@autoguru/overdrive 4.7.0 → 4.7.3

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 +1 @@
1
- {"version":3,"file":"AutoSuggest.d.ts","sourceRoot":"","sources":["../../../lib/components/AutoSuggest/AutoSuggest.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA8B,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAIvE,OAAO,EACN,wBAAwB,EAIxB,YAAY,EAEZ,GAAG,EAQH,MAAM,OAAO,CAAC;AAWf,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAMzC,MAAM,WAAW,gBAAgB,CAAC,WAAW;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,CAAC;IACxC,IAAI,CAAC,EAAE,OAAO,CAAC;CACf;AAED,oBAAY,uBAAuB,CAAC,WAAW,IAAI,CAAC,KAAK,EAAE;IAC1D,KAAK,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAC;IACrC,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,KAAK,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC,CAAC;CAClD,KAAK,YAAY,CAAC;AAiCnB,aAAK,WAAW,CAAC,WAAW,IAAI,KAAK,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC,CAAC;AAErE,MAAM,WAAW,KAAK,CAAC,WAAW,CACjC,SAAQ,IAAI,CACX,wBAAwB,CAAC,OAAO,SAAS,CAAC,EAC1C,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,YAAY,CAC5C;IACD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,QAAQ,CAAC;IACrB,KAAK,EAAE,gBAAgB,CAAC,WAAW,CAAC,GAAG,IA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S,CAAC,EAC1C,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,YAAY,CAC5C;IACD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,QAAQ,CAAC;IACrB,KAAK,EAAE,gBAAgB,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC;IAC5C,WAAW,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IAEtC,YAAY,CAAC,EAAE,uBAAuB,CAAC,WAAW,CAAC,CAAC;IAEpD,QAAQ,CAAC,CAAC,KAAK,EAAE,gBAAgB,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC;IAEtD,OAAO,CAAC,CAAC,KAAK,EAAE,gBAAgB,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC;CACrD;AAwGD,eAAO,MAAM,WAAW;UA2FS,IAAI,gBAAgB,CAAC;MACjD,YAAY,CAAC;AAmiBlB,eAAe,WAAW,CAAC"}
@@ -96,15 +96,25 @@ const inputReducerFactory = (suggestions) => (prevState, action) => {
96
96
  }
97
97
  }
98
98
  };
99
- export const AutoSuggest = forwardRef(function AutoSuggest({ autoFocus = false, autoWidth = false, inlineOptions = false, fieldIcon, suggestions, value, onChange: incomingOnChange, onEnter, itemRenderer = defaultItemRenderer, onBlur: incomingOnBlur, onFocus: incomingOnFocus, onKeyDown, onClick, ...textInputProps }, ref) {
99
+ export const AutoSuggest = forwardRef(function AutoSuggest({ autoFocus = false, autoWidth = false, inlineOptions = false, fieldIcon, suggestions, value: incomingValue, onChange: incomingOnChange, onEnter, itemRenderer = defaultItemRenderer, onBlur: incomingOnBlur, onFocus: incomingOnFocus, onKeyDown, onClick, ...textInputProps }, ref) {
100
100
  const inputRef = useRef();
101
+ const valueRef = useRef(incomingValue);
101
102
  useImperativeHandle(ref, () => inputRef.current);
102
103
  const [isDesktop] = useMedia(['desktop'], false);
103
104
  const [isFocused, setIsFocused] = useState(false);
104
105
  const [showModal, setShowModal] = useState(false);
106
+ const closeModal = useCallback(() => {
107
+ setShowModal(false);
108
+ setIsFocused(false);
109
+ }, [setShowModal]);
110
+ if (incomingValue && incomingValue !== valueRef.current) {
111
+ valueRef.current = incomingValue;
112
+ if (incomingValue.payload)
113
+ closeModal();
114
+ }
105
115
  const props = {
106
116
  suggestions,
107
- value,
117
+ value: valueRef.current,
108
118
  onChange: (value) => {
109
119
  if (typeof value.payload !== 'undefined' &&
110
120
  value.payload !== null) {
@@ -120,7 +130,7 @@ export const AutoSuggest = forwardRef(function AutoSuggest({ autoFocus = false,
120
130
  setShowModal(false);
121
131
  setIsFocused(false);
122
132
  inputRef.current?.blur();
123
- onEnter(value);
133
+ onEnter(valueRef.current);
124
134
  }
125
135
  },
126
136
  itemRenderer,
@@ -133,10 +143,6 @@ export const AutoSuggest = forwardRef(function AutoSuggest({ autoFocus = false,
133
143
  onBlur: wrapEvent(() => setIsFocused(false), incomingOnBlur),
134
144
  ...textInputProps,
135
145
  };
136
- const closeModal = useCallback(() => {
137
- setShowModal(false);
138
- setIsFocused(false);
139
- }, [setShowModal]);
140
146
  return !inlineOptions && !isDesktop && showModal ? (React.createElement(AutoSuggestFullscreenInput, { ...props, isFocused: isFocused, inlineOptions: true, fieldIcon: fieldIcon, autoFocus: autoFocus, closeModal: closeModal })) : (React.createElement(AutoSuggestInput, { ref: inputRef, ...props, isFocused: isFocused, inlineOptions: inlineOptions, fieldIcon: fieldIcon, autoFocus: autoFocus, autoWidth: autoWidth }));
141
147
  });
142
148
  const AutoSuggestFullscreenInput = forwardRef(function AutoSuggestFullscreenInput({ closeModal, ...props }, ref) {
@@ -1,5 +1,5 @@
1
- export declare const root: string;
2
1
  export declare const handle: Record<"transition" | "default", string>;
3
2
  export declare const toggled: string;
4
3
  export declare const disabled: Record<"default" | "toggled", string>;
4
+ export declare const root: string;
5
5
  //# 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,IAAI,QAKf,CAAC;AAEH,eAAO,MAAM,MAAM,0CAcjB,CAAC;AAEH,eAAO,MAAM,OAAO,QAGlB,CAAC;AAEH,eAAO,MAAM,QAAQ,uCAkBnB,CAAC"}
1
+ {"version":3,"file":"Switch.css.d.ts","sourceRoot":"","sources":["../../../lib/components/Switch/Switch.css.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,MAAM,0CAcjB,CAAC;AAEH,eAAO,MAAM,OAAO,QAGlB,CAAC;AAEH,eAAO,MAAM,QAAQ,uCAkBnB,CAAC;AAEH,eAAO,MAAM,IAAI,QAUf,CAAC"}
@@ -3,12 +3,6 @@ import { vars } from '../../themes/base/vars.css';
3
3
  const handleSize = '24px';
4
4
  const handleOffset = '2px';
5
5
  const borderSize = '1px';
6
- export const root = style({
7
- width: `calc((2 * ${handleSize}) + ${handleOffset} - 2 * ${borderSize})`,
8
- height: `calc(${handleSize} + (${handleOffset} * 2))`,
9
- transition: 'background-color 0.2s cubic-bezier(0, 0, 0.2, 1) 0s',
10
- border: `${borderSize} solid ${vars.border.colours.light}`,
11
- });
12
6
  export const handle = styleVariants({
13
7
  default: {
14
8
  borderColor: vars.border.colours.gray,
@@ -47,3 +41,14 @@ export const disabled = styleVariants({
47
41
  },
48
42
  },
49
43
  });
44
+ export const root = style({
45
+ width: `calc((2 * ${handleSize}) + ${handleOffset} - 2 * ${borderSize})`,
46
+ height: `calc(${handleSize} + (${handleOffset} * 2))`,
47
+ transition: 'background-color 0.2s cubic-bezier(0, 0, 0.2, 1) 0s',
48
+ border: `${borderSize} solid ${vars.border.colours.light}`,
49
+ selectors: {
50
+ [`&:not(${disabled.default}):not(${disabled.toggled}):focus`]: {
51
+ borderColor: vars.colours.intent.information.background.standard,
52
+ },
53
+ },
54
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autoguru/overdrive",
3
- "version": "4.7.0",
3
+ "version": "4.7.3",
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",