sag_components 2.0.0-beta314 → 2.0.0-beta316

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.esm.js CHANGED
@@ -36215,19 +36215,15 @@ const ToggleInput = styled.input`
36215
36215
  const ToggleSlider = styled.span`
36216
36216
  display: block;
36217
36217
  position: relative;
36218
- background: ${_ref => {
36219
- let {
36220
- checked,
36221
- disabled
36222
- } = _ref;
36223
- return checked ? "#006d6a" : disabled ? "#B1B1B1" : "#D0D0D0";
36224
- }};
36218
+ background: ${({
36219
+ checked,
36220
+ disabled
36221
+ }) => checked ? "#006d6a" : disabled ? "#B1B1B1" : "#D0D0D0"};
36225
36222
  border-radius: 999px;
36226
36223
  transition: background 0.2s;
36227
- ${_ref2 => {
36228
- let {
36229
- size
36230
- } = _ref2;
36224
+ ${({
36225
+ size
36226
+ }) => {
36231
36227
  switch (size) {
36232
36228
  case "s":
36233
36229
  return css`width: 40px; height: 20px;`;
@@ -36243,18 +36239,14 @@ const ToggleSlider = styled.span`
36243
36239
  left: 3px;
36244
36240
  top: 50%;
36245
36241
  transform: translateY(-50%);
36246
- background: ${_ref3 => {
36247
- let {
36248
- disabled
36249
- } = _ref3;
36250
- return disabled ? "#D0D0D0" : "#fff";
36251
- }};
36242
+ background: ${({
36243
+ disabled
36244
+ }) => disabled ? "#D0D0D0" : "#fff"};
36252
36245
  border-radius: 50%;
36253
36246
  transition: left 0.2s, width 0.2s, height 0.2s;
36254
- ${_ref4 => {
36255
- let {
36256
- size
36257
- } = _ref4;
36247
+ ${({
36248
+ size
36249
+ }) => {
36258
36250
  switch (size) {
36259
36251
  case "s":
36260
36252
  return css`width: 14px; height: 14px;`;
@@ -36264,11 +36256,10 @@ const ToggleSlider = styled.span`
36264
36256
  return css`width: 20px; height: 20px;`;
36265
36257
  }
36266
36258
  }}
36267
- left: ${_ref5 => {
36268
- let {
36269
- checked,
36270
- size
36271
- } = _ref5;
36259
+ left: ${({
36260
+ checked,
36261
+ size
36262
+ }) => {
36272
36263
  if (!checked) return "3px";
36273
36264
  switch (size) {
36274
36265
  case "s":
@@ -36282,9 +36273,9 @@ const ToggleSlider = styled.span`
36282
36273
  }
36283
36274
  `;
36284
36275
 
36285
- /**
36286
- * ToggleSwitch component for on/off states.
36287
- * Supports small/large sizes and disabled state.
36276
+ /**
36277
+ * ToggleSwitch component for on/off states.
36278
+ * Supports small/large sizes and disabled state.
36288
36279
  */
36289
36280
  function ToggleSwitch(_ref) {
36290
36281
  let {
@@ -42649,6 +42640,16 @@ const DropdownButton$1 = styled.button`
42649
42640
  white-space: nowrap;
42650
42641
  text-align: left;
42651
42642
  flex: 1;
42643
+
42644
+ /* Map --cell-* variables (set by Dropdown.jsx) to --tooltip-* variables (expected by tooltipStyles) */
42645
+ --tooltip-top: var(--cell-top);
42646
+ --tooltip-left: var(--cell-left);
42647
+ --tooltip-width: var(--cell-width);
42648
+ --tooltip-offset: calc(var(--cell-offset) + 20px); /* Add 20px to move tooltip up */
42649
+ --tooltip-height: var(--cell-height);
42650
+
42651
+ /* Import shared tooltip styles from TableBody */
42652
+ ${tooltipStyles$1}
42652
42653
  }
42653
42654
  `;
42654
42655
  const DropdownIcon = styled.div`
@@ -42770,10 +42771,19 @@ const Dropdown = ({
42770
42771
  showSelectAll = true // New prop to show/hide "Select All" option
42771
42772
  }) => {
42772
42773
  const [isDropdownHovered, setIsDropdownHovered] = useState(false);
42774
+ const displayTextRef = useRef(null);
42773
42775
 
42774
42776
  // Normalize selectedValue to always be an array for consistency
42775
42777
  const selectedValues = Array.isArray(selectedValue) ? selectedValue : selectedValue ? [selectedValue] : [];
42776
42778
 
42779
+ // Generate display text based on selections
42780
+ const getDisplayText = () => {
42781
+ if (selectedValues.length === 0) {
42782
+ return placeholder;
42783
+ }
42784
+ return `${selectedValues.map(val => options.find(opt => opt.value === val).label).join(', ')}`;
42785
+ };
42786
+
42777
42787
  // Reset dropdown hover state when dropdown closes
42778
42788
  useEffect(() => {
42779
42789
  if (!isOpen) {
@@ -42781,6 +42791,46 @@ const Dropdown = ({
42781
42791
  }
42782
42792
  }, [isOpen]);
42783
42793
 
42794
+ // Apply tooltip when text overflows
42795
+ useEffect(() => {
42796
+ const element = displayTextRef.current;
42797
+ if (element) {
42798
+ const fullText = displayText || getDisplayText();
42799
+
42800
+ // Check if text overflows
42801
+ if (element.scrollWidth > element.clientWidth && fullText && fullText.trim() !== "") {
42802
+ try {
42803
+ const rect = element.getBoundingClientRect();
42804
+ if (rect.width > 0 && rect.height > 0) {
42805
+ const tooltipInfo = calculateTooltipOffset(fullText, true);
42806
+ if (tooltipInfo) {
42807
+ const {
42808
+ offset,
42809
+ height
42810
+ } = tooltipInfo;
42811
+ element.style.setProperty("--cell-top", `${rect.top}px`);
42812
+ element.style.setProperty("--cell-left", `${rect.left}px`);
42813
+ element.style.setProperty("--cell-width", `${rect.width}px`);
42814
+ element.style.setProperty("--cell-offset", `${offset}px`);
42815
+ element.style.setProperty("--cell-height", `${height}px`);
42816
+ element.setAttribute("data-tooltip", fullText);
42817
+ }
42818
+ }
42819
+ } catch (e) {
42820
+ console.warn("Error applying dropdown tooltip:", e);
42821
+ }
42822
+ } else {
42823
+ // Remove tooltip if text doesn't overflow
42824
+ element.removeAttribute("data-tooltip");
42825
+ element.style.removeProperty("--cell-top");
42826
+ element.style.removeProperty("--cell-left");
42827
+ element.style.removeProperty("--cell-width");
42828
+ element.style.removeProperty("--cell-offset");
42829
+ element.style.removeProperty("--cell-height");
42830
+ }
42831
+ }
42832
+ }, [displayText, selectedValues, options, placeholder]);
42833
+
42784
42834
  // Check if an option is selected
42785
42835
  const isOptionSelected = optionValue => {
42786
42836
  return selectedValues.includes(optionValue);
@@ -42823,20 +42873,6 @@ const Dropdown = ({
42823
42873
  }, e);
42824
42874
  }
42825
42875
  };
42826
-
42827
- // Generate display text based on selections
42828
- const getDisplayText = () => {
42829
- if (selectedValues.length === 0) {
42830
- return placeholder;
42831
- }
42832
-
42833
- // if (selectedValues.length === 1) {
42834
- // const selectedOption = options.find(opt => opt.value === selectedValues[0]);
42835
- // return selectedOption ? selectedOption.label : displayText;
42836
- // }
42837
-
42838
- return `${selectedValues.map(val => options.find(opt => opt.value === val).label).join(', ')}`;
42839
- };
42840
42876
  return /*#__PURE__*/React$1.createElement(DropdownContainer$1, {
42841
42877
  onMouseEnter: () => setIsDropdownHovered(true),
42842
42878
  onMouseLeave: () => setIsDropdownHovered(false)
@@ -42846,7 +42882,9 @@ const Dropdown = ({
42846
42882
  $isRowFocused: isRowFocused,
42847
42883
  $isRowHovered: isRowHovered,
42848
42884
  $selectedColor: selectedColor
42849
- }, /*#__PURE__*/React$1.createElement("span", null, displayText || getDisplayText()), /*#__PURE__*/React$1.createElement(DropdownIcon, {
42885
+ }, /*#__PURE__*/React$1.createElement("span", {
42886
+ ref: displayTextRef
42887
+ }, displayText || getDisplayText()), /*#__PURE__*/React$1.createElement(DropdownIcon, {
42850
42888
  $isOpen: isOpen,
42851
42889
  $isRowFocused: isRowFocused,
42852
42890
  $isRowHovered: isRowHovered,
@@ -47992,23 +48030,19 @@ const NewItemList = ({
47992
48030
  // - When searching with external/server-side search: show searchResults (can change length)
47993
48031
  // - When searching with internal search: filter itemAndPackage locally
47994
48032
  const filteredItems = useMemo(() => {
47995
- // Safety check
47996
48033
  if (!itemAndPackage || !Array.isArray(itemAndPackage)) {
47997
48034
  return [];
47998
48035
  }
47999
-
48000
- // No search value = show static itemAndPackage list
48001
48036
  if (!currentSearchValue) {
48002
48037
  return itemAndPackage;
48003
48038
  }
48004
-
48005
- // Has search value - determine which source to use
48006
- if (isExternalSearch && serverSearchResults !== null) {
48007
- // Server-side search: use separate searchResults array (can have different length)
48008
- return serverSearchResults;
48039
+ if (isExternalSearch) {
48040
+ if (serverSearchResults !== null) {
48041
+ return serverSearchResults;
48042
+ } else {
48043
+ return [];
48044
+ }
48009
48045
  }
48010
-
48011
- // Internal/client-side filtering of itemAndPackage
48012
48046
  const searchLower = currentSearchValue.toLowerCase();
48013
48047
  const results = [];
48014
48048
  const startsWithResults = [];
@@ -48020,7 +48054,8 @@ const NewItemList = ({
48020
48054
  results.push(itemAndPackage[i]);
48021
48055
  }
48022
48056
  }
48023
- return [...startsWithResults, ...results];
48057
+ const finalResults = [...startsWithResults, ...results];
48058
+ return finalResults;
48024
48059
  }, [currentSearchValue, itemAndPackage, serverSearchResults, isExternalSearch]);
48025
48060
 
48026
48061
  // ONLY ONE scroll detection useEffect
@@ -48094,7 +48129,7 @@ const NewItemList = ({
48094
48129
  type: "search",
48095
48130
  placeholder: "Search",
48096
48131
  onChange: handleSearchChange
48097
- }), /*#__PURE__*/React$1.createElement(VendorSearchResult, null, isSearchLoading ? "Searching..." : currentSearchValue !== "" ? `${filteredItems.length === 0 ? "No" : filteredItems.length} Vendors Found` : " ")), /*#__PURE__*/React$1.createElement(VendorListWrapper$1, {
48132
+ }), /*#__PURE__*/React$1.createElement(VendorSearchResult, null, currentSearchValue === "" ? " " : isSearchLoading ? "Searching..." : serverSearchResults === null ? "..." : `${filteredItems.length === 0 ? "No" : filteredItems.length} Vendors Found`)), /*#__PURE__*/React$1.createElement(VendorListWrapper$1, {
48098
48133
  ref: scrollWrapperRef,
48099
48134
  headerHeight: headerHeight
48100
48135
  }, FixedSizeList ? /*#__PURE__*/React$1.createElement(FixedSizeList, {