@true-engineering/true-react-common-ui-kit 3.0.0-alpha.9 → 3.0.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.
- package/README.md +26 -0
- package/dist/components/Button/Button.d.ts +2 -1
- package/dist/components/Button/Button.styles.d.ts +1 -1
- package/dist/components/Checkbox/Checkbox.styles.d.ts +1 -1
- package/dist/components/DatePicker/components/DatePickerHeader/DatePickerHeader.styles.d.ts +1 -1
- package/dist/components/Description/Description.styles.d.ts +1 -1
- package/dist/components/FiltersPane/FiltersPane.styles.d.ts +1 -1
- package/dist/components/FiltersPane/components/Filter/Filter.d.ts +1 -1
- package/dist/components/FiltersPane/components/FilterInterval/FilterInterval.styles.d.ts +2 -2
- package/dist/components/FiltersPane/components/FilterSelect/FilterSelect.styles.d.ts +3 -3
- package/dist/components/FiltersPane/components/FilterValueView/FilterValueView.d.ts +1 -1
- package/dist/components/FiltersPane/components/FilterWithDates/FilterWithDates.styles.d.ts +4 -4
- package/dist/components/FiltersPane/components/FilterWrapper/FilterWrapper.styles.d.ts +1 -1
- package/dist/components/FiltersPane/constants.d.ts +1 -1
- package/dist/components/FiltersPane/types.d.ts +1 -1
- package/dist/components/FlexibleTable/FlexibleTable.d.ts +3 -2
- package/dist/components/FlexibleTable/FlexibleTable.styles.d.ts +2 -2
- package/dist/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.d.ts +2 -3
- package/dist/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.d.ts +1 -1
- package/dist/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.styles.d.ts +1 -1
- package/dist/components/FlexibleTable/helpers.d.ts +3 -0
- package/dist/components/FlexibleTable/types.d.ts +1 -1
- package/dist/components/Icon/helpers.d.ts +1 -1
- package/dist/components/Icon/icons-list.d.ts +1 -1
- package/dist/components/Icon/index.d.ts +1 -0
- package/dist/{helpers/snippets.d.ts → components/Icon/snippet.d.ts} +1 -1
- package/dist/components/Icon/types.d.ts +2 -1
- package/dist/components/Input/Input.d.ts +2 -1
- package/dist/components/Input/Input.styles.d.ts +1 -1
- package/dist/components/List/List.d.ts +3 -3
- package/dist/components/List/components/ListItem/ListItem.d.ts +15 -0
- package/dist/components/List/components/ListItem/ListItem.styles.d.ts +3 -0
- package/dist/components/List/components/ListItem/index.d.ts +2 -0
- package/dist/components/List/components/index.d.ts +1 -0
- package/dist/components/List/index.d.ts +1 -1
- package/dist/components/Modal/Modal.styles.d.ts +1 -1
- package/dist/components/MoreMenu/MoreMenu.styles.d.ts +1 -1
- package/dist/components/MultiSelect/MultiSelect.styles.d.ts +1 -1
- package/dist/components/MultiSelect/components/MultiSelectInput/MultiSelectInput.d.ts +2 -1
- package/dist/components/MultiSelect/components/MultiSelectInput/MultiSelectInput.styles.d.ts +1 -1
- package/dist/components/MultiSelectList/MultiSelectList.styles.d.ts +1 -1
- package/dist/components/Notification/Notification.styles.d.ts +1 -1
- package/dist/components/NumberInput/helpers.d.ts +1 -1
- package/dist/components/PhoneInput/PhoneInput.styles.d.ts +1 -1
- package/dist/components/PhoneInput/index.d.ts +0 -1
- package/dist/components/ScrollIntoViewIfNeeded/ScrollIntoViewIfNeeded.d.ts +5 -5
- package/dist/components/Select/Select.d.ts +2 -1
- package/dist/components/Select/Select.styles.d.ts +7 -7
- package/dist/components/Select/components/SelectList/SelectList.styles.d.ts +1 -1
- package/dist/components/Skeleton/Skeleton.d.ts +7 -0
- package/dist/components/Skeleton/Skeleton.styles.d.ts +3 -0
- package/dist/components/Skeleton/index.d.ts +2 -0
- package/dist/components/Switch/Switch.styles.d.ts +1 -1
- package/dist/components/TextArea/TextArea.styles.d.ts +1 -1
- package/dist/components/ThemedPreloader/ThemedPreloader.styles.d.ts +1 -1
- package/dist/components/Toaster/Toaster.styles.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.styles.d.ts +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/phone-info.d.ts +2 -0
- package/dist/helpers/phone.d.ts +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/use-merged-refs.d.ts +2 -0
- package/dist/index.d.ts +1 -1
- package/dist/theme/types.d.ts +3 -1
- package/dist/true-react-common-ui-kit.js +24269 -24084
- package/dist/true-react-common-ui-kit.js.map +1 -1
- package/dist/true-react-common-ui-kit.umd.cjs +24268 -24083
- package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
- package/dist/types.d.ts +0 -3
- package/package.json +2 -1
- package/src/components/Button/Button.tsx +2 -2
- package/src/components/FiltersPane/components/Filter/Filter.tsx +1 -1
- package/src/components/FiltersPane/components/FilterValueView/FilterValueView.tsx +1 -1
- package/src/components/FiltersPane/components/FilterWrapper/FilterWrapper.styles.ts +1 -1
- package/src/components/FiltersPane/constants.ts +1 -1
- package/src/components/FiltersPane/types.ts +1 -1
- package/src/components/FlexibleTable/FlexibleTable.stories.tsx +1 -0
- package/src/components/FlexibleTable/FlexibleTable.styles.ts +6 -1
- package/src/components/FlexibleTable/FlexibleTable.tsx +118 -55
- package/src/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.tsx +26 -30
- package/src/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.styles.ts +4 -0
- package/src/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.tsx +13 -12
- package/src/components/FlexibleTable/helpers.ts +15 -0
- package/src/components/FlexibleTable/types.ts +1 -1
- package/src/components/Icon/{helpers.ts → helpers.tsx} +1 -1
- package/src/components/Icon/icons-list.ts +30 -0
- package/src/components/Icon/index.ts +1 -0
- package/src/{helpers/snippets.tsx → components/Icon/snippet.tsx} +2 -2
- package/src/components/Icon/types.ts +3 -1
- package/src/components/Input/Input.tsx +2 -3
- package/src/components/List/List.stories.tsx +11 -4
- package/src/components/List/List.tsx +9 -32
- package/src/components/List/components/ListItem/ListItem.styles.ts +47 -0
- package/src/components/List/components/ListItem/ListItem.tsx +57 -0
- package/src/components/List/components/ListItem/index.ts +2 -0
- package/src/components/List/components/index.ts +1 -0
- package/src/components/List/index.ts +1 -1
- package/src/components/MultiSelect/components/MultiSelectInput/MultiSelectInput.tsx +3 -2
- package/src/components/NumberInput/helpers.ts +1 -1
- package/src/components/PhoneInput/PhoneInput.stories.tsx +1 -1
- package/src/components/PhoneInput/components/PhoneInputCountryList/PhoneInputCountryList.tsx +1 -1
- package/src/components/PhoneInput/index.ts +0 -1
- package/src/components/Select/Select.tsx +2 -2
- package/src/components/Skeleton/Skeleton.stories.tsx +19 -0
- package/src/components/Skeleton/Skeleton.styles.ts +46 -0
- package/src/components/Skeleton/Skeleton.tsx +12 -0
- package/src/components/Skeleton/index.ts +2 -0
- package/src/components/index.ts +1 -0
- package/src/constants/index.ts +1 -0
- package/src/{components/PhoneInput → constants}/phone-info.ts +1 -1
- package/src/helpers/phone.ts +2 -1
- package/src/hooks/index.ts +1 -0
- package/src/hooks/use-merged-refs.ts +4 -0
- package/src/index.ts +1 -1
- package/src/theme/types.ts +4 -0
- package/src/types.ts +0 -4
- package/dist/components/List/types.d.ts +0 -12
- package/dist/components/PhoneInput/phone-info.d.ts +0 -2
- package/src/components/List/types.ts +0 -13
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
2
2
|
import { colors } from '../../theme';
|
|
3
3
|
import { List } from './List';
|
|
4
|
-
import { IListItem } from './
|
|
4
|
+
import { IListItemProps as IListItem } from './components';
|
|
5
5
|
|
|
6
6
|
const listItems: IListItem[] = [
|
|
7
7
|
{
|
|
@@ -23,15 +23,22 @@ const listItems: IListItem[] = [
|
|
|
23
23
|
shouldDrawSpacerBelow: true,
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
|
-
item: (() => <div style={{ color: colors.
|
|
26
|
+
item: (() => <div style={{ color: colors.GREEN_FOCUS }}>Test</div>)(),
|
|
27
27
|
onClick: console.log,
|
|
28
|
-
disabled: true,
|
|
29
28
|
withIconGap: true,
|
|
30
29
|
},
|
|
31
30
|
{
|
|
32
|
-
item:
|
|
31
|
+
item: 'Удалить',
|
|
33
32
|
onClick: console.log,
|
|
33
|
+
disabled: true,
|
|
34
34
|
withIconGap: true,
|
|
35
|
+
view: 'destructive',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
item: 'Удалить',
|
|
39
|
+
icon: 'trash-can',
|
|
40
|
+
onClick: console.log,
|
|
41
|
+
view: 'destructive',
|
|
35
42
|
},
|
|
36
43
|
];
|
|
37
44
|
|
|
@@ -1,50 +1,27 @@
|
|
|
1
|
-
import { FC,
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
addDataTestId,
|
|
5
|
-
getTestId,
|
|
6
|
-
isReactNodeNotEmpty,
|
|
7
|
-
} from '@true-engineering/true-react-platform-helpers';
|
|
1
|
+
import { FC, KeyboardEvent, MouseEvent } from 'react';
|
|
2
|
+
import { addDataTestId } from '@true-engineering/true-react-platform-helpers';
|
|
8
3
|
import { addDataAttributes } from '../../helpers';
|
|
9
|
-
import { renderIcon } from '../../helpers/snippets';
|
|
10
4
|
import { ICommonProps } from '../../types';
|
|
11
|
-
import { IListItem } from './
|
|
5
|
+
import { IListItemProps as IListItem, ListItem } from './components';
|
|
12
6
|
import { useStyles, IListStyles } from './List.styles';
|
|
13
7
|
|
|
14
8
|
export interface IListProps extends ICommonProps<IListStyles> {
|
|
15
9
|
items: IListItem[];
|
|
16
|
-
onClick?(): void;
|
|
10
|
+
onClick?(event: MouseEvent | KeyboardEvent): void;
|
|
17
11
|
}
|
|
18
12
|
|
|
19
13
|
export const List: FC<IListProps> = ({ items, testId, data, tweakStyles, onClick }) => {
|
|
20
14
|
const classes = useStyles({ theme: tweakStyles });
|
|
21
15
|
|
|
22
|
-
const handleItemClick = (item: IListItem) => {
|
|
23
|
-
item.onClick();
|
|
24
|
-
onClick?.();
|
|
16
|
+
const handleItemClick = (event: MouseEvent | KeyboardEvent, item: IListItem) => {
|
|
17
|
+
item.onClick(event);
|
|
18
|
+
onClick?.(event);
|
|
25
19
|
};
|
|
26
20
|
|
|
27
21
|
return (
|
|
28
22
|
<div className={classes.root} {...addDataTestId(testId)} {...addDataAttributes(data)}>
|
|
29
|
-
{items.map((item,
|
|
30
|
-
<
|
|
31
|
-
{item.shouldDrawSpacerAbove && <div className={classes.spacer} />}
|
|
32
|
-
<div
|
|
33
|
-
className={clsx(classes.item, {
|
|
34
|
-
[classes.disabledItem]: item.disabled,
|
|
35
|
-
[classes.withIconGap]: item.withIconGap,
|
|
36
|
-
})}
|
|
37
|
-
onClick={item.disabled ? undefined : () => handleItemClick(item)}
|
|
38
|
-
{...addDataTestId(item.testId ?? getTestId(testId, `item-${idx}`))}
|
|
39
|
-
{...(item.disabled && addDataAttributes({ disabled: item.disabled }))}
|
|
40
|
-
>
|
|
41
|
-
{isReactNodeNotEmpty(item.icon) && (
|
|
42
|
-
<span className={classes.icon}>{renderIcon(item.icon)}</span>
|
|
43
|
-
)}
|
|
44
|
-
<span className={classes.content}>{item.item}</span>
|
|
45
|
-
</div>
|
|
46
|
-
{item.shouldDrawSpacerBelow && <div className={classes.spacer} />}
|
|
47
|
-
</Fragment>
|
|
23
|
+
{items.map((item, i) => (
|
|
24
|
+
<ListItem key={i} {...item} onClick={(event) => handleItemClick(event, item)} />
|
|
48
25
|
))}
|
|
49
26
|
</div>
|
|
50
27
|
);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { colors, createThemedStyles, ITweakStyles } from '../../../../theme';
|
|
2
|
+
|
|
3
|
+
const ITEM_HORIZONTAL_PADDING = 16;
|
|
4
|
+
const ICON_SIZE = 20;
|
|
5
|
+
const ICON_GAP = 12;
|
|
6
|
+
|
|
7
|
+
export const useStyles = createThemedStyles('ListItem', {
|
|
8
|
+
root: {
|
|
9
|
+
display: 'flex',
|
|
10
|
+
alignItems: 'center',
|
|
11
|
+
boxSizing: 'border-box',
|
|
12
|
+
fontSize: 16,
|
|
13
|
+
whiteSpace: 'nowrap',
|
|
14
|
+
minHeight: 40,
|
|
15
|
+
padding: [0, ITEM_HORIZONTAL_PADDING],
|
|
16
|
+
transition: 'background-color 0.25s ease-in-out',
|
|
17
|
+
cursor: 'pointer',
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
default: {},
|
|
21
|
+
|
|
22
|
+
destructive: {},
|
|
23
|
+
|
|
24
|
+
disabledItem: {
|
|
25
|
+
cursor: 'default',
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
spacer: {
|
|
29
|
+
height: 1,
|
|
30
|
+
backgroundColor: colors.BORDER_LIGHT,
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
withIconGap: {
|
|
34
|
+
paddingLeft: ITEM_HORIZONTAL_PADDING + ICON_SIZE + ICON_GAP,
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
icon: {
|
|
38
|
+
width: ICON_SIZE,
|
|
39
|
+
height: ICON_SIZE,
|
|
40
|
+
marginRight: ICON_GAP,
|
|
41
|
+
flexShrink: 0,
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
content: {},
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export type IListItemStyles = ITweakStyles<typeof useStyles>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { FC, Fragment, MouseEvent, KeyboardEvent, ReactNode } from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import {
|
|
4
|
+
addClickHandler,
|
|
5
|
+
addDataTestId,
|
|
6
|
+
isReactNodeNotEmpty,
|
|
7
|
+
} from '@true-engineering/true-react-platform-helpers';
|
|
8
|
+
import { addDataAttributes } from '../../../../helpers';
|
|
9
|
+
import { ICommonProps } from '../../../../types';
|
|
10
|
+
import { renderIcon, IIcon } from '../../../Icon';
|
|
11
|
+
import { useStyles, IListItemStyles } from './ListItem.styles';
|
|
12
|
+
|
|
13
|
+
export interface IListItemProps extends ICommonProps<IListItemStyles> {
|
|
14
|
+
item: ReactNode;
|
|
15
|
+
view?: 'default' | 'destructive';
|
|
16
|
+
icon?: IIcon;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
shouldDrawSpacerAbove?: boolean;
|
|
19
|
+
shouldDrawSpacerBelow?: boolean;
|
|
20
|
+
withIconGap?: boolean;
|
|
21
|
+
onClick(event: MouseEvent | KeyboardEvent): void;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const ListItem: FC<IListItemProps> = ({
|
|
25
|
+
disabled: isDisabled,
|
|
26
|
+
icon,
|
|
27
|
+
item,
|
|
28
|
+
shouldDrawSpacerAbove,
|
|
29
|
+
shouldDrawSpacerBelow,
|
|
30
|
+
testId,
|
|
31
|
+
tweakStyles,
|
|
32
|
+
view = 'default',
|
|
33
|
+
withIconGap,
|
|
34
|
+
data,
|
|
35
|
+
onClick,
|
|
36
|
+
}) => {
|
|
37
|
+
const classes = useStyles({ theme: tweakStyles });
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<Fragment>
|
|
41
|
+
{shouldDrawSpacerAbove && <div className={classes.spacer} />}
|
|
42
|
+
<div
|
|
43
|
+
className={clsx(classes.root, classes[view], {
|
|
44
|
+
[classes.disabledItem]: isDisabled,
|
|
45
|
+
[classes.withIconGap]: withIconGap,
|
|
46
|
+
})}
|
|
47
|
+
{...addClickHandler(onClick, !isDisabled)}
|
|
48
|
+
{...addDataTestId(testId)}
|
|
49
|
+
{...addDataAttributes({ ...data, disabled: isDisabled ? true : undefined })}
|
|
50
|
+
>
|
|
51
|
+
{isReactNodeNotEmpty(icon) && <span className={classes.icon}>{renderIcon(icon)}</span>}
|
|
52
|
+
<span className={classes.content}>{item}</span>
|
|
53
|
+
</div>
|
|
54
|
+
{shouldDrawSpacerBelow && <div className={classes.spacer} />}
|
|
55
|
+
</Fragment>
|
|
56
|
+
);
|
|
57
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ListItem';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import { ICommonProps } from '../../../../types';
|
|
4
|
-
import { Icon
|
|
5
|
-
import {
|
|
4
|
+
import { Icon } from '../../../Icon';
|
|
5
|
+
import { IMultiSelectListValues } from '../../../MultiSelectList';
|
|
6
|
+
import { useStyles, IMultiSelectInputStyles } from './MultiSelectInput.styles';
|
|
6
7
|
|
|
7
8
|
export interface IMultiSelectInputProps<Value>
|
|
8
9
|
extends Pick<ICommonProps<IMultiSelectInputStyles>, 'tweakStyles'> {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isStringNotEmpty } from '@true-engineering/true-react-platform-helpers';
|
|
2
2
|
import { formatNumber, isSpaceChar } from '../../helpers';
|
|
3
|
-
import { INumberInputProps } from './NumberInput';
|
|
3
|
+
import type { INumberInputProps } from './NumberInput';
|
|
4
4
|
|
|
5
5
|
const getPrevSpaces = (val: string, position: number): number =>
|
|
6
6
|
val
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { ComponentStory } from '@storybook/react';
|
|
3
|
+
import { phoneInfo } from '../../constants';
|
|
3
4
|
import { iconsList } from '../Icon';
|
|
4
5
|
import { PhoneInput } from './PhoneInput';
|
|
5
|
-
import { phoneInfo } from './phone-info';
|
|
6
6
|
import { IPhoneValue } from './types';
|
|
7
7
|
|
|
8
8
|
const iconTypes = [undefined, ...Object.keys(iconsList)];
|
package/src/components/PhoneInput/components/PhoneInputCountryList/PhoneInputCountryList.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FC, MouseEvent, useState, useEffect, useMemo } from 'react';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
|
+
import { phoneInfo } from '../../../../constants';
|
|
3
4
|
import {
|
|
4
5
|
checkSearchStringInCountry,
|
|
5
6
|
getCountryTextByLocale,
|
|
@@ -12,7 +13,6 @@ import { Flag } from '../../../Flag';
|
|
|
12
13
|
import { Icon } from '../../../Icon';
|
|
13
14
|
import { Input } from '../../../Input';
|
|
14
15
|
import { ScrollIntoViewIfNeeded } from '../../../ScrollIntoViewIfNeeded';
|
|
15
|
-
import { phoneInfo } from '../../phone-info';
|
|
16
16
|
import { IPhoneInfo } from '../../types';
|
|
17
17
|
import {
|
|
18
18
|
useStyles,
|
|
@@ -21,9 +21,9 @@ import {
|
|
|
21
21
|
createFilter,
|
|
22
22
|
} from '@true-engineering/true-react-platform-helpers';
|
|
23
23
|
import { hasExactParent } from '../../helpers';
|
|
24
|
-
import { renderIcon } from '../../helpers/snippets';
|
|
25
24
|
import { useIsMounted, useOnClickOutsideWithRef, useDropdown, useTweakStyles } from '../../hooks';
|
|
26
|
-
import { ICommonProps, IDropdownWithPopperOptions
|
|
25
|
+
import { ICommonProps, IDropdownWithPopperOptions } from '../../types';
|
|
26
|
+
import { renderIcon, IIcon } from '../Icon';
|
|
27
27
|
import { IInputProps, Input } from '../Input';
|
|
28
28
|
import { ISearchInputProps, SearchInput } from '../SearchInput';
|
|
29
29
|
import { SelectList } from './components';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ComponentStory } from '@storybook/react';
|
|
2
|
+
import { Skeleton } from './Skeleton';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Skeleton',
|
|
6
|
+
component: Skeleton,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const Template: ComponentStory<typeof Skeleton> = (args) => (
|
|
10
|
+
<div style={{ padding: 32, backgroundColor: '#fff', width: 200 }}>
|
|
11
|
+
<Skeleton {...args} />
|
|
12
|
+
</div>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export const Default = Template.bind({});
|
|
16
|
+
|
|
17
|
+
Default.args = {
|
|
18
|
+
height: '20px',
|
|
19
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { rgba } from '../../helpers';
|
|
2
|
+
import { colors, createThemedStyles, ITweakStyles } from '../../theme';
|
|
3
|
+
|
|
4
|
+
export const useStyles = createThemedStyles('Skeleton', {
|
|
5
|
+
root: {
|
|
6
|
+
display: 'flex',
|
|
7
|
+
width: '100%',
|
|
8
|
+
height: '100%',
|
|
9
|
+
backgroundColor: rgba(colors.GREY_DISABLED, 0.8),
|
|
10
|
+
position: 'relative',
|
|
11
|
+
borderRadius: 4,
|
|
12
|
+
overflow: 'hidden',
|
|
13
|
+
'-webkit-mask-image': '-webkit-radial-gradient(white, black)',
|
|
14
|
+
|
|
15
|
+
'&::after': {
|
|
16
|
+
content: '""',
|
|
17
|
+
animation: '$skeleton 1.6s linear 0.5s infinite',
|
|
18
|
+
background: `linear-gradient(90deg, transparent, ${rgba(
|
|
19
|
+
colors.GREY_BACKGROUND,
|
|
20
|
+
0.65,
|
|
21
|
+
)}, transparent)`,
|
|
22
|
+
position: 'absolute',
|
|
23
|
+
transform: 'translateX(-100%)',
|
|
24
|
+
bottom: 0,
|
|
25
|
+
left: 0,
|
|
26
|
+
right: 0,
|
|
27
|
+
top: 0,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
'@keyframes skeleton': {
|
|
32
|
+
'0%': {
|
|
33
|
+
transform: 'translateX(-100%)',
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
'50%': {
|
|
37
|
+
transform: 'translateX(100%)',
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
'100%': {
|
|
41
|
+
transform: 'translateX(100%)',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
export type ISkeletonStyles = ITweakStyles<typeof useStyles>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CSSProperties, FC } from 'react';
|
|
2
|
+
import { ICommonProps } from '../../types';
|
|
3
|
+
import { ISkeletonStyles, useStyles } from './Skeleton.styles';
|
|
4
|
+
|
|
5
|
+
export interface ISkeletonProps extends Pick<ICommonProps<ISkeletonStyles>, 'tweakStyles'> {
|
|
6
|
+
height?: CSSProperties['height'];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const Skeleton: FC<ISkeletonProps> = ({ height, tweakStyles }) => {
|
|
10
|
+
const classes = useStyles({ theme: tweakStyles });
|
|
11
|
+
return <div className={classes.root} style={{ height }} />;
|
|
12
|
+
};
|
package/src/components/index.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './phone-info';
|
package/src/helpers/phone.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isNotEmpty, isEmpty } from '@true-engineering/true-react-platform-helpers';
|
|
2
|
-
import {
|
|
2
|
+
import type { IPhoneInfo, IPhoneValue } from '../components';
|
|
3
|
+
import { phoneInfo } from '../constants';
|
|
3
4
|
|
|
4
5
|
export const findCountryByCode = (
|
|
5
6
|
countryCode?: string,
|
package/src/hooks/index.ts
CHANGED
package/src/index.ts
CHANGED
package/src/theme/types.ts
CHANGED
|
@@ -52,6 +52,8 @@ import type {
|
|
|
52
52
|
IFlexibleTableCellStyles,
|
|
53
53
|
IFlexibleTableRowStyles,
|
|
54
54
|
IFilterValueViewStyles,
|
|
55
|
+
ISkeletonStyles,
|
|
56
|
+
IListItemStyles,
|
|
55
57
|
} from '../components';
|
|
56
58
|
|
|
57
59
|
export type IStyles<C extends string, P> = Styles<C, P, Partial<Styles<C, P>>>;
|
|
@@ -96,6 +98,7 @@ export interface IComponentStyles {
|
|
|
96
98
|
IncrementInput: IIncrementInputStyles;
|
|
97
99
|
Input: IInputStyles;
|
|
98
100
|
List: IListStyles;
|
|
101
|
+
ListItem: IListItemStyles;
|
|
99
102
|
Modal: IModalStyles;
|
|
100
103
|
MoreMenu: IMoreMenuStyles;
|
|
101
104
|
MultiSelect: IMultiSelectStyles;
|
|
@@ -108,6 +111,7 @@ export interface IComponentStyles {
|
|
|
108
111
|
SearchInput: ISearchInputStyles;
|
|
109
112
|
Select: ISelectStyles;
|
|
110
113
|
SelectList: ISelectListStyles;
|
|
114
|
+
Skeleton: ISkeletonStyles;
|
|
111
115
|
Switch: ISwitchStyles;
|
|
112
116
|
TextArea: ITextAreaStyles;
|
|
113
117
|
TextWithInfo: ITextWithInfoStyles;
|
package/src/types.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
2
1
|
import { Modifier, Placement } from 'react-overlays/usePopper';
|
|
3
|
-
import type { IIconType } from './components';
|
|
4
2
|
|
|
5
3
|
export interface IDataAttributes {
|
|
6
4
|
[key: string]: unknown;
|
|
@@ -26,5 +24,3 @@ export interface IDropdownWithPopperOptions {
|
|
|
26
24
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
27
25
|
flipOptions?: Record<string, any>; // только с shouldUsePopper
|
|
28
26
|
}
|
|
29
|
-
|
|
30
|
-
export type IIcon = IIconType | ReactElement;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { IIcon } from '../../types';
|
|
3
|
-
export interface IListItem {
|
|
4
|
-
item: ReactNode;
|
|
5
|
-
icon?: IIcon;
|
|
6
|
-
disabled?: boolean;
|
|
7
|
-
shouldDrawSpacerAbove?: boolean;
|
|
8
|
-
shouldDrawSpacerBelow?: boolean;
|
|
9
|
-
withIconGap?: boolean;
|
|
10
|
-
testId?: string;
|
|
11
|
-
onClick(): void;
|
|
12
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { IIcon } from '../../types';
|
|
3
|
-
|
|
4
|
-
export interface IListItem {
|
|
5
|
-
item: ReactNode;
|
|
6
|
-
icon?: IIcon;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
shouldDrawSpacerAbove?: boolean;
|
|
9
|
-
shouldDrawSpacerBelow?: boolean;
|
|
10
|
-
withIconGap?: boolean;
|
|
11
|
-
testId?: string;
|
|
12
|
-
onClick(): void;
|
|
13
|
-
}
|