@superdispatch/ui-lab 0.13.0 → 0.17.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.
@@ -7,7 +7,7 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
7
7
  var SidebarSubheaderRoot = /*#__PURE__*/styled.div.withConfig({
8
8
  displayName: "SidebarSubheader__SidebarSubheaderRoot",
9
9
  componentId: "SD__sc-1r0xx76-0"
10
- })(["height:40px;max-height:40px;padding-left:24px;padding-right:24px;"]);
10
+ })(["display:flex;align-items:center;height:40px;max-height:40px;padding-left:24px;padding-right:24px;"]);
11
11
  export var SidebarSubheader = /*#__PURE__*/forwardRef((_ref, ref) => {
12
12
  var {
13
13
  id,
@@ -18,6 +18,7 @@ export var SidebarSubheader = /*#__PURE__*/forwardRef((_ref, ref) => {
18
18
  ref: ref,
19
19
  children: /*#__PURE__*/_jsxs(Columns, {
20
20
  space: "xsmall",
21
+ align: "center",
21
22
  children: [/*#__PURE__*/_jsx(Column, {
22
23
  children: /*#__PURE__*/_jsx(TextBox, {
23
24
  id: id,
@@ -8,6 +8,7 @@ import { mergeStyles } from "../utils/mergeStyles.js";
8
8
  import { createRuleNormalizer } from "../utils/RuleNormalizer.js";
9
9
  import { jsx as _jsx } from "react/jsx-runtime";
10
10
  var normalizeTextColor = /*#__PURE__*/createRuleNormalizer({
11
+ inherit: 'inherit',
11
12
  primary: Color.Dark500,
12
13
  secondary: Color.Dark200,
13
14
  white: Color.White,
@@ -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';
@@ -197,7 +207,7 @@ interface SidebarSubheaderProps {
197
207
  declare const SidebarSubheader: ForwardRefExoticComponent<SidebarSubheaderProps & RefAttributes<HTMLDivElement>>;
198
208
 
199
209
  declare type TextAlignProp = 'left' | 'right' | 'center';
200
- declare type TextColorProp = 'primary' | 'secondary' | 'white' | 'blue' | 'green' | 'purple' | 'red' | 'teal' | 'yellow';
210
+ declare type TextColorProp = 'inherit' | 'primary' | 'secondary' | 'white' | 'blue' | 'green' | 'purple' | 'red' | 'teal' | 'yellow';
201
211
  declare type TextDisplayProp = 'none' | 'block' | 'inline' | 'initial' | 'inherit';
202
212
  declare type TextVariantProp = 'heading-1' | 'heading-2' | 'heading-3' | 'heading-4' | 'heading-5' | 'heading-6' | 'body' | 'body-block' | 'body-semibold' | 'caption';
203
213
  interface TextBoxProps {
@@ -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, Suspense, useState, memo, useContext, createContext, useMemo, useRef, useLayoutEffect } from 'react';
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$1 = ["children", "endIcon", "startIcon", "tabIndex", "active", "pending", "disabled", "size", "fullWidth", "variant"],
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$1);
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,8 +546,9 @@ function mergeStyles(styles) {
491
546
  return styles;
492
547
  }
493
548
 
494
- var _excluded$2 = ["variant", "as", "align", "color", "display", "noWrap", "wrapOverflow"];
549
+ var _excluded$3 = ["variant", "as", "align", "color", "display", "noWrap", "wrapOverflow"];
495
550
  var normalizeTextColor = /*#__PURE__*/createRuleNormalizer({
551
+ inherit: 'inherit',
496
552
  primary: Color.Dark500,
497
553
  secondary: Color.Dark200,
498
554
  white: Color.White,
@@ -592,7 +648,7 @@ var TextBox = /*#__PURE__*/forwardRef((_ref3, ref) => {
592
648
  noWrap = false,
593
649
  wrapOverflow = false
594
650
  } = _ref3,
595
- props = _objectWithoutProperties(_ref3, _excluded$2);
651
+ props = _objectWithoutProperties(_ref3, _excluded$3);
596
652
 
597
653
  var $align = parseResponsiveProp(align);
598
654
  var $color = parseResponsiveProp(color);
@@ -673,7 +729,7 @@ var DescriptionItem = /*#__PURE__*/forwardRef((_ref2, ref) => {
673
729
  });
674
730
  if (process.env.NODE_ENV !== "production") DescriptionItem.displayName = "DescriptionItem";
675
731
 
676
- var _excluded$3 = ["disabled", "children", "hintText", "startIcon", "fallback", "accept", "maxSize", "maxFiles", "onDropRejected", "onDropAccepted"];
732
+ var _excluded$4 = ["disabled", "children", "hintText", "startIcon", "fallback", "accept", "maxSize", "maxFiles", "onDropRejected", "onDropAccepted"];
677
733
  function toBytes(input, unit) {
678
734
  if (unit === 'gb') return input * (1 << 30);
679
735
  if (unit === 'mb') return input * (1 << 20);
@@ -744,7 +800,7 @@ var FileDropZone = /*#__PURE__*/forwardRef((props, ref) => {
744
800
  onDropRejected: _onDropRejected,
745
801
  onDropAccepted: _onDropAccepted
746
802
  } = props,
747
- dropzoneProps = _objectWithoutProperties(props, _excluded$3);
803
+ dropzoneProps = _objectWithoutProperties(props, _excluded$4);
748
804
 
749
805
  return /*#__PURE__*/jsx(Suspense, {
750
806
  fallback: fallback,
@@ -1202,7 +1258,7 @@ if (process.env.NODE_ENV !== "production") SidebarMenuItemAvatar.displayName = "
1202
1258
  var SidebarSubheaderRoot = /*#__PURE__*/styled.div.withConfig({
1203
1259
  displayName: "SidebarSubheader__SidebarSubheaderRoot",
1204
1260
  componentId: "SD__sc-1r0xx76-0"
1205
- })(["height:40px;max-height:40px;padding-left:24px;padding-right:24px;"]);
1261
+ })(["display:flex;align-items:center;height:40px;max-height:40px;padding-left:24px;padding-right:24px;"]);
1206
1262
  var SidebarSubheader = /*#__PURE__*/forwardRef((_ref, ref) => {
1207
1263
  var {
1208
1264
  id,
@@ -1213,6 +1269,7 @@ var SidebarSubheader = /*#__PURE__*/forwardRef((_ref, ref) => {
1213
1269
  ref: ref,
1214
1270
  children: /*#__PURE__*/jsxs(Columns, {
1215
1271
  space: "xsmall",
1272
+ align: "center",
1216
1273
  children: [/*#__PURE__*/jsx(Column, {
1217
1274
  children: /*#__PURE__*/jsx(TextBox, {
1218
1275
  id: id,
@@ -1230,5 +1287,5 @@ var SidebarSubheader = /*#__PURE__*/forwardRef((_ref, ref) => {
1230
1287
  });
1231
1288
  if (process.env.NODE_ENV !== "production") SidebarSubheader.displayName = "SidebarSubheader";
1232
1289
 
1233
- 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 };
1234
1291
  //# sourceMappingURL=index.js.map