@sunggang/ui-lib 0.2.95 → 0.2.97
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/BaseCkeditor.esm.js +5 -0
- package/index.esm.css +12 -22
- package/index.esm.js +5 -0
- package/index.esm2.js +526 -2024
- package/index.esm3.js +5 -0
- package/package.json +3 -1
- package/src/components/ui/baseSwitch.d.ts +2 -14
- package/src/lib/Form/demo.d.ts +5 -25
- package/src/lib/Form/index.d.ts +11 -23
- package/src/lib/Form/types.d.ts +39 -4
- package/src/lib/Provider/FormProvider.d.ts +2 -1
package/index.esm3.js
CHANGED
|
@@ -17,6 +17,11 @@ import 'react-date-range';
|
|
|
17
17
|
import 'react-date-range/dist/locale/index.js';
|
|
18
18
|
import 'date-fns/addDays/index.js';
|
|
19
19
|
import 'date-fns/format/index.js';
|
|
20
|
+
import '@emotion/react';
|
|
21
|
+
import '@mui/material/Checkbox';
|
|
22
|
+
import '@mui/material/Radio';
|
|
23
|
+
import '@mui/material/RadioGroup';
|
|
24
|
+
import '@mui/material/FormControlLabel';
|
|
20
25
|
import '@tanstack/react-table';
|
|
21
26
|
import '@radix-ui/react-dropdown-menu';
|
|
22
27
|
import '@radix-ui/react-icons';
|
package/package.json
CHANGED
|
@@ -1,16 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
id?: string | undefined;
|
|
5
|
-
label?: string;
|
|
6
|
-
name: string;
|
|
7
|
-
type?: string;
|
|
8
|
-
disable?: boolean;
|
|
9
|
-
color?: 'blue' | 'red' | 'green' | 'yellow';
|
|
10
|
-
size?: 'small' | 'medium' | 'large';
|
|
11
|
-
className?: string;
|
|
12
|
-
labelClass?: string;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export declare const BaseSwitch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLButtonElement>>;
|
|
2
|
+
import { FormType } from '../../lib/Form/types';
|
|
3
|
+
export declare const BaseSwitch: React.ForwardRefExoticComponent<FormType & React.RefAttributes<HTMLButtonElement>>;
|
|
16
4
|
export default BaseSwitch;
|
package/src/lib/Form/demo.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import { FormItem } from './types';
|
|
1
2
|
export declare const Regex: {
|
|
2
3
|
phone: RegExp;
|
|
3
4
|
};
|
|
4
|
-
export declare const
|
|
5
|
+
export declare const checkboxConfig: FormItem;
|
|
6
|
+
export declare const checkboxGroupConfig: FormItem;
|
|
7
|
+
export declare const radioConfig: FormItem;
|
|
8
|
+
export declare const config: (getValues: any) => (FormItem[] | ({
|
|
5
9
|
type: string;
|
|
6
10
|
name: string;
|
|
7
11
|
label: string;
|
|
@@ -110,28 +114,4 @@ export declare const config: (getValues: any) => (({
|
|
|
110
114
|
validateOption?: undefined;
|
|
111
115
|
cityName?: undefined;
|
|
112
116
|
districtName?: undefined;
|
|
113
|
-
})[] | ({
|
|
114
|
-
type: string;
|
|
115
|
-
name: string;
|
|
116
|
-
label: string;
|
|
117
|
-
id: string;
|
|
118
|
-
placeholder: string;
|
|
119
|
-
errorText: string;
|
|
120
|
-
validateOption: {
|
|
121
|
-
required: boolean;
|
|
122
|
-
validate?: undefined;
|
|
123
|
-
};
|
|
124
|
-
} | {
|
|
125
|
-
type: string;
|
|
126
|
-
name: string;
|
|
127
|
-
label: string;
|
|
128
|
-
id: string;
|
|
129
|
-
placeholder: string;
|
|
130
|
-
errorText: string;
|
|
131
|
-
validateOption: {
|
|
132
|
-
required: boolean;
|
|
133
|
-
validate: {
|
|
134
|
-
afterStart: (value: string) => true | "結束時間需大於起始時間" | undefined;
|
|
135
|
-
};
|
|
136
|
-
};
|
|
137
117
|
})[])[];
|
package/src/lib/Form/index.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export declare const Textarea:
|
|
5
|
-
item: any;
|
|
6
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FormType } from './types';
|
|
3
|
+
export declare const City: React.FC<FormType>;
|
|
4
|
+
export declare const Textarea: React.FC<FormType>;
|
|
7
5
|
export declare const FieldLabel: ({ item }: {
|
|
8
6
|
item: any;
|
|
9
7
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -20,32 +18,22 @@ export declare const Form: {
|
|
|
20
18
|
Row: ({ rowItems }: {
|
|
21
19
|
rowItems: any;
|
|
22
20
|
}) => any;
|
|
23
|
-
TextField: (
|
|
24
|
-
|
|
25
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
26
|
-
SingleSelect: ({ item }: {
|
|
27
|
-
item: any;
|
|
28
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
TextField: import("react").FC<FormType>;
|
|
22
|
+
SingleSelect: import("react").FC<FormType>;
|
|
29
23
|
MultipleSelect: ({ item }: {
|
|
30
24
|
item: any;
|
|
31
25
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
32
26
|
FieldLabel: ({ item }: {
|
|
33
27
|
item: any;
|
|
34
28
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
35
|
-
RadioField: ({
|
|
36
|
-
direction?: string | undefined;
|
|
37
|
-
item: any;
|
|
38
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
39
|
-
Time: ({ item }: {
|
|
40
|
-
item: any;
|
|
41
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
42
|
-
Textarea: ({ item }: {
|
|
43
|
-
item: any;
|
|
44
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
45
|
-
City: ({ item }: {
|
|
29
|
+
RadioField: ({ item }: {
|
|
46
30
|
item: any;
|
|
47
31
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
Time: import("react").FC<FormType>;
|
|
33
|
+
Textarea: import("react").FC<FormType>;
|
|
34
|
+
City: import("react").FC<FormType>;
|
|
48
35
|
CityDistrict: ({ item }: {
|
|
49
36
|
item: any;
|
|
50
37
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
CheckboxField: import("react").FC<FormType>;
|
|
51
39
|
};
|
package/src/lib/Form/types.d.ts
CHANGED
|
@@ -6,27 +6,62 @@ interface OptionGroup {
|
|
|
6
6
|
label: string;
|
|
7
7
|
options: Option[];
|
|
8
8
|
}
|
|
9
|
+
interface RadioOption {
|
|
10
|
+
label?: string;
|
|
11
|
+
value?: string;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
}
|
|
9
14
|
type Options = (Option | OptionGroup)[];
|
|
15
|
+
interface Checkbox {
|
|
16
|
+
name: string;
|
|
17
|
+
checkboxLabel?: string;
|
|
18
|
+
checkboxLabelClass?: string;
|
|
19
|
+
errorText?: string;
|
|
20
|
+
validateOption?: {
|
|
21
|
+
required?: boolean;
|
|
22
|
+
};
|
|
23
|
+
muiProps?: {
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
size?: 'small' | 'medium' | 'large';
|
|
26
|
+
color?: 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning' | 'default';
|
|
27
|
+
};
|
|
28
|
+
}
|
|
10
29
|
export interface FormItem {
|
|
11
30
|
type: string;
|
|
12
31
|
name: string;
|
|
13
|
-
|
|
14
|
-
|
|
32
|
+
disable?: boolean;
|
|
33
|
+
style?: any;
|
|
15
34
|
label?: string;
|
|
16
35
|
id?: string;
|
|
17
36
|
placeholder?: string;
|
|
18
37
|
className?: string;
|
|
19
38
|
labelClass?: string;
|
|
20
39
|
errorText?: string;
|
|
21
|
-
color?: 'blue' | 'red' | 'green' | 'yellow';
|
|
22
|
-
size?: 'small' | 'medium' | 'large';
|
|
23
40
|
validateOption?: {
|
|
24
41
|
pattern?: RegExp;
|
|
25
42
|
validateMsg?: string;
|
|
26
43
|
required?: boolean;
|
|
27
44
|
validate?: any;
|
|
28
45
|
};
|
|
46
|
+
defaultValue?: string;
|
|
47
|
+
icon?: string;
|
|
29
48
|
option?: Options;
|
|
49
|
+
radioOptions?: RadioOption[];
|
|
50
|
+
direction?: 'horizontal' | 'vertical';
|
|
51
|
+
step?: string;
|
|
52
|
+
cityName?: string;
|
|
53
|
+
districtName?: string;
|
|
54
|
+
onlyHour?: boolean;
|
|
55
|
+
color?: 'blue' | 'red' | 'green' | 'yellow';
|
|
56
|
+
size?: 'small' | 'medium' | 'large';
|
|
57
|
+
checkboxLabel?: string;
|
|
58
|
+
checkboxLabelClass?: string;
|
|
59
|
+
muiProps?: {
|
|
60
|
+
disabled?: boolean;
|
|
61
|
+
size?: 'small' | 'medium' | 'large';
|
|
62
|
+
color?: 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning' | 'default';
|
|
63
|
+
};
|
|
64
|
+
checkboxes?: Checkbox[];
|
|
30
65
|
}
|
|
31
66
|
export interface FormType {
|
|
32
67
|
item: FormItem;
|
|
@@ -3,9 +3,10 @@ import { useForm, useFormContext, Controller } from 'react-hook-form';
|
|
|
3
3
|
export type FormProviderProps = {
|
|
4
4
|
children: React.ReactNode;
|
|
5
5
|
onSubmit: (data: any) => void;
|
|
6
|
+
onError?: (data: any) => void;
|
|
6
7
|
defaultValues?: any;
|
|
7
8
|
useFormContext?: any;
|
|
8
9
|
};
|
|
9
|
-
export declare const FormProvider: ({ children, onSubmit, defaultValues, }: FormProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare const FormProvider: ({ children, onSubmit, onError, defaultValues, }: FormProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
11
|
export { useFormContext, useForm, Controller };
|
|
11
12
|
export default FormProvider;
|