@lets-events/react 12.1.3 → 12.1.5
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/.turbo/turbo-build.log +10 -8
- package/CHANGELOG.md +12 -0
- package/dist/QuillComponent-A5KIFPCL.mjs +438 -0
- package/dist/chunk-TU7LKUXZ.mjs +1927 -0
- package/dist/index.d.mts +10 -2
- package/dist/index.d.ts +10 -2
- package/dist/index.js +1767 -1539
- package/dist/index.mjs +376 -2645
- package/package.json +1 -1
- package/src/components/FormFields/SwitchFormField.tsx +46 -0
- package/src/components/RichEditor/RichEditor.tsx +15 -3
- package/src/index.tsx +1 -0
package/package.json
CHANGED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useFormContext, Controller } from "react-hook-form";
|
|
2
|
+
import { Flex } from "../Flex";
|
|
3
|
+
import { Switch } from "../Switch";
|
|
4
|
+
import { Text } from "../Text";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export type SwitchFormFieldProps = {
|
|
8
|
+
name: string;
|
|
9
|
+
label: string;
|
|
10
|
+
defaultValue?: boolean;
|
|
11
|
+
watch?: boolean;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const SwitchFormField = ({
|
|
15
|
+
name,
|
|
16
|
+
label,
|
|
17
|
+
defaultValue = false,
|
|
18
|
+
watch = false,
|
|
19
|
+
}: SwitchFormFieldProps) => {
|
|
20
|
+
const {
|
|
21
|
+
control,
|
|
22
|
+
watch: watchForm,
|
|
23
|
+
} = useFormContext();
|
|
24
|
+
|
|
25
|
+
if (watch) {
|
|
26
|
+
watchForm(name);
|
|
27
|
+
}
|
|
28
|
+
return (
|
|
29
|
+
<Flex justify="between" style={{ margin: '1rem 0' }}>
|
|
30
|
+
<Text typography="labelMedium" fontWeight="regular">
|
|
31
|
+
{label}
|
|
32
|
+
</Text>
|
|
33
|
+
<Controller
|
|
34
|
+
control={control}
|
|
35
|
+
name={name}
|
|
36
|
+
defaultValue={defaultValue}
|
|
37
|
+
render={({ field }) => (
|
|
38
|
+
<Switch
|
|
39
|
+
checked={field.value}
|
|
40
|
+
onCheckedChange={field.onChange}
|
|
41
|
+
/>
|
|
42
|
+
)}
|
|
43
|
+
/>
|
|
44
|
+
</Flex>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { lazy, useEffect, useState, Suspense } from "react";
|
|
1
2
|
import { ToastProvider } from "../Toast";
|
|
2
|
-
|
|
3
|
+
|
|
4
|
+
const QuillComponent = lazy(() => import("./QuillComponent"));
|
|
3
5
|
|
|
4
6
|
export interface UploadConfig {
|
|
5
7
|
apiUrl: string;
|
|
@@ -25,13 +27,23 @@ export interface RichEditorProps {
|
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
const RichEditor = (props: RichEditorProps) => {
|
|
30
|
+
const [isClient, setIsClient] = useState(false);
|
|
31
|
+
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
setIsClient(typeof window !== "undefined");
|
|
34
|
+
}, []);
|
|
35
|
+
|
|
36
|
+
if (!isClient) return null;
|
|
37
|
+
|
|
28
38
|
return (
|
|
29
39
|
<div>
|
|
30
40
|
<ToastProvider>
|
|
31
|
-
<
|
|
41
|
+
<Suspense fallback={null}>
|
|
42
|
+
<QuillComponent {...props} />
|
|
43
|
+
</Suspense>
|
|
32
44
|
</ToastProvider>
|
|
33
45
|
</div>
|
|
34
46
|
);
|
|
35
47
|
};
|
|
36
48
|
|
|
37
|
-
export default RichEditor;
|
|
49
|
+
export default RichEditor;
|
package/src/index.tsx
CHANGED
|
@@ -52,6 +52,7 @@ export * from "./components/FormFields/RadioGroupFormField";
|
|
|
52
52
|
export * from "./components/FormFields/CheckboxGroupFormField";
|
|
53
53
|
export * from "./components/FormFields/AddressFormFields/CountryFormField";
|
|
54
54
|
export * from "./components/FormFields/SelectFormField";
|
|
55
|
+
export * from "./components/FormFields/SwitchFormField";
|
|
55
56
|
export * from "./components/FormFields/EmailFormField";
|
|
56
57
|
export * from "./components/FormFields/RichEditorFormField";
|
|
57
58
|
export * from "./components/FormFields/CalendarFormField";
|