@true-engineering/true-react-common-ui-kit 3.49.0 → 3.50.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.
@@ -9626,7 +9626,6 @@
9626
9626
  }, trueReactPlatformHelpers.addDataTestId(testId), addDataAttributes(data)));
9627
9627
  };
9628
9628
  var DEFAULT_SIZE = 6;
9629
- var PADDING_X$1 = 12;
9630
9629
  var AUTOSIZE_MAX_WIDTH = 480;
9631
9630
  var useStyles$H = createThemedStyles("Input", {
9632
9631
  root: {
@@ -9635,6 +9634,8 @@
9635
9634
  position: "relative"
9636
9635
  },
9637
9636
  inputWrapper: {
9637
+ "--input-padding-x": "12px",
9638
+ "--input-with-icons-padding-right": "4px",
9638
9639
  display: "flex",
9639
9640
  width: "100%",
9640
9641
  height: dimensions.CONTROL_HEIGHT,
@@ -9644,12 +9645,16 @@
9644
9645
  backgroundColor: "white",
9645
9646
  position: "relative"
9646
9647
  },
9648
+ inputWithLabelWrapper: {
9649
+ position: "relative",
9650
+ width: "100%"
9651
+ },
9647
9652
  inputContent: {
9648
9653
  fontSize: 16,
9649
9654
  fontFamily: "inherit",
9650
9655
  padding: [
9651
9656
  0,
9652
- PADDING_X$1
9657
+ "var(--input-padding-x)"
9653
9658
  ]
9654
9659
  },
9655
9660
  input: {
@@ -9722,8 +9727,10 @@
9722
9727
  activeLabel: {
9723
9728
  display: "none",
9724
9729
  "&$floating": {
9730
+ "--scale-factor": "0.75",
9725
9731
  display: "block",
9726
- transform: "scale(0.75) translateY(-120%)"
9732
+ transform: "scale(var(--scale-factor)) translateY(-120%)",
9733
+ maxWidth: "calc(var(--label-max-width) / var(--scale-factor))"
9727
9734
  }
9728
9735
  },
9729
9736
  required: {
@@ -9739,31 +9746,54 @@
9739
9746
  }
9740
9747
  },
9741
9748
  label: {
9749
+ "--label-max-width": "calc(100% - var(--input-padding-x))",
9742
9750
  position: "absolute",
9743
9751
  pointerEvents: "none",
9744
- left: PADDING_X$1,
9752
+ left: "var(--input-padding-x)",
9745
9753
  top: "50%",
9754
+ boxSizing: "border-box",
9755
+ maxWidth: "var(--label-max-width)",
9756
+ paddingRight: "var(--input-padding-x)",
9746
9757
  transformOrigin: "top left",
9747
9758
  transform: "translateY(-50%)",
9748
9759
  transition: animations.defaultTransition,
9749
- transitionProperty: "transform, color",
9760
+ transitionProperty: [
9761
+ "max-width",
9762
+ "transform",
9763
+ "color"
9764
+ ],
9750
9765
  fontSize: 16
9751
9766
  },
9752
9767
  floatingWithoutPadding: {
9753
9768
  left: 0
9754
9769
  },
9755
9770
  requiredLabel: {
9771
+ "--input-padding-right": "var(--input-padding-x)",
9772
+ "--required-label-size": "6px",
9773
+ "--required-label-right": "calc(var(--input-padding-right) - var(--required-label-size) - 2px)",
9774
+ "&:is($labelWithIcons)": {
9775
+ "--input-padding-right": "var(--input-with-icons-padding-right)"
9776
+ },
9756
9777
  "&:after": {
9757
9778
  content: '""',
9758
9779
  position: "absolute",
9759
- right: -8,
9780
+ right: "var(--required-label-right)",
9760
9781
  top: 4,
9761
9782
  transform: "translate(0, -50%)",
9762
- width: 6,
9763
- height: 6,
9783
+ width: "var(--required-label-size)",
9784
+ height: "var(--required-label-size)",
9764
9785
  borderRadius: "50%"
9765
9786
  }
9766
9787
  },
9788
+ labelWithIcons: {
9789
+ extend: "withIcons"
9790
+ },
9791
+ labelText: {
9792
+ display: "block",
9793
+ overflow: "hidden",
9794
+ textOverflow: "ellipsis",
9795
+ whiteSpace: "nowrap"
9796
+ },
9767
9797
  activeIcon: {
9768
9798
  cursor: "pointer"
9769
9799
  },
@@ -9871,7 +9901,7 @@
9871
9901
  extend: "icon"
9872
9902
  },
9873
9903
  withIcons: {
9874
- paddingRight: 4
9904
+ paddingRight: "var(--input-with-icons-padding-right)"
9875
9905
  },
9876
9906
  withControls: {},
9877
9907
  invalid: {},
@@ -10290,19 +10320,27 @@
10290
10320
  "data-value": isAutoSizeable ? value : void 0
10291
10321
  }, addDataAttributes(data)), {
10292
10322
  children: [
10293
- mask === void 0 ? /* @__PURE__ */ jsx("input", _object_spread$P({
10294
- ref: ref !== null && ref !== void 0 ? ref : inputRef
10295
- }, props)) : /* @__PURE__ */ jsx(InputMask, _object_spread$P({
10296
- ref: ref !== null && ref !== void 0 ? ref : inputRef,
10297
- mask,
10298
- maskPlaceholder,
10299
- alwaysShowMask,
10300
- beforeMaskedStateChange
10301
- }, props)),
10302
- hasLabel && /* @__PURE__ */ jsx("span", {
10303
- className: clsx(classes.label, (_obj22 = {}, _define_property$R(_obj22, classes.invalidLabel, isInvalid), _define_property$R(_obj22, classes.requiredLabel, hasRequiredLabel && !isRequired), _define_property$R(_obj22, classes.activeLabel, isLabelActive), _define_property$R(_obj22, classes.floating, hasFloatingLabel), // Обсуждаемо, сделал так, потому что не хочется создавать новую пропсу, на каждый чих в стилях
10304
- _define_property$R(_obj22, classes.floatingWithoutPadding, hasFloatingLabel && border === "bottom"), _obj22)),
10305
- children: label
10323
+ /* @__PURE__ */ jsxs("div", {
10324
+ className: classes.inputWithLabelWrapper,
10325
+ children: [
10326
+ mask === void 0 ? /* @__PURE__ */ jsx("input", _object_spread$P({
10327
+ ref: ref !== null && ref !== void 0 ? ref : inputRef
10328
+ }, props)) : /* @__PURE__ */ jsx(InputMask, _object_spread$P({
10329
+ ref: ref !== null && ref !== void 0 ? ref : inputRef,
10330
+ mask,
10331
+ maskPlaceholder,
10332
+ alwaysShowMask,
10333
+ beforeMaskedStateChange
10334
+ }, props)),
10335
+ hasLabel && /* @__PURE__ */ jsx("span", {
10336
+ className: clsx(classes.label, (_obj22 = {}, _define_property$R(_obj22, classes.invalidLabel, isInvalid), _define_property$R(_obj22, classes.requiredLabel, hasRequiredLabel && !isRequired), _define_property$R(_obj22, classes.activeLabel, isLabelActive), _define_property$R(_obj22, classes.floating, hasFloatingLabel), // Обсуждаемо, сделал так, потому что не хочется создавать новую пропсу, на каждый чих в стилях
10337
+ _define_property$R(_obj22, classes.floatingWithoutPadding, hasFloatingLabel && border === "bottom"), _define_property$R(_obj22, classes.labelWithIcons, hasControls), _obj22)),
10338
+ children: /* @__PURE__ */ jsx("span", {
10339
+ className: classes.labelText,
10340
+ children: label
10341
+ })
10342
+ })
10343
+ ]
10306
10344
  }),
10307
10345
  shouldShowUnits && /* @__PURE__ */ jsxs("div", {
10308
10346
  className: clsx(classes.unitsWrapper, _define_property$R({}, classes.withFloatingLabel, hasFloatingLabel && hasLabel)),
@@ -10507,7 +10545,6 @@
10507
10545
  }));
10508
10546
  });
10509
10547
  const reactDatepicker = "";
10510
- var LEFT_PADDING = 44;
10511
10548
  var useStyles$F = createThemedStyles("SearchInput", {
10512
10549
  root: {
10513
10550
  position: "relative"
@@ -10532,7 +10569,7 @@
10532
10569
  borderColor: "transparent",
10533
10570
  backgroundColor: rgba(colors.BORDER_MAIN, 0.3),
10534
10571
  borderRadius: 18,
10535
- paddingLeft: LEFT_PADDING,
10572
+ paddingLeft: 44,
10536
10573
  transitionProperty: "background-color, border-color"
10537
10574
  },
10538
10575
  focused: {
@@ -10544,7 +10581,7 @@
10544
10581
  paddingLeft: 0
10545
10582
  },
10546
10583
  label: {
10547
- left: LEFT_PADDING,
10584
+ left: 0,
10548
10585
  fontSize: 14
10549
10586
  }
10550
10587
  };
@@ -11249,6 +11286,7 @@
11249
11286
  boxSizing: "border-box"
11250
11287
  },
11251
11288
  inputWrapper: {
11289
+ "--select-arrow-size": "20px",
11252
11290
  width: "100%",
11253
11291
  cursor: "text",
11254
11292
  position: "relative"
@@ -11272,8 +11310,8 @@
11272
11310
  position: "absolute",
11273
11311
  right: 12,
11274
11312
  top: 14,
11275
- width: 20,
11276
- height: 20,
11313
+ width: "var(--select-arrow-size)",
11314
+ height: "var(--select-arrow-size)",
11277
11315
  cursor: "pointer",
11278
11316
  zIndex: 1,
11279
11317
  transition: animations.defaultTransition,
@@ -11308,6 +11346,17 @@
11308
11346
  },
11309
11347
  controls: {
11310
11348
  paddingRight: 32
11349
+ },
11350
+ label: {
11351
+ "--select-label-max-width": "calc(100% - var(--input-padding-x) - var(--select-arrow-size))",
11352
+ "&:not($labelWithIcons)": {
11353
+ "--label-max-width": "var(--select-label-max-width)"
11354
+ }
11355
+ },
11356
+ requiredLabel: {
11357
+ "&:not($labelWithIcons)": {
11358
+ "--label-max-width": "calc(var(--select-label-max-width) - var(--required-label-size))"
11359
+ }
11311
11360
  }
11312
11361
  };
11313
11362
  var readonlyInputBaseStyles = {
@@ -11636,7 +11685,7 @@
11636
11685
  }
11637
11686
  }
11638
11687
  function Select(props) {
11639
- var _input_current;
11688
+ var _input_current_parentElement, _input_current;
11640
11689
  var options = props.options, isMultiSelect = props.isMultiSelect, value = props.value, header = props.header, footer = props.footer, defaultOptionLabel = props.defaultOptionLabel, allOptionsLabel = props.allOptionsLabel, _props_debounceTime = props.debounceTime, debounceTime = _props_debounceTime === void 0 ? 400 : _props_debounceTime, _props_optionsMode = props.optionsMode, optionsMode = _props_optionsMode === void 0 ? "normal" : _props_optionsMode, noMatchesLabel = props.noMatchesLabel, loadingLabel = props.loadingLabel, tweakStyles = props.tweakStyles, testId = props.testId, isActive = props.isActive, isReadonly = props.isReadonly, isDisabled = props.isDisabled, dropdownOptions = props.dropdownOptions, _props_minSymbolsCountToOpenList = props.minSymbolsCountToOpenList, minSymbolsCountToOpenList = _props_minSymbolsCountToOpenList === void 0 ? 0 : _props_minSymbolsCountToOpenList, _props_dropdownIcon = props.dropdownIcon, dropdownIcon = _props_dropdownIcon === void 0 ? "chevron-down" : _props_dropdownIcon, _props_shouldScrollToList = props.shouldScrollToList, shouldScrollToList = _props_shouldScrollToList === void 0 ? true : _props_shouldScrollToList, searchInput = props.searchInput, iconType = props.iconType, onChange = props.onChange, onFocus = props.onFocus, onBlur = props.onBlur, onType = props.onType, onOpen = props.onOpen, _props_isOptionDisabled = props.isOptionDisabled, isOptionDisabled = _props_isOptionDisabled === void 0 ? defaultIsOptionDisabled : _props_isOptionDisabled, _props_compareValuesOnChange = props.compareValuesOnChange, compareValuesOnChange = _props_compareValuesOnChange === void 0 ? defaultCompareFunction : _props_compareValuesOnChange, _props_convertValueToString = props.convertValueToString, convertValueToString = _props_convertValueToString === void 0 ? defaultConvertFunction$2 : _props_convertValueToString, convertValueToId = props.convertValueToId, convertValueToReactNode = props.convertValueToReactNode, optionsFilter = props.optionsFilter, inputProps = _object_without_properties$c(props, [
11641
11690
  "options",
11642
11691
  "isMultiSelect",
@@ -11771,12 +11820,12 @@
11771
11820
  convertValueToString
11772
11821
  ]);
11773
11822
  var getDropdownOffset = function() {
11774
- var _input_current_parentElement2;
11775
- if (trueReactPlatformHelpers.isEmpty(input.current) || inputProps.errorPosition === "top") {
11823
+ var _inputWrapper_current;
11824
+ if (inputProps.errorPosition === "top") {
11776
11825
  return 0;
11777
11826
  }
11778
- var _input_current_parentElement_offsetHeight;
11779
- return (_input_current_parentElement_offsetHeight = (_input_current_parentElement2 = input.current.parentElement) === null || _input_current_parentElement2 === void 0 ? void 0 : _input_current_parentElement2.offsetHeight) !== null && _input_current_parentElement_offsetHeight !== void 0 ? _input_current_parentElement_offsetHeight : 0;
11827
+ var _inputWrapper_current_offsetHeight;
11828
+ return (_inputWrapper_current_offsetHeight = (_inputWrapper_current = inputWrapper.current) === null || _inputWrapper_current === void 0 ? void 0 : _inputWrapper_current.offsetHeight) !== null && _inputWrapper_current_offsetHeight !== void 0 ? _inputWrapper_current_offsetHeight : 0;
11780
11829
  };
11781
11830
  var closeList = React.useCallback(function() {
11782
11831
  setIsListOpen(false);
@@ -12013,11 +12062,11 @@
12013
12062
  (optionsMode === "normal" || hasEnoughSymbolsToSearch)
12014
12063
  );
12015
12064
  var _ref1 = dropdownOptions !== null && dropdownOptions !== void 0 ? dropdownOptions : {}, _ref_shouldUsePopper = _ref1.shouldUsePopper, shouldUsePopper = _ref_shouldUsePopper === void 0 ? false : _ref_shouldUsePopper, _ref_shouldRenderInBody = _ref1.shouldRenderInBody, shouldRenderInBody = _ref_shouldRenderInBody === void 0 ? false : _ref_shouldRenderInBody, _ref_shouldHideOnScroll = _ref1.shouldHideOnScroll, shouldHideOnScroll = _ref_shouldHideOnScroll === void 0 ? false : _ref_shouldHideOnScroll;
12016
- var _input_current_parentElement;
12065
+ var _input_current_parentElement_parentElement;
12017
12066
  var popperData = useDropdown({
12018
12067
  isOpen,
12019
12068
  onDropdownClose: handleListClose,
12020
- referenceElement: (_input_current_parentElement = (_input_current = input.current) === null || _input_current === void 0 ? void 0 : _input_current.parentElement) !== null && _input_current_parentElement !== void 0 ? _input_current_parentElement : inputWrapper.current,
12069
+ referenceElement: (_input_current_parentElement_parentElement = (_input_current = input.current) === null || _input_current === void 0 ? void 0 : (_input_current_parentElement = _input_current.parentElement) === null || _input_current_parentElement === void 0 ? void 0 : _input_current_parentElement.parentElement) !== null && _input_current_parentElement_parentElement !== void 0 ? _input_current_parentElement_parentElement : inputWrapper.current,
12021
12070
  dropdownElement: list.current,
12022
12071
  options: dropdownOptions,
12023
12072
  dependenciesForPositionUpdating: [
@@ -30173,7 +30222,6 @@
30173
30222
  }
30174
30223
  return target;
30175
30224
  }
30176
- var PADDING_X = 12;
30177
30225
  var useStyles$4 = createThemedStyles("TextArea", {
30178
30226
  root: {
30179
30227
  width: "100%",
@@ -30182,6 +30230,7 @@
30182
30230
  flexDirection: "column"
30183
30231
  },
30184
30232
  wrapper: {
30233
+ "--textarea-padding-x": "12px",
30185
30234
  display: "flex",
30186
30235
  position: "relative",
30187
30236
  width: "100%",
@@ -30205,7 +30254,7 @@
30205
30254
  fontSize: 16,
30206
30255
  padding: [
30207
30256
  14,
30208
- PADDING_X,
30257
+ "var(--textarea-padding-x)",
30209
30258
  8
30210
30259
  ],
30211
30260
  scrollPadding: "14px 0 8px",
@@ -30254,8 +30303,10 @@
30254
30303
  activeLabel: {
30255
30304
  display: "none",
30256
30305
  "&$floating": {
30306
+ "--scale-factor": "0.75",
30257
30307
  display: "block",
30258
- transform: "scale(0.75) translateY(-120%)"
30308
+ transform: "scale(var(--scale-factor)) translateY(-120%)",
30309
+ maxWidth: "calc(var(--label-max-width) / var(--scale-factor))"
30259
30310
  }
30260
30311
  },
30261
30312
  required: {
@@ -30272,14 +30323,20 @@
30272
30323
  },
30273
30324
  disabled: {},
30274
30325
  label: {
30326
+ "--label-max-width": "calc(100% - 2 * var(--textarea-padding-x))",
30275
30327
  position: "absolute",
30276
30328
  pointerEvents: "none",
30277
- left: PADDING_X,
30278
- top: PADDING_X * 2,
30329
+ left: "var(--textarea-padding-x)",
30330
+ top: 24,
30331
+ maxWidth: "var(--label-max-width)",
30279
30332
  transformOrigin: "top left",
30280
30333
  transform: "translateY(-50%)",
30281
30334
  transition: animations.defaultTransition,
30282
- transitionProperty: "transform, color",
30335
+ transitionProperty: [
30336
+ "max-width",
30337
+ "transform",
30338
+ "color"
30339
+ ],
30283
30340
  fontSize: 16
30284
30341
  },
30285
30342
  invalid: {
@@ -30293,18 +30350,27 @@
30293
30350
  color: "red"
30294
30351
  },
30295
30352
  requiredLabel: {
30353
+ "--required-label-size": "6px",
30354
+ "--required-label-right": "8px",
30355
+ maxWidth: "calc(100% - 2 * var(--textarea-padding-x) - var(--required-label-right))",
30296
30356
  "&:after": {
30297
30357
  content: '""',
30298
30358
  position: "absolute",
30299
- right: -8,
30359
+ right: "calc(-1 * var(--required-label-right))",
30300
30360
  top: 4,
30301
30361
  transform: "translate(0, -50%)",
30302
- width: 6,
30303
- height: 6,
30362
+ width: "var(--required-label-size)",
30363
+ height: "var(--required-label-size)",
30304
30364
  borderRadius: "50%",
30305
30365
  backgroundColor: "red"
30306
30366
  }
30307
30367
  },
30368
+ labelText: {
30369
+ display: "block",
30370
+ overflow: "hidden",
30371
+ textOverflow: "ellipsis",
30372
+ whiteSpace: "nowrap"
30373
+ },
30308
30374
  symbolsCount: {
30309
30375
  display: "block",
30310
30376
  textAlign: "right",
@@ -30490,7 +30556,10 @@
30490
30556
  children: [
30491
30557
  hasLabel && /* @__PURE__ */ jsx("span", {
30492
30558
  className: clsx(classes.label, (_obj1 = {}, _define_property$5(_obj1, classes.invalidLabel, isInvalid), _define_property$5(_obj1, classes.requiredLabel, hasRequiredLabel && !isRequired), _define_property$5(_obj1, classes.activeLabel, hasFocus || hasValue), _define_property$5(_obj1, classes.floating, hasFloatingLabel), _obj1)),
30493
- children: label
30559
+ children: /* @__PURE__ */ jsx("span", {
30560
+ className: classes.labelText,
30561
+ children: label
30562
+ })
30494
30563
  }),
30495
30564
  /* @__PURE__ */ jsx("textarea", _object_spread$5({
30496
30565
  ref