@autoguru/overdrive 4.12.3 → 4.12.4

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.
@@ -3,8 +3,8 @@ import { ResponsiveProp } from '../../utils/responsiveProps.css';
3
3
  import { widthMap } from './ImageServerProvider';
4
4
  import { SimpleImage } from './SimpleImage';
5
5
  export interface Props extends Omit<ComponentProps<typeof SimpleImage>, 'sizes'> {
6
- imageWidth?: ResponsiveProp<keyof typeof widthMap>;
7
- sizes?: ResponsiveProp<string>;
6
+ imageWidth: ResponsiveProp<keyof typeof widthMap>;
7
+ sizes: ResponsiveProp<string>;
8
8
  quality?: number;
9
9
  }
10
10
  export declare const ResponsiveImage: FunctionComponent<Props>;
@@ -1 +1 @@
1
- {"version":3,"file":"ResponsiveImage.d.ts","sourceRoot":"","sources":["../../../lib/components/Image/ResponsiveImage.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAK/D,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,EAAkB,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,WAAW,KAChB,SAAQ,IAAI,CAAC,cAAc,CAAC,OAAO,WAAW,CAAC,EAAE,OAAO,CAAC;IAQzD,UAAU,CAAC,EAAE,cAAc,CAAC,MAAM,OAAO,QAAQ,CAAC,CAAC;IAanD,KAAK,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IAM/B,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,eAAe,EAAE,iBAAiB,CAAC,KAAK,CAyCpD,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"ResponsiveImage.d.ts","sourceRoot":"","sources":["../../../lib/components/Image/ResponsiveImage.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAK/D,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,EAAkB,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,WAAW,KAChB,SAAQ,IAAI,CAAC,cAAc,CAAC,OAAO,WAAW,CAAC,EAAE,OAAO,CAAC;IAQzD,UAAU,EAAE,cAAc,CAAC,MAAM,OAAO,QAAQ,CAAC,CAAC;IAalD,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IAM9B,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,eAAe,EAAE,iBAAiB,CAAC,KAAK,CA6CpD,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -38,7 +38,7 @@ export const ResponsiveImage = _ref => {
38
38
  quality
39
39
  }), [incomingSrc, quality]);
40
40
  return _jsx(SimpleImage, _objectSpread({
41
- sizes: sizes,
41
+ sizes: sizes || void 0,
42
42
  srcSet: srcset,
43
43
  src: src
44
44
  }, imgProps));
@@ -1,4 +1,4 @@
1
1
  import { ResponsiveProp } from '../../utils/responsiveProps.css';
2
- export declare function useResponsiveValue<T extends string | number | boolean | {}>(responsiveValue: ResponsiveProp<T>, fallbackCase?: boolean): T;
2
+ export declare function useResponsiveValue<T extends string | number | boolean | {}>(responsiveValue: ResponsiveProp<T>, serverFallbackCase?: T): T | null;
3
3
  export default useResponsiveValue;
4
4
  //# sourceMappingURL=useResponsiveValue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useResponsiveValue.d.ts","sourceRoot":"","sources":["../../../lib/hooks/useResponsiveValue/useResponsiveValue.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,EAAE,EAC1E,eAAe,EAAE,cAAc,CAAC,CAAC,CAAC,EAClC,YAAY,UAAQ,GAClB,CAAC,CAeH;AAED,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"useResponsiveValue.d.ts","sourceRoot":"","sources":["../../../lib/hooks/useResponsiveValue/useResponsiveValue.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,EAAE,EAC1E,eAAe,EAAE,cAAc,CAAC,CAAC,CAAC,EAClC,kBAAkB,CAAC,EAAE,CAAC,GACpB,CAAC,GAAG,IAAI,CAmBV;AAED,eAAe,kBAAkB,CAAC"}
@@ -2,12 +2,12 @@
2
2
 
3
3
  import { useMemo } from 'react';
4
4
  import { useMedia } from "../../index.js";
5
+ import { isBrowser } from "../../utils/index.js";
5
6
  import { getEarliestKnownToken } from "../../utils/resolveResponsiveProps.js";
6
- export function useResponsiveValue(responsiveValue) {
7
- let fallbackCase = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
7
+ export function useResponsiveValue(responsiveValue, serverFallbackCase) {
8
+ if (!isBrowser) return serverFallbackCase || null;
8
9
  if (!Array.isArray(responsiveValue)) return responsiveValue;
9
- if (fallbackCase) return responsiveValue[0];
10
- const activeBP = useMedia(['mobile', 'tablet', 'desktop', 'largeDesktop'], fallbackCase).reduce((activeBreakPoint, current, index) => {
10
+ const activeBP = useMedia(['mobile', 'tablet', 'desktop', 'largeDesktop']).reduce((activeBreakPoint, current, index) => {
11
11
  if (current) activeBreakPoint = index + 1;
12
12
  return activeBreakPoint;
13
13
  }, 1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autoguru/overdrive",
3
- "version": "4.12.3",
3
+ "version": "4.12.4",
4
4
  "description": "Overdrive is a product component library, and design system for AutoGuru.",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",