@snack-uikit/tag 0.4.10-preview-104ad22c.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.
Files changed (78) hide show
  1. package/CHANGELOG.md +256 -0
  2. package/LICENSE +201 -0
  3. package/README.md +31 -0
  4. package/dist/components/Tag/Tag.d.ts +20 -0
  5. package/dist/components/Tag/Tag.js +24 -0
  6. package/dist/components/Tag/constants.d.ts +4 -0
  7. package/dist/components/Tag/constants.js +5 -0
  8. package/dist/components/Tag/index.d.ts +1 -0
  9. package/dist/components/Tag/index.js +1 -0
  10. package/dist/components/Tag/styles.module.css +270 -0
  11. package/dist/components/TagRow/TagRow.d.ts +22 -0
  12. package/dist/components/TagRow/TagRow.js +25 -0
  13. package/dist/components/TagRow/constants.d.ts +5 -0
  14. package/dist/components/TagRow/constants.js +5 -0
  15. package/dist/components/TagRow/index.d.ts +1 -0
  16. package/dist/components/TagRow/index.js +1 -0
  17. package/dist/components/TagRow/utils.d.ts +2 -0
  18. package/dist/components/TagRow/utils.js +13 -0
  19. package/dist/components/index.d.ts +2 -0
  20. package/dist/components/index.js +2 -0
  21. package/dist/constants.d.ts +15 -0
  22. package/dist/constants.js +17 -0
  23. package/dist/helperComponents/TagList/TagList.d.ts +12 -0
  24. package/dist/helperComponents/TagList/TagList.js +12 -0
  25. package/dist/helperComponents/TagList/index.d.ts +1 -0
  26. package/dist/helperComponents/TagList/index.js +1 -0
  27. package/dist/helperComponents/TagMore/TagMore.d.ts +12 -0
  28. package/dist/helperComponents/TagMore/TagMore.js +10 -0
  29. package/dist/helperComponents/TagMore/index.d.ts +1 -0
  30. package/dist/helperComponents/TagMore/index.js +1 -0
  31. package/dist/helperComponents/TagMore/styles.module.css +69 -0
  32. package/dist/helperComponents/TagRowSimple/TagRowSimple.d.ts +12 -0
  33. package/dist/helperComponents/TagRowSimple/TagRowSimple.js +20 -0
  34. package/dist/helperComponents/TagRowSimple/index.d.ts +1 -0
  35. package/dist/helperComponents/TagRowSimple/index.js +1 -0
  36. package/dist/helperComponents/TagRowSimple/styles.module.css +10 -0
  37. package/dist/helperComponents/TagRowTruncated/TagRowTruncated.d.ts +13 -0
  38. package/dist/helperComponents/TagRowTruncated/TagRowTruncated.js +87 -0
  39. package/dist/helperComponents/TagRowTruncated/hooks.d.ts +3 -0
  40. package/dist/helperComponents/TagRowTruncated/hooks.js +17 -0
  41. package/dist/helperComponents/TagRowTruncated/index.d.ts +1 -0
  42. package/dist/helperComponents/TagRowTruncated/index.js +1 -0
  43. package/dist/helperComponents/TagRowTruncated/styles.module.css +47 -0
  44. package/dist/helperComponents/TagRowTruncated/utils.d.ts +2 -0
  45. package/dist/helperComponents/TagRowTruncated/utils.js +4 -0
  46. package/dist/helperComponents/index.d.ts +2 -0
  47. package/dist/helperComponents/index.js +2 -0
  48. package/dist/index.d.ts +1 -0
  49. package/dist/index.js +1 -0
  50. package/dist/types.d.ts +9 -0
  51. package/dist/types.js +1 -0
  52. package/package.json +42 -0
  53. package/src/components/Tag/Tag.tsx +55 -0
  54. package/src/components/Tag/constants.ts +6 -0
  55. package/src/components/Tag/index.ts +1 -0
  56. package/src/components/Tag/styles.module.scss +175 -0
  57. package/src/components/TagRow/TagRow.tsx +34 -0
  58. package/src/components/TagRow/constants.ts +5 -0
  59. package/src/components/TagRow/index.ts +1 -0
  60. package/src/components/TagRow/utils.ts +16 -0
  61. package/src/components/index.ts +2 -0
  62. package/src/constants.ts +16 -0
  63. package/src/helperComponents/TagList/TagList.tsx +32 -0
  64. package/src/helperComponents/TagList/index.ts +1 -0
  65. package/src/helperComponents/TagMore/TagMore.tsx +54 -0
  66. package/src/helperComponents/TagMore/index.ts +1 -0
  67. package/src/helperComponents/TagMore/styles.module.scss +61 -0
  68. package/src/helperComponents/TagRowSimple/TagRowSimple.tsx +25 -0
  69. package/src/helperComponents/TagRowSimple/index.ts +1 -0
  70. package/src/helperComponents/TagRowSimple/styles.module.scss +14 -0
  71. package/src/helperComponents/TagRowTruncated/TagRowTruncated.tsx +127 -0
  72. package/src/helperComponents/TagRowTruncated/hooks.ts +23 -0
  73. package/src/helperComponents/TagRowTruncated/index.ts +1 -0
  74. package/src/helperComponents/TagRowTruncated/styles.module.scss +57 -0
  75. package/src/helperComponents/TagRowTruncated/utils.ts +7 -0
  76. package/src/helperComponents/index.ts +2 -0
  77. package/src/index.ts +1 -0
  78. package/src/types.ts +11 -0
@@ -0,0 +1,270 @@
1
+ .tag{
2
+ display:inline-flex;
3
+ align-items:center;
4
+ box-sizing:border-box;
5
+ }
6
+ .tag .tagButton{
7
+ cursor:pointer;
8
+ position:relative;
9
+ box-sizing:border-box;
10
+ margin:0;
11
+ padding:0;
12
+ background:none;
13
+ border:none;
14
+ }
15
+ .tag .tagButton:focus{
16
+ outline-width:var(--border-state-focus-s-border-width, 2px);
17
+ outline-style:var(--border-state-focus-s-border-style, solid);
18
+ outline-color:var(--border-state-focus-s-border-color, );
19
+ outline-offset:calc(var(--border-state-focus-s-border-width, 2px) * -1);
20
+ }
21
+ .tag .tagButton:active{
22
+ outline:none;
23
+ }
24
+ .tag .icon{
25
+ position:absolute;
26
+ top:50%;
27
+ left:50%;
28
+ transform:translate(-50%, -50%);
29
+ }
30
+ .tag[data-size=xs]{
31
+ padding-left:var(--space-tag-xs-from-label, 8px);
32
+ padding-right:var(--space-tag-xs-from-label, 8px);
33
+ height:var(--size-tag-xs, 24px);
34
+ border-radius:var(--radius-tag-xs, 4px);
35
+ }
36
+ .tag[data-size=xs][data-removable=true]{
37
+ padding-left:var(--space-tag-xs-from-label, 8px);
38
+ padding-right:var(--space-tag-xs-from-button, 0px);
39
+ height:var(--size-tag-xs, 24px);
40
+ border-radius:var(--radius-tag-xs, 4px);
41
+ gap:var(--space-tag-xs-gap, 2px);
42
+ }
43
+ .tag[data-size=xs] .label{
44
+ font-family:var(--sans-label-s-font-family, SB Sans Interface);
45
+ font-weight:var(--sans-label-s-font-weight, Semibold);
46
+ line-height:var(--sans-label-s-line-height, 14px);
47
+ font-size:var(--sans-label-s-font-size, 11px);
48
+ letter-spacing:var(--sans-label-s-letter-spacing, -0.1px);
49
+ paragraph-spacing:var(--sans-label-s-paragraph-spacing, 6.05px);
50
+ }
51
+ .tag[data-size=xs] .tagButton{
52
+ border-radius:var(--radius-tag-xs, 4px);
53
+ height:var(--size-tag-xs, 24px);
54
+ width:var(--size-tag-xs, 24px);
55
+ }
56
+ .tag[data-size=s]{
57
+ padding-left:var(--space-tag-s-from-label, 16px);
58
+ padding-right:var(--space-tag-s-from-label, 16px);
59
+ height:var(--size-tag-s, 32px);
60
+ border-radius:var(--radius-tag-s, 8px);
61
+ }
62
+ .tag[data-size=s][data-removable=true]{
63
+ padding-left:var(--space-tag-s-from-label, 16px);
64
+ padding-right:var(--space-tag-s-from-button, 0px);
65
+ height:var(--size-tag-s, 32px);
66
+ border-radius:var(--radius-tag-s, 8px);
67
+ gap:var(--space-tag-s-gap, 2px);
68
+ }
69
+ .tag[data-size=s] .label{
70
+ font-family:var(--sans-label-m-font-family, SB Sans Interface);
71
+ font-weight:var(--sans-label-m-font-weight, Semibold);
72
+ line-height:var(--sans-label-m-line-height, 16px);
73
+ font-size:var(--sans-label-m-font-size, 12px);
74
+ letter-spacing:var(--sans-label-m-letter-spacing, -0.1px);
75
+ paragraph-spacing:var(--sans-label-m-paragraph-spacing, 6.6px);
76
+ }
77
+ .tag[data-size=s] .tagButton{
78
+ border-radius:var(--radius-tag-s, 8px);
79
+ height:var(--size-tag-s, 32px);
80
+ width:var(--size-tag-s, 32px);
81
+ }
82
+ .tag[data-appearance=neutral]{
83
+ background-color:var(--sys-neutral-decor-default, #dedede);
84
+ }
85
+ .tag[data-appearance=neutral][data-removable=false]{
86
+ background-color:var(--sys-neutral-decor-disabled, #e7e7e7);
87
+ }
88
+ .tag[data-appearance=neutral] .label{
89
+ color:var(--sys-neutral-text-support, #565656);
90
+ }
91
+ .tag[data-appearance=neutral] .tagButton{
92
+ color:var(--sys-neutral-text-light, #898989);
93
+ }
94
+ .tag[data-appearance=neutral] .tagButton:focus, .tag[data-appearance=neutral] .tagButton:hover, .tag[data-appearance=neutral] .tagButton:active{
95
+ color:var(--sys-neutral-text-main, #333333);
96
+ }
97
+ .tag[data-appearance=neutral] .tagButton:focus, .tag[data-appearance=neutral] .tagButton:hover{
98
+ background-color:var(--sys-neutral-decor-hovered, #d2d2d2);
99
+ }
100
+ .tag[data-appearance=neutral] .tagButton:active{
101
+ background-color:var(--sys-neutral-decor-activated, #b8b8b8);
102
+ }
103
+ .tag[data-appearance=primary]{
104
+ background-color:var(--sys-primary-decor-default, #ebdefd);
105
+ }
106
+ .tag[data-appearance=primary][data-removable=false]{
107
+ background-color:var(--sys-primary-decor-disabled, #f0e7fd);
108
+ }
109
+ .tag[data-appearance=primary] .label{
110
+ color:var(--sys-primary-text-support, #5b4796);
111
+ }
112
+ .tag[data-appearance=primary] .tagButton{
113
+ color:var(--sys-primary-text-light, #997adc);
114
+ }
115
+ .tag[data-appearance=primary] .tagButton:focus, .tag[data-appearance=primary] .tagButton:hover, .tag[data-appearance=primary] .tagButton:active{
116
+ color:var(--sys-primary-text-main, #382a62);
117
+ }
118
+ .tag[data-appearance=primary] .tagButton:focus, .tag[data-appearance=primary] .tagButton:hover{
119
+ background-color:var(--sys-primary-decor-hovered, #decdfb);
120
+ }
121
+ .tag[data-appearance=primary] .tagButton:active{
122
+ background-color:var(--sys-primary-decor-activated, #c5b2f1);
123
+ }
124
+ .tag[data-appearance=red]{
125
+ background-color:var(--sys-red-decor-default, #ffd8d0);
126
+ }
127
+ .tag[data-appearance=red][data-removable=false]{
128
+ background-color:var(--sys-red-decor-disabled, #fee4de);
129
+ }
130
+ .tag[data-appearance=red] .label{
131
+ color:var(--sys-red-text-support, #a93936);
132
+ }
133
+ .tag[data-appearance=red] .tagButton{
134
+ color:var(--sys-red-text-light, #ec7465);
135
+ }
136
+ .tag[data-appearance=red] .tagButton:focus, .tag[data-appearance=red] .tagButton:hover, .tag[data-appearance=red] .tagButton:active{
137
+ color:var(--sys-red-text-main, #621c1e);
138
+ }
139
+ .tag[data-appearance=red] .tagButton:focus, .tag[data-appearance=red] .tagButton:hover{
140
+ background-color:var(--sys-red-decor-hovered, #fcc4b6);
141
+ }
142
+ .tag[data-appearance=red] .tagButton:active{
143
+ background-color:var(--sys-red-decor-activated, #ffa491);
144
+ }
145
+ .tag[data-appearance=orange]{
146
+ background-color:var(--sys-orange-decor-default, #fedeaf);
147
+ }
148
+ .tag[data-appearance=orange][data-removable=false]{
149
+ background-color:var(--sys-orange-decor-disabled, #fde8c4);
150
+ }
151
+ .tag[data-appearance=orange] .label{
152
+ color:var(--sys-orange-text-support, #a2532f);
153
+ }
154
+ .tag[data-appearance=orange] .tagButton{
155
+ color:var(--sys-orange-text-light, #d98135);
156
+ }
157
+ .tag[data-appearance=orange] .tagButton:focus, .tag[data-appearance=orange] .tagButton:hover, .tag[data-appearance=orange] .tagButton:active{
158
+ color:var(--sys-orange-text-main, #572212);
159
+ }
160
+ .tag[data-appearance=orange] .tagButton:focus, .tag[data-appearance=orange] .tagButton:hover{
161
+ background-color:var(--sys-orange-decor-hovered, #f6ce98);
162
+ }
163
+ .tag[data-appearance=orange] .tagButton:active{
164
+ background-color:var(--sys-orange-decor-activated, #f6bd75);
165
+ }
166
+ .tag[data-appearance=yellow]{
167
+ background-color:var(--sys-yellow-decor-default, #f9e5ad);
168
+ }
169
+ .tag[data-appearance=yellow][data-removable=false]{
170
+ background-color:var(--sys-yellow-decor-disabled, #f7ecc0);
171
+ }
172
+ .tag[data-appearance=yellow] .label{
173
+ color:var(--sys-yellow-text-support, #80461b);
174
+ }
175
+ .tag[data-appearance=yellow] .tagButton{
176
+ color:var(--sys-yellow-text-light, #be7d3c);
177
+ }
178
+ .tag[data-appearance=yellow] .tagButton:focus, .tag[data-appearance=yellow] .tagButton:hover, .tag[data-appearance=yellow] .tagButton:active{
179
+ color:var(--sys-yellow-text-main, #54290f);
180
+ }
181
+ .tag[data-appearance=yellow] .tagButton:focus, .tag[data-appearance=yellow] .tagButton:hover{
182
+ background-color:var(--sys-yellow-decor-hovered, #f6d997);
183
+ }
184
+ .tag[data-appearance=yellow] .tagButton:active{
185
+ background-color:var(--sys-yellow-decor-activated, #f3cd81);
186
+ }
187
+ .tag[data-appearance=green]{
188
+ background-color:var(--sys-green-decor-default, #cdebe3);
189
+ }
190
+ .tag[data-appearance=green][data-removable=false]{
191
+ background-color:var(--sys-green-decor-disabled, #dbefe9);
192
+ }
193
+ .tag[data-appearance=green] .label{
194
+ color:var(--sys-green-text-support, #335747);
195
+ }
196
+ .tag[data-appearance=green] .tagButton{
197
+ color:var(--sys-green-text-light, #4d9e80);
198
+ }
199
+ .tag[data-appearance=green] .tagButton:focus, .tag[data-appearance=green] .tagButton:hover, .tag[data-appearance=green] .tagButton:active{
200
+ color:var(--sys-green-text-main, #1f392a);
201
+ }
202
+ .tag[data-appearance=green] .tagButton:focus, .tag[data-appearance=green] .tagButton:hover{
203
+ background-color:var(--sys-green-decor-hovered, #b6e1d5);
204
+ }
205
+ .tag[data-appearance=green] .tagButton:active{
206
+ background-color:var(--sys-green-decor-activated, #9fd7c4);
207
+ }
208
+ .tag[data-appearance=blue]{
209
+ background-color:var(--sys-blue-decor-default, #d5e7f6);
210
+ }
211
+ .tag[data-appearance=blue][data-removable=false]{
212
+ background-color:var(--sys-blue-decor-disabled, #e0eef8);
213
+ }
214
+ .tag[data-appearance=blue] .label{
215
+ color:var(--sys-blue-text-support, #4265ab);
216
+ }
217
+ .tag[data-appearance=blue] .tagButton{
218
+ color:var(--sys-blue-text-light, #6b9fe3);
219
+ }
220
+ .tag[data-appearance=blue] .tagButton:focus, .tag[data-appearance=blue] .tagButton:hover, .tag[data-appearance=blue] .tagButton:active{
221
+ color:var(--sys-blue-text-main, #1f3361);
222
+ }
223
+ .tag[data-appearance=blue] .tagButton:focus, .tag[data-appearance=blue] .tagButton:hover{
224
+ background-color:var(--sys-blue-decor-hovered, #c4ddf9);
225
+ }
226
+ .tag[data-appearance=blue] .tagButton:active{
227
+ background-color:var(--sys-blue-decor-activated, #abcdf4);
228
+ }
229
+ .tag[data-appearance=violet]{
230
+ background-color:var(--sys-violet-decor-default, #f8dffc);
231
+ }
232
+ .tag[data-appearance=violet][data-removable=false]{
233
+ background-color:var(--sys-violet-decor-disabled, #f8e8fb);
234
+ }
235
+ .tag[data-appearance=violet] .label{
236
+ color:var(--sys-violet-text-support, #864b8e);
237
+ }
238
+ .tag[data-appearance=violet] .tagButton{
239
+ color:var(--sys-violet-text-light, #c982d1);
240
+ }
241
+ .tag[data-appearance=violet] .tagButton:focus, .tag[data-appearance=violet] .tagButton:hover, .tag[data-appearance=violet] .tagButton:active{
242
+ color:var(--sys-violet-text-main, #51255f);
243
+ }
244
+ .tag[data-appearance=violet] .tagButton:focus, .tag[data-appearance=violet] .tagButton:hover{
245
+ background-color:var(--sys-violet-decor-hovered, #f2d3f8);
246
+ }
247
+ .tag[data-appearance=violet] .tagButton:active{
248
+ background-color:var(--sys-violet-decor-activated, #eabfee);
249
+ }
250
+ .tag[data-appearance=pink]{
251
+ background-color:var(--sys-pink-decor-default, #fddde7);
252
+ }
253
+ .tag[data-appearance=pink][data-removable=false]{
254
+ background-color:var(--sys-pink-decor-disabled, #fde8ee);
255
+ }
256
+ .tag[data-appearance=pink] .label{
257
+ color:var(--sys-pink-text-support, #a23f69);
258
+ }
259
+ .tag[data-appearance=pink] .tagButton{
260
+ color:var(--sys-pink-text-light, #e988ad);
261
+ }
262
+ .tag[data-appearance=pink] .tagButton:focus, .tag[data-appearance=pink] .tagButton:hover, .tag[data-appearance=pink] .tagButton:active{
263
+ color:var(--sys-pink-text-main, #5e1937);
264
+ }
265
+ .tag[data-appearance=pink] .tagButton:focus, .tag[data-appearance=pink] .tagButton:hover{
266
+ background-color:var(--sys-pink-decor-hovered, #fdd1de);
267
+ }
268
+ .tag[data-appearance=pink] .tagButton:active{
269
+ background-color:var(--sys-pink-decor-activated, #f7bcd0);
270
+ }
@@ -0,0 +1,22 @@
1
+ import { WithSupportProps } from '@snack-uikit/utils';
2
+ import { Appearance, Size } from '../../constants';
3
+ import { TagRowItem } from '../../types';
4
+ export type TagRowProps = WithSupportProps<{
5
+ /** Массив тэгов */
6
+ items: TagRowItem[];
7
+ /** Лимит количества рядов тэгов. При достижении лимита тэги скрываются под кнопкой. Отсутствие лимита или значение равное нулю отобразит весь список */
8
+ rowLimit?: number;
9
+ /** Размер */
10
+ size?: Size;
11
+ /** Текст кнопки, при наведении на которую отображается список скрытых тэгов */
12
+ moreButtonLabel?: string;
13
+ /** CSS-класс */
14
+ className?: string;
15
+ /** Коллбэк на клик по удалению тэга */
16
+ onItemRemove?(item: string): void;
17
+ }>;
18
+ export declare function TagRow({ items, rowLimit, size, ...props }: TagRowProps): import("react/jsx-runtime").JSX.Element;
19
+ export declare namespace TagRow {
20
+ var sizes: typeof Size;
21
+ var appearances: typeof Appearance;
22
+ }
@@ -0,0 +1,25 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { Appearance, Size } from '../../constants';
14
+ import { TagRowSimple, TagRowTruncated } from '../../helperComponents';
15
+ import { mapTagRowItem } from './utils';
16
+ export function TagRow(_a) {
17
+ var { items, rowLimit, size = Size.Xs } = _a, props = __rest(_a, ["items", "rowLimit", "size"]);
18
+ const coloredItems = items.map(mapTagRowItem);
19
+ if (rowLimit) {
20
+ return _jsx(TagRowTruncated, Object.assign({ items: coloredItems, rowLimit: rowLimit, size: size }, props));
21
+ }
22
+ return _jsx(TagRowSimple, Object.assign({ items: coloredItems, size: size }, props));
23
+ }
24
+ TagRow.sizes = Size;
25
+ TagRow.appearances = Appearance;
@@ -0,0 +1,5 @@
1
+ export declare const TAG_ROW_TEST_IDS: {
2
+ moreButton: string;
3
+ visibleTagsWrapper: string;
4
+ droplistTagsWrapper: string;
5
+ };
@@ -0,0 +1,5 @@
1
+ export const TAG_ROW_TEST_IDS = {
2
+ moreButton: 'tag-row__more-button',
3
+ visibleTagsWrapper: 'tag-row__visible-row',
4
+ droplistTagsWrapper: 'tag-row__droplist-contents',
5
+ };
@@ -0,0 +1 @@
1
+ export * from './TagRow';
@@ -0,0 +1 @@
1
+ export * from './TagRow';
@@ -0,0 +1,2 @@
1
+ import { TagRowItem, TagRowItemInner } from '../../types';
2
+ export declare const mapTagRowItem: ({ label, color }: TagRowItem) => TagRowItemInner;
@@ -0,0 +1,13 @@
1
+ import { Appearance } from '../../constants';
2
+ export const mapTagRowItem = ({ label, color }) => {
3
+ if (color) {
4
+ return {
5
+ label,
6
+ color,
7
+ };
8
+ }
9
+ return {
10
+ label,
11
+ color: Appearance.Neutral,
12
+ };
13
+ };
@@ -0,0 +1,2 @@
1
+ export * from './Tag';
2
+ export * from './TagRow';
@@ -0,0 +1,2 @@
1
+ export * from './Tag';
2
+ export * from './TagRow';
@@ -0,0 +1,15 @@
1
+ export declare enum Appearance {
2
+ Neutral = "neutral",
3
+ Primary = "primary",
4
+ Red = "red",
5
+ Orange = "orange",
6
+ Yellow = "yellow",
7
+ Green = "green",
8
+ Blue = "blue",
9
+ Violet = "violet",
10
+ Pink = "pink"
11
+ }
12
+ export declare enum Size {
13
+ Xs = "xs",
14
+ S = "s"
15
+ }
@@ -0,0 +1,17 @@
1
+ export var Appearance;
2
+ (function (Appearance) {
3
+ Appearance["Neutral"] = "neutral";
4
+ Appearance["Primary"] = "primary";
5
+ Appearance["Red"] = "red";
6
+ Appearance["Orange"] = "orange";
7
+ Appearance["Yellow"] = "yellow";
8
+ Appearance["Green"] = "green";
9
+ Appearance["Blue"] = "blue";
10
+ Appearance["Violet"] = "violet";
11
+ Appearance["Pink"] = "pink";
12
+ })(Appearance || (Appearance = {}));
13
+ export var Size;
14
+ (function (Size) {
15
+ Size["Xs"] = "xs";
16
+ Size["S"] = "s";
17
+ })(Size || (Size = {}));
@@ -0,0 +1,12 @@
1
+ import { Ref } from 'react';
2
+ import { Size } from '../../constants';
3
+ import { TagRowItemInner } from '../../types';
4
+ type SetTagRef = (item: TagRowItemInner, index: number) => Ref<HTMLDivElement>;
5
+ type TagListProps = {
6
+ items: TagRowItemInner[];
7
+ size?: Size;
8
+ onItemRemove?(item: string): void;
9
+ setTagRef?: SetTagRef;
10
+ };
11
+ export declare function TagList({ items, size, onItemRemove, setTagRef }: TagListProps): import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Tag } from '../../components';
3
+ import { Size } from '../../constants';
4
+ function renderTag(size, handleRemoveItem, setRef) {
5
+ return function TagRowItem(item, index) {
6
+ return (_jsx("div", Object.assign({ ref: setRef === null || setRef === void 0 ? void 0 : setRef(item, index) }, { children: _jsx(Tag, { label: item.label, appearance: item.color, size: size, onDelete: handleRemoveItem === null || handleRemoveItem === void 0 ? void 0 : handleRemoveItem(item) }) }), item.label));
7
+ };
8
+ }
9
+ export function TagList({ items, size = Size.Xs, onItemRemove, setTagRef }) {
10
+ const handleRemoveItem = onItemRemove ? (item) => () => onItemRemove(item.label) : undefined;
11
+ return _jsx(_Fragment, { children: items.map(renderTag(size, handleRemoveItem, setTagRef)) });
12
+ }
@@ -0,0 +1 @@
1
+ export * from './TagList';
@@ -0,0 +1 @@
1
+ export * from './TagList';
@@ -0,0 +1,12 @@
1
+ import { Ref } from 'react';
2
+ import { Size } from '../../constants';
3
+ import { TagRowItemInner } from '../../types';
4
+ type TagMoreProps = {
5
+ items: TagRowItemInner[];
6
+ size: Size;
7
+ text?: string;
8
+ buttonRef?: Ref<HTMLButtonElement>;
9
+ onItemRemove?(item: string): void;
10
+ };
11
+ export declare function TagMore({ items, text, size, buttonRef, onItemRemove }: TagMoreProps): import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { PopoverPrivate } from '@snack-uikit/popover-private';
3
+ import { Scroll } from '@snack-uikit/scroll';
4
+ import { TAG_ROW_TEST_IDS } from '../../components/TagRow/constants';
5
+ import { Size } from '../../constants';
6
+ import { TagRowSimple } from '../TagRowSimple';
7
+ import styles from './styles.module.css';
8
+ export function TagMore({ items, text = '', size = Size.Xs, buttonRef, onItemRemove }) {
9
+ return (_jsx(PopoverPrivate, Object.assign({ placement: PopoverPrivate.placements.BottomEnd, trigger: PopoverPrivate.triggers.HoverAndFocusVisible, triggerClassName: styles.triggerClassName, popoverContent: _jsx("div", Object.assign({ className: styles.tagRowDroplistContainer, "data-size": size }, { children: _jsx(Scroll, Object.assign({ className: styles.tagRowDroplistScroll, size: Scroll.sizes.S, barHideStrategy: Scroll.barHideStrategies.Move, resize: Scroll.resizes.None }, { children: _jsx(TagRowSimple, { items: items, size: size, onItemRemove: onItemRemove, "data-test-id": TAG_ROW_TEST_IDS.droplistTagsWrapper }) })) })), hasArrow: false }, { children: _jsx("button", Object.assign({ type: 'button', className: styles.button, ref: buttonRef, "data-size": size, "data-test-id": TAG_ROW_TEST_IDS.moreButton }, { children: `${text}${items.length}` })) })));
10
+ }
@@ -0,0 +1 @@
1
+ export * from './TagMore';
@@ -0,0 +1 @@
1
+ export * from './TagMore';
@@ -0,0 +1,69 @@
1
+ .button{
2
+ cursor:pointer;
3
+ display:inline-flex;
4
+ align-items:center;
5
+ box-sizing:border-box;
6
+ color:var(--sys-neutral-text-support, #565656);
7
+ white-space:nowrap;
8
+ background:none;
9
+ border-color:var(--sys-neutral-decor-disabled, #e7e7e7);
10
+ border-style:solid;
11
+ font-family:var(--sans-label-s-font-family, SB Sans Interface);
12
+ font-weight:var(--sans-label-s-font-weight, Semibold);
13
+ line-height:var(--sans-label-s-line-height, 14px);
14
+ font-size:var(--sans-label-s-font-size, 11px);
15
+ letter-spacing:var(--sans-label-s-letter-spacing, -0.1px);
16
+ paragraph-spacing:var(--sans-label-s-paragraph-spacing, 6.05px);
17
+ font-family:var(--sans-label-m-font-family, SB Sans Interface);
18
+ font-weight:var(--sans-label-m-font-weight, Semibold);
19
+ line-height:var(--sans-label-m-line-height, 16px);
20
+ font-size:var(--sans-label-m-font-size, 12px);
21
+ letter-spacing:var(--sans-label-m-letter-spacing, -0.1px);
22
+ paragraph-spacing:var(--sans-label-m-paragraph-spacing, 6.6px);
23
+ }
24
+ .button:focus-visible{
25
+ outline-width:var(--border-state-focus-s-border-width, 2px);
26
+ outline-style:var(--border-state-focus-s-border-style, solid);
27
+ outline-color:var(--border-state-focus-s-border-color, );
28
+ outline-color:var(--sys-available-complementary, #131313);
29
+ }
30
+ .button[data-size=xs]{
31
+ padding-left:var(--space-tag-more-xs-from-label, 4px);
32
+ padding-right:var(--space-tag-more-xs-from-label, 4px);
33
+ height:var(--size-tag-xs, 24px);
34
+ border-radius:var(--radius-tag-xs, 4px);
35
+ border-width:var(--border-width-tag-more-single, 2px);
36
+ }
37
+ .button[data-size=s]{
38
+ padding-left:var(--space-tag-more-s-from-label, 8px);
39
+ padding-right:var(--space-tag-more-s-from-label, 8px);
40
+ height:var(--size-tag-s, 32px);
41
+ border-radius:var(--radius-tag-s, 8px);
42
+ border-width:var(--border-width-tag-more-single, 2px);
43
+ }
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
+ .tagRowDroplistContainer[data-size=xs]{
53
+ padding-right:var(--radius-drop-list-container, 8px);
54
+ padding-left:var(--radius-drop-list-container, 8px);
55
+ max-width:var(--size-tag-list-max-width-xs, 256px);
56
+ }
57
+ .tagRowDroplistContainer[data-size=s]{
58
+ padding-right:var(--radius-drop-list-container, 8px);
59
+ padding-left:var(--radius-drop-list-container, 8px);
60
+ max-width:var(--size-tag-list-max-width-s, 280px);
61
+ }
62
+
63
+ .tagRowDroplistScroll{
64
+ max-height:200px;
65
+ }
66
+
67
+ .triggerClassName{
68
+ --offset:var(--space-drop-list-drop-offset, 4px);
69
+ }
@@ -0,0 +1,12 @@
1
+ import { Ref } from 'react';
2
+ import { Size } from '../../constants';
3
+ import { TagRowItemInner } from '../../types';
4
+ type TagRowSimpleProps = {
5
+ items: TagRowItemInner[];
6
+ size: Size;
7
+ onItemRemove?(item: string): void;
8
+ setTagRef?(item: TagRowItemInner): Ref<HTMLDivElement>;
9
+ className?: string;
10
+ };
11
+ export declare function TagRowSimple({ items, size, onItemRemove, setTagRef, className, ...rest }: TagRowSimpleProps): import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,20 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import cn from 'classnames';
14
+ import { extractSupportProps } from '@snack-uikit/utils';
15
+ import { TagList } from '../TagList';
16
+ import styles from './styles.module.css';
17
+ export function TagRowSimple(_a) {
18
+ var { items, size, onItemRemove, setTagRef, className } = _a, rest = __rest(_a, ["items", "size", "onItemRemove", "setTagRef", "className"]);
19
+ return (_jsx("div", Object.assign({ className: cn(styles.tagRowSimpleWrapper, className) }, extractSupportProps(rest), { "data-size": size }, { children: _jsx(TagList, { items: items, size: size, onItemRemove: onItemRemove, setTagRef: setTagRef }) })));
20
+ }
@@ -0,0 +1 @@
1
+ export * from './TagRowSimple';
@@ -0,0 +1 @@
1
+ export * from './TagRowSimple';
@@ -0,0 +1,10 @@
1
+ .tagRowSimpleWrapper{
2
+ display:flex;
3
+ flex-wrap:wrap;
4
+ }
5
+ .tagRowSimpleWrapper[data-size=xs]{
6
+ gap:var(--space-tag-row-xs-gap, 2px);
7
+ }
8
+ .tagRowSimpleWrapper[data-size=s]{
9
+ gap:var(--space-tag-row-s-gap, 2px);
10
+ }
@@ -0,0 +1,13 @@
1
+ import { WithSupportProps } from '@snack-uikit/utils';
2
+ import { Size } from '../../constants';
3
+ import { TagRowItemInner } from '../../types';
4
+ type TagRowTruncatedProps = WithSupportProps<{
5
+ items: TagRowItemInner[];
6
+ rowLimit: number;
7
+ moreButtonLabel?: string;
8
+ size: Size;
9
+ className?: string;
10
+ onItemRemove?(item: string): void;
11
+ }>;
12
+ export declare function TagRowTruncated({ items, rowLimit, size, moreButtonLabel, className, onItemRemove, ...rest }: TagRowTruncatedProps): import("react/jsx-runtime").JSX.Element;
13
+ export {};