@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,76 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
import { ArrowLeftIcon, ArrowRightIcon } from '@autoguru/icons';
|
|
2
4
|
import { invariant } from '@autoguru/utilities';
|
|
3
5
|
import * as React from 'react';
|
|
4
|
-
import { Children, createContext, isValidElement, useCallback, useEffect, useRef, useState
|
|
6
|
+
import { Children, createContext, isValidElement, useCallback, useEffect, useRef, useState } from 'react';
|
|
5
7
|
import flattenChildren from 'react-keyed-flatten-children';
|
|
6
|
-
import { animate, ownerWindow, useEventCallback } from
|
|
7
|
-
import { Box } from
|
|
8
|
-
import { Button } from
|
|
9
|
-
import { Icon } from
|
|
10
|
-
import { useTextStyles } from
|
|
11
|
-
import * as styles from
|
|
8
|
+
import { animate, ownerWindow, useEventCallback } from "../../utils/index.js";
|
|
9
|
+
import { Box } from "../Box/index.js";
|
|
10
|
+
import { Button } from "../Button/index.js";
|
|
11
|
+
import { Icon } from "../Icon/index.js";
|
|
12
|
+
import { useTextStyles } from "../Text/index.js";
|
|
13
|
+
import * as styles from "./TabList.css.js";
|
|
14
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
16
|
export const TabListContext = createContext(null);
|
|
13
|
-
export const TabList =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
export const TabList = _ref => {
|
|
18
|
+
let {
|
|
19
|
+
children,
|
|
20
|
+
stretch = false,
|
|
21
|
+
scrollable = false
|
|
22
|
+
} = _ref;
|
|
23
|
+
!!(stretch && scrollable) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Tabs: `stretch={true}` and `scrollable={true}` cannot be used at the same time.') : invariant(false) : void 0;
|
|
24
|
+
const wrapperRef = useRef(null);
|
|
25
|
+
const innerRef = useRef(null);
|
|
26
|
+
const tabs = Children.map(flattenChildren(children), (child, index) => {
|
|
27
|
+
if (!isValidElement(child)) return null;
|
|
28
|
+
return _jsx(TabListContext.Provider, {
|
|
29
|
+
value: index,
|
|
30
|
+
children: child
|
|
21
31
|
});
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
});
|
|
33
|
+
const [displayScroll, setDisplayScroll] = useState({
|
|
34
|
+
start: false,
|
|
35
|
+
end: false
|
|
36
|
+
});
|
|
37
|
+
const updateScrollButtonState = useEventCallback(() => {
|
|
38
|
+
if (scrollable) {
|
|
39
|
+
const {
|
|
40
|
+
scrollWidth,
|
|
41
|
+
clientWidth,
|
|
42
|
+
scrollLeft
|
|
43
|
+
} = wrapperRef.current;
|
|
44
|
+
const showStartScroll = scrollLeft > 1;
|
|
45
|
+
const showEndScroll = scrollLeft < scrollWidth - clientWidth - 1;
|
|
46
|
+
|
|
47
|
+
if (showStartScroll !== displayScroll.start || showEndScroll !== displayScroll.end) {
|
|
48
|
+
setDisplayScroll({
|
|
49
|
+
start: showStartScroll,
|
|
50
|
+
end: showEndScroll
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
const handleOnScroll = useCallback(() => {
|
|
56
|
+
updateScrollButtonState();
|
|
57
|
+
}, []);
|
|
58
|
+
|
|
59
|
+
const scrollToItem = delta => {
|
|
60
|
+
if (wrapperRef.current) {
|
|
61
|
+
const scrollValue = wrapperRef.current.scrollLeft + delta;
|
|
62
|
+
animate(wrapperRef.current, 'scrollLeft', scrollValue, 300);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const handleStartButton = () => void scrollToItem(-wrapperRef.current.clientWidth);
|
|
67
|
+
|
|
68
|
+
const handleEndButton = () => void scrollToItem(wrapperRef.current.clientWidth);
|
|
69
|
+
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
const win = ownerWindow(wrapperRef.current);
|
|
72
|
+
|
|
73
|
+
const handleResize = () => {
|
|
74
|
+
updateScrollButtonState();
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
win.addEventListener('resize', handleResize, {
|
|
78
|
+
passive: true
|
|
39
79
|
});
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}, []);
|
|
43
|
-
const scrollToItem = (delta) => {
|
|
44
|
-
if (wrapperRef.current) {
|
|
45
|
-
const scrollValue = wrapperRef.current.scrollLeft + delta;
|
|
46
|
-
animate(wrapperRef.current, 'scrollLeft', scrollValue, 300);
|
|
47
|
-
}
|
|
80
|
+
return () => {
|
|
81
|
+
win.removeEventListener('resize', handleResize);
|
|
48
82
|
};
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
83
|
+
}, []);
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
updateScrollButtonState();
|
|
86
|
+
}, [children]);
|
|
87
|
+
const shouldShowScrollButtons = scrollable && (displayScroll.start || displayScroll.end);
|
|
88
|
+
return _jsxs(Box, {
|
|
89
|
+
overflow: "hidden",
|
|
90
|
+
alignItems: "center",
|
|
91
|
+
className: [styles.root.default, shouldShowScrollButtons && styles.root.scroll],
|
|
92
|
+
children: [shouldShowScrollButtons ? _jsx(Button, {
|
|
93
|
+
minimal: true,
|
|
94
|
+
rounded: true,
|
|
95
|
+
withDoubleClicks: true,
|
|
96
|
+
size: "small",
|
|
97
|
+
disabled: !displayScroll.start,
|
|
98
|
+
onClick: handleStartButton,
|
|
99
|
+
children: _jsx(Icon, {
|
|
100
|
+
icon: ArrowLeftIcon
|
|
101
|
+
})
|
|
102
|
+
}) : null, _jsx(Box, {
|
|
103
|
+
ref: wrapperRef,
|
|
104
|
+
className: [scrollable && styles.listWrapperScroll],
|
|
105
|
+
onScroll: handleOnScroll,
|
|
106
|
+
children: _jsx(Box, {
|
|
107
|
+
ref: innerRef,
|
|
108
|
+
display: stretch ? 'flex' : 'block',
|
|
109
|
+
flexWrap: "nowrap",
|
|
110
|
+
width: "full",
|
|
111
|
+
role: "tablist",
|
|
112
|
+
"aria-orientation": "horizontal",
|
|
113
|
+
className: useTextStyles({
|
|
114
|
+
noWrap: true
|
|
115
|
+
}),
|
|
116
|
+
children: tabs
|
|
117
|
+
})
|
|
118
|
+
}), shouldShowScrollButtons ? _jsx(Button, {
|
|
119
|
+
minimal: true,
|
|
120
|
+
rounded: true,
|
|
121
|
+
withDoubleClicks: true,
|
|
122
|
+
size: "small",
|
|
123
|
+
disabled: !displayScroll.end,
|
|
124
|
+
onClick: handleEndButton,
|
|
125
|
+
children: _jsx(Icon, {
|
|
126
|
+
icon: ArrowRightIcon
|
|
127
|
+
})
|
|
128
|
+
}) : null]
|
|
129
|
+
});
|
|
75
130
|
};
|
|
76
|
-
export default TabList;
|
|
131
|
+
export default TabList;
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import * as __vanilla_filescope__ from '@vanilla-extract/css/fileScope';
|
|
4
|
+
|
|
5
|
+
__vanilla_filescope__.setFileScope("lib/components/Tabs/TabPane.css.ts", "@autoguru/overdrive");
|
|
6
|
+
|
|
1
7
|
import { style } from '@vanilla-extract/css';
|
|
2
8
|
export const root = style({
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
9
|
+
float: 'left',
|
|
10
|
+
outline: 'none'
|
|
11
|
+
}, "root");
|
|
12
|
+
|
|
13
|
+
__vanilla_filescope__.endFileScope();
|
|
@@ -1,19 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
import { invariant } from '@autoguru/utilities';
|
|
2
4
|
import * as React from 'react';
|
|
3
5
|
import { useContext } from 'react';
|
|
4
|
-
import { Box } from
|
|
5
|
-
import * as styles from
|
|
6
|
-
import { TabPanesContext } from
|
|
7
|
-
import { TabsContext } from
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
6
|
+
import { Box } from "../Box/index.js";
|
|
7
|
+
import * as styles from "./TabPane.css.js";
|
|
8
|
+
import { TabPanesContext } from "./TabPanes.js";
|
|
9
|
+
import { TabsContext } from "./Tabs.js";
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
export const TabPane = _ref => {
|
|
12
|
+
let {
|
|
13
|
+
children,
|
|
14
|
+
id: incomingId = null
|
|
15
|
+
} = _ref;
|
|
16
|
+
const tabPanesContext = useContext(TabPanesContext);
|
|
17
|
+
const tabsContext = useContext(TabsContext);
|
|
18
|
+
!(tabPanesContext !== null && tabsContext !== null) ? process.env.NODE_ENV !== "production" ? invariant(false, 'TabPane rendered outside Tabs or TabPanes') : invariant(false) : void 0;
|
|
19
|
+
const {
|
|
20
|
+
paneIndex,
|
|
21
|
+
renderInactive
|
|
22
|
+
} = tabPanesContext;
|
|
23
|
+
const myId = typeof incomingId === 'string' ? incomingId : "".concat(tabsContext.id, "-").concat(paneIndex, "-tab");
|
|
24
|
+
const isActive = tabsContext.activeIndex === paneIndex;
|
|
25
|
+
return _jsx(Box, {
|
|
26
|
+
display: isActive ? undefined : 'none',
|
|
27
|
+
"aria-hidden": isActive ? undefined : true,
|
|
28
|
+
className: styles.root,
|
|
29
|
+
tabIndex: 0,
|
|
30
|
+
role: "tabpanel",
|
|
31
|
+
id: myId,
|
|
32
|
+
width: "full",
|
|
33
|
+
children: isActive || renderInactive ? children : undefined
|
|
34
|
+
});
|
|
18
35
|
};
|
|
19
|
-
export default TabPane;
|
|
36
|
+
export default TabPane;
|
|
@@ -1,10 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import * as __vanilla_filescope__ from '@vanilla-extract/css/fileScope';
|
|
4
|
+
|
|
5
|
+
__vanilla_filescope__.setFileScope("lib/components/Tabs/TabPanes.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
|
-
|
|
10
|
-
});
|
|
9
|
+
float: 'left',
|
|
10
|
+
outline: 'none',
|
|
11
|
+
':after': {
|
|
12
|
+
display: 'table',
|
|
13
|
+
clear: 'both',
|
|
14
|
+
content: '""'
|
|
15
|
+
}
|
|
16
|
+
}, "root");
|
|
17
|
+
|
|
18
|
+
__vanilla_filescope__.endFileScope();
|
|
@@ -1,11 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
import * as React from 'react';
|
|
2
4
|
import { Children, createContext } from 'react';
|
|
3
5
|
import flattenChildren from 'react-keyed-flatten-children';
|
|
4
|
-
import { Box } from
|
|
5
|
-
import * as styles from
|
|
6
|
+
import { Box } from "../Box/index.js";
|
|
7
|
+
import * as styles from "./TabPanes.css.js";
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
9
|
export const TabPanesContext = createContext(null);
|
|
7
|
-
export const TabPanes =
|
|
10
|
+
export const TabPanes = _ref => {
|
|
11
|
+
let {
|
|
12
|
+
renderInactivePanes = false,
|
|
13
|
+
children
|
|
14
|
+
} = _ref;
|
|
15
|
+
return _jsx(Box, {
|
|
16
|
+
paddingY: "6",
|
|
17
|
+
className: styles.root,
|
|
18
|
+
width: "full",
|
|
19
|
+
children: Children.map(flattenChildren(children), (child, index) => _jsx(TabPanesContext.Provider, {
|
|
20
|
+
value: {
|
|
8
21
|
paneIndex: index,
|
|
9
|
-
renderInactive: renderInactivePanes
|
|
10
|
-
|
|
11
|
-
|
|
22
|
+
renderInactive: renderInactivePanes
|
|
23
|
+
},
|
|
24
|
+
children: child
|
|
25
|
+
}))
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
export default TabPanes;
|
|
@@ -1,14 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
import * as React from 'react';
|
|
2
4
|
import { createContext, useMemo } from 'react';
|
|
3
|
-
import { useId, useUncontrolledState } from
|
|
5
|
+
import { useId, useUncontrolledState } from "../../utils/index.js";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
7
|
export const TabsContext = createContext(null);
|
|
5
|
-
export const Tabs =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
export const Tabs = _ref => {
|
|
9
|
+
let {
|
|
10
|
+
id: incomingId,
|
|
11
|
+
active = 0,
|
|
12
|
+
onChange,
|
|
13
|
+
children
|
|
14
|
+
} = _ref;
|
|
15
|
+
const [activeState, setActiveState] = useUncontrolledState(active, onChange);
|
|
16
|
+
const id = useId(incomingId !== null && incomingId !== void 0 ? incomingId : undefined);
|
|
17
|
+
return _jsx(TabsContext.Provider, {
|
|
18
|
+
value: useMemo(() => ({
|
|
19
|
+
id,
|
|
20
|
+
activeIndex: activeState,
|
|
21
|
+
onChange: setActiveState
|
|
22
|
+
}), [id, activeState]),
|
|
23
|
+
children: children
|
|
24
|
+
});
|
|
13
25
|
};
|
|
14
|
-
export default Tabs;
|
|
26
|
+
export default Tabs;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export { Tabs } from "./Tabs.js";
|
|
4
|
+
export { Tab } from "./Tab.js";
|
|
5
|
+
export { TabList } from "./TabList.js";
|
|
6
|
+
export { TabPane } from "./TabPane.js";
|
|
7
|
+
export { TabPanes } from "./TabPanes.js";
|
|
@@ -1,16 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
import * as React from 'react';
|
|
2
|
-
import { Box } from
|
|
3
|
-
import { useTextStyles } from
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
4
|
+
import { Box } from "../Box/index.js";
|
|
5
|
+
import { useTextStyles } from "./useTextStyles.js";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
export const Text = _ref => {
|
|
8
|
+
let {
|
|
9
|
+
children,
|
|
10
|
+
className = '',
|
|
11
|
+
is: Component = 'span',
|
|
12
|
+
align = 'left',
|
|
13
|
+
colour,
|
|
14
|
+
display,
|
|
15
|
+
fontWeight = 'normal',
|
|
16
|
+
transform,
|
|
17
|
+
breakWord,
|
|
18
|
+
noWrap,
|
|
19
|
+
size = '4',
|
|
20
|
+
strong = false
|
|
21
|
+
} = _ref;
|
|
22
|
+
return _jsx(Box, {
|
|
23
|
+
is: Component,
|
|
24
|
+
display: display,
|
|
25
|
+
textAlign: align,
|
|
26
|
+
className: [useTextStyles({
|
|
27
|
+
is: Component,
|
|
28
|
+
size,
|
|
29
|
+
colour: colour !== null && colour !== void 0 ? colour : strong ? 'dark' : undefined,
|
|
30
|
+
fontWeight: strong ? 'bold' : fontWeight,
|
|
31
|
+
transform,
|
|
32
|
+
noWrap,
|
|
33
|
+
breakWord
|
|
34
|
+
}), className],
|
|
35
|
+
children: children
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
export default Text;
|
|
@@ -1,23 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
|
+
import * as __vanilla_filescope__ from '@vanilla-extract/css/fileScope';
|
|
5
|
+
|
|
6
|
+
__vanilla_filescope__.setFileScope("lib/components/Text/useTextStyles.css.ts", "@autoguru/overdrive");
|
|
7
|
+
|
|
8
|
+
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; }
|
|
9
|
+
|
|
10
|
+
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; }
|
|
11
|
+
|
|
1
12
|
import { style, styleVariants } from '@vanilla-extract/css';
|
|
2
|
-
import { themeContractVars as vars } from
|
|
3
|
-
import { mapTokenToProperty } from
|
|
13
|
+
import { themeContractVars as vars } from "../../themes/theme.css.js";
|
|
14
|
+
import { mapTokenToProperty } from "../../utils/mapTokenToProperty.js";
|
|
4
15
|
export const root = style({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
});
|
|
12
|
-
export const sizes = styleVariants(Object.entries(vars.typography.size).reduce((result,
|
|
13
|
-
|
|
16
|
+
selectors: {
|
|
17
|
+
'&::selection': {
|
|
18
|
+
color: vars.typography.colour.white,
|
|
19
|
+
background: vars.typography.colour.primary
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}, "root");
|
|
23
|
+
export const sizes = styleVariants(Object.entries(vars.typography.size).reduce((result, _ref) => {
|
|
24
|
+
let [name, size] = _ref;
|
|
25
|
+
return _objectSpread(_objectSpread({}, result), {}, {
|
|
14
26
|
[name]: {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
export const
|
|
21
|
-
export const
|
|
22
|
-
export const
|
|
23
|
-
|
|
27
|
+
fontSize: size.fontSize,
|
|
28
|
+
lineHeight: size.lineHeight
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}, {}), "sizes");
|
|
32
|
+
export const colours = styleVariants(mapTokenToProperty(vars.typography.colour, 'color'), "colours");
|
|
33
|
+
export const fontWeight = styleVariants(mapTokenToProperty(vars.typography.fontWeight, 'fontWeight'), "fontWeight");
|
|
34
|
+
export const noWrap = style({
|
|
35
|
+
whiteSpace: 'nowrap'
|
|
36
|
+
}, "noWrap");
|
|
37
|
+
export const breakWord = style({
|
|
38
|
+
wordBreak: 'break-word'
|
|
39
|
+
}, "breakWord");
|
|
40
|
+
export const transform = styleVariants(mapTokenToProperty({
|
|
41
|
+
uppercase: 'uppercase',
|
|
42
|
+
capitalize: 'capitalize'
|
|
43
|
+
}, 'textTransform'), "transform");
|
|
44
|
+
|
|
45
|
+
__vanilla_filescope__.endFileScope();
|
|
@@ -1,7 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
import clsx from 'clsx';
|
|
2
|
-
import { useBoxStyles } from
|
|
3
|
-
import * as styles from
|
|
4
|
-
export const useTextStyles =
|
|
5
|
-
|
|
4
|
+
import { useBoxStyles } from "../Box/index.js";
|
|
5
|
+
import * as styles from "./useTextStyles.css.js";
|
|
6
|
+
export const useTextStyles = _ref => {
|
|
7
|
+
let {
|
|
8
|
+
align,
|
|
9
|
+
colour,
|
|
10
|
+
fontWeight,
|
|
11
|
+
is,
|
|
12
|
+
noWrap,
|
|
13
|
+
breakWord,
|
|
14
|
+
size,
|
|
15
|
+
transform
|
|
16
|
+
} = _ref;
|
|
17
|
+
return clsx(styles.root, useBoxStyles({
|
|
18
|
+
is,
|
|
19
|
+
textAlign: align
|
|
20
|
+
}), colour !== 'unset' && styles.colours[colour !== null && colour !== void 0 ? colour : 'neutral'], styles.fontWeight[fontWeight], noWrap && styles.noWrap, breakWord && styles.breakWord, styles.sizes[size], styles.transform[transform]);
|
|
6
21
|
};
|
|
7
|
-
export default useTextStyles;
|
|
22
|
+
export default useTextStyles;
|
|
@@ -1,9 +1,37 @@
|
|
|
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 = ["field", "eventHandlers", "validation", "isLoading", "suffixed", "prefixed", "size"];
|
|
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 * as React from 'react';
|
|
2
|
-
import { Box } from
|
|
3
|
-
import { withEnhancedInput } from
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
12
|
+
import { Box } from "../Box/index.js";
|
|
13
|
+
import { withEnhancedInput } from "../private/InputBase/index.js";
|
|
14
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
+
export const TextAreaInput = withEnhancedInput(_ref => {
|
|
16
|
+
let {
|
|
17
|
+
field,
|
|
18
|
+
eventHandlers,
|
|
19
|
+
validation,
|
|
20
|
+
isLoading,
|
|
21
|
+
suffixed,
|
|
22
|
+
prefixed,
|
|
23
|
+
size
|
|
24
|
+
} = _ref,
|
|
25
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
26
|
+
|
|
27
|
+
return _jsx(Box, _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
28
|
+
is: "textarea"
|
|
29
|
+
}, eventHandlers), field), rest), {}, {
|
|
30
|
+
autoComplete: "off"
|
|
31
|
+
}));
|
|
32
|
+
}, {
|
|
33
|
+
primitiveType: 'textarea',
|
|
34
|
+
withSuffixIcon: false,
|
|
35
|
+
withPrefixIcon: false
|
|
8
36
|
});
|
|
9
|
-
export default TextAreaInput;
|
|
37
|
+
export default TextAreaInput;
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import * as __vanilla_filescope__ from '@vanilla-extract/css/fileScope';
|
|
4
|
+
|
|
5
|
+
__vanilla_filescope__.setFileScope("lib/components/TextBubble/TextBubble.css.ts", "@autoguru/overdrive");
|
|
6
|
+
|
|
1
7
|
import { style } from '@vanilla-extract/css';
|
|
2
8
|
export const bubbleText = style({
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
});
|
|
9
|
+
top: '50%',
|
|
10
|
+
left: '50%',
|
|
11
|
+
transform: 'translate(-50%, -50%)',
|
|
12
|
+
textOverflow: 'ellipsis'
|
|
13
|
+
}, "bubbleText");
|
|
14
|
+
|
|
15
|
+
__vanilla_filescope__.endFileScope();
|