@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
|
@@ -20,9 +20,16 @@ $on-disabled-background: var(--on-background-inputs-30);
|
|
|
20
20
|
|
|
21
21
|
.#{bem.$base}.combobox,
|
|
22
22
|
.#{bem.$base}.multiple-combobox {
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: column;
|
|
23
25
|
outline: none;
|
|
24
26
|
position: relative;
|
|
25
27
|
|
|
28
|
+
> .#{bem.$base}.form-label {
|
|
29
|
+
margin-bottom: var(--gap);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
26
33
|
.#{bem.$base}.popover {
|
|
27
34
|
border: $default-border;
|
|
28
35
|
border-radius: $default-input-border-radius;
|
|
@@ -53,51 +60,45 @@ $on-disabled-background: var(--on-background-inputs-30);
|
|
|
53
60
|
}
|
|
54
61
|
}
|
|
55
62
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
63
|
+
>.#{bem.$base}.loading-circle,
|
|
64
|
+
>.#{bem.$base}.button {
|
|
65
|
+
position: absolute;
|
|
66
|
+
right: $default-loading-circle-displacement;
|
|
67
|
+
}
|
|
60
68
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
right: $default-loading-circle-displacement;
|
|
65
|
-
}
|
|
69
|
+
>.#{bem.$base}.loading-circle {
|
|
70
|
+
top: calc($default-loading-circle-displacement * 1.5);
|
|
71
|
+
}
|
|
66
72
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
73
|
+
>.#{bem.$base}.button {
|
|
74
|
+
top: $default-loading-circle-displacement;
|
|
75
|
+
}
|
|
70
76
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
77
|
+
> .input {
|
|
78
|
+
background: $default-background;
|
|
79
|
+
border: $default-border;
|
|
80
|
+
border-radius: calc(var(--theme-default-border-radius) / 2);
|
|
81
|
+
color: $on-default-background;
|
|
82
|
+
outline: none;
|
|
83
|
+
padding: $default-input-padding;
|
|
74
84
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
border-radius: calc(var(--theme-default-border-radius) / 2);
|
|
79
|
-
color: $on-default-background;
|
|
80
|
-
outline: none;
|
|
81
|
-
padding: $default-input-padding;
|
|
85
|
+
&::placeholder {
|
|
86
|
+
color: var(--metadata);
|
|
87
|
+
}
|
|
82
88
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
89
|
+
&:disabled {
|
|
90
|
+
background-color: $disabled-background;
|
|
91
|
+
color: $on-disabled-background;
|
|
92
|
+
}
|
|
86
93
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
94
|
+
&:not(:disabled) {
|
|
95
|
+
&:hover,
|
|
96
|
+
&:active {
|
|
97
|
+
border: $hover-border;
|
|
90
98
|
}
|
|
91
99
|
|
|
92
|
-
&:
|
|
93
|
-
|
|
94
|
-
&:active {
|
|
95
|
-
border: $hover-border;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
&:focus {
|
|
99
|
-
border: $focus-border;
|
|
100
|
-
}
|
|
100
|
+
&:focus {
|
|
101
|
+
border: $focus-border;
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
104
|
}
|
|
@@ -33,10 +33,6 @@ const QuerySelect = ({
|
|
|
33
33
|
loadingOption,
|
|
34
34
|
defaultOption,
|
|
35
35
|
validate,
|
|
36
|
-
labelSpan,
|
|
37
|
-
desktopLabelSpan,
|
|
38
|
-
inputSpan,
|
|
39
|
-
desktopInputSpan,
|
|
40
36
|
// ...otherProps
|
|
41
37
|
}) => {
|
|
42
38
|
const [, , helpers] = useField({ name, validate })
|
|
@@ -101,10 +97,6 @@ const QuerySelect = ({
|
|
|
101
97
|
disabled={isFetching || disabled}
|
|
102
98
|
options={options}
|
|
103
99
|
isLoading={isFetching}
|
|
104
|
-
labelSpan={labelSpan}
|
|
105
|
-
desktopLabelSpan={desktopLabelSpan}
|
|
106
|
-
inputSpan={inputSpan}
|
|
107
|
-
desktopInputSpan={desktopInputSpan}
|
|
108
100
|
/>
|
|
109
101
|
)
|
|
110
102
|
}
|
|
@@ -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, memo } from 'react'
|
|
4
|
+
import { useState, useInsertionEffect, memo } from 'react'
|
|
5
5
|
|
|
6
6
|
import PropTypes from 'prop-types'
|
|
7
7
|
|
|
@@ -10,9 +10,7 @@ import styleNames from '@pareto-engineering/bem/exports'
|
|
|
10
10
|
// Local Definitions
|
|
11
11
|
|
|
12
12
|
import { Rating } from './common'
|
|
13
|
-
import { FormLabel
|
|
14
|
-
|
|
15
|
-
import './styles.scss'
|
|
13
|
+
import { FormLabel } from '../../common'
|
|
16
14
|
|
|
17
15
|
const baseClassName = styleNames.base
|
|
18
16
|
|
|
@@ -35,40 +33,35 @@ const RatingsInput = ({
|
|
|
35
33
|
labelMin,
|
|
36
34
|
displayRatingsLabel,
|
|
37
35
|
optional,
|
|
38
|
-
labelSpan,
|
|
39
|
-
desktopLabelSpan,
|
|
40
|
-
inputSpan,
|
|
41
|
-
desktopInputSpan,
|
|
42
36
|
// ...otherProps
|
|
43
37
|
}) => {
|
|
38
|
+
useInsertionEffect(() => {
|
|
39
|
+
import('./styles.scss')
|
|
40
|
+
}, [])
|
|
41
|
+
|
|
44
42
|
const [hover, setHover] = useState(null)
|
|
45
43
|
|
|
46
44
|
return (
|
|
47
|
-
|
|
45
|
+
<div
|
|
46
|
+
id={id}
|
|
47
|
+
className={[
|
|
48
|
+
baseClassName,
|
|
49
|
+
componentClassName,
|
|
50
|
+
userClassName,
|
|
51
|
+
]
|
|
52
|
+
.filter((e) => e)
|
|
53
|
+
.join(' ')}
|
|
54
|
+
style={style}
|
|
55
|
+
>
|
|
48
56
|
<FormLabel
|
|
49
57
|
name={name}
|
|
50
58
|
color={labelColor}
|
|
51
59
|
optional={optional}
|
|
52
|
-
columnSpan={labelSpan}
|
|
53
|
-
desktopColumnSpan={desktopLabelSpan}
|
|
54
60
|
// {...otherProps}
|
|
55
61
|
>
|
|
56
62
|
{label}
|
|
57
63
|
</FormLabel>
|
|
58
|
-
<
|
|
59
|
-
id={id}
|
|
60
|
-
className={[
|
|
61
|
-
baseClassName,
|
|
62
|
-
componentClassName,
|
|
63
|
-
userClassName,
|
|
64
|
-
'stars',
|
|
65
|
-
]
|
|
66
|
-
.filter((e) => e)
|
|
67
|
-
.join(' ')}
|
|
68
|
-
style={style}
|
|
69
|
-
columnSpan={inputSpan}
|
|
70
|
-
desktopColumnSpan={desktopInputSpan}
|
|
71
|
-
>
|
|
64
|
+
<div className="stars">
|
|
72
65
|
{displayRatingsLabel && <p className="label-text s-2 x-metadata c-x">{labelMin}</p>}
|
|
73
66
|
{[...Array(ratingCount)].map((_, index) => {
|
|
74
67
|
const ratingValue = index + 1
|
|
@@ -86,8 +79,8 @@ const RatingsInput = ({
|
|
|
86
79
|
)
|
|
87
80
|
})}
|
|
88
81
|
{displayRatingsLabel && <p className="label-text s-2 x-metadata c-x">{labelMax}</p>}
|
|
89
|
-
</
|
|
90
|
-
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
91
84
|
)
|
|
92
85
|
}
|
|
93
86
|
|
|
@@ -149,26 +142,6 @@ RatingsInput.propTypes = {
|
|
|
149
142
|
* String that will represent color for the label
|
|
150
143
|
*/
|
|
151
144
|
labelColor:PropTypes.string,
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* The number of columns the label should span
|
|
155
|
-
*/
|
|
156
|
-
labelSpan:PropTypes.number,
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* The number of columns the input should span
|
|
160
|
-
*/
|
|
161
|
-
inputSpan:PropTypes.number,
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* The number of columns the label should span on desktop
|
|
165
|
-
*/
|
|
166
|
-
desktopLabelSpan:PropTypes.number,
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* The number of columns the input should span on desktop
|
|
170
|
-
*/
|
|
171
|
-
desktopInputSpan:PropTypes.number,
|
|
172
145
|
}
|
|
173
146
|
|
|
174
147
|
RatingsInput.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 { memo } from 'react'
|
|
4
|
+
import { useInsertionEffect, memo } from 'react'
|
|
5
5
|
|
|
6
6
|
import { useField } from 'formik'
|
|
7
7
|
|
|
@@ -11,9 +11,7 @@ import styleNames from '@pareto-engineering/bem/exports'
|
|
|
11
11
|
|
|
12
12
|
import { LoadingCircle } from 'ui/a'
|
|
13
13
|
|
|
14
|
-
import { FormLabel, FormDescription
|
|
15
|
-
|
|
16
|
-
import './styles.scss'
|
|
14
|
+
import { FormLabel, FormDescription } from '../../common'
|
|
17
15
|
|
|
18
16
|
// Local Definitions
|
|
19
17
|
|
|
@@ -39,49 +37,44 @@ const SelectInput = ({
|
|
|
39
37
|
disabled,
|
|
40
38
|
isLoading,
|
|
41
39
|
autoComplete,
|
|
42
|
-
labelSpan,
|
|
43
|
-
desktopLabelSpan,
|
|
44
|
-
inputSpan,
|
|
45
|
-
desktopInputSpan,
|
|
46
40
|
// ...otherProps
|
|
47
41
|
}) => {
|
|
42
|
+
useInsertionEffect(() => {
|
|
43
|
+
import('./styles.scss')
|
|
44
|
+
}, [])
|
|
45
|
+
|
|
48
46
|
const [field] = useField({ name, validate })
|
|
49
47
|
|
|
50
48
|
return (
|
|
51
|
-
|
|
49
|
+
<div
|
|
50
|
+
id={id}
|
|
51
|
+
className={[
|
|
52
|
+
baseClassName,
|
|
53
|
+
componentClassName,
|
|
54
|
+
userClassName,
|
|
55
|
+
]
|
|
56
|
+
.filter((e) => e)
|
|
57
|
+
.join(' ')}
|
|
58
|
+
style={style}
|
|
59
|
+
>
|
|
52
60
|
<FormLabel
|
|
53
61
|
name={name}
|
|
54
62
|
color={labelColor}
|
|
55
63
|
optional={optional}
|
|
56
|
-
columnSpan={labelSpan}
|
|
57
|
-
desktopColumnSpan={desktopLabelSpan}
|
|
58
64
|
// {...otherProps}
|
|
59
65
|
>
|
|
60
66
|
{label}
|
|
61
67
|
</FormLabel>
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
columnSpan={inputSpan}
|
|
73
|
-
desktopColumnSpan={desktopInputSpan}
|
|
74
|
-
>
|
|
75
|
-
<div className={`select-wrapper${disabled ? ' disabled' : ''}`}>
|
|
76
|
-
<select
|
|
77
|
-
className={`input y-${color}`}
|
|
78
|
-
{...field}
|
|
79
|
-
value={field.value || ''}
|
|
80
|
-
id={name}
|
|
81
|
-
disabled={disabled}
|
|
82
|
-
autoComplete={autoComplete}
|
|
83
|
-
>
|
|
84
|
-
{
|
|
68
|
+
<div className={`select-wrapper${disabled ? ' disabled' : ''}`}>
|
|
69
|
+
<select
|
|
70
|
+
className={`input y-${color}`}
|
|
71
|
+
{...field}
|
|
72
|
+
value={field.value || ''}
|
|
73
|
+
id={name}
|
|
74
|
+
disabled={disabled}
|
|
75
|
+
autoComplete={autoComplete}
|
|
76
|
+
>
|
|
77
|
+
{
|
|
85
78
|
options.map((option) => {
|
|
86
79
|
// i.e if option is a string like "blah", return { value: "blah", label: "blah" }
|
|
87
80
|
const newOption = typeof option === 'string' ? { value: option, label: option } : option
|
|
@@ -97,14 +90,13 @@ const SelectInput = ({
|
|
|
97
90
|
)
|
|
98
91
|
})
|
|
99
92
|
}
|
|
100
|
-
|
|
101
|
-
|
|
93
|
+
</select>
|
|
94
|
+
{isLoading && (
|
|
102
95
|
<LoadingCircle className="x-main" />
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
</>
|
|
96
|
+
)}
|
|
97
|
+
</div>
|
|
98
|
+
<FormDescription className="s-1" description={description} name={name} />
|
|
99
|
+
</div>
|
|
108
100
|
)
|
|
109
101
|
}
|
|
110
102
|
|
|
@@ -181,26 +173,6 @@ SelectInput.propTypes = {
|
|
|
181
173
|
*/
|
|
182
174
|
autoComplete:PropTypes.string,
|
|
183
175
|
|
|
184
|
-
/**
|
|
185
|
-
* The number of columns the label should span
|
|
186
|
-
*/
|
|
187
|
-
labelSpan:PropTypes.number,
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* The number of columns the input should span
|
|
191
|
-
*/
|
|
192
|
-
inputSpan:PropTypes.number,
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* The number of columns the label should span on desktop
|
|
196
|
-
*/
|
|
197
|
-
desktopLabelSpan:PropTypes.number,
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* The number of columns the input should span on desktop
|
|
201
|
-
*/
|
|
202
|
-
desktopInputSpan:PropTypes.number,
|
|
203
|
-
|
|
204
176
|
/**
|
|
205
177
|
* Whether the input is optional or not
|
|
206
178
|
*/
|
|
@@ -16,8 +16,11 @@ $default-background: var(--background-inputs);
|
|
|
16
16
|
$disabled-background: var(--background-inputs-30);
|
|
17
17
|
|
|
18
18
|
.#{bem.$base}.select-input {
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
|
|
22
|
+
> .#{bem.$base}.form-label {
|
|
23
|
+
margin-bottom: var(--gap);
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
.select-wrapper {
|
|
@@ -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,9 +9,7 @@ import styleNames from '@pareto-engineering/bem/exports'
|
|
|
9
9
|
|
|
10
10
|
import { useField } from 'formik'
|
|
11
11
|
|
|
12
|
-
import { FormLabel, FormDescription
|
|
13
|
-
|
|
14
|
-
import './styles.scss'
|
|
12
|
+
import { FormLabel, FormDescription } from '../../common'
|
|
15
13
|
|
|
16
14
|
// Local Definitions
|
|
17
15
|
|
|
@@ -37,47 +35,46 @@ const TextInput = ({
|
|
|
37
35
|
placeholder,
|
|
38
36
|
optional,
|
|
39
37
|
autoComplete,
|
|
40
|
-
labelSpan,
|
|
41
|
-
desktopLabelSpan,
|
|
42
|
-
inputSpan,
|
|
43
|
-
desktopInputSpan,
|
|
44
38
|
symbol,
|
|
45
39
|
...otherProps
|
|
46
40
|
}) => {
|
|
41
|
+
useInsertionEffect(() => {
|
|
42
|
+
import('./styles.scss')
|
|
43
|
+
}, [])
|
|
44
|
+
|
|
47
45
|
const [field] = useField({ name, validate })
|
|
48
46
|
const symbolStyle = symbol
|
|
49
47
|
? { '--symbol': symbol }
|
|
50
48
|
: {}
|
|
51
49
|
|
|
50
|
+
const InputWrapper = symbol ? 'div' : React.Fragment
|
|
51
|
+
const inputWrapperProps = symbol ? { className: 'input-wrapper' } : {}
|
|
52
|
+
|
|
52
53
|
return (
|
|
53
|
-
|
|
54
|
+
<div
|
|
55
|
+
id={id}
|
|
56
|
+
className={[
|
|
57
|
+
baseClassName,
|
|
58
|
+
componentClassName,
|
|
59
|
+
userClassName,
|
|
60
|
+
`y-${color} ${symbol ? 'has-symbol' : ''}`,
|
|
61
|
+
]
|
|
62
|
+
.filter((e) => e)
|
|
63
|
+
.join(' ')}
|
|
64
|
+
style={{
|
|
65
|
+
...symbolStyle,
|
|
66
|
+
...style,
|
|
67
|
+
}}
|
|
68
|
+
>
|
|
54
69
|
<FormLabel
|
|
55
70
|
name={name}
|
|
56
71
|
color={labelColor}
|
|
57
72
|
optional={optional}
|
|
58
|
-
columnSpan={labelSpan}
|
|
59
|
-
desktopColumnSpan={desktopLabelSpan}
|
|
60
73
|
// {...otherProps}
|
|
61
74
|
>
|
|
62
75
|
{label}
|
|
63
76
|
</FormLabel>
|
|
64
|
-
<InputWrapper
|
|
65
|
-
id={id}
|
|
66
|
-
className={[
|
|
67
|
-
baseClassName,
|
|
68
|
-
componentClassName,
|
|
69
|
-
userClassName,
|
|
70
|
-
`y-${color} ${symbol ? 'has-symbol' : ''}`,
|
|
71
|
-
]
|
|
72
|
-
.filter((e) => e)
|
|
73
|
-
.join(' ')}
|
|
74
|
-
style={{
|
|
75
|
-
...symbolStyle,
|
|
76
|
-
...style,
|
|
77
|
-
}}
|
|
78
|
-
columnSpan={inputSpan}
|
|
79
|
-
desktopColumnSpan={desktopInputSpan}
|
|
80
|
-
>
|
|
77
|
+
<InputWrapper {...inputWrapperProps}>
|
|
81
78
|
<input
|
|
82
79
|
id={name}
|
|
83
80
|
className="input"
|
|
@@ -88,9 +85,9 @@ const TextInput = ({
|
|
|
88
85
|
{...field}
|
|
89
86
|
{...otherProps}
|
|
90
87
|
/>
|
|
91
|
-
<FormDescription className="s-1" description={description} name={name} />
|
|
92
88
|
</InputWrapper>
|
|
93
|
-
|
|
89
|
+
<FormDescription className="s-1" description={description} name={name} />
|
|
90
|
+
</div>
|
|
94
91
|
)
|
|
95
92
|
}
|
|
96
93
|
|
|
@@ -180,26 +177,6 @@ TextInput.propTypes = {
|
|
|
180
177
|
*/
|
|
181
178
|
autoComplete:PropTypes.string,
|
|
182
179
|
|
|
183
|
-
/**
|
|
184
|
-
* The number of columns the label should span
|
|
185
|
-
*/
|
|
186
|
-
labelSpan:PropTypes.number,
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* The number of columns the input should span
|
|
190
|
-
*/
|
|
191
|
-
inputSpan:PropTypes.number,
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* The number of columns the label should span on desktop
|
|
195
|
-
*/
|
|
196
|
-
desktopLabelSpan:PropTypes.number,
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* The number of columns the input should span on desktop
|
|
200
|
-
*/
|
|
201
|
-
desktopInputSpan:PropTypes.number,
|
|
202
|
-
|
|
203
180
|
/**
|
|
204
181
|
* A symbol to be set inside the input field
|
|
205
182
|
*/
|
|
@@ -19,12 +19,18 @@ $default-background: var(--background-inputs);
|
|
|
19
19
|
$disabled-background: var(--background-inputs-30);
|
|
20
20
|
|
|
21
21
|
.#{bem.$base}.text-input {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
|
|
25
|
+
> .#{bem.$base}.form-label {
|
|
26
|
+
margin-bottom: var(--gap);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
&.has-symbol {
|
|
31
|
+
> .input-wrapper {
|
|
32
|
+
position: relative;
|
|
26
33
|
|
|
27
|
-
&.has-symbol {
|
|
28
34
|
&::before {
|
|
29
35
|
color: var(--y);
|
|
30
36
|
content: var(--symbol);
|
|
@@ -33,39 +39,40 @@ $disabled-background: var(--background-inputs-30);
|
|
|
33
39
|
top: 50%;
|
|
34
40
|
transform: translate(-50%, -50%);
|
|
35
41
|
}
|
|
42
|
+
}
|
|
36
43
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
44
|
+
input {
|
|
45
|
+
padding: $default-padding-with-symbol;
|
|
40
46
|
}
|
|
47
|
+
}
|
|
41
48
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
.input {
|
|
50
|
+
background-color: $default-background;
|
|
51
|
+
border: $default-border;
|
|
52
|
+
border-radius: $default-input-border-radius;
|
|
53
|
+
color: var(--y);
|
|
54
|
+
outline: none;
|
|
55
|
+
padding: $default-padding;
|
|
56
|
+
width: 100%;
|
|
50
57
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
58
|
+
&::placeholder {
|
|
59
|
+
color: var(--metadata);
|
|
60
|
+
}
|
|
54
61
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
62
|
+
&:disabled {
|
|
63
|
+
background-color: $disabled-background;
|
|
64
|
+
}
|
|
58
65
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
66
|
+
&:not(:disabled) {
|
|
67
|
+
&:hover,
|
|
68
|
+
&:active {
|
|
69
|
+
border: $hover-border;
|
|
70
|
+
}
|
|
64
71
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
72
|
+
&:focus {
|
|
73
|
+
border: $focus-border;
|
|
68
74
|
}
|
|
69
75
|
}
|
|
70
76
|
}
|
|
71
77
|
}
|
|
78
|
+
|