@box/uploads-manager 1.13.1

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 (103) hide show
  1. package/LICENSE +379 -0
  2. package/README.md +167 -0
  3. package/dist/chunks/uploads-header.js +149 -0
  4. package/dist/chunks/uploads-item-list.js +41 -0
  5. package/dist/chunks/uploads-item.module.js +10 -0
  6. package/dist/chunks/uploads-manager.js +52 -0
  7. package/dist/esm/index.js +5 -0
  8. package/dist/esm/lib/uploads-header/index.js +2 -0
  9. package/dist/esm/lib/uploads-header/uploads-header.js +2 -0
  10. package/dist/esm/lib/uploads-header/uploads-header.messages.js +68 -0
  11. package/dist/esm/lib/uploads-item/components/action-buttons.js +57 -0
  12. package/dist/esm/lib/uploads-item/components/index.js +4 -0
  13. package/dist/esm/lib/uploads-item/components/item-row-icon.js +24 -0
  14. package/dist/esm/lib/uploads-item/components/status-line.js +64 -0
  15. package/dist/esm/lib/uploads-item/index.js +2 -0
  16. package/dist/esm/lib/uploads-item/uploads-item.js +32 -0
  17. package/dist/esm/lib/uploads-item/uploads-item.messages.js +72 -0
  18. package/dist/esm/lib/uploads-item-list/index.js +2 -0
  19. package/dist/esm/lib/uploads-item-list/uploads-item-list.js +2 -0
  20. package/dist/esm/lib/uploads-item-list/uploads-item-list.messages.js +6 -0
  21. package/dist/esm/lib/uploads-manager.js +3 -0
  22. package/dist/esm/lib/utils/getProgress.js +9 -0
  23. package/dist/esm/lib/utils/getStatus.js +11 -0
  24. package/dist/i18n/bn-IN.js +36 -0
  25. package/dist/i18n/bn-IN.properties +68 -0
  26. package/dist/i18n/da-DK.js +36 -0
  27. package/dist/i18n/da-DK.properties +68 -0
  28. package/dist/i18n/de-DE.js +36 -0
  29. package/dist/i18n/de-DE.properties +68 -0
  30. package/dist/i18n/en-AU.js +36 -0
  31. package/dist/i18n/en-AU.properties +68 -0
  32. package/dist/i18n/en-CA.js +36 -0
  33. package/dist/i18n/en-CA.properties +68 -0
  34. package/dist/i18n/en-GB.js +36 -0
  35. package/dist/i18n/en-GB.properties +68 -0
  36. package/dist/i18n/en-US.js +36 -0
  37. package/dist/i18n/en-US.properties +68 -0
  38. package/dist/i18n/en-x-pseudo.js +36 -0
  39. package/dist/i18n/en-x-pseudo.properties +68 -0
  40. package/dist/i18n/es-419.js +36 -0
  41. package/dist/i18n/es-419.properties +68 -0
  42. package/dist/i18n/es-ES.js +36 -0
  43. package/dist/i18n/es-ES.properties +68 -0
  44. package/dist/i18n/fi-FI.js +36 -0
  45. package/dist/i18n/fi-FI.properties +68 -0
  46. package/dist/i18n/fr-CA.js +36 -0
  47. package/dist/i18n/fr-CA.properties +68 -0
  48. package/dist/i18n/fr-FR.js +36 -0
  49. package/dist/i18n/fr-FR.properties +68 -0
  50. package/dist/i18n/hi-IN.js +36 -0
  51. package/dist/i18n/hi-IN.properties +68 -0
  52. package/dist/i18n/it-IT.js +36 -0
  53. package/dist/i18n/it-IT.properties +68 -0
  54. package/dist/i18n/ja-JP.js +36 -0
  55. package/dist/i18n/ja-JP.properties +68 -0
  56. package/dist/i18n/json/src/lib/uploads-header/uploads-header.messages.json +1 -0
  57. package/dist/i18n/json/src/lib/uploads-item/uploads-item.messages.json +1 -0
  58. package/dist/i18n/json/src/lib/uploads-item-list/uploads-item-list.messages.json +1 -0
  59. package/dist/i18n/ko-KR.js +36 -0
  60. package/dist/i18n/ko-KR.properties +68 -0
  61. package/dist/i18n/nb-NO.js +36 -0
  62. package/dist/i18n/nb-NO.properties +68 -0
  63. package/dist/i18n/nl-NL.js +36 -0
  64. package/dist/i18n/nl-NL.properties +68 -0
  65. package/dist/i18n/pl-PL.js +36 -0
  66. package/dist/i18n/pl-PL.properties +68 -0
  67. package/dist/i18n/pt-BR.js +36 -0
  68. package/dist/i18n/pt-BR.properties +68 -0
  69. package/dist/i18n/ru-RU.js +36 -0
  70. package/dist/i18n/ru-RU.properties +68 -0
  71. package/dist/i18n/sv-SE.js +36 -0
  72. package/dist/i18n/sv-SE.properties +68 -0
  73. package/dist/i18n/tr-TR.js +36 -0
  74. package/dist/i18n/tr-TR.properties +68 -0
  75. package/dist/i18n/zh-CN.js +36 -0
  76. package/dist/i18n/zh-CN.properties +68 -0
  77. package/dist/i18n/zh-TW.js +36 -0
  78. package/dist/i18n/zh-TW.properties +68 -0
  79. package/dist/styles/uploads-header.css +1 -0
  80. package/dist/styles/uploads-item-list.css +1 -0
  81. package/dist/styles/uploads-item.css +1 -0
  82. package/dist/styles/uploads-manager.css +1 -0
  83. package/dist/types/index.d.ts +4 -0
  84. package/dist/types/lib/stories/decorators.d.ts +2 -0
  85. package/dist/types/lib/stories/mocks.d.ts +2 -0
  86. package/dist/types/lib/types.d.ts +141 -0
  87. package/dist/types/lib/uploads-header/index.d.ts +2 -0
  88. package/dist/types/lib/uploads-header/uploads-header.d.ts +19 -0
  89. package/dist/types/lib/uploads-header/uploads-header.messages.d.ts +83 -0
  90. package/dist/types/lib/uploads-item/components/action-buttons.d.ts +5 -0
  91. package/dist/types/lib/uploads-item/components/index.d.ts +3 -0
  92. package/dist/types/lib/uploads-item/components/item-row-icon.d.ts +4 -0
  93. package/dist/types/lib/uploads-item/components/status-line.d.ts +4 -0
  94. package/dist/types/lib/uploads-item/index.d.ts +1 -0
  95. package/dist/types/lib/uploads-item/uploads-item.d.ts +6 -0
  96. package/dist/types/lib/uploads-item/uploads-item.messages.d.ts +88 -0
  97. package/dist/types/lib/uploads-item-list/index.d.ts +1 -0
  98. package/dist/types/lib/uploads-item-list/uploads-item-list.d.ts +6 -0
  99. package/dist/types/lib/uploads-item-list/uploads-item-list.messages.d.ts +8 -0
  100. package/dist/types/lib/uploads-manager.d.ts +3 -0
  101. package/dist/types/lib/utils/getProgress.d.ts +2 -0
  102. package/dist/types/lib/utils/getStatus.d.ts +2 -0
  103. package/package.json +51 -0
@@ -0,0 +1,149 @@
1
+ import e from "../esm/lib/uploads-header/uploads-header.messages.js";
2
+ import { Button as t, ProgressBar as n, Text as r } from "@box/blueprint-web";
3
+ import i from "clsx";
4
+ import { AlertCircle as a, ChevronDown as o, ChevronUp as s, CloudCheck as c, CloudExclamation as l, CloudUp as u, CloudXMark as d } from "@box/blueprint-web-assets/icons/Medium";
5
+ import { Gray80 as f, GreenLight160 as p, WatermelonRed120 as m } from "@box/blueprint-web-assets/tokens/tokens";
6
+ import { useIntl as h } from "react-intl";
7
+ import { jsx as g, jsxs as _ } from "react/jsx-runtime";
8
+ import '../styles/uploads-header.css';var v = {
9
+ header: "_header_1h5ow_1907",
10
+ headerTop: "_headerTop_1h5ow_1915",
11
+ statusIcon: "_statusIcon_1h5ow_1922",
12
+ iconSwapIn: "_iconSwapIn_1h5ow_1",
13
+ statusIconContainer: "_statusIconContainer_1h5ow_1928",
14
+ iconPulse: "_iconPulse_1h5ow_1",
15
+ titleText: "_titleText_1h5ow_1943",
16
+ textSwapIn: "_textSwapIn_1h5ow_1",
17
+ subtitleText: "_subtitleText_1h5ow_1947",
18
+ statusIconContainerSuccess: "_statusIconContainerSuccess_1h5ow_1951",
19
+ statusIconContainerUploading: "_statusIconContainerUploading_1h5ow_1956",
20
+ statusIconContainerError: "_statusIconContainerError_1h5ow_1961",
21
+ statusIconContainerCanceled: "_statusIconContainerCanceled_1h5ow_1966",
22
+ subtitleError: "_subtitleError_1h5ow_1971",
23
+ subtitleErrorIcon: "_subtitleErrorIcon_1h5ow_1977",
24
+ titleArea: "_titleArea_1h5ow_1983",
25
+ actions: "_actions_1h5ow_1988",
26
+ chevronButton: "_chevronButton_1h5ow_1995",
27
+ progressBar: "_progressBar_1h5ow_1999"
28
+ };
29
+ function y(t, n, r, i, a) {
30
+ return n === "idle" && r === 0 ? {
31
+ title: t.formatMessage(e.titleDragAndDrop),
32
+ subtitle: null,
33
+ StatusIcon: u,
34
+ statusIconAriaLabel: t.formatMessage(e.statusIconPending)
35
+ } : n === "idle" || n === "uploading" ? {
36
+ title: t.formatMessage(e.titleUploading),
37
+ subtitle: t.formatMessage(e.subtitleProgress, {
38
+ completedCount: i,
39
+ totalCount: r
40
+ }),
41
+ StatusIcon: u,
42
+ statusIconAriaLabel: t.formatMessage(e.statusIconPending)
43
+ } : n === "success" ? {
44
+ title: t.formatMessage(e.titleComplete),
45
+ subtitle: t.formatMessage(e.subtitleProgress, {
46
+ completedCount: i,
47
+ totalCount: r
48
+ }),
49
+ StatusIcon: c,
50
+ statusIconAriaLabel: t.formatMessage(e.statusIconComplete)
51
+ } : n === "error" ? i > 0 ? {
52
+ title: t.formatMessage(e.titleComplete),
53
+ subtitle: t.formatMessage(e.subtitleErrors, { failedCount: a }),
54
+ StatusIcon: l,
55
+ statusIconAriaLabel: t.formatMessage(e.statusIconError)
56
+ } : {
57
+ title: t.formatMessage(e.titleErrorAllFailed),
58
+ subtitle: t.formatMessage(e.subtitleErrors, { failedCount: a }),
59
+ StatusIcon: l,
60
+ statusIconAriaLabel: t.formatMessage(e.statusIconError)
61
+ } : {
62
+ title: t.formatMessage(e.titleCanceled),
63
+ subtitle: null,
64
+ StatusIcon: d,
65
+ statusIconAriaLabel: t.formatMessage(e.statusIconCanceled)
66
+ };
67
+ }
68
+ function b({ status: c, progress: l, totalCount: u, completedCount: d, failedCount: b, isExpanded: x, onToggle: S, onCancelAll: C, onRetryAll: w }) {
69
+ let T = h(), E = c === "success", D = c === "uploading", O = c === "error", k = c === "canceled", A;
70
+ E ? A = p : D ? A = f : O && (A = m);
71
+ let { title: j, subtitle: M, StatusIcon: N, statusIconAriaLabel: P } = y(T, c, u, d, b), F = x ? T.formatMessage(e.toggleCollapse) : T.formatMessage(e.toggleExpand);
72
+ return /* @__PURE__ */ _("div", {
73
+ className: v.header,
74
+ children: [/* @__PURE__ */ _("div", {
75
+ className: v.headerTop,
76
+ children: [
77
+ /* @__PURE__ */ g("div", {
78
+ className: i(v.statusIconContainer, {
79
+ [v.statusIconContainerSuccess]: E,
80
+ [v.statusIconContainerUploading]: D,
81
+ [v.statusIconContainerError]: O,
82
+ [v.statusIconContainerCanceled]: k
83
+ }),
84
+ children: /* @__PURE__ */ g(N, {
85
+ "aria-label": P,
86
+ className: v.statusIcon,
87
+ color: A,
88
+ role: "img"
89
+ }, c)
90
+ }, c),
91
+ /* @__PURE__ */ _("div", {
92
+ className: v.titleArea,
93
+ children: [/* @__PURE__ */ g(r, {
94
+ as: "p",
95
+ className: v.titleText,
96
+ variant: "bodyDefaultBold",
97
+ children: j
98
+ }, j), M && /* @__PURE__ */ _(r, {
99
+ as: "p",
100
+ className: i(v.subtitleText, O && v.subtitleError),
101
+ color: O ? "textOnLightError" : "textOnLightSecondary",
102
+ variant: "bodySmall",
103
+ children: [O && /* @__PURE__ */ g(a, {
104
+ "aria-hidden": !0,
105
+ className: v.subtitleErrorIcon,
106
+ color: "currentColor",
107
+ role: "presentation"
108
+ }), M]
109
+ }, O ? "error" : "progress")]
110
+ }),
111
+ /* @__PURE__ */ _("div", {
112
+ className: v.actions,
113
+ children: [
114
+ C && /* @__PURE__ */ g(t, {
115
+ "aria-label": T.formatMessage(e.cancelAll),
116
+ onClick: C,
117
+ size: "small",
118
+ variant: "secondary",
119
+ children: T.formatMessage(e.cancelAll)
120
+ }),
121
+ w && /* @__PURE__ */ g(t, {
122
+ "aria-label": T.formatMessage(e.retryAll),
123
+ onClick: w,
124
+ size: "small",
125
+ variant: "secondary",
126
+ children: T.formatMessage(e.retryAll)
127
+ }),
128
+ /* @__PURE__ */ g(t, {
129
+ "aria-expanded": x,
130
+ "aria-label": F,
131
+ className: v.chevronButton,
132
+ onClick: S,
133
+ size: "small",
134
+ variant: "secondary",
135
+ endIcon: x ? s : o
136
+ })
137
+ ]
138
+ })
139
+ ]
140
+ }), /* @__PURE__ */ g(n, {
141
+ ariaLabel: T.formatMessage(e.progressAriaLabel),
142
+ className: v.progressBar,
143
+ maxValue: 100,
144
+ minValue: 0,
145
+ value: l
146
+ })]
147
+ });
148
+ }
149
+ export { b as t };
@@ -0,0 +1,41 @@
1
+ import { UploadsItem as e } from "../esm/lib/uploads-item/uploads-item.js";
2
+ import t from "../esm/lib/uploads-item-list/uploads-item-list.messages.js";
3
+ import { SmallList as n } from "@box/blueprint-web";
4
+ import { useIntl as r } from "react-intl";
5
+ import { jsx as i } from "react/jsx-runtime";
6
+ import { useMemo as a } from "react";
7
+ import { Collection as o, ListLayout as s, Virtualizer as c } from "react-aria-components";
8
+ import '../styles/uploads-item-list.css';var l = {
9
+ container: "_container_1vohr_1874",
10
+ list: "_list_1vohr_1883"
11
+ }, u = 56, d = 0;
12
+ function f({ items: f, onItemCancel: p, onItemRetry: m, onItemRemove: h, onItemOpen: g, onItemShare: _ }) {
13
+ let { formatMessage: v } = r(), y = a(() => new s({
14
+ estimatedRowHeight: u,
15
+ gap: d
16
+ }), []);
17
+ return /* @__PURE__ */ i("div", {
18
+ className: l.container,
19
+ children: /* @__PURE__ */ i(c, {
20
+ layout: y,
21
+ children: /* @__PURE__ */ i(n, {
22
+ "aria-label": v(t.listAriaLabel),
23
+ "data-testid": "uploads-manager-item-list",
24
+ selectionMode: "none",
25
+ className: l.list,
26
+ children: /* @__PURE__ */ i(o, {
27
+ items: f,
28
+ children: (t) => /* @__PURE__ */ i(e, {
29
+ item: t,
30
+ onItemCancel: p,
31
+ onItemRetry: m,
32
+ onItemRemove: h,
33
+ onItemOpen: g,
34
+ onItemShare: _
35
+ })
36
+ })
37
+ })
38
+ })
39
+ });
40
+ }
41
+ export { f as t };
@@ -0,0 +1,10 @@
1
+ import '../styles/uploads-item.css';var e = {
2
+ iconDimmed: "_iconDimmed_crikc_1874",
3
+ statusLine: "_statusLine_crikc_1878",
4
+ statusIcon: "_statusIcon_crikc_1885",
5
+ statusCompleted: "_statusCompleted_crikc_1891",
6
+ statusError: "_statusError_crikc_1896",
7
+ item: "_item_crikc_1900",
8
+ actionButton: "_actionButton_crikc_1905"
9
+ };
10
+ export { e as t };
@@ -0,0 +1,52 @@
1
+ import { t as e } from "./uploads-header.js";
2
+ import { t } from "./uploads-item-list.js";
3
+ import { getProgress as n } from "../esm/lib/utils/getProgress.js";
4
+ import { getStatus as r } from "../esm/lib/utils/getStatus.js";
5
+ import { useControllableState as i } from "@box/blueprint-web";
6
+ import a from "clsx";
7
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
8
+ import '../styles/uploads-manager.css';var c = {
9
+ container: "_container_1ybju_1874",
10
+ itemListSlot: "_itemListSlot_1ybju_1884",
11
+ itemListSlotExpanded: "_itemListSlotExpanded_1ybju_1892",
12
+ itemList: "_itemList_1ybju_1884"
13
+ };
14
+ function l({ isExpanded: l, defaultExpanded: u = !0, onToggle: d, items: f, onCancelAll: p, onRetryAll: m, onItemCancel: h, onItemRetry: g, onItemRemove: _, onItemOpen: v, onItemShare: y }) {
15
+ let [b = !0, x] = i({
16
+ prop: l,
17
+ defaultProp: u,
18
+ onChange: d
19
+ }), S = () => x((e) => !e), C = f.length, w = f.filter((e) => e.status === "complete").length, T = f.filter((e) => e.status === "error").length, E = f.filter((e) => e.status === "canceled").length, D = f.some((e) => e.status === "pending" || e.status === "uploading" || e.status === "staged"), O = D && !!p, k = !D && T > 0 && !!m, A = r(f), j = A === "canceled" ? 0 : n(f);
20
+ return /* @__PURE__ */ s("div", {
21
+ className: c.container,
22
+ children: [/* @__PURE__ */ o(e, {
23
+ canceledCount: E,
24
+ completedCount: w,
25
+ failedCount: T,
26
+ isExpanded: b,
27
+ onCancelAll: O ? p : void 0,
28
+ onRetryAll: k ? m : void 0,
29
+ onToggle: S,
30
+ progress: j,
31
+ status: A,
32
+ totalCount: C
33
+ }), /* @__PURE__ */ o("div", {
34
+ className: a(c.itemListSlot, b && c.itemListSlotExpanded),
35
+ children: /* @__PURE__ */ o("div", {
36
+ "aria-hidden": !b,
37
+ className: c.itemList,
38
+ "data-testid": "uploads-manager-item-list-container",
39
+ ...!b && { inert: "" },
40
+ children: /* @__PURE__ */ o(t, {
41
+ items: f,
42
+ onItemCancel: h,
43
+ onItemRetry: g,
44
+ onItemRemove: _,
45
+ onItemOpen: v,
46
+ onItemShare: y
47
+ })
48
+ })
49
+ })]
50
+ });
51
+ }
52
+ export { l as t };
@@ -0,0 +1,5 @@
1
+ import { UploadsItem as e } from "./lib/uploads-item/uploads-item.js";
2
+ import { t } from "../chunks/uploads-item-list.js";
3
+ import "./lib/uploads-item-list/index.js";
4
+ import { t as n } from "../chunks/uploads-manager.js";
5
+ export { e as UploadsItem, t as UploadsItemList, n as UploadsManager };
@@ -0,0 +1,2 @@
1
+ import { t as e } from "../../../chunks/uploads-header.js";
2
+ export { e as UploadsHeader, e as default };
@@ -0,0 +1,2 @@
1
+ import { t as e } from "../../../chunks/uploads-header.js";
2
+ export { e as UploadsHeader, e as default };
@@ -0,0 +1,68 @@
1
+ import { defineMessages as e } from "react-intl";
2
+ var t = e({
3
+ titleDragAndDrop: {
4
+ id: "groupSharedFeatures.uploadsManager.header.titleDragAndDrop",
5
+ defaultMessage: "Drag and drop files"
6
+ },
7
+ titleUploading: {
8
+ id: "groupSharedFeatures.uploadsManager.header.titleUploading",
9
+ defaultMessage: "Uploading"
10
+ },
11
+ titleComplete: {
12
+ id: "groupSharedFeatures.uploadsManager.header.titleComplete",
13
+ defaultMessage: "Uploads Complete"
14
+ },
15
+ titleCanceled: {
16
+ id: "groupSharedFeatures.uploadsManager.header.titleCanceled",
17
+ defaultMessage: "Uploads Canceled"
18
+ },
19
+ titleErrorAllFailed: {
20
+ id: "groupSharedFeatures.uploadsManager.header.titleErrorAllFailed",
21
+ defaultMessage: "Uploads Failed"
22
+ },
23
+ subtitleProgress: {
24
+ id: "groupSharedFeatures.uploadsManager.header.subtitleProgress",
25
+ defaultMessage: "{completedCount} of {totalCount} complete"
26
+ },
27
+ subtitleErrors: {
28
+ id: "groupSharedFeatures.uploadsManager.header.subtitleErrors",
29
+ defaultMessage: "{failedCount, plural, one {# Error} other {# Errors}}"
30
+ },
31
+ cancelAll: {
32
+ id: "groupSharedFeatures.uploadsManager.header.cancelAll",
33
+ defaultMessage: "Cancel All"
34
+ },
35
+ retryAll: {
36
+ id: "groupSharedFeatures.uploadsManager.header.retryAll",
37
+ defaultMessage: "Retry All"
38
+ },
39
+ toggleExpand: {
40
+ id: "groupSharedFeatures.uploadsManager.header.toggleExpand",
41
+ defaultMessage: "Expand uploads panel"
42
+ },
43
+ toggleCollapse: {
44
+ id: "groupSharedFeatures.uploadsManager.header.toggleCollapse",
45
+ defaultMessage: "Collapse uploads panel"
46
+ },
47
+ progressAriaLabel: {
48
+ id: "groupSharedFeatures.uploadsManager.header.progressAriaLabel",
49
+ defaultMessage: "Upload progress"
50
+ },
51
+ statusIconPending: {
52
+ id: "groupSharedFeatures.uploadsManager.header.statusIconPending",
53
+ defaultMessage: "Pending upload"
54
+ },
55
+ statusIconComplete: {
56
+ id: "groupSharedFeatures.uploadsManager.header.statusIconComplete",
57
+ defaultMessage: "Upload complete"
58
+ },
59
+ statusIconError: {
60
+ id: "groupSharedFeatures.uploadsManager.header.statusIconError",
61
+ defaultMessage: "Upload error"
62
+ },
63
+ statusIconCanceled: {
64
+ id: "groupSharedFeatures.uploadsManager.header.statusIconCanceled",
65
+ defaultMessage: "Upload canceled"
66
+ }
67
+ });
68
+ export { t as default };
@@ -0,0 +1,57 @@
1
+ import e from "../uploads-item.messages.js";
2
+ import { t } from "../../../../chunks/uploads-item.module.js";
3
+ import { SmallList as n } from "@box/blueprint-web";
4
+ import { ArrowUpRightSquare as r, ArrowsSpinning as i, Link as a, XMark as o } from "@box/blueprint-web-assets/icons/Medium";
5
+ import { useIntl as s } from "react-intl";
6
+ import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
7
+ function d({ item: d, onItemCancel: f, onItemRetry: p, onItemRemove: m, onItemOpen: h, onItemShare: g }) {
8
+ let _ = s(), { status: v, name: y, isFolder: b, isRetryable: x } = d;
9
+ return v === "pending" || v === "uploading" ? f ? /* @__PURE__ */ l(n.ActionIconButton, {
10
+ "aria-label": _.formatMessage(e.itemActionCancelAriaLabel, { name: y }),
11
+ className: t.actionButton,
12
+ icon: o,
13
+ onClick: () => f(d.id),
14
+ size: "small"
15
+ }) : null : v === "complete" ? b ? null : /* @__PURE__ */ u(c, { children: [
16
+ h && /* @__PURE__ */ l(n.ActionIconButton, {
17
+ "aria-label": _.formatMessage(e.itemActionOpenAriaLabel, { name: y }),
18
+ className: t.actionButton,
19
+ icon: r,
20
+ onClick: () => h(d.id),
21
+ size: "small"
22
+ }),
23
+ g && /* @__PURE__ */ l(n.ActionIconButton, {
24
+ "aria-label": _.formatMessage(e.itemActionShareAriaLabel, { name: y }),
25
+ className: t.actionButton,
26
+ icon: a,
27
+ onClick: () => g(d.id),
28
+ size: "small"
29
+ }),
30
+ m && /* @__PURE__ */ l(n.ActionIconButton, {
31
+ "aria-label": _.formatMessage(e.itemActionRemoveAriaLabel, { name: y }),
32
+ className: t.actionButton,
33
+ icon: o,
34
+ onClick: () => m(d.id),
35
+ size: "small"
36
+ })
37
+ ] }) : v === "error" ? /* @__PURE__ */ u(c, { children: [x !== !1 && p && /* @__PURE__ */ l(n.ActionIconButton, {
38
+ "aria-label": _.formatMessage(e.itemActionRetryAriaLabel, { name: y }),
39
+ className: t.actionButton,
40
+ icon: i,
41
+ onClick: () => p(d.id),
42
+ size: "small"
43
+ }), m && /* @__PURE__ */ l(n.ActionIconButton, {
44
+ "aria-label": _.formatMessage(e.itemActionRemoveAriaLabel, { name: y }),
45
+ className: t.actionButton,
46
+ icon: o,
47
+ onClick: () => m(d.id),
48
+ size: "small"
49
+ })] }) : v === "canceled" && p ? /* @__PURE__ */ l(n.ActionIconButton, {
50
+ "aria-label": _.formatMessage(e.itemActionRetryAriaLabel, { name: y }),
51
+ className: t.actionButton,
52
+ icon: i,
53
+ onClick: () => p(d.id),
54
+ size: "small"
55
+ }) : null;
56
+ }
57
+ export { d as ActionButtons };
@@ -0,0 +1,4 @@
1
+ import { ItemRowIcon as e } from "./item-row-icon.js";
2
+ import { StatusLine as t } from "./status-line.js";
3
+ import { ActionButtons as n } from "./action-buttons.js";
4
+ export { n as ActionButtons, e as ItemRowIcon, t as StatusLine };
@@ -0,0 +1,24 @@
1
+ import e from "../uploads-item.messages.js";
2
+ import { t } from "../../../../chunks/uploads-item.module.js";
3
+ import { CircularProgress as n } from "@box/blueprint-web";
4
+ import { useIntl as r } from "react-intl";
5
+ import { jsx as i } from "react/jsx-runtime";
6
+ import { ItemIcon as a, getFileCategoryByExtension as o } from "@box/item-icon";
7
+ function s({ item: s }) {
8
+ let c = r(), { status: l, name: u, progress: d, isFolder: f, extension: p } = s;
9
+ if (l === "pending" || l === "uploading" || l === "staged") return /* @__PURE__ */ i(n, {
10
+ "aria-label": c.formatMessage(e.itemProgressAriaLabel, {
11
+ name: u,
12
+ progress: d
13
+ }),
14
+ value: d
15
+ });
16
+ let m = f ? "folder-plain" : o(p.toLowerCase());
17
+ return /* @__PURE__ */ i(a, {
18
+ ariaHidden: !0,
19
+ className: l === "canceled" ? t.iconDimmed : void 0,
20
+ dimension: 32,
21
+ iconType: m
22
+ });
23
+ }
24
+ export { s as ItemRowIcon };
@@ -0,0 +1,64 @@
1
+ import e from "../uploads-item.messages.js";
2
+ import { t } from "../../../../chunks/uploads-item.module.js";
3
+ import { Text as n } from "@box/blueprint-web";
4
+ import { AlertCircle as r, CheckmarkCircle as i, XMarkCircle as a } from "@box/blueprint-web-assets/icons/Medium";
5
+ import { useIntl as o } from "react-intl";
6
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
7
+ function l({ item: l }) {
8
+ let u = o(), { status: d, progress: f, isFolder: p, errorMessage: m, versionNumber: h } = l;
9
+ return d === "pending" || d === "uploading" || d === "staged" ? p ? null : /* @__PURE__ */ s(n, {
10
+ as: "span",
11
+ color: "textOnLightSecondary",
12
+ variant: "bodySmall",
13
+ children: u.formatMessage(e.itemStatusUploading, { progress: f })
14
+ }) : d === "complete" ? /* @__PURE__ */ c("div", {
15
+ className: t.statusLine,
16
+ children: [
17
+ /* @__PURE__ */ s(i, {
18
+ "aria-hidden": !0,
19
+ className: `${t.statusIcon} ${t.statusCompleted}`,
20
+ color: "currentColor",
21
+ role: "presentation"
22
+ }),
23
+ /* @__PURE__ */ s(n, {
24
+ as: "span",
25
+ className: t.statusCompleted,
26
+ variant: "bodySmall",
27
+ children: u.formatMessage(e.itemStatusCompleted)
28
+ }),
29
+ h && /* @__PURE__ */ s(n, {
30
+ as: "span",
31
+ variant: "bodySmall",
32
+ color: "textOnLightSecondary",
33
+ children: u.formatMessage(e.itemStatusVersionSuffix, { versionNumber: h })
34
+ })
35
+ ]
36
+ }) : d === "error" ? /* @__PURE__ */ c("div", {
37
+ className: t.statusLine,
38
+ children: [/* @__PURE__ */ s(r, {
39
+ "aria-hidden": !0,
40
+ className: `${t.statusIcon} ${t.statusError}`,
41
+ color: "currentColor",
42
+ role: "presentation"
43
+ }), /* @__PURE__ */ s(n, {
44
+ as: "span",
45
+ color: "textOnLightError",
46
+ variant: "bodySmall",
47
+ children: u.formatMessage(e.itemStatusError, { errorMessage: m ?? "" })
48
+ })]
49
+ }) : d === "canceled" ? /* @__PURE__ */ c("div", {
50
+ className: t.statusLine,
51
+ children: [/* @__PURE__ */ s(a, {
52
+ "aria-hidden": !0,
53
+ className: t.statusIcon,
54
+ color: "currentColor",
55
+ role: "presentation"
56
+ }), /* @__PURE__ */ s(n, {
57
+ as: "span",
58
+ color: "textOnLightSecondary",
59
+ variant: "bodySmall",
60
+ children: u.formatMessage(e.itemStatusCanceled)
61
+ })]
62
+ }) : null;
63
+ }
64
+ export { l as StatusLine };
@@ -0,0 +1,2 @@
1
+ import { UploadsItem as e } from "./uploads-item.js";
2
+ export { e as UploadsItem };
@@ -0,0 +1,32 @@
1
+ import { t as e } from "../../../chunks/uploads-item.module.js";
2
+ import { ItemRowIcon as t } from "./components/item-row-icon.js";
3
+ import { StatusLine as n } from "./components/status-line.js";
4
+ import { ActionButtons as r } from "./components/action-buttons.js";
5
+ import { SmallList as i } from "@box/blueprint-web";
6
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
7
+ function s({ item: s, onItemCancel: c, onItemRetry: l, onItemRemove: u, onItemOpen: d, onItemShare: f }) {
8
+ let p = !s.isFolder || s.status === "complete" || s.status === "error";
9
+ return /* @__PURE__ */ o(i.Item, {
10
+ id: s.id,
11
+ textValue: s.name,
12
+ className: e.item,
13
+ onPointerDown: (e) => e.preventDefault(),
14
+ children: [
15
+ /* @__PURE__ */ a(i.Thumbnail, {
16
+ hasCustomSize: !0,
17
+ children: /* @__PURE__ */ a(t, { item: s })
18
+ }),
19
+ /* @__PURE__ */ a(i.Header, { children: s.name }),
20
+ p && /* @__PURE__ */ a(i.Subtitle, { children: /* @__PURE__ */ a(n, { item: s }) }),
21
+ /* @__PURE__ */ a(i.Actions, { children: /* @__PURE__ */ a(r, {
22
+ item: s,
23
+ onItemCancel: c,
24
+ onItemRetry: l,
25
+ onItemRemove: u,
26
+ onItemOpen: d,
27
+ onItemShare: f
28
+ }) })
29
+ ]
30
+ });
31
+ }
32
+ export { s as UploadsItem, s as default };
@@ -0,0 +1,72 @@
1
+ import { defineMessages as e } from "react-intl";
2
+ var t = e({
3
+ itemStatusUploading: {
4
+ id: "groupSharedFeatures.uploadsManager.itemList.itemStatusUploading",
5
+ defaultMessage: "Uploading · {progress}%"
6
+ },
7
+ itemStatusCompleted: {
8
+ id: "groupSharedFeatures.uploadsManager.itemList.itemStatusCompleted",
9
+ defaultMessage: "Completed"
10
+ },
11
+ itemStatusCompletedWithVersion: {
12
+ id: "groupSharedFeatures.uploadsManager.itemList.itemStatusCompletedWithVersion",
13
+ defaultMessage: "Completed · Version {versionNumber}"
14
+ },
15
+ itemStatusVersionSuffix: {
16
+ id: "groupSharedFeatures.uploadsManager.itemList.itemStatusVersionSuffix",
17
+ defaultMessage: "· Version {versionNumber}"
18
+ },
19
+ itemStatusCanceled: {
20
+ id: "groupSharedFeatures.uploadsManager.itemList.itemStatusCanceled",
21
+ defaultMessage: "Canceled"
22
+ },
23
+ itemStatusError: {
24
+ id: "groupSharedFeatures.uploadsManager.itemList.itemStatusError",
25
+ defaultMessage: "Error: {errorMessage}"
26
+ },
27
+ itemProgressAriaLabel: {
28
+ id: "groupSharedFeatures.uploadsManager.itemList.itemProgressAriaLabel",
29
+ defaultMessage: "Uploading {name}, {progress}% complete"
30
+ },
31
+ itemActionCancel: {
32
+ id: "groupSharedFeatures.uploadsManager.itemList.itemActionCancel",
33
+ defaultMessage: "Cancel"
34
+ },
35
+ itemActionCancelAriaLabel: {
36
+ id: "groupSharedFeatures.uploadsManager.itemList.itemActionCancelAriaLabel",
37
+ defaultMessage: "Cancel upload for {name}"
38
+ },
39
+ itemActionRetry: {
40
+ id: "groupSharedFeatures.uploadsManager.itemList.itemActionRetry",
41
+ defaultMessage: "Retry"
42
+ },
43
+ itemActionRetryAriaLabel: {
44
+ id: "groupSharedFeatures.uploadsManager.itemList.itemActionRetryAriaLabel",
45
+ defaultMessage: "Retry upload for {name}"
46
+ },
47
+ itemActionRemove: {
48
+ id: "groupSharedFeatures.uploadsManager.itemList.itemActionRemove",
49
+ defaultMessage: "Remove"
50
+ },
51
+ itemActionRemoveAriaLabel: {
52
+ id: "groupSharedFeatures.uploadsManager.itemList.itemActionRemoveAriaLabel",
53
+ defaultMessage: "Remove {name}"
54
+ },
55
+ itemActionOpen: {
56
+ id: "groupSharedFeatures.uploadsManager.itemList.itemActionOpen",
57
+ defaultMessage: "Open"
58
+ },
59
+ itemActionOpenAriaLabel: {
60
+ id: "groupSharedFeatures.uploadsManager.itemList.itemActionOpenAriaLabel",
61
+ defaultMessage: "Open {name}"
62
+ },
63
+ itemActionShare: {
64
+ id: "groupSharedFeatures.uploadsManager.itemList.itemActionShare",
65
+ defaultMessage: "Share"
66
+ },
67
+ itemActionShareAriaLabel: {
68
+ id: "groupSharedFeatures.uploadsManager.itemList.itemActionShareAriaLabel",
69
+ defaultMessage: "Share {name}"
70
+ }
71
+ });
72
+ export { t as default };
@@ -0,0 +1,2 @@
1
+ import { t as e } from "../../../chunks/uploads-item-list.js";
2
+ export { e as UploadsItemList };
@@ -0,0 +1,2 @@
1
+ import { t as e } from "../../../chunks/uploads-item-list.js";
2
+ export { e as UploadsItemList, e as default };
@@ -0,0 +1,6 @@
1
+ import { defineMessages as e } from "react-intl";
2
+ var t = e({ listAriaLabel: {
3
+ id: "groupSharedFeatures.uploadsManager.itemList.listAriaLabel",
4
+ defaultMessage: "Uploads"
5
+ } });
6
+ export { t as default };
@@ -0,0 +1,3 @@
1
+ import "./uploads-item-list/index.js";
2
+ import { t as e } from "../../chunks/uploads-manager.js";
3
+ export { e as UploadsManager, e as default };
@@ -0,0 +1,9 @@
1
+ function e(e) {
2
+ return e < 0 ? 0 : e > 100 ? 100 : e;
3
+ }
4
+ function t(t) {
5
+ if (t.length === 0) return 0;
6
+ let n = t.reduce((t, n) => n.status === "complete" || n.status === "error" || n.status === "canceled" ? t + 100 : n.status === "pending" ? t : t + e(n.progress), 0);
7
+ return Math.floor(n / t.length);
8
+ }
9
+ export { t as getProgress };
@@ -0,0 +1,11 @@
1
+ function e(e) {
2
+ if (e.length === 0) return "idle";
3
+ let t = e.filter((e) => e.status === "complete").length;
4
+ if (t === e.length) return "success";
5
+ let n = e.some((e) => e.status === "pending"), r = e.some((e) => e.status === "uploading" || e.status === "staged");
6
+ if (r || n) return r ? "uploading" : "idle";
7
+ if (e.some((e) => e.status === "error")) return "error";
8
+ let i = e.filter((e) => e.status === "canceled").length;
9
+ return i > 0 && i + t === e.length ? "canceled" : t > 0 ? "success" : "canceled";
10
+ }
11
+ export { e as getStatus };