@tempots/beatui 1.2.2 → 1.2.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.
@@ -12,6 +12,7 @@ export * from './dropdown-base';
12
12
  export * from './combobox-input';
13
13
  export * from './select-tags-input';
14
14
  export * from './combobox-tags-input';
15
+ export * from './multi-select';
15
16
  export * from './date-input';
16
17
  export * from './date-time-input';
17
18
  export * from './editable-text';
@@ -0,0 +1,98 @@
1
+ import { Renderable, TNode, Value } from '@tempots/dom';
2
+ import { InputOptions } from './input-options';
3
+ import { DropdownOption } from './option';
4
+ import { BaseControlOptions, ControlOptions } from '../control';
5
+ /**
6
+ * Options for the {@link MultiSelect} component.
7
+ *
8
+ * @typeParam T - The type of option values.
9
+ */
10
+ export type MultiSelectOptions<T> = {
11
+ /** The available dropdown options to choose from. */
12
+ options: Value<DropdownOption<T>[]>;
13
+ /**
14
+ * Custom equality function for comparing option values.
15
+ * @default (a, b) => a === b
16
+ */
17
+ equality?: (a: T, b: T) => boolean;
18
+ /** Placeholder text shown when no values are selected. */
19
+ placeholder?: Value<string>;
20
+ /** Placeholder text for the search input inside the dropdown. */
21
+ searchPlaceholder?: Value<string>;
22
+ /** Custom filter function for matching options against the search query. */
23
+ filter?: (q: string, opt: {
24
+ label: string;
25
+ }) => boolean;
26
+ /**
27
+ * Async option loader. When provided, called with the search query.
28
+ * The returned options replace the static `options` in the dropdown.
29
+ */
30
+ loadOptions?: (query: string) => Promise<DropdownOption<T>[]>;
31
+ /** Debounce delay in ms for async loading. @default 300 */
32
+ loadDebounce?: number;
33
+ /** Maximum number of values that can be selected. */
34
+ maxSelection?: Value<number | undefined>;
35
+ /** Whether to show "Select all" / "Clear all" action buttons. @default false */
36
+ showActions?: Value<boolean>;
37
+ /** Label for the "Select all" action. @default 'Select all' */
38
+ selectAllLabel?: Value<string>;
39
+ /** Label for the "Clear all" action. @default 'Clear all' */
40
+ clearAllLabel?: Value<string>;
41
+ /**
42
+ * Custom option renderer. Receives the option and whether it is selected.
43
+ * Return a TNode to replace the default option rendering.
44
+ */
45
+ renderOption?: (option: {
46
+ value: T;
47
+ label: string;
48
+ disabled?: boolean;
49
+ }, selected: Value<boolean>) => TNode;
50
+ } & InputOptions<T[]>;
51
+ /**
52
+ * A fully-featured multi-select dropdown component.
53
+ *
54
+ * Combines a dropdown flyout with searchable options, selected-value chips,
55
+ * keyboard navigation, async loading, select/clear all actions, and max
56
+ * selection limits. Uses proper ARIA combobox/listbox semantics.
57
+ *
58
+ * @typeParam T - The type of option values.
59
+ * @param options - Configuration options for the multi-select.
60
+ * @returns A renderable multi-select component.
61
+ *
62
+ * @example
63
+ * ```ts
64
+ * MultiSelect({
65
+ * value: prop<string[]>([]),
66
+ * options: [
67
+ * Option.value('react', 'React'),
68
+ * Option.value('vue', 'Vue'),
69
+ * Option.group('Backend', [
70
+ * Option.value('node', 'Node.js'),
71
+ * Option.value('deno', 'Deno'),
72
+ * ]),
73
+ * ],
74
+ * placeholder: 'Select frameworks...',
75
+ * searchPlaceholder: 'Search...',
76
+ * showActions: true,
77
+ * maxSelection: 3,
78
+ * onChange: tags => console.log('Selected:', tags),
79
+ * })
80
+ * ```
81
+ */
82
+ export declare function MultiSelect<T>(options: MultiSelectOptions<T>): TNode;
83
+ /**
84
+ * A base form control wrapper for {@link MultiSelect} using a raw controller.
85
+ *
86
+ * @typeParam T - The type of option values.
87
+ * @param options - Base controller options for the multi-select control.
88
+ * @returns A renderable form control component.
89
+ */
90
+ export declare function BaseMultiSelectControl<T>(options: BaseControlOptions<T[], MultiSelectOptions<T>>): TNode;
91
+ /**
92
+ * A full form control wrapper for {@link MultiSelect} with label, error, and description support.
93
+ *
94
+ * @typeParam T - The type of option values.
95
+ * @param options - Controller options for the multi-select control.
96
+ * @returns A renderable form control component with wrapper.
97
+ */
98
+ export declare function MultiSelectControl<T>(options: ControlOptions<T[], MultiSelectOptions<T>>): Renderable;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tempots/beatui",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "type": "module",
5
5
  "main": "dist/index.umd.js",
6
6
  "module": "dist/index.es.js",