@superdispatch/ui-lab 0.21.12 → 0.21.14

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 (95) hide show
  1. package/LICENSE +21 -0
  2. package/package.json +13 -38
  3. package/.babelrc.js +0 -5
  4. package/.turbo/turbo-version.log +0 -28
  5. package/pkg/README.md +0 -10
  6. package/pkg/package.json +0 -34
  7. package/playroom.ts +0 -23
  8. package/src/alert/Alert.stories.tsx +0 -105
  9. package/src/alert/Alert.tsx +0 -108
  10. package/src/banner/Banner.stories.tsx +0 -64
  11. package/src/banner/Banner.tsx +0 -120
  12. package/src/box/Box.stories.tsx +0 -20
  13. package/src/box/Box.tsx +0 -252
  14. package/src/button/Button.stories.tsx +0 -717
  15. package/src/button/Button.tsx +0 -460
  16. package/src/button-area/ButtonArea.stories.tsx +0 -65
  17. package/src/button-area/ButtonArea.tsx +0 -88
  18. package/src/container/Container.tsx +0 -48
  19. package/src/description-item/DescriptionItem.stories.tsx +0 -163
  20. package/src/description-item/DescriptionItem.tsx +0 -104
  21. package/src/file-drop-zone/FileDropZone.stories.tsx +0 -44
  22. package/src/file-drop-zone/FileDropZone.tsx +0 -170
  23. package/src/file-list-item/FileListItem.stories.tsx +0 -37
  24. package/src/file-list-item/FileListItem.tsx +0 -145
  25. package/src/file-list-item/__tests__/FileListItem.spec.tsx +0 -339
  26. package/src/index.spec.ts +0 -43
  27. package/src/index.ts +0 -28
  28. package/src/linked-text/LinkeText.stories.tsx +0 -42
  29. package/src/linked-text/LinkedText.tsx +0 -47
  30. package/src/multiline-text/MultilineText.stories.tsx +0 -30
  31. package/src/multiline-text/MultilineText.ts +0 -16
  32. package/src/navbar/Navbar.stories.tsx +0 -135
  33. package/src/navbar/Navbar.tsx +0 -111
  34. package/src/navbar/NavbarAccordion.tsx +0 -171
  35. package/src/navbar/NavbarAvatar.tsx +0 -51
  36. package/src/navbar/NavbarBottomBar.tsx +0 -135
  37. package/src/navbar/NavbarContext.tsx +0 -23
  38. package/src/navbar/NavbarItem.tsx +0 -119
  39. package/src/navbar/NavbarList.tsx +0 -225
  40. package/src/navbar/NavbarMenu.tsx +0 -102
  41. package/src/sidebar/Sidebar.stories.tsx +0 -363
  42. package/src/sidebar/Sidebar.tsx +0 -73
  43. package/src/sidebar/SidebarBackButton.tsx +0 -33
  44. package/src/sidebar/SidebarContainer.tsx +0 -114
  45. package/src/sidebar/SidebarContent.tsx +0 -119
  46. package/src/sidebar/SidebarDivider.tsx +0 -15
  47. package/src/sidebar/SidebarMenuItem.tsx +0 -211
  48. package/src/sidebar/SidebarMenuItemAction.tsx +0 -27
  49. package/src/sidebar/SidebarMenuItemAvatar.tsx +0 -59
  50. package/src/sidebar/SidebarMenuItemContext.tsx +0 -33
  51. package/src/sidebar/SidebarSubheader.tsx +0 -38
  52. package/src/styled.d.ts +0 -12
  53. package/src/text-box/TextBox.stories.tsx +0 -108
  54. package/src/text-box/TextBox.tsx +0 -229
  55. package/src/utils/RuleNormalizer.ts +0 -24
  56. package/src/utils/mergeStyles.ts +0 -28
  57. package/tsconfig.json +0 -19
  58. /package/{pkg/dist-node → dist-node}/index.js +0 -0
  59. /package/{pkg/dist-node → dist-node}/index.js.map +0 -0
  60. /package/{pkg/dist-src → dist-src}/alert/Alert.js +0 -0
  61. /package/{pkg/dist-src → dist-src}/banner/Banner.js +0 -0
  62. /package/{pkg/dist-src → dist-src}/box/Box.js +0 -0
  63. /package/{pkg/dist-src → dist-src}/button/Button.js +0 -0
  64. /package/{pkg/dist-src → dist-src}/button-area/ButtonArea.js +0 -0
  65. /package/{pkg/dist-src → dist-src}/container/Container.js +0 -0
  66. /package/{pkg/dist-src → dist-src}/description-item/DescriptionItem.js +0 -0
  67. /package/{pkg/dist-src → dist-src}/file-drop-zone/FileDropZone.js +0 -0
  68. /package/{pkg/dist-src → dist-src}/file-list-item/FileListItem.js +0 -0
  69. /package/{pkg/dist-src → dist-src}/index.js +0 -0
  70. /package/{pkg/dist-src → dist-src}/linked-text/LinkedText.js +0 -0
  71. /package/{pkg/dist-src → dist-src}/multiline-text/MultilineText.js +0 -0
  72. /package/{pkg/dist-src → dist-src}/navbar/Navbar.js +0 -0
  73. /package/{pkg/dist-src → dist-src}/navbar/NavbarAccordion.js +0 -0
  74. /package/{pkg/dist-src → dist-src}/navbar/NavbarAvatar.js +0 -0
  75. /package/{pkg/dist-src → dist-src}/navbar/NavbarBottomBar.js +0 -0
  76. /package/{pkg/dist-src → dist-src}/navbar/NavbarContext.js +0 -0
  77. /package/{pkg/dist-src → dist-src}/navbar/NavbarItem.js +0 -0
  78. /package/{pkg/dist-src → dist-src}/navbar/NavbarList.js +0 -0
  79. /package/{pkg/dist-src → dist-src}/navbar/NavbarMenu.js +0 -0
  80. /package/{pkg/dist-src → dist-src}/sidebar/Sidebar.js +0 -0
  81. /package/{pkg/dist-src → dist-src}/sidebar/SidebarBackButton.js +0 -0
  82. /package/{pkg/dist-src → dist-src}/sidebar/SidebarContainer.js +0 -0
  83. /package/{pkg/dist-src → dist-src}/sidebar/SidebarContent.js +0 -0
  84. /package/{pkg/dist-src → dist-src}/sidebar/SidebarDivider.js +0 -0
  85. /package/{pkg/dist-src → dist-src}/sidebar/SidebarMenuItem.js +0 -0
  86. /package/{pkg/dist-src → dist-src}/sidebar/SidebarMenuItemAction.js +0 -0
  87. /package/{pkg/dist-src → dist-src}/sidebar/SidebarMenuItemAvatar.js +0 -0
  88. /package/{pkg/dist-src → dist-src}/sidebar/SidebarMenuItemContext.js +0 -0
  89. /package/{pkg/dist-src → dist-src}/sidebar/SidebarSubheader.js +0 -0
  90. /package/{pkg/dist-src → dist-src}/text-box/TextBox.js +0 -0
  91. /package/{pkg/dist-src → dist-src}/utils/RuleNormalizer.js +0 -0
  92. /package/{pkg/dist-src → dist-src}/utils/mergeStyles.js +0 -0
  93. /package/{pkg/dist-types → dist-types}/index.d.ts +0 -0
  94. /package/{pkg/dist-web → dist-web}/index.js +0 -0
  95. /package/{pkg/dist-web → dist-web}/index.js.map +0 -0
@@ -1,38 +0,0 @@
1
- import { Column, Columns } from '@superdispatch/ui';
2
- import { forwardRef, ReactNode } from 'react';
3
- import styled from 'styled-components';
4
- import { TextBox } from '../text-box/TextBox';
5
-
6
- const SidebarSubheaderRoot = styled.div`
7
- display: flex;
8
- align-items: center;
9
-
10
- height: 40px;
11
- max-height: 40px;
12
- padding-left: 24px;
13
- padding-right: 24px;
14
- `;
15
-
16
- export interface SidebarSubheaderProps {
17
- id?: string;
18
- action?: ReactNode;
19
- children?: ReactNode;
20
- }
21
-
22
- export const SidebarSubheader = forwardRef<
23
- HTMLDivElement,
24
- SidebarSubheaderProps
25
- >(({ id, action, children }, ref) => {
26
- return (
27
- <SidebarSubheaderRoot ref={ref}>
28
- <Columns space="xsmall" align="center">
29
- <Column>
30
- <TextBox id={id} variant="heading-6" color="secondary" noWrap={true}>
31
- {children}
32
- </TextBox>
33
- </Column>
34
- {!!action && <Column width="content">{action}</Column>}
35
- </Columns>
36
- </SidebarSubheaderRoot>
37
- );
38
- });
package/src/styled.d.ts DELETED
@@ -1,12 +0,0 @@
1
- import { SuperDispatchTheme } from '@superdispatch/ui';
2
- import 'styled-components';
3
-
4
- declare module 'styled-components' {
5
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
6
- export interface DefaultTheme extends SuperDispatchTheme {}
7
-
8
- // eslint-disable-next-line @typescript-eslint/ban-types
9
- export interface StyledConfig<O extends object = {}> {
10
- displayName?: string;
11
- }
12
- }
@@ -1,108 +0,0 @@
1
- import { Meta } from '@storybook/react';
2
- import { Column, Columns, Inline, Stack } from '@superdispatch/ui';
3
- import { Box } from '../box/Box';
4
- import { TextBox } from './TextBox';
5
-
6
- export default { title: 'Lab/TextBox', component: TextBox } as Meta;
7
-
8
- export const basic = () => (
9
- <TextBox>
10
- Hello{' '}
11
- <span role="img" aria-label="waving hand">
12
- 👋
13
- </span>
14
- </TextBox>
15
- );
16
-
17
- export const alignment = () => (
18
- <Columns space="xsmall">
19
- <Column>
20
- <Box backgroundColor="Silver300" padding="xsmall" borderRadius="small">
21
- <TextBox align="right">Align Right</TextBox>
22
- </Box>
23
- </Column>
24
-
25
- <Column>
26
- <Box backgroundColor="Silver300" padding="xsmall" borderRadius="small">
27
- <TextBox align="center">Align Center</TextBox>
28
- </Box>
29
- </Column>
30
-
31
- <Column>
32
- <Box backgroundColor="Silver300" padding="xsmall" borderRadius="small">
33
- <TextBox align="left">Align Left</TextBox>
34
- </Box>
35
- </Column>
36
- </Columns>
37
- );
38
-
39
- export const responsiveAlignment = () => (
40
- <Box backgroundColor="Silver300" padding="xsmall" borderRadius="small">
41
- <TextBox align={['center', 'right']}>Text</TextBox>
42
- </Box>
43
- );
44
-
45
- export const colors = () => (
46
- <Box backgroundColor="Silver300" borderRadius="small" padding="xsmall">
47
- <Inline>
48
- <TextBox color="primary">Primary</TextBox>
49
- <TextBox color="secondary">Secondary</TextBox>
50
- <TextBox color="white">White</TextBox>
51
- <TextBox color="blue">Blue</TextBox>
52
- <TextBox color="green">Green</TextBox>
53
- <TextBox color="purple">Purple</TextBox>
54
- <TextBox color="red">Red</TextBox>
55
- <TextBox color="teal">Teal</TextBox>
56
- <TextBox color="yellow">Yellow</TextBox>
57
- </Inline>
58
- </Box>
59
- );
60
-
61
- export const variants = () => (
62
- <Stack>
63
- <TextBox variant="heading-1">h1. Heading</TextBox>
64
- <TextBox variant="heading-2">h2. Heading</TextBox>
65
- <TextBox variant="heading-3">h3. Heading</TextBox>
66
- <TextBox variant="heading-4">h4. Heading</TextBox>
67
- <TextBox variant="heading-5">h5. Heading</TextBox>
68
- <TextBox variant="heading-6">h6. Heading</TextBox>
69
- <TextBox variant="body">
70
- body. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quos
71
- blanditiis tenetur unde suscipit, quam beatae rerum inventore consectetur,
72
- neque doloribus, cupiditate numquam dignissimos laborum fugiat deleniti?
73
- </TextBox>
74
- <TextBox variant="body-block">
75
- body-block. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quos
76
- blanditiis tenetur unde suscipit, quam beatae rerum inventore consectetur,
77
- neque doloribus, cupiditate numquam dignissimos laborum fugiat deleniti?
78
- </TextBox>
79
- <TextBox variant="body-semibold">
80
- body-semibold. Lorem ipsum dolor sit amet, consectetur adipisicing elit.
81
- Quos blanditiis tenetur unde suscipit, quam beatae rerum inventore
82
- consectetur, neque doloribus, cupiditate numquam dignissimos laborum
83
- fugiat deleniti?
84
- </TextBox>
85
- <TextBox variant="caption">
86
- caption. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quos
87
- blanditiis tenetur unde suscipit, quam beatae rerum inventore consectetur,
88
- neque doloribus, cupiditate numquam dignissimos laborum fugiat deleniti?
89
- </TextBox>
90
- </Stack>
91
- );
92
-
93
- export const noWrap = () => (
94
- <Box width="128px">
95
- <TextBox noWrap={true}>
96
- Lorem ipsum dolor sit amet, consectetur adipisicing elit.
97
- </TextBox>
98
- </Box>
99
- );
100
-
101
- export const wrapOverflow = () => (
102
- <Box width="128px">
103
- <TextBox wrapOverflow={true}>
104
- Most words are short and don‘t need to break. But
105
- Antidisestablishmentarianism is long.
106
- </TextBox>
107
- </Box>
108
- );
@@ -1,229 +0,0 @@
1
- import {
2
- Color,
3
- parseResponsiveProp,
4
- ResponsiveProp,
5
- ResponsivePropTuple,
6
- SuperDispatchTheme,
7
- } from '@superdispatch/ui';
8
- import { forwardRef, ReactNode } from 'react';
9
- import styled, { css, CSSObject, SimpleInterpolation } from 'styled-components';
10
- import { mergeStyles } from '../utils/mergeStyles';
11
- import { createRuleNormalizer } from '../utils/RuleNormalizer';
12
-
13
- export type TextAlignProp = 'left' | 'right' | 'center';
14
- export type TextColorProp =
15
- | 'inherit'
16
- | 'primary'
17
- | 'secondary'
18
- | 'white'
19
- | 'blue'
20
- | 'green'
21
- | 'purple'
22
- | 'red'
23
- | 'teal'
24
- | 'yellow';
25
- export type TextDisplayProp =
26
- | 'none'
27
- | 'block'
28
- | 'inline'
29
- | 'initial'
30
- | 'inherit';
31
-
32
- const normalizeTextColor = createRuleNormalizer<TextColorProp>({
33
- inherit: 'inherit',
34
-
35
- primary: Color.Dark500,
36
- secondary: Color.Dark200,
37
-
38
- white: Color.White,
39
- blue: Color.Blue300,
40
- green: Color.Green300,
41
- purple: Color.Purple500,
42
- red: Color.Red300,
43
- teal: Color.Teal300,
44
- yellow: Color.Yellow300,
45
- });
46
-
47
- export type TextVariantProp =
48
- | 'heading-1'
49
- | 'heading-2'
50
- | 'heading-3'
51
- | 'heading-4'
52
- | 'heading-5'
53
- | 'heading-6'
54
- | 'body'
55
- | 'body-block'
56
- | 'body-semibold'
57
- | 'caption';
58
-
59
- const VARIANT_TYPE_MAPPING: Record<
60
- TextVariantProp,
61
- undefined | keyof JSX.IntrinsicElements
62
- > = {
63
- 'heading-1': 'h1',
64
- 'heading-2': 'h2',
65
- 'heading-3': 'h3',
66
- 'heading-4': 'h4',
67
- 'heading-5': 'h5',
68
- 'heading-6': 'h6',
69
-
70
- body: 'span',
71
- 'body-block': 'p',
72
- 'body-semibold': 'span',
73
- caption: 'span',
74
- };
75
-
76
- function variantMixin(
77
- { typography, breakpoints }: SuperDispatchTheme,
78
- variant: TextVariantProp,
79
- ): CSSObject {
80
- switch (variant) {
81
- case 'heading-1':
82
- return typography.h1 as CSSObject;
83
- case 'heading-2':
84
- return typography.h2 as CSSObject;
85
- case 'heading-3':
86
- return typography.h3 as CSSObject;
87
- case 'heading-4':
88
- return typography.h4 as CSSObject;
89
- case 'heading-5':
90
- return typography.h5 as CSSObject;
91
- case 'heading-6':
92
- return typography.h6 as CSSObject;
93
- case 'body':
94
- default:
95
- return typography.body2 as CSSObject;
96
- case 'body-block': {
97
- return mergeStyles({}, typography.body2 as CSSObject, {
98
- lineHeight: '24px',
99
- [breakpoints.only('xs')]: { lineHeight: '28px' },
100
- });
101
- }
102
- case 'body-semibold':
103
- return typography.body1 as CSSObject;
104
- case 'caption':
105
- return typography.caption as CSSObject;
106
- }
107
- }
108
-
109
- function textBoxMixin(
110
- noWrap: boolean,
111
- align: TextAlignProp,
112
- color: TextColorProp,
113
- display: TextDisplayProp,
114
- wrapOverflow: boolean,
115
- ): readonly SimpleInterpolation[] {
116
- return css`
117
- text-align: ${align};
118
- color: ${normalizeTextColor(color)};
119
- display: ${display === 'initial' && (noWrap || align !== 'left')
120
- ? 'block'
121
- : display};
122
- overflow: ${noWrap ? 'hidden' : 'visible'};
123
- white-space: ${noWrap ? 'nowrap' : 'normal'};
124
- overflow-wrap: ${wrapOverflow ? 'break-word' : 'normal'};
125
- `;
126
- }
127
-
128
- interface TextBoxRootProps {
129
- $variant: TextVariantProp;
130
- $noWrap: ResponsivePropTuple<boolean>;
131
- $wrapOverflow: ResponsivePropTuple<boolean>;
132
- $align: ResponsivePropTuple<TextAlignProp>;
133
- $color: ResponsivePropTuple<TextColorProp>;
134
- $display: ResponsivePropTuple<TextDisplayProp>;
135
- }
136
-
137
- const TextBoxRoot = styled.span<TextBoxRootProps>(
138
- ({ theme, $noWrap, $variant, $align, $color, $display, $wrapOverflow }) =>
139
- css`
140
- margin: 0;
141
- padding: 0;
142
- text-overflow: ellipsis;
143
-
144
- ${variantMixin(theme, $variant)};
145
-
146
- ${textBoxMixin(
147
- $noWrap[0],
148
- $align[0],
149
- $color[0],
150
- $display[0],
151
- $wrapOverflow[0],
152
- )};
153
-
154
- ${theme.breakpoints.up('sm')} {
155
- ${textBoxMixin(
156
- $noWrap[1],
157
- $align[1],
158
- $color[1],
159
- $display[1],
160
- $wrapOverflow[1],
161
- )};
162
- }
163
-
164
- ${theme.breakpoints.up('md')} {
165
- ${textBoxMixin(
166
- $noWrap[2],
167
- $align[2],
168
- $color[2],
169
- $display[2],
170
- $wrapOverflow[2],
171
- )};
172
- }
173
- `,
174
- );
175
-
176
- export interface TextBoxProps {
177
- children?: ReactNode;
178
- as?: keyof JSX.IntrinsicElements;
179
-
180
- id?: string;
181
- 'aria-label'?: string;
182
- 'aria-labelledby'?: string;
183
- 'aria-describedby'?: string;
184
-
185
- variant?: TextVariantProp;
186
-
187
- noWrap?: ResponsiveProp<boolean>;
188
- wrapOverflow?: ResponsiveProp<boolean>;
189
-
190
- align?: ResponsiveProp<TextAlignProp>;
191
- color?: ResponsiveProp<TextColorProp>;
192
- display?: ResponsiveProp<TextDisplayProp>;
193
- }
194
-
195
- export const TextBox = forwardRef<HTMLElement, TextBoxProps>(
196
- (
197
- {
198
- variant: $variant = 'body',
199
- as = VARIANT_TYPE_MAPPING[$variant],
200
- align = 'left',
201
- color = 'primary',
202
- display = 'initial',
203
- noWrap = false,
204
- wrapOverflow = false,
205
- ...props
206
- },
207
- ref,
208
- ) => {
209
- const $align = parseResponsiveProp(align);
210
- const $color = parseResponsiveProp(color);
211
- const $noWrap = parseResponsiveProp(noWrap);
212
- const $display = parseResponsiveProp(display);
213
- const $wrapOverflow = parseResponsiveProp(wrapOverflow);
214
-
215
- return (
216
- <TextBoxRoot
217
- {...props}
218
- as={as}
219
- ref={ref}
220
- $align={$align}
221
- $color={$color}
222
- $noWrap={$noWrap}
223
- $display={$display}
224
- $variant={$variant}
225
- $wrapOverflow={$wrapOverflow}
226
- />
227
- );
228
- },
229
- );
@@ -1,24 +0,0 @@
1
- export type RuleNormalizer = (input: unknown) => string | undefined;
2
- export type RuleNormalizerRecord<T extends string = string> = Readonly<
3
- Record<T, undefined | RuleNormalizer>
4
- >;
5
-
6
- export function createRuleNormalizer<TKey extends string>(
7
- rules: Record<TKey, unknown>,
8
- ): RuleNormalizer {
9
- return (input) => {
10
- if (typeof input == 'string') {
11
- const value = rules[input as TKey];
12
-
13
- if (typeof value == 'number') {
14
- return `${value}px`;
15
- }
16
-
17
- if (typeof value == 'string') {
18
- return value;
19
- }
20
- }
21
-
22
- return undefined;
23
- };
24
- }
@@ -1,28 +0,0 @@
1
- import { CSSObject } from 'styled-components';
2
-
3
- export function mergeStyles(
4
- styles: CSSObject,
5
- ...sources: Array<null | false | undefined | CSSObject>
6
- ): CSSObject {
7
- for (const source of sources) {
8
- if (source) {
9
- for (const key in source) {
10
- if (Object.prototype.hasOwnProperty.call(source, key)) {
11
- const stylesValue = styles[key];
12
- const sourceValue = source[key];
13
-
14
- if (
15
- typeof stylesValue == 'object' &&
16
- typeof sourceValue == 'object'
17
- ) {
18
- mergeStyles(stylesValue, sourceValue);
19
- } else {
20
- styles[key] = source[key];
21
- }
22
- }
23
- }
24
- }
25
- }
26
-
27
- return styles;
28
- }
package/tsconfig.json DELETED
@@ -1,19 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.build",
3
- "exclude": [
4
- "pkg",
5
- "playroom.ts",
6
- "**/*.spec.*",
7
- "**/*.stories.*",
8
- "**/*.playroom.*",
9
- "**/__tests__/**",
10
- "**/__testutils__/**"
11
- ],
12
- "references": [{ "path": "../hooks" }, { "path": "../__testutils__" }],
13
- "compilerOptions": {
14
- "composite": true,
15
- "rootDir": "src",
16
- "outDir": "pkg/dist-types",
17
- "tsBuildInfoFile": "pkg/dist-types/.tsbuildinfo"
18
- }
19
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes