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.d.ts CHANGED
@@ -1558,7 +1558,7 @@ declare function RangePop(props: any): react_jsx_runtime.JSX.Element;
1558
1558
 
1559
1559
  declare function SearchInput(props: any): react_jsx_runtime.JSX.Element;
1560
1560
 
1561
- declare function ItemManagerPanel({ width, height, disableSection, onSendForms, editMode, disabledSendForms, AllFormsSent, itemAndPackage, setItemAndPackage, linkColor, backgroundColor, buttonTooltipText, trashTooltipText, maxVisibleVendors, componentText, SubTitleColor, searchValue, onSearchChange, searchResults, filteredVendors, isSearchLoading, isLoading, isLoadingText, onLastRowsReached, lastRowsThreshold, onBackFromList, onPackageAdded, brandSuggestions, onBrandSaved, }: {
1561
+ declare function ItemManagerPanel({ width, height, disableSection, onSendForms, editMode, disabledSendForms, AllFormsSent, itemAndPackage, setItemAndPackage, linkColor, backgroundColor, buttonTooltipText, trashTooltipText, maxVisibleVendors, componentText, SubTitleColor, searchValue, onSearchChange, searchResults, filteredVendors, isSearchLoading, isLoading, isLoadingText, onLastRowsReached, lastRowsThreshold, onBackFromList, onPackageAdded, brandSuggestions, onBrandSaved, onFetchBrandSuggestions, }: {
1562
1562
  width?: string;
1563
1563
  height?: string;
1564
1564
  disableSection?: boolean;
@@ -1588,6 +1588,7 @@ declare function ItemManagerPanel({ width, height, disableSection, onSendForms,
1588
1588
  onPackageAdded?: any;
1589
1589
  brandSuggestions?: any[];
1590
1590
  onBrandSaved?: any;
1591
+ onFetchBrandSuggestions?: any;
1591
1592
  }): react_jsx_runtime.JSX.Element;
1592
1593
 
1593
1594
  /**
package/dist/index.esm.js CHANGED
@@ -12395,13 +12395,16 @@ const Td$1 = styled.td`
12395
12395
  `;
12396
12396
  const Tr = styled.tr`
12397
12397
  border-bottom: 1px solid #f3f4f6;
12398
- ${({
12399
- enableHover,
12400
- selectHoverColor
12401
- }) => enableHover && `&:hover {
12398
+ ${_ref => {
12399
+ let {
12400
+ enableHover,
12401
+ selectHoverColor
12402
+ } = _ref;
12403
+ return enableHover && `&:hover {
12402
12404
  background-color: ${selectHoverColor};
12403
12405
  cursor: pointer;
12404
- }`}
12406
+ }`;
12407
+ }}
12405
12408
  `;
12406
12409
  const InfoText = styled.div`
12407
12410
  font-weight: 400;
@@ -49299,14 +49302,32 @@ const NewSubitem = ({
49299
49302
  componentText = "Scale",
49300
49303
  itemAndPackage,
49301
49304
  brandSuggestions = [],
49302
- onBrandSaved
49305
+ onBrandSaved,
49306
+ onFetchBrandSuggestions = null
49303
49307
  }) => {
49304
49308
  const [negotiatedBrands, setNegotiatedBrands] = useState("");
49305
49309
  const [negotiatedComponent, setNegotiatedComponent] = useState(componentText);
49306
49310
  const [isPackageDuplicated, setIsPackageDuplicated] = useState(false);
49307
49311
  // Form state
49308
49312
  const [isApplyEnabled, setIsApplyEnabled] = useState(negotiatedBrands.trim().length > 2);
49309
- const vendorSuggestions = useMemo(() => brandSuggestions.filter(s => s.vendor === vendor.name), [brandSuggestions, vendor.name]);
49313
+ const [fetchedSuggestions, setFetchedSuggestions] = useState([]);
49314
+ useEffect(() => {
49315
+ let aborted = false;
49316
+ if (onFetchBrandSuggestions && vendor?.name) {
49317
+ onFetchBrandSuggestions(vendor.name).then(results => {
49318
+ if (!aborted) setFetchedSuggestions(results);
49319
+ }).catch(() => {
49320
+ if (!aborted) setFetchedSuggestions([]);
49321
+ });
49322
+ }
49323
+ return () => {
49324
+ aborted = true;
49325
+ };
49326
+ }, [onFetchBrandSuggestions, vendor?.name]);
49327
+ const vendorSuggestions = useMemo(() => {
49328
+ if (onFetchBrandSuggestions) return fetchedSuggestions;
49329
+ return brandSuggestions.filter(s => s.vendor === vendor.name);
49330
+ }, [brandSuggestions, fetchedSuggestions, onFetchBrandSuggestions, vendor.name]);
49310
49331
  useEffect(() => {
49311
49332
  if (!packageObject) return;
49312
49333
  if (!packageObject.brands) return;
@@ -49343,7 +49364,7 @@ const NewSubitem = ({
49343
49364
  addNewPackage(vendor.name, negotiatedBrands, negotiatedComponent);
49344
49365
  }
49345
49366
  if (onBrandSaved) {
49346
- onBrandSaved(negotiatedBrands, vendor.name);
49367
+ onBrandSaved(vendor.name, negotiatedBrands);
49347
49368
  }
49348
49369
  },
49349
49370
  rightIcon: "none",
@@ -58058,7 +58079,8 @@ const ItemManagerPanel = _ref => {
58058
58079
  onBackFromList = null,
58059
58080
  onPackageAdded = null,
58060
58081
  brandSuggestions = [],
58061
- onBrandSaved = null
58082
+ onBrandSaved = null,
58083
+ onFetchBrandSuggestions = null
58062
58084
  } = _ref;
58063
58085
  const [screen, setScreen] = useState("initial");
58064
58086
  const [selectedVendor, setSelectedVendor] = useState(null);
@@ -58070,7 +58092,6 @@ const ItemManagerPanel = _ref => {
58070
58092
  const scrollWrapperRef = useRef(null);
58071
58093
  const headerRef = useRef(null);
58072
58094
  useEffect(() => {
58073
- console.log("brandSuggestions", brandSuggestions);
58074
58095
  if (headerRef.current) {
58075
58096
  setHeaderHeight(headerRef.current.offsetHeight);
58076
58097
  }
@@ -58276,7 +58297,8 @@ const ItemManagerPanel = _ref => {
58276
58297
  onBack: () => setScreen("subitem"),
58277
58298
  componentText: componentText,
58278
58299
  brandSuggestions: brandSuggestions,
58279
- onBrandSaved: onBrandSaved
58300
+ onBrandSaved: onBrandSaved,
58301
+ onFetchBrandSuggestions: onFetchBrandSuggestions
58280
58302
  }));
58281
58303
  }
58282
58304
  if (screen === "list") {
@@ -59442,28 +59464,25 @@ const LinkText = styled.span`
59442
59464
  `;
59443
59465
 
59444
59466
  // OkCircleIcon.jsx
59445
- const OkCircleIcon = _ref => {
59446
- let {
59447
- width = '40',
59448
- height = '40',
59449
- color = '#519595'
59450
- } = _ref;
59451
- return /*#__PURE__*/React$1.createElement("svg", {
59452
- width: width,
59453
- height: height,
59454
- viewBox: "0 0 40 40",
59455
- fill: "none",
59456
- xmlns: "http://www.w3.org/2000/svg"
59457
- }, /*#__PURE__*/React$1.createElement("rect", {
59458
- width: "40",
59459
- height: "40",
59460
- rx: "20",
59461
- fill: color
59462
- }), /*#__PURE__*/React$1.createElement("path", {
59463
- 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",
59464
- fill: "white"
59465
- }));
59466
- };
59467
+ const OkCircleIcon = ({
59468
+ width = '40',
59469
+ height = '40',
59470
+ color = '#519595'
59471
+ }) => /*#__PURE__*/React$1.createElement("svg", {
59472
+ width: width,
59473
+ height: height,
59474
+ viewBox: "0 0 40 40",
59475
+ fill: "none",
59476
+ xmlns: "http://www.w3.org/2000/svg"
59477
+ }, /*#__PURE__*/React$1.createElement("rect", {
59478
+ width: "40",
59479
+ height: "40",
59480
+ rx: "20",
59481
+ fill: color
59482
+ }), /*#__PURE__*/React$1.createElement("path", {
59483
+ 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",
59484
+ fill: "white"
59485
+ }));
59467
59486
 
59468
59487
  // ToasterMessageBox.jsx
59469
59488
  const ToasterMessageBox = _ref => {