@pareto-engineering/design-system 4.0.0-alpha.62 → 4.0.0-alpha.64
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/common/Description/Description.js +6 -5
- package/dist/cjs/f/common/Label/Label.js +9 -22
- package/dist/cjs/f/common/Label/styles.scss +0 -5
- package/dist/cjs/f/common/index.js +1 -9
- package/dist/cjs/f/fields/Checkbox/Checkbox.js +16 -21
- package/dist/cjs/f/fields/Checkbox/styles.scss +7 -5
- package/dist/cjs/f/fields/ChoicesInput/ChoicesInput.js +13 -23
- package/dist/cjs/f/fields/ChoicesInput/styles.scss +44 -41
- package/dist/cjs/f/fields/EditorInput/EditorInput.js +11 -39
- package/dist/cjs/f/fields/EditorInput/styles.scss +92 -90
- package/dist/cjs/f/fields/LinkInput/LinkInput.js +14 -20
- package/dist/cjs/f/fields/LinkInput/styles.scss +52 -51
- package/dist/cjs/f/fields/QueryChoices/QueryChoices.js +2 -26
- package/dist/cjs/f/fields/QueryCombobox/QueryCombobox.js +4 -30
- package/dist/cjs/f/fields/QueryCombobox/common/Combobox/Combobox.js +7 -16
- package/dist/cjs/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +9 -17
- package/dist/cjs/f/fields/QueryCombobox/styles.scss +38 -37
- package/dist/cjs/f/fields/QuerySelect/QuerySelect.js +2 -10
- package/dist/cjs/f/fields/RatingsInput/RatingsInput.js +14 -38
- package/dist/cjs/f/fields/RatingsInput/styles.scss +5 -1
- package/dist/cjs/f/fields/SelectInput/SelectInput.js +14 -36
- package/dist/cjs/f/fields/SelectInput/styles.scss +5 -2
- package/dist/cjs/f/fields/TextInput/TextInput.js +19 -37
- package/dist/cjs/f/fields/TextInput/styles.scss +37 -30
- package/dist/cjs/f/fields/TextareaInput/TextareaInput.js +15 -37
- package/dist/cjs/f/fields/TextareaInput/styles.scss +30 -27
- package/dist/es/f/common/Description/Description.js +4 -1
- package/dist/es/f/common/Label/Label.js +15 -24
- package/dist/es/f/common/Label/styles.scss +0 -5
- package/dist/es/f/common/index.js +0 -1
- package/dist/es/f/fields/Checkbox/Checkbox.js +14 -19
- package/dist/es/f/fields/Checkbox/styles.scss +7 -5
- package/dist/es/f/fields/ChoicesInput/ChoicesInput.js +31 -39
- package/dist/es/f/fields/ChoicesInput/styles.scss +44 -41
- package/dist/es/f/fields/EditorInput/EditorInput.js +12 -35
- package/dist/es/f/fields/EditorInput/styles.scss +92 -90
- package/dist/es/f/fields/LinkInput/LinkInput.js +14 -20
- package/dist/es/f/fields/LinkInput/styles.scss +52 -51
- package/dist/es/f/fields/QueryChoices/QueryChoices.js +2 -26
- package/dist/es/f/fields/QueryCombobox/QueryCombobox.js +4 -26
- package/dist/es/f/fields/QueryCombobox/common/Combobox/Combobox.js +8 -17
- package/dist/es/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +10 -18
- package/dist/es/f/fields/QueryCombobox/styles.scss +38 -37
- package/dist/es/f/fields/QuerySelect/QuerySelect.js +2 -10
- package/dist/es/f/fields/RatingsInput/RatingsInput.js +15 -35
- package/dist/es/f/fields/RatingsInput/styles.scss +5 -1
- package/dist/es/f/fields/SelectInput/SelectInput.js +14 -36
- package/dist/es/f/fields/SelectInput/styles.scss +5 -2
- package/dist/es/f/fields/TextInput/TextInput.js +19 -37
- package/dist/es/f/fields/TextInput/styles.scss +37 -30
- package/dist/es/f/fields/TextareaInput/TextareaInput.js +15 -37
- package/dist/es/f/fields/TextareaInput/styles.scss +30 -27
- package/package.json +3 -3
- package/src/stories/f/Checkbox.stories.jsx +13 -21
- package/src/stories/f/ChoicesInput.stories.jsx +12 -27
- package/src/stories/f/EditorInput.stories.jsx +7 -14
- package/src/stories/f/LinkInput.stories.jsx +15 -22
- package/src/stories/f/QueryChoices.stories.jsx +12 -19
- package/src/stories/f/QueryCombobox.stories.jsx +16 -24
- package/src/stories/f/QuerySelect.stories.jsx +12 -19
- package/src/stories/f/RatingsInput.stories.jsx +7 -14
- package/src/stories/f/SelectInput.stories.jsx +12 -19
- package/src/stories/f/TextInput.stories.jsx +16 -23
- package/src/stories/f/TextareaInput.stories.jsx +7 -14
- package/src/ui/f/common/Description/Description.jsx +6 -2
- package/src/ui/f/common/Label/Label.jsx +27 -37
- package/src/ui/f/common/Label/styles.scss +0 -5
- package/src/ui/f/common/index.js +0 -1
- package/src/ui/f/fields/Checkbox/Checkbox.jsx +27 -33
- package/src/ui/f/fields/Checkbox/styles.scss +7 -5
- package/src/ui/f/fields/ChoicesInput/ChoicesInput.jsx +29 -38
- package/src/ui/f/fields/ChoicesInput/styles.scss +44 -41
- package/src/ui/f/fields/EditorInput/EditorInput.jsx +16 -41
- package/src/ui/f/fields/EditorInput/styles.scss +92 -90
- package/src/ui/f/fields/LinkInput/LinkInput.jsx +38 -45
- package/src/ui/f/fields/LinkInput/styles.scss +52 -51
- package/src/ui/f/fields/QueryChoices/QueryChoices.jsx +0 -28
- package/src/ui/f/fields/QueryCombobox/QueryCombobox.jsx +5 -31
- package/src/ui/f/fields/QueryCombobox/common/Combobox/Combobox.jsx +35 -46
- package/src/ui/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.jsx +63 -73
- package/src/ui/f/fields/QueryCombobox/styles.scss +38 -37
- package/src/ui/f/fields/QuerySelect/QuerySelect.jsx +0 -8
- package/src/ui/f/fields/RatingsInput/RatingsInput.jsx +20 -47
- package/src/ui/f/fields/RatingsInput/styles.scss +5 -1
- package/src/ui/f/fields/SelectInput/SelectInput.jsx +33 -61
- package/src/ui/f/fields/SelectInput/styles.scss +5 -2
- package/src/ui/f/fields/TextInput/TextInput.jsx +27 -50
- package/src/ui/f/fields/TextInput/styles.scss +37 -30
- package/src/ui/f/fields/TextareaInput/TextareaInput.jsx +32 -59
- package/src/ui/f/fields/TextareaInput/styles.scss +30 -27
- package/tests/__snapshots__/Storyshots.test.js.snap +5909 -0
- package/dist/cjs/f/common/InputWrapper/InputWrapper.js +0 -73
- package/dist/cjs/f/common/InputWrapper/index.js +0 -13
- package/dist/cjs/f/common/InputWrapper/styles.scss +0 -13
- package/dist/es/f/common/InputWrapper/InputWrapper.js +0 -61
- package/dist/es/f/common/InputWrapper/index.js +0 -2
- package/dist/es/f/common/InputWrapper/styles.scss +0 -13
- package/src/ui/f/common/InputWrapper/InputWrapper.jsx +0 -83
- package/src/ui/f/common/InputWrapper/index.js +0 -2
- package/src/ui/f/common/InputWrapper/styles.scss +0 -13
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
2
|
import * as React from 'react'
|
|
3
3
|
|
|
4
|
-
import { memo } from 'react'
|
|
4
|
+
import { useInsertionEffect, memo } from 'react'
|
|
5
5
|
|
|
6
6
|
import PropTypes from 'prop-types'
|
|
7
7
|
|
|
@@ -9,8 +9,7 @@ import styleNames from '@pareto-engineering/bem/exports'
|
|
|
9
9
|
|
|
10
10
|
import { useField } from 'formik'
|
|
11
11
|
|
|
12
|
-
import { FormLabel, FormDescription
|
|
13
|
-
import './styles.scss'
|
|
12
|
+
import { FormLabel, FormDescription } from '../../common'
|
|
14
13
|
|
|
15
14
|
// Local Definitions
|
|
16
15
|
|
|
@@ -35,61 +34,55 @@ const LinkInput = ({
|
|
|
35
34
|
placeholder,
|
|
36
35
|
optional,
|
|
37
36
|
autoComplete,
|
|
38
|
-
labelSpan,
|
|
39
|
-
desktopLabelSpan,
|
|
40
|
-
inputSpan,
|
|
41
|
-
desktopInputSpan,
|
|
42
37
|
// ...otherProps
|
|
43
38
|
}) => {
|
|
39
|
+
useInsertionEffect(() => {
|
|
40
|
+
import('./styles.scss')
|
|
41
|
+
}, [])
|
|
42
|
+
|
|
44
43
|
const [field] = useField({ name, validate })
|
|
45
44
|
|
|
46
45
|
return (
|
|
47
|
-
|
|
46
|
+
<div
|
|
47
|
+
id={id}
|
|
48
|
+
className={[
|
|
49
|
+
baseClassName,
|
|
50
|
+
componentClassName,
|
|
51
|
+
userClassName,
|
|
52
|
+
`y-${color}`,
|
|
53
|
+
]
|
|
54
|
+
.filter((e) => e)
|
|
55
|
+
.join(' ')}
|
|
56
|
+
style={style}
|
|
57
|
+
>
|
|
48
58
|
<FormLabel
|
|
49
59
|
name={name}
|
|
50
60
|
color={labelColor}
|
|
51
61
|
optional={optional}
|
|
52
|
-
columnSpan={labelSpan}
|
|
53
|
-
desktopColumnSpan={desktopLabelSpan}
|
|
54
62
|
// {...otherProps}
|
|
55
63
|
>
|
|
56
64
|
{label}
|
|
57
65
|
</FormLabel>
|
|
58
|
-
<
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
placeholder={placeholder}
|
|
79
|
-
autoComplete={autoComplete}
|
|
80
|
-
{...field}
|
|
81
|
-
/>
|
|
82
|
-
<a
|
|
83
|
-
href={field.value}
|
|
84
|
-
target="_blank"
|
|
85
|
-
rel="noopener noreferrer"
|
|
86
|
-
>
|
|
87
|
-
→
|
|
88
|
-
</a>
|
|
89
|
-
</div>
|
|
90
|
-
<FormDescription className="s-1" description={description} name={name} />
|
|
91
|
-
</InputWrapper>
|
|
92
|
-
</>
|
|
66
|
+
<div className="input-link-wrapper">
|
|
67
|
+
<input
|
|
68
|
+
id={name}
|
|
69
|
+
className="input"
|
|
70
|
+
type="text"
|
|
71
|
+
disabled={disabled}
|
|
72
|
+
placeholder={placeholder}
|
|
73
|
+
autoComplete={autoComplete}
|
|
74
|
+
{...field}
|
|
75
|
+
/>
|
|
76
|
+
<a
|
|
77
|
+
href={field.value}
|
|
78
|
+
target="_blank"
|
|
79
|
+
rel="noopener noreferrer"
|
|
80
|
+
>
|
|
81
|
+
→
|
|
82
|
+
</a>
|
|
83
|
+
</div>
|
|
84
|
+
<FormDescription className="s-1" description={description} name={name} />
|
|
85
|
+
</div>
|
|
93
86
|
)
|
|
94
87
|
}
|
|
95
88
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
-
/* stylelint-disable max-nesting-depth -- required here */
|
|
3
2
|
|
|
4
3
|
@use "@pareto-engineering/bem";
|
|
5
4
|
@use "@pareto-engineering/styles/src/mixins";
|
|
@@ -20,68 +19,70 @@ $default-background: var(--background-inputs);
|
|
|
20
19
|
$disabled-background: var(--background-inputs-30);
|
|
21
20
|
|
|
22
21
|
.#{bem.$base}.link-input {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
position: relative;
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
position: relative;
|
|
27
25
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
content: var(--symbol);
|
|
32
|
-
left: $default-symbol-left;
|
|
33
|
-
position: absolute;
|
|
34
|
-
top: 50%;
|
|
35
|
-
transform: translate(-50%, -50%);
|
|
36
|
-
}
|
|
26
|
+
> .#{bem.$base}.form-label {
|
|
27
|
+
margin-bottom: var(--gap);
|
|
28
|
+
}
|
|
37
29
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
30
|
+
&.has-symbol {
|
|
31
|
+
&::before {
|
|
32
|
+
color: var(--y);
|
|
33
|
+
content: var(--symbol);
|
|
34
|
+
left: $default-symbol-left;
|
|
35
|
+
position: absolute;
|
|
36
|
+
top: 50%;
|
|
37
|
+
transform: translate(-50%, -50%);
|
|
41
38
|
}
|
|
42
39
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
input {
|
|
41
|
+
padding: $default-padding-with-symbol;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
46
44
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
border-radius: var(--theme-default-input-border-radius);
|
|
51
|
-
padding: .5em;
|
|
45
|
+
> .input-link-wrapper {
|
|
46
|
+
display: flex;
|
|
47
|
+
gap: calc(var(--gap) / 2);
|
|
52
48
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
49
|
+
> a {
|
|
50
|
+
align-self: center;
|
|
51
|
+
border: 1px solid var(--interactive);
|
|
52
|
+
border-radius: var(--theme-default-input-border-radius);
|
|
53
|
+
padding: .5em;
|
|
54
|
+
|
|
55
|
+
&:hover {
|
|
56
|
+
background-color: var(--interactive);
|
|
57
|
+
color: var(--on-interactive);
|
|
57
58
|
}
|
|
59
|
+
}
|
|
58
60
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
> input {
|
|
62
|
+
background-color: $default-background;
|
|
63
|
+
border: $default-border;
|
|
64
|
+
border-radius: $default-input-border-radius;
|
|
65
|
+
color: var(--y);
|
|
66
|
+
outline: none;
|
|
67
|
+
padding: $default-padding;
|
|
68
|
+
width: 100%;
|
|
67
69
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
&::placeholder {
|
|
71
|
+
color: var(--metadata);
|
|
72
|
+
}
|
|
71
73
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
&:disabled {
|
|
75
|
+
background-color: $disabled-background;
|
|
76
|
+
}
|
|
75
77
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
&:not(:disabled) {
|
|
79
|
+
&:hover,
|
|
80
|
+
&:active {
|
|
81
|
+
border: $hover-border;
|
|
82
|
+
}
|
|
81
83
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
84
|
+
&:focus {
|
|
85
|
+
border: $focus-border;
|
|
85
86
|
}
|
|
86
87
|
}
|
|
87
88
|
}
|
|
@@ -22,10 +22,6 @@ const QueryChoices = ({
|
|
|
22
22
|
validate,
|
|
23
23
|
loadingOption,
|
|
24
24
|
extraVariables,
|
|
25
|
-
labelSpan,
|
|
26
|
-
desktopLabelSpan,
|
|
27
|
-
inputSpan,
|
|
28
|
-
desktopInputSpan,
|
|
29
25
|
...otherProps
|
|
30
26
|
}) => {
|
|
31
27
|
const [, , helpers] = useField({ name, validate })
|
|
@@ -88,10 +84,6 @@ const QueryChoices = ({
|
|
|
88
84
|
name={name}
|
|
89
85
|
validate={validate}
|
|
90
86
|
options={options}
|
|
91
|
-
labelSpan={labelSpan}
|
|
92
|
-
desktopLabelSpan={desktopLabelSpan}
|
|
93
|
-
inputSpan={inputSpan}
|
|
94
|
-
desktopInputSpan={desktopInputSpan}
|
|
95
87
|
{...otherProps}
|
|
96
88
|
/>
|
|
97
89
|
)
|
|
@@ -148,26 +140,6 @@ QueryChoices.propTypes = {
|
|
|
148
140
|
* select options.
|
|
149
141
|
*/
|
|
150
142
|
extraVariables:PropTypes.objectOf(PropTypes.string),
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* The number of columns the label should span
|
|
154
|
-
*/
|
|
155
|
-
labelSpan:PropTypes.number,
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* The number of columns the input should span
|
|
159
|
-
*/
|
|
160
|
-
inputSpan:PropTypes.number,
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* The number of columns the label should span on desktop
|
|
164
|
-
*/
|
|
165
|
-
desktopLabelSpan:PropTypes.number,
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* The number of columns the input should span on desktop
|
|
169
|
-
*/
|
|
170
|
-
desktopInputSpan:PropTypes.number,
|
|
171
143
|
}
|
|
172
144
|
|
|
173
145
|
QueryChoices.defaultProps = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
2
|
import * as React from 'react'
|
|
3
3
|
|
|
4
|
-
import { useState } from 'react'
|
|
4
|
+
import { useState, useInsertionEffect } from 'react'
|
|
5
5
|
|
|
6
6
|
import { useField } from 'formik'
|
|
7
7
|
|
|
@@ -9,8 +9,6 @@ import { useRelayEnvironment, fetchQuery } from 'react-relay'
|
|
|
9
9
|
|
|
10
10
|
import PropTypes from 'prop-types'
|
|
11
11
|
|
|
12
|
-
import './styles.scss'
|
|
13
|
-
|
|
14
12
|
// Local Definitions
|
|
15
13
|
|
|
16
14
|
import { Combobox, MultipleCombobox } from './common'
|
|
@@ -38,14 +36,14 @@ const QueryCombobox = ({
|
|
|
38
36
|
minLength,
|
|
39
37
|
transformSearch,
|
|
40
38
|
validate,
|
|
41
|
-
labelSpan,
|
|
42
|
-
desktopLabelSpan,
|
|
43
|
-
inputSpan,
|
|
44
|
-
desktopInputSpan,
|
|
45
39
|
placeholder,
|
|
46
40
|
promptCreateNewOption,
|
|
47
41
|
// ...otherProps
|
|
48
42
|
}) => {
|
|
43
|
+
useInsertionEffect(() => {
|
|
44
|
+
import('./styles.scss')
|
|
45
|
+
}, [])
|
|
46
|
+
|
|
49
47
|
const [, meta, helpers] = useField({ name, validate })
|
|
50
48
|
|
|
51
49
|
const { setValue, setError } = helpers
|
|
@@ -117,10 +115,6 @@ const QueryCombobox = ({
|
|
|
117
115
|
className,
|
|
118
116
|
minLength,
|
|
119
117
|
transformSearch,
|
|
120
|
-
labelSpan,
|
|
121
|
-
desktopLabelSpan,
|
|
122
|
-
inputSpan,
|
|
123
|
-
desktopInputSpan,
|
|
124
118
|
placeholder,
|
|
125
119
|
promptCreateNewOption,
|
|
126
120
|
}
|
|
@@ -236,26 +230,6 @@ QueryCombobox.propTypes = {
|
|
|
236
230
|
*/
|
|
237
231
|
optional:PropTypes.bool,
|
|
238
232
|
|
|
239
|
-
/**
|
|
240
|
-
* The number of columns the label should span
|
|
241
|
-
*/
|
|
242
|
-
labelSpan:PropTypes.number,
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* The number of columns the input should span
|
|
246
|
-
*/
|
|
247
|
-
inputSpan:PropTypes.number,
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
* The number of columns the label should span on desktop
|
|
251
|
-
*/
|
|
252
|
-
desktopLabelSpan:PropTypes.number,
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* The number of columns the input should span on desktop
|
|
256
|
-
*/
|
|
257
|
-
desktopInputSpan:PropTypes.number,
|
|
258
|
-
|
|
259
233
|
/**
|
|
260
234
|
* Whether to prompt the user to create a new option if the search input
|
|
261
235
|
* does not match any of the options
|
|
@@ -15,7 +15,7 @@ import { Popover, LoadingCircle } from 'ui/a'
|
|
|
15
15
|
|
|
16
16
|
import { Button } from 'ui/b'
|
|
17
17
|
|
|
18
|
-
import {
|
|
18
|
+
import { lookUpInputValueFromFetchedOptions } from '../../../../common'
|
|
19
19
|
|
|
20
20
|
// Local Definitions
|
|
21
21
|
|
|
@@ -47,10 +47,6 @@ const Combobox = ({
|
|
|
47
47
|
transformSearch,
|
|
48
48
|
disabled,
|
|
49
49
|
optional,
|
|
50
|
-
labelSpan,
|
|
51
|
-
desktopLabelSpan,
|
|
52
|
-
inputSpan,
|
|
53
|
-
desktopInputSpan,
|
|
54
50
|
placeholder,
|
|
55
51
|
promptCreateNewOption,
|
|
56
52
|
// ...otherProps
|
|
@@ -107,61 +103,54 @@ const Combobox = ({
|
|
|
107
103
|
const resetInputValue = () => setInputValue('')
|
|
108
104
|
|
|
109
105
|
return (
|
|
110
|
-
|
|
106
|
+
<div
|
|
107
|
+
id={id}
|
|
108
|
+
className={[
|
|
109
|
+
baseClassName,
|
|
110
|
+
componentClassName,
|
|
111
|
+
userClassName,
|
|
112
|
+
`y-${color}`,
|
|
113
|
+
]
|
|
114
|
+
.filter((e) => e)
|
|
115
|
+
.join(' ')}
|
|
116
|
+
style={style}
|
|
117
|
+
ref={parentRef}
|
|
118
|
+
{...getComboboxProps()}
|
|
119
|
+
>
|
|
111
120
|
<FormLabel
|
|
112
121
|
{...getLabelProps()}
|
|
113
122
|
name={name}
|
|
114
123
|
optional={optional}
|
|
115
124
|
color={labelColor}
|
|
116
|
-
columnSpan={labelSpan}
|
|
117
|
-
desktopColumnSpan={desktopLabelSpan}
|
|
118
125
|
>
|
|
119
126
|
{label}
|
|
120
127
|
</FormLabel>
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
componentClassName,
|
|
127
|
-
userClassName,
|
|
128
|
-
`y-${color}`,
|
|
129
|
-
]
|
|
130
|
-
.filter((e) => e)
|
|
131
|
-
.join(' ')}
|
|
132
|
-
style={style}
|
|
133
|
-
ref={parentRef}
|
|
134
|
-
{...getComboboxProps()}
|
|
135
|
-
columnSpan={inputSpan}
|
|
136
|
-
desktopColumnSpan={desktopInputSpan}
|
|
137
|
-
>
|
|
138
|
-
<input {...getInputProps()} className="input" disabled={disabled} placeholder={placeholder} />
|
|
139
|
-
{isFetching && (
|
|
140
|
-
<LoadingCircle className="x-main" />
|
|
141
|
-
)}
|
|
142
|
-
{inputValue.length > minLength && !isFetching && (
|
|
128
|
+
<input {...getInputProps()} className="input" disabled={disabled} placeholder={placeholder} />
|
|
129
|
+
{isFetching && (
|
|
130
|
+
<LoadingCircle className="x-main" />
|
|
131
|
+
)}
|
|
132
|
+
{inputValue.length > minLength && !isFetching && (
|
|
143
133
|
<Button isSimple isCompact color="heading" onClick={resetInputValue}>
|
|
144
134
|
<span className="icon">
|
|
145
135
|
Y
|
|
146
136
|
</span>
|
|
147
137
|
</Button>
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
138
|
+
)}
|
|
139
|
+
<FormDescription className="s-1" description={description} name={name} />
|
|
140
|
+
<Popover
|
|
141
|
+
isOpen={isOpen}
|
|
142
|
+
parentRef={parentRef}
|
|
143
|
+
>
|
|
144
|
+
<Menu
|
|
145
|
+
className={`y-${color}`}
|
|
151
146
|
isOpen={isOpen}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
items={items}
|
|
160
|
-
{...getMenuProps()}
|
|
161
|
-
/>
|
|
162
|
-
</Popover>
|
|
163
|
-
</InputWrapper>
|
|
164
|
-
</>
|
|
147
|
+
getItemProps={getItemProps}
|
|
148
|
+
highlightedIndex={highlightedIndex}
|
|
149
|
+
items={items}
|
|
150
|
+
{...getMenuProps()}
|
|
151
|
+
/>
|
|
152
|
+
</Popover>
|
|
153
|
+
</div>
|
|
165
154
|
)
|
|
166
155
|
}
|
|
167
156
|
|
|
@@ -15,7 +15,7 @@ import { Popover, LoadingCircle } from 'ui/a'
|
|
|
15
15
|
|
|
16
16
|
import { FormDescription, FormLabel } from 'ui/f'
|
|
17
17
|
|
|
18
|
-
import {
|
|
18
|
+
import { lookUpInputValueFromFetchedOptions } from '../../../../common'
|
|
19
19
|
|
|
20
20
|
// Local Definitions
|
|
21
21
|
|
|
@@ -57,11 +57,7 @@ const MultipleCombobox = ({
|
|
|
57
57
|
minLength,
|
|
58
58
|
transformSearch,
|
|
59
59
|
disabled,
|
|
60
|
-
labelSpan,
|
|
61
|
-
desktopLabelSpan,
|
|
62
|
-
inputSpan,
|
|
63
60
|
placeholder,
|
|
64
|
-
desktopInputSpan,
|
|
65
61
|
setOptions,
|
|
66
62
|
promptCreateNewOption,
|
|
67
63
|
// ...otherProps
|
|
@@ -168,7 +164,19 @@ const MultipleCombobox = ({
|
|
|
168
164
|
const resetInputValue = () => setInputValue('')
|
|
169
165
|
|
|
170
166
|
return (
|
|
171
|
-
|
|
167
|
+
<div
|
|
168
|
+
id={id}
|
|
169
|
+
className={[
|
|
170
|
+
baseClassName,
|
|
171
|
+
componentClassName,
|
|
172
|
+
userClassName,
|
|
173
|
+
]
|
|
174
|
+
.filter((e) => e)
|
|
175
|
+
.join(' ')}
|
|
176
|
+
style={style}
|
|
177
|
+
ref={parentRef}
|
|
178
|
+
{...getComboboxProps()}
|
|
179
|
+
>
|
|
172
180
|
<FormLabel
|
|
173
181
|
className={[
|
|
174
182
|
baseClassName,
|
|
@@ -180,63 +188,45 @@ const MultipleCombobox = ({
|
|
|
180
188
|
name={name}
|
|
181
189
|
optional={optional}
|
|
182
190
|
color={labelColor}
|
|
183
|
-
columnSpan={labelSpan}
|
|
184
|
-
desktopColumnSpan={desktopLabelSpan}
|
|
185
191
|
>
|
|
186
192
|
{label}
|
|
187
193
|
</FormLabel>
|
|
188
194
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
{selectedItems?.length > 0 && (
|
|
205
|
-
<div className="selected-items">
|
|
206
|
-
{selectedItems.map((selectedItem, index) => (
|
|
207
|
-
<div
|
|
208
|
-
key={selectedItem.label}
|
|
209
|
-
{...getSelectedItemProps({ selectedItem, index })}
|
|
210
|
-
className="item"
|
|
195
|
+
{selectedItems?.length > 0 && (
|
|
196
|
+
<div className="selected-items">
|
|
197
|
+
{selectedItems.map((selectedItem, index) => (
|
|
198
|
+
<div
|
|
199
|
+
key={selectedItem.label}
|
|
200
|
+
{...getSelectedItemProps({ selectedItem, index })}
|
|
201
|
+
className="item"
|
|
202
|
+
>
|
|
203
|
+
<Button
|
|
204
|
+
onClick={(e) => {
|
|
205
|
+
e.stopPropagation()
|
|
206
|
+
removeSelectedItem(selectedItem)
|
|
207
|
+
}}
|
|
208
|
+
isCompact
|
|
209
|
+
color={color}
|
|
211
210
|
>
|
|
212
|
-
<
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
</Button>
|
|
223
|
-
</div>
|
|
224
|
-
))}
|
|
225
|
-
</div>
|
|
211
|
+
<span>{selectedItem.label}</span>
|
|
212
|
+
<span className="icon close">Y</span>
|
|
213
|
+
</Button>
|
|
214
|
+
</div>
|
|
215
|
+
))}
|
|
216
|
+
</div>
|
|
217
|
+
)}
|
|
218
|
+
<input
|
|
219
|
+
{...getInputProps(
|
|
220
|
+
getDropdownProps({ preventKeyAction: isOpen }),
|
|
226
221
|
)}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
/>
|
|
236
|
-
{isFetching && (
|
|
237
|
-
<LoadingCircle className="x-main" />
|
|
238
|
-
)}
|
|
239
|
-
{inputValue.length > minLength && !isFetching && (
|
|
222
|
+
className="input"
|
|
223
|
+
disabled={disabled}
|
|
224
|
+
placeholder={placeholder}
|
|
225
|
+
/>
|
|
226
|
+
{isFetching && (
|
|
227
|
+
<LoadingCircle className="x-main" />
|
|
228
|
+
)}
|
|
229
|
+
{inputValue.length > minLength && !isFetching && (
|
|
240
230
|
<Button
|
|
241
231
|
isSimple
|
|
242
232
|
isCompact
|
|
@@ -247,24 +237,24 @@ const MultipleCombobox = ({
|
|
|
247
237
|
Y
|
|
248
238
|
</span>
|
|
249
239
|
</Button>
|
|
250
|
-
|
|
240
|
+
)}
|
|
251
241
|
|
|
252
|
-
|
|
253
|
-
|
|
242
|
+
<FormDescription className="s-1" description={description} name={name} />
|
|
243
|
+
<Popover
|
|
244
|
+
isOpen={isOpen}
|
|
245
|
+
parentRef={parentRef}
|
|
246
|
+
>
|
|
247
|
+
<Menu
|
|
248
|
+
className={`y-${color}`}
|
|
254
249
|
isOpen={isOpen}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
{...getMenuProps()}
|
|
264
|
-
/>
|
|
265
|
-
</Popover>
|
|
266
|
-
</InputWrapper>
|
|
267
|
-
</>
|
|
250
|
+
getItemProps={getItemProps}
|
|
251
|
+
highlightedIndex={highlightedIndex}
|
|
252
|
+
items={getFilteredItems()}
|
|
253
|
+
{...getMenuProps()}
|
|
254
|
+
/>
|
|
255
|
+
</Popover>
|
|
256
|
+
|
|
257
|
+
</div>
|
|
268
258
|
)
|
|
269
259
|
}
|
|
270
260
|
|