@duskmoon-dev/el-select 0.5.0

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.
package/README.md ADDED
@@ -0,0 +1,93 @@
1
+ # @duskmoon-dev/el-select
2
+
3
+ A unified select component with single, multi-select, and tree-select modes.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @duskmoon-dev/el-select
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```javascript
14
+ // Auto-register the element
15
+ import '@duskmoon-dev/el-select/register';
16
+
17
+ // Or manually register
18
+ import { register } from '@duskmoon-dev/el-select';
19
+ register();
20
+ ```
21
+
22
+ ```html
23
+ <el-dm-select placeholder="Select a fruit..."></el-dm-select>
24
+ ```
25
+
26
+ ## Features
27
+
28
+ - **Single Select**: Basic dropdown selection
29
+ - **Multi-Select**: Tag-based multiple selection
30
+ - **Tree Select**: Hierarchical data selection with expand/collapse
31
+ - **Searchable**: Filter options by typing
32
+ - **Clearable**: Clear selection with a button
33
+ - **Cascade Mode**: Auto-select children when parent selected
34
+ - **Keyboard Navigation**: Full keyboard support
35
+
36
+ ## Setting Options
37
+
38
+ ```javascript
39
+ const select = document.querySelector('el-dm-select');
40
+
41
+ // Flat options
42
+ select.setOptions([
43
+ { value: 'apple', label: 'Apple' },
44
+ { value: 'banana', label: 'Banana' }
45
+ ]);
46
+
47
+ // Grouped options
48
+ select.setOptions([
49
+ { value: 'js', label: 'JavaScript', group: 'Frontend' },
50
+ { value: 'py', label: 'Python', group: 'Backend' }
51
+ ]);
52
+
53
+ // Tree options
54
+ select.setTreeOptions([
55
+ {
56
+ value: 'frontend',
57
+ label: 'Frontend',
58
+ children: [
59
+ { value: 'react', label: 'React' },
60
+ { value: 'vue', label: 'Vue' }
61
+ ]
62
+ }
63
+ ]);
64
+ ```
65
+
66
+ ## Properties
67
+
68
+ | Property | Type | Default | Description |
69
+ |----------|------|---------|-------------|
70
+ | `value` | `string` | `''` | Selected value(s) |
71
+ | `placeholder` | `string` | `''` | Placeholder text |
72
+ | `disabled` | `boolean` | `false` | Disable the select |
73
+ | `multiple` | `boolean` | `false` | Enable multi-select |
74
+ | `tree-data` | `boolean` | `false` | Enable tree mode |
75
+ | `searchable` | `boolean` | `false` | Enable search |
76
+ | `clearable` | `boolean` | `false` | Show clear button |
77
+ | `cascade` | `boolean` | `false` | Cascade selection (tree mode) |
78
+ | `check-strictly` | `boolean` | `false` | Independent selection (tree mode) |
79
+ | `max-tag-count` | `number` | `-1` | Max visible tags |
80
+ | `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Size variant |
81
+
82
+ ## Events
83
+
84
+ | Event | Detail | Description |
85
+ |-------|--------|-------------|
86
+ | `change` | `{ value, selectedOptions }` | Selection changed |
87
+ | `search` | `{ searchValue }` | Search text changed |
88
+ | `clear` | `{ previousValue }` | Selection cleared |
89
+ | `expand` | `{ node, expanded }` | Tree node toggled |
90
+
91
+ ## License
92
+
93
+ MIT