@pareto-engineering/design-system 2.0.0-alpha.56 → 2.0.0-alpha.58
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/dist/cjs/f/FormInput/FormInput.js +7 -1
- package/dist/cjs/f/fields/PhoneIntlTelInput/PhoneIntlTelInput.js +180 -0
- package/dist/cjs/f/fields/PhoneIntlTelInput/index.js +15 -0
- package/dist/cjs/f/fields/PhoneIntlTelInput/styles.scss +43 -0
- package/dist/cjs/f/fields/QueryCombobox/QueryCombobox.js +2 -1
- package/dist/cjs/f/fields/QueryCombobox/common/Combobox/Combobox.js +10 -3
- package/dist/cjs/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +10 -3
- package/dist/es/f/FormInput/FormInput.js +8 -2
- package/dist/es/f/fields/PhoneIntlTelInput/PhoneIntlTelInput.js +163 -0
- package/dist/es/f/fields/PhoneIntlTelInput/index.js +2 -0
- package/dist/es/f/fields/PhoneIntlTelInput/styles.scss +43 -0
- package/dist/es/f/fields/QueryCombobox/QueryCombobox.js +2 -1
- package/dist/es/f/fields/QueryCombobox/common/Combobox/Combobox.js +10 -3
- package/dist/es/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +10 -3
- package/package.json +1 -1
- package/src/__snapshots__/Storyshots.test.js.snap +176 -1
- package/src/stories/f/FormInput.stories.jsx +26 -0
- package/src/stories/f/QueryCombobox.stories.jsx +5 -2
- package/src/ui/f/FormInput/FormInput.jsx +11 -0
- package/src/ui/f/fields/QueryCombobox/QueryCombobox.jsx +1 -0
- package/src/ui/f/fields/QueryCombobox/common/Combobox/Combobox.jsx +7 -1
- package/src/ui/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.jsx +6 -0
|
@@ -81,6 +81,12 @@ var FormInput = _ref => {
|
|
|
81
81
|
}, otherProps));
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
if (type === 'rating') {
|
|
85
|
+
return /*#__PURE__*/React.createElement(_fields.RatingsInput, _extends({
|
|
86
|
+
className: newClassName
|
|
87
|
+
}, otherProps));
|
|
88
|
+
}
|
|
89
|
+
|
|
84
90
|
if (extraTypes !== null && extraTypes !== void 0 && extraTypes[type]) {
|
|
85
91
|
var Component = extraTypes[type];
|
|
86
92
|
return /*#__PURE__*/React.createElement(Component, _extends({
|
|
@@ -105,7 +111,7 @@ FormInput.propTypes = {
|
|
|
105
111
|
/**
|
|
106
112
|
* The HTML class names for this element
|
|
107
113
|
*/
|
|
108
|
-
type: _propTypes.default.oneOf(['text', 'email', 'password', 'number', 'date', 'datetime', 'month', 'tel', 'hidden', 'select', 'choices', 'textarea', 'query-combobox', 'url', // to be removed
|
|
114
|
+
type: _propTypes.default.oneOf(['text', 'email', 'password', 'number', 'date', 'datetime', 'month', 'tel', 'hidden', 'select', 'choices', 'textarea', 'query-combobox', 'url', 'rating', // to be removed
|
|
109
115
|
'extendedTypeInput']),
|
|
110
116
|
|
|
111
117
|
/**
|
|
@@ -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
|
|
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
|
|
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
|
};
|
|
@@ -4,7 +4,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { memo, useLayoutEffect } from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
|
-
import { TextInput, TextareaInput, ChoicesInput, SelectInput, QueryCombobox, QuerySelect } from "../fields"; // Local Definitions
|
|
7
|
+
import { TextInput, TextareaInput, ChoicesInput, SelectInput, QueryCombobox, QuerySelect, RatingsInput } from "../fields"; // Local Definitions
|
|
8
8
|
// const baseClassName = styleNames.base
|
|
9
9
|
|
|
10
10
|
const componentClassName = 'form-input';
|
|
@@ -59,6 +59,12 @@ const FormInput = ({
|
|
|
59
59
|
}, otherProps));
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
if (type === 'rating') {
|
|
63
|
+
return /*#__PURE__*/React.createElement(RatingsInput, _extends({
|
|
64
|
+
className: newClassName
|
|
65
|
+
}, otherProps));
|
|
66
|
+
}
|
|
67
|
+
|
|
62
68
|
if (extraTypes !== null && extraTypes !== void 0 && extraTypes[type]) {
|
|
63
69
|
const Component = extraTypes[type];
|
|
64
70
|
return /*#__PURE__*/React.createElement(Component, _extends({
|
|
@@ -83,7 +89,7 @@ FormInput.propTypes = {
|
|
|
83
89
|
/**
|
|
84
90
|
* The HTML class names for this element
|
|
85
91
|
*/
|
|
86
|
-
type: PropTypes.oneOf(['text', 'email', 'password', 'number', 'date', 'datetime', 'month', 'tel', 'hidden', 'select', 'choices', 'textarea', 'query-combobox', 'url', // to be removed
|
|
92
|
+
type: PropTypes.oneOf(['text', 'email', 'password', 'number', 'date', 'datetime', 'month', 'tel', 'hidden', 'select', 'choices', 'textarea', 'query-combobox', 'url', 'rating', // to be removed
|
|
87
93
|
'extendedTypeInput']),
|
|
88
94
|
|
|
89
95
|
/**
|
|
@@ -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,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
|
+
}
|
|
@@ -30,7 +30,8 @@ const Combobox = ({
|
|
|
30
30
|
color,
|
|
31
31
|
minLength,
|
|
32
32
|
isFetching,
|
|
33
|
-
transformSearch
|
|
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
|
|
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
|
@@ -2950,7 +2950,7 @@ exports[`Storyshots a/Timestamp Distance Format 1`] = `
|
|
|
2950
2950
|
className="base timestamp"
|
|
2951
2951
|
onClick={[Function]}
|
|
2952
2952
|
>
|
|
2953
|
-
in
|
|
2953
|
+
in 1 day
|
|
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]}
|
|
@@ -11283,6 +11285,175 @@ exports[`Storyshots f/FormInput With Query Combobox 1`] = `
|
|
|
11283
11285
|
</form>
|
|
11284
11286
|
`;
|
|
11285
11287
|
|
|
11288
|
+
exports[`Storyshots f/FormInput With Ratings Input 1`] = `
|
|
11289
|
+
<form
|
|
11290
|
+
action="#"
|
|
11291
|
+
onReset={[Function]}
|
|
11292
|
+
onSubmit={[Function]}
|
|
11293
|
+
>
|
|
11294
|
+
<div
|
|
11295
|
+
className="base text-input form-input y-background2"
|
|
11296
|
+
>
|
|
11297
|
+
<label
|
|
11298
|
+
className="base label v50 mb-v x-main2"
|
|
11299
|
+
htmlFor="firstName"
|
|
11300
|
+
>
|
|
11301
|
+
What's your first name ?
|
|
11302
|
+
</label>
|
|
11303
|
+
<input
|
|
11304
|
+
className="input"
|
|
11305
|
+
disabled={false}
|
|
11306
|
+
id="firstName"
|
|
11307
|
+
name="firstName"
|
|
11308
|
+
onBlur={[Function]}
|
|
11309
|
+
onChange={[Function]}
|
|
11310
|
+
type="text"
|
|
11311
|
+
value="Test"
|
|
11312
|
+
/>
|
|
11313
|
+
</div>
|
|
11314
|
+
<div
|
|
11315
|
+
className="base ratings-input form-input"
|
|
11316
|
+
>
|
|
11317
|
+
<label
|
|
11318
|
+
className="base label input-label v50 mb-v x-main2"
|
|
11319
|
+
htmlFor="ratings"
|
|
11320
|
+
>
|
|
11321
|
+
Your Rating
|
|
11322
|
+
</label>
|
|
11323
|
+
<div
|
|
11324
|
+
className="stars"
|
|
11325
|
+
>
|
|
11326
|
+
<div
|
|
11327
|
+
className="base rating x-main1 y-background2"
|
|
11328
|
+
>
|
|
11329
|
+
<label
|
|
11330
|
+
htmlFor="ratings-1"
|
|
11331
|
+
onMouseEnter={[Function]}
|
|
11332
|
+
onMouseLeave={[Function]}
|
|
11333
|
+
>
|
|
11334
|
+
<span
|
|
11335
|
+
className="f-icons c-dark-y"
|
|
11336
|
+
>
|
|
11337
|
+
[
|
|
11338
|
+
</span>
|
|
11339
|
+
</label>
|
|
11340
|
+
<input
|
|
11341
|
+
id="ratings-1"
|
|
11342
|
+
name="ratings"
|
|
11343
|
+
onBlur={[Function]}
|
|
11344
|
+
onChange={[Function]}
|
|
11345
|
+
type="radio"
|
|
11346
|
+
value={1}
|
|
11347
|
+
/>
|
|
11348
|
+
</div>
|
|
11349
|
+
<div
|
|
11350
|
+
className="base rating x-main1 y-background2"
|
|
11351
|
+
>
|
|
11352
|
+
<label
|
|
11353
|
+
htmlFor="ratings-2"
|
|
11354
|
+
onMouseEnter={[Function]}
|
|
11355
|
+
onMouseLeave={[Function]}
|
|
11356
|
+
>
|
|
11357
|
+
<span
|
|
11358
|
+
className="f-icons c-dark-y"
|
|
11359
|
+
>
|
|
11360
|
+
[
|
|
11361
|
+
</span>
|
|
11362
|
+
</label>
|
|
11363
|
+
<input
|
|
11364
|
+
id="ratings-2"
|
|
11365
|
+
name="ratings"
|
|
11366
|
+
onBlur={[Function]}
|
|
11367
|
+
onChange={[Function]}
|
|
11368
|
+
type="radio"
|
|
11369
|
+
value={2}
|
|
11370
|
+
/>
|
|
11371
|
+
</div>
|
|
11372
|
+
<div
|
|
11373
|
+
className="base rating x-main1 y-background2"
|
|
11374
|
+
>
|
|
11375
|
+
<label
|
|
11376
|
+
htmlFor="ratings-3"
|
|
11377
|
+
onMouseEnter={[Function]}
|
|
11378
|
+
onMouseLeave={[Function]}
|
|
11379
|
+
>
|
|
11380
|
+
<span
|
|
11381
|
+
className="f-icons c-dark-y"
|
|
11382
|
+
>
|
|
11383
|
+
[
|
|
11384
|
+
</span>
|
|
11385
|
+
</label>
|
|
11386
|
+
<input
|
|
11387
|
+
id="ratings-3"
|
|
11388
|
+
name="ratings"
|
|
11389
|
+
onBlur={[Function]}
|
|
11390
|
+
onChange={[Function]}
|
|
11391
|
+
type="radio"
|
|
11392
|
+
value={3}
|
|
11393
|
+
/>
|
|
11394
|
+
</div>
|
|
11395
|
+
<div
|
|
11396
|
+
className="base rating x-main1 y-background2"
|
|
11397
|
+
>
|
|
11398
|
+
<label
|
|
11399
|
+
htmlFor="ratings-4"
|
|
11400
|
+
onMouseEnter={[Function]}
|
|
11401
|
+
onMouseLeave={[Function]}
|
|
11402
|
+
>
|
|
11403
|
+
<span
|
|
11404
|
+
className="f-icons c-dark-y"
|
|
11405
|
+
>
|
|
11406
|
+
[
|
|
11407
|
+
</span>
|
|
11408
|
+
</label>
|
|
11409
|
+
<input
|
|
11410
|
+
id="ratings-4"
|
|
11411
|
+
name="ratings"
|
|
11412
|
+
onBlur={[Function]}
|
|
11413
|
+
onChange={[Function]}
|
|
11414
|
+
type="radio"
|
|
11415
|
+
value={4}
|
|
11416
|
+
/>
|
|
11417
|
+
</div>
|
|
11418
|
+
<div
|
|
11419
|
+
className="base rating x-main1 y-background2"
|
|
11420
|
+
>
|
|
11421
|
+
<label
|
|
11422
|
+
htmlFor="ratings-5"
|
|
11423
|
+
onMouseEnter={[Function]}
|
|
11424
|
+
onMouseLeave={[Function]}
|
|
11425
|
+
>
|
|
11426
|
+
<span
|
|
11427
|
+
className="f-icons c-dark-y"
|
|
11428
|
+
>
|
|
11429
|
+
[
|
|
11430
|
+
</span>
|
|
11431
|
+
</label>
|
|
11432
|
+
<input
|
|
11433
|
+
id="ratings-5"
|
|
11434
|
+
name="ratings"
|
|
11435
|
+
onBlur={[Function]}
|
|
11436
|
+
onChange={[Function]}
|
|
11437
|
+
type="radio"
|
|
11438
|
+
value={5}
|
|
11439
|
+
/>
|
|
11440
|
+
</div>
|
|
11441
|
+
</div>
|
|
11442
|
+
</div>
|
|
11443
|
+
<div
|
|
11444
|
+
className="debugger"
|
|
11445
|
+
>
|
|
11446
|
+
<button
|
|
11447
|
+
className="base button x-main2"
|
|
11448
|
+
onClick={[Function]}
|
|
11449
|
+
type="button"
|
|
11450
|
+
>
|
|
11451
|
+
Open FormDebugger
|
|
11452
|
+
</button>
|
|
11453
|
+
</div>
|
|
11454
|
+
</form>
|
|
11455
|
+
`;
|
|
11456
|
+
|
|
11286
11457
|
exports[`Storyshots f/common/Description Base 1`] = `
|
|
11287
11458
|
<form
|
|
11288
11459
|
action="#"
|
|
@@ -12239,6 +12410,7 @@ exports[`Storyshots f/fields/QueryCombobox Multiple Select 1`] = `
|
|
|
12239
12410
|
aria-labelledby="downshift-4-label"
|
|
12240
12411
|
autoComplete="off"
|
|
12241
12412
|
className="input"
|
|
12413
|
+
disabled={false}
|
|
12242
12414
|
id="downshift-4-input"
|
|
12243
12415
|
onBlur={[Function]}
|
|
12244
12416
|
onChange={[Function]}
|
|
@@ -12369,6 +12541,7 @@ exports[`Storyshots f/fields/QueryCombobox Multiple Select With Default Formik S
|
|
|
12369
12541
|
aria-labelledby="downshift-5-label"
|
|
12370
12542
|
autoComplete="off"
|
|
12371
12543
|
className="input"
|
|
12544
|
+
disabled={false}
|
|
12372
12545
|
id="downshift-5-input"
|
|
12373
12546
|
onBlur={[Function]}
|
|
12374
12547
|
onChange={[Function]}
|
|
@@ -12449,6 +12622,7 @@ exports[`Storyshots f/fields/QueryCombobox Single Select 1`] = `
|
|
|
12449
12622
|
aria-labelledby="downshift-2-label"
|
|
12450
12623
|
autoComplete="off"
|
|
12451
12624
|
className="input"
|
|
12625
|
+
disabled={false}
|
|
12452
12626
|
id="downshift-2-input"
|
|
12453
12627
|
onBlur={[Function]}
|
|
12454
12628
|
onChange={[Function]}
|
|
@@ -12528,6 +12702,7 @@ exports[`Storyshots f/fields/QueryCombobox Single Select With Default Formik Sta
|
|
|
12528
12702
|
aria-labelledby="downshift-3-label"
|
|
12529
12703
|
autoComplete="off"
|
|
12530
12704
|
className="input"
|
|
12705
|
+
disabled={false}
|
|
12531
12706
|
id="downshift-3-input"
|
|
12532
12707
|
onBlur={[Function]}
|
|
12533
12708
|
onChange={[Function]}
|
|
@@ -332,6 +332,32 @@ export const WithPrefetchedQuerySelect = () => {
|
|
|
332
332
|
)
|
|
333
333
|
}
|
|
334
334
|
|
|
335
|
+
export const WithRatingsInput = () => {
|
|
336
|
+
const inputMap = [
|
|
337
|
+
{
|
|
338
|
+
type :'text',
|
|
339
|
+
name :'firstName',
|
|
340
|
+
label:"What's your first name ?",
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
type :'rating',
|
|
344
|
+
ratingCount:5,
|
|
345
|
+
name :'ratings',
|
|
346
|
+
label :'Your Rating',
|
|
347
|
+
},
|
|
348
|
+
]
|
|
349
|
+
|
|
350
|
+
return (
|
|
351
|
+
<>
|
|
352
|
+
{
|
|
353
|
+
inputMap.map((input) => <FormInput {...input} key={input.name} />)
|
|
354
|
+
}
|
|
355
|
+
<FormDebugger />
|
|
356
|
+
|
|
357
|
+
</>
|
|
358
|
+
)
|
|
359
|
+
}
|
|
360
|
+
|
|
335
361
|
export const ExtensibleFormInput = () => {
|
|
336
362
|
const ExtendedTextInput = (props) => (
|
|
337
363
|
<TextInput
|
|
@@ -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 = ({
|
|
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={{
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
SelectInput,
|
|
13
13
|
QueryCombobox,
|
|
14
14
|
QuerySelect,
|
|
15
|
+
RatingsInput,
|
|
15
16
|
} from '../fields'
|
|
16
17
|
|
|
17
18
|
// Local Definitions
|
|
@@ -84,6 +85,15 @@ const FormInput = ({
|
|
|
84
85
|
/>
|
|
85
86
|
)
|
|
86
87
|
}
|
|
88
|
+
|
|
89
|
+
if (type === 'rating') {
|
|
90
|
+
return (
|
|
91
|
+
<RatingsInput
|
|
92
|
+
className={newClassName}
|
|
93
|
+
{...otherProps}
|
|
94
|
+
/>
|
|
95
|
+
)
|
|
96
|
+
}
|
|
87
97
|
if (extraTypes?.[type]) {
|
|
88
98
|
const Component = extraTypes[type]
|
|
89
99
|
return (
|
|
@@ -128,6 +138,7 @@ FormInput.propTypes = {
|
|
|
128
138
|
'textarea',
|
|
129
139
|
'query-combobox',
|
|
130
140
|
'url',
|
|
141
|
+
'rating',
|
|
131
142
|
// to be removed
|
|
132
143
|
'extendedTypeInput',
|
|
133
144
|
]),
|
|
@@ -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 = {
|