@superdispatch/ui-lab 0.45.1 → 0.47.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.
@@ -867,7 +867,111 @@ var DescriptionLineItem = /*#__PURE__*/react.forwardRef((_ref, ref) => {
867
867
  if (process.env.NODE_ENV !== "production") DescriptionLineItem.displayName = "DescriptionLineItem";
868
868
  DescriptionLineItem.displayName = 'DescriptionLineItem';
869
869
 
870
- var _excluded$5 = ["disabled", "children", "hintText", "startIcon", "fallback", "accept", "maxSize", "maxFiles", "onDropRejected", "onDropAccepted"];
870
+ function CloseIcon(props) {
871
+ return /*#__PURE__*/jsxRuntime.jsx(core.SvgIcon, _objectSpread(_objectSpread({}, props), {}, {
872
+ viewBox: "0 0 6 6",
873
+ style: {
874
+ width: '6px',
875
+ height: '6px'
876
+ },
877
+ children: /*#__PURE__*/jsxRuntime.jsx("path", {
878
+ fillRule: "evenodd",
879
+ clipRule: "evenodd",
880
+ d: "M3.72278 2.99999L5.91671 0.806074L5.19396 0.0833282L3.00004 2.27725L0.80612 0.0833282L0.083374 0.806076L2.27729 2.99999L0.083374 5.19391L0.80612 5.91666L3.00004 3.72274L5.19396 5.91666L5.91671 5.19392L3.72278 2.99999Z",
881
+ fill: ui.Color.Dark100
882
+ })
883
+ }));
884
+ }
885
+
886
+ var _excluded$5 = ["value", "onChange", "TextFieldProps"];
887
+ var MultipleFieldText = /*#__PURE__*/styled__default(core.TextField).withConfig({
888
+ displayName: "EmailAutocomplete__MultipleFieldText",
889
+ componentId: "SD__sc-126rmmq-0"
890
+ })(["&{width:100%;margin-top:8px;overflow:hidden;}&& .MuiAutocomplete-inputRoot{flex-direction:column;align-items:flex-start;width:100%;gap:8px;& .MuiAutocomplete-input{width:100%;}}"]);
891
+ var EmailAutocomplete = /*#__PURE__*/react.forwardRef((_ref, ref) => {
892
+ var {
893
+ value,
894
+ onChange: _onChange,
895
+ TextFieldProps
896
+ } = _ref,
897
+ props = _objectWithoutProperties(_ref, _excluded$5);
898
+ function handleDelete(index) {
899
+ var filteredOrders = value === null || value === void 0 ? void 0 : value.filter((_item, fieldIndex) => fieldIndex !== index);
900
+ void (_onChange === null || _onChange === void 0 ? void 0 : _onChange(filteredOrders, 'remove-option'));
901
+ }
902
+ return /*#__PURE__*/jsxRuntime.jsx(lab.Autocomplete, _objectSpread(_objectSpread({}, props), {}, {
903
+ ref: ref,
904
+ multiple: true,
905
+ freeSolo: true,
906
+ filterSelectedOptions: true,
907
+ disableClearable: true,
908
+ value: value,
909
+ filterOptions: _filterOptions => {
910
+ return _filterOptions.filter(option => option !== '');
911
+ },
912
+ onChange: (event, selectedValue) => {
913
+ var keyboardEvent = event;
914
+ var lastElement = selectedValue[selectedValue.length - 1];
915
+ if (keyboardEvent.key === 'Backspace') {
916
+ var removeLatesElement = value === null || value === void 0 ? void 0 : value.filter((_, index) => index < value.length - 1);
917
+ _onChange === null || _onChange === void 0 ? void 0 : _onChange(removeLatesElement, 'remove-option');
918
+ } else if (keyboardEvent.key === 'Enter' && lastElement) {
919
+ _onChange === null || _onChange === void 0 ? void 0 : _onChange([...(value || []), lastElement], 'select-option');
920
+ } else if (lastElement) {
921
+ var emails = lastElement.split(',').map(item => item.replace(' ', ''));
922
+ _onChange === null || _onChange === void 0 ? void 0 : _onChange(emails, 'select-option');
923
+ } else {
924
+ _onChange === null || _onChange === void 0 ? void 0 : _onChange(selectedValue, 'select-option');
925
+ }
926
+ },
927
+ renderTags: items => {
928
+ return /*#__PURE__*/jsxRuntime.jsx(ui.Inline, {
929
+ space: "xxsmall",
930
+ children: items.map((option, index) => {
931
+ return /*#__PURE__*/jsxRuntime.jsx(ui.Tag, {
932
+ color: "grey",
933
+ variant: "subtle",
934
+ children: /*#__PURE__*/jsxRuntime.jsxs(ui.Inline, {
935
+ space: "xxsmall",
936
+ children: [/*#__PURE__*/jsxRuntime.jsx(uiLab.TextBox, {
937
+ wrapOverflow: true,
938
+ color: "primary",
939
+ children: option
940
+ }), /*#__PURE__*/jsxRuntime.jsx(core.IconButton, {
941
+ size: "small",
942
+ onClick: () => {
943
+ handleDelete(index);
944
+ },
945
+ children: /*#__PURE__*/jsxRuntime.jsx(CloseIcon, {})
946
+ })]
947
+ })
948
+ }, index);
949
+ })
950
+ });
951
+ },
952
+ renderInput: params => /*#__PURE__*/jsxRuntime.jsx(MultipleFieldText, _objectSpread(_objectSpread(_objectSpread({}, params), TextFieldProps), {}, {
953
+ multiline: true,
954
+ minRows: 2,
955
+ variant: "outlined",
956
+ fullWidth: true,
957
+ InputProps: _objectSpread(_objectSpread(_objectSpread({}, TextFieldProps === null || TextFieldProps === void 0 ? void 0 : TextFieldProps.InputProps), params.InputProps), {}, {
958
+ startAdornment: params.InputProps.startAdornment
959
+ }),
960
+ placeholder: "Enter individual emails on each line or separate them with comma (,)",
961
+ onChange: event => {
962
+ var text = event.target.value.replace(/,/g, '');
963
+ var hasCommaOrSpace = /,|\s/.test(event.target.value);
964
+ if (hasCommaOrSpace && text.trim() !== '') {
965
+ _onChange === null || _onChange === void 0 ? void 0 : _onChange([...(value || []), text.trim()], 'select-option');
966
+ }
967
+ }
968
+ }))
969
+ }));
970
+ });
971
+ if (process.env.NODE_ENV !== "production") EmailAutocomplete.displayName = "EmailAutocomplete";
972
+ EmailAutocomplete.displayName = 'EmailAutocomplete';
973
+
974
+ var _excluded$6 = ["disabled", "children", "hintText", "startIcon", "fallback", "accept", "maxSize", "maxFiles", "onDropRejected", "onDropAccepted"];
871
975
  function toBytes(input, unit) {
872
976
  if (unit === 'gb') return input * (1 << 30);
873
977
  if (unit === 'mb') return input * (1 << 20);
@@ -936,7 +1040,7 @@ var FileDropZone = /*#__PURE__*/react.forwardRef((props, ref) => {
936
1040
  onDropRejected: _onDropRejected,
937
1041
  onDropAccepted: _onDropAccepted
938
1042
  } = props,
939
- dropzoneProps = _objectWithoutProperties(props, _excluded$5);
1043
+ dropzoneProps = _objectWithoutProperties(props, _excluded$6);
940
1044
  return /*#__PURE__*/jsxRuntime.jsx(react.Suspense, {
941
1045
  fallback: fallback,
942
1046
  children: /*#__PURE__*/jsxRuntime.jsx(Dropzone, _objectSpread(_objectSpread({}, dropzoneProps), {}, {
@@ -1133,7 +1237,7 @@ var FlagList = /*#__PURE__*/react.forwardRef((_ref2, ref) => {
1133
1237
  });
1134
1238
  if (process.env.NODE_ENV !== "production") FlagList.displayName = "FlagList";
1135
1239
 
1136
- var _excluded$6 = ["variant", "showHelpIcon", "endAction", "children"];
1240
+ var _excluded$7 = ["variant", "showHelpIcon", "endAction", "children"];
1137
1241
  var IconContainer = /*#__PURE__*/styled__default.div.withConfig({
1138
1242
  displayName: "FlagListItem__IconContainer",
1139
1243
  componentId: "SD__sc-o5bqru-0"
@@ -1193,7 +1297,7 @@ var FlagListItem = /*#__PURE__*/react.forwardRef((_ref7, ref) => {
1193
1297
  endAction,
1194
1298
  children
1195
1299
  } = _ref7,
1196
- rest = _objectWithoutProperties(_ref7, _excluded$6);
1300
+ rest = _objectWithoutProperties(_ref7, _excluded$7);
1197
1301
  return /*#__PURE__*/jsxRuntime.jsxs(BannerListContainer, _objectSpread(_objectSpread({}, rest), {}, {
1198
1302
  ref: ref,
1199
1303
  $variant: variant,
@@ -1210,7 +1314,7 @@ var FlagListItem = /*#__PURE__*/react.forwardRef((_ref7, ref) => {
1210
1314
  });
1211
1315
  if (process.env.NODE_ENV !== "production") FlagListItem.displayName = "FlagListItem";
1212
1316
 
1213
- var _excluded$7 = ["color", "target", "rel"],
1317
+ var _excluded$8 = ["color", "target", "rel"],
1214
1318
  _excluded2$2 = ["children", "linkComponent"];
1215
1319
  var DefaultLinkComponent = /*#__PURE__*/react.forwardRef((_ref, ref) => {
1216
1320
  var {
@@ -1218,7 +1322,7 @@ var DefaultLinkComponent = /*#__PURE__*/react.forwardRef((_ref, ref) => {
1218
1322
  target = '_blank',
1219
1323
  rel = 'noreferrer noopener'
1220
1324
  } = _ref,
1221
- props = _objectWithoutProperties(_ref, _excluded$7);
1325
+ props = _objectWithoutProperties(_ref, _excluded$8);
1222
1326
  return /*#__PURE__*/jsxRuntime.jsx(core.Link, _objectSpread(_objectSpread({}, props), {}, {
1223
1327
  ref: ref,
1224
1328
  rel: rel,
@@ -1264,7 +1368,7 @@ function useNavbarContext() {
1264
1368
  return react.useContext(NavbarContext);
1265
1369
  }
1266
1370
 
1267
- var _excluded$8 = ["active", "hasBadge"];
1371
+ var _excluded$9 = ["active", "hasBadge"];
1268
1372
  var StyledBottomNavigation = /*#__PURE__*/styled__default(core.BottomNavigation).withConfig({
1269
1373
  displayName: "NavbarBottomBar__StyledBottomNavigation",
1270
1374
  componentId: "SD__sc-9z6v3k-0"
@@ -1308,7 +1412,7 @@ function NavbarBottomBar(_ref) {
1308
1412
  active,
1309
1413
  hasBadge
1310
1414
  } = _ref2,
1311
- item = _objectWithoutProperties(_ref2, _excluded$8);
1415
+ item = _objectWithoutProperties(_ref2, _excluded$9);
1312
1416
  return /*#__PURE__*/react.createElement(StyledBottomNavigationAction, _objectSpread(_objectSpread({}, item), {}, {
1313
1417
  key: item.value,
1314
1418
  icon: hasBadge ? /*#__PURE__*/jsxRuntime.jsxs(IconWrapper, {
@@ -1668,7 +1772,7 @@ function Navbar(_ref) {
1668
1772
  });
1669
1773
  }
1670
1774
 
1671
- var _excluded$9 = ["title", "subtitle", "children"];
1775
+ var _excluded$a = ["title", "subtitle", "children"];
1672
1776
  var StyledTypography = /*#__PURE__*/styled__default(core.Typography).withConfig({
1673
1777
  displayName: "NavbarAvatar__StyledTypography",
1674
1778
  componentId: "SD__sc-19q2zd0-0"
@@ -1679,7 +1783,7 @@ function NavbarAvatar(_ref) {
1679
1783
  subtitle,
1680
1784
  children
1681
1785
  } = _ref,
1682
- props = _objectWithoutProperties(_ref, _excluded$9);
1786
+ props = _objectWithoutProperties(_ref, _excluded$a);
1683
1787
  var {
1684
1788
  isNavbarExpanded
1685
1789
  } = useNavbarContext();
@@ -1889,7 +1993,7 @@ var SidebarContainer = /*#__PURE__*/react.forwardRef((_ref, ref) => {
1889
1993
  });
1890
1994
  if (process.env.NODE_ENV !== "production") SidebarContainer.displayName = "SidebarContainer";
1891
1995
 
1892
- var _excluded$a = ["onClick", "children"];
1996
+ var _excluded$b = ["onClick", "children"];
1893
1997
  function SidebarBackButton(_ref) {
1894
1998
  var {
1895
1999
  onClick: _onClick,
@@ -1897,7 +2001,7 @@ function SidebarBackButton(_ref) {
1897
2001
  fontSize: "small"
1898
2002
  })
1899
2003
  } = _ref,
1900
- props = _objectWithoutProperties(_ref, _excluded$a);
2004
+ props = _objectWithoutProperties(_ref, _excluded$b);
1901
2005
  var isCollapsed = ui.useCollapseBreakpoint('sm');
1902
2006
  var {
1903
2007
  openSidebar
@@ -2275,6 +2379,7 @@ exports.Container = Container;
2275
2379
  exports.DescriptionItem = DescriptionItem;
2276
2380
  exports.DescriptionLineItem = DescriptionLineItem;
2277
2381
  exports.DottedLine = DottedLine;
2382
+ exports.EmailAutocomplete = EmailAutocomplete;
2278
2383
  exports.FileDropZone = FileDropZone;
2279
2384
  exports.FileListItem = FileListItem;
2280
2385
  exports.FlagList = FlagList;