hrm_ui_lib 3.2.3 → 3.3.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/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/types.d.ts +2 -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/types.d.ts +0 -1
- package/components/Stepper/Stepper.js +2 -2
- package/components/Stepper/types.d.ts +2 -2
- 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
|
@@ -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;
|
|
@@ -100,7 +100,6 @@ export interface TMultiSelectPropTypes extends IFormCompProps, TSelectBaseProps
|
|
|
100
100
|
}
|
|
101
101
|
export interface TButtonSelectPropTypes extends IFormCompProps, TSelectBaseProps {
|
|
102
102
|
isMobileFullScreen?: boolean;
|
|
103
|
-
dataId?: string;
|
|
104
103
|
options: TSelectOptions;
|
|
105
104
|
selectedItem?: TItemValue;
|
|
106
105
|
setSelectedItem?: (items: TItemValue | undefined) => void;
|
|
@@ -129,11 +128,10 @@ export interface TSingleSelectPropTypes extends IFormCompProps, TSelectBaseProps
|
|
|
129
128
|
emptyListMainMessage: string;
|
|
130
129
|
};
|
|
131
130
|
}
|
|
132
|
-
export interface ISingleSelectResponsiveProps {
|
|
131
|
+
export interface ISingleSelectResponsiveProps extends IBaseProps {
|
|
133
132
|
isOpen: boolean;
|
|
134
133
|
closeDropdown: () => void;
|
|
135
134
|
isLoading?: boolean;
|
|
136
|
-
dataId?: string;
|
|
137
135
|
innerHelperText?: string;
|
|
138
136
|
labelLeftIconProps?: {
|
|
139
137
|
size?: TIconSize;
|
|
@@ -227,7 +225,7 @@ export interface TFilterGroupDropdownContentProps extends IFormCompProps {
|
|
|
227
225
|
onItemDeselect: (item: TSelectedValue) => void;
|
|
228
226
|
checkIsSelected: (item: TItemValue) => boolean;
|
|
229
227
|
}
|
|
230
|
-
export type TSelectWrapperProps = {
|
|
228
|
+
export type TSelectWrapperProps = IBaseProps & {
|
|
231
229
|
isMobile: boolean;
|
|
232
230
|
applySelectedItems: (isChecked: boolean) => void;
|
|
233
231
|
hasError?: boolean;
|
|
@@ -255,7 +253,6 @@ export type TSelectWrapperProps = {
|
|
|
255
253
|
dropdownRef: HTMLDivElement | null;
|
|
256
254
|
setDropdownRef: LegacyRef<HTMLDivElement>;
|
|
257
255
|
selectedValues?: TSelectedValue[];
|
|
258
|
-
dataId?: string;
|
|
259
256
|
type?: 'primary' | 'secondary' | 'tertiary';
|
|
260
257
|
modalApplyButtonText?: string;
|
|
261
258
|
hideSelectedOptions?: boolean;
|
|
@@ -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
|
}
|
|
@@ -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;
|
|
@@ -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();
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { TTableProps } from './types';
|
|
3
|
-
export declare function Table({ columns, data, onChange, fixedHeader, withSelect, handleRowClick, className, language, containerRefHandler, submitButtons }: TTableProps): ReactElement;
|
|
3
|
+
export declare function Table({ columns, data, onChange, fixedHeader, withSelect, handleRowClick, className, language, containerRefHandler, submitButtons, dataId }: TTableProps): ReactElement;
|
|
@@ -11,7 +11,7 @@ import { TABLE_LOCALIZATION } from './localization';
|
|
|
11
11
|
import { setTranslationValue } from '../../utils/helpers';
|
|
12
12
|
import IconCheckmark from '../SVGIcons/IconCheckmark';
|
|
13
13
|
import IconDismiss from '../SVGIcons/IconDismiss';
|
|
14
|
-
export function Table({ columns, data, onChange, fixedHeader, withSelect = false, handleRowClick, className, language = 'en', containerRefHandler, submitButtons }) {
|
|
14
|
+
export function Table({ columns, data, onChange, fixedHeader, withSelect = false, handleRowClick, className, language = 'en', containerRefHandler, submitButtons, dataId = '' }) {
|
|
15
15
|
const tableRef = useRef(null);
|
|
16
16
|
const [tableWidth, setTableWidth] = useState(400);
|
|
17
17
|
const uniqueKey = useId();
|
|
@@ -42,7 +42,7 @@ export function Table({ columns, data, onChange, fixedHeader, withSelect = false
|
|
|
42
42
|
const { getTableProps, getTableBodyProps, selectedFlatRows, headerGroups, rows, prepareRow, toggleAllRowsSelected, state } = useTable({
|
|
43
43
|
columns: sortedColumns,
|
|
44
44
|
data
|
|
45
|
-
}, useSortBy, useRowSelect, (hooks) => setSelectedRows(hooks, withSelect));
|
|
45
|
+
}, useSortBy, useRowSelect, (hooks) => setSelectedRows(hooks, withSelect, dataId));
|
|
46
46
|
const handleResize = useCallback(() => {
|
|
47
47
|
var _a;
|
|
48
48
|
if (tableRef.current) {
|
|
@@ -65,10 +65,10 @@ export function Table({ columns, data, onChange, fixedHeader, withSelect = false
|
|
|
65
65
|
const onClearSelectedRows = useCallback(() => {
|
|
66
66
|
toggleAllRowsSelected(false);
|
|
67
67
|
}, []);
|
|
68
|
-
return (_jsxs("div", { ref: containerRefHandler, children: [withSelect && selectedFlatRows.length > 0 && (_jsxs("div", { className: "table-wrapper__selected-rows", children: [_jsx(Button, { buttonText: setTranslationValue(TABLE_LOCALIZATION[language].n_selected || '', selectedFlatRows.length), onClick: onClearSelectedRows, type: "tertiary", size: "medium", iconProps: { alignment: 'left', Component: IconDismiss } }), submitButtons === null || submitButtons === void 0 ? void 0 : submitButtons.map(({ buttonText, isLoading, onClick, iconProps }) => (_jsx(Button, { iconProps: iconProps || { alignment: 'left', Component: IconCheckmark }, onClick: (event) => {
|
|
68
|
+
return (_jsxs("div", { ref: containerRefHandler, "data-id": dataId, children: [withSelect && selectedFlatRows.length > 0 && (_jsxs("div", { className: "table-wrapper__selected-rows", children: [_jsx(Button, { buttonText: setTranslationValue(TABLE_LOCALIZATION[language].n_selected || '', selectedFlatRows.length), onClick: onClearSelectedRows, type: "tertiary", size: "medium", iconProps: { alignment: 'left', Component: IconDismiss }, dataId: dataId ? `${dataId}-clear-selected` : '' }), submitButtons === null || submitButtons === void 0 ? void 0 : submitButtons.map(({ buttonText, isLoading, onClick, iconProps }, i) => (_jsx(Button, { iconProps: iconProps || { alignment: 'left', Component: IconCheckmark }, onClick: (event) => {
|
|
69
69
|
onClick(event, state, onClearSelectedRows);
|
|
70
|
-
}, buttonText: buttonText || 'Submit', type: "secondary", size: "medium", className: "mr-8", isLoading: isLoading })))] })), _jsx("div", { onScroll: dispatchScrollEvent, className: classNames('table-wrapper scrollbar scrollbar--horizontal scrollbar--vertical', className, { 'table-row-clickable': !!handleRowClick }), style: { maxHeight: fixedHeader === null || fixedHeader === void 0 ? void 0 : fixedHeader.y }, children: _jsxs("table", Object.assign({}, getTableProps(), { ref: tableRef, children: [_jsx("thead", { children: headerGroups.map((headerGroup, i) => (_jsx(Header, { withSelect: withSelect, fixedHeader: Boolean(fixedHeader), headerGroup: headerGroup, tableWidth: tableWidth, uniqueKey: uniqueKey }, `table_head_${uniqueKey}_${i}`))) }), _jsx("tbody", Object.assign({}, getTableBodyProps(), { children: rows.map((row) => {
|
|
70
|
+
}, buttonText: buttonText || 'Submit', type: "secondary", size: "medium", className: "mr-8", isLoading: isLoading, dataId: dataId ? `${dataId}-submit-${i}` : '' })))] })), _jsx("div", { onScroll: dispatchScrollEvent, className: classNames('table-wrapper scrollbar scrollbar--horizontal scrollbar--vertical', className, { 'table-row-clickable': !!handleRowClick }), style: { maxHeight: fixedHeader === null || fixedHeader === void 0 ? void 0 : fixedHeader.y }, children: _jsxs("table", Object.assign({}, getTableProps(), { ref: tableRef, children: [_jsx("thead", { children: headerGroups.map((headerGroup, i) => (_jsx(Header, { withSelect: withSelect, fixedHeader: Boolean(fixedHeader), headerGroup: headerGroup, tableWidth: tableWidth, uniqueKey: uniqueKey, dataId: dataId }, `table_head_${uniqueKey}_${i}`))) }), _jsx("tbody", Object.assign({}, getTableBodyProps(), { children: rows.map((row) => {
|
|
71
71
|
prepareRow(row);
|
|
72
|
-
return (_jsx(Row, { handleRowClick: handleRowClick, withSelect: withSelect, selectedFlatRows: selectedFlatRows, row: row, uniqueKey: uniqueKey }, `table_row_${uniqueKey}_${row.id}`));
|
|
72
|
+
return (_jsx(Row, { handleRowClick: handleRowClick, withSelect: withSelect, selectedFlatRows: selectedFlatRows, row: row, uniqueKey: uniqueKey, dataId: dataId }, `table_row_${uniqueKey}_${row.id}`));
|
|
73
73
|
}) }))] })) })] }));
|
|
74
74
|
}
|
|
@@ -15,7 +15,7 @@ export type TColumn = Column & TColumnFields;
|
|
|
15
15
|
export interface IButtonPropTypes extends Omit<TButtonPropTypes, 'onClick'> {
|
|
16
16
|
onClick: (event: TClickEventType, data: any, clearRowSelection?: () => void) => void;
|
|
17
17
|
}
|
|
18
|
-
export type TTableProps = {
|
|
18
|
+
export type TTableProps = IBaseProps & {
|
|
19
19
|
className?: string;
|
|
20
20
|
columns: TColumn[];
|
|
21
21
|
data: any[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Hooks } from 'react-table';
|
|
2
2
|
export declare const CHECKBOX_HEADER_ID = "selection";
|
|
3
3
|
export declare const CHECKBOX_DEFAULT_WIDTH = 48;
|
|
4
|
-
export declare function setSelectedRows(hooks: Hooks, withSelect: boolean): void;
|
|
4
|
+
export declare function setSelectedRows(hooks: Hooks, withSelect: boolean, dataId?: string): void;
|
|
5
5
|
export declare function calcColumnWidth(percent: number, tableWidth: number): number;
|