@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,22 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
import * as React from 'react';
|
|
2
4
|
import { useEffect } from 'react';
|
|
3
|
-
import { tokens } from
|
|
4
|
-
import { isBrowser } from
|
|
5
|
-
import { ThemeProvider } from
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
5
|
+
import { tokens } from "../../themes/base/tokens.js";
|
|
6
|
+
import { isBrowser } from "../../utils/index.js";
|
|
7
|
+
import { ThemeProvider } from "../ThemeProvider/ThemeProvider.js";
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
export const OverdriveProvider = _ref => {
|
|
10
|
+
let {
|
|
11
|
+
noBodyLevelTheming = false,
|
|
12
|
+
vars,
|
|
13
|
+
themeClass,
|
|
14
|
+
breakpoints,
|
|
15
|
+
children
|
|
16
|
+
} = _ref;
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (!isBrowser) return;
|
|
19
|
+
|
|
20
|
+
if (!noBodyLevelTheming) {
|
|
21
|
+
document.body.classList.add(themeClass);
|
|
22
|
+
document.body.style.backgroundColor = vars.body.backgroundColour;
|
|
23
|
+
document.body.style.color = vars.body.colour;
|
|
24
|
+
} else {
|
|
25
|
+
document.body.style.backgroundColor = tokens.body.backgroundColour;
|
|
26
|
+
document.body.style.color = tokens.body.colour;
|
|
27
|
+
}
|
|
28
|
+
}, [vars, themeClass]);
|
|
29
|
+
return _jsx(ThemeProvider, {
|
|
30
|
+
vars: vars,
|
|
31
|
+
themeClass: themeClass,
|
|
32
|
+
breakpoints: breakpoints,
|
|
33
|
+
children: children
|
|
34
|
+
});
|
|
21
35
|
};
|
|
22
|
-
export default OverdriveProvider;
|
|
36
|
+
export default OverdriveProvider;
|
|
@@ -1,22 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
import clsx from 'clsx';
|
|
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
|
-
|
|
5
|
+
import { Box } from "../Box/index.js";
|
|
6
|
+
import { useTextStyles } from "../Text/index.js";
|
|
7
|
+
import * as styles from "./Pagination.css.js";
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
export const Bubble = _ref => {
|
|
10
|
+
let {
|
|
11
|
+
className = '',
|
|
12
|
+
selected = false,
|
|
13
|
+
gap = false,
|
|
14
|
+
children,
|
|
15
|
+
disabled,
|
|
16
|
+
onClick
|
|
17
|
+
} = _ref;
|
|
18
|
+
let backgroundColour = 'transparent';
|
|
19
|
+
if (selected) backgroundColour = 'green900';else if (disabled) backgroundColour = 'gray200';
|
|
20
|
+
return _jsx(Box, {
|
|
21
|
+
is: "button",
|
|
22
|
+
backgroundColour: backgroundColour,
|
|
23
|
+
display: "flex",
|
|
24
|
+
overflow: "hidden",
|
|
25
|
+
alignItems: "center",
|
|
26
|
+
flexDirection: "row",
|
|
27
|
+
justifyContent: "center",
|
|
28
|
+
textAlign: "center",
|
|
29
|
+
borderRadius: "pill",
|
|
30
|
+
pointerEvents: disabled ? 'none' : void 0,
|
|
31
|
+
className: clsx(className, useTextStyles({
|
|
32
|
+
fontWeight: 'bold',
|
|
33
|
+
colour: selected ? 'white' : 'light',
|
|
34
|
+
size: '3'
|
|
35
|
+
}), {
|
|
36
|
+
[styles.selectedItem]: selected,
|
|
37
|
+
[styles.disabled]: gap,
|
|
38
|
+
[styles.activeItem]: !gap
|
|
39
|
+
}),
|
|
40
|
+
onClick: onClick,
|
|
41
|
+
children: gap ? '...' : children
|
|
42
|
+
});
|
|
21
43
|
};
|
|
22
|
-
export default Bubble;
|
|
44
|
+
export default Bubble;
|
|
@@ -1,26 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import * as __vanilla_filescope__ from '@vanilla-extract/css/fileScope';
|
|
4
|
+
|
|
5
|
+
__vanilla_filescope__.setFileScope("lib/components/Pagination/Pagination.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
|
const paginationBubbleSize = '36px';
|
|
4
10
|
export const disabled = style({
|
|
5
|
-
|
|
6
|
-
});
|
|
11
|
+
color: vars.colours.background.neutral
|
|
12
|
+
}, "disabled");
|
|
7
13
|
export const selectedItem = style({
|
|
8
|
-
|
|
9
|
-
});
|
|
14
|
+
transition: 'none'
|
|
15
|
+
}, "selectedItem");
|
|
10
16
|
export const activeItem = style({
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
},
|
|
21
|
-
[`&:not(${selectedItem}):active`]: {
|
|
22
|
-
backgroundColor: vars.colours.background.body,
|
|
23
|
-
boxShadow: `inset 0 0 0 1px ${vars.colours.intent.primary.background.strong}, ${vars.elevation['1']}`,
|
|
24
|
-
},
|
|
17
|
+
lineHeight: "calc(".concat(paginationBubbleSize, " - 3px)"),
|
|
18
|
+
width: paginationBubbleSize,
|
|
19
|
+
height: paginationBubbleSize,
|
|
20
|
+
cursor: 'pointer',
|
|
21
|
+
transition: "background-color 0.2s ".concat(vars.animation.easing.decelerate, " 0s, box-shadow 0.2s ").concat(vars.animation.easing.decelerate, " 0s"),
|
|
22
|
+
selectors: {
|
|
23
|
+
["&:not(".concat(selectedItem, "):hover")]: {
|
|
24
|
+
backgroundColor: vars.colours.background.body,
|
|
25
|
+
boxShadow: "inset 0 0 0 1px ".concat(vars.colours.intent.primary.background.strong, ", ").concat(vars.elevation['1'])
|
|
25
26
|
},
|
|
26
|
-
|
|
27
|
+
["&:not(".concat(selectedItem, "):active")]: {
|
|
28
|
+
backgroundColor: vars.colours.background.body,
|
|
29
|
+
boxShadow: "inset 0 0 0 1px ".concat(vars.colours.intent.primary.background.strong, ", ").concat(vars.elevation['1'])
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}, "activeItem");
|
|
33
|
+
|
|
34
|
+
__vanilla_filescope__.endFileScope();
|
|
@@ -1,85 +1,184 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
import { ChevronLeftIcon, ChevronRightIcon } from '@autoguru/icons';
|
|
2
4
|
import clsx from 'clsx';
|
|
3
5
|
import * as React from 'react';
|
|
4
|
-
import { useCallback, useMemo
|
|
5
|
-
import { noop } from
|
|
6
|
-
import { Box } from
|
|
7
|
-
import { Icon } from
|
|
8
|
-
import { Inline } from
|
|
9
|
-
import { useTextStyles } from
|
|
10
|
-
import { Bubble } from
|
|
11
|
-
import * as styles from
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
6
|
+
import { useCallback, useMemo } from 'react';
|
|
7
|
+
import { noop } from "../../utils/index.js";
|
|
8
|
+
import { Box } from "../Box/index.js";
|
|
9
|
+
import { Icon } from "../Icon/index.js";
|
|
10
|
+
import { Inline } from "../Inline/index.js";
|
|
11
|
+
import { useTextStyles } from "../Text/index.js";
|
|
12
|
+
import { Bubble } from "./Bubble.js";
|
|
13
|
+
import * as styles from "./Pagination.css.js";
|
|
14
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
+
|
|
17
|
+
const NavButton = _ref => {
|
|
18
|
+
let {
|
|
19
|
+
icon,
|
|
20
|
+
disabled,
|
|
21
|
+
label = '',
|
|
22
|
+
onClick = noop
|
|
23
|
+
} = _ref;
|
|
24
|
+
return _jsx(Box, {
|
|
25
|
+
is: "button",
|
|
26
|
+
"aria-disabled": disabled,
|
|
27
|
+
"aria-label": label,
|
|
28
|
+
display: "flex",
|
|
29
|
+
overflow: "hidden",
|
|
30
|
+
alignItems: "center",
|
|
31
|
+
flexDirection: "row",
|
|
32
|
+
justifyContent: "center",
|
|
33
|
+
textAlign: "center",
|
|
34
|
+
borderRadius: "pill",
|
|
35
|
+
padding: "2",
|
|
36
|
+
userSelect: "none",
|
|
37
|
+
pointerEvents: disabled ? 'none' : void 0,
|
|
38
|
+
className: clsx(useTextStyles({
|
|
39
|
+
colour: 'light'
|
|
40
|
+
}), {
|
|
41
|
+
[styles.disabled]: disabled
|
|
42
|
+
}),
|
|
43
|
+
onClick: onClick,
|
|
44
|
+
children: _jsx(Icon, {
|
|
45
|
+
size: "medium",
|
|
46
|
+
icon: icon
|
|
47
|
+
})
|
|
48
|
+
});
|
|
32
49
|
};
|
|
50
|
+
|
|
51
|
+
const Loading = _ref2 => {
|
|
52
|
+
let {
|
|
53
|
+
placeholderBubblesNum = 3
|
|
54
|
+
} = _ref2;
|
|
55
|
+
return _jsxs(Inline, {
|
|
56
|
+
is: "span",
|
|
57
|
+
space: "3",
|
|
58
|
+
children: [_jsx(NavButton, {
|
|
59
|
+
disabled: true,
|
|
60
|
+
icon: ChevronLeftIcon
|
|
61
|
+
}), Array.from({
|
|
62
|
+
length: placeholderBubblesNum
|
|
63
|
+
}).fill('').map((_, index) => _jsx(Bubble, {
|
|
64
|
+
children: "",
|
|
65
|
+
disabled: true,
|
|
66
|
+
className: styles.disabled
|
|
67
|
+
}, index)), _jsx(NavButton, {
|
|
68
|
+
disabled: true,
|
|
69
|
+
icon: ChevronRightIcon
|
|
70
|
+
})]
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const Pagination = _ref3 => {
|
|
75
|
+
let {
|
|
76
|
+
total,
|
|
77
|
+
pageSize,
|
|
78
|
+
activePage,
|
|
79
|
+
numPagesDisplayed = 5,
|
|
80
|
+
loading = false,
|
|
81
|
+
onChange = noop
|
|
82
|
+
} = _ref3;
|
|
83
|
+
const numPages = useMemo(() => calcPagesNum(total, pageSize), [total, pageSize]);
|
|
84
|
+
const handleClick = useCallback(num => () => {
|
|
85
|
+
onChange({
|
|
86
|
+
pageNumber: withinBoundaries(num, numPages)
|
|
87
|
+
});
|
|
88
|
+
}, [numPages]);
|
|
89
|
+
const allowedActive = useMemo(() => withinBoundaries(activePage, numPages), [activePage, numPages]);
|
|
90
|
+
return !loading && total && pageSize && activePage && numPagesDisplayed ? _jsxs(Inline, {
|
|
91
|
+
is: "nav",
|
|
92
|
+
space: "3",
|
|
93
|
+
"aria-label": "pagination",
|
|
94
|
+
children: [_jsx(NavButton, {
|
|
95
|
+
disabled: activePage <= 1,
|
|
96
|
+
label: "navigate back",
|
|
97
|
+
icon: ChevronLeftIcon,
|
|
98
|
+
onClick: handleClick(activePage - 1)
|
|
99
|
+
}), buildPagesList(numPages, allowedActive, numPagesDisplayed, numPages - numPagesDisplayed).map(num => _jsx(Bubble, {
|
|
100
|
+
gap: num < 0,
|
|
101
|
+
selected: allowedActive === num,
|
|
102
|
+
"aria-current": allowedActive === num ? 'page' : 'false',
|
|
103
|
+
onClick: handleClick(num),
|
|
104
|
+
children: num
|
|
105
|
+
}, num)), _jsx(NavButton, {
|
|
106
|
+
disabled: activePage >= numPages,
|
|
107
|
+
label: "navigate forward",
|
|
108
|
+
icon: ChevronRightIcon,
|
|
109
|
+
onClick: handleClick(allowedActive + 1)
|
|
110
|
+
})]
|
|
111
|
+
}) : _jsx(Loading, {
|
|
112
|
+
placeholderBubblesNum: 3
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
|
|
33
116
|
function calcPagesNum(total, pageSize) {
|
|
34
|
-
|
|
117
|
+
return Math.ceil(total / pageSize);
|
|
35
118
|
}
|
|
119
|
+
|
|
36
120
|
function withinBoundaries(activePage, numPages) {
|
|
37
|
-
|
|
121
|
+
return Math.min(Math.max(1, activePage), numPages);
|
|
38
122
|
}
|
|
123
|
+
|
|
39
124
|
function generateDefaultArray(numPages) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
125
|
+
return Array.from({
|
|
126
|
+
length: numPages
|
|
127
|
+
}).fill(-1).map((_, index) => index + 1);
|
|
43
128
|
}
|
|
129
|
+
|
|
44
130
|
function generateJumpForwardArray(numPages, activePage, numPagesDisplayed) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
131
|
+
return generateDefaultArray(numPagesDisplayed).map((_, index) => {
|
|
132
|
+
const num = index + 1;
|
|
133
|
+
const gapIndex = numPagesDisplayed - 1;
|
|
134
|
+
|
|
135
|
+
if (num < gapIndex) {
|
|
136
|
+
return activePage + index;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (num === gapIndex) {
|
|
140
|
+
return -1;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return numPages;
|
|
144
|
+
});
|
|
56
145
|
}
|
|
146
|
+
|
|
57
147
|
function generateNoJumpArray(numPagesDisplayed, rightBoundary) {
|
|
58
|
-
|
|
148
|
+
return generateDefaultArray(numPagesDisplayed).map((_, index) => rightBoundary + index + 1);
|
|
59
149
|
}
|
|
150
|
+
|
|
60
151
|
function generateJumpBackwardArray(numPages, numPagesDisplayed) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
if (num === gapIndex) {
|
|
68
|
-
return -1;
|
|
69
|
-
}
|
|
70
|
-
return numPages - 4 + index;
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
function buildPagesList(numPages, activePage, numPagesDisplayed, rightBoundary) {
|
|
74
|
-
if (numPages <= numPagesDisplayed) {
|
|
75
|
-
return generateDefaultArray(numPages);
|
|
152
|
+
return generateDefaultArray(numPagesDisplayed).map((_, index) => {
|
|
153
|
+
const num = index + 1;
|
|
154
|
+
const gapIndex = 2;
|
|
155
|
+
|
|
156
|
+
if (num === 1) {
|
|
157
|
+
return 1;
|
|
76
158
|
}
|
|
77
|
-
|
|
78
|
-
|
|
159
|
+
|
|
160
|
+
if (num === gapIndex) {
|
|
161
|
+
return -1;
|
|
79
162
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
163
|
+
|
|
164
|
+
return numPages - 4 + index;
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function buildPagesList(numPages, activePage, numPagesDisplayed, rightBoundary) {
|
|
169
|
+
if (numPages <= numPagesDisplayed) {
|
|
170
|
+
return generateDefaultArray(numPages);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (activePage <= rightBoundary) {
|
|
174
|
+
return generateJumpForwardArray(numPages, activePage, numPagesDisplayed);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (activePage > rightBoundary && activePage <= rightBoundary + 2) {
|
|
178
|
+
return generateNoJumpArray(numPagesDisplayed, rightBoundary);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return generateJumpBackwardArray(numPages, numPagesDisplayed);
|
|
84
182
|
}
|
|
85
|
-
|
|
183
|
+
|
|
184
|
+
export default Pagination;
|
|
@@ -1,30 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
import * as React from 'react';
|
|
2
4
|
import { forwardRef, useLayoutEffect, useState } from 'react';
|
|
3
5
|
import { createPortal } from 'react-dom';
|
|
4
|
-
import { isBrowser, isHtmlElement, setRef } from
|
|
5
|
-
import { useTheme } from
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
6
|
+
import { isBrowser, isHtmlElement, setRef } from "../../utils/index.js";
|
|
7
|
+
import { useTheme } from "../ThemeProvider/index.js";
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
|
|
10
|
+
function Portal(_ref, ref) {
|
|
11
|
+
var _useTheme;
|
|
12
|
+
|
|
13
|
+
let {
|
|
14
|
+
children,
|
|
15
|
+
container,
|
|
16
|
+
noThemedWrapper
|
|
17
|
+
} = _ref;
|
|
18
|
+
const themeClass = (_useTheme = useTheme()) === null || _useTheme === void 0 ? void 0 : _useTheme.themeClass;
|
|
19
|
+
const [mountNode, setMountNode] = useState(null);
|
|
20
|
+
|
|
21
|
+
if (isBrowser) {
|
|
22
|
+
useLayoutEffect(() => {
|
|
23
|
+
setMountNode(isHtmlElement(container) ? container : document.body);
|
|
24
|
+
}, [container]);
|
|
25
|
+
useLayoutEffect(() => {
|
|
26
|
+
if (mountNode) {
|
|
27
|
+
setRef(ref, mountNode);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return () => {
|
|
31
|
+
void setRef(ref, null);
|
|
32
|
+
};
|
|
33
|
+
}, [ref, mountNode]);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (!mountNode) return null;
|
|
37
|
+
return noThemedWrapper ? createPortal(children, mountNode) : createPortal(_jsx("div", {
|
|
38
|
+
className: themeClass,
|
|
39
|
+
children: children
|
|
40
|
+
}), mountNode);
|
|
27
41
|
}
|
|
42
|
+
|
|
28
43
|
const _Portal = forwardRef(Portal);
|
|
44
|
+
|
|
29
45
|
export { _Portal as Portal };
|
|
30
|
-
export default Portal;
|
|
46
|
+
export default Portal;
|
|
@@ -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/Positioner/Positioner.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
|
+
zIndex: 1050,
|
|
10
|
+
top: 0,
|
|
11
|
+
left: 0,
|
|
12
|
+
transform: 'translateZ(0)',
|
|
13
|
+
willChange: 'transform'
|
|
14
|
+
}, "root");
|
|
15
|
+
|
|
16
|
+
__vanilla_filescope__.endFileScope();
|