@beweco/aurora-ui 0.0.6 โ†’ 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,73 @@
1
+ .container__menu {
2
+ @apply relative
3
+ flex
4
+ h-screen
5
+ bg-transparent
6
+ transition-all
7
+ duration-300;
8
+ }
9
+ .container__menu--expanded {
10
+ @apply max-w-72
11
+ flex-1
12
+ flex-col
13
+ xs:p-0
14
+ sm:px-4
15
+ sm:py-6
16
+ xs:rounded-r-xl
17
+ xs:bg-default-100
18
+ sm:bg-transparent
19
+ xs:fixed
20
+ xs:left-0
21
+ xs:top-0
22
+ xs:z-50
23
+ xs:w-full
24
+ xs:h-full;
25
+ }
26
+ .container__menu--collapsed {
27
+ @apply max-w-24
28
+ flex-1
29
+ flex-col
30
+ p-4;
31
+ }
32
+ .container__menu--collapsed .content__menu {
33
+ @apply px-2 py-6;
34
+ }
35
+ .container__menu--collapsed .content__menu--header {
36
+ @apply flex-col gap-4;
37
+ }
38
+ .container__menu--collapsed .content__menu--user {
39
+ @apply justify-center py-0;
40
+ }
41
+ .container__menu--collapsed .collapsible-item {
42
+ opacity: 0;
43
+ max-width: 0;
44
+ }
45
+
46
+ .content__menu {
47
+ @apply w-full
48
+ h-full
49
+ rounded-2xl
50
+ p-6
51
+ bg-default-100
52
+ flex
53
+ flex-col;
54
+ }
55
+ .content__menu--header {
56
+ @apply flex
57
+ items-center
58
+ gap-2
59
+ justify-between;
60
+ }
61
+ .content__menu--user {
62
+ @apply flex
63
+ items-center
64
+ py-3;
65
+ }
66
+
67
+ .collapsible-item {
68
+ transition: all 300ms ease-in-out;
69
+ opacity: 1;
70
+ max-width: 1000px;
71
+ overflow: hidden;
72
+ white-space: nowrap;
73
+ }
package/dist/index.cjs.js CHANGED
@@ -1,9 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
- var react$1 = require('@heroui/react');
5
- var react = require('react');
6
- var react$2 = require('@iconify/react');
4
+ var react = require('@heroui/react');
5
+ var React = require('react');
6
+ var react$1 = require('@iconify/react');
7
+ var useTheme = require('@heroui/use-theme');
7
8
 
8
9
  /******************************************************************************
9
10
  Copyright (c) Microsoft Corporation.
@@ -56,10 +57,10 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
56
57
  */
57
58
  var ButtonPrueba = function (_a) {
58
59
  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"]);
59
- react.useEffect(function () {
60
+ React.useEffect(function () {
60
61
  // console.log("estamos dentro del botnon");
61
62
  }, []);
62
- return (jsxRuntime.jsx(react$1.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 })));
63
+ return (jsxRuntime.jsx(react.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 })));
63
64
  };
64
65
 
65
66
  var sizeMap = {
@@ -72,16 +73,299 @@ var IconComponent = function (_a) {
72
73
  var _b;
73
74
  var icon = _a.icon, _c = _a.size, size = _c === void 0 ? "md" : _c, className = _a.className, style = _a.style, color = _a.color, hFlip = _a.hFlip, vFlip = _a.vFlip, flip = _a.flip, rotate = _a.rotate, nativeProps = __rest(_a, ["icon", "size", "className", "style", "color", "hFlip", "vFlip", "flip", "rotate"]);
74
75
  var iconSize = (_b = sizeMap[size]) !== null && _b !== void 0 ? _b : sizeMap.md;
75
- return (jsxRuntime.jsx("span", __assign({}, nativeProps, { children: jsxRuntime.jsx(react$2.Icon, { icon: icon, width: iconSize, height: iconSize, className: className, style: style, color: color, hFlip: hFlip, vFlip: vFlip, flip: flip, rotate: rotate }) })));
76
+ return (jsxRuntime.jsx("span", __assign({}, nativeProps, { children: jsxRuntime.jsx(react$1.Icon, { icon: icon, width: iconSize, height: iconSize, className: className, style: style, color: color, hFlip: hFlip, vFlip: vFlip, flip: flip, rotate: rotate }) })));
76
77
  };
77
78
 
78
- var MenuPrueba = function (_a) {
79
- var logo = _a.logo, company = _a.company, user = _a.user, items = _a.items, _b = _a.collapsed, collapsed = _b === void 0 ? false : _b, onCollapse = _a.onCollapse;
80
- return (jsxRuntime.jsxs("aside", { className: "h-screen flex flex-col bg-transparent border-r border-gray-800 transition-all duration-300", style: { minWidth: collapsed ? 80 : 256, maxWidth: collapsed ? 80 : 256 }, children: [jsxRuntime.jsxs("div", { className: "flex items-center gap-3 px-6 py-5 border-b border-gray-800", children: [jsxRuntime.jsx("img", { src: logo, alt: company, className: "rounded-full bg-white", style: { width: 40, height: 40 } }), !collapsed && (jsxRuntime.jsx("span", { className: "font-bold uppercase text-base tracking-widest text-white", children: company })), jsxRuntime.jsx("button", { type: "button", className: "ml-auto text-white opacity-60 hover:opacity-100 bg-transparent", onClick: onCollapse, "aria-label": collapsed ? "Expand sidebar" : "Collapse sidebar", children: collapsed ? "ยป" : "ยซ" })] }), jsxRuntime.jsxs("div", { className: "flex items-center gap-3 px-6 py-4 border-b border-gray-800", children: [jsxRuntime.jsx("img", { src: user.avatar, alt: user.name, className: "rounded-full", style: { width: 36, height: 36 } }), !collapsed && (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("div", { className: "font-semibold text-white text-sm", children: user.name }), jsxRuntime.jsx("div", { className: "text-xs text-gray-400", children: user.email })] }))] }), jsxRuntime.jsx("nav", { className: "flex-1 mt-4", children: jsxRuntime.jsx("ul", { className: "flex flex-col gap-1", children: items.map(function (item, _idx) { return (jsxRuntime.jsx("li", { className: "list-none", children: jsxRuntime.jsxs("button", { type: "button", className: "flex items-center w-full gap-3 px-6 py-3 cursor-pointer transition-colors bg-transparent ".concat(item.selected
81
- ? "bg-gray-800 text-white font-semibold"
82
- : "hover:bg-gray-800 text-gray-300"), onClick: item.onClick, children: [jsxRuntime.jsx("span", { className: "text-lg", children: item.icon }), !collapsed && jsxRuntime.jsx("span", { className: "text-base", children: item.label })] }) }, item.label)); }) }) }), jsxRuntime.jsx("div", { className: "px-6 py-4 text-xs text-gray-500 border-t border-gray-800", children: !collapsed && "ยฉ BeweOS" })] }));
79
+ function normalizeClass(value) {
80
+ if (typeof value === "string") {
81
+ return value || undefined;
82
+ }
83
+ if (Array.isArray(value)) {
84
+ return value.filter(Boolean).join(" ") || undefined;
85
+ }
86
+ return undefined;
87
+ }
88
+ var getSectionClasses = function (isCollapsed, sectionClassesProp) {
89
+ if (sectionClassesProp === void 0) { sectionClassesProp = {}; }
90
+ return (__assign(__assign({}, Object.fromEntries(Object.entries(sectionClassesProp).map(function (_a) {
91
+ var k = _a[0], v = _a[1];
92
+ return [k, normalizeClass(v)];
93
+ }))), { base: normalizeClass(react.cn(sectionClassesProp === null || sectionClassesProp === void 0 ? void 0 : sectionClassesProp.base, "w-full", {
94
+ "p-0 max-w-[44px]": isCollapsed,
95
+ })), group: normalizeClass(react.cn(sectionClassesProp === null || sectionClassesProp === void 0 ? void 0 : sectionClassesProp.group, {
96
+ "flex flex-col gap-1": isCollapsed,
97
+ })), heading: normalizeClass(react.cn(sectionClassesProp === null || sectionClassesProp === void 0 ? void 0 : sectionClassesProp.heading, {
98
+ hidden: isCollapsed,
99
+ })) }));
100
+ };
101
+ var getItemClasses = function (isCollapsed, itemClassesProp) {
102
+ if (itemClassesProp === void 0) { itemClassesProp = {}; }
103
+ return (__assign(__assign({}, Object.fromEntries(Object.entries(itemClassesProp).map(function (_a) {
104
+ var k = _a[0], v = _a[1];
105
+ return [k, normalizeClass(v)];
106
+ }))), { base: normalizeClass(react.cn(itemClassesProp === null || itemClassesProp === void 0 ? void 0 : itemClassesProp.base, {
107
+ "w-11 h-11 gap-0 p-0": isCollapsed,
108
+ })) }));
109
+ };
110
+
111
+ var EnumMenuNavListItem;
112
+ (function (EnumMenuNavListItem) {
113
+ EnumMenuNavListItem["Nest"] = "nest";
114
+ })(EnumMenuNavListItem || (EnumMenuNavListItem = {}));
115
+
116
+ /**
117
+ * @component MenuNavList
118
+ * @description A versatile navigation list component that can be displayed in an expanded or collapsed state.
119
+ * It supports nested items, sections, and tooltips for items in the collapsed state.
120
+ *
121
+ * @param {MenuNavListProps} props - Props for configuring the component.
122
+ * @param {MenuNavListItem[]} props.items - Array of items to display in the list.
123
+ * @param {boolean} [props.isCollapsed] - If `true`, the menu is displayed in its collapsed state (icons only).
124
+ * @param {React.Key} [props.defaultSelectedKey] - The key of the default selected item.
125
+ * @param {(key: React.Key) => void} [props.onSelect] - Callback executed when an item is selected.
126
+ * @param {boolean} [props.hideEndContent] - If `true`, hides the end content of the items.
127
+ * @param {object} [props.sectionClasses] - CSS classes to customize the sections.
128
+ * @param {object} [props.itemClasses] - CSS classes to customize the items.
129
+ * @param {string} [props.iconClassName] - CSS class for the icons.
130
+ * @param {object} [props.classNames] - CSS classes to customize the Listbox component.
131
+ * @param {string} [props.className] - CSS class for the main container.
132
+ *
133
+ * @forwardRef
134
+ */
135
+ var MenuNavList = React.forwardRef(function (_a, ref) {
136
+ 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"]);
137
+ var _d = React.useState(defaultSelectedKey), selected = _d[0], setSelected = _d[1];
138
+ // Component styles
139
+ var sectionClasses = getSectionClasses(isCollapsed, sectionClassesProp);
140
+ var itemClasses = getItemClasses(isCollapsed, itemClassesProp);
141
+ // Handles the click event on an item, updating the selection state.
142
+ // biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
143
+ var handleItemPress = React.useCallback(function (item, parentKey) {
144
+ var keySelected = typeof parentKey === "string" ? parentKey : item.key;
145
+ setSelected(keySelected);
146
+ // Force blur to remove hover state after click.
147
+ if (document.activeElement instanceof HTMLElement) {
148
+ document.activeElement.blur();
149
+ }
150
+ }, [setSelected]);
151
+ // Renders the item displayed inside the Popover when the menu is collapsed.
152
+ var renderCompactItem = React.useCallback(function (item, parentKey) {
153
+ var _a, _b;
154
+ return (React.createElement(react.ListboxItem, __assign({}, item, { key: item.key, endContent: (_a = item.endContent) !== null && _a !== void 0 ? _a : null, startContent: item.icon ? (jsxRuntime.jsx(IconComponent, { className: react.cn("text-default-500", "group-data-[selected=true]:text-default-600", iconClassName), icon: item.icon, size: "lg" })) : (((_b = item.startContent) !== null && _b !== void 0 ? _b : null)), textValue: item.title, title: item.title, className: "data-[hover=true]:text-default-600", onPress: function () { return handleItemPress(item, parentKey); } })));
155
+ }, [handleItemPress, iconClassName]);
156
+ // Renders a nested item, i.e., an item that has sub-items.
157
+ // biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
158
+ var renderNestItem = React.useCallback(function (item) {
159
+ var _a, _b, _c, _d, _e, _f, _g;
160
+ var isNestType = item.items &&
161
+ ((_a = item.items) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
162
+ (item === null || item === void 0 ? void 0 : item.type) === EnumMenuNavListItem.Nest;
163
+ if (isNestType) {
164
+ item.href = undefined;
165
+ }
166
+ return (React.createElement(react.ListboxItem, __assign({}, item, { key: item.key, classNames: {
167
+ base: react.cn({
168
+ "h-auto p-0": !isCollapsed && isNestType,
169
+ }, {
170
+ "inline-block w-11": isCollapsed && isNestType,
171
+ }, {
172
+ "data-[selected=true]:bg-primary-100 h-11 justify-center items-center flex": isCollapsed && isNestType,
173
+ }, "rounded-large"),
174
+ }, endContent: isCollapsed || isNestType || hideEndContent
175
+ ? null
176
+ : ((_b = item.endContent) !== null && _b !== void 0 ? _b : null), startContent: isCollapsed || isNestType ? null : item.icon ? (jsxRuntime.jsx(IconComponent, { className: react.cn("text-default-500 group-data-[selected=true]:text-foreground", iconClassName), icon: item.icon, size: "lg" })) : (((_c = item.startContent) !== null && _c !== void 0 ? _c : null)), title: isCollapsed || isNestType ? null : item.title }),
177
+ isCollapsed && isNestType ? (jsxRuntime.jsxs(react.Popover, { placement: "right", offset: 10, children: [jsxRuntime.jsx(react.PopoverTrigger, { children: jsxRuntime.jsx("div", { className: "flex w-full items-center justify-center", children: jsxRuntime.jsx(react.Tooltip, { content: item.title, placement: "right", classNames: {
178
+ base: "text-default-500",
179
+ }, children: jsxRuntime.jsx("div", { className: "flex w-full items-center justify-center", children: item.icon ? (jsxRuntime.jsx(IconComponent, { className: react.cn("text-default-500 group-data-[selected=true]:text-default-600", iconClassName), icon: item.icon, size: "lg" })) : (((_d = item.startContent) !== null && _d !== void 0 ? _d : null)) }) }) }) }), jsxRuntime.jsx(react.PopoverContent, { className: "p-0", children: jsxRuntime.jsxs("div", { className: "min-w-[200px] rounded-large p-2", children: [jsxRuntime.jsx("div", { className: "p-2 text-small font-semibold text-default-500", children: item.title }), jsxRuntime.jsx(react.Listbox, { className: "mt-0.5 text-default-500", "aria-label": "Nested menu items", items: item.items, variant: "flat", children: item.items && ((_e = item.items) === null || _e === void 0 ? void 0 : _e.length) > 0
180
+ ? item.items.map(function (child) {
181
+ return renderCompactItem(child, item.key);
182
+ })
183
+ : renderCompactItem(item) })] }) })] })) : null,
184
+ !isCollapsed && isNestType ? (jsxRuntime.jsx(react.Accordion, { className: "p-0", children: jsxRuntime.jsx(react.AccordionItem, { "aria-label": item.title, classNames: {
185
+ heading: "pr-3 group-data-[selected=true]:bg-primary-100 rounded-large",
186
+ trigger: "p-0",
187
+ content: "py-0 pl-4",
188
+ }, title: item.icon ? (jsxRuntime.jsxs("div", { className: "flex h-11 items-center gap-2 px-3 py-1.5", children: [jsxRuntime.jsx(IconComponent, { className: react.cn("text-default-500 group-data-[selected=true]:text-default-600", iconClassName), icon: item.icon, size: "lg" }), jsxRuntime.jsx("span", { className: "text-small font-medium text-default-500 group-data-[selected=true]:text-default-600", children: item.title })] })) : (((_f = item.startContent) !== null && _f !== void 0 ? _f : null)), children: item.items && ((_g = item.items) === null || _g === void 0 ? void 0 : _g.length) > 0 ? (jsxRuntime.jsx(react.Listbox, { className: "mt-0.5 text-default-500", classNames: {
189
+ list: react.cn("border-l border-default-200 pl-4"),
190
+ }, items: item.items, variant: "flat", children: item.items.map(function (child) { return renderItem(child, item.key); }) })) : (renderItem(item)) }, item.key) })) : null));
191
+ }, [isCollapsed, hideEndContent, iconClassName, items, selected]);
192
+ // Renders a simple item (without children) in the navigation list.
193
+ // biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
194
+ var renderItem = React.useCallback(function (item, parentKey) {
195
+ var _a, _b, _c, _d;
196
+ var isNestType = item.items &&
197
+ ((_a = item.items) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
198
+ (item === null || item === void 0 ? void 0 : item.type) === EnumMenuNavListItem.Nest;
199
+ if (isNestType) {
200
+ return renderNestItem(item);
201
+ }
202
+ var isItemSelected = selected === item.key;
203
+ return (React.createElement(react.ListboxItem, __assign({}, item, { key: item.key, endContent: isCollapsed || hideEndContent ? null : ((_b = item.endContent) !== null && _b !== void 0 ? _b : null), startContent: isCollapsed ? null : item.icon ? (jsxRuntime.jsx(IconComponent, { className: react.cn("text-default-500", "group-data-[selected=true]:text-default-600", iconClassName), icon: item.icon, size: "lg" })) : (((_c = item.startContent) !== null && _c !== void 0 ? _c : null)), textValue: item.title, title: isCollapsed ? null : item.title, onPress: function () { return handleItemPress(item, parentKey); }, "aria-selected": isItemSelected, "aria-label": item.title || "Menu item ".concat(item.key) }), isCollapsed ? (jsxRuntime.jsx(react.Tooltip, { content: item.title, placement: "right", closeDelay: 200, shouldCloseOnBlur: false, classNames: {
204
+ base: "text-default-500",
205
+ }, children: jsxRuntime.jsx("div", { className: "flex w-full items-center justify-center", "aria-hidden": "true", children: item.icon ? (jsxRuntime.jsx(IconComponent, { className: react.cn("text-default-500", "group-data-[selected=true]:text-default-600", iconClassName), icon: item.icon, size: "lg" })) : (((_d = item.startContent) !== null && _d !== void 0 ? _d : null)) }) })) : null));
206
+ },
207
+ // eslint-disable-next-line react-hooks/exhaustive-deps
208
+ [isCollapsed, hideEndContent, iconClassName, itemClasses === null || itemClasses === void 0 ? void 0 : itemClasses.base]);
209
+ return (jsxRuntime.jsx(react.Listbox, __assign({ ref: ref, hideSelectedIcon: true, as: "nav", className: react.cn("list-none", className), classNames: __assign(__assign({}, classNames), { list: react.cn("items-center", classNames === null || classNames === void 0 ? void 0 : classNames.list) }), color: "default", itemClasses: __assign(__assign({}, itemClasses), { base: react.cn("px-3 min-h-11 rounded-large h-[44px] data-[selected=true]:bg-primary-100", itemClasses === null || itemClasses === void 0 ? void 0 : itemClasses.base), title: react.cn("text-small font-medium text-default-500 group-data-[selected=true]:text-default-600 ", itemClasses === null || itemClasses === void 0 ? void 0 : itemClasses.title) }), items: items, selectedKeys: [selected], selectionMode: "single", variant: "flat" }, props, { children: function (item) {
210
+ var _a, _b;
211
+ return item.items &&
212
+ ((_a = item.items) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
213
+ (item === null || item === void 0 ? void 0 : item.type) === EnumMenuNavListItem.Nest ? (renderNestItem(item)) : item.items && ((_b = item.items) === null || _b === void 0 ? void 0 : _b.length) > 0 ? (jsxRuntime.jsx(react.ListboxSection, { classNames: sectionClasses, showDivider: isCollapsed, title: item.title, children: item.items.map(renderItem) }, item.key)) : (renderItem(item));
214
+ } }), isCollapsed ? "compact" : "default"));
215
+ });
216
+ MenuNavList.displayName = "MenuNavList";
217
+
218
+ /**
219
+ * Sidebar menu component for navigation and user actions.
220
+ * @param commerceInfo - Object with logo and name of the company.
221
+ * @param userInfo - Object with user avatar, name, and email.
222
+ * @param helpButton - Help button configuration.
223
+ * @param upgradeCard - Optional upgrade card configuration.
224
+ * @param isOpenSidebar - Controls sidebar visibility.
225
+ * @param onOpenSidebarChange - Callback to open/close sidebar.
226
+ */
227
+ var MenuComponent = React.memo(function Menu(_a) {
228
+ var commerceInfo = _a.commerceInfo, userInfo = _a.userInfo, helpButton = _a.helpButton, upgradeCard = _a.upgradeCard, isOpenSidebar = _a.isOpenSidebar, onOpenSidebarChange = _a.onOpenSidebarChange, menuItems = _a.menuItems;
229
+ // State to control menu collapse on desktop devices
230
+ var _b = React.useState(false), isCollapsed = _b[0], setIsCollapsed = _b[1];
231
+ // Memoized handlers for performance
232
+ var handleSidebarClose = React.useCallback(function () {
233
+ onOpenSidebarChange === null || onOpenSidebarChange === void 0 ? void 0 : onOpenSidebarChange(false);
234
+ }, [onOpenSidebarChange]);
235
+ var handleCollapseToggle = React.useCallback(function () {
236
+ setIsCollapsed(function (prev) { return !prev; });
237
+ }, []);
238
+ var handleUpgradeClick = React.useCallback(function () {
239
+ if (upgradeCard) {
240
+ window.open(upgradeCard.buttonLink, "_blank");
241
+ }
242
+ }, [upgradeCard]);
243
+ var handleHelpClick = React.useCallback(function () {
244
+ window.open(helpButton.redirect, "_blank");
245
+ }, [helpButton]);
246
+ if (!isOpenSidebar) {
247
+ return null;
248
+ }
249
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("button", { type: "button", "aria-label": "Close sidebar", className: "fixed inset-0 bg-black bg-opacity-40 z-40 xs:block sm:hidden", onClick: handleSidebarClose, style: { border: "none", padding: 0, margin: 0 } }), jsxRuntime.jsx("div", { className: "container__menu ".concat(isCollapsed
250
+ ? "container__menu--collapsed"
251
+ : "container__menu--expanded"), children: jsxRuntime.jsxs("div", { className: "content__menu", children: [jsxRuntime.jsxs("div", { className: "content__menu--header", style: { flexDirection: isCollapsed ? "column-reverse" : "row" }, children: [jsxRuntime.jsxs("div", { className: "flex flex-row items-center justify-center ".concat(isCollapsed ? "gap-0" : "gap-2"), children: [jsxRuntime.jsx("div", { className: "flex h-8 w-8 items-center justify-center rounded-full bg-foreground", children: jsxRuntime.jsx("img", { src: commerceInfo.logo, alt: "Logo of ".concat(commerceInfo.name) }) }), jsxRuntime.jsx("span", { className: "collapsible-item text-small font-bold uppercase", children: commerceInfo.name })] }), jsxRuntime.jsxs("div", { className: "flex items-center", children: [jsxRuntime.jsx(IconComponent, { icon: "material-symbols-light:close", size: "lg", className: "cursor-pointer block sm:hidden", onClick: handleSidebarClose }), jsxRuntime.jsx(IconComponent, { icon: isCollapsed
252
+ ? "solar:alt-arrow-right-outline"
253
+ : "solar:alt-arrow-left-outline", size: "lg", className: "hidden sm:block cursor-pointer", onClick: handleCollapseToggle })] })] }), jsxRuntime.jsx(react.Spacer, { y: 6 }), jsxRuntime.jsxs("div", { className: "content__menu--user ".concat(isCollapsed ? "gap-0" : "gap-3"), children: [jsxRuntime.jsx(react.Avatar, { size: "md", src: userInfo.avatar, color: userInfo.avatar === "" ? "warning" : "default", name: userInfo.name }), jsxRuntime.jsxs("div", { className: "collapsible-item flex flex-col", children: [jsxRuntime.jsx("p", { className: "text-small font-medium text-default-900", children: userInfo.name }), jsxRuntime.jsx("p", { className: "text-tiny text-default-400", children: userInfo.role })] })] }), jsxRuntime.jsx("div", { className: "".concat(!isCollapsed ? "flex-1" : "h-full", " min-h-0 py-6"), children: jsxRuntime.jsx("div", { className: "h-full overflow-y-auto pr-6 -mr-6 [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]", children: jsxRuntime.jsx(MenuNavList, { defaultSelectedKey: menuItems.selectedKey, items: menuItems.items, isCollapsed: isCollapsed }) }) }), upgradeCard && (jsxRuntime.jsxs("div", { className: "collapsible-item relative", children: [jsxRuntime.jsxs(react.Card, { className: "border-none overflow-visible shadow-none", shadow: "sm", children: [jsxRuntime.jsxs(react.CardBody, { className: "items-center py-5 text-center gap-1", children: [jsxRuntime.jsx("h3", { className: "text-medium font-medium text-default-900", children: upgradeCard.title }), jsxRuntime.jsx("p", { className: "text-small text-default-500 pb-3 whitespace-normal", children: upgradeCard.description })] }), jsxRuntime.jsx(react.CardFooter, { className: "absolute justify-center", style: { bottom: "-30px" }, children: jsxRuntime.jsx(react.Button, { className: "px-10 shadow-md", color: "primary", radius: "full", variant: "shadow", onPress: handleUpgradeClick, children: upgradeCard.buttonText }) })] }), jsxRuntime.jsx(react.Spacer, { y: 9 })] })), jsxRuntime.jsx("div", { className: "mt-auto flex flex-col justify-center items-center", children: jsxRuntime.jsx(react.Button, { fullWidth: true, className: " text-default-600 data-[hover=true]:text-foreground", startContent: jsxRuntime.jsx(IconComponent, { className: "text-default-500", icon: "solar:info-circle-line-duotone", size: "md" }), variant: "light", onPress: handleHelpClick, isIconOnly: isCollapsed, children: !isCollapsed && (jsxRuntime.jsx("span", { className: "collapsible-item", children: helpButton.title })) }) })] }) })] }));
254
+ });
255
+
256
+ // Lista simple de paรญses con bandera emoji y cรณdigo
257
+ var countries = [
258
+ { code: "+57", name: "Colombia", flag: "๐Ÿ‡จ๐Ÿ‡ด" },
259
+ { code: "+54", name: "Argentina", flag: "๐Ÿ‡ฆ๐Ÿ‡ท" },
260
+ { code: "+55", name: "Brazil", flag: "๐Ÿ‡ง๐Ÿ‡ท" },
261
+ { code: "+52", name: "Mexico", flag: "๐Ÿ‡ฒ๐Ÿ‡ฝ" },
262
+ { code: "+503", name: "El Salvador", flag: "๐Ÿ‡ธ๐Ÿ‡ป" },
263
+ { code: "+51", name: "Peru", flag: "๐Ÿ‡ต๐Ÿ‡ช" },
264
+ { code: "+56", name: "Chile", flag: "๐Ÿ‡จ๐Ÿ‡ฑ" },
265
+ { code: "+1", name: "United States", flag: "๐Ÿ‡บ๐Ÿ‡ธ" },
266
+ { code: "+7", name: "Russia", flag: "๐Ÿ‡ท๐Ÿ‡บ" },
267
+ { code: "+20", name: "Egypt", flag: "๐Ÿ‡ช๐Ÿ‡ฌ" },
268
+ { code: "+27", name: "South Africa", flag: "๐Ÿ‡ฟ๐Ÿ‡ฆ" },
269
+ { code: "+33", name: "France", flag: "๐Ÿ‡ซ๐Ÿ‡ท" },
270
+ { code: "+34", name: "Spain", flag: "๐Ÿ‡ช๐Ÿ‡ธ" },
271
+ { code: "+39", name: "Italy", flag: "๐Ÿ‡ฎ๐Ÿ‡น" },
272
+ { code: "+44", name: "United Kingdom", flag: "๐Ÿ‡ฌ๐Ÿ‡ง" },
273
+ { code: "+49", name: "Germany", flag: "๐Ÿ‡ฉ๐Ÿ‡ช" },
274
+ { code: "+51", name: "Peru", flag: "๐Ÿ‡ต๐Ÿ‡ช" },
275
+ { code: "+52", name: "Mexico", flag: "๐Ÿ‡ฒ๐Ÿ‡ฝ" },
276
+ { code: "+54", name: "Argentina", flag: "๐Ÿ‡ฆ๐Ÿ‡ท" },
277
+ { code: "+55", name: "Brazil", flag: "๐Ÿ‡ง๐Ÿ‡ท" },
278
+ { code: "+56", name: "Chile", flag: "๐Ÿ‡จ๐Ÿ‡ฑ" },
279
+ { code: "+57", name: "Colombia", flag: "๐Ÿ‡จ๐Ÿ‡ด" },
280
+ { code: "+60", name: "Malaysia", flag: "๐Ÿ‡ฒ๐Ÿ‡พ" },
281
+ { code: "+61", name: "Australia", flag: "๐Ÿ‡ฆ๐Ÿ‡บ" },
282
+ { code: "+62", name: "Indonesia", flag: "๐Ÿ‡ฎ๐Ÿ‡ฉ" },
283
+ { code: "+64", name: "New Zealand", flag: "๐Ÿ‡ณ๐Ÿ‡ฟ" },
284
+ { code: "+65", name: "Singapore", flag: "๐Ÿ‡ธ๐Ÿ‡ฌ" },
285
+ { code: "+66", name: "Thailand", flag: "๐Ÿ‡น๐Ÿ‡ญ" },
286
+ { code: "+81", name: "Japan", flag: "๐Ÿ‡ฏ๐Ÿ‡ต" },
287
+ { code: "+82", name: "South Korea", flag: "๐Ÿ‡ฐ๐Ÿ‡ท" },
288
+ { code: "+84", name: "Vietnam", flag: "๐Ÿ‡ป๐Ÿ‡ณ" },
289
+ { code: "+86", name: "China", flag: "๐Ÿ‡จ๐Ÿ‡ณ" },
290
+ { code: "+91", name: "India", flag: "๐Ÿ‡ฎ๐Ÿ‡ณ" },
291
+ { code: "+351", name: "Portugal", flag: "๐Ÿ‡ต๐Ÿ‡น" },
292
+ { code: "+503", name: "El Salvador", flag: "๐Ÿ‡ธ๐Ÿ‡ป" },
293
+ { code: "+966", name: "Saudi Arabia", flag: "๐Ÿ‡ธ๐Ÿ‡ฆ" },
294
+ { code: "+971", name: "UAE", flag: "๐Ÿ‡ฆ๐Ÿ‡ช" },
295
+ ];
296
+ var uniqueCountries = Array.from(new Map(countries.map(function (item) { return [item.code + item.name, item]; })).values());
297
+ var Phone = function (_a) {
298
+ var _b = _a.label, label = _b === void 0 ? "Telรฉfono" : _b, _c = _a.required, required = _c === void 0 ? false : _c, _d = _a.error, error = _d === void 0 ? false : _d, _e = _a.errorText, errorText = _e === void 0 ? "" : _e, _f = _a.value, value = _f === void 0 ? "" : _f, onChange = _a.onChange, _g = _a.disabled, disabled = _g === void 0 ? false : _g, _h = _a.name, name = _h === void 0 ? "phone" : _h;
299
+ var _j = React.useState(false), isDropdownOpen = _j[0], setIsDropdownOpen = _j[1];
300
+ var _k = React.useState(uniqueCountries[0]), selectedCountry = _k[0], setSelectedCountry = _k[1];
301
+ var _l = React.useState(""), inputValue = _l[0], setInputValue = _l[1];
302
+ var dropdownRef = React.useRef(null);
303
+ var _m = React.useState(uniqueCountries), filteredCountries = _m[0], setFilteredCountries = _m[1];
304
+ // Sincroniza valor externo
305
+ React.useEffect(function () {
306
+ if (value) {
307
+ // Si value incluye el cรณdigo, lo separamos
308
+ var found = uniqueCountries.find(function (c) { return value.startsWith(c.code); });
309
+ if (found) {
310
+ setSelectedCountry(found);
311
+ setInputValue(value.replace(found.code, "").trim());
312
+ }
313
+ else {
314
+ setInputValue(value);
315
+ }
316
+ }
317
+ }, [value]);
318
+ // Open dropdown: reset filteredCountries
319
+ React.useEffect(function () {
320
+ if (isDropdownOpen) {
321
+ setFilteredCountries(uniqueCountries);
322
+ }
323
+ }, [isDropdownOpen]);
324
+ // Cierra dropdown al hacer click fuera
325
+ React.useEffect(function () {
326
+ var handleClickOutside = function (event) {
327
+ if (dropdownRef.current &&
328
+ !dropdownRef.current.contains(event.target)) {
329
+ setIsDropdownOpen(false);
330
+ }
331
+ };
332
+ if (isDropdownOpen) {
333
+ document.addEventListener("mousedown", handleClickOutside);
334
+ }
335
+ return function () {
336
+ document.removeEventListener("mousedown", handleClickOutside);
337
+ };
338
+ }, [isDropdownOpen]);
339
+ var handleCountrySelect = function (country) {
340
+ setSelectedCountry(country);
341
+ setIsDropdownOpen(false);
342
+ if (onChange) {
343
+ onChange(country.code + inputValue);
344
+ }
345
+ };
346
+ var handleInputChange = function (e) {
347
+ // Solo nรบmeros
348
+ var val = e.target.value.replace(/\D/g, "");
349
+ setInputValue(val);
350
+ if (onChange) {
351
+ onChange(selectedCountry.code + val);
352
+ }
353
+ };
354
+ return (jsxRuntime.jsxs("div", { className: "flex flex-col gap-1 w-full relative", children: [label && (jsxRuntime.jsxs("label", { htmlFor: "phone-input-".concat(name), className: "text-sm font-medium text-gray-700 dark:text-gray-200 mb-1", children: [label, " ", required && jsxRuntime.jsx("span", { className: "text-pink-600", children: "*" })] })), jsxRuntime.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
355
+ ? "border-pink-500 dark:border-pink-600"
356
+ : "border-[#E4E4E7] dark:border-gray-700").concat(disabled ? " bg-gray-100 dark:bg-gray-800 opacity-60" : ""), children: [jsxRuntime.jsxs("div", { className: "relative ml-2", ref: dropdownRef, children: [jsxRuntime.jsxs("button", { type: "button",
357
+ ///bg-gray-100
358
+ 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": "Seleccionar pa\u00EDs", children: [jsxRuntime.jsx("span", { className: "text-lg", children: selectedCountry.flag }), jsxRuntime.jsx("span", { className: "text-xs text-gray-700 dark:text-gray-200", children: selectedCountry.code }), jsxRuntime.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": "Desplegar lista de pa\u00EDses", children: [jsxRuntime.jsx("title", { children: "Desplegar lista de pa\u00EDses" }), jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" })] })] }), isDropdownOpen && (jsxRuntime.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: [jsxRuntime.jsx("div", { className: "p-2", children: jsxRuntime.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: "Buscar pa\u00EDs...", onChange: function (e) {
359
+ var searchTerm = e.target.value.toLowerCase();
360
+ var filtered = uniqueCountries.filter(function (country) {
361
+ return country.name.toLowerCase().includes(searchTerm) ||
362
+ country.code.toLowerCase().includes(searchTerm);
363
+ });
364
+ setFilteredCountries(filtered);
365
+ } }) }), jsxRuntime.jsx("div", { className: "max-h-60 overflow-y-auto", children: filteredCountries.length > 0 ? (filteredCountries.map(function (country) { return (jsxRuntime.jsxs("button", { type: "button", className: "flex items-center w-full px-4 py-2.5 text-sm hover:bg-gray-50 dark:hover:bg-gray-800 ".concat(country.code === selectedCountry.code
366
+ ? "bg-blue-50 dark:bg-blue-900"
367
+ : ""), onClick: function () { return handleCountrySelect(country); }, children: [jsxRuntime.jsx("span", { className: "mr-3 text-lg", children: country.flag }), jsxRuntime.jsx("span", { className: "flex-1 text-left dark:text-gray-100", children: country.name }), jsxRuntime.jsx("span", { className: "text-xs text-gray-500 dark:text-gray-400", children: country.code })] }, country.code)); })) : (jsxRuntime.jsx("div", { className: "px-4 py-2 text-sm text-gray-500 dark:text-gray-400", children: "No se encontraron pa\u00EDses" })) })] }))] }), jsxRuntime.jsx(react.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: "N\u00FAmero de tel\u00E9fono", value: inputValue, onChange: handleInputChange, disabled: disabled, name: name, autoComplete: "tel", id: "phone-input-".concat(name) })] }), error && errorText && (jsxRuntime.jsx("span", { className: "text-xs text-pink-600 dark:text-pink-400 mt-1", children: errorText }))] }));
83
368
  };
84
- MenuPrueba.displayName = "MenuPrueba";
85
369
 
86
370
  var themeColors = {
87
371
  "purple-light": {
@@ -262,13 +546,13 @@ var themeColors = {
262
546
  },
263
547
  };
264
548
 
265
- var ThemeContext = react.createContext({
549
+ var ThemeContext = React.createContext({
266
550
  theme: "light",
267
551
  // biome-ignore lint/suspicious/noEmptyBlockStatements: <explanation>
268
552
  setTheme: function () { },
269
553
  });
270
554
  var useThemeContext = function () {
271
- var context = react.useContext(ThemeContext);
555
+ var context = React.useContext(ThemeContext);
272
556
  if (!context) {
273
557
  throw new Error("useThemeContext debe ser usado dentro de un ThemeProvider");
274
558
  }
@@ -277,13 +561,14 @@ var useThemeContext = function () {
277
561
 
278
562
  var ThemeProvider = function (_a) {
279
563
  var children = _a.children;
280
- var _b = useThemeContext(), theme = _b.theme, setTheme = _b.setTheme;
564
+ var _b = useTheme.useTheme(), theme = _b.theme, setTheme = _b.setTheme;
281
565
  return (jsxRuntime.jsx(ThemeContext.Provider, { value: { theme: theme, setTheme: setTheme }, children: jsxRuntime.jsx("main", { className: "".concat(theme, " bg-background text-foreground "), children: children }) }));
282
566
  };
283
567
 
284
568
  exports.ButtonPrueba = ButtonPrueba;
285
569
  exports.IconComponent = IconComponent;
286
- exports.MenuPrueba = MenuPrueba;
570
+ exports.MenuComponent = MenuComponent;
571
+ exports.Phone = Phone;
287
572
  exports.ThemeContext = ThemeContext;
288
573
  exports.ThemeProvider = ThemeProvider;
289
574
  exports.sizeMap = sizeMap;