@superdispatch/ui-lab 0.23.0 → 0.23.2

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.
@@ -15,6 +15,7 @@ var _objectSpread = _interopDefault(require('@babel/runtime/helpers/objectSpread
15
15
  var _objectWithoutProperties = _interopDefault(require('@babel/runtime/helpers/objectWithoutProperties'));
16
16
  var reactTransitionGroup = require('react-transition-group');
17
17
  var core = require('@material-ui/core');
18
+ var uiLab = require('@superdispatch/ui-lab');
18
19
  var js = require('@mdi/js');
19
20
  var Dropzone = _interopDefault(require('react-dropzone'));
20
21
  var reactAnchorme = require('react-anchorme');
@@ -531,6 +532,88 @@ var AnchorButton = /*#__PURE__*/react.forwardRef((_ref5, ref) => {
531
532
  });
532
533
  if (process.env.NODE_ENV !== "production") AnchorButton.displayName = "AnchorButton";
533
534
 
535
+ var ChatContainer = /*#__PURE__*/styled__default('div').withConfig({
536
+ displayName: "Chat__ChatContainer",
537
+ componentId: "SD__sc-qksih8-0"
538
+ })(_ref => {
539
+ var {
540
+ isEmpty,
541
+ minWidth,
542
+ maxWidth,
543
+ minHeight,
544
+ maxHeight
545
+ } = _ref;
546
+ 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: ").concat(minWidth || 432, "px;\n max-width: ").concat(maxWidth || 560, "px;\n min-height: ").concat(minHeight || 368, "px;\n max-height: ").concat(maxHeight || 696, "px;\n padding: 16px;\n box-sizing: border-box;\n");
547
+ });
548
+
549
+ function emptyPlaceholder(text) {
550
+ return /*#__PURE__*/jsxRuntime.jsx(core.Typography, {
551
+ color: "textSecondary",
552
+ align: "center",
553
+ children: text
554
+ });
555
+ }
556
+
557
+ var Chat = /*#__PURE__*/react.forwardRef((_ref2, ref) => {
558
+ var {
559
+ children,
560
+ emptyText = 'No new messages'
561
+ } = _ref2;
562
+ var isEmpty = react.Children.toArray(children).length === 0;
563
+ return /*#__PURE__*/jsxRuntime.jsx(ChatContainer, {
564
+ "data-testid": "chat-container",
565
+ isEmpty: isEmpty,
566
+ ref: ref,
567
+ children: /*#__PURE__*/jsxRuntime.jsx(ui.Stack, {
568
+ space: "small",
569
+ children: isEmpty ? emptyPlaceholder(emptyText) : children
570
+ })
571
+ });
572
+ });
573
+ if (process.env.NODE_ENV !== "production") Chat.displayName = "Chat";
574
+ Chat.displayName = 'Chat';
575
+
576
+ var ChatMessage = /*#__PURE__*/react.forwardRef((_ref, ref) => {
577
+ var {
578
+ author,
579
+ role,
580
+ dateTime,
581
+ text,
582
+ variant
583
+ } = _ref;
584
+ return /*#__PURE__*/jsxRuntime.jsxs(ui.Stack, {
585
+ space: "xxsmall",
586
+ align: variant === 'outgoing' ? 'right' : 'left',
587
+ ref: ref,
588
+ "data-testid": "chat-message",
589
+ children: [/*#__PURE__*/jsxRuntime.jsxs(ui.Inline, {
590
+ verticalAlign: "center",
591
+ children: [/*#__PURE__*/jsxRuntime.jsx(core.Typography, {
592
+ color: "textPrimary",
593
+ children: author
594
+ }), /*#__PURE__*/jsxRuntime.jsx(core.Typography, {
595
+ color: "textSecondary",
596
+ children: role
597
+ }), /*#__PURE__*/jsxRuntime.jsx(core.Typography, {
598
+ color: "textSecondary",
599
+ children: dateTime
600
+ })]
601
+ }), /*#__PURE__*/jsxRuntime.jsx(uiLab.Box, {
602
+ display: "inline-block",
603
+ padding: "xsmall",
604
+ marginTop: "none",
605
+ borderRadius: "medium",
606
+ backgroundColor: variant === 'outgoing' ? 'Blue50' : 'Silver200',
607
+ children: /*#__PURE__*/jsxRuntime.jsx(core.Typography, {
608
+ color: "textPrimary",
609
+ children: text
610
+ })
611
+ })]
612
+ });
613
+ });
614
+ if (process.env.NODE_ENV !== "production") ChatMessage.displayName = "ChatMessage";
615
+ ChatMessage.displayName = 'ChatMessage';
616
+
534
617
  var _excluded$3 = ["fullViewportHeight"];
535
618
  var Container = /*#__PURE__*/react.forwardRef((_ref, ref) => {
536
619
  var {
@@ -2108,6 +2191,8 @@ exports.Banner = Banner;
2108
2191
  exports.Box = Box;
2109
2192
  exports.Button = Button;
2110
2193
  exports.ButtonArea = ButtonArea;
2194
+ exports.Chat = Chat;
2195
+ exports.ChatMessage = ChatMessage;
2111
2196
  exports.Container = Container;
2112
2197
  exports.DescriptionItem = DescriptionItem;
2113
2198
  exports.FileDropZone = FileDropZone;