@jobber/components 6.47.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/Combobox/Combobox.types.d.ts +5 -0
- package/dist/Combobox/components/ComboboxTrigger/ComboboxTrigger.d.ts +1 -1
- package/dist/Combobox-cjs.js +1 -1
- package/dist/Combobox-es.js +1 -1
- package/dist/ComboboxTrigger-cjs.js +2 -2
- package/dist/ComboboxTrigger-es.js +2 -2
- 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 +1205 -1205
- 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() {
|
|
@@ -46,6 +46,10 @@ export interface ComboboxProps {
|
|
|
46
46
|
* Should the Combobox display the loading state.
|
|
47
47
|
*/
|
|
48
48
|
readonly loading?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* A ref to the default activator button element.
|
|
51
|
+
*/
|
|
52
|
+
readonly defaultActivatorRef?: React.Ref<HTMLButtonElement>;
|
|
49
53
|
}
|
|
50
54
|
export interface ComboboxCustomActivatorProps {
|
|
51
55
|
/**
|
|
@@ -76,6 +80,7 @@ export interface ComboboxActivatorProps {
|
|
|
76
80
|
}
|
|
77
81
|
export interface ComboboxTriggerProps extends Pick<ComboboxContentProps, "selected"> {
|
|
78
82
|
readonly label?: string;
|
|
83
|
+
readonly activatorRef?: React.Ref<HTMLButtonElement>;
|
|
79
84
|
}
|
|
80
85
|
export interface ComboboxOptionProps {
|
|
81
86
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComboboxTriggerProps } from "../../Combobox.types";
|
|
2
|
-
export declare function ComboboxTrigger({ label, selected, }: ComboboxTriggerProps): JSX.Element;
|
|
2
|
+
export declare function ComboboxTrigger({ label, selected, activatorRef, }: ComboboxTriggerProps): JSX.Element;
|
package/dist/Combobox-cjs.js
CHANGED
|
@@ -107,7 +107,7 @@ function Combobox(props) {
|
|
|
107
107
|
return (React.createElement(ComboboxProvider.ComboboxContextProvider, { selected: selectedOptions, selectionHandler: handleSelection, open: open, handleOpen: handleOpen, handleClose: handleClose, shouldScroll: shouldScroll, searchValue: searchValue, label: props.label },
|
|
108
108
|
React.createElement("div", { ref: wrapperRef, className: styles.wrapper },
|
|
109
109
|
open && (React.createElement("div", { className: styles.overlay, onClick: () => handleClose(), "data-testid": "ATL-Combobox-Overlay" })),
|
|
110
|
-
triggerElement || (React.createElement(ComboboxTrigger.ComboboxTrigger, { label: props.label, selected: props.selected })),
|
|
110
|
+
triggerElement || (React.createElement(ComboboxTrigger.ComboboxTrigger, { label: props.label, selected: props.selected, activatorRef: props.defaultActivatorRef })),
|
|
111
111
|
React.createElement(ComboboxContent.ComboboxContent, { multiselect: props.multiSelect, subjectNoun: props.subjectNoun, selected: selectedOptions, actionElements: actionElements, selectedStateSetter: selectedStateSetter, handleSelection: handleSelection, searchValue: searchValue, setSearchValue: setSearchValue, wrapperRef: wrapperRef, open: open, options: props.onSearch ? options : internalFilteredOptions, loading: props.loading, handleSearchChange: handleSearchChange, onLoadMore: props.onLoadMore }))));
|
|
112
112
|
}
|
|
113
113
|
Combobox.Activator = ComboboxActivator.ComboboxActivator;
|
package/dist/Combobox-es.js
CHANGED
|
@@ -105,7 +105,7 @@ function Combobox(props) {
|
|
|
105
105
|
return (React__default.createElement(ComboboxContextProvider, { selected: selectedOptions, selectionHandler: handleSelection, open: open, handleOpen: handleOpen, handleClose: handleClose, shouldScroll: shouldScroll, searchValue: searchValue, label: props.label },
|
|
106
106
|
React__default.createElement("div", { ref: wrapperRef, className: styles.wrapper },
|
|
107
107
|
open && (React__default.createElement("div", { className: styles.overlay, onClick: () => handleClose(), "data-testid": "ATL-Combobox-Overlay" })),
|
|
108
|
-
triggerElement || (React__default.createElement(ComboboxTrigger, { label: props.label, selected: props.selected })),
|
|
108
|
+
triggerElement || (React__default.createElement(ComboboxTrigger, { label: props.label, selected: props.selected, activatorRef: props.defaultActivatorRef })),
|
|
109
109
|
React__default.createElement(ComboboxContent, { multiselect: props.multiSelect, subjectNoun: props.subjectNoun, selected: selectedOptions, actionElements: actionElements, selectedStateSetter: selectedStateSetter, handleSelection: handleSelection, searchValue: searchValue, setSearchValue: setSearchValue, wrapperRef: wrapperRef, open: open, options: props.onSearch ? options : internalFilteredOptions, loading: props.loading, handleSearchChange: handleSearchChange, onLoadMore: props.onLoadMore }))));
|
|
110
110
|
}
|
|
111
111
|
Combobox.Activator = ComboboxActivator;
|
|
@@ -6,11 +6,11 @@ require('./tslib.es6-cjs.js');
|
|
|
6
6
|
var Icon = require('./Icon-cjs.js');
|
|
7
7
|
var ComboboxProvider = require('./ComboboxProvider-cjs.js');
|
|
8
8
|
|
|
9
|
-
function ComboboxTrigger({ label = "Select", selected, }) {
|
|
9
|
+
function ComboboxTrigger({ label = "Select", selected, activatorRef, }) {
|
|
10
10
|
const { handleOpen } = React.useContext(ComboboxProvider.ComboboxContext);
|
|
11
11
|
const hasSelection = selected.length;
|
|
12
12
|
const selectedLabel = selected.map(option => option.label).join(", ");
|
|
13
|
-
return (React.createElement(Chip.ChipNamespace, { variation: hasSelection ? "base" : "subtle", label: hasSelection ? selectedLabel : "", ariaLabel: label, heading: label, onClick: handleOpen, role: "combobox" }, !hasSelection && (React.createElement(Chip.ChipNamespace.Suffix, null,
|
|
13
|
+
return (React.createElement(Chip.ChipNamespace, { variation: hasSelection ? "base" : "subtle", label: hasSelection ? selectedLabel : "", ariaLabel: label, heading: label, onClick: handleOpen, role: "combobox", ref: activatorRef }, !hasSelection && (React.createElement(Chip.ChipNamespace.Suffix, null,
|
|
14
14
|
React.createElement(Icon.Icon, { name: "add", size: "small" })))));
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -4,11 +4,11 @@ import './tslib.es6-es.js';
|
|
|
4
4
|
import { I as Icon } from './Icon-es.js';
|
|
5
5
|
import { a as ComboboxContext } from './ComboboxProvider-es.js';
|
|
6
6
|
|
|
7
|
-
function ComboboxTrigger({ label = "Select", selected, }) {
|
|
7
|
+
function ComboboxTrigger({ label = "Select", selected, activatorRef, }) {
|
|
8
8
|
const { handleOpen } = React__default.useContext(ComboboxContext);
|
|
9
9
|
const hasSelection = selected.length;
|
|
10
10
|
const selectedLabel = selected.map(option => option.label).join(", ");
|
|
11
|
-
return (React__default.createElement(ChipNamespace, { variation: hasSelection ? "base" : "subtle", label: hasSelection ? selectedLabel : "", ariaLabel: label, heading: label, onClick: handleOpen, role: "combobox" }, !hasSelection && (React__default.createElement(ChipNamespace.Suffix, null,
|
|
11
|
+
return (React__default.createElement(ChipNamespace, { variation: hasSelection ? "base" : "subtle", label: hasSelection ? selectedLabel : "", ariaLabel: label, heading: label, onClick: handleOpen, role: "combobox", ref: activatorRef }, !hasSelection && (React__default.createElement(ChipNamespace.Suffix, null,
|
|
12
12
|
React__default.createElement(Icon, { name: "add", size: "small" })))));
|
|
13
13
|
}
|
|
14
14
|
|
|
@@ -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>);
|