@autoguru/overdrive 4.45.2 → 4.46.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.
Files changed (43) hide show
  1. package/dist/components/DateTimePicker/CalendarButton.js +2 -2
  2. package/dist/components/DateTimePicker/CalendarGrid.js +2 -2
  3. package/dist/components/DateTimePicker/DateTimePicker.css.d.ts +2 -10
  4. package/dist/components/DateTimePicker/DateTimePicker.css.d.ts.map +1 -1
  5. package/dist/components/DateTimePicker/DateTimePicker.css.js +108 -81
  6. package/dist/components/OptionGrid/OptionGrid.css.d.ts +33 -34
  7. package/dist/components/OptionGrid/OptionGrid.css.d.ts.map +1 -1
  8. package/dist/components/OptionGrid/OptionGrid.css.js +208 -146
  9. package/dist/components/OptionGrid/OptionGrid.d.ts +16 -5
  10. package/dist/components/OptionGrid/OptionGrid.d.ts.map +1 -1
  11. package/dist/components/OptionGrid/OptionGrid.js +38 -13
  12. package/dist/components/OptionList/OptionList.css.d.ts +2 -10
  13. package/dist/components/OptionList/OptionList.css.d.ts.map +1 -1
  14. package/dist/components/OptionList/OptionList.css.js +92 -92
  15. package/dist/components/OptionList/OptionList.d.ts +7 -0
  16. package/dist/components/OptionList/OptionList.d.ts.map +1 -1
  17. package/dist/components/OptionList/OptionListItem.js +3 -3
  18. package/dist/components/SearchBar/SearchBar.css.d.ts +7 -12
  19. package/dist/components/SearchBar/SearchBar.css.d.ts.map +1 -1
  20. package/dist/components/SearchBar/SearchBar.css.js +121 -66
  21. package/dist/components/SearchBar/SearchBar.d.ts.map +1 -1
  22. package/dist/components/SearchBar/SearchBar.js +17 -10
  23. package/dist/hooks/useMedia/useMedia.spec.d.ts +2 -0
  24. package/dist/hooks/useMedia/useMedia.spec.d.ts.map +1 -0
  25. package/dist/hooks/useMedia/useMedia.spec.js +288 -0
  26. package/dist/styles/selectors.d.ts +13 -0
  27. package/dist/styles/selectors.d.ts.map +1 -0
  28. package/dist/styles/selectors.js +26 -0
  29. package/dist/utils/css.d.ts +0 -22
  30. package/dist/utils/css.d.ts.map +1 -1
  31. package/dist/utils/css.js +0 -52
  32. package/dist/utils/css.spec.d.ts +2 -0
  33. package/dist/utils/css.spec.d.ts.map +1 -0
  34. package/dist/utils/css.spec.js +66 -0
  35. package/dist/utils/object.spec.d.ts +2 -0
  36. package/dist/utils/object.spec.d.ts.map +1 -0
  37. package/dist/utils/object.spec.js +135 -0
  38. package/dist/utils/responsiveStyle.spec.d.ts +2 -0
  39. package/dist/utils/responsiveStyle.spec.d.ts.map +1 -0
  40. package/dist/utils/responsiveStyle.spec.js +134 -0
  41. package/dist/utils/utils.spec.d.ts.map +1 -1
  42. package/dist/utils/utils.spec.js +342 -0
  43. package/package.json +8 -8
@@ -3,108 +3,108 @@
3
3
  import * as __vanilla_filescope__ from '@vanilla-extract/css/fileScope';
4
4
  __vanilla_filescope__.setFileScope("lib/components/OptionList/OptionList.css.ts", "@autoguru/overdrive");
5
5
  import { style } from '@vanilla-extract/css';
6
- import { recipe } from '@vanilla-extract/recipes';
7
6
  import { focusOutlineStyle } from "../../styles/focusOutline.css.js";
7
+ import { cssLayerComponent } from "../../styles/layers.css.js";
8
+ import { selectors } from "../../styles/selectors.js";
8
9
  import { sprinkles } from "../../styles/sprinkles.css.js";
9
- import { overdriveTokens as tokens } from "../../themes/theme.css.js";
10
- import { interactionStyle } from "../../utils/css.js"; // === Group styles
11
- export const groupStyle = style({
12
- marginTop: tokens.space['6']
13
- }, "groupStyle");
14
- export const groupLabelStyle = style({
15
- fontSize: tokens.typography.size['7'].fontSize,
16
- fontWeight: tokens.typography.fontWeight.bold,
17
- lineHeight: tokens.typography.size['7'].lineHeight,
18
- marginBottom: tokens.space['3']
19
- }, "groupLabelStyle");
20
- export const descriptionStyle = style({
21
- color: tokens.colours.gamut.gray400,
22
- fontSize: tokens.typography.size[4].fontSize,
23
- lineHeight: tokens.typography.size[4].lineHeight
24
- }, "descriptionStyle");
10
+ import { overdriveTokens as tokens } from "../../themes/theme.css.js"; // === Group styles
11
+ export const groupStyle = sprinkles({
12
+ mt: '6'
13
+ });
14
+ export const groupLabelStyle = sprinkles({
15
+ text: '7',
16
+ fontWeight: 'bold',
17
+ mb: '3'
18
+ });
19
+ export const descriptionStyle = style([sprinkles({
20
+ text: '4'
21
+ }), {
22
+ '@layer': {
23
+ [cssLayerComponent]: {
24
+ color: tokens.colours.gamut.gray400
25
+ }
26
+ }
27
+ }], "descriptionStyle");
25
28
 
26
29
  // === Option item styles
27
- const buttonBorderRadius = tokens.border.radius['md'];
28
- export const styledOptionItem = recipe({
29
- base: [{
30
- background: tokens.colours.background.body,
31
- borderColor: tokens.border.colours.gray,
32
- borderStyle: 'solid',
33
- borderWidth: tokens.border.width['1'],
34
- display: 'flex',
35
- gap: tokens.space['2'],
36
- padding: `${tokens.space['3']} ${tokens.space['4']}`,
37
- width: '100%',
38
- userSelect: 'none'
39
- }, interactionStyle({
40
- disabled: {
30
+ export const optionItemStyle = style([sprinkles({
31
+ borderColour: 'gray',
32
+ borderStyle: 'solid',
33
+ borderWidth: '1',
34
+ display: 'flex',
35
+ gap: '2',
36
+ paddingY: '3',
37
+ paddingX: '4',
38
+ userSelect: 'none',
39
+ width: 'full'
40
+ }), {
41
+ '@layer': {
42
+ [cssLayerComponent]: {
41
43
  background: tokens.colours.background.body,
42
- cursor: 'default'
43
- },
44
- hover: {
45
- background: tokens.colours.gamut.gray200,
46
- cursor: 'pointer'
47
- },
48
- focusVisible: {
49
- background: tokens.colours.gamut.gray200
50
- }
51
- }), {
52
- selectors: {
53
- ['&+&']: {
54
- borderTopStyle: 'none'
55
- },
56
- ['&:first-child']: {
57
- borderTopLeftRadius: buttonBorderRadius,
58
- borderTopRightRadius: buttonBorderRadius
59
- },
60
- ['&:last-child']: {
61
- borderBottomLeftRadius: buttonBorderRadius,
62
- borderBottomRightRadius: buttonBorderRadius
44
+ selectors: {
45
+ ['&+&']: {
46
+ borderTopStyle: 'none'
47
+ },
48
+ ['&:first-child']: {
49
+ borderTopLeftRadius: tokens.border.radius.md,
50
+ borderTopRightRadius: tokens.border.radius.md
51
+ },
52
+ ['&:last-child']: {
53
+ borderBottomLeftRadius: tokens.border.radius.md,
54
+ borderBottomRightRadius: tokens.border.radius.md
55
+ },
56
+ [selectors.hoverNotDisabled]: {
57
+ background: tokens.colours.gamut.gray200,
58
+ cursor: 'pointer'
59
+ },
60
+ [selectors.focusVisible]: {
61
+ background: tokens.colours.gamut.gray200
62
+ },
63
+ [selectors.disabled]: {
64
+ background: tokens.colours.background.body,
65
+ cursor: 'default'
66
+ }
63
67
  }
64
68
  }
65
- }, focusOutlineStyle]
66
- }, "styledOptionItem");
67
- export const itemLabelStyle = style({
69
+ }
70
+ }, focusOutlineStyle], "optionItemStyle");
71
+ export const itemLabelStyle = sprinkles({
68
72
  alignSelf: 'center',
69
- fontSize: tokens.typography.size['3'].fontSize,
70
- lineHeight: tokens.typography.size['3'].lineHeight,
71
- width: '100%'
72
- }, "itemLabelStyle");
73
+ text: '3',
74
+ width: 'full'
75
+ });
73
76
 
74
77
  // === Checkbox styles
75
- const checkboxTransition = style({
76
- transitionDuration: '100ms',
77
- transitionProperty: 'background',
78
- transitionTimingFunction: 'ease-in'
79
- }, "checkboxTransition");
80
- const checkboxHovered = style({
81
- selectors: {
82
- [`${styledOptionItem.classNames.base}:hover &:not([data-checked],[data-disabled])`]: {
83
- background: tokens.colours.gamut.gray300,
84
- color: tokens.colours.background.body
78
+ export const checkbox = style([sprinkles({
79
+ alignItems: 'center',
80
+ display: 'flex',
81
+ flexShrink: '0',
82
+ justifyContent: 'center',
83
+ size: '6',
84
+ borderRadius: 'sm',
85
+ borderStyle: 'solid',
86
+ borderWidth: '1'
87
+ }), {
88
+ '@layer': {
89
+ [cssLayerComponent]: {
90
+ background: tokens.colours.background.body,
91
+ borderColor: tokens.border.colours.gray,
92
+ color: 'transparent',
93
+ transitionDuration: '100ms',
94
+ transitionProperty: 'background',
95
+ transitionTimingFunction: 'ease-in',
96
+ selectors: {
97
+ [selectors.checked]: {
98
+ background: tokens.colours.gamut.gray900,
99
+ borderColor: tokens.border.colours.dark,
100
+ color: tokens.colours.background.body
101
+ },
102
+ [`${optionItemStyle}:hover &:not([data-checked],[data-disabled])`]: {
103
+ background: tokens.colours.gamut.gray300,
104
+ color: tokens.colours.background.body
105
+ }
106
+ }
85
107
  }
86
108
  }
87
- }, "checkboxHovered");
88
- export const checkbox = recipe({
89
- base: [{
90
- background: tokens.colours.background.body,
91
- borderColor: tokens.border.colours.gray,
92
- borderStyle: 'solid',
93
- borderRadius: tokens.border.radius['sm'],
94
- borderWidth: tokens.border.width['1'],
95
- color: 'transparent'
96
- }, interactionStyle({
97
- selected: {
98
- background: tokens.colours.gamut.gray900,
99
- borderColor: tokens.border.colours.dark,
100
- color: tokens.colours.background.body
101
- }
102
- }), sprinkles({
103
- alignItems: 'center',
104
- display: 'flex',
105
- flexShrink: '0',
106
- justifyContent: 'center',
107
- size: '6'
108
- }), checkboxHovered, checkboxTransition]
109
- }, "checkbox");
109
+ }], "checkbox");
110
110
  __vanilla_filescope__.endFileScope();
@@ -43,6 +43,7 @@ export declare const OptionList: {
43
43
  Item: {
44
44
  (props: {
45
45
  name?: string | undefined;
46
+ form?: string | undefined;
46
47
  value: string;
47
48
  autoFocus?: boolean | undefined;
48
49
  id?: string | undefined;
@@ -58,10 +59,16 @@ export declare const OptionList: {
58
59
  onChange?: ((isSelected: boolean) => void) | undefined;
59
60
  onKeyDown?: ((e: import("@react-types/shared").KeyboardEvent) => void) | undefined;
60
61
  onKeyUp?: ((e: import("@react-types/shared").KeyboardEvent) => void) | undefined;
62
+ onClick?: ((e: React.MouseEvent<import("@react-types/shared").FocusableElement>) => void) | undefined;
61
63
  isDisabled?: boolean | undefined;
62
64
  isReadOnly?: boolean | undefined;
63
65
  onFocusChange?: ((isFocused: boolean) => void) | undefined;
64
66
  excludeFromTabOrder?: boolean | undefined;
67
+ onPress?: ((e: import("react-aria").PressEvent) => void) | undefined;
68
+ onPressStart?: ((e: import("react-aria").PressEvent) => void) | undefined;
69
+ onPressEnd?: ((e: import("react-aria").PressEvent) => void) | undefined;
70
+ onPressChange?: ((isPressed: boolean) => void) | undefined;
71
+ onPressUp?: ((e: import("react-aria").PressEvent) => void) | undefined;
65
72
  isRequired?: boolean | undefined;
66
73
  isInvalid?: boolean | undefined;
67
74
  validationState?: import("react-stately").ValidationState | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"OptionList.d.ts","sourceRoot":"","sources":["../../../lib/components/OptionList/OptionList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAoB,KAAK,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAC3E,OAAO,EAAE,KAAK,kBAAkB,EAAyB,MAAM,eAAe,CAAC;AAE/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAU9C,KAAK,iBAAiB,GAAG,IAAI,CAC5B,KAAK,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAClC,WAAW,GAAG,KAAK,GAAG,OAAO,CAC7B,CAAC;AAEF,MAAM,WAAW,eAChB,SAAQ,sBAAsB,EAC7B,iBAAiB,EACjB,UAAU;IACX;;OAEG;IACH,KAAK,EAAE,sBAAsB,CAAC,OAAO,CAAC,CAAC;IACvC,WAAW,CAAC,EAAE,sBAAsB,CAAC,aAAa,CAAC,CAAC;IACpD;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,IAAI,CAAC,EAAE,sBAAsB,CAAC,MAAM,CAAC,CAAC;IACtC,YAAY,CAAC,EAAE,sBAAsB,CAAC,cAAc,CAAC,CAAC;IACtD;;OAEG;IACH,KAAK,CAAC,EAAE,sBAAsB,CAAC,OAAO,CAAC,CAAC;IACxC;;;OAGG;IACH,QAAQ,CAAC,EAAE,sBAAsB,CAAC,UAAU,CAAC,CAAC;CAC9C;AAED,eAAO,MAAM,iBAAiB,0CAAiD,CAAC;AAEhF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,UAAU;YAAW,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BhD,CAAC"}
1
+ {"version":3,"file":"OptionList.d.ts","sourceRoot":"","sources":["../../../lib/components/OptionList/OptionList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAoB,KAAK,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAC3E,OAAO,EAAE,KAAK,kBAAkB,EAAyB,MAAM,eAAe,CAAC;AAE/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAU9C,KAAK,iBAAiB,GAAG,IAAI,CAC5B,KAAK,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAClC,WAAW,GAAG,KAAK,GAAG,OAAO,CAC7B,CAAC;AAEF,MAAM,WAAW,eAChB,SAAQ,sBAAsB,EAC7B,iBAAiB,EACjB,UAAU;IACX;;OAEG;IACH,KAAK,EAAE,sBAAsB,CAAC,OAAO,CAAC,CAAC;IACvC,WAAW,CAAC,EAAE,sBAAsB,CAAC,aAAa,CAAC,CAAC;IACpD;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,IAAI,CAAC,EAAE,sBAAsB,CAAC,MAAM,CAAC,CAAC;IACtC,YAAY,CAAC,EAAE,sBAAsB,CAAC,cAAc,CAAC,CAAC;IACtD;;OAEG;IACH,KAAK,CAAC,EAAE,sBAAsB,CAAC,OAAO,CAAC,CAAC;IACxC;;;OAGG;IACH,QAAQ,CAAC,EAAE,sBAAsB,CAAC,UAAU,CAAC,CAAC;CAC9C;AAED,eAAO,MAAM,iBAAiB,0CAAiD,CAAC;AAEhF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,UAAU;YAAW,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BhD,CAAC"}
@@ -11,7 +11,7 @@ import { dataAttrs } from "../../utils/dataAttrs.js";
11
11
  import { Icon } from "../Icon/index.js";
12
12
  import { VisuallyHidden } from "../VisuallyHidden/index.js";
13
13
  import { OptionListContext } from "./OptionList.js";
14
- import { checkbox, itemLabelStyle, styledOptionItem } from "./OptionList.css.js";
14
+ import { checkbox, itemLabelStyle, optionItemStyle } from "./OptionList.css.js";
15
15
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
16
16
  /**
17
17
  * The OptionListItem is used to populate OptionList. They are outlined with a large interactive area and flexible
@@ -29,7 +29,7 @@ export const OptionListItem = props => {
29
29
  focusProps
30
30
  } = useFocusRing();
31
31
  return /*#__PURE__*/_jsxs("label", _objectSpread(_objectSpread({
32
- className: styledOptionItem()
32
+ className: optionItemStyle
33
33
  }, dataAttrs({
34
34
  'focus-visible': isFocusVisible
35
35
  })), {}, {
@@ -44,7 +44,7 @@ export const OptionListItem = props => {
44
44
  width: 'full'
45
45
  }),
46
46
  children: [/*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
47
- className: checkbox()
47
+ className: checkbox
48
48
  }, dataAttrs({
49
49
  checked: isSelected
50
50
  })), {}, {
@@ -1,16 +1,11 @@
1
- export declare const styledSearchBar: import("@vanilla-extract/recipes").RuntimeFn<{
2
- [x: string]: {
3
- [x: string]: string | import("@vanilla-extract/css").ComplexStyleRule;
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
- export declare const styledInput: import("@vanilla-extract/recipes").RuntimeFn<{
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":"AA2BA,eAAO,MAAM,eAAe;;;;EAkC1B,CAAC;AAEH,eAAO,MAAM,WAAW;;;;EAetB,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;EAgB5B,CAAC;AAEH,eAAO,MAAM,YAAY,QAIvB,CAAC"}
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/base/tokens.js";
10
- import { interactionStyle } from "../../utils/css.js";
10
+ import { overdriveTokens as tokens } from "../../themes/theme.css.js";
11
11
  const hideWebkitAppearance = style({
12
- selectors: {
13
- '&::-webkit-search-cancel-button, &::-webkit-search-decoration': {
14
- appearance: 'none'
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
- selectors: {
20
- '&::placeholder': {
21
- color: tokens.colours.gamut.gray400
22
- },
23
- '&:disabled::placeholder': {
24
- color: tokens.colours.gamut.gray300
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 styledSearchBar = recipe({
29
- base: [{
30
- alignItems: 'center',
31
- backgroundColor: tokens.colours.background.body,
32
- borderColor: tokens.border.colours.gray,
33
- borderRadius: tokens.border.radius['md'],
34
- borderStyle: 'solid',
35
- borderWidth: tokens.border.width[2],
36
- color: tokens.colours.gamut.gray400,
37
- display: 'flex',
38
- gap: tokens.space[2],
39
- padding: `0 ${tokens.space[4]}`
40
- }, interactionStyle({
41
- focus: {
42
- borderColor: tokens.border.colours.dark,
43
- color: tokens.colours.gamut.gray900
44
- },
45
- disabled: {
46
- borderColor: tokens.border.colours.light,
47
- cursor: 'not-allowed',
48
- color: tokens.colours.gamut.gray300
49
- },
50
- hover: {
51
- cursor: 'text'
52
- },
53
- hoverNotFocus: {
54
- backgroundColor: tokens.border.colours.light,
55
- borderColor: tokens.border.colours.light
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
- }), focusOutlineStyle]
58
- }, "styledSearchBar");
59
- export const styledInput = recipe({
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
- padding: 0,
80
- position: 'relative'
81
- }, sprinkles({
89
+ opacity: '1',
90
+ p: 'none',
91
+ pointerEvents: 'auto',
92
+ position: 'relative',
82
93
  size: '6'
83
- })]
84
- }, "styledClearButton");
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
- alignItems: 'center',
87
- display: 'flex',
88
- flexGrow: 1
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;AAGpB,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,sBAiEvD,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, styledClearButton, styledInput, styledSearchBar } from "./SearchBar.css.js";
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
- if (state.value === '') return null;
69
+ var _componentProps$lang$, _componentProps$lang;
70
+ const hasValue = state.value !== '';
69
71
  return /*#__PURE__*/_jsx(ReactAriaButton, _objectSpread(_objectSpread({
70
- className: styledClearButton({})
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: styledSearchBar({}),
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("div", {
92
- children: /*#__PURE__*/_jsx(Icon, {
93
- icon: MagnifyIcon,
94
- size: "large"
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: styledInput({}),
106
+ className: inputStyle,
100
107
  ref: mergeRefs([refInput, refForwarded])
101
108
  })), /*#__PURE__*/_jsx(ClearButton, {})]
102
109
  })]
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=useMedia.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMedia.spec.d.ts","sourceRoot":"","sources":["../../../lib/hooks/useMedia/useMedia.spec.ts"],"names":[],"mappings":""}