@autoguru/overdrive 4.43.0-next.4 → 4.43.0-next.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import type { ElementType } from 'react';
2
- import type { AsPolyProp, CustomProps, StyleProps } from './';
3
- export type BoxStylesProps<E extends ElementType = 'div'> = AsPolyProp<E> & Pick<CustomProps, 'className'> & StyleProps;
2
+ import type { AsPolyProp, CommonBoxProps, StyleProps } from './';
3
+ export type BoxStylesProps<E extends ElementType = 'div'> = AsPolyProp<E> & Pick<CommonBoxProps, '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,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"}
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,cAAc,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAEjE,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,WAAW,GAAG,KAAK,IAAI,UAAU,CAAC,CAAC,CAAC,GACxE,IAAI,CAAC,cAAc,EAAE,WAAW,CAAC,GACjC,UAAU,CAAC;AA4BZ,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,WAAW,GAAG,KAAK,EAAE,6BAItD,cAAc,CAAC,CAAC,CAAC,WA4BnB,CAAC"}
@@ -2,7 +2,7 @@ import type { ClassValue as ClassName } from 'clsx';
2
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
4
  export type StyleProps = Sprinkles & SprinklesResponsive & SprinklesLegacyColours;
5
- export interface CustomProps extends PropsWithChildren {
5
+ export interface CommonBoxProps extends PropsWithChildren {
6
6
  className?: ClassName;
7
7
  odComponent?: string;
8
8
  testId?: string;
@@ -16,7 +16,8 @@ export type RefPolyProp<C extends ElementType> = {
16
16
  };
17
17
  export type PropsToOmit<C extends ElementType, P> = keyof (AsPolyProp<C> & P);
18
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>;
19
+ export type UseBoxProps<E extends ElementType = 'div'> = PolymorphicComponentProps<E, CommonBoxProps & StyleProps>;
20
+ export type BoxLikeProps<E extends ElementType, P = object> = PolymorphicComponentProps<E, Omit<StyleProps, keyof P> & CommonBoxProps & P>;
20
21
  export declare const useBox: <E extends ElementType = "div">({ as: _as, className: _className, odComponent, testId, ...props }: UseBoxProps<E>) => {
21
22
  Component: ElementType;
22
23
  componentProps: ComponentPropsWithRef<E>;
@@ -1 +1 @@
1
- {"version":3,"file":"useBox.d.ts","sourceRoot":"","sources":["../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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,cAAc,GAAG,UAAU,CAAC,CAAC;AAM3D,MAAM,MAAM,YAAY,CACvB,CAAC,SAAS,WAAW,EACrB,CAAC,GAAG,MAAM,IACP,yBAAyB,CAC5B,CAAC,EACD,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,GAAG,cAAc,GAAG,CAAC,CAC9C,CAAC;AAkBF,eAAO,MAAM,MAAM,GAAI,CAAC,SAAS,WAAW,GAAG,KAAK,EAAE,mEAMnD,WAAW,CAAC,CAAC,CAAC;;;;;CA2ChB,CAAC"}
@@ -1,23 +1,24 @@
1
- import { IconType } from '@autoguru/icons';
2
- import * as React from 'react';
3
- import { type AriaAttributes, type ComponentPropsWithRef, type ElementType, type ReactElement } from 'react';
1
+ import React, { type ComponentRef, type ForwardedRef, type ElementType, type ReactElement } from 'react';
2
+ import { BoxLikeProps } from '../Box';
4
3
  import type { StyledButtonProps } from './Button.css';
5
- type ButtonPrimitive = ComponentPropsWithRef<'button'>;
6
- type AllowedChildren = string | IconType;
7
4
  declare const defaultEnglish: {
8
5
  readonly loading: "loading";
9
6
  };
10
7
  type TextContent = keyof typeof defaultEnglish;
11
- export interface ButtonProps extends Pick<ButtonPrimitive, 'id' | 'onClick' | 'type' | 'className'>, Pick<AriaAttributes, 'aria-label'>, StyledButtonProps {
12
- children: AllowedChildren | AllowedChildren[];
8
+ export interface ButtonProps extends StyledButtonProps {
13
9
  disabled?: boolean;
14
- is?: ElementType | ReactElement;
15
10
  isLoading?: boolean;
16
11
  isFullWidth?: boolean;
17
12
  rounded?: boolean;
18
13
  withDoubleClicks?: boolean;
19
14
  lang?: Partial<Record<TextContent, string>>;
20
15
  }
21
- export declare const Button: React.ForwardRefExoticComponent<ButtonProps & import("../../types").TestId & React.RefAttributes<HTMLButtonElement>>;
16
+ export type ButtonPolyProps<E extends React.ElementType> = BoxLikeProps<E, ButtonProps>;
17
+ export type ButtonForwardRefReturn = (<E extends ElementType = 'button'>(props: ButtonPolyProps<E> & {
18
+ ref?: ForwardedRef<ComponentRef<E>>;
19
+ }) => ReactElement | null) & {
20
+ displayName?: string;
21
+ };
22
+ export declare const Button: ButtonForwardRefReturn;
22
23
  export default Button;
23
24
  //# sourceMappingURL=Button.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../lib/components/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EASN,KAAK,cAAc,EAEnB,KAAK,qBAAqB,EAC1B,KAAK,WAAW,EAEhB,KAAK,YAAY,EACjB,MAAM,OAAO,CAAC;AAWf,OAAO,KAAK,EAAc,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAElE,KAAK,eAAe,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAC;AACvD,KAAK,eAAe,GAAG,MAAM,GAAG,QAAQ,CAAC;AAIzC,QAAA,MAAM,cAAc;;CAEV,CAAC;AAEX,KAAK,WAAW,GAAG,MAAM,OAAO,cAAc,CAAC;AAE/C,MAAM,WAAW,WAChB,SAAQ,IAAI,CAAC,eAAe,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AAE,MAAM,CAAC,CAAC,CAAC;CAC5C;AAGD,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,IAAI,YAAY,CACtE,CAAC,EACD,WAAW,CACX,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,CAAC,SAAS,WAAW,GAAG,QAAQ,EACtE,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAA;CAAE,KAC/D,YAAY,GAAG,IAAI,CAAC,GAAG;IAAE,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAiCrD,eAAO,MAAM,MAAM,EAqLd,sBAAsB,CAAC;AAI5B,eAAe,MAAM,CAAC"}
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
 
3
3
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
4
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
+ const _excluded = ["as", "children", "className", "disabled", "id", "withDoubleClicks", "isLoading", "isFullWidth", "lang", "minimal", "onClick", "rounded", "size", "type", "variant", "testId"];
4
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; }
5
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; }
6
- import clsx from 'clsx';
7
- import * as React from 'react';
8
- import { cloneElement, createElement, forwardRef, isValidElement, useCallback, useEffect, useMemo, useState } from 'react';
8
+ import React, { cloneElement, forwardRef, isValidElement, useCallback, useEffect, useMemo, useState } from 'react';
9
9
  import { dataAttrs } from "../../utils/dataAttrs.js";
10
- import { Box, boxStyles } from "../Box/index.js";
10
+ import { Box, useBox } from "../Box/index.js";
11
11
  import { Icon } from "../Icon/index.js";
12
12
  import { ProgressSpinner } from "../ProgressSpinner/index.js";
13
13
  import { useTextStyles } from "../Text/index.js";
@@ -35,24 +35,27 @@ const fontWeight = {
35
35
  };
36
36
  export const Button = forwardRef((_ref, ref) => {
37
37
  let {
38
- children,
39
- className = '',
40
- disabled = false,
41
- id,
42
- is: Component = 'button',
43
- withDoubleClicks = false,
44
- isLoading = false,
45
- isFullWidth = false,
46
- lang,
47
- minimal = false,
48
- onClick: incomingOnClick,
49
- rounded = false,
50
- size = 'medium',
51
- type = 'button',
52
- variant = 'secondary',
53
- 'aria-label': ariaLabel,
54
- testId
55
- } = _ref;
38
+ as = 'button',
39
+ children,
40
+ className,
41
+ disabled = false,
42
+ id,
43
+ withDoubleClicks = false,
44
+ isLoading = false,
45
+ isFullWidth = false,
46
+ lang,
47
+ minimal = false,
48
+ onClick: incomingOnClick,
49
+ rounded = false,
50
+ size = 'medium',
51
+ type,
52
+ variant = 'secondary',
53
+ testId
54
+ } = _ref,
55
+ props = _objectWithoutProperties(_ref, _excluded);
56
+ const {
57
+ 'aria-label': ariaLabel
58
+ } = props;
56
59
  const language = _objectSpread(_objectSpread({}, defaultEnglish), lang);
57
60
  const {
58
61
  isSingleIconChild,
@@ -77,25 +80,15 @@ export const Button = forwardRef((_ref, ref) => {
77
80
  if (rounded) return 'rounded';
78
81
  return 'default';
79
82
  }, [isSingleIconChild, rounded]);
80
- const props = {
81
- type: Component === 'button' ? type : undefined,
82
- id,
83
- onClick,
84
- disabled: disabled || isLoading,
85
- 'aria-label': isLoading ? language.loading : ariaLabel,
86
- 'data-loading': isLoading ? '' : undefined,
87
- className: clsx(boxStyles({
88
- as: typeof Component === 'string' ? Component : undefined,
89
- display: 'inline-block',
90
- overflow: 'hidden',
91
- borderRadius: getBorderRadius(rounded),
92
- textAlign: 'center',
93
- borderWidth: 'none',
94
- paddingY: 'none',
95
- paddingX: getPadding(size, isLoading),
96
- width: isFullWidth ? 'full' : void 0,
97
- pointerEvents: functionallyDisabled ? 'none' : void 0
98
- }), useTextStyles({
83
+ const {
84
+ Component,
85
+ componentProps,
86
+ reactElement
87
+ } = useBox(_objectSpread(_objectSpread({}, props), {}, {
88
+ as,
89
+ borderRadius: getBorderRadius(rounded),
90
+ borderWidth: 'none',
91
+ className: [useTextStyles({
99
92
  colour: 'white',
100
93
  fontWeight: fontWeight[size],
101
94
  size: fontSize[size]
@@ -104,9 +97,23 @@ export const Button = forwardRef((_ref, ref) => {
104
97
  shape,
105
98
  intent: variant,
106
99
  minimal
107
- }), className),
108
- ref
109
- };
100
+ }), className],
101
+ disabled: disabled || isLoading,
102
+ display: 'inline-block',
103
+ id,
104
+ onClick,
105
+ overflow: 'hidden',
106
+ paddingX: getPadding(size, isLoading),
107
+ paddingY: 'none',
108
+ pointerEvents: functionallyDisabled ? 'none' : undefined,
109
+ ref,
110
+ textAlign: 'center',
111
+ type: as === 'button' ? type !== null && type !== void 0 ? type : 'button' : undefined,
112
+ width: isFullWidth ? 'full' : undefined,
113
+ 'aria-label': isLoading ? language.loading : ariaLabel
114
+ }, dataAttrs({
115
+ loading: isLoading ? '' : undefined
116
+ })));
110
117
  const buttonContents = useMemo(() => {
111
118
  var _maybeIconProps$size;
112
119
  return _jsx(_Fragment, {
@@ -155,7 +162,13 @@ export const Button = forwardRef((_ref, ref) => {
155
162
  })), {}, {
156
163
  children: buttonContents
157
164
  }));
158
- return isValidElement(Component) ? cloneElement(Component, _objectSpread({}, props), child) : createElement(Component, _objectSpread({}, props), child);
165
+ if (reactElement) {
166
+ cloneElement(reactElement, componentProps, child);
167
+ }
168
+ return _jsx(Component, _objectSpread(_objectSpread({}, componentProps), {}, {
169
+ ref: ref,
170
+ children: child
171
+ }));
159
172
  });
160
173
  Button.displayName = 'Button';
161
174
  export default Button;
@@ -1,9 +1,9 @@
1
- import React from 'react';
1
+ import React, { type ComponentRef, type ElementType, type ForwardedRef, type ReactElement } from 'react';
2
2
  import { SprinklesResponsive } from '../../styles/sprinkles.css';
3
- import { type UseBoxProps } from '../Box';
3
+ import { type BoxLikeProps } from '../Box';
4
4
  import * as styles from './Columns.css';
5
5
  type ResponsiveSpace = SprinklesResponsive['padding'];
6
- export interface ColumnsProps extends UseBoxProps {
6
+ export interface ColumnsProps {
7
7
  align?: styles.ColumnsStyle['align'];
8
8
  noWrap?: styles.ColumnsStyle['noWrap'];
9
9
  space?: ResponsiveSpace;
@@ -11,12 +11,18 @@ export interface ColumnsProps extends UseBoxProps {
11
11
  spaceY?: ResponsiveSpace;
12
12
  wrappingDirection?: styles.ColumnsStyle['wrappingDirection'];
13
13
  }
14
+ export type ColumnsPolyProps<E extends React.ElementType> = BoxLikeProps<E, ColumnsProps>;
15
+ export type ColumnsForwardRefReturn = (<E extends ElementType = 'div'>(props: ColumnsPolyProps<E> & {
16
+ ref?: ForwardedRef<ComponentRef<E>>;
17
+ }) => ReactElement | null) & {
18
+ displayName?: string;
19
+ };
14
20
  interface ColumnContextValue {
15
21
  spaceXCls: string;
16
22
  spaceYCls: string;
17
23
  isList: boolean;
18
24
  }
19
25
  export declare const ColumnContext: React.Context<ColumnContextValue | null>;
20
- export declare const Columns: React.ForwardRefExoticComponent<Omit<ColumnsProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
26
+ export declare const Columns: ColumnsForwardRefReturn;
21
27
  export default Columns;
22
28
  //# 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,KAA2D,MAAM,OAAO,CAAC;AAMhF,OAAO,EACN,mBAAmB,EAEnB,MAAM,4BAA4B,CAAC;AACpC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C,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;AAGD,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,IAAI,YAAY,CACvE,CAAC,EACD,YAAY,CACZ,CAAC;AAGF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,CAAC,SAAS,WAAW,GAAG,KAAK,EACpE,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAA;CAAE,KAChE,YAAY,GAAG,IAAI,CAAC,GAAG;IAAE,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAErD,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,EA8Ef,uBAAuB,CAAC;AAI7B,eAAe,OAAO,CAAC"}
@@ -14,7 +14,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
14
14
  export const ColumnContext = createContext(null);
15
15
  export const Columns = forwardRef((_ref, ref) => {
16
16
  let {
17
- as,
17
+ as = 'div',
18
18
  className,
19
19
  children,
20
20
  space,
@@ -40,7 +40,8 @@ export const Columns = forwardRef((_ref, ref) => {
40
40
  noWrap,
41
41
  wrappingDirection
42
42
  }), marginLeftFix, marginTopFix, className],
43
- odComponent: 'columns'
43
+ odComponent: 'columns',
44
+ ref
44
45
  }));
45
46
  const contextValue = useMemo(() => ({
46
47
  spaceXCls: sprinklesResponsive({
@@ -52,9 +53,7 @@ export const Columns = forwardRef((_ref, ref) => {
52
53
  isList: typeof as === 'string' && ['ul', 'ol'].includes(as)
53
54
  }), [as, resolvedSpaceX, resolvedSpaceY]);
54
55
  if (reactElement) {
55
- return cloneElement(reactElement, _objectSpread(_objectSpread({}, componentProps), {}, {
56
- ref
57
- }), _jsx(ColumnContext.Provider, {
56
+ return cloneElement(reactElement, componentProps, _jsx(ColumnContext.Provider, {
58
57
  value: contextValue,
59
58
  children: children
60
59
  }));
@@ -5,34 +5,21 @@ declare const meta: {
5
5
  title: string;
6
6
  component: React.FunctionComponent<import("./DropDown").Props>;
7
7
  decorators: ((Story: import("@storybook/core/csf").PartialStoryFn<import("@storybook/react").ReactRenderer, {
8
+ [x: string]: any;
9
+ [x: number]: any;
10
+ [x: symbol]: any;
8
11
  children: React.ReactNode;
9
12
  label: string;
10
13
  icon?: import("@autoguru/icons").IconType | undefined;
11
14
  isOpen?: boolean | undefined;
12
- onClick?: React.MouseEventHandler<HTMLButtonElement> | undefined;
13
- size?: import("../Button/Button.css").ButtonSize | undefined;
14
- disabled?: boolean | undefined;
15
- key?: React.Key | null | undefined;
16
- id?: string | undefined | undefined;
17
- ref?: React.Ref<HTMLButtonElement> | undefined;
18
- className?: string | undefined | undefined;
19
- testId?: string | undefined;
20
- lang?: Partial<Record<"loading", string>> | undefined;
21
- "aria-label"?: string | undefined | undefined;
22
- type?: "submit" | "reset" | "button" | undefined | undefined;
23
- rounded?: boolean | undefined;
24
- minimal?: import("../Button/Button.css").ButtonMinimal | undefined;
25
- isLoading?: boolean | undefined;
26
- isFullWidth?: boolean | undefined;
27
- withDoubleClicks?: boolean | undefined;
28
- variant?: import("../Button/Button.css").ButtonIntent | undefined;
15
+ onClick?: ComponentProps<typeof Button>["onClick"];
29
16
  alignment: any;
30
17
  }>) => React.JSX.Element)[];
31
18
  args: {
32
19
  label: string;
33
20
  children: undefined;
34
- size: "medium";
35
- variant: "primary";
21
+ size: string;
22
+ variant: string;
36
23
  };
37
24
  argTypes: {
38
25
  size: {
@@ -1 +1 @@
1
- {"version":3,"file":"DropDown.stories.d.ts","sourceRoot":"","sources":["../../../lib/components/DropDown/DropDown.stories.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAGnD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAMnC,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAqCF,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC,SAAS,CAAC,EAAE;;;;;;;CAoBjB,CAAC;AAElC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAQnC,eAAO,MAAM,OAAO,EAAE,KAarB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAK1B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAKvB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAM5B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAO5B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAc7B,CAAC"}
1
+ {"version":3,"file":"DropDown.stories.d.ts","sourceRoot":"","sources":["../../../lib/components/DropDown/DropDown.stories.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAGnD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAMnC,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAqCF,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC,SAAS,CAAC,EAAE;;;;;;;CAoBjB,CAAC;AAElC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAQnC,eAAO,MAAM,OAAO,EAAE,KAarB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAK1B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAKvB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAM5B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAO5B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAc7B,CAAC"}
@@ -17,7 +17,7 @@ declare const _default: {
17
17
  disable: boolean;
18
18
  };
19
19
  };
20
- argTypes: Partial<import("@storybook/react").ArgTypes<import("..").CustomProps & {
20
+ argTypes: Partial<import("@storybook/react").ArgTypes<import("..").CommonBoxProps & {
21
21
  borderRadius?: "1" | "none" | "min" | "sm" | "md" | "lg" | "xl" | "2xl" | "pill" | "full" | undefined;
22
22
  borderBottomColor?: "body" | "accent" | "hard" | "soft" | "success" | "info" | "danger" | "warning" | "muted" | "default" | "disabled" | undefined;
23
23
  borderLeftColor?: "body" | "accent" | "hard" | "soft" | "success" | "info" | "danger" | "warning" | "muted" | "default" | "disabled" | undefined;
@@ -391,7 +391,7 @@ declare const _default: {
391
391
  } | undefined) | import("@vanilla-extract/sprinkles").ResponsiveArray<1 | 2 | 3 | 4, "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "none" | "auto" | null>;
392
392
  } & import("../../styles/sprinkles.css").SprinklesLegacyColours & import("..").AsPolyProp<React.ElementType> & import("..").RefPolyProp<React.ElementType> & {
393
393
  children?: React.ReactNode | undefined;
394
- } & Omit<Omit<any, "ref">, "colour" | "backgroundColour" | "color" | "width" | "size" | "fontSize" | "lineHeight" | "fontWeight" | "opacity" | "alignContent" | "alignItems" | "alignSelf" | "backgroundColor" | "borderBottomColor" | "borderBottomStyle" | "borderBottomWidth" | "borderLeftColor" | "borderLeftStyle" | "borderLeftWidth" | "borderRightColor" | "borderRightStyle" | "borderRightWidth" | "borderTopColor" | "borderTopStyle" | "borderTopWidth" | "boxShadow" | "columnGap" | "display" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "height" | "justifyContent" | "justifySelf" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxWidth" | "minWidth" | "order" | "overflowX" | "overflowY" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "pointerEvents" | "position" | "rowGap" | "textAlign" | "userSelect" | "borderColor" | "borderRadius" | "borderStyle" | "borderWidth" | "gap" | "margin" | "overflow" | "padding" | "placeItems" | "text" | "bg" | "fg" | "borderBottomColour" | "borderLeftColour" | "borderRightColour" | "borderTopColour" | "borderColour" | "gridColumns" | "p" | "paddingX" | "px" | "paddingY" | "py" | "pt" | "pr" | "pb" | "pl" | "m" | "marginX" | "mx" | "marginY" | "my" | "mt" | "mr" | "mb" | "ml" | "as" | keyof import("..").CustomProps>>>;
394
+ } & Omit<Omit<any, "ref">, "colour" | "backgroundColour" | "color" | "width" | "size" | "fontSize" | "lineHeight" | "fontWeight" | "opacity" | "alignContent" | "alignItems" | "alignSelf" | "backgroundColor" | "borderBottomColor" | "borderBottomStyle" | "borderBottomWidth" | "borderLeftColor" | "borderLeftStyle" | "borderLeftWidth" | "borderRightColor" | "borderRightStyle" | "borderRightWidth" | "borderTopColor" | "borderTopStyle" | "borderTopWidth" | "boxShadow" | "columnGap" | "display" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "height" | "justifyContent" | "justifySelf" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxWidth" | "minWidth" | "order" | "overflowX" | "overflowY" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "pointerEvents" | "position" | "rowGap" | "textAlign" | "userSelect" | "borderColor" | "borderRadius" | "borderStyle" | "borderWidth" | "gap" | "margin" | "overflow" | "padding" | "placeItems" | "text" | "bg" | "fg" | "borderBottomColour" | "borderLeftColour" | "borderRightColour" | "borderTopColour" | "borderColour" | "gridColumns" | "p" | "paddingX" | "px" | "paddingY" | "py" | "pt" | "pr" | "pb" | "pl" | "m" | "marginX" | "mx" | "marginY" | "my" | "mt" | "mr" | "mb" | "ml" | "as" | keyof import("..").CommonBoxProps>>>;
395
395
  };
396
396
  export default _default;
397
397
  type Story = StoryObj<typeof LoadingBox>;
@@ -3,7 +3,7 @@ import React from 'react';
3
3
  import { Section } from '.';
4
4
  declare const _default: {
5
5
  title: string;
6
- component: React.FunctionComponent<import("../Box").CustomProps & {
6
+ component: React.FunctionComponent<import("../Box").CommonBoxProps & {
7
7
  borderRadius?: "1" | "none" | "min" | "sm" | "md" | "lg" | "xl" | "2xl" | "pill" | "full" | undefined;
8
8
  borderBottomColor?: "body" | "accent" | "hard" | "soft" | "success" | "info" | "danger" | "warning" | "muted" | "default" | "disabled" | undefined;
9
9
  borderLeftColor?: "body" | "accent" | "hard" | "soft" | "success" | "info" | "danger" | "warning" | "muted" | "default" | "disabled" | undefined;
@@ -377,7 +377,7 @@ declare const _default: {
377
377
  } | undefined) | import("@vanilla-extract/sprinkles").ResponsiveArray<1 | 2 | 3 | 4, "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "none" | "auto" | null>;
378
378
  } & import("../../styles/sprinkles.css").SprinklesLegacyColours & import("../Box").AsPolyProp<"div"> & import("../Box").RefPolyProp<"div"> & {
379
379
  children?: React.ReactNode | undefined;
380
- } & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "colour" | "backgroundColour" | "color" | "width" | "size" | "fontSize" | "lineHeight" | "fontWeight" | "opacity" | "alignContent" | "alignItems" | "alignSelf" | "backgroundColor" | "borderBottomColor" | "borderBottomStyle" | "borderBottomWidth" | "borderLeftColor" | "borderLeftStyle" | "borderLeftWidth" | "borderRightColor" | "borderRightStyle" | "borderRightWidth" | "borderTopColor" | "borderTopStyle" | "borderTopWidth" | "boxShadow" | "columnGap" | "display" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "height" | "justifyContent" | "justifySelf" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxWidth" | "minWidth" | "order" | "overflowX" | "overflowY" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "pointerEvents" | "position" | "rowGap" | "textAlign" | "userSelect" | "borderColor" | "borderRadius" | "borderStyle" | "borderWidth" | "gap" | "margin" | "overflow" | "padding" | "placeItems" | "text" | "bg" | "fg" | "borderBottomColour" | "borderLeftColour" | "borderRightColour" | "borderTopColour" | "borderColour" | "gridColumns" | "p" | "paddingX" | "px" | "paddingY" | "py" | "pt" | "pr" | "pb" | "pl" | "m" | "marginX" | "mx" | "marginY" | "my" | "mt" | "mr" | "mb" | "ml" | "as" | keyof import("../Box").CustomProps> & import("./Section").SectionProps>;
380
+ } & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "colour" | "backgroundColour" | "color" | "width" | "size" | "fontSize" | "lineHeight" | "fontWeight" | "opacity" | "alignContent" | "alignItems" | "alignSelf" | "backgroundColor" | "borderBottomColor" | "borderBottomStyle" | "borderBottomWidth" | "borderLeftColor" | "borderLeftStyle" | "borderLeftWidth" | "borderRightColor" | "borderRightStyle" | "borderRightWidth" | "borderTopColor" | "borderTopStyle" | "borderTopWidth" | "boxShadow" | "columnGap" | "display" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "height" | "justifyContent" | "justifySelf" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxWidth" | "minWidth" | "order" | "overflowX" | "overflowY" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "pointerEvents" | "position" | "rowGap" | "textAlign" | "userSelect" | "borderColor" | "borderRadius" | "borderStyle" | "borderWidth" | "gap" | "margin" | "overflow" | "padding" | "placeItems" | "text" | "bg" | "fg" | "borderBottomColour" | "borderLeftColour" | "borderRightColour" | "borderTopColour" | "borderColour" | "gridColumns" | "p" | "paddingX" | "px" | "paddingY" | "py" | "pt" | "pr" | "pb" | "pl" | "m" | "marginX" | "mx" | "marginY" | "my" | "mt" | "mr" | "mb" | "ml" | "as" | keyof import("../Box").CommonBoxProps> & import("./Section").SectionProps>;
381
381
  argTypes: {
382
382
  paddingX: import("@storybook/core/csf").InputType | undefined;
383
383
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autoguru/overdrive",
3
- "version": "4.43.0-next.4",
3
+ "version": "4.43.0-next.5",
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",