@jobber/components 6.48.0 → 6.49.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/AtlantisContext/AtlantisContext.d.ts +8 -0
- package/dist/AtlantisContext-cjs.js +1 -0
- package/dist/AtlantisContext-es.js +1 -0
- package/dist/DatePicker/DatePicker.d.ts +9 -1
- package/dist/DatePicker-cjs.js +5 -4
- package/dist/DatePicker-es.js +5 -4
- package/dist/sharedHelpers/types.d.ts +2 -0
- package/dist/styles.css +1333 -1333
- package/package.json +2 -2
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DayOfWeek } from "../sharedHelpers/types";
|
|
1
2
|
export interface AtlantisContextProps {
|
|
2
3
|
/**
|
|
3
4
|
* The date format Atlantis components would use
|
|
@@ -27,6 +28,13 @@ export interface AtlantisContextProps {
|
|
|
27
28
|
* @default "en"
|
|
28
29
|
*/
|
|
29
30
|
readonly locale: string;
|
|
31
|
+
/**
|
|
32
|
+
* Sets which day is considered the first day of the week in a calendar.
|
|
33
|
+
* 0 = Sunday, 1 = Monday, etc.
|
|
34
|
+
*
|
|
35
|
+
* @default 0
|
|
36
|
+
*/
|
|
37
|
+
readonly firstDayOfWeek: DayOfWeek;
|
|
30
38
|
}
|
|
31
39
|
export declare const atlantisContextDefaultValues: AtlantisContextProps;
|
|
32
40
|
export declare const AtlantisContext: import("react").Context<AtlantisContextProps>;
|
|
@@ -10,6 +10,7 @@ const atlantisContextDefaultValues = {
|
|
|
10
10
|
floatSeparators: { group: ",", decimal: "." },
|
|
11
11
|
currencySymbol: "$",
|
|
12
12
|
locale: "en",
|
|
13
|
+
firstDayOfWeek: 0,
|
|
13
14
|
};
|
|
14
15
|
const AtlantisContext = React.createContext(atlantisContextDefaultValues);
|
|
15
16
|
function useAtlantisContext() {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ReactElement } from "react";
|
|
2
2
|
import { XOR } from "ts-xor";
|
|
3
3
|
import { DatePickerActivatorProps } from "./DatePickerActivator";
|
|
4
|
+
import { DayOfWeek } from "../sharedHelpers/types";
|
|
4
5
|
interface BaseDatePickerProps {
|
|
5
6
|
/**
|
|
6
7
|
* The maximum selectable date.
|
|
@@ -23,6 +24,13 @@ interface BaseDatePickerProps {
|
|
|
23
24
|
* Dates on the calendar to highlight
|
|
24
25
|
*/
|
|
25
26
|
readonly highlightDates?: Date[];
|
|
27
|
+
/**
|
|
28
|
+
* Sets which day is considered the first day of the week.
|
|
29
|
+
* 0 = Sunday, 1 = Monday, etc.
|
|
30
|
+
*
|
|
31
|
+
* @default 0
|
|
32
|
+
*/
|
|
33
|
+
readonly firstDayOfWeek?: DayOfWeek;
|
|
26
34
|
/**
|
|
27
35
|
* Change handler that will return the date selected.
|
|
28
36
|
*/
|
|
@@ -57,5 +65,5 @@ interface DatePickerInlineProps extends BaseDatePickerProps {
|
|
|
57
65
|
readonly inline?: boolean;
|
|
58
66
|
}
|
|
59
67
|
type DatePickerProps = XOR<DatePickerModalProps, DatePickerInlineProps>;
|
|
60
|
-
export declare function DatePicker({ onChange, onMonthChange, activator, inline, selected, readonly, disabled, fullWidth, smartAutofocus, maxDate, minDate, highlightDates, }: DatePickerProps): JSX.Element;
|
|
68
|
+
export declare function DatePicker({ onChange, onMonthChange, activator, inline, selected, readonly, disabled, fullWidth, smartAutofocus, maxDate, minDate, highlightDates, firstDayOfWeek, }: DatePickerProps): JSX.Element;
|
|
61
69
|
export {};
|
package/dist/DatePicker-cjs.js
CHANGED
|
@@ -7291,11 +7291,12 @@ function useFocusOnSelectedDate() {
|
|
|
7291
7291
|
return { ref, focusOnSelectedDate };
|
|
7292
7292
|
}
|
|
7293
7293
|
|
|
7294
|
-
/*eslint max-statements: ["error",
|
|
7295
|
-
function DatePicker({ onChange, onMonthChange, activator, inline, selected, readonly = false, disabled = false, fullWidth = false, smartAutofocus = true, maxDate, minDate, highlightDates, }) {
|
|
7294
|
+
/*eslint max-statements: ["error", 14]*/
|
|
7295
|
+
function DatePicker({ onChange, onMonthChange, activator, inline, selected, readonly = false, disabled = false, fullWidth = false, smartAutofocus = true, maxDate, minDate, highlightDates, firstDayOfWeek, }) {
|
|
7296
7296
|
const { ref, focusOnSelectedDate } = useFocusOnSelectedDate();
|
|
7297
7297
|
const [open, setOpen] = React.useState(false);
|
|
7298
|
-
const { dateFormat } = AtlantisContext.useAtlantisContext();
|
|
7298
|
+
const { dateFormat, firstDayOfWeek: contextFirstDayOfWeek } = AtlantisContext.useAtlantisContext();
|
|
7299
|
+
const effectiveFirstDayOfWeek = firstDayOfWeek !== null && firstDayOfWeek !== void 0 ? firstDayOfWeek : contextFirstDayOfWeek;
|
|
7299
7300
|
const wrapperClassName = classnames(styles.datePickerWrapper, {
|
|
7300
7301
|
// react-datepicker uses this class name to not close the date picker when
|
|
7301
7302
|
// the activator is clicked
|
|
@@ -7323,7 +7324,7 @@ function DatePicker({ onChange, onMonthChange, activator, inline, selected, read
|
|
|
7323
7324
|
"PPP",
|
|
7324
7325
|
"MMM dd yyyy",
|
|
7325
7326
|
"MMMM dd yyyy",
|
|
7326
|
-
], highlightDates: highlightDates, onMonthChange: onMonthChange })));
|
|
7327
|
+
], highlightDates: highlightDates, onMonthChange: onMonthChange, calendarStartDay: effectiveFirstDayOfWeek })));
|
|
7327
7328
|
/**
|
|
7328
7329
|
* The onChange callback on ReactDatePicker returns a Date and an Event, but
|
|
7329
7330
|
* the onChange in our interface only provides the Date. Simplifying the code
|
package/dist/DatePicker-es.js
CHANGED
|
@@ -7289,11 +7289,12 @@ function useFocusOnSelectedDate() {
|
|
|
7289
7289
|
return { ref, focusOnSelectedDate };
|
|
7290
7290
|
}
|
|
7291
7291
|
|
|
7292
|
-
/*eslint max-statements: ["error",
|
|
7293
|
-
function DatePicker({ onChange, onMonthChange, activator, inline, selected, readonly = false, disabled = false, fullWidth = false, smartAutofocus = true, maxDate, minDate, highlightDates, }) {
|
|
7292
|
+
/*eslint max-statements: ["error", 14]*/
|
|
7293
|
+
function DatePicker({ onChange, onMonthChange, activator, inline, selected, readonly = false, disabled = false, fullWidth = false, smartAutofocus = true, maxDate, minDate, highlightDates, firstDayOfWeek, }) {
|
|
7294
7294
|
const { ref, focusOnSelectedDate } = useFocusOnSelectedDate();
|
|
7295
7295
|
const [open, setOpen] = useState(false);
|
|
7296
|
-
const { dateFormat } = useAtlantisContext();
|
|
7296
|
+
const { dateFormat, firstDayOfWeek: contextFirstDayOfWeek } = useAtlantisContext();
|
|
7297
|
+
const effectiveFirstDayOfWeek = firstDayOfWeek !== null && firstDayOfWeek !== void 0 ? firstDayOfWeek : contextFirstDayOfWeek;
|
|
7297
7298
|
const wrapperClassName = classnames(styles.datePickerWrapper, {
|
|
7298
7299
|
// react-datepicker uses this class name to not close the date picker when
|
|
7299
7300
|
// the activator is clicked
|
|
@@ -7321,7 +7322,7 @@ function DatePicker({ onChange, onMonthChange, activator, inline, selected, read
|
|
|
7321
7322
|
"PPP",
|
|
7322
7323
|
"MMM dd yyyy",
|
|
7323
7324
|
"MMMM dd yyyy",
|
|
7324
|
-
], highlightDates: highlightDates, onMonthChange: onMonthChange })));
|
|
7325
|
+
], highlightDates: highlightDates, onMonthChange: onMonthChange, calendarStartDay: effectiveFirstDayOfWeek })));
|
|
7325
7326
|
/**
|
|
7326
7327
|
* The onChange callback on ReactDatePicker returns a Date and an Event, but
|
|
7327
7328
|
* the onChange in our interface only provides the Date. Simplifying the code
|
|
@@ -10,6 +10,8 @@ export interface CommonAtlantisProps {
|
|
|
10
10
|
/** Standard HTML id attribute. */
|
|
11
11
|
id?: string;
|
|
12
12
|
}
|
|
13
|
+
/** Represents a day of the week as a number where 0 = Sunday, 1 = Monday, etc. */
|
|
14
|
+
export type DayOfWeek = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
13
15
|
export type CommonAllowedElements = "section" | "p" | "article" | "ul" | "li" | "div" | "span" | "dl" | "dd" | "dt";
|
|
14
16
|
export type Spaces = "minuscule" | "slim" | "smallest" | "smaller" | "small" | "base" | "large" | "larger" | "largest" | "extravagant";
|
|
15
17
|
export type GapSpacing = Spaces | (string & NonNullable<unknown>);
|