@true-engineering/true-react-common-ui-kit 4.0.0-alpha26 → 4.0.0-alpha28

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.
@@ -11461,7 +11461,7 @@
11461
11461
  return target;
11462
11462
  }
11463
11463
  var SelectListItem = function(param) {
11464
- var classes = param.classes, index = param.index, isSemiChecked = param.isSemiChecked, isDisabled = param.isDisabled, isActive = param.isActive, children = param.children, isFocused = param.isFocused, isMultiSelect = param.isMultiSelect, onOptionSelect = param.onOptionSelect, onToggleCheckbox = param.onToggleCheckbox;
11464
+ var classes = param.classes, index = param.index, isSemiChecked = param.isSemiChecked, isDisabled = param.isDisabled, isActive = param.isActive, children = param.children, isFocused = param.isFocused, isMultiSelect = param.isMultiSelect, data = param.data, onOptionSelect = param.onOptionSelect, onToggleCheckbox = param.onToggleCheckbox;
11465
11465
  var multiSelectContent = isMultiSelect && /* @__PURE__ */ jsx(Checkbox, {
11466
11466
  isChecked: isActive || isSemiChecked,
11467
11467
  isSemiChecked,
@@ -11480,11 +11480,11 @@
11480
11480
  block: "nearest"
11481
11481
  },
11482
11482
  className: clsx(classes.cell, (_obj2 = {}, _define_property$N(_obj2, classes.cellWithCheckbox, isMultiSelect), _define_property$N(_obj2, classes.focused, isFocused), _define_property$N(_obj2, classes.active, isActive && !isMultiSelect), _define_property$N(_obj2, classes.disabled, isDisabled), _obj2))
11483
- }, addDataAttributes({
11483
+ }, trueReactPlatformHelpers.addDataAttributes(_object_spread$L({
11484
11484
  disabled: isDisabled,
11485
11485
  active: isActive,
11486
11486
  focused: isFocused
11487
- })), {
11487
+ }, data))), {
11488
11488
  onClick: !isDisabled && !isMultiSelect ? function(event) {
11489
11489
  return onOptionSelect(index, event);
11490
11490
  } : void 0,
@@ -11613,8 +11613,9 @@
11613
11613
  }),
11614
11614
  listOptions.map(function(opt, i) {
11615
11615
  var optionValue = options[i];
11616
+ var id = convertValueToId(optionValue);
11616
11617
  var isFocused = focusedIndex === i;
11617
- var isActive = activeOptionsIds.has(convertValueToId(optionValue));
11618
+ var isActive = activeOptionsIds.has(id);
11618
11619
  var isDisabled = optionsDisableMap[i];
11619
11620
  return /* @__PURE__ */ jsx(SelectListItem, {
11620
11621
  classes,
@@ -11625,6 +11626,9 @@
11625
11626
  isMultiSelect,
11626
11627
  onOptionSelect,
11627
11628
  onToggleCheckbox,
11629
+ data: {
11630
+ id
11631
+ },
11628
11632
  children: opt
11629
11633
  }, i);
11630
11634
  }),
@@ -19064,7 +19068,7 @@
19064
19068
  }, []);
19065
19069
  return /* @__PURE__ */ jsxs("div", _object_spread_props$t(_object_spread$u({
19066
19070
  className: classes.root
19067
- }, addDataAttributes(data)), {
19071
+ }, trueReactPlatformHelpers.addDataAttributes(data, testId)), {
19068
19072
  children: [
19069
19073
  isSearchEnabled && /* @__PURE__ */ jsx("div", {
19070
19074
  className: classes.dropdownInput,
@@ -19073,20 +19077,20 @@
19073
19077
  placeholder: translates.searchPlaceholder,
19074
19078
  onChange: handleOnChange,
19075
19079
  tweakStyles: tweakSearchInputStyles,
19076
- testId: testId !== void 0 ? "".concat(testId, "-search") : void 0,
19080
+ testId: trueReactPlatformHelpers.getTestId(testId, "search"),
19077
19081
  shouldFocusOnMount: true
19078
19082
  })
19079
19083
  }),
19080
19084
  !isLoading && /* @__PURE__ */ jsxs(Fragment, {
19081
19085
  children: [
19082
- allOptions.length !== 0 && /* @__PURE__ */ jsxs("div", {
19083
- className: clsx(classes.list, hasClearButton && classes.withClearButton),
19084
- "data-testid": testId !== void 0 ? "".concat(testId, "-list") : void 0,
19086
+ trueReactPlatformHelpers.isArrayNotEmpty(allOptions) && /* @__PURE__ */ jsxs("div", _object_spread_props$t(_object_spread$u({
19087
+ className: clsx(classes.list, _define_property$v({}, classes.withClearButton, hasClearButton))
19088
+ }, trueReactPlatformHelpers.addDataTestId(testId, "list")), {
19085
19089
  children: [
19086
- isGroupingEnabled && value !== void 0 && /* @__PURE__ */ jsxs(Fragment, {
19090
+ isGroupingEnabled && trueReactPlatformHelpers.isNotEmpty(value) && /* @__PURE__ */ jsxs(Fragment, {
19087
19091
  children: [
19088
19092
  /* @__PURE__ */ jsx("div", {
19089
- className: clsx(classes.label, classes.labelChosen, !isSearchEnabled && classes.withoutTopGap),
19093
+ className: clsx(classes.label, classes.labelChosen, _define_property$v({}, classes.withoutTopGap, !isSearchEnabled)),
19090
19094
  children: translates.chosen
19091
19095
  }),
19092
19096
  /* @__PURE__ */ jsxs("div", {
@@ -19114,7 +19118,7 @@
19114
19118
  ]
19115
19119
  }),
19116
19120
  allOptions.map(function(item, index) {
19117
- var isActive = value !== void 0 && getValueId(value) === getValueId(item);
19121
+ var isActive = trueReactPlatformHelpers.isNotEmpty(value) && getValueId(value) === getValueId(item);
19118
19122
  if (isGroupingEnabled && isActive) {
19119
19123
  return null;
19120
19124
  }
@@ -19127,11 +19131,14 @@
19127
19131
  return handleChange(item);
19128
19132
  },
19129
19133
  children: [
19130
- /* @__PURE__ */ jsx("div", {
19131
- className: classes.option,
19132
- "data-option": id,
19134
+ /* @__PURE__ */ jsx("div", _object_spread_props$t(_object_spread$u({
19135
+ className: classes.option
19136
+ }, trueReactPlatformHelpers.addDataAttributes({
19137
+ id,
19138
+ option: id
19139
+ })), {
19133
19140
  children: view
19134
- }),
19141
+ })),
19135
19142
  isActive && /* @__PURE__ */ jsx("div", {
19136
19143
  className: classes.icon,
19137
19144
  children: /* @__PURE__ */ jsx(Icon, {
@@ -19150,14 +19157,14 @@
19150
19157
  }
19151
19158
  })
19152
19159
  ]
19153
- }),
19160
+ })),
19154
19161
  shouldShowPreloader && /* @__PURE__ */ jsx("div", {
19155
19162
  className: classes.preloader,
19156
19163
  children: /* @__PURE__ */ jsx(ThemedPreloader, {
19157
19164
  type: "dots"
19158
19165
  })
19159
19166
  }),
19160
- allOptions.length === 0 && /* @__PURE__ */ jsx("div", {
19167
+ !trueReactPlatformHelpers.isArrayNotEmpty(allOptions) && /* @__PURE__ */ jsx("div", {
19161
19168
  className: classes.nothingFound,
19162
19169
  children: translates.nothingFound
19163
19170
  }),
@@ -19174,7 +19181,7 @@
19174
19181
  onClick: handleClear,
19175
19182
  size: "s",
19176
19183
  view: "text",
19177
- testId: testId !== void 0 ? "".concat(testId, "-clear-button") : void 0,
19184
+ testId: trueReactPlatformHelpers.getTestId(testId, "clear-button"),
19178
19185
  tweakStyles: tweakClearButtonStyles,
19179
19186
  children: translates.clear
19180
19187
  })
@@ -19782,7 +19789,7 @@
19782
19789
  locale: translates,
19783
19790
  tweakStyles: tweakSelectStyles,
19784
19791
  getValueView: getPeriodTranslate,
19785
- testId: testId !== void 0 ? "".concat(testId, "-select") : void 0
19792
+ testId: trueReactPlatformHelpers.getTestId(testId, "select")
19786
19793
  })
19787
19794
  }),
19788
19795
  isDatePickerShown && /* @__PURE__ */ jsx("div", {
@@ -19804,7 +19811,7 @@
19804
19811
  onChange: handleCustomDateChange,
19805
19812
  localeKey,
19806
19813
  locale: translates,
19807
- testId: testId !== void 0 ? "".concat(testId, "-dates") : void 0
19814
+ testId: trueReactPlatformHelpers.getTestId(testId, "dates")
19808
19815
  })
19809
19816
  })
19810
19817
  ]
@@ -19899,7 +19906,7 @@
19899
19906
  onClose,
19900
19907
  localeKey: translatesLocaleKey,
19901
19908
  locale: translates,
19902
- testId: testId !== void 0 ? "".concat(testId, "-select") : void 0
19909
+ testId: trueReactPlatformHelpers.getTestId(testId, "select")
19903
19910
  }, filter));
19904
19911
  }
19905
19912
  if (filter.type === "dateRange") {
@@ -19910,7 +19917,7 @@
19910
19917
  onClose,
19911
19918
  localeKey: translatesLocaleKey,
19912
19919
  locale: translates,
19913
- testId: testId !== void 0 ? "".concat(testId, "-period") : void 0
19920
+ testId: trueReactPlatformHelpers.getTestId(testId, "period")
19914
19921
  }, filter));
19915
19922
  }
19916
19923
  if (filter.type === "dateRangeWithoutPeriod") {
@@ -19927,7 +19934,7 @@
19927
19934
  },
19928
19935
  localeKey: translatesLocaleKey,
19929
19936
  locale: translates,
19930
- testId: testId !== void 0 ? "".concat(testId, "-dates") : void 0
19937
+ testId: trueReactPlatformHelpers.getTestId(testId, "dates")
19931
19938
  }, filter));
19932
19939
  }
19933
19940
  if (filter.type === "multiSelect") {
@@ -19938,7 +19945,7 @@
19938
19945
  onClose,
19939
19946
  localeKey: translatesLocaleKey,
19940
19947
  locale: translates,
19941
- testId: testId !== void 0 ? "".concat(testId, "-multiSelect") : void 0
19948
+ testId: trueReactPlatformHelpers.getTestId(testId, "multiSelect")
19942
19949
  }, filter));
19943
19950
  }
19944
19951
  if (filter.type === "interval") {
@@ -19949,19 +19956,19 @@
19949
19956
  localeKey: translatesLocaleKey,
19950
19957
  locale: translates,
19951
19958
  labelName: filter.name,
19952
- testId: testId !== void 0 ? "".concat(testId, "-interval") : void 0
19959
+ testId: trueReactPlatformHelpers.getTestId(testId, "interval")
19953
19960
  }, filter));
19954
19961
  }
19955
- if (filter.type === "boolean") {
19956
- return null;
19957
- }
19958
19962
  if (filter.type === "custom" && filter.component) {
19959
19963
  var Component = filter.component;
19960
19964
  return /* @__PURE__ */ jsx(Component, _object_spread_props$q(_object_spread$r({}, props), {
19961
- filter
19965
+ filter,
19966
+ testId: trueReactPlatformHelpers.getTestId(testId, "dropdown")
19962
19967
  }));
19963
19968
  }
19964
- console.warn("%cДля фильтра ".concat(filter.name, " не задан тип или component"), "background: red; color: black");
19969
+ if (filter.type !== "boolean") {
19970
+ console.warn("%cДля фильтра ".concat(filter.name, " не задан тип или component"), "background: red; color: black");
19971
+ }
19965
19972
  return null;
19966
19973
  }
19967
19974
  var useStyles$o = createThemedStyles("FiltersPaneSearch", {
@@ -20215,17 +20222,11 @@
20215
20222
  });
20216
20223
  setIsOpen(false);
20217
20224
  };
20218
- var selectedFieldLabel = React.useMemo(function() {
20219
- return field !== void 0 && getValueView !== void 0 ? getValueView(field) : void 0;
20220
- }, [
20221
- field
20222
- ]);
20223
20225
  var _obj2;
20224
20226
  return /* @__PURE__ */ jsxs("div", _object_spread_props$p(_object_spread$q({
20225
20227
  className: clsx(classes.root, (_obj2 = {}, _define_property$r(_obj2, classes.focused, isInputFocused), _define_property$r(_obj2, classes.disabled, isDisabled), _obj2)),
20226
- ref: refRoot,
20227
- "data-testid": testId
20228
- }, addDataAttributes(data)), {
20228
+ ref: refRoot
20229
+ }, trueReactPlatformHelpers.addDataAttributes(data, testId)), {
20229
20230
  children: [
20230
20231
  /* @__PURE__ */ jsx(SearchInput, {
20231
20232
  value,
@@ -20238,23 +20239,23 @@
20238
20239
  onBlur: function() {
20239
20240
  return setIsInputFocused(false);
20240
20241
  },
20241
- testId: testId !== void 0 ? "".concat(testId, "-input") : void 0,
20242
+ testId: trueReactPlatformHelpers.getTestId(testId, "input"),
20242
20243
  maxLength,
20243
20244
  isDisabled
20244
20245
  }),
20245
20246
  /* @__PURE__ */ jsxs("div", {
20246
20247
  className: classes.selectWrapper,
20247
20248
  children: [
20248
- fields.length > 0 && /* @__PURE__ */ jsxs("div", {
20249
+ fields.length > 0 && /* @__PURE__ */ jsxs("div", _object_spread_props$p(_object_spread$q({
20249
20250
  className: classes.selectBlock,
20250
20251
  onClick: !isDisabled ? function() {
20251
20252
  return setIsOpen(!isOpen);
20252
- } : void 0,
20253
- "data-testid": testId !== void 0 ? "".concat(testId, "-select") : void 0,
20253
+ } : void 0
20254
+ }, trueReactPlatformHelpers.addDataTestId(testId, "select")), {
20254
20255
  children: [
20255
20256
  /* @__PURE__ */ jsx("div", {
20256
- className: clsx(classes.selectLabel, selectedFieldLabel !== void 0 && classes.active),
20257
- children: selectedFieldLabel !== null && selectedFieldLabel !== void 0 ? selectedFieldLabel : translates.displayedFields
20257
+ className: clsx(classes.selectLabel, _define_property$r({}, classes.active, trueReactPlatformHelpers.isNotEmpty(field))),
20258
+ children: trueReactPlatformHelpers.isNotEmpty(field) ? getValueView === null || getValueView === void 0 ? void 0 : getValueView(field) : translates.displayedFields
20258
20259
  }),
20259
20260
  /* @__PURE__ */ jsx("div", {
20260
20261
  className: clsx(classes.chevronIcon, isOpen && classes.open),
@@ -20263,7 +20264,7 @@
20263
20264
  })
20264
20265
  })
20265
20266
  ]
20266
- }),
20267
+ })),
20267
20268
  isOpen && /* @__PURE__ */ jsx("div", {
20268
20269
  className: classes.dropdown,
20269
20270
  children: /* @__PURE__ */ jsx(FilterSelect, {
@@ -20278,7 +20279,7 @@
20278
20279
  onChange: handleFieldsChange,
20279
20280
  isSearchEnabled: isSelectSearchEnabled,
20280
20281
  hasClearButton: hasClearSelectButton,
20281
- testId: testId !== void 0 ? "".concat(testId, "-dropdown") : void 0
20282
+ testId: trueReactPlatformHelpers.getTestId(testId, "dropdown")
20282
20283
  })
20283
20284
  })
20284
20285
  ]
@@ -20663,7 +20664,7 @@
20663
20664
  var _obj2;
20664
20665
  return /* @__PURE__ */ jsx("div", _object_spread_props$o(_object_spread$p({
20665
20666
  className: clsx(classes.root, (_obj2 = {}, _define_property$q(_obj2, classes.noValue, !hasValue), _define_property$q(_obj2, classes.openNoValue, isActive && !hasValue), _define_property$q(_obj2, classes.withValue, !isActive && hasValue), _define_property$q(_obj2, classes.openWithValue, isActive && hasValue), _define_property$q(_obj2, classes.boolean, isBoolean), _define_property$q(_obj2, classes.disabled, isDisabled), _obj2))
20666
- }, trueReactPlatformHelpers.addDataTestId(testId), addDataAttributes(data), referenceProps), {
20667
+ }, trueReactPlatformHelpers.addDataAttributes(data, testId), referenceProps), {
20667
20668
  children: /* @__PURE__ */ jsxs("div", {
20668
20669
  onClick: handleLabelClick,
20669
20670
  className: clsx(classes.item, _define_property$q({}, classes.booleanItem, isBoolean)),
@@ -20672,7 +20673,7 @@
20672
20673
  className: classes.name,
20673
20674
  children: filter.name
20674
20675
  }),
20675
- !isBoolean && value !== void 0 && value !== null && /* @__PURE__ */ jsx("div", {
20676
+ !isBoolean && trueReactPlatformHelpers.isNotEmpty(value) && /* @__PURE__ */ jsx("div", {
20676
20677
  className: classes.value,
20677
20678
  children: /* @__PURE__ */ jsx(FilterValueView, {
20678
20679
  value,
@@ -20790,7 +20791,7 @@
20790
20791
  ]);
20791
20792
  var filtersKeys = enabledFilters !== null && enabledFilters !== void 0 ? enabledFilters : Object.keys(filtersConfig);
20792
20793
  var handleClear = function() {
20793
- if (onClear !== void 0) {
20794
+ if (trueReactPlatformHelpers.isNotEmpty(onClear)) {
20794
20795
  onClear();
20795
20796
  return;
20796
20797
  }
@@ -20799,9 +20800,9 @@
20799
20800
  search.onChange({});
20800
20801
  }
20801
20802
  };
20802
- var shouldShowClearButton = hasClearButton && (search !== void 0 || filtersKeys.filter(function(key) {
20803
- return filtersConfig[key] !== void 0;
20804
- }).length > 0);
20803
+ var shouldShowClearButton = hasClearButton && (trueReactPlatformHelpers.isNotEmpty(search) || filtersKeys.some(function(key) {
20804
+ return trueReactPlatformHelpers.isNotEmpty(filtersConfig[key]);
20805
+ }));
20805
20806
  var clearButton = /* @__PURE__ */ jsx("div", {
20806
20807
  className: classes.clear,
20807
20808
  children: /* @__PURE__ */ jsx(Button, {
@@ -20817,7 +20818,7 @@
20817
20818
  var _search_localeKey, _search_localeKey1, _search_isDisabled;
20818
20819
  return /* @__PURE__ */ jsxs("div", _object_spread_props$n(_object_spread$o({
20819
20820
  className: classes.root
20820
- }, trueReactPlatformHelpers.addDataTestId(testId), addDataAttributes(data)), {
20821
+ }, trueReactPlatformHelpers.addDataAttributes(data, testId)), {
20821
20822
  children: [
20822
20823
  onSettingsButtonClick !== void 0 && /* @__PURE__ */ jsx("div", _object_spread_props$n(_object_spread$o({
20823
20824
  className: classes.settings,