@teamturing/react-kit 2.19.2 → 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.
@@ -0,0 +1,8 @@
1
+ import { HTMLAttributes, PropsWithChildren, ReactNode } from 'react';
2
+ import { SxProp } from '../../utils/styled-system';
3
+ type Props = {
4
+ renderBadge: (badgeProps: Pick<HTMLAttributes<HTMLElement>, 'style'>) => ReactNode;
5
+ } & SxProp;
6
+ declare const BadgeAttacher: ({ children, renderBadge, ...props }: PropsWithChildren<Props>) => import("react/jsx-runtime").JSX.Element;
7
+ export default BadgeAttacher;
8
+ export type { Props as BadgeAttacherProps };
@@ -0,0 +1,17 @@
1
+ import { HTMLAttributes } from 'react';
2
+ import { ResponsiveValue } from 'styled-system';
3
+ import { SxProp } from '../../utils/styled-system';
4
+ type CounterBadgeVariantType = 'red';
5
+ type CounterBadgeSizeType = 'm';
6
+ type Props = {
7
+ variant?: ResponsiveValue<CounterBadgeVariantType>;
8
+ size?: ResponsiveValue<CounterBadgeSizeType>;
9
+ /**
10
+ * maxCounter보다 큰 숫자가 children에 명시되면, {maxCounter+} 형식으로 표기됩니다.
11
+ */
12
+ maxCounter?: number;
13
+ children?: string | number;
14
+ } & SxProp & Pick<HTMLAttributes<HTMLSpanElement>, 'style'>;
15
+ declare const CounterBadge: ({ variant, size, children: propChildren, maxCounter, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
16
+ export default CounterBadge;
17
+ export type { Props as CounterBadgeProps };
@@ -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
- /// <reference types="react" />
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?: 'l' | 's';
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?: "s" | "l" | undefined;
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
@@ -7,6 +7,8 @@ export { default as AnimatePresence } from './core/AnimatePresence';
7
7
  export type { AnimatePresenceProps } from './core/AnimatePresence';
8
8
  export { default as Avatar } from './core/Avatar';
9
9
  export type { AvatarProps } from './core/Avatar';
10
+ export { default as BadgeAttacher } from './core/BadgeAttacher';
11
+ export type { BadgeAttacherProps } from './core/BadgeAttacher';
10
12
  export { default as Breadcrumbs } from './core/Breadcrumbs';
11
13
  export type { BreadcrumbsProps } from './core/Breadcrumbs';
12
14
  export { default as Button } from './core/Button';
@@ -15,12 +17,14 @@ export { default as Checkbox } from './core/Checkbox';
15
17
  export type { CheckboxProps } from './core/Checkbox';
16
18
  export { default as Chip } from './core/Chip';
17
19
  export type { ChipProps } from './core/Chip';
20
+ export { default as CounterBadge } from './core/CounterBadge';
21
+ export type { CounterBadgeProps } from './core/CounterBadge';
18
22
  export { default as Datagrid } from './core/Datagrid';
19
23
  export type { DatagridProps, DatagridBodyProps, DatagridCellProps, DatagridHeaderProps, DatagridRowProps, } from './core/Datagrid';
20
24
  export { default as DescriptionList } from './core/DescriptionList';
21
25
  export type { DescriptionListProps } from './core/DescriptionList';
22
26
  export { default as Dialog } from './core/Dialog';
23
- export type { DialogProps } from './core/Dialog';
27
+ export type { DialogProps, UnstyledDialogHeaderProps, UnstyledDialogBodyProps, UnstyledDialogFooterProps, DialogHeaderProps, DialogHeaderTitleProps, DialogHeaderSubtitleProps, DialogBodyProps, DialogFooterProps, } from './core/Dialog';
24
28
  export { default as DialogHandler } from './core/DialogHandler';
25
29
  export { default as EmptyState } from './core/EmptyState';
26
30
  export type { EmptyStateProps } from './core/EmptyState';
package/dist/index.js CHANGED
@@ -16377,6 +16377,28 @@ const BaseAvatar = styled__default.default(Image)`
16377
16377
  `;
16378
16378
  var index$9 = /*#__PURE__*/React.forwardRef(Avatar);
16379
16379
 
16380
+ const BadgeAttacher = ({
16381
+ children,
16382
+ renderBadge,
16383
+ ...props
16384
+ }) => /*#__PURE__*/jsxRuntimeExports.jsxs(BadgeAttacherWrapper, {
16385
+ ...props,
16386
+ children: [children, renderBadge({
16387
+ style: {
16388
+ position: 'absolute',
16389
+ top: 0,
16390
+ right: 0,
16391
+ transform: 'translate(10%, -10%)'
16392
+ }
16393
+ })]
16394
+ });
16395
+ const BadgeAttacherWrapper = styled__default.default.div`
16396
+ position: relative;
16397
+ width: fit-content;
16398
+
16399
+ ${sx}
16400
+ `;
16401
+
16380
16402
  const Tooltip = ({
16381
16403
  children,
16382
16404
  direction = 'top-center',
@@ -17473,6 +17495,57 @@ const BaseChip = styled__default.default.span({
17473
17495
  }
17474
17496
  }), sx);
17475
17497
 
17498
+ const CounterBadge = ({
17499
+ variant = 'red',
17500
+ size = 'm',
17501
+ children: propChildren = '',
17502
+ maxCounter = 99,
17503
+ ...props
17504
+ }) => {
17505
+ const numberChildren = typeof propChildren === 'number' ? propChildren : parseInt(propChildren);
17506
+ const children = maxCounter < numberChildren ? `${maxCounter}+` : `${numberChildren}`;
17507
+ return /*#__PURE__*/jsxRuntimeExports.jsx(BaseCounterBadge, {
17508
+ variant: variant,
17509
+ size: size,
17510
+ ...props,
17511
+ "aria-label": `${numberChildren}`,
17512
+ children: children
17513
+ });
17514
+ };
17515
+ const BaseCounterBadge = styled__default.default.span`
17516
+ display: inline-flex;
17517
+ align-items: center;
17518
+ justify-content: center;
17519
+ border-radius: ${({
17520
+ theme
17521
+ }) => forcePixelValue(theme.radii.full)};
17522
+
17523
+ ${variant({
17524
+ prop: 'variant',
17525
+ variants: {
17526
+ red: {
17527
+ backgroundColor: 'bg/accent/red',
17528
+ color: 'text/inverse'
17529
+ }
17530
+ }
17531
+ })}
17532
+ ${variant({
17533
+ prop: 'size',
17534
+ variants: {
17535
+ m: {
17536
+ minWidth: forcePixelValue(20),
17537
+ fontSize: 'xxs',
17538
+ fontWeight: 'medium',
17539
+ lineHeight: 2,
17540
+ px: 1,
17541
+ py: 0.25
17542
+ }
17543
+ }
17544
+ })}
17545
+
17546
+ ${sx}
17547
+ `;
17548
+
17476
17549
  /**
17477
17550
  * `children`의 컴포넌트들을 시각적으로 재배치하기 위한 훅입니다.
17478
17551
  */
@@ -18618,15 +18691,111 @@ const useFocusTrap = (settings, dependencies = []) => {
18618
18691
 
18619
18692
  const MotionView = motion(View);
18620
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
+
18621
18792
  const Dialog = ({
18622
18793
  children,
18623
18794
  isOpen,
18624
18795
  onDismiss,
18625
- size,
18796
+ size = 'm',
18626
18797
  sx
18627
18798
  }, ref) => {
18628
- const dialogRoot = typeof document !== 'undefined' ? document.getElementById('dialog_root') : null;
18629
- if (dialogRoot === null) return null;
18630
18799
  const handleDismiss = React.useCallback(() => onDismiss?.(), [onDismiss]);
18631
18800
  const overlayRef = React.useRef(null);
18632
18801
  const dialogRef = React.useRef(null);
@@ -18658,13 +18827,6 @@ const Dialog = ({
18658
18827
  };
18659
18828
  }
18660
18829
  }, [isOpen, handleOutsideClick]);
18661
- React.useEffect(() => {
18662
- if (isOpen) {
18663
- if (closeButtonRef && closeButtonRef.current) {
18664
- closeButtonRef.current.focus();
18665
- }
18666
- }
18667
- }, [isOpen, closeButtonRef]);
18668
18830
  return /*#__PURE__*/jsxRuntimeExports.jsx(AnimatePresence, {
18669
18831
  children: isOpen ? /*#__PURE__*/jsxRuntimeExports.jsxs(MotionView, {
18670
18832
  initial: {
@@ -18704,16 +18866,24 @@ const Dialog = ({
18704
18866
  tabIndex: -1,
18705
18867
  sx: {
18706
18868
  ...(size === 's' ? {
18707
- maxHeight: 'calc(100vh - 32px)',
18708
- width: ['100%', 400, 400],
18709
- marginX: [8, 'auto', 'auto'],
18869
+ maxHeight: 'calc(100vh - 64px)',
18870
+ width: ['calc(100% - 64px)', 400, 400],
18871
+ marginX: 'auto',
18710
18872
  marginY: 'auto',
18711
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']
18712
18882
  } : size === 'l' ? {
18713
- maxHeight: '100vh',
18883
+ maxHeight: ['100%', '100%', 'calc(100vh - 64px)'],
18714
18884
  height: ['100%', '100%', 'auto'],
18715
18885
  minHeight: ['-webkit-fill-available', '-webkit-fill-available', 'auto'],
18716
- width: ['100%', '100%', 820],
18886
+ width: ['100%', '100%', 860],
18717
18887
  marginX: [0, 0, 'auto'],
18718
18888
  marginY: 'auto',
18719
18889
  borderRadius: ['none', 'none', 'l']
@@ -18724,8 +18894,8 @@ const Dialog = ({
18724
18894
  children: [/*#__PURE__*/jsxRuntimeExports.jsx(View, {
18725
18895
  sx: {
18726
18896
  position: 'absolute',
18727
- top: 4,
18728
- right: 4
18897
+ top: 3,
18898
+ right: 3
18729
18899
  },
18730
18900
  children: /*#__PURE__*/jsxRuntimeExports.jsx(IconButton, {
18731
18901
  ref: closeButtonRef,
@@ -18753,6 +18923,8 @@ const Blanket = styled__default.default.span`
18753
18923
  }
18754
18924
  `;
18755
18925
  const BaseDialog = styled__default.default.div(() => ({
18926
+ display: 'flex',
18927
+ flexDirection: 'column',
18756
18928
  position: 'relative',
18757
18929
  boxShadow: elevation['shadow/overlay'],
18758
18930
  backgroundColor: elevation['surface/overlay'],
@@ -18760,7 +18932,16 @@ const BaseDialog = styled__default.default.div(() => ({
18760
18932
  overflow: 'hidden',
18761
18933
  margin: 'auto'
18762
18934
  }), sx);
18763
- 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
+ });
18764
18945
 
18765
18946
  const useDialogHandler = () => {
18766
18947
  const [isOpen, setIsOpen] = React.useState(false);
@@ -23939,10 +24120,12 @@ const useOutsideClick = ({
23939
24120
  exports.ActionList = index$a;
23940
24121
  exports.AnimatePresence = AnimatePresence;
23941
24122
  exports.Avatar = index$9;
24123
+ exports.BadgeAttacher = BadgeAttacher;
23942
24124
  exports.Breadcrumbs = index$8;
23943
24125
  exports.Button = Button;
23944
24126
  exports.Checkbox = Checkbox$1;
23945
24127
  exports.Chip = Chip;
24128
+ exports.CounterBadge = CounterBadge;
23946
24129
  exports.Datagrid = index$7;
23947
24130
  exports.DescriptionList = DescriptionList;
23948
24131
  exports.Dialog = index$6;
@@ -0,0 +1,27 @@
1
+ import styled from 'styled-components';
2
+ import { sx } from '../../utils/styled-system/index.js';
3
+ import { j as jsxRuntimeExports } from '../../node_modules/react/jsx-runtime.js';
4
+
5
+ const BadgeAttacher = ({
6
+ children,
7
+ renderBadge,
8
+ ...props
9
+ }) => /*#__PURE__*/jsxRuntimeExports.jsxs(BadgeAttacherWrapper, {
10
+ ...props,
11
+ children: [children, renderBadge({
12
+ style: {
13
+ position: 'absolute',
14
+ top: 0,
15
+ right: 0,
16
+ transform: 'translate(10%, -10%)'
17
+ }
18
+ })]
19
+ });
20
+ const BadgeAttacherWrapper = styled.div`
21
+ position: relative;
22
+ width: fit-content;
23
+
24
+ ${sx}
25
+ `;
26
+
27
+ export { BadgeAttacher as default };
@@ -0,0 +1,59 @@
1
+ import styled from 'styled-components';
2
+ import '../../node_modules/styled-system/dist/index.esm.js';
3
+ import { forcePixelValue } from '../../utils/forcePixelValue.js';
4
+ import { sx } from '../../utils/styled-system/index.js';
5
+ import { j as jsxRuntimeExports } from '../../node_modules/react/jsx-runtime.js';
6
+ import { variant } from '../../node_modules/@styled-system/variant/dist/index.esm.js';
7
+
8
+ const CounterBadge = ({
9
+ variant = 'red',
10
+ size = 'm',
11
+ children: propChildren = '',
12
+ maxCounter = 99,
13
+ ...props
14
+ }) => {
15
+ const numberChildren = typeof propChildren === 'number' ? propChildren : parseInt(propChildren);
16
+ const children = maxCounter < numberChildren ? `${maxCounter}+` : `${numberChildren}`;
17
+ return /*#__PURE__*/jsxRuntimeExports.jsx(BaseCounterBadge, {
18
+ variant: variant,
19
+ size: size,
20
+ ...props,
21
+ "aria-label": `${numberChildren}`,
22
+ children: children
23
+ });
24
+ };
25
+ const BaseCounterBadge = styled.span`
26
+ display: inline-flex;
27
+ align-items: center;
28
+ justify-content: center;
29
+ border-radius: ${({
30
+ theme
31
+ }) => forcePixelValue(theme.radii.full)};
32
+
33
+ ${variant({
34
+ prop: 'variant',
35
+ variants: {
36
+ red: {
37
+ backgroundColor: 'bg/accent/red',
38
+ color: 'text/inverse'
39
+ }
40
+ }
41
+ })}
42
+ ${variant({
43
+ prop: 'size',
44
+ variants: {
45
+ m: {
46
+ minWidth: forcePixelValue(20),
47
+ fontSize: 'xxs',
48
+ fontWeight: 'medium',
49
+ lineHeight: 2,
50
+ px: 1,
51
+ py: 0.25
52
+ }
53
+ }
54
+ })}
55
+
56
+ ${sx}
57
+ `;
58
+
59
+ export { CounterBadge as default };
@@ -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 };
@@ -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 - 32px)',
103
- width: ['100%', 400, 400],
104
- marginX: [8, 'auto', 'auto'],
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%', 820],
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: 4,
123
- right: 4
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/esm/index.js CHANGED
@@ -1,9 +1,11 @@
1
1
  export { default as ActionList } from './core/ActionList/index.js';
2
2
  export { default as Avatar } from './core/Avatar/index.js';
3
+ export { default as BadgeAttacher } from './core/BadgeAttacher/index.js';
3
4
  export { default as Breadcrumbs } from './core/Breadcrumbs/index.js';
4
5
  export { default as Button } from './core/Button/index.js';
5
6
  export { default as Checkbox } from './core/Checkbox/index.js';
6
7
  export { default as Chip } from './core/Chip/index.js';
8
+ export { default as CounterBadge } from './core/CounterBadge/index.js';
7
9
  export { default as Datagrid } from './core/Datagrid/index.js';
8
10
  export { default as DescriptionList } from './core/DescriptionList/index.js';
9
11
  export { default as Dialog } from './core/Dialog/index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamturing/react-kit",
3
- "version": "2.19.2",
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": "ca3fa5007b20b0b828c49f8ba09c58007b805442"
65
+ "gitHead": "a759ea92d1b8bfb8e7583150be5658763f3b2d9e"
66
66
  }