@sinco/react 1.1.2-rc.54 → 1.1.2-rc.55

Sign up to get free protection for your applications and to get access to all the features.
Binary file
package/index.esm.js CHANGED
@@ -14453,22 +14453,32 @@ const FooterAction = ({
14453
14453
  }), /*#__PURE__*/React__default.createElement(Box$2, null, labelChangeCounter), rightContent));
14454
14454
  };
14455
14455
 
14456
- const useProgress = (timeProgress, lote) => {
14457
- const [progress, setProgress] = useState(0);
14456
+ const useProgress = (initialProgress, timeProgress, shouldDecrease, lote) => {
14457
+ const [progress, setProgress] = useState(initialProgress);
14458
14458
  useEffect(() => {
14459
14459
  const interval = setInterval(() => {
14460
14460
  setProgress(prev => {
14461
- if (prev >= 100) {
14462
- clearInterval(interval);
14461
+ if (shouldDecrease) {
14462
+ if (prev <= 0 || prev >= 100) {
14463
+ clearInterval(interval);
14464
+ return prev;
14465
+ }
14466
+ const nextProgress = lote ? prev - lote : prev - 1;
14467
+ return nextProgress < 0 ? 0 : nextProgress;
14468
+ } else {
14469
+ if (prev >= 100) {
14470
+ clearInterval(interval);
14471
+ return prev;
14472
+ }
14473
+ const nextProgress = lote ? prev + lote : prev + 1;
14474
+ return nextProgress > 100 ? 100 : nextProgress;
14463
14475
  }
14464
- const nextProgress = lote ? prev + lote : prev;
14465
- return nextProgress > 100 ? 100 : nextProgress;
14466
14476
  });
14467
14477
  }, timeProgress * 10);
14468
14478
  return () => {
14469
14479
  clearInterval(interval);
14470
14480
  };
14471
- }, [timeProgress, lote]);
14481
+ }, [initialProgress, timeProgress, shouldDecrease, lote]);
14472
14482
  return {
14473
14483
  progressToast: progress
14474
14484
  };
@@ -14480,7 +14490,7 @@ const ToastNotification = toast => {
14480
14490
  const timeProgress = toast.time || 10;
14481
14491
  const {
14482
14492
  progressToast
14483
- } = useProgress(timeProgress);
14493
+ } = useProgress(99, timeProgress, true);
14484
14494
  const toastColorConfig = toast.type || 'info';
14485
14495
  const toastIconOption = {
14486
14496
  success: /*#__PURE__*/React__default.createElement(CheckCircleRounded, null),
@@ -14496,7 +14506,7 @@ const ToastNotification = toast => {
14496
14506
  setStateOptions(prevShowOptions => !prevShowOptions);
14497
14507
  };
14498
14508
  useEffect(() => {
14499
- progressToast >= 100 && setStateToast(false);
14509
+ progressToast <= 0 && setStateToast(false);
14500
14510
  }, [progressToast]);
14501
14511
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, stateToast && ( /*#__PURE__*/React__default.createElement(Stack$1, {
14502
14512
  position: 'fixed',
@@ -14583,7 +14593,6 @@ const ToastNotification = toast => {
14583
14593
  color: toastColorConfig
14584
14594
  }, stateOptions ? 'Ver más' : 'Ver menos', stateOptions ? /*#__PURE__*/React__default.createElement(KeyboardArrowDown, null) : /*#__PURE__*/React__default.createElement(KeyboardArrowUp, null)))))), /*#__PURE__*/React__default.createElement(LinearProgress$1, {
14585
14595
  sx: {
14586
- transform: 'rotate(180deg)',
14587
14596
  '.MuiLinearProgress-bar': {
14588
14597
  transition: '0.1s linear !important'
14589
14598
  }
@@ -14651,6 +14660,73 @@ const PageHeader = ({
14651
14660
  }, actions))));
14652
14661
  };
14653
14662
 
14663
+ var spinnerSinco = "6b9c10915ea2b5ed.gif";
14664
+
14665
+ const ProgressSinco = ({
14666
+ time,
14667
+ variant: _variant = 'indeterminate',
14668
+ valueBuffer,
14669
+ lote: _lote = 0,
14670
+ porcent: _porcent = true,
14671
+ text: _text = true,
14672
+ progress: _progress = true,
14673
+ gif: _gif = true
14674
+ }) => {
14675
+ const timeProgress = time || 10;
14676
+ const [showToast, setShowToast] = useState(true);
14677
+ const {
14678
+ progressToast
14679
+ } = useProgress(0, timeProgress, false, _lote);
14680
+ useEffect(() => {
14681
+ if (progressToast >= 100) {
14682
+ setShowToast(false);
14683
+ }
14684
+ }, [progressToast]);
14685
+ return /*#__PURE__*/React__default.createElement(Stack$1, {
14686
+ position: 'fixed',
14687
+ zIndex: 1000,
14688
+ height: '100%',
14689
+ width: '100%',
14690
+ alignItems: 'center',
14691
+ justifyContent: 'center'
14692
+ }, showToast && ( /*#__PURE__*/React__default.createElement(Stack$1, {
14693
+ width: 226,
14694
+ gap: 0.8,
14695
+ justifyContent: 'center',
14696
+ alignItems: 'center'
14697
+ }, _gif && ( /*#__PURE__*/React__default.createElement(Stack$1, {
14698
+ width: 300,
14699
+ height: 60,
14700
+ justifyContent: 'center'
14701
+ }, /*#__PURE__*/React__default.createElement("img", {
14702
+ src: spinnerSinco,
14703
+ alt: "logo"
14704
+ }))), _text && ( /*#__PURE__*/React__default.createElement(Typography$1, {
14705
+ variant: "body2",
14706
+ color: 'text.secondary'
14707
+ }, "Progresando...")), _progress && ( /*#__PURE__*/React__default.createElement(LinearProgress$1, {
14708
+ value: progressToast,
14709
+ variant: _variant === 'lote' ? 'determinate' : _variant,
14710
+ valueBuffer: valueBuffer,
14711
+ color: "primary",
14712
+ sx: {
14713
+ backgroundColor: SincoTheme.palette.primary[50],
14714
+ clipPath: 'polygon(5% 0, 100% 0, 95% 100%, 0 100%)',
14715
+ height: 10,
14716
+ width: 226,
14717
+ '.MuiLinearProgress-dashed': {
14718
+ top: _variant === 'buffer' ? 2.5 : 0
14719
+ },
14720
+ '.MuiLinearProgress-bar': {
14721
+ clipPath: 'polygon(5% 0, 100% 0, 95% 100%, 0 100%)'
14722
+ }
14723
+ }
14724
+ })), _porcent && ( /*#__PURE__*/React__default.createElement(Typography$1, {
14725
+ color: 'text.secondary',
14726
+ variant: "subtitle2"
14727
+ }, `${progressToast}%`)))));
14728
+ };
14729
+
14654
14730
  var global$6 = global$i;
14655
14731
  var classof$3 = classofRaw$2;
14656
14732
 
@@ -20166,4 +20242,4 @@ const useDynamicColor = url => {
20166
20242
  };
20167
20243
  };
20168
20244
 
20169
- export { AdproSincoTheme, DrawerComponent as Drawer, DrawerComponent, DynamicColor, EmptyState, EmptyStateImageUrls, FooterAction, PageHeader, PageHeaderWraps, SincoTheme, ToastNotification, useDynamicColor };
20245
+ export { AdproSincoTheme, DrawerComponent as Drawer, DrawerComponent, DynamicColor, EmptyState, EmptyStateImageUrls, FooterAction, PageHeader, PageHeaderWraps, ProgressSinco, SincoTheme, ToastNotification, useDynamicColor };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sinco/react",
3
- "version": "1.1.2-rc.54",
3
+ "version": "1.1.2-rc.55",
4
4
  "description": "package for the configuration of mui react sinco",
5
5
  "private": false,
6
6
  "license": "MIT",
@@ -10,5 +10,5 @@ interface ProgressProps {
10
10
  gif?: boolean;
11
11
  progress?: boolean;
12
12
  }
13
- export declare const Progres: FC<ProgressProps>;
13
+ export declare const ProgressSinco: FC<ProgressProps>;
14
14
  export {};
@@ -3,3 +3,4 @@ export * from "./Drawer";
3
3
  export * from "./FooterAction";
4
4
  export * from "./ToastNotification";
5
5
  export * from "./PageHeader";
6
+ export * from './Progress';
@@ -1,3 +1,3 @@
1
- export declare const useProgress: (timeProgress: number, lote?: number) => {
1
+ export declare const useProgress: (initialProgress: number, timeProgress: number, shouldDecrease: boolean, lote?: number) => {
2
2
  progressToast: number;
3
3
  };