@beweco/aurora-ui 0.1.5 → 0.1.7

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