Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"unit:clear": "jest --clearCache",
"build:css": "cross-env NODE_ENV=buildProduction postcss src/**/*.css --base src --dir dist/__internal__/src/",
"build:js": "cross-env NODE_ENV=buildProduction BUILDING_JS=true babel --extensions .ts,.tsx --config-file ./babel.config.js --source-maps --out-dir dist/__internal__/src/ ./src",
"build:types": "cross-env NODE_ENV=buildProduction ttsc --declaration --outDir dist/__internal__/src/ --emitDeclarationOnly -p tsconfig.build.json",
"build:types": "cross-env NODE_ENV=buildProduction tsc --declaration --outDir dist/__internal__/src/ --emitDeclarationOnly -p tsconfig.build.json && node ./scripts/copy.js --src=./tsconfig.json --dest=./dist/__internal__/tsconfig.json && tsconfig-replace-paths -p ./dist/__internal__/tsconfig.json -s ./dist/__internal__ -o ./dist/__internal__ && node ./scripts/rm.js --path=./dist/__internal__/tsconfig.json",
"build:package.json": "node scripts/prepare-package-json.js",
"build:reexports": "node scripts/generateReExports.js --config=scripts/generateReExportsConfig.js",
"build:copy-assets": "node scripts/copyAssets.js",
Expand Down Expand Up @@ -48,8 +48,11 @@
"Chrome >= 75"
],
"peerDependencies": {
"@consta/icons": "^1.0.1",
"@consta/uikit": "^5.0.0"
"@bem-react/classname": "^1.6.0",
"@bem-react/classnames": "^1.3.10",
"@consta/icons": "^1.1.1",
"@consta/uikit": "^5.22.0",
"date-fns": "^2.30.0"
},
"config": {
"commitizen": {
Expand Down Expand Up @@ -93,9 +96,7 @@
"@bem-react/classnames": "^1.3.10",
"@bem/sdk.naming.cell.match": "^0.1.3",
"@bem/sdk.naming.presets": "^0.2.3",
"@consta/icons": "^1.0.1",
"@consta/stand": "^0.0.150",
"@consta/uikit": "^5.0.0",
"@consta/stand": "^0.0.155",
"@mdx-js/loader": "^2.1.5",
"@oclif/command": "^1.8.16",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.3",
Expand All @@ -106,9 +107,9 @@
"@testing-library/react-hooks": "^7.0.2",
"@types/jest": "^27.4.1",
"@types/node": "^16.7.13",
"@types/react": "^18.0.16",
"@types/react-dom": "^18.0.6",
"@types/react-transition-group": "^4.4.5",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@types/react-transition-group": "^4.4.12",
"@typescript-eslint/eslint-plugin": "^5.30.7",
"@typescript-eslint/parser": "^5.30.7",
"autoprefixer": "^10.4.4",
Expand Down Expand Up @@ -189,8 +190,8 @@
"terser-webpack-plugin": "^5.2.5",
"ts-jest": "^28.0.7",
"ts-loader": "^9.2.8",
"ttypescript": "^1.5.15",
"typescript": "^4.6.3",
"tsconfig-replace-paths": "^0.0.14",
"typescript": "^5.8.3",
"typescript-eslint-parser": "^22.0.0",
"typescript-transform-paths": "^3.3.1",
"use-subscription": "^1.5.1",
Expand Down
49 changes: 49 additions & 0 deletions scripts/copy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
const { copy } = require('fs-extra');

const { Command, flags } = require('@oclif/command');
const logSymbols = require('log-symbols');
const { remove } = require('fs-extra');

class GenerateCommand extends Command {
async safeInvokeHook(hook) {
if (hook !== undefined) {
if (typeof hook === 'function') {
this.log(`start executing ${hook.name}`);
await hook();
this.log(`finish executing ${hook.name}`);
} else {
this.error(`${hook.name} should be function!`);
}
}
}

async run() {
const hrstart = process.hrtime();
const { flags } = this.parse(GenerateCommand);

try {
await copy(flags.src, flags.dest, {
recursive: !!flags.recursive,
overwrite: !!flags.overwrite,
});
} catch (err) {
this.error(err);
}

const hrend = process.hrtime(hrstart);

this.log(logSymbols.success, `${flags.src} is copied!`);
this.log(`Execution time: ${hrend[0]}s`);
}
}

GenerateCommand.flags = {
src: flags.string(),
dest: flags.string(),
recursive: flags.boolean(),
overwrite: flags.boolean(),
};

GenerateCommand.description = 'removing file...';

GenerateCommand.run();
5 changes: 2 additions & 3 deletions src/components/ButtonMenu/types.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { IconComponent } from '@consta/icons/Icon';
import { PropsWithHTMLAttributesAndRef } from '@consta/uikit/__internal__/src/utils/types/PropsWithHTMLAttributes';
import {
ButtonPropForm,
ButtonPropSize,
ButtonPropView,
} from '@consta/uikit/Button';

import { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';

export type ButtonMenuDefaultItem = {
label: string;
href?: string;
Expand Down Expand Up @@ -58,4 +57,4 @@ export type ButtonMenuProps<ITEM = ButtonMenuDefaultItem> =

export type ButtonMenuComponent = <ITEM = ButtonMenuDefaultItem>(
props: ButtonMenuProps<ITEM>,
) => React.ReactElement | null;
) => React.ReactNode;
2 changes: 1 addition & 1 deletion src/components/Layout/LayoutRow/LayoutRow.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import './LayoutRow.css';

import { PropsWithHTMLAttributes } from '@consta/uikit/__internal__/src/utils/types/PropsWithHTMLAttributes';
import { cnMixSpace } from '@consta/uikit/MixSpace';
import React from 'react';

import { cn } from '##/utils/bem';
import { PropsWithHTMLAttributes } from '##/utils/types/PropsWithHTMLAttributes';

import { LayoutRowIsObject } from '../helpers';
import { LayoutRow as LayoutRowType, LayoutSlotHeight } from '../types';
Expand Down
3 changes: 1 addition & 2 deletions src/components/Layout/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { PropsWithHTMLAttributesAndRef } from '@consta/uikit/__internal__/src/utils/types/PropsWithHTMLAttributes';
import React from 'react';

import { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';

export type LayoutSlotHeight = 'm' | 's';

export type LayoutRow = {
Expand Down
7 changes: 3 additions & 4 deletions src/components/MegaMenu/MegaMenuBannerBar/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import {
AsTags,
} from '@consta/uikit/__internal__/src/utils/types/AsTags';
import { PropsWithAsAttributes } from '@consta/uikit/__internal__/src/utils/types/PropsWithAsAttributes';
import { PropsWithHTMLAttributesAndRef } from '@consta/uikit/__internal__/src/utils/types/PropsWithHTMLAttributes';
import React from 'react';

import { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';

export type MegaMenuBannerBarDefaultItem = {
onClick?: React.MouseEventHandler;
label: string;
Expand Down Expand Up @@ -61,7 +60,7 @@ export type MegaMenuBannerBarProps<ITEM = MegaMenuBannerBarDefaultItem> =
export type MegaMenuBannerBarComponent = <ITEM = MegaMenuBannerBarDefaultItem>(
props: MegaMenuBannerBarProps<ITEM>,
ref: React.Ref<HTMLDivElement>,
) => React.ReactElement | null;
) => React.ReactNode;

export type MegaMenuBannerBarItemProps<AS extends AsTags = 'div'> =
PropsWithAsAttributes<
Expand All @@ -78,4 +77,4 @@ export type MegaMenuBannerBarItemProps<AS extends AsTags = 'div'> =
export type MegaMenuBannerBarItemComponent = <AS extends AsTags = 'div'>(
props: MegaMenuBannerBarItemProps<AS>,
ref: React.Ref<HTMLElement>,
) => React.ReactElement | null;
) => React.ReactNode;
2 changes: 1 addition & 1 deletion src/components/MegaMenu/MegaMenuBox/MegaMenuBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const ContextConsumer: React.FC<{
handler: onClickOutside,
});

return children as React.ReactElement;
return children;
};

export const MegaMenuBox = (props: MegaMenuBoxProps) => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/MegaMenu/MegaMenuBox/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';
import { PropsWithHTMLAttributesAndRef } from '@consta/uikit/__internal__/src/utils/types/PropsWithHTMLAttributes';

export type MegaMenuBoxProps = PropsWithHTMLAttributesAndRef<
{
Expand Down
9 changes: 4 additions & 5 deletions src/components/MegaMenu/MegaMenuGlobal/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import {
AsTags,
} from '@consta/uikit/__internal__/src/utils/types/AsTags';
import { PropsWithAsAttributes } from '@consta/uikit/__internal__/src/utils/types/PropsWithAsAttributes';
import { PropsWithHTMLAttributesAndRef } from '@consta/uikit/__internal__/src/utils/types/PropsWithHTMLAttributes';
import React from 'react';

import { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';

export type MegaMenuGlobalDefaultItem = {
as?: AsTags;
attributes?: AsAttributes;
Expand Down Expand Up @@ -102,7 +101,7 @@ export type MegaMenuGlobalComponent = <
>(
props: MegaMenuGlobalProps<ITEM, GROUP>,
ref: React.Ref<HTMLDivElement>,
) => React.ReactElement | null;
) => React.ReactNode;

export type MegaMenuGlobalGroupProps<ITEM = MegaMenuGlobalDefaultItem> =
PropsWithHTMLAttributesAndRef<
Expand All @@ -120,7 +119,7 @@ export type MegaMenuGlobalGroupProps<ITEM = MegaMenuGlobalDefaultItem> =
export type MegaMenuGlobalGroupComponent = <ITEM = MegaMenuGlobalDefaultItem>(
props: MegaMenuGlobalGroupProps<ITEM>,
ref: React.Ref<HTMLDivElement>,
) => React.ReactElement | null;
) => React.ReactNode;

export type MegaMenuGlobalItemProps<AS extends AsTags = 'div'> =
PropsWithAsAttributes<
Expand All @@ -134,4 +133,4 @@ export type MegaMenuGlobalItemProps<AS extends AsTags = 'div'> =
export type MegaMenuGlobalItemComponent = <AS extends AsTags = 'div'>(
props: MegaMenuGlobalItemProps<AS>,
ref: React.Ref<HTMLElement>,
) => React.ReactElement | null;
) => React.ReactNode;
7 changes: 3 additions & 4 deletions src/components/MegaMenu/MegaMenuNavBar/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import {
AsTags,
} from '@consta/uikit/__internal__/src/utils/types/AsTags';
import { PropsWithAsAttributes } from '@consta/uikit/__internal__/src/utils/types/PropsWithAsAttributes';
import { PropsWithHTMLAttributesAndRef } from '@consta/uikit/__internal__/src/utils/types/PropsWithHTMLAttributes';
import React from 'react';

import { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';

export type MegaMenuNavBarDefaultItem = {
label: string;
iconLeft?: IconComponent;
Expand Down Expand Up @@ -68,7 +67,7 @@ export type MegaMenuNavBarProps<ITEM = MegaMenuNavBarDefaultItem> =
export type MegaMenuNavBarComponent = <ITEM = MegaMenuNavBarDefaultItem>(
props: MegaMenuNavBarProps<ITEM>,
ref: React.Ref<HTMLDivElement>,
) => React.ReactElement | null;
) => React.ReactNode;

export type MegaMenuNavBarItemProps<AS extends AsTags = 'div'> =
PropsWithAsAttributes<
Expand All @@ -85,4 +84,4 @@ export type MegaMenuNavBarItemProps<AS extends AsTags = 'div'> =
export type MegaMenuNavBarItemComponent = <AS extends AsTags = 'div'>(
props: MegaMenuNavBarItemProps<AS>,
ref: React.Ref<HTMLElement>,
) => React.ReactElement | null;
) => React.ReactNode;
5 changes: 2 additions & 3 deletions src/components/MegaMenu/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import {
AsAttributes,
AsTags,
} from '@consta/uikit/__internal__/src/utils/types/AsTags';
import { PropsWithHTMLAttributesAndRef } from '@consta/uikit/__internal__/src/utils/types/PropsWithHTMLAttributes';
import React from 'react';

import { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';

import {
MegaMenuBannerBarDefaultItem,
MegaMenuBannerBarPropGetItemAs,
Expand Down Expand Up @@ -103,4 +102,4 @@ export type MegaMenuComponent = <
>(
props: MegaMenuProps<ITEM, BANNER>,
ref: React.Ref<HTMLDivElement>,
) => React.ReactElement | null;
) => React.ReactNode;
4 changes: 2 additions & 2 deletions src/components/Menu/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';
import { PropsWithHTMLAttributesAndRef } from '@consta/uikit/__internal__/src/utils/types/PropsWithHTMLAttributes';

export type MenuDefaultItem = {
label: string;
Expand Down Expand Up @@ -44,4 +44,4 @@ export type MenuProps<ITEM = MenuDefaultItem> = PropsWithHTMLAttributesAndRef<

export type MenuComponent = <ITEM = MenuDefaultItem>(
props: MenuProps<ITEM>,
) => React.ReactElement | null;
) => React.ReactNode;
4 changes: 2 additions & 2 deletions src/components/MobileMenu/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { PropsWithHTMLAttributesAndRef } from '@consta/uikit/__internal__/src/utils/types/PropsWithHTMLAttributes';
import React from 'react';

import {
Expand All @@ -11,7 +12,6 @@ import {
VerticalMenuPropGetItemTarget,
VerticalMenuPropOnItemClick,
} from '##/components/VerticalMenu';
import { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';

export type MobileMenuProps<ITEM = VerticalMenuDefaultItem> =
PropsWithHTMLAttributesAndRef<
Expand All @@ -38,6 +38,6 @@ export type MobileMenuProps<ITEM = VerticalMenuDefaultItem> =

export type MobileMenuComponent = <ITEM = VerticalMenuDefaultItem>(
props: MobileMenuProps<ITEM>,
) => React.ReactElement | null;
) => React.ReactNode;

export type { VerticalMenuDefaultItem };
5 changes: 4 additions & 1 deletion src/components/Navbar/NavbarRail/NavbarRail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ const NavbarRailRender = (
icon={getItemIcon(item)}
ref={getItemRef?.(item) as React.RefObject<HTMLDivElement>}
label={getItemLabel(item)}
tooltipProps={{ ...tooltipProps, content: getItemTooltip(item) }}
tooltipProps={{
...tooltipProps,
tooltipContent: getItemTooltip(item),
}}
active={getItemActive(item)}
status={getItemStatus(item)}
/>
Expand Down
6 changes: 3 additions & 3 deletions src/components/Navbar/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export type NavbarComponent = <
GROUP = DefaultNavbarGroup,
>(
props: NavbarProps<ITEM, GROUP>,
) => React.ReactElement | null;
) => React.ReactNode;

export type NavbarRailProps<ITEM = DefaultNavbarRailItem> =
PropsWithHTMLAttributesAndRef<
Expand Down Expand Up @@ -197,7 +197,7 @@ export type NavbarRailProps<ITEM = DefaultNavbarRailItem> =

export type NavbarRailComponent = <ITEM = DefaultNavbarRailItem>(
props: NavbarRailProps<ITEM>,
) => React.ReactElement | null;
) => React.ReactNode;

export type NavbarItemProps<ITEM = DefaultNavbarItem> =
PropsWithHTMLAttributesAndRef<
Expand Down Expand Up @@ -225,7 +225,7 @@ export type NavbarItemProps<ITEM = DefaultNavbarItem> =

export type NavbarItemComponent = <ITEM = DefaultNavbarItem>(
props: NavbarItemProps<ITEM>,
) => React.ReactElement | null;
) => React.ReactNode;

export type NavbarRailItemProps = PropsWithHTMLAttributesAndRef<
{
Expand Down
5 changes: 2 additions & 3 deletions src/components/Notifications/NotificationsActions/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { IconComponent } from '@consta/icons/Icon';

import { PropsWithHTMLAttributes } from '##/utils/types/PropsWithHTMLAttributes';
import { PropsWithHTMLAttributes } from '@consta/uikit/__internal__/src/utils/types/PropsWithHTMLAttributes';

export type ButtonMenuDefaultItem = {
label: string;
Expand Down Expand Up @@ -43,4 +42,4 @@ export type NotificationsActionsProps<ITEM = ButtonMenuDefaultItem> =

export type NotificationsActionsComponent = <ITEM = ButtonMenuDefaultItem>(
props: NotificationsActionsProps<ITEM>,
) => React.ReactElement | null;
) => React.ReactNode;
3 changes: 1 addition & 2 deletions src/components/Notifications/NotificationsItem/types.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { IconProps } from '@consta/icons/Icon';
import { PropsWithHTMLAttributesAndRef } from '@consta/uikit/__internal__/src/utils/types/PropsWithHTMLAttributes';
import { BadgePropStatus } from '@consta/uikit/Badge';
import React from 'react';

import { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';

export type NotificationsItemAction = {
label: string;
onClick?: React.EventHandler<React.MouseEvent>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { PropsWithHTMLAttributesAndRef } from '@consta/uikit/__internal__/src/utils/types/PropsWithHTMLAttributes';
import { BadgePropStatus } from '@consta/uikit/Badge';

import { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';

export type NotificationsItemBadge = {
label: string;
status?: BadgePropStatus;
Expand Down
5 changes: 2 additions & 3 deletions src/components/Notifications/NotificationsList/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { IconProps } from '@consta/icons/Icon';

import { PropsWithHTMLAttributesAndRef } from '##/utils/types/PropsWithHTMLAttributes';
import { PropsWithHTMLAttributesAndRef } from '@consta/uikit/__internal__/src/utils/types/PropsWithHTMLAttributes';

import {
NotificationsItemAction,
Expand Down Expand Up @@ -126,4 +125,4 @@ export type NotificationsListComponent = <
GROUP_BY_DAY extends boolean = false,
>(
props: NotificationsListProps<ITEM, GROUP, ACTION, GROUP_BY_DAY>,
) => React.ReactElement | null;
) => React.ReactNode;
Loading
Loading