@pareto-engineering/design-system 2.0.0-alpha.53 → 2.0.0-alpha.54

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.
Files changed (199) hide show
  1. package/dist/cjs/a/GradientBackground/GradientBackground.js +140 -0
  2. package/dist/cjs/a/GradientBackground/index.js +15 -0
  3. package/dist/cjs/a/GradientBackground/styles.scss +191 -0
  4. package/dist/cjs/a/Popover/common/Divider/Divider.js +67 -0
  5. package/dist/cjs/a/Popover/common/Divider/index.js +15 -0
  6. package/dist/cjs/a/Popover/common/Item/Item.js +67 -0
  7. package/dist/cjs/a/Popover/common/Item/index.js +15 -0
  8. package/dist/cjs/a/Popover/common/index.js +21 -0
  9. package/dist/cjs/c/AcceptCookies/AcceptCookies.js +134 -0
  10. package/dist/cjs/c/AcceptCookies/index.js +15 -0
  11. package/dist/cjs/c/AcceptCookies/styles.scss +49 -0
  12. package/dist/cjs/c/BlogCategoryButton/BlogCategoryButton.js +95 -0
  13. package/dist/cjs/c/BlogCategoryButton/index.js +15 -0
  14. package/dist/cjs/c/BlogContext/BlogContextProvider.js +63 -0
  15. package/dist/cjs/c/BlogContext/Context.js +16 -0
  16. package/dist/cjs/c/BlogContext/ContextProvider.js +63 -0
  17. package/dist/cjs/c/BlogContext/index.js +31 -0
  18. package/dist/cjs/c/BlogContext/useBlog.js +16 -0
  19. package/dist/cjs/c/BlogPost/BlogPost.js +147 -0
  20. package/dist/cjs/c/BlogPost/index.js +15 -0
  21. package/dist/cjs/c/BlogPost/styles.scss +33 -0
  22. package/dist/cjs/c/BlogPostsList/BlogPostsList.js +73 -0
  23. package/dist/cjs/c/BlogPostsList/common/Card/Card.js +170 -0
  24. package/dist/cjs/c/BlogPostsList/common/Card/index.js +15 -0
  25. package/dist/cjs/c/BlogPostsList/common/index.js +13 -0
  26. package/dist/cjs/c/BlogPostsList/index.js +15 -0
  27. package/dist/cjs/c/BlogPostsList/styles.scss +72 -0
  28. package/dist/cjs/c/SiteFooter/SiteFooter.js +73 -0
  29. package/dist/cjs/c/SiteFooter/common/Section/Section.js +95 -0
  30. package/dist/cjs/c/SiteFooter/common/Section/index.js +15 -0
  31. package/dist/cjs/c/SiteFooter/common/index.js +13 -0
  32. package/dist/cjs/c/SiteFooter/index.js +15 -0
  33. package/dist/cjs/c/SiteFooter/styles.scss +34 -0
  34. package/dist/cjs/c/SiteHeaderCTA/SiteHeaderCTA.js +108 -0
  35. package/dist/cjs/c/SiteHeaderCTA/index.js +15 -0
  36. package/dist/cjs/c/SiteHeaderCTA/styles.scss +44 -0
  37. package/dist/cjs/c/SiteMission/SiteMission.js +113 -0
  38. package/dist/cjs/c/SiteMission/index.js +15 -0
  39. package/dist/cjs/c/SiteMission/styles.scss +30 -0
  40. package/dist/cjs/c/SiteNavigation/SiteNavigation.js +130 -0
  41. package/dist/cjs/c/SiteNavigation/index.js +15 -0
  42. package/dist/cjs/c/SiteNavigation/styles.scss +118 -0
  43. package/dist/cjs/c/SiteOnboardingStep/SiteOnboardingStep.js +98 -0
  44. package/dist/cjs/c/SiteOnboardingStep/index.js +15 -0
  45. package/dist/cjs/c/SiteOnboardingStep/styles.scss +51 -0
  46. package/dist/cjs/c/SitePricing/SitePricing.js +108 -0
  47. package/dist/cjs/c/SitePricing/index.js +15 -0
  48. package/dist/cjs/c/SitePricing/styles.scss +73 -0
  49. package/dist/cjs/c/SiteServices/SiteServices.js +211 -0
  50. package/dist/cjs/c/SiteServices/index.js +15 -0
  51. package/dist/cjs/c/SiteServices/styles.scss +138 -0
  52. package/dist/cjs/c/TeamGallery/TeamGallery.js +80 -0
  53. package/dist/cjs/c/TeamGallery/common/PersonCard/PersonCard.js +84 -0
  54. package/dist/cjs/c/TeamGallery/common/PersonCard/index.js +15 -0
  55. package/dist/cjs/c/TeamGallery/common/index.js +13 -0
  56. package/dist/cjs/c/TeamGallery/index.js +15 -0
  57. package/dist/cjs/c/TeamGallery/styles.scss +100 -0
  58. package/dist/cjs/c/Testimonials/Testimonials.js +119 -0
  59. package/dist/cjs/c/Testimonials/index.js +15 -0
  60. package/dist/cjs/c/Testimonials/styles.scss +112 -0
  61. package/dist/cjs/experimental/GradientBackground/GradientBackground.js +98 -0
  62. package/dist/cjs/experimental/GradientBackground/index.js +15 -0
  63. package/dist/cjs/experimental/GradientBackground/styles.scss +64 -0
  64. package/dist/cjs/experimental/index.js +13 -0
  65. package/dist/cjs/f/common/Description/Description.js +20 -14
  66. package/dist/cjs/f/fields/CheckboxInput/CheckboxInput.js +105 -0
  67. package/dist/cjs/f/fields/CheckboxInput/index.js +15 -0
  68. package/dist/cjs/f/fields/CheckboxInput/styles.scss +28 -0
  69. package/dist/cjs/f/fields/QueryCombobox/QueryCombobox.js +0 -2
  70. package/dist/cjs/f/fields/QueryCombobox/common/Combobox/Combobox.js +5 -9
  71. package/dist/cjs/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +5 -9
  72. package/dist/cjs/f/fields/QuerySelect/styles.scss +21 -0
  73. package/dist/cjs/f/fields/RadioInput/RadioInput.js +110 -0
  74. package/dist/cjs/f/fields/RadioInput/index.js +15 -0
  75. package/dist/cjs/f/fields/RadioInput/styles.scss +26 -0
  76. package/dist/cjs/f/fields/SelectInput/SelectInput.js +16 -8
  77. package/dist/cjs/f/fields/TaskRecommendation/TaskRecommendation.js +129 -0
  78. package/dist/cjs/f/fields/TaskRecommendation/index.js +15 -0
  79. package/dist/cjs/f/fields/TaskRecommendation/styles.scss +37 -0
  80. package/dist/cjs/f/fields/TaskRecommendationInput/TaskRecommendationInput.js +131 -0
  81. package/dist/cjs/f/fields/TaskRecommendationInput/index.js +15 -0
  82. package/dist/cjs/f/fields/TaskRecommendationInput/styles.scss +41 -0
  83. package/dist/cjs/f/fields/TextArea/TextArea.js +141 -0
  84. package/dist/cjs/f/fields/TextArea/index.js +15 -0
  85. package/dist/cjs/f/fields/TextArea/styles.scss +19 -0
  86. package/dist/cjs/f/fields/TextInput/TextInput.js +18 -9
  87. package/dist/cjs/f/fields/TextareaInput/TextareaInput.js +16 -8
  88. package/dist/cjs/test/QueryLoader/styles.scss +9 -0
  89. package/dist/es/a/GradientBackground/GradientBackground.js +118 -0
  90. package/dist/es/a/GradientBackground/index.js +2 -0
  91. package/dist/es/a/GradientBackground/styles.scss +191 -0
  92. package/dist/es/a/Popover/common/Divider/Divider.js +47 -0
  93. package/dist/es/a/Popover/common/Divider/index.js +2 -0
  94. package/dist/es/a/Popover/common/Item/Item.js +47 -0
  95. package/dist/es/a/Popover/common/Item/index.js +2 -0
  96. package/dist/es/a/Popover/common/index.js +2 -0
  97. package/dist/es/c/AcceptCookies/AcceptCookies.js +117 -0
  98. package/dist/es/c/AcceptCookies/index.js +2 -0
  99. package/dist/es/c/AcceptCookies/styles.scss +49 -0
  100. package/dist/es/c/BlogCategoryButton/BlogCategoryButton.js +68 -0
  101. package/dist/es/c/BlogCategoryButton/index.js +2 -0
  102. package/dist/es/c/BlogContext/BlogContextProvider.js +45 -0
  103. package/dist/es/c/BlogContext/Context.js +2 -0
  104. package/dist/es/c/BlogContext/ContextProvider.js +45 -0
  105. package/dist/es/c/BlogContext/index.js +4 -0
  106. package/dist/es/c/BlogContext/useBlog.js +3 -0
  107. package/dist/es/c/BlogPost/BlogPost.js +128 -0
  108. package/dist/es/c/BlogPost/index.js +2 -0
  109. package/dist/es/c/BlogPost/styles.scss +33 -0
  110. package/dist/es/c/BlogPostsList/BlogPostsList.js +56 -0
  111. package/dist/es/c/BlogPostsList/common/Card/Card.js +143 -0
  112. package/dist/es/c/BlogPostsList/common/Card/index.js +2 -0
  113. package/dist/es/c/BlogPostsList/common/index.js +1 -0
  114. package/dist/es/c/BlogPostsList/index.js +2 -0
  115. package/dist/es/c/BlogPostsList/styles.scss +72 -0
  116. package/dist/es/c/SiteFooter/SiteFooter.js +56 -0
  117. package/dist/es/c/SiteFooter/common/Section/Section.js +73 -0
  118. package/dist/es/c/SiteFooter/common/Section/index.js +2 -0
  119. package/dist/es/c/SiteFooter/common/index.js +1 -0
  120. package/dist/es/c/SiteFooter/index.js +2 -0
  121. package/dist/es/c/SiteFooter/styles.scss +34 -0
  122. package/dist/es/c/SiteHeaderCTA/SiteHeaderCTA.js +92 -0
  123. package/dist/es/c/SiteHeaderCTA/index.js +2 -0
  124. package/dist/es/c/SiteHeaderCTA/styles.scss +44 -0
  125. package/dist/es/c/SiteMission/SiteMission.js +96 -0
  126. package/dist/es/c/SiteMission/index.js +2 -0
  127. package/dist/es/c/SiteMission/styles.scss +30 -0
  128. package/dist/es/c/SiteNavigation/SiteNavigation.js +111 -0
  129. package/dist/es/c/SiteNavigation/index.js +2 -0
  130. package/dist/es/c/SiteNavigation/styles.scss +118 -0
  131. package/dist/es/c/SiteOnboardingStep/SiteOnboardingStep.js +81 -0
  132. package/dist/es/c/SiteOnboardingStep/index.js +2 -0
  133. package/dist/es/c/SiteOnboardingStep/styles.scss +51 -0
  134. package/dist/es/c/SitePricing/SitePricing.js +91 -0
  135. package/dist/es/c/SitePricing/index.js +2 -0
  136. package/dist/es/c/SitePricing/styles.scss +73 -0
  137. package/dist/es/c/SiteServices/SiteServices.js +195 -0
  138. package/dist/es/c/SiteServices/index.js +2 -0
  139. package/dist/es/c/SiteServices/styles.scss +138 -0
  140. package/dist/es/c/TeamGallery/TeamGallery.js +64 -0
  141. package/dist/es/c/TeamGallery/common/PersonCard/PersonCard.js +64 -0
  142. package/dist/es/c/TeamGallery/common/PersonCard/index.js +2 -0
  143. package/dist/es/c/TeamGallery/common/index.js +1 -0
  144. package/dist/es/c/TeamGallery/index.js +2 -0
  145. package/dist/es/c/TeamGallery/styles.scss +100 -0
  146. package/dist/es/c/Testimonials/Testimonials.js +99 -0
  147. package/dist/es/c/Testimonials/index.js +2 -0
  148. package/dist/es/c/Testimonials/styles.scss +112 -0
  149. package/dist/es/experimental/GradientBackground/GradientBackground.js +76 -0
  150. package/dist/es/experimental/GradientBackground/index.js +2 -0
  151. package/dist/es/experimental/GradientBackground/styles.scss +64 -0
  152. package/dist/es/experimental/index.js +1 -0
  153. package/dist/es/f/common/Description/Description.js +19 -14
  154. package/dist/es/f/fields/CheckboxInput/CheckboxInput.js +85 -0
  155. package/dist/es/f/fields/CheckboxInput/index.js +2 -0
  156. package/dist/es/f/fields/CheckboxInput/styles.scss +28 -0
  157. package/dist/es/f/fields/QueryCombobox/QueryCombobox.js +0 -2
  158. package/dist/es/f/fields/QueryCombobox/common/Combobox/Combobox.js +5 -9
  159. package/dist/es/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +5 -9
  160. package/dist/es/f/fields/QuerySelect/styles.scss +21 -0
  161. package/dist/es/f/fields/RadioInput/RadioInput.js +90 -0
  162. package/dist/es/f/fields/RadioInput/index.js +2 -0
  163. package/dist/es/f/fields/RadioInput/styles.scss +26 -0
  164. package/dist/es/f/fields/SelectInput/SelectInput.js +16 -8
  165. package/dist/es/f/fields/TaskRecommendation/TaskRecommendation.js +111 -0
  166. package/dist/es/f/fields/TaskRecommendation/index.js +2 -0
  167. package/dist/es/f/fields/TaskRecommendation/styles.scss +37 -0
  168. package/dist/es/f/fields/TaskRecommendationInput/TaskRecommendationInput.js +111 -0
  169. package/dist/es/f/fields/TaskRecommendationInput/index.js +2 -0
  170. package/dist/es/f/fields/TaskRecommendationInput/styles.scss +41 -0
  171. package/dist/es/f/fields/TextArea/TextArea.js +124 -0
  172. package/dist/es/f/fields/TextArea/index.js +2 -0
  173. package/dist/es/f/fields/TextArea/styles.scss +19 -0
  174. package/dist/es/f/fields/TextInput/TextInput.js +18 -9
  175. package/dist/es/f/fields/TextareaInput/TextareaInput.js +16 -8
  176. package/dist/es/test/QueryLoader/styles.scss +9 -0
  177. package/package.json +1 -1
  178. package/src/__snapshots__/Storyshots.test.js.snap +1526 -1383
  179. package/src/stories/a/DotInfo.stories.jsx +12 -12
  180. package/src/stories/a/ProgressBar.stories.jsx +12 -6
  181. package/src/stories/a/Timestamp.stories.jsx +32 -38
  182. package/src/stories/b/Logo.stories.jsx +13 -13
  183. package/src/stories/b/QuestionDropdown.stories.jsx +17 -30
  184. package/src/stories/b/SocialMediaButton.stories.jsx +32 -50
  185. package/src/stories/b/Title.stories.jsx +11 -13
  186. package/src/stories/c/ContentSlides.stories.jsx +24 -294
  187. package/src/stories/f/ChoicesInput.stories.jsx +62 -129
  188. package/src/stories/f/Description.stories.jsx +12 -2
  189. package/src/stories/f/RatingsInput.stories.jsx +21 -22
  190. package/src/stories/f/SelectInput.stories.jsx +35 -75
  191. package/src/stories/f/TextInput.stories.jsx +55 -52
  192. package/src/stories/f/TextareaInput.stories.jsx +31 -46
  193. package/src/ui/f/common/Description/Description.jsx +34 -29
  194. package/src/ui/f/fields/QueryCombobox/QueryCombobox.jsx +1 -2
  195. package/src/ui/f/fields/QueryCombobox/common/Combobox/Combobox.jsx +1 -11
  196. package/src/ui/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.jsx +1 -11
  197. package/src/ui/f/fields/SelectInput/SelectInput.jsx +16 -9
  198. package/src/ui/f/fields/TextInput/TextInput.jsx +13 -7
  199. package/src/ui/f/fields/TextareaInput/TextareaInput.jsx +9 -8
@@ -26,87 +26,47 @@ export default {
26
26
  },
27
27
  }
28
28
 
29
- export const Base = () => (
29
+ const Template = (args) => (
30
30
  <>
31
- <SelectInput
32
- name="workType"
33
- label="Work Type"
34
- options={[{ value: '', label: 'Select an option', disabled: true }, 'Work', 'Managing', 'Training']}
35
- />
31
+ <SelectInput {...args} />
36
32
  <FormDebugger />
37
33
  </>
38
34
  )
39
35
 
40
- export const RequiredSelect = () => {
41
- const requiredInput = (inputValue) => {
42
- let error = ''
43
-
44
- if (!inputValue || !inputValue?.length === 0) {
45
- error = 'This information is required'
46
- }
47
- return error
48
- }
36
+ export const Base = Template.bind({})
37
+ Base.args = {
38
+ name :'workType',
39
+ label :'Work Type',
40
+ options:[
41
+ { value: '', label: 'Select an option', disabled: true },
42
+ { value: 'Work', label: 'Work' },
43
+ { value: 'Managing', label: 'Managing' },
44
+ { value: 'Training', label: 'Training' },
45
+ ],
46
+ }
49
47
 
50
- return (
51
- <>
52
- <SelectInput
53
- validate={requiredInput}
54
- name="activity"
55
- label="Activity Type"
56
- options={[
57
- { value: '', label: 'Select an option', disabled: true },
58
- { value: 'review', label: 'Review' },
59
- { value: 'Approve', label: 'Approve' },
60
- ]}
61
- />
62
- <FormDebugger />
63
- </>
64
- )
48
+ export const StringAndObjects = Template.bind({})
49
+ StringAndObjects.args = {
50
+ ...Base.args,
51
+ options:[...Base.args.options, 'Option1', 'Option2', 'Option3'],
65
52
  }
66
53
 
67
- export const Objects = () => (
68
- <>
69
- <SelectInput
70
- name="workType"
71
- label="Work Type"
72
- options={[
73
- { value: '', label: 'Select an option', disabled: true },
74
- { value: '20th Aug 2020 to 19th Sept, 2020', label: '20th Aug 2020 to 19th Sept, 2020' },
75
- { value: '20th Sept 2020 to 19th Oct, 2020', label: '20th Sept 2020 to 19th Oct, 2020' },
76
- ]}
77
- />
78
- <FormDebugger />
79
- </>
80
- )
54
+ const requiredInput = (inputValue) => {
55
+ let error = ''
81
56
 
82
- export const StringAndObjects = () => (
83
- <>
84
- <SelectInput
85
- name="workType"
86
- label="Work Type"
87
- options={[
88
- { value: '', label: 'Select an option', disabled: true },
89
- 'Work', 'Managing', 'Training',
90
- { value: '20th Aug 2020 to 19th Sept, 2020', label: '20th Aug 2020 to 19th Sept, 2020' },
91
- { value: '20th Sept 2020 to 19th Oct, 2020', label: '20th Sept 2020 to 19th Oct, 2020' },
92
- ]}
93
- />
94
- <FormDebugger />
95
- </>
96
- )
97
- export const DisabledSelectInput = () => (
98
- <>
99
- <SelectInput
100
- name="workType"
101
- label="Work Type"
102
- options={[
103
- { value: '', label: 'Select an option', disabled: true },
104
- 'Work', 'Managing', 'Training',
105
- { value: '20th Aug 2020 to 19th Sept, 2020', label: '20th Aug 2020 to 19th Sept, 2020' },
106
- { value: '20th Sept 2020 to 19th Oct, 2020', label: '20th Sept 2020 to 19th Oct, 2020' },
107
- ]}
108
- disabled
109
- />
110
- <FormDebugger />
111
- </>
112
- )
57
+ if (!inputValue || !inputValue?.length === 0) {
58
+ error = 'This information is required'
59
+ }
60
+ return error
61
+ }
62
+ export const Required = Template.bind({})
63
+ Required.args = {
64
+ ...Base.args,
65
+ validate:requiredInput,
66
+ }
67
+
68
+ export const DisabledSelectInput = Template.bind({})
69
+ DisabledSelectInput.args = {
70
+ ...Base.args,
71
+ disabled:true,
72
+ }
@@ -30,61 +30,64 @@ export default {
30
30
  },
31
31
  }
32
32
 
33
- export const Base = () => {
34
- const validate = (value) => {
35
- let errorMessage = ''
36
- const isValid = value.length > 3
33
+ // eslint-disable-next-line react/prop-types
34
+ const Template = (args) => (
35
+ <div className=" u2 pb-u">
36
+ <TextInput {...args} />
37
+ <FormDebugger />
38
+ </div>
39
+ )
40
+
41
+ export const Base = Template.bind({})
42
+ Base.args = {
43
+ name :'firstName',
44
+ label:"What's your first name ?",
45
+ }
46
+
47
+ const validate = (value) => {
48
+ let errorMessage = ''
49
+ const isValid = value.length > 3
37
50
 
38
- if (!isValid) {
39
- errorMessage = 'Value should be greater than 3 characters'
40
- }
41
- return errorMessage
51
+ if (!isValid) {
52
+ errorMessage = 'Value should be greater than 3 characters'
42
53
  }
43
- return (
44
- <div className=" u2 pb-u">
45
- <TextInput
46
- name="firstName"
47
- label="What's your first name ?"
48
- validate={validate}
49
- />
50
- <FormDebugger />
51
- </div>
52
- )
54
+ return errorMessage
53
55
  }
54
56
 
55
- export const Placeholder = () => (
56
- <div className="u2 pb-u">
57
- <TextInput
58
- name="firstName"
59
- label="What's your first name ?"
60
- placeholder="First Name"
61
- />
62
- <FormDebugger />
63
- </div>
64
- )
57
+ export const WithValidation = Template.bind({})
58
+ WithValidation.args = {
59
+ ...Base.args,
60
+ validate,
61
+ }
65
62
 
66
- export const Disabled = () => (
67
- <div className="u2 pb-u">
68
- <TextInput
69
- name="firstName"
70
- label="What's your first name ?"
71
- disabled
72
- />
73
- </div>
74
- )
63
+ export const WithPlaceholder = Template.bind({})
64
+ WithPlaceholder.args = {
65
+ ...Base.args,
66
+ placeholder:'First Name',
67
+ }
75
68
 
76
- export const DateTime = () => (
77
- <div>
78
- <TextInput
79
- name="date"
80
- label="Select date"
81
- type="date"
82
- />
83
- <TextInput
84
- name="time"
85
- label="Select time"
86
- type="time"
87
- />
88
- <FormDebugger />
89
- </div>
90
- )
69
+ export const WithAutoCompleteOff = Template.bind({})
70
+ WithAutoCompleteOff.args = {
71
+ ...Base.args,
72
+ autoComplete:'off',
73
+ }
74
+
75
+ export const WithDisabled = Template.bind({})
76
+ WithDisabled.args = {
77
+ ...Base.args,
78
+ disabled:true,
79
+ }
80
+
81
+ export const Date = Template.bind({})
82
+ Date.args = {
83
+ type :'date',
84
+ name :'date',
85
+ label:'Select date',
86
+ }
87
+
88
+ export const Time = Template.bind({})
89
+ Time.args = {
90
+ type :'time',
91
+ name :'time',
92
+ label:'Select time',
93
+ }
@@ -28,58 +28,43 @@ export default {
28
28
  },
29
29
  }
30
30
 
31
- export const Base = () => (
32
- <div>
33
- <TextareaInput
34
- name="feedback"
35
- label="What can we improve on?"
36
- />
31
+ const Template = (args) => (
32
+ <>
33
+ <TextareaInput {...args} />
37
34
  <FormDebugger />
38
- </div>
35
+ </>
39
36
  )
40
37
 
41
- export const Placeholder = () => (
42
- <div>
43
- <TextareaInput
44
- name="feedback"
45
- label="What can we improve on?"
46
- placeholder="Type your feedback here..."
47
- />
48
- <FormDebugger />
49
- </div>
50
- )
38
+ export const Base = Template.bind({})
39
+ Base.args = {
40
+ name :'feedback',
41
+ label:'What can we improve on?',
42
+ }
43
+
44
+ export const Placeholder = Template.bind({})
45
+ Placeholder.args = {
46
+ ...Base.args,
47
+ placeholder:'Type your feedback here...',
48
+ }
51
49
 
52
- export const Validation = () => {
53
- const validate = (value) => {
54
- let errorMessage = ''
55
- const isValid = value.length > 3
50
+ const validate = (value) => {
51
+ let errorMessage = ''
52
+ const isValid = value.length > 3
56
53
 
57
- if (!isValid) {
58
- errorMessage = 'Value should be greater than 3 characters'
59
- }
60
- return errorMessage
54
+ if (!isValid) {
55
+ errorMessage = 'Value should be greater than 3 characters'
61
56
  }
57
+ return errorMessage
58
+ }
62
59
 
63
- return (
64
- <div>
65
- <TextareaInput
66
- name="feedback"
67
- label="What can we improve on?"
68
- placeholder="Type your feedback here..."
69
- validate={validate}
70
- />
71
- <FormDebugger />
72
- </div>
73
- )
60
+ export const Validation = Template.bind({})
61
+ Validation.args = {
62
+ ...Base.args,
63
+ validate,
74
64
  }
75
65
 
76
- export const Disabled = () => (
77
- <div>
78
- <TextareaInput
79
- name="feedback"
80
- label="What can we improve on?"
81
- disabled
82
- />
83
- <FormDebugger />
84
- </div>
85
- )
66
+ export const Disabled = Template.bind({})
67
+ Disabled.args = {
68
+ ...Base.args,
69
+ disabled:true,
70
+ }
@@ -3,6 +3,8 @@ import * as React from 'react'
3
3
 
4
4
  import { useLayoutEffect } from 'react'
5
5
 
6
+ import { useField } from 'formik'
7
+
6
8
  import PropTypes from 'prop-types'
7
9
 
8
10
  import styleNames from '@pareto-engineering/bem'
@@ -20,8 +22,8 @@ const Description = ({
20
22
  id,
21
23
  className:userClassName,
22
24
  style,
23
- children,
24
- isError,
25
+ description,
26
+ name,
25
27
  color,
26
28
  // ...otherProps
27
29
  }) => {
@@ -29,25 +31,27 @@ const Description = ({
29
31
  import('./styles.scss')
30
32
  }, [])
31
33
 
32
- return (
33
- <div
34
- id={id}
35
- className={[
36
-
37
- baseClassName,
38
-
39
- componentClassName,
40
- userClassName,
41
- isError ? 'x-error' : `x-${color}`,
42
- ]
43
- .filter((e) => e)
44
- .join(' ')}
45
- style={style}
46
- // {...otherProps}
47
- >
48
- {children}
49
- </div>
50
- )
34
+ const [field, meta] = useField(name)
35
+
36
+ if (description || ((meta.touched || field.value) && meta.error)) {
37
+ return (
38
+ <div
39
+ id={id}
40
+ className={[
41
+ baseClassName,
42
+ componentClassName,
43
+ userClassName,
44
+ meta.error ? 'x-error' : `x-${color}`,
45
+ ]
46
+ .filter((e) => e)
47
+ .join(' ')}
48
+ style={style}
49
+ >
50
+ { meta.error || description}
51
+ </div>
52
+ )
53
+ }
54
+ return null
51
55
  }
52
56
 
53
57
  Description.propTypes = {
@@ -67,22 +71,23 @@ Description.propTypes = {
67
71
  style:PropTypes.objectOf(PropTypes.string),
68
72
 
69
73
  /**
70
- * The children JSX
74
+ * The base color for the description
71
75
  */
72
- children:PropTypes.node,
76
+ color:PropTypes.string,
77
+
73
78
  /**
74
- * The base color for the description
79
+ * Input description - extra description to guide a use in filling the input
75
80
  */
76
- color :PropTypes.string,
81
+ description:PropTypes.string,
82
+
77
83
  /**
78
- * isError
84
+ * The input name (html - and Formik state)
79
85
  */
80
- isError :PropTypes.bool,
86
+ name:PropTypes.string.isRequired,
81
87
  }
82
88
 
83
89
  Description.defaultProps = {
84
- isError:false,
85
- color :'metadata',
90
+ color:'metadata',
86
91
  }
87
92
 
88
93
  export default Description
@@ -43,7 +43,7 @@ const QueryCombobox = ({
43
43
 
44
44
  const { setValue, setError } = helpers
45
45
 
46
- const { error, value } = meta
46
+ const { value } = meta
47
47
 
48
48
  const environment = useRelayEnvironment()
49
49
 
@@ -101,7 +101,6 @@ const QueryCombobox = ({
101
101
  label,
102
102
  description,
103
103
  setValue,
104
- error,
105
104
  value,
106
105
  color,
107
106
  isFetching,
@@ -33,7 +33,6 @@ const Combobox = ({
33
33
  options:items,
34
34
  getOptions,
35
35
  setValue,
36
- error,
37
36
  description,
38
37
  value,
39
38
  color,
@@ -121,11 +120,7 @@ const Combobox = ({
121
120
  />
122
121
  </Popover>
123
122
 
124
- {(description || error) && (
125
- <FormDescription isError={!!error}>
126
- { error || description }
127
- </FormDescription>
128
- )}
123
+ <FormDescription className="v50 mt-v s-1" description={description} name={name} />
129
124
  </div>
130
125
  )
131
126
  }
@@ -181,11 +176,6 @@ Combobox.propTypes = {
181
176
  */
182
177
  description:PropTypes.string,
183
178
 
184
- /**
185
- * The error object
186
- */
187
- error:PropTypes.objectOf(PropTypes.string),
188
-
189
179
  /**
190
180
  * The value of the custom select input
191
181
  */
@@ -46,7 +46,6 @@ const MultipleCombobox = ({
46
46
  options:items,
47
47
  getOptions,
48
48
  setValue,
49
- error,
50
49
  description,
51
50
  value,
52
51
  color,
@@ -213,11 +212,7 @@ const MultipleCombobox = ({
213
212
  />
214
213
  </Popover>
215
214
 
216
- {(description || error) && (
217
- <FormDescription isError={!!error}>
218
- { error || description }
219
- </FormDescription>
220
- )}
215
+ <FormDescription className="v50 mt-v s-1" description={description} name={name} />
221
216
 
222
217
  </div>
223
218
  )
@@ -274,11 +269,6 @@ MultipleCombobox.propTypes = {
274
269
  */
275
270
  description:PropTypes.string,
276
271
 
277
- /**
278
- * The error object
279
- */
280
- error:PropTypes.objectOf(PropTypes.string),
281
-
282
272
  /**
283
273
  * The value of the custom select input
284
274
  */
@@ -34,13 +34,14 @@ const SelectInput = ({
34
34
  description,
35
35
  disabled,
36
36
  isLoading,
37
+ autoComplete,
37
38
  // ...otherProps
38
39
  }) => {
39
40
  useLayoutEffect(() => {
40
41
  import('./styles.scss')
41
42
  }, [])
42
43
 
43
- const [field, meta] = useField({ name, validate })
44
+ const [field] = useField({ name, validate })
44
45
 
45
46
  return (
46
47
  <div
@@ -60,7 +61,14 @@ const SelectInput = ({
60
61
  >
61
62
  <FormLabel name={name}>{label}</FormLabel>
62
63
  <div className="select-wrapper">
63
- <select className="input" {...field} value={field.value || ''} id={name} disabled={disabled}>
64
+ <select
65
+ className="input"
66
+ {...field}
67
+ value={field.value || ''}
68
+ id={name}
69
+ disabled={disabled}
70
+ autoComplete={autoComplete}
71
+ >
64
72
  {
65
73
  options.map((option) => {
66
74
  // i.e if option is a string like "blah", return { value: "blah", label: "blah" }
@@ -82,12 +90,7 @@ const SelectInput = ({
82
90
  <LoadingCircle className="x-main2" />
83
91
  )}
84
92
  </div>
85
- {(description || (meta.touched && meta.error))
86
- && (
87
- <FormDescription isError={!!meta.error} className="v50 mt-v s-1">
88
- { meta.error || description }
89
- </FormDescription>
90
- )}
93
+ <FormDescription className="v50 mt-v s-1" description={description} name={name} />
91
94
  </div>
92
95
  )
93
96
  }
@@ -154,7 +157,11 @@ SelectInput.propTypes = {
154
157
  /*
155
158
  * Whether the query that is fetching the select options is still in flight
156
159
  */
157
- isLoading:PropTypes.bool,
160
+ isLoading :PropTypes.bool,
161
+ /**
162
+ * The autoComplete value that the browser should watch for the input
163
+ */
164
+ autoComplete:PropTypes.string,
158
165
  }
159
166
 
160
167
  SelectInput.defaultProps = {
@@ -35,13 +35,14 @@ const TextInput = ({
35
35
  disabled,
36
36
  placeholder,
37
37
  optional,
38
+ autoComplete,
38
39
  // ...otherProps
39
40
  }) => {
40
41
  useLayoutEffect(() => {
41
42
  import('./styles.scss')
42
43
  }, [])
43
44
 
44
- const [field, meta] = useField({ name, validate })
45
+ const [field] = useField({ name, validate })
45
46
 
46
47
  return (
47
48
  <div
@@ -73,14 +74,12 @@ const TextInput = ({
73
74
  type={type}
74
75
  disabled={disabled}
75
76
  placeholder={placeholder}
77
+ autoComplete={autoComplete}
76
78
  {...field}
77
79
  />
78
- {(description || (meta.touched && meta.error))
79
- && (
80
- <FormDescription isError={!!meta.error} className="v50 mt-v s-1">
81
- { meta.error || description }
82
- </FormDescription>
83
- )}
80
+
81
+ <FormDescription className="v50 mt-v s-1" description={description} name={name} />
82
+
84
83
  </div>
85
84
  )
86
85
  }
@@ -130,6 +129,7 @@ TextInput.propTypes = {
130
129
  'month',
131
130
  'tel',
132
131
  'hidden',
132
+ 'url',
133
133
  ]),
134
134
 
135
135
  /**
@@ -163,6 +163,12 @@ TextInput.propTypes = {
163
163
  * Whether the input is optional or not
164
164
  */
165
165
  optional:PropTypes.bool,
166
+
167
+ /**
168
+ * The autoComplete value that the browser should watch for the input
169
+ * `https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete`
170
+ */
171
+ autoComplete:PropTypes.string,
166
172
  }
167
173
 
168
174
  TextInput.defaultProps = {
@@ -35,13 +35,14 @@ const TextareaInput = ({
35
35
  description,
36
36
  disabled,
37
37
  placeholder,
38
+ autoComplete,
38
39
  // ...otherProps
39
40
  }) => {
40
41
  useLayoutEffect(() => {
41
42
  import('./styles.scss')
42
43
  }, [])
43
44
 
44
- const [field, meta] = useField({ name, validate })
45
+ const [field] = useField({ name, validate })
45
46
 
46
47
  return (
47
48
  <div
@@ -75,17 +76,12 @@ const TextareaInput = ({
75
76
  placeholder={placeholder}
76
77
  rows={rows}
77
78
  disabled={disabled}
79
+ autoComplete={autoComplete}
78
80
  >
79
81
  {/* It was a dark and stormy night... */}
80
82
  </textarea>
81
83
 
82
- {(description || (meta.touched && meta.error))
83
- && (
84
- <FormDescription isError={!!meta.error} className="v50 mt-v s-1">
85
- { meta.error || description }
86
- </FormDescription>
87
- )}
88
- {' '}
84
+ <FormDescription className="v50 mt-v s-1" description={description} name={name} />
89
85
  </div>
90
86
  )
91
87
  }
@@ -159,6 +155,11 @@ TextareaInput.propTypes = {
159
155
  * The textarea placeholder text
160
156
  */
161
157
  placeholder:PropTypes.string,
158
+
159
+ /**
160
+ * The autoComplete value that the browser should watch for the input
161
+ */
162
+ autoComplete:PropTypes.string,
162
163
  }
163
164
 
164
165
  TextareaInput.defaultProps = {