@levo-so/studio 0.1.90 → 0.1.92

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 (29) hide show
  1. package/{BillingStep-DVKPpBT9.js → BillingStep-o2yIMjLk.js} +1 -1
  2. package/{Button-vQpIKPk7.js → Button-_hpg7Rxx.js} +6 -6
  3. package/{EntryCard-UWxVYAD_.js → EntryCard-B-feJvrB.js} +13 -13
  4. package/{LoginCard-BKq_s4ZT.js → LoginCard-CF9JbU-y.js} +3 -3
  5. package/{LoginForm-54dtpOlx.js → LoginForm-CdpNCQJa.js} +10 -10
  6. package/{LoginModal-DTSAYZLC.js → LoginModal-ngTHCyli.js} +4 -4
  7. package/{MessageCard-YUS-pnpe.js → MessageCard-D2uja800.js} +2 -2
  8. package/{MessageFooter-DrJ6jZ_n.js → MessageFooter-Bu-jyPkJ.js} +1 -1
  9. package/{ModalManager-DLxbnq-i.js → ModalManager-B7pCzvK1.js} +1 -1
  10. package/{PendingApprovalCard-BnteoK24.js → PendingApprovalCard-Dut-Xiw1.js} +20 -20
  11. package/{bookingCard-CPYdqA8t.js → bookingCard-CGV9svhn.js} +4 -4
  12. package/collection.d.ts +360 -0
  13. package/collection.js +28 -0
  14. package/dist-DDKHTnIW.js +3653 -0
  15. package/index.d.ts +101 -2
  16. package/index.js +1419 -1453
  17. package/package.json +14 -3
  18. package/studio.css +1 -1
  19. package/utils-KqbqLlMF.js +5 -0
  20. package/widgets-B84lq4lO.js +351 -0
  21. /package/{AuthProvider-Ch5Ny0il.js → AuthProvider-56TywIOB.js} +0 -0
  22. /package/{Beams-BqUps11n.js → Beams-CCNNOvfW.js} +0 -0
  23. /package/{Dots-BKqlE-Rv.js → Dots-89WGkd-z.js} +0 -0
  24. /package/{Gradient-hC5P0PfD.js → Gradient-vTa_uWCj.js} +0 -0
  25. /package/{Grid-DqZKCasl.js → Grid-CrtztrxK.js} +0 -0
  26. /package/{StripePaymentModal-Kk0GUsIU.js → StripePaymentModal-CajqohNM.js} +0 -0
  27. /package/{Waves-CzQRk01F.js → Waves-BhA6CLEI.js} +0 -0
  28. /package/{card-oIl95-_C.js → card-DCbhJCO9.js} +0 -0
  29. /package/{dialog-BRgfpVtv.js → dialog-CILIXExr.js} +0 -0
@@ -0,0 +1,360 @@
1
+ import { AsyncPaginateProps } from 'react-select-async-paginate';
2
+ import { Checkbox as Checkbox_2 } from 'radix-ui';
3
+ import { CommonFieldInterfacesList } from '@levo-so/core';
4
+ import { CSSProperties } from 'react';
5
+ import { default as default_2 } from 'react';
6
+ import { FieldInterfacesList } from '@levo-so/core';
7
+ import { FieldKindList } from '@levo-so/core';
8
+ import { FieldValues } from 'react-hook-form';
9
+ import { IFieldError } from '@levo-so/core';
10
+ import { ILemaCollection } from '@levo-so/core';
11
+ import { ILemaField } from '@levo-so/core';
12
+ import { ILemaFieldOptions } from '@levo-so/core';
13
+ import { ILevoMembership } from '@levo-so/core';
14
+ import { MediaKindList } from '@levo-so/core';
15
+ import * as React_2 from 'react';
16
+ import { ReactElement } from 'react';
17
+ import { RegisterOptions } from 'react-hook-form';
18
+ import { Switch as Switch_2 } from 'radix-ui';
19
+ import { UseFormReturn } from 'react-hook-form';
20
+ import { UseFormSetError } from 'react-hook-form';
21
+
22
+ export declare const areAllFieldsHidden: (fields: ILemaField[]) => boolean;
23
+
24
+ export declare const AsyncSelectPaginate: default_2.FC<AsyncPaginateProps<any, any, any, any>>;
25
+
26
+ export declare const Checkbox: React_2.ForwardRefExoticComponent<Omit<Checkbox_2.CheckboxProps & React_2.RefAttributes<HTMLButtonElement>, "ref"> & React_2.RefAttributes<HTMLButtonElement>>;
27
+
28
+ export declare const CollectionForm: default_2.FC<ICollectionFormProps>;
29
+
30
+ export declare const CollectionFormBuilder: default_2.FC<ICollectionFormBuilderProps>;
31
+
32
+ export declare const CollectionFormRenderer: default_2.FC<ICollectionFormRendererProps>;
33
+
34
+ export declare const createWidget: (component: WidgetComponent) => WidgetComponent;
35
+
36
+ export declare const DEFAULT_WIDGET_REGISTRY: IWidgetRegistry;
37
+
38
+ export declare const ErrorMessage: default_2.FC<{
39
+ children: default_2.ReactNode;
40
+ }>;
41
+
42
+ export declare const errorsToParam: (data: Record<string, string[]>) => ParamError[];
43
+
44
+ export declare const FieldRenderer: default_2.FC<{
45
+ schema: ILemaCollection | null;
46
+ field: ILemaField;
47
+ widgets?: Partial<IWidgetRegistry>;
48
+ settings?: {
49
+ enableVerification?: boolean;
50
+ };
51
+ }>;
52
+
53
+ /**
54
+ * @description This component is used to wrap the input components and display the error message and helper text.
55
+ */
56
+ export declare const FieldWrapper: default_2.ForwardRefExoticComponent<IFieldWrapperProps & default_2.RefAttributes<HTMLDivElement>>;
57
+
58
+ export declare const FormBuilder: default_2.FC<IFormBuilderProps>;
59
+
60
+ export declare const FormHelperText: default_2.FC<{
61
+ children: default_2.ReactNode;
62
+ }>;
63
+
64
+ export declare const FormLabel: default_2.FC<IFormLabelProps>;
65
+
66
+ declare type FormValidationOptionsType = Partial<Pick<RegisterOptions, "required" | "min" | "max" | "minLength" | "maxLength" | "pattern" | "validate">>;
67
+
68
+ export declare const FormVariantOptions: readonly [{
69
+ readonly value: "default";
70
+ readonly label: "Classic";
71
+ readonly description: "All fields displayed together in a single view";
72
+ }, {
73
+ readonly value: "steps";
74
+ readonly label: "Multi-Step";
75
+ readonly description: "Each section becomes a step — navigate with next/previous buttons";
76
+ }, {
77
+ readonly value: "single-field";
78
+ readonly label: "One at a Time";
79
+ readonly description: "Typeform-style — one field per screen with smooth transitions";
80
+ }, {
81
+ readonly value: "steps-2";
82
+ readonly label: "Conversational Steps";
83
+ readonly description: "Multi-step with typeform-style field presentation";
84
+ }];
85
+
86
+ export declare type FormVariantType = (typeof FormVariantOptions)[number]["value"];
87
+
88
+ export declare const getDefaultFieldValues: (fields: ILemaField[]) => Record<string, unknown>;
89
+
90
+ export declare const getDefaultValuesByKind: (schema: ILemaCollection | null) => Record<string, unknown>;
91
+
92
+ export declare const getFieldValidations: (field: ILemaField, customValidator?: (value: any) => boolean | string) => FormValidationOptionsType;
93
+
94
+ export declare const getInitialValues: (schema: ILemaCollection, data?: Record<string, unknown>) => Record<string, unknown>;
95
+
96
+ export declare const getKindFromMimetype: (mimetype: string) => (typeof MediaKindList)[number];
97
+
98
+ export declare const getValueIfNotUndefined: (value: unknown) => {} | null;
99
+
100
+ export declare interface IBaseInputProps {
101
+ name: string;
102
+ id?: string;
103
+ value?: any;
104
+ placeholder?: string;
105
+ disabled?: boolean;
106
+ readOnly?: boolean;
107
+ label?: string;
108
+ isRequired?: boolean;
109
+ error?: any;
110
+ touched?: any;
111
+ helperText?: string;
112
+ labelStyles?: string;
113
+ containerStyles?: string;
114
+ }
115
+
116
+ export declare interface ICollectionFormBuilderProps extends Omit<ILevoFormContext, "schema"> {
117
+ formVariant?: FormVariantType;
118
+ collection_id: string;
119
+ hiddenFields?: string[];
120
+ workspace_id?: string;
121
+ account?: ILevoMembership.Account;
122
+ }
123
+
124
+ export declare interface ICollectionFormProps extends Omit<ILevoFormContext, "onSuccess" | "externalInitialValues" | "onError" | "isLoggedIn" | "toastConfig" | "onFormDirty" | "disableCaptcha" | "enableVerification"> {
125
+ hiddenFields?: string[];
126
+ isLoading?: boolean;
127
+ initialValues?: any;
128
+ onSubmit?: (values: any) => void;
129
+ disableCaptcha?: boolean;
130
+ enableVerification?: boolean;
131
+ }
132
+
133
+ export declare interface ICollectionFormRendererProps extends Omit<ILevoFormContext, "schema"> {
134
+ formVariant?: FormVariantType;
135
+ fetchedSchema?: ILevoFormContext["schema"];
136
+ hiddenFields?: string[];
137
+ workspace_id?: string;
138
+ isLoading?: boolean;
139
+ }
140
+
141
+ declare interface ICommonRendererProps {
142
+ schema: ILemaCollection | null;
143
+ field: ILemaField;
144
+ settings?: {
145
+ enableVerification?: boolean;
146
+ };
147
+ }
148
+
149
+ export declare interface IFieldControlProps {
150
+ error?: any;
151
+ touched?: any;
152
+ helperText?: string;
153
+ children: ReactElement;
154
+ isDisabled?: boolean;
155
+ isReadOnly?: boolean;
156
+ containerStyles?: string;
157
+ inputContainerStyles?: string;
158
+ }
159
+
160
+ declare interface IFieldWrapperProps {
161
+ error?: default_2.ReactNode;
162
+ helperText?: string;
163
+ topHelperText?: string;
164
+ children: default_2.ReactNode;
165
+ readOnly?: boolean;
166
+ isRequired?: boolean;
167
+ containerStyles?: string;
168
+ labelStyles?: string;
169
+ label?: default_2.ReactNode;
170
+ htmlFor?: string;
171
+ }
172
+
173
+ export declare interface IFormBuilderProps extends ILevoFormContext {
174
+ formVariant?: FormVariantType;
175
+ }
176
+
177
+ declare interface IFormLabelProps extends default_2.LabelHTMLAttributes<HTMLLabelElement> {
178
+ isRequired?: boolean;
179
+ children?: default_2.ReactNode;
180
+ }
181
+
182
+ export declare interface IFormRendererProps extends ILevoFormContext {
183
+ children: default_2.ReactNode;
184
+ variant?: FormVariantType;
185
+ }
186
+
187
+ export declare interface IFormSelectOptions {
188
+ label: string;
189
+ value: any;
190
+ }
191
+
192
+ export declare interface IFormVariantProps {
193
+ schema: ILemaCollection;
194
+ isInternal?: boolean;
195
+ isDisabled?: boolean;
196
+ containerStyles?: string;
197
+ submitButtonConfig?: {
198
+ text?: string;
199
+ show?: boolean;
200
+ styles?: string;
201
+ };
202
+ uiConfig?: {
203
+ hideSectionHeadings?: boolean;
204
+ hideFormHeading?: boolean;
205
+ };
206
+ }
207
+
208
+ declare interface IInputProps extends default_2.ComponentPropsWithRef<"input"> {
209
+ leftIcon?: default_2.ReactNode;
210
+ rightIcon?: default_2.ReactNode;
211
+ leftIconBoxStyles?: string;
212
+ rightIconBoxStyles?: string;
213
+ containerStyles?: string;
214
+ }
215
+
216
+ export declare interface ILevoFormContext {
217
+ schema: ILemaCollection | null;
218
+ isDisabled?: boolean;
219
+ containerStyles?: string;
220
+ submitButtonConfig: {
221
+ text?: string;
222
+ show?: boolean;
223
+ styles?: string;
224
+ };
225
+ uiConfig?: {
226
+ hideSectionHeadings?: boolean;
227
+ hideFormHeading?: boolean;
228
+ };
229
+ toastConfig?: {
230
+ showSuccessToast?: boolean;
231
+ successToastText?: string;
232
+ suppressOnBooking?: boolean;
233
+ };
234
+ onError?: (v: any) => void;
235
+ disableCaptcha?: boolean;
236
+ enableVerification?: boolean;
237
+ theme?: {
238
+ className?: string;
239
+ style?: React.CSSProperties;
240
+ cssReset?: boolean;
241
+ };
242
+ isLoggedIn?: boolean;
243
+ account?: ILevoMembership.Account;
244
+ externalInitialValues?: Record<string, any>;
245
+ onSuccess?: (v: {
246
+ schemaId: string;
247
+ response: any;
248
+ meta?: any;
249
+ }) => void;
250
+ onFormView?: (v: {
251
+ schemaId: string;
252
+ }) => void;
253
+ onFormDirty?: (v: {
254
+ schemaId: string;
255
+ }) => void;
256
+ widgets?: Partial<IWidgetRegistry>;
257
+ /** Success screen config from props. Priority: this > schema.settings.success_message > defaults. */
258
+ successConfig?: {
259
+ title?: string;
260
+ message?: string;
261
+ action?: {
262
+ type: "none" | "submit_another" | "redirect";
263
+ /** URL for redirect action type. */
264
+ value?: string;
265
+ };
266
+ };
267
+ debug?: boolean;
268
+ }
269
+
270
+ export declare interface ILevoFormThemeContext {
271
+ themeClass: string;
272
+ style?: CSSProperties;
273
+ cssReset?: boolean;
274
+ }
275
+
276
+ export declare const Input: default_2.ForwardRefExoticComponent<Omit<IInputProps, "ref"> & default_2.RefAttributes<HTMLInputElement>>;
277
+
278
+ export declare const isPhoneValid: (phone: string) => boolean;
279
+
280
+ export declare type IWidgetRegistry = Record<(typeof CommonFieldInterfacesList)[number], WidgetComponent>;
281
+
282
+ export declare const LevoFormProvider: default_2.FC<IFormRendererProps>;
283
+
284
+ declare type ParamError = {
285
+ message: string;
286
+ name: string;
287
+ };
288
+
289
+ export declare const setFormErrors: (errors: IFieldError[], setError: UseFormSetError<any>) => void;
290
+
291
+ export declare const submitDataParser: (data: Record<string, unknown>, schema: ILemaCollection) => any;
292
+
293
+ export declare const Switch: React_2.ForwardRefExoticComponent<Omit<Switch_2.SwitchProps & React_2.RefAttributes<HTMLButtonElement>, "ref"> & React_2.RefAttributes<HTMLButtonElement>>;
294
+
295
+ export declare const ThemeWrapper: default_2.FC<{
296
+ children: default_2.ReactNode;
297
+ className?: string;
298
+ style?: default_2.CSSProperties;
299
+ cssReset?: boolean;
300
+ variant?: FormVariantType;
301
+ }>;
302
+
303
+ export declare const updateFieldWInterface: (tempField: ILemaField, field_interface: (typeof FieldInterfacesList)[number]) => {
304
+ field: {
305
+ id: string;
306
+ key: string;
307
+ kind: FieldKindList[number];
308
+ label: string;
309
+ field_interface: (typeof FieldInterfacesList)[number];
310
+ helper_text?: string | undefined;
311
+ placeholder?: string | undefined;
312
+ default_value?: any;
313
+ readonly?: boolean | undefined;
314
+ hidden?: boolean | undefined;
315
+ editable?: boolean | undefined;
316
+ required?: boolean | undefined;
317
+ unique?: boolean | undefined;
318
+ min?: string | number | null | undefined;
319
+ max?: string | number | null | undefined;
320
+ formats?: string[] | undefined;
321
+ values?: any[] | undefined;
322
+ created_at?: string | undefined;
323
+ updated_at?: string | undefined;
324
+ fields?: ILemaField[];
325
+ options: ILemaFieldOptions;
326
+ allow_public_view?: boolean;
327
+ allow_public_submit?: boolean;
328
+ };
329
+ fieldFocused: string | null;
330
+ };
331
+
332
+ export declare const useLevoForm: ({ schema: schemaProp, originalSchema: originalSchemaProp, saveToRemote, onSubmit, onSubmitSuccess, onSubmitError, setFormErrorAfterSubmit, }: {
333
+ schema: ILemaCollection | null;
334
+ originalSchema?: ILemaCollection | null;
335
+ saveToRemote?: boolean;
336
+ onSubmit?: (v: any) => void;
337
+ onSubmitSuccess?: () => void;
338
+ onSubmitError?: (e: IFieldError[]) => void;
339
+ setFormErrorAfterSubmit?: boolean;
340
+ }) => {
341
+ methods: UseFormReturn<FieldValues, any, FieldValues>;
342
+ isLoading: boolean;
343
+ isError: boolean;
344
+ contentId: string | null;
345
+ allFormValues: any;
346
+ handleContentId: (id: string) => void;
347
+ handleSubmit: (e?: React.BaseSyntheticEvent) => Promise<void>;
348
+ showSuccessOverlay: boolean;
349
+ dismissSuccessOverlay: () => void;
350
+ };
351
+
352
+ export declare const useLevoFormContext: () => ILevoFormContext;
353
+
354
+ export declare const useLevoFormTheme: () => ILevoFormThemeContext | null;
355
+
356
+ export declare const validateForm: (schema: ILemaCollection, formData: Record<string, unknown>) => Record<string, string>;
357
+
358
+ export declare type WidgetComponent = default_2.FC<ICommonRendererProps>;
359
+
360
+ export { }
package/collection.js ADDED
@@ -0,0 +1,28 @@
1
+ import { _ as e, a as t, b as n, c as r, d as i, f as a, g as o, h as s, i as c, l, m as u, n as d, o as f, p, r as m, s as h, u as g, v as _, y as v } from "./dist-DDKHTnIW.js";
2
+ import { a as y, c as b, d as x, f as S, i as C, l as w, n as T, o as E, p as D, r as O, s as k, t as A, u as j } from "./widgets-B84lq4lO.js";
3
+ import { t as M } from "./utils-KqbqLlMF.js";
4
+ //#region ../../libraries/react-collection/dist/types/formVariant.js
5
+ var N = [
6
+ {
7
+ value: "default",
8
+ label: "Classic",
9
+ description: "All fields displayed together in a single view"
10
+ },
11
+ {
12
+ value: "steps",
13
+ label: "Multi-Step",
14
+ description: "Each section becomes a step — navigate with next/previous buttons"
15
+ },
16
+ {
17
+ value: "single-field",
18
+ label: "One at a Time",
19
+ description: "Typeform-style — one field per screen with smooth transitions"
20
+ },
21
+ {
22
+ value: "steps-2",
23
+ label: "Conversational Steps",
24
+ description: "Multi-step with typeform-style field presentation"
25
+ }
26
+ ];
27
+ //#endregion
28
+ export { u as AsyncSelectPaginate, p as Checkbox, r as CollectionForm, m as CollectionFormBuilder, d as CollectionFormRenderer, g as DEFAULT_WIDGET_REGISTRY, _ as ErrorMessage, l as FieldRenderer, s as FieldWrapper, c as FormBuilder, o as FormHelperText, e as FormLabel, N as FormVariantOptions, a as Input, h as LevoFormProvider, i as Switch, v as ThemeWrapper, D as areAllFieldsHidden, A as createWidget, y as errorsToParam, k as getDefaultFieldValues, S as getDefaultValuesByKind, O as getFieldValidations, w as getInitialValues, M as getKindFromMimetype, x as getValueIfNotUndefined, j as isPhoneValid, T as setFormErrors, C as submitDataParser, b as updateFieldWInterface, t as useLevoForm, f as useLevoFormContext, n as useLevoFormTheme, E as validateForm };