@superdispatch/ui-lab 0.46.0 → 0.47.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.
@@ -867,7 +867,100 @@ 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
+ value: value,
907
+ disableClearable: true,
908
+ filterSelectedOptions: true,
909
+ filterOptions: _filterOptions => {
910
+ return _filterOptions.filter(option => option !== '');
911
+ },
912
+ onChange: (_event, selectedValue, reason) => {
913
+ var emails = selectedValue.flatMap(item => item.split(',')).map(item => item.trim());
914
+ _onChange === null || _onChange === void 0 ? void 0 : _onChange(emails, reason);
915
+ },
916
+ renderTags: items => {
917
+ return /*#__PURE__*/jsxRuntime.jsx(ui.Inline, {
918
+ space: "xxsmall",
919
+ children: items.map((option, index) => {
920
+ return /*#__PURE__*/jsxRuntime.jsx(ui.Tag, {
921
+ color: "grey",
922
+ variant: "subtle",
923
+ children: /*#__PURE__*/jsxRuntime.jsxs(ui.Inline, {
924
+ space: "xxsmall",
925
+ children: [/*#__PURE__*/jsxRuntime.jsx(uiLab.TextBox, {
926
+ wrapOverflow: true,
927
+ color: "primary",
928
+ children: option
929
+ }), /*#__PURE__*/jsxRuntime.jsx(core.IconButton, {
930
+ size: "small",
931
+ onClick: () => {
932
+ handleDelete(index);
933
+ },
934
+ children: /*#__PURE__*/jsxRuntime.jsx(CloseIcon, {})
935
+ })]
936
+ })
937
+ }, index);
938
+ })
939
+ });
940
+ },
941
+ renderInput: params => /*#__PURE__*/jsxRuntime.jsx(MultipleFieldText, _objectSpread(_objectSpread(_objectSpread({}, params), TextFieldProps), {}, {
942
+ multiline: true,
943
+ minRows: 2,
944
+ variant: "outlined",
945
+ fullWidth: true,
946
+ InputProps: _objectSpread(_objectSpread(_objectSpread({}, TextFieldProps === null || TextFieldProps === void 0 ? void 0 : TextFieldProps.InputProps), params.InputProps), {}, {
947
+ startAdornment: params.InputProps.startAdornment
948
+ }),
949
+ placeholder: "Enter individual emails on each line or separate them with comma (,)",
950
+ onChange: event => {
951
+ var text = event.target.value.replace(/,/g, '');
952
+ var hasCommaOrSpace = /,|\s/.test(event.target.value);
953
+ if (hasCommaOrSpace && text.trim() !== '') {
954
+ _onChange === null || _onChange === void 0 ? void 0 : _onChange([...(value || []), text.trim()], 'select-option');
955
+ }
956
+ }
957
+ }))
958
+ }));
959
+ });
960
+ if (process.env.NODE_ENV !== "production") EmailAutocomplete.displayName = "EmailAutocomplete";
961
+ EmailAutocomplete.displayName = 'EmailAutocomplete';
962
+
963
+ var _excluded$6 = ["disabled", "children", "hintText", "startIcon", "fallback", "accept", "maxSize", "maxFiles", "onDropRejected", "onDropAccepted"];
871
964
  function toBytes(input, unit) {
872
965
  if (unit === 'gb') return input * (1 << 30);
873
966
  if (unit === 'mb') return input * (1 << 20);
@@ -936,7 +1029,7 @@ var FileDropZone = /*#__PURE__*/react.forwardRef((props, ref) => {
936
1029
  onDropRejected: _onDropRejected,
937
1030
  onDropAccepted: _onDropAccepted
938
1031
  } = props,
939
- dropzoneProps = _objectWithoutProperties(props, _excluded$5);
1032
+ dropzoneProps = _objectWithoutProperties(props, _excluded$6);
940
1033
  return /*#__PURE__*/jsxRuntime.jsx(react.Suspense, {
941
1034
  fallback: fallback,
942
1035
  children: /*#__PURE__*/jsxRuntime.jsx(Dropzone, _objectSpread(_objectSpread({}, dropzoneProps), {}, {
@@ -1133,7 +1226,7 @@ var FlagList = /*#__PURE__*/react.forwardRef((_ref2, ref) => {
1133
1226
  });
1134
1227
  if (process.env.NODE_ENV !== "production") FlagList.displayName = "FlagList";
1135
1228
 
1136
- var _excluded$6 = ["variant", "showHelpIcon", "endAction", "children"];
1229
+ var _excluded$7 = ["variant", "showHelpIcon", "endAction", "children"];
1137
1230
  var IconContainer = /*#__PURE__*/styled__default.div.withConfig({
1138
1231
  displayName: "FlagListItem__IconContainer",
1139
1232
  componentId: "SD__sc-o5bqru-0"
@@ -1193,7 +1286,7 @@ var FlagListItem = /*#__PURE__*/react.forwardRef((_ref7, ref) => {
1193
1286
  endAction,
1194
1287
  children
1195
1288
  } = _ref7,
1196
- rest = _objectWithoutProperties(_ref7, _excluded$6);
1289
+ rest = _objectWithoutProperties(_ref7, _excluded$7);
1197
1290
  return /*#__PURE__*/jsxRuntime.jsxs(BannerListContainer, _objectSpread(_objectSpread({}, rest), {}, {
1198
1291
  ref: ref,
1199
1292
  $variant: variant,
@@ -1210,7 +1303,7 @@ var FlagListItem = /*#__PURE__*/react.forwardRef((_ref7, ref) => {
1210
1303
  });
1211
1304
  if (process.env.NODE_ENV !== "production") FlagListItem.displayName = "FlagListItem";
1212
1305
 
1213
- var _excluded$7 = ["color", "target", "rel"],
1306
+ var _excluded$8 = ["color", "target", "rel"],
1214
1307
  _excluded2$2 = ["children", "linkComponent"];
1215
1308
  var DefaultLinkComponent = /*#__PURE__*/react.forwardRef((_ref, ref) => {
1216
1309
  var {
@@ -1218,7 +1311,7 @@ var DefaultLinkComponent = /*#__PURE__*/react.forwardRef((_ref, ref) => {
1218
1311
  target = '_blank',
1219
1312
  rel = 'noreferrer noopener'
1220
1313
  } = _ref,
1221
- props = _objectWithoutProperties(_ref, _excluded$7);
1314
+ props = _objectWithoutProperties(_ref, _excluded$8);
1222
1315
  return /*#__PURE__*/jsxRuntime.jsx(core.Link, _objectSpread(_objectSpread({}, props), {}, {
1223
1316
  ref: ref,
1224
1317
  rel: rel,
@@ -1264,7 +1357,7 @@ function useNavbarContext() {
1264
1357
  return react.useContext(NavbarContext);
1265
1358
  }
1266
1359
 
1267
- var _excluded$8 = ["active", "hasBadge"];
1360
+ var _excluded$9 = ["active", "hasBadge"];
1268
1361
  var StyledBottomNavigation = /*#__PURE__*/styled__default(core.BottomNavigation).withConfig({
1269
1362
  displayName: "NavbarBottomBar__StyledBottomNavigation",
1270
1363
  componentId: "SD__sc-9z6v3k-0"
@@ -1308,7 +1401,7 @@ function NavbarBottomBar(_ref) {
1308
1401
  active,
1309
1402
  hasBadge
1310
1403
  } = _ref2,
1311
- item = _objectWithoutProperties(_ref2, _excluded$8);
1404
+ item = _objectWithoutProperties(_ref2, _excluded$9);
1312
1405
  return /*#__PURE__*/react.createElement(StyledBottomNavigationAction, _objectSpread(_objectSpread({}, item), {}, {
1313
1406
  key: item.value,
1314
1407
  icon: hasBadge ? /*#__PURE__*/jsxRuntime.jsxs(IconWrapper, {
@@ -1668,7 +1761,7 @@ function Navbar(_ref) {
1668
1761
  });
1669
1762
  }
1670
1763
 
1671
- var _excluded$9 = ["title", "subtitle", "children"];
1764
+ var _excluded$a = ["title", "subtitle", "children"];
1672
1765
  var StyledTypography = /*#__PURE__*/styled__default(core.Typography).withConfig({
1673
1766
  displayName: "NavbarAvatar__StyledTypography",
1674
1767
  componentId: "SD__sc-19q2zd0-0"
@@ -1679,7 +1772,7 @@ function NavbarAvatar(_ref) {
1679
1772
  subtitle,
1680
1773
  children
1681
1774
  } = _ref,
1682
- props = _objectWithoutProperties(_ref, _excluded$9);
1775
+ props = _objectWithoutProperties(_ref, _excluded$a);
1683
1776
  var {
1684
1777
  isNavbarExpanded
1685
1778
  } = useNavbarContext();
@@ -1889,7 +1982,7 @@ var SidebarContainer = /*#__PURE__*/react.forwardRef((_ref, ref) => {
1889
1982
  });
1890
1983
  if (process.env.NODE_ENV !== "production") SidebarContainer.displayName = "SidebarContainer";
1891
1984
 
1892
- var _excluded$a = ["onClick", "children"];
1985
+ var _excluded$b = ["onClick", "children"];
1893
1986
  function SidebarBackButton(_ref) {
1894
1987
  var {
1895
1988
  onClick: _onClick,
@@ -1897,7 +1990,7 @@ function SidebarBackButton(_ref) {
1897
1990
  fontSize: "small"
1898
1991
  })
1899
1992
  } = _ref,
1900
- props = _objectWithoutProperties(_ref, _excluded$a);
1993
+ props = _objectWithoutProperties(_ref, _excluded$b);
1901
1994
  var isCollapsed = ui.useCollapseBreakpoint('sm');
1902
1995
  var {
1903
1996
  openSidebar
@@ -2275,6 +2368,7 @@ exports.Container = Container;
2275
2368
  exports.DescriptionItem = DescriptionItem;
2276
2369
  exports.DescriptionLineItem = DescriptionLineItem;
2277
2370
  exports.DottedLine = DottedLine;
2371
+ exports.EmailAutocomplete = EmailAutocomplete;
2278
2372
  exports.FileDropZone = FileDropZone;
2279
2373
  exports.FileListItem = FileListItem;
2280
2374
  exports.FlagList = FlagList;