Note: This component is designed for internal Atlassian development.
External contributors will be able to use this component but will not be able to submit issues.
Note: This component is currently in developer preview.
Please experiment with and test this package, but be aware that the API may change at any time. Use at your own risk, preferably not in production.
This package provides the view components allowing users to share a resource by
sharing with User Picker, or by copying the share link.
The goal is to provide a consistent share experience across products.
Usage
Import the component in your React app as follows:
importShareDialogContainerfrom '@atlaskit/share;
Example
Share Component
Options
Recipient controls
Product (groups are not enabled in Jira)
confluence
Is Browse Users Disabled(if true, only emails can be selected)
Share config (controls whether emails are available)
Email sharing allowed
Features controls
Enable Integration Tabs
Enable Additional Tabs
Enable Integration Split Button
Enable Integration Menu Button
Is Public Link
Is Copy Disabled
Custom UI components
Custom Share Dialog Trigger Button
Custom Share Dialog Title
Custom Share Form Helper Message
Custom Trigger Button Tooltip Text
Custom Trigger Button Icon
Show Restriction Message
Custom Footer
Share Fields Footer
URL shortening
Use URL shortener
Use URL shortener legacy API
Auto open dialog
Core behavioural settings
Enable Smart User Picker
Dialog Placement
bottom-start
Close Share Dialog on escape key press
Trigger Button Style
icon-only
Trigger Button Appearance
default
Trigger Button Tooltip Position
top
Locale
en-US
Share Props
onTriggerButtonClickfunction
Callback function to be called on trigger button click.
() => undefined
onDialogOpenfunction
Callback function to be called on dialog open.
() => undefined
onDialogClosefunction
Callback function to be called on dialog close.
() => undefined
isAutoOpenDialogboolean
Allow the share dialog to be opened via a Prop.
shareClientobject
Share service client implementation that gets share configs and performs share.
Optional, a default one is provided.
share requiredfunction
content,
recipients,
metadata,
comment
=> Promise
shareRequestId string required
getConfig function requiredcloudId => Promise
disableSharingToEmails boolean
urlShortenerClientobject
URL Shortener service client implementation that may shorten links for copy.
Optional, a default one is provided.
shorten function requireddata => Promise
shortUrl string required
shortLinkDataobject
Data provided to the urlShortenerClient to shorten the shared URL.
If it is not provided, the link will not be shortened.
If link shortening fails, the full URL will be shared instead.
cloudId string
product string required
type string required
params requiredRecordstring, string
originId string
cloudIdstring required
Cloud ID of the instance.
Note: we assume this props is stable.
orgIdstring
Organisation ID of the instance.
dialogPlacementimport
Placement of the modal to the trigger button.
@atlaskit/popper.Placement
dialogZIndexnumber
Z-index that the popup should be displayed in.
This is passed to the portal component.
Defaults to layers.modal() from @atlaskit/theme.
formatCopyLinkfunction
Transform function to provide custom formatted copy link.
Optional, a default one is provided.
function
origin,
link
=> string
loadUserOptionsimport
Function used to load users options asynchronously. Not needed if smart user picker is enabled.
@atlaskit/smart-user-picker.LoadOptions
originTracingFactoryfunction required
Factory function to generate new Origin Tracing instance.
=>
id string required
addToUrl requiredlink => string
toAnalyticsAttributes requiredattrs => One of
originIdGenerated string required
originProduct string required
,
originId string required
originProduct string required
productIdunion required
Product ID (Canonical ID) in ARI of the share request.
Note: we assume this props is stable.
One of
"bitbucket",
"confluence",
"jira-addon",
"jira-core",
"jira-platform",
"jira-polaris",
"jira-portfolio",
"jira-servicedesk",
"jira-software",
"jira-unknown",
"trello"
renderCustomTriggerButtonfunction
Render function for a custom Share Dialog Trigger Button.
function
args,
triggerProps
=> React.ReactNode
shareAristring required
Atlassian Resource Identifier of a Site resource to be shared.
shareContentTypestring required
Content Type of the resource to be shared. It will also affect on the successful share message in the flag. A pre-defined list as follows:
blogpost
board
calendar
draft
filter
issue
media
page
project
pullrequest
question
report
repository
request
roadmap
site
space
Any other unlisted type will have a default message of "Link shared".
shareContentSubTypestring
Content SubType of the resource to be shared. Optional.
embed
shareContentIdstring
Content ID of the resource to be shared. Optional.
shareLinkstring
Link of the resource to be shared (should NOT includes origin tracing).
Optional, the current page URL is used by default.
shareTitlestring required
Title of the resource to be shared that will be sent in notifications.
shareFormTitleReact.ReactNode
Title of the share modal.
React.ReactNode
shareFormHelperMessagestring
Copy for helper message to be displayed under share form input box.
If set to empty string, no helper message will be displayed
shouldCloseOnEscapePressboolean
To enable closing the modal on escape key press.
showFlagsfunction required
Callback function for showing successful share flag(s) with a parameter providing details of the flag, including the type of the message with a localized default title
This package has an opinion on showing flag(s) upon successful share, and Flag system is NOT provided. Instead, showFlag prop is available for this purpose.
flags => undefined
enableSmartUserPickerboolean = false
Power the user picker with smarts. To enable smart user picker, the following props are used:
product: 'jira' or 'confluence'
loggedInAccountId: if not provided, defaults to obtaining from request context
cloudId
loggedInAccountIdstring
The userId of the sharer. If not provided, smart user picker
defaults it to the value 'Context'
which will tell the recommendation service to extract the
value from the request context.
triggerButtonAppearanceimport
Appearance of the share modal trigger button
undefined.IconButtonProps['appearance']
triggerButtonIconReact.ComponentType<import>
Share button Icon
React.ComponentType@atlaskit/icon.IconProps
triggerButtonStyleunion
Style of the share modal trigger button.
One of
"icon-only",
"icon-with-text",
"text-only"
triggerButtonTooltipPositionunion
Position of the tooltip on share modal trigger button.
One of
"top",
"right",
"bottom",
"left",
"mouse"
triggerButtonTooltipTextReact.ReactNode
Custom text of the tooltip on share modal trigger button.
React.ReactNode
bottomMessageReact.ReactNode
Message to be appended to the modal.
React.ReactNode
useUrlShortenerboolean deprecated
Use the shortLinkData prop instead.
*
Whether we should use the Atlassian Url Shortener or not.
Note that all products may not be supported.
shareeActionunion = "view"
Action that will be performed by the recipient when he/she receives the notification.
One of
"view",
"edit"
productunion = "confluence"
Optional, this prop can be jira or confluence. Default value is confluence.
We use this prop to control different text messages in UI.
One of
"jira",
"confluence"
productAttributesimport
attributes that apply to the product
undefined.Props['productAttributes']
customHeaderReact.ReactNode
Header for the share dialog.
React.ReactNode
customFooterReact.ReactNode
Footer for the share dialog.
React.ReactNode
userPickerOptionsintersection
common Props to pass to userPicker
Pick@atlaskit/smart-user-picker.Props, One of
"onFocus",
"header",
"includeNonLicensedUsers"
&
noOptionsMessageHandler union One of
value => One of
string,
null,
React.ReactNode
,
null
getPlaceholderMessagefunction
allowEmail,
isBrowseUsersDisabled
=> react-intl-next.MessageDescriptor
getLabelMessagefunction
allowEmail,
isBrowseUsersDisabled
=> react-intl-next.MessageDescriptor
getRequiredMessagefunction
allowEmail,
isBrowseUsersDisabled
=> react-intl-next.MessageDescriptor
onUserSelectionChangefunction
Callback function to be called on user selection change in the share form.
value => undefined
shareFieldsFooterReact.ReactNode
Footer component to display under the share form fields.
React.ReactNode
isCopyDisabledboolean
Indicates if the copy link and share link are disabled
isPublicLinkboolean
Indicates if the link shared publicly accessible
integrationModeunion
Indicates the mode for integrations to be displayed
One of
"tabs",
"split",
"menu",
"off"
isMenuItemSelectedboolean
Indicates if the menu item was clicked when 'integrationMode=menu' is active
shareIntegrationsArray<object>
List of share integrations
Array
type string required
Icon requiredReact.ComponentType
Content requiredReact.ComponentType
onClose required() => undefined
changeTabindex => undefined
additionalTabsArray<object>
List of additional tabs to be displayed
Array
label string required
Content requiredReact.ComponentType
onClose required() => undefined
changeTabindex => undefined
builtInTabContentWidthnumber
Content container width used by built-in tabs
tabIndexnumber
Optionally sets a tabIndex value if you need to set focus
copyTooltipTextstring
If present, will add a tooltip to the copy link and display link tooltip text
isBrowseUsersDisabledboolean
disable looking up users and teams
workspaceAristring
Atlassian resource identifier of the workspace initiating the share
isSubmitShareDisabledboolean
Indicates if share submit button is disabled
Notes
The share modal will be instantiated immediately but starts hidden.
It will retain the form state until the user either:
triggers a share = share completed
presses Esc = share cancelled
A click outside the modal will hide it, but the form state will be retained (as long as the share is not cancelled).