@beweco/aurora-ui 0.1.6 → 0.1.8

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