@autoguru/overdrive 4.14.4 → 4.14.6
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/Anchor/Anchor.d.ts +2 -6
- package/dist/components/Anchor/Anchor.d.ts.map +1 -1
- package/dist/components/Anchor/Anchor.js +15 -17
- package/dist/components/Switch/Switch.d.ts +2 -2
- package/dist/components/Switch/Switch.d.ts.map +1 -1
- package/dist/components/Switch/Switch.js +15 -8
- package/dist/themes/base/tokens.d.ts.map +1 -1
- package/dist/themes/base/tokens.js +56 -56
- package/dist/utils/css.d.ts +3 -0
- package/dist/utils/css.d.ts.map +1 -0
- package/dist/utils/css.js +14 -0
- package/package.json +1 -1
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { IconType } from '@autoguru/icons';
|
|
2
|
-
import { ElementType, FunctionComponent, ReactElement, ReactNode } from 'react';
|
|
3
|
-
export interface Props {
|
|
4
|
-
rel?: string;
|
|
5
|
-
href?: string;
|
|
6
|
-
title?: string;
|
|
7
|
-
target?: string;
|
|
2
|
+
import { AnchorHTMLAttributes, ElementType, FunctionComponent, ReactElement, ReactNode } from 'react';
|
|
3
|
+
export interface Props extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'children' | 'style' | 'is'> {
|
|
8
4
|
className?: string;
|
|
9
5
|
is?: ElementType | ReactElement;
|
|
10
6
|
disabled?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Anchor.d.ts","sourceRoot":"","sources":["../../../lib/components/Anchor/Anchor.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAG3C,OAAO,
|
|
1
|
+
{"version":3,"file":"Anchor.d.ts","sourceRoot":"","sources":["../../../lib/components/Anchor/Anchor.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAG3C,OAAO,EACN,oBAAoB,EAGpB,WAAW,EACX,iBAAiB,EAEjB,YAAY,EACZ,SAAS,EACT,MAAM,OAAO,CAAC;AASf,MAAM,WAAW,KAAM,SAAQ,IAAI,CAClC,oBAAoB,CAAC,iBAAiB,CAAC,EACvC,UAAU,GAAG,OAAO,GAAG,IAAI,CAC3B;IACA,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,EAAE,CAAC,EAAE,WAAW,GAAG,YAAY,CAAC;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB,IAAI,CAAC,EAAE,QAAQ,CAAC;CAChB;AAED,eAAO,MAAM,MAAM,EAAE,iBAAiB,CAAC,KAAK,CAyC3C,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
+
const _excluded = ["className", "is", "disabled", "children", "icon"];
|
|
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
|
+
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; }
|
|
3
8
|
import clsx from 'clsx';
|
|
4
9
|
import * as React from 'react';
|
|
5
10
|
import { cloneElement, createElement, isValidElement } from 'react';
|
|
@@ -12,30 +17,23 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
12
17
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
18
|
export const Anchor = _ref => {
|
|
14
19
|
let {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
children,
|
|
23
|
-
icon
|
|
24
|
-
} = _ref;
|
|
20
|
+
className = '',
|
|
21
|
+
is: Component = 'a',
|
|
22
|
+
disabled = false,
|
|
23
|
+
children,
|
|
24
|
+
icon
|
|
25
|
+
} = _ref,
|
|
26
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
25
27
|
const textStyles = useTextStyles({
|
|
26
28
|
colour: 'link'
|
|
27
29
|
});
|
|
28
|
-
const props = {
|
|
30
|
+
const props = _objectSpread({
|
|
29
31
|
className: clsx(styles.root, textStyles, useBoxStyles({
|
|
30
32
|
is: typeof Component === 'string' ? Component : undefined,
|
|
31
33
|
display: 'inline'
|
|
32
34
|
}), className),
|
|
33
|
-
disabled
|
|
34
|
-
|
|
35
|
-
href,
|
|
36
|
-
target,
|
|
37
|
-
title
|
|
38
|
-
};
|
|
35
|
+
disabled
|
|
36
|
+
}, rest);
|
|
39
37
|
const childs = _jsxs(Inline, {
|
|
40
38
|
space: "2",
|
|
41
39
|
children: [icon && _jsx(Icon, {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FunctionComponent } from 'react';
|
|
2
|
-
export interface Props {
|
|
1
|
+
import { AnchorHTMLAttributes, FunctionComponent } from 'react';
|
|
2
|
+
export interface Props extends Omit<AnchorHTMLAttributes<HTMLButtonElement>, 'children' | 'style' | 'is' | 'onChange'> {
|
|
3
3
|
className?: string;
|
|
4
4
|
disabled?: boolean;
|
|
5
5
|
toggled?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../lib/components/Switch/Switch.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAe,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../lib/components/Switch/Switch.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAe,MAAM,OAAO,CAAC;AAO7E,MAAM,WAAW,KAAM,SAAQ,IAAI,CAClC,oBAAoB,CAAC,iBAAiB,CAAC,EACvC,UAAU,GAAG,OAAO,GAAG,IAAI,GAAG,UAAU,CACxC;IACA,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,QAAQ,CAAC,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CAChC;AAED,eAAO,MAAM,MAAM,EAAE,iBAAiB,CAAC,KAAK,CAwD3C,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
+
const _excluded = ["className", "disabled", "toggled", "onChange"];
|
|
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
|
+
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; }
|
|
3
8
|
import clsx from 'clsx';
|
|
4
9
|
import * as React from 'react';
|
|
5
10
|
import { useCallback } from 'react';
|
|
@@ -9,11 +14,12 @@ import * as styles from "./Switch.css.js";
|
|
|
9
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
15
|
export const Switch = _ref => {
|
|
11
16
|
let {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
className = '',
|
|
18
|
+
disabled = false,
|
|
19
|
+
toggled = false,
|
|
20
|
+
onChange
|
|
21
|
+
} = _ref,
|
|
22
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
17
23
|
const onToggle = useCallback(() => {
|
|
18
24
|
if (disabled) {
|
|
19
25
|
return;
|
|
@@ -22,8 +28,9 @@ export const Switch = _ref => {
|
|
|
22
28
|
onChange(!toggled);
|
|
23
29
|
}
|
|
24
30
|
}, [disabled, toggled]);
|
|
25
|
-
return _jsx(Box, {
|
|
26
|
-
is: "button"
|
|
31
|
+
return _jsx(Box, _objectSpread(_objectSpread({
|
|
32
|
+
is: "button"
|
|
33
|
+
}, rest), {}, {
|
|
27
34
|
className: clsx(styles.root, useTextStyles({
|
|
28
35
|
size: '5'
|
|
29
36
|
}), {
|
|
@@ -52,6 +59,6 @@ export const Switch = _ref => {
|
|
|
52
59
|
[styles.handle.transition]: toggled
|
|
53
60
|
})
|
|
54
61
|
})
|
|
55
|
-
});
|
|
62
|
+
}));
|
|
56
63
|
};
|
|
57
64
|
export default Switch;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../lib/themes/base/tokens.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,MAAM,EAAE,MAAM,WAAW,CAAC;AAgE9C,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../lib/themes/base/tokens.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,MAAM,EAAE,MAAM,WAAW,CAAC;AAgE9C,eAAO,MAAM,YAAY,iDAAqC,CAAC;AAI/D,eAAO,MAAM,MAAM,EAAE,MAuNpB,CAAC"}
|
|
@@ -4,7 +4,7 @@ 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
6
|
import { buildColourGamut } from "../makeTheme.js";
|
|
7
|
-
const
|
|
7
|
+
const baseThemeColours = {
|
|
8
8
|
gray: {
|
|
9
9
|
'900': '#212338',
|
|
10
10
|
'800': '#34384c',
|
|
@@ -61,14 +61,14 @@ const colours = {
|
|
|
61
61
|
'100': '#fdf4f4'
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
|
-
export const defaultGamut = buildColourGamut(
|
|
64
|
+
export const defaultGamut = buildColourGamut(baseThemeColours);
|
|
65
65
|
const white = '#fff';
|
|
66
|
-
const secondaryForeground =
|
|
66
|
+
const secondaryForeground = baseThemeColours.gray['700'];
|
|
67
67
|
export const tokens = {
|
|
68
68
|
mode: 'light',
|
|
69
69
|
body: {
|
|
70
70
|
backgroundColour: white,
|
|
71
|
-
colour:
|
|
71
|
+
colour: baseThemeColours.gray['900']
|
|
72
72
|
},
|
|
73
73
|
contentWidth: {
|
|
74
74
|
small: '592px',
|
|
@@ -92,87 +92,87 @@ export const tokens = {
|
|
|
92
92
|
white
|
|
93
93
|
}),
|
|
94
94
|
foreground: {
|
|
95
|
-
body:
|
|
96
|
-
link:
|
|
95
|
+
body: baseThemeColours.gray['900'],
|
|
96
|
+
link: baseThemeColours.blue['500']
|
|
97
97
|
},
|
|
98
98
|
background: {
|
|
99
99
|
body: white,
|
|
100
|
-
light:
|
|
101
|
-
neutral:
|
|
102
|
-
neutralDark:
|
|
100
|
+
light: baseThemeColours.gray['200'],
|
|
101
|
+
neutral: baseThemeColours.gray['400'],
|
|
102
|
+
neutralDark: baseThemeColours.gray['800']
|
|
103
103
|
},
|
|
104
104
|
intent: {
|
|
105
105
|
primary: {
|
|
106
106
|
background: {
|
|
107
|
-
standard:
|
|
108
|
-
mild:
|
|
109
|
-
strong:
|
|
107
|
+
standard: baseThemeColours.green['700'],
|
|
108
|
+
mild: baseThemeColours.green['200'],
|
|
109
|
+
strong: baseThemeColours.green['900']
|
|
110
110
|
},
|
|
111
111
|
foreground: white,
|
|
112
|
-
border:
|
|
112
|
+
border: baseThemeColours.green['900']
|
|
113
113
|
},
|
|
114
114
|
secondary: {
|
|
115
115
|
background: {
|
|
116
116
|
standard: white,
|
|
117
117
|
mild: white,
|
|
118
|
-
strong:
|
|
118
|
+
strong: baseThemeColours.gray['200']
|
|
119
119
|
},
|
|
120
120
|
foreground: secondaryForeground,
|
|
121
|
-
border:
|
|
121
|
+
border: baseThemeColours.gray['300']
|
|
122
122
|
},
|
|
123
123
|
shine: {
|
|
124
124
|
background: {
|
|
125
|
-
standard:
|
|
126
|
-
mild:
|
|
127
|
-
strong:
|
|
125
|
+
standard: baseThemeColours.gray['200'],
|
|
126
|
+
mild: baseThemeColours.gray['100'],
|
|
127
|
+
strong: baseThemeColours.gray['300']
|
|
128
128
|
},
|
|
129
|
-
foreground:
|
|
130
|
-
border:
|
|
129
|
+
foreground: baseThemeColours.yellow['500'],
|
|
130
|
+
border: baseThemeColours.gray['300']
|
|
131
131
|
},
|
|
132
132
|
danger: {
|
|
133
133
|
background: {
|
|
134
|
-
standard:
|
|
135
|
-
mild:
|
|
136
|
-
strong:
|
|
134
|
+
standard: baseThemeColours.red['600'],
|
|
135
|
+
mild: baseThemeColours.red['100'],
|
|
136
|
+
strong: baseThemeColours.red['800']
|
|
137
137
|
},
|
|
138
138
|
foreground: white,
|
|
139
|
-
border:
|
|
139
|
+
border: baseThemeColours.red['800']
|
|
140
140
|
},
|
|
141
141
|
warning: {
|
|
142
142
|
background: {
|
|
143
|
-
standard:
|
|
144
|
-
mild:
|
|
145
|
-
strong:
|
|
143
|
+
standard: baseThemeColours.yellow['800'],
|
|
144
|
+
mild: baseThemeColours.yellow['100'],
|
|
145
|
+
strong: baseThemeColours.yellow['900']
|
|
146
146
|
},
|
|
147
147
|
foreground: white,
|
|
148
|
-
border:
|
|
148
|
+
border: baseThemeColours.yellow['900']
|
|
149
149
|
},
|
|
150
150
|
neutral: {
|
|
151
151
|
background: {
|
|
152
|
-
standard:
|
|
153
|
-
mild:
|
|
154
|
-
strong:
|
|
152
|
+
standard: baseThemeColours.gray['700'],
|
|
153
|
+
mild: baseThemeColours.gray['200'],
|
|
154
|
+
strong: baseThemeColours.gray['900']
|
|
155
155
|
},
|
|
156
156
|
foreground: white,
|
|
157
|
-
border:
|
|
157
|
+
border: baseThemeColours.gray['900']
|
|
158
158
|
},
|
|
159
159
|
success: {
|
|
160
160
|
background: {
|
|
161
|
-
standard:
|
|
162
|
-
mild:
|
|
163
|
-
strong:
|
|
161
|
+
standard: baseThemeColours.green['700'],
|
|
162
|
+
mild: baseThemeColours.green['200'],
|
|
163
|
+
strong: baseThemeColours.green['900']
|
|
164
164
|
},
|
|
165
|
-
foreground:
|
|
166
|
-
border:
|
|
165
|
+
foreground: baseThemeColours.green['200'],
|
|
166
|
+
border: baseThemeColours.green['900']
|
|
167
167
|
},
|
|
168
168
|
information: {
|
|
169
169
|
background: {
|
|
170
|
-
standard:
|
|
171
|
-
mild:
|
|
172
|
-
strong:
|
|
170
|
+
standard: baseThemeColours.blue['800'],
|
|
171
|
+
mild: baseThemeColours.blue['200'],
|
|
172
|
+
strong: baseThemeColours.blue['900']
|
|
173
173
|
},
|
|
174
174
|
foreground: white,
|
|
175
|
-
border:
|
|
175
|
+
border: baseThemeColours.blue['900']
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
},
|
|
@@ -192,9 +192,9 @@ export const tokens = {
|
|
|
192
192
|
'3': '4px'
|
|
193
193
|
},
|
|
194
194
|
colours: {
|
|
195
|
-
light:
|
|
196
|
-
gray:
|
|
197
|
-
dark:
|
|
195
|
+
light: baseThemeColours.gray['200'],
|
|
196
|
+
gray: baseThemeColours.gray['300'],
|
|
197
|
+
dark: baseThemeColours.gray['900']
|
|
198
198
|
},
|
|
199
199
|
radius: {
|
|
200
200
|
none: 'none',
|
|
@@ -244,19 +244,19 @@ export const tokens = {
|
|
|
244
244
|
}
|
|
245
245
|
},
|
|
246
246
|
colour: {
|
|
247
|
-
primary:
|
|
248
|
-
secondary:
|
|
249
|
-
shine:
|
|
250
|
-
link:
|
|
251
|
-
dark:
|
|
247
|
+
primary: baseThemeColours.green['600'],
|
|
248
|
+
secondary: baseThemeColours.gray['700'],
|
|
249
|
+
shine: baseThemeColours.yellow['500'],
|
|
250
|
+
link: baseThemeColours.blue['500'],
|
|
251
|
+
dark: baseThemeColours.gray['900'],
|
|
252
252
|
white,
|
|
253
|
-
muted:
|
|
254
|
-
neutral:
|
|
255
|
-
light:
|
|
256
|
-
danger:
|
|
257
|
-
warning:
|
|
258
|
-
success:
|
|
259
|
-
information:
|
|
253
|
+
muted: baseThemeColours.gray['400'],
|
|
254
|
+
neutral: baseThemeColours.gray['700'],
|
|
255
|
+
light: baseThemeColours.gray['600'],
|
|
256
|
+
danger: baseThemeColours.red['600'],
|
|
257
|
+
warning: baseThemeColours.yellow['800'],
|
|
258
|
+
success: baseThemeColours.green['600'],
|
|
259
|
+
information: baseThemeColours.blue['500']
|
|
260
260
|
},
|
|
261
261
|
fontWeight: {
|
|
262
262
|
normal: '400',
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../../lib/utils/css.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,UAAW,MAAM,WAIzC,CAAC;AAEF,eAAO,MAAM,kBAAkB,eAAgB,MAAM,SAAS,MAAM,KAAG,MAAM,GAAG,IAK/E,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const cssVarRegExp = /var\(([^)]+)\)/;
|
|
4
|
+
export const cssVarUnwrap = value => {
|
|
5
|
+
const matches = cssVarRegExp.exec(value);
|
|
6
|
+
return matches ? matches[1] : value;
|
|
7
|
+
};
|
|
8
|
+
export const getThemeTokenValue = (themeClass, token) => {
|
|
9
|
+
var _getComputedStyle$get;
|
|
10
|
+
const cssVar = cssVarUnwrap(token);
|
|
11
|
+
const themedElement = document.querySelector(".".concat(themeClass));
|
|
12
|
+
if (!themedElement || !cssVar) return null;
|
|
13
|
+
return ((_getComputedStyle$get = getComputedStyle(themedElement).getPropertyValue(cssVar)) === null || _getComputedStyle$get === void 0 ? void 0 : _getComputedStyle$get.trim()) || null;
|
|
14
|
+
};
|