@majoo-ui/react 1.62.5 → 1.62.6
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/index.esm.js +110 -50
- package/package.json +1 -1
package/index.esm.js
CHANGED
|
@@ -22080,8 +22080,19 @@ function pickerReducer(state, action) {
|
|
|
22080
22080
|
switch (action.type) {
|
|
22081
22081
|
case UPDATE_PICKER:
|
|
22082
22082
|
{
|
|
22083
|
+
const current = state.selectedDate;
|
|
22084
|
+
const next = action.payload;
|
|
22085
|
+
// Bail out if the value hasn't changed — prevents infinite re-render loops
|
|
22086
|
+
// caused by the circular: dispatch → selectedDate → DatePicker effect → onChange → dispatch
|
|
22087
|
+
if (current === next) return state;
|
|
22088
|
+
if (current instanceof Date && next instanceof Date && current.getTime() === next.getTime()) {
|
|
22089
|
+
return state;
|
|
22090
|
+
}
|
|
22091
|
+
if (Array.isArray(current) && Array.isArray(next) && current.length === next.length && current.every((d, i) => d instanceof Date && next[i] instanceof Date && d.getTime() === next[i].getTime())) {
|
|
22092
|
+
return state;
|
|
22093
|
+
}
|
|
22083
22094
|
return Object.assign(Object.assign({}, state), {
|
|
22084
|
-
selectedDate:
|
|
22095
|
+
selectedDate: next
|
|
22085
22096
|
});
|
|
22086
22097
|
}
|
|
22087
22098
|
case TODAY:
|
|
@@ -24522,11 +24533,14 @@ const PaginationButton = ({
|
|
|
24522
24533
|
currentPage,
|
|
24523
24534
|
totalPages,
|
|
24524
24535
|
onSelect,
|
|
24525
|
-
hideInputPageSection
|
|
24536
|
+
hideInputPageSection,
|
|
24537
|
+
previousButton,
|
|
24538
|
+
nextButton,
|
|
24539
|
+
gotoPageText,
|
|
24540
|
+
goToPagePlaceholder,
|
|
24541
|
+
btnCancelText,
|
|
24542
|
+
btnSubmitText
|
|
24526
24543
|
}) => {
|
|
24527
|
-
const {
|
|
24528
|
-
t
|
|
24529
|
-
} = useTranslation('MajooUI/pagination');
|
|
24530
24544
|
const isLg = useMediaQuery('(max-width: 800px)');
|
|
24531
24545
|
const handleSelectPage = page => {
|
|
24532
24546
|
if (onSelect && page > 0 && page <= totalPages) {
|
|
@@ -24605,7 +24619,7 @@ const PaginationButton = ({
|
|
|
24605
24619
|
isDisabled: currentPage === 1,
|
|
24606
24620
|
color: currentPage === 1 ? 'disable' : 'primary',
|
|
24607
24621
|
onClick: () => handleSelectPage(currentPage - 1)
|
|
24608
|
-
},
|
|
24622
|
+
}, previousButton || 'Sebelumnya')), generatePages().map((page, index) => {
|
|
24609
24623
|
return /*#__PURE__*/React__default.createElement(PageButton, {
|
|
24610
24624
|
key: index.toString(),
|
|
24611
24625
|
isActive: page === currentPage,
|
|
@@ -24622,7 +24636,7 @@ const PaginationButton = ({
|
|
|
24622
24636
|
isDisabled: currentPage === totalPages,
|
|
24623
24637
|
color: currentPage === totalPages ? 'disable' : 'primary',
|
|
24624
24638
|
onClick: () => handleSelectPage(currentPage + 1)
|
|
24625
|
-
},
|
|
24639
|
+
}, nextButton || 'Selanjutnya'), !isLg && /*#__PURE__*/React__default.createElement(IconButton, {
|
|
24626
24640
|
type: "button",
|
|
24627
24641
|
buttonType: "secondary",
|
|
24628
24642
|
disabled: currentPage === totalPages,
|
|
@@ -24657,7 +24671,7 @@ const PaginationButton = ({
|
|
|
24657
24671
|
padding: 4,
|
|
24658
24672
|
borderRadius: 4
|
|
24659
24673
|
})
|
|
24660
|
-
},
|
|
24674
|
+
}, gotoPageText || 'Ke Halaman'), isMobilePagination ? /*#__PURE__*/React__default.createElement(GoToPageBox, {
|
|
24661
24675
|
align: "center",
|
|
24662
24676
|
justify: "center",
|
|
24663
24677
|
onClick: () => {
|
|
@@ -24691,7 +24705,7 @@ const PaginationButton = ({
|
|
|
24691
24705
|
}
|
|
24692
24706
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
24693
24707
|
ref: dialogPageRef
|
|
24694
|
-
})), /*#__PURE__*/React__default.createElement(ModalDialogTitle, null,
|
|
24708
|
+
})), /*#__PURE__*/React__default.createElement(ModalDialogTitle, null, gotoPageText || 'Ke Halaman'), /*#__PURE__*/React__default.createElement(ModalDialogContent, null, /*#__PURE__*/React__default.createElement("form", {
|
|
24695
24709
|
onSubmit: () => {
|
|
24696
24710
|
var _dialogPageRef$curren2;
|
|
24697
24711
|
debouncedGoToPage(Number(goToPage));
|
|
@@ -24699,7 +24713,7 @@ const PaginationButton = ({
|
|
|
24699
24713
|
}
|
|
24700
24714
|
}, /*#__PURE__*/React__default.createElement(InputNumber, {
|
|
24701
24715
|
ref: inputPageRef,
|
|
24702
|
-
placeholder:
|
|
24716
|
+
placeholder: goToPagePlaceholder || 'Contoh: 10',
|
|
24703
24717
|
isAllowed: ({
|
|
24704
24718
|
floatValue
|
|
24705
24719
|
}) => floatValue === undefined || floatValue > 0 && floatValue <= totalPages,
|
|
@@ -24722,7 +24736,7 @@ const PaginationButton = ({
|
|
|
24722
24736
|
setGoToPage(null);
|
|
24723
24737
|
(_dialogPageRef$curren3 = dialogPageRef.current) == null || _dialogPageRef$curren3.click();
|
|
24724
24738
|
}
|
|
24725
|
-
},
|
|
24739
|
+
}, btnCancelText || 'Batal'), /*#__PURE__*/React__default.createElement(Button$4, {
|
|
24726
24740
|
block: true,
|
|
24727
24741
|
type: "button",
|
|
24728
24742
|
buttonType: "primary",
|
|
@@ -24731,10 +24745,10 @@ const PaginationButton = ({
|
|
|
24731
24745
|
debouncedGoToPage(Number(goToPage));
|
|
24732
24746
|
(_dialogPageRef$curren4 = dialogPageRef.current) == null || _dialogPageRef$curren4.click();
|
|
24733
24747
|
}
|
|
24734
|
-
},
|
|
24748
|
+
}, btnSubmitText || 'Lanjutkan')))));
|
|
24735
24749
|
};
|
|
24736
24750
|
|
|
24737
|
-
const _excluded$4 = ["limits", "selectedLimit", "currentPage", "totalData", "onChange"];
|
|
24751
|
+
const _excluded$4 = ["limits", "selectedLimit", "currentPage", "totalData", "onChange", "showingText", "showingCountText", "dialogShowingText"];
|
|
24738
24752
|
const LimitContainer = styled(Flex$1, {
|
|
24739
24753
|
cursor: 'pointer'
|
|
24740
24754
|
});
|
|
@@ -24757,12 +24771,14 @@ function PaginationInfo(_ref) {
|
|
|
24757
24771
|
selectedLimit,
|
|
24758
24772
|
currentPage,
|
|
24759
24773
|
totalData,
|
|
24760
|
-
onChange
|
|
24774
|
+
onChange,
|
|
24775
|
+
showingText,
|
|
24776
|
+
showingCountText,
|
|
24777
|
+
dialogShowingText
|
|
24761
24778
|
} = _ref;
|
|
24762
24779
|
_objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
24763
|
-
const
|
|
24764
|
-
|
|
24765
|
-
} = useTranslation('MajooUI/pagination');
|
|
24780
|
+
const from = (currentPage - 1) * selectedLimit + 1;
|
|
24781
|
+
const to = selectedLimit * currentPage < totalData ? selectedLimit * currentPage : totalData;
|
|
24766
24782
|
const dialogLimitRef = useRef();
|
|
24767
24783
|
const isMobilePagination = useMediaQuery('(max-width: 767px)');
|
|
24768
24784
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Flex$1, {
|
|
@@ -24771,7 +24787,7 @@ function PaginationInfo(_ref) {
|
|
|
24771
24787
|
}, /*#__PURE__*/React__default.createElement(Text$1, {
|
|
24772
24788
|
color: "secondary",
|
|
24773
24789
|
variant: "label"
|
|
24774
|
-
},
|
|
24790
|
+
}, showingText || 'Tampilkan:'), /*#__PURE__*/React__default.createElement(Popover, null, /*#__PURE__*/React__default.createElement(ConditionalWrapper, {
|
|
24775
24791
|
condition: !isMobilePagination,
|
|
24776
24792
|
wrapper: child => /*#__PURE__*/React__default.createElement(PopoverTrigger, null, child)
|
|
24777
24793
|
}, /*#__PURE__*/React__default.createElement(LimitContainer, {
|
|
@@ -24806,17 +24822,17 @@ function PaginationInfo(_ref) {
|
|
|
24806
24822
|
}, limit.toString())))))), /*#__PURE__*/React__default.createElement(Text$1, {
|
|
24807
24823
|
color: "secondary",
|
|
24808
24824
|
variant: "label"
|
|
24809
|
-
},
|
|
24810
|
-
|
|
24811
|
-
|
|
24812
|
-
totalData
|
|
24813
|
-
}))), /*#__PURE__*/React__default.createElement(ModalDialog, null, /*#__PURE__*/React__default.createElement(ModalDialogTrigger, {
|
|
24825
|
+
}, typeof showingCountText === 'function' ? showingCountText({
|
|
24826
|
+
from,
|
|
24827
|
+
to,
|
|
24828
|
+
total: totalData
|
|
24829
|
+
}) : showingCountText || `Ditampilkan ${from} - ${to} dari ${totalData} data`)), /*#__PURE__*/React__default.createElement(ModalDialog, null, /*#__PURE__*/React__default.createElement(ModalDialogTrigger, {
|
|
24814
24830
|
style: {
|
|
24815
24831
|
display: 'none'
|
|
24816
24832
|
}
|
|
24817
24833
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
24818
24834
|
ref: dialogLimitRef
|
|
24819
|
-
})), /*#__PURE__*/React__default.createElement(ModalDialogTitle, null,
|
|
24835
|
+
})), /*#__PURE__*/React__default.createElement(ModalDialogTitle, null, dialogShowingText || 'Tampilkan Data'), /*#__PURE__*/React__default.createElement(ModalDialogContent, {
|
|
24820
24836
|
style: {
|
|
24821
24837
|
padding: 0
|
|
24822
24838
|
}
|
|
@@ -24844,7 +24860,7 @@ function PaginationInfo(_ref) {
|
|
|
24844
24860
|
}, limit.toString()))))));
|
|
24845
24861
|
}
|
|
24846
24862
|
|
|
24847
|
-
const _excluded$3 = ["limit", "currentPage", "totalData", "totalPage", "hideDataInfo", "onLimitChange", "onPageChange", "rowsPerPageOptions", "hidePagination", "hideInputPageSection"];
|
|
24863
|
+
const _excluded$3 = ["limit", "currentPage", "totalData", "totalPage", "hideDataInfo", "onLimitChange", "onPageChange", "rowsPerPageOptions", "hidePagination", "hideInputPageSection", "showingText", "showingCountText", "dialogShowingText", "previousButton", "nextButton", "gotoPageText", "goToPagePlaceholder", "btnCancelText", "btnSubmitText"];
|
|
24848
24864
|
function Pagination(_ref) {
|
|
24849
24865
|
let {
|
|
24850
24866
|
limit,
|
|
@@ -24856,7 +24872,16 @@ function Pagination(_ref) {
|
|
|
24856
24872
|
onPageChange,
|
|
24857
24873
|
rowsPerPageOptions,
|
|
24858
24874
|
hidePagination,
|
|
24859
|
-
hideInputPageSection
|
|
24875
|
+
hideInputPageSection,
|
|
24876
|
+
showingText,
|
|
24877
|
+
showingCountText,
|
|
24878
|
+
dialogShowingText,
|
|
24879
|
+
previousButton,
|
|
24880
|
+
nextButton,
|
|
24881
|
+
gotoPageText,
|
|
24882
|
+
goToPagePlaceholder,
|
|
24883
|
+
btnCancelText,
|
|
24884
|
+
btnSubmitText
|
|
24860
24885
|
} = _ref,
|
|
24861
24886
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
24862
24887
|
const totalPages = totalPage || Math.ceil(totalData / limit);
|
|
@@ -24871,12 +24896,21 @@ function Pagination(_ref) {
|
|
|
24871
24896
|
selectedLimit: limit,
|
|
24872
24897
|
currentPage: currentPage,
|
|
24873
24898
|
totalData: totalData,
|
|
24874
|
-
onChange: onLimitChange
|
|
24899
|
+
onChange: onLimitChange,
|
|
24900
|
+
showingText: showingText,
|
|
24901
|
+
showingCountText: showingCountText,
|
|
24902
|
+
dialogShowingText: dialogShowingText
|
|
24875
24903
|
}) : /*#__PURE__*/React__default.createElement(Box, null), !hidePagination && /*#__PURE__*/React__default.createElement(PaginationButton, {
|
|
24876
24904
|
currentPage: currentPage,
|
|
24877
24905
|
totalPages: totalPages,
|
|
24878
24906
|
onSelect: onPageChange,
|
|
24879
|
-
hideInputPageSection: hideInputPageSection
|
|
24907
|
+
hideInputPageSection: hideInputPageSection,
|
|
24908
|
+
previousButton: previousButton,
|
|
24909
|
+
nextButton: nextButton,
|
|
24910
|
+
gotoPageText: gotoPageText,
|
|
24911
|
+
goToPagePlaceholder: goToPagePlaceholder,
|
|
24912
|
+
btnCancelText: btnCancelText,
|
|
24913
|
+
btnSubmitText: btnSubmitText
|
|
24880
24914
|
}));
|
|
24881
24915
|
}
|
|
24882
24916
|
Pagination.propTypes = {
|
|
@@ -24888,7 +24922,25 @@ Pagination.propTypes = {
|
|
|
24888
24922
|
onLimitChange: PropTypes.func,
|
|
24889
24923
|
onPageChange: PropTypes.func,
|
|
24890
24924
|
hidePagination: PropTypes.bool,
|
|
24891
|
-
hideInputPageSection: PropTypes.bool
|
|
24925
|
+
hideInputPageSection: PropTypes.bool,
|
|
24926
|
+
/** Label for "Show:" text in pagination info */
|
|
24927
|
+
showingText: PropTypes.string,
|
|
24928
|
+
/** Label for the "Showing X - Y of Z data" text. Can be a string or a function ({ from, to, total }) => string */
|
|
24929
|
+
showingCountText: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
24930
|
+
/** Title for the mobile limit selection dialog */
|
|
24931
|
+
dialogShowingText: PropTypes.string,
|
|
24932
|
+
/** Label for previous page button */
|
|
24933
|
+
previousButton: PropTypes.string,
|
|
24934
|
+
/** Label for next page button */
|
|
24935
|
+
nextButton: PropTypes.string,
|
|
24936
|
+
/** Label for "Go to page" text and dialog title */
|
|
24937
|
+
gotoPageText: PropTypes.string,
|
|
24938
|
+
/** Placeholder for go to page input */
|
|
24939
|
+
goToPagePlaceholder: PropTypes.string,
|
|
24940
|
+
/** Label for cancel button in go-to-page dialog */
|
|
24941
|
+
btnCancelText: PropTypes.string,
|
|
24942
|
+
/** Label for submit button in go-to-page dialog */
|
|
24943
|
+
btnSubmitText: PropTypes.string
|
|
24892
24944
|
};
|
|
24893
24945
|
Pagination.displayName = 'Pagination';
|
|
24894
24946
|
|
|
@@ -27853,7 +27905,7 @@ const StyledTitle = styled(ADialog.Title, {
|
|
|
27853
27905
|
fontSize: 17,
|
|
27854
27906
|
fontWeight: 500
|
|
27855
27907
|
});
|
|
27856
|
-
const StyledDescription$1 = styled(
|
|
27908
|
+
const StyledDescription$1 = styled('div', {
|
|
27857
27909
|
mx: 24,
|
|
27858
27910
|
my: 20,
|
|
27859
27911
|
color: colors$7.gray900,
|
|
@@ -30586,7 +30638,6 @@ const IconStateFull = _ref => {
|
|
|
30586
30638
|
})));
|
|
30587
30639
|
};
|
|
30588
30640
|
const Upload = ({
|
|
30589
|
-
placeholder,
|
|
30590
30641
|
listType,
|
|
30591
30642
|
multiple,
|
|
30592
30643
|
fileList,
|
|
@@ -30626,11 +30677,12 @@ const Upload = ({
|
|
|
30626
30677
|
customPreviewIcon,
|
|
30627
30678
|
onPreviewIconClick,
|
|
30628
30679
|
maxWidthOrHeight,
|
|
30629
|
-
theme
|
|
30680
|
+
theme,
|
|
30681
|
+
uploadingLabel,
|
|
30682
|
+
placeholder,
|
|
30683
|
+
cancelLabel,
|
|
30684
|
+
saveLabel
|
|
30630
30685
|
}) => {
|
|
30631
|
-
const {
|
|
30632
|
-
t
|
|
30633
|
-
} = useTranslation(['MajooUI/upload', 'translation']);
|
|
30634
30686
|
const isFile = listType === 'file';
|
|
30635
30687
|
const imgRef = useRef(null);
|
|
30636
30688
|
const indexReplace = useRef(null);
|
|
@@ -31076,7 +31128,7 @@ const Upload = ({
|
|
|
31076
31128
|
type: "button",
|
|
31077
31129
|
onClick: () => handleReplace(index),
|
|
31078
31130
|
buttonType: "ghost"
|
|
31079
|
-
}, replaceLabel
|
|
31131
|
+
}, replaceLabel || 'Ubah Berkas'));
|
|
31080
31132
|
}
|
|
31081
31133
|
const renderPicture = () => {
|
|
31082
31134
|
return fileList == null ? void 0 : fileList.map((item, index) => {
|
|
@@ -31219,7 +31271,7 @@ const Upload = ({
|
|
|
31219
31271
|
onCompleted: () => setTimeout(() => setIsLoading(false), 1000)
|
|
31220
31272
|
}), /*#__PURE__*/React__default.createElement(Text, {
|
|
31221
31273
|
hidden: !progress
|
|
31222
|
-
}, `${progress <= 100 ? progress : 100}%`), /*#__PURE__*/React__default.createElement(Text, null,
|
|
31274
|
+
}, `${progress <= 100 ? progress : 100}%`), /*#__PURE__*/React__default.createElement(Text, null, uploadingLabel || 'Berkas sedang diunggah')));
|
|
31223
31275
|
}
|
|
31224
31276
|
function renderUpload() {
|
|
31225
31277
|
return /*#__PURE__*/React__default.createElement(FocusArea, {
|
|
@@ -31244,7 +31296,7 @@ const Upload = ({
|
|
|
31244
31296
|
css: {
|
|
31245
31297
|
margin: '$spacing-04 $spacing-05 0 $spacing-05'
|
|
31246
31298
|
}
|
|
31247
|
-
}, placeholder
|
|
31299
|
+
}, placeholder || 'Pilih atau letakkan berkas di sini')))), error && /*#__PURE__*/React__default.createElement(ErrorMessage, {
|
|
31248
31300
|
css: {
|
|
31249
31301
|
width: width - 5
|
|
31250
31302
|
}
|
|
@@ -31271,7 +31323,7 @@ const Upload = ({
|
|
|
31271
31323
|
width: 300,
|
|
31272
31324
|
whiteSpace: 'nowrap'
|
|
31273
31325
|
}
|
|
31274
|
-
}, cropperTitle ||
|
|
31326
|
+
}, cropperTitle || 'Potong Gambar'), /*#__PURE__*/React__default.createElement(ModalDialogContent, {
|
|
31275
31327
|
css: {
|
|
31276
31328
|
padding: '$spacing-03 $spacing-07',
|
|
31277
31329
|
overflowY: 'auto',
|
|
@@ -31310,13 +31362,9 @@ const Upload = ({
|
|
|
31310
31362
|
}, /*#__PURE__*/React__default.createElement(Button$4, {
|
|
31311
31363
|
buttonType: "secondary",
|
|
31312
31364
|
onClick: toggleModal
|
|
31313
|
-
},
|
|
31314
|
-
ns: 'translation'
|
|
31315
|
-
})), /*#__PURE__*/React__default.createElement(Button$4, {
|
|
31365
|
+
}, cancelLabel || 'Batal'), /*#__PURE__*/React__default.createElement(Button$4, {
|
|
31316
31366
|
onClick: handleCrop
|
|
31317
|
-
},
|
|
31318
|
-
ns: 'translation'
|
|
31319
|
-
}))))));
|
|
31367
|
+
}, saveLabel || 'Simpan')))));
|
|
31320
31368
|
}
|
|
31321
31369
|
return /*#__PURE__*/React__default.createElement(Flex$1, {
|
|
31322
31370
|
direction: "row",
|
|
@@ -31351,10 +31399,6 @@ Upload.defaultProps = {
|
|
|
31351
31399
|
maxWidthOrHeight: 1024
|
|
31352
31400
|
};
|
|
31353
31401
|
Upload.propTypes = {
|
|
31354
|
-
/**
|
|
31355
|
-
Placeholder label of upload.
|
|
31356
|
-
*/
|
|
31357
|
-
placeholder: PropTypes.string,
|
|
31358
31402
|
/**
|
|
31359
31403
|
Disabled state of upload.
|
|
31360
31404
|
*/
|
|
@@ -31505,7 +31549,23 @@ Upload.propTypes = {
|
|
|
31505
31549
|
/**
|
|
31506
31550
|
Set max width or height of image
|
|
31507
31551
|
*/
|
|
31508
|
-
maxWidthOrHeight: PropTypes.number
|
|
31552
|
+
maxWidthOrHeight: PropTypes.number,
|
|
31553
|
+
/**
|
|
31554
|
+
Label for the uploading state text.
|
|
31555
|
+
*/
|
|
31556
|
+
uploadingLabel: PropTypes.string,
|
|
31557
|
+
/**
|
|
31558
|
+
Label for the upload area placeholder.
|
|
31559
|
+
*/
|
|
31560
|
+
placeholder: PropTypes.string,
|
|
31561
|
+
/**
|
|
31562
|
+
Label for the cancel button in the cropper dialog.
|
|
31563
|
+
*/
|
|
31564
|
+
cancelLabel: PropTypes.string,
|
|
31565
|
+
/**
|
|
31566
|
+
Label for the save button in the cropper dialog.
|
|
31567
|
+
*/
|
|
31568
|
+
saveLabel: PropTypes.string
|
|
31509
31569
|
};
|
|
31510
31570
|
Upload.displayName = 'Upload';
|
|
31511
31571
|
|