@bioturing/components 0.46.2 → 0.46.3

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,124 +1,6 @@
1
- import { ValidateStatus } from 'antd/es/form/FormItem';
2
- import { PopoverProps } from 'antd/es/popover';
3
1
  import { default as React, ForwardedRef } from 'react';
4
- export type ComboboxOption<T extends React.Key, O extends Record<string, unknown> = {}> = {
5
- value: T;
6
- label: React.ReactNode;
7
- disabled?: boolean;
8
- icon?: React.ReactNode;
9
- } & O;
10
- export interface ComboboxProps<T extends React.Key, M extends boolean, O extends Record<string, unknown> = {}> {
11
- /** Array of options to be displayed in the combobox */
12
- options?: ComboboxOption<T, O>[];
13
- /** Current value of the combobox */
14
- value?: M extends true ? T[] : T;
15
- /** Default value when uncontrolled */
16
- defaultValue?: M extends true ? T[] : T;
17
- /** Callback when value changes */
18
- onChange?: (value: M extends true ? T[] : T) => void;
19
- /** Placeholder text for the input */
20
- placeholder?: string;
21
- /** Whether the combobox is disabled */
22
- disabled?: boolean;
23
- /** Validation status */
24
- status?: ValidateStatus;
25
- /** Whether to allow clearing the selection */
26
- allowClear?: boolean;
27
- /** Whether to allow multiple selections */
28
- multiple?: M;
29
- /** Maximum number of tags to show */
30
- maxTagCount?: number;
31
- /** Whether to show search functionality */
32
- showSearch?: boolean;
33
- /** Controlled open state */
34
- open?: boolean;
35
- /** Callback when open state changes */
36
- onOpenChange?: (open: boolean) => void;
37
- /** Placement of the dropdown */
38
- placement?: PopoverProps["placement"];
39
- /** Custom className for the component */
40
- className?: string;
41
- /** Custom class names for different parts */
42
- classNames?: {
43
- trigger?: string;
44
- input?: string;
45
- option?: string;
46
- optionIcon?: string;
47
- optionText?: string;
48
- list?: string;
49
- portal?: string;
50
- };
51
- /** Size of the combobox */
52
- size?: "small" | "middle" | "large";
53
- /** Loading state */
54
- loading?: boolean;
55
- /** Custom render for options */
56
- optionRender?: (option: ComboboxOption<T, O>, props: React.HTMLAttributes<HTMLElement>) => React.ReactElement;
57
- /** Filter function for search */
58
- /**
59
- * Filter function for search
60
- * - `true` or `undefined`: default filtering (splits by tokenSeparators if provided)
61
- * - `false`: disables filtering
62
- * - custom function: `(input, option) => boolean`
63
- * @default true
64
- */
65
- filterOption?: boolean | ((input: string, option: ComboboxOption<T, O>) => boolean);
66
- /** Callback when search input changes */
67
- onSearch?: (value: string) => void;
68
- /** Custom dropdown render */
69
- dropdownRender?: (menu: React.ReactElement) => React.ReactElement;
70
- /** Custom clear icon */
71
- clearIcon?: React.ReactNode;
72
- /** Custom suffix icon */
73
- suffixIcon?: React.ReactNode;
74
- /**
75
- * Show select all option when in multiple mode
76
- * @default false
77
- */
78
- showSelectAll?: boolean;
79
- /**
80
- * Render function for the select all option
81
- */
82
- selectAllRender?: (props: {
83
- onSelectAll: () => void;
84
- onDeselectAll: () => void;
85
- checked: boolean;
86
- indeterminate: boolean;
87
- }) => React.ReactNode;
88
- /**
89
- * Function to extract keywords from the item for search filtering
90
- * @default (option) => [String(option.key), reactNodeToString(option.label)]
91
- */
92
- getOptionKeywords?: (option: ComboboxOption<T, O>) => string[];
93
- /**
94
- * Render function for the option label
95
- */
96
- optionLabelRender?: (option: ComboboxOption<T, O>, props?: React.HTMLAttributes<HTMLElement>) => React.ReactElement;
97
- /**
98
- * Whether the popup width should match the trigger width.
99
- * When `false`, the popup can exceed the trigger width to fit long option labels.
100
- * @default true
101
- */
102
- popupMatchSelectWidth?: boolean;
103
- /**
104
- * Allow adding items by typing the exact label or value and pressing Enter.
105
- * @default false
106
- */
107
- addOnEnter?: boolean;
108
- /**
109
- * Characters to split input by when adding multiple items on Enter.
110
- * Only applies when `addOnEnter` and `multiple` are true.
111
- * @default undefined
112
- */
113
- tokenSeparators?: string[];
114
- /**
115
- * Automatically highlight the first matching item while filtering.
116
- * When enabled in single-select mode, Enter selects the highlighted
117
- * item natively and `addOnEnter` is ignored to avoid conflicts.
118
- * @default true
119
- */
120
- autoHighlight?: boolean;
121
- }
2
+ import { ComboboxProps } from './types';
3
+ export type { ComboboxOption, ComboboxProps } from './types';
122
4
  declare const ComboboxInner: <T extends React.Key, M extends boolean, O extends Record<string, unknown> = {}>({ options, value: controlledValue, defaultValue, onChange, placeholder, disabled: disabledProp, status: statusProp, allowClear, multiple, showSearch: _showSearch, open: controlledOpen, onOpenChange, className, classNames, size, optionRender, onSearch, clearIcon, suffixIcon, placement, showSelectAll, optionLabelRender, getOptionKeywords: _getOptionKeywords, popupMatchSelectWidth, addOnEnter, tokenSeparators, autoHighlight, filterOption, ...rest }: ComboboxProps<T, M, O>, ref: React.ForwardedRef<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
123
5
  export declare const Combobox: <T extends React.Key, M extends boolean, O extends Record<string, unknown> = {}>(props: ComboboxProps<T, M, O> & {
124
6
  ref?: ForwardedRef<HTMLDivElement>;
@@ -1 +1 @@
1
- {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/components/combobox/component.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,EACZ,YAAY,EAOb,MAAM,OAAO,CAAC;AAWf,OAAO,aAAa,CAAC;AAQrB,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,IAAI;IACxF,KAAK,EAAE,CAAC,CAAC;IACT,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACxB,GAAG,CAAC,CAAC;AAEN,MAAM,WAAW,aAAa,CAC5B,CAAC,SAAS,KAAK,CAAC,GAAG,EACnB,CAAC,SAAS,OAAO,EACjB,CAAC,SAAS,MAA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