@true-engineering/true-react-common-ui-kit 4.0.0-alpha29 → 4.0.0-alpha30
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.
- package/dist/components/ControlWrapper/ControlWrapper.d.ts +3 -3
- package/dist/components/ControlWrapper/helpers.d.ts +4 -0
- package/dist/components/ControlWrapper/index.d.ts +1 -0
- package/dist/components/ControlWrapper/types.d.ts +9 -0
- package/dist/components/Input/InputBase.d.ts +1 -1
- package/dist/components/Select/Select.styles.d.ts +1 -1
- package/dist/true-react-common-ui-kit.js +76 -101
- package/dist/true-react-common-ui-kit.js.map +1 -1
- package/dist/true-react-common-ui-kit.umd.cjs +74 -99
- package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
- package/package.json +1 -1
- package/src/components/ControlWrapper/ControlWrapper.stories.tsx +7 -2
- package/src/components/ControlWrapper/ControlWrapper.tsx +24 -19
- package/src/components/ControlWrapper/helpers.ts +11 -0
- package/src/components/ControlWrapper/index.ts +1 -0
- package/src/components/ControlWrapper/types.ts +12 -0
- package/src/components/DateInput/DateInput.stories.tsx +0 -1
- package/src/components/DatePicker/DatePicker.stories.tsx +1 -10
- package/src/components/Input/Input.stories.tsx +1 -6
- package/src/components/Input/InputBase.tsx +0 -3
- package/src/components/Select/CustomSelect.stories.tsx +1 -0
- package/src/components/Select/MultiSelect.stories.tsx +5 -0
- package/src/components/Select/Select.stories.tsx +6 -0
- package/src/components/Select/Select.styles.ts +5 -40
- package/src/components/Select/Select.tsx +24 -20
- package/src/components/TextArea/TextArea.stories.tsx +1 -0
|
@@ -9959,15 +9959,23 @@
|
|
|
9959
9959
|
]
|
|
9960
9960
|
}));
|
|
9961
9961
|
});
|
|
9962
|
-
var
|
|
9962
|
+
var isControlWrapperIcon = function(iconItem) {
|
|
9963
|
+
return lodashEs.isObject(iconItem) && "iconComponent" in iconItem;
|
|
9964
|
+
};
|
|
9965
|
+
var convertToControlWrapperIcon = function(iconItem) {
|
|
9966
|
+
return isControlWrapperIcon(iconItem) ? iconItem : {
|
|
9967
|
+
iconComponent: iconItem
|
|
9968
|
+
};
|
|
9969
|
+
};
|
|
9970
|
+
var CONTROL = dimensions.CONTROL, Z_INDEX$1 = dimensions.Z_INDEX;
|
|
9963
9971
|
var useStyles$H = createThemedStyles("ControlWrapper", {
|
|
9964
9972
|
controlWrapper: {
|
|
9965
|
-
"--control-height": "".concat(CONTROL
|
|
9973
|
+
"--control-height": "".concat(CONTROL.HEIGHT - 2, "px"),
|
|
9966
9974
|
// borders
|
|
9967
|
-
"--control-padding": "".concat(CONTROL
|
|
9968
|
-
"--icon-size": "".concat(CONTROL
|
|
9969
|
-
"--icon-inner-size": "".concat(CONTROL
|
|
9970
|
-
"--icon-gap": "".concat(CONTROL
|
|
9975
|
+
"--control-padding": "".concat(CONTROL.PADDING, "px"),
|
|
9976
|
+
"--icon-size": "".concat(CONTROL.ICON_SIZE, "px"),
|
|
9977
|
+
"--icon-inner-size": "".concat(CONTROL.ICON_INNER_SIZE, "px"),
|
|
9978
|
+
"--icon-gap": "".concat(CONTROL.ICON_GAP, "px"),
|
|
9971
9979
|
display: "flex",
|
|
9972
9980
|
width: "100%",
|
|
9973
9981
|
backgroundColor: "white",
|
|
@@ -10164,20 +10172,21 @@
|
|
|
10164
10172
|
return target;
|
|
10165
10173
|
}
|
|
10166
10174
|
var ControlWrapper = function(param) {
|
|
10167
|
-
var label = param.label, icon = param.icon, groupPlacement = param.groupPlacement, isInvalid = param.isInvalid, isFocused = param.isFocused, isRequired = param.isRequired, isLoading = param.isLoading, isFullWidth = param.isFullWidth, isDisabled = param.isDisabled, hasValue = param.hasValue, size = param.size, testId = param.testId, children = param.children, tweakStyles = param.tweakStyles, data = param.data,
|
|
10175
|
+
var label = param.label, icon = param.icon, groupPlacement = param.groupPlacement, isInvalid = param.isInvalid, isFocused = param.isFocused, isRequired = param.isRequired, isLoading = param.isLoading, isFullWidth = param.isFullWidth, isDisabled = param.isDisabled, hasValue = param.hasValue, size = param.size, testId = param.testId, children = param.children, tweakStyles = param.tweakStyles, data = param.data, onClear = param.onClear;
|
|
10168
10176
|
var classes = useStyles$H({
|
|
10169
10177
|
theme: tweakStyles
|
|
10170
10178
|
});
|
|
10171
|
-
var
|
|
10179
|
+
var icons = trueReactPlatformHelpers.getArray(icon).map(convertToControlWrapperIcon);
|
|
10180
|
+
var hasIcons = !isLoading && trueReactPlatformHelpers.isArrayNotEmpty(icons);
|
|
10172
10181
|
var hasClearButton = !isDisabled && !isLoading && hasValue && trueReactPlatformHelpers.isNotEmpty(onClear);
|
|
10173
|
-
var hasControls =
|
|
10182
|
+
var hasControls = hasIcons || hasClearButton || isLoading;
|
|
10174
10183
|
var isActive = isFocused || hasValue;
|
|
10175
10184
|
var tweakPreloaderStyles = useTweakStyles({
|
|
10176
10185
|
tweakStyles,
|
|
10177
10186
|
className: "tweakPreloader",
|
|
10178
10187
|
currentComponentName: "ControlWrapper"
|
|
10179
10188
|
});
|
|
10180
|
-
var _obj2, _obj1
|
|
10189
|
+
var _obj2, _obj1;
|
|
10181
10190
|
return /* @__PURE__ */ jsxs("div", _object_spread_props$I(_object_spread$S({
|
|
10182
10191
|
className: clsx(classes.controlWrapper, trueReactPlatformHelpers.isNotEmpty(groupPlacement) && classes["placement-".concat(groupPlacement)], trueReactPlatformHelpers.isNotEmpty(size) && classes[size], (_obj2 = {}, _define_property$U(_obj2, classes.invalid, isInvalid), _define_property$U(_obj2, classes.focused, isFocused), _define_property$U(_obj2, classes.withValue, hasValue), _define_property$U(_obj2, classes.disabled, isDisabled), _define_property$U(_obj2, classes.loading, isLoading), _define_property$U(_obj2, classes.minContent, !isFullWidth), _obj2))
|
|
10183
10192
|
}, trueReactPlatformHelpers.addDataAttributes(data, testId)), {
|
|
@@ -10203,14 +10212,18 @@
|
|
|
10203
10212
|
})
|
|
10204
10213
|
})
|
|
10205
10214
|
})),
|
|
10206
|
-
|
|
10207
|
-
|
|
10208
|
-
|
|
10209
|
-
|
|
10210
|
-
className: classes.
|
|
10211
|
-
|
|
10212
|
-
|
|
10213
|
-
|
|
10215
|
+
hasIcons && icons.map(function(param2, index) {
|
|
10216
|
+
var key = param2.key, iconComponent = param2.iconComponent, onClick = param2.onClick, _param_shouldResetSize = param2.shouldResetSize, shouldResetSize = _param_shouldResetSize === void 0 ? false : _param_shouldResetSize;
|
|
10217
|
+
var _obj3;
|
|
10218
|
+
return /* @__PURE__ */ jsx("div", _object_spread_props$I(_object_spread$S({
|
|
10219
|
+
className: clsx(classes.icon, classes.endIcon, (_obj3 = {}, _define_property$U(_obj3, classes.activeIcon, !isDisabled && trueReactPlatformHelpers.isNotEmpty(onClick)), _define_property$U(_obj3, classes.customIcon, shouldResetSize), _obj3))
|
|
10220
|
+
}, trueReactPlatformHelpers.addClickHandler(onClick, !isDisabled), trueReactPlatformHelpers.addDataTestId(testId, "icon")), {
|
|
10221
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
10222
|
+
className: classes.iconInner,
|
|
10223
|
+
children: renderIcon(iconComponent)
|
|
10224
|
+
})
|
|
10225
|
+
}), key !== null && key !== void 0 ? key : index);
|
|
10226
|
+
}),
|
|
10214
10227
|
isLoading && /* @__PURE__ */ jsx("div", _object_spread_props$I(_object_spread$S({
|
|
10215
10228
|
className: clsx(classes.icon, classes.loader)
|
|
10216
10229
|
}, trueReactPlatformHelpers.addDataTestId(testId, "loading")), {
|
|
@@ -10552,7 +10565,7 @@
|
|
|
10552
10565
|
}
|
|
10553
10566
|
}
|
|
10554
10567
|
var InputBase = /* @__PURE__ */ React.forwardRef(function(_param, ref) {
|
|
10555
|
-
var _param_value = _param.value, value = _param_value === void 0 ? "" : _param_value, placeholder = _param.placeholder, label = _param.label, _param_type = _param.type, type = _param_type === void 0 ? "text" : _param_type, isDisabled = _param.isDisabled, autoComplete = _param.autoComplete, initialInputMode = _param.inputMode, isReadonly = _param.isReadonly, isInvalid = _param.isInvalid, isActive = _param.isActive, isClearable = _param.isClearable, isAutoSized = _param.isAutoSized, name = _param.name, tweakStyles = _param.tweakStyles, maxLength = _param.maxLength, shouldFocusOnMount = _param.shouldFocusOnMount, units = _param.units, testId = _param.testId, tabIndex = _param.tabIndex, shouldAlwaysShowPlaceholder = _param.shouldAlwaysShowPlaceholder, onChange = _param.onChange, onPaste = _param.onPaste, onFocus = _param.onFocus, onBlur = _param.onBlur, onKeyDown = _param.onKeyDown, mask = _param.mask, maskPlaceholder = _param.maskPlaceholder, alwaysShowMask = _param.alwaysShowMask, beforeMaskedStateChange = _param.beforeMaskedStateChange, data = _param.data, groupPlacement = _param.groupPlacement, icon = _param.icon, isLoading = _param.isLoading, isRequired = _param.isRequired, size = _param.size,
|
|
10568
|
+
var _param_value = _param.value, value = _param_value === void 0 ? "" : _param_value, placeholder = _param.placeholder, label = _param.label, _param_type = _param.type, type = _param_type === void 0 ? "text" : _param_type, isDisabled = _param.isDisabled, autoComplete = _param.autoComplete, initialInputMode = _param.inputMode, isReadonly = _param.isReadonly, isInvalid = _param.isInvalid, isActive = _param.isActive, isClearable = _param.isClearable, isAutoSized = _param.isAutoSized, name = _param.name, tweakStyles = _param.tweakStyles, maxLength = _param.maxLength, shouldFocusOnMount = _param.shouldFocusOnMount, units = _param.units, testId = _param.testId, tabIndex = _param.tabIndex, shouldAlwaysShowPlaceholder = _param.shouldAlwaysShowPlaceholder, onChange = _param.onChange, onPaste = _param.onPaste, onFocus = _param.onFocus, onBlur = _param.onBlur, onKeyDown = _param.onKeyDown, mask = _param.mask, maskPlaceholder = _param.maskPlaceholder, alwaysShowMask = _param.alwaysShowMask, beforeMaskedStateChange = _param.beforeMaskedStateChange, data = _param.data, groupPlacement = _param.groupPlacement, icon = _param.icon, isLoading = _param.isLoading, isRequired = _param.isRequired, size = _param.size, children = _param.children, inputProps = _object_without_properties$i(_param, [
|
|
10556
10569
|
"value",
|
|
10557
10570
|
"placeholder",
|
|
10558
10571
|
"label",
|
|
@@ -10588,7 +10601,6 @@
|
|
|
10588
10601
|
"isLoading",
|
|
10589
10602
|
"isRequired",
|
|
10590
10603
|
"size",
|
|
10591
|
-
"onIconClick",
|
|
10592
10604
|
"children"
|
|
10593
10605
|
]);
|
|
10594
10606
|
var classes = useStyles$G({
|
|
@@ -10718,7 +10730,6 @@
|
|
|
10718
10730
|
icon,
|
|
10719
10731
|
isLoading,
|
|
10720
10732
|
isRequired,
|
|
10721
|
-
onIconClick,
|
|
10722
10733
|
size,
|
|
10723
10734
|
children: [
|
|
10724
10735
|
hasUnits || isAutoSized ? /* @__PURE__ */ jsx("div", {
|
|
@@ -11662,7 +11673,7 @@
|
|
|
11662
11673
|
return trueReactPlatformHelpers.isNotEmpty(value === null || value === void 0 ? void 0 : value.id) ? String(value.id) : convertValueToString(value);
|
|
11663
11674
|
};
|
|
11664
11675
|
};
|
|
11665
|
-
var
|
|
11676
|
+
var Z_INDEX = dimensions.Z_INDEX;
|
|
11666
11677
|
var useStyles$D = createThemedStyles("Select", {
|
|
11667
11678
|
root: {
|
|
11668
11679
|
width: "100%",
|
|
@@ -11671,8 +11682,7 @@
|
|
|
11671
11682
|
},
|
|
11672
11683
|
inputWrapper: {
|
|
11673
11684
|
width: "100%",
|
|
11674
|
-
cursor: "text"
|
|
11675
|
-
position: "relative"
|
|
11685
|
+
cursor: "text"
|
|
11676
11686
|
},
|
|
11677
11687
|
listWrapper: {
|
|
11678
11688
|
left: -1,
|
|
@@ -11691,57 +11701,28 @@
|
|
|
11691
11701
|
maxWidth: "min-content"
|
|
11692
11702
|
},
|
|
11693
11703
|
arrow: {
|
|
11694
|
-
|
|
11695
|
-
|
|
11696
|
-
top: "50%",
|
|
11697
|
-
width: 20,
|
|
11698
|
-
height: 20,
|
|
11704
|
+
width: "var(--icon-inner-size, 20px)",
|
|
11705
|
+
height: "var(--icon-inner-size, 20px)",
|
|
11699
11706
|
cursor: "pointer",
|
|
11700
|
-
transform: "translateY(-50%)",
|
|
11701
11707
|
transition: animations.defaultTransition,
|
|
11702
11708
|
transitionProperty: "transform",
|
|
11703
11709
|
zIndex: Z_INDEX.CONTROL_FOCUS + 1
|
|
11704
11710
|
},
|
|
11705
11711
|
activeArrow: {
|
|
11706
|
-
transform: "
|
|
11712
|
+
transform: "rotate(180deg)"
|
|
11707
11713
|
},
|
|
11708
11714
|
disabled: {
|
|
11709
11715
|
"& $arrow": {
|
|
11710
11716
|
cursor: "default"
|
|
11711
11717
|
}
|
|
11712
11718
|
},
|
|
11713
|
-
counter: {
|
|
11714
|
-
"&:not(:last-child)": {
|
|
11715
|
-
paddingRight: 8
|
|
11716
|
-
}
|
|
11717
|
-
},
|
|
11718
|
-
icon: {
|
|
11719
|
-
width: CONTROL.ICON_INNER_SIZE,
|
|
11720
|
-
height: CONTROL.ICON_INNER_SIZE
|
|
11721
|
-
},
|
|
11722
|
-
iconWrapper: {
|
|
11723
|
-
display: "flex",
|
|
11724
|
-
alignItems: "center"
|
|
11725
|
-
}
|
|
11719
|
+
counter: {}
|
|
11726
11720
|
});
|
|
11727
11721
|
var baseInputStyles = {
|
|
11728
|
-
inputContent: {
|
|
11729
|
-
paddingRight: 32
|
|
11730
|
-
},
|
|
11731
11722
|
input: {
|
|
11732
11723
|
"&[readonly]": {
|
|
11733
11724
|
cursor: "pointer"
|
|
11734
11725
|
}
|
|
11735
|
-
},
|
|
11736
|
-
tweakControlWrapper: {
|
|
11737
|
-
controls: {
|
|
11738
|
-
paddingRight: 40
|
|
11739
|
-
},
|
|
11740
|
-
icon: {
|
|
11741
|
-
"&:last-child": {
|
|
11742
|
-
paddingRight: 0
|
|
11743
|
-
}
|
|
11744
|
-
}
|
|
11745
11726
|
}
|
|
11746
11727
|
};
|
|
11747
11728
|
var readonlyInputBaseStyles = {
|
|
@@ -12488,23 +12469,6 @@
|
|
|
12488
12469
|
onToggleCheckbox: handleToggleOptionCheckbox
|
|
12489
12470
|
})
|
|
12490
12471
|
}));
|
|
12491
|
-
var multiSelectCounterWithIcon = shouldShowMultiSelectCounter || trueReactPlatformHelpers.isNotEmpty(icon) ? /* @__PURE__ */ jsxs("div", {
|
|
12492
|
-
className: classes.iconWrapper,
|
|
12493
|
-
children: [
|
|
12494
|
-
shouldShowMultiSelectCounter && /* @__PURE__ */ jsxs("div", {
|
|
12495
|
-
className: classes.counter,
|
|
12496
|
-
children: [
|
|
12497
|
-
"(+",
|
|
12498
|
-
value.length - 1,
|
|
12499
|
-
")"
|
|
12500
|
-
]
|
|
12501
|
-
}),
|
|
12502
|
-
trueReactPlatformHelpers.isNotEmpty(icon) && /* @__PURE__ */ jsx("div", {
|
|
12503
|
-
className: classes.icon,
|
|
12504
|
-
children: renderIcon(icon)
|
|
12505
|
-
})
|
|
12506
|
-
]
|
|
12507
|
-
}) : void 0;
|
|
12508
12472
|
return /* @__PURE__ */ jsx(WithMessages, {
|
|
12509
12473
|
errorMessage,
|
|
12510
12474
|
infoMessage,
|
|
@@ -12515,34 +12479,43 @@
|
|
|
12515
12479
|
onKeyDown: handleKeyDown,
|
|
12516
12480
|
ref: root2,
|
|
12517
12481
|
children: [
|
|
12518
|
-
/* @__PURE__ */
|
|
12482
|
+
/* @__PURE__ */ jsx("div", {
|
|
12519
12483
|
className: clsx(classes.inputWrapper, isDisabled && classes.disabled),
|
|
12520
12484
|
onClick: isDisabled || isReadonly ? void 0 : handleOnClick,
|
|
12521
12485
|
ref: inputWrapper,
|
|
12522
|
-
children:
|
|
12523
|
-
|
|
12524
|
-
|
|
12525
|
-
|
|
12526
|
-
|
|
12527
|
-
|
|
12528
|
-
|
|
12529
|
-
|
|
12530
|
-
|
|
12531
|
-
|
|
12532
|
-
|
|
12533
|
-
|
|
12534
|
-
|
|
12535
|
-
|
|
12536
|
-
|
|
12537
|
-
|
|
12538
|
-
|
|
12539
|
-
|
|
12540
|
-
|
|
12541
|
-
|
|
12542
|
-
|
|
12543
|
-
|
|
12544
|
-
|
|
12545
|
-
|
|
12486
|
+
children: /* @__PURE__ */ jsx(InputBase, _object_spread$J({
|
|
12487
|
+
value: searchValue !== "" && !shouldRenderSearchInputInList ? searchValue : showedStringValue,
|
|
12488
|
+
onChange: handleInputChange,
|
|
12489
|
+
isActive: isListOpen || isActive,
|
|
12490
|
+
isReadonly: hasReadonlyInput,
|
|
12491
|
+
onFocus: handleFocus,
|
|
12492
|
+
onBlur: handleBlur,
|
|
12493
|
+
isDisabled,
|
|
12494
|
+
ref: input,
|
|
12495
|
+
isLoading: areOptionsLoading,
|
|
12496
|
+
tweakStyles: tweakInputStyles,
|
|
12497
|
+
testId,
|
|
12498
|
+
icon: [
|
|
12499
|
+
isMultiSelect && shouldShowMultiSelectCounter ? {
|
|
12500
|
+
key: "counter",
|
|
12501
|
+
iconComponent: /* @__PURE__ */ jsxs("div", {
|
|
12502
|
+
className: classes.counter,
|
|
12503
|
+
children: [
|
|
12504
|
+
"(+",
|
|
12505
|
+
value.length - 1,
|
|
12506
|
+
")"
|
|
12507
|
+
]
|
|
12508
|
+
}, "counter"),
|
|
12509
|
+
shouldResetSize: true
|
|
12510
|
+
} : void 0
|
|
12511
|
+
].concat(_to_consumable_array$7(trueReactPlatformHelpers.getArray(icon)), [
|
|
12512
|
+
/* @__PURE__ */ jsx("div", {
|
|
12513
|
+
className: clsx(classes.arrow, isOpen && classes.activeArrow),
|
|
12514
|
+
onClick: onArrowClick,
|
|
12515
|
+
children: renderIcon(dropdownIcon)
|
|
12516
|
+
}, "arrow")
|
|
12517
|
+
]).filter(trueReactPlatformHelpers.isNotEmpty)
|
|
12518
|
+
}, inputProps))
|
|
12546
12519
|
}),
|
|
12547
12520
|
shouldUsePopper ? /* @__PURE__ */ jsx(reactOverlays.Portal, {
|
|
12548
12521
|
container: shouldRenderInBody ? document.body : inputWrapper.current,
|
|
@@ -32661,6 +32634,7 @@
|
|
|
32661
32634
|
exports2.cleanStyles = cleanStyles;
|
|
32662
32635
|
exports2.colors = colors;
|
|
32663
32636
|
exports2.common = common;
|
|
32637
|
+
exports2.convertToControlWrapperIcon = convertToControlWrapperIcon;
|
|
32664
32638
|
exports2.createThemedStyles = createThemedStyles;
|
|
32665
32639
|
exports2.dimensions = dimensions;
|
|
32666
32640
|
exports2.findCountryByCode = findCountryByCode;
|
|
@@ -32685,6 +32659,7 @@
|
|
|
32685
32659
|
exports2.hasExactParent = hasExactParent;
|
|
32686
32660
|
exports2.helpers = helpers;
|
|
32687
32661
|
exports2.iconsList = iconsList;
|
|
32662
|
+
exports2.isControlWrapperIcon = isControlWrapperIcon;
|
|
32688
32663
|
exports2.isElementOffScreen = isElementOffScreen;
|
|
32689
32664
|
exports2.isElementOneOfParents = isElementOneOfParents;
|
|
32690
32665
|
exports2.isSpaceChar = isSpaceChar;
|