@pareto-engineering/design-system 2.0.0-alpha.56 → 2.0.0-alpha.57

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.
@@ -0,0 +1,180 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var React = _interopRequireWildcard(require("react"));
9
+
10
+ var _reactIntlTelInput = _interopRequireDefault(require("react-intl-tel-input"));
11
+
12
+ var _propTypes = _interopRequireDefault(require("prop-types"));
13
+
14
+ var _bem = _interopRequireDefault(require("@pareto-engineering/bem"));
15
+
16
+ var _formik = require("formik");
17
+
18
+ var _common = require("../../common");
19
+
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
+
22
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
+
24
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
+
26
+ var baseClassName = _bem.default.base;
27
+ var componentClassName = 'phone-intl-tel-input';
28
+ /**
29
+ * This is the component description.
30
+ */
31
+
32
+ var PhoneIntlTelInput = _ref => {
33
+ var {
34
+ id,
35
+ className: userClassName,
36
+ style,
37
+ name,
38
+ label,
39
+ color,
40
+ labelColor,
41
+ oneInputLabel,
42
+ description,
43
+ disabled,
44
+ placeholder,
45
+ optional,
46
+ autoComplete,
47
+ validate,
48
+ errorMessage // ...otherProps
49
+
50
+ } = _ref;
51
+ (0, React.useLayoutEffect)(() => {
52
+ Promise.resolve().then(() => _interopRequireWildcard(require("./styles.scss")));
53
+ Promise.resolve().then(() => _interopRequireWildcard(require('react-intl-tel-input/dist/main.css')));
54
+ }, []);
55
+ var [field,, helpers] = (0, _formik.useField)({
56
+ name,
57
+ validate
58
+ });
59
+ var {
60
+ setValue
61
+ } = helpers;
62
+ var [intlInputError, setIntlInputError] = (0, React.useState)('');
63
+ return /*#__PURE__*/React.createElement("div", {
64
+ id: id,
65
+ className: [baseClassName, componentClassName, userClassName, "y-".concat(color), intlInputError && 'error'].filter(e => e).join(' '),
66
+ style: style // {...otherProps}
67
+
68
+ }, /*#__PURE__*/React.createElement(_common.FormLabel, {
69
+ className: [oneInputLabel ? 'md-s2 s0 v1 mb-v' : 'v50 mb-v'].filter(e => e).join(' '),
70
+ name: name,
71
+ color: labelColor,
72
+ optional: optional
73
+ }, label), /*#__PURE__*/React.createElement(_reactIntlTelInput.default, {
74
+ inputClassName: "input",
75
+ customContainer: "input-wrapper",
76
+ placeholder: placeholder,
77
+ disabled: disabled,
78
+ value: field.value,
79
+ fieldName: field.name,
80
+ onPhoneNumberChange: (isValid, value) => {
81
+ setValue(value);
82
+
83
+ if (value && !isValid) {
84
+ setIntlInputError(errorMessage);
85
+ } else {
86
+ setIntlInputError('');
87
+ }
88
+ },
89
+ autoComplete: autoComplete
90
+ }), /*#__PURE__*/React.createElement(_common.FormDescription, {
91
+ className: "v50 mt-v s-1",
92
+ description: intlInputError || description,
93
+ name: name
94
+ }));
95
+ };
96
+
97
+ PhoneIntlTelInput.propTypes = {
98
+ /**
99
+ * The HTML id for this element
100
+ */
101
+ id: _propTypes.default.string,
102
+
103
+ /**
104
+ * The HTML class names for this element
105
+ */
106
+ className: _propTypes.default.string,
107
+
108
+ /**
109
+ * The React-written, css properties for this element.
110
+ */
111
+ style: _propTypes.default.objectOf(_propTypes.default.string),
112
+
113
+ /**
114
+ * The input name (html - and Formik state)
115
+ */
116
+ name: _propTypes.default.string.isRequired,
117
+
118
+ /**
119
+ * The input label
120
+ */
121
+ label: _propTypes.default.string.isRequired,
122
+
123
+ /**
124
+ * The input label color
125
+ */
126
+ labelColor: _propTypes.default.string,
127
+
128
+ /**
129
+ * If the slide will only have one input
130
+ */
131
+ oneInputLabel: _propTypes.default.bool,
132
+
133
+ /**
134
+ * Input description
135
+ */
136
+ description: _propTypes.default.string,
137
+
138
+ /**
139
+ * Whether the text input should be disabled
140
+ */
141
+ disabled: _propTypes.default.bool,
142
+
143
+ /**
144
+ * The placeholder text for the input
145
+ */
146
+ placeholder: _propTypes.default.string,
147
+
148
+ /**
149
+ * The text input color
150
+ */
151
+ color: _propTypes.default.string,
152
+
153
+ /**
154
+ * Whether the input is optional or not
155
+ */
156
+ optional: _propTypes.default.bool,
157
+
158
+ /**
159
+ * The autoComplete value that the browser should watch for the input
160
+ * `https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete`
161
+ */
162
+ autoComplete: _propTypes.default.string,
163
+
164
+ /**
165
+ * The error message to be siplayed when the input is invalid
166
+ */
167
+ errorMessage: _propTypes.default.string,
168
+
169
+ /**
170
+ * The input field validator function
171
+ */
172
+ validate: _propTypes.default.func
173
+ };
174
+ PhoneIntlTelInput.defaultProps = {
175
+ color: 'background2',
176
+ disabled: false,
177
+ errorMessage: 'Please enter a valid phone number'
178
+ };
179
+ var _default = PhoneIntlTelInput;
180
+ exports.default = _default;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "PhoneIntlTelInput", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _PhoneIntlTelInput.default;
10
+ }
11
+ });
12
+
13
+ var _PhoneIntlTelInput = _interopRequireDefault(require("./PhoneIntlTelInput"));
14
+
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -0,0 +1,43 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ @use "@pareto-engineering/bem";
3
+
4
+ $default-padding: 0.75em 0.75em 0.55em;
5
+
6
+ .#{bem.$base}.phone-intl-tel-input {
7
+ display: flex;
8
+ flex-direction: column;
9
+
10
+ &.error {
11
+ >.#{bem.$base}.description {
12
+ color: var(--error);
13
+ }
14
+ }
15
+
16
+ .input-wrapper {
17
+ width: 100%;
18
+ }
19
+
20
+ .input {
21
+ border: var(--theme-border-style) var(--dark-y);
22
+ background: var(--light-y);
23
+ color: var(--on-y);
24
+ padding: $default-padding;
25
+ width: 100%;
26
+
27
+ &::placeholder {
28
+ color: var(--metadata);
29
+ }
30
+
31
+ &:not(:disabled):hover {
32
+ border: var(--theme-border-style) var(--light-background4);
33
+ }
34
+
35
+ &:disabled {
36
+ background-color: var(--dark-y);
37
+ }
38
+
39
+ &:focus {
40
+ background: var(--light-background4);
41
+ }
42
+ }
43
+ }
@@ -228,7 +228,8 @@ QueryCombobox.defaultProps = {
228
228
  color: 'background2',
229
229
  searchVariable: 'search',
230
230
  transformSearch: search => search,
231
- minLength: 2
231
+ minLength: 2,
232
+ disabled: false
232
233
  };
233
234
  var _default = QueryCombobox;
234
235
  exports.default = _default;
@@ -48,7 +48,8 @@ var Combobox = _ref => {
48
48
  color,
49
49
  minLength,
50
50
  isFetching,
51
- transformSearch // ...otherProps
51
+ transformSearch,
52
+ disabled // ...otherProps
52
53
 
53
54
  } = _ref;
54
55
  var {
@@ -100,7 +101,8 @@ var Combobox = _ref => {
100
101
  }), label), /*#__PURE__*/React.createElement("div", _extends({}, getComboboxProps(), {
101
102
  className: "input-wrapper"
102
103
  }), /*#__PURE__*/React.createElement("input", _extends({}, getInputProps(), {
103
- className: "input"
104
+ className: "input",
105
+ disabled: disabled
104
106
  })), isFetching && /*#__PURE__*/React.createElement(_a.LoadingCircle, {
105
107
  className: "x-main2"
106
108
  })), /*#__PURE__*/React.createElement(_a.Popover, {
@@ -193,7 +195,12 @@ Combobox.propTypes = {
193
195
  /**
194
196
  * The function to transform the search input
195
197
  */
196
- transformSearch: _propTypes.default.func
198
+ transformSearch: _propTypes.default.func,
199
+
200
+ /**
201
+ * Whether the input filed shpuld be disabled
202
+ */
203
+ disabled: _propTypes.default.bool
197
204
  };
198
205
  Combobox.defaultProps = {// someProp: false
199
206
  };
@@ -65,7 +65,8 @@ var MultipleCombobox = _ref => {
65
65
  color,
66
66
  isFetching,
67
67
  minLength,
68
- transformSearch // ...otherProps
68
+ transformSearch,
69
+ disabled // ...otherProps
69
70
 
70
71
  } = _ref;
71
72
  var [searchInputValue, setSearchInputValue] = (0, React.useState)('');
@@ -199,7 +200,8 @@ var MultipleCombobox = _ref => {
199
200
  }), /*#__PURE__*/React.createElement("input", _extends({}, getInputProps(getDropdownProps({
200
201
  preventKeyAction: isOpen
201
202
  })), {
202
- className: "input"
203
+ className: "input",
204
+ disabled: disabled
203
205
  })), isFetching && /*#__PURE__*/React.createElement(_a.LoadingCircle, {
204
206
  className: "x-main2"
205
207
  })), /*#__PURE__*/React.createElement(_a.Popover, {
@@ -292,7 +294,12 @@ MultipleCombobox.propTypes = {
292
294
  /**
293
295
  * The function to transform the search input
294
296
  */
295
- transformSearch: _propTypes.default.func
297
+ transformSearch: _propTypes.default.func,
298
+
299
+ /**
300
+ * Whether the input filed shpuld be disabled
301
+ */
302
+ disabled: _propTypes.default.bool
296
303
  };
297
304
  MultipleCombobox.defaultProps = {// someProp: false
298
305
  };
@@ -0,0 +1,163 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ import * as React from 'react';
3
+ import { useState, useLayoutEffect } from 'react'; // import intlTelInput from 'intl-tel-input'
4
+
5
+ import IntlTelInput from 'react-intl-tel-input';
6
+ import PropTypes from 'prop-types';
7
+ import styleNames from '@pareto-engineering/bem'; // Local Definitions
8
+
9
+ import { useField } from 'formik';
10
+ import { FormLabel, FormDescription } from "../../common";
11
+ const baseClassName = styleNames.base;
12
+ const componentClassName = 'phone-intl-tel-input';
13
+ /**
14
+ * This is the component description.
15
+ */
16
+
17
+ const PhoneIntlTelInput = ({
18
+ id,
19
+ className: userClassName,
20
+ style,
21
+ name,
22
+ label,
23
+ color,
24
+ labelColor,
25
+ oneInputLabel,
26
+ description,
27
+ disabled,
28
+ placeholder,
29
+ optional,
30
+ autoComplete,
31
+ validate,
32
+ errorMessage // ...otherProps
33
+
34
+ }) => {
35
+ useLayoutEffect(() => {
36
+ import("./styles.scss");
37
+ import('react-intl-tel-input/dist/main.css');
38
+ }, []);
39
+ const [field,, helpers] = useField({
40
+ name,
41
+ validate
42
+ });
43
+ const {
44
+ setValue
45
+ } = helpers;
46
+ const [intlInputError, setIntlInputError] = useState('');
47
+ return /*#__PURE__*/React.createElement("div", {
48
+ id: id,
49
+ className: [baseClassName, componentClassName, userClassName, `y-${color}`, intlInputError && 'error'].filter(e => e).join(' '),
50
+ style: style // {...otherProps}
51
+
52
+ }, /*#__PURE__*/React.createElement(FormLabel, {
53
+ className: [oneInputLabel ? 'md-s2 s0 v1 mb-v' : 'v50 mb-v'].filter(e => e).join(' '),
54
+ name: name,
55
+ color: labelColor,
56
+ optional: optional
57
+ }, label), /*#__PURE__*/React.createElement(IntlTelInput, {
58
+ inputClassName: "input",
59
+ customContainer: "input-wrapper",
60
+ placeholder: placeholder,
61
+ disabled: disabled,
62
+ value: field.value,
63
+ fieldName: field.name,
64
+ onPhoneNumberChange: (isValid, value) => {
65
+ setValue(value);
66
+
67
+ if (value && !isValid) {
68
+ setIntlInputError(errorMessage);
69
+ } else {
70
+ setIntlInputError('');
71
+ }
72
+ },
73
+ autoComplete: autoComplete
74
+ }), /*#__PURE__*/React.createElement(FormDescription, {
75
+ className: "v50 mt-v s-1",
76
+ description: intlInputError || description,
77
+ name: name
78
+ }));
79
+ };
80
+
81
+ PhoneIntlTelInput.propTypes = {
82
+ /**
83
+ * The HTML id for this element
84
+ */
85
+ id: PropTypes.string,
86
+
87
+ /**
88
+ * The HTML class names for this element
89
+ */
90
+ className: PropTypes.string,
91
+
92
+ /**
93
+ * The React-written, css properties for this element.
94
+ */
95
+ style: PropTypes.objectOf(PropTypes.string),
96
+
97
+ /**
98
+ * The input name (html - and Formik state)
99
+ */
100
+ name: PropTypes.string.isRequired,
101
+
102
+ /**
103
+ * The input label
104
+ */
105
+ label: PropTypes.string.isRequired,
106
+
107
+ /**
108
+ * The input label color
109
+ */
110
+ labelColor: PropTypes.string,
111
+
112
+ /**
113
+ * If the slide will only have one input
114
+ */
115
+ oneInputLabel: PropTypes.bool,
116
+
117
+ /**
118
+ * Input description
119
+ */
120
+ description: PropTypes.string,
121
+
122
+ /**
123
+ * Whether the text input should be disabled
124
+ */
125
+ disabled: PropTypes.bool,
126
+
127
+ /**
128
+ * The placeholder text for the input
129
+ */
130
+ placeholder: PropTypes.string,
131
+
132
+ /**
133
+ * The text input color
134
+ */
135
+ color: PropTypes.string,
136
+
137
+ /**
138
+ * Whether the input is optional or not
139
+ */
140
+ optional: PropTypes.bool,
141
+
142
+ /**
143
+ * The autoComplete value that the browser should watch for the input
144
+ * `https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete`
145
+ */
146
+ autoComplete: PropTypes.string,
147
+
148
+ /**
149
+ * The error message to be siplayed when the input is invalid
150
+ */
151
+ errorMessage: PropTypes.string,
152
+
153
+ /**
154
+ * The input field validator function
155
+ */
156
+ validate: PropTypes.func
157
+ };
158
+ PhoneIntlTelInput.defaultProps = {
159
+ color: 'background2',
160
+ disabled: false,
161
+ errorMessage: 'Please enter a valid phone number'
162
+ };
163
+ export default PhoneIntlTelInput;
@@ -0,0 +1,2 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ export { default as PhoneIntlTelInput } from "./PhoneIntlTelInput";
@@ -0,0 +1,43 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ @use "@pareto-engineering/bem";
3
+
4
+ $default-padding: 0.75em 0.75em 0.55em;
5
+
6
+ .#{bem.$base}.phone-intl-tel-input {
7
+ display: flex;
8
+ flex-direction: column;
9
+
10
+ &.error {
11
+ >.#{bem.$base}.description {
12
+ color: var(--error);
13
+ }
14
+ }
15
+
16
+ .input-wrapper {
17
+ width: 100%;
18
+ }
19
+
20
+ .input {
21
+ border: var(--theme-border-style) var(--dark-y);
22
+ background: var(--light-y);
23
+ color: var(--on-y);
24
+ padding: $default-padding;
25
+ width: 100%;
26
+
27
+ &::placeholder {
28
+ color: var(--metadata);
29
+ }
30
+
31
+ &:not(:disabled):hover {
32
+ border: var(--theme-border-style) var(--light-background4);
33
+ }
34
+
35
+ &:disabled {
36
+ background-color: var(--dark-y);
37
+ }
38
+
39
+ &:focus {
40
+ background: var(--light-background4);
41
+ }
42
+ }
43
+ }
@@ -206,6 +206,7 @@ QueryCombobox.defaultProps = {
206
206
  color: 'background2',
207
207
  searchVariable: 'search',
208
208
  transformSearch: search => search,
209
- minLength: 2
209
+ minLength: 2,
210
+ disabled: false
210
211
  };
211
212
  export default QueryCombobox;
@@ -30,7 +30,8 @@ const Combobox = ({
30
30
  color,
31
31
  minLength,
32
32
  isFetching,
33
- transformSearch // ...otherProps
33
+ transformSearch,
34
+ disabled // ...otherProps
34
35
 
35
36
  }) => {
36
37
  const {
@@ -81,7 +82,8 @@ const Combobox = ({
81
82
  }), label), /*#__PURE__*/React.createElement("div", _extends({}, getComboboxProps(), {
82
83
  className: "input-wrapper"
83
84
  }), /*#__PURE__*/React.createElement("input", _extends({}, getInputProps(), {
84
- className: "input"
85
+ className: "input",
86
+ disabled: disabled
85
87
  })), isFetching && /*#__PURE__*/React.createElement(LoadingCircle, {
86
88
  className: "x-main2"
87
89
  })), /*#__PURE__*/React.createElement(Popover, {
@@ -174,7 +176,12 @@ Combobox.propTypes = {
174
176
  /**
175
177
  * The function to transform the search input
176
178
  */
177
- transformSearch: PropTypes.func
179
+ transformSearch: PropTypes.func,
180
+
181
+ /**
182
+ * Whether the input filed shpuld be disabled
183
+ */
184
+ disabled: PropTypes.bool
178
185
  };
179
186
  Combobox.defaultProps = {// someProp: false
180
187
  };
@@ -40,7 +40,8 @@ const MultipleCombobox = ({
40
40
  color,
41
41
  isFetching,
42
42
  minLength,
43
- transformSearch // ...otherProps
43
+ transformSearch,
44
+ disabled // ...otherProps
44
45
 
45
46
  }) => {
46
47
  const [searchInputValue, setSearchInputValue] = useState('');
@@ -172,7 +173,8 @@ const MultipleCombobox = ({
172
173
  }), /*#__PURE__*/React.createElement("input", _extends({}, getInputProps(getDropdownProps({
173
174
  preventKeyAction: isOpen
174
175
  })), {
175
- className: "input"
176
+ className: "input",
177
+ disabled: disabled
176
178
  })), isFetching && /*#__PURE__*/React.createElement(LoadingCircle, {
177
179
  className: "x-main2"
178
180
  })), /*#__PURE__*/React.createElement(Popover, {
@@ -265,7 +267,12 @@ MultipleCombobox.propTypes = {
265
267
  /**
266
268
  * The function to transform the search input
267
269
  */
268
- transformSearch: PropTypes.func
270
+ transformSearch: PropTypes.func,
271
+
272
+ /**
273
+ * Whether the input filed shpuld be disabled
274
+ */
275
+ disabled: PropTypes.bool
269
276
  };
270
277
  MultipleCombobox.defaultProps = {// someProp: false
271
278
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pareto-engineering/design-system",
3
- "version": "2.0.0-alpha.56",
3
+ "version": "2.0.0-alpha.57",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/es/index.js",
@@ -2950,7 +2950,7 @@ exports[`Storyshots a/Timestamp Distance Format 1`] = `
2950
2950
  className="base timestamp"
2951
2951
  onClick={[Function]}
2952
2952
  >
2953
- in 3 months
2953
+ in about 1 month
2954
2954
  </p>
2955
2955
  `;
2956
2956
 
@@ -11207,6 +11207,7 @@ exports[`Storyshots f/FormInput With Query Combobox 1`] = `
11207
11207
  aria-labelledby="downshift-0-label"
11208
11208
  autoComplete="off"
11209
11209
  className="input"
11210
+ disabled={false}
11210
11211
  id="downshift-0-input"
11211
11212
  onBlur={[Function]}
11212
11213
  onChange={[Function]}
@@ -11249,6 +11250,7 @@ exports[`Storyshots f/FormInput With Query Combobox 1`] = `
11249
11250
  aria-labelledby="downshift-1-label"
11250
11251
  autoComplete="off"
11251
11252
  className="input"
11253
+ disabled={false}
11252
11254
  id="downshift-1-input"
11253
11255
  onBlur={[Function]}
11254
11256
  onChange={[Function]}
@@ -12239,6 +12241,7 @@ exports[`Storyshots f/fields/QueryCombobox Multiple Select 1`] = `
12239
12241
  aria-labelledby="downshift-4-label"
12240
12242
  autoComplete="off"
12241
12243
  className="input"
12244
+ disabled={false}
12242
12245
  id="downshift-4-input"
12243
12246
  onBlur={[Function]}
12244
12247
  onChange={[Function]}
@@ -12369,6 +12372,7 @@ exports[`Storyshots f/fields/QueryCombobox Multiple Select With Default Formik S
12369
12372
  aria-labelledby="downshift-5-label"
12370
12373
  autoComplete="off"
12371
12374
  className="input"
12375
+ disabled={false}
12372
12376
  id="downshift-5-input"
12373
12377
  onBlur={[Function]}
12374
12378
  onChange={[Function]}
@@ -12449,6 +12453,7 @@ exports[`Storyshots f/fields/QueryCombobox Single Select 1`] = `
12449
12453
  aria-labelledby="downshift-2-label"
12450
12454
  autoComplete="off"
12451
12455
  className="input"
12456
+ disabled={false}
12452
12457
  id="downshift-2-input"
12453
12458
  onBlur={[Function]}
12454
12459
  onChange={[Function]}
@@ -12528,6 +12533,7 @@ exports[`Storyshots f/fields/QueryCombobox Single Select With Default Formik Sta
12528
12533
  aria-labelledby="downshift-3-label"
12529
12534
  autoComplete="off"
12530
12535
  className="input"
12536
+ disabled={false}
12531
12537
  id="downshift-3-input"
12532
12538
  onBlur={[Function]}
12533
12539
  onChange={[Function]}
@@ -31,6 +31,7 @@ export default {
31
31
  argTypes:{
32
32
  // backgroundColor:{ control: 'color' },
33
33
  multiple:{ control: 'boolean' },
34
+ disabled:{ control: 'boolean' },
34
35
  },
35
36
  }
36
37
 
@@ -81,11 +82,13 @@ const FETCH_TEAMS_QUERY = graphql`
81
82
  `
82
83
 
83
84
  // eslint-disable-next-line react/prop-types
84
- const ResolvedTemplate = ({ multiple, defaultFormikState }) => {
85
+ const ResolvedTemplate = ({ defaultFormikState, ...otherProps }) => {
85
86
  mockRelayOperation(allTeamsMockData)
86
87
  mockRelayOperation(allTeamsMockData)
87
88
  mockRelayOperation(allTeamsMockData)
88
89
 
90
+ const { multiple } = otherProps
91
+
89
92
  const Content = () => {
90
93
  const name = multiple ? 'teams' : 'team'
91
94
 
@@ -129,8 +132,8 @@ const ResolvedTemplate = ({ multiple, defaultFormikState }) => {
129
132
  accessor:'allTeams',
130
133
  }}
131
134
  name={name}
132
- multiple={multiple}
133
135
  searchVariable="name_Icontains"
136
+ {...otherProps}
134
137
  />
135
138
  <div
136
139
  style={{
@@ -221,6 +221,7 @@ QueryCombobox.defaultProps = {
221
221
  searchVariable :'search',
222
222
  transformSearch:(search) => search,
223
223
  minLength :2,
224
+ disabled :false,
224
225
  }
225
226
 
226
227
  export default QueryCombobox
@@ -39,6 +39,7 @@ const Combobox = ({
39
39
  minLength,
40
40
  isFetching,
41
41
  transformSearch,
42
+ disabled,
42
43
  // ...otherProps
43
44
  }) => {
44
45
  const {
@@ -101,7 +102,7 @@ const Combobox = ({
101
102
  </FormLabel>
102
103
 
103
104
  <div {...getComboboxProps()} className="input-wrapper">
104
- <input {...getInputProps()} className="input" />
105
+ <input {...getInputProps()} className="input" disabled={disabled} />
105
106
  {isFetching && (
106
107
  <LoadingCircle className="x-main2" />
107
108
  )}
@@ -203,6 +204,11 @@ Combobox.propTypes = {
203
204
  * The function to transform the search input
204
205
  */
205
206
  transformSearch:PropTypes.func,
207
+
208
+ /**
209
+ * Whether the input filed shpuld be disabled
210
+ */
211
+ disabled:PropTypes.bool,
206
212
  }
207
213
 
208
214
  Combobox.defaultProps = {
@@ -52,6 +52,7 @@ const MultipleCombobox = ({
52
52
  isFetching,
53
53
  minLength,
54
54
  transformSearch,
55
+ disabled,
55
56
  // ...otherProps
56
57
  }) => {
57
58
  const [searchInputValue, setSearchInputValue] = useState('')
@@ -193,6 +194,7 @@ const MultipleCombobox = ({
193
194
  getDropdownProps({ preventKeyAction: isOpen }),
194
195
  )}
195
196
  className="input"
197
+ disabled={disabled}
196
198
  />
197
199
  {isFetching && (
198
200
  <LoadingCircle className="x-main2" />
@@ -299,6 +301,10 @@ MultipleCombobox.propTypes = {
299
301
  */
300
302
  transformSearch:PropTypes.func,
301
303
 
304
+ /**
305
+ * Whether the input filed shpuld be disabled
306
+ */
307
+ disabled:PropTypes.bool,
302
308
  }
303
309
 
304
310
  MultipleCombobox.defaultProps = {