@beydesign/storybook 0.0.82 → 0.0.84

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.
@@ -0,0 +1 @@
1
+ { "nm": "Main Scene", "ddd": 0, "h": 8, "w": 302, "meta": { "g": "@lottiefiles/creator 1.45.0" }, "layers": [{ "ty": 4, "nm": "Masque", "sr": 1, "st": 0, "op": 2250.58391725058, "ip": 0, "hd": false, "ddd": 0, "bm": 0, "hasMask": false, "td": 1, "ao": 0, "ks": { "a": { "a": 0, "k": [-15.75, 16.08405002307892], "ix": 1 }, "s": { "a": 0, "k": [100, 100, 100], "ix": 6 }, "sk": { "a": 0, "k": 0 }, "p": { "a": 0, "k": [151.25, 4.08405002307892], "ix": 2 }, "r": { "a": 0, "k": 0, "ix": 10 }, "sa": { "a": 0, "k": 0 }, "o": { "a": 0, "k": 100, "ix": 11 } }, "shapes": [{ "ty": "gr", "bm": 0, "hd": false, "mn": "ADBE Vector Group", "nm": "Rectangle 1", "ix": 1, "cix": 2, "np": 3, "it": [{ "ty": "rc", "bm": 0, "hd": false, "mn": "ADBE Vector Shape - Rect", "nm": "Tracé rectangulaire 1", "d": 1, "p": { "a": 0, "k": [0, 0], "ix": 3 }, "r": { "a": 0, "k": 20, "ix": 4 }, "s": { "a": 0, "k": [300, 4], "ix": 2 } }, { "ty": "st", "bm": 0, "hd": false, "mn": "ADBE Vector Graphic - Stroke", "nm": "Contour 1", "lc": 1, "lj": 1, "ml": 4, "o": { "a": 0, "k": 100, "ix": 4 }, "w": { "a": 0, "k": 0, "ix": 5 }, "c": { "a": 0, "k": [1, 1, 1], "ix": 3 } }, { "ty": "fl", "bm": 0, "hd": false, "mn": "ADBE Vector Graphic - Fill", "nm": "Fond 1", "c": { "a": 0, "k": [0.9216, 1, 1], "ix": 4 }, "r": 1, "o": { "a": 0, "k": 100, "ix": 5 } }, { "ty": "tr", "a": { "a": 0, "k": [0, 0], "ix": 1 }, "s": { "a": 0, "k": [100, 100], "ix": 3 }, "sk": { "a": 0, "k": 0, "ix": 4 }, "p": { "a": 0, "k": [-15.75, 16.062], "ix": 2 }, "r": { "a": 0, "k": 0, "ix": 6 }, "sa": { "a": 0, "k": 0, "ix": 5 }, "o": { "a": 0, "k": 100, "ix": 7 } }] }], "ind": 1 }, { "ty": 4, "nm": "Item barre", "sr": 1, "st": 0, "op": 2250.58391725058, "ip": 0, "hd": false, "ddd": 0, "bm": 0, "tt": 1, "hasMask": false, "ao": 0, "ks": { "a": { "a": 0, "k": [0, 0, 0], "ix": 1 }, "s": { "a": 0, "k": [100, 100, 100], "ix": 6 }, "sk": { "a": 0, "k": 0 }, "p": { "a": 1, "k": [{ "o": { "x": 0.333, "y": 0 }, "i": { "x": 0.667, "y": 1 }, "s": [46, -12, 0], "t": 0 }, { "o": { "x": 0.167, "y": 0.167 }, "i": { "x": 0.833, "y": 0.833 }, "s": [498, -12, 0], "t": 50 }, { "o": { "x": 0.167, "y": 0.167 }, "i": { "x": 0.833, "y": 0.833 }, "s": [46, -12, 0], "t": 51 }, { "o": { "x": 0.333, "y": 0 }, "i": { "x": 0.667, "y": 1 }, "s": [46, -12, 0], "t": 53 }, { "s": [498, -12, 0], "t": 103 }], "ix": 2 }, "r": { "a": 0, "k": 0, "ix": 10 }, "sa": { "a": 0, "k": 0 }, "o": { "a": 1, "k": [{ "o": { "x": 0.167, "y": 0.167 }, "i": { "x": 0.833, "y": 0.833 }, "s": [100], "t": 46 }, { "o": { "x": 0.167, "y": 0.167 }, "i": { "x": 0.833, "y": 0.833 }, "s": [0], "t": 49 }, { "o": { "x": 0.167, "y": 0.167 }, "i": { "x": 0.833, "y": 0.833 }, "s": [0], "t": 51 }, { "s": [100], "t": 52 }], "ix": 11 } }, "shapes": [{ "ty": "gr", "bm": 0, "hd": false, "mn": "ADBE Vector Group", "nm": "Rectangle 1", "ix": 1, "cix": 2, "np": 3, "it": [{ "ty": "rc", "bm": 0, "hd": false, "mn": "ADBE Vector Shape - Rect", "nm": "Tracé rectangulaire 1", "d": 1, "p": { "a": 0, "k": [0, 0], "ix": 3 }, "r": { "a": 0, "k": 20, "ix": 4 }, "s": { "a": 0, "k": [100, 4], "ix": 2 } }, { "ty": "st", "bm": 0, "hd": false, "mn": "ADBE Vector Graphic - Stroke", "nm": "Contour 1", "lc": 1, "lj": 1, "ml": 4, "o": { "a": 0, "k": 100, "ix": 4 }, "w": { "a": 0, "k": 0, "ix": 5 }, "c": { "a": 0, "k": [1, 1, 1], "ix": 3 } }, { "ty": "fl", "bm": 0, "hd": false, "mn": "ADBE Vector Graphic - Fill", "nm": "Fond 1", "c": { "a": 0, "k": [0.2902, 0.1216, 0.7216], "ix": 4 }, "r": 1, "o": { "a": 0, "k": 100, "ix": 5 } }, { "ty": "tr", "a": { "a": 0, "k": [0, 0], "ix": 1 }, "s": { "a": 0, "k": [100, 100], "ix": 3 }, "sk": { "a": 0, "k": 0, "ix": 4 }, "p": { "a": 0, "k": [-115.75, 16.062], "ix": 2 }, "r": { "a": 0, "k": 0, "ix": 6 }, "sa": { "a": 0, "k": 0, "ix": 5 }, "o": { "a": 0, "k": 100, "ix": 7 } }] }], "ind": 2, "tp": 1 }, { "ty": 4, "nm": "Barre", "sr": 1, "st": 0, "op": 2250.58391725058, "ip": 0, "hd": false, "ddd": 0, "bm": 0, "hasMask": false, "ao": 0, "ks": { "a": { "a": 0, "k": [-15.75, 16.08405002307892], "ix": 1 }, "s": { "a": 0, "k": [100, 100, 100], "ix": 6 }, "sk": { "a": 0, "k": 0 }, "p": { "a": 0, "k": [151.25, 4.08405002307892], "ix": 2 }, "r": { "a": 0, "k": 0, "ix": 10 }, "sa": { "a": 0, "k": 0 }, "o": { "a": 0, "k": 100, "ix": 11 } }, "shapes": [{ "ty": "gr", "bm": 0, "hd": false, "mn": "ADBE Vector Group", "nm": "Rectangle 1", "ix": 1, "cix": 2, "np": 3, "it": [{ "ty": "rc", "bm": 0, "hd": false, "mn": "ADBE Vector Shape - Rect", "nm": "Tracé rectangulaire 1", "d": 1, "p": { "a": 0, "k": [0, 0], "ix": 3 }, "r": { "a": 0, "k": 20, "ix": 4 }, "s": { "a": 0, "k": [300, 4], "ix": 2 } }, { "ty": "st", "bm": 0, "hd": false, "mn": "ADBE Vector Graphic - Stroke", "nm": "Contour 1", "lc": 1, "lj": 1, "ml": 4, "o": { "a": 0, "k": 100, "ix": 4 }, "w": { "a": 0, "k": 0, "ix": 5 }, "c": { "a": 0, "k": [1, 1, 1], "ix": 3 } }, { "ty": "fl", "bm": 0, "hd": false, "mn": "ADBE Vector Graphic - Fill", "nm": "Fond 1", "c": { "a": 0, "k": [0.7412, 0.7059, 0.9961], "ix": 4 }, "r": 1, "o": { "a": 0, "k": 100, "ix": 5 } }, { "ty": "tr", "a": { "a": 0, "k": [0, 0], "ix": 1 }, "s": { "a": 0, "k": [100, 100], "ix": 3 }, "sk": { "a": 0, "k": 0, "ix": 4 }, "p": { "a": 0, "k": [-15.75, 16.062], "ix": 2 }, "r": { "a": 0, "k": 0, "ix": 6 }, "sa": { "a": 0, "k": 0, "ix": 5 }, "o": { "a": 0, "k": 100, "ix": 7 } }] }], "ind": 3 }], "v": "5.7.0", "fr": 50, "op": 105, "ip": 0, "assets": [] }
@@ -4,8 +4,9 @@ import { FileUploadingStatus } from '../types';
4
4
  import { Box } from '@mui/material';
5
5
  import { Typography, TypographySize, TypographyWeight } from '../../Typography';
6
6
  import { getIconComponent } from '../../../utils';
7
- import { ProgressIndicator, ProgressIndicatorMode } from '../../UI';
8
- export const FileUploading = ({ uploadProgress, uploadingStatus, sx, onCancel, onRetry, fileName, showCancel, showRetry, }) => {
7
+ import { Player } from '@lottiefiles/react-lottie-player';
8
+ import loadingAnimation from '../../../assets/animations/loading-animation.json';
9
+ export const FileUploading = ({ uploadingStatus, sx, onCancel, onRetry, fileName, showCancel, showRetry, }) => {
9
10
  const isUploading = uploadingStatus === FileUploadingStatus.Uploading;
10
11
  const isSuccess = uploadingStatus === FileUploadingStatus.Success;
11
12
  const isError = uploadingStatus === FileUploadingStatus.Error;
@@ -41,5 +42,5 @@ export const FileUploading = ({ uploadProgress, uploadingStatus, sx, onCancel, o
41
42
  width: '24px',
42
43
  height: '24px',
43
44
  color: 'var(--colors-light-foreground-fg-success)',
44
- })] })] }), _jsxs(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'flex-start', alignItems: 'center', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-xs)', children: [!isError && uploadProgress && (_jsx(ProgressIndicator, { currentValue: uploadProgress, maxValue: 100, mode: ProgressIndicatorMode.Percentage, style: { width: '100%' } })), isError && (_jsxs(Fragment, { children: [_jsx(Typography, { size: TypographySize.TextXS, weight: TypographyWeight.Regular, color: 'var(--colors-light-text-text-error)', children: "Upload failed, please try again." }), showRetry && onRetry && (_jsx(Box, { onClick: onRetry, style: { cursor: 'pointer' }, children: _jsx(Typography, { size: TypographySize.TextXS, weight: TypographyWeight.SemiBold, color: 'var(--colors-light-text-text-error)', children: "Try again" }) }))] }))] })] }));
45
+ })] })] }), _jsxs(Box, { display: 'flex', flexDirection: 'row', justifyContent: 'flex-start', alignItems: 'center', gap: 'var(--spacing-tokens-size-in-px-spacing-spacing-xs)', children: [!isError && uploadingStatus === FileUploadingStatus.Uploading && (_jsx(Player, { autoplay: true, loop: true, src: loadingAnimation, style: { width: '100%', height: '100%' } })), isError && (_jsxs(Fragment, { children: [_jsx(Typography, { size: TypographySize.TextXS, weight: TypographyWeight.Regular, color: 'var(--colors-light-text-text-error)', children: "Upload failed, please try again." }), showRetry && onRetry && (_jsx(Box, { onClick: onRetry, style: { cursor: 'pointer' }, children: _jsx(Typography, { size: TypographySize.TextXS, weight: TypographyWeight.SemiBold, color: 'var(--colors-light-text-text-error)', children: "Try again" }) }))] }))] })] }));
45
46
  };
@@ -24,11 +24,6 @@ const meta = {
24
24
  description: 'The status of the file upload',
25
25
  table: { type: { summary: 'FileUploadingStatus' } },
26
26
  },
27
- uploadProgress: {
28
- control: 'number',
29
- description: 'The progress of the file upload',
30
- table: { type: { summary: 'number' } },
31
- },
32
27
  showCancel: {
33
28
  control: 'boolean',
34
29
  description: 'Whether to show the cancel button',
@@ -61,7 +56,6 @@ export const Default = {
61
56
  args: {
62
57
  fileName: 'test.pdf',
63
58
  uploadingStatus: FileUploadingStatus.Uploading,
64
- uploadProgress: 50,
65
59
  showCancel: true,
66
60
  showRetry: true,
67
61
  },
@@ -70,7 +64,6 @@ export const Success = {
70
64
  args: {
71
65
  fileName: 'test.pdf',
72
66
  uploadingStatus: FileUploadingStatus.Success,
73
- uploadProgress: 100,
74
67
  showCancel: true,
75
68
  showRetry: true,
76
69
  },
@@ -79,7 +72,6 @@ export const Error = {
79
72
  args: {
80
73
  fileName: 'test.pdf',
81
74
  uploadingStatus: FileUploadingStatus.Error,
82
- uploadProgress: 100,
83
75
  showCancel: true,
84
76
  showRetry: true,
85
77
  },
@@ -171,8 +171,6 @@ export declare enum FileUploadingStatus {
171
171
  export interface FileUploadingProps {
172
172
  /** Status of the file uploading */
173
173
  uploadingStatus: FileUploadingStatus;
174
- /** Progress of the file uploading */
175
- uploadProgress: number | null;
176
174
  /** Style of the file uploading */
177
175
  sx?: SxProps<Theme>;
178
176
  /** Whether to show the cancel button */
@@ -5,6 +5,8 @@ import { Typography, TypographySize, TypographyWeight } from '../Typography';
5
5
  export const ProgressIndicator = ({ mode = ProgressIndicatorMode.Value, currentValue = 40, maxValue = 100, fillColor = 'var(--colors-light-background-bg-brand)', backgroundColor = 'var(--colors-light-background-bg-white)', text = 'used', textColor = 'var(--colors-light-text-text-primary)', style, }) => {
6
6
  let errorText = '';
7
7
  const calculateFill = () => {
8
+ if (currentValue > maxValue)
9
+ return 100;
8
10
  return (currentValue / maxValue) * 100;
9
11
  };
10
12
  if (isNaN(currentValue) || !isFinite(currentValue)) {
@@ -16,13 +18,13 @@ export const ProgressIndicator = ({ mode = ProgressIndicatorMode.Value, currentV
16
18
  else if (currentValue < 0) {
17
19
  errorText = 'Invalid current value';
18
20
  }
19
- else if (currentValue > maxValue) {
20
- errorText = 'Current value is greater than max value';
21
- }
22
21
  else if (mode === ProgressIndicatorMode.Percentage) {
23
22
  if (maxValue > 100 || maxValue < 0) {
24
23
  errorText = 'Invalid max value for percentage mode';
25
24
  }
25
+ else if (currentValue > maxValue) {
26
+ errorText = 'Current value is greater than max value for percentage mode';
27
+ }
26
28
  }
27
29
  if (errorText) {
28
30
  return (_jsx(Typography, { size: TypographySize.TextXS, weight: TypographyWeight.Regular, children: errorText }));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@beydesign/storybook",
3
3
  "private": false,
4
- "version": "0.0.82",
4
+ "version": "0.0.84",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -31,6 +31,7 @@
31
31
  "@fortawesome/fontawesome-svg-core": "^6.5.1",
32
32
  "@fortawesome/free-solid-svg-icons": "^6.5.1",
33
33
  "@fortawesome/react-fontawesome": "^0.2.0",
34
+ "@lottiefiles/react-lottie-player": "^3.6.0",
34
35
  "@mui/icons-material": "^5.15.12",
35
36
  "@mui/material": "^5.15.12",
36
37
  "@phosphor-icons/react": "^2.1.7",