@autoguru/overdrive 4.43.7 → 4.43.8-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.
- package/dist/components/Alert/Alert.d.ts.map +1 -1
- package/dist/components/Alert/Alert.js +9 -10
- package/dist/components/Anchor/Anchor.d.ts +2 -1
- package/dist/components/Anchor/Anchor.d.ts.map +1 -1
- package/dist/components/Anchor/Anchor.js +15 -11
- package/dist/components/Badge/Badge.d.ts +3 -3
- package/dist/components/Badge/Badge.d.ts.map +1 -1
- package/dist/components/Badge/Badge.js +6 -11
- package/dist/components/Box/Box.d.ts +5 -10
- package/dist/components/Box/Box.d.ts.map +1 -1
- package/dist/components/Box/Box.js +13 -13
- package/dist/components/Box/index.d.ts +2 -2
- package/dist/components/Box/index.d.ts.map +1 -1
- package/dist/components/Box/index.js +1 -1
- package/dist/components/Box/newBox/useBox.d.ts +6 -3
- package/dist/components/Box/newBox/useBox.d.ts.map +1 -1
- package/dist/components/Box/newBox/useBox.js +17 -6
- package/dist/components/BulletList/BulletList.d.ts.map +1 -1
- package/dist/components/BulletList/BulletList.js +1 -0
- package/dist/components/Button/Button.d.ts +3 -2
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/components/Button/Button.js +13 -13
- package/dist/components/Columns/Column.js +3 -3
- package/dist/components/Columns/Columns.js +4 -4
- package/dist/components/DateTimePicker/DateTimePicker.d.ts +3 -3
- package/dist/components/DateTimePicker/DateTimePicker.d.ts.map +1 -1
- package/dist/components/DateTimePicker/DateTimePicker.js +1 -1
- package/dist/components/DividerLine/DividerLine.d.ts.map +1 -1
- package/dist/components/DividerLine/DividerLine.js +2 -1
- package/dist/components/DropDown/DropDownOption.js +3 -3
- package/dist/components/EditableText/EditableText.d.ts.map +1 -1
- package/dist/components/EditableText/EditableText.js +2 -1
- package/dist/components/Heading/Heading.d.ts +3 -4
- package/dist/components/Heading/Heading.d.ts.map +1 -1
- package/dist/components/Heading/Heading.js +6 -6
- package/dist/components/Icon/Icon.d.ts.map +1 -1
- package/dist/components/Icon/Icon.js +2 -1
- package/dist/components/Inline/Inline.d.ts +1 -1
- package/dist/components/Inline/Inline.d.ts.map +1 -1
- package/dist/components/Inline/Inline.js +2 -3
- package/dist/components/IntentStripe/IntentStripe.d.ts.map +1 -1
- package/dist/components/IntentStripe/IntentStripe.js +2 -1
- package/dist/components/LinearProgressIndicator/LinearProgressIndicator.d.ts.map +1 -1
- package/dist/components/LinearProgressIndicator/LinearProgressIndicator.js +1 -0
- package/dist/components/LoadingBox/LoadingBox.d.ts.map +1 -1
- package/dist/components/LoadingBox/LoadingBox.js +5 -4
- package/dist/components/NumberBubble/NumberBubble.d.ts.map +1 -1
- package/dist/components/NumberBubble/NumberBubble.js +2 -1
- package/dist/components/OptionGrid/OptionGrid.d.ts +3 -3
- package/dist/components/OptionGrid/OptionGrid.d.ts.map +1 -1
- package/dist/components/OptionGrid/OptionGrid.js +1 -1
- package/dist/components/OptionList/OptionList.d.ts +4 -4
- package/dist/components/OptionList/OptionList.d.ts.map +1 -1
- package/dist/components/OptionList/OptionList.js +1 -1
- package/dist/components/OrderedList/OrderedList.d.ts.map +1 -1
- package/dist/components/OrderedList/OrderedList.js +5 -4
- package/dist/components/Pagination/Bubble.js +2 -2
- package/dist/components/Positioner/Positioner.d.ts.map +1 -1
- package/dist/components/Positioner/Positioner.js +1 -0
- package/dist/components/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/components/ProgressBar/ProgressBar.js +1 -0
- package/dist/components/ProgressBarGroup/ProgressBarGroup.d.ts.map +1 -1
- package/dist/components/ProgressBarGroup/ProgressBarGroup.js +1 -0
- package/dist/components/ProgressSpinner/ProgressSpinner.d.ts.map +1 -1
- package/dist/components/ProgressSpinner/ProgressSpinner.js +1 -0
- package/dist/components/ScrollPane/ScrollPane.d.ts.map +1 -1
- package/dist/components/ScrollPane/ScrollPane.js +4 -2
- package/dist/components/SearchBar/SearchBar.d.ts +3 -3
- package/dist/components/SearchBar/SearchBar.d.ts.map +1 -1
- package/dist/components/SearchBar/SearchBar.js +1 -1
- package/dist/components/Stack/Stack.d.ts +1 -1
- package/dist/components/Stack/Stack.d.ts.map +1 -1
- package/dist/components/Stack/Stack.js +1 -2
- package/dist/components/StarRating/StarRating.js +1 -0
- package/dist/components/Stepper/Stepper.d.ts.map +1 -1
- package/dist/components/Stepper/Stepper.js +1 -0
- package/dist/components/StickyBox/StickyBox.d.ts.map +1 -1
- package/dist/components/StickyBox/StickyBox.js +4 -2
- package/dist/components/Switch/Switch.d.ts +3 -3
- package/dist/components/Switch/Switch.d.ts.map +1 -1
- package/dist/components/Switch/Switch.js +9 -11
- package/dist/components/Table/Table.d.ts.map +1 -1
- package/dist/components/Table/Table.js +1 -0
- package/dist/components/Tabs/Tab.js +5 -5
- package/dist/components/Text/Text.d.ts +7 -8
- package/dist/components/Text/Text.d.ts.map +1 -1
- package/dist/components/Text/Text.js +20 -24
- package/dist/components/Text/index.d.ts +1 -2
- package/dist/components/Text/index.d.ts.map +1 -1
- package/dist/components/Text/index.js +1 -1
- package/dist/components/Text/textStyles.d.ts +4 -16
- package/dist/components/Text/textStyles.d.ts.map +1 -1
- package/dist/components/Text/textStyles.js +19 -17
- package/dist/components/TextBubble/TextBubble.d.ts.map +1 -1
- package/dist/components/TextBubble/TextBubble.js +2 -1
- package/dist/components/TextLink/TextLink.js +5 -5
- package/dist/components/VisuallyHidden/VisuallyHidden.d.ts +1 -1
- package/dist/components/VisuallyHidden/VisuallyHidden.d.ts.map +1 -1
- package/dist/components/VisuallyHidden/VisuallyHidden.js +1 -0
- package/dist/components/private/CheckableBase/CheckableBase.d.ts.map +1 -1
- package/dist/components/private/CheckableBase/CheckableBase.js +5 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/styles/componentStyles.d.ts +13 -0
- package/dist/styles/componentStyles.d.ts.map +1 -0
- package/dist/styles/componentStyles.js +27 -0
- package/dist/styles/{element.css.d.ts → elementReset.css.d.ts} +6 -3
- package/dist/styles/elementReset.css.d.ts.map +1 -0
- package/dist/styles/{element.css.js → elementReset.css.js} +8 -4
- package/dist/styles/index.d.ts +4 -3
- package/dist/styles/index.d.ts.map +1 -1
- package/dist/styles/index.js +4 -3
- package/dist/styles/sprinkles.css.d.ts +57 -64
- package/dist/styles/sprinkles.css.d.ts.map +1 -1
- package/dist/styles/sprinkles.css.js +51 -102
- package/dist/styles/typography.css.d.ts +51 -12
- package/dist/styles/typography.css.d.ts.map +1 -1
- package/dist/styles/typography.css.js +98 -17
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/object.d.ts +2 -0
- package/dist/utils/object.d.ts.map +1 -0
- package/dist/utils/object.js +3 -0
- package/package.json +9 -9
- package/dist/components/Box/newBox/boxStyles.d.ts +0 -462
- package/dist/components/Box/newBox/boxStyles.d.ts.map +0 -1
- package/dist/components/Box/newBox/boxStyles.js +0 -38
- package/dist/components/Box/useBoxStyles.css.d.ts +0 -48
- package/dist/components/Box/useBoxStyles.css.d.ts.map +0 -1
- package/dist/components/Box/useBoxStyles.css.js +0 -141
- package/dist/components/Box/useBoxStyles.d.ts +0 -69
- package/dist/components/Box/useBoxStyles.d.ts.map +0 -1
- package/dist/components/Box/useBoxStyles.js +0 -80
- package/dist/components/Text/useTextStyles.css.d.ts +0 -8
- package/dist/components/Text/useTextStyles.css.d.ts.map +0 -1
- package/dist/components/Text/useTextStyles.css.js +0 -40
- package/dist/components/Text/useTextStyles.d.ts +0 -22
- package/dist/components/Text/useTextStyles.d.ts.map +0 -1
- package/dist/components/Text/useTextStyles.js +0 -24
- package/dist/styles/element.css.d.ts.map +0 -1
- package/dist/styles/elementStyles.d.ts +0 -10
- package/dist/styles/elementStyles.d.ts.map +0 -1
- package/dist/styles/elementStyles.js +0 -30
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../../lib/components/Alert/Alert.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../../lib/components/Alert/Alert.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKrE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAK5D,KAAK,iBAAiB,GAAG,cAAc,CAAC,OAAO,YAAY,CAAC,CAAC;AAG7D,MAAM,WAAW,KAAM,SAAQ,iBAAiB;IAC/C,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,cAAc,CAAC,EAAE,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC;CAC1D;AASD,eAAO,MAAM,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAoE1C,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -4,12 +4,12 @@ import { AlertCircleIcon, AlertIcon, CheckCircleIcon, InformationIcon, WindowClo
|
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { sprinkles } from "../../styles/index.js";
|
|
7
|
+
import { sprinklesLegacyText } from "../../styles/typography.css.js";
|
|
7
8
|
import { Box } from "../Box/Box.js";
|
|
8
9
|
import { Button } from "../Button/Button.js";
|
|
9
10
|
import { Icon } from "../Icon/Icon.js";
|
|
10
11
|
import { IntentStripe } from "../IntentStripe/IntentStripe.js";
|
|
11
12
|
import { Text } from "../Text/Text.js";
|
|
12
|
-
import { useTextStyles } from "../Text/useTextStyles.js";
|
|
13
13
|
import * as styles from "./Alert.css.js";
|
|
14
14
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
15
|
const iconMapForIntent = {
|
|
@@ -27,14 +27,10 @@ export const Alert = _ref => {
|
|
|
27
27
|
onRequestClose,
|
|
28
28
|
dismissible = typeof onRequestClose === 'function'
|
|
29
29
|
} = _ref;
|
|
30
|
-
const dismissBtnStyles = useTextStyles({
|
|
31
|
-
colour: 'muted'
|
|
32
|
-
});
|
|
33
|
-
const intentColourStyles = useTextStyles({
|
|
34
|
-
colour: intent
|
|
35
|
-
});
|
|
36
30
|
return _jsxs(Box, {
|
|
37
|
-
className: clsx(className,
|
|
31
|
+
className: clsx(className, sprinklesLegacyText({
|
|
32
|
+
color: intent
|
|
33
|
+
}), {
|
|
38
34
|
[styles.contained]: !inline
|
|
39
35
|
}),
|
|
40
36
|
role: "alert",
|
|
@@ -46,6 +42,7 @@ export const Alert = _ref => {
|
|
|
46
42
|
borderRadius: "1",
|
|
47
43
|
boxShadow: inline ? 'none' : '4',
|
|
48
44
|
padding: "2",
|
|
45
|
+
odComponent: "alert",
|
|
49
46
|
children: [_jsx(IntentStripe, {
|
|
50
47
|
intent: intent
|
|
51
48
|
}), _jsxs(Box, {
|
|
@@ -64,7 +61,7 @@ export const Alert = _ref => {
|
|
|
64
61
|
}), _jsx(Box, {
|
|
65
62
|
alignSelf: "center",
|
|
66
63
|
width: "auto",
|
|
67
|
-
className:
|
|
64
|
+
className: sprinkles({
|
|
68
65
|
colour: 'dark'
|
|
69
66
|
}),
|
|
70
67
|
children: typeof children === 'string' ? _jsx(Text, {
|
|
@@ -80,7 +77,9 @@ export const Alert = _ref => {
|
|
|
80
77
|
"aria-label": "close",
|
|
81
78
|
onClick: onRequestClose,
|
|
82
79
|
children: _jsx(Icon, {
|
|
83
|
-
className:
|
|
80
|
+
className: sprinkles({
|
|
81
|
+
colour: 'muted'
|
|
82
|
+
}),
|
|
84
83
|
icon: WindowCloseIcon,
|
|
85
84
|
size: "medium"
|
|
86
85
|
})
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IconType } from '@autoguru/icons';
|
|
2
2
|
import { AnchorHTMLAttributes, ElementType, FunctionComponent, ReactElement, ReactNode } from 'react';
|
|
3
|
-
|
|
3
|
+
import { BoxProps } from '../Box/Box';
|
|
4
|
+
export interface Props extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'children' | 'style' | 'is'>, Pick<BoxProps, 'testId'> {
|
|
4
5
|
className?: string;
|
|
5
6
|
is?: ElementType | ReactElement;
|
|
6
7
|
disabled?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Anchor.d.ts","sourceRoot":"","sources":["../../../lib/components/Anchor/Anchor.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAG3C,OAAO,EACN,oBAAoB,EAGpB,WAAW,EACX,iBAAiB,EAEjB,YAAY,EACZ,SAAS,EACT,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Anchor.d.ts","sourceRoot":"","sources":["../../../lib/components/Anchor/Anchor.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAG3C,OAAO,EACN,oBAAoB,EAGpB,WAAW,EACX,iBAAiB,EAEjB,YAAY,EACZ,SAAS,EACT,MAAM,OAAO,CAAC;AAKf,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAOtC,MAAM,WAAW,KAChB,SAAQ,IAAI,CACV,oBAAoB,CAAC,iBAAiB,CAAC,EACvC,UAAU,GAAG,OAAO,GAAG,IAAI,CAC3B,EACD,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,EAAE,CAAC,EAAE,WAAW,GAAG,YAAY,CAAC;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB,IAAI,CAAC,EAAE,QAAQ,CAAC;CAChB;AAED,eAAO,MAAM,MAAM,EAAE,iBAAiB,CAAC,KAAK,CA6C3C,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -2,17 +2,18 @@
|
|
|
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 = ["className", "is", "disabled", "children", "icon"];
|
|
5
|
+
const _excluded = ["className", "is", "disabled", "testId", "children", "icon"];
|
|
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 clsx from 'clsx';
|
|
9
9
|
import * as React from 'react';
|
|
10
10
|
import { cloneElement, createElement, isValidElement } from 'react';
|
|
11
|
-
import { componentStyles } from "../../styles/
|
|
11
|
+
import { componentStyles } from "../../styles/componentStyles.js";
|
|
12
|
+
import { sprinkles } from "../../styles/sprinkles.css.js";
|
|
13
|
+
import { dataAttrs } from "../../utils/dataAttrs.js";
|
|
12
14
|
import { Icon } from "../Icon/Icon.js";
|
|
13
15
|
import { Inline } from "../Inline/Inline.js";
|
|
14
16
|
import { Text } from "../Text/Text.js";
|
|
15
|
-
import { useTextStyles } from "../Text/useTextStyles.js";
|
|
16
17
|
import * as styles from "./Anchor.css.js";
|
|
17
18
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
19
|
export const Anchor = _ref => {
|
|
@@ -20,28 +21,31 @@ export const Anchor = _ref => {
|
|
|
20
21
|
className = '',
|
|
21
22
|
is: Component = 'a',
|
|
22
23
|
disabled = false,
|
|
24
|
+
testId,
|
|
23
25
|
children,
|
|
24
26
|
icon
|
|
25
27
|
} = _ref,
|
|
26
28
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
27
|
-
const
|
|
28
|
-
colour: 'link'
|
|
29
|
-
});
|
|
30
|
-
const props = _objectSpread({
|
|
29
|
+
const props = _objectSpread(_objectSpread({
|
|
31
30
|
className: clsx(componentStyles({
|
|
32
31
|
as: Component,
|
|
32
|
+
colour: 'link',
|
|
33
33
|
display: 'inline'
|
|
34
|
-
}), styles.root,
|
|
34
|
+
}), styles.root, className),
|
|
35
35
|
disabled
|
|
36
|
-
},
|
|
36
|
+
}, dataAttrs({
|
|
37
|
+
testid: testId
|
|
38
|
+
})), rest);
|
|
37
39
|
const childs = _jsxs(Inline, {
|
|
38
40
|
space: "2",
|
|
39
41
|
children: [icon && _jsx(Icon, {
|
|
40
42
|
icon: icon,
|
|
41
43
|
size: "small",
|
|
42
|
-
className:
|
|
44
|
+
className: sprinkles({
|
|
45
|
+
colour: 'link'
|
|
46
|
+
})
|
|
43
47
|
}), _jsx(Text, {
|
|
44
|
-
|
|
48
|
+
weight: "bold",
|
|
45
49
|
size: "4",
|
|
46
50
|
colour: "link",
|
|
47
51
|
children: children
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type
|
|
2
|
+
import { type BoxProps } from '../Box/Box';
|
|
3
3
|
import type { StyledBadgeProps } from './Badge.css';
|
|
4
4
|
type Colours = Exclude<StyledBadgeProps['colour'], undefined>;
|
|
5
|
-
export interface BadgeProps {
|
|
5
|
+
export interface BadgeProps extends Pick<BoxProps, 'testId'> {
|
|
6
6
|
label: string;
|
|
7
7
|
colour?: Colours;
|
|
8
8
|
className?: string;
|
|
9
9
|
look?: 'standard' | 'inverted';
|
|
10
10
|
size?: StyledBadgeProps['size'];
|
|
11
11
|
}
|
|
12
|
-
export declare const Badge: ({ label, colour, look, size, className, testId, }:
|
|
12
|
+
export declare const Badge: ({ label, colour, look, size, className, testId, }: BadgeProps) => React.JSX.Element;
|
|
13
13
|
export {};
|
|
14
14
|
//# sourceMappingURL=Badge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../lib/components/Badge/Badge.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../lib/components/Badge/Badge.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAO,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGhD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,KAAK,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,CAAC;AAE9D,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAE3D,KAAK,EAAE,MAAM,CAAC;IAEd,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,IAAI,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;IAE/B,IAAI,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;CAChC;AAQD,eAAO,MAAM,KAAK,GAAI,mDAOnB,UAAU,sBAyBZ,CAAC"}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
3
|
import { invariant } from '@autoguru/utilities';
|
|
7
4
|
import clsx from 'clsx';
|
|
8
5
|
import React from 'react';
|
|
9
|
-
import {
|
|
10
|
-
import { Box } from "../Box/index.js";
|
|
6
|
+
import { Box } from "../Box/Box.js";
|
|
11
7
|
import * as styles from "./Badge.css.js";
|
|
12
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
9
|
export const Badge = _ref => {
|
|
@@ -21,16 +17,15 @@ export const Badge = _ref => {
|
|
|
21
17
|
} = _ref;
|
|
22
18
|
!['string', 'number'].includes(typeof label) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Badge `label` can only contain strings or numbers') : invariant(false) : void 0;
|
|
23
19
|
const inverted = look === 'inverted';
|
|
24
|
-
return _jsx(Box,
|
|
20
|
+
return _jsx(Box, {
|
|
25
21
|
className: clsx([styles.styledBadge({
|
|
26
22
|
colour,
|
|
27
23
|
inverted,
|
|
28
24
|
size
|
|
29
25
|
}), className]),
|
|
30
|
-
borderRadius: "1"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
})), {}, {
|
|
26
|
+
borderRadius: "1",
|
|
27
|
+
odComponent: "badge",
|
|
28
|
+
testId: testId,
|
|
34
29
|
children: label
|
|
35
|
-
})
|
|
30
|
+
});
|
|
36
31
|
};
|
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { AllHTMLAttributes, ElementType, PropsWithChildren, ReactNode } from 'react';
|
|
1
|
+
import type { AllHTMLAttributes, ElementType, PropsWithChildren } from 'react';
|
|
3
2
|
import React from 'react';
|
|
4
|
-
import { type
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
odComponent?: string;
|
|
8
|
-
testId?: string;
|
|
3
|
+
import { type ComponentStylesProps } from '../../styles/componentStyles';
|
|
4
|
+
import { OdComponent, TestId } from '../../types';
|
|
5
|
+
export interface CommonBoxProps extends OdComponent, PropsWithChildren, TestId {
|
|
9
6
|
}
|
|
10
|
-
export interface BoxProps extends
|
|
7
|
+
export interface BoxProps extends Omit<AllHTMLAttributes<HTMLElement>, 'as' | 'className' | 'color' | 'height' | 'is' | 'size' | 'width'>, CommonBoxProps, ComponentStylesProps {
|
|
11
8
|
as?: ElementType;
|
|
12
|
-
is?: ElementType;
|
|
13
|
-
children?: ReactNode;
|
|
14
9
|
}
|
|
15
10
|
export declare const Box: React.ForwardRefExoticComponent<BoxProps & React.RefAttributes<HTMLElement>>;
|
|
16
11
|
//# sourceMappingURL=Box.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Box.d.ts","sourceRoot":"","sources":["../../../lib/components/Box/Box.tsx"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"Box.d.ts","sourceRoot":"","sources":["../../../lib/components/Box/Box.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/E,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,EAEN,KAAK,oBAAoB,EACzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAMlD,MAAM,WAAW,cAChB,SAAQ,WAAW,EAClB,iBAAiB,EACjB,MAAM;CAAG;AAEX,MAAM,WAAW,QAChB,SAAQ,IAAI,CACV,iBAAiB,CAAC,WAAW,CAAC,EAC9B,IAAI,GAAG,WAAW,GAAG,OAAO,GAAG,QAAQ,GAAG,IAAI,GAAG,MAAM,GAAG,OAAO,CACjE,EACD,cAAc,EACd,oBAAoB;IAErB,EAAE,CAAC,EAAE,WAAW,CAAC;CACjB;AAKD,eAAO,MAAM,GAAG,8EA6Pf,CAAC"}
|
|
@@ -2,22 +2,18 @@
|
|
|
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 = ["
|
|
5
|
+
const _excluded = ["as", "children", "className", "odComponent", "testId", "display", "height", "maxWidth", "minWidth", "overflow", "overflowX", "overflowY", "pointerEvents", "position", "size", "userSelect", "useVar", "width", "bg", "backgroundColor", "backgroundColour", "boxShadow", "color", "colour", "fg", "opacity", "fontSize", "fontWeight", "lineHeight", "text", "textAlign", "textWrap", "borderRadius", "borderColor", "borderStyle", "borderWidth", "borderWidthX", "borderWidthY", "borderBottomColor", "borderBottomStyle", "borderBottomWidth", "borderLeftColor", "borderLeftStyle", "borderLeftWidth", "borderRightColor", "borderRightStyle", "borderRightWidth", "borderTopColor", "borderTopStyle", "borderTopWidth", "borderWidthTop", "borderWidthRight", "borderWidthBottom", "borderWidthLeft", "borderColour", "borderColourX", "borderColourY", "borderBottomColour", "borderLeftColour", "borderRightColour", "borderTopColour", "alignContent", "alignItems", "alignSelf", "columnGap", "flexDirection", "flexGrow", "flexShrink", "flexWrap", "gap", "gridAutoColumns", "gridAutoFlow", "gridAutoRows", "gridColumns", "justifyContent", "placeItems", "rowGap", "order", "m", "mb", "ml", "mr", "mt", "mx", "my", "margin", "marginX", "marginY", "marginBottom", "marginLeft", "marginRight", "marginTop", "p", "pb", "pl", "pr", "pt", "px", "py", "padding", "paddingX", "paddingY", "paddingBottom", "paddingLeft", "paddingRight", "paddingTop"];
|
|
6
6
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
7
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
|
-
import clsx from 'clsx';
|
|
9
8
|
import React, { forwardRef } from 'react';
|
|
10
|
-
import {
|
|
11
|
-
import { elementResetStyles } from "../../styles/elementStyles.js";
|
|
12
|
-
import { sprinkles } from "../../styles/sprinkles.css.js";
|
|
9
|
+
import { componentStyles } from "../../styles/componentStyles.js";
|
|
13
10
|
import { dataAttrs } from "../../utils/dataAttrs.js";
|
|
14
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
12
|
export const Box = forwardRef((_ref, ref) => {
|
|
16
13
|
let {
|
|
17
|
-
|
|
18
|
-
as = is,
|
|
14
|
+
as = 'div',
|
|
19
15
|
children,
|
|
20
|
-
className
|
|
16
|
+
className,
|
|
21
17
|
odComponent,
|
|
22
18
|
testId,
|
|
23
19
|
display,
|
|
@@ -99,6 +95,7 @@ export const Box = forwardRef((_ref, ref) => {
|
|
|
99
95
|
mr,
|
|
100
96
|
mt,
|
|
101
97
|
mx,
|
|
98
|
+
my,
|
|
102
99
|
margin,
|
|
103
100
|
marginX,
|
|
104
101
|
marginY,
|
|
@@ -112,6 +109,7 @@ export const Box = forwardRef((_ref, ref) => {
|
|
|
112
109
|
pr,
|
|
113
110
|
pt,
|
|
114
111
|
px,
|
|
112
|
+
py,
|
|
115
113
|
padding,
|
|
116
114
|
paddingX,
|
|
117
115
|
paddingY,
|
|
@@ -122,8 +120,9 @@ export const Box = forwardRef((_ref, ref) => {
|
|
|
122
120
|
} = _ref,
|
|
123
121
|
allOtherProps = _objectWithoutProperties(_ref, _excluded);
|
|
124
122
|
const Component = as;
|
|
125
|
-
const
|
|
126
|
-
|
|
123
|
+
const allClasses = componentStyles({
|
|
124
|
+
as,
|
|
125
|
+
className,
|
|
127
126
|
display,
|
|
128
127
|
height,
|
|
129
128
|
maxWidth,
|
|
@@ -203,6 +202,7 @@ export const Box = forwardRef((_ref, ref) => {
|
|
|
203
202
|
mr,
|
|
204
203
|
mt,
|
|
205
204
|
mx,
|
|
205
|
+
my,
|
|
206
206
|
margin,
|
|
207
207
|
marginX,
|
|
208
208
|
marginY,
|
|
@@ -216,6 +216,7 @@ export const Box = forwardRef((_ref, ref) => {
|
|
|
216
216
|
pr,
|
|
217
217
|
pt,
|
|
218
218
|
px,
|
|
219
|
+
py,
|
|
219
220
|
padding,
|
|
220
221
|
paddingX,
|
|
221
222
|
paddingY,
|
|
@@ -224,12 +225,11 @@ export const Box = forwardRef((_ref, ref) => {
|
|
|
224
225
|
paddingRight,
|
|
225
226
|
paddingTop
|
|
226
227
|
});
|
|
227
|
-
const className = clsx(elementResetStyles(as), hasBorder && borderReset, styles, _className);
|
|
228
228
|
return _jsx(Component, _objectSpread(_objectSpread(_objectSpread({}, allOtherProps), dataAttrs({
|
|
229
229
|
'od-component': odComponent === null || odComponent === void 0 ? void 0 : odComponent.toLocaleLowerCase(),
|
|
230
|
-
testId
|
|
230
|
+
testid: testId
|
|
231
231
|
})), {}, {
|
|
232
|
-
className:
|
|
232
|
+
className: allClasses,
|
|
233
233
|
ref: ref,
|
|
234
234
|
children: children
|
|
235
235
|
}));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { Box, type BoxProps } from './Box';
|
|
2
|
-
export { useBoxStyles } from '
|
|
3
|
-
export type { BoxStyleProps } from '
|
|
2
|
+
export { componentStyles as useBoxStyles } from '../../styles/componentStyles';
|
|
3
|
+
export type { ComponentStylesProps as BoxStyleProps } from '../../styles/componentStyles';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/components/Box/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,KAAK,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/components/Box/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,KAAK,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,eAAe,IAAI,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC/E,YAAY,EAAE,oBAAoB,IAAI,aAAa,EAAE,MAAM,8BAA8B,CAAC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { type ComponentPropsWithRef, type ComponentPropsWithoutRef, type ElementType, type PropsWithChildren, type ReactElement } from 'react';
|
|
2
|
+
import { type ComponentStylesProps } from '../../../styles/componentStyles';
|
|
3
|
+
import type { Sprinkles } from '../../../styles/sprinkles.css';
|
|
2
4
|
import type { CommonBoxProps } from '../Box';
|
|
3
|
-
|
|
5
|
+
export type BoxStylesProps<E extends ElementType = 'div'> = AsPolyProp<E> & Pick<ComponentStylesProps, 'className'> & Sprinkles;
|
|
6
|
+
export type BoxStylesReturn<P extends object> = [string, P];
|
|
4
7
|
export type PolymorphicRef<C extends ElementType> = ComponentPropsWithRef<C>['ref'];
|
|
5
8
|
export type AsPolyProp<C extends ElementType> = {
|
|
6
9
|
as?: C | ReactElement;
|
|
@@ -10,8 +13,8 @@ export type RefPolyProp<C extends ElementType> = {
|
|
|
10
13
|
};
|
|
11
14
|
export type PropsToOmit<C extends ElementType, P> = keyof (AsPolyProp<C> & P);
|
|
12
15
|
export type PolymorphicComponentProps<C extends ElementType, Props = object> = PropsWithChildren<Props & AsPolyProp<C> & RefPolyProp<C>> & Omit<ComponentPropsWithoutRef<C>, PropsToOmit<C, Props>>;
|
|
13
|
-
export type UseBoxProps<E extends ElementType = 'div'> = PolymorphicComponentProps<E, CommonBoxProps &
|
|
14
|
-
export type BoxLikeProps<E extends ElementType, P = object> = PolymorphicComponentProps<E, Omit<
|
|
16
|
+
export type UseBoxProps<E extends ElementType = 'div'> = PolymorphicComponentProps<E, CommonBoxProps & Sprinkles>;
|
|
17
|
+
export type BoxLikeProps<E extends ElementType, P = object> = PolymorphicComponentProps<E, Omit<Sprinkles, keyof P> & CommonBoxProps & P>;
|
|
15
18
|
export declare const useBox: <E extends ElementType = "div">({ as: _as, className: _className, odComponent, testId, ...props }: UseBoxProps<E>) => {
|
|
16
19
|
Component: ElementType;
|
|
17
20
|
componentProps: ComponentPropsWithRef<E>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBox.d.ts","sourceRoot":"","sources":["../../../../lib/components/Box/newBox/useBox.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,WAAW,EAEhB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useBox.d.ts","sourceRoot":"","sources":["../../../../lib/components/Box/newBox/useBox.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,WAAW,EAEhB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,MAAM,OAAO,CAAC;AAGf,OAAO,EAEN,KAAK,oBAAoB,EACzB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAG/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAQ7C,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,WAAW,GAAG,KAAK,IAAI,UAAU,CAAC,CAAC,CAAC,GACxE,IAAI,CAAC,oBAAoB,EAAE,WAAW,CAAC,GACvC,SAAS,CAAC;AAEX,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;AAG5D,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;CAGtB,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,cAAc,GAAG,SAAS,CAAC,CAAC;AAM1D,MAAM,MAAM,YAAY,CACvB,CAAC,SAAS,WAAW,EACrB,CAAC,GAAG,MAAM,IACP,yBAAyB,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,GAAG,cAAc,GAAG,CAAC,CAAC,CAAC;AAYhF,eAAO,MAAM,MAAM,GAAI,CAAC,SAAS,WAAW,GAAG,KAAK,EAAE,mEAMnD,WAAW,CAAC,CAAC,CAAC;;;;;CAmChB,CAAC"}
|
|
@@ -7,8 +7,9 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
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 { isValidElement } from 'react';
|
|
9
9
|
import { useDeepCompareMemo } from "../../../hooks/index.js";
|
|
10
|
+
import { componentStyles } from "../../../styles/componentStyles.js";
|
|
10
11
|
import { dataAttrs } from "../../../utils/dataAttrs.js";
|
|
11
|
-
import {
|
|
12
|
+
import { filterPropsWithStyles } from "../../../utils/sprinkles.js";
|
|
12
13
|
const DEFAULT_TAG = 'div';
|
|
13
14
|
const LIST_ITEM_TAG = 'li';
|
|
14
15
|
const LIST_TAGS = ['ul', 'ol'];
|
|
@@ -29,13 +30,23 @@ export const useBox = _ref => {
|
|
|
29
30
|
const {
|
|
30
31
|
className,
|
|
31
32
|
baseProps
|
|
32
|
-
} = useDeepCompareMemo(() =>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
} = useDeepCompareMemo(() => {
|
|
34
|
+
const {
|
|
35
|
+
sprinklesProps,
|
|
36
|
+
baseProps
|
|
37
|
+
} = filterPropsWithStyles(props);
|
|
38
|
+
const className = componentStyles(_objectSpread({
|
|
39
|
+
as,
|
|
40
|
+
className: _className
|
|
41
|
+
}, sprinklesProps));
|
|
42
|
+
return {
|
|
43
|
+
className,
|
|
44
|
+
baseProps
|
|
45
|
+
};
|
|
46
|
+
}, [as, _className, props]);
|
|
36
47
|
const componentProps = _objectSpread(_objectSpread(_objectSpread({}, baseProps), dataAttrs({
|
|
37
48
|
[OD_COMPONENT_ATTR]: odComponent === null || odComponent === void 0 ? void 0 : odComponent.toLocaleLowerCase(),
|
|
38
|
-
testId
|
|
49
|
+
testid: testId
|
|
39
50
|
})), {}, {
|
|
40
51
|
className
|
|
41
52
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BulletList.d.ts","sourceRoot":"","sources":["../../../lib/components/BulletList/BulletList.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAc,MAAM,OAAO,CAAC;AAOjE,MAAM,WAAW,eAAe;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACrB;AAED,eAAO,MAAM,UAAU,EAAE,iBAAiB,CAAC,eAAe,
|
|
1
|
+
{"version":3,"file":"BulletList.d.ts","sourceRoot":"","sources":["../../../lib/components/BulletList/BulletList.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAc,MAAM,OAAO,CAAC;AAOjE,MAAM,WAAW,eAAe;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACrB;AAED,eAAO,MAAM,UAAU,EAAE,iBAAiB,CAAC,eAAe,CAoBzD,CAAC"}
|
|
@@ -18,6 +18,7 @@ export const BulletList = _ref => {
|
|
|
18
18
|
className: clsx(className, styles.root, {
|
|
19
19
|
[styles.firstOccurrence]: stack === -1
|
|
20
20
|
}),
|
|
21
|
+
odComponent: "bullet-list",
|
|
21
22
|
children: _jsx(BulletListContext.Provider, {
|
|
22
23
|
value: stack + 1 >= bulletMap.length ? 0 : stack + 1,
|
|
23
24
|
children: children
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IconType } from '@autoguru/icons';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { type AriaAttributes, type ComponentPropsWithRef, type ElementType, type ReactElement } from 'react';
|
|
4
|
+
import type { TestId } from '../../types';
|
|
4
5
|
import type { StyledButtonProps } from './Button.css';
|
|
5
6
|
type ButtonPrimitive = ComponentPropsWithRef<'button'>;
|
|
6
7
|
type AllowedChildren = string | IconType;
|
|
@@ -8,7 +9,7 @@ declare const defaultEnglish: {
|
|
|
8
9
|
readonly loading: "loading";
|
|
9
10
|
};
|
|
10
11
|
type TextContent = keyof typeof defaultEnglish;
|
|
11
|
-
export interface ButtonProps extends Pick<ButtonPrimitive, 'id' | 'onClick' | 'type' | 'className'>, Pick<AriaAttributes, 'aria-label'>, StyledButtonProps {
|
|
12
|
+
export interface ButtonProps extends Pick<ButtonPrimitive, 'id' | 'onClick' | 'type' | 'className'>, Pick<AriaAttributes, 'aria-label'>, StyledButtonProps, TestId {
|
|
12
13
|
children: AllowedChildren | AllowedChildren[];
|
|
13
14
|
disabled?: boolean;
|
|
14
15
|
is?: ElementType | ReactElement;
|
|
@@ -18,6 +19,6 @@ export interface ButtonProps extends Pick<ButtonPrimitive, 'id' | 'onClick' | 't
|
|
|
18
19
|
withDoubleClicks?: boolean;
|
|
19
20
|
lang?: Partial<Record<TextContent, string>>;
|
|
20
21
|
}
|
|
21
|
-
export declare const Button: React.ForwardRefExoticComponent<ButtonProps &
|
|
22
|
+
export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
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;
|
|
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;AAKf,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAO1C,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,EAAE,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,CAAC,EACrE,IAAI,CAAC,cAAc,EAAE,YAAY,CAAC,EAClC,iBAAiB,EACjB,MAAM;IACP,QAAQ,EAAE,eAAe,GAAG,eAAe,EAAE,CAAC;IAI9C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,EAAE,CAAC,EAAE,WAAW,GAAG,YAAY,CAAC;IAChC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IAItB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAI3B,IAAI,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;CAC5C;AA2BD,eAAO,MAAM,MAAM,uFA4KlB,CAAC;AAIF,eAAe,MAAM,CAAC"}
|
|
@@ -7,11 +7,11 @@ import clsx from 'clsx';
|
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
import { cloneElement, createElement, forwardRef, isValidElement, useCallback, useEffect, useMemo, useState } from 'react';
|
|
9
9
|
import { componentStyles } from "../../styles/index.js";
|
|
10
|
+
import { typographyStyles } from "../../styles/typography.css.js";
|
|
10
11
|
import { dataAttrs } from "../../utils/dataAttrs.js";
|
|
11
12
|
import { Box } from "../Box/Box.js";
|
|
12
13
|
import { Icon } from "../Icon/Icon.js";
|
|
13
14
|
import { ProgressSpinner } from "../ProgressSpinner/ProgressSpinner.js";
|
|
14
|
-
import { useTextStyles } from "../Text/useTextStyles.js";
|
|
15
15
|
import * as styles from "./Button.css.js";
|
|
16
16
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
17
|
const DOUBLE_CLICK_DETECTION_PERIOD = 700;
|
|
@@ -78,13 +78,12 @@ export const Button = forwardRef((_ref, ref) => {
|
|
|
78
78
|
if (rounded) return 'rounded';
|
|
79
79
|
return 'default';
|
|
80
80
|
}, [isSingleIconChild, rounded]);
|
|
81
|
-
const props = {
|
|
81
|
+
const props = _objectSpread(_objectSpread({
|
|
82
82
|
type: Component === 'button' ? type : undefined,
|
|
83
83
|
id,
|
|
84
84
|
onClick,
|
|
85
85
|
disabled: disabled || isLoading,
|
|
86
86
|
'aria-label': isLoading ? language.loading : ariaLabel,
|
|
87
|
-
'data-loading': isLoading ? '' : undefined,
|
|
88
87
|
className: clsx(componentStyles({
|
|
89
88
|
as: Component,
|
|
90
89
|
display: 'inline-block',
|
|
@@ -96,18 +95,22 @@ export const Button = forwardRef((_ref, ref) => {
|
|
|
96
95
|
paddingX: getPadding(size, isLoading),
|
|
97
96
|
width: isFullWidth ? 'full' : undefined,
|
|
98
97
|
pointerEvents: functionallyDisabled ? 'none' : undefined
|
|
99
|
-
}),
|
|
98
|
+
}), typographyStyles({
|
|
100
99
|
colour: 'white',
|
|
101
|
-
|
|
100
|
+
weight: fontWeight[size],
|
|
102
101
|
size: fontSize[size]
|
|
103
102
|
}), styles.button({
|
|
104
103
|
size,
|
|
105
104
|
shape,
|
|
106
105
|
intent: variant,
|
|
107
106
|
minimal
|
|
108
|
-
}), className)
|
|
107
|
+
}), className)
|
|
108
|
+
}, dataAttrs({
|
|
109
|
+
loading: isLoading,
|
|
110
|
+
testid: testId
|
|
111
|
+
})), {}, {
|
|
109
112
|
ref
|
|
110
|
-
};
|
|
113
|
+
});
|
|
111
114
|
const buttonContents = useMemo(() => {
|
|
112
115
|
var _maybeIconProps$size;
|
|
113
116
|
return _jsx(_Fragment, {
|
|
@@ -146,16 +149,13 @@ export const Button = forwardRef((_ref, ref) => {
|
|
|
146
149
|
className: [styles.body, styles.hiddenContent],
|
|
147
150
|
children: buttonContents
|
|
148
151
|
})]
|
|
149
|
-
}) : _jsx(Box,
|
|
152
|
+
}) : _jsx(Box, {
|
|
150
153
|
height: "full",
|
|
151
154
|
alignItems: "center",
|
|
152
155
|
justifyContent: "center",
|
|
153
|
-
className: styles.body
|
|
154
|
-
}, dataAttrs({
|
|
155
|
-
'data-testid': testId
|
|
156
|
-
})), {}, {
|
|
156
|
+
className: styles.body,
|
|
157
157
|
children: buttonContents
|
|
158
|
-
})
|
|
158
|
+
});
|
|
159
159
|
return isValidElement(Component) ? cloneElement(Component, _objectSpread({}, props), child) : createElement(Component, _objectSpread({}, props), child);
|
|
160
160
|
});
|
|
161
161
|
Button.displayName = 'Button';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
const _excluded = ["className", "children", "width", "alignSelf", "
|
|
5
|
+
const _excluded = ["className", "children", "width", "alignSelf", "as", "noShrink", "grow", "order"];
|
|
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';
|
|
@@ -18,7 +18,7 @@ export const Column = forwardRef((_ref, ref) => {
|
|
|
18
18
|
children,
|
|
19
19
|
width,
|
|
20
20
|
alignSelf,
|
|
21
|
-
|
|
21
|
+
as,
|
|
22
22
|
noShrink = false,
|
|
23
23
|
grow = false,
|
|
24
24
|
order
|
|
@@ -43,7 +43,7 @@ export const Column = forwardRef((_ref, ref) => {
|
|
|
43
43
|
})],
|
|
44
44
|
children: _jsx(Box, _objectSpread(_objectSpread({
|
|
45
45
|
ref: ref,
|
|
46
|
-
as:
|
|
46
|
+
as: as,
|
|
47
47
|
display: "flex",
|
|
48
48
|
width: "full",
|
|
49
49
|
height: "full",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
const _excluded = ["className", "children", "space", "spaceX", "spaceY", "noWrap", "wrappingDirection", "align", "
|
|
5
|
+
const _excluded = ["className", "children", "space", "spaceX", "spaceY", "noWrap", "wrappingDirection", "align", "as"];
|
|
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 clsx from 'clsx';
|
|
@@ -24,8 +24,7 @@ export const Columns = forwardRef((_ref, ref) => {
|
|
|
24
24
|
noWrap,
|
|
25
25
|
wrappingDirection = 'default',
|
|
26
26
|
align = 'stretch',
|
|
27
|
-
|
|
28
|
-
as = is
|
|
27
|
+
as
|
|
29
28
|
} = _ref,
|
|
30
29
|
boxProps = _objectWithoutProperties(_ref, _excluded);
|
|
31
30
|
const resolvedSpaceX = useMemo(() => spaceX || space || ['none'], [space, spaceX]);
|
|
@@ -41,7 +40,8 @@ export const Columns = forwardRef((_ref, ref) => {
|
|
|
41
40
|
align,
|
|
42
41
|
noWrap,
|
|
43
42
|
wrappingDirection
|
|
44
|
-
}), className)
|
|
43
|
+
}), className),
|
|
44
|
+
odComponent: "columns"
|
|
45
45
|
}, boxProps), {}, {
|
|
46
46
|
children: _jsx(ColumnContext.Provider, {
|
|
47
47
|
value: useMemo(() => ({
|