@djangocfg/ui-tools 2.1.429 → 2.1.431

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.
@@ -130,6 +130,18 @@ type TreeBuiltinAction = 'open' | 'rename' | 'duplicate' | 'cut' | 'copy' | 'pas
130
130
  type TreeDensity = 'compact' | 'cozy' | 'comfortable';
131
131
  type TreeAccentIntensity = 'subtle' | 'default' | 'strong';
132
132
  type TreeRadius = 'none' | 'sm' | 'md';
133
+ /**
134
+ * High-level look. Sets sensible defaults for icons / row sizing / the
135
+ * active indicator; any individual `TreeAppearance` field still overrides.
136
+ *
137
+ * - `'explorer'` (default) — classic file/folder tree: leaf + folder
138
+ * icons, fixed single-line rows, VSCode active-bar.
139
+ * - `'list'` — macOS-sidebar / chat-history look: no icons (chevron
140
+ * only on groups), auto-height rows (multi-line label friendly), quiet
141
+ * selection (no active-bar).
142
+ */
143
+ type TreeVariant = 'explorer' | 'list';
144
+ type TreeRowSizing = 'fixed' | 'auto';
133
145
  /**
134
146
  * Cosmetic configuration. Every field is optional; missing values fall
135
147
  * back to the `cozy` preset (a comfortable VSCode-Explorer-like density).
@@ -162,6 +174,21 @@ interface TreeAppearance {
162
174
  * Mimics the VSCode active-tab indicator. Default: `true`.
163
175
  */
164
176
  showActiveIndicator?: boolean;
177
+ /**
178
+ * High-level look. Default: `'explorer'`. Sets defaults for the three
179
+ * fields below; pass any of them explicitly to override the variant.
180
+ */
181
+ variant?: TreeVariant;
182
+ /** Hide per-leaf icons (chevron + label only). Variant default. */
183
+ hideLeafIcons?: boolean;
184
+ /** Hide folder icons too (chevron stays). Variant default. */
185
+ hideFolderIcons?: boolean;
186
+ /**
187
+ * `'fixed'` — every row is exactly `rowHeight` (single-line explorer).
188
+ * `'auto'` — `rowHeight` is a *minimum*; rows grow to fit a multi-line
189
+ * label (title + meta). Variant default.
190
+ */
191
+ rowSizing?: TreeRowSizing;
165
192
  }
166
193
  interface ResolvedAppearance {
167
194
  density: TreeDensity;
@@ -175,6 +202,9 @@ interface ResolvedAppearance {
175
202
  radius: TreeRadius;
176
203
  indentGuideOpacity: number;
177
204
  showActiveIndicator: boolean;
205
+ hideLeafIcons: boolean;
206
+ hideFolderIcons: boolean;
207
+ rowSizing: TreeRowSizing;
178
208
  }
179
209
  declare const DEFAULT_TREE_APPEARANCE: ResolvedAppearance;
180
210
  /**
@@ -972,4 +1002,4 @@ interface TreeEmptyAreaProps {
972
1002
  */
973
1003
  declare function TreeEmptyArea({ className }: TreeEmptyAreaProps): react_jsx_runtime.JSX.Element;
974
1004
 
975
- export { type ChildCache, type ChildEntry, type ChildEntryStatus, DEFAULT_TREE_APPEARANCE, DEFAULT_TREE_LABELS, type DemoNode, FinderTree, FlatRow, type FlattenInput, type PersistedTreeState, type ResolvedAppearance, TREE_DND_MIME, TreeRoot as Tree, type TreeAccentIntensity, type TreeActionsHandle, type TreeActivateOptions, type TreeActivationMode, type TreeAdapter, type TreeAppearance, type TreeBuiltinAction, TreeChevron, type TreeChevronProps, TreeContent, type TreeContentProps, TreeContextMenuActionsResolver, TreeContextMenuItem, TreeContextMenuSlot, type TreeContextValue, type TreeDensity, TreeDropIndicator, type TreeDropIndicatorProps, TreeEmpty, TreeEmptyArea, type TreeEmptyAreaProps, type TreeEmptyProps, TreeError, type TreeErrorProps, TreeIcon, type TreeIconProps, TreeIndentGuides, type TreeIndentGuidesProps, TreeItemId, TreeLabel, type TreeLabelProps, type TreeLabels, type TreeLoadChildren, type TreeMovePosition, TreeNode, TreeProvider, type TreeProviderProps, type TreeRadius, TreeRenameInput, type TreeRenameInputProps, TreeRoot, type TreeRootProps, TreeRow, type TreeRowProps, TreeRowRenderProps, TreeRowSlot, TreeSearchInput, type TreeSearchInputProps, type TreeSelectionMode, TreeSkeleton, type TreeSkeletonProps, type UseTreeFinderHotkeysOptions, type UseTreeKeyboardOptions, type UseTreeTypeAheadOptions, appearanceToStyle, autoSelectRange, clearTreeState, createChildCache, createDemoTree, TreeRoot as default, defaultCanDrop, flattenTree, loadTreeState, resolveAppearance, resolveChildren, resolveDropZone, saveTreeState, splitFileName, useTreeActions, useTreeClipboard, useTreeContext, useTreeDnd, useTreeExpansion, useTreeFinderHotkeys, useTreeFocus, useTreeKeyboard, useTreeLabels, useTreeRename, useTreeRows, useTreeSearch, useTreeSelection, useTreeTypeAhead };
1005
+ export { type ChildCache, type ChildEntry, type ChildEntryStatus, DEFAULT_TREE_APPEARANCE, DEFAULT_TREE_LABELS, type DemoNode, FinderTree, FlatRow, type FlattenInput, type PersistedTreeState, type ResolvedAppearance, TREE_DND_MIME, TreeRoot as Tree, type TreeAccentIntensity, type TreeActionsHandle, type TreeActivateOptions, type TreeActivationMode, type TreeAdapter, type TreeAppearance, type TreeBuiltinAction, TreeChevron, type TreeChevronProps, TreeContent, type TreeContentProps, TreeContextMenuActionsResolver, TreeContextMenuItem, TreeContextMenuSlot, type TreeContextValue, type TreeDensity, TreeDropIndicator, type TreeDropIndicatorProps, TreeEmpty, TreeEmptyArea, type TreeEmptyAreaProps, type TreeEmptyProps, TreeError, type TreeErrorProps, TreeIcon, type TreeIconProps, TreeIndentGuides, type TreeIndentGuidesProps, TreeItemId, TreeLabel, type TreeLabelProps, type TreeLabels, type TreeLoadChildren, type TreeMovePosition, TreeNode, TreeProvider, type TreeProviderProps, type TreeRadius, TreeRenameInput, type TreeRenameInputProps, TreeRoot, type TreeRootProps, TreeRow, type TreeRowProps, TreeRowRenderProps, type TreeRowSizing, TreeRowSlot, TreeSearchInput, type TreeSearchInputProps, type TreeSelectionMode, TreeSkeleton, type TreeSkeletonProps, type TreeVariant, type UseTreeFinderHotkeysOptions, type UseTreeKeyboardOptions, type UseTreeTypeAheadOptions, appearanceToStyle, autoSelectRange, clearTreeState, createChildCache, createDemoTree, TreeRoot as default, defaultCanDrop, flattenTree, loadTreeState, resolveAppearance, resolveChildren, resolveDropZone, saveTreeState, splitFileName, useTreeActions, useTreeClipboard, useTreeContext, useTreeDnd, useTreeExpansion, useTreeFinderHotkeys, useTreeFocus, useTreeKeyboard, useTreeLabels, useTreeRename, useTreeRows, useTreeSearch, useTreeSelection, useTreeTypeAhead };
@@ -130,6 +130,18 @@ type TreeBuiltinAction = 'open' | 'rename' | 'duplicate' | 'cut' | 'copy' | 'pas
130
130
  type TreeDensity = 'compact' | 'cozy' | 'comfortable';
131
131
  type TreeAccentIntensity = 'subtle' | 'default' | 'strong';
132
132
  type TreeRadius = 'none' | 'sm' | 'md';
133
+ /**
134
+ * High-level look. Sets sensible defaults for icons / row sizing / the
135
+ * active indicator; any individual `TreeAppearance` field still overrides.
136
+ *
137
+ * - `'explorer'` (default) — classic file/folder tree: leaf + folder
138
+ * icons, fixed single-line rows, VSCode active-bar.
139
+ * - `'list'` — macOS-sidebar / chat-history look: no icons (chevron
140
+ * only on groups), auto-height rows (multi-line label friendly), quiet
141
+ * selection (no active-bar).
142
+ */
143
+ type TreeVariant = 'explorer' | 'list';
144
+ type TreeRowSizing = 'fixed' | 'auto';
133
145
  /**
134
146
  * Cosmetic configuration. Every field is optional; missing values fall
135
147
  * back to the `cozy` preset (a comfortable VSCode-Explorer-like density).
@@ -162,6 +174,21 @@ interface TreeAppearance {
162
174
  * Mimics the VSCode active-tab indicator. Default: `true`.
163
175
  */
164
176
  showActiveIndicator?: boolean;
177
+ /**
178
+ * High-level look. Default: `'explorer'`. Sets defaults for the three
179
+ * fields below; pass any of them explicitly to override the variant.
180
+ */
181
+ variant?: TreeVariant;
182
+ /** Hide per-leaf icons (chevron + label only). Variant default. */
183
+ hideLeafIcons?: boolean;
184
+ /** Hide folder icons too (chevron stays). Variant default. */
185
+ hideFolderIcons?: boolean;
186
+ /**
187
+ * `'fixed'` — every row is exactly `rowHeight` (single-line explorer).
188
+ * `'auto'` — `rowHeight` is a *minimum*; rows grow to fit a multi-line
189
+ * label (title + meta). Variant default.
190
+ */
191
+ rowSizing?: TreeRowSizing;
165
192
  }
166
193
  interface ResolvedAppearance {
167
194
  density: TreeDensity;
@@ -175,6 +202,9 @@ interface ResolvedAppearance {
175
202
  radius: TreeRadius;
176
203
  indentGuideOpacity: number;
177
204
  showActiveIndicator: boolean;
205
+ hideLeafIcons: boolean;
206
+ hideFolderIcons: boolean;
207
+ rowSizing: TreeRowSizing;
178
208
  }
179
209
  declare const DEFAULT_TREE_APPEARANCE: ResolvedAppearance;
180
210
  /**
@@ -972,4 +1002,4 @@ interface TreeEmptyAreaProps {
972
1002
  */
973
1003
  declare function TreeEmptyArea({ className }: TreeEmptyAreaProps): react_jsx_runtime.JSX.Element;
974
1004
 
975
- export { type ChildCache, type ChildEntry, type ChildEntryStatus, DEFAULT_TREE_APPEARANCE, DEFAULT_TREE_LABELS, type DemoNode, FinderTree, FlatRow, type FlattenInput, type PersistedTreeState, type ResolvedAppearance, TREE_DND_MIME, TreeRoot as Tree, type TreeAccentIntensity, type TreeActionsHandle, type TreeActivateOptions, type TreeActivationMode, type TreeAdapter, type TreeAppearance, type TreeBuiltinAction, TreeChevron, type TreeChevronProps, TreeContent, type TreeContentProps, TreeContextMenuActionsResolver, TreeContextMenuItem, TreeContextMenuSlot, type TreeContextValue, type TreeDensity, TreeDropIndicator, type TreeDropIndicatorProps, TreeEmpty, TreeEmptyArea, type TreeEmptyAreaProps, type TreeEmptyProps, TreeError, type TreeErrorProps, TreeIcon, type TreeIconProps, TreeIndentGuides, type TreeIndentGuidesProps, TreeItemId, TreeLabel, type TreeLabelProps, type TreeLabels, type TreeLoadChildren, type TreeMovePosition, TreeNode, TreeProvider, type TreeProviderProps, type TreeRadius, TreeRenameInput, type TreeRenameInputProps, TreeRoot, type TreeRootProps, TreeRow, type TreeRowProps, TreeRowRenderProps, TreeRowSlot, TreeSearchInput, type TreeSearchInputProps, type TreeSelectionMode, TreeSkeleton, type TreeSkeletonProps, type UseTreeFinderHotkeysOptions, type UseTreeKeyboardOptions, type UseTreeTypeAheadOptions, appearanceToStyle, autoSelectRange, clearTreeState, createChildCache, createDemoTree, TreeRoot as default, defaultCanDrop, flattenTree, loadTreeState, resolveAppearance, resolveChildren, resolveDropZone, saveTreeState, splitFileName, useTreeActions, useTreeClipboard, useTreeContext, useTreeDnd, useTreeExpansion, useTreeFinderHotkeys, useTreeFocus, useTreeKeyboard, useTreeLabels, useTreeRename, useTreeRows, useTreeSearch, useTreeSelection, useTreeTypeAhead };
1005
+ export { type ChildCache, type ChildEntry, type ChildEntryStatus, DEFAULT_TREE_APPEARANCE, DEFAULT_TREE_LABELS, type DemoNode, FinderTree, FlatRow, type FlattenInput, type PersistedTreeState, type ResolvedAppearance, TREE_DND_MIME, TreeRoot as Tree, type TreeAccentIntensity, type TreeActionsHandle, type TreeActivateOptions, type TreeActivationMode, type TreeAdapter, type TreeAppearance, type TreeBuiltinAction, TreeChevron, type TreeChevronProps, TreeContent, type TreeContentProps, TreeContextMenuActionsResolver, TreeContextMenuItem, TreeContextMenuSlot, type TreeContextValue, type TreeDensity, TreeDropIndicator, type TreeDropIndicatorProps, TreeEmpty, TreeEmptyArea, type TreeEmptyAreaProps, type TreeEmptyProps, TreeError, type TreeErrorProps, TreeIcon, type TreeIconProps, TreeIndentGuides, type TreeIndentGuidesProps, TreeItemId, TreeLabel, type TreeLabelProps, type TreeLabels, type TreeLoadChildren, type TreeMovePosition, TreeNode, TreeProvider, type TreeProviderProps, type TreeRadius, TreeRenameInput, type TreeRenameInputProps, TreeRoot, type TreeRootProps, TreeRow, type TreeRowProps, TreeRowRenderProps, type TreeRowSizing, TreeRowSlot, TreeSearchInput, type TreeSearchInputProps, type TreeSelectionMode, TreeSkeleton, type TreeSkeletonProps, type TreeVariant, type UseTreeFinderHotkeysOptions, type UseTreeKeyboardOptions, type UseTreeTypeAheadOptions, appearanceToStyle, autoSelectRange, clearTreeState, createChildCache, createDemoTree, TreeRoot as default, defaultCanDrop, flattenTree, loadTreeState, resolveAppearance, resolveChildren, resolveDropZone, saveTreeState, splitFileName, useTreeActions, useTreeClipboard, useTreeContext, useTreeDnd, useTreeExpansion, useTreeFinderHotkeys, useTreeFocus, useTreeKeyboard, useTreeLabels, useTreeRename, useTreeRows, useTreeSearch, useTreeSelection, useTreeTypeAhead };
@@ -118,6 +118,20 @@ var DENSITY_PRESETS = {
118
118
  cozy: { rowHeight: 28, iconSize: 16, fontSize: 13, gap: 8 },
119
119
  comfortable: { rowHeight: 32, iconSize: 16, fontSize: 14, gap: 8 }
120
120
  };
121
+ var VARIANT_DEFAULTS = {
122
+ explorer: {
123
+ hideLeafIcons: false,
124
+ hideFolderIcons: false,
125
+ rowSizing: "fixed",
126
+ showActiveIndicator: true
127
+ },
128
+ list: {
129
+ hideLeafIcons: true,
130
+ hideFolderIcons: true,
131
+ rowSizing: "auto",
132
+ showActiveIndicator: false
133
+ }
134
+ };
121
135
  var DEFAULT_TREE_APPEARANCE = {
122
136
  density: "cozy",
123
137
  ...DENSITY_PRESETS.cozy,
@@ -126,12 +140,14 @@ var DEFAULT_TREE_APPEARANCE = {
126
140
  accent: "default",
127
141
  radius: "sm",
128
142
  indentGuideOpacity: 0.4,
129
- showActiveIndicator: true
143
+ ...VARIANT_DEFAULTS.explorer
130
144
  };
131
145
  function resolveAppearance(input, outerIndent) {
132
146
  if (!input && outerIndent === void 0) return DEFAULT_TREE_APPEARANCE;
133
147
  const density = input?.density ?? "cozy";
134
148
  const preset = DENSITY_PRESETS[density];
149
+ const variant = input?.variant ?? "explorer";
150
+ const v = VARIANT_DEFAULTS[variant];
135
151
  return {
136
152
  density,
137
153
  rowHeight: input?.rowHeight ?? preset.rowHeight,
@@ -143,7 +159,10 @@ function resolveAppearance(input, outerIndent) {
143
159
  accent: input?.accent ?? DEFAULT_TREE_APPEARANCE.accent,
144
160
  radius: input?.radius ?? DEFAULT_TREE_APPEARANCE.radius,
145
161
  indentGuideOpacity: input?.indentGuideOpacity ?? DEFAULT_TREE_APPEARANCE.indentGuideOpacity,
146
- showActiveIndicator: input?.showActiveIndicator ?? DEFAULT_TREE_APPEARANCE.showActiveIndicator
162
+ showActiveIndicator: input?.showActiveIndicator ?? v.showActiveIndicator,
163
+ hideLeafIcons: input?.hideLeafIcons ?? v.hideLeafIcons,
164
+ hideFolderIcons: input?.hideFolderIcons ?? v.hideFolderIcons,
165
+ rowSizing: input?.rowSizing ?? v.rowSizing
147
166
  };
148
167
  }
149
168
  __name(resolveAppearance, "resolveAppearance");
@@ -1048,10 +1067,15 @@ function useResolvedMenu(opts) {
1048
1067
  ]);
1049
1068
  }
1050
1069
  __name(useResolvedMenu, "useResolvedMenu");
1051
- function renderItemsAsContextMenu(rowProps, items, trigger) {
1052
- return /* @__PURE__ */ jsxs(ContextMenu, { children: [
1070
+ function RowContextMenu({
1071
+ rowProps,
1072
+ items,
1073
+ trigger
1074
+ }) {
1075
+ const [open, setOpen] = useState(false);
1076
+ return /* @__PURE__ */ jsxs(ContextMenu, { onOpenChange: setOpen, children: [
1053
1077
  /* @__PURE__ */ jsx(ContextMenuTrigger, { asChild: true, children: trigger }),
1054
- /* @__PURE__ */ jsx(ContextMenuContent, { children: items.map((item, idx) => {
1078
+ open ? /* @__PURE__ */ jsx(ContextMenuContent, { children: items.map((item, idx) => {
1055
1079
  if (item === "separator") {
1056
1080
  return /* @__PURE__ */ jsx(ContextMenuSeparator, {}, `sep-${idx}`);
1057
1081
  }
@@ -1070,9 +1094,13 @@ function renderItemsAsContextMenu(rowProps, items, trigger) {
1070
1094
  },
1071
1095
  item.id
1072
1096
  );
1073
- }) })
1097
+ }) }) : null
1074
1098
  ] });
1075
1099
  }
1100
+ __name(RowContextMenu, "RowContextMenu");
1101
+ function renderItemsAsContextMenu(rowProps, items, trigger) {
1102
+ return /* @__PURE__ */ jsx(RowContextMenu, { rowProps, items, trigger });
1103
+ }
1076
1104
  __name(renderItemsAsContextMenu, "renderItemsAsContextMenu");
1077
1105
  function tidyMenuItems(items) {
1078
1106
  const out = [];
@@ -1967,7 +1995,14 @@ function TreeRowRaw({ row, className }) {
1967
1995
  tabIndex: -1,
1968
1996
  style: {
1969
1997
  paddingLeft: 6 + level * appearance.indent,
1970
- height: "var(--tree-row-height)",
1998
+ // `auto` sizing lets a multi-line label (e.g. title + meta in a
1999
+ // chat-history list) grow the row instead of overflowing a fixed
2000
+ // height. `fixed` keeps the classic single-line explorer row.
2001
+ ...appearance.rowSizing === "auto" ? {
2002
+ minHeight: "var(--tree-row-height)",
2003
+ paddingTop: 4,
2004
+ paddingBottom: 4
2005
+ } : { height: "var(--tree-row-height)" },
1971
2006
  gap: "var(--tree-gap)"
1972
2007
  },
1973
2008
  ...dnd.active ? draggable.listeners : {},
@@ -2018,7 +2053,7 @@ function TreeRowRaw({ row, className }) {
2018
2053
  style: { width: "var(--tree-icon-size)", height: "var(--tree-icon-size)" },
2019
2054
  className: "shrink-0 animate-spin text-muted-foreground/70"
2020
2055
  }
2021
- ) : renderIcon ? renderIcon(slot) : /* @__PURE__ */ jsx(TreeIcon, { isFolder, isExpanded }),
2056
+ ) : renderIcon ? renderIcon(slot) : (isFolder ? appearance.hideFolderIcons : appearance.hideLeafIcons) ? null : /* @__PURE__ */ jsx(TreeIcon, { isFolder, isExpanded }),
2022
2057
  /* @__PURE__ */ jsx(
2023
2058
  "span",
2024
2059
  {