@xqmsg/ui-core 0.16.1 → 0.16.2
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/dist/components/input/StackedInput/StackedInput.d.ts +2 -0
- package/dist/components/input/components/label/index.d.ts +1 -0
- package/dist/components/input/index.d.ts +4 -1
- package/dist/ui-core.cjs.development.js +74 -259
- package/dist/ui-core.cjs.development.js.map +1 -1
- package/dist/ui-core.cjs.production.min.js +1 -1
- package/dist/ui-core.cjs.production.min.js.map +1 -1
- package/dist/ui-core.esm.js +76 -261
- package/dist/ui-core.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/input/StackedInput/StackedInput.tsx +14 -3
- package/src/components/input/StackedPilledInput/index.tsx +27 -26
- package/src/components/input/components/label/index.tsx +14 -3
- package/src/components/input/index.tsx +17 -1
- package/src/theme/customXQChakraTheme.ts +0 -2
- package/dist/theme/components/modal.d.ts +0 -242
- package/src/theme/components/modal.ts +0 -216
package/package.json
CHANGED
|
@@ -1,17 +1,28 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Input } from '@chakra-ui/react';
|
|
2
|
+
import { Input, InputGroup } from '@chakra-ui/react';
|
|
3
3
|
import { InputFieldProps } from '../InputTypes';
|
|
4
4
|
|
|
5
5
|
export interface StackedInputProps extends InputFieldProps {
|
|
6
6
|
isRequired?: boolean;
|
|
7
|
+
leftElement?: React.ReactNode;
|
|
8
|
+
rightElement?: React.ReactNode;
|
|
7
9
|
}
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
12
|
* A functional React component utilized to render the `StackedInput` component.
|
|
11
13
|
*/
|
|
12
14
|
const StackedInput = React.forwardRef<HTMLInputElement, StackedInputProps>(
|
|
13
|
-
(
|
|
14
|
-
|
|
15
|
+
(
|
|
16
|
+
{ type = 'text', isRequired, rightElement, leftElement, ...props },
|
|
17
|
+
_ref
|
|
18
|
+
) => {
|
|
19
|
+
return (
|
|
20
|
+
<InputGroup>
|
|
21
|
+
{leftElement && leftElement}
|
|
22
|
+
<Input type={type} isRequired={isRequired} {...props} ref={_ref} />
|
|
23
|
+
{rightElement && rightElement}
|
|
24
|
+
</InputGroup>
|
|
25
|
+
);
|
|
15
26
|
}
|
|
16
27
|
);
|
|
17
28
|
|
|
@@ -261,35 +261,36 @@ const StackedPilledInput = React.forwardRef<
|
|
|
261
261
|
}}
|
|
262
262
|
ref={scrollRef}
|
|
263
263
|
>
|
|
264
|
-
{lastestFormValueToArray.length
|
|
265
|
-
lastestFormValueToArray.map((label, index) => (
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
264
|
+
{lastestFormValueToArray.length
|
|
265
|
+
? lastestFormValueToArray.map((label, index) => (
|
|
266
|
+
<Box
|
|
267
|
+
mr="4px"
|
|
268
|
+
border={
|
|
269
|
+
tokenIndex === index
|
|
270
|
+
? `1px solid ${colors.border.focus}`
|
|
271
|
+
: 'none'
|
|
272
|
+
}
|
|
273
|
+
borderRadius="full"
|
|
274
|
+
onClick={() => isFocussed && setTokenIndex(index)}
|
|
275
|
+
width="100%"
|
|
276
|
+
id={`${name}_token_${index}`}
|
|
277
|
+
>
|
|
278
|
+
<Token
|
|
279
|
+
label={label}
|
|
280
|
+
onDelete={(e: any) => {
|
|
281
|
+
e.stopPropagation();
|
|
282
|
+
e.preventDefault();
|
|
283
|
+
onRemoveTag(index);
|
|
284
|
+
}}
|
|
285
|
+
/>
|
|
286
|
+
</Box>
|
|
287
|
+
))
|
|
288
|
+
: null}
|
|
289
|
+
{!lastestFormValueToArray.length && !isFocussed ? (
|
|
289
290
|
<Text color={colors.label.secondary.light} fontSize="13px">
|
|
290
291
|
{placeholder}
|
|
291
292
|
</Text>
|
|
292
|
-
)}
|
|
293
|
+
) : null}
|
|
293
294
|
</Flex>
|
|
294
295
|
<Flex flex={1} minWidth={isFocussed ? '20%' : 0}>
|
|
295
296
|
<Input
|
|
@@ -1,24 +1,35 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Box, FormLabel } from '@chakra-ui/react';
|
|
2
|
+
import { Box, FormLabel, Tooltip } from '@chakra-ui/react';
|
|
3
3
|
import colors from '../../../../../src/theme/foundations/colors';
|
|
4
|
+
import { QuestionOutlineIcon } from '@chakra-ui/icons';
|
|
4
5
|
|
|
5
6
|
export interface LabelProps {
|
|
6
7
|
label: string;
|
|
8
|
+
tooltipText?: string;
|
|
7
9
|
isRequired?: boolean;
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
13
|
* A functional React component utilized to render the `Label` component
|
|
12
14
|
*/
|
|
13
|
-
export const Label: React.FC<LabelProps> = ({
|
|
15
|
+
export const Label: React.FC<LabelProps> = ({
|
|
16
|
+
tooltipText,
|
|
17
|
+
isRequired,
|
|
18
|
+
label,
|
|
19
|
+
}) => {
|
|
14
20
|
return (
|
|
15
|
-
<FormLabel>
|
|
21
|
+
<FormLabel display="flex" alignItems="center">
|
|
16
22
|
{label}
|
|
17
23
|
{isRequired && (
|
|
18
24
|
<Box ml={1} color={colors.label.error}>
|
|
19
25
|
*
|
|
20
26
|
</Box>
|
|
21
27
|
)}
|
|
28
|
+
{!!tooltipText && (
|
|
29
|
+
<Tooltip label={tooltipText} placement="top">
|
|
30
|
+
<QuestionOutlineIcon boxSize="13px" ml="8px" />
|
|
31
|
+
</Tooltip>
|
|
32
|
+
)}
|
|
22
33
|
</FormLabel>
|
|
23
34
|
);
|
|
24
35
|
};
|
|
@@ -40,9 +40,12 @@ export interface InputProps<T extends FieldValues> extends ValidationProps {
|
|
|
40
40
|
control: Control<T, any>;
|
|
41
41
|
onChange?: (value?: string) => void;
|
|
42
42
|
disabled?: boolean;
|
|
43
|
+
tooltipText?: string;
|
|
43
44
|
setValue: UseFormSetValue<T>;
|
|
44
45
|
setError: UseFormSetError<T>;
|
|
45
46
|
clearErrors: UseFormClearErrors<T>;
|
|
47
|
+
leftElement?: React.ReactNode;
|
|
48
|
+
rightElement?: React.ReactNode;
|
|
46
49
|
}
|
|
47
50
|
|
|
48
51
|
/**
|
|
@@ -58,6 +61,7 @@ export function Input<T extends FieldValues>({
|
|
|
58
61
|
name,
|
|
59
62
|
helperText,
|
|
60
63
|
options,
|
|
64
|
+
tooltipText,
|
|
61
65
|
isInvalid,
|
|
62
66
|
errorText,
|
|
63
67
|
isRequired,
|
|
@@ -65,6 +69,8 @@ export function Input<T extends FieldValues>({
|
|
|
65
69
|
defaultValue,
|
|
66
70
|
control,
|
|
67
71
|
disabled,
|
|
72
|
+
rightElement,
|
|
73
|
+
leftElement,
|
|
68
74
|
onChange,
|
|
69
75
|
setValue,
|
|
70
76
|
setError,
|
|
@@ -91,6 +97,8 @@ export function Input<T extends FieldValues>({
|
|
|
91
97
|
onChange={onChange}
|
|
92
98
|
onBlur={onBlur}
|
|
93
99
|
ref={ref}
|
|
100
|
+
rightElement={rightElement}
|
|
101
|
+
leftElement={leftElement}
|
|
94
102
|
disabled={disabled}
|
|
95
103
|
value={value}
|
|
96
104
|
/>
|
|
@@ -136,6 +144,7 @@ export function Input<T extends FieldValues>({
|
|
|
136
144
|
className={`input-${inputType} ${className ?? ''}`}
|
|
137
145
|
name={name}
|
|
138
146
|
id={name}
|
|
147
|
+
placeholder={placeholder}
|
|
139
148
|
maxLength={maxLength}
|
|
140
149
|
isInvalid={isInvalid}
|
|
141
150
|
onChange={onChange}
|
|
@@ -194,6 +203,7 @@ export function Input<T extends FieldValues>({
|
|
|
194
203
|
ref={ref}
|
|
195
204
|
disabled={disabled}
|
|
196
205
|
value={value}
|
|
206
|
+
placeholder={placeholder}
|
|
197
207
|
setValue={setValue as UseFormSetValue<FieldValues>}
|
|
198
208
|
setError={setError as UseFormSetError<FieldValues>}
|
|
199
209
|
clearErrors={clearErrors as UseFormClearErrors<FieldValues>}
|
|
@@ -234,7 +244,13 @@ export function Input<T extends FieldValues>({
|
|
|
234
244
|
position="relative"
|
|
235
245
|
py={label || helperText || isInvalid ? 6 : 0}
|
|
236
246
|
>
|
|
237
|
-
{label &&
|
|
247
|
+
{label && (
|
|
248
|
+
<Label
|
|
249
|
+
tooltipText={tooltipText}
|
|
250
|
+
label={label}
|
|
251
|
+
isRequired={isRequired}
|
|
252
|
+
/>
|
|
253
|
+
)}
|
|
238
254
|
{selectedInputField(
|
|
239
255
|
onChange ? onChange : fieldOnChange,
|
|
240
256
|
onBlur,
|
|
@@ -12,7 +12,6 @@ import FormError from './components/form-error';
|
|
|
12
12
|
import FormLabel from './components/form-label';
|
|
13
13
|
import Input from './components/input';
|
|
14
14
|
import Link from './components/link';
|
|
15
|
-
import Modal from './components/modal';
|
|
16
15
|
import Select from './components/select';
|
|
17
16
|
import Switch from './components/switch';
|
|
18
17
|
import Table from './components/table';
|
|
@@ -36,7 +35,6 @@ const customXQChakraTheme = extendTheme({
|
|
|
36
35
|
FormLabel,
|
|
37
36
|
Input,
|
|
38
37
|
Link,
|
|
39
|
-
Modal,
|
|
40
38
|
Select,
|
|
41
39
|
Switch,
|
|
42
40
|
Table,
|
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
parts: string[];
|
|
3
|
-
baseStyle: (props: Record<string, any>) => {
|
|
4
|
-
overlay: {
|
|
5
|
-
bg: string;
|
|
6
|
-
zIndex: string;
|
|
7
|
-
};
|
|
8
|
-
dialogContainer: {
|
|
9
|
-
display: string;
|
|
10
|
-
zIndex: string;
|
|
11
|
-
justifyContent: string;
|
|
12
|
-
alignItems: string;
|
|
13
|
-
overflow: string;
|
|
14
|
-
WebkitOverflowScrolling: string;
|
|
15
|
-
};
|
|
16
|
-
dialog: {
|
|
17
|
-
borderRadius: string;
|
|
18
|
-
bg: string;
|
|
19
|
-
color: string;
|
|
20
|
-
mt: string | {
|
|
21
|
-
base: number;
|
|
22
|
-
md: string;
|
|
23
|
-
};
|
|
24
|
-
mb: string | {
|
|
25
|
-
base: number;
|
|
26
|
-
md: string;
|
|
27
|
-
};
|
|
28
|
-
mx: number;
|
|
29
|
-
zIndex: string;
|
|
30
|
-
maxH: string | undefined;
|
|
31
|
-
boxShadow: string;
|
|
32
|
-
};
|
|
33
|
-
header: {
|
|
34
|
-
px: number;
|
|
35
|
-
py: number;
|
|
36
|
-
minHeight: number;
|
|
37
|
-
fontSize: string;
|
|
38
|
-
display: string;
|
|
39
|
-
alignItems: string;
|
|
40
|
-
fontWeight: string;
|
|
41
|
-
bg: string;
|
|
42
|
-
color: string;
|
|
43
|
-
userSelect: string;
|
|
44
|
-
};
|
|
45
|
-
closeButton: {
|
|
46
|
-
position: string;
|
|
47
|
-
top: number;
|
|
48
|
-
right: number;
|
|
49
|
-
};
|
|
50
|
-
body: {
|
|
51
|
-
px: (number | null)[];
|
|
52
|
-
py: number;
|
|
53
|
-
flex: number;
|
|
54
|
-
overflow: string | undefined;
|
|
55
|
-
};
|
|
56
|
-
footer: {
|
|
57
|
-
px: (number | null)[];
|
|
58
|
-
pt: number;
|
|
59
|
-
pb: number;
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
sizes: {
|
|
63
|
-
xs: {
|
|
64
|
-
content: {
|
|
65
|
-
maxW: string;
|
|
66
|
-
h: string;
|
|
67
|
-
};
|
|
68
|
-
body?: undefined;
|
|
69
|
-
footer?: undefined;
|
|
70
|
-
} | {
|
|
71
|
-
content: {
|
|
72
|
-
maxW: string;
|
|
73
|
-
h?: undefined;
|
|
74
|
-
};
|
|
75
|
-
body: any;
|
|
76
|
-
footer: any;
|
|
77
|
-
};
|
|
78
|
-
sm: {
|
|
79
|
-
content: {
|
|
80
|
-
maxW: string;
|
|
81
|
-
h: string;
|
|
82
|
-
};
|
|
83
|
-
body?: undefined;
|
|
84
|
-
footer?: undefined;
|
|
85
|
-
} | {
|
|
86
|
-
content: {
|
|
87
|
-
maxW: string;
|
|
88
|
-
h?: undefined;
|
|
89
|
-
};
|
|
90
|
-
body: any;
|
|
91
|
-
footer: any;
|
|
92
|
-
};
|
|
93
|
-
md: {
|
|
94
|
-
content: {
|
|
95
|
-
maxW: string;
|
|
96
|
-
h: string;
|
|
97
|
-
};
|
|
98
|
-
body?: undefined;
|
|
99
|
-
footer?: undefined;
|
|
100
|
-
} | {
|
|
101
|
-
content: {
|
|
102
|
-
maxW: string;
|
|
103
|
-
h?: undefined;
|
|
104
|
-
};
|
|
105
|
-
body: any;
|
|
106
|
-
footer: any;
|
|
107
|
-
};
|
|
108
|
-
lg: {
|
|
109
|
-
content: {
|
|
110
|
-
maxW: string;
|
|
111
|
-
h: string;
|
|
112
|
-
};
|
|
113
|
-
body?: undefined;
|
|
114
|
-
footer?: undefined;
|
|
115
|
-
} | {
|
|
116
|
-
content: {
|
|
117
|
-
maxW: string;
|
|
118
|
-
h?: undefined;
|
|
119
|
-
};
|
|
120
|
-
body: any;
|
|
121
|
-
footer: any;
|
|
122
|
-
};
|
|
123
|
-
xl: {
|
|
124
|
-
content: {
|
|
125
|
-
maxW: string;
|
|
126
|
-
h: string;
|
|
127
|
-
};
|
|
128
|
-
body?: undefined;
|
|
129
|
-
footer?: undefined;
|
|
130
|
-
} | {
|
|
131
|
-
content: {
|
|
132
|
-
maxW: string;
|
|
133
|
-
h?: undefined;
|
|
134
|
-
};
|
|
135
|
-
body: any;
|
|
136
|
-
footer: any;
|
|
137
|
-
};
|
|
138
|
-
'2xl': {
|
|
139
|
-
content: {
|
|
140
|
-
maxW: string;
|
|
141
|
-
h: string;
|
|
142
|
-
};
|
|
143
|
-
body?: undefined;
|
|
144
|
-
footer?: undefined;
|
|
145
|
-
} | {
|
|
146
|
-
content: {
|
|
147
|
-
maxW: string;
|
|
148
|
-
h?: undefined;
|
|
149
|
-
};
|
|
150
|
-
body: any;
|
|
151
|
-
footer: any;
|
|
152
|
-
};
|
|
153
|
-
'3xl': {
|
|
154
|
-
content: {
|
|
155
|
-
maxW: string;
|
|
156
|
-
h: string;
|
|
157
|
-
};
|
|
158
|
-
body?: undefined;
|
|
159
|
-
footer?: undefined;
|
|
160
|
-
} | {
|
|
161
|
-
content: {
|
|
162
|
-
maxW: string;
|
|
163
|
-
h?: undefined;
|
|
164
|
-
};
|
|
165
|
-
body: any;
|
|
166
|
-
footer: any;
|
|
167
|
-
};
|
|
168
|
-
'4xl': {
|
|
169
|
-
content: {
|
|
170
|
-
maxW: string;
|
|
171
|
-
h: string;
|
|
172
|
-
};
|
|
173
|
-
body?: undefined;
|
|
174
|
-
footer?: undefined;
|
|
175
|
-
} | {
|
|
176
|
-
content: {
|
|
177
|
-
maxW: string;
|
|
178
|
-
h?: undefined;
|
|
179
|
-
};
|
|
180
|
-
body: any;
|
|
181
|
-
footer: any;
|
|
182
|
-
};
|
|
183
|
-
'5xl': {
|
|
184
|
-
content: {
|
|
185
|
-
maxW: string;
|
|
186
|
-
h: string;
|
|
187
|
-
};
|
|
188
|
-
body?: undefined;
|
|
189
|
-
footer?: undefined;
|
|
190
|
-
} | {
|
|
191
|
-
content: {
|
|
192
|
-
maxW: string;
|
|
193
|
-
h?: undefined;
|
|
194
|
-
};
|
|
195
|
-
body: any;
|
|
196
|
-
footer: any;
|
|
197
|
-
};
|
|
198
|
-
'6xl': {
|
|
199
|
-
content: {
|
|
200
|
-
maxW: string;
|
|
201
|
-
h: string;
|
|
202
|
-
};
|
|
203
|
-
body?: undefined;
|
|
204
|
-
footer?: undefined;
|
|
205
|
-
} | {
|
|
206
|
-
content: {
|
|
207
|
-
maxW: string;
|
|
208
|
-
h?: undefined;
|
|
209
|
-
};
|
|
210
|
-
body: any;
|
|
211
|
-
footer: any;
|
|
212
|
-
};
|
|
213
|
-
full: {
|
|
214
|
-
content: {
|
|
215
|
-
maxW: string;
|
|
216
|
-
h: string;
|
|
217
|
-
};
|
|
218
|
-
body?: undefined;
|
|
219
|
-
footer?: undefined;
|
|
220
|
-
} | {
|
|
221
|
-
content: {
|
|
222
|
-
maxW: string;
|
|
223
|
-
h?: undefined;
|
|
224
|
-
};
|
|
225
|
-
body: any;
|
|
226
|
-
footer: any;
|
|
227
|
-
};
|
|
228
|
-
};
|
|
229
|
-
variants: {
|
|
230
|
-
warning: () => {
|
|
231
|
-
header: {
|
|
232
|
-
bg: string;
|
|
233
|
-
color: string;
|
|
234
|
-
};
|
|
235
|
-
};
|
|
236
|
-
};
|
|
237
|
-
defaultProps: {
|
|
238
|
-
size: string;
|
|
239
|
-
isCentered: boolean;
|
|
240
|
-
};
|
|
241
|
-
};
|
|
242
|
-
export default _default;
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
import { mode } from '@chakra-ui/theme-tools';
|
|
2
|
-
|
|
3
|
-
const parts = [
|
|
4
|
-
'overlay',
|
|
5
|
-
'dialogContainer',
|
|
6
|
-
'dialog',
|
|
7
|
-
'header',
|
|
8
|
-
'closeButton',
|
|
9
|
-
'body',
|
|
10
|
-
'footer',
|
|
11
|
-
];
|
|
12
|
-
|
|
13
|
-
const baseStyleOverlay = {
|
|
14
|
-
bg: 'blackAlpha.600',
|
|
15
|
-
zIndex: 'modal',
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19
|
-
type Dict = Record<string, any>;
|
|
20
|
-
|
|
21
|
-
function baseStyleDialogContainer(props: Dict) {
|
|
22
|
-
const { scrollBehavior } = props;
|
|
23
|
-
|
|
24
|
-
return {
|
|
25
|
-
display: 'flex',
|
|
26
|
-
zIndex: 'modal',
|
|
27
|
-
justifyContent: 'center',
|
|
28
|
-
alignItems: 'flex-start',
|
|
29
|
-
overflow: scrollBehavior === 'inside' ? 'hidden' : 'auto',
|
|
30
|
-
WebkitOverflowScrolling: 'touch',
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function baseStyleDialog(props: Dict) {
|
|
35
|
-
const { isCentered, scrollBehavior } = props;
|
|
36
|
-
|
|
37
|
-
return {
|
|
38
|
-
borderRadius: 'lg',
|
|
39
|
-
bg: mode('white', 'gray.700')(props),
|
|
40
|
-
color: 'inherit',
|
|
41
|
-
mt: isCentered ? { base: 8, md: 'auto' } : '3.75rem',
|
|
42
|
-
mb: isCentered ? { base: 20, md: 'auto' } : '3.75rem',
|
|
43
|
-
mx: 4,
|
|
44
|
-
zIndex: 'modal',
|
|
45
|
-
maxH: scrollBehavior === 'inside' ? 'calc(100vh - 7.5rem)' : undefined,
|
|
46
|
-
boxShadow: mode('xl', 'dark-lg')(props),
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const baseStyleHeader = {
|
|
51
|
-
px: 6,
|
|
52
|
-
py: 4,
|
|
53
|
-
minHeight: 20,
|
|
54
|
-
fontSize: 'xl',
|
|
55
|
-
display: 'flex',
|
|
56
|
-
alignItems: 'center',
|
|
57
|
-
fontWeight: 'bold',
|
|
58
|
-
bg: 'primary.900',
|
|
59
|
-
color: 'white',
|
|
60
|
-
userSelect: 'none',
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const baseStyleCloseButton = {
|
|
64
|
-
position: 'absolute',
|
|
65
|
-
top: 2,
|
|
66
|
-
right: 3,
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
function baseStyleBody(props: Dict) {
|
|
70
|
-
const { scrollBehavior } = props;
|
|
71
|
-
return {
|
|
72
|
-
px: [6, null, 20],
|
|
73
|
-
py: 10,
|
|
74
|
-
flex: 1,
|
|
75
|
-
overflow: scrollBehavior === 'inside' ? 'auto' : undefined,
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const baseStyleFooter = {
|
|
80
|
-
px: [6, null, 20],
|
|
81
|
-
pt: 5,
|
|
82
|
-
pb: 16,
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
const baseStyle = (props: Dict) => ({
|
|
86
|
-
overlay: baseStyleOverlay,
|
|
87
|
-
dialogContainer: baseStyleDialogContainer(props),
|
|
88
|
-
dialog: baseStyleDialog(props),
|
|
89
|
-
header: baseStyleHeader,
|
|
90
|
-
closeButton: baseStyleCloseButton,
|
|
91
|
-
body: baseStyleBody(props),
|
|
92
|
-
footer: baseStyleFooter,
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Since the `maxWidth` prop references theme.sizes internally,
|
|
97
|
-
* we can leverage that to size our modals.
|
|
98
|
-
*/
|
|
99
|
-
function getSize(value: string) {
|
|
100
|
-
const commonBodyFooterStyles: Dict = {
|
|
101
|
-
xs: {
|
|
102
|
-
px: 8,
|
|
103
|
-
pb: 8,
|
|
104
|
-
},
|
|
105
|
-
sm: {
|
|
106
|
-
px: 8,
|
|
107
|
-
pb: 8,
|
|
108
|
-
},
|
|
109
|
-
md: {
|
|
110
|
-
px: 8,
|
|
111
|
-
pb: 8,
|
|
112
|
-
},
|
|
113
|
-
lg: {
|
|
114
|
-
px: 10,
|
|
115
|
-
pb: 10,
|
|
116
|
-
},
|
|
117
|
-
xl: {
|
|
118
|
-
px: 12,
|
|
119
|
-
pb: 10,
|
|
120
|
-
},
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
const bodyStyles: Dict = {
|
|
124
|
-
xs: {
|
|
125
|
-
py: 6,
|
|
126
|
-
},
|
|
127
|
-
sm: {
|
|
128
|
-
py: 6,
|
|
129
|
-
},
|
|
130
|
-
md: {
|
|
131
|
-
py: 6,
|
|
132
|
-
},
|
|
133
|
-
lg: {
|
|
134
|
-
py: 8,
|
|
135
|
-
},
|
|
136
|
-
xl: {
|
|
137
|
-
py: 8,
|
|
138
|
-
},
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
const footerStyles: Dict = {
|
|
142
|
-
xs: {
|
|
143
|
-
pb: 8,
|
|
144
|
-
},
|
|
145
|
-
sm: {
|
|
146
|
-
pb: 8,
|
|
147
|
-
},
|
|
148
|
-
md: {
|
|
149
|
-
pb: 8,
|
|
150
|
-
},
|
|
151
|
-
lg: {
|
|
152
|
-
pb: 10,
|
|
153
|
-
},
|
|
154
|
-
xl: {
|
|
155
|
-
pb: 10,
|
|
156
|
-
},
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
if (value === 'full') {
|
|
160
|
-
return { content: { maxW: '100vw', h: '100vh' } };
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
return {
|
|
164
|
-
content: {
|
|
165
|
-
maxW: value,
|
|
166
|
-
},
|
|
167
|
-
body: {
|
|
168
|
-
...commonBodyFooterStyles[value],
|
|
169
|
-
...bodyStyles[value],
|
|
170
|
-
},
|
|
171
|
-
footer: {
|
|
172
|
-
...commonBodyFooterStyles[value],
|
|
173
|
-
...footerStyles[value],
|
|
174
|
-
},
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
const sizes = {
|
|
179
|
-
xs: getSize('xs'),
|
|
180
|
-
sm: getSize('sm'),
|
|
181
|
-
md: getSize('md'),
|
|
182
|
-
lg: getSize('lg'),
|
|
183
|
-
xl: getSize('xl'),
|
|
184
|
-
'2xl': getSize('2xl'),
|
|
185
|
-
'3xl': getSize('3xl'),
|
|
186
|
-
'4xl': getSize('4xl'),
|
|
187
|
-
'5xl': getSize('5xl'),
|
|
188
|
-
'6xl': getSize('6xl'),
|
|
189
|
-
full: getSize('full'),
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
const warningVariant = () => {
|
|
193
|
-
return {
|
|
194
|
-
header: {
|
|
195
|
-
bg: 'warning.300',
|
|
196
|
-
color: 'black',
|
|
197
|
-
},
|
|
198
|
-
};
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
const variants = {
|
|
202
|
-
warning: warningVariant,
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
const defaultProps = {
|
|
206
|
-
size: 'lg',
|
|
207
|
-
isCentered: true,
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
export default {
|
|
211
|
-
parts,
|
|
212
|
-
baseStyle,
|
|
213
|
-
sizes,
|
|
214
|
-
variants,
|
|
215
|
-
defaultProps,
|
|
216
|
-
};
|