@snack-uikit/tag 0.6.4 → 0.7.1-preview-3f90b7f1.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 +16 -0
- package/README.md +1 -1
- package/dist/components/Tag/Tag.d.ts +2 -0
- package/dist/components/Tag/Tag.js +1 -0
- package/dist/components/TagRow/TagRow.d.ts +4 -1
- package/dist/components/TagRow/TagRow.js +4 -2
- package/dist/components/TagRow/utils.d.ts +1 -1
- package/dist/components/TagRow/utils.js +4 -7
- package/dist/helperComponents/TagList/TagList.js +1 -1
- package/dist/helperComponents/TagMore/TagMore.js +2 -2
- package/dist/helperComponents/TagMore/styles.module.css +0 -7
- package/dist/helperComponents/TagRowTruncated/TagRowTruncated.d.ts +3 -1
- package/dist/helperComponents/TagRowTruncated/TagRowTruncated.js +3 -2
- package/dist/helperComponents/TagRowTruncated/styles.module.css +1 -0
- package/dist/types.d.ts +2 -2
- package/package.json +4 -4
- package/src/components/Tag/Tag.tsx +2 -0
- package/src/components/TagRow/TagRow.tsx +6 -2
- package/src/components/TagRow/utils.ts +4 -7
- package/src/helperComponents/TagList/TagList.tsx +1 -1
- package/src/helperComponents/TagMore/TagMore.tsx +4 -5
- package/src/helperComponents/TagMore/styles.module.scss +0 -6
- package/src/helperComponents/TagRowTruncated/TagRowTruncated.tsx +4 -2
- package/src/helperComponents/TagRowTruncated/styles.module.scss +1 -0
- package/src/types.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
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
|
+
# 0.7.0 (2024-01-31)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **FF-4016:** fix usages of TagRow inside Table, remove local Dropdown ([b33d8e5](https://github.com/cloud-ru-tech/snack-uikit/commit/b33d8e5f7fb74d1e5a14a00c8ee428383b1dac0b))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### BREAKING CHANGES
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
* **FF-4016:** rename color to appearance inside TagRow items ([e1bbffb](https://github.com/cloud-ru-tech/snack-uikit/commit/e1bbffbfe6bd4a60cfc3a78170e1bdc030312866))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
## 0.6.4 (2024-01-23)
|
|
7
23
|
|
|
8
24
|
### Only dependencies have been changed
|
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
|------|------|---------------|-------------|
|
|
23
23
|
| items* | `TagRowItem[]` | - | Массив тэгов |
|
|
24
24
|
| rowLimit | `number` | - | Лимит количества рядов тэгов. При достижении лимита тэги скрываются под кнопкой. Отсутствие лимита или значение равное нулю отобразит весь список |
|
|
25
|
-
| size | enum Size: `"xs"`, `"s"` |
|
|
25
|
+
| size | enum Size: `"xs"`, `"s"` | - | Размер |
|
|
26
26
|
| moreButtonLabel | `string` | - | Текст кнопки, при наведении на которую отображается список скрытых тэгов |
|
|
27
27
|
| className | `string` | - | CSS-класс |
|
|
28
28
|
| onItemRemove | `(item: string) => void` | - | Коллбэк на клик по удалению тэга |
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { MouseEventHandler } from 'react';
|
|
2
2
|
import { WithSupportProps } from '@snack-uikit/utils';
|
|
3
|
+
import { APPEARANCE } from '../../constants';
|
|
3
4
|
import { Appearance, Size } from '../../types';
|
|
4
5
|
export type TagProps = WithSupportProps<{
|
|
5
6
|
/** Текст */
|
|
@@ -14,3 +15,4 @@ export type TagProps = WithSupportProps<{
|
|
|
14
15
|
className?: string;
|
|
15
16
|
}>;
|
|
16
17
|
export declare function Tag({ label, size, appearance, onDelete, className, ...rest }: TagProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export { APPEARANCE };
|
|
@@ -20,3 +20,4 @@ export function Tag(_a) {
|
|
|
20
20
|
var { label, size = SIZE.Xs, appearance = APPEARANCE.Neutral, onDelete, className } = _a, rest = __rest(_a, ["label", "size", "appearance", "onDelete", "className"]);
|
|
21
21
|
return (_jsxs("span", Object.assign({}, extractSupportProps(rest), { className: cn(styles.tag, className), "data-size": size, "data-appearance": appearance, "data-removable": Boolean(onDelete), children: [_jsx("span", { className: styles.label, children: label }), onDelete && (_jsx("button", { type: 'button', className: styles.tagButton, onClick: onDelete, "data-test-id": 'tag-remove-button', children: size === SIZE.Xs ? (_jsx(CrossSVG, { size: ICON_SIZE[size], className: styles.icon })) : (_jsx(CrossSVG, { size: ICON_SIZE[size], className: styles.icon })) }))] })));
|
|
22
22
|
}
|
|
23
|
+
export { APPEARANCE };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { WithSupportProps } from '@snack-uikit/utils';
|
|
2
3
|
import { Size, TagRowItem } from '../../types';
|
|
3
4
|
export type TagRowProps = WithSupportProps<{
|
|
@@ -14,4 +15,6 @@ export type TagRowProps = WithSupportProps<{
|
|
|
14
15
|
/** Коллбэк на клик по удалению тэга */
|
|
15
16
|
onItemRemove?(item: string): void;
|
|
16
17
|
}>;
|
|
17
|
-
|
|
18
|
+
declare function TagRowInner({ items, rowLimit, size, ...props }: TagRowProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare const TagRow: import("react").MemoExoticComponent<typeof TagRowInner>;
|
|
20
|
+
export {};
|
|
@@ -10,14 +10,16 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { memo, useMemo } from 'react';
|
|
13
14
|
import { SIZE } from '../../constants';
|
|
14
15
|
import { TagRowSimple, TagRowTruncated } from '../../helperComponents';
|
|
15
16
|
import { mapTagRowItem } from './utils';
|
|
16
|
-
|
|
17
|
+
function TagRowInner(_a) {
|
|
17
18
|
var { items, rowLimit, size = SIZE.Xs } = _a, props = __rest(_a, ["items", "rowLimit", "size"]);
|
|
18
|
-
const coloredItems = items.map(mapTagRowItem);
|
|
19
|
+
const coloredItems = useMemo(() => items.map(mapTagRowItem), [items]);
|
|
19
20
|
if (rowLimit) {
|
|
20
21
|
return _jsx(TagRowTruncated, Object.assign({ items: coloredItems, rowLimit: rowLimit, size: size }, props));
|
|
21
22
|
}
|
|
22
23
|
return _jsx(TagRowSimple, Object.assign({ items: coloredItems, size: size }, props));
|
|
23
24
|
}
|
|
25
|
+
export const TagRow = memo(TagRowInner);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { TagRowItem, TagRowItemInner } from '../../types';
|
|
2
|
-
export declare const mapTagRowItem: ({ label,
|
|
2
|
+
export declare const mapTagRowItem: ({ label, appearance }: TagRowItem) => TagRowItemInner;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { APPEARANCE } from '../../constants';
|
|
2
|
-
export const mapTagRowItem = ({ label,
|
|
3
|
-
if (
|
|
4
|
-
return {
|
|
5
|
-
label,
|
|
6
|
-
color,
|
|
7
|
-
};
|
|
2
|
+
export const mapTagRowItem = ({ label, appearance }) => {
|
|
3
|
+
if (appearance) {
|
|
4
|
+
return { label, appearance };
|
|
8
5
|
}
|
|
9
6
|
return {
|
|
10
7
|
label,
|
|
11
|
-
|
|
8
|
+
appearance: APPEARANCE.Neutral,
|
|
12
9
|
};
|
|
13
10
|
};
|
|
@@ -3,7 +3,7 @@ import { Tag } from '../../components';
|
|
|
3
3
|
import { SIZE } from '../../constants';
|
|
4
4
|
function renderTag(size, handleRemoveItem, setRef) {
|
|
5
5
|
return function TagRowItem(item, index) {
|
|
6
|
-
return (_jsx("div", { ref: setRef === null || setRef === void 0 ? void 0 : setRef(item, index), children: _jsx(Tag, { label: item.label, appearance: item.
|
|
6
|
+
return (_jsx("div", { ref: setRef === null || setRef === void 0 ? void 0 : setRef(item, index), children: _jsx(Tag, { label: item.label, appearance: item.appearance, size: size, onDelete: handleRemoveItem === null || handleRemoveItem === void 0 ? void 0 : handleRemoveItem(item) }) }, item.label));
|
|
7
7
|
};
|
|
8
8
|
}
|
|
9
9
|
export function TagList({ items, size = SIZE.Xs, onItemRemove, setTagRef }) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { Dropdown } from '@snack-uikit/dropdown';
|
|
3
3
|
import { Scroll } from '@snack-uikit/scroll';
|
|
4
4
|
import { TAG_ROW_TEST_IDS } from '../../components/TagRow/constants';
|
|
5
5
|
import { SIZE } from '../../constants';
|
|
6
6
|
import { TagRowSimple } from '../TagRowSimple';
|
|
7
7
|
import styles from './styles.module.css';
|
|
8
8
|
export function TagMore({ items, text = '', size = SIZE.Xs, buttonRef, onItemRemove }) {
|
|
9
|
-
return (_jsx(
|
|
9
|
+
return (_jsx(Dropdown, { placement: 'bottom-end', trigger: 'hoverAndFocusVisible', triggerClassName: styles.triggerClassName, content: _jsx("div", { className: styles.tagRowDroplistContainer, "data-size": size, children: _jsx(Scroll, { className: styles.tagRowDroplistScroll, size: 's', barHideStrategy: 'move', resize: 'none', children: _jsx(TagRowSimple, { items: items, size: size, onItemRemove: onItemRemove, "data-test-id": TAG_ROW_TEST_IDS.droplistTagsWrapper }) }) }), children: _jsx("button", { type: 'button', className: styles.button, ref: buttonRef, "data-size": size, "data-test-id": TAG_ROW_TEST_IDS.moreButton, children: `${text}${items.length}` }) }));
|
|
10
10
|
}
|
|
@@ -42,13 +42,6 @@
|
|
|
42
42
|
border-width:var(--border-width-tag-more-single, 2px);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
.tagRowDroplistContainer{
|
|
46
|
-
padding-top:var(--radius-drop-list-container, 8px);
|
|
47
|
-
padding-bottom:var(--radius-drop-list-container, 8px);
|
|
48
|
-
border-radius:var(--radius-drop-list-container, 8px);
|
|
49
|
-
background-color:var(--sys-neutral-background2-level, #fdfdfd);
|
|
50
|
-
box-shadow:var(--box-shadow-elevation-level4, 0px 0px 8px 0px rgba(0, 0, 0, 0.0784313725), 0px 16px 16px 0px rgba(0, 0, 0, 0.0784313725));
|
|
51
|
-
}
|
|
52
45
|
.tagRowDroplistContainer[data-size=xs]{
|
|
53
46
|
padding-right:var(--radius-drop-list-container, 8px);
|
|
54
47
|
padding-left:var(--radius-drop-list-container, 8px);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { WithSupportProps } from '@snack-uikit/utils';
|
|
2
3
|
import { Size, TagRowItemInner } from '../../types';
|
|
3
4
|
type TagRowTruncatedProps = WithSupportProps<{
|
|
@@ -8,5 +9,6 @@ type TagRowTruncatedProps = WithSupportProps<{
|
|
|
8
9
|
className?: string;
|
|
9
10
|
onItemRemove?(item: string): void;
|
|
10
11
|
}>;
|
|
11
|
-
|
|
12
|
+
declare function TagRowTruncatedInner({ items, rowLimit, size, moreButtonLabel, className, onItemRemove, ...rest }: TagRowTruncatedProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const TagRowTruncated: import("react").MemoExoticComponent<typeof TagRowTruncatedInner>;
|
|
12
14
|
export {};
|
|
@@ -11,7 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import cn from 'classnames';
|
|
14
|
-
import { useEffect, useRef, useState } from 'react';
|
|
14
|
+
import { memo, useEffect, useRef, useState } from 'react';
|
|
15
15
|
import { extractSupportProps } from '@snack-uikit/utils';
|
|
16
16
|
import { TAG_ROW_TEST_IDS } from '../../components/TagRow/constants';
|
|
17
17
|
import { TagList } from '../TagList';
|
|
@@ -19,7 +19,7 @@ import { TagMore } from '../TagMore';
|
|
|
19
19
|
import { useResizeObserver } from './hooks';
|
|
20
20
|
import styles from './styles.module.css';
|
|
21
21
|
import { getGapWidth } from './utils';
|
|
22
|
-
|
|
22
|
+
function TagRowTruncatedInner(_a) {
|
|
23
23
|
var { items, rowLimit, size, moreButtonLabel = '', className, onItemRemove } = _a, rest = __rest(_a, ["items", "rowLimit", "size", "moreButtonLabel", "className", "onItemRemove"]);
|
|
24
24
|
const [visibleTags, setVisibleTags] = useState([]);
|
|
25
25
|
const [hiddenTags, setHiddenTags] = useState([]);
|
|
@@ -85,3 +85,4 @@ export function TagRowTruncated(_a) {
|
|
|
85
85
|
}, [items, rowLimit, maxWidth, onItemRemove, gapWidth, firstVisibleTagWidth]);
|
|
86
86
|
return (_jsxs("div", Object.assign({ className: cn(styles.wrapper, className) }, extractSupportProps(rest), { "data-size": size, children: [_jsx("div", { className: styles.hiddenRow, ref: hiddenRowElementRef, "data-size": size, children: _jsx(TagList, { items: items, size: size, onItemRemove: onItemRemove, setTagRef: setTagElement }) }), _jsx("div", { className: styles.hiddenMoreButton, ref: hiddenMoreButtonWrapperRef, children: _jsx(TagMore, { items: items, text: moreButtonLabel, size: size, buttonRef: hiddenMoreButtonRef }) }), _jsxs("div", { className: styles.visibleRow, "data-size": size, "data-test-id": TAG_ROW_TEST_IDS.visibleTagsWrapper, children: [_jsx(TagList, { items: visibleTags, size: size, onItemRemove: onItemRemove }), hiddenTags.length > 0 && (_jsx(TagMore, { items: hiddenTags, text: moreButtonLabel, size: size, onItemRemove: onItemRemove }))] })] })));
|
|
87
87
|
}
|
|
88
|
+
export const TagRowTruncated = memo(TagRowTruncatedInner);
|
package/dist/types.d.ts
CHANGED
|
@@ -4,9 +4,9 @@ export type Appearance = ValueOf<typeof APPEARANCE>;
|
|
|
4
4
|
export type Size = ValueOf<typeof SIZE>;
|
|
5
5
|
export type TagRowItem = {
|
|
6
6
|
label: string;
|
|
7
|
-
|
|
7
|
+
appearance?: Appearance;
|
|
8
8
|
};
|
|
9
9
|
export type TagRowItemInner = {
|
|
10
10
|
label: string;
|
|
11
|
-
|
|
11
|
+
appearance: Appearance;
|
|
12
12
|
};
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"title": "Tag",
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.7.1-preview-3f90b7f1.0",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"license": "Apache-2.0",
|
|
33
33
|
"scripts": {},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@snack-uikit/
|
|
36
|
-
"@snack-uikit/
|
|
35
|
+
"@snack-uikit/dropdown": "0.1.0",
|
|
36
|
+
"@snack-uikit/icons": "0.20.1-preview-3f90b7f1.0",
|
|
37
37
|
"@snack-uikit/scroll": "0.5.0",
|
|
38
38
|
"@snack-uikit/utils": "3.2.0",
|
|
39
39
|
"classnames": "2.3.2"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "80d28a192eeeb49f36eece4bec7e33e0fb788478"
|
|
42
42
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { memo, useMemo } from 'react';
|
|
2
|
+
|
|
1
3
|
import { WithSupportProps } from '@snack-uikit/utils';
|
|
2
4
|
|
|
3
5
|
import { SIZE } from '../../constants';
|
|
@@ -20,8 +22,8 @@ export type TagRowProps = WithSupportProps<{
|
|
|
20
22
|
onItemRemove?(item: string): void;
|
|
21
23
|
}>;
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
const coloredItems = items.map(mapTagRowItem);
|
|
25
|
+
function TagRowInner({ items, rowLimit, size = SIZE.Xs, ...props }: TagRowProps) {
|
|
26
|
+
const coloredItems = useMemo(() => items.map(mapTagRowItem), [items]);
|
|
25
27
|
|
|
26
28
|
if (rowLimit) {
|
|
27
29
|
return <TagRowTruncated items={coloredItems} rowLimit={rowLimit} size={size} {...props} />;
|
|
@@ -29,3 +31,5 @@ export function TagRow({ items, rowLimit, size = SIZE.Xs, ...props }: TagRowProp
|
|
|
29
31
|
|
|
30
32
|
return <TagRowSimple items={coloredItems} size={size} {...props} />;
|
|
31
33
|
}
|
|
34
|
+
|
|
35
|
+
export const TagRow = memo(TagRowInner);
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { APPEARANCE } from '../../constants';
|
|
2
2
|
import { TagRowItem, TagRowItemInner } from '../../types';
|
|
3
3
|
|
|
4
|
-
export const mapTagRowItem = ({ label,
|
|
5
|
-
if (
|
|
6
|
-
return {
|
|
7
|
-
label,
|
|
8
|
-
color,
|
|
9
|
-
};
|
|
4
|
+
export const mapTagRowItem = ({ label, appearance }: TagRowItem): TagRowItemInner => {
|
|
5
|
+
if (appearance) {
|
|
6
|
+
return { label, appearance };
|
|
10
7
|
}
|
|
11
8
|
|
|
12
9
|
return {
|
|
13
10
|
label,
|
|
14
|
-
|
|
11
|
+
appearance: APPEARANCE.Neutral,
|
|
15
12
|
};
|
|
16
13
|
};
|
|
@@ -19,7 +19,7 @@ function renderTag(size: Size, handleRemoveItem?: (item: TagRowItemInner) => OnD
|
|
|
19
19
|
return function TagRowItem(item: TagRowItemInner, index: number) {
|
|
20
20
|
return (
|
|
21
21
|
<div key={item.label} ref={setRef?.(item, index)}>
|
|
22
|
-
<Tag label={item.label} appearance={item.
|
|
22
|
+
<Tag label={item.label} appearance={item.appearance} size={size} onDelete={handleRemoveItem?.(item)} />
|
|
23
23
|
</div>
|
|
24
24
|
);
|
|
25
25
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Ref } from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { Dropdown } from '@snack-uikit/dropdown';
|
|
4
4
|
import { Scroll } from '@snack-uikit/scroll';
|
|
5
5
|
|
|
6
6
|
import { TAG_ROW_TEST_IDS } from '../../components/TagRow/constants';
|
|
@@ -19,11 +19,11 @@ type TagMoreProps = {
|
|
|
19
19
|
|
|
20
20
|
export function TagMore({ items, text = '', size = SIZE.Xs, buttonRef, onItemRemove }: TagMoreProps) {
|
|
21
21
|
return (
|
|
22
|
-
<
|
|
22
|
+
<Dropdown
|
|
23
23
|
placement='bottom-end'
|
|
24
24
|
trigger='hoverAndFocusVisible'
|
|
25
25
|
triggerClassName={styles.triggerClassName}
|
|
26
|
-
|
|
26
|
+
content={
|
|
27
27
|
<div className={styles.tagRowDroplistContainer} data-size={size}>
|
|
28
28
|
<Scroll className={styles.tagRowDroplistScroll} size='s' barHideStrategy='move' resize='none'>
|
|
29
29
|
<TagRowSimple
|
|
@@ -35,7 +35,6 @@ export function TagMore({ items, text = '', size = SIZE.Xs, buttonRef, onItemRem
|
|
|
35
35
|
</Scroll>
|
|
36
36
|
</div>
|
|
37
37
|
}
|
|
38
|
-
hasArrow={false}
|
|
39
38
|
>
|
|
40
39
|
<button
|
|
41
40
|
type='button'
|
|
@@ -44,6 +43,6 @@ export function TagMore({ items, text = '', size = SIZE.Xs, buttonRef, onItemRem
|
|
|
44
43
|
data-size={size}
|
|
45
44
|
data-test-id={TAG_ROW_TEST_IDS.moreButton}
|
|
46
45
|
>{`${text}${items.length}`}</button>
|
|
47
|
-
</
|
|
46
|
+
</Dropdown>
|
|
48
47
|
);
|
|
49
48
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
@import '@snack-uikit/figma-tokens/build/scss/components/styles-tokens-tag';
|
|
2
2
|
@import '@snack-uikit/figma-tokens/build/scss/components/styles-tokens-element';
|
|
3
|
-
@import '@snack-uikit/figma-tokens/build/scss/components/styles-tokens-dropList';
|
|
4
3
|
|
|
5
4
|
$sizes: 'xs', 's';
|
|
6
5
|
|
|
@@ -40,11 +39,6 @@ $label-typography: (
|
|
|
40
39
|
}
|
|
41
40
|
|
|
42
41
|
.tagRowDroplistContainer {
|
|
43
|
-
@include composite-var($drop-list-container);
|
|
44
|
-
|
|
45
|
-
background-color: $sys-neutral-background2-level;
|
|
46
|
-
box-shadow: $box-shadow-elevation-level4;
|
|
47
|
-
|
|
48
42
|
@each $size in $sizes {
|
|
49
43
|
&[data-size=#{$size}] {
|
|
50
44
|
@include composite-var($tag-list, $size);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import cn from 'classnames';
|
|
2
|
-
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { memo, useEffect, useRef, useState } from 'react';
|
|
3
3
|
|
|
4
4
|
import { extractSupportProps, WithSupportProps } from '@snack-uikit/utils';
|
|
5
5
|
|
|
@@ -20,7 +20,7 @@ type TagRowTruncatedProps = WithSupportProps<{
|
|
|
20
20
|
onItemRemove?(item: string): void;
|
|
21
21
|
}>;
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
function TagRowTruncatedInner({
|
|
24
24
|
items,
|
|
25
25
|
rowLimit,
|
|
26
26
|
size,
|
|
@@ -124,3 +124,5 @@ export function TagRowTruncated({
|
|
|
124
124
|
</div>
|
|
125
125
|
);
|
|
126
126
|
}
|
|
127
|
+
|
|
128
|
+
export const TagRowTruncated = memo(TagRowTruncatedInner);
|
package/src/types.ts
CHANGED
|
@@ -8,10 +8,10 @@ export type Size = ValueOf<typeof SIZE>;
|
|
|
8
8
|
|
|
9
9
|
export type TagRowItem = {
|
|
10
10
|
label: string;
|
|
11
|
-
|
|
11
|
+
appearance?: Appearance;
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
export type TagRowItemInner = {
|
|
15
15
|
label: string;
|
|
16
|
-
|
|
16
|
+
appearance: Appearance;
|
|
17
17
|
};
|