@superdispatch/ui-lab 0.47.0 → 0.48.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.
@@ -1,8 +1,8 @@
1
1
  import { Typography } from '@material-ui/core';
2
2
  import { formatDate } from '@superdispatch/dates';
3
3
  import { Inline, Stack } from '@superdispatch/ui';
4
- import { Box } from '@superdispatch/ui-lab';
5
4
  import { forwardRef } from 'react';
5
+ import { Box } from "../box/Box.js";
6
6
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
7
  export var ChatMessage = /*#__PURE__*/forwardRef((_ref, ref) => {
8
8
  var {
@@ -4,9 +4,9 @@ var _excluded = ["value", "onChange", "TextFieldProps"];
4
4
  import { IconButton, TextField } from '@material-ui/core';
5
5
  import { Autocomplete } from '@material-ui/lab';
6
6
  import { Inline, Tag } from '@superdispatch/ui';
7
- import { TextBox } from '@superdispatch/ui-lab';
8
7
  import { forwardRef } from 'react';
9
8
  import styled from 'styled-components';
9
+ import { TextBox } from "../text-box/TextBox.js";
10
10
  import { CloseIcon } from "./CloseIcon.js";
11
11
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
12
  var MultipleFieldText = /*#__PURE__*/styled(TextField).withConfig({
@@ -28,26 +28,15 @@ export var EmailAutocomplete = /*#__PURE__*/forwardRef((_ref, ref) => {
28
28
  ref: ref,
29
29
  multiple: true,
30
30
  freeSolo: true,
31
- filterSelectedOptions: true,
32
- disableClearable: true,
33
31
  value: value,
32
+ disableClearable: true,
33
+ filterSelectedOptions: true,
34
34
  filterOptions: _filterOptions => {
35
35
  return _filterOptions.filter(option => option !== '');
36
36
  },
37
- onChange: (event, selectedValue) => {
38
- var keyboardEvent = event;
39
- var lastElement = selectedValue[selectedValue.length - 1];
40
- if (keyboardEvent.key === 'Backspace') {
41
- var removeLatesElement = value === null || value === void 0 ? void 0 : value.filter((_, index) => index < value.length - 1);
42
- _onChange === null || _onChange === void 0 ? void 0 : _onChange(removeLatesElement, 'remove-option');
43
- } else if (keyboardEvent.key === 'Enter' && lastElement) {
44
- _onChange === null || _onChange === void 0 ? void 0 : _onChange([...(value || []), lastElement], 'select-option');
45
- } else if (lastElement) {
46
- var emails = lastElement.split(',').map(item => item.replace(' ', ''));
47
- _onChange === null || _onChange === void 0 ? void 0 : _onChange(emails, 'select-option');
48
- } else {
49
- _onChange === null || _onChange === void 0 ? void 0 : _onChange(selectedValue, 'select-option');
50
- }
37
+ onChange: (_event, selectedValue, reason) => {
38
+ var emails = selectedValue.flatMap(item => item.split(',')).map(item => item.trim());
39
+ _onChange === null || _onChange === void 0 ? void 0 : _onChange(emails, reason);
51
40
  },
52
41
  renderTags: items => {
53
42
  return /*#__PURE__*/_jsx(Inline, {
@@ -1,11 +1,10 @@
1
- import { noop } from 'lodash';
2
1
  import { createContext, useContext } from 'react';
3
2
  export var NavbarContext = /*#__PURE__*/createContext({
4
3
  isDrawerOpen: false,
5
4
  isMenuExpanded: false,
6
5
  isNavbarExpanded: false,
7
- setMenuExpanded: noop,
8
- setDrawerOpen: noop
6
+ setMenuExpanded: () => void 0,
7
+ setDrawerOpen: () => void 0
9
8
  });
10
9
  export function useNavbarContext() {
11
10
  return useContext(NavbarContext);
package/dist-web/index.js CHANGED
@@ -9,11 +9,9 @@ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProper
9
9
  import { CSSTransition } from 'react-transition-group';
10
10
  import { ButtonBase, Typography, CircularProgress, SvgIcon, IconButton, TextField, Link, Tooltip, BottomNavigation, BottomNavigationAction, alpha, Accordion, AccordionSummary, useTheme, useMediaQuery, Drawer, Avatar, MenuItem, Menu as Menu$1, Toolbar, AppBar, Divider as Divider$1, Checkbox } from '@material-ui/core';
11
11
  import { formatDate } from '@superdispatch/dates';
12
- import { Box as Box$1, TextBox as TextBox$1 } from '@superdispatch/ui-lab';
13
12
  import { mdiUpload, mdiFilePdfBox, mdiTextBox } from '@mdi/js';
14
13
  import Dropzone from 'react-dropzone';
15
14
  import { Anchorme } from 'react-anchorme';
16
- import { noop } from 'lodash';
17
15
 
18
16
  function colorMixin(textColor, iconColor, backgroundColor, buttonHoverColor) {
19
17
  return css(["color:", ";border-color:", ";background-color:", ";& .MuiAlert-icon{color:", ";}& .MuiAlert-action{color:", ";& .MuiIconButton-root{&:hover,&:active{color:", ";}}}"], textColor, textColor, backgroundColor, iconColor, iconColor, buttonHoverColor);
@@ -583,7 +581,7 @@ var ChatMessage = /*#__PURE__*/forwardRef((_ref, ref) => {
583
581
  color: "textSecondary",
584
582
  children: time
585
583
  })]
586
- }), /*#__PURE__*/jsx(Box$1, {
584
+ }), /*#__PURE__*/jsx(Box, {
587
585
  display: "inline-block",
588
586
  padding: "xsmall",
589
587
  marginTop: "none",
@@ -896,26 +894,15 @@ var EmailAutocomplete = /*#__PURE__*/forwardRef((_ref, ref) => {
896
894
  ref: ref,
897
895
  multiple: true,
898
896
  freeSolo: true,
899
- filterSelectedOptions: true,
900
- disableClearable: true,
901
897
  value: value,
898
+ disableClearable: true,
899
+ filterSelectedOptions: true,
902
900
  filterOptions: _filterOptions => {
903
901
  return _filterOptions.filter(option => option !== '');
904
902
  },
905
- onChange: (event, selectedValue) => {
906
- var keyboardEvent = event;
907
- var lastElement = selectedValue[selectedValue.length - 1];
908
- if (keyboardEvent.key === 'Backspace') {
909
- var removeLatesElement = value === null || value === void 0 ? void 0 : value.filter((_, index) => index < value.length - 1);
910
- _onChange === null || _onChange === void 0 ? void 0 : _onChange(removeLatesElement, 'remove-option');
911
- } else if (keyboardEvent.key === 'Enter' && lastElement) {
912
- _onChange === null || _onChange === void 0 ? void 0 : _onChange([...(value || []), lastElement], 'select-option');
913
- } else if (lastElement) {
914
- var emails = lastElement.split(',').map(item => item.replace(' ', ''));
915
- _onChange === null || _onChange === void 0 ? void 0 : _onChange(emails, 'select-option');
916
- } else {
917
- _onChange === null || _onChange === void 0 ? void 0 : _onChange(selectedValue, 'select-option');
918
- }
903
+ onChange: (_event, selectedValue, reason) => {
904
+ var emails = selectedValue.flatMap(item => item.split(',')).map(item => item.trim());
905
+ _onChange === null || _onChange === void 0 ? void 0 : _onChange(emails, reason);
919
906
  },
920
907
  renderTags: items => {
921
908
  return /*#__PURE__*/jsx(Inline, {
@@ -926,7 +913,7 @@ var EmailAutocomplete = /*#__PURE__*/forwardRef((_ref, ref) => {
926
913
  variant: "subtle",
927
914
  children: /*#__PURE__*/jsxs(Inline, {
928
915
  space: "xxsmall",
929
- children: [/*#__PURE__*/jsx(TextBox$1, {
916
+ children: [/*#__PURE__*/jsx(TextBox, {
930
917
  wrapOverflow: true,
931
918
  color: "primary",
932
919
  children: option
@@ -1354,8 +1341,8 @@ var NavbarContext = /*#__PURE__*/createContext({
1354
1341
  isDrawerOpen: false,
1355
1342
  isMenuExpanded: false,
1356
1343
  isNavbarExpanded: false,
1357
- setMenuExpanded: noop,
1358
- setDrawerOpen: noop
1344
+ setMenuExpanded: () => void 0,
1345
+ setDrawerOpen: () => void 0
1359
1346
  });
1360
1347
  function useNavbarContext() {
1361
1348
  return useContext(NavbarContext);