@sunggang/ui-lib 0.2.87 → 0.2.89
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 +66811 -0
- package/index.esm.css +50 -13
- package/index.esm.js +2 -1
- package/index.esm2.js +40224 -27988
- package/index.esm3.js +1 -0
- package/package.json +1 -1
- package/src/components/ui/baseSwitch.d.ts +16 -0
- package/src/components/ui/switch.d.ts +7 -4
- package/src/index.d.ts +2 -0
- package/src/lib/Ckeditor/BaseCkeditor.d.ts +7 -0
- package/src/lib/Form/CityDistrict.d.ts +3 -33
- package/src/lib/Form/FormChild.d.ts +2 -0
- package/src/lib/Form/StyleSelect.d.ts +11 -0
- package/src/lib/Form/demo.d.ts +137 -0
- package/src/lib/Form/index.d.ts +23 -29
- package/src/lib/Form/types.d.ts +34 -0
- package/src/lib/Provider/FormProvider.d.ts +11 -0
package/index.esm3.js
CHANGED
|
@@ -17,6 +17,7 @@ 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 '@material-ui/core/FormControl';
|
|
20
21
|
import '@tanstack/react-table';
|
|
21
22
|
import '@radix-ui/react-dropdown-menu';
|
|
22
23
|
import '@radix-ui/react-icons';
|
package/package.json
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
interface SwitchProps {
|
|
3
|
+
item?: {
|
|
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>>;
|
|
16
|
+
export default BaseSwitch;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
interface SwitchProps {
|
|
3
|
+
name: string;
|
|
4
|
+
className?: string;
|
|
5
|
+
color?: 'blue' | 'red' | 'green' | 'yellow';
|
|
6
|
+
size?: 'small' | 'medium' | 'large';
|
|
7
|
+
}
|
|
8
|
+
export declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLButtonElement>>;
|
|
6
9
|
export default Switch;
|
package/src/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from './lib/UploadImage/CustomUpload';
|
|
|
7
7
|
export * from './components/ui/switch';
|
|
8
8
|
export * from './components/ui/dateRangePicker';
|
|
9
9
|
export * from './components/ui/reactDateRange';
|
|
10
|
+
export * from './components/ui/baseSwitch';
|
|
10
11
|
export * from './components/ui/button';
|
|
11
12
|
export * from './lib/DataTable';
|
|
12
13
|
export * from './lib/DataTable/BaseTable';
|
|
@@ -16,3 +17,4 @@ export * from './lib/BigCalender/dnd';
|
|
|
16
17
|
export * from './lib/Select/CustomSelect';
|
|
17
18
|
export * from './lib/Tabs/TabsPanel';
|
|
18
19
|
export * from './lib/Provider/LiffProvider';
|
|
20
|
+
export * from './lib/Provider/FormProvider';
|
|
@@ -1,34 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
item?: {
|
|
5
|
-
id?: string;
|
|
6
|
-
label?: string;
|
|
7
|
-
name?: string;
|
|
8
|
-
placeholder?: string;
|
|
9
|
-
type?: string;
|
|
10
|
-
errorText?: string;
|
|
11
|
-
option?: Array<{
|
|
12
|
-
length: string;
|
|
13
|
-
map: (callback: any) => void;
|
|
14
|
-
}>;
|
|
15
|
-
validateOption?: {
|
|
16
|
-
required?: boolean;
|
|
17
|
-
pattern?: RegExp;
|
|
18
|
-
};
|
|
19
|
-
disable?: boolean;
|
|
20
|
-
defaultValue?: string;
|
|
21
|
-
icon?: string;
|
|
22
|
-
subIcon?: string;
|
|
23
|
-
style?: React.CSSProperties;
|
|
24
|
-
textColor?: string;
|
|
25
|
-
cityName?: string;
|
|
26
|
-
districtName?: string;
|
|
27
|
-
};
|
|
28
|
-
getValues: (field: string) => string | undefined;
|
|
29
|
-
setValue: (field: string, value: string) => void;
|
|
30
|
-
register: (field: string, options?: object) => object;
|
|
31
|
-
errors?: Record<string, any>;
|
|
32
|
-
}
|
|
33
|
-
declare const CityDistrict: React.FC<CityDistrictProps>;
|
|
1
|
+
export declare const CityDistrict: ({ item }: {
|
|
2
|
+
item: any;
|
|
3
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
34
4
|
export default CityDistrict;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface StyleAutoCompleteProps {
|
|
3
|
+
width?: number;
|
|
4
|
+
}
|
|
5
|
+
export declare const StyleSelect: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
6
|
+
export declare const StyleFitSelect: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
7
|
+
export declare const StyleField: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
8
|
+
export declare const StyleRadio: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
9
|
+
export declare const StyleAutoComplete: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyleAutoCompleteProps>> & string;
|
|
10
|
+
export declare const StyleText: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
export declare const Regex: {
|
|
2
|
+
phone: RegExp;
|
|
3
|
+
};
|
|
4
|
+
export declare const config: (getValues: any) => (({
|
|
5
|
+
type: string;
|
|
6
|
+
name: string;
|
|
7
|
+
label: string;
|
|
8
|
+
id: string;
|
|
9
|
+
placeholder: string;
|
|
10
|
+
validateOption?: undefined;
|
|
11
|
+
text_size?: undefined;
|
|
12
|
+
textColor?: undefined;
|
|
13
|
+
errorText?: undefined;
|
|
14
|
+
} | {
|
|
15
|
+
type: string;
|
|
16
|
+
name: string;
|
|
17
|
+
label: string;
|
|
18
|
+
id: string;
|
|
19
|
+
placeholder: string;
|
|
20
|
+
validateOption: {
|
|
21
|
+
pattern: RegExp;
|
|
22
|
+
validateMsg: string;
|
|
23
|
+
required?: undefined;
|
|
24
|
+
validate?: undefined;
|
|
25
|
+
};
|
|
26
|
+
text_size?: undefined;
|
|
27
|
+
textColor?: undefined;
|
|
28
|
+
errorText?: undefined;
|
|
29
|
+
} | {
|
|
30
|
+
type: string;
|
|
31
|
+
name: string;
|
|
32
|
+
label: string;
|
|
33
|
+
id: string;
|
|
34
|
+
placeholder: string;
|
|
35
|
+
text_size: string;
|
|
36
|
+
textColor: string;
|
|
37
|
+
errorText: string;
|
|
38
|
+
validateOption: {
|
|
39
|
+
required: boolean;
|
|
40
|
+
validate: (value: string) => true | "身分證格式錯誤";
|
|
41
|
+
pattern?: undefined;
|
|
42
|
+
validateMsg?: undefined;
|
|
43
|
+
};
|
|
44
|
+
})[] | ({
|
|
45
|
+
type: string;
|
|
46
|
+
name: string;
|
|
47
|
+
label: string;
|
|
48
|
+
id: string;
|
|
49
|
+
placeholder: string;
|
|
50
|
+
errorText: string;
|
|
51
|
+
option: ({
|
|
52
|
+
value: string;
|
|
53
|
+
name: string;
|
|
54
|
+
label?: undefined;
|
|
55
|
+
options?: undefined;
|
|
56
|
+
} | {
|
|
57
|
+
label: string;
|
|
58
|
+
options: {
|
|
59
|
+
value: string;
|
|
60
|
+
name: string;
|
|
61
|
+
}[];
|
|
62
|
+
value?: undefined;
|
|
63
|
+
name?: undefined;
|
|
64
|
+
})[];
|
|
65
|
+
validateOption: {
|
|
66
|
+
required: boolean;
|
|
67
|
+
};
|
|
68
|
+
cityName?: undefined;
|
|
69
|
+
districtName?: undefined;
|
|
70
|
+
color?: undefined;
|
|
71
|
+
size?: undefined;
|
|
72
|
+
} | {
|
|
73
|
+
type: string;
|
|
74
|
+
name: string;
|
|
75
|
+
label: string;
|
|
76
|
+
id: string;
|
|
77
|
+
placeholder?: undefined;
|
|
78
|
+
errorText?: undefined;
|
|
79
|
+
option?: undefined;
|
|
80
|
+
validateOption?: undefined;
|
|
81
|
+
cityName?: undefined;
|
|
82
|
+
districtName?: undefined;
|
|
83
|
+
color?: undefined;
|
|
84
|
+
size?: undefined;
|
|
85
|
+
} | {
|
|
86
|
+
type: string;
|
|
87
|
+
name: string;
|
|
88
|
+
cityName: string;
|
|
89
|
+
districtName: string;
|
|
90
|
+
label: string;
|
|
91
|
+
id: string;
|
|
92
|
+
validateOption: {
|
|
93
|
+
required: boolean;
|
|
94
|
+
};
|
|
95
|
+
errorText: string;
|
|
96
|
+
placeholder?: undefined;
|
|
97
|
+
option?: undefined;
|
|
98
|
+
color?: undefined;
|
|
99
|
+
size?: undefined;
|
|
100
|
+
} | {
|
|
101
|
+
type: string;
|
|
102
|
+
name: string;
|
|
103
|
+
label: string;
|
|
104
|
+
id: string;
|
|
105
|
+
color: string;
|
|
106
|
+
size: string;
|
|
107
|
+
placeholder?: undefined;
|
|
108
|
+
errorText?: undefined;
|
|
109
|
+
option?: undefined;
|
|
110
|
+
validateOption?: undefined;
|
|
111
|
+
cityName?: undefined;
|
|
112
|
+
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
|
+
})[])[];
|
package/src/lib/Form/index.d.ts
CHANGED
|
@@ -1,59 +1,53 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
|
|
1
|
+
export declare const City: ({ item }: {
|
|
2
|
+
item: any;
|
|
3
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare const Textarea: ({ item }: {
|
|
3
5
|
item: any;
|
|
4
|
-
methods: any;
|
|
5
6
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
6
7
|
export declare const FieldLabel: ({ item }: {
|
|
7
8
|
item: any;
|
|
8
9
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
export declare const Fields: ({
|
|
10
|
-
methods: any;
|
|
10
|
+
export declare const Fields: ({ formConfig }: {
|
|
11
11
|
formConfig: any;
|
|
12
|
-
className: any;
|
|
13
12
|
}) => any;
|
|
14
|
-
export declare const Row: ({ rowItems
|
|
13
|
+
export declare const Row: ({ rowItems }: {
|
|
15
14
|
rowItems: any;
|
|
16
|
-
methods: any;
|
|
17
15
|
}) => any;
|
|
18
16
|
declare const Form: {
|
|
19
|
-
Fields: ({
|
|
20
|
-
methods: any;
|
|
17
|
+
Fields: ({ formConfig }: {
|
|
21
18
|
formConfig: any;
|
|
22
|
-
className: any;
|
|
23
19
|
}) => any;
|
|
24
|
-
Row: ({ rowItems
|
|
20
|
+
Row: ({ rowItems }: {
|
|
25
21
|
rowItems: any;
|
|
26
|
-
methods: any;
|
|
27
22
|
}) => any;
|
|
28
|
-
TextField: ({
|
|
29
|
-
className?: string | undefined;
|
|
23
|
+
TextField: ({ item }: {
|
|
30
24
|
item: any;
|
|
31
|
-
methods: any;
|
|
32
25
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
33
|
-
SingleSelect: ({
|
|
34
|
-
className?: string | undefined;
|
|
26
|
+
SingleSelect: ({ item }: {
|
|
35
27
|
item: any;
|
|
36
|
-
methods: any;
|
|
37
|
-
disable: any;
|
|
38
28
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
39
|
-
MultipleSelect: ({
|
|
40
|
-
className?: string | undefined;
|
|
29
|
+
MultipleSelect: ({ item }: {
|
|
41
30
|
item: any;
|
|
42
|
-
methods: any;
|
|
43
31
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
44
32
|
FieldLabel: ({ item }: {
|
|
45
33
|
item: any;
|
|
46
34
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
47
|
-
RadioField: ({
|
|
48
|
-
className: any;
|
|
35
|
+
RadioField: ({ direction, item }: {
|
|
49
36
|
direction?: string | undefined;
|
|
50
37
|
item: any;
|
|
51
|
-
methods: any;
|
|
52
38
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
53
|
-
Time: ({
|
|
54
|
-
|
|
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 }: {
|
|
46
|
+
item: any;
|
|
47
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
48
|
+
CityDistrict: ({ item }: {
|
|
55
49
|
item: any;
|
|
56
|
-
methods: any;
|
|
57
50
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
58
51
|
};
|
|
52
|
+
export { Form };
|
|
59
53
|
export default Form;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
interface Option {
|
|
2
|
+
value: string;
|
|
3
|
+
name: string;
|
|
4
|
+
}
|
|
5
|
+
interface OptionGroup {
|
|
6
|
+
label: string;
|
|
7
|
+
options: Option[];
|
|
8
|
+
}
|
|
9
|
+
type Options = (Option | OptionGroup)[];
|
|
10
|
+
export interface FormItem {
|
|
11
|
+
type: string;
|
|
12
|
+
name: string;
|
|
13
|
+
cityName?: string;
|
|
14
|
+
districtName?: string;
|
|
15
|
+
label?: string;
|
|
16
|
+
id?: string;
|
|
17
|
+
placeholder?: string;
|
|
18
|
+
className?: string;
|
|
19
|
+
labelClass?: string;
|
|
20
|
+
errorText?: string;
|
|
21
|
+
color?: 'blue' | 'red' | 'green' | 'yellow';
|
|
22
|
+
size?: 'small' | 'medium' | 'large';
|
|
23
|
+
validateOption?: {
|
|
24
|
+
pattern?: RegExp;
|
|
25
|
+
validateMsg?: string;
|
|
26
|
+
required?: boolean;
|
|
27
|
+
validate?: any;
|
|
28
|
+
};
|
|
29
|
+
option?: Options;
|
|
30
|
+
}
|
|
31
|
+
export interface FormType {
|
|
32
|
+
item: FormItem;
|
|
33
|
+
}
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useForm, useFormContext, Controller } from 'react-hook-form';
|
|
3
|
+
export type FormProviderProps = {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
onSubmit: (data: any) => void;
|
|
6
|
+
defaultValues?: any;
|
|
7
|
+
useFormContext?: any;
|
|
8
|
+
};
|
|
9
|
+
export declare const FormProvider: ({ children, onSubmit, defaultValues, }: FormProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export { useFormContext, useForm, Controller };
|
|
11
|
+
export default FormProvider;
|