@autoguru/overdrive 4.44.4-next.0 → 4.44.4
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 +12 -15
- package/dist/components/Alert/Alert.js +8 -9
- package/dist/components/AutoSuggest/AutoSuggest.js +114 -126
- package/dist/components/Badge/Badge.js +8 -9
- package/dist/components/BulletList/Bullet.js +4 -5
- package/dist/components/BulletList/BulletList.js +4 -5
- package/dist/components/BulletText/BulletText.js +44 -47
- package/dist/components/Button/Button.js +23 -24
- package/dist/components/CheckBox/CheckBox.js +11 -12
- package/dist/components/DateTimePicker/CalendarGrid.js +7 -8
- package/dist/components/DateTimePicker/DateTimePicker.js +9 -10
- package/dist/components/DividerLine/DividerLine.js +16 -19
- package/dist/components/DropDown/DropDownOptionsList.js +15 -18
- package/dist/components/Flex/flex.js +35 -41
- package/dist/components/HorizontalAutoScroller/HorizontalAutoScroller.js +12 -13
- package/dist/components/HorizontalAutoScroller/useHorizontalAutoScroller.js +7 -8
- package/dist/components/Icon/Icon.js +6 -7
- package/dist/components/Image/ImageServerProvider.js +17 -21
- package/dist/components/Inline/Inline.js +13 -15
- package/dist/components/IntentStripe/IntentStripe.js +10 -13
- package/dist/components/LinearProgressIndicator/LinearProgressIndicator.js +3 -4
- package/dist/components/Meta/Meta.js +18 -21
- package/dist/components/Modal/Modal.js +13 -14
- package/dist/components/NumberBubble/NumberBubble.d.ts.map +1 -1
- package/dist/components/NumberBubble/NumberBubble.js +28 -29
- package/dist/components/NumberInput/useNumberInputBehaviours.js +8 -9
- package/dist/components/OptionGrid/OptionGrid.js +53 -57
- package/dist/components/OptionList/OptionListItem.js +4 -5
- package/dist/components/OrderedList/OrderedList.js +14 -18
- package/dist/components/OutsideClick/OutsideClick.js +4 -5
- package/dist/components/OverdriveProvider/FallbackProvider.js +3 -4
- package/dist/components/OverdriveProvider/OverdriveProvider.js +8 -9
- package/dist/components/Pagination/Bubble.js +8 -9
- package/dist/components/Pagination/Pagination.js +56 -63
- package/dist/components/Portal/Portal.js +5 -6
- package/dist/components/ProgressBar/ProgressBar.js +16 -19
- package/dist/components/ProgressBarGroup/ProgressBarGroup.js +7 -8
- package/dist/components/ProgressSpinner/ProgressSpinner.js +23 -26
- package/dist/components/Radio/Radio.js +6 -7
- package/dist/components/Radio/RadioGroup.js +7 -8
- package/dist/components/Section/Section.js +12 -15
- package/dist/components/SimplePagination/SimplePagination.js +5 -6
- package/dist/components/SliderProgress/ProgressStep.js +9 -10
- package/dist/components/SliderProgress/SliderProgress.js +25 -28
- package/dist/components/Stack/Stack.js +9 -10
- package/dist/components/StandardModal/StandardModal.js +11 -12
- package/dist/components/StarRating/StarRating.js +32 -36
- package/dist/components/Stepper/Stepper.js +45 -50
- package/dist/components/Table/Table.js +20 -23
- package/dist/components/Table/TableCell.js +8 -9
- package/dist/components/Table/TableHeadCell.js +10 -11
- package/dist/components/Table/TableRow.js +10 -13
- package/dist/components/Table/TableRowGroup.js +8 -11
- package/dist/components/Table/context.js +5 -6
- package/dist/components/Tabs/Tab.js +6 -7
- package/dist/components/Tabs/TabList.js +5 -6
- package/dist/components/Tabs/TabPane.js +4 -5
- package/dist/components/Tabs/TabPanes.js +18 -21
- package/dist/components/Tabs/Tabs.js +7 -8
- package/dist/components/TextContainer/TextContainer.js +21 -24
- package/dist/components/Toaster/Toast.js +65 -98
- package/dist/components/Tooltip/Tooltip.js +10 -11
- package/dist/components/Tooltip/useTooltip/useTooltip.js +11 -13
- package/dist/components/private/CheckableBase/CheckableBase.js +12 -13
- package/dist/components/private/InputBase/HintText.js +7 -8
- package/dist/components/private/InputBase/NotchedBase.js +17 -18
- package/dist/components/private/InputBase/withEnhancedInput.js +182 -187
- package/dist/hooks/useAnimationEvents/useAnimationEvents.js +5 -6
- package/dist/hooks/useAttachedBoxes/useAttachedBoxes.js +9 -10
- package/dist/hooks/useMedia/useMedia.js +1 -2
- package/dist/hooks/useWindowHeightFill/useWindowHeightFill.js +8 -9
- package/dist/styles/sprinkles.css.js +9 -18
- package/dist/styles/typography.js +28 -31
- package/dist/themes/helpers.js +13 -15
- package/dist/themes/makeTheme.js +8 -15
- package/dist/utils/css.js +1 -2
- package/dist/utils/dataAttrs.js +1 -2
- package/dist/utils/index.js +3 -9
- package/dist/utils/mapTokenToProperty.js +5 -14
- package/dist/utils/number.js +1 -2
- package/dist/utils/responsiveProps.css.js +1 -2
- package/dist/utils/sprinkles.js +1 -2
- package/package.json +2 -2
- package/dist/components/NumberBubble/NumberBubble.css.d.ts +0 -2
- package/dist/components/NumberBubble/NumberBubble.css.d.ts.map +0 -1
- package/dist/components/NumberBubble/NumberBubble.css.js +0 -11
|
@@ -6,23 +6,20 @@ import { Box } from "../Box/index.js";
|
|
|
6
6
|
import { Stack } from "../Stack/index.js";
|
|
7
7
|
import * as styles from "./DropDownOptionsList.css.js";
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
export const DropDownOptionsList = /*#__PURE__*/forwardRef((
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
className: styles.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
space: "none",
|
|
23
|
-
children: children
|
|
24
|
-
})
|
|
9
|
+
export const DropDownOptionsList = /*#__PURE__*/forwardRef(({
|
|
10
|
+
children
|
|
11
|
+
}, ref) => /*#__PURE__*/_jsx(Box, {
|
|
12
|
+
ref: ref,
|
|
13
|
+
className: styles.root,
|
|
14
|
+
children: /*#__PURE__*/_jsx(Box, {
|
|
15
|
+
className: styles.list,
|
|
16
|
+
overflow: "auto",
|
|
17
|
+
children: /*#__PURE__*/_jsx(Stack, {
|
|
18
|
+
dividers: true,
|
|
19
|
+
width: "full",
|
|
20
|
+
space: "none",
|
|
21
|
+
children: children
|
|
25
22
|
})
|
|
26
|
-
})
|
|
27
|
-
});
|
|
23
|
+
})
|
|
24
|
+
}));
|
|
28
25
|
DropDownOptionsList.displayName = 'DropDownOptionsList';
|
|
@@ -1,29 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { sprinkles } from "../../styles/sprinkles.css.js";
|
|
4
|
-
export const inlinePropMapping =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
width: fullWidth === true ? 'full' : undefined
|
|
25
|
-
};
|
|
26
|
-
};
|
|
4
|
+
export const inlinePropMapping = ({
|
|
5
|
+
align,
|
|
6
|
+
center,
|
|
7
|
+
end,
|
|
8
|
+
fullWidth,
|
|
9
|
+
gap,
|
|
10
|
+
noWrap,
|
|
11
|
+
justify,
|
|
12
|
+
reverse,
|
|
13
|
+
spaceBetween,
|
|
14
|
+
start
|
|
15
|
+
}) => ({
|
|
16
|
+
alignItems: justify,
|
|
17
|
+
display: 'flex',
|
|
18
|
+
flexDirection: reverse && 'row-reverse' || 'row',
|
|
19
|
+
flexWrap: noWrap === true ? 'nowrap' : 'wrap',
|
|
20
|
+
gap,
|
|
21
|
+
justifyContent: align !== null && align !== void 0 ? align : start && 'start' || center && 'center' || end && 'end' || spaceBetween && 'space-between' || 'start',
|
|
22
|
+
width: fullWidth === true ? 'full' : undefined
|
|
23
|
+
});
|
|
27
24
|
|
|
28
25
|
/**
|
|
29
26
|
* Creates a horizontal layout, convenience function for use with `className`.
|
|
@@ -44,24 +41,21 @@ export const inline = props => sprinkles(inlinePropMapping(props));
|
|
|
44
41
|
|
|
45
42
|
// ---
|
|
46
43
|
|
|
47
|
-
export const stackPropMapping =
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
justifyContent: justify
|
|
63
|
-
};
|
|
64
|
-
};
|
|
44
|
+
export const stackPropMapping = ({
|
|
45
|
+
align,
|
|
46
|
+
center,
|
|
47
|
+
end,
|
|
48
|
+
gap,
|
|
49
|
+
justify,
|
|
50
|
+
reverse,
|
|
51
|
+
start
|
|
52
|
+
}) => ({
|
|
53
|
+
alignItems: align !== null && align !== void 0 ? align : start && 'start' || center && 'center' || end && 'end' || undefined,
|
|
54
|
+
display: 'flex',
|
|
55
|
+
flexDirection: reverse && 'column-reverse' || 'column',
|
|
56
|
+
gap,
|
|
57
|
+
justifyContent: justify
|
|
58
|
+
});
|
|
65
59
|
|
|
66
60
|
/**
|
|
67
61
|
* Creates a vertical layout, convenience function for use with `className`.
|
|
@@ -20,19 +20,18 @@ import { Stack } from "../Stack/Stack.js";
|
|
|
20
20
|
import * as styles from "./HorizontalAutoScroller.css.js";
|
|
21
21
|
import { useHorizontalAutoScroller } from "./useHorizontalAutoScroller.js";
|
|
22
22
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
|
-
export const HorizontalAutoScroller =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
} = _ref;
|
|
23
|
+
export const HorizontalAutoScroller = ({
|
|
24
|
+
sliderProgressColour = 'primary',
|
|
25
|
+
noControls = false,
|
|
26
|
+
space = '5',
|
|
27
|
+
durationSeconds = 10,
|
|
28
|
+
children,
|
|
29
|
+
itemsPerPage: incomingItemsPerPage,
|
|
30
|
+
paused: incomingIsPaused,
|
|
31
|
+
activePage: incomingActivePage,
|
|
32
|
+
columnWidth = '1/2',
|
|
33
|
+
className
|
|
34
|
+
}) => {
|
|
36
35
|
const incomingItems = useMemo(() => flattenChildren(children), [children]);
|
|
37
36
|
const [activeIndex, setActiveIndex] = useState(incomingActivePage);
|
|
38
37
|
const [itemsRef, setItemsRef] = useState();
|
|
@@ -64,14 +64,13 @@ const stateReducer = (prevState, action) => {
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
};
|
|
67
|
-
export const useHorizontalAutoScroller =
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
} = _ref;
|
|
67
|
+
export const useHorizontalAutoScroller = ({
|
|
68
|
+
itemsRef,
|
|
69
|
+
itemsPerPage = 1,
|
|
70
|
+
paused: incomingIsPaused = false,
|
|
71
|
+
activePage: incomingActivePage = null,
|
|
72
|
+
onChange = () => void 0
|
|
73
|
+
}) => {
|
|
75
74
|
const [{
|
|
76
75
|
pageCount,
|
|
77
76
|
activePage,
|
|
@@ -8,14 +8,13 @@ import { resolveResponsiveStyle } from "../../utils/resolveResponsiveProps.js";
|
|
|
8
8
|
import { Box } from "../Box/Box.js";
|
|
9
9
|
import * as styles from "./Icon.css.js";
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
export const Icon =
|
|
11
|
+
export const Icon = ({
|
|
12
|
+
className,
|
|
13
|
+
icon,
|
|
14
|
+
size = 'small',
|
|
15
|
+
display = 'block'
|
|
16
|
+
}) => {
|
|
12
17
|
var _icon$props$ariaLabe;
|
|
13
|
-
let {
|
|
14
|
-
className,
|
|
15
|
-
icon,
|
|
16
|
-
size = 'small',
|
|
17
|
-
display = 'block'
|
|
18
|
-
} = _ref;
|
|
19
18
|
useNullCheck(icon, 'Icon component received an empty icon prop.');
|
|
20
19
|
const iconElement = /*#__PURE__*/cloneElement(icon, {
|
|
21
20
|
className: elementStyles({
|
|
@@ -33,28 +33,24 @@ const defaultValue = {
|
|
|
33
33
|
// @ts-expect-error type does not allow `null`
|
|
34
34
|
const imageServerCtx = /*#__PURE__*/createContext(null);
|
|
35
35
|
export const useImageServer = () => useContext(imageServerCtx);
|
|
36
|
-
export const ImageServerProvider =
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
36
|
+
export const ImageServerProvider = ({
|
|
37
|
+
children,
|
|
38
|
+
srcUrlMapper = defaultValue.srcUrlMapper,
|
|
39
|
+
getWidthValue = defaultValue.getWidthValue,
|
|
40
|
+
widthMap = defaultValue.widthMap
|
|
41
|
+
}) => {
|
|
42
|
+
const generateSrcSet = useCallback(({
|
|
43
|
+
quality,
|
|
44
|
+
src
|
|
45
|
+
}) => Object.keys(widthMap).map(key => {
|
|
46
|
+
const width = getWidthValue === null || getWidthValue === void 0 ? void 0 : getWidthValue(key);
|
|
47
|
+
// @ts-expect-error width could be undefined
|
|
48
|
+
return `${srcUrlMapper({
|
|
45
49
|
quality,
|
|
46
|
-
src
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
// @ts-expect-error width could be undefined
|
|
51
|
-
return `${srcUrlMapper({
|
|
52
|
-
quality,
|
|
53
|
-
src,
|
|
54
|
-
width
|
|
55
|
-
})} ${width}w`;
|
|
56
|
-
}).join(', ');
|
|
57
|
-
}, [widthMap, srcUrlMapper, getWidthValue]);
|
|
50
|
+
src,
|
|
51
|
+
width
|
|
52
|
+
})} ${width}w`;
|
|
53
|
+
}).join(', '), [widthMap, srcUrlMapper, getWidthValue]);
|
|
58
54
|
return /*#__PURE__*/_jsx(imageServerCtx.Provider, {
|
|
59
55
|
value: useMemo(() => ({
|
|
60
56
|
widthMap,
|
|
@@ -6,10 +6,9 @@ import { Box } from "../Box/Box.js";
|
|
|
6
6
|
import { LIST_MAP } from "../Stack/Stack.js";
|
|
7
7
|
import { Text } from "../Text/Text.js";
|
|
8
8
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
-
const Divider =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
} = _ref;
|
|
9
|
+
const Divider = ({
|
|
10
|
+
children
|
|
11
|
+
}) => {
|
|
13
12
|
if (!children) return null;
|
|
14
13
|
if (typeof children === 'boolean') return /*#__PURE__*/_jsx(Text, {
|
|
15
14
|
"aria-hidden": true,
|
|
@@ -49,17 +48,16 @@ const Divider = _ref => {
|
|
|
49
48
|
* <Text>Link 2</Text>
|
|
50
49
|
* </Inline>
|
|
51
50
|
*/
|
|
52
|
-
export const Inline =
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
} = _ref2;
|
|
51
|
+
export const Inline = ({
|
|
52
|
+
as = 'div',
|
|
53
|
+
alignX,
|
|
54
|
+
alignY = 'center',
|
|
55
|
+
children,
|
|
56
|
+
dividers,
|
|
57
|
+
noWrap,
|
|
58
|
+
space = '2',
|
|
59
|
+
width
|
|
60
|
+
}) => {
|
|
63
61
|
const items = useMemo(() => flattenChildren(children), [children]);
|
|
64
62
|
if (items.length === 0) {
|
|
65
63
|
return null;
|
|
@@ -4,16 +4,13 @@ import * as React from 'react';
|
|
|
4
4
|
import { Box } from "../Box/index.js";
|
|
5
5
|
import * as styles from "./IntentStripe.css.js";
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
export const IntentStripe =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
odComponent: "intent-stripe"
|
|
18
|
-
});
|
|
19
|
-
};
|
|
7
|
+
export const IntentStripe = ({
|
|
8
|
+
className = '',
|
|
9
|
+
intent = 'success'
|
|
10
|
+
}) => /*#__PURE__*/_jsx(Box, {
|
|
11
|
+
className: [className, styles.intentBox],
|
|
12
|
+
position: "absolute",
|
|
13
|
+
height: "full",
|
|
14
|
+
backgroundColour: intent,
|
|
15
|
+
odComponent: "intent-stripe"
|
|
16
|
+
});
|
|
@@ -5,10 +5,9 @@ import { memo } from 'react';
|
|
|
5
5
|
import { Box } from "../Box/index.js";
|
|
6
6
|
import * as styles from "./LinearProgressIndicator.css.js";
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
-
export const LinearProgressIndicator = /*#__PURE__*/memo(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} = _ref;
|
|
8
|
+
export const LinearProgressIndicator = /*#__PURE__*/memo(({
|
|
9
|
+
className = ''
|
|
10
|
+
}) => {
|
|
12
11
|
return /*#__PURE__*/_jsx(Box, {
|
|
13
12
|
position: "relative",
|
|
14
13
|
overflow: "hidden",
|
|
@@ -6,24 +6,21 @@ import { Inline } from "../Inline/Inline.js";
|
|
|
6
6
|
import { Text } from "../Text/Text.js";
|
|
7
7
|
import * as styles from "./Meta.css.js";
|
|
8
8
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
-
export const Meta =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
})]
|
|
28
|
-
});
|
|
29
|
-
};
|
|
9
|
+
export const Meta = ({
|
|
10
|
+
icon,
|
|
11
|
+
label,
|
|
12
|
+
variant = 'primary',
|
|
13
|
+
breakWord
|
|
14
|
+
}) => /*#__PURE__*/_jsxs(Inline, {
|
|
15
|
+
noWrap: true,
|
|
16
|
+
as: "span",
|
|
17
|
+
space: "2",
|
|
18
|
+
alignY: "center",
|
|
19
|
+
children: [icon && /*#__PURE__*/_jsx(Icon, {
|
|
20
|
+
icon: icon,
|
|
21
|
+
className: styles.variant[variant]
|
|
22
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
23
|
+
breakWord: breakWord,
|
|
24
|
+
children: label
|
|
25
|
+
})]
|
|
26
|
+
});
|
|
@@ -68,17 +68,16 @@ const reducer = (prevState, action) => {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
};
|
|
71
|
-
export const Modal =
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
} = _ref;
|
|
71
|
+
export const Modal = ({
|
|
72
|
+
isOpen,
|
|
73
|
+
hideBackdrop = false,
|
|
74
|
+
disableBackdropClick = false,
|
|
75
|
+
ref,
|
|
76
|
+
noThemedWrapper,
|
|
77
|
+
container,
|
|
78
|
+
onRequestClose,
|
|
79
|
+
children
|
|
80
|
+
}) => {
|
|
82
81
|
const [state, dispatch] = useReducer(reducer, 'INITIAL');
|
|
83
82
|
const handleBackdropClick = useEventCallback(event => {
|
|
84
83
|
if (event.target !== event.currentTarget) return;
|
|
@@ -125,12 +124,12 @@ export const Modal = _ref => {
|
|
|
125
124
|
}) : null
|
|
126
125
|
});
|
|
127
126
|
};
|
|
128
|
-
export const withModal = WrappedComponent =>
|
|
127
|
+
export const withModal = WrappedComponent => _ref => {
|
|
129
128
|
let {
|
|
130
129
|
onRequestClose,
|
|
131
130
|
isOpen
|
|
132
|
-
} =
|
|
133
|
-
rest = _objectWithoutProperties(
|
|
131
|
+
} = _ref,
|
|
132
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
134
133
|
// TODO: Deprecate me
|
|
135
134
|
process.env.NODE_ENV !== "production" ? warning(false, 'Using withModal is now an anti-pattern. Use <Modal /> instead') : void 0;
|
|
136
135
|
return /*#__PURE__*/_jsx(Modal, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumberBubble.d.ts","sourceRoot":"","sources":["../../../lib/components/NumberBubble/NumberBubble.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NumberBubble.d.ts","sourceRoot":"","sources":["../../../lib/components/NumberBubble/NumberBubble.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAW,MAAM,OAAO,CAAC;AAInE,OAAO,EAAE,GAAG,EAAiB,MAAM,YAAY,CAAC;AAEhD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,MAAM,WAAW,iBAChB,SAAQ,IAAI,CACX,cAAc,CAAC,OAAO,GAAG,CAAC,EAC1B,cAAc,GAAG,UAAU,GAAG,SAAS,CACvC;IACD,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,cAAc,CAAC,OAAO,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC;CACnD;AASD,eAAO,MAAM,YAAY,EAAE,iBAAiB,CAAC,iBAAiB,CAoC7D,CAAC"}
|
|
@@ -5,20 +5,16 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
5
5
|
const _excluded = ["value", "textColour", "rawNumbers"];
|
|
6
6
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
7
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
|
-
import clsx from 'clsx';
|
|
9
8
|
import * as React from 'react';
|
|
10
9
|
import { useMemo } from 'react';
|
|
11
|
-
import {
|
|
10
|
+
import { textStyles } from "../../styles/typography.js";
|
|
12
11
|
import { toPrettyBigNumber } from "../../utils/number.js";
|
|
13
|
-
import {
|
|
14
|
-
import { Text } from "../Text/Text.js";
|
|
15
|
-
import * as styles from "./NumberBubble.css.js";
|
|
12
|
+
import { useBox } from "../Box/useBox/useBox.js";
|
|
16
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
-
const
|
|
18
|
-
SMALL: '
|
|
19
|
-
MEDIUM: '
|
|
20
|
-
LARGE: '
|
|
21
|
-
X_LARGE: '5'
|
|
14
|
+
const sizeMap = {
|
|
15
|
+
SMALL: '4',
|
|
16
|
+
MEDIUM: '6',
|
|
17
|
+
LARGE: '7'
|
|
22
18
|
};
|
|
23
19
|
export const NumberBubble = _ref => {
|
|
24
20
|
let {
|
|
@@ -28,26 +24,29 @@ export const NumberBubble = _ref => {
|
|
|
28
24
|
} = _ref,
|
|
29
25
|
boxProps = _objectWithoutProperties(_ref, _excluded);
|
|
30
26
|
const size = useMemo(() => {
|
|
31
|
-
if (value
|
|
32
|
-
if (value
|
|
33
|
-
|
|
34
|
-
return 'SMALL';
|
|
27
|
+
if (value < 10) return 'SMALL';
|
|
28
|
+
if (value >= 10 && value < 100) return 'MEDIUM';
|
|
29
|
+
return 'LARGE';
|
|
35
30
|
}, [value]);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
31
|
+
const {
|
|
32
|
+
Component,
|
|
33
|
+
componentProps
|
|
34
|
+
} = useBox(_objectSpread({
|
|
35
|
+
odComponent: 'number-bubble',
|
|
36
|
+
alignItems: 'center',
|
|
37
|
+
backgroundColour: 'gray900',
|
|
38
|
+
borderRadius: 'full',
|
|
39
|
+
display: 'inline-flex',
|
|
40
|
+
justifyContent: 'center',
|
|
41
|
+
size: sizeMap[size]
|
|
42
|
+
}, boxProps));
|
|
43
|
+
return /*#__PURE__*/_jsx(Component, _objectSpread(_objectSpread({}, componentProps), {}, {
|
|
44
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
45
|
+
className: textStyles({
|
|
46
|
+
size: '2',
|
|
47
|
+
colour: textColour,
|
|
48
|
+
strong: true
|
|
49
|
+
}),
|
|
51
50
|
children: rawNumbers ? value : toPrettyBigNumber(value)
|
|
52
51
|
})
|
|
53
52
|
}));
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
4
|
-
export const useNumberInputBehaviours =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
} = _ref;
|
|
4
|
+
export const useNumberInputBehaviours = ({
|
|
5
|
+
ref,
|
|
6
|
+
preventMouseWheel,
|
|
7
|
+
onBlur: incomingOnBlur,
|
|
8
|
+
onFocus: incomingOnFocus,
|
|
9
|
+
onChange: incomingOnChange,
|
|
10
|
+
value
|
|
11
|
+
}) => {
|
|
13
12
|
const inputRef = useRef(ref === null || ref === void 0 ? void 0 : ref.current);
|
|
14
13
|
const [isFocused, setIsFocused] = useState(false);
|
|
15
14
|
const [displayValue, setDisplayValue] = useState(value);
|
|
@@ -50,64 +50,60 @@ export const OptionGrid = _ref => {
|
|
|
50
50
|
}, dataAttrs({
|
|
51
51
|
testid: testId
|
|
52
52
|
})), props), {}, {
|
|
53
|
-
children:
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if (icon && hasNoInteraction) return /*#__PURE__*/_jsx(Icon, {
|
|
74
|
-
icon: icon,
|
|
75
|
-
size: "100%"
|
|
76
|
-
});
|
|
77
|
-
const styledIndicator = indicator === 'radio' ? styledRadioButton : styledCheckbox;
|
|
78
|
-
return /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
|
|
79
|
-
className: styledIndicator()
|
|
80
|
-
}, dataAttrs({
|
|
81
|
-
'focus-visible': isFocusVisible,
|
|
82
|
-
hover: isHovered,
|
|
83
|
-
selected: isSelected
|
|
84
|
-
})), {}, {
|
|
85
|
-
children: indicator === 'checkbox' && /*#__PURE__*/_jsx(Icon, {
|
|
86
|
-
icon: CheckIcon
|
|
87
|
-
})
|
|
88
|
-
}));
|
|
89
|
-
};
|
|
90
|
-
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
91
|
-
children: [hasIndicator && /*#__PURE__*/_jsx("div", {
|
|
92
|
-
className: styleIndicator,
|
|
93
|
-
children: /*#__PURE__*/_jsx(IndicatorIcon, {})
|
|
94
|
-
}), /*#__PURE__*/_jsxs("div", {
|
|
95
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
96
|
-
slot: "label",
|
|
97
|
-
elementType: "div",
|
|
98
|
-
className: labelStyle,
|
|
99
|
-
children: label
|
|
100
|
-
}), description && /*#__PURE__*/_jsx(Text, {
|
|
101
|
-
slot: "description",
|
|
102
|
-
elementType: "div",
|
|
103
|
-
className: descriptionStyle,
|
|
104
|
-
children: description
|
|
105
|
-
})]
|
|
106
|
-
})]
|
|
53
|
+
children: ({
|
|
54
|
+
description,
|
|
55
|
+
icon,
|
|
56
|
+
label,
|
|
57
|
+
name
|
|
58
|
+
}) => /*#__PURE__*/_jsx(ListBoxItem, {
|
|
59
|
+
className: styledGridItem(),
|
|
60
|
+
id: name,
|
|
61
|
+
textValue: label,
|
|
62
|
+
children: ({
|
|
63
|
+
isFocusVisible,
|
|
64
|
+
isHovered,
|
|
65
|
+
isSelected
|
|
66
|
+
}) => {
|
|
67
|
+
const hasIndicator = indicator !== 'none';
|
|
68
|
+
const hasNoInteraction = !isFocusVisible && !isHovered && !isSelected;
|
|
69
|
+
const IndicatorIcon = () => {
|
|
70
|
+
if (icon && hasNoInteraction) return /*#__PURE__*/_jsx(Icon, {
|
|
71
|
+
icon: icon,
|
|
72
|
+
size: "100%"
|
|
107
73
|
});
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
74
|
+
const styledIndicator = indicator === 'radio' ? styledRadioButton : styledCheckbox;
|
|
75
|
+
return /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
|
|
76
|
+
className: styledIndicator()
|
|
77
|
+
}, dataAttrs({
|
|
78
|
+
'focus-visible': isFocusVisible,
|
|
79
|
+
hover: isHovered,
|
|
80
|
+
selected: isSelected
|
|
81
|
+
})), {}, {
|
|
82
|
+
children: indicator === 'checkbox' && /*#__PURE__*/_jsx(Icon, {
|
|
83
|
+
icon: CheckIcon
|
|
84
|
+
})
|
|
85
|
+
}));
|
|
86
|
+
};
|
|
87
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
88
|
+
children: [hasIndicator && /*#__PURE__*/_jsx("div", {
|
|
89
|
+
className: styleIndicator,
|
|
90
|
+
children: /*#__PURE__*/_jsx(IndicatorIcon, {})
|
|
91
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
92
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
93
|
+
slot: "label",
|
|
94
|
+
elementType: "div",
|
|
95
|
+
className: labelStyle,
|
|
96
|
+
children: label
|
|
97
|
+
}), description && /*#__PURE__*/_jsx(Text, {
|
|
98
|
+
slot: "description",
|
|
99
|
+
elementType: "div",
|
|
100
|
+
className: descriptionStyle,
|
|
101
|
+
children: description
|
|
102
|
+
})]
|
|
103
|
+
})]
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
})
|
|
111
107
|
}))
|
|
112
108
|
});
|
|
113
109
|
};
|