@true-engineering/true-react-common-ui-kit 4.0.0-alpha21 → 4.0.0-alpha23

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.
@@ -29655,7 +29655,7 @@
29655
29655
  ]
29656
29656
  });
29657
29657
  };
29658
- var DEFAULT_VALUE$1 = {
29658
+ var DEFAULT_VALUE = {
29659
29659
  phoneNumber: "",
29660
29660
  dialCode: ""
29661
29661
  };
@@ -29873,7 +29873,7 @@
29873
29873
  return _array_like_to_array$2(o, minLen);
29874
29874
  }
29875
29875
  var PhoneInput = function(_param) {
29876
- var _param_locale = _param.locale, locale = _param_locale === void 0 ? "ru" : _param_locale, _param_value = _param.value, value = _param_value === void 0 ? DEFAULT_VALUE$1 : _param_value, onChange = _param.onChange, data = _param.data, testId = _param.testId, isDisabled = _param.isDisabled, isInvalid = _param.isInvalid, isActive = _param.isActive, tweakStyles = _param.tweakStyles, _param_codeSearchPlaceholder = _param.codeSearchPlaceholder, codeSearchPlaceholder = _param_codeSearchPlaceholder === void 0 ? "Поиск" : _param_codeSearchPlaceholder, _param_noMatchesLabel = _param.noMatchesLabel, noMatchesLabel = _param_noMatchesLabel === void 0 ? "Ничего не найдено" : _param_noMatchesLabel, inputProps = _object_without_properties$5(_param, [
29876
+ var _param_locale = _param.locale, locale = _param_locale === void 0 ? "ru" : _param_locale, _param_value = _param.value, value = _param_value === void 0 ? DEFAULT_VALUE : _param_value, onChange = _param.onChange, data = _param.data, testId = _param.testId, isDisabled = _param.isDisabled, isInvalid = _param.isInvalid, isActive = _param.isActive, tweakStyles = _param.tweakStyles, _param_codeSearchPlaceholder = _param.codeSearchPlaceholder, codeSearchPlaceholder = _param_codeSearchPlaceholder === void 0 ? "Поиск" : _param_codeSearchPlaceholder, _param_noMatchesLabel = _param.noMatchesLabel, noMatchesLabel = _param_noMatchesLabel === void 0 ? "Ничего не найдено" : _param_noMatchesLabel, inputProps = _object_without_properties$5(_param, [
29877
29877
  "locale",
29878
29878
  "value",
29879
29879
  "onChange",
@@ -31316,6 +31316,9 @@
31316
31316
  return target;
31317
31317
  }
31318
31318
  var useStyles$4 = createThemedStyles("TextArea", {
31319
+ root: {
31320
+ width: "100%"
31321
+ },
31319
31322
  textarea: _object_spread_props$6(_object_spread$6({}, helpers.withScrollBar), {
31320
31323
  width: "100%",
31321
31324
  height: "100%",
@@ -31375,6 +31378,8 @@
31375
31378
  symbolsCountError: {
31376
31379
  color: "red"
31377
31380
  },
31381
+ symbolsCountActive: {},
31382
+ "counter-default": {},
31378
31383
  withLabel: {}
31379
31384
  });
31380
31385
  function _array_like_to_array(arr, len) {
@@ -31519,12 +31524,12 @@
31519
31524
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
31520
31525
  return _array_like_to_array(o, minLen);
31521
31526
  }
31522
- var DEFAULT_VALUE = "";
31523
31527
  var TextArea = /* @__PURE__ */ React.forwardRef(function(_param, ref) {
31524
- var _param_value = _param.value, value = _param_value === void 0 ? DEFAULT_VALUE : _param_value, placeholder = _param.placeholder, name = _param.name, shouldFocusOnMount = _param.shouldFocusOnMount, _param_hasCounter = _param.hasCounter, hasCounter = _param_hasCounter === void 0 ? true : _param_hasCounter, shouldTrimAfterMaxLength = _param.shouldTrimAfterMaxLength, _param_isAutoSized = _param.isAutoSized, isAutoSized = _param_isAutoSized === void 0 ? true : _param_isAutoSized, shouldAlwaysShowPlaceholder = _param.shouldAlwaysShowPlaceholder, isActive = _param.isActive, maxLength = _param.maxLength, rows = _param.rows, data = _param.data, testId = _param.testId, tweakStyles = _param.tweakStyles, onChange = _param.onChange, onPaste = _param.onPaste, onFocus = _param.onFocus, onBlur = _param.onBlur, infoMessage = _param.infoMessage, errorMessage = _param.errorMessage, label = _param.label, isDisabled = _param.isDisabled, isInvalid = _param.isInvalid, isRequired = _param.isRequired, size = _param.size, groupPlacement = _param.groupPlacement, textAreaProps = _object_without_properties$3(_param, [
31528
+ var _param_value = _param.value, value = _param_value === void 0 ? "" : _param_value, placeholder = _param.placeholder, name = _param.name, _param_counterPosition = _param.counterPosition, counterPosition = _param_counterPosition === void 0 ? "default" : _param_counterPosition, shouldFocusOnMount = _param.shouldFocusOnMount, _param_hasCounter = _param.hasCounter, hasCounter = _param_hasCounter === void 0 ? true : _param_hasCounter, shouldTrimAfterMaxLength = _param.shouldTrimAfterMaxLength, _param_isAutoSized = _param.isAutoSized, isAutoSized = _param_isAutoSized === void 0 ? true : _param_isAutoSized, shouldAlwaysShowPlaceholder = _param.shouldAlwaysShowPlaceholder, isActive = _param.isActive, maxLength = _param.maxLength, rows = _param.rows, data = _param.data, testId = _param.testId, tweakStyles = _param.tweakStyles, onChange = _param.onChange, onPaste = _param.onPaste, onFocus = _param.onFocus, onBlur = _param.onBlur, infoMessage = _param.infoMessage, errorMessage = _param.errorMessage, label = _param.label, isDisabled = _param.isDisabled, isInvalid = _param.isInvalid, isRequired = _param.isRequired, size = _param.size, groupPlacement = _param.groupPlacement, textAreaProps = _object_without_properties$3(_param, [
31525
31529
  "value",
31526
31530
  "placeholder",
31527
31531
  "name",
31532
+ "counterPosition",
31528
31533
  "shouldFocusOnMount",
31529
31534
  "hasCounter",
31530
31535
  "shouldTrimAfterMaxLength",
@@ -31552,6 +31557,8 @@
31552
31557
  var classes = useStyles$4({
31553
31558
  theme: tweakStyles
31554
31559
  });
31560
+ var shouldShowCounter = hasCounter && trueReactPlatformHelpers.isNotEmpty(maxLength);
31561
+ var counterString = "".concat(value.length, " / ").concat(maxLength);
31555
31562
  var tweakWithMessagesStyles = useTweakStyles({
31556
31563
  tweakStyles,
31557
31564
  className: "tweakWithMessages",
@@ -31578,14 +31585,18 @@
31578
31585
  setFocused(false);
31579
31586
  onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
31580
31587
  };
31581
- var _obj2;
31582
- return /* @__PURE__ */ jsxs(WithMessages, {
31583
- errorMessage,
31584
- infoMessage,
31585
- tweakStyles: tweakWithMessagesStyles,
31586
- testId: trueReactPlatformHelpers.getTestId(testId, "wrapper"),
31587
- children: [
31588
- /* @__PURE__ */ jsx(ControlWrapper, {
31588
+ var _obj2, _obj1;
31589
+ return /* @__PURE__ */ jsx("div", {
31590
+ className: clsx(classes.root, trueReactPlatformHelpers.isNotEmpty(size) && classes[size]),
31591
+ style: {
31592
+ "--counter-length": counterString.length
31593
+ },
31594
+ children: /* @__PURE__ */ jsx(WithMessages, {
31595
+ errorMessage,
31596
+ infoMessage,
31597
+ tweakStyles: tweakWithMessagesStyles,
31598
+ testId: trueReactPlatformHelpers.getTestId(testId, "wrapper"),
31599
+ children: /* @__PURE__ */ jsx(ControlWrapper, {
31589
31600
  label,
31590
31601
  tweakStyles: tweakControlWrapperStyles,
31591
31602
  isFocused: hasFocus,
@@ -31596,37 +31607,38 @@
31596
31607
  groupPlacement,
31597
31608
  size,
31598
31609
  isFullWidth: true,
31599
- children: /* @__PURE__ */ jsx("div", _object_spread_props$5(_object_spread$5({
31610
+ children: /* @__PURE__ */ jsxs("div", _object_spread_props$5(_object_spread$5({
31600
31611
  className: clsx(classes.wrapper, (_obj2 = {}, _define_property$5(_obj2, classes.autoSized, isAutoSized), _define_property$5(_obj2, classes.withLabel, hasLabel), _obj2))
31601
31612
  }, isAutoSized && {
31602
31613
  "data-value": value
31603
31614
  }), {
31604
- children: /* @__PURE__ */ jsx("textarea", _object_spread$5({
31605
- ref,
31606
- className: classes.textarea,
31607
- value,
31608
- disabled: isDisabled,
31609
- placeholder: hasPlaceholder ? placeholder : void 0,
31610
- maxLength: shouldTrimAfterMaxLength ? maxLength : void 0,
31611
- name,
31612
- rows,
31613
- onPaste,
31614
- onFocus: handleFocus,
31615
- onBlur: handleBlur,
31616
- onChange: handleChange,
31617
- autoFocus: shouldFocusOnMount
31618
- }, trueReactPlatformHelpers.addDataAttributes(data, testId), textAreaProps))
31615
+ children: [
31616
+ /* @__PURE__ */ jsx("textarea", _object_spread$5({
31617
+ ref,
31618
+ className: classes.textarea,
31619
+ value,
31620
+ disabled: isDisabled,
31621
+ placeholder: hasPlaceholder ? placeholder : void 0,
31622
+ maxLength: shouldTrimAfterMaxLength ? maxLength : void 0,
31623
+ name,
31624
+ rows,
31625
+ onPaste,
31626
+ onFocus: handleFocus,
31627
+ onBlur: handleBlur,
31628
+ onChange: handleChange,
31629
+ autoFocus: shouldFocusOnMount
31630
+ }, trueReactPlatformHelpers.addDataAttributes(data, testId), textAreaProps)),
31631
+ shouldShowCounter && /* @__PURE__ */ jsx("span", _object_spread_props$5(_object_spread$5({
31632
+ className: clsx(classes.symbolsCount, classes["counter-".concat(counterPosition)], (_obj1 = {}, _define_property$5(_obj1, classes.symbolsCountError, value.length > maxLength), _define_property$5(_obj1, classes.symbolsCountActive, hasFocus || hasValue), _obj1))
31633
+ }, trueReactPlatformHelpers.addDataAttributes({
31634
+ counterPosition
31635
+ })), {
31636
+ children: counterString
31637
+ }))
31638
+ ]
31619
31639
  }))
31620
- }),
31621
- hasCounter && trueReactPlatformHelpers.isNotEmpty(maxLength) && /* @__PURE__ */ jsxs("span", {
31622
- className: clsx(classes.symbolsCount, _define_property$5({}, classes.symbolsCountError, value.length > maxLength)),
31623
- children: [
31624
- value.length,
31625
- " / ",
31626
- maxLength
31627
- ]
31628
31640
  })
31629
- ]
31641
+ })
31630
31642
  });
31631
31643
  });
31632
31644
  var useStyles$3 = createThemedStyles("TextButton", {