@flipdish/ui-library 0.47.0 → 0.48.0
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/DatePicker/components/Calendar.cjs +2 -2
- package/dist/components/organisms/DatePicker/components/Calendar.cjs.map +1 -1
- package/dist/components/organisms/DatePicker/components/Calendar.d.ts +3 -1
- package/dist/components/organisms/DatePicker/components/Calendar.d.ts.map +1 -1
- package/dist/components/organisms/DatePicker/components/Calendar.js +2 -2
- package/dist/components/organisms/DatePicker/components/Calendar.js.map +1 -1
- package/dist/components/organisms/DatePicker/components/CalendarOverlay.cjs +26 -0
- package/dist/components/organisms/DatePicker/components/CalendarOverlay.cjs.map +1 -0
- package/dist/components/organisms/DatePicker/components/CalendarOverlay.d.ts +15 -0
- package/dist/components/organisms/DatePicker/components/CalendarOverlay.d.ts.map +1 -0
- package/dist/components/organisms/DatePicker/components/CalendarOverlay.js +24 -0
- package/dist/components/organisms/DatePicker/components/CalendarOverlay.js.map +1 -0
- package/dist/components/organisms/DatePicker/components/Cell.cjs +4 -2
- package/dist/components/organisms/DatePicker/components/Cell.cjs.map +1 -1
- package/dist/components/organisms/DatePicker/components/Cell.d.ts.map +1 -1
- package/dist/components/organisms/DatePicker/components/Cell.js +4 -2
- package/dist/components/organisms/DatePicker/components/Cell.js.map +1 -1
- package/dist/components/organisms/DatePicker/components/DateRangePicker.cjs +20 -25
- package/dist/components/organisms/DatePicker/components/DateRangePicker.cjs.map +1 -1
- package/dist/components/organisms/DatePicker/components/DateRangePicker.d.ts +9 -4
- package/dist/components/organisms/DatePicker/components/DateRangePicker.d.ts.map +1 -1
- package/dist/components/organisms/DatePicker/components/DateRangePicker.js +21 -26
- package/dist/components/organisms/DatePicker/components/DateRangePicker.js.map +1 -1
- package/dist/components/organisms/DatePicker/components/RangeCalendar.cjs +1 -1
- package/dist/components/organisms/DatePicker/components/RangeCalendar.cjs.map +1 -1
- package/dist/components/organisms/DatePicker/components/RangeCalendar.d.ts.map +1 -1
- package/dist/components/organisms/DatePicker/components/RangeCalendar.js +1 -1
- package/dist/components/organisms/DatePicker/components/RangeCalendar.js.map +1 -1
- package/dist/components/organisms/DatePicker/index.cjs +13 -16
- package/dist/components/organisms/DatePicker/index.cjs.map +1 -1
- package/dist/components/organisms/DatePicker/index.d.ts +6 -4
- package/dist/components/organisms/DatePicker/index.d.ts.map +1 -1
- package/dist/components/organisms/DatePicker/index.js +14 -17
- package/dist/components/organisms/DatePicker/index.js.map +1 -1
- package/dist/components/organisms/Messaging/components/MessageItemActions.cjs +13 -0
- package/dist/components/organisms/Messaging/components/MessageItemActions.cjs.map +1 -0
- package/dist/components/organisms/Messaging/components/MessageItemActions.d.ts +5 -0
- package/dist/components/organisms/Messaging/components/MessageItemActions.d.ts.map +1 -0
- package/dist/components/organisms/Messaging/components/MessageItemActions.js +11 -0
- package/dist/components/organisms/Messaging/components/MessageItemActions.js.map +1 -0
- package/dist/components/organisms/Messaging/index.cjs +12 -10
- package/dist/components/organisms/Messaging/index.cjs.map +1 -1
- package/dist/components/organisms/Messaging/index.d.ts.map +1 -1
- package/dist/components/organisms/Messaging/index.js +13 -11
- package/dist/components/organisms/Messaging/index.js.map +1 -1
- package/dist/components/organisms/Messaging/messageItem.utils.cjs +60 -0
- package/dist/components/organisms/Messaging/messageItem.utils.cjs.map +1 -0
- package/dist/components/organisms/Messaging/messageItem.utils.d.ts +65 -0
- package/dist/components/organisms/Messaging/messageItem.utils.d.ts.map +1 -0
- package/dist/components/organisms/Messaging/messageItem.utils.js +54 -0
- package/dist/components/organisms/Messaging/messageItem.utils.js.map +1 -0
- package/package.json +1 -1
|
@@ -20,14 +20,14 @@ const CalendarContextProvider = ({ children }) => {
|
|
|
20
20
|
};
|
|
21
21
|
return jsxRuntime.jsx(reactAriaComponents.CalendarContext.Provider, { value: { value, onChange, focusedValue, onFocusChange }, children: children });
|
|
22
22
|
};
|
|
23
|
-
const Calendar = ({ highlightedDates, className, children, ...props }) => {
|
|
23
|
+
const Calendar = ({ highlightedDates, className, children, showOutOfRangeDates = false, ...props }) => {
|
|
24
24
|
const context = reactAriaComponents.useSlottedContext(reactAriaComponents.CalendarContext);
|
|
25
25
|
const ContextWrapper = context ? React.Fragment : CalendarContextProvider;
|
|
26
26
|
const prefix = testIdUtils.useTestIdPrefix();
|
|
27
27
|
return (jsxRuntime.jsx(ContextWrapper, { children: jsxRuntime.jsx(reactAriaComponents.Calendar, { ...props, className: (state) => cx.cx('flex flex-col gap-3', typeof className === 'function' ? className(state) : className), children: ({ state }) => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntime.jsx(Button.Button, { slot: "previous", iconLeading: uiIcons.ChevronLeft, size: "sm", color: "tertiary", className: "size-8", "data-testid": prefix ? testIdUtils.joinTestId(prefix, 'prev') : undefined }), jsxRuntime.jsx(reactAriaComponents.Heading, { className: "text-sm font-semibold text-fg-secondary" }), jsxRuntime.jsx(Button.Button, { slot: "next", iconLeading: uiIcons.ChevronRight, size: "sm", color: "tertiary", className: "size-8", "data-testid": prefix ? testIdUtils.joinTestId(prefix, 'next') : undefined })] }), children || (jsxRuntime.jsxs("div", { className: "flex gap-3", children: [jsxRuntime.jsx(InputDate.InputDateBase, { "aria-label": "Date", size: "sm", className: "flex-1" }), jsxRuntime.jsx(Button.Button, { slot: null, size: "sm", color: "secondary", onClick: () => {
|
|
28
28
|
state.setValue(date.today(date.getLocalTimeZone()));
|
|
29
29
|
state.setFocusedDate(date.today(date.getLocalTimeZone()));
|
|
30
|
-
}, children: "Today" })] })), jsxRuntime.jsxs(reactAriaComponents.CalendarGrid, { weekdayStyle: "short", className: "w-max", children: [jsxRuntime.jsx(reactAriaComponents.CalendarGridHeader, { className: "border-b-4 border-transparent", children: (day) => (jsxRuntime.jsx(reactAriaComponents.CalendarHeaderCell, { className: "p-0", children: jsxRuntime.jsx("div", { className: "flex size-10 items-center justify-center text-sm font-medium text-secondary", children: day.slice(0, 2) }) })) }), jsxRuntime.jsx(reactAriaComponents.CalendarGridBody, { className: "[&_td]:p-0 [&_tr]:border-b-4 [&_tr]:border-transparent [&_tr:last-of-type]:border-none", children: (date) => (jsxRuntime.jsx(Cell.CalendarCell, { date: date, isHighlighted: highlightedDates?.some((highlightedDate) => date.compare(highlightedDate) === 0) })) })] })] })) }) }));
|
|
30
|
+
}, children: "Today" })] })), jsxRuntime.jsxs(reactAriaComponents.CalendarGrid, { weekdayStyle: "short", className: "w-max", children: [jsxRuntime.jsx(reactAriaComponents.CalendarGridHeader, { className: "border-b-4 border-transparent", children: (day) => (jsxRuntime.jsx(reactAriaComponents.CalendarHeaderCell, { className: "p-0", children: jsxRuntime.jsx("div", { className: "flex size-10 items-center justify-center text-sm font-medium text-secondary", children: day.slice(0, 2) }) })) }), jsxRuntime.jsx(reactAriaComponents.CalendarGridBody, { className: "[&_td]:p-0 [&_tr]:border-b-4 [&_tr]:border-transparent [&_tr:last-of-type]:border-none", children: (date) => (jsxRuntime.jsx(Cell.CalendarCell, { date: date, showOutOfRangeDates: showOutOfRangeDates, isHighlighted: highlightedDates?.some((highlightedDate) => date.compare(highlightedDate) === 0) })) })] })] })) }) }));
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
exports.Calendar = Calendar;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Calendar.cjs","sources":["../../../../../src/components/organisms/DatePicker/components/Calendar.tsx"],"sourcesContent":[null],"names":["useState","_jsx","AriaCalendarContext","useSlottedContext","Fragment","useTestIdPrefix","AriaCalendar","cx","_jsxs","Button","ChevronLeft","joinTestId","AriaHeading","ChevronRight","InputDateBase","today","getLocalTimeZone","AriaCalendarGrid","AriaCalendarGridHeader","AriaCalendarHeaderCell","AriaCalendarGridBody","CalendarCell"],"mappings":";;;;;;;;;;;;;MAuBa,uBAAuB,GAAG,CAAC,EAAE,QAAQ,EAAqB,KAAI;IACzE,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAGA,cAAQ,CAAmB,IAAI,CAAC;IAC1D,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAGA,cAAQ,EAAyB;IACzE,MAAM,aAAa,GAAG,CAAC,QAAmB,KAAK,eAAe,CAAC,QAAQ,CAAC;AAExE,IAAA,MAAM,QAAQ,GAAG,CAAC,QAA0C,KAAI;AAC9D,QAAA,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,GAAI,QAAsB,CAAC;AACpE,IAAA,CAAC;AAED,IAAA,OAAOC,eAACC,mCAAmB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,aAAa,EAAE,EAAA,QAAA,EAAG,QAAQ,GAAgC;AACzI;
|
|
1
|
+
{"version":3,"file":"Calendar.cjs","sources":["../../../../../src/components/organisms/DatePicker/components/Calendar.tsx"],"sourcesContent":[null],"names":["useState","_jsx","AriaCalendarContext","useSlottedContext","Fragment","useTestIdPrefix","AriaCalendar","cx","_jsxs","Button","ChevronLeft","joinTestId","AriaHeading","ChevronRight","InputDateBase","today","getLocalTimeZone","AriaCalendarGrid","AriaCalendarGridHeader","AriaCalendarHeaderCell","AriaCalendarGridBody","CalendarCell"],"mappings":";;;;;;;;;;;;;MAuBa,uBAAuB,GAAG,CAAC,EAAE,QAAQ,EAAqB,KAAI;IACzE,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAGA,cAAQ,CAAmB,IAAI,CAAC;IAC1D,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAGA,cAAQ,EAAyB;IACzE,MAAM,aAAa,GAAG,CAAC,QAAmB,KAAK,eAAe,CAAC,QAAQ,CAAC;AAExE,IAAA,MAAM,QAAQ,GAAG,CAAC,QAA0C,KAAI;AAC9D,QAAA,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,GAAI,QAAsB,CA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AAC,CAAC,eAAe,KAAK,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,EAAA,CAC/F,CACH,EAAA,CACoB,CAAA,EAAA,CACN,IAClB,CACJ,EAAA,CACY,EAAA,CACA;AAErB;;;"}
|
|
@@ -9,7 +9,9 @@ interface CalendarProps extends AriaCalendarProps<DateValue> {
|
|
|
9
9
|
* If not provided, a default layout will be rendered with a date input and a today button.
|
|
10
10
|
*/
|
|
11
11
|
children?: ReactNode;
|
|
12
|
+
/** Shows the padding days of the previous and next month instead of hiding them. */
|
|
13
|
+
showOutOfRangeDates?: boolean;
|
|
12
14
|
}
|
|
13
|
-
export declare const Calendar: ({ highlightedDates, className, children, ...props }: CalendarProps) => import("react").JSX.Element;
|
|
15
|
+
export declare const Calendar: ({ highlightedDates, className, children, showOutOfRangeDates, ...props }: CalendarProps) => import("react").JSX.Element;
|
|
14
16
|
export {};
|
|
15
17
|
//# sourceMappingURL=Calendar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Calendar.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/DatePicker/components/Calendar.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE1D,OAAO,KAAK,EAAE,aAAa,IAAI,iBAAiB,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAc3F,eAAO,MAAM,uBAAuB,GAAI,cAAc,iBAAiB,gCAUtE,CAAC;AAEF,UAAU,aAAc,SAAQ,iBAAiB,CAAC,SAAS,CAAC;IAC1D,8BAA8B;IAC9B,gBAAgB,CAAC,EAAE,SAAS,EAAE,CAAC;IAC/B;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"Calendar.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/DatePicker/components/Calendar.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE1D,OAAO,KAAK,EAAE,aAAa,IAAI,iBAAiB,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAc3F,eAAO,MAAM,uBAAuB,GAAI,cAAc,iBAAiB,gCAUtE,CAAC;AAEF,UAAU,aAAc,SAAQ,iBAAiB,CAAC,SAAS,CAAC;IAC1D,8BAA8B;IAC9B,gBAAgB,CAAC,EAAE,SAAS,EAAE,CAAC;IAC/B;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,oFAAoF;IACpF,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,eAAO,MAAM,QAAQ,GAAI,0EAAkF,aAAa,gCAwEvH,CAAC"}
|
|
@@ -18,14 +18,14 @@ const CalendarContextProvider = ({ children }) => {
|
|
|
18
18
|
};
|
|
19
19
|
return jsx(CalendarContext.Provider, { value: { value, onChange, focusedValue, onFocusChange }, children: children });
|
|
20
20
|
};
|
|
21
|
-
const Calendar = ({ highlightedDates, className, children, ...props }) => {
|
|
21
|
+
const Calendar = ({ highlightedDates, className, children, showOutOfRangeDates = false, ...props }) => {
|
|
22
22
|
const context = useSlottedContext(CalendarContext);
|
|
23
23
|
const ContextWrapper = context ? Fragment : CalendarContextProvider;
|
|
24
24
|
const prefix = useTestIdPrefix();
|
|
25
25
|
return (jsx(ContextWrapper, { children: jsx(Calendar$1, { ...props, className: (state) => cx('flex flex-col gap-3', typeof className === 'function' ? className(state) : className), children: ({ state }) => (jsxs(Fragment$1, { children: [jsxs("div", { className: "flex items-center justify-between", children: [jsx(Button, { slot: "previous", iconLeading: ChevronLeft, size: "sm", color: "tertiary", className: "size-8", "data-testid": prefix ? joinTestId(prefix, 'prev') : undefined }), jsx(Heading, { className: "text-sm font-semibold text-fg-secondary" }), jsx(Button, { slot: "next", iconLeading: ChevronRight, size: "sm", color: "tertiary", className: "size-8", "data-testid": prefix ? joinTestId(prefix, 'next') : undefined })] }), children || (jsxs("div", { className: "flex gap-3", children: [jsx(InputDateBase, { "aria-label": "Date", size: "sm", className: "flex-1" }), jsx(Button, { slot: null, size: "sm", color: "secondary", onClick: () => {
|
|
26
26
|
state.setValue(today(getLocalTimeZone()));
|
|
27
27
|
state.setFocusedDate(today(getLocalTimeZone()));
|
|
28
|
-
}, children: "Today" })] })), jsxs(CalendarGrid, { weekdayStyle: "short", className: "w-max", children: [jsx(CalendarGridHeader, { className: "border-b-4 border-transparent", children: (day) => (jsx(CalendarHeaderCell, { className: "p-0", children: jsx("div", { className: "flex size-10 items-center justify-center text-sm font-medium text-secondary", children: day.slice(0, 2) }) })) }), jsx(CalendarGridBody, { className: "[&_td]:p-0 [&_tr]:border-b-4 [&_tr]:border-transparent [&_tr:last-of-type]:border-none", children: (date) => (jsx(CalendarCell, { date: date, isHighlighted: highlightedDates?.some((highlightedDate) => date.compare(highlightedDate) === 0) })) })] })] })) }) }));
|
|
28
|
+
}, children: "Today" })] })), jsxs(CalendarGrid, { weekdayStyle: "short", className: "w-max", children: [jsx(CalendarGridHeader, { className: "border-b-4 border-transparent", children: (day) => (jsx(CalendarHeaderCell, { className: "p-0", children: jsx("div", { className: "flex size-10 items-center justify-center text-sm font-medium text-secondary", children: day.slice(0, 2) }) })) }), jsx(CalendarGridBody, { className: "[&_td]:p-0 [&_tr]:border-b-4 [&_tr]:border-transparent [&_tr:last-of-type]:border-none", children: (date) => (jsx(CalendarCell, { date: date, showOutOfRangeDates: showOutOfRangeDates, isHighlighted: highlightedDates?.some((highlightedDate) => date.compare(highlightedDate) === 0) })) })] })] })) }) }));
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
export { Calendar, CalendarContextProvider };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Calendar.js","sources":["../../../../../src/components/organisms/DatePicker/components/Calendar.tsx"],"sourcesContent":[null],"names":["_jsx","AriaCalendarContext","AriaCalendar","_jsxs","AriaHeading","AriaCalendarGrid","AriaCalendarGridHeader","AriaCalendarHeaderCell","AriaCalendarGridBody"],"mappings":";;;;;;;;;;;MAuBa,uBAAuB,GAAG,CAAC,EAAE,QAAQ,EAAqB,KAAI;IACzE,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAmB,IAAI,CAAC;IAC1D,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,EAAyB;IACzE,MAAM,aAAa,GAAG,CAAC,QAAmB,KAAK,eAAe,CAAC,QAAQ,CAAC;AAExE,IAAA,MAAM,QAAQ,GAAG,CAAC,QAA0C,KAAI;AAC9D,QAAA,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,GAAI,QAAsB,CAAC;AACpE,IAAA,CAAC;AAED,IAAA,OAAOA,IAACC,eAAmB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,aAAa,EAAE,EAAA,QAAA,EAAG,QAAQ,GAAgC;AACzI;
|
|
1
|
+
{"version":3,"file":"Calendar.js","sources":["../../../../../src/components/organisms/DatePicker/components/Calendar.tsx"],"sourcesContent":[null],"names":["_jsx","AriaCalendarContext","AriaCalendar","_jsxs","AriaHeading","AriaCalendarGrid","AriaCalendarGridHeader","AriaCalendarHeaderCell","AriaCalendarGridBody"],"mappings":";;;;;;;;;;;MAuBa,uBAAuB,GAAG,CAAC,EAAE,QAAQ,EAAqB,KAAI;IACzE,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAmB,IAAI,CAAC;IAC1D,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,EAAyB;IACzE,MAAM,aAAa,GAAG,CAAC,QAAmB,KAAK,eAAe,CAAC,QAAQ,CAAC;AAExE,IAAA,MAAM,QAAQ,GAAG,CAAC,QAA0C,KAAI;AAC9D,QAAA,QAAQ,CAAC,KAAK,CAAC,OAAO,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E,IAAI,CAAC,CAAC,eAAe,KAAK,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,EAAA,CAC/F,CACH,EAAA,CACoB,CAAA,EAAA,CACN,IAClB,CACJ,EAAA,CACY,EAAA,CACA;AAErB;;"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var Modal = require('@flipdish/ui-library/components/molecules/Modal');
|
|
5
|
+
var useBreakpoints = require('@flipdish/ui-library/hooks/useBreakpoints');
|
|
6
|
+
var cx = require('@flipdish/ui-library/utilities/cx');
|
|
7
|
+
var testIdUtils = require('@flipdish/ui-library/utilities/testIdUtils');
|
|
8
|
+
var reactAriaComponents = require('react-aria-components');
|
|
9
|
+
var ScrollClosingPopover = require('../../../__internal__/popover/ScrollClosingPopover.cjs');
|
|
10
|
+
|
|
11
|
+
const CalendarOverlay = ({ 'aria-label': ariaLabel, 'data-testid': dataTestId, className, children }) => {
|
|
12
|
+
const isDesktop = useBreakpoints.useBreakpoints('md');
|
|
13
|
+
const prefix = testIdUtils.useTestIdPrefix();
|
|
14
|
+
if (!isDesktop) {
|
|
15
|
+
// The picker's trigger state reaches ModalOverlay through react-aria's OverlayTriggerStateContext, so no open state is passed.
|
|
16
|
+
return (
|
|
17
|
+
// Flush bottom sheet all the way to `md`: the `sm:` overrides undo Modal's centred-card mode, since this surface never renders above `md`.
|
|
18
|
+
jsxRuntime.jsx(Modal.ModalOverlay, { isDismissable: true, className: "px-0 [--modal-pb:0px] sm:items-end sm:px-0 sm:[--modal-pb:0px] sm:[--modal-pt:16px]", children: jsxRuntime.jsx(Modal.Modal, { className: "w-full rounded-t-2xl rounded-b-none sm:rounded-t-2xl sm:rounded-b-none", children: jsxRuntime.jsx(testIdUtils.TestIdProvider, { value: prefix, children: jsxRuntime.jsx(Modal.Dialog, { "aria-label": ariaLabel, "data-testid": dataTestId, className: cx.cx('flex flex-col items-center', className), children: children }) }) }) }));
|
|
19
|
+
}
|
|
20
|
+
return (jsxRuntime.jsx(ScrollClosingPopover.ScrollClosingPopover, { placement: "bottom right", offset: 8, className: ({ isEntering, isExiting }) => cx.cx('origin-(--trigger-anchor-point) will-change-transform', isEntering &&
|
|
21
|
+
'duration-150 ease-out animate-in fade-in placement-right:slide-in-from-left-0.5 placement-top:slide-in-from-bottom-0.5 placement-bottom:slide-in-from-top-0.5', isExiting &&
|
|
22
|
+
'duration-100 ease-in animate-out fade-out placement-right:slide-out-to-left-0.5 placement-top:slide-out-to-bottom-0.5 placement-bottom:slide-out-to-top-0.5'), children: jsxRuntime.jsx(reactAriaComponents.Dialog, { "aria-label": ariaLabel, "data-testid": dataTestId, className: cx.cx('max-h-[inherit] overflow-y-auto rounded-2xl bg-primary shadow-xl ring ring-secondary_alt', className), children: children }) }));
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
exports.CalendarOverlay = CalendarOverlay;
|
|
26
|
+
//# sourceMappingURL=CalendarOverlay.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CalendarOverlay.cjs","sources":["../../../../../src/components/organisms/DatePicker/components/CalendarOverlay.tsx"],"sourcesContent":[null],"names":["useBreakpoints","useTestIdPrefix","_jsx","ModalOverlay","Modal","TestIdProvider","Dialog","cx","ScrollClosingPopover","AriaDialog"],"mappings":";;;;;;;;;;AAsBO,MAAM,eAAe,GAAG,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAwB,KAAI;AACnI,IAAA,MAAM,SAAS,GAAGA,6BAAc,CAAC,IAAI,CAAC;AACtC,IAAA,MAAM,MAAM,GAAGC,2BAAe,EAAE;IAEhC,IAAI,CAAC,SAAS,EAAE;;QAEd;;QAEEC,cAAA,CAACC,kBAAY,IAAC,aAAa,EAAA,IAAA,EAAC,SAAS,EAAC,qFAAqF,YACzHD,cAAA,CAACE,WAAK,IAAC,SAAS,EAAC,wEAAwE,EAAA,QAAA,EAEvFF,cAAA,CAACG,0BAAc,EAAA,EAAC,KAAK,EAAE,MAAM,EAAA,QAAA,EAE3BH,eAACI,YAAM,EAAA,EAAA,YAAA,EAAa,SAAS,EAAA,aAAA,EAAe,UAAU,EAAE,SAAS,EAAEC,KAAE,CAAC,4BAA4B,EAAE,SAAS,CAAC,YAC3G,QAAQ,EAAA,CACF,GACM,EAAA,CACX,EAAA,CACK;IAEnB;IAEA,QACEL,cAAA,CAACM,yCAAoB,EAAA,EACnB,SAAS,EAAC,cAAc,EACxB,MAAM,EAAE,CAAC,EACT,SAAS,EAAE,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,KACnCD,KAAE,CACA,uDAAuD,EACvD,UAAU;AACR,YAAA,+JAA+J,EACjK,SAAS;YACP,6JAA6J,CAChK,YAIHL,cAAA,CAACO,0BAAU,kBACG,SAAS,EAAA,aAAA,EACR,UAAU,EACvB,SAAS,EAAEF,KAAE,CAAC,0FAA0F,EAAE,SAAS,CAAC,YAEnH,QAAQ,EAAA,CACE,EAAA,CACQ;AAE3B;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { DialogRenderProps } from 'react-aria-components';
|
|
3
|
+
interface CalendarOverlayProps {
|
|
4
|
+
/** Accessible name of the dialog. */
|
|
5
|
+
'aria-label': string;
|
|
6
|
+
/** `data-testid` of the dialog, the same on both surfaces. */
|
|
7
|
+
'data-testid': string;
|
|
8
|
+
/** Extra classes for the dialog on both surfaces. */
|
|
9
|
+
className?: string;
|
|
10
|
+
/** Dialog content; `close` dismisses whichever surface is showing. */
|
|
11
|
+
children: (renderProps: DialogRenderProps) => ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export declare const CalendarOverlay: ({ "aria-label": ariaLabel, "data-testid": dataTestId, className, children }: CalendarOverlayProps) => import("react").JSX.Element;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=CalendarOverlay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CalendarOverlay.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/DatePicker/components/CalendarOverlay.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAI/D,UAAU,oBAAoB;IAC5B,qCAAqC;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,8DAA8D;IAC9D,aAAa,EAAE,MAAM,CAAC;IACtB,qDAAqD;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sEAAsE;IACtE,QAAQ,EAAE,CAAC,WAAW,EAAE,iBAAiB,KAAK,SAAS,CAAC;CACzD;AAED,eAAO,MAAM,eAAe,GAAI,6EAA6E,oBAAoB,gCA8ChI,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { ModalOverlay, Modal, Dialog } from '@flipdish/ui-library/components/molecules/Modal';
|
|
3
|
+
import { useBreakpoints } from '@flipdish/ui-library/hooks/useBreakpoints';
|
|
4
|
+
import { cx } from '@flipdish/ui-library/utilities/cx';
|
|
5
|
+
import { useTestIdPrefix, TestIdProvider } from '@flipdish/ui-library/utilities/testIdUtils';
|
|
6
|
+
import { Dialog as Dialog$1 } from 'react-aria-components';
|
|
7
|
+
import { ScrollClosingPopover } from '../../../__internal__/popover/ScrollClosingPopover.js';
|
|
8
|
+
|
|
9
|
+
const CalendarOverlay = ({ 'aria-label': ariaLabel, 'data-testid': dataTestId, className, children }) => {
|
|
10
|
+
const isDesktop = useBreakpoints('md');
|
|
11
|
+
const prefix = useTestIdPrefix();
|
|
12
|
+
if (!isDesktop) {
|
|
13
|
+
// The picker's trigger state reaches ModalOverlay through react-aria's OverlayTriggerStateContext, so no open state is passed.
|
|
14
|
+
return (
|
|
15
|
+
// Flush bottom sheet all the way to `md`: the `sm:` overrides undo Modal's centred-card mode, since this surface never renders above `md`.
|
|
16
|
+
jsx(ModalOverlay, { isDismissable: true, className: "px-0 [--modal-pb:0px] sm:items-end sm:px-0 sm:[--modal-pb:0px] sm:[--modal-pt:16px]", children: jsx(Modal, { className: "w-full rounded-t-2xl rounded-b-none sm:rounded-t-2xl sm:rounded-b-none", children: jsx(TestIdProvider, { value: prefix, children: jsx(Dialog, { "aria-label": ariaLabel, "data-testid": dataTestId, className: cx('flex flex-col items-center', className), children: children }) }) }) }));
|
|
17
|
+
}
|
|
18
|
+
return (jsx(ScrollClosingPopover, { placement: "bottom right", offset: 8, className: ({ isEntering, isExiting }) => cx('origin-(--trigger-anchor-point) will-change-transform', isEntering &&
|
|
19
|
+
'duration-150 ease-out animate-in fade-in placement-right:slide-in-from-left-0.5 placement-top:slide-in-from-bottom-0.5 placement-bottom:slide-in-from-top-0.5', isExiting &&
|
|
20
|
+
'duration-100 ease-in animate-out fade-out placement-right:slide-out-to-left-0.5 placement-top:slide-out-to-bottom-0.5 placement-bottom:slide-out-to-top-0.5'), children: jsx(Dialog$1, { "aria-label": ariaLabel, "data-testid": dataTestId, className: cx('max-h-[inherit] overflow-y-auto rounded-2xl bg-primary shadow-xl ring ring-secondary_alt', className), children: children }) }));
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { CalendarOverlay };
|
|
24
|
+
//# sourceMappingURL=CalendarOverlay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CalendarOverlay.js","sources":["../../../../../src/components/organisms/DatePicker/components/CalendarOverlay.tsx"],"sourcesContent":[null],"names":["_jsx","AriaDialog"],"mappings":";;;;;;;;AAsBO,MAAM,eAAe,GAAG,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAwB,KAAI;AACnI,IAAA,MAAM,SAAS,GAAG,cAAc,CAAC,IAAI,CAAC;AACtC,IAAA,MAAM,MAAM,GAAG,eAAe,EAAE;IAEhC,IAAI,CAAC,SAAS,EAAE;;QAEd;;QAEEA,GAAA,CAAC,YAAY,IAAC,aAAa,EAAA,IAAA,EAAC,SAAS,EAAC,qFAAqF,YACzHA,GAAA,CAAC,KAAK,IAAC,SAAS,EAAC,wEAAwE,EAAA,QAAA,EAEvFA,GAAA,CAAC,cAAc,EAAA,EAAC,KAAK,EAAE,MAAM,EAAA,QAAA,EAE3BA,IAAC,MAAM,EAAA,EAAA,YAAA,EAAa,SAAS,EAAA,aAAA,EAAe,UAAU,EAAE,SAAS,EAAE,EAAE,CAAC,4BAA4B,EAAE,SAAS,CAAC,YAC3G,QAAQ,EAAA,CACF,GACM,EAAA,CACX,EAAA,CACK;IAEnB;IAEA,QACEA,GAAA,CAAC,oBAAoB,EAAA,EACnB,SAAS,EAAC,cAAc,EACxB,MAAM,EAAE,CAAC,EACT,SAAS,EAAE,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,KACnC,EAAE,CACA,uDAAuD,EACvD,UAAU;AACR,YAAA,+JAA+J,EACjK,SAAS;YACP,6JAA6J,CAChK,YAIHA,GAAA,CAACC,QAAU,kBACG,SAAS,EAAA,aAAA,EACR,UAAU,EACvB,SAAS,EAAE,EAAE,CAAC,0FAA0F,EAAE,SAAS,CAAC,YAEnH,QAAQ,EAAA,CACE,EAAA,CACQ;AAE3B;;"}
|
|
@@ -8,11 +8,13 @@ var React = require('react');
|
|
|
8
8
|
var reactAriaComponents = require('react-aria-components');
|
|
9
9
|
var calendarCell_utils = require('../calendarCell.utils.cjs');
|
|
10
10
|
|
|
11
|
-
const CalendarCell = ({ date: date$1, isHighlighted, showOutOfRangeDates
|
|
11
|
+
const CalendarCell = ({ date: date$1, isHighlighted, showOutOfRangeDates, ...props }) => {
|
|
12
12
|
const { locale } = reactAriaComponents.useLocale();
|
|
13
13
|
// The props context is merged into the calendar's value, so the cell reads the state context instead.
|
|
14
14
|
const rangeCalendarState = React.useContext(reactAriaComponents.RangeCalendarStateContext);
|
|
15
15
|
const isRangeCalendar = !!rangeCalendarState;
|
|
16
|
+
// Left unset, only range calendars hide the padding days; the Calendar organism's day-view mini calendar relies on seeing them.
|
|
17
|
+
const hidesOutOfRangeDates = showOutOfRangeDates === undefined ? isRangeCalendar : !showOutOfRangeDates;
|
|
16
18
|
const position = calendarCell_utils.getCalendarCellRangePosition(date$1, rangeCalendarState?.value ?? null);
|
|
17
19
|
const isTodayDate = date.isToday(date$1, date.getLocalTimeZone());
|
|
18
20
|
const prefix = testIdUtils.useTestIdPrefix();
|
|
@@ -27,7 +29,7 @@ const CalendarCell = ({ date: date$1, isHighlighted, showOutOfRangeDates = false
|
|
|
27
29
|
isRangeCalendar,
|
|
28
30
|
position,
|
|
29
31
|
});
|
|
30
|
-
return cx.cx('relative size-10 focus:outline-hidden', isRoundedLeft && 'rounded-l-full', isRoundedRight && 'rounded-r-full', position.isInRange && isDisabled && 'bg-secondary', isSelected && isRangeCalendar && 'bg-secondary', isDisabled ? 'pointer-events-none' : 'cursor-pointer', isFocusVisible ? 'z-10' : 'z-0', isOutsideMonth && 'opacity-50',
|
|
32
|
+
return cx.cx('relative size-10 focus:outline-hidden', isRoundedLeft && 'rounded-l-full', isRoundedRight && 'rounded-r-full', position.isInRange && isDisabled && 'bg-secondary', isSelected && isRangeCalendar && 'bg-secondary', isDisabled ? 'pointer-events-none' : 'cursor-pointer', isFocusVisible ? 'z-10' : 'z-0', isOutsideMonth && 'opacity-50', isOutsideMonth && hidesOutOfRangeDates && 'hidden',
|
|
31
33
|
// The range continues into the next month, so the highlight must bleed past this cell.
|
|
32
34
|
showTrailingGradient &&
|
|
33
35
|
'after:absolute after:inset-0 after:translate-x-full after:bg-gradient-to-l after:from-transparent after:to-bg-secondary in-[[role=gridcell]:last-child]:after:hidden',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cell.cjs","sources":["../../../../../src/components/organisms/DatePicker/components/Cell.tsx"],"sourcesContent":[null],"names":["date","useLocale","useContext","RangeCalendarStateContext","getCalendarCellRangePosition","isToday","getLocalTimeZone","useTestIdPrefix","joinTestId","slugifyTestId","_jsx","AriaCalendarCell","getCalendarCellOutline","cx","isCalendarCellMarkedSelected","_jsxs"],"mappings":";;;;;;;;;;AAiBO,MAAM,YAAY,GAAG,CAAC,QAAEA,MAAI,EAAE,aAAa,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"Cell.cjs","sources":["../../../../../src/components/organisms/DatePicker/components/Cell.tsx"],"sourcesContent":[null],"names":["date","useLocale","useContext","RangeCalendarStateContext","getCalendarCellRangePosition","isToday","getLocalTimeZone","useTestIdPrefix","joinTestId","slugifyTestId","_jsx","AriaCalendarCell","getCalendarCellOutline","cx","isCalendarCellMarkedSelected","_jsxs"],"mappings":";;;;;;;;;;AAiBO,MAAM,YAAY,GAAG,CAAC,QAAEA,MAAI,EAAE,aAAa,EAAE,mBAAmB,EAAE,GAAG,KAAK,EAAqB,KAAI;AACxG,IAAA,MAAM,EAAE,MAAM,EAAE,GAAGC,6BAAS,EAAE;;AAE9B,IAAA,MAAM,kBAAkB,GAAGC,gBAAU,CAACC,6CAAyB,CAAC;AAChE,IAAA,MAAM,eAAe,GAAG,CAAC,CAAC,kBAAkB;;AAE5C,IAAA,MAAM,oBAAoB,GAAG,mBAAmB,KAAK,SAAS,GAAG,eAAe,GAAG,CAAC,mBAAmB;AACvG,IAAA,MAAM,QAAQ,GAAGC,+CAA4B,CAACJ,MAAI,EAAE,kBAAkB,EAAE,KAAK,IAAI,IAAI,CAAC;IACtF,MAAM,WAAW,GAAGK,YAAO,CAACL,MAAI,EAAEM,qBAAgB,EAAE,CAAC;AAErD,IAAA,MAAM,MAAM,GAAGC,2BAAe,EAAE;IAChC,MAAM,UAAU,GAAG,MAAM,GAAGC,sBAAU,CAAC,MAAM,EAAE,CAAA,KAAA,EAAQC,yBAAa,CAACT,MAAI,CAAC,QAAQ,EAAE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Ac,GAAG,+CAA+C,GAAG,EAAE;;AAErE,gBAAA,UAAU,IAAI,CAAC,UAAU,IAAI,eAAe,GAAG,aAAa,GAAG,EAAE,EACjE,gBAAgB,IAAI,mFAAmF;;AAEvG,gBAAA,CAAC,UAAU,IAAI,CAAC,UAAU,GAAG,2CAA2C,GAAG,EAAE,EAC7E,CAAC,UAAU,IAAI,WAAW,GAAG,mDAAmD,GAAG,EAAE,CACtF,EAAA,QAAA,EAAA,CAEA,aAAa,EAEb,CAAC,aAAa,IAAI,WAAW,MAC5BH,cAAA,CAAA,KAAA,EAAA,EACE,SAAS,EAAEG,KAAE,CACX,oEAAoE,EACpE,gBAAgB,GAAG,aAAa,GAAG,qBAAqB,EACxD,UAAU,IAAI,YAAY,CAC3B,EAAA,CACD,CACH,CAAA,EAAA,CACG;QAEV,CAAC,EAAA,CACgB;AAEvB;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cell.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/DatePicker/components/Cell.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,IAAI,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAIxF,UAAU,iBAAkB,SAAQ,qBAAqB;IACvD,uCAAuC;IACvC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,0CAA0C;IAC1C,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,eAAO,MAAM,YAAY,GAAI,
|
|
1
|
+
{"version":3,"file":"Cell.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/DatePicker/components/Cell.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,IAAI,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAIxF,UAAU,iBAAkB,SAAQ,qBAAqB;IACvD,uCAAuC;IACvC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,0CAA0C;IAC1C,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,eAAO,MAAM,YAAY,GAAI,wDAAwD,iBAAiB,gCA2FrG,CAAC"}
|
|
@@ -6,11 +6,13 @@ import { useContext } from 'react';
|
|
|
6
6
|
import { useLocale, RangeCalendarStateContext, CalendarCell as CalendarCell$1 } from 'react-aria-components';
|
|
7
7
|
import { getCalendarCellRangePosition, getCalendarCellOutline, isCalendarCellMarkedSelected } from '../calendarCell.utils.js';
|
|
8
8
|
|
|
9
|
-
const CalendarCell = ({ date, isHighlighted, showOutOfRangeDates
|
|
9
|
+
const CalendarCell = ({ date, isHighlighted, showOutOfRangeDates, ...props }) => {
|
|
10
10
|
const { locale } = useLocale();
|
|
11
11
|
// The props context is merged into the calendar's value, so the cell reads the state context instead.
|
|
12
12
|
const rangeCalendarState = useContext(RangeCalendarStateContext);
|
|
13
13
|
const isRangeCalendar = !!rangeCalendarState;
|
|
14
|
+
// Left unset, only range calendars hide the padding days; the Calendar organism's day-view mini calendar relies on seeing them.
|
|
15
|
+
const hidesOutOfRangeDates = showOutOfRangeDates === undefined ? isRangeCalendar : !showOutOfRangeDates;
|
|
14
16
|
const position = getCalendarCellRangePosition(date, rangeCalendarState?.value ?? null);
|
|
15
17
|
const isTodayDate = isToday(date, getLocalTimeZone());
|
|
16
18
|
const prefix = useTestIdPrefix();
|
|
@@ -25,7 +27,7 @@ const CalendarCell = ({ date, isHighlighted, showOutOfRangeDates = false, ...pro
|
|
|
25
27
|
isRangeCalendar,
|
|
26
28
|
position,
|
|
27
29
|
});
|
|
28
|
-
return cx('relative size-10 focus:outline-hidden', isRoundedLeft && 'rounded-l-full', isRoundedRight && 'rounded-r-full', position.isInRange && isDisabled && 'bg-secondary', isSelected && isRangeCalendar && 'bg-secondary', isDisabled ? 'pointer-events-none' : 'cursor-pointer', isFocusVisible ? 'z-10' : 'z-0', isOutsideMonth && 'opacity-50',
|
|
30
|
+
return cx('relative size-10 focus:outline-hidden', isRoundedLeft && 'rounded-l-full', isRoundedRight && 'rounded-r-full', position.isInRange && isDisabled && 'bg-secondary', isSelected && isRangeCalendar && 'bg-secondary', isDisabled ? 'pointer-events-none' : 'cursor-pointer', isFocusVisible ? 'z-10' : 'z-0', isOutsideMonth && 'opacity-50', isOutsideMonth && hidesOutOfRangeDates && 'hidden',
|
|
29
31
|
// The range continues into the next month, so the highlight must bleed past this cell.
|
|
30
32
|
showTrailingGradient &&
|
|
31
33
|
'after:absolute after:inset-0 after:translate-x-full after:bg-gradient-to-l after:from-transparent after:to-bg-secondary in-[[role=gridcell]:last-child]:after:hidden',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cell.js","sources":["../../../../../src/components/organisms/DatePicker/components/Cell.tsx"],"sourcesContent":[null],"names":["_jsx","AriaCalendarCell","_jsxs"],"mappings":";;;;;;;;AAiBO,MAAM,YAAY,GAAG,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"Cell.js","sources":["../../../../../src/components/organisms/DatePicker/components/Cell.tsx"],"sourcesContent":[null],"names":["_jsx","AriaCalendarCell","_jsxs"],"mappings":";;;;;;;;AAiBO,MAAM,YAAY,GAAG,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,mBAAmB,EAAE,GAAG,KAAK,EAAqB,KAAI;AACxG,IAAA,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE;;AAE9B,IAAA,MAAM,kBAAkB,GAAG,UAAU,CAAC,yBAAyB,CAAC;AAChE,IAAA,MAAM,eAAe,GAAG,CAAC,CAAC,kBAAkB;;AAE5C,IAAA,MAAM,oBAAoB,GAAG,mBAAmB,KAAK,SAAS,GAAG,eAAe,GAAG,CAAC,mBAAmB;AACvG,IAAA,MAAM,QAAQ,GAAG,4BAA4B,CAAC,IAAI,EAAE,kBAAkB,EAAE,KAAK,IAAI,IAAI,CAAC;IACtF,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,EAAE,gBAAgB,EAAE,CAAC;AAErD,IAAA,MAAM,MAAM,GA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,QACEC,IAAA,CAAA,KAAA,EAAA,EACE,SAAS,EAAE,EAAE,CACX,oHAAoH;;AAEpH,gBAAA,UAAU,IAAI,mBAAmB;;AAEjC,gBAAA,cAAc,GAAG,+CAA+C,GAAG,EAAE;;AAErE,gBAAA,UAAU,IAAI,CAAC,UAAU,IAAI,eAAe,GAAG,aAAa,GAAG,EAAE,EACjE,gBAAgB,IAAI,mFAAmF;;AAEvG,gBAAA,CAAC,UAAU,IAAI,CAAC,UAAU,GAAG,2CAA2C,GAAG,EAAE,EAC7E,CAAC,UAAU,IAAI,WAAW,GAAG,mDAAmD,GAAG,EAAE,CACtF,EAAA,QAAA,EAAA,CAEA,aAAa,EAEb,CAAC,aAAa,IAAI,WAAW,MAC5BF,GAAA,CAAA,KAAA,EAAA,EACE,SAAS,EAAE,EAAE,CACX,oEAAoE,EACpE,gBAAgB,GAAG,aAAa,GAAG,qBAAqB,EACxD,UAAU,IAAI,YAAY,CAC3B,EAAA,CACD,CACH,CAAA,EAAA,CACG;QAEV,CAAC,EAAA,CACgB;AAEvB;;"}
|
|
@@ -3,26 +3,25 @@
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var uiIcons = require('@flipdish/ui-icons');
|
|
5
5
|
var Button = require('@flipdish/ui-library/components/atoms/Button');
|
|
6
|
-
var cx = require('@flipdish/ui-library/utilities/cx');
|
|
7
6
|
var testIdUtils = require('@flipdish/ui-library/utilities/testIdUtils');
|
|
8
7
|
var date = require('@internationalized/date');
|
|
9
8
|
var i18n = require('@react-aria/i18n');
|
|
10
9
|
var utils = require('@react-stately/utils');
|
|
11
10
|
var React = require('react');
|
|
12
11
|
var reactAriaComponents = require('react-aria-components');
|
|
13
|
-
var
|
|
12
|
+
var CalendarOverlay = require('./CalendarOverlay.cjs');
|
|
14
13
|
var InputDate = require('./InputDate.cjs');
|
|
15
14
|
var RangeCalendar = require('./RangeCalendar.cjs');
|
|
16
15
|
|
|
17
16
|
const now = date.today(date.getLocalTimeZone());
|
|
18
17
|
const highlightedDates = [date.today(date.getLocalTimeZone())];
|
|
19
18
|
/**
|
|
20
|
-
* Trigger button with a two-month popover calendar for picking a start and end date
|
|
21
|
-
* preset shortcuts and Apply and Cancel actions.
|
|
19
|
+
* Trigger button with a two-month popover calendar for picking a start and end date, opening as a
|
|
20
|
+
* bottom sheet below the `md` breakpoint. Includes preset shortcuts and Apply and Cancel actions.
|
|
22
21
|
*
|
|
23
22
|
* @summary popover calendar for selecting a date range
|
|
24
23
|
*/
|
|
25
|
-
const DateRangePicker = ({ value: valueProp, defaultValue, onChange, onApply, onCancel, onOpenChange, size = 'sm', 'data-testid': dataTestId, ...props }) => {
|
|
24
|
+
const DateRangePicker = ({ value: valueProp, defaultValue, onChange, onApply, onCancel, onOpenChange, size = 'sm', presets: presetsProp, placeholder = 'Select dates', 'data-testid': dataTestId, ...props }) => {
|
|
26
25
|
const { locale } = reactAriaComponents.useLocale();
|
|
27
26
|
const formatter = i18n.useDateFormatter({
|
|
28
27
|
month: 'short',
|
|
@@ -36,9 +35,10 @@ const DateRangePicker = ({ value: valueProp, defaultValue, onChange, onApply, on
|
|
|
36
35
|
const [value, setValue] = utils.useControlledState(valueProp, defaultValue || null, onChange);
|
|
37
36
|
const [draftValue, setDraftValue] = React.useState(value);
|
|
38
37
|
const [focusedValue, setFocusedValue] = React.useState(null);
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
const formattedRange = value
|
|
39
|
+
? `${formatter.format(value.start.toDate(date.getLocalTimeZone()))} – ${formatter.format(value.end.toDate(date.getLocalTimeZone()))}`
|
|
40
|
+
: null;
|
|
41
|
+
const defaultPresets = React.useMemo(() => ({
|
|
42
42
|
today: { label: 'Today', value: { start: now, end: now } },
|
|
43
43
|
yesterday: { label: 'Yesterday', value: { start: now.subtract({ days: 1 }), end: now.subtract({ days: 1 }) } },
|
|
44
44
|
thisWeek: { label: 'This week', value: { start: date.startOfWeek(now, locale), end: date.endOfWeek(now, locale) } },
|
|
@@ -73,6 +73,7 @@ const DateRangePicker = ({ value: valueProp, defaultValue, onChange, onApply, on
|
|
|
73
73
|
},
|
|
74
74
|
},
|
|
75
75
|
}), [locale]);
|
|
76
|
+
const presets = presetsProp ?? defaultPresets;
|
|
76
77
|
const rootTestId = testIdUtils.useResolvedTestId({ testId: dataTestId, segment: 'date-range-picker', rootName: 'date-range-picker' });
|
|
77
78
|
return (jsxRuntime.jsx(testIdUtils.TestIdProvider, { value: rootTestId, children: jsxRuntime.jsxs(reactAriaComponents.DateRangePicker, { "aria-label": "Date range picker", shouldCloseOnSelect: false, ...props, value: draftValue, onChange: setDraftValue, onOpenChange: (isOpen) => {
|
|
78
79
|
// Re-seed the draft from the latest committed value every time the popover opens, so
|
|
@@ -83,23 +84,17 @@ const DateRangePicker = ({ value: valueProp, defaultValue, onChange, onApply, on
|
|
|
83
84
|
setFocusedValue(value?.start ?? null);
|
|
84
85
|
}
|
|
85
86
|
onOpenChange?.(isOpen);
|
|
86
|
-
}, "data-testid": rootTestId, children: [jsxRuntime.jsx(reactAriaComponents.Group, { children: jsxRuntime.jsx(Button.Button, { size: size, color: "secondary", iconLeading: uiIcons.Calendar, "data-testid": testIdUtils.joinTestId(rootTestId, 'trigger'), children:
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
close();
|
|
98
|
-
}, children: "Cancel" }), jsxRuntime.jsx(Button.Button, { size: "sm", color: "primary", "data-testid": testIdUtils.joinTestId(rootTestId, 'apply'), onClick: () => {
|
|
99
|
-
setValue(draftValue);
|
|
100
|
-
onApply?.();
|
|
101
|
-
close();
|
|
102
|
-
}, children: "Apply" })] })] })] })] })) }) })] }) }));
|
|
87
|
+
}, "data-testid": rootTestId, children: [jsxRuntime.jsx(reactAriaComponents.Group, { children: jsxRuntime.jsx(Button.Button, { size: size, color: "secondary", iconLeading: uiIcons.Calendar, "data-testid": testIdUtils.joinTestId(rootTestId, 'trigger'), children: formattedRange ?? jsxRuntime.jsx("span", { className: "text-placeholder", children: placeholder }) }) }), jsxRuntime.jsx(CalendarOverlay.CalendarOverlay, { "aria-label": props['aria-label'] ?? 'Date range picker', "data-testid": testIdUtils.joinTestId(rootTestId, 'popover'), className: "flex focus:outline-hidden", children: ({ close }) => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: "hidden w-38 flex-col gap-0.5 border-r border-solid border-secondary p-3 lg:flex", children: Object.values(presets).map((preset) => (jsxRuntime.jsx(RangeCalendar.RangePresetButton, { value: preset.value, onClick: () => {
|
|
88
|
+
setDraftValue(preset.value);
|
|
89
|
+
setFocusedValue(preset.value.start);
|
|
90
|
+
}, children: preset.label }, preset.label))) }), jsxRuntime.jsxs("div", { className: "flex flex-col max-md:w-full", children: [jsxRuntime.jsx(RangeCalendar.RangeCalendar, { focusedValue: focusedValue, onFocusChange: setFocusedValue, highlightedDates: highlightedDates, presets: presets, className: "max-md:w-full max-md:self-center max-sm:max-w-78 sm:max-md:max-w-82" }), jsxRuntime.jsxs("div", { className: "sticky bottom-0 flex justify-between gap-3 border-t border-secondary bg-primary px-4 pt-4 pb-[calc(1rem+env(safe-area-inset-bottom))]", children: [jsxRuntime.jsxs("div", { className: "hidden items-center gap-2 md:flex", children: [jsxRuntime.jsx(InputDate.InputDateBase, { slot: "start", size: "sm" }), jsxRuntime.jsx("div", { className: "text-md text-quaternary", children: "\u2013" }), jsxRuntime.jsx(InputDate.InputDateBase, { slot: "end", size: "sm" })] }), jsxRuntime.jsxs("div", { className: "grid w-full grid-cols-2 gap-3 md:flex md:w-auto", children: [jsxRuntime.jsx(Button.Button, { size: "sm", color: "secondary", "data-testid": testIdUtils.joinTestId(rootTestId, 'cancel'), onClick: () => {
|
|
91
|
+
onCancel?.();
|
|
92
|
+
close();
|
|
93
|
+
}, children: "Cancel" }), jsxRuntime.jsx(Button.Button, { size: "sm", color: "primary", "data-testid": testIdUtils.joinTestId(rootTestId, 'apply'), onClick: () => {
|
|
94
|
+
setValue(draftValue);
|
|
95
|
+
onApply?.();
|
|
96
|
+
close();
|
|
97
|
+
}, children: "Apply" })] })] })] })] })) })] }) }));
|
|
103
98
|
};
|
|
104
99
|
|
|
105
100
|
exports.DateRangePicker = DateRangePicker;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateRangePicker.cjs","sources":["../../../../../src/components/organisms/DatePicker/components/DateRangePicker.tsx"],"sourcesContent":[null],"names":["today","getLocalTimeZone","useLocale","useDateFormatter","useControlledState","useState","useMemo","startOfWeek","endOfWeek","startOfMonth","endOfMonth","useResolvedTestId","_jsx","TestIdProvider","_jsxs","AriaDateRangePicker","AriaGroup","Button","CalendarIcon","joinTestId","
|
|
1
|
+
{"version":3,"file":"DateRangePicker.cjs","sources":["../../../../../src/components/organisms/DatePicker/components/DateRangePicker.tsx"],"sourcesContent":[null],"names":["today","getLocalTimeZone","useLocale","useDateFormatter","useControlledState","useState","useMemo","startOfWeek","endOfWeek","startOfMonth","endOfMonth","useResolvedTestId","_jsx","TestIdProvider","_jsxs","AriaDateRangePicker","AriaGroup","Button","CalendarIcon","joinTestId","CalendarOverlay","_Fragment","RangePresetButton","RangeCalendar","InputDateBase"],"mappings":";;;;;;;;;;;;;;;AAgBA,MAAM,GAAG,GAAGA,UAAK,CAACC,qBAAgB,EAAE,CAAC;AAErC,MAAM,gBAAgB,GAAG,CAACD,UAAK,CAACC,qBAAgB,EAAE,CAAC,CAAC;AAiBpD;;;;;AAKG;AACI,MAAM,eAAe,GAAG,CAAC,EAC9B,KAAK,EAAE,SAAS,EAChB,YAAY,EACZ,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,IAAI,GAAG,IAAI,EACX,OAAO,EAAE,WAAW,EACpB,WAAW,GAAG,cAAc,EAC5B,aAAa,EAAE,UAAU,EACzB,GAAG,KAAK,EACa,KAAI;AACzB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B;;"}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import type { ButtonProps } from '@flipdish/ui-library/components/atoms/Button';
|
|
2
2
|
import type { DateRangePickerProps as AriaDateRangePickerProps, DateValue } from 'react-aria-components';
|
|
3
|
+
import { type RangeCalendarProps } from './RangeCalendar';
|
|
3
4
|
export interface DateRangePickerProps extends AriaDateRangePickerProps<DateValue> {
|
|
4
|
-
/** Size of the trigger button; the
|
|
5
|
+
/** Size of the trigger button; the calendar's inputs and actions keep a fixed size. */
|
|
5
6
|
size?: ButtonProps['size'];
|
|
7
|
+
/** Shortcut ranges keyed by a stable id, replacing the built-in set; each label also derives its `--preset-<slug>` test id. */
|
|
8
|
+
presets?: RangeCalendarProps['presets'];
|
|
9
|
+
/** Trigger text while no range is applied. */
|
|
10
|
+
placeholder?: string;
|
|
6
11
|
/** The function to call when the apply button is clicked. */
|
|
7
12
|
onApply?: () => void;
|
|
8
13
|
/** The function to call when the cancel button is clicked. */
|
|
@@ -11,10 +16,10 @@ export interface DateRangePickerProps extends AriaDateRangePickerProps<DateValue
|
|
|
11
16
|
'data-testid'?: string;
|
|
12
17
|
}
|
|
13
18
|
/**
|
|
14
|
-
* Trigger button with a two-month popover calendar for picking a start and end date
|
|
15
|
-
* preset shortcuts and Apply and Cancel actions.
|
|
19
|
+
* Trigger button with a two-month popover calendar for picking a start and end date, opening as a
|
|
20
|
+
* bottom sheet below the `md` breakpoint. Includes preset shortcuts and Apply and Cancel actions.
|
|
16
21
|
*
|
|
17
22
|
* @summary popover calendar for selecting a date range
|
|
18
23
|
*/
|
|
19
|
-
export declare const DateRangePicker: ({ value: valueProp, defaultValue, onChange, onApply, onCancel, onOpenChange, size, "data-testid": dataTestId, ...props }: DateRangePickerProps) => import("react").JSX.Element;
|
|
24
|
+
export declare const DateRangePicker: ({ value: valueProp, defaultValue, onChange, onApply, onCancel, onOpenChange, size, presets: presetsProp, placeholder, "data-testid": dataTestId, ...props }: DateRangePickerProps) => import("react").JSX.Element;
|
|
20
25
|
//# sourceMappingURL=DateRangePicker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateRangePicker.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/DatePicker/components/DateRangePicker.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8CAA8C,CAAC;
|
|
1
|
+
{"version":3,"file":"DateRangePicker.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/DatePicker/components/DateRangePicker.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8CAA8C,CAAC;AAOhF,OAAO,KAAK,EAAE,oBAAoB,IAAI,wBAAwB,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAIzG,OAAO,EAAiB,KAAK,kBAAkB,EAAqB,MAAM,iBAAiB,CAAC;AAM5F,MAAM,WAAW,oBAAqB,SAAQ,wBAAwB,CAAC,SAAS,CAAC;IAC/E,uFAAuF;IACvF,IAAI,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC3B,+HAA+H;IAC/H,OAAO,CAAC,EAAE,kBAAkB,CAAC,SAAS,CAAC,CAAC;IACxC,8CAA8C;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,4HAA4H;IAC5H,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,6JAY7B,oBAAoB,gCA2JtB,CAAC"}
|
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { Calendar } from '@flipdish/ui-icons';
|
|
3
3
|
import { Button } from '@flipdish/ui-library/components/atoms/Button';
|
|
4
|
-
import { cx } from '@flipdish/ui-library/utilities/cx';
|
|
5
4
|
import { useResolvedTestId, TestIdProvider, joinTestId } from '@flipdish/ui-library/utilities/testIdUtils';
|
|
6
5
|
import { today, getLocalTimeZone, endOfMonth, startOfMonth, endOfWeek, startOfWeek } from '@internationalized/date';
|
|
7
6
|
import { useDateFormatter } from '@react-aria/i18n';
|
|
8
7
|
import { useControlledState } from '@react-stately/utils';
|
|
9
8
|
import { useState, useMemo } from 'react';
|
|
10
|
-
import { useLocale, DateRangePicker as DateRangePicker$1, Group
|
|
11
|
-
import {
|
|
9
|
+
import { useLocale, DateRangePicker as DateRangePicker$1, Group } from 'react-aria-components';
|
|
10
|
+
import { CalendarOverlay } from './CalendarOverlay.js';
|
|
12
11
|
import { InputDateBase } from './InputDate.js';
|
|
13
12
|
import { RangePresetButton, RangeCalendar } from './RangeCalendar.js';
|
|
14
13
|
|
|
15
14
|
const now = today(getLocalTimeZone());
|
|
16
15
|
const highlightedDates = [today(getLocalTimeZone())];
|
|
17
16
|
/**
|
|
18
|
-
* Trigger button with a two-month popover calendar for picking a start and end date
|
|
19
|
-
* preset shortcuts and Apply and Cancel actions.
|
|
17
|
+
* Trigger button with a two-month popover calendar for picking a start and end date, opening as a
|
|
18
|
+
* bottom sheet below the `md` breakpoint. Includes preset shortcuts and Apply and Cancel actions.
|
|
20
19
|
*
|
|
21
20
|
* @summary popover calendar for selecting a date range
|
|
22
21
|
*/
|
|
23
|
-
const DateRangePicker = ({ value: valueProp, defaultValue, onChange, onApply, onCancel, onOpenChange, size = 'sm', 'data-testid': dataTestId, ...props }) => {
|
|
22
|
+
const DateRangePicker = ({ value: valueProp, defaultValue, onChange, onApply, onCancel, onOpenChange, size = 'sm', presets: presetsProp, placeholder = 'Select dates', 'data-testid': dataTestId, ...props }) => {
|
|
24
23
|
const { locale } = useLocale();
|
|
25
24
|
const formatter = useDateFormatter({
|
|
26
25
|
month: 'short',
|
|
@@ -34,9 +33,10 @@ const DateRangePicker = ({ value: valueProp, defaultValue, onChange, onApply, on
|
|
|
34
33
|
const [value, setValue] = useControlledState(valueProp, defaultValue || null, onChange);
|
|
35
34
|
const [draftValue, setDraftValue] = useState(value);
|
|
36
35
|
const [focusedValue, setFocusedValue] = useState(null);
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
const formattedRange = value
|
|
37
|
+
? `${formatter.format(value.start.toDate(getLocalTimeZone()))} – ${formatter.format(value.end.toDate(getLocalTimeZone()))}`
|
|
38
|
+
: null;
|
|
39
|
+
const defaultPresets = useMemo(() => ({
|
|
40
40
|
today: { label: 'Today', value: { start: now, end: now } },
|
|
41
41
|
yesterday: { label: 'Yesterday', value: { start: now.subtract({ days: 1 }), end: now.subtract({ days: 1 }) } },
|
|
42
42
|
thisWeek: { label: 'This week', value: { start: startOfWeek(now, locale), end: endOfWeek(now, locale) } },
|
|
@@ -71,6 +71,7 @@ const DateRangePicker = ({ value: valueProp, defaultValue, onChange, onApply, on
|
|
|
71
71
|
},
|
|
72
72
|
},
|
|
73
73
|
}), [locale]);
|
|
74
|
+
const presets = presetsProp ?? defaultPresets;
|
|
74
75
|
const rootTestId = useResolvedTestId({ testId: dataTestId, segment: 'date-range-picker', rootName: 'date-range-picker' });
|
|
75
76
|
return (jsx(TestIdProvider, { value: rootTestId, children: jsxs(DateRangePicker$1, { "aria-label": "Date range picker", shouldCloseOnSelect: false, ...props, value: draftValue, onChange: setDraftValue, onOpenChange: (isOpen) => {
|
|
76
77
|
// Re-seed the draft from the latest committed value every time the popover opens, so
|
|
@@ -81,23 +82,17 @@ const DateRangePicker = ({ value: valueProp, defaultValue, onChange, onApply, on
|
|
|
81
82
|
setFocusedValue(value?.start ?? null);
|
|
82
83
|
}
|
|
83
84
|
onOpenChange?.(isOpen);
|
|
84
|
-
}, "data-testid": rootTestId, children: [jsx(Group, { children: jsx(Button, { size: size, color: "secondary", iconLeading: Calendar, "data-testid": joinTestId(rootTestId, 'trigger'), children:
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
close();
|
|
96
|
-
}, children: "Cancel" }), jsx(Button, { size: "sm", color: "primary", "data-testid": joinTestId(rootTestId, 'apply'), onClick: () => {
|
|
97
|
-
setValue(draftValue);
|
|
98
|
-
onApply?.();
|
|
99
|
-
close();
|
|
100
|
-
}, children: "Apply" })] })] })] })] })) }) })] }) }));
|
|
85
|
+
}, "data-testid": rootTestId, children: [jsx(Group, { children: jsx(Button, { size: size, color: "secondary", iconLeading: Calendar, "data-testid": joinTestId(rootTestId, 'trigger'), children: formattedRange ?? jsx("span", { className: "text-placeholder", children: placeholder }) }) }), jsx(CalendarOverlay, { "aria-label": props['aria-label'] ?? 'Date range picker', "data-testid": joinTestId(rootTestId, 'popover'), className: "flex focus:outline-hidden", children: ({ close }) => (jsxs(Fragment, { children: [jsx("div", { className: "hidden w-38 flex-col gap-0.5 border-r border-solid border-secondary p-3 lg:flex", children: Object.values(presets).map((preset) => (jsx(RangePresetButton, { value: preset.value, onClick: () => {
|
|
86
|
+
setDraftValue(preset.value);
|
|
87
|
+
setFocusedValue(preset.value.start);
|
|
88
|
+
}, children: preset.label }, preset.label))) }), jsxs("div", { className: "flex flex-col max-md:w-full", children: [jsx(RangeCalendar, { focusedValue: focusedValue, onFocusChange: setFocusedValue, highlightedDates: highlightedDates, presets: presets, className: "max-md:w-full max-md:self-center max-sm:max-w-78 sm:max-md:max-w-82" }), jsxs("div", { className: "sticky bottom-0 flex justify-between gap-3 border-t border-secondary bg-primary px-4 pt-4 pb-[calc(1rem+env(safe-area-inset-bottom))]", children: [jsxs("div", { className: "hidden items-center gap-2 md:flex", children: [jsx(InputDateBase, { slot: "start", size: "sm" }), jsx("div", { className: "text-md text-quaternary", children: "\u2013" }), jsx(InputDateBase, { slot: "end", size: "sm" })] }), jsxs("div", { className: "grid w-full grid-cols-2 gap-3 md:flex md:w-auto", children: [jsx(Button, { size: "sm", color: "secondary", "data-testid": joinTestId(rootTestId, 'cancel'), onClick: () => {
|
|
89
|
+
onCancel?.();
|
|
90
|
+
close();
|
|
91
|
+
}, children: "Cancel" }), jsx(Button, { size: "sm", color: "primary", "data-testid": joinTestId(rootTestId, 'apply'), onClick: () => {
|
|
92
|
+
setValue(draftValue);
|
|
93
|
+
onApply?.();
|
|
94
|
+
close();
|
|
95
|
+
}, children: "Apply" })] })] })] })] })) })] }) }));
|
|
101
96
|
};
|
|
102
97
|
|
|
103
98
|
export { DateRangePicker };
|