@stfrigerio/sito-template 0.1.57 → 0.1.58
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/components/organisms/Calendar/Calendar.d.ts +21 -1
- package/dist/components/organisms/Calendar/Calendar.d.ts.map +1 -1
- package/dist/components/organisms/Calendar/Calendar.stories.d.ts +1 -0
- package/dist/components/organisms/Calendar/Calendar.stories.d.ts.map +1 -1
- package/dist/index.esm.js +21 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +21 -5
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.css.map +1 -1
- package/dist/themes/dao.css +16 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2975,7 +2975,7 @@ const LiquidButton = ({ actions, icon: Icon = lucideReact.Plus, className = '',
|
|
|
2975
2975
|
}, onClick: () => handleAction(action), children: [jsxRuntime.jsx(action.icon, { size: 18, color: action.color }), jsxRuntime.jsx("span", { className: styles$b.actionLabel, children: action.label })] }, action.key))) })) }), jsxRuntime.jsx(framerMotion.motion.button, { type: "button", className: styles$b.button, onClick: handleToggle, animate: { rotate: expanded ? 45 : 0 }, transition: { duration: 0.2 }, "aria-label": expanded ? 'Close actions' : 'Open actions', children: jsxRuntime.jsx(Icon, { size: 24, strokeWidth: 2.5 }) })] })] }));
|
|
2976
2976
|
};
|
|
2977
2977
|
|
|
2978
|
-
var styles$a = {"calendar":"Calendar-module_calendar__3mIJS","loading":"Calendar-module_loading__59Z9-","loadingSpinner":"Calendar-module_loadingSpinner__7MXqV","header":"Calendar-module_header__cZHNA","navigation":"Calendar-module_navigation__PGkpY","navButton":"Calendar-module_navButton__kOe-w","title":"Calendar-module_title__oJZ7m","controls":"Calendar-module_controls__i1Z38","todayButton":"Calendar-module_todayButton__Ac9zc","viewToggle":"Calendar-module_viewToggle__Fhg2t","viewButton":"Calendar-module_viewButton__J2WY6","active":"Calendar-module_active__lIqH-","weekDays":"Calendar-module_weekDays__4J-8f","weekNumberHeader":"Calendar-module_weekNumberHeader__xhKbB","weekDay":"Calendar-module_weekDay__cg8Gr","daysGrid":"Calendar-module_daysGrid__ER0GM","weekView":"Calendar-module_weekView__bdtGs","dayCell":"Calendar-module_dayCell__TV-HR","dayNumber":"Calendar-module_dayNumber__ICH-X","today":"Calendar-module_today__eGuUU","events":"Calendar-module_events__qdbs7","event":"Calendar-module_event__Q1Zq3","eventTitle":"Calendar-module_eventTitle__XU7Wd","eventTime":"Calendar-module_eventTime__pMGEB","otherMonth":"Calendar-module_otherMonth__r6VJK","selected":"Calendar-module_selected__5e6h0","compact":"Calendar-module_compact__i0SF3","dots":"Calendar-module_dots__1Q7QR","dot":"Calendar-module_dot__tsCR1","dotMore":"Calendar-module_dotMore__emasD","weekNumber":"Calendar-module_weekNumber__nlo50","completed":"Calendar-module_completed__B-SHI","completedIcon":"Calendar-module_completedIcon__-oDZ9","moreEvents":"Calendar-module_moreEvents__TIKaT","emptyState":"Calendar-module_emptyState__2fcj7","dayView":"Calendar-module_dayView__PCIos","dayViewHeader":"Calendar-module_dayViewHeader__Gvxx2","timeColumnHeader":"Calendar-module_timeColumnHeader__B0btR","dayColumnHeader":"Calendar-module_dayColumnHeader__Rjqwg","allDayStrip":"Calendar-module_allDayStrip__VOqbV","allDayLabel":"Calendar-module_allDayLabel__2AmyT","allDayList":"Calendar-module_allDayList__6hFSb","dayViewScrollContainer":"Calendar-module_dayViewScrollContainer__84Byq","dayTimelineGrid":"Calendar-module_dayTimelineGrid__r1BNI","hourRow":"Calendar-module_hourRow__U-YN-","hourLabel":"Calendar-module_hourLabel__im84k","hourSlots":"Calendar-module_hourSlots__vbtYy","halfHourSlot":"Calendar-module_halfHourSlot__UWIri","halfHourSlotBottom":"Calendar-module_halfHourSlotBottom__aE5Mo","dayEventAnchor":"Calendar-module_dayEventAnchor__oryAi","currentTimeIndicator":"Calendar-module_currentTimeIndicator__GntOZ"};
|
|
2978
|
+
var styles$a = {"calendar":"Calendar-module_calendar__3mIJS","loading":"Calendar-module_loading__59Z9-","loadingSpinner":"Calendar-module_loadingSpinner__7MXqV","header":"Calendar-module_header__cZHNA","navigation":"Calendar-module_navigation__PGkpY","navButton":"Calendar-module_navButton__kOe-w","title":"Calendar-module_title__oJZ7m","controls":"Calendar-module_controls__i1Z38","todayButton":"Calendar-module_todayButton__Ac9zc","viewToggle":"Calendar-module_viewToggle__Fhg2t","viewButton":"Calendar-module_viewButton__J2WY6","active":"Calendar-module_active__lIqH-","filterBar":"Calendar-module_filterBar__ZD-lX","filterPill":"Calendar-module_filterPill__f7S8p","filterPillActive":"Calendar-module_filterPillActive__9Wtm9","filterDot":"Calendar-module_filterDot__E1Hp8","weekDays":"Calendar-module_weekDays__4J-8f","weekNumberHeader":"Calendar-module_weekNumberHeader__xhKbB","weekDay":"Calendar-module_weekDay__cg8Gr","daysGrid":"Calendar-module_daysGrid__ER0GM","weekView":"Calendar-module_weekView__bdtGs","dayCell":"Calendar-module_dayCell__TV-HR","dayNumber":"Calendar-module_dayNumber__ICH-X","today":"Calendar-module_today__eGuUU","events":"Calendar-module_events__qdbs7","event":"Calendar-module_event__Q1Zq3","eventTitle":"Calendar-module_eventTitle__XU7Wd","eventTime":"Calendar-module_eventTime__pMGEB","otherMonth":"Calendar-module_otherMonth__r6VJK","selected":"Calendar-module_selected__5e6h0","compact":"Calendar-module_compact__i0SF3","dots":"Calendar-module_dots__1Q7QR","dot":"Calendar-module_dot__tsCR1","dotMore":"Calendar-module_dotMore__emasD","weekNumber":"Calendar-module_weekNumber__nlo50","completed":"Calendar-module_completed__B-SHI","completedIcon":"Calendar-module_completedIcon__-oDZ9","moreEvents":"Calendar-module_moreEvents__TIKaT","emptyState":"Calendar-module_emptyState__2fcj7","dayView":"Calendar-module_dayView__PCIos","dayViewHeader":"Calendar-module_dayViewHeader__Gvxx2","timeColumnHeader":"Calendar-module_timeColumnHeader__B0btR","dayColumnHeader":"Calendar-module_dayColumnHeader__Rjqwg","allDayStrip":"Calendar-module_allDayStrip__VOqbV","allDayLabel":"Calendar-module_allDayLabel__2AmyT","allDayList":"Calendar-module_allDayList__6hFSb","dayViewScrollContainer":"Calendar-module_dayViewScrollContainer__84Byq","dayTimelineGrid":"Calendar-module_dayTimelineGrid__r1BNI","hourRow":"Calendar-module_hourRow__U-YN-","hourLabel":"Calendar-module_hourLabel__im84k","hourSlots":"Calendar-module_hourSlots__vbtYy","halfHourSlot":"Calendar-module_halfHourSlot__UWIri","halfHourSlotBottom":"Calendar-module_halfHourSlotBottom__aE5Mo","dayEventAnchor":"Calendar-module_dayEventAnchor__oryAi","currentTimeIndicator":"Calendar-module_currentTimeIndicator__GntOZ"};
|
|
2979
2979
|
|
|
2980
2980
|
var styles$9 = {"wrapper":"DayEventCard-module_wrapper__qvRgl","deleteUnderlay":"DayEventCard-module_deleteUnderlay__fTtuX","card":"DayEventCard-module_card__V9xTi","dragging":"DayEventCard-module_dragging__q19ID","completed":"DayEventCard-module_completed__tq8ol","text":"DayEventCard-module_text__3dWF7","grip":"DayEventCard-module_grip__tmim4","checkIcon":"DayEventCard-module_checkIcon__Ki67j","time":"DayEventCard-module_time__Ojdye","editButton":"DayEventCard-module_editButton__nDi-e"};
|
|
2981
2981
|
|
|
@@ -3074,11 +3074,24 @@ const DayEventCard = ({ event, color, textColor, onComplete, onEdit, onDelete, o
|
|
|
3074
3074
|
* onEventClick={handleEventClick}
|
|
3075
3075
|
* />
|
|
3076
3076
|
*/
|
|
3077
|
-
function Calendar({ events, onEventClick, onDateClick, onEventClickByView, onDateClickByView, onTimeSlotClick, onEventDrop, onEventComplete, onEventDelete, onEventEdit, viewMode = 'month', initialDate = new Date(), config = {}, className = '', style = {}, loading = false, emptyState, hideHeader = false, compact = false, selectedDate }) {
|
|
3077
|
+
function Calendar({ events, onEventClick, onDateClick, onEventClickByView, onDateClickByView, onTimeSlotClick, onEventDrop, onEventComplete, onEventDelete, onEventEdit, viewMode = 'month', initialDate = new Date(), config = {}, className = '', style = {}, loading = false, emptyState, hideHeader = false, compact = false, selectedDate, selectedCategoryId, onCategoryChange }) {
|
|
3078
3078
|
const [currentDate, setCurrentDate] = React.useState(initialDate);
|
|
3079
3079
|
const [currentViewMode, setCurrentViewMode] = React.useState(viewMode);
|
|
3080
|
+
const [internalCategoryId, setInternalCategoryId] = React.useState(null);
|
|
3081
|
+
const isCategoryControlled = selectedCategoryId !== undefined;
|
|
3082
|
+
const activeCategoryId = isCategoryControlled ? selectedCategoryId ?? null : internalCategoryId;
|
|
3083
|
+
const handleCategoryPick = (id) => {
|
|
3084
|
+
if (!isCategoryControlled)
|
|
3085
|
+
setInternalCategoryId(id);
|
|
3086
|
+
onCategoryChange?.(id);
|
|
3087
|
+
};
|
|
3080
3088
|
const dayViewScrollRef = React.useRef(null);
|
|
3081
|
-
const { eventColors = {}, iconRenderer, maxEventsPerDay = 3, mondayStart = false, showWeekNumbers = false, dateFormat = { month: 'long', year: 'numeric' }, locale = 'en-US', dayLabels, monthNames, startHour = 0, endHour = 24, hourHeight = 60, halfHourSlots = false } = config;
|
|
3089
|
+
const { eventColors = {}, iconRenderer, maxEventsPerDay = 3, mondayStart = false, showWeekNumbers = false, dateFormat = { month: 'long', year: 'numeric' }, locale = 'en-US', dayLabels, monthNames, startHour = 0, endHour = 24, hourHeight = 60, halfHourSlots = false, categories } = config;
|
|
3090
|
+
const filteredEvents = React.useMemo(() => {
|
|
3091
|
+
if (!categories || categories.length === 0 || activeCategoryId === null)
|
|
3092
|
+
return events;
|
|
3093
|
+
return events.filter(e => !e.category || e.category === activeCategoryId);
|
|
3094
|
+
}, [events, categories, activeCategoryId]);
|
|
3082
3095
|
const defaultDayLabels = mondayStart
|
|
3083
3096
|
? ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
|
|
3084
3097
|
: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
@@ -3162,7 +3175,7 @@ function Calendar({ events, onEventClick, onDateClick, onEventClickByView, onDat
|
|
|
3162
3175
|
return { days, displayTitle };
|
|
3163
3176
|
}, [currentDate, currentViewMode, mondayStart, locale, dateFormat, monthNames]);
|
|
3164
3177
|
const getDayEvents = (day) => {
|
|
3165
|
-
const dayEvents =
|
|
3178
|
+
const dayEvents = filteredEvents.filter(event => {
|
|
3166
3179
|
const eventDate = new Date(event.date);
|
|
3167
3180
|
return eventDate.toDateString() === day.toDateString();
|
|
3168
3181
|
});
|
|
@@ -3278,7 +3291,10 @@ function Calendar({ events, onEventClick, onDateClick, onEventClickByView, onDat
|
|
|
3278
3291
|
if (loading) {
|
|
3279
3292
|
return (jsxRuntime.jsx("div", { className: `${styles$a.calendar} ${styles$a.loading} ${className}`, style: style, children: jsxRuntime.jsx("div", { className: styles$a.loadingSpinner, children: "Loading..." }) }));
|
|
3280
3293
|
}
|
|
3281
|
-
return (jsxRuntime.jsxs("div", { className: `${styles$a.calendar} ${compact ? styles$a.compact : ''} ${className}`, style: style, children: [!hideHeader && (jsxRuntime.jsxs("div", { className: styles$a.header, children: [jsxRuntime.jsxs("div", { className: styles$a.navigation, children: [jsxRuntime.jsx("button", { onClick: handlePrevious, className: styles$a.navButton, "aria-label": "Previous", children: jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", children: jsxRuntime.jsx("polyline", { points: "15,18 9,12 15,6" }) }) }), jsxRuntime.jsx("h3", { className: styles$a.title, children: calendarData.displayTitle }), jsxRuntime.jsx("button", { onClick: handleNext, className: styles$a.navButton, "aria-label": "Next", children: jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", children: jsxRuntime.jsx("polyline", { points: "9,6 15,12 9,18" }) }) })] }),
|
|
3294
|
+
return (jsxRuntime.jsxs("div", { className: `${styles$a.calendar} ${compact ? styles$a.compact : ''} ${className}`, style: style, children: [!hideHeader && (jsxRuntime.jsxs("div", { className: styles$a.header, children: [jsxRuntime.jsxs("div", { className: styles$a.navigation, children: [jsxRuntime.jsx("button", { onClick: handlePrevious, className: styles$a.navButton, "aria-label": "Previous", children: jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", children: jsxRuntime.jsx("polyline", { points: "15,18 9,12 15,6" }) }) }), jsxRuntime.jsx("h3", { className: styles$a.title, children: calendarData.displayTitle }), jsxRuntime.jsx("button", { onClick: handleNext, className: styles$a.navButton, "aria-label": "Next", children: jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", children: jsxRuntime.jsx("polyline", { points: "9,6 15,12 9,18" }) }) })] }), categories && categories.length > 0 && (jsxRuntime.jsxs("div", { className: styles$a.filterBar, role: "tablist", "aria-label": "Filter by category", children: [jsxRuntime.jsx("button", { type: "button", role: "tab", "aria-selected": activeCategoryId === null, className: `${styles$a.filterPill} ${activeCategoryId === null ? styles$a.filterPillActive : ''}`, onClick: () => handleCategoryPick(null), children: "All" }), categories.map(cat => {
|
|
3295
|
+
const active = activeCategoryId === cat.id;
|
|
3296
|
+
return (jsxRuntime.jsxs("button", { type: "button", role: "tab", "aria-selected": active, className: `${styles$a.filterPill} ${active ? styles$a.filterPillActive : ''}`, style: active ? { background: cat.color, borderColor: cat.color, color: '#ffffff' } : undefined, onClick: () => handleCategoryPick(cat.id), children: [!active && (jsxRuntime.jsx("span", { className: styles$a.filterDot, style: { background: cat.color } })), cat.label] }, cat.id));
|
|
3297
|
+
})] })), jsxRuntime.jsxs("div", { className: styles$a.controls, children: [jsxRuntime.jsx("button", { onClick: handleToday, className: styles$a.todayButton, children: "Today" }), jsxRuntime.jsxs("div", { className: styles$a.viewToggle, children: [jsxRuntime.jsx("button", { className: `${styles$a.viewButton} ${currentViewMode === 'month' ? styles$a.active : ''}`, onClick: () => setCurrentViewMode('month'), children: "Month" }), jsxRuntime.jsx("button", { className: `${styles$a.viewButton} ${currentViewMode === 'week' ? styles$a.active : ''}`, onClick: () => setCurrentViewMode('week'), children: "Week" }), jsxRuntime.jsx("button", { className: `${styles$a.viewButton} ${currentViewMode === 'day' ? styles$a.active : ''}`, onClick: () => setCurrentViewMode('day'), children: "Day" })] })] })] })), currentViewMode !== 'day' && (jsxRuntime.jsxs("div", { className: styles$a.weekDays, children: [showWeekNumbers && jsxRuntime.jsx("div", { className: styles$a.weekNumberHeader, children: "Week" }), finalDayLabels.map((day) => (jsxRuntime.jsx("div", { className: styles$a.weekDay, children: day }, day)))] })), currentViewMode === 'day' ? (
|
|
3282
3298
|
// Day view layout — positioned events with duration, all-day strip, now-line
|
|
3283
3299
|
(() => {
|
|
3284
3300
|
const dayEvents = getDayEvents(currentDate);
|