@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/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # 1.1.0 (2026-09-03)
7
+
8
+ ### Features
9
+
10
+ - **FF-8959:** show a tooltip with the full tag label when it is truncated ([ba346b7](https://github.com/cloud-ru-tech/snack-v2/commit/ba346b70f2bad14010ee5845b147139e6edde0c1))
11
+
6
12
  ## 1.0.9 (2026-09-01)
7
13
 
8
14
  ### Bug Fixes
package/README.md CHANGED
@@ -77,6 +77,7 @@ export function Removable() {
77
77
  | `onDelete` | `MouseEventHandler<HTMLButtonElement>` | — | Обработчик удаления тега. Если задан — отображается крестик-remove |
78
78
  | `size` | `"m"` \| `"s"` \| `"xs"` | — | |
79
79
  | `tabIndex` | `number` | — | |
80
+ | `truncateVariant` | `"end"` \| `"middle"` | — | Вариант обрезания подписи, не поместившейся в тег. |
80
81
 
81
82
  ##### Related types
82
83
 
@@ -1,2 +1,2 @@
1
1
  import { TagBaseProps } from '../../types';
2
- export declare function TagBase({ label, size, appearance, onDelete, className, tabIndex, innerRef, ...rest }: TagBaseProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function TagBase({ label, truncateVariant, size, appearance, onDelete, className, tabIndex, innerRef, ...rest }: TagBaseProps): import("react/jsx-runtime").JSX.Element;
@@ -6,13 +6,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.TagBase = TagBase;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const system_1 = require("@cloud-ru/ds-icons/interface/system");
9
+ const truncate_string_1 = require("@cloud-ru/ds-truncate-string");
9
10
  const utils_1 = require("@cloud-ru/ds-utils");
10
11
  const classnames_1 = __importDefault(require("classnames"));
11
12
  const constants_1 = require("../../constants");
12
13
  const constants_2 = require("./constants");
13
14
  const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
14
- function TagBase({ label, size = constants_1.SIZE.S, appearance = constants_1.APPEARANCE.Neutral, onDelete, className, tabIndex, innerRef, ...rest }) {
15
+ function TagBase({ label, truncateVariant, size = constants_1.SIZE.S, appearance = constants_1.APPEARANCE.Neutral, onDelete, className, tabIndex, innerRef, ...rest }) {
15
16
  const isRemovable = Boolean(onDelete);
16
- return ((0, jsx_runtime_1.jsxs)("span", { ref: innerRef, ...(0, utils_1.extractSupportProps)(rest), className: (0, classnames_1.default)(styles_module_scss_1.default.tag, className), "data-size": size, "data-appearance": appearance, "data-removable": isRemovable, children: [(0, jsx_runtime_1.jsx)("span", { className: styles_module_scss_1.default.textWrapper, children: (0, jsx_runtime_1.jsx)("span", { className: styles_module_scss_1.default.label, children: label }) }), isRemovable && ((0, jsx_runtime_1.jsx)("button", { type: 'button', className: styles_module_scss_1.default.tagButton, onClick: onDelete, "data-test-id": constants_1.TEST_IDS.tag.removeButton, tabIndex: tabIndex, children: (0, jsx_runtime_1.jsx)("span", { className: styles_module_scss_1.default.icon, children: (0, jsx_runtime_1.jsx)(system_1.CrossSVG, { size: constants_2.ICON_SIZE[size] }) }) }))] }));
17
+ return ((0, jsx_runtime_1.jsxs)("span", { ref: innerRef, ...(0, utils_1.extractSupportProps)(rest), className: (0, classnames_1.default)(styles_module_scss_1.default.tag, className), "data-size": size, "data-appearance": appearance, "data-removable": isRemovable, children: [(0, jsx_runtime_1.jsx)("span", { className: styles_module_scss_1.default.textWrapper, children: (0, jsx_runtime_1.jsx)(truncate_string_1.TruncateString, { className: styles_module_scss_1.default.label, text: label, variant: truncateVariant }) }), isRemovable && ((0, jsx_runtime_1.jsx)("button", { type: 'button', className: styles_module_scss_1.default.tagButton, onClick: onDelete, "data-test-id": constants_1.TEST_IDS.tag.removeButton, tabIndex: tabIndex, children: (0, jsx_runtime_1.jsx)("span", { className: styles_module_scss_1.default.icon, children: (0, jsx_runtime_1.jsx)(system_1.CrossSVG, { size: constants_2.ICON_SIZE[size] }) }) }))] }));
17
18
  }
18
19
  (0, utils_1.withInnerRefSupport)(TagBase);
@@ -236,10 +236,7 @@
236
236
  paragraph-spacing:var(--sn-regular-label-m-paragraphSpacing, var(--sn-primitive-font-paragraphSpacing-byFontSize12, 6px));
237
237
  }
238
238
  .tag .label{
239
- overflow:hidden;
240
239
  color:var(--sn-theme-color-available-version-textSecondary, var(--sn-brand-color-text-version-secondary, rgba(65, 66, 78, 0.8)));
241
- text-overflow:ellipsis;
242
- white-space:nowrap;
243
240
  }
244
241
  .tag[data-appearance=neutral]{
245
242
  background-color:var(--sn-theme-color-neutral-decorTransparent, var(--sn-brand-color-neutral-transparent-forLightMode, rgba(124, 131, 182, 0.0784313725)));
@@ -236,10 +236,7 @@
236
236
  paragraph-spacing:var(--sn-regular-label-m-paragraphSpacing, var(--sn-primitive-font-paragraphSpacing-byFontSize12, 6px));
237
237
  }
238
238
  .tag .label{
239
- overflow:hidden;
240
239
  color:var(--sn-theme-color-available-version-textSecondary, var(--sn-brand-color-text-version-secondary, rgba(65, 66, 78, 0.8)));
241
- text-overflow:ellipsis;
242
- white-space:nowrap;
243
240
  }
244
241
  .tag[data-appearance=neutral]{
245
242
  background-color:var(--sn-theme-color-neutral-decorTransparent, var(--sn-brand-color-neutral-transparent-forLightMode, rgba(124, 131, 182, 0.0784313725)));
@@ -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
  import { APPEARANCE, SIZE } from './constants';
@@ -24,6 +25,8 @@ export type CommonTagProps = {
24
25
  tabIndex?: number;
25
26
  /** Обработчик удаления тега. Если задан — отображается крестик-remove */
26
27
  onDelete?: MouseEventHandler<HTMLButtonElement>;
28
+ /** Вариант обрезания подписи, не поместившейся в тег. */
29
+ truncateVariant?: TruncateStringProps['variant'];
27
30
  };
28
31
  export type TagBaseProps = WithSupportProps<{
29
32
  onDelete?: MouseEventHandler<HTMLButtonElement>;
@@ -1,2 +1,2 @@
1
1
  import { TagBaseProps } from '../../types.js';
2
- export declare function TagBase({ label, size, appearance, onDelete, className, tabIndex, innerRef, ...rest }: TagBaseProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function TagBase({ label, truncateVariant, size, appearance, onDelete, className, tabIndex, innerRef, ...rest }: TagBaseProps): import("react/jsx-runtime").JSX.Element;
@@ -1,12 +1,13 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { CrossSVG } from '@cloud-ru/ds-icons/interface/system';
3
+ import { TruncateString } from '@cloud-ru/ds-truncate-string';
3
4
  import { extractSupportProps, withInnerRefSupport } from '@cloud-ru/ds-utils';
4
5
  import cn from 'classnames';
5
6
  import { APPEARANCE, SIZE, TEST_IDS } from '../../constants.js';
6
7
  import { ICON_SIZE } from './constants.js';
7
8
  import styles from './styles.module.css';
8
- export function TagBase({ label, size = SIZE.S, appearance = APPEARANCE.Neutral, onDelete, className, tabIndex, innerRef, ...rest }) {
9
+ export function TagBase({ label, truncateVariant, size = SIZE.S, appearance = APPEARANCE.Neutral, onDelete, className, tabIndex, innerRef, ...rest }) {
9
10
  const isRemovable = Boolean(onDelete);
10
- return (_jsxs("span", { ref: innerRef, ...extractSupportProps(rest), className: cn(styles.tag, className), "data-size": size, "data-appearance": appearance, "data-removable": isRemovable, children: [_jsx("span", { className: styles.textWrapper, children: _jsx("span", { className: styles.label, children: label }) }), isRemovable && (_jsx("button", { type: 'button', className: styles.tagButton, onClick: onDelete, "data-test-id": TEST_IDS.tag.removeButton, tabIndex: tabIndex, children: _jsx("span", { className: styles.icon, children: _jsx(CrossSVG, { size: ICON_SIZE[size] }) }) }))] }));
11
+ return (_jsxs("span", { ref: innerRef, ...extractSupportProps(rest), className: cn(styles.tag, className), "data-size": size, "data-appearance": appearance, "data-removable": isRemovable, children: [_jsx("span", { className: styles.textWrapper, children: _jsx(TruncateString, { className: styles.label, text: label, variant: truncateVariant }) }), isRemovable && (_jsx("button", { type: 'button', className: styles.tagButton, onClick: onDelete, "data-test-id": TEST_IDS.tag.removeButton, tabIndex: tabIndex, children: _jsx("span", { className: styles.icon, children: _jsx(CrossSVG, { size: ICON_SIZE[size] }) }) }))] }));
11
12
  }
12
13
  withInnerRefSupport(TagBase);
@@ -236,10 +236,7 @@
236
236
  paragraph-spacing:var(--sn-regular-label-m-paragraphSpacing, var(--sn-primitive-font-paragraphSpacing-byFontSize12, 6px));
237
237
  }
238
238
  .tag .label{
239
- overflow:hidden;
240
239
  color:var(--sn-theme-color-available-version-textSecondary, var(--sn-brand-color-text-version-secondary, rgba(65, 66, 78, 0.8)));
241
- text-overflow:ellipsis;
242
- white-space:nowrap;
243
240
  }
244
241
  .tag[data-appearance=neutral]{
245
242
  background-color:var(--sn-theme-color-neutral-decorTransparent, var(--sn-brand-color-neutral-transparent-forLightMode, rgba(124, 131, 182, 0.0784313725)));
@@ -236,10 +236,7 @@
236
236
  paragraph-spacing:var(--sn-regular-label-m-paragraphSpacing, var(--sn-primitive-font-paragraphSpacing-byFontSize12, 6px));
237
237
  }
238
238
  .tag .label{
239
- overflow:hidden;
240
239
  color:var(--sn-theme-color-available-version-textSecondary, var(--sn-brand-color-text-version-secondary, rgba(65, 66, 78, 0.8)));
241
- text-overflow:ellipsis;
242
- white-space:nowrap;
243
240
  }
244
241
  .tag[data-appearance=neutral]{
245
242
  background-color:var(--sn-theme-color-neutral-decorTransparent, var(--sn-brand-color-neutral-transparent-forLightMode, rgba(124, 131, 182, 0.0784313725)));
@@ -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
  import { APPEARANCE, SIZE } from './constants.js';
@@ -24,6 +25,8 @@ export type CommonTagProps = {
24
25
  tabIndex?: number;
25
26
  /** Обработчик удаления тега. Если задан — отображается крестик-remove */
26
27
  onDelete?: MouseEventHandler<HTMLButtonElement>;
28
+ /** Вариант обрезания подписи, не поместившейся в тег. */
29
+ truncateVariant?: TruncateStringProps['variant'];
27
30
  };
28
31
  export type TagBaseProps = WithSupportProps<{
29
32
  onDelete?: MouseEventHandler<HTMLButtonElement>;