@autoguru/overdrive 4.35.2 → 4.37.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 (108) hide show
  1. package/dist/components/AutoSuggest/AutoSuggest.d.ts.map +1 -1
  2. package/dist/components/AutoSuggest/AutoSuggest.js +1 -1
  3. package/dist/components/AutoSuggest/useLayoutSuggestionVisible.d.ts +1 -1
  4. package/dist/components/AutoSuggest/useLayoutSuggestionVisible.d.ts.map +1 -1
  5. package/dist/components/Badge/Badge.d.ts +4 -3
  6. package/dist/components/Badge/Badge.d.ts.map +1 -1
  7. package/dist/components/Badge/Badge.js +14 -6
  8. package/dist/components/Box/Box.d.ts +1 -1
  9. package/dist/components/Box/Box.d.ts.map +1 -1
  10. package/dist/components/Box/Box.js +5 -3
  11. package/dist/components/Box/index.d.ts +1 -1
  12. package/dist/components/Box/index.d.ts.map +1 -1
  13. package/dist/components/Box/useBoxStyles.d.ts +4 -3
  14. package/dist/components/Box/useBoxStyles.d.ts.map +1 -1
  15. package/dist/components/Box/useBoxStyles.js +2 -1
  16. package/dist/components/Button/Button.d.ts +2 -2
  17. package/dist/components/Button/Button.d.ts.map +1 -1
  18. package/dist/components/Button/Button.js +25 -20
  19. package/dist/components/FillHeightBox/FillHeightBox.d.ts.map +1 -1
  20. package/dist/components/Heading/Heading.d.ts +5 -8
  21. package/dist/components/Heading/Heading.d.ts.map +1 -1
  22. package/dist/components/Heading/Heading.js +12 -6
  23. package/dist/components/HorizontalAutoScroller/useHorizontalAutoScroller.d.ts.map +1 -1
  24. package/dist/components/HorizontalAutoScroller/useHorizontalAutoScroller.js +3 -3
  25. package/dist/components/Icon/Icon.d.ts +2 -1
  26. package/dist/components/Icon/Icon.d.ts.map +1 -1
  27. package/dist/components/Icon/Icon.js +6 -4
  28. package/dist/components/Icon/index.d.ts +1 -1
  29. package/dist/components/Icon/index.d.ts.map +1 -1
  30. package/dist/components/Inline/Inline.d.ts.map +1 -1
  31. package/dist/components/OptionGrid/OptionGrid.css.d.ts +31 -0
  32. package/dist/components/OptionGrid/OptionGrid.css.d.ts.map +1 -0
  33. package/dist/components/OptionGrid/OptionGrid.css.js +192 -0
  34. package/dist/components/OptionGrid/OptionGrid.d.ts +22 -0
  35. package/dist/components/OptionGrid/OptionGrid.d.ts.map +1 -0
  36. package/dist/components/OptionGrid/OptionGrid.js +101 -0
  37. package/dist/components/OptionList/OptionList.css.d.ts +14 -0
  38. package/dist/components/OptionList/OptionList.css.d.ts.map +1 -0
  39. package/dist/components/OptionList/OptionList.css.js +111 -0
  40. package/dist/components/OptionList/OptionList.d.ts +54 -0
  41. package/dist/components/OptionList/OptionList.d.ts.map +1 -0
  42. package/dist/components/OptionList/OptionList.js +53 -0
  43. package/dist/components/OptionList/OptionListItem.d.ts +17 -0
  44. package/dist/components/OptionList/OptionListItem.d.ts.map +1 -0
  45. package/dist/components/OptionList/OptionListItem.js +79 -0
  46. package/dist/components/OutsideClick/OutsideClick.d.ts +1 -1
  47. package/dist/components/OutsideClick/OutsideClick.d.ts.map +1 -1
  48. package/dist/components/Positioner/Positioner.d.ts +1 -1
  49. package/dist/components/Positioner/Positioner.d.ts.map +1 -1
  50. package/dist/components/SearchBar/SearchBar.css.d.ts +16 -0
  51. package/dist/components/SearchBar/SearchBar.css.d.ts.map +1 -0
  52. package/dist/components/SearchBar/SearchBar.css.js +90 -0
  53. package/dist/components/SearchBar/SearchBar.d.ts +17 -0
  54. package/dist/components/SearchBar/SearchBar.d.ts.map +1 -0
  55. package/dist/components/SearchBar/SearchBar.js +96 -0
  56. package/dist/components/StarRating/StarRating.d.ts.map +1 -1
  57. package/dist/components/StarRating/StarRating.js +1 -0
  58. package/dist/components/Switch/Switch.d.ts.map +1 -1
  59. package/dist/components/Switch/Switch.js +2 -1
  60. package/dist/components/Text/Text.d.ts +1 -2
  61. package/dist/components/Text/Text.d.ts.map +1 -1
  62. package/dist/components/Text/Text.js +11 -5
  63. package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
  64. package/dist/components/Tooltip/Tooltip.js +1 -1
  65. package/dist/components/VisuallyHidden/VisuallyHidden.css.d.ts +1 -1
  66. package/dist/components/VisuallyHidden/VisuallyHidden.css.d.ts.map +1 -1
  67. package/dist/components/VisuallyHidden/VisuallyHidden.css.js +8 -2
  68. package/dist/components/VisuallyHidden/VisuallyHidden.d.ts +4 -7
  69. package/dist/components/VisuallyHidden/VisuallyHidden.d.ts.map +1 -1
  70. package/dist/components/VisuallyHidden/VisuallyHidden.js +12 -11
  71. package/dist/hooks/useAnimationEvents/useAnimationEvents.js +1 -1
  72. package/dist/stories/helpers/index.d.ts +12 -9
  73. package/dist/stories/helpers/index.d.ts.map +1 -1
  74. package/dist/stories/helpers/styles.css.d.ts +1 -0
  75. package/dist/stories/helpers/styles.css.d.ts.map +1 -1
  76. package/dist/styles/focusOutline.css.d.ts +3 -0
  77. package/dist/styles/focusOutline.css.d.ts.map +1 -0
  78. package/dist/styles/focusOutline.css.js +17 -0
  79. package/dist/styles/sprinkles.css.d.ts +320 -21
  80. package/dist/styles/sprinkles.css.d.ts.map +1 -1
  81. package/dist/styles/sprinkles.css.js +147 -8
  82. package/dist/styles/stack.css.d.ts.map +1 -1
  83. package/dist/styles/stack.css.js +7 -7
  84. package/dist/themes/base/index.d.ts +4 -2
  85. package/dist/themes/base/index.d.ts.map +1 -1
  86. package/dist/themes/base/tokens.d.ts.map +1 -1
  87. package/dist/themes/base/tokens.js +5 -3
  88. package/dist/themes/flat_red/index.d.ts +4 -2
  89. package/dist/themes/flat_red/index.d.ts.map +1 -1
  90. package/dist/themes/neutral/index.d.ts +4 -2
  91. package/dist/themes/neutral/index.d.ts.map +1 -1
  92. package/dist/themes/neutral/tokens.d.ts.map +1 -1
  93. package/dist/themes/neutral/tokens.js +5 -3
  94. package/dist/themes/theme.css.d.ts +4 -2
  95. package/dist/themes/theme.css.d.ts.map +1 -1
  96. package/dist/themes/theme.css.js +5 -3
  97. package/dist/themes/tokens.d.ts +3 -1
  98. package/dist/themes/tokens.d.ts.map +1 -1
  99. package/dist/types/index.d.ts +5 -0
  100. package/dist/types/index.d.ts.map +1 -0
  101. package/dist/types/index.js +3 -0
  102. package/dist/utils/dataAttrs.d.ts +7 -0
  103. package/dist/utils/dataAttrs.d.ts.map +1 -0
  104. package/dist/utils/dataAttrs.js +11 -0
  105. package/dist/utils/index.d.ts +2 -1
  106. package/dist/utils/index.d.ts.map +1 -1
  107. package/dist/utils/index.js +11 -0
  108. package/package.json +53 -45
@@ -0,0 +1,192 @@
1
+ "use strict";
2
+
3
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
4
+ import * as __vanilla_filescope__ from '@vanilla-extract/css/fileScope';
5
+ __vanilla_filescope__.setFileScope("lib/components/OptionGrid/OptionGrid.css.ts", "@autoguru/overdrive");
6
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
7
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
8
+ import { style } from '@vanilla-extract/css';
9
+ import { recipe } from '@vanilla-extract/recipes';
10
+ import { focusOutline } from "../../styles/focusOutline.css.js";
11
+ import { odStyle } from "../../styles/sprinkles.css.js";
12
+ import { tokens } from "../../themes/base/tokens.js";
13
+ export const styledGridContainer = recipe({
14
+ base: odStyle({
15
+ display: {
16
+ mobile: 'flex'
17
+ },
18
+ flexDirection: {
19
+ mobile: 'column'
20
+ },
21
+ gap: '3'
22
+ }),
23
+ variants: {
24
+ columns: {
25
+ '1': {},
26
+ '2': odStyle({
27
+ display: {
28
+ tablet: 'grid'
29
+ },
30
+ gridColumns: {
31
+ tablet: '2'
32
+ }
33
+ }),
34
+ '3': odStyle({
35
+ display: {
36
+ tablet: 'grid'
37
+ },
38
+ gridColumns: {
39
+ tablet: '2',
40
+ desktop: '3'
41
+ }
42
+ }),
43
+ '4': odStyle({
44
+ display: {
45
+ tablet: 'grid'
46
+ },
47
+ gridColumns: {
48
+ tablet: '3',
49
+ desktop: '4'
50
+ }
51
+ }),
52
+ '5': odStyle({
53
+ display: {
54
+ tablet: 'grid'
55
+ },
56
+ gridColumns: {
57
+ tablet: '3',
58
+ desktop: '5'
59
+ }
60
+ })
61
+ }
62
+ },
63
+ defaultVariants: {
64
+ columns: '2'
65
+ }
66
+ }, "styledGridContainer");
67
+ const optionTransition = style({
68
+ transition: 'background 80ms ease-in'
69
+ }, "optionTransition");
70
+ const pseudoThickBorder = style({
71
+ selectors: {
72
+ '&[data-selected]:after': {
73
+ outlineColor: tokens.colours.gamut.black900,
74
+ outlineStyle: 'solid',
75
+ outlineWidth: tokens.border.width[2],
76
+ borderRadius: 'inherit',
77
+ content: '',
78
+ display: 'block',
79
+ position: 'absolute',
80
+ width: '100%',
81
+ height: '100%',
82
+ left: 0,
83
+ top: 0
84
+ }
85
+ }
86
+ }, "pseudoThickBorder");
87
+ export const styledGridItem = recipe({
88
+ base: [{
89
+ minHeight: '80px',
90
+ userSelect: 'none'
91
+ }, odStyle(_objectSpread(_objectSpread({
92
+ alignItems: 'center',
93
+ background: {
94
+ initial: 'white',
95
+ focusVisible: 'gray200',
96
+ hover: 'gray200',
97
+ selected: 'white'
98
+ },
99
+ borderColor: {
100
+ initial: 'gray',
101
+ focusVisible: 'light',
102
+ hover: 'light',
103
+ selected: 'dark'
104
+ },
105
+ borderRadius: '2',
106
+ borderStyle: 'solid',
107
+ borderWidth: '1',
108
+ cursor: {
109
+ hover: 'pointer'
110
+ },
111
+ display: 'flex'
112
+ }, focusOutline), {}, {
113
+ gap: '2',
114
+ paddingX: '4',
115
+ paddingY: '3',
116
+ position: 'relative'
117
+ })), optionTransition, pseudoThickBorder]
118
+ }, "styledGridItem");
119
+ export const styleIndicator = style({
120
+ height: '26px',
121
+ width: '26px'
122
+ }, "styleIndicator");
123
+ export const styledCheckbox = recipe({
124
+ base: [odStyle({
125
+ alignItems: 'center',
126
+ background: {
127
+ initial: 'white',
128
+ focusVisible: 'gray300',
129
+ hover: 'gray300',
130
+ selected: 'gray900'
131
+ },
132
+ borderColor: {
133
+ initial: 'gray',
134
+ selected: 'dark'
135
+ },
136
+ borderRadius: '1',
137
+ borderStyle: 'solid',
138
+ borderWidth: '1',
139
+ color: {
140
+ initial: 'transparent',
141
+ focusVisible: 'white',
142
+ hover: 'white',
143
+ selected: 'white'
144
+ },
145
+ display: 'flex',
146
+ flexShrink: 0,
147
+ justifyContent: 'center',
148
+ size: '6'
149
+ }), optionTransition]
150
+ }, "styledCheckbox");
151
+ const pseudoRadio = style({
152
+ selectors: {
153
+ '&:after': {
154
+ borderRadius: 'inherit',
155
+ content: '',
156
+ display: 'block',
157
+ position: 'absolute',
158
+ transform: 'scale(0.475)',
159
+ width: '100%',
160
+ height: '100%',
161
+ left: 0,
162
+ top: 0
163
+ },
164
+ '&[data-hover]:after, &[data-focus-visible]:after': {
165
+ background: tokens.colours.gamut.gray200
166
+ },
167
+ '&[data-selected]:after': {
168
+ background: tokens.colours.gamut.white
169
+ }
170
+ }
171
+ }, "pseudoRadio");
172
+ export const styledRadioButton = recipe({
173
+ base: [odStyle({
174
+ alignItems: 'center',
175
+ background: {
176
+ initial: 'white',
177
+ hover: 'gray300',
178
+ focusVisible: 'gray300',
179
+ selected: 'gray900'
180
+ },
181
+ borderColor: {
182
+ initial: 'gray',
183
+ selected: 'dark'
184
+ },
185
+ borderRadius: 'full',
186
+ borderStyle: 'solid',
187
+ borderWidth: '1',
188
+ position: 'relative',
189
+ size: '6'
190
+ }), pseudoRadio, optionTransition]
191
+ }, "styledRadioButton");
192
+ __vanilla_filescope__.endFileScope();
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import { type ListBoxProps } from 'react-aria-components';
3
+ import { type SelectionMode } from 'react-stately';
4
+ import type { WithTestId } from '../../types';
5
+ import { type IconEl } from '../Icon';
6
+ import { type StyledGridContainerProps } from './OptionGrid.css';
7
+ export interface OptionItem {
8
+ name: string;
9
+ label: string;
10
+ value?: string;
11
+ icon?: IconEl;
12
+ description?: string;
13
+ }
14
+ export interface OptionGridProps<T> extends Omit<ListBoxProps<T>, 'items'> {
15
+ label: string;
16
+ items: OptionItem[];
17
+ indicator?: 'none' | 'checkbox' | 'radio';
18
+ selectionMode?: SelectionMode;
19
+ columns?: StyledGridContainerProps['columns'];
20
+ }
21
+ export declare const OptionGrid: ({ className, columns, indicator, label, layout, selectionMode, testId, ...props }: WithTestId<OptionGridProps<OptionItem>>) => React.JSX.Element;
22
+ //# sourceMappingURL=OptionGrid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OptionGrid.d.ts","sourceRoot":"","sources":["../../../lib/components/OptionGrid/OptionGrid.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAIN,KAAK,YAAY,EACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAGnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,EAMN,KAAK,wBAAwB,EAC7B,MAAM,kBAAkB,CAAC;AAE1B,MAAM,WAAW,UAAU;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IAIf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AACD,MAAM,WAAW,eAAe,CAAC,CAAC,CAAE,SAAQ,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC;IAIzE,KAAK,EAAE,MAAM,CAAC;IAId,KAAK,EAAE,UAAU,EAAE,CAAC;IAIpB,SAAS,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC;IAI1C,aAAa,CAAC,EAAE,aAAa,CAAC;IAI9B,OAAO,CAAC,EAAE,wBAAwB,CAAC,SAAS,CAAC,CAAC;CAC9C;AAgBD,eAAO,MAAM,UAAU,sFASpB,WAAW,gBAAgB,UAAU,CAAC,CAAC,sBA+EzC,CAAC"}
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+
3
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
4
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
+ const _excluded = ["className", "columns", "indicator", "label", "layout", "selectionMode", "testId"];
6
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
7
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
8
+ import { CheckIcon } from '@autoguru/icons';
9
+ import clsx from 'clsx';
10
+ import React from 'react';
11
+ import { ListBox, ListBoxItem, Text } from 'react-aria-components';
12
+ import { odStyle } from "../../styles/sprinkles.css.js";
13
+ import { dataAttrs } from "../../utils/dataAttrs.js";
14
+ import { Icon } from "../Icon/index.js";
15
+ import { styledCheckbox, styledGridContainer, styledGridItem, styledRadioButton, styleIndicator } from "./OptionGrid.css.js";
16
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
17
+ export const OptionGrid = _ref => {
18
+ let {
19
+ className,
20
+ columns,
21
+ indicator = 'checkbox',
22
+ label,
23
+ layout = 'grid',
24
+ selectionMode = 'multiple',
25
+ testId
26
+ } = _ref,
27
+ props = _objectWithoutProperties(_ref, _excluded);
28
+ return _jsx(ListBox, _objectSpread(_objectSpread(_objectSpread({
29
+ "aria-label": label,
30
+ layout: layout,
31
+ selectionMode: selectionMode,
32
+ className: clsx([styledGridContainer({
33
+ columns
34
+ }), className])
35
+ }, dataAttrs({
36
+ 'test-id': testId
37
+ })), props), {}, {
38
+ children: _ref2 => {
39
+ let {
40
+ description,
41
+ icon,
42
+ label,
43
+ name
44
+ } = _ref2;
45
+ return _jsx(ListBoxItem, {
46
+ className: styledGridItem(),
47
+ id: name,
48
+ textValue: label,
49
+ children: _ref3 => {
50
+ let {
51
+ isFocusVisible,
52
+ isHovered,
53
+ isSelected
54
+ } = _ref3;
55
+ const hasIndicator = indicator !== 'none';
56
+ const hasNoInteraction = !isFocusVisible && !isHovered && !isSelected;
57
+ const IndicatorIcon = () => {
58
+ if (icon && hasNoInteraction) return _jsx(Icon, {
59
+ icon: icon,
60
+ size: "100%"
61
+ });
62
+ const styledIndicator = indicator === 'radio' ? styledRadioButton : styledCheckbox;
63
+ return _jsx("div", _objectSpread(_objectSpread({
64
+ className: styledIndicator()
65
+ }, dataAttrs({
66
+ 'focus-visible': isFocusVisible,
67
+ hover: isHovered,
68
+ selected: isSelected
69
+ })), {}, {
70
+ children: indicator === 'checkbox' && _jsx(Icon, {
71
+ icon: CheckIcon
72
+ })
73
+ }));
74
+ };
75
+ return _jsxs(_Fragment, {
76
+ children: [hasIndicator && _jsx("div", {
77
+ className: styleIndicator,
78
+ children: _jsx(IndicatorIcon, {})
79
+ }), _jsxs("div", {
80
+ children: [_jsx(Text, {
81
+ slot: "label",
82
+ elementType: "div",
83
+ className: odStyle({
84
+ fontSize: 'md'
85
+ }),
86
+ children: label
87
+ }), description && _jsx(Text, {
88
+ slot: "description",
89
+ elementType: "div",
90
+ className: odStyle({
91
+ fontSize: 'xs'
92
+ }),
93
+ children: description
94
+ })]
95
+ })]
96
+ });
97
+ }
98
+ });
99
+ }
100
+ }));
101
+ };
@@ -0,0 +1,14 @@
1
+ export declare const styleGroup: string;
2
+ export declare const styleGroupLabel: string;
3
+ export declare const styleDescription: string;
4
+ export declare const styledOptionItem: import("@vanilla-extract/recipes").RuntimeFn<{
5
+ [x: string]: {
6
+ [x: string]: string | import("@vanilla-extract/css").ComplexStyleRule;
7
+ };
8
+ }>;
9
+ export declare const checkbox: import("@vanilla-extract/recipes").RuntimeFn<{
10
+ [x: string]: {
11
+ [x: string]: string | import("@vanilla-extract/css").ComplexStyleRule;
12
+ };
13
+ }>;
14
+ //# sourceMappingURL=OptionList.css.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OptionList.css.d.ts","sourceRoot":"","sources":["../../../lib/components/OptionList/OptionList.css.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,UAAU,QAA8B,CAAC;AAEtD,eAAO,MAAM,eAAe,QAI1B,CAAC;AAEH,eAAO,MAAM,gBAAgB,QAG3B,CAAC;AAoBH,eAAO,MAAM,gBAAgB;;;;EA4B3B,CAAC;AAoBH,eAAO,MAAM,QAAQ;;;;EAmBnB,CAAC"}
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+
3
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
4
+ import * as __vanilla_filescope__ from '@vanilla-extract/css/fileScope';
5
+ __vanilla_filescope__.setFileScope("lib/components/OptionList/OptionList.css.ts", "@autoguru/overdrive");
6
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
7
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
8
+ import { style } from '@vanilla-extract/css';
9
+ import { recipe } from '@vanilla-extract/recipes';
10
+ import { tokens } from 'lib/themes/base/tokens';
11
+ import { focusOutline } from "../../styles/focusOutline.css.js";
12
+ import { odStyle } from "../../styles/sprinkles.css.js";
13
+ export const styleGroup = odStyle({
14
+ marginTop: '6'
15
+ });
16
+ export const styleGroupLabel = odStyle({
17
+ font: 'xxl',
18
+ fontWeight: 'bold',
19
+ marginBottom: '3'
20
+ });
21
+ export const styleDescription = odStyle({
22
+ color: 'gray400',
23
+ font: 'md'
24
+ });
25
+ const buttonBorderRadius = tokens.border.radius['2'];
26
+ const optionBorders = style({
27
+ selectors: {
28
+ ['&+&']: {
29
+ borderTopStyle: 'none'
30
+ },
31
+ ['&:first-child']: {
32
+ borderTopLeftRadius: buttonBorderRadius,
33
+ borderTopRightRadius: buttonBorderRadius
34
+ },
35
+ ['&:last-child']: {
36
+ borderBottomLeftRadius: buttonBorderRadius,
37
+ borderBottomRightRadius: buttonBorderRadius
38
+ }
39
+ }
40
+ }, "optionBorders");
41
+ export const styledOptionItem = recipe({
42
+ base: [{
43
+ userSelect: 'none'
44
+ }, odStyle({
45
+ background: {
46
+ initial: 'white',
47
+ hover: 'gray200',
48
+ focusVisible: 'gray200',
49
+ disabled: 'white'
50
+ },
51
+ borderColor: 'gray',
52
+ borderStyle: 'solid',
53
+ borderWidth: '1',
54
+ cursor: {
55
+ hover: 'pointer',
56
+ disabled: 'default'
57
+ },
58
+ display: 'flex',
59
+ gap: '2',
60
+ outlineColor: 'link',
61
+ outlineStyle: 'solid',
62
+ outlineOffset: 'md',
63
+ outlineWidth: {
64
+ initial: 'none',
65
+ focusVisible: 'default'
66
+ },
67
+ paddingX: '4',
68
+ paddingY: '3',
69
+ width: '100%'
70
+ }), optionBorders]
71
+ }, "styledOptionItem");
72
+ const checkboxHovered = style({
73
+ selectors: {
74
+ [`${styledOptionItem.classNames.base}:hover &:not([data-checked]):not([data-disabled])`]: {
75
+ color: tokens.colours.background.body,
76
+ background: tokens.colours.gamut.gray300,
77
+ transitionDuration: '15ms'
78
+ }
79
+ }
80
+ }, "checkboxHovered");
81
+ const checkboxTransition = style({
82
+ transitionProperty: 'background',
83
+ transitionTimingFunction: 'ease-in',
84
+ transitionDuration: '80ms'
85
+ }, "checkboxTransition");
86
+ export const checkbox = recipe({
87
+ base: [odStyle(_objectSpread(_objectSpread({
88
+ alignItems: 'center',
89
+ background: {
90
+ initial: 'white',
91
+ checked: 'gray900'
92
+ },
93
+ borderColor: {
94
+ initial: 'gray',
95
+ checked: 'dark'
96
+ },
97
+ borderStyle: 'solid',
98
+ borderRadius: '1',
99
+ borderWidth: '1',
100
+ color: {
101
+ initial: 'transparent',
102
+ checked: 'white'
103
+ },
104
+ display: 'flex',
105
+ flexShrink: 0,
106
+ justifyContent: 'center'
107
+ }, focusOutline), {}, {
108
+ size: '6'
109
+ })), checkboxTransition, checkboxHovered]
110
+ }, "checkbox");
111
+ __vanilla_filescope__.endFileScope();
@@ -0,0 +1,54 @@
1
+ import React from 'react';
2
+ import { type AriaCheckboxGroupProps } from 'react-aria';
3
+ import { type CheckboxGroupState } from 'react-stately';
4
+ import type { WithTestId } from '../../types';
5
+ type ElementAttributes = Pick<React.ComponentPropsWithRef<'div'>, 'className' | 'ref' | 'style'>;
6
+ export interface OptionListProps extends AriaCheckboxGroupProps, ElementAttributes {
7
+ label: AriaCheckboxGroupProps['label'];
8
+ description?: AriaCheckboxGroupProps['description'];
9
+ children?: React.ReactNode;
10
+ name?: AriaCheckboxGroupProps['name'];
11
+ defaultValue?: AriaCheckboxGroupProps['defaultValue'];
12
+ value?: AriaCheckboxGroupProps['value'];
13
+ onChange?: AriaCheckboxGroupProps['onChange'];
14
+ }
15
+ export declare const OptionListContext: React.Context<CheckboxGroupState | null>;
16
+ export declare const OptionList: {
17
+ (props: WithTestId<OptionListProps>): React.JSX.Element;
18
+ Item: {
19
+ (props: {
20
+ value: string;
21
+ id?: string | undefined;
22
+ name?: string | undefined;
23
+ children?: React.ReactNode;
24
+ autoFocus?: boolean | undefined;
25
+ 'aria-controls'?: string | undefined;
26
+ 'aria-describedby'?: string | undefined;
27
+ 'aria-details'?: string | undefined;
28
+ 'aria-errormessage'?: string | undefined;
29
+ 'aria-label'?: string | undefined;
30
+ 'aria-labelledby'?: string | undefined;
31
+ onFocus?: ((e: React.FocusEvent<Element, Element>) => void) | undefined;
32
+ onBlur?: ((e: React.FocusEvent<Element, Element>) => void) | undefined;
33
+ onChange?: ((isSelected: boolean) => void) | undefined;
34
+ onKeyDown?: ((e: import("@react-types/shared").KeyboardEvent) => void) | undefined;
35
+ onKeyUp?: ((e: import("@react-types/shared").KeyboardEvent) => void) | undefined;
36
+ isDisabled?: boolean | undefined;
37
+ isReadOnly?: boolean | undefined;
38
+ onFocusChange?: ((isFocused: boolean) => void) | undefined;
39
+ excludeFromTabOrder?: boolean | undefined;
40
+ isRequired?: boolean | undefined;
41
+ isInvalid?: boolean | undefined;
42
+ validationState?: import("react-stately").ValidationState | undefined;
43
+ validationBehavior?: "aria" | "native" | undefined;
44
+ validate?: ((value: boolean) => true | import("@react-types/shared").ValidationError | null | undefined) | undefined;
45
+ }): React.JSX.Element;
46
+ displayName: string;
47
+ };
48
+ ItemSplitLabel: {
49
+ ({ children, content }: import("./OptionListItem").SplitLabelProps): React.JSX.Element | null;
50
+ displayName: string;
51
+ };
52
+ };
53
+ export {};
54
+ //# sourceMappingURL=OptionList.d.ts.map
@@ -0,0 +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;IAIlB,KAAK,EAAE,sBAAsB,CAAC,OAAO,CAAC,CAAC;IACvC,WAAW,CAAC,EAAE,sBAAsB,CAAC,aAAa,CAAC,CAAC;IAIpD,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;IAItD,KAAK,CAAC,EAAE,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAKxC,QAAQ,CAAC,EAAE,sBAAsB,CAAC,UAAU,CAAC,CAAC;CAC9C;AAED,eAAO,MAAM,iBAAiB,0CAAiD,CAAC;AAchF,eAAO,MAAM,UAAU;YAAW,WAAW,eAAe,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4B5D,CAAC"}
@@ -0,0 +1,53 @@
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 React, { createContext } from 'react';
7
+ import { useCheckboxGroup } from 'react-aria';
8
+ import { useCheckboxGroupState } from 'react-stately';
9
+ import { dataAttrs } from "../../utils/dataAttrs.js";
10
+ import { styleDescription, styleGroup, styleGroupLabel } from "./OptionList.css.js";
11
+ import { OptionListItem, ItemSplitLabel } from "./OptionListItem.js";
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ export const OptionListContext = createContext(null);
14
+ export const OptionList = props => {
15
+ const {
16
+ children,
17
+ className,
18
+ description,
19
+ label,
20
+ ref,
21
+ style
22
+ } = props;
23
+ const elementAttrs = {
24
+ ref,
25
+ className,
26
+ style
27
+ };
28
+ const state = useCheckboxGroupState(props);
29
+ const {
30
+ groupProps,
31
+ labelProps,
32
+ descriptionProps
33
+ } = useCheckboxGroup(props, state);
34
+ return _jsxs("div", _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, groupProps), elementAttrs), dataAttrs({
35
+ 'test-id': props.testId
36
+ })), {}, {
37
+ children: [_jsx("div", _objectSpread(_objectSpread({}, labelProps), {}, {
38
+ className: styleGroupLabel,
39
+ children: label
40
+ })), description && _jsx("div", _objectSpread(_objectSpread({}, descriptionProps), {}, {
41
+ className: styleDescription,
42
+ children: description
43
+ })), _jsx(OptionListContext.Provider, {
44
+ value: state,
45
+ children: _jsx("div", {
46
+ className: styleGroup,
47
+ children: children
48
+ })
49
+ })]
50
+ }));
51
+ };
52
+ OptionList.Item = OptionListItem;
53
+ OptionList.ItemSplitLabel = ItemSplitLabel;
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { type AriaCheckboxGroupItemProps } from 'react-aria';
3
+ type FilteredCheckboxProps = Omit<AriaCheckboxGroupItemProps, 'isIndeterminate'>;
4
+ export declare const OptionListItem: {
5
+ (props: FilteredCheckboxProps): React.JSX.Element;
6
+ displayName: string;
7
+ };
8
+ export interface SplitLabelProps {
9
+ children?: React.ReactNode;
10
+ content?: string[];
11
+ }
12
+ export declare const ItemSplitLabel: {
13
+ ({ children, content }: SplitLabelProps): React.JSX.Element | null;
14
+ displayName: string;
15
+ };
16
+ export {};
17
+ //# sourceMappingURL=OptionListItem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OptionListItem.d.ts","sourceRoot":"","sources":["../../../lib/components/OptionList/OptionListItem.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAClD,OAAO,EAIN,KAAK,0BAA0B,EAC/B,MAAM,YAAY,CAAC;AAUpB,KAAK,qBAAqB,GAAG,IAAI,CAChC,0BAA0B,EAC1B,iBAAiB,CACjB,CAAC;AAMF,eAAO,MAAM,cAAc;YAAW,qBAAqB;;CAuC1D,CAAC;AAIF,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAI3B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAKD,eAAO,MAAM,cAAc;4BAA2B,eAAe;;CAepE,CAAC"}
@@ -0,0 +1,79 @@
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 { CheckIcon } from '@autoguru/icons';
7
+ import React, { useContext, useRef } from 'react';
8
+ import { useCheckboxGroupItem, useFocusRing, mergeProps } from 'react-aria';
9
+ import { odStyle } from "../../styles/sprinkles.css.js";
10
+ import { dataAttrs } from "../../utils/dataAttrs.js";
11
+ import { Icon } from "../Icon/index.js";
12
+ import { VisuallyHidden } from "../VisuallyHidden/index.js";
13
+ import { OptionListContext } from "./OptionList.js";
14
+ import { checkbox, styledOptionItem } from "./OptionList.css.js";
15
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
16
+ export const OptionListItem = props => {
17
+ const ref = useRef(null);
18
+ const state = useContext(OptionListContext);
19
+ const {
20
+ inputProps,
21
+ isSelected
22
+ } = useCheckboxGroupItem(props, state, ref);
23
+ const {
24
+ isFocusVisible,
25
+ focusProps
26
+ } = useFocusRing();
27
+ return _jsxs("label", _objectSpread(_objectSpread({
28
+ className: styledOptionItem()
29
+ }, dataAttrs({
30
+ 'focus-visible': isFocusVisible
31
+ })), {}, {
32
+ children: [_jsx(VisuallyHidden, {
33
+ children: _jsx("input", _objectSpread(_objectSpread({}, mergeProps(inputProps, focusProps)), {}, {
34
+ ref: ref
35
+ }))
36
+ }), _jsxs("div", {
37
+ className: odStyle({
38
+ display: 'flex',
39
+ gap: '2',
40
+ width: '100%'
41
+ }),
42
+ children: [_jsx("div", _objectSpread(_objectSpread({
43
+ className: checkbox()
44
+ }, dataAttrs({
45
+ checked: isSelected
46
+ })), {}, {
47
+ children: _jsx(Icon, {
48
+ icon: CheckIcon
49
+ })
50
+ })), _jsx("div", {
51
+ className: odStyle({
52
+ alignSelf: 'center',
53
+ font: 'sm',
54
+ width: '100%'
55
+ }),
56
+ children: props.children
57
+ })]
58
+ })]
59
+ }));
60
+ };
61
+ OptionListItem.displayName = 'OptionList.Item';
62
+ export const ItemSplitLabel = _ref => {
63
+ let {
64
+ children,
65
+ content
66
+ } = _ref;
67
+ if (!children && !content) return null;
68
+ return _jsx("div", {
69
+ className: odStyle({
70
+ display: 'flex',
71
+ gap: '2',
72
+ justifyContent: 'space-between'
73
+ }),
74
+ children: children !== null && children !== void 0 ? children : content === null || content === void 0 ? void 0 : content.map((item, idx) => _jsx("span", {
75
+ children: item
76
+ }, idx))
77
+ });
78
+ };
79
+ ItemSplitLabel.displayName = 'OptionList.ItemSplitLabel';
@@ -1,5 +1,5 @@
1
1
  import { FunctionComponent, ReactElement, RefObject } from 'react';
2
- export declare const useOutsideClick: (refs: Array<RefObject<HTMLElement>>, onClickAway: () => void) => void;
2
+ export declare const useOutsideClick: (refs: Array<RefObject<HTMLElement | null>>, onClickAway: () => void) => void;
3
3
  export interface Props {
4
4
  children: ReactElement;
5
5
  onOutsideClick?(): void;