@autoguru/overdrive 4.16.0 → 4.17.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/DatePicker/DatePicker.css.d.ts +1 -0
- package/dist/components/DatePicker/DatePicker.css.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePicker.css.js +15 -2
- package/dist/components/DatePicker/DatePicker.d.ts +2 -0
- package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePicker.js +25 -12
- package/dist/components/DatePicker/stories.js +21 -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":"
|
|
1
|
+
{"version":3,"file":"DatePicker.css.d.ts","sourceRoot":"","sources":["../../../lib/components/DatePicker/DatePicker.css.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,KAAK,QAqBhB,CAAC;AAGH,eAAO,MAAM,QAAQ,yCAWnB,CAAC;AACH,eAAO,MAAM,QAAQ,oCAOnB,CAAC;AAEH,eAAO,MAAM,OAAO,QAIlB,CAAC"}
|
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
import * as __vanilla_filescope__ from '@vanilla-extract/css/fileScope';
|
|
4
4
|
__vanilla_filescope__.setFileScope("lib/components/DatePicker/DatePicker.css.ts", "@autoguru/overdrive");
|
|
5
5
|
import { style, styleVariants } from '@vanilla-extract/css';
|
|
6
|
+
import { themeContractVars as vars } from "../../themes/theme.css.js";
|
|
6
7
|
export const input = style({
|
|
7
8
|
top: 0,
|
|
8
9
|
right: 0,
|
|
10
|
+
bottom: 0,
|
|
11
|
+
left: 0,
|
|
9
12
|
opacity: 0,
|
|
10
13
|
cursor: 'pointer',
|
|
11
|
-
display: 'grid',
|
|
12
|
-
gridTemplateColumns: 'auto 50px',
|
|
13
14
|
selectors: {
|
|
14
15
|
'&::-webkit-calendar-picker-indicator': {
|
|
15
16
|
background: 'transparent',
|
|
@@ -25,6 +26,18 @@ export const input = style({
|
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
28
|
}, "input");
|
|
29
|
+
export const contents = styleVariants({
|
|
30
|
+
default: {
|
|
31
|
+
display: 'grid',
|
|
32
|
+
gridTemplateColumns: 'auto',
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
justifyContent: 'flex-start',
|
|
35
|
+
gridGap: vars.space['1']
|
|
36
|
+
},
|
|
37
|
+
withLabel: {
|
|
38
|
+
gridTemplateColumns: 'auto auto'
|
|
39
|
+
}
|
|
40
|
+
}, "contents");
|
|
28
41
|
export const disabled = styleVariants({
|
|
29
42
|
default: {
|
|
30
43
|
cursor: 'not-allowed'
|
|
@@ -2,10 +2,12 @@ import { IconType } from '@autoguru/icons';
|
|
|
2
2
|
import { ComponentProps, FunctionComponent } from 'react';
|
|
3
3
|
import { Icon } from '../Icon';
|
|
4
4
|
export interface Props extends Partial<Pick<HTMLInputElement, 'min' | 'max' | 'value'>>, Pick<ComponentProps<typeof Icon>, 'size'> {
|
|
5
|
+
size: 'small' | 'medium' | 'large';
|
|
5
6
|
className?: string;
|
|
6
7
|
disabled?: boolean;
|
|
7
8
|
icon?: IconType;
|
|
8
9
|
isLoading?: boolean;
|
|
10
|
+
valueLabel?: string;
|
|
9
11
|
onChange(date: string): any;
|
|
10
12
|
}
|
|
11
13
|
export declare const DatePicker: FunctionComponent<Props>;
|
|
@@ -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;
|
|
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;AAGvE,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,IAAI,EAAE,OAAO,GAAC,QAAQ,GAAC,OAAO,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,QAAQ,CAAC,IAAI,EAAE,MAAM,OAAE;CACvB;AAOD,eAAO,MAAM,UAAU,EAAE,iBAAiB,CAAC,KAAK,CAsE/C,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -2,20 +2,24 @@
|
|
|
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 = ["className", "icon", "size", "disabled", "isLoading", "onChange"];
|
|
5
|
+
const _excluded = ["className", "icon", "size", "disabled", "isLoading", "valueLabel", "onChange"];
|
|
6
6
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
7
7
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8
8
|
import { CalendarIcon } from '@autoguru/icons';
|
|
9
9
|
import clsx from 'clsx';
|
|
10
10
|
import * as React from 'react';
|
|
11
|
-
import { resolveResponsiveStyle } from "../../utils/resolveResponsiveProps.js";
|
|
12
11
|
import { Box, useBoxStyles } from "../Box/index.js";
|
|
13
12
|
import { Icon } from "../Icon/index.js";
|
|
14
|
-
import * as iconStyles from "../Icon/Icon.css.js";
|
|
15
13
|
import { ProgressSpinner } from "../ProgressSpinner/index.js";
|
|
14
|
+
import { Text } from "../Text/index.js";
|
|
16
15
|
import * as styles from "./DatePicker.css.js";
|
|
17
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
17
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
|
+
const textSizeMap = {
|
|
19
|
+
small: '2',
|
|
20
|
+
medium: '3',
|
|
21
|
+
large: '5'
|
|
22
|
+
};
|
|
19
23
|
export const DatePicker = _ref => {
|
|
20
24
|
let {
|
|
21
25
|
className = '',
|
|
@@ -23,6 +27,7 @@ export const DatePicker = _ref => {
|
|
|
23
27
|
size = 'medium',
|
|
24
28
|
disabled = false,
|
|
25
29
|
isLoading = false,
|
|
30
|
+
valueLabel,
|
|
26
31
|
onChange
|
|
27
32
|
} = _ref,
|
|
28
33
|
inputProps = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -34,7 +39,7 @@ export const DatePicker = _ref => {
|
|
|
34
39
|
return _jsxs(Box, {
|
|
35
40
|
position: "relative",
|
|
36
41
|
overflow: "hidden",
|
|
37
|
-
className: clsx(
|
|
42
|
+
className: clsx(className, {
|
|
38
43
|
[styles.disabled.default]: disabled,
|
|
39
44
|
[styles.disabled.root]: disabled
|
|
40
45
|
}),
|
|
@@ -49,14 +54,22 @@ export const DatePicker = _ref => {
|
|
|
49
54
|
[styles.disabled.default]: disabled
|
|
50
55
|
}, styles.input),
|
|
51
56
|
type: "date"
|
|
52
|
-
}, inputProps)),
|
|
53
|
-
className: clsx(styles.
|
|
54
|
-
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
}, inputProps)), _jsxs(Box, {
|
|
58
|
+
className: clsx(styles.contents.default, {
|
|
59
|
+
[styles.contents.withLabel]: Boolean(valueLabel)
|
|
60
|
+
}),
|
|
61
|
+
children: [isLoading ? _jsx(ProgressSpinner, {
|
|
62
|
+
className: clsx(styles.spinner, useBoxStyles({
|
|
63
|
+
position: 'absolute'
|
|
64
|
+
})),
|
|
65
|
+
size: size
|
|
66
|
+
}) : _jsx(Icon, {
|
|
67
|
+
icon: icon,
|
|
68
|
+
size: size
|
|
69
|
+
}), valueLabel && _jsx(Text, {
|
|
70
|
+
size: textSizeMap[size],
|
|
71
|
+
children: valueLabel
|
|
72
|
+
})]
|
|
60
73
|
})]
|
|
61
74
|
});
|
|
62
75
|
};
|
|
@@ -5,6 +5,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
5
5
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
6
|
import { AccountEditIcon, AlertCircleIcon, CalendarIcon, CarIcon, CarMultipleIcon, CheckIcon, CurrencyUsdIcon, MagnifyIcon, PlusIcon, StarIcon } from '@autoguru/icons';
|
|
7
7
|
import * as React from 'react';
|
|
8
|
+
import { Box } from "../Box/index.js";
|
|
8
9
|
import { DatePicker } from "./index.js";
|
|
9
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
11
|
const iconOptions = {
|
|
@@ -40,7 +41,10 @@ export default {
|
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
43
|
};
|
|
43
|
-
const Template = args => _jsx(
|
|
44
|
+
const Template = args => _jsx(Box, {
|
|
45
|
+
display: "flex",
|
|
46
|
+
children: _jsx(DatePicker, _objectSpread({}, args))
|
|
47
|
+
});
|
|
44
48
|
const standardProps = {
|
|
45
49
|
isLoading: false,
|
|
46
50
|
disabled: false
|
|
@@ -54,6 +58,11 @@ const smallProps = {
|
|
|
54
58
|
};
|
|
55
59
|
export const small = Template.bind(smallProps);
|
|
56
60
|
small.args = smallProps;
|
|
61
|
+
const smallWithLabelProps = _objectSpread(_objectSpread({}, smallProps), {}, {
|
|
62
|
+
valueLabel: 'Today'
|
|
63
|
+
});
|
|
64
|
+
export const smallWithLabel = Template.bind(smallWithLabelProps);
|
|
65
|
+
smallWithLabel.args = smallWithLabelProps;
|
|
57
66
|
const mediumProps = {
|
|
58
67
|
size: 'medium',
|
|
59
68
|
isLoading: false,
|
|
@@ -61,10 +70,20 @@ const mediumProps = {
|
|
|
61
70
|
};
|
|
62
71
|
export const medium = Template.bind(mediumProps);
|
|
63
72
|
medium.args = mediumProps;
|
|
73
|
+
const mediumWithLabelProps = _objectSpread(_objectSpread({}, mediumProps), {}, {
|
|
74
|
+
valueLabel: 'Today'
|
|
75
|
+
});
|
|
76
|
+
export const mediumWithLabel = Template.bind(mediumWithLabelProps);
|
|
77
|
+
mediumWithLabel.args = mediumWithLabelProps;
|
|
64
78
|
const largeProps = {
|
|
65
79
|
size: 'large',
|
|
66
80
|
isLoading: false,
|
|
67
81
|
disabled: false
|
|
68
82
|
};
|
|
69
83
|
export const large = Template.bind(largeProps);
|
|
70
|
-
large.args = largeProps;
|
|
84
|
+
large.args = largeProps;
|
|
85
|
+
const largeWithLabelProps = _objectSpread(_objectSpread({}, largeProps), {}, {
|
|
86
|
+
valueLabel: 'Today'
|
|
87
|
+
});
|
|
88
|
+
export const largeWithLabel = Template.bind(largeWithLabelProps);
|
|
89
|
+
largeWithLabel.args = largeWithLabelProps;
|