@autoguru/overdrive 4.48.0 → 4.50.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/Calendar/Calendar.css.d.ts.map +1 -1
- package/dist/components/Calendar/Calendar.css.js +4 -4
- package/dist/components/Calendar/Calendar.d.ts +3 -10
- package/dist/components/Calendar/Calendar.d.ts.map +1 -1
- package/dist/components/Calendar/Calendar.js +4 -11
- package/dist/components/DatePicker/DatePicker.d.ts +10 -4
- package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePicker.js +36 -63
- package/dist/components/DatePicker/hooks/useCalendarPopover.d.ts +38 -0
- package/dist/components/DatePicker/hooks/useCalendarPopover.d.ts.map +1 -0
- package/dist/components/DatePicker/hooks/useCalendarPopover.js +44 -0
- package/dist/components/DateTimeField/DateField/DateField.d.ts +40 -0
- package/dist/components/DateTimeField/DateField/DateField.d.ts.map +1 -0
- package/dist/components/DateTimeField/DateField/DateField.js +110 -0
- package/dist/components/DateTimeField/DateTimeField.css.d.ts +21 -0
- package/dist/components/DateTimeField/DateTimeField.css.d.ts.map +1 -0
- package/dist/components/DateTimeField/DateTimeField.css.js +127 -0
- package/dist/components/DateTimeField/DateTimeField.d.ts +116 -0
- package/dist/components/DateTimeField/DateTimeField.d.ts.map +1 -0
- package/dist/components/DateTimeField/DateTimeField.js +107 -0
- package/dist/components/DateTimeField/TimeField/TimeField.d.ts +26 -0
- package/dist/components/DateTimeField/TimeField/TimeField.d.ts.map +1 -0
- package/dist/components/DateTimeField/TimeField/TimeField.js +99 -0
- package/dist/components/DateTimeField/default.d.ts +2 -0
- package/dist/components/DateTimeField/default.d.ts.map +1 -0
- package/dist/components/DateTimeField/default.js +3 -0
- package/dist/components/DateTimeField/index.d.ts +5 -0
- package/dist/components/DateTimeField/index.d.ts.map +1 -0
- package/dist/components/DateTimeField/index.js +5 -0
- package/dist/components/DateTimeField/types.d.ts +34 -0
- package/dist/components/DateTimeField/types.d.ts.map +1 -0
- package/dist/components/DateTimeField/types.js +3 -0
- package/dist/components/Popover/Popover.d.ts +2 -2
- package/dist/components/Popover/Popover.d.ts.map +1 -1
- package/dist/components/Popover/Popover.js +2 -2
- package/dist/components/Popover/PopoverTrigger.d.ts +9 -6
- package/dist/components/Popover/PopoverTrigger.d.ts.map +1 -1
- package/dist/components/Popover/PopoverTrigger.js +6 -3
- package/dist/components/Tabs/Tabs.d.ts +44 -0
- package/dist/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/components/Tabs/Tabs.js +41 -0
- package/dist/components/ToggleButtons/ToggleButtons.css.d.ts +18 -0
- package/dist/components/ToggleButtons/ToggleButtons.css.d.ts.map +1 -0
- package/dist/components/ToggleButtons/ToggleButtons.css.js +138 -0
- package/dist/components/ToggleButtons/ToggleButtons.d.ts +113 -0
- package/dist/components/ToggleButtons/ToggleButtons.d.ts.map +1 -0
- package/dist/components/ToggleButtons/ToggleButtons.js +199 -0
- package/dist/components/ToggleButtons/index.d.ts +2 -0
- package/dist/components/ToggleButtons/index.d.ts.map +1 -0
- package/dist/components/ToggleButtons/index.js +3 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +2 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useContainerWidth/index.d.ts +2 -0
- package/dist/hooks/useContainerWidth/index.d.ts.map +1 -0
- package/dist/hooks/useContainerWidth/index.js +3 -0
- package/dist/hooks/useContainerWidth/useContainerWidth.d.ts +27 -0
- package/dist/hooks/useContainerWidth/useContainerWidth.d.ts.map +1 -0
- package/dist/hooks/useContainerWidth/useContainerWidth.js +68 -0
- package/dist/styles/selectors.d.ts +1 -0
- package/dist/styles/selectors.d.ts.map +1 -1
- package/dist/styles/selectors.js +1 -0
- package/dist/utils/dateFormat.d.ts +5 -4
- package/dist/utils/dateFormat.d.ts.map +1 -1
- package/dist/utils/dateFormat.js +9 -9
- package/package.json +24 -24
- package/dist/components/DateTimePicker/DateTimePicker.css.d.ts +0 -4
- package/dist/components/DateTimePicker/DateTimePicker.css.d.ts.map +0 -1
- package/dist/components/DateTimePicker/DateTimePicker.css.js +0 -30
- package/dist/components/DateTimePicker/DateTimePicker.d.ts +0 -68
- package/dist/components/DateTimePicker/DateTimePicker.d.ts.map +0 -1
- package/dist/components/DateTimePicker/DateTimePicker.js +0 -130
- package/dist/components/DateTimePicker/default.d.ts +0 -2
- package/dist/components/DateTimePicker/default.d.ts.map +0 -1
- package/dist/components/DateTimePicker/default.js +0 -3
package/dist/components/index.js
CHANGED
|
@@ -14,6 +14,7 @@ export * from "./ColourInput/index.js";
|
|
|
14
14
|
export * from "./Columns/index.js";
|
|
15
15
|
export * from "./DateInput/index.js";
|
|
16
16
|
export * from "./DatePicker/index.js";
|
|
17
|
+
export * from "./DateTimeField/index.js";
|
|
17
18
|
export * from "./DividerLine/index.js";
|
|
18
19
|
export * from "./DropDown/index.js";
|
|
19
20
|
export * from "./EditableText/index.js";
|
|
@@ -67,5 +68,6 @@ export * from "./TextContainer/index.js";
|
|
|
67
68
|
export * from "./TextInput/index.js";
|
|
68
69
|
export * from "./TextLink/index.js";
|
|
69
70
|
export * from "./Toaster/index.js";
|
|
71
|
+
export * from "./ToggleButtons/index.js";
|
|
70
72
|
export * from "./Tooltip/index.js";
|
|
71
73
|
export * from "./VisuallyHidden/index.js";
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC"}
|
package/dist/hooks/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
export * from "./useAnimationEvents/index.js";
|
|
4
4
|
export * from "./useAttachedBoxes/index.js";
|
|
5
|
+
export * from "./useContainerWidth/index.js";
|
|
5
6
|
export * from "./useDeepCompareMemo/index.js";
|
|
6
7
|
export * from "./useDocumentBodyStyles/index.js";
|
|
7
8
|
export * from "./useNegativeMargin/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/hooks/useContainerWidth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,iBAAiB,EACjB,KAAK,sBAAsB,GAC3B,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
export interface UseContainerWidthProps {
|
|
3
|
+
containerRef: RefObject<HTMLElement>;
|
|
4
|
+
/**
|
|
5
|
+
* Debounce delay in milliseconds to prevent excessive updates during resize
|
|
6
|
+
* @default 32 (roughly 30fps)
|
|
7
|
+
*/
|
|
8
|
+
debounceMs?: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Hook to observe and return the width of a container element
|
|
12
|
+
*
|
|
13
|
+
* @param containerRef - Reference to the container element to measure
|
|
14
|
+
* @param debounceMs - Debounce delay in milliseconds (default: 32ms for ~30fps)
|
|
15
|
+
* @returns Current width of the container in pixels
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* const containerRef = useRef<HTMLDivElement>(null);
|
|
20
|
+
* const width = useContainerWidth({ containerRef });
|
|
21
|
+
*
|
|
22
|
+
* // With custom debounce
|
|
23
|
+
* const width = useContainerWidth({ containerRef, debounceMs: 100 });
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare const useContainerWidth: ({ containerRef, debounceMs, }: UseContainerWidthProps) => number;
|
|
27
|
+
//# sourceMappingURL=useContainerWidth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useContainerWidth.d.ts","sourceRoot":"","sources":["../../../lib/hooks/useContainerWidth/useContainerWidth.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,SAAS,EAKT,MAAM,OAAO,CAAC;AAEf,MAAM,WAAW,sBAAsB;IACtC,YAAY,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IACrC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,iBAAiB,GAAI,+BAG/B,sBAAsB,KAAG,MA2D3B,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useLayoutEffect, useState, useRef, useCallback } from 'react';
|
|
4
|
+
/**
|
|
5
|
+
* Hook to observe and return the width of a container element
|
|
6
|
+
*
|
|
7
|
+
* @param containerRef - Reference to the container element to measure
|
|
8
|
+
* @param debounceMs - Debounce delay in milliseconds (default: 32ms for ~30fps)
|
|
9
|
+
* @returns Current width of the container in pixels
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* const containerRef = useRef<HTMLDivElement>(null);
|
|
14
|
+
* const width = useContainerWidth({ containerRef });
|
|
15
|
+
*
|
|
16
|
+
* // With custom debounce
|
|
17
|
+
* const width = useContainerWidth({ containerRef, debounceMs: 100 });
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export const useContainerWidth = ({
|
|
21
|
+
containerRef,
|
|
22
|
+
debounceMs = 32
|
|
23
|
+
}) => {
|
|
24
|
+
const [containerWidth, setContainerWidth] = useState(0);
|
|
25
|
+
const debounceRef = useRef(debounceMs);
|
|
26
|
+
const debouncedSetWidth = useCallback(newWidth => {
|
|
27
|
+
if (debounceRef.current) {
|
|
28
|
+
clearTimeout(debounceRef.current);
|
|
29
|
+
}
|
|
30
|
+
debounceRef.current = window.setTimeout(() => {
|
|
31
|
+
setContainerWidth(newWidth);
|
|
32
|
+
}, debounceMs);
|
|
33
|
+
}, [debounceMs]);
|
|
34
|
+
useLayoutEffect(() => {
|
|
35
|
+
if (!(containerRef !== null && containerRef !== void 0 && containerRef.current)) return;
|
|
36
|
+
const resize = () => {
|
|
37
|
+
if (containerRef.current) {
|
|
38
|
+
const newWidth = containerRef.current.getBoundingClientRect().width;
|
|
39
|
+
|
|
40
|
+
// For test environments or initial measurement, set immediately
|
|
41
|
+
if (typeof ResizeObserver === 'undefined' || containerWidth === 0) {
|
|
42
|
+
setContainerWidth(newWidth);
|
|
43
|
+
} else {
|
|
44
|
+
debouncedSetWidth(newWidth);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// Check if ResizeObserver is available (not available in some test environments)
|
|
50
|
+
if (typeof ResizeObserver === 'undefined') {
|
|
51
|
+
// Fallback for test environments - just measure once
|
|
52
|
+
resize();
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const resizeObserver = new ResizeObserver(resize);
|
|
56
|
+
resizeObserver.observe(containerRef.current);
|
|
57
|
+
|
|
58
|
+
// Initial measurement (immediate)
|
|
59
|
+
resize();
|
|
60
|
+
return () => {
|
|
61
|
+
resizeObserver.disconnect();
|
|
62
|
+
if (debounceRef.current) {
|
|
63
|
+
clearTimeout(debounceRef.current);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}, [containerRef, debouncedSetWidth, containerWidth]);
|
|
67
|
+
return containerWidth;
|
|
68
|
+
};
|
|
@@ -4,6 +4,7 @@ export declare const selectors: {
|
|
|
4
4
|
readonly disabled: "&:disabled, &[data-disabled], &[aria-disabled=\"true\"]";
|
|
5
5
|
readonly focus: "&:focus, &[data-focus], &[data-focused]";
|
|
6
6
|
readonly focusVisible: "&:focus-visible, &[data-focus-visible]";
|
|
7
|
+
readonly invalid: "&:invalid, &[data-invalid]";
|
|
7
8
|
readonly selected: "&[data-selected], &[aria-selected=\"true\"]";
|
|
8
9
|
readonly unavailable: "&[data-unavailable]";
|
|
9
10
|
readonly hover: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../lib/styles/selectors.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../lib/styles/selectors.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,SAAS;;;;;;;;;;;;;CAqBZ,CAAC"}
|
package/dist/styles/selectors.js
CHANGED
|
@@ -10,6 +10,7 @@ export const selectors = {
|
|
|
10
10
|
disabled: '&:disabled, &[data-disabled], &[aria-disabled="true"]',
|
|
11
11
|
focus: '&:focus, &[data-focus], &[data-focused]',
|
|
12
12
|
focusVisible: '&:focus-visible, &[data-focus-visible]',
|
|
13
|
+
invalid: '&:invalid, &[data-invalid]',
|
|
13
14
|
selected: '&[data-selected], &[aria-selected="true"]',
|
|
14
15
|
unavailable: '&[data-unavailable]',
|
|
15
16
|
get hover() {
|
|
@@ -12,9 +12,9 @@ export declare function isToday(date: DateValue | string | null | undefined): bo
|
|
|
12
12
|
*/
|
|
13
13
|
export declare function safeParseDateString(dateString: string): DateValue | null;
|
|
14
14
|
/**
|
|
15
|
-
* Formats a DateValue to its string representation
|
|
15
|
+
* Formats a DateValue to its ISO string representation (YYYY-MM-DD)
|
|
16
16
|
* @param date - DateValue or null
|
|
17
|
-
* @returns
|
|
17
|
+
* @returns ISO date string (e.g., "2025-09-21") or empty string
|
|
18
18
|
*/
|
|
19
19
|
export declare function formatDateValue(date: DateValue | null): string;
|
|
20
20
|
/**
|
|
@@ -27,9 +27,10 @@ export declare function formatDateValue(date: DateValue | null): string;
|
|
|
27
27
|
*
|
|
28
28
|
* @example
|
|
29
29
|
* ```ts
|
|
30
|
-
* displayFormattedDate('2025-
|
|
31
|
-
* displayFormattedDate('2024-01-15', 'full') // "Monday, January 15, 2024"
|
|
30
|
+
* displayFormattedDate('2025-09-21') // (locale default) "21/09/2025"
|
|
32
31
|
* displayFormattedDate('2025-09-21', 'short') // "21/9/25"
|
|
32
|
+
* displayFormattedDate('2025-09-21', 'medium') // "Sep 21, 2025"
|
|
33
|
+
* displayFormattedDate('2024-01-15', 'full') // "Monday, January 15, 2024"
|
|
33
34
|
* ```
|
|
34
35
|
*/
|
|
35
36
|
export declare function displayFormattedDate(date: DateValue | string | null | undefined, format?: Intl.DateTimeFormatOptions['dateStyle'], locales?: Intl.LocalesArgument): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateFormat.d.ts","sourceRoot":"","sources":["../../lib/utils/dateFormat.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,KAAK,SAAS,EACd,MAAM,yBAAyB,CAAC;AAEjC;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,WAUlE;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAOxE;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,GAAG,MAAM,CAE9D;AAED
|
|
1
|
+
{"version":3,"file":"dateFormat.d.ts","sourceRoot":"","sources":["../../lib/utils/dateFormat.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,KAAK,SAAS,EACd,MAAM,yBAAyB,CAAC;AAEjC;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,WAUlE;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAOxE;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,GAAG,MAAM,CAE9D;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CACnC,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,EAC3C,MAAM,CAAC,EAAE,IAAI,CAAC,qBAAqB,CAAC,WAAW,CAAC,EAChD,OAAO,GAAE,IAAI,CAAC,eAAyB,GACrC,MAAM,CAmBR"}
|
package/dist/utils/dateFormat.js
CHANGED
|
@@ -34,9 +34,9 @@ export function safeParseDateString(dateString) {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
|
-
* Formats a DateValue to its string representation
|
|
37
|
+
* Formats a DateValue to its ISO string representation (YYYY-MM-DD)
|
|
38
38
|
* @param date - DateValue or null
|
|
39
|
-
* @returns
|
|
39
|
+
* @returns ISO date string (e.g., "2025-09-21") or empty string
|
|
40
40
|
*/
|
|
41
41
|
export function formatDateValue(date) {
|
|
42
42
|
var _date$toString;
|
|
@@ -53,12 +53,13 @@ export function formatDateValue(date) {
|
|
|
53
53
|
*
|
|
54
54
|
* @example
|
|
55
55
|
* ```ts
|
|
56
|
-
* displayFormattedDate('2025-
|
|
57
|
-
* displayFormattedDate('2024-01-15', 'full') // "Monday, January 15, 2024"
|
|
56
|
+
* displayFormattedDate('2025-09-21') // (locale default) "21/09/2025"
|
|
58
57
|
* displayFormattedDate('2025-09-21', 'short') // "21/9/25"
|
|
58
|
+
* displayFormattedDate('2025-09-21', 'medium') // "Sep 21, 2025"
|
|
59
|
+
* displayFormattedDate('2024-01-15', 'full') // "Monday, January 15, 2024"
|
|
59
60
|
* ```
|
|
60
61
|
*/
|
|
61
|
-
export function displayFormattedDate(date, format
|
|
62
|
+
export function displayFormattedDate(date, format, locales = 'en-AU') {
|
|
62
63
|
if (!date) return '';
|
|
63
64
|
let dateValue;
|
|
64
65
|
|
|
@@ -72,10 +73,9 @@ export function displayFormattedDate(date, format = 'medium', locales = 'en-AU')
|
|
|
72
73
|
} else {
|
|
73
74
|
dateValue = date;
|
|
74
75
|
}
|
|
75
|
-
|
|
76
|
-
// Format the date using Intl.DateTimeFormat
|
|
77
|
-
const formatter = new Intl.DateTimeFormat(locales, {
|
|
76
|
+
const formatOptions = {
|
|
78
77
|
dateStyle: format
|
|
79
|
-
}
|
|
78
|
+
};
|
|
79
|
+
const formatter = new Intl.DateTimeFormat(locales, formatOptions);
|
|
80
80
|
return formatter.format(dateValue.toDate(getLocalTimeZone()));
|
|
81
81
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autoguru/overdrive",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.50.0",
|
|
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",
|
|
@@ -85,22 +85,22 @@
|
|
|
85
85
|
"@octokit/rest": "22.0.0",
|
|
86
86
|
"@popperjs/core": "2.11.8",
|
|
87
87
|
"@react-stately/toggle": "3.9.1",
|
|
88
|
-
"@storybook/addon-a11y": "9.1.
|
|
89
|
-
"@storybook/addon-docs": "9.1.
|
|
90
|
-
"@storybook/addon-links": "9.1.
|
|
91
|
-
"@storybook/addon-onboarding": "9.1.
|
|
92
|
-
"@storybook/addon-vitest": "9.1.
|
|
93
|
-
"@storybook/react-vite": "9.1.
|
|
88
|
+
"@storybook/addon-a11y": "9.1.10",
|
|
89
|
+
"@storybook/addon-docs": "9.1.10",
|
|
90
|
+
"@storybook/addon-links": "9.1.10",
|
|
91
|
+
"@storybook/addon-onboarding": "9.1.10",
|
|
92
|
+
"@storybook/addon-vitest": "9.1.10",
|
|
93
|
+
"@storybook/react-vite": "9.1.10",
|
|
94
94
|
"@testing-library/dom": "^10.4.1",
|
|
95
|
-
"@testing-library/jest-dom": "6.
|
|
95
|
+
"@testing-library/jest-dom": "6.9.1",
|
|
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.6.0",
|
|
100
|
+
"@types/react": "19.1.15",
|
|
101
101
|
"@types/react-dom": "19.1.9",
|
|
102
102
|
"@types/webpack-env": "1.18.8",
|
|
103
|
-
"@typescript-eslint/utils": "8.
|
|
103
|
+
"@typescript-eslint/utils": "8.44.1",
|
|
104
104
|
"@vanilla-extract/babel-plugin": "1.2.0",
|
|
105
105
|
"@vanilla-extract/css": "1.17.4",
|
|
106
106
|
"@vanilla-extract/dynamic": "2.1.5",
|
|
@@ -110,12 +110,12 @@
|
|
|
110
110
|
"@vanilla-extract/webpack-plugin": "2.3.22",
|
|
111
111
|
"@vitest/browser": "3.2.4",
|
|
112
112
|
"@vitest/coverage-v8": "3.2.4",
|
|
113
|
-
"@vitest/eslint-plugin": "1.3.
|
|
113
|
+
"@vitest/eslint-plugin": "1.3.13",
|
|
114
114
|
"babel-plugin-add-import-extension": "1.6.0",
|
|
115
115
|
"babel-plugin-dev-expression": "0.2.3",
|
|
116
116
|
"babel-plugin-macros": "3.1.0",
|
|
117
|
-
"browserslist-config-autoguru": "2.5.
|
|
118
|
-
"chromatic": "13.
|
|
117
|
+
"browserslist-config-autoguru": "2.5.2",
|
|
118
|
+
"chromatic": "13.3.0",
|
|
119
119
|
"clsx": "2.1.1",
|
|
120
120
|
"colord": "2.9.3",
|
|
121
121
|
"concurrently": "9.2.1",
|
|
@@ -124,16 +124,16 @@
|
|
|
124
124
|
"deepmerge": "4.3.1",
|
|
125
125
|
"es-toolkit": "1.39.10",
|
|
126
126
|
"eslint": "9.34.0",
|
|
127
|
-
"eslint-plugin-storybook": "9.1.
|
|
127
|
+
"eslint-plugin-storybook": "9.1.10",
|
|
128
128
|
"husky": "9.1.7",
|
|
129
129
|
"intersection-observer": "0.12.2",
|
|
130
130
|
"jsdom": "26.1.0",
|
|
131
|
-
"lint-staged": "16.
|
|
131
|
+
"lint-staged": "16.2.3",
|
|
132
132
|
"magic-string": "0.30.19",
|
|
133
133
|
"mini-css-extract-plugin": "2.9.4",
|
|
134
134
|
"mockdate": "3.0.5",
|
|
135
|
-
"playwright": "1.55.
|
|
136
|
-
"plop": "4.0.
|
|
135
|
+
"playwright": "1.55.1",
|
|
136
|
+
"plop": "4.0.4",
|
|
137
137
|
"postcss": "8.5.6",
|
|
138
138
|
"prettier": "3.6.2",
|
|
139
139
|
"prop-types": "15.8.1",
|
|
@@ -148,13 +148,13 @@
|
|
|
148
148
|
"react-stately": "3.41.0",
|
|
149
149
|
"react-swipeable": "7.0.2",
|
|
150
150
|
"rollup-plugin-visualizer": "6.0.3",
|
|
151
|
-
"storybook": "9.1.
|
|
151
|
+
"storybook": "9.1.10",
|
|
152
152
|
"storybook-addon-tag-badges": "2.0.2",
|
|
153
153
|
"typescript": "5.9.2",
|
|
154
154
|
"url-loader": "4.1.1",
|
|
155
|
-
"vite": "7.1.
|
|
155
|
+
"vite": "7.1.7",
|
|
156
156
|
"vitest": "3.2.4",
|
|
157
|
-
"webpack": "5.
|
|
157
|
+
"webpack": "5.102.0"
|
|
158
158
|
},
|
|
159
159
|
"peerDependencies": {
|
|
160
160
|
"@autoguru/icons": ">=1.8.8",
|
|
@@ -177,8 +177,8 @@
|
|
|
177
177
|
"webpack": "*"
|
|
178
178
|
},
|
|
179
179
|
"volta": {
|
|
180
|
-
"node": "22.
|
|
181
|
-
"yarn": "4.
|
|
180
|
+
"node": "22.20.0",
|
|
181
|
+
"yarn": "4.10.3"
|
|
182
182
|
},
|
|
183
|
-
"packageManager": "yarn@4.
|
|
183
|
+
"packageManager": "yarn@4.10.3"
|
|
184
184
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DateTimePicker.css.d.ts","sourceRoot":"","sources":["../../../lib/components/DateTimePicker/DateTimePicker.css.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,cAAc,QAAoB,CAAC;AAChD,eAAO,MAAM,mBAAmB,QAO9B,CAAC;AAEH,eAAO,MAAM,WAAW,QAWtB,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import * as __vanilla_filescope__ from '@vanilla-extract/css/fileScope';
|
|
4
|
-
__vanilla_filescope__.setFileScope("lib/components/DateTimePicker/DateTimePicker.css.ts", "@autoguru/overdrive");
|
|
5
|
-
import { createContainer, style } from '@vanilla-extract/css';
|
|
6
|
-
import { cssLayerComponent } from "../../styles/layers.css.js";
|
|
7
|
-
import { breakpoints } from "../../themes/makeTheme.js";
|
|
8
|
-
import { overdriveTokens as tokens } from "../../themes/theme.css.js"; // === Container styles
|
|
9
|
-
export const queryContainer = createContainer("queryContainer");
|
|
10
|
-
export const queryContainerStyle = style({
|
|
11
|
-
'@layer': {
|
|
12
|
-
[cssLayerComponent]: {
|
|
13
|
-
containerName: queryContainer,
|
|
14
|
-
containerType: 'inline-size'
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}, "queryContainerStyle");
|
|
18
|
-
export const layoutStyle = style({
|
|
19
|
-
'@layer': {
|
|
20
|
-
[cssLayerComponent]: {
|
|
21
|
-
'@container': {
|
|
22
|
-
[`${queryContainer} (min-width: ${breakpoints.tablet})`]: {
|
|
23
|
-
display: 'flex',
|
|
24
|
-
gap: tokens.space[7]
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}, "layoutStyle");
|
|
30
|
-
__vanilla_filescope__.endFileScope();
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type AriaCalendarProps, type DateValue } from 'react-aria';
|
|
3
|
-
import type { TestIdProp } from '../../types';
|
|
4
|
-
import { type OptionGridProps, type OptionItem } from '../OptionGrid/OptionGrid';
|
|
5
|
-
declare const defaultEnglish: {
|
|
6
|
-
readonly dateLabel: "Date";
|
|
7
|
-
readonly timeLabel: "Time";
|
|
8
|
-
readonly nextLabel: "Next month";
|
|
9
|
-
readonly prevLabel: "Previous month";
|
|
10
|
-
};
|
|
11
|
-
type LangContent = keyof typeof defaultEnglish;
|
|
12
|
-
export type DateAndOption = {
|
|
13
|
-
date: DateValue;
|
|
14
|
-
timeOption: string;
|
|
15
|
-
};
|
|
16
|
-
export interface DateTimePickerProps<D extends DateValue> extends TestIdProp {
|
|
17
|
-
/**
|
|
18
|
-
* A title for the date/time selection
|
|
19
|
-
*/
|
|
20
|
-
title?: string;
|
|
21
|
-
/**
|
|
22
|
-
* Calendar props passed through to the react-aria hook
|
|
23
|
-
* ([docs](https://react-spectrum.adobe.com/react-aria/useCalendar.html))
|
|
24
|
-
*
|
|
25
|
-
* *Defaults*
|
|
26
|
-
* - `defaultValue`: Today's date
|
|
27
|
-
* - `firstDayOfWeek`: Monday
|
|
28
|
-
*/
|
|
29
|
-
calendarOptions?: Exclude<AriaCalendarProps<D>, 'onChange'>;
|
|
30
|
-
/**
|
|
31
|
-
* `OptionGrid` props used to generate the time picker items. Ensure to include a descriptive `label` value (for
|
|
32
|
-
* assistive technology). Currently time options are not tied to the day selection.
|
|
33
|
-
*/
|
|
34
|
-
timeOptions: OptionGridProps<OptionItem>;
|
|
35
|
-
/**
|
|
36
|
-
* Allow date in the past
|
|
37
|
-
*/
|
|
38
|
-
allowPastDate?: boolean;
|
|
39
|
-
/**
|
|
40
|
-
* Custom event handler return value when a date and time are both selected, return a value
|
|
41
|
-
* `{ date: DateValue, timeOption: string }` where `DateValue` comes from react-aria
|
|
42
|
-
*
|
|
43
|
-
* @returns `{ date: DateValue, timeOption: string }`
|
|
44
|
-
*/
|
|
45
|
-
onChange?: (value: DateAndOption) => void;
|
|
46
|
-
/**
|
|
47
|
-
* Language content override
|
|
48
|
-
*/
|
|
49
|
-
lang?: Partial<Record<LangContent, string>>;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* DateTimePicker component for selecting a date and time. The primary use case is for selecting a date and time for
|
|
53
|
-
* the vehicle to be left at the place of service, not scheduling the time of the service itself. Some suppliers
|
|
54
|
-
* may need the option to book a specficic time based on their availability which could require enahcement.
|
|
55
|
-
*
|
|
56
|
-
* For all date/time handling `@internationalized/date` is expected by react-aria. Presently only the Gregorian
|
|
57
|
-
* calendar is imported for use in order to minimise bundle size. It is recommended to use the the DateTimePicker
|
|
58
|
-
* uncontrolled.
|
|
59
|
-
*
|
|
60
|
-
* This component implements the react-aria `useCalendar` hook and supports controlled state as well
|
|
61
|
-
* ([docs](https://react-spectrum.adobe.com/react-aria/useCalendar.html))
|
|
62
|
-
*/
|
|
63
|
-
export declare const DateTimePicker: {
|
|
64
|
-
<D extends DateValue>({ allowPastDate, calendarOptions, lang, onChange, timeOptions, title, testId, }: DateTimePickerProps<D>): React.JSX.Element;
|
|
65
|
-
displayName: string;
|
|
66
|
-
};
|
|
67
|
-
export {};
|
|
68
|
-
//# sourceMappingURL=DateTimePicker.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DateTimePicker.d.ts","sourceRoot":"","sources":["../../../lib/components/DateTimePicker/DateTimePicker.tsx"],"names":[],"mappings":"AACA,OAAO,KAAiB,MAAM,OAAO,CAAC;AACtC,OAAO,EAAS,KAAK,iBAAiB,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAI3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAI9C,OAAO,EAEN,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,MAAM,0BAA0B,CAAC;AAIlC,QAAA,MAAM,cAAc;;;;;CAKV,CAAC;AAEX,KAAK,WAAW,GAAG,MAAM,OAAO,cAAc,CAAC;AAC/C,MAAM,MAAM,aAAa,GAAG;IAC3B,IAAI,EAAE,SAAS,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,SAAS,CAAE,SAAQ,UAAU;IAC3E;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;IAC5D;;;OAGG;IACH,WAAW,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC;IACzC;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC1C;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;CAC5C;AAQD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,cAAc;KAAI,CAAC,SAAS,SAAS,mFAQ/C,mBAAmB,CAAC,CAAC,CAAC;;CA+ExB,CAAC"}
|
|
@@ -1,130 +0,0 @@
|
|
|
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 { getLocalTimeZone, today } from '@internationalized/date';
|
|
7
|
-
import React, { useRef } from 'react';
|
|
8
|
-
import { useId } from 'react-aria';
|
|
9
|
-
import { sprinkles } from "../../styles/sprinkles.css.js";
|
|
10
|
-
import { dataAttrs } from "../../utils/dataAttrs.js";
|
|
11
|
-
import { Calendar } from "../Calendar/index.js";
|
|
12
|
-
import { Heading } from "../Heading/index.js";
|
|
13
|
-
import { OptionGrid } from "../OptionGrid/OptionGrid.js";
|
|
14
|
-
import { layoutStyle, queryContainerStyle } from "./DateTimePicker.css.js";
|
|
15
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
-
const defaultEnglish = {
|
|
17
|
-
dateLabel: 'Date',
|
|
18
|
-
timeLabel: 'Time',
|
|
19
|
-
nextLabel: 'Next month',
|
|
20
|
-
prevLabel: 'Previous month'
|
|
21
|
-
};
|
|
22
|
-
// const dateTextPunctuationEN = (text: string) =>
|
|
23
|
-
// text
|
|
24
|
-
// .split(' ')
|
|
25
|
-
// .map((word, idx) => (idx === 0 ? `${word},` : word))
|
|
26
|
-
// .join(' ');
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* DateTimePicker component for selecting a date and time. The primary use case is for selecting a date and time for
|
|
30
|
-
* the vehicle to be left at the place of service, not scheduling the time of the service itself. Some suppliers
|
|
31
|
-
* may need the option to book a specficic time based on their availability which could require enahcement.
|
|
32
|
-
*
|
|
33
|
-
* For all date/time handling `@internationalized/date` is expected by react-aria. Presently only the Gregorian
|
|
34
|
-
* calendar is imported for use in order to minimise bundle size. It is recommended to use the the DateTimePicker
|
|
35
|
-
* uncontrolled.
|
|
36
|
-
*
|
|
37
|
-
* This component implements the react-aria `useCalendar` hook and supports controlled state as well
|
|
38
|
-
* ([docs](https://react-spectrum.adobe.com/react-aria/useCalendar.html))
|
|
39
|
-
*/
|
|
40
|
-
export const DateTimePicker = ({
|
|
41
|
-
allowPastDate = false,
|
|
42
|
-
calendarOptions,
|
|
43
|
-
lang,
|
|
44
|
-
onChange,
|
|
45
|
-
timeOptions,
|
|
46
|
-
title,
|
|
47
|
-
testId
|
|
48
|
-
}) => {
|
|
49
|
-
var _lang$dateLabel, _lang$timeLabel;
|
|
50
|
-
const selectedDate = useRef(today(getLocalTimeZone()));
|
|
51
|
-
const selectedTimeOption = useRef(null);
|
|
52
|
-
const handleChange = () => {
|
|
53
|
-
var _selectedTimeOption$c;
|
|
54
|
-
if (selectedDate.current && (_selectedTimeOption$c = selectedTimeOption.current) !== null && _selectedTimeOption$c !== void 0 && _selectedTimeOption$c.length) {
|
|
55
|
-
onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
56
|
-
date: selectedDate.current,
|
|
57
|
-
timeOption: selectedTimeOption.current
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
const handleDateChange = value => {
|
|
62
|
-
selectedDate.current = value;
|
|
63
|
-
handleChange();
|
|
64
|
-
};
|
|
65
|
-
const handleTimeChange = keys => {
|
|
66
|
-
if (keys === 'all') return;
|
|
67
|
-
// we expect only a single value for time picker
|
|
68
|
-
const time = keys.values().next().value;
|
|
69
|
-
selectedTimeOption.current = time;
|
|
70
|
-
handleChange();
|
|
71
|
-
};
|
|
72
|
-
const optionGridComponentProps = _objectSpread({
|
|
73
|
-
columns: '3',
|
|
74
|
-
onSelectionChange: handleTimeChange,
|
|
75
|
-
indicator: 'none',
|
|
76
|
-
selectionMode: 'single',
|
|
77
|
-
disallowEmptySelection: true
|
|
78
|
-
}, timeOptions);
|
|
79
|
-
const titleId = useId();
|
|
80
|
-
|
|
81
|
-
// Create calendar lang props from our lang props
|
|
82
|
-
const calendarLang = lang ? {
|
|
83
|
-
nextLabel: lang.nextLabel,
|
|
84
|
-
prevLabel: lang.prevLabel
|
|
85
|
-
} : undefined;
|
|
86
|
-
return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
|
|
87
|
-
role: "group",
|
|
88
|
-
"aria-labelledby": titleId,
|
|
89
|
-
className: queryContainerStyle
|
|
90
|
-
}, dataAttrs({
|
|
91
|
-
testid: testId
|
|
92
|
-
})), {}, {
|
|
93
|
-
children: [title && /*#__PURE__*/_jsx(Heading, {
|
|
94
|
-
as: "h2",
|
|
95
|
-
id: titleId,
|
|
96
|
-
mb: "6",
|
|
97
|
-
size: "8",
|
|
98
|
-
children: title
|
|
99
|
-
}), /*#__PURE__*/_jsxs("div", {
|
|
100
|
-
className: layoutStyle,
|
|
101
|
-
children: [/*#__PURE__*/_jsxs("div", {
|
|
102
|
-
className: sprinkles({
|
|
103
|
-
flexShrink: '0'
|
|
104
|
-
}),
|
|
105
|
-
children: [/*#__PURE__*/_jsx(Heading, {
|
|
106
|
-
as: "h3",
|
|
107
|
-
mb: "4",
|
|
108
|
-
size: "6",
|
|
109
|
-
children: (_lang$dateLabel = lang === null || lang === void 0 ? void 0 : lang.dateLabel) !== null && _lang$dateLabel !== void 0 ? _lang$dateLabel : defaultEnglish.dateLabel
|
|
110
|
-
}), /*#__PURE__*/_jsx(Calendar, {
|
|
111
|
-
allowPastDate: allowPastDate,
|
|
112
|
-
calendarOptions: calendarOptions,
|
|
113
|
-
lang: calendarLang,
|
|
114
|
-
onChange: handleDateChange
|
|
115
|
-
})]
|
|
116
|
-
}), /*#__PURE__*/_jsxs("div", {
|
|
117
|
-
className: sprinkles({
|
|
118
|
-
flexGrow: '1'
|
|
119
|
-
}),
|
|
120
|
-
children: [/*#__PURE__*/_jsx(Heading, {
|
|
121
|
-
as: "h3",
|
|
122
|
-
mb: "4",
|
|
123
|
-
size: "6",
|
|
124
|
-
children: (_lang$timeLabel = lang === null || lang === void 0 ? void 0 : lang.timeLabel) !== null && _lang$timeLabel !== void 0 ? _lang$timeLabel : defaultEnglish.timeLabel
|
|
125
|
-
}), /*#__PURE__*/_jsx(OptionGrid, _objectSpread({}, optionGridComponentProps))]
|
|
126
|
-
})]
|
|
127
|
-
})]
|
|
128
|
-
}));
|
|
129
|
-
};
|
|
130
|
-
DateTimePicker.displayName = 'DateTimePicker';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../../lib/components/DateTimePicker/default.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,IAAI,OAAO,EAAE,MAAM,kBAAkB,CAAC"}
|