@autoguru/overdrive 4.47.1 → 4.47.3
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/DatePicker/DatePicker.css.d.ts +1 -1
- package/dist/components/DatePicker/DatePicker.css.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePicker.css.js +2 -2
- package/dist/components/DatePicker/DatePicker.d.ts +13 -0
- package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePicker.js +41 -32
- package/dist/components/Popover/Popover.css.d.ts.map +1 -1
- package/dist/components/Popover/Popover.css.js +9 -2
- package/package.json +6 -6
|
@@ -2,5 +2,5 @@ export declare const inputContainer: string;
|
|
|
2
2
|
export declare const input: string;
|
|
3
3
|
export declare const inputOverlay: string;
|
|
4
4
|
export declare const contents: Record<"default" | "withLabel", string>;
|
|
5
|
-
export declare const disabled: Record<"
|
|
5
|
+
export declare const disabled: Record<"cursor" | "native", string>;
|
|
6
6
|
//# sourceMappingURL=DatePicker.css.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePicker.css.d.ts","sourceRoot":"","sources":["../../../lib/components/DatePicker/DatePicker.css.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,cAAc,QAOzB,CAAC;AAEH,eAAO,MAAM,KAAK,QAsBhB,CAAC;AAEH,eAAO,MAAM,YAAY,QAQvB,CAAC;AAEH,eAAO,MAAM,QAAQ,yCAmBnB,CAAC;AAEH,eAAO,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"DatePicker.css.d.ts","sourceRoot":"","sources":["../../../lib/components/DatePicker/DatePicker.css.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,cAAc,QAOzB,CAAC;AAEH,eAAO,MAAM,KAAK,QAsBhB,CAAC;AAEH,eAAO,MAAM,YAAY,QAQvB,CAAC;AAEH,eAAO,MAAM,QAAQ,yCAmBnB,CAAC;AAEH,eAAO,MAAM,QAAQ,qCAenB,CAAC"}
|
|
@@ -66,14 +66,14 @@ export const contents = styleVariants({
|
|
|
66
66
|
}
|
|
67
67
|
}, "contents");
|
|
68
68
|
export const disabled = styleVariants({
|
|
69
|
-
|
|
69
|
+
cursor: {
|
|
70
70
|
'@layer': {
|
|
71
71
|
[cssLayerComponent]: {
|
|
72
72
|
cursor: 'not-allowed'
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
},
|
|
76
|
-
|
|
76
|
+
native: {
|
|
77
77
|
'@layer': {
|
|
78
78
|
[cssLayerComponent]: {
|
|
79
79
|
opacity: '0.3'
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IconType } from '@autoguru/icons';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import type { AriaPopoverProps } from 'react-aria';
|
|
3
4
|
import type { TestIdProp } from '../../types';
|
|
4
5
|
import { type CalendarProps } from '../Calendar';
|
|
5
6
|
type SizeScale = 'small' | 'medium' | 'large';
|
|
@@ -33,11 +34,23 @@ export interface DatePickerProps extends TestIdProp {
|
|
|
33
34
|
* Show a loading state spinner instead of the icon
|
|
34
35
|
*/
|
|
35
36
|
isLoading?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Maximum selectable date YYYY-MM-DD
|
|
39
|
+
*/
|
|
40
|
+
max?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Minimum selectable date YYYY-MM-DD
|
|
43
|
+
*/
|
|
44
|
+
min?: string;
|
|
36
45
|
/**
|
|
37
46
|
* Input field name recommended for form usage
|
|
38
47
|
*/
|
|
39
48
|
name?: string;
|
|
40
49
|
onChange(date: string): void;
|
|
50
|
+
/**
|
|
51
|
+
* Calendar popover placement relative to the trigger ('bottom left', 'top', etc.)
|
|
52
|
+
*/
|
|
53
|
+
placement?: AriaPopoverProps['placement'];
|
|
41
54
|
/**
|
|
42
55
|
* Visual size of the picker control (small, medium, large)
|
|
43
56
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../lib/components/DatePicker/DatePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgB,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAQzD,OAAO,
|
|
1
|
+
{"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../lib/components/DatePicker/DatePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgB,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAQzD,OAAO,KAON,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAInD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAS3D,KAAK,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE9C,QAAA,MAAM,cAAc;;CAEV,CAAC;AAEX,KAAK,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,OAAO,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;AAE5E,MAAM,WAAW,eAAgB,SAAQ,UAAU;IAClD;;OAEG;IACH,eAAe,CAAC,EAAE,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B;;OAEG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAC1C;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,IAAI,CAAC,EAAE,eAAe,CAAC;CACvB;AAqBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,eAAO,MAAM,UAAU,0FAkMtB,CAAC"}
|
|
@@ -2,13 +2,13 @@
|
|
|
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 = ["calendarOptions", "className", "defaultValue", "disabled", "icon", "isLoading", "lang", "onChange", "size", "testId", "useNativePicker", "value", "valueLabel"];
|
|
5
|
+
const _excluded = ["calendarOptions", "className", "defaultValue", "disabled", "icon", "isLoading", "lang", "max", "min", "onChange", "placement", "size", "testId", "useNativePicker", "value", "valueLabel"];
|
|
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 { CalendarIcon } from '@autoguru/icons';
|
|
9
9
|
import { getLocalTimeZone, parseDate, today } from '@internationalized/date';
|
|
10
10
|
import clsx from 'clsx';
|
|
11
|
-
import React, { useEffect, useMemo, useState, forwardRef } from 'react';
|
|
11
|
+
import React, { useCallback, useEffect, useMemo, useState, forwardRef } from 'react';
|
|
12
12
|
import { elementStyles } from "../../styles/elementStyles.js";
|
|
13
13
|
import { sprinkles } from "../../styles/sprinkles.css.js";
|
|
14
14
|
import { Calendar } from "../Calendar/index.js";
|
|
@@ -100,7 +100,10 @@ export const DatePicker = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
100
100
|
icon = CalendarIcon,
|
|
101
101
|
isLoading = false,
|
|
102
102
|
lang,
|
|
103
|
+
max,
|
|
104
|
+
min,
|
|
103
105
|
onChange,
|
|
106
|
+
placement = 'bottom left',
|
|
104
107
|
size = 'medium',
|
|
105
108
|
testId,
|
|
106
109
|
useNativePicker = false,
|
|
@@ -134,12 +137,6 @@ export const DatePicker = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
134
137
|
onChange(dateString);
|
|
135
138
|
}
|
|
136
139
|
};
|
|
137
|
-
const containerStyle = elementStyles({
|
|
138
|
-
className: [className, {
|
|
139
|
-
[styles.disabled.default]: disabled,
|
|
140
|
-
[styles.disabled.root]: disabled
|
|
141
|
-
}]
|
|
142
|
-
});
|
|
143
140
|
const indicator = isLoading ? /*#__PURE__*/_jsx(ProgressSpinner, {
|
|
144
141
|
size: size
|
|
145
142
|
}) : /*#__PURE__*/_jsx(Icon, {
|
|
@@ -147,41 +144,50 @@ export const DatePicker = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
147
144
|
size: size
|
|
148
145
|
});
|
|
149
146
|
const label = valueLabel ? /*#__PURE__*/_jsx(Text, {
|
|
147
|
+
colour: !useNativePicker && disabled ? 'muted' : undefined,
|
|
150
148
|
size: textSizeMap[size],
|
|
151
149
|
children: valueLabel
|
|
152
150
|
}) : null;
|
|
153
|
-
const
|
|
154
|
-
|
|
151
|
+
const handleCalendarChange = useCallback(date => {
|
|
152
|
+
setSelectedDate(date);
|
|
153
|
+
if (typeof onChange === 'function') {
|
|
154
|
+
onChange(formatDateToString(date));
|
|
155
|
+
}
|
|
156
|
+
// Close the popover after date selection
|
|
157
|
+
if (popoverState) {
|
|
158
|
+
popoverState.close();
|
|
159
|
+
}
|
|
160
|
+
}, [onChange, popoverState]);
|
|
161
|
+
const calendarProps = useMemo(() => _objectSpread(_objectSpread({
|
|
162
|
+
calendarOptions: _objectSpread(_objectSpread(_objectSpread({}, isControlled ? {
|
|
155
163
|
value: selectedDate || today(getLocalTimeZone())
|
|
156
164
|
} : {
|
|
157
165
|
defaultValue: selectedDate || today(getLocalTimeZone())
|
|
158
|
-
}),
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
popoverState.close();
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}), [selectedDate, calendarOptions, onChange, popoverState, isControlled]);
|
|
166
|
+
}), min && {
|
|
167
|
+
minValue: parseDateString(min)
|
|
168
|
+
}), max && {
|
|
169
|
+
maxValue: parseDateString(max)
|
|
170
|
+
})
|
|
171
|
+
}, calendarOptions), {}, {
|
|
172
|
+
onChange: handleCalendarChange
|
|
173
|
+
}), [selectedDate, calendarOptions, handleCalendarChange, isControlled, min, max]);
|
|
170
174
|
const contentCalendar = useMemo(() => /*#__PURE__*/_jsx(Calendar, _objectSpread({}, calendarProps)), [calendarProps]);
|
|
171
175
|
|
|
172
176
|
// Use native picker only if explicitly requested
|
|
173
177
|
if (useNativePicker) {
|
|
174
178
|
return /*#__PURE__*/_jsxs("div", {
|
|
175
|
-
className: clsx(
|
|
179
|
+
className: clsx(className, styles.inputContainer, disabled && styles.disabled.native),
|
|
176
180
|
children: [/*#__PURE__*/_jsx("input", _objectSpread(_objectSpread({}, inputProps), {}, {
|
|
177
181
|
ref: ref,
|
|
178
182
|
className: elementStyles({
|
|
179
183
|
className: [styles.input, {
|
|
180
|
-
[styles.disabled.
|
|
184
|
+
[styles.disabled.cursor]: disabled
|
|
181
185
|
}]
|
|
182
186
|
}),
|
|
183
187
|
type: "date",
|
|
184
188
|
disabled: disabled,
|
|
189
|
+
min: min,
|
|
190
|
+
max: max,
|
|
185
191
|
onChange: onChangeEvent
|
|
186
192
|
})), /*#__PURE__*/_jsx("div", {
|
|
187
193
|
className: styles.inputOverlay,
|
|
@@ -195,21 +201,24 @@ export const DatePicker = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
195
201
|
});
|
|
196
202
|
}
|
|
197
203
|
return /*#__PURE__*/_jsxs("div", {
|
|
198
|
-
className:
|
|
199
|
-
display: 'flex',
|
|
200
|
-
alignItems: 'center',
|
|
201
|
-
gap: '1'
|
|
202
|
-
})),
|
|
204
|
+
className: className,
|
|
203
205
|
children: [/*#__PURE__*/_jsxs(PopoverTrigger, {
|
|
204
206
|
content: contentCalendar,
|
|
205
|
-
placement:
|
|
207
|
+
placement: placement,
|
|
206
208
|
testId: testId,
|
|
207
209
|
isDisabled: disabled,
|
|
208
210
|
onStateReady: setPopoverState,
|
|
209
|
-
children: [
|
|
211
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
212
|
+
className: sprinkles({
|
|
213
|
+
display: 'flex',
|
|
214
|
+
alignItems: 'center',
|
|
215
|
+
gap: '1'
|
|
216
|
+
}),
|
|
217
|
+
children: [indicator, label]
|
|
218
|
+
}), /*#__PURE__*/_jsx(VisuallyHidden, {
|
|
210
219
|
children: (_lang$openCalendar = lang === null || lang === void 0 ? void 0 : lang.openCalendar) !== null && _lang$openCalendar !== void 0 ? _lang$openCalendar : defaultEnglish.openCalendar
|
|
211
220
|
})]
|
|
212
|
-
}),
|
|
221
|
+
}), /*#__PURE__*/_jsx("input", _objectSpread(_objectSpread({}, inputProps), {}, {
|
|
213
222
|
ref: ref,
|
|
214
223
|
value: formatDateToString(selectedDate),
|
|
215
224
|
type: "hidden"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popover.css.d.ts","sourceRoot":"","sources":["../../../lib/components/Popover/Popover.css.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Popover.css.d.ts","sourceRoot":"","sources":["../../../lib/components/Popover/Popover.css.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,YAAY,QAiBvB,CAAC;AAEH,eAAO,MAAM,YAAY,QAcvB,CAAC;AAEH,eAAO,MAAM,eAAe,QAY1B,CAAC"}
|
|
@@ -4,6 +4,7 @@ import * as __vanilla_filescope__ from '@vanilla-extract/css/fileScope';
|
|
|
4
4
|
__vanilla_filescope__.setFileScope("lib/components/Popover/Popover.css.ts", "@autoguru/overdrive");
|
|
5
5
|
import { style } from '@vanilla-extract/css';
|
|
6
6
|
import { cssLayerComponent } from "../../styles/layers.css.js";
|
|
7
|
+
import { selectors } from "../../styles/selectors.js";
|
|
7
8
|
import { sprinkles } from "../../styles/sprinkles.css.js";
|
|
8
9
|
import { overdriveTokens as tokens } from "../../themes/theme.css.js";
|
|
9
10
|
export const overlayStyle = style([sprinkles({
|
|
@@ -27,7 +28,12 @@ export const triggerStyle = style({
|
|
|
27
28
|
background: 'transparent',
|
|
28
29
|
border: 'none',
|
|
29
30
|
cursor: 'pointer',
|
|
30
|
-
padding: 0
|
|
31
|
+
padding: 0,
|
|
32
|
+
selectors: {
|
|
33
|
+
[selectors.disabled]: {
|
|
34
|
+
cursor: 'not-allowed'
|
|
35
|
+
}
|
|
36
|
+
}
|
|
31
37
|
}
|
|
32
38
|
}
|
|
33
39
|
}, "triggerStyle");
|
|
@@ -39,7 +45,8 @@ export const fullScreenStyle = style({
|
|
|
39
45
|
left: 0,
|
|
40
46
|
position: 'fixed',
|
|
41
47
|
right: 0,
|
|
42
|
-
top: 0
|
|
48
|
+
top: 0,
|
|
49
|
+
zIndex: 3
|
|
43
50
|
}
|
|
44
51
|
}
|
|
45
52
|
}, "fullScreenStyle");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autoguru/overdrive",
|
|
3
|
-
"version": "4.47.
|
|
3
|
+
"version": "4.47.3",
|
|
4
4
|
"description": "Overdrive is a product component library, and design system for AutoGuru.",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"@babel/preset-react": "7.27.1",
|
|
80
80
|
"@babel/preset-typescript": "7.27.1",
|
|
81
81
|
"@babel/runtime-corejs3": "7.28.4",
|
|
82
|
-
"@changesets/cli": "2.29.
|
|
82
|
+
"@changesets/cli": "2.29.7",
|
|
83
83
|
"@chromatic-com/storybook": "4.1.1",
|
|
84
84
|
"@internationalized/date": "3.9.0",
|
|
85
85
|
"@octokit/rest": "22.0.0",
|
|
@@ -96,8 +96,8 @@
|
|
|
96
96
|
"@testing-library/react": "16.3.0",
|
|
97
97
|
"@testing-library/react-hooks": "8.0.1",
|
|
98
98
|
"@testing-library/user-event": "14.6.1",
|
|
99
|
-
"@types/node": "24.
|
|
100
|
-
"@types/react": "19.1.
|
|
99
|
+
"@types/node": "24.4.0",
|
|
100
|
+
"@types/react": "19.1.13",
|
|
101
101
|
"@types/react-dom": "19.1.9",
|
|
102
102
|
"@types/webpack-env": "1.18.8",
|
|
103
103
|
"@typescript-eslint/utils": "8.41.0",
|
|
@@ -139,8 +139,8 @@
|
|
|
139
139
|
"prop-types": "15.8.1",
|
|
140
140
|
"rand-seed": "3.0.0",
|
|
141
141
|
"react": "19.1.1",
|
|
142
|
-
"react-aria": "3.43.
|
|
143
|
-
"react-aria-components": "1.12.
|
|
142
|
+
"react-aria": "3.43.2",
|
|
143
|
+
"react-aria-components": "1.12.2",
|
|
144
144
|
"react-dom": "19.1.1",
|
|
145
145
|
"react-focus-lock": "2.13.6",
|
|
146
146
|
"react-intersection-observer": "9.16.0",
|