@thecb/components 4.1.3 → 4.1.4

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/index.cjs.js CHANGED
@@ -18505,7 +18505,7 @@ function _templateObject3$5() {
18505
18505
  }
18506
18506
 
18507
18507
  function _templateObject2$b() {
18508
- var data = _taggedTemplateLiteral(["\n transform-origin: 0 0;\n border: 1px solid ", ";\n border-radius: 2px;\n background-color: ", ";\n padding: 8px 0 8px;\n position: absolute;\n width: 100%;\n max-height: 400px;\n overflow-y: scroll;\n z-index: 1;\n box-sizing: border-box;\n &:focus {\n outline: none;\n }\n"]);
18508
+ var data = _taggedTemplateLiteral(["\n transform-origin: 0 0;\n border: 1px solid ", ";\n border-radius: 2px;\n background-color: ", ";\n padding: 8px 0 8px;\n position: absolute;\n width: 100%;\n max-height: ", ";\n overflow-y: scroll;\n z-index: 1;\n box-sizing: border-box;\n &:focus {\n outline: none;\n }\n"]);
18509
18509
 
18510
18510
  _templateObject2$b = function _templateObject2() {
18511
18511
  return data;
@@ -18527,44 +18527,48 @@ var IconWrapper = styled__default.div(_templateObject$n(), function (_ref) {
18527
18527
  var open = _ref.open;
18528
18528
  return open ? "transform: rotate(-180deg)" : "";
18529
18529
  });
18530
- var DropdownContentWrapper = styled__default.div(_templateObject2$b(), GREY_CHATEAU, WHITE);
18531
- var DropdownItemWrapper = styled__default.div(_templateObject3$5(), function (_ref2) {
18532
- var selected = _ref2.selected,
18533
- themeValues = _ref2.themeValues;
18530
+ var DropdownContentWrapper = styled__default.div(_templateObject2$b(), GREY_CHATEAU, WHITE, function (_ref2) {
18531
+ var maxHeight = _ref2.maxHeight;
18532
+ return maxHeight || "400px";
18533
+ });
18534
+ var DropdownItemWrapper = styled__default.div(_templateObject3$5(), function (_ref3) {
18535
+ var selected = _ref3.selected,
18536
+ themeValues = _ref3.themeValues;
18534
18537
  return selected ? themeValues.selectedColor : WHITE;
18535
- }, function (_ref3) {
18536
- var disabled = _ref3.disabled;
18537
- return disabled ? "default" : "pointer";
18538
18538
  }, function (_ref4) {
18539
- var selected = _ref4.selected,
18540
- disabled = _ref4.disabled,
18541
- themeValues = _ref4.themeValues;
18542
- return selected ? themeValues.selectedColor : disabled ? WHITE : themeValues.hoverColor;
18539
+ var disabled = _ref4.disabled;
18540
+ return disabled ? "default" : "pointer";
18543
18541
  }, function (_ref5) {
18544
18542
  var selected = _ref5.selected,
18545
18543
  disabled = _ref5.disabled,
18546
18544
  themeValues = _ref5.themeValues;
18547
18545
  return selected ? themeValues.selectedColor : disabled ? WHITE : themeValues.hoverColor;
18546
+ }, function (_ref6) {
18547
+ var selected = _ref6.selected,
18548
+ disabled = _ref6.disabled,
18549
+ themeValues = _ref6.themeValues;
18550
+ return selected ? themeValues.selectedColor : disabled ? WHITE : themeValues.hoverColor;
18548
18551
  });
18549
- var SearchInput = styled__default.input(_templateObject4$2(), function (_ref6) {
18550
- var themeValues = _ref6.themeValues;
18552
+ var SearchInput = styled__default.input(_templateObject4$2(), function (_ref7) {
18553
+ var themeValues = _ref7.themeValues;
18551
18554
  return themeValues.hoverColor && themeValues.hoverColor;
18552
18555
  });
18553
18556
 
18554
- var Dropdown = function Dropdown(_ref7) {
18557
+ var Dropdown = function Dropdown(_ref8) {
18555
18558
  var _options$find;
18556
18559
 
18557
- var placeholder = _ref7.placeholder,
18558
- options = _ref7.options,
18559
- value = _ref7.value,
18560
- isOpen = _ref7.isOpen,
18561
- isError = _ref7.isError,
18562
- onSelect = _ref7.onSelect,
18563
- _ref7$disabledValues = _ref7.disabledValues,
18564
- disabledValues = _ref7$disabledValues === void 0 ? [] : _ref7$disabledValues,
18565
- _ref7$onClick = _ref7.onClick,
18566
- onClick = _ref7$onClick === void 0 ? noop : _ref7$onClick,
18567
- themeValues = _ref7.themeValues;
18560
+ var placeholder = _ref8.placeholder,
18561
+ options = _ref8.options,
18562
+ value = _ref8.value,
18563
+ isOpen = _ref8.isOpen,
18564
+ isError = _ref8.isError,
18565
+ onSelect = _ref8.onSelect,
18566
+ _ref8$disabledValues = _ref8.disabledValues,
18567
+ disabledValues = _ref8$disabledValues === void 0 ? [] : _ref8$disabledValues,
18568
+ _ref8$onClick = _ref8.onClick,
18569
+ onClick = _ref8$onClick === void 0 ? noop : _ref8$onClick,
18570
+ themeValues = _ref8.themeValues,
18571
+ maxHeight = _ref8.maxHeight;
18568
18572
 
18569
18573
  var _useState = React.useState(""),
18570
18574
  _useState2 = _slicedToArray(_useState, 2),
@@ -18728,6 +18732,7 @@ var Dropdown = function Dropdown(_ref7) {
18728
18732
  })) === null || _options$find === void 0 ? void 0 : _options$find.text : placeholder), /*#__PURE__*/React__default.createElement(IconWrapper, {
18729
18733
  open: isOpen
18730
18734
  }, /*#__PURE__*/React__default.createElement(DropdownIcon, null)))), isOpen ? /*#__PURE__*/React__default.createElement(DropdownContentWrapper, {
18735
+ maxHeight: maxHeight,
18731
18736
  open: isOpen,
18732
18737
  ref: dropdownRef,
18733
18738
  tabIndex: 0
@@ -18823,7 +18828,8 @@ var FormSelect = function FormSelect(_ref) {
18823
18828
  options = _ref.options,
18824
18829
  field = _ref.field,
18825
18830
  showErrors = _ref.showErrors,
18826
- onChange = _ref.onChange;
18831
+ onChange = _ref.onChange,
18832
+ dropdownMaxHeight = _ref.dropdownMaxHeight;
18827
18833
 
18828
18834
  var _useState = React.useState(false),
18829
18835
  _useState2 = _slicedToArray(_useState, 2),
@@ -18852,6 +18858,7 @@ var FormSelect = function FormSelect(_ref) {
18852
18858
  weight: "400",
18853
18859
  extraStyles: "margin-bottom: 4px;"
18854
18860
  }, labelTextWhenNoError), /*#__PURE__*/React__default.createElement(Dropdown$1, {
18861
+ maxHeight: dropdownMaxHeight,
18855
18862
  placeholder: options[0] ? options[0].text : "",
18856
18863
  options: options,
18857
18864
  value: field.rawValue,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "4.1.3",
3
+ "version": "4.1.4",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -31,7 +31,7 @@ const DropdownContentWrapper = styled.div`
31
31
  padding: 8px 0 8px;
32
32
  position: absolute;
33
33
  width: 100%;
34
- max-height: 400px;
34
+ max-height: ${({ maxHeight }) => maxHeight || "400px"};
35
35
  overflow-y: scroll;
36
36
  z-index: 1;
37
37
  box-sizing: border-box;
@@ -88,7 +88,8 @@ const Dropdown = ({
88
88
  onSelect,
89
89
  disabledValues = [],
90
90
  onClick = noop,
91
- themeValues
91
+ themeValues,
92
+ maxHeight
92
93
  }) => {
93
94
  const [inputValue, setInputValue] = useState("");
94
95
  const [optionsState, setOptionsState] = useState([]);
@@ -242,7 +243,12 @@ const Dropdown = ({
242
243
  </Stack>
243
244
  </Box>
244
245
  {isOpen ? (
245
- <DropdownContentWrapper open={isOpen} ref={dropdownRef} tabIndex={0}>
246
+ <DropdownContentWrapper
247
+ maxHeight={maxHeight}
248
+ open={isOpen}
249
+ ref={dropdownRef}
250
+ tabIndex={0}
251
+ >
246
252
  <Stack childGap="0">
247
253
  {filteredOptions.map((choice, i) => (
248
254
  <DropdownItemWrapper
@@ -11,7 +11,8 @@ const FormSelect = ({
11
11
  options,
12
12
  field,
13
13
  showErrors,
14
- onChange
14
+ onChange,
15
+ dropdownMaxHeight
15
16
  }) => {
16
17
  const [open, setOpen] = useState(false);
17
18
  const dropdownRef = useRef(null);
@@ -40,6 +41,7 @@ const FormSelect = ({
40
41
  {labelTextWhenNoError}
41
42
  </Text>
42
43
  <Dropdown
44
+ maxHeight={dropdownMaxHeight}
43
45
  placeholder={options[0] ? options[0].text : ""}
44
46
  options={options}
45
47
  value={field.rawValue}