@atlaskit/share 4.12.3 → 4.14.0

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 (39) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/components/LazyShareForm/LazyShareForm.js +4 -2
  3. package/dist/cjs/components/ShareDialogContainer.js +4 -2
  4. package/dist/cjs/components/ShareDialogWithTrigger.js +4 -2
  5. package/dist/cjs/components/ShareForm.js +4 -2
  6. package/dist/cjs/components/UserPickerField.js +20 -8
  7. package/dist/cjs/components/analytics/analytics.js +1 -1
  8. package/dist/cjs/types/UserPickerOptions.js +5 -0
  9. package/dist/es2019/components/LazyShareForm/LazyShareForm.js +4 -2
  10. package/dist/es2019/components/ShareDialogContainer.js +4 -2
  11. package/dist/es2019/components/ShareDialogWithTrigger.js +4 -2
  12. package/dist/es2019/components/ShareForm.js +4 -2
  13. package/dist/es2019/components/UserPickerField.js +23 -8
  14. package/dist/es2019/components/analytics/analytics.js +1 -1
  15. package/dist/es2019/types/UserPickerOptions.js +1 -0
  16. package/dist/esm/components/LazyShareForm/LazyShareForm.js +4 -2
  17. package/dist/esm/components/ShareDialogContainer.js +4 -2
  18. package/dist/esm/components/ShareDialogWithTrigger.js +4 -2
  19. package/dist/esm/components/ShareForm.js +4 -2
  20. package/dist/esm/components/UserPickerField.js +20 -8
  21. package/dist/esm/components/analytics/analytics.js +1 -1
  22. package/dist/esm/types/UserPickerOptions.js +1 -0
  23. package/dist/types/components/LazyShareForm/LazyShareForm.d.ts +1 -1
  24. package/dist/types/components/ShareDialogContainer.d.ts +1 -1
  25. package/dist/types/components/UserPickerField.d.ts +2 -1
  26. package/dist/types/types/ShareDialogContainer.d.ts +2 -0
  27. package/dist/types/types/ShareDialogWithTrigger.d.ts +1 -1
  28. package/dist/types/types/ShareForm.d.ts +1 -1
  29. package/dist/types/types/UserPickerOptions.d.ts +13 -0
  30. package/dist/types/types/index.d.ts +1 -0
  31. package/dist/types-ts4.5/components/LazyShareForm/LazyShareForm.d.ts +1 -1
  32. package/dist/types-ts4.5/components/ShareDialogContainer.d.ts +1 -1
  33. package/dist/types-ts4.5/components/UserPickerField.d.ts +2 -1
  34. package/dist/types-ts4.5/types/ShareDialogContainer.d.ts +2 -0
  35. package/dist/types-ts4.5/types/ShareDialogWithTrigger.d.ts +1 -1
  36. package/dist/types-ts4.5/types/ShareForm.d.ts +1 -1
  37. package/dist/types-ts4.5/types/UserPickerOptions.d.ts +13 -0
  38. package/dist/types-ts4.5/types/index.d.ts +1 -0
  39. package/package.json +5 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/share
2
2
 
3
+ ## 4.14.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#72864](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/72864) [`967b26e5f6b8`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/967b26e5f6b8) - [ux] Added new `userPickerCustomHeader` and `noOptionsMessage` prop to Share Dialog. `userPickerCustomHeader` adds custom header to User Picker Option List and `noOptionsMessage` renders a custom message when the user picker returns an empty options list.
8
+
9
+ ## 4.13.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#71584](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/71584) [`7962a0e6599c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/7962a0e6599c) - [ux] Added new `userPickerCustomHeader` and `noOptionsMessage` prop to Share Dialog. `userPickerCustomHeader` adds custom header to User Picker Option List and `noOptionsMessage` renders a custom message when the user picker returns an empty options list.
14
+
3
15
  ## 4.12.3
4
16
 
5
17
  ### Patch Changes
@@ -59,7 +59,8 @@ function LazyShareForm(props) {
59
59
  defaultValue = props.defaultValue,
60
60
  showTitle = props.showTitle,
61
61
  orgId = props.orgId,
62
- isBrowseUsersDisabled = props.isBrowseUsersDisabled;
62
+ isBrowseUsersDisabled = props.isBrowseUsersDisabled,
63
+ userPickerOptions = props.userPickerOptions;
63
64
  var footer = (0, _react2.jsx)("div", null, bottomMessage ? (0, _react2.jsx)("div", {
64
65
  css: {
65
66
  width: "".concat((0, _constants.gridSize)() * 44, "px")
@@ -115,7 +116,8 @@ function LazyShareForm(props) {
115
116
  onUserSelectionChange: onUserSelectionChange,
116
117
  handleCloseDialog: onDialogClose,
117
118
  onTabChange: onTabChange,
118
- isBrowseUsersDisabled: isBrowseUsersDisabled
119
+ isBrowseUsersDisabled: isBrowseUsersDisabled,
120
+ userPickerOptions: userPickerOptions
119
121
  }) : (0, _react2.jsx)("p", null, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _i18n.messages.formNoPermissions))));
120
122
  }
121
123
  var _default = exports.default = LazyShareForm;
@@ -357,7 +357,8 @@ var ShareDialogContainerInternal = exports.ShareDialogContainerInternal = /*#__P
357
357
  tabIndex = _this$props2.tabIndex,
358
358
  copyTooltipText = _this$props2.copyTooltipText,
359
359
  onDialogClose = _this$props2.onDialogClose,
360
- isBrowseUsersDisabled = _this$props2.isBrowseUsersDisabled;
360
+ isBrowseUsersDisabled = _this$props2.isBrowseUsersDisabled,
361
+ userPickerOptions = _this$props2.userPickerOptions;
361
362
  var _this$state = this.state,
362
363
  config = _this$state.config,
363
364
  isFetchingConfig = _this$state.isFetchingConfig;
@@ -405,7 +406,8 @@ var ShareDialogContainerInternal = exports.ShareDialogContainerInternal = /*#__P
405
406
  tabIndex: tabIndex,
406
407
  copyTooltipText: copyTooltipText,
407
408
  onDialogClose: onDialogClose,
408
- isBrowseUsersDisabled: isBrowseUsersDisabled
409
+ isBrowseUsersDisabled: isBrowseUsersDisabled,
410
+ userPickerOptions: userPickerOptions
409
411
  })));
410
412
  }
411
413
  }]);
@@ -514,7 +514,8 @@ var ShareDialogWithTriggerInternal = exports.ShareDialogWithTriggerInternal = /*
514
514
  copyTooltipText = _this$props7.copyTooltipText,
515
515
  integrationMode = _this$props7.integrationMode,
516
516
  shareIntegrations = _this$props7.shareIntegrations,
517
- isBrowseUsersDisabled = _this$props7.isBrowseUsersDisabled;
517
+ isBrowseUsersDisabled = _this$props7.isBrowseUsersDisabled,
518
+ userPickerOptions = _this$props7.userPickerOptions;
518
519
  var style = typeof tabIndex !== 'undefined' && tabIndex >= 0 ? {
519
520
  outline: 'none'
520
521
  } : undefined;
@@ -569,7 +570,8 @@ var ShareDialogWithTriggerInternal = exports.ShareDialogWithTriggerInternal = /*
569
570
  //ref
570
571
  ,
571
572
  selectPortalRef: _this2.selectPortalRef,
572
- isBrowseUsersDisabled: isBrowseUsersDisabled
573
+ isBrowseUsersDisabled: isBrowseUsersDisabled,
574
+ userPickerOptions: userPickerOptions
573
575
  }));
574
576
  },
575
577
  isOpen: isDialogOpen,
@@ -98,7 +98,8 @@ var InternalForm = /*#__PURE__*/function (_React$PureComponent) {
98
98
  orgId = _this$props.orgId,
99
99
  isBrowseUsersDisabled = _this$props.isBrowseUsersDisabled,
100
100
  formatMessage = _this$props.intl.formatMessage,
101
- shareError = _this$props.shareError;
101
+ shareError = _this$props.shareError,
102
+ userPickerOptions = _this$props.userPickerOptions;
102
103
  return (0, _react2.jsx)(_analyticsNext.AnalyticsContext, {
103
104
  data: {
104
105
  source: _analytics.ANALYTICS_SOURCE
@@ -125,7 +126,8 @@ var InternalForm = /*#__PURE__*/function (_React$PureComponent) {
125
126
  helperMessage: helperMessage,
126
127
  orgId: orgId,
127
128
  isBrowseUsersDisabled: isBrowseUsersDisabled,
128
- shareError: shareError
129
+ shareError: shareError,
130
+ userPickerOptions: userPickerOptions
129
131
  })), (0, _react2.jsx)("div", {
130
132
  css: formFieldStyles
131
133
  }, (0, _react2.jsx)(_CommentField.CommentField, {
@@ -40,9 +40,16 @@ var getNoOptionsMessageDescriptor = function getNoOptionsMessageDescriptor(email
40
40
  }
41
41
  return _i18n.messages.userPickerGenericNoOptionsMessage;
42
42
  };
43
- var getNoOptionsMessage = function getNoOptionsMessage(isPublicLink, allowEmail) {
43
+ var getNoOptionsMessage = function getNoOptionsMessage(isPublicLink, allowEmail, noOptionsMessageHandler) {
44
44
  return function (_ref) {
45
45
  var inputValue = _ref.inputValue;
46
+ if (noOptionsMessageHandler) {
47
+ return noOptionsMessageHandler({
48
+ inputValue: inputValue,
49
+ isPublicLink: isPublicLink,
50
+ allowEmail: allowEmail
51
+ });
52
+ }
46
53
  return inputValue && inputValue.trim().length > 0 ? /*#__PURE__*/_react.default.createElement(_reactIntlNext.FormattedMessage, (0, _extends2.default)({}, getNoOptionsMessageDescriptor((0, _smartUserPicker.isValidEmail)(inputValue), isPublicLink, allowEmail), {
47
54
  values: {
48
55
  inputValue: inputValue
@@ -172,7 +179,8 @@ var UserPickerFieldComponent = exports.UserPickerFieldComponent = /*#__PURE__*/f
172
179
  isPublicLink = _this$props2.isPublicLink,
173
180
  orgId = _this$props2.orgId,
174
181
  isBrowseUsersDisabled = _this$props2.isBrowseUsersDisabled,
175
- shareError = _this$props2.shareError;
182
+ shareError = _this$props2.shareError,
183
+ userPickerOptions = _this$props2.userPickerOptions;
176
184
  var smartUserPickerProps = enableSmartUserPicker && !isBrowseUsersDisabled ? {
177
185
  productKey: product,
178
186
  principalId: loggedInAccountId,
@@ -184,17 +192,21 @@ var UserPickerFieldComponent = exports.UserPickerFieldComponent = /*#__PURE__*/f
184
192
  } : {};
185
193
  var allowEmail = (0, _utils.allowEmails)(config);
186
194
  var requiredMessage = getRequiredMessage(product, allowEmail, isBrowseUsersDisabled);
195
+ var _ref2 = userPickerOptions !== null && userPickerOptions !== void 0 ? userPickerOptions : {},
196
+ header = _ref2.header,
197
+ noOptionsMessageHandler = _ref2.noOptionsMessageHandler;
187
198
  var commonPickerProps = {
188
199
  fieldId: 'share',
189
200
  loadOptions: this.loadOptions,
190
201
  isMulti: true,
191
202
  width: '100%',
192
203
  allowEmail: allowEmail,
193
- noOptionsMessage: getNoOptionsMessage(isPublicLink, allowEmail),
204
+ noOptionsMessage: getNoOptionsMessage(isPublicLink, allowEmail, noOptionsMessageHandler),
194
205
  isLoading: isLoading,
195
206
  onInputChange: onInputChange,
196
207
  maxPickerHeight: _styles.MAX_PICKER_HEIGHT,
197
- textFieldBackgroundColor: true
208
+ textFieldBackgroundColor: true,
209
+ header: header
198
210
  };
199
211
  var UserPickerComponent = enableSmartUserPicker && !isBrowseUsersDisabled ? _smartUserPicker.default : _userPicker.default;
200
212
  var menuPortalTarget = (0, _utils.getMenuPortalTargetCurrentHTML)(selectPortalRef);
@@ -207,10 +219,10 @@ var UserPickerFieldComponent = exports.UserPickerFieldComponent = /*#__PURE__*/f
207
219
  defaultValue: defaultValue,
208
220
  transform: this.handleUserPickerTransform,
209
221
  isRequired: true
210
- }, function (_ref2) {
211
- var fieldProps = _ref2.fieldProps,
212
- fieldValidationError = _ref2.error,
213
- fieldValid = _ref2.meta.valid;
222
+ }, function (_ref3) {
223
+ var fieldProps = _ref3.fieldProps,
224
+ fieldValidationError = _ref3.error,
225
+ fieldValid = _ref3.meta.valid;
214
226
  var helperMessage = _this2.getHelperMessageOrDefault();
215
227
  var addMoreMessage = shareError !== null && shareError !== void 0 && shareError.errorCode ? null : intl.formatMessage(_i18n.messages.userPickerAddMoreMessage);
216
228
  var wasValidationOrShareError = !!fieldValidationError || !!shareError;
@@ -13,7 +13,7 @@ var buildAttributes = function buildAttributes() {
13
13
  var attributes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
14
14
  return _objectSpread({
15
15
  packageName: "@atlaskit/share",
16
- packageVersion: "4.12.3"
16
+ packageVersion: "4.14.0"
17
17
  }, attributes);
18
18
  };
19
19
  var createEvent = function createEvent(eventType, source, action, actionSubject, actionSubjectId) {
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -54,7 +54,8 @@ function LazyShareForm(props) {
54
54
  defaultValue,
55
55
  showTitle,
56
56
  orgId,
57
- isBrowseUsersDisabled
57
+ isBrowseUsersDisabled,
58
+ userPickerOptions
58
59
  } = props;
59
60
  const footer = jsx("div", null, bottomMessage ? jsx("div", {
60
61
  css: {
@@ -111,7 +112,8 @@ function LazyShareForm(props) {
111
112
  onUserSelectionChange: onUserSelectionChange,
112
113
  handleCloseDialog: onDialogClose,
113
114
  onTabChange: onTabChange,
114
- isBrowseUsersDisabled: isBrowseUsersDisabled
115
+ isBrowseUsersDisabled: isBrowseUsersDisabled,
116
+ userPickerOptions: userPickerOptions
115
117
  }) : jsx("p", null, jsx(FormattedMessage, messages.formNoPermissions))));
116
118
  }
117
119
  export default LazyShareForm;
@@ -303,7 +303,8 @@ export class ShareDialogContainerInternal extends React.Component {
303
303
  tabIndex,
304
304
  copyTooltipText,
305
305
  onDialogClose,
306
- isBrowseUsersDisabled
306
+ isBrowseUsersDisabled,
307
+ userPickerOptions
307
308
  } = this.props;
308
309
  const {
309
310
  config,
@@ -353,7 +354,8 @@ export class ShareDialogContainerInternal extends React.Component {
353
354
  tabIndex: tabIndex,
354
355
  copyTooltipText: copyTooltipText,
355
356
  onDialogClose: onDialogClose,
356
- isBrowseUsersDisabled: isBrowseUsersDisabled
357
+ isBrowseUsersDisabled: isBrowseUsersDisabled,
358
+ userPickerOptions: userPickerOptions
357
359
  })));
358
360
  }
359
361
  }
@@ -459,7 +459,8 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
459
459
  copyTooltipText,
460
460
  integrationMode,
461
461
  shareIntegrations,
462
- isBrowseUsersDisabled
462
+ isBrowseUsersDisabled,
463
+ userPickerOptions
463
464
  } = this.props;
464
465
  const style = typeof tabIndex !== 'undefined' && tabIndex >= 0 ? {
465
466
  outline: 'none'
@@ -514,7 +515,8 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
514
515
  //ref
515
516
  ,
516
517
  selectPortalRef: this.selectPortalRef,
517
- isBrowseUsersDisabled: isBrowseUsersDisabled
518
+ isBrowseUsersDisabled: isBrowseUsersDisabled,
519
+ userPickerOptions: userPickerOptions
518
520
  })),
519
521
  isOpen: isDialogOpen,
520
522
  onClose: this.handleCloseDialog,
@@ -102,7 +102,8 @@ class InternalForm extends React.PureComponent {
102
102
  intl: {
103
103
  formatMessage
104
104
  },
105
- shareError
105
+ shareError,
106
+ userPickerOptions
106
107
  } = this.props;
107
108
  return jsx(AnalyticsContext, {
108
109
  data: {
@@ -130,7 +131,8 @@ class InternalForm extends React.PureComponent {
130
131
  helperMessage: helperMessage,
131
132
  orgId: orgId,
132
133
  isBrowseUsersDisabled: isBrowseUsersDisabled,
133
- shareError: shareError
134
+ shareError: shareError,
135
+ userPickerOptions: userPickerOptions
134
136
  })), jsx("div", {
135
137
  css: formFieldStyles
136
138
  }, jsx(CommentField, {
@@ -22,13 +22,22 @@ const getNoOptionsMessageDescriptor = (emailValidity, isPublicLink, allowEmail)
22
22
  }
23
23
  return messages.userPickerGenericNoOptionsMessage;
24
24
  };
25
- const getNoOptionsMessage = (isPublicLink, allowEmail) => ({
25
+ const getNoOptionsMessage = (isPublicLink, allowEmail, noOptionsMessageHandler) => ({
26
26
  inputValue
27
- }) => inputValue && inputValue.trim().length > 0 ? /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, getNoOptionsMessageDescriptor(isValidEmail(inputValue), isPublicLink, allowEmail), {
28
- values: {
29
- inputValue
27
+ }) => {
28
+ if (noOptionsMessageHandler) {
29
+ return noOptionsMessageHandler({
30
+ inputValue,
31
+ isPublicLink,
32
+ allowEmail
33
+ });
30
34
  }
31
- })) : null;
35
+ return inputValue && inputValue.trim().length > 0 ? /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, getNoOptionsMessageDescriptor(isValidEmail(inputValue), isPublicLink, allowEmail), {
36
+ values: {
37
+ inputValue
38
+ }
39
+ })) : null;
40
+ };
32
41
  const getPlaceHolderMessageDescriptor = (product = 'confluence', allowEmail, isBrowseUsersDisabled) => {
33
42
  if (!allowEmail) {
34
43
  const placeholderMessage = {
@@ -136,7 +145,8 @@ export class UserPickerFieldComponent extends React.Component {
136
145
  isPublicLink,
137
146
  orgId,
138
147
  isBrowseUsersDisabled,
139
- shareError
148
+ shareError,
149
+ userPickerOptions
140
150
  } = this.props;
141
151
  const smartUserPickerProps = enableSmartUserPicker && !isBrowseUsersDisabled ? {
142
152
  productKey: product,
@@ -149,17 +159,22 @@ export class UserPickerFieldComponent extends React.Component {
149
159
  } : {};
150
160
  const allowEmail = allowEmails(config);
151
161
  const requiredMessage = getRequiredMessage(product, allowEmail, isBrowseUsersDisabled);
162
+ const {
163
+ header,
164
+ noOptionsMessageHandler
165
+ } = userPickerOptions !== null && userPickerOptions !== void 0 ? userPickerOptions : {};
152
166
  const commonPickerProps = {
153
167
  fieldId: 'share',
154
168
  loadOptions: this.loadOptions,
155
169
  isMulti: true,
156
170
  width: '100%',
157
171
  allowEmail,
158
- noOptionsMessage: getNoOptionsMessage(isPublicLink, allowEmail),
172
+ noOptionsMessage: getNoOptionsMessage(isPublicLink, allowEmail, noOptionsMessageHandler),
159
173
  isLoading,
160
174
  onInputChange: onInputChange,
161
175
  maxPickerHeight: MAX_PICKER_HEIGHT,
162
- textFieldBackgroundColor: true
176
+ textFieldBackgroundColor: true,
177
+ header
163
178
  };
164
179
  const UserPickerComponent = enableSmartUserPicker && !isBrowseUsersDisabled ? SmartUserPicker : UserPicker;
165
180
  const menuPortalTarget = getMenuPortalTargetCurrentHTML(selectPortalRef);
@@ -1,7 +1,7 @@
1
1
  import { isEmail, isTeam, isUser } from '@atlaskit/smart-user-picker';
2
2
  const buildAttributes = (attributes = {}) => ({
3
3
  packageName: "@atlaskit/share",
4
- packageVersion: "4.12.3",
4
+ packageVersion: "4.14.0",
5
5
  ...attributes
6
6
  });
7
7
  const createEvent = (eventType, source, action, actionSubject, actionSubjectId, attributes = {}) => ({
@@ -0,0 +1 @@
1
+ export {};
@@ -50,7 +50,8 @@ function LazyShareForm(props) {
50
50
  defaultValue = props.defaultValue,
51
51
  showTitle = props.showTitle,
52
52
  orgId = props.orgId,
53
- isBrowseUsersDisabled = props.isBrowseUsersDisabled;
53
+ isBrowseUsersDisabled = props.isBrowseUsersDisabled,
54
+ userPickerOptions = props.userPickerOptions;
54
55
  var footer = jsx("div", null, bottomMessage ? jsx("div", {
55
56
  css: {
56
57
  width: "".concat(gridSize() * 44, "px")
@@ -106,7 +107,8 @@ function LazyShareForm(props) {
106
107
  onUserSelectionChange: onUserSelectionChange,
107
108
  handleCloseDialog: onDialogClose,
108
109
  onTabChange: onTabChange,
109
- isBrowseUsersDisabled: isBrowseUsersDisabled
110
+ isBrowseUsersDisabled: isBrowseUsersDisabled,
111
+ userPickerOptions: userPickerOptions
110
112
  }) : jsx("p", null, jsx(FormattedMessage, messages.formNoPermissions))));
111
113
  }
112
114
  export default LazyShareForm;
@@ -350,7 +350,8 @@ export var ShareDialogContainerInternal = /*#__PURE__*/function (_React$Componen
350
350
  tabIndex = _this$props2.tabIndex,
351
351
  copyTooltipText = _this$props2.copyTooltipText,
352
352
  onDialogClose = _this$props2.onDialogClose,
353
- isBrowseUsersDisabled = _this$props2.isBrowseUsersDisabled;
353
+ isBrowseUsersDisabled = _this$props2.isBrowseUsersDisabled,
354
+ userPickerOptions = _this$props2.userPickerOptions;
354
355
  var _this$state = this.state,
355
356
  config = _this$state.config,
356
357
  isFetchingConfig = _this$state.isFetchingConfig;
@@ -398,7 +399,8 @@ export var ShareDialogContainerInternal = /*#__PURE__*/function (_React$Componen
398
399
  tabIndex: tabIndex,
399
400
  copyTooltipText: copyTooltipText,
400
401
  onDialogClose: onDialogClose,
401
- isBrowseUsersDisabled: isBrowseUsersDisabled
402
+ isBrowseUsersDisabled: isBrowseUsersDisabled,
403
+ userPickerOptions: userPickerOptions
402
404
  })));
403
405
  }
404
406
  }]);
@@ -510,7 +510,8 @@ export var ShareDialogWithTriggerInternal = /*#__PURE__*/function (_React$PureCo
510
510
  copyTooltipText = _this$props7.copyTooltipText,
511
511
  integrationMode = _this$props7.integrationMode,
512
512
  shareIntegrations = _this$props7.shareIntegrations,
513
- isBrowseUsersDisabled = _this$props7.isBrowseUsersDisabled;
513
+ isBrowseUsersDisabled = _this$props7.isBrowseUsersDisabled,
514
+ userPickerOptions = _this$props7.userPickerOptions;
514
515
  var style = typeof tabIndex !== 'undefined' && tabIndex >= 0 ? {
515
516
  outline: 'none'
516
517
  } : undefined;
@@ -565,7 +566,8 @@ export var ShareDialogWithTriggerInternal = /*#__PURE__*/function (_React$PureCo
565
566
  //ref
566
567
  ,
567
568
  selectPortalRef: _this2.selectPortalRef,
568
- isBrowseUsersDisabled: isBrowseUsersDisabled
569
+ isBrowseUsersDisabled: isBrowseUsersDisabled,
570
+ userPickerOptions: userPickerOptions
569
571
  }));
570
572
  },
571
573
  isOpen: isDialogOpen,
@@ -88,7 +88,8 @@ var InternalForm = /*#__PURE__*/function (_React$PureComponent) {
88
88
  orgId = _this$props.orgId,
89
89
  isBrowseUsersDisabled = _this$props.isBrowseUsersDisabled,
90
90
  formatMessage = _this$props.intl.formatMessage,
91
- shareError = _this$props.shareError;
91
+ shareError = _this$props.shareError,
92
+ userPickerOptions = _this$props.userPickerOptions;
92
93
  return jsx(AnalyticsContext, {
93
94
  data: {
94
95
  source: ANALYTICS_SOURCE
@@ -115,7 +116,8 @@ var InternalForm = /*#__PURE__*/function (_React$PureComponent) {
115
116
  helperMessage: helperMessage,
116
117
  orgId: orgId,
117
118
  isBrowseUsersDisabled: isBrowseUsersDisabled,
118
- shareError: shareError
119
+ shareError: shareError,
120
+ userPickerOptions: userPickerOptions
119
121
  })), jsx("div", {
120
122
  css: formFieldStyles
121
123
  }, jsx(CommentField, {
@@ -30,9 +30,16 @@ var getNoOptionsMessageDescriptor = function getNoOptionsMessageDescriptor(email
30
30
  }
31
31
  return messages.userPickerGenericNoOptionsMessage;
32
32
  };
33
- var getNoOptionsMessage = function getNoOptionsMessage(isPublicLink, allowEmail) {
33
+ var getNoOptionsMessage = function getNoOptionsMessage(isPublicLink, allowEmail, noOptionsMessageHandler) {
34
34
  return function (_ref) {
35
35
  var inputValue = _ref.inputValue;
36
+ if (noOptionsMessageHandler) {
37
+ return noOptionsMessageHandler({
38
+ inputValue: inputValue,
39
+ isPublicLink: isPublicLink,
40
+ allowEmail: allowEmail
41
+ });
42
+ }
36
43
  return inputValue && inputValue.trim().length > 0 ? /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, getNoOptionsMessageDescriptor(isValidEmail(inputValue), isPublicLink, allowEmail), {
37
44
  values: {
38
45
  inputValue: inputValue
@@ -162,7 +169,8 @@ export var UserPickerFieldComponent = /*#__PURE__*/function (_React$Component) {
162
169
  isPublicLink = _this$props2.isPublicLink,
163
170
  orgId = _this$props2.orgId,
164
171
  isBrowseUsersDisabled = _this$props2.isBrowseUsersDisabled,
165
- shareError = _this$props2.shareError;
172
+ shareError = _this$props2.shareError,
173
+ userPickerOptions = _this$props2.userPickerOptions;
166
174
  var smartUserPickerProps = enableSmartUserPicker && !isBrowseUsersDisabled ? {
167
175
  productKey: product,
168
176
  principalId: loggedInAccountId,
@@ -174,17 +182,21 @@ export var UserPickerFieldComponent = /*#__PURE__*/function (_React$Component) {
174
182
  } : {};
175
183
  var allowEmail = allowEmails(config);
176
184
  var requiredMessage = getRequiredMessage(product, allowEmail, isBrowseUsersDisabled);
185
+ var _ref2 = userPickerOptions !== null && userPickerOptions !== void 0 ? userPickerOptions : {},
186
+ header = _ref2.header,
187
+ noOptionsMessageHandler = _ref2.noOptionsMessageHandler;
177
188
  var commonPickerProps = {
178
189
  fieldId: 'share',
179
190
  loadOptions: this.loadOptions,
180
191
  isMulti: true,
181
192
  width: '100%',
182
193
  allowEmail: allowEmail,
183
- noOptionsMessage: getNoOptionsMessage(isPublicLink, allowEmail),
194
+ noOptionsMessage: getNoOptionsMessage(isPublicLink, allowEmail, noOptionsMessageHandler),
184
195
  isLoading: isLoading,
185
196
  onInputChange: onInputChange,
186
197
  maxPickerHeight: MAX_PICKER_HEIGHT,
187
- textFieldBackgroundColor: true
198
+ textFieldBackgroundColor: true,
199
+ header: header
188
200
  };
189
201
  var UserPickerComponent = enableSmartUserPicker && !isBrowseUsersDisabled ? SmartUserPicker : UserPicker;
190
202
  var menuPortalTarget = getMenuPortalTargetCurrentHTML(selectPortalRef);
@@ -197,10 +209,10 @@ export var UserPickerFieldComponent = /*#__PURE__*/function (_React$Component) {
197
209
  defaultValue: defaultValue,
198
210
  transform: this.handleUserPickerTransform,
199
211
  isRequired: true
200
- }, function (_ref2) {
201
- var fieldProps = _ref2.fieldProps,
202
- fieldValidationError = _ref2.error,
203
- fieldValid = _ref2.meta.valid;
212
+ }, function (_ref3) {
213
+ var fieldProps = _ref3.fieldProps,
214
+ fieldValidationError = _ref3.error,
215
+ fieldValid = _ref3.meta.valid;
204
216
  var helperMessage = _this2.getHelperMessageOrDefault();
205
217
  var addMoreMessage = shareError !== null && shareError !== void 0 && shareError.errorCode ? null : intl.formatMessage(messages.userPickerAddMoreMessage);
206
218
  var wasValidationOrShareError = !!fieldValidationError || !!shareError;
@@ -6,7 +6,7 @@ var buildAttributes = function buildAttributes() {
6
6
  var attributes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
7
7
  return _objectSpread({
8
8
  packageName: "@atlaskit/share",
9
- packageVersion: "4.12.3"
9
+ packageVersion: "4.14.0"
10
10
  }, attributes);
11
11
  };
12
12
  var createEvent = function createEvent(eventType, source, action, actionSubject, actionSubjectId) {
@@ -0,0 +1 @@
1
+ export {};
@@ -2,7 +2,7 @@ import { jsx } from '@emotion/react';
2
2
  import type { LoadOptions } from '@atlaskit/smart-user-picker';
3
3
  import type { ShareData, ShareDialogWithTriggerProps, ShareDialogWithTriggerStates } from '../../types';
4
4
  import { IntegrationFormProps } from '../IntegrationForm';
5
- export type LazyShareFormProps = Pick<ShareDialogWithTriggerProps, 'copyLink' | 'config' | 'isFetchingConfig' | 'loadUserOptions' | 'shareFormTitle' | 'shareFormHelperMessage' | 'bottomMessage' | 'submitButtonLabel' | 'product' | 'customFooter' | 'enableSmartUserPicker' | 'loggedInAccountId' | 'cloudId' | 'shareFieldsFooter' | 'onUserSelectionChange' | 'isPublicLink' | 'copyTooltipText' | 'shareIntegrations' | 'integrationMode' | 'onDialogClose' | 'orgId' | 'isBrowseUsersDisabled'> & Pick<ShareDialogWithTriggerStates, 'showIntegrationForm' | 'selectedIntegration' | 'isSharing' | 'shareError' | 'defaultValue'> & Pick<IntegrationFormProps, 'Content'> & {
5
+ export type LazyShareFormProps = Pick<ShareDialogWithTriggerProps, 'copyLink' | 'config' | 'isFetchingConfig' | 'loadUserOptions' | 'shareFormTitle' | 'shareFormHelperMessage' | 'bottomMessage' | 'submitButtonLabel' | 'product' | 'customFooter' | 'enableSmartUserPicker' | 'loggedInAccountId' | 'cloudId' | 'shareFieldsFooter' | 'onUserSelectionChange' | 'isPublicLink' | 'copyTooltipText' | 'shareIntegrations' | 'integrationMode' | 'onDialogClose' | 'orgId' | 'isBrowseUsersDisabled' | 'userPickerOptions'> & Pick<ShareDialogWithTriggerStates, 'showIntegrationForm' | 'selectedIntegration' | 'isSharing' | 'shareError' | 'defaultValue'> & Pick<IntegrationFormProps, 'Content'> & {
6
6
  onLinkCopy: () => void;
7
7
  onDismiss: (data: ShareData) => void;
8
8
  onSubmit: (data: ShareData) => void;
@@ -50,7 +50,7 @@ export declare class ShareDialogContainerInternal extends React.Component<WithAn
50
50
  getFormShareLink: () => string;
51
51
  render(): JSX.Element;
52
52
  }
53
- export declare const ShareDialogContainer: React.ForwardRefExoticComponent<Pick<Omit<WithAnalyticsEventsProps & ShareDialogContainerProps, keyof WithAnalyticsEventsProps>, "onTriggerButtonClick" | "isAutoOpenDialog" | "shouldCloseOnEscapePress" | "dialogPlacement" | "loadUserOptions" | "onDialogOpen" | "onDialogClose" | "onUserSelectionChange" | "renderCustomTriggerButton" | "shareContentType" | "shareContentSubType" | "shareContentId" | "shareFormTitle" | "shareFormHelperMessage" | "showFlags" | "loggedInAccountId" | "triggerButtonAppearance" | "triggerButtonIcon" | "triggerButtonStyle" | "triggerButtonTooltipPosition" | "triggerButtonTooltipText" | "cloudId" | "bottomMessage" | "customFooter" | "isCopyDisabled" | "isPublicLink" | "integrationMode" | "shareFieldsFooter" | "shareIntegrations" | "shareAri" | "tabIndex" | "copyTooltipText" | "dialogZIndex" | "orgId" | "isBrowseUsersDisabled" | "shareClient" | "urlShortenerClient" | "shortLinkData" | "formatCopyLink" | "originTracingFactory" | "productId" | "shareLink" | "shareTitle" | "useUrlShortener" | "workspaceAri"> & Partial<Pick<Omit<WithAnalyticsEventsProps & ShareDialogContainerProps, keyof WithAnalyticsEventsProps>, "enableSmartUserPicker" | "product" | "shareeAction">> & Partial<Pick<{
53
+ export declare const ShareDialogContainer: React.ForwardRefExoticComponent<Pick<Omit<WithAnalyticsEventsProps & ShareDialogContainerProps, keyof WithAnalyticsEventsProps>, "onTriggerButtonClick" | "isAutoOpenDialog" | "shouldCloseOnEscapePress" | "dialogPlacement" | "loadUserOptions" | "onDialogOpen" | "onDialogClose" | "onUserSelectionChange" | "renderCustomTriggerButton" | "shareContentType" | "shareContentSubType" | "shareContentId" | "shareFormTitle" | "shareFormHelperMessage" | "showFlags" | "loggedInAccountId" | "triggerButtonAppearance" | "triggerButtonIcon" | "triggerButtonStyle" | "triggerButtonTooltipPosition" | "triggerButtonTooltipText" | "cloudId" | "bottomMessage" | "customFooter" | "isCopyDisabled" | "isPublicLink" | "integrationMode" | "shareFieldsFooter" | "shareIntegrations" | "shareAri" | "tabIndex" | "copyTooltipText" | "dialogZIndex" | "orgId" | "isBrowseUsersDisabled" | "userPickerOptions" | "shareClient" | "urlShortenerClient" | "shortLinkData" | "formatCopyLink" | "originTracingFactory" | "productId" | "shareLink" | "shareTitle" | "useUrlShortener" | "workspaceAri"> & Partial<Pick<Omit<WithAnalyticsEventsProps & ShareDialogContainerProps, keyof WithAnalyticsEventsProps>, "enableSmartUserPicker" | "product" | "shareeAction">> & Partial<Pick<{
54
54
  enableSmartUserPicker: boolean;
55
55
  shareeAction: "view" | "edit";
56
56
  product: string;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { WrappedComponentProps } from 'react-intl-next';
3
3
  import { LoadOptions, OptionData, Value } from '@atlaskit/smart-user-picker';
4
- import { ConfigResponse, ProductName, ShareError } from '../types';
4
+ import { ConfigResponse, ProductName, ShareError, UserPickerOptions } from '../types';
5
5
  export declare const REQUIRED = "REQUIRED";
6
6
  export type Props = {
7
7
  loadOptions?: LoadOptions;
@@ -20,6 +20,7 @@ export type Props = {
20
20
  orgId?: string;
21
21
  isBrowseUsersDisabled?: boolean;
22
22
  shareError?: ShareError;
23
+ userPickerOptions?: UserPickerOptions;
23
24
  };
24
25
  export declare class UserPickerFieldComponent extends React.Component<WrappedComponentProps & Props> {
25
26
  private loadOptions;
@@ -10,6 +10,7 @@ import type { ProductId, ProductName } from './Products';
10
10
  import type { ShareButtonStyle, TooltipPosition } from './ShareButton';
11
11
  import type { DialogPlacement, RenderCustomTriggerButton } from './ShareDialogWithTrigger';
12
12
  import type { Integration, IntegrationMode } from './ShareEntities';
13
+ import type { UserPickerOptions } from './UserPickerOptions';
13
14
  export type ShareDialogContainerProps = {
14
15
  onTriggerButtonClick?: () => void;
15
16
  onDialogOpen?: () => void;
@@ -137,6 +138,7 @@ export type ShareDialogContainerProps = {
137
138
  * Footer for the share dialog.
138
139
  */
139
140
  customFooter?: React.ReactNode;
141
+ userPickerOptions?: UserPickerOptions;
140
142
  onUserSelectionChange?: (value: Value) => void;
141
143
  shareFieldsFooter?: React.ReactNode;
142
144
  isCopyDisabled?: boolean;
@@ -19,7 +19,7 @@ export type DialogPlacement = Placement;
19
19
  * with the demo page and clearly visible options on that page.
20
20
  */
21
21
  export type DialogBoundariesElement = 'viewport' | 'window' | 'scrollParent';
22
- export type ShareDialogWithTriggerProps = Pick<ShareDialogContainerProps, 'onTriggerButtonClick' | 'isAutoOpenDialog' | 'shouldCloseOnEscapePress' | 'dialogPlacement' | 'loadUserOptions' | 'onDialogOpen' | 'onDialogClose' | 'onUserSelectionChange' | 'renderCustomTriggerButton' | 'shareContentType' | 'shareContentSubType' | 'shareContentId' | 'shareFormTitle' | 'shareFormHelperMessage' | 'showFlags' | 'enableSmartUserPicker' | 'loggedInAccountId' | 'triggerButtonAppearance' | 'triggerButtonIcon' | 'triggerButtonStyle' | 'triggerButtonTooltipPosition' | 'triggerButtonTooltipText' | 'cloudId' | 'bottomMessage' | 'product' | 'customFooter' | 'isCopyDisabled' | 'isPublicLink' | 'integrationMode' | 'shareFieldsFooter' | 'shareIntegrations' | 'shareAri' | 'tabIndex' | 'copyTooltipText' | 'dialogZIndex' | 'orgId' | 'isBrowseUsersDisabled'> & {
22
+ export type ShareDialogWithTriggerProps = Pick<ShareDialogContainerProps, 'onTriggerButtonClick' | 'isAutoOpenDialog' | 'shouldCloseOnEscapePress' | 'dialogPlacement' | 'loadUserOptions' | 'onDialogOpen' | 'onDialogClose' | 'onUserSelectionChange' | 'renderCustomTriggerButton' | 'shareContentType' | 'shareContentSubType' | 'shareContentId' | 'shareFormTitle' | 'shareFormHelperMessage' | 'showFlags' | 'enableSmartUserPicker' | 'loggedInAccountId' | 'triggerButtonAppearance' | 'triggerButtonIcon' | 'triggerButtonStyle' | 'triggerButtonTooltipPosition' | 'triggerButtonTooltipText' | 'cloudId' | 'bottomMessage' | 'product' | 'customFooter' | 'isCopyDisabled' | 'isPublicLink' | 'integrationMode' | 'shareFieldsFooter' | 'shareIntegrations' | 'shareAri' | 'tabIndex' | 'copyTooltipText' | 'dialogZIndex' | 'orgId' | 'isBrowseUsersDisabled' | 'userPickerOptions'> & {
23
23
  config?: ConfigResponse;
24
24
  isFetchingConfig?: boolean;
25
25
  children?: RenderCustomTriggerButton;
@@ -4,7 +4,7 @@ import type { ConfigResponse } from '../clients/ShareServiceClient';
4
4
  import type { ProductName } from './Products';
5
5
  import type { ShareData, ShareError } from './ShareContentState';
6
6
  import type { ShareDialogContainerProps } from './ShareDialogContainer';
7
- export type ShareFormProps = Pick<ShareDialogContainerProps, 'integrationMode' | 'shareIntegrations' | 'copyTooltipText' | 'isPublicLink' | 'onUserSelectionChange' | 'cloudId' | 'loggedInAccountId' | 'enableSmartUserPicker' | 'orgId' | 'isBrowseUsersDisabled'> & {
7
+ export type ShareFormProps = Pick<ShareDialogContainerProps, 'integrationMode' | 'shareIntegrations' | 'copyTooltipText' | 'isPublicLink' | 'onUserSelectionChange' | 'cloudId' | 'loggedInAccountId' | 'enableSmartUserPicker' | 'orgId' | 'isBrowseUsersDisabled' | 'userPickerOptions'> & {
8
8
  config?: ConfigResponse;
9
9
  isFetchingConfig?: boolean;
10
10
  copyLink: string;
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ export type UserPickerOptions = {
3
+ header?: React.ReactNode;
4
+ /** Message to be shown when the menu is open but no options are provided.
5
+ * If message is null, no message will be displayed.
6
+ * If message is undefined, default message will be displayed.
7
+ */
8
+ noOptionsMessageHandler?: ((value: {
9
+ inputValue: string;
10
+ isPublicLink?: boolean;
11
+ allowEmail?: boolean;
12
+ }) => string | null | React.ReactNode) | null;
13
+ };
@@ -15,3 +15,4 @@ export type KeysOfType<T, TProp> = {
15
15
  }[keyof T];
16
16
  export type { ShareDialogContainerProps } from './ShareDialogContainer';
17
17
  export type { ShareFormProps } from './ShareForm';
18
+ export type { UserPickerOptions } from './UserPickerOptions';
@@ -2,7 +2,7 @@ import { jsx } from '@emotion/react';
2
2
  import type { LoadOptions } from '@atlaskit/smart-user-picker';
3
3
  import type { ShareData, ShareDialogWithTriggerProps, ShareDialogWithTriggerStates } from '../../types';
4
4
  import { IntegrationFormProps } from '../IntegrationForm';
5
- export type LazyShareFormProps = Pick<ShareDialogWithTriggerProps, 'copyLink' | 'config' | 'isFetchingConfig' | 'loadUserOptions' | 'shareFormTitle' | 'shareFormHelperMessage' | 'bottomMessage' | 'submitButtonLabel' | 'product' | 'customFooter' | 'enableSmartUserPicker' | 'loggedInAccountId' | 'cloudId' | 'shareFieldsFooter' | 'onUserSelectionChange' | 'isPublicLink' | 'copyTooltipText' | 'shareIntegrations' | 'integrationMode' | 'onDialogClose' | 'orgId' | 'isBrowseUsersDisabled'> & Pick<ShareDialogWithTriggerStates, 'showIntegrationForm' | 'selectedIntegration' | 'isSharing' | 'shareError' | 'defaultValue'> & Pick<IntegrationFormProps, 'Content'> & {
5
+ export type LazyShareFormProps = Pick<ShareDialogWithTriggerProps, 'copyLink' | 'config' | 'isFetchingConfig' | 'loadUserOptions' | 'shareFormTitle' | 'shareFormHelperMessage' | 'bottomMessage' | 'submitButtonLabel' | 'product' | 'customFooter' | 'enableSmartUserPicker' | 'loggedInAccountId' | 'cloudId' | 'shareFieldsFooter' | 'onUserSelectionChange' | 'isPublicLink' | 'copyTooltipText' | 'shareIntegrations' | 'integrationMode' | 'onDialogClose' | 'orgId' | 'isBrowseUsersDisabled' | 'userPickerOptions'> & Pick<ShareDialogWithTriggerStates, 'showIntegrationForm' | 'selectedIntegration' | 'isSharing' | 'shareError' | 'defaultValue'> & Pick<IntegrationFormProps, 'Content'> & {
6
6
  onLinkCopy: () => void;
7
7
  onDismiss: (data: ShareData) => void;
8
8
  onSubmit: (data: ShareData) => void;
@@ -50,7 +50,7 @@ export declare class ShareDialogContainerInternal extends React.Component<WithAn
50
50
  getFormShareLink: () => string;
51
51
  render(): JSX.Element;
52
52
  }
53
- export declare const ShareDialogContainer: React.ForwardRefExoticComponent<Pick<Omit<WithAnalyticsEventsProps & ShareDialogContainerProps, keyof WithAnalyticsEventsProps>, "onTriggerButtonClick" | "isAutoOpenDialog" | "shouldCloseOnEscapePress" | "dialogPlacement" | "loadUserOptions" | "onDialogOpen" | "onDialogClose" | "onUserSelectionChange" | "renderCustomTriggerButton" | "shareContentType" | "shareContentSubType" | "shareContentId" | "shareFormTitle" | "shareFormHelperMessage" | "showFlags" | "loggedInAccountId" | "triggerButtonAppearance" | "triggerButtonIcon" | "triggerButtonStyle" | "triggerButtonTooltipPosition" | "triggerButtonTooltipText" | "cloudId" | "bottomMessage" | "customFooter" | "isCopyDisabled" | "isPublicLink" | "integrationMode" | "shareFieldsFooter" | "shareIntegrations" | "shareAri" | "tabIndex" | "copyTooltipText" | "dialogZIndex" | "orgId" | "isBrowseUsersDisabled" | "shareClient" | "urlShortenerClient" | "shortLinkData" | "formatCopyLink" | "originTracingFactory" | "productId" | "shareLink" | "shareTitle" | "useUrlShortener" | "workspaceAri"> & Partial<Pick<Omit<WithAnalyticsEventsProps & ShareDialogContainerProps, keyof WithAnalyticsEventsProps>, "enableSmartUserPicker" | "product" | "shareeAction">> & Partial<Pick<{
53
+ export declare const ShareDialogContainer: React.ForwardRefExoticComponent<Pick<Omit<WithAnalyticsEventsProps & ShareDialogContainerProps, keyof WithAnalyticsEventsProps>, "onTriggerButtonClick" | "isAutoOpenDialog" | "shouldCloseOnEscapePress" | "dialogPlacement" | "loadUserOptions" | "onDialogOpen" | "onDialogClose" | "onUserSelectionChange" | "renderCustomTriggerButton" | "shareContentType" | "shareContentSubType" | "shareContentId" | "shareFormTitle" | "shareFormHelperMessage" | "showFlags" | "loggedInAccountId" | "triggerButtonAppearance" | "triggerButtonIcon" | "triggerButtonStyle" | "triggerButtonTooltipPosition" | "triggerButtonTooltipText" | "cloudId" | "bottomMessage" | "customFooter" | "isCopyDisabled" | "isPublicLink" | "integrationMode" | "shareFieldsFooter" | "shareIntegrations" | "shareAri" | "tabIndex" | "copyTooltipText" | "dialogZIndex" | "orgId" | "isBrowseUsersDisabled" | "userPickerOptions" | "shareClient" | "urlShortenerClient" | "shortLinkData" | "formatCopyLink" | "originTracingFactory" | "productId" | "shareLink" | "shareTitle" | "useUrlShortener" | "workspaceAri"> & Partial<Pick<Omit<WithAnalyticsEventsProps & ShareDialogContainerProps, keyof WithAnalyticsEventsProps>, "enableSmartUserPicker" | "product" | "shareeAction">> & Partial<Pick<{
54
54
  enableSmartUserPicker: boolean;
55
55
  shareeAction: "view" | "edit";
56
56
  product: string;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { WrappedComponentProps } from 'react-intl-next';
3
3
  import { LoadOptions, OptionData, Value } from '@atlaskit/smart-user-picker';
4
- import { ConfigResponse, ProductName, ShareError } from '../types';
4
+ import { ConfigResponse, ProductName, ShareError, UserPickerOptions } from '../types';
5
5
  export declare const REQUIRED = "REQUIRED";
6
6
  export type Props = {
7
7
  loadOptions?: LoadOptions;
@@ -20,6 +20,7 @@ export type Props = {
20
20
  orgId?: string;
21
21
  isBrowseUsersDisabled?: boolean;
22
22
  shareError?: ShareError;
23
+ userPickerOptions?: UserPickerOptions;
23
24
  };
24
25
  export declare class UserPickerFieldComponent extends React.Component<WrappedComponentProps & Props> {
25
26
  private loadOptions;
@@ -10,6 +10,7 @@ import type { ProductId, ProductName } from './Products';
10
10
  import type { ShareButtonStyle, TooltipPosition } from './ShareButton';
11
11
  import type { DialogPlacement, RenderCustomTriggerButton } from './ShareDialogWithTrigger';
12
12
  import type { Integration, IntegrationMode } from './ShareEntities';
13
+ import type { UserPickerOptions } from './UserPickerOptions';
13
14
  export type ShareDialogContainerProps = {
14
15
  onTriggerButtonClick?: () => void;
15
16
  onDialogOpen?: () => void;
@@ -137,6 +138,7 @@ export type ShareDialogContainerProps = {
137
138
  * Footer for the share dialog.
138
139
  */
139
140
  customFooter?: React.ReactNode;
141
+ userPickerOptions?: UserPickerOptions;
140
142
  onUserSelectionChange?: (value: Value) => void;
141
143
  shareFieldsFooter?: React.ReactNode;
142
144
  isCopyDisabled?: boolean;
@@ -19,7 +19,7 @@ export type DialogPlacement = Placement;
19
19
  * with the demo page and clearly visible options on that page.
20
20
  */
21
21
  export type DialogBoundariesElement = 'viewport' | 'window' | 'scrollParent';
22
- export type ShareDialogWithTriggerProps = Pick<ShareDialogContainerProps, 'onTriggerButtonClick' | 'isAutoOpenDialog' | 'shouldCloseOnEscapePress' | 'dialogPlacement' | 'loadUserOptions' | 'onDialogOpen' | 'onDialogClose' | 'onUserSelectionChange' | 'renderCustomTriggerButton' | 'shareContentType' | 'shareContentSubType' | 'shareContentId' | 'shareFormTitle' | 'shareFormHelperMessage' | 'showFlags' | 'enableSmartUserPicker' | 'loggedInAccountId' | 'triggerButtonAppearance' | 'triggerButtonIcon' | 'triggerButtonStyle' | 'triggerButtonTooltipPosition' | 'triggerButtonTooltipText' | 'cloudId' | 'bottomMessage' | 'product' | 'customFooter' | 'isCopyDisabled' | 'isPublicLink' | 'integrationMode' | 'shareFieldsFooter' | 'shareIntegrations' | 'shareAri' | 'tabIndex' | 'copyTooltipText' | 'dialogZIndex' | 'orgId' | 'isBrowseUsersDisabled'> & {
22
+ export type ShareDialogWithTriggerProps = Pick<ShareDialogContainerProps, 'onTriggerButtonClick' | 'isAutoOpenDialog' | 'shouldCloseOnEscapePress' | 'dialogPlacement' | 'loadUserOptions' | 'onDialogOpen' | 'onDialogClose' | 'onUserSelectionChange' | 'renderCustomTriggerButton' | 'shareContentType' | 'shareContentSubType' | 'shareContentId' | 'shareFormTitle' | 'shareFormHelperMessage' | 'showFlags' | 'enableSmartUserPicker' | 'loggedInAccountId' | 'triggerButtonAppearance' | 'triggerButtonIcon' | 'triggerButtonStyle' | 'triggerButtonTooltipPosition' | 'triggerButtonTooltipText' | 'cloudId' | 'bottomMessage' | 'product' | 'customFooter' | 'isCopyDisabled' | 'isPublicLink' | 'integrationMode' | 'shareFieldsFooter' | 'shareIntegrations' | 'shareAri' | 'tabIndex' | 'copyTooltipText' | 'dialogZIndex' | 'orgId' | 'isBrowseUsersDisabled' | 'userPickerOptions'> & {
23
23
  config?: ConfigResponse;
24
24
  isFetchingConfig?: boolean;
25
25
  children?: RenderCustomTriggerButton;
@@ -4,7 +4,7 @@ import type { ConfigResponse } from '../clients/ShareServiceClient';
4
4
  import type { ProductName } from './Products';
5
5
  import type { ShareData, ShareError } from './ShareContentState';
6
6
  import type { ShareDialogContainerProps } from './ShareDialogContainer';
7
- export type ShareFormProps = Pick<ShareDialogContainerProps, 'integrationMode' | 'shareIntegrations' | 'copyTooltipText' | 'isPublicLink' | 'onUserSelectionChange' | 'cloudId' | 'loggedInAccountId' | 'enableSmartUserPicker' | 'orgId' | 'isBrowseUsersDisabled'> & {
7
+ export type ShareFormProps = Pick<ShareDialogContainerProps, 'integrationMode' | 'shareIntegrations' | 'copyTooltipText' | 'isPublicLink' | 'onUserSelectionChange' | 'cloudId' | 'loggedInAccountId' | 'enableSmartUserPicker' | 'orgId' | 'isBrowseUsersDisabled' | 'userPickerOptions'> & {
8
8
  config?: ConfigResponse;
9
9
  isFetchingConfig?: boolean;
10
10
  copyLink: string;
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ export type UserPickerOptions = {
3
+ header?: React.ReactNode;
4
+ /** Message to be shown when the menu is open but no options are provided.
5
+ * If message is null, no message will be displayed.
6
+ * If message is undefined, default message will be displayed.
7
+ */
8
+ noOptionsMessageHandler?: ((value: {
9
+ inputValue: string;
10
+ isPublicLink?: boolean;
11
+ allowEmail?: boolean;
12
+ }) => string | null | React.ReactNode) | null;
13
+ };
@@ -15,3 +15,4 @@ export type KeysOfType<T, TProp> = {
15
15
  }[keyof T];
16
16
  export type { ShareDialogContainerProps } from './ShareDialogContainer';
17
17
  export type { ShareFormProps } from './ShareForm';
18
+ export type { UserPickerOptions } from './UserPickerOptions';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/share",
3
- "version": "4.12.3",
3
+ "version": "4.14.0",
4
4
  "description": "Fabric Share Element",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -42,8 +42,8 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "@atlaskit/analytics-next": "^9.2.0",
45
- "@atlaskit/button": "^17.3.0",
46
- "@atlaskit/dropdown-menu": "^12.4.0",
45
+ "@atlaskit/button": "^17.4.0",
46
+ "@atlaskit/dropdown-menu": "^12.5.0",
47
47
  "@atlaskit/form": "^9.0.3",
48
48
  "@atlaskit/icon": "^22.0.0",
49
49
  "@atlaskit/popper": "^5.5.4",
@@ -54,7 +54,7 @@
54
54
  "@atlaskit/tabs": "^14.0.0",
55
55
  "@atlaskit/textarea": "^5.0.0",
56
56
  "@atlaskit/theme": "^12.6.0",
57
- "@atlaskit/tokens": "^1.35.0",
57
+ "@atlaskit/tokens": "^1.37.0",
58
58
  "@atlaskit/tooltip": "^18.1.0",
59
59
  "@atlaskit/ufo": "^0.2.0",
60
60
  "@atlaskit/user-picker": "^10.16.0",
@@ -72,7 +72,7 @@
72
72
  "react": "^16.8.0"
73
73
  },
74
74
  "devDependencies": {
75
- "@atlaskit/editor-test-helpers": "^18.17.0",
75
+ "@atlaskit/editor-test-helpers": "^18.18.0",
76
76
  "@atlaskit/flag": "^15.2.0",
77
77
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
78
78
  "@testing-library/react": "^12.1.5",