@autoguru/overdrive 4.43.0-next.0 → 4.43.0-next.1

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/Box/useBox.d.ts +3 -3
  2. package/dist/components/Box/useBox.d.ts.map +1 -1
  3. package/dist/components/Button/Button.stories.d.ts.map +1 -1
  4. package/dist/components/Columns/Column.css.d.ts +44 -0
  5. package/dist/components/Columns/Column.css.d.ts.map +1 -0
  6. package/dist/components/Columns/Column.css.js +69 -0
  7. package/dist/components/Columns/Column.d.ts +6 -8
  8. package/dist/components/Columns/Column.d.ts.map +1 -1
  9. package/dist/components/Columns/Column.js +28 -9
  10. package/dist/components/Columns/ColumnGrid.css.d.ts +35 -0
  11. package/dist/components/Columns/ColumnGrid.css.d.ts.map +1 -0
  12. package/dist/components/Columns/ColumnGrid.css.js +71 -0
  13. package/dist/components/Columns/Columns.css.d.ts +28 -10
  14. package/dist/components/Columns/Columns.css.d.ts.map +1 -1
  15. package/dist/components/Columns/Columns.css.js +31 -34
  16. package/dist/components/Columns/Columns.d.ts +20 -13
  17. package/dist/components/Columns/Columns.d.ts.map +1 -1
  18. package/dist/components/Columns/Columns.js +35 -19
  19. package/dist/components/Columns/Columns.stories.d.ts.map +1 -1
  20. package/dist/components/DropDown/DropDown.stories.d.ts +1 -1
  21. package/dist/components/HorizontalAutoScroller/HorizontalAutoScroller.css.d.ts +2 -2
  22. package/dist/components/Inline/Inline.d.ts +1 -1
  23. package/dist/components/Inline/Inline.d.ts.map +1 -1
  24. package/dist/components/Inline/Inline.js +6 -7
  25. package/dist/components/LoadingBox/LoadingBox.stories.d.ts +57 -75
  26. package/dist/components/LoadingBox/LoadingBox.stories.d.ts.map +1 -1
  27. package/dist/components/Stack/Stack.d.ts +1 -1
  28. package/dist/components/Stack/Stack.d.ts.map +1 -1
  29. package/dist/components/Stack/Stack.js +4 -6
  30. package/dist/components/TextLink/TextLink.stories.d.ts +6 -6
  31. package/dist/hooks/useNegativeMargin/useNegativeMarginLeft.d.ts +0 -1
  32. package/dist/hooks/useNegativeMargin/useNegativeMarginLeft.d.ts.map +1 -1
  33. package/dist/hooks/useNegativeMargin/useNegativeMarginLeft.js +1 -2
  34. package/dist/hooks/useNegativeMargin/useNegativeMarginTop.d.ts +0 -1
  35. package/dist/hooks/useNegativeMargin/useNegativeMarginTop.d.ts.map +1 -1
  36. package/dist/hooks/useNegativeMargin/useNegativeMarginTop.js +1 -2
  37. package/dist/styles/sprinkles.css.d.ts +57 -76
  38. package/dist/styles/sprinkles.css.d.ts.map +1 -1
  39. package/dist/styles/sprinkles.css.js +1 -23
  40. package/package.json +2 -2
@@ -1,5 +1,5 @@
1
1
  import type { ClassValue as ClassName } from 'clsx';
2
- import type { ComponentPropsWithRef, ElementType, JSX, PropsWithChildren } from 'react';
2
+ import type { ComponentPropsWithRef, ElementType, PropsWithChildren } from 'react';
3
3
  import type { Sprinkles, SprinklesResponsive, SprinklesLegacyColours } from '../../styles/sprinkles.css';
4
4
  export interface BoxBasedProps<E extends ElementType> extends PropsWithChildren {
5
5
  as?: E;
@@ -11,12 +11,12 @@ export type PolymorphicBoxProps<E extends ElementType, Props = object> = BoxBase
11
11
  export type UseBoxProps<E extends ElementType = 'div'> = PolymorphicBoxProps<E, StyleProps>;
12
12
  export type ComponentProps<E extends ElementType> = Omit<ComponentPropsWithRef<E>, 'as'>;
13
13
  export declare const useBox: <E extends ElementType = "div">({ as, className, odComponent, testId, ...props }: UseBoxProps<E>) => {
14
- Component: keyof JSX.IntrinsicElements | E;
14
+ Component: ElementType;
15
15
  componentProps: {
16
16
  className: string;
17
17
  } & (Omit<UseBoxProps<E>, "className" | "as" | "odComponent" | "testId"> extends infer T extends object ? { [K in keyof T]: Omit<UseBoxProps<E>, "className" | "as" | "odComponent" | "testId">[K]; } : never) & {
18
18
  [key: string]: string;
19
19
  };
20
- SemanticChild: keyof JSX.IntrinsicElements | undefined;
20
+ SemanticChild: ElementType | undefined;
21
21
  };
22
22
  //# sourceMappingURL=useBox.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useBox.d.ts","sourceRoot":"","sources":["../../../lib/components/Box/useBox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AACpD,OAAO,KAAK,EACX,qBAAqB,EACrB,WAAW,EACX,GAAG,EACH,iBAAiB,EACjB,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EACX,SAAS,EACT,mBAAmB,EACnB,sBAAsB,EACtB,MAAM,4BAA4B,CAAC;AAUpC,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,WAAW,CACnD,SAAQ,iBAAiB;IAKzB,EAAE,CAAC,EAAE,CAAC,CAAC;IAIP,SAAS,CAAC,EAAE,SAAS,CAAC;IAItB,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAGD,MAAM,MAAM,UAAU,GAAG,SAAS,GACjC,mBAAmB,GACnB,sBAAsB,CAAC;AAGxB,MAAM,MAAM,mBAAmB,CAC9B,CAAC,SAAS,WAAW,EACrB,KAAK,GAAG,MAAM,IACX,aAAa,CAAC,CAAC,CAAC,GACnB,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,MAAM,KAAK,GAAG,IAAI,GAAG,WAAW,CAAC,GAChE,KAAK,CAAC;AAGP,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,WAAW,GAAG,KAAK,IAAI,mBAAmB,CAC3E,CAAC,EACD,UAAU,CACV,CAAC;AAGF,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,WAAW,IAAI,IAAI,CACvD,qBAAqB,CAAC,CAAC,CAAC,EACxB,IAAI,CACJ,CAAC;AAcF,eAAO,MAAM,MAAM,GAAI,CAAC,SAAS,WAAW,GAAG,KAAK,EAAE,kDAMnD,WAAW,CAAC,CAAC,CAAC;;;;;;;;CAoChB,CAAC"}
1
+ {"version":3,"file":"useBox.d.ts","sourceRoot":"","sources":["../../../lib/components/Box/useBox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AACpD,OAAO,KAAK,EACX,qBAAqB,EACrB,WAAW,EAEX,iBAAiB,EACjB,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EACX,SAAS,EACT,mBAAmB,EACnB,sBAAsB,EACtB,MAAM,4BAA4B,CAAC;AAUpC,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,WAAW,CACnD,SAAQ,iBAAiB;IAKzB,EAAE,CAAC,EAAE,CAAC,CAAC;IAIP,SAAS,CAAC,EAAE,SAAS,CAAC;IAItB,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAGD,MAAM,MAAM,UAAU,GAAG,SAAS,GACjC,mBAAmB,GACnB,sBAAsB,CAAC;AAGxB,MAAM,MAAM,mBAAmB,CAC9B,CAAC,SAAS,WAAW,EACrB,KAAK,GAAG,MAAM,IACX,aAAa,CAAC,CAAC,CAAC,GACnB,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,MAAM,KAAK,GAAG,IAAI,GAAG,WAAW,CAAC,GAChE,KAAK,CAAC;AAGP,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,WAAW,GAAG,KAAK,IAAI,mBAAmB,CAC3E,CAAC,EACD,UAAU,CACV,CAAC;AAGF,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,WAAW,IAAI,IAAI,CACvD,qBAAqB,CAAC,CAAC,CAAC,EACxB,IAAI,CACJ,CAAC;AAcF,eAAO,MAAM,MAAM,GAAI,CAAC,SAAS,WAAW,GAAG,KAAK,EAAE,kDAMnD,WAAW,CAAC,CAAC,CAAC;;;;;;;;CAoChB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Button.stories.d.ts","sourceRoot":"","sources":["../../../lib/components/Button/Button.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,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44 @@
1
+ import { type RecipeVariants } from '@vanilla-extract/recipes';
2
+ export declare const sprinklesColumnWidthResponsive: ((props: {
3
+ flexBasis?: ("full" | "auto" | "1/2" | "1/3" | "2/3" | "1/4" | "3/4" | "1/5" | "2/5" | "3/5" | "4/5" | {
4
+ mobile?: "full" | "auto" | "1/2" | "1/3" | "2/3" | "1/4" | "3/4" | "1/5" | "2/5" | "3/5" | "4/5" | undefined;
5
+ tablet?: "full" | "auto" | "1/2" | "1/3" | "2/3" | "1/4" | "3/4" | "1/5" | "2/5" | "3/5" | "4/5" | undefined;
6
+ desktop?: "full" | "auto" | "1/2" | "1/3" | "2/3" | "1/4" | "3/4" | "1/5" | "2/5" | "3/5" | "4/5" | undefined;
7
+ largeDesktop?: "full" | "auto" | "1/2" | "1/3" | "2/3" | "1/4" | "3/4" | "1/5" | "2/5" | "3/5" | "4/5" | undefined;
8
+ } | undefined) | import("@vanilla-extract/sprinkles").ResponsiveArray<1 | 2 | 3 | 4, "full" | "auto" | "1/2" | "1/3" | "2/3" | "1/4" | "3/4" | "1/5" | "2/5" | "3/5" | "4/5" | null>;
9
+ }) => string) & {
10
+ properties: Set<"flexBasis">;
11
+ };
12
+ export type SprinklesColumnWidthResponsive = Parameters<typeof sprinklesColumnWidthResponsive>[0];
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
+ grow: {
29
+ true: {
30
+ flexGrow: number;
31
+ };
32
+ false: {
33
+ flexGrow: number;
34
+ };
35
+ };
36
+ noShrink: {
37
+ true: {
38
+ flexShrink: number;
39
+ };
40
+ false: {};
41
+ };
42
+ }>;
43
+ export type ColumnRecipeVariants = NonNullable<RecipeVariants<typeof columnStyle>>;
44
+ //# sourceMappingURL=Column.css.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+
3
+ import * as __vanilla_filescope__ from '@vanilla-extract/css/fileScope';
4
+ __vanilla_filescope__.setFileScope("lib/components/Columns/Column.css.ts", "@autoguru/overdrive");
5
+ import { recipe } from '@vanilla-extract/recipes';
6
+ import { createSprinkles, defineProperties } from '@vanilla-extract/sprinkles';
7
+ import { cssLayerComponent } from "../../styles/layers.css.js";
8
+ import { responsiveConditions } from "../../styles/sprinkles.css.js";
9
+ const getSizeStyle = scale => `${scale * 100}%`;
10
+ const columnWidthResponsive = defineProperties({
11
+ '@layer': cssLayerComponent,
12
+ conditions: responsiveConditions,
13
+ defaultCondition: 'mobile',
14
+ responsiveArray: ['mobile', 'tablet', 'desktop', 'largeDesktop'],
15
+ properties: {
16
+ flexBasis: {
17
+ '1/2': getSizeStyle(1 / 2),
18
+ '1/3': getSizeStyle(1 / 3),
19
+ '2/3': getSizeStyle(2 / 3),
20
+ '1/4': getSizeStyle(1 / 4),
21
+ '3/4': getSizeStyle(3 / 4),
22
+ '1/5': getSizeStyle(1 / 5),
23
+ '2/5': getSizeStyle(2 / 5),
24
+ '3/5': getSizeStyle(3 / 5),
25
+ '4/5': getSizeStyle(4 / 5),
26
+ full: getSizeStyle(1),
27
+ auto: 'auto'
28
+ }
29
+ }
30
+ });
31
+ export const sprinklesColumnWidthResponsive = createSprinkles(columnWidthResponsive);
32
+ export const columnStyle = recipe({
33
+ base: {},
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
+ grow: {
50
+ true: {
51
+ flexGrow: 1
52
+ },
53
+ false: {
54
+ flexGrow: 0
55
+ }
56
+ },
57
+ noShrink: {
58
+ true: {
59
+ flexShrink: 0
60
+ },
61
+ false: {}
62
+ }
63
+ },
64
+ defaultVariants: {
65
+ grow: false,
66
+ noShrink: false
67
+ }
68
+ }, "columnStyle");
69
+ __vanilla_filescope__.endFileScope();
@@ -1,15 +1,13 @@
1
1
  import React, { type ElementType, type Ref } from 'react';
2
- import { type SprinklesResponsive } from '../../styles/sprinkles.css';
3
- import { type BoxBasedProps } from '../Box';
4
- export interface ColumnProps<E extends ElementType> extends BoxBasedProps<E> {
5
- alignSelf?: SprinklesResponsive['alignSelf'];
6
- justifyContent?: SprinklesResponsive['justifyContent'];
7
- order?: SprinklesResponsive['order'];
2
+ import { type BoxBasedProps, type StyleProps } from '../Box';
3
+ import * as styles from './Column.css';
4
+ export interface ColumnProps<E extends ElementType> extends BoxBasedProps<E>, styles.ColumnRecipeVariants {
5
+ order?: StyleProps['order'];
8
6
  ref?: Ref<E>;
9
- width?: SprinklesResponsive['gridColumn'];
7
+ width?: styles.SprinklesColumnWidthResponsive['flexBasis'];
10
8
  }
11
9
  export declare const Column: {
12
- <E extends ElementType>({ alignSelf, children, justifyContent, order, width, ...props }: ColumnProps<E>): React.JSX.Element;
10
+ <E extends ElementType>({ alignSelf, children, grow, noShrink, order, ref, width, ...boxProps }: ColumnProps<E>): React.JSX.Element;
13
11
  displayName: string;
14
12
  };
15
13
  //# sourceMappingURL=Column.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Column.d.ts","sourceRoot":"","sources":["../../../lib/components/Columns/Column.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,KAAK,WAAW,EAAE,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AAE1D,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAO,KAAK,aAAa,EAA4B,MAAM,QAAQ,CAAC;AAE3E,MAAM,WAAW,WAAW,CAAC,CAAC,SAAS,WAAW,CAAE,SAAQ,aAAa,CAAC,CAAC,CAAC;IAC3E,SAAS,CAAC,EAAE,mBAAmB,CAAC,WAAW,CAAC,CAAC;IAC7C,cAAc,CAAC,EAAE,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;IACvD,KAAK,CAAC,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACrC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IACb,KAAK,CAAC,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC;CAC1C;AAED,eAAO,MAAM,MAAM;KAAI,CAAC,SAAS,WAAW,mEAOzC,WAAW,CAAC,CAAC,CAAC;;CAmBhB,CAAC"}
1
+ {"version":3,"file":"Column.d.ts","sourceRoot":"","sources":["../../../lib/components/Columns/Column.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,KAAK,WAAW,EAAE,KAAK,GAAG,EAAc,MAAM,OAAO,CAAC;AAEtE,OAAO,EAEN,KAAK,aAAa,EAClB,KAAK,UAAU,EAGf,MAAM,QAAQ,CAAC;AAEhB,OAAO,KAAK,MAAM,MAAM,cAAc,CAAC;AAGvC,MAAM,WAAW,WAAW,CAAC,CAAC,SAAS,WAAW,CACjD,SAAQ,aAAa,CAAC,CAAC,CAAC,EACvB,MAAM,CAAC,oBAAoB;IAC5B,KAAK,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;IAC5B,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC,8BAA8B,CAAC,WAAW,CAAC,CAAC;CAC3D;AAQD,eAAO,MAAM,MAAM;KAAI,CAAC,SAAS,WAAW,2EASzC,WAAW,CAAC,CAAC,CAAC;;CAqChB,CAAC"}
@@ -2,36 +2,55 @@
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", "justifyContent", "order", "width"];
5
+ const _excluded = ["alignSelf", "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
- import React from 'react';
8
+ import { invariant } from '@autoguru/utilities';
9
+ import React, { useContext } from 'react';
9
10
  import { Box, useBox } from "../Box/index.js";
11
+ import * as styles from "./Column.css.js";
12
+ import { ColumnContext } from "./Columns.js";
10
13
  import { jsx as _jsx } from "react/jsx-runtime";
11
14
  export const Column = _ref => {
12
15
  let {
13
16
  alignSelf,
14
17
  children,
15
- justifyContent,
18
+ grow = false,
19
+ noShrink = false,
16
20
  order,
21
+ ref,
17
22
  width
18
23
  } = _ref,
19
- props = _objectWithoutProperties(_ref, _excluded);
24
+ boxProps = _objectWithoutProperties(_ref, _excluded);
25
+ const columnsContext = useContext(ColumnContext);
26
+ !(columnsContext !== null) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Column must be wrapped inside a Columns element') : invariant(false) : void 0;
27
+ const {
28
+ isList,
29
+ spaceXCls,
30
+ spaceYCls
31
+ } = columnsContext;
20
32
  const {
21
33
  Component,
22
34
  componentProps
23
- } = useBox(_objectSpread(_objectSpread({}, props), {}, {
24
- justifyContent: 'center',
35
+ } = useBox(_objectSpread(_objectSpread({}, boxProps), {}, {
25
36
  display: 'flex',
26
37
  height: 'full',
27
38
  width: 'full'
28
39
  }));
29
40
  return _jsx(Box, {
30
- alignSelf: alignSelf,
31
- gridColumn: width,
32
- justifyContent: justifyContent,
41
+ as: isList ? 'li' : 'div',
33
42
  order: order,
43
+ flexGrow: grow ? 1 : 0,
44
+ flexShrink: noShrink ? 0 : void 0,
45
+ className: [spaceXCls, spaceYCls, styles.sprinklesColumnWidthResponsive({
46
+ flexBasis: width
47
+ }), styles.columnStyle({
48
+ alignSelf,
49
+ grow,
50
+ noShrink
51
+ })],
34
52
  children: _jsx(Component, _objectSpread(_objectSpread({}, componentProps), {}, {
53
+ ref: ref,
35
54
  children: children
36
55
  }))
37
56
  });
@@ -0,0 +1,35 @@
1
+ import { type RecipeVariants } from '@vanilla-extract/recipes';
2
+ export declare const totalGridColumns = 12;
3
+ export declare const columnStyle: import("@vanilla-extract/recipes").RuntimeFn<{
4
+ width: {
5
+ '1/2': string;
6
+ '1/3': string;
7
+ '2/3': string;
8
+ '1/4': string;
9
+ '3/4': string;
10
+ '1/6': string;
11
+ '2/6': string;
12
+ '3/6': string;
13
+ '4/6': string;
14
+ full: string;
15
+ auto: string;
16
+ };
17
+ }>;
18
+ export declare const columnGridStyle: import("@vanilla-extract/recipes").RuntimeFn<{
19
+ align: {
20
+ stretch: string;
21
+ top: string;
22
+ center: string;
23
+ bottom: string;
24
+ };
25
+ noWrap: {
26
+ false: string;
27
+ true: string;
28
+ };
29
+ wrappingDirection: {
30
+ default: string;
31
+ reverse: string;
32
+ };
33
+ }>;
34
+ export type ColumnGridStyle = NonNullable<RecipeVariants<typeof columnGridStyle>>;
35
+ //# sourceMappingURL=ColumnGrid.css.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ColumnGrid.css.d.ts","sourceRoot":"","sources":["../../../lib/components/Columns/ColumnGrid.css.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAIvE,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,eAAO,MAAM,WAAW;;;;;;;;;;;;;;EAiBtB,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;EAsC1B,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,WAAW,CACxC,cAAc,CAAC,OAAO,eAAe,CAAC,CACtC,CAAC"}
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+
3
+ import * as __vanilla_filescope__ from '@vanilla-extract/css/fileScope';
4
+ __vanilla_filescope__.setFileScope("lib/components/Columns/ColumnGrid.css.ts", "@autoguru/overdrive");
5
+ import { recipe } from '@vanilla-extract/recipes';
6
+ import { sprinklesResponsive } from "../../styles/sprinkles.css.js";
7
+ export const totalGridColumns = 12;
8
+ export const columnStyle = recipe({
9
+ base: {},
10
+ variants: {
11
+ width: {
12
+ '1/2': `span ${totalGridColumns / 2}`,
13
+ '1/3': `span ${totalGridColumns / 3}`,
14
+ '2/3': `span ${totalGridColumns / 3 * 2}`,
15
+ '1/4': `span ${totalGridColumns / 4}`,
16
+ '3/4': `span ${totalGridColumns / 4 * 3}`,
17
+ '1/6': `span ${totalGridColumns / 6}`,
18
+ '2/6': `span ${totalGridColumns / 6 * 2}`,
19
+ '3/6': `span ${totalGridColumns / 6 * 3}`,
20
+ '4/6': `span ${totalGridColumns / 6 * 4}`,
21
+ full: `span ${totalGridColumns}`,
22
+ auto: 'auto'
23
+ }
24
+ }
25
+ }, "columnStyle");
26
+ export const columnGridStyle = recipe({
27
+ base: {
28
+ display: 'grid',
29
+ gridAutoFlow: 'row',
30
+ gridTemplateColumns: `repeat(${totalGridColumns}, [col-start] 1fr)`
31
+ },
32
+ variants: {
33
+ align: {
34
+ stretch: sprinklesResponsive({
35
+ alignItems: 'stretch',
36
+ alignContent: 'stretch'
37
+ }),
38
+ top: sprinklesResponsive({
39
+ alignItems: 'flex-start',
40
+ alignContent: 'flex-start'
41
+ }),
42
+ center: sprinklesResponsive({
43
+ alignItems: 'center',
44
+ alignContent: 'center'
45
+ }),
46
+ bottom: sprinklesResponsive({
47
+ alignItems: 'flex-end',
48
+ alignContent: 'flex-end'
49
+ })
50
+ },
51
+ noWrap: {
52
+ false: sprinklesResponsive({
53
+ flexWrap: 'wrap'
54
+ }),
55
+ true: sprinklesResponsive({
56
+ flexWrap: 'nowrap'
57
+ })
58
+ },
59
+ wrappingDirection: {
60
+ default: '',
61
+ reverse: sprinklesResponsive({
62
+ flexWrap: 'wrap-reverse'
63
+ })
64
+ }
65
+ },
66
+ defaultVariants: {
67
+ align: 'stretch',
68
+ noWrap: false
69
+ }
70
+ }, "columnGridStyle");
71
+ __vanilla_filescope__.endFileScope();
@@ -1,19 +1,37 @@
1
1
  import { type RecipeVariants } from '@vanilla-extract/recipes';
2
- export declare const columnWrapper: import("@vanilla-extract/recipes").RuntimeFn<{
2
+ export declare const columnsStyle: import("@vanilla-extract/recipes").RuntimeFn<{
3
3
  align: {
4
- stretch: string;
5
- top: string;
6
- center: string;
7
- bottom: string;
4
+ stretch: {
5
+ alignContent: "stretch";
6
+ alignItems: "stretch";
7
+ };
8
+ top: {
9
+ alignContent: "flex-start";
10
+ alignItems: "flex-start";
11
+ };
12
+ center: {
13
+ alignContent: "center";
14
+ alignItems: "center";
15
+ };
16
+ bottom: {
17
+ alignContent: "flex-end";
18
+ alignItems: "flex-end";
19
+ };
8
20
  };
9
21
  noWrap: {
10
- false: string;
11
- true: string;
22
+ false: {
23
+ flexWrap: "wrap";
24
+ };
25
+ true: {
26
+ flexWrap: "nowrap";
27
+ };
12
28
  };
13
29
  wrappingDirection: {
14
- default: string;
15
- reverse: string;
30
+ default: {};
31
+ reverse: {
32
+ flexWrap: "wrap-reverse";
33
+ };
16
34
  };
17
35
  }>;
18
- export type ColumnWrapperVariants = NonNullable<RecipeVariants<typeof columnWrapper>>;
36
+ export type ColumnsStyle = NonNullable<RecipeVariants<typeof columnsStyle>>;
19
37
  //# sourceMappingURL=Columns.css.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Columns.css.d.ts","sourceRoot":"","sources":["../../../lib/components/Columns/Columns.css.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAOvE,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;EAwCxB,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,WAAW,CAC9C,cAAc,CAAC,OAAO,aAAa,CAAC,CACpC,CAAC"}
1
+ {"version":3,"file":"Columns.css.d.ts","sourceRoot":"","sources":["../../../lib/components/Columns/Columns.css.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAEvE,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2CvB,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,WAAW,CAAC,cAAc,CAAC,OAAO,YAAY,CAAC,CAAC,CAAC"}
@@ -3,51 +3,48 @@
3
3
  import * as __vanilla_filescope__ from '@vanilla-extract/css/fileScope';
4
4
  __vanilla_filescope__.setFileScope("lib/components/Columns/Columns.css.ts", "@autoguru/overdrive");
5
5
  import { recipe } from '@vanilla-extract/recipes';
6
- import { sprinklesResponsive, totalGridColumns } from "../../styles/sprinkles.css.js";
7
- export const columnWrapper = recipe({
8
- base: [sprinklesResponsive({
9
- display: 'grid'
10
- }), {
11
- gridAutoFlow: 'row',
12
- gridTemplateColumns: `repeat(${totalGridColumns}, [col-start] 1fr)`
13
- }],
6
+ export const columnsStyle = recipe({
7
+ base: {
8
+ display: 'flex',
9
+ flexDirection: 'row'
10
+ },
14
11
  variants: {
15
12
  align: {
16
- stretch: sprinklesResponsive({
17
- alignItems: 'stretch',
18
- alignContent: 'stretch'
19
- }),
20
- top: sprinklesResponsive({
21
- alignItems: 'flex-start',
22
- alignContent: 'flex-start'
23
- }),
24
- center: sprinklesResponsive({
25
- alignItems: 'center',
26
- alignContent: 'center'
27
- }),
28
- bottom: sprinklesResponsive({
29
- alignItems: 'flex-end',
30
- alignContent: 'flex-end'
31
- })
13
+ stretch: {
14
+ alignContent: 'stretch',
15
+ alignItems: 'stretch'
16
+ },
17
+ top: {
18
+ alignContent: 'flex-start',
19
+ alignItems: 'flex-start'
20
+ },
21
+ center: {
22
+ alignContent: 'center',
23
+ alignItems: 'center'
24
+ },
25
+ bottom: {
26
+ alignContent: 'flex-end',
27
+ alignItems: 'flex-end'
28
+ }
32
29
  },
33
30
  noWrap: {
34
- false: sprinklesResponsive({
31
+ false: {
35
32
  flexWrap: 'wrap'
36
- }),
37
- true: sprinklesResponsive({
33
+ },
34
+ true: {
38
35
  flexWrap: 'nowrap'
39
- })
36
+ }
40
37
  },
41
38
  wrappingDirection: {
42
- default: '',
43
- reverse: sprinklesResponsive({
39
+ default: {},
40
+ reverse: {
44
41
  flexWrap: 'wrap-reverse'
45
- })
42
+ }
46
43
  }
47
44
  },
48
45
  defaultVariants: {
49
- align: 'stretch',
50
- noWrap: false
46
+ wrappingDirection: 'default',
47
+ align: 'stretch'
51
48
  }
52
- }, "columnWrapper");
49
+ }, "columnsStyle");
53
50
  __vanilla_filescope__.endFileScope();
@@ -1,15 +1,22 @@
1
- import React, { type ElementType } from 'react';
2
- import { type SprinklesResponsive } from '../../styles/sprinkles.css';
3
- import { type PolymorphicBoxProps } from '../Box';
4
- import type { ColumnWrapperVariants } from './Columns.css';
5
- export interface ColumnsBaseProps extends ColumnWrapperVariants {
6
- space?: SprinklesResponsive['gap'];
7
- spaceX?: SprinklesResponsive['columnGap'];
8
- spaceY?: SprinklesResponsive['rowGap'];
1
+ import * as React from 'react';
2
+ import { SprinklesResponsive } from '../../styles/sprinkles.css';
3
+ import { type UseBoxProps } from '../Box';
4
+ import * as styles from './Columns.css';
5
+ type ResponsiveSpace = SprinklesResponsive['padding'];
6
+ export interface ColumnsProps extends UseBoxProps {
7
+ align?: styles.ColumnsStyle['align'];
8
+ noWrap?: styles.ColumnsStyle['noWrap'];
9
+ space?: ResponsiveSpace;
10
+ spaceX?: ResponsiveSpace;
11
+ spaceY?: ResponsiveSpace;
12
+ wrappingDirection?: styles.ColumnsStyle['wrappingDirection'];
9
13
  }
10
- export type StyledColumnsProps<E extends ElementType> = PolymorphicBoxProps<E, ColumnsBaseProps>;
11
- export declare const Columns: {
12
- <E extends ElementType>({ align, as, children, className, noWrap, space, spaceX, spaceY, wrappingDirection, ...props }: StyledColumnsProps<E>): React.JSX.Element;
13
- displayName: string;
14
- };
14
+ interface ColumnContextValue {
15
+ spaceXCls: string;
16
+ spaceYCls: string;
17
+ isList: boolean;
18
+ }
19
+ export declare const ColumnContext: React.Context<ColumnContextValue | null>;
20
+ export declare const Columns: React.ForwardRefExoticComponent<Omit<ColumnsProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
21
+ export default Columns;
15
22
  //# sourceMappingURL=Columns.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Columns.d.ts","sourceRoot":"","sources":["../../../lib/components/Columns/Columns.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,KAAK,WAAW,EAAE,MAAM,OAAO,CAAC;AAEhD,OAAO,EAEN,KAAK,mBAAmB,EACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,KAAK,mBAAmB,EAA4B,MAAM,QAAQ,CAAC;AAG5E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAE3D,MAAM,WAA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AAO,MAAM,aAAa,0CAAiD,CAAC;AAgC5E,eAAO,MAAM,OAAO,kGAqEnB,CAAC;AAIF,eAAe,OAAO,CAAC"}
@@ -2,45 +2,61 @@
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 = ["align", "as", "children", "className", "noWrap", "space", "spaceX", "spaceY", "wrappingDirection"];
5
+ const _excluded = ["as", "className", "children", "space", "spaceX", "spaceY", "noWrap", "wrappingDirection", "align"];
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 React from 'react';
8
+ import * as React from 'react';
9
+ import { createContext, forwardRef, useMemo } from 'react';
10
+ import { useNegativeMarginLeft, useNegativeMarginTop } from "../../hooks/useNegativeMargin/useNegativeMargin.js";
9
11
  import { sprinklesResponsive } from "../../styles/sprinkles.css.js";
10
12
  import { useBox } from "../Box/index.js";
11
13
  import * as styles from "./Columns.css.js";
12
14
  import { jsx as _jsx } from "react/jsx-runtime";
13
- export const Columns = _ref => {
15
+ export const ColumnContext = createContext(null);
16
+ export const Columns = forwardRef((_ref, ref) => {
14
17
  let {
15
- align = 'stretch',
16
18
  as,
17
- children,
18
19
  className,
19
- noWrap,
20
+ children,
20
21
  space,
21
22
  spaceX,
22
23
  spaceY,
23
- wrappingDirection = 'default'
24
+ noWrap,
25
+ wrappingDirection = 'default',
26
+ align = 'stretch'
24
27
  } = _ref,
25
- props = _objectWithoutProperties(_ref, _excluded);
28
+ boxProps = _objectWithoutProperties(_ref, _excluded);
29
+ const resolvedSpaceX = useMemo(() => spaceX || space || 'none', [space, spaceX]);
30
+ const resolvedSpaceY = useMemo(() => spaceY || space || 'none', [space, spaceY]);
31
+ const marginLeftFix = useNegativeMarginLeft(resolvedSpaceX);
32
+ const marginTopFix = useNegativeMarginTop(resolvedSpaceY);
26
33
  const {
27
34
  Component,
28
35
  componentProps
29
- } = useBox(_objectSpread({
36
+ } = useBox(_objectSpread(_objectSpread({}, boxProps), {}, {
30
37
  as,
31
- className: [styles.columnWrapper({
38
+ className: [styles.columnsStyle({
32
39
  align,
33
40
  noWrap,
34
41
  wrappingDirection
35
- }), sprinklesResponsive({
36
- gap: space,
37
- columnGap: spaceX,
38
- rowGap: spaceY
39
- }), className],
42
+ }), marginLeftFix, marginTopFix, className],
40
43
  odComponent: 'columns'
41
- }, props));
44
+ }));
42
45
  return _jsx(Component, _objectSpread(_objectSpread({}, componentProps), {}, {
43
- children: children
46
+ ref: ref,
47
+ children: _jsx(ColumnContext.Provider, {
48
+ value: useMemo(() => ({
49
+ spaceXCls: sprinklesResponsive({
50
+ paddingLeft: resolvedSpaceX
51
+ }),
52
+ spaceYCls: sprinklesResponsive({
53
+ paddingTop: resolvedSpaceY
54
+ }),
55
+ isList: typeof as === 'string' && ['ul', 'ol'].includes(as)
56
+ }), [as, resolvedSpaceX, resolvedSpaceY]),
57
+ children: children
58
+ })
44
59
  }));
45
- };
46
- Columns.displayName = 'Columns';
60
+ });
61
+ Columns.displayName = 'Columns';
62
+ export default Columns;
@@ -1 +1 @@
1
- {"version":3,"file":"Columns.stories.d.ts","sourceRoot":"","sources":["../../../lib/components/Columns/Columns.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAOvD,OAAO,EAAU,OAAO,EAAE,MAAM,GAAG,CAAC;AAEpC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,OAAO,CAwC9B,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,OAAO,CAAC,CAAC;AAEtC,eAAO,MAAM,QAAQ,EAAE,KAqEtB,CAAC;AAIF,eAAO,MAAM,cAAc,EAAE,KAqE5B,CAAC"}
1
+ {"version":3,"file":"Columns.stories.d.ts","sourceRoot":"","sources":["../../../lib/components/Columns/Columns.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAOvD,OAAO,EAAU,OAAO,EAAoB,MAAM,GAAG,CAAC;AAEtD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,OAAO,CAwB9B,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,OAAO,CAAC,CAAC;AAEtC,eAAO,MAAM,QAAQ,EAAE,KAyDtB,CAAC;AAOF,eAAO,MAAM,cAAc,EAAE,KAsE5B,CAAC"}
@@ -16,9 +16,9 @@ declare const meta: {
16
16
  id?: string | undefined | undefined;
17
17
  ref?: React.Ref<HTMLButtonElement> | undefined;
18
18
  className?: string | undefined | undefined;
19
- testId?: string | undefined;
20
19
  lang?: Partial<Record<"loading", string>> | undefined;
21
20
  "aria-label"?: string | undefined | undefined;
21
+ testId?: string | undefined;
22
22
  type?: "submit" | "reset" | "button" | undefined | undefined;
23
23
  rounded?: boolean | undefined;
24
24
  minimal?: import("../Button/Button.css").ButtonMinimal | undefined;