@cloudtower/eagle 0.35.8 → 481.0.2

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 (55) hide show
  1. package/dist/cjs/core/MediumDialog/MediumDialog.js +1 -1
  2. package/dist/cjs/core/index.js +12 -15
  3. package/dist/cjs/coreX/Dialogs/RejectDialog/RejectDialog.js +4 -16
  4. package/dist/cjs/index.js +245 -249
  5. package/dist/cjs/stats1.html +1 -1
  6. package/dist/components.css +2314 -2492
  7. package/dist/esm/core/MediumDialog/MediumDialog.js +1 -1
  8. package/dist/esm/core/index.js +2 -4
  9. package/dist/esm/coreX/Dialogs/RejectDialog/RejectDialog.js +4 -16
  10. package/dist/esm/index.js +0 -2
  11. package/dist/esm/stats1.html +1 -1
  12. package/dist/linaria.merged.scss +2952 -3142
  13. package/dist/src/core/index.d.ts +0 -5
  14. package/dist/src/coreX/Dialogs/RejectDialog/RejectDialog.type.d.ts +1 -5
  15. package/dist/src/coreX/index.d.ts +0 -1
  16. package/dist/src/hooks/index.d.ts +0 -1
  17. package/dist/src/utils/index.d.ts +0 -1
  18. package/dist/stories/docs/coreX/Dialogs/RejectDialog.stories.d.ts +1 -3
  19. package/dist/style.css +2314 -2492
  20. package/package.json +4 -6
  21. package/dist/cjs/core/Duration/index.js +0 -78
  22. package/dist/cjs/core/LocalUpload/LocalUpload.hooks.js +0 -66
  23. package/dist/cjs/core/LocalUpload/LocalUpload.js +0 -103
  24. package/dist/cjs/core/LocalUpload/LocalUpload.style.js +0 -13
  25. package/dist/cjs/core/LocalUpload/LocalUpload.widget.js +0 -379
  26. package/dist/cjs/hooks/useFormatDuration.js +0 -35
  27. package/dist/cjs/utils/formatDuration.js +0 -67
  28. package/dist/esm/core/Duration/index.js +0 -72
  29. package/dist/esm/core/LocalUpload/LocalUpload.hooks.js +0 -63
  30. package/dist/esm/core/LocalUpload/LocalUpload.js +0 -97
  31. package/dist/esm/core/LocalUpload/LocalUpload.style.js +0 -10
  32. package/dist/esm/core/LocalUpload/LocalUpload.widget.js +0 -365
  33. package/dist/esm/hooks/useFormatDuration.js +0 -33
  34. package/dist/esm/utils/formatDuration.js +0 -65
  35. package/dist/src/core/Duration/duration.type.d.ts +0 -42
  36. package/dist/src/core/Duration/index.d.ts +0 -4
  37. package/dist/src/core/LocalUpload/LocalUpload.d.ts +0 -15
  38. package/dist/src/core/LocalUpload/LocalUpload.hooks.d.ts +0 -32
  39. package/dist/src/core/LocalUpload/LocalUpload.style.d.ts +0 -3
  40. package/dist/src/core/LocalUpload/LocalUpload.type.d.ts +0 -175
  41. package/dist/src/core/LocalUpload/LocalUpload.widget.d.ts +0 -23
  42. package/dist/src/core/LocalUpload/index.d.ts +0 -2
  43. package/dist/src/coreX/Copy/CopyButton.d.ts +0 -5
  44. package/dist/src/coreX/Copy/CopyButton.type.d.ts +0 -8
  45. package/dist/src/coreX/Copy/CopyTooltip.d.ts +0 -5
  46. package/dist/src/coreX/Copy/CopyTooltip.typs.d.ts +0 -16
  47. package/dist/src/coreX/Copy/index.d.ts +0 -2
  48. package/dist/src/hooks/__tests__/useFormatDuration.test.d.ts +0 -1
  49. package/dist/src/hooks/useFormatDuration.d.ts +0 -31
  50. package/dist/src/utils/__test__/formatDuration.spec.d.ts +0 -1
  51. package/dist/src/utils/formatDuration.d.ts +0 -28
  52. package/dist/stories/docs/core/Duration.stories.d.ts +0 -88
  53. package/dist/stories/docs/core/LocalUpload.stories.d.ts +0 -74
  54. package/dist/stories/docs/coreX/Copy/CopyButton.stories.d.ts +0 -66
  55. package/dist/stories/docs/coreX/Copy/CopyTooltip.stories.d.ts +0 -66
@@ -1,35 +0,0 @@
1
- 'use strict';
2
-
3
- var React = require('react');
4
- var formatDuration = require('../utils/formatDuration.js');
5
-
6
- function useFormatDuration(milliseconds, options = {
7
- maxDisplayUnits: 2,
8
- useAbbreviation: false,
9
- minUnit: "second"
10
- }) {
11
- const {
12
- maxDisplayUnits = 2,
13
- useAbbreviation = false,
14
- minUnit = "second"
15
- } = options;
16
- const result = React.useMemo(() => {
17
- const items = formatDuration.formatDuration(milliseconds, { maxDisplayUnits, minUnit });
18
- const shouldUseAbbreviation = items.length > 1 && useAbbreviation;
19
- const parts = items.map((item) => {
20
- const suffix = shouldUseAbbreviation ? "_abbreviation" : "";
21
- const i18nKey = `unit.${item.unit}${suffix}`;
22
- return {
23
- value: item.value,
24
- unit: item.unit,
25
- i18nKey
26
- };
27
- });
28
- return {
29
- parts
30
- };
31
- }, [milliseconds, maxDisplayUnits, useAbbreviation, minUnit]);
32
- return result;
33
- }
34
-
35
- exports.useFormatDuration = useFormatDuration;
@@ -1,67 +0,0 @@
1
- 'use strict';
2
-
3
- function formatDuration(milliseconds, options = {}) {
4
- const { maxDisplayUnits = 2, minUnit = "second" } = options;
5
- const effectiveMaxDisplayUnits = Math.max(1, maxDisplayUnits);
6
- if (milliseconds < 0 || milliseconds === 0) {
7
- const minUnitValue2 = minUnit || "second";
8
- return [{ value: 0, unit: minUnitValue2 }];
9
- }
10
- const units = [
11
- { value: 365 * 24 * 60 * 60 * 1e3, unit: "year" },
12
- { value: 30 * 24 * 60 * 60 * 1e3, unit: "month" },
13
- { value: 7 * 24 * 60 * 60 * 1e3, unit: "week" },
14
- { value: 24 * 60 * 60 * 1e3, unit: "day" },
15
- { value: 60 * 60 * 1e3, unit: "hour" },
16
- { value: 60 * 1e3, unit: "minute" },
17
- { value: 1e3, unit: "second" },
18
- { value: 1, unit: "millisecond" }
19
- ];
20
- const minUnitValue = minUnit || "second";
21
- const minUnitIndex = units.findIndex((u) => u.unit === minUnitValue);
22
- if (minUnitIndex === -1) {
23
- const defaultMinUnitIndex = units.findIndex((u) => u.unit === "second");
24
- const filteredUnits2 = units.slice(0, defaultMinUnitIndex + 1);
25
- const parts2 = [];
26
- let remaining2 = milliseconds;
27
- for (const unitDef of filteredUnits2) {
28
- if (remaining2 >= unitDef.value) {
29
- const count = Math.floor(remaining2 / unitDef.value);
30
- remaining2 = remaining2 % unitDef.value;
31
- parts2.push({
32
- value: count,
33
- unit: unitDef.unit
34
- });
35
- if (parts2.length >= effectiveMaxDisplayUnits) {
36
- break;
37
- }
38
- }
39
- }
40
- if (parts2.length === 0) {
41
- return [{ value: 0, unit: "second" }];
42
- }
43
- return parts2;
44
- }
45
- const filteredUnits = units.slice(0, minUnitIndex + 1);
46
- const parts = [];
47
- let remaining = milliseconds;
48
- for (const unitDef of filteredUnits) {
49
- if (remaining >= unitDef.value) {
50
- const count = Math.floor(remaining / unitDef.value);
51
- remaining = remaining % unitDef.value;
52
- parts.push({
53
- value: count,
54
- unit: unitDef.unit
55
- });
56
- if (parts.length >= effectiveMaxDisplayUnits) {
57
- break;
58
- }
59
- }
60
- }
61
- if (parts.length === 0) {
62
- return [{ value: 0, unit: minUnitValue || "second" }];
63
- }
64
- return parts;
65
- }
66
-
67
- exports.formatDuration = formatDuration;
@@ -1,72 +0,0 @@
1
- import React__default from 'react';
2
- import { cx } from '@linaria/core';
3
- import Empty from '../Empty/index.js';
4
- import { ParrotTrans } from '../ParrotTrans/index.js';
5
- import { useFormatDuration } from '../../hooks/useFormatDuration.js';
6
- import isEmpty from '../../utils/isEmpty.js';
7
- import { formatDuration } from '../../utils/formatDuration.js';
8
- import { UnitStyle } from '../Styled/index.js';
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
12
- var __hasOwnProp = Object.prototype.hasOwnProperty;
13
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
14
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
15
- var __spreadValues = (a, b) => {
16
- for (var prop in b || (b = {}))
17
- if (__hasOwnProp.call(b, prop))
18
- __defNormalProp(a, prop, b[prop]);
19
- if (__getOwnPropSymbols)
20
- for (var prop of __getOwnPropSymbols(b)) {
21
- if (__propIsEnum.call(b, prop))
22
- __defNormalProp(a, prop, b[prop]);
23
- }
24
- return a;
25
- };
26
- const Duration = ({
27
- rawValue,
28
- valueClassName,
29
- unitClassName,
30
- abbreviate,
31
- emptyProps,
32
- maxDisplayUnits = 2,
33
- minUnit = "second",
34
- noUnitOnZero = false,
35
- contentRender
36
- }) => {
37
- const { parts } = useFormatDuration(rawValue != null ? rawValue : 0, {
38
- maxDisplayUnits,
39
- useAbbreviation: abbreviate,
40
- minUnit
41
- });
42
- if (isEmpty(rawValue)) {
43
- return /* @__PURE__ */ React__default.createElement(Empty, __spreadValues({}, emptyProps));
44
- }
45
- if (parts.length === 0) {
46
- return /* @__PURE__ */ React__default.createElement(Empty, __spreadValues({}, emptyProps));
47
- }
48
- if (contentRender) {
49
- const formatItems = formatDuration(rawValue, {
50
- maxDisplayUnits,
51
- minUnit
52
- });
53
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, contentRender(formatItems));
54
- }
55
- const allZero = parts.every((part) => part.value === 0);
56
- if (noUnitOnZero && allZero) {
57
- return /* @__PURE__ */ React__default.createElement("span", { className: cx("value", valueClassName) }, "0");
58
- }
59
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, parts.map((part, index) => /* @__PURE__ */ React__default.createElement(React__default.Fragment, { key: `${part.unit}-${index}` }, index > 0 && /* @__PURE__ */ React__default.createElement("span", null, " "), /* @__PURE__ */ React__default.createElement(
60
- ParrotTrans,
61
- {
62
- parent: "span",
63
- i18nKey: part.i18nKey,
64
- count: part.value
65
- },
66
- /* @__PURE__ */ React__default.createElement("span", { className: cx("value", valueClassName) }),
67
- /* @__PURE__ */ React__default.createElement("span", { className: cx("unit", UnitStyle, unitClassName) })
68
- ))));
69
- };
70
- var Duration$1 = Duration;
71
-
72
- export { Duration$1 as default };
@@ -1,63 +0,0 @@
1
- import { useEffect, useRef } from 'react';
2
-
3
- const useFileValidation = ({
4
- fileList,
5
- setFileList,
6
- validate,
7
- createNewFile = false
8
- }) => {
9
- useEffect(() => {
10
- if (!validate)
11
- return;
12
- const updateFile = (fileId, file) => {
13
- const index = fileList.findIndex((f) => f.uid === fileId);
14
- if (index !== -1) {
15
- const newList = [...fileList];
16
- const fileToUpdate = createNewFile ? (() => {
17
- const newFile = new File([file], file.name, { type: file.type });
18
- Object.assign(newFile, file);
19
- return newFile;
20
- })() : file;
21
- newList.splice(index, 1, fileToUpdate);
22
- setFileList(newList);
23
- }
24
- };
25
- for (const _file of fileList) {
26
- if (_file.fileStatus !== "need-validate") {
27
- continue;
28
- }
29
- _file.fileStatus = "validating";
30
- updateFile(_file.uid, _file);
31
- validate(_file, fileList).then((result) => {
32
- if (result.error) {
33
- _file.error = result.error;
34
- _file.fileStatus = "error";
35
- } else {
36
- _file.error = void 0;
37
- _file.fileStatus = "success";
38
- _file.data = result.data;
39
- }
40
- updateFile(_file.uid, _file);
41
- return;
42
- });
43
- }
44
- }, [fileList, setFileList, validate, createNewFile]);
45
- };
46
- const useFileCountErrorClear = ({
47
- fileList,
48
- maxCount,
49
- setError
50
- }) => {
51
- const fileCountRef = useRef(fileList.length);
52
- useEffect(() => {
53
- if (fileList.length === fileCountRef.current) {
54
- return;
55
- }
56
- fileCountRef.current = fileList.length;
57
- if (fileCountRef.current <= maxCount) {
58
- setError("");
59
- }
60
- }, [fileList.length, maxCount, setError]);
61
- };
62
-
63
- export { useFileCountErrorClear, useFileValidation };
@@ -1,97 +0,0 @@
1
- import useParrotTranslation from '../../hooks/useParrotTranslation.js';
2
- import React__default from 'react';
3
- import { UploadWrapper } from './LocalUpload.style.js';
4
- import { UploadLabel, UploadDescription, UploadButton, UploadDragger, UploadFileList, UploadFileInfo } from './LocalUpload.widget.js';
5
-
6
- var __defProp = Object.defineProperty;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
- var __spreadValues = (a, b) => {
12
- for (var prop in b || (b = {}))
13
- if (__hasOwnProp.call(b, prop))
14
- __defNormalProp(a, prop, b[prop]);
15
- if (__getOwnPropSymbols)
16
- for (var prop of __getOwnPropSymbols(b)) {
17
- if (__propIsEnum.call(b, prop))
18
- __defNormalProp(a, prop, b[prop]);
19
- }
20
- return a;
21
- };
22
- const UploadComp = React__default.forwardRef(
23
- ({
24
- className,
25
- label,
26
- description,
27
- type = "dragger",
28
- multiple = false,
29
- accept,
30
- disabled,
31
- maxCount,
32
- info,
33
- fileList,
34
- setFileList,
35
- validate,
36
- buttonProps,
37
- listType = "list",
38
- disableRemoveList = false,
39
- onRemove
40
- }, ref) => {
41
- const { t } = useParrotTranslation();
42
- const removeFile = (id) => {
43
- const index = fileList.findIndex((f) => f.uid === id);
44
- if (index !== -1) {
45
- const file = fileList[index];
46
- fileList.splice(index, 1);
47
- setFileList([...fileList]);
48
- onRemove == null ? void 0 : onRemove(file);
49
- }
50
- };
51
- const _maxCount = multiple ? maxCount || Infinity : 1;
52
- const isSingleSelect = _maxCount === 1;
53
- return /* @__PURE__ */ React__default.createElement(UploadComp.Wrapper, { className, ref }, label ? /* @__PURE__ */ React__default.createElement(UploadComp.Label, null, label) : null, description ? /* @__PURE__ */ React__default.createElement(UploadComp.Description, null, description) : null, type === "button" ? /* @__PURE__ */ React__default.createElement(
54
- UploadComp.Button,
55
- __spreadValues({}, __spreadValues({
56
- accept,
57
- multiple,
58
- disabled,
59
- maxCount,
60
- fileList,
61
- setFileList,
62
- validate
63
- }, buttonProps)),
64
- t("components.select_file")
65
- ) : /* @__PURE__ */ React__default.createElement(
66
- UploadComp.Dragger,
67
- __spreadValues({}, {
68
- accept,
69
- multiple,
70
- disabled,
71
- maxCount,
72
- fileList,
73
- setFileList,
74
- validate
75
- })
76
- ), info != null ? info : /* @__PURE__ */ React__default.createElement(React__default.Fragment, null), type === "button" || !isSingleSelect ? /* @__PURE__ */ React__default.createElement(
77
- UploadComp.FileList,
78
- {
79
- fileList,
80
- removeFile,
81
- type: listType,
82
- disableRemove: disableRemoveList,
83
- onRemove
84
- }
85
- ) : null);
86
- }
87
- );
88
- UploadComp.Wrapper = UploadWrapper;
89
- UploadComp.Label = UploadLabel;
90
- UploadComp.Description = UploadDescription;
91
- UploadComp.Button = UploadButton;
92
- UploadComp.Dragger = UploadDragger;
93
- UploadComp.FileList = UploadFileList;
94
- UploadComp.FileInfo = UploadFileInfo;
95
- const LocalUpload = UploadComp;
96
-
97
- export { LocalUpload };
@@ -1,10 +0,0 @@
1
- import { styled } from '@linaria/react';
2
-
3
- const UploadWrapper = /*#__PURE__*/styled('div')({
4
- name: "UploadWrapper",
5
- class: "E_u3l9ivi",
6
- propsAsIs: false
7
- });
8
- const FileInfoWrapperStyle = "E_ftdwz1g";
9
-
10
- export { FileInfoWrapperStyle, UploadWrapper };