@edux-design/tree-select 0.1.0 → 0.1.1

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 CHANGED
@@ -134,18 +134,42 @@ Allows multi-select drag using CMD/CTRL or SHIFT. Selection is restricted to adj
134
134
  ### `isEditable` (boolean, default `false`)
135
135
  Enables inline label editing and add-item controls.
136
136
 
137
+ ### `allowDelete` (boolean, default `false`)
138
+ Shows a delete action for each item and removes the node (plus descendants).
139
+
137
140
  ### `useChevron` (boolean, default `false`)
138
141
  Uses a chevron control for expand/collapse instead of the checkbox toggle.
139
142
 
143
+ ### `defaultExpanded` (`"all"` | number | string[] | Set<string | number>)
144
+ Defines the initial expansion state. Use `"all"` to expand every node with children, a number to expand up to that level (1 expands top-level nodes), or an array/set of ids to expand specific items.
145
+
146
+ ### `expanded` (`"all"` | number | string[] | Set<string | number>)
147
+ Controlled expansion state. When provided, the tree expansion is driven by this value.
148
+
149
+ ### `onExpandedChange` (function)
150
+ Called with a `Set` of expanded ids when the user toggles expansion in controlled mode.
151
+
140
152
  ### `maxDepth` (number)
141
153
  Limits how deep new items can be added. For example, `maxDepth={3}` allows at most 3 levels.
142
154
 
143
155
  ### `addChildTooltip` (string)
144
156
  Tooltip copy for the add-child button.
145
157
 
158
+ ### `addChildTooltipByLevel` (string[])
159
+ Tooltip copy for add-child, keyed by depth. Overrides `addChildTooltip` when provided.
160
+
146
161
  ### `addSiblingTooltip` (string)
147
162
  Tooltip copy for the add-sibling button.
148
163
 
164
+ ### `addSiblingTooltipByLevel` (string[])
165
+ Tooltip copy for add-sibling, keyed by depth. Overrides `addSiblingTooltip` when provided.
166
+
167
+ ### `deleteTooltip` (string)
168
+ Tooltip copy for the delete button.
169
+
170
+ ### `deleteTooltipByLevel` (string[])
171
+ Tooltip copy for delete, keyed by depth. Overrides `deleteTooltip` when provided.
172
+
149
173
  ---
150
174
 
151
175
  ## Behaviour details
@@ -154,6 +178,9 @@ Tooltip copy for the add-sibling button.
154
178
  - Leaf nodes do not render a checkbox/chevron toggle.
155
179
  - Expansion only controls visibility of children.
156
180
  - When `useChevron` is `false`, the toggle uses the Checkbox plus/indeterminate states.
181
+ - `defaultExpanded` only seeds the initial state; use `expanded` for controlled expansion.
182
+ - When `expanded` is provided, `onExpandedChange` is called with the next set of expanded ids.
183
+ - Deleting a node removes the entire subtree and clears any selected/expanded state for those ids.
157
184
  - Drag-and-drop supports reordering within a level and moving items between levels.
158
185
  - Drag handle alignment is set so child handles align under the parent toggle.
159
186
 
package/dist/index.d.mts CHANGED
@@ -1,15 +1,23 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
 
3
- declare function TreeSelect({ data, onDataChange, allowDragAndDrop, allowMultiDrag, isEditable, useChevron, maxDepth, addChildTooltip, addSiblingTooltip, }: {
3
+ declare function TreeSelect({ data, onDataChange, allowDragAndDrop, allowMultiDrag, isEditable, allowDelete, useChevron, maxDepth, addChildTooltip, addSiblingTooltip, deleteTooltip, addChildTooltipByLevel, addSiblingTooltipByLevel, deleteTooltipByLevel, defaultExpanded, expanded, onExpandedChange, }: {
4
4
  data: any;
5
5
  onDataChange: any;
6
6
  allowDragAndDrop?: boolean;
7
7
  allowMultiDrag?: boolean;
8
8
  isEditable?: boolean;
9
+ allowDelete?: boolean;
9
10
  useChevron?: boolean;
10
11
  maxDepth: any;
11
12
  addChildTooltip: any;
12
13
  addSiblingTooltip: any;
14
+ deleteTooltip: any;
15
+ addChildTooltipByLevel: any;
16
+ addSiblingTooltipByLevel: any;
17
+ deleteTooltipByLevel: any;
18
+ defaultExpanded: any;
19
+ expanded: any;
20
+ onExpandedChange: any;
13
21
  }): react_jsx_runtime.JSX.Element;
14
22
 
15
23
  export { TreeSelect };
package/dist/index.d.ts CHANGED
@@ -1,15 +1,23 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
 
3
- declare function TreeSelect({ data, onDataChange, allowDragAndDrop, allowMultiDrag, isEditable, useChevron, maxDepth, addChildTooltip, addSiblingTooltip, }: {
3
+ declare function TreeSelect({ data, onDataChange, allowDragAndDrop, allowMultiDrag, isEditable, allowDelete, useChevron, maxDepth, addChildTooltip, addSiblingTooltip, deleteTooltip, addChildTooltipByLevel, addSiblingTooltipByLevel, deleteTooltipByLevel, defaultExpanded, expanded, onExpandedChange, }: {
4
4
  data: any;
5
5
  onDataChange: any;
6
6
  allowDragAndDrop?: boolean;
7
7
  allowMultiDrag?: boolean;
8
8
  isEditable?: boolean;
9
+ allowDelete?: boolean;
9
10
  useChevron?: boolean;
10
11
  maxDepth: any;
11
12
  addChildTooltip: any;
12
13
  addSiblingTooltip: any;
14
+ deleteTooltip: any;
15
+ addChildTooltipByLevel: any;
16
+ addSiblingTooltipByLevel: any;
17
+ deleteTooltipByLevel: any;
18
+ defaultExpanded: any;
19
+ expanded: any;
20
+ onExpandedChange: any;
13
21
  }): react_jsx_runtime.JSX.Element;
14
22
 
15
23
  export { TreeSelect };