@autoguru/overdrive 4.11.4 → 4.11.5
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/OverdriveProvider/OverdriveProvider.d.ts +1 -1
- package/dist/components/OverdriveProvider/OverdriveProvider.d.ts.map +1 -1
- package/dist/components/OverdriveProvider/OverdriveProvider.js +4 -5
- package/dist/components/Portal/Portal.d.ts +2 -2
- package/dist/components/Portal/Portal.d.ts.map +1 -1
- package/dist/components/Portal/Portal.js +10 -4
- package/dist/components/ThemeProvider/ThemeProvider.d.ts +3 -4
- package/dist/components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
- package/dist/components/ThemeProvider/ThemeProvider.js +4 -2
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentProps, FunctionComponent, ReactNode } from 'react';
|
|
2
2
|
import { ThemeProvider } from '../ThemeProvider/ThemeProvider';
|
|
3
3
|
export interface Props extends ComponentProps<typeof ThemeProvider> {
|
|
4
|
-
noBodyLevelTheming
|
|
4
|
+
noBodyLevelTheming?: boolean;
|
|
5
5
|
children?: ReactNode;
|
|
6
6
|
}
|
|
7
7
|
export declare const OverdriveProvider: FunctionComponent<Props>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverdriveProvider.d.ts","sourceRoot":"","sources":["../../../lib/components/OverdriveProvider/OverdriveProvider.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AAIhF,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE/D,MAAM,WAAW,KAAM,SAAQ,cAAc,CAAC,OAAO,aAAa,CAAC;IAIlE,kBAAkB,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"OverdriveProvider.d.ts","sourceRoot":"","sources":["../../../lib/components/OverdriveProvider/OverdriveProvider.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AAIhF,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE/D,MAAM,WAAW,KAAM,SAAQ,cAAc,CAAC,OAAO,aAAa,CAAC;IAIlE,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,EAAE,SAAS,CAAC;CACrB;AAED,eAAO,MAAM,iBAAiB,EAAE,iBAAiB,CAAC,KAAK,CA4BtD,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -12,23 +12,22 @@ export const OverdriveProvider = _ref => {
|
|
|
12
12
|
vars,
|
|
13
13
|
themeClass,
|
|
14
14
|
breakpoints,
|
|
15
|
+
portalMountPoint,
|
|
15
16
|
children
|
|
16
17
|
} = _ref;
|
|
17
18
|
useEffect(() => {
|
|
18
19
|
if (!isBrowser) return;
|
|
20
|
+
document.body.style.backgroundColor = tokens.body.backgroundColour;
|
|
21
|
+
document.body.style.color = tokens.body.colour;
|
|
19
22
|
if (!noBodyLevelTheming) {
|
|
20
23
|
document.body.classList.add(themeClass);
|
|
21
|
-
document.body.style.backgroundColor = vars.body.backgroundColour;
|
|
22
|
-
document.body.style.color = vars.body.colour;
|
|
23
|
-
} else {
|
|
24
|
-
document.body.style.backgroundColor = tokens.body.backgroundColour;
|
|
25
|
-
document.body.style.color = tokens.body.colour;
|
|
26
24
|
}
|
|
27
25
|
}, [vars, themeClass]);
|
|
28
26
|
return _jsx(ThemeProvider, {
|
|
29
27
|
vars: vars,
|
|
30
28
|
themeClass: themeClass,
|
|
31
29
|
breakpoints: breakpoints,
|
|
30
|
+
portalMountPoint: portalMountPoint,
|
|
32
31
|
children: children
|
|
33
32
|
});
|
|
34
33
|
};
|
|
@@ -2,11 +2,11 @@ import type { ReactNode, Ref } from 'react';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
export interface Props {
|
|
4
4
|
children?: ReactNode;
|
|
5
|
-
container?:
|
|
5
|
+
container?: HTMLElement;
|
|
6
6
|
noThemedWrapper?: boolean;
|
|
7
7
|
}
|
|
8
8
|
declare function Portal({ children, container, noThemedWrapper }: Props, ref: Ref<typeof container>): React.ReactPortal | null;
|
|
9
|
-
declare const _Portal: React.ForwardRefExoticComponent<Props & React.RefAttributes<
|
|
9
|
+
declare const _Portal: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLElement | undefined>>;
|
|
10
10
|
export { _Portal as Portal };
|
|
11
11
|
export default Portal;
|
|
12
12
|
//# sourceMappingURL=Portal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Portal.d.ts","sourceRoot":"","sources":["../../../lib/components/Portal/Portal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAa,MAAM,OAAO,CAAC;AACvD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,MAAM,WAAW,KAAK;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"Portal.d.ts","sourceRoot":"","sources":["../../../lib/components/Portal/Portal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAa,MAAM,OAAO,CAAC;AACvD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,MAAM,WAAW,KAAK;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC1B;AAID,iBAAS,MAAM,CACd,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,EAAE,KAAK,EAC/C,GAAG,EAAE,GAAG,CAAC,OAAO,SAAS,CAAC,4BAmC1B;AAED,QAAA,MAAM,OAAO,uFAAqB,CAAC;AACnC,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,CAAC;AAE7B,eAAe,MAAM,CAAC"}
|
|
@@ -7,18 +7,24 @@ import { isBrowser, isHtmlElement, setRef } from "../../utils/index.js";
|
|
|
7
7
|
import { useTheme } from "../ThemeProvider/index.js";
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
9
|
function Portal(_ref, ref) {
|
|
10
|
-
var _useTheme;
|
|
11
10
|
let {
|
|
12
11
|
children,
|
|
13
12
|
container,
|
|
14
13
|
noThemedWrapper
|
|
15
14
|
} = _ref;
|
|
16
|
-
const
|
|
15
|
+
const {
|
|
16
|
+
themeClass,
|
|
17
|
+
portalMountPoint
|
|
18
|
+
} = useTheme();
|
|
17
19
|
const [mountNode, setMountNode] = useState(null);
|
|
18
20
|
if (isBrowser) {
|
|
19
21
|
useLayoutEffect(() => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
let mountElement = document.body;
|
|
23
|
+
if (isHtmlElement(container)) mountElement = container;else if (isHtmlElement(portalMountPoint === null || portalMountPoint === void 0 ? void 0 : portalMountPoint.current)) {
|
|
24
|
+
mountElement = portalMountPoint.current;
|
|
25
|
+
}
|
|
26
|
+
setMountNode(mountElement);
|
|
27
|
+
}, [container, portalMountPoint === null || portalMountPoint === void 0 ? void 0 : portalMountPoint.current]);
|
|
22
28
|
useLayoutEffect(() => {
|
|
23
29
|
if (mountNode) {
|
|
24
30
|
setRef(ref, mountNode);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FunctionComponent, ReactNode } from 'react';
|
|
1
|
+
import { FunctionComponent, MutableRefObject, ReactNode } from 'react';
|
|
2
2
|
import { RuntimeTokens } from '../../themes/makeTheme';
|
|
3
3
|
import { themeContractVars } from '../../themes/theme.css';
|
|
4
4
|
import { BreakPoints } from '../../themes/tokens';
|
|
@@ -6,11 +6,10 @@ declare type ThemeVars = typeof themeContractVars;
|
|
|
6
6
|
declare type ThemeContextType = {
|
|
7
7
|
vars: ThemeVars;
|
|
8
8
|
themeClass: string;
|
|
9
|
+
portalMountPoint?: MutableRefObject<typeof HTMLElement>;
|
|
9
10
|
};
|
|
10
|
-
export interface Props {
|
|
11
|
+
export interface Props extends ThemeContextType {
|
|
11
12
|
children?: ReactNode;
|
|
12
|
-
vars: ThemeVars;
|
|
13
|
-
themeClass: string;
|
|
14
13
|
breakpoints?: BreakPoints;
|
|
15
14
|
}
|
|
16
15
|
export declare const ThemeProvider: FunctionComponent<Props>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../../lib/components/ThemeProvider/ThemeProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAiB,iBAAiB,EAAE,SAAS,EAAuB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../../lib/components/ThemeProvider/ThemeProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAiB,iBAAiB,EAAE,gBAAgB,EAAE,SAAS,EAAuB,MAAM,OAAO,CAAC;AAE3G,OAAO,EAAqB,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,aAAK,SAAS,GAAG,OAAO,iBAAiB,CAAC;AAC1C,aAAK,gBAAgB,GAAG;IACvB,IAAI,EAAE,SAAS,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,OAAO,WAAW,CAAC,CAAC;CACxD,CAAC;AAIF,MAAM,WAAW,KAAM,SAAQ,gBAAgB;IAC9C,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC1B;AAED,eAAO,MAAM,aAAa,EAAE,iBAAiB,CAAC,KAAK,CAgBlD,CAAC;AAEF,eAAO,MAAM,QAAQ,wBAMpB,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAO,aAInC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -12,12 +12,14 @@ export const ThemeProvider = _ref => {
|
|
|
12
12
|
vars,
|
|
13
13
|
themeClass,
|
|
14
14
|
children,
|
|
15
|
-
breakpoints
|
|
15
|
+
breakpoints,
|
|
16
|
+
portalMountPoint
|
|
16
17
|
} = _ref;
|
|
17
18
|
return _jsx(themeContext.Provider, {
|
|
18
19
|
value: useMemo(() => ({
|
|
19
20
|
vars,
|
|
20
|
-
themeClass
|
|
21
|
+
themeClass,
|
|
22
|
+
portalMountPoint
|
|
21
23
|
}), [vars]),
|
|
22
24
|
children: _jsx(runtimeTokensContext.Provider, {
|
|
23
25
|
value: useMemo(() => makeRuntimeTokens(breakpoints), []),
|