@cloud-ru/ds-tree 1.0.51-preview-2df639a4.0 → 1.0.52

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloud-ru/ds-tree",
3
- "version": "1.0.51-preview-2df639a4.0",
3
+ "version": "1.0.52",
4
4
  "description": "Иерархический список с раскрывающимися узлами, выбором (single/multiple), кастомными иконками, контекстными действиями и асинхронной подгрузкой потомков.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -35,15 +35,15 @@
35
35
  "dependencies": {
36
36
  "classnames": "^2.5.1",
37
37
  "react-transition-state": "^2.4.0",
38
- "@cloud-ru/ds-button": "1.0.10-preview-2df639a4.0",
39
- "@cloud-ru/ds-icons": "1.8.1-preview-2df639a4.0",
40
- "@cloud-ru/ds-list": "3.2.1-preview-2df639a4.0",
41
- "@cloud-ru/ds-materials": "2.0.6-preview-2df639a4.0",
42
- "@cloud-ru/ds-truncate-string": "1.0.24-preview-2df639a4.0",
43
- "@cloud-ru/ds-toggles": "1.1.20-preview-2df639a4.0",
44
- "@cloud-ru/ds-typography": "1.0.3-preview-2df639a4.0",
45
- "@cloud-ru/ds-loader": "1.0.8-preview-2df639a4.0",
46
- "@cloud-ru/ds-utils": "1.4.3-preview-2df639a4.0"
38
+ "@cloud-ru/ds-button": "^1.0.9",
39
+ "@cloud-ru/ds-list": "^3.2.2",
40
+ "@cloud-ru/ds-icons": "^1.8.0",
41
+ "@cloud-ru/ds-toggles": "^1.1.19",
42
+ "@cloud-ru/ds-loader": "^1.0.7",
43
+ "@cloud-ru/ds-materials": "^2.0.5",
44
+ "@cloud-ru/ds-truncate-string": "^1.0.23",
45
+ "@cloud-ru/ds-typography": "^1.0.3",
46
+ "@cloud-ru/ds-utils": "^1.4.2"
47
47
  },
48
48
  "publishConfig": {
49
49
  "access": "public"
package/src/constants.ts CHANGED
@@ -14,10 +14,6 @@ export const TRANSITION_TIMING = {
14
14
  } as const;
15
15
 
16
16
  export const TEST_IDS = {
17
- expandableTreeNodeTreeNode: 'expandable-tree-node__tree-node',
18
- treeNodeActionsDroplist: 'tree-node-actions__droplist',
19
- treeNodeSpinner: 'tree-node__spinner',
20
- treeNodeTreeNodeTitle: 'tree-node__tree-node-title',
21
17
  node: 'tree__node',
22
18
  line: 'tree__node__line',
23
19
  item: 'tree__node__item',
@@ -76,12 +76,12 @@ export const ExpandableTreeNode = forwardRef<HTMLDivElement, ExpandableTreeNodeP
76
76
  if (node.nested && !node.nested.length && !isExpanded && onDataLoad) {
77
77
  setLoading(true);
78
78
 
79
- await onDataLoad({ ...node, 'data-test-id': dataTestId }).finally(() => {
79
+ await onDataLoad(node).finally(() => {
80
80
  setLoading(false);
81
81
  });
82
82
  }
83
83
 
84
- onExpand({ ...node, 'data-test-id': dataTestId });
84
+ onExpand(node);
85
85
 
86
86
  toggle();
87
87
  };
@@ -116,7 +116,6 @@ export const ExpandableTreeNode = forwardRef<HTMLDivElement, ExpandableTreeNodeP
116
116
  ref={ref}
117
117
  >
118
118
  <TreeNode
119
- data-test-id={TEST_IDS.expandableTreeNodeTreeNode}
120
119
  {...node}
121
120
  loading={loading}
122
121
  parentNode={parentNode}
@@ -1,20 +1,19 @@
1
- import type { WithSupportProps } from '@cloud-ru/ds-utils';
2
1
  import cn from 'classnames';
3
2
  import { CSSProperties } from 'react';
4
3
 
5
4
  import { TEST_IDS } from '../../constants';
6
5
  import styles from './styles.module.scss';
7
6
 
8
- export type TreeLineProps = WithSupportProps<{
7
+ export type TreeLineProps = {
9
8
  className?: string;
10
9
  /** Доп. инлайн-стили для контейнера (height/width передаются здесь, а не отдельными пропами). */
11
10
  style?: CSSProperties;
12
11
  halfWidth?: boolean;
13
12
  visible?: boolean;
14
13
  horizontal?: boolean;
15
- }>;
14
+ };
16
15
 
17
- export function TreeLine({ className, style, halfWidth, horizontal, visible, ...supportProps }: TreeLineProps) {
16
+ export function TreeLine({ className, style, halfWidth, horizontal, visible }: TreeLineProps) {
18
17
  return (
19
18
  <div
20
19
  className={cn(styles.treeLine, className)}
@@ -22,8 +21,7 @@ export function TreeLine({ className, style, halfWidth, horizontal, visible, ...
22
21
  data-horizontal={horizontal || undefined}
23
22
  data-half-width={halfWidth || undefined}
24
23
  data-visible={visible || undefined}
25
- {...supportProps}
26
- data-test-id={supportProps['data-test-id'] ?? TEST_IDS.line}
24
+ data-test-id={TEST_IDS.line}
27
25
  />
28
26
  );
29
27
  }
@@ -130,7 +130,17 @@ export const TreeNode = forwardRef<HTMLDivElement, TreeNodeComponentProps>(
130
130
  }, [showIcons, isExpandable, isExpanded, iconProp, expandedIconProp, collapsedIconProp]);
131
131
 
132
132
  const handleClick: TreeNodeProps['onClick'] = e => {
133
- onNodeClick({ 'data-test-id': rest['data-test-id'], id, title, disabled, nested, onClick, href }, e);
133
+ onNodeClick(
134
+ {
135
+ id,
136
+ title,
137
+ disabled,
138
+ nested,
139
+ onClick,
140
+ href,
141
+ },
142
+ e,
143
+ );
134
144
  };
135
145
 
136
146
  const handleAnchorClick = (e: MouseEvent<Element>) => {
@@ -268,9 +278,7 @@ export const TreeNode = forwardRef<HTMLDivElement, TreeNodeComponentProps>(
268
278
  data-size={size}
269
279
  ref={ref}
270
280
  >
271
- {parentNode && (
272
- <TreeLine data-test-id={TEST_IDS.line} halfWidth={isExpandable} horizontal visible={showLines} />
273
- )}
281
+ {parentNode && <TreeLine halfWidth={isExpandable} horizontal visible={showLines} />}
274
282
 
275
283
  {(isExpandable || !parentNode) && (
276
284
  <div className={styles.treeNodeExpandButtonWrapper}>
@@ -290,13 +298,9 @@ export const TreeNode = forwardRef<HTMLDivElement, TreeNodeComponentProps>(
290
298
  aria-hidden
291
299
  data-state='emptyNeutralOnBackground'
292
300
  />
293
- {loading ? (
294
- <Spinner data-test-id={TEST_IDS.treeNodeSpinner} size={SPINNER_SIZE_BY_TREE_SIZE[size]} />
295
- ) : (
296
- <ChevronRightSVG />
297
- )}
301
+ {loading ? <Spinner size={SPINNER_SIZE_BY_TREE_SIZE[size]} /> : <ChevronRightSVG />}
298
302
  </button>
299
- <TreeLine data-test-id={TEST_IDS.line} visible={isExpanded && showLines} />
303
+ <TreeLine visible={isExpanded && showLines} />
300
304
  </>
301
305
  ) : (
302
306
  <div className={styles.treeNodeExpandButtonSpacer} aria-hidden />
@@ -363,20 +367,13 @@ export const TreeNode = forwardRef<HTMLDivElement, TreeNodeComponentProps>(
363
367
  </div>
364
368
  )}
365
369
 
366
- <Typography
367
- data-test-id={TEST_IDS.treeNodeTreeNodeTitle}
368
- variant='body'
369
- size={size}
370
- as='div'
371
- className={styles.treeNodeTitle}
372
- >
370
+ <Typography variant='body' size={size} as='div' className={styles.treeNodeTitle}>
373
371
  <div className={styles.treeNodeTextContent}>
374
372
  <TreeNodeHref href={href} onClick={handleAnchorClick} ref={anchorRef}>
375
373
  {typeof title === 'string' && (
376
374
  <TruncateString text={title} maxLines={titleMaxLines} data-test-id={TEST_IDS.title} />
377
375
  )}
378
- {typeof title !== 'string' &&
379
- title({ 'data-test-id': rest['data-test-id'], id, disabled, nested } as TreeNodeProps)}
376
+ {typeof title !== 'string' && title({ id, disabled, nested } as TreeNodeProps)}
380
377
  </TreeNodeHref>
381
378
  </div>
382
379
  </Typography>
@@ -385,7 +382,12 @@ export const TreeNode = forwardRef<HTMLDivElement, TreeNodeComponentProps>(
385
382
  {getNodeActions && (
386
383
  <TreeNodeActions
387
384
  getNodeActions={getNodeActions}
388
- node={{ 'data-test-id': rest['data-test-id'], id, title, disabled, nested }}
385
+ node={{
386
+ id,
387
+ title,
388
+ disabled,
389
+ nested,
390
+ }}
389
391
  focusNode={handleFocus}
390
392
  onBlurActions={handleBlurActions}
391
393
  isDroplistTriggerFocused={isDroplistTriggerFocused}
@@ -106,7 +106,6 @@ export function TreeNodeActions({
106
106
  onFocus={stopPropagationFocus}
107
107
  >
108
108
  <Droplist
109
- data-test-id={TEST_IDS.treeNodeActionsDroplist}
110
109
  open={isDroplistOpen}
111
110
  onOpenChange={open => {
112
111
  setDroplistOpen(open);