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
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
export const Image = (props) => {
|
|
3
|
-
const { name, imagePath = 'static/media/src/assets/images/image-placeholder.png', isBackgroundImage, backgroundSize, className = '', isFullWidth, isFullHeight, ratio } = props;
|
|
4
|
-
return isBackgroundImage ? (_jsx("div", { className: `image image--bg ${className}`, style: {
|
|
3
|
+
const { name, imagePath = 'static/media/src/assets/images/image-placeholder.png', isBackgroundImage, backgroundSize, className = '', isFullWidth, isFullHeight, ratio, dataId = '' } = props;
|
|
4
|
+
return isBackgroundImage ? (_jsx("div", { "data-id": dataId, className: `image image--bg ${className}`, style: {
|
|
5
5
|
backgroundImage: `${imagePath ? `url(${imagePath})` : ''}`,
|
|
6
6
|
backgroundSize: backgroundSize,
|
|
7
7
|
aspectRatio: ratio
|
|
8
|
-
} })) : (_jsx("img", { className: `image ${className}`, src: imagePath, alt: name, style: {
|
|
8
|
+
} })) : (_jsx("img", { "data-id": dataId, className: `image ${className}`, src: imagePath, alt: name, style: {
|
|
9
9
|
aspectRatio: ratio,
|
|
10
10
|
width: isFullWidth ? '100%' : '',
|
|
11
11
|
height: isFullHeight ? '100%' : ''
|
|
@@ -3,18 +3,18 @@ import classNames from 'classnames';
|
|
|
3
3
|
import { Text } from '../Text';
|
|
4
4
|
import { Divider } from '../Divider';
|
|
5
5
|
import { generateLinePath, formatWithDots } from './helper';
|
|
6
|
-
export const LineChart = ({ data }) => {
|
|
6
|
+
export const LineChart = ({ data, dataId = '' }) => {
|
|
7
7
|
const linePathes = generateLinePath(data);
|
|
8
8
|
let percent = 0;
|
|
9
|
-
return (_jsxs("div", { children: [_jsx("div", { className: "bar", children: linePathes.map(({ percentage, color }, i) => {
|
|
9
|
+
return (_jsxs("div", { "data-id": dataId, children: [_jsx("div", { className: "bar", children: linePathes.map(({ percentage, color }, i) => {
|
|
10
10
|
const start = percent;
|
|
11
11
|
const end = start + percentage;
|
|
12
12
|
percent = end;
|
|
13
|
-
return (_jsx("div", { className: classNames('bar__segment', `bar__segment--color-${color}`, {
|
|
13
|
+
return (_jsx("div", { "data-id": dataId ? `${dataId}-segment-${i}` : '', className: classNames('bar__segment', `bar__segment--color-${color}`, {
|
|
14
14
|
'bar__segment--first': i === 0,
|
|
15
15
|
'bar__segment--last': i === linePathes.length - 1
|
|
16
16
|
}), style: {
|
|
17
17
|
flexBasis: `${percentage}%`
|
|
18
18
|
} }, `line-chart-segment-${i}`));
|
|
19
|
-
}) }), _jsx("div", { className: "line-chart-status", children: linePathes.map(({ label, dataCurrency, color, quantity, isHidden }, i) => !isHidden && (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flexbox justify-content--between pt-6 pb-6", children: [_jsxs("div", { className: "flexbox align-items--center", children: [_jsx("span", { className: classNames('status__circle', `status__circle--${color}`) }), _jsx(Text, { type: "tertiary", children: label })] }), _jsx("div", { children: _jsxs(Text, { children: [formatWithDots(quantity), " ", dataCurrency] }) })] }, `line-chart-status-${i}`), i !== linePathes.length - 1 && (_jsx(Divider, { type: "primary", isHorizontal: true, color: "grey" }))] }))) })] }));
|
|
19
|
+
}) }), _jsx("div", { className: "line-chart-status", children: linePathes.map(({ label, dataCurrency, color, quantity, isHidden }, i) => !isHidden && (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flexbox justify-content--between pt-6 pb-6", "data-id": dataId ? `${dataId}-item-${i}` : '', children: [_jsxs("div", { className: "flexbox align-items--center", children: [_jsx("span", { className: classNames('status__circle', `status__circle--${color}`) }), _jsx(Text, { type: "tertiary", dataId: dataId ? `${dataId}-label-${i}` : '', children: label })] }), _jsx("div", { children: _jsxs(Text, { dataId: dataId ? `${dataId}-value-${i}` : '', children: [formatWithDots(quantity), " ", dataCurrency] }) })] }, `line-chart-status-${i}`), i !== linePathes.length - 1 && (_jsx(Divider, { type: "primary", isHorizontal: true, color: "grey" }))] }))) })] }));
|
|
20
20
|
};
|
|
@@ -9,6 +9,6 @@ export type TLineChartDataItem = {
|
|
|
9
9
|
export interface TLineChartDataItemWithPercentage extends TLineChartDataItem {
|
|
10
10
|
percentage: number;
|
|
11
11
|
}
|
|
12
|
-
export type TLineChartProps = {
|
|
12
|
+
export type TLineChartProps = IBaseProps & {
|
|
13
13
|
data: Array<TLineChartDataItem>;
|
|
14
14
|
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
type TLinkTypes = 'primary' | 'secondary' | 'tertiary' | 'disabled' | 'inverse' | 'selected' | 'brand' | 'danger' | 'warning' | 'success' | 'information' | 'discovery';
|
|
2
|
-
export interface LinkPropTypes {
|
|
2
|
+
export interface LinkPropTypes extends IBaseProps {
|
|
3
3
|
children?: string | React.ReactElement;
|
|
4
4
|
className?: string;
|
|
5
5
|
type?: TLinkTypes;
|
|
6
6
|
url?: string;
|
|
7
|
-
dataId?: string;
|
|
8
7
|
target?: string;
|
|
9
8
|
beforeLink?: string | React.ReactElement;
|
|
10
9
|
afterLink?: string | React.ReactElement;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
export type TMenuItem = {
|
|
2
|
+
export type TMenuItem = IBaseProps & {
|
|
3
3
|
label: TItemLabel;
|
|
4
4
|
value: TItemValue;
|
|
5
5
|
iconProps?: TSelectIconProps;
|
|
6
6
|
handler?: TCallBackFn;
|
|
7
7
|
disabled?: boolean;
|
|
8
|
-
dataId?: string;
|
|
9
8
|
meta?: string;
|
|
10
9
|
};
|
|
11
10
|
export type TMenuProps = {
|
package/components/More/More.js
CHANGED
|
@@ -6,7 +6,7 @@ export const More = (props) => {
|
|
|
6
6
|
const { textProps = {}, expandedText, collapsedText, buttonText = {
|
|
7
7
|
expand: 'Ավելին',
|
|
8
8
|
collapse: 'Փակել'
|
|
9
|
-
} } = props;
|
|
9
|
+
}, dataId = '' } = props;
|
|
10
10
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
11
11
|
const expand = (e) => {
|
|
12
12
|
e.stopPropagation();
|
|
@@ -16,5 +16,5 @@ export const More = (props) => {
|
|
|
16
16
|
e.stopPropagation();
|
|
17
17
|
setIsExpanded(false);
|
|
18
18
|
};
|
|
19
|
-
return (_jsxs(Text, Object.assign({}, textProps, { className: 'more', children: [`${isExpanded ? expandedText : collapsedText}`, _jsx(Button, { className: 'more__btn ml-4', type: "link", buttonText: isExpanded ? buttonText.collapse : buttonText.expand, onClick: isExpanded ? collapse : expand })] })));
|
|
19
|
+
return (_jsxs(Text, Object.assign({}, textProps, { className: 'more', dataId: dataId, children: [`${isExpanded ? expandedText : collapsedText}`, _jsx(Button, { className: 'more__btn ml-4', type: "link", buttonText: isExpanded ? buttonText.collapse : buttonText.expand, dataId: dataId ? `${dataId}-action` : '', onClick: isExpanded ? collapse : expand })] })));
|
|
20
20
|
};
|
|
@@ -7,12 +7,12 @@ import IconChevronLeft from '../SVGIcons/IconChevronLeft';
|
|
|
7
7
|
import IconMore from '../SVGIcons/IconMore';
|
|
8
8
|
import { ICON_SIZE_MAPPING } from './consts';
|
|
9
9
|
export const Pagination = (props) => {
|
|
10
|
-
const { totalCount, handleChangePage, classname = '', size = 'large', pageSize, disableInitialCallback = false, page, breakLabel = _jsx(IconMore, { size: ICON_SIZE_MAPPING[size] }), labels = {
|
|
11
|
-
previous: _jsx(IconChevronLeft, { size: ICON_SIZE_MAPPING[size] }),
|
|
12
|
-
next: _jsx(IconChevronRight, { size: ICON_SIZE_MAPPING[size] })
|
|
10
|
+
const { totalCount, handleChangePage, classname = '', size = 'large', pageSize, disableInitialCallback = false, page, dataId = '', breakLabel = (_jsx(IconMore, { size: ICON_SIZE_MAPPING[size], dataId: dataId ? `${dataId}-more` : '' })), labels = {
|
|
11
|
+
previous: (_jsx(IconChevronLeft, { size: ICON_SIZE_MAPPING[size], dataId: dataId ? `${dataId}-prev` : '' })),
|
|
12
|
+
next: (_jsx(IconChevronRight, { size: ICON_SIZE_MAPPING[size], dataId: dataId ? `${dataId}-next` : '' }))
|
|
13
13
|
} } = props;
|
|
14
14
|
const handlePageChange = ({ selected }) => {
|
|
15
15
|
handleChangePage(selected + 1);
|
|
16
16
|
};
|
|
17
|
-
return (_jsx("div", { className: "pagination-wrapper flexbox", children: _jsx(ReactPaginate, Object.assign({ pageCount: Math.ceil(totalCount / pageSize), disableInitialCallback: disableInitialCallback, pageRangeDisplayed: PAGE_RANGE_DISPLAYED, marginPagesDisplayed: 1, onPageChange: handlePageChange, containerClassName: classNames(`pagination pagination--${size}`, classname), activeClassName: 'active', previousLabel: labels === null || labels === void 0 ? void 0 : labels.previous, nextLabel: labels === null || labels === void 0 ? void 0 : labels.next, breakClassName: "pagination__more", breakLinkClassName: "pagination__more__link", breakLabel: breakLabel }, (page ? { forcePage: page - 1 } : {}))) }));
|
|
17
|
+
return (_jsx("div", { className: "pagination-wrapper flexbox", "data-id": dataId, children: _jsx(ReactPaginate, Object.assign({ pageCount: Math.ceil(totalCount / pageSize), disableInitialCallback: disableInitialCallback, pageRangeDisplayed: PAGE_RANGE_DISPLAYED, marginPagesDisplayed: 1, onPageChange: handlePageChange, containerClassName: classNames(`pagination pagination--${size}`, classname), activeClassName: 'active', previousLabel: labels === null || labels === void 0 ? void 0 : labels.previous, nextLabel: labels === null || labels === void 0 ? void 0 : labels.next, breakClassName: "pagination__more", breakLinkClassName: "pagination__more__link", breakLabel: breakLabel }, (page ? { forcePage: page - 1 } : {}))) }));
|
|
18
18
|
};
|
|
@@ -5,12 +5,12 @@ var CIRCLE_SIZES;
|
|
|
5
5
|
CIRCLE_SIZES[CIRCLE_SIZES["large"] = 45] = "large";
|
|
6
6
|
})(CIRCLE_SIZES || (CIRCLE_SIZES = {}));
|
|
7
7
|
export const Progress = (props) => {
|
|
8
|
-
const { percent, stepCount, currentStep, type = 'linear', size = 'large', noText = false, dimension, className = '', loop = false } = props;
|
|
8
|
+
const { percent, stepCount, currentStep, type = 'linear', size = 'large', noText = false, dimension, className = '', loop = false, dataId = '' } = props;
|
|
9
9
|
const _dimension = dimension ? dimension : CIRCLE_SIZES[size];
|
|
10
10
|
const r = _dimension - 5;
|
|
11
11
|
const _percent = stepCount && currentStep ? (currentStep / stepCount) * 100 : percent;
|
|
12
12
|
const strokeDasharray = `${2 * r * 3.14}px`;
|
|
13
|
-
return (_jsxs("div", { className: `progress-bar progress-bar--${type} progress-bar--${size} ${className}${loop ? ' progress-bar--loop' : ''}`, style: type == 'circle'
|
|
13
|
+
return (_jsxs("div", { "data-id": dataId, className: `progress-bar progress-bar--${type} progress-bar--${size} ${className}${loop ? ' progress-bar--loop' : ''}`, style: type == 'circle'
|
|
14
14
|
? {
|
|
15
15
|
width: 2 * _dimension,
|
|
16
16
|
height: 2 * _dimension
|
|
@@ -18,5 +18,5 @@ export const Progress = (props) => {
|
|
|
18
18
|
: {}, children: [type == 'circle' ? (_jsxs("svg", { children: [_jsx("circle", { cx: _dimension, cy: _dimension, r: r }), _jsx("circle", { cx: _dimension, cy: _dimension, r: r, style: {
|
|
19
19
|
strokeDasharray,
|
|
20
20
|
strokeDashoffset: `calc(${strokeDasharray} - (${strokeDasharray} * ${_percent}) / 100)`
|
|
21
|
-
} })] })) : (_jsx("div", { className: "progress-bar__inner", children: _jsx("div", { className: "progress-bar__filled", style: { width: `${_percent}%` } }) })), !noText ? (_jsx("span", { className: "progress-bar__percent", children: stepCount ? `${currentStep}/${stepCount}` : `${percent}%` })) : null] }));
|
|
21
|
+
} })] })) : (_jsx("div", { className: "progress-bar__inner", children: _jsx("div", { className: "progress-bar__filled", style: { width: `${_percent}%` } }) })), !noText ? (_jsx("span", { className: "progress-bar__percent", "data-id": dataId ? `${dataId}-text` : '', children: stepCount ? `${currentStep}/${stepCount}` : `${percent}%` })) : null] }));
|
|
22
22
|
};
|
|
@@ -2,9 +2,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import classnames from 'classnames';
|
|
3
3
|
import { Step } from './Step';
|
|
4
4
|
export const ProgressStep = (props) => {
|
|
5
|
-
const { steps, stepType, activeStep, setActiveStep, stepSize = 'large', stepDirection = 'horizontal' } = props;
|
|
5
|
+
const { steps, stepType, activeStep, setActiveStep, stepSize = 'large', stepDirection = 'horizontal', dataId = '' } = props;
|
|
6
6
|
const singleStepWidth = `${100 / steps.length}%`;
|
|
7
|
-
return (_jsx("div", { className: classnames('progress-stepper', `progress-stepper--${stepDirection}`), children: steps.map((step, index) => {
|
|
8
|
-
return (_jsx(Step, { width: stepDirection == 'horizontal' ? singleStepWidth : '100%', step: step, index: index + 1, activeStep: activeStep, onStepClick: setActiveStep, stepType: stepType, stepSize: stepSize }, step.value));
|
|
7
|
+
return (_jsx("div", { className: classnames('progress-stepper', `progress-stepper--${stepDirection}`), "data-id": dataId, children: steps.map((step, index) => {
|
|
8
|
+
return (_jsx(Step, { width: stepDirection == 'horizontal' ? singleStepWidth : '100%', step: step, index: index + 1, activeStep: activeStep, onStepClick: setActiveStep, stepType: stepType, stepSize: stepSize, dataId: dataId ? `${dataId}-item-${index}` : '' }, step.value));
|
|
9
9
|
}) }));
|
|
10
10
|
};
|
|
@@ -7,7 +7,7 @@ import { PROGRESS_STATUSES } from './consts';
|
|
|
7
7
|
import IconDismissCircle from '../SVGIcons/IconDismissCircle';
|
|
8
8
|
import IconCheckmarkCircle from '../SVGIcons/IconCheckmarkCircle';
|
|
9
9
|
export const Step = (props) => {
|
|
10
|
-
const { width, step, stepSize = 'large', index, activeStep, stepType, onStepClick } = props;
|
|
10
|
+
const { width, step, stepSize = 'large', index, activeStep, stepType, onStepClick, dataId = '' } = props;
|
|
11
11
|
const { label, subText, value, status } = step;
|
|
12
12
|
const isActive = activeStep === value;
|
|
13
13
|
const isCompleted = status === PROGRESS_STATUSES.completed;
|
|
@@ -29,7 +29,7 @@ export const Step = (props) => {
|
|
|
29
29
|
};
|
|
30
30
|
const stepItemContent = useMemo(() => {
|
|
31
31
|
if (stepType === StepTypes.number) {
|
|
32
|
-
return (_jsx(Text, { type: textType, size: stepSize == 'large' ? 'medium' : 'small', weight: stepSize == 'large' ? 'semibold' : 'regular', children: `${index}` }));
|
|
32
|
+
return (_jsx(Text, { type: textType, size: stepSize == 'large' ? 'medium' : 'small', weight: stepSize == 'large' ? 'semibold' : 'regular', dataId: dataId ? `${dataId}-number` : '', children: `${index}` }));
|
|
33
33
|
}
|
|
34
34
|
if (stepType === StepTypes.dot) {
|
|
35
35
|
if (isActive) {
|
|
@@ -38,17 +38,17 @@ export const Step = (props) => {
|
|
|
38
38
|
if (isCompleted) {
|
|
39
39
|
const iconSize = stepSize == 'large' ? 'small' : 'xsmall';
|
|
40
40
|
if (isRejected) {
|
|
41
|
-
return _jsx(IconDismissCircle, { size: iconSize, type: "inverse" });
|
|
41
|
+
return (_jsx(IconDismissCircle, { size: iconSize, type: "inverse", dataId: dataId ? `${dataId}-icon` : '' }));
|
|
42
42
|
}
|
|
43
|
-
return _jsx(IconCheckmarkCircle, { size: iconSize, type: "inverse" });
|
|
43
|
+
return (_jsx(IconCheckmarkCircle, { size: iconSize, type: "inverse", dataId: dataId ? `${dataId}-icon` : '' }));
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
return null;
|
|
47
|
-
}, [index, stepType, stepSize, isCompleted, isActive, isRejected, textType]);
|
|
47
|
+
}, [index, stepType, stepSize, isCompleted, isActive, isRejected, textType, dataId]);
|
|
48
48
|
return (_jsxs("div", { className: classNames('step', `step--${stepSize}`, {
|
|
49
49
|
active: isActive,
|
|
50
50
|
completed: isCompleted && !isActive,
|
|
51
51
|
rejected: isRejected,
|
|
52
52
|
review: isReview
|
|
53
|
-
}), style: { width }, onClick: onClick, children: [_jsx("div", { className: "step__top", children: _jsx("div", { className: "step__circle", children: stepItemContent }) }), _jsxs("div", { className: "step__label", children: [_jsx(Text, { size: stepSize == 'large' ? 'standard' : 'small', weight: "semibold", lineHeight: 'large', className: "text-truncate", children: label }), _jsx(Text, { size: stepSize == 'large' ? 'small' : 'xsmall', className: "text-truncate", children: subText })] })] }));
|
|
53
|
+
}), style: { width }, onClick: onClick, "data-id": dataId, children: [_jsx("div", { className: "step__top", children: _jsx("div", { className: "step__circle", children: stepItemContent }) }), _jsxs("div", { className: "step__label", children: [_jsx(Text, { size: stepSize == 'large' ? 'standard' : 'small', weight: "semibold", lineHeight: 'large', className: "text-truncate", dataId: dataId ? `${dataId}-label` : '', children: label }), _jsx(Text, { size: stepSize == 'large' ? 'small' : 'xsmall', className: "text-truncate", dataId: dataId ? `${dataId}-subtext` : '', children: subText })] })] }));
|
|
54
54
|
};
|
|
@@ -8,7 +8,7 @@ export interface TStep {
|
|
|
8
8
|
}
|
|
9
9
|
export type TStepType = 'number' | 'dot';
|
|
10
10
|
export type TSteps = TStep[];
|
|
11
|
-
export type TProgressStepProps = {
|
|
11
|
+
export type TProgressStepProps = IBaseProps & {
|
|
12
12
|
steps: TSteps;
|
|
13
13
|
stepType: TStepType;
|
|
14
14
|
stepDirection: 'horizontal' | 'vertical';
|
|
@@ -16,7 +16,7 @@ export type TProgressStepProps = {
|
|
|
16
16
|
activeStep: TStepValue;
|
|
17
17
|
setActiveStep: (v: TStepValue) => void;
|
|
18
18
|
};
|
|
19
|
-
export type TStepProps = {
|
|
19
|
+
export type TStepProps = IBaseProps & {
|
|
20
20
|
width: string;
|
|
21
21
|
step: TStep;
|
|
22
22
|
stepSize?: 'large' | 'small';
|
|
@@ -9,11 +9,10 @@ export interface TRadioProps extends IFormCompProps {
|
|
|
9
9
|
isSelected?: boolean;
|
|
10
10
|
onClick?: (isChecked: boolean) => void;
|
|
11
11
|
}
|
|
12
|
-
export type TRadioOptionItem = {
|
|
12
|
+
export type TRadioOptionItem = IBaseProps & {
|
|
13
13
|
value: number | string;
|
|
14
14
|
label: string;
|
|
15
15
|
helperText?: string | ReactElement;
|
|
16
|
-
dataId?: string;
|
|
17
16
|
};
|
|
18
17
|
export interface TRadioGroupProps extends IFormCompProps {
|
|
19
18
|
label?: string | ReactElement;
|
|
@@ -6,6 +6,7 @@ import { useGetElemSizes, useOnOutsideClick } from '../../../hooks';
|
|
|
6
6
|
import { Loading, ButtonSelectWrapper } from '../SharedComponents';
|
|
7
7
|
import { noop } from '../../../utils/helpers';
|
|
8
8
|
import { useIsMobile } from '../../../hooks/useGetIsMobile';
|
|
9
|
+
import { getOptionDataId } from '../helper';
|
|
9
10
|
export const ButtonSelect = (props) => {
|
|
10
11
|
const { size, className, isLoading, options, name, setSelectedItem, setFieldValue, isRequiredField, selectedItem, labelLeftIconProps, tooltipAddons, dropdownWidth, labelRightIconComponent, optionRightIconComponent, align = 'left', value, placeHolder, offsets, dataId, type, isMobileFullScreen = false } = props;
|
|
11
12
|
const currentSelection = value || selectedItem;
|
|
@@ -38,8 +39,8 @@ export const ButtonSelect = (props) => {
|
|
|
38
39
|
};
|
|
39
40
|
return (_jsx(ButtonSelectWrapper, { applySelectedItems: noop, size: size, className: className, dropdownWidth: dropdownWidth, align: align, offsets: offsets, isOpen: isOpen, setIsOpen: setIsOpen, containerRef: containerRef, setContainerRef: setContainerRef, dropdownRef: dropdownRef, setDropdownRef: setDropdownRef, placeHolder: placeHolder, dataId: dataId, type: type, isMobile: isMobile && isMobileFullScreen, children: isLoading ? (_jsx(Loading, {})) : (_jsx(_Fragment, { children: _jsx("div", { ref: scrollRef, className: classNames('select__options__scroll', 'scrollbar', 'scrollbar--vertical', {
|
|
40
41
|
'mr-6': scrollHeight > 300
|
|
41
|
-
}), children: options.map((item) => {
|
|
42
|
+
}), children: options.map((item, index) => {
|
|
42
43
|
const isSelected = item.value === currentSelection;
|
|
43
|
-
return (_jsx(OptionItem, { tooltipAddons: tooltipAddons, data: item, onClick: clickHandler(isSelected), labelLeftIconProps: labelLeftIconProps, OptionRightIconComponent: optionRightIconComponent, LabelRightIconComponent: labelRightIconComponent, disabled: item.disabled, isSelected: isSelected }, item.value));
|
|
44
|
+
return (_jsx(OptionItem, { tooltipAddons: tooltipAddons, data: item, dataId: getOptionDataId(dataId, item.value, index) || item.dataId, onClick: clickHandler(isSelected), labelLeftIconProps: labelLeftIconProps, OptionRightIconComponent: optionRightIconComponent, LabelRightIconComponent: labelRightIconComponent, disabled: item.disabled, isSelected: isSelected }, item.value));
|
|
44
45
|
}) }) })) }));
|
|
45
46
|
};
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
import { OptionItem } from '../../../helperComponents/OptionItem';
|
|
4
|
+
import { getOptionDataId } from '../helper';
|
|
4
5
|
export const FilterDropdownContent = (props) => {
|
|
5
|
-
const { checkIsSelected, filterValue, options, onItemSelect, onItemDeselect, labelLeftIconProps, optionRightIconComponent, labelRightIconComponent } = props;
|
|
6
|
+
const { checkIsSelected, filterValue, options, onItemSelect, onItemDeselect, labelLeftIconProps, optionRightIconComponent, labelRightIconComponent, dataId } = props;
|
|
6
7
|
const filteredOptions = useMemo(() => {
|
|
7
8
|
return options.filter((option) => {
|
|
8
9
|
return option.label.toString().includes(filterValue);
|
|
9
10
|
});
|
|
10
11
|
}, [filterValue, options]);
|
|
11
|
-
return (_jsx(_Fragment, { children: filteredOptions.map((item) => {
|
|
12
|
+
return (_jsx(_Fragment, { children: filteredOptions.map((item, index) => {
|
|
12
13
|
const isSelected = checkIsSelected(item.value);
|
|
13
|
-
return (_jsx(OptionItem, { data: item, onClick: isSelected ? onItemDeselect : onItemSelect, labelLeftIconProps: labelLeftIconProps, OptionRightIconComponent: optionRightIconComponent, LabelRightIconComponent: labelRightIconComponent, isCheckbox: true, disabled: item.disabled, isSelected: isSelected }, item.value));
|
|
14
|
+
return (_jsx(OptionItem, { data: item, dataId: getOptionDataId(dataId, item.value, index) || item.dataId, onClick: isSelected ? onItemDeselect : onItemSelect, labelLeftIconProps: labelLeftIconProps, OptionRightIconComponent: optionRightIconComponent, LabelRightIconComponent: labelRightIconComponent, isCheckbox: true, disabled: item.disabled, isSelected: isSelected }, item.value));
|
|
14
15
|
}) }));
|
|
15
16
|
};
|
|
@@ -20,7 +20,7 @@ import { Input } from '../../Input';
|
|
|
20
20
|
import IconSearchFilled from '../../SVGIcons/IconSearchFilled';
|
|
21
21
|
import IconDismissFilled from '../../SVGIcons/IconDismissFilled';
|
|
22
22
|
export const FilterSelect = (props) => {
|
|
23
|
-
const { isLoading, isGrouped, options, isOpen, setFieldValue, name, footerButtonProps, selectedItems, setSelectedItems, closeHandler, parentRef, language = 'en' } = props, rest = __rest(props, ["isLoading", "isGrouped", "options", "isOpen", "setFieldValue", "name", "footerButtonProps", "selectedItems", "setSelectedItems", "closeHandler", "parentRef", "language"]);
|
|
23
|
+
const { isLoading, isGrouped, options, isOpen, setFieldValue, name, footerButtonProps, selectedItems, setSelectedItems, closeHandler, parentRef, language = 'en', dataId } = props, rest = __rest(props, ["isLoading", "isGrouped", "options", "isOpen", "setFieldValue", "name", "footerButtonProps", "selectedItems", "setSelectedItems", "closeHandler", "parentRef", "language", "dataId"]);
|
|
24
24
|
const [containerRef, setContainerRef] = useState(null);
|
|
25
25
|
const [selectedValues, setSelectedValues] = useState(selectedItems);
|
|
26
26
|
const [filterValue, setFilterValue] = useState('');
|
|
@@ -64,9 +64,9 @@ export const FilterSelect = (props) => {
|
|
|
64
64
|
if (!isOpen) {
|
|
65
65
|
return null;
|
|
66
66
|
}
|
|
67
|
-
return (_jsx(_Fragment, { children: createPortal(_jsx("div", { className: "select filter", children: _jsxs("div", { className: "select__options", ref: setContainerRef, children: [_jsx(Input, { onChange: onFilter, className: "filter__input", size: "small", currentValue: filterValue, rightIconProps: {
|
|
67
|
+
return (_jsx(_Fragment, { children: createPortal(_jsx("div", { className: "select filter", "data-id": dataId, children: _jsxs("div", { className: "select__options", "data-id": dataId ? `${dataId}-content` : '', ref: setContainerRef, children: [_jsx(Input, { dataId: dataId ? `${dataId}-search` : '', onChange: onFilter, className: "filter__input", size: "small", currentValue: filterValue, rightIconProps: {
|
|
68
68
|
size: filterValue === '' ? 'small' : 'xsmall',
|
|
69
69
|
Component: filterValue === '' ? IconSearchFilled : IconDismissFilled,
|
|
70
70
|
onClick: removeFilterValue
|
|
71
|
-
} }), _jsx("div", { className: 'select__options__scroll scrollbar scrollbar--vertical ', children: isLoading ? (_jsx(Loading, {})) : isGrouped ? (_jsx(FilterGroupDropdownContent, Object.assign({ checkIsSelected: checkIsSelected, onItemDeselect: onItemDeselect, filterValue: filterValue, onItemSelect: onItemSelect, options: options }, rest))) : (_jsx(FilterDropdownContent, Object.assign({ checkIsSelected: checkIsSelected, onItemDeselect: onItemDeselect, filterValue: filterValue, onItemSelect: onItemSelect, options: options }, rest))) }), isLoading ? null : (_jsx(Footer, { buttonProps: footerButtonProps, onCancel: cancelSelectedItems, onApply: applySelectedItems, language: language }))] }) }), document.body) }));
|
|
71
|
+
} }), _jsx("div", { className: 'select__options__scroll scrollbar scrollbar--vertical ', children: isLoading ? (_jsx(Loading, {})) : isGrouped ? (_jsx(FilterGroupDropdownContent, Object.assign({ checkIsSelected: checkIsSelected, onItemDeselect: onItemDeselect, filterValue: filterValue, onItemSelect: onItemSelect, dataId: dataId, options: options }, rest))) : (_jsx(FilterDropdownContent, Object.assign({ checkIsSelected: checkIsSelected, onItemDeselect: onItemDeselect, filterValue: filterValue, onItemSelect: onItemSelect, dataId: dataId, options: options }, rest))) }), isLoading ? null : (_jsx(Footer, { dataId: dataId, buttonProps: footerButtonProps, onCancel: cancelSelectedItems, onApply: applySelectedItems, language: language }))] }) }), document.body) }));
|
|
72
72
|
};
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { DROPDOWN_AND_INPUT_GAP } from '../../../consts';
|
|
3
3
|
import { useGetElemPositions, useGetElemSizes, useGetHasBottomSpace, useGetHasTopSpace } from '../../../hooks';
|
|
4
4
|
export const DesktopWrapper = (props) => {
|
|
5
|
-
const { offsets, setDropdownRef, align, isOpen, children, inputRef, dropdownRef, containerRef, dropdownWidth } = props;
|
|
5
|
+
const { offsets, setDropdownRef, align, isOpen, children, inputRef, dropdownRef, containerRef, dropdownWidth, dataId } = props;
|
|
6
6
|
const { bottom, left, top, right } = useGetElemPositions(inputRef);
|
|
7
7
|
const { width: containerWidth } = useGetElemSizes(containerRef);
|
|
8
8
|
const hasTopSpace = useGetHasTopSpace({
|
|
@@ -13,7 +13,7 @@ export const DesktopWrapper = (props) => {
|
|
|
13
13
|
element: dropdownRef,
|
|
14
14
|
input: inputRef
|
|
15
15
|
});
|
|
16
|
-
return isOpen ? (_jsx("div", { className: "select__options", ref: setDropdownRef, style: Object.assign({ left: align === 'left' ? (offsets === null || offsets === void 0 ? void 0 : offsets.left) || left : right - (dropdownWidth || containerWidth), right: align === 'right' ? (offsets === null || offsets === void 0 ? void 0 : offsets.right) || left : right - (dropdownWidth || containerWidth), width: dropdownWidth || containerWidth }, (hasBottomSpace || !hasTopSpace
|
|
16
|
+
return isOpen ? (_jsx("div", { "data-id": dataId ? `${dataId}-content` : '', className: "select__options", ref: setDropdownRef, style: Object.assign({ left: align === 'left' ? (offsets === null || offsets === void 0 ? void 0 : offsets.left) || left : right - (dropdownWidth || containerWidth), right: align === 'right' ? (offsets === null || offsets === void 0 ? void 0 : offsets.right) || left : right - (dropdownWidth || containerWidth), width: dropdownWidth || containerWidth }, (hasBottomSpace || !hasTopSpace
|
|
17
17
|
? { top: (offsets === null || offsets === void 0 ? void 0 : offsets.top) || bottom }
|
|
18
18
|
: { bottom: window.innerHeight - top + DROPDOWN_AND_INPUT_GAP })), children: children })) : null;
|
|
19
19
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Modal } from '../../Modal';
|
|
3
3
|
export const MobileWrapper = (props) => {
|
|
4
|
-
const { applySelectedItems, isOpen, closeDrodown, children, modalApplyButtonText = 'Apply' } = props;
|
|
4
|
+
const { applySelectedItems, isOpen, closeDrodown, children, modalApplyButtonText = 'Apply', dataId } = props;
|
|
5
5
|
const submitSelection = () => {
|
|
6
6
|
applySelectedItems(false);
|
|
7
7
|
};
|
|
8
|
-
return (_jsx(Modal, { isOpen: isOpen, onClose: closeDrodown, onSubmit: submitSelection, isMobileFullScreen: true, className: 'select__modal', buttonProps: {
|
|
8
|
+
return (_jsx(Modal, { isOpen: isOpen, onClose: closeDrodown, onSubmit: submitSelection, isMobileFullScreen: true, dataIdPrefix: dataId, className: 'select__modal', buttonProps: {
|
|
9
9
|
confirm: {
|
|
10
10
|
buttonText: modalApplyButtonText
|
|
11
11
|
}
|
|
@@ -8,8 +8,9 @@ import { DROPDOWN_HEIGHT, DROPDOWN_WIDTH, ITEM_SIZE, ITEM_SIZE_MOBILE } from '..
|
|
|
8
8
|
import classNames from 'classnames';
|
|
9
9
|
import { noop } from '../../../../utils/helpers';
|
|
10
10
|
import { filterSearchData } from '../../Select/helpers';
|
|
11
|
+
import { getOptionDataId } from '../../helper';
|
|
11
12
|
export const MultiBase = (props) => {
|
|
12
|
-
const { isMobile, closeDropdown, scrollableContentStyle, options, helperText, translations, onItemSelect, onItemDeselect, isSearchAvailable, setSelectedValues, selectedValues, labelLeftIconProps, labelRightIconComponent, optionRightIconComponent, maxSelectCount, menuOptions, dataIdPrefix, dropdownWidth, applySelectedItems } = props;
|
|
13
|
+
const { isMobile, closeDropdown, scrollableContentStyle, options, helperText, translations, onItemSelect, onItemDeselect, isSearchAvailable, setSelectedValues, selectedValues, labelLeftIconProps, labelRightIconComponent, optionRightIconComponent, maxSelectCount, menuOptions, dataIdPrefix, dataId, dropdownWidth, applySelectedItems } = props;
|
|
13
14
|
const { emptyListMainMessage, emptyListSecondaryMessage } = translations || {};
|
|
14
15
|
const [navigationMode, setNavigationMode] = useState(false);
|
|
15
16
|
const [searchValue, setSearchValue] = useState('');
|
|
@@ -104,7 +105,7 @@ export const MultiBase = (props) => {
|
|
|
104
105
|
labelRightIconComponent
|
|
105
106
|
};
|
|
106
107
|
}, [labelLeftIconProps, optionRightIconComponent, labelRightIconComponent]);
|
|
107
|
-
return (_jsxs(_Fragment, { children: [_jsx(ContentTop, { closeDropdown: closeDropdown, dataIdPrefix: dataIdPrefix, menuOptions: menuOptions, selectAll: selectAll, clearAll: clearAll, hasLimitation: !!maxSelectCount, isAnySelected: selectedValues.length !== 0, helperText: helperText, isSearchAvailable: isSearchAvailable, isSelectAllDisabled: isAllSelected || filteredData.length === 0, setSearchValue: setSearchValue, searchValue: searchValue, translations: translations, handleKeyDown: handleKeyDown }), _jsx("div", { className: classNames('select__options__scroll scrollbar', {
|
|
108
|
+
return (_jsxs(_Fragment, { children: [_jsx(ContentTop, { closeDropdown: closeDropdown, dataId: dataId, dataIdPrefix: dataIdPrefix, menuOptions: menuOptions, selectAll: selectAll, clearAll: clearAll, hasLimitation: !!maxSelectCount, isAnySelected: selectedValues.length !== 0, helperText: helperText, isSearchAvailable: isSearchAvailable, isSelectAllDisabled: isAllSelected || filteredData.length === 0, setSearchValue: setSearchValue, searchValue: searchValue, translations: translations, handleKeyDown: handleKeyDown }), _jsx("div", { className: classNames('select__options__scroll scrollbar', {
|
|
108
109
|
select__options__scroll_mobile: isMobile
|
|
109
110
|
}), style: scrollableContentStyle, ref: dropdownRef, tabIndex: 0, onKeyDown: isSearchAvailable ? noop : handleKeyDown, children: filteredData.length > 0 && (_jsx(List, { ref: listRef, height: isMobile
|
|
110
111
|
? window.innerHeight - 80 - 73 - 24
|
|
@@ -114,7 +115,7 @@ export const MultiBase = (props) => {
|
|
|
114
115
|
const item = filteredData[index];
|
|
115
116
|
const isSelected = checkIsSelected(item.value);
|
|
116
117
|
const isActive = index === activeIndex;
|
|
117
|
-
return (_jsx(OptionItem, Object.assign({ size: isMobile ? 'large' : 'small', data: item, dataId: item.dataId, onClick: isSelected ? onDeselect : onItemSelect, disabled: item.disabled || (!isSelected && selectedValues.length === maxSelectCount), isSelected: isSelected, style: style, className: classNames('option', {
|
|
118
|
+
return (_jsx(OptionItem, Object.assign({ size: isMobile ? 'large' : 'small', data: item, dataId: getOptionDataId(dataId, item.value, index) || item.dataId, onClick: isSelected ? onDeselect : onItemSelect, disabled: item.disabled || (!isSelected && selectedValues.length === maxSelectCount), isSelected: isSelected, style: style, className: classNames('option', {
|
|
118
119
|
'option--active': isActive
|
|
119
120
|
}) }, optionProps)));
|
|
120
121
|
} })) }), filteredData.length === 0 ? (_jsx(Empty, { size: "small", mainMessage: emptyListMainMessage, paragraphMessage: emptyListSecondaryMessage })) : null] }));
|
|
@@ -17,7 +17,7 @@ import { useOnOutsideClick } from '../../../hooks';
|
|
|
17
17
|
import { useIsMobile } from '../../../hooks/useGetIsMobile';
|
|
18
18
|
import { SELECT_TRANSLATIONS } from '../localization';
|
|
19
19
|
export const MultiSelect = forwardRef((props, _ref) => {
|
|
20
|
-
const { isMobileFullScreen = true, options, footerButtonProps, selectedItems, setSelectedItems, name, setFieldValue, value, label, placeHolder, isRequiredField, labelAddons, className = '', disabled, dropdownWidth, align = 'left', size, isButtonSelect, checkboxInfo, translations, hasError, language = 'en', hideSelectedOptions = false } = props, rest = __rest(props, ["isMobileFullScreen", "options", "footerButtonProps", "selectedItems", "setSelectedItems", "name", "setFieldValue", "value", "label", "placeHolder", "isRequiredField", "labelAddons", "className", "disabled", "dropdownWidth", "align", "size", "isButtonSelect", "checkboxInfo", "translations", "hasError", "language", "hideSelectedOptions"]);
|
|
20
|
+
const { isMobileFullScreen = true, options, footerButtonProps, selectedItems, setSelectedItems, name, setFieldValue, value, label, placeHolder, isRequiredField, labelAddons, className = '', disabled, dropdownWidth, align = 'left', size, isButtonSelect, checkboxInfo, translations, hasError, language = 'en', hideSelectedOptions = false, dataId } = props, rest = __rest(props, ["isMobileFullScreen", "options", "footerButtonProps", "selectedItems", "setSelectedItems", "name", "setFieldValue", "value", "label", "placeHolder", "isRequiredField", "labelAddons", "className", "disabled", "dropdownWidth", "align", "size", "isButtonSelect", "checkboxInfo", "translations", "hasError", "language", "hideSelectedOptions", "dataId"]);
|
|
21
21
|
const [dropdownRef, setDropdownRef] = useState(null);
|
|
22
22
|
const initialSelected = value || selectedItems || [];
|
|
23
23
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -59,10 +59,10 @@ export const MultiSelect = forwardRef((props, _ref) => {
|
|
|
59
59
|
const WrapperComponent = isButtonSelect ? ButtonSelectWrapper : InputSelectWrapper;
|
|
60
60
|
const localizations = Object.assign(Object.assign({}, SELECT_TRANSLATIONS[language]), translations);
|
|
61
61
|
const isMobile = useIsMobile();
|
|
62
|
-
return (_jsx(WrapperComponent, { dropdownRef: dropdownRef, isOpen: isOpen, setIsOpen: setIsOpen, containerRef: containerRef, setContainerRef: setContainerRef, dropdownWidth: dropdownWidth, setDropdownRef: setDropdownRef, size: size, label: label, align: align, disabled: disabled, className: className, labelAddons: labelAddons, placeHolder: placeHolder, selectedValues: selectedValues, isRequiredField: isRequiredField, overflowText: localizations.overflowText, hasError: hasError, applySelectedItems: applySelectedItems, isMobile: isMobile && isMobileFullScreen, hideSelectedOptions: hideSelectedOptions, children: _jsxs(_Fragment, { children: [_jsx(OptionsWrapper
|
|
62
|
+
return (_jsx(WrapperComponent, { dataId: dataId, dropdownRef: dropdownRef, isOpen: isOpen, setIsOpen: setIsOpen, containerRef: containerRef, setContainerRef: setContainerRef, dropdownWidth: dropdownWidth, setDropdownRef: setDropdownRef, size: size, label: label, align: align, disabled: disabled, className: className, labelAddons: labelAddons, placeHolder: placeHolder, selectedValues: selectedValues, isRequiredField: isRequiredField, overflowText: localizations.overflowText, hasError: hasError, applySelectedItems: applySelectedItems, isMobile: isMobile && isMobileFullScreen, hideSelectedOptions: hideSelectedOptions, children: _jsxs(_Fragment, { children: [_jsx(OptionsWrapper
|
|
63
63
|
// @ts-ignore
|
|
64
64
|
, Object.assign({
|
|
65
65
|
// @ts-ignore
|
|
66
|
-
options: options, isOpen: isOpen, translations: localizations, setIsOpen: setIsOpen, dropdownRef: dropdownRef, openDropdown: openDropdown, selectedValues: selectedValues, setSelectedValues: setSelectedValues, containerRef: containerRef, dropdownWidth: dropdownWidth, isMobileFullScreen: isMobileFullScreen, applySelectedItems: applySelectedItems }, rest)), options.length && !(isMobile && isMobileFullScreen) ? (_jsx(Footer, { checkboxInfo: checkboxInfo, hasChange: hasChange, buttonProps: footerButtonProps, onCancel: cancelSelectedItems, onApply: applySelectedItems, language: language })) : null] }) }));
|
|
66
|
+
options: options, dataId: dataId, isOpen: isOpen, translations: localizations, setIsOpen: setIsOpen, dropdownRef: dropdownRef, openDropdown: openDropdown, selectedValues: selectedValues, setSelectedValues: setSelectedValues, containerRef: containerRef, dropdownWidth: dropdownWidth, isMobileFullScreen: isMobileFullScreen, applySelectedItems: applySelectedItems }, rest)), options.length && !(isMobile && isMobileFullScreen) ? (_jsx(Footer, { dataId: dataId, checkboxInfo: checkboxInfo, hasChange: hasChange, buttonProps: footerButtonProps, onCancel: cancelSelectedItems, onApply: applySelectedItems, language: language })) : null] }) }));
|
|
67
67
|
});
|
|
68
68
|
MultiSelect.displayName = 'MultiSelect';
|
|
@@ -10,8 +10,9 @@ import { DROPDOWN_MAX_HEIGHT } from '../../constants';
|
|
|
10
10
|
import IconCaretUpFilled from '../../../SVGIcons/IconCaretUpFilled';
|
|
11
11
|
import IconCaretDownFilled from '../../../SVGIcons/IconCaretDownFilled';
|
|
12
12
|
import { filterSearchData } from '../../Select/helpers';
|
|
13
|
+
import { getOptionDataId } from '../../helper';
|
|
13
14
|
export const MultiSelectGrouped = (props) => {
|
|
14
|
-
const { isMobile, options, helperText, translations, selectedValues, onItemSelect, onItemDeselect, setSelectedValues, isSearchAvailable, labelLeftIconProps, scrollableContentStyle, optionRightIconComponent, labelRightIconComponent, maxSelectCount, menuOptions, dataIdPrefix, closeDropdown } = props;
|
|
15
|
+
const { isMobile, options, helperText, translations, selectedValues, onItemSelect, onItemDeselect, setSelectedValues, isSearchAvailable, labelLeftIconProps, scrollableContentStyle, optionRightIconComponent, labelRightIconComponent, maxSelectCount, menuOptions, dataIdPrefix, dataId, closeDropdown } = props;
|
|
15
16
|
const { emptyListMainMessage, emptyListSecondaryMessage } = translations;
|
|
16
17
|
const [searchValue, setSearchValue] = useState('');
|
|
17
18
|
const [activeGroupId, setActiveGroupId] = useState(0);
|
|
@@ -82,15 +83,15 @@ export const MultiSelectGrouped = (props) => {
|
|
|
82
83
|
};
|
|
83
84
|
}, [labelLeftIconProps, optionRightIconComponent, labelRightIconComponent]);
|
|
84
85
|
const hasTopContent = isSearchAvailable || helperText;
|
|
85
|
-
return (_jsxs(_Fragment, { children: [hasTopContent ? (_jsx(ContentTop, { closeDropdown: closeDropdown, dataIdPrefix: dataIdPrefix, menuOptions: menuOptions, isSearchAvailable: isSearchAvailable || isMobile, hasLimitation: !!maxSelectCount, selectAll: selectAll, clearAll: clearAll, isAnySelected: selectedValues.length !== 0, helperText: helperText, isSelectAllDisabled: isAllSelected || filteredData.length === 0, setSearchValue: setSearchValue, searchValue: searchValue, translations: translations })) : null, _jsx("div", { ref: setContentContainerRef, className: `select__options__scroll scrollbar scrollbar--vertical ${scrollHeight > DROPDOWN_MAX_HEIGHT ? 'mr-6' : ''}`, style: scrollableContentStyle, children: _jsxs("div", { children: [isSearchAvailable && (_jsx("div", { className: "selected-items", children: selectedOptions.map((selectedItem) => {
|
|
86
|
+
return (_jsxs(_Fragment, { children: [hasTopContent ? (_jsx(ContentTop, { closeDropdown: closeDropdown, dataId: dataId, dataIdPrefix: dataIdPrefix, menuOptions: menuOptions, isSearchAvailable: isSearchAvailable || isMobile, hasLimitation: !!maxSelectCount, selectAll: selectAll, clearAll: clearAll, isAnySelected: selectedValues.length !== 0, helperText: helperText, isSelectAllDisabled: isAllSelected || filteredData.length === 0, setSearchValue: setSearchValue, searchValue: searchValue, translations: translations })) : null, _jsx("div", { ref: setContentContainerRef, className: `select__options__scroll scrollbar scrollbar--vertical ${scrollHeight > DROPDOWN_MAX_HEIGHT ? 'mr-6' : ''}`, style: scrollableContentStyle, children: _jsxs("div", { children: [isSearchAvailable && (_jsx("div", { className: "selected-items", children: selectedOptions.map((selectedItem) => {
|
|
86
87
|
return (_jsx(OptionItem, Object.assign({ isSelected: true, data: selectedItem, onClick: onDeselect, disabled: selectedItem.disabled }, optionProps), selectedItem.value));
|
|
87
88
|
}) })), hasTopContent ? _jsx(Divider, { type: "primary", isHorizontal: true }) : null, filteredData.map(({ title, data }, index) => {
|
|
88
89
|
var _a;
|
|
89
90
|
const isActive = index === activeGroupId;
|
|
90
91
|
return (_jsxs("div", { className: "select__group group-item", children: [_jsxs("div", { onClick: () => onGroupClick(index), className: "group-item__top", children: [_jsx(Text, { size: "xxsmall", type: "tertiary", className: "group-item__title pr-4", children: title }), isActive ? (_jsx(IconCaretUpFilled, { size: "xxsmall", className: "group-item__icon" })) : (_jsx(IconCaretDownFilled, { size: "xxsmall", className: "group-item__icon" }))] }), isActive &&
|
|
91
|
-
data.map((item) => {
|
|
92
|
+
data.map((item, itemIndex) => {
|
|
92
93
|
const isSelected = selectedValues.findIndex((s) => s.value === item.value) !== -1;
|
|
93
|
-
return (_jsx(OptionItem, Object.assign({ data: item, dataId: item.dataId, isSelected: isSelected, disabled: item.disabled || (!isSelected && selectedValues.length === maxSelectCount), onClick: isSelected ? onDeselect : onItemSelect }, optionProps), item.value));
|
|
94
|
+
return (_jsx(OptionItem, Object.assign({ data: item, dataId: getOptionDataId(dataId, item.value, itemIndex) || item.dataId, isSelected: isSelected, disabled: item.disabled || (!isSelected && selectedValues.length === maxSelectCount), onClick: isSelected ? onDeselect : onItemSelect }, optionProps), item.value));
|
|
94
95
|
})] }, `${(_a = data[0]) === null || _a === void 0 ? void 0 : _a.value}_${index}`));
|
|
95
96
|
})] }) }), filteredData.length === 0 ? (_jsx(Empty, { size: "small", mainMessage: emptyListMainMessage, paragraphMessage: emptyListSecondaryMessage })) : null] }));
|
|
96
97
|
};
|
|
@@ -8,8 +8,9 @@ import { OptionItem } from '../../../../helperComponents/OptionItem';
|
|
|
8
8
|
import { ContentTop } from '../../SharedComponents';
|
|
9
9
|
import { DROPDOWN_MAX_HEIGHT } from '../../constants';
|
|
10
10
|
import { filterSearchData } from '../../Select/helpers';
|
|
11
|
+
import { getOptionDataId } from '../../helper';
|
|
11
12
|
export const MultiSelectWithTabs = (props) => {
|
|
12
|
-
const { options, scrollableContentStyle, selectedValues, onItemSelect, onItemDeselect, setSelectedValues, labelLeftIconProps, optionRightIconComponent, labelRightIconComponent, helperText, translations, isSearchAvailable, maxSelectCount, menuOptions, dataIdPrefix, closeDropdown } = props;
|
|
13
|
+
const { options, scrollableContentStyle, selectedValues, onItemSelect, onItemDeselect, setSelectedValues, labelLeftIconProps, optionRightIconComponent, labelRightIconComponent, helperText, translations, isSearchAvailable, maxSelectCount, menuOptions, dataIdPrefix, dataId, closeDropdown } = props;
|
|
13
14
|
const { emptyListMainMessage, emptyListSecondaryMessage } = translations;
|
|
14
15
|
const [contentContainerRef, setContentContainerRef] = useState(null);
|
|
15
16
|
const [activeTab, setActiveTab] = useState(0);
|
|
@@ -62,10 +63,10 @@ export const MultiSelectWithTabs = (props) => {
|
|
|
62
63
|
labelRightIconComponent
|
|
63
64
|
};
|
|
64
65
|
}, [labelLeftIconProps, optionRightIconComponent, labelRightIconComponent]);
|
|
65
|
-
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "tab_container", style: { padding: '0 20px', width: '100%' }, children: _jsx(Tab, { selectedValue: activeTab, tabItems: tabs, onSelect: onTabSelect, size: "small" }) }), _jsx(ContentTop, { closeDropdown: closeDropdown, dataIdPrefix: dataIdPrefix, menuOptions: menuOptions, isSearchAvailable: isSearchAvailable, clearAll: clearAll, selectAll: selectAll, helperText: helperText, searchValue: searchValue, translations: translations, setSearchValue: setSearchValue, hasLimitation: !!maxSelectCount, isAnySelected: selectedValues.length === 0, isSelectAllDisabled: isAllSelected || filteredData.length === 0 }), _jsxs("div", { ref: setContentContainerRef, className: `select__options__scroll scrollbar scrollbar--vertical ${scrollHeight > DROPDOWN_MAX_HEIGHT ? 'mr-6' : ''}`, style: scrollableContentStyle, children: [isSearchAvailable && (_jsx("div", { className: "selected_container", children: selectedOptions.map((selectedItem) => {
|
|
66
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "tab_container", style: { padding: '0 20px', width: '100%' }, children: _jsx(Tab, { selectedValue: activeTab, tabItems: tabs, onSelect: onTabSelect, size: "small" }) }), _jsx(ContentTop, { closeDropdown: closeDropdown, dataId: dataId, dataIdPrefix: dataIdPrefix, menuOptions: menuOptions, isSearchAvailable: isSearchAvailable, clearAll: clearAll, selectAll: selectAll, helperText: helperText, searchValue: searchValue, translations: translations, setSearchValue: setSearchValue, hasLimitation: !!maxSelectCount, isAnySelected: selectedValues.length === 0, isSelectAllDisabled: isAllSelected || filteredData.length === 0 }), _jsxs("div", { ref: setContentContainerRef, className: `select__options__scroll scrollbar scrollbar--vertical ${scrollHeight > DROPDOWN_MAX_HEIGHT ? 'mr-6' : ''}`, style: scrollableContentStyle, children: [isSearchAvailable && (_jsx("div", { className: "selected_container", children: selectedOptions.map((selectedItem) => {
|
|
66
67
|
return (_jsx(OptionItem, Object.assign({ data: selectedItem, onClick: onDeselect, disabled: selectedItem.disabled, isSelected: true }, optionProps), selectedItem.value));
|
|
67
|
-
}) })), _jsx(Divider, { type: "primary", isHorizontal: true }), filteredData.map((item) => {
|
|
68
|
+
}) })), _jsx(Divider, { type: "primary", isHorizontal: true }), filteredData.map((item, index) => {
|
|
68
69
|
const isSelected = selectedValues.findIndex((s) => s.value === item.value) !== -1;
|
|
69
|
-
return (_jsx(OptionItem, Object.assign({ data: item, dataId: item.dataId, onClick: isSelected ? onDeselect : onItemSelect, disabled: item.disabled || (!isSelected && selectedValues.length === maxSelectCount), isSelected: isSelected }, optionProps), item.value));
|
|
70
|
+
return (_jsx(OptionItem, Object.assign({ data: item, dataId: getOptionDataId(dataId, item.value, index) || item.dataId, onClick: isSelected ? onDeselect : onItemSelect, disabled: item.disabled || (!isSelected && selectedValues.length === maxSelectCount), isSelected: isSelected }, optionProps), item.value));
|
|
70
71
|
}), filteredData.length === 0 ? (_jsx(Empty, { size: "small", mainMessage: emptyListMainMessage, paragraphMessage: emptyListSecondaryMessage })) : null] })] }));
|
|
71
72
|
};
|
|
@@ -5,9 +5,10 @@ import { OptionItem } from '../../../helperComponents/OptionItem';
|
|
|
5
5
|
import { useGetElemPositions, useGetElemSizes, useOnOutsideClick } from '../../../hooks';
|
|
6
6
|
import IconChevronUp from '../../SVGIcons/IconChevronUp';
|
|
7
7
|
import IconChevronDown from '../../SVGIcons/IconChevronDown';
|
|
8
|
+
import { getOptionDataId } from '../helper';
|
|
8
9
|
const LEVEL_LEFT_MARGIN = 10;
|
|
9
10
|
export const NestedSelect = (props) => {
|
|
10
|
-
const { label, options, selected, placeHolder, isRequiredField, setSelectedValue, initialSelectedFolderIds, optionRightIconComponent, labelRightIconComponent, labelAddons } = props;
|
|
11
|
+
const { label, options, selected, placeHolder, isRequiredField, setSelectedValue, initialSelectedFolderIds, optionRightIconComponent, labelRightIconComponent, labelAddons, dataId } = props;
|
|
11
12
|
const [isDropdownOpen, setIsOpen] = useState(false);
|
|
12
13
|
const [containerRef, setContainerRef] = useState(null);
|
|
13
14
|
const [selectedValues, setSelectedValues] = useState(initialSelectedFolderIds || []);
|
|
@@ -45,14 +46,14 @@ export const NestedSelect = (props) => {
|
|
|
45
46
|
const { value, children, disabled } = option;
|
|
46
47
|
const isOpen = selectedValues.indexOf(option.value) !== -1;
|
|
47
48
|
const isSelected = option.value === (selected === null || selected === void 0 ? void 0 : selected.value);
|
|
48
|
-
acc.push(_jsx("div", { style: { paddingLeft: LEVEL_LEFT_MARGIN * level }, children: _jsx(OptionItem, { data: option, isSelected: isSelected, onClick: () => onSelect({ value, label: option.label }, !!children), disabled: disabled, OptionRightIconComponent: optionRightIconComponent, LabelRightIconComponent: labelRightIconComponent, labelLeftIconProps: children ? { Component: IconChevronDown, size: 'xsmall' } : undefined }, value) }));
|
|
49
|
+
acc.push(_jsx("div", { style: { paddingLeft: LEVEL_LEFT_MARGIN * level }, children: _jsx(OptionItem, { data: option, dataId: getOptionDataId(dataId, value, acc.length) || option.dataId, isSelected: isSelected, onClick: () => onSelect({ value, label: option.label }, !!children), disabled: disabled, OptionRightIconComponent: optionRightIconComponent, LabelRightIconComponent: labelRightIconComponent, labelLeftIconProps: children ? { Component: IconChevronDown, size: 'xsmall' } : undefined }, value) }));
|
|
49
50
|
if (isOpen && children) {
|
|
50
51
|
acc.push(...generateFolders(children, level + 1));
|
|
51
52
|
}
|
|
52
53
|
return acc;
|
|
53
54
|
}, []);
|
|
54
|
-
return (_jsxs("div", { className: "select select--multi", ref: setContainerRef, children: [_jsx("div", { onClick: toggleDropdown, children: _jsx(Input, { ref: inputRef, className: "select__input", label: label, required: isRequiredField, rightIconProps: {
|
|
55
|
+
return (_jsxs("div", { className: "select select--multi", "data-id": dataId, ref: setContainerRef, children: [_jsx("div", { onClick: toggleDropdown, children: _jsx(Input, { dataId: dataId ? `${dataId}-trigger` : '', ref: inputRef, className: "select__input", label: label, required: isRequiredField, rightIconProps: {
|
|
55
56
|
Component: isDropdownOpen ? IconChevronUp : IconChevronDown,
|
|
56
57
|
size: 'small'
|
|
57
|
-
}, placeholder: placeHolder, currentValue: (selected === null || selected === void 0 ? void 0 : selected.label.toString()) || '', readonly: true, labelAddons: labelAddons }) }), isDropdownOpen && (_jsx("div", { className: "select__options", style: { left, width, top: bottom }, children: _jsx("div", { className: "select__options__scroll scrollbar scrollbar--vertical", children: generateFolders(options, 0) }) }))] }));
|
|
58
|
+
}, placeholder: placeHolder, currentValue: (selected === null || selected === void 0 ? void 0 : selected.label.toString()) || '', readonly: true, labelAddons: labelAddons }) }), isDropdownOpen && (_jsx("div", { className: "select__options", "data-id": dataId ? `${dataId}-content` : '', style: { left, width, top: bottom }, children: _jsx("div", { className: "select__options__scroll scrollbar scrollbar--vertical", children: generateFolders(options, 0) }) }))] }));
|
|
58
59
|
};
|
|
@@ -5,9 +5,9 @@ import { useOnOutsideClick } from '../../../hooks';
|
|
|
5
5
|
import { Link } from '../../Link';
|
|
6
6
|
export const ProfileDropdown = (props) => {
|
|
7
7
|
const menuRef = useRef(null);
|
|
8
|
-
const { avatar, name, email, bodyItems, footerItems, className } = props;
|
|
8
|
+
const { avatar, name, email, bodyItems, footerItems, className, dataId } = props;
|
|
9
9
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
10
10
|
const closeDropdown = () => setIsOpen(false);
|
|
11
11
|
useOnOutsideClick(menuRef.current, closeDropdown, isOpen, useId());
|
|
12
|
-
return (_jsxs("div", { ref: menuRef, className: `relative ${className}`, children: [_jsx("div", { onClick: () => setIsOpen(!isOpen), children: avatar }), isOpen && (_jsxs("div", { className: "profile-dropdown", children: [_jsxs("div", { className: "profile-dropdown__top", children: [avatar, _jsxs("div", { className: 'pl-12', children: [_jsx(Text, { size: 'medium', weight: 'bold', lineHeight: 'large', children: name }), _jsx(Text, { type: 'tertiary', children: email })] })] }), _jsxs("div", { className: "profile-dropdown__menu", children: [_jsx("ul", { className: 'profile-dropdown__nav', children: bodyItems === null || bodyItems === void 0 ? void 0 : bodyItems.map((item, index) => (_jsx("li", { children: item.text ? (_jsx(Link, { url: item.url, onclick: item.onclick, className: 'profile-dropdown__nav__link', children: _jsxs(_Fragment, { children: [_jsx("span", { className: 'flexbox align-items--center', children: _jsxs(_Fragment, { children: [item.icon, item.text] }) }), item.rightInfoProps] }) })) : (_jsx("div", { onClick: closeDropdown, children: item.children })) }, index))) }), (footerItems === null || footerItems === void 0 ? void 0 : footerItems.length) ? (_jsx("div", { className: 'profile-dropdown__bottom', children: _jsx("ul", { className: 'profile-dropdown__nav', children: footerItems === null || footerItems === void 0 ? void 0 : footerItems.map((item, index) => (_jsx("li", { children: item.text ? (_jsx(Link, { url: item.url, onclick: item.onclick, className: 'profile-dropdown__nav__link', children: _jsxs(_Fragment, { children: [_jsx("span", { className: 'flexbox align-items--center', children: _jsxs(_Fragment, { children: [item.icon, item.text] }) }), item.rightInfoProps] }) })) : (item.children) }, index))) }) })) : null] })] }))] }));
|
|
12
|
+
return (_jsxs("div", { ref: menuRef, "data-id": dataId, className: `relative ${className}`, children: [_jsx("div", { "data-id": dataId ? `${dataId}-trigger` : '', onClick: () => setIsOpen(!isOpen), children: avatar }), isOpen && (_jsxs("div", { "data-id": dataId ? `${dataId}-content` : '', className: "profile-dropdown", children: [_jsxs("div", { className: "profile-dropdown__top", children: [avatar, _jsxs("div", { className: 'pl-12', children: [_jsx(Text, { size: 'medium', weight: 'bold', lineHeight: 'large', children: name }), _jsx(Text, { type: 'tertiary', children: email })] })] }), _jsxs("div", { className: "profile-dropdown__menu", children: [_jsx("ul", { className: 'profile-dropdown__nav', children: bodyItems === null || bodyItems === void 0 ? void 0 : bodyItems.map((item, index) => (_jsx("li", { "data-id": dataId ? `${dataId}-item-${index}` : '', children: item.text ? (_jsx(Link, { url: item.url, onclick: item.onclick, className: 'profile-dropdown__nav__link', children: _jsxs(_Fragment, { children: [_jsx("span", { className: 'flexbox align-items--center', children: _jsxs(_Fragment, { children: [item.icon, item.text] }) }), item.rightInfoProps] }) })) : (_jsx("div", { onClick: closeDropdown, children: item.children })) }, index))) }), (footerItems === null || footerItems === void 0 ? void 0 : footerItems.length) ? (_jsx("div", { className: 'profile-dropdown__bottom', children: _jsx("ul", { className: 'profile-dropdown__nav', children: footerItems === null || footerItems === void 0 ? void 0 : footerItems.map((item, index) => (_jsx("li", { "data-id": dataId ? `${dataId}-footer-item-${index}` : '', children: item.text ? (_jsx(Link, { url: item.url, onclick: item.onclick, className: 'profile-dropdown__nav__link', children: _jsxs(_Fragment, { children: [_jsx("span", { className: 'flexbox align-items--center', children: _jsxs(_Fragment, { children: [item.icon, item.text] }) }), item.rightInfoProps] }) })) : (item.children) }, index))) }) })) : null] })] }))] }));
|
|
13
13
|
};
|