@atlaskit/user-picker 9.3.2 → 9.3.5

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 CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/user-picker
2
2
 
3
+ ## 9.3.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [`45da4e093b9`](https://bitbucket.org/atlassian/atlassian-frontend/commits/45da4e093b9) - [ux] User picker now shows the "X" clear indicator on mobile, which previously wasn't working because hover was required which doesn't work on mobile.
8
+
9
+ ## 9.3.4
10
+
11
+ ### Patch Changes
12
+
13
+ - [`dbff164b600`](https://bitbucket.org/atlassian/atlassian-frontend/commits/dbff164b600) - [ux] Fix for appearance=compact not being applied correctly to user pickers
14
+
15
+ ## 9.3.3
16
+
17
+ ### Patch Changes
18
+
19
+ - [`2c7609cef36`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2c7609cef36) - onSelection prop is now also called for user pickers where isMulti=true. Previously onSelection was only called for user picker where isMulti was false
20
+
3
21
  ## 9.3.2
4
22
 
5
23
  ### Patch Changes
@@ -119,8 +119,8 @@ var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
119
119
 
120
120
  switch (action) {
121
121
  case 'select-option':
122
- if (value && !Array.isArray(value)) {
123
- (0, _utils.callCallback)(onSelection, value.data, _this.getSessionId());
122
+ if (value) {
123
+ (0, _utils.callCallback)(onSelection, (0, _utils.extractOptionValue)(value), _this.getSessionId());
124
124
  }
125
125
 
126
126
  _this.fireEvent(_analytics.selectEvent, isMulti ? option : value);
@@ -125,7 +125,7 @@ var UserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component) {
125
125
  }, /*#__PURE__*/_react.default.createElement(_BaseUserPicker.BaseUserPickerWithoutAnalytics, (0, _extends2.default)({}, this.props, {
126
126
  width: width,
127
127
  SelectComponent: SelectComponent,
128
- styles: (0, _styles.getStyles)(width, isMulti, this.props.styles),
128
+ styles: (0, _styles.getStyles)(width, isMulti, this.props.appearance === 'compact', this.props.styles),
129
129
  components: (0, _components.getComponents)(isMulti, anchor),
130
130
  pickerProps: pickerProps
131
131
  })))));
@@ -39,7 +39,7 @@ var INDICATOR_WIDTH = 39;
39
39
  exports.INDICATOR_WIDTH = INDICATOR_WIDTH;
40
40
  var TOTAL_PADDING_TAG_TO_CONTAINER = 10;
41
41
  var TAG_MARGIN_WIDTH = 4;
42
- var getStyles = (0, _memoizeOne.default)(function (width, isMulti, overrideStyles) {
42
+ var getStyles = (0, _memoizeOne.default)(function (width, isMulti, isCompact, overrideStyles) {
43
43
  var styles = {
44
44
  menu: function menu(css, state) {
45
45
  return _objectSpread(_objectSpread({}, css), {}, {
@@ -48,7 +48,6 @@ var getStyles = (0, _memoizeOne.default)(function (width, isMulti, overrideStyle
48
48
  });
49
49
  },
50
50
  control: function control(css, state) {
51
- var isCompact = state.selectProps.appearance === 'compact';
52
51
  var isMulti = state.selectProps.isMulti;
53
52
  return _objectSpread(_objectSpread({}, css), {}, {
54
53
  width: width,
@@ -77,7 +76,12 @@ var getStyles = (0, _memoizeOne.default)(function (width, isMulti, overrideStyle
77
76
  paddingRight = _ref.paddingRight,
78
77
  css = (0, _objectWithoutProperties2.default)(_ref, _excluded);
79
78
  return _objectSpread(_objectSpread({}, css), {}, {
80
- opacity: 0,
79
+ // By default show clear indicator, except for on devices where "hover" is supported.
80
+ // This means mobile devices (which do not support hover) will be able to see the clear indicator.
81
+ opacity: 1,
82
+ '@media (hover: hover) and (pointer: fine)': {
83
+ opacity: 0
84
+ },
81
85
  transition: css.transition + ', opacity 150ms',
82
86
  paddingTop: 0,
83
87
  padding: 0,
@@ -96,7 +100,6 @@ var getStyles = (0, _memoizeOne.default)(function (width, isMulti, overrideStyle
96
100
  paddingBottom = _ref2.paddingBottom,
97
101
  position = _ref2.position,
98
102
  css = (0, _objectWithoutProperties2.default)(_ref2, _excluded2);
99
- var isCompact = state.selectProps.appearance === 'compact';
100
103
  var isMulti = state.selectProps.isMulti;
101
104
  return _objectSpread(_objectSpread({}, css), {}, {
102
105
  paddingTop: isCompact ? 0 : TOTAL_PADDING_TAG_TO_CONTAINER - TAG_MARGIN_WIDTH,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/user-picker",
3
- "version": "9.3.2",
3
+ "version": "9.3.5",
4
4
  "sideEffects": false
5
5
  }
@@ -96,8 +96,8 @@ export class BaseUserPickerWithoutAnalytics extends React.Component {
96
96
 
97
97
  switch (action) {
98
98
  case 'select-option':
99
- if (value && !Array.isArray(value)) {
100
- callCallback(onSelection, value.data, this.getSessionId());
99
+ if (value) {
100
+ callCallback(onSelection, extractOptionValue(value), this.getSessionId());
101
101
  }
102
102
 
103
103
  this.fireEvent(selectEvent, isMulti ? option : value);
@@ -66,7 +66,7 @@ export class UserPickerWithoutAnalytics extends React.Component {
66
66
  }, /*#__PURE__*/React.createElement(BaseUserPickerWithoutAnalytics, _extends({}, this.props, {
67
67
  width: width,
68
68
  SelectComponent: SelectComponent,
69
- styles: getStyles(width, isMulti, this.props.styles),
69
+ styles: getStyles(width, isMulti, this.props.appearance === 'compact', this.props.styles),
70
70
  components: getComponents(isMulti, anchor),
71
71
  pickerProps: pickerProps
72
72
  })))));
@@ -9,14 +9,13 @@ export const AVATAR_PADDING = 6;
9
9
  export const INDICATOR_WIDTH = 39;
10
10
  const TOTAL_PADDING_TAG_TO_CONTAINER = 10;
11
11
  const TAG_MARGIN_WIDTH = 4;
12
- export const getStyles = memoizeOne((width, isMulti, overrideStyles) => {
12
+ export const getStyles = memoizeOne((width, isMulti, isCompact, overrideStyles) => {
13
13
  let styles = {
14
14
  menu: (css, state) => ({ ...css,
15
15
  width,
16
16
  minWidth: state.selectProps.menuMinWidth
17
17
  }),
18
18
  control: (css, state) => {
19
- const isCompact = state.selectProps.appearance === 'compact';
20
19
  const isMulti = state.selectProps.isMulti;
21
20
  return { ...css,
22
21
  width,
@@ -45,7 +44,12 @@ export const getStyles = memoizeOne((width, isMulti, overrideStyles) => {
45
44
  paddingRight,
46
45
  ...css
47
46
  }) => ({ ...css,
48
- opacity: 0,
47
+ // By default show clear indicator, except for on devices where "hover" is supported.
48
+ // This means mobile devices (which do not support hover) will be able to see the clear indicator.
49
+ opacity: 1,
50
+ '@media (hover: hover) and (pointer: fine)': {
51
+ opacity: 0
52
+ },
49
53
  transition: css.transition + ', opacity 150ms',
50
54
  paddingTop: 0,
51
55
  padding: 0,
@@ -62,7 +66,6 @@ export const getStyles = memoizeOne((width, isMulti, overrideStyles) => {
62
66
  position,
63
67
  ...css
64
68
  }, state) => {
65
- const isCompact = state.selectProps.appearance === 'compact';
66
69
  const isMulti = state.selectProps.isMulti;
67
70
  return { ...css,
68
71
  paddingTop: isCompact ? 0 : TOTAL_PADDING_TAG_TO_CONTAINER - TAG_MARGIN_WIDTH,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/user-picker",
3
- "version": "9.3.2",
3
+ "version": "9.3.5",
4
4
  "sideEffects": false
5
5
  }
@@ -102,8 +102,8 @@ export var BaseUserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Compon
102
102
 
103
103
  switch (action) {
104
104
  case 'select-option':
105
- if (value && !Array.isArray(value)) {
106
- callCallback(onSelection, value.data, _this.getSessionId());
105
+ if (value) {
106
+ callCallback(onSelection, extractOptionValue(value), _this.getSessionId());
107
107
  }
108
108
 
109
109
  _this.fireEvent(selectEvent, isMulti ? option : value);
@@ -89,7 +89,7 @@ export var UserPickerWithoutAnalytics = /*#__PURE__*/function (_React$Component)
89
89
  }, /*#__PURE__*/React.createElement(BaseUserPickerWithoutAnalytics, _extends({}, this.props, {
90
90
  width: width,
91
91
  SelectComponent: SelectComponent,
92
- styles: getStyles(width, isMulti, this.props.styles),
92
+ styles: getStyles(width, isMulti, this.props.appearance === 'compact', this.props.styles),
93
93
  components: getComponents(isMulti, anchor),
94
94
  pickerProps: pickerProps
95
95
  })))));
@@ -19,7 +19,7 @@ export var AVATAR_PADDING = 6;
19
19
  export var INDICATOR_WIDTH = 39;
20
20
  var TOTAL_PADDING_TAG_TO_CONTAINER = 10;
21
21
  var TAG_MARGIN_WIDTH = 4;
22
- export var getStyles = memoizeOne(function (width, isMulti, overrideStyles) {
22
+ export var getStyles = memoizeOne(function (width, isMulti, isCompact, overrideStyles) {
23
23
  var styles = {
24
24
  menu: function menu(css, state) {
25
25
  return _objectSpread(_objectSpread({}, css), {}, {
@@ -28,7 +28,6 @@ export var getStyles = memoizeOne(function (width, isMulti, overrideStyles) {
28
28
  });
29
29
  },
30
30
  control: function control(css, state) {
31
- var isCompact = state.selectProps.appearance === 'compact';
32
31
  var isMulti = state.selectProps.isMulti;
33
32
  return _objectSpread(_objectSpread({}, css), {}, {
34
33
  width: width,
@@ -58,7 +57,12 @@ export var getStyles = memoizeOne(function (width, isMulti, overrideStyles) {
58
57
  css = _objectWithoutProperties(_ref, _excluded);
59
58
 
60
59
  return _objectSpread(_objectSpread({}, css), {}, {
61
- opacity: 0,
60
+ // By default show clear indicator, except for on devices where "hover" is supported.
61
+ // This means mobile devices (which do not support hover) will be able to see the clear indicator.
62
+ opacity: 1,
63
+ '@media (hover: hover) and (pointer: fine)': {
64
+ opacity: 0
65
+ },
62
66
  transition: css.transition + ', opacity 150ms',
63
67
  paddingTop: 0,
64
68
  padding: 0,
@@ -78,7 +82,6 @@ export var getStyles = memoizeOne(function (width, isMulti, overrideStyles) {
78
82
  position = _ref2.position,
79
83
  css = _objectWithoutProperties(_ref2, _excluded2);
80
84
 
81
- var isCompact = state.selectProps.appearance === 'compact';
82
85
  var isMulti = state.selectProps.isMulti;
83
86
  return _objectSpread(_objectSpread({}, css), {}, {
84
87
  paddingTop: isCompact ? 0 : TOTAL_PADDING_TAG_TO_CONTAINER - TAG_MARGIN_WIDTH,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/user-picker",
3
- "version": "9.3.2",
3
+ "version": "9.3.5",
4
4
  "sideEffects": false
5
5
  }
@@ -27,7 +27,7 @@ export declare class PopupUserPickerWithoutAnalytics extends React.Component<Pop
27
27
  };
28
28
  render(): JSX.Element;
29
29
  }
30
- export declare const PopupUserPicker: React.ForwardRefExoticComponent<Pick<Omit<PopupUserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "target" | "autoFocus" | "captureMenuScroll" | "closeMenuOnScroll" | "inputId" | "isClearable" | "isDisabled" | "isLoading" | "menuPosition" | "menuPortalTarget" | "menuShouldBlockScroll" | "noOptionsMessage" | "onBlur" | "onChange" | "onFocus" | "onInputChange" | "options" | "placeholder" | "styles" | "value" | "defaultValue" | "fieldId" | "menuMinWidth" | "maxPickerHeight" | "textFieldBackgroundColor" | "loadOptions" | "loadUserSource" | "search" | "anchor" | "open" | "onSelection" | "onClear" | "onClose" | "appearance" | "subtle" | "noBorder" | "addMoreMessage" | "clearValueLabel" | "allowEmail" | "suggestEmailsForDomain" | "emailLabel" | "disableInput" | "isValidEmail" | "maxOptions" | "ariaLabelledBy" | "ariaLive" | "popupTitle"> & Partial<Pick<Omit<PopupUserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "isMulti" | "width" | "offset" | "boundariesElement" | "placement" | "rootBoundary" | "shouldFlip">> & Partial<Pick<{
30
+ export declare const PopupUserPicker: React.ForwardRefExoticComponent<Pick<Omit<PopupUserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "target" | "autoFocus" | "captureMenuScroll" | "closeMenuOnScroll" | "inputId" | "isClearable" | "isDisabled" | "isLoading" | "menuPosition" | "menuPortalTarget" | "menuShouldBlockScroll" | "noOptionsMessage" | "onBlur" | "onChange" | "onFocus" | "onInputChange" | "options" | "placeholder" | "styles" | "value" | "defaultValue" | "fieldId" | "menuMinWidth" | "maxPickerHeight" | "textFieldBackgroundColor" | "loadOptions" | "loadUserSource" | "search" | "anchor" | "open" | "onSelection" | "onClear" | "onClose" | "appearance" | "subtle" | "noBorder" | "addMoreMessage" | "clearValueLabel" | "allowEmail" | "suggestEmailsForDomain" | "emailLabel" | "disableInput" | "isValidEmail" | "maxOptions" | "ariaLabelledBy" | "ariaLive" | "popupTitle"> & Partial<Pick<Omit<PopupUserPickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "offset" | "isMulti" | "width" | "boundariesElement" | "placement" | "rootBoundary" | "shouldFlip">> & Partial<Pick<{
31
31
  boundariesElement: string;
32
32
  width: number;
33
33
  isMulti: boolean;
@@ -1,7 +1,7 @@
1
1
  export declare const BORDER_PADDING = 6;
2
2
  export declare const AVATAR_PADDING = 6;
3
3
  export declare const INDICATOR_WIDTH = 39;
4
- export declare const getStyles: import("memoize-one").MemoizedFn<(width: string | number, isMulti?: boolean | undefined, overrideStyles?: Partial<import("react-select").Styles<import("@atlaskit/select").OptionType, false, import("@atlaskit/select").GroupType<import("@atlaskit/select").OptionType>>> | undefined) => Partial<import("react-select").Styles<import("@atlaskit/select").OptionType, false, import("@atlaskit/select").GroupType<import("@atlaskit/select").OptionType>>> | {
4
+ export declare const getStyles: import("memoize-one").MemoizedFn<(width: string | number, isMulti?: boolean | undefined, isCompact?: boolean | undefined, overrideStyles?: Partial<import("react-select").Styles<import("@atlaskit/select").OptionType, false, import("@atlaskit/select").GroupType<import("@atlaskit/select").OptionType>>> | undefined) => Partial<import("react-select").Styles<import("@atlaskit/select").OptionType, false, import("@atlaskit/select").GroupType<import("@atlaskit/select").OptionType>>> | {
5
5
  menu: (css: any, state: any) => any;
6
6
  control: (css: any, state: any) => any;
7
7
  clearIndicator: ({ paddingTop, paddingBottom, paddingLeft, paddingRight, ...css }: any) => any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/user-picker",
3
- "version": "9.3.2",
3
+ "version": "9.3.5",
4
4
  "description": "Fabric component for display a dropdown to select a user from",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -29,12 +29,12 @@
29
29
  "@atlaskit/analytics-next": "^8.2.0",
30
30
  "@atlaskit/avatar": "^21.0.0",
31
31
  "@atlaskit/icon": "^21.10.0",
32
- "@atlaskit/logo": "^13.8.0",
33
- "@atlaskit/lozenge": "^11.0.0",
32
+ "@atlaskit/logo": "^13.9.0",
33
+ "@atlaskit/lozenge": "^11.2.0",
34
34
  "@atlaskit/popper": "^5.0.0",
35
- "@atlaskit/select": "^15.6.0",
35
+ "@atlaskit/select": "^15.7.0",
36
36
  "@atlaskit/spinner": "^15.1.4",
37
- "@atlaskit/theme": "^12.1.0",
37
+ "@atlaskit/theme": "^12.2.0",
38
38
  "@atlaskit/tokens": "^0.10.0",
39
39
  "@atlaskit/tooltip": "^17.5.0",
40
40
  "@atlaskit/ufo": "^0.1.0",
@@ -54,19 +54,19 @@
54
54
  "@atlaskit/button": "^16.3.0",
55
55
  "@atlaskit/docs": "*",
56
56
  "@atlaskit/elements-test-helpers": "^0.7.0",
57
- "@atlaskit/modal-dialog": "^12.2.0",
58
- "@atlaskit/radio": "^5.3.4",
57
+ "@atlaskit/modal-dialog": "^12.3.0",
58
+ "@atlaskit/radio": "^5.4.0",
59
59
  "@atlaskit/range": "^6.0.0",
60
- "@atlaskit/section-message": "^6.0.0",
61
- "@atlaskit/textfield": "^5.0.0",
60
+ "@atlaskit/section-message": "^6.2.0",
61
+ "@atlaskit/textfield": "^5.2.0",
62
62
  "@atlaskit/util-data-test": "^17.5.0",
63
63
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
64
64
  "@emotion/styled": "^10.0.7",
65
- "@testing-library/dom": "^7.7.3",
66
- "@testing-library/jest-dom": "^4.1.0",
67
- "@testing-library/react": "^8.0.1",
68
- "@testing-library/react-hooks": "^1.0.4",
69
- "@testing-library/user-event": "10.4.0",
65
+ "@testing-library/dom": "^8.17.1",
66
+ "@testing-library/jest-dom": "^5.16.5",
67
+ "@testing-library/react": "^12.1.5",
68
+ "@testing-library/react-hooks": "^1.1.0",
69
+ "@testing-library/user-event": "^13.5.0",
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
@@ -211,9 +211,9 @@ export declare const PopupUserPicker: React_2.ForwardRefExoticComponent<
211
211
  Partial<
212
212
  Pick<
213
213
  Omit<PopupUserPickerProps, keyof WithAnalyticsEventsProps>,
214
+ | 'offset'
214
215
  | 'isMulti'
215
216
  | 'width'
216
- | 'offset'
217
217
  | 'boundariesElement'
218
218
  | 'placement'
219
219
  | 'rootBoundary'