@autoguru/overdrive 4.45.2-next.0 → 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.
- package/dist/components/DateTimePicker/CalendarButton.js +2 -2
- package/dist/components/DateTimePicker/CalendarGrid.js +2 -2
- package/dist/components/DateTimePicker/DateTimePicker.css.d.ts +2 -10
- package/dist/components/DateTimePicker/DateTimePicker.css.d.ts.map +1 -1
- package/dist/components/DateTimePicker/DateTimePicker.css.js +108 -81
- 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 +7 -0
- package/dist/components/OptionList/OptionList.d.ts.map +1 -1
- package/dist/components/OptionList/OptionListItem.js +3 -3
- 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/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 +13 -0
- package/dist/styles/selectors.d.ts.map +1 -0
- package/dist/styles/selectors.js +26 -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/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 +8 -8
|
@@ -5,36 +5,46 @@ __vanilla_filescope__.setFileScope("lib/components/OptionGrid/OptionGrid.css.ts"
|
|
|
5
5
|
import { createContainer, 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";
|
|
9
|
+
import { selectors } from "../../styles/selectors.js";
|
|
8
10
|
import { sprinkles } from "../../styles/sprinkles.css.js";
|
|
9
11
|
import { breakpoints } from "../../themes/makeTheme.js";
|
|
10
|
-
import { overdriveTokens as tokens } from "../../themes/theme.css.js";
|
|
11
|
-
import { interactionStyle, notDisabled, notSelected } from "../../utils/css.js"; // === Container styles
|
|
12
|
+
import { overdriveTokens as tokens } from "../../themes/theme.css.js"; // === Container styles
|
|
12
13
|
export const gridContainer = createContainer("gridContainer");
|
|
13
14
|
export const gridContainerStyle = style({
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
'@layer': {
|
|
16
|
+
[cssLayerComponent]: {
|
|
17
|
+
containerName: gridContainer,
|
|
18
|
+
containerType: 'inline-size'
|
|
19
|
+
}
|
|
20
|
+
}
|
|
16
21
|
}, "gridContainerStyle");
|
|
17
22
|
|
|
18
|
-
//
|
|
23
|
+
// === Grid styles
|
|
24
|
+
|
|
19
25
|
const minWidth1200 = '(min-width: 1200px)';
|
|
20
26
|
const repeat2Col = 'repeat(2, 1fr)';
|
|
21
27
|
const repeat3Col = 'repeat(3, 1fr)';
|
|
22
28
|
const repeat4Col = 'repeat(4, 1fr)';
|
|
23
29
|
const repeat5Col = 'repeat(5, 1fr)';
|
|
24
30
|
const grid4ColStyle = style({
|
|
25
|
-
'@
|
|
26
|
-
[
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
'@layer': {
|
|
32
|
+
[cssLayerComponent]: {
|
|
33
|
+
'@container': {
|
|
34
|
+
[`${gridContainer} (min-width: ${breakpoints.mobile})`]: {
|
|
35
|
+
gridTemplateColumns: repeat2Col
|
|
36
|
+
},
|
|
37
|
+
[`${gridContainer} (min-width: ${breakpoints.tablet})`]: {
|
|
38
|
+
gridTemplateColumns: repeat3Col
|
|
39
|
+
},
|
|
40
|
+
[`${gridContainer} (min-width: ${breakpoints.desktop})`]: {
|
|
41
|
+
gridTemplateColumns: repeat4Col
|
|
42
|
+
}
|
|
43
|
+
}
|
|
34
44
|
}
|
|
35
45
|
}
|
|
36
46
|
}, "grid4ColStyle");
|
|
37
|
-
export const
|
|
47
|
+
export const gridVariants = recipe({
|
|
38
48
|
base: sprinkles({
|
|
39
49
|
display: 'grid',
|
|
40
50
|
gridColumns: {
|
|
@@ -46,30 +56,42 @@ export const styledGrid = recipe({
|
|
|
46
56
|
columns: {
|
|
47
57
|
'1': {},
|
|
48
58
|
'2': {
|
|
49
|
-
'@
|
|
50
|
-
[
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
59
|
+
'@layer': {
|
|
60
|
+
[cssLayerComponent]: {
|
|
61
|
+
'@container': {
|
|
62
|
+
[`${gridContainer} (min-width: 640px)`]: {
|
|
63
|
+
gridTemplateColumns: repeat2Col
|
|
64
|
+
},
|
|
65
|
+
[`${gridContainer} ${minWidth1200}`]: {
|
|
66
|
+
gridTemplateColumns: repeat3Col
|
|
67
|
+
}
|
|
68
|
+
}
|
|
55
69
|
}
|
|
56
70
|
}
|
|
57
71
|
},
|
|
58
72
|
'3': {
|
|
59
|
-
'@
|
|
60
|
-
[
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
73
|
+
'@layer': {
|
|
74
|
+
[cssLayerComponent]: {
|
|
75
|
+
'@container': {
|
|
76
|
+
[`${gridContainer} (min-width: 550px)`]: {
|
|
77
|
+
gridTemplateColumns: repeat2Col
|
|
78
|
+
},
|
|
79
|
+
[`${gridContainer} (min-width: ${breakpoints.desktop})`]: {
|
|
80
|
+
gridTemplateColumns: repeat3Col
|
|
81
|
+
}
|
|
82
|
+
}
|
|
65
83
|
}
|
|
66
84
|
}
|
|
67
85
|
},
|
|
68
86
|
'4': grid4ColStyle,
|
|
69
87
|
'5': [grid4ColStyle, {
|
|
70
|
-
'@
|
|
71
|
-
[
|
|
72
|
-
|
|
88
|
+
'@layer': {
|
|
89
|
+
[cssLayerComponent]: {
|
|
90
|
+
'@container': {
|
|
91
|
+
[`${gridContainer} ${minWidth1200}`]: {
|
|
92
|
+
gridTemplateColumns: repeat5Col
|
|
93
|
+
}
|
|
94
|
+
}
|
|
73
95
|
}
|
|
74
96
|
}
|
|
75
97
|
}]
|
|
@@ -78,139 +100,179 @@ export const styledGrid = recipe({
|
|
|
78
100
|
defaultVariants: {
|
|
79
101
|
columns: '2'
|
|
80
102
|
}
|
|
81
|
-
}, "
|
|
103
|
+
}, "gridVariants");
|
|
82
104
|
// === Option item styles
|
|
105
|
+
|
|
83
106
|
const optionTransition = style({
|
|
84
|
-
|
|
107
|
+
'@layer': {
|
|
108
|
+
[cssLayerComponent]: {
|
|
109
|
+
transition: 'background 100ms ease-in, border-color 100ms ease-in'
|
|
110
|
+
}
|
|
111
|
+
}
|
|
85
112
|
}, "optionTransition");
|
|
86
|
-
export const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}, interactionStyle({
|
|
101
|
-
hover: {
|
|
102
|
-
cursor: 'pointer'
|
|
103
|
-
},
|
|
104
|
-
selected: {
|
|
113
|
+
export const gridItemContainerStyle = style([sprinkles({
|
|
114
|
+
alignItems: 'center',
|
|
115
|
+
borderRadius: 'md',
|
|
116
|
+
borderStyle: 'solid',
|
|
117
|
+
borderWidth: '1',
|
|
118
|
+
display: 'flex',
|
|
119
|
+
gap: '2',
|
|
120
|
+
px: '4',
|
|
121
|
+
py: '3',
|
|
122
|
+
position: 'relative',
|
|
123
|
+
userSelect: 'none'
|
|
124
|
+
}), {
|
|
125
|
+
'@layer': {
|
|
126
|
+
[cssLayerComponent]: {
|
|
105
127
|
backgroundColor: tokens.colours.background.body,
|
|
106
|
-
borderColor: tokens.border.colours.
|
|
128
|
+
borderColor: tokens.border.colours.gray,
|
|
129
|
+
minHeight: '80px'
|
|
107
130
|
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
131
|
+
}
|
|
132
|
+
}], "gridItemContainerStyle");
|
|
133
|
+
export const gridItemStyle = style([gridItemContainerStyle, {
|
|
134
|
+
'@layer': {
|
|
135
|
+
[cssLayerComponent]: {
|
|
136
|
+
backgroundColor: tokens.colours.background.body,
|
|
137
|
+
borderColor: tokens.border.colours.gray,
|
|
138
|
+
minHeight: '80px',
|
|
139
|
+
selectors: {
|
|
140
|
+
[selectors.hover]: {
|
|
141
|
+
cursor: 'pointer'
|
|
142
|
+
},
|
|
143
|
+
[selectors.selected]: {
|
|
144
|
+
backgroundColor: tokens.colours.background.body,
|
|
145
|
+
borderColor: tokens.border.colours.dark
|
|
146
|
+
},
|
|
147
|
+
[`${selectors.hoverNotSelected}, ${selectors.focusVisibleNotSelected}`]: {
|
|
148
|
+
backgroundColor: tokens.border.colours.light,
|
|
149
|
+
borderColor: tokens.border.colours.light
|
|
150
|
+
},
|
|
151
|
+
[`&[data-selected]:after`]: {
|
|
152
|
+
borderRadius: 'inherit',
|
|
153
|
+
content: '',
|
|
154
|
+
display: 'block',
|
|
155
|
+
height: '100%',
|
|
156
|
+
left: 0,
|
|
157
|
+
outlineColor: tokens.colours.gamut.black900,
|
|
158
|
+
outlineStyle: 'solid',
|
|
159
|
+
outlineWidth: tokens.border.width[2],
|
|
160
|
+
position: 'absolute',
|
|
161
|
+
top: 0,
|
|
162
|
+
width: '100%'
|
|
163
|
+
},
|
|
164
|
+
[selectors.disabled]: {
|
|
165
|
+
backgroundColor: tokens.colours.gamut.gray100,
|
|
166
|
+
borderColor: 'transparent',
|
|
167
|
+
color: tokens.colours.gamut.black500,
|
|
168
|
+
cursor: 'not-allowed'
|
|
169
|
+
}
|
|
126
170
|
}
|
|
127
171
|
}
|
|
128
|
-
}
|
|
129
|
-
}, "
|
|
172
|
+
}
|
|
173
|
+
}, optionTransition, focusOutlineStyle], "gridItemStyle");
|
|
174
|
+
|
|
130
175
|
// === Indicator styles
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
borderColor: tokens.border.colours.gray,
|
|
138
|
-
borderRadius: tokens.border.radius['sm'],
|
|
139
|
-
borderStyle: 'solid',
|
|
140
|
-
borderWidth: tokens.border.width[1],
|
|
141
|
-
color: 'transparent'
|
|
142
|
-
}, interactionStyle({
|
|
143
|
-
selected: {
|
|
144
|
-
backgroundColor: tokens.colours.foreground.body,
|
|
145
|
-
color: tokens.colours.background.body
|
|
176
|
+
|
|
177
|
+
export const indicatorStyle = style({
|
|
178
|
+
'@layer': {
|
|
179
|
+
[cssLayerComponent]: {
|
|
180
|
+
height: '26px',
|
|
181
|
+
width: '26px'
|
|
146
182
|
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
183
|
+
}
|
|
184
|
+
}, "indicatorStyle");
|
|
185
|
+
export const checkboxStyle = style([sprinkles({
|
|
186
|
+
alignItems: 'center',
|
|
187
|
+
borderColour: 'gray',
|
|
188
|
+
borderRadius: 'sm',
|
|
189
|
+
borderStyle: 'solid',
|
|
190
|
+
borderWidth: '1',
|
|
191
|
+
display: 'flex',
|
|
192
|
+
flexShrink: '0',
|
|
193
|
+
justifyContent: 'center',
|
|
194
|
+
size: '6'
|
|
195
|
+
}), {
|
|
196
|
+
'@layer': {
|
|
197
|
+
[cssLayerComponent]: {
|
|
198
|
+
color: 'transparent',
|
|
199
|
+
selectors: {
|
|
200
|
+
[selectors.selected]: {
|
|
201
|
+
backgroundColor: tokens.colours.foreground.body,
|
|
202
|
+
color: tokens.colours.background.body
|
|
203
|
+
},
|
|
204
|
+
[`${selectors.hoverNotSelected}, ${selectors.focusVisibleNotSelected}`]: {
|
|
205
|
+
backgroundColor: tokens.colours.gamut.gray300,
|
|
206
|
+
color: tokens.colours.background.body
|
|
207
|
+
},
|
|
208
|
+
[selectors.disabled]: {
|
|
209
|
+
borderColor: tokens.colours.gamut.gray200
|
|
210
|
+
}
|
|
152
211
|
}
|
|
153
212
|
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
display: 'flex',
|
|
157
|
-
flexShrink: '0',
|
|
158
|
-
justifyContent: 'center',
|
|
159
|
-
size: '6'
|
|
160
|
-
}), optionTransition]
|
|
161
|
-
}, "styledCheckbox");
|
|
213
|
+
}
|
|
214
|
+
}, optionTransition], "checkboxStyle");
|
|
162
215
|
const pseudoRadio = style({
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
216
|
+
'@layer': {
|
|
217
|
+
[cssLayerComponent]: {
|
|
218
|
+
selectors: {
|
|
219
|
+
'&:after': {
|
|
220
|
+
borderRadius: 'inherit',
|
|
221
|
+
content: '',
|
|
222
|
+
display: 'block',
|
|
223
|
+
height: '100%',
|
|
224
|
+
left: 0,
|
|
225
|
+
position: 'absolute',
|
|
226
|
+
top: 0,
|
|
227
|
+
transform: 'scale(0.475)',
|
|
228
|
+
width: '100%'
|
|
229
|
+
},
|
|
230
|
+
[`${selectors.hover}:after, ${selectors.focusVisible}:after`]: {
|
|
231
|
+
background: tokens.colours.gamut.gray200
|
|
232
|
+
},
|
|
233
|
+
[`&[data-selected]:after`]: {
|
|
234
|
+
background: tokens.colours.gamut.white
|
|
235
|
+
}
|
|
236
|
+
}
|
|
180
237
|
}
|
|
181
238
|
}
|
|
182
239
|
}, "pseudoRadio");
|
|
183
|
-
export const
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
backgroundColor: tokens.colours.
|
|
194
|
-
borderColor: tokens.border.colours.
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
240
|
+
export const radioButtonStyle = style([sprinkles({
|
|
241
|
+
alignItems: 'center',
|
|
242
|
+
borderRadius: 'full',
|
|
243
|
+
borderStyle: 'solid',
|
|
244
|
+
borderWidth: '1',
|
|
245
|
+
position: 'relative',
|
|
246
|
+
size: '6'
|
|
247
|
+
}), {
|
|
248
|
+
'@layer': {
|
|
249
|
+
[cssLayerComponent]: {
|
|
250
|
+
backgroundColor: tokens.colours.background.body,
|
|
251
|
+
borderColor: tokens.border.colours.gray,
|
|
252
|
+
selectors: {
|
|
253
|
+
[selectors.selected]: {
|
|
254
|
+
backgroundColor: tokens.colours.foreground.body,
|
|
255
|
+
borderColor: tokens.border.colours.dark
|
|
256
|
+
},
|
|
257
|
+
[`${selectors.hoverNotSelected}, ${selectors.focusVisibleNotSelected}`]: {
|
|
258
|
+
backgroundColor: tokens.colours.gamut.gray300,
|
|
259
|
+
borderColor: tokens.colours.gamut.gray300
|
|
260
|
+
},
|
|
261
|
+
[selectors.disabled]: {
|
|
262
|
+
backgroundColor: tokens.colours.gamut.gray100,
|
|
263
|
+
borderColor: tokens.colours.gamut.gray200
|
|
264
|
+
}
|
|
204
265
|
}
|
|
205
266
|
}
|
|
206
|
-
}
|
|
207
|
-
}, "
|
|
267
|
+
}
|
|
268
|
+
}, pseudoRadio, optionTransition], "radioButtonStyle");
|
|
269
|
+
|
|
208
270
|
// === Label styles
|
|
209
271
|
|
|
210
|
-
export const labelStyle =
|
|
211
|
-
fontSize:
|
|
212
|
-
}
|
|
213
|
-
export const descriptionStyle =
|
|
214
|
-
fontSize:
|
|
215
|
-
}
|
|
272
|
+
export const labelStyle = sprinkles({
|
|
273
|
+
fontSize: '4'
|
|
274
|
+
});
|
|
275
|
+
export const descriptionStyle = sprinkles({
|
|
276
|
+
fontSize: '2'
|
|
277
|
+
});
|
|
216
278
|
__vanilla_filescope__.endFileScope();
|
|
@@ -3,7 +3,7 @@ import { type ListBoxProps } from 'react-aria-components';
|
|
|
3
3
|
import { type SelectionMode } from 'react-stately';
|
|
4
4
|
import type { TestIdProp } from '../../types';
|
|
5
5
|
import { type IconEl } from '../Icon';
|
|
6
|
-
import { type
|
|
6
|
+
import { type GridVariants } from './OptionGrid.css';
|
|
7
7
|
export interface OptionItem {
|
|
8
8
|
name: string;
|
|
9
9
|
label: string;
|
|
@@ -13,6 +13,10 @@ export interface OptionItem {
|
|
|
13
13
|
*/
|
|
14
14
|
icon?: IconEl;
|
|
15
15
|
description?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Whether this option should be disabled
|
|
18
|
+
*/
|
|
19
|
+
disabled?: boolean;
|
|
16
20
|
}
|
|
17
21
|
export interface OptionGridProps<T> extends Omit<ListBoxProps<T>, 'items'>, TestIdProp {
|
|
18
22
|
/**
|
|
@@ -34,7 +38,11 @@ export interface OptionGridProps<T> extends Omit<ListBoxProps<T>, 'items'>, Test
|
|
|
34
38
|
/**
|
|
35
39
|
* Number of columns to display the options in
|
|
36
40
|
*/
|
|
37
|
-
columns?:
|
|
41
|
+
columns?: GridVariants['columns'];
|
|
42
|
+
/**
|
|
43
|
+
* Loading state
|
|
44
|
+
*/
|
|
45
|
+
isLoading?: boolean;
|
|
38
46
|
}
|
|
39
47
|
/**
|
|
40
48
|
* The OptionGrid is primarily used in the booking flow to provide large selectable tiles to the user. It is not a form
|
|
@@ -42,13 +50,16 @@ export interface OptionGridProps<T> extends Omit<ListBoxProps<T>, 'items'>, Test
|
|
|
42
50
|
* and implements a listbox behaviour without wrapping an input element. It supports controlled and uncontrolled usage.
|
|
43
51
|
* Following ARIA guidelines, the arrow keys can be used to navigate withing the group of options.
|
|
44
52
|
*
|
|
53
|
+
* The ListBox implementation provides a Set of selected keys to the `onSelectionChange` handler. To preselect options
|
|
54
|
+
* in uncontrolled usage, simply provide a default selection using the `defaultSelectedKeys` prop.
|
|
45
55
|
* See more details on react-aria [ListBox props](https://react-spectrum.adobe.com/react-aria/ListBox.html#listbox-1).
|
|
46
56
|
*
|
|
47
|
-
* Not yet implemented: disabled appearance, empty state, loading state, error state.
|
|
48
|
-
*
|
|
49
57
|
* Accessibility note: The ARIA spec prohibits listbox items from including interactive content such as buttons,
|
|
50
58
|
* tooltips, etc. For these cases a completely different implementation is required (e.g. react-aria [GridList](
|
|
51
59
|
* https://react-spectrum.adobe.com/react-aria/GridList.html))
|
|
52
60
|
*/
|
|
53
|
-
export declare const OptionGrid:
|
|
61
|
+
export declare const OptionGrid: {
|
|
62
|
+
({ className, columns, indicator, isLoading, label, layout, selectionMode, testId, ...props }: OptionGridProps<OptionItem>): React.JSX.Element;
|
|
63
|
+
displayName: string;
|
|
64
|
+
};
|
|
54
65
|
//# sourceMappingURL=OptionGrid.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OptionGrid.d.ts","sourceRoot":"","sources":["../../../lib/components/OptionGrid/OptionGrid.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAIN,KAAK,YAAY,EACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"OptionGrid.d.ts","sourceRoot":"","sources":["../../../lib/components/OptionGrid/OptionGrid.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAIN,KAAK,YAAY,EACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,SAAS,CAAC;AAG5C,OAAO,EAUN,KAAK,YAAY,EACjB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,WAAW,UAAU;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AACD,MAAM,WAAW,eAAe,CAAC,CAAC,CACjC,SAAQ,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EACrC,UAAU;IACX;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC;IAC1C;;OAEG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B;;OAEG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IAClC;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,UAAU;mGAWpB,eAAe,CAAC,UAAU,CAAC;;CAgG7B,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
const _excluded = ["className", "columns", "indicator", "label", "layout", "selectionMode", "testId"];
|
|
5
|
+
const _excluded = ["className", "columns", "indicator", "isLoading", "label", "layout", "selectionMode", "testId"];
|
|
6
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
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 { CheckIcon } from '@autoguru/icons';
|
|
@@ -11,7 +11,8 @@ import React from 'react';
|
|
|
11
11
|
import { ListBox, ListBoxItem, Text } from 'react-aria-components';
|
|
12
12
|
import { dataAttrs } from "../../utils/dataAttrs.js";
|
|
13
13
|
import { Icon } from "../Icon/index.js";
|
|
14
|
-
import {
|
|
14
|
+
import { LoadingBox } from "../LoadingBox/LoadingBox.js";
|
|
15
|
+
import { checkboxStyle, descriptionStyle, gridContainerStyle, gridItemContainerStyle, gridItemStyle, gridVariants, indicatorStyle, labelStyle, radioButtonStyle } from "./OptionGrid.css.js";
|
|
15
16
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
16
17
|
/**
|
|
17
18
|
* The OptionGrid is primarily used in the booking flow to provide large selectable tiles to the user. It is not a form
|
|
@@ -19,10 +20,10 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
19
20
|
* and implements a listbox behaviour without wrapping an input element. It supports controlled and uncontrolled usage.
|
|
20
21
|
* Following ARIA guidelines, the arrow keys can be used to navigate withing the group of options.
|
|
21
22
|
*
|
|
23
|
+
* The ListBox implementation provides a Set of selected keys to the `onSelectionChange` handler. To preselect options
|
|
24
|
+
* in uncontrolled usage, simply provide a default selection using the `defaultSelectedKeys` prop.
|
|
22
25
|
* See more details on react-aria [ListBox props](https://react-spectrum.adobe.com/react-aria/ListBox.html#listbox-1).
|
|
23
26
|
*
|
|
24
|
-
* Not yet implemented: disabled appearance, empty state, loading state, error state.
|
|
25
|
-
*
|
|
26
27
|
* Accessibility note: The ARIA spec prohibits listbox items from including interactive content such as buttons,
|
|
27
28
|
* tooltips, etc. For these cases a completely different implementation is required (e.g. react-aria [GridList](
|
|
28
29
|
* https://react-spectrum.adobe.com/react-aria/GridList.html))
|
|
@@ -32,19 +33,36 @@ export const OptionGrid = _ref => {
|
|
|
32
33
|
className,
|
|
33
34
|
columns,
|
|
34
35
|
indicator = 'checkbox',
|
|
36
|
+
isLoading = false,
|
|
35
37
|
label,
|
|
36
38
|
layout = 'grid',
|
|
37
39
|
selectionMode = 'multiple',
|
|
38
40
|
testId
|
|
39
41
|
} = _ref,
|
|
40
42
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
43
|
+
if (isLoading) {
|
|
44
|
+
return /*#__PURE__*/_jsx("div", {
|
|
45
|
+
className: gridContainerStyle,
|
|
46
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
47
|
+
className: gridVariants({
|
|
48
|
+
columns
|
|
49
|
+
}),
|
|
50
|
+
children: Array.from({
|
|
51
|
+
length: Number(columns) || 1
|
|
52
|
+
}, (_, idx) => /*#__PURE__*/_jsx("div", {
|
|
53
|
+
className: gridItemContainerStyle,
|
|
54
|
+
children: /*#__PURE__*/_jsx(LoadingBox, {})
|
|
55
|
+
}, idx))
|
|
56
|
+
})
|
|
57
|
+
});
|
|
58
|
+
}
|
|
41
59
|
return /*#__PURE__*/_jsx("div", {
|
|
42
60
|
className: gridContainerStyle,
|
|
43
61
|
children: /*#__PURE__*/_jsx(ListBox, _objectSpread(_objectSpread(_objectSpread({
|
|
44
62
|
"aria-label": label,
|
|
45
63
|
layout: layout,
|
|
46
64
|
selectionMode: selectionMode,
|
|
47
|
-
className: clsx([
|
|
65
|
+
className: clsx([gridVariants({
|
|
48
66
|
columns
|
|
49
67
|
}), className])
|
|
50
68
|
}, dataAttrs({
|
|
@@ -52,13 +70,18 @@ export const OptionGrid = _ref => {
|
|
|
52
70
|
})), props), {}, {
|
|
53
71
|
children: ({
|
|
54
72
|
description,
|
|
73
|
+
disabled,
|
|
55
74
|
icon,
|
|
56
75
|
label,
|
|
57
76
|
name
|
|
58
|
-
}) => /*#__PURE__*/_jsx(ListBoxItem, {
|
|
59
|
-
className:
|
|
77
|
+
}) => /*#__PURE__*/_jsx(ListBoxItem, _objectSpread(_objectSpread({
|
|
78
|
+
className: gridItemStyle,
|
|
60
79
|
id: name,
|
|
61
|
-
|
|
80
|
+
isDisabled: disabled,
|
|
81
|
+
textValue: label
|
|
82
|
+
}, dataAttrs({
|
|
83
|
+
disabled
|
|
84
|
+
})), {}, {
|
|
62
85
|
children: ({
|
|
63
86
|
isFocusVisible,
|
|
64
87
|
isHovered,
|
|
@@ -71,10 +94,11 @@ export const OptionGrid = _ref => {
|
|
|
71
94
|
icon: icon,
|
|
72
95
|
size: "100%"
|
|
73
96
|
});
|
|
74
|
-
const styledIndicator = indicator === 'radio' ?
|
|
97
|
+
const styledIndicator = indicator === 'radio' ? radioButtonStyle : checkboxStyle;
|
|
75
98
|
return /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
|
|
76
|
-
className: styledIndicator
|
|
99
|
+
className: styledIndicator
|
|
77
100
|
}, dataAttrs({
|
|
101
|
+
disabled,
|
|
78
102
|
'focus-visible': isFocusVisible,
|
|
79
103
|
hover: isHovered,
|
|
80
104
|
selected: isSelected
|
|
@@ -86,7 +110,7 @@ export const OptionGrid = _ref => {
|
|
|
86
110
|
};
|
|
87
111
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
88
112
|
children: [hasIndicator && /*#__PURE__*/_jsx("div", {
|
|
89
|
-
className:
|
|
113
|
+
className: indicatorStyle,
|
|
90
114
|
children: /*#__PURE__*/_jsx(IndicatorIcon, {})
|
|
91
115
|
}), /*#__PURE__*/_jsxs("div", {
|
|
92
116
|
children: [/*#__PURE__*/_jsx(Text, {
|
|
@@ -103,7 +127,8 @@ export const OptionGrid = _ref => {
|
|
|
103
127
|
})]
|
|
104
128
|
});
|
|
105
129
|
}
|
|
106
|
-
})
|
|
130
|
+
}))
|
|
107
131
|
}))
|
|
108
132
|
});
|
|
109
|
-
};
|
|
133
|
+
};
|
|
134
|
+
OptionGrid.displayName = 'OptionGrid';
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
export declare const groupStyle: string;
|
|
2
2
|
export declare const groupLabelStyle: string;
|
|
3
3
|
export declare const descriptionStyle: string;
|
|
4
|
-
export declare const
|
|
5
|
-
[x: string]: {
|
|
6
|
-
[x: string]: string | import("@vanilla-extract/css").ComplexStyleRule;
|
|
7
|
-
};
|
|
8
|
-
}>;
|
|
4
|
+
export declare const optionItemStyle: string;
|
|
9
5
|
export declare const itemLabelStyle: string;
|
|
10
|
-
export declare const checkbox:
|
|
11
|
-
[x: string]: {
|
|
12
|
-
[x: string]: string | import("@vanilla-extract/css").ComplexStyleRule;
|
|
13
|
-
};
|
|
14
|
-
}>;
|
|
6
|
+
export declare const checkbox: string;
|
|
15
7
|
//# sourceMappingURL=OptionList.css.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OptionList.css.d.ts","sourceRoot":"","sources":["../../../lib/components/OptionList/OptionList.css.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"OptionList.css.d.ts","sourceRoot":"","sources":["../../../lib/components/OptionList/OptionList.css.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,UAAU,QAErB,CAAC;AAEH,eAAO,MAAM,eAAe,QAI1B,CAAC;AAEH,eAAO,MAAM,gBAAgB,QAW3B,CAAC;AAGH,eAAO,MAAM,eAAe,QA4C1B,CAAC;AAEH,eAAO,MAAM,cAAc,QAIzB,CAAC;AAGH,eAAO,MAAM,QAAQ,QAmCnB,CAAC"}
|