@spscommerce/ds-react 7.12.3 → 7.14.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/lib/dateTimeRangePicker/SpsDateTimeRangePicker.d.ts +16 -0
- package/lib/dateTimeRangePicker/SpsDateTimeRangePicker.examples.d.ts +2 -0
- package/lib/dateTimeRangePicker/index.d.ts +2 -0
- package/lib/datepicker/utils.d.ts +14 -7
- package/lib/datepicker/validation.d.ts +5 -5
- package/lib/form/validation/SpsValidators.d.ts +3 -3
- package/lib/index.cjs.js +1016 -928
- package/lib/index.d.ts +1 -0
- package/lib/index.es.js +17973 -17440
- package/lib/text-input/SpsTextInput.d.ts +2 -0
- package/package.json +12 -12
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { SimpleMomentRange, SimpleDate, DateTimePreset } from "@spscommerce/ds-shared";
|
|
3
|
+
import type { SpsGlobalPropTypes } from "../prop-types";
|
|
4
|
+
import type { SpsFormFieldMeta } from "../form/hooks/useSpsForm";
|
|
5
|
+
export type SpsDateTimeRangePickerProps = React.PropsWithChildren<SpsGlobalPropTypes & {
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
formMeta?: SpsFormFieldMeta<SimpleMomentRange | undefined>;
|
|
8
|
+
maxDate?: SimpleDate;
|
|
9
|
+
minDate?: SimpleDate;
|
|
10
|
+
onChange?: (newDateTimeRange?: SimpleMomentRange) => void;
|
|
11
|
+
presets?: DateTimePreset[];
|
|
12
|
+
value?: SimpleMomentRange;
|
|
13
|
+
showTwoMonths?: boolean;
|
|
14
|
+
}> & React.HTMLAttributes<HTMLInputElement>;
|
|
15
|
+
export declare const DEFAULT_DATETIME_PRESETS: DateTimePreset[];
|
|
16
|
+
export declare function SpsDateTimeRangePicker({ className, disabled, formMeta, id, maxDate, minDate, onChange, presets, value, showTwoMonths, "data-testid": testId, }: SpsDateTimeRangePickerProps): JSX.Element;
|
|
@@ -1,23 +1,30 @@
|
|
|
1
|
-
import type { SimpleDate, SimpleDateRange, DatePreset } from "@spscommerce/ds-shared";
|
|
1
|
+
import type { SimpleDate, SimpleDateRange, DatePreset, DateTimePreset, SimpleMomentRange } from "@spscommerce/ds-shared";
|
|
2
2
|
import type { Moment } from "moment-timezone";
|
|
3
3
|
export declare const FORMAT = "MM/DD/YYYY";
|
|
4
|
+
export declare const FORMAT_WITH_TIME = "MM/DD/YYYY hh:mm A";
|
|
4
5
|
export declare const FORMAT_PATTERN: RegExp;
|
|
5
6
|
export declare const SYMBOL_DATE_PARSE_ERROR: unique symbol;
|
|
6
7
|
export declare const SimpleDateUtils: Readonly<{
|
|
7
|
-
createFrom(input
|
|
8
|
+
createFrom(input?: string | Moment | null): SimpleDate | null;
|
|
9
|
+
createMomentFrom(input: string | Moment | SimpleDate): Moment | null;
|
|
8
10
|
createRangeFrom(input: string): SimpleDateRange | null;
|
|
9
|
-
isValid(date
|
|
11
|
+
isValid(date?: SimpleDate | Moment | null): boolean | undefined;
|
|
10
12
|
nullifyInvalidDate(value: any): SimpleDate | null;
|
|
11
|
-
toMoment(date
|
|
12
|
-
toString(date
|
|
13
|
+
toMoment(date?: Moment | SimpleDate | null): Moment | null;
|
|
14
|
+
toString(date?: Moment | SimpleDate | null): string;
|
|
13
15
|
toStringRange(dateRange: SimpleDateRange): string;
|
|
16
|
+
toDateTimeString(dateMoment: Moment | null): string;
|
|
17
|
+
toDateTimeStringRange(dateRange: SimpleMomentRange): string;
|
|
14
18
|
create(): SimpleDate;
|
|
15
19
|
isSameDate(d1: SimpleDate, d2: SimpleDate): boolean;
|
|
16
20
|
isSameMonth(d1: SimpleDate, d2: SimpleDate): boolean;
|
|
17
|
-
isAfter(date: SimpleDate, referenceDate: SimpleDate): boolean | null;
|
|
18
|
-
isBefore(date: SimpleDate, referenceDate: SimpleDate): boolean | null;
|
|
21
|
+
isAfter(date: SimpleDate | Moment | null, referenceDate: SimpleDate | Moment | null): boolean | null;
|
|
22
|
+
isBefore(date: SimpleDate | Moment | null, referenceDate: SimpleDate | Moment | null): boolean | null;
|
|
19
23
|
isInRange(date: SimpleDate, range: SimpleDateRange, inclusive?: boolean): boolean | 0 | null;
|
|
20
24
|
prevMonth(date: SimpleDate): SimpleDate;
|
|
21
25
|
nextMonth(date: SimpleDate): SimpleDate;
|
|
22
26
|
createRangeFromPreset(preset: DatePreset): SimpleDateRange;
|
|
27
|
+
createDateTimeRangeFromPreset(preset: DateTimePreset): SimpleMomentRange;
|
|
28
|
+
splitMomentInDateTimeParts(dateMoment?: Moment | null): [string, string, string];
|
|
29
|
+
getCurrentMoment(): Moment;
|
|
23
30
|
}>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { SimpleDate, SimpleDateRange } from "@spscommerce/ds-shared";
|
|
2
|
-
import type { Duration } from "moment-timezone";
|
|
1
|
+
import type { SimpleDate, SimpleDateRange, SimpleMomentRange } from "@spscommerce/ds-shared";
|
|
2
|
+
import type { Duration, Moment } from "moment-timezone";
|
|
3
3
|
import type { SpsValidator, SpsValidatorFactory } from "../form/validation/types";
|
|
4
|
-
export declare const date: SpsValidator<SimpleDate | SimpleDateRange>;
|
|
5
|
-
export declare const dateRange: SpsValidator<SimpleDateRange | Duration>;
|
|
4
|
+
export declare const date: SpsValidator<SimpleDate | SimpleDateRange | Moment | SimpleMomentRange | null>;
|
|
5
|
+
export declare const dateRange: SpsValidator<SimpleDateRange | Duration | SimpleMomentRange>;
|
|
6
6
|
export interface DateConstraintError {
|
|
7
7
|
minExceeded: string | null;
|
|
8
8
|
maxExceeded: string | null;
|
|
9
9
|
}
|
|
10
|
-
export declare const dateConstraint: SpsValidatorFactory<SimpleDate | SimpleDateRange>;
|
|
10
|
+
export declare const dateConstraint: SpsValidatorFactory<SimpleDate | SimpleDateRange | Moment | SimpleMomentRange>;
|
|
@@ -12,7 +12,7 @@ export declare const SpsValidators: Readonly<{
|
|
|
12
12
|
numeric: SpsValidator<string>;
|
|
13
13
|
nonNumeric: SpsValidator<string>;
|
|
14
14
|
OnBlurErrorKeys: Set<string>;
|
|
15
|
-
date: SpsValidator<import("@spscommerce/ds-shared").SimpleDate | import("@spscommerce/ds-shared").SimpleDateRange>;
|
|
16
|
-
dateRange: SpsValidator<import("@spscommerce/ds-shared").SimpleDateRange | import("moment").Duration>;
|
|
17
|
-
dateConstraint: SpsValidatorFactory<import("@spscommerce/ds-shared").SimpleDate | import("@spscommerce/ds-shared").SimpleDateRange>;
|
|
15
|
+
date: SpsValidator<import("@spscommerce/ds-shared").SimpleDate | import("moment").Moment | import("@spscommerce/ds-shared").SimpleDateRange | import("@spscommerce/ds-shared").SimpleMomentRange | null>;
|
|
16
|
+
dateRange: SpsValidator<import("@spscommerce/ds-shared").SimpleDateRange | import("@spscommerce/ds-shared").SimpleMomentRange | import("moment").Duration>;
|
|
17
|
+
dateConstraint: SpsValidatorFactory<import("@spscommerce/ds-shared").SimpleDate | import("moment").Moment | import("@spscommerce/ds-shared").SimpleDateRange | import("@spscommerce/ds-shared").SimpleMomentRange>;
|
|
18
18
|
}>;
|