@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.
Files changed (86) hide show
  1. package/dist/components/Actions/Actions.js +12 -15
  2. package/dist/components/Alert/Alert.js +8 -9
  3. package/dist/components/AutoSuggest/AutoSuggest.js +114 -126
  4. package/dist/components/Badge/Badge.js +8 -9
  5. package/dist/components/BulletList/Bullet.js +4 -5
  6. package/dist/components/BulletList/BulletList.js +4 -5
  7. package/dist/components/BulletText/BulletText.js +44 -47
  8. package/dist/components/Button/Button.js +23 -24
  9. package/dist/components/CheckBox/CheckBox.js +11 -12
  10. package/dist/components/DateTimePicker/CalendarGrid.js +7 -8
  11. package/dist/components/DateTimePicker/DateTimePicker.js +9 -10
  12. package/dist/components/DividerLine/DividerLine.js +16 -19
  13. package/dist/components/DropDown/DropDownOptionsList.js +15 -18
  14. package/dist/components/Flex/flex.js +35 -41
  15. package/dist/components/HorizontalAutoScroller/HorizontalAutoScroller.js +12 -13
  16. package/dist/components/HorizontalAutoScroller/useHorizontalAutoScroller.js +7 -8
  17. package/dist/components/Icon/Icon.js +6 -7
  18. package/dist/components/Image/ImageServerProvider.js +17 -21
  19. package/dist/components/Inline/Inline.js +13 -15
  20. package/dist/components/IntentStripe/IntentStripe.js +10 -13
  21. package/dist/components/LinearProgressIndicator/LinearProgressIndicator.js +3 -4
  22. package/dist/components/Meta/Meta.js +18 -21
  23. package/dist/components/Modal/Modal.js +13 -14
  24. package/dist/components/NumberBubble/NumberBubble.d.ts.map +1 -1
  25. package/dist/components/NumberBubble/NumberBubble.js +28 -29
  26. package/dist/components/NumberInput/useNumberInputBehaviours.js +8 -9
  27. package/dist/components/OptionGrid/OptionGrid.js +53 -57
  28. package/dist/components/OptionList/OptionListItem.js +4 -5
  29. package/dist/components/OrderedList/OrderedList.js +14 -18
  30. package/dist/components/OutsideClick/OutsideClick.js +4 -5
  31. package/dist/components/OverdriveProvider/FallbackProvider.js +3 -4
  32. package/dist/components/OverdriveProvider/OverdriveProvider.js +8 -9
  33. package/dist/components/Pagination/Bubble.js +8 -9
  34. package/dist/components/Pagination/Pagination.js +56 -63
  35. package/dist/components/Portal/Portal.js +5 -6
  36. package/dist/components/ProgressBar/ProgressBar.js +16 -19
  37. package/dist/components/ProgressBarGroup/ProgressBarGroup.js +7 -8
  38. package/dist/components/ProgressSpinner/ProgressSpinner.js +23 -26
  39. package/dist/components/Radio/Radio.js +6 -7
  40. package/dist/components/Radio/RadioGroup.js +7 -8
  41. package/dist/components/Section/Section.js +12 -15
  42. package/dist/components/SimplePagination/SimplePagination.js +5 -6
  43. package/dist/components/SliderProgress/ProgressStep.js +9 -10
  44. package/dist/components/SliderProgress/SliderProgress.js +25 -28
  45. package/dist/components/Stack/Stack.js +9 -10
  46. package/dist/components/StandardModal/StandardModal.js +11 -12
  47. package/dist/components/StarRating/StarRating.js +32 -36
  48. package/dist/components/Stepper/Stepper.js +45 -50
  49. package/dist/components/Table/Table.js +20 -23
  50. package/dist/components/Table/TableCell.js +8 -9
  51. package/dist/components/Table/TableHeadCell.js +10 -11
  52. package/dist/components/Table/TableRow.js +10 -13
  53. package/dist/components/Table/TableRowGroup.js +8 -11
  54. package/dist/components/Table/context.js +5 -6
  55. package/dist/components/Tabs/Tab.js +6 -7
  56. package/dist/components/Tabs/TabList.js +5 -6
  57. package/dist/components/Tabs/TabPane.js +4 -5
  58. package/dist/components/Tabs/TabPanes.js +18 -21
  59. package/dist/components/Tabs/Tabs.js +7 -8
  60. package/dist/components/TextContainer/TextContainer.js +21 -24
  61. package/dist/components/Toaster/Toast.js +65 -98
  62. package/dist/components/Tooltip/Tooltip.js +10 -11
  63. package/dist/components/Tooltip/useTooltip/useTooltip.js +11 -13
  64. package/dist/components/private/CheckableBase/CheckableBase.js +12 -13
  65. package/dist/components/private/InputBase/HintText.js +7 -8
  66. package/dist/components/private/InputBase/NotchedBase.js +17 -18
  67. package/dist/components/private/InputBase/withEnhancedInput.js +182 -187
  68. package/dist/hooks/useAnimationEvents/useAnimationEvents.js +5 -6
  69. package/dist/hooks/useAttachedBoxes/useAttachedBoxes.js +9 -10
  70. package/dist/hooks/useMedia/useMedia.js +1 -2
  71. package/dist/hooks/useWindowHeightFill/useWindowHeightFill.js +8 -9
  72. package/dist/styles/sprinkles.css.js +9 -18
  73. package/dist/styles/typography.js +28 -31
  74. package/dist/themes/helpers.js +13 -15
  75. package/dist/themes/makeTheme.js +8 -15
  76. package/dist/utils/css.js +1 -2
  77. package/dist/utils/dataAttrs.js +1 -2
  78. package/dist/utils/index.js +3 -9
  79. package/dist/utils/mapTokenToProperty.js +5 -14
  80. package/dist/utils/number.js +1 -2
  81. package/dist/utils/responsiveProps.css.js +1 -2
  82. package/dist/utils/sprinkles.js +1 -2
  83. package/package.json +2 -2
  84. package/dist/components/NumberBubble/NumberBubble.css.d.ts +0 -2
  85. package/dist/components/NumberBubble/NumberBubble.css.d.ts.map +0 -1
  86. 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((_ref, ref) => {
10
- let {
11
- children
12
- } = _ref;
13
- return /*#__PURE__*/_jsx(Box, {
14
- ref: ref,
15
- className: styles.root,
16
- children: /*#__PURE__*/_jsx(Box, {
17
- className: styles.list,
18
- overflow: "auto",
19
- children: /*#__PURE__*/_jsx(Stack, {
20
- dividers: true,
21
- width: "full",
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 = _ref => {
5
- let {
6
- align,
7
- center,
8
- end,
9
- fullWidth,
10
- gap,
11
- noWrap,
12
- justify,
13
- reverse,
14
- spaceBetween,
15
- start
16
- } = _ref;
17
- return {
18
- alignItems: justify,
19
- display: 'flex',
20
- flexDirection: reverse && 'row-reverse' || 'row',
21
- flexWrap: noWrap === true ? 'nowrap' : 'wrap',
22
- gap,
23
- justifyContent: align !== null && align !== void 0 ? align : start && 'start' || center && 'center' || end && 'end' || spaceBetween && 'space-between' || 'start',
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 = _ref2 => {
48
- let {
49
- align,
50
- center,
51
- end,
52
- gap,
53
- justify,
54
- reverse,
55
- start
56
- } = _ref2;
57
- return {
58
- alignItems: align !== null && align !== void 0 ? align : start && 'start' || center && 'center' || end && 'end' || undefined,
59
- display: 'flex',
60
- flexDirection: reverse && 'column-reverse' || 'column',
61
- gap,
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 = _ref => {
24
- let {
25
- sliderProgressColour = 'primary',
26
- noControls = false,
27
- space = '5',
28
- durationSeconds = 10,
29
- children,
30
- itemsPerPage: incomingItemsPerPage,
31
- paused: incomingIsPaused,
32
- activePage: incomingActivePage,
33
- columnWidth = '1/2',
34
- className
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 = _ref => {
68
- let {
69
- itemsRef,
70
- itemsPerPage = 1,
71
- paused: incomingIsPaused = false,
72
- activePage: incomingActivePage = null,
73
- onChange = () => void 0
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 = _ref => {
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 = _ref => {
37
- let {
38
- children,
39
- srcUrlMapper = defaultValue.srcUrlMapper,
40
- getWidthValue = defaultValue.getWidthValue,
41
- widthMap = defaultValue.widthMap
42
- } = _ref;
43
- const generateSrcSet = useCallback(_ref2 => {
44
- let {
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
- } = _ref2;
48
- return Object.keys(widthMap).map(key => {
49
- const width = getWidthValue === null || getWidthValue === void 0 ? void 0 : getWidthValue(key);
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 = _ref => {
10
- let {
11
- children
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 = _ref2 => {
53
- let {
54
- as = 'div',
55
- alignX,
56
- alignY = 'center',
57
- children,
58
- dividers,
59
- noWrap,
60
- space = '2',
61
- width
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 = _ref => {
8
- let {
9
- className = '',
10
- intent = 'success'
11
- } = _ref;
12
- return /*#__PURE__*/_jsx(Box, {
13
- className: [className, styles.intentBox],
14
- position: "absolute",
15
- height: "full",
16
- backgroundColour: intent,
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(_ref => {
9
- let {
10
- className = ''
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 = _ref => {
10
- let {
11
- icon,
12
- label,
13
- variant = 'primary',
14
- breakWord
15
- } = _ref;
16
- return /*#__PURE__*/_jsxs(Inline, {
17
- noWrap: true,
18
- as: "span",
19
- space: "2",
20
- alignY: "center",
21
- children: [icon && /*#__PURE__*/_jsx(Icon, {
22
- icon: icon,
23
- className: styles.variant[variant]
24
- }), /*#__PURE__*/_jsx(Text, {
25
- breakWord: breakWord,
26
- children: label
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 = _ref => {
72
- let {
73
- isOpen,
74
- hideBackdrop = false,
75
- disableBackdropClick = false,
76
- ref,
77
- noThemedWrapper,
78
- container,
79
- onRequestClose,
80
- children
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 => _ref2 => {
127
+ export const withModal = WrappedComponent => _ref => {
129
128
  let {
130
129
  onRequestClose,
131
130
  isOpen
132
- } = _ref2,
133
- rest = _objectWithoutProperties(_ref2, _excluded);
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":"AAEA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAW,MAAM,OAAO,CAAC;AAInE,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAIpC,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;AAaD,eAAO,MAAM,YAAY,EAAE,iBAAiB,CAAC,iBAAiB,CAqC7D,CAAC"}
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 { sprinkles } from "../../styles/index.js";
10
+ import { textStyles } from "../../styles/typography.js";
12
11
  import { toPrettyBigNumber } from "../../utils/number.js";
13
- import { Box } from "../Box/Box.js";
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 valuePaddingMap = {
18
- SMALL: '2',
19
- MEDIUM: '3',
20
- LARGE: '4',
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 > 9 && value < 100) return 'MEDIUM';
32
- if (value > 99 && value < 9999) return 'LARGE';
33
- if (value >= 9999) return 'LARGE';
34
- return 'SMALL';
27
+ if (value < 10) return 'SMALL';
28
+ if (value >= 10 && value < 100) return 'MEDIUM';
29
+ return 'LARGE';
35
30
  }, [value]);
36
- return /*#__PURE__*/_jsx(Box, _objectSpread(_objectSpread({
37
- borderRadius: "full",
38
- backgroundColour: "gray900",
39
- display: "inline-block",
40
- position: "relative",
41
- padding: valuePaddingMap[size],
42
- odComponent: "number-bubble"
43
- }, boxProps), {}, {
44
- children: /*#__PURE__*/_jsx(Text, {
45
- size: "2",
46
- strong: true,
47
- className: clsx(styles.bubbleText, sprinkles({
48
- position: 'absolute'
49
- })),
50
- colour: textColour,
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 = _ref => {
5
- let {
6
- ref,
7
- preventMouseWheel,
8
- onBlur: incomingOnBlur,
9
- onFocus: incomingOnFocus,
10
- onChange: incomingOnChange,
11
- value
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: _ref2 => {
54
- let {
55
- description,
56
- icon,
57
- label,
58
- name
59
- } = _ref2;
60
- return /*#__PURE__*/_jsx(ListBoxItem, {
61
- className: styledGridItem(),
62
- id: name,
63
- textValue: label,
64
- children: _ref3 => {
65
- let {
66
- isFocusVisible,
67
- isHovered,
68
- isSelected
69
- } = _ref3;
70
- const hasIndicator = indicator !== 'none';
71
- const hasNoInteraction = !isFocusVisible && !isHovered && !isSelected;
72
- const IndicatorIcon = () => {
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
  };