@autoguru/overdrive 4.32.0 → 4.33.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/Badge/Badge.d.ts.map +1 -1
- package/dist/components/Badge/Badge.js +6 -6
- package/dist/components/Image/stories.js +4 -2
- package/dist/components/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/components/Switch/Switch.css.d.ts +3 -1
- package/dist/components/Switch/Switch.css.d.ts.map +1 -1
- package/dist/components/Switch/Switch.css.js +44 -16
- package/dist/components/Switch/Switch.d.ts +5 -4
- package/dist/components/Switch/Switch.d.ts.map +1 -1
- package/dist/components/Switch/Switch.js +62 -45
- package/dist/components/Switch/stories.js +11 -21
- package/dist/components/TextAreaInput/TextAreaInput.d.ts.map +1 -1
- package/dist/themes/neutral/tokens.js +1 -1
- package/package.json +9 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../lib/components/Badge/Badge.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAkB,MAAM,OAAO,CAAC;AAK1D,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAEtC,MAAM,WAAW,KAAK;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,OAAO,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;IAC/B,IAAI,CAAC,EAAE,MAAM,OAAO,MAAM,CAAC,SAAS,CAAC;CACrC;
|
|
1
|
+
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../lib/components/Badge/Badge.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAkB,MAAM,OAAO,CAAC;AAK1D,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAEtC,MAAM,WAAW,KAAK;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,OAAO,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;IAC/B,IAAI,CAAC,EAAE,MAAM,OAAO,MAAM,CAAC,SAAS,CAAC;CACrC;AAoBD,eAAO,MAAM,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAmD1C,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -7,14 +7,14 @@ import { useTextStyles } from "../Text/index.js";
|
|
|
7
7
|
import * as styles from "./Badge.css.js";
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
9
|
const paddingXMap = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
small: '1',
|
|
11
|
+
standard: '1',
|
|
12
|
+
large: '4'
|
|
13
13
|
};
|
|
14
14
|
const paddingYMap = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
small: '1',
|
|
16
|
+
standard: '1',
|
|
17
|
+
large: '4'
|
|
18
18
|
};
|
|
19
19
|
export const Badge = _ref => {
|
|
20
20
|
let {
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
4
|
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; }
|
|
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
|
+
import isChromatic from 'chromatic/isChromatic';
|
|
6
7
|
import * as React from 'react';
|
|
7
8
|
import { Stack } from "../Stack/index.js";
|
|
8
9
|
import { Text } from "../Text/index.js";
|
|
@@ -10,7 +11,8 @@ import { ImageServerProvider, widthMap } from "./ImageServerProvider.js";
|
|
|
10
11
|
import { Image } from "./index.js";
|
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
13
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
const sizeOptions = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16'];
|
|
14
|
+
const sizeOptions = isChromatic() ? ['8'] : ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16'];
|
|
15
|
+
const qualityOptions = isChromatic() ? ['70'] : [1, 20, 40, 60, 80, 100];
|
|
14
16
|
export default {
|
|
15
17
|
title: 'Foundation/Image/Image',
|
|
16
18
|
component: Image,
|
|
@@ -124,7 +126,7 @@ const AllQualityTemplate = args => _jsx(ImageServerProvider, {
|
|
|
124
126
|
},
|
|
125
127
|
children: _jsx(Stack, {
|
|
126
128
|
space: "5",
|
|
127
|
-
children:
|
|
129
|
+
children: qualityOptions.map(quality => _jsxs(Stack, {
|
|
128
130
|
space: "1",
|
|
129
131
|
children: [_jsxs(Text, {
|
|
130
132
|
children: ["Quality: ", _jsx(Text, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumberInput.d.ts","sourceRoot":"","sources":["../../../lib/components/NumberInput/NumberInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAc5D,UAAU,KACT,SAAQ,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC,CAAC,EAC9D,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC;IAChC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IAC9C,OAAO,CAAC,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;IAC9C,MAAM,CAAC,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;IAC7C,GAAG,CAAC,EAAE,MAAM,CAAC;CACb;AAED,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"NumberInput.d.ts","sourceRoot":"","sources":["../../../lib/components/NumberInput/NumberInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAc5D,UAAU,KACT,SAAQ,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC,CAAC,EAC9D,IAAI,CAAC,gBAAgB,EAAE,OAAO,CAAC;IAChC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;IAC9C,OAAO,CAAC,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;IAC9C,MAAM,CAAC,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;IAC7C,GAAG,CAAC,EAAE,MAAM,CAAC;CACb;AAED,eAAO,MAAM,WAAW,oTA8CvB,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
export declare const handle: Record<"transition" | "default", string>;
|
|
1
|
+
export declare const handle: Record<"transition" | "default" | "disabled", string>;
|
|
2
2
|
export declare const toggled: string;
|
|
3
|
+
export declare const untoggled: string;
|
|
3
4
|
export declare const disabled: Record<"default" | "toggled", string>;
|
|
5
|
+
export declare const focus: string;
|
|
4
6
|
export declare const root: string;
|
|
5
7
|
//# sourceMappingURL=Switch.css.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.css.d.ts","sourceRoot":"","sources":["../../../lib/components/Switch/Switch.css.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"Switch.css.d.ts","sourceRoot":"","sources":["../../../lib/components/Switch/Switch.css.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,MAAM,uDA0BjB,CAAC;AAEH,eAAO,MAAM,OAAO,QAGlB,CAAC;AAEH,eAAO,MAAM,SAAS,QAUpB,CAAC;AAEH,eAAO,MAAM,QAAQ,uCAmBnB,CAAC;AAEH,eAAO,MAAM,KAAK,QAEhB,CAAC;AAEH,eAAO,MAAM,IAAI,QAWf,CAAC"}
|
|
@@ -5,51 +5,79 @@ __vanilla_filescope__.setFileScope("lib/components/Switch/Switch.css.ts", "@auto
|
|
|
5
5
|
import { style, styleVariants } from '@vanilla-extract/css';
|
|
6
6
|
import { themeContractVars as vars } from "../../themes/theme.css.js";
|
|
7
7
|
const handleSize = '24px';
|
|
8
|
-
const handleOffset = '
|
|
8
|
+
const handleOffset = '3px';
|
|
9
9
|
const borderSize = '1px';
|
|
10
10
|
export const handle = styleVariants({
|
|
11
|
+
disabled: {
|
|
12
|
+
border: "".concat(borderSize, " solid ").concat(vars.colours.intent.primary.background.mild)
|
|
13
|
+
},
|
|
11
14
|
default: {
|
|
12
|
-
|
|
15
|
+
borderSize: "".concat(borderSize),
|
|
13
16
|
top: "calc(".concat(handleOffset, " - ").concat(borderSize, ")"),
|
|
14
|
-
left: "calc(
|
|
15
|
-
width: "".concat(handleSize),
|
|
16
|
-
height: "".concat(handleSize),
|
|
17
|
+
left: "calc(1.5 * ".concat(handleOffset, ")"),
|
|
18
|
+
width: "calc(".concat(handleSize, " - (2 * ").concat(handleOffset, "))"),
|
|
19
|
+
height: "calc(".concat(handleSize, " - (2 * ").concat(handleOffset, "))"),
|
|
17
20
|
transition: 'transform 0.2s cubic-bezier(0, 0, 0.2, 1) 0s',
|
|
18
|
-
willChange: 'transform'
|
|
21
|
+
willChange: 'transform',
|
|
22
|
+
selectors: {
|
|
23
|
+
'&:hover': {
|
|
24
|
+
transform: 'scale(0.9)'
|
|
25
|
+
}
|
|
26
|
+
}
|
|
19
27
|
},
|
|
20
28
|
transition: {
|
|
21
29
|
transform: "translateX(calc(".concat(handleSize, " - (2 * ").concat(handleOffset, ")))"),
|
|
22
|
-
|
|
30
|
+
selectors: {
|
|
31
|
+
'&:hover': {
|
|
32
|
+
transform: "translateX(calc(".concat(handleSize, " - (2 * ").concat(handleOffset, "))) scale(0.9)")
|
|
33
|
+
}
|
|
34
|
+
}
|
|
23
35
|
}
|
|
24
36
|
}, "handle");
|
|
25
37
|
export const toggled = style({
|
|
26
|
-
|
|
27
|
-
backgroundColor: vars.colours.intent.primary.background.
|
|
38
|
+
border: "".concat(borderSize, " solid ").concat(vars.colours.intent.primary.background.strong),
|
|
39
|
+
backgroundColor: vars.colours.intent.primary.background.strong
|
|
28
40
|
}, "toggled");
|
|
41
|
+
export const untoggled = style({
|
|
42
|
+
border: "".concat(borderSize, " solid color-mix(in oklch, ").concat(vars.colours.intent.primary.background.standard, ", transparent 60%)"),
|
|
43
|
+
backgroundColor: vars.colours.intent.primary.background.mild,
|
|
44
|
+
transition: '0.2s cubic-bezier(0, 0, 0.2, 1) 0s',
|
|
45
|
+
selectors: {
|
|
46
|
+
'&:hover': {
|
|
47
|
+
borderColor: vars.colours.intent.primary.background.strong,
|
|
48
|
+
backgroundColor: vars.colours.intent.primary.background.strong
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}, "untoggled");
|
|
29
52
|
export const disabled = styleVariants({
|
|
30
53
|
default: {
|
|
31
54
|
selectors: {
|
|
32
55
|
'&[aria-disabled=true]': {
|
|
33
56
|
cursor: 'not-allowed',
|
|
34
|
-
|
|
35
|
-
backgroundColor:
|
|
57
|
+
border: "".concat(borderSize, " solid ").concat(vars.colours.intent.primary.background.mild),
|
|
58
|
+
backgroundColor: 'white'
|
|
36
59
|
}
|
|
37
60
|
}
|
|
38
61
|
},
|
|
39
62
|
toggled: {
|
|
40
63
|
selectors: {
|
|
41
64
|
'&[aria-disabled=true]': {
|
|
42
|
-
|
|
43
|
-
|
|
65
|
+
cursor: 'not-allowed',
|
|
66
|
+
border: "".concat(borderSize, " solid ").concat(vars.colours.intent.primary.background.mild),
|
|
67
|
+
backgroundColor: 'white'
|
|
44
68
|
}
|
|
45
69
|
}
|
|
46
70
|
}
|
|
47
71
|
}, "disabled");
|
|
72
|
+
export const focus = style({
|
|
73
|
+
outline: "calc(".concat(handleOffset, " - ").concat(borderSize, ") solid ").concat(vars.colours.intent.brand.background.standard)
|
|
74
|
+
}, "focus");
|
|
48
75
|
export const root = style({
|
|
49
|
-
width: "calc((2 * ".concat(handleSize, ")
|
|
50
|
-
height: "
|
|
76
|
+
width: "calc((2 * ".concat(handleSize, ") - 2 * ").concat(borderSize, ")"),
|
|
77
|
+
height: "".concat(handleSize),
|
|
78
|
+
top: "calc(".concat(handleOffset, " - ").concat(borderSize, ")"),
|
|
79
|
+
left: "calc(1.5 * ".concat(handleOffset, ")"),
|
|
51
80
|
transition: 'background-color 0.2s cubic-bezier(0, 0, 0.2, 1) 0s',
|
|
52
|
-
border: "".concat(borderSize, " solid ").concat(vars.border.colours.light),
|
|
53
81
|
selectors: {
|
|
54
82
|
["&:not(".concat(disabled.default, "):not(").concat(disabled.toggled, "):focus")]: {
|
|
55
83
|
borderColor: vars.colours.intent.information.background.standard
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { AnchorHTMLAttributes, FunctionComponent } from 'react';
|
|
2
|
-
|
|
2
|
+
import { useSwitch } from 'react-aria';
|
|
3
|
+
type AriaSwitchProps = Parameters<typeof useSwitch>[0];
|
|
4
|
+
export type SwitchProps = AriaSwitchProps & Omit<AnchorHTMLAttributes<HTMLButtonElement>, 'children' | 'style' | 'is' | 'onChange'> & {
|
|
3
5
|
className?: string;
|
|
4
6
|
disabled?: boolean;
|
|
5
7
|
toggled?: boolean;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export declare const Switch: FunctionComponent<Props>;
|
|
8
|
+
};
|
|
9
|
+
export declare const Switch: FunctionComponent;
|
|
9
10
|
export default Switch;
|
|
10
11
|
//# sourceMappingURL=Switch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../lib/components/Switch/Switch.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../lib/components/Switch/Switch.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAU,MAAM,OAAO,CAAC;AACxE,OAAO,EAAE,SAAS,EAAgC,MAAM,YAAY,CAAC;AAMrE,KAAK,eAAe,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AACvD,MAAM,MAAM,WAAW,GAAG,eAAe,GACxC,IAAI,CACH,oBAAoB,CAAC,iBAAiB,CAAC,EACvC,UAAU,GAAG,OAAO,GAAG,IAAI,GAAG,UAAU,CACxC,GAAG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAInB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAInB,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEH,eAAO,MAAM,MAAM,EAAE,iBAiEpB,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -2,63 +2,80 @@
|
|
|
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", "disabled", "toggled", "
|
|
5
|
+
const _excluded = ["className", "disabled", "toggled", "isSelected", "isDisabled"];
|
|
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
|
+
import { useToggleState } from '@react-stately/toggle';
|
|
8
9
|
import clsx from 'clsx';
|
|
9
10
|
import * as React from 'react';
|
|
10
|
-
import {
|
|
11
|
+
import { useRef } from 'react';
|
|
12
|
+
import { useSwitch, useFocusRing, VisuallyHidden } from 'react-aria';
|
|
11
13
|
import { Box, useBoxStyles } from "../Box/index.js";
|
|
12
14
|
import { useTextStyles } from "../Text/index.js";
|
|
13
15
|
import * as styles from "./Switch.css.js";
|
|
14
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
18
|
export const Switch = _ref => {
|
|
16
19
|
let {
|
|
17
|
-
className
|
|
18
|
-
disabled
|
|
19
|
-
toggled
|
|
20
|
-
|
|
20
|
+
className,
|
|
21
|
+
disabled,
|
|
22
|
+
toggled,
|
|
23
|
+
isSelected,
|
|
24
|
+
isDisabled
|
|
21
25
|
} = _ref,
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"aria-disabled": disabled,
|
|
45
|
-
"aria-label": "toggle ".concat(toggled ? 'on' : 'off'),
|
|
46
|
-
onClick: onToggle,
|
|
47
|
-
children: _jsx(Box, {
|
|
48
|
-
borderWidth: "1",
|
|
49
|
-
position: "absolute",
|
|
50
|
-
borderRadius: "pill",
|
|
51
|
-
backgroundColour: "white",
|
|
52
|
-
padding: "none",
|
|
53
|
-
boxShadow: "2",
|
|
54
|
-
className: clsx(styles.handle.default, useBoxStyles({
|
|
55
|
-
is: 'button'
|
|
56
|
-
}), useTextStyles({
|
|
57
|
-
colour: 'white'
|
|
26
|
+
incomingProps = _objectWithoutProperties(_ref, _excluded);
|
|
27
|
+
const props = _objectSpread(_objectSpread({}, incomingProps), {}, {
|
|
28
|
+
isDisabled: isDisabled || disabled,
|
|
29
|
+
isSelected: isSelected || toggled
|
|
30
|
+
});
|
|
31
|
+
const state = useToggleState(props);
|
|
32
|
+
const ref = useRef(null);
|
|
33
|
+
const {
|
|
34
|
+
inputProps
|
|
35
|
+
} = useSwitch(props, state, ref);
|
|
36
|
+
const {
|
|
37
|
+
isFocusVisible,
|
|
38
|
+
focusProps
|
|
39
|
+
} = useFocusRing();
|
|
40
|
+
return _jsxs("label", {
|
|
41
|
+
children: [_jsx(VisuallyHidden, {
|
|
42
|
+
children: _jsx("input", _objectSpread(_objectSpread(_objectSpread({}, inputProps), focusProps), {}, {
|
|
43
|
+
ref: ref
|
|
44
|
+
}))
|
|
45
|
+
}), _jsx(Box, {
|
|
46
|
+
className: clsx(styles.root, useTextStyles({
|
|
47
|
+
size: '5'
|
|
58
48
|
}), {
|
|
59
|
-
[styles.
|
|
49
|
+
[styles.disabled.default]: inputProps.disabled,
|
|
50
|
+
[styles.disabled.toggled]: state.isSelected && inputProps.disabled,
|
|
51
|
+
[styles.toggled]: state.isSelected,
|
|
52
|
+
[styles.untoggled]: !state.isSelected,
|
|
53
|
+
[styles.focus]: isFocusVisible
|
|
54
|
+
}, className),
|
|
55
|
+
tabIndex: inputProps.disabled ? -1 : void 0,
|
|
56
|
+
borderRadius: "pill",
|
|
57
|
+
position: "relative",
|
|
58
|
+
"aria-disabled": inputProps.disabled,
|
|
59
|
+
"aria-label": "toggle ".concat(state.isSelected ? 'on' : 'off'),
|
|
60
|
+
children: _jsx(Box, {
|
|
61
|
+
borderWidth: "1",
|
|
62
|
+
position: "absolute",
|
|
63
|
+
borderRadius: "pill",
|
|
64
|
+
backgroundColour: "white",
|
|
65
|
+
padding: "none",
|
|
66
|
+
pointerEvents: inputProps.disabled ? 'none' : void 0,
|
|
67
|
+
boxShadow: "2",
|
|
68
|
+
className: clsx(styles.handle.default, useBoxStyles({
|
|
69
|
+
is: 'button'
|
|
70
|
+
}), useTextStyles({
|
|
71
|
+
colour: 'white'
|
|
72
|
+
}), {
|
|
73
|
+
[styles.handle.transition]: state.isSelected,
|
|
74
|
+
[styles.handle.default]: inputProps.disabled,
|
|
75
|
+
[styles.handle.disabled]: inputProps.disabled
|
|
76
|
+
})
|
|
60
77
|
})
|
|
61
|
-
})
|
|
62
|
-
})
|
|
78
|
+
}), props.children]
|
|
79
|
+
});
|
|
63
80
|
};
|
|
64
81
|
export default Switch;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
|
-
import
|
|
5
|
-
const _excluded = ["onChange", "value"];
|
|
4
|
+
import _objectDestructuringEmpty from "@babel/runtime/helpers/esm/objectDestructuringEmpty";
|
|
6
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; }
|
|
7
6
|
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
7
|
import { action } from '@storybook/addon-actions';
|
|
@@ -14,39 +13,30 @@ export default {
|
|
|
14
13
|
component: Switch
|
|
15
14
|
};
|
|
16
15
|
const Template = _ref => {
|
|
17
|
-
let {
|
|
18
|
-
|
|
19
|
-
value
|
|
20
|
-
} = _ref,
|
|
21
|
-
args = _objectWithoutProperties(_ref, _excluded);
|
|
22
|
-
return _jsx(Switch, _objectSpread({
|
|
23
|
-
onChange: stepValue => {
|
|
24
|
-
setValue(stepValue);
|
|
25
|
-
incomingOnChange(stepValue);
|
|
26
|
-
},
|
|
27
|
-
value: value
|
|
28
|
-
}, args));
|
|
16
|
+
let args = Object.assign({}, (_objectDestructuringEmpty(_ref), _ref));
|
|
17
|
+
return _jsx(Switch, _objectSpread({}, args));
|
|
29
18
|
};
|
|
30
19
|
const standardProps = {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
onChange: action('onChange')
|
|
20
|
+
isDisabled: false,
|
|
21
|
+
isSelected: false,
|
|
22
|
+
onChange: action('onChange'),
|
|
23
|
+
className: 'toggleButton-class'
|
|
34
24
|
};
|
|
35
25
|
export const untoggled = Template.bind(standardProps);
|
|
36
26
|
untoggled.args = standardProps;
|
|
37
27
|
const untoggledDisabledProps = _objectSpread(_objectSpread({}, standardProps), {}, {
|
|
38
|
-
|
|
28
|
+
isDisabled: true
|
|
39
29
|
});
|
|
40
30
|
export const untoggledDisabled = Template.bind(untoggledDisabledProps);
|
|
41
31
|
untoggledDisabled.args = untoggledDisabledProps;
|
|
42
32
|
const toggledProps = _objectSpread(_objectSpread({}, standardProps), {}, {
|
|
43
|
-
|
|
33
|
+
isSelected: true
|
|
44
34
|
});
|
|
45
35
|
export const toggled = Template.bind(toggledProps);
|
|
46
36
|
toggled.args = toggledProps;
|
|
47
37
|
const toggledDisabledProps = _objectSpread(_objectSpread({}, standardProps), {}, {
|
|
48
|
-
|
|
49
|
-
|
|
38
|
+
isSelected: true,
|
|
39
|
+
isDisabled: true
|
|
50
40
|
});
|
|
51
41
|
export const toggledDisabled = Template.bind(toggledDisabledProps);
|
|
52
42
|
toggledDisabled.args = toggledDisabledProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextAreaInput.d.ts","sourceRoot":"","sources":["../../../lib/components/TextAreaInput/TextAreaInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"TextAreaInput.d.ts","sourceRoot":"","sources":["../../../lib/components/TextAreaInput/TextAreaInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,eAAO,MAAM,aAAa,uWA2BzB,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autoguru/overdrive",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.33.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",
|
|
@@ -42,32 +42,36 @@
|
|
|
42
42
|
"@autoguru/tsconfig": "1.0.80",
|
|
43
43
|
"@autoguru/utilities": "1.1.1",
|
|
44
44
|
"@popperjs/core": "2.11.6",
|
|
45
|
+
"@react-stately/toggle": "3.7.7",
|
|
45
46
|
"@types/react": "^18.0.17",
|
|
46
47
|
"@types/react-dom": "^18.0.6",
|
|
47
|
-
"@vanilla-extract/dynamic": "^2.
|
|
48
|
+
"@vanilla-extract/dynamic": "^2.1.2",
|
|
48
49
|
"clsx": "1.2.1",
|
|
49
50
|
"colord": "2.9.3",
|
|
50
|
-
"csstype": "3.1.
|
|
51
|
+
"csstype": "^3.1.3",
|
|
51
52
|
"deepmerge": "^4.2.2",
|
|
52
53
|
"eslint-plugin-jest": "26.9.0",
|
|
53
54
|
"intersection-observer": "^0.12.2",
|
|
54
55
|
"react": "^18.2.0",
|
|
56
|
+
"react-aria": "3.34.2",
|
|
55
57
|
"react-dom": "^18.2.0",
|
|
56
58
|
"react-focus-lock": "2.9.4",
|
|
57
59
|
"react-intersection-observer": "^9.4.3",
|
|
58
60
|
"react-keyed-flatten-children": "1.3.0",
|
|
59
61
|
"react-swipeable": "^7.0.0",
|
|
62
|
+
"react-types": "0.1.0",
|
|
60
63
|
"webpack": "5.77.0"
|
|
61
64
|
},
|
|
62
65
|
"peerDependencies": {
|
|
63
66
|
"@autoguru/icons": "^1.7.28",
|
|
64
67
|
"@autoguru/utilities": "^1.0.98",
|
|
65
68
|
"@popperjs/core": "^2.10.2",
|
|
66
|
-
"@vanilla-extract/dynamic": "^2.
|
|
69
|
+
"@vanilla-extract/dynamic": "^2.1.2",
|
|
67
70
|
"clsx": "^1.1.1",
|
|
68
71
|
"colord": "^2.0.1",
|
|
69
|
-
"csstype": "^3.
|
|
72
|
+
"csstype": "^3.1.3",
|
|
70
73
|
"react": ">=16.8",
|
|
74
|
+
"react-aria": "3.34.2",
|
|
71
75
|
"react-dom": ">=16.8",
|
|
72
76
|
"react-focus-lock": "^2.5.0",
|
|
73
77
|
"react-intersection-observer": ">=9.4.3",
|