@autoguru/overdrive 4.43.0-next.2 → 4.43.0-next.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.
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Box.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Box.test.d.ts","sourceRoot":"","sources":["../../../lib/components/Box/Box.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+
3
+ import { composeStories } from '@storybook/react';
4
+ import { render, screen } from '@testing-library/react';
5
+ import React from 'react';
6
+ import { Box } from "./Box.js";
7
+ import * as stories from "./Box.stories.js";
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ const {
10
+ ComponentAsProp,
11
+ DataAttributes,
12
+ ResponsiveProps,
13
+ Standard
14
+ } = composeStories(stories);
15
+ describe('Box', async () => {
16
+ await it('renders the standard Box story', async () => {
17
+ await Standard.run();
18
+ const text = Standard.args.children;
19
+ const boxElement = screen.getByText(text);
20
+ expect(boxElement.tagName).toBe('DIV');
21
+ });
22
+ await it('renders the Box story with responsive props', async () => {
23
+ await ResponsiveProps.run();
24
+ const boxElement = screen.getByText('Resize the viewport');
25
+ expect(boxElement.className).toMatchSnapshot();
26
+ });
27
+ await it('merges custom className with component styles', () => {
28
+ render(_jsx(Box, {
29
+ padding: "3",
30
+ className: "my-custom-class another-class",
31
+ children: "Custom Class Box"
32
+ }));
33
+ const boxElement = screen.getByText('Custom Class Box');
34
+ expect(boxElement.className).toContain('my-custom-class');
35
+ expect(boxElement.className).toContain('another-class');
36
+ expect(boxElement).not.toHaveAttribute('padding');
37
+ expect(boxElement.className).toMatchSnapshot();
38
+ });
39
+ await it('renders as a button element', () => {
40
+ render(_jsx(Box, {
41
+ as: "button",
42
+ children: "Button Box"
43
+ }));
44
+ const buttonElement = screen.getByRole('button', {
45
+ name: 'Button Box'
46
+ });
47
+ expect(buttonElement.tagName).toBe('BUTTON');
48
+ });
49
+ await it('renders using a React element passed to "as" prop', async () => {
50
+ await ComponentAsProp.run();
51
+ const boxElement = screen.getByText('Styled props merged with custom component');
52
+ expect(boxElement.tagName).toBe('A');
53
+ expect(boxElement).toHaveAttribute('href', '#hello');
54
+ expect(boxElement.className).toContain('keep-my-custom-class-name');
55
+ expect(boxElement).not.toHaveAttribute('backgroundColor');
56
+ expect(boxElement).not.toHaveAttribute('borderColor');
57
+ expect(boxElement).not.toHaveAttribute('borderWidth');
58
+ expect(boxElement).not.toHaveAttribute('p');
59
+ });
60
+ await it('renders as an anchor tag with href', () => {
61
+ render(_jsx(Box, {
62
+ as: "a",
63
+ href: "/test-link",
64
+ children: "Anchor Box"
65
+ }));
66
+ const anchorElement = screen.getByRole('link', {
67
+ name: 'Anchor Box'
68
+ });
69
+ expect(anchorElement.tagName).toBe('A');
70
+ expect(anchorElement).toHaveAttribute('href', '/test-link');
71
+ });
72
+ await it('renders with odComponent and testId props', async () => {
73
+ await DataAttributes.run();
74
+ const boxElement = screen.getByText('The most basic box (or is it?)');
75
+ expect(boxElement).toHaveAttribute('data-od-component', 'box-basic');
76
+ expect(boxElement).toHaveAttribute('data-test-id', 'so-basic');
77
+ expect(boxElement).toHaveAttribute('data-custom-attribute', 'somewhat less basic');
78
+ });
79
+ await it('applies basic style props (padding)', () => {
80
+ render(_jsx(Box, {
81
+ padding: "4",
82
+ children: "Padded Box"
83
+ }));
84
+ const boxElement = screen.getByText('Padded Box');
85
+ expect(boxElement.className).toMatchSnapshot();
86
+ });
87
+ await it('applies responsive style props for padding', () => {
88
+ render(_jsx(Box, {
89
+ padding: ['2', '4', '6'],
90
+ children: "Responsive Padded Box"
91
+ }));
92
+ const boxElement = screen.getByText('Responsive Padded Box');
93
+ expect(boxElement.className).toMatchSnapshot();
94
+ });
95
+ await it('applies colour and backgroundColour props', () => {
96
+ render(_jsx(Box, {
97
+ color: "onSurface",
98
+ backgroundColor: "danger",
99
+ children: "Coloured Box"
100
+ }));
101
+ const boxElement = screen.getByText('Coloured Box');
102
+ expect(boxElement.className).toMatchSnapshot();
103
+ });
104
+ await it('applies border props correctly', () => {
105
+ render(_jsx(Box, {
106
+ borderColor: "warning",
107
+ borderWidth: "2",
108
+ children: "Bordered Box"
109
+ }));
110
+ const boxElement = screen.getByText('Bordered Box');
111
+ expect(boxElement.className).toMatchSnapshot();
112
+ });
113
+ });
@@ -1 +1 @@
1
- {"version":3,"file":"boxStyles.d.ts","sourceRoot":"","sources":["../../../lib/components/Box/boxStyles.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAUzC,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAE9D,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,WAAW,GAAG,KAAK,IAAI,UAAU,CAAC,CAAC,CAAC,GACxE,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,GAC9B,UAAU,CAAC;AA4BZ,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,WAAW,GAAG,KAAK,EAAE,6BAItD,cAAc,CAAC,CAAC,CAAC,WA2BnB,CAAC"}
1
+ {"version":3,"file":"boxStyles.d.ts","sourceRoot":"","sources":["../../../lib/components/Box/boxStyles.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAUzC,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAE9D,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,WAAW,GAAG,KAAK,IAAI,UAAU,CAAC,CAAC,CAAC,GACxE,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,GAC9B,UAAU,CAAC;AA4BZ,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,WAAW,GAAG,KAAK,EAAE,6BAItD,cAAc,CAAC,CAAC,CAAC,WA4BnB,CAAC"}
@@ -5,7 +5,7 @@ const _excluded = ["as", "className"];
5
5
  import clsx from 'clsx';
6
6
  import { element } from "../../reset/reset.css.js";
7
7
  import { sprinkles, sprinklesLegacyColours, sprinklesResponsive } from "../../styles/sprinkles.css.js";
8
- import { filterSprinklesProps } from "../../utils/sprinkles.js";
8
+ import { filterPropsWithStyles } from "../../utils/sprinkles.js";
9
9
  const borderColorProps = ['borderColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor'];
10
10
  const borderStyleProps = ['borderStyle', 'borderBottomStyle', 'borderLeftStyle', 'borderRightStyle', 'borderTopStyle'];
11
11
  const borderWidthProps = ['borderWidth', 'borderBottomWidth', 'borderLeftWidth', 'borderRightWidth', 'borderTopWidth'];
@@ -24,7 +24,7 @@ export const boxStyles = _ref => {
24
24
  sprinklesProps,
25
25
  sprinklesResponsiveProps,
26
26
  sprinklesLegacyColourProps
27
- } = filterSprinklesProps(props);
27
+ } = filterPropsWithStyles(props);
28
28
  if (hasBorderColorOrWidth && !hasBorderStyle) {
29
29
  sprinklesProps['borderStyle'] = 'solid';
30
30
  }
@@ -30,11 +30,11 @@ export const useBox = _ref => {
30
30
  const className = useDeepCompareMemo(() => boxStyles(_objectSpread({
31
31
  as,
32
32
  className: _className
33
- }, props)), [_className, props]);
33
+ }, props)), [as, _className, props]);
34
34
  const remainingProps = useDeepCompareMemo(() => _objectSpread(_objectSpread({}, filterNonSprinklesProps(props)), dataAttrs({
35
35
  [OD_COMPONENT_ATTR]: odComponent === null || odComponent === void 0 ? void 0 : odComponent.toLocaleLowerCase(),
36
36
  testId
37
- })), [props]);
37
+ })), [odComponent, props, testId]);
38
38
  const componentProps = _objectSpread(_objectSpread({}, remainingProps), {}, {
39
39
  className
40
40
  });
@@ -11,20 +11,6 @@ export declare const sprinklesColumnWidthResponsive: ((props: {
11
11
  };
12
12
  export type SprinklesColumnWidthResponsive = Parameters<typeof sprinklesColumnWidthResponsive>[0];
13
13
  export declare const columnStyle: import("@vanilla-extract/recipes").RuntimeFn<{
14
- alignSelf: {
15
- stretch: {
16
- alignSelf: "stretch";
17
- };
18
- top: {
19
- alignSelf: "flex-start";
20
- };
21
- center: {
22
- alignSelf: "center";
23
- };
24
- bottom: {
25
- alignSelf: "flex-end";
26
- };
27
- };
28
14
  grow: {
29
15
  true: {
30
16
  flexGrow: number;
@@ -1 +1 @@
1
- {"version":3,"file":"Column.css.d.ts","sourceRoot":"","sources":["../../../lib/components/Columns/Column.css.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AA8BvE,eAAO,MAAM,8BAA8B;;;;;;;;;CAE1C,CAAC;AACF,MAAM,MAAM,8BAA8B,GAAG,UAAU,CACtD,OAAO,8BAA8B,CACrC,CAAC,CAAC,CAAC,CAAC;AAEL,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsBtB,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,WAAW,CAC7C,cAAc,CAAC,OAAO,WAAW,CAAC,CAClC,CAAC"}
1
+ {"version":3,"file":"Column.css.d.ts","sourceRoot":"","sources":["../../../lib/components/Columns/Column.css.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AA8BvE,eAAO,MAAM,8BAA8B;;;;;;;;;CAE1C,CAAC;AACF,MAAM,MAAM,8BAA8B,GAAG,UAAU,CACtD,OAAO,8BAA8B,CACrC,CAAC,CAAC,CAAC,CAAC;AAEL,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;EAgBtB,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,WAAW,CAC7C,cAAc,CAAC,OAAO,WAAW,CAAC,CAClC,CAAC"}
@@ -32,20 +32,6 @@ export const sprinklesColumnWidthResponsive = createSprinkles(columnWidthRespons
32
32
  export const columnStyle = recipe({
33
33
  base: {},
34
34
  variants: {
35
- alignSelf: {
36
- stretch: {
37
- alignSelf: 'stretch'
38
- },
39
- top: {
40
- alignSelf: 'flex-start'
41
- },
42
- center: {
43
- alignSelf: 'center'
44
- },
45
- bottom: {
46
- alignSelf: 'flex-end'
47
- }
48
- },
49
35
  grow: {
50
36
  true: {
51
37
  flexGrow: 1
@@ -1,12 +1,11 @@
1
1
  import React, { type ElementType } from 'react';
2
- import { type StyleProps, type UseBoxProps } from '../Box';
2
+ import { type UseBoxProps } from '../Box';
3
3
  import * as styles from './Column.css';
4
4
  export interface ColumnProps extends styles.ColumnRecipeVariants {
5
- order?: StyleProps['order'];
6
5
  width?: styles.SprinklesColumnWidthResponsive['flexBasis'];
7
6
  }
8
7
  export declare const Column: {
9
- <E extends ElementType>({ alignSelf, children, grow, noShrink, order, ref, width, ...boxProps }: UseBoxProps<E> & ColumnProps): React.JSX.Element;
8
+ <E extends ElementType>({ children, grow, noShrink, order, ref, width, ...boxProps }: UseBoxProps<E> & ColumnProps): React.JSX.Element;
10
9
  displayName: string;
11
10
  };
12
11
  //# sourceMappingURL=Column.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Column.d.ts","sourceRoot":"","sources":["../../../lib/components/Columns/Column.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAgB,KAAK,WAAW,EAAc,MAAM,OAAO,CAAC;AAE1E,OAAO,EAAO,KAAK,UAAU,EAAU,KAAK,WAAW,EAAE,MAAM,QAAQ,CAAC;AAExE,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AAGvC,MAAM,WAAW,WAAY,SAAQ,MAAM,CAAC,oBAAoB;IAC/D,KAAK,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC,8BAA8B,CAAC,WAAW,CAAC,CAAC;CAC3D;AAQD,eAAO,MAAM,MAAM;KAAI,CAAC,SAAS,WAAW,2EASzC,WAAW,CAAC,CAAC,CAAC,GAAG,WAAW;;CA4C9B,CAAC"}
1
+ {"version":3,"file":"Column.d.ts","sourceRoot":"","sources":["../../../lib/components/Columns/Column.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAgB,KAAK,WAAW,EAAc,MAAM,OAAO,CAAC;AAE1E,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,QAAQ,CAAC;AAEvD,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AAGvC,MAAM,WAAW,WAAY,SAAQ,MAAM,CAAC,oBAAoB;IAC/D,KAAK,CAAC,EAAE,MAAM,CAAC,8BAA8B,CAAC,WAAW,CAAC,CAAC;CAC3D;AAQD,eAAO,MAAM,MAAM;KAAI,CAAC,SAAS,WAAW,gEAQzC,WAAW,CAAC,CAAC,CAAC,GAAG,WAAW;;CA2C9B,CAAC"}
@@ -2,7 +2,7 @@
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 = ["alignSelf", "children", "grow", "noShrink", "order", "ref", "width"];
5
+ const _excluded = ["children", "grow", "noShrink", "order", "ref", "width"];
6
6
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
7
7
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
8
8
  import { invariant } from '@autoguru/utilities';
@@ -13,7 +13,6 @@ import { ColumnContext } from "./Columns.js";
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
14
  export const Column = _ref => {
15
15
  let {
16
- alignSelf,
17
16
  children,
18
17
  grow = false,
19
18
  noShrink = false,
@@ -52,7 +51,6 @@ export const Column = _ref => {
52
51
  className: [spaceXCls, spaceYCls, styles.sprinklesColumnWidthResponsive({
53
52
  flexBasis: width
54
53
  }), styles.columnStyle({
55
- alignSelf,
56
54
  grow,
57
55
  noShrink
58
56
  })],
@@ -95,12 +95,12 @@ declare const _default: {
95
95
  desktop?: "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "full" | "auto" | "fit-content" | "max-content" | "min-content" | undefined;
96
96
  largeDesktop?: "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "full" | "auto" | "fit-content" | "max-content" | "min-content" | undefined;
97
97
  } | undefined);
98
- maxWidth?: ("fit-content" | "max-content" | {
99
- mobile?: "fit-content" | "max-content" | undefined;
100
- tablet?: "fit-content" | "max-content" | undefined;
101
- desktop?: "fit-content" | "max-content" | undefined;
102
- largeDesktop?: "fit-content" | "max-content" | undefined;
103
- } | undefined) | import("@vanilla-extract/sprinkles").ResponsiveArray<1 | 2 | 3 | 4, "fit-content" | "max-content" | null>;
98
+ maxWidth?: ("small" | "medium" | "large" | "fit-content" | "max-content" | {
99
+ mobile?: "small" | "medium" | "large" | "fit-content" | "max-content" | undefined;
100
+ tablet?: "small" | "medium" | "large" | "fit-content" | "max-content" | undefined;
101
+ desktop?: "small" | "medium" | "large" | "fit-content" | "max-content" | undefined;
102
+ largeDesktop?: "small" | "medium" | "large" | "fit-content" | "max-content" | undefined;
103
+ } | undefined) | import("@vanilla-extract/sprinkles").ResponsiveArray<1 | 2 | 3 | 4, "small" | "medium" | "large" | "fit-content" | "max-content" | null>;
104
104
  minWidth?: ("auto" | "fit-content" | {
105
105
  mobile?: "auto" | "fit-content" | undefined;
106
106
  tablet?: "auto" | "fit-content" | undefined;
@@ -1,8 +1,8 @@
1
1
  import { type FunctionComponent } from 'react';
2
+ import { SprinklesResponsive } from '../../styles/sprinkles.css';
2
3
  import { type UseBoxProps } from '../Box';
3
- import * as styles from './Section.css';
4
4
  export interface SectionProps {
5
- width?: keyof typeof styles.width;
5
+ width?: SprinklesResponsive['maxWidth'];
6
6
  }
7
7
  export declare const Section: FunctionComponent<UseBoxProps & SectionProps>;
8
8
  //# sourceMappingURL=Section.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Section.d.ts","sourceRoot":"","sources":["../../../lib/components/Section/Section.tsx"],"names":[],"mappings":"AACA,OAAc,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,QAAQ,CAAC;AAElD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,MAAM,WAAW,YAAY;IAC5B,KAAK,CAAC,EAAE,MAAM,OAAO,MAAM,CAAC,KAAK,CAAC;CAClC;AAED,eAAO,MAAM,OAAO,EAAE,iBAAiB,CAAC,WAAW,GAAG,YAAY,CAYjE,CAAC"}
1
+ {"version":3,"file":"Section.d.ts","sourceRoot":"","sources":["../../../lib/components/Section/Section.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAgB,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,QAAQ,CAAC;AAIlD,MAAM,WAAW,YAAY;IAC5B,KAAK,CAAC,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC;CACxC;AAED,eAAO,MAAM,OAAO,EAAE,iBAAiB,CAAC,WAAW,GAAG,YAAY,CAiBjE,CAAC"}
@@ -5,24 +5,29 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
5
5
  const _excluded = ["children", "width"];
6
6
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
7
7
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
8
- import clsx from 'clsx';
9
- import React from 'react';
8
+ import React, { cloneElement } from 'react';
10
9
  import { useBox } from "../Box/index.js";
11
10
  import * as styles from "./Section.css.js";
12
11
  import { jsx as _jsx } from "react/jsx-runtime";
13
12
  export const Section = _ref => {
14
13
  let {
15
14
  children,
16
- width = 'medium'
15
+ width: maxWidth = 'medium'
17
16
  } = _ref,
18
17
  props = _objectWithoutProperties(_ref, _excluded);
19
18
  const {
20
- Component
19
+ Component,
20
+ componentProps,
21
+ reactElement
21
22
  } = useBox(_objectSpread({
23
+ className: styles.root,
24
+ maxWidth: maxWidth,
22
25
  width: 'full'
23
26
  }, props));
24
- return _jsx(Component, {
25
- className: clsx(styles.root, styles.width[width]),
27
+ if (reactElement) {
28
+ return cloneElement(reactElement, componentProps, children);
29
+ }
30
+ return _jsx(Component, _objectSpread(_objectSpread({}, componentProps), {}, {
26
31
  children: children
27
- });
32
+ }));
28
33
  };
@@ -81,12 +81,12 @@ declare const _default: {
81
81
  desktop?: "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "full" | "auto" | "fit-content" | "max-content" | "min-content" | undefined;
82
82
  largeDesktop?: "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "full" | "auto" | "fit-content" | "max-content" | "min-content" | undefined;
83
83
  } | undefined);
84
- maxWidth?: ("fit-content" | "max-content" | {
85
- mobile?: "fit-content" | "max-content" | undefined;
86
- tablet?: "fit-content" | "max-content" | undefined;
87
- desktop?: "fit-content" | "max-content" | undefined;
88
- largeDesktop?: "fit-content" | "max-content" | undefined;
89
- } | undefined) | import("@vanilla-extract/sprinkles").ResponsiveArray<1 | 2 | 3 | 4, "fit-content" | "max-content" | null>;
84
+ maxWidth?: ("small" | "medium" | "large" | "fit-content" | "max-content" | {
85
+ mobile?: "small" | "medium" | "large" | "fit-content" | "max-content" | undefined;
86
+ tablet?: "small" | "medium" | "large" | "fit-content" | "max-content" | undefined;
87
+ desktop?: "small" | "medium" | "large" | "fit-content" | "max-content" | undefined;
88
+ largeDesktop?: "small" | "medium" | "large" | "fit-content" | "max-content" | undefined;
89
+ } | undefined) | import("@vanilla-extract/sprinkles").ResponsiveArray<1 | 2 | 3 | 4, "small" | "medium" | "large" | "fit-content" | "max-content" | null>;
90
90
  minWidth?: ("auto" | "fit-content" | {
91
91
  mobile?: "auto" | "fit-content" | undefined;
92
92
  tablet?: "auto" | "fit-content" | undefined;
@@ -1,6 +1,6 @@
1
1
  import { ArgTypes } from '@storybook/react';
2
2
  import { type ComponentProps } from 'react';
3
- import { Box } from './Box';
3
+ import { Box } from '../../components/Box/Box';
4
4
  export declare const scaleOptions: string[];
5
5
  export declare const boxArgTypes: Partial<ArgTypes<ComponentProps<typeof Box>>>;
6
- //# sourceMappingURL=argTypes.d.ts.map
6
+ //# sourceMappingURL=argTypes-box.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"argTypes-box.d.ts","sourceRoot":"","sources":["../../../lib/stories/shared/argTypes-box.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAI/C,eAAO,MAAM,YAAY,UAA8B,CAAC;AAuBxD,eAAO,MAAM,WAAW,EAAE,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,OAAO,GAAG,CAAC,CAAC,CAoErE,CAAC"}
@@ -110,12 +110,12 @@ export declare const sprinklesResponsive: ((props: {
110
110
  desktop?: "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "full" | "auto" | "fit-content" | "max-content" | "min-content" | undefined;
111
111
  largeDesktop?: "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "full" | "auto" | "fit-content" | "max-content" | "min-content" | undefined;
112
112
  } | undefined);
113
- maxWidth?: ("fit-content" | "max-content" | {
114
- mobile?: "fit-content" | "max-content" | undefined;
115
- tablet?: "fit-content" | "max-content" | undefined;
116
- desktop?: "fit-content" | "max-content" | undefined;
117
- largeDesktop?: "fit-content" | "max-content" | undefined;
118
- } | undefined) | import("@vanilla-extract/sprinkles").ResponsiveArray<1 | 2 | 3 | 4, "fit-content" | "max-content" | null>;
113
+ maxWidth?: ("small" | "medium" | "large" | "fit-content" | "max-content" | {
114
+ mobile?: "small" | "medium" | "large" | "fit-content" | "max-content" | undefined;
115
+ tablet?: "small" | "medium" | "large" | "fit-content" | "max-content" | undefined;
116
+ desktop?: "small" | "medium" | "large" | "fit-content" | "max-content" | undefined;
117
+ largeDesktop?: "small" | "medium" | "large" | "fit-content" | "max-content" | undefined;
118
+ } | undefined) | import("@vanilla-extract/sprinkles").ResponsiveArray<1 | 2 | 3 | 4, "small" | "medium" | "large" | "fit-content" | "max-content" | null>;
119
119
  minWidth?: ("auto" | "fit-content" | {
120
120
  mobile?: "auto" | "fit-content" | undefined;
121
121
  tablet?: "auto" | "fit-content" | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"sprinkles.css.d.ts","sourceRoot":"","sources":["../../lib/styles/sprinkles.css.ts"],"names":[],"mappings":"AAkIA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAkC,CAAC;AACzD,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAuCxD,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;CAA0C,CAAC;AAE9E,MAAM,MAAM,sBAAsB,GAAG,IAAI,CACxC,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC,CAAC,CAAC,EAC1C,iBAAiB,GACjB,aAAa,GACb,mBAAmB,GACnB,iBAAiB,GACjB,kBAAkB,GAClB,gBAAgB,GAChB,OAAO,CACT,CAAC;AAGF,eAAO,MAAM,oBAAoB;;;;;;;;;;;CAOhC,CAAC;AAmHF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAwC,CAAC;AACzE,MAAM,MAAM,mBAAmB,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"sprinkles.css.d.ts","sourceRoot":"","sources":["../../lib/styles/sprinkles.css.ts"],"names":[],"mappings":"AAkIA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAkC,CAAC;AACzD,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AAuCxD,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;CAA0C,CAAC;AAE9E,MAAM,MAAM,sBAAsB,GAAG,IAAI,CACxC,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC,CAAC,CAAC,EAC1C,iBAAiB,GACjB,aAAa,GACb,mBAAmB,GACnB,iBAAiB,GACjB,kBAAkB,GAClB,gBAAgB,GAChB,OAAO,CACT,CAAC;AAGF,eAAO,MAAM,oBAAoB;;;;;;;;;;;CAOhC,CAAC;AAuHF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAwC,CAAC;AACzE,MAAM,MAAM,mBAAmB,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC"}
@@ -158,7 +158,10 @@ const responsiveProperties = defineProperties({
158
158
  full: '100%',
159
159
  auto: 'auto'
160
160
  }),
161
- maxWidth: ['fit-content', 'max-content'],
161
+ maxWidth: _objectSpread(_objectSpread({}, tokens.contentWidth), {}, {
162
+ 'fit-content': 'fit-content',
163
+ 'max-content': 'max-content'
164
+ }),
162
165
  minWidth: ['auto', 'fit-content'],
163
166
  gap: gapSizesWithVar,
164
167
  columnGap: space,
@@ -1,11 +1,18 @@
1
1
  import { type Sprinkles, type SprinklesLegacyColours, type SprinklesResponsive } from '../styles/sprinkles.css';
2
- export declare const isSprinklesProperty: (key: string) => boolean;
3
- export declare const isSprinklesLegacyColourProperty: (key: string) => boolean;
4
- export declare const isSprinklesResponsiveProperty: (key: string) => boolean;
5
- export declare const filterSprinklesProps: <T extends object>(props: T) => {
2
+ type AnySprinklesKey = keyof Sprinkles | keyof SprinklesResponsive | keyof SprinklesLegacyColours;
3
+ type RemainingProps<T extends object> = {
4
+ [K in keyof T as K extends AnySprinklesKey ? never : K]: T[K];
5
+ };
6
+ interface SortedProps<T extends object> {
6
7
  sprinklesProps: Sprinkles;
7
8
  sprinklesResponsiveProps: SprinklesResponsive;
8
9
  sprinklesLegacyColourProps: SprinklesLegacyColours;
9
- };
10
- export declare const filterNonSprinklesProps: <T extends object>(props: T) => { [K in keyof T]: T[K]; };
10
+ otherProps: RemainingProps<T>;
11
+ }
12
+ export declare const isSprinklesProperty: (key: string) => boolean;
13
+ export declare const isSprinklesLegacyColourProperty: (key: string) => boolean;
14
+ export declare const isSprinklesResponsiveProperty: (key: string) => boolean;
15
+ export declare const filterNonSprinklesProps: <P extends object>(props: P) => RemainingProps<P>;
16
+ export declare const filterPropsWithStyles: <P extends object>(props: P) => SortedProps<P>;
17
+ export {};
11
18
  //# sourceMappingURL=sprinkles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sprinkles.d.ts","sourceRoot":"","sources":["../../lib/utils/sprinkles.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,SAAS,EAEd,KAAK,sBAAsB,EAE3B,KAAK,mBAAmB,EACxB,MAAM,yBAAyB,CAAC;AAKjC,eAAO,MAAM,mBAAmB,GAAI,KAAK,MAAM,YAE9C,CAAC;AAKF,eAAO,MAAM,+BAA+B,GAAI,KAAK,MAAM,YAI1D,CAAC;AAKF,eAAO,MAAM,6BAA6B,GAAI,KAAK,MAAM,YAExD,CAAC;AAQF,eAAO,MAAM,oBAAoB,GAAI,CAAC,SAAS,MAAM,EAAE,OAAO,CAAC;oBAatC,SAAS;8BACC,mBAAmB;gCACjB,sBAAsB;CAEzD,CAAC;AAQH,eAAO,MAAM,uBAAuB,GAAI,CAAC,SAAS,MAAM,EAAE,OAAO,CAAC,QAe9D,CAAC,qBAEH,CAAC"}
1
+ {"version":3,"file":"sprinkles.d.ts","sourceRoot":"","sources":["../../lib/utils/sprinkles.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,SAAS,EAEd,KAAK,sBAAsB,EAE3B,KAAK,mBAAmB,EACxB,MAAM,yBAAyB,CAAC;AAEjC,KAAK,eAAe,GACjB,MAAM,SAAS,GACf,MAAM,mBAAmB,GACzB,MAAM,sBAAsB,CAAC;AAGhC,KAAK,cAAc,CAAC,CAAC,SAAS,MAAM,IAAI;KACtC,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,eAAe,GAAG,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAC7D,CAAC;AAEF,UAAU,WAAW,CAAC,CAAC,SAAS,MAAM;IACrC,cAAc,EAAE,SAAS,CAAC;IAC1B,wBAAwB,EAAE,mBAAmB,CAAC;IAC9C,0BAA0B,EAAE,sBAAsB,CAAC;IACnD,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;CAC9B;AAKD,eAAO,MAAM,mBAAmB,GAAI,KAAK,MAAM,YAE9C,CAAC;AAKF,eAAO,MAAM,+BAA+B,GAAI,KAAK,MAAM,YAI1D,CAAC;AAKF,eAAO,MAAM,6BAA6B,GAAI,KAAK,MAAM,YAExD,CAAC;AAQF,eAAO,MAAM,uBAAuB,GAAI,CAAC,SAAS,MAAM,EAAE,OAAO,CAAC,sBAYtC,CAAC;AAa7B,eAAO,MAAM,qBAAqB,GAAI,CAAC,SAAS,MAAM,EACrD,OAAO,CAAC,KACN,WAAW,CAAC,CAAC,CAgCf,CAAC"}
@@ -10,25 +10,38 @@ export const isSprinklesLegacyColourProperty = key => {
10
10
  export const isSprinklesResponsiveProperty = key => {
11
11
  return sprinklesResponsive.properties.has(key);
12
12
  };
13
- export const filterSprinklesProps = props => Object.entries(props).reduce((acc, _ref) => {
13
+ export const filterNonSprinklesProps = props => Object.entries(props).reduce((acc, _ref) => {
14
14
  let [key, value] = _ref;
15
- if (isSprinklesProperty(key)) {
16
- acc.sprinklesProps[key] = value;
17
- } else if (isSprinklesResponsiveProperty(key)) {
18
- acc.sprinklesResponsiveProps[key] = value;
19
- } else if (isSprinklesLegacyColourProperty(key)) {
20
- acc.sprinklesLegacyColourProps[key] = value;
21
- }
22
- return acc;
23
- }, {
24
- sprinklesProps: {},
25
- sprinklesResponsiveProps: {},
26
- sprinklesLegacyColourProps: {}
27
- });
28
- export const filterNonSprinklesProps = props => Object.entries(props).reduce((acc, _ref2) => {
29
- let [key, value] = _ref2;
30
15
  if (!(isSprinklesProperty(key) || isSprinklesResponsiveProperty(key) || isSprinklesLegacyColourProperty(key))) {
31
16
  acc[key] = value;
32
17
  }
33
18
  return acc;
34
- }, {});
19
+ }, {});
20
+ export const filterPropsWithStyles = props => {
21
+ const acc = {
22
+ sprinklesProps: {},
23
+ sprinklesResponsiveProps: {},
24
+ sprinklesLegacyColourProps: {},
25
+ otherProps: {}
26
+ };
27
+ for (const key in props) {
28
+ if (Object.prototype.hasOwnProperty.call(props, key)) {
29
+ const value = props[key];
30
+ if (isSprinklesProperty(key)) {
31
+ acc.sprinklesProps[key] = value;
32
+ } else if (isSprinklesResponsiveProperty(key)) {
33
+ acc.sprinklesResponsiveProps[key] = value;
34
+ } else if (isSprinklesLegacyColourProperty(key)) {
35
+ acc.sprinklesLegacyColourProps[key] = value;
36
+ } else {
37
+ acc.otherProps[key] = value;
38
+ }
39
+ }
40
+ }
41
+ return {
42
+ sprinklesProps: acc.sprinklesProps,
43
+ sprinklesResponsiveProps: acc.sprinklesResponsiveProps,
44
+ sprinklesLegacyColourProps: acc.sprinklesLegacyColourProps,
45
+ otherProps: acc.otherProps
46
+ };
47
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autoguru/overdrive",
3
- "version": "4.43.0-next.2",
3
+ "version": "4.43.0-next.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",
@@ -50,8 +50,8 @@
50
50
  "storybook:extract": "npx sb extract",
51
51
  "storybook": "storybook dev -p 6006",
52
52
  "storybook:build": "storybook build",
53
- "test": "vitest --project=specs",
54
- "test:ci": "yarn vitest run --no-cache --coverage --project=specs",
53
+ "test": "vitest --project=unit-tests",
54
+ "test:ci": "yarn vitest run --no-cache --coverage --project=unit-tests",
55
55
  "test:a11y": "vitest run --coverage --project=storybook",
56
56
  "typeEmit": "tsc -d --declarationDir dist --emitDeclarationOnly",
57
57
  "watch": "tsc --watch",
@@ -1 +0,0 @@
1
- {"version":3,"file":"argTypes.d.ts","sourceRoot":"","sources":["../../../lib/components/Box/argTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAK5C,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,eAAO,MAAM,YAAY,UAA8B,CAAC;AAuBxD,eAAO,MAAM,WAAW,EAAE,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,OAAO,GAAG,CAAC,CAAC,CAoErE,CAAC"}
@@ -1,81 +0,0 @@
1
- "use strict";
2
-
3
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
4
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
- import { colourMap as baseColours } from "../../themes/base/colours.js";
7
- import { tokens } from "../../themes/base/tokens.js";
8
- export const scaleOptions = Object.values(tokens.space);
9
- const boxShadowOptions = Object.keys(tokens.elevation);
10
- const borderRadiusOptions = Object.keys(tokens.border.radius);
11
- const scaledProps = ['padding', 'paddingX', 'paddingY', 'paddingTop', 'paddingRight', 'paddingLeft', 'margin', 'marginX', 'marginY', 'marginTop', 'marginRight', 'marginLeft'];
12
- const widthOptions = ['full'];
13
- const orderOptions = [0, 1, 2];
14
- export const boxArgTypes = _objectSpread({
15
- backgroundColour: {
16
- options: Object.keys(baseColours),
17
- control: {
18
- type: 'select'
19
- }
20
- },
21
- boxShadow: {
22
- options: boxShadowOptions,
23
- control: {
24
- type: 'select'
25
- }
26
- },
27
- borderRadius: {
28
- options: borderRadiusOptions,
29
- control: {
30
- type: 'select'
31
- }
32
- },
33
- alignItems: {
34
- options: ['flexStart', 'center', 'flexEnd', 'stretch'],
35
- control: {
36
- type: 'select'
37
- }
38
- },
39
- justifyContent: {
40
- options: ['flexStart', 'center', 'flexEnd', 'spaceBetween'],
41
- control: {
42
- type: 'select'
43
- }
44
- },
45
- flexDirection: {
46
- options: ['row', 'rowReverse', 'column', 'columnReverse'],
47
- control: {
48
- type: 'select'
49
- }
50
- },
51
- flexShrink: {
52
- defaultValue: undefined,
53
- options: ['1']
54
- },
55
- pointerEvents: {
56
- defaultValue: undefined,
57
- options: ['none']
58
- },
59
- width: {
60
- options: widthOptions,
61
- defaultValue: null,
62
- control: {
63
- type: 'select'
64
- }
65
- },
66
- order: {
67
- options: orderOptions,
68
- defaultValue: null,
69
- control: {
70
- type: 'select'
71
- }
72
- }
73
- }, scaledProps.reduce((argTypes, prop) => {
74
- argTypes[prop] = {
75
- options: scaleOptions,
76
- control: {
77
- type: 'select'
78
- }
79
- };
80
- return argTypes;
81
- }, {}));