@true-engineering/true-react-common-ui-kit 4.0.0-alpha13 → 4.0.0-alpha15

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.
@@ -2,7 +2,6 @@ import { ITweakStyles } from '../../theme';
2
2
  import { IControlWrapperStyles } from '../ControlWrapper';
3
3
  import { IWithMessagesStyles } from '../WithMessages';
4
4
  export declare const useStyles: import("../../theme").IUseStyles<"textarea" | "autoSized" | "withLabel" | "wrapper" | "symbolsCount" | "symbolsCountError", unknown>;
5
- export declare const controlWrapperStyles: IControlWrapperStyles;
6
5
  export type ITextAreaStyles = ITweakStyles<typeof useStyles, {
7
6
  tweakWithMessages: IWithMessagesStyles;
8
7
  tweakControlWrapper: IControlWrapperStyles;
@@ -1,6 +1,6 @@
1
1
  import React, { createContext, useMemo, useContext, useInsertionEffect, useRef, useEffect, useCallback, useState, createElement, Fragment as Fragment$1, forwardRef, createRef, PureComponent, memo } from "react";
2
2
  import { jss, JssContext as JssContext$1, createUseStyles } from "react-jss";
3
- import { isNotEmpty, isArrayNotEmpty, mergeStyles, joinStrings, isObject as isObject$1, isStringEmpty, isString, isStringNotEmpty, mergeRefs, addDataTestId, applyAction, addDataAttributes as addDataAttributes$1, stopPropagation, isReactNodeNotEmpty, addClickHandler, getTestId, getSelectKeyHandler, getArray, createFilter, isEmpty, isFunction as isFunction$1, getTransition, indexMap, isNumberInteger, hasDuplicates, isArrayLikeNotEmpty, isArrayEmpty } from "@true-engineering/true-react-platform-helpers";
3
+ import { isNotEmpty, isArrayNotEmpty, mergeStyles, joinStrings, isObject as isObject$1, isStringEmpty, isString, isStringNotEmpty, mergeRefs, addDataTestId, applyAction, addDataAttributes as addDataAttributes$1, stopPropagation, isReactNodeNotEmpty, addClickHandler, getTestId, getSelectKeyHandler, isArrayLikeNotEmpty, getArray, createFilter, isEmpty, isFunction as isFunction$1, getTransition, indexMap, isNumberInteger, hasDuplicates, isArrayEmpty } from "@true-engineering/true-react-platform-helpers";
4
4
  import { merge as merge$2 } from "lodash-es";
5
5
  import { CSSTransition } from "react-transition-group";
6
6
  import clsx from "clsx";
@@ -9931,7 +9931,7 @@ var useStyles$H = createThemedStyles("ControlWrapper", {
9931
9931
  position: "absolute",
9932
9932
  pointerEvents: "none",
9933
9933
  left: "var(--control-padding)",
9934
- top: "50%",
9934
+ top: "calc(var(--control-height) / 2)",
9935
9935
  transformOrigin: "top left",
9936
9936
  transform: "translateY(-50%)",
9937
9937
  transition: animations.defaultTransition,
@@ -10544,7 +10544,7 @@ var InputBase = /* @__PURE__ */ forwardRef(function(_param, ref) {
10544
10544
  "url"
10545
10545
  ].includes(type) ? type : void 0;
10546
10546
  var hasFocus = isFocused || isActive;
10547
- var hasValue = isNotEmpty(value) && value !== "";
10547
+ var hasValue = isArrayLikeNotEmpty(value);
10548
10548
  var hasUnits = isReactNodeNotEmpty(units);
10549
10549
  var hasPlaceholder = (!isReactNodeNotEmpty(label) || hasFocus || shouldAlwaysShowPlaceholder) && isStringNotEmpty(placeholder);
10550
10550
  var handleChange = function(event) {
@@ -10641,7 +10641,7 @@ var InputBase = /* @__PURE__ */ forwardRef(function(_param, ref) {
10641
10641
  isDisabled,
10642
10642
  isFocused: hasFocus,
10643
10643
  isInvalid,
10644
- hasValue: hasValue || hasPlaceholder,
10644
+ hasValue,
10645
10645
  isFullWidth: !isAutoSized,
10646
10646
  tweakStyles: tweakControlWrapperStyles,
10647
10647
  onClear: isClearable && hasValue ? handleInputClear : void 0,
@@ -11001,15 +11001,9 @@ function _object_without_properties_loose$f(source, excluded) {
11001
11001
  return target;
11002
11002
  }
11003
11003
  var SearchInput = /* @__PURE__ */ forwardRef(function(_param, ref) {
11004
- var _param_isClearable = _param.isClearable, isClearable = _param_isClearable === void 0 ? true : _param_isClearable, placeholder = _param.placeholder, value = _param.value, testId = _param.testId, tweakStyles = _param.tweakStyles;
11005
- _param.data;
11006
- var props = _object_without_properties$f(_param, [
11004
+ var _param_isClearable = _param.isClearable, isClearable = _param_isClearable === void 0 ? true : _param_isClearable, tweakStyles = _param.tweakStyles, props = _object_without_properties$f(_param, [
11007
11005
  "isClearable",
11008
- "placeholder",
11009
- "value",
11010
- "testId",
11011
- "tweakStyles",
11012
- "data"
11006
+ "tweakStyles"
11013
11007
  ]);
11014
11008
  var tweakInputStyles = useTweakStyles({
11015
11009
  innerStyles: inputStyles$4,
@@ -11019,11 +11013,8 @@ var SearchInput = /* @__PURE__ */ forwardRef(function(_param, ref) {
11019
11013
  });
11020
11014
  return /* @__PURE__ */ jsx(Input, _object_spread$N({
11021
11015
  ref,
11022
- value,
11023
- placeholder,
11024
11016
  icon: "search",
11025
11017
  isClearable,
11026
- testId: getTestId(testId, "input"),
11027
11018
  tweakStyles: tweakInputStyles
11028
11019
  }, props));
11029
11020
  });
@@ -31275,11 +31266,6 @@ var useStyles$4 = createThemedStyles("TextArea", {
31275
31266
  },
31276
31267
  withLabel: {}
31277
31268
  });
31278
- var controlWrapperStyles = {
31279
- label: {
31280
- top: 16
31281
- }
31282
- };
31283
31269
  function _array_like_to_array(arr, len) {
31284
31270
  if (len == null || len > arr.length)
31285
31271
  len = arr.length;
@@ -31424,9 +31410,7 @@ function _unsupported_iterable_to_array(o, minLen) {
31424
31410
  }
31425
31411
  var DEFAULT_VALUE = "";
31426
31412
  var TextArea = /* @__PURE__ */ forwardRef(function(_param, ref) {
31427
- var _param_value = _param.value, value = _param_value === void 0 ? DEFAULT_VALUE : _param_value, label = _param.label, placeholder = _param.placeholder, name = _param.name;
31428
- _param.shouldFocusOnMount;
31429
- var _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, isDisabled = _param.isDisabled, 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, isInvalid = _param.isInvalid, isRequired = _param.isRequired, size2 = _param.size, textAreaProps = _object_without_properties$3(_param, [
31413
+ var _param_value = _param.value, value = _param_value === void 0 ? DEFAULT_VALUE : _param_value, label = _param.label, 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, isDisabled = _param.isDisabled, 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, isInvalid = _param.isInvalid, isRequired = _param.isRequired, size2 = _param.size, textAreaProps = _object_without_properties$3(_param, [
31430
31414
  "value",
31431
31415
  "label",
31432
31416
  "placeholder",
@@ -31462,7 +31446,6 @@ var TextArea = /* @__PURE__ */ forwardRef(function(_param, ref) {
31462
31446
  currentComponentName: "TextArea"
31463
31447
  });
31464
31448
  var tweakControlWrapperStyles = useTweakStyles({
31465
- innerStyles: controlWrapperStyles,
31466
31449
  tweakStyles,
31467
31450
  className: "tweakControlWrapper",
31468
31451
  currentComponentName: "TextArea"
@@ -31517,7 +31500,8 @@ var TextArea = /* @__PURE__ */ forwardRef(function(_param, ref) {
31517
31500
  onPaste,
31518
31501
  onFocus: handleFocus,
31519
31502
  onBlur: handleBlur,
31520
- onChange: handleChange
31503
+ onChange: handleChange,
31504
+ autoFocus: shouldFocusOnMount
31521
31505
  }, addDataAttributes$1(data, testId), textAreaProps))
31522
31506
  }))
31523
31507
  }),
@@ -31538,6 +31522,7 @@ var useStyles$3 = createThemedStyles("TextButton", {
31538
31522
  alignItems: "center",
31539
31523
  height: 24,
31540
31524
  padding: 0,
31525
+ position: "relative",
31541
31526
  background: "transparent",
31542
31527
  border: "none",
31543
31528
  borderRadius: 0,