sag_components 2.0.0-beta343 → 2.0.0-beta344
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 +113 -83
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +113 -83
- package/dist/index.js.map +1 -1
- package/dist/types/icons/CalendarIcon.d.ts +3 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -646,21 +646,41 @@ const ChervronLeftIcon = _ref => {
|
|
|
646
646
|
|
|
647
647
|
const CalendarIcon = _ref => {
|
|
648
648
|
let {
|
|
649
|
-
clicked,
|
|
650
649
|
width = "14",
|
|
651
650
|
height = "14",
|
|
652
|
-
|
|
653
|
-
color
|
|
651
|
+
color = "#212121"
|
|
654
652
|
} = _ref;
|
|
655
653
|
return /*#__PURE__*/React__default["default"].createElement("svg", {
|
|
656
654
|
width: width,
|
|
657
655
|
height: height,
|
|
658
|
-
viewBox: "0 0
|
|
656
|
+
viewBox: "0 0 24 24",
|
|
659
657
|
fill: "none",
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
658
|
+
stroke: color,
|
|
659
|
+
strokeWidth: "2",
|
|
660
|
+
strokeLinecap: "round",
|
|
661
|
+
strokeLinejoin: "round"
|
|
662
|
+
}, /*#__PURE__*/React__default["default"].createElement("rect", {
|
|
663
|
+
x: "3",
|
|
664
|
+
y: "4",
|
|
665
|
+
width: "18",
|
|
666
|
+
height: "18",
|
|
667
|
+
rx: "2",
|
|
668
|
+
ry: "2"
|
|
669
|
+
}), /*#__PURE__*/React__default["default"].createElement("line", {
|
|
670
|
+
x1: "16",
|
|
671
|
+
y1: "2",
|
|
672
|
+
x2: "16",
|
|
673
|
+
y2: "6"
|
|
674
|
+
}), /*#__PURE__*/React__default["default"].createElement("line", {
|
|
675
|
+
x1: "8",
|
|
676
|
+
y1: "2",
|
|
677
|
+
x2: "8",
|
|
678
|
+
y2: "6"
|
|
679
|
+
}), /*#__PURE__*/React__default["default"].createElement("line", {
|
|
680
|
+
x1: "3",
|
|
681
|
+
y1: "10",
|
|
682
|
+
x2: "21",
|
|
683
|
+
y2: "10"
|
|
664
684
|
}));
|
|
665
685
|
};
|
|
666
686
|
|
|
@@ -9025,28 +9045,27 @@ const IconContainer$5 = styled__default["default"].div`
|
|
|
9025
9045
|
cursor: pointer;
|
|
9026
9046
|
`;
|
|
9027
9047
|
|
|
9028
|
-
const DropdownSingleNew =
|
|
9029
|
-
|
|
9030
|
-
|
|
9031
|
-
|
|
9032
|
-
|
|
9033
|
-
|
|
9034
|
-
|
|
9035
|
-
|
|
9036
|
-
|
|
9037
|
-
|
|
9038
|
-
|
|
9039
|
-
|
|
9040
|
-
|
|
9041
|
-
|
|
9042
|
-
|
|
9043
|
-
|
|
9044
|
-
|
|
9045
|
-
|
|
9046
|
-
|
|
9047
|
-
|
|
9048
|
-
|
|
9049
|
-
} = _ref;
|
|
9048
|
+
const DropdownSingleNew = ({
|
|
9049
|
+
label,
|
|
9050
|
+
labelEmptyValue,
|
|
9051
|
+
options,
|
|
9052
|
+
selectedValue,
|
|
9053
|
+
onChange,
|
|
9054
|
+
required,
|
|
9055
|
+
disabled,
|
|
9056
|
+
width,
|
|
9057
|
+
height,
|
|
9058
|
+
minHeight,
|
|
9059
|
+
withMarginBottom = true,
|
|
9060
|
+
error,
|
|
9061
|
+
errorMessage,
|
|
9062
|
+
xIconShow,
|
|
9063
|
+
labelColor,
|
|
9064
|
+
showLabelOnTop,
|
|
9065
|
+
orderBy,
|
|
9066
|
+
placeHolder = "",
|
|
9067
|
+
elementType
|
|
9068
|
+
}) => {
|
|
9050
9069
|
const [isFocused, setIsFocused] = React$1.useState(false);
|
|
9051
9070
|
const [showOptions, setShowOptions] = React$1.useState(false);
|
|
9052
9071
|
const [showAbove, setShowAbove] = React$1.useState(false);
|
|
@@ -9581,29 +9600,28 @@ const IconContainer$4 = styled__default["default"].div`
|
|
|
9581
9600
|
cursor: pointer;
|
|
9582
9601
|
`;
|
|
9583
9602
|
|
|
9584
|
-
const DropdownMultiNew =
|
|
9585
|
-
|
|
9586
|
-
|
|
9587
|
-
|
|
9588
|
-
|
|
9589
|
-
|
|
9590
|
-
|
|
9591
|
-
|
|
9592
|
-
|
|
9593
|
-
|
|
9594
|
-
|
|
9595
|
-
|
|
9596
|
-
|
|
9597
|
-
|
|
9598
|
-
|
|
9599
|
-
|
|
9600
|
-
|
|
9601
|
-
|
|
9602
|
-
|
|
9603
|
-
|
|
9604
|
-
|
|
9605
|
-
|
|
9606
|
-
} = _ref;
|
|
9603
|
+
const DropdownMultiNew = ({
|
|
9604
|
+
label,
|
|
9605
|
+
labelEmptyValue,
|
|
9606
|
+
options,
|
|
9607
|
+
selectedValue,
|
|
9608
|
+
onChange,
|
|
9609
|
+
required,
|
|
9610
|
+
disabled,
|
|
9611
|
+
width,
|
|
9612
|
+
height,
|
|
9613
|
+
minHeight,
|
|
9614
|
+
withMarginBottom = true,
|
|
9615
|
+
error,
|
|
9616
|
+
errorMessage,
|
|
9617
|
+
labelColor,
|
|
9618
|
+
xIconShow,
|
|
9619
|
+
checkBoxColor,
|
|
9620
|
+
showLabelOnTop,
|
|
9621
|
+
orderBy,
|
|
9622
|
+
elementType,
|
|
9623
|
+
showSelectAll = false
|
|
9624
|
+
}) => {
|
|
9607
9625
|
const [isFocused, setIsFocused] = React$1.useState(false);
|
|
9608
9626
|
const [showOptions, setShowOptions] = React$1.useState(false);
|
|
9609
9627
|
const [showAbove, setShowAbove] = React$1.useState(false);
|
|
@@ -10250,9 +10268,12 @@ const DatePicker = ({
|
|
|
10250
10268
|
if (value === '' || value === undefined) {
|
|
10251
10269
|
setStartDate(null);
|
|
10252
10270
|
setEndDate(null);
|
|
10271
|
+
setCurrentStartDate(new Date());
|
|
10253
10272
|
} else {
|
|
10254
|
-
|
|
10273
|
+
const parsedStart = new Date(startDateValue);
|
|
10274
|
+
setStartDate(parsedStart);
|
|
10255
10275
|
setEndDate(new Date(endDateValue));
|
|
10276
|
+
setCurrentStartDate(parsedStart);
|
|
10256
10277
|
}
|
|
10257
10278
|
}, [value, isOpen]);
|
|
10258
10279
|
const renderDatePicker = () => {
|
|
@@ -10366,48 +10387,61 @@ const RangePicker = _ref => {
|
|
|
10366
10387
|
const [startDateValue, setStartDateValue] = React$1.useState(null); // Added value state
|
|
10367
10388
|
const [endDateValue, setEndDateValue] = React$1.useState(null); // Added value state
|
|
10368
10389
|
|
|
10369
|
-
const
|
|
10370
|
-
const [hoverOptionsContainer, setHoverOptionsContainer] = React$1.useState(false);
|
|
10371
|
-
const inputRef = React$1.useRef(null);
|
|
10390
|
+
const containerRef = React$1.useRef(null);
|
|
10372
10391
|
React$1.useEffect(() => {
|
|
10373
10392
|
const handleClickOutside = event => {
|
|
10374
|
-
if (
|
|
10393
|
+
if (containerRef.current && !containerRef.current.contains(event.target)) {
|
|
10375
10394
|
setIsFocused(false);
|
|
10395
|
+
setIsOpen(false);
|
|
10376
10396
|
}
|
|
10377
10397
|
};
|
|
10378
|
-
|
|
10379
|
-
// Add event listener for clicks on the document
|
|
10380
10398
|
document.addEventListener('mousedown', handleClickOutside);
|
|
10381
|
-
|
|
10382
|
-
// Cleanup event listener on component unmount
|
|
10383
10399
|
return () => {
|
|
10384
10400
|
document.removeEventListener('mousedown', handleClickOutside);
|
|
10385
10401
|
};
|
|
10386
10402
|
}, []);
|
|
10387
10403
|
React$1.useEffect(() => {
|
|
10388
|
-
if (selectedValue
|
|
10389
|
-
|
|
10390
|
-
|
|
10391
|
-
const
|
|
10404
|
+
if (!selectedValue) return;
|
|
10405
|
+
if (selectedValue.includes(' - ')) {
|
|
10406
|
+
// DD/MM/YYYY - DD/MM/YYYY format
|
|
10407
|
+
const parts = selectedValue.split(' - ');
|
|
10408
|
+
if (parts.length !== 2) return;
|
|
10409
|
+
const startDate = moment(parts[0].trim(), 'DD/MM/YYYY', true);
|
|
10410
|
+
const endDate = moment(parts[1].trim(), 'DD/MM/YYYY', true);
|
|
10411
|
+
if (!startDate.isValid() || !endDate.isValid()) return;
|
|
10412
|
+
setStartDateValue(startDate.format('MM/DD/YYYY'));
|
|
10413
|
+
setEndDateValue(endDate.format('MM/DD/YYYY'));
|
|
10414
|
+
setValue(selectedValue);
|
|
10415
|
+
} else if (selectedValue.includes('-')) {
|
|
10416
|
+
// MM/DD/YYYY-MM/DD/YYYY format
|
|
10417
|
+
const parts = selectedValue.split('-');
|
|
10418
|
+
if (parts.length !== 2) return;
|
|
10419
|
+
const startDate = new Date(parts[0].trim());
|
|
10420
|
+
const endDate = new Date(parts[1].trim());
|
|
10421
|
+
if (isNaN(startDate.getTime()) || isNaN(endDate.getTime())) return;
|
|
10392
10422
|
setStartDateValue(moment(startDate).format('MM/DD/YYYY'));
|
|
10393
10423
|
setEndDateValue(moment(endDate).format('MM/DD/YYYY'));
|
|
10394
10424
|
setValue(selectedValue);
|
|
10395
10425
|
}
|
|
10396
10426
|
}, [selectedValue]);
|
|
10397
|
-
|
|
10398
|
-
if (!
|
|
10399
|
-
|
|
10400
|
-
|
|
10401
|
-
|
|
10402
|
-
|
|
10427
|
+
const getDisplayValue = val => {
|
|
10428
|
+
if (!val) return '';
|
|
10429
|
+
if (val.includes(' - ')) return val; // already DD/MM/YYYY - DD/MM/YYYY
|
|
10430
|
+
const parts = val.split('-');
|
|
10431
|
+
if (parts.length !== 2) return val;
|
|
10432
|
+
const start = moment(parts[0].trim(), 'MM/DD/YYYY', true);
|
|
10433
|
+
const end = moment(parts[1].trim(), 'MM/DD/YYYY', true);
|
|
10434
|
+
if (!start.isValid() || !end.isValid()) return val;
|
|
10435
|
+
return `${start.format('DD/MM/YYYY')} - ${end.format('DD/MM/YYYY')}`;
|
|
10436
|
+
};
|
|
10403
10437
|
const onChangeDate = (startDate, endDate) => {
|
|
10404
10438
|
if (startDate && endDate) {
|
|
10405
10439
|
setIsOpen(!isOpen);
|
|
10406
10440
|
setIsFocused(false);
|
|
10407
10441
|
setStartDateValue(startDate);
|
|
10408
10442
|
setEndDateValue(endDate);
|
|
10409
|
-
onChange(`${moment(startDate).format('MM/DD/YYYY')}
|
|
10410
|
-
setValue(`${moment(startDate).format('MM/DD/YYYY')}
|
|
10443
|
+
onChange(`${moment(startDate).format('MM/DD/YYYY')}-${moment(endDate).format('MM/DD/YYYY')}`);
|
|
10444
|
+
setValue(`${moment(startDate).format('MM/DD/YYYY')}-${moment(endDate).format('MM/DD/YYYY')}`);
|
|
10411
10445
|
}
|
|
10412
10446
|
};
|
|
10413
10447
|
const onChangeEvent = e => {
|
|
@@ -10432,6 +10466,7 @@ const RangePicker = _ref => {
|
|
|
10432
10466
|
};
|
|
10433
10467
|
return /*#__PURE__*/React__default["default"].createElement(RangePickerContainer, {
|
|
10434
10468
|
className: "RangePickerContainer",
|
|
10469
|
+
ref: containerRef,
|
|
10435
10470
|
onClick: handleFocus,
|
|
10436
10471
|
width: width,
|
|
10437
10472
|
height: height
|
|
@@ -10442,22 +10477,19 @@ const RangePicker = _ref => {
|
|
|
10442
10477
|
disabled: disabled,
|
|
10443
10478
|
textColor: textColor,
|
|
10444
10479
|
borderColor: borderColor,
|
|
10445
|
-
borderColorFocus: borderColorFocus
|
|
10446
|
-
onMouseEnter: () => setHoverInputContainer(true),
|
|
10447
|
-
onMouseLeave: () => setHoverInputContainer(false)
|
|
10480
|
+
borderColorFocus: borderColorFocus
|
|
10448
10481
|
}, /*#__PURE__*/React__default["default"].createElement(StyledLabel$3, {
|
|
10449
10482
|
className: "StyledLabel",
|
|
10450
10483
|
onClick: handleFocus,
|
|
10451
10484
|
isFocused: isFocused,
|
|
10452
|
-
hasValue: value,
|
|
10485
|
+
hasValue: getDisplayValue(value),
|
|
10453
10486
|
disabled: disabled,
|
|
10454
10487
|
textColor: textColor,
|
|
10455
10488
|
borderColor: borderColor,
|
|
10456
10489
|
borderColorFocus: borderColorFocus
|
|
10457
10490
|
}, label, required && /*#__PURE__*/React__default["default"].createElement(RequiredIndicator$3, null, "*")), /*#__PURE__*/React__default["default"].createElement(StyledInput$6, {
|
|
10458
10491
|
className: "StyledInput",
|
|
10459
|
-
|
|
10460
|
-
value: value,
|
|
10492
|
+
value: getDisplayValue(value),
|
|
10461
10493
|
isFocused: isFocused,
|
|
10462
10494
|
onChange: onChangeEvent,
|
|
10463
10495
|
onFocus: handleFocus,
|
|
@@ -10480,9 +10512,7 @@ const RangePicker = _ref => {
|
|
|
10480
10512
|
className: "Calendar",
|
|
10481
10513
|
fill: calendarIconColor
|
|
10482
10514
|
}))), /*#__PURE__*/React__default["default"].createElement(OptionsContainer$5, {
|
|
10483
|
-
className: "OptionsContainer"
|
|
10484
|
-
onMouseEnter: () => setHoverOptionsContainer(true),
|
|
10485
|
-
onMouseLeave: () => setHoverOptionsContainer(false)
|
|
10515
|
+
className: "OptionsContainer"
|
|
10486
10516
|
}, /*#__PURE__*/React__default["default"].createElement(DatePicker, {
|
|
10487
10517
|
className: "DatePicker",
|
|
10488
10518
|
isOpen: isOpen,
|