@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
@@ -1,238 +0,0 @@
1
- import {
2
- ColorDynamic,
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
- | 'light-gray' //*deprecated use disabled instead
19
- | 'disabled'
20
- | 'white'
21
- | 'blue'
22
- | 'green'
23
- | 'purple'
24
- | 'red'
25
- | 'teal'
26
- | 'yellow';
27
- export type TextDisplayProp =
28
- | 'none'
29
- | 'block'
30
- | 'inline'
31
- | 'initial'
32
- | 'inherit';
33
-
34
- const normalizeTextColor = createRuleNormalizer<TextColorProp>({
35
- inherit: 'inherit',
36
- primary: ColorDynamic.Dark500,
37
- secondary: ColorDynamic.Dark300,
38
- 'light-gray': ColorDynamic.Dark100, //*deprecated use disabled instead
39
- disabled: ColorDynamic.Dark100,
40
- white: ColorDynamic.White,
41
- blue: ColorDynamic.Blue500,
42
- green: ColorDynamic.Green500,
43
- purple: ColorDynamic.Purple500,
44
- red: ColorDynamic.Red500,
45
- teal: ColorDynamic.Teal500,
46
- yellow: ColorDynamic.Yellow500,
47
- });
48
-
49
- export type TextVariantProp =
50
- | 'heading-1'
51
- | 'heading-2'
52
- | 'heading-3'
53
- | 'heading-4'
54
- | 'heading-5'
55
- | 'heading-6'
56
- | 'body'
57
- | 'body-block'
58
- | 'body-semibold'
59
- | 'caption'
60
- | 'hint';
61
-
62
- const VARIANT_TYPE_MAPPING: Record<
63
- TextVariantProp,
64
- undefined | keyof JSX.IntrinsicElements
65
- > = {
66
- 'heading-1': 'h1',
67
- 'heading-2': 'h2',
68
- 'heading-3': 'h3',
69
- 'heading-4': 'h4',
70
- 'heading-5': 'h5',
71
- 'heading-6': 'h6',
72
-
73
- body: 'span',
74
- 'body-block': 'p',
75
- 'body-semibold': 'span',
76
- caption: 'span',
77
- hint: 'span',
78
- };
79
-
80
- function variantMixin(
81
- { typography, breakpoints }: SuperDispatchTheme,
82
- variant: TextVariantProp,
83
- ): CSSObject {
84
- switch (variant) {
85
- case 'heading-1':
86
- return typography.h1 as CSSObject;
87
- case 'heading-2':
88
- return typography.h2 as CSSObject;
89
- case 'heading-3':
90
- return typography.h3 as CSSObject;
91
- case 'heading-4':
92
- return typography.h4 as CSSObject;
93
- case 'heading-5':
94
- return typography.h5 as CSSObject;
95
- case 'heading-6':
96
- return typography.h6 as CSSObject;
97
- case 'body':
98
- default:
99
- return typography.body2 as CSSObject;
100
- case 'body-block': {
101
- return mergeStyles({}, typography.body2 as CSSObject, {
102
- lineHeight: '24px',
103
- [breakpoints.only('xs')]: { lineHeight: '28px' },
104
- });
105
- }
106
- case 'body-semibold':
107
- return typography.body1 as CSSObject;
108
- case 'caption':
109
- return typography.caption as CSSObject;
110
- case 'hint':
111
- return mergeStyles({}, typography.caption as CSSObject, {
112
- lineHeight: '20px',
113
- fontSize: '13px',
114
- });
115
- }
116
- }
117
-
118
- function textBoxMixin(
119
- noWrap: boolean,
120
- align: TextAlignProp,
121
- color: TextColorProp,
122
- display: TextDisplayProp,
123
- wrapOverflow: boolean,
124
- ): readonly SimpleInterpolation[] {
125
- return css`
126
- text-align: ${align};
127
- color: ${normalizeTextColor(color)};
128
- display: ${display === 'initial' && (noWrap || align !== 'left')
129
- ? 'block'
130
- : display};
131
- overflow: ${noWrap ? 'hidden' : 'visible'};
132
- white-space: ${noWrap ? 'nowrap' : 'normal'};
133
- overflow-wrap: ${wrapOverflow ? 'break-word' : 'normal'};
134
- `;
135
- }
136
-
137
- interface TextBoxRootProps {
138
- $variant: TextVariantProp;
139
- $noWrap: ResponsivePropTuple<boolean>;
140
- $wrapOverflow: ResponsivePropTuple<boolean>;
141
- $align: ResponsivePropTuple<TextAlignProp>;
142
- $color: ResponsivePropTuple<TextColorProp>;
143
- $display: ResponsivePropTuple<TextDisplayProp>;
144
- }
145
-
146
- const TextBoxRoot = styled.span<TextBoxRootProps>(
147
- ({ theme, $noWrap, $variant, $align, $color, $display, $wrapOverflow }) =>
148
- css`
149
- margin: 0;
150
- padding: 0;
151
- text-overflow: ellipsis;
152
-
153
- ${variantMixin(theme, $variant)};
154
-
155
- ${textBoxMixin(
156
- $noWrap[0],
157
- $align[0],
158
- $color[0],
159
- $display[0],
160
- $wrapOverflow[0],
161
- )};
162
-
163
- ${theme.breakpoints.up('sm')} {
164
- ${textBoxMixin(
165
- $noWrap[1],
166
- $align[1],
167
- $color[1],
168
- $display[1],
169
- $wrapOverflow[1],
170
- )};
171
- }
172
-
173
- ${theme.breakpoints.up('md')} {
174
- ${textBoxMixin(
175
- $noWrap[2],
176
- $align[2],
177
- $color[2],
178
- $display[2],
179
- $wrapOverflow[2],
180
- )};
181
- }
182
- `,
183
- );
184
-
185
- export interface TextBoxProps {
186
- children?: ReactNode;
187
- as?: keyof JSX.IntrinsicElements;
188
-
189
- id?: string;
190
- 'aria-label'?: string;
191
- 'aria-labelledby'?: string;
192
- 'aria-describedby'?: string;
193
-
194
- variant?: TextVariantProp;
195
-
196
- noWrap?: ResponsiveProp<boolean>;
197
- wrapOverflow?: ResponsiveProp<boolean>;
198
-
199
- align?: ResponsiveProp<TextAlignProp>;
200
- color?: ResponsiveProp<TextColorProp>;
201
- display?: ResponsiveProp<TextDisplayProp>;
202
- }
203
-
204
- export const TextBox = forwardRef<HTMLElement, TextBoxProps>(
205
- (
206
- {
207
- variant: $variant = 'body',
208
- as = VARIANT_TYPE_MAPPING[$variant],
209
- align = 'left',
210
- color = 'primary',
211
- display = 'initial',
212
- noWrap = false,
213
- wrapOverflow = false,
214
- ...props
215
- },
216
- ref,
217
- ) => {
218
- const $align = parseResponsiveProp(align);
219
- const $color = parseResponsiveProp(color);
220
- const $noWrap = parseResponsiveProp(noWrap);
221
- const $display = parseResponsiveProp(display);
222
- const $wrapOverflow = parseResponsiveProp(wrapOverflow);
223
-
224
- return (
225
- <TextBoxRoot
226
- {...props}
227
- as={as}
228
- ref={ref}
229
- $align={$align}
230
- $color={$color}
231
- $noWrap={$noWrap}
232
- $display={$display}
233
- $variant={$variant}
234
- $wrapOverflow={$wrapOverflow}
235
- />
236
- );
237
- },
238
- );
@@ -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
File without changes
File without changes