@true-engineering/true-react-common-ui-kit 3.0.0-alpha.0 → 3.0.0-alpha.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@true-engineering/true-react-common-ui-kit",
3
- "version": "3.0.0-alpha.0",
3
+ "version": "3.0.0-alpha.2",
4
4
  "description": "True Engineering React UI Kit with theming support",
5
5
  "author": "True Engineering (https://trueengineering.ru)",
6
6
  "keywords": [
@@ -4,6 +4,7 @@ export const useStyles = createThemedStyles('Checkbox', {
4
4
  root: {
5
5
  cursor: 'pointer',
6
6
  display: 'flex',
7
+ alignItems: 'center',
7
8
  gap: 14,
8
9
  width: 'fit-content',
9
10
  },
@@ -1,7 +1,7 @@
1
1
  import { FC } from 'react';
2
2
  import { ComponentStory } from '@storybook/react';
3
3
  import { FlexibleTable } from './FlexibleTable';
4
- import { FlexibleTableConfigType } from './types';
4
+ import { IFlexibleTableConfigType } from './types';
5
5
  import { IFlexibleTableStyles } from './FlexibleTable.styles';
6
6
 
7
7
  export default {
@@ -25,7 +25,7 @@ interface ITableContent {
25
25
  const Temp: FC<{ value: string | undefined }> = ({ value }) => <>{value}</>;
26
26
  const Temp1: FC<{ value: string }> = ({ value }) => <>{value}</>;
27
27
 
28
- const config: FlexibleTableConfigType<ITableContent> = {
28
+ const config: IFlexibleTableConfigType<ITableContent> = {
29
29
  contractCode: {
30
30
  title: 'Contract Code',
31
31
  },
@@ -5,7 +5,7 @@ import { useTweakStyles } from '../../hooks';
5
5
  import { ICommonProps } from '../../types';
6
6
  import { ThemedPreloader } from '../ThemedPreloader';
7
7
  import { FlexibleTableRow } from './components';
8
- import { FlexibleTableConfigType, IInfinityScrollConfig, ITitleComponent } from './types';
8
+ import { IFlexibleTableConfigType, IInfinityScrollConfig, ITitleComponent } from './types';
9
9
  import { useStyles, IFlexibleTableStyles } from './FlexibleTable.styles';
10
10
 
11
11
  // TODO: Заменить Record<string, any> на Record<string, unknown>
@@ -15,7 +15,7 @@ export interface IFlexibleTableProps<Values extends Record<string, any>>
15
15
  headerContent?: Partial<Record<keyof Values, any>>;
16
16
  enabledColumns?: Array<keyof Values>;
17
17
  activeRows?: number[];
18
- config?: FlexibleTableConfigType<Values>;
18
+ config?: IFlexibleTableConfigType<Values>;
19
19
  isHorizontallyScrollable?: boolean;
20
20
  isFirstColumnSticky?: boolean;
21
21
  infinityScrollConfig?: IInfinityScrollConfig;
@@ -3,14 +3,14 @@ import clsx from 'clsx';
3
3
  import { format } from 'date-fns';
4
4
  import type { ICommonProps } from '../../../../types';
5
5
  import { DEFAULT_DATE_FORMAT } from '../../constants';
6
- import type { FlexibleTableConfigType } from '../../types';
6
+ import type { IFlexibleTableConfigType } from '../../types';
7
7
  import { useStyles, IFlexibleTableCellStyles } from './FlexibleTableCell.styles';
8
8
 
9
9
  export interface IFlexibleTableCellProps<Values extends Record<string, any>>
10
10
  extends Pick<ICommonProps<IFlexibleTableCellStyles>, 'tweakStyles'> {
11
11
  item: Values;
12
12
  columnName: keyof Values;
13
- config?: FlexibleTableConfigType<Values>;
13
+ config?: IFlexibleTableConfigType<Values>;
14
14
  isFocusedRow?: boolean;
15
15
  isSecond?: boolean;
16
16
  isSticky?: boolean;
@@ -3,7 +3,7 @@ import clsx from 'clsx';
3
3
  import { addDataAttributes } from '../../../../helpers';
4
4
  import { useTweakStyles } from '../../../../hooks';
5
5
  import { ICommonProps, IDataAttributes } from '../../../../types';
6
- import { FlexibleTableConfigType, INestedComponent } from '../../types';
6
+ import { IFlexibleTableConfigType, INestedComponent } from '../../types';
7
7
  import FlexibleTableCell from '../FlexibleTableCell/FlexibleTableCell';
8
8
  import { useStyles, IFlexibleTableRowStyles } from './FlexibleTableRow.styles';
9
9
 
@@ -14,7 +14,7 @@ export interface IFlexibleTableRowProps<Values extends Record<string, any>>
14
14
  uniqueField?: keyof Values;
15
15
  isFirstColumnSticky?: boolean;
16
16
  isActive: boolean;
17
- config?: FlexibleTableConfigType<Values>;
17
+ config?: IFlexibleTableConfigType<Values>;
18
18
  enabledColumns?: Array<keyof Values>;
19
19
  rowAttributes?: Array<keyof Values>;
20
20
  expandableRowComponent?(item: Values, isOpen: boolean, close: () => void): ReactNode;
@@ -19,7 +19,7 @@ export type IValueComponent<Values, Value> = (props: {
19
19
  onSetNestedComponent: (component?: ReactNode) => void;
20
20
  }) => JSX.Element | ReactNode;
21
21
 
22
- export type FlexibleTableConfigType<Values> = {
22
+ export type IFlexibleTableConfigType<Values> = {
23
23
  [Key in keyof Values]?: {
24
24
  title?: ReactNode;
25
25
  titleComponent?: ITitleComponent<unknown>;
@@ -85,14 +85,16 @@ const baseInputStyles: IInputStyles = {
85
85
  };
86
86
 
87
87
  const readonlyInputBaseStyles: IInputStyles = {
88
- inputIcon: {
89
- width: 'auto',
88
+ input: {
89
+ cursor: 'pointer',
90
90
  },
91
91
  };
92
92
 
93
93
  const multiSelectInputBaseStyles: IInputStyles = {
94
94
  inputIcon: {
95
- width: 'auto',
95
+ '&:not($loading)': {
96
+ width: 'auto',
97
+ },
96
98
  },
97
99
  };
98
100
 
@@ -3,3 +3,4 @@ export * from './use-on-click-outside';
3
3
  export * from './use-dropdown';
4
4
  export * from './use-tweak-styles';
5
5
  export * from './use-did-mount-effect';
6
+ export * from './use-mixed-styles';
@@ -0,0 +1,14 @@
1
+ import { useMemo } from 'react';
2
+ import { isNotEmpty, mergeStyles } from '@true-engineering/true-react-platform-helpers';
3
+
4
+ export const useMixedStyles = <StyleSheet>(
5
+ baseStyles?: StyleSheet,
6
+ tweakStyles?: StyleSheet,
7
+ ): StyleSheet | undefined =>
8
+ useMemo(
9
+ () =>
10
+ isNotEmpty(baseStyles) && isNotEmpty(tweakStyles)
11
+ ? mergeStyles(baseStyles, tweakStyles)
12
+ : baseStyles ?? tweakStyles,
13
+ [baseStyles, tweakStyles],
14
+ );