@snack-uikit/breadcrumbs 0.10.14 → 0.10.16-preview-a3bb0dea.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.10.15 (2024-12-26)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **FF-5734:** eslint fixes ([5ce6f1f](https://github.com/cloud-ru-tech/snack-uikit/commit/5ce6f1f22d3ac3dd367cbdd184e5873e67837c8b))
12
+
13
+
14
+
15
+
16
+
6
17
  ## 0.10.14 (2024-12-25)
7
18
 
8
19
  ### Only dependencies have been changed
@@ -68,18 +68,21 @@ exports.Breadcrumbs = (0, react_1.memo)(function Breadcrumbs(_a) {
68
68
  currentConfig: currentConfig.chain
69
69
  }, index);
70
70
  case constants_1.ELEMENT_TYPE.Item:
71
- const {
72
- renderMode,
73
- id
74
- } = block.item;
75
- if (renderMode !== constants_1.ITEM_RENDER_MODE.Collapsed) {
76
- return (0, jsx_runtime_1.jsx)(Crumb_1.Crumb, {
77
- useIconOnly: !index && firstItemIconOnly,
78
- current: isLastElement,
79
- renderMode: renderMode,
80
- minWidth: block.width,
81
- item: block.item
82
- }, id);
71
+ {
72
+ const {
73
+ renderMode,
74
+ id
75
+ } = block.item;
76
+ if (renderMode !== constants_1.ITEM_RENDER_MODE.Collapsed) {
77
+ return (0, jsx_runtime_1.jsx)(Crumb_1.Crumb, {
78
+ useIconOnly: !index && firstItemIconOnly,
79
+ current: isLastElement,
80
+ renderMode: renderMode,
81
+ minWidth: block.width,
82
+ item: block.item
83
+ }, id);
84
+ }
85
+ break;
83
86
  }
84
87
  default:
85
88
  return null;
@@ -32,10 +32,18 @@ function Collapse(_ref) {
32
32
  const collapsedItems = currentConfig.filter(node => node.element === constants_1.ELEMENT_TYPE.Item && node.item.renderMode === constants_1.ITEM_RENDER_MODE.Collapsed).map(
33
33
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
34
34
  // @ts-ignore
35
- node => ({
35
+ node => Object.assign({
36
36
  content: {
37
37
  option: node.item.label
38
- },
38
+ }
39
+ }, node.item.href ? {
40
+ itemWrapRender: crumb => (0, jsx_runtime_1.jsx)("a", {
41
+ href: node.item.href,
42
+ onClick: node.item.onClick,
43
+ className: styles_module_scss_1.default.a,
44
+ children: crumb
45
+ })
46
+ } : {
39
47
  onClick: node.item.onClick
40
48
  }));
41
49
  return (0, jsx_runtime_1.jsx)("div", {
@@ -15,4 +15,8 @@
15
15
 
16
16
  .collapsedRow{
17
17
  display:flex;
18
+ }
19
+
20
+ .a{
21
+ text-decoration:none;
18
22
  }
@@ -35,11 +35,13 @@ export const Breadcrumbs = memo(function Breadcrumbs(_a) {
35
35
  return _jsx(Separator, {}, index);
36
36
  case ELEMENT_TYPE.Collapse:
37
37
  return _jsx(Collapse, { currentConfig: currentConfig.chain }, index);
38
- case ELEMENT_TYPE.Item:
38
+ case ELEMENT_TYPE.Item: {
39
39
  const { renderMode, id } = block.item;
40
40
  if (renderMode !== ITEM_RENDER_MODE.Collapsed) {
41
41
  return (_jsx(Crumb, { useIconOnly: !index && firstItemIconOnly, current: isLastElement, renderMode: renderMode, minWidth: block.width, item: block.item }, id));
42
42
  }
43
+ break;
44
+ }
43
45
  default:
44
46
  return null;
45
47
  }
@@ -15,9 +15,12 @@ export function Collapse({ currentConfig, className }) {
15
15
  .map(
16
16
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
17
17
  // @ts-ignore
18
- (node) => ({
19
- content: { option: node.item.label },
20
- onClick: node.item.onClick,
21
- }));
18
+ (node) => (Object.assign({ content: { option: node.item.label } }, (node.item.href
19
+ ? {
20
+ itemWrapRender: crumb => (_jsx("a", { href: node.item.href, onClick: node.item.onClick, className: styles.a, children: crumb })),
21
+ }
22
+ : {
23
+ onClick: node.item.onClick,
24
+ }))));
22
25
  return (_jsx("div", { className: className, "data-test-id": getTestId('collapse', testId), "data-element-type": ELEMENT_TYPE.Collapse, children: _jsx(BreadcrumbsContext.Provider, { value: Object.assign(Object.assign({}, ctx), { testId: `${testId}-collapsed` }), children: _jsx(Droplist, { trigger: 'hoverAndFocusVisible', size: 's', scroll: true, triggerElemRef: buttonRef, items: collapsedItems, children: _jsx("button", { type: 'button', ref: buttonRef, className: styles.collapse, tabIndex: hidden ? -1 : 0, children: _jsx(CrumbsTypography, { size: size, children: "..." }) }) }) }) }));
23
26
  }
@@ -15,4 +15,8 @@
15
15
 
16
16
  .collapsedRow{
17
17
  display:flex;
18
+ }
19
+
20
+ .a{
21
+ text-decoration:none;
18
22
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "title": "Breadcrumbs",
7
- "version": "0.10.14",
7
+ "version": "0.10.16-preview-a3bb0dea.0",
8
8
  "sideEffects": [
9
9
  "*.css",
10
10
  "*.woff",
@@ -36,11 +36,11 @@
36
36
  "license": "Apache-2.0",
37
37
  "scripts": {},
38
38
  "dependencies": {
39
- "@snack-uikit/list": "0.22.1",
39
+ "@snack-uikit/list": "0.22.2",
40
40
  "@snack-uikit/typography": "0.8.3",
41
41
  "@snack-uikit/utils": "3.6.0",
42
42
  "classnames": "2.5.1",
43
43
  "lodash.debounce": "4.0.8"
44
44
  },
45
- "gitHead": "5f981cd3d7c5169db2bff1d58db36b6c83da6861"
45
+ "gitHead": "8b0b9ad383b7999c2cc9ef43e8d12e3f67df7010"
46
46
  }
@@ -86,7 +86,7 @@ export const Breadcrumbs = memo(function Breadcrumbs({
86
86
  return <Separator key={index} />;
87
87
  case ELEMENT_TYPE.Collapse:
88
88
  return <Collapse key={index} currentConfig={currentConfig.chain} />;
89
- case ELEMENT_TYPE.Item:
89
+ case ELEMENT_TYPE.Item: {
90
90
  const { renderMode, id } = block.item;
91
91
  if (renderMode !== ITEM_RENDER_MODE.Collapsed) {
92
92
  return (
@@ -100,6 +100,8 @@ export const Breadcrumbs = memo(function Breadcrumbs({
100
100
  />
101
101
  );
102
102
  }
103
+ break;
104
+ }
103
105
  default:
104
106
  return null;
105
107
  }
@@ -1,6 +1,6 @@
1
1
  import { useContext, useRef } from 'react';
2
2
 
3
- import { Droplist } from '@snack-uikit/list';
3
+ import { Droplist, DroplistProps } from '@snack-uikit/list';
4
4
 
5
5
  import { ELEMENT_TYPE, ITEM_RENDER_MODE } from '../../constants';
6
6
  import { BreadcrumbsContext } from '../../context';
@@ -19,14 +19,24 @@ export function Collapse({ currentConfig, className }: CollapseProps) {
19
19
  const { hidden, size, testId } = ctx;
20
20
  const buttonRef = useRef(null);
21
21
 
22
- const collapsedItems = currentConfig
22
+ const collapsedItems: DroplistProps['items'] = currentConfig
23
23
  .filter(node => node.element === ELEMENT_TYPE.Item && node.item.renderMode === ITEM_RENDER_MODE.Collapsed)
24
24
  .map(
25
25
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
26
26
  // @ts-ignore
27
27
  (node: { element: typeof ELEMENT_TYPE.Item; width: number; item: InnerItem }) => ({
28
28
  content: { option: node.item.label },
29
- onClick: node.item.onClick,
29
+ ...(node.item.href
30
+ ? {
31
+ itemWrapRender: crumb => (
32
+ <a href={node.item.href} onClick={node.item.onClick} className={styles.a}>
33
+ {crumb}
34
+ </a>
35
+ ),
36
+ }
37
+ : {
38
+ onClick: node.item.onClick,
39
+ }),
30
40
  }),
31
41
  );
32
42
 
@@ -13,10 +13,19 @@
13
13
  &:focus-visible {
14
14
  @include styles-tokens-element.outline-var(styles-tokens-element.$container-focused-s);
15
15
 
16
- outline-color: styles-tokens-element.simple-var(styles-tokens-element.$theme-variables, 'sys', 'available', 'complementary');
16
+ outline-color: styles-tokens-element.simple-var(
17
+ styles-tokens-element.$theme-variables,
18
+ 'sys',
19
+ 'available',
20
+ 'complementary'
21
+ );
17
22
  }
18
23
  }
19
24
 
20
25
  .collapsedRow {
21
26
  display: flex;
22
- }
27
+ }
28
+
29
+ .a {
30
+ text-decoration: none;
31
+ }