@autoguru/overdrive 4.49.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/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -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 +10 -10
- 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
|
@@ -39,19 +39,22 @@ export const PopoverTrigger = ({
|
|
|
39
39
|
shouldFlip,
|
|
40
40
|
testId,
|
|
41
41
|
lang,
|
|
42
|
+
ref,
|
|
42
43
|
onStateReady
|
|
43
44
|
}) => {
|
|
44
45
|
const state = useOverlayTriggerState({});
|
|
45
|
-
const
|
|
46
|
+
const internalRef = useRef(null);
|
|
47
|
+
const triggerRef = ref !== null && ref !== void 0 ? ref : internalRef;
|
|
46
48
|
|
|
47
49
|
// Provide state access to parent component
|
|
48
50
|
React.useEffect(() => {
|
|
49
51
|
if (onStateReady) {
|
|
50
52
|
onStateReady({
|
|
51
|
-
close: state.close
|
|
53
|
+
close: state.close,
|
|
54
|
+
isOpen: state.isOpen
|
|
52
55
|
});
|
|
53
56
|
}
|
|
54
|
-
}, [onStateReady, state.close]);
|
|
57
|
+
}, [onStateReady, state.close, state.isOpen]);
|
|
55
58
|
const {
|
|
56
59
|
triggerProps,
|
|
57
60
|
overlayProps
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,0BAA0B,CAAC;AACzC,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cA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zB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC"}
|
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";
|
|
@@ -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,14 +85,14 @@
|
|
|
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",
|
|
@@ -124,7 +124,7 @@
|
|
|
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",
|
|
@@ -148,7 +148,7 @@
|
|
|
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",
|
|
@@ -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"}
|