sag_components 2.0.0-beta275 → 2.0.0-beta277

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
@@ -1578,29 +1578,29 @@ declare function ModalDrawer({ open, height, onClose, children, widthPercent }:
1578
1578
  widthPercent?: number;
1579
1579
  }): react_jsx_runtime.JSX.Element;
1580
1580
 
1581
- declare function OverlayDropdown({ data, value, onSelectClick, disabled, isDarkerBackground, required, selectedColor, hoverColor, dropdownMaxHeight, width, minWidth, height, label, labelEmptyValue, showLabelOnTop, placeHolder, labelColor, placeHolderColor, margin, dropdownWidth, editableDigitalCoupon, ...props }: {
1581
+ declare function OverlayDropdown({ data, value, onSelectClick, label, labelEmptyValue, showLabelOnTop, labelColor, placeHolder, placeHolderColor, required, disabled, isDarkerBackground, editableDigitalCoupon, selectedColor, hoverColor, width, minWidth, dropdownWidth, dropdownMaxHeight, height, margin, ...props }: {
1582
1582
  [x: string]: any;
1583
1583
  data?: any[];
1584
1584
  value: any;
1585
1585
  onSelectClick: any;
1586
+ label: any;
1587
+ labelEmptyValue: any;
1588
+ showLabelOnTop: any;
1589
+ labelColor: any;
1590
+ placeHolder: any;
1591
+ placeHolderColor: any;
1592
+ required?: boolean;
1586
1593
  disabled?: boolean;
1587
1594
  isDarkerBackground?: boolean;
1588
- required?: boolean;
1595
+ editableDigitalCoupon?: boolean;
1589
1596
  selectedColor?: string;
1590
1597
  hoverColor?: string;
1591
- dropdownMaxHeight?: string;
1592
1598
  width?: string;
1593
1599
  minWidth?: string;
1600
+ dropdownWidth?: string;
1601
+ dropdownMaxHeight?: string;
1594
1602
  height?: string;
1595
- label: any;
1596
- labelEmptyValue: any;
1597
- showLabelOnTop: any;
1598
- placeHolder: any;
1599
- labelColor: any;
1600
- placeHolderColor: any;
1601
1603
  margin?: string;
1602
- dropdownWidth?: string;
1603
- editableDigitalCoupon?: boolean;
1604
1604
  }): react_jsx_runtime.JSX.Element;
1605
1605
 
1606
1606
  declare function MessageBox({ isOpen, isDisabled, onClose, onConfirm, title, primaryText, secondaryText, width, height, color, hoverColor, opacity, secondaryColor, seperateSectionBorder, children, tooltipContent, }: {
package/dist/index.esm.js CHANGED
@@ -9292,7 +9292,6 @@ const Label$7 = styled.label`
9292
9292
  return props.isFocused || props.hasValue ? '0px' : `${height / 2 - 4}px`;
9293
9293
  }};
9294
9294
  left: ${props => props.isFocused || props.hasValue ? '23px' : '10px'};
9295
- font-family: Poppins;
9296
9295
  transform: translateY(-50%);
9297
9296
  transition: ${props => props.showLabelOnTop ? 'top 0.3s ease, font-size 0.3s ease, color 0.3s ease' : ''} ;
9298
9297
  display: flex;
@@ -24543,7 +24542,6 @@ const OptionsContainer$1 = styled.div`
24543
24542
  width: 100%;
24544
24543
  background-color: #fff;
24545
24544
  display: ${props => props.showoptions && props.filteredoptions?.length > 0 ? 'block' : 'none'};
24546
-
24547
24545
  `;
24548
24546
  const OptionsSubContainer = styled.ul`
24549
24547
  list-style: none;
@@ -24555,7 +24553,6 @@ const OptionsSubContainer = styled.ul`
24555
24553
  left: 0;
24556
24554
  z-index: 101;
24557
24555
  width: calc(100% - 23px);
24558
- font-family: Poppins;
24559
24556
  border-radius: 4px;
24560
24557
  background-color: #fff;
24561
24558
  display: ${props => props.showoptions && props.filteredoptions?.length > 0 ? 'block' : 'none'};
@@ -24566,13 +24563,10 @@ const OptionsSubContainer = styled.ul`
24566
24563
  const OptionItem = styled.li`
24567
24564
  display: flex;
24568
24565
  align-items: center;
24569
- gap: 8px;
24570
24566
  padding: 10px;
24571
24567
  cursor: pointer;
24572
24568
  color: #212121;
24573
- font-family: Poppins;
24574
24569
  font-size: 14px;
24575
- font-style: normal;
24576
24570
  font-weight: 400;
24577
24571
  transition: background-color 0.3s;
24578
24572
 
@@ -24587,7 +24581,6 @@ const ErrorMessage$1 = styled.div`
24587
24581
  `;
24588
24582
  const SelectedOptionsContainer = styled.div`
24589
24583
  display: flex;
24590
- flex-direction: row;
24591
24584
  align-items: center;
24592
24585
  gap: 4px;
24593
24586
  flex-wrap: nowrap;
@@ -24636,7 +24629,8 @@ const SelectedOptionCount = styled.div`
24636
24629
  const IconContainer$2 = styled.div`
24637
24630
  display: flex;
24638
24631
  padding: 2px;
24639
- cursor: pointer;
24632
+ margin-right: 8px;
24633
+ cursor: pointer;
24640
24634
  `;
24641
24635
 
24642
24636
  const QuickFilterDropdownMultiSelection = _ref => {
@@ -35687,7 +35681,7 @@ const Label$3 = styled.label`
35687
35681
  if (props.multiline) {
35688
35682
  return props.isFocused || props.hasValue ? '0px' : '20px';
35689
35683
  }
35690
- return props.isFocused || props.hasValue ? '0px' : props.size === 'medium' ? '27px' : '17px';
35684
+ return props.isFocused || props.hasValue ? '0px' : props.size === 'medium' ? '50%' : '17px';
35691
35685
  }};
35692
35686
  left: ${props => {
35693
35687
  if (props.multiline) {
@@ -35695,7 +35689,6 @@ const Label$3 = styled.label`
35695
35689
  }
35696
35690
  return props.isFocused || props.hasValue ? '23px' : props.leftIcon && props.leftIcon !== 'none' ? '42px' : '16px';
35697
35691
  }};
35698
- font-family: Poppins;
35699
35692
  transform: translateY(-50%);
35700
35693
  transition: top 0.3s ease, font-size 0.3s ease, color 0.3s ease;
35701
35694
  display: flex;
@@ -37428,8 +37421,8 @@ const ColumnContent = styled.div`
37428
37421
  min-height: 20px;
37429
37422
  `;
37430
37423
  const ColumnCheckbox = styled.input`
37431
- width: 16px;
37432
- height: 16px;
37424
+ width: 18px;
37425
+ height: 18px;
37433
37426
  cursor: pointer;
37434
37427
  margin: 0;
37435
37428
  `;
@@ -40413,6 +40406,7 @@ const Radio = styled.input`
40413
40406
  `;
40414
40407
  const Actions$1 = styled.div`
40415
40408
  display: flex;
40409
+ align-items: center;
40416
40410
  justify-content: space-between;
40417
40411
  padding-top: 12px;
40418
40412
  `;
@@ -41341,14 +41335,7 @@ const TableHeader = ({
41341
41335
  onChange: e => handleHeaderCheckboxClick(column.key, e),
41342
41336
  "data-column": column.key,
41343
41337
  style: {
41344
- width: '18px',
41345
- height: '18px',
41346
- marginLeft: '10px',
41347
- cursor: 'pointer',
41348
- accentColor: '#066768',
41349
- display: 'flex',
41350
- alignItems: 'center',
41351
- justifyContent: 'center'
41338
+ accentColor: '#066768'
41352
41339
  }
41353
41340
  }), column.title && /*#__PURE__*/React$1.createElement(ColumnLabel, null, column.title), (column.filter || column.sort) && /*#__PURE__*/React$1.createElement(ColumnActions, null, column.sort && /*#__PURE__*/React$1.createElement(IconButton, {
41354
41341
  ref: el => iconRefs.current[`sort-${column.key}`] = el,
@@ -42106,6 +42093,18 @@ styled.div`
42106
42093
  }
42107
42094
  `}
42108
42095
  `;
42096
+ const CheckboxInput = styled.input`
42097
+ width: 18px;
42098
+ height: 18px;
42099
+ margin: 0;
42100
+ accent-color: ${props => props.buttonColor || '#066768'};
42101
+ cursor: pointer;
42102
+
42103
+ &:disabled {
42104
+ cursor: not-allowed;
42105
+ opacity: 0.5;
42106
+ }
42107
+ `;
42109
42108
  const HeroButton = styled.button`
42110
42109
  display: flex;
42111
42110
  align-items: center;
@@ -42749,6 +42748,7 @@ const TableBody = /*#__PURE__*/forwardRef(({
42749
42748
  onDropdownSelected = () => {},
42750
42749
  onCheckboxClick = () => {},
42751
42750
  onHeaderCheckboxClick = () => {},
42751
+ disableCheckboxTooltipText = "",
42752
42752
  onHeroClick = () => {},
42753
42753
  onEditableClick = () => {},
42754
42754
  isEditMode = false,
@@ -43152,12 +43152,12 @@ const TableBody = /*#__PURE__*/forwardRef(({
43152
43152
  hoverTextColor: "#B1B1B1",
43153
43153
  hoverBackgroundColor: "#E6F0F0",
43154
43154
  hoverBorderColor: "#D9D9D9",
43155
+ disabled: true,
43155
43156
  disabledTextColor: "#B1B1B1",
43156
- disabledBackgroundColor: focusedRowIndex === rowIndex ? "#D1E7E7" : hoveredRowIndex === rowIndex ? "#E6F0F0" : "#FFF",
43157
43157
  disabledBorderColor: "#D9D9D9",
43158
+ disabledBackgroundColor: focusedRowIndex === rowIndex ? "#D1E7E7" : hoveredRowIndex === rowIndex ? "#E6F0F0" : "#FFF",
43158
43159
  width: "100px",
43159
- height: "32px",
43160
- disabled: true
43160
+ height: "32px"
43161
43161
  }));
43162
43162
  } else if (lowerValue === "draft") {
43163
43163
  return /*#__PURE__*/React$1.createElement(ButtonWrapper, {
@@ -43379,24 +43379,15 @@ const TableBody = /*#__PURE__*/forwardRef(({
43379
43379
  return /*#__PURE__*/React$1.createElement("div", {
43380
43380
  style: {
43381
43381
  display: "flex",
43382
- alignItems: "center",
43383
- justifyContent: "center",
43384
- width: "100%",
43385
- height: "100%"
43382
+ alignItems: "center"
43386
43383
  }
43387
- }, /*#__PURE__*/React$1.createElement("input", {
43384
+ }, /*#__PURE__*/React$1.createElement(CheckboxInput, {
43388
43385
  type: "checkbox",
43389
43386
  checked: isChecked,
43390
43387
  disabled: isDisabled,
43388
+ buttonColor: buttonColor,
43391
43389
  onChange: e => handleCheckboxClick(row, column.key, e),
43392
- onClick: e => e.stopPropagation(),
43393
- style: {
43394
- width: "18px",
43395
- height: "18px",
43396
- cursor: isDisabled ? "not-allowed" : "pointer",
43397
- accentColor: buttonColor,
43398
- opacity: isDisabled ? 0.5 : 1
43399
- }
43390
+ onClick: e => e.stopPropagation()
43400
43391
  }));
43401
43392
  } catch (e) {
43402
43393
  console.warn('Error formatting checkbox:', e);
@@ -47026,6 +47017,7 @@ const Table = props => {
47026
47017
  onCheckboxClick = () => {},
47027
47018
  onHeaderCheckboxClick = () => {},
47028
47019
  headerCheckboxStates = {},
47020
+ disableCheckboxTooltipText = "",
47029
47021
  onHeroClick = () => {},
47030
47022
  dotIndicatorColor = '#34D399',
47031
47023
  onEditableClick = () => {},
@@ -47170,6 +47162,7 @@ const Table = props => {
47170
47162
  onDropdownSelected: onDropdownSelected,
47171
47163
  onCheckboxClick: onCheckboxClick,
47172
47164
  onHeaderCheckboxClick: onHeaderCheckboxClick,
47165
+ disableCheckboxTooltipText: disableCheckboxTooltipText,
47173
47166
  onHeroClick: onHeroClick,
47174
47167
  onEditableClick: onEditableClick,
47175
47168
  isEditMode: isEditMode,
@@ -47603,25 +47596,52 @@ styled.span`
47603
47596
  font-weight: 600;
47604
47597
  `;
47605
47598
 
47599
+ let FixedSizeList = null;
47600
+ try {
47601
+ FixedSizeList = require('react-window').FixedSizeList;
47602
+ } catch (e) {
47603
+ console.error('react-window not found:', e);
47604
+ }
47605
+ const VENDOR_ITEM_HEIGHT = 72;
47606
47606
  const NewItemList = ({
47607
47607
  onBack,
47608
47608
  onVendorClick,
47609
47609
  itemAndPackage
47610
47610
  }) => {
47611
- const [search, setSearch] = useState("");
47611
+ const [debouncedSearch, setDebouncedSearch] = useState("");
47612
47612
  const [headerHeight, setHeaderHeight] = useState(0);
47613
47613
  const headerRef = useRef(null);
47614
+ const searchInputRef = useRef(null);
47615
+ const timerRef = useRef(null);
47614
47616
  useEffect(() => {
47615
47617
  if (headerRef.current) {
47616
47618
  setHeaderHeight(headerRef.current.offsetHeight);
47617
47619
  }
47618
47620
  }, []);
47619
- const searchLower = search.toLowerCase();
47620
- const startsWithMatches = itemAndPackage.filter(i => i.name.toLowerCase().startsWith(searchLower));
47621
- const includesMatches = itemAndPackage.filter(i => !i.name.toLowerCase().startsWith(searchLower) && i.name.toLowerCase().includes(searchLower));
47622
- const filteredItems = [...startsWithMatches, ...includesMatches];
47623
-
47624
- // Helper to highlight matched portions
47621
+ const handleSearchChange = e => {
47622
+ const value = e.target.value;
47623
+ if (timerRef.current) {
47624
+ clearTimeout(timerRef.current);
47625
+ }
47626
+ timerRef.current = setTimeout(() => {
47627
+ setDebouncedSearch(value);
47628
+ }, 100);
47629
+ };
47630
+ const filteredItems = useMemo(() => {
47631
+ if (!debouncedSearch) return itemAndPackage;
47632
+ const searchLower = debouncedSearch.toLowerCase();
47633
+ const results = [];
47634
+ const startsWithResults = [];
47635
+ for (let i = 0; i < itemAndPackage.length; i++) {
47636
+ const nameLower = itemAndPackage[i].name.toLowerCase();
47637
+ if (nameLower.startsWith(searchLower)) {
47638
+ startsWithResults.push(itemAndPackage[i]);
47639
+ } else if (nameLower.includes(searchLower)) {
47640
+ results.push(itemAndPackage[i]);
47641
+ }
47642
+ }
47643
+ return [...startsWithResults, ...results];
47644
+ }, [debouncedSearch, itemAndPackage]);
47625
47645
  const highlightMatch = (text, query) => {
47626
47646
  if (!query) return text;
47627
47647
  const regex = new RegExp(`(${query})`, "ig");
@@ -47631,18 +47651,51 @@ const NewItemList = ({
47631
47651
  };
47632
47652
  const hasValidStatus = pkg => pkg.hasOwnProperty("status") && pkg.status != null && pkg.status !== undefined && pkg.status !== "";
47633
47653
  const draftPackages = pkg => pkg.status === 1;
47654
+ const VendorRow = ({
47655
+ index,
47656
+ style
47657
+ }) => {
47658
+ const item = filteredItems[index];
47659
+ let packagesLength = 0;
47660
+ let sentPackagesLength = 0;
47661
+ if (item.packages !== null) {
47662
+ packagesLength = item.packages.length;
47663
+ sentPackagesLength = item.packages.filter(pkg => hasValidStatus(pkg) && !draftPackages(pkg)).length;
47664
+ }
47665
+ return /*#__PURE__*/React$1.createElement("div", {
47666
+ style: style
47667
+ }, /*#__PURE__*/React$1.createElement(VendorItem, {
47668
+ onClick: e => {
47669
+ if (onVendorClick) {
47670
+ onVendorClick(item);
47671
+ }
47672
+ }
47673
+ }, /*#__PURE__*/React$1.createElement(VendorNameAndPackagesContainer, null, /*#__PURE__*/React$1.createElement(VendorName$1, null, highlightMatch(item.name, debouncedSearch.toLowerCase())), packagesLength > 0 && /*#__PURE__*/React$1.createElement(VendorPackages, null, (() => {
47674
+ const noPackagesSent = sentPackagesLength === 0;
47675
+ if (noPackagesSent) {
47676
+ return `0/${packagesLength} Packages Sent`;
47677
+ } else {
47678
+ return `${sentPackagesLength}/${packagesLength} Packages Sent`;
47679
+ }
47680
+ })())), /*#__PURE__*/React$1.createElement(VendorChevron, null, /*#__PURE__*/React$1.createElement(ArrowRightFullIcon, null))));
47681
+ };
47634
47682
  return /*#__PURE__*/React$1.createElement(VendorSelectionContainer, null, /*#__PURE__*/React$1.createElement(VendorHeader$1, {
47635
47683
  ref: headerRef
47636
47684
  }, /*#__PURE__*/React$1.createElement(VendorRoute, null, /*#__PURE__*/React$1.createElement(VendorBackButton, {
47637
47685
  onClick: onBack
47638
47686
  }, /*#__PURE__*/React$1.createElement(ArrowLeftIcon, null)), /*#__PURE__*/React$1.createElement(VendorBackTitle, null, "Selected Vendors")), /*#__PURE__*/React$1.createElement(VendorSelectionTitle, null, "Add New Vendor"), /*#__PURE__*/React$1.createElement(VendorSearch, {
47687
+ ref: searchInputRef,
47639
47688
  type: "search",
47640
47689
  placeholder: "Search",
47641
- value: search,
47642
- onChange: e => setSearch(e.target.value)
47643
- }), /*#__PURE__*/React$1.createElement(VendorSearchResult, null, search !== "" ? `${filteredItems.length === 0 ? "No" : filteredItems.length} Vendors Found` : " ")), /*#__PURE__*/React$1.createElement(VendorListWrapper$1, {
47690
+ onChange: handleSearchChange
47691
+ }), /*#__PURE__*/React$1.createElement(VendorSearchResult, null, debouncedSearch !== "" ? `${filteredItems.length === 0 ? "No" : filteredItems.length} Vendors Found` : " ")), /*#__PURE__*/React$1.createElement(VendorListWrapper$1, {
47644
47692
  headerHeight: headerHeight
47645
- }, /*#__PURE__*/React$1.createElement(VendorList$1, null, filteredItems.map((item, idx) => {
47693
+ }, FixedSizeList ? /*#__PURE__*/React$1.createElement(FixedSizeList, {
47694
+ height: window.innerHeight - headerHeight - 48,
47695
+ itemCount: filteredItems.length,
47696
+ itemSize: VENDOR_ITEM_HEIGHT,
47697
+ width: "100%"
47698
+ }, VendorRow) : /*#__PURE__*/React$1.createElement(VendorList$1, null, filteredItems.map((item, idx) => {
47646
47699
  let packagesLength = 0;
47647
47700
  let sentPackagesLength = 0;
47648
47701
  if (item.packages !== null) {
@@ -47652,12 +47705,11 @@ const NewItemList = ({
47652
47705
  return /*#__PURE__*/React$1.createElement(VendorItem, {
47653
47706
  key: idx,
47654
47707
  onClick: e => {
47655
- // Always call onVendorClick - it will handle the conversion from null to []
47656
47708
  if (onVendorClick) {
47657
47709
  onVendorClick(item);
47658
47710
  }
47659
47711
  }
47660
- }, /*#__PURE__*/React$1.createElement(VendorNameAndPackagesContainer, null, /*#__PURE__*/React$1.createElement(VendorName$1, null, highlightMatch(item.name, searchLower)), packagesLength > 0 && /*#__PURE__*/React$1.createElement(VendorPackages, null, (() => {
47712
+ }, /*#__PURE__*/React$1.createElement(VendorNameAndPackagesContainer, null, /*#__PURE__*/React$1.createElement(VendorName$1, null, highlightMatch(item.name, debouncedSearch.toLowerCase())), packagesLength > 0 && /*#__PURE__*/React$1.createElement(VendorPackages, null, (() => {
47661
47713
  const noPackagesSent = sentPackagesLength === 0;
47662
47714
  if (noPackagesSent) {
47663
47715
  return `0/${packagesLength} Packages Sent`;
@@ -57798,27 +57850,32 @@ OverlayTemplateDialog.propTypes = {
57798
57850
  // Main Component
57799
57851
  const OverlayDropdown = _ref => {
57800
57852
  let {
57853
+ // Data / selection
57801
57854
  data = [],
57802
57855
  value,
57803
57856
  onSelectClick,
57857
+ // Label / placeholder
57858
+ label,
57859
+ labelEmptyValue,
57860
+ showLabelOnTop,
57861
+ labelColor,
57862
+ placeHolder,
57863
+ placeHolderColor,
57864
+ // Behavior
57865
+ required = false,
57804
57866
  disabled = false,
57805
57867
  isDarkerBackground = false,
57806
- required = false,
57868
+ editableDigitalCoupon = false,
57869
+ // Appearance
57807
57870
  selectedColor = "#066768",
57808
57871
  hoverColor = "#E6F0F0",
57809
- dropdownMaxHeight = "600px",
57872
+ // Sizing
57810
57873
  width = "100%",
57811
57874
  minWidth = "unset",
57875
+ dropdownWidth = "100%",
57876
+ dropdownMaxHeight = "600px",
57812
57877
  height = "auto",
57813
- label,
57814
- labelEmptyValue,
57815
- showLabelOnTop,
57816
- placeHolder,
57817
- labelColor,
57818
- placeHolderColor,
57819
57878
  margin = "8px",
57820
- dropdownWidth = "100%",
57821
- editableDigitalCoupon = false,
57822
57879
  ...props
57823
57880
  } = _ref;
57824
57881
  const [open, setOpen] = useState(false);