@jobber/components 6.56.0 → 6.56.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/dist/DatePicker/DatePickerActivator.d.ts +3 -2
- package/dist/DatePicker-cjs.js +1 -2
- package/dist/DatePicker-es.js +2 -2
- package/dist/InputDate/index.cjs +5 -9
- package/dist/InputDate/index.mjs +6 -10
- package/dist/styles.css +1833 -1833
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { ChangeEvent, ReactElement } from "react";
|
|
2
|
-
import { ReactDatePickerProps } from "react-datepicker";
|
|
1
|
+
import React, { ChangeEvent, ReactElement, RefObject } from "react";
|
|
2
|
+
import ReactDatePicker, { ReactDatePickerProps } from "react-datepicker";
|
|
3
3
|
export interface DatePickerActivatorProps extends Pick<ReactDatePickerProps, "value" | "id" | "ariaDescribedBy" | "ariaInvalid" | "ariaLabelledBy" | "ariaRequired"> {
|
|
4
4
|
readonly activator?: ReactElement | ((props: DatePickerActivatorProps) => ReactElement);
|
|
5
5
|
readonly fullWidth?: boolean;
|
|
@@ -8,5 +8,6 @@ export interface DatePickerActivatorProps extends Pick<ReactDatePickerProps, "va
|
|
|
8
8
|
onClick?(): void;
|
|
9
9
|
onFocus?(): void;
|
|
10
10
|
onKeyDown?(): void;
|
|
11
|
+
readonly pickerRef: RefObject<ReactDatePicker>;
|
|
11
12
|
}
|
|
12
13
|
export declare const DatePickerActivator: React.ForwardRefExoticComponent<DatePickerActivatorProps & React.RefAttributes<HTMLElement>>;
|
package/dist/DatePicker-cjs.js
CHANGED
|
@@ -7317,7 +7317,7 @@ function DatePicker({ onChange, onMonthChange, activator, inline, selected, read
|
|
|
7317
7317
|
React.useEffect(focusOnSelectedDate, [open]);
|
|
7318
7318
|
}
|
|
7319
7319
|
return (React.createElement("div", { className: wrapperClassName, ref: ref, "data-elevation": "elevated" },
|
|
7320
|
-
React.createElement(Ht, { ref: pickerRef, calendarClassName: datePickerClassNames, showPopperArrow: false, selected: selected, inline: inline, disabled: disabled, readOnly: readonly, onChange: handleChange, maxDate: maxDate, preventOpenOnFocus: true, minDate: minDate, useWeekdaysShort: true, customInput: React.createElement(DatePickerActivator, { activator: activator, fullWidth: fullWidth }), renderCustomHeader: props => React.createElement(DatePickerCustomHeader, Object.assign({}, props)), onCalendarOpen: handleCalendarOpen, onCalendarClose: handleCalendarClose, dateFormat: [
|
|
7320
|
+
React.createElement(Ht, { ref: pickerRef, calendarClassName: datePickerClassNames, showPopperArrow: false, selected: selected, inline: inline, disabled: disabled, readOnly: readonly, onChange: handleChange, maxDate: maxDate, preventOpenOnFocus: true, minDate: minDate, useWeekdaysShort: true, customInput: React.createElement(DatePickerActivator, { pickerRef: pickerRef, activator: activator, fullWidth: fullWidth }), renderCustomHeader: props => React.createElement(DatePickerCustomHeader, Object.assign({}, props)), onCalendarOpen: handleCalendarOpen, onCalendarClose: handleCalendarClose, dateFormat: [
|
|
7321
7321
|
dateFormat,
|
|
7322
7322
|
"P",
|
|
7323
7323
|
"PP",
|
|
@@ -7368,5 +7368,4 @@ function useEscapeKeyToCloseDatePicker(open, ref) {
|
|
|
7368
7368
|
}
|
|
7369
7369
|
|
|
7370
7370
|
exports.DatePicker = DatePicker;
|
|
7371
|
-
exports.format = format;
|
|
7372
7371
|
exports.isValid = isValid;
|
package/dist/DatePicker-es.js
CHANGED
|
@@ -7315,7 +7315,7 @@ function DatePicker({ onChange, onMonthChange, activator, inline, selected, read
|
|
|
7315
7315
|
useEffect(focusOnSelectedDate, [open]);
|
|
7316
7316
|
}
|
|
7317
7317
|
return (React__default.createElement("div", { className: wrapperClassName, ref: ref, "data-elevation": "elevated" },
|
|
7318
|
-
React__default.createElement(Ht, { ref: pickerRef, calendarClassName: datePickerClassNames, showPopperArrow: false, selected: selected, inline: inline, disabled: disabled, readOnly: readonly, onChange: handleChange, maxDate: maxDate, preventOpenOnFocus: true, minDate: minDate, useWeekdaysShort: true, customInput: React__default.createElement(DatePickerActivator, { activator: activator, fullWidth: fullWidth }), renderCustomHeader: props => React__default.createElement(DatePickerCustomHeader, Object.assign({}, props)), onCalendarOpen: handleCalendarOpen, onCalendarClose: handleCalendarClose, dateFormat: [
|
|
7318
|
+
React__default.createElement(Ht, { ref: pickerRef, calendarClassName: datePickerClassNames, showPopperArrow: false, selected: selected, inline: inline, disabled: disabled, readOnly: readonly, onChange: handleChange, maxDate: maxDate, preventOpenOnFocus: true, minDate: minDate, useWeekdaysShort: true, customInput: React__default.createElement(DatePickerActivator, { pickerRef: pickerRef, activator: activator, fullWidth: fullWidth }), renderCustomHeader: props => React__default.createElement(DatePickerCustomHeader, Object.assign({}, props)), onCalendarOpen: handleCalendarOpen, onCalendarClose: handleCalendarClose, dateFormat: [
|
|
7319
7319
|
dateFormat,
|
|
7320
7320
|
"P",
|
|
7321
7321
|
"PP",
|
|
@@ -7365,4 +7365,4 @@ function useEscapeKeyToCloseDatePicker(open, ref) {
|
|
|
7365
7365
|
};
|
|
7366
7366
|
}
|
|
7367
7367
|
|
|
7368
|
-
export { DatePicker as D,
|
|
7368
|
+
export { DatePicker as D, isValid as i };
|
package/dist/InputDate/index.cjs
CHANGED
|
@@ -10,7 +10,6 @@ require('react-hook-form');
|
|
|
10
10
|
require('framer-motion');
|
|
11
11
|
require('@jobber/design');
|
|
12
12
|
require('../Button-cjs.js');
|
|
13
|
-
var AtlantisContext = require('../AtlantisContext-cjs.js');
|
|
14
13
|
var InputText_index = require('../InputText/index.cjs');
|
|
15
14
|
require('../_commonjsHelpers-cjs.js');
|
|
16
15
|
require('../_baseGet-cjs.js');
|
|
@@ -28,6 +27,7 @@ require('react-dom');
|
|
|
28
27
|
require('react-popper');
|
|
29
28
|
require('../useRefocusOnActivator-cjs.js');
|
|
30
29
|
require('../Typography-cjs.js');
|
|
30
|
+
require('../AtlantisContext-cjs.js');
|
|
31
31
|
require('../Icon-cjs.js');
|
|
32
32
|
require('../Text-cjs.js');
|
|
33
33
|
require('../useFormFieldFocus-cjs.js');
|
|
@@ -38,9 +38,8 @@ require('../useSafeLayoutEffect-cjs.js');
|
|
|
38
38
|
|
|
39
39
|
function InputDate$1(inputProps) {
|
|
40
40
|
const formFieldActionsRef = React.useRef(null);
|
|
41
|
-
const { dateFormat } = AtlantisContext.useAtlantisContext();
|
|
42
41
|
return (React.createElement(DatePicker.DatePicker, { selected: inputProps.value, onChange: inputProps.onChange, disabled: inputProps.disabled, readonly: inputProps.readonly, fullWidth: !inputProps.inline, minDate: inputProps.minDate, maxDate: inputProps.maxDate, smartAutofocus: false, activator: activatorProps => {
|
|
43
|
-
const { onChange, onClick, value } = activatorProps;
|
|
42
|
+
const { onChange, onClick, value, pickerRef } = activatorProps;
|
|
44
43
|
const newActivatorProps = omit.omit(activatorProps, ["activator"]);
|
|
45
44
|
const [isFocused, setIsFocused] = React.useState(false);
|
|
46
45
|
const suffix = inputProps.showIcon !== false
|
|
@@ -63,6 +62,7 @@ function InputDate$1(inputProps) {
|
|
|
63
62
|
React.createElement(FormField.FormField, Object.assign({}, newActivatorProps, inputProps, { value: showEmptyValueLabel ? inputProps.emptyValueLabel || "" : value, placeholder: inputProps.placeholder, onChange: (_, event) => {
|
|
64
63
|
onChange && onChange(event);
|
|
65
64
|
}, onBlur: () => {
|
|
65
|
+
var _a;
|
|
66
66
|
inputProps.onBlur && inputProps.onBlur();
|
|
67
67
|
activatorProps.onBlur && activatorProps.onBlur();
|
|
68
68
|
setIsFocused(false);
|
|
@@ -83,12 +83,8 @@ function InputDate$1(inputProps) {
|
|
|
83
83
|
*/
|
|
84
84
|
if (inputProps.restoreLastValueOnBlur) {
|
|
85
85
|
if ((!value || !DatePicker.isValid(value)) && inputProps.value) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
target: {
|
|
89
|
-
value: DatePicker.format(inputProps.value, dateFormat),
|
|
90
|
-
},
|
|
91
|
-
});
|
|
86
|
+
// @ts-expect-error -- ReactDatePicker types don't include setSelected
|
|
87
|
+
(_a = pickerRef.current) === null || _a === void 0 ? void 0 : _a.setSelected(inputProps.value);
|
|
92
88
|
}
|
|
93
89
|
}
|
|
94
90
|
}, onFocus: () => {
|
package/dist/InputDate/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React__default, { useRef, useState, useEffect, forwardRef } from 'react';
|
|
2
2
|
import { o as omit } from '../omit-es.js';
|
|
3
|
-
import { D as DatePicker, i as isValid
|
|
3
|
+
import { D as DatePicker, i as isValid } from '../DatePicker-es.js';
|
|
4
4
|
import { k as FormField } from '../FormField-es.js';
|
|
5
5
|
import 'classnames';
|
|
6
6
|
import '../tslib.es6-es.js';
|
|
@@ -8,7 +8,6 @@ import 'react-hook-form';
|
|
|
8
8
|
import 'framer-motion';
|
|
9
9
|
import '@jobber/design';
|
|
10
10
|
import '../Button-es.js';
|
|
11
|
-
import { u as useAtlantisContext } from '../AtlantisContext-es.js';
|
|
12
11
|
import { InputText } from '../InputText/index.mjs';
|
|
13
12
|
import '../_commonjsHelpers-es.js';
|
|
14
13
|
import '../_baseGet-es.js';
|
|
@@ -26,6 +25,7 @@ import 'react-dom';
|
|
|
26
25
|
import 'react-popper';
|
|
27
26
|
import '../useRefocusOnActivator-es.js';
|
|
28
27
|
import '../Typography-es.js';
|
|
28
|
+
import '../AtlantisContext-es.js';
|
|
29
29
|
import '../Icon-es.js';
|
|
30
30
|
import '../Text-es.js';
|
|
31
31
|
import '../useFormFieldFocus-es.js';
|
|
@@ -36,9 +36,8 @@ import '../useSafeLayoutEffect-es.js';
|
|
|
36
36
|
|
|
37
37
|
function InputDate$1(inputProps) {
|
|
38
38
|
const formFieldActionsRef = useRef(null);
|
|
39
|
-
const { dateFormat } = useAtlantisContext();
|
|
40
39
|
return (React__default.createElement(DatePicker, { selected: inputProps.value, onChange: inputProps.onChange, disabled: inputProps.disabled, readonly: inputProps.readonly, fullWidth: !inputProps.inline, minDate: inputProps.minDate, maxDate: inputProps.maxDate, smartAutofocus: false, activator: activatorProps => {
|
|
41
|
-
const { onChange, onClick, value } = activatorProps;
|
|
40
|
+
const { onChange, onClick, value, pickerRef } = activatorProps;
|
|
42
41
|
const newActivatorProps = omit(activatorProps, ["activator"]);
|
|
43
42
|
const [isFocused, setIsFocused] = useState(false);
|
|
44
43
|
const suffix = inputProps.showIcon !== false
|
|
@@ -61,6 +60,7 @@ function InputDate$1(inputProps) {
|
|
|
61
60
|
React__default.createElement(FormField, Object.assign({}, newActivatorProps, inputProps, { value: showEmptyValueLabel ? inputProps.emptyValueLabel || "" : value, placeholder: inputProps.placeholder, onChange: (_, event) => {
|
|
62
61
|
onChange && onChange(event);
|
|
63
62
|
}, onBlur: () => {
|
|
63
|
+
var _a;
|
|
64
64
|
inputProps.onBlur && inputProps.onBlur();
|
|
65
65
|
activatorProps.onBlur && activatorProps.onBlur();
|
|
66
66
|
setIsFocused(false);
|
|
@@ -81,12 +81,8 @@ function InputDate$1(inputProps) {
|
|
|
81
81
|
*/
|
|
82
82
|
if (inputProps.restoreLastValueOnBlur) {
|
|
83
83
|
if ((!value || !isValid(value)) && inputProps.value) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
target: {
|
|
87
|
-
value: format(inputProps.value, dateFormat),
|
|
88
|
-
},
|
|
89
|
-
});
|
|
84
|
+
// @ts-expect-error -- ReactDatePicker types don't include setSelected
|
|
85
|
+
(_a = pickerRef.current) === null || _a === void 0 ? void 0 : _a.setSelected(inputProps.value);
|
|
90
86
|
}
|
|
91
87
|
}
|
|
92
88
|
}, onFocus: () => {
|