@saptanshuwanjari/react-component-library 0.1.8 → 0.1.10

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.mts CHANGED
@@ -1,8 +1,11 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
1
  import * as react from 'react';
2
+ import { ComponentType, ReactNode } from 'react';
3
3
  import * as react_hook_form from 'react-hook-form';
4
4
  import { FieldValues, Path, ControllerRenderProps } from 'react-hook-form';
5
+ import * as react_jsx_runtime from 'react/jsx-runtime';
5
6
  import * as z from 'zod';
7
+ import * as class_variance_authority_types from 'class-variance-authority/types';
8
+ import { VariantProps } from 'class-variance-authority';
6
9
  import { ColumnDef } from '@tanstack/react-table';
7
10
  import { ClassValue } from 'clsx';
8
11
 
@@ -11,7 +14,7 @@ type ZodSchema = z.ZodTypeAny;
11
14
  type RootProps$1<T extends FieldValues> = {
12
15
  schema?: ZodSchema;
13
16
  defaultValues?: Partial<T>;
14
- onSubmit: (values: any) => void | Promise<void>;
17
+ onSubmit: (values: T) => void | Promise<void>;
15
18
  children: React.ReactNode;
16
19
  enableOptimistic?: boolean;
17
20
  title?: string;
@@ -28,30 +31,45 @@ type FieldProps<TFieldValues extends FieldValues> = {
28
31
  };
29
32
  declare function Field<TFieldValues extends FieldValues>({ name, label, children, }: FieldProps<TFieldValues>): react_jsx_runtime.JSX.Element;
30
33
 
31
- declare const Button$2: ({ children, ...props }: React.ComponentProps<"button">) => react_jsx_runtime.JSX.Element;
32
- declare function Submit({ children, ...props }: React.ComponentProps<typeof Button$2>): react_jsx_runtime.JSX.Element | null;
33
-
34
34
  declare const Button$1: ({ children, ...props }: React.ComponentProps<"button">) => react_jsx_runtime.JSX.Element;
35
- type EditButtonProps = React.ComponentProps<typeof Button$1> & {
35
+ declare function Submit({ children, ...props }: React.ComponentProps<typeof Button$1>): react_jsx_runtime.JSX.Element | null;
36
+
37
+ declare const buttonVariants: (props?: ({
38
+ variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
39
+ size?: "icon" | "default" | "sm" | "lg" | "icon-sm" | "icon-lg" | null | undefined;
40
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
41
+ declare function Button({ className, variant, size, asChild, ...props }: react.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
42
+ asChild?: boolean;
43
+ }): react_jsx_runtime.JSX.Element;
44
+
45
+ type EditButtonProps = React.ComponentProps<typeof Button> & {
36
46
  formId?: string;
37
47
  };
38
48
  declare function EditButton({ children, formId, ...props }: EditButtonProps): react_jsx_runtime.JSX.Element | null;
39
49
 
40
- declare const Button: ({ children, className, ...props }: React.ComponentProps<"button">) => react_jsx_runtime.JSX.Element;
41
50
  declare function CancelButton({ children, ...props }: React.ComponentProps<typeof Button>): react_jsx_runtime.JSX.Element | null;
42
51
 
43
52
  type LinkFieldProps = {
44
53
  label?: string;
45
54
  link: string;
46
- LinkComponent?: React.ComponentType<{
55
+ LinkComponent?: ComponentType<{
47
56
  href: string;
48
57
  className?: string;
49
- children: React.ReactNode;
58
+ children: ReactNode;
50
59
  }>;
60
+ className?: string;
51
61
  };
52
- declare function LinkField({ label, link, LinkComponent }: LinkFieldProps): react_jsx_runtime.JSX.Element;
62
+ declare function LinkField({ label, link, LinkComponent, className }: LinkFieldProps): react_jsx_runtime.JSX.Element;
63
+
64
+ type FieldGroupProps = {
65
+ children: ReactNode;
66
+ className?: string;
67
+ title?: string;
68
+ };
69
+ declare function FieldGroup({ children, className, title }: FieldGroupProps): react_jsx_runtime.JSX.Element;
53
70
 
54
71
  declare const Form: typeof Root$1 & {
72
+ Root: typeof Root$1;
55
73
  Field: typeof Field;
56
74
  InputField: <TFieldValues extends react_hook_form.FieldValues>(props: {
57
75
  name: react_hook_form.Path<TFieldValues>;
@@ -64,11 +82,11 @@ declare const Form: typeof Root$1 & {
64
82
  endAddon?: React.ReactNode;
65
83
  useGroup?: boolean;
66
84
  }) => react.ReactNode;
67
- PasswordField: react.MemoExoticComponent<(<TFieldValues extends react_hook_form.FieldValues>({ name, label, placeholder, }: {
85
+ PasswordField: <TFieldValues extends react_hook_form.FieldValues>(props: {
68
86
  name: react_hook_form.Path<TFieldValues>;
69
87
  label?: string;
70
88
  placeholder?: string;
71
- }) => react_jsx_runtime.JSX.Element)>;
89
+ }) => react.ReactNode;
72
90
  TextareaField: <TFieldValues extends react_hook_form.FieldValues>(props: {
73
91
  name: react_hook_form.Path<TFieldValues>;
74
92
  label?: string;
@@ -110,9 +128,7 @@ declare const Form: typeof Root$1 & {
110
128
  Submit: typeof Submit;
111
129
  EditButton: typeof EditButton;
112
130
  CancelButton: typeof CancelButton;
113
- Group: ({ children }: {
114
- children: React.ReactNode;
115
- }) => react_jsx_runtime.JSX.Element;
131
+ Group: typeof FieldGroup;
116
132
  LinkField: typeof LinkField;
117
133
  };
118
134
 
@@ -145,21 +161,21 @@ interface ToolbarProps {
145
161
  }
146
162
  declare function Toolbar({ viewOptions }?: ToolbarProps): react_jsx_runtime.JSX.Element;
147
163
 
148
- interface ContentProps {
149
- renderCard?: (item: any, index: number) => React.ReactNode;
164
+ interface ContentProps<TData> {
165
+ renderCard?: (item: TData, index: number) => React.ReactNode;
150
166
  gridColumns?: number;
151
167
  gridGap?: number;
152
168
  }
153
- declare function Content({ renderCard, gridColumns, gridGap }: ContentProps): react_jsx_runtime.JSX.Element;
169
+ declare function Content<TData>({ renderCard, gridColumns, gridGap }: ContentProps<TData>): react_jsx_runtime.JSX.Element;
154
170
 
155
171
  declare function TableView(): react_jsx_runtime.JSX.Element;
156
172
 
157
- interface GridViewProps<TData = any> {
173
+ interface GridViewProps<TData> {
158
174
  renderCard?: (item: TData, index: number) => React.ReactNode;
159
175
  columns?: number;
160
176
  gap?: number;
161
177
  }
162
- declare function GridView<TData = any>({ renderCard, columns, gap }: GridViewProps<TData>): react_jsx_runtime.JSX.Element;
178
+ declare function GridView<TData>({ renderCard, columns, gap }: GridViewProps<TData>): react_jsx_runtime.JSX.Element;
163
179
 
164
180
  declare function Pagination(): react_jsx_runtime.JSX.Element;
165
181
 
@@ -170,6 +186,7 @@ interface ViewOptionsProps {
170
186
  declare function ViewOptions({ viewMode: propViewMode, onViewModeChange: propOnViewModeChange }: ViewOptionsProps): react_jsx_runtime.JSX.Element;
171
187
 
172
188
  declare const DataTable: typeof Root & {
189
+ Root: typeof Root;
173
190
  Toolbar: typeof Toolbar;
174
191
  Content: typeof Content;
175
192
  TableView: typeof TableView;
package/dist/index.d.ts CHANGED
@@ -1,8 +1,11 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
1
  import * as react from 'react';
2
+ import { ComponentType, ReactNode } from 'react';
3
3
  import * as react_hook_form from 'react-hook-form';
4
4
  import { FieldValues, Path, ControllerRenderProps } from 'react-hook-form';
5
+ import * as react_jsx_runtime from 'react/jsx-runtime';
5
6
  import * as z from 'zod';
7
+ import * as class_variance_authority_types from 'class-variance-authority/types';
8
+ import { VariantProps } from 'class-variance-authority';
6
9
  import { ColumnDef } from '@tanstack/react-table';
7
10
  import { ClassValue } from 'clsx';
8
11
 
@@ -11,7 +14,7 @@ type ZodSchema = z.ZodTypeAny;
11
14
  type RootProps$1<T extends FieldValues> = {
12
15
  schema?: ZodSchema;
13
16
  defaultValues?: Partial<T>;
14
- onSubmit: (values: any) => void | Promise<void>;
17
+ onSubmit: (values: T) => void | Promise<void>;
15
18
  children: React.ReactNode;
16
19
  enableOptimistic?: boolean;
17
20
  title?: string;
@@ -28,30 +31,45 @@ type FieldProps<TFieldValues extends FieldValues> = {
28
31
  };
29
32
  declare function Field<TFieldValues extends FieldValues>({ name, label, children, }: FieldProps<TFieldValues>): react_jsx_runtime.JSX.Element;
30
33
 
31
- declare const Button$2: ({ children, ...props }: React.ComponentProps<"button">) => react_jsx_runtime.JSX.Element;
32
- declare function Submit({ children, ...props }: React.ComponentProps<typeof Button$2>): react_jsx_runtime.JSX.Element | null;
33
-
34
34
  declare const Button$1: ({ children, ...props }: React.ComponentProps<"button">) => react_jsx_runtime.JSX.Element;
35
- type EditButtonProps = React.ComponentProps<typeof Button$1> & {
35
+ declare function Submit({ children, ...props }: React.ComponentProps<typeof Button$1>): react_jsx_runtime.JSX.Element | null;
36
+
37
+ declare const buttonVariants: (props?: ({
38
+ variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
39
+ size?: "icon" | "default" | "sm" | "lg" | "icon-sm" | "icon-lg" | null | undefined;
40
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
41
+ declare function Button({ className, variant, size, asChild, ...props }: react.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
42
+ asChild?: boolean;
43
+ }): react_jsx_runtime.JSX.Element;
44
+
45
+ type EditButtonProps = React.ComponentProps<typeof Button> & {
36
46
  formId?: string;
37
47
  };
38
48
  declare function EditButton({ children, formId, ...props }: EditButtonProps): react_jsx_runtime.JSX.Element | null;
39
49
 
40
- declare const Button: ({ children, className, ...props }: React.ComponentProps<"button">) => react_jsx_runtime.JSX.Element;
41
50
  declare function CancelButton({ children, ...props }: React.ComponentProps<typeof Button>): react_jsx_runtime.JSX.Element | null;
42
51
 
43
52
  type LinkFieldProps = {
44
53
  label?: string;
45
54
  link: string;
46
- LinkComponent?: React.ComponentType<{
55
+ LinkComponent?: ComponentType<{
47
56
  href: string;
48
57
  className?: string;
49
- children: React.ReactNode;
58
+ children: ReactNode;
50
59
  }>;
60
+ className?: string;
51
61
  };
52
- declare function LinkField({ label, link, LinkComponent }: LinkFieldProps): react_jsx_runtime.JSX.Element;
62
+ declare function LinkField({ label, link, LinkComponent, className }: LinkFieldProps): react_jsx_runtime.JSX.Element;
63
+
64
+ type FieldGroupProps = {
65
+ children: ReactNode;
66
+ className?: string;
67
+ title?: string;
68
+ };
69
+ declare function FieldGroup({ children, className, title }: FieldGroupProps): react_jsx_runtime.JSX.Element;
53
70
 
54
71
  declare const Form: typeof Root$1 & {
72
+ Root: typeof Root$1;
55
73
  Field: typeof Field;
56
74
  InputField: <TFieldValues extends react_hook_form.FieldValues>(props: {
57
75
  name: react_hook_form.Path<TFieldValues>;
@@ -64,11 +82,11 @@ declare const Form: typeof Root$1 & {
64
82
  endAddon?: React.ReactNode;
65
83
  useGroup?: boolean;
66
84
  }) => react.ReactNode;
67
- PasswordField: react.MemoExoticComponent<(<TFieldValues extends react_hook_form.FieldValues>({ name, label, placeholder, }: {
85
+ PasswordField: <TFieldValues extends react_hook_form.FieldValues>(props: {
68
86
  name: react_hook_form.Path<TFieldValues>;
69
87
  label?: string;
70
88
  placeholder?: string;
71
- }) => react_jsx_runtime.JSX.Element)>;
89
+ }) => react.ReactNode;
72
90
  TextareaField: <TFieldValues extends react_hook_form.FieldValues>(props: {
73
91
  name: react_hook_form.Path<TFieldValues>;
74
92
  label?: string;
@@ -110,9 +128,7 @@ declare const Form: typeof Root$1 & {
110
128
  Submit: typeof Submit;
111
129
  EditButton: typeof EditButton;
112
130
  CancelButton: typeof CancelButton;
113
- Group: ({ children }: {
114
- children: React.ReactNode;
115
- }) => react_jsx_runtime.JSX.Element;
131
+ Group: typeof FieldGroup;
116
132
  LinkField: typeof LinkField;
117
133
  };
118
134
 
@@ -145,21 +161,21 @@ interface ToolbarProps {
145
161
  }
146
162
  declare function Toolbar({ viewOptions }?: ToolbarProps): react_jsx_runtime.JSX.Element;
147
163
 
148
- interface ContentProps {
149
- renderCard?: (item: any, index: number) => React.ReactNode;
164
+ interface ContentProps<TData> {
165
+ renderCard?: (item: TData, index: number) => React.ReactNode;
150
166
  gridColumns?: number;
151
167
  gridGap?: number;
152
168
  }
153
- declare function Content({ renderCard, gridColumns, gridGap }: ContentProps): react_jsx_runtime.JSX.Element;
169
+ declare function Content<TData>({ renderCard, gridColumns, gridGap }: ContentProps<TData>): react_jsx_runtime.JSX.Element;
154
170
 
155
171
  declare function TableView(): react_jsx_runtime.JSX.Element;
156
172
 
157
- interface GridViewProps<TData = any> {
173
+ interface GridViewProps<TData> {
158
174
  renderCard?: (item: TData, index: number) => React.ReactNode;
159
175
  columns?: number;
160
176
  gap?: number;
161
177
  }
162
- declare function GridView<TData = any>({ renderCard, columns, gap }: GridViewProps<TData>): react_jsx_runtime.JSX.Element;
178
+ declare function GridView<TData>({ renderCard, columns, gap }: GridViewProps<TData>): react_jsx_runtime.JSX.Element;
163
179
 
164
180
  declare function Pagination(): react_jsx_runtime.JSX.Element;
165
181
 
@@ -170,6 +186,7 @@ interface ViewOptionsProps {
170
186
  declare function ViewOptions({ viewMode: propViewMode, onViewModeChange: propOnViewModeChange }: ViewOptionsProps): react_jsx_runtime.JSX.Element;
171
187
 
172
188
  declare const DataTable: typeof Root & {
189
+ Root: typeof Root;
173
190
  Toolbar: typeof Toolbar;
174
191
  Content: typeof Content;
175
192
  TableView: typeof TableView;