@jobber/components 4.87.4-JOB-85849.1 → 4.87.4-STfixing-.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.
|
@@ -1,7 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const mediaQueryStore: {
|
|
3
|
-
subscribe(onChange: () => void, query: MediaQuery): () => void;
|
|
4
|
-
getSnapshot(query: MediaQuery): () => boolean;
|
|
5
|
-
};
|
|
6
|
-
export declare function useMediaQuery(query: MediaQuery): boolean;
|
|
7
|
-
export {};
|
|
1
|
+
export declare function useMediaQuery(CSSMediaQuery: string): boolean;
|
package/dist/DataList/index.js
CHANGED
|
@@ -101,19 +101,7 @@ function useDataListContext() {
|
|
|
101
101
|
return React.useContext(DataListContext);
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
|
|
105
|
-
subscribe(onChange, query) {
|
|
106
|
-
const matchMedia = window.matchMedia(query);
|
|
107
|
-
matchMedia.addEventListener("change", onChange);
|
|
108
|
-
return () => {
|
|
109
|
-
matchMedia.removeEventListener("change", onChange);
|
|
110
|
-
};
|
|
111
|
-
},
|
|
112
|
-
getSnapshot(query) {
|
|
113
|
-
return () => window.matchMedia(query).matches;
|
|
114
|
-
},
|
|
115
|
-
};
|
|
116
|
-
function useMediaQuery(query) {
|
|
104
|
+
function useMediaQuery(CSSMediaQuery) {
|
|
117
105
|
/**
|
|
118
106
|
* matchMedia have had full support for browsers since 2012 but jest, being a
|
|
119
107
|
* lite version of a DOM, doesn't support it.
|
|
@@ -125,12 +113,18 @@ function useMediaQuery(query) {
|
|
|
125
113
|
* screen sizes, they can use the `mockViewportWidth` function from
|
|
126
114
|
* `@jobber/components/useBreakpoints`.
|
|
127
115
|
*/
|
|
128
|
-
if (
|
|
129
|
-
typeof window.matchMedia === "undefined") {
|
|
116
|
+
if (window.matchMedia === undefined)
|
|
130
117
|
return true;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
118
|
+
const [matches, setMatches] = React.useState(window.matchMedia(CSSMediaQuery).matches);
|
|
119
|
+
React.useEffect(() => {
|
|
120
|
+
const media = window.matchMedia(CSSMediaQuery);
|
|
121
|
+
if (media.matches !== matches) {
|
|
122
|
+
setMatches(media.matches);
|
|
123
|
+
}
|
|
124
|
+
const listener = () => setMatches(media.matches);
|
|
125
|
+
media.addEventListener("change", listener);
|
|
126
|
+
return () => media.removeEventListener("change", listener);
|
|
127
|
+
}, [CSSMediaQuery]);
|
|
134
128
|
return matches;
|
|
135
129
|
}
|
|
136
130
|
|
package/dist/InputDate/index.js
CHANGED
|
@@ -31,7 +31,6 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
31
31
|
function InputDate(inputProps) {
|
|
32
32
|
const formFieldActionsRef = React.useRef(null);
|
|
33
33
|
return (React__default["default"].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 => {
|
|
34
|
-
var _a;
|
|
35
34
|
const { onChange, onClick, value } = activatorProps;
|
|
36
35
|
const newActivatorProps = omit__default["default"](activatorProps, ["activator"]);
|
|
37
36
|
const suffix = Object.assign({ icon: "calendar" }, (onClick && {
|
|
@@ -40,7 +39,10 @@ function InputDate(inputProps) {
|
|
|
40
39
|
}));
|
|
41
40
|
// Set form field to formatted date string immediately, to avoid validations
|
|
42
41
|
// triggering incorrectly when it blurs (to handle the datepicker UI click)
|
|
43
|
-
|
|
42
|
+
React.useEffect(() => {
|
|
43
|
+
var _a;
|
|
44
|
+
value && ((_a = formFieldActionsRef.current) === null || _a === void 0 ? void 0 : _a.setValue(value));
|
|
45
|
+
}, [value]);
|
|
44
46
|
return (
|
|
45
47
|
// We prevent the picker from opening on focus for keyboard navigation, so to maintain a good UX for mouse users we want to open the picker on click
|
|
46
48
|
React__default["default"].createElement("div", { onClick: onClick },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "4.87.4-
|
|
3
|
+
"version": "4.87.4-STfixing-.1+9f4777b2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"> 1%",
|
|
81
81
|
"IE 10"
|
|
82
82
|
],
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "9f4777b2ce8f07176eed60e9d4848b60b970af51"
|
|
84
84
|
}
|