@utrecht/calendar-react 1.0.14 → 1.0.16
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/css.mjs +12 -3
- package/dist/css.mjs.map +1 -1
- package/dist/index.mjs +12 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -8
- package/src/index.test.tsx +9 -0
- package/src/index.tsx +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3550,9 +3550,18 @@ function chunk(array, size, guard) {
|
|
|
3550
3550
|
const CalendarNavigation = ({ children, ...props }) => (jsx("div", { className: "utrecht-calendar__navigation", ...props, children: children }));
|
|
3551
3551
|
|
|
3552
3552
|
function r$1(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r$1(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx$1(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r$1(e))&&(n&&(n+=" "),n+=t);return n}
|
|
3553
|
-
|
|
3553
|
+
const APPEARANCE = {
|
|
3554
|
+
'primary-action-button': 'utrecht-button--primary-action',
|
|
3555
|
+
'secondary-action-button': 'utrecht-button--secondary-action',
|
|
3556
|
+
'subtle-button': 'utrecht-button--subtle',
|
|
3557
|
+
};
|
|
3558
|
+
const HINT = {
|
|
3559
|
+
danger: 'utrecht-button--danger',
|
|
3560
|
+
warning: 'utrecht-button--warning',
|
|
3561
|
+
ready: 'utrecht-button--ready',
|
|
3562
|
+
};
|
|
3554
3563
|
const Button = forwardRef(({ appearance, busy, disabled, children, className, hint, icon, label, pressed, type, ...restProps }, ref) => {
|
|
3555
|
-
return (jsxs("button", { ref: ref, className: clsx$1('utrecht-button', busy && 'utrecht-button--busy', disabled && 'utrecht-button--disabled', type === 'submit' && 'utrecht-button--submit', appearance
|
|
3564
|
+
return (jsxs("button", { ref: ref, className: clsx$1('utrecht-button', busy && 'utrecht-button--busy', disabled && 'utrecht-button--disabled', type === 'submit' && 'utrecht-button--submit', appearance && APPEARANCE[appearance], hint && HINT[hint], pressed === true && 'utrecht-button--pressed', className), "aria-busy": busy || undefined, "aria-pressed": typeof pressed === 'boolean' ? pressed : undefined, disabled: disabled, type: type || 'button', ...restProps, children: [icon, label && jsx("span", { className: "utrecht-button__label", children: label }), children] }));
|
|
3556
3565
|
});
|
|
3557
3566
|
Button.displayName = 'Button';
|
|
3558
3567
|
|
|
@@ -3624,7 +3633,7 @@ const Calendar = ({ onCalendarClick, events, currentDate, locale: locale$1 = loc
|
|
|
3624
3633
|
};
|
|
3625
3634
|
}
|
|
3626
3635
|
}));
|
|
3627
|
-
return (jsxs("div", { className: "utrecht-calendar", children: [jsx(CalendarNavigation, { children: jsx(CalendarNavigationButtons, { previousIcon: jsx(IconArrowLeftDouble, { title: previousYearButtonTitle }), nextIcon: jsx(IconArrowRightDouble, { title: nextYearButtonTitle }), onPreviousClick: () => setVisibleMonth(setYear(visibleMonth, getYear(visibleMonth) - 1)), onNextClick: () => setVisibleMonth(addYears(visibleMonth, 1)), children: jsx(CalendarNavigationButtons, { previousIcon: jsx(IconArrowLeft, { title: previousMonthButtonTitle }), nextIcon: jsx(IconArrowRight, { title: nextMonthButtonTitle }), onPreviousClick: () => setVisibleMonth(setMonth(visibleMonth, visibleMonth.getMonth() - 1)), onNextClick: () => setVisibleMonth(addMonths(visibleMonth, 1)), children: jsx(CalendarNavigationLabel, { dateTime: format(visibleMonth, 'yyyy-mm'), children: format(visibleMonth, 'LLLL
|
|
3636
|
+
return (jsxs("div", { className: "utrecht-calendar", children: [jsx(CalendarNavigation, { children: jsx(CalendarNavigationButtons, { previousIcon: jsx(IconArrowLeftDouble, { title: previousYearButtonTitle }), nextIcon: jsx(IconArrowRightDouble, { title: nextYearButtonTitle }), onPreviousClick: () => setVisibleMonth(setYear(visibleMonth, getYear(visibleMonth) - 1)), onNextClick: () => setVisibleMonth(addYears(visibleMonth, 1)), children: jsx(CalendarNavigationButtons, { previousIcon: jsx(IconArrowLeft, { title: previousMonthButtonTitle }), nextIcon: jsx(IconArrowRight, { title: nextMonthButtonTitle }), onPreviousClick: () => setVisibleMonth(setMonth(visibleMonth, visibleMonth.getMonth() - 1)), onNextClick: () => setVisibleMonth(addMonths(visibleMonth, 1)), children: jsx(CalendarNavigationLabel, { dateTime: format(visibleMonth, 'yyyy-mm'), children: format(visibleMonth, 'LLLL y', { locale: locale$1 }) }) }) }) }), jsxs("table", { className: "utrecht-calendar__table", role: "grid", children: [jsx(CalendarTableWeeksContainer, { children: currentWeek &&
|
|
3628
3637
|
currentWeek.length > 0 &&
|
|
3629
3638
|
currentWeek.map((day, index) => (jsx(CalendarTableWeeksItem, { scope: "col", abbr: format(day, 'EEEE', { locale: locale$1 }), children: format(day, 'EEEEEE', { locale: locale$1 }) }, index))) }), jsx(CalendarTableDaysContainer, { children: weeks &&
|
|
3630
3639
|
weeks.length > 0 &&
|