@autoguru/overdrive 4.43.9-next.0 → 4.43.10-next.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.d.ts +3 -3
- package/dist/components/Actions/Actions.d.ts.map +1 -1
- package/dist/components/Actions/Actions.js +4 -3
- package/dist/components/Alert/Alert.d.ts +3 -3
- package/dist/components/Alert/Alert.d.ts.map +1 -1
- package/dist/components/Alert/Alert.js +11 -11
- package/dist/components/Anchor/Anchor.d.ts +4 -3
- package/dist/components/Anchor/Anchor.d.ts.map +1 -1
- package/dist/components/Anchor/Anchor.js +21 -19
- package/dist/components/AutoSuggest/AutoSuggest.js +52 -34
- package/dist/components/AutoSuggest/useLayoutSuggestionVisible.js +1 -0
- package/dist/components/Badge/Badge.d.ts +13 -2
- package/dist/components/Badge/Badge.d.ts.map +1 -1
- package/dist/components/Badge/Badge.js +7 -1
- package/dist/components/Box/Box.d.ts +7 -0
- package/dist/components/Box/Box.d.ts.map +1 -1
- package/dist/components/Box/Box.js +11 -2
- package/dist/components/Box/newBox/NewBox.d.ts +23 -0
- package/dist/components/Box/newBox/NewBox.d.ts.map +1 -1
- package/dist/components/Box/newBox/NewBox.js +25 -2
- package/dist/components/Box/newBox/useBox.d.ts +24 -0
- package/dist/components/Box/newBox/useBox.d.ts.map +1 -1
- package/dist/components/Box/newBox/useBox.js +38 -1
- package/dist/components/BulletList/Bullet.js +2 -2
- package/dist/components/BulletList/BulletList.js +2 -2
- package/dist/components/BulletList/context.js +1 -1
- package/dist/components/BulletText/BulletText.d.ts.map +1 -1
- package/dist/components/BulletText/BulletText.js +13 -12
- package/dist/components/Button/Button.css.d.ts +9 -0
- package/dist/components/Button/Button.css.d.ts.map +1 -1
- package/dist/components/Button/Button.css.js +12 -2
- package/dist/components/Button/Button.d.ts +11 -2
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/components/Button/Button.js +23 -11
- package/dist/components/CheckBox/CheckBox.d.ts +4 -0
- package/dist/components/CheckBox/CheckBox.d.ts.map +1 -1
- package/dist/components/CheckBox/CheckBox.js +4 -4
- package/dist/components/ColourInput/ColourInput.d.ts.map +1 -1
- package/dist/components/ColourInput/ColourInput.js +10 -9
- package/dist/components/Columns/Column.css.js +1 -0
- package/dist/components/Columns/Column.js +3 -3
- package/dist/components/Columns/ColumnGrid.css.js +1 -1
- package/dist/components/Columns/Columns.d.ts +3 -3
- package/dist/components/Columns/Columns.d.ts.map +1 -1
- package/dist/components/Columns/Columns.js +4 -4
- package/dist/components/DateInput/DateInput.js +1 -1
- package/dist/components/DatePicker/DatePicker.js +6 -6
- package/dist/components/DateTimePicker/CalendarButton.js +1 -1
- package/dist/components/DateTimePicker/CalendarGrid.js +10 -10
- package/dist/components/DateTimePicker/DateTimePicker.css.js +9 -1
- package/dist/components/DateTimePicker/DateTimePicker.d.ts +39 -0
- package/dist/components/DateTimePicker/DateTimePicker.d.ts.map +1 -1
- package/dist/components/DateTimePicker/DateTimePicker.js +50 -17
- package/dist/components/DividerLine/DividerLine.js +1 -1
- package/dist/components/DropDown/DropDown.js +5 -5
- package/dist/components/DropDown/DropDownOption.js +4 -4
- package/dist/components/DropDown/DropDownOptionsList.js +4 -4
- package/dist/components/EditableText/EditableText.d.ts +2 -2
- package/dist/components/EditableText/EditableText.d.ts.map +1 -1
- package/dist/components/EditableText/EditableText.js +10 -10
- package/dist/components/FillHeightBox/FillHeightBox.js +2 -1
- package/dist/components/Flyout/Flyout.d.ts +2 -2
- package/dist/components/Flyout/Flyout.d.ts.map +1 -1
- package/dist/components/Flyout/Flyout.js +3 -3
- package/dist/components/Heading/Heading.d.ts +6 -1
- package/dist/components/Heading/Heading.d.ts.map +1 -1
- package/dist/components/Heading/Heading.js +10 -3
- package/dist/components/HorizontalAutoScroller/HorizontalAutoScroller.d.ts +2 -2
- package/dist/components/HorizontalAutoScroller/HorizontalAutoScroller.d.ts.map +1 -1
- package/dist/components/HorizontalAutoScroller/HorizontalAutoScroller.js +19 -18
- package/dist/components/Icon/Icon.js +2 -2
- package/dist/components/Image/Image.d.ts +3 -0
- package/dist/components/Image/Image.d.ts.map +1 -1
- package/dist/components/Image/Image.js +2 -2
- package/dist/components/Image/ImageServerProvider.js +7 -2
- package/dist/components/Image/ResponsiveImage.d.ts +22 -0
- package/dist/components/Image/ResponsiveImage.d.ts.map +1 -1
- package/dist/components/Image/ResponsiveImage.js +2 -1
- package/dist/components/Image/SimpleImage.d.ts +18 -0
- package/dist/components/Image/SimpleImage.d.ts.map +1 -1
- package/dist/components/Image/SimpleImage.js +6 -2
- package/dist/components/Inline/Inline.d.ts +9 -6
- package/dist/components/Inline/Inline.d.ts.map +1 -1
- package/dist/components/Inline/Inline.js +53 -46
- package/dist/components/IntentStripe/IntentStripe.js +1 -1
- package/dist/components/LinearProgressIndicator/LinearProgressIndicator.js +4 -4
- package/dist/components/LoadingBox/LoadingBox.js +1 -1
- package/dist/components/Meta/Meta.js +3 -3
- package/dist/components/MinimalModal/MinimalModal.js +4 -4
- package/dist/components/Modal/Modal.js +7 -6
- package/dist/components/NumberBubble/NumberBubble.js +2 -2
- package/dist/components/NumberInput/NumberInput.js +1 -1
- package/dist/components/NumberInput/useNumberInputBehaviours.js +9 -3
- package/dist/components/OptionGrid/OptionGrid.css.js +7 -1
- package/dist/components/OptionGrid/OptionGrid.d.ts +32 -0
- package/dist/components/OptionGrid/OptionGrid.d.ts.map +1 -1
- package/dist/components/OptionGrid/OptionGrid.js +26 -12
- package/dist/components/OptionList/OptionList.css.js +5 -1
- package/dist/components/OptionList/OptionList.d.ts +25 -0
- package/dist/components/OptionList/OptionList.d.ts.map +1 -1
- package/dist/components/OptionList/OptionList.js +19 -6
- package/dist/components/OptionList/OptionListItem.d.ts +10 -0
- package/dist/components/OptionList/OptionListItem.d.ts.map +1 -1
- package/dist/components/OptionList/OptionListItem.js +16 -9
- package/dist/components/OrderedList/OrderedList.css.d.ts +0 -1
- package/dist/components/OrderedList/OrderedList.css.d.ts.map +1 -1
- package/dist/components/OrderedList/OrderedList.css.js +1 -8
- package/dist/components/OrderedList/OrderedList.d.ts +4 -4
- package/dist/components/OrderedList/OrderedList.d.ts.map +1 -1
- package/dist/components/OrderedList/OrderedList.js +11 -9
- package/dist/components/OutsideClick/OutsideClick.js +4 -1
- package/dist/components/OverdriveProvider/FallbackProvider.d.ts +3 -0
- package/dist/components/OverdriveProvider/FallbackProvider.d.ts.map +1 -1
- package/dist/components/OverdriveProvider/FallbackProvider.js +5 -1
- package/dist/components/OverdriveProvider/OverdriveProvider.d.ts +5 -0
- package/dist/components/OverdriveProvider/OverdriveProvider.d.ts.map +1 -1
- package/dist/components/OverdriveProvider/OverdriveProvider.js +10 -6
- package/dist/components/OverdriveProvider/ThemeOverrideDebugger.js +7 -7
- package/dist/components/OverdriveProvider/index.d.ts +2 -1
- package/dist/components/OverdriveProvider/index.d.ts.map +1 -1
- package/dist/components/OverdriveProvider/index.js +3 -1
- package/dist/components/OverdriveProvider/useColorOverrides.d.ts +1 -0
- package/dist/components/OverdriveProvider/useColorOverrides.d.ts.map +1 -1
- package/dist/components/OverdriveProvider/useColorOverrides.js +9 -0
- package/dist/components/Pagination/Bubble.js +1 -1
- package/dist/components/Pagination/Pagination.js +11 -11
- package/dist/components/Portal/Portal.js +5 -2
- package/dist/components/Positioner/Positioner.js +18 -2
- package/dist/components/Positioner/alignment.js +1 -1
- package/dist/components/ProgressBar/ProgressBar.js +3 -3
- package/dist/components/ProgressBarGroup/ProgressBarGroup.js +5 -5
- package/dist/components/ProgressSpinner/ProgressSpinner.js +3 -3
- package/dist/components/Radio/Radio.js +4 -4
- package/dist/components/Radio/RadioGroup.js +4 -4
- package/dist/components/ScrollPane/ScrollPane.js +2 -2
- package/dist/components/SearchBar/SearchBar.d.ts +17 -0
- package/dist/components/SearchBar/SearchBar.d.ts.map +1 -1
- package/dist/components/SearchBar/SearchBar.js +21 -9
- package/dist/components/Section/Section.d.ts +3 -3
- package/dist/components/Section/Section.d.ts.map +1 -1
- package/dist/components/Section/Section.js +4 -3
- package/dist/components/SelectInput/SelectInput.js +6 -6
- package/dist/components/SimplePagination/SimplePagination.js +6 -6
- package/dist/components/SliderProgress/ProgressStep.js +4 -4
- package/dist/components/SliderProgress/SliderProgress.js +3 -3
- package/dist/components/Stack/Divider.d.ts +3 -0
- package/dist/components/Stack/Divider.d.ts.map +1 -0
- package/dist/components/Stack/Divider.js +13 -0
- package/dist/components/Stack/Stack.d.ts +6 -10
- package/dist/components/Stack/Stack.d.ts.map +1 -1
- package/dist/components/Stack/Stack.js +28 -28
- package/dist/components/StandardModal/StandardModal.d.ts +2 -2
- package/dist/components/StandardModal/StandardModal.d.ts.map +1 -1
- package/dist/components/StandardModal/StandardModal.js +13 -11
- package/dist/components/StarRating/StarRating.js +11 -9
- package/dist/components/Stepper/Stepper.js +10 -10
- package/dist/components/StickyBox/StickyBox.js +4 -3
- package/dist/components/Switch/Switch.d.ts +11 -0
- package/dist/components/Switch/Switch.d.ts.map +1 -1
- package/dist/components/Switch/Switch.js +10 -5
- package/dist/components/Table/Table.css.js +4 -0
- package/dist/components/Table/Table.js +9 -3
- package/dist/components/Table/TableCell.css.js +5 -0
- package/dist/components/Table/TableCell.js +7 -4
- package/dist/components/Table/TableHeadCell.js +7 -7
- package/dist/components/Table/TableRow.js +2 -2
- package/dist/components/Table/TableRowGroup.js +2 -2
- package/dist/components/Table/context.js +2 -2
- package/dist/components/Tabs/Tab.d.ts +3 -3
- package/dist/components/Tabs/Tab.d.ts.map +1 -1
- package/dist/components/Tabs/Tab.js +6 -6
- package/dist/components/Tabs/TabList.js +10 -10
- package/dist/components/Tabs/TabPane.js +1 -1
- package/dist/components/Tabs/TabPanes.d.ts +1 -0
- package/dist/components/Tabs/TabPanes.d.ts.map +1 -1
- package/dist/components/Tabs/TabPanes.js +3 -3
- package/dist/components/Tabs/Tabs.js +2 -2
- package/dist/components/Text/Text.d.ts +3 -5
- package/dist/components/Text/Text.d.ts.map +1 -1
- package/dist/components/Text/Text.js +5 -2
- package/dist/components/Text/textStyles.d.ts +3 -0
- package/dist/components/Text/textStyles.d.ts.map +1 -1
- package/dist/components/Text/textStyles.js +5 -0
- package/dist/components/TextAreaInput/TextAreaInput.js +1 -1
- package/dist/components/TextBubble/TextBubble.d.ts +5 -5
- package/dist/components/TextBubble/TextBubble.d.ts.map +1 -1
- package/dist/components/TextBubble/TextBubble.js +4 -3
- package/dist/components/TextContainer/TextContainer.js +4 -4
- package/dist/components/TextInput/TextInput.js +1 -1
- package/dist/components/TextLink/TextLink.css.d.ts +0 -1
- package/dist/components/TextLink/TextLink.css.d.ts.map +1 -1
- package/dist/components/TextLink/TextLink.css.js +0 -5
- package/dist/components/TextLink/TextLink.d.ts +7 -8
- package/dist/components/TextLink/TextLink.d.ts.map +1 -1
- package/dist/components/TextLink/TextLink.js +19 -19
- package/dist/components/Toaster/Toast.js +20 -10
- package/dist/components/Tooltip/Tooltip.d.ts +25 -5
- package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/components/Tooltip/Tooltip.js +61 -82
- package/dist/components/Tooltip/index.d.ts +1 -1
- package/dist/components/Tooltip/index.d.ts.map +1 -1
- package/dist/components/VisuallyHidden/VisuallyHidden.d.ts +5 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.d.ts.map +1 -1
- package/dist/components/VisuallyHidden/VisuallyHidden.js +6 -1
- package/dist/components/private/CheckableBase/CheckableBase.css.js +2 -0
- package/dist/components/private/CheckableBase/CheckableBase.js +6 -6
- package/dist/components/private/CheckableBase/useCheckableStyles.d.ts +3 -0
- package/dist/components/private/CheckableBase/useCheckableStyles.d.ts.map +1 -1
- package/dist/components/private/CheckableBase/useCheckableStyles.js +3 -0
- package/dist/components/private/InputBase/HintText.js +1 -1
- package/dist/components/private/InputBase/NotchedBase.js +7 -7
- package/dist/components/private/InputBase/withEnhancedInput.css.js +1 -0
- package/dist/components/private/InputBase/withEnhancedInput.d.ts +1 -1
- package/dist/components/private/InputBase/withEnhancedInput.d.ts.map +1 -1
- package/dist/components/private/InputBase/withEnhancedInput.js +32 -10
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useAttachedBoxes/useAttachedBoxes.js +2 -1
- package/dist/hooks/useDeepCompareMemo/index.d.ts +4 -0
- package/dist/hooks/useDeepCompareMemo/index.d.ts.map +1 -1
- package/dist/hooks/useDeepCompareMemo/index.js +12 -0
- package/dist/hooks/useMedia/useMedia.js +1 -0
- package/dist/hooks/useResponsiveValue/useResponsiveValue.js +3 -1
- package/dist/hooks/useTooltip/index.d.ts +2 -0
- package/dist/hooks/useTooltip/index.d.ts.map +1 -0
- package/dist/hooks/useTooltip/index.js +3 -0
- package/dist/hooks/useTooltip/useTooltip.d.ts +38 -0
- package/dist/hooks/useTooltip/useTooltip.d.ts.map +1 -0
- package/dist/hooks/useTooltip/useTooltip.js +125 -0
- package/dist/hooks/useWindowHeightFill/useWindowHeightFill.js +1 -0
- package/dist/hooks/useWindowScrollLock/index.js +2 -0
- package/dist/styles/componentStyles.d.ts +14 -1
- package/dist/styles/componentStyles.d.ts.map +1 -1
- package/dist/styles/componentStyles.js +17 -3
- package/dist/styles/componentStyles.spec.d.ts +2 -0
- package/dist/styles/componentStyles.spec.d.ts.map +1 -0
- package/dist/styles/componentStyles.spec.js +251 -0
- package/dist/styles/elementReset.css.d.ts +1 -0
- package/dist/styles/elementReset.css.d.ts.map +1 -1
- package/dist/styles/elementReset.css.js +4 -0
- package/dist/styles/global/reset.css.js +2 -0
- package/dist/styles/layers.css.d.ts +3 -2
- package/dist/styles/layers.css.d.ts.map +1 -1
- package/dist/styles/layers.css.js +6 -2
- package/dist/styles/sprinkles.css.d.ts +11 -11
- package/dist/styles/sprinkles.css.d.ts.map +1 -1
- package/dist/styles/sprinkles.css.js +39 -14
- package/dist/styles/typography.css.d.ts +14 -0
- package/dist/styles/typography.css.d.ts.map +1 -1
- package/dist/styles/typography.css.js +5 -0
- package/dist/styles/vars.css.js +2 -0
- package/dist/themes/base/theme.css.js +3 -1
- package/dist/themes/base/tokens.d.ts +3 -0
- package/dist/themes/base/tokens.d.ts.map +1 -1
- package/dist/themes/base/tokens.js +3 -0
- package/dist/themes/helpers.d.ts +22 -0
- package/dist/themes/helpers.d.ts.map +1 -1
- package/dist/themes/helpers.js +24 -0
- package/dist/themes/makeTheme.d.ts +3 -0
- package/dist/themes/makeTheme.d.ts.map +1 -1
- package/dist/themes/makeTheme.js +7 -1
- package/dist/themes/theme.css.d.ts +4 -0
- package/dist/themes/theme.css.d.ts.map +1 -1
- package/dist/themes/theme.css.js +16 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/css.d.ts +15 -0
- package/dist/utils/css.d.ts.map +1 -1
- package/dist/utils/css.js +18 -0
- package/dist/utils/dataAttrs.d.ts +3 -0
- package/dist/utils/dataAttrs.d.ts.map +1 -1
- package/dist/utils/dataAttrs.js +3 -0
- package/dist/utils/estimateTextWidth.js +3 -2
- package/dist/utils/index.d.ts +21 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +39 -0
- package/dist/utils/number.js +7 -2
- package/dist/utils/propGuards.d.ts +14 -0
- package/dist/utils/propGuards.d.ts.map +1 -1
- package/dist/utils/propGuards.js +14 -0
- package/dist/utils/responsiveProps.css.js +1 -1
- package/dist/utils/sprinkles.d.ts +18 -0
- package/dist/utils/sprinkles.d.ts.map +1 -1
- package/dist/utils/sprinkles.js +21 -1
- package/package.json +19 -19
package/dist/utils/index.js
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
4
4
|
export const isBrowser = typeof window !== 'undefined';
|
|
5
5
|
export const isomorphicLayoutEffect = isBrowser ? useLayoutEffect : useEffect;
|
|
6
|
+
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
|
|
6
8
|
export const useUncontrolledState = (value, onChange) => {
|
|
7
9
|
if (typeof onChange === 'function') {
|
|
8
10
|
return [value, onChange];
|
|
@@ -21,6 +23,13 @@ export const useInputControlledState = (incomingValue, incomingOnChange) => {
|
|
|
21
23
|
let id = 0;
|
|
22
24
|
const genId = () => ++id;
|
|
23
25
|
let serverHandoffComplete = false;
|
|
26
|
+
|
|
27
|
+
/*
|
|
28
|
+
For rationale around this file, please see @reach-ui/auto-id's comments. We have opted to not use the npm package as they
|
|
29
|
+
import a series of utils that arent tree-shakable. And something that is too big to include for now.
|
|
30
|
+
|
|
31
|
+
@see https://github.com/reach/reach-ui/blob/983acb60ee9ac64b1b708523b44f660c65af6726/packages/auto-id/src/index.ts#L1-L55
|
|
32
|
+
*/
|
|
24
33
|
export const useId = idFromProps => {
|
|
25
34
|
const initialId = idFromProps !== null && idFromProps !== void 0 ? idFromProps : serverHandoffComplete ? genId() : null;
|
|
26
35
|
const [id, setId] = useState(initialId);
|
|
@@ -43,6 +52,12 @@ export const setRef = (ref, value) => {
|
|
|
43
52
|
ref.current = value;
|
|
44
53
|
}
|
|
45
54
|
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Used to merge multiple refs into a single ref callback
|
|
58
|
+
* @param refs an array of refs
|
|
59
|
+
*/
|
|
60
|
+
// using an arrow function here causes a typescript error with the `RefCallback` type
|
|
46
61
|
export function mergeRefs(refs) {
|
|
47
62
|
return value => {
|
|
48
63
|
refs.forEach(ref => {
|
|
@@ -64,6 +79,15 @@ export const ownerWindow = node => {
|
|
|
64
79
|
var _ownerDocument;
|
|
65
80
|
return ((_ownerDocument = ownerDocument(node)) === null || _ownerDocument === void 0 ? void 0 : _ownerDocument.defaultView) || window;
|
|
66
81
|
};
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* A method to be used when dealing with callbacks that depend on data, but you don't want to trigger re-renders.
|
|
85
|
+
*
|
|
86
|
+
* @see {@link https://github.com/facebook/react/issues/14099#issuecomment-440013892|facebook/react#14099}
|
|
87
|
+
*
|
|
88
|
+
* @param fn
|
|
89
|
+
*/
|
|
90
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
67
91
|
export const useEventCallback = fn => {
|
|
68
92
|
const ref = useRef(fn);
|
|
69
93
|
isomorphicLayoutEffect(() => {
|
|
@@ -73,10 +97,13 @@ export const useEventCallback = fn => {
|
|
|
73
97
|
return void ref.current.apply(ref, arguments);
|
|
74
98
|
}, []);
|
|
75
99
|
};
|
|
100
|
+
|
|
101
|
+
// Taken from https://gist.github.com/gre/1650294
|
|
76
102
|
const easeInOutCubic = t => t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1;
|
|
77
103
|
export const animate = function (element, property, to) {
|
|
78
104
|
let duration = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 600;
|
|
79
105
|
let start = null;
|
|
106
|
+
// @ts-expect-error Type 'T[keyof T]' is not assignable to type 'number'
|
|
80
107
|
const from = element[property];
|
|
81
108
|
if (start === from) return;
|
|
82
109
|
let cancelled = false;
|
|
@@ -89,6 +116,7 @@ export const animate = function (element, property, to) {
|
|
|
89
116
|
start = timestamp;
|
|
90
117
|
}
|
|
91
118
|
const time = Math.min(1, (timestamp - start) / duration);
|
|
119
|
+
// @ts-expect-error Type 'number' is not assignable to type 'T[keyof T]'
|
|
92
120
|
element[property] = easeInOutCubic(time) * (to - from) + from;
|
|
93
121
|
if (time >= 1) return;
|
|
94
122
|
requestAnimationFrame(step);
|
|
@@ -101,6 +129,17 @@ export const alignmentToFlexAlignment = align => ({
|
|
|
101
129
|
left: 'start',
|
|
102
130
|
right: 'end'
|
|
103
131
|
})[align];
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* A function that returns the first item in the array, if the index exceeds its maximum length
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```js
|
|
138
|
+
* const sortFlowRingLookup = arrayRingLookup(['asc', 'desc', 'none']);
|
|
139
|
+
*
|
|
140
|
+
* expect(sortFlowRingLookup(4)).toBe('desc');
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
104
143
|
export const arrayRingLookup = collection => {
|
|
105
144
|
const len = collection.length;
|
|
106
145
|
return index => collection[(index % len + len) % len];
|
package/dist/utils/number.js
CHANGED
|
@@ -4,10 +4,15 @@ export const bigNumFormatter = num => {
|
|
|
4
4
|
if (num < 1e3) return {
|
|
5
5
|
value: num,
|
|
6
6
|
descriptor: ''
|
|
7
|
-
};
|
|
7
|
+
};
|
|
8
|
+
// if value < 1000, nothing to do
|
|
9
|
+
else if (num < 1e6) return {
|
|
8
10
|
value: num / 1e3,
|
|
9
11
|
descriptor: 'K'
|
|
10
|
-
};
|
|
12
|
+
};
|
|
13
|
+
// convert to K for number from > 1000 < 1 million
|
|
14
|
+
else {
|
|
15
|
+
// convert to M for number from > 1 million
|
|
11
16
|
return {
|
|
12
17
|
value: num / 1e6,
|
|
13
18
|
descriptor: 'M'
|
|
@@ -1,2 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type guard that returns the value if it's a non-empty string, otherwise returns undefined.
|
|
3
|
+
* This is useful for ensuring type safety when working with props that should be strings.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* // Returns 'hello'
|
|
7
|
+
* onlyString('hello');
|
|
8
|
+
*
|
|
9
|
+
* // Returns undefined
|
|
10
|
+
* onlyString(42);
|
|
11
|
+
* onlyString('');
|
|
12
|
+
* onlyString(null);
|
|
13
|
+
* onlyString(undefined);
|
|
14
|
+
*/
|
|
1
15
|
export declare function onlyString<P extends string | unknown>(prop: P): (P & string) | undefined;
|
|
2
16
|
//# sourceMappingURL=propGuards.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propGuards.d.ts","sourceRoot":"","sources":["../../lib/utils/propGuards.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"propGuards.d.ts","sourceRoot":"","sources":["../../lib/utils/propGuards.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,GAAG,OAAO,EAAE,IAAI,EAAE,CAAC,4BAI7D"}
|
package/dist/utils/propGuards.js
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Type guard that returns the value if it's a non-empty string, otherwise returns undefined.
|
|
5
|
+
* This is useful for ensuring type safety when working with props that should be strings.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* // Returns 'hello'
|
|
9
|
+
* onlyString('hello');
|
|
10
|
+
*
|
|
11
|
+
* // Returns undefined
|
|
12
|
+
* onlyString(42);
|
|
13
|
+
* onlyString('');
|
|
14
|
+
* onlyString(null);
|
|
15
|
+
* onlyString(undefined);
|
|
16
|
+
*/
|
|
3
17
|
export function onlyString(prop) {
|
|
4
18
|
return prop && typeof prop === 'string' && prop.length > 0 ? prop : undefined;
|
|
5
19
|
}
|
|
@@ -7,7 +7,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
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
8
|
import { style } from '@vanilla-extract/css';
|
|
9
9
|
import { breakpoints } from "../themes/makeTheme.js";
|
|
10
|
-
import { responsiveStyle } from "./responsiveStyle.js";
|
|
10
|
+
import { responsiveStyle } from "./responsiveStyle.js"; // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
|
|
11
11
|
export const makeResponsiveStyle = (tokens, property) => Object.entries(tokens || {}).reduce((results, _ref) => {
|
|
12
12
|
let [key, value] = _ref;
|
|
13
13
|
const breakpointsKeys = Object.keys(breakpoints);
|
|
@@ -6,8 +6,26 @@ interface SortedProps<T extends object> {
|
|
|
6
6
|
sprinklesProps: Sprinkles;
|
|
7
7
|
baseProps: RemainingProps<T>;
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Typeguard function for base sprinkles (non-responsive) props
|
|
11
|
+
*/
|
|
9
12
|
export declare const isSprinklesProperty: (key: string) => boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Filters out sprinkles and responsive sprinkles props, returning only the non-sprinkles props.
|
|
15
|
+
*
|
|
16
|
+
* @param props - Object containing all props to be filtered
|
|
17
|
+
* @returns Object containing only non-sprinkles props
|
|
18
|
+
*/
|
|
10
19
|
export declare const filterNonSprinklesProps: <P extends object>(props: P) => RemainingProps<P>;
|
|
20
|
+
/**
|
|
21
|
+
* Filters and separates props into four categories in a single pass:
|
|
22
|
+
* base sprinkles, responsive sprinkles, legacy colour sprinkles, and all other props.
|
|
23
|
+
*
|
|
24
|
+
* @param props - Object containing all props to be classified.
|
|
25
|
+
* @returns `{ sprinklesProps, sprinklesResponsiveProps, sprinklesLegacyColourProps, baseProps }`
|
|
26
|
+
* - `sprinklesProps`: Props matching sprinkles
|
|
27
|
+
* - `baseProps`: The remainder are the component's base props
|
|
28
|
+
*/
|
|
11
29
|
export declare const filterPropsWithStyles: <P extends object>(props: P) => SortedProps<P>;
|
|
12
30
|
export {};
|
|
13
31
|
//# sourceMappingURL=sprinkles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sprinkles.d.ts","sourceRoot":"","sources":["../../lib/utils/sprinkles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAGpE,KAAK,cAAc,CAAC,CAAC,SAAS,MAAM,IAAI;KACtC,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACvD,CAAC;AAEF,UAAU,WAAW,CAAC,CAAC,SAAS,MAAM;IACrC,cAAc,EAAE,SAAS,CAAC;IAC1B,SAAS,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;CAC7B;
|
|
1
|
+
{"version":3,"file":"sprinkles.d.ts","sourceRoot":"","sources":["../../lib/utils/sprinkles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAGpE,KAAK,cAAc,CAAC,CAAC,SAAS,MAAM,IAAI;KACtC,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACvD,CAAC;AAEF,UAAU,WAAW,CAAC,CAAC,SAAS,MAAM;IACrC,cAAc,EAAE,SAAS,CAAC;IAC1B,SAAS,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;CAC7B;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAI,KAAK,MAAM,YAE9C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAAI,CAAC,SAAS,MAAM,EAAE,OAAO,CAAC,sBAMtC,CAAC;AAE7B;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,GAAI,CAAC,SAAS,MAAM,EACrD,OAAO,CAAC,KACN,WAAW,CAAC,CAAC,CAuBf,CAAC"}
|
package/dist/utils/sprinkles.js
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { sprinkles } from "../styles/sprinkles.css.js";
|
|
3
|
+
import { sprinkles } from "../styles/sprinkles.css.js"; // Type for 'baseProps', containing only non-sprinkle properties from T
|
|
4
|
+
/**
|
|
5
|
+
* Typeguard function for base sprinkles (non-responsive) props
|
|
6
|
+
*/
|
|
4
7
|
export const isSprinklesProperty = key => {
|
|
5
8
|
return sprinkles.properties.has(key);
|
|
6
9
|
};
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Filters out sprinkles and responsive sprinkles props, returning only the non-sprinkles props.
|
|
13
|
+
*
|
|
14
|
+
* @param props - Object containing all props to be filtered
|
|
15
|
+
* @returns Object containing only non-sprinkles props
|
|
16
|
+
*/
|
|
7
17
|
export const filterNonSprinklesProps = props => Object.entries(props).reduce((acc, _ref) => {
|
|
8
18
|
let [key, value] = _ref;
|
|
9
19
|
if (!isSprinklesProperty(key)) {
|
|
@@ -11,6 +21,16 @@ export const filterNonSprinklesProps = props => Object.entries(props).reduce((ac
|
|
|
11
21
|
}
|
|
12
22
|
return acc;
|
|
13
23
|
}, {});
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Filters and separates props into four categories in a single pass:
|
|
27
|
+
* base sprinkles, responsive sprinkles, legacy colour sprinkles, and all other props.
|
|
28
|
+
*
|
|
29
|
+
* @param props - Object containing all props to be classified.
|
|
30
|
+
* @returns `{ sprinklesProps, sprinklesResponsiveProps, sprinklesLegacyColourProps, baseProps }`
|
|
31
|
+
* - `sprinklesProps`: Props matching sprinkles
|
|
32
|
+
* - `baseProps`: The remainder are the component's base props
|
|
33
|
+
*/
|
|
14
34
|
export const filterPropsWithStyles = props => {
|
|
15
35
|
const acc = {
|
|
16
36
|
sprinklesProps: {},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autoguru/overdrive",
|
|
3
|
-
"version": "4.43.
|
|
3
|
+
"version": "4.43.10-next.0",
|
|
4
4
|
"description": "Overdrive is a product component library, and design system for AutoGuru.",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"format": "prettier --list-different --write \"**/*.+(js|jsx|ts|tsx|json|yml|md|mdx|html)\"",
|
|
41
41
|
"format:staged": "prettier --write",
|
|
42
42
|
"prepublishOnly": "yarn dlx rimraf ./dist && yarn run build && yarn run typeEmit",
|
|
43
|
-
"lint:tsc": "tsc --noEmit
|
|
43
|
+
"lint:tsc": "tsc --noEmit",
|
|
44
44
|
"lint:eslint": "eslint \"lib/**/*.+(ts|tsx)\" --fix --quiet",
|
|
45
45
|
"lint": "yarn run lint:eslint && yarn run lint:tsc",
|
|
46
46
|
"release": "changeset publish",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"test": "vitest --project=unit-tests",
|
|
52
52
|
"test:ci": "yarn vitest run --no-cache --coverage --project=unit-tests",
|
|
53
53
|
"test:a11y": "vitest run --coverage --project=storybook",
|
|
54
|
-
"typeEmit": "tsc -p tsconfig.dist.json
|
|
54
|
+
"typeEmit": "tsc -p tsconfig.dist.json",
|
|
55
55
|
"watch": "tsc --watch",
|
|
56
56
|
"prepare": "husky"
|
|
57
57
|
},
|
|
@@ -87,18 +87,18 @@
|
|
|
87
87
|
"@babel/preset-react": "7.27.1",
|
|
88
88
|
"@babel/preset-typescript": "7.27.1",
|
|
89
89
|
"@babel/runtime-corejs3": "7.27.6",
|
|
90
|
-
"@changesets/cli": "2.29.
|
|
91
|
-
"@chromatic-com/storybook": "4.0.
|
|
90
|
+
"@changesets/cli": "2.29.5",
|
|
91
|
+
"@chromatic-com/storybook": "4.0.1",
|
|
92
92
|
"@internationalized/date": "^3.8.2",
|
|
93
93
|
"@octokit/rest": "^22.0.0",
|
|
94
94
|
"@popperjs/core": "^2.11.8",
|
|
95
95
|
"@react-stately/toggle": "^3.8.5",
|
|
96
|
-
"@storybook/addon-a11y": "9.0.
|
|
97
|
-
"@storybook/addon-docs": "9.0.
|
|
98
|
-
"@storybook/addon-links": "9.0.
|
|
99
|
-
"@storybook/addon-onboarding": "9.0.
|
|
100
|
-
"@storybook/addon-vitest": "9.0.
|
|
101
|
-
"@storybook/react-vite": "9.0.
|
|
96
|
+
"@storybook/addon-a11y": "9.0.12",
|
|
97
|
+
"@storybook/addon-docs": "9.0.12",
|
|
98
|
+
"@storybook/addon-links": "9.0.12",
|
|
99
|
+
"@storybook/addon-onboarding": "9.0.12",
|
|
100
|
+
"@storybook/addon-vitest": "9.0.12",
|
|
101
|
+
"@storybook/react-vite": "9.0.12",
|
|
102
102
|
"@testing-library/dom": "^10.4.0",
|
|
103
103
|
"@testing-library/jest-dom": "^6.6.3",
|
|
104
104
|
"@testing-library/react": "^16.3.0",
|
|
@@ -116,23 +116,23 @@
|
|
|
116
116
|
"@vanilla-extract/sprinkles": "^1.6.5",
|
|
117
117
|
"@vanilla-extract/vite-plugin": "^5.0.6",
|
|
118
118
|
"@vanilla-extract/webpack-plugin": "^2.3.22",
|
|
119
|
-
"@vitest/browser": "3.2.
|
|
120
|
-
"@vitest/coverage-v8": "3.2.
|
|
119
|
+
"@vitest/browser": "3.2.4",
|
|
120
|
+
"@vitest/coverage-v8": "3.2.4",
|
|
121
121
|
"@vitest/eslint-plugin": "1.2.7",
|
|
122
122
|
"babel-plugin-add-import-extension": "^1.6.0",
|
|
123
123
|
"babel-plugin-dev-expression": "^0.2.3",
|
|
124
124
|
"babel-plugin-macros": "^3.1.0",
|
|
125
125
|
"browserslist-config-autoguru": "^2.4.4",
|
|
126
|
-
"chromatic": "13.0.
|
|
126
|
+
"chromatic": "13.0.1",
|
|
127
127
|
"clsx": "^2.1.1",
|
|
128
128
|
"colord": "^2.9.3",
|
|
129
129
|
"concurrently": "^9.1.2",
|
|
130
130
|
"core-js": "^3.43.0",
|
|
131
131
|
"csstype": "^3.1.3",
|
|
132
132
|
"deepmerge": "^4.3.1",
|
|
133
|
-
"es-toolkit": "1.39.
|
|
133
|
+
"es-toolkit": "1.39.4",
|
|
134
134
|
"eslint": "9.29.0",
|
|
135
|
-
"eslint-plugin-storybook": "9.0.
|
|
135
|
+
"eslint-plugin-storybook": "9.0.12",
|
|
136
136
|
"husky": "^9.1.7",
|
|
137
137
|
"intersection-observer": "^0.12.2",
|
|
138
138
|
"jsdom": "26.1.0",
|
|
@@ -140,7 +140,7 @@
|
|
|
140
140
|
"magic-string": "^0.30.17",
|
|
141
141
|
"mini-css-extract-plugin": "^2.9.2",
|
|
142
142
|
"mockdate": "^3.0.5",
|
|
143
|
-
"playwright": "
|
|
143
|
+
"playwright": "1.53.1",
|
|
144
144
|
"plop": "^4.0.1",
|
|
145
145
|
"postcss": "^8.5.6",
|
|
146
146
|
"prettier": "^3.5.3",
|
|
@@ -156,7 +156,7 @@
|
|
|
156
156
|
"react-stately": "^3.39.0",
|
|
157
157
|
"react-swipeable": "^7.0.2",
|
|
158
158
|
"rollup-plugin-visualizer": "^6.0.3",
|
|
159
|
-
"storybook": "9.0.
|
|
159
|
+
"storybook": "9.0.12",
|
|
160
160
|
"storybook-addon-tag-badges": "^2.0.1",
|
|
161
161
|
"typescript": "5.8.3",
|
|
162
162
|
"url-loader": "^4.1.1",
|
|
@@ -185,7 +185,7 @@
|
|
|
185
185
|
"webpack": "*"
|
|
186
186
|
},
|
|
187
187
|
"volta": {
|
|
188
|
-
"node": "22.
|
|
188
|
+
"node": "22.17.0",
|
|
189
189
|
"yarn": "4.9.2"
|
|
190
190
|
},
|
|
191
191
|
"packageManager": "yarn@4.9.2"
|