@true-engineering/true-react-common-ui-kit 2.0.0 → 2.1.0
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/README.md +17 -0
- package/dist/components/Button/Button.d.ts +35 -0
- package/dist/components/Checkbox/Checkbox.d.ts +15 -2
- package/dist/components/DatePicker/DatePicker.d.ts +3 -4
- package/dist/components/DatePicker/types.d.ts +1 -1
- package/dist/components/FiltersPane/FilterSelect/FilterSelect.d.ts +12 -0
- package/dist/components/Input/Input.d.ts +17 -0
- package/dist/components/MoreMenu/MoreMenu.d.ts +3 -0
- package/dist/components/Notification/Notification.d.ts +6 -0
- package/dist/components/RadioButton/RadioButton.d.ts +4 -3
- package/dist/components/Switch/Switch.d.ts +10 -4
- package/dist/components/ThemedPreloader/ThemedPreloader.d.ts +3 -0
- package/dist/components/Toaster/Toaster.d.ts +13 -0
- package/dist/components/Tooltip/Tooltip.d.ts +6 -0
- package/dist/helpers/utils.d.ts +14 -0
- package/dist/true-react-common-ui-kit.js +19 -15
- package/dist/true-react-common-ui-kit.js.map +1 -1
- package/dist/true-react-common-ui-kit.umd.cjs +19 -15
- package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
- package/dist/types.d.ts +3 -0
- package/package.json +1 -1
- package/src/components/Checkbox/Checkbox.tsx +3 -2
- package/src/components/DatePicker/DatePicker.tsx +2 -4
- package/src/components/DatePicker/types.ts +5 -0
- package/src/components/RadioButton/RadioButton.tsx +5 -4
- package/src/components/Select/Select.tsx +6 -2
- package/src/components/Switch/Switch.tsx +10 -16
|
@@ -8823,11 +8823,17 @@
|
|
|
8823
8823
|
]
|
|
8824
8824
|
});
|
|
8825
8825
|
React.useEffect(function() {
|
|
8826
|
-
var val = isMultiSelect ? value === null || value === void 0 ? void 0 : value[0] : value;
|
|
8827
8826
|
var _optionsIndexesForNavigation_find;
|
|
8828
8827
|
setFocusedListCellIndex((_optionsIndexesForNavigation_find = optionsIndexesForNavigation.find(function(index) {
|
|
8829
|
-
return filteredOptions[index] ===
|
|
8828
|
+
return isNotEmpty(strValue) && isNotEmpty(filteredOptions[index]) && convertToId(filteredOptions[index]) === convertToId(strValue);
|
|
8830
8829
|
})) !== null && _optionsIndexesForNavigation_find !== void 0 ? _optionsIndexesForNavigation_find : optionsIndexesForNavigation[0]);
|
|
8830
|
+
}, [
|
|
8831
|
+
strValue,
|
|
8832
|
+
filteredOptions,
|
|
8833
|
+
optionsIndexesForNavigation,
|
|
8834
|
+
convertToId
|
|
8835
|
+
]);
|
|
8836
|
+
React.useEffect(function() {
|
|
8831
8837
|
if (isOpen) {
|
|
8832
8838
|
onOpen === null || onOpen === void 0 ? void 0 : onOpen();
|
|
8833
8839
|
}
|
|
@@ -9277,7 +9283,7 @@
|
|
|
9277
9283
|
});
|
|
9278
9284
|
};
|
|
9279
9285
|
var DatePicker = /* @__PURE__ */ React.forwardRef(function(_param, ref) {
|
|
9280
|
-
var data = _param.data, _param_selectedDate = _param.selectedDate, selectedDate = _param_selectedDate === void 0 ? null : _param_selectedDate, minDate = _param.minDate, maxDate = _param.maxDate, _param_endDate = _param.endDate, endDate = _param_endDate === void 0 ? null : _param_endDate, _param_startDate = _param.startDate, startDate = _param_startDate === void 0 ? null : _param_startDate, locale2 = _param.locale, months = _param.months, _param_topPosition = _param.topPosition, topPosition = _param_topPosition === void 0 ? 0 : _param_topPosition, _param_leftPosition = _param.leftPosition, leftPosition = _param_leftPosition === void 0 ? 0 : _param_leftPosition, _param_calendarStartDay = _param.calendarStartDay, calendarStartDay = _param_calendarStartDay === void 0 ? 1 : _param_calendarStartDay, _param_dateFormat = _param.dateFormat, dateFormat = _param_dateFormat === void 0 ? DEFAULT_DATE_FORMAT$2 : _param_dateFormat, monthsShown = _param.monthsShown, placeholder = _param.placeholder, isRange = _param.isRange, isInline = _param.isInline, isDisabled = _param.isDisabled, isClearable = _param.isClearable, focusSelectedMonth = _param.focusSelectedMonth, disabledKeyboardNavigation = _param.disabledKeyboardNavigation, shouldRenderPopperInBody = _param.shouldRenderPopperInBody, _param_allowSameDay = _param.allowSameDay, allowSameDay = _param_allowSameDay === void 0 ? false : _param_allowSameDay, shouldCloseOnSelect = _param.shouldCloseOnSelect, showPreviousMonths = _param.showPreviousMonths, preventOpenOnFocus = _param.preventOpenOnFocus, popperModifiers = _param.popperModifiers, popperPlacement = _param.popperPlacement, todayButton = _param.todayButton, calendarContainer = _param.calendarContainer, dayClassName = _param.dayClassName, tmp = _param.customInput, CustomInput = tmp === void 0 ? DateInput : tmp, customInputRef = _param.customInputRef, renderCustomHeader = _param.renderCustomHeader, filterDate = _param.filterDate, onYearChange = _param.onYearChange, onMonthChange = _param.onMonthChange, onCalendarOpen = _param.onCalendarOpen, onCalendarClose = _param.onCalendarClose, onChangeDate = _param.onChangeDate, onChangeRange = _param.onChangeRange, onBlur = _param.onBlur, onFocus = _param.onFocus, onKeyDown = _param.onKeyDown, tweakStyles = _param.tweakStyles, inputProps = _object_without_properties$4(_param, [
|
|
9286
|
+
var data = _param.data, _param_selectedDate = _param.selectedDate, selectedDate = _param_selectedDate === void 0 ? null : _param_selectedDate, minDate = _param.minDate, maxDate = _param.maxDate, _param_endDate = _param.endDate, endDate = _param_endDate === void 0 ? null : _param_endDate, _param_startDate = _param.startDate, startDate = _param_startDate === void 0 ? null : _param_startDate, locale2 = _param.locale, months = _param.months, _param_topPosition = _param.topPosition, topPosition = _param_topPosition === void 0 ? 0 : _param_topPosition, _param_leftPosition = _param.leftPosition, leftPosition = _param_leftPosition === void 0 ? 0 : _param_leftPosition, _param_calendarStartDay = _param.calendarStartDay, calendarStartDay = _param_calendarStartDay === void 0 ? 1 : _param_calendarStartDay, _param_dateFormat = _param.dateFormat, dateFormat = _param_dateFormat === void 0 ? DEFAULT_DATE_FORMAT$2 : _param_dateFormat, monthsShown = _param.monthsShown, placeholder = _param.placeholder, isRange = _param.isRange, isInline = _param.isInline, isDisabled = _param.isDisabled, isClearable = _param.isClearable, strictParsing = _param.strictParsing, focusSelectedMonth = _param.focusSelectedMonth, disabledKeyboardNavigation = _param.disabledKeyboardNavigation, shouldRenderPopperInBody = _param.shouldRenderPopperInBody, _param_allowSameDay = _param.allowSameDay, allowSameDay = _param_allowSameDay === void 0 ? false : _param_allowSameDay, shouldCloseOnSelect = _param.shouldCloseOnSelect, showPreviousMonths = _param.showPreviousMonths, preventOpenOnFocus = _param.preventOpenOnFocus, popperModifiers = _param.popperModifiers, popperPlacement = _param.popperPlacement, todayButton = _param.todayButton, calendarContainer = _param.calendarContainer, dayClassName = _param.dayClassName, tmp = _param.customInput, CustomInput = tmp === void 0 ? DateInput : tmp, customInputRef = _param.customInputRef, renderCustomHeader = _param.renderCustomHeader, filterDate = _param.filterDate, onYearChange = _param.onYearChange, onMonthChange = _param.onMonthChange, onCalendarOpen = _param.onCalendarOpen, onCalendarClose = _param.onCalendarClose, onChangeDate = _param.onChangeDate, onChangeRange = _param.onChangeRange, onBlur = _param.onBlur, onFocus = _param.onFocus, onKeyDown = _param.onKeyDown, tweakStyles = _param.tweakStyles, inputProps = _object_without_properties$4(_param, [
|
|
9281
9287
|
"data",
|
|
9282
9288
|
"selectedDate",
|
|
9283
9289
|
"minDate",
|
|
@@ -9296,6 +9302,7 @@
|
|
|
9296
9302
|
"isInline",
|
|
9297
9303
|
"isDisabled",
|
|
9298
9304
|
"isClearable",
|
|
9305
|
+
"strictParsing",
|
|
9299
9306
|
"focusSelectedMonth",
|
|
9300
9307
|
"disabledKeyboardNavigation",
|
|
9301
9308
|
"shouldRenderPopperInBody",
|
|
@@ -9469,6 +9476,7 @@
|
|
|
9469
9476
|
popperModifiers,
|
|
9470
9477
|
popperPlacement,
|
|
9471
9478
|
selectsRange: isRange,
|
|
9479
|
+
strictParsing,
|
|
9472
9480
|
preventOpenOnFocus,
|
|
9473
9481
|
shouldCloseOnSelect,
|
|
9474
9482
|
customInputRef,
|
|
@@ -26707,7 +26715,7 @@
|
|
|
26707
26715
|
return target;
|
|
26708
26716
|
}
|
|
26709
26717
|
function RadioButton(param) {
|
|
26710
|
-
var children = param.children, value = param.value, groupName = param.groupName, isChecked = param.isChecked, isDisabled = param.isDisabled, isInvalid = param.isInvalid,
|
|
26718
|
+
var children = param.children, value = param.value, groupName = param.groupName, isChecked = param.isChecked, isDisabled = param.isDisabled, isInvalid = param.isInvalid, data = param.data, tweakStyles = param.tweakStyles, onChange = param.onChange;
|
|
26711
26719
|
var classes = useTheme("RadioButton", styles$6, tweakStyles).classes;
|
|
26712
26720
|
var _obj;
|
|
26713
26721
|
return /* @__PURE__ */ jsxs("label", _object_spread_props$6(_object_spread$6({
|
|
@@ -26847,10 +26855,8 @@
|
|
|
26847
26855
|
return target;
|
|
26848
26856
|
}
|
|
26849
26857
|
var Switch = function(param) {
|
|
26850
|
-
var isDisabled = param.isDisabled, isChecked = param.isChecked, isInvalid = param.isInvalid,
|
|
26858
|
+
var isDisabled = param.isDisabled, isChecked = param.isChecked, isInvalid = param.isInvalid, value = param.value, children = param.children, _param_labelPosition = param.labelPosition, labelPosition = _param_labelPosition === void 0 ? "right" : _param_labelPosition, _param_color = param.color, color = _param_color === void 0 ? "primary" : _param_color, data = param.data, tweakStyles = param.tweakStyles, testId = param.testId, onChange = param.onChange;
|
|
26851
26859
|
var classes = useTheme("Switch", styles$5, tweakStyles).classes;
|
|
26852
|
-
var hasLabel = isNotEmpty(label);
|
|
26853
|
-
var hasChild = isNotEmpty(children);
|
|
26854
26860
|
var handleChange = function() {
|
|
26855
26861
|
return onChange({
|
|
26856
26862
|
name: value,
|
|
@@ -26860,24 +26866,22 @@
|
|
|
26860
26866
|
var _obj;
|
|
26861
26867
|
return /* @__PURE__ */ jsxs("label", _object_spread_props$5(_object_spread$5({
|
|
26862
26868
|
className: clsx(classes.root, classes[color], (_obj = {}, _define_property$5(_obj, classes.disabled, isDisabled), _define_property$5(_obj, classes.checked, isChecked), _define_property$5(_obj, classes.invalid, isInvalid), _obj))
|
|
26863
|
-
}, addDataAttributes(data)), {
|
|
26864
|
-
"data-testid": testId,
|
|
26869
|
+
}, addDataTestId(testId), addDataAttributes(data)), {
|
|
26865
26870
|
children: [
|
|
26866
26871
|
/* @__PURE__ */ jsx("span", {
|
|
26867
26872
|
className: classes.switch,
|
|
26868
|
-
children: /* @__PURE__ */ jsx("input", {
|
|
26873
|
+
children: /* @__PURE__ */ jsx("input", _object_spread$5({
|
|
26869
26874
|
type: "checkbox",
|
|
26870
26875
|
name: value,
|
|
26871
26876
|
className: classes.input,
|
|
26872
26877
|
onChange: isDisabled ? void 0 : handleChange,
|
|
26873
26878
|
checked: isChecked,
|
|
26874
|
-
disabled: isDisabled
|
|
26875
|
-
|
|
26876
|
-
})
|
|
26879
|
+
disabled: isDisabled
|
|
26880
|
+
}, addDataTestId(testId, "input")))
|
|
26877
26881
|
}),
|
|
26878
|
-
(
|
|
26882
|
+
isNotEmpty(children) && /* @__PURE__ */ jsx("span", {
|
|
26879
26883
|
className: clsx(classes.label, classes[labelPosition === "left" ? "labelLeft" : "labelRight"]),
|
|
26880
|
-
children
|
|
26884
|
+
children
|
|
26881
26885
|
})
|
|
26882
26886
|
]
|
|
26883
26887
|
}));
|