@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
@@ -21,202 +21,197 @@ import * as styles from "./withEnhancedInput.css.js"; // The event handlers we'l
21
21
  // An amalgamation of the HoC props, event handlers and the consumer props.
22
22
  // The final props we send into thw wrapping component
23
23
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
- export const withEnhancedInput = function (WrappingComponent) {
24
+ export const withEnhancedInput = (WrappingComponent, {
25
+ primitiveType = 'text',
26
+ withPrefixIcon = true,
27
+ withSuffixIcon = true,
28
+ defaultValue
29
+ // eslint-disable-next-line unicorn/no-object-as-default-parameter
30
+ } = {
31
+ primitiveType: 'text',
32
+ defaultValue: void 0
33
+ }) =>
34
+ /*#__PURE__*/
35
+ // eslint-disable-next-line react/display-name
36
+ forwardRef((_ref, ref) => {
25
37
  let {
26
- primitiveType = 'text',
27
- withPrefixIcon = true,
28
- withSuffixIcon = true,
29
- defaultValue
30
- // eslint-disable-next-line unicorn/no-object-as-default-parameter
31
- } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
32
- primitiveType: 'text',
33
- defaultValue: void 0
34
- };
35
- return (
36
- /*#__PURE__*/
37
- // eslint-disable-next-line react/display-name
38
- forwardRef((_ref, ref) => {
39
- let {
40
- // EnhanceInputPrimitiveProps
41
- placeholder,
42
- name,
43
- id = name,
44
- hintText,
45
- disabled = false,
46
- className,
47
- isTouched,
48
- isValid,
49
- isLoading = false,
50
- notch = true,
51
- reserveHintSpace = false,
52
- size = 'medium',
53
- backgroundColour = 'transparent',
54
- value: incomingValue = defaultValue || '',
55
- onChange: incomingOnChange,
56
- onReset,
57
- onMouseLeave,
58
- onMouseEnter,
59
- onBlur,
60
- onFocus,
61
- onKeyDown,
62
- prefixIcon,
63
- suffixIcon,
64
- wrapperRef,
65
- autoFocus,
66
- attach,
67
- borderMerged
68
- } = _ref,
69
- rest = _objectWithoutProperties(_ref, _excluded);
70
- !!(prefixIcon && !withPrefixIcon) ? process.env.NODE_ENV !== "production" ? invariant(false, 'prefix icon is not supported for this component') : invariant(false) : void 0;
71
- !!(suffixIcon && !withSuffixIcon) ? process.env.NODE_ENV !== "production" ? invariant(false, 'suffix icon is not supported for this component') : invariant(false) : void 0;
72
- const [value, onChange] = useInputControlledState(incomingValue, incomingOnChange);
73
- const [isActive, setActive] = useState(false);
74
- const [isHovered, setIsHovered] = useState(false);
75
- const isEmpty = primitiveType === 'date' && value === '' ? false : value === '';
76
- const derivedColours = derivedColourIntent({
77
- isValid,
78
- isHovered,
79
- isActive,
80
- isTouched,
81
- disabled
82
- }, inputStateStyles);
83
- const iconSize = size === 'small' ? 'medium' : size;
84
- const inputItselfClassName = clsx(elementStyles({
85
- as: primitiveType === 'textarea' ? 'textarea' : 'input',
86
- backgroundColour,
87
- width: 'full',
88
- position: 'relative',
89
- display: 'flex',
90
- borderRadius: 'md'
91
- }), styles.input.itself.root, styles.types[primitiveType], styles.inputItselfSize[size].root.any, styles.inputItselfSize[size].root[primitiveType], {
92
- [styles.inputItselfSize[size].prefixed.any]: Boolean(prefixIcon),
93
- [styles.inputItselfSize[size].prefixed[primitiveType]]: Boolean(prefixIcon),
94
- [styles.inputItselfSize[size].suffixed.any]: Boolean(suffixIcon || isLoading),
95
- [styles.inputItselfSize[size].suffixed[primitiveType]]: Boolean(suffixIcon || isLoading)
96
- });
38
+ // EnhanceInputPrimitiveProps
39
+ placeholder,
40
+ name,
41
+ id = name,
42
+ hintText,
43
+ disabled = false,
44
+ className,
45
+ isTouched,
46
+ isValid,
47
+ isLoading = false,
48
+ notch = true,
49
+ reserveHintSpace = false,
50
+ size = 'medium',
51
+ backgroundColour = 'transparent',
52
+ value: incomingValue = defaultValue || '',
53
+ onChange: incomingOnChange,
54
+ onReset,
55
+ onMouseLeave,
56
+ onMouseEnter,
57
+ onBlur,
58
+ onFocus,
59
+ onKeyDown,
60
+ prefixIcon,
61
+ suffixIcon,
62
+ wrapperRef,
63
+ autoFocus,
64
+ attach,
65
+ borderMerged
66
+ } = _ref,
67
+ rest = _objectWithoutProperties(_ref, _excluded);
68
+ !!(prefixIcon && !withPrefixIcon) ? process.env.NODE_ENV !== "production" ? invariant(false, 'prefix icon is not supported for this component') : invariant(false) : void 0;
69
+ !!(suffixIcon && !withSuffixIcon) ? process.env.NODE_ENV !== "production" ? invariant(false, 'suffix icon is not supported for this component') : invariant(false) : void 0;
70
+ const [value, onChange] = useInputControlledState(incomingValue, incomingOnChange);
71
+ const [isActive, setActive] = useState(false);
72
+ const [isHovered, setIsHovered] = useState(false);
73
+ const isEmpty = primitiveType === 'date' && value === '' ? false : value === '';
74
+ const derivedColours = derivedColourIntent({
75
+ isValid,
76
+ isHovered,
77
+ isActive,
78
+ isTouched,
79
+ disabled
80
+ }, inputStateStyles);
81
+ const iconSize = size === 'small' ? 'medium' : size;
82
+ const inputItselfClassName = clsx(elementStyles({
83
+ as: primitiveType === 'textarea' ? 'textarea' : 'input',
84
+ backgroundColour,
85
+ width: 'full',
86
+ position: 'relative',
87
+ display: 'flex',
88
+ borderRadius: 'md'
89
+ }), styles.input.itself.root, styles.types[primitiveType], styles.inputItselfSize[size].root.any, styles.inputItselfSize[size].root[primitiveType], {
90
+ [styles.inputItselfSize[size].prefixed.any]: Boolean(prefixIcon),
91
+ [styles.inputItselfSize[size].prefixed[primitiveType]]: Boolean(prefixIcon),
92
+ [styles.inputItselfSize[size].suffixed.any]: Boolean(suffixIcon || isLoading),
93
+ [styles.inputItselfSize[size].suffixed[primitiveType]]: Boolean(suffixIcon || isLoading)
94
+ });
97
95
 
98
- /*
99
- Need to disable the type assertion here, as ts has no idea that P and an omitted P without its properties is just P
100
- @see https://stackoverflow.com/a/53951825/2609301
101
- type P = {firstName: string}
102
- type A = P
103
- type B = Omit<P, 'firstName'>
104
- A & B != A _or_ P & Omit<P, 'firstName'> != P
105
- */
96
+ /*
97
+ Need to disable the type assertion here, as ts has no idea that P and an omitted P without its properties is just P
98
+ @see https://stackoverflow.com/a/53951825/2609301
99
+ type P = {firstName: string}
100
+ type A = P
101
+ type B = Omit<P, 'firstName'>
102
+ A & B != A _or_ P & Omit<P, 'firstName'> != P
103
+ */
106
104
 
107
- // @ts-expect-error props not assignable to type
108
- const wrappingComponent = _objectSpread({
109
- validation: {
110
- isTouched,
111
- isValid
112
- },
113
- size,
114
- eventHandlers: {
115
- onChange: wrapEvent(event => {
116
- if (disabled) {
117
- event.preventDefault();
118
- return false;
119
- }
120
- return true;
121
- }, onChange),
122
- // Until https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-within is more stable, the below
123
- // will wrap now
124
- onFocus: wrapEvent(() => setActive(true), onFocus),
125
- onBlur: wrapEvent(() => setActive(false), onBlur),
126
- onMouseEnter,
127
- onMouseLeave,
128
- onKeyDown,
129
- onReset
130
- },
131
- field: {
132
- name,
133
- id,
134
- disabled,
135
- value,
136
- autoFocus,
137
- className: inputItselfClassName,
138
- placeholder: notch ? undefined : placeholder,
139
- ref
140
- },
141
- prefixed: Boolean(prefixIcon),
142
- suffixed: Boolean(suffixIcon),
143
- isLoading,
144
- 'aria-busy': isLoading || void 0
145
- }, rest);
146
- const onMouseOver = useCallback(() => {
147
- setIsHovered(true);
148
- }, []);
149
- const onMouseOut = useCallback(() => {
150
- setIsHovered(false);
151
- }, []);
152
- const iconStyles = sprinkles({
153
- pointerEvents: 'none',
154
- position: 'absolute'
155
- });
156
- return /*#__PURE__*/_jsxs(Box, {
105
+ // @ts-expect-error props not assignable to type
106
+ const wrappingComponent = _objectSpread({
107
+ validation: {
108
+ isTouched,
109
+ isValid
110
+ },
111
+ size,
112
+ eventHandlers: {
113
+ onChange: wrapEvent(event => {
114
+ if (disabled) {
115
+ event.preventDefault();
116
+ return false;
117
+ }
118
+ return true;
119
+ }, onChange),
120
+ // Until https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-within is more stable, the below
121
+ // will wrap now
122
+ onFocus: wrapEvent(() => setActive(true), onFocus),
123
+ onBlur: wrapEvent(() => setActive(false), onBlur),
124
+ onMouseEnter,
125
+ onMouseLeave,
126
+ onKeyDown,
127
+ onReset
128
+ },
129
+ field: {
130
+ name,
131
+ id,
132
+ disabled,
133
+ value,
134
+ autoFocus,
135
+ className: inputItselfClassName,
136
+ placeholder: notch ? undefined : placeholder,
137
+ ref
138
+ },
139
+ prefixed: Boolean(prefixIcon),
140
+ suffixed: Boolean(suffixIcon),
141
+ isLoading,
142
+ 'aria-busy': isLoading || void 0
143
+ }, rest);
144
+ const onMouseOver = useCallback(() => {
145
+ setIsHovered(true);
146
+ }, []);
147
+ const onMouseOut = useCallback(() => {
148
+ setIsHovered(false);
149
+ }, []);
150
+ const iconStyles = sprinkles({
151
+ pointerEvents: 'none',
152
+ position: 'absolute'
153
+ });
154
+ return /*#__PURE__*/_jsxs(Box, {
155
+ width: "full",
156
+ className: className,
157
+ onMouseEnter: onMouseOver,
158
+ onMouseLeave: onMouseOut,
159
+ children: [/*#__PURE__*/_jsx(NotchedBase, {
160
+ id: id,
161
+ prefixed: Boolean(prefixIcon),
162
+ isEmpty: isEmpty,
163
+ size: size,
164
+ disabled: disabled,
165
+ notch: notch,
166
+ placeholder: placeholder,
167
+ attach: attach,
168
+ borderMerged: borderMerged,
169
+ isFocused: isActive,
170
+ isHovered: isHovered,
171
+ placeholderColourClassName: clsx({
172
+ [derivedColours.colour]: !isEmpty
173
+ }),
174
+ borderColourClassName: derivedColours.borderColour,
175
+ children: /*#__PURE__*/_jsxs(Box, {
176
+ ref: wrapperRef,
177
+ className: styles.inputWrapperSize[size].root[primitiveType],
157
178
  width: "full",
158
- className: className,
159
- onMouseEnter: onMouseOver,
160
- onMouseLeave: onMouseOut,
161
- children: [/*#__PURE__*/_jsx(NotchedBase, {
162
- id: id,
163
- prefixed: Boolean(prefixIcon),
164
- isEmpty: isEmpty,
165
- size: size,
166
- disabled: disabled,
167
- notch: notch,
168
- placeholder: placeholder,
169
- attach: attach,
170
- borderMerged: borderMerged,
171
- isFocused: isActive,
172
- isHovered: isHovered,
173
- placeholderColourClassName: clsx({
174
- [derivedColours.colour]: !isEmpty
175
- }),
176
- borderColourClassName: derivedColours.borderColour,
177
- children: /*#__PURE__*/_jsxs(Box, {
178
- ref: wrapperRef,
179
- className: styles.inputWrapperSize[size].root[primitiveType],
180
- width: "full",
181
- height: "full",
182
- children: [prefixIcon ? /*#__PURE__*/_jsx(Icon, {
183
- icon: prefixIcon,
184
- size: iconSize,
185
- className: clsx(iconStyles, styles.iconRoot, styles.prefixIcon, styles.iconSize[size], derivedColours.colour)
186
- }) : null, isLoading ? /*#__PURE__*/_jsx(ProgressSpinner, {
187
- colour: "default",
188
- size: size === 'large' ? size : undefined,
189
- className: clsx(iconStyles, styles.iconRoot, styles.suffixIcon, styles.iconSize[size])
190
- }) : null, suffixIcon && !isLoading ? /*#__PURE__*/_jsx(Icon, {
191
- icon: suffixIcon,
192
- size: iconSize,
193
- className: clsx(iconStyles, styles.iconRoot, styles.suffixIcon, styles.iconSize[size], derivedColours.colour)
194
- }) : null, /*#__PURE__*/_jsx(WrappingComponent, _objectSpread({}, wrappingComponent))]
195
- })
196
- }), hintText || reserveHintSpace ? /*#__PURE__*/_jsx(HintText, {
197
- className: derivedColours.colour,
198
- hintText: hintText,
199
- disabled: disabled,
200
- reserveHintSpace: reserveHintSpace,
201
- size: size
202
- }) : null]
203
- });
204
- })
205
- );
206
- };
179
+ height: "full",
180
+ children: [prefixIcon ? /*#__PURE__*/_jsx(Icon, {
181
+ icon: prefixIcon,
182
+ size: iconSize,
183
+ className: clsx(iconStyles, styles.iconRoot, styles.prefixIcon, styles.iconSize[size], derivedColours.colour)
184
+ }) : null, isLoading ? /*#__PURE__*/_jsx(ProgressSpinner, {
185
+ colour: "default",
186
+ size: size === 'large' ? size : undefined,
187
+ className: clsx(iconStyles, styles.iconRoot, styles.suffixIcon, styles.iconSize[size])
188
+ }) : null, suffixIcon && !isLoading ? /*#__PURE__*/_jsx(Icon, {
189
+ icon: suffixIcon,
190
+ size: iconSize,
191
+ className: clsx(iconStyles, styles.iconRoot, styles.suffixIcon, styles.iconSize[size], derivedColours.colour)
192
+ }) : null, /*#__PURE__*/_jsx(WrappingComponent, _objectSpread({}, wrappingComponent))]
193
+ })
194
+ }), hintText || reserveHintSpace ? /*#__PURE__*/_jsx(HintText, {
195
+ className: derivedColours.colour,
196
+ hintText: hintText,
197
+ disabled: disabled,
198
+ reserveHintSpace: reserveHintSpace,
199
+ size: size
200
+ }) : null]
201
+ });
202
+ });
207
203
  const stateNodeGetter = styles => (isHovered, isActive) => {
208
204
  if (isHovered) return styles.hover;
209
205
  if (isActive) return styles.active;
210
206
  return styles.default;
211
207
  };
212
- const derivedColourIntent = (_ref2, styles) => {
213
- let {
214
- isTouched,
215
- isValid,
216
- disabled,
217
- isHovered,
218
- isActive
219
- } = _ref2;
208
+ const derivedColourIntent = ({
209
+ isTouched,
210
+ isValid,
211
+ disabled,
212
+ isHovered,
213
+ isActive
214
+ }, styles) => {
220
215
  if (disabled) return styles.disabled;
221
216
  if (isTouched === true) {
222
217
  // Validation route
@@ -3,12 +3,11 @@
3
3
  import { useEffect, useRef } from 'react';
4
4
  const finishEvents = ['animationend', 'transitionend', 'transitioncancel'];
5
5
  const startEvents = ['animationstart', 'transitionrun'];
6
- export const useAnimationEvents = _ref => {
7
- let {
8
- onAnimationStart: incomingOnAnimationStart = () => void 0,
9
- onAnimationEnd: incomingOnAnimationEnd = () => void 0,
10
- elementRef: incomingRef
11
- } = _ref;
6
+ export const useAnimationEvents = ({
7
+ onAnimationStart: incomingOnAnimationStart = () => void 0,
8
+ onAnimationEnd: incomingOnAnimationEnd = () => void 0,
9
+ elementRef: incomingRef
10
+ }) => {
12
11
  const elementRef = incomingRef !== null && incomingRef !== void 0 && incomingRef.current ? incomingRef : useRef(null);
13
12
  const onAnimationStart = useRef(incomingOnAnimationStart);
14
13
  const onAnimationEnd = useRef(incomingOnAnimationEnd);
@@ -20,13 +20,12 @@ function useResponsiveValue(responsiveValue) {
20
20
  }, 1);
21
21
  return getEarliestKnownToken(responsiveValue, activeBP);
22
22
  }
23
- export const useAttachedBoxes = _ref => {
24
- let {
25
- count,
26
- columnCount: incomingColumnCount,
27
- gap = '1',
28
- backgroundColour = 'gray900'
29
- } = _ref;
23
+ export const useAttachedBoxes = ({
24
+ count,
25
+ columnCount: incomingColumnCount,
26
+ gap = '1',
27
+ backgroundColour = 'gray900'
28
+ }) => {
30
29
  const columnCount = useResponsiveValue(incomingColumnCount);
31
30
  const decimals = count / columnCount % 1;
32
31
  let colStart;
@@ -36,12 +35,12 @@ export const useAttachedBoxes = _ref => {
36
35
  const bottomLeftIndex = decimals ? Math.floor(count / columnCount) * columnCount : count - columnCount;
37
36
  return [Array.from({
38
37
  length: count
39
- }).map((_, index) => _ref2 => {
38
+ }).map((_, index) => _ref => {
40
39
  let {
41
40
  children,
42
41
  className
43
- } = _ref2,
44
- rest = _objectWithoutProperties(_ref2, _excluded);
42
+ } = _ref,
43
+ rest = _objectWithoutProperties(_ref, _excluded);
45
44
  isLastItem = index === count - 1;
46
45
  if (isLastItem && decimals) {
47
46
  //is last item and is not a perfect division
@@ -4,8 +4,7 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
4
4
  import { useCallback, useLayoutEffect, useMemo, useState } from 'react';
5
5
  import { useRuntimeTokens } from "../../components/OverdriveProvider/index.js";
6
6
  import { isBrowser } from "../../utils/index.js";
7
- export const useMedia = function (queries) {
8
- let fallbackCase = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
7
+ export const useMedia = (queries, fallbackCase = false) => {
9
8
  const {
10
9
  breakpoints
11
10
  } = useRuntimeTokens();
@@ -5,15 +5,14 @@ import { useTheme } from "../../components/OverdriveProvider/index.js";
5
5
  import { overdriveTokens } from "../../themes/theme.css.js";
6
6
  import { getThemeTokenValue } from "../../utils/css.js";
7
7
  import { useResponsiveValue } from "../useResponsiveValue/useResponsiveValue.js";
8
- export const useWindowHeightFill = _ref => {
9
- let {
10
- bottomGap = 'none',
11
- includeMobile = false,
12
- serverVhFallback = 100,
13
- containerRef,
14
- observedElementRef,
15
- maxHeight
16
- } = _ref;
8
+ export const useWindowHeightFill = ({
9
+ bottomGap = 'none',
10
+ includeMobile = false,
11
+ serverVhFallback = 100,
12
+ containerRef,
13
+ observedElementRef,
14
+ maxHeight
15
+ }) => {
17
16
  // Create an observer instance linked to the callback function
18
17
  const cappedHeight = useResponsiveValue([includeMobile,, true]);
19
18
  const {
@@ -38,24 +38,15 @@ const flexAlignmentsWithSpace = _objectSpread(_objectSpread({}, flexAlignments),
38
38
  'space-between': 'space-between',
39
39
  'space-evenly': 'space-evenly'
40
40
  });
41
- const intentForegroundColours = mapValues(tokens.colours.intent, _ref => {
42
- let {
43
- foreground
44
- } = _ref;
45
- return foreground;
46
- });
47
- const intentBackgroundColoursStandard = mapValues(tokens.colours.intent, _ref2 => {
48
- let {
49
- background
50
- } = _ref2;
51
- return background.standard;
52
- });
53
- const intentBorderColours = mapValues(tokens.colours.intent, _ref3 => {
54
- let {
55
- border
56
- } = _ref3;
57
- return border;
58
- });
41
+ const intentForegroundColours = mapValues(tokens.colours.intent, ({
42
+ foreground
43
+ }) => foreground);
44
+ const intentBackgroundColoursStandard = mapValues(tokens.colours.intent, ({
45
+ background
46
+ }) => background.standard);
47
+ const intentBorderColours = mapValues(tokens.colours.intent, ({
48
+ border
49
+ }) => border);
59
50
  const backgroundColours = _objectSpread(_objectSpread(_objectSpread({}, intentBackgroundColoursStandard), tokens.colours.gamut), {}, {
60
51
  transparent: 'transparent'
61
52
  });
@@ -26,34 +26,31 @@ const headingSizeMap = {
26
26
  /**
27
27
  * Applies typography-related styling including font size and weight, has opinionated defaults.
28
28
  */
29
- export const typography = _ref => {
30
- let {
31
- align: textAlign,
32
- breakWord = false,
33
- color,
34
- // modern semantic colour tokens
35
- colour,
36
- // legacy colours
37
- noWrap = false,
38
- size: text = DEFAULT_TEXT_SIZE,
39
- strong = false,
40
- transform: textTransform,
41
- weight = DEFAULT_TEXT_WEIGHT,
42
- wrap,
43
- wordBreak
44
- } = _ref;
45
- return clsx(common, sprinkles({
46
- color,
47
- fontWeight: strong === true ? 'bold' : weight,
48
- text,
49
- textAlign,
50
- textTransform,
51
- textWrap: noWrap === true ? 'nowrap' : wrap,
52
- wordBreak: breakWord === true ? 'break-word' : wordBreak
53
- }), !color && sprinklesLegacyText({
54
- color: colour !== null && colour !== void 0 ? colour : strong === true ? 'dark' : DEFAULT_TEXT_COLOUR
55
- }));
56
- };
29
+ export const typography = ({
30
+ align: textAlign,
31
+ breakWord = false,
32
+ color,
33
+ // modern semantic colour tokens
34
+ colour,
35
+ // legacy colours
36
+ noWrap = false,
37
+ size: text = DEFAULT_TEXT_SIZE,
38
+ strong = false,
39
+ transform: textTransform,
40
+ weight = DEFAULT_TEXT_WEIGHT,
41
+ wrap,
42
+ wordBreak
43
+ }) => clsx(common, sprinkles({
44
+ color,
45
+ fontWeight: strong === true ? 'bold' : weight,
46
+ text,
47
+ textAlign,
48
+ textTransform,
49
+ textWrap: noWrap === true ? 'nowrap' : wrap,
50
+ wordBreak: breakWord === true ? 'break-word' : wordBreak
51
+ }), !color && sprinklesLegacyText({
52
+ color: colour !== null && colour !== void 0 ? colour : strong === true ? 'dark' : DEFAULT_TEXT_COLOUR
53
+ }));
57
54
  /**
58
55
  * Primary utility for styling typography, combines reset styles, style props and element props.
59
56
  * Also accepts a heading tag which will apply colour, font weight and size defaults.
@@ -75,7 +72,7 @@ export const typography = _ref => {
75
72
  * breakWord: true
76
73
  * })
77
74
  */
78
- export function textStyles(_ref2) {
75
+ export function textStyles(_ref) {
79
76
  let {
80
77
  as = 'span',
81
78
  className,
@@ -83,8 +80,8 @@ export function textStyles(_ref2) {
83
80
  size = isHeadingTag(as) ? headingSizeMap[as] : undefined,
84
81
  weight = isHeadingTag(as) ? 'bold' : undefined
85
82
  // remaining style props
86
- } = _ref2,
87
- props = _objectWithoutProperties(_ref2, _excluded);
83
+ } = _ref,
84
+ props = _objectWithoutProperties(_ref, _excluded);
88
85
  return clsx(resetStyles(as), typography(_objectSpread({
89
86
  colour,
90
87
  size,
@@ -25,14 +25,13 @@ import { colord } from 'colord';
25
25
  * ```
26
26
  */
27
27
 
28
- export const shadedColour = _ref => {
29
- let {
30
- colour,
31
- intensity,
32
- direction,
33
- isDarkTheme,
34
- transparency = 0
35
- } = _ref;
28
+ export const shadedColour = ({
29
+ colour,
30
+ intensity,
31
+ direction,
32
+ isDarkTheme,
33
+ transparency = 0
34
+ }) => {
36
35
  const intensityValue = typeof intensity === 'string' ? Number(intensity) : intensity;
37
36
  const transparencyValue = typeof transparency === 'string' ? Number(transparency) : transparency;
38
37
  return colord(colour)[!isDarkTheme && direction === 'backward' || isDarkTheme && direction === 'forward' ? 'darken' : 'lighten'](intensityValue || void 0).alpha(typeof transparencyValue === 'number' ? 1 - transparencyValue : 1).toHex();
@@ -74,13 +73,12 @@ export const getContrastRatio = (colour1, colour2) => {
74
73
  const color2luminance = getColourLuminance(getRGBValues(colour2));
75
74
  return color1luminance > color2luminance ? (color2luminance + 0.05) / (color1luminance + 0.05) : (color1luminance + 0.05) / (color2luminance + 0.05);
76
75
  };
77
- export const passesAccessibilityContrast = _ref2 => {
78
- let {
79
- colour1,
80
- colour2,
81
- level,
82
- textSize
83
- } = _ref2;
76
+ export const passesAccessibilityContrast = ({
77
+ colour1,
78
+ colour2,
79
+ level,
80
+ textSize
81
+ }) => {
84
82
  const contrastRatio = getContrastRatio(colour1, colour2);
85
83
  if (textSize === 'LARGE') {
86
84
  return level === 'AAA' ? contrastRatio < 1 / 4.5 : contrastRatio < 1 / 3;