@true-engineering/true-react-common-ui-kit 3.0.0-alpha.20 → 3.0.0-alpha.21

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 (32) hide show
  1. package/LICENSE +201 -201
  2. package/dist/components/Flag/augment.d.ts +1 -1
  3. package/dist/components/Icon/complexIcons/augment.d.ts +1 -1
  4. package/dist/components/List/List.d.ts +2 -2
  5. package/dist/components/List/types.d.ts +2 -2
  6. package/dist/true-react-common-ui-kit.js +62 -62
  7. package/dist/true-react-common-ui-kit.js.map +1 -1
  8. package/dist/true-react-common-ui-kit.umd.cjs +62 -62
  9. package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
  10. package/dist/vite-env.d.ts +1 -1
  11. package/package.json +1 -1
  12. package/src/components/AddButton/AddButton.stories.tsx +21 -21
  13. package/src/components/Colors/Colors.stories.tsx +7 -7
  14. package/src/components/DateInput/constants.ts +2 -2
  15. package/src/components/Flag/augment.d.ts +1 -1
  16. package/src/components/Icon/complexIcons/augment.d.ts +1 -1
  17. package/src/components/Icon/complexIcons/avatarGreen.svg +57 -57
  18. package/src/components/Icon/complexIcons/index.ts +1 -1
  19. package/src/components/List/List.tsx +6 -6
  20. package/src/components/List/types.ts +2 -2
  21. package/src/components/MoreMenu/MoreMenu.stories.tsx +46 -46
  22. package/src/components/NumberInput/index.ts +1 -1
  23. package/src/components/PhoneInput/types.ts +16 -16
  24. package/src/components/ScrollIntoViewIfNeeded/index.ts +1 -1
  25. package/src/components/Select/constants.ts +2 -2
  26. package/src/components/Select/types.ts +1 -1
  27. package/src/components/TextWithTooltip/TextWithTooltip.stories.tsx +58 -58
  28. package/src/components/ThemedPreloader/components/DefaultPreloader/index.ts +1 -1
  29. package/src/components/Tooltip/types.ts +1 -1
  30. package/src/helpers/popper-helpers.ts +17 -17
  31. package/src/hooks/use-is-mounted.ts +15 -15
  32. package/src/vite-env.d.ts +1 -1
@@ -1 +1 @@
1
- /// <reference types="vite/client" />
1
+ /// <reference types="vite/client" />
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.20",
3
+ "version": "3.0.0-alpha.21",
4
4
  "description": "True Engineering React UI Kit with theming support",
5
5
  "author": "True Engineering (https://trueengineering.ru)",
6
6
  "keywords": [
@@ -1,21 +1,21 @@
1
- import { ComponentStory } from '@storybook/react';
2
- import { AddButton } from './AddButton';
3
-
4
- export default {
5
- title: 'AddButton',
6
- component: AddButton,
7
- };
8
-
9
- const Template: ComponentStory<typeof AddButton> = (args) => (
10
- <AddButton {...args} onClick={console.log} />
11
- );
12
-
13
- export const Default = Template.bind({});
14
-
15
- Default.args = {
16
- text: 'Добавить билет',
17
- isDisabled: false,
18
- isFullWidth: false,
19
- };
20
-
21
- Default.parameters = { controls: { exclude: ['onClick'] } };
1
+ import { ComponentStory } from '@storybook/react';
2
+ import { AddButton } from './AddButton';
3
+
4
+ export default {
5
+ title: 'AddButton',
6
+ component: AddButton,
7
+ };
8
+
9
+ const Template: ComponentStory<typeof AddButton> = (args) => (
10
+ <AddButton {...args} onClick={console.log} />
11
+ );
12
+
13
+ export const Default = Template.bind({});
14
+
15
+ Default.args = {
16
+ text: 'Добавить билет',
17
+ isDisabled: false,
18
+ isFullWidth: false,
19
+ };
20
+
21
+ Default.parameters = { controls: { exclude: ['onClick'] } };
@@ -1,7 +1,7 @@
1
- import { Colors } from './Colors';
2
-
3
- export default {
4
- title: 'Colors',
5
- };
6
-
7
- export const Default = (): JSX.Element => <Colors />;
1
+ import { Colors } from './Colors';
2
+
3
+ export default {
4
+ title: 'Colors',
5
+ };
6
+
7
+ export const Default = (): JSX.Element => <Colors />;
@@ -1,2 +1,2 @@
1
- export const EMPTY_DATE_INPUT_VALUE = '__.__.____';
2
- export const EMPTY_DATE_RANGE_INPUT_VALUE = `${EMPTY_DATE_INPUT_VALUE} - ${EMPTY_DATE_INPUT_VALUE}`;
1
+ export const EMPTY_DATE_INPUT_VALUE = '__.__.____';
2
+ export const EMPTY_DATE_RANGE_INPUT_VALUE = `${EMPTY_DATE_INPUT_VALUE} - ${EMPTY_DATE_INPUT_VALUE}`;
@@ -1 +1 @@
1
- declare module 'country-flag-icons/react/3x2';
1
+ declare module 'country-flag-icons/react/3x2';
@@ -1 +1 @@
1
- declare module '*.svg?raw';
1
+ declare module '*.svg?raw';
@@ -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,4 +1,4 @@
1
- import { FC, Fragment } from 'react';
1
+ import { FC, Fragment, MouseEvent } from 'react';
2
2
  import clsx from 'clsx';
3
3
  import {
4
4
  addDataTestId,
@@ -13,15 +13,15 @@ import { useStyles, IListStyles } from './List.styles';
13
13
 
14
14
  export interface IListProps extends ICommonProps<IListStyles> {
15
15
  items: IListItem[];
16
- onClick?(): void;
16
+ onClick?(event: MouseEvent): void;
17
17
  }
18
18
 
19
19
  export const List: FC<IListProps> = ({ items, testId, data, tweakStyles, onClick }) => {
20
20
  const classes = useStyles({ theme: tweakStyles });
21
21
 
22
- const handleItemClick = (item: IListItem) => {
23
- item.onClick();
24
- onClick?.();
22
+ const handleItemClick = (event: MouseEvent, item: IListItem) => {
23
+ item.onClick(event);
24
+ onClick?.(event);
25
25
  };
26
26
 
27
27
  return (
@@ -34,7 +34,7 @@ export const List: FC<IListProps> = ({ items, testId, data, tweakStyles, onClick
34
34
  [classes.disabledItem]: item.disabled,
35
35
  [classes.withIconGap]: item.withIconGap,
36
36
  })}
37
- onClick={item.disabled ? undefined : () => handleItemClick(item)}
37
+ onClick={item.disabled ? undefined : (event) => handleItemClick(event, item)}
38
38
  {...addDataTestId(item.testId ?? getTestId(testId, `item-${idx}`))}
39
39
  {...(item.disabled && addDataAttributes({ disabled: item.disabled }))}
40
40
  >
@@ -1,4 +1,4 @@
1
- import { ReactNode } from 'react';
1
+ import { ReactNode, MouseEvent } from 'react';
2
2
  import { IIcon } from '../../types';
3
3
 
4
4
  export interface IListItem {
@@ -9,5 +9,5 @@ export interface IListItem {
9
9
  shouldDrawSpacerBelow?: boolean;
10
10
  withIconGap?: boolean;
11
11
  testId?: string;
12
- onClick(): void;
12
+ onClick(event: MouseEvent): void;
13
13
  }
@@ -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
+ };
@@ -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';
@@ -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>>;
@@ -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';
@@ -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
+ };
@@ -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
+ };
package/src/vite-env.d.ts CHANGED
@@ -1 +1 @@
1
- /// <reference types="vite/client" />
1
+ /// <reference types="vite/client" />