sag_components 2.0.0-beta330 → 2.0.0-beta331

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/index.js CHANGED
@@ -12405,13 +12405,16 @@ const Td$1 = styled__default["default"].td`
12405
12405
  `;
12406
12406
  const Tr = styled__default["default"].tr`
12407
12407
  border-bottom: 1px solid #f3f4f6;
12408
- ${({
12409
- enableHover,
12410
- selectHoverColor
12411
- }) => enableHover && `&:hover {
12408
+ ${_ref => {
12409
+ let {
12410
+ enableHover,
12411
+ selectHoverColor
12412
+ } = _ref;
12413
+ return enableHover && `&:hover {
12412
12414
  background-color: ${selectHoverColor};
12413
12415
  cursor: pointer;
12414
- }`}
12416
+ }`;
12417
+ }}
12415
12418
  `;
12416
12419
  const InfoText = styled__default["default"].div`
12417
12420
  font-weight: 400;
@@ -49309,14 +49312,32 @@ const NewSubitem = ({
49309
49312
  componentText = "Scale",
49310
49313
  itemAndPackage,
49311
49314
  brandSuggestions = [],
49312
- onBrandSaved
49315
+ onBrandSaved,
49316
+ onFetchBrandSuggestions = null
49313
49317
  }) => {
49314
49318
  const [negotiatedBrands, setNegotiatedBrands] = React$1.useState("");
49315
49319
  const [negotiatedComponent, setNegotiatedComponent] = React$1.useState(componentText);
49316
49320
  const [isPackageDuplicated, setIsPackageDuplicated] = React$1.useState(false);
49317
49321
  // Form state
49318
49322
  const [isApplyEnabled, setIsApplyEnabled] = React$1.useState(negotiatedBrands.trim().length > 2);
49319
- const vendorSuggestions = React$1.useMemo(() => brandSuggestions.filter(s => s.vendor === vendor.name), [brandSuggestions, vendor.name]);
49323
+ const [fetchedSuggestions, setFetchedSuggestions] = React$1.useState([]);
49324
+ React$1.useEffect(() => {
49325
+ let aborted = false;
49326
+ if (onFetchBrandSuggestions && vendor?.name) {
49327
+ onFetchBrandSuggestions(vendor.name).then(results => {
49328
+ if (!aborted) setFetchedSuggestions(results);
49329
+ }).catch(() => {
49330
+ if (!aborted) setFetchedSuggestions([]);
49331
+ });
49332
+ }
49333
+ return () => {
49334
+ aborted = true;
49335
+ };
49336
+ }, [onFetchBrandSuggestions, vendor?.name]);
49337
+ const vendorSuggestions = React$1.useMemo(() => {
49338
+ if (onFetchBrandSuggestions) return fetchedSuggestions;
49339
+ return brandSuggestions.filter(s => s.vendor === vendor.name);
49340
+ }, [brandSuggestions, fetchedSuggestions, onFetchBrandSuggestions, vendor.name]);
49320
49341
  React$1.useEffect(() => {
49321
49342
  if (!packageObject) return;
49322
49343
  if (!packageObject.brands) return;
@@ -49353,7 +49374,7 @@ const NewSubitem = ({
49353
49374
  addNewPackage(vendor.name, negotiatedBrands, negotiatedComponent);
49354
49375
  }
49355
49376
  if (onBrandSaved) {
49356
- onBrandSaved(negotiatedBrands, vendor.name);
49377
+ onBrandSaved(vendor.name, negotiatedBrands);
49357
49378
  }
49358
49379
  },
49359
49380
  rightIcon: "none",
@@ -58068,7 +58089,8 @@ const ItemManagerPanel = _ref => {
58068
58089
  onBackFromList = null,
58069
58090
  onPackageAdded = null,
58070
58091
  brandSuggestions = [],
58071
- onBrandSaved = null
58092
+ onBrandSaved = null,
58093
+ onFetchBrandSuggestions = null
58072
58094
  } = _ref;
58073
58095
  const [screen, setScreen] = React$1.useState("initial");
58074
58096
  const [selectedVendor, setSelectedVendor] = React$1.useState(null);
@@ -58080,7 +58102,6 @@ const ItemManagerPanel = _ref => {
58080
58102
  const scrollWrapperRef = React$1.useRef(null);
58081
58103
  const headerRef = React$1.useRef(null);
58082
58104
  React$1.useEffect(() => {
58083
- console.log("brandSuggestions", brandSuggestions);
58084
58105
  if (headerRef.current) {
58085
58106
  setHeaderHeight(headerRef.current.offsetHeight);
58086
58107
  }
@@ -58286,7 +58307,8 @@ const ItemManagerPanel = _ref => {
58286
58307
  onBack: () => setScreen("subitem"),
58287
58308
  componentText: componentText,
58288
58309
  brandSuggestions: brandSuggestions,
58289
- onBrandSaved: onBrandSaved
58310
+ onBrandSaved: onBrandSaved,
58311
+ onFetchBrandSuggestions: onFetchBrandSuggestions
58290
58312
  }));
58291
58313
  }
58292
58314
  if (screen === "list") {
@@ -59452,28 +59474,25 @@ const LinkText = styled__default["default"].span`
59452
59474
  `;
59453
59475
 
59454
59476
  // OkCircleIcon.jsx
59455
- const OkCircleIcon = _ref => {
59456
- let {
59457
- width = '40',
59458
- height = '40',
59459
- color = '#519595'
59460
- } = _ref;
59461
- return /*#__PURE__*/React__default["default"].createElement("svg", {
59462
- width: width,
59463
- height: height,
59464
- viewBox: "0 0 40 40",
59465
- fill: "none",
59466
- xmlns: "http://www.w3.org/2000/svg"
59467
- }, /*#__PURE__*/React__default["default"].createElement("rect", {
59468
- width: "40",
59469
- height: "40",
59470
- rx: "20",
59471
- fill: color
59472
- }), /*#__PURE__*/React__default["default"].createElement("path", {
59473
- d: "M20.0176 12.6875C17.3809 12.6875 14.9902 14.0938 13.6543 16.3438C12.3535 18.6289 12.3535 21.4062 13.6543 23.6562C14.9902 25.9414 17.3809 27.3125 20.0176 27.3125C22.6191 27.3125 25.0098 25.9414 26.3457 23.6562C27.6465 21.4062 27.6465 18.6289 26.3457 16.3438C25.0098 14.0938 22.6191 12.6875 20.0176 12.6875ZM20.0176 29C16.7832 29 13.8301 27.3125 12.2129 24.5C10.5957 21.7227 10.5957 18.3125 12.2129 15.5C13.8301 12.7227 16.7832 11 20.0176 11C23.2168 11 26.1699 12.7227 27.7871 15.5C29.4043 18.3125 29.4043 21.7227 27.7871 24.5C26.1699 27.3125 23.2168 29 20.0176 29ZM23.9902 18.3477L19.4902 22.8477C19.1387 23.1992 18.6113 23.1992 18.2949 22.8477L16.0449 20.5977C15.6934 20.2812 15.6934 19.7539 16.0449 19.4375C16.3613 19.0859 16.8887 19.0859 17.2402 19.4375L18.8926 21.0898L22.7949 17.1875C23.1113 16.8359 23.6387 16.8359 23.9902 17.1875C24.3066 17.5039 24.3066 18.0312 23.9902 18.3477Z",
59474
- fill: "white"
59475
- }));
59476
- };
59477
+ const OkCircleIcon = ({
59478
+ width = '40',
59479
+ height = '40',
59480
+ color = '#519595'
59481
+ }) => /*#__PURE__*/React__default["default"].createElement("svg", {
59482
+ width: width,
59483
+ height: height,
59484
+ viewBox: "0 0 40 40",
59485
+ fill: "none",
59486
+ xmlns: "http://www.w3.org/2000/svg"
59487
+ }, /*#__PURE__*/React__default["default"].createElement("rect", {
59488
+ width: "40",
59489
+ height: "40",
59490
+ rx: "20",
59491
+ fill: color
59492
+ }), /*#__PURE__*/React__default["default"].createElement("path", {
59493
+ d: "M20.0176 12.6875C17.3809 12.6875 14.9902 14.0938 13.6543 16.3438C12.3535 18.6289 12.3535 21.4062 13.6543 23.6562C14.9902 25.9414 17.3809 27.3125 20.0176 27.3125C22.6191 27.3125 25.0098 25.9414 26.3457 23.6562C27.6465 21.4062 27.6465 18.6289 26.3457 16.3438C25.0098 14.0938 22.6191 12.6875 20.0176 12.6875ZM20.0176 29C16.7832 29 13.8301 27.3125 12.2129 24.5C10.5957 21.7227 10.5957 18.3125 12.2129 15.5C13.8301 12.7227 16.7832 11 20.0176 11C23.2168 11 26.1699 12.7227 27.7871 15.5C29.4043 18.3125 29.4043 21.7227 27.7871 24.5C26.1699 27.3125 23.2168 29 20.0176 29ZM23.9902 18.3477L19.4902 22.8477C19.1387 23.1992 18.6113 23.1992 18.2949 22.8477L16.0449 20.5977C15.6934 20.2812 15.6934 19.7539 16.0449 19.4375C16.3613 19.0859 16.8887 19.0859 17.2402 19.4375L18.8926 21.0898L22.7949 17.1875C23.1113 16.8359 23.6387 16.8359 23.9902 17.1875C24.3066 17.5039 24.3066 18.0312 23.9902 18.3477Z",
59494
+ fill: "white"
59495
+ }));
59477
59496
 
59478
59497
  // ToasterMessageBox.jsx
59479
59498
  const ToasterMessageBox = _ref => {