@rockshin/tao-ui 0.0.12 → 0.0.14

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.
@@ -13,18 +13,29 @@ export interface SelectOption {
13
13
  /** Nested options turn this entry into a group; `label` becomes the group title. */
14
14
  options?: SelectOption[];
15
15
  }
16
- export type SelectSemanticPart = 'root' | 'prefix' | 'suffix' | 'placeholder' | 'clear' | 'popup' | 'search' | 'group' | 'groupLabel' | 'item' | 'itemIcon' | 'itemLabel' | 'itemDesc' | 'empty';
16
+ export type SelectSemanticPart = 'root' | 'prefix' | 'suffix' | 'placeholder' | 'clear' | 'popup' | 'search' | 'searchInput' | 'group' | 'groupLabel' | 'item' | 'itemIcon' | 'itemLabel' | 'itemDesc' | 'empty' | 'tag' | 'tagLabel' | 'tagClose' | 'tagRest' | 'values';
17
17
  export type SelectPlacement = 'bottomLeft' | 'bottomRight' | 'topLeft' | 'topRight';
18
+ export interface TagRenderProps {
19
+ label: ReactNode;
20
+ value: string;
21
+ closable: boolean;
22
+ disabled: boolean;
23
+ onClose: (e: React.MouseEvent) => void;
24
+ }
18
25
  export interface SelectProps {
19
26
  options: SelectOption[];
20
- value?: string;
21
- defaultValue?: string;
22
- /** Fired on selection or clear. `option` is undefined when cleared. */
23
- onChange?: (value: string, option?: SelectOption) => void;
24
- /** Fired only when an option is picked (not on clear). */
27
+ value?: string | string[];
28
+ defaultValue?: string | string[];
29
+ /** Fired on selection or clear. Multi-mode receives `string[]`. */
30
+ onChange?: (value: string | string[], option?: SelectOption | SelectOption[]) => void;
31
+ /** Fired only when an option is picked (not on clear). Multi-mode receives a single value. */
25
32
  onSelect?: (value: string, option: SelectOption) => void;
33
+ /** Fired when an option is deselected (multi-mode only). */
34
+ onDeselect?: (value: string, option: SelectOption) => void;
26
35
  /** Fired when the value is cleared via the clear button. */
27
36
  onClear?: () => void;
37
+ /** Selection mode. `multiple` for multi-select, `tags` for free-form tag input. */
38
+ mode?: 'multiple' | 'tags';
28
39
  placeholder?: string;
29
40
  size?: TaoSize;
30
41
  variant?: TaoVariant;
@@ -53,9 +64,11 @@ export interface SelectProps {
53
64
  prefix?: ReactNode;
54
65
  /** Custom suffix (arrow) icon. */
55
66
  suffixIcon?: ReactNode;
67
+ /** Custom remove icon for multi-select tags. */
68
+ removeIcon?: ReactNode;
56
69
  autoFocus?: boolean;
57
70
  id?: string;
58
- /** Name for hidden form field. */
71
+ /** Name for hidden form field (single mode only). */
59
72
  name?: string;
60
73
  /** Controlled open state of the dropdown. */
61
74
  open?: boolean;
@@ -73,10 +86,26 @@ export interface SelectProps {
73
86
  optionRender?: (option: SelectOption, info: {
74
87
  index: number;
75
88
  }) => ReactNode;
76
- /** Customize the selected label shown in the trigger. */
89
+ /** Customize the selected label shown in the trigger (single mode only). */
77
90
  labelRender?: (option: SelectOption) => ReactNode;
78
91
  /** Wrap/customize the dropdown content. */
79
92
  popupRender?: (menu: ReactNode) => ReactNode;
93
+ /** Custom tag rendering (multi-mode only). */
94
+ tagRender?: (props: TagRenderProps) => ReactNode;
95
+ /** Max visible tags before collapsing into "+N". */
96
+ maxTagCount?: number | 'responsive';
97
+ /** Placeholder for collapsed tags: node or `(omittedValues) => node`. */
98
+ maxTagPlaceholder?: ReactNode | ((omittedValues: SelectOption[]) => ReactNode);
99
+ /** Truncate tag label text to this length. */
100
+ maxTagTextLength?: number;
101
+ /** Max selectable items (multi-mode only). */
102
+ maxCount?: number;
103
+ /** Auto-clear search text after selection (multi-mode only, default: true). */
104
+ autoClearSearchValue?: boolean;
105
+ /** Characters that split pasted/typed text into multiple selections. */
106
+ tokenSeparators?: string[];
107
+ /** Hide already-selected options from the dropdown (multi-mode only). */
108
+ hideSelected?: boolean;
80
109
  /** Force mobile mode (bottom sheet) regardless of screen size */
81
110
  mobile?: boolean;
82
111
  /** Merged onto the trigger root; use to override width etc. */
@@ -88,3 +117,4 @@ export interface SelectProps {
88
117
  export declare function Select(props: SelectProps): import("react/jsx-runtime").JSX.Element;
89
118
  /** Double chevron (↕) for a switcher-style trigger. Pass to `suffixIcon`. */
90
119
  export declare function ChevronsUpDownIcon(): import("react/jsx-runtime").JSX.Element;
120
+ export declare function SearchIcon(): import("react/jsx-runtime").JSX.Element;