@cloud-ru/ds-tag 1.0.9 → 1.1.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloud-ru/ds-tag",
3
- "version": "1.0.9",
3
+ "version": "1.1.0",
4
4
  "description": "Пакет компактных меток — компонент Tag (опционально удаляемый или ссылочный) и контейнер TagRow для групп меток с обрезанием по строкам.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -37,8 +37,9 @@
37
37
  "@cloud-ru/ds-dropdown": "^1.0.8",
38
38
  "@cloud-ru/ds-icons": "^1.1.0",
39
39
  "@cloud-ru/ds-materials": "^1.0.1",
40
+ "@cloud-ru/ds-scroll": "^1.0.2",
40
41
  "@cloud-ru/ds-utils": "^1.1.0",
41
- "@cloud-ru/ds-scroll": "^1.0.2"
42
+ "@cloud-ru/ds-truncate-string": "^1.0.4"
42
43
  },
43
44
  "publishConfig": {
44
45
  "access": "public"
@@ -1,4 +1,5 @@
1
1
  import { CrossSVG } from '@cloud-ru/ds-icons/interface/system';
2
+ import { TruncateString } from '@cloud-ru/ds-truncate-string';
2
3
  import { extractSupportProps, withInnerRefSupport } from '@cloud-ru/ds-utils';
3
4
  import cn from 'classnames';
4
5
 
@@ -9,6 +10,7 @@ import styles from './styles.module.scss';
9
10
 
10
11
  export function TagBase({
11
12
  label,
13
+ truncateVariant,
12
14
  size = SIZE.S,
13
15
  appearance = APPEARANCE.Neutral,
14
16
  onDelete,
@@ -29,7 +31,7 @@ export function TagBase({
29
31
  data-removable={isRemovable}
30
32
  >
31
33
  <span className={styles.textWrapper}>
32
- <span className={styles.label}>{label}</span>
34
+ <TruncateString className={styles.label} text={label} variant={truncateVariant} />
33
35
  </span>
34
36
  {isRemovable && (
35
37
  <button
@@ -145,10 +145,7 @@ $removeButtonSize: (
145
145
  }
146
146
 
147
147
  .label {
148
- overflow: hidden;
149
148
  color: base.$sn-theme-color-available-version-textSecondary;
150
- text-overflow: ellipsis;
151
- white-space: nowrap;
152
149
  }
153
150
 
154
151
  @each $appearance in $appearances {
package/src/types.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { TruncateStringProps } from '@cloud-ru/ds-truncate-string';
1
2
  import { PolymorphicRef, ValueOf, WithSupportProps } from '@cloud-ru/ds-utils';
2
3
  import { ComponentPropsWithoutRef, ElementType, MouseEvent, MouseEventHandler, Ref } from 'react';
3
4
 
@@ -31,6 +32,8 @@ export type CommonTagProps = {
31
32
  tabIndex?: number;
32
33
  /** Обработчик удаления тега. Если задан — отображается крестик-remove */
33
34
  onDelete?: MouseEventHandler<HTMLButtonElement>;
35
+ /** Вариант обрезания подписи, не поместившейся в тег. */
36
+ truncateVariant?: TruncateStringProps['variant'];
34
37
  };
35
38
 
36
39
  export type TagBaseProps = WithSupportProps<{