@beweco/aurora-ui 0.1.17 → 0.1.20
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 +125 -16
- package/dist/index.esm.js +125 -17
- package/dist/types/components/schedule-row/index.d.ts +2 -1
- package/dist/types/components/schedule-row/index.d.ts.map +1 -1
- package/dist/types/components/schedule-row/schedule-row.constants.d.ts +34 -0
- package/dist/types/components/schedule-row/schedule-row.constants.d.ts.map +1 -0
- package/dist/types/components/schedule-row/schedule-row.d.ts +31 -0
- package/dist/types/components/schedule-row/schedule-row.d.ts.map +1 -1
- package/dist/types/components/schedule-row/schedule-row.types.d.ts +49 -17
- package/dist/types/components/schedule-row/schedule-row.types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -139,7 +139,7 @@ var Input = function (_a) {
|
|
|
139
139
|
} })));
|
|
140
140
|
};
|
|
141
141
|
|
|
142
|
-
var defaultTranslations$
|
|
142
|
+
var defaultTranslations$8 = {
|
|
143
143
|
addHolidayTitle: "Add holiday",
|
|
144
144
|
dayOption: "Day",
|
|
145
145
|
dateRangeOption: "Date range",
|
|
@@ -163,7 +163,7 @@ var INITIAL_HOLIDAY_STATE = {
|
|
|
163
163
|
*/
|
|
164
164
|
var AddHolidayForm = function (_a) {
|
|
165
165
|
var onAddHoliday = _a.onAddHoliday, translations = _a.translations, className = _a.className, radioGroupProps = _a.radioGroupProps, dateRangePickerProps = _a.dateRangePickerProps, buttonProps = _a.buttonProps;
|
|
166
|
-
var t = __assign(__assign({}, defaultTranslations$
|
|
166
|
+
var t = __assign(__assign({}, defaultTranslations$8), translations);
|
|
167
167
|
var _b = React.useState(INITIAL_HOLIDAY_STATE), newHoliday = _b[0], setNewHoliday = _b[1];
|
|
168
168
|
/**
|
|
169
169
|
* A boolean flag that determines if a date has been set.
|
|
@@ -233,7 +233,7 @@ var P = function (_a) {
|
|
|
233
233
|
return (jsxRuntime.jsx("p", __assign({ className: react.cn("text-tiny text-default-500 font-normal", className) }, props, { children: children })));
|
|
234
234
|
};
|
|
235
235
|
|
|
236
|
-
var defaultTranslations$
|
|
236
|
+
var defaultTranslations$7 = {
|
|
237
237
|
title: "Analytics",
|
|
238
238
|
description: "Monthly growth of your metrics during the selected period",
|
|
239
239
|
viewDetails: "View Details",
|
|
@@ -287,7 +287,7 @@ var formatMonth = function (month) {
|
|
|
287
287
|
var AnalyticsCard = function (_a) {
|
|
288
288
|
var _b, _c;
|
|
289
289
|
var data = _a.data, _d = _a.showTimePeriods, showTimePeriods = _d === void 0 ? true : _d, _e = _a.showDropdownMenu, showDropdownMenu = _e === void 0 ? true : _e, _f = _a.showMetricCards, showMetricCards = _f === void 0 ? true : _f, onChartChange = _a.onChartChange, onMenuAction = _a.onMenuAction, onTimePeriodChange = _a.onTimePeriodChange, _g = _a.translations, translations = _g === void 0 ? {} : _g, props = __rest(_a, ["data", "showTimePeriods", "showDropdownMenu", "showMetricCards", "onChartChange", "onMenuAction", "onTimePeriodChange", "translations"]);
|
|
290
|
-
var t = __assign(__assign({}, defaultTranslations$
|
|
290
|
+
var t = __assign(__assign({}, defaultTranslations$7), translations);
|
|
291
291
|
var _h = React.useState((_c = (_b = data[0]) === null || _b === void 0 ? void 0 : _b.key) !== null && _c !== void 0 ? _c : ""), activeChart = _h[0], setActiveChart = _h[1];
|
|
292
292
|
var activeChartData = React.useMemo(function () {
|
|
293
293
|
var _a;
|
|
@@ -952,7 +952,7 @@ var Chip = function (_a) {
|
|
|
952
952
|
};
|
|
953
953
|
|
|
954
954
|
// Traducciones por defecto en español
|
|
955
|
-
var defaultTranslations$
|
|
955
|
+
var defaultTranslations$6 = {
|
|
956
956
|
dayOption: "Día específico",
|
|
957
957
|
dateRangeOption: "Rango de fechas",
|
|
958
958
|
selectDateAriaLabel: "Seleccionar fecha",
|
|
@@ -970,7 +970,7 @@ var DateSelector = function (_a) {
|
|
|
970
970
|
var _f = React.useState(initialDate || null), date = _f[0], setDate = _f[1];
|
|
971
971
|
var _g = React.useState(initialDateRange || null), dateRange = _g[0], setDateRange = _g[1];
|
|
972
972
|
// Combinar traducciones por defecto con las proporcionadas
|
|
973
|
-
var t = __assign(__assign({}, defaultTranslations$
|
|
973
|
+
var t = __assign(__assign({}, defaultTranslations$6), translations);
|
|
974
974
|
var handleTypeChange = function (value) {
|
|
975
975
|
var newType = value;
|
|
976
976
|
setType(newType);
|
|
@@ -1337,13 +1337,13 @@ function $458b0a5536c1a7cf$export$40bfa8c7b0832715(value, defaultValue, onChange
|
|
|
1337
1337
|
];
|
|
1338
1338
|
}
|
|
1339
1339
|
|
|
1340
|
-
var defaultTranslations$
|
|
1340
|
+
var defaultTranslations$5 = {
|
|
1341
1341
|
checkIconTitle: "Check",
|
|
1342
1342
|
};
|
|
1343
1343
|
var VerticalSteps = React.forwardRef(function (_a, ref) {
|
|
1344
1344
|
var _b = _a.color, color = _b === void 0 ? "primary" : _b, _c = _a.steps, stepsProp = _c === void 0 ? [] : _c, _d = _a.defaultStep, defaultStep = _d === void 0 ? 0 : _d, onStepChange = _a.onStepChange, currentStepProp = _a.currentStep, _e = _a.hideProgressBars, hideProgressBars = _e === void 0 ? false : _e, stepClassName = _a.stepClassName, className = _a.className, translations = _a.translations, props = __rest(_a, ["color", "steps", "defaultStep", "onStepChange", "currentStep", "hideProgressBars", "stepClassName", "className", "translations"]);
|
|
1345
1345
|
var _f = $458b0a5536c1a7cf$export$40bfa8c7b0832715(currentStepProp, defaultStep, onStepChange), currentStep = _f[0], setCurrentStep = _f[1];
|
|
1346
|
-
var t = __assign(__assign({}, defaultTranslations$
|
|
1346
|
+
var t = __assign(__assign({}, defaultTranslations$5), translations);
|
|
1347
1347
|
var steps = React.useMemo(function () {
|
|
1348
1348
|
if (typeof stepsProp === "number") {
|
|
1349
1349
|
return Array.from({ length: stepsProp }, function () { return ({}); });
|
|
@@ -1592,7 +1592,7 @@ var countries = [
|
|
|
1592
1592
|
];
|
|
1593
1593
|
var uniqueCountries = Array.from(new Map(countries.map(function (item) { return [item.code + item.name, item]; })).values());
|
|
1594
1594
|
// Traducciones por defecto
|
|
1595
|
-
var defaultTranslations$
|
|
1595
|
+
var defaultTranslations$4 = {
|
|
1596
1596
|
label: "Teléfono",
|
|
1597
1597
|
placeholder: "Número de teléfono",
|
|
1598
1598
|
searchPlaceholder: "Buscar país...",
|
|
@@ -1610,7 +1610,7 @@ var Phone = function (_a) {
|
|
|
1610
1610
|
var portalDropdownRef = React.useRef(null);
|
|
1611
1611
|
var _l = React.useState({}), dropdownPosition = _l[0], setDropdownPosition = _l[1];
|
|
1612
1612
|
var _m = React.useState(uniqueCountries), filteredCountries = _m[0], setFilteredCountries = _m[1];
|
|
1613
|
-
var t = __assign(__assign({}, defaultTranslations$
|
|
1613
|
+
var t = __assign(__assign({}, defaultTranslations$4), translations);
|
|
1614
1614
|
var finalLabel = label || t.label;
|
|
1615
1615
|
React.useEffect(function () {
|
|
1616
1616
|
if (value) {
|
|
@@ -1689,7 +1689,7 @@ var Phone = function (_a) {
|
|
|
1689
1689
|
: ""), 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 text-default-500", children: country.name }), jsxRuntime.jsx("span", { className: "text-xs text-default-500", children: country.code })] }, country.code)); })) : (jsxRuntime.jsx("div", { className: "px-4 py-2 text-sm text-default-500", children: t.noCountriesFound })) })] }), document.body)] }));
|
|
1690
1690
|
};
|
|
1691
1691
|
|
|
1692
|
-
var defaultTranslations$
|
|
1692
|
+
var defaultTranslations$3 = {
|
|
1693
1693
|
message: "The Winter 2024 Release is here: new editor, analytics API, and so much more.",
|
|
1694
1694
|
buttonText: "Explore",
|
|
1695
1695
|
closeButtonLabel: "Close Banner",
|
|
@@ -1699,7 +1699,7 @@ var defaultTranslations$2 = {
|
|
|
1699
1699
|
*/
|
|
1700
1700
|
var PromotionalBanner = function (_a) {
|
|
1701
1701
|
var message = _a.message, buttonText = _a.buttonText, _b = _a.messageHref, messageHref = _b === void 0 ? "#" : _b, _c = _a.buttonHref, buttonHref = _c === void 0 ? "#" : _c, _d = _a.showCloseButton, showCloseButton = _d === void 0 ? true : _d, _e = _a.isVisible, isVisible = _e === void 0 ? true : _e, _f = _a.gradientColors, gradientColors = _f === void 0 ? ["default-100", "danger-100", "secondary-100"] : _f, _g = _a.buttonGradientColors, buttonGradientColors = _g === void 0 ? ["#F871A0", "#9353D3"] : _g, onClose = _a.onClose, onMessageClick = _a.onMessageClick, onButtonClick = _a.onButtonClick, _h = _a.messageLinkProps, messageLinkProps = _h === void 0 ? {} : _h, _j = _a.buttonProps, buttonProps = _j === void 0 ? {} : _j, _k = _a.translations, translations = _k === void 0 ? {} : _k;
|
|
1702
|
-
var t = __assign(__assign({}, defaultTranslations$
|
|
1702
|
+
var t = __assign(__assign({}, defaultTranslations$3), translations);
|
|
1703
1703
|
var finalMessage = message || t.message;
|
|
1704
1704
|
var finalButtonText = buttonText || t.buttonText;
|
|
1705
1705
|
var handleClose = function () {
|
|
@@ -1997,6 +1997,52 @@ var TimeInput = function (_a) {
|
|
|
1997
1997
|
} })));
|
|
1998
1998
|
};
|
|
1999
1999
|
|
|
2000
|
+
/**
|
|
2001
|
+
* @file schedule-row.constants.ts
|
|
2002
|
+
* @description Default translations for the ScheduleRow component.
|
|
2003
|
+
* These translations are used when no custom translations are provided via props.
|
|
2004
|
+
* The component supports full internationalization by overriding these defaults.
|
|
2005
|
+
*/
|
|
2006
|
+
/**
|
|
2007
|
+
* @constant defaultTranslations
|
|
2008
|
+
* @description Default translations in Spanish for the ScheduleRow component.
|
|
2009
|
+
* These can be overridden by passing a `translations` prop to the component.
|
|
2010
|
+
*
|
|
2011
|
+
* @example
|
|
2012
|
+
* ```tsx
|
|
2013
|
+
* // Using default Spanish translations
|
|
2014
|
+
* <ScheduleRow day="Lunes" daySchedule={...} />
|
|
2015
|
+
*
|
|
2016
|
+
* // Overriding with English translations
|
|
2017
|
+
* <ScheduleRow
|
|
2018
|
+
* day="Monday"
|
|
2019
|
+
* daySchedule={...}
|
|
2020
|
+
* translations={{
|
|
2021
|
+
* from: "From",
|
|
2022
|
+
* to: "To",
|
|
2023
|
+
* open: "Open",
|
|
2024
|
+
* closed: "Closed",
|
|
2025
|
+
* copyToAll: "Copy to all",
|
|
2026
|
+
* addTimeSlot: "Add time slot"
|
|
2027
|
+
* }}
|
|
2028
|
+
* />
|
|
2029
|
+
* ```
|
|
2030
|
+
*/
|
|
2031
|
+
var defaultTranslations$2 = {
|
|
2032
|
+
/** Label for the start time input field */
|
|
2033
|
+
from: "Desde",
|
|
2034
|
+
/** Label for the end time input field */
|
|
2035
|
+
to: "Hasta",
|
|
2036
|
+
/** Label shown when the day is active/open */
|
|
2037
|
+
open: "Abierto",
|
|
2038
|
+
/** Label shown when the day is inactive/closed */
|
|
2039
|
+
closed: "Cerrado",
|
|
2040
|
+
/** Label for the button that copies schedule to all days */
|
|
2041
|
+
copyToAll: "Copiar a todos",
|
|
2042
|
+
/** Label for the button that adds a new time slot */
|
|
2043
|
+
addTimeSlot: "Agregar horario",
|
|
2044
|
+
};
|
|
2045
|
+
|
|
2000
2046
|
/**
|
|
2001
2047
|
* @component ScheduleRow
|
|
2002
2048
|
* @description A React component for managing the schedule of a single day.
|
|
@@ -2004,11 +2050,43 @@ var TimeInput = function (_a) {
|
|
|
2004
2050
|
* and modify the start and end times of each slot. The component is fully
|
|
2005
2051
|
* controlled and reports changes to the parent via the `onChange` callback.
|
|
2006
2052
|
*
|
|
2053
|
+
* Features:
|
|
2054
|
+
* - Toggle day open/closed status
|
|
2055
|
+
* - Add multiple time slots per day
|
|
2056
|
+
* - Edit start (from) and end (to) times for each slot
|
|
2057
|
+
* - Remove time slots (with minimum of one slot)
|
|
2058
|
+
* - Automatic validation to prevent invalid time ranges (from > to)
|
|
2059
|
+
* - Copy schedule to all days functionality
|
|
2060
|
+
* - Always displays an empty slot for adding new times
|
|
2061
|
+
* - Internationalization support via translations prop
|
|
2062
|
+
*
|
|
2063
|
+
* @example
|
|
2064
|
+
* ```tsx
|
|
2065
|
+
* <ScheduleRow
|
|
2066
|
+
* day="Monday"
|
|
2067
|
+
* daySchedule={{
|
|
2068
|
+
* isOpen: true,
|
|
2069
|
+
* timeSlots: [{ from: "09:00", to: "17:00" }]
|
|
2070
|
+
* }}
|
|
2071
|
+
* translations={{
|
|
2072
|
+
* from: "From",
|
|
2073
|
+
* to: "To",
|
|
2074
|
+
* open: "Open",
|
|
2075
|
+
* closed: "Closed",
|
|
2076
|
+
* copyToAll: "Copy to all",
|
|
2077
|
+
* addTimeSlot: "Add time slot"
|
|
2078
|
+
* }}
|
|
2079
|
+
* onChange={(newSchedule) => console.log(newSchedule)}
|
|
2080
|
+
* onCopyToAll={(day) => console.log(`Copy from ${day}`)}
|
|
2081
|
+
* />
|
|
2082
|
+
* ```
|
|
2083
|
+
*
|
|
2007
2084
|
* @param {ScheduleRowProps} props - The props for the component.
|
|
2008
2085
|
* @returns {React.ReactElement} The rendered ScheduleRow component.
|
|
2009
2086
|
*/
|
|
2010
2087
|
var ScheduleRow = function (_a) {
|
|
2011
|
-
var day = _a.day, daySchedule = _a.daySchedule,
|
|
2088
|
+
var day = _a.day, daySchedule = _a.daySchedule, _b = _a.translations, translations = _b === void 0 ? {} : _b, _c = _a.showCopyToAll, showCopyToAll = _c === void 0 ? false : _c, onChange = _a.onChange, onCopyToAll = _a.onCopyToAll;
|
|
2089
|
+
var t = __assign(__assign({}, defaultTranslations$2), translations);
|
|
2012
2090
|
/**
|
|
2013
2091
|
* @function validateTimeSlots
|
|
2014
2092
|
* @description Validates all time slots to ensure the "from" time is not after the "to" time.
|
|
@@ -2070,28 +2148,58 @@ var ScheduleRow = function (_a) {
|
|
|
2070
2148
|
var handleTimeChange = function (index, field, value) {
|
|
2071
2149
|
var _a;
|
|
2072
2150
|
var newTimeSlots = __spreadArray([], daySchedule.timeSlots, true);
|
|
2151
|
+
// Update the specific field
|
|
2073
2152
|
newTimeSlots[index] = __assign(__assign({}, newTimeSlots[index]), (_a = {}, _a[field] = fromTimeValue(value), _a));
|
|
2074
2153
|
var validatedSlots = validateTimeSlots(newTimeSlots);
|
|
2075
2154
|
onChange(__assign(__assign({}, daySchedule), { timeSlots: validatedSlots }));
|
|
2076
2155
|
};
|
|
2077
2156
|
/**
|
|
2078
2157
|
* @function handleAddTimeSlot
|
|
2079
|
-
* @description Adds a new
|
|
2158
|
+
* @description Adds a new empty time slot when the + button is clicked.
|
|
2159
|
+
* The button is only enabled when the last slot is filled, so no validation needed here.
|
|
2080
2160
|
*/
|
|
2081
2161
|
var handleAddTimeSlot = function () {
|
|
2162
|
+
// Add a new empty slot
|
|
2082
2163
|
var newTimeSlots = __spreadArray(__spreadArray([], daySchedule.timeSlots, true), [{ from: "", to: "" }], false);
|
|
2083
|
-
|
|
2164
|
+
var validatedSlots = validateTimeSlots(newTimeSlots);
|
|
2165
|
+
onChange(__assign(__assign({}, daySchedule), { timeSlots: validatedSlots }));
|
|
2084
2166
|
};
|
|
2085
2167
|
/**
|
|
2086
2168
|
* @function handleRemoveTimeSlot
|
|
2087
2169
|
* @description Removes a time slot from the schedule at the specified index.
|
|
2170
|
+
* Ensures at least one empty slot remains.
|
|
2088
2171
|
* @param {number} index - The index of the time slot to remove.
|
|
2089
2172
|
*/
|
|
2090
2173
|
var handleRemoveTimeSlot = function (index) {
|
|
2091
2174
|
var newTimeSlots = daySchedule.timeSlots.filter(function (_, i) { return i !== index; });
|
|
2175
|
+
// Ensure there's always at least one slot (empty if needed)
|
|
2176
|
+
if (newTimeSlots.length === 0) {
|
|
2177
|
+
newTimeSlots = [{ from: "", to: "" }];
|
|
2178
|
+
}
|
|
2092
2179
|
onChange(__assign(__assign({}, daySchedule), { timeSlots: newTimeSlots }));
|
|
2093
2180
|
};
|
|
2094
|
-
|
|
2181
|
+
/**
|
|
2182
|
+
* @function getSlotsToDisplay
|
|
2183
|
+
* @description Returns the time slots to display exactly as they are in the schedule.
|
|
2184
|
+
* No automatic additions - slots are only added when the user clicks the + button.
|
|
2185
|
+
* @returns {TimeSlot[]} The time slots to display.
|
|
2186
|
+
*/
|
|
2187
|
+
var getSlotsToDisplay = function () {
|
|
2188
|
+
var slots = daySchedule.timeSlots;
|
|
2189
|
+
// If there are no slots, return one empty slot to start
|
|
2190
|
+
if (slots.length === 0) {
|
|
2191
|
+
return [{ from: "", to: "" }];
|
|
2192
|
+
}
|
|
2193
|
+
// Return slots exactly as they are - no automatic additions
|
|
2194
|
+
return slots;
|
|
2195
|
+
};
|
|
2196
|
+
return (jsxRuntime.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: [jsxRuntime.jsxs("div", { className: "flex w-full items-center justify-between", children: [jsxRuntime.jsxs("div", { className: "flex xs:space-x-2 sm:space-x-4", children: [jsxRuntime.jsx("h3", { className: "text-small font-semibold text-default-900 capitalize", children: day }), jsxRuntime.jsx(react.Chip, { size: "sm", color: daySchedule.isOpen ? "primary" : "default", className: "text-background", children: daySchedule.isOpen ? t.open : t.closed })] }), jsxRuntime.jsxs("div", { className: "flex xs:gap-2 sm:gap-5", children: [jsxRuntime.jsx(Switch, { size: "sm", color: "primary", isSelected: daySchedule.isOpen, onValueChange: handleToggleDay }), showCopyToAll && onCopyToAll && (jsxRuntime.jsx(Button, { size: "sm", variant: "bordered", onPress: function () { return onCopyToAll(day); }, children: t.copyToAll }))] })] }), daySchedule.isOpen && (jsxRuntime.jsx("div", { className: "flex flex-col justify-around gap-y-3 ", children: getSlotsToDisplay().map(function (slot, index) {
|
|
2197
|
+
var slotsToDisplay = getSlotsToDisplay();
|
|
2198
|
+
var isLastSlot = index === slotsToDisplay.length - 1;
|
|
2199
|
+
var isSlotFilled = slot.from && slot.to;
|
|
2200
|
+
var canDelete = slotsToDisplay.length > 1;
|
|
2201
|
+
return (jsxRuntime.jsxs("div", { className: "flex items-center gap-1 w-full justify-between", children: [jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-1", children: [jsxRuntime.jsx(TimeInput, { label: t.from, className: "w-full", value: toTimeValue(slot.from), onChange: function (value) { return handleTimeChange(index, "from", value); }, isInvalid: !!slot.error }), jsxRuntime.jsx("span", { className: "text-default-900 xs:hidden xl:block", children: "-" }), jsxRuntime.jsx(TimeInput, { label: t.to, className: "w-full", value: toTimeValue(slot.to), onChange: function (value) { return handleTimeChange(index, "to", value); }, isInvalid: !!slot.error, errorMessage: slot.error })] }), isLastSlot ? (jsxRuntime.jsx(Button, { isIconOnly: true, size: "sm", color: "primary", variant: "light", onPress: handleAddTimeSlot, isDisabled: !isSlotFilled, startContent: jsxRuntime.jsx(IconComponent, { icon: "solar:add-circle-bold" }) })) : (jsxRuntime.jsx(Button, { isIconOnly: true, size: "sm", color: "danger", variant: "light", onPress: function () { return handleRemoveTimeSlot(index); }, isDisabled: !canDelete, startContent: jsxRuntime.jsx(IconComponent, { icon: "solar:trash-bin-minimalistic-outline" }) }))] }, "".concat(day, "-timeslot-").concat(index)));
|
|
2202
|
+
}) }))] }, day));
|
|
2095
2203
|
};
|
|
2096
2204
|
|
|
2097
2205
|
/**
|
|
@@ -3393,6 +3501,7 @@ exports.TimeInputComponent = TimeInput;
|
|
|
3393
3501
|
exports.ToastContext = ToastContext;
|
|
3394
3502
|
exports.UploadFile = UploadFile;
|
|
3395
3503
|
exports.VerticalSteps = VerticalSteps;
|
|
3504
|
+
exports.defaultTranslations = defaultTranslations$2;
|
|
3396
3505
|
exports.sizeMap = sizeMap;
|
|
3397
3506
|
exports.themeColors = themeColors;
|
|
3398
3507
|
exports.useAuraToast = useAuraToast;
|
package/dist/index.esm.js
CHANGED
|
@@ -140,7 +140,7 @@ var Input = function (_a) {
|
|
|
140
140
|
} })));
|
|
141
141
|
};
|
|
142
142
|
|
|
143
|
-
var defaultTranslations$
|
|
143
|
+
var defaultTranslations$8 = {
|
|
144
144
|
addHolidayTitle: "Add holiday",
|
|
145
145
|
dayOption: "Day",
|
|
146
146
|
dateRangeOption: "Date range",
|
|
@@ -164,7 +164,7 @@ var INITIAL_HOLIDAY_STATE = {
|
|
|
164
164
|
*/
|
|
165
165
|
var AddHolidayForm = function (_a) {
|
|
166
166
|
var onAddHoliday = _a.onAddHoliday, translations = _a.translations, className = _a.className, radioGroupProps = _a.radioGroupProps, dateRangePickerProps = _a.dateRangePickerProps, buttonProps = _a.buttonProps;
|
|
167
|
-
var t = __assign(__assign({}, defaultTranslations$
|
|
167
|
+
var t = __assign(__assign({}, defaultTranslations$8), translations);
|
|
168
168
|
var _b = useState(INITIAL_HOLIDAY_STATE), newHoliday = _b[0], setNewHoliday = _b[1];
|
|
169
169
|
/**
|
|
170
170
|
* A boolean flag that determines if a date has been set.
|
|
@@ -234,7 +234,7 @@ var P = function (_a) {
|
|
|
234
234
|
return (jsx("p", __assign({ className: cn("text-tiny text-default-500 font-normal", className) }, props, { children: children })));
|
|
235
235
|
};
|
|
236
236
|
|
|
237
|
-
var defaultTranslations$
|
|
237
|
+
var defaultTranslations$7 = {
|
|
238
238
|
title: "Analytics",
|
|
239
239
|
description: "Monthly growth of your metrics during the selected period",
|
|
240
240
|
viewDetails: "View Details",
|
|
@@ -288,7 +288,7 @@ var formatMonth = function (month) {
|
|
|
288
288
|
var AnalyticsCard = function (_a) {
|
|
289
289
|
var _b, _c;
|
|
290
290
|
var data = _a.data, _d = _a.showTimePeriods, showTimePeriods = _d === void 0 ? true : _d, _e = _a.showDropdownMenu, showDropdownMenu = _e === void 0 ? true : _e, _f = _a.showMetricCards, showMetricCards = _f === void 0 ? true : _f, onChartChange = _a.onChartChange, onMenuAction = _a.onMenuAction, onTimePeriodChange = _a.onTimePeriodChange, _g = _a.translations, translations = _g === void 0 ? {} : _g, props = __rest(_a, ["data", "showTimePeriods", "showDropdownMenu", "showMetricCards", "onChartChange", "onMenuAction", "onTimePeriodChange", "translations"]);
|
|
291
|
-
var t = __assign(__assign({}, defaultTranslations$
|
|
291
|
+
var t = __assign(__assign({}, defaultTranslations$7), translations);
|
|
292
292
|
var _h = useState((_c = (_b = data[0]) === null || _b === void 0 ? void 0 : _b.key) !== null && _c !== void 0 ? _c : ""), activeChart = _h[0], setActiveChart = _h[1];
|
|
293
293
|
var activeChartData = useMemo(function () {
|
|
294
294
|
var _a;
|
|
@@ -953,7 +953,7 @@ var Chip = function (_a) {
|
|
|
953
953
|
};
|
|
954
954
|
|
|
955
955
|
// Traducciones por defecto en español
|
|
956
|
-
var defaultTranslations$
|
|
956
|
+
var defaultTranslations$6 = {
|
|
957
957
|
dayOption: "Día específico",
|
|
958
958
|
dateRangeOption: "Rango de fechas",
|
|
959
959
|
selectDateAriaLabel: "Seleccionar fecha",
|
|
@@ -971,7 +971,7 @@ var DateSelector = function (_a) {
|
|
|
971
971
|
var _f = React.useState(initialDate || null), date = _f[0], setDate = _f[1];
|
|
972
972
|
var _g = React.useState(initialDateRange || null), dateRange = _g[0], setDateRange = _g[1];
|
|
973
973
|
// Combinar traducciones por defecto con las proporcionadas
|
|
974
|
-
var t = __assign(__assign({}, defaultTranslations$
|
|
974
|
+
var t = __assign(__assign({}, defaultTranslations$6), translations);
|
|
975
975
|
var handleTypeChange = function (value) {
|
|
976
976
|
var newType = value;
|
|
977
977
|
setType(newType);
|
|
@@ -1338,13 +1338,13 @@ function $458b0a5536c1a7cf$export$40bfa8c7b0832715(value, defaultValue, onChange
|
|
|
1338
1338
|
];
|
|
1339
1339
|
}
|
|
1340
1340
|
|
|
1341
|
-
var defaultTranslations$
|
|
1341
|
+
var defaultTranslations$5 = {
|
|
1342
1342
|
checkIconTitle: "Check",
|
|
1343
1343
|
};
|
|
1344
1344
|
var VerticalSteps = React.forwardRef(function (_a, ref) {
|
|
1345
1345
|
var _b = _a.color, color = _b === void 0 ? "primary" : _b, _c = _a.steps, stepsProp = _c === void 0 ? [] : _c, _d = _a.defaultStep, defaultStep = _d === void 0 ? 0 : _d, onStepChange = _a.onStepChange, currentStepProp = _a.currentStep, _e = _a.hideProgressBars, hideProgressBars = _e === void 0 ? false : _e, stepClassName = _a.stepClassName, className = _a.className, translations = _a.translations, props = __rest(_a, ["color", "steps", "defaultStep", "onStepChange", "currentStep", "hideProgressBars", "stepClassName", "className", "translations"]);
|
|
1346
1346
|
var _f = $458b0a5536c1a7cf$export$40bfa8c7b0832715(currentStepProp, defaultStep, onStepChange), currentStep = _f[0], setCurrentStep = _f[1];
|
|
1347
|
-
var t = __assign(__assign({}, defaultTranslations$
|
|
1347
|
+
var t = __assign(__assign({}, defaultTranslations$5), translations);
|
|
1348
1348
|
var steps = React.useMemo(function () {
|
|
1349
1349
|
if (typeof stepsProp === "number") {
|
|
1350
1350
|
return Array.from({ length: stepsProp }, function () { return ({}); });
|
|
@@ -1593,7 +1593,7 @@ var countries = [
|
|
|
1593
1593
|
];
|
|
1594
1594
|
var uniqueCountries = Array.from(new Map(countries.map(function (item) { return [item.code + item.name, item]; })).values());
|
|
1595
1595
|
// Traducciones por defecto
|
|
1596
|
-
var defaultTranslations$
|
|
1596
|
+
var defaultTranslations$4 = {
|
|
1597
1597
|
label: "Teléfono",
|
|
1598
1598
|
placeholder: "Número de teléfono",
|
|
1599
1599
|
searchPlaceholder: "Buscar país...",
|
|
@@ -1611,7 +1611,7 @@ var Phone = function (_a) {
|
|
|
1611
1611
|
var portalDropdownRef = useRef(null);
|
|
1612
1612
|
var _l = useState({}), dropdownPosition = _l[0], setDropdownPosition = _l[1];
|
|
1613
1613
|
var _m = useState(uniqueCountries), filteredCountries = _m[0], setFilteredCountries = _m[1];
|
|
1614
|
-
var t = __assign(__assign({}, defaultTranslations$
|
|
1614
|
+
var t = __assign(__assign({}, defaultTranslations$4), translations);
|
|
1615
1615
|
var finalLabel = label || t.label;
|
|
1616
1616
|
useEffect(function () {
|
|
1617
1617
|
if (value) {
|
|
@@ -1690,7 +1690,7 @@ var Phone = function (_a) {
|
|
|
1690
1690
|
: ""), onClick: function () { return handleCountrySelect(country); }, children: [jsx("span", { className: "mr-3 text-lg", children: country.flag }), jsx("span", { className: "flex-1 text-left text-default-500", children: country.name }), jsx("span", { className: "text-xs text-default-500", children: country.code })] }, country.code)); })) : (jsx("div", { className: "px-4 py-2 text-sm text-default-500", children: t.noCountriesFound })) })] }), document.body)] }));
|
|
1691
1691
|
};
|
|
1692
1692
|
|
|
1693
|
-
var defaultTranslations$
|
|
1693
|
+
var defaultTranslations$3 = {
|
|
1694
1694
|
message: "The Winter 2024 Release is here: new editor, analytics API, and so much more.",
|
|
1695
1695
|
buttonText: "Explore",
|
|
1696
1696
|
closeButtonLabel: "Close Banner",
|
|
@@ -1700,7 +1700,7 @@ var defaultTranslations$2 = {
|
|
|
1700
1700
|
*/
|
|
1701
1701
|
var PromotionalBanner = function (_a) {
|
|
1702
1702
|
var message = _a.message, buttonText = _a.buttonText, _b = _a.messageHref, messageHref = _b === void 0 ? "#" : _b, _c = _a.buttonHref, buttonHref = _c === void 0 ? "#" : _c, _d = _a.showCloseButton, showCloseButton = _d === void 0 ? true : _d, _e = _a.isVisible, isVisible = _e === void 0 ? true : _e, _f = _a.gradientColors, gradientColors = _f === void 0 ? ["default-100", "danger-100", "secondary-100"] : _f, _g = _a.buttonGradientColors, buttonGradientColors = _g === void 0 ? ["#F871A0", "#9353D3"] : _g, onClose = _a.onClose, onMessageClick = _a.onMessageClick, onButtonClick = _a.onButtonClick, _h = _a.messageLinkProps, messageLinkProps = _h === void 0 ? {} : _h, _j = _a.buttonProps, buttonProps = _j === void 0 ? {} : _j, _k = _a.translations, translations = _k === void 0 ? {} : _k;
|
|
1703
|
-
var t = __assign(__assign({}, defaultTranslations$
|
|
1703
|
+
var t = __assign(__assign({}, defaultTranslations$3), translations);
|
|
1704
1704
|
var finalMessage = message || t.message;
|
|
1705
1705
|
var finalButtonText = buttonText || t.buttonText;
|
|
1706
1706
|
var handleClose = function () {
|
|
@@ -1998,6 +1998,52 @@ var TimeInput = function (_a) {
|
|
|
1998
1998
|
} })));
|
|
1999
1999
|
};
|
|
2000
2000
|
|
|
2001
|
+
/**
|
|
2002
|
+
* @file schedule-row.constants.ts
|
|
2003
|
+
* @description Default translations for the ScheduleRow component.
|
|
2004
|
+
* These translations are used when no custom translations are provided via props.
|
|
2005
|
+
* The component supports full internationalization by overriding these defaults.
|
|
2006
|
+
*/
|
|
2007
|
+
/**
|
|
2008
|
+
* @constant defaultTranslations
|
|
2009
|
+
* @description Default translations in Spanish for the ScheduleRow component.
|
|
2010
|
+
* These can be overridden by passing a `translations` prop to the component.
|
|
2011
|
+
*
|
|
2012
|
+
* @example
|
|
2013
|
+
* ```tsx
|
|
2014
|
+
* // Using default Spanish translations
|
|
2015
|
+
* <ScheduleRow day="Lunes" daySchedule={...} />
|
|
2016
|
+
*
|
|
2017
|
+
* // Overriding with English translations
|
|
2018
|
+
* <ScheduleRow
|
|
2019
|
+
* day="Monday"
|
|
2020
|
+
* daySchedule={...}
|
|
2021
|
+
* translations={{
|
|
2022
|
+
* from: "From",
|
|
2023
|
+
* to: "To",
|
|
2024
|
+
* open: "Open",
|
|
2025
|
+
* closed: "Closed",
|
|
2026
|
+
* copyToAll: "Copy to all",
|
|
2027
|
+
* addTimeSlot: "Add time slot"
|
|
2028
|
+
* }}
|
|
2029
|
+
* />
|
|
2030
|
+
* ```
|
|
2031
|
+
*/
|
|
2032
|
+
var defaultTranslations$2 = {
|
|
2033
|
+
/** Label for the start time input field */
|
|
2034
|
+
from: "Desde",
|
|
2035
|
+
/** Label for the end time input field */
|
|
2036
|
+
to: "Hasta",
|
|
2037
|
+
/** Label shown when the day is active/open */
|
|
2038
|
+
open: "Abierto",
|
|
2039
|
+
/** Label shown when the day is inactive/closed */
|
|
2040
|
+
closed: "Cerrado",
|
|
2041
|
+
/** Label for the button that copies schedule to all days */
|
|
2042
|
+
copyToAll: "Copiar a todos",
|
|
2043
|
+
/** Label for the button that adds a new time slot */
|
|
2044
|
+
addTimeSlot: "Agregar horario",
|
|
2045
|
+
};
|
|
2046
|
+
|
|
2001
2047
|
/**
|
|
2002
2048
|
* @component ScheduleRow
|
|
2003
2049
|
* @description A React component for managing the schedule of a single day.
|
|
@@ -2005,11 +2051,43 @@ var TimeInput = function (_a) {
|
|
|
2005
2051
|
* and modify the start and end times of each slot. The component is fully
|
|
2006
2052
|
* controlled and reports changes to the parent via the `onChange` callback.
|
|
2007
2053
|
*
|
|
2054
|
+
* Features:
|
|
2055
|
+
* - Toggle day open/closed status
|
|
2056
|
+
* - Add multiple time slots per day
|
|
2057
|
+
* - Edit start (from) and end (to) times for each slot
|
|
2058
|
+
* - Remove time slots (with minimum of one slot)
|
|
2059
|
+
* - Automatic validation to prevent invalid time ranges (from > to)
|
|
2060
|
+
* - Copy schedule to all days functionality
|
|
2061
|
+
* - Always displays an empty slot for adding new times
|
|
2062
|
+
* - Internationalization support via translations prop
|
|
2063
|
+
*
|
|
2064
|
+
* @example
|
|
2065
|
+
* ```tsx
|
|
2066
|
+
* <ScheduleRow
|
|
2067
|
+
* day="Monday"
|
|
2068
|
+
* daySchedule={{
|
|
2069
|
+
* isOpen: true,
|
|
2070
|
+
* timeSlots: [{ from: "09:00", to: "17:00" }]
|
|
2071
|
+
* }}
|
|
2072
|
+
* translations={{
|
|
2073
|
+
* from: "From",
|
|
2074
|
+
* to: "To",
|
|
2075
|
+
* open: "Open",
|
|
2076
|
+
* closed: "Closed",
|
|
2077
|
+
* copyToAll: "Copy to all",
|
|
2078
|
+
* addTimeSlot: "Add time slot"
|
|
2079
|
+
* }}
|
|
2080
|
+
* onChange={(newSchedule) => console.log(newSchedule)}
|
|
2081
|
+
* onCopyToAll={(day) => console.log(`Copy from ${day}`)}
|
|
2082
|
+
* />
|
|
2083
|
+
* ```
|
|
2084
|
+
*
|
|
2008
2085
|
* @param {ScheduleRowProps} props - The props for the component.
|
|
2009
2086
|
* @returns {React.ReactElement} The rendered ScheduleRow component.
|
|
2010
2087
|
*/
|
|
2011
2088
|
var ScheduleRow = function (_a) {
|
|
2012
|
-
var day = _a.day, daySchedule = _a.daySchedule,
|
|
2089
|
+
var day = _a.day, daySchedule = _a.daySchedule, _b = _a.translations, translations = _b === void 0 ? {} : _b, _c = _a.showCopyToAll, showCopyToAll = _c === void 0 ? false : _c, onChange = _a.onChange, onCopyToAll = _a.onCopyToAll;
|
|
2090
|
+
var t = __assign(__assign({}, defaultTranslations$2), translations);
|
|
2013
2091
|
/**
|
|
2014
2092
|
* @function validateTimeSlots
|
|
2015
2093
|
* @description Validates all time slots to ensure the "from" time is not after the "to" time.
|
|
@@ -2071,28 +2149,58 @@ var ScheduleRow = function (_a) {
|
|
|
2071
2149
|
var handleTimeChange = function (index, field, value) {
|
|
2072
2150
|
var _a;
|
|
2073
2151
|
var newTimeSlots = __spreadArray([], daySchedule.timeSlots, true);
|
|
2152
|
+
// Update the specific field
|
|
2074
2153
|
newTimeSlots[index] = __assign(__assign({}, newTimeSlots[index]), (_a = {}, _a[field] = fromTimeValue(value), _a));
|
|
2075
2154
|
var validatedSlots = validateTimeSlots(newTimeSlots);
|
|
2076
2155
|
onChange(__assign(__assign({}, daySchedule), { timeSlots: validatedSlots }));
|
|
2077
2156
|
};
|
|
2078
2157
|
/**
|
|
2079
2158
|
* @function handleAddTimeSlot
|
|
2080
|
-
* @description Adds a new
|
|
2159
|
+
* @description Adds a new empty time slot when the + button is clicked.
|
|
2160
|
+
* The button is only enabled when the last slot is filled, so no validation needed here.
|
|
2081
2161
|
*/
|
|
2082
2162
|
var handleAddTimeSlot = function () {
|
|
2163
|
+
// Add a new empty slot
|
|
2083
2164
|
var newTimeSlots = __spreadArray(__spreadArray([], daySchedule.timeSlots, true), [{ from: "", to: "" }], false);
|
|
2084
|
-
|
|
2165
|
+
var validatedSlots = validateTimeSlots(newTimeSlots);
|
|
2166
|
+
onChange(__assign(__assign({}, daySchedule), { timeSlots: validatedSlots }));
|
|
2085
2167
|
};
|
|
2086
2168
|
/**
|
|
2087
2169
|
* @function handleRemoveTimeSlot
|
|
2088
2170
|
* @description Removes a time slot from the schedule at the specified index.
|
|
2171
|
+
* Ensures at least one empty slot remains.
|
|
2089
2172
|
* @param {number} index - The index of the time slot to remove.
|
|
2090
2173
|
*/
|
|
2091
2174
|
var handleRemoveTimeSlot = function (index) {
|
|
2092
2175
|
var newTimeSlots = daySchedule.timeSlots.filter(function (_, i) { return i !== index; });
|
|
2176
|
+
// Ensure there's always at least one slot (empty if needed)
|
|
2177
|
+
if (newTimeSlots.length === 0) {
|
|
2178
|
+
newTimeSlots = [{ from: "", to: "" }];
|
|
2179
|
+
}
|
|
2093
2180
|
onChange(__assign(__assign({}, daySchedule), { timeSlots: newTimeSlots }));
|
|
2094
2181
|
};
|
|
2095
|
-
|
|
2182
|
+
/**
|
|
2183
|
+
* @function getSlotsToDisplay
|
|
2184
|
+
* @description Returns the time slots to display exactly as they are in the schedule.
|
|
2185
|
+
* No automatic additions - slots are only added when the user clicks the + button.
|
|
2186
|
+
* @returns {TimeSlot[]} The time slots to display.
|
|
2187
|
+
*/
|
|
2188
|
+
var getSlotsToDisplay = function () {
|
|
2189
|
+
var slots = daySchedule.timeSlots;
|
|
2190
|
+
// If there are no slots, return one empty slot to start
|
|
2191
|
+
if (slots.length === 0) {
|
|
2192
|
+
return [{ from: "", to: "" }];
|
|
2193
|
+
}
|
|
2194
|
+
// Return slots exactly as they are - no automatic additions
|
|
2195
|
+
return slots;
|
|
2196
|
+
};
|
|
2197
|
+
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) {
|
|
2198
|
+
var slotsToDisplay = getSlotsToDisplay();
|
|
2199
|
+
var isLastSlot = index === slotsToDisplay.length - 1;
|
|
2200
|
+
var isSlotFilled = slot.from && slot.to;
|
|
2201
|
+
var canDelete = slotsToDisplay.length > 1;
|
|
2202
|
+
return (jsxs("div", { className: "flex items-center gap-1 w-full justify-between", children: [jsxs("div", { className: "flex items-center justify-between gap-1", children: [jsx(TimeInput, { label: t.from, className: "w-full", value: toTimeValue(slot.from), onChange: function (value) { return handleTimeChange(index, "from", value); }, isInvalid: !!slot.error }), jsx("span", { className: "text-default-900 xs:hidden xl:block", children: "-" }), jsx(TimeInput, { label: t.to, className: "w-full", value: toTimeValue(slot.to), onChange: function (value) { return handleTimeChange(index, "to", value); }, isInvalid: !!slot.error, errorMessage: slot.error })] }), isLastSlot ? (jsx(Button, { isIconOnly: true, size: "sm", color: "primary", variant: "light", onPress: handleAddTimeSlot, isDisabled: !isSlotFilled, startContent: jsx(IconComponent, { icon: "solar:add-circle-bold" }) })) : (jsx(Button, { isIconOnly: true, size: "sm", color: "danger", variant: "light", onPress: function () { return handleRemoveTimeSlot(index); }, isDisabled: !canDelete, startContent: jsx(IconComponent, { icon: "solar:trash-bin-minimalistic-outline" }) }))] }, "".concat(day, "-timeslot-").concat(index)));
|
|
2203
|
+
}) }))] }, day));
|
|
2096
2204
|
};
|
|
2097
2205
|
|
|
2098
2206
|
/**
|
|
@@ -3335,4 +3443,4 @@ var NavigationLoadingProvider = function (_a) {
|
|
|
3335
3443
|
return (jsxs(NavigationLoadingContext.Provider, { value: value, children: [children, jsx(NavigationLoadingOverlay, { isVisible: isVisible })] }));
|
|
3336
3444
|
};
|
|
3337
3445
|
|
|
3338
|
-
export { AddHolidayForm, AnalyticsCard, AuraAutocomplete, AuraTable, AuraToastProvider, BreadcrumbsComponent, Button, Card, Chip, ColorSelector, DatePicker, DateRangePicker, DateSelector, DrawerFilters, GlobalToast, H1, H2, H3, H4, HeaderComponent, HolidayType, IconComponent, Input, MenuComponent, Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, MultiStepWizard, NavigationLoadingContext, NavigationLoadingOverlay, NavigationLoadingProvider, P, Pagination, Phone, PromotionalBanner, RangeFilter, RowSteps, ScheduleRow, SearchInput, Select, StepIndicator, Switch as SwitchComponent, Textarea, ThemeContext, ThemePicker, ThemeProvider, TimeInput as TimeInputComponent, ToastContext, UploadFile, VerticalSteps, sizeMap, themeColors, useAuraToast, useNavigationLoading, useThemeContext };
|
|
3446
|
+
export { AddHolidayForm, AnalyticsCard, AuraAutocomplete, AuraTable, AuraToastProvider, BreadcrumbsComponent, Button, Card, Chip, ColorSelector, DatePicker, DateRangePicker, DateSelector, DrawerFilters, GlobalToast, H1, H2, H3, H4, HeaderComponent, HolidayType, IconComponent, Input, MenuComponent, Modal, ModalBody, ModalContent, ModalFooter, ModalHeader, MultiStepWizard, NavigationLoadingContext, NavigationLoadingOverlay, NavigationLoadingProvider, P, Pagination, Phone, PromotionalBanner, RangeFilter, RowSteps, ScheduleRow, SearchInput, Select, StepIndicator, Switch as SwitchComponent, Textarea, ThemeContext, ThemePicker, ThemeProvider, TimeInput as TimeInputComponent, ToastContext, UploadFile, VerticalSteps, defaultTranslations$2 as defaultTranslations, sizeMap, themeColors, useAuraToast, useNavigationLoading, useThemeContext };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { ScheduleRow } from "./schedule-row";
|
|
2
|
-
export type { ScheduleRowProps, DaySchedule, TimeSlot, } from "./schedule-row.types";
|
|
2
|
+
export type { ScheduleRowProps, ScheduleRowTranslations, DaySchedule, TimeSlot, } from "./schedule-row.types";
|
|
3
|
+
export { defaultTranslations } from "./schedule-row.constants";
|
|
3
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/schedule-row/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,YAAY,EACX,gBAAgB,EAChB,WAAW,EACX,QAAQ,GACR,MAAM,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/schedule-row/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,YAAY,EACX,gBAAgB,EAChB,uBAAuB,EACvB,WAAW,EACX,QAAQ,GACR,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ScheduleRowTranslations } from "./schedule-row.types";
|
|
2
|
+
/**
|
|
3
|
+
* @file schedule-row.constants.ts
|
|
4
|
+
* @description Default translations for the ScheduleRow component.
|
|
5
|
+
* These translations are used when no custom translations are provided via props.
|
|
6
|
+
* The component supports full internationalization by overriding these defaults.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* @constant defaultTranslations
|
|
10
|
+
* @description Default translations in Spanish for the ScheduleRow component.
|
|
11
|
+
* These can be overridden by passing a `translations` prop to the component.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* // Using default Spanish translations
|
|
16
|
+
* <ScheduleRow day="Lunes" daySchedule={...} />
|
|
17
|
+
*
|
|
18
|
+
* // Overriding with English translations
|
|
19
|
+
* <ScheduleRow
|
|
20
|
+
* day="Monday"
|
|
21
|
+
* daySchedule={...}
|
|
22
|
+
* translations={{
|
|
23
|
+
* from: "From",
|
|
24
|
+
* to: "To",
|
|
25
|
+
* open: "Open",
|
|
26
|
+
* closed: "Closed",
|
|
27
|
+
* copyToAll: "Copy to all",
|
|
28
|
+
* addTimeSlot: "Add time slot"
|
|
29
|
+
* }}
|
|
30
|
+
* />
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare const defaultTranslations: Required<ScheduleRowTranslations>;
|
|
34
|
+
//# sourceMappingURL=schedule-row.constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule-row.constants.d.ts","sourceRoot":"","sources":["../../../../src/components/schedule-row/schedule-row.constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAEpE;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,uBAAuB,CAajE,CAAC"}
|
|
@@ -7,6 +7,37 @@ import type { ScheduleRowProps } from "./schedule-row.types";
|
|
|
7
7
|
* and modify the start and end times of each slot. The component is fully
|
|
8
8
|
* controlled and reports changes to the parent via the `onChange` callback.
|
|
9
9
|
*
|
|
10
|
+
* Features:
|
|
11
|
+
* - Toggle day open/closed status
|
|
12
|
+
* - Add multiple time slots per day
|
|
13
|
+
* - Edit start (from) and end (to) times for each slot
|
|
14
|
+
* - Remove time slots (with minimum of one slot)
|
|
15
|
+
* - Automatic validation to prevent invalid time ranges (from > to)
|
|
16
|
+
* - Copy schedule to all days functionality
|
|
17
|
+
* - Always displays an empty slot for adding new times
|
|
18
|
+
* - Internationalization support via translations prop
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* <ScheduleRow
|
|
23
|
+
* day="Monday"
|
|
24
|
+
* daySchedule={{
|
|
25
|
+
* isOpen: true,
|
|
26
|
+
* timeSlots: [{ from: "09:00", to: "17:00" }]
|
|
27
|
+
* }}
|
|
28
|
+
* translations={{
|
|
29
|
+
* from: "From",
|
|
30
|
+
* to: "To",
|
|
31
|
+
* open: "Open",
|
|
32
|
+
* closed: "Closed",
|
|
33
|
+
* copyToAll: "Copy to all",
|
|
34
|
+
* addTimeSlot: "Add time slot"
|
|
35
|
+
* }}
|
|
36
|
+
* onChange={(newSchedule) => console.log(newSchedule)}
|
|
37
|
+
* onCopyToAll={(day) => console.log(`Copy from ${day}`)}
|
|
38
|
+
* />
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
10
41
|
* @param {ScheduleRowProps} props - The props for the component.
|
|
11
42
|
* @returns {React.ReactElement} The rendered ScheduleRow component.
|
|
12
43
|
*/
|