sag_components 2.0.0-beta176 → 2.0.0-beta178
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 +14 -1
- package/dist/index.esm.js +327 -91
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +327 -91
- package/dist/index.js.map +1 -1
- package/dist/types/components/Input/Input.d.ts +14 -1
- package/dist/types/components/Input/Input.stories.d.ts +85 -14
- package/dist/types/components/Input/Input.style.d.ts +1 -0
- package/dist/types/components/Table/DropMenus/Dropdown.d.ts +7 -1
- package/dist/types/components/Table/Table.stories.d.ts +40 -1
- package/dist/types/components/Table/TableBody.d.ts +5 -1
- package/dist/types/components/Table/TableHeader.d.ts +3 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -10545,24 +10545,23 @@ const QuarterPopupPicker = ({
|
|
|
10545
10545
|
};
|
|
10546
10546
|
|
|
10547
10547
|
/* eslint-disable import/no-extraneous-dependencies */
|
|
10548
|
-
const QuarterPicker =
|
|
10549
|
-
|
|
10550
|
-
|
|
10551
|
-
|
|
10552
|
-
|
|
10553
|
-
|
|
10554
|
-
|
|
10555
|
-
|
|
10556
|
-
|
|
10557
|
-
|
|
10558
|
-
|
|
10559
|
-
|
|
10560
|
-
|
|
10561
|
-
|
|
10562
|
-
|
|
10563
|
-
|
|
10564
|
-
|
|
10565
|
-
} = _ref;
|
|
10548
|
+
const QuarterPicker = ({
|
|
10549
|
+
availableQuarters,
|
|
10550
|
+
// ["Q1-2024"]
|
|
10551
|
+
label,
|
|
10552
|
+
onChange,
|
|
10553
|
+
borderRadius,
|
|
10554
|
+
required,
|
|
10555
|
+
width,
|
|
10556
|
+
height,
|
|
10557
|
+
placeholder,
|
|
10558
|
+
disabled,
|
|
10559
|
+
borderColor,
|
|
10560
|
+
borderColorFocus,
|
|
10561
|
+
textColor,
|
|
10562
|
+
selectedValue,
|
|
10563
|
+
startYear
|
|
10564
|
+
}) => {
|
|
10566
10565
|
const [isFocused, setIsFocused] = useState(false);
|
|
10567
10566
|
const [isOpen, setIsOpen] = useState(false);
|
|
10568
10567
|
const [value, setValue] = useState('');
|
|
@@ -35400,18 +35399,19 @@ const MainContainer = styled.div`
|
|
|
35400
35399
|
display: flex;
|
|
35401
35400
|
flex-direction: column;
|
|
35402
35401
|
align-content: center;
|
|
35403
|
-
justify-content:
|
|
35402
|
+
justify-content: flex-start;
|
|
35404
35403
|
align-items: flex-start;
|
|
35405
|
-
width: ${props => props.width || '300px'};
|
|
35404
|
+
width: ${props => props.width || '300px'};
|
|
35405
|
+
height: ${props => props.height || '45px'};
|
|
35406
35406
|
font-family: "Poppins", sans-serif;
|
|
35407
35407
|
font-weight: 400;
|
|
35408
35408
|
font-size: 14px;
|
|
35409
35409
|
border-radius: ${props => props.size === 'small' ? '8px' : '12px'};
|
|
35410
35410
|
padding: 0;
|
|
35411
35411
|
cursor: ${props => props.disabled ? 'not-allowed' : 'default'};
|
|
35412
|
+
min-height: ${props => props.multiline ? '80px' : 'auto'};
|
|
35412
35413
|
`;
|
|
35413
35414
|
const Label$3 = styled.label`
|
|
35414
|
-
|
|
35415
35415
|
font-size: ${props => props.isFocused || props.hasValue ? '14px' : '14px'};
|
|
35416
35416
|
font-weight: 400;
|
|
35417
35417
|
padding-inline-end: 5px;
|
|
@@ -35421,8 +35421,18 @@ const Label$3 = styled.label`
|
|
|
35421
35421
|
color: ${props => props.error ? 'red' : props.disabled ? '#D0D0D0' : props.labelColor};
|
|
35422
35422
|
background-color: ${props => props.disabled && props.isDarkerBackground ? '#F2F2F2' : '#fff'};
|
|
35423
35423
|
position: absolute;
|
|
35424
|
-
top: ${props =>
|
|
35425
|
-
|
|
35424
|
+
top: ${props => {
|
|
35425
|
+
if (props.multiline) {
|
|
35426
|
+
return props.isFocused || props.hasValue ? '0px' : '20px';
|
|
35427
|
+
}
|
|
35428
|
+
return props.isFocused || props.hasValue ? '0px' : props.size === 'medium' ? '27px' : '17px';
|
|
35429
|
+
}};
|
|
35430
|
+
left: ${props => {
|
|
35431
|
+
if (props.multiline) {
|
|
35432
|
+
return props.isFocused || props.hasValue ? '23px' : '16px';
|
|
35433
|
+
}
|
|
35434
|
+
return props.isFocused || props.hasValue ? '23px' : props.leftIcon && props.leftIcon !== 'none' ? '42px' : '16px';
|
|
35435
|
+
}};
|
|
35426
35436
|
font-family: Poppins;
|
|
35427
35437
|
transform: translateY(-50%);
|
|
35428
35438
|
transition: top 0.3s ease, font-size 0.3s ease, color 0.3s ease;
|
|
@@ -35439,17 +35449,17 @@ const InputContainer = styled.div`
|
|
|
35439
35449
|
display: flex;
|
|
35440
35450
|
flex-wrap: nowrap;
|
|
35441
35451
|
justify-content: flex-start;
|
|
35442
|
-
align-content: center;
|
|
35452
|
+
align-content: ${props => props.multiline ? 'flex-start' : 'center'};
|
|
35443
35453
|
white-space: pre-wrap;
|
|
35444
|
-
align-items: center;
|
|
35454
|
+
align-items: ${props => props.multiline ? 'flex-start' : 'center'};
|
|
35445
35455
|
overflow: hidden;
|
|
35446
|
-
padding: 0 16px;
|
|
35447
|
-
gap: 14px;
|
|
35456
|
+
padding: ${props => props.multiline ? '16px' : '0 16px'};
|
|
35457
|
+
gap: ${props => props.multiline ? '0' : '14px'};
|
|
35448
35458
|
width: 100%;
|
|
35449
35459
|
height: 100%;
|
|
35450
35460
|
box-sizing: border-box;
|
|
35451
35461
|
background-color: ${props => props.disabled && props.isDarkerBackground ? '#F2F2F2' : '#fff'};
|
|
35452
|
-
border:
|
|
35462
|
+
border: 1px solid ${props => props.disabled ? '#D0D0D0' : props.error ? 'red' : '#B1B1B1'};
|
|
35453
35463
|
font-family: "Poppins", sans-serif;
|
|
35454
35464
|
font-weight: 400;
|
|
35455
35465
|
font-size: 14px;
|
|
@@ -35461,10 +35471,9 @@ const InputContainer = styled.div`
|
|
|
35461
35471
|
border: 1px solid ${props => props.disabled ? '#D0D0D0' : props.error ? 'red' : props.labelColor || '#212121'};
|
|
35462
35472
|
}
|
|
35463
35473
|
|
|
35464
|
-
&:focus {
|
|
35474
|
+
&:focus-within {
|
|
35465
35475
|
border: 1px solid ${props => props.disabled ? '#D0D0D0' : props.error ? 'red' : props.labelColor || '#212121'};
|
|
35466
35476
|
}
|
|
35467
|
-
|
|
35468
35477
|
`;
|
|
35469
35478
|
const InputSubContainer = styled.div`
|
|
35470
35479
|
display: flex;
|
|
@@ -35472,13 +35481,16 @@ const InputSubContainer = styled.div`
|
|
|
35472
35481
|
flex-wrap: nowrap;
|
|
35473
35482
|
align-content: center;
|
|
35474
35483
|
align-items: flex-start;
|
|
35475
|
-
justify-content: center;
|
|
35484
|
+
justify-content: ${props => props.multiline ? 'flex-start' : 'center'};
|
|
35476
35485
|
white-space: pre-wrap;
|
|
35477
35486
|
overflow: hidden;
|
|
35478
|
-
padding: 5px 0;
|
|
35487
|
+
padding: ${props => props.multiline ? '5px 0 0 0' : '5px 0'};
|
|
35479
35488
|
width: 100%;
|
|
35480
|
-
height:
|
|
35481
|
-
min-height: ${props =>
|
|
35489
|
+
height: ${props => props.height || '45px'};
|
|
35490
|
+
min-height: ${props => {
|
|
35491
|
+
if (props.multiline) return 'auto';
|
|
35492
|
+
return props.size === 'medium' ? '52px' : '32px';
|
|
35493
|
+
}};
|
|
35482
35494
|
box-sizing: border-box;
|
|
35483
35495
|
background-color: ${props => props.disabled && props.isDarkerBackground ? '#F2F2F2' : '#fff'};
|
|
35484
35496
|
border-radius: ${props => props.size === 'small' ? '8px' : '12px'};
|
|
@@ -35488,14 +35500,59 @@ const InputSubContainer = styled.div`
|
|
|
35488
35500
|
`;
|
|
35489
35501
|
const StyledInput = styled.input`
|
|
35490
35502
|
width: calc(100% - 10px);
|
|
35491
|
-
height: 20px;
|
|
35503
|
+
height: ${props => props.height || '20px'};
|
|
35492
35504
|
font-weight: 400;
|
|
35493
35505
|
font-size: 14px;
|
|
35494
35506
|
outline: none;
|
|
35495
35507
|
color: ${props => props.disabled ? '#D0D0D0' : '#212121'};
|
|
35496
35508
|
background-color: ${props => props.disabled && props.isDarkerBackground ? '#F2F2F2' : '#fff'};
|
|
35497
35509
|
border: none;
|
|
35498
|
-
cursor: ${props => props.disabled ? 'not-allowed' : '
|
|
35510
|
+
cursor: ${props => props.disabled ? 'not-allowed' : 'text'};
|
|
35511
|
+
font-family: "Poppins", sans-serif;
|
|
35512
|
+
`;
|
|
35513
|
+
const StyledTextarea = styled.textarea`
|
|
35514
|
+
width: 100%;
|
|
35515
|
+
min-height: 60px;
|
|
35516
|
+
font-weight: 400;
|
|
35517
|
+
font-size: 14px;
|
|
35518
|
+
outline: none;
|
|
35519
|
+
color: ${props => props.disabled ? '#D0D0D0' : '#212121'};
|
|
35520
|
+
background-color: ${props => props.disabled && props.isDarkerBackground ? '#F2F2F2' : '#fff'};
|
|
35521
|
+
border: none;
|
|
35522
|
+
cursor: ${props => props.disabled ? 'not-allowed' : 'text'};
|
|
35523
|
+
font-family: "Poppins", sans-serif;
|
|
35524
|
+
resize: vertical;
|
|
35525
|
+
line-height: 1.4;
|
|
35526
|
+
padding: 0;
|
|
35527
|
+
margin-top: 10px;
|
|
35528
|
+
|
|
35529
|
+
&::placeholder {
|
|
35530
|
+
color: #999;
|
|
35531
|
+
font-style: italic;
|
|
35532
|
+
}
|
|
35533
|
+
|
|
35534
|
+
&:focus {
|
|
35535
|
+
outline: none;
|
|
35536
|
+
}
|
|
35537
|
+
|
|
35538
|
+
/* Remove default textarea styling */
|
|
35539
|
+
&::-webkit-scrollbar {
|
|
35540
|
+
width: 6px;
|
|
35541
|
+
}
|
|
35542
|
+
|
|
35543
|
+
&::-webkit-scrollbar-track {
|
|
35544
|
+
background: #f1f1f1;
|
|
35545
|
+
border-radius: 3px;
|
|
35546
|
+
}
|
|
35547
|
+
|
|
35548
|
+
&::-webkit-scrollbar-thumb {
|
|
35549
|
+
background: #c1c1c1;
|
|
35550
|
+
border-radius: 3px;
|
|
35551
|
+
}
|
|
35552
|
+
|
|
35553
|
+
&::-webkit-scrollbar-thumb:hover {
|
|
35554
|
+
background: #a8a8a8;
|
|
35555
|
+
}
|
|
35499
35556
|
`;
|
|
35500
35557
|
const ErrorMessage = styled.div`
|
|
35501
35558
|
font-size: 12px;
|
|
@@ -35528,6 +35585,7 @@ const Input$2 = _ref => {
|
|
|
35528
35585
|
disabled,
|
|
35529
35586
|
isDarkerBackground = false,
|
|
35530
35587
|
width,
|
|
35588
|
+
height = '50px',
|
|
35531
35589
|
error,
|
|
35532
35590
|
errorMessage,
|
|
35533
35591
|
labelColor,
|
|
@@ -35535,7 +35593,12 @@ const Input$2 = _ref => {
|
|
|
35535
35593
|
rightIcon,
|
|
35536
35594
|
password,
|
|
35537
35595
|
leftIconOnClick,
|
|
35538
|
-
rightIconOnClick
|
|
35596
|
+
rightIconOnClick,
|
|
35597
|
+
multiline = false,
|
|
35598
|
+
// New prop to enable textarea mode
|
|
35599
|
+
rows = 3,
|
|
35600
|
+
// New prop for textarea rows
|
|
35601
|
+
maxLength // New prop for character limit
|
|
35539
35602
|
} = _ref;
|
|
35540
35603
|
const [isFocused, setIsFocused] = useState(false);
|
|
35541
35604
|
const [inputValue, setInputValue] = useState('');
|
|
@@ -35609,12 +35672,24 @@ const Input$2 = _ref => {
|
|
|
35609
35672
|
}
|
|
35610
35673
|
return getIcon('eye', '14px', '14px', error ? 'red' : labelColor, disabled, 'pointer', toggleShowPassword);
|
|
35611
35674
|
};
|
|
35675
|
+
|
|
35676
|
+
// Calculate dynamic height for multiline inputs
|
|
35677
|
+
const calculateHeight = () => {
|
|
35678
|
+
if (!multiline) return height;
|
|
35679
|
+
const baseHeight = size === 'small' ? 32 : 52;
|
|
35680
|
+
const lineHeight = 20;
|
|
35681
|
+
const padding = 10;
|
|
35682
|
+
return `${baseHeight + (rows - 1) * lineHeight + padding}px`;
|
|
35683
|
+
};
|
|
35684
|
+
const InputElement = multiline ? StyledTextarea : StyledInput;
|
|
35612
35685
|
return /*#__PURE__*/React$1.createElement(MainContainer, {
|
|
35613
35686
|
className: "MainContainer",
|
|
35614
35687
|
width: width,
|
|
35688
|
+
height: calculateHeight(),
|
|
35615
35689
|
size: size,
|
|
35616
35690
|
disabled: disabled,
|
|
35617
|
-
isDarkerBackground: isDarkerBackground
|
|
35691
|
+
isDarkerBackground: isDarkerBackground,
|
|
35692
|
+
multiline: multiline
|
|
35618
35693
|
}, /*#__PURE__*/React$1.createElement(InputContainer, {
|
|
35619
35694
|
className: "InputContainer",
|
|
35620
35695
|
labelColor: labelColor,
|
|
@@ -35622,8 +35697,9 @@ const Input$2 = _ref => {
|
|
|
35622
35697
|
isDarkerBackground: isDarkerBackground,
|
|
35623
35698
|
error: error,
|
|
35624
35699
|
isFocused: isFocused,
|
|
35625
|
-
size: size
|
|
35626
|
-
|
|
35700
|
+
size: size,
|
|
35701
|
+
multiline: multiline
|
|
35702
|
+
}, !multiline && getLeftIcon(), /*#__PURE__*/React$1.createElement(InputSubContainer, {
|
|
35627
35703
|
className: "InputSubContainer",
|
|
35628
35704
|
ref: containerRef,
|
|
35629
35705
|
labelColor: labelColor,
|
|
@@ -35631,26 +35707,29 @@ const Input$2 = _ref => {
|
|
|
35631
35707
|
isDarkerBackground: isDarkerBackground,
|
|
35632
35708
|
error: error,
|
|
35633
35709
|
onClick: handleLabelClick,
|
|
35634
|
-
|
|
35710
|
+
height: calculateHeight(),
|
|
35711
|
+
size: size,
|
|
35712
|
+
multiline: multiline
|
|
35635
35713
|
}, /*#__PURE__*/React$1.createElement(Label$3, {
|
|
35636
35714
|
className: "Label",
|
|
35637
35715
|
isFocused: isFocused,
|
|
35638
35716
|
labelColor: labelColor,
|
|
35639
35717
|
hasValue: inputValue,
|
|
35640
|
-
leftIcon: leftIcon,
|
|
35718
|
+
leftIcon: !multiline ? leftIcon : 'none',
|
|
35641
35719
|
disabled: disabled,
|
|
35642
35720
|
isDarkerBackground: isDarkerBackground,
|
|
35643
35721
|
error: error,
|
|
35644
35722
|
errorMessage: errorMessage,
|
|
35645
35723
|
onClick: handleLabelClick,
|
|
35646
|
-
size: size
|
|
35724
|
+
size: size,
|
|
35725
|
+
multiline: multiline
|
|
35647
35726
|
}, inputValue ? label : labelEmptyValue || label, required && /*#__PURE__*/React$1.createElement("span", {
|
|
35648
35727
|
style: {
|
|
35649
35728
|
color: disabled ? '#D0D0D0' : 'red',
|
|
35650
35729
|
height: '16px'
|
|
35651
35730
|
}
|
|
35652
|
-
}, "*")), /*#__PURE__*/React$1.createElement(
|
|
35653
|
-
className: "StyledInput",
|
|
35731
|
+
}, "*")), /*#__PURE__*/React$1.createElement(InputElement, {
|
|
35732
|
+
className: multiline ? "StyledTextarea" : "StyledInput",
|
|
35654
35733
|
ref: inputRef,
|
|
35655
35734
|
type: password && !showPassword ? 'password' : 'text',
|
|
35656
35735
|
value: inputValue,
|
|
@@ -35662,11 +35741,22 @@ const Input$2 = _ref => {
|
|
|
35662
35741
|
isDarkerBackground: isDarkerBackground,
|
|
35663
35742
|
placeholder: isFocused ? placeHolder : '',
|
|
35664
35743
|
error: error,
|
|
35665
|
-
|
|
35666
|
-
|
|
35744
|
+
height: calculateHeight(),
|
|
35745
|
+
isFocused: isFocused,
|
|
35746
|
+
rows: multiline ? rows : undefined,
|
|
35747
|
+
maxLength: maxLength,
|
|
35748
|
+
multiline: multiline
|
|
35749
|
+
})), !multiline && (password ? getPasswordIcon() : getRightIcon())), error && errorMessage?.length > 0 && /*#__PURE__*/React$1.createElement(ErrorMessage, {
|
|
35667
35750
|
className: "ErrorMessage",
|
|
35668
35751
|
width: width
|
|
35669
|
-
}, errorMessage)
|
|
35752
|
+
}, errorMessage), multiline && maxLength && /*#__PURE__*/React$1.createElement("div", {
|
|
35753
|
+
style: {
|
|
35754
|
+
fontSize: '12px',
|
|
35755
|
+
color: inputValue.length > maxLength * 0.9 ? 'orange' : '#666',
|
|
35756
|
+
textAlign: 'right',
|
|
35757
|
+
marginTop: '4px'
|
|
35758
|
+
}
|
|
35759
|
+
}, inputValue.length, "/", maxLength));
|
|
35670
35760
|
};
|
|
35671
35761
|
Input$2.propTypes = {
|
|
35672
35762
|
placeHolder: PropTypes.string,
|
|
@@ -35686,7 +35776,10 @@ Input$2.propTypes = {
|
|
|
35686
35776
|
onBlur: PropTypes.func,
|
|
35687
35777
|
leftIcon: PropTypes.string,
|
|
35688
35778
|
rightIcon: PropTypes.string,
|
|
35689
|
-
password: PropTypes.bool
|
|
35779
|
+
password: PropTypes.bool,
|
|
35780
|
+
multiline: PropTypes.bool,
|
|
35781
|
+
rows: PropTypes.number,
|
|
35782
|
+
maxLength: PropTypes.number
|
|
35690
35783
|
};
|
|
35691
35784
|
Input$2.defaultProps = {
|
|
35692
35785
|
placeHolder: 'Type...',
|
|
@@ -35705,7 +35798,10 @@ Input$2.defaultProps = {
|
|
|
35705
35798
|
leftIconOnClick: () => {},
|
|
35706
35799
|
rightIconOnClick: () => {},
|
|
35707
35800
|
onBlur: () => {},
|
|
35708
|
-
password: false
|
|
35801
|
+
password: false,
|
|
35802
|
+
multiline: false,
|
|
35803
|
+
rows: 3,
|
|
35804
|
+
maxLength: undefined
|
|
35709
35805
|
};
|
|
35710
35806
|
|
|
35711
35807
|
const ToggleSwitchLabel = styled.label`
|
|
@@ -35713,12 +35809,9 @@ const ToggleSwitchLabel = styled.label`
|
|
|
35713
35809
|
position: relative;
|
|
35714
35810
|
cursor: pointer;
|
|
35715
35811
|
user-select: none;
|
|
35716
|
-
opacity: ${
|
|
35717
|
-
|
|
35718
|
-
|
|
35719
|
-
} = _ref;
|
|
35720
|
-
return disabled ? 0.5 : 1;
|
|
35721
|
-
}};
|
|
35812
|
+
opacity: ${({
|
|
35813
|
+
disabled
|
|
35814
|
+
}) => disabled ? 0.5 : 1};
|
|
35722
35815
|
`;
|
|
35723
35816
|
const ToggleInput = styled.input`
|
|
35724
35817
|
display: none;
|
|
@@ -35726,19 +35819,15 @@ const ToggleInput = styled.input`
|
|
|
35726
35819
|
const ToggleSlider = styled.span`
|
|
35727
35820
|
display: block;
|
|
35728
35821
|
position: relative;
|
|
35729
|
-
background: ${
|
|
35730
|
-
|
|
35731
|
-
|
|
35732
|
-
|
|
35733
|
-
} = _ref2;
|
|
35734
|
-
return checked ? disabled ? "#7bb1b0" : "#006d6a" : "#cfd8dc";
|
|
35735
|
-
}};
|
|
35822
|
+
background: ${({
|
|
35823
|
+
checked,
|
|
35824
|
+
disabled
|
|
35825
|
+
}) => checked ? disabled ? "#7bb1b0" : "#006d6a" : "#cfd8dc"};
|
|
35736
35826
|
border-radius: 999px;
|
|
35737
35827
|
transition: background 0.2s;
|
|
35738
|
-
${
|
|
35739
|
-
|
|
35740
|
-
|
|
35741
|
-
} = _ref3;
|
|
35828
|
+
${({
|
|
35829
|
+
size
|
|
35830
|
+
}) => {
|
|
35742
35831
|
switch (size) {
|
|
35743
35832
|
case "s":
|
|
35744
35833
|
return css`width: 40px; height: 20px;`;
|
|
@@ -35757,10 +35846,9 @@ const ToggleSlider = styled.span`
|
|
|
35757
35846
|
background: #fff;
|
|
35758
35847
|
border-radius: 50%;
|
|
35759
35848
|
transition: left 0.2s, width 0.2s, height 0.2s;
|
|
35760
|
-
${
|
|
35761
|
-
|
|
35762
|
-
|
|
35763
|
-
} = _ref4;
|
|
35849
|
+
${({
|
|
35850
|
+
size
|
|
35851
|
+
}) => {
|
|
35764
35852
|
switch (size) {
|
|
35765
35853
|
case "s":
|
|
35766
35854
|
return css`width: 14px; height: 14px;`;
|
|
@@ -35770,11 +35858,10 @@ const ToggleSlider = styled.span`
|
|
|
35770
35858
|
return css`width: 20px; height: 20px;`;
|
|
35771
35859
|
}
|
|
35772
35860
|
}}
|
|
35773
|
-
left: ${
|
|
35774
|
-
|
|
35775
|
-
|
|
35776
|
-
|
|
35777
|
-
} = _ref5;
|
|
35861
|
+
left: ${({
|
|
35862
|
+
checked,
|
|
35863
|
+
size
|
|
35864
|
+
}) => {
|
|
35778
35865
|
if (!checked) return "3px";
|
|
35779
35866
|
switch (size) {
|
|
35780
35867
|
case "s":
|
|
@@ -37757,7 +37844,9 @@ const TableHeader = ({
|
|
|
37757
37844
|
onSelectAll,
|
|
37758
37845
|
activeFilters = [],
|
|
37759
37846
|
activeSorts = [],
|
|
37760
|
-
expandable = false
|
|
37847
|
+
expandable = false,
|
|
37848
|
+
onHeaderCheckboxClick = () => {},
|
|
37849
|
+
headerCheckboxStates = {}
|
|
37761
37850
|
}) => {
|
|
37762
37851
|
const [focusedFilter, setFocusedFilter] = useState(null);
|
|
37763
37852
|
const [focusedSort, setFocusedSort] = useState(null);
|
|
@@ -38107,6 +38196,20 @@ const TableHeader = ({
|
|
|
38107
38196
|
return isFocused || isActive || hasSelection;
|
|
38108
38197
|
};
|
|
38109
38198
|
|
|
38199
|
+
// Handle header checkbox click
|
|
38200
|
+
const handleHeaderCheckboxClick = (columnKey, event) => {
|
|
38201
|
+
// Don't prevent the default checkbox behavior
|
|
38202
|
+
const newValue = event.target.checked;
|
|
38203
|
+
|
|
38204
|
+
// Fire the callback with column info and new value - let parent handle state
|
|
38205
|
+
if (onHeaderCheckboxClick) {
|
|
38206
|
+
onHeaderCheckboxClick({
|
|
38207
|
+
columnName: columnKey,
|
|
38208
|
+
checked: newValue
|
|
38209
|
+
});
|
|
38210
|
+
}
|
|
38211
|
+
};
|
|
38212
|
+
|
|
38110
38213
|
// Update showColumnFilter to pass current filterSelections to stateless FilterPop
|
|
38111
38214
|
const showColumnFilter = column => {
|
|
38112
38215
|
const {
|
|
@@ -38210,7 +38313,24 @@ const TableHeader = ({
|
|
|
38210
38313
|
type: "checkbox",
|
|
38211
38314
|
onChange: e => handleCheckboxChange(column.key, e.target.checked),
|
|
38212
38315
|
"data-column": column.key
|
|
38213
|
-
}),
|
|
38316
|
+
}), column.fieldType?.toLowerCase() === 'checkbox' && column.showCheckboxInTitle !== false && /*#__PURE__*/React$1.createElement(ColumnCheckbox, {
|
|
38317
|
+
type: "checkbox",
|
|
38318
|
+
checked: headerCheckboxStates[column.key] || false,
|
|
38319
|
+
onChange: e => handleHeaderCheckboxClick(column.key, e),
|
|
38320
|
+
"data-column": column.key,
|
|
38321
|
+
style: {
|
|
38322
|
+
width: '18px',
|
|
38323
|
+
height: '18px',
|
|
38324
|
+
marginLeft: '10px',
|
|
38325
|
+
// Moved 5px more to the right (was 5px)
|
|
38326
|
+
cursor: 'pointer',
|
|
38327
|
+
accentColor: '#066768',
|
|
38328
|
+
// Use the same green color as row checkboxes
|
|
38329
|
+
display: 'flex',
|
|
38330
|
+
alignItems: 'center',
|
|
38331
|
+
justifyContent: 'center'
|
|
38332
|
+
}
|
|
38333
|
+
}), column.fieldType?.toLowerCase() !== 'checkbox' && /*#__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, {
|
|
38214
38334
|
ref: el => iconRefs.current[`sort-${column.key}`] = el,
|
|
38215
38335
|
onClick: () => handleSort(column.key),
|
|
38216
38336
|
onMouseEnter: () => setFocusedSort(column.key),
|
|
@@ -39186,8 +39306,19 @@ const DropdownButton$1 = styled.button`
|
|
|
39186
39306
|
align-items: center;
|
|
39187
39307
|
justify-content: space-between;
|
|
39188
39308
|
width: 100%;
|
|
39189
|
-
min-width: 120px;
|
|
39190
|
-
background-color: ${props =>
|
|
39309
|
+
min-width: 120px;
|
|
39310
|
+
background-color: ${props => {
|
|
39311
|
+
// When row is being hovered (regardless of focus state), use hover color
|
|
39312
|
+
if (props.$isRowHovered) {
|
|
39313
|
+
return props.$selectedColor; // Use selected color for row hover
|
|
39314
|
+
}
|
|
39315
|
+
// Row focused/selected state (only when NOT hovering the row) - should use selected color
|
|
39316
|
+
if (props.$isRowFocused) {
|
|
39317
|
+
return props.$selectedColor; // Use selected color when row is focused/selected
|
|
39318
|
+
}
|
|
39319
|
+
// Default
|
|
39320
|
+
return 'white';
|
|
39321
|
+
}};
|
|
39191
39322
|
border: none;
|
|
39192
39323
|
border-radius: 0;
|
|
39193
39324
|
font-family: "Poppins", sans-serif;
|
|
@@ -39220,7 +39351,22 @@ const DropdownIcon = styled.div`
|
|
|
39220
39351
|
justify-content: center;
|
|
39221
39352
|
width: 20px;
|
|
39222
39353
|
height: 20px;
|
|
39223
|
-
background-color: ${props =>
|
|
39354
|
+
background-color: ${props => {
|
|
39355
|
+
// Highest Priority: dropdown-specific hover takes precedence over everything
|
|
39356
|
+
if (props.$isDropdownHovered) {
|
|
39357
|
+
return '#B4D1D2'; // Green color when specifically hovering this dropdown
|
|
39358
|
+
}
|
|
39359
|
+
// When row is being hovered (regardless of focus state), other dropdowns should use hover color
|
|
39360
|
+
if (props.$isRowHovered) {
|
|
39361
|
+
return '#E6F0F0'; // Light gray when row is hovered but not this specific dropdown
|
|
39362
|
+
}
|
|
39363
|
+
// Row focused/selected state (only when NOT hovering the row) - should use green color
|
|
39364
|
+
if (props.$isRowFocused) {
|
|
39365
|
+
return '#B4D1D2'; // Green color when row is focused/selected but not being hovered
|
|
39366
|
+
}
|
|
39367
|
+
// Default
|
|
39368
|
+
return 'white';
|
|
39369
|
+
}};
|
|
39224
39370
|
border-radius: 4px;
|
|
39225
39371
|
margin-left: 8px;
|
|
39226
39372
|
transition: all 0.2s ease;
|
|
@@ -39232,8 +39378,14 @@ const DropdownIcon = styled.div`
|
|
|
39232
39378
|
const DropdownMenu = styled.div`
|
|
39233
39379
|
position: absolute;
|
|
39234
39380
|
top: calc(100%);
|
|
39235
|
-
|
|
39236
|
-
|
|
39381
|
+
${props => {
|
|
39382
|
+
if (props.$dropdownOptionsAlignment === 'left') {
|
|
39383
|
+
return props.$dropdownOptionsWidth ? `left: 0; width: ${props.$dropdownOptionsWidth};` : 'left: 0; right: 0;';
|
|
39384
|
+
} else {
|
|
39385
|
+
// Default: right alignment
|
|
39386
|
+
return props.$dropdownOptionsWidth ? `right: 0; width: ${props.$dropdownOptionsWidth};` : 'left: 0; right: 0;';
|
|
39387
|
+
}
|
|
39388
|
+
}}
|
|
39237
39389
|
z-index: 1000;
|
|
39238
39390
|
background-color: white;
|
|
39239
39391
|
border: none;
|
|
@@ -39302,23 +39454,41 @@ const Dropdown = ({
|
|
|
39302
39454
|
maxDropdownHeight,
|
|
39303
39455
|
isRowFocused = false,
|
|
39304
39456
|
isRowHovered = false,
|
|
39305
|
-
selectedColor
|
|
39457
|
+
selectedColor,
|
|
39458
|
+
dropdownOptionsWidth,
|
|
39459
|
+
dropdownOptionsAlignment = 'right',
|
|
39460
|
+
placeholder = 'Select...'
|
|
39306
39461
|
}) => {
|
|
39307
|
-
|
|
39462
|
+
const [isDropdownHovered, setIsDropdownHovered] = useState(false);
|
|
39463
|
+
|
|
39464
|
+
// Reset dropdown hover state when dropdown closes
|
|
39465
|
+
useEffect(() => {
|
|
39466
|
+
if (!isOpen) {
|
|
39467
|
+
setIsDropdownHovered(false);
|
|
39468
|
+
}
|
|
39469
|
+
}, [isOpen]);
|
|
39470
|
+
return /*#__PURE__*/React$1.createElement(DropdownContainer$1, {
|
|
39471
|
+
onMouseEnter: () => setIsDropdownHovered(true),
|
|
39472
|
+
onMouseLeave: () => setIsDropdownHovered(false)
|
|
39473
|
+
}, /*#__PURE__*/React$1.createElement(DropdownButton$1, {
|
|
39308
39474
|
onClick: onToggle,
|
|
39309
39475
|
$isOpen: isOpen,
|
|
39310
39476
|
$isRowFocused: isRowFocused,
|
|
39477
|
+
$isRowHovered: isRowHovered,
|
|
39311
39478
|
$selectedColor: selectedColor
|
|
39312
39479
|
}, /*#__PURE__*/React$1.createElement("span", null, displayText), /*#__PURE__*/React$1.createElement(DropdownIcon, {
|
|
39313
39480
|
$isOpen: isOpen,
|
|
39314
39481
|
$isRowFocused: isRowFocused,
|
|
39315
|
-
$isRowHovered: isRowHovered
|
|
39482
|
+
$isRowHovered: isRowHovered,
|
|
39483
|
+
$isDropdownHovered: isDropdownHovered
|
|
39316
39484
|
}, /*#__PURE__*/React$1.createElement(MenuItemOpenIcon, {
|
|
39317
39485
|
width: "10",
|
|
39318
39486
|
height: "6",
|
|
39319
39487
|
color: "#212121"
|
|
39320
39488
|
}))), isOpen && /*#__PURE__*/React$1.createElement(DropdownMenu, {
|
|
39321
|
-
$maxDropdownHeight: maxDropdownHeight
|
|
39489
|
+
$maxDropdownHeight: maxDropdownHeight,
|
|
39490
|
+
$dropdownOptionsWidth: dropdownOptionsWidth,
|
|
39491
|
+
$dropdownOptionsAlignment: dropdownOptionsAlignment
|
|
39322
39492
|
}, options.map((option, index) => /*#__PURE__*/React$1.createElement(DropdownOption, {
|
|
39323
39493
|
key: index,
|
|
39324
39494
|
onClick: e => onOptionSelect(option, e),
|
|
@@ -39342,7 +39512,10 @@ Dropdown.propTypes = {
|
|
|
39342
39512
|
maxDropdownHeight: PropTypes.string,
|
|
39343
39513
|
isRowFocused: PropTypes.bool,
|
|
39344
39514
|
isRowHovered: PropTypes.bool,
|
|
39345
|
-
selectedColor: PropTypes.string
|
|
39515
|
+
selectedColor: PropTypes.string,
|
|
39516
|
+
dropdownOptionsWidth: PropTypes.string,
|
|
39517
|
+
dropdownOptionsAlignment: PropTypes.oneOf(['left', 'right']),
|
|
39518
|
+
placeholder: PropTypes.string
|
|
39346
39519
|
};
|
|
39347
39520
|
|
|
39348
39521
|
// TableBody.jsx
|
|
@@ -39381,6 +39554,8 @@ const TableBody = ({
|
|
|
39381
39554
|
expandedBackgroundColor = '#E6F0F0',
|
|
39382
39555
|
// New prop with default
|
|
39383
39556
|
onDropdownSelected = () => {},
|
|
39557
|
+
onCheckboxClick = () => {},
|
|
39558
|
+
onHeaderCheckboxClick = () => {},
|
|
39384
39559
|
ref = null
|
|
39385
39560
|
}) => {
|
|
39386
39561
|
const [hoveredRowIndex, setHoveredRowIndex] = useState(null);
|
|
@@ -39730,10 +39905,13 @@ const TableBody = ({
|
|
|
39730
39905
|
const isOpen = openDropdowns[dropdownKey] || false;
|
|
39731
39906
|
const dropdownOptions = column.dropdownOptions || [];
|
|
39732
39907
|
const maxDropdownHeight = column.maxDropdownHeight || '200px';
|
|
39908
|
+
const dropdownOptionsWidth = column.dropdownOptionsWidth; // Get from column config
|
|
39909
|
+
const dropdownOptionsAlignment = column.dropdownOptionsAlignment || 'right'; // Get from column config, default to 'right'
|
|
39910
|
+
const placeholder = column.placeholder || 'Select...'; // Get from column config, default to 'Select...'
|
|
39733
39911
|
|
|
39734
39912
|
// Find the current selected option to display its label
|
|
39735
39913
|
const currentOption = dropdownOptions.find(option => option.value === value);
|
|
39736
|
-
const displayText = currentOption ? currentOption.label : value ||
|
|
39914
|
+
const displayText = currentOption ? currentOption.label : value || placeholder;
|
|
39737
39915
|
return /*#__PURE__*/React$1.createElement(Dropdown, {
|
|
39738
39916
|
isOpen: isOpen,
|
|
39739
39917
|
options: dropdownOptions,
|
|
@@ -39742,10 +39920,37 @@ const TableBody = ({
|
|
|
39742
39920
|
onToggle: e => handleDropdownClick(rowIndex, column.key, e),
|
|
39743
39921
|
onOptionSelect: (option, e) => handleDropdownOptionClick(row, rowIndex, column.key, option, e),
|
|
39744
39922
|
maxDropdownHeight: maxDropdownHeight,
|
|
39923
|
+
dropdownOptionsWidth: dropdownOptionsWidth,
|
|
39924
|
+
dropdownOptionsAlignment: dropdownOptionsAlignment,
|
|
39925
|
+
placeholder: placeholder,
|
|
39745
39926
|
isRowFocused: focusedRowIndex === rowIndex,
|
|
39746
39927
|
isRowHovered: hoveredRowIndex === rowIndex,
|
|
39747
39928
|
selectedColor: selectedColor
|
|
39748
39929
|
});
|
|
39930
|
+
case 'checkbox':
|
|
39931
|
+
const isChecked = Boolean(value); // Convert to boolean
|
|
39932
|
+
|
|
39933
|
+
return /*#__PURE__*/React$1.createElement("div", {
|
|
39934
|
+
style: {
|
|
39935
|
+
display: 'flex',
|
|
39936
|
+
alignItems: 'center',
|
|
39937
|
+
justifyContent: 'center',
|
|
39938
|
+
width: '100%',
|
|
39939
|
+
height: '100%'
|
|
39940
|
+
}
|
|
39941
|
+
}, /*#__PURE__*/React$1.createElement("input", {
|
|
39942
|
+
type: "checkbox",
|
|
39943
|
+
checked: isChecked,
|
|
39944
|
+
onChange: e => handleCheckboxClick(row, column.key, e),
|
|
39945
|
+
onClick: e => e.stopPropagation() // Prevent row click on checkbox click
|
|
39946
|
+
,
|
|
39947
|
+
style: {
|
|
39948
|
+
width: '18px',
|
|
39949
|
+
height: '18px',
|
|
39950
|
+
cursor: 'pointer',
|
|
39951
|
+
accentColor: buttonColor // Use the theme color for checkbox
|
|
39952
|
+
}
|
|
39953
|
+
}));
|
|
39749
39954
|
default:
|
|
39750
39955
|
// Treat default as text
|
|
39751
39956
|
return value.toString();
|
|
@@ -39765,6 +39970,28 @@ const TableBody = ({
|
|
|
39765
39970
|
}
|
|
39766
39971
|
};
|
|
39767
39972
|
|
|
39973
|
+
// Handle checkbox click
|
|
39974
|
+
const handleCheckboxClick = (row, columnKey, event) => {
|
|
39975
|
+
event.stopPropagation();
|
|
39976
|
+
const currentValue = row[columnKey];
|
|
39977
|
+
const newValue = !currentValue; // Toggle the value
|
|
39978
|
+
|
|
39979
|
+
// Create updated row with new checkbox value
|
|
39980
|
+
const updatedRow = {
|
|
39981
|
+
...row,
|
|
39982
|
+
[columnKey]: newValue
|
|
39983
|
+
};
|
|
39984
|
+
|
|
39985
|
+
// Fire the onCheckboxClick event with updated row
|
|
39986
|
+
if (onCheckboxClick) {
|
|
39987
|
+
onCheckboxClick({
|
|
39988
|
+
fullRow: updatedRow,
|
|
39989
|
+
columnName: columnKey,
|
|
39990
|
+
checked: newValue
|
|
39991
|
+
});
|
|
39992
|
+
}
|
|
39993
|
+
};
|
|
39994
|
+
|
|
39768
39995
|
// Handle dropdown click
|
|
39769
39996
|
const handleDropdownClick = (rowIndex, columnKey, event) => {
|
|
39770
39997
|
event.stopPropagation();
|
|
@@ -39901,6 +40128,8 @@ TableBody.propTypes = {
|
|
|
39901
40128
|
onCommentSave: PropTypes.func,
|
|
39902
40129
|
commentTextLimit: PropTypes.number,
|
|
39903
40130
|
onDropdownSelected: PropTypes.func,
|
|
40131
|
+
onCheckboxClick: PropTypes.func,
|
|
40132
|
+
onHeaderCheckboxClick: PropTypes.func,
|
|
39904
40133
|
ref: PropTypes.object
|
|
39905
40134
|
};
|
|
39906
40135
|
TableBody.displayName = 'TableBody';
|
|
@@ -43260,6 +43489,9 @@ const Table = props => {
|
|
|
43260
43489
|
expandedBackgroundColor = '#E6F0F0',
|
|
43261
43490
|
// New prop
|
|
43262
43491
|
onDropdownSelected = () => {},
|
|
43492
|
+
onCheckboxClick = () => {},
|
|
43493
|
+
onHeaderCheckboxClick = () => {},
|
|
43494
|
+
headerCheckboxStates = {},
|
|
43263
43495
|
// Accept ref as a regular prop
|
|
43264
43496
|
ref = null
|
|
43265
43497
|
} = props;
|
|
@@ -43386,7 +43618,9 @@ const Table = props => {
|
|
|
43386
43618
|
onSort: onSort,
|
|
43387
43619
|
onFilter: onFilter,
|
|
43388
43620
|
onSelectAll: onSelectAll,
|
|
43389
|
-
expandable: expandable
|
|
43621
|
+
expandable: expandable,
|
|
43622
|
+
onHeaderCheckboxClick: onHeaderCheckboxClick,
|
|
43623
|
+
headerCheckboxStates: headerCheckboxStates
|
|
43390
43624
|
}), columns.length > 0 && data.length > 0 && /*#__PURE__*/React$1.createElement(TableBody, {
|
|
43391
43625
|
ref: tableBodyRef,
|
|
43392
43626
|
columns: columns,
|
|
@@ -43407,7 +43641,9 @@ const Table = props => {
|
|
|
43407
43641
|
expandedContent: expandedContent,
|
|
43408
43642
|
onExpandRow: onExpandRow,
|
|
43409
43643
|
expandedBackgroundColor: expandedBackgroundColor,
|
|
43410
|
-
onDropdownSelected: onDropdownSelected
|
|
43644
|
+
onDropdownSelected: onDropdownSelected,
|
|
43645
|
+
onCheckboxClick: onCheckboxClick,
|
|
43646
|
+
onHeaderCheckboxClick: onHeaderCheckboxClick
|
|
43411
43647
|
})), data.length === 0 && /*#__PURE__*/React$1.createElement(NoEventsParent, null, /*#__PURE__*/React$1.createElement(NoEventsWrapper, null, showNoDataInSearch ? getNoDataSearchIcon(noDataSearchIcon) : getNoDataIcon(noDataIcon)), /*#__PURE__*/React$1.createElement(NoEventsMessage, null, showNoDataInSearch ? /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement("strong", null, noDataInSearchTitle), /*#__PURE__*/React$1.createElement("br", null), noDataInSearchMessage) : /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement("strong", null, noEventsTitle), /*#__PURE__*/React$1.createElement("br", null), noEventsSubtitle)), !showNoDataInSearch && showNoEventsButton && /*#__PURE__*/React$1.createElement(Button$1, {
|
|
43412
43648
|
height: "45px",
|
|
43413
43649
|
leftIcon: noEventsButtonIcon,
|