@autoguru/overdrive 4.47.1 → 4.47.2
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 +5 -0
- package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePicker.js +33 -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';
|
|
@@ -38,6 +39,10 @@ export interface DatePickerProps extends TestIdProp {
|
|
|
38
39
|
*/
|
|
39
40
|
name?: string;
|
|
40
41
|
onChange(date: string): void;
|
|
42
|
+
/**
|
|
43
|
+
* Calendar popover placement relative to the trigger ('bottom left', 'top', etc.)
|
|
44
|
+
*/
|
|
45
|
+
placement?: AriaPopoverProps['placement'];
|
|
41
46
|
/**
|
|
42
47
|
* Visual size of the picker control (small, medium, large)
|
|
43
48
|
*/
|
|
@@ -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,CAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,eAAO,MAAM,UAAU,0FAqLtB,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", "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";
|
|
@@ -101,6 +101,7 @@ export const DatePicker = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
101
101
|
isLoading = false,
|
|
102
102
|
lang,
|
|
103
103
|
onChange,
|
|
104
|
+
placement = 'bottom left',
|
|
104
105
|
size = 'medium',
|
|
105
106
|
testId,
|
|
106
107
|
useNativePicker = false,
|
|
@@ -134,12 +135,6 @@ export const DatePicker = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
134
135
|
onChange(dateString);
|
|
135
136
|
}
|
|
136
137
|
};
|
|
137
|
-
const containerStyle = elementStyles({
|
|
138
|
-
className: [className, {
|
|
139
|
-
[styles.disabled.default]: disabled,
|
|
140
|
-
[styles.disabled.root]: disabled
|
|
141
|
-
}]
|
|
142
|
-
});
|
|
143
138
|
const indicator = isLoading ? /*#__PURE__*/_jsx(ProgressSpinner, {
|
|
144
139
|
size: size
|
|
145
140
|
}) : /*#__PURE__*/_jsx(Icon, {
|
|
@@ -147,37 +142,40 @@ export const DatePicker = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
147
142
|
size: size
|
|
148
143
|
});
|
|
149
144
|
const label = valueLabel ? /*#__PURE__*/_jsx(Text, {
|
|
145
|
+
colour: !useNativePicker && disabled ? 'muted' : undefined,
|
|
150
146
|
size: textSizeMap[size],
|
|
151
147
|
children: valueLabel
|
|
152
148
|
}) : null;
|
|
153
|
-
const
|
|
154
|
-
|
|
149
|
+
const handleCalendarChange = useCallback(date => {
|
|
150
|
+
setSelectedDate(date);
|
|
151
|
+
if (typeof onChange === 'function') {
|
|
152
|
+
onChange(formatDateToString(date));
|
|
153
|
+
}
|
|
154
|
+
// Close the popover after date selection
|
|
155
|
+
if (popoverState) {
|
|
156
|
+
popoverState.close();
|
|
157
|
+
}
|
|
158
|
+
}, [onChange, popoverState]);
|
|
159
|
+
const calendarProps = useMemo(() => _objectSpread(_objectSpread({
|
|
160
|
+
calendarOptions: _objectSpread({}, isControlled ? {
|
|
155
161
|
value: selectedDate || today(getLocalTimeZone())
|
|
156
162
|
} : {
|
|
157
163
|
defaultValue: selectedDate || today(getLocalTimeZone())
|
|
158
|
-
})
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
onChange(formatDateToString(date));
|
|
163
|
-
}
|
|
164
|
-
// Close the popover after date selection
|
|
165
|
-
if (popoverState) {
|
|
166
|
-
popoverState.close();
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}), [selectedDate, calendarOptions, onChange, popoverState, isControlled]);
|
|
164
|
+
})
|
|
165
|
+
}, calendarOptions), {}, {
|
|
166
|
+
onChange: handleCalendarChange
|
|
167
|
+
}), [selectedDate, calendarOptions, handleCalendarChange, isControlled]);
|
|
170
168
|
const contentCalendar = useMemo(() => /*#__PURE__*/_jsx(Calendar, _objectSpread({}, calendarProps)), [calendarProps]);
|
|
171
169
|
|
|
172
170
|
// Use native picker only if explicitly requested
|
|
173
171
|
if (useNativePicker) {
|
|
174
172
|
return /*#__PURE__*/_jsxs("div", {
|
|
175
|
-
className: clsx(
|
|
173
|
+
className: clsx(className, styles.inputContainer, disabled && styles.disabled.native),
|
|
176
174
|
children: [/*#__PURE__*/_jsx("input", _objectSpread(_objectSpread({}, inputProps), {}, {
|
|
177
175
|
ref: ref,
|
|
178
176
|
className: elementStyles({
|
|
179
177
|
className: [styles.input, {
|
|
180
|
-
[styles.disabled.
|
|
178
|
+
[styles.disabled.cursor]: disabled
|
|
181
179
|
}]
|
|
182
180
|
}),
|
|
183
181
|
type: "date",
|
|
@@ -195,21 +193,24 @@ export const DatePicker = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
195
193
|
});
|
|
196
194
|
}
|
|
197
195
|
return /*#__PURE__*/_jsxs("div", {
|
|
198
|
-
className:
|
|
199
|
-
display: 'flex',
|
|
200
|
-
alignItems: 'center',
|
|
201
|
-
gap: '1'
|
|
202
|
-
})),
|
|
196
|
+
className: className,
|
|
203
197
|
children: [/*#__PURE__*/_jsxs(PopoverTrigger, {
|
|
204
198
|
content: contentCalendar,
|
|
205
|
-
placement:
|
|
199
|
+
placement: placement,
|
|
206
200
|
testId: testId,
|
|
207
201
|
isDisabled: disabled,
|
|
208
202
|
onStateReady: setPopoverState,
|
|
209
|
-
children: [
|
|
203
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
204
|
+
className: sprinkles({
|
|
205
|
+
display: 'flex',
|
|
206
|
+
alignItems: 'center',
|
|
207
|
+
gap: '1'
|
|
208
|
+
}),
|
|
209
|
+
children: [indicator, label]
|
|
210
|
+
}), /*#__PURE__*/_jsx(VisuallyHidden, {
|
|
210
211
|
children: (_lang$openCalendar = lang === null || lang === void 0 ? void 0 : lang.openCalendar) !== null && _lang$openCalendar !== void 0 ? _lang$openCalendar : defaultEnglish.openCalendar
|
|
211
212
|
})]
|
|
212
|
-
}),
|
|
213
|
+
}), /*#__PURE__*/_jsx("input", _objectSpread(_objectSpread({}, inputProps), {}, {
|
|
213
214
|
ref: ref,
|
|
214
215
|
value: formatDateToString(selectedDate),
|
|
215
216
|
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.2",
|
|
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",
|