@teamturing/react-kit 2.19.3 → 2.19.4
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/core/Dialog/DialogBody.d.ts +6 -0
- package/dist/core/Dialog/DialogFooter.d.ts +6 -0
- package/dist/core/Dialog/DialogHeader.d.ts +6 -0
- package/dist/core/Dialog/DialogHeaderSubtitle.d.ts +6 -0
- package/dist/core/Dialog/DialogHeaderTitle.d.ts +6 -0
- package/dist/core/Dialog/_UnstyledDialogBody.d.ts +6 -0
- package/dist/core/Dialog/_UnstyledDialogFooter.d.ts +6 -0
- package/dist/core/Dialog/_UnstyledDialogHeader.d.ts +6 -0
- package/dist/core/Dialog/index.d.ts +23 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +126 -18
- package/esm/core/Dialog/DialogBody.js +17 -0
- package/esm/core/Dialog/DialogFooter.js +27 -0
- package/esm/core/Dialog/DialogHeader.js +21 -0
- package/esm/core/Dialog/DialogHeaderSubtitle.js +14 -0
- package/esm/core/Dialog/DialogHeaderTitle.js +14 -0
- package/esm/core/Dialog/_UnstyledDialogBody.js +13 -0
- package/esm/core/Dialog/_UnstyledDialogFooter.js +12 -0
- package/esm/core/Dialog/_UnstyledDialogHeader.js +12 -0
- package/esm/core/Dialog/index.js +36 -18
- package/package.json +2 -2
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { UnstyledDialogBodyProps } from './_UnstyledDialogBody';
|
|
3
|
+
type Props = {} & UnstyledDialogBodyProps;
|
|
4
|
+
declare const DialogBody: ({ children, sx, ...props }: PropsWithChildren<Props>) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export default DialogBody;
|
|
6
|
+
export type { Props as DialogBodyProps };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { UnstyledDialogFooterProps } from './_UnstyledDialogFooter';
|
|
3
|
+
type Props = {} & UnstyledDialogFooterProps;
|
|
4
|
+
declare const DialogFooter: ({ children, sx, ...props }: PropsWithChildren<Props>) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export default DialogFooter;
|
|
6
|
+
export type { Props as DialogFooterProps };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { UnstyledDialogHeaderProps } from './_UnstyledDialogHeader';
|
|
3
|
+
type Props = {} & UnstyledDialogHeaderProps;
|
|
4
|
+
declare const DialogHeader: ({ children, sx, ...props }: PropsWithChildren<Props>) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export default DialogHeader;
|
|
6
|
+
export type { Props as DialogHeaderProps };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { TextProps } from '../Text';
|
|
3
|
+
type Props = {} & TextProps;
|
|
4
|
+
declare const DialogHeaderSubtitle: ({ typography, color, ...props }: PropsWithChildren<Props>) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export default DialogHeaderSubtitle;
|
|
6
|
+
export type { Props as DialogHeaderSubtitleProps };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { TextProps } from '../Text';
|
|
3
|
+
type Props = {} & TextProps;
|
|
4
|
+
declare const DialogHeaderTitle: ({ typography, color, ...props }: PropsWithChildren<Props>) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export default DialogHeaderTitle;
|
|
6
|
+
export type { Props as DialogHeaderTitleProps };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
import { SxProp } from '../../utils/styled-system';
|
|
3
|
+
type Props = {} & HTMLAttributes<HTMLDivElement> & SxProp;
|
|
4
|
+
declare const UnstyledDialogBody: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, Props>>;
|
|
5
|
+
export default UnstyledDialogBody;
|
|
6
|
+
export type { Props as UnstyledDialogBodyProps };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
import { SxProp } from '../../utils/styled-system';
|
|
3
|
+
type Props = {} & HTMLAttributes<HTMLDivElement> & SxProp;
|
|
4
|
+
declare const UnstyledDialogFooter: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, Props>>;
|
|
5
|
+
export default UnstyledDialogFooter;
|
|
6
|
+
export type { Props as UnstyledDialogFooterProps };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
import { SxProp } from '../../utils/styled-system';
|
|
3
|
+
type Props = {} & HTMLAttributes<HTMLDivElement> & SxProp;
|
|
4
|
+
declare const UnstyledDialogHeader: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, Props>>;
|
|
5
|
+
export default UnstyledDialogHeader;
|
|
6
|
+
export type { Props as UnstyledDialogHeaderProps };
|
|
@@ -1,16 +1,34 @@
|
|
|
1
|
-
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
2
|
import { SxProp } from '../../utils/styled-system';
|
|
3
|
+
import { DialogBodyProps } from './DialogBody';
|
|
4
|
+
import { DialogFooterProps } from './DialogFooter';
|
|
5
|
+
import { DialogHeaderProps } from './DialogHeader';
|
|
6
|
+
import { DialogHeaderSubtitleProps } from './DialogHeaderSubtitle';
|
|
7
|
+
import { DialogHeaderTitleProps } from './DialogHeaderTitle';
|
|
8
|
+
import { UnstyledDialogBodyProps } from './_UnstyledDialogBody';
|
|
9
|
+
import { UnstyledDialogFooterProps } from './_UnstyledDialogFooter';
|
|
10
|
+
import { UnstyledDialogHeaderProps } from './_UnstyledDialogHeader';
|
|
11
|
+
type DialogSizeType = 'l' | 'm' | 's';
|
|
3
12
|
type Props = {
|
|
4
13
|
isOpen?: boolean;
|
|
5
14
|
onDismiss?: () => void;
|
|
6
|
-
size?:
|
|
15
|
+
size?: DialogSizeType;
|
|
7
16
|
} & SxProp;
|
|
8
17
|
declare const _default: import("react").ForwardRefExoticComponent<{
|
|
9
18
|
isOpen?: boolean | undefined;
|
|
10
19
|
onDismiss?: (() => void) | undefined;
|
|
11
|
-
size?:
|
|
20
|
+
size?: DialogSizeType | undefined;
|
|
12
21
|
} & SxProp & {
|
|
13
22
|
children?: import("react").ReactNode;
|
|
14
|
-
} & import("react").RefAttributes<HTMLDivElement
|
|
23
|
+
} & import("react").RefAttributes<HTMLDivElement>> & {
|
|
24
|
+
UnstyledHeader: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, UnstyledDialogHeaderProps>>;
|
|
25
|
+
UnstyledBody: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, UnstyledDialogBodyProps>>;
|
|
26
|
+
UnstyledFooter: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, UnstyledDialogFooterProps>>;
|
|
27
|
+
Header: ({ children, sx, ...props }: PropsWithChildren<DialogHeaderProps>) => import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
HeaderTitle: ({ typography, color, ...props }: PropsWithChildren<DialogHeaderTitleProps>) => import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
HeaderSubtitle: ({ typography, color, ...props }: PropsWithChildren<DialogHeaderSubtitleProps>) => import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
Body: ({ children, sx, ...props }: PropsWithChildren<DialogBodyProps>) => import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
Footer: ({ children, sx, ...props }: PropsWithChildren<DialogFooterProps>) => import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
};
|
|
15
33
|
export default _default;
|
|
16
|
-
export type { Props as DialogProps };
|
|
34
|
+
export type { Props as DialogProps, UnstyledDialogHeaderProps, UnstyledDialogBodyProps, UnstyledDialogFooterProps, DialogHeaderProps, DialogHeaderTitleProps, DialogHeaderSubtitleProps, DialogBodyProps, DialogFooterProps, };
|
package/dist/index.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export type { DatagridProps, DatagridBodyProps, DatagridCellProps, DatagridHeade
|
|
|
24
24
|
export { default as DescriptionList } from './core/DescriptionList';
|
|
25
25
|
export type { DescriptionListProps } from './core/DescriptionList';
|
|
26
26
|
export { default as Dialog } from './core/Dialog';
|
|
27
|
-
export type { DialogProps } from './core/Dialog';
|
|
27
|
+
export type { DialogProps, UnstyledDialogHeaderProps, UnstyledDialogBodyProps, UnstyledDialogFooterProps, DialogHeaderProps, DialogHeaderTitleProps, DialogHeaderSubtitleProps, DialogBodyProps, DialogFooterProps, } from './core/Dialog';
|
|
28
28
|
export { default as DialogHandler } from './core/DialogHandler';
|
|
29
29
|
export { default as EmptyState } from './core/EmptyState';
|
|
30
30
|
export type { EmptyStateProps } from './core/EmptyState';
|
package/dist/index.js
CHANGED
|
@@ -18691,15 +18691,111 @@ const useFocusTrap = (settings, dependencies = []) => {
|
|
|
18691
18691
|
|
|
18692
18692
|
const MotionView = motion(View);
|
|
18693
18693
|
|
|
18694
|
+
const UnstyledDialogBody = styled__default.default.div`
|
|
18695
|
+
flex-grow: 1;
|
|
18696
|
+
flex-shrink: 1;
|
|
18697
|
+
flex-basis: auto;
|
|
18698
|
+
overflow-y: auto;
|
|
18699
|
+
|
|
18700
|
+
${sx}
|
|
18701
|
+
`;
|
|
18702
|
+
|
|
18703
|
+
const DialogBody = ({
|
|
18704
|
+
children,
|
|
18705
|
+
sx,
|
|
18706
|
+
...props
|
|
18707
|
+
}) => /*#__PURE__*/jsxRuntimeExports.jsx(UnstyledDialogBody, {
|
|
18708
|
+
...props,
|
|
18709
|
+
sx: {
|
|
18710
|
+
p: 5,
|
|
18711
|
+
...sx
|
|
18712
|
+
},
|
|
18713
|
+
children: children
|
|
18714
|
+
});
|
|
18715
|
+
|
|
18716
|
+
const UnstyledDialogFooter = styled__default.default.div`
|
|
18717
|
+
flex-grow: 0;
|
|
18718
|
+
flex-shrink: 0;
|
|
18719
|
+
flex-basis: auto;
|
|
18720
|
+
|
|
18721
|
+
${sx}
|
|
18722
|
+
`;
|
|
18723
|
+
|
|
18724
|
+
const DialogFooter = ({
|
|
18725
|
+
children,
|
|
18726
|
+
sx,
|
|
18727
|
+
...props
|
|
18728
|
+
}) => /*#__PURE__*/jsxRuntimeExports.jsx(UnstyledDialogFooter, {
|
|
18729
|
+
...props,
|
|
18730
|
+
sx: {
|
|
18731
|
+
display: 'flex',
|
|
18732
|
+
alignItems: 'center',
|
|
18733
|
+
justifyContent: 'flex-end',
|
|
18734
|
+
flexWrap: 'wrap-reverse',
|
|
18735
|
+
px: 5,
|
|
18736
|
+
py: 4,
|
|
18737
|
+
borderTopWidth: 1,
|
|
18738
|
+
borderTopStyle: 'solid',
|
|
18739
|
+
borderTopColor: 'border/neutral',
|
|
18740
|
+
rowGap: 1,
|
|
18741
|
+
columnGap: 2,
|
|
18742
|
+
...sx
|
|
18743
|
+
},
|
|
18744
|
+
children: children
|
|
18745
|
+
});
|
|
18746
|
+
|
|
18747
|
+
const UnstyledDialogHeader = styled__default.default.div`
|
|
18748
|
+
flex-grow: 0;
|
|
18749
|
+
flex-shrink: 0;
|
|
18750
|
+
flex-basis: auto;
|
|
18751
|
+
|
|
18752
|
+
${sx}
|
|
18753
|
+
`;
|
|
18754
|
+
|
|
18755
|
+
const DialogHeader = ({
|
|
18756
|
+
children,
|
|
18757
|
+
sx,
|
|
18758
|
+
...props
|
|
18759
|
+
}) => /*#__PURE__*/jsxRuntimeExports.jsx(UnstyledDialogHeader, {
|
|
18760
|
+
...props,
|
|
18761
|
+
sx: {
|
|
18762
|
+
px: 5,
|
|
18763
|
+
py: 4,
|
|
18764
|
+
borderBottomWidth: 1,
|
|
18765
|
+
borderBottomStyle: 'solid',
|
|
18766
|
+
borderBottomColor: 'border/neutral',
|
|
18767
|
+
...sx
|
|
18768
|
+
},
|
|
18769
|
+
children: children
|
|
18770
|
+
});
|
|
18771
|
+
|
|
18772
|
+
const DialogHeaderSubtitle = ({
|
|
18773
|
+
typography = 'xs',
|
|
18774
|
+
color = 'text/neutral/subtler',
|
|
18775
|
+
...props
|
|
18776
|
+
}) => /*#__PURE__*/jsxRuntimeExports.jsx(Text, {
|
|
18777
|
+
typography: typography,
|
|
18778
|
+
color: color,
|
|
18779
|
+
...props
|
|
18780
|
+
});
|
|
18781
|
+
|
|
18782
|
+
const DialogHeaderTitle = ({
|
|
18783
|
+
typography = 'm/bold',
|
|
18784
|
+
color = 'text/neutral',
|
|
18785
|
+
...props
|
|
18786
|
+
}) => /*#__PURE__*/jsxRuntimeExports.jsx(Text, {
|
|
18787
|
+
typography: typography,
|
|
18788
|
+
color: color,
|
|
18789
|
+
...props
|
|
18790
|
+
});
|
|
18791
|
+
|
|
18694
18792
|
const Dialog = ({
|
|
18695
18793
|
children,
|
|
18696
18794
|
isOpen,
|
|
18697
18795
|
onDismiss,
|
|
18698
|
-
size,
|
|
18796
|
+
size = 'm',
|
|
18699
18797
|
sx
|
|
18700
18798
|
}, ref) => {
|
|
18701
|
-
const dialogRoot = typeof document !== 'undefined' ? document.getElementById('dialog_root') : null;
|
|
18702
|
-
if (dialogRoot === null) return null;
|
|
18703
18799
|
const handleDismiss = React.useCallback(() => onDismiss?.(), [onDismiss]);
|
|
18704
18800
|
const overlayRef = React.useRef(null);
|
|
18705
18801
|
const dialogRef = React.useRef(null);
|
|
@@ -18731,13 +18827,6 @@ const Dialog = ({
|
|
|
18731
18827
|
};
|
|
18732
18828
|
}
|
|
18733
18829
|
}, [isOpen, handleOutsideClick]);
|
|
18734
|
-
React.useEffect(() => {
|
|
18735
|
-
if (isOpen) {
|
|
18736
|
-
if (closeButtonRef && closeButtonRef.current) {
|
|
18737
|
-
closeButtonRef.current.focus();
|
|
18738
|
-
}
|
|
18739
|
-
}
|
|
18740
|
-
}, [isOpen, closeButtonRef]);
|
|
18741
18830
|
return /*#__PURE__*/jsxRuntimeExports.jsx(AnimatePresence, {
|
|
18742
18831
|
children: isOpen ? /*#__PURE__*/jsxRuntimeExports.jsxs(MotionView, {
|
|
18743
18832
|
initial: {
|
|
@@ -18777,16 +18866,24 @@ const Dialog = ({
|
|
|
18777
18866
|
tabIndex: -1,
|
|
18778
18867
|
sx: {
|
|
18779
18868
|
...(size === 's' ? {
|
|
18780
|
-
maxHeight: 'calc(100vh -
|
|
18781
|
-
width: ['100%', 400, 400],
|
|
18782
|
-
marginX:
|
|
18869
|
+
maxHeight: 'calc(100vh - 64px)',
|
|
18870
|
+
width: ['calc(100% - 64px)', 400, 400],
|
|
18871
|
+
marginX: 'auto',
|
|
18783
18872
|
marginY: 'auto',
|
|
18784
18873
|
borderRadius: 'l'
|
|
18874
|
+
} : size === 'm' ? {
|
|
18875
|
+
maxHeight: ['100%', '100%', 'calc(100vh - 64px)'],
|
|
18876
|
+
height: ['100%', '100%', 'auto'],
|
|
18877
|
+
minHeight: ['-webkit-fill-available', '-webkit-fill-available', 'auto'],
|
|
18878
|
+
width: ['100%', '100%', 640],
|
|
18879
|
+
marginX: [0, 0, 'auto'],
|
|
18880
|
+
marginY: 'auto',
|
|
18881
|
+
borderRadius: ['none', 'none', 'l']
|
|
18785
18882
|
} : size === 'l' ? {
|
|
18786
|
-
maxHeight: '100vh',
|
|
18883
|
+
maxHeight: ['100%', '100%', 'calc(100vh - 64px)'],
|
|
18787
18884
|
height: ['100%', '100%', 'auto'],
|
|
18788
18885
|
minHeight: ['-webkit-fill-available', '-webkit-fill-available', 'auto'],
|
|
18789
|
-
width: ['100%', '100%',
|
|
18886
|
+
width: ['100%', '100%', 860],
|
|
18790
18887
|
marginX: [0, 0, 'auto'],
|
|
18791
18888
|
marginY: 'auto',
|
|
18792
18889
|
borderRadius: ['none', 'none', 'l']
|
|
@@ -18797,8 +18894,8 @@ const Dialog = ({
|
|
|
18797
18894
|
children: [/*#__PURE__*/jsxRuntimeExports.jsx(View, {
|
|
18798
18895
|
sx: {
|
|
18799
18896
|
position: 'absolute',
|
|
18800
|
-
top:
|
|
18801
|
-
right:
|
|
18897
|
+
top: 3,
|
|
18898
|
+
right: 3
|
|
18802
18899
|
},
|
|
18803
18900
|
children: /*#__PURE__*/jsxRuntimeExports.jsx(IconButton, {
|
|
18804
18901
|
ref: closeButtonRef,
|
|
@@ -18826,6 +18923,8 @@ const Blanket = styled__default.default.span`
|
|
|
18826
18923
|
}
|
|
18827
18924
|
`;
|
|
18828
18925
|
const BaseDialog = styled__default.default.div(() => ({
|
|
18926
|
+
display: 'flex',
|
|
18927
|
+
flexDirection: 'column',
|
|
18829
18928
|
position: 'relative',
|
|
18830
18929
|
boxShadow: elevation['shadow/overlay'],
|
|
18831
18930
|
backgroundColor: elevation['surface/overlay'],
|
|
@@ -18833,7 +18932,16 @@ const BaseDialog = styled__default.default.div(() => ({
|
|
|
18833
18932
|
overflow: 'hidden',
|
|
18834
18933
|
margin: 'auto'
|
|
18835
18934
|
}), sx);
|
|
18836
|
-
var index$6 = /*#__PURE__*/React.forwardRef(Dialog)
|
|
18935
|
+
var index$6 = Object.assign( /*#__PURE__*/React.forwardRef(Dialog), {
|
|
18936
|
+
UnstyledHeader: UnstyledDialogHeader,
|
|
18937
|
+
UnstyledBody: UnstyledDialogBody,
|
|
18938
|
+
UnstyledFooter: UnstyledDialogFooter,
|
|
18939
|
+
Header: DialogHeader,
|
|
18940
|
+
HeaderTitle: DialogHeaderTitle,
|
|
18941
|
+
HeaderSubtitle: DialogHeaderSubtitle,
|
|
18942
|
+
Body: DialogBody,
|
|
18943
|
+
Footer: DialogFooter
|
|
18944
|
+
});
|
|
18837
18945
|
|
|
18838
18946
|
const useDialogHandler = () => {
|
|
18839
18947
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import UnstyledDialogBody from './_UnstyledDialogBody.js';
|
|
2
|
+
import { j as jsxRuntimeExports } from '../../node_modules/react/jsx-runtime.js';
|
|
3
|
+
|
|
4
|
+
const DialogBody = ({
|
|
5
|
+
children,
|
|
6
|
+
sx,
|
|
7
|
+
...props
|
|
8
|
+
}) => /*#__PURE__*/jsxRuntimeExports.jsx(UnstyledDialogBody, {
|
|
9
|
+
...props,
|
|
10
|
+
sx: {
|
|
11
|
+
p: 5,
|
|
12
|
+
...sx
|
|
13
|
+
},
|
|
14
|
+
children: children
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export { DialogBody as default };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import UnstyledDialogFooter from './_UnstyledDialogFooter.js';
|
|
2
|
+
import { j as jsxRuntimeExports } from '../../node_modules/react/jsx-runtime.js';
|
|
3
|
+
|
|
4
|
+
const DialogFooter = ({
|
|
5
|
+
children,
|
|
6
|
+
sx,
|
|
7
|
+
...props
|
|
8
|
+
}) => /*#__PURE__*/jsxRuntimeExports.jsx(UnstyledDialogFooter, {
|
|
9
|
+
...props,
|
|
10
|
+
sx: {
|
|
11
|
+
display: 'flex',
|
|
12
|
+
alignItems: 'center',
|
|
13
|
+
justifyContent: 'flex-end',
|
|
14
|
+
flexWrap: 'wrap-reverse',
|
|
15
|
+
px: 5,
|
|
16
|
+
py: 4,
|
|
17
|
+
borderTopWidth: 1,
|
|
18
|
+
borderTopStyle: 'solid',
|
|
19
|
+
borderTopColor: 'border/neutral',
|
|
20
|
+
rowGap: 1,
|
|
21
|
+
columnGap: 2,
|
|
22
|
+
...sx
|
|
23
|
+
},
|
|
24
|
+
children: children
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export { DialogFooter as default };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import UnstyledDialogHeader from './_UnstyledDialogHeader.js';
|
|
2
|
+
import { j as jsxRuntimeExports } from '../../node_modules/react/jsx-runtime.js';
|
|
3
|
+
|
|
4
|
+
const DialogHeader = ({
|
|
5
|
+
children,
|
|
6
|
+
sx,
|
|
7
|
+
...props
|
|
8
|
+
}) => /*#__PURE__*/jsxRuntimeExports.jsx(UnstyledDialogHeader, {
|
|
9
|
+
...props,
|
|
10
|
+
sx: {
|
|
11
|
+
px: 5,
|
|
12
|
+
py: 4,
|
|
13
|
+
borderBottomWidth: 1,
|
|
14
|
+
borderBottomStyle: 'solid',
|
|
15
|
+
borderBottomColor: 'border/neutral',
|
|
16
|
+
...sx
|
|
17
|
+
},
|
|
18
|
+
children: children
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export { DialogHeader as default };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Text from '../Text/index.js';
|
|
2
|
+
import { j as jsxRuntimeExports } from '../../node_modules/react/jsx-runtime.js';
|
|
3
|
+
|
|
4
|
+
const DialogHeaderSubtitle = ({
|
|
5
|
+
typography = 'xs',
|
|
6
|
+
color = 'text/neutral/subtler',
|
|
7
|
+
...props
|
|
8
|
+
}) => /*#__PURE__*/jsxRuntimeExports.jsx(Text, {
|
|
9
|
+
typography: typography,
|
|
10
|
+
color: color,
|
|
11
|
+
...props
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export { DialogHeaderSubtitle as default };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Text from '../Text/index.js';
|
|
2
|
+
import { j as jsxRuntimeExports } from '../../node_modules/react/jsx-runtime.js';
|
|
3
|
+
|
|
4
|
+
const DialogHeaderTitle = ({
|
|
5
|
+
typography = 'm/bold',
|
|
6
|
+
color = 'text/neutral',
|
|
7
|
+
...props
|
|
8
|
+
}) => /*#__PURE__*/jsxRuntimeExports.jsx(Text, {
|
|
9
|
+
typography: typography,
|
|
10
|
+
color: color,
|
|
11
|
+
...props
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export { DialogHeaderTitle as default };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { sx } from '../../utils/styled-system/index.js';
|
|
3
|
+
|
|
4
|
+
const UnstyledDialogBody = styled.div`
|
|
5
|
+
flex-grow: 1;
|
|
6
|
+
flex-shrink: 1;
|
|
7
|
+
flex-basis: auto;
|
|
8
|
+
overflow-y: auto;
|
|
9
|
+
|
|
10
|
+
${sx}
|
|
11
|
+
`;
|
|
12
|
+
|
|
13
|
+
export { UnstyledDialogBody as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { sx } from '../../utils/styled-system/index.js';
|
|
3
|
+
|
|
4
|
+
const UnstyledDialogFooter = styled.div`
|
|
5
|
+
flex-grow: 0;
|
|
6
|
+
flex-shrink: 0;
|
|
7
|
+
flex-basis: auto;
|
|
8
|
+
|
|
9
|
+
${sx}
|
|
10
|
+
`;
|
|
11
|
+
|
|
12
|
+
export { UnstyledDialogFooter as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { sx } from '../../utils/styled-system/index.js';
|
|
3
|
+
|
|
4
|
+
const UnstyledDialogHeader = styled.div`
|
|
5
|
+
flex-grow: 0;
|
|
6
|
+
flex-shrink: 0;
|
|
7
|
+
flex-basis: auto;
|
|
8
|
+
|
|
9
|
+
${sx}
|
|
10
|
+
`;
|
|
11
|
+
|
|
12
|
+
export { UnstyledDialogHeader as default };
|
package/esm/core/Dialog/index.js
CHANGED
|
@@ -9,6 +9,14 @@ import View from '../View/index.js';
|
|
|
9
9
|
import useFocusTrap from '../../hook/useFocusTrap.js';
|
|
10
10
|
import { sx } from '../../utils/styled-system/index.js';
|
|
11
11
|
import MotionView from '../MotionView/index.js';
|
|
12
|
+
import DialogBody from './DialogBody.js';
|
|
13
|
+
import DialogFooter from './DialogFooter.js';
|
|
14
|
+
import DialogHeader from './DialogHeader.js';
|
|
15
|
+
import DialogHeaderSubtitle from './DialogHeaderSubtitle.js';
|
|
16
|
+
import DialogHeaderTitle from './DialogHeaderTitle.js';
|
|
17
|
+
import UnstyledDialogBody from './_UnstyledDialogBody.js';
|
|
18
|
+
import UnstyledDialogFooter from './_UnstyledDialogFooter.js';
|
|
19
|
+
import UnstyledDialogHeader from './_UnstyledDialogHeader.js';
|
|
12
20
|
import { j as jsxRuntimeExports } from '../../node_modules/react/jsx-runtime.js';
|
|
13
21
|
import { AnimatePresence } from '../../node_modules/framer-motion/dist/es/components/AnimatePresence/index.js';
|
|
14
22
|
import { cubicBezier } from '../../node_modules/framer-motion/dist/es/easing/cubic-bezier.js';
|
|
@@ -17,11 +25,9 @@ const Dialog = ({
|
|
|
17
25
|
children,
|
|
18
26
|
isOpen,
|
|
19
27
|
onDismiss,
|
|
20
|
-
size,
|
|
28
|
+
size = 'm',
|
|
21
29
|
sx
|
|
22
30
|
}, ref) => {
|
|
23
|
-
const dialogRoot = typeof document !== 'undefined' ? document.getElementById('dialog_root') : null;
|
|
24
|
-
if (dialogRoot === null) return null;
|
|
25
31
|
const handleDismiss = useCallback(() => onDismiss?.(), [onDismiss]);
|
|
26
32
|
const overlayRef = useRef(null);
|
|
27
33
|
const dialogRef = useRef(null);
|
|
@@ -53,13 +59,6 @@ const Dialog = ({
|
|
|
53
59
|
};
|
|
54
60
|
}
|
|
55
61
|
}, [isOpen, handleOutsideClick]);
|
|
56
|
-
useEffect(() => {
|
|
57
|
-
if (isOpen) {
|
|
58
|
-
if (closeButtonRef && closeButtonRef.current) {
|
|
59
|
-
closeButtonRef.current.focus();
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}, [isOpen, closeButtonRef]);
|
|
63
62
|
return /*#__PURE__*/jsxRuntimeExports.jsx(AnimatePresence, {
|
|
64
63
|
children: isOpen ? /*#__PURE__*/jsxRuntimeExports.jsxs(MotionView, {
|
|
65
64
|
initial: {
|
|
@@ -99,16 +98,24 @@ const Dialog = ({
|
|
|
99
98
|
tabIndex: -1,
|
|
100
99
|
sx: {
|
|
101
100
|
...(size === 's' ? {
|
|
102
|
-
maxHeight: 'calc(100vh -
|
|
103
|
-
width: ['100%', 400, 400],
|
|
104
|
-
marginX:
|
|
101
|
+
maxHeight: 'calc(100vh - 64px)',
|
|
102
|
+
width: ['calc(100% - 64px)', 400, 400],
|
|
103
|
+
marginX: 'auto',
|
|
105
104
|
marginY: 'auto',
|
|
106
105
|
borderRadius: 'l'
|
|
106
|
+
} : size === 'm' ? {
|
|
107
|
+
maxHeight: ['100%', '100%', 'calc(100vh - 64px)'],
|
|
108
|
+
height: ['100%', '100%', 'auto'],
|
|
109
|
+
minHeight: ['-webkit-fill-available', '-webkit-fill-available', 'auto'],
|
|
110
|
+
width: ['100%', '100%', 640],
|
|
111
|
+
marginX: [0, 0, 'auto'],
|
|
112
|
+
marginY: 'auto',
|
|
113
|
+
borderRadius: ['none', 'none', 'l']
|
|
107
114
|
} : size === 'l' ? {
|
|
108
|
-
maxHeight: '100vh',
|
|
115
|
+
maxHeight: ['100%', '100%', 'calc(100vh - 64px)'],
|
|
109
116
|
height: ['100%', '100%', 'auto'],
|
|
110
117
|
minHeight: ['-webkit-fill-available', '-webkit-fill-available', 'auto'],
|
|
111
|
-
width: ['100%', '100%',
|
|
118
|
+
width: ['100%', '100%', 860],
|
|
112
119
|
marginX: [0, 0, 'auto'],
|
|
113
120
|
marginY: 'auto',
|
|
114
121
|
borderRadius: ['none', 'none', 'l']
|
|
@@ -119,8 +126,8 @@ const Dialog = ({
|
|
|
119
126
|
children: [/*#__PURE__*/jsxRuntimeExports.jsx(View, {
|
|
120
127
|
sx: {
|
|
121
128
|
position: 'absolute',
|
|
122
|
-
top:
|
|
123
|
-
right:
|
|
129
|
+
top: 3,
|
|
130
|
+
right: 3
|
|
124
131
|
},
|
|
125
132
|
children: /*#__PURE__*/jsxRuntimeExports.jsx(IconButton, {
|
|
126
133
|
ref: closeButtonRef,
|
|
@@ -148,6 +155,8 @@ const Blanket = styled.span`
|
|
|
148
155
|
}
|
|
149
156
|
`;
|
|
150
157
|
const BaseDialog = styled.div(() => ({
|
|
158
|
+
display: 'flex',
|
|
159
|
+
flexDirection: 'column',
|
|
151
160
|
position: 'relative',
|
|
152
161
|
boxShadow: elevation['shadow/overlay'],
|
|
153
162
|
backgroundColor: elevation['surface/overlay'],
|
|
@@ -155,6 +164,15 @@ const BaseDialog = styled.div(() => ({
|
|
|
155
164
|
overflow: 'hidden',
|
|
156
165
|
margin: 'auto'
|
|
157
166
|
}), sx);
|
|
158
|
-
var index = /*#__PURE__*/forwardRef(Dialog)
|
|
167
|
+
var index = Object.assign( /*#__PURE__*/forwardRef(Dialog), {
|
|
168
|
+
UnstyledHeader: UnstyledDialogHeader,
|
|
169
|
+
UnstyledBody: UnstyledDialogBody,
|
|
170
|
+
UnstyledFooter: UnstyledDialogFooter,
|
|
171
|
+
Header: DialogHeader,
|
|
172
|
+
HeaderTitle: DialogHeaderTitle,
|
|
173
|
+
HeaderSubtitle: DialogHeaderSubtitle,
|
|
174
|
+
Body: DialogBody,
|
|
175
|
+
Footer: DialogFooter
|
|
176
|
+
});
|
|
159
177
|
|
|
160
178
|
export { index as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamturing/react-kit",
|
|
3
|
-
"version": "2.19.
|
|
3
|
+
"version": "2.19.4",
|
|
4
4
|
"description": "React components, hooks for create teamturing web application",
|
|
5
5
|
"author": "Sungchang Park <psch300@gmail.com> (https://github.com/psch300)",
|
|
6
6
|
"homepage": "https://github.com/weareteamturing/bombe#readme",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"react-is": "^18.2.0",
|
|
63
63
|
"styled-system": "^5.1.5"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "a759ea92d1b8bfb8e7583150be5658763f3b2d9e"
|
|
66
66
|
}
|