@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.
package/dist-src/index.js CHANGED
@@ -3,6 +3,8 @@ export * from "./banner/Banner.js";
3
3
  export * from "./box/Box.js";
4
4
  export * from "./button-area/ButtonArea.js";
5
5
  export * from "./button/Button.js";
6
+ export * from "./chat/Chat.js";
7
+ export * from "./chat/ChatMessage.js";
6
8
  export * from "./container/Container.js";
7
9
  export * from "./description-item/DescriptionItem.js";
8
10
  export * from "./file-drop-zone/FileDropZone.js";
@@ -119,6 +119,23 @@ interface AnchorButtonProps extends BaseButtonProps<HTMLAnchorElement> {
119
119
  }
120
120
  declare const AnchorButton: ForwardRefExoticComponent<AnchorButtonProps & RefAttributes<HTMLAnchorElement>>;
121
121
 
122
+
123
+ interface ChatProps {
124
+ children?: React.ReactNode | React.ReactNode[];
125
+ emptyText?: string;
126
+ }
127
+ declare const Chat: ForwardRefExoticComponent<ChatProps & RefAttributes<HTMLDivElement>>;
128
+
129
+
130
+ interface ChatMessageProps {
131
+ author: string;
132
+ role: string;
133
+ dateTime: string;
134
+ text: string;
135
+ variant: 'incoming' | 'outgoing';
136
+ }
137
+ declare const ChatMessage: ForwardRefExoticComponent<ChatMessageProps & RefAttributes<HTMLDivElement>>;
138
+
122
139
  declare type ContainerProps = HTMLAttributes<HTMLDivElement> & {
123
140
  fullViewportHeight?: boolean;
124
141
  };
@@ -373,4 +390,4 @@ interface TextBoxProps {
373
390
  }
374
391
  declare const TextBox: ForwardRefExoticComponent<TextBoxProps & RefAttributes<HTMLElement>>;
375
392
 
376
- export { Alert, AlertProps, AlertSeverityProp, AnchorButton, AnchorButtonProps, Banner, BorderRadiusProp, BorderWidthProp, Box, BoxProps, Button, ButtonArea, ButtonAreaProps, ButtonProps, ButtonSizeProp, ButtonVariantProp, Container, ContainerProps, DescriptionItem, DescriptionItemProps, FileDropZone, FileDropZoneProps, FileListItem, FileListItemProps, LinkComponentProps, LinkedText, LinkedTextProps, MarginProp, MultilineText, MultilineTextProps, Navbar, NavbarAccordionOptions, NavbarAvatar, NavbarBadge, NavbarBottomBar, NavbarBottomBarItem, NavbarItem, NavbarItemOptions, NavbarItemProps, NavbarLabel, NavbarList, NavbarMenu, NavbarMenuItem, NavbarMenuItemOption, Sidebar, SidebarBackButton, SidebarContainer, SidebarContainerProps, SidebarContent, SidebarContentProps, SidebarDivider, SidebarMenuItem, SidebarMenuItemAction, SidebarMenuItemActionProps, SidebarMenuItemAvatar, SidebarMenuItemAvatarProps, SidebarMenuItemProps, SidebarProps, SidebarSubheader, SidebarSubheaderProps, TextAlignProp, TextBox, TextBoxProps, TextColorProp, TextDisplayProp, TextVariantProp, formatBytes, toBytes, useNavbarContext, useSidebarContext };
393
+ export { Alert, AlertProps, AlertSeverityProp, AnchorButton, AnchorButtonProps, Banner, BorderRadiusProp, BorderWidthProp, Box, BoxProps, Button, ButtonArea, ButtonAreaProps, ButtonProps, ButtonSizeProp, ButtonVariantProp, Chat, ChatMessage, Container, ContainerProps, DescriptionItem, DescriptionItemProps, FileDropZone, FileDropZoneProps, FileListItem, FileListItemProps, LinkComponentProps, LinkedText, LinkedTextProps, MarginProp, MultilineText, MultilineTextProps, Navbar, NavbarAccordionOptions, NavbarAvatar, NavbarBadge, NavbarBottomBar, NavbarBottomBarItem, NavbarItem, NavbarItemOptions, NavbarItemProps, NavbarLabel, NavbarList, NavbarMenu, NavbarMenuItem, NavbarMenuItemOption, Sidebar, SidebarBackButton, SidebarContainer, SidebarContainerProps, SidebarContent, SidebarContentProps, SidebarDivider, SidebarMenuItem, SidebarMenuItemAction, SidebarMenuItemActionProps, SidebarMenuItemAvatar, SidebarMenuItemAvatarProps, SidebarMenuItemProps, SidebarProps, SidebarSubheader, SidebarSubheaderProps, TextAlignProp, TextBox, TextBoxProps, TextColorProp, TextDisplayProp, TextVariantProp, formatBytes, toBytes, useNavbarContext, useSidebarContext };
package/dist-web/index.js CHANGED
@@ -1,13 +1,14 @@
1
1
  import { CheckCircle, Info, Error as Error$1, Image, Refresh, Delete, Menu, ExpandMore, MenuOpen, ArrowBack, OpenInNew } from '@material-ui/icons';
2
2
  import { Alert as Alert$1 } from '@material-ui/lab';
3
- import { Color, parseResponsiveProp, isColorProp, parseSpaceProp, Stack, mergeRefs, useUID, isEmptyReactNode, Columns, Column, Inline, CardButton, useResponsiveValue, useCollapseBreakpoint } from '@superdispatch/ui';
4
- import { forwardRef, useState, useEffect, useRef, useLayoutEffect, Suspense, memo, useContext, createContext, useMemo, createElement } from 'react';
3
+ import { Color, parseResponsiveProp, isColorProp, parseSpaceProp, Stack, Inline, mergeRefs, useUID, isEmptyReactNode, Columns, Column, CardButton, useResponsiveValue, useCollapseBreakpoint } from '@superdispatch/ui';
4
+ import { forwardRef, useState, useEffect, Children, useRef, useLayoutEffect, Suspense, memo, useContext, createContext, useMemo, createElement } from 'react';
5
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
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 { Box as Box$1 } from '@superdispatch/ui-lab';
11
12
  import { mdiUpload, mdiFilePdfBox, mdiTextBox } from '@mdi/js';
12
13
  import Dropzone from 'react-dropzone';
13
14
  import { Anchorme } from 'react-anchorme';
@@ -524,6 +525,88 @@ var AnchorButton = /*#__PURE__*/forwardRef((_ref5, ref) => {
524
525
  });
525
526
  if (process.env.NODE_ENV !== "production") AnchorButton.displayName = "AnchorButton";
526
527
 
528
+ var ChatContainer = /*#__PURE__*/styled('div').withConfig({
529
+ displayName: "Chat__ChatContainer",
530
+ componentId: "SD__sc-qksih8-0"
531
+ })(_ref => {
532
+ var {
533
+ isEmpty,
534
+ minWidth,
535
+ maxWidth,
536
+ minHeight,
537
+ maxHeight
538
+ } = _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: ").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");
540
+ });
541
+
542
+ function emptyPlaceholder(text) {
543
+ return /*#__PURE__*/jsx(Typography, {
544
+ color: "textSecondary",
545
+ align: "center",
546
+ children: text
547
+ });
548
+ }
549
+
550
+ var Chat = /*#__PURE__*/forwardRef((_ref2, ref) => {
551
+ var {
552
+ children,
553
+ emptyText = 'No new messages'
554
+ } = _ref2;
555
+ var isEmpty = Children.toArray(children).length === 0;
556
+ return /*#__PURE__*/jsx(ChatContainer, {
557
+ "data-testid": "chat-container",
558
+ isEmpty: isEmpty,
559
+ ref: ref,
560
+ children: /*#__PURE__*/jsx(Stack, {
561
+ space: "small",
562
+ children: isEmpty ? emptyPlaceholder(emptyText) : children
563
+ })
564
+ });
565
+ });
566
+ if (process.env.NODE_ENV !== "production") Chat.displayName = "Chat";
567
+ Chat.displayName = 'Chat';
568
+
569
+ var ChatMessage = /*#__PURE__*/forwardRef((_ref, ref) => {
570
+ var {
571
+ author,
572
+ role,
573
+ dateTime,
574
+ text,
575
+ variant
576
+ } = _ref;
577
+ return /*#__PURE__*/jsxs(Stack, {
578
+ space: "xxsmall",
579
+ align: variant === 'outgoing' ? 'right' : 'left',
580
+ ref: ref,
581
+ "data-testid": "chat-message",
582
+ children: [/*#__PURE__*/jsxs(Inline, {
583
+ verticalAlign: "center",
584
+ children: [/*#__PURE__*/jsx(Typography, {
585
+ color: "textPrimary",
586
+ children: author
587
+ }), /*#__PURE__*/jsx(Typography, {
588
+ color: "textSecondary",
589
+ children: role
590
+ }), /*#__PURE__*/jsx(Typography, {
591
+ color: "textSecondary",
592
+ children: dateTime
593
+ })]
594
+ }), /*#__PURE__*/jsx(Box$1, {
595
+ display: "inline-block",
596
+ padding: "xsmall",
597
+ marginTop: "none",
598
+ borderRadius: "medium",
599
+ backgroundColor: variant === 'outgoing' ? 'Blue50' : 'Silver200',
600
+ children: /*#__PURE__*/jsx(Typography, {
601
+ color: "textPrimary",
602
+ children: text
603
+ })
604
+ })]
605
+ });
606
+ });
607
+ if (process.env.NODE_ENV !== "production") ChatMessage.displayName = "ChatMessage";
608
+ ChatMessage.displayName = 'ChatMessage';
609
+
527
610
  var _excluded$3 = ["fullViewportHeight"];
528
611
  var Container = /*#__PURE__*/forwardRef((_ref, ref) => {
529
612
  var {
@@ -2095,5 +2178,5 @@ var SidebarSubheader = /*#__PURE__*/forwardRef((_ref, ref) => {
2095
2178
  });
2096
2179
  if (process.env.NODE_ENV !== "production") SidebarSubheader.displayName = "SidebarSubheader";
2097
2180
 
2098
- export { Alert, AnchorButton, Banner, Box, Button, ButtonArea, Container, DescriptionItem, FileDropZone, FileListItem, LinkedText, MultilineText, Navbar, NavbarAvatar, NavbarBadge, NavbarBottomBar, NavbarItem, NavbarLabel, NavbarList, NavbarMenu, NavbarMenuItem, Sidebar, SidebarBackButton, SidebarContainer, SidebarContent, SidebarDivider, SidebarMenuItem, SidebarMenuItemAction, SidebarMenuItemAvatar, SidebarSubheader, TextBox, formatBytes, toBytes, useNavbarContext, useSidebarContext };
2181
+ export { Alert, AnchorButton, Banner, Box, Button, ButtonArea, Chat, ChatMessage, Container, DescriptionItem, FileDropZone, FileListItem, LinkedText, MultilineText, Navbar, NavbarAvatar, NavbarBadge, NavbarBottomBar, NavbarItem, NavbarLabel, NavbarList, NavbarMenu, NavbarMenuItem, Sidebar, SidebarBackButton, SidebarContainer, SidebarContent, SidebarDivider, SidebarMenuItem, SidebarMenuItemAction, SidebarMenuItemAvatar, SidebarSubheader, TextBox, formatBytes, toBytes, useNavbarContext, useSidebarContext };
2099
2182
  //# sourceMappingURL=index.js.map