@amboss/design-system 2.3.12 → 2.3.13
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.
|
@@ -7,13 +7,33 @@ export type TreeNodeWithUIState = TreeNode & {
|
|
|
7
7
|
};
|
|
8
8
|
type PartialEntityListItemProps = Pick<EntityListItemProps, "hideBorder" | "size" | "renderRight">;
|
|
9
9
|
export type EntityTreeProps = {
|
|
10
|
+
/**
|
|
11
|
+
* TreeNode
|
|
12
|
+
* @param id - **Unique** identifier for the node
|
|
13
|
+
* @param label - Node label
|
|
14
|
+
* @param description - Optional node description
|
|
15
|
+
* @param children - Node children, TreeNode[]
|
|
16
|
+
*/
|
|
10
17
|
data: TreeNode[];
|
|
18
|
+
/** Current selected node ids. If provided, the EntityTree becomes a selectable variant */
|
|
11
19
|
selectedIds?: NodeID[];
|
|
20
|
+
/** Callback function to handle selection change
|
|
21
|
+
* @param ids - Updated selected node ids
|
|
22
|
+
*/
|
|
12
23
|
onSelectionChange?: (ids: NodeID[]) => void;
|
|
24
|
+
/** Expanded node ids */
|
|
13
25
|
expandedIds?: NodeID[];
|
|
26
|
+
/** Callback function to handle node expand/collapse
|
|
27
|
+
* @param ids - Updated expanded node ids
|
|
28
|
+
*/
|
|
14
29
|
onToggle?: (ids: NodeID[]) => void;
|
|
30
|
+
/** If provided, the filter function is used to filter the tree. */
|
|
15
31
|
filterFn?: (node: TreeNode) => boolean;
|
|
32
|
+
/** Callback function to handle tree change
|
|
33
|
+
* @param data - Updated tree data
|
|
34
|
+
*/
|
|
16
35
|
onTreeChange?: (data: TreeNodeWithUIState[]) => void;
|
|
36
|
+
/** Show items count or not */
|
|
17
37
|
showItemsCount?: boolean;
|
|
18
38
|
"data-e2e-test-id"?: string;
|
|
19
39
|
} & PartialEntityListItemProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"useKeyboard",{enumerable:!0,get:function(){return useKeyboard}});const _react=require("react"),_useDocument=require("./useDocument");function useKeyboard(config,ref,isActive){let document=(0,_useDocument.useDocument)(),handleKeyboard=event=>{if(!isActive||document.activeElement!==ref.current&&!ref.current
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"useKeyboard",{enumerable:!0,get:function(){return useKeyboard}});const _react=require("react"),_useDocument=require("./useDocument");function useKeyboard(config,ref,isActive){let document=(0,_useDocument.useDocument)(),handleKeyboard=event=>{if(!isActive||document.activeElement!==ref.current&&!ref.current?.contains(document.activeElement))return;let targetConfigKey=Object.keys(config).find(targetKeys=>targetKeys.split(" ").includes(event.code));targetConfigKey&&(event.preventDefault(),!1===config[targetConfigKey](event)&&event.stopPropagation())};(0,_react.useEffect)(()=>(document.addEventListener("keydown",handleKeyboard),()=>{document.removeEventListener("keydown",handleKeyboard)}))}
|
|
@@ -7,13 +7,33 @@ export type TreeNodeWithUIState = TreeNode & {
|
|
|
7
7
|
};
|
|
8
8
|
type PartialEntityListItemProps = Pick<EntityListItemProps, "hideBorder" | "size" | "renderRight">;
|
|
9
9
|
export type EntityTreeProps = {
|
|
10
|
+
/**
|
|
11
|
+
* TreeNode
|
|
12
|
+
* @param id - **Unique** identifier for the node
|
|
13
|
+
* @param label - Node label
|
|
14
|
+
* @param description - Optional node description
|
|
15
|
+
* @param children - Node children, TreeNode[]
|
|
16
|
+
*/
|
|
10
17
|
data: TreeNode[];
|
|
18
|
+
/** Current selected node ids. If provided, the EntityTree becomes a selectable variant */
|
|
11
19
|
selectedIds?: NodeID[];
|
|
20
|
+
/** Callback function to handle selection change
|
|
21
|
+
* @param ids - Updated selected node ids
|
|
22
|
+
*/
|
|
12
23
|
onSelectionChange?: (ids: NodeID[]) => void;
|
|
24
|
+
/** Expanded node ids */
|
|
13
25
|
expandedIds?: NodeID[];
|
|
26
|
+
/** Callback function to handle node expand/collapse
|
|
27
|
+
* @param ids - Updated expanded node ids
|
|
28
|
+
*/
|
|
14
29
|
onToggle?: (ids: NodeID[]) => void;
|
|
30
|
+
/** If provided, the filter function is used to filter the tree. */
|
|
15
31
|
filterFn?: (node: TreeNode) => boolean;
|
|
32
|
+
/** Callback function to handle tree change
|
|
33
|
+
* @param data - Updated tree data
|
|
34
|
+
*/
|
|
16
35
|
onTreeChange?: (data: TreeNodeWithUIState[]) => void;
|
|
36
|
+
/** Show items count or not */
|
|
17
37
|
showItemsCount?: boolean;
|
|
18
38
|
"data-e2e-test-id"?: string;
|
|
19
39
|
} & PartialEntityListItemProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useEffect}from"react";import{useDocument}from"./useDocument";export function useKeyboard(config,ref,isActive){let document=useDocument(),handleKeyboard=event=>{if(!isActive||document.activeElement!==ref.current&&!ref.current
|
|
1
|
+
import{useEffect}from"react";import{useDocument}from"./useDocument";export function useKeyboard(config,ref,isActive){let document=useDocument(),handleKeyboard=event=>{if(!isActive||document.activeElement!==ref.current&&!ref.current?.contains(document.activeElement))return;let targetConfigKey=Object.keys(config).find(targetKeys=>targetKeys.split(" ").includes(event.code));targetConfigKey&&(event.preventDefault(),!1===config[targetConfigKey](event)&&event.stopPropagation())};useEffect(()=>(document.addEventListener("keydown",handleKeyboard),()=>{document.removeEventListener("keydown",handleKeyboard)}))}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amboss/design-system",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.13",
|
|
4
4
|
"description": "the design system for AMBOSS products",
|
|
5
5
|
"author": "AMBOSS",
|
|
6
6
|
"license": "ISC",
|
|
@@ -113,6 +113,7 @@
|
|
|
113
113
|
],
|
|
114
114
|
"dependencies": {
|
|
115
115
|
"@swc/helpers": "^0.5.3",
|
|
116
|
+
"@testing-library/react-hooks": "^8.0.1",
|
|
116
117
|
"focus-trap-react": "^10.2.3",
|
|
117
118
|
"imask": "^7.4.0",
|
|
118
119
|
"react-is": "^17.0.1",
|