@autoguru/overdrive 4.5.0 → 4.5.1
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 +2 -1
- package/dist/components/DatePicker/DatePicker.css.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePicker.css.js +13 -4
- package/dist/components/DatePicker/DatePicker.d.ts +3 -2
- package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePicker.js +13 -5
- package/dist/components/DatePicker/stories.js +26 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePicker.css.d.ts","sourceRoot":"","sources":["../../../lib/components/DatePicker/DatePicker.css.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,QAqBhB,CAAC;AACH,eAAO,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"DatePicker.css.d.ts","sourceRoot":"","sources":["../../../lib/components/DatePicker/DatePicker.css.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,QAqBhB,CAAC;AACH,eAAO,MAAM,QAAQ,oCAOnB,CAAC;AAEH,eAAO,MAAM,OAAO,QAIlB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { style } from '@vanilla-extract/css';
|
|
1
|
+
import { style, styleVariants } from '@vanilla-extract/css';
|
|
2
2
|
export const input = style({
|
|
3
3
|
top: 0,
|
|
4
4
|
right: 0,
|
|
@@ -21,7 +21,16 @@ export const input = style({
|
|
|
21
21
|
},
|
|
22
22
|
},
|
|
23
23
|
});
|
|
24
|
-
export const disabled =
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
export const disabled = styleVariants({
|
|
25
|
+
default: {
|
|
26
|
+
cursor: 'not-allowed',
|
|
27
|
+
},
|
|
28
|
+
root: {
|
|
29
|
+
opacity: '0.3',
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
export const spinner = style({
|
|
33
|
+
top: '50%',
|
|
34
|
+
left: '50%',
|
|
35
|
+
transform: 'translate(-50%, -50%)',
|
|
27
36
|
});
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { IconType } from '@autoguru/icons';
|
|
2
2
|
import { ComponentProps, FunctionComponent } from 'react';
|
|
3
3
|
import { Icon } from '../Icon';
|
|
4
|
-
export interface Props extends Pick<HTMLInputElement, 'min' | 'max' | 'value'
|
|
4
|
+
export interface Props extends Partial<Pick<HTMLInputElement, 'min' | 'max' | 'value'>>, Pick<ComponentProps<typeof Icon>, 'size'> {
|
|
5
5
|
className?: string;
|
|
6
6
|
disabled?: boolean;
|
|
7
|
-
onChange(date: string): any;
|
|
8
7
|
icon?: IconType;
|
|
8
|
+
isLoading?: boolean;
|
|
9
|
+
onChange(date: string): any;
|
|
9
10
|
}
|
|
10
11
|
export declare const DatePicker: FunctionComponent<Props>;
|
|
11
12
|
//# sourceMappingURL=DatePicker.d.ts.map
|
|
@@ -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;AAGzD,OAAO,EAAe,cAAc,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAIvE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../lib/components/DatePicker/DatePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgB,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAGzD,OAAO,EAAe,cAAc,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAIvE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAM/B,MAAM,WAAW,KAChB,SAAQ,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,KAAK,GAAG,KAAK,GAAG,OAAO,CAAC,CAAC,EAC/D,IAAI,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,EAAE,MAAM,CAAC;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,QAAQ,CAAC,IAAI,EAAE,MAAM,OAAE;CACvB;AAED,eAAO,MAAM,UAAU,EAAE,iBAAiB,CAAC,KAAK,CA2D/C,CAAC"}
|
|
@@ -2,17 +2,25 @@ import { CalendarIcon } from '@autoguru/icons';
|
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { resolveResponsiveStyle } from '../../utils/resolveResponsiveProps';
|
|
5
|
-
import { Box } from '../Box';
|
|
5
|
+
import { Box, useBoxStyles } from '../Box';
|
|
6
6
|
import { Icon } from '../Icon';
|
|
7
7
|
import * as iconStyles from '../Icon/Icon.css';
|
|
8
|
+
import { ProgressSpinner } from '../ProgressSpinner';
|
|
8
9
|
import * as styles from './DatePicker.css';
|
|
9
|
-
export const DatePicker = ({ className = '', icon = CalendarIcon, size = 'medium', disabled = false, onChange, ...inputProps }) => {
|
|
10
|
+
export const DatePicker = ({ className = '', icon = CalendarIcon, size = 'medium', disabled = false, isLoading = false, onChange, ...inputProps }) => {
|
|
10
11
|
const onChangeEvent = (event) => {
|
|
11
12
|
if (typeof onChange === 'function') {
|
|
12
13
|
onChange(event.currentTarget.value);
|
|
13
14
|
}
|
|
14
15
|
};
|
|
15
|
-
return (React.createElement(Box, { position: "relative", overflow: "hidden", className: clsx(resolveResponsiveStyle(size, iconStyles.size), className, {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
return (React.createElement(Box, { position: "relative", overflow: "hidden", className: clsx(resolveResponsiveStyle(size, iconStyles.size), className, {
|
|
17
|
+
[styles.disabled.default]: disabled,
|
|
18
|
+
[styles.disabled.root]: disabled,
|
|
19
|
+
}) },
|
|
20
|
+
React.createElement(Box, { position: "absolute", height: "full", width: "full", is: "input", disabled: disabled, onChange: onChangeEvent, className: clsx({
|
|
21
|
+
[styles.disabled.default]: disabled,
|
|
22
|
+
}, styles.input), type: "date", ...inputProps }),
|
|
23
|
+
isLoading ? (React.createElement(ProgressSpinner, { className: clsx(styles.spinner, useBoxStyles({
|
|
24
|
+
position: 'absolute',
|
|
25
|
+
})), size: size })) : (React.createElement(Icon, { icon: icon, size: size }))));
|
|
18
26
|
};
|
|
@@ -46,6 +46,30 @@ export default {
|
|
|
46
46
|
|
|
47
47
|
const Template = args => _jsx(DatePicker, _objectSpread({}, args));
|
|
48
48
|
|
|
49
|
-
const standardProps = {
|
|
49
|
+
const standardProps = {
|
|
50
|
+
isLoading: false,
|
|
51
|
+
disabled: false
|
|
52
|
+
};
|
|
50
53
|
export const standard = Template.bind(standardProps);
|
|
51
|
-
standard.args = standardProps;
|
|
54
|
+
standard.args = standardProps;
|
|
55
|
+
const smallProps = {
|
|
56
|
+
size: 'small',
|
|
57
|
+
isLoading: false,
|
|
58
|
+
disabled: false
|
|
59
|
+
};
|
|
60
|
+
export const small = Template.bind(smallProps);
|
|
61
|
+
small.args = smallProps;
|
|
62
|
+
const mediumProps = {
|
|
63
|
+
size: 'medium',
|
|
64
|
+
isLoading: false,
|
|
65
|
+
disabled: false
|
|
66
|
+
};
|
|
67
|
+
export const medium = Template.bind(mediumProps);
|
|
68
|
+
medium.args = mediumProps;
|
|
69
|
+
const largeProps = {
|
|
70
|
+
size: 'large',
|
|
71
|
+
isLoading: false,
|
|
72
|
+
disabled: false
|
|
73
|
+
};
|
|
74
|
+
export const large = Template.bind(largeProps);
|
|
75
|
+
large.args = largeProps;
|