@box/unified-share-modal 0.45.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.
- package/LICENSE +379 -0
- package/README.md +57 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/lib/components/index.js +8 -0
- package/dist/esm/lib/components/remove-shared-link-modal/index.js +4 -0
- package/dist/esm/lib/components/remove-shared-link-modal/messages.js +30 -0
- package/dist/esm/lib/components/remove-shared-link-modal/remove-shared-link-modal.js +59 -0
- package/dist/esm/lib/components/shared-link-settings-modal/index.js +4 -0
- package/dist/esm/lib/components/shared-link-settings-modal/messages.js +106 -0
- package/dist/esm/lib/components/shared-link-settings-modal/shared-link-settings-modal.js +181 -0
- package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/collaboration-role.js +89 -0
- package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/collaboration-section.js +108 -0
- package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/index.js +4 -0
- package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/messages.js +90 -0
- package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/shared-with-avatars.js +58 -0
- package/dist/esm/lib/components/unified-share-form-modal/collaboration-section/text-area-container.js +58 -0
- package/dist/esm/lib/components/unified-share-form-modal/collaborators-view/collaborator-avatar.js +65 -0
- package/dist/esm/lib/components/unified-share-form-modal/collaborators-view/collaborator-list-item.js +64 -0
- package/dist/esm/lib/components/unified-share-form-modal/collaborators-view/collaborators-view.js +85 -0
- package/dist/esm/lib/components/unified-share-form-modal/collaborators-view/index.js +4 -0
- package/dist/esm/lib/components/unified-share-form-modal/collaborators-view/messages.js +38 -0
- package/dist/esm/lib/components/unified-share-form-modal/index.js +4 -0
- package/dist/esm/lib/components/unified-share-form-modal/messages.js +50 -0
- package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/index.js +4 -0
- package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/messages.js +98 -0
- package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-access.js +86 -0
- package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-permission.js +19 -0
- package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-section.js +144 -0
- package/dist/esm/lib/components/unified-share-form-modal/unified-share-form-modal.js +72 -0
- package/dist/esm/lib/components/unified-share-form-modal/unified-share-form.js +29 -0
- package/dist/esm/lib/constants.js +25 -0
- package/dist/esm/lib/contexts/index.js +9 -0
- package/dist/esm/lib/contexts/unified-share-form-context.js +40 -0
- package/dist/esm/lib/contexts/unified-share-modal-context.js +11 -0
- package/dist/esm/lib/hooks/index.js +12 -0
- package/dist/esm/lib/hooks/use-access-levels.js +51 -0
- package/dist/esm/lib/hooks/use-collaboration-form.js +70 -0
- package/dist/esm/lib/hooks/use-form-validation.js +31 -0
- package/dist/esm/lib/hooks/use-link-settings-form.js +60 -0
- package/dist/esm/lib/hooks/use-sharing-action.js +71 -0
- package/dist/esm/lib/messages.js +70 -0
- package/dist/esm/lib/store.js +30 -0
- package/dist/esm/lib/unified-share-modal.js +65 -0
- package/dist/esm/lib/utils/collaborator.js +26 -0
- package/dist/esm/lib/utils/date.js +14 -0
- package/dist/esm/lib/utils/event.js +14 -0
- package/dist/esm/lib/utils/index.js +19 -0
- package/dist/esm/lib/utils/permission.js +14 -0
- package/dist/esm/lib/utils/validation.js +5 -0
- package/dist/i18n/bn-IN.js +157 -0
- package/dist/i18n/bn-IN.properties +290 -0
- package/dist/i18n/da-DK.js +157 -0
- package/dist/i18n/da-DK.properties +290 -0
- package/dist/i18n/de-DE.js +157 -0
- package/dist/i18n/de-DE.properties +290 -0
- package/dist/i18n/en-AU.js +157 -0
- package/dist/i18n/en-AU.properties +290 -0
- package/dist/i18n/en-CA.js +157 -0
- package/dist/i18n/en-CA.properties +290 -0
- package/dist/i18n/en-GB.js +157 -0
- package/dist/i18n/en-GB.properties +290 -0
- package/dist/i18n/en-US.js +111 -0
- package/dist/i18n/en-US.properties +218 -0
- package/dist/i18n/en-x-pseudo.js +157 -0
- package/dist/i18n/en-x-pseudo.properties +290 -0
- package/dist/i18n/es-419.js +157 -0
- package/dist/i18n/es-419.properties +290 -0
- package/dist/i18n/es-ES.js +157 -0
- package/dist/i18n/es-ES.properties +290 -0
- package/dist/i18n/fi-FI.js +157 -0
- package/dist/i18n/fi-FI.properties +290 -0
- package/dist/i18n/fr-CA.js +157 -0
- package/dist/i18n/fr-CA.properties +290 -0
- package/dist/i18n/fr-FR.js +157 -0
- package/dist/i18n/fr-FR.properties +290 -0
- package/dist/i18n/hi-IN.js +157 -0
- package/dist/i18n/hi-IN.properties +290 -0
- package/dist/i18n/it-IT.js +157 -0
- package/dist/i18n/it-IT.properties +290 -0
- package/dist/i18n/ja-JP.js +157 -0
- package/dist/i18n/ja-JP.properties +290 -0
- package/dist/i18n/json/src/lib/components/remove-shared-link-modal/messages.json +1 -0
- package/dist/i18n/json/src/lib/components/shared-link-settings-modal/messages.json +1 -0
- package/dist/i18n/json/src/lib/components/unified-share-form-modal/collaboration-section/messages.json +1 -0
- package/dist/i18n/json/src/lib/components/unified-share-form-modal/collaborators-view/messages.json +1 -0
- package/dist/i18n/json/src/lib/components/unified-share-form-modal/messages.json +1 -0
- package/dist/i18n/json/src/lib/components/unified-share-form-modal/shared-link-section/messages.json +1 -0
- package/dist/i18n/json/src/lib/messages.json +1 -0
- package/dist/i18n/ko-KR.js +157 -0
- package/dist/i18n/ko-KR.properties +290 -0
- package/dist/i18n/nb-NO.js +157 -0
- package/dist/i18n/nb-NO.properties +290 -0
- package/dist/i18n/nl-NL.js +157 -0
- package/dist/i18n/nl-NL.properties +290 -0
- package/dist/i18n/pl-PL.js +157 -0
- package/dist/i18n/pl-PL.properties +290 -0
- package/dist/i18n/pt-BR.js +157 -0
- package/dist/i18n/pt-BR.properties +290 -0
- package/dist/i18n/ru-RU.js +157 -0
- package/dist/i18n/ru-RU.properties +290 -0
- package/dist/i18n/sv-SE.js +157 -0
- package/dist/i18n/sv-SE.properties +290 -0
- package/dist/i18n/tr-TR.js +157 -0
- package/dist/i18n/tr-TR.properties +290 -0
- package/dist/i18n/zh-CN.js +157 -0
- package/dist/i18n/zh-CN.properties +290 -0
- package/dist/i18n/zh-TW.js +157 -0
- package/dist/i18n/zh-TW.properties +290 -0
- package/dist/styles/collaboration-role.css +1 -0
- package/dist/styles/collaboration-section.css +1 -0
- package/dist/styles/collaborator-avatar.css +1 -0
- package/dist/styles/collaborator-list-item.css +1 -0
- package/dist/styles/collaborators-view.css +1 -0
- package/dist/styles/remove-shared-link-modal.css +1 -0
- package/dist/styles/shared-link-access.css +1 -0
- package/dist/styles/shared-link-permission.css +1 -0
- package/dist/styles/shared-link-section.css +1 -0
- package/dist/styles/shared-link-settings-modal.css +1 -0
- package/dist/styles/shared-with-avatars.css +1 -0
- package/dist/styles/text-area-container.css +1 -0
- package/dist/styles/unified-share-form-modal.css +1 -0
- package/dist/styles/unified-share-form.css +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/lib/components/index.d.ts +3 -0
- package/dist/types/lib/components/remove-shared-link-modal/index.d.ts +1 -0
- package/dist/types/lib/components/remove-shared-link-modal/messages.d.ts +33 -0
- package/dist/types/lib/components/remove-shared-link-modal/remove-shared-link-modal.d.ts +5 -0
- package/dist/types/lib/components/remove-shared-link-modal/stories/shared.d.ts +3 -0
- package/dist/types/lib/components/shared-link-settings-modal/index.d.ts +1 -0
- package/dist/types/lib/components/shared-link-settings-modal/messages.d.ts +123 -0
- package/dist/types/lib/components/shared-link-settings-modal/shared-link-settings-modal.d.ts +5 -0
- package/dist/types/lib/components/shared-link-settings-modal/stories/shared.d.ts +36 -0
- package/dist/types/lib/components/unified-share-form-modal/collaboration-section/collaboration-role.d.ts +1 -0
- package/dist/types/lib/components/unified-share-form-modal/collaboration-section/collaboration-section.d.ts +1 -0
- package/dist/types/lib/components/unified-share-form-modal/collaboration-section/index.d.ts +1 -0
- package/dist/types/lib/components/unified-share-form-modal/collaboration-section/messages.d.ts +108 -0
- package/dist/types/lib/components/unified-share-form-modal/collaboration-section/shared-with-avatars.d.ts +1 -0
- package/dist/types/lib/components/unified-share-form-modal/collaboration-section/text-area-container.d.ts +3 -0
- package/dist/types/lib/components/unified-share-form-modal/collaborators-view/collaborator-avatar.d.ts +8 -0
- package/dist/types/lib/components/unified-share-form-modal/collaborators-view/collaborator-list-item.d.ts +5 -0
- package/dist/types/lib/components/unified-share-form-modal/collaborators-view/collaborators-view.d.ts +1 -0
- package/dist/types/lib/components/unified-share-form-modal/collaborators-view/index.d.ts +1 -0
- package/dist/types/lib/components/unified-share-form-modal/collaborators-view/messages.d.ts +43 -0
- package/dist/types/lib/components/unified-share-form-modal/index.d.ts +1 -0
- package/dist/types/lib/components/unified-share-form-modal/messages.d.ts +58 -0
- package/dist/types/lib/components/unified-share-form-modal/shared-link-section/index.d.ts +1 -0
- package/dist/types/lib/components/unified-share-form-modal/shared-link-section/messages.d.ts +118 -0
- package/dist/types/lib/components/unified-share-form-modal/shared-link-section/shared-link-access.d.ts +1 -0
- package/dist/types/lib/components/unified-share-form-modal/shared-link-section/shared-link-permission.d.ts +1 -0
- package/dist/types/lib/components/unified-share-form-modal/shared-link-section/shared-link-section.d.ts +1 -0
- package/dist/types/lib/components/unified-share-form-modal/stories/shared.d.ts +15 -0
- package/dist/types/lib/components/unified-share-form-modal/unified-share-form-modal.d.ts +9 -0
- package/dist/types/lib/components/unified-share-form-modal/unified-share-form.d.ts +1 -0
- package/dist/types/lib/constants.d.ts +7 -0
- package/dist/types/lib/contexts/index.d.ts +2 -0
- package/dist/types/lib/contexts/unified-share-form-context.d.ts +25 -0
- package/dist/types/lib/contexts/unified-share-modal-context.d.ts +16 -0
- package/dist/types/lib/hooks/index.d.ts +5 -0
- package/dist/types/lib/hooks/use-access-levels.d.ts +6 -0
- package/dist/types/lib/hooks/use-collaboration-form.d.ts +10 -0
- package/dist/types/lib/hooks/use-form-validation.d.ts +18 -0
- package/dist/types/lib/hooks/use-link-settings-form.d.ts +10 -0
- package/dist/types/lib/hooks/use-sharing-action.d.ts +7 -0
- package/dist/types/lib/messages.d.ts +83 -0
- package/dist/types/lib/store.d.ts +21 -0
- package/dist/types/lib/stories/shared.d.ts +22 -0
- package/dist/types/lib/types.d.ts +387 -0
- package/dist/types/lib/unified-share-modal.d.ts +20 -0
- package/dist/types/lib/utils/collaborator.d.ts +8 -0
- package/dist/types/lib/utils/date.d.ts +3 -0
- package/dist/types/lib/utils/event.d.ts +13 -0
- package/dist/types/lib/utils/index.d.ts +5 -0
- package/dist/types/lib/utils/permission.d.ts +3 -0
- package/dist/types/lib/utils/validation.d.ts +2 -0
- package/package.json +54 -0
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { DatePickerProps } from '@box/blueprint-web';
|
|
3
|
+
import { FetchedAvatarUrls, UserContactType } from '@box/user-selector';
|
|
4
|
+
/**
|
|
5
|
+
* The date value type returned from the DatePicker component.
|
|
6
|
+
*/
|
|
7
|
+
export type DateValue = Parameters<DatePickerProps['onChange']>[0];
|
|
8
|
+
/**
|
|
9
|
+
* Modal dialogs used in the Unified Share Modal. Only one modal is open at a time.
|
|
10
|
+
*
|
|
11
|
+
* - `unified-share-form` - The sharing form where users can invite collaborators and manage shared links
|
|
12
|
+
* - `shared-link-settings` - A focused view for configuring the shared link settings and permissions
|
|
13
|
+
* - `remove-shared-link` - A confirmation view for removing an existing shared link
|
|
14
|
+
*/
|
|
15
|
+
export type ModalViewType = 'unified-share-form' | 'shared-link-settings' | 'remove-shared-link';
|
|
16
|
+
/**
|
|
17
|
+
* View states of the sharing form in the Unified Share Modal.
|
|
18
|
+
*
|
|
19
|
+
* - `default` - The initial view which displays the collaboration and shared link sections
|
|
20
|
+
* - `invite` - An expanded view of the collaboration section used for inviting collaborators
|
|
21
|
+
* - `email` - An expanded view of the collaboration section used for emailing the shared link
|
|
22
|
+
* - `collaborators` - A separate view for displaying the list of collaborators on the item
|
|
23
|
+
*/
|
|
24
|
+
export type ShareViewType = 'default' | 'invite' | 'email' | 'collaborators';
|
|
25
|
+
/**
|
|
26
|
+
* Supported success and error notifications when the user performs sharing actions.
|
|
27
|
+
*/
|
|
28
|
+
export type NotificationType = 'invite-collaborators' | 'create-shared-link' | 'delete-shared-link' | 'update-shared-link' | 'email-shared-link' | 'auto-copy-shared-link';
|
|
29
|
+
/**
|
|
30
|
+
* Supported roles for inviting a new collaborator. The available roles are dependent on the Enterprise settings.
|
|
31
|
+
*
|
|
32
|
+
* The `owner` role is not supported when inviting a new collaborator.
|
|
33
|
+
*/
|
|
34
|
+
export type InvitationRole = 'co_owner' | 'editor' | 'previewer' | 'previewer_uploader' | 'uploader' | 'viewer' | 'viewer_uploader';
|
|
35
|
+
/**
|
|
36
|
+
* Supported access levels for a shared link. The allowed access levels are dependent on the Enterprise settings.
|
|
37
|
+
*/
|
|
38
|
+
export type AccessLevelType = 'open' | 'company' | 'collaborators';
|
|
39
|
+
/**
|
|
40
|
+
* Shield policies that restrict access or permissions on the item.
|
|
41
|
+
*/
|
|
42
|
+
export type ShieldPolicyType = 'access_policy' | 'malicious_content' | 'information_barrier';
|
|
43
|
+
/**
|
|
44
|
+
* Supported item types in the Unified Share Modal.
|
|
45
|
+
*/
|
|
46
|
+
export type ItemType = 'file' | 'folder' | 'hubs' | 'web_link';
|
|
47
|
+
export interface Item {
|
|
48
|
+
/**
|
|
49
|
+
* The ID of the item.
|
|
50
|
+
*/
|
|
51
|
+
id: string;
|
|
52
|
+
/**
|
|
53
|
+
* The name of the item.
|
|
54
|
+
*/
|
|
55
|
+
name: string;
|
|
56
|
+
/**
|
|
57
|
+
* The permissions that the current user has for the item.
|
|
58
|
+
*/
|
|
59
|
+
permissions?: {
|
|
60
|
+
/**
|
|
61
|
+
* When `true`, the user can invite collaborators on the item.
|
|
62
|
+
*/
|
|
63
|
+
canInviteCollaborator?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* When `true`, the user can change the access level of the shared link.
|
|
66
|
+
*/
|
|
67
|
+
canSetShareAccess?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* When `true`, the user can create a shared link for the item.
|
|
70
|
+
*/
|
|
71
|
+
canShare?: boolean;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* The type of the item.
|
|
75
|
+
*/
|
|
76
|
+
type: ItemType;
|
|
77
|
+
}
|
|
78
|
+
export interface User {
|
|
79
|
+
/**
|
|
80
|
+
* The ID of the user.
|
|
81
|
+
*
|
|
82
|
+
* Used with `Collaborator.userId` to exclude the current user in the "Shared with ..." list of avatars.
|
|
83
|
+
*/
|
|
84
|
+
id: string;
|
|
85
|
+
/**
|
|
86
|
+
* The enterprise of the user.
|
|
87
|
+
*/
|
|
88
|
+
enterprise?: Enterprise;
|
|
89
|
+
}
|
|
90
|
+
export interface Enterprise {
|
|
91
|
+
/**
|
|
92
|
+
* The name of the enterprise.
|
|
93
|
+
*
|
|
94
|
+
* Used to display the enterprise name in the access level dropdown menu options.
|
|
95
|
+
*/
|
|
96
|
+
name?: string;
|
|
97
|
+
}
|
|
98
|
+
export interface Permissions {
|
|
99
|
+
canChangeDownload?: boolean;
|
|
100
|
+
canChangeExpiration?: boolean;
|
|
101
|
+
canChangePassword?: boolean;
|
|
102
|
+
canChangeVanityName?: boolean;
|
|
103
|
+
isDownloadAvailable?: boolean;
|
|
104
|
+
isDownloadEnabled?: boolean;
|
|
105
|
+
isPasswordAvailable?: boolean;
|
|
106
|
+
isPasswordEnabled?: boolean;
|
|
107
|
+
isVanityNameAvailable?: boolean;
|
|
108
|
+
}
|
|
109
|
+
export interface SharedLink {
|
|
110
|
+
access?: AccessLevelType;
|
|
111
|
+
accessLevels?: (AccessLevel | AccessLevelType)[];
|
|
112
|
+
expiresAt?: number;
|
|
113
|
+
permissions?: Permissions;
|
|
114
|
+
url: string;
|
|
115
|
+
vanityDomain?: string;
|
|
116
|
+
vanityName?: string;
|
|
117
|
+
}
|
|
118
|
+
export interface AccessLevel {
|
|
119
|
+
/**
|
|
120
|
+
* The description for the access level. Each access level has a default description.
|
|
121
|
+
*/
|
|
122
|
+
description?: string;
|
|
123
|
+
/**
|
|
124
|
+
* The policy reason for disabling the option when selecting an access level.
|
|
125
|
+
*/
|
|
126
|
+
disabledReason?: ShieldPolicyType;
|
|
127
|
+
/**
|
|
128
|
+
* The ID of the access level. The value must be one of the allowed access levels within the Enterprise.
|
|
129
|
+
*/
|
|
130
|
+
id: AccessLevelType;
|
|
131
|
+
/**
|
|
132
|
+
* The label for the access level. Each access level has a default label.
|
|
133
|
+
*/
|
|
134
|
+
label?: string;
|
|
135
|
+
}
|
|
136
|
+
export interface Collaborator {
|
|
137
|
+
/**
|
|
138
|
+
* The URL to the profile picture of the collaborator.
|
|
139
|
+
*/
|
|
140
|
+
avatarUrl?: string;
|
|
141
|
+
/**
|
|
142
|
+
* The email address of the collaborator.
|
|
143
|
+
*/
|
|
144
|
+
email?: string;
|
|
145
|
+
/**
|
|
146
|
+
* The expiration date on the avatar badge to indicate when the collaborator loses access to the item.
|
|
147
|
+
*
|
|
148
|
+
* - `number` - The value is treated as a timestamp and will be converted to a localized date string.
|
|
149
|
+
* - `string` - The value is treated as a localized date string and will be used without transformation.
|
|
150
|
+
*/
|
|
151
|
+
expiresAt?: number | string;
|
|
152
|
+
/**
|
|
153
|
+
* When `false`, the avatar will show the collaborator's first initial instead of the profile picture.
|
|
154
|
+
*
|
|
155
|
+
* Used to prevent showing the default profile picture.
|
|
156
|
+
*/
|
|
157
|
+
hasCustomAvatar?: boolean;
|
|
158
|
+
/**
|
|
159
|
+
* When `true`, the collaborator's role is treated as a localized string and will be used without transformation.
|
|
160
|
+
*/
|
|
161
|
+
hasCustomRole?: boolean;
|
|
162
|
+
/**
|
|
163
|
+
* The ID of the collaboration record for the item. This is different than the User ID.
|
|
164
|
+
*/
|
|
165
|
+
id: string;
|
|
166
|
+
/**
|
|
167
|
+
* When `true`, the collaborator does not appear in the "Shared with ..." list of avatars.
|
|
168
|
+
*/
|
|
169
|
+
isCurrentUser?: boolean;
|
|
170
|
+
/**
|
|
171
|
+
* When `true`, there is an avatar badge indicating the collaborator is external to the enterprise.
|
|
172
|
+
*/
|
|
173
|
+
isExternal?: boolean;
|
|
174
|
+
/**
|
|
175
|
+
* When `true`, the collaborator's role is displayed as "Pending" in the list of collaborators.
|
|
176
|
+
*
|
|
177
|
+
* Used when the collaborator has not accepted or declined the collaboration invite.
|
|
178
|
+
*/
|
|
179
|
+
isPending?: boolean;
|
|
180
|
+
/**
|
|
181
|
+
* The name of the collaborator.
|
|
182
|
+
*/
|
|
183
|
+
name: string;
|
|
184
|
+
/**
|
|
185
|
+
* The role of the collaborator. The value must be one of the supported roles within the Enterprise.
|
|
186
|
+
*
|
|
187
|
+
* Can be used with `hasCustomRole` to support custom collaboration roles.
|
|
188
|
+
*/
|
|
189
|
+
role: InvitationRole | 'owner' | string;
|
|
190
|
+
/**
|
|
191
|
+
* The user ID of the collaborator. Alternative method to using the `isCurrentUser` property.
|
|
192
|
+
*
|
|
193
|
+
* Used with `currentUser.id` to exclude the current user in the "Shared with ..." list of avatars.
|
|
194
|
+
*/
|
|
195
|
+
userId?: string;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Collaboration roles available to the user to choose from when inviting a new collaborator.
|
|
199
|
+
*
|
|
200
|
+
* These roles are dependent on the Item type and Enterprise settings.
|
|
201
|
+
*
|
|
202
|
+
* See https://support.box.com/hc/en-us/articles/360044196413-Understanding-Collaborator-Permission-Levels
|
|
203
|
+
*/
|
|
204
|
+
export interface CollaborationRole {
|
|
205
|
+
/**
|
|
206
|
+
* The description for the role. Supported roles have default descriptions.
|
|
207
|
+
*/
|
|
208
|
+
description?: string;
|
|
209
|
+
/**
|
|
210
|
+
* The ID of the role. The value must be one of the supported roles within the Enterprise.
|
|
211
|
+
*
|
|
212
|
+
* If the value does not match a supported role, the role is treated as a custom collaboration role.
|
|
213
|
+
*/
|
|
214
|
+
id: InvitationRole | string;
|
|
215
|
+
/**
|
|
216
|
+
* When `true`, the role will be the default selected collaboration role.
|
|
217
|
+
*/
|
|
218
|
+
isDefault?: boolean;
|
|
219
|
+
/**
|
|
220
|
+
* When `true`, the role will be disabled when selecting a collaboration role.
|
|
221
|
+
*/
|
|
222
|
+
isDisabled?: boolean;
|
|
223
|
+
/**
|
|
224
|
+
* The label for the role. Supported roles have default labels.
|
|
225
|
+
*/
|
|
226
|
+
label?: string;
|
|
227
|
+
}
|
|
228
|
+
export interface EventService {
|
|
229
|
+
onCollaboratorsClick?: () => void;
|
|
230
|
+
onCollaboratorsManageClick?: () => void;
|
|
231
|
+
onSharedLinkSettingsClick?: () => void;
|
|
232
|
+
onSharedLinkSettingsClose?: () => void;
|
|
233
|
+
onSharedLinkSettingsLoad?: () => void;
|
|
234
|
+
}
|
|
235
|
+
export interface ContactService {
|
|
236
|
+
getContactByEmail?: (email: string) => Promise<UserContactType | void>;
|
|
237
|
+
getContacts?: (query: string) => Promise<UserContactType[]>;
|
|
238
|
+
getContactsAvatarUrls?: (userContacts: UserContactType[]) => Promise<FetchedAvatarUrls>;
|
|
239
|
+
}
|
|
240
|
+
export interface SharingService {
|
|
241
|
+
sendInvites?: () => Promise<SharingResponse | void>;
|
|
242
|
+
sendSharedLink?: () => Promise<SharingResponse | void>;
|
|
243
|
+
createSharedLink?: () => Promise<SharingResponse | void>;
|
|
244
|
+
deleteSharedLink?: () => Promise<SharingResponse | void>;
|
|
245
|
+
updateSharedLink?: () => Promise<SharingResponse | void>;
|
|
246
|
+
changeSharedLinkAccess?: (access: AccessLevelType) => Promise<void>;
|
|
247
|
+
changeSharedLinkPermission?: () => Promise<void>;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Response structure for sharing actions in the Unified Share Modal.
|
|
251
|
+
*/
|
|
252
|
+
export interface SharingResponse {
|
|
253
|
+
/**
|
|
254
|
+
* Notifications displayed after the user performs sharing actions. If omitted, the default notifications are displayed to the user.
|
|
255
|
+
*/
|
|
256
|
+
messages?: Array<{
|
|
257
|
+
text: string;
|
|
258
|
+
type: 'success' | 'error';
|
|
259
|
+
[key: string]: string;
|
|
260
|
+
}>;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Error structure for sharing actions in the Unified Share Modal.
|
|
264
|
+
*/
|
|
265
|
+
export interface SharingError {
|
|
266
|
+
/**
|
|
267
|
+
* Error messages for form fields after the user performs sharing actions.
|
|
268
|
+
*/
|
|
269
|
+
fields?: {
|
|
270
|
+
/**
|
|
271
|
+
* The key must be a field on the collaboration form or link settings form.
|
|
272
|
+
*/
|
|
273
|
+
[key: string]: string;
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
export interface LinkSettingsFormData {
|
|
277
|
+
expiration?: DateValue;
|
|
278
|
+
isDownloadEnabled: boolean;
|
|
279
|
+
isExpirationEnabled: boolean;
|
|
280
|
+
isPasswordEnabled: boolean;
|
|
281
|
+
isVanityEnabled: boolean;
|
|
282
|
+
password?: string;
|
|
283
|
+
vanityName?: string;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Configuration options for configuring features in the Unified Share Modal.
|
|
287
|
+
*
|
|
288
|
+
* Generally used for hiding specific sections of the sharing form.
|
|
289
|
+
*/
|
|
290
|
+
export interface Configuration {
|
|
291
|
+
/**
|
|
292
|
+
* Controls whether the collaboration section is visible to the user.
|
|
293
|
+
*
|
|
294
|
+
* @default true
|
|
295
|
+
*/
|
|
296
|
+
collaboration?: boolean;
|
|
297
|
+
/**
|
|
298
|
+
* Controls the number of contacts in the contact combobox that can be added at a time.
|
|
299
|
+
*
|
|
300
|
+
* @default 100
|
|
301
|
+
*/
|
|
302
|
+
collaborationLimit?: number;
|
|
303
|
+
/**
|
|
304
|
+
* Controls whether the collaboration message text field is visible to the user.
|
|
305
|
+
*
|
|
306
|
+
* @default true
|
|
307
|
+
*/
|
|
308
|
+
collaborationMessage?: boolean;
|
|
309
|
+
/**
|
|
310
|
+
* Inline notices to display in the collaboration section.
|
|
311
|
+
*
|
|
312
|
+
* There are no inline notices by default.
|
|
313
|
+
*/
|
|
314
|
+
collaborationNotices?: ReactElement | ReactElement[];
|
|
315
|
+
/**
|
|
316
|
+
* Controls whether the collaboration role is visible to the user.
|
|
317
|
+
*
|
|
318
|
+
* @default true
|
|
319
|
+
*/
|
|
320
|
+
collaborationRole?: boolean;
|
|
321
|
+
/**
|
|
322
|
+
* Controls whether the "Shared with ..." list of avatars is visible to the user.
|
|
323
|
+
*
|
|
324
|
+
* @default true
|
|
325
|
+
*/
|
|
326
|
+
collaborators?: boolean;
|
|
327
|
+
/**
|
|
328
|
+
* Controls the number of collaborators that are displayed in the list of collaborators.
|
|
329
|
+
*
|
|
330
|
+
* @default 100
|
|
331
|
+
*/
|
|
332
|
+
collaboratorsLimit?: number;
|
|
333
|
+
/**
|
|
334
|
+
* Controls whether the "Manage All" link is visible to the user.
|
|
335
|
+
*
|
|
336
|
+
* @default true
|
|
337
|
+
*/
|
|
338
|
+
collaboratorsManagement?: boolean;
|
|
339
|
+
/**
|
|
340
|
+
* Controls which notification types are displayed after sharing related actions.
|
|
341
|
+
*
|
|
342
|
+
* All notifications are enabled by default.
|
|
343
|
+
*/
|
|
344
|
+
notifications?: NotificationType[];
|
|
345
|
+
/**
|
|
346
|
+
* Controls whether the shared link section is visible to the user.
|
|
347
|
+
*
|
|
348
|
+
* @default true
|
|
349
|
+
*/
|
|
350
|
+
sharedLink?: boolean;
|
|
351
|
+
/**
|
|
352
|
+
* Controls whether the shared link access level is visible to the user.
|
|
353
|
+
*
|
|
354
|
+
* @default true
|
|
355
|
+
*/
|
|
356
|
+
sharedLinkAccess?: boolean;
|
|
357
|
+
/**
|
|
358
|
+
* Controls whether the shared link is automatically copied on load.
|
|
359
|
+
*
|
|
360
|
+
* @default false
|
|
361
|
+
*/
|
|
362
|
+
sharedLinkAutoCopy?: boolean;
|
|
363
|
+
/**
|
|
364
|
+
* Controls whether the shared link is automatically created on load.
|
|
365
|
+
*
|
|
366
|
+
* @default false
|
|
367
|
+
*/
|
|
368
|
+
sharedLinkAutoCreate?: boolean;
|
|
369
|
+
/**
|
|
370
|
+
* Controls whether the button to email a shared link is visible to the user.
|
|
371
|
+
*
|
|
372
|
+
* @default true
|
|
373
|
+
*/
|
|
374
|
+
sharedLinkEmail?: boolean;
|
|
375
|
+
/**
|
|
376
|
+
* Controls whether the shared link permission level is visible to the user.
|
|
377
|
+
*
|
|
378
|
+
* @default true
|
|
379
|
+
*/
|
|
380
|
+
sharedLinkPermission?: boolean;
|
|
381
|
+
/**
|
|
382
|
+
* Controls whether the "Link Settings" button is visible to the user.
|
|
383
|
+
*
|
|
384
|
+
* @default true
|
|
385
|
+
*/
|
|
386
|
+
sharedLinkSettings?: boolean;
|
|
387
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { CollaborationRole, Collaborator, Configuration, ContactService, EventService, Item, SharedLink, SharingService, User } from './types';
|
|
3
|
+
export interface UnifiedShareModalProps {
|
|
4
|
+
children?: ReactElement;
|
|
5
|
+
collaborationRoles?: CollaborationRole[];
|
|
6
|
+
collaborators?: Collaborator[];
|
|
7
|
+
config?: Configuration;
|
|
8
|
+
contactService?: ContactService;
|
|
9
|
+
currentUser?: User;
|
|
10
|
+
eventService?: EventService;
|
|
11
|
+
isFetching?: boolean;
|
|
12
|
+
isOpen?: boolean;
|
|
13
|
+
isSubmitting?: boolean;
|
|
14
|
+
item: Item;
|
|
15
|
+
onLoad?: () => Promise<void>;
|
|
16
|
+
onOpenChange?: (open: boolean) => void;
|
|
17
|
+
sharedLink?: SharedLink;
|
|
18
|
+
sharingService?: SharingService;
|
|
19
|
+
}
|
|
20
|
+
export declare function UnifiedShareModal({ children, collaborationRoles, collaborators, config, contactService, currentUser, eventService, isFetching, isOpen, isSubmitting, item, onLoad, onOpenChange, sharedLink, sharingService, }: UnifiedShareModalProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AvatarProps, IconBadgeProps } from '@box/blueprint-web';
|
|
2
|
+
import { CollaborationRole, Collaborator } from '../types';
|
|
3
|
+
declare const getAvatarBadgeSize: (size: AvatarProps["size"]) => IconBadgeProps["size"];
|
|
4
|
+
declare const getDefaultCollaborationRole: (collaborationRoles?: CollaborationRole[]) => CollaborationRole;
|
|
5
|
+
declare const getFirstInitial: (name: string) => string;
|
|
6
|
+
declare const isCollaboratorRoleSupported: (role: Collaborator["role"]) => boolean;
|
|
7
|
+
declare const isInvitationRoleSupported: (role: CollaborationRole["id"]) => boolean;
|
|
8
|
+
export { getAvatarBadgeSize, getDefaultCollaborationRole, getFirstInitial, isCollaboratorRoleSupported, isInvitationRoleSupported, };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const formatDateFromTimestampToCalendarDate: (timestamp: number) => import('@internationalized/date').CalendarDate;
|
|
2
|
+
export declare const formatDateFromTimestampToDateString: (timestamp: number) => string;
|
|
3
|
+
export declare const formatTomorrowDateToCalendarDate: () => import('@internationalized/date').CalendarDate;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Triggers actions on specific keyboard events.
|
|
3
|
+
* Use appropriate and accessible design patterns for keyboard interactions.
|
|
4
|
+
*
|
|
5
|
+
* See https://www.w3.org/WAI/ARIA/apg/patterns/
|
|
6
|
+
*/
|
|
7
|
+
declare const callOnKeyboardEvent: (callback: any, options?: {
|
|
8
|
+
args?: unknown[];
|
|
9
|
+
canPreventDefault?: boolean;
|
|
10
|
+
canStopPropagation?: boolean;
|
|
11
|
+
keys?: string[];
|
|
12
|
+
}) => (event: any) => void;
|
|
13
|
+
export { callOnKeyboardEvent };
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@box/unified-share-modal",
|
|
3
|
+
"version": "0.45.1",
|
|
4
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
5
|
+
"peerDependencies": {
|
|
6
|
+
"@box/blueprint-web": "^9.18.13",
|
|
7
|
+
"@box/blueprint-web-assets": "^4.37.0",
|
|
8
|
+
"@box/copy-input": "^0.9.0",
|
|
9
|
+
"@box/user-selector": "^0.47.1",
|
|
10
|
+
"lodash": "^4.17.15",
|
|
11
|
+
"react": "^18.0.0",
|
|
12
|
+
"react-dom": "^18.0.0",
|
|
13
|
+
"react-intl": "^6.4.2"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@box/blueprint-web": "^12.68.2",
|
|
17
|
+
"@box/blueprint-web-assets": "^4.66.0",
|
|
18
|
+
"@box/copy-input": "^0.21.12",
|
|
19
|
+
"@box/storybook-utils": "0.14.2",
|
|
20
|
+
"@box/eslint-plugin-blueprint": "1.0.4",
|
|
21
|
+
"react-intl": "^6.4.2"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@xstate/store": "3.4.2"
|
|
25
|
+
},
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist"
|
|
31
|
+
],
|
|
32
|
+
"main": "./dist/esm/index.js",
|
|
33
|
+
"module": "./dist/esm/index.js",
|
|
34
|
+
"types": "./dist/types/index.d.ts",
|
|
35
|
+
"exports": {
|
|
36
|
+
".": {
|
|
37
|
+
"require": "./dist/esm/index.js",
|
|
38
|
+
"import": "./dist/esm/index.js",
|
|
39
|
+
"types": "./dist/types/index.d.ts"
|
|
40
|
+
},
|
|
41
|
+
"./*": {
|
|
42
|
+
"require": "./dist/esm/*",
|
|
43
|
+
"import": "./dist/esm/*",
|
|
44
|
+
"types": "./dist/types/*"
|
|
45
|
+
},
|
|
46
|
+
"./i18n/*": {
|
|
47
|
+
"require": "./dist/i18n/*",
|
|
48
|
+
"import": "./dist/i18n/*"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"sideEffects": [
|
|
52
|
+
"**/*.css"
|
|
53
|
+
]
|
|
54
|
+
}
|