cozy-ui 127.10.1 → 127.12.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 (76) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/package.json +1 -1
  3. package/react/Contacts/GroupsSelect/GroupCreation.jsx +95 -0
  4. package/react/Contacts/GroupsSelect/GroupsSelect.jsx +159 -0
  5. package/react/Contacts/GroupsSelect/GroupsSelect.spec.jsx +248 -0
  6. package/react/Contacts/GroupsSelect/GroupsSelectProvider.jsx +39 -0
  7. package/react/Contacts/GroupsSelect/Readme.md +1 -0
  8. package/react/Contacts/GroupsSelect/SelectBox/Control.jsx +36 -0
  9. package/react/Contacts/GroupsSelect/SelectBox/EditGroupName.jsx +52 -0
  10. package/react/Contacts/GroupsSelect/SelectBox/Menu.jsx +26 -0
  11. package/react/Contacts/GroupsSelect/SelectBox/Option.jsx +67 -0
  12. package/react/Contacts/GroupsSelect/SelectBox/SelectContainer.jsx +15 -0
  13. package/react/Contacts/GroupsSelect/SelectBox/styles.styl +2 -0
  14. package/react/Contacts/GroupsSelect/helpers.js +25 -0
  15. package/react/Contacts/GroupsSelect/locales/en.json +21 -0
  16. package/react/Contacts/GroupsSelect/locales/fr.json +21 -0
  17. package/react/Contacts/GroupsSelect/locales/index.jsx +12 -0
  18. package/react/Contacts/GroupsSelect/styles.styl +47 -0
  19. package/react/Contacts/GroupsSelect/useGroupSelect.jsx +88 -0
  20. package/react/Contacts/Header/GroupsSelection.jsx +74 -0
  21. package/react/Contacts/Header/ImportDropdown.jsx +78 -0
  22. package/react/Contacts/Header/Readme.md +40 -0
  23. package/react/Contacts/Header/SearchInput.jsx +19 -0
  24. package/react/Contacts/Header/index.jsx +79 -0
  25. package/react/Contacts/Header/locales/en.json +15 -0
  26. package/react/Contacts/Header/locales/fr.json +15 -0
  27. package/react/Contacts/Header/locales/index.jsx +12 -0
  28. package/react/Contacts/Readme.md +1 -0
  29. package/react/ContactsList/ContactCell.jsx +58 -0
  30. package/react/ContactsList/helpers.js +50 -1
  31. package/react/ContactsList/helpers.spec.js +50 -1
  32. package/react/ContactsList/locales/en.json +3 -1
  33. package/react/ContactsList/locales/fr.json +3 -1
  34. package/react/providers/Selection/Readme.md +28 -0
  35. package/react/providers/Selection/index.jsx +85 -0
  36. package/transpiled/react/Contacts/GroupsSelect/GroupCreation.d.ts +3 -0
  37. package/transpiled/react/Contacts/GroupsSelect/GroupCreation.js +133 -0
  38. package/transpiled/react/Contacts/GroupsSelect/GroupsSelect.d.ts +56 -0
  39. package/transpiled/react/Contacts/GroupsSelect/GroupsSelect.js +181 -0
  40. package/transpiled/react/Contacts/GroupsSelect/GroupsSelect.spec.d.ts +22 -0
  41. package/transpiled/react/Contacts/GroupsSelect/GroupsSelectProvider.d.ts +5 -0
  42. package/transpiled/react/Contacts/GroupsSelect/GroupsSelectProvider.js +38 -0
  43. package/transpiled/react/Contacts/GroupsSelect/SelectBox/Control.d.ts +14 -0
  44. package/transpiled/react/Contacts/GroupsSelect/SelectBox/Control.js +37 -0
  45. package/transpiled/react/Contacts/GroupsSelect/SelectBox/EditGroupName.d.ts +7 -0
  46. package/transpiled/react/Contacts/GroupsSelect/SelectBox/EditGroupName.js +71 -0
  47. package/transpiled/react/Contacts/GroupsSelect/SelectBox/Menu.d.ts +7 -0
  48. package/transpiled/react/Contacts/GroupsSelect/SelectBox/Menu.js +34 -0
  49. package/transpiled/react/Contacts/GroupsSelect/SelectBox/Option.d.ts +18 -0
  50. package/transpiled/react/Contacts/GroupsSelect/SelectBox/Option.js +66 -0
  51. package/transpiled/react/Contacts/GroupsSelect/SelectBox/SelectContainer.d.ts +2 -0
  52. package/transpiled/react/Contacts/GroupsSelect/SelectBox/SelectContainer.js +12 -0
  53. package/transpiled/react/Contacts/GroupsSelect/helpers.d.ts +9 -0
  54. package/transpiled/react/Contacts/GroupsSelect/helpers.js +30 -0
  55. package/transpiled/react/Contacts/GroupsSelect/locales/index.d.ts +6 -0
  56. package/transpiled/react/Contacts/GroupsSelect/locales/index.js +49 -0
  57. package/transpiled/react/Contacts/GroupsSelect/useGroupSelect.d.ts +11 -0
  58. package/transpiled/react/Contacts/GroupsSelect/useGroupSelect.js +179 -0
  59. package/transpiled/react/Contacts/Header/GroupsSelection.d.ts +7 -0
  60. package/transpiled/react/Contacts/Header/GroupsSelection.js +84 -0
  61. package/transpiled/react/Contacts/Header/ImportDropdown.d.ts +4 -0
  62. package/transpiled/react/Contacts/Header/ImportDropdown.js +88 -0
  63. package/transpiled/react/Contacts/Header/SearchInput.d.ts +4 -0
  64. package/transpiled/react/Contacts/Header/SearchInput.js +24 -0
  65. package/transpiled/react/Contacts/Header/index.d.ts +26 -0
  66. package/transpiled/react/Contacts/Header/index.js +72 -0
  67. package/transpiled/react/Contacts/Header/locales/index.d.ts +6 -0
  68. package/transpiled/react/Contacts/Header/locales/index.js +37 -0
  69. package/transpiled/react/ContactsList/ContactCell.d.ts +8 -0
  70. package/transpiled/react/ContactsList/ContactCell.js +68 -0
  71. package/transpiled/react/ContactsList/helpers.d.ts +1 -0
  72. package/transpiled/react/ContactsList/helpers.js +51 -1
  73. package/transpiled/react/ContactsList/locales/withContactsListLocales.js +6 -2
  74. package/transpiled/react/providers/Selection/index.d.ts +6 -0
  75. package/transpiled/react/providers/Selection/index.js +99 -0
  76. package/transpiled/react/stylesheet.css +1 -1
@@ -0,0 +1,58 @@
1
+ import React, { useRef, useState } from 'react'
2
+
3
+ import ContactIdentity from './Contacts/ContactIdentity'
4
+ import { locales } from './locales/withContactsListLocales'
5
+ import ActionsMenu from '../ActionsMenu'
6
+ import Icon from '../Icon'
7
+ import IconButton from '../IconButton'
8
+ import DotsIcon from '../Icons/Dots'
9
+ import ListItemIcon from '../ListItemIcon'
10
+ import { useI18n, useExtendI18n } from '../providers/I18n'
11
+
12
+ const Cell = ({ row, column, cell, actions }) => {
13
+ const [showActions, setShowActions] = useState(false)
14
+ useExtendI18n(locales)
15
+ const { t } = useI18n()
16
+ const actionsRef = useRef()
17
+
18
+ if (column.id === 'fullname') {
19
+ return <ContactIdentity contact={row} noWrapper />
20
+ }
21
+
22
+ if (column.id === 'actions') {
23
+ if (!actions) {
24
+ return null
25
+ }
26
+
27
+ return (
28
+ <>
29
+ <ListItemIcon>
30
+ <IconButton
31
+ ref={actionsRef}
32
+ arial-label={t('menu')}
33
+ onClick={() => setShowActions(true)}
34
+ >
35
+ <Icon icon={DotsIcon} />
36
+ </IconButton>
37
+ </ListItemIcon>
38
+ {showActions && (
39
+ <ActionsMenu
40
+ open
41
+ ref={actionsRef}
42
+ docs={[row]}
43
+ actions={actions}
44
+ anchorOrigin={{
45
+ vertical: 'bottom',
46
+ horizontal: 'right'
47
+ }}
48
+ onClose={() => setShowActions(false)}
49
+ />
50
+ )}
51
+ </>
52
+ )
53
+ }
54
+
55
+ return cell
56
+ }
57
+
58
+ export default React.memo(Cell)
@@ -1,3 +1,5 @@
1
+ import get from 'lodash/get'
2
+
1
3
  export function buildLastNameFirst(contact) {
2
4
  const givenName =
3
5
  contact.name && contact.name.givenName
@@ -36,15 +38,39 @@ const makeHeader = (contact, t) => {
36
38
  return name[0] || t('empty')
37
39
  }
38
40
 
41
+ /**
42
+ * Build header for a contact (first letter of indexes.byFamilyNameGivenNameEmailCozyUrl)
43
+ * @param {object} contact
44
+ * @param {function} t translation function
45
+ * @returns {string} header
46
+ */
47
+ const makeHeaderForIndexedContacts = (contact, t) => {
48
+ if (contact.me) return t('me')
49
+ if (contact.cozyMetadata?.favorite) return t('favorite')
50
+
51
+ const index = get(contact, 'indexes.byFamilyNameGivenNameEmailCozyUrl', '')
52
+ const hasIndex = index !== null && index.length > 0
53
+
54
+ if (hasIndex) {
55
+ const firstLetterWithoutAccent = index[0]
56
+ .normalize('NFD')
57
+ .replace(/\p{Diacritic}/gu, '')
58
+ return firstLetterWithoutAccent
59
+ }
60
+
61
+ return t('empty')
62
+ }
63
+
39
64
  /**
40
65
  * @typedef {Object.<string, Object>} CategorizedContactsResult
41
66
  */
42
67
 
43
68
  /**
44
69
  * Categorize contacts by first letter of last name
70
+ * Expl.: all contacts with A as first letter will be in A category
45
71
  * @param {object[]} contacts io.cozy.contacts documents
46
72
  * @param {function} t translation function
47
- * @returns {CategorizedContactsResult}
73
+ * @returns {CategorizedContactsResult} Categorized contacts
48
74
  */
49
75
  export const categorizeContacts = (contacts, t) =>
50
76
  contacts.reduce((acc, contact) => {
@@ -81,3 +107,26 @@ export const sortHeaders = (categorized, t) => {
81
107
 
82
108
  return headersSorted.concat(notEmptyAndMyselfSorted)
83
109
  }
110
+
111
+ /**
112
+ * Counts how many contacts are categorized by first letter and store it in `groupCounts`
113
+ * Expl.: if there is 3 contacts in A and 2 in B, it will return [3,2]
114
+ * Also store first letters and store them in `groupLabels`
115
+ * @param {array} contacts - Array of io.cozy.contact documents
116
+ * @returns {object}
117
+ */
118
+ export const makeGroupLabelsAndCounts = (contacts, t) => {
119
+ return contacts.reduce(
120
+ (acc, contact) => {
121
+ const header = makeHeaderForIndexedContacts(contact, t)
122
+ if (!acc.groupLabels.includes(header)) {
123
+ acc.groupLabels.push(header)
124
+ }
125
+ const idx = acc.groupLabels.indexOf(header)
126
+ const val = acc.groupCounts[idx] || 0
127
+ acc.groupCounts[idx] = val + 1
128
+ return acc
129
+ },
130
+ { groupLabels: [], groupCounts: [] }
131
+ )
132
+ }
@@ -1,4 +1,11 @@
1
- import { sortLastNameFirst, sortHeaders } from './helpers'
1
+ import {
2
+ sortLastNameFirst,
3
+ sortHeaders,
4
+ makeGroupLabelsAndCounts
5
+ } from './helpers'
6
+
7
+ const t = x => x
8
+
2
9
  describe('Sort contacts', () => {
3
10
  describe('By Last Name', () => {
4
11
  it('should sort contact by last name', () => {
@@ -99,3 +106,45 @@ describe('sortHeaders', () => {
99
106
  expect(sortedHeaders).toEqual(['me', 'empty', 'B', 'F', 'H'])
100
107
  })
101
108
  })
109
+
110
+ describe('makeGroupLabelsAndCounts', () => {
111
+ it('should returns labels and counts', () => {
112
+ const contacts = [
113
+ { name: 'Alex', indexes: { byFamilyNameGivenNameEmailCozyUrl: 'A' } },
114
+ { name: 'Alan', indexes: { byFamilyNameGivenNameEmailCozyUrl: 'A' } },
115
+ { name: 'Cleo', indexes: { byFamilyNameGivenNameEmailCozyUrl: 'C' } },
116
+ { name: 'Cloé', indexes: { byFamilyNameGivenNameEmailCozyUrl: 'C' } },
117
+ { name: 'Clotilde', indexes: { byFamilyNameGivenNameEmailCozyUrl: 'C' } },
118
+ { name: 'Constant', indexes: { byFamilyNameGivenNameEmailCozyUrl: 'C' } },
119
+ {
120
+ name: 'Christophe',
121
+ indexes: { byFamilyNameGivenNameEmailCozyUrl: 'C' }
122
+ },
123
+ { name: 'Bernard', indexes: { byFamilyNameGivenNameEmailCozyUrl: 'B' } },
124
+ { name: 'Baptiste', indexes: { byFamilyNameGivenNameEmailCozyUrl: 'B' } },
125
+ { name: 'Xavier', indexes: { byFamilyNameGivenNameEmailCozyUrl: 'X' } },
126
+ { name: 'Zorro', indexes: { byFamilyNameGivenNameEmailCozyUrl: 'Z' } },
127
+ { name: '', indexes: { byFamilyNameGivenNameEmailCozyUrl: '' } },
128
+ { name: {}, indexes: { byFamilyNameGivenNameEmailCozyUrl: {} } },
129
+ { name: 'John', indexes: { byFamilyNameGivenNameEmailCozyUrl: null } },
130
+ {
131
+ name: 'Connor',
132
+ indexes: { byFamilyNameGivenNameEmailCozyUrl: undefined }
133
+ },
134
+ { name: 'Àlbert', indexes: { byFamilyNameGivenNameEmailCozyUrl: 'À' } },
135
+ {
136
+ name: 'Alice',
137
+ me: true,
138
+ indexes: { byFamilyNameGivenNameEmailCozyUrl: 'Alice' }
139
+ },
140
+ { name: 'Èllen', indexes: { byFamilyNameGivenNameEmailCozyUrl: 'È' } }
141
+ ]
142
+
143
+ const res = makeGroupLabelsAndCounts(contacts, t)
144
+
145
+ expect(res).toStrictEqual({
146
+ groupLabels: ['A', 'C', 'B', 'X', 'Z', 'empty', 'me', 'E'],
147
+ groupCounts: [3, 5, 2, 1, 1, 4, 1, 1]
148
+ })
149
+ })
150
+ })
@@ -1,4 +1,6 @@
1
1
  {
2
2
  "empty": "EMPTY",
3
- "me": "ME"
3
+ "me": "me",
4
+ "favorite": "favorites",
5
+ "menu": "Menu"
4
6
  }
@@ -1,4 +1,6 @@
1
1
  {
2
2
  "empty": "VIDE",
3
- "me": "MOI"
3
+ "me": "moi",
4
+ "favorite": "favoris",
5
+ "menu": "Menu"
4
6
  }
@@ -0,0 +1,28 @@
1
+ ```jsx
2
+ import DemoProvider from 'cozy-ui/docs/components/DemoProvider'
3
+ import SelectionProvider, { useSelection } from 'cozy-ui/transpiled/react/providers/Selection'
4
+ import Button from 'cozy-ui/transpiled/react/Buttons'
5
+ import Icon from 'cozy-ui/transpiled/react/Icon'
6
+ import Typography from 'cozy-ui/transpiled/react/Typography'
7
+ import DeviceLaptopIcon from 'cozy-ui/transpiled/react/Icons/DeviceLaptop'
8
+
9
+ const Component = () => {
10
+ const { selectedItemsId, addSelectedItem, removeSelectedItem } = useSelection()
11
+
12
+ return (
13
+ <>
14
+ <Typography>selectedItemsId : {JSON.stringify(selectedItemsId)}</Typography>
15
+ <Button label="Add Item" onClick={() => addSelectedItem({ _id: '01' })} />
16
+ <Button label="Remove Item" onClick={() => removeSelectedItem({ _id: '01' })} />
17
+ </>
18
+ )
19
+ }
20
+
21
+ ;
22
+
23
+ <DemoProvider>
24
+ <SelectionProvider>
25
+ <Component />
26
+ </SelectionProvider>
27
+ </DemoProvider>
28
+ ```
@@ -0,0 +1,85 @@
1
+ import isEqual from 'lodash/isEqual'
2
+ import React, { createContext, useContext, useState } from 'react'
3
+
4
+ const SelectionContext = createContext()
5
+
6
+ export const useSelection = () => {
7
+ const context = useContext(SelectionContext)
8
+
9
+ if (!context) {
10
+ throw new Error('useSelection must be used within a SelectionProvider')
11
+ }
12
+ return context
13
+ }
14
+
15
+ /**
16
+ * This provider allows you to manage item selection
17
+ */
18
+ const SelectionProvider = ({ children }) => {
19
+ const [selectedItemsId, setSelectedItemsId] = useState([])
20
+
21
+ const isSelectedItem = item => {
22
+ return selectedItemsId.some(selectedItemId => selectedItemId === item._id)
23
+ }
24
+
25
+ const isSelectionEnabled = selectedItemsId.length > 0
26
+
27
+ const addSelectedItem = item => {
28
+ setSelectedItemsId(prev => [...prev, item._id])
29
+ }
30
+
31
+ const removeSelectedItem = item => {
32
+ setSelectedItemsId(prev => prev.filter(el => el !== item._id))
33
+ }
34
+
35
+ const toggleSelectedItem = item => {
36
+ if (isSelectedItem(item)) {
37
+ removeSelectedItem(item)
38
+ } else {
39
+ addSelectedItem(item)
40
+ }
41
+ }
42
+
43
+ const selectAll = items => {
44
+ const ids = items.map(item => item._id)
45
+ setSelectedItemsId(ids)
46
+ }
47
+
48
+ const unselectAll = () => {
49
+ setSelectedItemsId([])
50
+ }
51
+
52
+ const isSelectedAllItems = items => {
53
+ const a = selectedItemsId.sort()
54
+ const b = items.map(item => item._id).sort()
55
+ return isEqual(a, b)
56
+ }
57
+
58
+ const toggleSelectAllItems = items => {
59
+ if (isSelectedAllItems(items)) {
60
+ unselectAll()
61
+ } else {
62
+ selectAll(items)
63
+ }
64
+ }
65
+
66
+ return (
67
+ <SelectionContext.Provider
68
+ value={{
69
+ selectedItemsId,
70
+ addSelectedItem,
71
+ removeSelectedItem,
72
+ toggleSelectedItem,
73
+ selectAll,
74
+ toggleSelectAllItems,
75
+ isSelectedItem,
76
+ isSelectionEnabled,
77
+ isSelectedAllItems
78
+ }}
79
+ >
80
+ {children}
81
+ </SelectionContext.Provider>
82
+ )
83
+ }
84
+
85
+ export default React.memo(SelectionProvider)
@@ -0,0 +1,3 @@
1
+ declare var _default: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
2
+ export default _default;
3
+ import React from "react";
@@ -0,0 +1,133 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
+ import _createClass from "@babel/runtime/helpers/createClass";
4
+ import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
5
+ import _inherits from "@babel/runtime/helpers/inherits";
6
+ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
+ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
10
+
11
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
12
+
13
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
14
+
15
+ import classNames from 'classnames';
16
+ import React, { Component } from 'react';
17
+ var styles = {};
18
+ import Icon from "cozy-ui/transpiled/react/Icon";
19
+ import PlusIcon from "cozy-ui/transpiled/react/Icons/Plus";
20
+ import Input from "cozy-ui/transpiled/react/Input";
21
+ import { translate } from "cozy-ui/transpiled/react/providers/I18n";
22
+
23
+ var normalizeGroupData = function normalizeGroupData(name) {
24
+ return {
25
+ name: name,
26
+ metadata: {
27
+ version: 1
28
+ }
29
+ };
30
+ };
31
+
32
+ var GroupCreation = /*#__PURE__*/function (_Component) {
33
+ _inherits(GroupCreation, _Component);
34
+
35
+ var _super = _createSuper(GroupCreation);
36
+
37
+ function GroupCreation(props) {
38
+ var _this;
39
+
40
+ _classCallCheck(this, GroupCreation);
41
+
42
+ _this = _super.call(this, props);
43
+
44
+ _defineProperty(_assertThisInitialized(_this), "state", {
45
+ isInputDisplayed: false,
46
+ groupName: ''
47
+ });
48
+
49
+ _defineProperty(_assertThisInitialized(_this), "handleClick", function () {
50
+ _this.setState({
51
+ isInputDisplayed: !_this.state.isInputDisplayed
52
+ });
53
+ });
54
+
55
+ _defineProperty(_assertThisInitialized(_this), "onFocus", function (e) {
56
+ e.stopPropagation();
57
+ });
58
+
59
+ _defineProperty(_assertThisInitialized(_this), "onClick", function (e) {
60
+ e.stopPropagation();
61
+ });
62
+
63
+ _defineProperty(_assertThisInitialized(_this), "keyPress", /*#__PURE__*/function () {
64
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(e) {
65
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
66
+ while (1) {
67
+ switch (_context.prev = _context.next) {
68
+ case 0:
69
+ if (e.keyCode == 13) {
70
+ _this.props.createGroup(normalizeGroupData(e.target.value));
71
+
72
+ _this.textInput.current.value = '';
73
+ }
74
+
75
+ e.stopPropagation();
76
+
77
+ case 2:
78
+ case "end":
79
+ return _context.stop();
80
+ }
81
+ }
82
+ }, _callee);
83
+ }));
84
+
85
+ return function (_x) {
86
+ return _ref.apply(this, arguments);
87
+ };
88
+ }());
89
+
90
+ _defineProperty(_assertThisInitialized(_this), "onMouseDown", function (e) {
91
+ e.stopPropagation();
92
+ });
93
+
94
+ _this.textInput = /*#__PURE__*/React.createRef();
95
+ return _this;
96
+ }
97
+
98
+ _createClass(GroupCreation, [{
99
+ key: "render",
100
+ value: function render() {
101
+ var isInputDisplayed = this.state.isInputDisplayed;
102
+ var t = this.props.t;
103
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
104
+ className: styles['contact-group-creation-divider']
105
+ }), /*#__PURE__*/React.createElement("div", {
106
+ className: classNames('u-ml-half', 'u-mr-half', 'u-c-pointer', styles['container'])
107
+ }, !isInputDisplayed && /*#__PURE__*/React.createElement("div", {
108
+ onClick: this.handleClick,
109
+ className: styles['contact-group-create-div-icon']
110
+ }, /*#__PURE__*/React.createElement(Icon, {
111
+ icon: PlusIcon
112
+ }), /*#__PURE__*/React.createElement("span", {
113
+ className: "u-pl-half"
114
+ }, t('Contacts.GroupsSelect.create'))), isInputDisplayed && /*#__PURE__*/React.createElement(Input, {
115
+ id: "createGroupInput",
116
+ ref: this.textInput,
117
+ type: "text",
118
+ placeholder: t('Contacts.GroupsSelect.name'),
119
+ onClick: this.onClick,
120
+ onFocus: this.onFocus,
121
+ onKeyDown: this.keyPress,
122
+ size: "tiny",
123
+ autoComplete: "off",
124
+ autoFocus: true,
125
+ onMouseDown: this.onMouseDown
126
+ })));
127
+ }
128
+ }]);
129
+
130
+ return GroupCreation;
131
+ }(Component);
132
+
133
+ export default translate()(GroupCreation);
@@ -0,0 +1,56 @@
1
+ export function GroupsSelect({ allGroups, closeMenuOnSelect, value, styles, isMulti, noOptionsMessage, withCheckbox, components, onGroupCreated, onChange, onGroupCreate, onGroupUpdate, onGroupDelete, menuPosition }: {
2
+ allGroups: any;
3
+ closeMenuOnSelect: any;
4
+ value: any;
5
+ styles: any;
6
+ isMulti: any;
7
+ noOptionsMessage: any;
8
+ withCheckbox: any;
9
+ components: any;
10
+ onGroupCreated: any;
11
+ onChange: any;
12
+ onGroupCreate: any;
13
+ onGroupUpdate: any;
14
+ onGroupDelete: any;
15
+ menuPosition: any;
16
+ }): JSX.Element;
17
+ export namespace GroupsSelect {
18
+ const propTypes: {
19
+ allGroups: PropTypes.Validator<any[]>;
20
+ styles: PropTypes.Requireable<object>;
21
+ value: PropTypes.Validator<object>;
22
+ components: PropTypes.Requireable<object>;
23
+ isMulti: PropTypes.Requireable<boolean>;
24
+ noOptionsMessage: PropTypes.Requireable<(...args: any[]) => any>;
25
+ withCheckbox: PropTypes.Requireable<boolean>;
26
+ onChange: PropTypes.Validator<(...args: any[]) => any>;
27
+ onGroupCreated: PropTypes.Requireable<(...args: any[]) => any>;
28
+ onGroupCreate: PropTypes.Requireable<(...args: any[]) => any>;
29
+ onGroupUpdate: PropTypes.Requireable<(...args: any[]) => any>;
30
+ onGroupDelete: PropTypes.Requireable<(...args: any[]) => any>;
31
+ closeMenuOnSelect: PropTypes.Requireable<boolean>;
32
+ menuPosition: PropTypes.Requireable<string>;
33
+ } | {
34
+ allGroups: PropTypes.Validator<any[]>;
35
+ onGroupCreate: PropTypes.Validator<(...args: any[]) => any>;
36
+ onGroupUpdate: PropTypes.Validator<(...args: any[]) => any>;
37
+ onGroupDelete: PropTypes.Validator<(...args: any[]) => any>;
38
+ styles?: undefined;
39
+ value?: undefined;
40
+ components?: undefined;
41
+ isMulti?: undefined;
42
+ noOptionsMessage?: undefined;
43
+ withCheckbox?: undefined;
44
+ onChange?: undefined;
45
+ onGroupCreated?: undefined;
46
+ closeMenuOnSelect?: undefined;
47
+ menuPosition?: undefined;
48
+ };
49
+ namespace defaultProps {
50
+ const isMulti: boolean;
51
+ const components: {};
52
+ const closeMenuOnSelect: boolean;
53
+ }
54
+ }
55
+ export default GroupsSelect;
56
+ import PropTypes from "prop-types";