@underverse-ui/underverse 1.0.118 → 1.0.119

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/dist/index.d.cts CHANGED
@@ -1890,6 +1890,46 @@ interface CategoryTreeSelectBaseProps {
1890
1890
  minSearchLength?: number;
1891
1891
  /** Show a prompt instead of options while the query is shorter than `minSearchLength`. Default: `false`. */
1892
1892
  showSearchPromptWhenEmptyQuery?: boolean;
1893
+ /**
1894
+ * Render custom actions at the trailing edge of each tree row.
1895
+ *
1896
+ * @remarks
1897
+ * The returned node is placed inside the row flex container, after the label/content area.
1898
+ * Click events on the returned node are stopped from propagating to the row, so action buttons
1899
+ * do not accidentally trigger selection or expansion.
1900
+ *
1901
+ * @example
1902
+ * <CategoryTreeSelect
1903
+ * renderItemActions={(category) => (
1904
+ * <button onClick={() => handleEdit(category)}>Edit</button>
1905
+ * )}
1906
+ * />
1907
+ */
1908
+ renderItemActions?: (category: Category) => React__default.ReactNode;
1909
+ /**
1910
+ * Base left padding in rem applied to every node regardless of depth. Default: `0.75`.
1911
+ *
1912
+ * @remarks
1913
+ * Combined with `indentSize`, the final padding of a node at a given depth is:
1914
+ * `paddingLeft = level * indentSize + baseIndent` rem.
1915
+ *
1916
+ * @example
1917
+ * // Compact sidebar tree
1918
+ * <CategoryTreeSelect baseIndent={0.25} indentSize={0.75} />
1919
+ */
1920
+ baseIndent?: number;
1921
+ /**
1922
+ * Additional left padding in rem added per depth level. Default: `1`.
1923
+ *
1924
+ * @remarks
1925
+ * Set to a smaller value (e.g. `0.75`) to reduce the visual gap between
1926
+ * parent and child nodes without touching DOM styles.
1927
+ *
1928
+ * @example
1929
+ * // Compact sidebar tree
1930
+ * <CategoryTreeSelect baseIndent={0.25} indentSize={0.75} />
1931
+ */
1932
+ indentSize?: number;
1893
1933
  }
1894
1934
  /** Multi-select mode. This is the default when `singleSelect` is omitted. */
1895
1935
  interface CategoryTreeSelectMultiProps extends CategoryTreeSelectBaseProps {
package/dist/index.d.ts CHANGED
@@ -1890,6 +1890,46 @@ interface CategoryTreeSelectBaseProps {
1890
1890
  minSearchLength?: number;
1891
1891
  /** Show a prompt instead of options while the query is shorter than `minSearchLength`. Default: `false`. */
1892
1892
  showSearchPromptWhenEmptyQuery?: boolean;
1893
+ /**
1894
+ * Render custom actions at the trailing edge of each tree row.
1895
+ *
1896
+ * @remarks
1897
+ * The returned node is placed inside the row flex container, after the label/content area.
1898
+ * Click events on the returned node are stopped from propagating to the row, so action buttons
1899
+ * do not accidentally trigger selection or expansion.
1900
+ *
1901
+ * @example
1902
+ * <CategoryTreeSelect
1903
+ * renderItemActions={(category) => (
1904
+ * <button onClick={() => handleEdit(category)}>Edit</button>
1905
+ * )}
1906
+ * />
1907
+ */
1908
+ renderItemActions?: (category: Category) => React__default.ReactNode;
1909
+ /**
1910
+ * Base left padding in rem applied to every node regardless of depth. Default: `0.75`.
1911
+ *
1912
+ * @remarks
1913
+ * Combined with `indentSize`, the final padding of a node at a given depth is:
1914
+ * `paddingLeft = level * indentSize + baseIndent` rem.
1915
+ *
1916
+ * @example
1917
+ * // Compact sidebar tree
1918
+ * <CategoryTreeSelect baseIndent={0.25} indentSize={0.75} />
1919
+ */
1920
+ baseIndent?: number;
1921
+ /**
1922
+ * Additional left padding in rem added per depth level. Default: `1`.
1923
+ *
1924
+ * @remarks
1925
+ * Set to a smaller value (e.g. `0.75`) to reduce the visual gap between
1926
+ * parent and child nodes without touching DOM styles.
1927
+ *
1928
+ * @example
1929
+ * // Compact sidebar tree
1930
+ * <CategoryTreeSelect baseIndent={0.25} indentSize={0.75} />
1931
+ */
1932
+ indentSize?: number;
1893
1933
  }
1894
1934
  /** Multi-select mode. This is the default when `singleSelect` is omitted. */
1895
1935
  interface CategoryTreeSelectMultiProps extends CategoryTreeSelectBaseProps {
package/dist/index.js CHANGED
@@ -17466,6 +17466,9 @@ function CategoryTreeSelect(props) {
17466
17466
  searchDebounceMs = 0,
17467
17467
  minSearchLength = 0,
17468
17468
  showSearchPromptWhenEmptyQuery = false,
17469
+ baseIndent = TREE_NODE_BASE_PADDING_REM,
17470
+ indentSize = TREE_NODE_INDENT_REM,
17471
+ renderItemActions,
17469
17472
  singleSelect = false
17470
17473
  } = props;
17471
17474
  const [isOpen, setIsOpen] = useState31(false);
@@ -17769,7 +17772,7 @@ function CategoryTreeSelect(props) {
17769
17772
  // Selected state - đồng bộ cho tất cả
17770
17773
  !viewOnly && isSelected && "bg-accent/40"
17771
17774
  ),
17772
- style: { paddingLeft: `${level * TREE_NODE_INDENT_REM + TREE_NODE_BASE_PADDING_REM}rem` },
17775
+ style: { paddingLeft: `${level * indentSize + baseIndent}rem` },
17773
17776
  children: [
17774
17777
  hasChildren ? /* @__PURE__ */ jsx50(
17775
17778
  "button",
@@ -17814,7 +17817,8 @@ function CategoryTreeSelect(props) {
17814
17817
  ),
17815
17818
  hasChildren && !isSelected && /* @__PURE__ */ jsx50("span", { className: "ml-auto shrink-0 text-[10px] font-medium text-muted-foreground/50 bg-muted/50 px-1.5 py-0.5 rounded-md", children: children.length })
17816
17819
  ] })
17817
- )
17820
+ ),
17821
+ renderItemActions && /* @__PURE__ */ jsx50("div", { className: "shrink-0 ml-auto", onClick: (e) => e.stopPropagation(), children: renderItemActions(category) })
17818
17822
  ]
17819
17823
  }
17820
17824
  ),