@beweco/aurora-ui 0.0.9 → 0.0.11

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 (96) hide show
  1. package/dist/assets/css/styles.css +1 -1
  2. package/dist/index.cjs.js +673 -14
  3. package/dist/index.esm.js +664 -17
  4. package/dist/types/components/autocomplete/AutoComplete.d.ts +13 -0
  5. package/dist/types/components/autocomplete/AutoComplete.d.ts.map +1 -0
  6. package/dist/types/components/autocomplete/AutoComplete.types.d.ts +8 -0
  7. package/dist/types/components/autocomplete/AutoComplete.types.d.ts.map +1 -0
  8. package/dist/types/components/autocomplete/index.d.ts +3 -0
  9. package/dist/types/components/autocomplete/index.d.ts.map +1 -0
  10. package/dist/types/components/button/Button.d.ts +12 -5
  11. package/dist/types/components/button/Button.d.ts.map +1 -1
  12. package/dist/types/components/button/Button.types.d.ts +10 -20
  13. package/dist/types/components/button/Button.types.d.ts.map +1 -1
  14. package/dist/types/components/button/index.d.ts +2 -2
  15. package/dist/types/components/button/index.d.ts.map +1 -1
  16. package/dist/types/components/card/Card.d.ts +13 -0
  17. package/dist/types/components/card/Card.d.ts.map +1 -0
  18. package/dist/types/components/card/Card.types.d.ts +15 -0
  19. package/dist/types/components/card/Card.types.d.ts.map +1 -0
  20. package/dist/types/components/card/index.d.ts +3 -0
  21. package/dist/types/components/card/index.d.ts.map +1 -0
  22. package/dist/types/components/header/Header.d.ts +5 -0
  23. package/dist/types/components/header/Header.d.ts.map +1 -0
  24. package/dist/types/components/header/Header.types.d.ts +27 -0
  25. package/dist/types/components/header/Header.types.d.ts.map +1 -0
  26. package/dist/types/components/header/_internal/config-menu/ConfigMenu.d.ts +4 -0
  27. package/dist/types/components/header/_internal/config-menu/ConfigMenu.d.ts.map +1 -0
  28. package/dist/types/components/header/_internal/config-menu/ConfigMenu.types.d.ts +9 -0
  29. package/dist/types/components/header/_internal/config-menu/ConfigMenu.types.d.ts.map +1 -0
  30. package/dist/types/components/header/_internal/notification-button/NotificationButton.d.ts +7 -0
  31. package/dist/types/components/header/_internal/notification-button/NotificationButton.d.ts.map +1 -0
  32. package/dist/types/components/header/index.d.ts +3 -0
  33. package/dist/types/components/header/index.d.ts.map +1 -0
  34. package/dist/types/components/input/Input.d.ts +14 -0
  35. package/dist/types/components/input/Input.d.ts.map +1 -0
  36. package/dist/types/components/input/Input.types.d.ts +8 -0
  37. package/dist/types/components/input/Input.types.d.ts.map +1 -0
  38. package/dist/types/components/input/index.d.ts +3 -0
  39. package/dist/types/components/input/index.d.ts.map +1 -0
  40. package/dist/types/components/{Menu → menu}/Menu.d.ts.map +1 -1
  41. package/dist/types/components/{Menu → menu}/Menu.types.d.ts +1 -1
  42. package/dist/types/components/{Menu → menu}/Menu.types.d.ts.map +1 -1
  43. package/dist/types/components/{menu-nav-list → menu/_internal/menu-nav-list}/MenuNavList.d.ts +1 -2
  44. package/dist/types/components/menu/_internal/menu-nav-list/MenuNavList.d.ts.map +1 -0
  45. package/dist/types/components/menu/_internal/menu-nav-list/MenuNavList.styles.d.ts.map +1 -0
  46. package/dist/types/components/menu/_internal/menu-nav-list/MenuNavList.types.d.ts.map +1 -0
  47. package/dist/types/components/{menu-nav-list → menu/_internal/menu-nav-list}/index.d.ts +1 -0
  48. package/dist/types/components/menu/_internal/menu-nav-list/index.d.ts.map +1 -0
  49. package/dist/types/components/menu/sidebar-items.d.ts +3 -0
  50. package/dist/types/components/{Menu → menu}/sidebar-items.d.ts.map +1 -1
  51. package/dist/types/components/phone/Phone.d.ts +1 -20
  52. package/dist/types/components/phone/Phone.d.ts.map +1 -1
  53. package/dist/types/components/phone/Phone.types.d.ts +21 -0
  54. package/dist/types/components/phone/Phone.types.d.ts.map +1 -0
  55. package/dist/types/components/phone/index.d.ts +1 -0
  56. package/dist/types/components/phone/index.d.ts.map +1 -1
  57. package/dist/types/components/select/Select.d.ts +14 -0
  58. package/dist/types/components/select/Select.d.ts.map +1 -0
  59. package/dist/types/components/select/Select.types.d.ts +8 -0
  60. package/dist/types/components/select/Select.types.d.ts.map +1 -0
  61. package/dist/types/components/select/index.d.ts +3 -0
  62. package/dist/types/components/select/index.d.ts.map +1 -0
  63. package/dist/types/components/theme-picker/ThemePicker.d.ts +14 -0
  64. package/dist/types/components/theme-picker/ThemePicker.d.ts.map +1 -0
  65. package/dist/types/components/theme-picker/ThemePicker.types.d.ts +21 -0
  66. package/dist/types/components/theme-picker/ThemePicker.types.d.ts.map +1 -0
  67. package/dist/types/components/theme-picker/index.d.ts +3 -0
  68. package/dist/types/components/theme-picker/index.d.ts.map +1 -0
  69. package/dist/types/components/upload-file/UploadFile.d.ts +20 -0
  70. package/dist/types/components/upload-file/UploadFile.d.ts.map +1 -0
  71. package/dist/types/components/upload-file/UploadFile.types.d.ts +104 -0
  72. package/dist/types/components/upload-file/UploadFile.types.d.ts.map +1 -0
  73. package/dist/types/components/upload-file/index.d.ts +3 -0
  74. package/dist/types/components/upload-file/index.d.ts.map +1 -0
  75. package/dist/types/index.d.ts +9 -1
  76. package/dist/types/index.d.ts.map +1 -1
  77. package/package.json +1 -1
  78. package/dist/assets/output-Ck0ffzyL.css +0 -73
  79. package/dist/types/components/Menu/sidebar-items.d.ts +0 -3
  80. package/dist/types/components/index.d.ts +0 -4
  81. package/dist/types/components/index.d.ts.map +0 -1
  82. package/dist/types/components/menu-nav-list/MenuNavList.d.ts.map +0 -1
  83. package/dist/types/components/menu-nav-list/MenuNavList.styles.d.ts.map +0 -1
  84. package/dist/types/components/menu-nav-list/MenuNavList.types.d.ts.map +0 -1
  85. package/dist/types/components/menu-nav-list/index.d.ts.map +0 -1
  86. package/dist/types/components/menuprueba/MenuPrueba.d.ts +0 -4
  87. package/dist/types/components/menuprueba/MenuPrueba.d.ts.map +0 -1
  88. package/dist/types/components/menuprueba/MenuPrueba.types.d.ts +0 -23
  89. package/dist/types/components/menuprueba/MenuPrueba.types.d.ts.map +0 -1
  90. package/dist/types/components/menuprueba/index.d.ts +0 -3
  91. package/dist/types/components/menuprueba/index.d.ts.map +0 -1
  92. /package/dist/types/components/{Menu → menu}/Menu.d.ts +0 -0
  93. /package/dist/types/components/{menu-nav-list → menu/_internal/menu-nav-list}/MenuNavList.styles.d.ts +0 -0
  94. /package/dist/types/components/{menu-nav-list → menu/_internal/menu-nav-list}/MenuNavList.types.d.ts +0 -0
  95. /package/dist/types/components/{Menu → menu}/index.d.ts +0 -0
  96. /package/dist/types/components/{Menu → menu}/index.d.ts.map +0 -0
package/dist/index.esm.js CHANGED
@@ -1,6 +1,7 @@
1
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
- import { Button, cn, ListboxItem, Popover, PopoverTrigger, Tooltip, PopoverContent, Listbox, Accordion, AccordionItem, ListboxSection, Spacer, Avatar, Card, CardBody, CardFooter, Input } from '@heroui/react';
3
- import React, { useEffect, useState, createElement, useCallback, useRef, createContext, useContext } from 'react';
1
+ import { Autocomplete, cn, ListboxItem, Popover, PopoverTrigger, Tooltip, PopoverContent, Listbox, Accordion, AccordionItem, ListboxSection, Spacer, Avatar, Card as Card$1, CardBody, CardFooter, Button as Button$1, Input as Input$1, RadioGroup, Radio, Modal, ModalContent, ModalHeader, ModalBody, Slider, ModalFooter, Dropdown, DropdownTrigger, DropdownMenu, DropdownSection, DropdownItem, Select as Select$1 } from '@heroui/react';
2
+ export * from '@heroui/react';
3
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
4
+ import React, { useId, useState, createElement, useCallback, useRef, useEffect, useMemo, createContext, useContext } from 'react';
4
5
  import { Icon } from '@iconify/react';
5
6
  import { useTheme } from '@heroui/use-theme';
6
7
 
@@ -50,15 +51,22 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
50
51
  };
51
52
 
52
53
  /**
53
- * Button component with HeroUI styling
54
- * Provides a consistent interface for button interactions across the application
54
+ * AutoComplete genérico reutilizable basado en HeroUI siguiendo las reglas de diseño BeweOS.
55
+ *
56
+ * Reglas aplicadas:
57
+ * - Variant: Bordered (por defecto)
58
+ * - Radius: md (por defecto)
59
+ * - labelPlacement: Outside
60
+ * - Size: sm, md, lg (configurable)
55
61
  */
56
- var ButtonPrueba = function (_a) {
57
- var children = _a.children, startIcon = _a.startIcon, endIcon = _a.endIcon, _b = _a.loading, loading = _b === void 0 ? false : _b, disabled = _a.disabled, _c = _a.variant, variant = _c === void 0 ? "solid" : _c, _d = _a.color, color = _d === void 0 ? "primary" : _d, _e = _a.size, size = _e === void 0 ? "md" : _e, radius = _a.radius, _f = _a.fullWidth, fullWidth = _f === void 0 ? false : _f, _g = _a.className, className = _g === void 0 ? "" : _g, props = __rest(_a, ["children", "startIcon", "endIcon", "loading", "disabled", "variant", "color", "size", "radius", "fullWidth", "className"]);
58
- useEffect(function () {
59
- // console.log("estamos dentro del botnon");
60
- }, []);
61
- return (jsx(Button, __assign({ variant: variant, color: color, size: size, radius: radius, fullWidth: fullWidth, isLoading: loading, isDisabled: disabled, startContent: startIcon, endContent: endIcon, className: className }, props, { children: children })));
62
+ var AutoComplete = function (_a) {
63
+ 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"]);
64
+ var generatedId = useId();
65
+ var autoId = id || generatedId;
66
+ 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: {
67
+ base: "[&_[data-slot=input-wrapper][data-focus=true]]:!border-primary-500",
68
+ popoverContent: "[&_li[data-hover=true]]:!bg-primary-50 [&_li[data-hover=true]]:!text-default-600 [&_li]:!text-default-500",
69
+ } }))] }));
62
70
  };
63
71
 
64
72
  var sizeMap = {
@@ -246,9 +254,9 @@ var MenuComponent = React.memo(function Menu(_a) {
246
254
  }
247
255
  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
248
256
  ? "container__menu--collapsed"
249
- : "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 uppercase", 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
257
+ : "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
250
258
  ? "solar:alt-arrow-right-outline"
251
- : "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, { 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, { 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, { fullWidth: true, className: " text-default-600 data-[hover=true]:text-foreground", 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 })) }) })] }) })] }));
259
+ : "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 })) }) })] }) })] }));
252
260
  });
253
261
 
254
262
  // Lista simple de países con bandera emoji y código
@@ -292,7 +300,8 @@ var countries = [
292
300
  { code: "+971", name: "UAE", flag: "🇦🇪" },
293
301
  ];
294
302
  var uniqueCountries = Array.from(new Map(countries.map(function (item) { return [item.code + item.name, item]; })).values());
295
- var defaultTranslations = {
303
+ // Traducciones por defecto
304
+ var defaultTranslations$2 = {
296
305
  label: "Teléfono",
297
306
  placeholder: "Número de teléfono",
298
307
  searchPlaceholder: "Buscar país...",
@@ -308,7 +317,7 @@ var Phone = function (_a) {
308
317
  var dropdownRef = useRef(null);
309
318
  var _m = useState(uniqueCountries), filteredCountries = _m[0], setFilteredCountries = _m[1];
310
319
  // Combinar traducciones por defecto con las proporcionadas
311
- var t = __assign(__assign({}, defaultTranslations), translations);
320
+ var t = __assign(__assign({}, defaultTranslations$2), translations);
312
321
  // Usar la etiqueta de las traducciones si no se proporciona label explícitamente
313
322
  var finalLabel = label || t.label;
314
323
  // Sincroniza valor externo
@@ -374,7 +383,645 @@ var Phone = function (_a) {
374
383
  setFilteredCountries(filtered);
375
384
  } }) }), 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
376
385
  ? "bg-blue-50 dark:bg-blue-900"
377
- : ""), 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, { 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 }))] }));
386
+ : ""), 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 }))] }));
387
+ };
388
+
389
+ // Traducciones por defecto en español según las reglas de diseño
390
+ var defaultTranslations$1 = {
391
+ lightTheme: "Claro",
392
+ darkTheme: "Oscuro",
393
+ };
394
+ /**
395
+ * Selector de tema visual con preview interactivo siguiendo las reglas de diseño BeweOS.
396
+ *
397
+ * Reglas aplicadas:
398
+ * - Soporte completo de traducciones mediante props
399
+ * - Sin dependencias de sistemas i18n específicos
400
+ * - Dark mode compatible
401
+ * - Uso exclusivo de Tailwind CSS
402
+ */
403
+ var ThemePicker = function (_a) {
404
+ var value = _a.value, onChange = _a.onChange, className = _a.className, _b = _a.translations, translations = _b === void 0 ? {} : _b;
405
+ // Combinar traducciones por defecto con las proporcionadas
406
+ var t = __assign(__assign({}, defaultTranslations$1), translations);
407
+ var themes = [
408
+ {
409
+ key: "light",
410
+ label: t.lightTheme,
411
+ cardClass: "bg-white border border-[#E4E4E7] text-zinc-900",
412
+ previewClass: "bg-[#F4F4F5] border border-[#E4E4E7]",
413
+ labelClass: "font-medium text-[14px] leading-[20px] text-zinc-900",
414
+ radioColor: "primary",
415
+ 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" })] })),
416
+ },
417
+ {
418
+ key: "dark",
419
+ label: t.darkTheme,
420
+ cardClass: "bg-black border border-[#3F3F46] text-white",
421
+ previewClass: "bg-[#27272A] border border-[#3F3F46]",
422
+ labelClass: "font-medium text-[14px] leading-[20px] text-white",
423
+ radioColor: "primary",
424
+ 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" })] })),
425
+ },
426
+ ];
427
+ 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)); }) }));
428
+ };
429
+
430
+ // Traducciones por defecto en español
431
+ var defaultTranslations = {
432
+ uploadText: "Da clic y selecciona tus archivos",
433
+ subText: "",
434
+ dragText: "Suelta el archivo aquí",
435
+ multipleFilesError: "Solo puedes subir un archivo",
436
+ maxFilesError: "Puedes subir máximo {maxFiles} archivos",
437
+ invalidFileTypeError: "Solo se aceptan archivos de tipo: {acceptedTypes}",
438
+ maxFileSizeError: "El archivo excede el tamaño máximo permitido de {maxSize}",
439
+ removeFileAriaLabel: "Remover archivo",
440
+ uploadAreaAriaLabel: "Área de carga de archivos",
441
+ cropModalTitle: "Recortar imagen",
442
+ cropSaveButton: "Guardar",
443
+ cropCancelButton: "Cancelar",
444
+ cropZoomLabel: "Zoom",
445
+ cropInstructions: "Arrastra para mover la imagen y usa el zoom para ajustar el tamaño",
446
+ cropBackgroundLabel: "Color de fondo",
447
+ cropBackgroundWhite: "Blanco",
448
+ cropBackgroundBlack: "Negro",
449
+ cropBackgroundTransparent: "Transparente",
450
+ };
451
+ /**
452
+ * Formatea el tipo de archivo para mostrar
453
+ */
454
+ var formatFileType = function (type) {
455
+ var _a;
456
+ if (type.startsWith(".")) {
457
+ return type.toUpperCase();
458
+ }
459
+ if (type.includes("/")) {
460
+ var parts = type.split("/");
461
+ return ((_a = parts[1]) === null || _a === void 0 ? void 0 : _a.toUpperCase()) || type;
462
+ }
463
+ return type.toUpperCase();
464
+ };
465
+ /**
466
+ * Formatea el tamaño del archivo de forma legible
467
+ */
468
+ var formatFileSize = function (bytes) {
469
+ if (bytes === 0) {
470
+ return "0 Bytes";
471
+ }
472
+ var k = 1024;
473
+ var sizes = ["Bytes", "KB", "MB", "GB"];
474
+ var i = Math.floor(Math.log(bytes) / Math.log(k));
475
+ return "".concat(Math.round(bytes / Math.pow(k, i)), " ").concat(sizes[i]);
476
+ };
477
+ /**
478
+ * Componente de recorte de imagen usando Canvas API
479
+ */
480
+ var ImageCropModal = function (_a) {
481
+ var isOpen = _a.isOpen, imageUrl = _a.imageUrl, targetWidth = _a.targetWidth, targetHeight = _a.targetHeight, onSave = _a.onSave, onCancel = _a.onCancel, translations = _a.translations;
482
+ var canvasRef = useRef(null);
483
+ var _b = useState(null), imageElement = _b[0], setImageElement = _b[1];
484
+ var _c = useState(0), zoomValue = _c[0], setZoomValue = _c[1]; // Valor del slider de -1 a 1
485
+ var _d = useState({ x: 0, y: 0 }), position = _d[0], setPosition = _d[1];
486
+ var _e = useState(false), isDragging = _e[0], setIsDragging = _e[1];
487
+ var _f = useState({ x: 0, y: 0 }), dragStart = _f[0], setDragStart = _f[1];
488
+ var _g = useState(1), baseScale = _g[0], setBaseScale = _g[1]; // Escala base inicial
489
+ var _h = useState({ width: 400, height: 300 }), canvasSize = _h[0], setCanvasSize = _h[1];
490
+ var _j = useState("white"), backgroundColor = _j[0], setBackgroundColor = _j[1];
491
+ // Función para convertir el valor del zoom slider a escala real
492
+ var getScaleFromZoom = function (zoomValue) {
493
+ if (zoomValue === 0) {
494
+ return baseScale;
495
+ }
496
+ if (zoomValue > 0) {
497
+ // Zoom in: de baseScale a baseScale * 3
498
+ return baseScale + baseScale * 2 * zoomValue;
499
+ }
500
+ // Zoom out: de baseScale * 0.3 a baseScale
501
+ return baseScale + baseScale * 0.7 * zoomValue;
502
+ };
503
+ var currentScale = getScaleFromZoom(zoomValue);
504
+ // Cargar imagen cuando se abre el modal
505
+ useEffect(function () {
506
+ if (isOpen && imageUrl) {
507
+ var img_1 = new Image();
508
+ img_1.onload = function () {
509
+ setImageElement(img_1);
510
+ // Calcular escala inicial para que la imagen quepa en el área de crop
511
+ var scaleX = targetWidth / img_1.width;
512
+ var scaleY = targetHeight / img_1.height;
513
+ var initialScale = Math.max(scaleX, scaleY);
514
+ setBaseScale(initialScale);
515
+ setZoomValue(0); // Empezar en el centro
516
+ setPosition({ x: 0, y: 0 });
517
+ setBackgroundColor("white"); // Reset color de fondo
518
+ };
519
+ img_1.src = imageUrl;
520
+ }
521
+ }, [isOpen, imageUrl, targetWidth, targetHeight]);
522
+ // Dibujar en el canvas
523
+ useEffect(function () {
524
+ if (!(imageElement && canvasRef.current)) {
525
+ return;
526
+ }
527
+ var canvas = canvasRef.current;
528
+ var ctx = canvas.getContext("2d");
529
+ if (!ctx) {
530
+ return;
531
+ }
532
+ // Limpiar canvas
533
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
534
+ // Dibujar fondo gris del canvas
535
+ ctx.fillStyle = "#f3f4f6";
536
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
537
+ // Calcular posición y tamaño de la imagen
538
+ var imgWidth = imageElement.width * currentScale;
539
+ var imgHeight = imageElement.height * currentScale;
540
+ var imgX = (canvas.width - imgWidth) / 2 + position.x;
541
+ var imgY = (canvas.height - imgHeight) / 2 + position.y;
542
+ // Dibujar imagen
543
+ ctx.drawImage(imageElement, imgX, imgY, imgWidth, imgHeight);
544
+ // Dibujar overlay para mostrar área de recorte
545
+ ctx.fillStyle = "rgba(0, 0, 0, 0.5)";
546
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
547
+ // Limpiar área de recorte (centro)
548
+ var cropX = (canvas.width - targetWidth) / 2;
549
+ var cropY = (canvas.height - targetHeight) / 2;
550
+ ctx.clearRect(cropX, cropY, targetWidth, targetHeight);
551
+ // Dibujar color de fondo del área de recorte
552
+ if (backgroundColor !== "transparent") {
553
+ ctx.fillStyle = backgroundColor === "white" ? "#ffffff" : "#000000";
554
+ ctx.fillRect(cropX, cropY, targetWidth, targetHeight);
555
+ }
556
+ // Redibujar imagen solo en el área de recorte
557
+ ctx.save();
558
+ ctx.beginPath();
559
+ ctx.rect(cropX, cropY, targetWidth, targetHeight);
560
+ ctx.clip();
561
+ ctx.drawImage(imageElement, imgX, imgY, imgWidth, imgHeight);
562
+ ctx.restore();
563
+ // Dibujar borde del área de recorte
564
+ ctx.strokeStyle = "#3b82f6";
565
+ ctx.lineWidth = 2;
566
+ ctx.strokeRect(cropX, cropY, targetWidth, targetHeight);
567
+ }, [
568
+ imageElement,
569
+ currentScale,
570
+ position,
571
+ targetWidth,
572
+ targetHeight,
573
+ backgroundColor,
574
+ ]);
575
+ var handleMouseDown = function (e) {
576
+ var _a;
577
+ e.preventDefault();
578
+ setIsDragging(true);
579
+ var rect = (_a = canvasRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
580
+ if (rect) {
581
+ setDragStart({
582
+ x: e.clientX - rect.left - position.x,
583
+ y: e.clientY - rect.top - position.y,
584
+ });
585
+ }
586
+ };
587
+ var handleMouseMove = function (e) {
588
+ var _a;
589
+ if (!isDragging) {
590
+ return;
591
+ }
592
+ e.preventDefault();
593
+ var rect = (_a = canvasRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
594
+ if (rect) {
595
+ setPosition({
596
+ x: e.clientX - rect.left - dragStart.x,
597
+ y: e.clientY - rect.top - dragStart.y,
598
+ });
599
+ }
600
+ };
601
+ var handleMouseUp = function () {
602
+ setIsDragging(false);
603
+ };
604
+ // Eventos táctiles para dispositivos móviles
605
+ var handleTouchStart = function (e) {
606
+ var _a;
607
+ e.preventDefault();
608
+ if (e.touches.length === 1) {
609
+ setIsDragging(true);
610
+ var rect = (_a = canvasRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
611
+ if (rect) {
612
+ var touch = e.touches[0];
613
+ setDragStart({
614
+ x: touch.clientX - rect.left - position.x,
615
+ y: touch.clientY - rect.top - position.y,
616
+ });
617
+ }
618
+ }
619
+ };
620
+ var handleTouchMove = function (e) {
621
+ var _a;
622
+ if (!isDragging || e.touches.length !== 1) {
623
+ return;
624
+ }
625
+ e.preventDefault();
626
+ var rect = (_a = canvasRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
627
+ if (rect) {
628
+ var touch = e.touches[0];
629
+ setPosition({
630
+ x: touch.clientX - rect.left - dragStart.x,
631
+ y: touch.clientY - rect.top - dragStart.y,
632
+ });
633
+ }
634
+ };
635
+ var handleTouchEnd = function () {
636
+ setIsDragging(false);
637
+ };
638
+ var handleSave = function () {
639
+ if (!(imageElement && canvasRef.current)) {
640
+ return;
641
+ }
642
+ // Crear canvas temporal para el recorte
643
+ var tempCanvas = document.createElement("canvas");
644
+ tempCanvas.width = targetWidth;
645
+ tempCanvas.height = targetHeight;
646
+ var tempCtx = tempCanvas.getContext("2d");
647
+ if (!tempCtx) {
648
+ return;
649
+ }
650
+ // Dibujar color de fondo si no es transparente
651
+ if (backgroundColor !== "transparent") {
652
+ tempCtx.fillStyle = backgroundColor === "white" ? "#ffffff" : "#000000";
653
+ tempCtx.fillRect(0, 0, targetWidth, targetHeight);
654
+ }
655
+ // Calcular parámetros de recorte
656
+ var canvas = canvasRef.current;
657
+ var imgWidth = imageElement.width * currentScale;
658
+ var imgHeight = imageElement.height * currentScale;
659
+ var imgX = (canvas.width - imgWidth) / 2 + position.x;
660
+ var imgY = (canvas.height - imgHeight) / 2 + position.y;
661
+ var cropX = (canvas.width - targetWidth) / 2;
662
+ var cropY = (canvas.height - targetHeight) / 2;
663
+ // Calcular área fuente en la imagen original
664
+ var sourceX = (cropX - imgX) / currentScale;
665
+ var sourceY = (cropY - imgY) / currentScale;
666
+ var sourceWidth = targetWidth / currentScale;
667
+ var sourceHeight = targetHeight / currentScale;
668
+ // Dibujar recorte sobre el fondo
669
+ tempCtx.drawImage(imageElement, sourceX, sourceY, sourceWidth, sourceHeight, 0, 0, targetWidth, targetHeight);
670
+ // Convertir a blob y crear archivo
671
+ var fileType = backgroundColor === "transparent" ? "image/png" : "image/png";
672
+ tempCanvas.toBlob(function (blob) {
673
+ if (blob) {
674
+ var timestamp = new Date().getTime();
675
+ var file = new File([blob], "cropped-image-".concat(timestamp, ".png"), {
676
+ type: fileType,
677
+ });
678
+ onSave(file, imageElement.src);
679
+ }
680
+ }, fileType);
681
+ };
682
+ // Calcular dimensiones responsive del canvas
683
+ var updateCanvasSize = useCallback(function () {
684
+ var minCanvasWidth = Math.min(350, window.innerWidth - 40);
685
+ var minCanvasHeight = Math.min(250, window.innerHeight - 300);
686
+ var newCanvasWidth = Math.max(minCanvasWidth, targetWidth + 60);
687
+ var newCanvasHeight = Math.max(minCanvasHeight, targetHeight + 60);
688
+ setCanvasSize({ width: newCanvasWidth, height: newCanvasHeight });
689
+ }, [targetWidth, targetHeight]);
690
+ // Actualizar tamaño del canvas al cambiar el tamaño de la ventana
691
+ useEffect(function () {
692
+ if (!isOpen) {
693
+ return;
694
+ }
695
+ updateCanvasSize();
696
+ var handleResize = function () {
697
+ updateCanvasSize();
698
+ };
699
+ window.addEventListener("resize", handleResize);
700
+ return function () {
701
+ window.removeEventListener("resize", handleResize);
702
+ };
703
+ }, [isOpen, updateCanvasSize]);
704
+ return (jsx(Modal, { isOpen: isOpen, onClose: onCancel, size: "5xl", className: "sm:max-w-4xl", scrollBehavior: "inside", backdrop: "blur", classNames: {
705
+ backdrop: "bg-black/80",
706
+ wrapper: "p-0 sm:p-4",
707
+ base: "m-0 sm:m-4 max-h-screen sm:max-h-[90vh] w-full sm:w-auto",
708
+ }, children: jsxs(ModalContent, { className: "m-0 sm:m-0 h-screen sm:h-auto sm:max-h-[90vh] sm:rounded-lg", children: [jsxs(ModalHeader, { 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, { 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: [
709
+ { value: -1, label: "Out" },
710
+ { value: 0, label: "0" },
711
+ { value: 1, label: "In" },
712
+ ] }), 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) {
713
+ return setBackgroundColor(e.target.value);
714
+ }, 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) {
715
+ return setBackgroundColor(e.target.value);
716
+ }, 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) {
717
+ return setBackgroundColor(e.target.value);
718
+ }, className: "text-blue-600 focus:ring-blue-500" }), jsx("div", { className: "w-4 h-4 bg-gray-200 border border-gray-300 rounded", style: {
719
+ 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%)",
720
+ backgroundSize: "8px 8px",
721
+ backgroundPosition: "0 0, 0 4px, 4px -4px, -4px 0px",
722
+ } }), jsx("span", { className: "text-sm", children: translations.cropBackgroundTransparent })] })] })] })] }) }), jsxs(ModalFooter, { 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 })] })] }) }));
723
+ };
724
+ /**
725
+ * Componente de previsualización de archivo
726
+ */
727
+ var FilePreview = function (_a) {
728
+ var file = _a.file, onRemove = _a.onRemove, removeAriaLabel = _a.removeAriaLabel;
729
+ var _b = useState(""), previewUrl = _b[0], setPreviewUrl = _b[1];
730
+ useEffect(function () {
731
+ if (file === null || file === void 0 ? void 0 : file.type.startsWith("image/")) {
732
+ var url_1 = URL.createObjectURL(file);
733
+ setPreviewUrl(url_1);
734
+ return function () { return URL.revokeObjectURL(url_1); };
735
+ }
736
+ }, [file]);
737
+ if (!(file === null || file === void 0 ? void 0 : file.type.startsWith("image/"))) {
738
+ return null;
739
+ }
740
+ 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" }) })] }));
741
+ };
742
+ /**
743
+ * Componente UploadDocument basado en Hero UI con funcionalidad mejorada
744
+ *
745
+ * @example
746
+ * ```tsx
747
+ * <UploadDocument
748
+ * onUpload={(files) => console.log(files)}
749
+ * acceptedFiles="image/*,.pdf"
750
+ * multiple={false}
751
+ * translations={{
752
+ * uploadText: "Upload your files",
753
+ * dragText: "Drop files here"
754
+ * }}
755
+ * />
756
+ * ```
757
+ */
758
+ var UploadFile = function (_a) {
759
+ var text = _a.text, textColor = _a.textColor, subText = _a.subText,
760
+ // borderColor, // TODO: Implementar colores personalizados
761
+ iconColor = _a.iconColor,
762
+ // backgroundColor, // TODO: Implementar colores personalizados
763
+ _b = _a.width,
764
+ // backgroundColor, // TODO: Implementar colores personalizados
765
+ 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;
766
+ var inputRef = useRef(null);
767
+ var uploadImageRef = useRef(image || null);
768
+ var _o = useState(false), isDragging = _o[0], setIsDragging = _o[1];
769
+ // Estados para el modal de crop
770
+ var _p = useState(false), showCropModal = _p[0], setShowCropModal = _p[1];
771
+ var _q = useState(""), selectedImageUrl = _q[0], setSelectedImageUrl = _q[1];
772
+ var _r = useState(null); _r[0]; var setOriginalFile = _r[1];
773
+ // Combinar traducciones por defecto con las proporcionadas
774
+ var t = useMemo(function () { return (__assign(__assign({}, defaultTranslations), translations)); }, [translations]);
775
+ // Actualizar texto si se pasa como prop (retrocompatibilidad)
776
+ var finalText = text || t.uploadText;
777
+ var finalSubText = subText || t.subText;
778
+ var handleClick = function () {
779
+ var _a;
780
+ if (!(disabled || uploadImageRef.current)) {
781
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.click();
782
+ }
783
+ };
784
+ var validateFiles = useCallback(function (files) {
785
+ var filesArray = Array.from(files);
786
+ if (!multiple && filesArray.length > 1) {
787
+ onError === null || onError === void 0 ? void 0 : onError(t.multipleFilesError);
788
+ return [];
789
+ }
790
+ if (filesArray.length > maxFiles) {
791
+ onError === null || onError === void 0 ? void 0 : onError(t.maxFilesError.replace("{maxFiles}", maxFiles.toString()));
792
+ return [];
793
+ }
794
+ // Validar tamaño de archivo
795
+ if (maxFileSize) {
796
+ var oversizedFiles = filesArray.filter(function (file) { return file.size > maxFileSize; });
797
+ if (oversizedFiles.length > 0) {
798
+ var maxSizeFormatted = formatFileSize(maxFileSize);
799
+ onError === null || onError === void 0 ? void 0 : onError(t.maxFileSizeError.replace("{maxSize}", maxSizeFormatted));
800
+ return [];
801
+ }
802
+ }
803
+ // Validar tipos de archivo
804
+ var acceptedExtensions = Array.isArray(acceptedFiles)
805
+ ? acceptedFiles.map(function (ext) { return ext.trim().toLowerCase(); })
806
+ : acceptedFiles.split(",").map(function (ext) { return ext.trim().toLowerCase(); });
807
+ var validFiles = filesArray.filter(function (file) {
808
+ var _a;
809
+ if (acceptedFiles.includes("image/*") &&
810
+ file.type.startsWith("image/")) {
811
+ return true;
812
+ }
813
+ if (acceptedExtensions.some(function (ext) { return ext.includes("/"); })) {
814
+ return acceptedExtensions.some(function (type) { return file.type === type; });
815
+ }
816
+ var fileExtension = ".".concat((_a = file.name.split(".").pop()) === null || _a === void 0 ? void 0 : _a.toLowerCase());
817
+ return acceptedExtensions.some(function (ext) { return ext === fileExtension || ext === "*"; });
818
+ });
819
+ if (validFiles.length === 0) {
820
+ var formattedTypes = acceptedExtensions
821
+ .map(formatFileType)
822
+ .join(", ");
823
+ onError === null || onError === void 0 ? void 0 : onError(t.invalidFileTypeError.replace("{acceptedTypes}", formattedTypes));
824
+ return [];
825
+ }
826
+ return validFiles;
827
+ }, [multiple, maxFiles, maxFileSize, acceptedFiles, t, onError]);
828
+ var handleFileUpload = useCallback(function (files) {
829
+ var validFiles = validateFiles(files);
830
+ if (validFiles.length > 0) {
831
+ var file_1 = validFiles[0];
832
+ // Si es imagen y hay configuración de crop, abrir modal
833
+ if (file_1.type.startsWith("image/") && cropConfig) {
834
+ var reader_1 = new FileReader();
835
+ reader_1.onload = function () {
836
+ setSelectedImageUrl(reader_1.result);
837
+ setOriginalFile(file_1);
838
+ setShowCropModal(true);
839
+ };
840
+ reader_1.readAsDataURL(file_1);
841
+ }
842
+ else {
843
+ // Procesar directamente si no necesita crop
844
+ uploadImageRef.current = file_1;
845
+ onUpload(validFiles);
846
+ }
847
+ }
848
+ }, [onUpload, validateFiles, cropConfig]);
849
+ // Manejar guardado de imagen recortada
850
+ var handleCropSave = useCallback(function (croppedFile) {
851
+ uploadImageRef.current = croppedFile;
852
+ setShowCropModal(false);
853
+ setSelectedImageUrl("");
854
+ setOriginalFile(null);
855
+ onUpload([croppedFile]);
856
+ }, [onUpload]);
857
+ // Manejar cancelación de crop
858
+ var handleCropCancel = useCallback(function () {
859
+ setShowCropModal(false);
860
+ setSelectedImageUrl("");
861
+ setOriginalFile(null);
862
+ }, []);
863
+ var handleChange = function (event) {
864
+ var files = event.target.files;
865
+ if (files && files.length > 0) {
866
+ handleFileUpload(files);
867
+ }
868
+ // Limpiar el input
869
+ if (inputRef.current) {
870
+ inputRef.current.value = "";
871
+ }
872
+ };
873
+ var handleDragEnter = useCallback(function (e) {
874
+ e.preventDefault();
875
+ e.stopPropagation();
876
+ if (!disabled) {
877
+ setIsDragging(true);
878
+ }
879
+ }, [disabled]);
880
+ var handleDragLeave = useCallback(function (e) {
881
+ e.preventDefault();
882
+ e.stopPropagation();
883
+ setIsDragging(false);
884
+ }, []);
885
+ var handleDragOver = useCallback(function (e) {
886
+ e.preventDefault();
887
+ e.stopPropagation();
888
+ }, []);
889
+ var handleDrop = useCallback(function (e) {
890
+ e.preventDefault();
891
+ e.stopPropagation();
892
+ setIsDragging(false);
893
+ if (disabled) {
894
+ return;
895
+ }
896
+ var droppedFiles = e.dataTransfer.files;
897
+ if (droppedFiles.length > 0) {
898
+ handleFileUpload(droppedFiles);
899
+ }
900
+ }, [disabled, handleFileUpload]);
901
+ var handleRemoveImage = function () {
902
+ uploadImageRef.current = null;
903
+ onUpload([]);
904
+ };
905
+ // Clases CSS dinámicas usando Tailwind
906
+ var containerClasses = "\n\t\trelative w-full border-2 border-dashed rounded-2xl p-2 sm:p-4 lg:p-4 transition-all duration-300\n\t\t".concat(width !== "100%" ? "w-[".concat(width, "]") : "w-full", "\n\t\t").concat(height !== "auto" ? "h-[".concat(height, "]") : "min-h-[150px] sm:min-h-[180px] lg:min-h-[200px]", "\n\t\t").concat(isDragging
907
+ ? "border-blue-500 bg-blue-50 dark:bg-blue-950"
908
+ : error
909
+ ? "border-red-500 bg-red-50 dark:bg-red-950"
910
+ : success
911
+ ? "border-green-500 bg-green-50 dark:bg-green-950"
912
+ : disabled
913
+ ? "border-gray-300 bg-gray-100 dark:bg-gray-800"
914
+ : "border-gray-300 hover:border-gray-400 bg-gray-50 dark:bg-gray-900", "\n\t\t").concat(!(disabled || uploadImageRef.current) ? "cursor-pointer" : "cursor-default", "\n\t\t").concat(className, "\n\t")
915
+ .trim()
916
+ .replace(/\s+/g, " ");
917
+ var textClasses = "\n\t\ttext-center mb-1 sm:mb-2 text-sm sm:text-base lg:text-lg font-medium\n\t\t".concat(disabled ? "text-gray-400" : textColor || "text-gray-700 dark:text-gray-200", "\n\t");
918
+ var subTextClasses = "\n\t\ttext-xs sm:text-sm text-center\n\t\t".concat(disabled ? "text-gray-400" : "text-gray-500 dark:text-gray-400", "\n\t");
919
+ 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", 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
920
+ ? "opacity-0"
921
+ : "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: "space-y-1 sm:space-y-2 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)
922
+ ? acceptedFiles.join(",")
923
+ : 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 }))] }));
924
+ };
925
+ UploadFile.displayName = "UploadFile";
926
+
927
+ var ConfigMenu = function (_a) {
928
+ var _b;
929
+ var options = _a.options, onLogout = _a.onLogout, translations = _a.translations;
930
+ 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-50 data-[hover=true]:text-default-700", classNames: {
931
+ base: "text-default-500",
932
+ }, 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-50 data-[hover=true]:text-default-700", classNames: {
933
+ base: "text-default-500",
934
+ }, 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") })] })] }));
935
+ };
936
+ ConfigMenu.displayName = "ConfigMenu";
937
+
938
+ var NotificationButton = function (_a) {
939
+ var _b = _a.notificationCount, notificationCount = _b === void 0 ? 0 : _b;
940
+ 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 })) }));
941
+ };
942
+ NotificationButton.displayName = "NotificationButton";
943
+
944
+ var HeaderComponent = function (_a) {
945
+ var notificationCount = _a.notificationCount, options = _a.options, onMenuClick = _a.onMenuClick, onLogout = _a.onLogout, translations = _a.translations;
946
+ 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 })] })] }));
947
+ };
948
+ HeaderComponent.displayName = "Header";
949
+
950
+ /**
951
+ * Botón genérico basado en HeroUI siguiendo las reglas de diseño BeweOS.
952
+ *
953
+ * Reglas aplicadas:
954
+ * - Variant: Solid, Bordered, Light, Flat, Faded
955
+ * - Size: sm, md, lg
956
+ * - StartContent: On, Off
957
+ * - isLoading: On, Off
958
+ * - Radius: md (por defecto)
959
+ * - isIconOnly: True, False
960
+ */
961
+ var Button = function (_a) {
962
+ var _b = _a.color, color = _b === void 0 ? "primary" : _b, _c = _a.size, size = _c === void 0 ? "md" : _c, _d = _a.variant, variant = _d === void 0 ? "solid" : _d, _e = _a.radius, radius = _e === void 0 ? "sm" : _e, startContent = _a.startContent, endContent = _a.endContent, _f = _a.isLoading, isLoading = _f === void 0 ? false : _f, _g = _a.isIconOnly, isIconOnly = _g === void 0 ? false : _g, props = __rest(_a, ["color", "size", "variant", "radius", "startContent", "endContent", "isLoading", "isIconOnly"]);
963
+ return (jsx(Button$1, __assign({}, props, { color: color, size: size, variant: variant, radius: radius, startContent: startContent, endContent: endContent, isLoading: isLoading, isIconOnly: isIconOnly })));
964
+ };
965
+
966
+ var paddingClasses = {
967
+ sm: "p-4",
968
+ md: "p-6",
969
+ lg: "p-8",
970
+ };
971
+
972
+ /**
973
+ * Card genérica siguiendo las reglas de diseño BeweOS basada en HeroUI.
974
+ *
975
+ * Reglas aplicadas:
976
+ * - Shadow: none, sm, md, lg (configurable)
977
+ * - Radius: sm (por defecto, configurable)
978
+ * - Padding configurable (sm, md, lg)
979
+ * - Hereda de HeroUI Card con personalización BeweOS
980
+ */
981
+ var Card = function (_a) {
982
+ var children = _a.children, _b = _a.className, className = _b === void 0 ? "" : _b, _c = _a.shadow, shadow = _c === void 0 ? "sm" : _c, _d = _a.radius, radius = _d === void 0 ? "sm" : _d, _e = _a.padding, padding = _e === void 0 ? "md" : _e, props = __rest(_a, ["children", "className", "shadow", "radius", "padding"]);
983
+ var paddingClass = paddingClasses[padding];
984
+ var combinedClassName = [paddingClass, className].filter(Boolean).join(" ");
985
+ return (jsx(Card$1, __assign({ shadow: shadow, radius: radius, className: combinedClassName }, props, { children: children })));
986
+ };
987
+
988
+ /**
989
+ * Input genérico reutilizable basado en HeroUI siguiendo las reglas de diseño BeweOS.
990
+ *
991
+ * Reglas aplicadas:
992
+ * - Variant: Bordered (por defecto)
993
+ * - labelPlacement: Outside
994
+ * - Size: sm, md, lg (configurable)
995
+ * - Radius configurable
996
+ */
997
+ var Input = function (_a) {
998
+ 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"]);
999
+ var generatedId = useId();
1000
+ var inputId = id || generatedId;
1001
+ return (jsx(Input$1, __assign({}, props, { id: inputId, label: label, labelPlacement: "outside", placeholder: placeholder, variant: variant, size: size, radius: radius, classNames: {
1002
+ label: "text-default-600 text-tiny",
1003
+ inputWrapper: "focus-within:!border-primary-500",
1004
+ } })));
1005
+ };
1006
+
1007
+ /**
1008
+ * Select genérico reutilizable basado en HeroUI siguiendo las reglas de diseño BeweOS.
1009
+ *
1010
+ * Reglas aplicadas:
1011
+ * - Variant: Bordered (por defecto)
1012
+ * - Radius: md (por defecto)
1013
+ * - labelPlacement: Outside
1014
+ * - Size: sm, md, lg (configurable)
1015
+ */
1016
+ var Select = function (_a) {
1017
+ 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"]);
1018
+ var generatedId = useId();
1019
+ var selectId = id || generatedId;
1020
+ 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: {
1021
+ label: "text-default-600 text-tiny group-data-[filled=true]:text-default-600",
1022
+ trigger: "data-[open=true]:!border-primary-500 data-[focus=true]:!border-primary-500",
1023
+ 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",
1024
+ } })) }));
378
1025
  };
379
1026
 
380
1027
  var themeColors = {
@@ -575,4 +1222,4 @@ var ThemeProvider = function (_a) {
575
1222
  return (jsx(ThemeContext.Provider, { value: { theme: theme, setTheme: setTheme }, children: jsx("main", { className: "".concat(theme, " bg-background text-foreground "), children: children }) }));
576
1223
  };
577
1224
 
578
- export { ButtonPrueba, IconComponent, MenuComponent, Phone, ThemeContext, ThemeProvider, sizeMap, themeColors, useThemeContext };
1225
+ export { AutoComplete, Button, Card, HeaderComponent, IconComponent, Input, MenuComponent, Phone, Select, ThemeContext, ThemePicker, ThemeProvider, UploadFile, sizeMap, themeColors, useThemeContext };