@atlaskit/user-picker 8.6.2 → 8.6.3
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 +6 -0
- package/dist/cjs/components/BaseUserPicker.js +1 -1
- package/dist/cjs/components/utils.js +7 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/BaseUserPicker.js +2 -2
- package/dist/es2019/components/utils.js +1 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/BaseUserPicker.js +2 -2
- package/dist/esm/components/utils.js +3 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/components/utils.d.ts +1 -0
- package/dist/types/types.d.ts +0 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/user-picker
|
|
2
2
|
|
|
3
|
+
## 8.6.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`6503f21cfc0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6503f21cfc0) - [ux] Fix defaultValue behavior for user-picker and smart-user-picker. user-picker previously advertised hydrating default values if provided in unhydrated form. This was never the case; it is only hydrated from smart-user-picker. defaultValue would also be ignored if provided as a single OptionValue despite the typing being advertised as supporting it - this is now fixed.
|
|
8
|
+
|
|
3
9
|
## 8.6.2
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -553,7 +553,7 @@ var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
|
|
|
553
553
|
|
|
554
554
|
if (nextProps.value !== undefined) {
|
|
555
555
|
derivedState.value = (0, _utils.optionToSelectableOptions)(nextProps.value);
|
|
556
|
-
} else if (
|
|
556
|
+
} else if ((0, _utils.isDefaultValuePopulated)(nextProps.defaultValue) && !prevState.isDefaultSet) {
|
|
557
557
|
derivedState.value = (0, _utils.optionToSelectableOptions)(nextProps.defaultValue);
|
|
558
558
|
derivedState.isDefaultSet = true;
|
|
559
559
|
}
|
|
@@ -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.userPickerRenderedUfoExperience = exports.optionToSelectableOptions = exports.optionToSelectableOption = exports.isUser = exports.isTeam = exports.isSingleValue = exports.isPopupUserPickerByProps = exports.isPopupUserPickerByComponent = exports.isIterable = exports.isGroup = exports.isExternalUser = exports.isEmail = exports.isChildInput = exports.hasValue = exports.getOptions = exports.getAvatarUrl = exports.getAvatarSize = exports.extractOptionValue = exports.callCallback = void 0;
|
|
8
|
+
exports.userPickerRenderedUfoExperience = 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;
|
|
9
9
|
|
|
10
10
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11
11
|
|
|
@@ -53,6 +53,12 @@ var isEmail = function isEmail(option) {
|
|
|
53
53
|
|
|
54
54
|
exports.isEmail = isEmail;
|
|
55
55
|
|
|
56
|
+
var isDefaultValuePopulated = function isDefaultValuePopulated(value) {
|
|
57
|
+
return value && !Array.isArray(value) || Array.isArray(value) && value.length > 0;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
exports.isDefaultValuePopulated = isDefaultValuePopulated;
|
|
61
|
+
|
|
56
62
|
var isOptionData = function isOptionData(option) {
|
|
57
63
|
return option.name !== undefined;
|
|
58
64
|
};
|
package/dist/cjs/version.json
CHANGED
|
@@ -7,7 +7,7 @@ import { FormattedMessage } from 'react-intl-next';
|
|
|
7
7
|
import { cancelEvent, clearEvent, createAndFireEventInElementsChannel, deleteEvent, failedEvent, focusEvent, searchedEvent, selectEvent, startSession } from '../analytics';
|
|
8
8
|
import { batchByKey } from './batch';
|
|
9
9
|
import { messages } from './i18n';
|
|
10
|
-
import { callCallback, extractOptionValue, getOptions, isIterable, isPopupUserPickerByComponent, isSingleValue, optionToSelectableOptions } from './utils';
|
|
10
|
+
import { callCallback, extractOptionValue, getOptions, isIterable, isPopupUserPickerByComponent, isDefaultValuePopulated, isSingleValue, optionToSelectableOptions } from './utils';
|
|
11
11
|
|
|
12
12
|
const loadingMessage = () => null;
|
|
13
13
|
|
|
@@ -21,7 +21,7 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
|
|
|
21
21
|
|
|
22
22
|
if (nextProps.value !== undefined) {
|
|
23
23
|
derivedState.value = optionToSelectableOptions(nextProps.value);
|
|
24
|
-
} else if (
|
|
24
|
+
} else if (isDefaultValuePopulated(nextProps.defaultValue) && !prevState.isDefaultSet) {
|
|
25
25
|
derivedState.value = optionToSelectableOptions(nextProps.defaultValue);
|
|
26
26
|
derivedState.isDefaultSet = true;
|
|
27
27
|
}
|
|
@@ -7,6 +7,7 @@ export const isUser = option => option.type === undefined || option.type === Use
|
|
|
7
7
|
export const isTeam = option => option.type === TeamType;
|
|
8
8
|
export const isGroup = option => option.type === GroupType;
|
|
9
9
|
export const isEmail = option => option.type === EmailType;
|
|
10
|
+
export const isDefaultValuePopulated = value => value && !Array.isArray(value) || Array.isArray(value) && value.length > 0;
|
|
10
11
|
|
|
11
12
|
const isOptionData = option => option.name !== undefined;
|
|
12
13
|
|
package/dist/es2019/version.json
CHANGED
|
@@ -24,7 +24,7 @@ import { FormattedMessage } from 'react-intl-next';
|
|
|
24
24
|
import { cancelEvent, clearEvent, createAndFireEventInElementsChannel, deleteEvent, failedEvent, focusEvent, searchedEvent, selectEvent, startSession } from '../analytics';
|
|
25
25
|
import { batchByKey } from './batch';
|
|
26
26
|
import { messages } from './i18n';
|
|
27
|
-
import { callCallback, extractOptionValue, getOptions, isIterable, isPopupUserPickerByComponent, isSingleValue, optionToSelectableOptions } from './utils';
|
|
27
|
+
import { callCallback, extractOptionValue, getOptions, isIterable, isPopupUserPickerByComponent, isDefaultValuePopulated, isSingleValue, optionToSelectableOptions } from './utils';
|
|
28
28
|
|
|
29
29
|
var loadingMessage = function loadingMessage() {
|
|
30
30
|
return null;
|
|
@@ -556,7 +556,7 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
|
|
|
556
556
|
|
|
557
557
|
if (nextProps.value !== undefined) {
|
|
558
558
|
derivedState.value = optionToSelectableOptions(nextProps.value);
|
|
559
|
-
} else if (
|
|
559
|
+
} else if (isDefaultValuePopulated(nextProps.defaultValue) && !prevState.isDefaultSet) {
|
|
560
560
|
derivedState.value = optionToSelectableOptions(nextProps.defaultValue);
|
|
561
561
|
derivedState.isDefaultSet = true;
|
|
562
562
|
}
|
|
@@ -24,6 +24,9 @@ export var isGroup = function isGroup(option) {
|
|
|
24
24
|
export var isEmail = function isEmail(option) {
|
|
25
25
|
return option.type === EmailType;
|
|
26
26
|
};
|
|
27
|
+
export var isDefaultValuePopulated = function isDefaultValuePopulated(value) {
|
|
28
|
+
return value && !Array.isArray(value) || Array.isArray(value) && value.length > 0;
|
|
29
|
+
};
|
|
27
30
|
|
|
28
31
|
var isOptionData = function isOptionData(option) {
|
|
29
32
|
return option.name !== undefined;
|
package/dist/esm/version.json
CHANGED
|
@@ -6,6 +6,7 @@ export declare const isUser: (option: OptionData) => option is User;
|
|
|
6
6
|
export declare const isTeam: (option: OptionData) => option is Team;
|
|
7
7
|
export declare const isGroup: (option: OptionData) => option is Group;
|
|
8
8
|
export declare const isEmail: (option: OptionData) => option is Email;
|
|
9
|
+
export declare const isDefaultValuePopulated: (value?: DefaultValue) => boolean;
|
|
9
10
|
export declare const optionToSelectableOption: (option: OptionData | OptionIdentifier) => Option;
|
|
10
11
|
export declare const extractOptionValue: (value: AtlaskitSelectValue) => OptionData | OptionData[] | undefined;
|
|
11
12
|
export declare const isIterable: (a: any) => a is Iterable<Promisable<OptionData | OptionData[]>>;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -83,12 +83,6 @@ export declare type UserPickerProps = WithAnalyticsEventsProps & {
|
|
|
83
83
|
*/
|
|
84
84
|
styles?: StylesConfig;
|
|
85
85
|
/** Default value for the field to be used on initial render.
|
|
86
|
-
* If the `DefaultValue` contains only an `id` and `type` (it conforms to an `OptionIdentifier`)
|
|
87
|
-
* then the values will be automatically hydrated from the backend.
|
|
88
|
-
* If the value has a `name` then it is considered hydrated.
|
|
89
|
-
* If `defaultValue` is an array then only the first item is checked and the rest
|
|
90
|
-
* are assumed to conform.
|
|
91
|
-
* Hydration is only supported for Confluence and Jira.
|
|
92
86
|
* `defaultValue` differs from `value` in that it sets the initial value then leaves the component 'uncontrolled'
|
|
93
87
|
* whereas setting the `value` prop delegates responsibility for maintaining the value to the caller
|
|
94
88
|
* (i.e. listen to `onChange`) */
|