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

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 (70) hide show
  1. package/LICENSE +201 -201
  2. package/dist/components/Checkbox/Checkbox.d.ts +1 -1
  3. package/dist/components/FiltersPane/components/FilterSelect/FilterSelect.d.ts +1 -5
  4. package/dist/components/FiltersPane/components/FiltersPaneSearch/FiltersPaneSearch.d.ts +1 -3
  5. package/dist/components/Flag/augment.d.ts +1 -1
  6. package/dist/components/FlexibleTable/FlexibleTable.d.ts +5 -2
  7. package/dist/components/FlexibleTable/FlexibleTable.styles.d.ts +1 -1
  8. package/dist/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.d.ts +2 -2
  9. package/dist/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.d.ts +2 -2
  10. package/dist/components/FlexibleTable/helpers.d.ts +1 -0
  11. package/dist/components/FlexibleTable/types.d.ts +1 -1
  12. package/dist/components/Icon/complexIcons/augment.d.ts +1 -1
  13. package/dist/components/MultiSelectList/MultiSelectList.d.ts +1 -2
  14. package/dist/components/Switch/Switch.d.ts +1 -1
  15. package/dist/helpers/phone.d.ts +1 -1
  16. package/dist/hooks/index.d.ts +1 -0
  17. package/dist/hooks/use-mixed-styles.d.ts +1 -0
  18. package/dist/true-react-common-ui-kit.js +719 -411
  19. package/dist/true-react-common-ui-kit.js.map +1 -1
  20. package/dist/true-react-common-ui-kit.umd.cjs +719 -411
  21. package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
  22. package/dist/vite-env.d.ts +1 -1
  23. package/package.json +1 -1
  24. package/src/components/AddButton/AddButton.stories.tsx +21 -21
  25. package/src/components/Checkbox/Checkbox.styles.ts +1 -0
  26. package/src/components/Checkbox/Checkbox.tsx +1 -1
  27. package/src/components/Colors/Colors.stories.tsx +7 -7
  28. package/src/components/DateInput/DateInput.tsx +1 -9
  29. package/src/components/DateInput/constants.ts +2 -2
  30. package/src/components/DatePicker/DatePicker.stories.tsx +1 -0
  31. package/src/components/DatePicker/DatePicker.tsx +1 -3
  32. package/src/components/FiltersPane/FiltersPane.stories.tsx +0 -8
  33. package/src/components/FiltersPane/components/FilterInterval/FilterInterval.styles.ts +2 -1
  34. package/src/components/FiltersPane/components/FilterSelect/FilterSelect.styles.ts +3 -1
  35. package/src/components/FiltersPane/components/FilterSelect/FilterSelect.tsx +1 -6
  36. package/src/components/FiltersPane/components/FilterWithDates/FilterWithDates.styles.ts +2 -1
  37. package/src/components/FiltersPane/components/FiltersPaneSearch/FiltersPaneSearch.styles.ts +1 -0
  38. package/src/components/FiltersPane/components/FiltersPaneSearch/FiltersPaneSearch.tsx +1 -4
  39. package/src/components/FiltersPane/types.ts +1 -1
  40. package/src/components/Flag/augment.d.ts +1 -1
  41. package/src/components/FlexibleTable/FlexibleTable.stories.tsx +16 -14
  42. package/src/components/FlexibleTable/FlexibleTable.styles.ts +4 -10
  43. package/src/components/FlexibleTable/FlexibleTable.tsx +23 -17
  44. package/src/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.styles.ts +4 -0
  45. package/src/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.tsx +2 -2
  46. package/src/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.tsx +2 -2
  47. package/src/components/FlexibleTable/helpers.ts +4 -0
  48. package/src/components/FlexibleTable/types.ts +1 -1
  49. package/src/components/Icon/complexIcons/augment.d.ts +1 -1
  50. package/src/components/Icon/complexIcons/avatarGreen.svg +57 -57
  51. package/src/components/Icon/complexIcons/index.ts +1 -1
  52. package/src/components/MoreMenu/MoreMenu.stories.tsx +46 -46
  53. package/src/components/MultiSelectList/MultiSelectList.styles.ts +4 -0
  54. package/src/components/MultiSelectList/MultiSelectList.tsx +1 -3
  55. package/src/components/NumberInput/index.ts +1 -1
  56. package/src/components/PhoneInput/types.ts +16 -16
  57. package/src/components/ScrollIntoViewIfNeeded/index.ts +1 -1
  58. package/src/components/Select/Select.styles.ts +5 -3
  59. package/src/components/Select/constants.ts +2 -2
  60. package/src/components/Select/types.ts +1 -1
  61. package/src/components/Switch/Switch.tsx +2 -2
  62. package/src/components/TextWithTooltip/TextWithTooltip.stories.tsx +58 -58
  63. package/src/components/ThemedPreloader/components/DefaultPreloader/index.ts +1 -1
  64. package/src/components/Tooltip/types.ts +1 -1
  65. package/src/helpers/phone.ts +1 -1
  66. package/src/helpers/popper-helpers.ts +17 -17
  67. package/src/hooks/index.ts +1 -0
  68. package/src/hooks/use-is-mounted.ts +15 -15
  69. package/src/hooks/use-mixed-styles.ts +14 -0
  70. package/src/vite-env.d.ts +1 -1
@@ -1,58 +1,58 @@
1
- <svg
2
- width="100%"
3
- height="100%"
4
- viewBox="0 0 32 32"
5
- fill="none"
6
- xmlns="http://www.w3.org/2000/svg"
7
- >
8
- <circle opacity="0.5" cx="16" cy="16" r="16" fill="#DDE3ED" />
9
- <mask
10
- id="mask0_0_12744"
11
- style="mask-type: 'alpha';"
12
- maskUnits="userSpaceOnUse"
13
- x="0"
14
- y="0"
15
- width="32"
16
- height="32"
17
- >
18
- <circle cx="16" cy="16" r="16" fill="white" />
19
- </mask>
20
- <g mask="url(#mask0_0_12744)">
21
- <circle cx="16" cy="29" r="13" fill="url(#paint0_linear_0_12744)" />
22
- <mask
23
- id="mask1_0_12744"
24
- style="mask-type: 'alpha';"
25
- maskUnits="userSpaceOnUse"
26
- x="3"
27
- y="16"
28
- width="26"
29
- height="26"
30
- >
31
- <circle cx="16" cy="29" r="13" fill="white" />
32
- </mask>
33
- <g mask="url(#mask1_0_12744)">
34
- <ellipse
35
- cx="16"
36
- cy="17.5"
37
- rx="6"
38
- ry="7.5"
39
- fill="#505F79"
40
- fill-opacity="0.204983"
41
- />
42
- </g>
43
- </g>
44
- <ellipse cx="16" cy="13" rx="6" ry="7" fill="white" />
45
- <defs>
46
- <linearGradient
47
- id="paint0_linear_0_12744"
48
- x1="13.347"
49
- y1="46.279"
50
- x2="33.5318"
51
- y2="30.8088"
52
- gradientUnits="userSpaceOnUse"
53
- >
54
- <stop stop-color="#ABD229" />
55
- <stop offset="1" stop-color="#9CD03F" />
56
- </linearGradient>
57
- </defs>
1
+ <svg
2
+ width="100%"
3
+ height="100%"
4
+ viewBox="0 0 32 32"
5
+ fill="none"
6
+ xmlns="http://www.w3.org/2000/svg"
7
+ >
8
+ <circle opacity="0.5" cx="16" cy="16" r="16" fill="#DDE3ED" />
9
+ <mask
10
+ id="mask0_0_12744"
11
+ style="mask-type: 'alpha';"
12
+ maskUnits="userSpaceOnUse"
13
+ x="0"
14
+ y="0"
15
+ width="32"
16
+ height="32"
17
+ >
18
+ <circle cx="16" cy="16" r="16" fill="white" />
19
+ </mask>
20
+ <g mask="url(#mask0_0_12744)">
21
+ <circle cx="16" cy="29" r="13" fill="url(#paint0_linear_0_12744)" />
22
+ <mask
23
+ id="mask1_0_12744"
24
+ style="mask-type: 'alpha';"
25
+ maskUnits="userSpaceOnUse"
26
+ x="3"
27
+ y="16"
28
+ width="26"
29
+ height="26"
30
+ >
31
+ <circle cx="16" cy="29" r="13" fill="white" />
32
+ </mask>
33
+ <g mask="url(#mask1_0_12744)">
34
+ <ellipse
35
+ cx="16"
36
+ cy="17.5"
37
+ rx="6"
38
+ ry="7.5"
39
+ fill="#505F79"
40
+ fill-opacity="0.204983"
41
+ />
42
+ </g>
43
+ </g>
44
+ <ellipse cx="16" cy="13" rx="6" ry="7" fill="white" />
45
+ <defs>
46
+ <linearGradient
47
+ id="paint0_linear_0_12744"
48
+ x1="13.347"
49
+ y1="46.279"
50
+ x2="33.5318"
51
+ y2="30.8088"
52
+ gradientUnits="userSpaceOnUse"
53
+ >
54
+ <stop stop-color="#ABD229" />
55
+ <stop offset="1" stop-color="#9CD03F" />
56
+ </linearGradient>
57
+ </defs>
58
58
  </svg>
@@ -1 +1 @@
1
- export * from './icons';
1
+ export * from './icons';
@@ -1,46 +1,46 @@
1
- import { ComponentStory } from '@storybook/react';
2
- import { colors } from '../../theme';
3
- import { MoreMenu } from './MoreMenu';
4
-
5
- const menuItems = [
6
- { item: 'Печатать билет', onClick: console.log },
7
- { item: 'Выписать', onClick: console.log },
8
- { item: 'Аннулировать', onClick: console.log, shouldDrawSpacerBelow: true },
9
- {
10
- item: (() => <div style={{ color: colors.RED_ACTIVE }}>Удалить</div>)(),
11
- onClick: console.log,
12
- },
13
- {
14
- item: (() => <div style={{ color: colors.RED_ACTIVE }}>Удалить</div>)(),
15
- onClick: console.log,
16
- },
17
- ];
18
-
19
- export default {
20
- title: 'MoreMenu',
21
- component: MoreMenu,
22
- };
23
-
24
- const Template: ComponentStory<typeof MoreMenu> = (args) => (
25
- <div
26
- style={{
27
- display: 'flex',
28
- alignItems: 'center',
29
- justifyContent: 'center',
30
- width: 600,
31
- height: 400,
32
- }}
33
- >
34
- <div style={{ display: 'flex', gap: 10, alignItems: 'center' }}>
35
- <div style={{ flexShrink: 0 }}>Test subject</div>
36
- <MoreMenu {...args} items={menuItems} />
37
- </div>
38
- </div>
39
- );
40
-
41
- export const Default = Template.bind({});
42
-
43
- Default.args = {
44
- isDisabled: false,
45
- hasDefaultStateBackground: true,
46
- };
1
+ import { ComponentStory } from '@storybook/react';
2
+ import { colors } from '../../theme';
3
+ import { MoreMenu } from './MoreMenu';
4
+
5
+ const menuItems = [
6
+ { item: 'Печатать билет', onClick: console.log },
7
+ { item: 'Выписать', onClick: console.log },
8
+ { item: 'Аннулировать', onClick: console.log, shouldDrawSpacerBelow: true },
9
+ {
10
+ item: (() => <div style={{ color: colors.RED_ACTIVE }}>Удалить</div>)(),
11
+ onClick: console.log,
12
+ },
13
+ {
14
+ item: (() => <div style={{ color: colors.RED_ACTIVE }}>Удалить</div>)(),
15
+ onClick: console.log,
16
+ },
17
+ ];
18
+
19
+ export default {
20
+ title: 'MoreMenu',
21
+ component: MoreMenu,
22
+ };
23
+
24
+ const Template: ComponentStory<typeof MoreMenu> = (args) => (
25
+ <div
26
+ style={{
27
+ display: 'flex',
28
+ alignItems: 'center',
29
+ justifyContent: 'center',
30
+ width: 600,
31
+ height: 400,
32
+ }}
33
+ >
34
+ <div style={{ display: 'flex', gap: 10, alignItems: 'center' }}>
35
+ <div style={{ flexShrink: 0 }}>Test subject</div>
36
+ <MoreMenu {...args} items={menuItems} />
37
+ </div>
38
+ </div>
39
+ );
40
+
41
+ export const Default = Template.bind({});
42
+
43
+ Default.args = {
44
+ isDisabled: false,
45
+ hasDefaultStateBackground: true,
46
+ };
@@ -8,6 +8,7 @@ const TOP_GAP = 12;
8
8
 
9
9
  export const useStyles = createThemedStyles('MultiSelectList', {
10
10
  root: {
11
+ width: 220,
11
12
  background: colors.CLASSIC_WHITE,
12
13
  },
13
14
 
@@ -101,10 +102,13 @@ export const searchInputStyles: ISearchInputStyles = {
101
102
  export const checkboxStyles: ICheckboxStyles = {
102
103
  root: {
103
104
  padding: [11, 16],
105
+ boxSizing: 'border-box',
106
+ width: '100%',
104
107
  },
105
108
 
106
109
  children: {
107
110
  marginRight: 'auto',
111
+ overflow: 'hidden',
108
112
  },
109
113
  };
110
114
 
@@ -22,7 +22,6 @@ import {
22
22
  export interface IMultiSelectListProps<Value, Option> extends ICommonProps<IMultiSelectListStyles> {
23
23
  value?: Value;
24
24
  isSearchEnabled?: boolean;
25
- width?: number | string;
26
25
  localeKey?: IMultiSelectLocaleKey;
27
26
  locale?: Partial<IMultiSelectLocale>;
28
27
  onClose?: () => void;
@@ -43,7 +42,6 @@ export function MultiSelectList<Value extends IMultiSelectListValues<Option>, Op
43
42
  tweakStyles,
44
43
  data,
45
44
  isSearchEnabled = false,
46
- width = 220,
47
45
  localeKey = DEFAULT_LOCALE,
48
46
  locale = MultiSelectLocales[localeKey],
49
47
  onChange,
@@ -329,7 +327,7 @@ export function MultiSelectList<Value extends IMultiSelectListValues<Option>, Op
329
327
  const shouldShowOptionsList = !isLoading && allOptions.length !== 0;
330
328
 
331
329
  return (
332
- <div className={classes.root} style={{ width }} {...addDataAttributes(data)}>
330
+ <div className={classes.root} {...addDataAttributes(data)}>
333
331
  {isSearchEnabled && (
334
332
  <div className={classes.dropdownInput}>
335
333
  <SearchInput
@@ -1 +1 @@
1
- export * from './NumberInput';
1
+ export * from './NumberInput';
@@ -1,16 +1,16 @@
1
- export interface IPhoneInfo {
2
- countryEn: string;
3
- countryRu: string;
4
- countryCode: string;
5
- dialCode: string;
6
- phoneMask?: string;
7
- dialCodePriority?: number;
8
- areaCodes?: string[];
9
- fullCodes: string[];
10
- }
11
-
12
- export interface IPhoneValue {
13
- phoneNumber?: string;
14
- dialCode?: string;
15
- countryCode?: string;
16
- }
1
+ export interface IPhoneInfo {
2
+ countryEn: string;
3
+ countryRu: string;
4
+ countryCode: string;
5
+ dialCode: string;
6
+ phoneMask?: string;
7
+ dialCodePriority?: number;
8
+ areaCodes?: string[];
9
+ fullCodes: string[];
10
+ }
11
+
12
+ export interface IPhoneValue {
13
+ phoneNumber?: string;
14
+ dialCode?: string;
15
+ countryCode?: string;
16
+ }
@@ -1 +1 @@
1
- export * from './ScrollIntoViewIfNeeded';
1
+ export * from './ScrollIntoViewIfNeeded';
@@ -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
 
@@ -1,2 +1,2 @@
1
- export const DEFAULT_OPTION_INDEX = -2;
2
- export const ALL_OPTION_INDEX = -1;
1
+ export const DEFAULT_OPTION_INDEX = -2;
2
+ export const ALL_OPTION_INDEX = -1;
@@ -1 +1 @@
1
- export type IMultipleSelectValue<Value> = Array<NonNullable<Value>>;
1
+ export type IMultipleSelectValue<Value> = Array<NonNullable<Value>>;
@@ -9,7 +9,7 @@ import { useStyles, ISwitchStyles } from './Switch.styles';
9
9
  export interface ISwitchProps<V extends string> extends ICommonProps<ISwitchStyles> {
10
10
  children?: ReactNode;
11
11
  value: V;
12
- isChecked: boolean;
12
+ isChecked: boolean | undefined;
13
13
  isDisabled?: boolean;
14
14
  isInvalid?: boolean;
15
15
  /**
@@ -25,7 +25,7 @@ export interface ISwitchProps<V extends string> extends ICommonProps<ISwitchStyl
25
25
 
26
26
  export const Switch = <V extends string>({
27
27
  isDisabled,
28
- isChecked,
28
+ isChecked = false,
29
29
  isInvalid,
30
30
  value,
31
31
  children,
@@ -1,58 +1,58 @@
1
- import { ComponentStory } from '@storybook/react';
2
- import { TextWithTooltip } from './TextWithTooltip';
3
-
4
- const positions = [
5
- 'top',
6
- 'bottom',
7
- 'right',
8
- 'left',
9
- 'top-start',
10
- 'top-end',
11
- 'bottom-start',
12
- 'bottom-end',
13
- 'right-start',
14
- 'right-end',
15
- 'left-start',
16
- 'left-end',
17
- 'auto',
18
- 'auto-start',
19
- 'auto-end',
20
- ];
21
-
22
- export default {
23
- title: 'TextWithTooltip',
24
- component: TextWithTooltip,
25
- argTypes: {
26
- tooltipPosition: { control: 'select', options: positions },
27
- tooltipView: { control: 'inline-radio', options: ['tooltip', 'hint'] },
28
- tooltipType: { control: 'inline-radio', options: ['info', 'error'] },
29
- mouseEventType: { control: 'inline-radio', options: ['hover', 'click'] },
30
- },
31
- };
32
-
33
- const Template: ComponentStory<typeof TextWithTooltip> = (args) => (
34
- <div
35
- style={{
36
- display: 'flex',
37
- alignItems: 'center',
38
- justifyContent: 'center',
39
- width: 600,
40
- height: 400,
41
- }}
42
- >
43
- <TextWithTooltip {...args} />
44
- </div>
45
- );
46
-
47
- export const Default = Template.bind({});
48
-
49
- Default.args = {
50
- children: 'Наведи на меня - появится тултип',
51
- tooltipText: 'Текст тултипа',
52
- tooltipPosition: 'top',
53
- tooltipView: 'tooltip',
54
- tooltipType: 'info',
55
- isDisabled: false,
56
- mouseEventType: 'hover',
57
- shouldRenderInBody: true,
58
- };
1
+ import { ComponentStory } from '@storybook/react';
2
+ import { TextWithTooltip } from './TextWithTooltip';
3
+
4
+ const positions = [
5
+ 'top',
6
+ 'bottom',
7
+ 'right',
8
+ 'left',
9
+ 'top-start',
10
+ 'top-end',
11
+ 'bottom-start',
12
+ 'bottom-end',
13
+ 'right-start',
14
+ 'right-end',
15
+ 'left-start',
16
+ 'left-end',
17
+ 'auto',
18
+ 'auto-start',
19
+ 'auto-end',
20
+ ];
21
+
22
+ export default {
23
+ title: 'TextWithTooltip',
24
+ component: TextWithTooltip,
25
+ argTypes: {
26
+ tooltipPosition: { control: 'select', options: positions },
27
+ tooltipView: { control: 'inline-radio', options: ['tooltip', 'hint'] },
28
+ tooltipType: { control: 'inline-radio', options: ['info', 'error'] },
29
+ mouseEventType: { control: 'inline-radio', options: ['hover', 'click'] },
30
+ },
31
+ };
32
+
33
+ const Template: ComponentStory<typeof TextWithTooltip> = (args) => (
34
+ <div
35
+ style={{
36
+ display: 'flex',
37
+ alignItems: 'center',
38
+ justifyContent: 'center',
39
+ width: 600,
40
+ height: 400,
41
+ }}
42
+ >
43
+ <TextWithTooltip {...args} />
44
+ </div>
45
+ );
46
+
47
+ export const Default = Template.bind({});
48
+
49
+ Default.args = {
50
+ children: 'Наведи на меня - появится тултип',
51
+ tooltipText: 'Текст тултипа',
52
+ tooltipPosition: 'top',
53
+ tooltipView: 'tooltip',
54
+ tooltipType: 'info',
55
+ isDisabled: false,
56
+ mouseEventType: 'hover',
57
+ shouldRenderInBody: true,
58
+ };
@@ -1 +1 @@
1
- export * from './DefaultPreloader';
1
+ export * from './DefaultPreloader';
@@ -1 +1 @@
1
- export type ITooltipType = 'info' | 'warning';
1
+ export type ITooltipType = 'info' | 'warning';
@@ -18,7 +18,7 @@ export const getCountryTextByLocale = (country: IPhoneInfo, locale: string): str
18
18
  locale.toLowerCase() === 'ru' ? country.countryRu : country.countryEn;
19
19
 
20
20
  /**
21
- * Мутирует!
21
+ * Мутирует countriesList!
22
22
  */
23
23
  export const sortCountriesByLocale = (countriesList: IPhoneInfo[], locale: string): IPhoneInfo[] =>
24
24
  countriesList.sort((countryA, countryB) =>
@@ -1,17 +1,17 @@
1
- import { Modifier } from 'react-overlays/usePopper';
2
-
3
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
- export const minWidthModifier: Partial<Modifier<any, any>> = {
5
- name: 'minWidth',
6
- enabled: true,
7
- phase: 'beforeWrite',
8
- requires: ['computeStyles'],
9
- fn: ({ state }) => {
10
- state.styles.popper.minWidth = `${state.rects.reference.width}px`;
11
- },
12
- effect: ({ state }) => {
13
- state.elements.popper.style.minWidth = `${
14
- (state.elements.reference as HTMLElement).offsetWidth
15
- }px`;
16
- },
17
- };
1
+ import { Modifier } from 'react-overlays/usePopper';
2
+
3
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
+ export const minWidthModifier: Partial<Modifier<any, any>> = {
5
+ name: 'minWidth',
6
+ enabled: true,
7
+ phase: 'beforeWrite',
8
+ requires: ['computeStyles'],
9
+ fn: ({ state }) => {
10
+ state.styles.popper.minWidth = `${state.rects.reference.width}px`;
11
+ },
12
+ effect: ({ state }) => {
13
+ state.elements.popper.style.minWidth = `${
14
+ (state.elements.reference as HTMLElement).offsetWidth
15
+ }px`;
16
+ },
17
+ };
@@ -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';
@@ -1,15 +1,15 @@
1
- import { useCallback, useEffect, useRef } from 'react';
2
-
3
- export const useIsMounted = (): (() => boolean) => {
4
- const isMounted = useRef(false);
5
-
6
- useEffect(() => {
7
- isMounted.current = true;
8
-
9
- return () => {
10
- isMounted.current = false;
11
- };
12
- }, []);
13
-
14
- return useCallback(() => isMounted.current, []);
15
- };
1
+ import { useCallback, useEffect, useRef } from 'react';
2
+
3
+ export const useIsMounted = (): (() => boolean) => {
4
+ const isMounted = useRef(false);
5
+
6
+ useEffect(() => {
7
+ isMounted.current = true;
8
+
9
+ return () => {
10
+ isMounted.current = false;
11
+ };
12
+ }, []);
13
+
14
+ return useCallback(() => isMounted.current, []);
15
+ };
@@ -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
+ );
package/src/vite-env.d.ts CHANGED
@@ -1 +1 @@
1
- /// <reference types="vite/client" />
1
+ /// <reference types="vite/client" />