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

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 (62) hide show
  1. package/dist/components/Box/Box.d.ts.map +1 -1
  2. package/dist/components/Box/Box.js +6 -2
  3. package/dist/components/Box/Box.stories.d.ts +3 -1
  4. package/dist/components/Box/Box.stories.d.ts.map +1 -1
  5. package/dist/components/Box/Box.test.d.ts +2 -0
  6. package/dist/components/Box/Box.test.d.ts.map +1 -0
  7. package/dist/components/Box/Box.test.js +113 -0
  8. package/dist/components/Box/boxStyles.d.ts +2 -2
  9. package/dist/components/Box/boxStyles.d.ts.map +1 -1
  10. package/dist/components/Box/boxStyles.js +2 -2
  11. package/dist/components/Box/useBox.d.ts +17 -13
  12. package/dist/components/Box/useBox.d.ts.map +1 -1
  13. package/dist/components/Box/useBox.js +14 -9
  14. package/dist/components/BulletText/BulletText.d.ts +3 -3
  15. package/dist/components/BulletText/BulletText.d.ts.map +1 -1
  16. package/dist/components/BulletText/BulletText.js +1 -1
  17. package/dist/components/BulletText/BulletText.stories.d.ts +1 -1
  18. package/dist/components/Columns/Column.css.d.ts +0 -14
  19. package/dist/components/Columns/Column.css.d.ts.map +1 -1
  20. package/dist/components/Columns/Column.css.js +0 -14
  21. package/dist/components/Columns/Column.d.ts +4 -6
  22. package/dist/components/Columns/Column.d.ts.map +1 -1
  23. package/dist/components/Columns/Column.js +11 -9
  24. package/dist/components/Columns/Columns.d.ts +1 -1
  25. package/dist/components/Columns/Columns.d.ts.map +1 -1
  26. package/dist/components/Columns/Columns.js +21 -12
  27. package/dist/components/Columns/Columns.stories.d.ts.map +1 -1
  28. package/dist/components/DropDown/DropDown.stories.d.ts +1 -1
  29. package/dist/components/Heading/Heading.js +1 -1
  30. package/dist/components/Inline/Inline.d.ts +3 -4
  31. package/dist/components/Inline/Inline.d.ts.map +1 -1
  32. package/dist/components/Inline/Inline.js +17 -12
  33. package/dist/components/LoadingBox/LoadingBox.stories.d.ts +8 -6
  34. package/dist/components/LoadingBox/LoadingBox.stories.d.ts.map +1 -1
  35. package/dist/components/Section/Section.d.ts +3 -4
  36. package/dist/components/Section/Section.d.ts.map +1 -1
  37. package/dist/components/Section/Section.stories.d.ts +375 -1
  38. package/dist/components/Section/Section.stories.d.ts.map +1 -1
  39. package/dist/components/Stack/Stack.d.ts +3 -3
  40. package/dist/components/Stack/Stack.d.ts.map +1 -1
  41. package/dist/components/Stack/Stack.js +9 -4
  42. package/dist/components/TextAreaInput/TextAreaInput.d.ts +1 -1
  43. package/dist/components/TextInput/TextInput.d.ts +1 -1
  44. package/dist/components/TextLink/TextLink.stories.d.ts +2 -2
  45. package/dist/components/VisuallyHidden/VisuallyHidden.d.ts +3 -5
  46. package/dist/components/VisuallyHidden/VisuallyHidden.d.ts.map +1 -1
  47. package/dist/components/VisuallyHidden/VisuallyHidden.js +6 -2
  48. package/dist/components/VisuallyHidden/VisuallyHidden.stories.d.ts +1 -1
  49. package/dist/{components/Box/argTypes.d.ts → stories/shared/argTypes-box.d.ts} +2 -2
  50. package/dist/stories/shared/argTypes-box.d.ts.map +1 -0
  51. package/dist/styles/sprinkles.css.d.ts +4 -4
  52. package/dist/themes/helpers.d.ts.map +1 -1
  53. package/dist/utils/dataAttrs.d.ts.map +1 -1
  54. package/dist/utils/dataAttrs.js +1 -1
  55. package/dist/utils/sprinkles.d.ts +13 -6
  56. package/dist/utils/sprinkles.d.ts.map +1 -1
  57. package/dist/utils/sprinkles.js +30 -17
  58. package/package.json +3 -3
  59. package/dist/components/Box/Box.spec.d.ts +0 -2
  60. package/dist/components/Box/Box.spec.d.ts.map +0 -1
  61. package/dist/components/Box/argTypes.d.ts.map +0 -1
  62. package/dist/components/Box/argTypes.js +0 -81
@@ -1 +1 @@
1
- {"version":3,"file":"Box.d.ts","sourceRoot":"","sources":["../../../lib/components/Box/Box.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,KAAK,WAAW,EAAE,MAAM,OAAO,CAAC;AAEhD,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAoBpD,eAAO,MAAM,GAAG;KAAI,CAAC,SAAS,WAAW,kCAGtC,WAAW,CAAC,CAAC,CAAC;;CAIhB,CAAC"}
1
+ {"version":3,"file":"Box.d.ts","sourceRoot":"","sources":["../../../lib/components/Box/Box.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAgB,KAAK,WAAW,EAAE,MAAM,OAAO,CAAC;AAE9D,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAyBpD,eAAO,MAAM,GAAG;KAAI,CAAC,SAAS,WAAW,kCAGtC,WAAW,CAAC,CAAC,CAAC;;CAUhB,CAAC"}
@@ -5,7 +5,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
5
5
  const _excluded = ["children"];
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 React, { cloneElement } from 'react';
9
9
  import { useBox } from "./useBox.js";
10
10
  import { jsx as _jsx } from "react/jsx-runtime";
11
11
  export const Box = _ref => {
@@ -15,8 +15,12 @@ export const Box = _ref => {
15
15
  props = _objectWithoutProperties(_ref, _excluded);
16
16
  const {
17
17
  Component,
18
- componentProps
18
+ componentProps,
19
+ reactElement
19
20
  } = useBox(props);
21
+ if (reactElement) {
22
+ return cloneElement(reactElement, componentProps, children);
23
+ }
20
24
  return _jsx(Component, _objectSpread(_objectSpread({}, componentProps), {}, {
21
25
  children: children
22
26
  }));
@@ -1,8 +1,10 @@
1
1
  import { Meta, StoryObj } from '@storybook/react';
2
- import { Box } from '.';
2
+ import { Box } from './Box';
3
3
  declare const meta: Meta<typeof Box>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof meta>;
6
6
  export declare const Standard: Story;
7
7
  export declare const ResponsiveProps: Story;
8
+ export declare const DataAttributes: Story;
9
+ export declare const ComponentAsProp: Story;
8
10
  //# sourceMappingURL=Box.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Box.stories.d.ts","sourceRoot":"","sources":["../../../lib/components/Box/Box.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC;AAExB,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,GAAG,CAgB1B,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,QAAQ,EAAE,KAAU,CAAC;AAKlC,eAAO,MAAM,eAAe,EAAE,KAK7B,CAAC"}
1
+ {"version":3,"file":"Box.stories.d.ts","sourceRoot":"","sources":["../../../lib/components/Box/Box.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,GAAG,CAgB1B,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,QAAQ,EAAE,KAAU,CAAC;AAKlC,eAAO,MAAM,eAAe,EAAE,KAK7B,CAAC;AAKF,eAAO,MAAM,cAAc,EAAE,KAU5B,CAAC;AAKF,eAAO,MAAM,eAAe,EAAE,KAa7B,CAAC"}
@@ -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,5 +1,5 @@
1
1
  import type { ElementType } from 'react';
2
- import type { BoxBasedProps, StyleProps } from './';
3
- export type BoxStylesProps<E extends ElementType = 'div'> = StyleProps & Omit<BoxBasedProps<E>, 'children'>;
2
+ import type { AsPolyProp, CustomProps, StyleProps } from './';
3
+ export type BoxStylesProps<E extends ElementType = 'div'> = AsPolyProp<E> & Pick<CustomProps, 'className'> & StyleProps;
4
4
  export declare const boxStyles: <E extends ElementType = "div">({ as, className, ...props }: BoxStylesProps<E>) => string;
5
5
  //# sourceMappingURL=boxStyles.d.ts.map
@@ -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,aAAa,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAEpD,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,WAAW,GAAG,KAAK,IAAI,UAAU,GACrE,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;AA4BpC,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
  }
@@ -1,22 +1,26 @@
1
1
  import type { ClassValue as ClassName } from 'clsx';
2
- import type { ComponentPropsWithRef, ElementType, PropsWithChildren } from 'react';
2
+ import { type ComponentPropsWithRef, type ComponentPropsWithoutRef, type ElementType, type PropsWithChildren, type ReactElement } from 'react';
3
3
  import type { Sprinkles, SprinklesResponsive, SprinklesLegacyColours } from '../../styles/sprinkles.css';
4
- export interface BoxBasedProps<E extends ElementType> extends PropsWithChildren {
5
- as?: E;
4
+ export type StyleProps = Sprinkles & SprinklesResponsive & SprinklesLegacyColours;
5
+ export interface CustomProps extends PropsWithChildren {
6
6
  className?: ClassName;
7
7
  odComponent?: string;
8
+ testId?: string;
8
9
  }
9
- export type StyleProps = Sprinkles & SprinklesResponsive & SprinklesLegacyColours;
10
- export type PolymorphicBoxProps<E extends ElementType, Props = object> = BoxBasedProps<E> & Omit<ComponentPropsWithRef<E>, keyof Props | 'as' | 'className'> & Props;
11
- export type UseBoxProps<E extends ElementType = 'div'> = PolymorphicBoxProps<E, StyleProps>;
12
- export type ComponentProps<E extends ElementType> = Omit<ComponentPropsWithRef<E>, 'as'>;
13
- export declare const useBox: <E extends ElementType = "div">({ as, className, odComponent, testId, ...props }: UseBoxProps<E>) => {
10
+ export type PolymorphicRef<C extends ElementType> = ComponentPropsWithRef<C>['ref'];
11
+ export type AsPolyProp<C extends ElementType> = {
12
+ as?: C | ReactElement;
13
+ };
14
+ export type RefPolyProp<C extends ElementType> = {
15
+ ref?: PolymorphicRef<C>;
16
+ };
17
+ export type PropsToOmit<C extends ElementType, P> = keyof (AsPolyProp<C> & P);
18
+ export type PolymorphicComponentProps<C extends ElementType, Props = object> = PropsWithChildren<Props & AsPolyProp<C> & RefPolyProp<C>> & Omit<ComponentPropsWithoutRef<C>, PropsToOmit<C, Props>>;
19
+ export type UseBoxProps<E extends ElementType = 'div'> = PolymorphicComponentProps<E, CustomProps & StyleProps>;
20
+ export declare const useBox: <E extends ElementType = "div">({ as: _as, className: _className, odComponent, testId, ...props }: UseBoxProps<E>) => {
14
21
  Component: ElementType;
15
- componentProps: {
16
- className: string;
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
- [key: string]: string;
19
- };
22
+ componentProps: ComponentPropsWithRef<E>;
23
+ reactElement: ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | undefined;
20
24
  SemanticChild: ElementType | undefined;
21
25
  };
22
26
  //# 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,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
+ {"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,EAEN,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,WAAW,EAEhB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EACX,SAAS,EACT,mBAAmB,EACnB,sBAAsB,EACtB,MAAM,4BAA4B,CAAC;AAOpC,MAAM,MAAM,UAAU,GAAG,SAAS,GACjC,mBAAmB,GACnB,sBAAsB,CAAC;AAMxB,MAAM,WAAW,WAAY,SAAQ,iBAAiB;IAIrD,SAAS,CAAC,EAAE,SAAS,CAAC;IAItB,WAAW,CAAC,EAAE,MAAM,CAAC;IAIrB,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,WAAW,IAC/C,qBAAqB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAGjC,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,WAAW,IAAI;IAC/C,EAAE,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC;CACtB,CAAC;AAGF,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,WAAW,IAAI;IAChD,GAAG,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;CACxB,CAAC;AAGF,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,WAAW,EAAE,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AAO9E,MAAM,MAAM,yBAAyB,CACpC,CAAC,SAAS,WAAW,EACrB,KAAK,GAAG,MAAM,IACX,iBAAiB,CAAC,KAAK,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,GAC5D,IAAI,CAAC,wBAAwB,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;AAG1D,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,WAAW,GAAG,KAAK,IACpD,yBAAyB,CAAC,CAAC,EAAE,WAAW,GAAG,UAAU,CAAC,CAAC;AAkBxD,eAAO,MAAM,MAAM,GAAI,CAAC,SAAS,WAAW,GAAG,KAAK,EAAE,mEAMnD,WAAW,CAAC,CAAC,CAAC;;;;;CA2ChB,CAAC"}
@@ -5,6 +5,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
5
5
  const _excluded = ["as", "className", "odComponent", "testId"];
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 { isValidElement } from 'react';
8
9
  import { useDeepCompareMemo } from "../../hooks/index.js";
9
10
  import { dataAttrs } from "../../utils/dataAttrs.js";
10
11
  import { filterNonSprinklesProps } from "../../utils/sprinkles.js";
@@ -15,28 +16,32 @@ const LIST_TAGS = ['ul', 'ol'];
15
16
  const OD_COMPONENT_ATTR = 'od-component';
16
17
  export const useBox = _ref => {
17
18
  let {
18
- as,
19
- className,
19
+ as: _as,
20
+ className: _className,
20
21
  odComponent,
21
22
  testId
22
23
  } = _ref,
23
24
  props = _objectWithoutProperties(_ref, _excluded);
25
+ const isReactElement = typeof _as !== 'string' && isValidElement(_as);
26
+ const as = isReactElement ? undefined : _as !== null && _as !== void 0 ? _as : DEFAULT_TAG;
24
27
  const Component = as !== null && as !== void 0 ? as : DEFAULT_TAG;
25
28
  const isList = LIST_TAGS.includes(Component);
26
29
  const SemanticChild = isList ? LIST_ITEM_TAG : undefined;
27
- const style = useDeepCompareMemo(() => boxStyles(_objectSpread({
30
+ const className = useDeepCompareMemo(() => boxStyles(_objectSpread({
28
31
  as,
29
- className
30
- }, props)), [className, props]);
32
+ className: _className
33
+ }, props)), [as, _className, props]);
31
34
  const remainingProps = useDeepCompareMemo(() => _objectSpread(_objectSpread({}, filterNonSprinklesProps(props)), dataAttrs({
32
35
  [OD_COMPONENT_ATTR]: odComponent === null || odComponent === void 0 ? void 0 : odComponent.toLocaleLowerCase(),
33
36
  testId
34
- })), [props]);
37
+ })), [odComponent, props, testId]);
38
+ const componentProps = _objectSpread(_objectSpread({}, remainingProps), {}, {
39
+ className
40
+ });
35
41
  return {
36
42
  Component,
37
- componentProps: _objectSpread({
38
- className: style
39
- }, remainingProps),
43
+ componentProps,
44
+ reactElement: isReactElement ? _as : undefined,
40
45
  SemanticChild
41
46
  };
42
47
  };
@@ -1,9 +1,9 @@
1
1
  import React, { type ElementType, type ReactNode } from 'react';
2
- import { type BoxBasedProps } from '../Box';
3
- export interface Props<E extends ElementType> extends BoxBasedProps<E> {
2
+ import { type UseBoxProps } from '../Box';
3
+ export interface Props {
4
4
  bullet?: ReactNode;
5
5
  variant?: 'primary' | 'secondary';
6
6
  }
7
- export declare const BulletText: <E extends ElementType>({ as, variant, children, bullet: Bullet, }: Props<E>) => React.JSX.Element;
7
+ export declare const BulletText: <E extends ElementType>({ as, variant, children, bullet: Bullet, }: UseBoxProps<E> & Props) => React.JSX.Element;
8
8
  export default BulletText;
9
9
  //# sourceMappingURL=BulletText.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BulletText.d.ts","sourceRoot":"","sources":["../../../lib/components/BulletText/BulletText.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,KAAK,WAAW,EAAkB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEhF,OAAO,EAAE,KAAK,aAAa,EAAO,MAAM,QAAQ,CAAC;AAMjD,MAAM,WAAW,KAAK,CAAC,CAAC,SAAS,WAAW,CAAE,SAAQ,aAAa,CAAC,CAAC,CAAC;IACrE,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC;CAClC;AAED,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,WAAW,EAAE,4CAK/C,KAAK,CAAC,CAAC,CAAC,sBAqCV,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"BulletText.d.ts","sourceRoot":"","sources":["../../../lib/components/BulletText/BulletText.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAEb,KAAK,WAAW,EAEhB,KAAK,SAAS,EACd,MAAM,OAAO,CAAC;AAEf,OAAO,EAAO,KAAK,WAAW,EAAE,MAAM,QAAQ,CAAC;AAM/C,MAAM,WAAW,KAAK;IACrB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC;CAClC;AAED,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,WAAW,EAAE,4CAK/C,WAAW,CAAC,CAAC,CAAC,GAAG,KAAK,sBA2CxB,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -15,9 +15,9 @@ export const BulletText = _ref => {
15
15
  bullet: Bullet = '•'
16
16
  } = _ref;
17
17
  return _jsxs(Inline, {
18
+ as: as,
18
19
  noWrap: true,
19
20
  space: "3",
20
- as: as,
21
21
  alignX: "flex-start",
22
22
  alignY: "center",
23
23
  children: [isValidElement(Bullet) ? _jsx(Box, {
@@ -3,7 +3,7 @@ import * as React from 'react';
3
3
  import { BulletText } from '.';
4
4
  declare const meta: {
5
5
  title: string;
6
- component: <E extends React.ElementType>({ as, variant, children, bullet: Bullet, }: import("./BulletText").Props<E>) => React.JSX.Element;
6
+ component: <E extends React.ElementType>({ as, variant, children, bullet: Bullet, }: import("..").UseBoxProps<E> & import("./BulletText").Props) => React.JSX.Element;
7
7
  args: {
8
8
  as: "div";
9
9
  children: string;
@@ -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,13 +1,11 @@
1
- import React, { type ElementType, type Ref } from 'react';
2
- import { type BoxBasedProps, type StyleProps } from '../Box';
1
+ import React, { type ElementType } from 'react';
2
+ import { type UseBoxProps } from '../Box';
3
3
  import * as styles from './Column.css';
4
- export interface ColumnProps<E extends ElementType> extends BoxBasedProps<E>, styles.ColumnRecipeVariants {
5
- order?: StyleProps['order'];
6
- ref?: Ref<E>;
4
+ export interface ColumnProps extends styles.ColumnRecipeVariants {
7
5
  width?: styles.SprinklesColumnWidthResponsive['flexBasis'];
8
6
  }
9
7
  export declare const Column: {
10
- <E extends ElementType>({ alignSelf, children, grow, noShrink, order, ref, width, ...boxProps }: ColumnProps<E>): React.JSX.Element;
8
+ <E extends ElementType>({ children, grow, noShrink, order, ref, width, ...boxProps }: UseBoxProps<E> & ColumnProps): React.JSX.Element;
11
9
  displayName: string;
12
10
  };
13
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,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"}
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,18 +2,17 @@
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';
9
- import React, { useContext } from 'react';
9
+ import React, { cloneElement, useContext } from 'react';
10
10
  import { Box, useBox } from "../Box/index.js";
11
11
  import * as styles from "./Column.css.js";
12
12
  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,
@@ -31,12 +30,19 @@ export const Column = _ref => {
31
30
  } = columnsContext;
32
31
  const {
33
32
  Component,
34
- componentProps
33
+ componentProps,
34
+ reactElement
35
35
  } = useBox(_objectSpread(_objectSpread({}, boxProps), {}, {
36
36
  display: 'flex',
37
37
  height: 'full',
38
38
  width: 'full'
39
39
  }));
40
+ const ColumnContent = () => reactElement ? (cloneElement(reactElement, _objectSpread(_objectSpread({}, componentProps), {}, {
41
+ ref
42
+ }), children)) : _jsx(Component, _objectSpread(_objectSpread({}, componentProps), {}, {
43
+ ref: ref,
44
+ children: children
45
+ }));
40
46
  return _jsx(Box, {
41
47
  as: isList ? 'li' : 'div',
42
48
  order: order,
@@ -45,14 +51,10 @@ export const Column = _ref => {
45
51
  className: [spaceXCls, spaceYCls, styles.sprinklesColumnWidthResponsive({
46
52
  flexBasis: width
47
53
  }), styles.columnStyle({
48
- alignSelf,
49
54
  grow,
50
55
  noShrink
51
56
  })],
52
- children: _jsx(Component, _objectSpread(_objectSpread({}, componentProps), {}, {
53
- ref: ref,
54
- children: children
55
- }))
57
+ children: _jsx(ColumnContent, {})
56
58
  });
57
59
  };
58
60
  Column.displayName = 'Column';
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import React from 'react';
2
2
  import { SprinklesResponsive } from '../../styles/sprinkles.css';
3
3
  import { type UseBoxProps } from '../Box';
4
4
  import * as styles from './Columns.css';
@@ -1 +1 @@
1
- {"version":3,"file":"Columns.d.ts","sourceRoot":"","sources":["../../../lib/components/Columns/Columns.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,EACN,mBAAmB,EAEnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,QAAQ,CAAC;AAElD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,KAAK,eAAe,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC;AAEtD,MAAM,WAAW,YAAa,SAAQ,WAAW;IAIhD,KAAK,CAAC,EAAE,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IAIrC,MAAM,CAAC,EAAE,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAIvC,KAAK,CAAC,EAAE,eAAe,CAAC;IAIxB,MAAM,CAAC,EAAE,eAAe,CAAC;IAIzB,MAAM,CAAC,EAAE,eAAe,CAAC;IAIzB,iBAAiB,CAAC,EAAE,MAAM,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;CAC7D;AAED,UAAU,kBAAkB;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;CAChB;AAED,eAAO,MAAM,aAAa,0CAAiD,CAAC;AAgC5E,eAAO,MAAM,OAAO,kGAqEnB,CAAC;AAIF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"Columns.d.ts","sourceRoot":"","sources":["../../../lib/components/Columns/Columns.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAMhF,OAAO,EACN,mBAAmB,EAEnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,QAAQ,CAAC;AAElD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,KAAK,eAAe,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC;AAEtD,MAAM,WAAW,YAAa,SAAQ,WAAW;IAIhD,KAAK,CAAC,EAAE,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IAIrC,MAAM,CAAC,EAAE,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAIvC,KAAK,CAAC,EAAE,eAAe,CAAC;IAIxB,MAAM,CAAC,EAAE,eAAe,CAAC;IAIzB,MAAM,CAAC,EAAE,eAAe,CAAC;IAIzB,iBAAiB,CAAC,EAAE,MAAM,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;CAC7D;AAED,UAAU,kBAAkB;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;CAChB;AAED,eAAO,MAAM,aAAa,0CAAiD,CAAC;AAgC5E,eAAO,MAAM,OAAO,kGA8EnB,CAAC;AAIF,eAAe,OAAO,CAAC"}
@@ -5,8 +5,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
5
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 * as React from 'react';
9
- import { createContext, forwardRef, useMemo } from 'react';
8
+ import React, { cloneElement, createContext, forwardRef, useMemo } from 'react';
10
9
  import { useNegativeMarginLeft, useNegativeMarginTop } from "../../hooks/useNegativeMargin/useNegativeMargin.js";
11
10
  import { sprinklesResponsive } from "../../styles/sprinkles.css.js";
12
11
  import { useBox } from "../Box/index.js";
@@ -32,7 +31,8 @@ export const Columns = forwardRef((_ref, ref) => {
32
31
  const marginTopFix = useNegativeMarginTop(resolvedSpaceY);
33
32
  const {
34
33
  Component,
35
- componentProps
34
+ componentProps,
35
+ reactElement
36
36
  } = useBox(_objectSpread(_objectSpread({}, boxProps), {}, {
37
37
  as,
38
38
  className: [styles.columnsStyle({
@@ -42,18 +42,27 @@ export const Columns = forwardRef((_ref, ref) => {
42
42
  }), marginLeftFix, marginTopFix, className],
43
43
  odComponent: 'columns'
44
44
  }));
45
+ const contextValue = useMemo(() => ({
46
+ spaceXCls: sprinklesResponsive({
47
+ paddingLeft: resolvedSpaceX
48
+ }),
49
+ spaceYCls: sprinklesResponsive({
50
+ paddingTop: resolvedSpaceY
51
+ }),
52
+ isList: typeof as === 'string' && ['ul', 'ol'].includes(as)
53
+ }), [as, resolvedSpaceX, resolvedSpaceY]);
54
+ if (reactElement) {
55
+ return cloneElement(reactElement, _objectSpread(_objectSpread({}, componentProps), {}, {
56
+ ref
57
+ }), _jsx(ColumnContext.Provider, {
58
+ value: contextValue,
59
+ children: children
60
+ }));
61
+ }
45
62
  return _jsx(Component, _objectSpread(_objectSpread({}, componentProps), {}, {
46
63
  ref: ref,
47
64
  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]),
65
+ value: contextValue,
57
66
  children: children
58
67
  })
59
68
  }));
@@ -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,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"}
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;AAIpC,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;
19
20
  lang?: Partial<Record<"loading", string>> | undefined;
20
21
  "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;
@@ -42,7 +42,7 @@ export const Heading = _ref => {
42
42
  breakWord
43
43
  }), className]
44
44
  }, dataAttrs({
45
- 'test-id': testId
45
+ testId
46
46
  })), {}, {
47
47
  children: children
48
48
  }));
@@ -1,16 +1,15 @@
1
1
  import React, { type ElementType, type ReactNode } from 'react';
2
2
  import type { SprinklesResponsive } from '../../styles/sprinkles.css';
3
+ import { type UseBoxProps } from '../Box';
3
4
  export type InlineDivider = ReactNode | boolean;
4
- export interface InlineProps<E extends ElementType = 'div'> {
5
+ export interface InlineProps {
5
6
  alignX?: SprinklesResponsive['justifyContent'];
6
7
  alignY?: SprinklesResponsive['alignItems'];
7
- as?: E;
8
- children: ReactNode;
9
8
  dividers?: InlineDivider;
10
9
  noWrap?: boolean;
11
10
  reverse?: boolean;
12
11
  space?: SprinklesResponsive['gap'];
13
12
  width?: SprinklesResponsive['width'];
14
13
  }
15
- export declare const Inline: <E extends ElementType = "div">({ alignX, alignY, children, dividers, noWrap, reverse, space, ...props }: InlineProps<E>) => React.JSX.Element;
14
+ export declare const Inline: <E extends ElementType>({ alignX, alignY, children, dividers, noWrap, reverse, space, ...props }: UseBoxProps<E> & InlineProps) => React.JSX.Element;
16
15
  //# sourceMappingURL=Inline.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Inline.d.ts","sourceRoot":"","sources":["../../../lib/components/Inline/Inline.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAGb,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAItE,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,OAAO,CAAC;AAChD,MAAM,WAAW,WAAW,CAAC,CAAC,SAAS,WAAW,GAAG,KAAK;IAIzD,MAAM,CAAC,EAAE,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;IAK/C,MAAM,CAAC,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC;IAK3C,EAAE,CAAC,EAAE,CAAC,CAAC;IAIP,QAAQ,EAAE,SAAS,CAAC;IAIpB,QAAQ,CAAC,EAAE,aAAa,CAAC;IAKzB,MAAM,CAAC,EAAE,OAAO,CAAC;IAIjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAKlB,KAAK,CAAC,EAAE,mBAAmB,CAAC,KAAK,CAAC,CAAC;IAInC,KAAK,CAAC,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC;CACrC;AAkCD,eAAO,MAAM,MAAM,GAAI,CAAC,SAAS,WAAW,GAAG,KAAK,EAAE,0EASnD,WAAW,CAAC,CAAC,CAAC,sBA4ChB,CAAC"}
1
+ {"version":3,"file":"Inline.d.ts","sourceRoot":"","sources":["../../../lib/components/Inline/Inline.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAIb,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,QAAQ,CAAC;AAGvD,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,OAAO,CAAC;AAChD,MAAM,WAAW,WAAW;IAI3B,MAAM,CAAC,EAAE,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;IAK/C,MAAM,CAAC,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC;IAI3C,QAAQ,CAAC,EAAE,aAAa,CAAC;IAKzB,MAAM,CAAC,EAAE,OAAO,CAAC;IAIjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAKlB,KAAK,CAAC,EAAE,mBAAmB,CAAC,KAAK,CAAC,CAAC;IAInC,KAAK,CAAC,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC;CACrC;AAkCD,eAAO,MAAM,MAAM,GAAI,CAAC,SAAS,WAAW,EAAE,0EAS3C,WAAW,CAAC,CAAC,CAAC,GAAG,WAAW,sBAoD9B,CAAC"}