acsi-core 0.1.37 → 0.1.38

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.
@@ -14,6 +14,12 @@ interface IProps {
14
14
  rows?: number;
15
15
  width?: number;
16
16
  minHeight?: string;
17
+ className?: string;
18
+ onKeyDown?: (e: any) => void;
19
+ onKeyFocus?: (name: string, value: string) => void;
20
+ autoResize?: boolean;
21
+ onClick?: () => void;
22
+ onBlur?: () => void;
17
23
  }
18
24
  declare const CoreTextArea: (props: IProps) => React.JSX.Element;
19
25
  export default CoreTextArea;
package/dist/index.js CHANGED
@@ -1471,6 +1471,7 @@ var Info = function Info() {
1471
1471
  }));
1472
1472
  };
1473
1473
 
1474
+ var _excluded$1 = ["name", "value", "onChange", "placeholder", "error", "label", "isOptional", "tooltip", "noBorder", "smallHeight", "cols", "rows", "minHeight", "className", "onKeyDown", "onKeyFocus", "autoResize", "width", "onClick", "onBlur"];
1474
1475
  var CoreTextArea = function CoreTextArea(props) {
1475
1476
  var _props$name = props.name,
1476
1477
  name = _props$name === void 0 ? "" : _props$name,
@@ -1490,7 +1491,15 @@ var CoreTextArea = function CoreTextArea(props) {
1490
1491
  smallHeight = _props$smallHeight === void 0 ? false : _props$smallHeight,
1491
1492
  cols = props.cols,
1492
1493
  rows = props.rows,
1493
- minHeight = props.minHeight;
1494
+ minHeight = props.minHeight,
1495
+ className = props.className,
1496
+ _onKeyDown = props.onKeyDown,
1497
+ onKeyFocus = props.onKeyFocus,
1498
+ autoResize = props.autoResize,
1499
+ width = props.width,
1500
+ onClick = props.onClick,
1501
+ onBlur = props.onBlur,
1502
+ rest = _objectWithoutPropertiesLoose(props, _excluded$1);
1494
1503
  var _useState = React.useState(false),
1495
1504
  isOpenTooltip = _useState[0],
1496
1505
  setIsOpenTooltip = _useState[1];
@@ -1498,8 +1507,20 @@ var CoreTextArea = function CoreTextArea(props) {
1498
1507
  return setIsOpenTooltip(!isOpenTooltip);
1499
1508
  };
1500
1509
  var textareaRef = React.useRef(null);
1510
+ React.useEffect(function () {
1511
+ if (autoResize && textareaRef.current) {
1512
+ var el = textareaRef.current;
1513
+ requestAnimationFrame(function () {
1514
+ el.style.height = "auto";
1515
+ el.style.height = el.scrollHeight + "px";
1516
+ });
1517
+ }
1518
+ }, [value, autoResize]);
1501
1519
  return React__default.createElement("div", {
1502
- className: styles$8["editor"] + " " + (error ? styles$8["error"] : "") + " " + (noBorder ? styles$8["no-border"] : "") + " " + (smallHeight ? styles$8["small-height"] : "")
1520
+ className: styles$8["editor"] + " " + (error ? styles$8["error"] : "") + " " + (noBorder ? styles$8["no-border"] : "") + " " + (smallHeight ? styles$8["small-height"] : ""),
1521
+ style: {
1522
+ width: width != null ? width : "100%"
1523
+ }
1503
1524
  }, label && React__default.createElement("span", {
1504
1525
  className: styles$8["label"]
1505
1526
  }, React__default.createElement("div", {
@@ -1513,7 +1534,7 @@ var CoreTextArea = function CoreTextArea(props) {
1513
1534
  target: name,
1514
1535
  isOpen: isOpenTooltip,
1515
1536
  toggle: toggleTooltip
1516
- }, tooltip))), React__default.createElement("textarea", {
1537
+ }, tooltip))), React__default.createElement("textarea", Object.assign({
1517
1538
  ref: textareaRef,
1518
1539
  placeholder: placeholder,
1519
1540
  style: {
@@ -1528,8 +1549,17 @@ var CoreTextArea = function CoreTextArea(props) {
1528
1549
  rows: rows,
1529
1550
  onChange: function onChange(e) {
1530
1551
  return _onChange(name, e.target.value);
1531
- }
1532
- }));
1552
+ },
1553
+ onKeyDown: function onKeyDown(e) {
1554
+ return _onKeyDown === null || _onKeyDown === void 0 ? void 0 : _onKeyDown(e);
1555
+ },
1556
+ onFocus: function onFocus(e) {
1557
+ return onKeyFocus === null || onKeyFocus === void 0 ? void 0 : onKeyFocus(name, e.target.value);
1558
+ },
1559
+ className: className,
1560
+ onClick: onClick,
1561
+ onBlur: onBlur
1562
+ }, rest)));
1533
1563
  };
1534
1564
 
1535
1565
  var styles$9 = {"core-search":"_wyI1K","input":"_9XW-D","clear":"_1nhXy"};
@@ -1759,7 +1789,7 @@ var CoreSelectCompact = function CoreSelectCompact(props) {
1759
1789
 
1760
1790
  var styles$b = {"core-input-compact":"_1qmXW","label":"_1argp","icon":"_3DPRG"};
1761
1791
 
1762
- var _excluded$1 = ["name", "value", "onChange", "disabled", "label", "width", "placeholder", "error", "tooltip", "onKeyDown"];
1792
+ var _excluded$2 = ["name", "value", "onChange", "disabled", "label", "width", "placeholder", "error", "tooltip", "onKeyDown"];
1763
1793
  var CoreInputCompact = function CoreInputCompact(props) {
1764
1794
  var _props$name = props.name,
1765
1795
  name = _props$name === void 0 ? "" : _props$name,
@@ -1774,7 +1804,7 @@ var CoreInputCompact = function CoreInputCompact(props) {
1774
1804
  error = props.error,
1775
1805
  tooltip = props.tooltip,
1776
1806
  _onKeyDown = props.onKeyDown,
1777
- rest = _objectWithoutPropertiesLoose(props, _excluded$1);
1807
+ rest = _objectWithoutPropertiesLoose(props, _excluded$2);
1778
1808
  var _useState = React.useState(false),
1779
1809
  isOpenTooltip = _useState[0],
1780
1810
  setIsOpenTooltip = _useState[1];
@@ -1914,7 +1944,7 @@ var CustomOption = function CustomOption(props) {
1914
1944
  }, props.data.label));
1915
1945
  };
1916
1946
 
1917
- var _excluded$2 = ["isDefault", "defaultValue", "options", "isDisabled", "scrollBottom", "value", "isMulti"];
1947
+ var _excluded$3 = ["isDefault", "defaultValue", "options", "isDisabled", "scrollBottom", "value", "isMulti"];
1918
1948
  var CustomSelect = function CustomSelect(_ref) {
1919
1949
  var isDefault = _ref.isDefault,
1920
1950
  options = _ref.options,
@@ -1922,7 +1952,7 @@ var CustomSelect = function CustomSelect(_ref) {
1922
1952
  scrollBottom = _ref.scrollBottom,
1923
1953
  value = _ref.value,
1924
1954
  isMulti = _ref.isMulti,
1925
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
1955
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
1926
1956
  var initialValues = Array.isArray(value) ? options.filter(function (i) {
1927
1957
  return value.includes(i.value);
1928
1958
  }) : isMulti ? options === null || options === void 0 ? void 0 : options.filter(function (i) {
@@ -1949,7 +1979,7 @@ var CustomSelect = function CustomSelect(_ref) {
1949
1979
  }, rest));
1950
1980
  };
1951
1981
 
1952
- var _excluded$3 = ["isDefault", "defaultValue", "options", "isDisabled", "scrollBottom", "value", "isMulti"];
1982
+ var _excluded$4 = ["isDefault", "defaultValue", "options", "isDisabled", "scrollBottom", "value", "isMulti"];
1953
1983
  var CustomAsyncSelect = function CustomAsyncSelect(_ref) {
1954
1984
  var isDefault = _ref.isDefault,
1955
1985
  options = _ref.options,
@@ -1957,7 +1987,7 @@ var CustomAsyncSelect = function CustomAsyncSelect(_ref) {
1957
1987
  scrollBottom = _ref.scrollBottom,
1958
1988
  value = _ref.value,
1959
1989
  isMulti = _ref.isMulti,
1960
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
1990
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
1961
1991
  var initialValues = Array.isArray(value) ? options.filter(function (i) {
1962
1992
  return value.includes(i.value);
1963
1993
  }) : isMulti ? options.filter(function (i) {
@@ -1984,14 +2014,14 @@ var CustomAsyncSelect = function CustomAsyncSelect(_ref) {
1984
2014
  }, rest));
1985
2015
  };
1986
2016
 
1987
- var _excluded$4 = ["defaultValue", "options", "isDisabled", "scrollBottom", "value", "isMulti"];
2017
+ var _excluded$5 = ["defaultValue", "options", "isDisabled", "scrollBottom", "value", "isMulti"];
1988
2018
  var CustomCreatable = function CustomCreatable(_ref) {
1989
2019
  var options = _ref.options,
1990
2020
  isDisabled = _ref.isDisabled,
1991
2021
  scrollBottom = _ref.scrollBottom,
1992
2022
  value = _ref.value,
1993
2023
  isMulti = _ref.isMulti,
1994
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
2024
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$5);
1995
2025
  var initialValues = Array.isArray(value) ? options.filter(function (i) {
1996
2026
  return value.includes(i.value);
1997
2027
  }) : isMulti ? options.filter(function (i) {
@@ -2018,7 +2048,7 @@ var CustomCreatable = function CustomCreatable(_ref) {
2018
2048
  }, rest));
2019
2049
  };
2020
2050
 
2021
- var _excluded$5 = ["defaultValue", "options", "isDisabled", "scrollBottom", "value", "isMulti"];
2051
+ var _excluded$6 = ["defaultValue", "options", "isDisabled", "scrollBottom", "value", "isMulti"];
2022
2052
  var CustomSelectOption = function CustomSelectOption(_ref) {
2023
2053
  var defaultValue = _ref.defaultValue,
2024
2054
  options = _ref.options,
@@ -2026,7 +2056,7 @@ var CustomSelectOption = function CustomSelectOption(_ref) {
2026
2056
  scrollBottom = _ref.scrollBottom,
2027
2057
  value = _ref.value,
2028
2058
  isMulti = _ref.isMulti,
2029
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$5);
2059
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded$6);
2030
2060
  var initialValues = defaultValue !== null && typeof defaultValue !== "undefined" ? options.find(function (option) {
2031
2061
  return option.value === defaultValue;
2032
2062
  }) || null : null;