@box/unified-share-modal 2.12.14 → 2.12.16

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 (95) hide show
  1. package/dist/chunks/classification-status.js +62 -0
  2. package/dist/chunks/collaboration-role.js +89 -0
  3. package/dist/chunks/collaboration-section.js +156 -0
  4. package/dist/chunks/collaborator-list-item.js +61 -0
  5. package/dist/chunks/collaborator-list.js +74 -0
  6. package/dist/chunks/remove-collaborator-modal.js +61 -0
  7. package/dist/chunks/remove-shared-link-modal.js +56 -0
  8. package/dist/chunks/shared-link-access.js +65 -0
  9. package/dist/chunks/shared-link-permission.js +67 -0
  10. package/dist/chunks/shared-link-section.js +176 -0
  11. package/dist/chunks/shared-link-settings-modal.js +86 -0
  12. package/dist/chunks/shared-with-avatars.js +48 -0
  13. package/dist/chunks/shield-restriction-notice.js +97 -0
  14. package/dist/chunks/text-area-container.js +36 -0
  15. package/dist/chunks/unified-share-form-modal.js +66 -0
  16. package/dist/chunks/unified-share-form.js +23 -0
  17. package/dist/esm/index.js +2 -4
  18. package/dist/esm/lib/components/classification-status/classification-status.js +2 -80
  19. package/dist/esm/lib/components/classification-status/index.js +2 -4
  20. package/dist/esm/lib/components/classification-status/messages.js +10 -12
  21. package/dist/esm/lib/components/index.js +5 -10
  22. package/dist/esm/lib/components/remove-collaborator-modal/index.js +2 -4
  23. package/dist/esm/lib/components/remove-collaborator-modal/messages.js +26 -28
  24. package/dist/esm/lib/components/remove-collaborator-modal/remove-collaborator-modal.js +2 -84
  25. package/dist/esm/lib/components/remove-shared-link-modal/index.js +2 -4
  26. package/dist/esm/lib/components/remove-shared-link-modal/messages.js +26 -28
  27. package/dist/esm/lib/components/remove-shared-link-modal/remove-shared-link-modal.js +2 -72
  28. package/dist/esm/lib/components/shared-link-settings-modal/download-section.js +35 -61
  29. package/dist/esm/lib/components/shared-link-settings-modal/expiration-section.js +33 -50
  30. package/dist/esm/lib/components/shared-link-settings-modal/index.js +2 -4
  31. package/dist/esm/lib/components/shared-link-settings-modal/messages.js +138 -144
  32. package/dist/esm/lib/components/shared-link-settings-modal/password-section.js +32 -52
  33. package/dist/esm/lib/components/shared-link-settings-modal/shared-link-settings-modal.js +2 -98
  34. package/dist/esm/lib/components/shared-link-settings-modal/shared-link-settings.js +97 -126
  35. package/dist/esm/lib/components/shared-link-settings-modal/vanity-section.js +33 -47
  36. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/collaboration-role.js +2 -128
  37. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/collaboration-section.js +2 -202
  38. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/index.js +2 -4
  39. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/messages.js +134 -136
  40. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/shared-with-avatars.js +2 -67
  41. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/shield-restriction-notice.js +2 -134
  42. package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/text-area-container.js +2 -53
  43. package/dist/esm/lib/components/unified-share-form-modal/collaborator-list/collaborator-avatar.js +48 -60
  44. package/dist/esm/lib/components/unified-share-form-modal/collaborator-list/collaborator-list-item.js +2 -86
  45. package/dist/esm/lib/components/unified-share-form-modal/collaborator-list/collaborator-list.js +2 -101
  46. package/dist/esm/lib/components/unified-share-form-modal/collaborator-list/index.js +2 -4
  47. package/dist/esm/lib/components/unified-share-form-modal/collaborator-list/messages.js +38 -40
  48. package/dist/esm/lib/components/unified-share-form-modal/index.js +2 -4
  49. package/dist/esm/lib/components/unified-share-form-modal/messages.js +46 -48
  50. package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/index.js +2 -4
  51. package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/messages.js +142 -144
  52. package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-access.js +2 -102
  53. package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-permission.js +2 -105
  54. package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-section.js +2 -191
  55. package/dist/esm/lib/components/unified-share-form-modal/unified-share-form-modal.js +2 -85
  56. package/dist/esm/lib/components/unified-share-form-modal/unified-share-form.js +2 -29
  57. package/dist/esm/lib/constants.js +44 -28
  58. package/dist/esm/lib/contexts/index.js +4 -14
  59. package/dist/esm/lib/contexts/shared-link-settings-context.js +50 -59
  60. package/dist/esm/lib/contexts/unified-share-form-context.js +60 -57
  61. package/dist/esm/lib/contexts/unified-share-modal-context.js +65 -68
  62. package/dist/esm/lib/hooks/index.js +7 -14
  63. package/dist/esm/lib/hooks/use-access-levels.js +69 -93
  64. package/dist/esm/lib/hooks/use-collaboration-form.js +75 -95
  65. package/dist/esm/lib/hooks/use-form-validation.js +32 -43
  66. package/dist/esm/lib/hooks/use-link-settings-form.js +49 -64
  67. package/dist/esm/lib/hooks/use-permission-levels.js +33 -50
  68. package/dist/esm/lib/hooks/use-sharing-action.js +44 -59
  69. package/dist/esm/lib/messages.js +106 -108
  70. package/dist/esm/lib/unified-share-base.js +30 -40
  71. package/dist/esm/lib/unified-share-modal.js +41 -59
  72. package/dist/esm/lib/utils/collaborator.js +12 -27
  73. package/dist/esm/lib/utils/date.js +10 -14
  74. package/dist/esm/lib/utils/email.js +5 -7
  75. package/dist/esm/lib/utils/event.js +6 -13
  76. package/dist/esm/lib/utils/form.js +4 -14
  77. package/dist/esm/lib/utils/index.js +9 -34
  78. package/dist/esm/lib/utils/notification.js +19 -28
  79. package/dist/esm/lib/utils/permission.js +15 -22
  80. package/dist/esm/lib/utils/validation.js +2 -11
  81. package/dist/styles/classification-status.css +1 -1
  82. package/dist/styles/collaboration-role.css +1 -1
  83. package/dist/styles/collaboration-section.css +1 -1
  84. package/dist/styles/collaborator-list-item.css +1 -1
  85. package/dist/styles/collaborator-list.css +1 -1
  86. package/dist/styles/remove-collaborator-modal.css +1 -1
  87. package/dist/styles/shared-link-access.css +1 -1
  88. package/dist/styles/shared-link-section.css +1 -1
  89. package/dist/styles/shared-link-settings-modal.css +1 -1
  90. package/dist/styles/shared-with-avatars.css +1 -1
  91. package/dist/styles/shield-restriction-notice.css +1 -1
  92. package/dist/styles/text-area-container.css +1 -1
  93. package/dist/styles/unified-share-form-modal.css +1 -1
  94. package/dist/styles/unified-share-form.css +1 -1
  95. package/package.json +10 -10
@@ -1,191 +1,2 @@
1
- import { useRef as G, useCallback as w, useEffect as V } from "react";
2
- import { useIntl as q } from "react-intl";
3
- import { useNotification as H, Text as y, Tooltip as C, Focusable as J, Switch as Q, Status as W, Link as X, Button as Y } from "@box/blueprint-web";
4
- import { ClockBadge as Z } from "@box/blueprint-web-assets/icons/Line";
5
- import { Mail as $, Globe as P } from "@box/blueprint-web-assets/icons/Medium";
6
- import { SurfaceStatusSurfaceRed as ee, bpSize040 as k } from "@box/blueprint-web-assets/tokens/tokens";
7
- import { CopyInput as te } from "@box/copy-input";
8
- import { SharedLinkAccess as ie } from "./shared-link-access.js";
9
- import { SharedLinkPermission as ae } from "./shared-link-permission.js";
10
- import t from "./messages.js";
11
- import { jsxs as h, jsx as i } from "react/jsx-runtime";
12
- import { useUnifiedShareFormContext as ne } from "../../../contexts/unified-share-form-context.js";
13
- import { useUnifiedShareModalContext as oe } from "../../../contexts/unified-share-modal-context.js";
14
- import { useSharingAction as re } from "../../../hooks/use-sharing-action.js";
15
- import { getNotificationArgs as se } from "../../../utils/notification.js";
16
- import { formatDateFromTimestampToDateString as ce } from "../../../utils/date.js";
17
- import { callOnKeyboardEvent as le } from "../../../utils/event.js";
18
- import '../../../../../styles/shared-link-section.css';const de = "_container_j966c_1", he = "_toggle_j966c_7", ue = "_settings_j966c_13", me = "_copy_j966c_22", pe = "_access_j966c_30", ge = "_icon_j966c_36", l = {
19
- container: de,
20
- toggle: he,
21
- settings: ue,
22
- copy: me,
23
- access: pe,
24
- icon: ge
25
- };
26
- function we() {
27
- const {
28
- formatMessage: e
29
- } = q(), {
30
- addNotification: v
31
- } = H(), f = G(null), {
32
- isInteracted: L,
33
- isSharedLinkAutoCopied: m,
34
- isSharedLinkAutoCreated: n,
35
- setForm: B
36
- } = ne(), {
37
- config: s,
38
- eventService: F,
39
- isFetching: x,
40
- isSubmitting: o,
41
- item: M,
42
- setView: T,
43
- sharedLink: r,
44
- sharingService: O
45
- } = oe(), {
46
- permissions: _ = {}
47
- } = M, {
48
- onSharedLinkCopy: S,
49
- onSharedLinkSettingsClick: A
50
- } = F, {
51
- createSharedLink: N
52
- } = O, {
53
- notifications: E,
54
- sharedLinkAutoCopy: R,
55
- sharedLinkAutoCreate: D
56
- } = s, a = !!r.url, c = R && !m.current && !L, I = D && !n.current && !L, U = w(async () => {
57
- const d = await N();
58
- return c ? {
59
- messages: []
60
- } : d;
61
- }, [c, N]), {
62
- onAction: b
63
- } = re(U, "create-shared-link");
64
- V(() => {
65
- (async () => x || o || ((c || I) && !a && !n.current && (n.current = !0, await b()), c && a && f.current && f.current.click()))();
66
- }, [a, c, I, x, m, n, o, b]);
67
- const z = w((d) => {
68
- if (S && S(d), !c)
69
- return;
70
- m.current = !0;
71
- let g;
72
- typeof d != "string" ? g = n.current ? e(t.autoCreateCopyErrorNoticeText) : null : g = n.current ? e(t.autoCreateCopySuccessNoticeText) : e(t.autoCopySuccessNoticeText), g && E.includes("auto-copy-shared-link") && v({
73
- ...se(e, "success"),
74
- styledText: g
75
- });
76
- }, [v, e, c, m, n, E, S]), K = async (d) => {
77
- if (d) {
78
- await b();
79
- return;
80
- }
81
- T("remove-shared-link");
82
- }, j = () => {
83
- if (A) {
84
- A();
85
- return;
86
- }
87
- T("shared-link-settings");
88
- };
89
- let u, p = !1;
90
- return !a && !o && (u = e(t.sharedLinkToggleTooltip)), !a && !_.canShare && (u = e(t.createLinkDisabledTooltip), p = !0), a && !_.canSetShareAccess && (u = e(t.removeLinkDisabledTooltip), p = !0), /* @__PURE__ */ h("div", {
91
- className: l.container,
92
- children: [/* @__PURE__ */ i(y, {
93
- as: "label",
94
- variant: "bodyDefaultBold",
95
- children: e(t.shareLinkLabel)
96
- }), /* @__PURE__ */ h("div", {
97
- className: l.toggle,
98
- children: [/* @__PURE__ */ i(C, {
99
- align: "start",
100
- content: u,
101
- "data-testid": "usm-SharedLinkToggle-tooltip",
102
- open: u ? void 0 : !1,
103
- children: /* @__PURE__ */ i(J, {
104
- focusable: p,
105
- children: /* @__PURE__ */ i(Q.Item, {
106
- checked: a,
107
- "data-target-id": "Toggle-CreateSharedLink",
108
- disabled: p || o,
109
- label: e(t.sharedLinkToggleLabel),
110
- onCheckedChange: K,
111
- value: "shared-link"
112
- })
113
- })
114
- }), a && !!r.expiresAt && /* @__PURE__ */ i(C, {
115
- content: e(t.expirationIconTooltip, {
116
- expirationDate: ce(r.expiresAt)
117
- }),
118
- "data-testid": "usm-SharedLinkExpiration-tooltip",
119
- children: /* @__PURE__ */ i(W, {
120
- color: ee,
121
- hideText: !0,
122
- icon: Z,
123
- text: e(t.expirationIconLabel)
124
- })
125
- }), a && s.sharedLinkSettings && /* @__PURE__ */ i(X, {
126
- "aria-disabled": o,
127
- "aria-haspopup": "dialog",
128
- className: l.settings,
129
- "data-target-id": "PlainButton-SharedLinkSettings",
130
- onClick: j,
131
- onKeyDown: le(j, {
132
- canPreventDefault: !0
133
- }),
134
- role: "button",
135
- tabIndex: o ? -1 : 0,
136
- variant: "standalone",
137
- children: e(t.sharedLinkSettingsLabel)
138
- })]
139
- }), a && /* @__PURE__ */ h("div", {
140
- className: l.copy,
141
- children: [/* @__PURE__ */ i(te, {
142
- ref: f,
143
- autoFocus: D && n.current && !L,
144
- "data-target-id": "Button-CopySharedLink",
145
- disabled: o,
146
- hideLabel: !0,
147
- label: e(t.sharedLinkUrlLabel),
148
- onCopy: z,
149
- value: r.url
150
- }), s.sharedLinkEmail && /* @__PURE__ */ i(C, {
151
- align: "end",
152
- content: e(t.sharedLinkEmailLabel),
153
- children: /* @__PURE__ */ i(Y, {
154
- "aria-label": e(t.sharedLinkEmailLabel),
155
- "data-target-id": "Button-SendSharedLink",
156
- disabled: o,
157
- endIcon: $,
158
- onClick: () => B("email"),
159
- size: "large",
160
- variant: "secondary"
161
- })
162
- })]
163
- }), a && (s.sharedLinkAccess || s.sharedLinkPermission) && /* @__PURE__ */ h("div", {
164
- className: l.access,
165
- children: [s.sharedLinkAccess && /* @__PURE__ */ i(ie, {}), s.sharedLinkPermission && /* @__PURE__ */ i(ae, {})]
166
- }), a && r.access === "open" && /* @__PURE__ */ h("div", {
167
- children: [/* @__PURE__ */ i(P, {
168
- className: l.icon,
169
- height: k,
170
- width: k
171
- }), /* @__PURE__ */ i(y, {
172
- as: "span",
173
- color: "textOnLightSecondary",
174
- children: r.permission === "can_edit" ? e(t.sharedLinkEditablePubliclyAvailable) : e(t.sharedLinkPubliclyAvailable)
175
- })]
176
- }), a && r.access === "company" && r.permission === "can_edit" && /* @__PURE__ */ h("div", {
177
- children: [/* @__PURE__ */ i(P, {
178
- className: l.icon,
179
- height: k,
180
- width: k
181
- }), /* @__PURE__ */ i(y, {
182
- as: "span",
183
- color: "textOnLightSecondary",
184
- children: e(t.sharedLinkElevatedEditableCompanyAvailable)
185
- })]
186
- })]
187
- });
188
- }
189
- export {
190
- we as SharedLinkSection
191
- };
1
+ import { t as e } from "../../../../../chunks/shared-link-section.js";
2
+ export { e as SharedLinkSection };
@@ -1,85 +1,2 @@
1
- import a from "clsx";
2
- import { useCallback as N } from "react";
3
- import { useIntl as S } from "react-intl";
4
- import { Modal as t, LoadingIndicator as v } from "@box/blueprint-web";
5
- import { UnifiedShareForm as D } from "./unified-share-form.js";
6
- import l from "./messages.js";
7
- import { jsxs as i, jsx as o } from "react/jsx-runtime";
8
- import { CollaboratorList as M } from "./collaborator-list/collaborator-list.js";
9
- import { useUnifiedShareFormContext as h } from "../../contexts/unified-share-form-context.js";
10
- import { useUnifiedShareModalContext as O } from "../../contexts/unified-share-modal-context.js";
11
- import { ClassificationStatus as U } from "../classification-status/classification-status.js";
12
- import '../../../../styles/unified-share-form-modal.css';const j = "_content_1k0mu_1", w = "_isFullscreen_1k0mu_4", z = "_body_1k0mu_13", B = "_title_1k0mu_17", I = "_hasFooter_1k0mu_39", P = "_loading_1k0mu_43", H = "_form_1k0mu_51", R = "_isLoading_1k0mu_56", e = {
13
- content: j,
14
- isFullscreen: w,
15
- body: z,
16
- title: B,
17
- hasFooter: I,
18
- loading: P,
19
- form: H,
20
- isLoading: R
21
- };
22
- function Y({
23
- children: m,
24
- isOpen: p,
25
- onOpenChange: c
26
- }) {
27
- const {
28
- formatMessage: n
29
- } = S(), {
30
- isCollaboratorsOpen: d,
31
- setContainerRef: F,
32
- setForm: f
33
- } = h(), {
34
- isFetching: u,
35
- isSubmitting: s,
36
- item: b,
37
- variant: k
38
- } = O(), {
39
- form: C
40
- } = h(), {
41
- name: L
42
- } = b, _ = k === "desktop", g = C === "default" && !d, x = N((r) => {
43
- s || (f("default"), c(r));
44
- }, [s, c, f]), y = (r) => {
45
- r.preventDefault();
46
- };
47
- return /* @__PURE__ */ i(t, {
48
- onOpenChange: x,
49
- open: p,
50
- children: [!!m && /* @__PURE__ */ o(t.Trigger, {
51
- children: m
52
- }), /* @__PURE__ */ i(t.Content, {
53
- ref: F,
54
- className: a(e.content, _ && e.isFullscreen),
55
- onPointerDownOutside: y,
56
- size: "medium",
57
- children: [/* @__PURE__ */ i(t.Header, {
58
- children: [/* @__PURE__ */ o("div", {
59
- className: e.title,
60
- children: n(l.title, {
61
- itemName: L
62
- })
63
- }), /* @__PURE__ */ o(U, {})]
64
- }), /* @__PURE__ */ i(t.Body, {
65
- className: a(e.body, !g && e.hasFooter),
66
- children: [u && /* @__PURE__ */ o("div", {
67
- className: e.loading,
68
- children: /* @__PURE__ */ o(v, {
69
- "aria-label": n(l.loadingLabel),
70
- size: "large"
71
- })
72
- }), /* @__PURE__ */ o("div", {
73
- className: a(e.form, u && e.isLoading),
74
- children: d ? /* @__PURE__ */ o(M, {}) : /* @__PURE__ */ o(D, {})
75
- })]
76
- }), !_ && g && /* @__PURE__ */ o(t.Close, {
77
- "aria-label": n(l.closeButton),
78
- disabled: s
79
- })]
80
- })]
81
- });
82
- }
83
- export {
84
- Y as UnifiedShareFormModal
85
- };
1
+ import { t as e } from "../../../../chunks/unified-share-form-modal.js";
2
+ export { e as UnifiedShareFormModal };
@@ -1,29 +1,2 @@
1
- import { Divider as n } from "@box/blueprint-web";
2
- import { jsxs as m, jsx as o } from "react/jsx-runtime";
3
- import { CollaborationSection as f } from "./collaboration-section/collaboration-section.js";
4
- import { SharedLinkSection as l } from "./shared-link-section/shared-link-section.js";
5
- import { useUnifiedShareModalContext as p } from "../../contexts/unified-share-modal-context.js";
6
- import { useUnifiedShareFormContext as h } from "../../contexts/unified-share-form-context.js";
7
- import '../../../../styles/unified-share-form.css';const S = "_container_rq40p_1", v = "_divider_rq40p_6", i = {
8
- container: S,
9
- divider: v
10
- };
11
- function D() {
12
- const {
13
- config: r,
14
- variant: a
15
- } = p(), {
16
- form: s
17
- } = h(), c = a === "desktop", d = s === "default", t = r.collaboration, e = r.sharedLink && d;
18
- return /* @__PURE__ */ m("div", {
19
- className: i.container,
20
- children: [c && /* @__PURE__ */ o(n, {
21
- className: i.divider
22
- }), t && /* @__PURE__ */ o(f, {}), t && e && /* @__PURE__ */ o(n, {
23
- className: i.divider
24
- }), e && /* @__PURE__ */ o(l, {})]
25
- });
26
- }
27
- export {
28
- D as UnifiedShareForm
29
- };
1
+ import { t as e } from "../../../../chunks/unified-share-form.js";
2
+ export { e as UnifiedShareForm };
@@ -1,28 +1,44 @@
1
- const e = ["invite-collaborators", "remove-collaborator", "create-shared-link", "delete-shared-link", "update-shared-link", "email-shared-link", "auto-copy-shared-link"], r = {
2
- collaboration: !0,
3
- collaborationLimit: 100,
4
- collaborationMessage: !0,
5
- collaborationMessageLimit: 750,
6
- collaborationRole: !0,
7
- collaborators: !0,
8
- collaboratorsLimit: 100,
9
- collaboratorsManagement: !0,
10
- notifications: e,
11
- sharedLink: !0,
12
- sharedLinkAccess: !0,
13
- sharedLinkAutoCopy: !1,
14
- sharedLinkAutoCreate: !1,
15
- sharedLinkEmail: !0,
16
- sharedLinkEmailMessage: !0,
17
- sharedLinkPermission: !0,
18
- sharedLinkSettings: !0
19
- }, o = ["co_owner", "editor", "previewer", "previewer_uploader", "uploader", "viewer", "viewer_uploader"], a = ["owner", ...o], t = ["open", "company", "collaborators"], i = ["can_edit", "can_download", "can_preview"], n = "boxnote";
20
- export {
21
- r as DEFAULT_CONFIGURATION,
22
- e as DEFAULT_NOTIFICATIONS,
23
- n as FILE_EXTENSION_BOX_NOTE,
24
- t as SUPPORTED_ACCESS_LEVELS,
25
- a as SUPPORTED_COLLABORATOR_ROLES,
26
- o as SUPPORTED_INVITATION_ROLES,
27
- i as SUPPORTED_PERMISSION_LEVELS
28
- };
1
+ var e = [
2
+ "invite-collaborators",
3
+ "remove-collaborator",
4
+ "create-shared-link",
5
+ "delete-shared-link",
6
+ "update-shared-link",
7
+ "email-shared-link",
8
+ "auto-copy-shared-link"
9
+ ], t = {
10
+ collaboration: !0,
11
+ collaborationLimit: 100,
12
+ collaborationMessage: !0,
13
+ collaborationMessageLimit: 750,
14
+ collaborationRole: !0,
15
+ collaborators: !0,
16
+ collaboratorsLimit: 100,
17
+ collaboratorsManagement: !0,
18
+ notifications: e,
19
+ sharedLink: !0,
20
+ sharedLinkAccess: !0,
21
+ sharedLinkAutoCopy: !1,
22
+ sharedLinkAutoCreate: !1,
23
+ sharedLinkEmail: !0,
24
+ sharedLinkEmailMessage: !0,
25
+ sharedLinkPermission: !0,
26
+ sharedLinkSettings: !0
27
+ }, n = [
28
+ "co_owner",
29
+ "editor",
30
+ "previewer",
31
+ "previewer_uploader",
32
+ "uploader",
33
+ "viewer",
34
+ "viewer_uploader"
35
+ ], r = ["owner", ...n], i = [
36
+ "open",
37
+ "company",
38
+ "collaborators"
39
+ ], a = [
40
+ "can_edit",
41
+ "can_download",
42
+ "can_preview"
43
+ ], o = "boxnote";
44
+ export { t as DEFAULT_CONFIGURATION, e as DEFAULT_NOTIFICATIONS, o as FILE_EXTENSION_BOX_NOTE, i as SUPPORTED_ACCESS_LEVELS, r as SUPPORTED_COLLABORATOR_ROLES, n as SUPPORTED_INVITATION_ROLES, a as SUPPORTED_PERMISSION_LEVELS };
@@ -1,14 +1,4 @@
1
- import { SharedLinkSettingsContext as i, SharedLinkSettingsProvider as o, useSharedLinkSettingsContext as t } from "./shared-link-settings-context.js";
2
- import { UnifiedShareFormContext as d, UnifiedShareFormProvider as a, useUnifiedShareFormContext as S } from "./unified-share-form-context.js";
3
- import { UnifiedShareModalContext as h, UnifiedShareModalProvider as x, useUnifiedShareModalContext as m } from "./unified-share-modal-context.js";
4
- export {
5
- i as SharedLinkSettingsContext,
6
- o as SharedLinkSettingsProvider,
7
- d as UnifiedShareFormContext,
8
- a as UnifiedShareFormProvider,
9
- h as UnifiedShareModalContext,
10
- x as UnifiedShareModalProvider,
11
- t as useSharedLinkSettingsContext,
12
- S as useUnifiedShareFormContext,
13
- m as useUnifiedShareModalContext
14
- };
1
+ import { UnifiedShareModalContext as e, UnifiedShareModalProvider as t, useUnifiedShareModalContext as n } from "./unified-share-modal-context.js";
2
+ import { UnifiedShareFormContext as r, UnifiedShareFormProvider as i, useUnifiedShareFormContext as a } from "./unified-share-form-context.js";
3
+ import { SharedLinkSettingsContext as o, SharedLinkSettingsProvider as s, useSharedLinkSettingsContext as c } from "./shared-link-settings-context.js";
4
+ export { o as SharedLinkSettingsContext, s as SharedLinkSettingsProvider, r as UnifiedShareFormContext, i as UnifiedShareFormProvider, e as UnifiedShareModalContext, t as UnifiedShareModalProvider, c as useSharedLinkSettingsContext, a as useUnifiedShareFormContext, n as useUnifiedShareModalContext };
@@ -1,60 +1,51 @@
1
- import { createContext as E, useState as F, useMemo as x, useContext as C } from "react";
2
- import { useUnifiedShareModalContext as g } from "./unified-share-modal-context.js";
3
- import { jsx as k } from "react/jsx-runtime";
4
- import { formatDateFromTimestampToCalendarDate as L } from "../utils/date.js";
5
- import { useLinkSettingsForm as v } from "../hooks/use-link-settings-form.js";
6
- const f = /* @__PURE__ */ E(null), M = () => {
7
- const e = C(f);
8
- if (!e)
9
- throw new Error("useSharedLinkSettingsContext must be used with SharedLinkSettingsProvider");
10
- return e;
11
- }, N = ({
12
- children: e
13
- }) => {
14
- const {
15
- sharedLink: h
16
- } = g(), {
17
- expiresAt: t = 0,
18
- settings: p = {},
19
- vanityName: n = ""
20
- } = h, {
21
- isDownloadEnabled: r,
22
- isPasswordEnabled: s
23
- } = p, [i, b] = F(null), o = x(() => ({
24
- expiration: t ? L(t) : null,
25
- isDownloadEnabled: !!r,
26
- isExpirationEnabled: !!t,
27
- isPasswordEnabled: !!s,
28
- isVanityNameEnabled: !!n,
29
- password: "",
30
- vanityName: n
31
- }), [t, r, s, n]), {
32
- errors: a,
33
- formData: d,
34
- handleFormReset: m,
35
- handleFormSubmit: l,
36
- setFieldError: u,
37
- setFieldValue: c,
38
- validatePassword: S
39
- } = v(o), w = x(() => ({
40
- containerRef: i,
41
- errors: a,
42
- formData: d,
43
- initialFormData: o,
44
- resetForm: m,
45
- setContainerRef: b,
46
- setFieldError: u,
47
- setFieldValue: c,
48
- submitForm: l,
49
- validatePassword: S
50
- }), [i, a, d, m, l, o, u, c, S]);
51
- return /* @__PURE__ */ k(f.Provider, {
52
- value: w,
53
- children: e
54
- });
55
- };
56
- export {
57
- f as SharedLinkSettingsContext,
58
- N as SharedLinkSettingsProvider,
59
- M as useSharedLinkSettingsContext
1
+ import { useUnifiedShareModalContext as e } from "./unified-share-modal-context.js";
2
+ import { formatDateFromTimestampToCalendarDate as t } from "../utils/date.js";
3
+ import { useLinkSettingsForm as n } from "../hooks/use-link-settings-form.js";
4
+ import { createContext as r, useContext as i, useMemo as a, useState as o } from "react";
5
+ import { jsx as s } from "react/jsx-runtime";
6
+ var c = /* @__PURE__ */ r(null), l = () => {
7
+ let e = i(c);
8
+ if (!e) throw Error("useSharedLinkSettingsContext must be used with SharedLinkSettingsProvider");
9
+ return e;
10
+ }, u = ({ children: r }) => {
11
+ let { sharedLink: i } = e(), { expiresAt: l = 0, settings: u = {}, vanityName: d = "" } = i, { isDownloadEnabled: f, isPasswordEnabled: p } = u, [m, h] = o(null), g = a(() => ({
12
+ expiration: l ? t(l) : null,
13
+ isDownloadEnabled: !!f,
14
+ isExpirationEnabled: !!l,
15
+ isPasswordEnabled: !!p,
16
+ isVanityNameEnabled: !!d,
17
+ password: "",
18
+ vanityName: d
19
+ }), [
20
+ l,
21
+ f,
22
+ p,
23
+ d
24
+ ]), { errors: _, formData: v, handleFormReset: y, handleFormSubmit: b, setFieldError: x, setFieldValue: S, validatePassword: C } = n(g), w = a(() => ({
25
+ containerRef: m,
26
+ errors: _,
27
+ formData: v,
28
+ initialFormData: g,
29
+ resetForm: y,
30
+ setContainerRef: h,
31
+ setFieldError: x,
32
+ setFieldValue: S,
33
+ submitForm: b,
34
+ validatePassword: C
35
+ }), [
36
+ m,
37
+ _,
38
+ v,
39
+ y,
40
+ b,
41
+ g,
42
+ x,
43
+ S,
44
+ C
45
+ ]);
46
+ return /* @__PURE__ */ s(c.Provider, {
47
+ value: w,
48
+ children: r
49
+ });
60
50
  };
51
+ export { c as SharedLinkSettingsContext, u as SharedLinkSettingsProvider, l as useSharedLinkSettingsContext };
@@ -1,58 +1,61 @@
1
- import { createContext as A, useState as e, useRef as g, useCallback as D, useEffect as k, useMemo as E, useContext as L } from "react";
2
- import { useUnifiedShareModalContext as j } from "./unified-share-modal-context.js";
3
- import { jsx as q } from "react/jsx-runtime";
4
- const M = /* @__PURE__ */ A(null), G = () => {
5
- const t = L(M);
6
- if (!t)
7
- throw new Error("useUnifiedShareFormContext must be used with UnifiedShareFormProvider");
8
- return t;
9
- }, H = ({
10
- children: t
11
- }) => {
12
- const {
13
- initialContacts: n,
14
- isOpen: a,
15
- view: l
16
- } = j(), [o, c] = e("default"), [f, u] = e(!1), [s, d] = e(!1), [m, O] = e(null), [C, h] = e(n), [S, x] = e(""), [R, p] = e(""), [F, U] = e(), [b, v] = e({}), V = g(!1), w = g(!1), I = D((r) => {
17
- v((i) => ({
18
- ...i,
19
- ...r
20
- }));
21
- }, []);
22
- k(() => {
23
- a || (c("default"), u(!1), d(!1), h(n), x(""), p(""), U(void 0), v({}), V.current = !1, w.current = !1);
24
- }, [n, a]), k(() => {
25
- const r = l === "unified-share-form", i = o === "default";
26
- s || (!r || !i) && d(!0);
27
- }, [s, l, o]);
28
- const P = E(() => ({
29
- collaborationRole: F,
30
- contactValue: S,
31
- containerRef: m,
32
- form: o,
33
- isCollaboratorsOpen: f,
34
- isInteracted: s,
35
- isSharedLinkAutoCopied: V,
36
- isSharedLinkAutoCreated: w,
37
- messageValue: R,
38
- setCollaborationRole: U,
39
- setContactValue: x,
40
- setContainerRef: O,
41
- setForm: c,
42
- setIsCollaboratorsOpen: u,
43
- setMessageValue: p,
44
- setShieldRestriction: I,
45
- setUserContacts: h,
46
- shieldRestriction: b,
47
- userContacts: C
48
- }), [F, S, m, o, I, f, s, R, b, C]);
49
- return /* @__PURE__ */ q(M.Provider, {
50
- value: P,
51
- children: t
52
- });
53
- };
54
- export {
55
- M as UnifiedShareFormContext,
56
- H as UnifiedShareFormProvider,
57
- G as useUnifiedShareFormContext
1
+ import { useUnifiedShareModalContext as e } from "./unified-share-modal-context.js";
2
+ import { createContext as t, useCallback as n, useContext as r, useEffect as i, useMemo as a, useRef as o, useState as s } from "react";
3
+ import { jsx as c } from "react/jsx-runtime";
4
+ var l = /* @__PURE__ */ t(null), u = () => {
5
+ let e = r(l);
6
+ if (!e) throw Error("useUnifiedShareFormContext must be used with UnifiedShareFormProvider");
7
+ return e;
8
+ }, d = ({ children: t }) => {
9
+ let { initialContacts: r, isOpen: u, view: d } = e(), [f, p] = s("default"), [m, h] = s(!1), [g, _] = s(!1), [v, y] = s(null), [b, x] = s(r), [S, C] = s(""), [w, T] = s(""), [E, D] = s(), [O, k] = s({}), A = o(!1), j = o(!1), M = n((e) => {
10
+ k((t) => ({
11
+ ...t,
12
+ ...e
13
+ }));
14
+ }, []);
15
+ i(() => {
16
+ u || (p("default"), h(!1), _(!1), x(r), C(""), T(""), D(void 0), k({}), A.current = !1, j.current = !1);
17
+ }, [r, u]), i(() => {
18
+ g || (d !== "unified-share-form" || f !== "default") && _(!0);
19
+ }, [
20
+ g,
21
+ d,
22
+ f
23
+ ]);
24
+ let N = a(() => ({
25
+ collaborationRole: E,
26
+ contactValue: S,
27
+ containerRef: v,
28
+ form: f,
29
+ isCollaboratorsOpen: m,
30
+ isInteracted: g,
31
+ isSharedLinkAutoCopied: A,
32
+ isSharedLinkAutoCreated: j,
33
+ messageValue: w,
34
+ setCollaborationRole: D,
35
+ setContactValue: C,
36
+ setContainerRef: y,
37
+ setForm: p,
38
+ setIsCollaboratorsOpen: h,
39
+ setMessageValue: T,
40
+ setShieldRestriction: M,
41
+ setUserContacts: x,
42
+ shieldRestriction: O,
43
+ userContacts: b
44
+ }), [
45
+ E,
46
+ S,
47
+ v,
48
+ f,
49
+ M,
50
+ m,
51
+ g,
52
+ w,
53
+ O,
54
+ b
55
+ ]);
56
+ return /* @__PURE__ */ c(l.Provider, {
57
+ value: N,
58
+ children: t
59
+ });
58
60
  };
61
+ export { l as UnifiedShareFormContext, d as UnifiedShareFormProvider, u as useUnifiedShareFormContext };