@autoguru/overdrive 4.14.7 → 4.15.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.
Files changed (40) hide show
  1. package/dist/components/FillHeightBox/FillHeightBox.d.ts +7 -0
  2. package/dist/components/FillHeightBox/FillHeightBox.d.ts.map +1 -0
  3. package/dist/components/FillHeightBox/FillHeightBox.js +33 -0
  4. package/dist/components/FillHeightBox/index.d.ts +2 -0
  5. package/dist/components/FillHeightBox/index.d.ts.map +1 -0
  6. package/dist/components/FillHeightBox/index.js +3 -0
  7. package/dist/components/FillHeightBox/stories.js +47 -0
  8. package/dist/components/ScrollPane/ScrollPane.css.d.ts +3 -0
  9. package/dist/components/ScrollPane/ScrollPane.css.d.ts.map +1 -0
  10. package/dist/components/ScrollPane/ScrollPane.css.js +45 -0
  11. package/dist/components/ScrollPane/ScrollPane.d.ts +13 -0
  12. package/dist/components/ScrollPane/ScrollPane.d.ts.map +1 -0
  13. package/dist/components/ScrollPane/ScrollPane.js +27 -0
  14. package/dist/components/ScrollPane/index.d.ts +2 -0
  15. package/dist/components/ScrollPane/index.d.ts.map +1 -0
  16. package/dist/components/ScrollPane/index.js +3 -0
  17. package/dist/components/ScrollPane/stories.js +55 -0
  18. package/dist/components/StickyBox/StickyBox.css.d.ts +7 -0
  19. package/dist/components/StickyBox/StickyBox.css.d.ts.map +1 -0
  20. package/dist/components/StickyBox/StickyBox.css.js +31 -0
  21. package/dist/components/StickyBox/StickyBox.d.ts +11 -0
  22. package/dist/components/StickyBox/StickyBox.d.ts.map +1 -0
  23. package/dist/components/StickyBox/StickyBox.js +55 -0
  24. package/dist/components/StickyBox/index.d.ts +2 -0
  25. package/dist/components/StickyBox/index.d.ts.map +1 -0
  26. package/dist/components/StickyBox/index.js +3 -0
  27. package/dist/components/StickyBox/stories.js +64 -0
  28. package/dist/components/index.d.ts +3 -0
  29. package/dist/components/index.d.ts.map +1 -1
  30. package/dist/components/index.js +4 -1
  31. package/dist/hooks/useWindowHeightFill/index.d.ts +2 -0
  32. package/dist/hooks/useWindowHeightFill/index.d.ts.map +1 -0
  33. package/dist/hooks/useWindowHeightFill/index.js +3 -0
  34. package/dist/hooks/useWindowHeightFill/useWindowHeightFill.d.ts +11 -0
  35. package/dist/hooks/useWindowHeightFill/useWindowHeightFill.d.ts.map +1 -0
  36. package/dist/hooks/useWindowHeightFill/useWindowHeightFill.js +42 -0
  37. package/dist/utils/css.d.ts +1 -1
  38. package/dist/utils/css.d.ts.map +1 -1
  39. package/dist/utils/css.js +3 -2
  40. package/package.json +1 -1
@@ -0,0 +1,7 @@
1
+ import { ComponentProps, FunctionComponent } from 'react';
2
+ import { UseWindowHeightFillProps } from '../../hooks/useWindowHeightFill/useWindowHeightFill';
3
+ import { ScrollPane } from '../ScrollPane';
4
+ type Props = Omit<UseWindowHeightFillProps, 'containerRef'> & ComponentProps<typeof ScrollPane>;
5
+ export declare const FillHeightBox: FunctionComponent<Props>;
6
+ export {};
7
+ //# sourceMappingURL=FillHeightBox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FillHeightBox.d.ts","sourceRoot":"","sources":["../../../lib/components/FillHeightBox/FillHeightBox.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE1D,OAA4B,EAC3B,wBAAwB,EACxB,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,KAAK,KAAK,GAAG,IAAI,CAAC,wBAAwB,EAAE,cAAc,CAAC,GAC1D,cAAc,CAAC,OAAO,UAAU,CAAC,CAAC;AAEnC,eAAO,MAAM,aAAa,EAAE,iBAAiB,CAAC,KAAK,CAsBlD,CAAC"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
4
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
+ const _excluded = ["includeMobile", "bottomGap", "serverVhFallback", "style"];
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
+ 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
+ import * as React from 'react';
9
+ import useWindowHeightFill from "../../hooks/useWindowHeightFill/useWindowHeightFill.js";
10
+ import { ScrollPane } from "../ScrollPane/index.js";
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ export const FillHeightBox = _ref => {
13
+ let {
14
+ includeMobile,
15
+ bottomGap,
16
+ serverVhFallback,
17
+ style
18
+ } = _ref,
19
+ scrollPaneProps = _objectWithoutProperties(_ref, _excluded);
20
+ const containerRef = React.useRef(null);
21
+ const containerHeight = useWindowHeightFill({
22
+ containerRef,
23
+ includeMobile,
24
+ bottomGap,
25
+ serverVhFallback
26
+ });
27
+ return _jsx(ScrollPane, _objectSpread(_objectSpread({}, scrollPaneProps), {}, {
28
+ ref: containerRef,
29
+ style: _objectSpread(_objectSpread({}, style), {}, {
30
+ maxHeight: containerHeight
31
+ })
32
+ }));
33
+ };
@@ -0,0 +1,2 @@
1
+ export { FillHeightBox } from './FillHeightBox';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/components/FillHeightBox/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+
3
+ export { FillHeightBox } from "./FillHeightBox.js";
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
4
+ 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; }
5
+ 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; }
6
+ import * as React from 'react';
7
+ import { Box } from "../Box/index.js";
8
+ import { StickyBox } from "../StickyBox/index.js";
9
+ import { Text } from "../Text/index.js";
10
+ import { FillHeightBox } from "./FillHeightBox.js";
11
+ import { jsxs as _jsxs } from "react/jsx-runtime";
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ export default {
14
+ title: 'Foundation/Layout/FillHeightBox',
15
+ component: StickyBox
16
+ };
17
+ const Template = args => _jsx(FillHeightBox, _objectSpread(_objectSpread({
18
+ rounded: true,
19
+ includeMobile: true,
20
+ bottomGap: "5",
21
+ width: "full",
22
+ backgroundColour: "white",
23
+ borderColour: "gray",
24
+ borderWidth: "1",
25
+ boxShadow: "1",
26
+ height: "full",
27
+ borderRadius: "1"
28
+ }, args), {}, {
29
+ children: _jsx(Box, {
30
+ padding: "5",
31
+ width: "full",
32
+ style: {
33
+ minHeight: '300vh'
34
+ },
35
+ children: Array.from({
36
+ length: 100
37
+ }).map((_, i) => _jsxs(Text, {
38
+ is: "p",
39
+ children: ["I am page content ", i + 1]
40
+ }, i))
41
+ })
42
+ }));
43
+ const standardProps = {
44
+ top: 'none'
45
+ };
46
+ export const standard = Template.bind(standardProps);
47
+ standard.args = standardProps;
@@ -0,0 +1,3 @@
1
+ export declare const root: string;
2
+ export declare const rounded: string;
3
+ //# sourceMappingURL=ScrollPane.css.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScrollPane.css.d.ts","sourceRoot":"","sources":["../../../lib/components/ScrollPane/ScrollPane.css.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,IAAI,QA6Bf,CAAC;AAEH,eAAO,MAAM,OAAO,QAOlB,CAAC"}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+
3
+ import * as __vanilla_filescope__ from '@vanilla-extract/css/fileScope';
4
+ __vanilla_filescope__.setFileScope("lib/components/ScrollPane/ScrollPane.css.ts", "@autoguru/overdrive");
5
+ import { style } from '@vanilla-extract/css';
6
+ import { themeContractVars as vars } from "../../themes/theme.css.js";
7
+ export const root = style({
8
+ '::-webkit-scrollbar': {
9
+ backgroundColor: 'transparent',
10
+ width: 6
11
+ },
12
+ '::-webkit-scrollbar-corner': {
13
+ background: 'transparent'
14
+ },
15
+ '::-webkit-scrollbar-thumb': {
16
+ overflow: 'hidden',
17
+ backgroundColor: vars.colours.gamut.gray300
18
+ },
19
+ '::-webkit-scrollbar-track': {
20
+ position: 'absolute',
21
+ backgroundColor: vars.colours.gamut.gray100,
22
+ border: "1px solid ".concat(vars.colours.gamut.gray200)
23
+ },
24
+ '::-webkit-scrollbar-button': {
25
+ display: 'none'
26
+ },
27
+ selectors: {
28
+ ['&::-webkit-scrollbar-track:hover']: {
29
+ backgroundColor: vars.colours.gamut.gray300
30
+ },
31
+ ['&::-webkit-scrollbar-thumb:hover']: {
32
+ backgroundColor: vars.colours.gamut.gray400,
33
+ border: "1px solid ".concat(vars.colours.gamut.gray400)
34
+ }
35
+ }
36
+ }, "root");
37
+ export const rounded = style({
38
+ '::-webkit-scrollbar-thumb': {
39
+ borderRadius: vars.border.radius['1']
40
+ },
41
+ '::-webkit-scrollbar-track': {
42
+ borderRadius: "0 ".concat(vars.border.radius['1'], " ").concat(vars.border.radius['1'], " 0")
43
+ }
44
+ }, "rounded");
45
+ __vanilla_filescope__.endFileScope();
@@ -0,0 +1,13 @@
1
+ import { ComponentProps, FunctionComponent } from 'react';
2
+ import { Tokens } from '../../themes/tokens';
3
+ import { Box } from '../Box';
4
+ interface Props extends Omit<ComponentProps<typeof Box>, 'overflow'> {
5
+ bottomGap?: keyof Tokens['space'];
6
+ serverVhFallback?: number;
7
+ includeMobile?: boolean;
8
+ rounded?: boolean;
9
+ className?: string;
10
+ }
11
+ export declare const ScrollPane: FunctionComponent<Props>;
12
+ export {};
13
+ //# sourceMappingURL=ScrollPane.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScrollPane.d.ts","sourceRoot":"","sources":["../../../lib/components/ScrollPane/ScrollPane.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAc,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEtE,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAI7B,UAAU,KAAM,SAAQ,IAAI,CAAC,cAAc,CAAC,OAAO,GAAG,CAAC,EAAE,UAAU,CAAC;IACnE,SAAS,CAAC,EAAE,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC;IAClC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,UAAU,EAAE,iBAAiB,CAAC,KAAK,CAW/C,CAAC"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
4
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
+ const _excluded = ["className", "rounded"];
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
+ 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
+ import clsx from 'clsx';
9
+ import * as React from 'react';
10
+ import { forwardRef } from 'react';
11
+ import { Box } from "../Box/index.js";
12
+ import * as styles from "./ScrollPane.css.js";
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ export const ScrollPane = forwardRef((_ref, ref) => {
15
+ let {
16
+ className = '',
17
+ rounded = false
18
+ } = _ref,
19
+ rest = _objectWithoutProperties(_ref, _excluded);
20
+ return _jsx(Box, _objectSpread({
21
+ ref: ref,
22
+ overflow: "auto",
23
+ className: clsx(className, styles.root, {
24
+ [styles.rounded]: rounded
25
+ })
26
+ }, rest));
27
+ });
@@ -0,0 +1,2 @@
1
+ export { ScrollPane } from './ScrollPane';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/components/ScrollPane/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+
3
+ export { ScrollPane } from "./ScrollPane.js";
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
4
+ 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; }
5
+ 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; }
6
+ import * as React from 'react';
7
+ import { Box } from "../Box/index.js";
8
+ import { Heading } from "../Heading/index.js";
9
+ import { StickyBox } from "../StickyBox/index.js";
10
+ import { Text } from "../Text/index.js";
11
+ import { ScrollPane } from "./index.js";
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { jsxs as _jsxs } from "react/jsx-runtime";
14
+ export default {
15
+ title: 'Foundation/Layout/ScrollPane',
16
+ component: ScrollPane
17
+ };
18
+ const Template = args => _jsxs(ScrollPane, _objectSpread(_objectSpread({
19
+ style: {
20
+ maxHeight: '300px'
21
+ }
22
+ }, args), {}, {
23
+ children: [_jsx(StickyBox, {
24
+ width: "full",
25
+ children: _jsx(Box, {
26
+ matginTop: "8",
27
+ padding: "3",
28
+ width: "full",
29
+ backgroundColour: "yellow700",
30
+ borderRadius: "1",
31
+ overflow: "hidden",
32
+ children: _jsx(Heading, {
33
+ is: "h2",
34
+ align: "center",
35
+ colour: "white",
36
+ children: "I'm a sticky header"
37
+ })
38
+ })
39
+ }), _jsx(Box, {
40
+ padding: "5",
41
+ width: "full",
42
+ style: {
43
+ minHeight: '300vh'
44
+ },
45
+ children: Array.from({
46
+ length: 100
47
+ }).map((_, i) => _jsxs(Text, {
48
+ is: "p",
49
+ children: ["I am page content ", i + 1]
50
+ }, i))
51
+ })]
52
+ }));
53
+ const standardProps = {};
54
+ export const standard = Template.bind(standardProps);
55
+ standard.args = standardProps;
@@ -0,0 +1,7 @@
1
+ export declare const root: string;
2
+ export declare const content: string;
3
+ export declare const popped: string;
4
+ export declare const zIndex: Record<never, string>;
5
+ export declare const top: Record<never, string>;
6
+ export declare const bottom: Record<never, string>;
7
+ //# sourceMappingURL=StickyBox.css.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StickyBox.css.d.ts","sourceRoot":"","sources":["../../../lib/components/StickyBox/StickyBox.css.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,IAAI,QAGf,CAAC;AAEH,eAAO,MAAM,OAAO,QAGlB,CAAC;AAEH,eAAO,MAAM,MAAM,QAEjB,CAAC;AAEH,eAAO,MAAM,MAAM,uBAQlB,CAAC;AAEF,eAAO,MAAM,GAAG,uBASf,CAAC;AAEF,eAAO,MAAM,MAAM,uBASlB,CAAC"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ import * as __vanilla_filescope__ from '@vanilla-extract/css/fileScope';
4
+ __vanilla_filescope__.setFileScope("lib/components/StickyBox/StickyBox.css.ts", "@autoguru/overdrive");
5
+ import { style, styleVariants } from '@vanilla-extract/css';
6
+ import { themeContractVars as vars } from "../../themes/theme.css.js";
7
+ import { mapTokenToProperty } from "../../utils/mapTokenToProperty.js";
8
+ export const root = style({
9
+ position: 'sticky',
10
+ transition: "box-shadow 0.3s ".concat(vars.animation.easing.standard, " 0s")
11
+ }, "root");
12
+ export const content = style({
13
+ height: 'fit-content',
14
+ transition: "transform 0.3s ".concat(vars.animation.easing.standard, " 0s")
15
+ }, "content");
16
+ export const popped = style({
17
+ transform: 'scale(1.01)'
18
+ }, "popped");
19
+ export const zIndex = styleVariants(mapTokenToProperty([0, 1, 2, 3, 99].reduce((tokens, current) => {
20
+ tokens[current] = current;
21
+ return tokens;
22
+ }, {}), 'zIndex'), "zIndex");
23
+ export const top = styleVariants(mapTokenToProperty(['none', '1', '3', '5', '7', 'subHeader'].reduce((tokens, current) => {
24
+ if (current === 'subHeader') tokens[current] = '72px';else tokens[current] = vars.space[current];
25
+ return tokens;
26
+ }, {}), 'top'), "top");
27
+ export const bottom = styleVariants(mapTokenToProperty(['none', '1', '3', '5', '7', 'subHeader'].reduce((tokens, current) => {
28
+ if (current === 'subHeader') tokens[current] = '72px';else tokens[current] = vars.space[current];
29
+ return tokens;
30
+ }, {}), 'bottom'), "bottom");
31
+ __vanilla_filescope__.endFileScope();
@@ -0,0 +1,11 @@
1
+ import { ComponentProps, FunctionComponent } from 'react';
2
+ import { Box } from '../Box';
3
+ interface Props extends ComponentProps<typeof Box> {
4
+ top?: 'none' | '1' | '2' | '3' | '5' | '7' | 'subHeader';
5
+ bottom?: 'none' | '1' | '2' | '3' | 'subHeader';
6
+ zIndex?: 0 | 1 | 2 | 3 | 99;
7
+ className?: string;
8
+ }
9
+ export declare const StickyBox: FunctionComponent<Props>;
10
+ export {};
11
+ //# sourceMappingURL=StickyBox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StickyBox.d.ts","sourceRoot":"","sources":["../../../lib/components/StickyBox/StickyBox.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAuB,MAAM,OAAO,CAAC;AAE/E,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAI7B,UAAU,KAAM,SAAQ,cAAc,CAAC,OAAO,GAAG,CAAC;IACjD,GAAG,CAAC,EAAE,MAAM,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,WAAW,CAAC;IACzD,MAAM,CAAC,EAAE,MAAM,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,WAAW,CAAC;IAChD,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,SAAS,EAAE,iBAAiB,CAAC,KAAK,CAgD9C,CAAC"}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
4
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
+ const _excluded = ["top", "bottom", "zIndex", "className", "backgroundColour", "boxShadow", "children"];
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
+ 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
+ import clsx from 'clsx';
9
+ import * as React from 'react';
10
+ import { useEffect, useState } from 'react';
11
+ import { Box } from "../Box/index.js";
12
+ import * as styles from "./StickyBox.css.js";
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ export const StickyBox = _ref => {
15
+ var _containerRef$current2;
16
+ let {
17
+ top = 'none',
18
+ bottom = 'none',
19
+ zIndex = 2,
20
+ className = '',
21
+ backgroundColour,
22
+ boxShadow,
23
+ children
24
+ } = _ref,
25
+ rest = _objectWithoutProperties(_ref, _excluded);
26
+ const containerRef = React.useRef(null);
27
+ const [withShadow, setWithShadow] = useState(false);
28
+ useEffect(() => {
29
+ var _containerRef$current;
30
+ if (!((_containerRef$current = containerRef.current) !== null && _containerRef$current !== void 0 && _containerRef$current.parentElement) || !window) return void 0;
31
+ const parentElement = containerRef.current.parentElement;
32
+ const onScroll = () => {
33
+ setWithShadow(parentElement.scrollTop > 3);
34
+ };
35
+ parentElement.removeEventListener('scroll', onScroll);
36
+ parentElement.addEventListener('scroll', onScroll, {
37
+ passive: true
38
+ });
39
+ return () => parentElement.removeEventListener('scroll', onScroll);
40
+ }, [(_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.parentElement]);
41
+ return _jsx(Box, _objectSpread(_objectSpread({
42
+ ref: containerRef,
43
+ overflow: "hidden",
44
+ className: clsx(className, styles.root, styles.top[top], styles.zIndex[zIndex]),
45
+ backgroundColour: withShadow ? backgroundColour || 'white' : void 0,
46
+ boxShadow: withShadow ? boxShadow || '3' : void 0
47
+ }, rest), {}, {
48
+ children: _jsx(Box, {
49
+ className: clsx(className, styles.content, {
50
+ [styles.popped]: withShadow
51
+ }),
52
+ children: children
53
+ })
54
+ }));
55
+ };
@@ -0,0 +1,2 @@
1
+ export { StickyBox } from './StickyBox';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/components/StickyBox/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+
3
+ export { StickyBox } from "./StickyBox.js";
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+
3
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
4
+ 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; }
5
+ 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; }
6
+ import * as React from 'react';
7
+ import { Box } from "../Box/index.js";
8
+ import { FillHeightBox } from "../FillHeightBox/index.js";
9
+ import { Heading } from "../Heading/index.js";
10
+ import { Text } from "../Text/index.js";
11
+ import { StickyBox } from "./index.js";
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { jsxs as _jsxs } from "react/jsx-runtime";
14
+ export default {
15
+ title: 'Foundation/Layout/StickyBox',
16
+ component: StickyBox
17
+ };
18
+ const Template = args => _jsxs(FillHeightBox, {
19
+ rounded: true,
20
+ includeMobile: true,
21
+ bottomGap: "5",
22
+ width: "full",
23
+ backgroundColour: "white",
24
+ borderColour: "gray",
25
+ borderWidth: "1",
26
+ boxShadow: "1",
27
+ height: "full",
28
+ borderRadius: "1",
29
+ children: [_jsx(StickyBox, _objectSpread(_objectSpread({
30
+ width: "full"
31
+ }, args), {}, {
32
+ children: _jsx(Box, {
33
+ matginTop: "8",
34
+ padding: "3",
35
+ width: "full",
36
+ backgroundColour: "yellow700",
37
+ borderRadius: "1",
38
+ overflow: "hidden",
39
+ children: _jsx(Heading, {
40
+ is: "h2",
41
+ align: "center",
42
+ colour: "white",
43
+ children: "I'm a sticky header"
44
+ })
45
+ })
46
+ })), _jsx(Box, {
47
+ padding: "5",
48
+ width: "full",
49
+ style: {
50
+ minHeight: '300vh'
51
+ },
52
+ children: Array.from({
53
+ length: 100
54
+ }).map((_, i) => _jsxs(Text, {
55
+ is: "p",
56
+ children: ["I am page content ", i + 1]
57
+ }, i))
58
+ })]
59
+ });
60
+ const standardProps = {
61
+ top: 'none'
62
+ };
63
+ export const standard = Template.bind(standardProps);
64
+ standard.args = standardProps;
@@ -57,4 +57,7 @@ export * from './DividerLine';
57
57
  export * from './ThemeOverrideProvider';
58
58
  export * from './SliderProgress';
59
59
  export * from './HorizontalAutoScroller';
60
+ export * from './FillHeightBox';
61
+ export * from './StickyBox';
62
+ export * from './ScrollPane';
60
63
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAEhC,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,2BAA2B,CAAC;AAC1C,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAEhC,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,2BAA2B,CAAC;AAC1C,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
@@ -58,4 +58,7 @@ export * from "./ColourInput/index.js";
58
58
  export * from "./DividerLine/index.js";
59
59
  export * from "./ThemeOverrideProvider/index.js";
60
60
  export * from "./SliderProgress/index.js";
61
- export * from "./HorizontalAutoScroller/index.js";
61
+ export * from "./HorizontalAutoScroller/index.js";
62
+ export * from "./FillHeightBox/index.js";
63
+ export * from "./StickyBox/index.js";
64
+ export * from "./ScrollPane/index.js";
@@ -0,0 +1,2 @@
1
+ export { useWindowHeightFill } from './useWindowHeightFill';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/hooks/useWindowHeightFill/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+
3
+ export { useWindowHeightFill } from "./useWindowHeightFill.js";
@@ -0,0 +1,11 @@
1
+ import { RefObject } from 'react';
2
+ import { Tokens } from '../../themes/tokens';
3
+ export interface UseWindowHeightFillProps {
4
+ bottomGap?: keyof Tokens['space'];
5
+ serverVhFallback?: number;
6
+ includeMobile?: boolean;
7
+ containerRef: RefObject<HTMLDivElement>;
8
+ }
9
+ export declare const useWindowHeightFill: ({ bottomGap, includeMobile, serverVhFallback, containerRef, }: UseWindowHeightFillProps) => string;
10
+ export default useWindowHeightFill;
11
+ //# sourceMappingURL=useWindowHeightFill.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useWindowHeightFill.d.ts","sourceRoot":"","sources":["../../../lib/hooks/useWindowHeightFill/useWindowHeightFill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA6B,MAAM,OAAO,CAAC;AAI7D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAG7C,MAAM,WAAW,wBAAwB;IACxC,SAAS,CAAC,EAAE,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC;IAClC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,YAAY,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC;CACxC;AAED,eAAO,MAAM,mBAAmB,kEAK7B,wBAAwB,KAAG,MAiD7B,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ import { useLayoutEffect, useState } from 'react';
4
+ import { useResponsiveValue, useTheme } from "../../index.js";
5
+ import { themeContractVars } from "../../themes/theme.css.js";
6
+ import { getThemeTokenValue } from "../../utils/css.js";
7
+ export const useWindowHeightFill = _ref => {
8
+ var _window2, _document2;
9
+ let {
10
+ bottomGap = 'none',
11
+ includeMobile = false,
12
+ serverVhFallback = 100,
13
+ containerRef
14
+ } = _ref;
15
+ const cappedHeight = useResponsiveValue([includeMobile,, true]);
16
+ const {
17
+ themeClass
18
+ } = useTheme();
19
+ const [containerHeight, setContainerHeight] = useState("".concat(serverVhFallback, "vh"));
20
+ useLayoutEffect(() => {
21
+ var _window, _document;
22
+ if (!(containerRef !== null && containerRef !== void 0 && containerRef.current) || !((_window = window) !== null && _window !== void 0 && _window.innerHeight) || !((_document = document) !== null && _document !== void 0 && _document.body)) return void 0;
23
+ const resize = () => {
24
+ const gap = getThemeTokenValue(themeClass, themeContractVars.space[bottomGap]) || '0px';
25
+ const availableHeight = window.innerHeight - containerRef.current.getBoundingClientRect().top;
26
+ setContainerHeight(gap ? "calc(".concat(availableHeight, "px - ").concat(gap, ")") : "".concat(availableHeight, "px"));
27
+ };
28
+ const resizeObserver = new ResizeObserver(resize);
29
+ resizeObserver.observe(document.body);
30
+ window.removeEventListener('resize', resize);
31
+ window.addEventListener('resize', resize, {
32
+ passive: true
33
+ });
34
+ resize();
35
+ return () => {
36
+ window.removeEventListener('resize', resize);
37
+ resizeObserver.disconnect();
38
+ };
39
+ }, [containerRef === null || containerRef === void 0 ? void 0 : containerRef.current, (_window2 = window) === null || _window2 === void 0 ? void 0 : _window2.innerHeight, (_document2 = document) === null || _document2 === void 0 ? void 0 : _document2.body, themeClass, bottomGap]);
40
+ return cappedHeight ? containerHeight : 'auto';
41
+ };
42
+ export default useWindowHeightFill;
@@ -1,3 +1,3 @@
1
1
  export declare const cssVarUnwrap: (value: string) => string;
2
- export declare const getThemeTokenValue: (themeClass: string, token: string) => string | null;
2
+ export declare const getThemeTokenValue: (themeClass?: string | null, token?: string | null) => string;
3
3
  //# sourceMappingURL=css.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../../lib/utils/css.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,UAAW,MAAM,WAIzC,CAAC;AAEF,eAAO,MAAM,kBAAkB,eAClB,MAAM,SACX,MAAM,KACX,MAAM,GAAG,IAOX,CAAC"}
1
+ {"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../../lib/utils/css.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,UAAW,MAAM,WAIzC,CAAC;AAEF,eAAO,MAAM,kBAAkB,gBACjB,MAAM,GAAG,IAAI,UAClB,MAAM,GAAG,IAAI,KACnB,MAQF,CAAC"}
package/dist/utils/css.js CHANGED
@@ -7,8 +7,9 @@ export const cssVarUnwrap = value => {
7
7
  };
8
8
  export const getThemeTokenValue = (themeClass, token) => {
9
9
  var _getComputedStyle$get;
10
+ if (!themeClass || !token) return '';
10
11
  const cssVar = cssVarUnwrap(token);
11
12
  const themedElement = document.querySelector(".".concat(themeClass));
12
- if (!themedElement || !cssVar) return null;
13
- return ((_getComputedStyle$get = getComputedStyle(themedElement).getPropertyValue(cssVar)) === null || _getComputedStyle$get === void 0 ? void 0 : _getComputedStyle$get.trim()) || null;
13
+ if (!themedElement || !cssVar) return '';
14
+ return ((_getComputedStyle$get = getComputedStyle(themedElement).getPropertyValue(cssVar)) === null || _getComputedStyle$get === void 0 ? void 0 : _getComputedStyle$get.trim()) || '';
14
15
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autoguru/overdrive",
3
- "version": "4.14.7",
3
+ "version": "4.15.0",
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",