sag_components 2.0.0-beta197 → 2.0.0-beta198

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
@@ -10589,23 +10589,24 @@ const QuarterPopupPicker = ({
10589
10589
  };
10590
10590
 
10591
10591
  /* eslint-disable import/no-extraneous-dependencies */
10592
- const QuarterPicker = ({
10593
- availableQuarters,
10594
- // ["Q1-2024"]
10595
- label,
10596
- onChange,
10597
- borderRadius,
10598
- required,
10599
- width,
10600
- height,
10601
- placeholder,
10602
- disabled,
10603
- borderColor,
10604
- borderColorFocus,
10605
- textColor,
10606
- selectedValue,
10607
- startYear
10608
- }) => {
10592
+ const QuarterPicker = _ref => {
10593
+ let {
10594
+ availableQuarters,
10595
+ // ["Q1-2024"]
10596
+ label,
10597
+ onChange,
10598
+ borderRadius,
10599
+ required,
10600
+ width,
10601
+ height,
10602
+ placeholder,
10603
+ disabled,
10604
+ borderColor,
10605
+ borderColorFocus,
10606
+ textColor,
10607
+ selectedValue,
10608
+ startYear
10609
+ } = _ref;
10609
10610
  const [isFocused, setIsFocused] = React$1.useState(false);
10610
10611
  const [isOpen, setIsOpen] = React$1.useState(false);
10611
10612
  const [value, setValue] = React$1.useState('');
@@ -11047,22 +11048,23 @@ const MonthPopupPicker = ({
11047
11048
  };
11048
11049
 
11049
11050
  /* eslint-disable import/no-extraneous-dependencies */
11050
- const MonthPicker = ({
11051
- availableMonths,
11052
- label,
11053
- onChange,
11054
- borderRadius,
11055
- required,
11056
- width,
11057
- height,
11058
- placeholder,
11059
- disabled,
11060
- borderColor,
11061
- borderColorFocus,
11062
- textColor,
11063
- selectedValue,
11064
- startYear
11065
- }) => {
11051
+ const MonthPicker = _ref => {
11052
+ let {
11053
+ availableMonths,
11054
+ label,
11055
+ onChange,
11056
+ borderRadius,
11057
+ required,
11058
+ width,
11059
+ height,
11060
+ placeholder,
11061
+ disabled,
11062
+ borderColor,
11063
+ borderColorFocus,
11064
+ textColor,
11065
+ selectedValue,
11066
+ startYear
11067
+ } = _ref;
11066
11068
  const [isFocused, setIsFocused] = React$1.useState(false);
11067
11069
  const [isOpen, setIsOpen] = React$1.useState(false);
11068
11070
  const [value, setValue] = React$1.useState('');
@@ -34884,17 +34886,18 @@ styled.css`
34884
34886
  * • onApply(start,end) — callback, both numbers (inclusive)
34885
34887
  * • onCancel() — callback
34886
34888
  */
34887
- const WeeksCalendar = ({
34888
- year,
34889
- defaultStartWeek = null,
34890
- defaultEndWeek = null,
34891
- backgroundColor = "#066768",
34892
- hoverBackgroundColor = "#E6F0F0",
34893
- allowedWeekRange = null,
34894
- // New prop for range restriction
34895
- onApply,
34896
- onCancel
34897
- }) => {
34889
+ const WeeksCalendar = _ref => {
34890
+ let {
34891
+ year,
34892
+ defaultStartWeek = null,
34893
+ defaultEndWeek = null,
34894
+ backgroundColor = "#066768",
34895
+ hoverBackgroundColor = "#E6F0F0",
34896
+ allowedWeekRange = null,
34897
+ // New prop for range restriction
34898
+ onApply,
34899
+ onCancel
34900
+ } = _ref;
34898
34901
  // state -------------------------------------------------
34899
34902
  const [startWeek, setStartWeek] = React$1.useState(defaultStartWeek);
34900
34903
  const [endWeek, setEndWeek] = React$1.useState(defaultEndWeek);
@@ -40085,6 +40088,13 @@ const TableBody = /*#__PURE__*/React$1.forwardRef(({
40085
40088
  onCheckboxClick = () => {},
40086
40089
  onHeaderCheckboxClick = () => {}
40087
40090
  }, ref) => {
40091
+ // MOVE ALL VALIDATION TO THE VERY TOP BEFORE ANY HOOKS
40092
+ if (!Array.isArray(data) || !Array.isArray(columns)) {
40093
+ console.warn("TableBody: Invalid data or columns prop");
40094
+ return null;
40095
+ }
40096
+
40097
+ // NOW ALL THE HOOKS CAN BE CALLED SAFELY
40088
40098
  const [hoveredRowIndex, setHoveredRowIndex] = React$1.useState(null);
40089
40099
  const [focusedRowIndex, setFocusedRowIndex] = React$1.useState(null);
40090
40100
  const [isCommentModalOpen, setIsCommentModalOpen] = React$1.useState(false);
@@ -40097,12 +40107,6 @@ const TableBody = /*#__PURE__*/React$1.forwardRef(({
40097
40107
  const [hasUserInteracted, setHasUserInteracted] = React$1.useState(false);
40098
40108
  const [hasInitialValue, setHasInitialValue] = React$1.useState(false);
40099
40109
 
40100
- // Early return for invalid data
40101
- if (!Array.isArray(data) || !Array.isArray(columns)) {
40102
- console.warn("TableBody: Invalid data or columns prop");
40103
- return null;
40104
- }
40105
-
40106
40110
  // Expose methods to parent component via ref
40107
40111
  React$1.useImperativeHandle(ref, () => ({
40108
40112
  clearFocus: () => {
@@ -40675,7 +40679,7 @@ const TableBody = /*#__PURE__*/React$1.forwardRef(({
40675
40679
  };
40676
40680
  }, []);
40677
40681
 
40678
- // Return null if no data
40682
+ // HANDLE SPECIAL CASE: EMPTY DATA AFTER ALL HOOKS
40679
40683
  if (data.length === 0) {
40680
40684
  return /*#__PURE__*/React__default["default"].createElement(StyledTableBody, {
40681
40685
  ref: ref
@@ -54549,10 +54553,11 @@ const DropdownList = styled__default["default"].ul`
54549
54553
  `}
54550
54554
  `;
54551
54555
  const SectionDiv = styled__default["default"].div`
54552
- ${({
54553
- $showBorder,
54554
- margin
54555
- }) => {
54556
+ ${_ref => {
54557
+ let {
54558
+ $showBorder,
54559
+ margin
54560
+ } = _ref;
54556
54561
  switch ($showBorder) {
54557
54562
  case 'Template Offer':
54558
54563
  return styled.css`border-top: 1px solid #e6e2e2ff;
@@ -54737,15 +54742,16 @@ function validateField(value, param) {
54737
54742
  if (param.type === 'percent' && Number(value) > 100) return 'Max 100%';
54738
54743
  return null;
54739
54744
  }
54740
- const OverlayTemplateDialog = ({
54741
- open,
54742
- onClose,
54743
- onApply,
54744
- template,
54745
- params,
54746
- buttonColor = '#1db6ab',
54747
- buttonHoverColor = '#066768'
54748
- }) => {
54745
+ const OverlayTemplateDialog = _ref => {
54746
+ let {
54747
+ open,
54748
+ onClose,
54749
+ onApply,
54750
+ template,
54751
+ params,
54752
+ buttonColor = '#1db6ab',
54753
+ buttonHoverColor = '#066768'
54754
+ } = _ref;
54749
54755
  const [fields, setFields] = React$1.useState(() => params.map(() => ''));
54750
54756
  const [touched, setTouched] = React$1.useState(() => params.map(() => false));
54751
54757
  if (!open) return null;