@atlaskit/user-picker 13.8.8 → 13.9.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 CHANGED
@@ -1,5 +1,20 @@
1
1
  # @atlaskit/user-picker
2
2
 
3
+ ## 13.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`079dc2326a811`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/079dc2326a811) -
8
+ Added an optional `renderOptionContent` prop to `Option`'s props, letting consumers wrap the
9
+ default rendered option content (e.g. to add a profile card) without losing the built-in avatar,
10
+ name, and email rendering.
11
+
12
+ ```tsx
13
+ <Option
14
+ renderOptionContent={(content) => <ProfileCard accountId={accountId}>{content}</ProfileCard>}
15
+ />
16
+ ```
17
+
3
18
  ## 13.8.8
4
19
 
5
20
  ### Patch Changes
@@ -15,7 +15,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
15
15
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } // eslint-disable-next-line @typescript-eslint/consistent-type-imports
16
16
  // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
17
17
  var packageName = "@atlaskit/user-picker";
18
- var packageVersion = "13.8.7";
18
+ var packageVersion = "13.8.8";
19
19
  var UUID_REGEXP_TEAMS_GROUPS = /^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/;
20
20
  var UUID_REGEXP_OLD_AAID = /^[a-fA-F0-9]{1,8}:[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/;
21
21
  var UUID_REGEXP_NEW_AAID = /^[a-fA-F0-9]{24,24}$/;
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.Option = void 0;
8
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
8
9
  var _compiled = require("@atlaskit/primitives/compiled");
9
10
  var _select = require("@atlaskit/select");
10
11
  var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
@@ -17,6 +18,7 @@ var _EmailOption = _interopRequireDefault(require("./EmailOption"));
17
18
  var _CustomOption = _interopRequireDefault(require("./CustomOption"));
18
19
  var _utils = require("./utils");
19
20
  var _emailValidation = require("./emailValidation");
21
+ var _excluded = ["renderOptionContent"];
20
22
  var defaultOption = function defaultOption(_ref) {
21
23
  var data = _ref.data.data,
22
24
  isSelected = _ref.isSelected,
@@ -92,8 +94,11 @@ var dataOptionWithTooltip = function dataOptionWithTooltip(props) {
92
94
  }
93
95
  return dataOption(props);
94
96
  };
95
- var Option = exports.Option = function Option(props) {
96
- return /*#__PURE__*/_react.default.createElement(_select.components.Option, props, /*#__PURE__*/_react.default.createElement(_react.default.Suspense, {
97
+ var Option = exports.Option = function Option(_ref3) {
98
+ var renderOptionContent = _ref3.renderOptionContent,
99
+ props = (0, _objectWithoutProperties2.default)(_ref3, _excluded);
100
+ var defaultContent = /*#__PURE__*/_react.default.createElement(_react.default.Suspense, {
97
101
  fallback: defaultOption(props)
98
- }, dataOptionWithTooltip(props)));
102
+ }, dataOptionWithTooltip(props));
103
+ return /*#__PURE__*/_react.default.createElement(_select.components.Option, props, renderOptionContent ? renderOptionContent(defaultContent) : defaultContent);
99
104
  };
@@ -6,7 +6,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
6
6
  import { v4 as uuidv4 } from 'uuid';
7
7
  import { isCustom, isExternalUser } from './components/utils';
8
8
  const packageName = "@atlaskit/user-picker";
9
- const packageVersion = "13.8.7";
9
+ const packageVersion = "13.8.8";
10
10
  const UUID_REGEXP_TEAMS_GROUPS = /^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/;
11
11
  const UUID_REGEXP_OLD_AAID = /^[a-fA-F0-9]{1,8}:[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/;
12
12
  const UUID_REGEXP_NEW_AAID = /^[a-fA-F0-9]{24,24}$/;
@@ -86,6 +86,12 @@ const dataOptionWithTooltip = props => {
86
86
  }
87
87
  return dataOption(props);
88
88
  };
89
- export const Option = props => /*#__PURE__*/React.createElement(components.Option, props, /*#__PURE__*/React.createElement(React.Suspense, {
90
- fallback: defaultOption(props)
91
- }, dataOptionWithTooltip(props)));
89
+ export const Option = ({
90
+ renderOptionContent,
91
+ ...props
92
+ }) => {
93
+ const defaultContent = /*#__PURE__*/React.createElement(React.Suspense, {
94
+ fallback: defaultOption(props)
95
+ }, dataOptionWithTooltip(props));
96
+ return /*#__PURE__*/React.createElement(components.Option, props, renderOptionContent ? renderOptionContent(defaultContent) : defaultContent);
97
+ };
@@ -9,7 +9,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
9
9
  import { v4 as uuidv4 } from 'uuid';
10
10
  import { isCustom, isExternalUser } from './components/utils';
11
11
  var packageName = "@atlaskit/user-picker";
12
- var packageVersion = "13.8.7";
12
+ var packageVersion = "13.8.8";
13
13
  var UUID_REGEXP_TEAMS_GROUPS = /^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/;
14
14
  var UUID_REGEXP_OLD_AAID = /^[a-fA-F0-9]{1,8}:[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/;
15
15
  var UUID_REGEXP_NEW_AAID = /^[a-fA-F0-9]{24,24}$/;
@@ -1,3 +1,5 @@
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
+ var _excluded = ["renderOptionContent"];
1
3
  import { Box } from '@atlaskit/primitives/compiled';
2
4
  import { components } from '@atlaskit/select';
3
5
  import Tooltip from '@atlaskit/tooltip';
@@ -85,8 +87,11 @@ var dataOptionWithTooltip = function dataOptionWithTooltip(props) {
85
87
  }
86
88
  return dataOption(props);
87
89
  };
88
- export var Option = function Option(props) {
89
- return /*#__PURE__*/React.createElement(components.Option, props, /*#__PURE__*/React.createElement(React.Suspense, {
90
+ export var Option = function Option(_ref3) {
91
+ var renderOptionContent = _ref3.renderOptionContent,
92
+ props = _objectWithoutProperties(_ref3, _excluded);
93
+ var defaultContent = /*#__PURE__*/React.createElement(React.Suspense, {
90
94
  fallback: defaultOption(props)
91
- }, dataOptionWithTooltip(props)));
95
+ }, dataOptionWithTooltip(props));
96
+ return /*#__PURE__*/React.createElement(components.Option, props, renderOptionContent ? renderOptionContent(defaultContent) : defaultContent);
92
97
  };
@@ -1,5 +1,5 @@
1
1
  import { type OptionProps as AkOptionProps } from '@atlaskit/select';
2
- import { type FC } from 'react';
2
+ import React, { type ReactNode } from 'react';
3
3
  import { type Option as OptionType } from '../types';
4
4
  export type OptionProps = AkOptionProps & {
5
5
  data: OptionType;
@@ -7,9 +7,10 @@ export type OptionProps = AkOptionProps & {
7
7
  isDisabled: boolean;
8
8
  isFocused: boolean;
9
9
  isSelected: boolean;
10
+ renderOptionContent?: (defaultContent: ReactNode) => ReactNode;
10
11
  selectProps: {
11
12
  emailLabel?: string;
12
13
  };
13
14
  status?: string;
14
15
  };
15
- export declare const Option: FC<OptionProps>;
16
+ export declare const Option: ({ renderOptionContent, ...props }: OptionProps) => React.ReactElement;
package/docs/0-intro.tsx CHANGED
@@ -31,9 +31,9 @@ const _default_1: any = md`
31
31
  ${(
32
32
  <Example
33
33
  packageName="@atlaskit/user-picker"
34
- Component={require('../examples/01-multi').default}
34
+ Component={require('../examples/01-multi.vr.ap').default}
35
35
  title="Multi User Picker"
36
- source={require('!!raw-loader!../examples/01-multi')}
36
+ source={require('!!raw-loader!../examples/01-multi.vr.ap')}
37
37
  />
38
38
  )}
39
39
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/user-picker",
3
- "version": "13.8.8",
3
+ "version": "13.9.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/"
@@ -79,11 +79,11 @@
79
79
  "@atlaskit/spinner": "^20.1.0",
80
80
  "@atlaskit/tag": "^15.4.0",
81
81
  "@atlaskit/teams-avatar": "^4.1.0",
82
- "@atlaskit/tokens": "^16.4.0",
82
+ "@atlaskit/tokens": "^16.7.0",
83
83
  "@atlaskit/tooltip": "^24.0.0",
84
84
  "@atlaskit/ufo": "^1.0.0",
85
85
  "@babel/runtime": "^7.0.0",
86
- "@compiled/react": "^1.0.0",
86
+ "@compiled/react": "^1.0.2",
87
87
  "@emotion/react": "^11.7.1",
88
88
  "lodash": "^4.17.21",
89
89
  "memoize-one": "^6.0.0",
@@ -1,55 +0,0 @@
1
- /**
2
- * Structured MCP docs for `@atlaskit/user-picker`.
3
- */
4
-
5
- import path from 'path';
6
-
7
- import type { StructuredContentSource } from '@atlassian/structured-docs-types/types';
8
-
9
- import packageJson from './package.json';
10
-
11
- const packagePath = path.resolve(__dirname);
12
-
13
- const documentation: StructuredContentSource = {
14
- package: {
15
- package: '@atlaskit/user-picker',
16
- packagePath,
17
- packageJson,
18
- overview:
19
- 'A React component for selecting users, teams, and groups. It provides a searchable dropdown with support for single and multi-select modes, custom options, and external users.',
20
- },
21
- components: [
22
- {
23
- name: 'UserPicker',
24
- description: 'The main user picker component.',
25
- status: 'general-availability',
26
- import: {
27
- name: 'default',
28
- package: '@atlaskit/user-picker',
29
- type: 'default',
30
- packagePath,
31
- packageJson,
32
- },
33
- usageGuidelines: [
34
- 'Use `UserPicker` for selecting users or teams in forms or filters.',
35
- 'Supports `isMulti` for selecting multiple items.',
36
- ],
37
- keywords: ['user-picker', 'select', 'user', 'team'],
38
- categories: ['elements'],
39
- examples: [
40
- {
41
- name: 'Single user picker',
42
- description: 'Basic usage of UserPicker in single-select mode.',
43
- source: path.resolve(packagePath, './examples/00-single.tsx'),
44
- },
45
- {
46
- name: 'Multi user picker',
47
- description: 'Basic usage of UserPicker in multi-select mode.',
48
- source: path.resolve(packagePath, './examples/01-multi.tsx'),
49
- },
50
- ],
51
- },
52
- ],
53
- };
54
-
55
- export default documentation;