caplink-saas-ui-shared-component-library 0.4.8 → 0.5.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.
Files changed (41) hide show
  1. package/dist/components/dag/hooks/index.d.ts +5 -0
  2. package/dist/components/dag/hooks/use-dag.d.ts +57 -0
  3. package/dist/components/dag/hooks/use-get-adjacent-nodes.d.ts +7 -0
  4. package/dist/components/dag/ui/adjacent-nodes/adjacent-nodes.d.ts +10 -0
  5. package/dist/components/dag/ui/adjacent-nodes/index.d.ts +4 -0
  6. package/dist/components/dag/ui/dag.d.ts +3 -2
  7. package/dist/components/dag/ui/defaults/default-node.d.ts +5 -3
  8. package/dist/components/dag/ui/defaults/index.d.ts +4 -3
  9. package/dist/components/dag/ui/defaults/skeleton-node.d.ts +1 -0
  10. package/dist/components/dag/ui/float-menu/default-float-buttons/button-change-orientation.d.ts +10 -0
  11. package/dist/components/dag/ui/float-menu/default-float-buttons/button-zoom-in.d.ts +1 -0
  12. package/dist/components/dag/ui/float-menu/default-float-buttons/button-zoom-out.d.ts +1 -0
  13. package/dist/components/dag/ui/float-menu/default-float-buttons/index.d.ts +6 -0
  14. package/dist/components/dag/ui/float-menu/float-menu-button-group.d.ts +2 -0
  15. package/dist/components/dag/ui/float-menu/float-menu-button.d.ts +2 -0
  16. package/dist/components/dag/ui/float-menu/float-menu.d.ts +5 -0
  17. package/dist/components/dag/ui/float-menu/index.d.ts +6 -0
  18. package/dist/components/dag/utils/get-layout-elements.d.ts +49 -0
  19. package/dist/components/sidebar/ui/content-split.d.ts +4 -0
  20. package/dist/components/sidebar/ui/index.d.ts +6 -0
  21. package/dist/components/sidebar/ui/sidebar-header.d.ts +5 -0
  22. package/dist/components/sidebar/ui/sidebar.d.ts +12 -0
  23. package/dist/index.d.ts +142 -7
  24. package/dist/index.es.js +25155 -16270
  25. package/dist/index.es.js.map +1 -1
  26. package/dist/index.umd.js +114 -99
  27. package/dist/index.umd.js.map +1 -1
  28. package/dist/shared/business/get-formatted-id.d.ts +4 -0
  29. package/dist/shared/business/index.d.ts +57 -0
  30. package/dist/shared/business/parse-product-featured-data.d.ts +14 -0
  31. package/dist/shared/business/product-featured-data-schema.d.ts +51 -0
  32. package/dist/shared/business/validate-product-featured-data.d.ts +9 -0
  33. package/dist/shared/lib/custom-variant-prop.d.ts +7 -0
  34. package/dist/shared/ui/button.d.ts +1 -1
  35. package/dist/shared/ui/empty-search-icon.d.ts +2 -0
  36. package/dist/shared/ui/float-button.d.ts +9 -0
  37. package/dist/shared/ui/icon-button.d.ts +11 -0
  38. package/package.json +6 -3
  39. package/dist/components/dag/ui/dag-sidebar/dag-sidebar-header.d.ts +0 -5
  40. package/dist/components/dag/ui/dag-sidebar/dag-sidebar.d.ts +0 -8
  41. package/dist/components/dag/ui/dag-sidebar/index.d.ts +0 -5
@@ -0,0 +1,5 @@
1
+ import { useDag } from './use-dag';
2
+ import { useGetAdjacentNodes, useGetAdjacentNodesProps } from './use-get-adjacent-nodes';
3
+
4
+ export { useDag, useGetAdjacentNodes };
5
+ export type { useGetAdjacentNodesProps };
@@ -0,0 +1,57 @@
1
+ import { Edge, Node } from '@xyflow/react';
2
+
3
+ export declare const useDag: () => {
4
+ getEdges: () => Edge[];
5
+ getNodes: () => Node[];
6
+ getNode: (id: string) => Node | undefined;
7
+ getEdge: (id: string) => Edge | undefined;
8
+ zoomIn: import('@xyflow/system').ZoomInOut;
9
+ zoomOut: import('@xyflow/system').ZoomInOut;
10
+ fitView: import('@xyflow/react').FitView;
11
+ addEdges: (payload: Edge | Edge[]) => void;
12
+ addNodes: (payload: Node | Node[]) => void;
13
+ deleteNodes: (node: Node | Node[]) => void;
14
+ deleteEdges: (edge: Edge | Edge[]) => void;
15
+ getNodeEdges: (nodeId: string) => Edge[];
16
+ changeOrientation: (direction: 'vertical' | 'horizontal') => {
17
+ nodes: {
18
+ targetPosition: import('@xyflow/react').Position;
19
+ sourcePosition: import('@xyflow/react').Position;
20
+ position: {
21
+ x: number;
22
+ y: number;
23
+ };
24
+ id: string;
25
+ data: Record<string, unknown>;
26
+ type?: string | undefined;
27
+ hidden?: boolean | undefined;
28
+ selected?: boolean | undefined;
29
+ dragging?: boolean | undefined;
30
+ draggable?: boolean | undefined;
31
+ selectable?: boolean | undefined;
32
+ connectable?: boolean | undefined;
33
+ deletable?: boolean | undefined;
34
+ dragHandle?: string | undefined;
35
+ width?: number | undefined;
36
+ height?: number | undefined;
37
+ initialWidth?: number | undefined;
38
+ initialHeight?: number | undefined;
39
+ parentId?: string | undefined;
40
+ zIndex?: number | undefined;
41
+ extent?: "parent" | import('@xyflow/react').CoordinateExtent | undefined;
42
+ expandParent?: boolean | undefined;
43
+ ariaLabel?: string | undefined;
44
+ origin?: import('@xyflow/react').NodeOrigin | undefined;
45
+ handles?: import('@xyflow/system').NodeHandle[] | undefined;
46
+ measured?: {
47
+ width?: number | undefined;
48
+ height?: number | undefined;
49
+ } | undefined;
50
+ style?: import('react').CSSProperties | undefined;
51
+ className?: string | undefined;
52
+ resizing?: boolean | undefined;
53
+ focusable?: boolean | undefined;
54
+ }[];
55
+ edges: Edge[];
56
+ };
57
+ };
@@ -0,0 +1,7 @@
1
+ import { HandleType, Node } from '@xyflow/react';
2
+
3
+ export type useGetAdjacentNodesProps = {
4
+ nodeId?: string;
5
+ type: HandleType;
6
+ };
7
+ export declare const useGetAdjacentNodes: ({ nodeId, type }: useGetAdjacentNodesProps) => Node[];
@@ -0,0 +1,10 @@
1
+ import { HandleType, Node } from '@xyflow/react';
2
+
3
+ export type AdjacentNodesProps = {
4
+ title?: string;
5
+ nodeId: string;
6
+ type: HandleType;
7
+ nodeValueKey: string;
8
+ onFindAdjacentNodes?: (nodes: Node[]) => void;
9
+ };
10
+ export declare function AdjacentNodes(props: AdjacentNodesProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,4 @@
1
+ import { AdjacentNodes, AdjacentNodesProps } from './adjacent-nodes';
2
+
3
+ export { AdjacentNodes };
4
+ export type { AdjacentNodesProps };
@@ -1,7 +1,8 @@
1
1
  import { ReactFlowProps } from '@xyflow/react';
2
2
 
3
3
  export type DagProps = {
4
- initialNodes?: ReactFlowProps['nodes'];
5
- initialEdges?: ReactFlowProps['edges'];
4
+ initialNodes: ReactFlowProps['nodes'];
5
+ initialEdges: ReactFlowProps['edges'];
6
+ isLoading?: boolean;
6
7
  };
7
8
  export declare function Dag(props: DagProps & Omit<ReactFlowProps, 'nodes' | 'edges'>): import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,9 @@
1
- import { NodeProps, Node } from '@xyflow/react';
1
+ import { Node, NodeProps } from '@xyflow/react';
2
2
 
3
- export type NodeDataProps = {
3
+ export type DefaultNodeDataProps = {
4
4
  content: React.ReactNode;
5
5
  className?: string;
6
+ targetHandleClassName?: string;
7
+ sourceHandleClassName?: string;
6
8
  } & Record<string, unknown>;
7
- export declare function DefaultNode({ id, data }: NodeProps<Node<NodeDataProps>>): import("react/jsx-runtime").JSX.Element;
9
+ export declare function DefaultNode({ id, selected, data, sourcePosition, targetPosition, }: NodeProps<Node<DefaultNodeDataProps>>): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,6 @@
1
- import { DefaultNode, NodeDataProps } from './default-node';
2
1
  import { DefaultEdge } from './default-edge';
2
+ import { DefaultNode, DefaultNodeDataProps } from './default-node';
3
+ import { SkeletonNode } from './skeleton-node';
3
4
 
4
- export { DefaultNode, DefaultEdge };
5
- export type { NodeDataProps };
5
+ export { DefaultNode, DefaultEdge, SkeletonNode };
6
+ export type { DefaultNodeDataProps };
@@ -0,0 +1 @@
1
+ export declare function SkeletonNode(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { Edge, Node } from '@xyflow/react';
2
+
3
+ export type ButtonChangeOrientationProps = {
4
+ orientation: 'vertical' | 'horizontal';
5
+ onClick?: (event: React.MouseEvent<HTMLButtonElement>, props: {
6
+ nodes: Node[];
7
+ edges: Edge[];
8
+ }) => void;
9
+ };
10
+ export declare const ButtonChangeOrientation: ({ onClick, orientation }: ButtonChangeOrientationProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const ButtonZoomIn: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const ButtonZoomOut: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { ButtonChangeOrientation, ButtonChangeOrientationProps } from './button-change-orientation';
2
+ import { ButtonZoomIn } from './button-zoom-in';
3
+ import { ButtonZoomOut } from './button-zoom-out';
4
+
5
+ export { ButtonChangeOrientation, ButtonZoomIn, ButtonZoomOut };
6
+ export type { ButtonChangeOrientationProps };
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function FloatMenuButtonGroup(props: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function FloatMenuButton(props: React.HTMLAttributes<HTMLButtonElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ export type FloatMenuProps = {
3
+ isLoading?: boolean;
4
+ } & React.HTMLAttributes<HTMLDivElement>;
5
+ export declare function FloatMenu(props: FloatMenuProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { FloatMenu, FloatMenuProps } from './float-menu';
2
+ import { FloatMenuButton } from './float-menu-button';
3
+ import { FloatMenuButtonGroup } from './float-menu-button-group';
4
+
5
+ export { FloatMenu, FloatMenuButton, FloatMenuButtonGroup };
6
+ export type { FloatMenuProps };
@@ -0,0 +1,49 @@
1
+ import { Edge, Node, Position } from '@xyflow/react';
2
+
3
+ interface GetLayoutedElementsProps {
4
+ nodes: Node[];
5
+ edges: Edge[];
6
+ direction?: 'vertical' | 'horizontal';
7
+ }
8
+ export declare const getLayoutedElements: (props: GetLayoutedElementsProps) => {
9
+ nodes: {
10
+ targetPosition: Position;
11
+ sourcePosition: Position;
12
+ position: {
13
+ x: number;
14
+ y: number;
15
+ };
16
+ id: string;
17
+ data: Record<string, unknown>;
18
+ type?: string | undefined;
19
+ hidden?: boolean | undefined;
20
+ selected?: boolean | undefined;
21
+ dragging?: boolean | undefined;
22
+ draggable?: boolean | undefined;
23
+ selectable?: boolean | undefined;
24
+ connectable?: boolean | undefined;
25
+ deletable?: boolean | undefined;
26
+ dragHandle?: string | undefined;
27
+ width?: number | undefined;
28
+ height?: number | undefined;
29
+ initialWidth?: number | undefined;
30
+ initialHeight?: number | undefined;
31
+ parentId?: string | undefined;
32
+ zIndex?: number | undefined;
33
+ extent?: "parent" | import('@xyflow/react').CoordinateExtent | undefined;
34
+ expandParent?: boolean | undefined;
35
+ ariaLabel?: string | undefined;
36
+ origin?: import('@xyflow/react').NodeOrigin | undefined;
37
+ handles?: import('@xyflow/system').NodeHandle[] | undefined;
38
+ measured?: {
39
+ width?: number | undefined;
40
+ height?: number | undefined;
41
+ } | undefined;
42
+ style?: import('react').CSSProperties | undefined;
43
+ className?: string | undefined;
44
+ resizing?: boolean | undefined;
45
+ focusable?: boolean | undefined;
46
+ }[];
47
+ edges: Edge[];
48
+ };
49
+ export {};
@@ -0,0 +1,4 @@
1
+ export type ContentSplitProps = {
2
+ className?: string;
3
+ };
4
+ export declare function ContentSplit(props: ContentSplitProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { ContentSplit, ContentSplitProps } from './content-split';
2
+ import { Sidebar, SidebarProps } from './sidebar';
3
+ import { SidebarHeader } from './sidebar-header';
4
+
5
+ export { Sidebar, SidebarHeader, ContentSplit };
6
+ export type { SidebarProps, ContentSplitProps };
@@ -0,0 +1,5 @@
1
+ export type SidebarHeaderProps = {
2
+ title: string;
3
+ onClose?: () => void;
4
+ };
5
+ export declare function SidebarHeader(props: SidebarHeaderProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { VariantProps } from 'class-variance-authority';
2
+ import { PropsWithChildren } from 'react';
3
+
4
+ declare const sidebarVariants: (props?: ({
5
+ direction?: "left" | "right" | "fixed" | null | undefined;
6
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
7
+ export type SidebarProps = PropsWithChildren<{
8
+ isOpen: boolean;
9
+ className?: string;
10
+ } & VariantProps<typeof sidebarVariants>>;
11
+ export declare function Sidebar(props: SidebarProps): import("react/jsx-runtime").JSX.Element | null;
12
+ export {};
package/dist/index.d.ts CHANGED
@@ -1,11 +1,19 @@
1
- import { Spreadsheet } from './components/spreadsheet/ui';
1
+ import { Connection, Edge, Node, Position } from '@xyflow/react';
2
2
  import { FileUploader, FileUploaderProps } from './components/file-uploader/ui';
3
3
  import { ImageUploader, ImageUploaderProps } from './components/image-uploader/ui';
4
- import { MatrixTypes, SpreadsheetTypes } from './types';
4
+ import { Spreadsheet } from './components/spreadsheet/ui';
5
+ import { useGetAdjacentNodesProps } from './components/dag/hooks';
5
6
  import { Dag, DagContainer, DagProps } from './components/dag/ui';
6
- import { DagSidebar, DagSidebarHeader, DagSidebarHeaderProps, DagSidebarProps } from './components/dag/ui/dag-sidebar';
7
- import { DefaultEdge, DefaultNode, NodeDataProps } from './components/dag/ui/defaults';
7
+ import { AdjacentNodes, AdjacentNodesProps } from './components/dag/ui/adjacent-nodes';
8
+ import { DefaultEdge, DefaultNode, DefaultNodeDataProps, SkeletonNode } from './components/dag/ui/defaults';
9
+ import { FloatMenu, FloatMenuButton, FloatMenuButtonGroup, FloatMenuProps } from './components/dag/ui/float-menu';
10
+ import { ButtonChangeOrientationProps } from './components/dag/ui/float-menu/default-float-buttons';
8
11
  import { SearchNode, SearchNodeProps } from './components/dag/ui/search-node';
12
+ import { ContentSplit, ContentSplitProps, Sidebar, SidebarHeader, SidebarProps } from './components/sidebar/ui';
13
+ import { EmptySearchIcon } from './shared/ui/empty-search-icon';
14
+ import { FloatButton, FloatButtonProps } from './shared/ui/float-button';
15
+ import { IconButtonProps } from './shared/ui/icon-button';
16
+ import { MatrixTypes, SpreadsheetTypes } from './types';
9
17
 
10
18
  export declare const CapLink: {
11
19
  Spreadsheet: typeof Spreadsheet;
@@ -14,10 +22,137 @@ export declare const CapLink: {
14
22
  ImageUploader: typeof ImageUploader;
15
23
  Dag: typeof Dag;
16
24
  DagContainer: typeof DagContainer;
17
- DagSidebar: typeof DagSidebar;
18
- DagSidebarHeader: typeof DagSidebarHeader;
19
25
  DefaultNode: typeof DefaultNode;
20
26
  DefaultEdge: typeof DefaultEdge;
27
+ SkeletonNode: typeof SkeletonNode;
21
28
  SearchNode: typeof SearchNode;
29
+ IconButton: import('react').ForwardRefExoticComponent<IconButtonProps & import('react').RefAttributes<HTMLButtonElement>>;
30
+ iconButtonVariants: (props?: ({
31
+ variant?: "primary" | "success" | "info" | "warning" | "danger" | null | undefined;
32
+ backgroundVariant?: "transparent" | "primary" | null | undefined;
33
+ size?: "md" | "lg" | null | undefined;
34
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
35
+ FloatButton: typeof FloatButton;
36
+ ContentSplit: typeof ContentSplit;
37
+ Sidebar: typeof Sidebar;
38
+ SidebarHeader: typeof SidebarHeader;
39
+ Position: typeof Position;
40
+ useDag: () => {
41
+ getEdges: () => Edge[];
42
+ getNodes: () => Node[];
43
+ getNode: (id: string) => Node | undefined;
44
+ getEdge: (id: string) => Edge | undefined;
45
+ zoomIn: import('@xyflow/system').ZoomInOut;
46
+ zoomOut: import('@xyflow/system').ZoomInOut;
47
+ fitView: import('@xyflow/react').FitView;
48
+ addEdges: (payload: Edge | Edge[]) => void;
49
+ addNodes: (payload: Node | Node[]) => void;
50
+ deleteNodes: (node: Node | Node[]) => void;
51
+ deleteEdges: (edge: Edge | Edge[]) => void;
52
+ getNodeEdges: (nodeId: string) => Edge[];
53
+ changeOrientation: (direction: "horizontal" | "vertical") => {
54
+ nodes: {
55
+ targetPosition: Position;
56
+ sourcePosition: Position;
57
+ position: {
58
+ x: number;
59
+ y: number;
60
+ };
61
+ id: string;
62
+ data: Record<string, unknown>;
63
+ type?: string | undefined;
64
+ hidden?: boolean | undefined;
65
+ selected?: boolean | undefined;
66
+ dragging?: boolean | undefined;
67
+ draggable?: boolean | undefined;
68
+ selectable?: boolean | undefined;
69
+ connectable?: boolean | undefined;
70
+ deletable?: boolean | undefined;
71
+ dragHandle?: string | undefined;
72
+ width?: number | undefined;
73
+ height?: number | undefined;
74
+ initialWidth?: number | undefined;
75
+ initialHeight?: number | undefined;
76
+ parentId?: string | undefined;
77
+ zIndex?: number | undefined;
78
+ extent?: "parent" | import('@xyflow/react').CoordinateExtent | undefined;
79
+ expandParent?: boolean | undefined;
80
+ ariaLabel?: string | undefined;
81
+ origin?: import('@xyflow/react').NodeOrigin | undefined;
82
+ handles?: import('@xyflow/system').NodeHandle[] | undefined;
83
+ measured?: {
84
+ width?: number | undefined;
85
+ height?: number | undefined;
86
+ } | undefined;
87
+ style?: import('react').CSSProperties | undefined;
88
+ className?: string | undefined;
89
+ resizing?: boolean | undefined;
90
+ focusable?: boolean | undefined;
91
+ }[];
92
+ edges: Edge[];
93
+ };
94
+ };
95
+ useGetAdjacentNodes: ({ nodeId, type }: useGetAdjacentNodesProps) => Node[];
96
+ AdjacentNodes: typeof AdjacentNodes;
97
+ ButtonChangeOrientation: ({ onClick, orientation }: ButtonChangeOrientationProps) => import("react/jsx-runtime").JSX.Element;
98
+ ButtonZoomIn: () => import("react/jsx-runtime").JSX.Element;
99
+ ButtonZoomOut: () => import("react/jsx-runtime").JSX.Element;
100
+ FloatMenu: typeof FloatMenu;
101
+ FloatMenuButton: typeof FloatMenuButton;
102
+ FloatMenuButtonGroup: typeof FloatMenuButtonGroup;
103
+ EmptySearchIcon: typeof EmptySearchIcon;
104
+ SaaSBusiness: {
105
+ getFormattedId: typeof import('./shared/business/get-formatted-id').getFormattedId;
106
+ parseProductFeaturedData: typeof import('./shared/business/parse-product-featured-data').parseProductFeaturedData;
107
+ validateProductFeaturedData: typeof import('./shared/business/validate-product-featured-data').validateProductFeaturedData;
108
+ productFeaturedDataSchema: import('zod').ZodObject<{
109
+ groups: import('zod').ZodArray<import('zod').ZodObject<{
110
+ title: import('zod').ZodString;
111
+ svgIcon: import('zod').ZodString;
112
+ items: import('zod').ZodArray<import('zod').ZodObject<{
113
+ title: import('zod').ZodString;
114
+ rawData: import('zod').ZodString;
115
+ }, "strip", import('zod').ZodTypeAny, {
116
+ title: string;
117
+ rawData: string;
118
+ }, {
119
+ title: string;
120
+ rawData: string;
121
+ }>, "many">;
122
+ }, "strip", import('zod').ZodTypeAny, {
123
+ title: string;
124
+ items: {
125
+ title: string;
126
+ rawData: string;
127
+ }[];
128
+ svgIcon: string;
129
+ }, {
130
+ title: string;
131
+ items: {
132
+ title: string;
133
+ rawData: string;
134
+ }[];
135
+ svgIcon: string;
136
+ }>, "many">;
137
+ }, "strip", import('zod').ZodTypeAny, {
138
+ groups: {
139
+ title: string;
140
+ items: {
141
+ title: string;
142
+ rawData: string;
143
+ }[];
144
+ svgIcon: string;
145
+ }[];
146
+ }, {
147
+ groups: {
148
+ title: string;
149
+ items: {
150
+ title: string;
151
+ rawData: string;
152
+ }[];
153
+ svgIcon: string;
154
+ }[];
155
+ }>;
156
+ };
22
157
  };
23
- export type { FileUploaderProps, ImageUploaderProps, MatrixTypes, SpreadsheetTypes, DagProps, DagSidebarHeaderProps, DagSidebarProps, NodeDataProps, SearchNodeProps };
158
+ export type { FileUploaderProps, ImageUploaderProps, MatrixTypes, SpreadsheetTypes, DagProps, DefaultNodeDataProps, SearchNodeProps, IconButtonProps, FloatButtonProps, ContentSplitProps, SidebarProps, Node, Edge, Connection, useGetAdjacentNodesProps, AdjacentNodesProps, ButtonChangeOrientationProps, FloatMenuProps, };