@edux-design/tree-select 0.1.2 → 0.2.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
@@ -125,6 +125,9 @@ Tree data to render. This component is controlled; updates are emitted through `
125
125
  ### `onDataChange` (function)
126
126
  Called with the updated tree when edits, add actions, or drag-and-drop reordering occur.
127
127
 
128
+ ### `onLabelChange` (function)
129
+ Called with `(id, nextLabel)` when a label edit is committed. When provided, label edits do not emit `onDataChange`.
130
+
128
131
  ### `allowDragAndDrop` (boolean, default `false`)
129
132
  Enables drag-and-drop. When `false`, drag handles are hidden and items cannot be reordered.
130
133
 
@@ -137,6 +140,12 @@ Enables inline label editing and add-item controls.
137
140
  ### `allowDelete` (boolean, default `false`)
138
141
  Shows a delete action for each item and removes the node (plus descendants).
139
142
 
143
+ ### `actionButtonsPosition` (`"start"` | `"end"`, default `"start"`)
144
+ Positions the action buttons within a row. `"end"` pushes the actions to the end of the row.
145
+
146
+ ### `maxLabelLength` (number)
147
+ Limits label width by character count and truncates with an ellipsis when exceeded.
148
+
140
149
  ### `useChevron` (boolean, default `false`)
141
150
  Uses a chevron control for expand/collapse instead of the checkbox toggle.
142
151
 
@@ -155,20 +164,35 @@ Limits how deep new items can be added. For example, `maxDepth={3}` allows at mo
155
164
  ### `addChildTooltip` (string)
156
165
  Tooltip copy for the add-child button.
157
166
 
158
- ### `addChildTooltipByLevel` (string[])
159
- Tooltip copy for add-child, keyed by depth. Overrides `addChildTooltip` when provided.
160
-
161
167
  ### `addSiblingTooltip` (string)
162
168
  Tooltip copy for the add-sibling button.
163
169
 
164
- ### `addSiblingTooltipByLevel` (string[])
165
- Tooltip copy for add-sibling, keyed by depth. Overrides `addSiblingTooltip` when provided.
166
-
167
170
  ### `deleteTooltip` (string)
168
171
  Tooltip copy for the delete button.
169
172
 
170
- ### `deleteTooltipByLevel` (string[])
171
- Tooltip copy for delete, keyed by depth. Overrides `deleteTooltip` when provided.
173
+ ### `levelConfig` (object)
174
+ Per-level configuration for editing, actions, and tooltips. Use `default` for global settings and `levels` to override by depth.
175
+ Values in `levelConfig` override `isEditable`, `allowDelete`, and tooltip props for the matching depth.
176
+
177
+ ```js
178
+ levelConfig={{
179
+ default: {
180
+ editable: true,
181
+ actions: { addChild: true, addSibling: true, delete: false },
182
+ tooltips: {
183
+ addChild: "Add child",
184
+ addSibling: "Add sibling",
185
+ delete: "Delete item",
186
+ },
187
+ },
188
+ levels: {
189
+ 0: {
190
+ editable: false,
191
+ tooltips: { addChild: "Add chapter" },
192
+ },
193
+ },
194
+ }}
195
+ ```
172
196
 
173
197
  ---
174
198
 
@@ -181,6 +205,7 @@ Tooltip copy for delete, keyed by depth. Overrides `deleteTooltip` when provided
181
205
  - `defaultExpanded` only seeds the initial state; use `expanded` for controlled expansion.
182
206
  - When `expanded` is provided, `onExpandedChange` is called with the next set of expanded ids.
183
207
  - Deleting a node removes the entire subtree and clears any selected/expanded state for those ids.
208
+ - `levelConfig` can override editability, actions, and tooltips per depth.
184
209
  - Drag-and-drop supports reordering within a level and moving items between levels.
185
210
  - Drag handle alignment is set so child handles align under the parent toggle.
186
211
 
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
 
3
- declare function TreeSelect({ data, onDataChange, allowDragAndDrop, allowMultiDrag, isEditable, allowDelete, useChevron, maxDepth, addChildTooltip, addSiblingTooltip, deleteTooltip, addChildTooltipByLevel, addSiblingTooltipByLevel, deleteTooltipByLevel, defaultExpanded, expanded, onExpandedChange, }: {
3
+ declare function TreeSelect({ data, onDataChange, allowDragAndDrop, allowMultiDrag, isEditable, allowDelete, useChevron, actionButtonsPosition, maxLabelLength, maxDepth, addChildTooltip, addSiblingTooltip, deleteTooltip, onLabelChange, levelConfig, defaultExpanded, expanded, onExpandedChange, }: {
4
4
  data: any;
5
5
  onDataChange: any;
6
6
  allowDragAndDrop?: boolean;
@@ -8,13 +8,14 @@ declare function TreeSelect({ data, onDataChange, allowDragAndDrop, allowMultiDr
8
8
  isEditable?: boolean;
9
9
  allowDelete?: boolean;
10
10
  useChevron?: boolean;
11
+ actionButtonsPosition?: string;
12
+ maxLabelLength: any;
11
13
  maxDepth: any;
12
14
  addChildTooltip: any;
13
15
  addSiblingTooltip: any;
14
16
  deleteTooltip: any;
15
- addChildTooltipByLevel: any;
16
- addSiblingTooltipByLevel: any;
17
- deleteTooltipByLevel: any;
17
+ onLabelChange: any;
18
+ levelConfig: any;
18
19
  defaultExpanded: any;
19
20
  expanded: any;
20
21
  onExpandedChange: any;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
 
3
- declare function TreeSelect({ data, onDataChange, allowDragAndDrop, allowMultiDrag, isEditable, allowDelete, useChevron, maxDepth, addChildTooltip, addSiblingTooltip, deleteTooltip, addChildTooltipByLevel, addSiblingTooltipByLevel, deleteTooltipByLevel, defaultExpanded, expanded, onExpandedChange, }: {
3
+ declare function TreeSelect({ data, onDataChange, allowDragAndDrop, allowMultiDrag, isEditable, allowDelete, useChevron, actionButtonsPosition, maxLabelLength, maxDepth, addChildTooltip, addSiblingTooltip, deleteTooltip, onLabelChange, levelConfig, defaultExpanded, expanded, onExpandedChange, }: {
4
4
  data: any;
5
5
  onDataChange: any;
6
6
  allowDragAndDrop?: boolean;
@@ -8,13 +8,14 @@ declare function TreeSelect({ data, onDataChange, allowDragAndDrop, allowMultiDr
8
8
  isEditable?: boolean;
9
9
  allowDelete?: boolean;
10
10
  useChevron?: boolean;
11
+ actionButtonsPosition?: string;
12
+ maxLabelLength: any;
11
13
  maxDepth: any;
12
14
  addChildTooltip: any;
13
15
  addSiblingTooltip: any;
14
16
  deleteTooltip: any;
15
- addChildTooltipByLevel: any;
16
- addSiblingTooltipByLevel: any;
17
- deleteTooltipByLevel: any;
17
+ onLabelChange: any;
18
+ levelConfig: any;
18
19
  defaultExpanded: any;
19
20
  expanded: any;
20
21
  onExpandedChange: any;