@atlaskit/user-picker 11.2.2 → 11.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/afm-cc/tsconfig.json +1 -4
  3. package/afm-jira/tsconfig.json +0 -3
  4. package/afm-post-office/tsconfig.json +0 -3
  5. package/afm-townsquare/tsconfig.json +69 -0
  6. package/dist/cjs/analytics.js +1 -1
  7. package/dist/cjs/components/AvatarItemOption.js +2 -2
  8. package/dist/cjs/components/BaseUserPicker.js +6 -3
  9. package/dist/cjs/components/Control.compiled.css +3 -2
  10. package/dist/cjs/components/Control.js +4 -2
  11. package/dist/cjs/components/i18n.js +35 -0
  12. package/dist/cjs/util/group-options-by-type/index.js +55 -0
  13. package/dist/es2019/analytics.js +1 -1
  14. package/dist/es2019/components/AvatarItemOption.js +2 -2
  15. package/dist/es2019/components/BaseUserPicker.js +6 -3
  16. package/dist/es2019/components/Control.compiled.css +3 -2
  17. package/dist/es2019/components/Control.js +4 -2
  18. package/dist/es2019/components/i18n.js +35 -0
  19. package/dist/es2019/util/group-options-by-type/index.js +48 -0
  20. package/dist/esm/analytics.js +1 -1
  21. package/dist/esm/components/AvatarItemOption.js +2 -2
  22. package/dist/esm/components/BaseUserPicker.js +6 -3
  23. package/dist/esm/components/Control.compiled.css +3 -2
  24. package/dist/esm/components/Control.js +4 -2
  25. package/dist/esm/components/i18n.js +35 -0
  26. package/dist/esm/util/group-options-by-type/index.js +48 -0
  27. package/dist/types/components/BaseUserPicker.d.ts +9 -3
  28. package/dist/types/components/Control.d.ts +2 -1
  29. package/dist/types/components/PopupControl.d.ts +2 -1
  30. package/dist/types/components/PopupUserPicker.d.ts +7 -5
  31. package/dist/types/components/UserPicker.d.ts +4 -3
  32. package/dist/types/components/components.d.ts +71 -1
  33. package/dist/types/components/i18n.d.ts +35 -0
  34. package/dist/types/components/popup.d.ts +1 -1
  35. package/dist/types/types.d.ts +6 -0
  36. package/dist/types/util/group-options-by-type/index.d.ts +2 -0
  37. package/dist/types-ts4.5/components/BaseUserPicker.d.ts +9 -3
  38. package/dist/types-ts4.5/components/Control.d.ts +2 -1
  39. package/dist/types-ts4.5/components/PopupControl.d.ts +2 -1
  40. package/dist/types-ts4.5/components/PopupUserPicker.d.ts +7 -5
  41. package/dist/types-ts4.5/components/UserPicker.d.ts +4 -3
  42. package/dist/types-ts4.5/components/components.d.ts +71 -1
  43. package/dist/types-ts4.5/components/i18n.d.ts +35 -0
  44. package/dist/types-ts4.5/components/popup.d.ts +1 -1
  45. package/dist/types-ts4.5/types.d.ts +6 -0
  46. package/dist/types-ts4.5/util/group-options-by-type/index.d.ts +2 -0
  47. package/docs/1-smart-user-picker.tsx +2 -7
  48. package/package.json +7 -8
@@ -19,7 +19,77 @@ export declare const getComponents: import("memoize-one").MemoizedFn<(multi?: bo
19
19
  Option: import("react").FC<import("./Option").OptionProps> | import("react").ComponentType<import("packages/design-system/react-select/dist/types").OptionProps<OptionData, boolean, import("@atlaskit/select").GroupType<OptionData>>>;
20
20
  Group?: import("react").ComponentType<import("packages/design-system/react-select/dist/types").GroupProps<OptionData, boolean, import("@atlaskit/select").GroupType<OptionData>>> | undefined;
21
21
  ClearIndicator: typeof ClearIndicator | import("react").ComponentType<import("@atlaskit/select").ClearIndicatorProps<OptionData, boolean, import("@atlaskit/select").GroupType<OptionData>>> | null;
22
- Control: ((props: import("@atlaskit/select").ControlProps<any>) => JSX.Element) | import("react").ComponentType<import("packages/design-system/react-select/dist/types").ControlProps<OptionData, boolean, import("@atlaskit/select").GroupType<OptionData>>>;
22
+ Control: ((props: import("@atlaskit/select").ControlProps<any> & import("@atlaskit/analytics-next").WithAnalyticsEventsProps & {
23
+ fieldId: string | null;
24
+ options?: OptionData[] | undefined;
25
+ width?: string | number | undefined;
26
+ menuMinWidth?: number | undefined;
27
+ maxPickerHeight?: number | undefined;
28
+ textFieldBackgroundColor?: boolean | undefined;
29
+ loadOptions?: import("../types").LoadOptions | undefined;
30
+ loadOptionsErrorMessage?: ((value: {
31
+ inputValue: string;
32
+ }) => import("react").ReactNode) | undefined;
33
+ loadUserSource?: import("../types").LoadUserSource | undefined;
34
+ onChange?: import("../types").OnChange | undefined;
35
+ isMulti?: boolean | undefined;
36
+ search?: string | undefined;
37
+ anchor?: import("react").ComponentType<any> | undefined;
38
+ open?: boolean | undefined;
39
+ isLoading?: boolean | undefined;
40
+ onInputChange?: import("../types").OnInputChange | undefined;
41
+ onSelection?: import("../types").OnOption | undefined;
42
+ onFocus?: import("../types").OnPicker | undefined;
43
+ onBlur?: import("../types").OnPicker | undefined;
44
+ onClear?: import("../types").OnPicker | undefined;
45
+ onOpen?: import("../types").OnPicker | undefined;
46
+ onClose?: import("../types").OnPicker | undefined;
47
+ onKeyDown?: ((event: import("react").KeyboardEvent<Element>) => void) | undefined;
48
+ appearance?: import("../types").Appearance | undefined;
49
+ subtle?: boolean | undefined;
50
+ noBorder?: boolean | undefined;
51
+ styles?: import("@atlaskit/select").StylesConfig | undefined;
52
+ components?: Partial<import("packages/design-system/react-select/dist/types/components").SelectComponents<OptionData, boolean, import("@atlaskit/select").GroupType<OptionData>>> | undefined;
53
+ defaultValue?: import("../types").DefaultValue;
54
+ placeholder?: import("react").ReactNode;
55
+ placeholderAvatar?: "team" | "person" | undefined;
56
+ addMoreMessage?: string | undefined;
57
+ noOptionsMessage?: import("react").ReactNode | ((value: {
58
+ inputValue: string;
59
+ }) => import("react").ReactNode);
60
+ footer?: import("react").ReactNode;
61
+ value?: import("../types").Value;
62
+ isDisabled?: boolean | undefined;
63
+ isInvalid?: boolean | undefined;
64
+ isClearable?: boolean | undefined;
65
+ clearValueLabel?: string | undefined;
66
+ menuPosition?: "fixed" | "absolute" | undefined;
67
+ captureMenuScroll?: boolean | undefined;
68
+ menuPortalTarget?: HTMLElement | undefined;
69
+ allowEmail?: boolean | undefined;
70
+ suggestEmailsForDomain?: string | undefined;
71
+ emailLabel?: string | undefined;
72
+ disableInput?: boolean | undefined;
73
+ isValidEmail?: import("./emailValidation").EmailValidator | undefined;
74
+ autoFocus?: boolean | undefined;
75
+ maxOptions?: number | undefined;
76
+ inputId?: string | undefined;
77
+ closeMenuOnScroll?: boolean | EventListener | undefined;
78
+ menuShouldBlockScroll?: boolean | undefined;
79
+ ariaLabel?: string | undefined;
80
+ ariaLabelledBy?: string | undefined;
81
+ ariaDescribedBy?: string | undefined;
82
+ ariaLive?: "polite" | "off" | "assertive" | undefined;
83
+ name?: string | undefined;
84
+ header?: import("react").ReactNode;
85
+ required?: boolean | undefined;
86
+ UNSAFE_hasDraggableParentComponent?: boolean | undefined;
87
+ openMenuOnClick?: boolean | undefined;
88
+ strategy?: "fixed" | "absolute" | undefined;
89
+ showClearIndicator?: boolean | undefined;
90
+ forwardedRef?: import("react").ForwardedRef<import("../types").UserPickerRef> | undefined;
91
+ groupByTypeOrder?: NonNullable<"user" | "team" | "email" | "group" | "custom" | "external_user" | undefined>[] | undefined;
92
+ }) => JSX.Element) | import("react").ComponentType<import("packages/design-system/react-select/dist/types").ControlProps<OptionData, boolean, import("@atlaskit/select").GroupType<OptionData>>>;
23
93
  DropdownIndicator: import("react").ComponentType<import("@atlaskit/select").DropdownIndicatorProps<OptionData, boolean, import("@atlaskit/select").GroupType<OptionData>>> | null;
24
94
  GroupHeading?: import("react").ComponentType<import("packages/design-system/react-select/dist/types").GroupHeadingProps<OptionData, boolean, import("@atlaskit/select").GroupType<OptionData>>> | undefined;
25
95
  IndicatorsContainer?: import("react").ComponentType<import("@atlaskit/select").IndicatorsContainerProps<OptionData, boolean, import("@atlaskit/select").GroupType<OptionData>>> | undefined;
@@ -129,4 +129,39 @@ export declare const messages: {
129
129
  defaultMessage: string;
130
130
  description: string;
131
131
  };
132
+ userTypeLabel: {
133
+ id: string;
134
+ defaultMessage: string;
135
+ description: string;
136
+ };
137
+ teamTypeLabel: {
138
+ id: string;
139
+ defaultMessage: string;
140
+ description: string;
141
+ };
142
+ emailTypeLabel: {
143
+ id: string;
144
+ defaultMessage: string;
145
+ description: string;
146
+ };
147
+ groupTypeLabel: {
148
+ id: string;
149
+ defaultMessage: string;
150
+ description: string;
151
+ };
152
+ externalUserTypeLabel: {
153
+ id: string;
154
+ defaultMessage: string;
155
+ description: string;
156
+ };
157
+ customTypeLabel: {
158
+ id: string;
159
+ defaultMessage: string;
160
+ description: string;
161
+ };
162
+ otherTypeLabel: {
163
+ id: string;
164
+ defaultMessage: string;
165
+ description: string;
166
+ };
132
167
  };
@@ -10,7 +10,7 @@ export declare const getPopupProps: import("memoize-one").MemoizedFn<(width: str
10
10
  popupTitle: string | undefined;
11
11
  popperProps: {
12
12
  placement: Placement;
13
- strategy: "absolute" | "fixed";
13
+ strategy: "fixed" | "absolute";
14
14
  modifiers: ({
15
15
  name: string;
16
16
  options: {
@@ -182,6 +182,8 @@ export type UserPickerProps = WithAnalyticsEventsProps & {
182
182
  showClearIndicator?: boolean;
183
183
  /** Ref to the underlying select */
184
184
  forwardedRef?: React.ForwardedRef<UserPickerRef>;
185
+ /** group the options by type */
186
+ groupByTypeOrder?: NonNullable<OptionData['type']>[];
185
187
  };
186
188
  export type UserPickerRef = {
187
189
  focus: () => void;
@@ -343,6 +345,10 @@ export type Option<Data = OptionData> = {
343
345
  label: string;
344
346
  value: string;
345
347
  };
348
+ export type GroupedOptions = {
349
+ label: React.JSX.Element;
350
+ options: Option[];
351
+ };
346
352
  export interface UserSourceResult {
347
353
  sourceId: string;
348
354
  sourceType: UserSource;
@@ -0,0 +1,2 @@
1
+ import type { OptionData, Option, GroupedOptions } from "../../types";
2
+ export declare const groupOptionsByType: import("memoize-one").MemoizedFn<(options: Option[], groupByTypeOrder: NonNullable<OptionData['type']>[]) => Option[] | GroupedOptions[]>;
@@ -1,13 +1,8 @@
1
1
  import Link from '@atlaskit/link';
2
- import { fg } from '@atlaskit/platform-feature-flags';
3
2
  import React from 'react';
4
3
  import { md } from '@atlaskit/docs';
5
4
  import SectionMessage from '@atlaskit/section-message';
6
5
 
7
- const LinkComponent = (props: any) =>
8
- // eslint-disable-next-line @atlaskit/design-system/no-html-anchor, jsx-a11y/anchor-has-content
9
- fg('dst-a11y__replace-anchor-with-link__search-platfor') ? <Link {...props} /> : <a {...props} />;
10
-
11
6
  export default md`
12
7
  ${(
13
8
  <SectionMessage
@@ -15,9 +10,9 @@ export default md`
15
10
  title="Note: @atlaskit/user-picker/smart-user-picker is deprecated."
16
11
  >
17
12
  SmartUserPicker has moved packages! Please use{' '}
18
- <LinkComponent href="https://statlas.prod.atl-paas.net/atlassian-frontend/master#packages/smart-experiences/smart-user-picker">
13
+ <Link href="https://statlas.prod.atl-paas.net/atlassian-frontend/master#packages/smart-experiences/smart-user-picker">
19
14
  @atlaskit/smart-user-picker
20
- </LinkComponent>{' '}
15
+ </Link>{' '}
21
16
  instead. Alternatively, @atlaskit/smart-hooks will be ready by end of FY22Q4. Contact
22
17
  #search-plex for further details.
23
18
  </SectionMessage>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/user-picker",
3
- "version": "11.2.2",
3
+ "version": "11.3.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/"
@@ -51,19 +51,18 @@
51
51
  "dependencies": {
52
52
  "@atlaskit/analytics-next": "^11.1.0",
53
53
  "@atlaskit/avatar": "^25.1.0",
54
- "@atlaskit/icon": "^26.4.0",
55
- "@atlaskit/link": "^3.2.0",
56
- "@atlaskit/logo": "^19.0.0",
54
+ "@atlaskit/icon": "^27.1.0",
55
+ "@atlaskit/logo": "^19.1.0",
57
56
  "@atlaskit/lozenge": "^13.0.0",
58
57
  "@atlaskit/people-teams-ui-public": "^3.1.0",
59
58
  "@atlaskit/platform-feature-flags": "^1.1.0",
60
59
  "@atlaskit/popper": "^7.0.0",
61
- "@atlaskit/primitives": "^14.8.0",
62
- "@atlaskit/select": "^20.6.0",
60
+ "@atlaskit/primitives": "^14.9.0",
61
+ "@atlaskit/select": "^20.7.0",
63
62
  "@atlaskit/spinner": "^18.0.0",
64
63
  "@atlaskit/teams-avatar": "^2.3.0",
65
64
  "@atlaskit/theme": "^18.0.0",
66
- "@atlaskit/tokens": "^5.0.0",
65
+ "@atlaskit/tokens": "^5.4.0",
67
66
  "@atlaskit/tooltip": "^20.3.0",
68
67
  "@atlaskit/ufo": "^0.4.0",
69
68
  "@babel/runtime": "^7.0.0",
@@ -116,7 +115,7 @@
116
115
  "user-picker-show-clear-indicator": {
117
116
  "type": "boolean"
118
117
  },
119
- "dst-a11y__replace-anchor-with-link__search-platfor": {
118
+ "support_group_by_type_for_user_picker": {
120
119
  "type": "boolean"
121
120
  }
122
121
  }