@teamturing/react-kit 2.25.0 → 2.26.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.
@@ -0,0 +1,6 @@
1
+ import { PropsWithChildren } from 'react';
2
+ import { UnstyledDrawerBodyProps } from './_UnstyledDrawerBody';
3
+ type Props = {} & UnstyledDrawerBodyProps;
4
+ declare const DrawerBody: ({ children, sx, ...props }: PropsWithChildren<Props>) => import("react/jsx-runtime").JSX.Element;
5
+ export default DrawerBody;
6
+ export type { Props as DrawerBodyProps };
@@ -0,0 +1,6 @@
1
+ import { PropsWithChildren } from 'react';
2
+ import { UnstyledDrawerFooterProps } from './_UnstyledDrawerFooter';
3
+ type Props = {} & UnstyledDrawerFooterProps;
4
+ declare const DrawerFooter: ({ children, sx, ...props }: PropsWithChildren<Props>) => import("react/jsx-runtime").JSX.Element;
5
+ export default DrawerFooter;
6
+ export type { Props as DrawerFooterProps };
@@ -0,0 +1,6 @@
1
+ import { PropsWithChildren } from 'react';
2
+ import { UnstyledDrawerHeaderProps } from './_UnstyledDrawerHeader';
3
+ type Props = {} & UnstyledDrawerHeaderProps;
4
+ declare const DrawerHeader: ({ children, sx, ...props }: PropsWithChildren<Props>) => import("react/jsx-runtime").JSX.Element;
5
+ export default DrawerHeader;
6
+ export type { Props as DrawerHeaderProps };
@@ -0,0 +1,6 @@
1
+ import { PropsWithChildren } from 'react';
2
+ import { IconButtonProps } from '../IconButton';
3
+ type Props = {} & IconButtonProps;
4
+ declare const DrawerHeaderIconButton: ({ size, variant, ...props }: PropsWithChildren<Props>) => import("react/jsx-runtime").JSX.Element;
5
+ export default DrawerHeaderIconButton;
6
+ export type { Props as DrawerHeaderIconButtonProps };
@@ -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 UnstyledDrawerBody: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, Props>>;
5
+ export default UnstyledDrawerBody;
6
+ export type { Props as UnstyledDrawerBodyProps };
@@ -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 UnstyledDrawerFooter: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, Props>>;
5
+ export default UnstyledDrawerFooter;
6
+ export type { Props as UnstyledDrawerFooterProps };
@@ -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 UnstyledDrawerHeader: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, Props>>;
5
+ export default UnstyledDrawerHeader;
6
+ export type { Props as UnstyledDrawerHeaderProps };
@@ -0,0 +1,36 @@
1
+ import { PropsWithChildren, RefObject } from 'react';
2
+ import { SxProp } from '../../utils/styled-system';
3
+ import { DrawerBodyProps } from './DrawerBody';
4
+ import { DrawerFooterProps } from './DrawerFooter';
5
+ import { DrawerHeaderProps } from './DrawerHeader';
6
+ import { DrawerHeaderIconButtonProps } from './DrawerHeaderIconButton';
7
+ import { UnstyledDrawerBodyProps } from './_UnstyledDrawerBody';
8
+ import { UnstyledDrawerFooterProps } from './_UnstyledDrawerFooter';
9
+ import { UnstyledDrawerHeaderProps } from './_UnstyledDrawerHeader';
10
+ type DrawerSizeType = 'full' | 'l' | 'm' | 's';
11
+ type Props = {
12
+ isOpen?: boolean;
13
+ onDismiss?: () => void;
14
+ isOutsideClickDismissable?: boolean;
15
+ size?: DrawerSizeType;
16
+ initialFocusRef?: RefObject<HTMLElement>;
17
+ } & SxProp;
18
+ declare const _default: import("react").ForwardRefExoticComponent<{
19
+ isOpen?: boolean | undefined;
20
+ onDismiss?: (() => void) | undefined;
21
+ isOutsideClickDismissable?: boolean | undefined;
22
+ size?: DrawerSizeType | undefined;
23
+ initialFocusRef?: RefObject<HTMLElement> | undefined;
24
+ } & SxProp & {
25
+ children?: import("react").ReactNode;
26
+ } & import("react").RefAttributes<HTMLDivElement>> & {
27
+ UnstyledHeader: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, UnstyledDrawerHeaderProps>>;
28
+ UnstyledBody: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, UnstyledDrawerBodyProps>>;
29
+ UnstyledFooter: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, UnstyledDrawerFooterProps>>;
30
+ Header: ({ children, sx, ...props }: PropsWithChildren<DrawerHeaderProps>) => import("react/jsx-runtime").JSX.Element;
31
+ HeaderIconButton: ({ size, variant, ...props }: PropsWithChildren<DrawerHeaderIconButtonProps>) => import("react/jsx-runtime").JSX.Element;
32
+ Body: ({ children, sx, ...props }: PropsWithChildren<DrawerBodyProps>) => import("react/jsx-runtime").JSX.Element;
33
+ Footer: ({ children, sx, ...props }: PropsWithChildren<DrawerFooterProps>) => import("react/jsx-runtime").JSX.Element;
34
+ };
35
+ export default _default;
36
+ export type { Props as DrawerProps, UnstyledDrawerHeaderProps, UnstyledDrawerBodyProps, UnstyledDrawerFooterProps, DrawerHeaderProps, DrawerHeaderIconButtonProps, DrawerBodyProps, DrawerFooterProps, };
package/dist/index.d.ts CHANGED
@@ -25,6 +25,8 @@ 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
27
  export type { DialogProps, UnstyledDialogHeaderProps, UnstyledDialogBodyProps, UnstyledDialogFooterProps, DialogHeaderProps, DialogHeaderTitleProps, DialogHeaderSubtitleProps, DialogBodyProps, DialogFooterProps, } from './core/Dialog';
28
+ export { default as Drawer } from './core/Drawer';
29
+ export type { DrawerProps, UnstyledDrawerHeaderProps, UnstyledDrawerBodyProps, UnstyledDrawerFooterProps, DrawerHeaderProps, DrawerHeaderIconButtonProps, DrawerBodyProps, DrawerFooterProps, } from './core/Drawer';
28
30
  export { default as EmptyState } from './core/EmptyState';
29
31
  export type { EmptyStateProps } from './core/EmptyState';
30
32
  export { default as Flash } from './core/Flash';
package/dist/index.js CHANGED
@@ -1163,6 +1163,17 @@ const SvgAppleColor = props => /*#__PURE__*/React__namespace.createElement("svg"
1163
1163
  d: "M14.514 11.781c-.01-1.139.952-1.685.995-1.71-.54-.774-1.384-.882-1.683-.895-.718-.07-1.401.413-1.764.413s-.926-.401-1.52-.39a2.263 2.263 0 0 0-1.906 1.127c-.813 1.377-.209 3.418.584 4.535.386.547.847 1.161 1.452 1.14.585-.023.805-.37 1.51-.37.706 0 .904.37 1.521.36.628-.013 1.026-.56 1.409-1.107.443-.634.627-1.248.638-1.28-.014-.006-1.223-.46-1.236-1.823ZM13.354 8.436c.322-.38.54-.91.48-1.436-.463.017-1.024.303-1.356.681-.299.338-.56.878-.49 1.394.516.038 1.046-.257 1.366-.639Z"
1164
1164
  }));
1165
1165
 
1166
+ const SvgArrowDiagonal = props => /*#__PURE__*/React__namespace.createElement("svg", _extends({
1167
+ xmlns: "http://www.w3.org/2000/svg",
1168
+ width: "1em",
1169
+ height: "1em",
1170
+ fill: "none",
1171
+ viewBox: "0 0 24 24"
1172
+ }, props), /*#__PURE__*/React__namespace.createElement("path", {
1173
+ fill: "currentColor",
1174
+ d: "M9.297 10.841c.463.464 1.08.464 1.544 0a1.095 1.095 0 0 0 0-1.544L6.708 5.163h3.553c.618 0 1.081-.464 1.081-1.082 0-.309-.077-.54-.309-.772-.232-.232-.463-.309-.772-.309H4.08C3.463 3 3 3.463 3 4.081v6.18c0 .618.463 1.081 1.081 1.081.618 0 1.082-.463 1.082-1.081V6.708l4.134 4.133ZM13.159 14.704c-.464-.464-.464-1.082 0-1.545a1.095 1.095 0 0 1 1.544 0l4.134 4.133V13.74c0-.618.464-1.081 1.082-1.081.309 0 .54.077.772.309.232.232.309.463.309.772v6.18c0 .617-.463 1.081-1.081 1.081h-6.18a1.056 1.056 0 0 1-1.081-1.081c0-.618.463-1.082 1.081-1.082h3.553l-4.133-4.133Z"
1175
+ }));
1176
+
1166
1177
  const SvgArrowDown = props => /*#__PURE__*/React__namespace.createElement("svg", _extends({
1167
1178
  xmlns: "http://www.w3.org/2000/svg",
1168
1179
  width: "1em",
@@ -3926,6 +3937,19 @@ const SvgShieldCheck = props => /*#__PURE__*/React__namespace.createElement("svg
3926
3937
  d: "M21.1 4.3 12.4.7c-.2-.1-.5-.1-.8 0L2.9 4.3c-.4.1-.6.5-.6.9v8.3c0 3.8 4.8 7.5 9.3 9.8.3.1.6.1.9 0 4.5-2.3 9.3-6 9.3-9.8V5.2c-.1-.4-.3-.8-.7-.9Zm-3.7 5.5-5.8 5.8c-.2.2-.5.3-.7.3-.2 0-.5-.1-.7-.3L6.6 12c-.4-.4-.4-1.1 0-1.5.4-.4 1.1-.4 1.5 0l2.8 2.8 5.1-5c.4-.4 1.1-.4 1.5 0 .4.4.4 1.1-.1 1.5Z"
3927
3938
  }));
3928
3939
 
3940
+ const SvgSidebar = props => /*#__PURE__*/React__namespace.createElement("svg", _extends({
3941
+ xmlns: "http://www.w3.org/2000/svg",
3942
+ width: "1em",
3943
+ height: "1em",
3944
+ fill: "none",
3945
+ viewBox: "0 0 24 24"
3946
+ }, props), /*#__PURE__*/React__namespace.createElement("path", {
3947
+ fill: "currentColor",
3948
+ fillRule: "evenodd",
3949
+ d: "M3.5 3a3 3 0 0 0-3 3v12a3 3 0 0 0 3 3h17a3 3 0 0 0 3-3V6a3 3 0 0 0-3-3h-17Zm-1 3a1 1 0 0 1 1-1h3v14h-3a1 1 0 0 1-1-1V6Zm6 13h12a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-12v14Z",
3950
+ clipRule: "evenodd"
3951
+ }));
3952
+
3929
3953
  const SvgSiren = props => /*#__PURE__*/React__namespace.createElement("svg", _extends({
3930
3954
  xmlns: "http://www.w3.org/2000/svg",
3931
3955
  width: "1em",
@@ -4563,6 +4587,7 @@ var icons = /*#__PURE__*/Object.freeze({
4563
4587
  AiSadIcon: SvgAiSad,
4564
4588
  AlarmIcon: SvgAlarm,
4565
4589
  AppleColorIcon: SvgAppleColor,
4590
+ ArrowDiagonalIcon: SvgArrowDiagonal,
4566
4591
  ArrowDownIcon: SvgArrowDown,
4567
4592
  ArrowLeftCircleIcon: SvgArrowLeftCircle,
4568
4593
  ArrowLeftIcon: SvgArrowLeft,
@@ -4733,6 +4758,7 @@ var icons = /*#__PURE__*/Object.freeze({
4733
4758
  SettingIcon: SvgSetting,
4734
4759
  ShareIcon: SvgShare,
4735
4760
  ShieldCheckIcon: SvgShieldCheck,
4761
+ SidebarIcon: SvgSidebar,
4736
4762
  SirenIcon: SvgSiren,
4737
4763
  SkipbackIcon: SvgSkipback,
4738
4764
  SkipforwardIcon: SvgSkipforward,
@@ -7022,7 +7048,7 @@ const BaseActionList = styled__default.default.ul`
7022
7048
 
7023
7049
  ${sx}
7024
7050
  `;
7025
- var index$b = Object.assign(ActionList, {
7051
+ var index$c = Object.assign(ActionList, {
7026
7052
  Item: ActionListItem,
7027
7053
  SectionDivider: ActionListSectionDivider,
7028
7054
  SectionHeader: ActionListSectionHeader
@@ -16293,7 +16319,7 @@ const BaseAvatar = styled__default.default(Image)`
16293
16319
  })}
16294
16320
  ${sx}
16295
16321
  `;
16296
- var index$a = /*#__PURE__*/React.forwardRef(Avatar);
16322
+ var index$b = /*#__PURE__*/React.forwardRef(Avatar);
16297
16323
 
16298
16324
  const BadgeAttacher = ({
16299
16325
  children,
@@ -16705,7 +16731,7 @@ const BreadcrumbsItemWrapper = styled__default.default.span`
16705
16731
  }
16706
16732
  }
16707
16733
  `;
16708
- var index$9 = Object.assign(Breadcrumbs, {
16734
+ var index$a = Object.assign(Breadcrumbs, {
16709
16735
  Item: BreadcrumbsItem
16710
16736
  });
16711
16737
 
@@ -17275,7 +17301,8 @@ const BaseChip = styled__default.default.span(({
17275
17301
  theme
17276
17302
  }) => ({
17277
17303
  position: 'relative',
17278
- width: 'fit-content',
17304
+ width: 'max-content',
17305
+ whiteSpace: 'nowrap',
17279
17306
  borderRadius: theme.radii.full,
17280
17307
  outline: 'none',
17281
17308
  display: 'flex',
@@ -17661,7 +17688,7 @@ const DatagridWrapper = styled__default.default.div`
17661
17688
  const BaseDatagrid = styled__default.default.div`
17662
17689
  width: inherit;
17663
17690
  `;
17664
- var index$8 = Object.assign(Datagrid, {
17691
+ var index$9 = Object.assign(Datagrid, {
17665
17692
  Header: DatagridHeader,
17666
17693
  Subheader: DatagridSubheader,
17667
17694
  Body: DatagridBody,
@@ -17769,6 +17796,7 @@ const BaseIconButton = styled__default.default(UnstyledButton)(({
17769
17796
  $disabled,
17770
17797
  theme
17771
17798
  }) => ({
17799
+ 'width': 'fit-content',
17772
17800
  'position': 'relative',
17773
17801
  'borderRadius': theme.radii.full,
17774
17802
  'transition': 'background-color 100ms, color 100ms',
@@ -18772,7 +18800,7 @@ const Dialog = ({
18772
18800
  height: '100%',
18773
18801
  zIndex: 9999
18774
18802
  },
18775
- children: [/*#__PURE__*/jsxRuntimeExports.jsx(Blanket, {
18803
+ children: [/*#__PURE__*/jsxRuntimeExports.jsx(Blanket$1, {
18776
18804
  ref: overlayRef
18777
18805
  }), /*#__PURE__*/jsxRuntimeExports.jsxs(BaseDialog, {
18778
18806
  ref: dialogRef,
@@ -18829,7 +18857,7 @@ const Dialog = ({
18829
18857
  })]
18830
18858
  }) : null;
18831
18859
  };
18832
- const Blanket = styled__default.default.span`
18860
+ const Blanket$1 = styled__default.default.span`
18833
18861
  &:before {
18834
18862
  position: fixed;
18835
18863
  top: 0;
@@ -18856,7 +18884,7 @@ const BaseDialog = styled__default.default.div(({
18856
18884
  overflow: 'hidden',
18857
18885
  margin: 'auto'
18858
18886
  }), sx);
18859
- var index$7 = Object.assign( /*#__PURE__*/React.forwardRef(Dialog), {
18887
+ var index$8 = Object.assign( /*#__PURE__*/React.forwardRef(Dialog), {
18860
18888
  UnstyledHeader: UnstyledDialogHeader,
18861
18889
  UnstyledBody: UnstyledDialogBody,
18862
18890
  UnstyledFooter: UnstyledDialogFooter,
@@ -18867,6 +18895,269 @@ var index$7 = Object.assign( /*#__PURE__*/React.forwardRef(Dialog), {
18867
18895
  Footer: DialogFooter
18868
18896
  });
18869
18897
 
18898
+ const MotionView = motion(View);
18899
+
18900
+ const UnstyledDrawerBody = styled__default.default.div`
18901
+ flex-grow: 1;
18902
+ flex-shrink: 1;
18903
+ flex-basis: auto;
18904
+ overflow-y: auto;
18905
+
18906
+ ${sx}
18907
+ `;
18908
+
18909
+ const DrawerBody = ({
18910
+ children,
18911
+ sx,
18912
+ ...props
18913
+ }) => /*#__PURE__*/jsxRuntimeExports.jsx(UnstyledDrawerBody, {
18914
+ ...props,
18915
+ sx: {
18916
+ p: 5,
18917
+ ...sx
18918
+ },
18919
+ children: children
18920
+ });
18921
+
18922
+ const UnstyledDrawerFooter = styled__default.default.div`
18923
+ flex-grow: 0;
18924
+ flex-shrink: 0;
18925
+ flex-basis: auto;
18926
+
18927
+ ${sx}
18928
+ `;
18929
+
18930
+ const DrawerFooter = ({
18931
+ children,
18932
+ sx,
18933
+ ...props
18934
+ }) => /*#__PURE__*/jsxRuntimeExports.jsx(UnstyledDrawerFooter, {
18935
+ ...props,
18936
+ sx: {
18937
+ display: 'flex',
18938
+ alignItems: 'center',
18939
+ justifyContent: 'flex-end',
18940
+ flexWrap: 'wrap-reverse',
18941
+ px: 5,
18942
+ py: 4,
18943
+ borderTopWidth: 1,
18944
+ borderTopStyle: 'solid',
18945
+ borderTopColor: 'border/neutral',
18946
+ rowGap: 1,
18947
+ columnGap: 2,
18948
+ ...sx
18949
+ },
18950
+ children: children
18951
+ });
18952
+
18953
+ const UnstyledDrawerHeader = styled__default.default.div`
18954
+ flex-grow: 0;
18955
+ flex-shrink: 0;
18956
+ flex-basis: auto;
18957
+
18958
+ ${sx}
18959
+ `;
18960
+
18961
+ const DrawerHeader = ({
18962
+ children,
18963
+ sx,
18964
+ ...props
18965
+ }) => /*#__PURE__*/jsxRuntimeExports.jsx(UnstyledDrawerHeader, {
18966
+ ...props,
18967
+ sx: {
18968
+ pl: 5,
18969
+ pr: 16,
18970
+ py: 2,
18971
+ minHeight: 56,
18972
+ borderBottomWidth: 1,
18973
+ borderBottomStyle: 'solid',
18974
+ borderBottomColor: 'border/neutral',
18975
+ display: 'flex',
18976
+ flexDirection: 'column',
18977
+ columnGap: 1,
18978
+ flexWrap: 'nowrap',
18979
+ ...sx
18980
+ },
18981
+ children: children
18982
+ });
18983
+
18984
+ const DrawerHeaderIconButton = ({
18985
+ size = 'm',
18986
+ variant = 'plain-bold',
18987
+ ...props
18988
+ }) => /*#__PURE__*/jsxRuntimeExports.jsx(IconButton, {
18989
+ size: size,
18990
+ variant: variant,
18991
+ ...props
18992
+ });
18993
+
18994
+ const Drawer = ({
18995
+ children,
18996
+ isOpen,
18997
+ onDismiss,
18998
+ isOutsideClickDismissable = true,
18999
+ size = 'm',
19000
+ initialFocusRef,
19001
+ sx
19002
+ }, ref) => {
19003
+ const handleDismiss = React.useCallback(() => onDismiss?.(), [onDismiss]);
19004
+ const blanketRef = React.useRef(null);
19005
+ const drawerRef = React.useRef(null);
19006
+ const closeButtonRef = React.useRef(null);
19007
+ React.useImperativeHandle(ref, () => drawerRef.current);
19008
+ const handleOutsideClick = React.useCallback(e => {
19009
+ if (drawerRef.current && blanketRef.current && e.target instanceof Node && !drawerRef.current.contains(e.target) && blanketRef.current.contains(e.target)) {
19010
+ handleDismiss?.();
19011
+ }
19012
+ }, [handleDismiss, drawerRef, blanketRef]);
19013
+ const handleKeyDown = React.useCallback(event => {
19014
+ switch (event.key) {
19015
+ case 'Escape':
19016
+ handleDismiss?.();
19017
+ event.stopPropagation();
19018
+ break;
19019
+ }
19020
+ }, [handleDismiss]);
19021
+ useFocusTrap({
19022
+ containerRef: drawerRef,
19023
+ initialFocusRef: initialFocusRef || closeButtonRef,
19024
+ disabled: !isOpen
19025
+ });
19026
+ React.useEffect(() => {
19027
+ if (isOpen && isOutsideClickDismissable) {
19028
+ document.addEventListener('click', handleOutsideClick);
19029
+ return () => {
19030
+ document.removeEventListener('click', handleOutsideClick);
19031
+ };
19032
+ }
19033
+ }, [isOpen, isOutsideClickDismissable, handleOutsideClick]);
19034
+ return /*#__PURE__*/jsxRuntimeExports.jsx(AnimatePresence, {
19035
+ children: isOpen ? /*#__PURE__*/jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
19036
+ children: [/*#__PURE__*/jsxRuntimeExports.jsx(MotionView, {
19037
+ initial: {
19038
+ opacity: 0
19039
+ },
19040
+ animate: {
19041
+ opacity: 1
19042
+ },
19043
+ exit: {
19044
+ opacity: 0
19045
+ },
19046
+ transition: {
19047
+ duration: 0.25,
19048
+ ease: easeInOut
19049
+ },
19050
+ sx: {
19051
+ position: 'fixed',
19052
+ top: 0,
19053
+ right: 0,
19054
+ bottom: 0,
19055
+ left: 0,
19056
+ zIndex: 9999
19057
+ },
19058
+ children: /*#__PURE__*/jsxRuntimeExports.jsx(Blanket, {
19059
+ ref: blanketRef
19060
+ })
19061
+ }), /*#__PURE__*/jsxRuntimeExports.jsx(MotionView, {
19062
+ initial: {
19063
+ x: '100%'
19064
+ },
19065
+ animate: {
19066
+ x: 0
19067
+ },
19068
+ exit: {
19069
+ x: '100%'
19070
+ },
19071
+ transition: {
19072
+ duration: 0.25,
19073
+ ease: easeInOut
19074
+ },
19075
+ sx: {
19076
+ position: 'fixed',
19077
+ display: 'flex',
19078
+ top: 0,
19079
+ right: 0,
19080
+ bottom: 0,
19081
+ zIndex: 9999,
19082
+ width: ['100%', '100%', 'fit-content']
19083
+ },
19084
+ children: /*#__PURE__*/jsxRuntimeExports.jsxs(BaseDrawer, {
19085
+ ref: drawerRef,
19086
+ "aria-modal": 'true',
19087
+ role: 'dialog',
19088
+ tabIndex: -1,
19089
+ sx: {
19090
+ ...(size === 's' ? {
19091
+ width: ['calc(100% - 32px)', 400, 400]
19092
+ } : size === 'm' ? {
19093
+ width: ['100%', '100%', 640]
19094
+ } : size === 'l' ? {
19095
+ width: ['100%', '100%', 860]
19096
+ } : size === 'full' ? {
19097
+ width: ['100%', '100%', 'calc(100vw - 80px)']
19098
+ } : {}),
19099
+ ...sx
19100
+ },
19101
+ onKeyDown: handleKeyDown,
19102
+ children: [/*#__PURE__*/jsxRuntimeExports.jsx(View, {
19103
+ sx: {
19104
+ position: 'absolute',
19105
+ top: 2,
19106
+ right: 5
19107
+ },
19108
+ children: /*#__PURE__*/jsxRuntimeExports.jsx(IconButton, {
19109
+ ref: closeButtonRef,
19110
+ icon: SvgClose,
19111
+ variant: 'plain-bold',
19112
+ size: 'm',
19113
+ onClick: handleDismiss
19114
+ })
19115
+ }), children]
19116
+ })
19117
+ })]
19118
+ }) : null
19119
+ });
19120
+ };
19121
+ const Blanket = styled__default.default.span`
19122
+ &:before {
19123
+ position: fixed;
19124
+ z-index: 9999;
19125
+ top: 0;
19126
+ right: 0;
19127
+ bottom: 0;
19128
+ left: 0;
19129
+ display: block;
19130
+ cursor: default;
19131
+ content: '';
19132
+ background: ${({
19133
+ theme
19134
+ }) => theme.colors.dim};
19135
+ }
19136
+ `;
19137
+ const BaseDrawer = styled__default.default.div(({
19138
+ theme
19139
+ }) => ({
19140
+ display: 'flex',
19141
+ flexDirection: 'column',
19142
+ position: 'relative',
19143
+ boxShadow: theme.shadows['shadow/overlay'],
19144
+ backgroundColor: theme.colors['surface/overlay'],
19145
+ outline: 'none',
19146
+ overflow: 'hidden',
19147
+ margin: 'auto',
19148
+ height: '100%',
19149
+ marginRight: 0
19150
+ }), sx);
19151
+ var index$7 = Object.assign( /*#__PURE__*/React.forwardRef(Drawer), {
19152
+ UnstyledHeader: UnstyledDrawerHeader,
19153
+ UnstyledBody: UnstyledDrawerBody,
19154
+ UnstyledFooter: UnstyledDrawerFooter,
19155
+ Header: DrawerHeader,
19156
+ HeaderIconButton: DrawerHeaderIconButton,
19157
+ Body: DrawerBody,
19158
+ Footer: DrawerFooter
19159
+ });
19160
+
18870
19161
  const EmptyState = ({
18871
19162
  title,
18872
19163
  icon: Icon = SvgDocument,
@@ -36133,8 +36424,6 @@ const BaseIconToggleButton = styled__default.default(UnstyledButton)(({
36133
36424
  }
36134
36425
  }), sx);
36135
36426
 
36136
- const MotionView = motion(View);
36137
-
36138
36427
  const Pagination = ({
36139
36428
  pages: propPages,
36140
36429
  currentPageIndex,
@@ -38221,11 +38510,8 @@ const opacity$1 = {
38221
38510
  opacity50: 0.5
38222
38511
  };
38223
38512
 
38224
- const accentOpacity = {
38225
- accent: opacity$1.opacity50
38226
- };
38227
38513
  const opacity = {
38228
- ...accentOpacity
38514
+ disabled: opacity$1.opacity50
38229
38515
  };
38230
38516
 
38231
38517
  const rounding = {
@@ -39054,18 +39340,19 @@ const useTabState = ({
39054
39340
  return [selectedIndex, handleSelect];
39055
39341
  };
39056
39342
 
39057
- exports.ActionList = index$b;
39343
+ exports.ActionList = index$c;
39058
39344
  exports.AnimatePresence = AnimatePresence;
39059
- exports.Avatar = index$a;
39345
+ exports.Avatar = index$b;
39060
39346
  exports.BadgeAttacher = BadgeAttacher;
39061
- exports.Breadcrumbs = index$9;
39347
+ exports.Breadcrumbs = index$a;
39062
39348
  exports.Button = Button;
39063
39349
  exports.Checkbox = Checkbox$1;
39064
39350
  exports.Chip = Chip;
39065
39351
  exports.CounterBadge = CounterBadge;
39066
- exports.Datagrid = index$8;
39352
+ exports.Datagrid = index$9;
39067
39353
  exports.DescriptionList = DescriptionList;
39068
- exports.Dialog = index$7;
39354
+ exports.Dialog = index$8;
39355
+ exports.Drawer = index$7;
39069
39356
  exports.EmptyState = EmptyState;
39070
39357
  exports.EnigmaUI = index;
39071
39358
  exports.Flash = index$6;
@@ -295,7 +295,7 @@ declare const theme: {
295
295
  'shadow/overlay': string;
296
296
  };
297
297
  opacity: {
298
- readonly accent: number;
298
+ readonly disabled: number;
299
299
  };
300
300
  };
301
301
  export default theme;
@@ -23,7 +23,8 @@ const BaseChip = styled.span(({
23
23
  theme
24
24
  }) => ({
25
25
  position: 'relative',
26
- width: 'fit-content',
26
+ width: 'max-content',
27
+ whiteSpace: 'nowrap',
27
28
  borderRadius: theme.radii.full,
28
29
  outline: 'none',
29
30
  display: 'flex',
@@ -0,0 +1,17 @@
1
+ import UnstyledDrawerBody from './_UnstyledDrawerBody.js';
2
+ import { j as jsxRuntimeExports } from '../../node_modules/react/jsx-runtime.js';
3
+
4
+ const DrawerBody = ({
5
+ children,
6
+ sx,
7
+ ...props
8
+ }) => /*#__PURE__*/jsxRuntimeExports.jsx(UnstyledDrawerBody, {
9
+ ...props,
10
+ sx: {
11
+ p: 5,
12
+ ...sx
13
+ },
14
+ children: children
15
+ });
16
+
17
+ export { DrawerBody as default };
@@ -0,0 +1,27 @@
1
+ import UnstyledDrawerFooter from './_UnstyledDrawerFooter.js';
2
+ import { j as jsxRuntimeExports } from '../../node_modules/react/jsx-runtime.js';
3
+
4
+ const DrawerFooter = ({
5
+ children,
6
+ sx,
7
+ ...props
8
+ }) => /*#__PURE__*/jsxRuntimeExports.jsx(UnstyledDrawerFooter, {
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 { DrawerFooter as default };
@@ -0,0 +1,27 @@
1
+ import UnstyledDrawerHeader from './_UnstyledDrawerHeader.js';
2
+ import { j as jsxRuntimeExports } from '../../node_modules/react/jsx-runtime.js';
3
+
4
+ const DrawerHeader = ({
5
+ children,
6
+ sx,
7
+ ...props
8
+ }) => /*#__PURE__*/jsxRuntimeExports.jsx(UnstyledDrawerHeader, {
9
+ ...props,
10
+ sx: {
11
+ pl: 5,
12
+ pr: 16,
13
+ py: 2,
14
+ minHeight: 56,
15
+ borderBottomWidth: 1,
16
+ borderBottomStyle: 'solid',
17
+ borderBottomColor: 'border/neutral',
18
+ display: 'flex',
19
+ flexDirection: 'column',
20
+ columnGap: 1,
21
+ flexWrap: 'nowrap',
22
+ ...sx
23
+ },
24
+ children: children
25
+ });
26
+
27
+ export { DrawerHeader as default };
@@ -0,0 +1,14 @@
1
+ import IconButton from '../IconButton/index.js';
2
+ import { j as jsxRuntimeExports } from '../../node_modules/react/jsx-runtime.js';
3
+
4
+ const DrawerHeaderIconButton = ({
5
+ size = 'm',
6
+ variant = 'plain-bold',
7
+ ...props
8
+ }) => /*#__PURE__*/jsxRuntimeExports.jsx(IconButton, {
9
+ size: size,
10
+ variant: variant,
11
+ ...props
12
+ });
13
+
14
+ export { DrawerHeaderIconButton as default };
@@ -0,0 +1,13 @@
1
+ import styled from 'styled-components';
2
+ import { sx } from '../../utils/styled-system/index.js';
3
+
4
+ const UnstyledDrawerBody = 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 { UnstyledDrawerBody as default };
@@ -0,0 +1,12 @@
1
+ import styled from 'styled-components';
2
+ import { sx } from '../../utils/styled-system/index.js';
3
+
4
+ const UnstyledDrawerFooter = styled.div`
5
+ flex-grow: 0;
6
+ flex-shrink: 0;
7
+ flex-basis: auto;
8
+
9
+ ${sx}
10
+ `;
11
+
12
+ export { UnstyledDrawerFooter as default };
@@ -0,0 +1,12 @@
1
+ import styled from 'styled-components';
2
+ import { sx } from '../../utils/styled-system/index.js';
3
+
4
+ const UnstyledDrawerHeader = styled.div`
5
+ flex-grow: 0;
6
+ flex-shrink: 0;
7
+ flex-basis: auto;
8
+
9
+ ${sx}
10
+ `;
11
+
12
+ export { UnstyledDrawerHeader as default };
@@ -0,0 +1,187 @@
1
+ import { forwardRef, useCallback, useRef, useImperativeHandle, useEffect } from 'react';
2
+ import SvgClose from '../../packages/icons/esm/Close.js';
3
+ import styled from 'styled-components';
4
+ import useFocusTrap from '../../hook/useFocusTrap.js';
5
+ import { sx } from '../../utils/styled-system/index.js';
6
+ import IconButton from '../IconButton/index.js';
7
+ import MotionView from '../MotionView/index.js';
8
+ import View from '../View/index.js';
9
+ import DrawerBody from './DrawerBody.js';
10
+ import DrawerFooter from './DrawerFooter.js';
11
+ import DrawerHeader from './DrawerHeader.js';
12
+ import DrawerHeaderIconButton from './DrawerHeaderIconButton.js';
13
+ import UnstyledDrawerBody from './_UnstyledDrawerBody.js';
14
+ import UnstyledDrawerFooter from './_UnstyledDrawerFooter.js';
15
+ import UnstyledDrawerHeader from './_UnstyledDrawerHeader.js';
16
+ import { j as jsxRuntimeExports } from '../../node_modules/react/jsx-runtime.js';
17
+ import { AnimatePresence } from '../../node_modules/framer-motion/dist/es/components/AnimatePresence/index.js';
18
+ import { easeInOut } from '../../node_modules/framer-motion/dist/es/easing/ease.js';
19
+
20
+ const Drawer = ({
21
+ children,
22
+ isOpen,
23
+ onDismiss,
24
+ isOutsideClickDismissable = true,
25
+ size = 'm',
26
+ initialFocusRef,
27
+ sx
28
+ }, ref) => {
29
+ const handleDismiss = useCallback(() => onDismiss?.(), [onDismiss]);
30
+ const blanketRef = useRef(null);
31
+ const drawerRef = useRef(null);
32
+ const closeButtonRef = useRef(null);
33
+ useImperativeHandle(ref, () => drawerRef.current);
34
+ const handleOutsideClick = useCallback(e => {
35
+ if (drawerRef.current && blanketRef.current && e.target instanceof Node && !drawerRef.current.contains(e.target) && blanketRef.current.contains(e.target)) {
36
+ handleDismiss?.();
37
+ }
38
+ }, [handleDismiss, drawerRef, blanketRef]);
39
+ const handleKeyDown = useCallback(event => {
40
+ switch (event.key) {
41
+ case 'Escape':
42
+ handleDismiss?.();
43
+ event.stopPropagation();
44
+ break;
45
+ }
46
+ }, [handleDismiss]);
47
+ useFocusTrap({
48
+ containerRef: drawerRef,
49
+ initialFocusRef: initialFocusRef || closeButtonRef,
50
+ disabled: !isOpen
51
+ });
52
+ useEffect(() => {
53
+ if (isOpen && isOutsideClickDismissable) {
54
+ document.addEventListener('click', handleOutsideClick);
55
+ return () => {
56
+ document.removeEventListener('click', handleOutsideClick);
57
+ };
58
+ }
59
+ }, [isOpen, isOutsideClickDismissable, handleOutsideClick]);
60
+ return /*#__PURE__*/jsxRuntimeExports.jsx(AnimatePresence, {
61
+ children: isOpen ? /*#__PURE__*/jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
62
+ children: [/*#__PURE__*/jsxRuntimeExports.jsx(MotionView, {
63
+ initial: {
64
+ opacity: 0
65
+ },
66
+ animate: {
67
+ opacity: 1
68
+ },
69
+ exit: {
70
+ opacity: 0
71
+ },
72
+ transition: {
73
+ duration: 0.25,
74
+ ease: easeInOut
75
+ },
76
+ sx: {
77
+ position: 'fixed',
78
+ top: 0,
79
+ right: 0,
80
+ bottom: 0,
81
+ left: 0,
82
+ zIndex: 9999
83
+ },
84
+ children: /*#__PURE__*/jsxRuntimeExports.jsx(Blanket, {
85
+ ref: blanketRef
86
+ })
87
+ }), /*#__PURE__*/jsxRuntimeExports.jsx(MotionView, {
88
+ initial: {
89
+ x: '100%'
90
+ },
91
+ animate: {
92
+ x: 0
93
+ },
94
+ exit: {
95
+ x: '100%'
96
+ },
97
+ transition: {
98
+ duration: 0.25,
99
+ ease: easeInOut
100
+ },
101
+ sx: {
102
+ position: 'fixed',
103
+ display: 'flex',
104
+ top: 0,
105
+ right: 0,
106
+ bottom: 0,
107
+ zIndex: 9999,
108
+ width: ['100%', '100%', 'fit-content']
109
+ },
110
+ children: /*#__PURE__*/jsxRuntimeExports.jsxs(BaseDrawer, {
111
+ ref: drawerRef,
112
+ "aria-modal": 'true',
113
+ role: 'dialog',
114
+ tabIndex: -1,
115
+ sx: {
116
+ ...(size === 's' ? {
117
+ width: ['calc(100% - 32px)', 400, 400]
118
+ } : size === 'm' ? {
119
+ width: ['100%', '100%', 640]
120
+ } : size === 'l' ? {
121
+ width: ['100%', '100%', 860]
122
+ } : size === 'full' ? {
123
+ width: ['100%', '100%', 'calc(100vw - 80px)']
124
+ } : {}),
125
+ ...sx
126
+ },
127
+ onKeyDown: handleKeyDown,
128
+ children: [/*#__PURE__*/jsxRuntimeExports.jsx(View, {
129
+ sx: {
130
+ position: 'absolute',
131
+ top: 2,
132
+ right: 5
133
+ },
134
+ children: /*#__PURE__*/jsxRuntimeExports.jsx(IconButton, {
135
+ ref: closeButtonRef,
136
+ icon: SvgClose,
137
+ variant: 'plain-bold',
138
+ size: 'm',
139
+ onClick: handleDismiss
140
+ })
141
+ }), children]
142
+ })
143
+ })]
144
+ }) : null
145
+ });
146
+ };
147
+ const Blanket = styled.span`
148
+ &:before {
149
+ position: fixed;
150
+ z-index: 9999;
151
+ top: 0;
152
+ right: 0;
153
+ bottom: 0;
154
+ left: 0;
155
+ display: block;
156
+ cursor: default;
157
+ content: '';
158
+ background: ${({
159
+ theme
160
+ }) => theme.colors.dim};
161
+ }
162
+ `;
163
+ const BaseDrawer = styled.div(({
164
+ theme
165
+ }) => ({
166
+ display: 'flex',
167
+ flexDirection: 'column',
168
+ position: 'relative',
169
+ boxShadow: theme.shadows['shadow/overlay'],
170
+ backgroundColor: theme.colors['surface/overlay'],
171
+ outline: 'none',
172
+ overflow: 'hidden',
173
+ margin: 'auto',
174
+ height: '100%',
175
+ marginRight: 0
176
+ }), sx);
177
+ var index = Object.assign( /*#__PURE__*/forwardRef(Drawer), {
178
+ UnstyledHeader: UnstyledDrawerHeader,
179
+ UnstyledBody: UnstyledDrawerBody,
180
+ UnstyledFooter: UnstyledDrawerFooter,
181
+ Header: DrawerHeader,
182
+ HeaderIconButton: DrawerHeaderIconButton,
183
+ Body: DrawerBody,
184
+ Footer: DrawerFooter
185
+ });
186
+
187
+ export { index as default };
@@ -33,6 +33,7 @@ const BaseIconButton = styled(UnstyledButton)(({
33
33
  $disabled,
34
34
  theme
35
35
  }) => ({
36
+ 'width': 'fit-content',
36
37
  'position': 'relative',
37
38
  'borderRadius': theme.radii.full,
38
39
  'transition': 'background-color 100ms, color 100ms',
package/esm/index.js CHANGED
@@ -9,6 +9,7 @@ export { default as CounterBadge } from './core/CounterBadge/index.js';
9
9
  export { default as Datagrid } from './core/Datagrid/index.js';
10
10
  export { default as DescriptionList } from './core/DescriptionList/index.js';
11
11
  export { default as Dialog } from './core/Dialog/index.js';
12
+ export { default as Drawer } from './core/Drawer/index.js';
12
13
  export { default as EmptyState } from './core/EmptyState/index.js';
13
14
  export { default as Flash } from './core/Flash/index.js';
14
15
  export { default as FormControl } from './core/FormControl/index.js';
@@ -0,0 +1,15 @@
1
+ import { extends as _extends } from './_virtual/_rollupPluginBabelHelpers.js';
2
+ import * as React from 'react';
3
+
4
+ const SvgArrowDiagonal = props => /*#__PURE__*/React.createElement("svg", _extends({
5
+ xmlns: "http://www.w3.org/2000/svg",
6
+ width: "1em",
7
+ height: "1em",
8
+ fill: "none",
9
+ viewBox: "0 0 24 24"
10
+ }, props), /*#__PURE__*/React.createElement("path", {
11
+ fill: "currentColor",
12
+ d: "M9.297 10.841c.463.464 1.08.464 1.544 0a1.095 1.095 0 0 0 0-1.544L6.708 5.163h3.553c.618 0 1.081-.464 1.081-1.082 0-.309-.077-.54-.309-.772-.232-.232-.463-.309-.772-.309H4.08C3.463 3 3 3.463 3 4.081v6.18c0 .618.463 1.081 1.081 1.081.618 0 1.082-.463 1.082-1.081V6.708l4.134 4.133ZM13.159 14.704c-.464-.464-.464-1.082 0-1.545a1.095 1.095 0 0 1 1.544 0l4.134 4.133V13.74c0-.618.464-1.081 1.082-1.081.309 0 .54.077.772.309.232.232.309.463.309.772v6.18c0 .617-.463 1.081-1.081 1.081h-6.18a1.056 1.056 0 0 1-1.081-1.081c0-.618.463-1.082 1.081-1.082h3.553l-4.133-4.133Z"
13
+ }));
14
+
15
+ export { SvgArrowDiagonal as default };
@@ -0,0 +1,17 @@
1
+ import { extends as _extends } from './_virtual/_rollupPluginBabelHelpers.js';
2
+ import * as React from 'react';
3
+
4
+ const SvgSidebar = props => /*#__PURE__*/React.createElement("svg", _extends({
5
+ xmlns: "http://www.w3.org/2000/svg",
6
+ width: "1em",
7
+ height: "1em",
8
+ fill: "none",
9
+ viewBox: "0 0 24 24"
10
+ }, props), /*#__PURE__*/React.createElement("path", {
11
+ fill: "currentColor",
12
+ fillRule: "evenodd",
13
+ d: "M3.5 3a3 3 0 0 0-3 3v12a3 3 0 0 0 3 3h17a3 3 0 0 0 3-3V6a3 3 0 0 0-3-3h-17Zm-1 3a1 1 0 0 1 1-1h3v14h-3a1 1 0 0 1-1-1V6Zm6 13h12a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-12v14Z",
14
+ clipRule: "evenodd"
15
+ }));
16
+
17
+ export { SvgSidebar as default };
@@ -3,6 +3,7 @@ export { default as AiColorIcon } from './AiColor.js';
3
3
  export { default as AiSadIcon } from './AiSad.js';
4
4
  export { default as AlarmIcon } from './Alarm.js';
5
5
  export { default as AppleColorIcon } from './AppleColor.js';
6
+ export { default as ArrowDiagonalIcon } from './ArrowDiagonal.js';
6
7
  export { default as ArrowDownIcon } from './ArrowDown.js';
7
8
  export { default as ArrowLeftIcon } from './ArrowLeft.js';
8
9
  export { default as ArrowLeftCircleIcon } from './ArrowLeftCircle.js';
@@ -173,6 +174,7 @@ export { default as SetIcon } from './Set.js';
173
174
  export { default as SettingIcon } from './Setting.js';
174
175
  export { default as ShareIcon } from './Share.js';
175
176
  export { default as ShieldCheckIcon } from './ShieldCheck.js';
177
+ export { default as SidebarIcon } from './Sidebar.js';
176
178
  export { default as SirenIcon } from './Siren.js';
177
179
  export { default as SkipbackIcon } from './Skipback.js';
178
180
  export { default as SkipforwardIcon } from './Skipforward.js';
@@ -1,10 +1,7 @@
1
1
  import opacity$1 from '../../foundation/opacity/index.js';
2
2
 
3
- const accentOpacity = {
4
- accent: opacity$1.opacity50
5
- };
6
3
  const opacity = {
7
- ...accentOpacity
4
+ disabled: opacity$1.opacity50
8
5
  };
9
6
 
10
- export { accentOpacity, opacity as default };
7
+ export { opacity as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamturing/react-kit",
3
- "version": "2.25.0",
3
+ "version": "2.26.0",
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",
@@ -55,8 +55,8 @@
55
55
  "dependencies": {
56
56
  "@floating-ui/react-dom": "^2.0.2",
57
57
  "@primer/behaviors": "^1.3.6",
58
- "@teamturing/icons": "^1.38.2",
59
- "@teamturing/token-studio": "^1.5.0",
58
+ "@teamturing/icons": "^1.39.0",
59
+ "@teamturing/token-studio": "^1.6.0",
60
60
  "@teamturing/utils": "^1.3.0",
61
61
  "framer-motion": "^10.16.4",
62
62
  "lodash.debounce": "^4.0.8",
@@ -66,5 +66,5 @@
66
66
  "react-textarea-autosize": "^8.5.3",
67
67
  "styled-system": "^5.1.5"
68
68
  },
69
- "gitHead": "49372114babdc4079f06ad66cd3cd5c7321bc621"
69
+ "gitHead": "5ffda9f34ed0398c6de4786338f54af08adc875e"
70
70
  }