@beweco/aurora-ui 0.6.67 → 0.6.69-qa.89
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.
- package/dist/assets/css/styles.css +1 -1
- package/dist/index.cjs.js +285 -49
- package/dist/index.esm.js +276 -51
- package/dist/types/components/area-line-chart/AreaLineChart.d.ts +1 -1
- package/dist/types/components/area-line-chart/AreaLineChart.d.ts.map +1 -1
- package/dist/types/components/area-line-chart/AreaLineChart.types.d.ts +8 -0
- package/dist/types/components/area-line-chart/AreaLineChart.types.d.ts.map +1 -1
- package/dist/types/components/donut-chart/DonutChart.d.ts +9 -0
- package/dist/types/components/donut-chart/DonutChart.d.ts.map +1 -0
- package/dist/types/components/donut-chart/DonutChart.types.d.ts +51 -0
- package/dist/types/components/donut-chart/DonutChart.types.d.ts.map +1 -0
- package/dist/types/components/donut-chart/donut-chart.utils.d.ts +15 -0
- package/dist/types/components/donut-chart/donut-chart.utils.d.ts.map +1 -0
- package/dist/types/components/donut-chart/index.d.ts +4 -0
- package/dist/types/components/donut-chart/index.d.ts.map +1 -0
- package/dist/types/components/menu/Menu.d.ts.map +1 -1
- package/dist/types/components/menu/Menu.types.d.ts +7 -0
- package/dist/types/components/menu/Menu.types.d.ts.map +1 -1
- package/dist/types/components/menu/get-user-initials.d.ts +15 -0
- package/dist/types/components/menu/get-user-initials.d.ts.map +1 -0
- package/dist/types/components/menu-claw/MenuClaw.d.ts.map +1 -1
- package/dist/types/components/menu-claw/_internal/menu-claw-nav/MenuClawNavItem.d.ts +17 -0
- package/dist/types/components/menu-claw/_internal/menu-claw-nav/MenuClawNavItem.d.ts.map +1 -0
- package/dist/types/components/menu-claw/_internal/menu-claw-nav/MenuClawNavItem.types.d.ts +18 -0
- package/dist/types/components/menu-claw/_internal/menu-claw-nav/MenuClawNavItem.types.d.ts.map +1 -0
- package/dist/types/components/menu-claw/_internal/menu-claw-nav/index.d.ts +3 -0
- package/dist/types/components/menu-claw/_internal/menu-claw-nav/index.d.ts.map +1 -0
- package/dist/types/components/phone/Phone.d.ts.map +1 -1
- package/dist/types/components/ranked-bar-list/RankedBarList.d.ts +10 -0
- package/dist/types/components/ranked-bar-list/RankedBarList.d.ts.map +1 -0
- package/dist/types/components/ranked-bar-list/RankedBarList.types.d.ts +41 -0
- package/dist/types/components/ranked-bar-list/RankedBarList.types.d.ts.map +1 -0
- package/dist/types/components/ranked-bar-list/index.d.ts +4 -0
- package/dist/types/components/ranked-bar-list/index.d.ts.map +1 -0
- package/dist/types/components/ranked-bar-list/ranked-bar-list.utils.d.ts +16 -0
- package/dist/types/components/ranked-bar-list/ranked-bar-list.utils.d.ts.map +1 -0
- package/dist/types/components/schedule-row/schedule-row.d.ts.map +1 -1
- package/dist/types/components/stat-tile/StatTile.d.ts +10 -0
- package/dist/types/components/stat-tile/StatTile.d.ts.map +1 -0
- package/dist/types/components/stat-tile/StatTile.types.d.ts +40 -0
- package/dist/types/components/stat-tile/StatTile.types.d.ts.map +1 -0
- package/dist/types/components/stat-tile/index.d.ts +3 -0
- package/dist/types/components/stat-tile/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -5,7 +5,7 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
5
5
|
import { Icon } from '@iconify/react';
|
|
6
6
|
export { loadIcons } from '@iconify/react';
|
|
7
7
|
import React, { useId, useState, useCallback, useMemo, forwardRef, useEffect, useImperativeHandle, createContext, useContext, useRef, useLayoutEffect, memo, createElement, Fragment as Fragment$1 } from 'react';
|
|
8
|
-
import { ResponsiveContainer, AreaChart, CartesianGrid, XAxis, Tooltip as Tooltip$1, Area, LineChart, YAxis, Line } from 'recharts';
|
|
8
|
+
import { ResponsiveContainer, AreaChart, CartesianGrid, XAxis, Tooltip as Tooltip$1, Area, LineChart, YAxis, Line, PieChart, Pie, Cell } from 'recharts';
|
|
9
9
|
import { createPortal } from 'react-dom';
|
|
10
10
|
import { motion, AnimatePresence } from 'framer-motion';
|
|
11
11
|
import { useTheme } from '@heroui/use-theme';
|
|
@@ -582,9 +582,9 @@ function ChartTooltip(_a) {
|
|
|
582
582
|
})] }));
|
|
583
583
|
}
|
|
584
584
|
function AreaLineChart(_a) {
|
|
585
|
-
var data = _a.data, xAxisKey = _a.xAxisKey, series = _a.series, title = _a.title, value = _a.value, trend = _a.trend, _b = _a.height, height = _b === void 0 ? 200 : _b, _c = _a.className, className = _c === void 0 ? "" : _c, _d = _a.wrappedInCard, wrappedInCard = _d === void 0 ? false : _d, formatTooltipValue = _a.formatTooltipValue;
|
|
585
|
+
var data = _a.data, xAxisKey = _a.xAxisKey, series = _a.series, title = _a.title, value = _a.value, trend = _a.trend, _b = _a.height, height = _b === void 0 ? 200 : _b, _c = _a.className, className = _c === void 0 ? "" : _c, _d = _a.wrappedInCard, wrappedInCard = _d === void 0 ? false : _d, formatTooltipValue = _a.formatTooltipValue, _e = _a.yAxisDomain, yAxisDomain = _e === void 0 ? [0, "dataMax + 100"] : _e;
|
|
586
586
|
var hasHeader = title != null || value != null || trend != null || series.length > 0;
|
|
587
|
-
var content = (jsxs(Fragment, { children: [hasHeader && (jsxs("div", { className: "flex items-start justify-between mb-6", children: [jsxs("div", { children: [title != null && (jsx(H3, { className: "text-xs font-semibold text-gray-500 uppercase tracking-wide mb-1", children: title })), value != null && (jsxs("div", { className: "flex items-baseline gap-2", children: [jsx("span", { className: "text-2xl font-bold text-gray-900", children: value }), trend != null && (jsx("span", { className: "text-xs font-medium text-yellow-600 bg-yellow-50 px-2 py-1 rounded", children: trend }))] }))] }), series.length > 0 && (jsx("div", { className: "flex items-center gap-4", children: series.map(function (s) { return (jsxs("div", { className: "flex items-center gap-2", children: [jsx("svg", { width: "16", height: "2", viewBox: "0 0 16 2", fill: "none", children: jsx("line", { x1: "0", y1: "1", x2: "16", y2: "1", stroke: s.color, strokeWidth: "2" }) }), jsx("span", { className: "text-xs text-gray-600 font-medium", children: s.label })] }, s.dataKey)); }) }))] })), jsx("div", { className: "w-full", style: { height: "".concat(height, "px") }, children: jsx(ResponsiveContainer, { width: "100%", height: "100%", children: jsxs(LineChart, { data: data, margin: { top: 5, right: 5, left: 5, bottom: 5 }, children: [jsx("defs", { children: series.map(function (s) { return (jsxs("linearGradient", { id: "area-line-chart-".concat(s.dataKey), x1: "0", y1: "0", x2: "0", y2: "1", children: [jsx("stop", { offset: "0%", stopColor: s.color, stopOpacity: 0.3 }), jsx("stop", { offset: "50%", stopColor: s.color, stopOpacity: 0.15 }), jsx("stop", { offset: "100%", stopColor: s.color, stopOpacity: 0 })] }, s.dataKey)); }) }), jsx(XAxis, { dataKey: xAxisKey, axisLine: false, tickLine: false, tick: { fill: "#9ca3af", fontSize: 12 }, dy: 10 }), jsx(YAxis, { axisLine: false, tickLine: false, tick: { fill: "transparent", fontSize: 0 }, width: 0, tickCount: 6, domain:
|
|
587
|
+
var content = (jsxs(Fragment, { children: [hasHeader && (jsxs("div", { className: "flex items-start justify-between mb-6", children: [jsxs("div", { children: [title != null && (jsx(H3, { className: "text-xs font-semibold text-gray-500 uppercase tracking-wide mb-1", children: title })), value != null && (jsxs("div", { className: "flex items-baseline gap-2", children: [jsx("span", { className: "text-2xl font-bold text-gray-900", children: value }), trend != null && (jsx("span", { className: "text-xs font-medium text-yellow-600 bg-yellow-50 px-2 py-1 rounded", children: trend }))] }))] }), series.length > 0 && (jsx("div", { className: "flex flex-wrap items-center gap-4", children: series.map(function (s) { return (jsxs("div", { className: "flex items-center gap-2", children: [jsx("svg", { width: "16", height: "2", viewBox: "0 0 16 2", fill: "none", children: jsx("line", { x1: "0", y1: "1", x2: "16", y2: "1", stroke: s.color, strokeWidth: "2" }) }), jsx("span", { className: "text-xs text-gray-600 font-medium", children: s.label })] }, s.dataKey)); }) }))] })), jsx("div", { className: "w-full", style: { height: "".concat(height, "px") }, children: jsx(ResponsiveContainer, { width: "100%", height: "100%", children: jsxs(LineChart, { data: data, margin: { top: 5, right: 5, left: 5, bottom: 5 }, children: [jsx("defs", { children: series.map(function (s) { return (jsxs("linearGradient", { id: "area-line-chart-".concat(s.dataKey), x1: "0", y1: "0", x2: "0", y2: "1", children: [jsx("stop", { offset: "0%", stopColor: s.color, stopOpacity: 0.3 }), jsx("stop", { offset: "50%", stopColor: s.color, stopOpacity: 0.15 }), jsx("stop", { offset: "100%", stopColor: s.color, stopOpacity: 0 })] }, s.dataKey)); }) }), jsx(XAxis, { dataKey: xAxisKey, axisLine: false, tickLine: false, tick: { fill: "#9ca3af", fontSize: 12 }, dy: 10 }), jsx(YAxis, { axisLine: false, tickLine: false, tick: { fill: "transparent", fontSize: 0 }, width: 0, tickCount: 6, domain: yAxisDomain, allowDecimals: false }), jsx(CartesianGrid, { strokeDasharray: "3 3", stroke: "#d1d5db", strokeOpacity: 0.5, vertical: false, horizontal: true }), jsx(Tooltip$1, { content: jsx(ChartTooltip, { series: series, formatValue: formatTooltipValue }) }), series.map(function (s) { return (jsx(Area, { type: "natural", dataKey: s.dataKey, stroke: "none", fill: "url(#area-line-chart-".concat(s.dataKey, ")"), animationDuration: 1500, animationEasing: "ease-in-out" }, "area-".concat(s.dataKey))); }), series.map(function (s) { return (jsx(Line, { type: "natural", dataKey: s.dataKey, name: s.dataKey, stroke: s.color, strokeWidth: 3, dot: false, activeDot: {
|
|
588
588
|
r: 6,
|
|
589
589
|
fill: s.color,
|
|
590
590
|
stroke: "#fff",
|
|
@@ -2947,6 +2947,65 @@ var DateSelector = function (_a) {
|
|
|
2947
2947
|
return (jsxs("div", { className: "w-full flex flex-wrap xs:gap-5 justify-between items-center ".concat(className), children: [jsxs(RadioGroup, __assign({ color: "primary", orientation: "horizontal", size: "sm", value: type, onValueChange: handleTypeChange }, radioGroupProps, { children: [jsx(Radio, __assign({ value: HolidayType.SingleDay }, radioItemProps, { children: t.dayOption })), jsx(Radio, __assign({ value: HolidayType.DateRange }, radioItemProps, { children: t.dateRangeOption }))] })), type === HolidayType.DateRange ? (jsx(DateRangePicker$1, __assign({ className: "xs:w-full md:flex-1 md:max-w-xs", value: dateRange || null, onChange: handleDateRangeChange, "aria-label": t.selectDateRangeAriaLabel, endContent: jsx(IconComponent, { icon: "solar:calendar-outline" }) }, dateRangePickerProps))) : (jsx(DatePicker$1, __assign({ className: "xs:w-full md:flex-1 md:max-w-40", value: date || null, onChange: handleDateChange, endContent: jsx(IconComponent, { icon: "solar:calendar-outline" }), "aria-label": t.selectDateAriaLabel }, datePickerProps)))] }));
|
|
2948
2948
|
};
|
|
2949
2949
|
|
|
2950
|
+
/** Paleta categórica por defecto: primary/secondary/success/warning/danger de BeweOS. */
|
|
2951
|
+
var DEFAULT_DONUT_COLORS = [
|
|
2952
|
+
"#006fee",
|
|
2953
|
+
"#7828c8",
|
|
2954
|
+
"#17c964",
|
|
2955
|
+
"#f5a524",
|
|
2956
|
+
"#f31260",
|
|
2957
|
+
];
|
|
2958
|
+
function safeValue$1(value) {
|
|
2959
|
+
return Number.isFinite(value) && value > 0 ? value : 0;
|
|
2960
|
+
}
|
|
2961
|
+
function computeTotal(data) {
|
|
2962
|
+
return data.reduce(function (sum, d) { return sum + safeValue$1(d.value); }, 0);
|
|
2963
|
+
}
|
|
2964
|
+
/**
|
|
2965
|
+
* `true` cuando no hay datos o todos los valores son 0 — mismo criterio que el
|
|
2966
|
+
* `NotData` legacy de Guru.js: un donut sin nada que repartir no aporta información.
|
|
2967
|
+
*/
|
|
2968
|
+
function isDonutEmpty(data) {
|
|
2969
|
+
return data.length === 0 || computeTotal(data) === 0;
|
|
2970
|
+
}
|
|
2971
|
+
/**
|
|
2972
|
+
* Resuelve las proporciones y el color final de cada categoría.
|
|
2973
|
+
* El color propio de cada dato tiene prioridad; si falta, se cicla `palette` por índice.
|
|
2974
|
+
*/
|
|
2975
|
+
function computeSlices(data, palette) {
|
|
2976
|
+
if (palette === void 0) { palette = DEFAULT_DONUT_COLORS; }
|
|
2977
|
+
var total = computeTotal(data);
|
|
2978
|
+
return data.map(function (datum, index) {
|
|
2979
|
+
var _a;
|
|
2980
|
+
var value = safeValue$1(datum.value);
|
|
2981
|
+
return __assign(__assign({}, datum), { value: value, color: (_a = datum.color) !== null && _a !== void 0 ? _a : palette[index % palette.length], percent: total > 0 ? value / total : 0 });
|
|
2982
|
+
});
|
|
2983
|
+
}
|
|
2984
|
+
|
|
2985
|
+
var DEFAULT_TRANSLATIONS$b = {
|
|
2986
|
+
emptyState: "Sin datos para mostrar",
|
|
2987
|
+
totalLabel: "Total",
|
|
2988
|
+
};
|
|
2989
|
+
/**
|
|
2990
|
+
* DonutChart - Gráfico circular (pie o donut, según `innerRadiusRatio`) con
|
|
2991
|
+
* leyenda y total central propios, renderizados fuera del árbol de Recharts
|
|
2992
|
+
* para que sean estables independientemente del tamaño medido del contenedor.
|
|
2993
|
+
*/
|
|
2994
|
+
var DonutChart = function (_a) {
|
|
2995
|
+
var data = _a.data, _b = _a.height, height = _b === void 0 ? 220 : _b, _c = _a.innerRadiusRatio, innerRadiusRatio = _c === void 0 ? 0.65 : _c, _d = _a.showLegend, showLegend = _d === void 0 ? true : _d, _e = _a.showTotal, showTotal = _e === void 0 ? true : _e, colors = _a.colors, formatValue = _a.formatValue, _f = _a.translations, translations = _f === void 0 ? {} : _f, className = _a.className;
|
|
2996
|
+
var t = __assign(__assign({}, DEFAULT_TRANSLATIONS$b), translations);
|
|
2997
|
+
if (isDonutEmpty(data)) {
|
|
2998
|
+
return (jsx("div", { className: className, children: jsx(P, { children: t.emptyState }) }));
|
|
2999
|
+
}
|
|
3000
|
+
var slices = computeSlices(data, colors);
|
|
3001
|
+
var total = slices.reduce(function (sum, s) { return sum + s.value; }, 0);
|
|
3002
|
+
var format = function (value) {
|
|
3003
|
+
return formatValue ? formatValue(value) : String(value);
|
|
3004
|
+
};
|
|
3005
|
+
var isDonut = innerRadiusRatio > 0;
|
|
3006
|
+
return (jsxs("div", { className: className, children: [jsxs("div", { className: "relative w-full", style: { height: height }, children: [jsx(ResponsiveContainer, { width: "100%", height: "100%", children: jsxs(PieChart, { children: [jsx(Pie, { data: slices, dataKey: "value", nameKey: "name", innerRadius: isDonut ? "".concat(innerRadiusRatio * 100, "%") : 0, outerRadius: "90%", stroke: "none", children: slices.map(function (slice) { return (jsx(Cell, { fill: slice.color }, slice.name)); }) }), jsx(Tooltip$1, { formatter: function (value) { return format(value); } })] }) }), isDonut && showTotal && (jsxs("div", { className: "aurora-donut-total pointer-events-none absolute inset-0 flex flex-col items-center justify-center", "aria-hidden": "true", children: [jsx("span", { className: "text-xs text-foreground-500", children: t.totalLabel }), jsx("span", { className: "text-xl font-semibold", children: format(total) })] }))] }), showLegend && (jsx("ul", { className: "mt-3 flex flex-wrap gap-3", children: slices.map(function (slice) { return (jsxs("li", { className: "flex items-center gap-1.5 text-xs", children: [jsx("span", { className: "h-2 w-2 rounded-full", style: { backgroundColor: slice.color }, "aria-hidden": "true" }), jsx("span", { children: slice.name }), jsxs("span", { className: "text-foreground-500", children: [Math.round(slice.percent * 100), "%"] })] }, slice.name)); }) }))] }));
|
|
3007
|
+
};
|
|
3008
|
+
|
|
2950
3009
|
var H1 = function (_a) {
|
|
2951
3010
|
var children = _a.children, className = _a.className, props = __rest(_a, ["children", "className"]);
|
|
2952
3011
|
return (jsx("h1", __assign({ className: cn("text-xl font-bold", className) }, props, { children: children })));
|
|
@@ -3012,12 +3071,12 @@ var NotificationButton = function (_a) {
|
|
|
3012
3071
|
};
|
|
3013
3072
|
NotificationButton.displayName = "NotificationButton";
|
|
3014
3073
|
|
|
3015
|
-
var DEFAULT_TRANSLATIONS$
|
|
3074
|
+
var DEFAULT_TRANSLATIONS$a = {
|
|
3016
3075
|
logout: "Cerrar sesión",
|
|
3017
3076
|
};
|
|
3018
3077
|
var HeaderComponent = function (_a) {
|
|
3019
3078
|
var notificationCount = _a.notificationCount, options = _a.options, onMenuClick = _a.onMenuClick, onLogout = _a.onLogout, _b = _a.translations, translations = _b === void 0 ? {} : _b, breadcrumbs = _a.breadcrumbs, extraContent = _a.extraContent, _c = _a.showMenuButton, showMenuButton = _c === void 0 ? true : _c, onNotificationClick = _a.onNotificationClick, onOptionSelect = _a.onOptionSelect, onBreadcrumbClick = _a.onBreadcrumbClick;
|
|
3020
|
-
var t = __assign(__assign({}, DEFAULT_TRANSLATIONS$
|
|
3079
|
+
var t = __assign(__assign({}, DEFAULT_TRANSLATIONS$a), translations);
|
|
3021
3080
|
return (jsx("header", { className: "header__container", children: jsxs("div", { className: "flex items-center justify-between w-full", children: [jsxs("div", { className: "flex items-center gap-4", children: [showMenuButton && (jsx(Button$1, { className: "sm:hidden", isIconOnly: true, variant: "light", startContent: jsx(IconComponent, { icon: "solar:hamburger-menu-linear" }), onPress: onMenuClick })), breadcrumbs && breadcrumbs.length > 0 && (jsx(BreadcrumbsComponent, { items: breadcrumbs, onItemClick: onBreadcrumbClick }))] }), jsxs("div", { className: "flex items-center gap-4", children: [extraContent, jsx(NotificationButton, { notificationCount: notificationCount, onPress: onNotificationClick }), jsx(ConfigMenu, { options: options, onLogout: onLogout, onOptionSelect: onOptionSelect, translations: t })] })] }) }));
|
|
3022
3081
|
};
|
|
3023
3082
|
HeaderComponent.displayName = "Header";
|
|
@@ -3141,7 +3200,7 @@ KanbanColumn.displayName = "KanbanColumn";
|
|
|
3141
3200
|
* Traducciones por defecto en español.
|
|
3142
3201
|
* Se mezclan con las traducciones proporcionadas por el usuario.
|
|
3143
3202
|
*/
|
|
3144
|
-
var DEFAULT_TRANSLATIONS$
|
|
3203
|
+
var DEFAULT_TRANSLATIONS$9 = {
|
|
3145
3204
|
dropHere: "Soltar aquí",
|
|
3146
3205
|
emptyMessage: "No hay elementos",
|
|
3147
3206
|
};
|
|
@@ -3175,7 +3234,7 @@ var columnGapClasses = {
|
|
|
3175
3234
|
var KanbanComponent = function (_a) {
|
|
3176
3235
|
var columns = _a.columns, renderItem = _a.renderItem, onCardClick = _a.onCardClick, onItemMove = _a.onItemMove, isDraggable = _a.isDraggable, cardClassName = _a.cardClassName, isCardClickable = _a.isCardClickable, className = _a.className, _b = _a.columnWidth, columnWidth = _b === void 0 ? "280px" : _b, _c = _a.columnGap, columnGap = _c === void 0 ? "md" : _c, _d = _a.horizontalScroll, horizontalScroll = _d === void 0 ? true : _d, columnMaxHeight = _a.columnMaxHeight, renderColumnHeader = _a.renderColumnHeader, renderEmptyState = _a.renderEmptyState, _e = _a.translations, translations = _e === void 0 ? {} : _e, onLoadMore = _a.onLoadMore;
|
|
3177
3236
|
// Mezclar traducciones del usuario con las por defecto
|
|
3178
|
-
var t = __assign(__assign({}, DEFAULT_TRANSLATIONS$
|
|
3237
|
+
var t = __assign(__assign({}, DEFAULT_TRANSLATIONS$9), translations);
|
|
3179
3238
|
// Determinar si drag está habilitado
|
|
3180
3239
|
var dragEnabled = isDraggable !== null && isDraggable !== void 0 ? isDraggable : !!onItemMove;
|
|
3181
3240
|
// Estado del drag actual
|
|
@@ -3333,6 +3392,32 @@ function getSelectedKeyFromPath(pathname, items) {
|
|
|
3333
3392
|
return undefined;
|
|
3334
3393
|
}
|
|
3335
3394
|
|
|
3395
|
+
/**
|
|
3396
|
+
* Deriva las iniciales para el avatar del usuario a partir de su nombre completo.
|
|
3397
|
+
*
|
|
3398
|
+
* Muestra la inicial del nombre + la inicial del primer apellido (2 letras en
|
|
3399
|
+
* mayúsculas), p. ej. "Roser Ruiz" -> "RR". Si el usuario solo tiene un token
|
|
3400
|
+
* (nombre sin apellido) devuelve una sola inicial. Si no hay texto, devuelve "".
|
|
3401
|
+
*
|
|
3402
|
+
* TECH-1727: reemplaza el comportamiento por defecto de HeroUI (`safeText`), que
|
|
3403
|
+
* muestra las 3 primeras letras del nombre ("Roser Ruiz" -> "Ros").
|
|
3404
|
+
*
|
|
3405
|
+
* @param fullName Nombre completo del usuario (se usa el mismo valor que el label).
|
|
3406
|
+
* @returns Iniciales en mayúsculas (0, 1 o 2 letras).
|
|
3407
|
+
*/
|
|
3408
|
+
var getUserInitials = function (fullName) {
|
|
3409
|
+
var tokens = fullName.trim().split(/\s+/).filter(Boolean);
|
|
3410
|
+
if (tokens.length === 0) {
|
|
3411
|
+
return "";
|
|
3412
|
+
}
|
|
3413
|
+
var firstInitial = tokens[0].charAt(0).toUpperCase();
|
|
3414
|
+
if (tokens.length === 1) {
|
|
3415
|
+
return firstInitial;
|
|
3416
|
+
}
|
|
3417
|
+
var secondInitial = tokens[1].charAt(0).toUpperCase();
|
|
3418
|
+
return "".concat(firstInitial).concat(secondInitial);
|
|
3419
|
+
};
|
|
3420
|
+
|
|
3336
3421
|
var EnumMenuNavListItem;
|
|
3337
3422
|
(function (EnumMenuNavListItem) {
|
|
3338
3423
|
EnumMenuNavListItem["Nest"] = "nest";
|
|
@@ -3493,7 +3578,7 @@ var MenuNavList = React.forwardRef(function (_a, ref) {
|
|
|
3493
3578
|
});
|
|
3494
3579
|
MenuNavList.displayName = "MenuNavList";
|
|
3495
3580
|
|
|
3496
|
-
var DEFAULT_TRANSLATIONS$
|
|
3581
|
+
var DEFAULT_TRANSLATIONS$8 = {
|
|
3497
3582
|
menuLabel: "Menú",
|
|
3498
3583
|
closeSidebarAriaLabel: "Cerrar menú lateral",
|
|
3499
3584
|
mobileNavAriaLabel: "Navegación móvil",
|
|
@@ -3508,10 +3593,10 @@ var DEFAULT_TRANSLATIONS$6 = {
|
|
|
3508
3593
|
*/
|
|
3509
3594
|
var MenuComponent = React.memo(function Menu(_a) {
|
|
3510
3595
|
var _b, _c;
|
|
3511
|
-
var commerceInfo = _a.commerceInfo, userInfo = _a.userInfo, helpButton = _a.helpButton, isOpenSidebar = _a.isOpenSidebar, onOpenSidebarChange = _a.onOpenSidebarChange, menuItems = _a.menuItems, mobileBottomBarGroupKey = _a.mobileBottomBarGroupKey, _d = _a.showNativeMenu, showNativeMenu = _d === void 0 ? true : _d, _e = _a.translations, translations = _e === void 0 ? {} : _e;
|
|
3596
|
+
var commerceInfo = _a.commerceInfo, userInfo = _a.userInfo, helpButton = _a.helpButton, isOpenSidebar = _a.isOpenSidebar, onOpenSidebarChange = _a.onOpenSidebarChange, menuItems = _a.menuItems, mobileBottomBarGroupKey = _a.mobileBottomBarGroupKey, _d = _a.showNativeMenu, showNativeMenu = _d === void 0 ? true : _d, onUserInfoClick = _a.onUserInfoClick, _e = _a.translations, translations = _e === void 0 ? {} : _e;
|
|
3512
3597
|
var _f = React.useState(false), isCollapsed = _f[0], setIsCollapsed = _f[1];
|
|
3513
3598
|
var _g = React.useState(false), logoError = _g[0], setLogoError = _g[1];
|
|
3514
|
-
var t = __assign(__assign({}, DEFAULT_TRANSLATIONS$
|
|
3599
|
+
var t = __assign(__assign({}, DEFAULT_TRANSLATIONS$8), translations);
|
|
3515
3600
|
var selectedKey = React.useMemo(function () {
|
|
3516
3601
|
var _a, _b, _c;
|
|
3517
3602
|
if (menuItems.selectedPath) {
|
|
@@ -3548,6 +3633,18 @@ var MenuComponent = React.memo(function Menu(_a) {
|
|
|
3548
3633
|
var handleSidebarClose = useCallback(function () {
|
|
3549
3634
|
onOpenSidebarChange === null || onOpenSidebarChange === void 0 ? void 0 : onOpenSidebarChange(false);
|
|
3550
3635
|
}, [onOpenSidebarChange]);
|
|
3636
|
+
// TECH-1784: clic en el bloque de usuario -> acción del consumidor (ej.
|
|
3637
|
+
// navegar a /profile) y cierre del sidebar en móvil, igual que los ítems.
|
|
3638
|
+
var handleUserInfoClick = useCallback(function () {
|
|
3639
|
+
onUserInfoClick === null || onUserInfoClick === void 0 ? void 0 : onUserInfoClick();
|
|
3640
|
+
handleSidebarClose();
|
|
3641
|
+
}, [onUserInfoClick, handleSidebarClose]);
|
|
3642
|
+
// Contenido del bloque de usuario (avatar + nombre + rol), reutilizado
|
|
3643
|
+
// tanto en la variante estática como en la interactiva (TECH-1784).
|
|
3644
|
+
var userInfoContent = (jsxs(Fragment, { children: [jsx(Avatar, { size: "md", src: ((_b = userInfo === null || userInfo === void 0 ? void 0 : userInfo.avatar) === null || _b === void 0 ? void 0 : _b.trim()) || undefined, color: !((_c = userInfo === null || userInfo === void 0 ? void 0 : userInfo.avatar) === null || _c === void 0 ? void 0 : _c.trim()) ? "warning" : "default", name: userName,
|
|
3645
|
+
// TECH-1727: inicial de nombre + inicial de primer apellido
|
|
3646
|
+
// (p. ej. "Roser Ruiz" -> "RR") en vez de las 3 primeras letras.
|
|
3647
|
+
getInitials: getUserInitials, className: "shrink-0" }), jsxs("div", { className: "collapsible-item flex min-w-0 flex-col overflow-hidden", children: [jsx("p", { className: "text-small font-medium text-default-900 truncate", children: userName }), jsx("p", { className: "text-tiny text-default-400 truncate", children: userRole })] })] }));
|
|
3551
3648
|
var handleSidebarOpen = useCallback(function () {
|
|
3552
3649
|
onOpenSidebarChange === null || onOpenSidebarChange === void 0 ? void 0 : onOpenSidebarChange(true);
|
|
3553
3650
|
}, [onOpenSidebarChange]);
|
|
@@ -3687,7 +3784,7 @@ var MenuComponent = React.memo(function Menu(_a) {
|
|
|
3687
3784
|
flexDirection: isCollapsed ? "column-reverse" : "row",
|
|
3688
3785
|
}, 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 shrink-0 items-center justify-center overflow-hidden rounded-full bg-foreground text-background", children: hasValidLogo ? (jsx("img", { src: commerceInfo.logo, alt: "".concat(t.logoAlt, " ").concat(commerceName), className: "h-full w-full object-cover", onError: function () { return setLogoError(true); } })) : (jsx(IconComponent, { icon: "solar:buildings-2-outline", size: "sm", className: "shrink-0", "aria-hidden": true })) }), jsx("span", { className: "collapsible-item text-small font-bold truncate min-w-0", children: commerceName })] }), 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
|
|
3689
3786
|
? "solar:alt-arrow-right-outline"
|
|
3690
|
-
: "solar:alt-arrow-left-outline", size: "lg", className: "hidden sm:block cursor-pointer", onClick: handleCollapseToggle })] })] }), jsx(Spacer, { y: 6 }),
|
|
3787
|
+
: "solar:alt-arrow-left-outline", size: "lg", className: "hidden sm:block cursor-pointer", onClick: handleCollapseToggle })] })] }), jsx(Spacer, { y: 6 }), onUserInfoClick ? (jsx("button", { type: "button", onClick: handleUserInfoClick, className: "content__menu--user w-full text-left cursor-pointer rounded-large border-none bg-transparent transition-colors hover:bg-default/40 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus ".concat(isCollapsed ? "gap-0" : "gap-3"), children: userInfoContent })) : (jsx("div", { className: "content__menu--user ".concat(isCollapsed ? "gap-0" : "gap-3"), children: userInfoContent })), jsxs("div", { className: "".concat(!isCollapsed ? "flex-1" : "h-full", " min-h-0 py-6 relative"), children: [!isCollapsed && showScrollArrows && (jsxs(Fragment, { children: [scrollState.canScrollUp && (jsxs(Fragment, { children: [jsx("div", { className: "menu-scroll-fade menu-scroll-fade--up", "aria-hidden": "true" }), jsx("button", { type: "button", "aria-label": t.scrollUpAriaLabel, className: "menu-scroll-chevron menu-scroll-chevron--up", onClick: handleScrollUp, children: jsx(IconComponent, { icon: "solar:alt-arrow-up-outline", size: "md", "aria-hidden": true }) })] })), scrollState.canScrollDown && (jsxs(Fragment, { children: [jsx("div", { className: "menu-scroll-fade menu-scroll-fade--down", "aria-hidden": "true" }), jsx("button", { type: "button", "aria-label": t.scrollDownAriaLabel, className: "menu-scroll-chevron menu-scroll-chevron--down", onClick: handleScrollDown, children: jsx(IconComponent, { icon: "solar:alt-arrow-down-outline", size: "md", "aria-hidden": true }) })] }))] })), jsx("div", { ref: scrollContainerRef, className: "h-full overflow-y-auto pr-6 -mr-6 [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none] select-none ".concat(isDraggingScroll ? "cursor-grabbing" : ""), onMouseDown: handleScrollAreaMouseDown, children: jsx(MenuNavList, { defaultSelectedKey: selectedKey, items: menuItems.items, isCollapsed: isCollapsed, onSelect: handleMenuSelect }, selectedKey) })] }), helpSection ? (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 truncate", children: helpSection.title })) }) })) : null] }) })] }));
|
|
3691
3788
|
});
|
|
3692
3789
|
|
|
3693
3790
|
/**
|
|
@@ -3731,7 +3828,59 @@ var MenuClawHistoryPanel = React.memo(function MenuClawHistoryPanel(_a) {
|
|
|
3731
3828
|
: "solar:alt-arrow-down-linear", size: "sm", "aria-hidden": true }), isExpanded ? showLessLabel : showMoreLabel] })) : null] })) : null] }));
|
|
3732
3829
|
});
|
|
3733
3830
|
|
|
3734
|
-
|
|
3831
|
+
/** ¿Está la key seleccionada en este ítem o en cualquiera de sus descendientes? */
|
|
3832
|
+
var containsKey = function (item, key) {
|
|
3833
|
+
var _a;
|
|
3834
|
+
if (!key) {
|
|
3835
|
+
return false;
|
|
3836
|
+
}
|
|
3837
|
+
if (item.key === key) {
|
|
3838
|
+
return true;
|
|
3839
|
+
}
|
|
3840
|
+
return ((_a = item.items) !== null && _a !== void 0 ? _a : []).some(function (child) { return containsKey(child, key); });
|
|
3841
|
+
};
|
|
3842
|
+
/**
|
|
3843
|
+
* Fila del menú. Si el ítem trae `items`, se pinta como grupo desplegable en vez
|
|
3844
|
+
* de como enlace.
|
|
3845
|
+
*
|
|
3846
|
+
* Existe porque `MenuClaw` no puede reutilizar `MenuNavList` (heredaría sus filas
|
|
3847
|
+
* de 44px) pero sí necesita el mismo dato jerárquico: los consumidores mandan
|
|
3848
|
+
* módulos con hijos —Catálogo › Productos/Servicios— y sin este render se
|
|
3849
|
+
* perderían en silencio, porque `MenuNavListItem.items` es opcional y no falla
|
|
3850
|
+
* al compilar.
|
|
3851
|
+
*
|
|
3852
|
+
* El grupo que contiene la ruta activa se despliega solo y no se puede plegar:
|
|
3853
|
+
* si se pudiera, el ítem activo quedaría oculto.
|
|
3854
|
+
*/
|
|
3855
|
+
var MenuClawNavItem = function (_a) {
|
|
3856
|
+
var _b, _c;
|
|
3857
|
+
var item = _a.item, selectedKey = _a.selectedKey, isCollapsed = _a.isCollapsed, onSelect = _a.onSelect, _d = _a.depth, depth = _d === void 0 ? 0 : _d;
|
|
3858
|
+
var submenuId = useId();
|
|
3859
|
+
var _e = useState(false), isManuallyOpen = _e[0], setIsManuallyOpen = _e[1];
|
|
3860
|
+
var children = (_b = item.items) !== null && _b !== void 0 ? _b : [];
|
|
3861
|
+
// Comprimido no hay sitio para desplegables: la fila vuelve a ser navegable.
|
|
3862
|
+
var isGroup = children.length > 0 && !isCollapsed;
|
|
3863
|
+
var hasSelectedDescendant = useMemo(function () { return children.some(function (child) { return containsKey(child, selectedKey); }); }, [children, selectedKey]);
|
|
3864
|
+
var isOpen = hasSelectedDescendant || isManuallyOpen;
|
|
3865
|
+
var isActive = !!item.key && item.key === selectedKey;
|
|
3866
|
+
var handleClick = useCallback(function () {
|
|
3867
|
+
if (isGroup) {
|
|
3868
|
+
setIsManuallyOpen(function (prev) { return !prev; });
|
|
3869
|
+
return;
|
|
3870
|
+
}
|
|
3871
|
+
onSelect(item.key, item.href);
|
|
3872
|
+
}, [isGroup, onSelect, item.key, item.href]);
|
|
3873
|
+
var icon = item.icon || item.startContent ? (jsx("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center text-default-500 [&_svg]:h-5 [&_svg]:w-5", children: item.icon ? (jsx(IconComponent, { icon: item.icon, size: "md", "aria-hidden": true })) : (item.startContent) })) : null;
|
|
3874
|
+
return (jsxs("li", { children: [jsxs("button", { type: "button", title: isCollapsed ? item.title : undefined, onClick: handleClick, "aria-expanded": isGroup ? isOpen : undefined, "aria-controls": isGroup ? submenuId : undefined, className: cn("flex w-full items-center rounded-lg px-2 py-1.5 text-left text-small transition-colors", "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus", depth === 0 ? "min-h-9" : "min-h-8", isCollapsed ? "justify-center" : "gap-3",
|
|
3875
|
+
// Sangría del hijo: alinea su texto con el del padre (px-2 + icono
|
|
3876
|
+
// de 20px + gap de 12px).
|
|
3877
|
+
!isCollapsed && depth > 0 && !icon ? "pl-10" : undefined, isActive
|
|
3878
|
+
? "bg-default-100 font-medium text-foreground"
|
|
3879
|
+
: "text-default-600 hover:bg-default-100", item.className), children: [icon, !isCollapsed ? (jsxs(Fragment, { children: [jsx("span", { className: "menu-claw-collapsible flex-1 truncate", children: item.title }), (_c = item.endContent) !== null && _c !== void 0 ? _c : null, isGroup ? (jsx(IconComponent, { icon: "solar:alt-arrow-down-linear", size: "sm", "aria-hidden": true, className: cn("shrink-0 text-default-400 transition-transform", isOpen && "rotate-180") })) : null] })) : null] }), isGroup && isOpen ? (jsx("ul", { id: submenuId, className: "mt-0.5 flex flex-col gap-0.5", children: children.map(function (child) { return (jsx(MenuClawNavItem, { item: child, selectedKey: selectedKey, isCollapsed: isCollapsed, onSelect: onSelect, depth: depth + 1 }, child.key)); }) })) : null] }));
|
|
3880
|
+
};
|
|
3881
|
+
MenuClawNavItem.displayName = "MenuClawNavItem";
|
|
3882
|
+
|
|
3883
|
+
var DEFAULT_TRANSLATIONS$7 = {
|
|
3735
3884
|
menuLabel: "Menú",
|
|
3736
3885
|
closeSidebarAriaLabel: "Cerrar menú lateral",
|
|
3737
3886
|
mobileNavAriaLabel: "Navegación móvil",
|
|
@@ -3769,7 +3918,7 @@ var MenuClaw = React.memo(function MenuClaw(_a) {
|
|
|
3769
3918
|
var _b, _c;
|
|
3770
3919
|
var userInfo = _a.userInfo, helpButton = _a.helpButton, menuItems = _a.menuItems, history = _a.history, isOpenSidebar = _a.isOpenSidebar, onOpenSidebarChange = _a.onOpenSidebarChange, mobileBottomBarGroupKey = _a.mobileBottomBarGroupKey, _d = _a.showNativeMenu, showNativeMenu = _d === void 0 ? true : _d, _e = _a.translations, translations = _e === void 0 ? {} : _e;
|
|
3771
3920
|
var _f = React.useState(false), isCollapsed = _f[0], setIsCollapsed = _f[1];
|
|
3772
|
-
var t = __assign(__assign({}, DEFAULT_TRANSLATIONS$
|
|
3921
|
+
var t = __assign(__assign({}, DEFAULT_TRANSLATIONS$7), translations);
|
|
3773
3922
|
var selectedKey = useMemo(function () {
|
|
3774
3923
|
var _a, _b, _c;
|
|
3775
3924
|
if (menuItems.selectedPath) {
|
|
@@ -3841,13 +3990,7 @@ var MenuClaw = React.memo(function MenuClaw(_a) {
|
|
|
3841
3990
|
? "solar:alt-arrow-right-linear"
|
|
3842
3991
|
: "solar:alt-arrow-left-linear", size: "md", "aria-hidden": true }) })] }), jsxs("div", { className: cn("flex items-center py-3", isCollapsed ? "justify-center gap-0" : "gap-3"), children: [jsx(Avatar, { size: "sm", src: ((_b = userInfo === null || userInfo === void 0 ? void 0 : userInfo.avatar) === null || _b === void 0 ? void 0 : _b.trim()) || undefined, color: !((_c = userInfo === null || userInfo === void 0 ? void 0 : userInfo.avatar) === null || _c === void 0 ? void 0 : _c.trim()) ? "warning" : "default", name: userName, className: "shrink-0" }), !isCollapsed ? (jsxs("div", { className: "menu-claw-collapsible flex min-w-0 flex-col overflow-hidden", children: [jsx("p", { className: "truncate text-small font-semibold text-foreground", children: userName }), jsx("p", { className: "truncate text-tiny text-default-400", children: userRole })] })) : null] }), jsx(MenuClawHistoryPanel, { items: historyConfig.items, initialVisibleCount: historyConfig.initialVisibleCount, onNewConversation: history === null || history === void 0 ? void 0 : history.onNewConversation, isCollapsed: isCollapsed, title: t.historyTitle, newLabel: t.historyNewLabel, showMoreLabel: t.historyShowMoreLabel, showLessLabel: t.historyShowLessLabel, onBeforeSelect: handleSidebarClose }), jsx("nav", { className: "flex min-h-0 flex-1 flex-col overflow-y-auto [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]", children: menuItems.items.map(function (group) {
|
|
3843
3992
|
var _a;
|
|
3844
|
-
return (jsxs("div", { className: "mb-2", children: [group.title && !isCollapsed ? (jsx("p", { className: "px-2 pb-1 pt-2 text-tiny font-medium uppercase tracking-wide text-default-400", children: group.title })) : null, jsx("ul", { className: "flex flex-col gap-0.5", children: ((_a = group.items) !== null && _a !== void 0 ? _a : []).map(function (item) {
|
|
3845
|
-
var _a;
|
|
3846
|
-
var isActive = !!item.key && item.key === selectedKey;
|
|
3847
|
-
return (jsx("li", { children: jsxs("button", { type: "button", title: isCollapsed ? item.title : undefined, onClick: function () { return handleMenuSelect(item.key, item.href); }, className: cn("flex min-h-9 w-full items-center rounded-lg px-2 py-1.5 text-left text-small transition-colors", "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus", isCollapsed ? "justify-center" : "gap-3", isActive
|
|
3848
|
-
? "bg-default-100 font-medium text-foreground"
|
|
3849
|
-
: "text-default-600 hover:bg-default-100", item.className), children: [item.icon || item.startContent ? (jsx("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center text-default-500 [&_svg]:h-5 [&_svg]:w-5", children: item.icon ? (jsx(IconComponent, { icon: item.icon, size: "md", "aria-hidden": true })) : (item.startContent) })) : null, !isCollapsed ? (jsxs(Fragment, { children: [jsx("span", { className: "menu-claw-collapsible flex-1 truncate", children: item.title }), (_a = item.endContent) !== null && _a !== void 0 ? _a : null] })) : null] }) }, item.key));
|
|
3850
|
-
}) })] }, group.key));
|
|
3993
|
+
return (jsxs("div", { className: "mb-2", children: [group.title && !isCollapsed ? (jsx("p", { className: "px-2 pb-1 pt-2 text-tiny font-medium uppercase tracking-wide text-default-400", children: group.title })) : null, jsx("ul", { className: "flex flex-col gap-0.5", children: ((_a = group.items) !== null && _a !== void 0 ? _a : []).map(function (item) { return (jsx(MenuClawNavItem, { item: item, selectedKey: selectedKey, isCollapsed: isCollapsed, onSelect: handleMenuSelect }, item.key)); }) })] }, group.key));
|
|
3851
3994
|
}) }), helpSection ? (jsx("div", { className: "mt-auto flex flex-col items-center justify-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: "menu-claw-collapsible truncate", children: helpSection.title })) : null }) })) : null] }) })] }));
|
|
3852
3995
|
});
|
|
3853
3996
|
|
|
@@ -4207,13 +4350,6 @@ var Phone = function (_a) {
|
|
|
4207
4350
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
4208
4351
|
};
|
|
4209
4352
|
}, [isDropdownOpen]);
|
|
4210
|
-
// El dropdown se portea a `body` con posición absoluta fija; cerrarlo cuando
|
|
4211
|
-
// un ancestro hace scroll para que no quede flotando fuera de lugar.
|
|
4212
|
-
useCloseOnAncestorScroll({
|
|
4213
|
-
isOpen: isDropdownOpen,
|
|
4214
|
-
onClose: function () { return setIsDropdownOpen(false); },
|
|
4215
|
-
contentRef: portalDropdownRef,
|
|
4216
|
-
});
|
|
4217
4353
|
var handleCountrySelect = function (country) {
|
|
4218
4354
|
setSelectedCountry(country);
|
|
4219
4355
|
setIsDropdownOpen(false);
|
|
@@ -4285,6 +4421,64 @@ var PromotionalBanner = function (_a) {
|
|
|
4285
4421
|
}, variant: "bordered", onClick: handleButtonClick }, buttonProps, { children: finalButtonText })), showCloseButton && (jsx("div", { className: "flex flex-1 justify-end", children: jsx(Button$1, { isIconOnly: true, "aria-label": t.closeButtonLabel, className: "-m-1", size: "lg", variant: "bordered", onClick: handleClose, children: jsx(IconComponent, { "aria-hidden": "true", className: "text-default-500", icon: "lucide:x", size: "md" }) }) }))] }));
|
|
4286
4422
|
};
|
|
4287
4423
|
|
|
4424
|
+
/** Paleta categórica por defecto: primary/secondary/success/warning/danger de BeweOS. */
|
|
4425
|
+
var DEFAULT_RANKED_BAR_COLORS = [
|
|
4426
|
+
"#006fee",
|
|
4427
|
+
"#7828c8",
|
|
4428
|
+
"#17c964",
|
|
4429
|
+
"#f5a524",
|
|
4430
|
+
"#f31260",
|
|
4431
|
+
];
|
|
4432
|
+
function safeValue(value) {
|
|
4433
|
+
return Number.isFinite(value) && value > 0 ? value : 0;
|
|
4434
|
+
}
|
|
4435
|
+
function computeMax(data) {
|
|
4436
|
+
return data.reduce(function (max, d) { return Math.max(max, safeValue(d.value)); }, 0);
|
|
4437
|
+
}
|
|
4438
|
+
/**
|
|
4439
|
+
* `true` cuando no hay datos o todos los valores son 0 — mismo criterio que el
|
|
4440
|
+
* `NotData` legacy de Guru.js.
|
|
4441
|
+
*/
|
|
4442
|
+
function isRankedBarListEmpty(data) {
|
|
4443
|
+
return data.length === 0 || computeMax(data) === 0;
|
|
4444
|
+
}
|
|
4445
|
+
/**
|
|
4446
|
+
* Resuelve el ancho de cada barra como porcentaje del **valor máximo del set**
|
|
4447
|
+
* (no del total) — igual que `BusinessStage.js` legacy (`100 * quantity / max`),
|
|
4448
|
+
* y el color final de cada fila.
|
|
4449
|
+
*/
|
|
4450
|
+
function computeBars(data, palette) {
|
|
4451
|
+
if (palette === void 0) { palette = DEFAULT_RANKED_BAR_COLORS; }
|
|
4452
|
+
var max = computeMax(data);
|
|
4453
|
+
return data.map(function (item, index) {
|
|
4454
|
+
var _a;
|
|
4455
|
+
var value = safeValue(item.value);
|
|
4456
|
+
return __assign(__assign({}, item), { value: value, color: (_a = item.color) !== null && _a !== void 0 ? _a : palette[index % palette.length], percent: max > 0 ? (value / max) * 100 : 0 });
|
|
4457
|
+
});
|
|
4458
|
+
}
|
|
4459
|
+
|
|
4460
|
+
var DEFAULT_TRANSLATIONS$6 = {
|
|
4461
|
+
emptyState: "Sin datos para mostrar",
|
|
4462
|
+
};
|
|
4463
|
+
/**
|
|
4464
|
+
* RankedBarList - Lista de barras horizontales escaladas al valor máximo del
|
|
4465
|
+
* set (no al total) — mismo criterio visual que `BusinessStage.js` legacy.
|
|
4466
|
+
* No reordena las filas: el llamador decide el orden (por relevancia, por
|
|
4467
|
+
* etapa del funnel, etc.).
|
|
4468
|
+
*/
|
|
4469
|
+
var RankedBarList = function (_a) {
|
|
4470
|
+
var data = _a.data, colors = _a.colors, formatValue = _a.formatValue, _b = _a.showValue, showValue = _b === void 0 ? true : _b, _c = _a.barHeight, barHeight = _c === void 0 ? 8 : _c, _d = _a.translations, translations = _d === void 0 ? {} : _d, className = _a.className;
|
|
4471
|
+
var t = __assign(__assign({}, DEFAULT_TRANSLATIONS$6), translations);
|
|
4472
|
+
if (isRankedBarListEmpty(data)) {
|
|
4473
|
+
return (jsx("div", { className: className, children: jsx(P, { children: t.emptyState }) }));
|
|
4474
|
+
}
|
|
4475
|
+
var bars = computeBars(data, colors);
|
|
4476
|
+
var format = function (value) {
|
|
4477
|
+
return formatValue ? formatValue(value) : String(value);
|
|
4478
|
+
};
|
|
4479
|
+
return (jsx("div", { className: ["flex flex-col gap-3", className].filter(Boolean).join(" "), children: bars.map(function (bar) { return (jsxs("div", { className: "flex flex-col gap-1", children: [jsxs("div", { className: "flex items-baseline justify-between gap-2", children: [jsx(P, { className: "truncate", children: bar.label }), showValue && (jsx("span", { className: "text-sm font-medium text-foreground", children: format(bar.value) }))] }), jsx("div", { className: "w-full rounded-full bg-default-100", style: { height: barHeight }, children: jsx("div", { className: "h-full rounded-full", style: { width: "".concat(bar.percent, "%"), backgroundColor: bar.color } }) })] }, bar.label)); }) }));
|
|
4480
|
+
};
|
|
4481
|
+
|
|
4288
4482
|
var VALID_STEP_COLORS = [
|
|
4289
4483
|
"primary",
|
|
4290
4484
|
"secondary",
|
|
@@ -5342,7 +5536,7 @@ var ScheduleRow = function (_a) {
|
|
|
5342
5536
|
// Return slots exactly as they are - no automatic additions
|
|
5343
5537
|
return slots;
|
|
5344
5538
|
};
|
|
5345
|
-
return (jsxs("div", { className: "flex flex-col w-full gap-y-4 last:border-b-0 last:mb-0 last:pb-0 border-b border-default-200 xs:py-4 xl:p-4 first:pt-0", children: [jsxs("div", { className: "flex w-full items-center justify-between", children: [jsxs("div", { className: "flex xs:space-x-2 sm:space-x-4", children: [jsx("h3", { className: "text-small font-semibold text-default-900 capitalize", children: day }), jsx(Chip$1, { size: "sm", color: daySchedule.isOpen ? "primary" : "default", className: "text-background", children: daySchedule.isOpen ? t.open : t.closed })] }), jsxs("div", { className: "flex xs:gap-2 sm:gap-5", children: [jsx(Switch, { size: "sm", color: "primary", isSelected: daySchedule.isOpen, onValueChange: handleToggleDay }), showCopyToAll && onCopyToAll && (jsx(Button, { size: "sm", variant: "bordered", onPress: function () { return onCopyToAll(day); }, children: t.copyToAll }))] })] }), daySchedule.isOpen && (jsx("div", { className: "flex flex-col justify-around gap-y-3 ", children: getSlotsToDisplay().map(function (slot, index) {
|
|
5539
|
+
return (jsxs("div", { className: "flex flex-col w-full gap-y-4 last:border-b-0 last:mb-0 last:pb-0 border-b border-default-200 xs:py-4 xl:p-4 first:pt-0", children: [jsxs("div", { className: "flex w-full items-center justify-between", children: [jsxs("div", { className: "flex items-center xs:space-x-2 sm:space-x-4", children: [jsx("h3", { className: "text-small font-semibold text-default-900 capitalize w-24 shrink-0", children: day }), jsx(Chip$1, { size: "sm", color: daySchedule.isOpen ? "primary" : "default", className: "text-background", children: daySchedule.isOpen ? t.open : t.closed })] }), jsxs("div", { className: "flex xs:gap-2 sm:gap-5", children: [jsx(Switch, { size: "sm", color: "primary", isSelected: daySchedule.isOpen, onValueChange: handleToggleDay }), showCopyToAll && onCopyToAll && (jsx(Button, { size: "sm", variant: "bordered", onPress: function () { return onCopyToAll(day); }, children: t.copyToAll }))] })] }), daySchedule.isOpen && (jsx("div", { className: "flex flex-col justify-around gap-y-3 ", children: getSlotsToDisplay().map(function (slot, index) {
|
|
5346
5540
|
var slotsToDisplay = getSlotsToDisplay();
|
|
5347
5541
|
var isLastSlot = index === slotsToDisplay.length - 1;
|
|
5348
5542
|
var isSlotFilled = slot.from && slot.to;
|
|
@@ -5476,6 +5670,59 @@ var SocialMediaPreview = function (_a) {
|
|
|
5476
5670
|
}
|
|
5477
5671
|
};
|
|
5478
5672
|
|
|
5673
|
+
var paddingClasses = {
|
|
5674
|
+
sm: "p-4",
|
|
5675
|
+
md: "p-6",
|
|
5676
|
+
lg: "p-8",
|
|
5677
|
+
};
|
|
5678
|
+
|
|
5679
|
+
/**
|
|
5680
|
+
* Card genérica siguiendo las reglas de diseño BeweOS basada en HeroUI.
|
|
5681
|
+
*
|
|
5682
|
+
* Reglas aplicadas:
|
|
5683
|
+
* - Shadow: none, sm, md, lg (configurable)
|
|
5684
|
+
* - Radius: sm (por defecto, configurable)
|
|
5685
|
+
* - Padding configurable (sm, md, lg)
|
|
5686
|
+
* - Hereda de HeroUI Card con personalización BeweOS
|
|
5687
|
+
*/
|
|
5688
|
+
var Card = function (_a) {
|
|
5689
|
+
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"]);
|
|
5690
|
+
var paddingClass = paddingClasses[padding];
|
|
5691
|
+
var combinedClassName = [paddingClass, className].filter(Boolean).join(" ");
|
|
5692
|
+
return (jsx(Card$1, __assign({ shadow: shadow, radius: radius, className: combinedClassName }, props, { children: children })));
|
|
5693
|
+
};
|
|
5694
|
+
|
|
5695
|
+
var DEFAULT_TRANSLATIONS$5 = {
|
|
5696
|
+
trendUpAriaLabel: "Tendencia al alza",
|
|
5697
|
+
trendDownAriaLabel: "Tendencia a la baja",
|
|
5698
|
+
trendNeutralAriaLabel: "Sin variación",
|
|
5699
|
+
};
|
|
5700
|
+
var TREND_COLOR_CLASS = {
|
|
5701
|
+
positive: "text-success",
|
|
5702
|
+
negative: "text-danger",
|
|
5703
|
+
neutral: "text-foreground-500",
|
|
5704
|
+
};
|
|
5705
|
+
var TREND_ARIA_KEY = {
|
|
5706
|
+
positive: "trendUpAriaLabel",
|
|
5707
|
+
negative: "trendDownAriaLabel",
|
|
5708
|
+
neutral: "trendNeutralAriaLabel",
|
|
5709
|
+
};
|
|
5710
|
+
/**
|
|
5711
|
+
* StatTile - Tarjeta KPI compacta: ícono opcional + título + valor + tendencia opcional.
|
|
5712
|
+
*
|
|
5713
|
+
* Cubre el patrón "tile" (título + número, con o sin ícono/variación) que se repite en
|
|
5714
|
+
* varios dashboards de estadísticas y no encajaba en ningún chart existente de AuraUI.
|
|
5715
|
+
*/
|
|
5716
|
+
var StatTile = function (_a) {
|
|
5717
|
+
var _b;
|
|
5718
|
+
var title = _a.title, value = _a.value, icon = _a.icon, trend = _a.trend, _c = _a.translations, translations = _c === void 0 ? {} : _c, className = _a.className, _d = _a.padding, padding = _d === void 0 ? "md" : _d, cardProps = __rest(_a, ["title", "value", "icon", "trend", "translations", "className", "padding"]);
|
|
5719
|
+
var t = __assign(__assign({}, DEFAULT_TRANSLATIONS$5), translations);
|
|
5720
|
+
var direction = (_b = trend === null || trend === void 0 ? void 0 : trend.direction) !== null && _b !== void 0 ? _b : "neutral";
|
|
5721
|
+
return (jsxs(Card, __assign({ padding: padding, className: ["flex flex-row items-center gap-3", className]
|
|
5722
|
+
.filter(Boolean)
|
|
5723
|
+
.join(" ") }, cardProps, { children: [icon && (jsx("span", { className: "shrink-0 text-foreground-600", "aria-hidden": "true", children: icon })), jsxs("div", { className: "flex min-w-0 flex-col gap-0.5", children: [jsx(P, { className: "truncate", children: title }), jsxs("div", { className: "flex items-baseline gap-2", children: [jsx(H3, { className: "text-2xl font-semibold", children: value }), trend && (jsx("span", { className: "text-xs font-medium ".concat(TREND_COLOR_CLASS[direction]), "aria-label": t[TREND_ARIA_KEY[direction]], children: trend.value }))] })] })] })));
|
|
5724
|
+
};
|
|
5725
|
+
|
|
5479
5726
|
function AuraTable(_a) {
|
|
5480
5727
|
var columns = _a.columns, items = _a.items, renderCell = _a.renderCell, children = _a.children, props = __rest(_a, ["columns", "items", "renderCell", "children"]);
|
|
5481
5728
|
return (jsxs(Table, __assign({ removeWrapper: true, radius: "none" }, props, { children: [jsx(TableHeader, { columns: columns, children: function (column) { return jsx(TableColumn, { children: column.label }, column.key); } }), jsx(TableBody, { items: items, children: function (item) { return (jsx(TableRow, { children: function (columnKey) { return (jsx(TableCell, { children: renderCell ? renderCell(item, columnKey) : children })); } }, item.id)); } })] })));
|
|
@@ -8864,28 +9111,6 @@ ModalBody.displayName = "ModalBody";
|
|
|
8864
9111
|
|
|
8865
9112
|
var ModalFooter = ModalFooter$1;
|
|
8866
9113
|
|
|
8867
|
-
var paddingClasses = {
|
|
8868
|
-
sm: "p-4",
|
|
8869
|
-
md: "p-6",
|
|
8870
|
-
lg: "p-8",
|
|
8871
|
-
};
|
|
8872
|
-
|
|
8873
|
-
/**
|
|
8874
|
-
* Card genérica siguiendo las reglas de diseño BeweOS basada en HeroUI.
|
|
8875
|
-
*
|
|
8876
|
-
* Reglas aplicadas:
|
|
8877
|
-
* - Shadow: none, sm, md, lg (configurable)
|
|
8878
|
-
* - Radius: sm (por defecto, configurable)
|
|
8879
|
-
* - Padding configurable (sm, md, lg)
|
|
8880
|
-
* - Hereda de HeroUI Card con personalización BeweOS
|
|
8881
|
-
*/
|
|
8882
|
-
var Card = function (_a) {
|
|
8883
|
-
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"]);
|
|
8884
|
-
var paddingClass = paddingClasses[padding];
|
|
8885
|
-
var combinedClassName = [paddingClass, className].filter(Boolean).join(" ");
|
|
8886
|
-
return (jsx(Card$1, __assign({ shadow: shadow, radius: radius, className: combinedClassName }, props, { children: children })));
|
|
8887
|
-
};
|
|
8888
|
-
|
|
8889
9114
|
/**
|
|
8890
9115
|
* Tooltip - Componente BeweOS basado en HeroUI.
|
|
8891
9116
|
*
|
|
@@ -9428,4 +9653,4 @@ var NavigationLoadingProvider = function (_a) {
|
|
|
9428
9653
|
return (jsxs(NavigationLoadingContext.Provider, { value: value, children: [children, jsx(NavigationLoadingOverlay, { isVisible: isVisible })] }));
|
|
9429
9654
|
};
|
|
9430
9655
|
|
|
9431
|
-
export { ALL_THEMES, AURORA_THEME_FAMILIES, AURORA_THEME_REGISTRY, AccordionList, AddHolidayForm, AnalyticsCard, AreaLineChart, AuraAutocomplete, AuraTable, AuraToastProvider, BEWEOS_THEME_MODE_COOKIE_NAME, BreadcrumbsComponent, Button, Card, Chip, ColorPicker, ColorSelector, ContentCarousel, Currency, DEFAULT_PREDEFINED_COLORS, DatePicker, DateRangePicker, DateSelector, DrawerFilters, EmailPreview, EnumMenuNavListItem, GlobalToast, H1, H2, H3, H4, HeaderComponent, HolidayType, IconComponent, ImagePreview, Input, InputPassword, Kanban, KanbanCard, KanbanColumn, MenuClaw, MenuComponent, Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, MultiStepWizard, NavigationLoadingContext, NavigationLoadingOverlay, NavigationLoadingProvider, P, Pagination, Phone, PromotionalBanner, REGISTERED_THEME_COLORS, RangeFilter, RowSteps, DEFAULT_TRANSLATIONS$1 as SEGMENTATION_DEFAULT_TRANSLATIONS, ScheduleRow, SearchInput, SegmentationBuilder, Select, SimpleLineChart, SocialMediaBar, SocialMediaCarousel, SocialMediaPreview, StepIndicator, Switch as SwitchComponent, THEME_COLOR_HEX_MAP, TagsFilter, Textarea, ThemeContext, ThemePicker, ThemeProvider, TimeInput as TimeInputComponent, ToastContext, Tooltip, TwoColumnLayoutAgent, UploadFile, VerticalSteps, ViolinPlot, WhatsAppPreview, Wizard, WizardNavigation, WizardSidebar, applyCustomPrimaryColor, createCurrencyFormatter, uniqueCountries as defaultCountries, defaultCurrencyOptions, defaultTranslations$5 as defaultTranslations, forceLightOnlyThemeBeforeReact, formatAuroraThemeTooltip, generateThemeColorScale, getContrastForeground, getRegisteredThemeColorBases, getSelectedKeyFromPath, hexToThemeColor, hslToCssValue, isAuroraFullThemeId, isExactThemeColor, isGroupState, isHexColor, isSegmentationGroup, removeCustomPrimaryColor, sizeMap, themeColors, useAuraToast, useCloseOnAncestorScroll, useMediaQuery, useNavigationLoading, useThemeContext };
|
|
9656
|
+
export { ALL_THEMES, AURORA_THEME_FAMILIES, AURORA_THEME_REGISTRY, AccordionList, AddHolidayForm, AnalyticsCard, AreaLineChart, AuraAutocomplete, AuraTable, AuraToastProvider, BEWEOS_THEME_MODE_COOKIE_NAME, BreadcrumbsComponent, Button, Card, Chip, ColorPicker, ColorSelector, ContentCarousel, Currency, DEFAULT_DONUT_COLORS, DEFAULT_PREDEFINED_COLORS, DEFAULT_RANKED_BAR_COLORS, DatePicker, DateRangePicker, DateSelector, DonutChart, DrawerFilters, EmailPreview, EnumMenuNavListItem, GlobalToast, H1, H2, H3, H4, HeaderComponent, HolidayType, IconComponent, ImagePreview, Input, InputPassword, Kanban, KanbanCard, KanbanColumn, MenuClaw, MenuComponent, Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, MultiStepWizard, NavigationLoadingContext, NavigationLoadingOverlay, NavigationLoadingProvider, P, Pagination, Phone, PromotionalBanner, REGISTERED_THEME_COLORS, RangeFilter, RankedBarList, RowSteps, DEFAULT_TRANSLATIONS$1 as SEGMENTATION_DEFAULT_TRANSLATIONS, ScheduleRow, SearchInput, SegmentationBuilder, Select, SimpleLineChart, SocialMediaBar, SocialMediaCarousel, SocialMediaPreview, StatTile, StepIndicator, Switch as SwitchComponent, THEME_COLOR_HEX_MAP, TagsFilter, Textarea, ThemeContext, ThemePicker, ThemeProvider, TimeInput as TimeInputComponent, ToastContext, Tooltip, TwoColumnLayoutAgent, UploadFile, VerticalSteps, ViolinPlot, WhatsAppPreview, Wizard, WizardNavigation, WizardSidebar, applyCustomPrimaryColor, computeBars, computeMax, computeSlices, computeTotal, createCurrencyFormatter, uniqueCountries as defaultCountries, defaultCurrencyOptions, defaultTranslations$5 as defaultTranslations, forceLightOnlyThemeBeforeReact, formatAuroraThemeTooltip, generateThemeColorScale, getContrastForeground, getRegisteredThemeColorBases, getSelectedKeyFromPath, hexToThemeColor, hslToCssValue, isAuroraFullThemeId, isDonutEmpty, isExactThemeColor, isGroupState, isHexColor, isRankedBarListEmpty, isSegmentationGroup, removeCustomPrimaryColor, sizeMap, themeColors, useAuraToast, useCloseOnAncestorScroll, useMediaQuery, useNavigationLoading, useThemeContext };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { AreaLineChartProps } from "./AreaLineChart.types";
|
|
2
|
-
export declare function AreaLineChart<T extends Record<string, unknown>>({ data, xAxisKey, series, title, value, trend, height, className, wrappedInCard, formatTooltipValue, }: AreaLineChartProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function AreaLineChart<T extends Record<string, unknown>>({ data, xAxisKey, series, title, value, trend, height, className, wrappedInCard, formatTooltipValue, yAxisDomain, }: AreaLineChartProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=AreaLineChart.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AreaLineChart.d.ts","sourceRoot":"","sources":["../../../../src/components/area-line-chart/AreaLineChart.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"AreaLineChart.d.ts","sourceRoot":"","sources":["../../../../src/components/area-line-chart/AreaLineChart.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EACX,kBAAkB,EAElB,MAAM,uBAAuB,CAAC;AAgD/B,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAChE,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,KAAK,EACL,KAAK,EACL,KAAK,EACL,MAAY,EACZ,SAAc,EACd,aAAqB,EACrB,kBAAkB,EAClB,WAAkC,GAClC,EAAE,kBAAkB,CAAC,CAAC,CAAC,2CAoJvB"}
|
|
@@ -27,5 +27,13 @@ export interface AreaLineChartProps<T extends Record<string, unknown> = Record<s
|
|
|
27
27
|
wrappedInCard?: boolean;
|
|
28
28
|
/** Formatear valor en tooltip (valor, dataKey) */
|
|
29
29
|
formatTooltipValue?: (value: number, dataKey: string) => string;
|
|
30
|
+
/**
|
|
31
|
+
* Dominio del eje Y, en el formato de Recharts (acepta números o
|
|
32
|
+
* expresiones como "dataMax + 5"). Si no se envía, se mantiene el
|
|
33
|
+
* comportamiento por defecto del componente (`[0, "dataMax + 100"]`).
|
|
34
|
+
* El cálculo a partir de los datos (ej. máximo real * 1.2) le
|
|
35
|
+
* corresponde a quien consume el componente, no a AreaLineChart.
|
|
36
|
+
*/
|
|
37
|
+
yAxisDomain?: [number | string, number | string];
|
|
30
38
|
}
|
|
31
39
|
//# sourceMappingURL=AreaLineChart.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AreaLineChart.types.d.ts","sourceRoot":"","sources":["../../../../src/components/area-line-chart/AreaLineChart.types.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,MAAM,WAAW,yBAAyB;IACzC,sEAAsE;IACtE,OAAO,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,kBAAkB,
|
|
1
|
+
{"version":3,"file":"AreaLineChart.types.d.ts","sourceRoot":"","sources":["../../../../src/components/area-line-chart/AreaLineChart.types.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,MAAM,WAAW,yBAAyB;IACzC,sEAAsE;IACtE,OAAO,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,kBAAkB,CAClC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAE3D,gFAAgF;IAChF,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,0DAA0D;IAC1D,QAAQ,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC;IAC3B,2CAA2C;IAC3C,MAAM,EAAE,yBAAyB,EAAE,CAAC;IACpC,yBAAyB;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+BAA+B;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uFAAuF;IACvF,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,kDAAkD;IAClD,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;IAChE;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;CACjD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { DonutChartProps } from "./DonutChart.types";
|
|
3
|
+
/**
|
|
4
|
+
* DonutChart - Gráfico circular (pie o donut, según `innerRadiusRatio`) con
|
|
5
|
+
* leyenda y total central propios, renderizados fuera del árbol de Recharts
|
|
6
|
+
* para que sean estables independientemente del tamaño medido del contenedor.
|
|
7
|
+
*/
|
|
8
|
+
export declare const DonutChart: React.FC<DonutChartProps>;
|
|
9
|
+
//# sourceMappingURL=DonutChart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DonutChart.d.ts","sourceRoot":"","sources":["../../../../src/components/donut-chart/DonutChart.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,OAAO,KAAK,EACX,eAAe,EAEf,MAAM,oBAAoB,CAAC;AAQ5B;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA4EhD,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export type DonutChartDatum = {
|
|
2
|
+
/** Nombre de la categoría (se usa como key de React y en la leyenda/tooltip). */
|
|
3
|
+
name: string;
|
|
4
|
+
/** Valor numérico de la categoría. Valores negativos se tratan como 0. */
|
|
5
|
+
value: number;
|
|
6
|
+
/** Color fijo de esta categoría. Si se omite, se resuelve de la paleta por índice. */
|
|
7
|
+
color?: string;
|
|
8
|
+
};
|
|
9
|
+
export type DonutChartSlice = DonutChartDatum & {
|
|
10
|
+
/** Color ya resuelto (propio o de la paleta). */
|
|
11
|
+
color: string;
|
|
12
|
+
/** Proporción sobre el total, entre 0 y 1. */
|
|
13
|
+
percent: number;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Traducciones disponibles para el componente.
|
|
17
|
+
* Todas las propiedades son opcionales para permitir traducciones parciales.
|
|
18
|
+
*/
|
|
19
|
+
export type DonutChartTranslations = {
|
|
20
|
+
/** Texto cuando no hay datos o todos los valores son 0. */
|
|
21
|
+
emptyState?: string;
|
|
22
|
+
/** Etiqueta sobre el total, en el centro del donut (solo si `innerRadiusRatio > 0`). */
|
|
23
|
+
totalLabel?: string;
|
|
24
|
+
};
|
|
25
|
+
export type DonutChartProps = {
|
|
26
|
+
/** Categorías a graficar. */
|
|
27
|
+
data: DonutChartDatum[];
|
|
28
|
+
/** Alto del gráfico en px (el ancho es 100% del contenedor). @default 220 */
|
|
29
|
+
height?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Radio interior como proporción del radio exterior: 0 dibuja un pie
|
|
32
|
+
* completo, valores > 0 dibujan un donut (más alto = anillo más fino).
|
|
33
|
+
* @default 0.65
|
|
34
|
+
*/
|
|
35
|
+
innerRadiusRatio?: number;
|
|
36
|
+
/** Muestra la leyenda con nombre + porcentaje debajo del gráfico. @default true */
|
|
37
|
+
showLegend?: boolean;
|
|
38
|
+
/** Muestra el total en el centro (solo aplica si `innerRadiusRatio > 0`). @default true */
|
|
39
|
+
showTotal?: boolean;
|
|
40
|
+
/** Paleta de color de respaldo, ciclada por índice para categorías sin `color` propio. */
|
|
41
|
+
colors?: string[];
|
|
42
|
+
/** Formateo a medida del valor mostrado en el tooltip/centro (por defecto, el número tal cual). */
|
|
43
|
+
formatValue?: (value: number) => string;
|
|
44
|
+
/**
|
|
45
|
+
* Traducciones i18n del componente.
|
|
46
|
+
* Si no se proporciona, usa traducciones por defecto en español.
|
|
47
|
+
*/
|
|
48
|
+
translations?: DonutChartTranslations;
|
|
49
|
+
className?: string;
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=DonutChart.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DonutChart.types.d.ts","sourceRoot":"","sources":["../../../../src/components/donut-chart/DonutChart.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC7B,iFAAiF;IACjF,IAAI,EAAE,MAAM,CAAC;IACb,0EAA0E;IAC1E,KAAK,EAAE,MAAM,CAAC;IACd,sFAAsF;IACtF,KAAK,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,eAAe,GAAG;IAC/C,iDAAiD;IACjD,KAAK,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,OAAO,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACpC,2DAA2D;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wFAAwF;IACxF,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC7B,6BAA6B;IAC7B,IAAI,EAAE,eAAe,EAAE,CAAC;IACxB,6EAA6E;IAC7E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,mFAAmF;IACnF,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,2FAA2F;IAC3F,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,0FAA0F;IAC1F,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,mGAAmG;IACnG,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACxC;;;OAGG;IACH,YAAY,CAAC,EAAE,sBAAsB,CAAC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC"}
|