@spscommerce/ds-react 8.0.0-rc1 → 8.0.1
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/dateRangePicker/SpsDateRangePicker.d.ts +5 -3
- package/lib/dateTimeRangePicker/SpsDateTimeRangePicker.d.ts +17 -0
- package/lib/dateTimeRangePicker/SpsDateTimeRangePicker.examples.d.ts +2 -0
- package/lib/dateTimeRangePicker/index.d.ts +2 -0
- package/lib/datepicker/SpsDatepicker.d.ts +1 -1
- package/lib/datepicker/SpsDatepickerCalendar.d.ts +1 -0
- package/lib/datepicker/utils.d.ts +17 -7
- package/lib/datepicker/validation.d.ts +5 -5
- package/lib/filter-panel/SpsFilterPanelSection.d.ts +2 -2
- package/lib/form/validation/SpsValidators.d.ts +3 -3
- package/lib/index.cjs.js +1992 -1630
- package/lib/index.d.ts +2 -0
- package/lib/index.es.js +17644 -16601
- package/lib/split-button/SpsSplitButton.d.ts +2 -0
- package/lib/text-input/SpsTextInput.d.ts +2 -0
- package/lib/time-input/SpsTimeInput.d.ts +11 -0
- package/lib/time-input/SpsTimeInput.examples.d.ts +2 -0
- package/lib/time-input/index.d.ts +2 -0
- package/package.json +12 -12
|
@@ -4,13 +4,15 @@ import type { SpsGlobalPropTypes } from "../prop-types";
|
|
|
4
4
|
import type { SpsFormFieldMeta } from "../form/hooks/useSpsForm";
|
|
5
5
|
export declare type SpsDateRangePickerProps = React.PropsWithChildren<SpsGlobalPropTypes & {
|
|
6
6
|
disabled?: boolean;
|
|
7
|
-
formMeta?: SpsFormFieldMeta<SimpleDateRange | DatePreset | undefined>;
|
|
7
|
+
formMeta?: SpsFormFieldMeta<SimpleDateRange | DatePreset | null | undefined>;
|
|
8
8
|
maxDate?: SimpleDate;
|
|
9
9
|
minDate?: SimpleDate;
|
|
10
|
-
onChange?: (newDateRange?: SimpleDateRange | DatePreset) => void;
|
|
10
|
+
onChange?: (newDateRange?: SimpleDateRange | DatePreset | null, preset?: DatePreset["definition"]) => void;
|
|
11
11
|
presets?: DatePreset[];
|
|
12
|
+
selectedPreset?: string;
|
|
13
|
+
onPresetChange?: (newPreset?: string) => void;
|
|
12
14
|
value?: SimpleDateRange | DatePreset;
|
|
13
15
|
showTwoMonths?: boolean;
|
|
14
16
|
}> & React.HTMLAttributes<HTMLInputElement>;
|
|
15
17
|
export declare const DEFAULT_PRESETS: DatePreset[];
|
|
16
|
-
export declare function SpsDateRangePicker({ children, className, disabled, formMeta, id, maxDate, minDate, onChange, presets, value, showTwoMonths, "data-testid": testId, ...rest }: SpsDateRangePickerProps): JSX.Element;
|
|
18
|
+
export declare function SpsDateRangePicker({ children, className, disabled, formMeta, id, maxDate, minDate, onChange, presets, selectedPreset: presetProp, onPresetChange, value, showTwoMonths, "data-testid": testId, ...rest }: SpsDateRangePickerProps): JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
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 declare 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
|
+
twentyFourHour?: boolean;
|
|
15
|
+
}> & React.HTMLAttributes<HTMLInputElement>;
|
|
16
|
+
export declare const DEFAULT_DATETIME_PRESETS: DateTimePreset[];
|
|
17
|
+
export declare function SpsDateTimeRangePicker({ className, disabled, formMeta, id, maxDate, minDate, onChange, presets, value, showTwoMonths, twentyFourHour, "data-testid": testId, }: SpsDateTimeRangePickerProps): JSX.Element;
|
|
@@ -4,7 +4,7 @@ import type { SpsGlobalPropTypes } from "../prop-types";
|
|
|
4
4
|
import type { SpsFormFieldMeta } from "../form/hooks/useSpsForm";
|
|
5
5
|
export declare type SpsDatepickerProps = React.PropsWithChildren<SpsGlobalPropTypes & {
|
|
6
6
|
disabled?: boolean;
|
|
7
|
-
formMeta?: SpsFormFieldMeta<SimpleDate>;
|
|
7
|
+
formMeta?: SpsFormFieldMeta<SimpleDate | undefined>;
|
|
8
8
|
maxDate?: SimpleDate;
|
|
9
9
|
minDate?: SimpleDate;
|
|
10
10
|
onChange?: (newDate: SimpleDate) => void;
|
|
@@ -3,6 +3,7 @@ import type { SimpleDate, SimpleDateRange } from "@spscommerce/ds-shared";
|
|
|
3
3
|
import type { SpsGlobalPropTypes } from "../prop-types";
|
|
4
4
|
export declare type SpsDatepickerCalendarProps = React.PropsWithChildren<SpsGlobalPropTypes & {
|
|
5
5
|
selectedRange?: SimpleDateRange;
|
|
6
|
+
isOpen?: boolean;
|
|
6
7
|
maxDate?: SimpleDate;
|
|
7
8
|
minDate?: SimpleDate;
|
|
8
9
|
onNewSelection: (date: SimpleDate) => void;
|
|
@@ -1,23 +1,33 @@
|
|
|
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";
|
|
5
|
+
export declare const FORMAT_WITH_TIME_24 = "MM/DD/YYYY HH:mm";
|
|
4
6
|
export declare const FORMAT_PATTERN: RegExp;
|
|
5
7
|
export declare const SYMBOL_DATE_PARSE_ERROR: unique symbol;
|
|
6
8
|
export declare const SimpleDateUtils: Readonly<{
|
|
7
|
-
createFrom(input
|
|
9
|
+
createFrom(input?: string | Moment | null): SimpleDate | null;
|
|
10
|
+
createMomentFrom(input: string | Moment | SimpleDate): Moment | null;
|
|
8
11
|
createRangeFrom(input: string): SimpleDateRange | null;
|
|
9
|
-
isValid(date
|
|
12
|
+
isValid(date?: SimpleDate | Moment | null): boolean | undefined;
|
|
10
13
|
nullifyInvalidDate(value: any): SimpleDate | null;
|
|
11
|
-
toMoment(date
|
|
12
|
-
toString(date
|
|
14
|
+
toMoment(date?: Moment | SimpleDate | null): Moment | null;
|
|
15
|
+
toString(date?: Moment | SimpleDate | null): string;
|
|
13
16
|
toStringRange(dateRange: SimpleDateRange): string;
|
|
17
|
+
toDateTimeString(dateMoment: Moment | null, twentyFourHourFormat?: boolean): string;
|
|
18
|
+
toDateTimeStringRange(dateRange: SimpleMomentRange, twentyFourHourFormat?: boolean): string;
|
|
14
19
|
create(): SimpleDate;
|
|
15
20
|
isSameDate(d1: SimpleDate, d2: SimpleDate): boolean;
|
|
16
21
|
isSameMonth(d1: SimpleDate, d2: SimpleDate): boolean;
|
|
17
|
-
isAfter(date: SimpleDate, referenceDate: SimpleDate): boolean | null;
|
|
18
|
-
isBefore(date: SimpleDate, referenceDate: SimpleDate): boolean | null;
|
|
22
|
+
isAfter(date: SimpleDate | Moment | null, referenceDate: SimpleDate | Moment | null): boolean | null;
|
|
23
|
+
isBefore(date: SimpleDate | Moment | null, referenceDate: SimpleDate | Moment | null): boolean | null;
|
|
19
24
|
isInRange(date: SimpleDate, range: SimpleDateRange, inclusive?: boolean): boolean | 0 | null;
|
|
20
25
|
prevMonth(date: SimpleDate): SimpleDate;
|
|
21
26
|
nextMonth(date: SimpleDate): SimpleDate;
|
|
22
27
|
createRangeFromPreset(preset: DatePreset): SimpleDateRange;
|
|
28
|
+
createDateTimeRangeFromPreset(preset: DateTimePreset): SimpleMomentRange;
|
|
29
|
+
splitMomentInDateTimeParts(dateMoment?: Moment | null, twentyFourHourFormat?: boolean): [string, string, string | undefined];
|
|
30
|
+
getCurrentMoment(): Moment;
|
|
31
|
+
validateTimeString(timeString?: string, twentyFourHourFormat?: boolean): boolean;
|
|
32
|
+
padIncompleteTimeString(timeString?: string, twentyFourHourFormat?: boolean): string;
|
|
23
33
|
}>;
|
|
@@ -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>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { SpsGlobalPropTypes } from "../prop-types";
|
|
3
3
|
export declare type SpsFilterPanelSectionProps = React.PropsWithChildren<SpsGlobalPropTypes & {
|
|
4
|
-
title?: string;
|
|
4
|
+
title?: string | React.ReactNode;
|
|
5
5
|
expanded?: boolean;
|
|
6
6
|
heightPx?: number;
|
|
7
7
|
heightRem?: number;
|
|
8
8
|
onExpand?: () => void;
|
|
9
9
|
onCollapse?: () => void;
|
|
10
|
-
}> & React.HTMLAttributes<HTMLDivElement>;
|
|
10
|
+
}> & Omit<React.HTMLAttributes<HTMLDivElement>, "title">;
|
|
11
11
|
export declare function SpsFilterPanelSection({ children, className, title, expanded, heightPx, heightRem, onExpand, onCollapse, ...rest }: SpsFilterPanelSectionProps): JSX.Element;
|
|
@@ -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
|
}>;
|