hrm_ui_lib 1.2.2 → 1.2.3

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.
@@ -6,8 +6,8 @@ import { Text } from '../Text/Text.js';
6
6
  import { Button } from '../Button/Button.js';
7
7
  import { IconDismissFilled } from '../SVGIcons/IconDismissFilled.js';
8
8
  import { IconDynamicComponent } from '../../helperComponents/IconDynamicComponent/IconDynamicComponent.js';
9
- import '../Checkbox/Checkbox.js';
10
9
  import 'dayjs';
10
+ import '../Checkbox/Checkbox.js';
11
11
  import '../../hooks/useScreenSize.js';
12
12
  import 'react-hook-form';
13
13
  import 'react-syntax-highlighter';
@@ -7,7 +7,7 @@ import { Divider } from '../../Divider/Divider.js';
7
7
  import { AnimatePresenceWrapper } from '../../../helperComponents/AnimatePresenceWrapper/AnimatePresenceWrapper.js';
8
8
  import classNames from 'classnames';
9
9
  import { IconChevronDown } from '../../SVGIcons/IconChevronDown.js';
10
- import '../../../utils/helpers.js';
10
+ import { generateDataTestId } from '../../../utils/helpers.js';
11
11
  import 'dayjs';
12
12
  import '../../../defineProperty-4fc3f29b.js';
13
13
  import '../../../typeof-b7d08b0d.js';
@@ -32,13 +32,14 @@ var CollapseItem = function CollapseItem(props) {
32
32
  size: size,
33
33
  type: color,
34
34
  weight: "bolder",
35
- dataId: dataId
35
+ dataId: generateDataTestId('title', dataId)
36
36
  }, text) : text;
37
37
  return /*#__PURE__*/React.createElement("div", {
38
38
  className: classNames('collapse', {
39
39
  'collapse--opened': isOpen
40
40
  }, className),
41
- id: "".concat(id || '')
41
+ id: "".concat(id || ''),
42
+ "data-id": generateDataTestId('collapse-item', dataId)
42
43
  }, /*#__PURE__*/React.createElement("div", {
43
44
  className: "collapse__header flexbox justify-content--between",
44
45
  onClick: toggle
@@ -9,9 +9,9 @@ import { useGetElemSizes } from '../../../../hooks/useGetElemSizes.js';
9
9
  import 'dayjs';
10
10
  import '../../../../hooks/useScreenSize.js';
11
11
  import 'react-hook-form';
12
+ import 'classnames';
12
13
  import { OptionItem } from '../../../../helperComponents/OptionItem/OptionItem.js';
13
14
  import 'react-syntax-highlighter';
14
- import 'classnames';
15
15
  import '../../../Checkbox/Checkbox.js';
16
16
  import 'react-dom';
17
17
  import 'framer-motion';
@@ -5,9 +5,9 @@ import { Text } from '../Text/Text.js';
5
5
  import { Button } from '../Button/Button.js';
6
6
  import { ICONS_MAPPING, TYPE_MAPPING, DEFAULT_DURATION } from './consts.js';
7
7
  import { IconDynamicComponent } from '../../helperComponents/IconDynamicComponent/IconDynamicComponent.js';
8
- import '../Checkbox/Checkbox.js';
9
- import 'classnames';
10
8
  import 'dayjs';
9
+ import 'classnames';
10
+ import '../Checkbox/Checkbox.js';
11
11
  import '../../hooks/useScreenSize.js';
12
12
  import 'react-hook-form';
13
13
  import 'react-syntax-highlighter';
@@ -91,7 +91,8 @@ var Textarea = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
91
91
  className: "textarea__message mt-8"
92
92
  }, error && /*#__PURE__*/React.createElement(ErrorMessage, {
93
93
  message: error,
94
- icon: "infoFilled"
94
+ icon: "infoFilled",
95
+ dataId: dataId
95
96
  }), successMessage ? /*#__PURE__*/React.createElement(Text, {
96
97
  size: "small",
97
98
  type: "success",
@@ -1,3 +1,3 @@
1
- /// <reference types="react" />
1
+ import { ReactElement } from 'react';
2
2
  import { TErrorMessageProps } from './types';
3
- export declare const ErrorMessage: (props: TErrorMessageProps) => JSX.Element;
3
+ export declare const ErrorMessage: ({ message, icon, dataId, className }: TErrorMessageProps) => ReactElement;
@@ -1,21 +1,21 @@
1
1
  import React from 'react';
2
2
  import { Text } from '../../components/Text/Text.js';
3
3
  import { IconDynamicComponent } from '../IconDynamicComponent/IconDynamicComponent.js';
4
- import 'classnames';
5
- import '../../utils/helpers.js';
4
+ import { generateDataTestId } from '../../utils/helpers.js';
5
+ import classNames from 'classnames';
6
6
  import 'dayjs';
7
7
  import '../IconDynamicComponent/constants.js';
8
8
 
9
- var ErrorMessage = function ErrorMessage(props) {
10
- var message = props.message,
11
- icon = props.icon,
12
- dataId = props.dataId,
13
- className = props.className;
9
+ var ErrorMessage = function ErrorMessage(_ref) {
10
+ var message = _ref.message,
11
+ icon = _ref.icon,
12
+ dataId = _ref.dataId,
13
+ className = _ref.className;
14
14
  return /*#__PURE__*/React.createElement(Text, {
15
- className: "error-message ".concat(className),
15
+ className: classNames('error-message', className),
16
16
  size: "small",
17
17
  type: "danger",
18
- dataId: dataId ? "".concat(dataId, "-error-message") : ''
18
+ dataId: generateDataTestId('error-message', dataId)
19
19
  }, /*#__PURE__*/React.createElement(React.Fragment, null, icon && /*#__PURE__*/React.createElement(IconDynamicComponent, {
20
20
  componentName: icon,
21
21
  className: "mr-4",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hrm_ui_lib",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "UI library for Dino",
5
5
  "main": "./index.js",
6
6
  "module": "./index.js",
@@ -12,3 +12,4 @@ export declare const getStringWidth: (text: string, fontSize: number) => number;
12
12
  export declare const setTranslationValue: (translation: string, value: string | number) => string;
13
13
  export declare const getYearOptions: (startYear: number, lastYear: number) => TSelectOptions;
14
14
  export declare const isSameDay: (date1?: Date, date2?: Date) => boolean;
15
+ export declare const generateDataTestId: (postfix: string, dataId?: string) => string;
package/utils/helpers.js CHANGED
@@ -79,5 +79,11 @@ var isSameDay = function isSameDay(date1, date2) {
79
79
  }
80
80
  return dayjs(date1).isSame(date2, 'day');
81
81
  };
82
+ var generateDataTestId = function generateDataTestId(postfix, dataId) {
83
+ if (!dataId) {
84
+ return '';
85
+ }
86
+ return "".concat(dataId, "-").concat(postfix);
87
+ };
82
88
 
83
- export { checkIsAllowedFileSize, checkIsAllowedTypes, getFormattedValues, getStringWidth, getYearOptions, isSameDay, noop, openFileInNewWindow, setTranslationValue, uniqueFiles };
89
+ export { checkIsAllowedFileSize, checkIsAllowedTypes, generateDataTestId, getFormattedValues, getStringWidth, getYearOptions, isSameDay, noop, openFileInNewWindow, setTranslationValue, uniqueFiles };