@true-engineering/true-react-common-ui-kit 4.0.0-alpha45 → 4.0.0-alpha47
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/dist/components/AccountInfo/AccountInfo.styles.d.ts +1 -1
- package/dist/components/AddButton/AddButton.styles.d.ts +1 -1
- package/dist/components/Button/Button.d.ts +1 -1
- package/dist/components/Button/Button.styles.d.ts +1 -1
- package/dist/components/Checkbox/Checkbox.styles.d.ts +1 -1
- package/dist/components/CloseButton/CloseButton.styles.d.ts +1 -1
- package/dist/components/ControlWrapper/ControlWrapper.styles.d.ts +1 -1
- package/dist/components/ControlWrapper/types.d.ts +1 -1
- package/dist/components/CssBaseline/CssBaseline.styles.d.ts +1 -1
- package/dist/components/DateInput/DateInput.d.ts +1 -2
- package/dist/components/DateInput/DateInput.styles.d.ts +1 -1
- package/dist/components/DateInput/constants.d.ts +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts +2 -3
- package/dist/components/DatePicker/DatePicker.styles.d.ts +1 -1
- package/dist/components/DatePicker/components/DatePickerBase/DatePickerBase.d.ts +1 -1
- package/dist/components/DatePicker/components/DatePickerHeader/DatePickerHeader.styles.d.ts +1 -1
- package/dist/components/DatePicker/constants.d.ts +1 -1
- package/dist/components/DatePicker/types.d.ts +2 -2
- package/dist/components/Description/Description.styles.d.ts +1 -1
- package/dist/components/FileInput/FileInput.d.ts +1 -1
- package/dist/components/FileInput/FileInput.styles.d.ts +1 -1
- package/dist/components/FileItem/FileItem.styles.d.ts +1 -1
- package/dist/components/FiltersPane/FiltersPane.d.ts +0 -1
- package/dist/components/FiltersPane/FiltersPane.styles.d.ts +2 -2
- package/dist/components/FiltersPane/components/Filter/Filter.d.ts +1 -2
- package/dist/components/FiltersPane/components/FilterInterval/FilterInterval.styles.d.ts +3 -6
- package/dist/components/FiltersPane/components/FilterMultiSelect/FilterMultiSelect.d.ts +0 -1
- package/dist/components/FiltersPane/components/FilterSelect/FilterSelect.styles.d.ts +3 -6
- package/dist/components/FiltersPane/components/FilterValueView/FilterValueView.d.ts +1 -2
- package/dist/components/FiltersPane/components/FilterValueView/FilterValueView.styles.d.ts +1 -1
- package/dist/components/FiltersPane/components/FilterWithDates/FilterWithDates.styles.d.ts +5 -11
- package/dist/components/FiltersPane/components/FilterWithPeriod/FilterWithPeriod.styles.d.ts +1 -1
- package/dist/components/FiltersPane/components/FilterWrapper/FilterWrapper.d.ts +0 -1
- package/dist/components/FiltersPane/components/FilterWrapper/FilterWrapper.styles.d.ts +2 -2
- package/dist/components/FiltersPane/components/FiltersPaneSearch/FiltersPaneSearch.styles.d.ts +1 -1
- package/dist/components/FiltersPane/constants.d.ts +1 -1
- package/dist/components/FiltersPane/helpers.d.ts +1 -1
- package/dist/components/FiltersPane/types.d.ts +1 -1
- package/dist/components/Flag/Flag.styles.d.ts +1 -1
- package/dist/components/Flag/customFlags/customFlags.d.ts +2 -2
- package/dist/components/FlexibleTable/FlexibleTable.styles.d.ts +2 -2
- package/dist/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.styles.d.ts +1 -1
- package/dist/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.styles.d.ts +1 -1
- package/dist/components/FlexibleTable/helpers.d.ts +2 -2
- package/dist/components/FloatDocActions/FloatDocActions.styles.d.ts +1 -1
- package/dist/components/FloatDocActions/components/DocActions/DocActions.styles.d.ts +1 -1
- package/dist/components/Icon/Icon.styles.d.ts +1 -1
- package/dist/components/Icon/icons/index.d.ts +29 -29
- package/dist/components/IconButton/IconButton.d.ts +1 -2
- package/dist/components/IconButton/IconButton.styles.d.ts +1 -1
- package/dist/components/IncrementInput/IncrementInput.styles.d.ts +1 -1
- package/dist/components/Input/Input.d.ts +1 -2
- package/dist/components/Input/Input.styles.d.ts +1 -1
- package/dist/components/Input/InputBase.d.ts +1 -1
- package/dist/components/List/List.styles.d.ts +1 -1
- package/dist/components/List/components/ListItem/ListItem.styles.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.d.ts +0 -1
- package/dist/components/MultiSelect/MultiSelect.styles.d.ts +1 -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/MultiSelectList/constants.d.ts +1 -1
- package/dist/components/MultiSelectList/helpers.d.ts +1 -1
- package/dist/components/NewMoreMenu/NewMoreMenu.styles.d.ts +1 -1
- package/dist/components/Notification/Notification.styles.d.ts +1 -1
- package/dist/components/NumberInput/NumberInput.d.ts +1 -2
- package/dist/components/NumberInput/helpers.d.ts +2 -2
- package/dist/components/PhoneInput/PhoneInput.styles.d.ts +1 -1
- package/dist/components/PhoneInput/components/PhoneInputCountryList/PhoneInputCountryList.styles.d.ts +1 -1
- package/dist/components/RadioButton/RadioButton.styles.d.ts +1 -1
- package/dist/components/ScrollIntoViewIfNeeded/ScrollIntoViewIfNeeded.d.ts +3 -373
- package/dist/components/ScrollIntoViewIfNeeded/constants.d.ts +1 -1
- package/dist/components/SearchInput/SearchInput.d.ts +1 -2
- package/dist/components/Select/Select.d.ts +1 -1
- package/dist/components/Select/Select.styles.d.ts +12 -22
- package/dist/components/Select/components/SelectList/SelectList.d.ts +5 -5
- package/dist/components/Select/components/SelectList/SelectList.styles.d.ts +1 -1
- package/dist/components/Select/components/SelectListItem/SelectListItem.d.ts +2 -2
- package/dist/components/Select/helpers.d.ts +1 -1
- package/dist/components/Selector/Selector.d.ts +0 -1
- package/dist/components/Selector/Selector.styles.d.ts +1 -1
- package/dist/components/Skeleton/Skeleton.styles.d.ts +1 -1
- package/dist/components/SmartInput/SmartInput.d.ts +1 -1
- package/dist/components/Status/Status.styles.d.ts +1 -1
- package/dist/components/Status/types.d.ts +1 -1
- package/dist/components/Switch/Switch.styles.d.ts +1 -1
- package/dist/components/TextArea/TextArea.d.ts +1 -1
- package/dist/components/TextArea/TextArea.styles.d.ts +1 -1
- package/dist/components/TextButton/TextButton.d.ts +1 -1
- package/dist/components/TextButton/TextButton.styles.d.ts +1 -1
- package/dist/components/TextWithInfo/TextWithInfo.styles.d.ts +1 -1
- package/dist/components/TextWithTooltip/TextWithTooltip.styles.d.ts +1 -1
- package/dist/components/ThemedPreloader/ThemedPreloader.styles.d.ts +1 -1
- package/dist/components/ThemedPreloader/components/DotsPreloader/DotsPreloader.styles.d.ts +1 -1
- package/dist/components/ThemedPreloader/components/SvgPreloader/SvgPreloader.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/WithMessages/WithMessages.d.ts +1 -1
- package/dist/components/WithMessages/WithMessages.styles.d.ts +1 -1
- package/dist/components/WithPopup/WithPopup.styles.d.ts +1 -1
- package/dist/components/WithPopup/types.d.ts +4 -4
- package/dist/constants/phone-info.d.ts +1 -1
- package/dist/helpers/misc.d.ts +1 -1
- package/dist/helpers/phone.d.ts +1 -1
- package/dist/hooks/use-dropdown.d.ts +3 -3
- package/dist/hooks/use-merge.d.ts +1 -1
- package/dist/hooks/use-mixed-styles.d.ts +3 -3
- package/dist/hooks/use-tweak-styles.d.ts +5 -5
- package/dist/theme/Provider.d.ts +2 -2
- package/dist/theme/common.d.ts +1 -1
- package/dist/theme/helpers.d.ts +3 -3
- package/dist/theme/true-jss/ThemedStylesManager.d.ts +1 -1
- package/dist/theme/true-jss/TweakStylesManager.d.ts +1 -1
- package/dist/theme/types.d.ts +1 -1
- package/dist/true-react-common-ui-kit.js +2 -31108
- package/dist/true-react-common-ui-kit.js.map +1 -1
- package/dist/true-react-common-ui-kit.umd.cjs +3 -31095
- package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
- package/dist/types.d.ts +4 -4
- package/package.json +17 -16
- package/src/components/Checkbox/Checkbox.stories.tsx +1 -1
- package/src/components/Checkbox/types.ts +1 -1
- package/src/components/ControlWrapper/ControlWrapper.stories.tsx +1 -1
- package/src/components/ControlWrapper/types.ts +1 -1
- package/src/components/FiltersPane/components/Filter/Filter.tsx +1 -1
- package/src/components/FiltersPane/components/Filter/helpers.ts +3 -3
- package/src/components/FiltersPane/types.ts +0 -2
- package/src/components/Flag/Flag.tsx +2 -2
- package/src/components/Icon/types.ts +1 -1
- package/src/components/PhoneInput/PhoneInput.tsx +1 -1
- package/src/components/PhoneInput/components/PhoneInputCountryList/PhoneInputCountryList.tsx +1 -4
- package/src/components/RadioButton/RadioButton.stories.tsx +1 -1
- package/src/components/RadioButton/types.ts +1 -1
- package/src/components/ScrollIntoViewIfNeeded/ScrollIntoViewIfNeeded.ts +15 -9
- package/src/components/Select/MultiSelect.stories.tsx +2 -2
- package/src/components/Select/Select.stories.tsx +2 -2
- package/src/components/Select/Select.tsx +27 -27
- package/src/components/Select/components/SelectList/SelectList.tsx +4 -4
- package/src/components/Selector/Selector.tsx +1 -2
- package/src/components/Status/Status.stories.tsx +1 -1
- package/src/components/Status/types.ts +1 -1
- package/src/components/TextArea/TextArea.stories.tsx +1 -1
- package/src/components/TextArea/types.ts +1 -1
- package/src/components/TextWithTooltip/TextWithTooltip.tsx +1 -2
- package/src/helpers/misc.ts +5 -5
- package/src/helpers/popper-helpers.ts +0 -1
- package/src/theme/helpers.ts +3 -1
- package/src/theme/true-jss/ThemedStylesManager.ts +2 -1
- package/src/theme/true-jss/TweakStylesManager.ts +1 -2
- package/src/theme/types.ts +0 -1
- package/src/types.ts +0 -2
- package/src/components/Flag/customFlags/augment.d.ts +0 -1
- /package/dist/{style.css → true-react-common-ui-kit.css} +0 -0
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { FocusEventHandler, KeyboardEvent, KeyboardEventHandler, MouseEvent, MouseEventHandler, PointerEventHandler, ReactNode } from 'react';
|
|
2
|
+
import { Modifier, Placement } from 'react-overlays/usePopper';
|
|
3
|
+
import { JssStyle } from 'jss';
|
|
4
|
+
import { IMaybeArray } from './theme';
|
|
5
5
|
export interface ITestIdProps {
|
|
6
6
|
testId?: string;
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@true-engineering/true-react-common-ui-kit",
|
|
3
|
-
"version": "4.0.0-
|
|
3
|
+
"version": "4.0.0-alpha47",
|
|
4
4
|
"description": "True Engineering React UI Kit with theming support",
|
|
5
5
|
"author": "True Engineering (https://trueengineering.ru)",
|
|
6
6
|
"keywords": [
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@floating-ui/react": "^0.27.13",
|
|
51
51
|
"@true-engineering/true-react-platform-helpers": "^1.0.0",
|
|
52
52
|
"clsx": "^2.1.1",
|
|
53
|
-
"country-flag-icons": "1.5.
|
|
53
|
+
"country-flag-icons": "1.5.21",
|
|
54
54
|
"date-fns": "^4.1.0",
|
|
55
55
|
"filesize": "10.1.1",
|
|
56
56
|
"hex-to-rgba": "2.0.1",
|
|
@@ -70,28 +70,29 @@
|
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@babel/core": "7.20.12",
|
|
72
72
|
"@storybook/react": "9.1.10",
|
|
73
|
-
"@swc/core": "
|
|
73
|
+
"@swc/core": "1.3.30",
|
|
74
74
|
"@trivago/prettier-plugin-sort-imports": "4.3.0",
|
|
75
75
|
"@types/lodash-es": "4.17.11",
|
|
76
|
-
"@types/node": "
|
|
76
|
+
"@types/node": "24.7.2",
|
|
77
77
|
"@types/react": "18.2.79",
|
|
78
78
|
"@types/react-dom": "18.2.25",
|
|
79
79
|
"@types/react-input-mask": "3.0.2",
|
|
80
80
|
"@types/react-transition-group": "4.4.10",
|
|
81
|
-
"@
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"eslint": "
|
|
85
|
-
"eslint-
|
|
86
|
-
"eslint-plugin-
|
|
87
|
-
"eslint-plugin-react": "
|
|
88
|
-
"
|
|
81
|
+
"@vitejs/plugin-react-swc": "4.2.0",
|
|
82
|
+
"eslint": "9.34.0",
|
|
83
|
+
"eslint-config-prettier": "10.1.8",
|
|
84
|
+
"eslint-import-resolver-typescript": "4.4.4",
|
|
85
|
+
"eslint-plugin-import": "2.32.0",
|
|
86
|
+
"eslint-plugin-react": "7.37.5",
|
|
87
|
+
"eslint-plugin-react-hooks": "6.0.0-rc.1",
|
|
88
|
+
"globals": "16.3.0",
|
|
89
89
|
"prettier": "2.8.3",
|
|
90
90
|
"rollup-plugin-swc3": "0.3.0",
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"vite
|
|
91
|
+
"terser": "5.44.0",
|
|
92
|
+
"typescript": "5.8.2",
|
|
93
|
+
"typescript-eslint": "8.46.2",
|
|
94
|
+
"vite": "7.1.12",
|
|
95
|
+
"vite-plugin-dts": "4.5.4"
|
|
95
96
|
},
|
|
96
97
|
"resolutions": {
|
|
97
98
|
"strip-ansi": "6.0.1"
|
|
@@ -7,7 +7,7 @@ import { Checkbox, ICheckboxProps } from '../Checkbox';
|
|
|
7
7
|
const SIZES = ['micro'] as const;
|
|
8
8
|
|
|
9
9
|
declare module './types' {
|
|
10
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
11
11
|
export interface ICheckboxSizes extends IExtendableProps<typeof SIZES> {}
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -10,7 +10,7 @@ import { GROUP_PLACEMENTS } from './constants';
|
|
|
10
10
|
const SIZES = ['micro'] as const;
|
|
11
11
|
|
|
12
12
|
declare module './types' {
|
|
13
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
14
14
|
export interface IControlWrapperSizes extends IExtendableProps<typeof SIZES> {}
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -3,7 +3,7 @@ import { IClickHandlerEvent } from '../../types';
|
|
|
3
3
|
import { IIcon } from '../Icon';
|
|
4
4
|
import { GROUP_PLACEMENTS } from './constants';
|
|
5
5
|
|
|
6
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
7
7
|
export interface IControlWrapperSizes {}
|
|
8
8
|
|
|
9
9
|
export type IControlWrapperSize = keyof IControlWrapperSizes;
|
|
@@ -72,7 +72,7 @@ export function Filter<Values extends Record<string, unknown>, Key extends keyof
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
if (filter.type === 'multiSelect') {
|
|
75
|
-
const preparedValue = isMultiSelectValue<any>(value) ? value : undefined;
|
|
75
|
+
const preparedValue = isMultiSelectValue<any>(value) ? value : undefined;
|
|
76
76
|
|
|
77
77
|
return (
|
|
78
78
|
<FilterMultiSelect
|
|
@@ -4,15 +4,15 @@ import { IDatePeriod, IFilterMultiSelectValues, IPeriod } from '../../types';
|
|
|
4
4
|
const isDateOrEmpty = (value: unknown): value is Date | null | undefined =>
|
|
5
5
|
isEmpty(value) || value instanceof Date;
|
|
6
6
|
|
|
7
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
8
8
|
export const isDatePeriodValue = (value: any): value is IDatePeriod =>
|
|
9
9
|
isDateOrEmpty(value?.from) && isDateOrEmpty(value?.to);
|
|
10
10
|
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
12
12
|
export const isPeriodValue = (value: any): value is IPeriod =>
|
|
13
13
|
isString(value?.periodType) && isDatePeriodValue(value);
|
|
14
14
|
|
|
15
15
|
export const isMultiSelectValue = <T extends string>(
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
17
17
|
value: any,
|
|
18
18
|
): value is IFilterMultiSelectValues<T> => Array.isArray(value?.include);
|
|
@@ -101,7 +101,6 @@ export type CustomComponent<Value> = FC<ICustomComponentProps<Value>>;
|
|
|
101
101
|
export type ICustomValue<V> = V extends Array<infer T> ? T : never;
|
|
102
102
|
|
|
103
103
|
export interface ICustomRangeConfigItem<Value> extends IConfigItemBasicBase<Value> {
|
|
104
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
105
104
|
[key: string & {}]: any;
|
|
106
105
|
type: 'custom';
|
|
107
106
|
component: CustomComponent<Value>;
|
|
@@ -109,7 +108,6 @@ export interface ICustomRangeConfigItem<Value> extends IConfigItemBasicBase<Valu
|
|
|
109
108
|
}
|
|
110
109
|
|
|
111
110
|
export interface ICustomMultipleConfigItem<Value> extends IConfigItemBasicBase<Value> {
|
|
112
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
113
111
|
[key: string & {}]: any;
|
|
114
112
|
type: 'custom';
|
|
115
113
|
component: CustomComponent<Value>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { hasFlag } from 'country-flag-icons';
|
|
3
|
-
import Flags from 'country-flag-icons/react/3x2';
|
|
3
|
+
import * as Flags from 'country-flag-icons/react/3x2';
|
|
4
4
|
import { ICommonProps } from '../../types';
|
|
5
5
|
import { Icon } from '../Icon';
|
|
6
6
|
import { customFlags } from './customFlags';
|
|
7
|
-
import {
|
|
7
|
+
import { IFlagStyles, useStyles } from './Flag.styles';
|
|
8
8
|
|
|
9
9
|
export interface IFlagProps extends Pick<ICommonProps<IFlagStyles>, 'tweakStyles'> {
|
|
10
10
|
/** @default '' */
|
|
@@ -4,7 +4,7 @@ import { iconsMap } from './icons';
|
|
|
4
4
|
export type ISvgIcon = string;
|
|
5
5
|
|
|
6
6
|
type IUiKitIconsMap = typeof iconsMap;
|
|
7
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
8
8
|
export interface IIconsMap extends IUiKitIconsMap {}
|
|
9
9
|
|
|
10
10
|
export type IIconType = keyof IIconsMap;
|
|
@@ -76,7 +76,7 @@ export const PhoneInput: FC<IPhoneInputProps> = ({
|
|
|
76
76
|
|
|
77
77
|
const countryCode = useMemo(
|
|
78
78
|
() => value?.countryCode ?? getCountryCodeFromPhone(phoneWithCode),
|
|
79
|
-
[
|
|
79
|
+
[phoneWithCode, value?.countryCode],
|
|
80
80
|
);
|
|
81
81
|
|
|
82
82
|
const handleClose = () => {
|
package/src/components/PhoneInput/components/PhoneInputCountryList/PhoneInputCountryList.tsx
CHANGED
|
@@ -48,10 +48,7 @@ export const PhoneInputCountryList: FC<IPhoneInputCountryListProps> = ({
|
|
|
48
48
|
currentComponentName: 'PhoneInputCountryList',
|
|
49
49
|
});
|
|
50
50
|
|
|
51
|
-
const sortedCountries = useMemo(
|
|
52
|
-
() => sortCountriesByLocale(phoneInfo, locale),
|
|
53
|
-
[phoneInfo, locale],
|
|
54
|
-
);
|
|
51
|
+
const sortedCountries = useMemo(() => sortCountriesByLocale(phoneInfo, locale), [locale]);
|
|
55
52
|
|
|
56
53
|
const selectedCountryIdx = findCountryIndexByCode(selectedCountryCode, sortedCountries);
|
|
57
54
|
|
|
@@ -8,7 +8,7 @@ const options = ['one', 'two', 'three'];
|
|
|
8
8
|
const SIZES = [undefined, 'micro'] as const;
|
|
9
9
|
|
|
10
10
|
declare module './types' {
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
12
12
|
export interface IRadioButtonSizes extends IExtendableProps<typeof SIZES> {}
|
|
13
13
|
}
|
|
14
14
|
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createElement,
|
|
3
|
+
createRef,
|
|
4
|
+
DOMElement,
|
|
5
|
+
HTMLProps,
|
|
6
|
+
PureComponent,
|
|
7
|
+
ReactNode,
|
|
8
|
+
RefObject,
|
|
9
|
+
} from 'react';
|
|
2
10
|
import scrollIntoViewIfNeeded, { StandardBehaviorOptions } from 'scroll-into-view-if-needed';
|
|
3
11
|
import {
|
|
4
12
|
ScrollIntoViewIfNeededDefaultElementType,
|
|
@@ -13,25 +21,25 @@ export interface IScrollIntoViewIfNeededProps extends HTMLProps<HTMLElement> {
|
|
|
13
21
|
}
|
|
14
22
|
|
|
15
23
|
export class ScrollIntoViewIfNeeded extends PureComponent<IScrollIntoViewIfNeededProps> {
|
|
16
|
-
node: RefObject<HTMLElement> = createRef();
|
|
17
|
-
|
|
18
24
|
public static defaultProps: IScrollIntoViewIfNeededProps = ScrollIntoViewIfNeededDefaultProps;
|
|
19
25
|
|
|
20
|
-
|
|
26
|
+
node: RefObject<HTMLElement> = createRef();
|
|
27
|
+
|
|
28
|
+
componentDidMount(): void {
|
|
21
29
|
const { active } = this.props;
|
|
22
30
|
if (active) {
|
|
23
31
|
this.handleScrollIntoViewIfNeeded();
|
|
24
32
|
}
|
|
25
33
|
}
|
|
26
34
|
|
|
27
|
-
componentDidUpdate({ active }: IScrollIntoViewIfNeededProps) {
|
|
35
|
+
componentDidUpdate({ active }: IScrollIntoViewIfNeededProps): void {
|
|
28
36
|
const { active: isNowActive } = this.props;
|
|
29
37
|
if (!active && isNowActive) {
|
|
30
38
|
this.handleScrollIntoViewIfNeeded();
|
|
31
39
|
}
|
|
32
40
|
}
|
|
33
41
|
|
|
34
|
-
handleScrollIntoViewIfNeeded = () => {
|
|
42
|
+
handleScrollIntoViewIfNeeded = (): void => {
|
|
35
43
|
const { options } = this.props;
|
|
36
44
|
const { current: node } = this.node;
|
|
37
45
|
|
|
@@ -40,7 +48,7 @@ export class ScrollIntoViewIfNeeded extends PureComponent<IScrollIntoViewIfNeede
|
|
|
40
48
|
}
|
|
41
49
|
};
|
|
42
50
|
|
|
43
|
-
render() {
|
|
51
|
+
render(): DOMElement<any, any> {
|
|
44
52
|
const { active, elementType, children, options, ...wrapperProps } = this.props;
|
|
45
53
|
|
|
46
54
|
return createElement(
|
|
@@ -50,5 +58,3 @@ export class ScrollIntoViewIfNeeded extends PureComponent<IScrollIntoViewIfNeede
|
|
|
50
58
|
);
|
|
51
59
|
}
|
|
52
60
|
}
|
|
53
|
-
|
|
54
|
-
export default ScrollIntoViewIfNeeded;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode, useEffect, useState } from 'react';
|
|
1
|
+
import { ReactElement, ReactNode, useEffect, useState } from 'react';
|
|
2
2
|
import { isStringNotEmpty } from '@true-engineering/true-react-platform-helpers';
|
|
3
3
|
import { type Meta } from '@storybook/react';
|
|
4
4
|
import { GROUP_PLACEMENTS } from '../ControlWrapper';
|
|
@@ -85,7 +85,7 @@ function Story<T>({
|
|
|
85
85
|
scrollParent,
|
|
86
86
|
noMatchesLabel,
|
|
87
87
|
...args
|
|
88
|
-
}: ISelectCustomProps<T>) {
|
|
88
|
+
}: ISelectCustomProps<T>): ReactElement {
|
|
89
89
|
const [stringValue, setStringValue] = useState<string[]>();
|
|
90
90
|
|
|
91
91
|
const stringHandler = (newValue?: string[]) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode, useEffect, useState } from 'react';
|
|
1
|
+
import { ReactElement, ReactNode, useEffect, useState } from 'react';
|
|
2
2
|
import { isStringNotEmpty } from '@true-engineering/true-react-platform-helpers';
|
|
3
3
|
import { type Meta } from '@storybook/react';
|
|
4
4
|
import { GROUP_PLACEMENTS } from '../ControlWrapper';
|
|
@@ -85,7 +85,7 @@ function Story<T>({
|
|
|
85
85
|
scrollParent,
|
|
86
86
|
noMatchesLabel,
|
|
87
87
|
...args
|
|
88
|
-
}: ISelectCustomProps<T>) {
|
|
88
|
+
}: ISelectCustomProps<T>): ReactElement {
|
|
89
89
|
const [stringValue, setStringValue] = useState<string>();
|
|
90
90
|
const stringHandler = (newValue?: string) => {
|
|
91
91
|
console.log('change');
|
|
@@ -61,7 +61,7 @@ export interface ISelectProps<Value>
|
|
|
61
61
|
dropdownOptions?: IDropdownWithPopperOptions;
|
|
62
62
|
/** @default 'chevron-down' */
|
|
63
63
|
dropdownIcon?: IIcon;
|
|
64
|
-
options: Value[] |
|
|
64
|
+
options: Value[] | readonly Value[];
|
|
65
65
|
value: Value | undefined;
|
|
66
66
|
/** @default true */
|
|
67
67
|
shouldScrollToList?: boolean;
|
|
@@ -280,32 +280,6 @@ export function Select<Value>(
|
|
|
280
280
|
handleListOpen();
|
|
281
281
|
};
|
|
282
282
|
|
|
283
|
-
const handleBlur = (event: FocusEvent<HTMLInputElement>) => {
|
|
284
|
-
// Когда что-то блокирует открытие листа, но блур все равно должен сработать
|
|
285
|
-
// например minSymbolsCount
|
|
286
|
-
if (isListOpen && !isOpen) {
|
|
287
|
-
handleListClose(event);
|
|
288
|
-
return;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
if (
|
|
292
|
-
!isNotEmpty(event.relatedTarget) ||
|
|
293
|
-
!isNotEmpty(list.current) ||
|
|
294
|
-
!isNotEmpty(inputWrapper.current)
|
|
295
|
-
) {
|
|
296
|
-
return;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
const isActionInsideSelect =
|
|
300
|
-
hasExactParent(event.relatedTarget, list.current) ||
|
|
301
|
-
hasExactParent(event.relatedTarget, inputWrapper.current);
|
|
302
|
-
|
|
303
|
-
// Ничего не делаем, если клик был внутри селекта
|
|
304
|
-
if (!isActionInsideSelect) {
|
|
305
|
-
handleListClose(event);
|
|
306
|
-
}
|
|
307
|
-
};
|
|
308
|
-
|
|
309
283
|
const handleChange = useCallback(
|
|
310
284
|
(newValue: Value | IMultipleSelectValue<Value> | undefined, event: IChangeSelectEvent) => {
|
|
311
285
|
// Тут беда с типами, сорри
|
|
@@ -484,6 +458,32 @@ export function Select<Value>(
|
|
|
484
458
|
// Последняя проверка на случай, если мы че то ищем в опциях
|
|
485
459
|
(optionsMode === 'normal' || hasEnoughSymbolsToSearch);
|
|
486
460
|
|
|
461
|
+
const handleBlur = (event: FocusEvent<HTMLInputElement>) => {
|
|
462
|
+
// Когда что-то блокирует открытие листа, но блур все равно должен сработать
|
|
463
|
+
// например minSymbolsCount
|
|
464
|
+
if (isListOpen && !isOpen) {
|
|
465
|
+
handleListClose(event);
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
if (
|
|
470
|
+
!isNotEmpty(event.relatedTarget) ||
|
|
471
|
+
!isNotEmpty(list.current) ||
|
|
472
|
+
!isNotEmpty(inputWrapper.current)
|
|
473
|
+
) {
|
|
474
|
+
return;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
const isActionInsideSelect =
|
|
478
|
+
hasExactParent(event.relatedTarget, list.current) ||
|
|
479
|
+
hasExactParent(event.relatedTarget, inputWrapper.current);
|
|
480
|
+
|
|
481
|
+
// Ничего не делаем, если клик был внутри селекта
|
|
482
|
+
if (!isActionInsideSelect) {
|
|
483
|
+
handleListClose(event);
|
|
484
|
+
}
|
|
485
|
+
};
|
|
486
|
+
|
|
487
487
|
// Эти значения ставятся в false по дефолту также в useDropdown
|
|
488
488
|
const {
|
|
489
489
|
shouldUsePopper = false,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type ReactNode, useMemo } from 'react';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import {
|
|
4
4
|
addDataTestId,
|
|
@@ -8,13 +8,13 @@ import {
|
|
|
8
8
|
import { type ICommonProps } from '../../../../types';
|
|
9
9
|
import { ScrollIntoViewIfNeeded } from '../../../ScrollIntoViewIfNeeded';
|
|
10
10
|
import { ALL_OPTION_INDEX, DEFAULT_OPTION_INDEX } from '../../constants';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { type ISelectListItemProps, SelectListItem } from '../SelectListItem';
|
|
12
|
+
import { type ISelectListStyles, useStyles } from './SelectList.styles';
|
|
13
13
|
|
|
14
14
|
export interface ISelectListProps<Value>
|
|
15
15
|
extends ICommonProps<ISelectListStyles>,
|
|
16
16
|
Pick<ISelectListItemProps, 'onToggleCheckbox' | 'onOptionSelect' | 'isMultiSelect'> {
|
|
17
|
-
options: Value[] |
|
|
17
|
+
options: Value[] | readonly Value[];
|
|
18
18
|
focusedIndex?: number;
|
|
19
19
|
activeValue?: Value | Value[];
|
|
20
20
|
noMatchesLabel?: string;
|
|
@@ -11,7 +11,7 @@ import { addDataAttributes } from '../../helpers';
|
|
|
11
11
|
import { ICommonProps } from '../../types';
|
|
12
12
|
import { renderIcon } from '../Icon';
|
|
13
13
|
import { ISelectorOption, ISelectorValue } from './types';
|
|
14
|
-
import { getSelectorLineStyle,
|
|
14
|
+
import { getSelectorLineStyle, ISelectorStyles, useStyles } from './Selector.styles';
|
|
15
15
|
|
|
16
16
|
export interface ISelectorProps<V extends ISelectorValue> extends ICommonProps<ISelectorStyles> {
|
|
17
17
|
options: Array<ISelectorOption<V>>;
|
|
@@ -52,7 +52,6 @@ export function Selector<V extends ISelectorValue>({
|
|
|
52
52
|
const listRef = useRef<HTMLDivElement>(null);
|
|
53
53
|
|
|
54
54
|
if (hasDuplicates(optionsValues)) {
|
|
55
|
-
// eslint-disable-next-line no-console
|
|
56
55
|
console.error('Selector: Значения options.value должны быть уникальными');
|
|
57
56
|
}
|
|
58
57
|
|
|
@@ -19,7 +19,7 @@ const STATUS_COLORS = [
|
|
|
19
19
|
] as const;
|
|
20
20
|
|
|
21
21
|
declare module './types' {
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
23
23
|
export interface IStatusColors extends IExtendableProps<typeof STATUS_COLORS> {}
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -3,7 +3,7 @@ import type { STATUS_SIZES } from './constants';
|
|
|
3
3
|
|
|
4
4
|
export type IStatusSize = (typeof STATUS_SIZES)[number];
|
|
5
5
|
|
|
6
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
7
7
|
export interface IStatusColors extends IDefaultExtendableProps {}
|
|
8
8
|
|
|
9
9
|
export type IStatusColor = keyof IStatusColors;
|
|
@@ -6,7 +6,7 @@ import { ITextAreaProps, TextArea } from './TextArea';
|
|
|
6
6
|
const COUNTER_POSITIONS = ['default', 'top'] as const;
|
|
7
7
|
|
|
8
8
|
declare module './types' {
|
|
9
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
10
10
|
export interface ITextAreaCounterPositions extends IExtendableProps<typeof COUNTER_POSITIONS> {}
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IExtendableProps } from '../../types';
|
|
2
2
|
|
|
3
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
4
4
|
export interface ITextAreaCounterPositions extends IExtendableProps<'default'> {}
|
|
5
5
|
|
|
6
6
|
export type ITextAreaCounterPosition = keyof ITextAreaCounterPositions;
|
|
@@ -7,7 +7,7 @@ import { addDataAttributes } from '../../helpers';
|
|
|
7
7
|
import { useOnClickOutsideWithRef, useTweakStyles } from '../../hooks';
|
|
8
8
|
import { ICommonProps } from '../../types';
|
|
9
9
|
import { ITooltipProps, Tooltip } from '../Tooltip';
|
|
10
|
-
import {
|
|
10
|
+
import { ITextWithTooltipStyles, useStyles } from './TextWithTooltip.styles';
|
|
11
11
|
|
|
12
12
|
export interface ITextWithTooltipProps extends ICommonProps<ITextWithTooltipStyles> {
|
|
13
13
|
children: ReactNode;
|
|
@@ -18,7 +18,6 @@ export interface ITextWithTooltipProps extends ICommonProps<ITextWithTooltipStyl
|
|
|
18
18
|
tooltipType?: ITooltipProps['type'];
|
|
19
19
|
/** @default 'top' */
|
|
20
20
|
tooltipPosition?: Placement;
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
21
|
/** @default [] */
|
|
23
22
|
tooltipModifiers?: Array<Partial<Modifier<any, any>>>;
|
|
24
23
|
tooltipOffsetOptions?: Record<string, unknown>;
|
package/src/helpers/misc.ts
CHANGED
|
@@ -21,6 +21,11 @@ export const transformToKebab = (string: string): string => {
|
|
|
21
21
|
return result;
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
+
export const getParentNode = (element: Element | ShadowRoot | Document): Element =>
|
|
25
|
+
element.nodeName === 'HTML' || element === document
|
|
26
|
+
? (element as Element)
|
|
27
|
+
: (element.parentNode as Element) ?? (element as ShadowRoot).host;
|
|
28
|
+
|
|
24
29
|
export const hasExactParent = (element: Element, parent: Element): boolean => {
|
|
25
30
|
if (element === parent) {
|
|
26
31
|
return true; // Found the exact parent
|
|
@@ -35,11 +40,6 @@ export const hasExactParent = (element: Element, parent: Element): boolean => {
|
|
|
35
40
|
return hasExactParent(parentNode, parent);
|
|
36
41
|
};
|
|
37
42
|
|
|
38
|
-
export const getParentNode = (element: Element | ShadowRoot | Document): Element =>
|
|
39
|
-
element.nodeName === 'HTML' || element === document
|
|
40
|
-
? (element as Element)
|
|
41
|
-
: (element.parentNode as Element) ?? (element as ShadowRoot).host;
|
|
42
|
-
|
|
43
43
|
export const getStyleComputedProperty = (element: Element): Partial<CSSStyleDeclaration> =>
|
|
44
44
|
element.nodeType !== 1 ? {} : getComputedStyle(element, null);
|
|
45
45
|
|
package/src/theme/helpers.ts
CHANGED
|
@@ -58,7 +58,9 @@ export const getTweakStylesCache = (): TweakStylesCache => {
|
|
|
58
58
|
if (!cache.has(next)) {
|
|
59
59
|
cache.set(next, getTweakStylesCache());
|
|
60
60
|
}
|
|
61
|
-
|
|
61
|
+
|
|
62
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
63
|
+
return cache.get(next)!;
|
|
62
64
|
};
|
|
63
65
|
|
|
64
66
|
return (styles, prev = []) => {
|
|
@@ -87,6 +87,7 @@ export class ThemedStylesManager<C extends string> {
|
|
|
87
87
|
this.#styleSheetMap.set(theme, { sheet, manager, refs: 0 });
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
91
|
+
return this.#styleSheetMap.get(theme)!;
|
|
91
92
|
}
|
|
92
93
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Classes, Rule, StyleSheet } from 'jss';
|
|
2
2
|
import {
|
|
3
3
|
isArrayNotEmpty,
|
|
4
4
|
isNotEmpty,
|
|
@@ -142,7 +142,6 @@ declare module 'jss' {
|
|
|
142
142
|
export interface RuleList {
|
|
143
143
|
index: Rule[];
|
|
144
144
|
}
|
|
145
|
-
// eslint-disable-next-line no-shadow
|
|
146
145
|
export interface StyleSheet<RuleName> {
|
|
147
146
|
rules: RuleList;
|
|
148
147
|
// eslint-disable-next-line @typescript-eslint/method-signature-style
|
package/src/theme/types.ts
CHANGED
|
@@ -148,7 +148,6 @@ export interface IComponentStyles {
|
|
|
148
148
|
|
|
149
149
|
export type IComponentName = keyof IComponentStyles;
|
|
150
150
|
|
|
151
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
152
151
|
export type IUiKitAnimations = Record<string, any>;
|
|
153
152
|
export type IUiKitHelpers = Record<string, Styles | (() => Styles)>;
|
|
154
153
|
|
package/src/types.ts
CHANGED
|
@@ -36,11 +36,9 @@ export interface IDropdownWithPopperOptions {
|
|
|
36
36
|
|
|
37
37
|
shouldHideOnScroll?: boolean; // работает весьма условно без shouldUsePopper
|
|
38
38
|
canBeFlipped?: boolean; // только с shouldUsePopper
|
|
39
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
40
39
|
modifiers?: Array<Partial<Modifier<any, any>>>; // только с shouldUsePopper
|
|
41
40
|
placement?: Placement; // only with shouldUsePopper
|
|
42
41
|
// https://popper.js.org/docs/v2/modifiers/flip/
|
|
43
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
44
42
|
flipOptions?: Record<string, any>; // только с shouldUsePopper
|
|
45
43
|
}
|
|
46
44
|
export type IClickHandlerEvent = MouseEvent | KeyboardEvent;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
declare module '*.svg?raw';
|
|
File without changes
|