@autoguru/overdrive 4.45.2 → 4.47.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/Calendar/Calendar.css.d.ts +8 -0
- package/dist/components/Calendar/Calendar.css.d.ts.map +1 -0
- package/dist/components/Calendar/Calendar.css.js +113 -0
- package/dist/components/Calendar/Calendar.d.ts +64 -0
- package/dist/components/Calendar/Calendar.d.ts.map +1 -0
- package/dist/components/Calendar/Calendar.js +122 -0
- package/dist/components/Calendar/CalendarButton.d.ts +7 -0
- package/dist/components/Calendar/CalendarButton.d.ts.map +1 -0
- package/dist/components/{DateTimePicker → Calendar}/CalendarButton.js +4 -3
- package/dist/components/{DateTimePicker → Calendar}/CalendarGrid.d.ts +4 -1
- package/dist/components/Calendar/CalendarGrid.d.ts.map +1 -0
- package/dist/components/{DateTimePicker → Calendar}/CalendarGrid.js +8 -7
- package/dist/components/Calendar/index.d.ts +3 -0
- package/dist/components/Calendar/index.d.ts.map +1 -0
- package/dist/components/Calendar/index.js +3 -0
- package/dist/components/DatePicker/DatePicker.css.d.ts +2 -1
- package/dist/components/DatePicker/DatePicker.css.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePicker.css.js +60 -30
- package/dist/components/DatePicker/DatePicker.d.ts +83 -5
- package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePicker.js +160 -43
- package/dist/components/DateTimePicker/DateTimePicker.css.d.ts +0 -15
- package/dist/components/DateTimePicker/DateTimePicker.css.d.ts.map +1 -1
- package/dist/components/DateTimePicker/DateTimePicker.css.js +16 -99
- package/dist/components/DateTimePicker/DateTimePicker.d.ts +5 -2
- package/dist/components/DateTimePicker/DateTimePicker.d.ts.map +1 -1
- package/dist/components/DateTimePicker/DateTimePicker.js +24 -80
- package/dist/components/OptionGrid/OptionGrid.css.d.ts +33 -34
- package/dist/components/OptionGrid/OptionGrid.css.d.ts.map +1 -1
- package/dist/components/OptionGrid/OptionGrid.css.js +208 -146
- package/dist/components/OptionGrid/OptionGrid.d.ts +16 -5
- package/dist/components/OptionGrid/OptionGrid.d.ts.map +1 -1
- package/dist/components/OptionGrid/OptionGrid.js +38 -13
- package/dist/components/OptionList/OptionList.css.d.ts +2 -10
- package/dist/components/OptionList/OptionList.css.d.ts.map +1 -1
- package/dist/components/OptionList/OptionList.css.js +92 -92
- package/dist/components/OptionList/OptionList.d.ts +10 -3
- package/dist/components/OptionList/OptionList.d.ts.map +1 -1
- package/dist/components/OptionList/OptionListItem.js +3 -3
- package/dist/components/Popover/Popover.css.d.ts +4 -0
- package/dist/components/Popover/Popover.css.d.ts.map +1 -0
- package/dist/components/Popover/Popover.css.js +46 -0
- package/dist/components/Popover/Popover.d.ts +34 -0
- package/dist/components/Popover/Popover.d.ts.map +1 -0
- package/dist/components/Popover/Popover.js +127 -0
- package/dist/components/Popover/PopoverTrigger.d.ts +51 -0
- package/dist/components/Popover/PopoverTrigger.d.ts.map +1 -0
- package/dist/components/Popover/PopoverTrigger.js +94 -0
- package/dist/components/Popover/index.d.ts +5 -0
- package/dist/components/Popover/index.d.ts.map +1 -0
- package/dist/components/Popover/index.js +4 -0
- package/dist/components/SearchBar/SearchBar.css.d.ts +7 -12
- package/dist/components/SearchBar/SearchBar.css.d.ts.map +1 -1
- package/dist/components/SearchBar/SearchBar.css.js +121 -66
- package/dist/components/SearchBar/SearchBar.d.ts.map +1 -1
- package/dist/components/SearchBar/SearchBar.js +17 -10
- package/dist/components/Slider/Slider.css.d.ts +9 -0
- package/dist/components/Slider/Slider.css.d.ts.map +1 -0
- package/dist/components/Slider/Slider.css.js +92 -0
- package/dist/components/Slider/Slider.d.ts +47 -0
- package/dist/components/Slider/Slider.d.ts.map +1 -0
- package/dist/components/Slider/Slider.js +137 -0
- package/dist/components/Slider/index.d.ts +2 -0
- package/dist/components/Slider/index.d.ts.map +1 -0
- package/dist/components/Slider/index.js +3 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -0
- package/dist/hooks/useMedia/useMedia.spec.d.ts +2 -0
- package/dist/hooks/useMedia/useMedia.spec.d.ts.map +1 -0
- package/dist/hooks/useMedia/useMedia.spec.js +288 -0
- package/dist/styles/selectors.d.ts +14 -0
- package/dist/styles/selectors.d.ts.map +1 -0
- package/dist/styles/selectors.js +27 -0
- package/dist/utils/css.d.ts +0 -22
- package/dist/utils/css.d.ts.map +1 -1
- package/dist/utils/css.js +0 -52
- package/dist/utils/css.spec.d.ts +2 -0
- package/dist/utils/css.spec.d.ts.map +1 -0
- package/dist/utils/css.spec.js +66 -0
- package/dist/utils/dateFormat.d.ts +24 -0
- package/dist/utils/dateFormat.d.ts.map +1 -0
- package/dist/utils/dateFormat.js +57 -0
- package/dist/utils/object.spec.d.ts +2 -0
- package/dist/utils/object.spec.d.ts.map +1 -0
- package/dist/utils/object.spec.js +135 -0
- package/dist/utils/responsiveStyle.spec.d.ts +2 -0
- package/dist/utils/responsiveStyle.spec.d.ts.map +1 -0
- package/dist/utils/responsiveStyle.spec.js +134 -0
- package/dist/utils/utils.spec.d.ts.map +1 -1
- package/dist/utils/utils.spec.js +342 -0
- package/package.json +25 -25
- package/dist/components/DateTimePicker/CalendarButton.d.ts +0 -4
- package/dist/components/DateTimePicker/CalendarButton.d.ts.map +0 -1
- package/dist/components/DateTimePicker/CalendarGrid.d.ts.map +0 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type AriaPopoverProps } from 'react-aria';
|
|
3
|
+
import type { TestIdProp } from '../../types';
|
|
4
|
+
import { type Language } from './Popover';
|
|
5
|
+
/**
|
|
6
|
+
* Props for the PopoverTrigger component.
|
|
7
|
+
*/
|
|
8
|
+
export interface PopoverTriggerProps extends Pick<AriaPopoverProps, 'offset' | 'placement' | 'shouldCloseOnInteractOutside' | 'shouldFlip'>, TestIdProp {
|
|
9
|
+
/**
|
|
10
|
+
* The content to display in the popover
|
|
11
|
+
*/
|
|
12
|
+
content: React.ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* The element that triggers the popover when interacted with. For accessibility,
|
|
15
|
+
* this must contain the aria visible content (e.g. "open calender")
|
|
16
|
+
*/
|
|
17
|
+
children: React.ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* Whether the trigger is disabled and non-interactive
|
|
20
|
+
*/
|
|
21
|
+
isDisabled?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Language content override
|
|
24
|
+
*/
|
|
25
|
+
lang?: Language;
|
|
26
|
+
/**
|
|
27
|
+
* Callback that receives the overlay trigger state for external control
|
|
28
|
+
*/
|
|
29
|
+
onStateReady?: (state: {
|
|
30
|
+
close: () => void;
|
|
31
|
+
}) => void;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* A popover component that displays content in an overlay positioned relative to a trigger element.
|
|
35
|
+
* The popover automatically handles positioning, accessibility, and focus management.
|
|
36
|
+
*
|
|
37
|
+
* Note: Button components are not supported as children due to React Aria compatibility issues,
|
|
38
|
+
* use button tag, plain text, or other elements instead.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```tsx
|
|
42
|
+
* <PopoverTrigger content={<Calendar />}>
|
|
43
|
+
* Choose Date
|
|
44
|
+
* </PopoverTrigger>
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare const PopoverTrigger: {
|
|
48
|
+
({ content, children, isDisabled, offset, placement, shouldCloseOnInteractOutside, shouldFlip, testId, lang, onStateReady, }: PopoverTriggerProps): React.JSX.Element;
|
|
49
|
+
displayName: string;
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=PopoverTrigger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PopoverTrigger.d.ts","sourceRoot":"","sources":["../../../lib/components/Popover/PopoverTrigger.tsx"],"names":[],"mappings":"AACA,OAAO,KAAiB,MAAM,OAAO,CAAC;AACtC,OAAO,EAGN,KAAK,gBAAgB,EACrB,MAAM,YAAY,CAAC;AAGpB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAI9C,OAAO,EAAE,KAAK,QAAQ,EAAW,MAAM,WAAW,CAAC;AAGnD;;GAEG;AACH,MAAM,WAAW,mBAChB,SAAQ,IAAI,CACV,gBAAgB,EACd,QAAQ,GACR,WAAW,GACX,8BAA8B,GAC9B,YAAY,CACd,EACD,UAAU;IACX;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB;;;OAGG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,KAAK,EAAE,MAAM,IAAI,CAAA;KAAE,KAAK,IAAI,CAAC;CACtD;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,cAAc;kIAWxB,mBAAmB;;CAwErB,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
import { invariant } from '@autoguru/utilities';
|
|
7
|
+
import React, { useRef } from 'react';
|
|
8
|
+
import { useOverlayTrigger, useButton } from 'react-aria';
|
|
9
|
+
import { useOverlayTriggerState } from 'react-stately';
|
|
10
|
+
import { dataAttrs } from "../../utils/dataAttrs.js";
|
|
11
|
+
import { Button } from "../Button/Button.js";
|
|
12
|
+
import { Popover } from "./Popover.js";
|
|
13
|
+
import { triggerStyle } from "./Popover.css.js";
|
|
14
|
+
/**
|
|
15
|
+
* Props for the PopoverTrigger component.
|
|
16
|
+
*/
|
|
17
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
|
+
/**
|
|
19
|
+
* A popover component that displays content in an overlay positioned relative to a trigger element.
|
|
20
|
+
* The popover automatically handles positioning, accessibility, and focus management.
|
|
21
|
+
*
|
|
22
|
+
* Note: Button components are not supported as children due to React Aria compatibility issues,
|
|
23
|
+
* use button tag, plain text, or other elements instead.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* <PopoverTrigger content={<Calendar />}>
|
|
28
|
+
* Choose Date
|
|
29
|
+
* </PopoverTrigger>
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export const PopoverTrigger = ({
|
|
33
|
+
content,
|
|
34
|
+
children,
|
|
35
|
+
isDisabled,
|
|
36
|
+
offset,
|
|
37
|
+
placement,
|
|
38
|
+
shouldCloseOnInteractOutside,
|
|
39
|
+
shouldFlip,
|
|
40
|
+
testId,
|
|
41
|
+
lang,
|
|
42
|
+
onStateReady
|
|
43
|
+
}) => {
|
|
44
|
+
const state = useOverlayTriggerState({});
|
|
45
|
+
const triggerRef = useRef(null);
|
|
46
|
+
|
|
47
|
+
// Provide state access to parent component
|
|
48
|
+
React.useEffect(() => {
|
|
49
|
+
if (onStateReady) {
|
|
50
|
+
onStateReady({
|
|
51
|
+
close: state.close
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}, [onStateReady, state.close]);
|
|
55
|
+
const {
|
|
56
|
+
triggerProps,
|
|
57
|
+
overlayProps
|
|
58
|
+
} = useOverlayTrigger({
|
|
59
|
+
type: 'dialog'
|
|
60
|
+
}, state, triggerRef);
|
|
61
|
+
const {
|
|
62
|
+
buttonProps
|
|
63
|
+
} = useButton(_objectSpread(_objectSpread({}, triggerProps), {}, {
|
|
64
|
+
isDisabled
|
|
65
|
+
}), triggerRef);
|
|
66
|
+
|
|
67
|
+
// Validate that Button components are not used as children
|
|
68
|
+
if (/*#__PURE__*/React.isValidElement(children) && children.type === Button) {
|
|
69
|
+
!false ? process.env.NODE_ENV !== "production" ? invariant(false, 'PopoverTrigger: The Button component is presently incompatible with ReactAria. Please use a native button or other element for the trigger.') : invariant(false) : void 0;
|
|
70
|
+
}
|
|
71
|
+
const isNativeButton = /*#__PURE__*/React.isValidElement(children) && children.type === 'button';
|
|
72
|
+
const combinedProps = _objectSpread(_objectSpread(_objectSpread({}, buttonProps), dataAttrs({
|
|
73
|
+
testid: testId
|
|
74
|
+
})), {}, {
|
|
75
|
+
ref: triggerRef
|
|
76
|
+
});
|
|
77
|
+
const triggerElement = isNativeButton ? (/*#__PURE__*/React.cloneElement(children, combinedProps)) : /*#__PURE__*/_jsx("button", _objectSpread(_objectSpread({}, combinedProps), {}, {
|
|
78
|
+
className: triggerStyle,
|
|
79
|
+
children: children
|
|
80
|
+
}));
|
|
81
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
82
|
+
children: [triggerElement, state.isOpen && /*#__PURE__*/_jsx(Popover, _objectSpread(_objectSpread({}, overlayProps), {}, {
|
|
83
|
+
state: state,
|
|
84
|
+
triggerRef: triggerRef,
|
|
85
|
+
placement: placement,
|
|
86
|
+
offset: offset,
|
|
87
|
+
shouldCloseOnInteractOutside: shouldCloseOnInteractOutside,
|
|
88
|
+
shouldFlip: shouldFlip,
|
|
89
|
+
lang: lang,
|
|
90
|
+
children: content
|
|
91
|
+
}))]
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
PopoverTrigger.displayName = 'PopoverTrigger';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/components/Popover/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export declare const searchBarStyle: string;
|
|
2
|
+
export declare const inputStyle: string;
|
|
3
|
+
export declare const clearButtonVariants: import("@vanilla-extract/recipes").RuntimeFn<{
|
|
4
|
+
hasValue: {
|
|
5
|
+
false: {};
|
|
4
6
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
[x: string]: {
|
|
8
|
-
[x: string]: string | import("@vanilla-extract/css").ComplexStyleRule;
|
|
9
|
-
};
|
|
10
|
-
}>;
|
|
11
|
-
export declare const styledClearButton: import("@vanilla-extract/recipes").RuntimeFn<{
|
|
12
|
-
[x: string]: {
|
|
13
|
-
[x: string]: string | import("@vanilla-extract/css").ComplexStyleRule;
|
|
7
|
+
isFocused: {
|
|
8
|
+
false: {};
|
|
14
9
|
};
|
|
15
10
|
}>;
|
|
16
11
|
export declare const fieldWrapper: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchBar.css.d.ts","sourceRoot":"","sources":["../../../lib/components/SearchBar/SearchBar.css.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SearchBar.css.d.ts","sourceRoot":"","sources":["../../../lib/components/SearchBar/SearchBar.css.ts"],"names":[],"mappings":"AAoCA,eAAO,MAAM,cAAc,QAsCzB,CAAC;AAEH,eAAO,MAAM,UAAU,QAiBrB,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;EA2C9B,CAAC;AAEH,eAAO,MAAM,YAAY,QAQvB,CAAC"}
|
|
@@ -5,86 +5,141 @@ __vanilla_filescope__.setFileScope("lib/components/SearchBar/SearchBar.css.ts",
|
|
|
5
5
|
import { style } from '@vanilla-extract/css';
|
|
6
6
|
import { recipe } from '@vanilla-extract/recipes';
|
|
7
7
|
import { focusOutlineStyle } from "../../styles/focusOutline.css.js";
|
|
8
|
+
import { cssLayerComponent } from "../../styles/layers.css.js";
|
|
8
9
|
import { sprinkles } from "../../styles/sprinkles.css.js";
|
|
9
|
-
import { tokens } from "../../themes/
|
|
10
|
-
import { interactionStyle } from "../../utils/css.js";
|
|
10
|
+
import { overdriveTokens as tokens } from "../../themes/theme.css.js";
|
|
11
11
|
const hideWebkitAppearance = style({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
'@layer': {
|
|
13
|
+
[cssLayerComponent]: {
|
|
14
|
+
selectors: {
|
|
15
|
+
'&::-webkit-search-cancel-button, &::-webkit-search-decoration': {
|
|
16
|
+
appearance: 'none'
|
|
17
|
+
}
|
|
18
|
+
}
|
|
15
19
|
}
|
|
16
20
|
}
|
|
17
21
|
}, "hideWebkitAppearance");
|
|
18
22
|
const placeholder = style({
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
'@layer': {
|
|
24
|
+
[cssLayerComponent]: {
|
|
25
|
+
selectors: {
|
|
26
|
+
'&::placeholder': {
|
|
27
|
+
color: tokens.colours.gamut.gray400
|
|
28
|
+
},
|
|
29
|
+
'&:disabled::placeholder': {
|
|
30
|
+
color: tokens.colours.gamut.gray300
|
|
31
|
+
}
|
|
32
|
+
}
|
|
25
33
|
}
|
|
26
34
|
}
|
|
27
35
|
}, "placeholder");
|
|
28
|
-
export const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
36
|
+
export const searchBarStyle = style([{
|
|
37
|
+
'@layer': {
|
|
38
|
+
[cssLayerComponent]: {
|
|
39
|
+
alignItems: 'center',
|
|
40
|
+
backgroundColor: tokens.colours.background.body,
|
|
41
|
+
borderColor: tokens.border.colours.gray,
|
|
42
|
+
borderRadius: tokens.border.radius['md'],
|
|
43
|
+
borderStyle: 'solid',
|
|
44
|
+
borderWidth: tokens.border.width[2],
|
|
45
|
+
color: tokens.colours.gamut.gray400,
|
|
46
|
+
display: 'flex',
|
|
47
|
+
gap: tokens.space[2],
|
|
48
|
+
padding: `0 ${tokens.space[4]}`,
|
|
49
|
+
selectors: {
|
|
50
|
+
'&:focus, &[data-focus], &[data-focused]': {
|
|
51
|
+
borderColor: tokens.border.colours.dark,
|
|
52
|
+
color: tokens.colours.gamut.gray900
|
|
53
|
+
},
|
|
54
|
+
'&:disabled, &[data-disabled]': {
|
|
55
|
+
borderColor: tokens.border.colours.light,
|
|
56
|
+
color: tokens.colours.gamut.gray300,
|
|
57
|
+
cursor: 'not-allowed'
|
|
58
|
+
},
|
|
59
|
+
'&:hover:not(:disabled,[data-disabled]), &[data-hover]:not(:disabled,[data-disabled])': {
|
|
60
|
+
cursor: 'text'
|
|
61
|
+
},
|
|
62
|
+
'&:hover:not(:focus,[data-focus],[data-focused]):not(:disabled,[data-disabled]), &[data-hover]:not(:focus,[data-focus],[data-focused]):not(:disabled,[data-disabled])': {
|
|
63
|
+
backgroundColor: tokens.border.colours.light,
|
|
64
|
+
borderColor: tokens.border.colours.light
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}, focusOutlineStyle], "searchBarStyle");
|
|
70
|
+
export const inputStyle = style([{
|
|
71
|
+
'@layer': {
|
|
72
|
+
[cssLayerComponent]: {
|
|
73
|
+
background: 'transparent',
|
|
74
|
+
borderWidth: 0,
|
|
75
|
+
cursor: 'inherit',
|
|
76
|
+
fontSize: tokens.typography.size[8].fontSize,
|
|
77
|
+
height: '72px',
|
|
78
|
+
outlineStyle: 'none',
|
|
79
|
+
textAlign: 'center',
|
|
80
|
+
width: '100%'
|
|
56
81
|
}
|
|
57
|
-
}
|
|
58
|
-
}, "
|
|
59
|
-
export const
|
|
60
|
-
base: [{
|
|
61
|
-
background: 'transparent',
|
|
62
|
-
borderWidth: 0,
|
|
63
|
-
cursor: 'inherit',
|
|
64
|
-
fontSize: tokens.typography.size[8].fontSize,
|
|
65
|
-
height: '72px',
|
|
66
|
-
outlineStyle: 'none',
|
|
67
|
-
textAlign: 'center',
|
|
68
|
-
width: '100%'
|
|
69
|
-
}, hideWebkitAppearance, placeholder]
|
|
70
|
-
}, "styledInput");
|
|
71
|
-
export const styledClearButton = recipe({
|
|
72
|
-
base: [{
|
|
82
|
+
}
|
|
83
|
+
}, hideWebkitAppearance, placeholder], "inputStyle");
|
|
84
|
+
export const clearButtonVariants = recipe({
|
|
85
|
+
base: [sprinkles({
|
|
73
86
|
alignItems: 'center',
|
|
74
|
-
background: 'transparent',
|
|
75
87
|
borderStyle: 'none',
|
|
76
|
-
cursor: 'pointer',
|
|
77
|
-
display: 'flex',
|
|
78
88
|
justifyContent: 'center',
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
89
|
+
opacity: '1',
|
|
90
|
+
p: 'none',
|
|
91
|
+
pointerEvents: 'auto',
|
|
92
|
+
position: 'relative',
|
|
82
93
|
size: '6'
|
|
83
|
-
})
|
|
84
|
-
|
|
94
|
+
}), {
|
|
95
|
+
'@layer': {
|
|
96
|
+
[cssLayerComponent]: {
|
|
97
|
+
background: 'transparent',
|
|
98
|
+
cursor: 'pointer'
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}],
|
|
102
|
+
variants: {
|
|
103
|
+
hasValue: {
|
|
104
|
+
false: {}
|
|
105
|
+
},
|
|
106
|
+
isFocused: {
|
|
107
|
+
false: {}
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
compoundVariants: [{
|
|
111
|
+
variants: {
|
|
112
|
+
hasValue: false
|
|
113
|
+
},
|
|
114
|
+
style: sprinkles({
|
|
115
|
+
display: 'none'
|
|
116
|
+
})
|
|
117
|
+
}, {
|
|
118
|
+
variants: {
|
|
119
|
+
hasValue: true,
|
|
120
|
+
isFocused: false
|
|
121
|
+
},
|
|
122
|
+
style: sprinkles({
|
|
123
|
+
opacity: '0',
|
|
124
|
+
pointerEvents: 'none'
|
|
125
|
+
})
|
|
126
|
+
}, {
|
|
127
|
+
variants: {
|
|
128
|
+
hasValue: true,
|
|
129
|
+
isFocused: true
|
|
130
|
+
},
|
|
131
|
+
style: sprinkles({
|
|
132
|
+
display: 'flex'
|
|
133
|
+
})
|
|
134
|
+
}]
|
|
135
|
+
}, "clearButtonVariants");
|
|
85
136
|
export const fieldWrapper = style({
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
137
|
+
'@layer': {
|
|
138
|
+
[cssLayerComponent]: {
|
|
139
|
+
alignItems: 'center',
|
|
140
|
+
display: 'flex',
|
|
141
|
+
flexGrow: 1
|
|
142
|
+
}
|
|
143
|
+
}
|
|
89
144
|
}, "fieldWrapper");
|
|
90
145
|
__vanilla_filescope__.endFileScope();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchBar.d.ts","sourceRoot":"","sources":["../../../lib/components/SearchBar/SearchBar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAMN,KAAK,oBAAoB,EACzB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"SearchBar.d.ts","sourceRoot":"","sources":["../../../lib/components/SearchBar/SearchBar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAMN,KAAK,oBAAoB,EACzB,MAAM,YAAY,CAAC;AAIpB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAY9C,QAAA,MAAM,cAAc;;;CAGV,CAAC;AAEX,KAAK,WAAW,GAAG,MAAM,OAAO,cAAc,CAAC;AAE/C,UAAU,cAAe,SAAQ,oBAAoB,EAAE,UAAU;IAChE,QAAQ,CAAC,EAAE,oBAAoB,CAAC,UAAU,CAAC,CAAC;IAC5C,UAAU,CAAC,EAAE,oBAAoB,CAAC,YAAY,CAAC,CAAC;IAChD,SAAS,CAAC,EAAE,oBAAoB,CAAC,WAAW,CAAC,CAAC;IAC9C;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;IAC5C;;OAEG;IACH,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;CAClC;AAYD;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,GAAI,gBAAgB,cAAc,sBAuEvD,CAAC"}
|
|
@@ -7,10 +7,11 @@ import { MagnifyIcon, CloseIcon } from '@autoguru/icons';
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { mergeProps, useButton, useFocusRing, useSearchField } from 'react-aria';
|
|
9
9
|
import { useSearchFieldState } from 'react-stately';
|
|
10
|
+
import { sprinkles } from "../../styles/index.js";
|
|
10
11
|
import { mergeRefs } from "../../utils/index.js";
|
|
11
12
|
import { dataAttrs } from "../../utils/dataAttrs.js";
|
|
12
13
|
import { Icon } from "../Icon/index.js";
|
|
13
|
-
import { fieldWrapper,
|
|
14
|
+
import { fieldWrapper, clearButtonVariants, inputStyle, searchBarStyle } from "./SearchBar.css.js";
|
|
14
15
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
16
|
const defaultEnglish = {
|
|
16
17
|
label: 'Search',
|
|
@@ -65,9 +66,14 @@ export const SearchBar = componentProps => {
|
|
|
65
66
|
(_refInput$current = refInput.current) === null || _refInput$current === void 0 ? void 0 : _refInput$current.focus();
|
|
66
67
|
};
|
|
67
68
|
const ClearButton = () => {
|
|
68
|
-
|
|
69
|
+
var _componentProps$lang$, _componentProps$lang;
|
|
70
|
+
const hasValue = state.value !== '';
|
|
69
71
|
return /*#__PURE__*/_jsx(ReactAriaButton, _objectSpread(_objectSpread({
|
|
70
|
-
className:
|
|
72
|
+
className: clearButtonVariants({
|
|
73
|
+
hasValue,
|
|
74
|
+
isFocused
|
|
75
|
+
}),
|
|
76
|
+
"aria-label": (_componentProps$lang$ = (_componentProps$lang = componentProps.lang) === null || _componentProps$lang === void 0 ? void 0 : _componentProps$lang.clear) !== null && _componentProps$lang$ !== void 0 ? _componentProps$lang$ : defaultEnglish.clear
|
|
71
77
|
}, clearButtonProps), {}, {
|
|
72
78
|
children: /*#__PURE__*/_jsx(Icon, {
|
|
73
79
|
icon: CloseIcon,
|
|
@@ -79,7 +85,7 @@ export const SearchBar = componentProps => {
|
|
|
79
85
|
/*#__PURE__*/
|
|
80
86
|
// this is a pass-through for mouse/touch interaction, the interactive element is keyboard focusable
|
|
81
87
|
_jsxs("div", _objectSpread(_objectSpread({
|
|
82
|
-
className:
|
|
88
|
+
className: searchBarStyle,
|
|
83
89
|
onClick: handleWrapperClick,
|
|
84
90
|
ref: refWrapper
|
|
85
91
|
}, dataAttrs({
|
|
@@ -88,15 +94,16 @@ export const SearchBar = componentProps => {
|
|
|
88
94
|
'focus-visible': isFocusVisible,
|
|
89
95
|
testid: props.testId
|
|
90
96
|
})), {}, {
|
|
91
|
-
children: [/*#__PURE__*/_jsx(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
97
|
+
children: [/*#__PURE__*/_jsx(Icon, {
|
|
98
|
+
className: sprinkles({
|
|
99
|
+
flexShrink: '0'
|
|
100
|
+
}),
|
|
101
|
+
icon: MagnifyIcon,
|
|
102
|
+
size: "large"
|
|
96
103
|
}), /*#__PURE__*/_jsxs("div", {
|
|
97
104
|
className: fieldWrapper,
|
|
98
105
|
children: [/*#__PURE__*/_jsx("input", _objectSpread(_objectSpread({}, mergeProps(inputProps, focusProps)), {}, {
|
|
99
|
-
className:
|
|
106
|
+
className: inputStyle,
|
|
100
107
|
ref: mergeRefs([refInput, refForwarded])
|
|
101
108
|
})), /*#__PURE__*/_jsx(ClearButton, {})]
|
|
102
109
|
})]
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const container: string;
|
|
2
|
+
export declare const label: string;
|
|
3
|
+
export declare const valueDisplay: string;
|
|
4
|
+
export declare const valueText: string;
|
|
5
|
+
export declare const sliderContainer: string;
|
|
6
|
+
export declare const trackContainer: string;
|
|
7
|
+
export declare const track: string;
|
|
8
|
+
export declare const thumb: string;
|
|
9
|
+
//# sourceMappingURL=Slider.css.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Slider.css.d.ts","sourceRoot":"","sources":["../../../lib/components/Slider/Slider.css.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,SAAS,QAKpB,CAAC;AAEH,eAAO,MAAM,KAAK,QAIhB,CAAC;AAEH,eAAO,MAAM,YAAY,QAIvB,CAAC;AAEH,eAAO,MAAM,SAAS,QAIpB,CAAC;AAEH,eAAO,MAAM,eAAe,QAK1B,CAAC;AAEH,eAAO,MAAM,cAAc,QAIzB,CAAC;AAEH,eAAO,MAAM,KAAK,QAoBhB,CAAC;AAEH,eAAO,MAAM,KAAK,QAkChB,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import * as __vanilla_filescope__ from '@vanilla-extract/css/fileScope';
|
|
4
|
+
__vanilla_filescope__.setFileScope("lib/components/Slider/Slider.css.ts", "@autoguru/overdrive");
|
|
5
|
+
import { style } from '@vanilla-extract/css';
|
|
6
|
+
import { focusOutlineStyle } from "../../styles/focusOutline.css.js";
|
|
7
|
+
import { cssLayerComponent } from "../../styles/layers.css.js";
|
|
8
|
+
import { selectors } from "../../styles/selectors.js";
|
|
9
|
+
import { sprinkles } from "../../styles/sprinkles.css.js";
|
|
10
|
+
import { overdriveTokens as vars } from "../../themes/theme.css.js";
|
|
11
|
+
export const container = sprinkles({
|
|
12
|
+
display: 'flex',
|
|
13
|
+
flexDirection: 'column',
|
|
14
|
+
gap: '3',
|
|
15
|
+
width: 'full'
|
|
16
|
+
});
|
|
17
|
+
export const label = sprinkles({
|
|
18
|
+
fontSize: '6',
|
|
19
|
+
fontWeight: 'semiBold',
|
|
20
|
+
color: 'normal'
|
|
21
|
+
});
|
|
22
|
+
export const valueDisplay = sprinkles({
|
|
23
|
+
display: 'flex',
|
|
24
|
+
justifyContent: 'center',
|
|
25
|
+
marginBottom: '3'
|
|
26
|
+
});
|
|
27
|
+
export const valueText = sprinkles({
|
|
28
|
+
fontSize: '7',
|
|
29
|
+
fontWeight: 'semiBold',
|
|
30
|
+
color: 'normal'
|
|
31
|
+
});
|
|
32
|
+
export const sliderContainer = sprinkles({
|
|
33
|
+
display: 'flex',
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
gap: '4',
|
|
36
|
+
width: 'full'
|
|
37
|
+
});
|
|
38
|
+
export const trackContainer = sprinkles({
|
|
39
|
+
position: 'relative',
|
|
40
|
+
width: 'full',
|
|
41
|
+
display: 'flex'
|
|
42
|
+
});
|
|
43
|
+
export const track = style([sprinkles({
|
|
44
|
+
borderRadius: 'pill',
|
|
45
|
+
height: '1',
|
|
46
|
+
position: 'relative',
|
|
47
|
+
width: 'full'
|
|
48
|
+
}), {
|
|
49
|
+
'@layer': {
|
|
50
|
+
[cssLayerComponent]: {
|
|
51
|
+
backgroundColor: vars.colours.gamut.gray300,
|
|
52
|
+
selectors: {
|
|
53
|
+
[selectors.disabled]: {
|
|
54
|
+
backgroundColor: vars.colours.gamut.gray200,
|
|
55
|
+
cursor: 'not-allowed'
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}], "track");
|
|
61
|
+
export const thumb = style([sprinkles({
|
|
62
|
+
borderRadius: 'full',
|
|
63
|
+
borderWidth: 'none',
|
|
64
|
+
size: '5'
|
|
65
|
+
}), {
|
|
66
|
+
'@layer': {
|
|
67
|
+
[cssLayerComponent]: {
|
|
68
|
+
backgroundColor: vars.colours.gamut.black900,
|
|
69
|
+
cursor: 'pointer',
|
|
70
|
+
position: 'absolute',
|
|
71
|
+
top: '50%',
|
|
72
|
+
transform: 'translate(-50%, -50%)',
|
|
73
|
+
transition: `box-shadow 0.2s ${vars.animation.easing.standard}`,
|
|
74
|
+
selectors: {
|
|
75
|
+
[selectors.hover]: {
|
|
76
|
+
boxShadow: `0 0 0 4px rgba(0, 0, 0, 0.1)`
|
|
77
|
+
},
|
|
78
|
+
[selectors.focusVisible]: {
|
|
79
|
+
boxShadow: `0 0 0 4px rgba(0, 0, 0, 0.2)`
|
|
80
|
+
},
|
|
81
|
+
'&[data-dragging]': {
|
|
82
|
+
boxShadow: `0 0 0 4px rgba(0, 0, 0, 0.2)`
|
|
83
|
+
},
|
|
84
|
+
[selectors.disabled]: {
|
|
85
|
+
backgroundColor: vars.colours.gamut.gray500,
|
|
86
|
+
cursor: 'not-allowed'
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}, focusOutlineStyle], "thumb");
|
|
92
|
+
__vanilla_filescope__.endFileScope();
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type AriaSliderProps, type AriaSliderThumbProps } from 'react-aria';
|
|
3
|
+
import type { TestIdProp } from '../../types';
|
|
4
|
+
export interface SliderProps extends AriaSliderProps, Pick<AriaSliderThumbProps, 'name'>, TestIdProp {
|
|
5
|
+
/**
|
|
6
|
+
* Optional label for the slider
|
|
7
|
+
*/
|
|
8
|
+
label?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Unit text to display with the value (e.g., 'kms', 'miles', '%')
|
|
11
|
+
*/
|
|
12
|
+
unitText?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Step value for slider increments
|
|
15
|
+
* @default 5
|
|
16
|
+
*/
|
|
17
|
+
step?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Formatting options for the value displayed in the slider
|
|
20
|
+
*/
|
|
21
|
+
formatOptions?: Intl.NumberFormatOptions;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A slider component that allows users to select a value from a range,
|
|
25
|
+
* supports configurable step values and value unit post-fix. Use the `onChange` handler
|
|
26
|
+
* in most instances for retrieving the current value.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* const handleOnChange = (value) => {
|
|
30
|
+
* console.log('Distance changed to:', value);
|
|
31
|
+
* };
|
|
32
|
+
*
|
|
33
|
+
* <Slider
|
|
34
|
+
* label="Distance"
|
|
35
|
+
* value={distance}
|
|
36
|
+
* onChange={handleOnChange}
|
|
37
|
+
* minValue={0}
|
|
38
|
+
* maxValue={100}
|
|
39
|
+
* step={5}
|
|
40
|
+
* unitText="kms"
|
|
41
|
+
* />;
|
|
42
|
+
*/
|
|
43
|
+
export declare const Slider: {
|
|
44
|
+
({ testId, unitText, step, formatOptions, ...props }: SliderProps): React.JSX.Element;
|
|
45
|
+
displayName: string;
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=Slider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Slider.d.ts","sourceRoot":"","sources":["../../../lib/components/Slider/Slider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAMN,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,MAAM,YAAY,CAAC;AAGpB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAQ9C,MAAM,WAAW,WAChB,SAAQ,eAAe,EACtB,IAAI,CAAC,oBAAoB,EAAE,MAAM,CAAC,EAClC,UAAU;IACX;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,aAAa,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC;CACzC;AAqCD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,MAAM;0DAMhB,WAAW;;CA0Db,CAAC"}
|