@superdispatch/ui-lab 0.50.3 → 0.50.5

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.
Files changed (124) hide show
  1. package/.babelrc.js +5 -0
  2. package/package.json +38 -13
  3. package/pkg/README.md +10 -0
  4. package/{dist-node → pkg/dist-node}/index.js +52 -40
  5. package/pkg/dist-node/index.js.map +1 -0
  6. package/{dist-src → pkg/dist-src}/email-autocomplate/EmailAutocomplete.js +3 -3
  7. package/{dist-src → pkg/dist-src}/file-drop-zone/FileDropZone.js +2 -2
  8. package/{dist-src → pkg/dist-src}/flag-list/FlagListItem.js +11 -19
  9. package/{dist-src → pkg/dist-src}/index.js +1 -0
  10. package/{dist-src → pkg/dist-src}/navbar/Navbar.js +13 -4
  11. package/{dist-src → pkg/dist-src}/navbar/NavbarAccordion.js +18 -9
  12. package/{dist-src → pkg/dist-src}/navbar/NavbarList.js +1 -1
  13. package/{dist-src → pkg/dist-src}/sidebar/SidebarBackButton.js +1 -1
  14. package/{dist-src → pkg/dist-src}/sidebar/SidebarMenuItem.js +1 -1
  15. package/{dist-src → pkg/dist-src}/sidebar/SidebarMenuItemAvatar.js +1 -1
  16. package/{dist-types → pkg/dist-types}/index.d.ts +8 -2
  17. package/{dist-web → pkg/dist-web}/index.js +52 -42
  18. package/pkg/dist-web/index.js.map +1 -0
  19. package/pkg/package.json +41 -0
  20. package/playroom.ts +24 -0
  21. package/src/alert/Alert.stories.tsx +162 -0
  22. package/src/alert/Alert.tsx +135 -0
  23. package/src/banner/Banner.stories.tsx +64 -0
  24. package/src/banner/Banner.tsx +120 -0
  25. package/src/box/Box.stories.tsx +20 -0
  26. package/src/box/Box.tsx +257 -0
  27. package/src/button/Button.stories.tsx +739 -0
  28. package/src/button/Button.tsx +498 -0
  29. package/src/button-area/ButtonArea.stories.tsx +65 -0
  30. package/src/button-area/ButtonArea.tsx +90 -0
  31. package/src/chat/Chat.stories.tsx +130 -0
  32. package/src/chat/Chat.tsx +57 -0
  33. package/src/chat/ChatMessage.tsx +45 -0
  34. package/src/chat/README.MD +7 -0
  35. package/src/chat/__tests__/Chat.spec.tsx +29 -0
  36. package/src/chat/__tests__/ChatMessage.spec.tsx +39 -0
  37. package/src/container/Container.tsx +48 -0
  38. package/src/description-item/DescriptionItem.stories.tsx +163 -0
  39. package/src/description-item/DescriptionItem.tsx +104 -0
  40. package/src/description-line-item/DescriptionLineItem.stories.tsx +23 -0
  41. package/src/description-line-item/DescriptionLineItem.tsx +29 -0
  42. package/src/email-autocomplate/CloseIcon.tsx +20 -0
  43. package/src/email-autocomplate/EmailAutocomplete.stories.tsx +47 -0
  44. package/src/email-autocomplate/EmailAutocomplete.tsx +138 -0
  45. package/src/file-drop-zone/FileDropZone.stories.tsx +44 -0
  46. package/src/file-drop-zone/FileDropZone.tsx +170 -0
  47. package/src/file-list-item/FileListItem.stories.tsx +37 -0
  48. package/src/file-list-item/FileListItem.tsx +148 -0
  49. package/src/file-list-item/__tests__/FileListItem.spec.tsx +339 -0
  50. package/src/flag-list/FlagList.stories.tsx +72 -0
  51. package/src/flag-list/FlagList.tsx +54 -0
  52. package/src/flag-list/FlagListItem.tsx +126 -0
  53. package/src/index.spec.ts +53 -0
  54. package/src/index.ts +36 -0
  55. package/src/linked-text/LinkeText.stories.tsx +42 -0
  56. package/src/linked-text/LinkedText.tsx +47 -0
  57. package/src/multiline-text/MultilineText.stories.tsx +30 -0
  58. package/src/multiline-text/MultilineText.ts +16 -0
  59. package/src/navbar/Navbar.stories.tsx +137 -0
  60. package/src/navbar/Navbar.tsx +132 -0
  61. package/src/navbar/NavbarAccordion.tsx +195 -0
  62. package/src/navbar/NavbarAvatar.tsx +51 -0
  63. package/src/navbar/NavbarBottomBar.tsx +135 -0
  64. package/src/navbar/NavbarContext.tsx +22 -0
  65. package/src/navbar/NavbarItem.tsx +125 -0
  66. package/src/navbar/NavbarList.tsx +247 -0
  67. package/src/navbar/NavbarMenu.tsx +102 -0
  68. package/src/passwordStepper/PasswordStrength.stories.tsx +95 -0
  69. package/src/passwordStepper/PasswordStrength.tsx +107 -0
  70. package/src/passwordStepper/PasswordUtils.tsx +42 -0
  71. package/src/passwordStepper/PasswordValidationComponents.tsx +95 -0
  72. package/src/sidebar/Sidebar.stories.tsx +376 -0
  73. package/src/sidebar/Sidebar.tsx +75 -0
  74. package/src/sidebar/SidebarBackButton.tsx +33 -0
  75. package/src/sidebar/SidebarContainer.tsx +114 -0
  76. package/src/sidebar/SidebarContent.tsx +119 -0
  77. package/src/sidebar/SidebarDivider.tsx +15 -0
  78. package/src/sidebar/SidebarMenuItem.tsx +196 -0
  79. package/src/sidebar/SidebarMenuItemAction.tsx +27 -0
  80. package/src/sidebar/SidebarMenuItemAvatar.tsx +59 -0
  81. package/src/sidebar/SidebarMenuItemContext.tsx +33 -0
  82. package/src/sidebar/SidebarSubheader.tsx +38 -0
  83. package/src/styled.d.ts +12 -0
  84. package/src/text-box/TextBox.stories.tsx +114 -0
  85. package/src/text-box/TextBox.tsx +238 -0
  86. package/src/utils/RuleNormalizer.ts +24 -0
  87. package/src/utils/mergeStyles.ts +28 -0
  88. package/tsconfig.json +19 -0
  89. package/LICENSE +0 -21
  90. package/dist-node/index.js.map +0 -1
  91. package/dist-web/index.js.map +0 -1
  92. /package/{dist-src → pkg/dist-src}/alert/Alert.js +0 -0
  93. /package/{dist-src → pkg/dist-src}/banner/Banner.js +0 -0
  94. /package/{dist-src → pkg/dist-src}/box/Box.js +0 -0
  95. /package/{dist-src → pkg/dist-src}/button/Button.js +0 -0
  96. /package/{dist-src → pkg/dist-src}/button-area/ButtonArea.js +0 -0
  97. /package/{dist-src → pkg/dist-src}/chat/Chat.js +0 -0
  98. /package/{dist-src → pkg/dist-src}/chat/ChatMessage.js +0 -0
  99. /package/{dist-src → pkg/dist-src}/container/Container.js +0 -0
  100. /package/{dist-src → pkg/dist-src}/description-item/DescriptionItem.js +0 -0
  101. /package/{dist-src → pkg/dist-src}/description-line-item/DescriptionLineItem.js +0 -0
  102. /package/{dist-src → pkg/dist-src}/email-autocomplate/CloseIcon.js +0 -0
  103. /package/{dist-src → pkg/dist-src}/file-list-item/FileListItem.js +0 -0
  104. /package/{dist-src → pkg/dist-src}/flag-list/FlagList.js +0 -0
  105. /package/{dist-src → pkg/dist-src}/linked-text/LinkedText.js +0 -0
  106. /package/{dist-src → pkg/dist-src}/multiline-text/MultilineText.js +0 -0
  107. /package/{dist-src → pkg/dist-src}/navbar/NavbarAvatar.js +0 -0
  108. /package/{dist-src → pkg/dist-src}/navbar/NavbarBottomBar.js +0 -0
  109. /package/{dist-src → pkg/dist-src}/navbar/NavbarContext.js +0 -0
  110. /package/{dist-src → pkg/dist-src}/navbar/NavbarItem.js +0 -0
  111. /package/{dist-src → pkg/dist-src}/navbar/NavbarMenu.js +0 -0
  112. /package/{dist-src → pkg/dist-src}/passwordStepper/PasswordStrength.js +0 -0
  113. /package/{dist-src → pkg/dist-src}/passwordStepper/PasswordUtils.js +0 -0
  114. /package/{dist-src → pkg/dist-src}/passwordStepper/PasswordValidationComponents.js +0 -0
  115. /package/{dist-src → pkg/dist-src}/sidebar/Sidebar.js +0 -0
  116. /package/{dist-src → pkg/dist-src}/sidebar/SidebarContainer.js +0 -0
  117. /package/{dist-src → pkg/dist-src}/sidebar/SidebarContent.js +0 -0
  118. /package/{dist-src → pkg/dist-src}/sidebar/SidebarDivider.js +0 -0
  119. /package/{dist-src → pkg/dist-src}/sidebar/SidebarMenuItemAction.js +0 -0
  120. /package/{dist-src → pkg/dist-src}/sidebar/SidebarMenuItemContext.js +0 -0
  121. /package/{dist-src → pkg/dist-src}/sidebar/SidebarSubheader.js +0 -0
  122. /package/{dist-src → pkg/dist-src}/text-box/TextBox.js +0 -0
  123. /package/{dist-src → pkg/dist-src}/utils/RuleNormalizer.js +0 -0
  124. /package/{dist-src → pkg/dist-src}/utils/mergeStyles.js +0 -0
@@ -0,0 +1,162 @@
1
+ import {
2
+ AddAlertOutlined,
3
+ OutlinedFlag,
4
+ SecurityRounded,
5
+ WarningRounded,
6
+ } from '@material-ui/icons';
7
+ import { Meta } from '@storybook/react';
8
+ import { Column, Columns, Inline, Stack } from '@superdispatch/ui';
9
+ import { Button } from '../button/Button';
10
+ import { Alert } from './Alert';
11
+
12
+ export default {
13
+ title: 'Lab/Alert',
14
+ component: Alert,
15
+ } as Meta;
16
+
17
+ export const basic = () => (
18
+ <Columns collapseBelow="tablet" space="xsmall">
19
+ <Column>
20
+ <Stack>
21
+ <Alert severity="positive">
22
+ <Inline verticalAlign="center">
23
+ <span>This is a success alert — check it out!</span>
24
+ <Button variant="neutral" size="small">
25
+ Button
26
+ </Button>
27
+ </Inline>
28
+ </Alert>
29
+
30
+ <Alert severity="info">
31
+ <Inline verticalAlign="center">
32
+ <span>This is an info alert — check it out!</span>
33
+ <Button variant="neutral" size="small">
34
+ Button
35
+ </Button>
36
+ </Inline>
37
+ </Alert>
38
+
39
+ <Alert severity="caution">
40
+ <Inline verticalAlign="center">
41
+ <span>This is a warning alert — check it out!</span>
42
+ <Button variant="neutral" size="small">
43
+ Button
44
+ </Button>
45
+ </Inline>
46
+ </Alert>
47
+
48
+ <Alert severity="critical">
49
+ <Inline verticalAlign="center">
50
+ <span>This is an error alert — check it out!</span>
51
+ <Button variant="neutral" size="small">
52
+ Button
53
+ </Button>
54
+ </Inline>
55
+ </Alert>
56
+ </Stack>
57
+ </Column>
58
+
59
+ <Column>
60
+ <Stack>
61
+ <Alert severity="positive">
62
+ <Inline verticalAlign="center">
63
+ <span>
64
+ Uh-Oh! Your Super Carrier documents need review. please submit the
65
+ following documents. Don’t worry! Be happy!
66
+ </span>
67
+ <Button variant="neutral" size="small">
68
+ Button
69
+ </Button>
70
+ </Inline>
71
+ </Alert>
72
+
73
+ <Alert severity="info">
74
+ <Inline verticalAlign="center">
75
+ <span>
76
+ Uh-Oh! Your Super Carrier documents need review. please submit the
77
+ following documents. Don’t worry! Be happy!
78
+ </span>
79
+ <Button variant="neutral" size="small">
80
+ Button
81
+ </Button>
82
+ </Inline>
83
+ </Alert>
84
+
85
+ <Alert severity="caution">
86
+ <Inline verticalAlign="center">
87
+ <span>
88
+ Uh-Oh! Your Super Carrier documents need review. please submit the
89
+ following documents. Don’t worry! Be happy!
90
+ </span>
91
+ <Button variant="neutral" size="small">
92
+ Button
93
+ </Button>
94
+ </Inline>
95
+ </Alert>
96
+
97
+ <Alert severity="critical">
98
+ <Inline verticalAlign="center">
99
+ <span>
100
+ Uh-Oh! Your Super Carrier documents need review. please submit the
101
+ following documents. Don’t worry! Be happy!
102
+ </span>
103
+ <Button variant="neutral" size="small">
104
+ Button
105
+ </Button>
106
+ </Inline>
107
+ </Alert>
108
+ </Stack>
109
+ </Column>
110
+
111
+ <Column>
112
+ <Stack>
113
+ <Alert icon={<OutlinedFlag />} severity="positive">
114
+ <Inline verticalAlign="center">
115
+ <span>This is a success alert — check it out!</span>
116
+ <Button variant="neutral" size="small">
117
+ Button
118
+ </Button>
119
+ </Inline>
120
+ </Alert>
121
+
122
+ <Alert icon={<SecurityRounded />} severity="info">
123
+ <Inline verticalAlign="center">
124
+ <span>This is an info alert — check it out!</span>
125
+ <Button variant="neutral" size="small">
126
+ Button
127
+ </Button>
128
+ </Inline>
129
+ </Alert>
130
+
131
+ <Alert icon={<WarningRounded />} severity="caution">
132
+ <Inline verticalAlign="center">
133
+ <span>This is a warning alert — check it out!</span>
134
+ <Button variant="neutral" size="small">
135
+ Button
136
+ </Button>
137
+ </Inline>
138
+ </Alert>
139
+
140
+ <Alert icon={<AddAlertOutlined />} severity="critical">
141
+ <Inline verticalAlign="center">
142
+ <span>This is an error alert — check it out!</span>
143
+ <Button variant="neutral" size="small">
144
+ Button
145
+ </Button>
146
+ </Inline>
147
+ </Alert>
148
+
149
+ <Alert
150
+ severity="info"
151
+ onClose={() => {
152
+ return null;
153
+ }}
154
+ >
155
+ <Inline verticalAlign="center">
156
+ <span>This is an alert with close icon — check it out!</span>
157
+ </Inline>
158
+ </Alert>
159
+ </Stack>
160
+ </Column>
161
+ </Columns>
162
+ );
@@ -0,0 +1,135 @@
1
+ import { CheckCircle, Error, Info, WarningRounded } from '@material-ui/icons';
2
+ import {
3
+ Alert as MaterialAlert,
4
+ AlertProps as MaterialAlertProps,
5
+ } from '@material-ui/lab';
6
+ import { ColorDynamic } from '@superdispatch/ui';
7
+ import { forwardRef, ReactNode } from 'react';
8
+ import styled, { css, SimpleInterpolation } from 'styled-components';
9
+
10
+ function colorMixin(
11
+ textColor: ColorDynamic,
12
+ iconColor: ColorDynamic,
13
+ backgroundColor: ColorDynamic,
14
+ buttonHoverColor: ColorDynamic,
15
+ ): readonly SimpleInterpolation[] {
16
+ return css`
17
+ color: ${textColor};
18
+ border-color: ${textColor};
19
+ background-color: ${backgroundColor};
20
+
21
+ & .MuiAlert-icon {
22
+ color: ${iconColor};
23
+ }
24
+
25
+ & .MuiAlert-action {
26
+ color: ${iconColor};
27
+
28
+ & .MuiIconButton-root {
29
+ &:hover,
30
+ &:active {
31
+ color: ${buttonHoverColor};
32
+ }
33
+ }
34
+ }
35
+ `;
36
+ }
37
+
38
+ const StyledAlert = styled(MaterialAlert)`
39
+ &.MuiAlert-outlinedSuccess {
40
+ ${colorMixin(
41
+ ColorDynamic.Green500,
42
+ ColorDynamic.Green300,
43
+ ColorDynamic.Green50,
44
+ ColorDynamic.Green400,
45
+ )};
46
+ }
47
+
48
+ &.MuiAlert-outlinedInfo {
49
+ ${colorMixin(
50
+ ColorDynamic.Blue500,
51
+ ColorDynamic.Blue300,
52
+ ColorDynamic.Blue50,
53
+ ColorDynamic.Blue400,
54
+ )};
55
+ }
56
+
57
+ &.MuiAlert-outlinedWarning {
58
+ ${colorMixin(
59
+ ColorDynamic.Yellow500,
60
+ ColorDynamic.Yellow300,
61
+ ColorDynamic.Yellow50,
62
+ ColorDynamic.Yellow400,
63
+ )};
64
+ }
65
+
66
+ &.MuiAlert-outlinedError {
67
+ ${colorMixin(
68
+ ColorDynamic.Red500,
69
+ ColorDynamic.Red300,
70
+ ColorDynamic.Red50,
71
+ ColorDynamic.Red400,
72
+ )};
73
+ }
74
+
75
+ & .MuiAlert-icon {
76
+ opacity: 1;
77
+ padding: 8px 0;
78
+ font-size: 24px;
79
+ }
80
+
81
+ & .MuiAlert-action {
82
+ display: block;
83
+ padding-top: 5px;
84
+ margin-right: -3px;
85
+
86
+ & .MuiIconButton-root {
87
+ & .MuiSvgIcon-root {
88
+ font-size: 24px;
89
+ }
90
+ }
91
+ }
92
+ `;
93
+
94
+ export type AlertSeverityProp = 'positive' | 'info' | 'caution' | 'critical';
95
+
96
+ export interface AlertProps {
97
+ onClose?: () => void;
98
+ children?: ReactNode;
99
+ icon?: ReactNode;
100
+ severity?: AlertSeverityProp;
101
+ }
102
+
103
+ function toMaterialSeverity(
104
+ severity: AlertSeverityProp,
105
+ ): MaterialAlertProps['severity'] {
106
+ return severity === 'info'
107
+ ? 'info'
108
+ : severity === 'caution'
109
+ ? 'warning'
110
+ : severity === 'critical'
111
+ ? 'error'
112
+ : 'success';
113
+ }
114
+
115
+ const iconMapping: MaterialAlertProps['iconMapping'] = {
116
+ success: <CheckCircle />,
117
+ info: <Info />,
118
+ error: <Error />,
119
+ warning: <WarningRounded />,
120
+ };
121
+
122
+ export const Alert = forwardRef<HTMLDivElement, AlertProps>(
123
+ ({ children, onClose, severity = 'positive', icon }, ref) => (
124
+ <StyledAlert
125
+ ref={ref}
126
+ variant="outlined"
127
+ icon={icon}
128
+ iconMapping={iconMapping}
129
+ severity={toMaterialSeverity(severity)}
130
+ onClose={onClose}
131
+ >
132
+ {children}
133
+ </StyledAlert>
134
+ ),
135
+ );
@@ -0,0 +1,64 @@
1
+ import { Link } from '@material-ui/core';
2
+ import { Meta } from '@storybook/react';
3
+ import { Inline, Stack } from '@superdispatch/ui';
4
+ import { UseState } from '@superdispatch/ui-docs';
5
+ import { Button } from '../button/Button';
6
+ import { TextBox } from '../text-box/TextBox';
7
+ import { Banner } from './Banner';
8
+
9
+ export default {
10
+ title: 'Lab/Banner',
11
+ component: Banner,
12
+ } as Meta;
13
+
14
+ export const basic = () => (
15
+ <Stack>
16
+ <UseState initialState={true}>
17
+ {(open, setOpen) => (
18
+ <Stack space="none">
19
+ <Button
20
+ size="small"
21
+ variant="neutral"
22
+ aria-label="Rate Button"
23
+ onClick={() => {
24
+ setOpen(!open);
25
+ }}
26
+ >
27
+ {open ? 'Close' : 'Open'}
28
+ </Button>
29
+
30
+ <Banner
31
+ in={open}
32
+ border="top"
33
+ mountOnEnter={true}
34
+ unmountOnExit={true}
35
+ >
36
+ <Inline
37
+ verticalAlign="center"
38
+ horizontalAlign="center"
39
+ space="small"
40
+ >
41
+ <Inline
42
+ space="xxsmall"
43
+ verticalAlign="center"
44
+ horizontalAlign="center"
45
+ >
46
+ <TextBox color="inherit">
47
+ Rate your recent experience with{' '}
48
+ </TextBox>
49
+ <Link
50
+ color="inherit"
51
+ target="_blank"
52
+ rel="noreferrer"
53
+ href="https://superdispatch.com/"
54
+ >
55
+ SuperDispatch
56
+ </Link>
57
+ </Inline>
58
+ </Inline>
59
+ </Banner>
60
+ </Stack>
61
+ )}
62
+ </UseState>
63
+ </Stack>
64
+ );
@@ -0,0 +1,120 @@
1
+ import { ColorDynamic } from '@superdispatch/ui';
2
+ import { forwardRef, useEffect, useState } from 'react';
3
+ import { CSSTransition } from 'react-transition-group';
4
+ // eslint-disable-next-line import/no-internal-modules
5
+ import { CSSTransitionProps } from 'react-transition-group/CSSTransition';
6
+ import styled, {
7
+ css,
8
+ Keyframes,
9
+ keyframes,
10
+ SimpleInterpolation,
11
+ } from 'styled-components';
12
+
13
+ function enterMixin(border: BorderPlacement): readonly SimpleInterpolation[] {
14
+ return css`
15
+ min-height: 56px;
16
+ color: ${ColorDynamic.Dark500};
17
+ background-color: ${ColorDynamic.White};
18
+
19
+ border-${border}: 1px #dfe3e8 solid;
20
+ `;
21
+ }
22
+
23
+ function enterAnimation(border: BorderPlacement): Keyframes {
24
+ return keyframes`
25
+ 0% {
26
+ min-height: 0;
27
+ color: ${ColorDynamic.White};
28
+ background-color: ${ColorDynamic.Dark500};
29
+ }
30
+
31
+ 50% {
32
+ min-height: 56px;
33
+ color: ${ColorDynamic.White};
34
+ background-color: ${ColorDynamic.Dark500};
35
+ }
36
+
37
+ 70% {
38
+ min-height: 56px;
39
+ color: ${ColorDynamic.White};
40
+ background-color: ${ColorDynamic.Dark500};
41
+ }
42
+
43
+ 100% {
44
+ ${enterMixin(border)}
45
+ }
46
+ `;
47
+ }
48
+
49
+ type BorderPlacement = 'top' | 'bottom';
50
+
51
+ type CustomerTransitionProps = CSSTransitionProps<HTMLDivElement> & {
52
+ className?: string;
53
+ border?: BorderPlacement;
54
+ };
55
+
56
+ const CustomTransition = forwardRef<
57
+ CSSTransition<HTMLDivElement>,
58
+ CustomerTransitionProps
59
+ >(({ children, ...props }, ref) => (
60
+ <CSSTransition
61
+ {...props}
62
+ ref={ref}
63
+ timeout={3000}
64
+ classNames={props.className}
65
+ >
66
+ <div>{children}</div>
67
+ </CSSTransition>
68
+ ));
69
+
70
+ const BannerContent = styled(CustomTransition)<CustomerTransitionProps>(
71
+ ({ border = 'bottom' }) => {
72
+ return css`
73
+ height: 0;
74
+ width: 100%;
75
+ overflow: hidden;
76
+
77
+ display: flex;
78
+ align-items: center;
79
+ justify-content: center;
80
+
81
+ color: ${ColorDynamic.White};
82
+ background-color: ${ColorDynamic.White};
83
+
84
+ &-enter-active {
85
+ animation: ${enterAnimation(border)} 2s 1s forwards;
86
+ }
87
+
88
+ &-enter-done {
89
+ ${enterMixin(border)};
90
+ }
91
+
92
+ &-exit {
93
+ ${enterMixin(border)};
94
+ }
95
+
96
+ &-exit-active {
97
+ min-height: 0;
98
+ transition: min-height 2s 1s;
99
+ }
100
+ `;
101
+ },
102
+ );
103
+
104
+ type BannerProps = Omit<
105
+ CustomerTransitionProps,
106
+ 'timeout' | 'className' | 'classNames'
107
+ >;
108
+
109
+ export const Banner = forwardRef<CSSTransition<HTMLDivElement>, BannerProps>(
110
+ ({ in: inProp, ...props }, ref) => {
111
+ const [isIn, setIn] = useState(false);
112
+
113
+ // transition is not triggered on initial render with `in: true`
114
+ useEffect(() => {
115
+ setIn(!!inProp);
116
+ }, [inProp]);
117
+
118
+ return <BannerContent ref={ref} in={isIn} {...props} />;
119
+ },
120
+ );
@@ -0,0 +1,20 @@
1
+ import { Meta } from '@storybook/react';
2
+ import { Box } from './Box';
3
+
4
+ export default { title: 'Lab/Box', component: Box } as Meta;
5
+
6
+ export const basic = () => (
7
+ <Box
8
+ display="inline-block"
9
+ borderWidth="small"
10
+ borderTopRightRadius="small"
11
+ borderBottomRightRadius="small"
12
+ borderColor={['Blue200', 'Green200', 'Purple200']}
13
+ borderLeftWidth="large"
14
+ borderLeftColor={['Blue300', 'Green300', 'Purple300']}
15
+ padding={['large', 'medium', 'small']}
16
+ backgroundColor={['Blue50', 'Green50', 'Purple50']}
17
+ >
18
+ Hey
19
+ </Box>
20
+ );