@snack-uikit/tag 0.7.5 → 0.8.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 };
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.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": "ee199e2cdca1d24db821533512263dfe06365159"
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
  ) : (