@superdispatch/ui-lab 0.14.0 → 0.15.0
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/dist-node/index.js +66 -10
- package/dist-node/index.js.map +1 -1
- package/dist-src/banner/Banner.js +61 -0
- package/dist-src/index.js +1 -0
- package/dist-types/index.d.ts +11 -1
- package/dist-web/index.js +68 -13
- package/dist-web/index.js.map +1 -1
- package/package.json +3 -3
package/dist-types/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ReactNode, ForwardRefExoticComponent, RefAttributes, Ref, AriaAttributes, MouseEventHandler, FocusEventHandler, ReactChild, MouseEvent, ReactElement } from 'react';
|
|
3
|
+
import { CSSTransition } from 'react-transition-group';
|
|
4
|
+
import { CSSTransitionProps } from 'react-transition-group/CSSTransition';
|
|
3
5
|
import { SpaceProp, NegativeSpaceProp, ResponsiveProp, ColorProp } from '@superdispatch/ui';
|
|
4
6
|
import { Property } from 'csstype';
|
|
5
7
|
import { ButtonBaseProps, TooltipProps } from '@material-ui/core';
|
|
@@ -13,6 +15,14 @@ interface AlertProps {
|
|
|
13
15
|
}
|
|
14
16
|
declare const Alert: ForwardRefExoticComponent<AlertProps & RefAttributes<HTMLDivElement>>;
|
|
15
17
|
|
|
18
|
+
declare type BorderPlacement = 'top' | 'bottom';
|
|
19
|
+
declare type CustomerTransitionProps = CSSTransitionProps<HTMLDivElement> & {
|
|
20
|
+
className?: string;
|
|
21
|
+
border?: BorderPlacement;
|
|
22
|
+
};
|
|
23
|
+
declare type BannerProps = Omit<CustomerTransitionProps, 'timeout' | 'className' | 'classNames'>;
|
|
24
|
+
declare const Banner: ForwardRefExoticComponent<Pick<BannerProps, string | number> & RefAttributes<CSSTransition<HTMLDivElement>>>;
|
|
25
|
+
|
|
16
26
|
declare type MarginProp = 'auto' | SpaceProp | NegativeSpaceProp;
|
|
17
27
|
declare type BorderRadiusProp = 'none' | 'small';
|
|
18
28
|
declare type BorderWidthProp = 'none' | 'small' | 'medium' | 'large';
|
|
@@ -216,4 +226,4 @@ interface TextBoxProps {
|
|
|
216
226
|
}
|
|
217
227
|
declare const TextBox: ForwardRefExoticComponent<TextBoxProps & RefAttributes<HTMLElement>>;
|
|
218
228
|
|
|
219
|
-
export { Alert, AlertProps, AlertSeverityProp, AnchorButton, AnchorButtonProps, BorderRadiusProp, BorderWidthProp, Box, BoxProps, Button, ButtonArea, ButtonAreaProps, ButtonProps, ButtonSizeProp, ButtonVariantProp, DescriptionItem, DescriptionItemProps, FileDropZone, FileDropZoneProps, FileListItem, FileListItemProps, MarginProp, Sidebar, SidebarContainer, SidebarContainerProps, SidebarDivider, SidebarMenuItem, SidebarMenuItemAction, SidebarMenuItemActionProps, SidebarMenuItemAvatar, SidebarMenuItemAvatarProps, SidebarMenuItemProps, SidebarProps, SidebarSubheader, SidebarSubheaderProps, TextAlignProp, TextBox, TextBoxProps, TextColorProp, TextDisplayProp, TextVariantProp, formatBytes, toBytes };
|
|
229
|
+
export { Alert, AlertProps, AlertSeverityProp, AnchorButton, AnchorButtonProps, Banner, BorderRadiusProp, BorderWidthProp, Box, BoxProps, Button, ButtonArea, ButtonAreaProps, ButtonProps, ButtonSizeProp, ButtonVariantProp, DescriptionItem, DescriptionItemProps, FileDropZone, FileDropZoneProps, FileListItem, FileListItemProps, MarginProp, Sidebar, SidebarContainer, SidebarContainerProps, SidebarDivider, SidebarMenuItem, SidebarMenuItemAction, SidebarMenuItemActionProps, SidebarMenuItemAvatar, SidebarMenuItemAvatarProps, SidebarMenuItemProps, SidebarProps, SidebarSubheader, SidebarSubheaderProps, TextAlignProp, TextBox, TextBoxProps, TextColorProp, TextDisplayProp, TextVariantProp, formatBytes, toBytes };
|
package/dist-web/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { CheckCircle, Info, Error, Image, Refresh, Delete, OpenInNew } from '@material-ui/icons';
|
|
2
2
|
import { Alert as Alert$1 } from '@material-ui/lab';
|
|
3
3
|
import { Color, parseResponsiveProp, isColorProp, parseSpaceProp, Stack, useUID, isEmptyReactNode, Columns, Column, Inline, CardButton, useResponsiveValue } from '@superdispatch/ui';
|
|
4
|
-
import { forwardRef,
|
|
5
|
-
import styled, { css } from 'styled-components';
|
|
4
|
+
import { forwardRef, useState, useEffect, Suspense, memo, useContext, createContext, useMemo, useRef, useLayoutEffect } from 'react';
|
|
5
|
+
import styled, { css, keyframes } from 'styled-components';
|
|
6
6
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
7
|
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
8
8
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
9
|
+
import { CSSTransition } from 'react-transition-group';
|
|
9
10
|
import { ButtonBase, Typography, CircularProgress, SvgIcon, Link, Tooltip, IconButton, Divider, Checkbox, Avatar } from '@material-ui/core';
|
|
10
11
|
import { mdiUpload, mdiFilePdfBox, mdiTextBox } from '@mdi/js';
|
|
11
12
|
import Dropzone from 'react-dropzone';
|
|
@@ -47,6 +48,60 @@ var Alert = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
47
48
|
});
|
|
48
49
|
if (process.env.NODE_ENV !== "production") Alert.displayName = "Alert";
|
|
49
50
|
|
|
51
|
+
var _excluded = ["children"],
|
|
52
|
+
_excluded2 = ["in"];
|
|
53
|
+
|
|
54
|
+
function enterMixin(border) {
|
|
55
|
+
return css(["min-height:56px;color:", ";background-color:", ";border-", ":1px #dfe3e8 solid;"], Color.Dark500, Color.White, border);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function enterAnimation(border) {
|
|
59
|
+
return keyframes(["0%{min-height:0;color:", ";background-color:", ";}50%{min-height:56px;color:", ";background-color:", ";}70%{min-height:56px;color:", ";background-color:", ";}100%{", "}"], Color.White, Color.Dark500, Color.White, Color.Dark500, Color.White, Color.Dark500, enterMixin(border));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
var CustomTransition = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
63
|
+
var {
|
|
64
|
+
children
|
|
65
|
+
} = _ref,
|
|
66
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
67
|
+
|
|
68
|
+
return /*#__PURE__*/jsx(CSSTransition, _objectSpread(_objectSpread({}, props), {}, {
|
|
69
|
+
ref: ref,
|
|
70
|
+
timeout: 3000,
|
|
71
|
+
classNames: props.className,
|
|
72
|
+
children: /*#__PURE__*/jsx("div", {
|
|
73
|
+
children: children
|
|
74
|
+
})
|
|
75
|
+
}));
|
|
76
|
+
});
|
|
77
|
+
if (process.env.NODE_ENV !== "production") CustomTransition.displayName = "CustomTransition";
|
|
78
|
+
var BannerContent = /*#__PURE__*/styled(CustomTransition).withConfig({
|
|
79
|
+
displayName: "Banner__BannerContent",
|
|
80
|
+
componentId: "SD__sc-9kw31n-0"
|
|
81
|
+
})(_ref2 => {
|
|
82
|
+
var {
|
|
83
|
+
border = 'bottom'
|
|
84
|
+
} = _ref2;
|
|
85
|
+
return css(["height:0;width:100%;overflow:hidden;display:flex;align-items:center;justify-content:center;color:", ";background-color:", ";&-enter-active{animation:", " 2s 1s forwards;}&-enter-done{", ";}&-exit{", ";}&-exit-active{min-height:0;transition:min-height 2s 1s;}"], Color.White, Color.White, enterAnimation(border), enterMixin(border), enterMixin(border));
|
|
86
|
+
});
|
|
87
|
+
var Banner = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
88
|
+
var {
|
|
89
|
+
in: inProp
|
|
90
|
+
} = _ref3,
|
|
91
|
+
props = _objectWithoutProperties(_ref3, _excluded2);
|
|
92
|
+
|
|
93
|
+
var [isIn, setIn] = useState(false); // transition is not triggered on initial render with `in: true`
|
|
94
|
+
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
setIn(!!inProp);
|
|
97
|
+
}, [inProp]);
|
|
98
|
+
return /*#__PURE__*/jsx(BannerContent, _objectSpread({
|
|
99
|
+
ref: ref,
|
|
100
|
+
in: isIn
|
|
101
|
+
}, props));
|
|
102
|
+
});
|
|
103
|
+
if (process.env.NODE_ENV !== "production") Banner.displayName = "Banner";
|
|
104
|
+
|
|
50
105
|
function createRuleNormalizer(rules) {
|
|
51
106
|
return input => {
|
|
52
107
|
if (typeof input == 'string') {
|
|
@@ -209,7 +264,7 @@ var Box = /*#__PURE__*/styled.div.withConfig({
|
|
|
209
264
|
return styles;
|
|
210
265
|
});
|
|
211
266
|
|
|
212
|
-
var _excluded = ["icon", "children", "variant", "active", "disabled", "fullWidth"];
|
|
267
|
+
var _excluded$1 = ["icon", "children", "variant", "active", "disabled", "fullWidth"];
|
|
213
268
|
var ButtonRoot = /*#__PURE__*/styled(ButtonBase).withConfig({
|
|
214
269
|
displayName: "ButtonArea__ButtonRoot",
|
|
215
270
|
componentId: "SD__sc-1czum63-0"
|
|
@@ -223,7 +278,7 @@ var ButtonArea = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
223
278
|
disabled,
|
|
224
279
|
fullWidth
|
|
225
280
|
} = _ref,
|
|
226
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
281
|
+
props = _objectWithoutProperties(_ref, _excluded$1);
|
|
227
282
|
|
|
228
283
|
return /*#__PURE__*/jsx(ButtonRoot, _objectSpread(_objectSpread({
|
|
229
284
|
ref: ref,
|
|
@@ -246,8 +301,8 @@ var ButtonArea = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
246
301
|
});
|
|
247
302
|
if (process.env.NODE_ENV !== "production") ButtonArea.displayName = "ButtonArea";
|
|
248
303
|
|
|
249
|
-
var _excluded$
|
|
250
|
-
_excluded2 = ["type"],
|
|
304
|
+
var _excluded$2 = ["children", "endIcon", "startIcon", "tabIndex", "active", "pending", "disabled", "size", "fullWidth", "variant"],
|
|
305
|
+
_excluded2$1 = ["type"],
|
|
251
306
|
_excluded3 = ["href", "target"];
|
|
252
307
|
|
|
253
308
|
function createButtonVariables(size, _ref) {
|
|
@@ -406,7 +461,7 @@ function useButtonProps(_ref3) {
|
|
|
406
461
|
fullWidth = false,
|
|
407
462
|
variant = 'default'
|
|
408
463
|
} = _ref3,
|
|
409
|
-
props = _objectWithoutProperties(_ref3, _excluded$
|
|
464
|
+
props = _objectWithoutProperties(_ref3, _excluded$2);
|
|
410
465
|
|
|
411
466
|
var disabled = pending || disabledProp;
|
|
412
467
|
var tabIndex = disabled ? -1 : tabIndexProp;
|
|
@@ -438,7 +493,7 @@ var Button = /*#__PURE__*/forwardRef((_ref4, ref) => {
|
|
|
438
493
|
var {
|
|
439
494
|
type = 'button'
|
|
440
495
|
} = _ref4,
|
|
441
|
-
props = _objectWithoutProperties(_ref4, _excluded2);
|
|
496
|
+
props = _objectWithoutProperties(_ref4, _excluded2$1);
|
|
442
497
|
|
|
443
498
|
var buttonProps = useButtonProps(props);
|
|
444
499
|
return /*#__PURE__*/jsx(ButtonRoot$1, _objectSpread(_objectSpread({}, buttonProps), {}, {
|
|
@@ -491,7 +546,7 @@ function mergeStyles(styles) {
|
|
|
491
546
|
return styles;
|
|
492
547
|
}
|
|
493
548
|
|
|
494
|
-
var _excluded$
|
|
549
|
+
var _excluded$3 = ["variant", "as", "align", "color", "display", "noWrap", "wrapOverflow"];
|
|
495
550
|
var normalizeTextColor = /*#__PURE__*/createRuleNormalizer({
|
|
496
551
|
inherit: 'inherit',
|
|
497
552
|
primary: Color.Dark500,
|
|
@@ -593,7 +648,7 @@ var TextBox = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
|
593
648
|
noWrap = false,
|
|
594
649
|
wrapOverflow = false
|
|
595
650
|
} = _ref3,
|
|
596
|
-
props = _objectWithoutProperties(_ref3, _excluded$
|
|
651
|
+
props = _objectWithoutProperties(_ref3, _excluded$3);
|
|
597
652
|
|
|
598
653
|
var $align = parseResponsiveProp(align);
|
|
599
654
|
var $color = parseResponsiveProp(color);
|
|
@@ -674,7 +729,7 @@ var DescriptionItem = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
674
729
|
});
|
|
675
730
|
if (process.env.NODE_ENV !== "production") DescriptionItem.displayName = "DescriptionItem";
|
|
676
731
|
|
|
677
|
-
var _excluded$
|
|
732
|
+
var _excluded$4 = ["disabled", "children", "hintText", "startIcon", "fallback", "accept", "maxSize", "maxFiles", "onDropRejected", "onDropAccepted"];
|
|
678
733
|
function toBytes(input, unit) {
|
|
679
734
|
if (unit === 'gb') return input * (1 << 30);
|
|
680
735
|
if (unit === 'mb') return input * (1 << 20);
|
|
@@ -745,7 +800,7 @@ var FileDropZone = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
745
800
|
onDropRejected: _onDropRejected,
|
|
746
801
|
onDropAccepted: _onDropAccepted
|
|
747
802
|
} = props,
|
|
748
|
-
dropzoneProps = _objectWithoutProperties(props, _excluded$
|
|
803
|
+
dropzoneProps = _objectWithoutProperties(props, _excluded$4);
|
|
749
804
|
|
|
750
805
|
return /*#__PURE__*/jsx(Suspense, {
|
|
751
806
|
fallback: fallback,
|
|
@@ -1232,5 +1287,5 @@ var SidebarSubheader = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
1232
1287
|
});
|
|
1233
1288
|
if (process.env.NODE_ENV !== "production") SidebarSubheader.displayName = "SidebarSubheader";
|
|
1234
1289
|
|
|
1235
|
-
export { Alert, AnchorButton, Box, Button, ButtonArea, DescriptionItem, FileDropZone, FileListItem, Sidebar, SidebarContainer, SidebarDivider, SidebarMenuItem, SidebarMenuItemAction, SidebarMenuItemAvatar, SidebarSubheader, TextBox, formatBytes, toBytes };
|
|
1290
|
+
export { Alert, AnchorButton, Banner, Box, Button, ButtonArea, DescriptionItem, FileDropZone, FileListItem, Sidebar, SidebarContainer, SidebarDivider, SidebarMenuItem, SidebarMenuItemAction, SidebarMenuItemAvatar, SidebarSubheader, TextBox, formatBytes, toBytes };
|
|
1236
1291
|
//# sourceMappingURL=index.js.map
|