@superdispatch/ui-lab 0.23.2 → 0.23.4
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-src/chat/Chat.js
CHANGED
|
@@ -8,13 +8,9 @@ var ChatContainer = /*#__PURE__*/styled('div').withConfig({
|
|
|
8
8
|
componentId: "SD__sc-qksih8-0"
|
|
9
9
|
})(_ref => {
|
|
10
10
|
var {
|
|
11
|
-
isEmpty
|
|
12
|
-
minWidth,
|
|
13
|
-
maxWidth,
|
|
14
|
-
minHeight,
|
|
15
|
-
maxHeight
|
|
11
|
+
isEmpty
|
|
16
12
|
} = _ref;
|
|
17
|
-
return "\n display: flex;\n flex-direction: column-reverse;\n overflow: auto;\n justify-content: ".concat(isEmpty ? 'center' : 'end', ";\n width: 100%;\n height: 100%;\n min-width:
|
|
13
|
+
return "\n display: flex;\n flex-direction: column-reverse;\n overflow: auto;\n justify-content: ".concat(isEmpty ? 'center' : 'end', ";\n width: 100%;\n height: 100%;\n min-width: 300px;\n max-width: 560px;\n min-height: 368px;\n max-height: 696px;\n padding: 16px;\n box-sizing: border-box;\n");
|
|
18
14
|
});
|
|
19
15
|
|
|
20
16
|
function emptyPlaceholder(text) {
|
|
@@ -28,6 +24,7 @@ function emptyPlaceholder(text) {
|
|
|
28
24
|
export var Chat = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
29
25
|
var {
|
|
30
26
|
children,
|
|
27
|
+
className,
|
|
31
28
|
emptyText = 'No new messages'
|
|
32
29
|
} = _ref2;
|
|
33
30
|
var isEmpty = Children.toArray(children).length === 0;
|
|
@@ -35,6 +32,7 @@ export var Chat = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
35
32
|
"data-testid": "chat-container",
|
|
36
33
|
isEmpty: isEmpty,
|
|
37
34
|
ref: ref,
|
|
35
|
+
className: className,
|
|
38
36
|
children: /*#__PURE__*/_jsx(Stack, {
|
|
39
37
|
space: "small",
|
|
40
38
|
children: isEmpty ? emptyPlaceholder(emptyText) : children
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Typography } from '@material-ui/core';
|
|
2
|
+
import { formatDate } from '@superdispatch/dates';
|
|
2
3
|
import { Inline, Stack } from '@superdispatch/ui';
|
|
3
4
|
import { Box } from '@superdispatch/ui-lab';
|
|
4
5
|
import { forwardRef } from 'react';
|
|
@@ -12,6 +13,9 @@ export var ChatMessage = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
12
13
|
text,
|
|
13
14
|
variant
|
|
14
15
|
} = _ref;
|
|
16
|
+
var time = formatDate(dateTime, {
|
|
17
|
+
variant: 'Time'
|
|
18
|
+
});
|
|
15
19
|
return /*#__PURE__*/_jsxs(Stack, {
|
|
16
20
|
space: "xxsmall",
|
|
17
21
|
align: variant === 'outgoing' ? 'right' : 'left',
|
|
@@ -27,7 +31,7 @@ export var ChatMessage = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
27
31
|
children: role
|
|
28
32
|
}), /*#__PURE__*/_jsx(Typography, {
|
|
29
33
|
color: "textSecondary",
|
|
30
|
-
children:
|
|
34
|
+
children: time
|
|
31
35
|
})]
|
|
32
36
|
}), /*#__PURE__*/_jsx(Box, {
|
|
33
37
|
display: "inline-block",
|
package/dist-types/index.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ import { CSSTransitionProps } from 'react-transition-group/CSSTransition';
|
|
|
5
5
|
import { SpaceProp, NegativeSpaceProp, ResponsiveProp, ColorProp } from '@superdispatch/ui';
|
|
6
6
|
import { Property } from 'csstype';
|
|
7
7
|
import { ButtonBaseProps, AvatarProps, IconButtonProps, TooltipProps } from '@material-ui/core';
|
|
8
|
+
import { PrimitiveDateInput } from '@superdispatch/dates';
|
|
9
|
+
import { DateTime } from 'luxon';
|
|
8
10
|
import { FileRejection } from 'react-dropzone';
|
|
9
11
|
import { StyledComponent, DefaultTheme } from 'styled-components';
|
|
10
12
|
|
|
@@ -121,16 +123,16 @@ declare const AnchorButton: ForwardRefExoticComponent<AnchorButtonProps & RefAtt
|
|
|
121
123
|
|
|
122
124
|
|
|
123
125
|
interface ChatProps {
|
|
126
|
+
className?: string;
|
|
124
127
|
children?: React.ReactNode | React.ReactNode[];
|
|
125
128
|
emptyText?: string;
|
|
126
129
|
}
|
|
127
130
|
declare const Chat: ForwardRefExoticComponent<ChatProps & RefAttributes<HTMLDivElement>>;
|
|
128
131
|
|
|
129
|
-
|
|
130
132
|
interface ChatMessageProps {
|
|
131
133
|
author: string;
|
|
132
134
|
role: string;
|
|
133
|
-
dateTime:
|
|
135
|
+
dateTime: Date | DateTime | PrimitiveDateInput;
|
|
134
136
|
text: string;
|
|
135
137
|
variant: 'incoming' | 'outgoing';
|
|
136
138
|
}
|
package/dist-web/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
|
8
8
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
9
9
|
import { CSSTransition } from 'react-transition-group';
|
|
10
10
|
import { ButtonBase, Typography, CircularProgress, SvgIcon, Link, Tooltip, IconButton, BottomNavigation, BottomNavigationAction, Accordion, AccordionSummary, useTheme, useMediaQuery, Drawer, Avatar, MenuItem, Menu as Menu$1, Toolbar, AppBar, Divider as Divider$1, Checkbox } from '@material-ui/core';
|
|
11
|
+
import { formatDate } from '@superdispatch/dates';
|
|
11
12
|
import { Box as Box$1 } from '@superdispatch/ui-lab';
|
|
12
13
|
import { mdiUpload, mdiFilePdfBox, mdiTextBox } from '@mdi/js';
|
|
13
14
|
import Dropzone from 'react-dropzone';
|
|
@@ -530,13 +531,9 @@ var ChatContainer = /*#__PURE__*/styled('div').withConfig({
|
|
|
530
531
|
componentId: "SD__sc-qksih8-0"
|
|
531
532
|
})(_ref => {
|
|
532
533
|
var {
|
|
533
|
-
isEmpty
|
|
534
|
-
minWidth,
|
|
535
|
-
maxWidth,
|
|
536
|
-
minHeight,
|
|
537
|
-
maxHeight
|
|
534
|
+
isEmpty
|
|
538
535
|
} = _ref;
|
|
539
|
-
return "\n display: flex;\n flex-direction: column-reverse;\n overflow: auto;\n justify-content: ".concat(isEmpty ? 'center' : 'end', ";\n width: 100%;\n height: 100%;\n min-width:
|
|
536
|
+
return "\n display: flex;\n flex-direction: column-reverse;\n overflow: auto;\n justify-content: ".concat(isEmpty ? 'center' : 'end', ";\n width: 100%;\n height: 100%;\n min-width: 300px;\n max-width: 560px;\n min-height: 368px;\n max-height: 696px;\n padding: 16px;\n box-sizing: border-box;\n");
|
|
540
537
|
});
|
|
541
538
|
|
|
542
539
|
function emptyPlaceholder(text) {
|
|
@@ -550,6 +547,7 @@ function emptyPlaceholder(text) {
|
|
|
550
547
|
var Chat = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
551
548
|
var {
|
|
552
549
|
children,
|
|
550
|
+
className,
|
|
553
551
|
emptyText = 'No new messages'
|
|
554
552
|
} = _ref2;
|
|
555
553
|
var isEmpty = Children.toArray(children).length === 0;
|
|
@@ -557,6 +555,7 @@ var Chat = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
557
555
|
"data-testid": "chat-container",
|
|
558
556
|
isEmpty: isEmpty,
|
|
559
557
|
ref: ref,
|
|
558
|
+
className: className,
|
|
560
559
|
children: /*#__PURE__*/jsx(Stack, {
|
|
561
560
|
space: "small",
|
|
562
561
|
children: isEmpty ? emptyPlaceholder(emptyText) : children
|
|
@@ -574,6 +573,9 @@ var ChatMessage = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
574
573
|
text,
|
|
575
574
|
variant
|
|
576
575
|
} = _ref;
|
|
576
|
+
var time = formatDate(dateTime, {
|
|
577
|
+
variant: 'Time'
|
|
578
|
+
});
|
|
577
579
|
return /*#__PURE__*/jsxs(Stack, {
|
|
578
580
|
space: "xxsmall",
|
|
579
581
|
align: variant === 'outgoing' ? 'right' : 'left',
|
|
@@ -589,7 +591,7 @@ var ChatMessage = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
589
591
|
children: role
|
|
590
592
|
}), /*#__PURE__*/jsx(Typography, {
|
|
591
593
|
color: "textSecondary",
|
|
592
|
-
children:
|
|
594
|
+
children: time
|
|
593
595
|
})]
|
|
594
596
|
}), /*#__PURE__*/jsx(Box$1, {
|
|
595
597
|
display: "inline-block",
|