@pareto-engineering/design-system 4.0.0-alpha.35 → 4.0.0-alpha.37
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/InputWrapper/InputWrapper.js +74 -0
- package/dist/cjs/f/common/InputWrapper/index.js +13 -0
- package/dist/cjs/f/common/InputWrapper/styles.scss +13 -0
- package/dist/cjs/f/common/Label/Label.js +18 -4
- package/dist/cjs/f/common/Label/styles.scss +8 -2
- package/dist/cjs/f/common/index.js +8 -1
- package/dist/cjs/f/fields/Checkbox/Checkbox.js +40 -10
- package/dist/cjs/f/fields/Checkbox/styles.scss +6 -8
- package/dist/cjs/f/fields/ChoicesInput/ChoicesInput.js +42 -20
- package/dist/cjs/f/fields/ChoicesInput/common/Choice/Choice.js +1 -1
- package/dist/cjs/f/fields/ChoicesInput/styles.scss +50 -35
- package/dist/cjs/f/fields/QueryChoices/QueryChoices.js +26 -2
- package/dist/cjs/f/fields/QueryCombobox/QueryCombobox.js +35 -5
- package/dist/cjs/f/fields/QueryCombobox/common/Combobox/Combobox.js +41 -14
- package/dist/cjs/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +33 -23
- package/dist/cjs/f/fields/QueryCombobox/styles.scss +58 -28
- package/dist/cjs/f/fields/QuerySelect/QuerySelect.js +17 -3
- package/dist/cjs/f/fields/RatingsInput/RatingsInput.js +41 -19
- package/dist/cjs/f/fields/RatingsInput/common/Rating/Rating.js +3 -3
- package/dist/cjs/f/fields/RatingsInput/styles.scss +6 -13
- package/dist/cjs/f/fields/SelectInput/SelectInput.js +45 -15
- package/dist/cjs/f/fields/SelectInput/styles.scss +41 -18
- package/dist/cjs/f/fields/TextInput/TextInput.js +38 -16
- package/dist/cjs/f/fields/TextInput/styles.scss +28 -22
- package/dist/cjs/f/fields/TextareaInput/TextareaInput.js +42 -21
- package/dist/cjs/f/fields/TextareaInput/styles.scss +42 -27
- package/dist/es/f/common/InputWrapper/InputWrapper.js +66 -0
- package/dist/es/f/common/InputWrapper/index.js +2 -0
- package/dist/es/f/common/InputWrapper/styles.scss +13 -0
- package/dist/es/f/common/Label/Label.js +18 -4
- package/dist/es/f/common/Label/styles.scss +8 -2
- package/dist/es/f/common/index.js +2 -1
- package/dist/es/f/fields/Checkbox/Checkbox.js +41 -11
- package/dist/es/f/fields/Checkbox/styles.scss +6 -8
- package/dist/es/f/fields/ChoicesInput/ChoicesInput.js +43 -21
- package/dist/es/f/fields/ChoicesInput/common/Choice/Choice.js +1 -1
- package/dist/es/f/fields/ChoicesInput/styles.scss +50 -35
- package/dist/es/f/fields/QueryChoices/QueryChoices.js +26 -2
- package/dist/es/f/fields/QueryCombobox/QueryCombobox.js +35 -5
- package/dist/es/f/fields/QueryCombobox/common/Combobox/Combobox.js +41 -14
- package/dist/es/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +33 -23
- package/dist/es/f/fields/QueryCombobox/styles.scss +58 -28
- package/dist/es/f/fields/QuerySelect/QuerySelect.js +17 -3
- package/dist/es/f/fields/RatingsInput/RatingsInput.js +42 -20
- package/dist/es/f/fields/RatingsInput/common/Rating/Rating.js +3 -3
- package/dist/es/f/fields/RatingsInput/styles.scss +6 -13
- package/dist/es/f/fields/SelectInput/SelectInput.js +46 -16
- package/dist/es/f/fields/SelectInput/styles.scss +41 -18
- package/dist/es/f/fields/TextInput/TextInput.js +39 -17
- package/dist/es/f/fields/TextInput/styles.scss +28 -22
- package/dist/es/f/fields/TextareaInput/TextareaInput.js +43 -22
- package/dist/es/f/fields/TextareaInput/styles.scss +42 -27
- package/package.json +2 -2
- package/src/stories/f/Checkbox.stories.jsx +22 -7
- package/src/stories/f/ChoicesInput.stories.jsx +21 -7
- package/src/stories/f/QueryChoices.stories.jsx +20 -4
- package/src/stories/f/QueryCombobox.stories.jsx +25 -13
- package/src/stories/f/QuerySelect.stories.jsx +20 -5
- package/src/stories/f/RatingsInput.stories.jsx +16 -2
- package/src/stories/f/SelectInput.stories.jsx +20 -5
- package/src/stories/f/TextInput.stories.jsx +23 -9
- package/src/stories/f/TextareaInput.stories.jsx +16 -2
- package/src/ui/f/common/InputWrapper/InputWrapper.jsx +89 -0
- package/src/ui/f/common/InputWrapper/index.js +2 -0
- package/src/ui/f/common/InputWrapper/styles.scss +13 -0
- package/src/ui/f/common/Label/Label.jsx +18 -2
- package/src/ui/f/common/Label/styles.scss +8 -2
- package/src/ui/f/common/index.js +1 -0
- package/src/ui/f/fields/Checkbox/Checkbox.jsx +65 -27
- package/src/ui/f/fields/Checkbox/styles.scss +6 -8
- package/src/ui/f/fields/ChoicesInput/ChoicesInput.jsx +75 -47
- package/src/ui/f/fields/ChoicesInput/common/Choice/Choice.jsx +10 -3
- package/src/ui/f/fields/ChoicesInput/styles.scss +50 -35
- package/src/ui/f/fields/QueryChoices/QueryChoices.jsx +28 -0
- package/src/ui/f/fields/QueryCombobox/QueryCombobox.jsx +37 -2
- package/src/ui/f/fields/QueryCombobox/common/Combobox/Combobox.jsx +67 -38
- package/src/ui/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.jsx +81 -66
- package/src/ui/f/fields/QueryCombobox/styles.scss +58 -28
- package/src/ui/f/fields/QuerySelect/QuerySelect.jsx +16 -1
- package/src/ui/f/fields/RatingsInput/RatingsInput.jsx +55 -28
- package/src/ui/f/fields/RatingsInput/common/Rating/Rating.jsx +3 -3
- package/src/ui/f/fields/RatingsInput/styles.scss +6 -13
- package/src/ui/f/fields/SelectInput/SelectInput.jsx +88 -49
- package/src/ui/f/fields/SelectInput/styles.scss +41 -18
- package/src/ui/f/fields/TextInput/TextInput.jsx +52 -29
- package/src/ui/f/fields/TextInput/styles.scss +28 -22
- package/src/ui/f/fields/TextareaInput/TextareaInput.jsx +65 -43
- package/src/ui/f/fields/TextareaInput/styles.scss +42 -27
- package/tests/__snapshots__/Storyshots.test.js.snap +4698 -3122
|
@@ -29,10 +29,18 @@ export default {
|
|
|
29
29
|
),
|
|
30
30
|
],
|
|
31
31
|
argTypes:{
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
disabled :{ control: 'boolean' },
|
|
33
|
+
type :{ control: 'text' },
|
|
34
|
+
name :{ control: 'text' },
|
|
35
|
+
color :{ control: 'text' },
|
|
36
|
+
label :{ control: 'text' },
|
|
37
|
+
labelColor :{ control: 'text' },
|
|
38
|
+
multiple :{ control: 'boolean' },
|
|
39
|
+
optional :{ control: 'boolean' },
|
|
40
|
+
labelSpan :{ control: 'number' },
|
|
41
|
+
inputSpan :{ control: 'number' },
|
|
42
|
+
desktopLabelSpan:{ control: 'number' },
|
|
43
|
+
desktopInputSpan:{ control: 'number' },
|
|
36
44
|
},
|
|
37
45
|
}
|
|
38
46
|
|
|
@@ -121,7 +129,7 @@ const ResolvedTemplate = ({ defaultFormikState, ...otherProps }) => {
|
|
|
121
129
|
}
|
|
122
130
|
|
|
123
131
|
return (
|
|
124
|
-
|
|
132
|
+
<div className="grid">
|
|
125
133
|
<QueryCombobox
|
|
126
134
|
label="Search for a team"
|
|
127
135
|
optionsKeyMap={{
|
|
@@ -136,13 +144,7 @@ const ResolvedTemplate = ({ defaultFormikState, ...otherProps }) => {
|
|
|
136
144
|
searchVariable="name_Icontains"
|
|
137
145
|
{...otherProps}
|
|
138
146
|
/>
|
|
139
|
-
<div
|
|
140
|
-
style={{
|
|
141
|
-
display :'flex',
|
|
142
|
-
alignItems :'flex-end',
|
|
143
|
-
flexDirection:'column',
|
|
144
|
-
}}
|
|
145
|
-
>
|
|
147
|
+
<div className="container">
|
|
146
148
|
<FormDebugger />
|
|
147
149
|
<Button
|
|
148
150
|
onClick={updateFormikState}
|
|
@@ -150,7 +152,7 @@ const ResolvedTemplate = ({ defaultFormikState, ...otherProps }) => {
|
|
|
150
152
|
{multiple ? 'Add formik values' : 'Replace formik value'}
|
|
151
153
|
</Button>
|
|
152
154
|
</div>
|
|
153
|
-
|
|
155
|
+
</div>
|
|
154
156
|
)
|
|
155
157
|
}
|
|
156
158
|
|
|
@@ -217,6 +219,16 @@ MultipleSelectWithDefaultFormikState.args = {
|
|
|
217
219
|
},
|
|
218
220
|
}
|
|
219
221
|
|
|
222
|
+
export const OnSingleRow = ResolvedTemplate.bind({})
|
|
223
|
+
OnSingleRow.args = {
|
|
224
|
+
multiple :true,
|
|
225
|
+
defaultFormikState:{ teams: [] },
|
|
226
|
+
labelSpan :4,
|
|
227
|
+
inputSpan :4,
|
|
228
|
+
desktopLabelSpan :4,
|
|
229
|
+
desktopInputSpan :10,
|
|
230
|
+
}
|
|
231
|
+
|
|
220
232
|
// eslint-disable-next-line react/prop-types
|
|
221
233
|
// const RejectedTemplate = ({ multiple }) => {
|
|
222
234
|
// const Content = () => {
|
|
@@ -28,9 +28,15 @@ export default {
|
|
|
28
28
|
),
|
|
29
29
|
],
|
|
30
30
|
argTypes:{
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
color :{ control: 'text' },
|
|
32
|
+
label :{ control: 'text' },
|
|
33
|
+
labelColor :{ control: 'text' },
|
|
34
|
+
isLoading :{ control: 'boolean' },
|
|
35
|
+
optional :{ control: 'boolean' },
|
|
36
|
+
labelSpan :{ control: 'number' },
|
|
37
|
+
inputSpan :{ control: 'number' },
|
|
38
|
+
desktopLabelSpan:{ control: 'number' },
|
|
39
|
+
desktopInputSpan:{ control: 'number' },
|
|
34
40
|
},
|
|
35
41
|
}
|
|
36
42
|
const statuses = [
|
|
@@ -93,7 +99,7 @@ const Template = ({ isLoading, defaultFormikState, ...args }) => {
|
|
|
93
99
|
}
|
|
94
100
|
|
|
95
101
|
const Content = () => (
|
|
96
|
-
|
|
102
|
+
<div className="grid">
|
|
97
103
|
<QuerySelect
|
|
98
104
|
name="status"
|
|
99
105
|
label="Select Task Status"
|
|
@@ -108,7 +114,7 @@ const Template = ({ isLoading, defaultFormikState, ...args }) => {
|
|
|
108
114
|
{...args}
|
|
109
115
|
/>
|
|
110
116
|
<FormDebugger />
|
|
111
|
-
|
|
117
|
+
</div>
|
|
112
118
|
)
|
|
113
119
|
|
|
114
120
|
const initialValues = defaultFormikState ?? { status: '' }
|
|
@@ -140,3 +146,12 @@ export const Optional = Template.bind({})
|
|
|
140
146
|
Optional.args = {
|
|
141
147
|
optional:true,
|
|
142
148
|
}
|
|
149
|
+
|
|
150
|
+
export const OnSingleRow = Template.bind({})
|
|
151
|
+
OnSingleRow.args = {
|
|
152
|
+
...Base.args,
|
|
153
|
+
labelSpan :4,
|
|
154
|
+
inputSpan :4,
|
|
155
|
+
desktopLabelSpan:4,
|
|
156
|
+
desktopInputSpan:10,
|
|
157
|
+
}
|
|
@@ -27,19 +27,24 @@ export default {
|
|
|
27
27
|
ratingCount :{ control: 'number' },
|
|
28
28
|
name :{ control: 'text' },
|
|
29
29
|
label :{ control: 'text' },
|
|
30
|
+
labelColor :{ control: 'text' },
|
|
30
31
|
showRatingValue :{ control: 'boolean' },
|
|
31
32
|
displayRatingsLabel:{ control: 'boolean' },
|
|
32
33
|
labelMax :{ control: 'text' },
|
|
33
34
|
labelMin :{ control: 'text' },
|
|
34
35
|
optional :{ control: 'boolean' },
|
|
36
|
+
labelSpan :{ control: 'number' },
|
|
37
|
+
inputSpan :{ control: 'number' },
|
|
38
|
+
desktopLabelSpan :{ control: 'number' },
|
|
39
|
+
desktopInputSpan :{ control: 'number' },
|
|
35
40
|
},
|
|
36
41
|
}
|
|
37
42
|
|
|
38
43
|
const Template = (args) => (
|
|
39
|
-
|
|
44
|
+
<div className="grid">
|
|
40
45
|
<RatingsInput {...args} />
|
|
41
46
|
<FormDebugger />
|
|
42
|
-
|
|
47
|
+
</div>
|
|
43
48
|
)
|
|
44
49
|
|
|
45
50
|
export const Base = Template.bind({})
|
|
@@ -68,3 +73,12 @@ Labels.args = {
|
|
|
68
73
|
labelMin :'not satisfied.',
|
|
69
74
|
displayRatingsLabel:true,
|
|
70
75
|
}
|
|
76
|
+
|
|
77
|
+
export const OnSingleRow = Template.bind({})
|
|
78
|
+
OnSingleRow.args = {
|
|
79
|
+
...Base.args,
|
|
80
|
+
labelSpan :4,
|
|
81
|
+
inputSpan :4,
|
|
82
|
+
desktopLabelSpan:4,
|
|
83
|
+
desktopInputSpan:10,
|
|
84
|
+
}
|
|
@@ -22,17 +22,23 @@ export default {
|
|
|
22
22
|
),
|
|
23
23
|
],
|
|
24
24
|
argTypes:{
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
color :{ control: 'text' },
|
|
26
|
+
label :{ control: 'text' },
|
|
27
|
+
labelColor :{ control: 'text' },
|
|
28
|
+
disabled :{ control: 'boolean' },
|
|
29
|
+
optional :{ control: 'boolean' },
|
|
30
|
+
labelSpan :{ control: 'number' },
|
|
31
|
+
inputSpan :{ control: 'number' },
|
|
32
|
+
desktopLabelSpan:{ control: 'number' },
|
|
33
|
+
desktopInputSpan:{ control: 'number' },
|
|
28
34
|
},
|
|
29
35
|
}
|
|
30
36
|
|
|
31
37
|
const Template = (args) => (
|
|
32
|
-
|
|
38
|
+
<div className="grid">
|
|
33
39
|
<SelectInput {...args} />
|
|
34
40
|
<FormDebugger />
|
|
35
|
-
|
|
41
|
+
</div>
|
|
36
42
|
)
|
|
37
43
|
|
|
38
44
|
export const Base = Template.bind({})
|
|
@@ -85,3 +91,12 @@ DisabledWithDescriptionSelectInput.args = {
|
|
|
85
91
|
disabled :true,
|
|
86
92
|
description:'This is a description',
|
|
87
93
|
}
|
|
94
|
+
|
|
95
|
+
export const OnSingleRow = Template.bind({})
|
|
96
|
+
OnSingleRow.args = {
|
|
97
|
+
...Base.args,
|
|
98
|
+
labelSpan :4,
|
|
99
|
+
inputSpan :4,
|
|
100
|
+
desktopLabelSpan:4,
|
|
101
|
+
desktopInputSpan:10,
|
|
102
|
+
}
|
|
@@ -27,20 +27,25 @@ export default {
|
|
|
27
27
|
],
|
|
28
28
|
argTypes:{
|
|
29
29
|
// backgroundColor:{ control: 'color' },
|
|
30
|
-
placeholder
|
|
31
|
-
autoComplete:{ control: 'select', options: ['off', 'on'] },
|
|
32
|
-
disabled
|
|
33
|
-
type
|
|
34
|
-
name
|
|
35
|
-
label
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
placeholder :{ control: 'text' },
|
|
31
|
+
autoComplete :{ control: 'select', options: ['off', 'on'] },
|
|
32
|
+
disabled :{ control: 'boolean' },
|
|
33
|
+
type :{ control: 'text' },
|
|
34
|
+
name :{ control: 'text' },
|
|
35
|
+
label :{ control: 'text' },
|
|
36
|
+
labelColor :{ control: 'text' },
|
|
37
|
+
optional :{ control: 'boolean' },
|
|
38
|
+
symbol :{ control: 'text' },
|
|
39
|
+
labelSpan :{ control: 'number' },
|
|
40
|
+
inputSpan :{ control: 'number' },
|
|
41
|
+
desktopLabelSpan:{ control: 'number' },
|
|
42
|
+
desktopInputSpan:{ control: 'number' },
|
|
38
43
|
},
|
|
39
44
|
}
|
|
40
45
|
|
|
41
46
|
// eslint-disable-next-line react/prop-types
|
|
42
47
|
const Template = (args) => (
|
|
43
|
-
<div className="
|
|
48
|
+
<div className="grid">
|
|
44
49
|
<TextInput {...args} />
|
|
45
50
|
<FormDebugger />
|
|
46
51
|
</div>
|
|
@@ -111,3 +116,12 @@ HasSymbol.args = {
|
|
|
111
116
|
...Base.args,
|
|
112
117
|
symbol:"'$'",
|
|
113
118
|
}
|
|
119
|
+
|
|
120
|
+
export const OnSingleRow = Template.bind({})
|
|
121
|
+
OnSingleRow.args = {
|
|
122
|
+
...Base.args,
|
|
123
|
+
labelSpan :4,
|
|
124
|
+
inputSpan :4,
|
|
125
|
+
desktopLabelSpan:4,
|
|
126
|
+
desktopInputSpan:10,
|
|
127
|
+
}
|
|
@@ -27,18 +27,23 @@ export default {
|
|
|
27
27
|
// backgroundColor:{ control: 'color' },
|
|
28
28
|
name :{ control: 'text' },
|
|
29
29
|
label :{ control: 'text' },
|
|
30
|
+
labelColor :{ control: 'text' },
|
|
30
31
|
placeholder :{ control: 'text' },
|
|
31
32
|
disabled :{ control: 'boolean' },
|
|
32
33
|
labelAsDescription:{ control: 'boolean' },
|
|
33
34
|
optional :{ control: 'boolean' },
|
|
35
|
+
labelSpan :{ control: 'number' },
|
|
36
|
+
inputSpan :{ control: 'number' },
|
|
37
|
+
desktopLabelSpan :{ control: 'number' },
|
|
38
|
+
desktopInputSpan :{ control: 'number' },
|
|
34
39
|
},
|
|
35
40
|
}
|
|
36
41
|
|
|
37
42
|
const Template = (args) => (
|
|
38
|
-
|
|
43
|
+
<div className="grid">
|
|
39
44
|
<TextareaInput {...args} />
|
|
40
45
|
<FormDebugger />
|
|
41
|
-
|
|
46
|
+
</div>
|
|
42
47
|
)
|
|
43
48
|
|
|
44
49
|
export const Base = Template.bind({})
|
|
@@ -98,3 +103,12 @@ DisableResize.args = {
|
|
|
98
103
|
...Base.args,
|
|
99
104
|
resize:'none',
|
|
100
105
|
}
|
|
106
|
+
|
|
107
|
+
export const OnSingleRow = Template.bind({})
|
|
108
|
+
OnSingleRow.args = {
|
|
109
|
+
...Base.args,
|
|
110
|
+
labelSpan :4,
|
|
111
|
+
inputSpan :4,
|
|
112
|
+
desktopLabelSpan:4,
|
|
113
|
+
desktopInputSpan:10,
|
|
114
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
import * as React from 'react'
|
|
3
|
+
|
|
4
|
+
import { useInsertionEffect } from 'react'
|
|
5
|
+
|
|
6
|
+
import PropTypes from 'prop-types'
|
|
7
|
+
|
|
8
|
+
import styleNames from '@pareto-engineering/bem/exports'
|
|
9
|
+
|
|
10
|
+
// Local Definitions
|
|
11
|
+
|
|
12
|
+
const baseClassName = styleNames.base
|
|
13
|
+
|
|
14
|
+
const componentClassName = 'input-wrapper'
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* This is the component description.
|
|
18
|
+
*/
|
|
19
|
+
const InputWrapper = ({
|
|
20
|
+
id,
|
|
21
|
+
className:userClassName,
|
|
22
|
+
style,
|
|
23
|
+
children,
|
|
24
|
+
columnSpan,
|
|
25
|
+
desktopColumnSpan,
|
|
26
|
+
// ...otherProps
|
|
27
|
+
}) => {
|
|
28
|
+
useInsertionEffect(() => {
|
|
29
|
+
import('./styles.scss')
|
|
30
|
+
}, [])
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<div
|
|
34
|
+
id={id}
|
|
35
|
+
className={[
|
|
36
|
+
baseClassName,
|
|
37
|
+
componentClassName,
|
|
38
|
+
userClassName,
|
|
39
|
+
]
|
|
40
|
+
.filter((e) => e)
|
|
41
|
+
.join(' ')}
|
|
42
|
+
style={{
|
|
43
|
+
...style,
|
|
44
|
+
'--column-span' :columnSpan || 'var(--columns)',
|
|
45
|
+
'--column-span-md':desktopColumnSpan || 'var(--columns)',
|
|
46
|
+
}}
|
|
47
|
+
>
|
|
48
|
+
{children}
|
|
49
|
+
</div>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
InputWrapper.propTypes = {
|
|
54
|
+
/**
|
|
55
|
+
* The HTML id for this element
|
|
56
|
+
*/
|
|
57
|
+
id:PropTypes.string,
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The HTML class names for this element
|
|
61
|
+
*/
|
|
62
|
+
className:PropTypes.string,
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The React-written, css properties for this element.
|
|
66
|
+
*/
|
|
67
|
+
style:PropTypes.objectOf(PropTypes.string),
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* The children JSX
|
|
71
|
+
*/
|
|
72
|
+
children:PropTypes.node,
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* How many columns the input should span
|
|
76
|
+
*/
|
|
77
|
+
columnSpan:PropTypes.number,
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* How many columns the input should span on desktop
|
|
81
|
+
*/
|
|
82
|
+
desktopColumnSpan:PropTypes.number,
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
InputWrapper.defaultProps = {
|
|
86
|
+
// as :'label',
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export default InputWrapper
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
|
|
3
|
+
@use "@pareto-engineering/bem";
|
|
4
|
+
@use "@pareto-engineering/styles/src/mixins";
|
|
5
|
+
@use "@pareto-engineering/styles/src/globals" as *;
|
|
6
|
+
|
|
7
|
+
.#{bem.$base}.input-wrapper {
|
|
8
|
+
grid-column: span var(--column-span);
|
|
9
|
+
|
|
10
|
+
@include mixins.media($from: $sm-md) {
|
|
11
|
+
grid-column: span var(--column-span-md);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -25,6 +25,8 @@ const Label = ({
|
|
|
25
25
|
color,
|
|
26
26
|
optional,
|
|
27
27
|
as:Wrapper,
|
|
28
|
+
columnSpan,
|
|
29
|
+
desktopColumnSpan,
|
|
28
30
|
// ...otherProps
|
|
29
31
|
}) => {
|
|
30
32
|
useInsertionEffect(() => {
|
|
@@ -43,7 +45,11 @@ const Label = ({
|
|
|
43
45
|
]
|
|
44
46
|
.filter((e) => e)
|
|
45
47
|
.join(' ')}
|
|
46
|
-
style={
|
|
48
|
+
style={{
|
|
49
|
+
...style,
|
|
50
|
+
'--column-span' :columnSpan || 'var(--columns)',
|
|
51
|
+
'--column-span-md':desktopColumnSpan || 'var(--columns)',
|
|
52
|
+
}}
|
|
47
53
|
// {...otherProps}
|
|
48
54
|
>
|
|
49
55
|
{children}
|
|
@@ -91,11 +97,21 @@ Label.propTypes = {
|
|
|
91
97
|
* Whether the input should have an optional tag
|
|
92
98
|
*/
|
|
93
99
|
optional:PropTypes.bool,
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* How many columns the input should span
|
|
103
|
+
*/
|
|
104
|
+
columnSpan:PropTypes.number,
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* How many columns the input should span on desktop
|
|
108
|
+
*/
|
|
109
|
+
desktopColumnSpan:PropTypes.number,
|
|
94
110
|
}
|
|
95
111
|
|
|
96
112
|
Label.defaultProps = {
|
|
97
113
|
as :'label',
|
|
98
|
-
color :'
|
|
114
|
+
color :'paragraph',
|
|
99
115
|
optional:false,
|
|
100
116
|
}
|
|
101
117
|
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
2
|
|
|
3
3
|
@use "@pareto-engineering/bem";
|
|
4
|
-
@use "
|
|
4
|
+
@use "@pareto-engineering/styles/src/mixins";
|
|
5
|
+
@use "@pareto-engineering/styles/src/globals" as *;
|
|
5
6
|
|
|
6
7
|
.#{bem.$base}.form-label {
|
|
7
|
-
color: var(--
|
|
8
|
+
color: var(--x);
|
|
9
|
+
grid-column: span var(--column-span);
|
|
10
|
+
|
|
11
|
+
@include mixins.media($from: $sm-md) {
|
|
12
|
+
grid-column: span var(--column-span-md);
|
|
13
|
+
}
|
|
8
14
|
}
|
package/src/ui/f/common/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import styleNames from '@pareto-engineering/bem/exports'
|
|
|
9
9
|
|
|
10
10
|
import { useField } from 'formik'
|
|
11
11
|
|
|
12
|
-
import { FormLabel, FormDescription } from '../../common'
|
|
12
|
+
import { FormLabel, FormDescription, InputWrapper } from '../../common'
|
|
13
13
|
|
|
14
14
|
// Local Definitions
|
|
15
15
|
|
|
@@ -29,6 +29,11 @@ const Checkbox = ({
|
|
|
29
29
|
description,
|
|
30
30
|
disabled,
|
|
31
31
|
optional,
|
|
32
|
+
labelColor,
|
|
33
|
+
labelSpan,
|
|
34
|
+
desktopLabelSpan,
|
|
35
|
+
inputSpan,
|
|
36
|
+
desktopInputSpan,
|
|
32
37
|
// ...otherProps
|
|
33
38
|
}) => {
|
|
34
39
|
useInsertionEffect(() => {
|
|
@@ -38,34 +43,42 @@ const Checkbox = ({
|
|
|
38
43
|
const [field] = useField({ name, type: 'checkbox' })
|
|
39
44
|
|
|
40
45
|
return (
|
|
41
|
-
|
|
42
|
-
id={id}
|
|
43
|
-
className={[
|
|
44
|
-
|
|
45
|
-
baseClassName,
|
|
46
|
-
|
|
47
|
-
componentClassName,
|
|
48
|
-
userClassName,
|
|
49
|
-
]
|
|
50
|
-
.filter((e) => e)
|
|
51
|
-
.join(' ')}
|
|
52
|
-
style={style}
|
|
53
|
-
// {...otherProps}
|
|
54
|
-
>
|
|
46
|
+
<>
|
|
55
47
|
{label && (
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
48
|
+
<FormLabel
|
|
49
|
+
name={name}
|
|
50
|
+
color={labelColor}
|
|
51
|
+
optional={optional}
|
|
52
|
+
columnSpan={labelSpan}
|
|
53
|
+
desktopColumnSpan={desktopLabelSpan}
|
|
54
|
+
// {...otherProps}
|
|
55
|
+
>
|
|
56
|
+
{label}
|
|
57
|
+
</FormLabel>
|
|
59
58
|
)}
|
|
60
|
-
<
|
|
61
|
-
id={
|
|
62
|
-
className=
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
59
|
+
<InputWrapper
|
|
60
|
+
id={id}
|
|
61
|
+
className={[
|
|
62
|
+
baseClassName,
|
|
63
|
+
componentClassName,
|
|
64
|
+
userClassName,
|
|
65
|
+
]
|
|
66
|
+
.filter((e) => e)
|
|
67
|
+
.join(' ')}
|
|
68
|
+
style={style}
|
|
69
|
+
columnSpan={inputSpan}
|
|
70
|
+
desktopColumnSpan={desktopInputSpan}
|
|
71
|
+
>
|
|
72
|
+
<input
|
|
73
|
+
id={name}
|
|
74
|
+
className="input"
|
|
75
|
+
type="checkbox"
|
|
76
|
+
disabled={disabled}
|
|
77
|
+
{...field}
|
|
78
|
+
/>
|
|
79
|
+
<FormDescription className="s-1" description={description} name={name} />
|
|
80
|
+
</InputWrapper>
|
|
81
|
+
</>
|
|
69
82
|
)
|
|
70
83
|
}
|
|
71
84
|
|
|
@@ -100,11 +113,36 @@ Checkbox.propTypes = {
|
|
|
100
113
|
*/
|
|
101
114
|
disabled:PropTypes.bool,
|
|
102
115
|
|
|
116
|
+
/**
|
|
117
|
+
* The color of the label
|
|
118
|
+
*/
|
|
119
|
+
labelColor:PropTypes.string,
|
|
120
|
+
|
|
103
121
|
/**
|
|
104
122
|
* The input label
|
|
105
123
|
*/
|
|
106
124
|
label:PropTypes.string,
|
|
107
125
|
|
|
126
|
+
/**
|
|
127
|
+
* The number of columns the label should span
|
|
128
|
+
*/
|
|
129
|
+
labelSpan:PropTypes.number,
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* The number of columns the input should span
|
|
133
|
+
*/
|
|
134
|
+
inputSpan:PropTypes.number,
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* The number of columns the label should span on desktop
|
|
138
|
+
*/
|
|
139
|
+
desktopLabelSpan:PropTypes.number,
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* The number of columns the input should span on desktop
|
|
143
|
+
*/
|
|
144
|
+
desktopInputSpan:PropTypes.number,
|
|
145
|
+
|
|
108
146
|
/**
|
|
109
147
|
* Whether the input should have an optional tag
|
|
110
148
|
*/
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
2
|
|
|
3
3
|
@use "@pareto-engineering/bem";
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
@use "@pareto-engineering/styles/src/mixins";
|
|
5
|
+
@use "@pareto-engineering/styles/src/globals" as *;
|
|
6
6
|
|
|
7
7
|
.#{bem.$base}.checkbox {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
.#{bem.$base}.label {
|
|
13
|
-
margin-bottom: $default-margin;
|
|
8
|
+
&.#{bem.$base}.input-wrapper {
|
|
9
|
+
align-items: flex-start;
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
14
12
|
}
|
|
15
13
|
}
|