@autoguru/overdrive 4.4.4 → 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.
@@ -0,0 +1,4 @@
1
+ export declare const input: string;
2
+ export declare const disabled: Record<"default" | "root", string>;
3
+ export declare const spinner: string;
4
+ //# sourceMappingURL=DatePicker.css.d.ts.map
@@ -0,0 +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,oCAOnB,CAAC;AAEH,eAAO,MAAM,OAAO,QAIlB,CAAC"}
@@ -0,0 +1,36 @@
1
+ import { style, styleVariants } from '@vanilla-extract/css';
2
+ export const input = style({
3
+ top: 0,
4
+ right: 0,
5
+ opacity: 0,
6
+ cursor: 'pointer',
7
+ display: 'grid',
8
+ gridTemplateColumns: 'auto 50px',
9
+ selectors: {
10
+ '&::-webkit-calendar-picker-indicator': {
11
+ background: 'transparent',
12
+ bottom: 0,
13
+ color: 'transparent',
14
+ cursor: 'pointer',
15
+ height: 'auto',
16
+ left: 0,
17
+ position: 'absolute',
18
+ right: 0,
19
+ top: 0,
20
+ width: 'auto',
21
+ },
22
+ },
23
+ });
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%)',
36
+ });
@@ -0,0 +1,12 @@
1
+ import { IconType } from '@autoguru/icons';
2
+ import { ComponentProps, FunctionComponent } from 'react';
3
+ import { Icon } from '../Icon';
4
+ export interface Props extends Partial<Pick<HTMLInputElement, 'min' | 'max' | 'value'>>, Pick<ComponentProps<typeof Icon>, 'size'> {
5
+ className?: string;
6
+ disabled?: boolean;
7
+ icon?: IconType;
8
+ isLoading?: boolean;
9
+ onChange(date: string): any;
10
+ }
11
+ export declare const DatePicker: FunctionComponent<Props>;
12
+ //# sourceMappingURL=DatePicker.d.ts.map
@@ -0,0 +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;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"}
@@ -0,0 +1,26 @@
1
+ import { CalendarIcon } from '@autoguru/icons';
2
+ import clsx from 'clsx';
3
+ import * as React from 'react';
4
+ import { resolveResponsiveStyle } from '../../utils/resolveResponsiveProps';
5
+ import { Box, useBoxStyles } from '../Box';
6
+ import { Icon } from '../Icon';
7
+ import * as iconStyles from '../Icon/Icon.css';
8
+ import { ProgressSpinner } from '../ProgressSpinner';
9
+ import * as styles from './DatePicker.css';
10
+ export const DatePicker = ({ className = '', icon = CalendarIcon, size = 'medium', disabled = false, isLoading = false, onChange, ...inputProps }) => {
11
+ const onChangeEvent = (event) => {
12
+ if (typeof onChange === 'function') {
13
+ onChange(event.currentTarget.value);
14
+ }
15
+ };
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 }))));
26
+ };
@@ -0,0 +1,2 @@
1
+ export { DatePicker } from './DatePicker';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/components/DatePicker/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1 @@
1
+ export { DatePicker } from './DatePicker';
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+
3
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
4
+
5
+ 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; }
6
+
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
+
9
+ import { AccountEditIcon, AlertCircleIcon, CalendarIcon, CarIcon, CarMultipleIcon, CheckIcon, CurrencyUsdIcon, MagnifyIcon, PlusIcon, StarIcon } from '@autoguru/icons';
10
+ import * as React from 'react';
11
+ import { DatePicker } from "./index.js";
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ const iconOptions = {
14
+ MagnifyIcon,
15
+ CarIcon,
16
+ CarMultipleIcon,
17
+ CalendarIcon,
18
+ AccountEditIcon,
19
+ AlertCircleIcon,
20
+ CurrencyUsdIcon,
21
+ PlusIcon,
22
+ StarIcon,
23
+ CheckIcon
24
+ };
25
+ export default {
26
+ title: 'Components/DatePicker',
27
+ component: DatePicker,
28
+ decorators: [],
29
+ argTypes: {
30
+ icon: {
31
+ defaultValue: void 0,
32
+ description: 'Input field Icon',
33
+ options: iconOptions,
34
+ control: {
35
+ type: 'select'
36
+ }
37
+ },
38
+ size: {
39
+ options: ['small', 'medium', 'large'],
40
+ control: {
41
+ type: 'select'
42
+ }
43
+ }
44
+ }
45
+ };
46
+
47
+ const Template = args => _jsx(DatePicker, _objectSpread({}, args));
48
+
49
+ const standardProps = {
50
+ isLoading: false,
51
+ disabled: false
52
+ };
53
+ export const standard = Template.bind(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;
@@ -1 +1 @@
1
- {"version":3,"file":"Tab.d.ts","sourceRoot":"","sources":["../../../lib/components/Tabs/Tab.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAGN,WAAW,EAGX,YAAY,EACZ,SAAS,EAET,MAAM,OAAO,CAAC;AAUf,MAAM,WAAW,KAAK;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,WAAW,GAAG,YAAY,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,GAAG,8EA0Ff,CAAC"}
1
+ {"version":3,"file":"Tab.d.ts","sourceRoot":"","sources":["../../../lib/components/Tabs/Tab.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAGN,WAAW,EAGX,YAAY,EACZ,SAAS,EAET,MAAM,OAAO,CAAC;AAUf,MAAM,WAAW,KAAK;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,WAAW,GAAG,YAAY,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,GAAG,8EAqFf,CAAC"}
@@ -21,7 +21,6 @@ export const Tab = forwardRef(({ children, id: incomingId = null, indication = n
21
21
  const controlsId = typeof incomingId === 'string'
22
22
  ? incomingId
23
23
  : `${tabsContext.id}-${tabListContext}-tab`;
24
- invariant(typeof children === 'string' || typeof children === 'number', 'Tab children have to be text.');
25
24
  const props = {
26
25
  className: clsx(useBoxStyles({
27
26
  is: typeof Component === 'string' ? Component : 'button',
@@ -6,12 +6,18 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
6
6
 
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
 
9
+ import { AlertIcon, OttoIcon } from '@autoguru/icons';
9
10
  import { action } from '@storybook/addon-actions';
10
11
  import isChromatic from 'chromatic/isChromatic';
11
12
  import * as React from 'react';
12
13
  import { useEffect, useState } from 'react';
14
+ import { Box } from "../Box/index.js";
15
+ import { Icon } from "../Icon/index.js";
16
+ import { Inline } from "../Inline/index.js";
17
+ import { EAlignment } from "../Positioner/alignment.js";
13
18
  import { Stack } from "../Stack/index.js";
14
19
  import { StarRating } from "../StarRating/index.js";
20
+ import { Tooltip } from "../Tooltip/index.js";
15
21
  import { Tab, TabList, TabPane, TabPanes, Tabs } from "./index.js";
16
22
  import { jsx as _jsx } from "react/jsx-runtime";
17
23
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -112,6 +118,50 @@ const withIndicationProps = {
112
118
  };
113
119
  export const withIndication = Template.bind(withIndicationProps);
114
120
  withIndication.args = withIndicationProps;
121
+ const withComplexTabProps = {
122
+ active: 0,
123
+ onChange: action('onChange'),
124
+ children: _jsxs(_Fragment, {
125
+ children: [_jsxs(TabList, {
126
+ children: [_jsx(Tab, {
127
+ indication: 2,
128
+ children: _jsxs(Inline, {
129
+ alignY: "center",
130
+ children: ["Tab 1", _jsx(Tooltip, {
131
+ alignment: EAlignment.BOTTOM,
132
+ label: "This tab is a winner",
133
+ children: _jsx(Box, {
134
+ children: _jsx(Icon, {
135
+ icon: OttoIcon
136
+ })
137
+ })
138
+ })]
139
+ })
140
+ }), _jsx(Tab, {
141
+ children: _jsxs(Inline, {
142
+ alignY: "center",
143
+ children: ["Tab 2", _jsx(Tooltip, {
144
+ alignment: EAlignment.BOTTOM,
145
+ label: "This tab is less awesome",
146
+ children: _jsx(Box, {
147
+ children: _jsx(Icon, {
148
+ icon: AlertIcon
149
+ })
150
+ })
151
+ })]
152
+ })
153
+ })]
154
+ }), _jsxs(TabPanes, {
155
+ children: [_jsx(TabPane, {
156
+ children: "Content A"
157
+ }), _jsx(TabPane, {
158
+ children: "Content B"
159
+ })]
160
+ })]
161
+ })
162
+ };
163
+ export const withComplexTab = Template.bind(withComplexTabProps);
164
+ withComplexTab.args = withComplexTabProps;
115
165
  const tabsWithoutPanesProps = {
116
166
  active: 0,
117
167
  onChange: action('onChange'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autoguru/overdrive",
3
- "version": "4.4.4",
3
+ "version": "4.5.1",
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",