@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,72 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
import { MinusIcon, PlusIcon } from '@autoguru/icons';
|
|
2
4
|
import { clamp } from '@autoguru/utilities';
|
|
3
5
|
import clsx from 'clsx';
|
|
4
6
|
import * as React from 'react';
|
|
5
|
-
import { useCallback
|
|
6
|
-
import { addWithSafeDecimal } from
|
|
7
|
-
import { Box, useBoxStyles } from
|
|
8
|
-
import { Column, Columns } from
|
|
9
|
-
import { Icon } from
|
|
10
|
-
import { Text, useTextStyles } from
|
|
11
|
-
import * as styles from
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
import { useCallback } from 'react';
|
|
8
|
+
import { addWithSafeDecimal } from "../../utils/number.js";
|
|
9
|
+
import { Box, useBoxStyles } from "../Box/index.js";
|
|
10
|
+
import { Column, Columns } from "../Columns/index.js";
|
|
11
|
+
import { Icon } from "../Icon/index.js";
|
|
12
|
+
import { Text, useTextStyles } from "../Text/index.js";
|
|
13
|
+
import * as styles from "./Stepper.css.js";
|
|
14
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
+
|
|
17
|
+
const takeStep = _ref => {
|
|
18
|
+
let {
|
|
19
|
+
min,
|
|
20
|
+
max,
|
|
21
|
+
value,
|
|
22
|
+
step,
|
|
23
|
+
direction
|
|
24
|
+
} = _ref;
|
|
25
|
+
const directionChange = (direction === 'DOWN' ? -1 : 1) * step;
|
|
26
|
+
return clamp(addWithSafeDecimal(value, directionChange), min, max);
|
|
15
27
|
};
|
|
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
|
-
case 'ArrowRight':
|
|
44
|
-
return onIncrement();
|
|
45
|
-
case 'Home':
|
|
46
|
-
event.preventDefault();
|
|
47
|
-
return onChange(min);
|
|
48
|
-
case 'End':
|
|
49
|
-
event.preventDefault();
|
|
50
|
-
return onChange(max);
|
|
51
|
-
case 'Escape':
|
|
52
|
-
event.currentTarget.blur();
|
|
53
|
-
break;
|
|
54
|
-
}
|
|
55
|
-
}, [min, max, onDecrement, onIncrement, onChange]);
|
|
56
|
-
return (React.createElement(Box, { className: clsx(className, styles.root, useBoxStyles({ is: 'button' }), disabled && styles.disabled, {
|
|
57
|
-
[styles.width.default]: !isFullWidth,
|
|
58
|
-
[styles.width.full]: isFullWidth,
|
|
59
|
-
}), userSelect: "none", "aria-disabled": disabled, tabIndex: 0, borderWidth: "1", borderColour: "gray", padding: "3", borderRadius: "1", boxShadow: "2", onKeyDown: keyDownHandler },
|
|
60
|
-
React.createElement(Columns, { noWrap: true, width: "full" },
|
|
61
|
-
React.createElement(Column, { noShrink: true, alignSelf: "centre" },
|
|
62
|
-
React.createElement(Handle, { icon: MinusIcon, label: "step down", disabled: disabled, onClick: onDecrement })),
|
|
63
|
-
React.createElement(Column, { noShrink: true, grow: true, width: "auto", alignSelf: "centre" },
|
|
64
|
-
React.createElement(Text, { is: "span", align: "center", colour: "dark", display: "block", className: clsx(useBoxStyles({
|
|
65
|
-
paddingX: '2',
|
|
66
|
-
width: 'full',
|
|
67
|
-
is: 'span',
|
|
68
|
-
}), styles.label), size: "4" }, Number.isFinite(value) ? format(value) : '')),
|
|
69
|
-
React.createElement(Column, { noShrink: true, alignSelf: "centre" },
|
|
70
|
-
React.createElement(Handle, { icon: PlusIcon, label: "step up", disabled: disabled, onClick: onIncrement })))));
|
|
28
|
+
|
|
29
|
+
const Handle = _ref2 => {
|
|
30
|
+
let {
|
|
31
|
+
disabled,
|
|
32
|
+
icon,
|
|
33
|
+
label,
|
|
34
|
+
onClick
|
|
35
|
+
} = _ref2;
|
|
36
|
+
return _jsx(Box, {
|
|
37
|
+
is: "button",
|
|
38
|
+
className: [styles.handle.default, disabled && styles.handle.disabled, useTextStyles({
|
|
39
|
+
colour: 'white'
|
|
40
|
+
})],
|
|
41
|
+
"aria-label": label,
|
|
42
|
+
padding: "none",
|
|
43
|
+
borderRadius: "full",
|
|
44
|
+
display: "flex",
|
|
45
|
+
alignItems: "center",
|
|
46
|
+
justifyContent: "center",
|
|
47
|
+
disabled: disabled,
|
|
48
|
+
tabIndex: -1,
|
|
49
|
+
onClick: onClick,
|
|
50
|
+
children: _jsx(Icon, {
|
|
51
|
+
icon: icon,
|
|
52
|
+
size: "small"
|
|
53
|
+
})
|
|
54
|
+
});
|
|
71
55
|
};
|
|
72
|
-
|
|
56
|
+
|
|
57
|
+
export const Stepper = _ref3 => {
|
|
58
|
+
let {
|
|
59
|
+
className = '',
|
|
60
|
+
disabled: incomingDisabled = false,
|
|
61
|
+
isFullWidth = false,
|
|
62
|
+
step = 1,
|
|
63
|
+
min = Number.MIN_SAFE_INTEGER,
|
|
64
|
+
max = Number.MAX_SAFE_INTEGER,
|
|
65
|
+
value: incomingValue = 0,
|
|
66
|
+
format = value => value.toString(),
|
|
67
|
+
onChange = () => void 0
|
|
68
|
+
} = _ref3;
|
|
69
|
+
const value = clamp(incomingValue, min, max);
|
|
70
|
+
const disabled = incomingDisabled || value === undefined || value === null;
|
|
71
|
+
const onDecrement = useCallback(() => onChange(takeStep({
|
|
72
|
+
direction: 'DOWN',
|
|
73
|
+
step,
|
|
74
|
+
min,
|
|
75
|
+
max,
|
|
76
|
+
value
|
|
77
|
+
})), [step, min, max, value, onChange]);
|
|
78
|
+
const onIncrement = useCallback(() => onChange(takeStep({
|
|
79
|
+
direction: 'UP',
|
|
80
|
+
step,
|
|
81
|
+
min,
|
|
82
|
+
max,
|
|
83
|
+
value
|
|
84
|
+
})), [step, min, max, value, onChange]);
|
|
85
|
+
const keyDownHandler = useCallback(event => {
|
|
86
|
+
switch (event.key) {
|
|
87
|
+
case 'ArrowLeft':
|
|
88
|
+
return onDecrement();
|
|
89
|
+
|
|
90
|
+
case 'ArrowRight':
|
|
91
|
+
return onIncrement();
|
|
92
|
+
|
|
93
|
+
case 'Home':
|
|
94
|
+
event.preventDefault();
|
|
95
|
+
return onChange(min);
|
|
96
|
+
|
|
97
|
+
case 'End':
|
|
98
|
+
event.preventDefault();
|
|
99
|
+
return onChange(max);
|
|
100
|
+
|
|
101
|
+
case 'Escape':
|
|
102
|
+
event.currentTarget.blur();
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
}, [min, max, onDecrement, onIncrement, onChange]);
|
|
106
|
+
return _jsx(Box, {
|
|
107
|
+
className: clsx(className, styles.root, useBoxStyles({
|
|
108
|
+
is: 'button'
|
|
109
|
+
}), disabled && styles.disabled, {
|
|
110
|
+
[styles.width.default]: !isFullWidth,
|
|
111
|
+
[styles.width.full]: isFullWidth
|
|
112
|
+
}),
|
|
113
|
+
userSelect: "none",
|
|
114
|
+
"aria-disabled": disabled,
|
|
115
|
+
tabIndex: 0,
|
|
116
|
+
borderWidth: "1",
|
|
117
|
+
borderColour: "gray",
|
|
118
|
+
padding: "3",
|
|
119
|
+
borderRadius: "1",
|
|
120
|
+
boxShadow: "2",
|
|
121
|
+
onKeyDown: keyDownHandler,
|
|
122
|
+
children: _jsxs(Columns, {
|
|
123
|
+
noWrap: true,
|
|
124
|
+
width: "full",
|
|
125
|
+
children: [_jsx(Column, {
|
|
126
|
+
noShrink: true,
|
|
127
|
+
alignSelf: "centre",
|
|
128
|
+
children: _jsx(Handle, {
|
|
129
|
+
icon: MinusIcon,
|
|
130
|
+
label: "step down",
|
|
131
|
+
disabled: disabled,
|
|
132
|
+
onClick: onDecrement
|
|
133
|
+
})
|
|
134
|
+
}), _jsx(Column, {
|
|
135
|
+
noShrink: true,
|
|
136
|
+
grow: true,
|
|
137
|
+
width: "auto",
|
|
138
|
+
alignSelf: "centre",
|
|
139
|
+
children: _jsx(Text, {
|
|
140
|
+
is: "span",
|
|
141
|
+
align: "center",
|
|
142
|
+
colour: "dark",
|
|
143
|
+
display: "block",
|
|
144
|
+
className: clsx(useBoxStyles({
|
|
145
|
+
paddingX: '2',
|
|
146
|
+
width: 'full',
|
|
147
|
+
is: 'span'
|
|
148
|
+
}), styles.label),
|
|
149
|
+
size: "4",
|
|
150
|
+
children: Number.isFinite(value) ? format(value) : ''
|
|
151
|
+
})
|
|
152
|
+
}), _jsx(Column, {
|
|
153
|
+
noShrink: true,
|
|
154
|
+
alignSelf: "centre",
|
|
155
|
+
children: _jsx(Handle, {
|
|
156
|
+
icon: PlusIcon,
|
|
157
|
+
label: "step up",
|
|
158
|
+
disabled: disabled,
|
|
159
|
+
onClick: onIncrement
|
|
160
|
+
})
|
|
161
|
+
})]
|
|
162
|
+
})
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
export default Stepper;
|
|
@@ -1,54 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import * as __vanilla_filescope__ from '@vanilla-extract/css/fileScope';
|
|
4
|
+
|
|
5
|
+
__vanilla_filescope__.setFileScope("lib/components/Switch/Switch.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
|
const handleSize = '24px';
|
|
4
10
|
const handleOffset = '2px';
|
|
5
11
|
const borderSize = '1px';
|
|
6
12
|
export const handle = styleVariants({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
});
|
|
13
|
+
default: {
|
|
14
|
+
borderColor: vars.border.colours.gray,
|
|
15
|
+
top: "calc(".concat(handleOffset, " - ").concat(borderSize, ")"),
|
|
16
|
+
left: "calc(".concat(handleOffset, " - ").concat(borderSize, ")"),
|
|
17
|
+
width: "".concat(handleSize),
|
|
18
|
+
height: "".concat(handleSize),
|
|
19
|
+
transition: 'transform 0.2s cubic-bezier(0, 0, 0.2, 1) 0s',
|
|
20
|
+
willChange: 'transform'
|
|
21
|
+
},
|
|
22
|
+
transition: {
|
|
23
|
+
transform: "translateX(calc(".concat(handleSize, " - (2 * ").concat(handleOffset, ")))"),
|
|
24
|
+
borderColor: vars.colours.intent.primary.background.strong
|
|
25
|
+
}
|
|
26
|
+
}, "handle");
|
|
21
27
|
export const toggled = style({
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
});
|
|
28
|
+
borderColor: vars.colours.intent.primary.background.strong,
|
|
29
|
+
backgroundColor: vars.colours.intent.primary.background.standard
|
|
30
|
+
}, "toggled");
|
|
25
31
|
export const disabled = styleVariants({
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
selectors: {
|
|
37
|
-
'&[aria-disabled=true]': {
|
|
38
|
-
borderColor: vars.border.colours.light,
|
|
39
|
-
backgroundColor: vars.colours.intent.primary.background.mild,
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
export const root = style({
|
|
45
|
-
width: `calc((2 * ${handleSize}) + ${handleOffset} - 2 * ${borderSize})`,
|
|
46
|
-
height: `calc(${handleSize} + (${handleOffset} * 2))`,
|
|
47
|
-
transition: 'background-color 0.2s cubic-bezier(0, 0, 0.2, 1) 0s',
|
|
48
|
-
border: `${borderSize} solid ${vars.border.colours.light}`,
|
|
32
|
+
default: {
|
|
33
|
+
selectors: {
|
|
34
|
+
'&[aria-disabled=true]': {
|
|
35
|
+
cursor: 'not-allowed',
|
|
36
|
+
borderColor: vars.border.colours.light,
|
|
37
|
+
backgroundColor: vars.border.colours.light
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
toggled: {
|
|
49
42
|
selectors: {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
43
|
+
'&[aria-disabled=true]': {
|
|
44
|
+
borderColor: vars.border.colours.light,
|
|
45
|
+
backgroundColor: vars.colours.intent.primary.background.mild
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}, "disabled");
|
|
50
|
+
export const root = style({
|
|
51
|
+
width: "calc((2 * ".concat(handleSize, ") + ").concat(handleOffset, " - 2 * ").concat(borderSize, ")"),
|
|
52
|
+
height: "calc(".concat(handleSize, " + (").concat(handleOffset, " * 2))"),
|
|
53
|
+
transition: 'background-color 0.2s cubic-bezier(0, 0, 0.2, 1) 0s',
|
|
54
|
+
border: "".concat(borderSize, " solid ").concat(vars.border.colours.light),
|
|
55
|
+
selectors: {
|
|
56
|
+
["&:not(".concat(disabled.default, "):not(").concat(disabled.toggled, "):focus")]: {
|
|
57
|
+
borderColor: vars.colours.intent.information.background.standard
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}, "root");
|
|
61
|
+
|
|
62
|
+
__vanilla_filescope__.endFileScope();
|
|
@@ -1,25 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
import clsx from 'clsx';
|
|
2
4
|
import * as React from 'react';
|
|
3
5
|
import { useCallback } from 'react';
|
|
4
|
-
import { Box, useBoxStyles } from
|
|
5
|
-
import { useTextStyles } from
|
|
6
|
-
import * as styles from
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
6
|
+
import { Box, useBoxStyles } from "../Box/index.js";
|
|
7
|
+
import { useTextStyles } from "../Text/index.js";
|
|
8
|
+
import * as styles from "./Switch.css.js";
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
export const Switch = _ref => {
|
|
11
|
+
let {
|
|
12
|
+
className = '',
|
|
13
|
+
disabled = false,
|
|
14
|
+
toggled = false,
|
|
15
|
+
onChange
|
|
16
|
+
} = _ref;
|
|
17
|
+
const onToggle = useCallback(() => {
|
|
18
|
+
if (disabled) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (typeof onChange === 'function') {
|
|
23
|
+
onChange(!toggled);
|
|
24
|
+
}
|
|
25
|
+
}, [disabled, toggled]);
|
|
26
|
+
return _jsx(Box, {
|
|
27
|
+
is: "button",
|
|
28
|
+
className: clsx(styles.root, useTextStyles({
|
|
29
|
+
size: '5'
|
|
30
|
+
}), {
|
|
31
|
+
[styles.toggled]: toggled,
|
|
32
|
+
[styles.disabled.default]: disabled,
|
|
33
|
+
[styles.disabled.toggled]: toggled && disabled
|
|
34
|
+
}, className),
|
|
35
|
+
tabIndex: disabled ? -1 : void 0,
|
|
36
|
+
borderRadius: "pill",
|
|
37
|
+
position: "relative",
|
|
38
|
+
"aria-disabled": disabled,
|
|
39
|
+
"aria-label": "toggle ".concat(toggled ? 'on' : 'off'),
|
|
40
|
+
onClick: onToggle,
|
|
41
|
+
children: _jsx(Box, {
|
|
42
|
+
borderWidth: "1",
|
|
43
|
+
position: "absolute",
|
|
44
|
+
borderRadius: "pill",
|
|
45
|
+
backgroundColour: "white",
|
|
46
|
+
padding: "none",
|
|
47
|
+
boxShadow: "2",
|
|
48
|
+
className: clsx(styles.handle.default, useBoxStyles({
|
|
49
|
+
is: 'button'
|
|
50
|
+
}), useTextStyles({
|
|
51
|
+
colour: 'white'
|
|
52
|
+
}), {
|
|
53
|
+
[styles.handle.transition]: toggled
|
|
54
|
+
})
|
|
55
|
+
})
|
|
56
|
+
});
|
|
24
57
|
};
|
|
25
|
-
export default Switch;
|
|
58
|
+
export default Switch;
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import * as __vanilla_filescope__ from '@vanilla-extract/css/fileScope';
|
|
4
|
+
|
|
5
|
+
__vanilla_filescope__.setFileScope("lib/components/Table/Table.css.ts", "@autoguru/overdrive");
|
|
6
|
+
|
|
1
7
|
import { style } from '@vanilla-extract/css';
|
|
2
8
|
export const root = style({
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
});
|
|
9
|
+
display: 'grid',
|
|
10
|
+
gridGap: '0',
|
|
11
|
+
alignItems: 'stretch',
|
|
12
|
+
clipPath: 'inset(0)',
|
|
13
|
+
clip: 'rect(0px, auto, auto, 0px)'
|
|
14
|
+
}, "root");
|
|
15
|
+
|
|
16
|
+
__vanilla_filescope__.endFileScope();
|
|
@@ -1,8 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
import * as React from 'react';
|
|
2
4
|
import { forwardRef } from 'react';
|
|
3
|
-
import { Box } from
|
|
4
|
-
import * as styles from
|
|
5
|
-
import { TableContextProvider } from
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
import { Box } from "../Box/index.js";
|
|
6
|
+
import * as styles from "./Table.css.js";
|
|
7
|
+
import { TableContextProvider } from "./context.js";
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
export const Table = forwardRef((_ref, ref) => {
|
|
10
|
+
let {
|
|
11
|
+
children,
|
|
12
|
+
padding = '4',
|
|
13
|
+
stickyHead = false,
|
|
14
|
+
columnTemplate
|
|
15
|
+
} = _ref;
|
|
16
|
+
return _jsx(TableContextProvider, {
|
|
17
|
+
padding: padding,
|
|
18
|
+
stickyHead: stickyHead,
|
|
19
|
+
children: _jsx(Box, {
|
|
20
|
+
ref: ref,
|
|
21
|
+
role: "grid",
|
|
22
|
+
width: "full",
|
|
23
|
+
style: {
|
|
24
|
+
gridTemplateColumns: columnTemplate
|
|
25
|
+
},
|
|
26
|
+
className: styles.root,
|
|
27
|
+
children: children
|
|
28
|
+
})
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
export default Table;
|
|
@@ -1,22 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import * as __vanilla_filescope__ from '@vanilla-extract/css/fileScope';
|
|
4
|
+
|
|
5
|
+
__vanilla_filescope__.setFileScope("lib/components/Table/TableCell.css.ts", "@autoguru/overdrive");
|
|
6
|
+
|
|
1
7
|
import { style } from '@vanilla-extract/css';
|
|
2
|
-
import { themeContractVars as vars } from
|
|
8
|
+
import { themeContractVars as vars } from "../../themes/theme.css.js";
|
|
3
9
|
export const root = style({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
});
|
|
10
|
+
position: 'relative',
|
|
11
|
+
':before': {
|
|
12
|
+
display: 'block',
|
|
13
|
+
content: '""',
|
|
14
|
+
position: 'absolute',
|
|
15
|
+
zIndex: -1,
|
|
16
|
+
top: 0,
|
|
17
|
+
bottom: 0,
|
|
18
|
+
left: '-1000%',
|
|
19
|
+
right: '-1000%',
|
|
20
|
+
transition: "background-color 0.2s ".concat(vars.animation.easing.accelerate)
|
|
21
|
+
},
|
|
22
|
+
selectors: {
|
|
23
|
+
'&:hover:before': {
|
|
24
|
+
transitionTimingFunction: vars.animation.easing.decelerate,
|
|
25
|
+
backgroundColor: vars.border.colours.light
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}, "root");
|
|
29
|
+
|
|
30
|
+
__vanilla_filescope__.endFileScope();
|
|
@@ -1,14 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
import * as React from 'react';
|
|
2
4
|
import { forwardRef } from 'react';
|
|
3
|
-
import { alignmentToFlexAlignment } from
|
|
4
|
-
import { Box } from
|
|
5
|
-
import { Text } from
|
|
6
|
-
import * as styles from
|
|
7
|
-
import { useTableContext } from
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
import { alignmentToFlexAlignment } from "../../utils/index.js";
|
|
6
|
+
import { Box } from "../Box/index.js";
|
|
7
|
+
import { Text } from "../Text/index.js";
|
|
8
|
+
import * as styles from "./TableCell.css.js";
|
|
9
|
+
import { useTableContext } from "./context.js";
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
export const TableCell = forwardRef((_ref, ref) => {
|
|
12
|
+
var _ref2;
|
|
13
|
+
|
|
14
|
+
let {
|
|
15
|
+
padding: incomingPadding,
|
|
16
|
+
align = 'left',
|
|
17
|
+
'aria-label': ariaLabel,
|
|
18
|
+
children
|
|
19
|
+
} = _ref;
|
|
20
|
+
const tableContext = useTableContext();
|
|
21
|
+
const padding = (_ref2 = incomingPadding !== null && incomingPadding !== void 0 ? incomingPadding : tableContext === null || tableContext === void 0 ? void 0 : tableContext.padding) !== null && _ref2 !== void 0 ? _ref2 : 'none';
|
|
22
|
+
return _jsx(Box, {
|
|
23
|
+
ref: ref,
|
|
24
|
+
role: "gridcell",
|
|
25
|
+
scope: "row",
|
|
26
|
+
display: "flex",
|
|
27
|
+
alignItems: "center",
|
|
28
|
+
justifyContent: alignmentToFlexAlignment(align),
|
|
29
|
+
padding: padding,
|
|
30
|
+
borderColourBottom: "light",
|
|
31
|
+
borderWidthBottom: "1",
|
|
32
|
+
"aria-label": ariaLabel,
|
|
33
|
+
className: styles.root,
|
|
34
|
+
children: typeof children === 'string' || typeof children === 'number' ? _jsx(Text, {
|
|
35
|
+
is: "span",
|
|
36
|
+
align: align,
|
|
37
|
+
colour: "dark",
|
|
38
|
+
display: "block",
|
|
39
|
+
size: "3",
|
|
40
|
+
children: children
|
|
41
|
+
}) : children
|
|
42
|
+
});
|
|
13
43
|
});
|
|
14
|
-
export default TableCell;
|
|
44
|
+
export default TableCell;
|