@true-engineering/true-react-common-ui-kit 3.24.1 → 3.25.1

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 (100) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +21 -0
  3. package/dist/components/Select/CustomSelect.stories.d.ts +1 -1
  4. package/dist/components/Select/MultiSelect.stories.d.ts +2 -2
  5. package/dist/components/Select/Select.d.ts +14 -9
  6. package/dist/components/Select/Select.styles.d.ts +5 -5
  7. package/dist/components/Select/components/SelectList/SelectList.d.ts +7 -6
  8. package/dist/components/Select/components/SelectList/SelectList.styles.d.ts +1 -1
  9. package/dist/components/Select/components/SelectListItem/SelectListItem.d.ts +4 -3
  10. package/dist/components/Select/helpers.d.ts +0 -3
  11. package/dist/true-react-common-ui-kit.js +176 -142
  12. package/dist/true-react-common-ui-kit.js.map +1 -1
  13. package/dist/true-react-common-ui-kit.umd.cjs +175 -141
  14. package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
  15. package/package.json +1 -1
  16. package/src/components/AccountInfo/AccountInfo.stories.tsx +32 -32
  17. package/src/components/AccountInfo/AccountInfo.tsx +80 -80
  18. package/src/components/AddButton/AddButton.stories.tsx +21 -21
  19. package/src/components/AddButton/AddButton.tsx +52 -52
  20. package/src/components/Button/Button.tsx +129 -129
  21. package/src/components/Colors/Colors.stories.tsx +7 -7
  22. package/src/components/DateInput/DateInput.tsx +90 -90
  23. package/src/components/DateInput/constants.ts +2 -2
  24. package/src/components/Description/Description.stories.tsx +27 -27
  25. package/src/components/Description/Description.tsx +61 -61
  26. package/src/components/FiltersPane/components/FilterValueView/FilterValueView.tsx +166 -166
  27. package/src/components/FiltersPane/components/FilterWithDates/FilterWithDates.tsx +210 -210
  28. package/src/components/FiltersPane/components/FilterWithPeriod/FilterWithPeriod.tsx +177 -177
  29. package/src/components/Flag/Flag.stories.tsx +29 -29
  30. package/src/components/Flag/Flag.tsx +26 -26
  31. package/src/components/Flag/augment.d.ts +1 -1
  32. package/src/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.styles.ts +38 -38
  33. package/src/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.styles.ts +25 -25
  34. package/src/components/FlexibleTable/helpers.ts +13 -13
  35. package/src/components/Icon/Icon.stories.tsx +86 -86
  36. package/src/components/Icon/complexIcons/augment.d.ts +1 -1
  37. package/src/components/Icon/complexIcons/avatarGreen.svg +57 -57
  38. package/src/components/Icon/complexIcons/index.ts +1 -1
  39. package/src/components/IncrementInput/IncrementInput.tsx +105 -105
  40. package/src/components/Input/Input.tsx +297 -297
  41. package/src/components/Input/types.ts +32 -32
  42. package/src/components/List/List.stories.tsx +70 -70
  43. package/src/components/List/List.tsx +33 -33
  44. package/src/components/List/components/ListItem/ListItem.tsx +57 -57
  45. package/src/components/Modal/Modal.stories.tsx +105 -105
  46. package/src/components/MultiSelect/MultiSelect.stories.tsx +46 -46
  47. package/src/components/MultiSelect/MultiSelect.tsx +106 -106
  48. package/src/components/MultiSelect/components/MultiSelectInput/MultiSelectInput.tsx +53 -53
  49. package/src/components/Notification/Notification.stories.tsx +46 -46
  50. package/src/components/Notification/Notification.tsx +69 -69
  51. package/src/components/NumberInput/NumberInput.tsx +137 -137
  52. package/src/components/NumberInput/helpers.ts +4 -6
  53. package/src/components/NumberInput/index.ts +1 -1
  54. package/src/components/PhoneInput/PhoneInput.tsx +214 -214
  55. package/src/components/PhoneInput/components/PhoneInputCountryList/PhoneInputCountryList.tsx +155 -155
  56. package/src/components/PhoneInput/types.ts +16 -16
  57. package/src/components/RadioButton/RadioButton.stories.tsx +46 -46
  58. package/src/components/RadioButton/RadioButton.tsx +57 -57
  59. package/src/components/ScrollIntoViewIfNeeded/index.ts +1 -1
  60. package/src/components/Select/CustomSelect.stories.tsx +52 -16
  61. package/src/components/Select/MultiSelect.stories.tsx +3 -3
  62. package/src/components/Select/Select.stories.tsx +235 -235
  63. package/src/components/Select/Select.styles.ts +8 -7
  64. package/src/components/Select/Select.tsx +106 -62
  65. package/src/components/Select/components/SelectList/SelectList.styles.ts +6 -4
  66. package/src/components/Select/components/SelectList/SelectList.tsx +25 -29
  67. package/src/components/Select/components/SelectListItem/SelectListItem.tsx +23 -19
  68. package/src/components/Select/constants.ts +2 -2
  69. package/src/components/Select/helpers.ts +0 -7
  70. package/src/components/Select/types.ts +1 -1
  71. package/src/components/Selector/Selector.stories.tsx +62 -62
  72. package/src/components/Selector/Selector.tsx +115 -115
  73. package/src/components/Selector/index.ts +2 -2
  74. package/src/components/Selector/types.ts +12 -12
  75. package/src/components/Skeleton/Skeleton.stories.tsx +19 -19
  76. package/src/components/SmartInput/SmartInput.tsx +134 -134
  77. package/src/components/Status/Status.stories.tsx +73 -73
  78. package/src/components/Status/Status.styles.ts +143 -143
  79. package/src/components/Status/Status.tsx +49 -49
  80. package/src/components/Status/constants.ts +11 -11
  81. package/src/components/Status/index.ts +3 -3
  82. package/src/components/Status/types.ts +5 -5
  83. package/src/components/Switch/Switch.stories.tsx +40 -40
  84. package/src/components/Switch/Switch.tsx +75 -75
  85. package/src/components/TextWithInfo/TextWithInfo.stories.tsx +53 -53
  86. package/src/components/TextWithInfo/TextWithInfo.tsx +62 -62
  87. package/src/components/TextWithTooltip/TextWithTooltip.stories.tsx +58 -58
  88. package/src/components/TextWithTooltip/TextWithTooltip.tsx +2 -3
  89. package/src/components/ThemedPreloader/ThemedPreloader.stories.tsx +41 -41
  90. package/src/components/ThemedPreloader/ThemedPreloader.tsx +54 -54
  91. package/src/components/ThemedPreloader/components/DefaultPreloader/index.ts +1 -1
  92. package/src/components/Toaster/Toaster.stories.tsx +30 -30
  93. package/src/components/Tooltip/Tooltip.stories.tsx +19 -19
  94. package/src/components/Tooltip/Tooltip.tsx +35 -35
  95. package/src/components/Tooltip/types.ts +1 -1
  96. package/src/helpers/popper-helpers.ts +17 -17
  97. package/src/hooks/use-dropdown.ts +84 -84
  98. package/src/hooks/use-is-mounted.ts +15 -15
  99. package/src/theme/helpers.ts +76 -76
  100. 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
+ >;
@@ -1,13 +1,13 @@
1
- import { format } from 'date-fns';
2
- import { isNotEmpty } from '@true-engineering/true-react-platform-helpers';
3
- import { DEFAULT_DATE_FORMAT } from './constants';
4
- import { IFlexibleTableConfigType } from './types';
5
-
6
- export const hasHorizontalScrollBar = (el: HTMLElement | null | undefined): boolean =>
7
- isNotEmpty(el) && el.scrollWidth !== el.clientWidth;
8
-
9
- export const formatCellContent = <Values>(
10
- value: unknown,
11
- config?: IFlexibleTableConfigType<Values>[keyof Values],
12
- ): string =>
13
- value instanceof Date ? format(value, config?.dateFormat ?? DEFAULT_DATE_FORMAT) : String(value);
1
+ import { format } from 'date-fns';
2
+ import { isNotEmpty } from '@true-engineering/true-react-platform-helpers';
3
+ import { DEFAULT_DATE_FORMAT } from './constants';
4
+ import { IFlexibleTableConfigType } from './types';
5
+
6
+ export const hasHorizontalScrollBar = (el: HTMLElement | null | undefined): boolean =>
7
+ isNotEmpty(el) && el.scrollWidth !== el.clientWidth;
8
+
9
+ export const formatCellContent = <Values>(
10
+ value: unknown,
11
+ config?: IFlexibleTableConfigType<Values>[keyof Values],
12
+ ): string =>
13
+ value instanceof Date ? format(value, config?.dateFormat ?? DEFAULT_DATE_FORMAT) : String(value);