dawn-ui-react 1.0.0-alpha.1 → 1.0.0-alpha.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.
Files changed (45) hide show
  1. package/dist/{Input-DXDwtOqf.js → Input-CcHtcKpV.js} +4 -4
  2. package/dist/{clamp-CYKyjuJR.js → clamp-CKgqaxcU.js} +50 -50
  3. package/dist/components/badge/badge.d.ts +1 -1
  4. package/dist/components/badge/badge.types.d.ts +1 -0
  5. package/dist/components/drawer/drawer-close.d.ts +2 -0
  6. package/dist/components/drawer/drawer-content.d.ts +2 -0
  7. package/dist/components/drawer/drawer-description.d.ts +2 -0
  8. package/dist/components/drawer/drawer-header.d.ts +2 -0
  9. package/dist/components/drawer/drawer-popup.d.ts +2 -0
  10. package/dist/components/drawer/drawer-provider.d.ts +2 -0
  11. package/dist/components/drawer/drawer-title.d.ts +2 -0
  12. package/dist/components/drawer/drawer-trigger.d.ts +2 -0
  13. package/dist/components/drawer/drawer.d.ts +2 -0
  14. package/dist/components/drawer/drawer.types.d.ts +10 -0
  15. package/dist/components/drawer/index.d.ts +10 -0
  16. package/dist/components/index.d.ts +1 -0
  17. package/dist/components/input-otp/index.d.ts +2 -1
  18. package/dist/components/input-otp/input-otp-separator.d.ts +2 -0
  19. package/dist/components/input-otp/input-otp-slot.d.ts +1 -1
  20. package/dist/components/input-otp/input-otp.types.d.ts +4 -3
  21. package/dist/components/layer-tree/index.d.ts +4 -1
  22. package/dist/components/layer-tree/layer-tree-body.d.ts +1 -1
  23. package/dist/components/layer-tree/layer-tree-footer.d.ts +2 -0
  24. package/dist/components/layer-tree/layer-tree-node-toggle.d.ts +1 -1
  25. package/dist/components/layer-tree/layer-tree-node.d.ts +1 -1
  26. package/dist/components/layer-tree/layer-tree-row.d.ts +1 -1
  27. package/dist/components/layer-tree/layer-tree-sort.d.ts +4 -0
  28. package/dist/components/layer-tree/layer-tree-utils.d.ts +83 -0
  29. package/dist/components/layer-tree/layer-tree.d.ts +9 -4
  30. package/dist/components/layer-tree/layer-tree.types.d.ts +11 -4
  31. package/dist/dawn-ui-react.js +12667 -7026
  32. package/dist/dawn-ui-react.umd.cjs +71 -24
  33. package/dist/{field-errors-DVQtEKG3.js → field-errors-CA0345jw.js} +1 -1
  34. package/dist/{field-input-group-CzX_hAjq.js → field-input-group-BhLWbbuz.js} +2 -2
  35. package/dist/{field-input-group-input-micw-J2Y.js → field-input-group-input-E_r5HrPw.js} +2 -2
  36. package/dist/{field-input-Doplzz0V.js → field-input-qIw9X6Ab.js} +3 -3
  37. package/dist/{field-label-C2atREm0.js → field-label-crBMOJm1.js} +1 -1
  38. package/dist/{field-select--mY7GbNz.js → field-select-BCO8NSzS.js} +427 -429
  39. package/dist/{field-slider-D54-Z8Ds.js → field-slider-BhSg1byn.js} +303 -303
  40. package/dist/{form-context-DqrRdk0d.js → form-context-DScGBFYs.js} +29 -29
  41. package/dist/{input-group-DgFUfXr7.js → input-group-BlPsN5Zd.js} +1 -1
  42. package/dist/{input-group-input-DNZQ6g-3.js → input-group-input-D-x5ovI-.js} +1 -1
  43. package/dist/{input.types-D8b-1Bcm.js → input.types-DS4BNmw3.js} +1 -1
  44. package/dist/{useLabelableId-BaWKrZ8_.js → useLabelableId-BsYhJQW7.js} +51 -51
  45. package/package.json +23 -24
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Base constraint for tree node data types used by layer tree utilities.
3
+ */
4
+ export type LayerTreeNodeData = {
5
+ id: string;
6
+ children?: LayerTreeNodeData[];
7
+ };
8
+ /**
9
+ * Recursively searches for a node by ID in a nested tree structure.
10
+ *
11
+ * @param nodes - The array of nodes to search through
12
+ * @param nodeId - The ID of the node to find
13
+ * @returns The matching node or `null` if not found
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * const node = findLayerTreeNode(layers, 'layer-001')
18
+ * if (node) console.log(node.name)
19
+ * ```
20
+ */
21
+ export declare const findLayerTreeNode: <TData extends LayerTreeNodeData>(nodes: TData[], nodeId: string) => TData | null;
22
+ /**
23
+ * Removes a node from a nested tree structure by ID.
24
+ *
25
+ * @param nodes - The array of nodes to remove from
26
+ * @param nodeId - The ID of the node to remove
27
+ * @returns An object containing the updated tree and the removed node (if found)
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * const { nextNodes, removedNode } = removeLayerTreeNode(layers, 'layer-001')
32
+ * if (removedNode) setLayers(nextNodes)
33
+ * ```
34
+ */
35
+ export declare const removeLayerTreeNode: <TData extends LayerTreeNodeData>(nodes: TData[], nodeId: string) => {
36
+ nextNodes: TData[];
37
+ removedNode: TData | null;
38
+ };
39
+ /**
40
+ * Inserts a node as a child of the specified folder node.
41
+ *
42
+ * @param nodes - The array of nodes to search through
43
+ * @param folderId - The ID of the folder to insert into
44
+ * @param nodeToInsert - The node to insert
45
+ * @returns A new tree with the node inserted
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * const newTree = insertLayerTreeNode(layers, 'folder-001', newLayer)
50
+ * setLayers(newTree)
51
+ * ```
52
+ */
53
+ export declare const insertLayerTreeNode: <TData extends LayerTreeNodeData>(nodes: TData[], folderId: string, nodeToInsert: TData) => TData[];
54
+ /**
55
+ * Moves a node from its current position into a target folder.
56
+ * Prevents circular references by checking if target is a descendant of source.
57
+ *
58
+ * @param nodes - The array of nodes
59
+ * @param sourceId - The ID of the node to move
60
+ * @param targetId - The ID of the folder to move into
61
+ * @returns A new tree with the node moved, or the original tree if the move is invalid
62
+ *
63
+ * @example
64
+ * ```ts
65
+ * const newTree = moveLayerTreeNode(layers, 'layer-001', 'folder-002')
66
+ * setLayers(newTree)
67
+ * ```
68
+ */
69
+ export declare const moveLayerTreeNode: <TData extends LayerTreeNodeData>(nodes: TData[], sourceId: string, targetId: string) => TData[];
70
+ /**
71
+ * Moves a node to the root level of the tree.
72
+ *
73
+ * @param nodes - The array of nodes
74
+ * @param sourceId - The ID of the node to move
75
+ * @returns A new tree with the node at root level
76
+ *
77
+ * @example
78
+ * ```ts
79
+ * const newTree = moveLayerTreeNodeToRoot(layers, 'layer-001')
80
+ * setLayers(newTree)
81
+ * ```
82
+ */
83
+ export declare const moveLayerTreeNodeToRoot: <TData extends LayerTreeNodeData>(nodes: TData[], sourceId: string) => TData[];
@@ -1,5 +1,10 @@
1
- import { LayerTreeProps } from './layer-tree.types';
2
- type LayerTreeContextType = LayerTreeProps;
3
- export declare const LayerTree: ({ table, className, children, ref, ...props }: LayerTreeProps) => import("react/jsx-runtime").JSX.Element;
4
- export declare const useLayerTree: () => LayerTreeContextType;
1
+ import { default as React } from 'react';
2
+ import { LayerTreeDataSet, LayerTreeProps } from './layer-tree.types';
3
+ type LayerTreeContextType<TData> = LayerTreeProps<TData> & {
4
+ dataSet: LayerTreeDataSet<TData>;
5
+ setDataSet: React.Dispatch<React.SetStateAction<LayerTreeDataSet<TData>>>;
6
+ draggingNodeId: string | null;
7
+ };
8
+ export declare const LayerTree: <TData>({ table, dataSet, setDataSet, className, children, ref, ...props }: LayerTreeProps<TData>) => import("react/jsx-runtime").JSX.Element;
9
+ export declare const useLayerTree: <TData>() => LayerTreeContextType<TData>;
5
10
  export {};
@@ -1,24 +1,31 @@
1
1
  import { Button } from '../button';
2
2
  import { Row, Table as TanstackTable } from '@tanstack/react-table';
3
- export type LayerTreeProps<TData = any> = React.ComponentProps<'div'> & {
3
+ export type LayerTreeDataSet<TData> = {
4
+ data: TData[];
5
+ };
6
+ export type LayerTreeProps<TData> = React.ComponentProps<'div'> & {
4
7
  table: TanstackTable<TData>;
8
+ dataSet?: LayerTreeDataSet<TData>;
9
+ setDataSet?: React.Dispatch<React.SetStateAction<LayerTreeDataSet<TData>>>;
5
10
  };
6
11
  export type LayerTreeBodyProps = React.ComponentProps<'div'>;
7
- export type LayerTreeRowProps<TData = any> = React.ComponentProps<'div'> & {
12
+ export type LayerTreeRowProps<TData> = React.ComponentProps<'div'> & {
8
13
  row: Row<TData>;
9
14
  };
10
- export type LayerTreeNodeToggleProps<TData = any> = Omit<React.ComponentProps<typeof Button>, 'value' | 'children'> & {
15
+ export type LayerTreeNodeToggleProps<TData> = Omit<React.ComponentProps<typeof Button>, 'value' | 'children'> & {
11
16
  value: boolean;
12
17
  columnId: {
13
18
  [K in keyof TData]: TData[K] extends boolean ? K : never;
14
19
  }[keyof TData];
15
20
  rows: Row<TData>[];
16
- onToggle: () => void;
17
21
  children: (value: boolean) => React.ReactNode;
18
22
  };
19
23
  export type LayerTreeNodeProps<TData> = React.ComponentProps<'button'> & {
20
24
  row: Row<TData>;
21
25
  icon?: React.ElementType;
26
+ dndDisabled?: boolean;
22
27
  };
23
28
  export type LayerTreeSearchProps = React.ComponentProps<'input'>;
24
29
  export type LayerTreeExpandAllProps = React.ComponentProps<'button'>;
30
+ export type LayerTreeNodeActionProps = React.ComponentProps<'button'>;
31
+ export type LayerTreeFooterProps = React.ComponentProps<'div'>;