@autoguru/overdrive 4.10.1 → 4.11.0
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/Actions/Actions.js +21 -4
- package/dist/components/Actions/index.js +3 -1
- package/dist/components/Alert/Alert.css.js +28 -20
- package/dist/components/Alert/Alert.js +84 -26
- package/dist/components/Alert/index.js +3 -1
- package/dist/components/Anchor/Anchor.css.js +11 -3
- package/dist/components/Anchor/Anchor.js +53 -28
- package/dist/components/Anchor/index.js +3 -1
- package/dist/components/AutoSuggest/AutoSuggest.css.js +84 -76
- package/dist/components/AutoSuggest/AutoSuggest.js +621 -302
- package/dist/components/AutoSuggest/index.js +3 -1
- package/dist/components/AutoSuggest/useLayoutSuggestionVisible.js +29 -31
- package/dist/components/Badge/Badge.css.js +79 -71
- package/dist/components/Badge/Badge.js +44 -27
- package/dist/components/Badge/index.js +3 -1
- package/dist/components/Box/Box.js +122 -53
- package/dist/components/Box/argTypes.js +72 -105
- package/dist/components/Box/index.js +4 -2
- package/dist/components/Box/useBoxStyles.css.d.ts +4 -4
- package/dist/components/Box/useBoxStyles.css.d.ts.map +1 -1
- package/dist/components/Box/useBoxStyles.css.js +114 -89
- package/dist/components/Box/useBoxStyles.d.ts +7 -7
- package/dist/components/Box/useBoxStyles.d.ts.map +1 -1
- package/dist/components/Box/useBoxStyles.js +75 -47
- package/dist/components/BulletList/Bullet.css.js +49 -41
- package/dist/components/BulletList/Bullet.js +38 -24
- package/dist/components/BulletList/BulletList.css.js +13 -5
- package/dist/components/BulletList/BulletList.js +23 -10
- package/dist/components/BulletList/context.js +3 -1
- package/dist/components/BulletList/index.js +4 -2
- package/dist/components/BulletText/BulletText.css.js +21 -13
- package/dist/components/BulletText/BulletText.js +57 -16
- package/dist/components/BulletText/index.js +3 -1
- package/dist/components/Button/Button.css.js +243 -235
- package/dist/components/Button/Button.js +154 -91
- package/dist/components/Button/index.js +3 -1
- package/dist/components/CheckBox/CheckBox.css.js +28 -20
- package/dist/components/CheckBox/CheckBox.js +54 -16
- package/dist/components/CheckBox/index.js +3 -1
- package/dist/components/ColourInput/ColourInput.css.js +31 -23
- package/dist/components/ColourInput/ColourInput.js +70 -20
- package/dist/components/ColourInput/index.js +3 -1
- package/dist/components/Columns/Column.css.js +36 -26
- package/dist/components/Columns/Column.js +51 -16
- package/dist/components/Columns/Columns.css.js +39 -31
- package/dist/components/Columns/Columns.js +55 -22
- package/dist/components/Columns/index.js +4 -2
- package/dist/components/DateInput/DateInput.js +34 -7
- package/dist/components/DateInput/index.js +3 -1
- package/dist/components/DatePicker/DatePicker.css.js +40 -32
- package/dist/components/DatePicker/DatePicker.js +64 -23
- package/dist/components/DatePicker/index.js +3 -1
- package/dist/components/DividerLine/DividerLine.css.js +45 -37
- package/dist/components/DividerLine/DividerLine.js +22 -6
- package/dist/components/DividerLine/index.js +3 -1
- package/dist/components/Flyout/Flyout.js +41 -5
- package/dist/components/Flyout/index.js +3 -1
- package/dist/components/Heading/Heading.js +41 -21
- package/dist/components/Heading/index.js +3 -1
- package/dist/components/Icon/Icon.css.js +13 -5
- package/dist/components/Icon/Icon.js +26 -9
- package/dist/components/Icon/index.js +3 -1
- package/dist/components/Image/Image.js +23 -5
- package/dist/components/Image/ImageServerProvider.d.ts +1 -1
- package/dist/components/Image/ImageServerProvider.d.ts.map +1 -1
- package/dist/components/Image/ImageServerProvider.js +55 -35
- package/dist/components/Image/ResponsiveImage.js +46 -21
- package/dist/components/Image/SimpleImage.js +30 -2
- package/dist/components/Image/index.js +4 -2
- package/dist/components/Image/types.js +3 -1
- package/dist/components/Inline/Inline.js +74 -30
- package/dist/components/Inline/index.js +3 -1
- package/dist/components/LinearProgressIndicator/LinearProgressIndicator.css.js +56 -48
- package/dist/components/LinearProgressIndicator/LinearProgressIndicator.js +31 -7
- package/dist/components/LinearProgressIndicator/index.js +3 -1
- package/dist/components/LoadingBox/LoadingBox.css.js +26 -18
- package/dist/components/LoadingBox/LoadingBox.js +40 -7
- package/dist/components/LoadingBox/index.js +3 -1
- package/dist/components/Meta/Meta.css.js +16 -8
- package/dist/components/Meta/Meta.js +30 -8
- package/dist/components/Meta/index.js +3 -1
- package/dist/components/MinimalModal/MinimalModal.css.js +15 -7
- package/dist/components/MinimalModal/MinimalModal.js +67 -29
- package/dist/components/MinimalModal/index.js +3 -1
- package/dist/components/Modal/Modal.css.js +38 -30
- package/dist/components/Modal/Modal.js +129 -73
- package/dist/components/Modal/index.js +3 -1
- package/dist/components/NumberBubble/NumberBubble.css.js +12 -4
- package/dist/components/NumberBubble/NumberBubble.js +51 -23
- package/dist/components/NumberBubble/index.js +3 -1
- package/dist/components/NumberInput/NumberInput.js +67 -29
- package/dist/components/NumberInput/index.js +3 -1
- package/dist/components/OrderedList/OrderedList.css.js +16 -8
- package/dist/components/OrderedList/OrderedList.js +60 -26
- package/dist/components/OrderedList/index.js +3 -1
- package/dist/components/OutsideClick/OutsideClick.js +40 -35
- package/dist/components/OutsideClick/index.js +3 -1
- package/dist/components/OverdriveProvider/OverdriveProvider.js +33 -19
- package/dist/components/OverdriveProvider/index.js +3 -1
- package/dist/components/Pagination/Bubble.js +41 -19
- package/dist/components/Pagination/Pagination.css.js +28 -20
- package/dist/components/Pagination/Pagination.js +166 -67
- package/dist/components/Pagination/index.js +3 -1
- package/dist/components/Portal/Portal.js +40 -24
- package/dist/components/Portal/index.js +3 -1
- package/dist/components/Positioner/Positioner.css.js +14 -6
- package/dist/components/Positioner/Positioner.js +109 -85
- package/dist/components/Positioner/alignment.js +13 -10
- package/dist/components/Positioner/index.js +4 -2
- package/dist/components/ProgressBar/ProgressBar.css.js +14 -6
- package/dist/components/ProgressBar/ProgressBar.js +30 -12
- package/dist/components/ProgressBar/index.js +3 -1
- package/dist/components/ProgressBarGroup/ProgressBarGroup.css.js +12 -4
- package/dist/components/ProgressBarGroup/ProgressBarGroup.js +42 -14
- package/dist/components/ProgressBarGroup/index.js +3 -1
- package/dist/components/ProgressSpinner/ProgressSpinner.css.js +81 -73
- package/dist/components/ProgressSpinner/ProgressSpinner.js +32 -14
- package/dist/components/ProgressSpinner/index.js +3 -1
- package/dist/components/Radio/Radio.css.js +31 -23
- package/dist/components/Radio/Radio.js +58 -19
- package/dist/components/Radio/RadioGroup.js +32 -7
- package/dist/components/Radio/index.js +4 -2
- package/dist/components/Section/Section.css.js +13 -5
- package/dist/components/Section/Section.js +19 -4
- package/dist/components/Section/index.js +3 -1
- package/dist/components/SelectInput/SelectInput.css.js +19 -11
- package/dist/components/SelectInput/SelectInput.js +60 -11
- package/dist/components/SelectInput/index.js +3 -1
- package/dist/components/SimplePagination/SimplePagination.js +57 -17
- package/dist/components/SimplePagination/index.js +3 -1
- package/dist/components/Stack/Divider.css.js +12 -4
- package/dist/components/Stack/Divider.js +13 -4
- package/dist/components/Stack/Stack.css.js +18 -10
- package/dist/components/Stack/Stack.js +47 -23
- package/dist/components/Stack/index.js +3 -1
- package/dist/components/StandardModal/StandardModal.css.js +69 -57
- package/dist/components/StandardModal/StandardModal.js +127 -52
- package/dist/components/StandardModal/index.js +3 -1
- package/dist/components/StarRating/StarRating.css.js +16 -8
- package/dist/components/StarRating/StarRating.js +90 -46
- package/dist/components/StarRating/index.js +3 -1
- package/dist/components/Stepper/Stepper.css.js +46 -36
- package/dist/components/Stepper/Stepper.js +159 -66
- package/dist/components/Stepper/index.js +3 -1
- package/dist/components/Switch/Switch.css.js +54 -46
- package/dist/components/Switch/Switch.js +54 -21
- package/dist/components/Switch/index.js +3 -1
- package/dist/components/Table/Table.css.js +14 -6
- package/dist/components/Table/Table.js +29 -6
- package/dist/components/Table/TableCell.css.js +28 -20
- package/dist/components/Table/TableCell.js +41 -11
- package/dist/components/Table/TableHeadCell.css.js +61 -50
- package/dist/components/Table/TableHeadCell.js +86 -40
- package/dist/components/Table/TableRow.js +18 -3
- package/dist/components/Table/TableRowGroup.js +16 -3
- package/dist/components/Table/context.js +21 -10
- package/dist/components/Table/index.js +7 -5
- package/dist/components/Tabs/Tab.css.js +43 -35
- package/dist/components/Tabs/Tab.js +79 -49
- package/dist/components/Tabs/TabList.css.js +30 -22
- package/dist/components/Tabs/TabList.js +122 -67
- package/dist/components/Tabs/TabPane.css.js +11 -3
- package/dist/components/Tabs/TabPane.js +32 -15
- package/dist/components/Tabs/TabPanes.css.js +16 -8
- package/dist/components/Tabs/TabPanes.js +23 -6
- package/dist/components/Tabs/Tabs.js +22 -10
- package/dist/components/Tabs/index.js +7 -5
- package/dist/components/Text/Text.js +37 -15
- package/dist/components/Text/index.js +4 -2
- package/dist/components/Text/useTextStyles.css.js +42 -20
- package/dist/components/Text/useTextStyles.js +20 -5
- package/dist/components/TextAreaInput/TextAreaInput.js +35 -7
- package/dist/components/TextAreaInput/index.js +3 -1
- package/dist/components/TextBubble/TextBubble.css.js +13 -5
- package/dist/components/TextBubble/TextBubble.js +66 -29
- package/dist/components/TextBubble/index.js +3 -1
- package/dist/components/TextContainer/TextContainer.js +44 -9
- package/dist/components/TextContainer/index.js +3 -1
- package/dist/components/TextInput/TextInput.js +36 -5
- package/dist/components/TextInput/index.js +3 -1
- package/dist/components/TextLink/TextLink.css.js +23 -15
- package/dist/components/TextLink/TextLink.js +63 -24
- package/dist/components/TextLink/index.js +3 -1
- package/dist/components/ThemeOverrideProvider/ThemeOverrideDebugger.d.ts +3 -0
- package/dist/components/ThemeOverrideProvider/ThemeOverrideDebugger.d.ts.map +1 -0
- package/dist/components/ThemeOverrideProvider/ThemeOverrideDebugger.js +80 -0
- package/dist/components/ThemeOverrideProvider/ThemeOverrideProvider.d.ts +22 -0
- package/dist/components/ThemeOverrideProvider/ThemeOverrideProvider.d.ts.map +1 -0
- package/dist/components/ThemeOverrideProvider/ThemeOverrideProvider.js +39 -0
- package/dist/components/ThemeOverrideProvider/index.d.ts +3 -0
- package/dist/components/ThemeOverrideProvider/index.d.ts.map +1 -0
- package/dist/components/ThemeOverrideProvider/index.js +4 -0
- package/dist/components/ThemeOverrideProvider/useBuildThemeOverrides.d.ts +17 -0
- package/dist/components/ThemeOverrideProvider/useBuildThemeOverrides.d.ts.map +1 -0
- package/dist/components/ThemeOverrideProvider/useBuildThemeOverrides.js +97 -0
- package/dist/components/ThemeProvider/ThemeProvider.js +30 -11
- package/dist/components/ThemeProvider/index.js +3 -1
- package/dist/components/Toaster/Toast.css.js +18 -10
- package/dist/components/Toaster/Toast.js +222 -108
- package/dist/components/Toaster/index.js +3 -1
- package/dist/components/Tooltip/Tooltip.css.js +21 -9
- package/dist/components/Tooltip/Tooltip.js +72 -40
- package/dist/components/Tooltip/index.js +3 -1
- package/dist/components/VisuallyHidden/VisuallyHidden.css.js +13 -5
- package/dist/components/VisuallyHidden/VisuallyHidden.js +20 -4
- package/dist/components/VisuallyHidden/index.js +3 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +59 -56
- package/dist/components/private/CheckableBase/CheckableBase.css.js +46 -38
- package/dist/components/private/CheckableBase/CheckableBase.js +91 -27
- package/dist/components/private/CheckableBase/index.js +3 -1
- package/dist/components/private/CheckableBase/useCheckableStyles.js +5 -3
- package/dist/components/private/InputBase/HintText.css.js +11 -3
- package/dist/components/private/InputBase/HintText.js +28 -14
- package/dist/components/private/InputBase/InputState.css.js +96 -80
- package/dist/components/private/InputBase/NotchedBase.css.js +157 -162
- package/dist/components/private/InputBase/NotchedBase.js +116 -76
- package/dist/components/private/InputBase/index.js +3 -1
- package/dist/components/private/InputBase/withEnhancedInput.css.js +117 -109
- package/dist/components/private/InputBase/withEnhancedInput.js +190 -92
- package/dist/hooks/useAttachedBoxes/index.js +3 -1
- package/dist/hooks/useAttachedBoxes/useAttachedBoxes.css.js +26 -18
- package/dist/hooks/useAttachedBoxes/useAttachedBoxes.js +71 -46
- package/dist/hooks/useMedia/index.js +3 -1
- package/dist/hooks/useMedia/useMedia.js +44 -34
- package/dist/hooks/useNegativeMargin/useNegativeMargin.js +4 -2
- package/dist/hooks/useNegativeMargin/useNegativeMarginLeft.css.js +13 -5
- package/dist/hooks/useNegativeMargin/useNegativeMarginLeft.js +6 -4
- package/dist/hooks/useNegativeMargin/useNegativeMarginTop.css.js +12 -4
- package/dist/hooks/useNegativeMargin/useNegativeMarginTop.js +6 -4
- package/dist/hooks/useResponsiveValue/index.js +3 -1
- package/dist/hooks/useResponsiveValue/useResponsiveValue.js +14 -14
- package/dist/hooks/useWindowScrollLock/index.js +15 -13
- package/dist/index.js +7 -5
- package/dist/reset/globalFonts.css.js +20 -12
- package/dist/reset/globalReset.css.js +21 -13
- package/dist/reset/reset.css.js +105 -109
- package/dist/themes/base/index.d.ts +1 -0
- package/dist/themes/base/index.d.ts.map +1 -1
- package/dist/themes/base/index.js +10 -6
- package/dist/themes/base/tokens.js +264 -257
- package/dist/themes/base/vars.css.js +10 -2
- package/dist/themes/flat_red/index.d.ts +1 -0
- package/dist/themes/flat_red/index.d.ts.map +1 -1
- package/dist/themes/flat_red/index.js +10 -6
- package/dist/themes/flat_red/tokens.js +104 -98
- package/dist/themes/flat_red/vars.css.js +10 -2
- package/dist/themes/helpers.js +60 -51
- package/dist/themes/index.js +4 -2
- package/dist/themes/makeTheme.js +27 -16
- package/dist/themes/theme.css.js +271 -259
- package/dist/themes/tokens.js +3 -1
- package/dist/utils/index.js +93 -77
- package/dist/utils/mapTokenToProperty.js +22 -10
- package/dist/utils/number.js +21 -24
- package/dist/utils/resolveResponsiveProps.js +29 -31
- package/dist/utils/responsiveProps.css.js +29 -17
- package/dist/utils/responsiveStyle.js +26 -16
- package/package.json +4 -2
|
@@ -1,33 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
import { useLayoutEffect } from 'react';
|
|
2
|
-
import { isBrowser } from
|
|
4
|
+
import { isBrowser } from "../../utils/index.js";
|
|
3
5
|
export const useLayoutSuggestionVisible = (highlightIndex, highlightRef, suggestionListRef) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
}, [highlightIndex, highlightRef, suggestionListRef]);
|
|
32
|
-
}
|
|
33
|
-
};
|
|
6
|
+
if (isBrowser) {
|
|
7
|
+
useLayoutEffect(() => {
|
|
8
|
+
if (highlightRef.current && suggestionListRef.current && highlightIndex > -1) {
|
|
9
|
+
const highlightItem = highlightRef.current;
|
|
10
|
+
const suggestionListItem = suggestionListRef.current;
|
|
11
|
+
const itemOffsetRelativeToContainer = highlightItem.offsetParent === suggestionListItem ? highlightItem.offsetTop : highlightItem.offsetTop - suggestionListItem.offsetTop;
|
|
12
|
+
let {
|
|
13
|
+
scrollTop
|
|
14
|
+
} = suggestionListItem;
|
|
15
|
+
const {
|
|
16
|
+
offsetHeight
|
|
17
|
+
} = suggestionListItem;
|
|
18
|
+
|
|
19
|
+
if (itemOffsetRelativeToContainer < scrollTop) {
|
|
20
|
+
scrollTop = itemOffsetRelativeToContainer;
|
|
21
|
+
} else if (itemOffsetRelativeToContainer + highlightItem.offsetHeight > scrollTop + offsetHeight) {
|
|
22
|
+
scrollTop = itemOffsetRelativeToContainer + highlightItem.offsetHeight - offsetHeight;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (scrollTop !== scrollTop) {
|
|
26
|
+
suggestionListItem.scrollTop = scrollTop;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}, [highlightIndex, highlightRef, suggestionListRef]);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
@@ -1,78 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import * as __vanilla_filescope__ from '@vanilla-extract/css/fileScope';
|
|
4
|
+
|
|
5
|
+
__vanilla_filescope__.setFileScope("lib/components/Badge/Badge.css.ts", "@autoguru/overdrive");
|
|
6
|
+
|
|
1
7
|
import { style, styleVariants } from '@vanilla-extract/css';
|
|
2
|
-
import { themeContractVars as vars } from
|
|
8
|
+
import { themeContractVars as vars } from "../../themes/theme.css.js";
|
|
3
9
|
export const label = style({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
});
|
|
10
|
+
textOverflow: 'ellipsis',
|
|
11
|
+
letterSpacing: '0.5px',
|
|
12
|
+
textTransform: 'uppercase'
|
|
13
|
+
}, "label");
|
|
8
14
|
export const labelSize = styleVariants({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
15
|
+
standard: {
|
|
16
|
+
fontSize: vars.typography.size['2'].fontSize,
|
|
17
|
+
lineHeight: vars.typography.size['2'].fontSize
|
|
18
|
+
},
|
|
19
|
+
large: {
|
|
20
|
+
fontSize: vars.typography.size['4'].fontSize,
|
|
21
|
+
lineHeight: vars.typography.size['4'].fontSize
|
|
22
|
+
}
|
|
23
|
+
}, "labelSize");
|
|
24
|
+
export const colours = {
|
|
25
|
+
default: styleVariants({
|
|
26
|
+
neutral: {
|
|
27
|
+
backgroundColor: vars.colours.intent.neutral.background.standard
|
|
12
28
|
},
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
lineHeight: vars.typography.size['4'].fontSize,
|
|
29
|
+
green: {
|
|
30
|
+
backgroundColor: vars.colours.intent.success.background.standard
|
|
16
31
|
},
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
green: {
|
|
24
|
-
backgroundColor: vars.colours.intent.success.background.standard,
|
|
25
|
-
},
|
|
26
|
-
blue: {
|
|
27
|
-
backgroundColor: vars.colours.intent.information.background.standard,
|
|
28
|
-
},
|
|
29
|
-
yellow: {
|
|
30
|
-
backgroundColor: vars.colours.intent.warning.background.standard,
|
|
31
|
-
},
|
|
32
|
-
red: {
|
|
33
|
-
backgroundColor: vars.colours.intent.danger.background.standard,
|
|
34
|
-
},
|
|
35
|
-
}),
|
|
36
|
-
inverted: {
|
|
37
|
-
neutral: styleVariants({
|
|
38
|
-
background: {
|
|
39
|
-
backgroundColor: vars.colours.intent.neutral.background.mild,
|
|
40
|
-
},
|
|
41
|
-
text: {
|
|
42
|
-
color: vars.colours.intent.neutral.background.standard,
|
|
43
|
-
},
|
|
44
|
-
}),
|
|
45
|
-
green: styleVariants({
|
|
46
|
-
background: {
|
|
47
|
-
backgroundColor: vars.colours.intent.success.background.mild,
|
|
48
|
-
},
|
|
49
|
-
text: {
|
|
50
|
-
color: vars.colours.intent.success.background.standard,
|
|
51
|
-
},
|
|
52
|
-
}),
|
|
53
|
-
blue: styleVariants({
|
|
54
|
-
background: {
|
|
55
|
-
backgroundColor: vars.colours.intent.information.background.mild,
|
|
56
|
-
},
|
|
57
|
-
text: {
|
|
58
|
-
color: vars.colours.intent.information.background.standard,
|
|
59
|
-
},
|
|
60
|
-
}),
|
|
61
|
-
yellow: styleVariants({
|
|
62
|
-
background: {
|
|
63
|
-
backgroundColor: vars.colours.intent.warning.background.mild,
|
|
64
|
-
},
|
|
65
|
-
text: {
|
|
66
|
-
color: vars.colours.intent.warning.background.standard,
|
|
67
|
-
},
|
|
68
|
-
}),
|
|
69
|
-
red: styleVariants({
|
|
70
|
-
background: {
|
|
71
|
-
backgroundColor: vars.colours.intent.danger.background.mild,
|
|
72
|
-
},
|
|
73
|
-
text: {
|
|
74
|
-
color: vars.colours.intent.danger.background.standard,
|
|
75
|
-
},
|
|
76
|
-
}),
|
|
32
|
+
blue: {
|
|
33
|
+
backgroundColor: vars.colours.intent.information.background.standard
|
|
34
|
+
},
|
|
35
|
+
yellow: {
|
|
36
|
+
backgroundColor: vars.colours.intent.warning.background.standard
|
|
77
37
|
},
|
|
38
|
+
red: {
|
|
39
|
+
backgroundColor: vars.colours.intent.danger.background.standard
|
|
40
|
+
}
|
|
41
|
+
}, "colours_default"),
|
|
42
|
+
inverted: {
|
|
43
|
+
neutral: styleVariants({
|
|
44
|
+
background: {
|
|
45
|
+
backgroundColor: vars.colours.intent.neutral.background.mild
|
|
46
|
+
},
|
|
47
|
+
text: {
|
|
48
|
+
color: vars.colours.intent.neutral.background.standard
|
|
49
|
+
}
|
|
50
|
+
}, "colours_inverted_neutral"),
|
|
51
|
+
green: styleVariants({
|
|
52
|
+
background: {
|
|
53
|
+
backgroundColor: vars.colours.intent.success.background.mild
|
|
54
|
+
},
|
|
55
|
+
text: {
|
|
56
|
+
color: vars.colours.intent.success.background.standard
|
|
57
|
+
}
|
|
58
|
+
}, "colours_inverted_green"),
|
|
59
|
+
blue: styleVariants({
|
|
60
|
+
background: {
|
|
61
|
+
backgroundColor: vars.colours.intent.information.background.mild
|
|
62
|
+
},
|
|
63
|
+
text: {
|
|
64
|
+
color: vars.colours.intent.information.background.standard
|
|
65
|
+
}
|
|
66
|
+
}, "colours_inverted_blue"),
|
|
67
|
+
yellow: styleVariants({
|
|
68
|
+
background: {
|
|
69
|
+
backgroundColor: vars.colours.intent.warning.background.mild
|
|
70
|
+
},
|
|
71
|
+
text: {
|
|
72
|
+
color: vars.colours.intent.warning.background.standard
|
|
73
|
+
}
|
|
74
|
+
}, "colours_inverted_yellow"),
|
|
75
|
+
red: styleVariants({
|
|
76
|
+
background: {
|
|
77
|
+
backgroundColor: vars.colours.intent.danger.background.mild
|
|
78
|
+
},
|
|
79
|
+
text: {
|
|
80
|
+
color: vars.colours.intent.danger.background.standard
|
|
81
|
+
}
|
|
82
|
+
}, "colours_inverted_red")
|
|
83
|
+
}
|
|
78
84
|
};
|
|
85
|
+
|
|
86
|
+
__vanilla_filescope__.endFileScope();
|
|
@@ -1,30 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
import { invariant } from '@autoguru/utilities';
|
|
2
4
|
import * as React from 'react';
|
|
3
|
-
import { Box } from
|
|
4
|
-
import { useTextStyles } from
|
|
5
|
-
import * as styles from
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
5
|
+
import { Box } from "../Box/index.js";
|
|
6
|
+
import { useTextStyles } from "../Text/index.js";
|
|
7
|
+
import * as styles from "./Badge.css.js";
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
export const Badge = _ref => {
|
|
10
|
+
let {
|
|
11
|
+
label,
|
|
12
|
+
colour = 'neutral',
|
|
13
|
+
look = 'standard',
|
|
14
|
+
size = 'standard',
|
|
15
|
+
className = ''
|
|
16
|
+
} = _ref;
|
|
17
|
+
const isStandardSize = size === 'standard';
|
|
18
|
+
const textStyles = useTextStyles({
|
|
19
|
+
noWrap: true,
|
|
20
|
+
fontWeight: 'semiBold',
|
|
21
|
+
colour: 'unset'
|
|
22
|
+
});
|
|
23
|
+
const inverted = look === 'inverted';
|
|
24
|
+
!['string', 'number'].includes(typeof label) ? process.env.NODE_ENV !== "production" ? invariant(false, "Badge `label` can only contain string's or number's") : invariant(false) : void 0;
|
|
25
|
+
return _jsx(Box, {
|
|
26
|
+
className: className,
|
|
27
|
+
display: "flex",
|
|
28
|
+
children: _jsx(Box, {
|
|
29
|
+
className: [styles.labelSize[size], inverted ? styles.colours.inverted[colour].background : styles.colours.default[colour]],
|
|
30
|
+
overflow: "hidden",
|
|
31
|
+
display: "block",
|
|
32
|
+
paddingX: isStandardSize ? '1' : '4',
|
|
33
|
+
paddingY: isStandardSize ? '1' : '2',
|
|
34
|
+
borderRadius: "1",
|
|
35
|
+
children: _jsx(Box, {
|
|
36
|
+
is: "span",
|
|
37
|
+
display: "block",
|
|
38
|
+
overflow: "hidden",
|
|
39
|
+
className: [textStyles, styles.label, inverted ? styles.colours.inverted[colour].text : useTextStyles({
|
|
40
|
+
colour: 'white'
|
|
41
|
+
})],
|
|
42
|
+
children: label
|
|
43
|
+
})
|
|
44
|
+
})
|
|
45
|
+
});
|
|
29
46
|
};
|
|
30
|
-
export default Badge;
|
|
47
|
+
export default Badge;
|
|
@@ -1,58 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
+
const _excluded = ["is", "padding", "paddingX", "paddingY", "paddingTop", "paddingBottom", "paddingLeft", "paddingRight", "margin", "marginX", "marginY", "marginTop", "marginBottom", "marginLeft", "marginRight", "display", "width", "height", "position", "overflow", "userSelect", "textAlign", "pointerEvents", "borderColour", "borderColourX", "borderColourY", "borderColourTop", "borderColourRight", "borderColourBottom", "borderColourLeft", "borderWidth", "borderWidthX", "borderWidthY", "borderWidthTop", "borderWidthRight", "borderWidthBottom", "borderWidthLeft", "boxShadow", "borderRadius", "backgroundColour", "opacity", "className", "alignItems", "flexDirection", "flexGrow", "flexShrink", "flexWrap", "justifyContent", "children"];
|
|
6
|
+
|
|
7
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
8
|
+
|
|
9
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10
|
+
|
|
1
11
|
import clsx from 'clsx';
|
|
2
12
|
import * as React from 'react';
|
|
3
13
|
import { forwardRef } from 'react';
|
|
4
|
-
import { useBoxStyles } from
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
14
|
+
import { useBoxStyles } from "./useBoxStyles.js";
|
|
15
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
+
export const Box = forwardRef((_ref, ref) => {
|
|
17
|
+
let {
|
|
18
|
+
is: Component = 'div',
|
|
19
|
+
padding,
|
|
20
|
+
paddingX,
|
|
21
|
+
paddingY,
|
|
22
|
+
paddingTop,
|
|
23
|
+
paddingBottom,
|
|
24
|
+
paddingLeft,
|
|
25
|
+
paddingRight,
|
|
26
|
+
margin,
|
|
27
|
+
marginX,
|
|
28
|
+
marginY,
|
|
29
|
+
marginTop,
|
|
30
|
+
marginBottom,
|
|
31
|
+
marginLeft,
|
|
32
|
+
marginRight,
|
|
33
|
+
display,
|
|
34
|
+
width = 'none',
|
|
35
|
+
height,
|
|
36
|
+
position,
|
|
37
|
+
overflow,
|
|
38
|
+
userSelect,
|
|
39
|
+
textAlign,
|
|
40
|
+
pointerEvents,
|
|
41
|
+
borderColour,
|
|
42
|
+
borderColourX,
|
|
43
|
+
borderColourY,
|
|
44
|
+
borderColourTop,
|
|
45
|
+
borderColourRight,
|
|
46
|
+
borderColourBottom,
|
|
47
|
+
borderColourLeft,
|
|
48
|
+
borderWidth,
|
|
49
|
+
borderWidthX,
|
|
50
|
+
borderWidthY,
|
|
51
|
+
borderWidthTop,
|
|
52
|
+
borderWidthRight,
|
|
53
|
+
borderWidthBottom,
|
|
54
|
+
borderWidthLeft,
|
|
55
|
+
boxShadow,
|
|
56
|
+
borderRadius,
|
|
57
|
+
backgroundColour,
|
|
58
|
+
opacity,
|
|
59
|
+
className = '',
|
|
60
|
+
alignItems,
|
|
61
|
+
flexDirection,
|
|
62
|
+
flexGrow,
|
|
63
|
+
flexShrink,
|
|
64
|
+
flexWrap,
|
|
65
|
+
justifyContent,
|
|
66
|
+
children
|
|
67
|
+
} = _ref,
|
|
68
|
+
allOtherProps = _objectWithoutProperties(_ref, _excluded);
|
|
69
|
+
|
|
70
|
+
const cls = useBoxStyles({
|
|
71
|
+
is: Component,
|
|
72
|
+
alignItems,
|
|
73
|
+
backgroundColour,
|
|
74
|
+
borderColour,
|
|
75
|
+
borderColourBottom,
|
|
76
|
+
borderColourLeft,
|
|
77
|
+
borderColourRight,
|
|
78
|
+
borderColourTop,
|
|
79
|
+
borderColourX,
|
|
80
|
+
borderColourY,
|
|
81
|
+
borderRadius,
|
|
82
|
+
borderWidth,
|
|
83
|
+
borderWidthBottom,
|
|
84
|
+
borderWidthLeft,
|
|
85
|
+
borderWidthRight,
|
|
86
|
+
borderWidthTop,
|
|
87
|
+
borderWidthX,
|
|
88
|
+
borderWidthY,
|
|
89
|
+
boxShadow,
|
|
90
|
+
display,
|
|
91
|
+
flexDirection,
|
|
92
|
+
flexGrow,
|
|
93
|
+
flexShrink,
|
|
94
|
+
flexWrap,
|
|
95
|
+
height,
|
|
96
|
+
justifyContent,
|
|
97
|
+
margin,
|
|
98
|
+
marginBottom,
|
|
99
|
+
marginLeft,
|
|
100
|
+
marginRight,
|
|
101
|
+
marginTop,
|
|
102
|
+
marginX,
|
|
103
|
+
marginY,
|
|
104
|
+
opacity,
|
|
105
|
+
overflow,
|
|
106
|
+
padding,
|
|
107
|
+
paddingBottom,
|
|
108
|
+
paddingLeft,
|
|
109
|
+
paddingRight,
|
|
110
|
+
paddingTop,
|
|
111
|
+
paddingX,
|
|
112
|
+
paddingY,
|
|
113
|
+
pointerEvents,
|
|
114
|
+
position,
|
|
115
|
+
textAlign,
|
|
116
|
+
userSelect,
|
|
117
|
+
width
|
|
118
|
+
});
|
|
119
|
+
return _jsx(Component, _objectSpread(_objectSpread({
|
|
120
|
+
ref: ref,
|
|
121
|
+
className: clsx(cls, className)
|
|
122
|
+
}, allOtherProps), {}, {
|
|
123
|
+
children: children
|
|
124
|
+
}));
|
|
56
125
|
});
|
|
57
126
|
Box.displayName = 'Box';
|
|
58
|
-
export default Box;
|
|
127
|
+
export default Box;
|