@snack-uikit/tag 0.7.5 → 0.8.1-preview-3bc93fc3.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,17 @@
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.8.0 (2024-02-23)
7
+
8
+
9
+ ### Features
10
+
11
+ * **FF-4221:** add tabIndex prop ([e087f40](https://github.com/cloud-ru-tech/snack-uikit/commit/e087f401caefb2731e9e7fa6a03e4599d337cfb1))
12
+
13
+
14
+
15
+
16
+
6
17
  ## 0.7.5 (2024-02-22)
7
18
 
8
19
  ### Only dependencies have been changed
package/README.md CHANGED
@@ -16,6 +16,7 @@
16
16
  | appearance | enum Appearance: `"neutral"`, `"primary"`, `"red"`, `"orange"`, `"yellow"`, `"green"`, `"blue"`, `"violet"`, `"pink"` | neutral | Внешний вид |
17
17
  | onDelete | `MouseEventHandler<HTMLButtonElement>` | - | Коллбэк на удаление |
18
18
  | className | `string` | - | CSS-класс |
19
+ | tabIndex | `number` | - | tabIndex кнопки удаления |
19
20
  ## TagRow
20
21
  ### Props
21
22
  | name | type | default value | description |
@@ -13,6 +13,8 @@ export type TagProps = WithSupportProps<{
13
13
  onDelete?: MouseEventHandler<HTMLButtonElement>;
14
14
  /** CSS-класс */
15
15
  className?: string;
16
+ /** tabIndex кнопки удаления */
17
+ tabIndex?: number;
16
18
  }>;
17
- export declare function Tag({ label, size, appearance, onDelete, className, ...rest }: TagProps): import("react/jsx-runtime").JSX.Element;
19
+ export declare function Tag({ label, size, appearance, onDelete, className, tabIndex, ...rest }: TagProps): import("react/jsx-runtime").JSX.Element;
18
20
  export { APPEARANCE };
@@ -17,7 +17,7 @@ import { APPEARANCE, SIZE } from '../../constants';
17
17
  import { ICON_SIZE } from './constants';
18
18
  import styles from './styles.module.css';
19
19
  export function Tag(_a) {
20
- var { label, size = SIZE.Xs, appearance = APPEARANCE.Neutral, onDelete, className } = _a, rest = __rest(_a, ["label", "size", "appearance", "onDelete", "className"]);
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 })) }))] })));
20
+ var { label, size = SIZE.Xs, appearance = APPEARANCE.Neutral, onDelete, className, tabIndex } = _a, rest = __rest(_a, ["label", "size", "appearance", "onDelete", "className", "tabIndex"]);
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', tabIndex: tabIndex, 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
23
  export { APPEARANCE };
@@ -82,9 +82,6 @@
82
82
  .tag[data-appearance=neutral]{
83
83
  background-color:var(--sys-neutral-decor-default, #dfe2ec);
84
84
  }
85
- .tag[data-appearance=neutral][data-removable=false]{
86
- background-color:var(--sys-neutral-decor-disabled, #e8eaf1);
87
- }
88
85
  .tag[data-appearance=neutral] .label{
89
86
  color:var(--sys-neutral-text-support, #656771);
90
87
  }
@@ -103,9 +100,6 @@
103
100
  .tag[data-appearance=primary]{
104
101
  background-color:var(--sys-primary-decor-default, #ebdefd);
105
102
  }
106
- .tag[data-appearance=primary][data-removable=false]{
107
- background-color:var(--sys-primary-decor-disabled, #f0e7fd);
108
- }
109
103
  .tag[data-appearance=primary] .label{
110
104
  color:var(--sys-primary-text-support, #5b4796);
111
105
  }
@@ -124,9 +118,6 @@
124
118
  .tag[data-appearance=red]{
125
119
  background-color:var(--sys-red-decor-default, #fdd6cd);
126
120
  }
127
- .tag[data-appearance=red][data-removable=false]{
128
- background-color:var(--sys-red-decor-disabled, #fce2dc);
129
- }
130
121
  .tag[data-appearance=red] .label{
131
122
  color:var(--sys-red-text-support, #ab423e);
132
123
  }
@@ -145,9 +136,6 @@
145
136
  .tag[data-appearance=orange]{
146
137
  background-color:var(--sys-orange-decor-default, #fed8b8);
147
138
  }
148
- .tag[data-appearance=orange][data-removable=false]{
149
- background-color:var(--sys-orange-decor-disabled, #ffe4c8);
150
- }
151
139
  .tag[data-appearance=orange] .label{
152
140
  color:var(--sys-orange-text-support, #c06735);
153
141
  }
@@ -166,9 +154,6 @@
166
154
  .tag[data-appearance=yellow]{
167
155
  background-color:var(--sys-yellow-decor-default, #f0dfb1);
168
156
  }
169
- .tag[data-appearance=yellow][data-removable=false]{
170
- background-color:var(--sys-yellow-decor-disabled, #f7ebc7);
171
- }
172
157
  .tag[data-appearance=yellow] .label{
173
158
  color:var(--sys-yellow-text-support, #a57b0e);
174
159
  }
@@ -187,9 +172,6 @@
187
172
  .tag[data-appearance=green]{
188
173
  background-color:var(--sys-green-decor-default, #d2ead0);
189
174
  }
190
- .tag[data-appearance=green][data-removable=false]{
191
- background-color:var(--sys-green-decor-disabled, #e0f0de);
192
- }
193
175
  .tag[data-appearance=green] .label{
194
176
  color:var(--sys-green-text-support, #568a56);
195
177
  }
@@ -208,9 +190,6 @@
208
190
  .tag[data-appearance=blue]{
209
191
  background-color:var(--sys-blue-decor-default, #d6e2f4);
210
192
  }
211
- .tag[data-appearance=blue][data-removable=false]{
212
- background-color:var(--sys-blue-decor-disabled, #e3edfa);
213
- }
214
193
  .tag[data-appearance=blue] .label{
215
194
  color:var(--sys-blue-text-support, #4975a9);
216
195
  }
@@ -229,9 +208,6 @@
229
208
  .tag[data-appearance=violet]{
230
209
  background-color:var(--sys-violet-decor-default, #efd9ef);
231
210
  }
232
- .tag[data-appearance=violet][data-removable=false]{
233
- background-color:var(--sys-violet-decor-disabled, #f8e6f7);
234
- }
235
211
  .tag[data-appearance=violet] .label{
236
212
  color:var(--sys-violet-text-support, #8c5d93);
237
213
  }
@@ -250,9 +226,6 @@
250
226
  .tag[data-appearance=pink]{
251
227
  background-color:var(--sys-pink-decor-default, #f5d9e1);
252
228
  }
253
- .tag[data-appearance=pink][data-removable=false]{
254
- background-color:var(--sys-pink-decor-disabled, #fbe6ec);
255
- }
256
229
  .tag[data-appearance=pink] .label{
257
230
  color:var(--sys-pink-text-support, #aa597d);
258
231
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "title": "Tag",
7
- "version": "0.7.5",
7
+ "version": "0.8.1-preview-3bc93fc3.0",
8
8
  "sideEffects": [
9
9
  "*.css",
10
10
  "*.woff",
@@ -38,5 +38,5 @@
38
38
  "@snack-uikit/utils": "3.2.0",
39
39
  "classnames": "2.3.2"
40
40
  },
41
- "gitHead": "6aa9d988eebb76712315def67343b8b2e4cd268c"
41
+ "gitHead": "a2fa7717157c8a23fa1fc6b64c67c7b2d9dfc39c"
42
42
  }
@@ -20,6 +20,8 @@ export type TagProps = WithSupportProps<{
20
20
  onDelete?: MouseEventHandler<HTMLButtonElement>;
21
21
  /** CSS-класс */
22
22
  className?: string;
23
+ /** tabIndex кнопки удаления */
24
+ tabIndex?: number;
23
25
  }>;
24
26
 
25
27
  export function Tag({
@@ -28,6 +30,7 @@ export function Tag({
28
30
  appearance = APPEARANCE.Neutral,
29
31
  onDelete,
30
32
  className,
33
+ tabIndex,
31
34
  ...rest
32
35
  }: TagProps) {
33
36
  return (
@@ -40,7 +43,13 @@ export function Tag({
40
43
  >
41
44
  <span className={styles.label}>{label}</span>
42
45
  {onDelete && (
43
- <button type='button' className={styles.tagButton} onClick={onDelete} data-test-id='tag-remove-button'>
46
+ <button
47
+ type='button'
48
+ className={styles.tagButton}
49
+ onClick={onDelete}
50
+ data-test-id='tag-remove-button'
51
+ tabIndex={tabIndex}
52
+ >
44
53
  {size === SIZE.Xs ? (
45
54
  <CrossSVG size={ICON_SIZE[size]} className={styles.icon} />
46
55
  ) : (
@@ -4,7 +4,7 @@
4
4
  $sizes: 'xs', 's';
5
5
  $label-typography: (
6
6
  'xs': $sans-label-s,
7
- 's': $sans-label-m
7
+ 's': $sans-label-m,
8
8
  );
9
9
  $appearances: (
10
10
  'neutral': (
@@ -124,10 +124,10 @@ $appearances: (
124
124
  }
125
125
 
126
126
  @each $size in $sizes {
127
- &[data-size=#{$size}] {
127
+ &[data-size='#{$size}'] {
128
128
  @include composite-var($tag, 'container', $size, 'label-only');
129
129
 
130
- &[data-removable="true"] {
130
+ &[data-removable='true'] {
131
131
  @include composite-var($tag, 'container', $size, 'button-after');
132
132
  }
133
133
 
@@ -142,13 +142,9 @@ $appearances: (
142
142
  }
143
143
 
144
144
  @each $appearanceKey, $appearance in $appearances {
145
- &[data-appearance=#{$appearanceKey}] {
145
+ &[data-appearance='#{$appearanceKey}'] {
146
146
  background-color: simple-var($appearance, 'container');
147
147
 
148
- &[data-removable="false"] {
149
- background-color: simple-var($appearance, 'container-disabled');
150
- }
151
-
152
148
  .label {
153
149
  color: simple-var($appearance, 'label');
154
150
  }
@@ -156,11 +152,14 @@ $appearances: (
156
152
  .tagButton {
157
153
  color: simple-var($appearance, 'icon');
158
154
 
159
- &:focus, &:hover, &:active {
155
+ &:focus,
156
+ &:hover,
157
+ &:active {
160
158
  color: simple-var($appearance, 'icon-active');
161
159
  }
162
160
 
163
- &:focus, &:hover {
161
+ &:focus,
162
+ &:hover {
164
163
  background-color: simple-var($appearance, 'button-hovered');
165
164
  }
166
165