asterui 0.12.22 → 0.12.24

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.
@@ -1,19 +1,69 @@
1
1
  import { default as React } from 'react';
2
2
  export interface CascaderOption {
3
- value: string | number;
3
+ value: string;
4
4
  label: React.ReactNode;
5
5
  disabled?: boolean;
6
6
  children?: CascaderOption[];
7
+ isLeaf?: boolean;
7
8
  }
9
+ export type CascaderColor = 'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'error';
10
+ export type CascaderSize = 'xs' | 'sm' | 'md' | 'lg';
8
11
  export interface CascaderProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {
12
+ /** Hierarchical options data */
9
13
  options: CascaderOption[];
10
- value?: (string | number)[];
11
- onChange?: (value: (string | number)[], selectedOptions: CascaderOption[]) => void;
14
+ /** Controlled selected value path */
15
+ value?: string[];
16
+ /** Default selected value path (uncontrolled) */
17
+ defaultValue?: string[];
18
+ /** Callback when selection changes */
19
+ onChange?: (value: string[], selectedOptions: CascaderOption[]) => void;
20
+ /** Placeholder text */
12
21
  placeholder?: string;
22
+ /** Disable the cascader */
13
23
  disabled?: boolean;
24
+ /** Show clear button */
14
25
  allowClear?: boolean;
26
+ /** How to expand sub-menus */
15
27
  expandTrigger?: 'click' | 'hover';
28
+ /** Allow selection of any level, not just leaf nodes */
29
+ changeOnSelect?: boolean;
30
+ /** Custom display render function */
16
31
  displayRender?: (labels: React.ReactNode[], selectedOptions: CascaderOption[]) => React.ReactNode;
17
- size?: 'xs' | 'sm' | 'md' | 'lg';
32
+ /** Input size */
33
+ size?: CascaderSize;
34
+ /** Focus ring color */
35
+ color?: CascaderColor;
36
+ /** Validation status */
37
+ status?: 'error' | 'warning';
38
+ /** Enable search/filter functionality */
39
+ showSearch?: boolean | {
40
+ filter?: (inputValue: string, path: CascaderOption[]) => boolean;
41
+ render?: (inputValue: string, path: CascaderOption[]) => React.ReactNode;
42
+ matchInputWidth?: boolean;
43
+ };
44
+ /** Content when no results found */
45
+ notFoundContent?: React.ReactNode;
46
+ /** Async data loading function */
47
+ loadData?: (selectedOptions: CascaderOption[]) => Promise<void>;
48
+ /** Custom field names for data mapping */
49
+ fieldNames?: {
50
+ label?: string;
51
+ value?: string;
52
+ children?: string;
53
+ };
54
+ /** Controlled open state */
55
+ open?: boolean;
56
+ /** Callback when dropdown visibility changes */
57
+ onDropdownVisibleChange?: (open: boolean) => void;
58
+ /** Class name for dropdown */
59
+ popupClassName?: string;
60
+ /** Custom dropdown render wrapper */
61
+ dropdownRender?: (menu: React.ReactNode) => React.ReactNode;
62
+ /** Multiple selection mode */
63
+ multiple?: boolean;
64
+ /** Max tags to show in multiple mode */
65
+ maxTagCount?: number | 'responsive';
66
+ /** Accessible label */
67
+ 'aria-label'?: string;
18
68
  }
19
- export declare function Cascader({ options, value, onChange, placeholder, disabled, allowClear, expandTrigger, displayRender, size, className, ...rest }: CascaderProps): import("react/jsx-runtime").JSX.Element;
69
+ export declare const Cascader: React.ForwardRefExoticComponent<CascaderProps & React.RefAttributes<HTMLDivElement>>;
@@ -1,4 +1,6 @@
1
1
  import { default as React } from 'react';
2
+ export type TreeColor = 'primary' | 'secondary' | 'accent' | 'neutral' | 'info' | 'success' | 'warning' | 'error';
3
+ export type TreeSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
2
4
  export interface TreeDataNode {
3
5
  key: string;
4
6
  title: React.ReactNode;
@@ -11,30 +13,104 @@ export interface TreeDataNode {
11
13
  isLeaf?: boolean;
12
14
  }
13
15
  export interface TreeProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> {
14
- treeData: TreeDataNode[];
16
+ /** Tree data structure (alternative to compound pattern) */
17
+ treeData?: TreeDataNode[] | undefined;
18
+ /** Children for compound pattern */
19
+ children?: React.ReactNode;
20
+ /** Show checkbox for each node */
15
21
  checkable?: boolean;
22
+ /** Checkbox color (DaisyUI) */
23
+ checkboxColor?: TreeColor;
24
+ /** Checkbox size (DaisyUI) */
25
+ checkboxSize?: TreeSize;
26
+ /** Enable node selection */
16
27
  selectable?: boolean;
28
+ /** Allow multiple selection */
17
29
  multiple?: boolean;
30
+ /** Expand all nodes by default */
18
31
  defaultExpandAll?: boolean;
32
+ /** Default expanded keys */
19
33
  defaultExpandedKeys?: string[];
34
+ /** Controlled expanded keys */
20
35
  expandedKeys?: string[];
36
+ /** Default selected keys */
21
37
  defaultSelectedKeys?: string[];
38
+ /** Controlled selected keys */
22
39
  selectedKeys?: string[];
40
+ /** Default checked keys */
23
41
  defaultCheckedKeys?: string[];
42
+ /** Controlled checked keys */
24
43
  checkedKeys?: string[];
44
+ /** Callback when node is expanded */
25
45
  onExpand?: (expandedKeys: string[], info: {
26
46
  node: TreeDataNode;
27
47
  expanded: boolean;
28
48
  }) => void;
49
+ /** Callback when node is selected */
29
50
  onSelect?: (selectedKeys: string[], info: {
30
51
  node: TreeDataNode;
31
52
  selected: boolean;
32
53
  }) => void;
54
+ /** Callback when node is checked */
33
55
  onCheck?: (checkedKeys: string[], info: {
34
56
  node: TreeDataNode;
35
57
  checked: boolean;
36
58
  }) => void;
59
+ /** Show connecting lines */
37
60
  showLine?: boolean;
61
+ /** Show node icons */
38
62
  showIcon?: boolean;
63
+ /** Decouple parent-child checkbox relationship */
64
+ checkStrictly?: boolean;
65
+ /** Auto expand parent nodes when expandedKeys change */
66
+ autoExpandParent?: boolean;
67
+ /** Make node fill remaining horizontal space */
68
+ blockNode?: boolean;
69
+ /** Custom expand/collapse icon */
70
+ switcherIcon?: React.ReactNode | ((expanded: boolean) => React.ReactNode);
71
+ /** Custom title render function */
72
+ titleRender?: (node: TreeDataNode) => React.ReactNode;
73
+ /** Filter function for highlighting nodes */
74
+ filterTreeNode?: (node: TreeDataNode) => boolean;
75
+ /** Async data loading */
76
+ loadData?: (node: TreeDataNode) => Promise<void>;
77
+ /** Right click handler */
78
+ onRightClick?: (info: {
79
+ event: React.MouseEvent;
80
+ node: TreeDataNode;
81
+ }) => void;
82
+ /** Custom field names for data mapping */
83
+ fieldNames?: {
84
+ key?: string;
85
+ title?: string;
86
+ children?: string;
87
+ };
88
+ }
89
+ export interface TreeNodeProps {
90
+ /** Unique key for the node (uses React's key prop) */
91
+ key: string;
92
+ /** Display title */
93
+ title: React.ReactNode;
94
+ /** Custom icon */
95
+ icon?: React.ReactNode;
96
+ /** Disable the node */
97
+ disabled?: boolean;
98
+ /** Disable checkbox for this node */
99
+ disableCheckbox?: boolean;
100
+ /** Whether node can be selected */
101
+ selectable?: boolean;
102
+ /** Whether node shows checkbox */
103
+ checkable?: boolean;
104
+ /** Force node to be a leaf */
105
+ isLeaf?: boolean;
106
+ /** Child nodes */
107
+ children?: React.ReactNode;
108
+ }
109
+ declare function TreeNode(_props: TreeNodeProps): null;
110
+ declare namespace TreeNode {
111
+ var displayName: string;
39
112
  }
40
- export declare function Tree({ treeData, checkable, selectable, multiple, defaultExpandAll, defaultExpandedKeys, expandedKeys: controlledExpandedKeys, defaultSelectedKeys, selectedKeys: controlledSelectedKeys, defaultCheckedKeys, checkedKeys: controlledCheckedKeys, onExpand, onSelect, onCheck, showLine, showIcon, className, ...rest }: TreeProps): import("react/jsx-runtime").JSX.Element;
113
+ export declare const Tree: React.ForwardRefExoticComponent<TreeProps & React.RefAttributes<HTMLDivElement>> & {
114
+ Node: typeof TreeNode;
115
+ };
116
+ export {};
@@ -1,5 +1,14 @@
1
1
  import { default as React } from 'react';
2
2
  import { TreeDataNode } from './Tree';
3
+ export type TreeSelectSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
4
+ export type TreeSelectColor = 'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'error';
5
+ export type TreeSelectStatus = 'error' | 'warning';
6
+ export type ShowCheckedStrategy = 'SHOW_ALL' | 'SHOW_PARENT' | 'SHOW_CHILD';
7
+ export interface TreeSelectFieldNames {
8
+ label?: string;
9
+ value?: string;
10
+ children?: string;
11
+ }
3
12
  export interface TreeSelectProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {
4
13
  treeData: TreeDataNode[];
5
14
  value?: string | string[];
@@ -7,7 +16,12 @@ export interface TreeSelectProps extends Omit<React.HTMLAttributes<HTMLDivElemen
7
16
  onChange?: (value: string | string[], labels: React.ReactNode[]) => void;
8
17
  multiple?: boolean;
9
18
  treeCheckable?: boolean;
19
+ treeCheckStrictly?: boolean;
20
+ showCheckedStrategy?: ShowCheckedStrategy;
10
21
  showSearch?: boolean;
22
+ searchValue?: string;
23
+ onSearch?: (value: string) => void;
24
+ filterTreeNode?: (searchValue: string, node: TreeDataNode) => boolean;
11
25
  placeholder?: string;
12
26
  allowClear?: boolean;
13
27
  disabled?: boolean;
@@ -15,6 +29,25 @@ export interface TreeSelectProps extends Omit<React.HTMLAttributes<HTMLDivElemen
15
29
  treeDefaultExpandedKeys?: string[];
16
30
  treeExpandedKeys?: string[];
17
31
  onTreeExpand?: (expandedKeys: string[]) => void;
18
- size?: 'xs' | 'sm' | 'md' | 'lg';
32
+ size?: TreeSelectSize;
33
+ color?: TreeSelectColor;
34
+ status?: TreeSelectStatus;
35
+ maxTagCount?: number | 'responsive';
36
+ maxTagPlaceholder?: React.ReactNode | ((omittedValues: string[]) => React.ReactNode);
37
+ labelInValue?: boolean;
38
+ treeLine?: boolean;
39
+ treeIcon?: boolean;
40
+ loadData?: (node: TreeDataNode) => Promise<void>;
41
+ fieldNames?: TreeSelectFieldNames;
42
+ open?: boolean;
43
+ onDropdownVisibleChange?: (open: boolean) => void;
44
+ suffixIcon?: React.ReactNode;
45
+ switcherIcon?: React.ReactNode | ((props: {
46
+ expanded: boolean;
47
+ }) => React.ReactNode);
48
+ notFoundContent?: React.ReactNode;
49
+ dropdownRender?: (menu: React.ReactNode) => React.ReactNode;
50
+ popupClassName?: string;
51
+ 'data-testid'?: string;
19
52
  }
20
- export declare function TreeSelect({ treeData, value: controlledValue, defaultValue, onChange, multiple, treeCheckable, showSearch, placeholder, allowClear, disabled, treeDefaultExpandAll, treeDefaultExpandedKeys, treeExpandedKeys: controlledExpandedKeys, onTreeExpand, size, className, ...rest }: TreeSelectProps): import("react/jsx-runtime").JSX.Element;
53
+ export declare const TreeSelect: React.ForwardRefExoticComponent<TreeSelectProps & React.RefAttributes<HTMLDivElement>>;
package/dist/index.d.ts CHANGED
@@ -183,7 +183,7 @@ export type { TransferProps, TransferItem } from './components/Transfer';
183
183
  export { Tree } from './components/Tree';
184
184
  export type { TreeProps, TreeDataNode } from './components/Tree';
185
185
  export { TreeSelect } from './components/TreeSelect';
186
- export type { TreeSelectProps } from './components/TreeSelect';
186
+ export type { TreeSelectProps, TreeSelectSize, TreeSelectColor, TreeSelectStatus, TreeSelectFieldNames, ShowCheckedStrategy, } from './components/TreeSelect';
187
187
  export { Typography } from './components/Typography';
188
188
  export type { TypographyProps, TitleProps, ParagraphProps, TextProps, TypographyLinkProps, TypographySize, TitleLevel, } from './components/Typography';
189
189
  export { Upload } from './components/Upload';