Skip to content

Commit

Permalink
feat: add more exports (#7892)
Browse files Browse the repository at this point in the history
* feat: add more imports

* feat: add more exports

* bump(@vkontakte/vkui): from 7.0.0-beta.1 to 7.0.0-dev-d4929f.0

* feat: type getInitialsFontSize function

* bump(@vkontakte/vkui): from 7.0.0-dev-d4929f.0 to 7.0.0-dev-d4929f.1

* revert version up

---------

Co-authored-by: GitHub Action <[email protected]>
  • Loading branch information
BlackySoul and actions-user authored Nov 7, 2024
1 parent ca09fb8 commit f76f212
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
6 changes: 4 additions & 2 deletions packages/vkui/src/components/Avatar/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ const MAX_FONT_SIZE = 30;
const MAX_IMAGE_BASE_SIZE: ImageBaseSize = 96;
const RELATIVE_SIZE = MAX_FONT_SIZE / MAX_IMAGE_BASE_SIZE;

export type GetInitialsFontSizeType = (avatarSize: number) => number;

/**
* По возможности выставляем размеры по дизайн-системе. Иначе высчитываем.
*/
export function getInitialsFontSize(avatarSize: number): number {
export const getInitialsFontSize: GetInitialsFontSizeType = (avatarSize) => {
if (avatarSize <= 16) {
return 5;
} else if (avatarSize <= 24) {
Expand All @@ -33,4 +35,4 @@ export function getInitialsFontSize(avatarSize: number): number {
const calculatedFontSize = Math.ceil(avatarSize * RELATIVE_SIZE);
const evenFix = calculatedFontSize % 2;
return calculatedFontSize + evenFix;
}
};
8 changes: 4 additions & 4 deletions packages/vkui/src/components/Placeholder/Placeholder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,18 @@ const PlaceholderIcon = (props: PlaceholderIconProps): React.ReactNode => (
<RootComponent baseClassName={styles.icon} {...props} />
);

export type PlaceholderHeaderProps = HTMLAttributesWithRootRef<HTMLElement> & HasComponent;
export type PlaceholderTitleProps = HTMLAttributesWithRootRef<HTMLElement> & HasComponent;

const PlaceholderTitle = ({ className, ...restProps }: PlaceholderHeaderProps): React.ReactNode => (
const PlaceholderTitle = ({ className, ...restProps }: PlaceholderTitleProps): React.ReactNode => (
<Title level="2" weight="2" className={classNames(className, styles.title)} {...restProps} />
);

export type PlaceholderTextProps = HTMLAttributesWithRootRef<HTMLElement> & HasComponent;
export type PlaceholderDescriptionProps = HTMLAttributesWithRootRef<HTMLElement> & HasComponent;

const PlaceholderDescription = ({
className,
...restProps
}: PlaceholderTextProps): React.ReactNode => (
}: PlaceholderDescriptionProps): React.ReactNode => (
<Headline weight="3" className={classNames(className, styles.description)} {...restProps} />
);

Expand Down
15 changes: 12 additions & 3 deletions packages/vkui/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export { AspectRatio } from './components/AspectRatio/AspectRatio';
export type { AspectRatioProps } from './components/AspectRatio/AspectRatio';
export { Flex } from './components/Flex/Flex';
export type { FlexProps } from './components/Flex/Flex';
export type { FlexItemProps } from './components/Flex/FlexItem/FlexItem';
export { SimpleGrid } from './components/SimpleGrid/SimpleGrid';
export type { SimpleGridProps } from './components/SimpleGrid/SimpleGrid';

Expand Down Expand Up @@ -198,6 +199,7 @@ export type { InfoRowProps } from './components/InfoRow/InfoRow';
export { Gallery } from './components/Gallery/Gallery';
export type { GalleryProps } from './components/Gallery/Gallery';
export { Avatar } from './components/Avatar/Avatar';
export type { GetInitialsFontSizeType } from './components/Avatar/helpers';
export type {
AvatarProps,
AvatarBadgeProps,
Expand Down Expand Up @@ -244,8 +246,8 @@ export type {
PlaceholderProps,
PlaceholderContainerProps,
PlaceholderIconProps,
PlaceholderHeaderProps,
PlaceholderTextProps,
PlaceholderTitleProps,
PlaceholderDescriptionProps,
PlaceholderActionsProps,
} from './components/Placeholder/Placeholder';
export { Banner } from './components/Banner/Banner';
Expand Down Expand Up @@ -292,7 +294,13 @@ export type { DropZoneProps } from './components/DropZone/DropZone';
export { Input } from './components/Input/Input';
export type { InputProps } from './components/Input/Input';
export { Chip } from './components/ChipsInputBase/Chip/Chip';
export type { ChipProps, ChipOption, RenderChipProps } from './components/ChipsInputBase/types';
export type {
ChipProps,
ChipOption,
RenderChipProps,
ChipOptionValue,
ChipOptionLabel,
} from './components/ChipsInputBase/types';
export { ChipsInput } from './components/ChipsInput/ChipsInput';
export type { ChipsInputProps } from './components/ChipsInput/ChipsInput';
export { ChipsSelect } from './components/ChipsSelect/ChipsSelect';
Expand Down Expand Up @@ -445,6 +453,7 @@ export {
export type { AdaptivityProps } from './components/AdaptivityProvider/AdaptivityContext';
export { calcInitialsAvatarColor } from './helpers/avatar';
export { CustomScrollView } from './components/CustomScrollView/CustomScrollView';
export type { CustomScrollViewProps } from './components/CustomScrollView/CustomScrollView';
export { Popper } from './components/Popper/Popper';
export type { PopperProps } from './components/Popper/Popper';

Expand Down

0 comments on commit f76f212

Please sign in to comment.