@linagora/twake-mui 15.2.0 → 16.0.0
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/CHANGELOG.md +25 -0
- package/dist/components/Dialog/Dialog.stories.d.ts +1 -1
- package/dist/components/Dialog/Dialog.stories.js +1 -1
- package/dist/components/Dialog/index.d.ts +1 -1
- package/dist/components/Dialog/index.js +1 -1
- package/dist/components/Dialogs/ConfirmDialog.d.ts +8 -0
- package/dist/components/Dialogs/ConfirmDialog.js +16 -0
- package/dist/components/Dialogs/DialogBackButton.d.ts +8 -0
- package/dist/components/Dialogs/DialogBackButton.js +14 -0
- package/dist/components/Dialogs/DialogCloseButton.d.ts +8 -0
- package/dist/components/Dialogs/DialogCloseButton.js +14 -0
- package/dist/components/Dialogs/DialogFluidContent.d.ts +12 -0
- package/dist/components/Dialogs/DialogFluidContent.js +11 -0
- package/dist/components/Dialogs/DialogNavButtons.d.ts +9 -0
- package/dist/components/Dialogs/DialogNavButtons.js +14 -0
- package/dist/components/Dialogs/Dialogs.stories.d.ts +33 -0
- package/dist/components/Dialogs/Dialogs.stories.js +177 -0
- package/dist/components/Dialogs/FixedActionsDialog.d.ts +8 -0
- package/dist/components/Dialogs/FixedActionsDialog.js +20 -0
- package/dist/components/Dialogs/FixedDialog.d.ts +8 -0
- package/dist/components/Dialogs/FixedDialog.js +20 -0
- package/dist/components/Dialogs/IllustrationDialog.d.ts +8 -0
- package/dist/components/Dialogs/IllustrationDialog.js +21 -0
- package/dist/components/Dialogs/InstallFlagshipAppDialog.d.ts +13 -0
- package/dist/components/Dialogs/InstallFlagshipAppDialog.js +26 -0
- package/dist/components/Dialogs/PermissionDialog.d.ts +11 -0
- package/dist/components/Dialogs/PermissionDialog.js +15 -0
- package/dist/components/Dialogs/PermissionDialogIcon.d.ts +3 -0
- package/dist/components/Dialogs/PermissionDialogIcon.js +8 -0
- package/dist/components/Dialogs/ShortcutDialog.d.ts +15 -0
- package/dist/components/Dialogs/ShortcutDialog.js +41 -0
- package/dist/components/Dialogs/SlideUpTransition.d.ts +5 -0
- package/dist/components/Dialogs/SlideUpTransition.js +6 -0
- package/dist/components/Dialogs/SpecificDialogs.stories.d.ts +7 -0
- package/dist/components/Dialogs/SpecificDialogs.stories.js +43 -0
- package/dist/components/Dialogs/StandardDialog.d.ts +11 -0
- package/dist/components/Dialogs/StandardDialog.js +21 -0
- package/dist/components/Dialogs/images/appStore.png +0 -0
- package/dist/components/Dialogs/images/installFlagshipAppQrCode.png +0 -0
- package/dist/components/Dialogs/images/playStore.png +0 -0
- package/dist/components/Dialogs/locales/de.json +25 -0
- package/dist/components/Dialogs/locales/en.json +25 -0
- package/dist/components/Dialogs/locales/es.json +25 -0
- package/dist/components/Dialogs/locales/fr.json +25 -0
- package/dist/components/Dialogs/locales/index.d.ts +177 -0
- package/dist/components/Dialogs/locales/index.js +8 -0
- package/dist/components/Dialogs/locales/it.json +25 -0
- package/dist/components/Dialogs/locales/ru.json +25 -0
- package/dist/components/Dialogs/locales/vi.json +25 -0
- package/dist/components/Dialogs/shortcutHelpers.d.ts +19 -0
- package/dist/components/Dialogs/shortcutHelpers.js +49 -0
- package/dist/components/Dialogs/types.d.ts +7 -0
- package/dist/components/Dialogs/types.js +1 -0
- package/dist/components/Dialogs/useDialogLayout.d.ts +40 -0
- package/dist/components/Dialogs/useDialogLayout.js +63 -0
- package/dist/index.d.ts +24 -1
- package/dist/index.js +12 -1
- package/dist/lib/overrides.js +71 -6
- package/package.json +2 -2
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Grow } from '@mui/material';
|
|
2
|
+
import { mergeSlotProps } from '@mui/material/utils';
|
|
3
|
+
import cx from 'classnames';
|
|
4
|
+
import { useId } from 'react';
|
|
5
|
+
import SlideUpTransition from './SlideUpTransition';
|
|
6
|
+
import { useBreakpoints } from '../../hooks/useBreakpoints';
|
|
7
|
+
/** Computes the props of a dialog and of its parts, for dialogs laid out with a title, a content and actions */
|
|
8
|
+
export const useDialogLayout = ({ size = 'medium', fullScreen: fullScreenProp, onClose, onBack, align, disableTitleAutoPadding, isFluidTitle, disableGutters, titleRef, background, componentsProps, classes, slots, slotProps, ...props }) => {
|
|
9
|
+
const { isMobile } = useBreakpoints();
|
|
10
|
+
const id = useId();
|
|
11
|
+
const fullScreen = fullScreenProp ?? (size !== 'small' && isMobile);
|
|
12
|
+
const titleId = `modal-title-${id}`;
|
|
13
|
+
const hasCloseButton = !fullScreen && Boolean(onClose);
|
|
14
|
+
const hasBackButton = Boolean(onBack) || (fullScreen && Boolean(onClose));
|
|
15
|
+
return {
|
|
16
|
+
id,
|
|
17
|
+
fullScreen,
|
|
18
|
+
dialogProps: {
|
|
19
|
+
'aria-labelledby': titleId,
|
|
20
|
+
...props,
|
|
21
|
+
size,
|
|
22
|
+
fullScreen,
|
|
23
|
+
onClose,
|
|
24
|
+
classes: {
|
|
25
|
+
...classes,
|
|
26
|
+
container: cx({ alignTop: align === 'top' }, classes?.container)
|
|
27
|
+
},
|
|
28
|
+
slots: {
|
|
29
|
+
transition: fullScreen ? SlideUpTransition : Grow,
|
|
30
|
+
...slots
|
|
31
|
+
},
|
|
32
|
+
slotProps: {
|
|
33
|
+
...slotProps,
|
|
34
|
+
paper: background
|
|
35
|
+
? mergeSlotProps(slotProps?.paper, { sx: { background } })
|
|
36
|
+
: slotProps?.paper
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
dialogTitleProps: {
|
|
40
|
+
...componentsProps?.dialogTitle,
|
|
41
|
+
id: titleId,
|
|
42
|
+
ref: titleRef,
|
|
43
|
+
className: cx({
|
|
44
|
+
'u-ellipsis': !isFluidTitle,
|
|
45
|
+
dialogTitleFluid: isFluidTitle,
|
|
46
|
+
dialogTitleWithClose: hasCloseButton && !disableTitleAutoPadding,
|
|
47
|
+
dialogTitleWithBack: hasBackButton && !disableTitleAutoPadding
|
|
48
|
+
}, componentsProps?.dialogTitle?.className)
|
|
49
|
+
},
|
|
50
|
+
dividerProps: {
|
|
51
|
+
...componentsProps?.divider,
|
|
52
|
+
className: cx('dialogDivider', componentsProps?.divider?.className)
|
|
53
|
+
},
|
|
54
|
+
dialogActionsProps: {
|
|
55
|
+
...componentsProps?.dialogActions,
|
|
56
|
+
className: cx('dialogActions', componentsProps?.dialogActions?.className)
|
|
57
|
+
},
|
|
58
|
+
dialogContentProps: {
|
|
59
|
+
...componentsProps?.dialogContent,
|
|
60
|
+
className: cx({ disableGutters }, componentsProps?.dialogContent?.className)
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -41,7 +41,18 @@ export { default as BottomSheetHeader } from './components/BottomSheet/BottomShe
|
|
|
41
41
|
export { default as BottomSheetTitle } from './components/BottomSheet/BottomSheetTitle';
|
|
42
42
|
export { default as Chip } from './components/Chip';
|
|
43
43
|
export { default as ColorList } from './components/ColorList';
|
|
44
|
-
export {
|
|
44
|
+
export { default as Dialog } from './components/Dialog';
|
|
45
|
+
export { default as StandardDialog } from './components/Dialogs/StandardDialog';
|
|
46
|
+
export { default as DialogCloseButton } from './components/Dialogs/DialogCloseButton';
|
|
47
|
+
export { default as DialogBackButton } from './components/Dialogs/DialogBackButton';
|
|
48
|
+
export { default as ConfirmDialog } from './components/Dialogs/ConfirmDialog';
|
|
49
|
+
export { default as FixedDialog } from './components/Dialogs/FixedDialog';
|
|
50
|
+
export { default as FixedActionsDialog } from './components/Dialogs/FixedActionsDialog';
|
|
51
|
+
export { default as IllustrationDialog } from './components/Dialogs/IllustrationDialog';
|
|
52
|
+
export { default as PermissionDialog } from './components/Dialogs/PermissionDialog';
|
|
53
|
+
export { default as InstallFlagshipAppDialog } from './components/Dialogs/InstallFlagshipAppDialog';
|
|
54
|
+
export { default as ShortcutDialog } from './components/Dialogs/ShortcutDialog';
|
|
55
|
+
export { useDialogLayout } from './components/Dialogs/useDialogLayout';
|
|
45
56
|
export { default as ContactPopover } from './components/ContactPopover';
|
|
46
57
|
export { default as DropdownButton } from './components/DropdownButton';
|
|
47
58
|
export { default as DropdownText } from './components/DropdownText';
|
|
@@ -127,6 +138,18 @@ export type { OverlayBox, OverlayRegion } from './components/SpaceOverlay/region
|
|
|
127
138
|
export type { OverlayFrameProps } from './components/SpaceOverlay/OverlayFrame';
|
|
128
139
|
export type { ColorListProps, ColorListSize } from './components/ColorList';
|
|
129
140
|
export type { DialogProps, DialogSize } from './components/Dialog';
|
|
141
|
+
export type { StandardDialogProps } from './components/Dialogs/StandardDialog';
|
|
142
|
+
export type { DialogSectionsProps } from './components/Dialogs/types';
|
|
143
|
+
export type { ShortcutDialogProps } from './components/Dialogs/ShortcutDialog';
|
|
144
|
+
export type { InstallFlagshipAppDialogProps } from './components/Dialogs/InstallFlagshipAppDialog';
|
|
145
|
+
export type { PermissionDialogProps } from './components/Dialogs/PermissionDialog';
|
|
146
|
+
export type { IllustrationDialogProps } from './components/Dialogs/IllustrationDialog';
|
|
147
|
+
export type { FixedActionsDialogProps } from './components/Dialogs/FixedActionsDialog';
|
|
148
|
+
export type { FixedDialogProps } from './components/Dialogs/FixedDialog';
|
|
149
|
+
export type { ConfirmDialogProps } from './components/Dialogs/ConfirmDialog';
|
|
150
|
+
export type { DialogCloseButtonProps } from './components/Dialogs/DialogCloseButton';
|
|
151
|
+
export type { DialogBackButtonProps } from './components/Dialogs/DialogBackButton';
|
|
152
|
+
export type { DialogCloseReason, DialogLayout, DialogLayoutComponentsProps, DialogLayoutProps } from './components/Dialogs/useDialogLayout';
|
|
130
153
|
export type { PointerAlertProps, PointerAlertDirection } from './components/PointerAlert';
|
|
131
154
|
export type { ProgressionBannerProps } from './components/ProgressionBanner';
|
|
132
155
|
export type { EmptyProps, EmptyIconSize, EmptyComponentsProps } from './components/Empty';
|
package/dist/index.js
CHANGED
|
@@ -44,7 +44,18 @@ export { default as BottomSheetHeader } from './components/BottomSheet/BottomShe
|
|
|
44
44
|
export { default as BottomSheetTitle } from './components/BottomSheet/BottomSheetTitle';
|
|
45
45
|
export { default as Chip } from './components/Chip';
|
|
46
46
|
export { default as ColorList } from './components/ColorList';
|
|
47
|
-
export {
|
|
47
|
+
export { default as Dialog } from './components/Dialog';
|
|
48
|
+
export { default as StandardDialog } from './components/Dialogs/StandardDialog';
|
|
49
|
+
export { default as DialogCloseButton } from './components/Dialogs/DialogCloseButton';
|
|
50
|
+
export { default as DialogBackButton } from './components/Dialogs/DialogBackButton';
|
|
51
|
+
export { default as ConfirmDialog } from './components/Dialogs/ConfirmDialog';
|
|
52
|
+
export { default as FixedDialog } from './components/Dialogs/FixedDialog';
|
|
53
|
+
export { default as FixedActionsDialog } from './components/Dialogs/FixedActionsDialog';
|
|
54
|
+
export { default as IllustrationDialog } from './components/Dialogs/IllustrationDialog';
|
|
55
|
+
export { default as PermissionDialog } from './components/Dialogs/PermissionDialog';
|
|
56
|
+
export { default as InstallFlagshipAppDialog } from './components/Dialogs/InstallFlagshipAppDialog';
|
|
57
|
+
export { default as ShortcutDialog } from './components/Dialogs/ShortcutDialog';
|
|
58
|
+
export { useDialogLayout } from './components/Dialogs/useDialogLayout';
|
|
48
59
|
export { default as ContactPopover } from './components/ContactPopover';
|
|
49
60
|
export { default as DropdownButton } from './components/DropdownButton';
|
|
50
61
|
export { default as DropdownText } from './components/DropdownText';
|
package/dist/lib/overrides.js
CHANGED
|
@@ -430,15 +430,20 @@ export const overrides = {
|
|
|
430
430
|
padding: '0 8px 8px',
|
|
431
431
|
height: 'auto',
|
|
432
432
|
maxHeight: 'calc(100% - 32px)',
|
|
433
|
-
borderRadius: 6
|
|
433
|
+
borderRadius: 6,
|
|
434
|
+
'& .dialogDivider': { marginLeft: -8, marginRight: -8 }
|
|
434
435
|
}
|
|
435
436
|
},
|
|
436
437
|
'&.medium': { maxWidth: 544 },
|
|
437
438
|
'&.large': { maxWidth: 800 },
|
|
438
439
|
'&.full': { maxWidth: '100%' }
|
|
439
440
|
}),
|
|
441
|
+
container: {
|
|
442
|
+
'&.alignTop': { alignItems: 'start' }
|
|
443
|
+
},
|
|
440
444
|
paperFullScreen: {
|
|
441
|
-
'&.small, &.medium, &.large': { maxWidth: '100%' }
|
|
445
|
+
'&.small, &.medium, &.large': { maxWidth: '100%' },
|
|
446
|
+
'& .dialogActions': { paddingBottom: 'env(safe-area-inset-bottom)' }
|
|
442
447
|
}
|
|
443
448
|
}
|
|
444
449
|
},
|
|
@@ -461,7 +466,8 @@ export const overrides = {
|
|
|
461
466
|
'&.dialogTitleWithClose': {
|
|
462
467
|
paddingRight: '4rem',
|
|
463
468
|
[theme.breakpoints.down('md')]: { paddingRight: '3rem' }
|
|
464
|
-
}
|
|
469
|
+
},
|
|
470
|
+
'&.dialogTitleFluid': { paddingTop: 0 }
|
|
465
471
|
})
|
|
466
472
|
}
|
|
467
473
|
},
|
|
@@ -471,7 +477,41 @@ export const overrides = {
|
|
|
471
477
|
padding: '24px 32px 0',
|
|
472
478
|
[theme.breakpoints.down('md')]: { padding: '24px 16px 0' },
|
|
473
479
|
// MUI drops the top padding after a title, cozy-ui keeps it
|
|
474
|
-
[`.${dialogTitleClasses.root} + &`]: { paddingTop: 24 }
|
|
480
|
+
[`.${dialogTitleClasses.root} + &`]: { paddingTop: 24 },
|
|
481
|
+
'&.disableGutters': {
|
|
482
|
+
padding: 0,
|
|
483
|
+
'& .dialogContentInner': { marginBottom: 0 },
|
|
484
|
+
'& .dialogTitleFluidContainer': { margin: 0 }
|
|
485
|
+
},
|
|
486
|
+
'& .dialogContentInner': {
|
|
487
|
+
marginBottom: 24,
|
|
488
|
+
'&.withFluidActions': {
|
|
489
|
+
[theme.breakpoints.down('md')]: {
|
|
490
|
+
marginBottom: 0,
|
|
491
|
+
display: 'flex',
|
|
492
|
+
flexDirection: 'column',
|
|
493
|
+
height: '100%',
|
|
494
|
+
'& .dialogContentWrapper': {
|
|
495
|
+
flexGrow: 1,
|
|
496
|
+
'&:not(.withActions)': {
|
|
497
|
+
paddingBottom: 'calc(env(safe-area-inset-bottom) + 16px)'
|
|
498
|
+
}
|
|
499
|
+
},
|
|
500
|
+
'& .dialogActions': {
|
|
501
|
+
paddingBottom: 'calc(env(safe-area-inset-bottom) + 16px)'
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
},
|
|
505
|
+
'& .dialogTitleFluidContainer': {
|
|
506
|
+
marginLeft: '-2rem',
|
|
507
|
+
marginRight: '-2rem',
|
|
508
|
+
[theme.breakpoints.down('md')]: {
|
|
509
|
+
marginLeft: '-1rem',
|
|
510
|
+
marginRight: '-1rem',
|
|
511
|
+
marginTop: '-0.75rem'
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
}
|
|
475
515
|
})
|
|
476
516
|
}
|
|
477
517
|
},
|
|
@@ -484,7 +524,16 @@ export const overrides = {
|
|
|
484
524
|
margin: '8px 16px',
|
|
485
525
|
'& button': { flexGrow: 1 }
|
|
486
526
|
},
|
|
487
|
-
'& > :not(style) ~ :not(style)': { marginLeft: 4 }
|
|
527
|
+
'& > :not(style) ~ :not(style)': { marginLeft: 4 },
|
|
528
|
+
'&.dialogActionsFluid': { margin: '24px 0 0' },
|
|
529
|
+
'&.columnLayout': {
|
|
530
|
+
flexDirection: 'column-reverse',
|
|
531
|
+
'& button': {
|
|
532
|
+
width: '100%',
|
|
533
|
+
margin: 0,
|
|
534
|
+
'&:not(:first-child)': { marginBottom: 8 }
|
|
535
|
+
}
|
|
536
|
+
}
|
|
488
537
|
})
|
|
489
538
|
}
|
|
490
539
|
},
|
|
@@ -495,7 +544,7 @@ export const overrides = {
|
|
|
495
544
|
variants: [
|
|
496
545
|
{
|
|
497
546
|
props: { variant: 'inset' },
|
|
498
|
-
style: { marginLeft: 64 }
|
|
547
|
+
style: { marginLeft: 64, '&.dialogDivider': { marginLeft: 80 } }
|
|
499
548
|
},
|
|
500
549
|
{
|
|
501
550
|
props: ({ ownerState }) => !!ownerState.children &&
|
|
@@ -651,6 +700,22 @@ export const overrides = {
|
|
|
651
700
|
defaultProps: { size: 'large' },
|
|
652
701
|
styleOverrides: {
|
|
653
702
|
root: ({ theme }) => ({
|
|
703
|
+
'&.dialogIconButton': {
|
|
704
|
+
position: 'absolute',
|
|
705
|
+
top: '1.15rem',
|
|
706
|
+
zIndex: 1,
|
|
707
|
+
backgroundColor: theme.vars.palette.background.paper,
|
|
708
|
+
'&:hover': { backgroundColor: theme.vars.palette.action.selected },
|
|
709
|
+
[theme.breakpoints.down('md')]: { top: '0.25rem' }
|
|
710
|
+
},
|
|
711
|
+
'&.dialogCloseButton': {
|
|
712
|
+
right: '1.15rem',
|
|
713
|
+
[theme.breakpoints.down('md')]: { right: '0.25rem' }
|
|
714
|
+
},
|
|
715
|
+
'&.dialogBackButton': {
|
|
716
|
+
left: '1.15rem',
|
|
717
|
+
[theme.breakpoints.down('md')]: { left: '0.25rem' }
|
|
718
|
+
},
|
|
654
719
|
variants: [
|
|
655
720
|
{
|
|
656
721
|
props: { color: 'default' },
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linagora/twake-mui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "16.0.0",
|
|
5
5
|
"description": "MUI v9 theme system for Twake applications",
|
|
6
6
|
"author": "Twake",
|
|
7
7
|
"license": "MIT",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
|
-
"build": "tsc",
|
|
40
|
+
"build": "tsc && node scripts/copyAssets.mjs",
|
|
41
41
|
"build:doc": "storybook build --output-dir storybook-static",
|
|
42
42
|
"start": "tsc --watch",
|
|
43
43
|
"test": "vitest run --project unit",
|