@swan-io/shared-business 4.1.1 → 4.2.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swan-io/shared-business",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=18.0.0",
|
|
6
6
|
"yarn": "^1.22.0"
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@formatjs/intl": "^2.9.9",
|
|
33
33
|
"@googlemaps/js-api-loader": "1.16.2",
|
|
34
34
|
"@placekit/client-js": "^2.2.0",
|
|
35
|
-
"@swan-io/boxed": "^
|
|
35
|
+
"@swan-io/boxed": "^2.0.0",
|
|
36
36
|
"dayjs": "^1.11.10",
|
|
37
37
|
"react": "^18.2.0",
|
|
38
38
|
"react-atomic-state": "^1.2.7",
|
|
@@ -279,8 +279,8 @@ const isDateRange = (value) => {
|
|
|
279
279
|
};
|
|
280
280
|
const isSelectedDate = (date, value) => {
|
|
281
281
|
return match(value)
|
|
282
|
-
.with(Option.
|
|
283
|
-
.with(Option.
|
|
282
|
+
.with(Option.P.Some(P.select()), value => isDateEquals(value, date))
|
|
283
|
+
.with(Option.P.None, () => false)
|
|
284
284
|
.with(P.when(isDateRange), ({ start, end }) => {
|
|
285
285
|
// if range is invalid, we don't display any selection
|
|
286
286
|
if (start.isSome() && end.isSome() && isDateAfter(start.value, end.value)) {
|
|
@@ -477,7 +477,7 @@ export const DatePicker = ({ label, value, error, format, firstWeekDay, isSelect
|
|
|
477
477
|
const ref = useRef(null);
|
|
478
478
|
const [isOpened, { open, close }] = useDisclosure(false);
|
|
479
479
|
const popoverId = useId();
|
|
480
|
-
return (_jsxs(_Fragment, { children: [_jsx(Box, { direction: "row", alignItems: "end", children: _jsx(LakeLabel, { label: label, style: styles.label, actions: _jsx(LakeButton, { mode: "secondary", icon: "calendar-ltr-regular", size: "small", onPress: open, ariaLabel: t("common.open") }), render: id => (_jsx(Rifm, { value: value ?? "", onChange: onChange, ...rifmDateProps, children: ({ value, onChange }) => (_jsx(LakeTextInput, { ref: ref, id: id, placeholder: format, value: value, error: error, onChange: onChange, ariaExpanded: isOpened })) })) }) }), _jsx(Popover, { id: popoverId, role: "dialog", onDismiss: close, referenceRef: ref, visible: isOpened, children: _jsx(View, { style: desktop ? styles.popoverDesktop : styles.popover, children: _jsx(DatePickerPopoverContent, { value: value, format: format, firstWeekDay: firstWeekDay, desktop: desktop, isSelectable: isSelectable, onChange: onChange }) }) })] }));
|
|
480
|
+
return (_jsxs(_Fragment, { children: [_jsx(Box, { direction: "row", alignItems: "end", children: _jsx(LakeLabel, { label: label, style: styles.label, actions: _jsx(LakeButton, { mode: "secondary", icon: "calendar-ltr-regular", size: "small", onPress: open, ariaLabel: t("common.open") }), render: id => (_jsx(Rifm, { value: value ?? "", onChange: onChange, ...rifmDateProps, children: ({ value, onChange }) => (_jsx(LakeTextInput, { ref: ref, id: id, placeholder: format, value: value, error: error, onChange: onChange, ariaExpanded: isOpened })) })) }) }), _jsx(Popover, { id: popoverId, role: "dialog", onDismiss: close, referenceRef: ref, visible: isOpened, field: true, children: _jsx(View, { style: desktop ? styles.popoverDesktop : styles.popover, children: _jsx(DatePickerPopoverContent, { value: value, format: format, firstWeekDay: firstWeekDay, desktop: desktop, isSelectable: isSelectable, onChange: onChange }) }) })] }));
|
|
481
481
|
};
|
|
482
482
|
export const DatePickerModal = ({ value, format, firstWeekDay, isSelectable, onChange, visible, label, cancelLabel, confirmLabel, validate, onDissmiss, }) => {
|
|
483
483
|
const { desktop } = useResponsive(DATE_PICKER_MOBILE_THRESHOLD);
|