@mackin.com/styleguide 7.13.0 → 7.13.1

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 (2) hide show
  1. package/index.js +7 -6
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -883,16 +883,17 @@ const getAutocompleteValueId = (v) => {
883
883
  };
884
884
  //TB: will need to use the new input
885
885
  const Autocomplete = (p) => {
886
- var _a;
886
+ var _a, _b;
887
887
  const element = React__namespace.useRef(null);
888
888
  const input = React__namespace.useRef(null);
889
889
  const list = React__namespace.useRef(null);
890
890
  const [values, setValues] = React__namespace.useState([]);
891
891
  const showValues = React__namespace.useMemo(() => values.length > 0, [values]);
892
+ const maxShowValues = (_a = p.maxShownValues) !== null && _a !== void 0 ? _a : DEFAULT_MAX_SHOWN_VALUES;
892
893
  const shownValues = React__namespace.useMemo(() => {
893
- var _a;
894
894
  if (!p.allowScroll) {
895
- return values.slice(0, (_a = p.maxShownValues) !== null && _a !== void 0 ? _a : DEFAULT_MAX_SHOWN_VALUES);
895
+ //TB:normalize this value and use it below for list building
896
+ return values.slice(0, maxShowValues);
896
897
  }
897
898
  return values.slice();
898
899
  }, [values]);
@@ -908,7 +909,7 @@ const Autocomplete = (p) => {
908
909
  else {
909
910
  setValues([]);
910
911
  }
911
- }, (_a = p.getOptionsDebounceMs) !== null && _a !== void 0 ? _a : 0, { leading: true, trailing: true }));
912
+ }, (_b = p.getOptionsDebounceMs) !== null && _b !== void 0 ? _b : 0, { leading: true, trailing: true }));
912
913
  const theme = useThemeSafely();
913
914
  const baseClass = css.css `
914
915
  label: Autocomplete;
@@ -989,9 +990,9 @@ const Autocomplete = (p) => {
989
990
  }
990
991
  }
991
992
  }, onKeyPress: e => { var _a; return (_a = p.onKeyPress) === null || _a === void 0 ? void 0 : _a.call(p, e); } }),
992
- showValues && (React__namespace.createElement(List, { ref: list, className: css.cx(listClass, p.allowScroll && css.css({
993
+ showValues && (React__namespace.createElement(List, { ref: list, className: css.cx(listClass, p.allowScroll && shownValues.length > maxShowValues && css.css({
993
994
  overflowY: 'scroll',
994
- maxHeight: `calc(${theme.controls.height} * ${p.maxShownValues})`
995
+ maxHeight: `calc(${theme.controls.height} * ${maxShowValues})`
995
996
  })) },
996
997
  shownValues.map((value, listItemIndex) => {
997
998
  return (React__namespace.createElement(ListItem, { key: getAutocompleteValueId(value), variant: "full" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mackin.com/styleguide",
3
- "version": "7.13.0",
3
+ "version": "7.13.1",
4
4
  "description": "",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",