hrm_ui_lib 3.2.3 → 3.4.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/components/Alert/Alert.js +2 -2
- package/components/Avatar/types.d.ts +1 -3
- package/components/Badge/Badge.js +2 -2
- package/components/BadgeV2/BadgeV2.js +3 -3
- package/components/Breadcrumb/Breadcrumb.js +3 -3
- package/components/Button/types.d.ts +1 -2
- package/components/ButtonGroup/ButtonGroup.d.ts +1 -1
- package/components/ButtonGroup/ButtonGroup.js +3 -3
- package/components/ButtonGroup/ButtonGroupItem.d.ts +1 -1
- package/components/ButtonGroup/ButtonGroupItem.js +2 -2
- package/components/ButtonGroup/types.d.ts +1 -1
- package/components/Card/types.d.ts +1 -2
- package/components/CardGroup/types.d.ts +1 -2
- package/components/Checkbox/Checkbox.js +4 -4
- package/components/Chips/Chips.js +1 -1
- package/components/Chips/types.d.ts +0 -1
- package/components/Collapse/types.d.ts +3 -6
- package/components/Container/Container.js +2 -2
- package/components/Container/types.d.ts +1 -1
- package/components/Copy/types.d.ts +1 -2
- package/components/DarkModeSwitcher/DarkModeSwitcher.d.ts +2 -4
- package/components/DarkModeSwitcher/DarkModeSwitcher.js +2 -2
- package/components/DatePicker/types.d.ts +0 -1
- package/components/Divider/Divider.js +2 -2
- package/components/Divider/types.d.ts +1 -1
- package/components/Empty/Empty.js +3 -2
- package/components/Empty/types.d.ts +1 -1
- package/components/FileUpload/DropzoneFileUpload/DropzoneFileUpload.js +5 -5
- package/components/FileUpload/DropzoneFileUpload/ErrorItem.d.ts +2 -1
- package/components/FileUpload/DropzoneFileUpload/ErrorItem.js +2 -2
- package/components/FileUpload/DropzoneFileUpload/PreviewItem.d.ts +2 -1
- package/components/FileUpload/DropzoneFileUpload/PreviewItem.js +2 -2
- package/components/FileUpload/FileUpload.js +2 -2
- package/components/FileUpload/UploadItems.js +3 -3
- package/components/FileUpload/types.d.ts +1 -1
- package/components/FormContainer/FormContainer.js +4 -4
- package/components/FormContainer/types.d.ts +1 -1
- package/components/FormField/types.d.ts +1 -2
- package/components/Heading/types.d.ts +1 -2
- package/components/Image/Image.js +3 -3
- package/components/Image/types.d.ts +1 -1
- package/components/LineChart/LineChart.d.ts +1 -1
- package/components/LineChart/LineChart.js +4 -4
- package/components/LineChart/types.d.ts +1 -1
- package/components/Link/types.d.ts +1 -2
- package/components/Menu/types.d.ts +1 -2
- package/components/More/More.js +2 -2
- package/components/More/types.d.ts +1 -1
- package/components/Pagination/Pagination.js +4 -4
- package/components/Pagination/types.d.ts +1 -1
- package/components/Progress/Progress.js +3 -3
- package/components/Progress/types.d.ts +1 -1
- package/components/ProgressStep/ProgressStep.js +3 -3
- package/components/ProgressStep/Step.js +6 -6
- package/components/ProgressStep/types.d.ts +2 -2
- package/components/Radio/types.d.ts +1 -2
- package/components/Select/ButtonSelect/ButtonSelect.js +3 -2
- package/components/Select/FilterSelect/FilterDropdown.js +4 -3
- package/components/Select/FilterSelect/FilterSelect.js +3 -3
- package/components/Select/MultiSelect/DesktopWrapper.d.ts +1 -0
- package/components/Select/MultiSelect/DesktopWrapper.js +2 -2
- package/components/Select/MultiSelect/MobileWrapper.d.ts +1 -0
- package/components/Select/MultiSelect/MobileWrapper.js +2 -2
- package/components/Select/MultiSelect/MultiBase/MultiBase.js +4 -3
- package/components/Select/MultiSelect/MultiSelect.js +3 -3
- package/components/Select/MultiSelect/MultiSelectGrouped/MultiSelectGrouped.js +5 -4
- package/components/Select/MultiSelect/MultiSelectWithTabs/MultiSelectWithTabs.js +5 -4
- package/components/Select/MultiSelect/OptionsWrapper.d.ts +1 -0
- package/components/Select/NestedSelect/NestedSelect.js +5 -4
- package/components/Select/ProfileDropdown/index.js +2 -2
- package/components/Select/Select/Select.js +2 -2
- package/components/Select/Select/SelectDesktop/index.js +4 -3
- package/components/Select/Select/SelectMobile/MobileTopContent.d.ts +2 -1
- package/components/Select/Select/SelectMobile/MobileTopContent.js +2 -2
- package/components/Select/Select/SelectMobile/index.js +3 -2
- package/components/Select/SharedComponents/ButtonSelectWrapper/ButtonSelectWrapper.js +1 -1
- package/components/Select/SharedComponents/ContentTop.d.ts +1 -0
- package/components/Select/SharedComponents/ContentTop.js +6 -5
- package/components/Select/SharedComponents/Footer.js +2 -2
- package/components/Select/SharedComponents/InputSelectWrapper/InputSelectWrapper.js +3 -3
- package/components/Select/helper.d.ts +1 -0
- package/components/Select/helper.js +7 -1
- package/components/Select/types.d.ts +5 -5
- package/components/SideSheet/Footer/Footer.d.ts +2 -1
- package/components/SideSheet/Footer/Footer.js +2 -2
- package/components/SideSheet/SideSheet.js +3 -3
- package/components/SideSheet/types.d.ts +1 -1
- package/components/Skeleton/types.d.ts +1 -2
- package/components/Status/Status.js +3 -3
- package/components/Status/types.d.ts +0 -1
- package/components/Stepper/Stepper.js +2 -2
- package/components/Stepper/types.d.ts +2 -2
- package/components/Tab/Tab.js +3 -3
- package/components/Tab/TabItem.js +1 -1
- package/components/Tab/types.d.ts +2 -4
- package/components/Table/Header.d.ts +2 -2
- package/components/Table/Header.js +2 -2
- package/components/Table/IndeterminateCheckbox.d.ts +2 -4
- package/components/Table/IndeterminateCheckbox.js +2 -2
- package/components/Table/Row.d.ts +2 -2
- package/components/Table/Row.js +6 -6
- package/components/Table/Table.d.ts +1 -1
- package/components/Table/Table.js +5 -5
- package/components/Table/types.d.ts +1 -1
- package/components/Table/utils.d.ts +1 -1
- package/components/Table/utils.js +3 -3
- package/components/TableV2/AdvancedPagination.d.ts +2 -2
- package/components/TableV2/AdvancedPagination.js +3 -3
- package/components/TableV2/ColumnHeader.d.ts +2 -2
- package/components/TableV2/ColumnHeader.js +3 -3
- package/components/TableV2/IndeterminateCheckbox.d.ts +2 -4
- package/components/TableV2/IndeterminateCheckbox.js +2 -2
- package/components/TableV2/Table.d.ts +1 -1
- package/components/TableV2/Table.js +15 -12
- package/components/TableV2/hooks/useTableControl.d.ts +1 -1
- package/components/TableV2/hooks/useTableControl.js +4 -4
- package/components/TableV2/types.d.ts +2 -2
- package/components/Text/types.d.ts +1 -2
- package/components/UnderConstruction/UnderConstruction.js +2 -2
- package/components/UnderConstruction/types.d.ts +1 -1
- package/package.json +1 -1
|
@@ -117,8 +117,8 @@ export const Select = forwardRef((props, _ref) => {
|
|
|
117
117
|
useEffect(() => {
|
|
118
118
|
setCurrentSelectedLabel();
|
|
119
119
|
}, [setCurrentSelectedLabel]);
|
|
120
|
-
return (_jsxs("div", { "data-id":
|
|
120
|
+
return (_jsxs("div", { "data-id": dataId, className: classNames(`select select--${size}`, className, {
|
|
121
121
|
'select--opened': isOpen
|
|
122
|
-
}), ref: containerRef, children: [!isButtonSelect && (_jsx(Input, { onClick: disabled ? noop : onOpenOptions, size: size, dataId: dataId, hasError: hasError, className: "select__input", label: label, onChange: onSearch, required: isRequiredField, leftIconProps: leftIconProps, rightIconProps: isOpen ? selectRightIconOpenedProps : selectRightIconProps, placeholder: placeHolder, currentValue: searchValue || (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label.toString()) || '', isValid: isValid, disabled: disabled, helperText: isOpen ? '' : outerHelperText, ref: inputRef, labelAddons: labelAddons, autoComplete: "false", readOnly: (isMobile && isMobileFullScreen) || !isWithSearch, onKeyDown: handleKeyDown })), isButtonSelect && (_jsx(Button, { size: size, type: "secondary", dataId: dataId, iconProps: selectRightIconProps, buttonText: placeHolder || '', onClick: disabled ? noop : openDropdown, className: "select_button" })), isMobile && isMobileFullScreen ? (_jsx(SelectMobile, Object.assign({}, rest, { isOpen: isOpen, filteredData: filteredData, closeDropdown: closeDropdown, currentSelection: currentSelection, isRequiredField: isRequiredField, onItemDeselect: onItemDeselect, onItemSelect: onItemSelect, translations: localizations, withSearch: withSearch, searchValue: searchValue, setSearchValue: setSearchValue }))) : (_jsx(SelectDesktop, Object.assign({}, rest, { onItemDeselect: onItemDeselect, onItemSelect: onItemSelect, currentSelection: currentSelection, isRequiredField: isRequiredField, filteredData: filteredData, inputRef: inputRef.current, containerRef: containerRef.current, isOpen: isOpen, closeDropdown: closeDropdown, setCurrentSelectedLabel: setCurrentSelectedLabel, searchValue: searchValue, setSearchValue: setSearchValue, translations: localizations, activeIndex: activeIndex, setActiveIndex: setActiveIndex })))] }));
|
|
122
|
+
}), ref: containerRef, children: [!isButtonSelect && (_jsx(Input, { onClick: disabled ? noop : onOpenOptions, size: size, dataId: dataId ? `${dataId}-trigger` : '', hasError: hasError, className: "select__input", label: label, onChange: onSearch, required: isRequiredField, leftIconProps: leftIconProps, rightIconProps: isOpen ? selectRightIconOpenedProps : selectRightIconProps, placeholder: placeHolder, currentValue: searchValue || (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label.toString()) || '', isValid: isValid, disabled: disabled, helperText: isOpen ? '' : outerHelperText, ref: inputRef, labelAddons: labelAddons, autoComplete: "false", readOnly: (isMobile && isMobileFullScreen) || !isWithSearch, onKeyDown: handleKeyDown })), isButtonSelect && (_jsx(Button, { size: size, type: "secondary", dataId: dataId ? `${dataId}-trigger` : '', iconProps: selectRightIconProps, buttonText: placeHolder || '', onClick: disabled ? noop : openDropdown, className: "select_button" })), isMobile && isMobileFullScreen ? (_jsx(SelectMobile, Object.assign({}, rest, { dataId: dataId, isOpen: isOpen, filteredData: filteredData, closeDropdown: closeDropdown, currentSelection: currentSelection, isRequiredField: isRequiredField, onItemDeselect: onItemDeselect, onItemSelect: onItemSelect, translations: localizations, withSearch: withSearch, searchValue: searchValue, setSearchValue: setSearchValue }))) : (_jsx(SelectDesktop, Object.assign({}, rest, { dataId: dataId, onItemDeselect: onItemDeselect, onItemSelect: onItemSelect, currentSelection: currentSelection, isRequiredField: isRequiredField, filteredData: filteredData, inputRef: inputRef.current, containerRef: containerRef.current, isOpen: isOpen, closeDropdown: closeDropdown, setCurrentSelectedLabel: setCurrentSelectedLabel, searchValue: searchValue, setSearchValue: setSearchValue, translations: localizations, activeIndex: activeIndex, setActiveIndex: setActiveIndex })))] }));
|
|
123
123
|
});
|
|
124
124
|
Select.displayName = 'Select';
|
|
@@ -10,6 +10,7 @@ import { Empty } from '../../../Empty';
|
|
|
10
10
|
import { Text } from '../../../Text';
|
|
11
11
|
import { Loading } from '../../SharedComponents';
|
|
12
12
|
import { DROPDOWN_HEIGHT, DROPDOWN_WIDTH, ITEM_SIZE } from '../../constants';
|
|
13
|
+
import { getOptionDataId } from '../../helper';
|
|
13
14
|
export const SelectDesktop = (props) => {
|
|
14
15
|
const { currentSelection, isLoading, dataId = '', innerHelperText, isRequiredField, labelLeftIconProps, labelRightIconComponent, optionRightIconComponent, tooltipAddons, dropdownWidth, isOpen, closeDropdown, inputRef, containerRef, onItemSelect, onItemDeselect, searchValue, setSearchValue, translations, filteredData, activeIndex, setActiveIndex, setCurrentSelectedLabel } = props;
|
|
15
16
|
const listRef = useRef(null);
|
|
@@ -60,10 +61,10 @@ export const SelectDesktop = (props) => {
|
|
|
60
61
|
input: inputRef
|
|
61
62
|
});
|
|
62
63
|
useChangePositionsOnScroll(inputRef, dropdownRef, hasBottomSpace);
|
|
63
|
-
return (_jsx(_Fragment, { children: isOpen && (_jsx("div", { className: "select__options", style: Object.assign({ left,
|
|
64
|
+
return (_jsx(_Fragment, { children: isOpen && (_jsx("div", { "data-id": dataId ? `${dataId}-content` : '', className: "select__options", style: Object.assign({ left,
|
|
64
65
|
width }, (hasBottomSpace || !hasTopSpace
|
|
65
66
|
? { top: bottom }
|
|
66
|
-
: { bottom: window.innerHeight - top + DROPDOWN_AND_INPUT_GAP })), ref: setDropdownRef, children: isLoading ? (_jsx(Loading, {})) : (_jsx(_Fragment, { children: _jsxs("div", {
|
|
67
|
+
: { bottom: window.innerHeight - top + DROPDOWN_AND_INPUT_GAP })), ref: setDropdownRef, children: isLoading ? (_jsx(Loading, {})) : (_jsx(_Fragment, { children: _jsxs("div", { className: classNames('select__options__scroll', 'scrollbar'), children: [innerHelperText ? (_jsx("div", { className: "content-top", children: _jsx(Text, { size: "xsmall", type: "secondary", className: "content-top__label", children: innerHelperText }) })) : null, filteredData.length > 0 && (_jsx(List, { ref: listRef, height: filteredData.length * ITEM_SIZE > DROPDOWN_HEIGHT
|
|
67
68
|
? DROPDOWN_HEIGHT
|
|
68
69
|
: filteredData.length * ITEM_SIZE, itemCount: filteredData.length, itemSize: ITEM_SIZE, width: dropdownWidth || DROPDOWN_WIDTH, style: {
|
|
69
70
|
width: dropdownWidth || '100%',
|
|
@@ -74,7 +75,7 @@ export const SelectDesktop = (props) => {
|
|
|
74
75
|
const item = filteredData[index];
|
|
75
76
|
const isSelected = item.value === currentSelection;
|
|
76
77
|
const isActive = activeIndex === index;
|
|
77
|
-
return (_jsx(OptionItem, { tooltipAddons: tooltipAddons, data: item, onClick: clickHandler(isSelected), labelLeftIconProps: labelLeftIconProps, OptionRightIconComponent: optionRightIconComponent, LabelRightIconComponent: labelRightIconComponent, disabled: item.disabled, isSelected: isSelected, dataId: item.dataId, style: style, className: classNames('option', {
|
|
78
|
+
return (_jsx(OptionItem, { tooltipAddons: tooltipAddons, data: item, onClick: clickHandler(isSelected), labelLeftIconProps: labelLeftIconProps, OptionRightIconComponent: optionRightIconComponent, LabelRightIconComponent: labelRightIconComponent, disabled: item.disabled, isSelected: isSelected, dataId: getOptionDataId(dataId, item.value, index) || item.dataId, style: style, className: classNames('option', {
|
|
78
79
|
'option--active': isActive
|
|
79
80
|
}) }, item.value));
|
|
80
81
|
} })), filteredData.length === 0 ? (_jsx(Empty, { size: "small", mainMessage: translations === null || translations === void 0 ? void 0 : translations.emptyListMainMessage })) : null] }) })) })) }));
|
|
@@ -5,6 +5,7 @@ type TProps = {
|
|
|
5
5
|
onBack: () => void;
|
|
6
6
|
withSearch: boolean;
|
|
7
7
|
isOpen: boolean;
|
|
8
|
+
dataId?: string;
|
|
8
9
|
};
|
|
9
|
-
export declare const MobileTopContent: ({ onBack, setSearchValue, searchValue, withSearch, isOpen }: TProps) => ReactElement;
|
|
10
|
+
export declare const MobileTopContent: ({ onBack, setSearchValue, searchValue, withSearch, isOpen, dataId }: TProps) => ReactElement;
|
|
10
11
|
export {};
|
|
@@ -4,7 +4,7 @@ import IconChevronLeft from '../../../SVGIcons/IconChevronLeft';
|
|
|
4
4
|
import { Input } from '../../../Input';
|
|
5
5
|
import IconDismissFilled from '../../../SVGIcons/IconDismissFilled';
|
|
6
6
|
import IconSearchFilled from '../../../SVGIcons/IconSearchFilled';
|
|
7
|
-
export const MobileTopContent = ({ onBack, setSearchValue, searchValue, withSearch, isOpen }) => {
|
|
7
|
+
export const MobileTopContent = ({ onBack, setSearchValue, searchValue, withSearch, isOpen, dataId }) => {
|
|
8
8
|
const inputRef = useRef(null);
|
|
9
9
|
const onSearch = (e) => {
|
|
10
10
|
setSearchValue(e.target.value);
|
|
@@ -17,7 +17,7 @@ export const MobileTopContent = ({ onBack, setSearchValue, searchValue, withSear
|
|
|
17
17
|
inputRef.current.focus();
|
|
18
18
|
}
|
|
19
19
|
}, [inputRef.current]);
|
|
20
|
-
return (_jsxs("div", { className: "flexbox mobile_top_content", children: [_jsx(IconChevronLeft, { onClick: onBack, size: "large" }), withSearch && (_jsx(Input, { currentValue: searchValue, handleChange: onSearch, className: "ml-8", size: "small", ref: inputRef, rightIconProps: {
|
|
20
|
+
return (_jsxs("div", { className: "flexbox mobile_top_content", children: [_jsx(IconChevronLeft, { onClick: onBack, size: "large" }), withSearch && (_jsx(Input, { dataId: dataId ? `${dataId}-search` : '', currentValue: searchValue, handleChange: onSearch, className: "ml-8", size: "small", ref: inputRef, rightIconProps: {
|
|
21
21
|
Component: searchValue ? IconDismissFilled : IconSearchFilled,
|
|
22
22
|
size: searchValue ? 'xsmall' : 'small',
|
|
23
23
|
onClick: removeFilter
|
|
@@ -7,6 +7,7 @@ import { ITEM_SIZE_MOBILE } from '../../constants';
|
|
|
7
7
|
import { Loading } from '../../SharedComponents';
|
|
8
8
|
import { MobileTopContent } from './MobileTopContent';
|
|
9
9
|
import { FixedSizeList as List } from 'react-window';
|
|
10
|
+
import { getOptionDataId } from '../../helper';
|
|
10
11
|
export const SelectMobile = (props) => {
|
|
11
12
|
const { translations, currentSelection, isOpen, closeDropdown, isLoading, dataId, innerHelperText, filteredData, isRequiredField, onItemSelect, onItemDeselect, tooltipAddons, labelLeftIconProps, optionRightIconComponent, labelRightIconComponent, withSearch, searchValue, setSearchValue } = props;
|
|
12
13
|
const clickHandler = (isSelected) => ({ value }) => {
|
|
@@ -25,7 +26,7 @@ export const SelectMobile = (props) => {
|
|
|
25
26
|
};
|
|
26
27
|
const windowHeight = window.innerHeight;
|
|
27
28
|
const windowWidth = window.innerWidth;
|
|
28
|
-
return (_jsxs(Modal, { isOpen: isOpen, onClose: closeDropdown, isMobileFullScreen: true, children: [_jsx(MobileTopContent, { searchValue: searchValue, setSearchValue: setSearchValue, onBack: closeModal, withSearch: withSearch, isOpen: isOpen }), _jsxs("div", { className: "mobile_options_content", children: [innerHelperText ? (_jsx(Text, { size: "xsmall", type: "secondary", className: "mobile_options_content__label", children: innerHelperText })) : null, isLoading ? (_jsx(Loading, {})) : (_jsxs("div", { "data-id": `${dataId}-
|
|
29
|
+
return (_jsxs(Modal, { isOpen: isOpen, onClose: closeDropdown, isMobileFullScreen: true, children: [_jsx(MobileTopContent, { dataId: dataId, searchValue: searchValue, setSearchValue: setSearchValue, onBack: closeModal, withSearch: withSearch, isOpen: isOpen }), _jsxs("div", { className: "mobile_options_content", children: [innerHelperText ? (_jsx(Text, { size: "xsmall", type: "secondary", className: "mobile_options_content__label", children: innerHelperText })) : null, isLoading ? (_jsx(Loading, {})) : (_jsxs("div", { "data-id": dataId ? `${dataId}-content` : '', children: [filteredData.length > 0 && (_jsx(List, { height: windowHeight - 30 - 32 - 24, itemCount: filteredData.length, itemSize: ITEM_SIZE_MOBILE, width: windowWidth, style: {
|
|
29
30
|
width: '100%',
|
|
30
31
|
overflowX: 'hidden',
|
|
31
32
|
overflowY: 'auto',
|
|
@@ -33,6 +34,6 @@ export const SelectMobile = (props) => {
|
|
|
33
34
|
}, children: ({ index, style }) => {
|
|
34
35
|
const item = filteredData[index];
|
|
35
36
|
const isSelected = item.value === currentSelection;
|
|
36
|
-
return (_jsx(OptionItem, { size: "large", tooltipAddons: tooltipAddons, data: item, onClick: clickHandler(isSelected), labelLeftIconProps: labelLeftIconProps, OptionRightIconComponent: optionRightIconComponent, LabelRightIconComponent: labelRightIconComponent, disabled: item.disabled, isSelected: isSelected, dataId: item.dataId, style: style }, item.value));
|
|
37
|
+
return (_jsx(OptionItem, { size: "large", tooltipAddons: tooltipAddons, data: item, onClick: clickHandler(isSelected), labelLeftIconProps: labelLeftIconProps, OptionRightIconComponent: optionRightIconComponent, LabelRightIconComponent: labelRightIconComponent, disabled: item.disabled, isSelected: isSelected, dataId: getOptionDataId(dataId, item.value, index) || item.dataId, style: style }, item.value));
|
|
37
38
|
} })), filteredData.length === 0 ? (_jsx(Empty, { size: "small", mainMessage: translations === null || translations === void 0 ? void 0 : translations.emptyListMainMessage })) : null] }))] })] }));
|
|
38
39
|
};
|
|
@@ -25,5 +25,5 @@ export const ButtonSelectWrapper = (props) => {
|
|
|
25
25
|
return ` ${selectedValues[0].label} +${selectedValues.length - 1}`;
|
|
26
26
|
}, [selectedValues]);
|
|
27
27
|
useChangePositionsOnScroll(buttonRef === null || buttonRef === void 0 ? void 0 : buttonRef.current, dropdownRef, hasBottomSpace);
|
|
28
|
-
return (_jsxs("div", { className: classNames(`select select--${size}`, className), ref: setContainerRef, children: [_jsx(Button, { size: size, type: type, dataId: dataId, isOpen: isOpen, buttonText: placeHolder || '', selectedItemsLabels: selectedItemsLabels, onClick: disabled ? noop : openDropdown, refHandler: buttonRef, className: "select_button" }), _jsx(_Fragment, { children: isMobile ? (_jsx(MobileWrapper, { applySelectedItems: applySelectedItems, isOpen: isOpen, closeDrodown: () => setIsOpen(false), modalApplyButtonText: modalApplyButtonText, children: children })) : (_jsx(DesktopWrapper, { offsets: offsets, setDropdownRef: setDropdownRef, isOpen: isOpen, align: align, dropdownWidth: dropdownWidth, inputRef: buttonRef.current, dropdownRef: dropdownRef, containerRef: containerRef, children: children })) })] }));
|
|
28
|
+
return (_jsxs("div", { "data-id": dataId, className: classNames(`select select--${size}`, className), ref: setContainerRef, children: [_jsx(Button, { size: size, type: type, dataId: dataId ? `${dataId}-trigger` : '', isOpen: isOpen, buttonText: placeHolder || '', selectedItemsLabels: selectedItemsLabels, onClick: disabled ? noop : openDropdown, refHandler: buttonRef, className: "select_button" }), _jsx(_Fragment, { children: isMobile ? (_jsx(MobileWrapper, { dataId: dataId, applySelectedItems: applySelectedItems, isOpen: isOpen, closeDrodown: () => setIsOpen(false), modalApplyButtonText: modalApplyButtonText, children: children })) : (_jsx(DesktopWrapper, { dataId: dataId, offsets: offsets, setDropdownRef: setDropdownRef, isOpen: isOpen, align: align, dropdownWidth: dropdownWidth, inputRef: buttonRef.current, dropdownRef: dropdownRef, containerRef: containerRef, children: children })) })] }));
|
|
29
29
|
};
|
|
@@ -10,8 +10,9 @@ import { useIsMobile } from '../../../hooks/useGetIsMobile';
|
|
|
10
10
|
import IconChevronLeft from '../../SVGIcons/IconChevronLeft';
|
|
11
11
|
import { noop } from '../../../utils/helpers';
|
|
12
12
|
export const ContentTop = React.memo((props) => {
|
|
13
|
-
const { clearAll, selectAll, helperText, searchValue, translations, isAnySelected, setSearchValue, isSearchAvailable = false, hasLimitation = false, isSelectAllDisabled = false, menuOptions = [], dataIdPrefix, closeDropdown, handleKeyDown } = props;
|
|
13
|
+
const { clearAll, selectAll, helperText, searchValue, translations, isAnySelected, setSearchValue, isSearchAvailable = false, hasLimitation = false, isSelectAllDisabled = false, menuOptions = [], dataIdPrefix, dataId, closeDropdown, handleKeyDown } = props;
|
|
14
14
|
const inputRef = useRef(null);
|
|
15
|
+
const baseDataId = dataId || dataIdPrefix;
|
|
15
16
|
const { searchInputPlaceHolder, innerLabel, clearAllLabel, selectAllLabel } = translations || {};
|
|
16
17
|
const selectActions = useMemo(() => {
|
|
17
18
|
let options = menuOptions;
|
|
@@ -23,7 +24,7 @@ export const ContentTop = React.memo((props) => {
|
|
|
23
24
|
handler: selectAll,
|
|
24
25
|
disabled: isSelectAllDisabled,
|
|
25
26
|
iconProps: { Component: IconSelectAllOff },
|
|
26
|
-
dataId:
|
|
27
|
+
dataId: baseDataId ? `${baseDataId}-select-all` : ''
|
|
27
28
|
}
|
|
28
29
|
];
|
|
29
30
|
}
|
|
@@ -36,7 +37,7 @@ export const ContentTop = React.memo((props) => {
|
|
|
36
37
|
handler: clearAll,
|
|
37
38
|
disabled: !isAnySelected,
|
|
38
39
|
iconProps: { Component: IconDismissFilled },
|
|
39
|
-
dataId:
|
|
40
|
+
dataId: baseDataId ? `${baseDataId}-clear` : ''
|
|
40
41
|
}
|
|
41
42
|
];
|
|
42
43
|
}
|
|
@@ -49,7 +50,7 @@ export const ContentTop = React.memo((props) => {
|
|
|
49
50
|
clearAllLabel,
|
|
50
51
|
isSelectAllDisabled,
|
|
51
52
|
isAnySelected,
|
|
52
|
-
|
|
53
|
+
baseDataId
|
|
53
54
|
]);
|
|
54
55
|
const onSearch = (e) => {
|
|
55
56
|
setSearchValue && setSearchValue(e.target.value);
|
|
@@ -64,7 +65,7 @@ export const ContentTop = React.memo((props) => {
|
|
|
64
65
|
const onBack = () => {
|
|
65
66
|
closeDropdown && closeDropdown();
|
|
66
67
|
};
|
|
67
|
-
return (_jsxs("div", { className: "content-top", children: [helperText && !isMobile ? (_jsx(Text, { size: "xsmall", type: "secondary", className: "content-top__label", children: helperText })) : null, _jsxs("div", { className: "flexbox search-container", children: [isMobile && _jsx(IconChevronLeft, { onClick: onBack, size: "large" }), isSearchAvailable && (_jsx(Input, { onKeyDown: handleKeyDown || noop, ref: inputRef, className: "content-top__search", size: "small", placeholder: searchInputPlaceHolder, handleChange: onSearch, currentValue: searchValue, rightIconProps: {
|
|
68
|
+
return (_jsxs("div", { className: "content-top", children: [helperText && !isMobile ? (_jsx(Text, { size: "xsmall", type: "secondary", className: "content-top__label", children: helperText })) : null, _jsxs("div", { className: "flexbox search-container", children: [isMobile && _jsx(IconChevronLeft, { onClick: onBack, size: "large" }), isSearchAvailable && (_jsx(Input, { dataId: baseDataId ? `${baseDataId}-search` : '', onKeyDown: handleKeyDown || noop, ref: inputRef, className: "content-top__search", size: "small", placeholder: searchInputPlaceHolder, handleChange: onSearch, currentValue: searchValue, rightIconProps: {
|
|
68
69
|
Component: searchValue ? IconDismissFilled : IconSearchFilled,
|
|
69
70
|
size: searchValue ? 'xsmall' : 'small',
|
|
70
71
|
onClick: removeFilter
|
|
@@ -4,9 +4,9 @@ import { Button } from '../../Button';
|
|
|
4
4
|
import { Checkbox } from '../../Checkbox';
|
|
5
5
|
import { SELECT_TRANSLATIONS } from '../localization';
|
|
6
6
|
export const Footer = (props) => {
|
|
7
|
-
const { language, buttonProps, onApply, onCancel, hasChange = true, checkboxInfo } = props;
|
|
7
|
+
const { language, buttonProps, onApply, onCancel, hasChange = true, checkboxInfo, dataId } = props;
|
|
8
8
|
const [isSelected, setIsSelected] = React.useState((checkboxInfo === null || checkboxInfo === void 0 ? void 0 : checkboxInfo.isChecked) || false);
|
|
9
9
|
const confirmButtonProps = Object.assign({ buttonText: SELECT_TRANSLATIONS[language].confirmButtonText }, ((buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.confirm) || {}));
|
|
10
10
|
const cancelButtonProps = Object.assign({ buttonText: SELECT_TRANSLATIONS[language].cancelButtonText }, ((buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.cancel) || {}));
|
|
11
|
-
return (_jsxs("div", { className: "select__footer", children: [_jsx("div", { children: checkboxInfo ? (_jsx(Checkbox, { label: checkboxInfo.label, selectedValue: isSelected, onClick: setIsSelected })) : null }), _jsxs("div", { className: 'select__footer__right flexbox', children: [_jsx(Button, Object.assign({}, cancelButtonProps, { type: "tertiary", size: "medium", className: "mr-12", onClick: onCancel })), _jsx(Button, Object.assign({ disabled: !hasChange && isSelected === !!(checkboxInfo === null || checkboxInfo === void 0 ? void 0 : checkboxInfo.isChecked) }, confirmButtonProps, { type: "primary", size: "medium", onClick: () => onApply(isSelected) }))] })] }));
|
|
11
|
+
return (_jsxs("div", { className: "select__footer", children: [_jsx("div", { children: checkboxInfo ? (_jsx(Checkbox, { label: checkboxInfo.label, selectedValue: isSelected, onClick: setIsSelected })) : null }), _jsxs("div", { className: 'select__footer__right flexbox', children: [_jsx(Button, Object.assign({}, cancelButtonProps, { dataId: dataId ? `${dataId}-cancel` : '', type: "tertiary", size: "medium", className: "mr-12", onClick: onCancel })), _jsx(Button, Object.assign({ disabled: !hasChange && isSelected === !!(checkboxInfo === null || checkboxInfo === void 0 ? void 0 : checkboxInfo.isChecked) }, confirmButtonProps, { dataId: dataId ? `${dataId}-apply` : '', type: "primary", size: "medium", onClick: () => onApply(isSelected) }))] })] }));
|
|
12
12
|
};
|
|
@@ -10,7 +10,7 @@ import { DesktopWrapper } from '../../MultiSelect/DesktopWrapper';
|
|
|
10
10
|
import IconChevronUp from '../../../SVGIcons/IconChevronUp';
|
|
11
11
|
import IconChevronDown from '../../../SVGIcons/IconChevronDown';
|
|
12
12
|
export const InputSelectWrapper = (props) => {
|
|
13
|
-
const { isMobile, children, options, label, placeHolder, isRequiredField, labelAddons, disabled, className = '', dropdownWidth, align = 'left', size = 'small', dropdownRef, setDropdownRef, containerRef, setIsOpen, isOpen, selectedValues, setContainerRef, overflowText, hasError, modalApplyButtonText, applySelectedItems, hideSelectedOptions = false } = props;
|
|
13
|
+
const { isMobile, children, options, label, placeHolder, isRequiredField, labelAddons, disabled, className = '', dropdownWidth, align = 'left', size = 'small', dropdownRef, setDropdownRef, containerRef, setIsOpen, isOpen, selectedValues, setContainerRef, overflowText, hasError, modalApplyButtonText, applySelectedItems, hideSelectedOptions = false, dataId } = props;
|
|
14
14
|
const inputRef = useRef(null);
|
|
15
15
|
const { width } = useGetElemSizes(containerRef);
|
|
16
16
|
const checkIsValueOverflowed = useCallback((value) => {
|
|
@@ -53,8 +53,8 @@ export const InputSelectWrapper = (props) => {
|
|
|
53
53
|
input: inputRef.current
|
|
54
54
|
});
|
|
55
55
|
useChangePositionsOnScroll(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current, dropdownRef, hasBottomSpace);
|
|
56
|
-
return (_jsxs("div", { className: classNames('select select--multi', className), ref: setContainerRef, children: [_jsx("div", { onClick: disabled ? noop : toggleDropdown, children: _jsx(Input, { readonly: true, label: label, ref: inputRef, hasError: hasError, className: "select__input", placeholder: placeHolder, required: isRequiredField, currentValue: hideSelectedOptions ? '' : selectedItemsLabels, rightIconProps: {
|
|
56
|
+
return (_jsxs("div", { "data-id": dataId, className: classNames('select select--multi', className), ref: setContainerRef, children: [_jsx("div", { onClick: disabled ? noop : toggleDropdown, children: _jsx(Input, { dataId: dataId ? `${dataId}-trigger` : '', readonly: true, label: label, ref: inputRef, hasError: hasError, className: "select__input", placeholder: placeHolder, required: isRequiredField, currentValue: hideSelectedOptions ? '' : selectedItemsLabels, rightIconProps: {
|
|
57
57
|
Component: isOpen ? IconChevronUp : IconChevronDown,
|
|
58
58
|
size: 'small'
|
|
59
|
-
}, labelAddons: labelAddons, disabled: disabled, size: size, title: inputTitle }) }), _jsx(_Fragment, { children: isMobile ? (_jsx(MobileWrapper, { applySelectedItems: applySelectedItems, isOpen: isOpen, closeDrodown: () => setIsOpen(false), modalApplyButtonText: modalApplyButtonText, children: children })) : (_jsx(DesktopWrapper, { setDropdownRef: setDropdownRef, isOpen: isOpen, align: align, dropdownWidth: dropdownWidth, inputRef: inputRef.current, dropdownRef: dropdownRef, containerRef: containerRef, children: children })) })] }));
|
|
59
|
+
}, labelAddons: labelAddons, disabled: disabled, size: size, title: inputTitle }) }), _jsx(_Fragment, { children: isMobile ? (_jsx(MobileWrapper, { dataId: dataId, applySelectedItems: applySelectedItems, isOpen: isOpen, closeDrodown: () => setIsOpen(false), modalApplyButtonText: modalApplyButtonText, children: children })) : (_jsx(DesktopWrapper, { dataId: dataId, setDropdownRef: setDropdownRef, isOpen: isOpen, align: align, dropdownWidth: dropdownWidth, inputRef: inputRef.current, dropdownRef: dropdownRef, containerRef: containerRef, children: children })) })] }));
|
|
60
60
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getOptionDataId: (dataId: string | undefined, value: TItemValue, index: number) => string;
|
|
@@ -26,6 +26,7 @@ interface TSelectBaseProps {
|
|
|
26
26
|
language?: string;
|
|
27
27
|
}
|
|
28
28
|
export interface TNestedSelectProps {
|
|
29
|
+
dataId?: string;
|
|
29
30
|
options: TSelectOptions;
|
|
30
31
|
isRequiredField?: boolean;
|
|
31
32
|
label?: string | ReactElement;
|
|
@@ -100,7 +101,6 @@ export interface TMultiSelectPropTypes extends IFormCompProps, TSelectBaseProps
|
|
|
100
101
|
}
|
|
101
102
|
export interface TButtonSelectPropTypes extends IFormCompProps, TSelectBaseProps {
|
|
102
103
|
isMobileFullScreen?: boolean;
|
|
103
|
-
dataId?: string;
|
|
104
104
|
options: TSelectOptions;
|
|
105
105
|
selectedItem?: TItemValue;
|
|
106
106
|
setSelectedItem?: (items: TItemValue | undefined) => void;
|
|
@@ -129,11 +129,10 @@ export interface TSingleSelectPropTypes extends IFormCompProps, TSelectBaseProps
|
|
|
129
129
|
emptyListMainMessage: string;
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
|
-
export interface ISingleSelectResponsiveProps {
|
|
132
|
+
export interface ISingleSelectResponsiveProps extends IBaseProps {
|
|
133
133
|
isOpen: boolean;
|
|
134
134
|
closeDropdown: () => void;
|
|
135
135
|
isLoading?: boolean;
|
|
136
|
-
dataId?: string;
|
|
137
136
|
innerHelperText?: string;
|
|
138
137
|
labelLeftIconProps?: {
|
|
139
138
|
size?: TIconSize;
|
|
@@ -166,6 +165,7 @@ export interface ISingleSelectDesktopProps extends ISingleSelectResponsiveProps
|
|
|
166
165
|
setActiveIndex: (index: number) => void;
|
|
167
166
|
}
|
|
168
167
|
export type TSelectFooterPropTypes = {
|
|
168
|
+
dataId?: string;
|
|
169
169
|
checkboxInfo?: TCheckboxInfo;
|
|
170
170
|
hasChange?: boolean;
|
|
171
171
|
buttonProps?: {
|
|
@@ -227,7 +227,7 @@ export interface TFilterGroupDropdownContentProps extends IFormCompProps {
|
|
|
227
227
|
onItemDeselect: (item: TSelectedValue) => void;
|
|
228
228
|
checkIsSelected: (item: TItemValue) => boolean;
|
|
229
229
|
}
|
|
230
|
-
export type TSelectWrapperProps = {
|
|
230
|
+
export type TSelectWrapperProps = IBaseProps & {
|
|
231
231
|
isMobile: boolean;
|
|
232
232
|
applySelectedItems: (isChecked: boolean) => void;
|
|
233
233
|
hasError?: boolean;
|
|
@@ -255,7 +255,6 @@ export type TSelectWrapperProps = {
|
|
|
255
255
|
dropdownRef: HTMLDivElement | null;
|
|
256
256
|
setDropdownRef: LegacyRef<HTMLDivElement>;
|
|
257
257
|
selectedValues?: TSelectedValue[];
|
|
258
|
-
dataId?: string;
|
|
259
258
|
type?: 'primary' | 'secondary' | 'tertiary';
|
|
260
259
|
modalApplyButtonText?: string;
|
|
261
260
|
hideSelectedOptions?: boolean;
|
|
@@ -269,6 +268,7 @@ declare type TNavItemValue = {
|
|
|
269
268
|
children: ReactNode;
|
|
270
269
|
};
|
|
271
270
|
export type TProfileDropdownProps = {
|
|
271
|
+
dataId?: string;
|
|
272
272
|
avatar: ReactElement;
|
|
273
273
|
email: string;
|
|
274
274
|
name: string;
|
|
@@ -11,6 +11,7 @@ type TProps = {
|
|
|
11
11
|
onClose: (e?: TClickEventType) => void;
|
|
12
12
|
onSubmit?: (isSelected: boolean) => void;
|
|
13
13
|
checkboxInfo?: TCheckboxInfo;
|
|
14
|
+
dataId?: string;
|
|
14
15
|
};
|
|
15
|
-
export declare const Footer: ({ isLoading, footerButtons, onClose, onSubmit, checkboxInfo }: TProps) => ReactElement | null;
|
|
16
|
+
export declare const Footer: ({ isLoading, footerButtons, onClose, onSubmit, checkboxInfo, dataId }: TProps) => ReactElement | null;
|
|
16
17
|
export {};
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import React, { useCallback } from 'react';
|
|
3
3
|
import { Button } from '../../Button';
|
|
4
4
|
import { Checkbox } from '../../Checkbox';
|
|
5
|
-
export const Footer = ({ isLoading, footerButtons, onClose, onSubmit, checkboxInfo }) => {
|
|
5
|
+
export const Footer = ({ isLoading, footerButtons, onClose, onSubmit, checkboxInfo, dataId = '' }) => {
|
|
6
6
|
const [isSelected, setIsSelected] = React.useState((checkboxInfo === null || checkboxInfo === void 0 ? void 0 : checkboxInfo.isChecked) || false);
|
|
7
7
|
const handleSubmit = useCallback(() => {
|
|
8
8
|
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(isSelected);
|
|
@@ -11,5 +11,5 @@ export const Footer = ({ isLoading, footerButtons, onClose, onSubmit, checkboxIn
|
|
|
11
11
|
return null;
|
|
12
12
|
}
|
|
13
13
|
const { extraButton, confirm, cancel } = footerButtons;
|
|
14
|
-
return (_jsxs("div", { className: "side-sheet__footer", children: [checkboxInfo ? (_jsx("div", { className: "side-sheet__footer_checkbox", children: _jsx(Checkbox, { label: checkboxInfo.label, selectedValue: isSelected, onClick: setIsSelected }) })) : null, _jsxs("div", { className: "side-sheet__footer_buttons", children: [extraButton ? (_jsx(Button, Object.assign({ size: "large", type: "secondary" }, footerButtons.extraButton, { className: "mr-12" }))) : null, _jsx(Button, Object.assign({ type: "secondary", size: "large", className: "mr-12", onClick: onClose }, cancel)), _jsx(Button, Object.assign({ type: "primary", size: "large", onClick: handleSubmit, disabled: isLoading }, confirm))] })] }));
|
|
14
|
+
return (_jsxs("div", { className: "side-sheet__footer", "data-id": dataId ? `${dataId}-footer` : '', children: [checkboxInfo ? (_jsx("div", { className: "side-sheet__footer_checkbox", children: _jsx(Checkbox, { label: checkboxInfo.label, selectedValue: isSelected, onClick: setIsSelected, dataId: dataId ? `${dataId}-checkbox` : '' }) })) : null, _jsxs("div", { className: "side-sheet__footer_buttons", children: [extraButton ? (_jsx(Button, Object.assign({ size: "large", type: "secondary" }, footerButtons.extraButton, { className: "mr-12", dataId: dataId ? `${dataId}-extra` : '' }))) : null, _jsx(Button, Object.assign({ type: "secondary", size: "large", className: "mr-12", onClick: onClose }, cancel, { dataId: dataId ? `${dataId}-cancel` : '' })), _jsx(Button, Object.assign({ type: "primary", size: "large", onClick: handleSubmit, disabled: isLoading }, confirm, { dataId: dataId ? `${dataId}-confirm` : '' }))] })] }));
|
|
15
15
|
};
|
|
@@ -11,7 +11,7 @@ import { Footer } from './Footer/Footer';
|
|
|
11
11
|
import IconCaretUp from '../SVGIcons/IconCaretUp';
|
|
12
12
|
import IconDismissFilled from '../SVGIcons/IconDismissFilled';
|
|
13
13
|
export const SideSheet = (props) => {
|
|
14
|
-
const { size = 'small', isLoading, isOpen, onClose, onSubmit, title, position = 'right', shouldRemoveCallback, className = '', headerButtons, footerButtons, scrollToTopOptions, children, closeOnOutsideClick = true, checkboxInfo } = props;
|
|
14
|
+
const { size = 'small', isLoading, isOpen, onClose, onSubmit, title, position = 'right', shouldRemoveCallback, className = '', headerButtons, footerButtons, scrollToTopOptions, children, closeOnOutsideClick = true, checkboxInfo, dataId = '' } = props;
|
|
15
15
|
const [containerRef, setContainerRef] = useState(null);
|
|
16
16
|
const [isShownScrollIcon, setIsShownScrollIcon] = useState(false);
|
|
17
17
|
const scrollbarContainerRef = useRef(null);
|
|
@@ -42,7 +42,7 @@ export const SideSheet = (props) => {
|
|
|
42
42
|
});
|
|
43
43
|
}, []);
|
|
44
44
|
const isFromLeft = position === 'left';
|
|
45
|
-
return (_jsx(AnimatePresenceWrapper, { children: isOpen ? (_jsx(motion.div, { className: "side-sheet", initial: {
|
|
45
|
+
return (_jsx(AnimatePresenceWrapper, { children: isOpen ? (_jsx(motion.div, { className: "side-sheet", "data-id": dataId, initial: {
|
|
46
46
|
opacity: 0
|
|
47
47
|
}, animate: {
|
|
48
48
|
opacity: 1
|
|
@@ -54,5 +54,5 @@ export const SideSheet = (props) => {
|
|
|
54
54
|
}
|
|
55
55
|
}, transition: { duration: 0.2 }, children: _jsxs(motion.div, { initial: isFromLeft ? { left: '-100%' } : { right: '-100%' }, animate: isFromLeft ? { left: 0 } : { right: 0 }, exit: Object.assign(Object.assign({}, (isFromLeft ? { left: '-100%' } : { right: '-100%' })), { transition: {
|
|
56
56
|
duration: 0.5
|
|
57
|
-
} }), transition: { duration: 0.5 }, className: classnames('side-sheet__container', `side-sheet__${position}`, `side-sheet__container--${size}`, className), ref: setContainerRef, children: [_jsxs("div", { className: "side-sheet__header", children: [_jsxs("div", { className: "side-sheet__header__left pr-16", children: [(headerButtons === null || headerButtons === void 0 ? void 0 : headerButtons.back) ? (_jsx(Button, Object.assign({ size: "small", type: "tertiary" }, headerButtons.back, { className: "mr-8" }))) : null, _jsx(Text, { className: "side-sheet__title", weight: "bolder", lineHeight: "large", size: "medium", children: title })] }), _jsxs("div", { className: "side-sheet__header__right", children: [(headerButtons === null || headerButtons === void 0 ? void 0 : headerButtons.pin) ? (_jsx(Button, Object.assign({ size: "small", type: "tertiary" }, headerButtons.pin, { className: "mr-8" }))) : null, (headerButtons === null || headerButtons === void 0 ? void 0 : headerButtons.close) ? (_jsx(Button, Object.assign({ size: "small", type: "tertiary" }, headerButtons.close, { onClick: onClose }))) : (_jsx(Button, { size: "small", type: "tertiary", iconProps: { Component: IconDismissFilled }, onClick: onClose }))] }), isShownScrollIcon && (_jsx(Button, { size: "large", type: "secondary", iconProps: { Component: IconCaretUp }, className: `side-sheet__header__scroll-top side-sheet__header__scroll-top__${size}`, onClick: handleScrollToTop }))] }), _jsx("div", { className: "side-sheet__content scrollbar scrollbar--vertical", ref: scrollbarContainerRef, children: children }), _jsx(Footer, { footerButtons: footerButtons, isLoading: isLoading, onClose: onClose, onSubmit: onSubmit, checkboxInfo: checkboxInfo })] }) })) : null }));
|
|
57
|
+
} }), transition: { duration: 0.5 }, className: classnames('side-sheet__container', `side-sheet__${position}`, `side-sheet__container--${size}`, className), "data-id": dataId ? `${dataId}-container` : '', ref: setContainerRef, children: [_jsxs("div", { className: "side-sheet__header", children: [_jsxs("div", { className: "side-sheet__header__left pr-16", children: [(headerButtons === null || headerButtons === void 0 ? void 0 : headerButtons.back) ? (_jsx(Button, Object.assign({ size: "small", type: "tertiary" }, headerButtons.back, { className: "mr-8", dataId: dataId ? `${dataId}-back` : '' }))) : null, _jsx(Text, { className: "side-sheet__title", weight: "bolder", lineHeight: "large", size: "medium", dataId: dataId ? `${dataId}-title` : '', children: title })] }), _jsxs("div", { className: "side-sheet__header__right", children: [(headerButtons === null || headerButtons === void 0 ? void 0 : headerButtons.pin) ? (_jsx(Button, Object.assign({ size: "small", type: "tertiary" }, headerButtons.pin, { className: "mr-8", dataId: dataId ? `${dataId}-pin` : '' }))) : null, (headerButtons === null || headerButtons === void 0 ? void 0 : headerButtons.close) ? (_jsx(Button, Object.assign({ size: "small", type: "tertiary" }, headerButtons.close, { onClick: onClose, dataId: dataId ? `${dataId}-close` : '' }))) : (_jsx(Button, { size: "small", type: "tertiary", iconProps: { Component: IconDismissFilled }, onClick: onClose, dataId: dataId ? `${dataId}-close` : '' }))] }), isShownScrollIcon && (_jsx(Button, { size: "large", type: "secondary", iconProps: { Component: IconCaretUp }, className: `side-sheet__header__scroll-top side-sheet__header__scroll-top__${size}`, dataId: dataId ? `${dataId}-scroll-top` : '', onClick: handleScrollToTop }))] }), _jsx("div", { className: "side-sheet__content scrollbar scrollbar--vertical", "data-id": dataId ? `${dataId}-content` : '', ref: scrollbarContainerRef, children: children }), _jsx(Footer, { footerButtons: footerButtons, isLoading: isLoading, onClose: onClose, onSubmit: onSubmit, checkboxInfo: checkboxInfo, dataId: dataId })] }) })) : null }));
|
|
58
58
|
};
|
|
@@ -5,7 +5,7 @@ export type TCheckboxInfo = {
|
|
|
5
5
|
label: string;
|
|
6
6
|
isChecked: boolean;
|
|
7
7
|
};
|
|
8
|
-
export interface TSideSheetPropTypes {
|
|
8
|
+
export interface TSideSheetPropTypes extends IBaseProps {
|
|
9
9
|
closeOnOutsideClick?: boolean;
|
|
10
10
|
shouldRemoveCallback?: boolean;
|
|
11
11
|
size?: TSideSheetSize;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
export type TSkeletonVariant = 'text' | 'circular' | 'rectangular' | 'rounded';
|
|
3
3
|
export type TSkeletonAnimation = 'pulse' | 'wave' | 'none';
|
|
4
|
-
export interface TSkeletonPropTypes {
|
|
4
|
+
export interface TSkeletonPropTypes extends IBaseProps {
|
|
5
5
|
/** Visual shape of the placeholder. */
|
|
6
6
|
variant?: TSkeletonVariant;
|
|
7
7
|
/** Animation style. Pass `'none'` to disable. */
|
|
@@ -20,5 +20,4 @@ export interface TSkeletonPropTypes {
|
|
|
20
20
|
/** Inline style overrides applied to every rendered skeleton element. */
|
|
21
21
|
style?: CSSProperties;
|
|
22
22
|
className?: string;
|
|
23
|
-
dataId?: string;
|
|
24
23
|
}
|
|
@@ -8,11 +8,11 @@ var StatusTextSize;
|
|
|
8
8
|
StatusTextSize["small"] = "xsmall";
|
|
9
9
|
})(StatusTextSize || (StatusTextSize = {}));
|
|
10
10
|
export const Status = (props) => {
|
|
11
|
-
const { type = 'primary', size = 'large', text = '', children, className = '', leftIconProps, rightIconProps, withCircle = true, withBackground = false, dataId } = props;
|
|
12
|
-
return (_jsxs("div", { className: classNames(`status status--${size}`, className, {
|
|
11
|
+
const { type = 'primary', size = 'large', text = '', children, className = '', leftIconProps, rightIconProps, withCircle = true, withBackground = false, dataId = '' } = props;
|
|
12
|
+
return (_jsxs("div", { "data-id": dataId, className: classNames(`status status--${size}`, className, {
|
|
13
13
|
status__withBackground: withBackground,
|
|
14
14
|
[`status__withBackground--${type}`]: withBackground
|
|
15
15
|
}), children: [withCircle ? (_jsx("span", { className: classNames('status__circle', 'mr-6', {
|
|
16
16
|
[`status__circle--${type}`]: true
|
|
17
|
-
}) })) : null, (leftIconProps === null || leftIconProps === void 0 ? void 0 : leftIconProps.Component) ? (_jsx(leftIconProps.Component, Object.assign({ size: "xsmall", type: type, className: "mr-6" }, leftIconProps))) : null, _jsxs("div", { className: "status__label", children: [_jsx(Text, { className: "status__label-text", dataId: `${dataId}-text
|
|
17
|
+
}) })) : null, (leftIconProps === null || leftIconProps === void 0 ? void 0 : leftIconProps.Component) ? (_jsx(leftIconProps.Component, Object.assign({ size: "xsmall", type: type, className: "mr-6" }, leftIconProps))) : null, _jsxs("div", { className: "status__label", children: [_jsx(Text, { className: "status__label-text", dataId: dataId ? `${dataId}-text` : '', weight: withBackground ? 'semibold' : 'regular', type: !withCircle || withBackground ? type : 'primary', size: StatusTextSize[size], children: text }), children] }), rightIconProps] }));
|
|
18
18
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
3
|
export const Stepper = (props) => {
|
|
4
|
-
const { list, activeStep = 0, setActiveStep } = props;
|
|
4
|
+
const { list, activeStep = 0, setActiveStep, dataId = '' } = props;
|
|
5
5
|
const [activeStepIndex, setActiveStepIndex] = useState(activeStep);
|
|
6
6
|
const decreaseStepIndex = () => {
|
|
7
7
|
let newIndex = activeStepIndex;
|
|
@@ -25,5 +25,5 @@ export const Stepper = (props) => {
|
|
|
25
25
|
}
|
|
26
26
|
}, [activeStep, activeStepIndex]);
|
|
27
27
|
const Content = list[activeStepIndex];
|
|
28
|
-
return (_jsx(Content, { activeStepIndex: activeStepIndex, isNextDisabled: activeStepIndex === list.length - 1, isPrevDisabled: activeStepIndex === 0, prevHandler: decreaseStepIndex, nextHandler: increaseStepIndex, stepCount: list.length }));
|
|
28
|
+
return (_jsx(Content, { activeStepIndex: activeStepIndex, isNextDisabled: activeStepIndex === list.length - 1, isPrevDisabled: activeStepIndex === 0, prevHandler: decreaseStepIndex, nextHandler: increaseStepIndex, stepCount: list.length, dataId: dataId ? `${dataId}-step-${activeStepIndex}` : '' }));
|
|
29
29
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export interface TStepperContentWrapperProps {
|
|
1
|
+
export interface TStepperContentWrapperProps extends IBaseProps {
|
|
2
2
|
isPrevDisabled: boolean;
|
|
3
3
|
isNextDisabled: boolean;
|
|
4
4
|
prevHandler: () => void;
|
|
@@ -7,7 +7,7 @@ export interface TStepperContentWrapperProps {
|
|
|
7
7
|
stepCount: number;
|
|
8
8
|
}
|
|
9
9
|
declare type TComp = (props: TStepperContentWrapperProps) => React.ReactElement;
|
|
10
|
-
export interface TStepperProps {
|
|
10
|
+
export interface TStepperProps extends IBaseProps {
|
|
11
11
|
list: TComp[];
|
|
12
12
|
activeStep?: number;
|
|
13
13
|
setActiveStep?: (step: number) => void;
|
package/components/Tab/Tab.js
CHANGED
|
@@ -13,8 +13,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
13
13
|
import { TabItem } from './TabItem';
|
|
14
14
|
import classNames from 'classnames';
|
|
15
15
|
export const Tab = (props) => {
|
|
16
|
-
const { selectedValue, tabItems, onSelect, className } = props, rest = __rest(props, ["selectedValue", "tabItems", "onSelect", "className"]);
|
|
17
|
-
return (_jsx("div", { className: "tabs-container", children: _jsx("div", { className: classNames('tabs-header-container', className), children: tabItems.map((tabInfo) => {
|
|
18
|
-
return (_jsx(TabItem, Object.assign({ label: tabInfo.label, badgeProps: tabInfo.badgeProps, onClick: () => onSelect(tabInfo.value), val: tabInfo.value, isSelected: selectedValue === tabInfo.value, dataId: (tabInfo === null || tabInfo === void 0 ? void 0 : tabInfo.dataId) || '', disabled: tabInfo.disabled }, rest), tabInfo.value));
|
|
16
|
+
const { selectedValue, tabItems, onSelect, className, dataId = '' } = props, rest = __rest(props, ["selectedValue", "tabItems", "onSelect", "className", "dataId"]);
|
|
17
|
+
return (_jsx("div", { className: "tabs-container", "data-id": dataId, children: _jsx("div", { className: classNames('tabs-header-container', className), children: tabItems.map((tabInfo, index) => {
|
|
18
|
+
return (_jsx(TabItem, Object.assign({ label: tabInfo.label, badgeProps: tabInfo.badgeProps, onClick: () => onSelect(tabInfo.value), val: tabInfo.value, isSelected: selectedValue === tabInfo.value, dataId: (tabInfo === null || tabInfo === void 0 ? void 0 : tabInfo.dataId) || (dataId ? `${dataId}-item-${index}` : ''), disabled: tabInfo.disabled }, rest), tabInfo.value));
|
|
19
19
|
}) }) }));
|
|
20
20
|
};
|
|
@@ -4,7 +4,7 @@ import { noop } from '../../utils/helpers';
|
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
export const TabItem = (props) => {
|
|
6
6
|
const { size = 'large', iconProps, badgeProps, label, className = '', disabled = false, isSelected, rightIconProps, val, onClick, dataId } = props;
|
|
7
|
-
return (_jsxs("div", { onClick: disabled ? noop : onClick, className: classNames('tab', { [`tab--${size}`]: size }, { 'tab--disabled': disabled }, { 'tab--selected': isSelected }, className), children: [(iconProps === null || iconProps === void 0 ? void 0 : iconProps.Component) ? (_jsx(iconProps.Component, Object.assign({ className: "tab__icon mr-8", size: `${size == 'small' ? 'xsmall' : 'small'}` }, iconProps))) : null, _jsx("span", { className: "tab__label", "data-id": dataId, children: label }), (rightIconProps === null || rightIconProps === void 0 ? void 0 : rightIconProps.Component) ? (_jsx(rightIconProps.Component, Object.assign({ onClick: (e) => {
|
|
7
|
+
return (_jsxs("div", { "data-id": dataId, onClick: disabled ? noop : onClick, className: classNames('tab', { [`tab--${size}`]: size }, { 'tab--disabled': disabled }, { 'tab--selected': isSelected }, className), children: [(iconProps === null || iconProps === void 0 ? void 0 : iconProps.Component) ? (_jsx(iconProps.Component, Object.assign({ className: "tab__icon mr-8", size: `${size == 'small' ? 'xsmall' : 'small'}` }, iconProps))) : null, _jsx("span", { className: "tab__label", "data-id": dataId ? `${dataId}-label` : '', children: label }), (rightIconProps === null || rightIconProps === void 0 ? void 0 : rightIconProps.Component) ? (_jsx(rightIconProps.Component, Object.assign({ onClick: (e) => {
|
|
8
8
|
if (rightIconProps === null || rightIconProps === void 0 ? void 0 : rightIconProps.action) {
|
|
9
9
|
e.stopPropagation();
|
|
10
10
|
rightIconProps === null || rightIconProps === void 0 ? void 0 : rightIconProps.action(val);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { TBadgeProps } from '../Badge/types';
|
|
2
|
-
export type TTabItem = {
|
|
2
|
+
export type TTabItem = IBaseProps & {
|
|
3
3
|
value: number | string;
|
|
4
4
|
label: string | React.ReactElement;
|
|
5
|
-
dataId?: string;
|
|
6
5
|
disabled?: boolean;
|
|
7
6
|
badgeProps?: TBadgeProps;
|
|
8
7
|
iconProps?: {
|
|
@@ -25,8 +24,7 @@ export interface TTabProps extends IFormCompProps {
|
|
|
25
24
|
selectedValue: number | string;
|
|
26
25
|
onSelect: (value: string | number) => void;
|
|
27
26
|
}
|
|
28
|
-
export type TTabItemProps = {
|
|
29
|
-
dataId?: string;
|
|
27
|
+
export type TTabItemProps = IBaseProps & {
|
|
30
28
|
label?: string | React.ReactElement;
|
|
31
29
|
size?: 'large' | 'medium' | 'small';
|
|
32
30
|
className?: string;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { HeaderGroup } from 'react-table';
|
|
3
|
-
type Props = {
|
|
3
|
+
type Props = IBaseProps & {
|
|
4
4
|
fixedHeader?: boolean;
|
|
5
5
|
withSelect: boolean;
|
|
6
6
|
tableWidth: number;
|
|
7
7
|
headerGroup: HeaderGroup;
|
|
8
8
|
uniqueKey: string;
|
|
9
9
|
};
|
|
10
|
-
export declare function Header({ headerGroup, tableWidth, withSelect, uniqueKey, fixedHeader }: Props): ReactElement;
|
|
10
|
+
export declare function Header({ headerGroup, tableWidth, withSelect, uniqueKey, fixedHeader, dataId }: Props): ReactElement;
|
|
11
11
|
export {};
|
|
@@ -15,7 +15,7 @@ import { calcColumnWidth, CHECKBOX_DEFAULT_WIDTH, CHECKBOX_HEADER_ID } from './u
|
|
|
15
15
|
import { Text } from '../Text';
|
|
16
16
|
import IconArrowDown from '../SVGIcons/IconArrowDown';
|
|
17
17
|
import IconArrowUp from '../SVGIcons/IconArrowUp';
|
|
18
|
-
export function Header({ headerGroup, tableWidth, withSelect, uniqueKey, fixedHeader = false }) {
|
|
18
|
+
export function Header({ headerGroup, tableWidth, withSelect, uniqueKey, fixedHeader = false, dataId = '' }) {
|
|
19
19
|
const _a = headerGroup.getHeaderGroupProps(), { key: keyheaderGroup } = _a, headerGroupProps = __rest(_a, ["key"]);
|
|
20
20
|
return (_jsx("tr", Object.assign({}, headerGroupProps, { className: classNames({ fixed_header: fixedHeader }), children: headerGroup.headers.map(({ id, minWidth, maxWidth, width, widthInPercent, getHeaderProps, fixed, columnProps, render, isSorted, isSortedDesc, getSortByToggleProps }, i, arr) => {
|
|
21
21
|
var _a;
|
|
@@ -24,7 +24,7 @@ export function Header({ headerGroup, tableWidth, withSelect, uniqueKey, fixedHe
|
|
|
24
24
|
? CHECKBOX_DEFAULT_WIDTH
|
|
25
25
|
: calcColumnWidth(widthInPercent, tableWidth), left: !isSelection && withSelect && fixed === 'left' ? CHECKBOX_DEFAULT_WIDTH : 0 }, (!isSelection && minWidth ? { minWidth } : {})), (!isSelection && maxWidth ? { maxWidth } : {})), (!isSelection && width ? { width } : {}));
|
|
26
26
|
const _b = getHeaderProps((columnProps === null || columnProps === void 0 ? void 0 : columnProps.sortable) ? getSortByToggleProps() : undefined), { key: keyHead } = _b, headProps = __rest(_b, ["key"]);
|
|
27
|
-
return (_jsx("th", Object.assign({}, headProps, { className: classNames({
|
|
27
|
+
return (_jsx("th", Object.assign({}, headProps, { "data-id": dataId ? `${dataId}-header-${id !== null && id !== void 0 ? id : i}` : '', className: classNames({
|
|
28
28
|
fixed_column_left: fixed === 'left',
|
|
29
29
|
fixed_column_right: fixed === 'right',
|
|
30
30
|
fixed_checkbox: isSelection && ((_a = arr[i + 1]) === null || _a === void 0 ? void 0 : _a.fixed) === 'left',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
export declare const IndeterminateCheckbox: React.ForwardRefExoticComponent<IBaseProps & {
|
|
3
3
|
indeterminate: boolean;
|
|
4
4
|
checked: boolean;
|
|
5
5
|
disabled: boolean;
|
|
@@ -8,6 +8,4 @@ type IndeterminateCheckboxProps = {
|
|
|
8
8
|
checked: boolean;
|
|
9
9
|
};
|
|
10
10
|
}) => void;
|
|
11
|
-
}
|
|
12
|
-
export declare const IndeterminateCheckbox: React.ForwardRefExoticComponent<IndeterminateCheckboxProps & React.RefAttributes<HTMLInputElement>>;
|
|
13
|
-
export {};
|
|
11
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useEffect, useRef } from 'react';
|
|
3
3
|
import { Checkbox } from '../Checkbox';
|
|
4
|
-
export const IndeterminateCheckbox = forwardRef(({ indeterminate, checked, onChange, disabled = false }, ref) => {
|
|
4
|
+
export const IndeterminateCheckbox = forwardRef(({ indeterminate, checked, onChange, disabled = false, dataId = '' }, ref) => {
|
|
5
5
|
const defaultRef = useRef(null);
|
|
6
6
|
const resolvedRef = ref || defaultRef;
|
|
7
7
|
useEffect(() => {
|
|
@@ -10,6 +10,6 @@ export const IndeterminateCheckbox = forwardRef(({ indeterminate, checked, onCha
|
|
|
10
10
|
const handleChange = (v) => {
|
|
11
11
|
onChange({ target: { checked: v } });
|
|
12
12
|
};
|
|
13
|
-
return (_jsx(Checkbox, { disabled: disabled, value: checked, onClick: handleChange, ref: resolvedRef, stopPropagation: true }));
|
|
13
|
+
return (_jsx(Checkbox, { disabled: disabled, value: checked, onClick: handleChange, ref: resolvedRef, dataId: dataId, stopPropagation: true }));
|
|
14
14
|
});
|
|
15
15
|
IndeterminateCheckbox.displayName = 'IndeterminateCheckbox';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { Row as RowType } from 'react-table';
|
|
3
|
-
type Props = {
|
|
3
|
+
type Props = IBaseProps & {
|
|
4
4
|
row: RowType;
|
|
5
5
|
handleRowClick?: (row: any) => void;
|
|
6
6
|
withSelect: boolean;
|
|
7
7
|
selectedFlatRows: RowType[];
|
|
8
8
|
uniqueKey: string;
|
|
9
9
|
};
|
|
10
|
-
export declare function Row({ row, selectedFlatRows, withSelect, uniqueKey, handleRowClick }: Props): ReactElement;
|
|
10
|
+
export declare function Row({ row, selectedFlatRows, withSelect, uniqueKey, handleRowClick, dataId }: Props): ReactElement;
|
|
11
11
|
export {};
|
package/components/Table/Row.js
CHANGED
|
@@ -13,19 +13,19 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
13
13
|
import { useMemo } from 'react';
|
|
14
14
|
import classNames from 'classnames';
|
|
15
15
|
import { CHECKBOX_DEFAULT_WIDTH, CHECKBOX_HEADER_ID } from './utils';
|
|
16
|
-
export function Row({ row, selectedFlatRows, withSelect, uniqueKey, handleRowClick }) {
|
|
16
|
+
export function Row({ row, selectedFlatRows, withSelect, uniqueKey, handleRowClick, dataId = '' }) {
|
|
17
17
|
const isRowSelected = useMemo(() => selectedFlatRows.find((r) => r.id === row.id), [selectedFlatRows]);
|
|
18
18
|
const _a = row.getRowProps(), { key: keyRow } = _a, rowProps = __rest(_a, ["key"]);
|
|
19
|
-
return (_jsx("tr", Object.assign({}, rowProps, { className: classNames({ selected: Boolean(isRowSelected) }), onClick: () => handleRowClick === null || handleRowClick === void 0 ? void 0 : handleRowClick(row.original), children: row.cells.map(({ getCellProps, column, render }, i, arr) => {
|
|
20
|
-
var _a;
|
|
19
|
+
return (_jsx("tr", Object.assign({}, rowProps, { "data-id": dataId ? `${dataId}-row-${row.index}` : '', className: classNames({ selected: Boolean(isRowSelected) }), onClick: () => handleRowClick === null || handleRowClick === void 0 ? void 0 : handleRowClick(row.original), children: row.cells.map(({ getCellProps, column, render }, i, arr) => {
|
|
20
|
+
var _a, _b;
|
|
21
21
|
const isSelection = column.id === CHECKBOX_HEADER_ID;
|
|
22
|
-
const
|
|
23
|
-
return (_jsx("td", Object.assign({}, cellProps, { style: {
|
|
22
|
+
const _c = getCellProps(), { key: keycell } = _c, cellProps = __rest(_c, ["key"]);
|
|
23
|
+
return (_jsx("td", Object.assign({}, cellProps, { "data-id": dataId ? `${dataId}-row-${row.index}-cell-${(_a = column.id) !== null && _a !== void 0 ? _a : i}` : '', style: {
|
|
24
24
|
left: !isSelection && withSelect && (column === null || column === void 0 ? void 0 : column.fixed) === 'left' ? CHECKBOX_DEFAULT_WIDTH : 0
|
|
25
25
|
}, className: classNames({
|
|
26
26
|
fixed_column_left: (column === null || column === void 0 ? void 0 : column.fixed) === 'left',
|
|
27
27
|
fixed_column_right: (column === null || column === void 0 ? void 0 : column.fixed) === 'right',
|
|
28
|
-
fixed_checkbox: isSelection && ((
|
|
28
|
+
fixed_checkbox: isSelection && ((_b = arr[i + 1].column) === null || _b === void 0 ? void 0 : _b.fixed) === 'left'
|
|
29
29
|
}), onClick: (event) => {
|
|
30
30
|
if (isSelection)
|
|
31
31
|
event.stopPropagation();
|