Skip to content

Commit

Permalink
Merge branch 'main' into timofeyevvv/readme_corrections_from_loc_team
Browse files Browse the repository at this point in the history
  • Loading branch information
vvtimofeev authored Dec 11, 2024
2 parents 0286477 + 555b186 commit 963119a
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 26 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## [6.38.0](https://github.com/gravity-ui/uikit/compare/v6.37.0...v6.38.0) (2024-12-06)


### Features

* **User:** add html titles for elements ([#1982](https://github.com/gravity-ui/uikit/issues/1982)) ([105d43b](https://github.com/gravity-ui/uikit/commit/105d43b0d511e516675e66877fb31c94bf583f91))


### Bug Fixes

* **PinInput:** remove height glitch in Safari ([#1938](https://github.com/gravity-ui/uikit/issues/1938)) ([d6cb1cf](https://github.com/gravity-ui/uikit/commit/d6cb1cfaec89a806b6948f92aa2c12669c110fb8))
* **TextInput:** share font styles between error and note blocks in OuterAdditionalContent ([#1970](https://github.com/gravity-ui/uikit/issues/1970)) ([55737b5](https://github.com/gravity-ui/uikit/commit/55737b5a66dbd975ecbbf84dac95592cd65e3b1a))

## [6.37.0](https://github.com/gravity-ui/uikit/compare/v6.36.0...v6.37.0) (2024-11-27)


Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gravity-ui/uikit",
"version": "6.37.0",
"version": "6.38.0",
"description": "Gravity UI base styling and components",
"keywords": [
"component",
Expand Down
17 changes: 7 additions & 10 deletions src/components/Sheet/SheetContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const ACCELERATION_Y_MAX = 0.08;
const ACCELERATION_Y_MIN = -0.02;
// 90% from viewport
const MAX_CONTENT_HEIGHT_FROM_VIEWPORT_COEFFICIENT = 0.9;
const WINDOW_RESIZE_TIMEOUT = 25;
const WINDOW_RESIZE_TIMEOUT = 50;

let hashHistory: string[] = [];

Expand Down Expand Up @@ -123,21 +123,14 @@ class SheetContent extends React.Component<SheetContentInnerProps, SheetContentS
render() {
const {content, contentClassName, swipeAreaClassName, hideTopBar, title} = this.props;

const {
deltaY,
swipeAreaTouched,
contentTouched,
veilTouched,
isAnimating,
inWindowResizeScope,
} = this.state;
const {deltaY, swipeAreaTouched, contentTouched, veilTouched, isAnimating} = this.state;

const veilTransitionMod = {
'with-transition': !deltaY || veilTouched,
};

const sheetTransitionMod = {
'with-transition': !inWindowResizeScope && veilTransitionMod['with-transition'],
'with-transition': veilTransitionMod['with-transition'],
};

const contentMod = {
Expand Down Expand Up @@ -416,6 +409,10 @@ class SheetContent extends React.Component<SheetContentInnerProps, SheetContentS
};

private onResizeWindow = () => {
if (this.state.isAnimating) {
return;
}

this.setState({inWindowResizeScope: true});

if (this.resizeWindowTimer) {
Expand Down
26 changes: 16 additions & 10 deletions src/components/User/User.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,13 @@ import React from 'react';
import {Avatar} from '../Avatar';
import {block} from '../utils/cn';

import {COMPACT_SIZES, DEFAULT_SIZE} from './constants';
import {COMPACT_SIZES, DEFAULT_SIZE, UserQa} from './constants';
import type {UserProps} from './types';

import './User.scss';

const b = block('user');

export const UserQa = {
NAME: 'user-name',
DESCRIPTION: 'user-description',
};

export const User = React.forwardRef<HTMLDivElement, UserProps>(
(
{
Expand All @@ -30,7 +25,10 @@ export const User = React.forwardRef<HTMLDivElement, UserProps>(
},
ref,
) => {
const showDescription = Boolean(description && !COMPACT_SIZES.includes(size));
const showDescription = Boolean(description && !COMPACT_SIZES.has(size));

const nameTitle = typeof name === 'string' ? name : undefined;
const descriptionTitle = typeof description === 'string' ? description : undefined;

return (
<div
Expand All @@ -43,18 +41,26 @@ export const User = React.forwardRef<HTMLDivElement, UserProps>(
>
{avatar ? (
<div className={b('avatar')}>
{React.isValidElement(avatar) ? avatar : <Avatar {...avatar} size={size} />}
{React.isValidElement(avatar) ? (
avatar
) : (
<Avatar {...avatar} size={size} title={avatar.title || nameTitle} />
)}
</div>
) : null}
{name || showDescription ? (
<div className={b('info')}>
{name ? (
<span className={b('name')} data-qa={UserQa.NAME}>
<span className={b('name')} title={nameTitle} data-qa={UserQa.NAME}>
{name}
</span>
) : null}
{showDescription ? (
<span className={b('description')} data-qa={UserQa.DESCRIPTION}>
<span
className={b('description')}
title={descriptionTitle}
data-qa={UserQa.DESCRIPTION}
>
{description}
</span>
) : null}
Expand Down
7 changes: 6 additions & 1 deletion src/components/User/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import type {UserSize} from './types';

export const COMPACT_SIZES: UserSize[] = ['xs', '2xs'];
export const COMPACT_SIZES: Set<UserSize> = new Set(['xs', '2xs']);
export const DEFAULT_SIZE: UserSize = 'm';

export const UserQa = {
NAME: 'user-name',
DESCRIPTION: 'user-description',
};
1 change: 1 addition & 0 deletions src/components/User/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export type {UserSize, UserProps} from './types';
export {UserQa} from './constants';
export {User} from './User';
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ $block: '.#{variables.$ns}outer-additional-content';

&__note,
&__error {
@include mixins.text-body-1();
margin-block-start: 2px;
}

&__error {
@include mixins.text-body-1();

color: var(--g-color-text-danger);

&:not(:last-child) {
Expand Down

0 comments on commit 963119a

Please sign in to comment.