@autoguru/overdrive 4.28.0 → 4.29.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/components/Icon/Icon.d.ts.map +1 -1
- package/dist/components/Icon/Icon.js +4 -2
- package/dist/components/Icon/stories.js +2 -1
- package/dist/components/Image/SimpleImage.d.ts +2 -2
- package/dist/components/Image/SimpleImage.d.ts.map +1 -1
- package/dist/components/Image/SimpleImage.js +14 -5
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +2 -1
- package/dist/hooks/useNullCheck/index.d.ts +2 -0
- package/dist/hooks/useNullCheck/index.d.ts.map +1 -0
- package/dist/hooks/useNullCheck/index.js +3 -0
- package/dist/hooks/useNullCheck/useNullCheck.d.ts +2 -0
- package/dist/hooks/useNullCheck/useNullCheck.d.ts.map +1 -0
- package/dist/hooks/useNullCheck/useNullCheck.js +10 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../../lib/components/Icon/Icon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../../lib/components/Icon/Icon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAM5E,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAG5C,OAAO,KAAK,MAAM,MAAM,YAAY,CAAC;AAErC,MAAM,WAAW,KAAK;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE,OAAO,GAAG,aAAa,CAAC,CAAC;IACrE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,cAAc,CAAC,MAAM,OAAO,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;IACzD,IAAI,EAAE,QAAQ,GAAG,YAAY,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC,CAAC;CAChE;AAED,eAAO,MAAM,IAAI,EAAE,iBAAiB,CAAC,KAAK,CA0BzC,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { cloneElement } from 'react';
|
|
5
|
+
import { useNullCheck } from "../../hooks/useNullCheck/index.js";
|
|
5
6
|
import { resolveResponsiveStyle } from "../../utils/resolveResponsiveProps.js";
|
|
6
7
|
import { Box, useBoxStyles } from "../Box/index.js";
|
|
7
8
|
import * as styles from "./Icon.css.js";
|
|
@@ -13,19 +14,20 @@ export const Icon = _ref => {
|
|
|
13
14
|
size = 'small',
|
|
14
15
|
display = 'block'
|
|
15
16
|
} = _ref;
|
|
17
|
+
useNullCheck(icon, 'Icon component received an empty icon prop.');
|
|
16
18
|
return _jsx(Box, {
|
|
17
19
|
is: "i",
|
|
18
20
|
display: display,
|
|
19
21
|
className: [resolveResponsiveStyle(size, styles.size), className],
|
|
20
22
|
role: "presentation",
|
|
21
|
-
children: cloneElement(icon, {
|
|
23
|
+
children: icon ? cloneElement(icon, {
|
|
22
24
|
className: useBoxStyles({
|
|
23
25
|
is: 'svg',
|
|
24
26
|
display: 'block',
|
|
25
27
|
width: 'full',
|
|
26
28
|
height: 'full'
|
|
27
29
|
})
|
|
28
|
-
})
|
|
30
|
+
}) : '⬤'
|
|
29
31
|
});
|
|
30
32
|
};
|
|
31
33
|
export default Icon;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FunctionComponent } from 'react';
|
|
1
|
+
import { FunctionComponent, ReactElement } from 'react';
|
|
2
2
|
export interface Props extends Partial<Omit<HTMLImageElement, 'loading' | 'className' | 'width' | 'height'>> {
|
|
3
3
|
src: string;
|
|
4
4
|
eager?: boolean;
|
|
@@ -7,7 +7,7 @@ export interface Props extends Partial<Omit<HTMLImageElement, 'loading' | 'class
|
|
|
7
7
|
width?: string;
|
|
8
8
|
height?: string;
|
|
9
9
|
className?: string;
|
|
10
|
+
fallbackComponent?: ReactElement;
|
|
10
11
|
}
|
|
11
12
|
export declare const SimpleImage: FunctionComponent<Props>;
|
|
12
|
-
export default SimpleImage;
|
|
13
13
|
//# sourceMappingURL=SimpleImage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SimpleImage.d.ts","sourceRoot":"","sources":["../../../lib/components/Image/SimpleImage.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"SimpleImage.d.ts","sourceRoot":"","sources":["../../../lib/components/Image/SimpleImage.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAY,MAAM,OAAO,CAAC;AAElE,MAAM,WAAW,KAChB,SAAQ,OAAO,CACd,IAAI,CAAC,gBAAgB,EAAE,SAAS,GAAG,WAAW,GAAG,OAAO,GAAG,QAAQ,CAAC,CACpE;IACD,GAAG,EAAE,MAAM,CAAC;IAKZ,KAAK,CAAC,EAAE,OAAO,CAAC;IAMhB,MAAM,CAAC,EAAE,MAAM,CAAC;IAMhB,YAAY,CAAC,EAAE,OAAO,CAAC;IAMvB,KAAK,CAAC,EAAE,MAAM,CAAC;IAKf,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,iBAAiB,CAAC,EAAE,YAAY,CAAC;CACjC;AAED,eAAO,MAAM,WAAW,EAAE,iBAAiB,CAAC,KAAK,CAgChD,CAAC"}
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
const _excluded = ["eager", "syncDecoding", "className", "src", "srcSet"];
|
|
5
|
+
const _excluded = ["eager", "syncDecoding", "className", "src", "srcSet", "fallbackComponent"];
|
|
6
6
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
7
7
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8
8
|
import * as React from 'react';
|
|
9
|
+
import { useState } from 'react';
|
|
9
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
11
|
export const SimpleImage = _ref => {
|
|
11
12
|
let {
|
|
@@ -13,15 +14,23 @@ export const SimpleImage = _ref => {
|
|
|
13
14
|
syncDecoding = 'false',
|
|
14
15
|
className = '',
|
|
15
16
|
src,
|
|
16
|
-
srcSet
|
|
17
|
+
srcSet,
|
|
18
|
+
fallbackComponent
|
|
17
19
|
} = _ref,
|
|
18
20
|
imgProps = _objectWithoutProperties(_ref, _excluded);
|
|
21
|
+
const [hasError, setHasError] = useState(false);
|
|
22
|
+
const handleError = () => {
|
|
23
|
+
setHasError(true);
|
|
24
|
+
};
|
|
25
|
+
if (hasError && fallbackComponent) {
|
|
26
|
+
return fallbackComponent;
|
|
27
|
+
}
|
|
19
28
|
return _jsx("img", _objectSpread({
|
|
20
29
|
loading: eager ? 'eager' : 'lazy',
|
|
21
30
|
decoding: syncDecoding ? 'sync' : 'async',
|
|
22
31
|
className: className,
|
|
23
32
|
srcSet: srcSet,
|
|
24
|
-
src: src
|
|
33
|
+
src: src,
|
|
34
|
+
onError: handleError
|
|
25
35
|
}, imgProps));
|
|
26
|
-
};
|
|
27
|
-
export default SimpleImage;
|
|
36
|
+
};
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC"}
|
package/dist/hooks/index.js
CHANGED
|
@@ -7,4 +7,5 @@ export * from "./useNegativeMargin/index.js";
|
|
|
7
7
|
export * from "./useResponsiveValue/index.js";
|
|
8
8
|
export * from "./useWindowHeightFill/index.js";
|
|
9
9
|
export * from "./useWindowScrollLock/index.js";
|
|
10
|
-
export * from "./useMedia/index.js";
|
|
10
|
+
export * from "./useMedia/index.js";
|
|
11
|
+
export * from "./useNullCheck/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/hooks/useNullCheck/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNullCheck.d.ts","sourceRoot":"","sources":["../../../lib/hooks/useNullCheck/useNullCheck.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,UAAW,GAAG,WAAW,MAAM,SAMvD,CAAC"}
|