@alfalab/core-components-file-upload-item 6.0.4 → 6.1.0

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.
Files changed (94) hide show
  1. package/Component.js +1 -1
  2. package/actions-control.module-340119ff.js +6 -0
  3. package/components/actions-control/actions-control.css +6 -6
  4. package/components/actions-control/actions.js +1 -1
  5. package/components/actions-control/components/delete-button/delete-button.js +1 -1
  6. package/components/actions-control/components/download-button/download-button.js +1 -1
  7. package/components/actions-control/components/restore-button/restore-button.js +1 -1
  8. package/components/content/components/content-error/content-error.css +2 -2
  9. package/components/content/components/content-error/content-error.js +1 -1
  10. package/components/content/components/content-subtitle/content-subtitle.css +4 -4
  11. package/components/content/components/content-subtitle/content-subtitle.js +1 -1
  12. package/components/content/content.css +8 -8
  13. package/components/content/content.js +1 -1
  14. package/components/status-control/components/status-control-icon/status-control-icon.css +6 -6
  15. package/components/status-control/components/status-control-icon/status-control-icon.js +1 -1
  16. package/components/status-control/status-control.css +10 -10
  17. package/components/status-control/status-control.js +1 -1
  18. package/context/file-upload-item-context.d.ts +2 -1
  19. package/cssm/context/file-upload-item-context.d.ts +2 -1
  20. package/cssm/index.d.ts +2 -0
  21. package/cssm/types/file-upload-item-props.d.ts +2 -1
  22. package/cssm/types/status.d.ts +2 -0
  23. package/cssm/types/status.js +2 -0
  24. package/cssm/utils.d.ts +6 -5
  25. package/esm/Component.js +1 -1
  26. package/esm/actions-control.module-9f6e94da.js +4 -0
  27. package/esm/components/actions-control/actions-control.css +6 -6
  28. package/esm/components/actions-control/actions.js +1 -1
  29. package/esm/components/actions-control/components/delete-button/delete-button.js +1 -1
  30. package/esm/components/actions-control/components/download-button/download-button.js +1 -1
  31. package/esm/components/actions-control/components/restore-button/restore-button.js +1 -1
  32. package/esm/components/content/components/content-error/content-error.css +2 -2
  33. package/esm/components/content/components/content-error/content-error.js +1 -1
  34. package/esm/components/content/components/content-subtitle/content-subtitle.css +4 -4
  35. package/esm/components/content/components/content-subtitle/content-subtitle.js +1 -1
  36. package/esm/components/content/content.css +8 -8
  37. package/esm/components/content/content.js +1 -1
  38. package/esm/components/status-control/components/status-control-icon/status-control-icon.css +6 -6
  39. package/esm/components/status-control/components/status-control-icon/status-control-icon.js +1 -1
  40. package/esm/components/status-control/status-control.css +10 -10
  41. package/esm/components/status-control/status-control.js +1 -1
  42. package/esm/context/file-upload-item-context.d.ts +2 -1
  43. package/esm/index.css +3 -3
  44. package/esm/index.d.ts +2 -0
  45. package/esm/types/file-upload-item-props.d.ts +2 -1
  46. package/esm/types/status.d.ts +2 -0
  47. package/esm/types/status.js +1 -0
  48. package/esm/utils.d.ts +6 -5
  49. package/index.css +3 -3
  50. package/index.d.ts +2 -0
  51. package/modern/Component.js +1 -1
  52. package/modern/actions-control.module-4ddd7980.js +4 -0
  53. package/modern/components/actions-control/actions-control.css +6 -6
  54. package/modern/components/actions-control/actions.js +1 -1
  55. package/modern/components/actions-control/components/delete-button/delete-button.js +1 -1
  56. package/modern/components/actions-control/components/download-button/download-button.js +1 -1
  57. package/modern/components/actions-control/components/restore-button/restore-button.js +1 -1
  58. package/modern/components/content/components/content-error/content-error.css +2 -2
  59. package/modern/components/content/components/content-error/content-error.js +1 -1
  60. package/modern/components/content/components/content-subtitle/content-subtitle.css +4 -4
  61. package/modern/components/content/components/content-subtitle/content-subtitle.js +1 -1
  62. package/modern/components/content/content.css +8 -8
  63. package/modern/components/content/content.js +1 -1
  64. package/modern/components/status-control/components/status-control-icon/status-control-icon.css +6 -6
  65. package/modern/components/status-control/components/status-control-icon/status-control-icon.js +1 -1
  66. package/modern/components/status-control/status-control.css +10 -10
  67. package/modern/components/status-control/status-control.js +1 -1
  68. package/modern/context/file-upload-item-context.d.ts +2 -1
  69. package/modern/index.css +3 -3
  70. package/modern/index.d.ts +2 -0
  71. package/modern/types/file-upload-item-props.d.ts +2 -1
  72. package/modern/types/status.d.ts +2 -0
  73. package/modern/types/status.js +1 -0
  74. package/modern/utils.d.ts +6 -5
  75. package/moderncssm/context/file-upload-item-context.d.ts +2 -1
  76. package/moderncssm/index.d.ts +2 -0
  77. package/moderncssm/types/file-upload-item-props.d.ts +2 -1
  78. package/moderncssm/types/status.d.ts +2 -0
  79. package/moderncssm/types/status.js +1 -0
  80. package/moderncssm/utils.d.ts +6 -5
  81. package/package.json +6 -5
  82. package/src/Component.tsx +1 -1
  83. package/src/context/file-upload-item-context.tsx +3 -1
  84. package/src/index.ts +3 -0
  85. package/src/types/file-upload-item-props.ts +3 -1
  86. package/src/types/status.ts +7 -0
  87. package/src/utils.ts +7 -5
  88. package/types/file-upload-item-props.d.ts +2 -1
  89. package/types/status.d.ts +2 -0
  90. package/types/status.js +2 -0
  91. package/utils.d.ts +6 -5
  92. package/actions-control.module-4c64f0ce.js +0 -6
  93. package/esm/actions-control.module-e32db318.js +0 -4
  94. package/modern/actions-control.module-8c021ec2.js +0 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfalab/core-components-file-upload-item",
3
- "version": "6.0.4",
3
+ "version": "6.1.0",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -10,15 +10,16 @@
10
10
  "access": "public",
11
11
  "directory": "dist"
12
12
  },
13
+ "sideEffects": false,
13
14
  "peerDependencies": {
14
15
  "react": "^16.9.0 || ^17.0.1 || ^18.0.0"
15
16
  },
16
17
  "dependencies": {
17
- "@alfalab/core-components-icon-button": "^6.11.4",
18
- "@alfalab/core-components-link": "^5.3.2",
19
- "@alfalab/core-components-spinner": "^4.0.1",
18
+ "@alfalab/core-components-icon-button": "^6.11.5",
19
+ "@alfalab/core-components-link": "^5.3.3",
20
+ "@alfalab/core-components-spinner": "^4.0.2",
20
21
  "@alfalab/icons-glyph": "^2.189.0",
21
- "@alfalab/core-components-typography": "^4.11.1",
22
+ "@alfalab/core-components-typography": "^4.11.2",
22
23
  "classnames": "^2.5.1",
23
24
  "tslib": "^2.4.0"
24
25
  },
package/src/Component.tsx CHANGED
@@ -5,7 +5,7 @@ import { Actions } from './components/actions-control';
5
5
  import { Content } from './components/content';
6
6
  import { StatusControl } from './components/status-control';
7
7
  import { FileUploadItemContext } from './context/file-upload-item-context';
8
- import { FileUploadItemProps } from './types/file-upload-item-props';
8
+ import { type FileUploadItemProps } from './types/file-upload-item-props';
9
9
 
10
10
  import styles from './index.module.css';
11
11
 
@@ -1,8 +1,10 @@
1
1
  import { createContext, ElementType, HTMLAttributeAnchorTarget, MouseEvent } from 'react';
2
2
 
3
+ import { type FileUploadItemStatus } from '../types/status';
4
+
3
5
  type TFileUploadItemContext = {
4
6
  showRestore?: boolean;
5
- uploadStatus?: string;
7
+ uploadStatus?: FileUploadItemStatus;
6
8
  error?: string | string[];
7
9
  title?: string;
8
10
  subtitle?: string;
package/src/index.ts CHANGED
@@ -1 +1,4 @@
1
1
  export * from './Component';
2
+
3
+ export { type FileUploadItemProps } from './types/file-upload-item-props';
4
+ export { type FileUploadItemStatus } from './types/status';
@@ -1,5 +1,7 @@
1
1
  import React, { ElementType, HTMLAttributeAnchorTarget, MouseEvent } from 'react';
2
2
 
3
+ import { type FileUploadItemStatus } from './status';
4
+
3
5
  export type FileUploadItemProps = {
4
6
  /**
5
7
  * Дополнительный класс
@@ -55,7 +57,7 @@ export type FileUploadItemProps = {
55
57
  /**
56
58
  * Статус загрузки файла
57
59
  */
58
- uploadStatus?: string;
60
+ uploadStatus?: FileUploadItemStatus;
59
61
 
60
62
  /**
61
63
  * Сообщение об ошибке
@@ -0,0 +1,7 @@
1
+ export type FileUploadItemStatus =
2
+ | 'INITIAL'
3
+ | 'SUCCESS'
4
+ | 'ERROR'
5
+ | 'UPLOADING'
6
+ | 'UPLOADED'
7
+ | 'DELETED';
package/src/utils.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { type FileUploadItemStatus } from './types/status';
2
+
1
3
  export function humanFileSize(size: string | number) {
2
4
  const units = ['Б', 'КБ', 'МБ', 'ГБ'];
3
5
 
@@ -16,8 +18,8 @@ export function humanFileSize(size: string | number) {
16
18
 
17
19
  export const getExtension = (filename: string) => filename.toLowerCase().split('.').pop();
18
20
 
19
- export const isInitialStatus = (status?: string) => status === 'INITIAL';
20
- export const isSuccessStatus = (status?: string) => status === 'SUCCESS';
21
- export const isErrorStatus = (status?: string) => status === 'ERROR';
22
- export const isUploadingStatus = (status?: string) => status === 'UPLOADING';
23
- export const isUploadedStatus = (status?: string) => status === 'UPLOADED';
21
+ export const isInitialStatus = (status?: FileUploadItemStatus) => status === 'INITIAL';
22
+ export const isSuccessStatus = (status?: FileUploadItemStatus) => status === 'SUCCESS';
23
+ export const isErrorStatus = (status?: FileUploadItemStatus) => status === 'ERROR';
24
+ export const isUploadingStatus = (status?: FileUploadItemStatus) => status === 'UPLOADING';
25
+ export const isUploadedStatus = (status?: FileUploadItemStatus) => status === 'UPLOADED';
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import React from 'react';
3
3
  import { ElementType, HTMLAttributeAnchorTarget, MouseEvent } from "react";
4
+ import { FileUploadItemStatus } from "./status";
4
5
  type FileUploadItemProps = {
5
6
  /**
6
7
  * Дополнительный класс
@@ -46,7 +47,7 @@ type FileUploadItemProps = {
46
47
  /**
47
48
  * Статус загрузки файла
48
49
  */
49
- uploadStatus?: string;
50
+ uploadStatus?: FileUploadItemStatus;
50
51
  /**
51
52
  * Сообщение об ошибке
52
53
  */
@@ -0,0 +1,2 @@
1
+ type FileUploadItemStatus = 'INITIAL' | 'SUCCESS' | 'ERROR' | 'UPLOADING' | 'UPLOADED' | 'DELETED';
2
+ export { FileUploadItemStatus };
@@ -0,0 +1,2 @@
1
+ 'use strict';
2
+
package/utils.d.ts CHANGED
@@ -1,8 +1,9 @@
1
+ import { FileUploadItemStatus } from "./types/status";
1
2
  declare function humanFileSize(size: string | number): string;
2
3
  declare const getExtension: (filename: string) => string | undefined;
3
- declare const isInitialStatus: (status?: string) => boolean;
4
- declare const isSuccessStatus: (status?: string) => boolean;
5
- declare const isErrorStatus: (status?: string) => boolean;
6
- declare const isUploadingStatus: (status?: string) => boolean;
7
- declare const isUploadedStatus: (status?: string) => boolean;
4
+ declare const isInitialStatus: (status?: FileUploadItemStatus) => boolean;
5
+ declare const isSuccessStatus: (status?: FileUploadItemStatus) => boolean;
6
+ declare const isErrorStatus: (status?: FileUploadItemStatus) => boolean;
7
+ declare const isUploadingStatus: (status?: FileUploadItemStatus) => boolean;
8
+ declare const isUploadedStatus: (status?: FileUploadItemStatus) => boolean;
8
9
  export { humanFileSize, getExtension, isInitialStatus, isSuccessStatus, isErrorStatus, isUploadingStatus, isUploadedStatus };
@@ -1,6 +0,0 @@
1
- 'use strict';
2
-
3
- var styles = {"container":"file-upload-item__container_jtpzt","icon":"file-upload-item__icon_jtpzt","deleteIconColor":"file-upload-item__deleteIconColor_jtpzt","downloadIconColor":"file-upload-item__downloadIconColor_jtpzt","restoreIconColor":"file-upload-item__restoreIconColor_jtpzt"};
4
- require('./components/actions-control/actions-control.css')
5
-
6
- exports.styles = styles;
@@ -1,4 +0,0 @@
1
- var styles = {"container":"file-upload-item__container_jtpzt","icon":"file-upload-item__icon_jtpzt","deleteIconColor":"file-upload-item__deleteIconColor_jtpzt","downloadIconColor":"file-upload-item__downloadIconColor_jtpzt","restoreIconColor":"file-upload-item__restoreIconColor_jtpzt"};
2
- require('./components/actions-control/actions-control.css')
3
-
4
- export { styles as s };
@@ -1,4 +0,0 @@
1
- const styles = {"container":"file-upload-item__container_jtpzt","icon":"file-upload-item__icon_jtpzt","deleteIconColor":"file-upload-item__deleteIconColor_jtpzt","downloadIconColor":"file-upload-item__downloadIconColor_jtpzt","restoreIconColor":"file-upload-item__restoreIconColor_jtpzt"};
2
- require('./components/actions-control/actions-control.css')
3
-
4
- export { styles as s };