@pushwoosh/dumb-components 1.0.36 → 1.0.38
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/DateTimePicker/components/DatePicker/types.d.ts +2 -2
- package/DateTimePicker/components/Month/Month.js +2 -2
- package/DateTimePicker/components/Month/types.d.ts +2 -2
- package/DateTimePicker/components/MonthView/types.d.ts +2 -2
- package/DateTimePicker/helpers.d.ts +0 -2
- package/DateTimePicker/helpers.js +5 -4
- package/DateTimePicker/types.d.ts +2 -2
- package/DropdownMenu/components/DropdownMenuItem/styles.js +1 -1
- package/package.json +1 -1
|
@@ -2,8 +2,8 @@ import type { ReactNode } from 'react';
|
|
|
2
2
|
export interface DatePickerProps {
|
|
3
3
|
value?: string;
|
|
4
4
|
userInputDay?: string;
|
|
5
|
-
minDate?: Date;
|
|
6
|
-
maxDate?: Date;
|
|
5
|
+
minDate?: Date | string;
|
|
6
|
+
maxDate?: Date | string;
|
|
7
7
|
slotAfterMonth?: () => ReactNode | null;
|
|
8
8
|
onChange: (day: string) => void;
|
|
9
9
|
}
|
|
@@ -32,8 +32,8 @@ export function Month(props) {
|
|
|
32
32
|
const curDay = new Date(Date.UTC(firstDayDate.getUTCFullYear(), firstDayDate.getUTCMonth(), firstDayDate.getUTCDate() + i));
|
|
33
33
|
const isDisabled = isInRange({
|
|
34
34
|
value: curDay,
|
|
35
|
-
minDate: minDate
|
|
36
|
-
maxDate: maxDate
|
|
35
|
+
minDate: minDate,
|
|
36
|
+
maxDate: maxDate
|
|
37
37
|
});
|
|
38
38
|
return React.createElement(CellBox, {
|
|
39
39
|
key: `${curDay}`,
|
|
@@ -2,8 +2,8 @@ export interface MonthViewProps {
|
|
|
2
2
|
month: string;
|
|
3
3
|
activeDay?: string;
|
|
4
4
|
userInputDay?: string;
|
|
5
|
-
minDate?: Date;
|
|
6
|
-
maxDate?: Date;
|
|
5
|
+
minDate?: Date | string;
|
|
6
|
+
maxDate?: Date | string;
|
|
7
7
|
onDaySelect: (day: string) => void;
|
|
8
8
|
onShowYear: () => void;
|
|
9
9
|
onShowDecade: () => void;
|
|
@@ -10,6 +10,4 @@ export declare const differenceInDays: (d1: Date, d2: Date) => number;
|
|
|
10
10
|
export declare const monthName: (month: number, monthFormat?: "short" | "long") => string;
|
|
11
11
|
export declare const isSamePeriod: (d1: string | Date, d2: string | Date, period: Period) => boolean;
|
|
12
12
|
export declare const firstDayOfWeek: (date: Date) => Date;
|
|
13
|
-
export declare const startOfYear: (date: Date) => Date;
|
|
14
|
-
export declare const endOfYear: (date: Date) => Date;
|
|
15
13
|
export declare const isInRange: (options: RangeOptions) => boolean;
|
|
@@ -57,8 +57,9 @@ export const firstDayOfWeek = date => {
|
|
|
57
57
|
}
|
|
58
58
|
return d;
|
|
59
59
|
};
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
const parseLocalTzDateOrString = date => {
|
|
61
|
+
return date instanceof Date ? createUTCDate(date.getFullYear(), date.getMonth() + 1, date.getDate()) : parseStringToDate(date);
|
|
62
|
+
};
|
|
62
63
|
export const isInRange = options => {
|
|
63
64
|
const {
|
|
64
65
|
value,
|
|
@@ -67,12 +68,12 @@ export const isInRange = options => {
|
|
|
67
68
|
} = options;
|
|
68
69
|
let result = false;
|
|
69
70
|
if (minDate) {
|
|
70
|
-
if (value.getTime() < minDate.getTime()) {
|
|
71
|
+
if (value.getTime() < parseLocalTzDateOrString(minDate).getTime()) {
|
|
71
72
|
result = true;
|
|
72
73
|
}
|
|
73
74
|
}
|
|
74
75
|
if (maxDate) {
|
|
75
|
-
if (value.getTime() > maxDate.getTime()) {
|
|
76
|
+
if (value.getTime() > parseLocalTzDateOrString(maxDate).getTime()) {
|
|
76
77
|
result = true;
|
|
77
78
|
}
|
|
78
79
|
}
|
|
@@ -3,7 +3,7 @@ import { Color, Spacing, UnitSize } from '@pushwoosh/kit-constants';
|
|
|
3
3
|
export const DropdownMenuItemStyled = styled.button.withConfig({
|
|
4
4
|
displayName: "DropdownMenuItemStyled",
|
|
5
5
|
componentId: "sc-1wmyvxp-0"
|
|
6
|
-
})(["appearance:none;display:flex;align-items:center;padding:0 ", ";min-height:", ";border:none;color:", ";background:none;cursor:pointer;&:hover{background:", ";color:", ";}&:disabled{color:", ";cursor:not-allowed;}"], Spacing.S4, UnitSize.FIELD_HEIGHT, ({
|
|
6
|
+
})(["appearance:none;display:flex;align-items:center;white-space:nowrap;padding:0 ", ";min-height:", ";border:none;color:", ";background:none;cursor:pointer;&:hover{background:", ";color:", ";}&:disabled{color:", ";cursor:not-allowed;}"], Spacing.S4, UnitSize.FIELD_HEIGHT, ({
|
|
7
7
|
$active,
|
|
8
8
|
$danger
|
|
9
9
|
}) => {
|