@beweco/aurora-ui 0.1.6 → 0.1.7

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 (70) hide show
  1. package/dist/assets/css/styles.css +1 -1
  2. package/dist/index.cjs.js +2002 -1441
  3. package/dist/index.esm.js +2018 -1464
  4. package/dist/types/components/analytics-card/AnalyticsCard.d.ts +10 -0
  5. package/dist/types/components/analytics-card/AnalyticsCard.d.ts.map +1 -0
  6. package/dist/types/components/analytics-card/AnalyticsCard.types.d.ts +65 -0
  7. package/dist/types/components/analytics-card/AnalyticsCard.types.d.ts.map +1 -0
  8. package/dist/types/components/analytics-card/index.d.ts +3 -0
  9. package/dist/types/components/analytics-card/index.d.ts.map +1 -0
  10. package/dist/types/components/autocomplete/index.d.ts +1 -1
  11. package/dist/types/components/autocomplete/index.d.ts.map +1 -1
  12. package/dist/types/components/button/index.d.ts +2 -2
  13. package/dist/types/components/button/index.d.ts.map +1 -1
  14. package/dist/types/components/copy-text/CopyText.d.ts +12 -0
  15. package/dist/types/components/copy-text/CopyText.d.ts.map +1 -0
  16. package/dist/types/components/copy-text/CopyText.types.d.ts +8 -0
  17. package/dist/types/components/copy-text/CopyText.types.d.ts.map +1 -0
  18. package/dist/types/components/copy-text/index.d.ts +3 -0
  19. package/dist/types/components/copy-text/index.d.ts.map +1 -0
  20. package/dist/types/components/datepicker/index.d.ts +2 -2
  21. package/dist/types/components/datepicker/index.d.ts.map +1 -1
  22. package/dist/types/components/daterangepicker/index.d.ts +2 -2
  23. package/dist/types/components/daterangepicker/index.d.ts.map +1 -1
  24. package/dist/types/components/h1/H1.d.ts +3 -0
  25. package/dist/types/components/h1/H1.d.ts.map +1 -0
  26. package/dist/types/components/h1/index.d.ts +2 -0
  27. package/dist/types/components/h1/index.d.ts.map +1 -0
  28. package/dist/types/components/multi-step-wizard/MultiStepWizard.d.ts +3 -0
  29. package/dist/types/components/multi-step-wizard/MultiStepWizard.d.ts.map +1 -0
  30. package/dist/types/components/multi-step-wizard/MultiStepWizard.types.d.ts +20 -0
  31. package/dist/types/components/multi-step-wizard/MultiStepWizard.types.d.ts.map +1 -0
  32. package/dist/types/components/multi-step-wizard/_internal/MultiStepSidebar.d.ts +4 -0
  33. package/dist/types/components/multi-step-wizard/_internal/MultiStepSidebar.d.ts.map +1 -0
  34. package/dist/types/components/multi-step-wizard/_internal/MultiStepSidebar.types.d.ts +13 -0
  35. package/dist/types/components/multi-step-wizard/_internal/MultiStepSidebar.types.d.ts.map +1 -0
  36. package/dist/types/components/multi-step-wizard/_internal/MultistepNavigationButtons.d.ts +4 -0
  37. package/dist/types/components/multi-step-wizard/_internal/MultistepNavigationButtons.d.ts.map +1 -0
  38. package/dist/types/components/multi-step-wizard/_internal/MultistepNavigationButtons.types.d.ts +8 -0
  39. package/dist/types/components/multi-step-wizard/_internal/MultistepNavigationButtons.types.d.ts.map +1 -0
  40. package/dist/types/components/multi-step-wizard/_internal/index.d.ts +3 -0
  41. package/dist/types/components/multi-step-wizard/_internal/index.d.ts.map +1 -0
  42. package/dist/types/components/multi-step-wizard/index.d.ts +3 -0
  43. package/dist/types/components/multi-step-wizard/index.d.ts.map +1 -0
  44. package/dist/types/components/promotional-banner/PromotionalBanner.d.ts +7 -0
  45. package/dist/types/components/promotional-banner/PromotionalBanner.d.ts.map +1 -0
  46. package/dist/types/components/promotional-banner/PromotionalBanner.types.d.ts +69 -0
  47. package/dist/types/components/promotional-banner/PromotionalBanner.types.d.ts.map +1 -0
  48. package/dist/types/components/promotional-banner/index.d.ts +3 -0
  49. package/dist/types/components/promotional-banner/index.d.ts.map +1 -0
  50. package/dist/types/components/row-steps/RowSteps.d.ts +4 -0
  51. package/dist/types/components/row-steps/RowSteps.d.ts.map +1 -0
  52. package/dist/types/components/row-steps/RowSteps.types.d.ts +21 -0
  53. package/dist/types/components/row-steps/RowSteps.types.d.ts.map +1 -0
  54. package/dist/types/components/row-steps/index.d.ts +3 -0
  55. package/dist/types/components/row-steps/index.d.ts.map +1 -0
  56. package/dist/types/components/step-indicator/StepIndicator.d.ts +4 -0
  57. package/dist/types/components/step-indicator/StepIndicator.d.ts.map +1 -0
  58. package/dist/types/components/step-indicator/StepIndicator.types.d.ts +14 -0
  59. package/dist/types/components/step-indicator/StepIndicator.types.d.ts.map +1 -0
  60. package/dist/types/components/step-indicator/index.d.ts +3 -0
  61. package/dist/types/components/step-indicator/index.d.ts.map +1 -0
  62. package/dist/types/components/vertical-steps/VerticalSteps.d.ts +4 -0
  63. package/dist/types/components/vertical-steps/VerticalSteps.d.ts.map +1 -0
  64. package/dist/types/components/vertical-steps/VerticalSteps.types.d.ts +57 -0
  65. package/dist/types/components/vertical-steps/VerticalSteps.types.d.ts.map +1 -0
  66. package/dist/types/components/vertical-steps/index.d.ts +3 -0
  67. package/dist/types/components/vertical-steps/index.d.ts.map +1 -0
  68. package/dist/types/index.d.ts +18 -11
  69. package/dist/types/index.d.ts.map +1 -1
  70. package/package.json +4 -2
package/dist/index.cjs.js CHANGED
@@ -4,6 +4,8 @@ var react = require('@heroui/react');
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
  var React = require('react');
6
6
  var react$1 = require('@iconify/react');
7
+ var recharts = require('recharts');
8
+ var framerMotion = require('framer-motion');
7
9
  var reactDom = require('react-dom');
8
10
  var useTheme = require('@heroui/use-theme');
9
11
 
@@ -62,25 +64,6 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
62
64
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
63
65
  };
64
66
 
65
- /**
66
- * AutoComplete genérico reutilizable basado en HeroUI siguiendo las reglas de diseño BeweOS.
67
- *
68
- * Reglas aplicadas:
69
- * - Variant: Bordered (por defecto)
70
- * - Radius: md (por defecto)
71
- * - labelPlacement: Outside
72
- * - Size: sm, md, lg (configurable)
73
- */
74
- var AutoComplete = function (_a) {
75
- var label = _a.label, id = _a.id, _b = _a.size, size = _b === void 0 ? "md" : _b, _c = _a.variant, variant = _c === void 0 ? "bordered" : _c, _d = _a.radius, radius = _d === void 0 ? "md" : _d, props = __rest(_a, ["label", "id", "size", "variant", "radius"]);
76
- var generatedId = React.useId();
77
- var autoId = id || generatedId;
78
- return (jsxRuntime.jsxs("div", { children: [label && (jsxRuntime.jsx("label", { htmlFor: autoId, className: "block mb-2 text-tiny text-default-600", children: label })), jsxRuntime.jsx(react.Autocomplete, __assign({}, props, { id: autoId, label: undefined, labelPlacement: "outside", variant: variant, size: size, radius: radius, classNames: {
79
- base: "[&_[data-slot=input-wrapper][data-focus=true]]:!border-primary-500",
80
- popoverContent: "[&_li[data-hover=true]]:!bg-primary-50 [&_li[data-hover=true]]:!text-default-600 [&_li]:!text-default-500",
81
- } }))] }));
82
- };
83
-
84
67
  exports.HolidayType = void 0;
85
68
  (function (HolidayType) {
86
69
  HolidayType["SingleDay"] = "singleDay";
@@ -155,7 +138,7 @@ var Input = function (_a) {
155
138
  } })));
156
139
  };
157
140
 
158
- var defaultTranslations$3 = {
141
+ var defaultTranslations$6 = {
159
142
  addHolidayTitle: "Add holiday",
160
143
  dayOption: "Day",
161
144
  dateRangeOption: "Date range",
@@ -179,7 +162,7 @@ var INITIAL_HOLIDAY_STATE = {
179
162
  */
180
163
  var AddHolidayForm = function (_a) {
181
164
  var onAddHoliday = _a.onAddHoliday, translations = _a.translations, className = _a.className, radioGroupProps = _a.radioGroupProps, dateRangePickerProps = _a.dateRangePickerProps, buttonProps = _a.buttonProps;
182
- var t = __assign(__assign({}, defaultTranslations$3), translations);
165
+ var t = __assign(__assign({}, defaultTranslations$6), translations);
183
166
  var _b = React.useState(INITIAL_HOLIDAY_STATE), newHoliday = _b[0], setNewHoliday = _b[1];
184
167
  /**
185
168
  * A boolean flag that determines if a date has been set.
@@ -239,1249 +222,176 @@ var AddHolidayForm = function (_a) {
239
222
  }, "aria-label": t.optionalTitle }), jsxRuntime.jsx("div", { className: "w-full", children: jsxRuntime.jsx(Button, __assign({ size: "sm", fullWidth: true, variant: "flat", startContent: jsxRuntime.jsx(IconComponent, { icon: "solar:add-circle-outline" }), onPress: handleAddHoliday, isDisabled: !isDateSet }, buttonProps, { children: t.addButton })) })] }));
240
223
  };
241
224
 
242
- function normalizeClass(value) {
243
- if (typeof value === "string") {
244
- return value || undefined;
225
+ var H2 = function (_a) {
226
+ var children = _a.children, className = _a.className, props = __rest(_a, ["children", "className"]);
227
+ return (jsxRuntime.jsx("h2", __assign({ className: react.cn("text-lg font-medium", className) }, props, { children: children })));
228
+ };
229
+
230
+ var P = function (_a) {
231
+ var children = _a.children, className = _a.className, props = __rest(_a, ["children", "className"]);
232
+ return (jsxRuntime.jsx("p", __assign({ className: react.cn("text-sm text-default-500", className) }, props, { children: children })));
233
+ };
234
+
235
+ var defaultTranslations$5 = {
236
+ title: "Analytics",
237
+ description: "Monthly growth of your metrics during the selected period",
238
+ viewDetails: "View Details",
239
+ exportData: "Export Data",
240
+ setAlert: "Set Alert",
241
+ months6: "6 Months",
242
+ months3: "3 Months",
243
+ days30: "30 Days",
244
+ days7: "7 Days",
245
+ hours24: "24 Hours",
246
+ };
247
+ var formatValue = function (value, type) {
248
+ if (type === "number") {
249
+ if (value >= 1000000) {
250
+ return "".concat((value / 1000000).toFixed(1), "M");
251
+ }
252
+ if (value >= 1000) {
253
+ return "".concat((value / 1000).toFixed(0), "k");
254
+ }
255
+ return value.toLocaleString();
245
256
  }
246
- if (Array.isArray(value)) {
247
- return value.filter(Boolean).join(" ") || undefined;
257
+ if (type === "percentage") {
258
+ return "".concat(value, "%");
248
259
  }
249
- return undefined;
250
- }
251
- var getSectionClasses = function (isCollapsed, sectionClassesProp) {
252
- if (sectionClassesProp === void 0) { sectionClassesProp = {}; }
253
- return (__assign(__assign({}, Object.fromEntries(Object.entries(sectionClassesProp).map(function (_a) {
254
- var k = _a[0], v = _a[1];
255
- return [k, normalizeClass(v)];
256
- }))), { base: normalizeClass(react.cn(sectionClassesProp === null || sectionClassesProp === void 0 ? void 0 : sectionClassesProp.base, "w-full", {
257
- "p-0 max-w-[44px]": isCollapsed,
258
- })), group: normalizeClass(react.cn(sectionClassesProp === null || sectionClassesProp === void 0 ? void 0 : sectionClassesProp.group, {
259
- "flex flex-col gap-1": isCollapsed,
260
- })), heading: normalizeClass(react.cn(sectionClassesProp === null || sectionClassesProp === void 0 ? void 0 : sectionClassesProp.heading, {
261
- hidden: isCollapsed,
262
- })) }));
260
+ return value;
263
261
  };
264
- var getItemClasses = function (isCollapsed, itemClassesProp) {
265
- if (itemClassesProp === void 0) { itemClassesProp = {}; }
266
- return (__assign(__assign({}, Object.fromEntries(Object.entries(itemClassesProp).map(function (_a) {
267
- var k = _a[0], v = _a[1];
268
- return [k, normalizeClass(v)];
269
- }))), { base: normalizeClass(react.cn(itemClassesProp === null || itemClassesProp === void 0 ? void 0 : itemClassesProp.base, {
270
- "w-11 h-11 gap-0 p-0": isCollapsed,
271
- })) }));
262
+ var formatMonth = function (month) {
263
+ var _a;
264
+ var monthNumber = (_a = {
265
+ Jan: 0,
266
+ Feb: 1,
267
+ Mar: 2,
268
+ Apr: 3,
269
+ May: 4,
270
+ Jun: 5,
271
+ Jul: 6,
272
+ Aug: 7,
273
+ Sep: 8,
274
+ Oct: 9,
275
+ Nov: 10,
276
+ Dec: 11,
277
+ }[month]) !== null && _a !== void 0 ? _a : 0;
278
+ return new Intl.DateTimeFormat("en-US", { month: "long" }).format(new Date(2024, monthNumber, 1));
272
279
  };
273
-
274
- var EnumMenuNavListItem;
275
- (function (EnumMenuNavListItem) {
276
- EnumMenuNavListItem["Nest"] = "nest";
277
- })(EnumMenuNavListItem || (EnumMenuNavListItem = {}));
278
-
279
280
  /**
280
- * @component MenuNavList
281
- * @description A versatile navigation list component that can be displayed in an expanded or collapsed state.
282
- * It supports nested items, sections, and tooltips for items in the collapsed state.
283
- *
284
- * @param {MenuNavListProps} props - Props for configuring the component.
285
- * @param {MenuNavListItem[]} props.items - Array of items to display in the list.
286
- * @param {boolean} [props.isCollapsed] - If `true`, the menu is displayed in its collapsed state (icons only).
287
- * @param {React.Key} [props.defaultSelectedKey] - The key of the default selected item.
288
- * @param {(key: React.Key) => void} [props.onSelect] - Callback executed when an item is selected.
289
- * @param {boolean} [props.hideEndContent] - If `true`, hides the end content of the items.
290
- * @param {object} [props.sectionClasses] - CSS classes to customize the sections.
291
- * @param {object} [props.itemClasses] - CSS classes to customize the items.
292
- * @param {string} [props.iconClassName] - CSS class for the icons.
293
- * @param {object} [props.classNames] - CSS classes to customize the Listbox component.
294
- * @param {string} [props.className] - CSS class for the main container.
281
+ * AnalyticsCard genérico reutilizable basado en HeroUI siguiendo las reglas de diseño BeweOS.
295
282
  *
296
- * @forwardRef
283
+ * 🚨 This component requires installing the `recharts` package:
284
+ * `npm install recharts`
297
285
  */
298
- var MenuNavList = React.forwardRef(function (_a, ref) {
299
- var items = _a.items, isCollapsed = _a.isCollapsed, defaultSelectedKey = _a.defaultSelectedKey; _a.onSelect; var hideEndContent = _a.hideEndContent, _b = _a.sectionClasses, sectionClassesProp = _b === void 0 ? {} : _b, _c = _a.itemClasses, itemClassesProp = _c === void 0 ? {} : _c, iconClassName = _a.iconClassName, classNames = _a.classNames, className = _a.className, props = __rest(_a, ["items", "isCollapsed", "defaultSelectedKey", "onSelect", "hideEndContent", "sectionClasses", "itemClasses", "iconClassName", "classNames", "className"]);
300
- var _d = React.useState(defaultSelectedKey), selected = _d[0], setSelected = _d[1];
301
- // Component styles
302
- var sectionClasses = getSectionClasses(isCollapsed, sectionClassesProp);
303
- var itemClasses = getItemClasses(isCollapsed, itemClassesProp);
304
- // Handles the click event on an item, updating the selection state.
305
- // biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
306
- var handleItemPress = React.useCallback(function (item, parentKey) {
307
- var keySelected = typeof parentKey === "string" ? parentKey : item.key;
308
- setSelected(keySelected);
309
- // Force blur to remove hover state after click.
310
- if (document.activeElement instanceof HTMLElement) {
311
- document.activeElement.blur();
312
- }
313
- }, [setSelected]);
314
- // Renders the item displayed inside the Popover when the menu is collapsed.
315
- var renderCompactItem = React.useCallback(function (item, parentKey) {
316
- var _a, _b;
317
- return (React.createElement(react.ListboxItem, __assign({}, item, { key: item.key, endContent: (_a = item.endContent) !== null && _a !== void 0 ? _a : null, startContent: item.icon ? (jsxRuntime.jsx(IconComponent, { className: react.cn("text-default-500", "group-data-[selected=true]:text-default-600", iconClassName), icon: item.icon, size: "lg" })) : (((_b = item.startContent) !== null && _b !== void 0 ? _b : null)), textValue: item.title, title: item.title, className: "data-[hover=true]:text-default-600", onPress: function () { return handleItemPress(item, parentKey); } })));
318
- }, [handleItemPress, iconClassName]);
319
- // Renders a nested item, i.e., an item that has sub-items.
320
- // biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
321
- var renderNestItem = React.useCallback(function (item) {
322
- var _a, _b, _c, _d, _e, _f, _g;
323
- var isNestType = item.items &&
324
- ((_a = item.items) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
325
- (item === null || item === void 0 ? void 0 : item.type) === EnumMenuNavListItem.Nest;
326
- if (isNestType) {
327
- item.href = undefined;
328
- }
329
- return (React.createElement(react.ListboxItem, __assign({}, item, { key: item.key, classNames: {
330
- base: react.cn({
331
- "h-auto p-0": !isCollapsed && isNestType,
332
- }, {
333
- "inline-block w-11": isCollapsed && isNestType,
334
- }, {
335
- "data-[selected=true]:bg-primary-100 h-11 justify-center items-center flex": isCollapsed && isNestType,
336
- }, "rounded-large"),
337
- }, endContent: isCollapsed || isNestType || hideEndContent
338
- ? null
339
- : ((_b = item.endContent) !== null && _b !== void 0 ? _b : null), startContent: isCollapsed || isNestType ? null : item.icon ? (jsxRuntime.jsx(IconComponent, { className: react.cn("text-default-500 group-data-[selected=true]:text-foreground", iconClassName), icon: item.icon, size: "lg" })) : (((_c = item.startContent) !== null && _c !== void 0 ? _c : null)), title: isCollapsed || isNestType ? null : item.title }),
340
- isCollapsed && isNestType ? (jsxRuntime.jsxs(react.Popover, { placement: "right", offset: 10, children: [jsxRuntime.jsx(react.PopoverTrigger, { children: jsxRuntime.jsx("div", { className: "flex w-full items-center justify-center", children: jsxRuntime.jsx(react.Tooltip, { content: item.title, placement: "right", classNames: {
341
- base: "text-default-500",
342
- }, children: jsxRuntime.jsx("div", { className: "flex w-full items-center justify-center", children: item.icon ? (jsxRuntime.jsx(IconComponent, { className: react.cn("text-default-500 group-data-[selected=true]:text-default-600", iconClassName), icon: item.icon, size: "lg" })) : (((_d = item.startContent) !== null && _d !== void 0 ? _d : null)) }) }) }) }), jsxRuntime.jsx(react.PopoverContent, { className: "p-0", children: jsxRuntime.jsxs("div", { className: "min-w-[200px] rounded-large p-2", children: [jsxRuntime.jsx("div", { className: "p-2 text-small font-semibold text-default-500", children: item.title }), jsxRuntime.jsx(react.Listbox, { className: "mt-0.5 text-default-500", "aria-label": "Nested menu items", items: item.items, variant: "flat", children: item.items && ((_e = item.items) === null || _e === void 0 ? void 0 : _e.length) > 0
343
- ? item.items.map(function (child) {
344
- return renderCompactItem(child, item.key);
345
- })
346
- : renderCompactItem(item) })] }) })] })) : null,
347
- !isCollapsed && isNestType ? (jsxRuntime.jsx(react.Accordion, { className: "p-0", children: jsxRuntime.jsx(react.AccordionItem, { "aria-label": item.title, classNames: {
348
- heading: "pr-3 group-data-[selected=true]:bg-primary-100 rounded-large",
349
- trigger: "p-0",
350
- content: "py-0 pl-4",
351
- }, title: item.icon ? (jsxRuntime.jsxs("div", { className: "flex h-11 items-center gap-2 px-3 py-1.5", children: [jsxRuntime.jsx(IconComponent, { className: react.cn("text-default-500 group-data-[selected=true]:text-default-600", iconClassName), icon: item.icon, size: "lg" }), jsxRuntime.jsx("span", { className: "text-small font-medium text-default-500 group-data-[selected=true]:text-default-600", children: item.title })] })) : (((_f = item.startContent) !== null && _f !== void 0 ? _f : null)), children: item.items && ((_g = item.items) === null || _g === void 0 ? void 0 : _g.length) > 0 ? (jsxRuntime.jsx(react.Listbox, { className: "mt-0.5 text-default-500", classNames: {
352
- list: react.cn("border-l border-default-200 pl-4"),
353
- }, items: item.items, variant: "flat", children: item.items.map(function (child) { return renderItem(child, item.key); }) })) : (renderItem(item)) }, item.key) })) : null));
354
- }, [isCollapsed, hideEndContent, iconClassName, items, selected]);
355
- // Renders a simple item (without children) in the navigation list.
356
- // biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
357
- var renderItem = React.useCallback(function (item, parentKey) {
358
- var _a, _b, _c, _d;
359
- var isNestType = item.items &&
360
- ((_a = item.items) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
361
- (item === null || item === void 0 ? void 0 : item.type) === EnumMenuNavListItem.Nest;
362
- if (isNestType) {
363
- return renderNestItem(item);
364
- }
365
- var isItemSelected = selected === item.key;
366
- return (React.createElement(react.ListboxItem, __assign({}, item, { key: item.key, endContent: isCollapsed || hideEndContent ? null : ((_b = item.endContent) !== null && _b !== void 0 ? _b : null), startContent: isCollapsed ? null : item.icon ? (jsxRuntime.jsx(IconComponent, { className: react.cn("text-default-500", "group-data-[selected=true]:text-default-600", iconClassName), icon: item.icon, size: "lg" })) : (((_c = item.startContent) !== null && _c !== void 0 ? _c : null)), textValue: item.title, title: isCollapsed ? null : item.title, onPress: function () { return handleItemPress(item, parentKey); }, "aria-selected": isItemSelected, "aria-label": item.title || "Menu item ".concat(item.key) }), isCollapsed ? (jsxRuntime.jsx(react.Tooltip, { content: item.title, placement: "right", closeDelay: 200, shouldCloseOnBlur: false, classNames: {
367
- base: "text-default-500",
368
- }, children: jsxRuntime.jsx("div", { className: "flex w-full items-center justify-center", "aria-hidden": "true", children: item.icon ? (jsxRuntime.jsx(IconComponent, { className: react.cn("text-default-500", "group-data-[selected=true]:text-default-600", iconClassName), icon: item.icon, size: "lg" })) : (((_d = item.startContent) !== null && _d !== void 0 ? _d : null)) }) })) : null));
369
- },
370
- // eslint-disable-next-line react-hooks/exhaustive-deps
371
- [isCollapsed, hideEndContent, iconClassName, itemClasses === null || itemClasses === void 0 ? void 0 : itemClasses.base]);
372
- return (jsxRuntime.jsx(react.Listbox, __assign({ ref: ref, hideSelectedIcon: true, as: "nav", className: react.cn("list-none", className), classNames: __assign(__assign({}, classNames), { list: react.cn("items-center", classNames === null || classNames === void 0 ? void 0 : classNames.list) }), color: "default", itemClasses: __assign(__assign({}, itemClasses), { base: react.cn("px-3 min-h-11 rounded-large h-[44px] data-[selected=true]:bg-primary-100", itemClasses === null || itemClasses === void 0 ? void 0 : itemClasses.base), title: react.cn("text-small font-medium text-default-500 group-data-[selected=true]:text-default-600 ", itemClasses === null || itemClasses === void 0 ? void 0 : itemClasses.title) }), items: items, selectedKeys: [selected], selectionMode: "single", variant: "flat" }, props, { children: function (item) {
373
- var _a, _b;
374
- return item.items &&
375
- ((_a = item.items) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
376
- (item === null || item === void 0 ? void 0 : item.type) === EnumMenuNavListItem.Nest ? (renderNestItem(item)) : item.items && ((_b = item.items) === null || _b === void 0 ? void 0 : _b.length) > 0 ? (jsxRuntime.jsx(react.ListboxSection, { classNames: sectionClasses, showDivider: isCollapsed, title: item.title, children: item.items.map(renderItem) }, item.key)) : (renderItem(item));
377
- } }), isCollapsed ? "compact" : "default"));
378
- });
379
- MenuNavList.displayName = "MenuNavList";
286
+ var AnalyticsCard = function (_a) {
287
+ var _b, _c;
288
+ var data = _a.data, _d = _a.showTimePeriods, showTimePeriods = _d === void 0 ? true : _d, _e = _a.showDropdownMenu, showDropdownMenu = _e === void 0 ? true : _e, _f = _a.showMetricCards, showMetricCards = _f === void 0 ? true : _f, onChartChange = _a.onChartChange, onMenuAction = _a.onMenuAction, onTimePeriodChange = _a.onTimePeriodChange, _g = _a.translations, translations = _g === void 0 ? {} : _g, props = __rest(_a, ["data", "showTimePeriods", "showDropdownMenu", "showMetricCards", "onChartChange", "onMenuAction", "onTimePeriodChange", "translations"]);
289
+ var t = __assign(__assign({}, defaultTranslations$5), translations);
290
+ var _h = React.useState((_c = (_b = data[0]) === null || _b === void 0 ? void 0 : _b.key) !== null && _c !== void 0 ? _c : ""), activeChart = _h[0], setActiveChart = _h[1];
291
+ var activeChartData = React.useMemo(function () {
292
+ var _a;
293
+ var chart = data.find(function (d) { return d.key === activeChart; });
294
+ return {
295
+ chartData: (_a = chart === null || chart === void 0 ? void 0 : chart.chartData) !== null && _a !== void 0 ? _a : [],
296
+ color: (chart === null || chart === void 0 ? void 0 : chart.changeType) === "positive"
297
+ ? "success"
298
+ : (chart === null || chart === void 0 ? void 0 : chart.changeType) === "negative"
299
+ ? "danger"
300
+ : "default",
301
+ suffix: chart === null || chart === void 0 ? void 0 : chart.suffix,
302
+ type: chart === null || chart === void 0 ? void 0 : chart.type,
303
+ };
304
+ }, [activeChart, data]);
305
+ var chartData = activeChartData.chartData, color = activeChartData.color, suffix = activeChartData.suffix, type = activeChartData.type;
306
+ var handleChartChange = function (chartKey) {
307
+ setActiveChart(chartKey);
308
+ onChartChange === null || onChartChange === void 0 ? void 0 : onChartChange(chartKey);
309
+ };
310
+ var handleMenuAction = function (action) {
311
+ onMenuAction === null || onMenuAction === void 0 ? void 0 : onMenuAction(action);
312
+ };
313
+ var handleTimePeriodChange = function (period) {
314
+ onTimePeriodChange === null || onTimePeriodChange === void 0 ? void 0 : onTimePeriodChange(period);
315
+ };
316
+ return (jsxRuntime.jsx(react.Card, __assign({ as: "dl", className: "dark:border-default-100 border border-transparent" }, props, { children: jsxRuntime.jsxs("section", { className: "flex flex-col flex-nowrap", children: [jsxRuntime.jsx("div", { className: "flex flex-col justify-between gap-y-2 p-6", children: jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-2", children: [jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-0", children: [jsxRuntime.jsx(H2, { children: t.title }), jsxRuntime.jsx(P, { children: t.description })] }), jsxRuntime.jsx(react.Spacer, { y: 2 }), showTimePeriods && (jsxRuntime.jsxs(react.Tabs, { size: "md", className: " self-end", onSelectionChange: function (key) { return handleTimePeriodChange(String(key)); }, children: [jsxRuntime.jsx(react.Tab, { title: t.months6 }, "6-months"), jsxRuntime.jsx(react.Tab, { title: t.months3 }, "3-months"), jsxRuntime.jsx(react.Tab, { title: t.days30 }, "30-days"), jsxRuntime.jsx(react.Tab, { title: t.days7 }, "7-days"), jsxRuntime.jsx(react.Tab, { title: t.hours24 }, "24-hours")] })), showMetricCards && (jsxRuntime.jsx("div", { className: "mt-2 flex w-full items-center", children: jsxRuntime.jsx("div", { className: "-my-3 flex w-full max-w-[800px] items-center gap-x-3 overflow-x-auto py-3", children: data.map(function (_a) {
317
+ var key = _a.key, change = _a.change, changeType = _a.changeType, type = _a.type, value = _a.value, title = _a.title;
318
+ return (jsxRuntime.jsxs("button", { type: "button", className: react.cn("rounded-medium flex w-full flex-col gap-2 p-3 transition-colors", {
319
+ "bg-default-100": activeChart === key,
320
+ }), onClick: function () { return handleChartChange(key); }, children: [jsxRuntime.jsx("span", { className: react.cn("text-small text-default-500 font-medium transition-colors", {
321
+ "text-primary": activeChart === key,
322
+ }), children: title }), jsxRuntime.jsxs("div", { className: "flex items-center gap-x-3", children: [jsxRuntime.jsx("span", { className: "text-foreground text-2xl font-bold", children: formatValue(value, type) }), jsxRuntime.jsx(react.Chip, { classNames: {
323
+ content: "font-medium",
324
+ }, color: changeType === "positive"
325
+ ? "success"
326
+ : changeType === "negative"
327
+ ? "danger"
328
+ : "default", radius: "md", size: "sm", startContent: changeType === "positive" ? (jsxRuntime.jsx(IconComponent, { icon: "solar:arrow-right-up-linear", size: "sm" })) : changeType === "negative" ? (jsxRuntime.jsx(IconComponent, { icon: "solar:arrow-right-down-linear", size: "sm" })) : (jsxRuntime.jsx(IconComponent, { icon: "solar:arrow-right-linear", size: "sm" })), variant: "bordered", children: jsxRuntime.jsx("span", { children: change }) })] })] }, key));
329
+ }) }) }))] }) }), jsxRuntime.jsx(recharts.ResponsiveContainer, { className: "min-h-[300px] [&_.recharts-surface]:outline-hidden", height: "100%", width: "100%", children: jsxRuntime.jsxs(recharts.AreaChart, { accessibilityLayer: true, data: chartData, height: 300, margin: {
330
+ left: 0,
331
+ right: 0,
332
+ }, width: 500, children: [jsxRuntime.jsx("defs", { children: jsxRuntime.jsxs("linearGradient", { id: "colorGradient", x1: "0", x2: "0", y1: "0", y2: "1", children: [jsxRuntime.jsx("stop", { offset: "10%", stopColor: "hsl(var(--heroui-".concat(color, "-500))"), stopOpacity: 0.3 }), jsxRuntime.jsx("stop", { offset: "100%", stopColor: "hsl(var(--heroui-".concat(color, "-100))"), stopOpacity: 0.1 })] }) }), jsxRuntime.jsx(recharts.CartesianGrid, { horizontalCoordinatesGenerator: function () { return [200, 150, 100, 50]; }, stroke: "hsl(var(--heroui-default-200))", strokeDasharray: "3 3", vertical: false }), jsxRuntime.jsx(recharts.XAxis, { axisLine: false, dataKey: "month", style: {
333
+ fontSize: "var(--heroui-font-size-tiny)",
334
+ transform: "translateX(-40px)",
335
+ }, tickLine: false }), jsxRuntime.jsx(recharts.Tooltip, { content: function (_a) {
336
+ var label = _a.label, payload = _a.payload;
337
+ return (jsxRuntime.jsx("div", { className: "rounded-medium bg-foreground text-tiny shadow-small flex h-auto min-w-[120px] items-center gap-x-2 p-2", children: jsxRuntime.jsxs("div", { className: "flex w-full flex-col gap-y-0", children: [payload === null || payload === void 0 ? void 0 : payload.map(function (p, index) {
338
+ var name = p.name;
339
+ var value = p.value;
340
+ return (jsxRuntime.jsx("div", { className: "flex w-full items-center gap-x-2", children: jsxRuntime.jsxs("div", { className: "text-small text-background flex w-full items-center gap-x-1", children: [jsxRuntime.jsx("span", { children: formatValue(value, type) }), jsxRuntime.jsx("span", { children: suffix })] }) }, "".concat(index, "-").concat(name)));
341
+ }), jsxRuntime.jsxs("span", { className: "text-small text-foreground-400 font-medium", children: [formatMonth(String(label || "")), " 25, 2024"] })] }) }));
342
+ }, cursor: {
343
+ strokeWidth: 0,
344
+ } }), jsxRuntime.jsx(recharts.Area, { activeDot: {
345
+ stroke: "hsl(var(--heroui-".concat(color, "))"),
346
+ strokeWidth: 2,
347
+ fill: "hsl(var(--heroui-background))",
348
+ r: 5,
349
+ }, dot: {
350
+ stroke: "hsl(var(--heroui-".concat(color, "))"),
351
+ strokeWidth: 2,
352
+ fill: "hsl(var(--heroui-".concat(color, "))"),
353
+ r: 4,
354
+ }, animationDuration: 1000, animationEasing: "ease", dataKey: "value", fill: "url(#colorGradient)", stroke: "hsl(var(--heroui-".concat(color, "))"), strokeWidth: 2, type: "monotone" })] }) }), showDropdownMenu && (jsxRuntime.jsxs(react.Dropdown, { classNames: {
355
+ content: "min-w-[120px]",
356
+ }, placement: "bottom-end", children: [jsxRuntime.jsx(react.DropdownTrigger, { children: jsxRuntime.jsx(react.Button, { isIconOnly: true, className: "absolute top-2 right-2 w-auto rounded-full", size: "lg", variant: "bordered", children: jsxRuntime.jsx(IconComponent, { icon: "solar:menu-dots-bold", size: "sm" }) }) }), jsxRuntime.jsxs(react.DropdownMenu, { itemClasses: {
357
+ title: "text-tiny",
358
+ }, variant: "bordered", onAction: function (key) { return handleMenuAction(String(key)); }, children: [jsxRuntime.jsx(react.DropdownItem, { children: t.viewDetails }, "view-details"), jsxRuntime.jsx(react.DropdownItem, { children: t.exportData }, "export-data"), jsxRuntime.jsx(react.DropdownItem, { children: t.setAlert }, "set-alert")] })] }))] }) })));
359
+ };
380
360
 
381
361
  /**
382
- * Sidebar menu component for navigation and user actions.
383
- * @param commerceInfo - Object with logo and name of the company.
384
- * @param userInfo - Object with user avatar, name, and email.
385
- * @param helpButton - Help button configuration.
386
- * @param upgradeCard - Optional upgrade card configuration.
387
- * @param isOpenSidebar - Controls sidebar visibility.
388
- * @param onOpenSidebarChange - Callback to open/close sidebar.
362
+ * AutoComplete genérico reutilizable basado en HeroUI siguiendo las reglas de diseño BeweOS.
363
+ *
364
+ * Reglas aplicadas:
365
+ * - Variant: Bordered (por defecto)
366
+ * - Radius: md (por defecto)
367
+ * - labelPlacement: Outside
368
+ * - Size: sm, md, lg (configurable)
389
369
  */
390
- var MenuComponent = React.memo(function Menu(_a) {
391
- var commerceInfo = _a.commerceInfo, userInfo = _a.userInfo, helpButton = _a.helpButton, upgradeCard = _a.upgradeCard, isOpenSidebar = _a.isOpenSidebar, onOpenSidebarChange = _a.onOpenSidebarChange, menuItems = _a.menuItems;
392
- // State to control menu collapse on desktop devices
393
- var _b = React.useState(false), isCollapsed = _b[0], setIsCollapsed = _b[1];
394
- // Memoized handlers for performance
395
- var handleSidebarClose = React.useCallback(function () {
396
- onOpenSidebarChange === null || onOpenSidebarChange === void 0 ? void 0 : onOpenSidebarChange(false);
397
- }, [onOpenSidebarChange]);
398
- var handleCollapseToggle = React.useCallback(function () {
399
- setIsCollapsed(function (prev) { return !prev; });
400
- }, []);
401
- var handleUpgradeClick = React.useCallback(function () {
402
- if (upgradeCard) {
403
- window.open(upgradeCard.buttonLink, "_blank");
404
- }
405
- }, [upgradeCard]);
406
- var handleHelpClick = React.useCallback(function () {
407
- window.open(helpButton.redirect, "_blank");
408
- }, [helpButton]);
409
- if (!isOpenSidebar) {
410
- return null;
411
- }
412
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("button", { type: "button", "aria-label": "Close sidebar", className: "fixed inset-0 bg-black bg-opacity-40 z-40 xs:block sm:hidden", onClick: handleSidebarClose, style: { border: "none", padding: 0, margin: 0 } }), jsxRuntime.jsx("div", { className: "container__menu ".concat(isCollapsed
413
- ? "container__menu--collapsed"
414
- : "container__menu--expanded"), children: jsxRuntime.jsxs("div", { className: "content__menu", children: [jsxRuntime.jsxs("div", { className: "content__menu--header", style: { flexDirection: isCollapsed ? "column-reverse" : "row" }, children: [jsxRuntime.jsxs("div", { className: "flex flex-row items-center justify-center ".concat(isCollapsed ? "gap-0" : "gap-2"), children: [jsxRuntime.jsx("div", { className: "flex h-8 w-8 items-center justify-center rounded-full bg-foreground", children: jsxRuntime.jsx("img", { src: commerceInfo.logo, alt: "Logo of ".concat(commerceInfo.name) }) }), jsxRuntime.jsx("span", { className: "collapsible-item text-small font-bold ", children: commerceInfo.name })] }), jsxRuntime.jsxs("div", { className: "flex items-center", children: [jsxRuntime.jsx(IconComponent, { icon: "material-symbols-light:close", size: "lg", className: "cursor-pointer block sm:hidden", onClick: handleSidebarClose }), jsxRuntime.jsx(IconComponent, { icon: isCollapsed
415
- ? "solar:alt-arrow-right-outline"
416
- : "solar:alt-arrow-left-outline", size: "lg", className: "hidden sm:block cursor-pointer", onClick: handleCollapseToggle })] })] }), jsxRuntime.jsx(react.Spacer, { y: 6 }), jsxRuntime.jsxs("div", { className: "content__menu--user ".concat(isCollapsed ? "gap-0" : "gap-3"), children: [jsxRuntime.jsx(react.Avatar, { size: "md", src: userInfo.avatar, color: userInfo.avatar === "" ? "warning" : "default", name: userInfo.name }), jsxRuntime.jsxs("div", { className: "collapsible-item flex flex-col", children: [jsxRuntime.jsx("p", { className: "text-small font-medium text-default-900", children: userInfo.name }), jsxRuntime.jsx("p", { className: "text-tiny text-default-400", children: userInfo.role })] })] }), jsxRuntime.jsx("div", { className: "".concat(!isCollapsed ? "flex-1" : "h-full", " min-h-0 py-6"), children: jsxRuntime.jsx("div", { className: "h-full overflow-y-auto pr-6 -mr-6 [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]", children: jsxRuntime.jsx(MenuNavList, { defaultSelectedKey: menuItems.selectedKey, items: menuItems.items, isCollapsed: isCollapsed }) }) }), upgradeCard && (jsxRuntime.jsxs("div", { className: "collapsible-item relative", children: [jsxRuntime.jsxs(react.Card, { className: "border-none overflow-visible shadow-none", shadow: "sm", children: [jsxRuntime.jsxs(react.CardBody, { className: "items-center py-5 text-center gap-1", children: [jsxRuntime.jsx("h3", { className: "text-medium font-medium text-default-900", children: upgradeCard.title }), jsxRuntime.jsx("p", { className: "text-small text-default-500 pb-3 whitespace-normal", children: upgradeCard.description })] }), jsxRuntime.jsx(react.CardFooter, { className: "absolute justify-center", style: { bottom: "-30px" }, children: jsxRuntime.jsx(react.Button, { className: "px-10 shadow-md", color: "primary", radius: "full", variant: "shadow", onPress: handleUpgradeClick, children: upgradeCard.buttonText }) })] }), jsxRuntime.jsx(react.Spacer, { y: 9 })] })), jsxRuntime.jsx("div", { className: "mt-auto flex flex-col justify-center items-center", children: jsxRuntime.jsx(react.Button, { fullWidth: true, className: " text-default-500 data-[hover=true]:text-default-600", startContent: jsxRuntime.jsx(IconComponent, { className: "text-default-500", icon: "solar:info-circle-line-duotone", size: "md" }), variant: "light", onPress: handleHelpClick, isIconOnly: isCollapsed, children: !isCollapsed && (jsxRuntime.jsx("span", { className: "collapsible-item", children: helpButton.title })) }) })] }) })] }));
370
+ var AutoComplete = function (_a) {
371
+ var label = _a.label, id = _a.id, _b = _a.size, size = _b === void 0 ? "md" : _b, _c = _a.variant, variant = _c === void 0 ? "bordered" : _c, _d = _a.radius, radius = _d === void 0 ? "md" : _d, props = __rest(_a, ["label", "id", "size", "variant", "radius"]);
372
+ var generatedId = React.useId();
373
+ var autoId = id || generatedId;
374
+ return (jsxRuntime.jsxs("div", { children: [label && (jsxRuntime.jsx("label", { htmlFor: autoId, className: "block mb-2 text-tiny text-default-600", children: label })), jsxRuntime.jsx(react.Autocomplete, __assign({}, props, { id: autoId, label: undefined, labelPlacement: "outside", variant: variant, size: size, radius: radius, classNames: {
375
+ base: "[&_[data-slot=input-wrapper][data-focus=true]]:!border-primary-500",
376
+ popoverContent: "[&_li[data-hover=true]]:!bg-primary-50 [&_li[data-hover=true]]:!text-default-600 [&_li]:!text-default-500",
377
+ } }))] }));
378
+ };
379
+
380
+ var ThemeContext = React.createContext({
381
+ mode: "light",
382
+ color: "blue",
383
+ // biome-ignore lint/suspicious/noEmptyBlockStatements: <explanation>
384
+ setMode: function () { },
385
+ // biome-ignore lint/suspicious/noEmptyBlockStatements: <explanation>
386
+ setColor: function () { },
417
387
  });
418
-
419
- // Lista simple de países con bandera emoji y código
420
- var countries = [
421
- { code: "+57", name: "Colombia", flag: "🇨🇴" },
422
- { code: "+54", name: "Argentina", flag: "🇦🇷" },
423
- { code: "+55", name: "Brazil", flag: "🇧🇷" },
424
- { code: "+52", name: "Mexico", flag: "🇲🇽" },
425
- { code: "+503", name: "El Salvador", flag: "🇸🇻" },
426
- { code: "+51", name: "Peru", flag: "🇵🇪" },
427
- { code: "+56", name: "Chile", flag: "🇨🇱" },
428
- { code: "+1", name: "United States", flag: "🇺🇸" },
429
- { code: "+7", name: "Russia", flag: "🇷🇺" },
430
- { code: "+20", name: "Egypt", flag: "🇪🇬" },
431
- { code: "+27", name: "South Africa", flag: "🇿🇦" },
432
- { code: "+33", name: "France", flag: "🇫🇷" },
433
- { code: "+34", name: "Spain", flag: "🇪🇸" },
434
- { code: "+39", name: "Italy", flag: "🇮🇹" },
435
- { code: "+44", name: "United Kingdom", flag: "🇬🇧" },
436
- { code: "+49", name: "Germany", flag: "🇩🇪" },
437
- { code: "+51", name: "Peru", flag: "🇵🇪" },
438
- { code: "+52", name: "Mexico", flag: "🇲🇽" },
439
- { code: "+54", name: "Argentina", flag: "🇦🇷" },
440
- { code: "+55", name: "Brazil", flag: "🇧🇷" },
441
- { code: "+56", name: "Chile", flag: "🇨🇱" },
442
- { code: "+57", name: "Colombia", flag: "🇨🇴" },
443
- { code: "+60", name: "Malaysia", flag: "🇲🇾" },
444
- { code: "+61", name: "Australia", flag: "🇦🇺" },
445
- { code: "+62", name: "Indonesia", flag: "🇮🇩" },
446
- { code: "+64", name: "New Zealand", flag: "🇳🇿" },
447
- { code: "+65", name: "Singapore", flag: "🇸🇬" },
448
- { code: "+66", name: "Thailand", flag: "🇹🇭" },
449
- { code: "+81", name: "Japan", flag: "🇯🇵" },
450
- { code: "+82", name: "South Korea", flag: "🇰🇷" },
451
- { code: "+84", name: "Vietnam", flag: "🇻🇳" },
452
- { code: "+86", name: "China", flag: "🇨🇳" },
453
- { code: "+91", name: "India", flag: "🇮🇳" },
454
- { code: "+351", name: "Portugal", flag: "🇵🇹" },
455
- { code: "+503", name: "El Salvador", flag: "🇸🇻" },
456
- { code: "+966", name: "Saudi Arabia", flag: "🇸🇦" },
457
- { code: "+971", name: "UAE", flag: "🇦🇪" },
458
- ];
459
- var uniqueCountries = Array.from(new Map(countries.map(function (item) { return [item.code + item.name, item]; })).values());
460
- // Traducciones por defecto
461
- var defaultTranslations$2 = {
462
- label: "Teléfono",
463
- placeholder: "Número de teléfono",
464
- searchPlaceholder: "Buscar país...",
465
- selectCountryAriaLabel: "Seleccionar país",
466
- expandListAriaLabel: "Desplegar lista de países",
467
- noCountriesFound: "No se encontraron países",
468
- };
469
-
470
- var Phone = function (_a) {
471
- var id = _a.id, label = _a.label, _b = _a.required, required = _b === void 0 ? false : _b, _c = _a.error, error = _c === void 0 ? false : _c, _d = _a.errorText, errorText = _d === void 0 ? "" : _d, value = _a.value, onChange = _a.onChange, onBlur = _a.onBlur, _e = _a.disabled, disabled = _e === void 0 ? false : _e, _f = _a.name, name = _f === void 0 ? "phone" : _f, _g = _a.translations, translations = _g === void 0 ? {} : _g;
472
- var _h = React.useState(false), isDropdownOpen = _h[0], setIsDropdownOpen = _h[1];
473
- var _j = React.useState(uniqueCountries[0]), selectedCountry = _j[0], setSelectedCountry = _j[1];
474
- var _k = React.useState(""), inputValue = _k[0], setInputValue = _k[1];
475
- var dropdownRef = React.useRef(null);
476
- var portalDropdownRef = React.useRef(null);
477
- var _l = React.useState({}), dropdownPosition = _l[0], setDropdownPosition = _l[1];
478
- var _m = React.useState(uniqueCountries), filteredCountries = _m[0], setFilteredCountries = _m[1];
479
- var t = __assign(__assign({}, defaultTranslations$2), translations);
480
- var finalLabel = label || t.label;
481
- React.useEffect(function () {
482
- if (value) {
483
- var found = uniqueCountries.find(function (c) { return c.code === value.countryCode; });
484
- if (found) {
485
- setSelectedCountry(found);
486
- }
487
- setInputValue(value.phoneNumber);
488
- }
489
- }, [value]);
490
- React.useEffect(function () {
491
- if (isDropdownOpen) {
492
- setFilteredCountries(uniqueCountries);
493
- }
494
- }, [isDropdownOpen]);
495
- React.useLayoutEffect(function () {
496
- if (isDropdownOpen && dropdownRef.current) {
497
- var rect = dropdownRef.current.getBoundingClientRect();
498
- setDropdownPosition({
499
- position: "absolute",
500
- top: "".concat(rect.bottom + window.scrollY + 4, "px"),
501
- left: "".concat(rect.left + window.scrollX, "px"),
502
- width: "15rem",
503
- zIndex: 50,
504
- });
505
- }
506
- }, [isDropdownOpen]);
507
- React.useEffect(function () {
508
- var handleClickOutside = function (event) {
509
- if (dropdownRef.current &&
510
- !dropdownRef.current.contains(event.target) &&
511
- portalDropdownRef.current &&
512
- !portalDropdownRef.current.contains(event.target)) {
513
- setIsDropdownOpen(false);
514
- }
515
- };
516
- if (isDropdownOpen) {
517
- document.addEventListener("mousedown", handleClickOutside);
518
- }
519
- return function () {
520
- document.removeEventListener("mousedown", handleClickOutside);
521
- };
522
- }, [isDropdownOpen]);
523
- var handleCountrySelect = function (country) {
524
- setSelectedCountry(country);
525
- setIsDropdownOpen(false);
526
- if (onChange) {
527
- onChange({ countryCode: country.code, phoneNumber: inputValue });
528
- }
529
- };
530
- var handleInputChange = function (e) {
531
- var val = e.target.value.replace(/\D/g, "");
532
- setInputValue(val);
533
- if (onChange) {
534
- onChange({ countryCode: selectedCountry.code, phoneNumber: val });
535
- }
536
- };
537
- return (jsxRuntime.jsxs("div", { className: "flex flex-col gap-1 w-full relative", id: id, children: [finalLabel && (jsxRuntime.jsxs("label", { htmlFor: "phone-input-".concat(name), className: "text-tiny text-default-500 mb-1", children: [finalLabel, " ", required && jsxRuntime.jsx("span", { className: "text-danger-500", children: "*" })] })), jsxRuntime.jsxs("div", { className: "flex items-center w-full min-h-[56px] transition-colors shadow-sm border-medium border-default-200 rounded-xl focus-within:border-primary-500 dark:focus-within:border-primary-500 ".concat(error ? "border-danger-500 " : "border-default-200").concat(disabled ? "opacity-60" : ""), children: [jsxRuntime.jsx("div", { className: "relative ml-2", ref: dropdownRef, children: jsxRuntime.jsxs("button", { type: "button", className: "flex items-center gap-1 px-4 h-10 rounded-xl bg-default-100 focus:outline-none transition-colors", onClick: function () { return setIsDropdownOpen(function (v) { return !v; }); }, disabled: disabled, tabIndex: 0, "aria-label": t.selectCountryAriaLabel, children: [jsxRuntime.jsx("span", { className: "text-lg", children: selectedCountry.flag }), jsxRuntime.jsx("span", { className: "text-xs text-default-500", children: selectedCountry.code }), jsxRuntime.jsxs("svg", { className: "w-4 h-4 text-default-500 ml-1", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", role: "img", "aria-label": t.expandListAriaLabel, children: [jsxRuntime.jsx("title", { children: t.expandListAriaLabel }), jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" })] })] }) }), jsxRuntime.jsx(react.Input, { type: "tel", className: "flex-1 border-none bg-transparent text-default-500 placeholder-default-500 px-2", placeholder: t.placeholder, value: inputValue, onChange: handleInputChange, onBlur: onBlur, disabled: disabled, name: name, autoComplete: "tel", id: "phone-input-".concat(name) })] }), error && errorText && (jsxRuntime.jsx("span", { className: "text-xs text-danger-500 mt-1", children: errorText })), isDropdownOpen &&
538
- reactDom.createPortal(jsxRuntime.jsxs("div", { ref: portalDropdownRef, style: dropdownPosition, className: "bg-content1 border border-default-200 rounded-lg shadow-lg z-50", children: [jsxRuntime.jsx("div", { className: "p-2", children: jsxRuntime.jsx("input", { type: "text", className: "w-full px-3 py-2 text-sm bg-default-100 border-medium border-default-200 text-default-500 rounded-lg focus:outline-none focus:border-primary-500", placeholder: t.searchPlaceholder, onChange: function (e) {
539
- var searchTerm = e.target.value.toLowerCase();
540
- var filtered = uniqueCountries.filter(function (country) {
541
- return country.name.toLowerCase().includes(searchTerm) ||
542
- country.code.toLowerCase().includes(searchTerm);
543
- });
544
- setFilteredCountries(filtered);
545
- } }) }), jsxRuntime.jsx("div", { className: "max-h-60 overflow-y-auto", children: filteredCountries.length > 0 ? (filteredCountries.map(function (country) { return (jsxRuntime.jsxs("button", { type: "button", className: "flex items-center w-full px-4 py-2.5 text-sm hover:bg-default-200 ".concat(country.code === selectedCountry.code
546
- ? "bg-primary-50"
547
- : ""), onClick: function () { return handleCountrySelect(country); }, children: [jsxRuntime.jsx("span", { className: "mr-3 text-lg", children: country.flag }), jsxRuntime.jsx("span", { className: "flex-1 text-left text-default-500", children: country.name }), jsxRuntime.jsx("span", { className: "text-xs text-default-500", children: country.code })] }, country.code)); })) : (jsxRuntime.jsx("div", { className: "px-4 py-2 text-sm text-default-500", children: t.noCountriesFound })) })] }), document.body)] }));
548
- };
549
-
550
- /**
551
- * Select genérico reutilizable basado en HeroUI siguiendo las reglas de diseño BeweOS.
552
- *
553
- * Reglas aplicadas:
554
- * - Variant: Bordered (por defecto)
555
- * - Radius: md (por defecto)
556
- * - labelPlacement: Outside
557
- * - Size: sm, md, lg (configurable)
558
- */
559
- var Select = function (_a) {
560
- var label = _a.label, id = _a.id, _b = _a.size, size = _b === void 0 ? "md" : _b, _c = _a.variant, variant = _c === void 0 ? "bordered" : _c, _d = _a.radius, radius = _d === void 0 ? "md" : _d, placeholder = _a.placeholder, props = __rest(_a, ["label", "id", "size", "variant", "radius", "placeholder"]);
561
- var generatedId = React.useId();
562
- var selectId = id || generatedId;
563
- return (jsxRuntime.jsx("div", { className: "group", children: jsxRuntime.jsx(react.Select, __assign({}, props, { id: selectId, label: label, labelPlacement: "outside", placeholder: placeholder, variant: variant, size: size, radius: radius, classNames: {
564
- label: "text-default-600 text-tiny group-data-[filled=true]:text-default-600",
565
- trigger: "data-[open=true]:!border-primary-500 data-[focus=true]:!border-primary-500 data-[disabled=true]:bg-default-100",
566
- popoverContent: "[&_[data-focus-visible=true]]:!outline-none [&_[data-selectable=true]:focus]:!bg-primary-50 [&_li]:!text-default-500 [&_li[data-hover=true]]:!text-default-600",
567
- } })) }));
568
- };
569
-
570
- function $14e0f24ef4ac5c92$export$c19a80a9721b80f6(a, b) {
571
- return $14e0f24ef4ac5c92$var$timeToMs(a) - $14e0f24ef4ac5c92$var$timeToMs(b);
572
- }
573
- function $14e0f24ef4ac5c92$var$timeToMs(a) {
574
- return a.hour * 3600000 + a.minute * 60000 + a.second * 1000 + a.millisecond;
575
- }
576
-
577
- function $735220c2d4774dd3$export$3e2544e88a25bff8(duration) {
578
- let inverseDuration = {};
579
- for(let key in duration)if (typeof duration[key] === 'number') inverseDuration[key] = -duration[key];
580
- return inverseDuration;
581
- }
582
- function $735220c2d4774dd3$export$e5d5e1c1822b6e56(value, fields) {
583
- let mutableValue = value.copy();
584
- if (fields.hour != null) mutableValue.hour = fields.hour;
585
- if (fields.minute != null) mutableValue.minute = fields.minute;
586
- if (fields.second != null) mutableValue.second = fields.second;
587
- if (fields.millisecond != null) mutableValue.millisecond = fields.millisecond;
588
- $735220c2d4774dd3$export$7555de1e070510cb(mutableValue);
589
- return mutableValue;
590
- }
591
- function $735220c2d4774dd3$var$balanceTime(time) {
592
- time.second += Math.floor(time.millisecond / 1000);
593
- time.millisecond = $735220c2d4774dd3$var$nonNegativeMod(time.millisecond, 1000);
594
- time.minute += Math.floor(time.second / 60);
595
- time.second = $735220c2d4774dd3$var$nonNegativeMod(time.second, 60);
596
- time.hour += Math.floor(time.minute / 60);
597
- time.minute = $735220c2d4774dd3$var$nonNegativeMod(time.minute, 60);
598
- let days = Math.floor(time.hour / 24);
599
- time.hour = $735220c2d4774dd3$var$nonNegativeMod(time.hour, 24);
600
- return days;
601
- }
602
- function $735220c2d4774dd3$export$7555de1e070510cb(time) {
603
- time.millisecond = Math.max(0, Math.min(time.millisecond, 1000));
604
- time.second = Math.max(0, Math.min(time.second, 59));
605
- time.minute = Math.max(0, Math.min(time.minute, 59));
606
- time.hour = Math.max(0, Math.min(time.hour, 23));
607
- }
608
- function $735220c2d4774dd3$var$nonNegativeMod(a, b) {
609
- let result = a % b;
610
- if (result < 0) result += b;
611
- return result;
612
- }
613
- function $735220c2d4774dd3$var$addTimeFields(time, duration) {
614
- time.hour += duration.hours || 0;
615
- time.minute += duration.minutes || 0;
616
- time.second += duration.seconds || 0;
617
- time.millisecond += duration.milliseconds || 0;
618
- return $735220c2d4774dd3$var$balanceTime(time);
619
- }
620
- function $735220c2d4774dd3$export$7ed87b6bc2506470(time, duration) {
621
- let res = time.copy();
622
- $735220c2d4774dd3$var$addTimeFields(res, duration);
623
- return res;
624
- }
625
- function $735220c2d4774dd3$export$fe34d3a381cd7501(time, duration) {
626
- return $735220c2d4774dd3$export$7ed87b6bc2506470(time, $735220c2d4774dd3$export$3e2544e88a25bff8(duration));
627
- }
628
- function $735220c2d4774dd3$export$dd02b3e0007dfe28(value, field, amount, options) {
629
- let mutable = value.copy();
630
- switch(field){
631
- case 'hour':
632
- {
633
- let hours = value.hour;
634
- let min = 0;
635
- let max = 23;
636
- if ((options === null || options === void 0 ? void 0 : options.hourCycle) === 12) {
637
- let isPM = hours >= 12;
638
- min = isPM ? 12 : 0;
639
- max = isPM ? 23 : 11;
640
- }
641
- mutable.hour = $735220c2d4774dd3$var$cycleValue(hours, amount, min, max, options === null || options === void 0 ? void 0 : options.round);
642
- break;
643
- }
644
- case 'minute':
645
- mutable.minute = $735220c2d4774dd3$var$cycleValue(value.minute, amount, 0, 59, options === null || options === void 0 ? void 0 : options.round);
646
- break;
647
- case 'second':
648
- mutable.second = $735220c2d4774dd3$var$cycleValue(value.second, amount, 0, 59, options === null || options === void 0 ? void 0 : options.round);
649
- break;
650
- case 'millisecond':
651
- mutable.millisecond = $735220c2d4774dd3$var$cycleValue(value.millisecond, amount, 0, 999, options === null || options === void 0 ? void 0 : options.round);
652
- break;
653
- default:
654
- throw new Error('Unsupported field ' + field);
655
- }
656
- return mutable;
657
- }
658
- function $735220c2d4774dd3$var$cycleValue(value, amount, min, max, round = false) {
659
- if (round) {
660
- value += Math.sign(amount);
661
- if (value < min) value = max;
662
- let div = Math.abs(amount);
663
- if (amount > 0) value = Math.ceil(value / div) * div;
664
- else value = Math.floor(value / div) * div;
665
- if (value > max) value = min;
666
- } else {
667
- value += amount;
668
- if (value < min) value = max - (min - value - 1);
669
- else if (value > max) value = min + (value - max - 1);
670
- }
671
- return value;
672
- }
673
-
674
- function $fae977aafc393c5c$export$f59dee82248f5ad4(time) {
675
- return `${String(time.hour).padStart(2, '0')}:${String(time.minute).padStart(2, '0')}:${String(time.second).padStart(2, '0')}${time.millisecond ? String(time.millisecond / 1000).slice(1) : ''}`;
676
- }
677
-
678
- function _check_private_redeclaration(obj, privateCollection) {
679
- if (privateCollection.has(obj)) {
680
- throw new TypeError("Cannot initialize the same private elements twice on an object");
681
- }
682
- }
683
-
684
- function _class_private_field_init(obj, privateMap, value) {
685
- _check_private_redeclaration(obj, privateMap);
686
- privateMap.set(obj, value);
687
- }
688
-
689
- var // This prevents TypeScript from allowing other types with the same fields to match.
690
- // @ts-ignore
691
- $35ea8db9cb2ccb90$var$_type1 = /*#__PURE__*/ new WeakMap();
692
- class $35ea8db9cb2ccb90$export$680ea196effce5f {
693
- /** Returns a copy of this time. */ copy() {
694
- return new $35ea8db9cb2ccb90$export$680ea196effce5f(this.hour, this.minute, this.second, this.millisecond);
695
- }
696
- /** Returns a new `Time` with the given duration added to it. */ add(duration) {
697
- return ($735220c2d4774dd3$export$7ed87b6bc2506470)(this, duration);
698
- }
699
- /** Returns a new `Time` with the given duration subtracted from it. */ subtract(duration) {
700
- return ($735220c2d4774dd3$export$fe34d3a381cd7501)(this, duration);
701
- }
702
- /** Returns a new `Time` with the given fields set to the provided values. Other fields will be constrained accordingly. */ set(fields) {
703
- return ($735220c2d4774dd3$export$e5d5e1c1822b6e56)(this, fields);
704
- }
705
- /**
706
- * Returns a new `Time` with the given field adjusted by a specified amount.
707
- * When the resulting value reaches the limits of the field, it wraps around.
708
- */ cycle(field, amount, options) {
709
- return ($735220c2d4774dd3$export$dd02b3e0007dfe28)(this, field, amount, options);
710
- }
711
- /** Converts the time to an ISO 8601 formatted string. */ toString() {
712
- return ($fae977aafc393c5c$export$f59dee82248f5ad4)(this);
713
- }
714
- /** Compares this time with another. A negative result indicates that this time is before the given one, and a positive time indicates that it is after. */ compare(b) {
715
- return ($14e0f24ef4ac5c92$export$c19a80a9721b80f6)(this, b);
716
- }
717
- constructor(hour = 0, minute = 0, second = 0, millisecond = 0){
718
- (_class_private_field_init)(this, $35ea8db9cb2ccb90$var$_type1, {
719
- writable: true,
720
- value: void 0
721
- });
722
- this.hour = hour;
723
- this.minute = minute;
724
- this.second = second;
725
- this.millisecond = millisecond;
726
- ($735220c2d4774dd3$export$7555de1e070510cb)(this);
727
- }
728
- }
729
-
730
- var Switch = function (_a) {
731
- var id = _a.id, props = __rest(_a, ["id"]);
732
- var generatedId = React.useId();
733
- var autoId = id || generatedId;
734
- return jsxRuntime.jsx(react.Switch, __assign({}, props, { id: autoId }));
735
- };
736
-
737
- /**
738
- * TimeInput genérico reutilizable basado en HeroUI siguiendo las reglas de diseño BeweOS.
739
- */
740
- var TimeInput = function (_a) {
741
- var label = _a.label, id = _a.id, _b = _a.size, size = _b === void 0 ? "md" : _b, _c = _a.radius, radius = _c === void 0 ? "md" : _c, _d = _a.variant, variant = _d === void 0 ? "bordered" : _d, props = __rest(_a, ["label", "id", "size", "radius", "variant"]);
742
- var generatedId = React.useId();
743
- var autoId = id || generatedId;
744
- return (jsxRuntime.jsx(react.TimeInput, __assign({}, props, { id: autoId, size: size, radius: radius, variant: variant, label: label, labelPlacement: "outside-left", classNames: {
745
- label: "text-default-600 text-tiny group-data-[filled=true]:text-default-600",
746
- inputWrapper: "focus-within:!border-primary-500",
747
- } })));
748
- };
749
-
750
- /**
751
- * @component ScheduleRow
752
- * @description A React component for managing the schedule of a single day.
753
- * It allows users to open or close the schedule, add or remove time slots,
754
- * and modify the start and end times of each slot. The component is fully
755
- * controlled and reports changes to the parent via the `onChange` callback.
756
- *
757
- * @param {ScheduleRowProps} props - The props for the component.
758
- * @returns {React.ReactElement} The rendered ScheduleRow component.
759
- */
760
- var ScheduleRow = function (_a) {
761
- var day = _a.day, daySchedule = _a.daySchedule, translations = _a.translations, onChange = _a.onChange, onCopyToAll = _a.onCopyToAll;
762
- /**
763
- * @function validateTimeSlots
764
- * @description Validates all time slots to ensure the "from" time is not after the "to" time.
765
- * @param {TimeSlot[]} timeSlots - The array of time slots to validate.
766
- * @returns {TimeSlot[]} The updated array of time slots with error messages if any.
767
- */
768
- var validateTimeSlots = function (timeSlots) {
769
- return timeSlots.map(function (slot) {
770
- if (slot.from && slot.to) {
771
- var fromTime = new ($35ea8db9cb2ccb90$export$680ea196effce5f.bind.apply($35ea8db9cb2ccb90$export$680ea196effce5f, __spreadArray([void 0], slot.from.split(":").map(Number), false)))();
772
- var toTime = new ($35ea8db9cb2ccb90$export$680ea196effce5f.bind.apply($35ea8db9cb2ccb90$export$680ea196effce5f, __spreadArray([void 0], slot.to.split(":").map(Number), false)))();
773
- if (fromTime.compare(toTime) > 0) {
774
- return __assign(__assign({}, slot), { error: "From time cannot be after to time" });
775
- }
776
- }
777
- return __assign(__assign({}, slot), { error: null });
778
- });
779
- };
780
- /**
781
- * @function toTimeValue
782
- * @description Converts a time string (e.g., "09:00") to a `TimeValue` object
783
- * required by the `TimeInput` component.
784
- * @param {string} time - The time string to convert.
785
- * @returns {TimeValue | null} The corresponding `TimeValue` object, or `null` if the input is empty.
786
- */
787
- var toTimeValue = function (time) {
788
- if (!time) {
789
- return null;
790
- }
791
- var _a = time.split(":").map(Number), hour = _a[0], minute = _a[1];
792
- return new $35ea8db9cb2ccb90$export$680ea196effce5f(hour, minute);
793
- };
794
- /**
795
- * @function fromTimeValue
796
- * @description Converts a `TimeValue` object back to a formatted time string (e.g., "09:00").
797
- * @param {TimeValue | null} time - The `TimeValue` object to convert.
798
- * @returns {string} The formatted time string.
799
- */
800
- var fromTimeValue = function (time) {
801
- if (!time) {
802
- return "";
803
- }
804
- return "".concat(String(time.hour).padStart(2, "0"), ":").concat(String(time.minute).padStart(2, "0"));
805
- };
806
- /**
807
- * @function handleToggleDay
808
- * @description Toggles the `isOpen` status of the schedule for the day.
809
- */
810
- var handleToggleDay = function () {
811
- onChange(__assign(__assign({}, daySchedule), { isOpen: !daySchedule.isOpen }));
812
- };
813
- /**
814
- * @function handleTimeChange
815
- * @description Updates the time for a specific time slot.
816
- * @param {number} index - The index of the time slot to modify.
817
- * @param {"from" | "to"} field - The field to update ("from" or "to").
818
- * @param {TimeValue | null} value - The new time value from the `TimeInput` component.
819
- */
820
- var handleTimeChange = function (index, field, value) {
821
- var _a;
822
- var newTimeSlots = __spreadArray([], daySchedule.timeSlots, true);
823
- newTimeSlots[index] = __assign(__assign({}, newTimeSlots[index]), (_a = {}, _a[field] = fromTimeValue(value), _a));
824
- var validatedSlots = validateTimeSlots(newTimeSlots);
825
- onChange(__assign(__assign({}, daySchedule), { timeSlots: validatedSlots }));
826
- };
827
- /**
828
- * @function handleAddTimeSlot
829
- * @description Adds a new, empty time slot to the schedule.
830
- */
831
- var handleAddTimeSlot = function () {
832
- var newTimeSlots = __spreadArray(__spreadArray([], daySchedule.timeSlots, true), [{ from: "", to: "" }], false);
833
- onChange(__assign(__assign({}, daySchedule), { timeSlots: newTimeSlots }));
834
- };
835
- /**
836
- * @function handleRemoveTimeSlot
837
- * @description Removes a time slot from the schedule at the specified index.
838
- * @param {number} index - The index of the time slot to remove.
839
- */
840
- var handleRemoveTimeSlot = function (index) {
841
- var newTimeSlots = daySchedule.timeSlots.filter(function (_, i) { return i !== index; });
842
- onChange(__assign(__assign({}, daySchedule), { timeSlots: newTimeSlots }));
843
- };
844
- return (jsxRuntime.jsxs("div", { className: "flex flex-col w-full gap-y-4 last:border-b-0 last:mb-0 last:pb-0 border-b border-default-200 xs:py-4 xl:p-4 first:pt-0", children: [jsxRuntime.jsxs("div", { className: "flex w-full items-center justify-between", children: [jsxRuntime.jsxs("div", { className: "flex xs:space-x-2 sm:space-x-4", children: [jsxRuntime.jsx("h3", { className: "text-small font-semibold text-default-900 capitalize", children: day }), jsxRuntime.jsx(react.Chip, { size: "sm", color: daySchedule.isOpen ? "primary" : "default", className: "text-background", children: daySchedule.isOpen ? translations.open : translations.closed })] }), jsxRuntime.jsxs("div", { className: "flex xs:gap-2 sm:gap-5", children: [jsxRuntime.jsx(Switch, { size: "sm", color: "primary", isSelected: daySchedule.isOpen, onValueChange: handleToggleDay }), jsxRuntime.jsx(Button, { size: "sm", variant: "bordered", onPress: function () { return onCopyToAll(day); }, children: translations.copyToAll })] })] }), daySchedule.isOpen && (jsxRuntime.jsxs("div", { className: "flex flex-col justify-around gap-y-3 ", children: [daySchedule.timeSlots.map(function (slot, index) { return (jsxRuntime.jsxs("div", { className: "flex items-center gap-1 w-full justify-between", children: [jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-1", children: [jsxRuntime.jsx(TimeInput, { label: translations.from, className: "w-full", value: toTimeValue(slot.from), onChange: function (value) { return handleTimeChange(index, "from", value); }, isInvalid: !!slot.error }), jsxRuntime.jsx("span", { className: "text-default-900 xs:hidden xl:block", children: "-" }), jsxRuntime.jsx(TimeInput, { label: translations.to, className: "w-full", value: toTimeValue(slot.to), onChange: function (value) { return handleTimeChange(index, "to", value); }, isInvalid: !!slot.error, errorMessage: slot.error })] }), jsxRuntime.jsx(Button, { isIconOnly: true, size: "sm", color: "danger", variant: "light", onPress: function () { return handleRemoveTimeSlot(index); }, isDisabled: daySchedule.timeSlots.length === 1, startContent: jsxRuntime.jsx(IconComponent, { icon: "solar:trash-bin-minimalistic-outline" }) })] }, "".concat(day, "-timeslot-").concat(slot.from, "-").concat(slot.to, "-").concat(index))); }), daySchedule.timeSlots.length < 2 && (jsxRuntime.jsx(Button, { size: "sm", variant: "flat", onPress: function () { return handleAddTimeSlot(); }, startContent: jsxRuntime.jsx(IconComponent, { icon: "solar:add-circle-outline" }), children: translations.addTimeSlot }))] }))] }, day));
845
- };
846
-
847
- function AuraTable(_a) {
848
- var columns = _a.columns, items = _a.items, renderCell = _a.renderCell, children = _a.children, props = __rest(_a, ["columns", "items", "renderCell", "children"]);
849
- return (jsxRuntime.jsxs(react.Table, __assign({ removeWrapper: true, radius: "none" }, props, { children: [jsxRuntime.jsx(react.TableHeader, { columns: columns, children: function (column) { return jsxRuntime.jsx(react.TableColumn, { children: column.label }, column.key); } }), jsxRuntime.jsx(react.TableBody, { items: items, children: function (item) { return (jsxRuntime.jsx(react.TableRow, { children: function (columnKey) { return (jsxRuntime.jsx(react.TableCell, { children: renderCell ? renderCell(item, columnKey) : children })); } }, item.id)); } })] })));
850
- }
851
-
852
- /**
853
- * Textarea component that wraps the HeroUI TextArea component.
854
- */
855
- var Textarea = function (_a) {
856
- var id = _a.id, label = _a.label, placeholder = _a.placeholder, description = _a.description, errorMessage = _a.errorMessage, _b = _a.variant, variant = _b === void 0 ? "bordered" : _b, _c = _a.radius, radius = _c === void 0 ? "md" : _c, _d = _a.size, size = _d === void 0 ? "md" : _d; _a.labelPlacement; var props = __rest(_a, ["id", "label", "placeholder", "description", "errorMessage", "variant", "radius", "size", "labelPlacement"]);
857
- var generatedId = React.useId();
858
- var autoId = id || generatedId;
859
- return (jsxRuntime.jsx(react.Textarea, __assign({}, props, { id: autoId, label: label, variant: variant, radius: radius, size: size, labelPlacement: "outside", placeholder: placeholder, description: description, errorMessage: errorMessage, classNames: {
860
- label: "text-default-600 text-tiny group-data-[filled=true]:text-default-600",
861
- inputWrapper: "data-[focus=true]:!border-primary-500 data-[focus=true]:!border-primary-500",
862
- } })));
863
- };
864
-
865
- // Traducciones por defecto en español según las reglas de diseño
866
- var defaultTranslations$1 = {
867
- lightTheme: "Claro",
868
- darkTheme: "Oscuro",
869
- };
870
- /**
871
- * Selector de tema visual con preview interactivo siguiendo las reglas de diseño BeweOS.
872
- *
873
- * Reglas aplicadas:
874
- * - Soporte completo de traducciones mediante props
875
- * - Sin dependencias de sistemas i18n específicos
876
- * - Dark mode compatible
877
- * - Uso exclusivo de Tailwind CSS
878
- */
879
- var ThemePicker = function (_a) {
880
- var value = _a.value, onChange = _a.onChange, className = _a.className, _b = _a.translations, translations = _b === void 0 ? {} : _b;
881
- // Combinar traducciones por defecto con las proporcionadas
882
- var t = __assign(__assign({}, defaultTranslations$1), translations);
883
- var themes = [
884
- {
885
- key: "light",
886
- label: t.lightTheme,
887
- cardClass: "bg-white border border-[#E4E4E7] text-zinc-900",
888
- previewClass: "bg-[#F4F4F5] border border-[#E4E4E7]",
889
- labelClass: "font-medium text-[14px] leading-[20px] text-zinc-900",
890
- radioColor: "primary",
891
- previewContent: (jsxRuntime.jsxs("div", { className: "rounded-lg border border-[#E4E4E7] p-3 mt-4 flex flex-col gap-2", children: [jsxRuntime.jsx("div", { className: "h-3 w-1/2 bg-[#E4E4E7] rounded mb-2" }), jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsx("div", { className: "h-3 w-3 rounded-full bg-[#E4E4E7]" }), jsxRuntime.jsx("div", { className: "h-3 w-1/3 rounded bg-[#E4E4E7]" })] }), jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsx("div", { className: "h-3 w-3 rounded-full bg-[#E4E4E7]" }), jsxRuntime.jsx("div", { className: "h-3 w-1/4 rounded bg-[#E4E4E7]" })] })] }), jsxRuntime.jsx("div", { className: "h-8 w-2/3 bg-[#F4F4F5] rounded-lg mt-2" })] })),
892
- },
893
- {
894
- key: "dark",
895
- label: t.darkTheme,
896
- cardClass: "bg-black border border-[#3F3F46] text-white",
897
- previewClass: "bg-[#27272A] border border-[#3F3F46]",
898
- labelClass: "font-medium text-[14px] leading-[20px] text-white",
899
- radioColor: "primary",
900
- previewContent: (jsxRuntime.jsxs("div", { className: "rounded-lg border border-[#3F3F46] p-3 mt-4 flex flex-col gap-2", children: [jsxRuntime.jsx("div", { className: "h-3 w-1/2 bg-[#3F3F46] rounded mb-2" }), jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsx("div", { className: "h-3 w-3 rounded-full bg-[#3F3F46]" }), jsxRuntime.jsx("div", { className: "h-3 w-1/3 rounded bg-[#3F3F46]" })] }), jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsx("div", { className: "h-3 w-3 rounded-full bg-[#3F3F46]" }), jsxRuntime.jsx("div", { className: "h-3 w-1/4 rounded bg-[#3F3F46]" })] })] }), jsxRuntime.jsx("div", { className: "h-8 w-2/3 bg-[#27272A] rounded-lg mt-2" })] })),
901
- },
902
- ];
903
- return (jsxRuntime.jsx(react.RadioGroup, { value: value, onChange: function (e) { return onChange(e.target.value); }, className: "flex justify-center ".concat(className || ""), orientation: "horizontal", classNames: {
904
- wrapper: "gap-3",
905
- }, children: themes.map(function (theme) { return (jsxRuntime.jsxs("div", { className: "relative rounded-2xl ".concat(theme.cardClass, " p-4 flex-1 transition-all duration-200 flex flex-col justify-start"), children: [jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [jsxRuntime.jsx("span", { className: theme.labelClass, children: theme.label }), jsxRuntime.jsx(react.Radio, { "aria-label": theme.label, color: theme.radioColor, size: "sm", value: theme.key })] }), theme.previewContent] }, theme.key)); }) }));
906
- };
907
-
908
- var ConfigMenu = function (_a) {
909
- var _b;
910
- var options = _a.options, onLogout = _a.onLogout, translations = _a.translations;
911
- return (jsxRuntime.jsxs(react.Dropdown, { className: "min-w-40", children: [jsxRuntime.jsx(react.DropdownTrigger, { children: jsxRuntime.jsx(react.Button, { isIconOnly: true, color: "default", startContent: jsxRuntime.jsx(IconComponent, { icon: "solar:settings-linear" }) }) }), jsxRuntime.jsxs(react.DropdownMenu, { "aria-label": "Configuration", children: [jsxRuntime.jsx(react.DropdownSection, { showDivider: true, className: "mb-0", children: options.map(function (item) { return (jsxRuntime.jsx(react.DropdownItem, { href: item.href, className: "data-[hover=true]:bg-primary-100 data-[hover=true]:text-default-700", classNames: {
912
- base: "text-default-500",
913
- }, startContent: item.icon ? jsxRuntime.jsx(IconComponent, { icon: item.icon }) : undefined, children: item.label }, item.label)); }) }), jsxRuntime.jsx(react.DropdownSection, { children: jsxRuntime.jsx(react.DropdownItem, { onPress: onLogout, className: "data-[hover=true]:bg-primary-100 data-[hover=true]:text-default-700", classNames: {
914
- base: "text-default-500",
915
- }, startContent: jsxRuntime.jsx(IconComponent, { icon: "solar:logout-2-linear" }), children: (_b = translations === null || translations === void 0 ? void 0 : translations.logout) !== null && _b !== void 0 ? _b : "Logout" }, "logout") })] })] }));
916
- };
917
- ConfigMenu.displayName = "ConfigMenu";
918
-
919
- var NotificationButton = function (_a) {
920
- var _b = _a.notificationCount, notificationCount = _b === void 0 ? 0 : _b;
921
- return (jsxRuntime.jsx(react.Button, { isIconOnly: true, color: "secondary", variant: "flat", startContent: jsxRuntime.jsx(IconComponent, { icon: "solar:bell-bing-linear" }), children: notificationCount > 0 && (jsxRuntime.jsx("span", { className: "notification__alert", children: notificationCount })) }));
922
- };
923
- NotificationButton.displayName = "NotificationButton";
924
-
925
- var HeaderComponent = function (_a) {
926
- var notificationCount = _a.notificationCount, options = _a.options, onMenuClick = _a.onMenuClick, onLogout = _a.onLogout, translations = _a.translations;
927
- return (jsxRuntime.jsxs("header", { className: "header__container", children: [jsxRuntime.jsx(react.Button, { className: "sm:hidden", isIconOnly: true, variant: "light", startContent: jsxRuntime.jsx(IconComponent, { icon: "solar:hamburger-menu-linear" }), onPress: onMenuClick }), jsxRuntime.jsxs("div", { className: "flex items-center gap-4", children: [jsxRuntime.jsx(NotificationButton, { notificationCount: notificationCount }), jsxRuntime.jsx(ConfigMenu, { options: options, onLogout: onLogout, translations: translations })] })] }));
928
- };
929
- HeaderComponent.displayName = "Header";
930
-
931
- var ToastContext = React.createContext(undefined);
932
- var useAuraToast = function () {
933
- var context = React.useContext(ToastContext);
934
- if (!context) {
935
- throw new Error("useAuraToast must be used within a AuraToastProvider");
936
- }
937
- return context;
938
- };
939
-
940
- function GlobalToast() {
941
- var _a = useAuraToast(), toast = _a.toast, hideToast = _a.hideToast;
942
- if (!toast.isVisible) {
943
- return null;
944
- }
945
- return (jsxRuntime.jsx("div", { className: "fixed top-4 right-4 z-50 w-full max-w-sm", children: jsxRuntime.jsx(react.Alert, { hideIconWrapper: true, color: toast.color, variant: "flat", title: toast.title, description: toast.description, isClosable: true, onClose: hideToast }) }));
946
- }
947
-
948
- // Traducciones por defecto en español
949
- var defaultTranslations = {
950
- uploadText: "Da clic y selecciona tus archivos",
951
- subText: "",
952
- dragText: "Suelta el archivo aquí",
953
- multipleFilesError: "Solo puedes subir un archivo",
954
- maxFilesError: "Puedes subir máximo {maxFiles} archivos",
955
- invalidFileTypeError: "Solo se aceptan archivos de tipo: {acceptedTypes}",
956
- maxFileSizeError: "El archivo excede el tamaño máximo permitido de {maxSize}",
957
- removeFileAriaLabel: "Remover archivo",
958
- uploadAreaAriaLabel: "Área de carga de archivos",
959
- cropModalTitle: "Recortar imagen",
960
- cropSaveButton: "Guardar",
961
- cropCancelButton: "Cancelar",
962
- cropZoomLabel: "Zoom",
963
- cropInstructions: "Arrastra para mover la imagen y usa el zoom para ajustar el tamaño",
964
- cropBackgroundLabel: "Color de fondo",
965
- cropBackgroundWhite: "Blanco",
966
- cropBackgroundBlack: "Negro",
967
- cropBackgroundTransparent: "Transparente",
968
- };
969
- /**
970
- * Formatea el tipo de archivo para mostrar
971
- */
972
- var formatFileType = function (type) {
973
- var _a;
974
- if (type.startsWith(".")) {
975
- return type.toUpperCase();
976
- }
977
- if (type.includes("/")) {
978
- var parts = type.split("/");
979
- return ((_a = parts[1]) === null || _a === void 0 ? void 0 : _a.toUpperCase()) || type;
980
- }
981
- return type.toUpperCase();
982
- };
983
- /**
984
- * Formatea el tamaño del archivo de forma legible
985
- */
986
- var formatFileSize = function (bytes) {
987
- if (bytes === 0) {
988
- return "0 Bytes";
989
- }
990
- var k = 1024;
991
- var sizes = ["Bytes", "KB", "MB", "GB"];
992
- var i = Math.floor(Math.log(bytes) / Math.log(k));
993
- return "".concat(Math.round(bytes / Math.pow(k, i)), " ").concat(sizes[i]);
994
- };
995
- /**
996
- * Componente de recorte de imagen usando Canvas API
997
- */
998
- var ImageCropModal = function (_a) {
999
- var isOpen = _a.isOpen, imageUrl = _a.imageUrl, targetWidth = _a.targetWidth, targetHeight = _a.targetHeight, onSave = _a.onSave, onCancel = _a.onCancel, translations = _a.translations;
1000
- var canvasRef = React.useRef(null);
1001
- var _b = React.useState(null), imageElement = _b[0], setImageElement = _b[1];
1002
- var _c = React.useState(0), zoomValue = _c[0], setZoomValue = _c[1]; // Valor del slider de -1 a 1
1003
- var _d = React.useState({ x: 0, y: 0 }), position = _d[0], setPosition = _d[1];
1004
- var _e = React.useState(false), isDragging = _e[0], setIsDragging = _e[1];
1005
- var _f = React.useState({ x: 0, y: 0 }), dragStart = _f[0], setDragStart = _f[1];
1006
- var _g = React.useState(1), baseScale = _g[0], setBaseScale = _g[1]; // Escala base inicial
1007
- var _h = React.useState({ width: 400, height: 300 }), canvasSize = _h[0], setCanvasSize = _h[1];
1008
- var _j = React.useState("white"), backgroundColor = _j[0], setBackgroundColor = _j[1];
1009
- // Función para convertir el valor del zoom slider a escala real
1010
- var getScaleFromZoom = function (zoomValue) {
1011
- if (zoomValue === 0) {
1012
- return baseScale;
1013
- }
1014
- if (zoomValue > 0) {
1015
- // Zoom in: de baseScale a baseScale * 3
1016
- return baseScale + baseScale * 2 * zoomValue;
1017
- }
1018
- // Zoom out: de baseScale * 0.3 a baseScale
1019
- return baseScale + baseScale * 0.7 * zoomValue;
1020
- };
1021
- var currentScale = getScaleFromZoom(zoomValue);
1022
- // Cargar imagen cuando se abre el modal
1023
- React.useEffect(function () {
1024
- if (isOpen && imageUrl) {
1025
- var img_1 = new Image();
1026
- img_1.onload = function () {
1027
- setImageElement(img_1);
1028
- // Calcular escala inicial para que la imagen quepa en el área de crop
1029
- var scaleX = targetWidth / img_1.width;
1030
- var scaleY = targetHeight / img_1.height;
1031
- var initialScale = Math.max(scaleX, scaleY);
1032
- setBaseScale(initialScale);
1033
- setZoomValue(0); // Empezar en el centro
1034
- setPosition({ x: 0, y: 0 });
1035
- setBackgroundColor("white"); // Reset color de fondo
1036
- };
1037
- img_1.src = imageUrl;
1038
- }
1039
- }, [isOpen, imageUrl, targetWidth, targetHeight]);
1040
- // Dibujar en el canvas
1041
- React.useEffect(function () {
1042
- if (!(imageElement && canvasRef.current)) {
1043
- return;
1044
- }
1045
- var canvas = canvasRef.current;
1046
- var ctx = canvas.getContext("2d");
1047
- if (!ctx) {
1048
- return;
1049
- }
1050
- // Limpiar canvas
1051
- ctx.clearRect(0, 0, canvas.width, canvas.height);
1052
- // Dibujar fondo gris del canvas
1053
- ctx.fillStyle = "#f3f4f6";
1054
- ctx.fillRect(0, 0, canvas.width, canvas.height);
1055
- // Calcular posición y tamaño de la imagen
1056
- var imgWidth = imageElement.width * currentScale;
1057
- var imgHeight = imageElement.height * currentScale;
1058
- var imgX = (canvas.width - imgWidth) / 2 + position.x;
1059
- var imgY = (canvas.height - imgHeight) / 2 + position.y;
1060
- // Dibujar imagen
1061
- ctx.drawImage(imageElement, imgX, imgY, imgWidth, imgHeight);
1062
- // Dibujar overlay para mostrar área de recorte
1063
- ctx.fillStyle = "rgba(0, 0, 0, 0.5)";
1064
- ctx.fillRect(0, 0, canvas.width, canvas.height);
1065
- // Limpiar área de recorte (centro)
1066
- var cropX = (canvas.width - targetWidth) / 2;
1067
- var cropY = (canvas.height - targetHeight) / 2;
1068
- ctx.clearRect(cropX, cropY, targetWidth, targetHeight);
1069
- // Dibujar color de fondo del área de recorte
1070
- if (backgroundColor !== "transparent") {
1071
- ctx.fillStyle = backgroundColor === "white" ? "#ffffff" : "#000000";
1072
- ctx.fillRect(cropX, cropY, targetWidth, targetHeight);
1073
- }
1074
- // Redibujar imagen solo en el área de recorte
1075
- ctx.save();
1076
- ctx.beginPath();
1077
- ctx.rect(cropX, cropY, targetWidth, targetHeight);
1078
- ctx.clip();
1079
- ctx.drawImage(imageElement, imgX, imgY, imgWidth, imgHeight);
1080
- ctx.restore();
1081
- // Dibujar borde del área de recorte
1082
- ctx.strokeStyle = "#3b82f6";
1083
- ctx.lineWidth = 2;
1084
- ctx.strokeRect(cropX, cropY, targetWidth, targetHeight);
1085
- }, [
1086
- imageElement,
1087
- currentScale,
1088
- position,
1089
- targetWidth,
1090
- targetHeight,
1091
- backgroundColor,
1092
- ]);
1093
- var handleMouseDown = function (e) {
1094
- var _a;
1095
- e.preventDefault();
1096
- setIsDragging(true);
1097
- var rect = (_a = canvasRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
1098
- if (rect) {
1099
- setDragStart({
1100
- x: e.clientX - rect.left - position.x,
1101
- y: e.clientY - rect.top - position.y,
1102
- });
1103
- }
1104
- };
1105
- var handleMouseMove = function (e) {
1106
- var _a;
1107
- if (!isDragging) {
1108
- return;
1109
- }
1110
- e.preventDefault();
1111
- var rect = (_a = canvasRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
1112
- if (rect) {
1113
- setPosition({
1114
- x: e.clientX - rect.left - dragStart.x,
1115
- y: e.clientY - rect.top - dragStart.y,
1116
- });
1117
- }
1118
- };
1119
- var handleMouseUp = function () {
1120
- setIsDragging(false);
1121
- };
1122
- // Eventos táctiles para dispositivos móviles
1123
- var handleTouchStart = function (e) {
1124
- var _a;
1125
- e.preventDefault();
1126
- if (e.touches.length === 1) {
1127
- setIsDragging(true);
1128
- var rect = (_a = canvasRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
1129
- if (rect) {
1130
- var touch = e.touches[0];
1131
- setDragStart({
1132
- x: touch.clientX - rect.left - position.x,
1133
- y: touch.clientY - rect.top - position.y,
1134
- });
1135
- }
1136
- }
1137
- };
1138
- var handleTouchMove = function (e) {
1139
- var _a;
1140
- if (!isDragging || e.touches.length !== 1) {
1141
- return;
1142
- }
1143
- e.preventDefault();
1144
- var rect = (_a = canvasRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
1145
- if (rect) {
1146
- var touch = e.touches[0];
1147
- setPosition({
1148
- x: touch.clientX - rect.left - dragStart.x,
1149
- y: touch.clientY - rect.top - dragStart.y,
1150
- });
1151
- }
1152
- };
1153
- var handleTouchEnd = function () {
1154
- setIsDragging(false);
1155
- };
1156
- var handleSave = function () {
1157
- if (!(imageElement && canvasRef.current)) {
1158
- return;
1159
- }
1160
- // Crear canvas temporal para el recorte
1161
- var tempCanvas = document.createElement("canvas");
1162
- tempCanvas.width = targetWidth;
1163
- tempCanvas.height = targetHeight;
1164
- var tempCtx = tempCanvas.getContext("2d");
1165
- if (!tempCtx) {
1166
- return;
1167
- }
1168
- // Dibujar color de fondo si no es transparente
1169
- if (backgroundColor !== "transparent") {
1170
- tempCtx.fillStyle = backgroundColor === "white" ? "#ffffff" : "#000000";
1171
- tempCtx.fillRect(0, 0, targetWidth, targetHeight);
1172
- }
1173
- // Calcular parámetros de recorte
1174
- var canvas = canvasRef.current;
1175
- var imgWidth = imageElement.width * currentScale;
1176
- var imgHeight = imageElement.height * currentScale;
1177
- var imgX = (canvas.width - imgWidth) / 2 + position.x;
1178
- var imgY = (canvas.height - imgHeight) / 2 + position.y;
1179
- var cropX = (canvas.width - targetWidth) / 2;
1180
- var cropY = (canvas.height - targetHeight) / 2;
1181
- // Calcular área fuente en la imagen original
1182
- var sourceX = (cropX - imgX) / currentScale;
1183
- var sourceY = (cropY - imgY) / currentScale;
1184
- var sourceWidth = targetWidth / currentScale;
1185
- var sourceHeight = targetHeight / currentScale;
1186
- // Dibujar recorte sobre el fondo
1187
- tempCtx.drawImage(imageElement, sourceX, sourceY, sourceWidth, sourceHeight, 0, 0, targetWidth, targetHeight);
1188
- // Convertir a blob y crear archivo
1189
- var fileType = backgroundColor === "transparent" ? "image/png" : "image/png";
1190
- tempCanvas.toBlob(function (blob) {
1191
- if (blob) {
1192
- var timestamp = new Date().getTime();
1193
- var file = new File([blob], "cropped-image-".concat(timestamp, ".png"), {
1194
- type: fileType,
1195
- });
1196
- onSave(file, imageElement.src);
1197
- }
1198
- }, fileType);
1199
- };
1200
- // Calcular dimensiones responsive del canvas
1201
- var updateCanvasSize = React.useCallback(function () {
1202
- var minCanvasWidth = Math.min(350, window.innerWidth - 40);
1203
- var minCanvasHeight = Math.min(250, window.innerHeight - 300);
1204
- var newCanvasWidth = Math.max(minCanvasWidth, targetWidth + 60);
1205
- var newCanvasHeight = Math.max(minCanvasHeight, targetHeight + 60);
1206
- setCanvasSize({ width: newCanvasWidth, height: newCanvasHeight });
1207
- }, [targetWidth, targetHeight]);
1208
- // Actualizar tamaño del canvas al cambiar el tamaño de la ventana
1209
- React.useEffect(function () {
1210
- if (!isOpen) {
1211
- return;
1212
- }
1213
- updateCanvasSize();
1214
- var handleResize = function () {
1215
- updateCanvasSize();
1216
- };
1217
- window.addEventListener("resize", handleResize);
1218
- return function () {
1219
- window.removeEventListener("resize", handleResize);
1220
- };
1221
- }, [isOpen, updateCanvasSize]);
1222
- return (jsxRuntime.jsx(react.Modal, { isOpen: isOpen, onClose: onCancel, size: "5xl", className: "sm:max-w-4xl", scrollBehavior: "inside", backdrop: "blur", classNames: {
1223
- backdrop: "bg-black/80",
1224
- wrapper: "p-0 sm:p-4",
1225
- base: "m-0 sm:m-4 max-h-screen sm:max-h-[90vh] w-full sm:w-auto",
1226
- }, children: jsxRuntime.jsxs(react.ModalContent, { className: "m-0 sm:m-0 h-screen sm:h-auto sm:max-h-[90vh] sm:rounded-lg", children: [jsxRuntime.jsxs(react.ModalHeader, { className: "flex flex-col gap-1 px-4 sm:px-6", children: [translations.cropModalTitle, jsxRuntime.jsx("p", { className: "text-xs sm:text-sm text-gray-500 font-normal", children: translations.cropInstructions })] }), jsxRuntime.jsx(react.ModalBody, { className: "px-4 sm:px-6 py-4", children: jsxRuntime.jsxs("div", { className: "flex flex-col gap-4", children: [jsxRuntime.jsx("div", { className: "flex justify-center overflow-hidden", children: jsxRuntime.jsx("canvas", { ref: canvasRef, width: canvasSize.width, height: canvasSize.height, className: "border border-gray-300 cursor-move select-none max-w-full max-h-[50vh] sm:max-h-[60vh]", onMouseDown: handleMouseDown, onMouseMove: handleMouseMove, onMouseUp: handleMouseUp, onMouseLeave: handleMouseUp, onTouchStart: handleTouchStart, onTouchMove: handleTouchMove, onTouchEnd: handleTouchEnd, style: { touchAction: "none" } }) }), jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [jsxRuntime.jsx("label", { htmlFor: "zoom-slider", className: "text-sm font-medium", children: translations.cropZoomLabel }), jsxRuntime.jsxs("div", { className: "flex items-center gap-2 sm:gap-3 w-full", children: [jsxRuntime.jsx("span", { className: "text-xs text-gray-500 min-w-[15px] sm:min-w-[20px]", children: "-" }), jsxRuntime.jsx(react.Slider, { id: "zoom-slider", size: "sm", step: 0.1, minValue: -1, maxValue: 1, value: zoomValue, onChange: function (value) { return setZoomValue(value); }, className: "flex-1", marks: [
1227
- { value: -1, label: "Out" },
1228
- { value: 0, label: "0" },
1229
- { value: 1, label: "In" },
1230
- ] }), jsxRuntime.jsx("span", { className: "text-xs text-gray-500 min-w-[15px] sm:min-w-[20px]", children: "+" })] })] }), jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [jsxRuntime.jsx("div", { className: "text-sm font-medium", children: translations.cropBackgroundLabel }), jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-3 sm:gap-4", children: [jsxRuntime.jsxs("label", { className: "flex items-center gap-2 cursor-pointer", children: [jsxRuntime.jsx("input", { type: "radio", name: "background-color", value: "white", checked: backgroundColor === "white", onChange: function (e) {
1231
- return setBackgroundColor(e.target.value);
1232
- }, className: "text-blue-600 focus:ring-blue-500" }), jsxRuntime.jsx("div", { className: "w-4 h-4 bg-white border border-gray-300 rounded" }), jsxRuntime.jsx("span", { className: "text-sm", children: translations.cropBackgroundWhite })] }), jsxRuntime.jsxs("label", { className: "flex items-center gap-2 cursor-pointer", children: [jsxRuntime.jsx("input", { type: "radio", name: "background-color", value: "black", checked: backgroundColor === "black", onChange: function (e) {
1233
- return setBackgroundColor(e.target.value);
1234
- }, className: "text-blue-600 focus:ring-blue-500" }), jsxRuntime.jsx("div", { className: "w-4 h-4 bg-black border border-gray-300 rounded" }), jsxRuntime.jsx("span", { className: "text-sm", children: translations.cropBackgroundBlack })] }), jsxRuntime.jsxs("label", { className: "flex items-center gap-2 cursor-pointer", children: [jsxRuntime.jsx("input", { type: "radio", name: "background-color", value: "transparent", checked: backgroundColor === "transparent", onChange: function (e) {
1235
- return setBackgroundColor(e.target.value);
1236
- }, className: "text-blue-600 focus:ring-blue-500" }), jsxRuntime.jsx("div", { className: "w-4 h-4 bg-gray-200 border border-gray-300 rounded", style: {
1237
- backgroundImage: "linear-gradient(45deg, #ccc 25%, transparent 25%), linear-gradient(-45deg, #ccc 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ccc 75%), linear-gradient(-45deg, transparent 75%, #ccc 75%)",
1238
- backgroundSize: "8px 8px",
1239
- backgroundPosition: "0 0, 0 4px, 4px -4px, -4px 0px",
1240
- } }), jsxRuntime.jsx("span", { className: "text-sm", children: translations.cropBackgroundTransparent })] })] })] })] }) }), jsxRuntime.jsxs(react.ModalFooter, { className: "flex flex-col-reverse sm:flex-row gap-2 px-4 sm:px-6", children: [jsxRuntime.jsx(react.Button, { color: "danger", variant: "light", onPress: onCancel, className: "w-full sm:w-auto", children: translations.cropCancelButton }), jsxRuntime.jsx(react.Button, { color: "primary", onPress: handleSave, className: "w-full sm:w-auto", children: translations.cropSaveButton })] })] }) }));
1241
- };
1242
- /**
1243
- * Componente de previsualización de archivo
1244
- */
1245
- var FilePreview = function (_a) {
1246
- var file = _a.file, onRemove = _a.onRemove, removeAriaLabel = _a.removeAriaLabel;
1247
- var _b = React.useState(""), previewUrl = _b[0], setPreviewUrl = _b[1];
1248
- React.useEffect(function () {
1249
- if (file === null || file === void 0 ? void 0 : file.type.startsWith("image/")) {
1250
- var url_1 = URL.createObjectURL(file);
1251
- setPreviewUrl(url_1);
1252
- return function () { return URL.revokeObjectURL(url_1); };
1253
- }
1254
- }, [file]);
1255
- if (!(file === null || file === void 0 ? void 0 : file.type.startsWith("image/"))) {
1256
- return null;
1257
- }
1258
- return (jsxRuntime.jsxs("div", { className: "absolute inset-0 overflow-hidden z-10", children: [jsxRuntime.jsx("img", { src: previewUrl, alt: file.name, className: "w-full h-full object-cover" }), jsxRuntime.jsx(react.Button, { isIconOnly: true, size: "sm", color: "danger", variant: "solid", className: "absolute top-2 right-2 sm:top-3 sm:right-3 z-20 bg-red-100 hover:bg-red-200 text-red-600 min-w-8 h-8 sm:min-w-10 sm:h-10", onPress: onRemove, "aria-label": removeAriaLabel, children: jsxRuntime.jsx(IconComponent, { icon: "heroicons:trash", size: "sm" }) })] }));
1259
- };
1260
- /**
1261
- * Componente UploadDocument basado en Hero UI con funcionalidad mejorada
1262
- *
1263
- * @example
1264
- * ```tsx
1265
- * <UploadDocument
1266
- * onUpload={(files) => console.log(files)}
1267
- * acceptedFiles="image/*,.pdf"
1268
- * multiple={false}
1269
- * translations={{
1270
- * uploadText: "Upload your files",
1271
- * dragText: "Drop files here"
1272
- * }}
1273
- * />
1274
- * ```
1275
- */
1276
- var UploadFile = function (_a) {
1277
- var text = _a.text, textColor = _a.textColor, subText = _a.subText,
1278
- // borderColor, // TODO: Implementar colores personalizados
1279
- iconColor = _a.iconColor,
1280
- // backgroundColor, // TODO: Implementar colores personalizados
1281
- _b = _a.width,
1282
- // backgroundColor, // TODO: Implementar colores personalizados
1283
- width = _b === void 0 ? "100%" : _b, _c = _a.height, height = _c === void 0 ? "auto" : _c, _d = _a.multiple, multiple = _d === void 0 ? false : _d, _e = _a.maxFiles, maxFiles = _e === void 0 ? 1 : _e, maxFileSize = _a.maxFileSize, _f = _a.acceptedFiles, acceptedFiles = _f === void 0 ? ".pdf" : _f, _g = _a.icon, icon = _g === void 0 ? "heroicons:arrow-up-on-square" : _g, onUpload = _a.onUpload, onError = _a.onError, _h = _a.error, error = _h === void 0 ? false : _h, _j = _a.success, success = _j === void 0 ? false : _j, _k = _a.disabled, disabled = _k === void 0 ? false : _k, errorText = _a.errorText, cropConfig = _a.cropConfig, image = _a.image, _l = _a.className, className = _l === void 0 ? "" : _l, _m = _a.translations, translations = _m === void 0 ? {} : _m;
1284
- var inputRef = React.useRef(null);
1285
- var uploadImageRef = React.useRef(image || null);
1286
- var _o = React.useState(false), isDragging = _o[0], setIsDragging = _o[1];
1287
- // Estados para el modal de crop
1288
- var _p = React.useState(false), showCropModal = _p[0], setShowCropModal = _p[1];
1289
- var _q = React.useState(""), selectedImageUrl = _q[0], setSelectedImageUrl = _q[1];
1290
- var _r = React.useState(null); _r[0]; var setOriginalFile = _r[1];
1291
- // Combinar traducciones por defecto con las proporcionadas
1292
- var t = React.useMemo(function () { return (__assign(__assign({}, defaultTranslations), translations)); }, [translations]);
1293
- // Actualizar texto si se pasa como prop (retrocompatibilidad)
1294
- var finalText = text || t.uploadText;
1295
- var finalSubText = subText || t.subText;
1296
- var handleClick = function () {
1297
- var _a;
1298
- if (!(disabled || uploadImageRef.current)) {
1299
- (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.click();
1300
- }
1301
- };
1302
- var validateFiles = React.useCallback(function (files) {
1303
- var filesArray = Array.from(files);
1304
- if (!multiple && filesArray.length > 1) {
1305
- onError === null || onError === void 0 ? void 0 : onError(t.multipleFilesError);
1306
- return [];
1307
- }
1308
- if (filesArray.length > maxFiles) {
1309
- onError === null || onError === void 0 ? void 0 : onError(t.maxFilesError.replace("{maxFiles}", maxFiles.toString()));
1310
- return [];
1311
- }
1312
- // Validar tamaño de archivo
1313
- if (maxFileSize) {
1314
- var oversizedFiles = filesArray.filter(function (file) { return file.size > maxFileSize; });
1315
- if (oversizedFiles.length > 0) {
1316
- var maxSizeFormatted = formatFileSize(maxFileSize);
1317
- onError === null || onError === void 0 ? void 0 : onError(t.maxFileSizeError.replace("{maxSize}", maxSizeFormatted));
1318
- return [];
1319
- }
1320
- }
1321
- // Validar tipos de archivo
1322
- var acceptedExtensions = Array.isArray(acceptedFiles)
1323
- ? acceptedFiles.map(function (ext) { return ext.trim().toLowerCase(); })
1324
- : acceptedFiles.split(",").map(function (ext) { return ext.trim().toLowerCase(); });
1325
- var validFiles = filesArray.filter(function (file) {
1326
- var _a;
1327
- if (acceptedFiles.includes("image/*") &&
1328
- file.type.startsWith("image/")) {
1329
- return true;
1330
- }
1331
- if (acceptedExtensions.some(function (ext) { return ext.includes("/"); })) {
1332
- return acceptedExtensions.some(function (type) { return file.type === type; });
1333
- }
1334
- var fileExtension = ".".concat((_a = file.name.split(".").pop()) === null || _a === void 0 ? void 0 : _a.toLowerCase());
1335
- return acceptedExtensions.some(function (ext) { return ext === fileExtension || ext === "*"; });
1336
- });
1337
- if (validFiles.length === 0) {
1338
- var formattedTypes = acceptedExtensions
1339
- .map(formatFileType)
1340
- .join(", ");
1341
- onError === null || onError === void 0 ? void 0 : onError(t.invalidFileTypeError.replace("{acceptedTypes}", formattedTypes));
1342
- return [];
1343
- }
1344
- return validFiles;
1345
- }, [multiple, maxFiles, maxFileSize, acceptedFiles, t, onError]);
1346
- var handleFileUpload = React.useCallback(function (files) {
1347
- var validFiles = validateFiles(files);
1348
- if (validFiles.length > 0) {
1349
- var file_1 = validFiles[0];
1350
- // Si es imagen y hay configuración de crop, abrir modal
1351
- if (file_1.type.startsWith("image/") && cropConfig) {
1352
- var reader_1 = new FileReader();
1353
- reader_1.onload = function () {
1354
- setSelectedImageUrl(reader_1.result);
1355
- setOriginalFile(file_1);
1356
- setShowCropModal(true);
1357
- };
1358
- reader_1.readAsDataURL(file_1);
1359
- }
1360
- else {
1361
- // Procesar directamente si no necesita crop
1362
- uploadImageRef.current = file_1;
1363
- onUpload(validFiles);
1364
- }
1365
- }
1366
- }, [onUpload, validateFiles, cropConfig]);
1367
- // Manejar guardado de imagen recortada
1368
- var handleCropSave = React.useCallback(function (croppedFile) {
1369
- uploadImageRef.current = croppedFile;
1370
- setShowCropModal(false);
1371
- setSelectedImageUrl("");
1372
- setOriginalFile(null);
1373
- onUpload([croppedFile]);
1374
- }, [onUpload]);
1375
- // Manejar cancelación de crop
1376
- var handleCropCancel = React.useCallback(function () {
1377
- setShowCropModal(false);
1378
- setSelectedImageUrl("");
1379
- setOriginalFile(null);
1380
- }, []);
1381
- var handleChange = function (event) {
1382
- var files = event.target.files;
1383
- if (files && files.length > 0) {
1384
- handleFileUpload(files);
1385
- }
1386
- // Limpiar el input
1387
- if (inputRef.current) {
1388
- inputRef.current.value = "";
1389
- }
1390
- };
1391
- var handleDragEnter = React.useCallback(function (e) {
1392
- e.preventDefault();
1393
- e.stopPropagation();
1394
- if (!disabled) {
1395
- setIsDragging(true);
1396
- }
1397
- }, [disabled]);
1398
- var handleDragLeave = React.useCallback(function (e) {
1399
- e.preventDefault();
1400
- e.stopPropagation();
1401
- setIsDragging(false);
1402
- }, []);
1403
- var handleDragOver = React.useCallback(function (e) {
1404
- e.preventDefault();
1405
- e.stopPropagation();
1406
- }, []);
1407
- var handleDrop = React.useCallback(function (e) {
1408
- e.preventDefault();
1409
- e.stopPropagation();
1410
- setIsDragging(false);
1411
- if (disabled) {
1412
- return;
1413
- }
1414
- var droppedFiles = e.dataTransfer.files;
1415
- if (droppedFiles.length > 0) {
1416
- handleFileUpload(droppedFiles);
1417
- }
1418
- }, [disabled, handleFileUpload]);
1419
- var handleRemoveImage = function () {
1420
- uploadImageRef.current = null;
1421
- onUpload([]);
1422
- };
1423
- // Clases CSS dinámicas usando Tailwind
1424
- var containerClasses = "\n\t\trelative w-full border-2 border-dashed rounded-2xl p-3 transition-all duration-300 bg-red-500\n\t\t".concat(width !== "100%" ? "w-[".concat(width, "]") : "w-full", "\n\t\t").concat(height !== "auto" ? "h-[".concat(height, "]") : "min-h-28", "\n\t\t").concat(isDragging
1425
- ? "border-primary-500 bg-primary-50 dark:bg-primary-900"
1426
- : error
1427
- ? "border-danger-500 bg-danger-50 dark:bg-danger-950"
1428
- : success
1429
- ? "border-success-500 bg-success-50 dark:bg-success-950"
1430
- : disabled
1431
- ? "border-gray-300 bg-gray-100 dark:bg-gray-800"
1432
- : "border-gray-300 hover:border-gray-400 bg-primary-50 dark:bg-gray-900", "\n\t\t").concat(!(disabled || uploadImageRef.current) ? "cursor-pointer" : "cursor-default", "\n\t\t").concat(className, "\n\t")
1433
- .trim()
1434
- .replace(/\s+/g, " ");
1435
- var textClasses = "\n\t\ttext-centertext-base ont-medium\n\t\t".concat(disabled ? "text-default-400" : textColor || "text-default-700 dark:text-default-200", "\n\t");
1436
- var subTextClasses = "\n\t\ttext-tiny text-center\n\t\t".concat(disabled ? "text-default-400" : "text-default-500 dark:text-default-400", "\n\t");
1437
- return (jsxRuntime.jsxs("div", { className: "relative", children: [jsxRuntime.jsx(react.Card, { className: containerClasses, isPressable: !(disabled || uploadImageRef.current), onPress: handleClick, children: jsxRuntime.jsxs(react.CardBody, { className: "flex flex-col items-center justify-center gap-3 sm:gap-4 relative overflow-hidden", onDragEnter: handleDragEnter, onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, children: [uploadImageRef.current && (jsxRuntime.jsx(FilePreview, { file: uploadImageRef.current, onRemove: handleRemoveImage, removeAriaLabel: t.removeFileAriaLabel })), jsxRuntime.jsx("div", { className: uploadImageRef.current
1438
- ? "opacity-0"
1439
- : "opacity-100 transition-opacity", children: jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-3 sm:gap-4", children: [jsxRuntime.jsx(IconComponent, { icon: icon, size: "xl", className: "sm:text-4xl lg:text-5xl ".concat(disabled ? "text-gray-400" : iconColor || "text-primary") }), jsxRuntime.jsxs("div", { className: "text-center px-2", children: [jsxRuntime.jsx("p", { className: textClasses, children: isDragging ? t.dragText : finalText }), finalSubText && !isDragging && (jsxRuntime.jsx("p", { className: subTextClasses, children: finalSubText }))] })] }) }), jsxRuntime.jsx("input", { ref: inputRef, type: "file", className: "hidden", multiple: multiple, accept: Array.isArray(acceptedFiles)
1440
- ? acceptedFiles.join(",")
1441
- : acceptedFiles, onChange: handleChange, disabled: disabled, "aria-label": t.uploadAreaAriaLabel })] }) }), error && errorText && (jsxRuntime.jsx("p", { className: "text-red-500 text-sm mt-2", role: "alert", children: errorText })), showCropModal && selectedImageUrl && cropConfig && (jsxRuntime.jsx(ImageCropModal, { isOpen: showCropModal, imageUrl: selectedImageUrl, targetWidth: cropConfig.targetWidth, targetHeight: cropConfig.targetHeight, onSave: handleCropSave, onCancel: handleCropCancel, translations: t }))] }));
1442
- };
1443
- UploadFile.displayName = "UploadFile";
1444
-
1445
- var Pagination = function (_a) {
1446
- _a.size; var props = __rest(_a, ["size"]);
1447
- return jsxRuntime.jsx(react.Pagination, __assign({ showControls: true, isCompact: true }, props));
1448
- };
1449
-
1450
- var H2 = function (_a) {
1451
- var children = _a.children, className = _a.className, props = __rest(_a, ["children", "className"]);
1452
- return (jsxRuntime.jsx("h2", __assign({ className: react.cn("text-lg font-medium", className) }, props, { children: children })));
1453
- };
1454
-
1455
- var H3 = function (_a) {
1456
- var children = _a.children, className = _a.className, props = __rest(_a, ["children", "className"]);
1457
- return (jsxRuntime.jsx("h3", __assign({ className: react.cn("text-base font-medium mb-1", className) }, props, { children: children })));
1458
- };
1459
-
1460
- var H4 = function (_a) {
1461
- var children = _a.children, className = _a.className, props = __rest(_a, ["children", "className"]);
1462
- return (jsxRuntime.jsx("h4", __assign({ className: react.cn("text-sm font-medium mb-1", className) }, props, { children: children })));
1463
- };
1464
-
1465
- var P = function (_a) {
1466
- var children = _a.children, className = _a.className, props = __rest(_a, ["children", "className"]);
1467
- return (jsxRuntime.jsx("p", __assign({ className: react.cn("text-sm text-default-500", className) }, props, { children: children })));
1468
- };
1469
-
1470
- var ThemeContext = React.createContext({
1471
- mode: "light",
1472
- color: "blue",
1473
- // biome-ignore lint/suspicious/noEmptyBlockStatements: <explanation>
1474
- setMode: function () { },
1475
- // biome-ignore lint/suspicious/noEmptyBlockStatements: <explanation>
1476
- setColor: function () { },
1477
- });
1478
- var useThemeContext = function () {
1479
- var context = React.useContext(ThemeContext);
1480
- if (!context) {
1481
- throw new Error("useThemeContext debe ser usado dentro de un ThemeProvider");
1482
- }
1483
- return context;
1484
- };
388
+ var useThemeContext = function () {
389
+ var context = React.useContext(ThemeContext);
390
+ if (!context) {
391
+ throw new Error("useThemeContext debe ser usado dentro de un ThemeProvider");
392
+ }
393
+ return context;
394
+ };
1485
395
 
1486
396
  var themeColors = {
1487
397
  "blue-light": {
@@ -1812,202 +722,1846 @@ var themeColors = {
1812
722
  "800": "#ffcaca",
1813
723
  "900": "#ffe9e9",
1814
724
  foreground: "#000",
1815
- DEFAULT: "#ff4f4f",
725
+ DEFAULT: "#ff4f4f",
726
+ },
727
+ focus: "#ff4f4f",
728
+ },
729
+ },
730
+ "green-light": {
731
+ extend: "light",
732
+ colors: {
733
+ primary: {
734
+ 50: "#EFFFEF",
735
+ 100: "#CFFCD1",
736
+ 200: "#A0F9AC",
737
+ 300: "#6FEE8D",
738
+ 400: "#49DE7B",
739
+ 500: "#16C964",
740
+ 600: "#10AC64",
741
+ 700: "#0B905F",
742
+ 800: "#077457",
743
+ 900: "#046051",
744
+ foreground: "#000",
745
+ DEFAULT: "#16C964",
746
+ },
747
+ secondary: {
748
+ "50": "#e3eaff",
749
+ "100": "#D7DFFE",
750
+ "200": "#AFBFFE",
751
+ "300": "#889DFD",
752
+ "400": "#6A82FB",
753
+ "500": "#3956F9",
754
+ "600": "#2941D6",
755
+ "700": "#1C2EB3",
756
+ "800": "#121F90",
757
+ "900": "#0A1477",
758
+ foreground: "#fff",
759
+ DEFAULT: "#3956F9",
760
+ },
761
+ success: {
762
+ "50": "#e7fde3",
763
+ "100": "#E8FCD3",
764
+ "200": "#CBFAA8",
765
+ "300": "#A4F17B",
766
+ "400": "#7EE358",
767
+ "500": "#49D127",
768
+ "600": "#2FB31C",
769
+ "700": "#1A9613",
770
+ "800": "#0C790E",
771
+ "900": "#076410",
772
+ foreground: "#000",
773
+ DEFAULT: "#49D127",
774
+ },
775
+ warning: {
776
+ "50": "#fff9da",
777
+ "100": "#FFF7CC",
778
+ "200": "#FFEE99",
779
+ "300": "#FFE266",
780
+ "400": "#FFD63F",
781
+ "500": "#FFC300",
782
+ "600": "#DBA200",
783
+ "700": "#B78300",
784
+ "800": "#936600",
785
+ "900": "#7A5100",
786
+ foreground: "#000",
787
+ DEFAULT: "#FFC300",
788
+ },
789
+ danger: {
790
+ "50": "#ffe2e5",
791
+ "100": "#FFE3D8",
792
+ "200": "#FFC1B2",
793
+ "300": "#FF988B",
794
+ "400": "#FF726F",
795
+ "500": "#FF3F4C",
796
+ "600": "#DB2E49",
797
+ "700": "#B71F45",
798
+ "800": "#93143F",
799
+ "900": "#7A0C3B",
800
+ foreground: "#000",
801
+ DEFAULT: "#FF3F4C",
802
+ },
803
+ focus: "#66cc8a",
804
+ overlay: "#000000",
805
+ },
806
+ },
807
+ "green-dark": {
808
+ extend: "dark",
809
+ colors: {
810
+ primary: {
811
+ 50: "#EFFFEF",
812
+ 100: "#CFFCD1",
813
+ 200: "#A0F9AC",
814
+ 300: "#6FEE8D",
815
+ 400: "#49DE7B",
816
+ 500: "#16C964",
817
+ 600: "#10AC64",
818
+ 700: "#0B905F",
819
+ 800: "#077457",
820
+ 900: "#046051",
821
+ foreground: "#000",
822
+ DEFAULT: "#16C964",
823
+ },
824
+ secondary: {
825
+ "50": "#e3eaff",
826
+ "100": "#D7DFFE",
827
+ "200": "#AFBFFE",
828
+ "300": "#889DFD",
829
+ "400": "#6A82FB",
830
+ "500": "#3956F9",
831
+ "600": "#2941D6",
832
+ "700": "#1C2EB3",
833
+ "800": "#121F90",
834
+ "900": "#0A1477",
835
+ foreground: "#fff",
836
+ DEFAULT: "#3956F9",
837
+ },
838
+ success: {
839
+ "50": "#e7fde3",
840
+ "100": "#E8FCD3",
841
+ "200": "#CBFAA8",
842
+ "300": "#A4F17B",
843
+ "400": "#7EE358",
844
+ "500": "#49D127",
845
+ "600": "#2FB31C",
846
+ "700": "#1A9613",
847
+ "800": "#0C790E",
848
+ "900": "#076410",
849
+ foreground: "#000",
850
+ DEFAULT: "#49D127",
1816
851
  },
1817
- focus: "#ff4f4f",
852
+ warning: {
853
+ "50": "#fff9da",
854
+ "100": "#FFF7CC",
855
+ "200": "#FFEE99",
856
+ "300": "#FFE266",
857
+ "400": "#FFD63F",
858
+ "500": "#FFC300",
859
+ "600": "#DBA200",
860
+ "700": "#B78300",
861
+ "800": "#936600",
862
+ "900": "#7A5100",
863
+ foreground: "#000",
864
+ DEFAULT: "#FFC300",
865
+ },
866
+ danger: {
867
+ "50": "#ffe2e5",
868
+ "100": "#FFE3D8",
869
+ "200": "#FFC1B2",
870
+ "300": "#FF988B",
871
+ "400": "#FF726F",
872
+ "500": "#FF3F4C",
873
+ "600": "#DB2E49",
874
+ "700": "#B71F45",
875
+ "800": "#93143F",
876
+ "900": "#7A0C3B",
877
+ foreground: "#fff",
878
+ DEFAULT: "#FF3F4C",
879
+ },
880
+ focus: "#66cc8a",
881
+ overlay: "#ffffff",
1818
882
  },
1819
883
  },
1820
- "green-light": {
1821
- extend: "light",
1822
- colors: {
1823
- primary: {
1824
- 50: "#EFFFEF",
1825
- 100: "#CFFCD1",
1826
- 200: "#A0F9AC",
1827
- 300: "#6FEE8D",
1828
- 400: "#49DE7B",
1829
- 500: "#16C964",
1830
- 600: "#10AC64",
1831
- 700: "#0B905F",
1832
- 800: "#077457",
1833
- 900: "#046051",
1834
- foreground: "#000",
1835
- DEFAULT: "#16C964",
1836
- },
1837
- secondary: {
1838
- "50": "#e3eaff",
1839
- "100": "#D7DFFE",
1840
- "200": "#AFBFFE",
1841
- "300": "#889DFD",
1842
- "400": "#6A82FB",
1843
- "500": "#3956F9",
1844
- "600": "#2941D6",
1845
- "700": "#1C2EB3",
1846
- "800": "#121F90",
1847
- "900": "#0A1477",
1848
- foreground: "#fff",
1849
- DEFAULT: "#3956F9",
1850
- },
1851
- success: {
1852
- "50": "#e7fde3",
1853
- "100": "#E8FCD3",
1854
- "200": "#CBFAA8",
1855
- "300": "#A4F17B",
1856
- "400": "#7EE358",
1857
- "500": "#49D127",
1858
- "600": "#2FB31C",
1859
- "700": "#1A9613",
1860
- "800": "#0C790E",
1861
- "900": "#076410",
1862
- foreground: "#000",
1863
- DEFAULT: "#49D127",
1864
- },
1865
- warning: {
1866
- "50": "#fff9da",
1867
- "100": "#FFF7CC",
1868
- "200": "#FFEE99",
1869
- "300": "#FFE266",
1870
- "400": "#FFD63F",
1871
- "500": "#FFC300",
1872
- "600": "#DBA200",
1873
- "700": "#B78300",
1874
- "800": "#936600",
1875
- "900": "#7A5100",
1876
- foreground: "#000",
1877
- DEFAULT: "#FFC300",
1878
- },
1879
- danger: {
1880
- "50": "#ffe2e5",
1881
- "100": "#FFE3D8",
1882
- "200": "#FFC1B2",
1883
- "300": "#FF988B",
1884
- "400": "#FF726F",
1885
- "500": "#FF3F4C",
1886
- "600": "#DB2E49",
1887
- "700": "#B71F45",
1888
- "800": "#93143F",
1889
- "900": "#7A0C3B",
1890
- foreground: "#000",
1891
- DEFAULT: "#FF3F4C",
1892
- },
1893
- focus: "#66cc8a",
1894
- overlay: "#000000",
884
+ };
885
+
886
+ var ColorSelector = function (_a) {
887
+ var selectedColor = _a.selectedColor, onColorChange = _a.onColorChange;
888
+ var mode = useThemeContext().mode;
889
+ /**
890
+ * Filters and maps the available theme colors to the current theme mode (light/dark).
891
+ * Each color option contains:
892
+ * - value: the theme name (e.g., "blue-light")
893
+ * - label: the base color name (e.g., "blue")
894
+ * - color: the primary color hex value
895
+ */
896
+ var colorOptions = Object.entries(themeColors)
897
+ .filter(function (_a) {
898
+ var themeData = _a[1];
899
+ var themeMode = themeData.extend;
900
+ return mode === "light" ? themeMode === "light" : themeMode === "dark";
901
+ })
902
+ .map(function (_a) {
903
+ var themeName = _a[0], theme = _a[1];
904
+ return ({
905
+ value: themeName,
906
+ label: themeName.split("-")[0],
907
+ color: theme.colors.primary.DEFAULT,
908
+ });
909
+ });
910
+ return (jsxRuntime.jsx(react.RadioGroup, { value: selectedColor, onValueChange: onColorChange, orientation: "horizontal", className: "flex flex-wrap !gap-2", classNames: {
911
+ base: "flex flex-wrap !gap-2",
912
+ wrapper: "flex flex-wrap !gap-2",
913
+ }, children: colorOptions.map(function (color) { return (jsxRuntime.jsx(react.Radio, { value: color.label, className: "p-0 m-0", classNames: {
914
+ base: "p-0 m-0",
915
+ wrapper: "hidden",
916
+ labelWrapper: "p-0 m-0",
917
+ }, children: jsxRuntime.jsx("div", { className: "w-8 h-8 rounded-full border-2 cursor-pointer transition-all ".concat(selectedColor === color.label
918
+ ? "border-black border-opacity-20 scale-110"
919
+ : "border-gray-200 hover:scale-105"), style: { backgroundColor: color.color }, title: color.label }) }, color.value)); }) }));
920
+ };
921
+
922
+ var H1 = function (_a) {
923
+ var children = _a.children, className = _a.className, props = __rest(_a, ["children", "className"]);
924
+ return (jsxRuntime.jsx("h1", __assign({ className: react.cn("text-xl font-bold", className) }, props, { children: children })));
925
+ };
926
+
927
+ var H3 = function (_a) {
928
+ var children = _a.children, className = _a.className, props = __rest(_a, ["children", "className"]);
929
+ return (jsxRuntime.jsx("h3", __assign({ className: react.cn("text-base font-medium mb-1", className) }, props, { children: children })));
930
+ };
931
+
932
+ var H4 = function (_a) {
933
+ var children = _a.children, className = _a.className, props = __rest(_a, ["children", "className"]);
934
+ return (jsxRuntime.jsx("h4", __assign({ className: react.cn("text-sm font-medium mb-1", className) }, props, { children: children })));
935
+ };
936
+
937
+ var ConfigMenu = function (_a) {
938
+ var _b;
939
+ var options = _a.options, onLogout = _a.onLogout, translations = _a.translations;
940
+ return (jsxRuntime.jsxs(react.Dropdown, { className: "min-w-40", children: [jsxRuntime.jsx(react.DropdownTrigger, { children: jsxRuntime.jsx(react.Button, { isIconOnly: true, color: "default", startContent: jsxRuntime.jsx(IconComponent, { icon: "solar:settings-linear" }) }) }), jsxRuntime.jsxs(react.DropdownMenu, { "aria-label": "Configuration", children: [jsxRuntime.jsx(react.DropdownSection, { showDivider: true, className: "mb-0", children: options.map(function (item) { return (jsxRuntime.jsx(react.DropdownItem, { href: item.href, className: "data-[hover=true]:bg-primary-100 data-[hover=true]:text-default-700", classNames: {
941
+ base: "text-default-500",
942
+ }, startContent: item.icon ? jsxRuntime.jsx(IconComponent, { icon: item.icon }) : undefined, children: item.label }, item.label)); }) }), jsxRuntime.jsx(react.DropdownSection, { children: jsxRuntime.jsx(react.DropdownItem, { onPress: onLogout, className: "data-[hover=true]:bg-primary-100 data-[hover=true]:text-default-700", classNames: {
943
+ base: "text-default-500",
944
+ }, startContent: jsxRuntime.jsx(IconComponent, { icon: "solar:logout-2-linear" }), children: (_b = translations === null || translations === void 0 ? void 0 : translations.logout) !== null && _b !== void 0 ? _b : "Logout" }, "logout") })] })] }));
945
+ };
946
+ ConfigMenu.displayName = "ConfigMenu";
947
+
948
+ var NotificationButton = function (_a) {
949
+ var _b = _a.notificationCount, notificationCount = _b === void 0 ? 0 : _b;
950
+ return (jsxRuntime.jsx(react.Button, { isIconOnly: true, color: "secondary", variant: "flat", startContent: jsxRuntime.jsx(IconComponent, { icon: "solar:bell-bing-linear" }), children: notificationCount > 0 && (jsxRuntime.jsx("span", { className: "notification__alert", children: notificationCount })) }));
951
+ };
952
+ NotificationButton.displayName = "NotificationButton";
953
+
954
+ var HeaderComponent = function (_a) {
955
+ var notificationCount = _a.notificationCount, options = _a.options, onMenuClick = _a.onMenuClick, onLogout = _a.onLogout, translations = _a.translations;
956
+ return (jsxRuntime.jsxs("header", { className: "header__container", children: [jsxRuntime.jsx(react.Button, { className: "sm:hidden", isIconOnly: true, variant: "light", startContent: jsxRuntime.jsx(IconComponent, { icon: "solar:hamburger-menu-linear" }), onPress: onMenuClick }), jsxRuntime.jsxs("div", { className: "flex items-center gap-4", children: [jsxRuntime.jsx(NotificationButton, { notificationCount: notificationCount }), jsxRuntime.jsx(ConfigMenu, { options: options, onLogout: onLogout, translations: translations })] })] }));
957
+ };
958
+ HeaderComponent.displayName = "Header";
959
+
960
+ function normalizeClass(value) {
961
+ if (typeof value === "string") {
962
+ return value || undefined;
963
+ }
964
+ if (Array.isArray(value)) {
965
+ return value.filter(Boolean).join(" ") || undefined;
966
+ }
967
+ return undefined;
968
+ }
969
+ var getSectionClasses = function (isCollapsed, sectionClassesProp) {
970
+ if (sectionClassesProp === void 0) { sectionClassesProp = {}; }
971
+ return (__assign(__assign({}, Object.fromEntries(Object.entries(sectionClassesProp).map(function (_a) {
972
+ var k = _a[0], v = _a[1];
973
+ return [k, normalizeClass(v)];
974
+ }))), { base: normalizeClass(react.cn(sectionClassesProp === null || sectionClassesProp === void 0 ? void 0 : sectionClassesProp.base, "w-full", {
975
+ "p-0 max-w-[44px]": isCollapsed,
976
+ })), group: normalizeClass(react.cn(sectionClassesProp === null || sectionClassesProp === void 0 ? void 0 : sectionClassesProp.group, {
977
+ "flex flex-col gap-1": isCollapsed,
978
+ })), heading: normalizeClass(react.cn(sectionClassesProp === null || sectionClassesProp === void 0 ? void 0 : sectionClassesProp.heading, {
979
+ hidden: isCollapsed,
980
+ })) }));
981
+ };
982
+ var getItemClasses = function (isCollapsed, itemClassesProp) {
983
+ if (itemClassesProp === void 0) { itemClassesProp = {}; }
984
+ return (__assign(__assign({}, Object.fromEntries(Object.entries(itemClassesProp).map(function (_a) {
985
+ var k = _a[0], v = _a[1];
986
+ return [k, normalizeClass(v)];
987
+ }))), { base: normalizeClass(react.cn(itemClassesProp === null || itemClassesProp === void 0 ? void 0 : itemClassesProp.base, {
988
+ "w-11 h-11 gap-0 p-0": isCollapsed,
989
+ })) }));
990
+ };
991
+
992
+ var EnumMenuNavListItem;
993
+ (function (EnumMenuNavListItem) {
994
+ EnumMenuNavListItem["Nest"] = "nest";
995
+ })(EnumMenuNavListItem || (EnumMenuNavListItem = {}));
996
+
997
+ /**
998
+ * @component MenuNavList
999
+ * @description A versatile navigation list component that can be displayed in an expanded or collapsed state.
1000
+ * It supports nested items, sections, and tooltips for items in the collapsed state.
1001
+ *
1002
+ * @param {MenuNavListProps} props - Props for configuring the component.
1003
+ * @param {MenuNavListItem[]} props.items - Array of items to display in the list.
1004
+ * @param {boolean} [props.isCollapsed] - If `true`, the menu is displayed in its collapsed state (icons only).
1005
+ * @param {React.Key} [props.defaultSelectedKey] - The key of the default selected item.
1006
+ * @param {(key: React.Key) => void} [props.onSelect] - Callback executed when an item is selected.
1007
+ * @param {boolean} [props.hideEndContent] - If `true`, hides the end content of the items.
1008
+ * @param {object} [props.sectionClasses] - CSS classes to customize the sections.
1009
+ * @param {object} [props.itemClasses] - CSS classes to customize the items.
1010
+ * @param {string} [props.iconClassName] - CSS class for the icons.
1011
+ * @param {object} [props.classNames] - CSS classes to customize the Listbox component.
1012
+ * @param {string} [props.className] - CSS class for the main container.
1013
+ *
1014
+ * @forwardRef
1015
+ */
1016
+ var MenuNavList = React.forwardRef(function (_a, ref) {
1017
+ var items = _a.items, isCollapsed = _a.isCollapsed, defaultSelectedKey = _a.defaultSelectedKey; _a.onSelect; var hideEndContent = _a.hideEndContent, _b = _a.sectionClasses, sectionClassesProp = _b === void 0 ? {} : _b, _c = _a.itemClasses, itemClassesProp = _c === void 0 ? {} : _c, iconClassName = _a.iconClassName, classNames = _a.classNames, className = _a.className, props = __rest(_a, ["items", "isCollapsed", "defaultSelectedKey", "onSelect", "hideEndContent", "sectionClasses", "itemClasses", "iconClassName", "classNames", "className"]);
1018
+ var _d = React.useState(defaultSelectedKey), selected = _d[0], setSelected = _d[1];
1019
+ // Component styles
1020
+ var sectionClasses = getSectionClasses(isCollapsed, sectionClassesProp);
1021
+ var itemClasses = getItemClasses(isCollapsed, itemClassesProp);
1022
+ // Handles the click event on an item, updating the selection state.
1023
+ // biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
1024
+ var handleItemPress = React.useCallback(function (item, parentKey) {
1025
+ var keySelected = typeof parentKey === "string" ? parentKey : item.key;
1026
+ setSelected(keySelected);
1027
+ // Force blur to remove hover state after click.
1028
+ if (document.activeElement instanceof HTMLElement) {
1029
+ document.activeElement.blur();
1030
+ }
1031
+ }, [setSelected]);
1032
+ // Renders the item displayed inside the Popover when the menu is collapsed.
1033
+ var renderCompactItem = React.useCallback(function (item, parentKey) {
1034
+ var _a, _b;
1035
+ return (React.createElement(react.ListboxItem, __assign({}, item, { key: item.key, endContent: (_a = item.endContent) !== null && _a !== void 0 ? _a : null, startContent: item.icon ? (jsxRuntime.jsx(IconComponent, { className: react.cn("text-default-500", "group-data-[selected=true]:text-default-600", iconClassName), icon: item.icon, size: "lg" })) : (((_b = item.startContent) !== null && _b !== void 0 ? _b : null)), textValue: item.title, title: item.title, className: "data-[hover=true]:text-default-600", onPress: function () { return handleItemPress(item, parentKey); } })));
1036
+ }, [handleItemPress, iconClassName]);
1037
+ // Renders a nested item, i.e., an item that has sub-items.
1038
+ // biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
1039
+ var renderNestItem = React.useCallback(function (item) {
1040
+ var _a, _b, _c, _d, _e, _f, _g;
1041
+ var isNestType = item.items &&
1042
+ ((_a = item.items) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
1043
+ (item === null || item === void 0 ? void 0 : item.type) === EnumMenuNavListItem.Nest;
1044
+ if (isNestType) {
1045
+ item.href = undefined;
1046
+ }
1047
+ return (React.createElement(react.ListboxItem, __assign({}, item, { key: item.key, classNames: {
1048
+ base: react.cn({
1049
+ "h-auto p-0": !isCollapsed && isNestType,
1050
+ }, {
1051
+ "inline-block w-11": isCollapsed && isNestType,
1052
+ }, {
1053
+ "data-[selected=true]:bg-primary-100 h-11 justify-center items-center flex": isCollapsed && isNestType,
1054
+ }, "rounded-large"),
1055
+ }, endContent: isCollapsed || isNestType || hideEndContent
1056
+ ? null
1057
+ : ((_b = item.endContent) !== null && _b !== void 0 ? _b : null), startContent: isCollapsed || isNestType ? null : item.icon ? (jsxRuntime.jsx(IconComponent, { className: react.cn("text-default-500 group-data-[selected=true]:text-foreground", iconClassName), icon: item.icon, size: "lg" })) : (((_c = item.startContent) !== null && _c !== void 0 ? _c : null)), title: isCollapsed || isNestType ? null : item.title }),
1058
+ isCollapsed && isNestType ? (jsxRuntime.jsxs(react.Popover, { placement: "right", offset: 10, children: [jsxRuntime.jsx(react.PopoverTrigger, { children: jsxRuntime.jsx("div", { className: "flex w-full items-center justify-center", children: jsxRuntime.jsx(react.Tooltip, { content: item.title, placement: "right", classNames: {
1059
+ base: "text-default-500",
1060
+ }, children: jsxRuntime.jsx("div", { className: "flex w-full items-center justify-center", children: item.icon ? (jsxRuntime.jsx(IconComponent, { className: react.cn("text-default-500 group-data-[selected=true]:text-default-600", iconClassName), icon: item.icon, size: "lg" })) : (((_d = item.startContent) !== null && _d !== void 0 ? _d : null)) }) }) }) }), jsxRuntime.jsx(react.PopoverContent, { className: "p-0", children: jsxRuntime.jsxs("div", { className: "min-w-[200px] rounded-large p-2", children: [jsxRuntime.jsx("div", { className: "p-2 text-small font-semibold text-default-500", children: item.title }), jsxRuntime.jsx(react.Listbox, { className: "mt-0.5 text-default-500", "aria-label": "Nested menu items", items: item.items, variant: "flat", children: item.items && ((_e = item.items) === null || _e === void 0 ? void 0 : _e.length) > 0
1061
+ ? item.items.map(function (child) {
1062
+ return renderCompactItem(child, item.key);
1063
+ })
1064
+ : renderCompactItem(item) })] }) })] })) : null,
1065
+ !isCollapsed && isNestType ? (jsxRuntime.jsx(react.Accordion, { className: "p-0", children: jsxRuntime.jsx(react.AccordionItem, { "aria-label": item.title, classNames: {
1066
+ heading: "pr-3 group-data-[selected=true]:bg-primary-100 rounded-large",
1067
+ trigger: "p-0",
1068
+ content: "py-0 pl-4",
1069
+ }, title: item.icon ? (jsxRuntime.jsxs("div", { className: "flex h-11 items-center gap-2 px-3 py-1.5", children: [jsxRuntime.jsx(IconComponent, { className: react.cn("text-default-500 group-data-[selected=true]:text-default-600", iconClassName), icon: item.icon, size: "lg" }), jsxRuntime.jsx("span", { className: "text-small font-medium text-default-500 group-data-[selected=true]:text-default-600", children: item.title })] })) : (((_f = item.startContent) !== null && _f !== void 0 ? _f : null)), children: item.items && ((_g = item.items) === null || _g === void 0 ? void 0 : _g.length) > 0 ? (jsxRuntime.jsx(react.Listbox, { className: "mt-0.5 text-default-500", classNames: {
1070
+ list: react.cn("border-l border-default-200 pl-4"),
1071
+ }, items: item.items, variant: "flat", children: item.items.map(function (child) { return renderItem(child, item.key); }) })) : (renderItem(item)) }, item.key) })) : null));
1072
+ }, [isCollapsed, hideEndContent, iconClassName, items, selected]);
1073
+ // Renders a simple item (without children) in the navigation list.
1074
+ // biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
1075
+ var renderItem = React.useCallback(function (item, parentKey) {
1076
+ var _a, _b, _c, _d;
1077
+ var isNestType = item.items &&
1078
+ ((_a = item.items) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
1079
+ (item === null || item === void 0 ? void 0 : item.type) === EnumMenuNavListItem.Nest;
1080
+ if (isNestType) {
1081
+ return renderNestItem(item);
1082
+ }
1083
+ var isItemSelected = selected === item.key;
1084
+ return (React.createElement(react.ListboxItem, __assign({}, item, { key: item.key, endContent: isCollapsed || hideEndContent ? null : ((_b = item.endContent) !== null && _b !== void 0 ? _b : null), startContent: isCollapsed ? null : item.icon ? (jsxRuntime.jsx(IconComponent, { className: react.cn("text-default-500", "group-data-[selected=true]:text-default-600", iconClassName), icon: item.icon, size: "lg" })) : (((_c = item.startContent) !== null && _c !== void 0 ? _c : null)), textValue: item.title, title: isCollapsed ? null : item.title, onPress: function () { return handleItemPress(item, parentKey); }, "aria-selected": isItemSelected, "aria-label": item.title || "Menu item ".concat(item.key) }), isCollapsed ? (jsxRuntime.jsx(react.Tooltip, { content: item.title, placement: "right", closeDelay: 200, shouldCloseOnBlur: false, classNames: {
1085
+ base: "text-default-500",
1086
+ }, children: jsxRuntime.jsx("div", { className: "flex w-full items-center justify-center", "aria-hidden": "true", children: item.icon ? (jsxRuntime.jsx(IconComponent, { className: react.cn("text-default-500", "group-data-[selected=true]:text-default-600", iconClassName), icon: item.icon, size: "lg" })) : (((_d = item.startContent) !== null && _d !== void 0 ? _d : null)) }) })) : null));
1087
+ },
1088
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1089
+ [isCollapsed, hideEndContent, iconClassName, itemClasses === null || itemClasses === void 0 ? void 0 : itemClasses.base]);
1090
+ return (jsxRuntime.jsx(react.Listbox, __assign({ ref: ref, hideSelectedIcon: true, as: "nav", className: react.cn("list-none", className), classNames: __assign(__assign({}, classNames), { list: react.cn("items-center", classNames === null || classNames === void 0 ? void 0 : classNames.list) }), color: "default", itemClasses: __assign(__assign({}, itemClasses), { base: react.cn("px-3 min-h-11 rounded-large h-[44px] data-[selected=true]:bg-primary-100", itemClasses === null || itemClasses === void 0 ? void 0 : itemClasses.base), title: react.cn("text-small font-medium text-default-500 group-data-[selected=true]:text-default-600 ", itemClasses === null || itemClasses === void 0 ? void 0 : itemClasses.title) }), items: items, selectedKeys: [selected], selectionMode: "single", variant: "flat" }, props, { children: function (item) {
1091
+ var _a, _b;
1092
+ return item.items &&
1093
+ ((_a = item.items) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
1094
+ (item === null || item === void 0 ? void 0 : item.type) === EnumMenuNavListItem.Nest ? (renderNestItem(item)) : item.items && ((_b = item.items) === null || _b === void 0 ? void 0 : _b.length) > 0 ? (jsxRuntime.jsx(react.ListboxSection, { classNames: sectionClasses, showDivider: isCollapsed, title: item.title, children: item.items.map(renderItem) }, item.key)) : (renderItem(item));
1095
+ } }), isCollapsed ? "compact" : "default"));
1096
+ });
1097
+ MenuNavList.displayName = "MenuNavList";
1098
+
1099
+ /**
1100
+ * Sidebar menu component for navigation and user actions.
1101
+ * @param commerceInfo - Object with logo and name of the company.
1102
+ * @param userInfo - Object with user avatar, name, and email.
1103
+ * @param helpButton - Help button configuration.
1104
+ * @param upgradeCard - Optional upgrade card configuration.
1105
+ * @param isOpenSidebar - Controls sidebar visibility.
1106
+ * @param onOpenSidebarChange - Callback to open/close sidebar.
1107
+ */
1108
+ var MenuComponent = React.memo(function Menu(_a) {
1109
+ var commerceInfo = _a.commerceInfo, userInfo = _a.userInfo, helpButton = _a.helpButton, upgradeCard = _a.upgradeCard, isOpenSidebar = _a.isOpenSidebar, onOpenSidebarChange = _a.onOpenSidebarChange, menuItems = _a.menuItems;
1110
+ // State to control menu collapse on desktop devices
1111
+ var _b = React.useState(false), isCollapsed = _b[0], setIsCollapsed = _b[1];
1112
+ // Memoized handlers for performance
1113
+ var handleSidebarClose = React.useCallback(function () {
1114
+ onOpenSidebarChange === null || onOpenSidebarChange === void 0 ? void 0 : onOpenSidebarChange(false);
1115
+ }, [onOpenSidebarChange]);
1116
+ var handleCollapseToggle = React.useCallback(function () {
1117
+ setIsCollapsed(function (prev) { return !prev; });
1118
+ }, []);
1119
+ var handleUpgradeClick = React.useCallback(function () {
1120
+ if (upgradeCard) {
1121
+ window.open(upgradeCard.buttonLink, "_blank");
1122
+ }
1123
+ }, [upgradeCard]);
1124
+ var handleHelpClick = React.useCallback(function () {
1125
+ window.open(helpButton.redirect, "_blank");
1126
+ }, [helpButton]);
1127
+ if (!isOpenSidebar) {
1128
+ return null;
1129
+ }
1130
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("button", { type: "button", "aria-label": "Close sidebar", className: "fixed inset-0 bg-black bg-opacity-40 z-40 xs:block sm:hidden", onClick: handleSidebarClose, style: { border: "none", padding: 0, margin: 0 } }), jsxRuntime.jsx("div", { className: "container__menu ".concat(isCollapsed
1131
+ ? "container__menu--collapsed"
1132
+ : "container__menu--expanded"), children: jsxRuntime.jsxs("div", { className: "content__menu", children: [jsxRuntime.jsxs("div", { className: "content__menu--header", style: { flexDirection: isCollapsed ? "column-reverse" : "row" }, children: [jsxRuntime.jsxs("div", { className: "flex flex-row items-center justify-center ".concat(isCollapsed ? "gap-0" : "gap-2"), children: [jsxRuntime.jsx("div", { className: "flex h-8 w-8 items-center justify-center rounded-full bg-foreground", children: jsxRuntime.jsx("img", { src: commerceInfo.logo, alt: "Logo of ".concat(commerceInfo.name) }) }), jsxRuntime.jsx("span", { className: "collapsible-item text-small font-bold ", children: commerceInfo.name })] }), jsxRuntime.jsxs("div", { className: "flex items-center", children: [jsxRuntime.jsx(IconComponent, { icon: "material-symbols-light:close", size: "lg", className: "cursor-pointer block sm:hidden", onClick: handleSidebarClose }), jsxRuntime.jsx(IconComponent, { icon: isCollapsed
1133
+ ? "solar:alt-arrow-right-outline"
1134
+ : "solar:alt-arrow-left-outline", size: "lg", className: "hidden sm:block cursor-pointer", onClick: handleCollapseToggle })] })] }), jsxRuntime.jsx(react.Spacer, { y: 6 }), jsxRuntime.jsxs("div", { className: "content__menu--user ".concat(isCollapsed ? "gap-0" : "gap-3"), children: [jsxRuntime.jsx(react.Avatar, { size: "md", src: userInfo.avatar, color: userInfo.avatar === "" ? "warning" : "default", name: userInfo.name }), jsxRuntime.jsxs("div", { className: "collapsible-item flex flex-col", children: [jsxRuntime.jsx("p", { className: "text-small font-medium text-default-900", children: userInfo.name }), jsxRuntime.jsx("p", { className: "text-tiny text-default-400", children: userInfo.role })] })] }), jsxRuntime.jsx("div", { className: "".concat(!isCollapsed ? "flex-1" : "h-full", " min-h-0 py-6"), children: jsxRuntime.jsx("div", { className: "h-full overflow-y-auto pr-6 -mr-6 [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]", children: jsxRuntime.jsx(MenuNavList, { defaultSelectedKey: menuItems.selectedKey, items: menuItems.items, isCollapsed: isCollapsed }) }) }), upgradeCard && (jsxRuntime.jsxs("div", { className: "collapsible-item relative", children: [jsxRuntime.jsxs(react.Card, { className: "border-none overflow-visible shadow-none", shadow: "sm", children: [jsxRuntime.jsxs(react.CardBody, { className: "items-center py-5 text-center gap-1", children: [jsxRuntime.jsx("h3", { className: "text-medium font-medium text-default-900", children: upgradeCard.title }), jsxRuntime.jsx("p", { className: "text-small text-default-500 pb-3 whitespace-normal", children: upgradeCard.description })] }), jsxRuntime.jsx(react.CardFooter, { className: "absolute justify-center", style: { bottom: "-30px" }, children: jsxRuntime.jsx(react.Button, { className: "px-10 shadow-md", color: "primary", radius: "full", variant: "shadow", onPress: handleUpgradeClick, children: upgradeCard.buttonText }) })] }), jsxRuntime.jsx(react.Spacer, { y: 9 })] })), jsxRuntime.jsx("div", { className: "mt-auto flex flex-col justify-center items-center", children: jsxRuntime.jsx(react.Button, { fullWidth: true, className: " text-default-500 data-[hover=true]:text-default-600", startContent: jsxRuntime.jsx(IconComponent, { className: "text-default-500", icon: "solar:info-circle-line-duotone", size: "md" }), variant: "light", onPress: handleHelpClick, isIconOnly: isCollapsed, children: !isCollapsed && (jsxRuntime.jsx("span", { className: "collapsible-item", children: helpButton.title })) }) })] }) })] }));
1135
+ });
1136
+
1137
+ var StepIndicator = function (_a) {
1138
+ var currentStep = _a.currentStep, totalSteps = _a.totalSteps, _b = _a.color, color = _b === void 0 ? "primary" : _b, _c = _a.showStepText, showStepText = _c === void 0 ? true : _c, stepTextFormatter = _a.stepTextFormatter, className = _a.className, props = __rest(_a, ["currentStep", "totalSteps", "color", "showStepText", "stepTextFormatter", "className"]);
1139
+ var progressPercentage = Math.min((currentStep / totalSteps) * 100, 100);
1140
+ var colorClasses = {
1141
+ primary: "bg-primary",
1142
+ secondary: "bg-secondary",
1143
+ success: "bg-success",
1144
+ warning: "bg-warning",
1145
+ danger: "bg-danger",
1146
+ };
1147
+ var defaultStepText = function (current, total) {
1148
+ return "Step ".concat(current, " of ").concat(total);
1149
+ };
1150
+ var stepText = stepTextFormatter
1151
+ ? stepTextFormatter(currentStep, totalSteps)
1152
+ : defaultStepText(currentStep, totalSteps);
1153
+ return (jsxRuntime.jsxs("div", __assign({ className: react.cn("w-full", className) }, props, { children: [showStepText && (jsxRuntime.jsx("div", { className: "text-center text-sm font-medium text-default-400 mb-3", children: stepText })), jsxRuntime.jsx("div", { className: "w-full bg-content2 rounded-full h-2 overflow-hidden", children: jsxRuntime.jsx("div", { className: react.cn("h-full transition-all duration-300 ease-out rounded-full", colorClasses[color]), style: { width: "".concat(progressPercentage, "%") } }) })] })));
1154
+ };
1155
+
1156
+ /*
1157
+ * Copyright 2020 Adobe. All rights reserved.
1158
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
1159
+ * you may not use this file except in compliance with the License. You may obtain a copy
1160
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
1161
+ *
1162
+ * Unless required by applicable law or agreed to in writing, software distributed under
1163
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
1164
+ * OF ANY KIND, either express or implied. See the License for the specific language
1165
+ * governing permissions and limitations under the License.
1166
+ */
1167
+ function $458b0a5536c1a7cf$export$40bfa8c7b0832715(value, defaultValue, onChange) {
1168
+ let [stateValue, setStateValue] = (React.useState)(value || defaultValue);
1169
+ let isControlledRef = (React.useRef)(value !== undefined);
1170
+ let isControlled = value !== undefined;
1171
+ (React.useEffect)(()=>{
1172
+ let wasControlled = isControlledRef.current;
1173
+ if (wasControlled !== isControlled && process.env.NODE_ENV !== 'production') console.warn(`WARN: A component changed from ${wasControlled ? 'controlled' : 'uncontrolled'} to ${isControlled ? 'controlled' : 'uncontrolled'}.`);
1174
+ isControlledRef.current = isControlled;
1175
+ }, [
1176
+ isControlled
1177
+ ]);
1178
+ let currentValue = isControlled ? value : stateValue;
1179
+ let setValue = (React.useCallback)((value, ...args)=>{
1180
+ let onChangeCaller = (value, ...onChangeArgs)=>{
1181
+ if (onChange) {
1182
+ if (!Object.is(currentValue, value)) onChange(value, ...onChangeArgs);
1183
+ }
1184
+ if (!isControlled) // If uncontrolled, mutate the currentValue local variable so that
1185
+ // calling setState multiple times with the same value only emits onChange once.
1186
+ // We do not use a ref for this because we specifically _do_ want the value to
1187
+ // reset every render, and assigning to a ref in render breaks aborted suspended renders.
1188
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1189
+ currentValue = value;
1190
+ };
1191
+ if (typeof value === 'function') {
1192
+ if (process.env.NODE_ENV !== 'production') console.warn('We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320');
1193
+ // this supports functional updates https://reactjs.org/docs/hooks-reference.html#functional-updates
1194
+ // when someone using useControlledState calls setControlledState(myFunc)
1195
+ // this will call our useState setState with a function as well which invokes myFunc and calls onChange with the value from myFunc
1196
+ // if we're in an uncontrolled state, then we also return the value of myFunc which to setState looks as though it was just called with myFunc from the beginning
1197
+ // otherwise we just return the controlled value, which won't cause a rerender because React knows to bail out when the value is the same
1198
+ let updateFunction = (oldValue, ...functionArgs)=>{
1199
+ let interceptedValue = value(isControlled ? currentValue : oldValue, ...functionArgs);
1200
+ onChangeCaller(interceptedValue, ...args);
1201
+ if (!isControlled) return interceptedValue;
1202
+ return oldValue;
1203
+ };
1204
+ setStateValue(updateFunction);
1205
+ } else {
1206
+ if (!isControlled) setStateValue(value);
1207
+ onChangeCaller(value, ...args);
1208
+ }
1209
+ }, [
1210
+ isControlled,
1211
+ currentValue,
1212
+ onChange
1213
+ ]);
1214
+ return [
1215
+ currentValue,
1216
+ setValue
1217
+ ];
1218
+ }
1219
+
1220
+ var defaultTranslations$4 = {
1221
+ checkIconTitle: "Check",
1222
+ };
1223
+ var VerticalSteps = React.forwardRef(function (_a, ref) {
1224
+ var _b = _a.color, color = _b === void 0 ? "primary" : _b, _c = _a.steps, stepsProp = _c === void 0 ? [] : _c, _d = _a.defaultStep, defaultStep = _d === void 0 ? 0 : _d, onStepChange = _a.onStepChange, currentStepProp = _a.currentStep, _e = _a.hideProgressBars, hideProgressBars = _e === void 0 ? false : _e, stepClassName = _a.stepClassName, className = _a.className, translations = _a.translations, props = __rest(_a, ["color", "steps", "defaultStep", "onStepChange", "currentStep", "hideProgressBars", "stepClassName", "className", "translations"]);
1225
+ var _f = $458b0a5536c1a7cf$export$40bfa8c7b0832715(currentStepProp, defaultStep, onStepChange), currentStep = _f[0], setCurrentStep = _f[1];
1226
+ var t = __assign(__assign({}, defaultTranslations$4), translations);
1227
+ var steps = React.useMemo(function () {
1228
+ if (typeof stepsProp === "number") {
1229
+ return Array.from({ length: stepsProp }, function () { return ({}); });
1230
+ }
1231
+ return stepsProp;
1232
+ }, [stepsProp]);
1233
+ var colors = React.useMemo(function () {
1234
+ var _a;
1235
+ var colorMappings = {
1236
+ primary: [
1237
+ "[--step-color:hsl(var(--heroui-primary))]",
1238
+ "[--step-fg-color:hsl(var(--heroui-primary-foreground))]",
1239
+ ],
1240
+ secondary: [
1241
+ "[--step-color:hsl(var(--heroui-secondary))]",
1242
+ "[--step-fg-color:hsl(var(--heroui-secondary-foreground))]",
1243
+ ],
1244
+ success: [
1245
+ "[--step-color:hsl(var(--heroui-success))]",
1246
+ "[--step-fg-color:hsl(var(--heroui-success-foreground))]",
1247
+ ],
1248
+ warning: [
1249
+ "[--step-color:hsl(var(--heroui-warning))]",
1250
+ "[--step-fg-color:hsl(var(--heroui-warning-foreground))]",
1251
+ ],
1252
+ danger: [
1253
+ "[--step-color:hsl(var(--heroui-danger))]",
1254
+ "[--step-fg-color:hsl(var(--heroui-danger-foreground))]",
1255
+ ],
1256
+ default: [
1257
+ "[--step-color:hsl(var(--heroui-default))]",
1258
+ "[--step-fg-color:hsl(var(--heroui-default-foreground))]",
1259
+ ],
1260
+ };
1261
+ var _b = (_a = colorMappings[color]) !== null && _a !== void 0 ? _a : colorMappings.primary, userColor = _b[0], fgColor = _b[1];
1262
+ var colorsVars = [
1263
+ "[--active-fg-color:var(--step-fg-color)]",
1264
+ "[--active-border-color:var(--step-color)]",
1265
+ "[--active-color:var(--step-color)]",
1266
+ "[--complete-background-color:var(--step-color)]",
1267
+ "[--complete-border-color:var(--step-color)]",
1268
+ "[--inactive-border-color:hsl(var(--heroui-default-300))]",
1269
+ "[--inactive-color:hsl(var(--heroui-default-300))]",
1270
+ ];
1271
+ if (!(className === null || className === void 0 ? void 0 : className.includes("--step-fg-color"))) {
1272
+ colorsVars.unshift(fgColor);
1273
+ }
1274
+ if (!(className === null || className === void 0 ? void 0 : className.includes("--step-color"))) {
1275
+ colorsVars.unshift(userColor);
1276
+ }
1277
+ if (!(className === null || className === void 0 ? void 0 : className.includes("--inactive-bar-color"))) {
1278
+ colorsVars.push("[--inactive-bar-color:hsl(var(--heroui-default-300))]");
1279
+ }
1280
+ return colorsVars;
1281
+ }, [color, className]);
1282
+ return (jsxRuntime.jsx("nav", { "aria-label": "Progress", className: "max-w-fit", children: jsxRuntime.jsx("ol", { className: react.cn("flex flex-col gap-y-3", colors, className), children: steps === null || steps === void 0 ? void 0 : steps.map(function (step, stepIdx) {
1283
+ var status = currentStep === stepIdx
1284
+ ? "active"
1285
+ : currentStep < stepIdx
1286
+ ? "inactive"
1287
+ : "complete";
1288
+ return (
1289
+ // biome-ignore lint/suspicious/noArrayIndexKey: <explanation>
1290
+ jsxRuntime.jsxs("li", { className: "relative", children: [jsxRuntime.jsx("div", { className: "flex w-full max-w-full items-center", children: jsxRuntime.jsxs("button", __assign({ type: "button", ref: ref, "aria-current": status === "active" ? "step" : undefined, className: react.cn("group rounded-large flex w-full cursor-pointer items-center justify-center gap-4 px-3 py-2.5", stepClassName), onClick: function () { return setCurrentStep(stepIdx); } }, props, { children: [jsxRuntime.jsx("div", { className: "flex h-full items-center", children: jsxRuntime.jsx(framerMotion.LazyMotion, { features: framerMotion.domAnimation, children: jsxRuntime.jsx("div", { className: "relative", children: jsxRuntime.jsx(framerMotion.m.div, { animate: status, className: react.cn("border-medium text-large text-default-600 relative flex h-[34px] w-[34px] items-center justify-center rounded-full font-semibold", {
1291
+ "shadow-lg": status === "complete",
1292
+ }), "data-status": status, initial: false, transition: { duration: 0.25 }, variants: {
1293
+ inactive: {
1294
+ backgroundColor: "transparent",
1295
+ borderColor: "var(--inactive-border-color)",
1296
+ color: "var(--inactive-color)",
1297
+ },
1298
+ active: {
1299
+ backgroundColor: "transparent",
1300
+ borderColor: "var(--active-border-color)",
1301
+ color: "var(--active-color)",
1302
+ },
1303
+ complete: {
1304
+ backgroundColor: "var(--complete-background-color)",
1305
+ borderColor: "var(--complete-border-color)",
1306
+ },
1307
+ }, children: jsxRuntime.jsx("div", { className: "flex items-center justify-center", children: status === "complete" ? (jsxRuntime.jsx(IconComponent, { className: " text-[var(--active-fg-color)] font-bold", icon: "material-symbols:check-rounded", title: t.checkIconTitle })) : (jsxRuntime.jsx("span", { children: stepIdx + 1 })) }) }) }) }) }), jsxRuntime.jsx("div", { className: "flex-1 text-left", children: jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("div", { className: react.cn("text-medium text-default-600 font-medium transition-[color,opacity] duration-300 group-active:opacity-70", {
1308
+ "text-default-300": status === "inactive",
1309
+ }), children: step.title }), jsxRuntime.jsx("div", { className: react.cn("text-tiny text-default-600 lg:text-small transition-[color,opacity] duration-300 group-active:opacity-70", {
1310
+ "text-default-300": status === "inactive",
1311
+ }), children: step.description })] }) })] }), stepIdx) }), stepIdx < steps.length - 1 && !hideProgressBars && (jsxRuntime.jsx("div", { "aria-hidden": "true", className: react.cn("pointer-events-none absolute top-[calc(64px*var(--idx)+1)] left-3 flex h-1/2 -translate-y-1/3 items-center px-4"), style: {
1312
+ // @ts-ignore
1313
+ "--idx": stepIdx,
1314
+ }, children: jsxRuntime.jsx("div", { className: react.cn("relative h-full w-0.5 bg-[var(--inactive-bar-color)] transition-colors duration-300", "after:absolute after:block after:h-0 after:w-full after:bg-[var(--active-border-color)] after:transition-[height] after:duration-300 after:content-['']", {
1315
+ "after:h-full": stepIdx < currentStep,
1316
+ }) }) }))] }, stepIdx));
1317
+ }) }) }));
1318
+ });
1319
+ VerticalSteps.displayName = "VerticalSteps";
1320
+
1321
+ var stepperClasses = react.cn(
1322
+ // light
1323
+ "[--step-color:hsl(var(--heroui-primary-400))]", "[--active-color:hsl(var(--heroui-primary-400))]", "[--inactive-border-color:hsl(var(--heroui-primary-200))]", "[--inactive-bar-color:hsl(var(--heroui-primary-200))]", "[--inactive-color:hsl(var(--heroui-primary-300))]",
1324
+ // dark
1325
+ "dark:[--step-color:rgba(255,255,255,0.1)]", "dark:[--active-color:hsl(var(--heroui-foreground-600))]", "dark:[--active-border-color:rgba(255,255,255,0.5)]", "dark:[--inactive-border-color:rgba(255,255,255,0.1)]", "dark:[--inactive-bar-color:rgba(255,255,255,0.1)]", "dark:[--inactive-color:rgba(255,255,255,0.2)]");
1326
+ var MultiStepSidebar = React.forwardRef(function (_a, ref) {
1327
+ var children = _a.children, className = _a.className, currentPage = _a.currentPage; _a.onBack; var onChangePage = _a.onChangePage, steps = _a.steps; _a.goBackTranslation; var onClose = _a.onClose, props = __rest(_a, ["children", "className", "currentPage", "onBack", "onChangePage", "steps", "goBackTranslation", "onClose"]);
1328
+ var handleOverlayClick = function (e) {
1329
+ if (e.target === e.currentTarget) {
1330
+ onClose === null || onClose === void 0 ? void 0 : onClose();
1331
+ }
1332
+ };
1333
+ return (jsxRuntime.jsx("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-content3/50 backdrop-blur-sm", onClick: handleOverlayClick, children: jsxRuntime.jsxs("div", __assign({ ref: ref, className: react.cn("flex h-full w-full max-w-4xl rounded-lg bg-background shadow-lg lg:h-auto", className) }, props, { children: [jsxRuntime.jsx("div", { className: "hidden w-1/3 flex-col items-center gap-y-8 p-8 lg:flex", children: jsxRuntime.jsx(VerticalSteps, { className: stepperClasses, color: "primary", currentStep: currentPage, steps: steps, onStepChange: onChangePage }) }), jsxRuntime.jsxs("div", { className: "relative flex h-auto w-full flex-col items-center gap-4 md:p-4 lg:w-2/3", children: [jsxRuntime.jsx(Button, { isIconOnly: true, className: "absolute right-4 top-4", size: "sm", variant: "light", color: "default", onPress: onClose, startContent: jsxRuntime.jsx(IconComponent, { className: "text-foreground", icon: "material-symbols:close-rounded", size: "lg" }) }), jsxRuntime.jsx("div", { className: "pt-9 w-10/12 lg:hidden", children: jsxRuntime.jsx("div", { className: "flex justify-center", children: jsxRuntime.jsx(StepIndicator, { className: react.cn(stepperClasses), currentStep: currentPage + 1, totalSteps: steps.length }) }) }), jsxRuntime.jsx("div", { className: "h-full w-full p-4 sm:max-w-md md:max-w-lg", children: children })] })] })) }));
1334
+ });
1335
+ MultiStepSidebar.displayName = "MultiStepSidebar";
1336
+
1337
+ var MultistepNavigationButtons = function (_a) {
1338
+ var nextButtonProps = _a.nextButtonProps, cancelButtonProps = _a.cancelButtonProps, className = _a.className;
1339
+ // const { children: backButtonChildren, ...restBackButtonProps } =
1340
+ // backButtonProps || {};
1341
+ var _b = nextButtonProps || {}, nextButtonChildren = _b.children, restNextButtonProps = __rest(_b, ["children"]);
1342
+ var _c = cancelButtonProps || {}, cancelButtonChildren = _c.children, restCancelButtonProps = __rest(_c, ["children"]);
1343
+ return (jsxRuntime.jsx("div", { className: react.cn("flex w-full flex-col-reverse gap-2 pt-4 sm:flex-row sm:justify-between md:justify-end", className), children: jsxRuntime.jsxs("div", { className: "flex w-full flex-col-reverse gap-2 sm:w-auto sm:flex-row", children: [jsxRuntime.jsx(react.Button, __assign({ className: "w-full sm:w-auto", color: "primary", variant: "flat" }, restCancelButtonProps, { children: cancelButtonChildren || "Cancel" })), jsxRuntime.jsx(react.Button, __assign({ className: "w-full sm:w-auto", color: "primary" }, restNextButtonProps, { children: nextButtonChildren || "Next" }))] }) }));
1344
+ };
1345
+
1346
+ var variants = {
1347
+ enter: function (direction) { return ({
1348
+ y: direction > 0 ? 30 : -30,
1349
+ opacity: 0,
1350
+ }); },
1351
+ center: {
1352
+ zIndex: 1,
1353
+ y: 0,
1354
+ opacity: 1,
1355
+ },
1356
+ exit: function (direction) { return ({
1357
+ zIndex: 0,
1358
+ y: direction < 0 ? 30 : -30,
1359
+ opacity: 0,
1360
+ }); },
1361
+ };
1362
+ var MultiStepWizard = function (_a) {
1363
+ var isOpen = _a.isOpen, steps = _a.steps, translations = _a.translations, onClose = _a.onClose;
1364
+ var _b = React.useState([0, 0]), _c = _b[0], page = _c[0], direction = _c[1], setPage = _b[1];
1365
+ React.useEffect(function () {
1366
+ if (isOpen) {
1367
+ setPage([0, 0]);
1368
+ }
1369
+ }, [isOpen]);
1370
+ var t = __assign({
1371
+ continue: "Continue",
1372
+ goBack: "Back",
1373
+ cancel: "Cancel",
1374
+ signUp: "Sign Up for Free",
1375
+ goToPayment: "Go to Payment",
1376
+ }, translations);
1377
+ var paginate = React.useCallback(function (newDirection) {
1378
+ setPage(function (prev) {
1379
+ var nextPage = prev[0] + newDirection;
1380
+ if (nextPage < 0 || nextPage > steps.length - 1) {
1381
+ return prev;
1382
+ }
1383
+ return [nextPage, newDirection];
1384
+ });
1385
+ }, [steps]);
1386
+ var onChangePage = React.useCallback(function (newPage) {
1387
+ setPage(function (prev) {
1388
+ if (newPage < 0 || newPage > steps.length - 1) {
1389
+ return prev;
1390
+ }
1391
+ var currentPage = prev[0];
1392
+ return [newPage, newPage > currentPage ? 1 : -1];
1393
+ });
1394
+ }, [steps]);
1395
+ var onBack = React.useCallback(function () {
1396
+ paginate(-1);
1397
+ }, [paginate]);
1398
+ var onNext = React.useCallback(function () {
1399
+ paginate(1);
1400
+ }, [paginate]);
1401
+ var content = React.useMemo(function () {
1402
+ return (jsxRuntime.jsx(framerMotion.LazyMotion, { features: framerMotion.domAnimation, children: jsxRuntime.jsx(framerMotion.m.div, { animate: "center", className: "col-span-12", custom: direction, exit: "exit", initial: "exit", transition: {
1403
+ y: {
1404
+ ease: "backOut",
1405
+ duration: 0.35,
1406
+ },
1407
+ opacity: { duration: 0.4 },
1408
+ }, variants: variants, children: steps[page].content }, page) }));
1409
+ }, [page, steps, direction]);
1410
+ if (!isOpen) {
1411
+ return null;
1412
+ }
1413
+ return (jsxRuntime.jsxs(MultiStepSidebar, { currentPage: page, goBackTranslation: t.goBack, steps: steps, onBack: onBack, onChangePage: onChangePage, onClose: onClose, onNext: onNext, children: [jsxRuntime.jsx(Button, { className: "w-fit text-default-600 mb-6", color: "default", variant: "light", onPress: onBack, isDisabled: page === 0, startContent: jsxRuntime.jsx(IconComponent, { className: "text-default-500", icon: "material-symbols:arrow-back-rounded", size: "sm" }), children: t.goBack || "Back" }), jsxRuntime.jsxs("div", { className: "relative flex h-fit w-full flex-col pt-6 text-center lg:h-full lg:justify-center lg:pt-0", children: [content, jsxRuntime.jsx(MultistepNavigationButtons, { backButtonProps: {
1414
+ isDisabled: page === 0,
1415
+ onPress: onBack,
1416
+ children: t.goBack,
1417
+ }, cancelButtonProps: {
1418
+ onPress: onClose,
1419
+ children: t.cancel,
1420
+ }, nextButtonProps: {
1421
+ children: page === 0
1422
+ ? t.signUp
1423
+ : page === steps.length - 1
1424
+ ? t.goToPayment
1425
+ : t.continue,
1426
+ onPress: onNext,
1427
+ } })] })] }));
1428
+ };
1429
+
1430
+ var Pagination = function (_a) {
1431
+ _a.size; var props = __rest(_a, ["size"]);
1432
+ return jsxRuntime.jsx(react.Pagination, __assign({ showControls: true, isCompact: true }, props));
1433
+ };
1434
+
1435
+ // Lista simple de países con bandera emoji y código
1436
+ var countries = [
1437
+ { code: "+57", name: "Colombia", flag: "🇨🇴" },
1438
+ { code: "+54", name: "Argentina", flag: "🇦🇷" },
1439
+ { code: "+55", name: "Brazil", flag: "🇧🇷" },
1440
+ { code: "+52", name: "Mexico", flag: "🇲🇽" },
1441
+ { code: "+503", name: "El Salvador", flag: "🇸🇻" },
1442
+ { code: "+51", name: "Peru", flag: "🇵🇪" },
1443
+ { code: "+56", name: "Chile", flag: "🇨🇱" },
1444
+ { code: "+1", name: "United States", flag: "🇺🇸" },
1445
+ { code: "+7", name: "Russia", flag: "🇷🇺" },
1446
+ { code: "+20", name: "Egypt", flag: "🇪🇬" },
1447
+ { code: "+27", name: "South Africa", flag: "🇿🇦" },
1448
+ { code: "+33", name: "France", flag: "🇫🇷" },
1449
+ { code: "+34", name: "Spain", flag: "🇪🇸" },
1450
+ { code: "+39", name: "Italy", flag: "🇮🇹" },
1451
+ { code: "+44", name: "United Kingdom", flag: "🇬🇧" },
1452
+ { code: "+49", name: "Germany", flag: "🇩🇪" },
1453
+ { code: "+51", name: "Peru", flag: "🇵🇪" },
1454
+ { code: "+52", name: "Mexico", flag: "🇲🇽" },
1455
+ { code: "+54", name: "Argentina", flag: "🇦🇷" },
1456
+ { code: "+55", name: "Brazil", flag: "🇧🇷" },
1457
+ { code: "+56", name: "Chile", flag: "🇨🇱" },
1458
+ { code: "+57", name: "Colombia", flag: "🇨🇴" },
1459
+ { code: "+60", name: "Malaysia", flag: "🇲🇾" },
1460
+ { code: "+61", name: "Australia", flag: "🇦🇺" },
1461
+ { code: "+62", name: "Indonesia", flag: "🇮🇩" },
1462
+ { code: "+64", name: "New Zealand", flag: "🇳🇿" },
1463
+ { code: "+65", name: "Singapore", flag: "🇸🇬" },
1464
+ { code: "+66", name: "Thailand", flag: "🇹🇭" },
1465
+ { code: "+81", name: "Japan", flag: "🇯🇵" },
1466
+ { code: "+82", name: "South Korea", flag: "🇰🇷" },
1467
+ { code: "+84", name: "Vietnam", flag: "🇻🇳" },
1468
+ { code: "+86", name: "China", flag: "🇨🇳" },
1469
+ { code: "+91", name: "India", flag: "🇮🇳" },
1470
+ { code: "+351", name: "Portugal", flag: "🇵🇹" },
1471
+ { code: "+503", name: "El Salvador", flag: "🇸🇻" },
1472
+ { code: "+966", name: "Saudi Arabia", flag: "🇸🇦" },
1473
+ { code: "+971", name: "UAE", flag: "🇦🇪" },
1474
+ ];
1475
+ var uniqueCountries = Array.from(new Map(countries.map(function (item) { return [item.code + item.name, item]; })).values());
1476
+ // Traducciones por defecto
1477
+ var defaultTranslations$3 = {
1478
+ label: "Teléfono",
1479
+ placeholder: "Número de teléfono",
1480
+ searchPlaceholder: "Buscar país...",
1481
+ selectCountryAriaLabel: "Seleccionar país",
1482
+ expandListAriaLabel: "Desplegar lista de países",
1483
+ noCountriesFound: "No se encontraron países",
1484
+ };
1485
+
1486
+ var Phone = function (_a) {
1487
+ var id = _a.id, label = _a.label, _b = _a.required, required = _b === void 0 ? false : _b, _c = _a.error, error = _c === void 0 ? false : _c, _d = _a.errorText, errorText = _d === void 0 ? "" : _d, value = _a.value, onChange = _a.onChange, onBlur = _a.onBlur, _e = _a.disabled, disabled = _e === void 0 ? false : _e, _f = _a.name, name = _f === void 0 ? "phone" : _f, _g = _a.translations, translations = _g === void 0 ? {} : _g;
1488
+ var _h = React.useState(false), isDropdownOpen = _h[0], setIsDropdownOpen = _h[1];
1489
+ var _j = React.useState(uniqueCountries[0]), selectedCountry = _j[0], setSelectedCountry = _j[1];
1490
+ var _k = React.useState(""), inputValue = _k[0], setInputValue = _k[1];
1491
+ var dropdownRef = React.useRef(null);
1492
+ var portalDropdownRef = React.useRef(null);
1493
+ var _l = React.useState({}), dropdownPosition = _l[0], setDropdownPosition = _l[1];
1494
+ var _m = React.useState(uniqueCountries), filteredCountries = _m[0], setFilteredCountries = _m[1];
1495
+ var t = __assign(__assign({}, defaultTranslations$3), translations);
1496
+ var finalLabel = label || t.label;
1497
+ React.useEffect(function () {
1498
+ if (value) {
1499
+ var found = uniqueCountries.find(function (c) { return c.code === value.countryCode; });
1500
+ if (found) {
1501
+ setSelectedCountry(found);
1502
+ }
1503
+ setInputValue(value.phoneNumber);
1504
+ }
1505
+ }, [value]);
1506
+ React.useEffect(function () {
1507
+ if (isDropdownOpen) {
1508
+ setFilteredCountries(uniqueCountries);
1509
+ }
1510
+ }, [isDropdownOpen]);
1511
+ React.useLayoutEffect(function () {
1512
+ if (isDropdownOpen && dropdownRef.current) {
1513
+ var rect = dropdownRef.current.getBoundingClientRect();
1514
+ setDropdownPosition({
1515
+ position: "absolute",
1516
+ top: "".concat(rect.bottom + window.scrollY + 4, "px"),
1517
+ left: "".concat(rect.left + window.scrollX, "px"),
1518
+ width: "15rem",
1519
+ zIndex: 50,
1520
+ });
1521
+ }
1522
+ }, [isDropdownOpen]);
1523
+ React.useEffect(function () {
1524
+ var handleClickOutside = function (event) {
1525
+ if (dropdownRef.current &&
1526
+ !dropdownRef.current.contains(event.target) &&
1527
+ portalDropdownRef.current &&
1528
+ !portalDropdownRef.current.contains(event.target)) {
1529
+ setIsDropdownOpen(false);
1530
+ }
1531
+ };
1532
+ if (isDropdownOpen) {
1533
+ document.addEventListener("mousedown", handleClickOutside);
1534
+ }
1535
+ return function () {
1536
+ document.removeEventListener("mousedown", handleClickOutside);
1537
+ };
1538
+ }, [isDropdownOpen]);
1539
+ var handleCountrySelect = function (country) {
1540
+ setSelectedCountry(country);
1541
+ setIsDropdownOpen(false);
1542
+ if (onChange) {
1543
+ onChange({ countryCode: country.code, phoneNumber: inputValue });
1544
+ }
1545
+ };
1546
+ var handleInputChange = function (e) {
1547
+ var val = e.target.value.replace(/\D/g, "");
1548
+ setInputValue(val);
1549
+ if (onChange) {
1550
+ onChange({ countryCode: selectedCountry.code, phoneNumber: val });
1551
+ }
1552
+ };
1553
+ return (jsxRuntime.jsxs("div", { className: "flex flex-col gap-1 w-full relative", id: id, children: [finalLabel && (jsxRuntime.jsxs("label", { htmlFor: "phone-input-".concat(name), className: "text-tiny text-default-500 mb-1", children: [finalLabel, " ", required && jsxRuntime.jsx("span", { className: "text-danger-500", children: "*" })] })), jsxRuntime.jsxs("div", { className: "flex items-center w-full min-h-[56px] transition-colors shadow-sm border-medium border-default-200 rounded-xl focus-within:border-primary-500 dark:focus-within:border-primary-500 ".concat(error ? "border-danger-500 " : "border-default-200").concat(disabled ? "opacity-60" : ""), children: [jsxRuntime.jsx("div", { className: "relative ml-2", ref: dropdownRef, children: jsxRuntime.jsxs("button", { type: "button", className: "flex items-center gap-1 px-4 h-10 rounded-xl bg-default-100 focus:outline-none transition-colors", onClick: function () { return setIsDropdownOpen(function (v) { return !v; }); }, disabled: disabled, tabIndex: 0, "aria-label": t.selectCountryAriaLabel, children: [jsxRuntime.jsx("span", { className: "text-lg", children: selectedCountry.flag }), jsxRuntime.jsx("span", { className: "text-xs text-default-500", children: selectedCountry.code }), jsxRuntime.jsxs("svg", { className: "w-4 h-4 text-default-500 ml-1", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", role: "img", "aria-label": t.expandListAriaLabel, children: [jsxRuntime.jsx("title", { children: t.expandListAriaLabel }), jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" })] })] }) }), jsxRuntime.jsx(react.Input, { type: "tel", className: "flex-1 border-none bg-transparent text-default-500 placeholder-default-500 px-2", placeholder: t.placeholder, value: inputValue, onChange: handleInputChange, onBlur: onBlur, disabled: disabled, name: name, autoComplete: "tel", id: "phone-input-".concat(name) })] }), error && errorText && (jsxRuntime.jsx("span", { className: "text-xs text-danger-500 mt-1", children: errorText })), isDropdownOpen &&
1554
+ reactDom.createPortal(jsxRuntime.jsxs("div", { ref: portalDropdownRef, style: dropdownPosition, className: "bg-content1 border border-default-200 rounded-lg shadow-lg z-50", children: [jsxRuntime.jsx("div", { className: "p-2", children: jsxRuntime.jsx("input", { type: "text", className: "w-full px-3 py-2 text-sm bg-default-100 border-medium border-default-200 text-default-500 rounded-lg focus:outline-none focus:border-primary-500", placeholder: t.searchPlaceholder, onChange: function (e) {
1555
+ var searchTerm = e.target.value.toLowerCase();
1556
+ var filtered = uniqueCountries.filter(function (country) {
1557
+ return country.name.toLowerCase().includes(searchTerm) ||
1558
+ country.code.toLowerCase().includes(searchTerm);
1559
+ });
1560
+ setFilteredCountries(filtered);
1561
+ } }) }), jsxRuntime.jsx("div", { className: "max-h-60 overflow-y-auto", children: filteredCountries.length > 0 ? (filteredCountries.map(function (country) { return (jsxRuntime.jsxs("button", { type: "button", className: "flex items-center w-full px-4 py-2.5 text-sm hover:bg-default-200 ".concat(country.code === selectedCountry.code
1562
+ ? "bg-primary-50"
1563
+ : ""), onClick: function () { return handleCountrySelect(country); }, children: [jsxRuntime.jsx("span", { className: "mr-3 text-lg", children: country.flag }), jsxRuntime.jsx("span", { className: "flex-1 text-left text-default-500", children: country.name }), jsxRuntime.jsx("span", { className: "text-xs text-default-500", children: country.code })] }, country.code)); })) : (jsxRuntime.jsx("div", { className: "px-4 py-2 text-sm text-default-500", children: t.noCountriesFound })) })] }), document.body)] }));
1564
+ };
1565
+
1566
+ var defaultTranslations$2 = {
1567
+ message: "The Winter 2024 Release is here: new editor, analytics API, and so much more.",
1568
+ buttonText: "Explore",
1569
+ closeButtonLabel: "Close Banner",
1570
+ };
1571
+ /**
1572
+ * PromotionalBanner genérico reutilizable basado en HeroUI siguiendo las reglas de diseño BeweOS.
1573
+ */
1574
+ var PromotionalBanner = function (_a) {
1575
+ var message = _a.message, buttonText = _a.buttonText, _b = _a.messageHref, messageHref = _b === void 0 ? "#" : _b, _c = _a.buttonHref, buttonHref = _c === void 0 ? "#" : _c, _d = _a.showCloseButton, showCloseButton = _d === void 0 ? true : _d, _e = _a.isVisible, isVisible = _e === void 0 ? true : _e, _f = _a.gradientColors, gradientColors = _f === void 0 ? ["default-100", "danger-100", "secondary-100"] : _f, _g = _a.buttonGradientColors, buttonGradientColors = _g === void 0 ? ["#F871A0", "#9353D3"] : _g, onClose = _a.onClose, onMessageClick = _a.onMessageClick, onButtonClick = _a.onButtonClick, _h = _a.messageLinkProps, messageLinkProps = _h === void 0 ? {} : _h, _j = _a.buttonProps, buttonProps = _j === void 0 ? {} : _j, _k = _a.translations, translations = _k === void 0 ? {} : _k;
1576
+ var t = __assign(__assign({}, defaultTranslations$2), translations);
1577
+ var finalMessage = message || t.message;
1578
+ var finalButtonText = buttonText || t.buttonText;
1579
+ var handleClose = function () {
1580
+ onClose === null || onClose === void 0 ? void 0 : onClose();
1581
+ };
1582
+ var handleMessageClick = function () {
1583
+ onMessageClick === null || onMessageClick === void 0 ? void 0 : onMessageClick();
1584
+ };
1585
+ var handleButtonClick = function () {
1586
+ onButtonClick === null || onButtonClick === void 0 ? void 0 : onButtonClick();
1587
+ };
1588
+ if (!isVisible) {
1589
+ return null;
1590
+ }
1591
+ var fromColor = gradientColors[0], viaColor = gradientColors[1], toColor = gradientColors[2];
1592
+ var buttonGradient1 = buttonGradientColors[0], buttonGradient2 = buttonGradientColors[1];
1593
+ return (jsxRuntime.jsxs("div", { className: "border-divider flex w-full items-center gap-x-3 border-b-1 bg-gradient-to-r from-".concat(fromColor, " via-").concat(viaColor, " to-").concat(toColor, " px-6 py-2 sm:px-3.5 sm:before:flex-1"), children: [jsxRuntime.jsx("p", { className: "text-small text-foreground", children: jsxRuntime.jsxs(react.Link, __assign({ className: "text-inherit", href: messageHref, onClick: handleMessageClick }, messageLinkProps, { children: [finalMessage, "\u00A0"] })) }), jsxRuntime.jsx(react.Button, __assign({ as: react.Link, className: "group text-small relative h-9 overflow-hidden bg-transparent font-normal", color: "default", endContent: jsxRuntime.jsx(IconComponent, { className: "flex-none transition-transform outline-hidden group-data-[hover=true]:translate-x-0.5 [&>path]:stroke-2", icon: "solar:arrow-right-linear", size: "sm" }), href: buttonHref, style: {
1594
+ border: "solid 2px transparent",
1595
+ backgroundImage: "linear-gradient(hsl(var(--heroui-danger-50)), hsl(var(--heroui-danger-50))), linear-gradient(to right, ".concat(buttonGradient1, ", ").concat(buttonGradient2, ")"),
1596
+ backgroundOrigin: "border-box",
1597
+ backgroundClip: "padding-box, border-box",
1598
+ }, variant: "bordered", onClick: handleButtonClick }, buttonProps, { children: finalButtonText })), showCloseButton && (jsxRuntime.jsx("div", { className: "flex flex-1 justify-end", children: jsxRuntime.jsx(react.Button, { isIconOnly: true, "aria-label": t.closeButtonLabel, className: "-m-1", size: "lg", variant: "bordered", onClick: handleClose, children: jsxRuntime.jsx(IconComponent, { "aria-hidden": "true", className: "text-default-500", icon: "lucide:x", size: "md" }) }) }))] }));
1599
+ };
1600
+
1601
+ var RowSteps = React.forwardRef(function (_a, ref) {
1602
+ var _b = _a.color, color = _b === void 0 ? "primary" : _b, _c = _a.steps, stepsProp = _c === void 0 ? [] : _c, _d = _a.defaultStep, defaultStep = _d === void 0 ? 0 : _d, onStepChange = _a.onStepChange, currentStepProp = _a.currentStep, _e = _a.hideProgressBars, hideProgressBars = _e === void 0 ? false : _e, stepClassName = _a.stepClassName, className = _a.className; _a.translations; var props = __rest(_a, ["color", "steps", "defaultStep", "onStepChange", "currentStep", "hideProgressBars", "stepClassName", "className", "translations"]);
1603
+ var _f = $458b0a5536c1a7cf$export$40bfa8c7b0832715(currentStepProp, defaultStep, onStepChange), currentStep = _f[0], setCurrentStep = _f[1];
1604
+ var steps = React.useMemo(function () {
1605
+ if (typeof stepsProp === "number") {
1606
+ return Array.from({ length: stepsProp }, function () { return ({}); });
1607
+ }
1608
+ return stepsProp;
1609
+ }, [stepsProp]);
1610
+ var colors = React.useMemo(function () {
1611
+ var _a;
1612
+ var colorMappings = {
1613
+ primary: [
1614
+ "[--step-color:hsl(var(--heroui-primary))]",
1615
+ "[--step-fg-color:hsl(var(--heroui-primary-foreground))]",
1616
+ ],
1617
+ secondary: [
1618
+ "[--step-color:hsl(var(--heroui-secondary))]",
1619
+ "[--step-fg-color:hsl(var(--heroui-secondary-foreground))]",
1620
+ ],
1621
+ success: [
1622
+ "[--step-color:hsl(var(--heroui-success))]",
1623
+ "[--step-fg-color:hsl(var(--heroui-success-foreground))]",
1624
+ ],
1625
+ warning: [
1626
+ "[--step-color:hsl(var(--heroui-warning))]",
1627
+ "[--step-fg-color:hsl(var(--heroui-warning-foreground))]",
1628
+ ],
1629
+ danger: [
1630
+ "[--step-color:hsl(var(--heroui-danger))]",
1631
+ "[--step-fg-color:hsl(var(--heroui-danger-foreground))]",
1632
+ ],
1633
+ default: [
1634
+ "[--step-color:hsl(var(--heroui-default))]",
1635
+ "[--step-fg-color:hsl(var(--heroui-default-foreground))]",
1636
+ ],
1637
+ };
1638
+ var _b = (_a = colorMappings[color]) !== null && _a !== void 0 ? _a : colorMappings.primary, userColor = _b[0], fgColor = _b[1];
1639
+ var colorsVars = [
1640
+ "[--active-fg-color:var(--step-fg-color)]",
1641
+ "[--active-border-color:var(--step-color)]",
1642
+ "[--active-color:var(--step-color)]",
1643
+ "[--complete-background-color:var(--step-color)]",
1644
+ "[--complete-border-color:var(--step-color)]",
1645
+ "[--inactive-border-color:hsl(var(--heroui-default-300))]",
1646
+ "[--inactive-color:hsl(var(--heroui-default-300))]",
1647
+ ];
1648
+ if (!(className === null || className === void 0 ? void 0 : className.includes("--step-fg-color"))) {
1649
+ colorsVars.unshift(fgColor);
1650
+ }
1651
+ if (!(className === null || className === void 0 ? void 0 : className.includes("--step-color"))) {
1652
+ colorsVars.unshift(userColor);
1653
+ }
1654
+ if (!(className === null || className === void 0 ? void 0 : className.includes("--inactive-bar-color"))) {
1655
+ colorsVars.push("[--inactive-bar-color:hsl(var(--heroui-default-300))]");
1656
+ }
1657
+ return colorsVars;
1658
+ }, [color, className]);
1659
+ return (jsxRuntime.jsx("nav", { "aria-label": "Progress", className: "-my-4 max-w-fit overflow-x-auto py-4", children: jsxRuntime.jsx("ol", { className: react.cn("flex flex-row flex-nowrap gap-x-3", colors, className), children: steps === null || steps === void 0 ? void 0 : steps.map(function (step, stepIdx) {
1660
+ var status = currentStep === stepIdx
1661
+ ? "active"
1662
+ : currentStep < stepIdx
1663
+ ? "inactive"
1664
+ : "complete";
1665
+ return (jsxRuntime.jsx("li", { className: "relative flex w-full items-center pr-12 last:pr-0", children: jsxRuntime.jsxs("button", __assign({ type: "button", ref: ref, "aria-current": status === "active" ? "step" : undefined, className: react.cn("group rounded-large flex w-full cursor-pointer flex-row items-center justify-center gap-x-3 py-2.5", stepClassName), onClick: function () { return setCurrentStep(stepIdx); } }, props, { children: [jsxRuntime.jsx("div", { className: "h-ful relative flex items-center", children: jsxRuntime.jsx(framerMotion.LazyMotion, { features: framerMotion.domAnimation, children: jsxRuntime.jsx(framerMotion.m.div, { animate: status, className: "relative", children: jsxRuntime.jsx(framerMotion.m.div, { className: react.cn("border-medium text-large text-default-600 relative flex h-[34px] w-[34px] items-center justify-center rounded-full font-semibold", {
1666
+ "shadow-lg": status === "complete",
1667
+ }), initial: false, transition: { duration: 0.25 }, variants: {
1668
+ inactive: {
1669
+ backgroundColor: "transparent",
1670
+ borderColor: "var(--inactive-border-color)",
1671
+ color: "var(--inactive-color)",
1672
+ },
1673
+ active: {
1674
+ backgroundColor: "transparent",
1675
+ borderColor: "var(--active-border-color)",
1676
+ color: "var(--active-color)",
1677
+ },
1678
+ complete: {
1679
+ backgroundColor: "var(--complete-background-color)",
1680
+ borderColor: "var(--complete-border-color)",
1681
+ },
1682
+ }, children: jsxRuntime.jsx("div", { className: "flex items-center justify-center", children: status === "complete" ? (jsxRuntime.jsx(IconComponent, { className: " text-[var(--active-fg-color)] font-bold", icon: "material-symbols:check-rounded" })) : (jsxRuntime.jsx("span", { children: stepIdx + 1 })) }) }) }) }) }), step.title && (jsxRuntime.jsx("div", { className: "max-w-full flex-1 text-start", children: jsxRuntime.jsx("div", { className: react.cn("text-small text-default-600 lg:text-medium font-medium transition-[color,opacity] duration-300 group-active:opacity-80", {
1683
+ "text-default-300": status === "inactive",
1684
+ }), children: step.title }) })), stepIdx < steps.length - 1 && !hideProgressBars && (jsxRuntime.jsx("div", { "aria-hidden": "true", className: "pointer-events-none absolute right-0 w-10 flex-none items-center", style: {
1685
+ // @ts-ignore
1686
+ "--idx": stepIdx,
1687
+ }, children: jsxRuntime.jsx("div", { className: react.cn("relative h-0.5 w-full bg-[var(--inactive-bar-color)] transition-colors duration-300", "after:absolute after:block after:h-full after:w-0 after:bg-[var(--active-border-color)] after:transition-[width] after:duration-300 after:content-['']", {
1688
+ "after:w-full": stepIdx < currentStep,
1689
+ }) }) }))] }), stepIdx) }, stepIdx));
1690
+ }) }) }));
1691
+ });
1692
+ RowSteps.displayName = "RowSteps";
1693
+
1694
+ function $14e0f24ef4ac5c92$export$c19a80a9721b80f6(a, b) {
1695
+ return $14e0f24ef4ac5c92$var$timeToMs(a) - $14e0f24ef4ac5c92$var$timeToMs(b);
1696
+ }
1697
+ function $14e0f24ef4ac5c92$var$timeToMs(a) {
1698
+ return a.hour * 3600000 + a.minute * 60000 + a.second * 1000 + a.millisecond;
1699
+ }
1700
+
1701
+ function $735220c2d4774dd3$export$3e2544e88a25bff8(duration) {
1702
+ let inverseDuration = {};
1703
+ for(let key in duration)if (typeof duration[key] === 'number') inverseDuration[key] = -duration[key];
1704
+ return inverseDuration;
1705
+ }
1706
+ function $735220c2d4774dd3$export$e5d5e1c1822b6e56(value, fields) {
1707
+ let mutableValue = value.copy();
1708
+ if (fields.hour != null) mutableValue.hour = fields.hour;
1709
+ if (fields.minute != null) mutableValue.minute = fields.minute;
1710
+ if (fields.second != null) mutableValue.second = fields.second;
1711
+ if (fields.millisecond != null) mutableValue.millisecond = fields.millisecond;
1712
+ $735220c2d4774dd3$export$7555de1e070510cb(mutableValue);
1713
+ return mutableValue;
1714
+ }
1715
+ function $735220c2d4774dd3$var$balanceTime(time) {
1716
+ time.second += Math.floor(time.millisecond / 1000);
1717
+ time.millisecond = $735220c2d4774dd3$var$nonNegativeMod(time.millisecond, 1000);
1718
+ time.minute += Math.floor(time.second / 60);
1719
+ time.second = $735220c2d4774dd3$var$nonNegativeMod(time.second, 60);
1720
+ time.hour += Math.floor(time.minute / 60);
1721
+ time.minute = $735220c2d4774dd3$var$nonNegativeMod(time.minute, 60);
1722
+ let days = Math.floor(time.hour / 24);
1723
+ time.hour = $735220c2d4774dd3$var$nonNegativeMod(time.hour, 24);
1724
+ return days;
1725
+ }
1726
+ function $735220c2d4774dd3$export$7555de1e070510cb(time) {
1727
+ time.millisecond = Math.max(0, Math.min(time.millisecond, 1000));
1728
+ time.second = Math.max(0, Math.min(time.second, 59));
1729
+ time.minute = Math.max(0, Math.min(time.minute, 59));
1730
+ time.hour = Math.max(0, Math.min(time.hour, 23));
1731
+ }
1732
+ function $735220c2d4774dd3$var$nonNegativeMod(a, b) {
1733
+ let result = a % b;
1734
+ if (result < 0) result += b;
1735
+ return result;
1736
+ }
1737
+ function $735220c2d4774dd3$var$addTimeFields(time, duration) {
1738
+ time.hour += duration.hours || 0;
1739
+ time.minute += duration.minutes || 0;
1740
+ time.second += duration.seconds || 0;
1741
+ time.millisecond += duration.milliseconds || 0;
1742
+ return $735220c2d4774dd3$var$balanceTime(time);
1743
+ }
1744
+ function $735220c2d4774dd3$export$7ed87b6bc2506470(time, duration) {
1745
+ let res = time.copy();
1746
+ $735220c2d4774dd3$var$addTimeFields(res, duration);
1747
+ return res;
1748
+ }
1749
+ function $735220c2d4774dd3$export$fe34d3a381cd7501(time, duration) {
1750
+ return $735220c2d4774dd3$export$7ed87b6bc2506470(time, $735220c2d4774dd3$export$3e2544e88a25bff8(duration));
1751
+ }
1752
+ function $735220c2d4774dd3$export$dd02b3e0007dfe28(value, field, amount, options) {
1753
+ let mutable = value.copy();
1754
+ switch(field){
1755
+ case 'hour':
1756
+ {
1757
+ let hours = value.hour;
1758
+ let min = 0;
1759
+ let max = 23;
1760
+ if ((options === null || options === void 0 ? void 0 : options.hourCycle) === 12) {
1761
+ let isPM = hours >= 12;
1762
+ min = isPM ? 12 : 0;
1763
+ max = isPM ? 23 : 11;
1764
+ }
1765
+ mutable.hour = $735220c2d4774dd3$var$cycleValue(hours, amount, min, max, options === null || options === void 0 ? void 0 : options.round);
1766
+ break;
1767
+ }
1768
+ case 'minute':
1769
+ mutable.minute = $735220c2d4774dd3$var$cycleValue(value.minute, amount, 0, 59, options === null || options === void 0 ? void 0 : options.round);
1770
+ break;
1771
+ case 'second':
1772
+ mutable.second = $735220c2d4774dd3$var$cycleValue(value.second, amount, 0, 59, options === null || options === void 0 ? void 0 : options.round);
1773
+ break;
1774
+ case 'millisecond':
1775
+ mutable.millisecond = $735220c2d4774dd3$var$cycleValue(value.millisecond, amount, 0, 999, options === null || options === void 0 ? void 0 : options.round);
1776
+ break;
1777
+ default:
1778
+ throw new Error('Unsupported field ' + field);
1779
+ }
1780
+ return mutable;
1781
+ }
1782
+ function $735220c2d4774dd3$var$cycleValue(value, amount, min, max, round = false) {
1783
+ if (round) {
1784
+ value += Math.sign(amount);
1785
+ if (value < min) value = max;
1786
+ let div = Math.abs(amount);
1787
+ if (amount > 0) value = Math.ceil(value / div) * div;
1788
+ else value = Math.floor(value / div) * div;
1789
+ if (value > max) value = min;
1790
+ } else {
1791
+ value += amount;
1792
+ if (value < min) value = max - (min - value - 1);
1793
+ else if (value > max) value = min + (value - max - 1);
1794
+ }
1795
+ return value;
1796
+ }
1797
+
1798
+ function $fae977aafc393c5c$export$f59dee82248f5ad4(time) {
1799
+ return `${String(time.hour).padStart(2, '0')}:${String(time.minute).padStart(2, '0')}:${String(time.second).padStart(2, '0')}${time.millisecond ? String(time.millisecond / 1000).slice(1) : ''}`;
1800
+ }
1801
+
1802
+ function _check_private_redeclaration(obj, privateCollection) {
1803
+ if (privateCollection.has(obj)) {
1804
+ throw new TypeError("Cannot initialize the same private elements twice on an object");
1805
+ }
1806
+ }
1807
+
1808
+ function _class_private_field_init(obj, privateMap, value) {
1809
+ _check_private_redeclaration(obj, privateMap);
1810
+ privateMap.set(obj, value);
1811
+ }
1812
+
1813
+ var // This prevents TypeScript from allowing other types with the same fields to match.
1814
+ // @ts-ignore
1815
+ $35ea8db9cb2ccb90$var$_type1 = /*#__PURE__*/ new WeakMap();
1816
+ class $35ea8db9cb2ccb90$export$680ea196effce5f {
1817
+ /** Returns a copy of this time. */ copy() {
1818
+ return new $35ea8db9cb2ccb90$export$680ea196effce5f(this.hour, this.minute, this.second, this.millisecond);
1819
+ }
1820
+ /** Returns a new `Time` with the given duration added to it. */ add(duration) {
1821
+ return ($735220c2d4774dd3$export$7ed87b6bc2506470)(this, duration);
1822
+ }
1823
+ /** Returns a new `Time` with the given duration subtracted from it. */ subtract(duration) {
1824
+ return ($735220c2d4774dd3$export$fe34d3a381cd7501)(this, duration);
1825
+ }
1826
+ /** Returns a new `Time` with the given fields set to the provided values. Other fields will be constrained accordingly. */ set(fields) {
1827
+ return ($735220c2d4774dd3$export$e5d5e1c1822b6e56)(this, fields);
1828
+ }
1829
+ /**
1830
+ * Returns a new `Time` with the given field adjusted by a specified amount.
1831
+ * When the resulting value reaches the limits of the field, it wraps around.
1832
+ */ cycle(field, amount, options) {
1833
+ return ($735220c2d4774dd3$export$dd02b3e0007dfe28)(this, field, amount, options);
1834
+ }
1835
+ /** Converts the time to an ISO 8601 formatted string. */ toString() {
1836
+ return ($fae977aafc393c5c$export$f59dee82248f5ad4)(this);
1837
+ }
1838
+ /** Compares this time with another. A negative result indicates that this time is before the given one, and a positive time indicates that it is after. */ compare(b) {
1839
+ return ($14e0f24ef4ac5c92$export$c19a80a9721b80f6)(this, b);
1840
+ }
1841
+ constructor(hour = 0, minute = 0, second = 0, millisecond = 0){
1842
+ (_class_private_field_init)(this, $35ea8db9cb2ccb90$var$_type1, {
1843
+ writable: true,
1844
+ value: void 0
1845
+ });
1846
+ this.hour = hour;
1847
+ this.minute = minute;
1848
+ this.second = second;
1849
+ this.millisecond = millisecond;
1850
+ ($735220c2d4774dd3$export$7555de1e070510cb)(this);
1851
+ }
1852
+ }
1853
+
1854
+ var Switch = function (_a) {
1855
+ var id = _a.id, props = __rest(_a, ["id"]);
1856
+ var generatedId = React.useId();
1857
+ var autoId = id || generatedId;
1858
+ return jsxRuntime.jsx(react.Switch, __assign({}, props, { id: autoId }));
1859
+ };
1860
+
1861
+ /**
1862
+ * TimeInput genérico reutilizable basado en HeroUI siguiendo las reglas de diseño BeweOS.
1863
+ */
1864
+ var TimeInput = function (_a) {
1865
+ var label = _a.label, id = _a.id, _b = _a.size, size = _b === void 0 ? "md" : _b, _c = _a.radius, radius = _c === void 0 ? "md" : _c, _d = _a.variant, variant = _d === void 0 ? "bordered" : _d, props = __rest(_a, ["label", "id", "size", "radius", "variant"]);
1866
+ var generatedId = React.useId();
1867
+ var autoId = id || generatedId;
1868
+ return (jsxRuntime.jsx(react.TimeInput, __assign({}, props, { id: autoId, size: size, radius: radius, variant: variant, label: label, labelPlacement: "outside-left", classNames: {
1869
+ label: "text-default-600 text-tiny group-data-[filled=true]:text-default-600",
1870
+ inputWrapper: "focus-within:!border-primary-500",
1871
+ } })));
1872
+ };
1873
+
1874
+ /**
1875
+ * @component ScheduleRow
1876
+ * @description A React component for managing the schedule of a single day.
1877
+ * It allows users to open or close the schedule, add or remove time slots,
1878
+ * and modify the start and end times of each slot. The component is fully
1879
+ * controlled and reports changes to the parent via the `onChange` callback.
1880
+ *
1881
+ * @param {ScheduleRowProps} props - The props for the component.
1882
+ * @returns {React.ReactElement} The rendered ScheduleRow component.
1883
+ */
1884
+ var ScheduleRow = function (_a) {
1885
+ var day = _a.day, daySchedule = _a.daySchedule, translations = _a.translations, onChange = _a.onChange, onCopyToAll = _a.onCopyToAll;
1886
+ /**
1887
+ * @function validateTimeSlots
1888
+ * @description Validates all time slots to ensure the "from" time is not after the "to" time.
1889
+ * @param {TimeSlot[]} timeSlots - The array of time slots to validate.
1890
+ * @returns {TimeSlot[]} The updated array of time slots with error messages if any.
1891
+ */
1892
+ var validateTimeSlots = function (timeSlots) {
1893
+ return timeSlots.map(function (slot) {
1894
+ if (slot.from && slot.to) {
1895
+ var fromTime = new ($35ea8db9cb2ccb90$export$680ea196effce5f.bind.apply($35ea8db9cb2ccb90$export$680ea196effce5f, __spreadArray([void 0], slot.from.split(":").map(Number), false)))();
1896
+ var toTime = new ($35ea8db9cb2ccb90$export$680ea196effce5f.bind.apply($35ea8db9cb2ccb90$export$680ea196effce5f, __spreadArray([void 0], slot.to.split(":").map(Number), false)))();
1897
+ if (fromTime.compare(toTime) > 0) {
1898
+ return __assign(__assign({}, slot), { error: "From time cannot be after to time" });
1899
+ }
1900
+ }
1901
+ return __assign(__assign({}, slot), { error: null });
1902
+ });
1903
+ };
1904
+ /**
1905
+ * @function toTimeValue
1906
+ * @description Converts a time string (e.g., "09:00") to a `TimeValue` object
1907
+ * required by the `TimeInput` component.
1908
+ * @param {string} time - The time string to convert.
1909
+ * @returns {TimeValue | null} The corresponding `TimeValue` object, or `null` if the input is empty.
1910
+ */
1911
+ var toTimeValue = function (time) {
1912
+ if (!time) {
1913
+ return null;
1914
+ }
1915
+ var _a = time.split(":").map(Number), hour = _a[0], minute = _a[1];
1916
+ return new $35ea8db9cb2ccb90$export$680ea196effce5f(hour, minute);
1917
+ };
1918
+ /**
1919
+ * @function fromTimeValue
1920
+ * @description Converts a `TimeValue` object back to a formatted time string (e.g., "09:00").
1921
+ * @param {TimeValue | null} time - The `TimeValue` object to convert.
1922
+ * @returns {string} The formatted time string.
1923
+ */
1924
+ var fromTimeValue = function (time) {
1925
+ if (!time) {
1926
+ return "";
1927
+ }
1928
+ return "".concat(String(time.hour).padStart(2, "0"), ":").concat(String(time.minute).padStart(2, "0"));
1929
+ };
1930
+ /**
1931
+ * @function handleToggleDay
1932
+ * @description Toggles the `isOpen` status of the schedule for the day.
1933
+ */
1934
+ var handleToggleDay = function () {
1935
+ onChange(__assign(__assign({}, daySchedule), { isOpen: !daySchedule.isOpen }));
1936
+ };
1937
+ /**
1938
+ * @function handleTimeChange
1939
+ * @description Updates the time for a specific time slot.
1940
+ * @param {number} index - The index of the time slot to modify.
1941
+ * @param {"from" | "to"} field - The field to update ("from" or "to").
1942
+ * @param {TimeValue | null} value - The new time value from the `TimeInput` component.
1943
+ */
1944
+ var handleTimeChange = function (index, field, value) {
1945
+ var _a;
1946
+ var newTimeSlots = __spreadArray([], daySchedule.timeSlots, true);
1947
+ newTimeSlots[index] = __assign(__assign({}, newTimeSlots[index]), (_a = {}, _a[field] = fromTimeValue(value), _a));
1948
+ var validatedSlots = validateTimeSlots(newTimeSlots);
1949
+ onChange(__assign(__assign({}, daySchedule), { timeSlots: validatedSlots }));
1950
+ };
1951
+ /**
1952
+ * @function handleAddTimeSlot
1953
+ * @description Adds a new, empty time slot to the schedule.
1954
+ */
1955
+ var handleAddTimeSlot = function () {
1956
+ var newTimeSlots = __spreadArray(__spreadArray([], daySchedule.timeSlots, true), [{ from: "", to: "" }], false);
1957
+ onChange(__assign(__assign({}, daySchedule), { timeSlots: newTimeSlots }));
1958
+ };
1959
+ /**
1960
+ * @function handleRemoveTimeSlot
1961
+ * @description Removes a time slot from the schedule at the specified index.
1962
+ * @param {number} index - The index of the time slot to remove.
1963
+ */
1964
+ var handleRemoveTimeSlot = function (index) {
1965
+ var newTimeSlots = daySchedule.timeSlots.filter(function (_, i) { return i !== index; });
1966
+ onChange(__assign(__assign({}, daySchedule), { timeSlots: newTimeSlots }));
1967
+ };
1968
+ return (jsxRuntime.jsxs("div", { className: "flex flex-col w-full gap-y-4 last:border-b-0 last:mb-0 last:pb-0 border-b border-default-200 xs:py-4 xl:p-4 first:pt-0", children: [jsxRuntime.jsxs("div", { className: "flex w-full items-center justify-between", children: [jsxRuntime.jsxs("div", { className: "flex xs:space-x-2 sm:space-x-4", children: [jsxRuntime.jsx("h3", { className: "text-small font-semibold text-default-900 capitalize", children: day }), jsxRuntime.jsx(react.Chip, { size: "sm", color: daySchedule.isOpen ? "primary" : "default", className: "text-background", children: daySchedule.isOpen ? translations.open : translations.closed })] }), jsxRuntime.jsxs("div", { className: "flex xs:gap-2 sm:gap-5", children: [jsxRuntime.jsx(Switch, { size: "sm", color: "primary", isSelected: daySchedule.isOpen, onValueChange: handleToggleDay }), jsxRuntime.jsx(Button, { size: "sm", variant: "bordered", onPress: function () { return onCopyToAll(day); }, children: translations.copyToAll })] })] }), daySchedule.isOpen && (jsxRuntime.jsxs("div", { className: "flex flex-col justify-around gap-y-3 ", children: [daySchedule.timeSlots.map(function (slot, index) { return (jsxRuntime.jsxs("div", { className: "flex items-center gap-1 w-full justify-between", children: [jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-1", children: [jsxRuntime.jsx(TimeInput, { label: translations.from, className: "w-full", value: toTimeValue(slot.from), onChange: function (value) { return handleTimeChange(index, "from", value); }, isInvalid: !!slot.error }), jsxRuntime.jsx("span", { className: "text-default-900 xs:hidden xl:block", children: "-" }), jsxRuntime.jsx(TimeInput, { label: translations.to, className: "w-full", value: toTimeValue(slot.to), onChange: function (value) { return handleTimeChange(index, "to", value); }, isInvalid: !!slot.error, errorMessage: slot.error })] }), jsxRuntime.jsx(Button, { isIconOnly: true, size: "sm", color: "danger", variant: "light", onPress: function () { return handleRemoveTimeSlot(index); }, isDisabled: daySchedule.timeSlots.length === 1, startContent: jsxRuntime.jsx(IconComponent, { icon: "solar:trash-bin-minimalistic-outline" }) })] }, "".concat(day, "-timeslot-").concat(slot.from, "-").concat(slot.to, "-").concat(index))); }), daySchedule.timeSlots.length < 2 && (jsxRuntime.jsx(Button, { size: "sm", variant: "flat", onPress: function () { return handleAddTimeSlot(); }, startContent: jsxRuntime.jsx(IconComponent, { icon: "solar:add-circle-outline" }), children: translations.addTimeSlot }))] }))] }, day));
1969
+ };
1970
+
1971
+ /**
1972
+ * Select genérico reutilizable basado en HeroUI siguiendo las reglas de diseño BeweOS.
1973
+ *
1974
+ * Reglas aplicadas:
1975
+ * - Variant: Bordered (por defecto)
1976
+ * - Radius: md (por defecto)
1977
+ * - labelPlacement: Outside
1978
+ * - Size: sm, md, lg (configurable)
1979
+ */
1980
+ var Select = function (_a) {
1981
+ var label = _a.label, id = _a.id, _b = _a.size, size = _b === void 0 ? "md" : _b, _c = _a.variant, variant = _c === void 0 ? "bordered" : _c, _d = _a.radius, radius = _d === void 0 ? "md" : _d, placeholder = _a.placeholder, props = __rest(_a, ["label", "id", "size", "variant", "radius", "placeholder"]);
1982
+ var generatedId = React.useId();
1983
+ var selectId = id || generatedId;
1984
+ return (jsxRuntime.jsx("div", { className: "group", children: jsxRuntime.jsx(react.Select, __assign({}, props, { id: selectId, label: label, labelPlacement: "outside", placeholder: placeholder, variant: variant, size: size, radius: radius, classNames: {
1985
+ label: "text-default-600 text-tiny group-data-[filled=true]:text-default-600",
1986
+ trigger: "data-[open=true]:!border-primary-500 data-[focus=true]:!border-primary-500 data-[disabled=true]:bg-default-100",
1987
+ popoverContent: "[&_[data-focus-visible=true]]:!outline-none [&_[data-selectable=true]:focus]:!bg-primary-50 [&_li]:!text-default-500 [&_li[data-hover=true]]:!text-default-600",
1988
+ } })) }));
1989
+ };
1990
+
1991
+ function AuraTable(_a) {
1992
+ var columns = _a.columns, items = _a.items, renderCell = _a.renderCell, children = _a.children, props = __rest(_a, ["columns", "items", "renderCell", "children"]);
1993
+ return (jsxRuntime.jsxs(react.Table, __assign({ removeWrapper: true, radius: "none" }, props, { children: [jsxRuntime.jsx(react.TableHeader, { columns: columns, children: function (column) { return jsxRuntime.jsx(react.TableColumn, { children: column.label }, column.key); } }), jsxRuntime.jsx(react.TableBody, { items: items, children: function (item) { return (jsxRuntime.jsx(react.TableRow, { children: function (columnKey) { return (jsxRuntime.jsx(react.TableCell, { children: renderCell ? renderCell(item, columnKey) : children })); } }, item.id)); } })] })));
1994
+ }
1995
+
1996
+ /**
1997
+ * Textarea component that wraps the HeroUI TextArea component.
1998
+ */
1999
+ var Textarea = function (_a) {
2000
+ var id = _a.id, label = _a.label, placeholder = _a.placeholder, description = _a.description, errorMessage = _a.errorMessage, _b = _a.variant, variant = _b === void 0 ? "bordered" : _b, _c = _a.radius, radius = _c === void 0 ? "md" : _c, _d = _a.size, size = _d === void 0 ? "md" : _d; _a.labelPlacement; var props = __rest(_a, ["id", "label", "placeholder", "description", "errorMessage", "variant", "radius", "size", "labelPlacement"]);
2001
+ var generatedId = React.useId();
2002
+ var autoId = id || generatedId;
2003
+ return (jsxRuntime.jsx(react.Textarea, __assign({}, props, { id: autoId, label: label, variant: variant, radius: radius, size: size, labelPlacement: "outside", placeholder: placeholder, description: description, errorMessage: errorMessage, classNames: {
2004
+ label: "text-default-600 text-tiny group-data-[filled=true]:text-default-600",
2005
+ inputWrapper: "data-[focus=true]:!border-primary-500 data-[focus=true]:!border-primary-500",
2006
+ } })));
2007
+ };
2008
+
2009
+ // Traducciones por defecto en español según las reglas de diseño
2010
+ var defaultTranslations$1 = {
2011
+ lightTheme: "Claro",
2012
+ darkTheme: "Oscuro",
2013
+ };
2014
+ /**
2015
+ * Selector de tema visual con preview interactivo siguiendo las reglas de diseño BeweOS.
2016
+ *
2017
+ * Reglas aplicadas:
2018
+ * - Soporte completo de traducciones mediante props
2019
+ * - Sin dependencias de sistemas i18n específicos
2020
+ * - Dark mode compatible
2021
+ * - Uso exclusivo de Tailwind CSS
2022
+ */
2023
+ var ThemePicker = function (_a) {
2024
+ var value = _a.value, onChange = _a.onChange, className = _a.className, _b = _a.translations, translations = _b === void 0 ? {} : _b;
2025
+ // Combinar traducciones por defecto con las proporcionadas
2026
+ var t = __assign(__assign({}, defaultTranslations$1), translations);
2027
+ var themes = [
2028
+ {
2029
+ key: "light",
2030
+ label: t.lightTheme,
2031
+ cardClass: "bg-white border border-[#E4E4E7] text-zinc-900",
2032
+ previewClass: "bg-[#F4F4F5] border border-[#E4E4E7]",
2033
+ labelClass: "font-medium text-[14px] leading-[20px] text-zinc-900",
2034
+ radioColor: "primary",
2035
+ previewContent: (jsxRuntime.jsxs("div", { className: "rounded-lg border border-[#E4E4E7] p-3 mt-4 flex flex-col gap-2", children: [jsxRuntime.jsx("div", { className: "h-3 w-1/2 bg-[#E4E4E7] rounded mb-2" }), jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsx("div", { className: "h-3 w-3 rounded-full bg-[#E4E4E7]" }), jsxRuntime.jsx("div", { className: "h-3 w-1/3 rounded bg-[#E4E4E7]" })] }), jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsx("div", { className: "h-3 w-3 rounded-full bg-[#E4E4E7]" }), jsxRuntime.jsx("div", { className: "h-3 w-1/4 rounded bg-[#E4E4E7]" })] })] }), jsxRuntime.jsx("div", { className: "h-8 w-2/3 bg-[#F4F4F5] rounded-lg mt-2" })] })),
1895
2036
  },
1896
- },
1897
- "green-dark": {
1898
- extend: "dark",
1899
- colors: {
1900
- primary: {
1901
- 50: "#EFFFEF",
1902
- 100: "#CFFCD1",
1903
- 200: "#A0F9AC",
1904
- 300: "#6FEE8D",
1905
- 400: "#49DE7B",
1906
- 500: "#16C964",
1907
- 600: "#10AC64",
1908
- 700: "#0B905F",
1909
- 800: "#077457",
1910
- 900: "#046051",
1911
- foreground: "#000",
1912
- DEFAULT: "#16C964",
1913
- },
1914
- secondary: {
1915
- "50": "#e3eaff",
1916
- "100": "#D7DFFE",
1917
- "200": "#AFBFFE",
1918
- "300": "#889DFD",
1919
- "400": "#6A82FB",
1920
- "500": "#3956F9",
1921
- "600": "#2941D6",
1922
- "700": "#1C2EB3",
1923
- "800": "#121F90",
1924
- "900": "#0A1477",
1925
- foreground: "#fff",
1926
- DEFAULT: "#3956F9",
1927
- },
1928
- success: {
1929
- "50": "#e7fde3",
1930
- "100": "#E8FCD3",
1931
- "200": "#CBFAA8",
1932
- "300": "#A4F17B",
1933
- "400": "#7EE358",
1934
- "500": "#49D127",
1935
- "600": "#2FB31C",
1936
- "700": "#1A9613",
1937
- "800": "#0C790E",
1938
- "900": "#076410",
1939
- foreground: "#000",
1940
- DEFAULT: "#49D127",
1941
- },
1942
- warning: {
1943
- "50": "#fff9da",
1944
- "100": "#FFF7CC",
1945
- "200": "#FFEE99",
1946
- "300": "#FFE266",
1947
- "400": "#FFD63F",
1948
- "500": "#FFC300",
1949
- "600": "#DBA200",
1950
- "700": "#B78300",
1951
- "800": "#936600",
1952
- "900": "#7A5100",
1953
- foreground: "#000",
1954
- DEFAULT: "#FFC300",
1955
- },
1956
- danger: {
1957
- "50": "#ffe2e5",
1958
- "100": "#FFE3D8",
1959
- "200": "#FFC1B2",
1960
- "300": "#FF988B",
1961
- "400": "#FF726F",
1962
- "500": "#FF3F4C",
1963
- "600": "#DB2E49",
1964
- "700": "#B71F45",
1965
- "800": "#93143F",
1966
- "900": "#7A0C3B",
1967
- foreground: "#fff",
1968
- DEFAULT: "#FF3F4C",
1969
- },
1970
- focus: "#66cc8a",
1971
- overlay: "#ffffff",
2037
+ {
2038
+ key: "dark",
2039
+ label: t.darkTheme,
2040
+ cardClass: "bg-black border border-[#3F3F46] text-white",
2041
+ previewClass: "bg-[#27272A] border border-[#3F3F46]",
2042
+ labelClass: "font-medium text-[14px] leading-[20px] text-white",
2043
+ radioColor: "primary",
2044
+ previewContent: (jsxRuntime.jsxs("div", { className: "rounded-lg border border-[#3F3F46] p-3 mt-4 flex flex-col gap-2", children: [jsxRuntime.jsx("div", { className: "h-3 w-1/2 bg-[#3F3F46] rounded mb-2" }), jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsx("div", { className: "h-3 w-3 rounded-full bg-[#3F3F46]" }), jsxRuntime.jsx("div", { className: "h-3 w-1/3 rounded bg-[#3F3F46]" })] }), jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsx("div", { className: "h-3 w-3 rounded-full bg-[#3F3F46]" }), jsxRuntime.jsx("div", { className: "h-3 w-1/4 rounded bg-[#3F3F46]" })] })] }), jsxRuntime.jsx("div", { className: "h-8 w-2/3 bg-[#27272A] rounded-lg mt-2" })] })),
1972
2045
  },
1973
- },
2046
+ ];
2047
+ return (jsxRuntime.jsx(react.RadioGroup, { value: value, onChange: function (e) { return onChange(e.target.value); }, className: "flex justify-center ".concat(className || ""), orientation: "horizontal", classNames: {
2048
+ wrapper: "gap-3",
2049
+ }, children: themes.map(function (theme) { return (jsxRuntime.jsxs("div", { className: "relative rounded-2xl ".concat(theme.cardClass, " p-4 flex-1 transition-all duration-200 flex flex-col justify-start"), children: [jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [jsxRuntime.jsx("span", { className: theme.labelClass, children: theme.label }), jsxRuntime.jsx(react.Radio, { "aria-label": theme.label, color: theme.radioColor, size: "sm", value: theme.key })] }), theme.previewContent] }, theme.key)); }) }));
2050
+ };
2051
+
2052
+ var ToastContext = React.createContext(undefined);
2053
+ var useAuraToast = function () {
2054
+ var context = React.useContext(ToastContext);
2055
+ if (!context) {
2056
+ throw new Error("useAuraToast must be used within a AuraToastProvider");
2057
+ }
2058
+ return context;
2059
+ };
2060
+
2061
+ function GlobalToast() {
2062
+ var _a = useAuraToast(), toast = _a.toast, hideToast = _a.hideToast;
2063
+ if (!toast.isVisible) {
2064
+ return null;
2065
+ }
2066
+ return (jsxRuntime.jsx("div", { className: "fixed top-4 right-4 z-50 w-full max-w-sm", children: jsxRuntime.jsx(react.Alert, { hideIconWrapper: true, color: toast.color, variant: "flat", title: toast.title, description: toast.description, isClosable: true, onClose: hideToast }) }));
2067
+ }
2068
+
2069
+ // Traducciones por defecto en español
2070
+ var defaultTranslations = {
2071
+ uploadText: "Da clic y selecciona tus archivos",
2072
+ subText: "",
2073
+ dragText: "Suelta el archivo aquí",
2074
+ multipleFilesError: "Solo puedes subir un archivo",
2075
+ maxFilesError: "Puedes subir máximo {maxFiles} archivos",
2076
+ invalidFileTypeError: "Solo se aceptan archivos de tipo: {acceptedTypes}",
2077
+ maxFileSizeError: "El archivo excede el tamaño máximo permitido de {maxSize}",
2078
+ removeFileAriaLabel: "Remover archivo",
2079
+ uploadAreaAriaLabel: "Área de carga de archivos",
2080
+ cropModalTitle: "Recortar imagen",
2081
+ cropSaveButton: "Guardar",
2082
+ cropCancelButton: "Cancelar",
2083
+ cropZoomLabel: "Zoom",
2084
+ cropInstructions: "Arrastra para mover la imagen y usa el zoom para ajustar el tamaño",
2085
+ cropBackgroundLabel: "Color de fondo",
2086
+ cropBackgroundWhite: "Blanco",
2087
+ cropBackgroundBlack: "Negro",
2088
+ cropBackgroundTransparent: "Transparente",
2089
+ };
2090
+ /**
2091
+ * Formatea el tipo de archivo para mostrar
2092
+ */
2093
+ var formatFileType = function (type) {
2094
+ var _a;
2095
+ if (type.startsWith(".")) {
2096
+ return type.toUpperCase();
2097
+ }
2098
+ if (type.includes("/")) {
2099
+ var parts = type.split("/");
2100
+ return ((_a = parts[1]) === null || _a === void 0 ? void 0 : _a.toUpperCase()) || type;
2101
+ }
2102
+ return type.toUpperCase();
2103
+ };
2104
+ /**
2105
+ * Formatea el tamaño del archivo de forma legible
2106
+ */
2107
+ var formatFileSize = function (bytes) {
2108
+ if (bytes === 0) {
2109
+ return "0 Bytes";
2110
+ }
2111
+ var k = 1024;
2112
+ var sizes = ["Bytes", "KB", "MB", "GB"];
2113
+ var i = Math.floor(Math.log(bytes) / Math.log(k));
2114
+ return "".concat(Math.round(bytes / Math.pow(k, i)), " ").concat(sizes[i]);
2115
+ };
2116
+ /**
2117
+ * Componente de recorte de imagen usando Canvas API
2118
+ */
2119
+ var ImageCropModal = function (_a) {
2120
+ var isOpen = _a.isOpen, imageUrl = _a.imageUrl, targetWidth = _a.targetWidth, targetHeight = _a.targetHeight, onSave = _a.onSave, onCancel = _a.onCancel, translations = _a.translations;
2121
+ var canvasRef = React.useRef(null);
2122
+ var _b = React.useState(null), imageElement = _b[0], setImageElement = _b[1];
2123
+ var _c = React.useState(0), zoomValue = _c[0], setZoomValue = _c[1]; // Valor del slider de -1 a 1
2124
+ var _d = React.useState({ x: 0, y: 0 }), position = _d[0], setPosition = _d[1];
2125
+ var _e = React.useState(false), isDragging = _e[0], setIsDragging = _e[1];
2126
+ var _f = React.useState({ x: 0, y: 0 }), dragStart = _f[0], setDragStart = _f[1];
2127
+ var _g = React.useState(1), baseScale = _g[0], setBaseScale = _g[1]; // Escala base inicial
2128
+ var _h = React.useState({ width: 400, height: 300 }), canvasSize = _h[0], setCanvasSize = _h[1];
2129
+ var _j = React.useState("white"), backgroundColor = _j[0], setBackgroundColor = _j[1];
2130
+ // Función para convertir el valor del zoom slider a escala real
2131
+ var getScaleFromZoom = function (zoomValue) {
2132
+ if (zoomValue === 0) {
2133
+ return baseScale;
2134
+ }
2135
+ if (zoomValue > 0) {
2136
+ // Zoom in: de baseScale a baseScale * 3
2137
+ return baseScale + baseScale * 2 * zoomValue;
2138
+ }
2139
+ // Zoom out: de baseScale * 0.3 a baseScale
2140
+ return baseScale + baseScale * 0.7 * zoomValue;
2141
+ };
2142
+ var currentScale = getScaleFromZoom(zoomValue);
2143
+ // Cargar imagen cuando se abre el modal
2144
+ React.useEffect(function () {
2145
+ if (isOpen && imageUrl) {
2146
+ var img_1 = new Image();
2147
+ img_1.onload = function () {
2148
+ setImageElement(img_1);
2149
+ // Calcular escala inicial para que la imagen quepa en el área de crop
2150
+ var scaleX = targetWidth / img_1.width;
2151
+ var scaleY = targetHeight / img_1.height;
2152
+ var initialScale = Math.max(scaleX, scaleY);
2153
+ setBaseScale(initialScale);
2154
+ setZoomValue(0); // Empezar en el centro
2155
+ setPosition({ x: 0, y: 0 });
2156
+ setBackgroundColor("white"); // Reset color de fondo
2157
+ };
2158
+ img_1.src = imageUrl;
2159
+ }
2160
+ }, [isOpen, imageUrl, targetWidth, targetHeight]);
2161
+ // Dibujar en el canvas
2162
+ React.useEffect(function () {
2163
+ if (!(imageElement && canvasRef.current)) {
2164
+ return;
2165
+ }
2166
+ var canvas = canvasRef.current;
2167
+ var ctx = canvas.getContext("2d");
2168
+ if (!ctx) {
2169
+ return;
2170
+ }
2171
+ // Limpiar canvas
2172
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
2173
+ // Dibujar fondo gris del canvas
2174
+ ctx.fillStyle = "#f3f4f6";
2175
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
2176
+ // Calcular posición y tamaño de la imagen
2177
+ var imgWidth = imageElement.width * currentScale;
2178
+ var imgHeight = imageElement.height * currentScale;
2179
+ var imgX = (canvas.width - imgWidth) / 2 + position.x;
2180
+ var imgY = (canvas.height - imgHeight) / 2 + position.y;
2181
+ // Dibujar imagen
2182
+ ctx.drawImage(imageElement, imgX, imgY, imgWidth, imgHeight);
2183
+ // Dibujar overlay para mostrar área de recorte
2184
+ ctx.fillStyle = "rgba(0, 0, 0, 0.5)";
2185
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
2186
+ // Limpiar área de recorte (centro)
2187
+ var cropX = (canvas.width - targetWidth) / 2;
2188
+ var cropY = (canvas.height - targetHeight) / 2;
2189
+ ctx.clearRect(cropX, cropY, targetWidth, targetHeight);
2190
+ // Dibujar color de fondo del área de recorte
2191
+ if (backgroundColor !== "transparent") {
2192
+ ctx.fillStyle = backgroundColor === "white" ? "#ffffff" : "#000000";
2193
+ ctx.fillRect(cropX, cropY, targetWidth, targetHeight);
2194
+ }
2195
+ // Redibujar imagen solo en el área de recorte
2196
+ ctx.save();
2197
+ ctx.beginPath();
2198
+ ctx.rect(cropX, cropY, targetWidth, targetHeight);
2199
+ ctx.clip();
2200
+ ctx.drawImage(imageElement, imgX, imgY, imgWidth, imgHeight);
2201
+ ctx.restore();
2202
+ // Dibujar borde del área de recorte
2203
+ ctx.strokeStyle = "#3b82f6";
2204
+ ctx.lineWidth = 2;
2205
+ ctx.strokeRect(cropX, cropY, targetWidth, targetHeight);
2206
+ }, [
2207
+ imageElement,
2208
+ currentScale,
2209
+ position,
2210
+ targetWidth,
2211
+ targetHeight,
2212
+ backgroundColor,
2213
+ ]);
2214
+ var handleMouseDown = function (e) {
2215
+ var _a;
2216
+ e.preventDefault();
2217
+ setIsDragging(true);
2218
+ var rect = (_a = canvasRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
2219
+ if (rect) {
2220
+ setDragStart({
2221
+ x: e.clientX - rect.left - position.x,
2222
+ y: e.clientY - rect.top - position.y,
2223
+ });
2224
+ }
2225
+ };
2226
+ var handleMouseMove = function (e) {
2227
+ var _a;
2228
+ if (!isDragging) {
2229
+ return;
2230
+ }
2231
+ e.preventDefault();
2232
+ var rect = (_a = canvasRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
2233
+ if (rect) {
2234
+ setPosition({
2235
+ x: e.clientX - rect.left - dragStart.x,
2236
+ y: e.clientY - rect.top - dragStart.y,
2237
+ });
2238
+ }
2239
+ };
2240
+ var handleMouseUp = function () {
2241
+ setIsDragging(false);
2242
+ };
2243
+ // Eventos táctiles para dispositivos móviles
2244
+ var handleTouchStart = function (e) {
2245
+ var _a;
2246
+ e.preventDefault();
2247
+ if (e.touches.length === 1) {
2248
+ setIsDragging(true);
2249
+ var rect = (_a = canvasRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
2250
+ if (rect) {
2251
+ var touch = e.touches[0];
2252
+ setDragStart({
2253
+ x: touch.clientX - rect.left - position.x,
2254
+ y: touch.clientY - rect.top - position.y,
2255
+ });
2256
+ }
2257
+ }
2258
+ };
2259
+ var handleTouchMove = function (e) {
2260
+ var _a;
2261
+ if (!isDragging || e.touches.length !== 1) {
2262
+ return;
2263
+ }
2264
+ e.preventDefault();
2265
+ var rect = (_a = canvasRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
2266
+ if (rect) {
2267
+ var touch = e.touches[0];
2268
+ setPosition({
2269
+ x: touch.clientX - rect.left - dragStart.x,
2270
+ y: touch.clientY - rect.top - dragStart.y,
2271
+ });
2272
+ }
2273
+ };
2274
+ var handleTouchEnd = function () {
2275
+ setIsDragging(false);
2276
+ };
2277
+ var handleSave = function () {
2278
+ if (!(imageElement && canvasRef.current)) {
2279
+ return;
2280
+ }
2281
+ // Crear canvas temporal para el recorte
2282
+ var tempCanvas = document.createElement("canvas");
2283
+ tempCanvas.width = targetWidth;
2284
+ tempCanvas.height = targetHeight;
2285
+ var tempCtx = tempCanvas.getContext("2d");
2286
+ if (!tempCtx) {
2287
+ return;
2288
+ }
2289
+ // Dibujar color de fondo si no es transparente
2290
+ if (backgroundColor !== "transparent") {
2291
+ tempCtx.fillStyle = backgroundColor === "white" ? "#ffffff" : "#000000";
2292
+ tempCtx.fillRect(0, 0, targetWidth, targetHeight);
2293
+ }
2294
+ // Calcular parámetros de recorte
2295
+ var canvas = canvasRef.current;
2296
+ var imgWidth = imageElement.width * currentScale;
2297
+ var imgHeight = imageElement.height * currentScale;
2298
+ var imgX = (canvas.width - imgWidth) / 2 + position.x;
2299
+ var imgY = (canvas.height - imgHeight) / 2 + position.y;
2300
+ var cropX = (canvas.width - targetWidth) / 2;
2301
+ var cropY = (canvas.height - targetHeight) / 2;
2302
+ // Calcular área fuente en la imagen original
2303
+ var sourceX = (cropX - imgX) / currentScale;
2304
+ var sourceY = (cropY - imgY) / currentScale;
2305
+ var sourceWidth = targetWidth / currentScale;
2306
+ var sourceHeight = targetHeight / currentScale;
2307
+ // Dibujar recorte sobre el fondo
2308
+ tempCtx.drawImage(imageElement, sourceX, sourceY, sourceWidth, sourceHeight, 0, 0, targetWidth, targetHeight);
2309
+ // Convertir a blob y crear archivo
2310
+ var fileType = backgroundColor === "transparent" ? "image/png" : "image/png";
2311
+ tempCanvas.toBlob(function (blob) {
2312
+ if (blob) {
2313
+ var timestamp = new Date().getTime();
2314
+ var file = new File([blob], "cropped-image-".concat(timestamp, ".png"), {
2315
+ type: fileType,
2316
+ });
2317
+ onSave(file, imageElement.src);
2318
+ }
2319
+ }, fileType);
2320
+ };
2321
+ // Calcular dimensiones responsive del canvas
2322
+ var updateCanvasSize = React.useCallback(function () {
2323
+ var minCanvasWidth = Math.min(350, window.innerWidth - 40);
2324
+ var minCanvasHeight = Math.min(250, window.innerHeight - 300);
2325
+ var newCanvasWidth = Math.max(minCanvasWidth, targetWidth + 60);
2326
+ var newCanvasHeight = Math.max(minCanvasHeight, targetHeight + 60);
2327
+ setCanvasSize({ width: newCanvasWidth, height: newCanvasHeight });
2328
+ }, [targetWidth, targetHeight]);
2329
+ // Actualizar tamaño del canvas al cambiar el tamaño de la ventana
2330
+ React.useEffect(function () {
2331
+ if (!isOpen) {
2332
+ return;
2333
+ }
2334
+ updateCanvasSize();
2335
+ var handleResize = function () {
2336
+ updateCanvasSize();
2337
+ };
2338
+ window.addEventListener("resize", handleResize);
2339
+ return function () {
2340
+ window.removeEventListener("resize", handleResize);
2341
+ };
2342
+ }, [isOpen, updateCanvasSize]);
2343
+ return (jsxRuntime.jsx(react.Modal, { isOpen: isOpen, onClose: onCancel, size: "5xl", className: "sm:max-w-4xl", scrollBehavior: "inside", backdrop: "blur", classNames: {
2344
+ backdrop: "bg-black/80",
2345
+ wrapper: "p-0 sm:p-4",
2346
+ base: "m-0 sm:m-4 max-h-screen sm:max-h-[90vh] w-full sm:w-auto",
2347
+ }, children: jsxRuntime.jsxs(react.ModalContent, { className: "m-0 sm:m-0 h-screen sm:h-auto sm:max-h-[90vh] sm:rounded-lg", children: [jsxRuntime.jsxs(react.ModalHeader, { className: "flex flex-col gap-1 px-4 sm:px-6", children: [translations.cropModalTitle, jsxRuntime.jsx("p", { className: "text-xs sm:text-sm text-gray-500 font-normal", children: translations.cropInstructions })] }), jsxRuntime.jsx(react.ModalBody, { className: "px-4 sm:px-6 py-4", children: jsxRuntime.jsxs("div", { className: "flex flex-col gap-4", children: [jsxRuntime.jsx("div", { className: "flex justify-center overflow-hidden", children: jsxRuntime.jsx("canvas", { ref: canvasRef, width: canvasSize.width, height: canvasSize.height, className: "border border-gray-300 cursor-move select-none max-w-full max-h-[50vh] sm:max-h-[60vh]", onMouseDown: handleMouseDown, onMouseMove: handleMouseMove, onMouseUp: handleMouseUp, onMouseLeave: handleMouseUp, onTouchStart: handleTouchStart, onTouchMove: handleTouchMove, onTouchEnd: handleTouchEnd, style: { touchAction: "none" } }) }), jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [jsxRuntime.jsx("label", { htmlFor: "zoom-slider", className: "text-sm font-medium", children: translations.cropZoomLabel }), jsxRuntime.jsxs("div", { className: "flex items-center gap-2 sm:gap-3 w-full", children: [jsxRuntime.jsx("span", { className: "text-xs text-gray-500 min-w-[15px] sm:min-w-[20px]", children: "-" }), jsxRuntime.jsx(react.Slider, { id: "zoom-slider", size: "sm", step: 0.1, minValue: -1, maxValue: 1, value: zoomValue, onChange: function (value) { return setZoomValue(value); }, className: "flex-1", marks: [
2348
+ { value: -1, label: "Out" },
2349
+ { value: 0, label: "0" },
2350
+ { value: 1, label: "In" },
2351
+ ] }), jsxRuntime.jsx("span", { className: "text-xs text-gray-500 min-w-[15px] sm:min-w-[20px]", children: "+" })] })] }), jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [jsxRuntime.jsx("div", { className: "text-sm font-medium", children: translations.cropBackgroundLabel }), jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-3 sm:gap-4", children: [jsxRuntime.jsxs("label", { className: "flex items-center gap-2 cursor-pointer", children: [jsxRuntime.jsx("input", { type: "radio", name: "background-color", value: "white", checked: backgroundColor === "white", onChange: function (e) {
2352
+ return setBackgroundColor(e.target.value);
2353
+ }, className: "text-blue-600 focus:ring-blue-500" }), jsxRuntime.jsx("div", { className: "w-4 h-4 bg-white border border-gray-300 rounded" }), jsxRuntime.jsx("span", { className: "text-sm", children: translations.cropBackgroundWhite })] }), jsxRuntime.jsxs("label", { className: "flex items-center gap-2 cursor-pointer", children: [jsxRuntime.jsx("input", { type: "radio", name: "background-color", value: "black", checked: backgroundColor === "black", onChange: function (e) {
2354
+ return setBackgroundColor(e.target.value);
2355
+ }, className: "text-blue-600 focus:ring-blue-500" }), jsxRuntime.jsx("div", { className: "w-4 h-4 bg-black border border-gray-300 rounded" }), jsxRuntime.jsx("span", { className: "text-sm", children: translations.cropBackgroundBlack })] }), jsxRuntime.jsxs("label", { className: "flex items-center gap-2 cursor-pointer", children: [jsxRuntime.jsx("input", { type: "radio", name: "background-color", value: "transparent", checked: backgroundColor === "transparent", onChange: function (e) {
2356
+ return setBackgroundColor(e.target.value);
2357
+ }, className: "text-blue-600 focus:ring-blue-500" }), jsxRuntime.jsx("div", { className: "w-4 h-4 bg-gray-200 border border-gray-300 rounded", style: {
2358
+ backgroundImage: "linear-gradient(45deg, #ccc 25%, transparent 25%), linear-gradient(-45deg, #ccc 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ccc 75%), linear-gradient(-45deg, transparent 75%, #ccc 75%)",
2359
+ backgroundSize: "8px 8px",
2360
+ backgroundPosition: "0 0, 0 4px, 4px -4px, -4px 0px",
2361
+ } }), jsxRuntime.jsx("span", { className: "text-sm", children: translations.cropBackgroundTransparent })] })] })] })] }) }), jsxRuntime.jsxs(react.ModalFooter, { className: "flex flex-col-reverse sm:flex-row gap-2 px-4 sm:px-6", children: [jsxRuntime.jsx(react.Button, { color: "danger", variant: "light", onPress: onCancel, className: "w-full sm:w-auto", children: translations.cropCancelButton }), jsxRuntime.jsx(react.Button, { color: "primary", onPress: handleSave, className: "w-full sm:w-auto", children: translations.cropSaveButton })] })] }) }));
1974
2362
  };
1975
-
1976
- var ColorSelector = function (_a) {
1977
- var selectedColor = _a.selectedColor, onColorChange = _a.onColorChange;
1978
- var mode = useThemeContext().mode;
1979
- /**
1980
- * Filters and maps the available theme colors to the current theme mode (light/dark).
1981
- * Each color option contains:
1982
- * - value: the theme name (e.g., "blue-light")
1983
- * - label: the base color name (e.g., "blue")
1984
- * - color: the primary color hex value
1985
- */
1986
- var colorOptions = Object.entries(themeColors)
1987
- .filter(function (_a) {
1988
- var themeData = _a[1];
1989
- var themeMode = themeData.extend;
1990
- return mode === "light" ? themeMode === "light" : themeMode === "dark";
1991
- })
1992
- .map(function (_a) {
1993
- var themeName = _a[0], theme = _a[1];
1994
- return ({
1995
- value: themeName,
1996
- label: themeName.split("-")[0],
1997
- color: theme.colors.primary.DEFAULT,
2363
+ /**
2364
+ * Componente de previsualización de archivo
2365
+ */
2366
+ var FilePreview = function (_a) {
2367
+ var file = _a.file, onRemove = _a.onRemove, removeAriaLabel = _a.removeAriaLabel;
2368
+ var _b = React.useState(""), previewUrl = _b[0], setPreviewUrl = _b[1];
2369
+ React.useEffect(function () {
2370
+ if (file === null || file === void 0 ? void 0 : file.type.startsWith("image/")) {
2371
+ var url_1 = URL.createObjectURL(file);
2372
+ setPreviewUrl(url_1);
2373
+ return function () { return URL.revokeObjectURL(url_1); };
2374
+ }
2375
+ }, [file]);
2376
+ if (!(file === null || file === void 0 ? void 0 : file.type.startsWith("image/"))) {
2377
+ return null;
2378
+ }
2379
+ return (jsxRuntime.jsxs("div", { className: "absolute inset-0 overflow-hidden z-10", children: [jsxRuntime.jsx("img", { src: previewUrl, alt: file.name, className: "w-full h-full object-cover" }), jsxRuntime.jsx(react.Button, { isIconOnly: true, size: "sm", color: "danger", variant: "solid", className: "absolute top-2 right-2 sm:top-3 sm:right-3 z-20 bg-red-100 hover:bg-red-200 text-red-600 min-w-8 h-8 sm:min-w-10 sm:h-10", onPress: onRemove, "aria-label": removeAriaLabel, children: jsxRuntime.jsx(IconComponent, { icon: "heroicons:trash", size: "sm" }) })] }));
2380
+ };
2381
+ /**
2382
+ * Componente UploadDocument basado en Hero UI con funcionalidad mejorada
2383
+ *
2384
+ * @example
2385
+ * ```tsx
2386
+ * <UploadDocument
2387
+ * onUpload={(files) => console.log(files)}
2388
+ * acceptedFiles="image/*,.pdf"
2389
+ * multiple={false}
2390
+ * translations={{
2391
+ * uploadText: "Upload your files",
2392
+ * dragText: "Drop files here"
2393
+ * }}
2394
+ * />
2395
+ * ```
2396
+ */
2397
+ var UploadFile = function (_a) {
2398
+ var text = _a.text, textColor = _a.textColor, subText = _a.subText,
2399
+ // borderColor, // TODO: Implementar colores personalizados
2400
+ iconColor = _a.iconColor,
2401
+ // backgroundColor, // TODO: Implementar colores personalizados
2402
+ _b = _a.width,
2403
+ // backgroundColor, // TODO: Implementar colores personalizados
2404
+ width = _b === void 0 ? "100%" : _b, _c = _a.height, height = _c === void 0 ? "auto" : _c, _d = _a.multiple, multiple = _d === void 0 ? false : _d, _e = _a.maxFiles, maxFiles = _e === void 0 ? 1 : _e, maxFileSize = _a.maxFileSize, _f = _a.acceptedFiles, acceptedFiles = _f === void 0 ? ".pdf" : _f, _g = _a.icon, icon = _g === void 0 ? "heroicons:arrow-up-on-square" : _g, onUpload = _a.onUpload, onError = _a.onError, _h = _a.error, error = _h === void 0 ? false : _h, _j = _a.success, success = _j === void 0 ? false : _j, _k = _a.disabled, disabled = _k === void 0 ? false : _k, errorText = _a.errorText, cropConfig = _a.cropConfig, image = _a.image, _l = _a.className, className = _l === void 0 ? "" : _l, _m = _a.translations, translations = _m === void 0 ? {} : _m;
2405
+ var inputRef = React.useRef(null);
2406
+ var uploadImageRef = React.useRef(image || null);
2407
+ var _o = React.useState(false), isDragging = _o[0], setIsDragging = _o[1];
2408
+ // Estados para el modal de crop
2409
+ var _p = React.useState(false), showCropModal = _p[0], setShowCropModal = _p[1];
2410
+ var _q = React.useState(""), selectedImageUrl = _q[0], setSelectedImageUrl = _q[1];
2411
+ var _r = React.useState(null); _r[0]; var setOriginalFile = _r[1];
2412
+ // Combinar traducciones por defecto con las proporcionadas
2413
+ var t = React.useMemo(function () { return (__assign(__assign({}, defaultTranslations), translations)); }, [translations]);
2414
+ // Actualizar texto si se pasa como prop (retrocompatibilidad)
2415
+ var finalText = text || t.uploadText;
2416
+ var finalSubText = subText || t.subText;
2417
+ var handleClick = function () {
2418
+ var _a;
2419
+ if (!(disabled || uploadImageRef.current)) {
2420
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.click();
2421
+ }
2422
+ };
2423
+ var validateFiles = React.useCallback(function (files) {
2424
+ var filesArray = Array.from(files);
2425
+ if (!multiple && filesArray.length > 1) {
2426
+ onError === null || onError === void 0 ? void 0 : onError(t.multipleFilesError);
2427
+ return [];
2428
+ }
2429
+ if (filesArray.length > maxFiles) {
2430
+ onError === null || onError === void 0 ? void 0 : onError(t.maxFilesError.replace("{maxFiles}", maxFiles.toString()));
2431
+ return [];
2432
+ }
2433
+ // Validar tamaño de archivo
2434
+ if (maxFileSize) {
2435
+ var oversizedFiles = filesArray.filter(function (file) { return file.size > maxFileSize; });
2436
+ if (oversizedFiles.length > 0) {
2437
+ var maxSizeFormatted = formatFileSize(maxFileSize);
2438
+ onError === null || onError === void 0 ? void 0 : onError(t.maxFileSizeError.replace("{maxSize}", maxSizeFormatted));
2439
+ return [];
2440
+ }
2441
+ }
2442
+ // Validar tipos de archivo
2443
+ var acceptedExtensions = Array.isArray(acceptedFiles)
2444
+ ? acceptedFiles.map(function (ext) { return ext.trim().toLowerCase(); })
2445
+ : acceptedFiles.split(",").map(function (ext) { return ext.trim().toLowerCase(); });
2446
+ var validFiles = filesArray.filter(function (file) {
2447
+ var _a;
2448
+ if (acceptedFiles.includes("image/*") &&
2449
+ file.type.startsWith("image/")) {
2450
+ return true;
2451
+ }
2452
+ if (acceptedExtensions.some(function (ext) { return ext.includes("/"); })) {
2453
+ return acceptedExtensions.some(function (type) { return file.type === type; });
2454
+ }
2455
+ var fileExtension = ".".concat((_a = file.name.split(".").pop()) === null || _a === void 0 ? void 0 : _a.toLowerCase());
2456
+ return acceptedExtensions.some(function (ext) { return ext === fileExtension || ext === "*"; });
1998
2457
  });
1999
- });
2000
- return (jsxRuntime.jsx(react.RadioGroup, { value: selectedColor, onValueChange: onColorChange, orientation: "horizontal", className: "flex flex-wrap !gap-2", classNames: {
2001
- base: "flex flex-wrap !gap-2",
2002
- wrapper: "flex flex-wrap !gap-2",
2003
- }, children: colorOptions.map(function (color) { return (jsxRuntime.jsx(react.Radio, { value: color.label, className: "p-0 m-0", classNames: {
2004
- base: "p-0 m-0",
2005
- wrapper: "hidden",
2006
- labelWrapper: "p-0 m-0",
2007
- }, children: jsxRuntime.jsx("div", { className: "w-8 h-8 rounded-full border-2 cursor-pointer transition-all ".concat(selectedColor === color.label
2008
- ? "border-black border-opacity-20 scale-110"
2009
- : "border-gray-200 hover:scale-105"), style: { backgroundColor: color.color }, title: color.label }) }, color.value)); }) }));
2458
+ if (validFiles.length === 0) {
2459
+ var formattedTypes = acceptedExtensions
2460
+ .map(formatFileType)
2461
+ .join(", ");
2462
+ onError === null || onError === void 0 ? void 0 : onError(t.invalidFileTypeError.replace("{acceptedTypes}", formattedTypes));
2463
+ return [];
2464
+ }
2465
+ return validFiles;
2466
+ }, [multiple, maxFiles, maxFileSize, acceptedFiles, t, onError]);
2467
+ var handleFileUpload = React.useCallback(function (files) {
2468
+ var validFiles = validateFiles(files);
2469
+ if (validFiles.length > 0) {
2470
+ var file_1 = validFiles[0];
2471
+ // Si es imagen y hay configuración de crop, abrir modal
2472
+ if (file_1.type.startsWith("image/") && cropConfig) {
2473
+ var reader_1 = new FileReader();
2474
+ reader_1.onload = function () {
2475
+ setSelectedImageUrl(reader_1.result);
2476
+ setOriginalFile(file_1);
2477
+ setShowCropModal(true);
2478
+ };
2479
+ reader_1.readAsDataURL(file_1);
2480
+ }
2481
+ else {
2482
+ // Procesar directamente si no necesita crop
2483
+ uploadImageRef.current = file_1;
2484
+ onUpload(validFiles);
2485
+ }
2486
+ }
2487
+ }, [onUpload, validateFiles, cropConfig]);
2488
+ // Manejar guardado de imagen recortada
2489
+ var handleCropSave = React.useCallback(function (croppedFile) {
2490
+ uploadImageRef.current = croppedFile;
2491
+ setShowCropModal(false);
2492
+ setSelectedImageUrl("");
2493
+ setOriginalFile(null);
2494
+ onUpload([croppedFile]);
2495
+ }, [onUpload]);
2496
+ // Manejar cancelación de crop
2497
+ var handleCropCancel = React.useCallback(function () {
2498
+ setShowCropModal(false);
2499
+ setSelectedImageUrl("");
2500
+ setOriginalFile(null);
2501
+ }, []);
2502
+ var handleChange = function (event) {
2503
+ var files = event.target.files;
2504
+ if (files && files.length > 0) {
2505
+ handleFileUpload(files);
2506
+ }
2507
+ // Limpiar el input
2508
+ if (inputRef.current) {
2509
+ inputRef.current.value = "";
2510
+ }
2511
+ };
2512
+ var handleDragEnter = React.useCallback(function (e) {
2513
+ e.preventDefault();
2514
+ e.stopPropagation();
2515
+ if (!disabled) {
2516
+ setIsDragging(true);
2517
+ }
2518
+ }, [disabled]);
2519
+ var handleDragLeave = React.useCallback(function (e) {
2520
+ e.preventDefault();
2521
+ e.stopPropagation();
2522
+ setIsDragging(false);
2523
+ }, []);
2524
+ var handleDragOver = React.useCallback(function (e) {
2525
+ e.preventDefault();
2526
+ e.stopPropagation();
2527
+ }, []);
2528
+ var handleDrop = React.useCallback(function (e) {
2529
+ e.preventDefault();
2530
+ e.stopPropagation();
2531
+ setIsDragging(false);
2532
+ if (disabled) {
2533
+ return;
2534
+ }
2535
+ var droppedFiles = e.dataTransfer.files;
2536
+ if (droppedFiles.length > 0) {
2537
+ handleFileUpload(droppedFiles);
2538
+ }
2539
+ }, [disabled, handleFileUpload]);
2540
+ var handleRemoveImage = function () {
2541
+ uploadImageRef.current = null;
2542
+ onUpload([]);
2543
+ };
2544
+ // Clases CSS dinámicas usando Tailwind
2545
+ var containerClasses = "\n\t\trelative w-full border-2 border-dashed rounded-2xl p-3 transition-all duration-300 bg-red-500\n\t\t".concat(width !== "100%" ? "w-[".concat(width, "]") : "w-full", "\n\t\t").concat(height !== "auto" ? "h-[".concat(height, "]") : "min-h-28", "\n\t\t").concat(isDragging
2546
+ ? "border-primary-500 bg-primary-50 dark:bg-primary-900"
2547
+ : error
2548
+ ? "border-danger-500 bg-danger-50 dark:bg-danger-950"
2549
+ : success
2550
+ ? "border-success-500 bg-success-50 dark:bg-success-950"
2551
+ : disabled
2552
+ ? "border-gray-300 bg-gray-100 dark:bg-gray-800"
2553
+ : "border-gray-300 hover:border-gray-400 bg-primary-50 dark:bg-gray-900", "\n\t\t").concat(!(disabled || uploadImageRef.current) ? "cursor-pointer" : "cursor-default", "\n\t\t").concat(className, "\n\t")
2554
+ .trim()
2555
+ .replace(/\s+/g, " ");
2556
+ var textClasses = "\n\t\ttext-centertext-base ont-medium\n\t\t".concat(disabled ? "text-default-400" : textColor || "text-default-700 dark:text-default-200", "\n\t");
2557
+ var subTextClasses = "\n\t\ttext-tiny text-center\n\t\t".concat(disabled ? "text-default-400" : "text-default-500 dark:text-default-400", "\n\t");
2558
+ return (jsxRuntime.jsxs("div", { className: "relative", children: [jsxRuntime.jsx(react.Card, { className: containerClasses, isPressable: !(disabled || uploadImageRef.current), onPress: handleClick, children: jsxRuntime.jsxs(react.CardBody, { className: "flex flex-col items-center justify-center gap-3 sm:gap-4 relative overflow-hidden", onDragEnter: handleDragEnter, onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, children: [uploadImageRef.current && (jsxRuntime.jsx(FilePreview, { file: uploadImageRef.current, onRemove: handleRemoveImage, removeAriaLabel: t.removeFileAriaLabel })), jsxRuntime.jsx("div", { className: uploadImageRef.current
2559
+ ? "opacity-0"
2560
+ : "opacity-100 transition-opacity", children: jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-3 sm:gap-4", children: [jsxRuntime.jsx(IconComponent, { icon: icon, size: "xl", className: "sm:text-4xl lg:text-5xl ".concat(disabled ? "text-gray-400" : iconColor || "text-primary") }), jsxRuntime.jsxs("div", { className: "text-center px-2", children: [jsxRuntime.jsx("p", { className: textClasses, children: isDragging ? t.dragText : finalText }), finalSubText && !isDragging && (jsxRuntime.jsx("p", { className: subTextClasses, children: finalSubText }))] })] }) }), jsxRuntime.jsx("input", { ref: inputRef, type: "file", className: "hidden", multiple: multiple, accept: Array.isArray(acceptedFiles)
2561
+ ? acceptedFiles.join(",")
2562
+ : acceptedFiles, onChange: handleChange, disabled: disabled, "aria-label": t.uploadAreaAriaLabel })] }) }), error && errorText && (jsxRuntime.jsx("p", { className: "text-red-500 text-sm mt-2", role: "alert", children: errorText })), showCropModal && selectedImageUrl && cropConfig && (jsxRuntime.jsx(ImageCropModal, { isOpen: showCropModal, imageUrl: selectedImageUrl, targetWidth: cropConfig.targetWidth, targetHeight: cropConfig.targetHeight, onSave: handleCropSave, onCancel: handleCropCancel, translations: t }))] }));
2010
2563
  };
2564
+ UploadFile.displayName = "UploadFile";
2011
2565
 
2012
2566
  var Modal = function (props) {
2013
2567
  return (jsxRuntime.jsx(react.Modal, __assign({ shouldBlockScroll: true, radius: "lg", className: "py-9 px-6" }, props)));
@@ -2155,6 +2709,7 @@ var AuraToastProvider = function (_a) {
2155
2709
  };
2156
2710
 
2157
2711
  exports.AddHolidayForm = AddHolidayForm;
2712
+ exports.AnalyticsCard = AnalyticsCard;
2158
2713
  exports.AuraTable = AuraTable;
2159
2714
  exports.AuraToastProvider = AuraToastProvider;
2160
2715
  exports.AutoComplete = AutoComplete;
@@ -2164,6 +2719,7 @@ exports.ColorSelector = ColorSelector;
2164
2719
  exports.DatePicker = DatePicker;
2165
2720
  exports.DateRangePicker = DateRangePicker;
2166
2721
  exports.GlobalToast = GlobalToast;
2722
+ exports.H1 = H1;
2167
2723
  exports.H2 = H2;
2168
2724
  exports.H3 = H3;
2169
2725
  exports.H4 = H4;
@@ -2176,11 +2732,15 @@ exports.ModalBody = ModalBody;
2176
2732
  exports.ModalContent = ModalContent;
2177
2733
  exports.ModalFooter = ModalFooter;
2178
2734
  exports.ModalHeader = ModalHeader;
2735
+ exports.MultiStepWizard = MultiStepWizard;
2179
2736
  exports.P = P;
2180
2737
  exports.Pagination = Pagination;
2181
2738
  exports.Phone = Phone;
2739
+ exports.PromotionalBanner = PromotionalBanner;
2740
+ exports.RowSteps = RowSteps;
2182
2741
  exports.ScheduleRow = ScheduleRow;
2183
2742
  exports.Select = Select;
2743
+ exports.StepIndicator = StepIndicator;
2184
2744
  exports.SwitchComponent = Switch;
2185
2745
  exports.Textarea = Textarea;
2186
2746
  exports.ThemeContext = ThemeContext;
@@ -2189,6 +2749,7 @@ exports.ThemeProvider = ThemeProvider;
2189
2749
  exports.TimeInputComponent = TimeInput;
2190
2750
  exports.ToastContext = ToastContext;
2191
2751
  exports.UploadFile = UploadFile;
2752
+ exports.VerticalSteps = VerticalSteps;
2192
2753
  exports.sizeMap = sizeMap;
2193
2754
  exports.themeColors = themeColors;
2194
2755
  exports.useAuraToast = useAuraToast;