@algorithm-shift/design-system 1.2.44 → 1.2.46
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/chunk-QZ2QO7MJ.mjs +24 -0
- package/dist/chunk-QZ2QO7MJ.mjs.map +1 -0
- package/dist/client.d.mts +21 -8
- package/dist/client.d.ts +21 -8
- package/dist/client.js +100 -334
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +292 -4
- package/dist/client.mjs.map +1 -1
- package/dist/index.d.mts +3 -18
- package/dist/index.d.ts +3 -18
- package/dist/index.js +6 -301
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2785 -51
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-JFDQZCMW.mjs +0 -3130
- package/dist/chunk-JFDQZCMW.mjs.map +0 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
// src/lib/utils.ts
|
|
4
|
+
import { clsx } from "clsx";
|
|
5
|
+
import { twMerge } from "tailwind-merge";
|
|
6
|
+
function cn(...inputs) {
|
|
7
|
+
return twMerge(clsx(inputs));
|
|
8
|
+
}
|
|
9
|
+
function getInitials(name) {
|
|
10
|
+
const words = name.split(" ");
|
|
11
|
+
if (words.length === 0) {
|
|
12
|
+
return "";
|
|
13
|
+
}
|
|
14
|
+
if (words.length === 1) {
|
|
15
|
+
return words[0].charAt(0);
|
|
16
|
+
}
|
|
17
|
+
return words[0].charAt(0) + words[1].charAt(0);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
cn,
|
|
22
|
+
getInitials
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=chunk-QZ2QO7MJ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/utils.ts"],"sourcesContent":["import { clsx, type ClassValue } from \"clsx\"\r\nimport { twMerge } from \"tailwind-merge\"\r\n\r\nexport function cn(...inputs: ClassValue[]) {\r\n return twMerge(clsx(inputs))\r\n}\r\n\r\nexport function getInitials(name: string) {\r\n const words = name.split(' ');\r\n if (words.length === 0) {\r\n return '';\r\n }\r\n if (words.length === 1) {\r\n return words[0].charAt(0);\r\n }\r\n return words[0].charAt(0) + words[1].charAt(0);\r\n}"],"mappings":";;;AAAA,SAAS,YAA6B;AACtC,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;AAEO,SAAS,YAAY,MAAc;AACxC,QAAM,QAAQ,KAAK,MAAM,GAAG;AAC5B,MAAI,MAAM,WAAW,GAAG;AACtB,WAAO;AAAA,EACT;AACA,MAAI,MAAM,WAAW,GAAG;AACtB,WAAO,MAAM,CAAC,EAAE,OAAO,CAAC;AAAA,EAC1B;AACA,SAAO,MAAM,CAAC,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,EAAE,OAAO,CAAC;AAC/C;","names":[]}
|
package/dist/client.d.mts
CHANGED
|
@@ -1,26 +1,39 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { z } from 'zod';
|
|
4
3
|
import { UseFormReturn } from 'react-hook-form';
|
|
4
|
+
import { z } from 'zod';
|
|
5
5
|
|
|
6
|
-
interface
|
|
6
|
+
interface FormWrapperProps<T extends z.ZodObject<any>> {
|
|
7
7
|
validation?: any[];
|
|
8
8
|
formName?: string;
|
|
9
9
|
defaultValues?: Partial<z.infer<T>> | any;
|
|
10
|
-
children?: React.ReactNode;
|
|
10
|
+
children?: React.ReactNode | ((form: UseFormReturn<z.infer<T>>) => React.ReactNode);
|
|
11
11
|
onSubmit?: (data: z.infer<T>) => void;
|
|
12
12
|
onReset?: () => void;
|
|
13
13
|
}
|
|
14
|
-
declare const
|
|
14
|
+
declare const FormWrapper: <T extends z.ZodObject<any>>({ validation, defaultValues, children, onSubmit, onReset, }: FormWrapperProps<T>) => react_jsx_runtime.JSX.Element;
|
|
15
15
|
|
|
16
|
-
interface
|
|
16
|
+
interface FormProps<T extends z.ZodObject<any>> {
|
|
17
17
|
validation?: any[];
|
|
18
18
|
formName?: string;
|
|
19
19
|
defaultValues?: Partial<z.infer<T>> | any;
|
|
20
|
-
children?: React.ReactNode
|
|
20
|
+
children?: React.ReactNode;
|
|
21
21
|
onSubmit?: (data: z.infer<T>) => void;
|
|
22
22
|
onReset?: () => void;
|
|
23
23
|
}
|
|
24
|
-
declare const
|
|
24
|
+
declare const Form: <T extends z.ZodObject<any>>({ validation, defaultValues, children, onSubmit, onReset, }: FormProps<T>) => react_jsx_runtime.JSX.Element;
|
|
25
|
+
|
|
26
|
+
type CanvasState = Record<string, any>;
|
|
27
|
+
type CanvasAction = {
|
|
28
|
+
type: 'SET_STATE';
|
|
29
|
+
key: string;
|
|
30
|
+
value: any;
|
|
31
|
+
};
|
|
32
|
+
declare function stateReducer(state: CanvasState, action: CanvasAction): CanvasState;
|
|
33
|
+
|
|
34
|
+
declare function StateProvider({ children }: {
|
|
35
|
+
children: React.ReactNode;
|
|
36
|
+
}): react_jsx_runtime.JSX.Element;
|
|
37
|
+
declare function useAppState(): any;
|
|
25
38
|
|
|
26
|
-
export { Form, FormWrapper };
|
|
39
|
+
export { Form, FormWrapper, StateProvider, stateReducer, useAppState };
|
package/dist/client.d.ts
CHANGED
|
@@ -1,26 +1,39 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { z } from 'zod';
|
|
4
3
|
import { UseFormReturn } from 'react-hook-form';
|
|
4
|
+
import { z } from 'zod';
|
|
5
5
|
|
|
6
|
-
interface
|
|
6
|
+
interface FormWrapperProps<T extends z.ZodObject<any>> {
|
|
7
7
|
validation?: any[];
|
|
8
8
|
formName?: string;
|
|
9
9
|
defaultValues?: Partial<z.infer<T>> | any;
|
|
10
|
-
children?: React.ReactNode;
|
|
10
|
+
children?: React.ReactNode | ((form: UseFormReturn<z.infer<T>>) => React.ReactNode);
|
|
11
11
|
onSubmit?: (data: z.infer<T>) => void;
|
|
12
12
|
onReset?: () => void;
|
|
13
13
|
}
|
|
14
|
-
declare const
|
|
14
|
+
declare const FormWrapper: <T extends z.ZodObject<any>>({ validation, defaultValues, children, onSubmit, onReset, }: FormWrapperProps<T>) => react_jsx_runtime.JSX.Element;
|
|
15
15
|
|
|
16
|
-
interface
|
|
16
|
+
interface FormProps<T extends z.ZodObject<any>> {
|
|
17
17
|
validation?: any[];
|
|
18
18
|
formName?: string;
|
|
19
19
|
defaultValues?: Partial<z.infer<T>> | any;
|
|
20
|
-
children?: React.ReactNode
|
|
20
|
+
children?: React.ReactNode;
|
|
21
21
|
onSubmit?: (data: z.infer<T>) => void;
|
|
22
22
|
onReset?: () => void;
|
|
23
23
|
}
|
|
24
|
-
declare const
|
|
24
|
+
declare const Form: <T extends z.ZodObject<any>>({ validation, defaultValues, children, onSubmit, onReset, }: FormProps<T>) => react_jsx_runtime.JSX.Element;
|
|
25
|
+
|
|
26
|
+
type CanvasState = Record<string, any>;
|
|
27
|
+
type CanvasAction = {
|
|
28
|
+
type: 'SET_STATE';
|
|
29
|
+
key: string;
|
|
30
|
+
value: any;
|
|
31
|
+
};
|
|
32
|
+
declare function stateReducer(state: CanvasState, action: CanvasAction): CanvasState;
|
|
33
|
+
|
|
34
|
+
declare function StateProvider({ children }: {
|
|
35
|
+
children: React.ReactNode;
|
|
36
|
+
}): react_jsx_runtime.JSX.Element;
|
|
37
|
+
declare function useAppState(): any;
|
|
25
38
|
|
|
26
|
-
export { Form, FormWrapper };
|
|
39
|
+
export { Form, FormWrapper, StateProvider, stateReducer, useAppState };
|
package/dist/client.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
"use strict";
|
|
2
3
|
"use client";
|
|
3
4
|
var __create = Object.create;
|
|
@@ -32,25 +33,18 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
32
33
|
var client_exports = {};
|
|
33
34
|
__export(client_exports, {
|
|
34
35
|
Form: () => Form_default,
|
|
35
|
-
FormWrapper: () => Wrapper_default
|
|
36
|
+
FormWrapper: () => Wrapper_default,
|
|
37
|
+
StateProvider: () => StateProvider,
|
|
38
|
+
stateReducer: () => stateReducer,
|
|
39
|
+
useAppState: () => useAppState
|
|
36
40
|
});
|
|
37
41
|
module.exports = __toCommonJS(client_exports);
|
|
38
42
|
|
|
39
|
-
// src/components/
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
// src/components/Layout/Grid.tsx
|
|
46
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
47
|
-
|
|
48
|
-
// src/components/Layout/Container.tsx
|
|
49
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
50
|
-
|
|
51
|
-
// src/components/ui/button.tsx
|
|
52
|
-
var import_react_slot = require("@radix-ui/react-slot");
|
|
53
|
-
var import_class_variance_authority = require("class-variance-authority");
|
|
43
|
+
// src/components/Form/Wrapper.tsx
|
|
44
|
+
var import_react = require("react");
|
|
45
|
+
var import_zod = require("@hookform/resolvers/zod");
|
|
46
|
+
var import_react_hook_form = require("react-hook-form");
|
|
47
|
+
var import_zod2 = require("zod");
|
|
54
48
|
|
|
55
49
|
// src/lib/utils.ts
|
|
56
50
|
var import_clsx = require("clsx");
|
|
@@ -59,261 +53,8 @@ function cn(...inputs) {
|
|
|
59
53
|
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
60
54
|
}
|
|
61
55
|
|
|
62
|
-
// src/components/
|
|
63
|
-
var
|
|
64
|
-
var buttonVariants = (0, import_class_variance_authority.cva)(
|
|
65
|
-
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
66
|
-
{
|
|
67
|
-
variants: {
|
|
68
|
-
variant: {
|
|
69
|
-
default: "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
|
|
70
|
-
destructive: "bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
71
|
-
outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
72
|
-
secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
|
|
73
|
-
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
74
|
-
link: "text-primary underline-offset-4 hover:underline"
|
|
75
|
-
},
|
|
76
|
-
size: {
|
|
77
|
-
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
78
|
-
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
79
|
-
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
80
|
-
icon: "size-9"
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
defaultVariants: {
|
|
84
|
-
variant: "default",
|
|
85
|
-
size: "default"
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
// src/components/Basic/Button/Button.tsx
|
|
91
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
92
|
-
|
|
93
|
-
// src/components/Basic/Image/Image.tsx
|
|
94
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
95
|
-
|
|
96
|
-
// src/components/Basic/Shape/Shape.tsx
|
|
97
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
98
|
-
|
|
99
|
-
// src/components/Basic/Typography/Typography.tsx
|
|
100
|
-
var import_react = __toESM(require("react"));
|
|
101
|
-
|
|
102
|
-
// src/components/Basic/Breadcrumb/Breadcrumb.tsx
|
|
103
|
-
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
104
|
-
|
|
105
|
-
// src/components/ui/dropdown-menu.tsx
|
|
106
|
-
var DropdownMenuPrimitive = __toESM(require("@radix-ui/react-dropdown-menu"));
|
|
107
|
-
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
108
|
-
|
|
109
|
-
// src/components/Basic/ButtonGroup/ButtonGroup.tsx
|
|
110
|
-
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
111
|
-
|
|
112
|
-
// src/components/ui/input.tsx
|
|
113
|
-
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
114
|
-
|
|
115
|
-
// src/components/Inputs/TextInput/TextInput.tsx
|
|
116
|
-
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
117
|
-
|
|
118
|
-
// src/components/Inputs/NumberInput/NumberInput.tsx
|
|
119
|
-
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
120
|
-
|
|
121
|
-
// src/components/Inputs/EmailInput/EmailInput.tsx
|
|
122
|
-
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
123
|
-
|
|
124
|
-
// src/components/Inputs/PasswordInput/PasswordInput.tsx
|
|
125
|
-
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
126
|
-
|
|
127
|
-
// src/components/ui/textarea.tsx
|
|
128
|
-
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
129
|
-
|
|
130
|
-
// src/components/Inputs/Textarea/Textarea.tsx
|
|
131
|
-
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
132
|
-
|
|
133
|
-
// src/components/Inputs/UrlInput/UrlInput.tsx
|
|
134
|
-
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
135
|
-
|
|
136
|
-
// src/components/ui/checkbox.tsx
|
|
137
|
-
var CheckboxPrimitive = __toESM(require("@radix-ui/react-checkbox"));
|
|
138
|
-
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
139
|
-
|
|
140
|
-
// src/components/ui/label.tsx
|
|
141
|
-
var LabelPrimitive = __toESM(require("@radix-ui/react-label"));
|
|
142
|
-
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
143
|
-
|
|
144
|
-
// src/components/Inputs/Checkbox/Checkbox.tsx
|
|
145
|
-
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
146
|
-
|
|
147
|
-
// src/components/ui/radio-group.tsx
|
|
148
|
-
var RadioGroupPrimitive = __toESM(require("@radix-ui/react-radio-group"));
|
|
149
|
-
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
150
|
-
|
|
151
|
-
// src/components/Inputs/RadioInput/RadioInput.tsx
|
|
152
|
-
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
153
|
-
|
|
154
|
-
// src/components/Inputs/MultiCheckbox/MultiCheckbox.tsx
|
|
155
|
-
var import_react2 = require("react");
|
|
156
|
-
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
157
|
-
|
|
158
|
-
// src/components/Global/TinyMceEditor.tsx
|
|
159
|
-
var import_react3 = require("react");
|
|
160
|
-
var import_tinymce_react = require("@tinymce/tinymce-react");
|
|
161
|
-
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
162
|
-
|
|
163
|
-
// src/components/Inputs/RichText/RichText.tsx
|
|
164
|
-
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
165
|
-
|
|
166
|
-
// src/components/ui/select.tsx
|
|
167
|
-
var SelectPrimitive = __toESM(require("@radix-ui/react-select"));
|
|
168
|
-
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
169
|
-
|
|
170
|
-
// src/components/Inputs/Dropdown/Dropdown.tsx
|
|
171
|
-
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
172
|
-
|
|
173
|
-
// src/components/ui/switch.tsx
|
|
174
|
-
var SwitchPrimitive = __toESM(require("@radix-ui/react-switch"));
|
|
175
|
-
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
176
|
-
|
|
177
|
-
// src/components/Inputs/SwitchToggle/SwitchToggle.tsx
|
|
178
|
-
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
179
|
-
|
|
180
|
-
// src/components/Inputs/PhoneInput/PhoneInput.tsx
|
|
181
|
-
var import_react_international_phone = require("react-international-phone");
|
|
182
|
-
var import_style = require("react-international-phone/style.css");
|
|
183
|
-
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
184
|
-
|
|
185
|
-
// src/components/Inputs/SearchInput/SearchInput.tsx
|
|
186
|
-
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
187
|
-
|
|
188
|
-
// src/components/Inputs/FileInput/FileInput.tsx
|
|
189
|
-
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
190
|
-
|
|
191
|
-
// src/components/Inputs/DatePicker/DatePicker.tsx
|
|
192
|
-
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
193
|
-
|
|
194
|
-
// src/components/Inputs/DateRange/DateRange.tsx
|
|
195
|
-
var React3 = __toESM(require("react"));
|
|
196
|
-
var import_date_fns = require("date-fns");
|
|
197
|
-
|
|
198
|
-
// src/components/ui/calendar.tsx
|
|
199
|
-
var React2 = __toESM(require("react"));
|
|
200
|
-
var import_react_day_picker = require("react-day-picker");
|
|
201
|
-
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
202
|
-
|
|
203
|
-
// src/components/ui/popover.tsx
|
|
204
|
-
var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"));
|
|
205
|
-
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
206
|
-
|
|
207
|
-
// src/components/Inputs/DateRange/DateRange.tsx
|
|
208
|
-
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
209
|
-
|
|
210
|
-
// src/components/Inputs/TextInputGroup/TextInputGroup.tsx
|
|
211
|
-
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
212
|
-
|
|
213
|
-
// src/components/ui/data-table.tsx
|
|
214
|
-
var import_react_table = require("@tanstack/react-table");
|
|
215
|
-
|
|
216
|
-
// src/components/ui/table.tsx
|
|
217
|
-
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
218
|
-
|
|
219
|
-
// src/components/ui/data-table.tsx
|
|
220
|
-
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
221
|
-
|
|
222
|
-
// src/components/ui/pagination.tsx
|
|
223
|
-
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
224
|
-
|
|
225
|
-
// src/components/DataDisplay/Pagination/Pagination.tsx
|
|
226
|
-
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
227
|
-
|
|
228
|
-
// src/components/DataDisplay/Table/Table.tsx
|
|
229
|
-
var import_react4 = require("react");
|
|
230
|
-
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
231
|
-
|
|
232
|
-
// src/components/Navigation/Tabs/Tabs.tsx
|
|
233
|
-
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
234
|
-
|
|
235
|
-
// src/components/Navigation/Stages/Stages.tsx
|
|
236
|
-
var import_react5 = __toESM(require("react"));
|
|
237
|
-
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
238
|
-
|
|
239
|
-
// src/components/Navigation/Spacer/Spacer.tsx
|
|
240
|
-
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
241
|
-
|
|
242
|
-
// src/components/Navigation/Profile/Profile.tsx
|
|
243
|
-
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
244
|
-
|
|
245
|
-
// src/components/Navigation/Notification/Notification.tsx
|
|
246
|
-
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
247
|
-
|
|
248
|
-
// src/components/Navigation/Logo/Logo.tsx
|
|
249
|
-
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
250
|
-
|
|
251
|
-
// src/components/ui/avatar.tsx
|
|
252
|
-
var React5 = __toESM(require("react"));
|
|
253
|
-
var AvatarPrimitive = __toESM(require("@radix-ui/react-avatar"));
|
|
254
|
-
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
255
|
-
var Avatar = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
256
|
-
AvatarPrimitive.Root,
|
|
257
|
-
{
|
|
258
|
-
ref,
|
|
259
|
-
className: cn(
|
|
260
|
-
"relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
|
|
261
|
-
className
|
|
262
|
-
),
|
|
263
|
-
...props
|
|
264
|
-
}
|
|
265
|
-
));
|
|
266
|
-
Avatar.displayName = AvatarPrimitive.Root.displayName;
|
|
267
|
-
var AvatarImage = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
268
|
-
AvatarPrimitive.Image,
|
|
269
|
-
{
|
|
270
|
-
ref,
|
|
271
|
-
className: cn("aspect-square h-full w-full", className),
|
|
272
|
-
...props
|
|
273
|
-
}
|
|
274
|
-
));
|
|
275
|
-
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
|
|
276
|
-
var AvatarFallback = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
277
|
-
AvatarPrimitive.Fallback,
|
|
278
|
-
{
|
|
279
|
-
ref,
|
|
280
|
-
className: cn(
|
|
281
|
-
"flex h-full w-full items-center justify-center rounded-full bg-muted",
|
|
282
|
-
className
|
|
283
|
-
),
|
|
284
|
-
...props
|
|
285
|
-
}
|
|
286
|
-
));
|
|
287
|
-
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
|
|
288
|
-
|
|
289
|
-
// src/components/Navigation/Navbar/Navbar.tsx
|
|
290
|
-
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
291
|
-
|
|
292
|
-
// src/components/Chart/BarChart.tsx
|
|
293
|
-
var import_recharts = require("recharts");
|
|
294
|
-
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
295
|
-
|
|
296
|
-
// src/components/Chart/PieChart.tsx
|
|
297
|
-
var import_recharts2 = require("recharts");
|
|
298
|
-
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
299
|
-
|
|
300
|
-
// src/components/Blocks/EmailComposer.tsx
|
|
301
|
-
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
302
|
-
|
|
303
|
-
// src/components/ui/sonner-toast.tsx
|
|
304
|
-
var import_sonner = require("sonner");
|
|
305
|
-
|
|
306
|
-
// src/components/StateManagment/StateContext.tsx
|
|
307
|
-
var import_react6 = require("react");
|
|
308
|
-
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
309
|
-
var StateContext = (0, import_react6.createContext)(null);
|
|
310
|
-
|
|
311
|
-
// src/components/Form/Form.tsx
|
|
312
|
-
var import_react7 = __toESM(require("react"));
|
|
313
|
-
var import_zod = require("@hookform/resolvers/zod");
|
|
314
|
-
var import_react_hook_form = require("react-hook-form");
|
|
315
|
-
var import_zod2 = require("zod");
|
|
316
|
-
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
56
|
+
// src/components/Form/Wrapper.tsx
|
|
57
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
317
58
|
function generateZodSchema(data) {
|
|
318
59
|
const fields = data.reduce((acc, f) => {
|
|
319
60
|
const name = f.name || "unnamed";
|
|
@@ -382,23 +123,18 @@ function generateZodSchema(data) {
|
|
|
382
123
|
}, {});
|
|
383
124
|
return import_zod2.z.object(fields);
|
|
384
125
|
}
|
|
385
|
-
var
|
|
126
|
+
var FormWrapper = ({
|
|
386
127
|
validation,
|
|
387
128
|
defaultValues,
|
|
388
129
|
children,
|
|
389
130
|
onSubmit,
|
|
390
131
|
onReset
|
|
391
132
|
}) => {
|
|
392
|
-
const schema = (0,
|
|
133
|
+
const schema = (0, import_react.useMemo)(() => {
|
|
393
134
|
if (!validation || validation.length === 0) return null;
|
|
394
135
|
return generateZodSchema(validation);
|
|
395
136
|
}, [validation]);
|
|
396
|
-
const {
|
|
397
|
-
handleSubmit,
|
|
398
|
-
control,
|
|
399
|
-
formState: { errors },
|
|
400
|
-
reset
|
|
401
|
-
} = (0, import_react_hook_form.useForm)({
|
|
137
|
+
const form = (0, import_react_hook_form.useForm)({
|
|
402
138
|
resolver: schema ? (0, import_zod.zodResolver)(schema) : void 0,
|
|
403
139
|
defaultValues
|
|
404
140
|
});
|
|
@@ -406,67 +142,29 @@ var Form = ({
|
|
|
406
142
|
if (onSubmit) onSubmit(data);
|
|
407
143
|
};
|
|
408
144
|
const handleReset = () => {
|
|
409
|
-
reset();
|
|
145
|
+
form.reset();
|
|
410
146
|
if (onReset) onReset();
|
|
411
147
|
};
|
|
412
|
-
return /* @__PURE__ */ (0,
|
|
148
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
413
149
|
"form",
|
|
414
150
|
{
|
|
415
|
-
onSubmit: handleSubmit(formSubmit),
|
|
151
|
+
onSubmit: form.handleSubmit(formSubmit),
|
|
416
152
|
onReset: handleReset,
|
|
417
153
|
className: cn(
|
|
418
154
|
"space-y-4 min-h-[100px] h-auto flex justify-between flex-col"
|
|
419
155
|
),
|
|
420
|
-
children: /* @__PURE__ */ (0,
|
|
421
|
-
const processChild = (child2) => {
|
|
422
|
-
if (import_react7.default.isValidElement(child2)) {
|
|
423
|
-
const node = child2.props?.node;
|
|
424
|
-
if (node?.category === "Form Controls") {
|
|
425
|
-
const name = node.properties?.name || "unnamed";
|
|
426
|
-
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "flex flex-col", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
427
|
-
import_react_hook_form.Controller,
|
|
428
|
-
{
|
|
429
|
-
name,
|
|
430
|
-
control,
|
|
431
|
-
render: ({ field: controllerField }) => {
|
|
432
|
-
const childElement = child2;
|
|
433
|
-
return import_react7.default.cloneElement(childElement, {
|
|
434
|
-
input: {
|
|
435
|
-
...controllerField,
|
|
436
|
-
value: controllerField.value || "",
|
|
437
|
-
hasFormContainer: true,
|
|
438
|
-
validateOnMount: true,
|
|
439
|
-
errorMessage: errors[name]?.message || null
|
|
440
|
-
},
|
|
441
|
-
children: void 0
|
|
442
|
-
});
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
) }, node.id);
|
|
446
|
-
}
|
|
447
|
-
if (child2.props?.children) {
|
|
448
|
-
const childElement = child2;
|
|
449
|
-
return import_react7.default.cloneElement(childElement, {
|
|
450
|
-
children: import_react7.default.Children.map(childElement.props.children, processChild)
|
|
451
|
-
});
|
|
452
|
-
}
|
|
453
|
-
return import_react7.default.cloneElement(child2);
|
|
454
|
-
}
|
|
455
|
-
return child2;
|
|
456
|
-
};
|
|
457
|
-
return processChild(child);
|
|
458
|
-
}) })
|
|
156
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "min-h-[50px]", children: typeof children === "function" ? children(form) : children })
|
|
459
157
|
}
|
|
460
158
|
);
|
|
461
159
|
};
|
|
462
|
-
var
|
|
160
|
+
var Wrapper_default = FormWrapper;
|
|
463
161
|
|
|
464
|
-
// src/components/Form/
|
|
465
|
-
var
|
|
162
|
+
// src/components/Form/Form.tsx
|
|
163
|
+
var import_react2 = __toESM(require("react"));
|
|
466
164
|
var import_zod3 = require("@hookform/resolvers/zod");
|
|
467
165
|
var import_react_hook_form2 = require("react-hook-form");
|
|
468
166
|
var import_zod4 = require("zod");
|
|
469
|
-
var
|
|
167
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
470
168
|
function generateZodSchema2(data) {
|
|
471
169
|
const fields = data.reduce((acc, f) => {
|
|
472
170
|
const name = f.name || "unnamed";
|
|
@@ -535,18 +233,23 @@ function generateZodSchema2(data) {
|
|
|
535
233
|
}, {});
|
|
536
234
|
return import_zod4.z.object(fields);
|
|
537
235
|
}
|
|
538
|
-
var
|
|
236
|
+
var Form = ({
|
|
539
237
|
validation,
|
|
540
238
|
defaultValues,
|
|
541
239
|
children,
|
|
542
240
|
onSubmit,
|
|
543
241
|
onReset
|
|
544
242
|
}) => {
|
|
545
|
-
const schema = (0,
|
|
243
|
+
const schema = (0, import_react2.useMemo)(() => {
|
|
546
244
|
if (!validation || validation.length === 0) return null;
|
|
547
245
|
return generateZodSchema2(validation);
|
|
548
246
|
}, [validation]);
|
|
549
|
-
const
|
|
247
|
+
const {
|
|
248
|
+
handleSubmit,
|
|
249
|
+
control,
|
|
250
|
+
formState: { errors },
|
|
251
|
+
reset
|
|
252
|
+
} = (0, import_react_hook_form2.useForm)({
|
|
550
253
|
resolver: schema ? (0, import_zod3.zodResolver)(schema) : void 0,
|
|
551
254
|
defaultValues
|
|
552
255
|
});
|
|
@@ -554,25 +257,88 @@ var FormWrapper = ({
|
|
|
554
257
|
if (onSubmit) onSubmit(data);
|
|
555
258
|
};
|
|
556
259
|
const handleReset = () => {
|
|
557
|
-
|
|
260
|
+
reset();
|
|
558
261
|
if (onReset) onReset();
|
|
559
262
|
};
|
|
560
|
-
return /* @__PURE__ */ (0,
|
|
263
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
561
264
|
"form",
|
|
562
265
|
{
|
|
563
|
-
onSubmit:
|
|
266
|
+
onSubmit: handleSubmit(formSubmit),
|
|
564
267
|
onReset: handleReset,
|
|
565
268
|
className: cn(
|
|
566
269
|
"space-y-4 min-h-[100px] h-auto flex justify-between flex-col"
|
|
567
270
|
),
|
|
568
|
-
children: /* @__PURE__ */ (0,
|
|
271
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "min-h-[50px]", children: import_react2.default.Children.map(children, (child) => {
|
|
272
|
+
const processChild = (child2) => {
|
|
273
|
+
if (import_react2.default.isValidElement(child2)) {
|
|
274
|
+
const node = child2.props?.node;
|
|
275
|
+
if (node?.category === "Form Controls") {
|
|
276
|
+
const name = node.properties?.name || "unnamed";
|
|
277
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "flex flex-col", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
278
|
+
import_react_hook_form2.Controller,
|
|
279
|
+
{
|
|
280
|
+
name,
|
|
281
|
+
control,
|
|
282
|
+
render: ({ field: controllerField }) => {
|
|
283
|
+
const childElement = child2;
|
|
284
|
+
return import_react2.default.cloneElement(childElement, {
|
|
285
|
+
input: {
|
|
286
|
+
...controllerField,
|
|
287
|
+
value: controllerField.value || "",
|
|
288
|
+
hasFormContainer: true,
|
|
289
|
+
validateOnMount: true,
|
|
290
|
+
errorMessage: errors[name]?.message || null
|
|
291
|
+
},
|
|
292
|
+
children: void 0
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
) }, node.id);
|
|
297
|
+
}
|
|
298
|
+
if (child2.props?.children) {
|
|
299
|
+
const childElement = child2;
|
|
300
|
+
return import_react2.default.cloneElement(childElement, {
|
|
301
|
+
children: import_react2.default.Children.map(childElement.props.children, processChild)
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
return import_react2.default.cloneElement(child2);
|
|
305
|
+
}
|
|
306
|
+
return child2;
|
|
307
|
+
};
|
|
308
|
+
return processChild(child);
|
|
309
|
+
}) })
|
|
569
310
|
}
|
|
570
311
|
);
|
|
571
312
|
};
|
|
572
|
-
var
|
|
313
|
+
var Form_default = Form;
|
|
314
|
+
|
|
315
|
+
// src/components/StateManagment/stateReducer.ts
|
|
316
|
+
function stateReducer(state, action) {
|
|
317
|
+
switch (action.type) {
|
|
318
|
+
case "SET_STATE":
|
|
319
|
+
return { ...state, [action.key]: action.value };
|
|
320
|
+
default:
|
|
321
|
+
return state;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
// src/components/StateManagment/StateContext.tsx
|
|
326
|
+
var import_react3 = require("react");
|
|
327
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
328
|
+
var StateContext = (0, import_react3.createContext)(null);
|
|
329
|
+
function StateProvider({ children }) {
|
|
330
|
+
const [state, dispatch] = (0, import_react3.useReducer)(stateReducer, {});
|
|
331
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(StateContext.Provider, { value: { state, dispatch }, children });
|
|
332
|
+
}
|
|
333
|
+
function useAppState() {
|
|
334
|
+
return (0, import_react3.useContext)(StateContext);
|
|
335
|
+
}
|
|
573
336
|
// Annotate the CommonJS export names for ESM import in node:
|
|
574
337
|
0 && (module.exports = {
|
|
575
338
|
Form,
|
|
576
|
-
FormWrapper
|
|
339
|
+
FormWrapper,
|
|
340
|
+
StateProvider,
|
|
341
|
+
stateReducer,
|
|
342
|
+
useAppState
|
|
577
343
|
});
|
|
578
344
|
//# sourceMappingURL=client.js.map
|