@superdispatch/ui-lab 0.50.5 → 0.50.6

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 (122) hide show
  1. package/LICENSE +21 -0
  2. package/package.json +14 -39
  3. package/.babelrc.js +0 -5
  4. package/pkg/README.md +0 -10
  5. package/pkg/package.json +0 -41
  6. package/playroom.ts +0 -24
  7. package/src/alert/Alert.stories.tsx +0 -162
  8. package/src/alert/Alert.tsx +0 -135
  9. package/src/banner/Banner.stories.tsx +0 -64
  10. package/src/banner/Banner.tsx +0 -120
  11. package/src/box/Box.stories.tsx +0 -20
  12. package/src/box/Box.tsx +0 -257
  13. package/src/button/Button.stories.tsx +0 -739
  14. package/src/button/Button.tsx +0 -498
  15. package/src/button-area/ButtonArea.stories.tsx +0 -65
  16. package/src/button-area/ButtonArea.tsx +0 -90
  17. package/src/chat/Chat.stories.tsx +0 -130
  18. package/src/chat/Chat.tsx +0 -57
  19. package/src/chat/ChatMessage.tsx +0 -45
  20. package/src/chat/README.MD +0 -7
  21. package/src/chat/__tests__/Chat.spec.tsx +0 -29
  22. package/src/chat/__tests__/ChatMessage.spec.tsx +0 -39
  23. package/src/container/Container.tsx +0 -48
  24. package/src/description-item/DescriptionItem.stories.tsx +0 -163
  25. package/src/description-item/DescriptionItem.tsx +0 -104
  26. package/src/description-line-item/DescriptionLineItem.stories.tsx +0 -23
  27. package/src/description-line-item/DescriptionLineItem.tsx +0 -29
  28. package/src/email-autocomplate/CloseIcon.tsx +0 -20
  29. package/src/email-autocomplate/EmailAutocomplete.stories.tsx +0 -47
  30. package/src/email-autocomplate/EmailAutocomplete.tsx +0 -138
  31. package/src/file-drop-zone/FileDropZone.stories.tsx +0 -44
  32. package/src/file-drop-zone/FileDropZone.tsx +0 -170
  33. package/src/file-list-item/FileListItem.stories.tsx +0 -37
  34. package/src/file-list-item/FileListItem.tsx +0 -148
  35. package/src/file-list-item/__tests__/FileListItem.spec.tsx +0 -339
  36. package/src/flag-list/FlagList.stories.tsx +0 -72
  37. package/src/flag-list/FlagList.tsx +0 -54
  38. package/src/flag-list/FlagListItem.tsx +0 -126
  39. package/src/index.spec.ts +0 -53
  40. package/src/index.ts +0 -36
  41. package/src/linked-text/LinkeText.stories.tsx +0 -42
  42. package/src/linked-text/LinkedText.tsx +0 -47
  43. package/src/multiline-text/MultilineText.stories.tsx +0 -30
  44. package/src/multiline-text/MultilineText.ts +0 -16
  45. package/src/navbar/Navbar.stories.tsx +0 -137
  46. package/src/navbar/Navbar.tsx +0 -132
  47. package/src/navbar/NavbarAccordion.tsx +0 -195
  48. package/src/navbar/NavbarAvatar.tsx +0 -51
  49. package/src/navbar/NavbarBottomBar.tsx +0 -135
  50. package/src/navbar/NavbarContext.tsx +0 -22
  51. package/src/navbar/NavbarItem.tsx +0 -125
  52. package/src/navbar/NavbarList.tsx +0 -247
  53. package/src/navbar/NavbarMenu.tsx +0 -102
  54. package/src/passwordStepper/PasswordStrength.stories.tsx +0 -95
  55. package/src/passwordStepper/PasswordStrength.tsx +0 -107
  56. package/src/passwordStepper/PasswordUtils.tsx +0 -42
  57. package/src/passwordStepper/PasswordValidationComponents.tsx +0 -95
  58. package/src/sidebar/Sidebar.stories.tsx +0 -376
  59. package/src/sidebar/Sidebar.tsx +0 -75
  60. package/src/sidebar/SidebarBackButton.tsx +0 -33
  61. package/src/sidebar/SidebarContainer.tsx +0 -114
  62. package/src/sidebar/SidebarContent.tsx +0 -119
  63. package/src/sidebar/SidebarDivider.tsx +0 -15
  64. package/src/sidebar/SidebarMenuItem.tsx +0 -196
  65. package/src/sidebar/SidebarMenuItemAction.tsx +0 -27
  66. package/src/sidebar/SidebarMenuItemAvatar.tsx +0 -59
  67. package/src/sidebar/SidebarMenuItemContext.tsx +0 -33
  68. package/src/sidebar/SidebarSubheader.tsx +0 -38
  69. package/src/styled.d.ts +0 -12
  70. package/src/text-box/TextBox.stories.tsx +0 -114
  71. package/src/text-box/TextBox.tsx +0 -238
  72. package/src/utils/RuleNormalizer.ts +0 -24
  73. package/src/utils/mergeStyles.ts +0 -28
  74. package/tsconfig.json +0 -19
  75. /package/{pkg/dist-node → dist-node}/index.js +0 -0
  76. /package/{pkg/dist-node → dist-node}/index.js.map +0 -0
  77. /package/{pkg/dist-src → dist-src}/alert/Alert.js +0 -0
  78. /package/{pkg/dist-src → dist-src}/banner/Banner.js +0 -0
  79. /package/{pkg/dist-src → dist-src}/box/Box.js +0 -0
  80. /package/{pkg/dist-src → dist-src}/button/Button.js +0 -0
  81. /package/{pkg/dist-src → dist-src}/button-area/ButtonArea.js +0 -0
  82. /package/{pkg/dist-src → dist-src}/chat/Chat.js +0 -0
  83. /package/{pkg/dist-src → dist-src}/chat/ChatMessage.js +0 -0
  84. /package/{pkg/dist-src → dist-src}/container/Container.js +0 -0
  85. /package/{pkg/dist-src → dist-src}/description-item/DescriptionItem.js +0 -0
  86. /package/{pkg/dist-src → dist-src}/description-line-item/DescriptionLineItem.js +0 -0
  87. /package/{pkg/dist-src → dist-src}/email-autocomplate/CloseIcon.js +0 -0
  88. /package/{pkg/dist-src → dist-src}/email-autocomplate/EmailAutocomplete.js +0 -0
  89. /package/{pkg/dist-src → dist-src}/file-drop-zone/FileDropZone.js +0 -0
  90. /package/{pkg/dist-src → dist-src}/file-list-item/FileListItem.js +0 -0
  91. /package/{pkg/dist-src → dist-src}/flag-list/FlagList.js +0 -0
  92. /package/{pkg/dist-src → dist-src}/flag-list/FlagListItem.js +0 -0
  93. /package/{pkg/dist-src → dist-src}/index.js +0 -0
  94. /package/{pkg/dist-src → dist-src}/linked-text/LinkedText.js +0 -0
  95. /package/{pkg/dist-src → dist-src}/multiline-text/MultilineText.js +0 -0
  96. /package/{pkg/dist-src → dist-src}/navbar/Navbar.js +0 -0
  97. /package/{pkg/dist-src → dist-src}/navbar/NavbarAccordion.js +0 -0
  98. /package/{pkg/dist-src → dist-src}/navbar/NavbarAvatar.js +0 -0
  99. /package/{pkg/dist-src → dist-src}/navbar/NavbarBottomBar.js +0 -0
  100. /package/{pkg/dist-src → dist-src}/navbar/NavbarContext.js +0 -0
  101. /package/{pkg/dist-src → dist-src}/navbar/NavbarItem.js +0 -0
  102. /package/{pkg/dist-src → dist-src}/navbar/NavbarList.js +0 -0
  103. /package/{pkg/dist-src → dist-src}/navbar/NavbarMenu.js +0 -0
  104. /package/{pkg/dist-src → dist-src}/passwordStepper/PasswordStrength.js +0 -0
  105. /package/{pkg/dist-src → dist-src}/passwordStepper/PasswordUtils.js +0 -0
  106. /package/{pkg/dist-src → dist-src}/passwordStepper/PasswordValidationComponents.js +0 -0
  107. /package/{pkg/dist-src → dist-src}/sidebar/Sidebar.js +0 -0
  108. /package/{pkg/dist-src → dist-src}/sidebar/SidebarBackButton.js +0 -0
  109. /package/{pkg/dist-src → dist-src}/sidebar/SidebarContainer.js +0 -0
  110. /package/{pkg/dist-src → dist-src}/sidebar/SidebarContent.js +0 -0
  111. /package/{pkg/dist-src → dist-src}/sidebar/SidebarDivider.js +0 -0
  112. /package/{pkg/dist-src → dist-src}/sidebar/SidebarMenuItem.js +0 -0
  113. /package/{pkg/dist-src → dist-src}/sidebar/SidebarMenuItemAction.js +0 -0
  114. /package/{pkg/dist-src → dist-src}/sidebar/SidebarMenuItemAvatar.js +0 -0
  115. /package/{pkg/dist-src → dist-src}/sidebar/SidebarMenuItemContext.js +0 -0
  116. /package/{pkg/dist-src → dist-src}/sidebar/SidebarSubheader.js +0 -0
  117. /package/{pkg/dist-src → dist-src}/text-box/TextBox.js +0 -0
  118. /package/{pkg/dist-src → dist-src}/utils/RuleNormalizer.js +0 -0
  119. /package/{pkg/dist-src → dist-src}/utils/mergeStyles.js +0 -0
  120. /package/{pkg/dist-types → dist-types}/index.d.ts +0 -0
  121. /package/{pkg/dist-web → dist-web}/index.js +0 -0
  122. /package/{pkg/dist-web → dist-web}/index.js.map +0 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Super Dispatch
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/package.json CHANGED
@@ -1,22 +1,21 @@
1
1
  {
2
2
  "name": "@superdispatch/ui-lab",
3
- "version": "0.50.5",
3
+ "version": "0.50.6",
4
+ "license": "MIT",
5
+ "files": [
6
+ "dist-*/**",
7
+ "bin/"
8
+ ],
9
+ "pika": true,
10
+ "sideEffects": false,
4
11
  "repository": {
5
12
  "type": "git",
6
13
  "url": "https://github.com/superdispatch/ui.git"
7
14
  },
8
- "license": "MIT",
9
- "main": "src/index.ts",
10
- "module": "src/index.ts",
11
- "browser": "pkg/dist-web/index.js",
12
- "types": "src/index.ts",
13
- "scripts": {
14
- "version": "pika build"
15
- },
16
15
  "dependencies": {
17
- "@superdispatch/dates": "^0.50.3",
16
+ "@superdispatch/dates": "^0.50.6",
18
17
  "@superdispatch/hooks": "^0.50.0",
19
- "@superdispatch/ui": "^0.50.3",
18
+ "@superdispatch/ui": "^0.50.6",
20
19
  "react-anchorme": "^3.0.0",
21
20
  "react-dropzone": "^11.3.4"
22
21
  },
@@ -35,32 +34,8 @@
35
34
  "access": "public",
36
35
  "directory": "pkg"
37
36
  },
38
- "@pika/pack": {
39
- "pipeline": [
40
- [
41
- "@pika/plugin-standard-pkg",
42
- {
43
- "exclude": [
44
- "**/*.spec.*",
45
- "**/*.stories.*",
46
- "**/*.playroom.*",
47
- "**/__tests__/**",
48
- "**/__testutils__/**"
49
- ]
50
- }
51
- ],
52
- [
53
- "@pika/plugin-build-web"
54
- ],
55
- [
56
- "@pika/plugin-build-node"
57
- ],
58
- [
59
- "@pika/plugin-build-types"
60
- ],
61
- [
62
- "@pika/plugin-bundle-types"
63
- ]
64
- ]
65
- }
37
+ "esnext": "dist-src/index.js",
38
+ "module": "dist-web/index.js",
39
+ "main": "dist-node/index.js",
40
+ "types": "dist-types/index.d.ts"
66
41
  }
package/.babelrc.js DELETED
@@ -1,5 +0,0 @@
1
- 'use strict';
2
-
3
- const createBabelConfig = require('../../config/createBabelConfig');
4
-
5
- module.exports = createBabelConfig();
package/pkg/README.md DELETED
@@ -1,10 +0,0 @@
1
- ### `@superdispatch/ui-lab`
2
-
3
- [![npm](https://img.shields.io/npm/v/@superdispatch/ui-lab)](https://www.npmjs.com/package/@superdispatch/ui-lab)
4
- [![npm minzipped size](https://img.shields.io/bundlephobia/minzip/@superdispatch/ui-lab.svg)](https://bundlephobia.com/result?p=@superdispatch/ui-lab)
5
-
6
- #### Installation
7
-
8
- ```bash
9
- yarn add @superdispatch/ui-lab
10
- ```
package/pkg/package.json DELETED
@@ -1,41 +0,0 @@
1
- {
2
- "name": "@superdispatch/ui-lab",
3
- "version": "0.50.5",
4
- "license": "MIT",
5
- "files": [
6
- "dist-*/**",
7
- "bin/"
8
- ],
9
- "pika": true,
10
- "sideEffects": false,
11
- "repository": {
12
- "type": "git",
13
- "url": "https://github.com/superdispatch/ui.git"
14
- },
15
- "dependencies": {
16
- "@superdispatch/dates": "^0.50.3",
17
- "@superdispatch/hooks": "^0.50.0",
18
- "@superdispatch/ui": "^0.50.3",
19
- "react-anchorme": "^3.0.0",
20
- "react-dropzone": "^11.3.4"
21
- },
22
- "peerDependencies": {
23
- "@babel/runtime": "^7.0.0",
24
- "@material-ui/core": "^4.7.2",
25
- "@material-ui/icons": "^4.5.1",
26
- "@material-ui/lab": "^4.0.0-alpha.40",
27
- "@mdi/js": "^6.0.0",
28
- "luxon": "^3.7.1",
29
- "react": "^17.0.2",
30
- "react-transition-group": "^4.4.5",
31
- "styled-components": "^5.2.1"
32
- },
33
- "publishConfig": {
34
- "access": "public",
35
- "directory": "pkg"
36
- },
37
- "esnext": "dist-src/index.js",
38
- "module": "dist-web/index.js",
39
- "main": "dist-node/index.js",
40
- "types": "dist-types/index.d.ts"
41
- }
package/playroom.ts DELETED
@@ -1,24 +0,0 @@
1
- export {
2
- Alert,
3
- Banner,
4
- Box,
5
- Button,
6
- ButtonArea,
7
- DescriptionItem,
8
- FileDropZone,
9
- FileListItem,
10
- FlagList,
11
- LinkedText,
12
- MultilineText,
13
- Navbar,
14
- NavbarAvatar,
15
- NavbarMenu,
16
- Sidebar,
17
- SidebarContainer,
18
- SidebarDivider,
19
- SidebarMenuItem,
20
- SidebarMenuItemAction,
21
- SidebarMenuItemAvatar,
22
- SidebarSubheader,
23
- TextBox,
24
- } from './src';
@@ -1,162 +0,0 @@
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
- );
@@ -1,135 +0,0 @@
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
- );
@@ -1,64 +0,0 @@
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
- );
@@ -1,120 +0,0 @@
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
- );
@@ -1,20 +0,0 @@
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
- );