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
|
@@ -6,6 +6,6 @@ import { Button } from '../Button';
|
|
|
6
6
|
import IconDismissFilled from '../SVGIcons/IconDismissFilled';
|
|
7
7
|
import { IconDynamicComponent } from '../../helperComponents/IconDynamicComponent';
|
|
8
8
|
export const Alert = (props) => {
|
|
9
|
-
const { buttonProps, type = 'information', position = 'inline', text, subtext, closeIcon, onClose, className = '' } = props;
|
|
10
|
-
return (_jsx("div", { className: classnames('alert', `alert--${type} alert--${position}`, className), children: _jsxs("div", { className: "alert__content", children: [_jsx(IconDynamicComponent, { Component: ICONS_MAPPING[type], size: "small", type: TYPE_MAPPING[type] }), _jsxs("div", { className: "alert__text pl-8", children: [_jsxs("div", { children: [_jsx(Text, { type: "primary", size: "standard", weight: "regular", lineHeight: "large", children: text }), subtext ? (_jsx(Text, { className: 'mt-4', type: "secondary", size: "small", weight: "regular", lineHeight: "large", children: subtext })) : null] }), buttonProps ? (_jsxs("div", { className: "alert__actions", children: [buttonProps.confirm && (_jsx(Button, Object.assign({ size: "medium", type: "secondary" }, buttonProps.confirm))), buttonProps.cancel && (_jsx(Button, Object.assign({ size: "medium", type: "tertiary", className: "ml-12" }, buttonProps.cancel)))] })) : null] }), closeIcon ? (_jsx(IconDismissFilled, { type: TYPE_MAPPING[type], size: "xsmall", className: "ml-12 pointer", onClick: onClose })) : null] }) }));
|
|
9
|
+
const { buttonProps, type = 'information', position = 'inline', text, subtext, closeIcon, onClose, className = '', dataId = '' } = props;
|
|
10
|
+
return (_jsx("div", { className: classnames('alert', `alert--${type} alert--${position}`, className), "data-id": dataId, children: _jsxs("div", { className: "alert__content", children: [_jsx(IconDynamicComponent, { Component: ICONS_MAPPING[type], size: "small", type: TYPE_MAPPING[type], dataId: dataId ? `${dataId}-icon` : '' }), _jsxs("div", { className: "alert__text pl-8", children: [_jsxs("div", { children: [_jsx(Text, { type: "primary", size: "standard", weight: "regular", lineHeight: "large", dataId: dataId ? `${dataId}-text` : '', children: text }), subtext ? (_jsx(Text, { className: 'mt-4', type: "secondary", size: "small", weight: "regular", lineHeight: "large", dataId: dataId ? `${dataId}-subtext` : '', children: subtext })) : null] }), buttonProps ? (_jsxs("div", { className: "alert__actions", children: [buttonProps.confirm && (_jsx(Button, Object.assign({ size: "medium", type: "secondary", dataId: dataId ? `${dataId}-confirm` : '' }, buttonProps.confirm))), buttonProps.cancel && (_jsx(Button, Object.assign({ size: "medium", type: "tertiary", className: "ml-12", dataId: dataId ? `${dataId}-cancel` : '' }, buttonProps.cancel)))] })) : null] }), closeIcon ? (_jsx(IconDismissFilled, { type: TYPE_MAPPING[type], size: "xsmall", className: "ml-12 pointer", onClick: onClose, dataId: dataId ? `${dataId}-close` : '' })) : null] }) }));
|
|
11
11
|
};
|
|
@@ -3,7 +3,6 @@ import { FILE_UPLOAD_ERRORS } from '../../consts';
|
|
|
3
3
|
export interface TAvatarProps extends IFormCompProps {
|
|
4
4
|
allowedTypes?: string;
|
|
5
5
|
id?: string;
|
|
6
|
-
dataId?: string;
|
|
7
6
|
imagePath?: string;
|
|
8
7
|
initials?: string | ReactElement;
|
|
9
8
|
color?: 'default' | 'purple' | 'blue' | 'green' | 'red';
|
|
@@ -17,8 +16,7 @@ export interface TAvatarProps extends IFormCompProps {
|
|
|
17
16
|
fileAllowedSize?: number;
|
|
18
17
|
onAvatarClick?: () => void;
|
|
19
18
|
}
|
|
20
|
-
export interface TAvatarGroupProps {
|
|
21
|
-
dataId?: string;
|
|
19
|
+
export interface TAvatarGroupProps extends IBaseProps {
|
|
22
20
|
avatarGroup: TAvatarProps[];
|
|
23
21
|
onAddUser?: () => void;
|
|
24
22
|
maxCount?: 0 | 2 | 4 | 6;
|
|
@@ -2,6 +2,6 @@ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { Text } from '../Text';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
export const Badge = (props) => {
|
|
5
|
-
const { type = 'primary', size = 'large', text, className = '' } = props;
|
|
6
|
-
return (_jsx("div", { className: classNames(`badge badge--${type} badge--${size}`, className), children: text ? (_jsx(Text, { size: "xsmall", type: type == 'secondary' ? 'primary' : 'inverse', className: "badge__inner", children: _jsx(_Fragment, { children: text }) })) : null }));
|
|
5
|
+
const { type = 'primary', size = 'large', text, className = '', dataId = '' } = props;
|
|
6
|
+
return (_jsx("div", { className: classNames(`badge badge--${type} badge--${size}`, className), "data-id": dataId, children: text ? (_jsx(Text, { size: "xsmall", type: type == 'secondary' ? 'primary' : 'inverse', className: "badge__inner", dataId: dataId ? `${dataId}-text` : '', children: _jsx(_Fragment, { children: text }) })) : null }));
|
|
7
7
|
};
|
|
@@ -4,11 +4,11 @@ import { Text } from '../Text';
|
|
|
4
4
|
import { BadgeSize } from './types';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
6
|
export const BadgeV2 = (props) => {
|
|
7
|
-
const { type = 'blue', style = 'filled', size = BadgeSize.large, text, className = '', iconProps, withDot, dot, disabled } = props;
|
|
7
|
+
const { type = 'blue', style = 'filled', size = BadgeSize.large, text, className = '', iconProps, withDot, dot, disabled, dataId = '' } = props;
|
|
8
8
|
const { size: iconSize = 'small', type: iconType, alignment: iconAlignment = 'left' } = iconProps !== null && iconProps !== void 0 ? iconProps : {};
|
|
9
9
|
const baseClassName = classNames(`badge-v2 badge-v2--${type} badge-v2--${style} badge-v2--${size}`, { 'badge-v2--disabled': disabled }, className);
|
|
10
10
|
if (dot) {
|
|
11
|
-
return _jsx("div", { className: classNames(baseClassName, 'badge-v2--dot') });
|
|
11
|
+
return _jsx("div", { className: classNames(baseClassName, 'badge-v2--dot'), "data-id": dataId });
|
|
12
12
|
}
|
|
13
|
-
return (_jsxs("div", { className: baseClassName, children: [withDot ? (_jsx("div", { className: classNames(baseClassName, 'badge-v2--dot badge-v2--with-dot') })) : null, !withDot && iconProps && iconAlignment === 'left' ? (_jsx(iconProps.Component, { size: iconSize, type: iconType })) : null, typeof text === 'string' || typeof text === 'number' ? (_jsx(Text, { size: "xsmall", className: "badge-v2__inner", children: text })) : React.isValidElement(text) ? (text) : null, !withDot && iconProps && iconAlignment === 'right' ? (_jsx(iconProps.Component, { size: iconSize, type: iconType })) : null] }));
|
|
13
|
+
return (_jsxs("div", { className: baseClassName, "data-id": dataId, children: [withDot ? (_jsx("div", { className: classNames(baseClassName, 'badge-v2--dot badge-v2--with-dot'), "data-id": dataId ? `${dataId}-dot` : '' })) : null, !withDot && iconProps && iconAlignment === 'left' ? (_jsx(iconProps.Component, { size: iconSize, type: iconType, dataId: dataId ? `${dataId}-left-icon` : '' })) : null, typeof text === 'string' || typeof text === 'number' ? (_jsx(Text, { size: "xsmall", className: "badge-v2__inner", dataId: dataId ? `${dataId}-text` : '', children: text })) : React.isValidElement(text) ? (text) : null, !withDot && iconProps && iconAlignment === 'right' ? (_jsx(iconProps.Component, { size: iconSize, type: iconType, dataId: dataId ? `${dataId}-right-icon` : '' })) : null] }));
|
|
14
14
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
export const Breadcrumb = (props) => {
|
|
3
|
-
const { selectedValue, breadCrumbItems, className = '', onSelect } = props;
|
|
4
|
-
return (_jsx("div", { className: `breadcrumb ${className}`, children: breadCrumbItems.map((itemInfo) => {
|
|
5
|
-
return (_jsx("span", { className: "breadcrumb__item", children: _jsx("span", { className: `breadcrumb__item__inner ${selectedValue === itemInfo.value ? 'selected' : ''}`, onClick: () => onSelect(itemInfo.value), children: itemInfo.label }) }, itemInfo.value));
|
|
3
|
+
const { selectedValue, breadCrumbItems, className = '', onSelect, dataId = '' } = props;
|
|
4
|
+
return (_jsx("div", { className: `breadcrumb ${className}`, "data-id": dataId, children: breadCrumbItems.map((itemInfo, index) => {
|
|
5
|
+
return (_jsx("span", { className: "breadcrumb__item", children: _jsx("span", { className: `breadcrumb__item__inner ${selectedValue === itemInfo.value ? 'selected' : ''}`, "data-id": dataId ? `${dataId}-crumb-${index}` : '', onClick: () => onSelect(itemInfo.value), children: itemInfo.label }) }, itemInfo.value));
|
|
6
6
|
}) }));
|
|
7
7
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ButtonHTMLAttributes, LegacyRef, PropsWithChildren, ReactElement } from 'react';
|
|
2
2
|
import { TSVGIconType } from '../../type';
|
|
3
|
-
export interface TButtonPropTypes extends PropsWithChildren<Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'type' | 'children'
|
|
3
|
+
export interface TButtonPropTypes extends PropsWithChildren<Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'type' | 'children'>>, IBaseProps {
|
|
4
4
|
id?: string;
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
pressed?: boolean;
|
|
@@ -18,6 +18,5 @@ export interface TButtonPropTypes extends PropsWithChildren<Omit<ButtonHTMLAttri
|
|
|
18
18
|
};
|
|
19
19
|
onClick?: (event: TClickEventType) => void;
|
|
20
20
|
formId?: string;
|
|
21
|
-
dataId?: string;
|
|
22
21
|
refHandler?: LegacyRef<HTMLButtonElement> | undefined;
|
|
23
22
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { IButtonGroup } from './types';
|
|
2
|
-
export declare const ButtonGroup: ({ buttons, activeIndex, className, type, size, disabled, onTabChange }: IButtonGroup) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const ButtonGroup: ({ buttons, activeIndex, className, type, size, disabled, onTabChange, dataId }: IButtonGroup) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { ButtonGroupItem } from './ButtonGroupItem';
|
|
5
|
-
export const ButtonGroup = ({ buttons, activeIndex = 0, className, type, size, disabled, onTabChange }) => {
|
|
5
|
+
export const ButtonGroup = ({ buttons, activeIndex = 0, className, type, size, disabled, onTabChange, dataId = '' }) => {
|
|
6
6
|
const [activeItem, setActiveItem] = useState(activeIndex);
|
|
7
7
|
const handleItemClick = (index) => {
|
|
8
8
|
if (disabled || activeItem === index)
|
|
@@ -10,7 +10,7 @@ export const ButtonGroup = ({ buttons, activeIndex = 0, className, type, size, d
|
|
|
10
10
|
setActiveItem(index);
|
|
11
11
|
onTabChange === null || onTabChange === void 0 ? void 0 : onTabChange(index);
|
|
12
12
|
};
|
|
13
|
-
return (_jsx("div", { className: classNames('button-group', className), children: buttons.map((button) => {
|
|
14
|
-
return (_jsx(ButtonGroupItem, Object.assign({}, button, { type: type, size: size, isActive: activeItem === button.id, disabled: disabled, onClick: () => handleItemClick(button.id) }), `buttonGroup_${button.id}`));
|
|
13
|
+
return (_jsx("div", { className: classNames('button-group', className), "data-id": dataId, children: buttons.map((button, index) => {
|
|
14
|
+
return (_jsx(ButtonGroupItem, Object.assign({}, button, { type: type, size: size, isActive: activeItem === button.id, disabled: disabled, dataId: dataId ? `${dataId}-item-${index}` : '', onClick: () => handleItemClick(button.id) }), `buttonGroup_${button.id}`));
|
|
15
15
|
}) }));
|
|
16
16
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { IButtonGroupItem } from './types';
|
|
2
|
-
export declare const ButtonGroupItem: ({ buttonText, size, type, isActive, disabled, onClick, className, icons }: IButtonGroupItem) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const ButtonGroupItem: ({ buttonText, size, type, isActive, disabled, onClick, className, icons, dataId }: IButtonGroupItem) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,7 +3,7 @@ import { useMemo } from 'react';
|
|
|
3
3
|
import { Text } from '../Text';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
import { ICON_SIZE_MAPPING, TEXT_SIZE_MAPPING } from './consts';
|
|
6
|
-
export const ButtonGroupItem = ({ buttonText, size = 'medium', type = 'primary', isActive, disabled, onClick, className, icons }) => {
|
|
6
|
+
export const ButtonGroupItem = ({ buttonText, size = 'medium', type = 'primary', isActive, disabled, onClick, className, icons, dataId = '' }) => {
|
|
7
7
|
var _a, _b;
|
|
8
8
|
const onClickHandler = (event) => {
|
|
9
9
|
event.preventDefault();
|
|
@@ -19,5 +19,5 @@ export const ButtonGroupItem = ({ buttonText, size = 'medium', type = 'primary',
|
|
|
19
19
|
}
|
|
20
20
|
return 'tertiary';
|
|
21
21
|
}, [disabled, isActive]);
|
|
22
|
-
return (_jsxs("div", { className: classNames('button-group-item', `button-group-item__${type}`, `button-group-item__${size}`, { active: isActive, disabled }, className), onClick: onClickHandler, children: [((_a = icons === null || icons === void 0 ? void 0 : icons.left) === null || _a === void 0 ? void 0 : _a.Component) ? (_jsx(icons.left.Component, { size: ICON_SIZE_MAPPING[size], type: iconType })) : null, _jsx(Text, { size: TEXT_SIZE_MAPPING[size], type: iconType, children: buttonText }), ((_b = icons === null || icons === void 0 ? void 0 : icons.right) === null || _b === void 0 ? void 0 : _b.Component) ? (_jsx(icons.right.Component, { size: ICON_SIZE_MAPPING[size], type: iconType })) : null] }));
|
|
22
|
+
return (_jsxs("div", { className: classNames('button-group-item', `button-group-item__${type}`, `button-group-item__${size}`, { active: isActive, disabled }, className), "data-id": dataId, onClick: onClickHandler, children: [((_a = icons === null || icons === void 0 ? void 0 : icons.left) === null || _a === void 0 ? void 0 : _a.Component) ? (_jsx(icons.left.Component, { dataId: dataId ? `${dataId}-left-icon` : '', size: ICON_SIZE_MAPPING[size], type: iconType })) : null, _jsx(Text, { dataId: dataId ? `${dataId}-text` : '', size: TEXT_SIZE_MAPPING[size], type: iconType, children: buttonText }), ((_b = icons === null || icons === void 0 ? void 0 : icons.right) === null || _b === void 0 ? void 0 : _b.Component) ? (_jsx(icons.right.Component, { dataId: dataId ? `${dataId}-right-icon` : '', size: ICON_SIZE_MAPPING[size], type: iconType })) : null] }));
|
|
23
23
|
};
|
|
@@ -4,7 +4,7 @@ export type TCardTitle = {
|
|
|
4
4
|
text: string;
|
|
5
5
|
color: 'blue' | 'purple' | 'yellow' | 'pink' | 'green' | 'grey';
|
|
6
6
|
};
|
|
7
|
-
export type TCardProps = {
|
|
7
|
+
export type TCardProps = IBaseProps & {
|
|
8
8
|
title?: TCardTitle;
|
|
9
9
|
isExpandable?: boolean;
|
|
10
10
|
isExpanded?: boolean;
|
|
@@ -15,5 +15,4 @@ export type TCardProps = {
|
|
|
15
15
|
children: ReactNode;
|
|
16
16
|
className?: string;
|
|
17
17
|
id?: string;
|
|
18
|
-
dataId?: string;
|
|
19
18
|
};
|
|
@@ -4,11 +4,10 @@ export type TCardGroupTitle = {
|
|
|
4
4
|
text: string;
|
|
5
5
|
color: 'blue' | 'purple' | 'yellow' | 'pink' | 'green' | 'grey';
|
|
6
6
|
};
|
|
7
|
-
export type TCardGroupProps = {
|
|
7
|
+
export type TCardGroupProps = IBaseProps & {
|
|
8
8
|
title?: TCardGroupTitle;
|
|
9
9
|
children: ReactNode;
|
|
10
10
|
className?: string;
|
|
11
11
|
id?: string;
|
|
12
|
-
dataId?: string;
|
|
13
12
|
noDivider?: boolean;
|
|
14
13
|
};
|
|
@@ -8,26 +8,24 @@ export interface ICollapseTitleProps {
|
|
|
8
8
|
export interface TCollapseItemTitle extends ICollapseTitleProps {
|
|
9
9
|
text: string | ReactNode;
|
|
10
10
|
}
|
|
11
|
-
export type TCollapseProps = {
|
|
11
|
+
export type TCollapseProps = IBaseProps & {
|
|
12
12
|
isOpen: boolean;
|
|
13
13
|
toggle: () => void;
|
|
14
14
|
children: ReactNode;
|
|
15
15
|
title: TCollapseItemTitle;
|
|
16
16
|
reverse?: boolean;
|
|
17
17
|
additionalInfo?: ReactNode;
|
|
18
|
-
dataId?: string | undefined;
|
|
19
18
|
labelLeftIconProps?: TSelectIconProps;
|
|
20
19
|
id?: string | number;
|
|
21
20
|
className?: string;
|
|
22
21
|
};
|
|
23
22
|
export type TCollapseValue = string | number;
|
|
24
|
-
export type TCollapseItem = {
|
|
23
|
+
export type TCollapseItem = IBaseProps & {
|
|
25
24
|
title: string;
|
|
26
25
|
value: TCollapseValue;
|
|
27
26
|
content?: ReactElement | null;
|
|
28
27
|
iconProps?: TSelectIconProps;
|
|
29
28
|
isOpen?: boolean;
|
|
30
|
-
dataId?: string;
|
|
31
29
|
id?: string | number;
|
|
32
30
|
};
|
|
33
31
|
export type TCollapseGroupProps = {
|
|
@@ -39,14 +37,13 @@ export type TCollapseGroupProps = {
|
|
|
39
37
|
export interface TCollapseItemTitleV2 extends ICollapseTitleProps {
|
|
40
38
|
text?: string | ReactNode;
|
|
41
39
|
}
|
|
42
|
-
export type TCollapseV2Props = {
|
|
40
|
+
export type TCollapseV2Props = IBaseProps & {
|
|
43
41
|
isOpen?: boolean;
|
|
44
42
|
toggle?: (isOpen: boolean) => void;
|
|
45
43
|
children: ReactNode;
|
|
46
44
|
title: TCollapseItemTitleV2;
|
|
47
45
|
iconAlignment?: 'left' | 'right';
|
|
48
46
|
hasIconBorder?: boolean;
|
|
49
|
-
dataId?: string | undefined;
|
|
50
47
|
id?: string | number;
|
|
51
48
|
className?: string;
|
|
52
49
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
export const Container = (props) => {
|
|
3
|
-
const { children } = props;
|
|
4
|
-
return _jsx("div", { className: "container", children: children });
|
|
3
|
+
const { children, dataId = '' } = props;
|
|
4
|
+
return (_jsx("div", { className: "container", "data-id": dataId, children: children }));
|
|
5
5
|
};
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
export declare const DarkModeSwitcher: React.ForwardRefExoticComponent<IBaseProps & {
|
|
3
3
|
checked: boolean;
|
|
4
4
|
onChange: (checked: boolean) => void;
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
id?: string;
|
|
7
7
|
name?: string;
|
|
8
8
|
className?: string;
|
|
9
|
-
}
|
|
10
|
-
export declare const DarkModeSwitcher: React.ForwardRefExoticComponent<DarkModeSwitcherProps & React.RefAttributes<HTMLInputElement>>;
|
|
11
|
-
export {};
|
|
9
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -3,13 +3,13 @@ import { forwardRef } from 'react';
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import IconMoon from '../SVGIcons/IconMoon';
|
|
5
5
|
import IconSun from '../SVGIcons/IconSun';
|
|
6
|
-
export const DarkModeSwitcher = forwardRef(({ checked, onChange, disabled = false, id = 'dark-mode-switcher', name, className }, ref) => {
|
|
6
|
+
export const DarkModeSwitcher = forwardRef(({ checked, onChange, disabled = false, id = 'dark-mode-switcher', name, className, dataId = '' }, ref) => {
|
|
7
7
|
const _onChange = (e) => {
|
|
8
8
|
if (disabled) {
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
11
|
onChange(e.target.checked);
|
|
12
12
|
};
|
|
13
|
-
return (_jsx("label", { className: classNames('theme-switch', className, { 'is-disabled': disabled }), htmlFor: id, children: _jsxs("span", { className: classNames('theme-switch__track', { 'is-checked': checked }), children: [_jsx("span", { className: "theme-switch__icon theme-switch__icon--sun", "aria-hidden": "true", children: _jsx(IconSun, { size: "xsmall" }) }), _jsx("input", { ref: ref, id: id, name: name, type: "checkbox", checked: checked, disabled: disabled, onChange: _onChange, className: "theme-switch__input" }), _jsx("span", { className: "theme-switch__thumb", "aria-hidden": "true" }), _jsx("span", { className: "theme-switch__icon theme-switch__icon--moon", "aria-hidden": "true", children: _jsx(IconMoon, { size: "xsmall" }) })] }) }));
|
|
13
|
+
return (_jsx("label", { className: classNames('theme-switch', className, { 'is-disabled': disabled }), htmlFor: id, "data-id": dataId, children: _jsxs("span", { className: classNames('theme-switch__track', { 'is-checked': checked }), children: [_jsx("span", { className: "theme-switch__icon theme-switch__icon--sun", "aria-hidden": "true", children: _jsx(IconSun, { size: "xsmall", dataId: dataId ? `${dataId}-sun-icon` : '' }) }), _jsx("input", { ref: ref, id: id, name: name, type: "checkbox", checked: checked, disabled: disabled, onChange: _onChange, className: "theme-switch__input", "data-id": dataId ? `${dataId}-input` : '' }), _jsx("span", { className: "theme-switch__thumb", "aria-hidden": "true" }), _jsx("span", { className: "theme-switch__icon theme-switch__icon--moon", "aria-hidden": "true", children: _jsx(IconMoon, { size: "xsmall", dataId: dataId ? `${dataId}-moon-icon` : '' }) })] }) }));
|
|
14
14
|
});
|
|
15
15
|
DarkModeSwitcher.displayName = 'DarkModeSwitcher';
|
|
@@ -2,7 +2,6 @@ import { DatePickerProps } from 'react-datepicker';
|
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
type DatePickerDefaultProps = Omit<IFormCompProps, 'value'> & Omit<DatePickerProps, 'onChange' | 'value'>;
|
|
4
4
|
export interface TDatepickerBaseProps extends DatePickerDefaultProps {
|
|
5
|
-
dataId?: string;
|
|
6
5
|
dataIdPrefix?: string;
|
|
7
6
|
label?: ReactNode;
|
|
8
7
|
format?: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import classnames from 'classnames';
|
|
3
3
|
export const Divider = (props) => {
|
|
4
|
-
const { type = 'primary', isHorizontal, className, color = 'light-grey' } = props;
|
|
5
|
-
return (_jsx("hr", { className: classnames('divider', `divider--${type}`, `divider--${color}`, {
|
|
4
|
+
const { type = 'primary', isHorizontal, className, color = 'light-grey', dataId = '' } = props;
|
|
5
|
+
return (_jsx("hr", { "data-id": dataId, className: classnames('divider', `divider--${type}`, `divider--${color}`, {
|
|
6
6
|
'divider--horizontal': isHorizontal,
|
|
7
7
|
'divider--vertical': !isHorizontal
|
|
8
8
|
}, className) }));
|
|
@@ -6,6 +6,7 @@ import classNames from 'classnames';
|
|
|
6
6
|
// @ts-ignore
|
|
7
7
|
import noResultImage from '../../assets/images/no-result.svg';
|
|
8
8
|
export const Empty = (props) => {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
var _a;
|
|
10
|
+
const { size = 'large', mainMessage, paragraphMessage, buttonProps, className, illustration = noResultImage, dataId = '' } = props;
|
|
11
|
+
return (_jsxs("div", { "data-id": dataId, className: classNames(`no-result ${size == 'large' ? 'no-result--large' : 'no-result--small'}`, className), children: [_jsx("div", { className: "no-result__icon", children: _jsx(Image, { imagePath: illustration, dataId: dataId ? `${dataId}-image` : '' }) }), _jsxs("div", { className: "no-result__content", children: [mainMessage ? (_jsx(Text, { size: size == 'large' ? 'large' : 'small', weight: "bold", dataId: dataId ? `${dataId}-text` : '', children: mainMessage })) : null, paragraphMessage ? (_jsx(Text, { size: size == 'large' ? 'small' : 'xsmall', dataId: dataId ? `${dataId}-subtext` : '', children: paragraphMessage })) : null, buttonProps ? (_jsx(Button, Object.assign({}, buttonProps, { size: "medium", className: "mt-4", dataId: (_a = buttonProps.dataId) !== null && _a !== void 0 ? _a : (dataId ? `${dataId}-action` : '') }))) : null] })] }));
|
|
11
12
|
};
|
|
@@ -10,7 +10,7 @@ import { generateAreaContent, getDropzoneLocale } from './helpers';
|
|
|
10
10
|
import { ErrorItem } from './ErrorItem';
|
|
11
11
|
import { PreviewItem } from './PreviewItem';
|
|
12
12
|
import { uniqueFiles as _uniqueFiles } from '../../../utils/helpers';
|
|
13
|
-
export const DropzoneFileUpload = forwardRef(({ maxSize = 10 * 1024 * 1024, allowedTypes = [FileTypeEnum.IMAGE, FileTypeEnum.PDF, FileTypeEnum.DOC], name, setFiles, setFieldValue, value, selectedFiles, maxFiles = 1, mode = FileUploadMode.attach, locale, multiple = false }, _ref) => {
|
|
13
|
+
export const DropzoneFileUpload = forwardRef(({ maxSize = 10 * 1024 * 1024, allowedTypes = [FileTypeEnum.IMAGE, FileTypeEnum.PDF, FileTypeEnum.DOC], name, setFiles, setFieldValue, value, selectedFiles, maxFiles = 1, mode = FileUploadMode.attach, locale, multiple = false, dataId = '' }, _ref) => {
|
|
14
14
|
const initialFiles = value || selectedFiles || [];
|
|
15
15
|
const initialMaxFiles = initialFiles.length >= maxFiles ? 0 : maxFiles - initialFiles.length;
|
|
16
16
|
const [errors, setErrors] = useState([]);
|
|
@@ -55,13 +55,13 @@ export const DropzoneFileUpload = forwardRef(({ maxSize = 10 * 1024 * 1024, allo
|
|
|
55
55
|
setFieldValue(name, values);
|
|
56
56
|
}
|
|
57
57
|
}, [name, setFieldValue]);
|
|
58
|
-
return (_jsxs("div", { className: "dz-file-upload", children: [mode !== FileUploadMode.view ? (_jsxs("div", Object.assign({}, getRootProps(), { className: classnames('dz-file-upload__area', {
|
|
58
|
+
return (_jsxs("div", { className: "dz-file-upload", "data-id": dataId, children: [mode !== FileUploadMode.view ? (_jsxs("div", Object.assign({}, getRootProps(), { className: classnames('dz-file-upload__area', {
|
|
59
59
|
'dz-file-upload__area--focused': isFocused,
|
|
60
60
|
'dz-file-upload__area--active': isDragActive
|
|
61
|
-
}), children: [_jsx(IconUpload, { className: "mb-20", size: "xlarge" }), _jsx("input", Object.assign({}, getInputProps(), { name: name })), _jsx(Text, { type: "primary", weight: "semibold", className: "mb-6", children: translation.title }), _jsx(Text, { size: "small", children: `${areaContent.acceptTypesMessage} ${(allowedTypes === null || allowedTypes === void 0 ? void 0 : allowedTypes.length) === 1 ? translation.format : translation.formats}, ${translation.maxSize.replace('$1', areaContent.maxSizeFormatted)}` })] }))) : null, _jsxs("div", { className: "dz-file-upload__files", children: [errors.map(({ code }, index) => {
|
|
62
|
-
return (_jsx(ErrorItem, { code: code, areaContent: areaContent, onRemove: () => removeError(index), locale: locale }, index));
|
|
61
|
+
}), "data-id": dataId ? `${dataId}-dropzone` : '', children: [_jsx(IconUpload, { className: "mb-20", size: "xlarge" }), _jsx("input", Object.assign({}, getInputProps(), { name: name, "data-id": dataId ? `${dataId}-input` : '' })), _jsx(Text, { type: "primary", weight: "semibold", className: "mb-6", children: translation.title }), _jsx(Text, { size: "small", children: `${areaContent.acceptTypesMessage} ${(allowedTypes === null || allowedTypes === void 0 ? void 0 : allowedTypes.length) === 1 ? translation.format : translation.formats}, ${translation.maxSize.replace('$1', areaContent.maxSizeFormatted)}` })] }))) : null, _jsxs("div", { className: "dz-file-upload__files", children: [errors.map(({ code }, index) => {
|
|
62
|
+
return (_jsx(ErrorItem, { code: code, areaContent: areaContent, onRemove: () => removeError(index), locale: locale, dataId: dataId ? `${dataId}-error-${index}` : '' }, index));
|
|
63
63
|
}), initialFiles.map((file, index) => {
|
|
64
|
-
return (_jsx(PreviewItem, { file: file, onRemove: () => removeFile(file.name), mode: mode }, index));
|
|
64
|
+
return (_jsx(PreviewItem, { file: file, onRemove: () => removeFile(file.name), mode: mode, dataId: dataId ? `${dataId}-item-${index}` : '' }, index));
|
|
65
65
|
})] })] }));
|
|
66
66
|
});
|
|
67
67
|
DropzoneFileUpload.displayName = 'DropzoneFileUpload';
|
|
@@ -5,6 +5,7 @@ interface IErrorItemProps {
|
|
|
5
5
|
areaContent: AreaContentDTO;
|
|
6
6
|
onRemove: () => void;
|
|
7
7
|
locale?: string;
|
|
8
|
+
dataId?: string;
|
|
8
9
|
}
|
|
9
|
-
export declare const ErrorItem: ({ code, onRemove, areaContent, locale }: IErrorItemProps) => ReactElement | null;
|
|
10
|
+
export declare const ErrorItem: ({ code, onRemove, areaContent, locale, dataId }: IErrorItemProps) => ReactElement | null;
|
|
10
11
|
export {};
|
|
@@ -3,7 +3,7 @@ import { useMemo } from 'react';
|
|
|
3
3
|
import { ErrorCode } from 'react-dropzone';
|
|
4
4
|
import { Alert } from '../../Alert';
|
|
5
5
|
import { getDropzoneLocale } from './helpers';
|
|
6
|
-
export const ErrorItem = ({ code, onRemove, areaContent, locale }) => {
|
|
6
|
+
export const ErrorItem = ({ code, onRemove, areaContent, locale, dataId = '' }) => {
|
|
7
7
|
const errorMessage = useMemo(() => {
|
|
8
8
|
const translation = getDropzoneLocale(locale);
|
|
9
9
|
if (code === ErrorCode.FileInvalidType) {
|
|
@@ -17,5 +17,5 @@ export const ErrorItem = ({ code, onRemove, areaContent, locale }) => {
|
|
|
17
17
|
}
|
|
18
18
|
return '';
|
|
19
19
|
}, [code]);
|
|
20
|
-
return errorMessage ? (_jsx(Alert, { type: "error", text: errorMessage, closeIcon: true, onClose: onRemove })) : null;
|
|
20
|
+
return errorMessage ? (_jsx(Alert, { type: "error", text: errorMessage, closeIcon: true, onClose: onRemove, dataId: dataId })) : null;
|
|
21
21
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { FileType, FileUploadMode } from '../types';
|
|
3
|
-
export declare const PreviewItem: ({ file, onRemove, mode }: {
|
|
3
|
+
export declare const PreviewItem: ({ file, onRemove, mode, dataId }: {
|
|
4
4
|
file: FileType;
|
|
5
5
|
onRemove: () => void;
|
|
6
6
|
mode: FileUploadMode;
|
|
7
|
+
dataId?: string;
|
|
7
8
|
}) => ReactElement;
|
|
@@ -9,7 +9,7 @@ import { formatFileSize, shortenFileName } from './helpers';
|
|
|
9
9
|
import IconArrowDownloadFilled from '../../SVGIcons/IconArrowDownloadFilled';
|
|
10
10
|
import classnames from 'classnames';
|
|
11
11
|
import { downloadFile } from '../../../helpers';
|
|
12
|
-
export const PreviewItem = ({ file, onRemove, mode }) => {
|
|
12
|
+
export const PreviewItem = ({ file, onRemove, mode, dataId = '' }) => {
|
|
13
13
|
const type = file.type.split('/')[0];
|
|
14
14
|
const preview = useMemo(() => {
|
|
15
15
|
return URL.createObjectURL(file);
|
|
@@ -26,5 +26,5 @@ export const PreviewItem = ({ file, onRemove, mode }) => {
|
|
|
26
26
|
};
|
|
27
27
|
return (_jsxs("div", { className: classnames('dz-file-upload__files--item', {
|
|
28
28
|
'dz-file-upload__files--item--view': mode === FileUploadMode.view
|
|
29
|
-
}), onClick: handleItemClick, children: [_jsx("div", { className: 'dz-file-upload__files--item__preview', children: _jsx(FilePreview, { preview: preview, type: type }) }), _jsxs("div", { className: 'dz-file-upload__files--item__info', children: [_jsxs("div", { className: "dz-file-upload__files--item__info-title", children: [_jsx(Text, { weight: "semibold", children: shortenFileName(file.name, 40) }), mode === FileUploadMode.attach && (_jsx(Button, { size: "small", type: "tertiary", onClick: onRemove, iconProps: { Component: IconDelete } })), mode === FileUploadMode.view && (_jsx(Button, { size: "small", type: "tertiary", onClick: onFileDownload, iconProps: { Component: IconArrowDownloadFilled } }))] }), _jsx("div", { className: "dz-file-upload__files--item__info-size", children: _jsx(Text, { size: "small", children: formatFileSize(file.size) }) })] })] }));
|
|
29
|
+
}), "data-id": dataId, onClick: handleItemClick, children: [_jsx("div", { className: 'dz-file-upload__files--item__preview', children: _jsx(FilePreview, { preview: preview, type: type }) }), _jsxs("div", { className: 'dz-file-upload__files--item__info', children: [_jsxs("div", { className: "dz-file-upload__files--item__info-title", children: [_jsx(Text, { weight: "semibold", dataId: dataId ? `${dataId}-text` : '', children: shortenFileName(file.name, 40) }), mode === FileUploadMode.attach && (_jsx(Button, { size: "small", type: "tertiary", onClick: onRemove, iconProps: { Component: IconDelete }, dataId: dataId ? `${dataId}-close` : '' })), mode === FileUploadMode.view && (_jsx(Button, { size: "small", type: "tertiary", onClick: onFileDownload, iconProps: { Component: IconArrowDownloadFilled }, dataId: dataId ? `${dataId}-action` : '' }))] }), _jsx("div", { className: "dz-file-upload__files--item__info-size", children: _jsx(Text, { size: "small", dataId: dataId ? `${dataId}-size` : '', children: formatFileSize(file.size) }) })] })] }));
|
|
30
30
|
};
|
|
@@ -10,7 +10,7 @@ import IconEditFilled from '../SVGIcons/IconEditFilled';
|
|
|
10
10
|
import IconEdit from '../SVGIcons/IconEdit';
|
|
11
11
|
import IconAttach from '../SVGIcons/IconAttach';
|
|
12
12
|
export const FileUpload = (props) => {
|
|
13
|
-
const { allowedTypes = 'application/pdf, .png, .jpg, .jpeg, image/jpeg, image/png, image/jpg, text/plain, image/*, .pdf, .doc, .docx, application/vnd', label, getFiles, removeFiles, handleFileClick, name, setFieldValue, toBase64, required, disabled, buttonText, withFilePreview = true, multiple = true, uploadedFiles, value, labelAddons, onError, fileAllowedSize, mode = FileUploadMode.attach } = props;
|
|
13
|
+
const { allowedTypes = 'application/pdf, .png, .jpg, .jpeg, image/jpeg, image/png, image/jpg, text/plain, image/*, .pdf, .doc, .docx, application/vnd', label, getFiles, removeFiles, handleFileClick, name, setFieldValue, toBase64, required, disabled, buttonText, withFilePreview = true, multiple = true, uploadedFiles, value, labelAddons, onError, fileAllowedSize, mode = FileUploadMode.attach, dataId = '' } = props;
|
|
14
14
|
const files = value || uploadedFiles || [];
|
|
15
15
|
const fileInputRef = useRef(null);
|
|
16
16
|
const [isHovered, setHoverState] = useState(false);
|
|
@@ -66,5 +66,5 @@ export const FileUpload = (props) => {
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
}, [files, removeFiles]);
|
|
69
|
-
return (_jsxs("div", { className: "file-upload", children: [_jsx(Label, { text: label, required: required, disabled: disabled, labelAddons: labelAddons }), _jsxs("div", { className: "file-upload__inner", children: [_jsx("input", { name: name, type: "file", multiple: multiple, className: "hide", ref: fileInputRef, accept: allowedTypes, onChange: handleChange }), mode === FileUploadMode.edit && (_jsx("div", { className: "edit__icon", onMouseEnter: onMouseEnterOrLeave, onMouseLeave: onMouseEnterOrLeave, onClick: onUploadClick, children: isHovered ? (_jsx(IconEditFilled, { size: "xxsmall", type: "secondary" })) : (_jsx(IconEdit, { size: "xxsmall", type: "secondary" })) })), mode === FileUploadMode.attach && (_jsx(Button, { type: "secondary", size: "medium", disabled: disabled, iconProps: { Component: IconAttach }, onClick: onUploadClick, buttonText: buttonText })), _jsx(UploadItems, { handleFileClick: handleFileClick, onRemove: handleFileRemove, files: files, withFilePreview: withFilePreview })] })] }));
|
|
69
|
+
return (_jsxs("div", { className: "file-upload", "data-id": dataId, children: [_jsx(Label, { text: label, required: required, disabled: disabled, labelAddons: labelAddons, dataId: dataId ? `${dataId}-label` : '' }), _jsxs("div", { className: "file-upload__inner", children: [_jsx("input", { name: name, type: "file", multiple: multiple, className: "hide", ref: fileInputRef, accept: allowedTypes, "data-id": dataId ? `${dataId}-input` : '', onChange: handleChange }), mode === FileUploadMode.edit && (_jsx("div", { className: "edit__icon", "data-id": dataId ? `${dataId}-trigger` : '', onMouseEnter: onMouseEnterOrLeave, onMouseLeave: onMouseEnterOrLeave, onClick: onUploadClick, children: isHovered ? (_jsx(IconEditFilled, { size: "xxsmall", type: "secondary" })) : (_jsx(IconEdit, { size: "xxsmall", type: "secondary" })) })), mode === FileUploadMode.attach && (_jsx(Button, { type: "secondary", size: "medium", disabled: disabled, iconProps: { Component: IconAttach }, onClick: onUploadClick, buttonText: buttonText, dataId: dataId ? `${dataId}-action` : '' })), _jsx(UploadItems, { handleFileClick: handleFileClick, onRemove: handleFileRemove, files: files, withFilePreview: withFilePreview, dataId: dataId })] })] }));
|
|
70
70
|
};
|
|
@@ -6,17 +6,17 @@ import { ErrorMessage } from '../../helperComponents/ErrorMessage';
|
|
|
6
6
|
import { Button } from '../Button';
|
|
7
7
|
import IconDelete from '../SVGIcons/IconDelete';
|
|
8
8
|
export const UploadItems = (props) => {
|
|
9
|
-
const { files, onRemove, withFilePreview, handleFileClick } = props;
|
|
9
|
+
const { files, onRemove, withFilePreview, handleFileClick, dataId = '' } = props;
|
|
10
10
|
const { errors } = useFormProps();
|
|
11
11
|
const filesErrors = errors && errors.files && errors.files.length > 0;
|
|
12
12
|
return (_jsx(_Fragment, { children: files.map((file, index) => {
|
|
13
13
|
var _a, _b;
|
|
14
|
-
return (_jsx("div", { className: `upload-item mt-4 ${filesErrors && ((_a = errors.files[index]) === null || _a === void 0 ? void 0 : _a.message) ? 'upload-item--error' : ''}`, children: _jsx("div", { className: "upload-item__inner", children: _jsxs("div", { className: "upload-item__content mb-2", children: [_jsxs("div", { className: "upload-item__content__inner pr-8", children: [_jsx(Text, { size: "small", lineHeight: "medium", className: "upload-item__text", onClick: (e) => withFilePreview &&
|
|
14
|
+
return (_jsx("div", { className: `upload-item mt-4 ${filesErrors && ((_a = errors.files[index]) === null || _a === void 0 ? void 0 : _a.message) ? 'upload-item--error' : ''}`, "data-id": dataId ? `${dataId}-item-${index}` : '', children: _jsx("div", { className: "upload-item__inner", children: _jsxs("div", { className: "upload-item__content mb-2", children: [_jsxs("div", { className: "upload-item__content__inner pr-8", children: [_jsx(Text, { size: "small", lineHeight: "medium", className: "upload-item__text", dataId: dataId ? `${dataId}-item-${index}-text` : '', onClick: (e) => withFilePreview &&
|
|
15
15
|
openFileInNewWindow({
|
|
16
16
|
e,
|
|
17
17
|
file,
|
|
18
18
|
handleFileClick
|
|
19
|
-
}), children: file.name }), filesErrors && _jsx(ErrorMessage, { message: (_b = errors.files[index]) === null || _b === void 0 ? void 0 : _b.message })] }), _jsx(Button, { type: "tertiary", size: "small", iconProps: { Component: IconDelete }, onClick: () => {
|
|
19
|
+
}), children: file.name }), filesErrors && (_jsx(ErrorMessage, { message: (_b = errors.files[index]) === null || _b === void 0 ? void 0 : _b.message, dataId: dataId ? `${dataId}-item-${index}` : '' }))] }), _jsx(Button, { type: "tertiary", size: "small", iconProps: { Component: IconDelete }, dataId: dataId ? `${dataId}-item-${index}-close` : '', onClick: () => {
|
|
20
20
|
onRemove(file, index);
|
|
21
21
|
} })] }) }) }, index));
|
|
22
22
|
}) }));
|
|
@@ -26,7 +26,7 @@ export declare enum FileUploadMode {
|
|
|
26
26
|
attach = "attach",
|
|
27
27
|
view = "view"
|
|
28
28
|
}
|
|
29
|
-
export interface IUploadItemPropTypes {
|
|
29
|
+
export interface IUploadItemPropTypes extends IBaseProps {
|
|
30
30
|
name?: string;
|
|
31
31
|
onRemove: (file: File, index: number) => void;
|
|
32
32
|
fileType?: string;
|
|
@@ -7,7 +7,7 @@ import classnames from 'classnames';
|
|
|
7
7
|
import { FormContext } from '../../context';
|
|
8
8
|
import { Button } from '../Button';
|
|
9
9
|
export const FormContainer = (props) => {
|
|
10
|
-
const { children, className = '', shouldUnregister, shouldFocusError = true, mode = 'onBlur', initialValues, validationScheme, buttonConfigs, formId, language, onSubmit } = props;
|
|
10
|
+
const { children, className = '', shouldUnregister, shouldFocusError = true, mode = 'onBlur', initialValues, validationScheme, buttonConfigs, formId, language, onSubmit, dataId = '' } = props;
|
|
11
11
|
const { handleSubmit, register, setValue, control, formState, getValues, watch, reset, clearErrors, setError, trigger, getFieldState, unregister } = useForm({
|
|
12
12
|
mode: mode,
|
|
13
13
|
resolver: yupResolver(validationScheme),
|
|
@@ -29,7 +29,7 @@ export const FormContainer = (props) => {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
}, [language]);
|
|
32
|
-
return (_jsx("form", { onSubmit: handleSubmit(customSubmit), id: formId, className: classnames('form-container', className), children: _jsx(FormContext.Provider, { value: {
|
|
32
|
+
return (_jsx("form", { onSubmit: handleSubmit(customSubmit), id: formId, "data-id": dataId, className: classnames('form-container', className), children: _jsx(FormContext.Provider, { value: {
|
|
33
33
|
trigger,
|
|
34
34
|
register,
|
|
35
35
|
errors,
|
|
@@ -48,7 +48,7 @@ export const FormContainer = (props) => {
|
|
|
48
48
|
unregister,
|
|
49
49
|
isValid,
|
|
50
50
|
onSubmit: () => handleSubmit(customSubmit)()
|
|
51
|
-
}, children: _jsxs(_Fragment, { children: [children, buttonConfigs && (_jsx("div", { className: "form-container__buttons", children: buttonConfigs.map((buttonConfig, index) => {
|
|
52
|
-
return _createElement(Button, Object.assign({}, buttonConfig, { key: index }));
|
|
51
|
+
}, children: _jsxs(_Fragment, { children: [children, buttonConfigs && (_jsx("div", { className: "form-container__buttons", "data-id": dataId ? `${dataId}-buttons` : '', children: buttonConfigs.map((buttonConfig, index) => {
|
|
52
|
+
return (_createElement(Button, Object.assign({}, buttonConfig, { key: index, dataId: dataId ? `${dataId}-button-${index}` : buttonConfig.dataId })));
|
|
53
53
|
}) }))] }) }) }));
|
|
54
54
|
};
|
|
@@ -5,7 +5,7 @@ import { TButtonPropTypes } from '../Button/types';
|
|
|
5
5
|
export type TDirtyFields = Partial<Readonly<{
|
|
6
6
|
[x: string]: unknown;
|
|
7
7
|
}>>;
|
|
8
|
-
export interface FormPropTypes {
|
|
8
|
+
export interface FormPropTypes extends IBaseProps {
|
|
9
9
|
className?: string;
|
|
10
10
|
onSubmit?: (data: TFormData, formState: FormState<TFormData>, dirtyFields?: TDirtyFields) => void;
|
|
11
11
|
children?: ReactNode;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
export interface TFormFieldPropTypes {
|
|
1
|
+
export interface TFormFieldPropTypes extends IBaseProps {
|
|
2
2
|
As: (props: IFormCompProps) => React.ReactElement;
|
|
3
3
|
name: string;
|
|
4
4
|
className?: string;
|
|
5
|
-
dataId?: string;
|
|
6
5
|
hideErrorMessage?: boolean;
|
|
7
6
|
errorMessageIcon?: string;
|
|
8
7
|
defaultValue?: any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ElementType, ReactNode } from 'react';
|
|
2
|
-
export interface HeadingPropTypes {
|
|
2
|
+
export interface HeadingPropTypes extends IBaseProps {
|
|
3
3
|
children?: ReactNode;
|
|
4
4
|
type?: ElementType;
|
|
5
5
|
size?: 'xsmall' | 'small' | 'standard' | 'medium' | 'large' | 'xlarge';
|
|
@@ -7,5 +7,4 @@ export interface HeadingPropTypes {
|
|
|
7
7
|
lineHeight?: 'xsmall' | 'small' | 'medium' | 'large';
|
|
8
8
|
className?: string;
|
|
9
9
|
onClick?: (event: TClickEventType) => void;
|
|
10
|
-
dataId?: string;
|
|
11
10
|
}
|
|
@@ -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%' : ''
|