@true-engineering/true-react-common-ui-kit 3.30.0 → 3.31.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.
Files changed (78) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +6 -0
  3. package/dist/components/FlexibleTable/types.d.ts +17 -16
  4. package/dist/true-react-common-ui-kit.js +57 -57
  5. package/dist/true-react-common-ui-kit.js.map +1 -1
  6. package/dist/true-react-common-ui-kit.umd.cjs +57 -57
  7. package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
  8. package/package.json +1 -1
  9. package/src/components/AccountInfo/AccountInfo.stories.tsx +32 -32
  10. package/src/components/AccountInfo/AccountInfo.tsx +80 -80
  11. package/src/components/AddButton/AddButton.stories.tsx +21 -21
  12. package/src/components/AddButton/AddButton.tsx +52 -52
  13. package/src/components/Colors/Colors.stories.tsx +7 -7
  14. package/src/components/DateInput/DateInput.tsx +90 -90
  15. package/src/components/DateInput/constants.ts +2 -2
  16. package/src/components/Description/Description.stories.tsx +27 -27
  17. package/src/components/Description/Description.tsx +61 -61
  18. package/src/components/FiltersPane/components/FilterValueView/FilterValueView.tsx +166 -166
  19. package/src/components/FiltersPane/components/FilterWithDates/FilterWithDates.tsx +210 -210
  20. package/src/components/FiltersPane/components/FilterWithPeriod/FilterWithPeriod.tsx +177 -177
  21. package/src/components/Flag/Flag.stories.tsx +29 -29
  22. package/src/components/Flag/Flag.tsx +26 -26
  23. package/src/components/Flag/augment.d.ts +1 -1
  24. package/src/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.styles.ts +38 -38
  25. package/src/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.styles.ts +25 -25
  26. package/src/components/FlexibleTable/types.ts +22 -16
  27. package/src/components/Icon/Icon.stories.tsx +86 -86
  28. package/src/components/Icon/complexIcons/augment.d.ts +1 -1
  29. package/src/components/Icon/complexIcons/avatarGreen.svg +57 -57
  30. package/src/components/Icon/complexIcons/index.ts +1 -1
  31. package/src/components/IncrementInput/IncrementInput.tsx +105 -105
  32. package/src/components/Input/types.ts +32 -32
  33. package/src/components/Modal/Modal.stories.tsx +105 -105
  34. package/src/components/MultiSelect/MultiSelect.stories.tsx +46 -46
  35. package/src/components/MultiSelect/MultiSelect.tsx +106 -106
  36. package/src/components/MultiSelect/components/MultiSelectInput/MultiSelectInput.tsx +53 -53
  37. package/src/components/Notification/Notification.stories.tsx +46 -46
  38. package/src/components/Notification/Notification.tsx +69 -69
  39. package/src/components/NumberInput/NumberInput.tsx +137 -137
  40. package/src/components/NumberInput/index.ts +1 -1
  41. package/src/components/PhoneInput/PhoneInput.tsx +214 -214
  42. package/src/components/PhoneInput/components/PhoneInputCountryList/PhoneInputCountryList.tsx +155 -155
  43. package/src/components/PhoneInput/types.ts +16 -16
  44. package/src/components/RadioButton/RadioButton.stories.tsx +46 -46
  45. package/src/components/RadioButton/RadioButton.tsx +57 -57
  46. package/src/components/ScrollIntoViewIfNeeded/index.ts +1 -1
  47. package/src/components/Select/Select.stories.tsx +235 -235
  48. package/src/components/Select/constants.ts +2 -2
  49. package/src/components/Select/types.ts +1 -1
  50. package/src/components/Selector/Selector.stories.tsx +62 -62
  51. package/src/components/Selector/Selector.tsx +115 -115
  52. package/src/components/Selector/index.ts +2 -2
  53. package/src/components/Selector/types.ts +12 -12
  54. package/src/components/Skeleton/Skeleton.stories.tsx +19 -19
  55. package/src/components/SmartInput/SmartInput.tsx +134 -134
  56. package/src/components/Status/Status.stories.tsx +73 -73
  57. package/src/components/Status/Status.styles.ts +143 -143
  58. package/src/components/Status/Status.tsx +49 -49
  59. package/src/components/Status/constants.ts +11 -11
  60. package/src/components/Status/index.ts +3 -3
  61. package/src/components/Status/types.ts +5 -5
  62. package/src/components/Switch/Switch.stories.tsx +40 -40
  63. package/src/components/Switch/Switch.tsx +75 -75
  64. package/src/components/TextWithInfo/TextWithInfo.stories.tsx +53 -53
  65. package/src/components/TextWithInfo/TextWithInfo.tsx +62 -62
  66. package/src/components/TextWithTooltip/TextWithTooltip.stories.tsx +58 -58
  67. package/src/components/ThemedPreloader/ThemedPreloader.stories.tsx +41 -41
  68. package/src/components/ThemedPreloader/ThemedPreloader.tsx +54 -54
  69. package/src/components/ThemedPreloader/components/DefaultPreloader/index.ts +1 -1
  70. package/src/components/Toaster/Toaster.stories.tsx +30 -30
  71. package/src/components/Tooltip/Tooltip.stories.tsx +19 -19
  72. package/src/components/Tooltip/Tooltip.tsx +35 -35
  73. package/src/components/Tooltip/types.ts +1 -1
  74. package/src/helpers/popper-helpers.ts +17 -17
  75. package/src/hooks/use-dropdown.ts +84 -84
  76. package/src/hooks/use-is-mounted.ts +15 -15
  77. package/src/theme/helpers.ts +76 -76
  78. package/src/vite-env.d.ts +1 -1
@@ -1,177 +1,177 @@
1
- import { FC, useCallback, useEffect, useMemo, useRef, useState } from 'react';
2
- import { useOnClickOutside, useTweakStyles } from '../../../../hooks';
3
- import { ICommonProps } from '../../../../types';
4
- import { PERIODS, PERIODS_GETTERS } from '../../constants';
5
- import { getLocale } from '../../helpers';
6
- import {
7
- IDatePeriod,
8
- IFilterLocaleKey,
9
- IPartialFilterLocale,
10
- IPeriod,
11
- IPeriodGetter,
12
- IPeriodsList,
13
- } from '../../types';
14
- import { FilterSelect } from '../FilterSelect';
15
- import { FilterWithDates } from '../FilterWithDates';
16
- import { useStyles, IFilterWithPeriodStyles, filterSelectStyles } from './FilterWithPeriod.styles';
17
-
18
- export interface IFilterWithPeriodProps extends ICommonProps<IFilterWithPeriodStyles> {
19
- value?: IPeriod;
20
- localeKey?: IFilterLocaleKey;
21
- locale?: IPartialFilterLocale;
22
- periods?: IPeriodsList;
23
- onChange: (period?: IPeriod) => void;
24
- onClose?: () => void;
25
- }
26
-
27
- export const FilterWithPeriod: FC<IFilterWithPeriodProps> = ({
28
- value,
29
- localeKey,
30
- locale,
31
- onChange,
32
- onClose,
33
- periods,
34
- tweakStyles,
35
- testId,
36
- }) => {
37
- const classes = useStyles({ theme: tweakStyles });
38
-
39
- const translates = useMemo(() => getLocale(localeKey, locale), [localeKey, locale]);
40
-
41
- const [isPeriodPickerShown, setIsPeriodPickerShown] = useState(value?.periodType !== 'CUSTOM');
42
-
43
- const [isDatePickerShown, setIsDatePickerShown] = useState(value?.periodType === 'CUSTOM');
44
-
45
- const [period, setPeriod] = useState(value);
46
-
47
- const periodGetters = useMemo(() => {
48
- const result: Record<string, IPeriodGetter> = { ...PERIODS_GETTERS };
49
- periods?.forEach((p) => {
50
- if (Array.isArray(p)) {
51
- result[p[0]] = p[1];
52
- }
53
- });
54
- return result;
55
- }, [periods]);
56
-
57
- const periodsList = useMemo(() => {
58
- if (periods === undefined) {
59
- return [...PERIODS];
60
- }
61
- return periods.map((p) => (Array.isArray(p) ? p[0] : p));
62
- }, [periods]);
63
-
64
- const getPeriodTranslate = useCallback(
65
- (val: string) => translates.periods[val] ?? val,
66
- [translates.periods],
67
- );
68
-
69
- const handlePeriodChange = (periodType: string) => {
70
- let from = null;
71
- let to = null;
72
-
73
- if (periodType in periodGetters) {
74
- const newPeriod = periodGetters[periodType]();
75
- from = newPeriod.from;
76
- to = newPeriod.to;
77
- }
78
-
79
- const p = { from, to, periodType };
80
- setPeriod(p);
81
-
82
- if (periodType === 'CUSTOM') {
83
- setIsDatePickerShown(true);
84
- } else {
85
- if (onClose !== undefined) {
86
- onClose();
87
- }
88
- onChange({ ...p, label: getPeriodTranslate(periodType) });
89
- }
90
-
91
- setIsPeriodPickerShown(false);
92
- };
93
-
94
- const refPeriodPicker = useRef<HTMLDivElement>(null);
95
- const refDatePicker = useRef<HTMLDivElement>(null);
96
-
97
- const onPeriodChange = (val?: string) => {
98
- if (val !== undefined) {
99
- handlePeriodChange(val);
100
- } else {
101
- onChange(undefined);
102
- if (onClose !== undefined) {
103
- onClose();
104
- }
105
- }
106
- };
107
-
108
- const handleCustomDateChange = (val: IDatePeriod): void => {
109
- if (val.from || val.to) {
110
- onChange({
111
- ...val,
112
- periodType: 'CUSTOM',
113
- });
114
- } else {
115
- onChange(undefined);
116
- }
117
- };
118
-
119
- useOnClickOutside(refDatePicker, () => {
120
- if (!period?.from && !period?.to) {
121
- setPeriod(undefined);
122
- }
123
- setIsDatePickerShown(false);
124
- });
125
-
126
- useEffect(() => {
127
- setPeriod(value);
128
- }, [value, value?.from, value?.to, value?.periodType]);
129
-
130
- const tweakSelectStyles = useTweakStyles({
131
- innerStyles: filterSelectStyles,
132
- tweakStyles,
133
- className: 'tweakFilterSelect',
134
- currentComponentName: 'FilterWithPeriod',
135
- });
136
-
137
- return (
138
- <div className={classes.root}>
139
- {isPeriodPickerShown && (
140
- <div className={classes.main} ref={refPeriodPicker}>
141
- <FilterSelect
142
- options={periodsList}
143
- value={period?.periodType}
144
- onChange={onPeriodChange}
145
- localeKey={localeKey}
146
- locale={translates}
147
- tweakStyles={tweakSelectStyles}
148
- getValueView={getPeriodTranslate}
149
- testId={testId !== undefined ? `${testId}-select` : undefined}
150
- />
151
- </div>
152
- )}
153
- {isDatePickerShown && (
154
- <div className={classes.picker} style={{ width: 320 }} ref={refDatePicker}>
155
- <FilterWithDates
156
- onStartBtnSubmit={() => {
157
- setIsDatePickerShown(false);
158
- setIsPeriodPickerShown(true);
159
- }}
160
- onEndBtnSubmit={() => {
161
- onChange(undefined);
162
- setIsDatePickerShown(false);
163
- if (onClose !== undefined) {
164
- onClose();
165
- }
166
- }}
167
- value={period}
168
- onChange={handleCustomDateChange}
169
- localeKey={localeKey}
170
- locale={translates}
171
- testId={testId !== undefined ? `${testId}-dates` : undefined}
172
- />
173
- </div>
174
- )}
175
- </div>
176
- );
177
- };
1
+ import { FC, useCallback, useEffect, useMemo, useRef, useState } from 'react';
2
+ import { useOnClickOutside, useTweakStyles } from '../../../../hooks';
3
+ import { ICommonProps } from '../../../../types';
4
+ import { PERIODS, PERIODS_GETTERS } from '../../constants';
5
+ import { getLocale } from '../../helpers';
6
+ import {
7
+ IDatePeriod,
8
+ IFilterLocaleKey,
9
+ IPartialFilterLocale,
10
+ IPeriod,
11
+ IPeriodGetter,
12
+ IPeriodsList,
13
+ } from '../../types';
14
+ import { FilterSelect } from '../FilterSelect';
15
+ import { FilterWithDates } from '../FilterWithDates';
16
+ import { useStyles, IFilterWithPeriodStyles, filterSelectStyles } from './FilterWithPeriod.styles';
17
+
18
+ export interface IFilterWithPeriodProps extends ICommonProps<IFilterWithPeriodStyles> {
19
+ value?: IPeriod;
20
+ localeKey?: IFilterLocaleKey;
21
+ locale?: IPartialFilterLocale;
22
+ periods?: IPeriodsList;
23
+ onChange: (period?: IPeriod) => void;
24
+ onClose?: () => void;
25
+ }
26
+
27
+ export const FilterWithPeriod: FC<IFilterWithPeriodProps> = ({
28
+ value,
29
+ localeKey,
30
+ locale,
31
+ onChange,
32
+ onClose,
33
+ periods,
34
+ tweakStyles,
35
+ testId,
36
+ }) => {
37
+ const classes = useStyles({ theme: tweakStyles });
38
+
39
+ const translates = useMemo(() => getLocale(localeKey, locale), [localeKey, locale]);
40
+
41
+ const [isPeriodPickerShown, setIsPeriodPickerShown] = useState(value?.periodType !== 'CUSTOM');
42
+
43
+ const [isDatePickerShown, setIsDatePickerShown] = useState(value?.periodType === 'CUSTOM');
44
+
45
+ const [period, setPeriod] = useState(value);
46
+
47
+ const periodGetters = useMemo(() => {
48
+ const result: Record<string, IPeriodGetter> = { ...PERIODS_GETTERS };
49
+ periods?.forEach((p) => {
50
+ if (Array.isArray(p)) {
51
+ result[p[0]] = p[1];
52
+ }
53
+ });
54
+ return result;
55
+ }, [periods]);
56
+
57
+ const periodsList = useMemo(() => {
58
+ if (periods === undefined) {
59
+ return [...PERIODS];
60
+ }
61
+ return periods.map((p) => (Array.isArray(p) ? p[0] : p));
62
+ }, [periods]);
63
+
64
+ const getPeriodTranslate = useCallback(
65
+ (val: string) => translates.periods[val] ?? val,
66
+ [translates.periods],
67
+ );
68
+
69
+ const handlePeriodChange = (periodType: string) => {
70
+ let from = null;
71
+ let to = null;
72
+
73
+ if (periodType in periodGetters) {
74
+ const newPeriod = periodGetters[periodType]();
75
+ from = newPeriod.from;
76
+ to = newPeriod.to;
77
+ }
78
+
79
+ const p = { from, to, periodType };
80
+ setPeriod(p);
81
+
82
+ if (periodType === 'CUSTOM') {
83
+ setIsDatePickerShown(true);
84
+ } else {
85
+ if (onClose !== undefined) {
86
+ onClose();
87
+ }
88
+ onChange({ ...p, label: getPeriodTranslate(periodType) });
89
+ }
90
+
91
+ setIsPeriodPickerShown(false);
92
+ };
93
+
94
+ const refPeriodPicker = useRef<HTMLDivElement>(null);
95
+ const refDatePicker = useRef<HTMLDivElement>(null);
96
+
97
+ const onPeriodChange = (val?: string) => {
98
+ if (val !== undefined) {
99
+ handlePeriodChange(val);
100
+ } else {
101
+ onChange(undefined);
102
+ if (onClose !== undefined) {
103
+ onClose();
104
+ }
105
+ }
106
+ };
107
+
108
+ const handleCustomDateChange = (val: IDatePeriod): void => {
109
+ if (val.from || val.to) {
110
+ onChange({
111
+ ...val,
112
+ periodType: 'CUSTOM',
113
+ });
114
+ } else {
115
+ onChange(undefined);
116
+ }
117
+ };
118
+
119
+ useOnClickOutside(refDatePicker, () => {
120
+ if (!period?.from && !period?.to) {
121
+ setPeriod(undefined);
122
+ }
123
+ setIsDatePickerShown(false);
124
+ });
125
+
126
+ useEffect(() => {
127
+ setPeriod(value);
128
+ }, [value, value?.from, value?.to, value?.periodType]);
129
+
130
+ const tweakSelectStyles = useTweakStyles({
131
+ innerStyles: filterSelectStyles,
132
+ tweakStyles,
133
+ className: 'tweakFilterSelect',
134
+ currentComponentName: 'FilterWithPeriod',
135
+ });
136
+
137
+ return (
138
+ <div className={classes.root}>
139
+ {isPeriodPickerShown && (
140
+ <div className={classes.main} ref={refPeriodPicker}>
141
+ <FilterSelect
142
+ options={periodsList}
143
+ value={period?.periodType}
144
+ onChange={onPeriodChange}
145
+ localeKey={localeKey}
146
+ locale={translates}
147
+ tweakStyles={tweakSelectStyles}
148
+ getValueView={getPeriodTranslate}
149
+ testId={testId !== undefined ? `${testId}-select` : undefined}
150
+ />
151
+ </div>
152
+ )}
153
+ {isDatePickerShown && (
154
+ <div className={classes.picker} style={{ width: 320 }} ref={refDatePicker}>
155
+ <FilterWithDates
156
+ onStartBtnSubmit={() => {
157
+ setIsDatePickerShown(false);
158
+ setIsPeriodPickerShown(true);
159
+ }}
160
+ onEndBtnSubmit={() => {
161
+ onChange(undefined);
162
+ setIsDatePickerShown(false);
163
+ if (onClose !== undefined) {
164
+ onClose();
165
+ }
166
+ }}
167
+ value={period}
168
+ onChange={handleCustomDateChange}
169
+ localeKey={localeKey}
170
+ locale={translates}
171
+ testId={testId !== undefined ? `${testId}-dates` : undefined}
172
+ />
173
+ </div>
174
+ )}
175
+ </div>
176
+ );
177
+ };
@@ -1,29 +1,29 @@
1
- import { countries } from 'country-flag-icons';
2
- import { ComponentStory } from '@storybook/react';
3
- import { Flag } from './Flag';
4
-
5
- export default {
6
- title: 'Data Display/Flag',
7
- component: Flag,
8
- argTypes: {
9
- countryCode: { control: 'select', options: countries },
10
- },
11
- };
12
-
13
- const Template: ComponentStory<typeof Flag> = (args) => (
14
- <div style={{ width: 60, height: 40 }}>
15
- <Flag {...args} />
16
- </div>
17
- );
18
-
19
- export const Default = Template.bind({});
20
-
21
- Default.args = {
22
- countryCode: 'ug',
23
- };
24
-
25
- Default.parameters = {
26
- controls: {
27
- exclude: ['data'],
28
- },
29
- };
1
+ import { countries } from 'country-flag-icons';
2
+ import { ComponentStory } from '@storybook/react';
3
+ import { Flag } from './Flag';
4
+
5
+ export default {
6
+ title: 'Data Display/Flag',
7
+ component: Flag,
8
+ argTypes: {
9
+ countryCode: { control: 'select', options: countries },
10
+ },
11
+ };
12
+
13
+ const Template: ComponentStory<typeof Flag> = (args) => (
14
+ <div style={{ width: 60, height: 40 }}>
15
+ <Flag {...args} />
16
+ </div>
17
+ );
18
+
19
+ export const Default = Template.bind({});
20
+
21
+ Default.args = {
22
+ countryCode: 'ug',
23
+ };
24
+
25
+ Default.parameters = {
26
+ controls: {
27
+ exclude: ['data'],
28
+ },
29
+ };
@@ -1,26 +1,26 @@
1
- import { FC } from 'react';
2
- import { hasFlag } from 'country-flag-icons';
3
- import Flags from 'country-flag-icons/react/3x2';
4
- import { ICommonProps } from '../../types';
5
- import { Icon } from '../Icon';
6
- import { useStyles, IFlagStyles } from './Flag.styles';
7
-
8
- export interface IFlagProps extends Pick<ICommonProps<IFlagStyles>, 'tweakStyles'> {
9
- /** @default '' */
10
- countryCode?: string;
11
- }
12
-
13
- export const Flag: FC<IFlagProps> = ({ countryCode = '', tweakStyles }) => {
14
- const classes = useStyles({ theme: tweakStyles });
15
- const CC = countryCode.toUpperCase();
16
-
17
- const TheFlag = hasFlag(CC)
18
- ? Flags[CC as keyof typeof Flags]
19
- : () => (
20
- <div className={classes.noFlag}>
21
- <Icon type="minus" />
22
- </div>
23
- );
24
-
25
- return <TheFlag className={classes.root} />;
26
- };
1
+ import { FC } from 'react';
2
+ import { hasFlag } from 'country-flag-icons';
3
+ import Flags from 'country-flag-icons/react/3x2';
4
+ import { ICommonProps } from '../../types';
5
+ import { Icon } from '../Icon';
6
+ import { useStyles, IFlagStyles } from './Flag.styles';
7
+
8
+ export interface IFlagProps extends Pick<ICommonProps<IFlagStyles>, 'tweakStyles'> {
9
+ /** @default '' */
10
+ countryCode?: string;
11
+ }
12
+
13
+ export const Flag: FC<IFlagProps> = ({ countryCode = '', tweakStyles }) => {
14
+ const classes = useStyles({ theme: tweakStyles });
15
+ const CC = countryCode.toUpperCase();
16
+
17
+ const TheFlag = hasFlag(CC)
18
+ ? Flags[CC as keyof typeof Flags]
19
+ : () => (
20
+ <div className={classes.noFlag}>
21
+ <Icon type="minus" />
22
+ </div>
23
+ );
24
+
25
+ return <TheFlag className={classes.root} />;
26
+ };
@@ -1 +1 @@
1
- declare module 'country-flag-icons/react/3x2';
1
+ declare module 'country-flag-icons/react/3x2';
@@ -1,38 +1,38 @@
1
- import { getTransition } from '@true-engineering/true-react-platform-helpers';
2
- import { ITweakStyles, createThemedStyles } from '../../../../theme';
3
- import { STICKY_SHADOW_PADDING } from '../../FlexibleTable.styles';
4
-
5
- export const useStyles = createThemedStyles('FlexibleTableCell', {
6
- root: {
7
- position: 'relative',
8
- boxSizing: 'content-box',
9
- padding: [14, 7],
10
- fontSize: 14,
11
- lineHeight: 1.42,
12
- zIndex: 5,
13
- verticalAlign: 'top',
14
- },
15
-
16
- sticky: {
17
- zIndex: 19,
18
- paddingLeft: 24,
19
- paddingRight: 12,
20
- ...getTransition(['box-shadow']),
21
-
22
- '[data-scrolled] &': {
23
- boxShadow: '4px 0 4px rgba(0, 0, 0, 0.05)',
24
- },
25
- },
26
-
27
- second: {
28
- paddingLeft: STICKY_SHADOW_PADDING,
29
- },
30
-
31
- loading: {},
32
-
33
- skeleton: {
34
- height: 21,
35
- },
36
- });
37
-
38
- export type IFlexibleTableCellStyles = ITweakStyles<typeof useStyles>;
1
+ import { getTransition } from '@true-engineering/true-react-platform-helpers';
2
+ import { ITweakStyles, createThemedStyles } from '../../../../theme';
3
+ import { STICKY_SHADOW_PADDING } from '../../FlexibleTable.styles';
4
+
5
+ export const useStyles = createThemedStyles('FlexibleTableCell', {
6
+ root: {
7
+ position: 'relative',
8
+ boxSizing: 'content-box',
9
+ padding: [14, 7],
10
+ fontSize: 14,
11
+ lineHeight: 1.42,
12
+ zIndex: 5,
13
+ verticalAlign: 'top',
14
+ },
15
+
16
+ sticky: {
17
+ zIndex: 19,
18
+ paddingLeft: 24,
19
+ paddingRight: 12,
20
+ ...getTransition(['box-shadow']),
21
+
22
+ '[data-scrolled] &': {
23
+ boxShadow: '4px 0 4px rgba(0, 0, 0, 0.05)',
24
+ },
25
+ },
26
+
27
+ second: {
28
+ paddingLeft: STICKY_SHADOW_PADDING,
29
+ },
30
+
31
+ loading: {},
32
+
33
+ skeleton: {
34
+ height: 21,
35
+ },
36
+ });
37
+
38
+ export type IFlexibleTableCellStyles = ITweakStyles<typeof useStyles>;
@@ -1,25 +1,25 @@
1
- import { ITweakStyles, createThemedStyles } from '../../../../theme';
2
- import { IFlexibleTableCellStyles } from '../FlexibleTableCell';
3
-
4
- export const useStyles = createThemedStyles('FlexibleTableRow', {
5
- root: {
6
- position: 'relative',
7
- },
8
-
9
- active: {},
10
-
11
- editable: {
12
- cursor: 'pointer',
13
- },
14
-
15
- clickable: {
16
- cursor: 'pointer',
17
- },
18
-
19
- nestedComponent: {},
20
- });
21
-
22
- export type IFlexibleTableRowStyles = ITweakStyles<
23
- typeof useStyles,
24
- { tweakTableCell: IFlexibleTableCellStyles }
25
- >;
1
+ import { ITweakStyles, createThemedStyles } from '../../../../theme';
2
+ import { IFlexibleTableCellStyles } from '../FlexibleTableCell';
3
+
4
+ export const useStyles = createThemedStyles('FlexibleTableRow', {
5
+ root: {
6
+ position: 'relative',
7
+ },
8
+
9
+ active: {},
10
+
11
+ editable: {
12
+ cursor: 'pointer',
13
+ },
14
+
15
+ clickable: {
16
+ cursor: 'pointer',
17
+ },
18
+
19
+ nestedComponent: {},
20
+ });
21
+
22
+ export type IFlexibleTableRowStyles = ITweakStyles<
23
+ typeof useStyles,
24
+ { tweakTableCell: IFlexibleTableCellStyles }
25
+ >;
@@ -27,26 +27,32 @@ export interface IValueComponentProps<Values, Value> {
27
27
  onSetNestedComponent: (component?: ReactNode) => void;
28
28
  }
29
29
 
30
+ export interface IFlexibleTableRowConfig<
31
+ Values extends ITableRow,
32
+ Key extends keyof Values,
33
+ HeaderContent extends IHeaderContent<Values> = IHeaderContent<Values>,
34
+ > {
35
+ title?: IRenderNode<ITitleComponentProps<HeaderContent[Key]>>;
36
+ component?: IRenderNode<IValueComponentProps<Values, NonNullable<Values[Key]>>>;
37
+ dateFormat?: string;
38
+ minWidth?: string | number;
39
+ width?: string | number;
40
+ maxWidth?: string | number;
41
+ /** @default 'left' */
42
+ titleAlign?: CSSProperties['textAlign'];
43
+ cellAlign?: CSSProperties['textAlign'];
44
+ cellVerticalAlign?: CSSProperties['verticalAlign'];
45
+ position?: CSSProperties['position'];
46
+ right?: number;
47
+ left?: number;
48
+ shouldRenderDataId?: boolean;
49
+ }
50
+
30
51
  export type IFlexibleTableConfigType<
31
52
  Values extends ITableRow,
32
53
  HeaderContent extends IHeaderContent<Values> = IHeaderContent<Values>,
33
54
  > = {
34
- [Key in keyof Values]?: {
35
- title?: IRenderNode<ITitleComponentProps<HeaderContent[Key]>>;
36
- component?: IRenderNode<IValueComponentProps<Values, NonNullable<Values[Key]>>>;
37
- dateFormat?: string;
38
- minWidth?: string | number;
39
- width?: string | number;
40
- maxWidth?: string | number;
41
- /** @default 'left' */
42
- titleAlign?: CSSProperties['textAlign'];
43
- cellAlign?: CSSProperties['textAlign'];
44
- cellVerticalAlign?: CSSProperties['verticalAlign'];
45
- position?: CSSProperties['position'];
46
- right?: number;
47
- left?: number;
48
- shouldRenderDataId?: boolean;
49
- };
55
+ [Key in keyof Values]?: IFlexibleTableRowConfig<Values, Key, HeaderContent>;
50
56
  };
51
57
 
52
58
  export interface IInfinityScrollConfig {