dynamic-modal 1.1.4 → 1.1.8

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 (50) hide show
  1. package/README-ES.md +217 -217
  2. package/README.md +216 -216
  3. package/dist/components/input-upload/input-upload.js +1 -1
  4. package/dist/components/make-button/make-button.js +7 -17
  5. package/dist/components/make-input/make-input.js +7 -17
  6. package/dist/components/make-select/make-select.js +7 -17
  7. package/dist/components/make-textarea/make-textarea.js +7 -17
  8. package/dist/components/make-toggle/make-toggle.js +7 -17
  9. package/dist/components/portal/portal.js +7 -17
  10. package/dist/context/component/component-state.js +7 -17
  11. package/dist/hooks/field-render.d.ts +1 -0
  12. package/dist/hooks/field-render.js +22 -15
  13. package/dist/interfaces/modal.d.ts +5 -1
  14. package/dist/modal.js +38 -19
  15. package/eslint.config.mjs +14 -14
  16. package/examples/enable-if.ts +127 -127
  17. package/examples/live-data.ts +61 -61
  18. package/examples/render-if.ts +128 -128
  19. package/examples/simple.ts +74 -74
  20. package/index.ts +5 -5
  21. package/package.json +46 -47
  22. package/src/components/input-upload/input-upload.tsx +67 -67
  23. package/src/components/make-button/make-button.tsx +18 -18
  24. package/src/components/make-description/make-description.tsx +15 -15
  25. package/src/components/make-input/make-input.tsx +53 -53
  26. package/src/components/make-select/make-select.tsx +55 -55
  27. package/src/components/make-textarea/make-textarea.tsx +53 -53
  28. package/src/components/make-toggle/make-toggle.tsx +53 -53
  29. package/src/components/make-upload/make-upload.tsx +40 -40
  30. package/src/components/portal/portal.tsx +37 -37
  31. package/src/context/component/component-state.tsx +17 -17
  32. package/src/hooks/field-render.ts +120 -109
  33. package/src/hooks/modal-handler.ts +38 -38
  34. package/src/interfaces/component-state.ts +33 -33
  35. package/src/interfaces/field.ts +37 -37
  36. package/src/interfaces/input-upload.ts +21 -21
  37. package/src/interfaces/make-button.ts +19 -19
  38. package/src/interfaces/make-description.ts +14 -14
  39. package/src/interfaces/make-field-group.ts +14 -14
  40. package/src/interfaces/make-input.ts +14 -14
  41. package/src/interfaces/make-select.ts +15 -15
  42. package/src/interfaces/make-textarea.ts +11 -11
  43. package/src/interfaces/make-toggle.ts +9 -9
  44. package/src/interfaces/make-upload.ts +14 -14
  45. package/src/interfaces/modal.ts +50 -46
  46. package/src/interfaces/option.ts +3 -3
  47. package/src/interfaces/portal.ts +8 -8
  48. package/src/modal.tsx +196 -164
  49. package/src/tools/general.ts +8 -8
  50. package/tsconfig.json +13 -13
@@ -1,18 +1,18 @@
1
- 'use client'
2
-
3
- import React, { useMemo } from "react"
4
- import { createContext } from "react"
5
- import { IComponentState, IComponentStateProps } from "../../interfaces/component-state"
6
-
7
- export const ComponentStateContext = createContext<IComponentState>({} as IComponentState)
8
-
9
- export const ComponentState = ({ children, components }: IComponentStateProps) => {
10
-
11
- const value: IComponentState = useMemo(() => components, [])
12
-
13
- return (
14
- <ComponentStateContext.Provider value={value}>
15
- {children}
16
- </ComponentStateContext.Provider>
17
- )
1
+ 'use client'
2
+
3
+ import React, { useMemo } from "react"
4
+ import { createContext } from "react"
5
+ import { IComponentState, IComponentStateProps } from "../../interfaces/component-state"
6
+
7
+ export const ComponentStateContext = createContext<IComponentState>({} as IComponentState)
8
+
9
+ export const ComponentState = ({ children, components }: IComponentStateProps) => {
10
+
11
+ const value: IComponentState = useMemo(() => components, [])
12
+
13
+ return (
14
+ <ComponentStateContext.Provider value={value}>
15
+ {children}
16
+ </ComponentStateContext.Provider>
17
+ )
18
18
  }
@@ -1,109 +1,120 @@
1
- 'use client'
2
-
3
- import { useCallback, useMemo, useState } from 'react'
4
- import { IField, IFieldProps } from '../interfaces/field'
5
- import { IOption } from '../interfaces/option'
6
- import { IModalLiveDataCondition, IModalRenderCondition } from '../interfaces/modal'
7
-
8
- export type IFormData = Record<string, unknown>
9
-
10
- export interface IWatchEvent {
11
- name: string | undefined;
12
- type: string | undefined;
13
- }
14
-
15
- export interface IFieldRender {
16
- render: boolean | null;
17
- enable: boolean | null;
18
- checkField: (formData: IFormData, { name, type }: IWatchEvent) => void;
19
- liveData?: Array<IOption>;
20
- liveSearching?: boolean;
21
- }
22
-
23
- export interface IFieldRenderProps extends Pick<IFieldProps, 'setValue' | 'unregister'> {
24
- element: Partial<Pick<IField, 'enableIf' | 'renderIf' | 'name' >> & Partial<Record<'liveData', IModalLiveDataCondition>>
25
- }
26
-
27
- export const useFieldRender = ({ element, setValue, unregister }: IFieldRenderProps): IFieldRender => {
28
- const [render, setRender] = useState<boolean|null>(null)
29
- const [enable, setEnable] = useState<boolean|null>(null)
30
- const [liveSearching, setLiveSearching] = useState<boolean>(false)
31
- const [liveData, setLiveData] = useState<Array<IOption> | undefined>(undefined)
32
-
33
- const renderCondition = useMemo<boolean>(
34
- () => {
35
- const isRender: boolean = element.renderIf !== undefined
36
- if (render === null) setRender(!isRender)
37
- return isRender
38
- }, [element.renderIf, render]
39
- )
40
-
41
- const enableCondition = useMemo<boolean>(
42
- () => {
43
- const isEnable: boolean = element.enableIf !== undefined
44
- if (enable === null) setEnable(!isEnable)
45
- return isEnable
46
- }, [element.enableIf, enable]
47
- )
48
-
49
- const liveDataCondition = useMemo<boolean>(
50
- () => {
51
- return element.liveData !== undefined
52
- }, [element.liveData]
53
- )
54
-
55
- const renderConditionList: Array<string> = useMemo(() => {
56
- return renderCondition ? Object.keys(element.renderIf as IModalRenderCondition) : []
57
- }, [element.renderIf, renderCondition])
58
-
59
- const enableConditionList: Array<string> = useMemo(() => {
60
- return enableCondition ? Object.keys(element.enableIf as IModalRenderCondition) : []
61
- }, [enableCondition, element.enableIf])
62
-
63
- const liveDataAction = useCallback(
64
- async (field: string |number | Array<unknown>, formData: IFormData) => {
65
- if (typeof field === 'string' && element.liveData?.action) {
66
- const options = element.liveData.action(field, formData)
67
- return options ?? []
68
- }
69
- return [] as Array<IOption>
70
- }, [element.liveData]
71
- )
72
-
73
- const checkField = useCallback(
74
- async (formData: IFormData, { name }: IWatchEvent) => {
75
- const key: string = name ?? ''
76
- const targetField = formData[key] as string | number
77
- const fieldValidValue: boolean = targetField !== undefined && targetField !== null && targetField !== ''
78
-
79
- if (renderCondition && renderConditionList.includes(key) && fieldValidValue) {
80
- const renderStatus: boolean = (element.renderIf as IModalRenderCondition)[key]!.includes(targetField) || (element.renderIf as IModalRenderCondition)[key]!.includes('*')
81
- if (render !== renderStatus) {
82
- setRender(renderStatus)
83
- if(!renderStatus) unregister(element.name as string)
84
- }
85
- } else if (enableCondition && enableConditionList.includes(key) && fieldValidValue) {
86
- const enableStatus: boolean = (element.enableIf as IModalRenderCondition)[key]!.includes(targetField) || (element.enableIf as IModalRenderCondition)[key]!.includes('*')
87
- if (enable !== enableStatus) setEnable(enableStatus)
88
- }
89
-
90
- if (liveDataCondition && element.liveData?.condition.includes(key)) {
91
- if (targetField) {
92
- setLiveSearching(true)
93
- const options: Array<IOption> = await liveDataAction(targetField, formData)
94
- if (liveData && JSON.stringify(liveData) !== JSON.stringify(options)) { setValue(element.name as string, options) }
95
- setLiveData(options)
96
- setLiveSearching(false)
97
- }
98
- }
99
- }, [enable, enableCondition, enableConditionList, liveData, liveDataAction, liveDataCondition, render, renderCondition, renderConditionList]
100
- )
101
-
102
- return {
103
- render,
104
- enable,
105
- checkField,
106
- liveData,
107
- liveSearching
108
- }
109
- }
1
+ 'use client'
2
+
3
+ import { useCallback, useMemo, useState } from 'react'
4
+ import { IField, IFieldProps } from '../interfaces/field'
5
+ import { IOption } from '../interfaces/option'
6
+ import { IModalLiveDataCondition, IModalRenderCondition } from '../interfaces/modal'
7
+
8
+ export type IFormData = Record<string, unknown>
9
+
10
+ export interface IWatchEvent {
11
+ name: string | undefined
12
+ type: string | undefined
13
+ }
14
+
15
+ export interface IFieldRender {
16
+ render: boolean | null
17
+ enable: boolean | null
18
+ checkField: (formData: IFormData, { name, type }: IWatchEvent) => void
19
+ liveData?: Array<IOption>
20
+ liveSearching?: boolean
21
+ }
22
+
23
+ export interface IFieldRenderProps extends Pick<IFieldProps, 'setValue' | 'unregister'> {
24
+ element: Partial<Pick<IField, 'enableIf' | 'renderIf' | 'name' >> & Partial<Record<'liveData', IModalLiveDataCondition>>
25
+ }
26
+
27
+ export type ILiveHandlerProps = Pick<IField, 'enableIf' | 'renderIf'>
28
+
29
+ export const useFieldRender = ({ element, setValue, unregister }: IFieldRenderProps): IFieldRender => {
30
+ const [render, setRender] = useState<boolean|null>(null)
31
+ const [enable, setEnable] = useState<boolean|null>(null)
32
+ const [liveSearching, setLiveSearching] = useState<boolean>(false)
33
+ const [liveData, setLiveData] = useState<Array<IOption> | undefined>(undefined)
34
+
35
+ const renderCondition = useMemo<boolean>(
36
+ () => {
37
+ const isRender: boolean = element.renderIf !== undefined
38
+ if (render === null) setRender(!isRender)
39
+ return isRender
40
+ }, [element.renderIf, render]
41
+ )
42
+
43
+ const enableCondition = useMemo<boolean>(
44
+ () => {
45
+ const isEnable: boolean = element.enableIf !== undefined
46
+ if (enable === null) setEnable(!isEnable)
47
+ return isEnable
48
+ }, [element.enableIf, enable]
49
+ )
50
+
51
+ const liveDataCondition = useMemo<boolean>(
52
+ () => {
53
+ return element.liveData !== undefined
54
+ }, [element.liveData]
55
+ )
56
+
57
+ const renderConditionList: Array<string> = useMemo(() => {
58
+ return renderCondition ? Object.keys(element.renderIf as IModalRenderCondition) : []
59
+ }, [element.renderIf, renderCondition])
60
+
61
+ const enableConditionList: Array<string> = useMemo(() => {
62
+ return enableCondition ? Object.keys(element.enableIf as IModalRenderCondition) : []
63
+ }, [enableCondition, element.enableIf])
64
+
65
+ const liveDataAction = useCallback(
66
+ async (field: string | number | Array<unknown>, formData: IFormData) => {
67
+ if (typeof field === 'string' && element.liveData?.action) {
68
+ const options = element.liveData.action(field, formData)
69
+ return options ?? []
70
+ }
71
+ return [] as Array<IOption>
72
+ }, [element.liveData]
73
+ )
74
+
75
+ const liveDataHandler = useCallback(
76
+ async (targetHandler: keyof ILiveHandlerProps, field: string | number | Array<unknown>, formData: IFormData) => {
77
+ if (typeof field === 'string' && element[targetHandler]?.action) {
78
+ const result = element[targetHandler].action(field, formData)
79
+ return result ?? false
80
+ }
81
+
82
+ return false
83
+ }, [element.liveData]
84
+ )
85
+
86
+ const checkField = useCallback(
87
+ async (formData: IFormData, { name }: IWatchEvent) => {
88
+ const key: string = name ?? ''
89
+ const targetField = formData[key] as string | number
90
+ if(!targetField) return
91
+
92
+ if (renderCondition && element.renderIf?.condition.includes(key)) {
93
+ const renderStatus: boolean = await liveDataHandler('renderIf', targetField, formData)
94
+ if (render !== renderStatus) {
95
+ setRender(renderStatus)
96
+ if(!renderStatus) unregister(element.name as string)
97
+ }
98
+ } else if (enableCondition && element.enableIf?.condition.includes(key)){
99
+ const enableStatus: boolean = await liveDataHandler('enableIf', targetField, formData)
100
+ if (enable !== enableStatus) setEnable(enableStatus)
101
+ }
102
+
103
+ if (liveDataCondition && element.liveData?.condition.includes(key)) {
104
+ setLiveSearching(true)
105
+ const options: Array<IOption> = await liveDataAction(targetField, formData)
106
+ if (liveData && JSON.stringify(liveData) !== JSON.stringify(options)) { setValue(element.name as string, options) }
107
+ setLiveData(options)
108
+ setLiveSearching(false)
109
+ }
110
+ }, [enable, enableCondition, enableConditionList, liveData, liveDataAction, liveDataCondition, render, renderCondition, renderConditionList]
111
+ )
112
+
113
+ return {
114
+ render,
115
+ enable,
116
+ checkField,
117
+ liveData,
118
+ liveSearching
119
+ }
120
+ }
@@ -1,38 +1,38 @@
1
- 'use client'
2
-
3
- import { useState } from 'react'
4
- import { IModal, IModalConfigProps } from '../interfaces/modal'
5
-
6
- interface IModalHandler {
7
- openModal: (config: IModalConfigProps) => void
8
- modalProps: IModal
9
- }
10
-
11
- export function useModalHandler (): IModalHandler {
12
- const initialState: IModalHandler = {
13
- modalProps: {
14
- config: {} as IModalConfigProps,
15
- close: () => {},
16
- open: false,
17
- },
18
- openModal: () => {},
19
- }
20
-
21
- const [modalConfig, setModalConfig] = useState<IModalHandler>(initialState)
22
-
23
- const openModal = (config: IModalConfigProps) => {
24
- if (!config) {
25
- alert(`¡WARNING! this modal was not returned config, please check before use`)
26
- return
27
- }
28
-
29
- setModalConfig({ openModal, modalProps: { config, open: true, close } })
30
- }
31
-
32
- const closeModal = () => setModalConfig(initialState)
33
-
34
- return {
35
- openModal,
36
- modalProps: { ...modalConfig.modalProps, close: closeModal },
37
- }
38
- }
1
+ 'use client'
2
+
3
+ import { useState } from 'react'
4
+ import { IModal, IModalConfigProps } from '../interfaces/modal'
5
+
6
+ interface IModalHandler {
7
+ openModal: (config: IModalConfigProps) => void
8
+ modalProps: IModal
9
+ }
10
+
11
+ export function useModalHandler (): IModalHandler {
12
+ const initialState: IModalHandler = {
13
+ modalProps: {
14
+ config: {} as IModalConfigProps,
15
+ close: () => {},
16
+ open: false,
17
+ },
18
+ openModal: () => {},
19
+ }
20
+
21
+ const [modalConfig, setModalConfig] = useState<IModalHandler>(initialState)
22
+
23
+ const openModal = (config: IModalConfigProps) => {
24
+ if (!config) {
25
+ alert(`¡WARNING! this modal was not returned config, please check before use`)
26
+ return
27
+ }
28
+
29
+ setModalConfig({ openModal, modalProps: { config, open: true, close } })
30
+ }
31
+
32
+ const closeModal = () => setModalConfig(initialState)
33
+
34
+ return {
35
+ openModal,
36
+ modalProps: { ...modalConfig.modalProps, close: closeModal },
37
+ }
38
+ }
@@ -1,33 +1,33 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- import { FC, PropsWithChildren } from "react"
3
- import { FieldError } from "react-hook-form"
4
- import { IOption } from "./option"
5
- import { IMakeInput } from "./make-input"
6
- import { IMakeButton } from "./make-button"
7
- import { IMakeSelect } from "./make-select"
8
- import { IMakeTextarea } from "./make-textarea"
9
- import { IMakeToggle } from "./make-toggle"
10
-
11
- export interface IComponentAditionalProps {
12
- onChange: (...event: any[]) => void
13
- value: any
14
- invalid: boolean
15
- error?: FieldError
16
- liveSearching?: boolean
17
- }
18
-
19
- export interface IComponentState {
20
- ModalButtonCancel: FC<Omit<IMakeButton, 'elementType'>>
21
- ModalButtonAction: FC<Omit<IMakeButton, 'elementType'>>
22
- Button: FC<Omit<IMakeButton, 'elementType'>>
23
- //Description: FC<Omit<IMakeDescription, 'elementType'>>
24
- Input: FC<Omit<IMakeInput, 'elementType' | 'validation' |'renderIf' | 'enableIf'> & IComponentAditionalProps>
25
- Select: FC<Omit<IMakeSelect, 'elementType' | 'validation' |'renderIf' | 'enableIf'> & IComponentAditionalProps & Record<'options', Array<IOption>>>
26
- Textarea: FC<Omit<IMakeTextarea, 'elementType' | 'validation' |'renderIf' | 'enableIf'> & IComponentAditionalProps>
27
- Toggle: FC<Omit<IMakeToggle, 'elementType' | 'validation' |'renderIf' | 'enableIf'> & IComponentAditionalProps>
28
- }
29
-
30
- export interface IComponentStateProps extends PropsWithChildren {
31
- components: IComponentState
32
- }
33
-
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ import { FC, PropsWithChildren } from "react"
3
+ import { FieldError } from "react-hook-form"
4
+ import { IOption } from "./option"
5
+ import { IMakeInput } from "./make-input"
6
+ import { IMakeButton } from "./make-button"
7
+ import { IMakeSelect } from "./make-select"
8
+ import { IMakeTextarea } from "./make-textarea"
9
+ import { IMakeToggle } from "./make-toggle"
10
+
11
+ export interface IComponentAditionalProps {
12
+ onChange: (...event: any[]) => void
13
+ value: any
14
+ invalid: boolean
15
+ error?: FieldError
16
+ liveSearching?: boolean
17
+ }
18
+
19
+ export interface IComponentState {
20
+ ModalButtonCancel: FC<Omit<IMakeButton, 'elementType'>>
21
+ ModalButtonAction: FC<Omit<IMakeButton, 'elementType'>>
22
+ Button: FC<Omit<IMakeButton, 'elementType'>>
23
+ //Description: FC<Omit<IMakeDescription, 'elementType'>>
24
+ Input: FC<Omit<IMakeInput, 'elementType' | 'validation' |'renderIf' | 'enableIf'> & IComponentAditionalProps>
25
+ Select: FC<Omit<IMakeSelect, 'elementType' | 'validation' |'renderIf' | 'enableIf'> & IComponentAditionalProps & Record<'options', Array<IOption>>>
26
+ Textarea: FC<Omit<IMakeTextarea, 'elementType' | 'validation' |'renderIf' | 'enableIf'> & IComponentAditionalProps>
27
+ Toggle: FC<Omit<IMakeToggle, 'elementType' | 'validation' |'renderIf' | 'enableIf'> & IComponentAditionalProps>
28
+ }
29
+
30
+ export interface IComponentStateProps extends PropsWithChildren {
31
+ components: IComponentState
32
+ }
33
+
@@ -1,37 +1,37 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- import { CSSProperties } from 'react'
3
- import { Control, FieldValues, UseFormSetValue, UseFormUnregister, UseFormWatch } from 'react-hook-form'
4
- import { IModalRenderCondition } from './modal'
5
-
6
- export interface IValidationBase<T> {
7
- value: T
8
- message: string
9
- }
10
-
11
- export interface IField {
12
- name: string
13
- id?: string
14
- label?: string
15
- style?: CSSProperties
16
- placeholder?: string
17
- defaultValue?: any
18
- renderIf?: IModalRenderCondition
19
- enableIf?: IModalRenderCondition
20
- validation: {
21
- required: boolean
22
- regex?: RegExp
23
- message?: string
24
- maxLength?: IValidationBase<number>
25
- minLength?: IValidationBase<number>
26
- min?: IValidationBase<number | string>
27
- max?: IValidationBase<number | string>
28
- }
29
- disabled?: boolean
30
- }
31
-
32
- export interface IFieldProps {
33
- control: Control<FieldValues, unknown>
34
- watch: UseFormWatch<FieldValues>
35
- setValue: UseFormSetValue<FieldValues>
36
- unregister: UseFormUnregister<FieldValues>
37
- }
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ import { CSSProperties } from 'react'
3
+ import { Control, FieldValues, UseFormSetValue, UseFormUnregister, UseFormWatch } from 'react-hook-form'
4
+ import { IModalRenderCondition } from './modal'
5
+
6
+ export interface IValidationBase<T> {
7
+ value: T
8
+ message: string
9
+ }
10
+
11
+ export interface IField {
12
+ name: string
13
+ id?: string
14
+ label?: string
15
+ style?: CSSProperties
16
+ placeholder?: string
17
+ defaultValue?: any
18
+ renderIf?: IModalRenderCondition
19
+ enableIf?: IModalRenderCondition
20
+ validation: {
21
+ required: boolean
22
+ regex?: RegExp
23
+ message?: string
24
+ maxLength?: IValidationBase<number>
25
+ minLength?: IValidationBase<number>
26
+ min?: IValidationBase<number | string>
27
+ max?: IValidationBase<number | string>
28
+ }
29
+ disabled?: boolean
30
+ }
31
+
32
+ export interface IFieldProps {
33
+ control: Control<FieldValues, unknown>
34
+ watch: UseFormWatch<FieldValues>
35
+ setValue: UseFormSetValue<FieldValues>
36
+ unregister: UseFormUnregister<FieldValues>
37
+ }
@@ -1,21 +1,21 @@
1
- import { ChangeEvent, CSSProperties } from 'react'
2
-
3
- export interface IFileResult {
4
- name: string
5
- size: number
6
- data: string
7
- }
8
-
9
- export interface IInputUpload {
10
- id?: string
11
- value?: string
12
- onChange: (event: ChangeEvent<HTMLInputElement> | IFileResult | FileList | null) => void
13
- accept?:string
14
- label?: string
15
- helpText?: string
16
- style?:CSSProperties
17
- readAsArrayBuffer?: boolean
18
- name: string
19
- disabled?: boolean
20
- read?: boolean
21
- }
1
+ import { ChangeEvent, CSSProperties } from 'react'
2
+
3
+ export interface IFileResult {
4
+ name: string
5
+ size: number
6
+ data: string
7
+ }
8
+
9
+ export interface IInputUpload {
10
+ id?: string
11
+ value?: string
12
+ onChange: (event: ChangeEvent<HTMLInputElement> | IFileResult | FileList | null) => void
13
+ accept?:string
14
+ label?: string
15
+ helpText?: string
16
+ style?:CSSProperties
17
+ readAsArrayBuffer?: boolean
18
+ name: string
19
+ disabled?: boolean
20
+ read?: boolean
21
+ }
@@ -1,19 +1,19 @@
1
- import { CSSProperties } from 'react'
2
- import { IFieldProps } from './field'
3
-
4
- export interface IMakeButton {
5
- id?: string
6
- elementType: 'button'
7
- disabled?: boolean
8
- className?: string
9
- style?: CSSProperties
10
- variant?: string
11
- text?: string
12
- type?: 'button' | 'submit' | 'reset'
13
- onClick?: () => void
14
- color?: string
15
- }
16
-
17
- export interface IMakeButtonProps extends IFieldProps {
18
- element: Omit<IMakeButton, 'elementType'>
19
- }
1
+ import { CSSProperties } from 'react'
2
+ import { IFieldProps } from './field'
3
+
4
+ export interface IMakeButton {
5
+ id?: string
6
+ elementType: 'button'
7
+ disabled?: boolean
8
+ className?: string
9
+ style?: CSSProperties
10
+ variant?: string
11
+ text?: string
12
+ type?: 'button' | 'submit' | 'reset'
13
+ onClick?: () => void
14
+ color?: string
15
+ }
16
+
17
+ export interface IMakeButtonProps extends IFieldProps {
18
+ element: Omit<IMakeButton, 'elementType'>
19
+ }
@@ -1,14 +1,14 @@
1
- import { CSSProperties, FC } from 'react'
2
- import { IFieldProps } from './field'
3
-
4
- export interface IMakeDescription {
5
- elementType: 'text'
6
- text: string
7
- containerStyle?: CSSProperties
8
- textStyle?: CSSProperties
9
- Icon?: FC
10
- }
11
-
12
- export interface IMakeDescriptionProps extends IFieldProps {
13
- element: Omit<IMakeDescription, 'elementType'>
14
- }
1
+ import { CSSProperties, FC } from 'react'
2
+ import { IFieldProps } from './field'
3
+
4
+ export interface IMakeDescription {
5
+ elementType: 'text'
6
+ text: string
7
+ containerStyle?: CSSProperties
8
+ textStyle?: CSSProperties
9
+ Icon?: FC
10
+ }
11
+
12
+ export interface IMakeDescriptionProps extends IFieldProps {
13
+ element: Omit<IMakeDescription, 'elementType'>
14
+ }
@@ -1,14 +1,14 @@
1
- import { CSSProperties } from 'react'
2
- import { IFieldProps } from './field'
3
- import { IModalField } from './modal'
4
-
5
- export interface IMakeFieldGroup {
6
- elementType: 'group'
7
- groups: Array<IModalField>
8
- style?: CSSProperties
9
- title?: string
10
- }
11
-
12
- export interface IMakeFieldGroupProps extends IFieldProps {
13
- element: IMakeFieldGroup
14
- }
1
+ import { CSSProperties } from 'react'
2
+ import { IFieldProps } from './field'
3
+ import { IModalField } from './modal'
4
+
5
+ export interface IMakeFieldGroup {
6
+ elementType: 'group'
7
+ groups: Array<IModalField>
8
+ style?: CSSProperties
9
+ title?: string
10
+ }
11
+
12
+ export interface IMakeFieldGroupProps extends IFieldProps {
13
+ element: IMakeFieldGroup
14
+ }