@andreyfedkovich/cozy-ui 0.2.2 → 0.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.
package/README.md CHANGED
@@ -383,10 +383,13 @@ import { TreeDialogSelect } from "@andreyfedkovich/cozy-ui";
383
383
  nodes: await fetchChildren(parentId, search),
384
384
  })}
385
385
  searchNodes={async (search) => ({ matches: await searchTreeWithPath(search) })}
386
+ leafConfirmOnly
386
387
  onChange={(node) => console.log(node)}
387
388
  />;
388
389
  ```
389
390
 
391
+ With **`leafConfirmOnly`**, the confirm button in the dialog stays disabled until a row is selected and that node’s `hasChildren` is not strictly `true` (only leaves can be confirmed). Omit the prop to allow confirming any selected node, including branches.
392
+
390
393
  #### `InputCaption`
391
394
 
392
395
  Small caption row under an input — supports neutral, error, and success tones.
@@ -649,7 +649,7 @@ declare type TooltipTarget = string | HTMLElement | RefObject<HTMLElement | null
649
649
 
650
650
  export declare type TooltipTrigger = "hover" | "click";
651
651
 
652
- export declare const TreeDialogSelect: <T, S extends string | number>({ value, placeholder, loadChildren: loadChildrenProp, loadNodes, searchNodes, onChange, onClear, label, title, searchPlaceholder, selectButtonText, closeButtonText, confirmButtonText, debounceMs, disabled, error, className, inputClassName, selectedOptionRender, nodeRender, }: TreeDialogSelectProps<T, S>) => JSX.Element;
652
+ export declare const TreeDialogSelect: <T, S extends string | number>({ value, placeholder, loadChildren: loadChildrenProp, loadNodes, searchNodes, onChange, onClear, label, title, searchPlaceholder, selectButtonText, closeButtonText, confirmButtonText, debounceMs, disabled, error, className, inputClassName, selectedOptionRender, nodeRender, leafConfirmOnly, }: TreeDialogSelectProps<T, S>) => JSX.Element;
653
653
 
654
654
  /** Pass either {@link loadNodes} or {@link loadChildren} (deprecated alias). */
655
655
  export declare type TreeDialogSelectProps<T, S extends string | number> = TreeDialogSelectShared<T, S> & ({
@@ -679,6 +679,11 @@ declare interface TreeDialogSelectShared<T, S extends string | number> {
679
679
  inputClassName?: string;
680
680
  selectedOptionRender?: (node: TreeNode<T, S>) => ReactNode;
681
681
  nodeRender?: (node: TreeNode<T, S>) => ReactNode;
682
+ /**
683
+ * When true, the dialog confirm button stays disabled until a node is selected and
684
+ * {@link TreeNode.hasChildren} is not strictly `true` (confirm leaf nodes only).
685
+ */
686
+ leafConfirmOnly?: boolean;
682
687
  }
683
688
 
684
689
  declare type TreeLoader<T, S extends string | number> = (params: TreeLoadParams<S>) => Promise<TreeLoadResult<T, S>>;