@atlaskit/user-picker 9.3.5 → 9.4.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.
- package/CHANGELOG.md +12 -0
- package/analytics/package.json +8 -1
- package/dist/cjs/components/AvatarItemOption.js +37 -19
- package/dist/cjs/components/TeamOption/main.js +12 -1
- package/dist/cjs/components/styles.js +5 -5
- package/dist/cjs/components/utils.js +8 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/AvatarItemOption.js +41 -24
- package/dist/es2019/components/TeamOption/main.js +13 -1
- package/dist/es2019/components/styles.js +5 -5
- package/dist/es2019/components/utils.js +4 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/AvatarItemOption.js +35 -19
- package/dist/esm/components/TeamOption/main.js +13 -1
- package/dist/esm/components/styles.js +5 -5
- package/dist/esm/components/utils.js +3 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/components/AvatarItemOption.d.ts +1 -1
- package/dist/types/components/TeamOption/main.d.ts +1 -0
- package/dist/types/components/utils.d.ts +3 -2
- package/dist/types/types.d.ts +2 -1
- package/package.json +3 -3
- package/report.api.md +166 -193
- package/types/package.json +8 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/user-picker
|
|
2
2
|
|
|
3
|
+
## 9.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`47c6607c914`](https://bitbucket.org/atlassian/atlassian-frontend/commits/47c6607c914) - [ux] Adding ability for Options of type Team to allow for custom html in the lozenge prop. Added byline prop for type Team which will override the default byline generated from includesYou and memberCount props.
|
|
8
|
+
|
|
9
|
+
## 9.3.6
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`cb4c9cdd28b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cb4c9cdd28b) - [ux] Update input component to use input tokens
|
|
14
|
+
|
|
3
15
|
## 9.3.5
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/analytics/package.json
CHANGED
|
@@ -4,5 +4,12 @@
|
|
|
4
4
|
"module": "../dist/esm/analytics.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/analytics.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/analytics.d.ts"
|
|
7
|
+
"types": "../dist/types/analytics.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.0 <4.3": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.0/analytics.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
8
15
|
}
|
|
@@ -13,10 +13,14 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
13
13
|
|
|
14
14
|
var _react = _interopRequireDefault(require("react"));
|
|
15
15
|
|
|
16
|
+
var _constants = require("@atlaskit/theme/constants");
|
|
17
|
+
|
|
16
18
|
var _core = require("@emotion/core");
|
|
17
19
|
|
|
18
20
|
var _lozenge = _interopRequireDefault(require("@atlaskit/lozenge"));
|
|
19
21
|
|
|
22
|
+
var _utils = require("./utils");
|
|
23
|
+
|
|
20
24
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
21
25
|
|
|
22
26
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -45,6 +49,13 @@ var wrapper = (0, _core.css)({
|
|
|
45
49
|
width: '100%',
|
|
46
50
|
cursor: 'pointer'
|
|
47
51
|
});
|
|
52
|
+
var optionWrapper = (0, _core.css)({
|
|
53
|
+
maxWidth: '100%',
|
|
54
|
+
minWidth: 0,
|
|
55
|
+
flex: '1 1 100%',
|
|
56
|
+
lineHeight: '1.4',
|
|
57
|
+
paddingLeft: "".concat((0, _constants.gridSize)(), "px")
|
|
58
|
+
});
|
|
48
59
|
|
|
49
60
|
var getTextStyle = function getTextStyle(isSecondary) {
|
|
50
61
|
var secondaryCssArgs = isSecondary ? {
|
|
@@ -66,7 +77,7 @@ var textWrapper = function textWrapper(color) {
|
|
|
66
77
|
return (0, _core.css)({
|
|
67
78
|
overflow: 'hidden',
|
|
68
79
|
textOverflow: 'ellipsis',
|
|
69
|
-
display: 'inline
|
|
80
|
+
display: 'inline',
|
|
70
81
|
color: color
|
|
71
82
|
});
|
|
72
83
|
};
|
|
@@ -78,29 +89,36 @@ var AvatarItemOption = function AvatarItemOption(_ref) {
|
|
|
78
89
|
primaryText = _ref.primaryText,
|
|
79
90
|
secondaryText = _ref.secondaryText,
|
|
80
91
|
lozenge = _ref.lozenge;
|
|
92
|
+
|
|
93
|
+
var renderLozenge = function renderLozenge() {
|
|
94
|
+
if ((0, _utils.isLozengeText)(lozenge)) {
|
|
95
|
+
if (lozenge !== null && lozenge !== void 0 && lozenge.tooltip) {
|
|
96
|
+
// Note that entire Lozenge must be wrapped in the Tooltip (rather than just the
|
|
97
|
+
// Lozenge text) or tooltip won't work
|
|
98
|
+
return (0, _core.jsx)(_react.default.Suspense, {
|
|
99
|
+
fallback: (0, _core.jsx)(_lozenge.default, lozenge, lozenge.text)
|
|
100
|
+
}, (0, _core.jsx)(AsyncTooltip, {
|
|
101
|
+
content: lozenge.tooltip
|
|
102
|
+
}, (0, _core.jsx)(_lozenge.default, lozenge, lozenge.text)));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return (0, _core.jsx)(_lozenge.default, lozenge, lozenge.text);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return lozenge;
|
|
109
|
+
};
|
|
110
|
+
|
|
81
111
|
return (0, _core.jsx)("span", {
|
|
82
112
|
css: wrapper
|
|
83
113
|
}, avatar, (0, _core.jsx)("div", {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
minWidth: 0,
|
|
87
|
-
flex: '1 1 100%',
|
|
88
|
-
lineHeight: '1.4',
|
|
89
|
-
paddingLeft: '8px'
|
|
90
|
-
}
|
|
91
|
-
}, (0, _core.jsx)("div", null, (0, _core.jsx)("span", {
|
|
114
|
+
css: optionWrapper
|
|
115
|
+
}, (0, _core.jsx)("div", null, (0, _core.jsx)("div", {
|
|
92
116
|
css: getTextStyle()
|
|
93
|
-
}, primaryText), (0, _core.jsx)("
|
|
94
|
-
css: additionalInfo
|
|
95
|
-
}, (lozenge === null || lozenge === void 0 ? void 0 : lozenge.text) && (lozenge !== null && lozenge !== void 0 && lozenge.tooltip ? // Note that entire Lozenge must be wrapped in the Tooltip (rather than just the
|
|
96
|
-
// Lozenge text) or tooltip won't work
|
|
97
|
-
(0, _core.jsx)(_react.default.Suspense, {
|
|
98
|
-
fallback: (0, _core.jsx)(_lozenge.default, lozenge, lozenge.text)
|
|
99
|
-
}, (0, _core.jsx)(AsyncTooltip, {
|
|
100
|
-
content: lozenge.tooltip
|
|
101
|
-
}, (0, _core.jsx)(_lozenge.default, lozenge, lozenge.text))) : (0, _core.jsx)(_lozenge.default, lozenge, lozenge.text)))), (0, _core.jsx)("div", null, (0, _core.jsx)("span", {
|
|
117
|
+
}, primaryText), secondaryText && (0, _core.jsx)("div", {
|
|
102
118
|
css: getTextStyle(true)
|
|
103
|
-
}, secondaryText))))
|
|
119
|
+
}, secondaryText))), lozenge && (0, _core.jsx)("div", {
|
|
120
|
+
css: additionalInfo
|
|
121
|
+
}, renderLozenge()));
|
|
104
122
|
};
|
|
105
123
|
|
|
106
124
|
exports.AvatarItemOption = AvatarItemOption;
|
|
@@ -124,6 +124,17 @@ var TeamOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
124
124
|
text: _this.props.team.lozenge
|
|
125
125
|
} : _this.props.team.lozenge;
|
|
126
126
|
});
|
|
127
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderCustomByLine", function () {
|
|
128
|
+
var _this$props$team4;
|
|
129
|
+
|
|
130
|
+
if (!((_this$props$team4 = _this.props.team) !== null && _this$props$team4 !== void 0 && _this$props$team4.byline)) {
|
|
131
|
+
return undefined;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return (0, _core.jsx)("span", {
|
|
135
|
+
css: (0, _AvatarItemOption.textWrapper)(_this.props.isSelected ? (0, _tokens.token)('color.text.selected', _colors.B400) : (0, _tokens.token)('color.text.subtlest', _colors.N200))
|
|
136
|
+
}, _this.props.team.byline);
|
|
137
|
+
});
|
|
127
138
|
return _this;
|
|
128
139
|
}
|
|
129
140
|
|
|
@@ -132,7 +143,7 @@ var TeamOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
132
143
|
value: function render() {
|
|
133
144
|
return (0, _core.jsx)(_AvatarItemOption.AvatarItemOption, {
|
|
134
145
|
avatar: this.renderAvatar(),
|
|
135
|
-
secondaryText: this.renderByline(),
|
|
146
|
+
secondaryText: this.renderCustomByLine() || this.renderByline(),
|
|
136
147
|
primaryText: this.getPrimaryText(),
|
|
137
148
|
lozenge: this.getLozengeProps()
|
|
138
149
|
});
|
|
@@ -51,14 +51,14 @@ var getStyles = (0, _memoizeOne.default)(function (width, isMulti, isCompact, ov
|
|
|
51
51
|
var isMulti = state.selectProps.isMulti;
|
|
52
52
|
return _objectSpread(_objectSpread({}, css), {}, {
|
|
53
53
|
width: width,
|
|
54
|
-
borderColor: state.isFocused ? (0, _tokens.token)('color.border', css.borderColor) : state.selectProps.subtle || state.selectProps.noBorder ? 'transparent' : (0, _tokens.token)('color.border', _colors.N40),
|
|
55
|
-
backgroundColor: state.isFocused ? (0, _tokens.token)('
|
|
54
|
+
borderColor: state.isFocused ? (0, _tokens.token)('color.border.focused', css.borderColor) : state.selectProps.subtle || state.selectProps.noBorder ? 'transparent' : (0, _tokens.token)('color.border.input', _colors.N40),
|
|
55
|
+
backgroundColor: state.isFocused ? (0, _tokens.token)('color.background.input', css['backgroundColor']) : state.selectProps.subtle ? 'transparent' : state.selectProps.textFieldBackgroundColor ? (0, _tokens.token)('color.background.input', _colors.N10) : (0, _tokens.token)('color.background.input', _colors.N20),
|
|
56
56
|
'&:hover .fabric-user-picker__clear-indicator': {
|
|
57
57
|
opacity: 1
|
|
58
58
|
},
|
|
59
59
|
':hover': _objectSpread(_objectSpread({}, css[':hover']), {}, {
|
|
60
|
-
borderColor: state.isFocused ? css[':hover'] ? (0, _tokens.token)('color.border.focused', css[':hover'].borderColor) : (0, _tokens.token)('color.border.focused', _colors.B100) : state.selectProps.subtle ? state.selectProps.hoveringClearIndicator ? (0, _tokens.token)('color.icon.danger', _colors.R50) : (0, _tokens.token)('color.
|
|
61
|
-
backgroundColor: state.selectProps.subtle && state.selectProps.hoveringClearIndicator ? (0, _tokens.token)('color.background.danger', _colors.R50) : state.isFocused ? css[':hover'] ? (0, _tokens.token)('
|
|
60
|
+
borderColor: state.isFocused ? css[':hover'] ? (0, _tokens.token)('color.border.focused', css[':hover'].borderColor) : (0, _tokens.token)('color.border.focused', _colors.B100) : state.selectProps.subtle ? state.selectProps.hoveringClearIndicator ? (0, _tokens.token)('color.icon.danger', _colors.R50) : (0, _tokens.token)('color.icon', _colors.N30) : (0, _tokens.token)('color.border.input', _colors.N40),
|
|
61
|
+
backgroundColor: state.selectProps.subtle && state.selectProps.hoveringClearIndicator ? (0, _tokens.token)('color.background.danger', _colors.R50) : state.isFocused ? css[':hover'] ? (0, _tokens.token)('color.background.input', css[':hover'].backgroundColor) : (0, _tokens.token)('color.background.input', _colors.N0) : state.isDisabled ? (0, _tokens.token)('color.background.disabled', _colors.N10) : (0, _tokens.token)('color.background.input.hovered', _colors.N30)
|
|
62
62
|
}),
|
|
63
63
|
padding: 0,
|
|
64
64
|
minHeight: isCompact ? 'none' : 44,
|
|
@@ -86,7 +86,7 @@ var getStyles = (0, _memoizeOne.default)(function (width, isMulti, isCompact, ov
|
|
|
86
86
|
paddingTop: 0,
|
|
87
87
|
padding: 0,
|
|
88
88
|
':hover': {
|
|
89
|
-
color: (0, _tokens.token)('color.
|
|
89
|
+
color: (0, _tokens.token)('color.icon.danger', _colors.R400)
|
|
90
90
|
}
|
|
91
91
|
});
|
|
92
92
|
},
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.optionToSelectableOptions = exports.optionToSelectableOption = exports.isUser = exports.isTeam = exports.isSingleValue = exports.isPopupUserPickerByProps = exports.isPopupUserPickerByComponent = exports.isIterable = exports.isGroup = exports.isExternalUser = exports.isEmail = exports.isDefaultValuePopulated = exports.isChildInput = exports.hasValue = exports.getOptions = exports.getAvatarUrl = exports.getAvatarSize = exports.extractOptionValue = exports.callCallback = void 0;
|
|
8
|
+
exports.optionToSelectableOptions = exports.optionToSelectableOption = exports.isUser = exports.isTeam = exports.isSingleValue = exports.isPopupUserPickerByProps = exports.isPopupUserPickerByComponent = exports.isLozengeText = exports.isIterable = exports.isGroup = exports.isExternalUser = exports.isEmail = exports.isDefaultValuePopulated = exports.isChildInput = exports.hasValue = exports.getOptions = exports.getAvatarUrl = exports.getAvatarSize = exports.extractOptionValue = exports.callCallback = void 0;
|
|
9
9
|
|
|
10
10
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11
11
|
|
|
@@ -182,4 +182,10 @@ var isPopupUserPickerByProps = function isPopupUserPickerByProps(selectProps) {
|
|
|
182
182
|
return selectProps.searchThreshold === -1;
|
|
183
183
|
};
|
|
184
184
|
|
|
185
|
-
exports.isPopupUserPickerByProps = isPopupUserPickerByProps;
|
|
185
|
+
exports.isPopupUserPickerByProps = isPopupUserPickerByProps;
|
|
186
|
+
|
|
187
|
+
var isLozengeText = function isLozengeText(lozengeProp) {
|
|
188
|
+
return (lozengeProp === null || lozengeProp === void 0 ? void 0 : lozengeProp.hasOwnProperty('text')) || false;
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
exports.isLozengeText = isLozengeText;
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { gridSize } from '@atlaskit/theme/constants';
|
|
3
4
|
import { css, jsx } from '@emotion/core';
|
|
4
5
|
import Lozenge from '@atlaskit/lozenge';
|
|
6
|
+
import { isLozengeText } from './utils';
|
|
5
7
|
const AsyncTooltip = /*#__PURE__*/React.lazy(() => import(
|
|
6
8
|
/* webpackChunkName: "@atlaskit-internal_@atlaskit/tooltip" */
|
|
7
9
|
'@atlaskit/tooltip').then(module => {
|
|
@@ -19,6 +21,13 @@ const wrapper = css({
|
|
|
19
21
|
width: '100%',
|
|
20
22
|
cursor: 'pointer'
|
|
21
23
|
});
|
|
24
|
+
const optionWrapper = css({
|
|
25
|
+
maxWidth: '100%',
|
|
26
|
+
minWidth: 0,
|
|
27
|
+
flex: '1 1 100%',
|
|
28
|
+
lineHeight: '1.4',
|
|
29
|
+
paddingLeft: `${gridSize()}px`
|
|
30
|
+
});
|
|
22
31
|
|
|
23
32
|
const getTextStyle = isSecondary => {
|
|
24
33
|
const secondaryCssArgs = isSecondary ? {
|
|
@@ -39,7 +48,7 @@ const additionalInfo = css({
|
|
|
39
48
|
export const textWrapper = color => css({
|
|
40
49
|
overflow: 'hidden',
|
|
41
50
|
textOverflow: 'ellipsis',
|
|
42
|
-
display: 'inline
|
|
51
|
+
display: 'inline',
|
|
43
52
|
color
|
|
44
53
|
});
|
|
45
54
|
export const AvatarItemOption = ({
|
|
@@ -47,26 +56,34 @@ export const AvatarItemOption = ({
|
|
|
47
56
|
primaryText,
|
|
48
57
|
secondaryText,
|
|
49
58
|
lozenge
|
|
50
|
-
}) =>
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}, jsx(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
59
|
+
}) => {
|
|
60
|
+
const renderLozenge = () => {
|
|
61
|
+
if (isLozengeText(lozenge)) {
|
|
62
|
+
if (lozenge !== null && lozenge !== void 0 && lozenge.tooltip) {
|
|
63
|
+
// Note that entire Lozenge must be wrapped in the Tooltip (rather than just the
|
|
64
|
+
// Lozenge text) or tooltip won't work
|
|
65
|
+
return jsx(React.Suspense, {
|
|
66
|
+
fallback: jsx(Lozenge, lozenge, lozenge.text)
|
|
67
|
+
}, jsx(AsyncTooltip, {
|
|
68
|
+
content: lozenge.tooltip
|
|
69
|
+
}, jsx(Lozenge, lozenge, lozenge.text)));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return jsx(Lozenge, lozenge, lozenge.text);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return lozenge;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
return jsx("span", {
|
|
79
|
+
css: wrapper
|
|
80
|
+
}, avatar, jsx("div", {
|
|
81
|
+
css: optionWrapper
|
|
82
|
+
}, jsx("div", null, jsx("div", {
|
|
83
|
+
css: getTextStyle()
|
|
84
|
+
}, primaryText), secondaryText && jsx("div", {
|
|
85
|
+
css: getTextStyle(true)
|
|
86
|
+
}, secondaryText))), lozenge && jsx("div", {
|
|
87
|
+
css: additionalInfo
|
|
88
|
+
}, renderLozenge()));
|
|
89
|
+
};
|
|
@@ -87,12 +87,24 @@ export class TeamOption extends React.PureComponent {
|
|
|
87
87
|
_defineProperty(this, "getLozengeProps", () => typeof this.props.team.lozenge === 'string' ? {
|
|
88
88
|
text: this.props.team.lozenge
|
|
89
89
|
} : this.props.team.lozenge);
|
|
90
|
+
|
|
91
|
+
_defineProperty(this, "renderCustomByLine", () => {
|
|
92
|
+
var _this$props$team;
|
|
93
|
+
|
|
94
|
+
if (!((_this$props$team = this.props.team) !== null && _this$props$team !== void 0 && _this$props$team.byline)) {
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return jsx("span", {
|
|
99
|
+
css: textWrapper(this.props.isSelected ? token('color.text.selected', B400) : token('color.text.subtlest', N200))
|
|
100
|
+
}, this.props.team.byline);
|
|
101
|
+
});
|
|
90
102
|
}
|
|
91
103
|
|
|
92
104
|
render() {
|
|
93
105
|
return jsx(AvatarItemOption, {
|
|
94
106
|
avatar: this.renderAvatar(),
|
|
95
|
-
secondaryText: this.renderByline(),
|
|
107
|
+
secondaryText: this.renderCustomByLine() || this.renderByline(),
|
|
96
108
|
primaryText: this.getPrimaryText(),
|
|
97
109
|
lozenge: this.getLozengeProps()
|
|
98
110
|
});
|
|
@@ -19,14 +19,14 @@ export const getStyles = memoizeOne((width, isMulti, isCompact, overrideStyles)
|
|
|
19
19
|
const isMulti = state.selectProps.isMulti;
|
|
20
20
|
return { ...css,
|
|
21
21
|
width,
|
|
22
|
-
borderColor: state.isFocused ? token('color.border', css.borderColor) : state.selectProps.subtle || state.selectProps.noBorder ? 'transparent' : token('color.border', N40),
|
|
23
|
-
backgroundColor: state.isFocused ? token('
|
|
22
|
+
borderColor: state.isFocused ? token('color.border.focused', css.borderColor) : state.selectProps.subtle || state.selectProps.noBorder ? 'transparent' : token('color.border.input', N40),
|
|
23
|
+
backgroundColor: state.isFocused ? token('color.background.input', css['backgroundColor']) : state.selectProps.subtle ? 'transparent' : state.selectProps.textFieldBackgroundColor ? token('color.background.input', N10) : token('color.background.input', N20),
|
|
24
24
|
'&:hover .fabric-user-picker__clear-indicator': {
|
|
25
25
|
opacity: 1
|
|
26
26
|
},
|
|
27
27
|
':hover': { ...css[':hover'],
|
|
28
|
-
borderColor: state.isFocused ? css[':hover'] ? token('color.border.focused', css[':hover'].borderColor) : token('color.border.focused', B100) : state.selectProps.subtle ? state.selectProps.hoveringClearIndicator ? token('color.icon.danger', R50) : token('color.
|
|
29
|
-
backgroundColor: state.selectProps.subtle && state.selectProps.hoveringClearIndicator ? token('color.background.danger', R50) : state.isFocused ? css[':hover'] ? token('
|
|
28
|
+
borderColor: state.isFocused ? css[':hover'] ? token('color.border.focused', css[':hover'].borderColor) : token('color.border.focused', B100) : state.selectProps.subtle ? state.selectProps.hoveringClearIndicator ? token('color.icon.danger', R50) : token('color.icon', N30) : token('color.border.input', N40),
|
|
29
|
+
backgroundColor: state.selectProps.subtle && state.selectProps.hoveringClearIndicator ? token('color.background.danger', R50) : state.isFocused ? css[':hover'] ? token('color.background.input', css[':hover'].backgroundColor) : token('color.background.input', N0) : state.isDisabled ? token('color.background.disabled', N10) : token('color.background.input.hovered', N30)
|
|
30
30
|
},
|
|
31
31
|
padding: 0,
|
|
32
32
|
minHeight: isCompact ? 'none' : 44,
|
|
@@ -54,7 +54,7 @@ export const getStyles = memoizeOne((width, isMulti, isCompact, overrideStyles)
|
|
|
54
54
|
paddingTop: 0,
|
|
55
55
|
padding: 0,
|
|
56
56
|
':hover': {
|
|
57
|
-
color: token('color.
|
|
57
|
+
color: token('color.icon.danger', R400)
|
|
58
58
|
}
|
|
59
59
|
}),
|
|
60
60
|
indicatorsContainer: css => ({ ...css,
|
|
@@ -76,4 +76,7 @@ export const getAvatarUrl = optionData => {
|
|
|
76
76
|
return undefined;
|
|
77
77
|
};
|
|
78
78
|
export const isPopupUserPickerByComponent = SelectComponent => SelectComponent === PopupSelect;
|
|
79
|
-
export const isPopupUserPickerByProps = selectProps => selectProps.searchThreshold === -1;
|
|
79
|
+
export const isPopupUserPickerByProps = selectProps => selectProps.searchThreshold === -1;
|
|
80
|
+
export const isLozengeText = lozengeProp => {
|
|
81
|
+
return (lozengeProp === null || lozengeProp === void 0 ? void 0 : lozengeProp.hasOwnProperty('text')) || false;
|
|
82
|
+
};
|
package/dist/es2019/version.json
CHANGED
|
@@ -6,8 +6,10 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
6
6
|
|
|
7
7
|
/** @jsx jsx */
|
|
8
8
|
import React from 'react';
|
|
9
|
+
import { gridSize } from '@atlaskit/theme/constants';
|
|
9
10
|
import { css, jsx } from '@emotion/core';
|
|
10
11
|
import Lozenge from '@atlaskit/lozenge';
|
|
12
|
+
import { isLozengeText } from './utils';
|
|
11
13
|
var AsyncTooltip = /*#__PURE__*/React.lazy(function () {
|
|
12
14
|
return import(
|
|
13
15
|
/* webpackChunkName: "@atlaskit-internal_@atlaskit/tooltip" */
|
|
@@ -27,6 +29,13 @@ var wrapper = css({
|
|
|
27
29
|
width: '100%',
|
|
28
30
|
cursor: 'pointer'
|
|
29
31
|
});
|
|
32
|
+
var optionWrapper = css({
|
|
33
|
+
maxWidth: '100%',
|
|
34
|
+
minWidth: 0,
|
|
35
|
+
flex: '1 1 100%',
|
|
36
|
+
lineHeight: '1.4',
|
|
37
|
+
paddingLeft: "".concat(gridSize(), "px")
|
|
38
|
+
});
|
|
30
39
|
|
|
31
40
|
var getTextStyle = function getTextStyle(isSecondary) {
|
|
32
41
|
var secondaryCssArgs = isSecondary ? {
|
|
@@ -47,7 +56,7 @@ export var textWrapper = function textWrapper(color) {
|
|
|
47
56
|
return css({
|
|
48
57
|
overflow: 'hidden',
|
|
49
58
|
textOverflow: 'ellipsis',
|
|
50
|
-
display: 'inline
|
|
59
|
+
display: 'inline',
|
|
51
60
|
color: color
|
|
52
61
|
});
|
|
53
62
|
};
|
|
@@ -56,27 +65,34 @@ export var AvatarItemOption = function AvatarItemOption(_ref) {
|
|
|
56
65
|
primaryText = _ref.primaryText,
|
|
57
66
|
secondaryText = _ref.secondaryText,
|
|
58
67
|
lozenge = _ref.lozenge;
|
|
68
|
+
|
|
69
|
+
var renderLozenge = function renderLozenge() {
|
|
70
|
+
if (isLozengeText(lozenge)) {
|
|
71
|
+
if (lozenge !== null && lozenge !== void 0 && lozenge.tooltip) {
|
|
72
|
+
// Note that entire Lozenge must be wrapped in the Tooltip (rather than just the
|
|
73
|
+
// Lozenge text) or tooltip won't work
|
|
74
|
+
return jsx(React.Suspense, {
|
|
75
|
+
fallback: jsx(Lozenge, lozenge, lozenge.text)
|
|
76
|
+
}, jsx(AsyncTooltip, {
|
|
77
|
+
content: lozenge.tooltip
|
|
78
|
+
}, jsx(Lozenge, lozenge, lozenge.text)));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return jsx(Lozenge, lozenge, lozenge.text);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return lozenge;
|
|
85
|
+
};
|
|
86
|
+
|
|
59
87
|
return jsx("span", {
|
|
60
88
|
css: wrapper
|
|
61
89
|
}, avatar, jsx("div", {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
minWidth: 0,
|
|
65
|
-
flex: '1 1 100%',
|
|
66
|
-
lineHeight: '1.4',
|
|
67
|
-
paddingLeft: '8px'
|
|
68
|
-
}
|
|
69
|
-
}, jsx("div", null, jsx("span", {
|
|
90
|
+
css: optionWrapper
|
|
91
|
+
}, jsx("div", null, jsx("div", {
|
|
70
92
|
css: getTextStyle()
|
|
71
|
-
}, primaryText), jsx("
|
|
72
|
-
css: additionalInfo
|
|
73
|
-
}, (lozenge === null || lozenge === void 0 ? void 0 : lozenge.text) && (lozenge !== null && lozenge !== void 0 && lozenge.tooltip ? // Note that entire Lozenge must be wrapped in the Tooltip (rather than just the
|
|
74
|
-
// Lozenge text) or tooltip won't work
|
|
75
|
-
jsx(React.Suspense, {
|
|
76
|
-
fallback: jsx(Lozenge, lozenge, lozenge.text)
|
|
77
|
-
}, jsx(AsyncTooltip, {
|
|
78
|
-
content: lozenge.tooltip
|
|
79
|
-
}, jsx(Lozenge, lozenge, lozenge.text))) : jsx(Lozenge, lozenge, lozenge.text)))), jsx("div", null, jsx("span", {
|
|
93
|
+
}, primaryText), secondaryText && jsx("div", {
|
|
80
94
|
css: getTextStyle(true)
|
|
81
|
-
}, secondaryText)))
|
|
95
|
+
}, secondaryText))), lozenge && jsx("div", {
|
|
96
|
+
css: additionalInfo
|
|
97
|
+
}, renderLozenge()));
|
|
82
98
|
};
|
|
@@ -106,6 +106,18 @@ export var TeamOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
106
106
|
} : _this.props.team.lozenge;
|
|
107
107
|
});
|
|
108
108
|
|
|
109
|
+
_defineProperty(_assertThisInitialized(_this), "renderCustomByLine", function () {
|
|
110
|
+
var _this$props$team4;
|
|
111
|
+
|
|
112
|
+
if (!((_this$props$team4 = _this.props.team) !== null && _this$props$team4 !== void 0 && _this$props$team4.byline)) {
|
|
113
|
+
return undefined;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return jsx("span", {
|
|
117
|
+
css: textWrapper(_this.props.isSelected ? token('color.text.selected', B400) : token('color.text.subtlest', N200))
|
|
118
|
+
}, _this.props.team.byline);
|
|
119
|
+
});
|
|
120
|
+
|
|
109
121
|
return _this;
|
|
110
122
|
}
|
|
111
123
|
|
|
@@ -114,7 +126,7 @@ export var TeamOption = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
114
126
|
value: function render() {
|
|
115
127
|
return jsx(AvatarItemOption, {
|
|
116
128
|
avatar: this.renderAvatar(),
|
|
117
|
-
secondaryText: this.renderByline(),
|
|
129
|
+
secondaryText: this.renderCustomByLine() || this.renderByline(),
|
|
118
130
|
primaryText: this.getPrimaryText(),
|
|
119
131
|
lozenge: this.getLozengeProps()
|
|
120
132
|
});
|
|
@@ -31,14 +31,14 @@ export var getStyles = memoizeOne(function (width, isMulti, isCompact, overrideS
|
|
|
31
31
|
var isMulti = state.selectProps.isMulti;
|
|
32
32
|
return _objectSpread(_objectSpread({}, css), {}, {
|
|
33
33
|
width: width,
|
|
34
|
-
borderColor: state.isFocused ? token('color.border', css.borderColor) : state.selectProps.subtle || state.selectProps.noBorder ? 'transparent' : token('color.border', N40),
|
|
35
|
-
backgroundColor: state.isFocused ? token('
|
|
34
|
+
borderColor: state.isFocused ? token('color.border.focused', css.borderColor) : state.selectProps.subtle || state.selectProps.noBorder ? 'transparent' : token('color.border.input', N40),
|
|
35
|
+
backgroundColor: state.isFocused ? token('color.background.input', css['backgroundColor']) : state.selectProps.subtle ? 'transparent' : state.selectProps.textFieldBackgroundColor ? token('color.background.input', N10) : token('color.background.input', N20),
|
|
36
36
|
'&:hover .fabric-user-picker__clear-indicator': {
|
|
37
37
|
opacity: 1
|
|
38
38
|
},
|
|
39
39
|
':hover': _objectSpread(_objectSpread({}, css[':hover']), {}, {
|
|
40
|
-
borderColor: state.isFocused ? css[':hover'] ? token('color.border.focused', css[':hover'].borderColor) : token('color.border.focused', B100) : state.selectProps.subtle ? state.selectProps.hoveringClearIndicator ? token('color.icon.danger', R50) : token('color.
|
|
41
|
-
backgroundColor: state.selectProps.subtle && state.selectProps.hoveringClearIndicator ? token('color.background.danger', R50) : state.isFocused ? css[':hover'] ? token('
|
|
40
|
+
borderColor: state.isFocused ? css[':hover'] ? token('color.border.focused', css[':hover'].borderColor) : token('color.border.focused', B100) : state.selectProps.subtle ? state.selectProps.hoveringClearIndicator ? token('color.icon.danger', R50) : token('color.icon', N30) : token('color.border.input', N40),
|
|
41
|
+
backgroundColor: state.selectProps.subtle && state.selectProps.hoveringClearIndicator ? token('color.background.danger', R50) : state.isFocused ? css[':hover'] ? token('color.background.input', css[':hover'].backgroundColor) : token('color.background.input', N0) : state.isDisabled ? token('color.background.disabled', N10) : token('color.background.input.hovered', N30)
|
|
42
42
|
}),
|
|
43
43
|
padding: 0,
|
|
44
44
|
minHeight: isCompact ? 'none' : 44,
|
|
@@ -67,7 +67,7 @@ export var getStyles = memoizeOne(function (width, isMulti, isCompact, overrideS
|
|
|
67
67
|
paddingTop: 0,
|
|
68
68
|
padding: 0,
|
|
69
69
|
':hover': {
|
|
70
|
-
color: token('color.
|
|
70
|
+
color: token('color.icon.danger', R400)
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
73
|
},
|
|
@@ -118,4 +118,7 @@ export var isPopupUserPickerByComponent = function isPopupUserPickerByComponent(
|
|
|
118
118
|
};
|
|
119
119
|
export var isPopupUserPickerByProps = function isPopupUserPickerByProps(selectProps) {
|
|
120
120
|
return selectProps.searchThreshold === -1;
|
|
121
|
+
};
|
|
122
|
+
export var isLozengeText = function isLozengeText(lozengeProp) {
|
|
123
|
+
return (lozengeProp === null || lozengeProp === void 0 ? void 0 : lozengeProp.hasOwnProperty('text')) || false;
|
|
121
124
|
};
|
package/dist/esm/version.json
CHANGED
|
@@ -6,6 +6,6 @@ export declare type AvatarItemOptionProps = {
|
|
|
6
6
|
avatar: ReactNode;
|
|
7
7
|
primaryText?: ReactNode;
|
|
8
8
|
secondaryText?: ReactNode;
|
|
9
|
-
lozenge?: LozengeProps;
|
|
9
|
+
lozenge?: ReactNode | LozengeProps;
|
|
10
10
|
};
|
|
11
11
|
export declare const AvatarItemOption: ({ avatar, primaryText, secondaryText, lozenge, }: AvatarItemOptionProps) => JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ReactChild, ReactElement } from 'react';
|
|
2
|
-
import { AtlaskitSelectValue, ExternalUser, Email, Option, OptionData, Promisable, Team, Group, User, OptionIdentifier, DefaultValue } from '../types';
|
|
1
|
+
import { ReactChild, ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { AtlaskitSelectValue, ExternalUser, Email, Option, OptionData, Promisable, Team, Group, User, OptionIdentifier, DefaultValue, LozengeProps } from '../types';
|
|
3
3
|
export declare const isExternalUser: (option: OptionData) => option is ExternalUser;
|
|
4
4
|
export declare const isUser: (option: OptionData) => option is User;
|
|
5
5
|
export declare const isTeam: (option: OptionData) => option is Team;
|
|
@@ -25,3 +25,4 @@ export declare const callCallback: <U extends any[], R>(callback: ((...U: U) =>
|
|
|
25
25
|
export declare const getAvatarUrl: (optionData: OptionData) => string | undefined;
|
|
26
26
|
export declare const isPopupUserPickerByComponent: (SelectComponent: React.ComponentClass<any>) => boolean;
|
|
27
27
|
export declare const isPopupUserPickerByProps: (selectProps: any) => boolean;
|
|
28
|
+
export declare const isLozengeText: (lozengeProp: ReactNode | LozengeProps) => lozengeProp is LozengeProps;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -203,7 +203,7 @@ export interface OptionData {
|
|
|
203
203
|
name: string;
|
|
204
204
|
type?: 'user' | 'team' | 'email' | 'group';
|
|
205
205
|
fixed?: boolean;
|
|
206
|
-
lozenge?: string | LozengeProps;
|
|
206
|
+
lozenge?: string | LozengeProps | ReactNode;
|
|
207
207
|
}
|
|
208
208
|
export declare const UserType = "user";
|
|
209
209
|
export declare type UserSource = 'google' | 'slack' | 'microsoft' | 'github' | 'jira' | 'confluence' | 'other-atlassian';
|
|
@@ -241,6 +241,7 @@ export interface Team extends OptionData {
|
|
|
241
241
|
includesYou?: boolean;
|
|
242
242
|
highlight?: TeamHighlight;
|
|
243
243
|
type: 'team';
|
|
244
|
+
byline?: string;
|
|
244
245
|
}
|
|
245
246
|
export declare const GroupType = "group";
|
|
246
247
|
export interface Group extends OptionData {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/user-picker",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.4.0",
|
|
4
4
|
"description": "Fabric component for display a dropdown to select a user from",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -65,8 +65,8 @@
|
|
|
65
65
|
"@testing-library/dom": "^8.17.1",
|
|
66
66
|
"@testing-library/jest-dom": "^5.16.5",
|
|
67
67
|
"@testing-library/react": "^12.1.5",
|
|
68
|
-
"@testing-library/react-hooks": "^
|
|
69
|
-
"@testing-library/user-event": "^
|
|
68
|
+
"@testing-library/react-hooks": "^8.0.1",
|
|
69
|
+
"@testing-library/user-event": "^14.4.3",
|
|
70
70
|
"@types/uuid": "^3.4.4",
|
|
71
71
|
"enzyme": "^3.10.0",
|
|
72
72
|
"enzyme-react-intl": "^2.0.6",
|
package/report.api.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
## API Report File for "@atlaskit/user-picker"
|
|
1
|
+
## API Report File for "@atlaskit/user-picker"
|
|
2
2
|
|
|
3
|
-
> Do not edit this file.
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
<!--
|
|
6
|
+
Generated API Report version: 2.0
|
|
7
|
+
-->
|
|
4
8
|
|
|
5
9
|
[Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
|
|
6
10
|
|
|
@@ -11,7 +15,8 @@ import { ReactNode } from 'react';
|
|
|
11
15
|
import { StylesConfig } from '@atlaskit/select';
|
|
12
16
|
import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
13
17
|
|
|
14
|
-
|
|
18
|
+
// @public (undocumented)
|
|
19
|
+
export type ActionTypes =
|
|
15
20
|
| 'select-option'
|
|
16
21
|
| 'deselect-option'
|
|
17
22
|
| 'remove-value'
|
|
@@ -20,9 +25,11 @@ export declare type ActionTypes =
|
|
|
20
25
|
| 'clear'
|
|
21
26
|
| 'create-option';
|
|
22
27
|
|
|
23
|
-
|
|
28
|
+
// @public (undocumented)
|
|
29
|
+
export type Appearance = 'normal' | 'compact';
|
|
24
30
|
|
|
25
|
-
|
|
31
|
+
// @public (undocumented)
|
|
32
|
+
export type AtlasKitSelectChange = (
|
|
26
33
|
value: AtlaskitSelectValue,
|
|
27
34
|
extraInfo: {
|
|
28
35
|
removedValue?: Option_2;
|
|
@@ -31,77 +38,92 @@ export declare type AtlasKitSelectChange = (
|
|
|
31
38
|
},
|
|
32
39
|
) => void;
|
|
33
40
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
| Array<Option_2>
|
|
37
|
-
| null
|
|
38
|
-
| undefined;
|
|
41
|
+
// @public (undocumented)
|
|
42
|
+
export type AtlaskitSelectValue = Option_2 | Array<Option_2> | null | undefined;
|
|
39
43
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
| 'window'
|
|
43
|
-
| 'viewport'
|
|
44
|
-
| HTMLElement;
|
|
44
|
+
// @public (undocumented)
|
|
45
|
+
type BoundariesElement = 'scrollParent' | 'window' | 'viewport' | HTMLElement;
|
|
45
46
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
| OptionIdentifier
|
|
49
|
-
| OptionIdentifier[];
|
|
47
|
+
// @public (undocumented)
|
|
48
|
+
export type DefaultValue = Value | OptionIdentifier | OptionIdentifier[];
|
|
50
49
|
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
// @public (undocumented)
|
|
51
|
+
export interface Email extends OptionData {
|
|
52
|
+
// (undocumented)
|
|
53
53
|
suggestion?: boolean;
|
|
54
|
+
// (undocumented)
|
|
55
|
+
type: 'email';
|
|
54
56
|
}
|
|
55
57
|
|
|
56
|
-
|
|
58
|
+
// @public (undocumented)
|
|
59
|
+
export const EmailType = 'email';
|
|
57
60
|
|
|
58
|
-
|
|
61
|
+
// @public (undocumented)
|
|
62
|
+
export type EmailValidationResponse = 'INVALID' | 'POTENTIAL' | 'VALID';
|
|
59
63
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
) => EmailValidationResponse;
|
|
64
|
+
// @public (undocumented)
|
|
65
|
+
export type EmailValidator = (inputText: string) => EmailValidationResponse;
|
|
63
66
|
|
|
64
|
-
|
|
67
|
+
// @public (undocumented)
|
|
68
|
+
export interface ExternalUser extends User {
|
|
69
|
+
// (undocumented)
|
|
65
70
|
externalUserType?: 'crossSite' | 'thirdParty';
|
|
71
|
+
// (undocumented)
|
|
66
72
|
requiresSourceHydration?: boolean;
|
|
73
|
+
// (undocumented)
|
|
67
74
|
sources: UserSource[];
|
|
68
75
|
}
|
|
69
76
|
|
|
70
|
-
|
|
77
|
+
// @public (undocumented)
|
|
78
|
+
export interface Group extends OptionData {
|
|
79
|
+
// (undocumented)
|
|
71
80
|
highlight?: GroupHighlight;
|
|
81
|
+
// (undocumented)
|
|
72
82
|
type: 'group';
|
|
73
83
|
}
|
|
74
84
|
|
|
75
|
-
|
|
85
|
+
// @public (undocumented)
|
|
86
|
+
export interface GroupHighlight {
|
|
87
|
+
// (undocumented)
|
|
76
88
|
name: HighlightRange[];
|
|
77
89
|
}
|
|
78
90
|
|
|
79
|
-
|
|
91
|
+
// @public (undocumented)
|
|
92
|
+
export const GroupType = 'group';
|
|
80
93
|
|
|
81
|
-
|
|
82
|
-
|
|
94
|
+
// @public (undocumented)
|
|
95
|
+
export interface HighlightRange {
|
|
96
|
+
// (undocumented)
|
|
83
97
|
end: number;
|
|
98
|
+
// (undocumented)
|
|
99
|
+
start: number;
|
|
84
100
|
}
|
|
85
101
|
|
|
86
|
-
|
|
102
|
+
// @public (undocumented)
|
|
103
|
+
export type InputActionTypes =
|
|
87
104
|
| 'set-value'
|
|
88
105
|
| 'input-change'
|
|
89
106
|
| 'input-blur'
|
|
90
107
|
| 'menu-close';
|
|
91
108
|
|
|
92
|
-
|
|
109
|
+
// @public (undocumented)
|
|
110
|
+
export const isEmail: (option: OptionData) => option is Email;
|
|
93
111
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
) => option is ExternalUser;
|
|
112
|
+
// @public (undocumented)
|
|
113
|
+
export const isExternalUser: (option: OptionData) => option is ExternalUser;
|
|
97
114
|
|
|
98
|
-
|
|
115
|
+
// @public (undocumented)
|
|
116
|
+
export const isTeam: (option: OptionData) => option is Team;
|
|
99
117
|
|
|
100
|
-
|
|
118
|
+
// @public (undocumented)
|
|
119
|
+
export const isUser: (option: OptionData) => option is User;
|
|
101
120
|
|
|
102
|
-
|
|
121
|
+
// @public (undocumented)
|
|
122
|
+
export const isValidEmail: EmailValidator;
|
|
103
123
|
|
|
104
|
-
|
|
124
|
+
// @public (undocumented)
|
|
125
|
+
export interface LoadOptions {
|
|
126
|
+
// (undocumented)
|
|
105
127
|
(searchText?: string, sessionId?: string):
|
|
106
128
|
| Promisable<OptionData | OptionData[]>
|
|
107
129
|
| Iterable<
|
|
@@ -109,11 +131,14 @@ export declare interface LoadOptions {
|
|
|
109
131
|
>;
|
|
110
132
|
}
|
|
111
133
|
|
|
112
|
-
|
|
134
|
+
// @public (undocumented)
|
|
135
|
+
interface LoadUserSource {
|
|
136
|
+
// (undocumented)
|
|
113
137
|
(accountId: string, signal?: AbortSignal): Promise<UserSourceResult[]>;
|
|
114
138
|
}
|
|
115
139
|
|
|
116
|
-
|
|
140
|
+
// @public (undocumented)
|
|
141
|
+
type LozengeColor =
|
|
117
142
|
| 'default'
|
|
118
143
|
| 'success'
|
|
119
144
|
| 'removed'
|
|
@@ -121,43 +146,59 @@ declare type LozengeColor =
|
|
|
121
146
|
| 'new'
|
|
122
147
|
| 'moved';
|
|
123
148
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
149
|
+
// @public (undocumented)
|
|
150
|
+
export interface LozengeProps {
|
|
151
|
+
// (undocumented)
|
|
127
152
|
appearance?: LozengeColor;
|
|
153
|
+
// (undocumented)
|
|
128
154
|
isBold?: boolean;
|
|
155
|
+
// (undocumented)
|
|
156
|
+
text: string;
|
|
157
|
+
// (undocumented)
|
|
158
|
+
tooltip?: string;
|
|
129
159
|
}
|
|
130
160
|
|
|
131
|
-
|
|
161
|
+
// @public (undocumented)
|
|
162
|
+
export type OnChange = (value: Value, action: ActionTypes) => void;
|
|
132
163
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
sessionId?: string,
|
|
136
|
-
) => void;
|
|
164
|
+
// @public (undocumented)
|
|
165
|
+
export type OnInputChange = (query?: string, sessionId?: string) => void;
|
|
137
166
|
|
|
138
|
-
|
|
167
|
+
// @public (undocumented)
|
|
168
|
+
export type OnOption = (value: Value, sessionId?: string) => void;
|
|
139
169
|
|
|
140
|
-
|
|
170
|
+
// @public (undocumented)
|
|
171
|
+
export type OnPicker = (sessionId?: string) => void;
|
|
141
172
|
|
|
142
|
-
|
|
173
|
+
// @public (undocumented)
|
|
174
|
+
type Option_2<Data = OptionData> = {
|
|
143
175
|
label: string;
|
|
144
176
|
value: string;
|
|
145
177
|
data: Data;
|
|
146
178
|
};
|
|
147
179
|
export { Option_2 as Option };
|
|
148
180
|
|
|
149
|
-
|
|
181
|
+
// @public (undocumented)
|
|
182
|
+
export interface OptionData {
|
|
183
|
+
// (undocumented)
|
|
150
184
|
avatarUrl?: any;
|
|
185
|
+
// (undocumented)
|
|
186
|
+
fixed?: boolean;
|
|
187
|
+
// (undocumented)
|
|
151
188
|
id: string;
|
|
189
|
+
// (undocumented)
|
|
190
|
+
lozenge?: string | LozengeProps | ReactNode;
|
|
191
|
+
// (undocumented)
|
|
152
192
|
name: string;
|
|
193
|
+
// (undocumented)
|
|
153
194
|
type?: 'user' | 'team' | 'email' | 'group';
|
|
154
|
-
fixed?: boolean;
|
|
155
|
-
lozenge?: string | LozengeProps;
|
|
156
195
|
}
|
|
157
196
|
|
|
158
|
-
|
|
197
|
+
// @public (undocumented)
|
|
198
|
+
export type OptionIdentifier = Pick<OptionData, 'id' | 'type'>;
|
|
159
199
|
|
|
160
|
-
|
|
200
|
+
// @public (undocumented)
|
|
201
|
+
export const PopupUserPicker: React_2.ForwardRefExoticComponent<
|
|
161
202
|
Pick<
|
|
162
203
|
Omit<PopupUserPickerProps, keyof WithAnalyticsEventsProps>,
|
|
163
204
|
| 'target'
|
|
@@ -237,86 +278,93 @@ export declare const PopupUserPicker: React_2.ForwardRefExoticComponent<
|
|
|
237
278
|
React_2.RefAttributes<any>
|
|
238
279
|
>;
|
|
239
280
|
|
|
240
|
-
|
|
241
|
-
|
|
281
|
+
// @public (undocumented)
|
|
282
|
+
export type PopupUserPickerProps = UserPickerProps & {
|
|
242
283
|
target: Target;
|
|
243
|
-
/** Optional title assigned to popup picker */
|
|
244
284
|
popupTitle?: string;
|
|
245
|
-
/**
|
|
246
|
-
* The boundary element that the popup will check for overflow.
|
|
247
|
-
* Defaults to `"viewport"` which are parent scroll containers,
|
|
248
|
-
* but can be set to any element.
|
|
249
|
-
*/
|
|
250
285
|
boundariesElement?: BoundariesElement;
|
|
251
|
-
/**
|
|
252
|
-
* Distance the popup should be offset from the reference in the format of [along, away] (units in px).
|
|
253
|
-
*/
|
|
254
286
|
offset?: [number, number];
|
|
255
|
-
/**
|
|
256
|
-
* Placement of where the popup should be displayed relative to the trigger element.
|
|
257
|
-
* Defaults to `"auto"`.
|
|
258
|
-
*/
|
|
259
287
|
placement?: Placement;
|
|
260
|
-
/**
|
|
261
|
-
* The root boundary that the popup will check for overflow.
|
|
262
|
-
* Defaults to `"viewport"` but can be set to `"document"`.
|
|
263
|
-
* See `@atlaskit/popper` for further details.
|
|
264
|
-
*/
|
|
265
288
|
rootBoundary?: RootBoundary;
|
|
266
|
-
/**
|
|
267
|
-
* Allows the dropdown menu to be placed on the opposite side of its trigger if it does not
|
|
268
|
-
* fit in the viewport.
|
|
269
|
-
*/
|
|
270
289
|
shouldFlip?: boolean;
|
|
271
290
|
};
|
|
272
291
|
|
|
273
|
-
|
|
292
|
+
// @public (undocumented)
|
|
293
|
+
export type Promisable<T> = T | PromiseLike<T>;
|
|
274
294
|
|
|
275
|
-
|
|
295
|
+
// @public (undocumented)
|
|
296
|
+
type RootBoundary = 'viewport' | 'document';
|
|
276
297
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
isOpen: boolean;
|
|
280
|
-
}) => ReactNode;
|
|
298
|
+
// @public (undocumented)
|
|
299
|
+
export type Target = (options: { ref: any; isOpen: boolean }) => ReactNode;
|
|
281
300
|
|
|
282
|
-
|
|
301
|
+
// @public (undocumented)
|
|
302
|
+
export interface Team extends OptionData {
|
|
303
|
+
// (undocumented)
|
|
283
304
|
avatarUrl?: string;
|
|
305
|
+
// (undocumented)
|
|
306
|
+
byline?: string;
|
|
307
|
+
// (undocumented)
|
|
284
308
|
description?: string;
|
|
309
|
+
// (undocumented)
|
|
310
|
+
highlight?: TeamHighlight;
|
|
311
|
+
// (undocumented)
|
|
312
|
+
includesYou?: boolean;
|
|
313
|
+
// (undocumented)
|
|
285
314
|
memberCount?: number;
|
|
315
|
+
// (undocumented)
|
|
286
316
|
members?: TeamMember[];
|
|
287
|
-
|
|
288
|
-
highlight?: TeamHighlight;
|
|
317
|
+
// (undocumented)
|
|
289
318
|
type: 'team';
|
|
290
319
|
}
|
|
291
320
|
|
|
292
|
-
|
|
293
|
-
|
|
321
|
+
// @public (undocumented)
|
|
322
|
+
export interface TeamHighlight {
|
|
323
|
+
// (undocumented)
|
|
294
324
|
description?: HighlightRange[];
|
|
325
|
+
// (undocumented)
|
|
326
|
+
name: HighlightRange[];
|
|
295
327
|
}
|
|
296
328
|
|
|
297
|
-
|
|
298
|
-
|
|
329
|
+
// @public (undocumented)
|
|
330
|
+
export interface TeamMember {
|
|
331
|
+
// (undocumented)
|
|
299
332
|
id: string;
|
|
333
|
+
// (undocumented)
|
|
334
|
+
name: string;
|
|
300
335
|
}
|
|
301
336
|
|
|
302
|
-
|
|
337
|
+
// @public (undocumented)
|
|
338
|
+
export const TeamType = 'team';
|
|
303
339
|
|
|
304
|
-
|
|
340
|
+
// @public (undocumented)
|
|
341
|
+
export interface User extends OptionData {
|
|
342
|
+
// (undocumented)
|
|
305
343
|
avatarUrl?: string;
|
|
306
|
-
|
|
307
|
-
highlight?: UserHighlight;
|
|
344
|
+
// (undocumented)
|
|
308
345
|
byline?: string;
|
|
309
|
-
|
|
346
|
+
// (undocumented)
|
|
310
347
|
email?: string;
|
|
348
|
+
// (undocumented)
|
|
349
|
+
highlight?: UserHighlight;
|
|
350
|
+
// (undocumented)
|
|
311
351
|
isExternal?: boolean;
|
|
352
|
+
// (undocumented)
|
|
353
|
+
publicName?: string;
|
|
354
|
+
// (undocumented)
|
|
355
|
+
type?: 'user';
|
|
312
356
|
}
|
|
313
357
|
|
|
314
|
-
|
|
358
|
+
// @public (undocumented)
|
|
359
|
+
export interface UserHighlight {
|
|
360
|
+
// (undocumented)
|
|
315
361
|
name: HighlightRange[];
|
|
362
|
+
// (undocumented)
|
|
316
363
|
publicName: HighlightRange[];
|
|
317
364
|
}
|
|
318
365
|
|
|
319
|
-
|
|
366
|
+
// @public (undocumented)
|
|
367
|
+
const UserPicker: React_2.ForwardRefExoticComponent<
|
|
320
368
|
Pick<
|
|
321
369
|
Omit<UserPickerProps, keyof WithAnalyticsEventsProps>,
|
|
322
370
|
| 'autoFocus'
|
|
@@ -384,143 +432,62 @@ declare const UserPicker: React_2.ForwardRefExoticComponent<
|
|
|
384
432
|
>;
|
|
385
433
|
export default UserPicker;
|
|
386
434
|
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
* Used to configure additional information regarding where the
|
|
390
|
-
* user picker has been mounted.
|
|
391
|
-
*
|
|
392
|
-
* The purpose is to give more context as to where user picker events
|
|
393
|
-
* are being fired from, as the current data may not uniquely identify
|
|
394
|
-
* which field is the source.
|
|
395
|
-
*
|
|
396
|
-
* The value will be passed as a data attribute for analytics.
|
|
397
|
-
* Examples include "assignee", "watchers" and "share".
|
|
398
|
-
*
|
|
399
|
-
* A second usage for the fieldId is for server side rendering (SSR) where it must be a unique id per UserPicker
|
|
400
|
-
* instance contained in the serialized SSR content. E.g. a SPA page rendered through SSR that has multiple user pickers.
|
|
401
|
-
*
|
|
402
|
-
* fieldId can be set to null if the integrator is not listening
|
|
403
|
-
* for the analytic events or does not care about SSR.
|
|
404
|
-
*/
|
|
435
|
+
// @public (undocumented)
|
|
436
|
+
export type UserPickerProps = WithAnalyticsEventsProps & {
|
|
405
437
|
fieldId: string | null;
|
|
406
|
-
/** List of users or teams to be used as options by the user picker. */
|
|
407
438
|
options?: OptionData[];
|
|
408
|
-
/** Width of the user picker field. It can be the amount of pixels as numbers or a string with the percentage. */
|
|
409
439
|
width?: number | string;
|
|
410
|
-
/** Sets the minimum width for the menu. If not set, menu will always have the same width of the field. */
|
|
411
440
|
menuMinWidth?: number;
|
|
412
|
-
/** Sets max height of the user picker. If not set, the height will grow based on number of picked users. */
|
|
413
441
|
maxPickerHeight?: number;
|
|
414
|
-
/** Sets the background color to be the same color as a textfield (Atlaskit N10) */
|
|
415
442
|
textFieldBackgroundColor?: boolean;
|
|
416
|
-
/**
|
|
417
|
-
* Function used to load options asynchronously.
|
|
418
|
-
* accepts two optional params:
|
|
419
|
-
* searchText?: optional text to filter results
|
|
420
|
-
* sessionId?: user picker session identifier, used to track success metric for users providers
|
|
421
|
-
*/
|
|
422
443
|
loadOptions?: LoadOptions;
|
|
423
|
-
/**
|
|
424
|
-
* Function used to load user source if they are an external user.
|
|
425
|
-
* accepts two params:
|
|
426
|
-
* accountId: account ID of the user to lookup sources
|
|
427
|
-
* signal: AbortController signal to abort the request if the tooltip is closed
|
|
428
|
-
*/
|
|
429
444
|
loadUserSource?: LoadUserSource;
|
|
430
|
-
/** Callback for value change events fired whenever a selection is inserted or removed. */
|
|
431
445
|
onChange?: OnChange;
|
|
432
|
-
/** To enable multi user picker. */
|
|
433
446
|
isMulti?: boolean;
|
|
434
|
-
/** Input text value. */
|
|
435
447
|
search?: string;
|
|
436
|
-
/** Anchor for the user picker popup. */
|
|
437
448
|
anchor?: React_2.ComponentType<any>;
|
|
438
|
-
/** Controls if user picker menu is open or not. If not provided, UserPicker will control menu state internally. */
|
|
439
449
|
open?: boolean;
|
|
440
|
-
/** Show the loading indicator. */
|
|
441
450
|
isLoading?: boolean;
|
|
442
|
-
/** Callback for search input text change events. */
|
|
443
451
|
onInputChange?: OnInputChange;
|
|
444
|
-
/** Callback for when a selection is made. */
|
|
445
452
|
onSelection?: OnOption;
|
|
446
|
-
/** Callback for when the field gains focus. */
|
|
447
453
|
onFocus?: OnPicker;
|
|
448
|
-
/** Callback for when the field loses focus. */
|
|
449
454
|
onBlur?: OnPicker;
|
|
450
|
-
/** Callback for when the value/s in the picker is cleared. */
|
|
451
455
|
onClear?: OnPicker;
|
|
452
|
-
/** Callback that is triggered when popup picker is closed */
|
|
453
456
|
onClose?: OnPicker;
|
|
454
|
-
/** Appearance of the user picker. */
|
|
455
457
|
appearance?: Appearance;
|
|
456
|
-
/** Display the picker with a subtle style. */
|
|
457
458
|
subtle?: boolean;
|
|
458
|
-
/** Display the picker with no border. */
|
|
459
459
|
noBorder?: boolean;
|
|
460
|
-
/**
|
|
461
|
-
* You may pass through a `StylesConfig` to be merged with the picker default styles if a custom override is required.
|
|
462
|
-
* Consider using noBorder, subtle before customising further.
|
|
463
|
-
* See https://react-select.com/styles
|
|
464
|
-
*/
|
|
465
460
|
styles?: StylesConfig;
|
|
466
|
-
/** Default value for the field to be used on initial render.
|
|
467
|
-
* `defaultValue` differs from `value` in that it sets the initial value then leaves the component 'uncontrolled'
|
|
468
|
-
* whereas setting the `value` prop delegates responsibility for maintaining the value to the caller
|
|
469
|
-
* (i.e. listen to `onChange`) */
|
|
470
461
|
defaultValue?: DefaultValue;
|
|
471
|
-
/** Placeholder text to be shown when there is no value in the field. */
|
|
472
462
|
placeholder?: React_2.ReactNode;
|
|
473
|
-
/** Message to encourage the user to add more items to user picker. */
|
|
474
463
|
addMoreMessage?: string;
|
|
475
|
-
/** Message to be shown when the menu is open but no options are provided.
|
|
476
|
-
* If message is null, no message will be displayed.
|
|
477
|
-
* If message is undefined, default message will be displayed.
|
|
478
|
-
*/
|
|
479
464
|
noOptionsMessage?:
|
|
480
465
|
| ((value: { inputValue: string }) => string | null)
|
|
481
466
|
| string
|
|
482
467
|
| null;
|
|
483
|
-
/** Controls if the user picker has a value or not. If not provided, UserPicker will control the value internally. */
|
|
484
468
|
value?: Value;
|
|
485
|
-
/** Disable all interactions with the picker, putting it in a read-only state. */
|
|
486
469
|
isDisabled?: boolean;
|
|
487
|
-
/** Display a remove button on the single picker. True by default. */
|
|
488
470
|
isClearable?: boolean;
|
|
489
|
-
/** Optional tooltip to display on hover over the clear indicator. */
|
|
490
471
|
clearValueLabel?: string;
|
|
491
|
-
/** React-select prop for controlling menu position */
|
|
492
472
|
menuPosition?: 'absolute' | 'fixed';
|
|
493
|
-
/** React-select prop for blocking menu scroll on container when menu scrolled to the very top/bottom of the menu */
|
|
494
473
|
captureMenuScroll?: boolean;
|
|
495
|
-
/** Whether the menu should use a portal, and where it should attach. */
|
|
496
474
|
menuPortalTarget?: HTMLElement;
|
|
497
|
-
/** Whether the user is allowed to enter emails as a value. */
|
|
498
475
|
allowEmail?: boolean;
|
|
499
|
-
/** Setting this with allowEmail will cause the picker to constantly show an email option at the bottom for the supplied email domain/an email the user types in */
|
|
500
476
|
suggestEmailsForDomain?: string;
|
|
501
|
-
/** Email option label */
|
|
502
477
|
emailLabel?: string;
|
|
503
|
-
/** Whether to disable interaction with the input */
|
|
504
478
|
disableInput?: boolean;
|
|
505
|
-
/** Override default email validation function. */
|
|
506
479
|
isValidEmail?: EmailValidator;
|
|
507
|
-
/** Override the internal behaviour to automatically focus the control when the picker is open */
|
|
508
480
|
autoFocus?: boolean;
|
|
509
|
-
/** The maximum number options to be displayed in the dropdown menu during any state of search. The value should be non-negative. */
|
|
510
481
|
maxOptions?: number;
|
|
511
|
-
/** Allows clicking on a label with the same id to open user picker. */
|
|
512
482
|
inputId?: string;
|
|
513
|
-
/** Whether to close menu on scroll */
|
|
514
483
|
closeMenuOnScroll?: boolean | EventListener;
|
|
515
|
-
/** Whether to block scrolling actions */
|
|
516
484
|
menuShouldBlockScroll?: boolean;
|
|
517
|
-
/** Accessibility: Identifies the element (or elements) that labels the current element.*/
|
|
518
485
|
ariaLabelledBy?: string;
|
|
519
|
-
/** Accessibility: Used to set the priority with which screen reader should treat updates to live regions.*/
|
|
520
486
|
ariaLive?: 'polite' | 'off' | 'assertive';
|
|
521
487
|
};
|
|
522
488
|
|
|
523
|
-
|
|
489
|
+
// @public (undocumented)
|
|
490
|
+
export type UserPickerState = {
|
|
524
491
|
options: OptionData[];
|
|
525
492
|
value?: AtlaskitSelectValue;
|
|
526
493
|
isDefaultSet: boolean;
|
|
@@ -532,7 +499,8 @@ export declare type UserPickerState = {
|
|
|
532
499
|
resolving: boolean;
|
|
533
500
|
};
|
|
534
501
|
|
|
535
|
-
|
|
502
|
+
// @public (undocumented)
|
|
503
|
+
export type UserSource =
|
|
536
504
|
| 'google'
|
|
537
505
|
| 'slack'
|
|
538
506
|
| 'microsoft'
|
|
@@ -541,14 +509,19 @@ export declare type UserSource =
|
|
|
541
509
|
| 'confluence'
|
|
542
510
|
| 'other-atlassian';
|
|
543
511
|
|
|
544
|
-
|
|
512
|
+
// @public (undocumented)
|
|
513
|
+
interface UserSourceResult {
|
|
514
|
+
// (undocumented)
|
|
545
515
|
sourceId: string;
|
|
516
|
+
// (undocumented)
|
|
546
517
|
sourceType: UserSource;
|
|
547
518
|
}
|
|
548
519
|
|
|
549
|
-
|
|
520
|
+
// @public (undocumented)
|
|
521
|
+
export const UserType = 'user';
|
|
550
522
|
|
|
551
|
-
|
|
523
|
+
// @public (undocumented)
|
|
524
|
+
export type Value = OptionData | OptionData[] | null | undefined;
|
|
552
525
|
|
|
553
|
-
|
|
526
|
+
// (No @packageDocumentation comment for this package)
|
|
554
527
|
```
|
package/types/package.json
CHANGED
|
@@ -4,5 +4,12 @@
|
|
|
4
4
|
"module": "../dist/esm/types.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/types.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/types.d.ts"
|
|
7
|
+
"types": "../dist/types/types.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.0 <4.3": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.0/types.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
8
15
|
}
|