@autoguru/overdrive 4.9.4 → 4.9.5

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.
Files changed (26) hide show
  1. package/dist/components/AutoSuggest/stories.js +16 -0
  2. package/dist/components/ColourInput/stories.js +16 -0
  3. package/dist/components/DateInput/stories.js +16 -0
  4. package/dist/components/MinimalModal/MinimalModal.d.ts.map +1 -1
  5. package/dist/components/MinimalModal/MinimalModal.js +9 -7
  6. package/dist/components/NumberInput/stories.js +16 -0
  7. package/dist/components/Portal/Portal.d.ts.map +1 -1
  8. package/dist/components/Portal/Portal.js +14 -12
  9. package/dist/components/SelectInput/stories.js +16 -0
  10. package/dist/components/StandardModal/StandardModal.d.ts.map +1 -1
  11. package/dist/components/StandardModal/StandardModal.js +9 -7
  12. package/dist/components/TextInput/stories.js +48 -0
  13. package/dist/components/Toaster/Toast.d.ts.map +1 -1
  14. package/dist/components/Toaster/Toast.js +11 -8
  15. package/dist/components/private/InputBase/NotchedBase.css.d.ts +4 -0
  16. package/dist/components/private/InputBase/NotchedBase.css.d.ts.map +1 -1
  17. package/dist/components/private/InputBase/NotchedBase.css.js +37 -7
  18. package/dist/components/private/InputBase/NotchedBase.d.ts +1 -0
  19. package/dist/components/private/InputBase/NotchedBase.d.ts.map +1 -1
  20. package/dist/components/private/InputBase/NotchedBase.js +25 -4
  21. package/dist/components/private/InputBase/withEnhancedInput.d.ts +4 -5
  22. package/dist/components/private/InputBase/withEnhancedInput.d.ts.map +1 -1
  23. package/dist/components/private/InputBase/withEnhancedInput.js +2 -2
  24. package/dist/hooks/useMedia/useMedia.d.ts.map +1 -1
  25. package/dist/hooks/useMedia/useMedia.js +22 -20
  26. package/package.json +1 -1
@@ -31,6 +31,14 @@ const iconOptions = {
31
31
  StarIcon,
32
32
  CheckIcon
33
33
  };
34
+ const attachOptions = {
35
+ NONE: 'NONE',
36
+ TOP: 'TOP',
37
+ RIGHT: 'RIGHT',
38
+ LEFT: 'LEFT',
39
+ BOTTOM: 'BOTTOM',
40
+ ALL: 'ALL'
41
+ };
34
42
  export default {
35
43
  title: 'Components/Inputs/AutoSuggest',
36
44
  component: AutoSuggest,
@@ -53,6 +61,14 @@ export default {
53
61
  type: 'select'
54
62
  }
55
63
  },
64
+ attach: {
65
+ defaultValue: 'NONE',
66
+ description: 'Input attach',
67
+ options: attachOptions,
68
+ control: {
69
+ type: 'select'
70
+ }
71
+ },
56
72
  fieldIcon: {
57
73
  defaultValue: void 0,
58
74
  description: 'Input field Icon',
@@ -30,12 +30,28 @@ const iconOptions = {
30
30
  PlusIcon,
31
31
  StarIcon
32
32
  };
33
+ const attachOptions = {
34
+ NONE: 'NONE',
35
+ TOP: 'TOP',
36
+ RIGHT: 'RIGHT',
37
+ LEFT: 'LEFT',
38
+ BOTTOM: 'BOTTOM',
39
+ ALL: 'ALL'
40
+ };
33
41
  const argTypes = {
34
42
  value: {
35
43
  control: {
36
44
  type: 'color'
37
45
  }
38
46
  },
47
+ attach: {
48
+ defaultValue: 'NONE',
49
+ description: 'Input attach',
50
+ options: attachOptions,
51
+ control: {
52
+ type: 'select'
53
+ }
54
+ },
39
55
  suffixIcon: {
40
56
  defaultValue: null,
41
57
  description: 'Input suffix Icon',
@@ -40,12 +40,28 @@ const iconOptions = {
40
40
  PlusIcon,
41
41
  StarIcon
42
42
  };
43
+ const attachOptions = {
44
+ NONE: 'NONE',
45
+ TOP: 'TOP',
46
+ RIGHT: 'RIGHT',
47
+ LEFT: 'LEFT',
48
+ BOTTOM: 'BOTTOM',
49
+ ALL: 'ALL'
50
+ };
43
51
  const argTypes = {
44
52
  value: {
45
53
  control: {
46
54
  type: 'date'
47
55
  }
48
56
  },
57
+ attach: {
58
+ defaultValue: 'NONE',
59
+ description: 'Input attach',
60
+ options: attachOptions,
61
+ control: {
62
+ type: 'select'
63
+ }
64
+ },
49
65
  prefixIcon: {
50
66
  defaultValue: null,
51
67
  description: 'Input prefix Icon',
@@ -1 +1 @@
1
- {"version":3,"file":"MinimalModal.d.ts","sourceRoot":"","sources":["../../../lib/components/MinimalModal/MinimalModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,cAAc,EACd,iBAAiB,EAEjB,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,SAAS,EAA2B,MAAM,OAAO,CAAC;AAG3D,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAIjC,MAAM,WAAW,KAChB,SAAQ,cAAc,CAAC,OAAO,KAAK,CAAC,EACnC,IAAI,CAAC,cAAc,CAAC,OAAO,GAAG,CAAC,EAAE,YAAY,CAAC;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACrB;AAED,eAAO,MAAM,YAAY,EAAE,iBAAiB,CAAC,KAAK,CAmEjD,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"MinimalModal.d.ts","sourceRoot":"","sources":["../../../lib/components/MinimalModal/MinimalModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,cAAc,EACd,iBAAiB,EAEjB,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,SAAS,EAA2B,MAAM,OAAO,CAAC;AAG3D,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAIjC,MAAM,WAAW,KAChB,SAAQ,cAAc,CAAC,OAAO,KAAK,CAAC,EACnC,IAAI,CAAC,cAAc,CAAC,OAAO,GAAG,CAAC,EAAE,YAAY,CAAC;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACrB;AAED,eAAO,MAAM,YAAY,EAAE,iBAAiB,CAAC,KAAK,CAqEjD,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { useLayoutEffect, useRef } from 'react';
3
- import { useEventCallback, useId } from '../../utils';
3
+ import { isBrowser, useEventCallback, useId } from '../../utils';
4
4
  import { Box } from '../Box';
5
5
  import { Modal } from '../Modal';
6
6
  import * as styles from './MinimalModal.css';
@@ -16,12 +16,14 @@ export const MinimalModal = ({ isOpen, alignItems = 'center', className = '', on
16
16
  if (typeof onRequestClose === 'function')
17
17
  onRequestClose('backdrop');
18
18
  });
19
- useLayoutEffect(() => {
20
- document.body.style.overflow = isOpen ? 'hidden' : '';
21
- return () => {
22
- document.body.style.overflow = '';
23
- };
24
- }, [isOpen]);
19
+ if (isBrowser) {
20
+ useLayoutEffect(() => {
21
+ document.body.style.overflow = isOpen ? 'hidden' : '';
22
+ return () => {
23
+ document.body.style.overflow = '';
24
+ };
25
+ }, [isOpen]);
26
+ }
25
27
  return (React.createElement(Modal, { isOpen: isOpen, onRequestClose: onRequestClose },
26
28
  React.createElement(Box, { className: [styles.container, className], height: "full", display: "flex", alignItems: alignItems, justifyContent: "center", "aria-hidden": isOpen ? 'false' : 'true', role: "none presentation", onMouseDown: unlockModal, onClick: backdropHandler },
27
29
  React.createElement(Box, { is: "article", role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, display: "flex", flexDirection: "column" },
@@ -34,6 +34,14 @@ const iconOptions = {
34
34
  StarIcon,
35
35
  CheckIcon
36
36
  };
37
+ const attachOptions = {
38
+ NONE: 'NONE',
39
+ TOP: 'TOP',
40
+ RIGHT: 'RIGHT',
41
+ LEFT: 'LEFT',
42
+ BOTTOM: 'BOTTOM',
43
+ ALL: 'ALL'
44
+ };
37
45
  const argTypes = {
38
46
  prefixIcon: {
39
47
  defaultValue: null,
@@ -43,6 +51,14 @@ const argTypes = {
43
51
  type: 'select'
44
52
  }
45
53
  },
54
+ attach: {
55
+ defaultValue: 'NONE',
56
+ description: 'Input attach',
57
+ options: attachOptions,
58
+ control: {
59
+ type: 'select'
60
+ }
61
+ },
46
62
  suffixIcon: {
47
63
  defaultValue: null,
48
64
  description: 'Input suffix Icon',
@@ -1 +1 @@
1
- {"version":3,"file":"Portal.d.ts","sourceRoot":"","sources":["../../../lib/components/Portal/Portal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAa,MAAM,OAAO,CAAC;AACvD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,MAAM,WAAW,KAAK;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC1B;AAID,iBAAS,MAAM,CACd,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,EAAE,KAAK,EAC/C,GAAG,EAAE,GAAG,CAAC,OAAO,SAAS,CAAC,4BA2B1B;AAED,QAAA,MAAM,OAAO,mFAAqB,CAAC;AACnC,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,CAAC;AAE7B,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"Portal.d.ts","sourceRoot":"","sources":["../../../lib/components/Portal/Portal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAa,MAAM,OAAO,CAAC;AACvD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,MAAM,WAAW,KAAK;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC1B;AAID,iBAAS,MAAM,CACd,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,EAAE,KAAK,EAC/C,GAAG,EAAE,GAAG,CAAC,OAAO,SAAS,CAAC,4BA6B1B;AAED,QAAA,MAAM,OAAO,mFAAqB,CAAC;AACnC,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,CAAC;AAE7B,eAAe,MAAM,CAAC"}
@@ -1,22 +1,24 @@
1
1
  import * as React from 'react';
2
2
  import { forwardRef, useLayoutEffect, useState } from 'react';
3
3
  import { createPortal } from 'react-dom';
4
- import { isHtmlElement, setRef } from '../../utils';
4
+ import { isBrowser, isHtmlElement, setRef } from '../../utils';
5
5
  import { useTheme } from '../ThemeProvider';
6
6
  function Portal({ children, container, noThemedWrapper }, ref) {
7
7
  const themeClass = useTheme()?.themeClass;
8
8
  const [mountNode, setMountNode] = useState(null);
9
- useLayoutEffect(() => {
10
- setMountNode(isHtmlElement(container) ? container : document.body);
11
- }, [container]);
12
- useLayoutEffect(() => {
13
- if (mountNode) {
14
- setRef(ref, mountNode);
15
- }
16
- return () => {
17
- void setRef(ref, null);
18
- };
19
- }, [ref, mountNode]);
9
+ if (isBrowser) {
10
+ useLayoutEffect(() => {
11
+ setMountNode(isHtmlElement(container) ? container : document.body);
12
+ }, [container]);
13
+ useLayoutEffect(() => {
14
+ if (mountNode) {
15
+ setRef(ref, mountNode);
16
+ }
17
+ return () => {
18
+ void setRef(ref, null);
19
+ };
20
+ }, [ref, mountNode]);
21
+ }
20
22
  if (!mountNode)
21
23
  return null;
22
24
  return noThemedWrapper
@@ -39,6 +39,14 @@ const iconOptions = {
39
39
  StarIcon,
40
40
  CheckIcon
41
41
  };
42
+ const attachOptions = {
43
+ NONE: 'NONE',
44
+ TOP: 'TOP',
45
+ RIGHT: 'RIGHT',
46
+ LEFT: 'LEFT',
47
+ BOTTOM: 'BOTTOM',
48
+ ALL: 'ALL'
49
+ };
42
50
  const argTypes = {
43
51
  value: {
44
52
  options: valueOptions,
@@ -47,6 +55,14 @@ const argTypes = {
47
55
  type: 'select'
48
56
  }
49
57
  },
58
+ attach: {
59
+ defaultValue: 'NONE',
60
+ description: 'Input attach',
61
+ options: attachOptions,
62
+ control: {
63
+ type: 'select'
64
+ }
65
+ },
50
66
  prefixIcon: {
51
67
  defaultValue: null,
52
68
  description: 'Input prefix Icon',
@@ -1 +1 @@
1
- {"version":3,"file":"StandardModal.d.ts","sourceRoot":"","sources":["../../../lib/components/StandardModal/StandardModal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACX,cAAc,EACd,iBAAiB,EAEjB,MAAM,OAAO,CAAC;AASf,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAKjC,oBAAY,KAAK;IAChB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,QAAQ,aAAa;CACrB;AAED,aAAK,IAAI,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC;AAE7C,MAAM,WAAW,KAAM,SAAQ,cAAc,CAAC,OAAO,KAAK,CAAC;IAC1D,IAAI,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,aAAa,EAAE,iBAAiB,CAAC,KAAK,CAoHlD,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"StandardModal.d.ts","sourceRoot":"","sources":["../../../lib/components/StandardModal/StandardModal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACX,cAAc,EACd,iBAAiB,EAEjB,MAAM,OAAO,CAAC;AASf,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAKjC,oBAAY,KAAK;IAChB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,QAAQ,aAAa;CACrB;AAED,aAAK,IAAI,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC;AAE7C,MAAM,WAAW,KAAM,SAAQ,cAAc,CAAC,OAAO,KAAK,CAAC;IAC1D,IAAI,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,aAAa,EAAE,iBAAiB,CAAC,KAAK,CAsHlD,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -2,7 +2,7 @@ import { WindowCloseIcon } from '@autoguru/icons';
2
2
  import clsx from 'clsx';
3
3
  import * as React from 'react';
4
4
  import { useLayoutEffect, useRef } from 'react';
5
- import { useEventCallback, useId } from '../../utils';
5
+ import { isBrowser, useEventCallback, useId } from '../../utils';
6
6
  import { Box } from '../Box';
7
7
  import { Button } from '../Button';
8
8
  import { Heading } from '../Heading';
@@ -32,12 +32,14 @@ export const StandardModal = ({ isOpen, size = 'standard', className = '', title
32
32
  if (typeof onRequestClose === 'function')
33
33
  onRequestClose('backdrop');
34
34
  });
35
- useLayoutEffect(() => {
36
- document.body.style.overflow = isOpen ? 'hidden' : '';
37
- return () => {
38
- document.body.style.overflow = '';
39
- };
40
- }, [isOpen]);
35
+ if (isBrowser) {
36
+ useLayoutEffect(() => {
37
+ document.body.style.overflow = isOpen ? 'hidden' : '';
38
+ return () => {
39
+ document.body.style.overflow = '';
40
+ };
41
+ }, [isOpen]);
42
+ }
41
43
  return (React.createElement(Modal, { isOpen: isOpen, onRequestClose: onRequestClose },
42
44
  React.createElement(Box, { className: styles.container, height: "full", display: "flex", alignItems: "center", justifyContent: "center", "aria-hidden": isOpen ? 'false' : 'true', role: "none presentation", onMouseDown: unlockModal, onClick: backdropHandler },
43
45
  React.createElement(Box, { is: "article", overflow: "hidden", role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, display: "flex", flexDirection: "column", backgroundColour: "white", marginTop: "8", className: clsx([
@@ -32,7 +32,23 @@ const iconOptions = {
32
32
  StarIcon,
33
33
  CheckIcon
34
34
  };
35
+ const attachOptions = {
36
+ NONE: 'NONE',
37
+ TOP: 'TOP',
38
+ RIGHT: 'RIGHT',
39
+ LEFT: 'LEFT',
40
+ BOTTOM: 'BOTTOM',
41
+ ALL: 'ALL'
42
+ };
35
43
  const argTypes = {
44
+ attach: {
45
+ defaultValue: 'NONE',
46
+ description: 'Input attach',
47
+ options: attachOptions,
48
+ control: {
49
+ type: 'select'
50
+ }
51
+ },
36
52
  prefixIcon: {
37
53
  defaultValue: null,
38
54
  description: 'Input prefix Icon',
@@ -85,6 +101,26 @@ const withPrefixIconProps = _objectSpread(_objectSpread({}, sharedProps), {}, {
85
101
  prefixIcon: CalendarIcon
86
102
  });
87
103
 
104
+ const attachedLeftProps = _objectSpread(_objectSpread({}, sharedProps), {}, {
105
+ attach: 'LEFT'
106
+ });
107
+
108
+ const attachedTopProps = _objectSpread(_objectSpread({}, sharedProps), {}, {
109
+ attach: 'TOP'
110
+ });
111
+
112
+ const attachedRightProps = _objectSpread(_objectSpread({}, sharedProps), {}, {
113
+ attach: 'RIGHT'
114
+ });
115
+
116
+ const attachedBottomProps = _objectSpread(_objectSpread({}, sharedProps), {}, {
117
+ attach: 'BOTTOM'
118
+ });
119
+
120
+ const attachedAllProps = _objectSpread(_objectSpread({}, sharedProps), {}, {
121
+ attach: 'ALL'
122
+ });
123
+
88
124
  const withSuffixIconProps = _objectSpread(_objectSpread({}, sharedProps), {}, {
89
125
  suffixIcon: AccountEditIcon
90
126
  });
@@ -154,6 +190,18 @@ withSuffixIcon.argTypes = argTypes;
154
190
  export const withBothIcons = Template.bind(withBothIconsProps);
155
191
  withBothIcons.args = withBothIconsProps;
156
192
  withBothIcons.argTypes = argTypes;
193
+ export const attachedLeft = Template.bind(attachedLeftProps);
194
+ attachedLeft.args = attachedLeftProps;
195
+ attachedLeft.argTypes = argTypes;
196
+ export const attachedTop = Template.bind(attachedTopProps);
197
+ attachedTop.args = attachedTopProps;
198
+ attachedTop.argTypes = argTypes;
199
+ export const attachedRight = Template.bind(attachedRightProps);
200
+ attachedRight.args = attachedRightProps;
201
+ attachedRight.argTypes = argTypes;
202
+ export const attachedBottom = Template.bind(attachedBottomProps);
203
+ attachedBottom.args = attachedBottomProps;
204
+ attachedBottom.argTypes = argTypes;
157
205
  export const disabled = Template.bind(disabledProps);
158
206
  disabled.args = disabledProps;
159
207
  disabled.argTypes = argTypes;
@@ -1 +1 @@
1
- {"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../../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AC,QAAQ,CAAC,CAAC;AAEpE,UAAU,aAAa;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,WAAW,CAAC;IACrB,MAAM,EAAE,WAAW,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CACjB;AAID,UAAU,OACT,SAAQ,QAAQ,CACf,MAAM,CAAC,WAAW,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC,CACtE;IACD,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAChD;AA0ED,eAAO,MAAM,aAAa;;iBAQzB,CAAC;AAEF,eAAO,MAAM,QAAQ,QAAO,OAwE3B,CAAC;AAEF,QAAA,MAAM,KAAK,EAAE,iBAAiB,CAC7B,aAAa,GAAG;IACf,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7B,CA2BD,CAAC;AAEF,eAAe,KAAK,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { invariant } from '@autoguru/utilities';
2
2
  import * as React from 'react';
3
3
  import { createContext, useCallback, useContext, useLayoutEffect, useMemo, useReducer, } from 'react';
4
+ import { isBrowser } from '../../utils';
4
5
  import { Alert } from '../Alert';
5
6
  import { Box } from '../Box';
6
7
  import { Portal } from '../Portal';
@@ -108,14 +109,16 @@ const Toast = ({ remove, duration, message, id, intent }) => {
108
109
  const dismiss = useCallback(() => {
109
110
  remove(id);
110
111
  }, [id, remove]);
111
- useLayoutEffect(() => {
112
- const timeout = setTimeout(() => {
113
- dismiss();
114
- }, duration);
115
- return () => {
116
- clearTimeout(timeout);
117
- };
118
- }, [dismiss]);
112
+ if (isBrowser) {
113
+ useLayoutEffect(() => {
114
+ const timeout = setTimeout(() => {
115
+ dismiss();
116
+ }, duration);
117
+ return () => {
118
+ clearTimeout(timeout);
119
+ };
120
+ }, [dismiss]);
121
+ }
119
122
  return (React.createElement(Alert, { dismissible: true, intent: intent, className: styles.alert, onRequestClose: dismiss }, message));
120
123
  };
121
124
  export default Toast;
@@ -9,6 +9,10 @@ export declare const borders: {
9
9
  middle: string[];
10
10
  trailing: string[];
11
11
  };
12
+ export declare const bordersAttach: {
13
+ complete: Record<"NONE" | "LEFT" | "TOP" | "RIGHT" | "BOTTOM" | "ALL", string>;
14
+ flatCorners: Record<"TOP_LEFT" | "TOP_RIGHT" | "BOTTOM_RIGHT" | "BOTTOM_LEFT", string>;
15
+ };
12
16
  export declare const placeholder: Record<"default" | "mutedLabelStyles", string>;
13
17
  export declare const placeholderPlacement: any;
14
18
  //# sourceMappingURL=NotchedBase.css.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"NotchedBase.css.d.ts","sourceRoot":"","sources":["../../../../lib/components/private/InputBase/NotchedBase.css.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,IAAI,QAEf,CAAC;AAcH,eAAO,MAAM,OAAO;;;;;;;;;CA6CnB,CAAC;AAEF,eAAO,MAAM,WAAW,gDAWtB,CAAC;AA2BH,eAAO,MAAM,oBAAoB,KAiDhC,CAAC"}
1
+ {"version":3,"file":"NotchedBase.css.d.ts","sourceRoot":"","sources":["../../../../lib/components/private/InputBase/NotchedBase.css.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,IAAI,QAEf,CAAC;AAcH,eAAO,MAAM,OAAO;;;;;;;;;CAuCnB,CAAC;AAEF,eAAO,MAAM,aAAa;;;CAmCzB,CAAC;AAEF,eAAO,MAAM,WAAW,gDAWtB,CAAC;AA2BH,eAAO,MAAM,oBAAoB,KAiDhC,CAAC"}
@@ -26,13 +26,7 @@ export const borders = {
26
26
  ],
27
27
  disabled: style({ boxShadow: 'none' }),
28
28
  },
29
- complete: [
30
- borderVisualDefaults,
31
- borderRegionDefaults,
32
- style({
33
- borderRadius: `${vars.border.radius['1']}`,
34
- }),
35
- ],
29
+ complete: [borderVisualDefaults, borderRegionDefaults],
36
30
  leading: [
37
31
  borderRegionDefaults,
38
32
  style({
@@ -59,6 +53,42 @@ export const borders = {
59
53
  }),
60
54
  ],
61
55
  };
56
+ export const bordersAttach = {
57
+ complete: styleVariants({
58
+ NONE: {
59
+ borderRadius: `${vars.border.radius['1']}`,
60
+ },
61
+ LEFT: {
62
+ borderRadius: `0 ${vars.border.radius['1']} ${vars.border.radius['1']} 0`,
63
+ },
64
+ TOP: {
65
+ borderRadius: `0 0 ${vars.border.radius['1']} ${vars.border.radius['1']}`,
66
+ },
67
+ RIGHT: {
68
+ borderRadius: `${vars.border.radius['1']} 0 0 ${vars.border.radius['1']}`,
69
+ },
70
+ BOTTOM: {
71
+ borderRadius: `${vars.border.radius['1']} ${vars.border.radius['1']} 0 0`,
72
+ },
73
+ ALL: {
74
+ borderRadius: 0,
75
+ },
76
+ }),
77
+ flatCorners: styleVariants({
78
+ TOP_LEFT: {
79
+ borderTopLeftRadius: 0,
80
+ },
81
+ TOP_RIGHT: {
82
+ borderTopRightRadius: 0,
83
+ },
84
+ BOTTOM_RIGHT: {
85
+ borderBottomRightRadius: 0,
86
+ },
87
+ BOTTOM_LEFT: {
88
+ borderBottomLeftRadius: 0,
89
+ },
90
+ }),
91
+ };
62
92
  export const placeholder = styleVariants({
63
93
  default: {
64
94
  lineHeight: 1,
@@ -12,6 +12,7 @@ export interface Props {
12
12
  size: keyof typeof styles.placeholderPlacement;
13
13
  className?: string;
14
14
  children?: ReactNode;
15
+ attach?: keyof typeof styles.bordersAttach['complete'];
15
16
  }
16
17
  export declare const NotchedBase: FunctionComponent<Props>;
17
18
  //# sourceMappingURL=NotchedBase.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"NotchedBase.d.ts","sourceRoot":"","sources":["../../../../lib/components/private/InputBase/NotchedBase.tsx"],"names":[],"mappings":"AAEA,OAAO,EACN,iBAAiB,EACjB,SAAS,EAIT,MAAM,OAAO,CAAC;AAKf,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAM5C,MAAM,WAAW,KAA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,7 @@ import * as styles from './NotchedBase.css';
7
7
  const ACTIVE_SCALING_FACTOR = 0.7777;
8
8
  const ACTIVE_PADDING_ADDED = 16;
9
9
  const ROUGH_WIDTH_PER_CHARACTER = 10.2;
10
- export const NotchedBase = ({ id, placeholder, isEmpty, disabled, prefixed, size, children, notch = true, borderColourClassName, placeholderColourClassName, className = '', }) => {
10
+ export const NotchedBase = ({ id, placeholder, isEmpty, disabled, prefixed, size, children, notch = true, borderColourClassName, placeholderColourClassName, className = '', attach = 'NONE', }) => {
11
11
  const labelStyles = useTextStyles({
12
12
  noWrap: true,
13
13
  size: '4',
@@ -20,12 +20,26 @@ export const NotchedBase = ({ id, placeholder, isEmpty, disabled, prefixed, size
20
20
  }
21
21
  }, [placeholder]);
22
22
  const notchedWidth = getNotchedComputedWidthForWidth(labelWidth);
23
- return (React.createElement(Box, { position: "relative", width: "full", padding: "none", className: clsx(styles.root, !notch && [styles.borders.complete, borderColourClassName], className) },
23
+ return (React.createElement(Box, { position: "relative", width: "full", padding: "none", className: clsx(styles.root, !notch && [styles.borders.complete, borderColourClassName], className, {
24
+ [styles.bordersAttach.complete.NONE]: !notch && !attach,
25
+ [styles.bordersAttach.complete.LEFT]: !notch && attach === 'LEFT',
26
+ [styles.bordersAttach.complete.RIGHT]: !notch && attach === 'RIGHT',
27
+ [styles.bordersAttach.complete.TOP]: !notch && attach === 'TOP',
28
+ [styles.bordersAttach.complete.BOTTOM]: !notch && attach === 'BOTTOM',
29
+ [styles.bordersAttach.complete.ALL]: !notch && attach === 'ALL',
30
+ }) },
24
31
  children,
25
32
  notch && (React.createElement(Box, { className: clsx(styles.borders.root.default, {
26
33
  [styles.borders.root.disabled]: disabled,
27
34
  }), pointerEvents: "none", position: "absolute", display: "flex", width: "full", height: "full", textAlign: "left" },
28
- React.createElement("div", { className: clsx(styles.borders.leading, borderColourClassName) }),
35
+ React.createElement("div", { className: clsx(styles.borders.leading, borderColourClassName, {
36
+ [styles.bordersAttach.flatCorners.TOP_LEFT]: attach === 'LEFT' ||
37
+ attach === 'TOP' ||
38
+ attach === 'ALL',
39
+ [styles.bordersAttach.flatCorners.BOTTOM_LEFT]: attach === 'LEFT' ||
40
+ attach === 'BOTTOM' ||
41
+ attach === 'ALL',
42
+ }) }),
29
43
  React.createElement("div", { className: clsx(styles.borders.middle, borderColourClassName), style: { width: isEmpty ? 0 : notchedWidth } },
30
44
  React.createElement(Box, { ref: labelRef, is: "label", pointerEvents: "none", htmlFor: id, position: "absolute", display: "inline", margin: "none", padding: "none", className: clsx(styles.placeholder.default, placeholderColourClassName, labelStyles, {
31
45
  [styles.placeholder.mutedLabelStyles]: isEmpty || disabled,
@@ -34,7 +48,14 @@ export const NotchedBase = ({ id, placeholder, isEmpty, disabled, prefixed, size
34
48
  .defaultPrefixed]: isEmpty && prefixed,
35
49
  [styles.placeholderPlacement[size].shifted]: !isEmpty,
36
50
  }) }, placeholder)),
37
- React.createElement("div", { className: clsx(styles.borders.trailing, borderColourClassName) })))));
51
+ React.createElement("div", { className: clsx(styles.borders.trailing, borderColourClassName, borderColourClassName, {
52
+ [styles.bordersAttach.flatCorners.TOP_RIGHT]: attach === 'RIGHT' ||
53
+ attach === 'TOP' ||
54
+ attach === 'ALL',
55
+ [styles.bordersAttach.flatCorners.BOTTOM_RIGHT]: attach === 'RIGHT' ||
56
+ attach === 'BOTTOM' ||
57
+ attach === 'ALL',
58
+ }) })))));
38
59
  };
39
60
  function getNotchedComputedWidthForWidth(width) {
40
61
  return (Math.round((width * ACTIVE_SCALING_FACTOR + ACTIVE_PADDING_ADDED) * 100) / 100);
@@ -1,6 +1,7 @@
1
1
  import { IconType } from '@autoguru/icons';
2
2
  import * as React from 'react';
3
- import { AriaAttributes, ChangeEventHandler, ComponentType, FocusEventHandler, KeyboardEventHandler, MouseEventHandler, MutableRefObject, ReactNode, Ref } from 'react';
3
+ import { AriaAttributes, ChangeEventHandler, ComponentProps, ComponentType, FocusEventHandler, KeyboardEventHandler, MouseEventHandler, MutableRefObject, ReactNode, Ref } from 'react';
4
+ import { NotchedBase } from './NotchedBase';
4
5
  import * as styles from './withEnhancedInput.css';
5
6
  export interface EventHandlers<PrimitiveElementType> {
6
7
  onChange?: ChangeEventHandler<PrimitiveElementType>;
@@ -12,16 +13,14 @@ export interface EventHandlers<PrimitiveElementType> {
12
13
  onMouseLeave?: MouseEventHandler<PrimitiveElementType>;
13
14
  onReset?(): void;
14
15
  }
15
- export interface EnhanceInputPrimitiveProps extends AriaAttributes {
16
+ export interface EnhanceInputPrimitiveProps extends AriaAttributes, Pick<ComponentProps<typeof NotchedBase>, 'notch' | 'placeholder' | 'attach'> {
16
17
  name: string;
17
- placeholder: string;
18
18
  id?: string;
19
19
  className?: string;
20
20
  value?: string;
21
21
  hintText?: ReactNode;
22
22
  autoFocus?: boolean;
23
23
  disabled?: boolean;
24
- notch?: boolean;
25
24
  reserveHintSpace?: boolean;
26
25
  size?: keyof typeof styles.inputItselfSize;
27
26
  fieldIcon?: IconType;
@@ -49,7 +48,7 @@ export declare type WrappedComponentProps<IncomingProps, PrimitiveElementType> =
49
48
  prefixed: boolean;
50
49
  suffixed: boolean;
51
50
  isLoading: boolean;
52
- } & IncomingProps;
51
+ } & IncomingProps & Pick<ComponentProps<typeof NotchedBase>, 'attach'>;
53
52
  interface EnhancedInputConfigs<ValueType = string> {
54
53
  defaultValue?: ValueType;
55
54
  withPrefixIcon?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"withEnhancedInput.d.ts","sourceRoot":"","sources":["../../../../lib/components/private/InputBase/withEnhancedInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAG3C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACN,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EAEjB,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,SAAS,EACT,GAAG,EAGH,MAAM,OAAO,CAAC;AAUf,O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AC,CAAC;AAEpD,UAAU,oBAAoB,CAAC,SAAS,GAAG,MAAM;IAChD,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,EAAE,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;CAC5E;AAED,eAAO,MAAM,iBAAiB,sQAY1B,oBAAoB,+JAsPtB,CAAC"}
@@ -10,7 +10,7 @@ import { HintText } from './HintText';
10
10
  import * as inputStateStyles from './InputState.css';
11
11
  import { NotchedBase } from './NotchedBase';
12
12
  import * as styles from './withEnhancedInput.css';
13
- export const withEnhancedInput = (WrappingComponent, { primitiveType = 'text', withPrefixIcon = true, withSuffixIcon = true, defaultValue, } = { primitiveType: 'text', defaultValue: void 0 }) => forwardRef(({ placeholder, name, id = name, hintText, disabled = false, className, isTouched, isValid, isLoading = false, notch = true, reserveHintSpace = false, size = 'medium', value: incomingValue = defaultValue || '', onChange: incomingOnChange, onReset, onMouseLeave, onMouseEnter, onBlur, onFocus, onKeyDown, prefixIcon, suffixIcon, wrapperRef, autoFocus, ...rest }, ref) => {
13
+ export const withEnhancedInput = (WrappingComponent, { primitiveType = 'text', withPrefixIcon = true, withSuffixIcon = true, defaultValue, } = { primitiveType: 'text', defaultValue: void 0 }) => forwardRef(({ placeholder, name, id = name, hintText, disabled = false, className, isTouched, isValid, isLoading = false, notch = true, reserveHintSpace = false, size = 'medium', value: incomingValue = defaultValue || '', onChange: incomingOnChange, onReset, onMouseLeave, onMouseEnter, onBlur, onFocus, onKeyDown, prefixIcon, suffixIcon, wrapperRef, autoFocus, attach, ...rest }, ref) => {
14
14
  invariant(!(prefixIcon && !withPrefixIcon), 'prefix icon is not supported for this component');
15
15
  invariant(!(suffixIcon && !withSuffixIcon), 'suffix icon is not supported for this component');
16
16
  const [value, onChange] = useInputControlledState(incomingValue, incomingOnChange);
@@ -83,7 +83,7 @@ export const withEnhancedInput = (WrappingComponent, { primitiveType = 'text', w
83
83
  position: 'absolute',
84
84
  });
85
85
  return (React.createElement(Box, { width: "full", className: className, onMouseEnter: onMouseOver, onMouseLeave: onMouseOut },
86
- React.createElement(NotchedBase, { id: id, prefixed: Boolean(prefixIcon), isEmpty: isEmpty, size: size, disabled: disabled, notch: notch, placeholder: placeholder, placeholderColourClassName: clsx({
86
+ React.createElement(NotchedBase, { id: id, prefixed: Boolean(prefixIcon), isEmpty: isEmpty, size: size, disabled: disabled, notch: notch, placeholder: placeholder, attach: attach, placeholderColourClassName: clsx({
87
87
  [derivedColours.colour]: !isEmpty,
88
88
  }), borderColourClassName: derivedColours.borderColour },
89
89
  React.createElement(Box, { ref: wrapperRef, className: styles.inputWrapperSize[size].root[primitiveType], width: "full", height: "full" },
@@ -1 +1 @@
1
- {"version":3,"file":"useMedia.d.ts","sourceRoot":"","sources":["../../../lib/hooks/useMedia/useMedia.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGvD,eAAO,MAAM,QAAQ,YACX,cAAc,MAAM,WAAW,CAAC,6BAEvC,SAAS,OAAO,EA2ClB,CAAC;AAEF,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"useMedia.d.ts","sourceRoot":"","sources":["../../../lib/hooks/useMedia/useMedia.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGvD,eAAO,MAAM,QAAQ,YACX,cAAc,MAAM,WAAW,CAAC,6BAEvC,SAAS,OAAO,EA+ClB,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -8,27 +8,29 @@ export const useMedia = (queries, fallbackCase = false) => {
8
8
  const getQueries = useCallback(() => queries.map((media) => `(min-width: ${breakpoints[media]})`), [breakpoints]);
9
9
  const matchesInit = useMemo(() => getQueries().map((query) => window.matchMedia(query).matches), [getQueries]);
10
10
  const [matches, setMatches] = useState(matchesInit);
11
- useLayoutEffect(() => {
12
- let isMounted = true;
13
- const matchers = getQueries().map((query) => window.matchMedia(query));
14
- const removeHandlersFn = matchers.map((matcher, idx) => {
15
- const handler = (e) => {
16
- if (!isMounted)
17
- return;
18
- setMatches((prevState) => {
19
- const newState = [...prevState];
20
- newState[idx] = e.matches;
21
- return newState;
22
- });
11
+ if (isBrowser) {
12
+ useLayoutEffect(() => {
13
+ let isMounted = true;
14
+ const matchers = getQueries().map((query) => window.matchMedia(query));
15
+ const removeHandlersFn = matchers.map((matcher, idx) => {
16
+ const handler = (e) => {
17
+ if (!isMounted)
18
+ return;
19
+ setMatches((prevState) => {
20
+ const newState = [...prevState];
21
+ newState[idx] = e.matches;
22
+ return newState;
23
+ });
24
+ };
25
+ matcher.addEventListener('change', handler, { passive: true });
26
+ return () => matcher.removeEventListener('change', handler);
27
+ });
28
+ return () => {
29
+ isMounted = false;
30
+ removeHandlersFn.forEach((item) => item());
23
31
  };
24
- matcher.addEventListener('change', handler, { passive: true });
25
- return () => matcher.removeEventListener('change', handler);
26
- });
27
- return () => {
28
- isMounted = false;
29
- removeHandlersFn.forEach((item) => item());
30
- };
31
- }, [...queries, breakpoints]);
32
+ }, [...queries, breakpoints]);
33
+ }
32
34
  return matches;
33
35
  };
34
36
  export default useMedia;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autoguru/overdrive",
3
- "version": "4.9.4",
3
+ "version": "4.9.5",
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",