@pareto-engineering/design-system 2.0.0-alpha.61 → 2.0.0-alpha.63
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/a/GradientBackground/GradientBackground.js +140 -0
- package/dist/cjs/a/GradientBackground/index.js +15 -0
- package/dist/cjs/a/GradientBackground/styles.scss +191 -0
- package/dist/cjs/a/Popover/common/Divider/Divider.js +67 -0
- package/dist/cjs/a/Popover/common/Divider/index.js +15 -0
- package/dist/cjs/a/Popover/common/Item/Item.js +67 -0
- package/dist/cjs/a/Popover/common/Item/index.js +15 -0
- package/dist/cjs/a/Popover/common/index.js +21 -0
- package/dist/cjs/c/AcceptCookies/AcceptCookies.js +134 -0
- package/dist/cjs/c/AcceptCookies/index.js +15 -0
- package/dist/cjs/c/AcceptCookies/styles.scss +49 -0
- package/dist/cjs/c/BlogCategoryButton/BlogCategoryButton.js +95 -0
- package/dist/cjs/c/BlogCategoryButton/index.js +15 -0
- package/dist/cjs/c/BlogContext/BlogContextProvider.js +63 -0
- package/dist/cjs/c/BlogContext/Context.js +16 -0
- package/dist/cjs/c/BlogContext/ContextProvider.js +63 -0
- package/dist/cjs/c/BlogContext/index.js +31 -0
- package/dist/cjs/c/BlogContext/useBlog.js +16 -0
- package/dist/cjs/c/BlogPost/BlogPost.js +147 -0
- package/dist/cjs/c/BlogPost/index.js +15 -0
- package/dist/cjs/c/BlogPost/styles.scss +33 -0
- package/dist/cjs/c/BlogPostsList/BlogPostsList.js +73 -0
- package/dist/cjs/c/BlogPostsList/common/Card/Card.js +170 -0
- package/dist/cjs/c/BlogPostsList/common/Card/index.js +15 -0
- package/dist/cjs/c/BlogPostsList/common/index.js +13 -0
- package/dist/cjs/c/BlogPostsList/index.js +15 -0
- package/dist/cjs/c/BlogPostsList/styles.scss +72 -0
- package/dist/cjs/c/SiteFooter/SiteFooter.js +73 -0
- package/dist/cjs/c/SiteFooter/common/Section/Section.js +95 -0
- package/dist/cjs/c/SiteFooter/common/Section/index.js +15 -0
- package/dist/cjs/c/SiteFooter/common/index.js +13 -0
- package/dist/cjs/c/SiteFooter/index.js +15 -0
- package/dist/cjs/c/SiteFooter/styles.scss +34 -0
- package/dist/cjs/c/SiteHeaderCTA/SiteHeaderCTA.js +108 -0
- package/dist/cjs/c/SiteHeaderCTA/index.js +15 -0
- package/dist/cjs/c/SiteHeaderCTA/styles.scss +44 -0
- package/dist/cjs/c/SiteMission/SiteMission.js +113 -0
- package/dist/cjs/{a/ColumnLabel → c/SiteMission}/index.js +3 -3
- package/dist/cjs/c/SiteMission/styles.scss +30 -0
- package/dist/cjs/c/SiteNavigation/SiteNavigation.js +130 -0
- package/dist/cjs/c/SiteNavigation/index.js +15 -0
- package/dist/cjs/c/SiteNavigation/styles.scss +118 -0
- package/dist/cjs/c/SiteOnboardingStep/SiteOnboardingStep.js +98 -0
- package/dist/cjs/c/SiteOnboardingStep/index.js +15 -0
- package/dist/cjs/c/SiteOnboardingStep/styles.scss +51 -0
- package/dist/cjs/c/SitePricing/SitePricing.js +108 -0
- package/dist/cjs/c/SitePricing/index.js +15 -0
- package/dist/cjs/c/SitePricing/styles.scss +73 -0
- package/dist/cjs/c/SiteServices/SiteServices.js +211 -0
- package/dist/cjs/c/SiteServices/index.js +15 -0
- package/dist/cjs/c/SiteServices/styles.scss +138 -0
- package/dist/cjs/c/TeamGallery/TeamGallery.js +80 -0
- package/dist/cjs/c/TeamGallery/common/PersonCard/PersonCard.js +84 -0
- package/dist/cjs/c/TeamGallery/common/PersonCard/index.js +15 -0
- package/dist/cjs/c/TeamGallery/common/index.js +13 -0
- package/dist/cjs/c/TeamGallery/index.js +15 -0
- package/dist/cjs/c/TeamGallery/styles.scss +100 -0
- package/dist/cjs/c/Testimonials/Testimonials.js +119 -0
- package/dist/cjs/c/Testimonials/index.js +15 -0
- package/dist/cjs/c/Testimonials/styles.scss +112 -0
- package/dist/cjs/{a/ColumnLabel/ColumnLabel.js → experimental/GradientBackground/GradientBackground.js} +30 -32
- package/dist/cjs/experimental/GradientBackground/index.js +15 -0
- package/dist/cjs/experimental/GradientBackground/styles.scss +64 -0
- package/dist/cjs/experimental/index.js +13 -0
- package/dist/cjs/f/FormInput/FormInput.js +7 -0
- package/dist/cjs/f/common/Label/Label.js +1 -1
- package/dist/cjs/f/common/Label/styles.scss +1 -4
- package/dist/cjs/f/fields/Checkbox/Checkbox.js +117 -0
- package/dist/cjs/f/fields/Checkbox/index.js +15 -0
- package/dist/cjs/f/fields/Checkbox/styles.scss +14 -0
- package/dist/cjs/f/fields/ChoicesInput/ChoicesInput.js +1 -1
- package/dist/cjs/f/fields/ChoicesInput/common/Choice/Choice.js +5 -2
- package/dist/cjs/f/fields/IntlTelInput/IntlTelInput.js +170 -0
- package/dist/cjs/f/fields/IntlTelInput/index.js +15 -0
- package/dist/cjs/f/fields/IntlTelInput/styles.scss +37 -0
- 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 +12 -3
- package/dist/cjs/f/fields/QuerySelect/QuerySelect.js +12 -3
- package/dist/cjs/f/fields/QuerySelect/styles.scss +21 -0
- package/dist/cjs/f/fields/RatingsInput/common/Rating/Rating.js +11 -2
- package/dist/cjs/f/fields/TaskRecommendation/TaskRecommendation.js +129 -0
- package/dist/cjs/f/fields/TaskRecommendation/index.js +15 -0
- package/dist/cjs/f/fields/TaskRecommendation/styles.scss +37 -0
- package/dist/cjs/f/fields/TaskRecommendationInput/TaskRecommendationInput.js +1 -1
- package/dist/cjs/f/fields/TaskRecommendationInput/styles.scss +4 -0
- package/dist/cjs/f/fields/TextArea/TextArea.js +141 -0
- package/dist/cjs/f/fields/TextArea/index.js +15 -0
- package/dist/cjs/f/fields/TextArea/styles.scss +19 -0
- package/dist/cjs/f/fields/index.js +9 -1
- package/dist/cjs/test/QueryLoader/styles.scss +9 -0
- package/dist/es/a/GradientBackground/GradientBackground.js +118 -0
- package/dist/es/a/GradientBackground/index.js +2 -0
- package/dist/es/a/GradientBackground/styles.scss +191 -0
- package/dist/es/a/Popover/common/Divider/Divider.js +47 -0
- package/dist/es/a/Popover/common/Divider/index.js +2 -0
- package/dist/es/a/Popover/common/Item/Item.js +47 -0
- package/dist/es/a/Popover/common/Item/index.js +2 -0
- package/dist/es/a/Popover/common/index.js +2 -0
- package/dist/es/c/AcceptCookies/AcceptCookies.js +117 -0
- package/dist/es/c/AcceptCookies/index.js +2 -0
- package/dist/es/c/AcceptCookies/styles.scss +49 -0
- package/dist/es/c/BlogCategoryButton/BlogCategoryButton.js +68 -0
- package/dist/es/c/BlogCategoryButton/index.js +2 -0
- package/dist/es/c/BlogContext/BlogContextProvider.js +45 -0
- package/dist/es/c/BlogContext/Context.js +2 -0
- package/dist/es/c/BlogContext/ContextProvider.js +45 -0
- package/dist/es/c/BlogContext/index.js +4 -0
- package/dist/es/c/BlogContext/useBlog.js +3 -0
- package/dist/es/c/BlogPost/BlogPost.js +128 -0
- package/dist/es/c/BlogPost/index.js +2 -0
- package/dist/es/c/BlogPost/styles.scss +33 -0
- package/dist/es/c/BlogPostsList/BlogPostsList.js +56 -0
- package/dist/es/c/BlogPostsList/common/Card/Card.js +143 -0
- package/dist/es/c/BlogPostsList/common/Card/index.js +2 -0
- package/dist/es/c/BlogPostsList/common/index.js +1 -0
- package/dist/es/c/BlogPostsList/index.js +2 -0
- package/dist/es/c/BlogPostsList/styles.scss +72 -0
- package/dist/es/c/SiteFooter/SiteFooter.js +56 -0
- package/dist/es/c/SiteFooter/common/Section/Section.js +73 -0
- package/dist/es/c/SiteFooter/common/Section/index.js +2 -0
- package/dist/es/c/SiteFooter/common/index.js +1 -0
- package/dist/es/c/SiteFooter/index.js +2 -0
- package/dist/es/c/SiteFooter/styles.scss +34 -0
- package/dist/es/c/SiteHeaderCTA/SiteHeaderCTA.js +92 -0
- package/dist/es/c/SiteHeaderCTA/index.js +2 -0
- package/dist/es/c/SiteHeaderCTA/styles.scss +44 -0
- package/dist/es/c/SiteMission/SiteMission.js +96 -0
- package/dist/es/c/SiteMission/index.js +2 -0
- package/dist/es/c/SiteMission/styles.scss +30 -0
- package/dist/es/c/SiteNavigation/SiteNavigation.js +111 -0
- package/dist/es/c/SiteNavigation/index.js +2 -0
- package/dist/es/c/SiteNavigation/styles.scss +118 -0
- package/dist/es/c/SiteOnboardingStep/SiteOnboardingStep.js +81 -0
- package/dist/es/c/SiteOnboardingStep/index.js +2 -0
- package/dist/es/c/SiteOnboardingStep/styles.scss +51 -0
- package/dist/es/c/SitePricing/SitePricing.js +91 -0
- package/dist/es/c/SitePricing/index.js +2 -0
- package/dist/es/c/SitePricing/styles.scss +73 -0
- package/dist/es/c/SiteServices/SiteServices.js +195 -0
- package/dist/es/c/SiteServices/index.js +2 -0
- package/dist/es/c/SiteServices/styles.scss +138 -0
- package/dist/es/c/TeamGallery/TeamGallery.js +64 -0
- package/dist/es/c/TeamGallery/common/PersonCard/PersonCard.js +64 -0
- package/dist/es/c/TeamGallery/common/PersonCard/index.js +2 -0
- package/dist/es/c/TeamGallery/common/index.js +1 -0
- package/dist/es/c/TeamGallery/index.js +2 -0
- package/dist/es/c/TeamGallery/styles.scss +100 -0
- package/dist/es/c/Testimonials/Testimonials.js +99 -0
- package/dist/es/c/Testimonials/index.js +2 -0
- package/dist/es/c/Testimonials/styles.scss +112 -0
- package/dist/es/experimental/GradientBackground/GradientBackground.js +76 -0
- package/dist/es/experimental/GradientBackground/index.js +2 -0
- package/dist/es/experimental/GradientBackground/styles.scss +64 -0
- package/dist/es/experimental/index.js +1 -0
- package/dist/es/f/FormInput/FormInput.js +8 -1
- package/dist/es/f/common/Label/Label.js +1 -1
- package/dist/es/f/common/Label/styles.scss +1 -4
- package/dist/es/f/fields/Checkbox/Checkbox.js +99 -0
- package/dist/es/f/fields/Checkbox/index.js +2 -0
- package/dist/es/f/fields/Checkbox/styles.scss +14 -0
- package/dist/es/f/fields/ChoicesInput/ChoicesInput.js +1 -1
- package/dist/es/f/fields/ChoicesInput/common/Choice/Choice.js +5 -2
- package/dist/es/f/fields/IntlTelInput/IntlTelInput.js +152 -0
- package/dist/es/f/fields/IntlTelInput/index.js +2 -0
- package/dist/es/f/fields/IntlTelInput/styles.scss +37 -0
- 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 +12 -3
- package/dist/es/f/fields/QuerySelect/QuerySelect.js +12 -3
- package/dist/es/f/fields/QuerySelect/styles.scss +21 -0
- package/dist/es/f/fields/RatingsInput/common/Rating/Rating.js +11 -2
- package/dist/es/f/fields/TaskRecommendation/TaskRecommendation.js +111 -0
- package/dist/es/f/fields/TaskRecommendation/index.js +2 -0
- package/dist/es/f/fields/TaskRecommendation/styles.scss +37 -0
- package/dist/es/f/fields/TaskRecommendationInput/TaskRecommendationInput.js +1 -1
- package/dist/es/f/fields/TaskRecommendationInput/styles.scss +4 -0
- package/dist/es/f/fields/TextArea/TextArea.js +124 -0
- package/dist/es/f/fields/TextArea/index.js +2 -0
- package/dist/es/f/fields/TextArea/styles.scss +19 -0
- package/dist/es/f/fields/index.js +2 -1
- package/dist/es/test/QueryLoader/styles.scss +9 -0
- package/package.json +1 -1
- package/src/__snapshots__/Storyshots.test.js.snap +819 -158
- package/src/stories/f/Checkbox.stories.jsx +95 -0
- package/src/stories/f/ChoicesInput.stories.jsx +38 -10
- package/src/stories/f/FormInput.stories.jsx +5 -0
- package/src/ui/f/FormInput/FormInput.jsx +12 -0
- package/src/ui/f/common/Label/Label.jsx +1 -1
- package/src/ui/f/common/Label/styles.scss +1 -4
- package/src/ui/f/fields/Checkbox/Checkbox.jsx +118 -0
- package/src/ui/f/fields/Checkbox/index.js +2 -0
- package/src/ui/f/fields/Checkbox/styles.scss +14 -0
- package/src/ui/f/fields/ChoicesInput/ChoicesInput.jsx +1 -1
- package/src/ui/f/fields/ChoicesInput/common/Choice/Choice.jsx +10 -2
- package/src/ui/f/fields/QueryCombobox/QueryCombobox.jsx +7 -1
- package/src/ui/f/fields/QuerySelect/QuerySelect.jsx +7 -1
- package/src/ui/f/fields/RatingsInput/common/Rating/Rating.jsx +7 -1
- package/src/ui/f/fields/index.js +1 -0
- package/dist/cjs/a/ColumnLabel/styles.scss +0 -22
- package/dist/es/a/ColumnLabel/ColumnLabel.js +0 -78
- package/dist/es/a/ColumnLabel/index.js +0 -2
- package/dist/es/a/ColumnLabel/styles.scss +0 -22
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
import * as React from 'react'
|
|
3
|
+
|
|
4
|
+
import { useEffect } from 'react'
|
|
5
|
+
|
|
6
|
+
import { Formik, Form, useField } from 'formik'
|
|
7
|
+
|
|
8
|
+
import { Checkbox, FormDebugger } from 'ui'
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
title :'f/fields/Checkbox',
|
|
12
|
+
component :Checkbox,
|
|
13
|
+
subcomponents:{
|
|
14
|
+
// Item:Checkbox.Item
|
|
15
|
+
},
|
|
16
|
+
decorators:[
|
|
17
|
+
// storyfn => <div className="">{ storyfn() }</div>,
|
|
18
|
+
(storyfn) => (
|
|
19
|
+
<Formik
|
|
20
|
+
initialValues={{}}
|
|
21
|
+
>
|
|
22
|
+
<Form>
|
|
23
|
+
|
|
24
|
+
{ storyfn() }
|
|
25
|
+
</Form>
|
|
26
|
+
</Formik>
|
|
27
|
+
),
|
|
28
|
+
],
|
|
29
|
+
argTypes:{
|
|
30
|
+
label :{ control: 'text' },
|
|
31
|
+
description :{ control: 'text' },
|
|
32
|
+
defaultValue:{ control: 'boolean' },
|
|
33
|
+
disabled :{ control: 'boolean' },
|
|
34
|
+
optional :{ control: 'boolean' },
|
|
35
|
+
},
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// eslint-disable-next-line react/prop-types
|
|
39
|
+
const Template = ({ defaultValue, ...args }) => {
|
|
40
|
+
const Content = () => {
|
|
41
|
+
const { name } = args
|
|
42
|
+
const [, , helpers] = useField(name)
|
|
43
|
+
const { setValue } = helpers
|
|
44
|
+
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
if (defaultValue) {
|
|
47
|
+
setValue(defaultValue)
|
|
48
|
+
}
|
|
49
|
+
}, [defaultValue])
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<>
|
|
53
|
+
<Checkbox {...args} />
|
|
54
|
+
<FormDebugger />
|
|
55
|
+
</>
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return <Content />
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export const Base = Template.bind({})
|
|
63
|
+
Base.args = {
|
|
64
|
+
name:'urgent',
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export const WithLabel = Template.bind({})
|
|
68
|
+
WithLabel.args = {
|
|
69
|
+
...Base.args,
|
|
70
|
+
label:'Urgent',
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export const WithDescription = Template.bind({})
|
|
74
|
+
WithDescription.args = {
|
|
75
|
+
...Base.args,
|
|
76
|
+
description:'Click on the checkbox',
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export const WithDefaultFormikValue = Template.bind({})
|
|
80
|
+
WithDefaultFormikValue.args = {
|
|
81
|
+
...Base.args,
|
|
82
|
+
defaultValue:true,
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export const Disabled = Template.bind({})
|
|
86
|
+
Disabled.args = {
|
|
87
|
+
...Base.args,
|
|
88
|
+
disabled:true,
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export const Optional = Template.bind({})
|
|
92
|
+
Optional.args = {
|
|
93
|
+
...Base.args,
|
|
94
|
+
optional:true,
|
|
95
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
2
|
import * as React from 'react'
|
|
3
|
-
|
|
3
|
+
import { useEffect } from 'react'
|
|
4
4
|
import { ChoicesInput, FormDebugger } from 'ui'
|
|
5
|
-
import { Formik, Form } from 'formik'
|
|
5
|
+
import { Formik, Form, useField } from 'formik'
|
|
6
6
|
|
|
7
7
|
export default {
|
|
8
8
|
title :'f/fields/ChoicesInput',
|
|
@@ -29,14 +29,6 @@ export default {
|
|
|
29
29
|
},
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
const Template = (args) => (
|
|
33
|
-
<>
|
|
34
|
-
<ChoicesInput {...args} />
|
|
35
|
-
<FormDebugger />
|
|
36
|
-
</>
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
-
export const Base = Template.bind({})
|
|
40
32
|
const optionsMap = [
|
|
41
33
|
{
|
|
42
34
|
value:'red',
|
|
@@ -72,18 +64,54 @@ const optionsMap = [
|
|
|
72
64
|
},
|
|
73
65
|
]
|
|
74
66
|
|
|
67
|
+
// eslint-disable-next-line react/prop-types
|
|
68
|
+
const Template = ({ defaultValue, ...args }) => {
|
|
69
|
+
const Content = () => {
|
|
70
|
+
const [, , helpers] = useField(args.name)
|
|
71
|
+
const { setValue } = helpers
|
|
72
|
+
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
if (defaultValue) {
|
|
75
|
+
setValue(defaultValue)
|
|
76
|
+
}
|
|
77
|
+
}, [defaultValue])
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<>
|
|
81
|
+
<ChoicesInput {...args} />
|
|
82
|
+
<FormDebugger />
|
|
83
|
+
</>
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
return <Content />
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export const Base = Template.bind({})
|
|
75
90
|
Base.args = {
|
|
76
91
|
id :'colors',
|
|
77
92
|
options:optionsMap,
|
|
78
93
|
name :'color',
|
|
79
94
|
}
|
|
80
95
|
|
|
96
|
+
export const WithDefaultFormikValue = Template.bind({})
|
|
97
|
+
WithDefaultFormikValue.args = {
|
|
98
|
+
...Base.args,
|
|
99
|
+
defaultValue:'red',
|
|
100
|
+
}
|
|
101
|
+
|
|
81
102
|
export const Multiple = Template.bind({})
|
|
82
103
|
Multiple.args = {
|
|
83
104
|
...Base.args,
|
|
84
105
|
multiple:true,
|
|
85
106
|
}
|
|
86
107
|
|
|
108
|
+
export const MultipleWithDefaultFormikValue = Template.bind({})
|
|
109
|
+
MultipleWithDefaultFormikValue.args = {
|
|
110
|
+
...Base.args,
|
|
111
|
+
multiple :true,
|
|
112
|
+
defaultValue:['brown', 'violet'],
|
|
113
|
+
}
|
|
114
|
+
|
|
87
115
|
export const MultipleWithGrid = Template.bind({})
|
|
88
116
|
MultipleWithGrid.args = {
|
|
89
117
|
...Base.args,
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
QueryCombobox,
|
|
14
14
|
QuerySelect,
|
|
15
15
|
RatingsInput,
|
|
16
|
+
Checkbox,
|
|
16
17
|
} from '../fields'
|
|
17
18
|
|
|
18
19
|
// Local Definitions
|
|
@@ -94,6 +95,17 @@ const FormInput = ({
|
|
|
94
95
|
/>
|
|
95
96
|
)
|
|
96
97
|
}
|
|
98
|
+
|
|
99
|
+
if (type === 'checkbox') {
|
|
100
|
+
return (
|
|
101
|
+
<Checkbox
|
|
102
|
+
className={newClassName}
|
|
103
|
+
disabled={disabled}
|
|
104
|
+
{...otherProps}
|
|
105
|
+
/>
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
|
|
97
109
|
if (extraTypes?.[type]) {
|
|
98
110
|
const Component = extraTypes[type]
|
|
99
111
|
return (
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
import * as React from 'react'
|
|
3
|
+
|
|
4
|
+
import { useLayoutEffect } from 'react'
|
|
5
|
+
|
|
6
|
+
import PropTypes from 'prop-types'
|
|
7
|
+
|
|
8
|
+
import styleNames from '@pareto-engineering/bem'
|
|
9
|
+
|
|
10
|
+
import { useField } from 'formik'
|
|
11
|
+
|
|
12
|
+
import { FormLabel, FormDescription } from '../../common'
|
|
13
|
+
|
|
14
|
+
// Local Definitions
|
|
15
|
+
|
|
16
|
+
const baseClassName = styleNames.base
|
|
17
|
+
|
|
18
|
+
const componentClassName = 'checkbox'
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* This is the component description.
|
|
22
|
+
*/
|
|
23
|
+
const Checkbox = ({
|
|
24
|
+
id,
|
|
25
|
+
className:userClassName,
|
|
26
|
+
style,
|
|
27
|
+
name,
|
|
28
|
+
label,
|
|
29
|
+
description,
|
|
30
|
+
disabled,
|
|
31
|
+
optional,
|
|
32
|
+
// ...otherProps
|
|
33
|
+
}) => {
|
|
34
|
+
useLayoutEffect(() => {
|
|
35
|
+
import('./styles.scss')
|
|
36
|
+
}, [])
|
|
37
|
+
|
|
38
|
+
const [field] = useField({ name, type: 'checkbox' })
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<div
|
|
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
|
+
>
|
|
55
|
+
{label && (
|
|
56
|
+
<FormLabel name={name} optional={optional}>
|
|
57
|
+
{label}
|
|
58
|
+
</FormLabel>
|
|
59
|
+
)}
|
|
60
|
+
<input
|
|
61
|
+
id={name}
|
|
62
|
+
className="input"
|
|
63
|
+
type="checkbox"
|
|
64
|
+
disabled={disabled}
|
|
65
|
+
{...field}
|
|
66
|
+
/>
|
|
67
|
+
<FormDescription className="v50 mt-v s-1" description={description} name={name} />
|
|
68
|
+
</div>
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
Checkbox.propTypes = {
|
|
73
|
+
/**
|
|
74
|
+
* The HTML id for this element
|
|
75
|
+
*/
|
|
76
|
+
id:PropTypes.string,
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* The HTML class names for this element
|
|
80
|
+
*/
|
|
81
|
+
className:PropTypes.string,
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* The React-written, css properties for this element.
|
|
85
|
+
*/
|
|
86
|
+
style:PropTypes.objectOf(PropTypes.string),
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* The input name (html - and Formik state)
|
|
90
|
+
*/
|
|
91
|
+
name:PropTypes.string.isRequired,
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* The Input description to guide the user if it's not obvious
|
|
95
|
+
*/
|
|
96
|
+
description:PropTypes.string,
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Whether the input should be disabled
|
|
100
|
+
*/
|
|
101
|
+
disabled:PropTypes.bool,
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* The input label
|
|
105
|
+
*/
|
|
106
|
+
label:PropTypes.string,
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Whether the input should have an optional tag
|
|
110
|
+
*/
|
|
111
|
+
optional:PropTypes.bool,
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
Checkbox.defaultProps = {
|
|
115
|
+
disabled:false,
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export default Checkbox
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
@use "@pareto-engineering/bem";
|
|
3
|
+
|
|
4
|
+
$default-margin: 1em;
|
|
5
|
+
|
|
6
|
+
.#{bem.$base}.checkbox {
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
align-items: flex-start;
|
|
10
|
+
|
|
11
|
+
.#{bem.$base}.label {
|
|
12
|
+
margin-bottom: $default-margin
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -28,7 +28,15 @@ const Choice = ({
|
|
|
28
28
|
validate,
|
|
29
29
|
disabled,
|
|
30
30
|
}) => {
|
|
31
|
-
const
|
|
31
|
+
const type = multiple ? 'checkbox' : 'radio'
|
|
32
|
+
|
|
33
|
+
const [field] = useField({
|
|
34
|
+
name,
|
|
35
|
+
validate,
|
|
36
|
+
type,
|
|
37
|
+
value,
|
|
38
|
+
})
|
|
39
|
+
|
|
32
40
|
return (
|
|
33
41
|
<div
|
|
34
42
|
className={[
|
|
@@ -43,7 +51,7 @@ const Choice = ({
|
|
|
43
51
|
style={style}
|
|
44
52
|
>
|
|
45
53
|
<input
|
|
46
|
-
type={
|
|
54
|
+
type={type}
|
|
47
55
|
id={id}
|
|
48
56
|
name={name}
|
|
49
57
|
{...field}
|
|
@@ -33,13 +33,14 @@ const QueryCombobox = ({
|
|
|
33
33
|
optionsKeyMap,
|
|
34
34
|
minLength,
|
|
35
35
|
transformSearch,
|
|
36
|
+
validate,
|
|
36
37
|
// ...otherProps
|
|
37
38
|
}) => {
|
|
38
39
|
useLayoutEffect(() => {
|
|
39
40
|
import('./styles.scss')
|
|
40
41
|
}, [])
|
|
41
42
|
|
|
42
|
-
const [, meta, helpers] = useField(name)
|
|
43
|
+
const [, meta, helpers] = useField({ name, validate })
|
|
43
44
|
|
|
44
45
|
const { setValue, setError } = helpers
|
|
45
46
|
|
|
@@ -209,6 +210,11 @@ QueryCombobox.propTypes = {
|
|
|
209
210
|
* The function to transform the search input
|
|
210
211
|
*/
|
|
211
212
|
transformSearch:PropTypes.func,
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* The query combobox field validator function
|
|
216
|
+
*/
|
|
217
|
+
validate:PropTypes.func,
|
|
212
218
|
}
|
|
213
219
|
|
|
214
220
|
QueryCombobox.defaultProps = {
|
|
@@ -30,9 +30,10 @@ const QuerySelect = ({
|
|
|
30
30
|
color,
|
|
31
31
|
loadingOption,
|
|
32
32
|
defaultOption,
|
|
33
|
+
validate,
|
|
33
34
|
// ...otherProps
|
|
34
35
|
}) => {
|
|
35
|
-
const [, , helpers] = useField(name)
|
|
36
|
+
const [, , helpers] = useField({ name, validate })
|
|
36
37
|
|
|
37
38
|
const { setError } = helpers
|
|
38
39
|
|
|
@@ -180,6 +181,11 @@ QuerySelect.propTypes = {
|
|
|
180
181
|
label :PropTypes.string.isRequired,
|
|
181
182
|
disabled:PropTypes.bool.isRequired,
|
|
182
183
|
}),
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* The query select field validator function
|
|
187
|
+
*/
|
|
188
|
+
validate:PropTypes.func,
|
|
183
189
|
}
|
|
184
190
|
|
|
185
191
|
QuerySelect.defaultProps = {
|
|
@@ -25,12 +25,13 @@ const Rating = ({
|
|
|
25
25
|
ratingId,
|
|
26
26
|
hover,
|
|
27
27
|
setHover,
|
|
28
|
+
validate,
|
|
28
29
|
activeBackgroundColor,
|
|
29
30
|
inactiveBackgroundColor,
|
|
30
31
|
showRatingValue,
|
|
31
32
|
// ...otherProps
|
|
32
33
|
}) => {
|
|
33
|
-
const [field] = useField(name)
|
|
34
|
+
const [field] = useField({ name, validate })
|
|
34
35
|
|
|
35
36
|
return (
|
|
36
37
|
<div
|
|
@@ -125,6 +126,11 @@ Rating.propTypes = {
|
|
|
125
126
|
* Determines if the rating start value should be shown
|
|
126
127
|
*/
|
|
127
128
|
showRatingValue :PropTypes.bool,
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* The rating field validator function
|
|
132
|
+
*/
|
|
133
|
+
validate:PropTypes.func,
|
|
128
134
|
}
|
|
129
135
|
|
|
130
136
|
Rating.defaultProps = {
|
package/src/ui/f/fields/index.js
CHANGED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
-
@use "@pareto-engineering/bem";
|
|
3
|
-
|
|
4
|
-
$default-image-size: 2em;
|
|
5
|
-
$default-font-size: calc(1 em * var(--s-1));
|
|
6
|
-
$default-padding: .5em;
|
|
7
|
-
|
|
8
|
-
.#{bem.$base}.column-label{
|
|
9
|
-
align-items: center;
|
|
10
|
-
background: var(--x);
|
|
11
|
-
border-radius: 3em;
|
|
12
|
-
display: inline-flex;
|
|
13
|
-
font-size: $default-font-size;
|
|
14
|
-
padding: $default-padding;
|
|
15
|
-
white-space: nowrap;
|
|
16
|
-
|
|
17
|
-
img {
|
|
18
|
-
border-radius: 50%;
|
|
19
|
-
height: $default-image-size;
|
|
20
|
-
width: $default-image-size;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { useLayoutEffect } from 'react';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import styleNames from '@pareto-engineering/bem'; // Local Definitions
|
|
6
|
-
|
|
7
|
-
const baseClassName = styleNames.base;
|
|
8
|
-
const componentClassName = 'column-label';
|
|
9
|
-
/**
|
|
10
|
-
* This is the component description.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
const ColumnLabel = ({
|
|
14
|
-
id,
|
|
15
|
-
className: userClassName,
|
|
16
|
-
style,
|
|
17
|
-
value,
|
|
18
|
-
color: FontColor,
|
|
19
|
-
getColor,
|
|
20
|
-
image
|
|
21
|
-
}) => {
|
|
22
|
-
useLayoutEffect(() => {
|
|
23
|
-
import("./styles.scss");
|
|
24
|
-
}, []);
|
|
25
|
-
const color = getColor ? getColor(value) : FontColor;
|
|
26
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
27
|
-
id: id,
|
|
28
|
-
className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
|
|
29
|
-
style: { ...style,
|
|
30
|
-
color
|
|
31
|
-
}
|
|
32
|
-
}, image && /*#__PURE__*/React.createElement("img", {
|
|
33
|
-
className: "image v50 mr-v",
|
|
34
|
-
src: image,
|
|
35
|
-
alt: `${value}`
|
|
36
|
-
}), value);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
ColumnLabel.propTypes = {
|
|
40
|
-
/**
|
|
41
|
-
* The HTML id for this element
|
|
42
|
-
*/
|
|
43
|
-
id: PropTypes.string,
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* The HTML class names for this element
|
|
47
|
-
*/
|
|
48
|
-
className: PropTypes.string,
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* The React-written, css properties for this element.
|
|
52
|
-
*/
|
|
53
|
-
style: PropTypes.objectOf(PropTypes.string),
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* The value to display for the label
|
|
57
|
-
*/
|
|
58
|
-
value: PropTypes.string,
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* The default font color to display for the label
|
|
62
|
-
*/
|
|
63
|
-
color: PropTypes.string,
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* The function passed to decide the color of the label
|
|
67
|
-
*/
|
|
68
|
-
getColor: PropTypes.func,
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* The image to be displayed if passed
|
|
72
|
-
*/
|
|
73
|
-
image: PropTypes.string
|
|
74
|
-
};
|
|
75
|
-
ColumnLabel.defaultProps = {
|
|
76
|
-
color: 'var(--on-x)'
|
|
77
|
-
};
|
|
78
|
-
export default ColumnLabel;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
-
@use "@pareto-engineering/bem";
|
|
3
|
-
|
|
4
|
-
$default-image-size: 2em;
|
|
5
|
-
$default-font-size: calc(1 em * var(--s-1));
|
|
6
|
-
$default-padding: .5em;
|
|
7
|
-
|
|
8
|
-
.#{bem.$base}.column-label{
|
|
9
|
-
align-items: center;
|
|
10
|
-
background: var(--x);
|
|
11
|
-
border-radius: 3em;
|
|
12
|
-
display: inline-flex;
|
|
13
|
-
font-size: $default-font-size;
|
|
14
|
-
padding: $default-padding;
|
|
15
|
-
white-space: nowrap;
|
|
16
|
-
|
|
17
|
-
img {
|
|
18
|
-
border-radius: 50%;
|
|
19
|
-
height: $default-image-size;
|
|
20
|
-
width: $default-image-size;
|
|
21
|
-
}
|
|
22
|
-
}
|