@sinco/react 1.1.2-rc.73 → 1.1.2-rc.74

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 CHANGED
@@ -13393,7 +13393,7 @@ var FooterAction = function FooterAction(_ref) {
13393
13393
  }), React__default.createElement(Box$2, null, labelChangeCounter), rightContent));
13394
13394
  };
13395
13395
 
13396
- var useProgress = function useProgress(timeProgress) {
13396
+ var useProgress = function useProgress(timeProgress, lote) {
13397
13397
  var _useState = useState(0),
13398
13398
  _useState2 = _slicedToArray(_useState, 2),
13399
13399
  progress = _useState2[0],
@@ -13404,15 +13404,20 @@ var useProgress = function useProgress(timeProgress) {
13404
13404
  if (prev >= 100) {
13405
13405
  clearInterval(interval);
13406
13406
  }
13407
- return prev + 1;
13407
+ if (lote) {
13408
+ var nextProgress = prev + lote;
13409
+ return nextProgress <= 100 ? nextProgress : 100;
13410
+ } else {
13411
+ return prev + 1;
13412
+ }
13408
13413
  });
13409
13414
  }, timeProgress * 10);
13410
13415
  return function () {
13411
13416
  clearInterval(interval);
13412
13417
  };
13413
- }, [timeProgress]);
13418
+ }, [timeProgress, lote]);
13414
13419
  return {
13415
- progressToast: progress
13420
+ progress: progress
13416
13421
  };
13417
13422
  };
13418
13423
 
@@ -13427,7 +13432,7 @@ var ToastNotification = function ToastNotification(toast) {
13427
13432
  setStateToast = _useState4[1];
13428
13433
  var timeProgress = toast.time || 10;
13429
13434
  var _useProgress = useProgress(timeProgress),
13430
- progressToast = _useProgress.progressToast;
13435
+ progress = _useProgress.progress;
13431
13436
  var toastColorConfig = toast.type || 'info';
13432
13437
  var toastIconOption = {
13433
13438
  success: React__default.createElement(CheckCircleRounded, null),
@@ -13445,8 +13450,8 @@ var ToastNotification = function ToastNotification(toast) {
13445
13450
  });
13446
13451
  };
13447
13452
  useEffect(function () {
13448
- progressToast >= 100 && setStateToast(false);
13449
- }, [progressToast]);
13453
+ progress >= 100 && setStateToast(false);
13454
+ }, [progress]);
13450
13455
  return React__default.createElement(React__default.Fragment, null, stateToast && React__default.createElement(Stack$1, {
13451
13456
  position: 'fixed',
13452
13457
  zIndex: 1400,
@@ -13542,7 +13547,7 @@ var ToastNotification = function ToastNotification(toast) {
13542
13547
  },
13543
13548
  color: toastColorConfig,
13544
13549
  variant: "determinate",
13545
- value: 100 - progressToast
13550
+ value: 100 - progress
13546
13551
  })));
13547
13552
  };
13548
13553
 
@@ -13599,6 +13604,70 @@ var PageHeader = function PageHeader(_ref2) {
13599
13604
  }, actions)));
13600
13605
  };
13601
13606
 
13607
+ var ProgressSinco = function ProgressSinco(_ref) {
13608
+ var time = _ref.time,
13609
+ _ref$variant = _ref.variant,
13610
+ variant = _ref$variant === void 0 ? 'indeterminate' : _ref$variant,
13611
+ valueBuffer = _ref.valueBuffer,
13612
+ _ref$lote = _ref.lote,
13613
+ lote = _ref$lote === void 0 ? 0 : _ref$lote;
13614
+ var timeProgress = time || 10;
13615
+ var _useState = useState(true),
13616
+ _useState2 = _slicedToArray(_useState, 2),
13617
+ showToast = _useState2[0],
13618
+ setShowToast = _useState2[1];
13619
+ var _useProgress = useProgress(timeProgress, lote),
13620
+ progress = _useProgress.progress;
13621
+ useEffect(function () {
13622
+ if (progress >= 100) {
13623
+ setShowToast(false);
13624
+ }
13625
+ }, [progress]);
13626
+ return React__default.createElement(React__default.Fragment, null, showToast && React__default.createElement(Stack$1, {
13627
+ position: 'fixed',
13628
+ zIndex: 1000,
13629
+ height: '100%',
13630
+ width: '100%',
13631
+ alignItems: 'center',
13632
+ justifyContent: 'center'
13633
+ }, React__default.createElement(Stack$1, {
13634
+ width: 226,
13635
+ gap: 0.8,
13636
+ justifyContent: 'center',
13637
+ alignItems: 'center'
13638
+ }, React__default.createElement(Stack$1, {
13639
+ width: 300,
13640
+ height: 60,
13641
+ justifyContent: 'center'
13642
+ }, React__default.createElement("img", {
13643
+ src: '../assets/spinner.gif',
13644
+ alt: "logo"
13645
+ })), React__default.createElement(Typography$1, {
13646
+ variant: "body2",
13647
+ color: 'text.secondary'
13648
+ }, "Progresando..."), React__default.createElement(LinearProgress$1, {
13649
+ value: progress,
13650
+ variant: variant === 'lote' ? 'determinate' : variant,
13651
+ valueBuffer: valueBuffer,
13652
+ color: "primary",
13653
+ sx: {
13654
+ backgroundColor: SincoTheme.palette.primary[50],
13655
+ clipPath: 'polygon(5% 0, 100% 0, 95% 100%, 0 100%)',
13656
+ height: 10,
13657
+ width: 226,
13658
+ '.MuiLinearProgress-dashed': {
13659
+ top: variant === 'buffer' ? 2.5 : 0
13660
+ },
13661
+ '.MuiLinearProgress-bar': {
13662
+ clipPath: 'polygon(5% 0, 100% 0, 95% 100%, 0 100%)'
13663
+ }
13664
+ }
13665
+ }), React__default.createElement(Typography$1, {
13666
+ color: 'text.secondary',
13667
+ variant: "subtitle2"
13668
+ }, "".concat(progress, "%")))));
13669
+ };
13670
+
13602
13671
  /**
13603
13672
  * @license
13604
13673
  * Copyright 2021 Google LLC
@@ -18005,4 +18074,4 @@ var useDynamicColor = function useDynamicColor(url) {
18005
18074
  };
18006
18075
  };
18007
18076
 
18008
- export { AdproSincoTheme, DrawerComponent as Drawer, DrawerComponent, DynamicColor, EmptyStateComponent as EmptyState, EmptyStateComponent, FooterAction, PageHeader, PageHeaderWraps, SincoTheme, ToastNotification, useDynamicColor };
18077
+ export { AdproSincoTheme, DrawerComponent as Drawer, DrawerComponent, DynamicColor, EmptyStateComponent as EmptyState, EmptyStateComponent, 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.73",
3
+ "version": "1.1.2-rc.74",
4
4
  "description": "package for the configuration of mui react sinco",
5
5
  "private": false,
6
6
  "license": "MIT",
@@ -0,0 +1,10 @@
1
+ import { FC } from 'react';
2
+ type Variant = 'buffer' | 'determinate' | 'indeterminate' | 'query' | 'lote';
3
+ interface ProgressProps {
4
+ time?: number;
5
+ variant?: Variant;
6
+ valueBuffer?: number;
7
+ lote?: number;
8
+ }
9
+ export declare const ProgressSinco: FC<ProgressProps>;
10
+ 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 "./ProgressSinco";
@@ -1,3 +1,3 @@
1
- export declare const useProgress: (timeProgress: number) => {
2
- progressToast: number;
1
+ export declare const useProgress: (timeProgress: number, lote?: number) => {
2
+ progress: number;
3
3
  };
File without changes