@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.
- package/LICENSE +21 -0
- package/package.json +14 -39
- package/.babelrc.js +0 -5
- package/pkg/README.md +0 -10
- package/pkg/package.json +0 -41
- package/playroom.ts +0 -24
- package/src/alert/Alert.stories.tsx +0 -162
- package/src/alert/Alert.tsx +0 -135
- package/src/banner/Banner.stories.tsx +0 -64
- package/src/banner/Banner.tsx +0 -120
- package/src/box/Box.stories.tsx +0 -20
- package/src/box/Box.tsx +0 -257
- package/src/button/Button.stories.tsx +0 -739
- package/src/button/Button.tsx +0 -498
- package/src/button-area/ButtonArea.stories.tsx +0 -65
- package/src/button-area/ButtonArea.tsx +0 -90
- package/src/chat/Chat.stories.tsx +0 -130
- package/src/chat/Chat.tsx +0 -57
- package/src/chat/ChatMessage.tsx +0 -45
- package/src/chat/README.MD +0 -7
- package/src/chat/__tests__/Chat.spec.tsx +0 -29
- package/src/chat/__tests__/ChatMessage.spec.tsx +0 -39
- package/src/container/Container.tsx +0 -48
- package/src/description-item/DescriptionItem.stories.tsx +0 -163
- package/src/description-item/DescriptionItem.tsx +0 -104
- package/src/description-line-item/DescriptionLineItem.stories.tsx +0 -23
- package/src/description-line-item/DescriptionLineItem.tsx +0 -29
- package/src/email-autocomplate/CloseIcon.tsx +0 -20
- package/src/email-autocomplate/EmailAutocomplete.stories.tsx +0 -47
- package/src/email-autocomplate/EmailAutocomplete.tsx +0 -138
- package/src/file-drop-zone/FileDropZone.stories.tsx +0 -44
- package/src/file-drop-zone/FileDropZone.tsx +0 -170
- package/src/file-list-item/FileListItem.stories.tsx +0 -37
- package/src/file-list-item/FileListItem.tsx +0 -148
- package/src/file-list-item/__tests__/FileListItem.spec.tsx +0 -339
- package/src/flag-list/FlagList.stories.tsx +0 -72
- package/src/flag-list/FlagList.tsx +0 -54
- package/src/flag-list/FlagListItem.tsx +0 -126
- package/src/index.spec.ts +0 -53
- package/src/index.ts +0 -36
- package/src/linked-text/LinkeText.stories.tsx +0 -42
- package/src/linked-text/LinkedText.tsx +0 -47
- package/src/multiline-text/MultilineText.stories.tsx +0 -30
- package/src/multiline-text/MultilineText.ts +0 -16
- package/src/navbar/Navbar.stories.tsx +0 -137
- package/src/navbar/Navbar.tsx +0 -132
- package/src/navbar/NavbarAccordion.tsx +0 -195
- package/src/navbar/NavbarAvatar.tsx +0 -51
- package/src/navbar/NavbarBottomBar.tsx +0 -135
- package/src/navbar/NavbarContext.tsx +0 -22
- package/src/navbar/NavbarItem.tsx +0 -125
- package/src/navbar/NavbarList.tsx +0 -247
- package/src/navbar/NavbarMenu.tsx +0 -102
- package/src/passwordStepper/PasswordStrength.stories.tsx +0 -95
- package/src/passwordStepper/PasswordStrength.tsx +0 -107
- package/src/passwordStepper/PasswordUtils.tsx +0 -42
- package/src/passwordStepper/PasswordValidationComponents.tsx +0 -95
- package/src/sidebar/Sidebar.stories.tsx +0 -376
- package/src/sidebar/Sidebar.tsx +0 -75
- package/src/sidebar/SidebarBackButton.tsx +0 -33
- package/src/sidebar/SidebarContainer.tsx +0 -114
- package/src/sidebar/SidebarContent.tsx +0 -119
- package/src/sidebar/SidebarDivider.tsx +0 -15
- package/src/sidebar/SidebarMenuItem.tsx +0 -196
- package/src/sidebar/SidebarMenuItemAction.tsx +0 -27
- package/src/sidebar/SidebarMenuItemAvatar.tsx +0 -59
- package/src/sidebar/SidebarMenuItemContext.tsx +0 -33
- package/src/sidebar/SidebarSubheader.tsx +0 -38
- package/src/styled.d.ts +0 -12
- package/src/text-box/TextBox.stories.tsx +0 -114
- package/src/text-box/TextBox.tsx +0 -238
- package/src/utils/RuleNormalizer.ts +0 -24
- package/src/utils/mergeStyles.ts +0 -28
- package/tsconfig.json +0 -19
- /package/{pkg/dist-node → dist-node}/index.js +0 -0
- /package/{pkg/dist-node → dist-node}/index.js.map +0 -0
- /package/{pkg/dist-src → dist-src}/alert/Alert.js +0 -0
- /package/{pkg/dist-src → dist-src}/banner/Banner.js +0 -0
- /package/{pkg/dist-src → dist-src}/box/Box.js +0 -0
- /package/{pkg/dist-src → dist-src}/button/Button.js +0 -0
- /package/{pkg/dist-src → dist-src}/button-area/ButtonArea.js +0 -0
- /package/{pkg/dist-src → dist-src}/chat/Chat.js +0 -0
- /package/{pkg/dist-src → dist-src}/chat/ChatMessage.js +0 -0
- /package/{pkg/dist-src → dist-src}/container/Container.js +0 -0
- /package/{pkg/dist-src → dist-src}/description-item/DescriptionItem.js +0 -0
- /package/{pkg/dist-src → dist-src}/description-line-item/DescriptionLineItem.js +0 -0
- /package/{pkg/dist-src → dist-src}/email-autocomplate/CloseIcon.js +0 -0
- /package/{pkg/dist-src → dist-src}/email-autocomplate/EmailAutocomplete.js +0 -0
- /package/{pkg/dist-src → dist-src}/file-drop-zone/FileDropZone.js +0 -0
- /package/{pkg/dist-src → dist-src}/file-list-item/FileListItem.js +0 -0
- /package/{pkg/dist-src → dist-src}/flag-list/FlagList.js +0 -0
- /package/{pkg/dist-src → dist-src}/flag-list/FlagListItem.js +0 -0
- /package/{pkg/dist-src → dist-src}/index.js +0 -0
- /package/{pkg/dist-src → dist-src}/linked-text/LinkedText.js +0 -0
- /package/{pkg/dist-src → dist-src}/multiline-text/MultilineText.js +0 -0
- /package/{pkg/dist-src → dist-src}/navbar/Navbar.js +0 -0
- /package/{pkg/dist-src → dist-src}/navbar/NavbarAccordion.js +0 -0
- /package/{pkg/dist-src → dist-src}/navbar/NavbarAvatar.js +0 -0
- /package/{pkg/dist-src → dist-src}/navbar/NavbarBottomBar.js +0 -0
- /package/{pkg/dist-src → dist-src}/navbar/NavbarContext.js +0 -0
- /package/{pkg/dist-src → dist-src}/navbar/NavbarItem.js +0 -0
- /package/{pkg/dist-src → dist-src}/navbar/NavbarList.js +0 -0
- /package/{pkg/dist-src → dist-src}/navbar/NavbarMenu.js +0 -0
- /package/{pkg/dist-src → dist-src}/passwordStepper/PasswordStrength.js +0 -0
- /package/{pkg/dist-src → dist-src}/passwordStepper/PasswordUtils.js +0 -0
- /package/{pkg/dist-src → dist-src}/passwordStepper/PasswordValidationComponents.js +0 -0
- /package/{pkg/dist-src → dist-src}/sidebar/Sidebar.js +0 -0
- /package/{pkg/dist-src → dist-src}/sidebar/SidebarBackButton.js +0 -0
- /package/{pkg/dist-src → dist-src}/sidebar/SidebarContainer.js +0 -0
- /package/{pkg/dist-src → dist-src}/sidebar/SidebarContent.js +0 -0
- /package/{pkg/dist-src → dist-src}/sidebar/SidebarDivider.js +0 -0
- /package/{pkg/dist-src → dist-src}/sidebar/SidebarMenuItem.js +0 -0
- /package/{pkg/dist-src → dist-src}/sidebar/SidebarMenuItemAction.js +0 -0
- /package/{pkg/dist-src → dist-src}/sidebar/SidebarMenuItemAvatar.js +0 -0
- /package/{pkg/dist-src → dist-src}/sidebar/SidebarMenuItemContext.js +0 -0
- /package/{pkg/dist-src → dist-src}/sidebar/SidebarSubheader.js +0 -0
- /package/{pkg/dist-src → dist-src}/text-box/TextBox.js +0 -0
- /package/{pkg/dist-src → dist-src}/utils/RuleNormalizer.js +0 -0
- /package/{pkg/dist-src → dist-src}/utils/mergeStyles.js +0 -0
- /package/{pkg/dist-types → dist-types}/index.d.ts +0 -0
- /package/{pkg/dist-web → dist-web}/index.js +0 -0
- /package/{pkg/dist-web → dist-web}/index.js.map +0 -0
package/src/box/Box.tsx
DELETED
|
@@ -1,257 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ColorDynamic,
|
|
3
|
-
ColorProp,
|
|
4
|
-
isColorDynamicProp,
|
|
5
|
-
NegativeSpaceProp,
|
|
6
|
-
parseResponsiveProp,
|
|
7
|
-
parseSpaceProp,
|
|
8
|
-
ResponsiveProp,
|
|
9
|
-
SpaceProp,
|
|
10
|
-
} from '@superdispatch/ui';
|
|
11
|
-
import { Property } from 'csstype';
|
|
12
|
-
import { ForwardRefExoticComponent, ReactNode, Ref } from 'react';
|
|
13
|
-
import styled, { CSSObject } from 'styled-components';
|
|
14
|
-
import { createRuleNormalizer, RuleNormalizer } from '../utils/RuleNormalizer';
|
|
15
|
-
|
|
16
|
-
//
|
|
17
|
-
// Colors
|
|
18
|
-
//
|
|
19
|
-
|
|
20
|
-
function normalizeColor(input: unknown): string | undefined {
|
|
21
|
-
return isColorDynamicProp(input) ? ColorDynamic[input] : undefined;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
//
|
|
25
|
-
// Space
|
|
26
|
-
//
|
|
27
|
-
|
|
28
|
-
function parseSpace(space: unknown): string {
|
|
29
|
-
return `${parseSpaceProp(space as SpaceProp)}px`;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
//
|
|
33
|
-
// Margins
|
|
34
|
-
//
|
|
35
|
-
|
|
36
|
-
export type MarginProp = 'auto' | SpaceProp | NegativeSpaceProp;
|
|
37
|
-
function parseMargin(input: unknown): string {
|
|
38
|
-
if (input === 'auto') return input;
|
|
39
|
-
|
|
40
|
-
let prefix = '';
|
|
41
|
-
|
|
42
|
-
if (typeof input == 'string' && input.startsWith('-')) {
|
|
43
|
-
prefix = '-';
|
|
44
|
-
input = input.slice(1);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return prefix + parseSpace(input);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
//
|
|
51
|
-
// Borders
|
|
52
|
-
//
|
|
53
|
-
|
|
54
|
-
export type BorderRadiusProp = 'none' | 'small' | 'medium';
|
|
55
|
-
const normalizeBorderRadius = createRuleNormalizer<BorderRadiusProp>({
|
|
56
|
-
none: 0,
|
|
57
|
-
small: 4,
|
|
58
|
-
medium: 8,
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
export type BorderWidthProp = 'none' | 'small' | 'medium' | 'large';
|
|
62
|
-
const normalizeBorderWidth = createRuleNormalizer<BorderWidthProp>({
|
|
63
|
-
none: 0,
|
|
64
|
-
small: 1,
|
|
65
|
-
medium: 2,
|
|
66
|
-
large: 4,
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
//
|
|
70
|
-
// Rules
|
|
71
|
-
//
|
|
72
|
-
|
|
73
|
-
interface BoxRules {
|
|
74
|
-
display?: ResponsiveProp<Property.Display>;
|
|
75
|
-
|
|
76
|
-
alignItems?: ResponsiveProp<Property.AlignItems>;
|
|
77
|
-
justifyContent?: ResponsiveProp<Property.JustifyContent>;
|
|
78
|
-
color?: ResponsiveProp<ColorProp>;
|
|
79
|
-
backgroundColor?: ResponsiveProp<ColorProp>;
|
|
80
|
-
|
|
81
|
-
borderColor?: ResponsiveProp<ColorProp>;
|
|
82
|
-
borderTopColor?: ResponsiveProp<ColorProp>;
|
|
83
|
-
borderLeftColor?: ResponsiveProp<ColorProp>;
|
|
84
|
-
borderRightColor?: ResponsiveProp<ColorProp>;
|
|
85
|
-
borderBottomColor?: ResponsiveProp<ColorProp>;
|
|
86
|
-
|
|
87
|
-
borderWidth?: ResponsiveProp<BorderWidthProp>;
|
|
88
|
-
borderTopWidth?: ResponsiveProp<BorderWidthProp>;
|
|
89
|
-
borderLeftWidth?: ResponsiveProp<BorderWidthProp>;
|
|
90
|
-
borderRightWidth?: ResponsiveProp<BorderWidthProp>;
|
|
91
|
-
borderBottomWidth?: ResponsiveProp<BorderWidthProp>;
|
|
92
|
-
|
|
93
|
-
padding?: ResponsiveProp<SpaceProp>;
|
|
94
|
-
paddingTop?: ResponsiveProp<SpaceProp>;
|
|
95
|
-
paddingLeft?: ResponsiveProp<SpaceProp>;
|
|
96
|
-
paddingRight?: ResponsiveProp<SpaceProp>;
|
|
97
|
-
paddingBottom?: ResponsiveProp<SpaceProp>;
|
|
98
|
-
|
|
99
|
-
margin?: ResponsiveProp<MarginProp>;
|
|
100
|
-
marginTop?: ResponsiveProp<MarginProp>;
|
|
101
|
-
marginLeft?: ResponsiveProp<MarginProp>;
|
|
102
|
-
marginRight?: ResponsiveProp<MarginProp>;
|
|
103
|
-
marginBottom?: ResponsiveProp<MarginProp>;
|
|
104
|
-
|
|
105
|
-
borderRadius?: ResponsiveProp<BorderRadiusProp>;
|
|
106
|
-
borderTopLeftRadius?: ResponsiveProp<BorderRadiusProp>;
|
|
107
|
-
borderTopRightRadius?: ResponsiveProp<BorderRadiusProp>;
|
|
108
|
-
borderBottomLeftRadius?: ResponsiveProp<BorderRadiusProp>;
|
|
109
|
-
borderBottomRightRadius?: ResponsiveProp<BorderRadiusProp>;
|
|
110
|
-
|
|
111
|
-
fontSize?: ResponsiveProp<Property.FontSize>;
|
|
112
|
-
|
|
113
|
-
width?: ResponsiveProp<Property.Width>;
|
|
114
|
-
maxWidth?: ResponsiveProp<Property.MaxWidth>;
|
|
115
|
-
minWidth?: ResponsiveProp<Property.MinWidth>;
|
|
116
|
-
|
|
117
|
-
height?: ResponsiveProp<Property.Height>;
|
|
118
|
-
maxHeight?: ResponsiveProp<Property.MaxHeight>;
|
|
119
|
-
minHeight?: ResponsiveProp<Property.MinHeight>;
|
|
120
|
-
|
|
121
|
-
overflow?: ResponsiveProp<Property.Overflow>;
|
|
122
|
-
overflowY?: ResponsiveProp<Property.OverflowY>;
|
|
123
|
-
overflowX?: ResponsiveProp<Property.OverflowX>;
|
|
124
|
-
|
|
125
|
-
top?: ResponsiveProp<Property.Top>;
|
|
126
|
-
left?: ResponsiveProp<Property.Left>;
|
|
127
|
-
right?: ResponsiveProp<Property.Right>;
|
|
128
|
-
bottom?: ResponsiveProp<Property.Bottom>;
|
|
129
|
-
position?: ResponsiveProp<Property.Position>;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
const normalizers: Record<keyof BoxRules, undefined | RuleNormalizer> = {
|
|
133
|
-
display: undefined,
|
|
134
|
-
|
|
135
|
-
color: normalizeColor,
|
|
136
|
-
backgroundColor: normalizeColor,
|
|
137
|
-
|
|
138
|
-
borderColor: normalizeColor,
|
|
139
|
-
borderTopColor: normalizeColor,
|
|
140
|
-
borderLeftColor: normalizeColor,
|
|
141
|
-
borderRightColor: normalizeColor,
|
|
142
|
-
borderBottomColor: normalizeColor,
|
|
143
|
-
|
|
144
|
-
borderWidth: normalizeBorderWidth,
|
|
145
|
-
borderTopWidth: normalizeBorderWidth,
|
|
146
|
-
borderLeftWidth: normalizeBorderWidth,
|
|
147
|
-
borderRightWidth: normalizeBorderWidth,
|
|
148
|
-
borderBottomWidth: normalizeBorderWidth,
|
|
149
|
-
|
|
150
|
-
margin: parseMargin,
|
|
151
|
-
marginTop: parseMargin,
|
|
152
|
-
marginLeft: parseMargin,
|
|
153
|
-
marginRight: parseMargin,
|
|
154
|
-
marginBottom: parseMargin,
|
|
155
|
-
|
|
156
|
-
padding: parseSpace,
|
|
157
|
-
paddingTop: parseSpace,
|
|
158
|
-
paddingLeft: parseSpace,
|
|
159
|
-
paddingRight: parseSpace,
|
|
160
|
-
paddingBottom: parseSpace,
|
|
161
|
-
|
|
162
|
-
borderRadius: normalizeBorderRadius,
|
|
163
|
-
borderTopLeftRadius: normalizeBorderRadius,
|
|
164
|
-
borderTopRightRadius: normalizeBorderRadius,
|
|
165
|
-
borderBottomLeftRadius: normalizeBorderRadius,
|
|
166
|
-
borderBottomRightRadius: normalizeBorderRadius,
|
|
167
|
-
|
|
168
|
-
fontSize: undefined,
|
|
169
|
-
|
|
170
|
-
width: undefined,
|
|
171
|
-
maxWidth: undefined,
|
|
172
|
-
minWidth: undefined,
|
|
173
|
-
|
|
174
|
-
height: undefined,
|
|
175
|
-
maxHeight: undefined,
|
|
176
|
-
minHeight: undefined,
|
|
177
|
-
|
|
178
|
-
overflow: undefined,
|
|
179
|
-
overflowY: undefined,
|
|
180
|
-
overflowX: undefined,
|
|
181
|
-
|
|
182
|
-
top: undefined,
|
|
183
|
-
left: undefined,
|
|
184
|
-
right: undefined,
|
|
185
|
-
bottom: undefined,
|
|
186
|
-
position: undefined,
|
|
187
|
-
|
|
188
|
-
alignItems: undefined,
|
|
189
|
-
justifyContent: undefined,
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
function injectRule(
|
|
193
|
-
styles: CSSObject,
|
|
194
|
-
key: string,
|
|
195
|
-
breakpoint: string,
|
|
196
|
-
value: unknown,
|
|
197
|
-
normalizer: undefined | RuleNormalizer,
|
|
198
|
-
): void {
|
|
199
|
-
if (normalizer != null) value = normalizer(value);
|
|
200
|
-
|
|
201
|
-
if (value != null) {
|
|
202
|
-
let rules = styles[breakpoint];
|
|
203
|
-
|
|
204
|
-
if (typeof rules != 'object') {
|
|
205
|
-
rules = {};
|
|
206
|
-
styles[breakpoint] = rules;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
rules[key] = String(value);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
//
|
|
214
|
-
// Box
|
|
215
|
-
//
|
|
216
|
-
|
|
217
|
-
export interface BoxProps extends BoxRules {
|
|
218
|
-
ref?: Ref<unknown>;
|
|
219
|
-
as?: keyof JSX.IntrinsicElements;
|
|
220
|
-
|
|
221
|
-
role?: string;
|
|
222
|
-
children?: ReactNode;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
export const Box: ForwardRefExoticComponent<BoxProps> = styled.div<BoxProps>(
|
|
226
|
-
(props) => {
|
|
227
|
-
const { breakpoints } = props.theme;
|
|
228
|
-
const xs = breakpoints.up('xs');
|
|
229
|
-
const sm = breakpoints.up('sm');
|
|
230
|
-
const md = breakpoints.up('md');
|
|
231
|
-
|
|
232
|
-
const styles: CSSObject = {
|
|
233
|
-
margin: 0,
|
|
234
|
-
padding: 0,
|
|
235
|
-
borderWidth: 0,
|
|
236
|
-
borderStyle: 'solid',
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
for (const k in props) {
|
|
240
|
-
if (Object.prototype.hasOwnProperty.call(props, k) && k in normalizers) {
|
|
241
|
-
const key = k as keyof BoxRules;
|
|
242
|
-
const prop = props[key];
|
|
243
|
-
|
|
244
|
-
if (prop != null) {
|
|
245
|
-
const [mobile, tablet, desktop] = parseResponsiveProp(prop);
|
|
246
|
-
|
|
247
|
-
const normalizer = normalizers[key];
|
|
248
|
-
injectRule(styles, key, xs, mobile, normalizer);
|
|
249
|
-
injectRule(styles, key, sm, tablet, normalizer);
|
|
250
|
-
injectRule(styles, key, md, desktop, normalizer);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
return styles;
|
|
256
|
-
},
|
|
257
|
-
);
|