Skip to content

Commit 40a5ff2

Browse files
authored
fix(bundle): added missing toolbar types (#611)
Added and exported `WToolbarBaseProps` and `MToolbarBaseProps` types
1 parent de141f2 commit 40a5ff2

File tree

10 files changed

+19
-22
lines changed

10 files changed

+19
-22
lines changed

src/bundle/config/markup.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ import {icons} from './icons';
6262
import {HeadingPreview} from './previews/HeadingPreview';
6363

6464
export type {
65+
MToolbarBaseProps,
6566
MToolbarData,
6667
MToolbarItemData,
6768
MToolbarSingleItemData,

src/bundle/config/wysiwyg.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import {
4141
} from './w-heading-config';
4242

4343
export type {
44+
WToolbarBaseProps,
4445
WToolbarData,
4546
WToolbarItemData,
4647
WToolbarSingleItemData,

src/bundle/toolbar/ToolbarButtonWithPopupMenu.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
} from '@gravity-ui/uikit';
1313

1414
import {cn} from '../../classname';
15-
import type {Action, ActionStorage} from '../../core';
15+
import type {Action} from '../../core';
1616
import {groupBy, isFunction} from '../../lodash';
1717
import {useBooleanState, useElementState} from '../../react-utils/hooks';
1818
import {type ToolbarBaseProps, type ToolbarIconData, ToolbarTooltipDelay} from '../../toolbar';
@@ -32,7 +32,7 @@ export type MenuItem = {
3232
};
3333

3434
export type ToolbarButtonWithPopupMenuProps = Omit<
35-
ToolbarBaseProps<ActionStorage> &
35+
ToolbarBaseProps<never> &
3636
Pick<PopupProps, 'disablePortal'> & {
3737
icon: ToolbarIconData;
3838
iconClassName?: string;

src/bundle/toolbar/ToolbarSelect.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,15 @@ import {
88
} from '@gravity-ui/uikit';
99

1010
import {cn} from '../../classname';
11-
import type {ActionStorage} from '../../core';
1211
import {isFunction} from '../../lodash';
1312

14-
import type {ToolbarBaseProps, WToolbarItemData} from './types';
13+
import type {WToolbarBaseProps, WToolbarItemData} from './types';
1514

1615
import './ToolbarSelect.scss';
1716

1817
const b = cn('toolbar-select');
1918

20-
export type ToolbarSelectProps = ToolbarBaseProps<ActionStorage> &
19+
export type ToolbarSelectProps = WToolbarBaseProps &
2120
Pick<SelectProps, 'disablePortal'> & {
2221
items: WToolbarItemData[];
2322
};

src/bundle/toolbar/markup/MToolbarColors.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import {colorify} from '../../../markup/commands';
2-
import type {CodeEditor} from '../../../markup/editor';
32
import {ToolbarColors} from '../custom/ToolbarColors';
4-
import type {ToolbarBaseProps} from '../types';
3+
import type {MToolbarBaseProps} from '../types';
54

6-
export type MToolbarColorsProps = ToolbarBaseProps<CodeEditor>;
5+
export type MToolbarColorsProps = MToolbarBaseProps;
76

87
export const MToolbarColors: React.FC<MToolbarColorsProps> = ({
98
className,

src/bundle/toolbar/markup/MToolbarFilePopup.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import {type FileItem, insertFiles} from '../../../markup/commands';
2-
import type {CodeEditor} from '../../../markup/editor';
3-
import type {ToolbarBaseProps} from '../../../toolbar';
42
import {ToolbarFilePopup, type ToolbarFilePopupProps} from '../custom/ToolbarFilePopup';
3+
import type {MToolbarBaseProps} from '../types';
54

65
import {useMarkupToolbarContext} from './context';
76

8-
export type MToolbarFilePopupProps = ToolbarBaseProps<CodeEditor> &
7+
export type MToolbarFilePopupProps = MToolbarBaseProps &
98
Pick<ToolbarFilePopupProps, 'anchorElement'> & {
109
hide: () => void;
1110
};

src/bundle/toolbar/markup/MToolbarImagePopup.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
import isNumber from 'is-number';
22

33
import {IMG_MAX_HEIGHT, type ImageItem, getImageDimensions, insertImages} from '../../../markup';
4-
import type {CodeEditor} from '../../../markup/editor';
5-
import type {ToolbarBaseProps} from '../../../toolbar';
64
import type {UploadSuccessItem} from '../../../utils';
75
import {type ToolbarImagePopuProps, ToolbarImagePopup} from '../custom/ToolbarImagePopup';
6+
import type {MToolbarBaseProps} from '../types';
87

98
import {useMarkupToolbarContext} from './context';
109

1110
const noop = (err: unknown) => {
1211
console.error(err);
1312
};
1413

15-
export type MToolbarImagePopupProps = ToolbarBaseProps<CodeEditor> &
14+
export type MToolbarImagePopupProps = MToolbarBaseProps &
1615
Pick<ToolbarImagePopuProps, 'anchorElement'> & {
1716
hide: () => void;
1817
};

src/bundle/toolbar/types.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type {ActionStorage} from '../../core';
22
import type {CodeEditor} from '../../markup';
33
import type {ToolbarListButtonData} from '../../toolbar';
44
import type {
5+
ToolbarBaseProps,
56
ToolbarButtonPopupData,
67
ToolbarData,
78
ToolbarGroupData,
@@ -15,6 +16,7 @@ import type {
1516

1617
export * from '../../toolbar/types';
1718

19+
export type WToolbarBaseProps = ToolbarBaseProps<ActionStorage>;
1820
export type WToolbarData = ToolbarData<ActionStorage>;
1921
export type WToolbarItemData = ToolbarItemData<ActionStorage>;
2022
export type WToolbarSingleItemData = ToolbarSingleItemData<ActionStorage>;
@@ -24,6 +26,7 @@ export type WToolbarListButtonData = ToolbarListButtonData<ActionStorage>;
2426
export type WToolbarListItemData = ToolbarListItemData<ActionStorage>;
2527
export type WToolbarListButtonItemData = ToolbarListButtonItemData<ActionStorage>;
2628

29+
export type MToolbarBaseProps = ToolbarBaseProps<CodeEditor>;
2730
export type MToolbarData = ToolbarData<CodeEditor>;
2831
export type MToolbarItemData = ToolbarItemData<CodeEditor>;
2932
export type MToolbarSingleItemData = ToolbarSingleItemData<CodeEditor>;

src/bundle/toolbar/wysiwyg/WToolbarColors.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import type {ActionStorage} from '../../../core';
21
import {ToolbarColors, type ToolbarColorsProps} from '../custom/ToolbarColors';
3-
import type {ToolbarBaseProps} from '../types';
2+
import type {WToolbarBaseProps} from '../types';
43

5-
export type WToolbarColorsProps = ToolbarBaseProps<ActionStorage> &
6-
Pick<ToolbarColorsProps, 'disablePortal'>;
4+
export type WToolbarColorsProps = WToolbarBaseProps & Pick<ToolbarColorsProps, 'disablePortal'>;
75

86
export const WToolbarColors: React.FC<WToolbarColorsProps> = ({
97
disablePortal,

src/bundle/toolbar/wysiwyg/WToolbarTextSelect.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
import type {ActionStorage} from '../../../core';
2-
import type {ToolbarBaseProps} from '../../../toolbar/types';
31
import {wHeadingListConfig} from '../../config/w-heading-config';
42
import {ToolbarSelect, type ToolbarSelectProps} from '../ToolbarSelect';
3+
import type {WToolbarBaseProps} from '../types';
54

6-
export type WToolbarTextSelectProps = ToolbarBaseProps<ActionStorage> &
7-
Pick<ToolbarSelectProps, 'disablePortal'>;
5+
export type WToolbarTextSelectProps = WToolbarBaseProps & Pick<ToolbarSelectProps, 'disablePortal'>;
86

97
export const WToolbarTextSelect: React.FC<WToolbarTextSelectProps> = ({
108
focus,

0 commit comments

Comments
 (0)