@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.
@@ -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,EAGN,WAAW,EACX,iBAAiB,EAEjB,YAAY,EACZ,SAAS,EACT,MAAM,OAAO,CAAC;AASf,MAAM,WAAW,KAAK;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,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,CAgD3C,CAAC;AAEF,eAAe,MAAM,CAAC"}
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
- rel,
16
- href,
17
- target,
18
- title,
19
- className = '',
20
- is: Component = 'a',
21
- disabled = false,
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
- rel,
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;AAOvD,MAAM,WAAW,KAAK;IACrB,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,CAsD3C,CAAC;AAEF,eAAe,MAAM,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
- className = '',
13
- disabled = false,
14
- toggled = false,
15
- onChange
16
- } = _ref;
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,iDAA4B,CAAC;AAItD,eAAO,MAAM,MAAM,EAAE,MAuNpB,CAAC"}
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 colours = {
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(colours);
64
+ export const defaultGamut = buildColourGamut(baseThemeColours);
65
65
  const white = '#fff';
66
- const secondaryForeground = colours.gray['700'];
66
+ const secondaryForeground = baseThemeColours.gray['700'];
67
67
  export const tokens = {
68
68
  mode: 'light',
69
69
  body: {
70
70
  backgroundColour: white,
71
- colour: colours.gray['900']
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: colours.gray['900'],
96
- link: colours.blue['500']
95
+ body: baseThemeColours.gray['900'],
96
+ link: baseThemeColours.blue['500']
97
97
  },
98
98
  background: {
99
99
  body: white,
100
- light: colours.gray['200'],
101
- neutral: colours.gray['400'],
102
- neutralDark: colours.gray['800']
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: colours.green['700'],
108
- mild: colours.green['200'],
109
- strong: colours.green['900']
107
+ standard: baseThemeColours.green['700'],
108
+ mild: baseThemeColours.green['200'],
109
+ strong: baseThemeColours.green['900']
110
110
  },
111
111
  foreground: white,
112
- border: colours.green['900']
112
+ border: baseThemeColours.green['900']
113
113
  },
114
114
  secondary: {
115
115
  background: {
116
116
  standard: white,
117
117
  mild: white,
118
- strong: colours.gray['200']
118
+ strong: baseThemeColours.gray['200']
119
119
  },
120
120
  foreground: secondaryForeground,
121
- border: colours.gray['300']
121
+ border: baseThemeColours.gray['300']
122
122
  },
123
123
  shine: {
124
124
  background: {
125
- standard: colours.gray['200'],
126
- mild: colours.gray['100'],
127
- strong: colours.gray['300']
125
+ standard: baseThemeColours.gray['200'],
126
+ mild: baseThemeColours.gray['100'],
127
+ strong: baseThemeColours.gray['300']
128
128
  },
129
- foreground: colours.yellow['500'],
130
- border: colours.gray['300']
129
+ foreground: baseThemeColours.yellow['500'],
130
+ border: baseThemeColours.gray['300']
131
131
  },
132
132
  danger: {
133
133
  background: {
134
- standard: colours.red['600'],
135
- mild: colours.red['100'],
136
- strong: colours.red['800']
134
+ standard: baseThemeColours.red['600'],
135
+ mild: baseThemeColours.red['100'],
136
+ strong: baseThemeColours.red['800']
137
137
  },
138
138
  foreground: white,
139
- border: colours.red['800']
139
+ border: baseThemeColours.red['800']
140
140
  },
141
141
  warning: {
142
142
  background: {
143
- standard: colours.yellow['800'],
144
- mild: colours.yellow['100'],
145
- strong: colours.yellow['900']
143
+ standard: baseThemeColours.yellow['800'],
144
+ mild: baseThemeColours.yellow['100'],
145
+ strong: baseThemeColours.yellow['900']
146
146
  },
147
147
  foreground: white,
148
- border: colours.yellow['900']
148
+ border: baseThemeColours.yellow['900']
149
149
  },
150
150
  neutral: {
151
151
  background: {
152
- standard: colours.gray['700'],
153
- mild: colours.gray['200'],
154
- strong: colours.gray['900']
152
+ standard: baseThemeColours.gray['700'],
153
+ mild: baseThemeColours.gray['200'],
154
+ strong: baseThemeColours.gray['900']
155
155
  },
156
156
  foreground: white,
157
- border: colours.gray['900']
157
+ border: baseThemeColours.gray['900']
158
158
  },
159
159
  success: {
160
160
  background: {
161
- standard: colours.green['700'],
162
- mild: colours.green['200'],
163
- strong: colours.green['900']
161
+ standard: baseThemeColours.green['700'],
162
+ mild: baseThemeColours.green['200'],
163
+ strong: baseThemeColours.green['900']
164
164
  },
165
- foreground: colours.green['200'],
166
- border: colours.green['900']
165
+ foreground: baseThemeColours.green['200'],
166
+ border: baseThemeColours.green['900']
167
167
  },
168
168
  information: {
169
169
  background: {
170
- standard: colours.blue['800'],
171
- mild: colours.blue['200'],
172
- strong: colours.blue['900']
170
+ standard: baseThemeColours.blue['800'],
171
+ mild: baseThemeColours.blue['200'],
172
+ strong: baseThemeColours.blue['900']
173
173
  },
174
174
  foreground: white,
175
- border: colours.blue['900']
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: colours.gray['200'],
196
- gray: colours.gray['300'],
197
- dark: colours.gray['900']
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: colours.green['600'],
248
- secondary: colours.gray['700'],
249
- shine: colours.yellow['500'],
250
- link: colours.blue['500'],
251
- dark: colours.gray['900'],
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: colours.gray['400'],
254
- neutral: colours.gray['700'],
255
- light: colours.gray['600'],
256
- danger: colours.red['600'],
257
- warning: colours.yellow['800'],
258
- success: colours.green['600'],
259
- information: colours.blue['500']
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,3 @@
1
+ export declare const cssVarUnwrap: (value: string) => string;
2
+ export declare const getThemeTokenValue: (themeClass: string, token: string) => string | null;
3
+ //# sourceMappingURL=css.d.ts.map
@@ -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
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autoguru/overdrive",
3
- "version": "4.14.4",
3
+ "version": "4.14.6",
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",