@true-engineering/true-react-common-ui-kit 2.0.1 → 2.1.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/dist/types.d.ts CHANGED
@@ -24,6 +24,9 @@ export declare type UiKitHelpers = Record<string, Styles | (() => Styles)>;
24
24
  export interface UiKitTheme {
25
25
  name: string;
26
26
  components?: Partial<Record<ComponentName, ComponentStyles<any, any>>>;
27
+ /**
28
+ * Для переопределения иконок, которые есть в UiKit
29
+ */
27
30
  icons?: Partial<Record<ICommonIcon, ISvgIcon>>;
28
31
  complexIcons?: Partial<Record<IComplexIcon, string>>;
29
32
  preloaders?: Partial<Record<IPreloaderSvgType, string>>;
package/package.json CHANGED
@@ -1,91 +1,91 @@
1
- {
2
- "name": "@true-engineering/true-react-common-ui-kit",
3
- "version": "2.0.1",
4
- "description": "True Engineering React UI Kit with theming support",
5
- "author": "True Engineering (https://trueengineering.ru)",
6
- "keywords": [
7
- "TE",
8
- "True Engineering",
9
- "UI Kit with theming support",
10
- "UI Kit"
11
- ],
12
- "homepage": "",
13
- "license": "Apache-2.0",
14
- "type": "module",
15
- "types": "dist/index.d.ts",
16
- "main": "dist/true-react-common-ui-kit.umd.cjs",
17
- "module": "./dist/true-react-common-ui-kit.js",
18
- "directories": {
19
- "lib": "src"
20
- },
21
- "publishConfig": {
22
- "access": "public"
23
- },
24
- "files": [
25
- "src",
26
- "dist"
27
- ],
28
- "exports": {
29
- ".": {
30
- "require": "./dist/true-react-common-ui-kit.umd.cjs",
31
- "import": "./dist/true-react-common-ui-kit.js"
32
- },
33
- "./dist/style.css": "./dist/style.css",
34
- "./src": "./src/index.ts"
35
- },
36
- "scripts": {
37
- "build": "tsc && vite build",
38
- "lint": "eslint \"**/*.{js,jsx,ts,tsx}\"",
39
- "format": "prettier --write \"**/*.{js,jsx,css,json,ts,tsx}\"",
40
- "format:check": "prettier --check \"**/*.{js,jsx,css,json,ts,tsx}\"",
41
- "full-check": "yarn format:check && yarn lint",
42
- "types-check": "tsc --noEmit"
43
- },
44
- "dependencies": {
45
- "clsx": "1.2.1",
46
- "country-flag-icons": "1.5.5",
47
- "date-fns": "2.29.3",
48
- "hex-to-rgba": "2.0.1",
49
- "jss": "10.9.2",
50
- "lodash-es": "4.17.21",
51
- "react": "18.2.0",
52
- "react-datepicker": "4.25.0",
53
- "react-dom": "18.2.0",
54
- "react-input-mask": "3.0.0-alpha.2",
55
- "react-jss": "10.9.2",
56
- "react-overlays": "5.2.1",
57
- "react-remove-scroll": "2.5.6",
58
- "react-transition-group": "4.4.5",
59
- "scroll-into-view-if-needed": "3.0.6",
60
- "ts-debounce": "4.0.0"
61
- },
62
- "devDependencies": {
63
- "@babel/core": "7.20.12",
64
- "@storybook/addon-actions": "6.5.15",
65
- "@storybook/addon-essentials": "6.5.15",
66
- "@storybook/addon-interactions": "6.5.15",
67
- "@storybook/addon-links": "6.5.15",
68
- "@storybook/builder-vite": "0.3.0",
69
- "@storybook/react": "6.5.15",
70
- "@storybook/testing-library": "0.0.13",
71
- "@swc/core": "^1.3.30",
72
- "@types/lodash-es": "4.17.11",
73
- "@types/react": "18.0.26",
74
- "@types/react-datepicker": "4.19.4",
75
- "@types/react-dom": "18.0.9",
76
- "@types/react-input-mask": "3.0.2",
77
- "@types/react-transition-group": "4.4.5",
78
- "@typescript-eslint/eslint-plugin": "5.48.2",
79
- "@typescript-eslint/parser": "5.48.2",
80
- "@vitejs/plugin-react": "3.0.0",
81
- "eslint": "8.36.0",
82
- "eslint-config-prettier": "8.7.0",
83
- "eslint-plugin-react": "7.32.2",
84
- "prettier": "2.8.3",
85
- "rollup-plugin-swc3": "0.3.0",
86
- "typescript": "4.9.3",
87
- "unplugin-swc": "1.3.2",
88
- "vite": "4.0.0",
89
- "vite-plugin-dts": "1.7.1"
90
- }
91
- }
1
+ {
2
+ "name": "@true-engineering/true-react-common-ui-kit",
3
+ "version": "2.1.0",
4
+ "description": "True Engineering React UI Kit with theming support",
5
+ "author": "True Engineering (https://trueengineering.ru)",
6
+ "keywords": [
7
+ "TE",
8
+ "True Engineering",
9
+ "UI Kit with theming support",
10
+ "UI Kit"
11
+ ],
12
+ "homepage": "",
13
+ "license": "Apache-2.0",
14
+ "type": "module",
15
+ "types": "dist/index.d.ts",
16
+ "main": "dist/true-react-common-ui-kit.umd.cjs",
17
+ "module": "./dist/true-react-common-ui-kit.js",
18
+ "directories": {
19
+ "lib": "src"
20
+ },
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "files": [
25
+ "src",
26
+ "dist"
27
+ ],
28
+ "exports": {
29
+ ".": {
30
+ "require": "./dist/true-react-common-ui-kit.umd.cjs",
31
+ "import": "./dist/true-react-common-ui-kit.js"
32
+ },
33
+ "./dist/style.css": "./dist/style.css",
34
+ "./src": "./src/index.ts"
35
+ },
36
+ "scripts": {
37
+ "build": "tsc && vite build",
38
+ "lint": "eslint \"**/*.{js,jsx,ts,tsx}\"",
39
+ "format": "prettier --write \"**/*.{js,jsx,css,json,ts,tsx}\"",
40
+ "format:check": "prettier --check \"**/*.{js,jsx,css,json,ts,tsx}\"",
41
+ "full-check": "yarn format:check && yarn lint",
42
+ "types-check": "tsc --noEmit"
43
+ },
44
+ "dependencies": {
45
+ "clsx": "1.2.1",
46
+ "country-flag-icons": "1.5.5",
47
+ "date-fns": "2.29.3",
48
+ "hex-to-rgba": "2.0.1",
49
+ "jss": "10.9.2",
50
+ "lodash-es": "4.17.21",
51
+ "react": "18.2.0",
52
+ "react-datepicker": "4.25.0",
53
+ "react-dom": "18.2.0",
54
+ "react-input-mask": "3.0.0-alpha.2",
55
+ "react-jss": "10.9.2",
56
+ "react-overlays": "5.2.1",
57
+ "react-remove-scroll": "2.5.6",
58
+ "react-transition-group": "4.4.5",
59
+ "scroll-into-view-if-needed": "3.0.6",
60
+ "ts-debounce": "4.0.0"
61
+ },
62
+ "devDependencies": {
63
+ "@babel/core": "7.20.12",
64
+ "@storybook/addon-actions": "6.5.15",
65
+ "@storybook/addon-essentials": "6.5.15",
66
+ "@storybook/addon-interactions": "6.5.15",
67
+ "@storybook/addon-links": "6.5.15",
68
+ "@storybook/builder-vite": "0.3.0",
69
+ "@storybook/react": "6.5.15",
70
+ "@storybook/testing-library": "0.0.13",
71
+ "@swc/core": "^1.3.30",
72
+ "@types/lodash-es": "4.17.11",
73
+ "@types/react": "18.0.26",
74
+ "@types/react-datepicker": "4.19.4",
75
+ "@types/react-dom": "18.0.9",
76
+ "@types/react-input-mask": "3.0.2",
77
+ "@types/react-transition-group": "4.4.5",
78
+ "@typescript-eslint/eslint-plugin": "5.48.2",
79
+ "@typescript-eslint/parser": "5.48.2",
80
+ "@vitejs/plugin-react": "3.0.0",
81
+ "eslint": "8.36.0",
82
+ "eslint-config-prettier": "8.7.0",
83
+ "eslint-plugin-react": "7.32.2",
84
+ "prettier": "2.8.3",
85
+ "rollup-plugin-swc3": "0.3.0",
86
+ "typescript": "4.9.3",
87
+ "unplugin-swc": "1.3.2",
88
+ "vite": "4.0.0",
89
+ "vite-plugin-dts": "1.7.1"
90
+ }
91
+ }
@@ -1,4 +1,4 @@
1
- import { useEffect, useState, PropsWithChildren } from 'react';
1
+ import { useEffect, useState, ReactNode } from 'react';
2
2
  import clsx from 'clsx';
3
3
  import { Icon } from '../Icon';
4
4
  import { useTheme } from '../../hooks';
@@ -13,6 +13,7 @@ import { CheckboxStyles, styles } from './Checkbox.styles';
13
13
 
14
14
  export interface ICheckboxProps<V> extends ICommonProps {
15
15
  tweakStyles?: CheckboxStyles;
16
+ children?: ReactNode;
16
17
  isChecked?: boolean;
17
18
  isSemiChecked?: boolean;
18
19
  isDisabled?: boolean;
@@ -54,7 +55,7 @@ export function Checkbox<V>({
54
55
  labelPosition = 'right',
55
56
  tweakStyles,
56
57
  onSelect,
57
- }: PropsWithChildren<ICheckboxProps<V>>): JSX.Element {
58
+ }: ICheckboxProps<V>): JSX.Element {
58
59
  const { classes } = useTheme('Checkbox', styles, tweakStyles, {
59
60
  size,
60
61
  alignItems,
@@ -46,10 +46,6 @@ export interface IDatePickerProps extends IDatePickerBaseProps {
46
46
  selectedDate?: Date | null;
47
47
  locale: Locale;
48
48
  months?: string[];
49
- minDate?: Date | null;
50
- maxDate?: Date | null;
51
- endDate?: Date | null;
52
- startDate?: Date | null;
53
49
  topPosition?: number;
54
50
  leftPosition?: number;
55
51
  /**
@@ -91,6 +87,7 @@ export const DatePicker = forwardRef<ReactDatePicker, IDatePickerProps>(
91
87
  isInline,
92
88
  isDisabled,
93
89
  isClearable,
90
+ strictParsing,
94
91
  focusSelectedMonth,
95
92
  disabledKeyboardNavigation,
96
93
  shouldRenderPopperInBody,
@@ -305,6 +302,7 @@ export const DatePicker = forwardRef<ReactDatePicker, IDatePickerProps>(
305
302
  popperModifiers={popperModifiers}
306
303
  popperPlacement={popperPlacement}
307
304
  selectsRange={isRange}
305
+ strictParsing={strictParsing}
308
306
  preventOpenOnFocus={preventOpenOnFocus}
309
307
  shouldCloseOnSelect={shouldCloseOnSelect}
310
308
  customInputRef={customInputRef}
@@ -5,6 +5,10 @@ export type IRange = [Date | null, Date | null] | null;
5
5
 
6
6
  export type IDatePickerBaseProps = Pick<
7
7
  ReactDatePickerProps,
8
+ | 'startDate'
9
+ | 'endDate'
10
+ | 'minDate'
11
+ | 'maxDate'
8
12
  | 'allowSameDay'
9
13
  | 'disabledKeyboardNavigation'
10
14
  | 'monthsShown'
@@ -24,6 +28,7 @@ export type IDatePickerBaseProps = Pick<
24
28
  | 'renderCustomHeader'
25
29
  | 'customInputRef'
26
30
  | 'preventOpenOnFocus'
31
+ | 'strictParsing'
27
32
  > &
28
33
  Omit<
29
34
  IDateInputProps,
@@ -1,86 +1,86 @@
1
- import { ComponentStory } from '@storybook/react';
2
- import { FC } from 'react';
3
- import { FlexibleTable } from './FlexibleTable';
4
- import { FlexibleTableConfigType } from './types';
5
- import content from './fixture-test';
6
-
7
- export default {
8
- title: 'Table/FlexibleTable',
9
- component: FlexibleTable,
10
- };
11
-
12
- interface ITableContent {
13
- contractCode: string;
14
- validFrom: Date;
15
- validTo: Date;
16
- title: string;
17
- signDate: Date;
18
- partner: string;
19
- partnerDescription: string;
20
- parentContract: string;
21
- currency: string;
22
- status: string;
23
- }
24
-
25
- const Temp: FC<{ value: string | undefined }> = ({ value }) => <>{value}</>;
26
- const Temp1: FC<{ value: string }> = ({ value }) => <>{value}</>;
27
-
28
- const config: FlexibleTableConfigType<ITableContent> = {
29
- contractCode: {
30
- title: 'Contract Code',
31
- },
32
- title: {
33
- component: Temp,
34
- title: 'Title',
35
- minWidth: 320,
36
- },
37
- validFrom: {
38
- title: 'Valid From',
39
- },
40
- validTo: {
41
- title: 'Valid From',
42
- },
43
- signDate: {
44
- title: 'Sign Date',
45
- },
46
- partner: {
47
- component: Temp1,
48
- title: 'Partner',
49
- },
50
- };
51
-
52
- const Template: ComponentStory<typeof FlexibleTable<ITableContent>> = (
53
- args,
54
- ) => (
55
- <FlexibleTable<ITableContent>
56
- {...args}
57
- uniqueField="contractCode"
58
- expandableRowComponent={(item, _, close) =>
59
- item.contractCode === 'OB_UT_M119' ? (
60
- <div onClick={close}>всем привет :) {item.contractCode}</div>
61
- ) : null
62
- }
63
- content={content}
64
- config={config}
65
- />
66
- );
67
-
68
- export const Default = Template.bind({});
69
-
70
- Default.args = {
71
- isHorizontallyScrollable: true,
72
- isFirstColumnSticky: true,
73
- };
74
-
75
- Default.parameters = {
76
- controls: {
77
- exclude: [
78
- 'data',
79
- 'testId',
80
- 'onHeadClick',
81
- 'onRowClick',
82
- 'onRowHover',
83
- 'expandableRowComponent',
84
- ],
85
- },
86
- };
1
+ import { ComponentStory } from '@storybook/react';
2
+ import { FC } from 'react';
3
+ import { FlexibleTable } from './FlexibleTable';
4
+ import { FlexibleTableConfigType } from './types';
5
+ import content from './fixture-test';
6
+
7
+ export default {
8
+ title: 'Table/FlexibleTable',
9
+ component: FlexibleTable,
10
+ };
11
+
12
+ interface ITableContent {
13
+ contractCode: string;
14
+ validFrom: Date;
15
+ validTo: Date;
16
+ title: string;
17
+ signDate: Date;
18
+ partner: string;
19
+ partnerDescription: string;
20
+ parentContract: string;
21
+ currency: string;
22
+ status: string;
23
+ }
24
+
25
+ const Temp: FC<{ value: string | undefined }> = ({ value }) => <>{value}</>;
26
+ const Temp1: FC<{ value: string }> = ({ value }) => <>{value}</>;
27
+
28
+ const config: FlexibleTableConfigType<ITableContent> = {
29
+ contractCode: {
30
+ title: 'Contract Code',
31
+ },
32
+ title: {
33
+ component: Temp,
34
+ title: 'Title',
35
+ minWidth: 320,
36
+ },
37
+ validFrom: {
38
+ title: 'Valid From',
39
+ },
40
+ validTo: {
41
+ title: 'Valid From',
42
+ },
43
+ signDate: {
44
+ title: 'Sign Date',
45
+ },
46
+ partner: {
47
+ component: Temp1,
48
+ title: 'Partner',
49
+ },
50
+ };
51
+
52
+ const Template: ComponentStory<typeof FlexibleTable<ITableContent>> = (
53
+ args,
54
+ ) => (
55
+ <FlexibleTable<ITableContent>
56
+ {...args}
57
+ uniqueField="contractCode"
58
+ expandableRowComponent={(item, _, close) =>
59
+ item.contractCode === 'OB_UT_M119' ? (
60
+ <div onClick={close}>всем привет :) {item.contractCode}</div>
61
+ ) : null
62
+ }
63
+ content={content}
64
+ config={config}
65
+ />
66
+ );
67
+
68
+ export const Default = Template.bind({});
69
+
70
+ Default.args = {
71
+ isHorizontallyScrollable: true,
72
+ isFirstColumnSticky: true,
73
+ };
74
+
75
+ Default.parameters = {
76
+ controls: {
77
+ exclude: [
78
+ 'data',
79
+ 'testId',
80
+ 'onHeadClick',
81
+ 'onRowClick',
82
+ 'onRowHover',
83
+ 'expandableRowComponent',
84
+ ],
85
+ },
86
+ };
@@ -1,4 +1,4 @@
1
- import { PropsWithChildren } from 'react';
1
+ import { ReactNode } from 'react';
2
2
  import clsx from 'clsx';
3
3
  import { useTheme } from '../../hooks';
4
4
  import { addDataAttributes, isNotEmpty } from '../../helpers';
@@ -8,12 +8,13 @@ import { RadioButtonStyles, styles } from './RadioButton.styles';
8
8
 
9
9
  export interface IRadioButtonProps<Value extends string> extends ICommonProps {
10
10
  tweakStyles?: RadioButtonStyles;
11
+ children?: ReactNode;
11
12
  value: Value;
12
13
  groupName: string;
13
14
  isChecked?: boolean;
14
15
  isDisabled?: boolean;
15
16
  isInvalid?: boolean;
16
- onChange: (value: Value) => void | Promise<void>;
17
+ onChange(value: Value): void | Promise<void>;
17
18
  }
18
19
 
19
20
  export function RadioButton<Value extends string>({
@@ -23,10 +24,10 @@ export function RadioButton<Value extends string>({
23
24
  isChecked,
24
25
  isDisabled,
25
26
  isInvalid,
26
- onChange,
27
27
  data,
28
28
  tweakStyles,
29
- }: PropsWithChildren<IRadioButtonProps<Value>>): JSX.Element {
29
+ onChange,
30
+ }: IRadioButtonProps<Value>): JSX.Element {
30
31
  const { classes } = useTheme('RadioButton', styles, tweakStyles);
31
32
 
32
33
  return (