uikit-react-public 0.47.0 → 0.47.1
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/Dialog/BaseDialog.d.ts +1 -0
- package/dist/index.js +1014 -1007
- package/lib/components/Dialog/BaseDialog.tsx +25 -15
- package/package.json +1 -1
|
@@ -20,6 +20,7 @@ export const LARGE_WIDTH = 740;
|
|
|
20
20
|
export interface BaseDialogProps extends HTMLAttributes<HTMLDialogElement> {
|
|
21
21
|
open?: boolean;
|
|
22
22
|
size?: 'small' | 'medium' | 'large';
|
|
23
|
+
fullScreenOnMobile?: boolean;
|
|
23
24
|
modal?: boolean;
|
|
24
25
|
closeOnClickOutside?: boolean;
|
|
25
26
|
closeOnClickOutsideStopPropagation?: boolean;
|
|
@@ -39,6 +40,7 @@ const BaseDialog = forwardRef<HTMLDialogElement, BaseDialogProps>(
|
|
|
39
40
|
{
|
|
40
41
|
open = false,
|
|
41
42
|
size = 'medium',
|
|
43
|
+
fullScreenOnMobile = true,
|
|
42
44
|
modal = true,
|
|
43
45
|
closeOnClickOutside = true,
|
|
44
46
|
closeOnClickOutsideStopPropagation = true,
|
|
@@ -185,32 +187,40 @@ const BaseDialog = forwardRef<HTMLDialogElement, BaseDialogProps>(
|
|
|
185
187
|
font-size: ${md.fontSize}px;
|
|
186
188
|
font-weight: ${md.fontWeight};
|
|
187
189
|
line-height: ${md.lineHeight}%;
|
|
188
|
-
width:
|
|
189
|
-
|
|
190
|
+
width: ${width}px;
|
|
191
|
+
max-width: calc(100vw - ${theme.margin.m16});
|
|
192
|
+
height: fit-content;
|
|
190
193
|
margin: auto;
|
|
191
194
|
|
|
192
195
|
&:modal {
|
|
193
|
-
max-width:
|
|
194
|
-
max-height:
|
|
196
|
+
max-width: min(${width}px, calc(100vw - ${theme.margin.m16}));
|
|
197
|
+
max-height: calc(100vh - 32px);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
&::backdrop {
|
|
201
|
+
background-color: ${theme.colour.surface.backdrop};
|
|
195
202
|
}
|
|
203
|
+
`;
|
|
196
204
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
205
|
+
const fullScreenOnMobileStyle = css`
|
|
206
|
+
@media (width < ${theme.breakpoints.tablet}px) {
|
|
207
|
+
width: 100vw;
|
|
208
|
+
max-width: none;
|
|
209
|
+
height: 100vh;
|
|
201
210
|
|
|
202
211
|
&:modal {
|
|
203
|
-
max-width:
|
|
204
|
-
max-height:
|
|
212
|
+
max-width: none;
|
|
213
|
+
max-height: none;
|
|
205
214
|
}
|
|
206
215
|
}
|
|
207
|
-
|
|
208
|
-
&::backdrop {
|
|
209
|
-
background-color: ${theme.colour.surface.backdrop};
|
|
210
|
-
}
|
|
211
216
|
`;
|
|
212
217
|
|
|
213
|
-
const style = cx(
|
|
218
|
+
const style = cx(
|
|
219
|
+
NAME,
|
|
220
|
+
baseStyle,
|
|
221
|
+
fullScreenOnMobile && fullScreenOnMobileStyle,
|
|
222
|
+
className
|
|
223
|
+
);
|
|
214
224
|
|
|
215
225
|
if (open) {
|
|
216
226
|
return (
|