@superdispatch/ui-lab 0.22.0 → 0.22.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.
@@ -0,0 +1,45 @@
1
+ import { Typography } from '@material-ui/core';
2
+ import { Stack } from '@superdispatch/ui';
3
+ import { Children, forwardRef } from 'react';
4
+ import styled from 'styled-components';
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ var ChatContainer = /*#__PURE__*/styled('div').withConfig({
7
+ displayName: "Chat__ChatContainer",
8
+ componentId: "SD__sc-qksih8-0"
9
+ })(_ref => {
10
+ var {
11
+ isEmpty,
12
+ minWidth,
13
+ maxWidth,
14
+ minHeight,
15
+ maxHeight
16
+ } = _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: ").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");
18
+ });
19
+
20
+ function emptyPlaceholder(text) {
21
+ return /*#__PURE__*/_jsx(Typography, {
22
+ color: "textSecondary",
23
+ align: "center",
24
+ children: text
25
+ });
26
+ }
27
+
28
+ export var Chat = /*#__PURE__*/forwardRef((_ref2, ref) => {
29
+ var {
30
+ children,
31
+ emptyText = 'No new messages'
32
+ } = _ref2;
33
+ var isEmpty = Children.toArray(children).length === 0;
34
+ return /*#__PURE__*/_jsx(ChatContainer, {
35
+ "data-testid": "chat-container",
36
+ isEmpty: isEmpty,
37
+ ref: ref,
38
+ children: /*#__PURE__*/_jsx(Stack, {
39
+ space: "small",
40
+ children: isEmpty ? emptyPlaceholder(emptyText) : children
41
+ })
42
+ });
43
+ });
44
+ if (process.env.NODE_ENV !== "production") Chat.displayName = "Chat";
45
+ Chat.displayName = 'Chat';
@@ -0,0 +1,46 @@
1
+ import { Typography } from '@material-ui/core';
2
+ import { Inline, Stack } from '@superdispatch/ui';
3
+ import { Box } from '@superdispatch/ui-lab';
4
+ import { forwardRef } from 'react';
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ import { jsxs as _jsxs } from "react/jsx-runtime";
7
+ export var ChatMessage = /*#__PURE__*/forwardRef((_ref, ref) => {
8
+ var {
9
+ author,
10
+ role,
11
+ dateTime,
12
+ text,
13
+ variant
14
+ } = _ref;
15
+ return /*#__PURE__*/_jsxs(Stack, {
16
+ space: "xxsmall",
17
+ align: variant === 'outgoing' ? 'right' : 'left',
18
+ ref: ref,
19
+ "data-testid": "chat-message",
20
+ children: [/*#__PURE__*/_jsxs(Inline, {
21
+ verticalAlign: "center",
22
+ children: [/*#__PURE__*/_jsx(Typography, {
23
+ color: "textPrimary",
24
+ children: author
25
+ }), /*#__PURE__*/_jsx(Typography, {
26
+ color: "textSecondary",
27
+ children: role
28
+ }), /*#__PURE__*/_jsx(Typography, {
29
+ color: "textSecondary",
30
+ children: dateTime
31
+ })]
32
+ }), /*#__PURE__*/_jsx(Box, {
33
+ display: "inline-block",
34
+ padding: "xsmall",
35
+ marginTop: "none",
36
+ borderRadius: "medium",
37
+ backgroundColor: variant === 'outgoing' ? 'Blue50' : 'Silver200',
38
+ children: /*#__PURE__*/_jsx(Typography, {
39
+ color: "textPrimary",
40
+ children: text
41
+ })
42
+ })]
43
+ });
44
+ });
45
+ if (process.env.NODE_ENV !== "production") ChatMessage.displayName = "ChatMessage";
46
+ ChatMessage.displayName = 'ChatMessage';
@@ -67,7 +67,7 @@ export function NavbarMenuItem(_ref4) {
67
67
  var Content = /*#__PURE__*/styled.div.withConfig({
68
68
  displayName: "NavbarList__Content",
69
69
  componentId: "SD__sc-19zrmxc-5"
70
- })(["height:100%;min-height:50px;overflow-y:auto;overflow-x:hidden;&[aria-expanded='false']{", ",", "{display:none;}}"], NavbarBadge, NavbarLabel);
70
+ })(["height:100%;min-height:50px;overflow-y:auto;overflow-x:hidden;&[aria-expanded='false']{", ",", "{display:none;}}&::-webkit-scrollbar{width:10px;height:10px;}&::-webkit-scrollbar-track{background-color:transparent;}&::-webkit-scrollbar-thumb{background-color:", ";border-radius:100vw;margin-bottom:100px;}"], NavbarBadge, NavbarLabel, Color.Dark300);
71
71
  export function NavbarList(_ref5) {
72
72
  var {
73
73
  header,
package/dist-web/index.js CHANGED
@@ -1326,7 +1326,7 @@ function NavbarMenuItem(_ref4) {
1326
1326
  var Content = /*#__PURE__*/styled.div.withConfig({
1327
1327
  displayName: "NavbarList__Content",
1328
1328
  componentId: "SD__sc-19zrmxc-5"
1329
- })(["height:100%;min-height:50px;overflow-y:auto;overflow-x:hidden;&[aria-expanded='false']{", ",", "{display:none;}}"], NavbarBadge, NavbarLabel);
1329
+ })(["height:100%;min-height:50px;overflow-y:auto;overflow-x:hidden;&[aria-expanded='false']{", ",", "{display:none;}}&::-webkit-scrollbar{width:10px;height:10px;}&::-webkit-scrollbar-track{background-color:transparent;}&::-webkit-scrollbar-thumb{background-color:", ";border-radius:100vw;margin-bottom:100px;}"], NavbarBadge, NavbarLabel, Color.Dark300);
1330
1330
  function NavbarList(_ref5) {
1331
1331
  var {
1332
1332
  header,