@pareto-engineering/design-system 2.0.0-alpha.6 → 2.0.0-alpha.61

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 (460) hide show
  1. package/.env.scripts.example +4 -0
  2. package/.eslintrc.js +25 -1
  3. package/babel.config.js +1 -0
  4. package/dist/cjs/a/{GradientBackground/GradientBackground.js → Alert/Alert.js} +68 -67
  5. package/dist/cjs/{c/SiteFooter/common/Section → a/Alert}/index.js +3 -3
  6. package/dist/cjs/a/Alert/styles.scss +74 -0
  7. package/dist/cjs/{c/BlogContext → a/AppContext}/Context.js +0 -0
  8. package/dist/cjs/a/AppContext/ContextProvider.js +96 -0
  9. package/dist/cjs/{c/BlogContext → a/AppContext}/index.js +13 -5
  10. package/dist/cjs/{c/BlogContext/useBlog.js → a/AppContext/useApp.js} +0 -0
  11. package/dist/cjs/a/AppContext/useTheme.js +45 -0
  12. package/dist/cjs/{c/SiteFooter/common/Section/Section.js → a/BackgroundGradient/BackgroundGradient.js} +20 -38
  13. package/dist/cjs/a/BackgroundGradient/index.js +15 -0
  14. package/dist/cjs/a/BackgroundGradient/styles.scss +16 -0
  15. package/dist/cjs/{experimental/GradientBackground/GradientBackground.js → a/ColumnLabel/ColumnLabel.js} +32 -30
  16. package/dist/cjs/{c/SiteMission → a/ColumnLabel}/index.js +3 -3
  17. package/dist/cjs/a/ColumnLabel/styles.scss +22 -0
  18. package/dist/cjs/{c/TeamGallery/TeamGallery.js → a/ContentTree/ContentTree.js} +23 -20
  19. package/dist/cjs/a/ContentTree/common/Tree/Tree.js +116 -0
  20. package/dist/cjs/{c/BlogPostsList/common/Card → a/ContentTree/common/Tree}/index.js +3 -3
  21. package/dist/cjs/a/ContentTree/common/index.js +31 -0
  22. package/dist/cjs/a/ContentTree/common/useContentTree.js +82 -0
  23. package/dist/cjs/a/ContentTree/common/useFirstVisibleNode.js +65 -0
  24. package/dist/cjs/{c/SitePricing → a/ContentTree}/index.js +3 -3
  25. package/dist/cjs/a/ContentTree/styles.scss +33 -0
  26. package/dist/cjs/a/Conversation/Conversation.js +14 -8
  27. package/dist/cjs/a/Conversation/common/Message/Message.js +32 -6
  28. package/dist/cjs/a/Conversation/styles.scss +132 -33
  29. package/dist/cjs/{c/SiteFooter/SiteFooter.js → a/Label/Label.js} +28 -14
  30. package/dist/cjs/{f/fields/TextArea → a/Label}/index.js +3 -3
  31. package/dist/cjs/a/Label/styles.scss +34 -0
  32. package/dist/cjs/a/OvalIllustration/OvalIllustration.js +133 -0
  33. package/dist/cjs/a/OvalIllustration/index.js +15 -0
  34. package/dist/cjs/a/OvalIllustration/styles.scss +102 -0
  35. package/dist/cjs/{c/AcceptCookies/AcceptCookies.js → a/Popover/Popover.js} +57 -57
  36. package/dist/cjs/{c/BlogPost → a/Popover}/index.js +3 -3
  37. package/dist/cjs/a/Popover/styles.scss +33 -0
  38. package/dist/cjs/a/Shapes/Shapes.js +9 -1
  39. package/dist/cjs/a/Shapes/styles.scss +42 -9
  40. package/dist/cjs/{c/BlogPostsList/BlogPostsList.js → a/SnapScroller/SnapScroller.js} +15 -11
  41. package/dist/cjs/{c/SiteFooter → a/SnapScroller}/index.js +3 -3
  42. package/dist/cjs/a/SnapScroller/styles.scss +38 -0
  43. package/dist/cjs/a/index.js +65 -9
  44. package/dist/cjs/b/Button/Button.js +10 -4
  45. package/dist/cjs/b/Button/styles.scss +55 -10
  46. package/dist/cjs/b/Logo/Logo.js +41 -41
  47. package/dist/cjs/b/Logo/styles.scss +0 -138
  48. package/dist/cjs/b/Page/common/PageHelmet/PageHelmet.js +1 -1
  49. package/dist/cjs/b/Page/common/Section/Section.js +17 -3
  50. package/dist/cjs/b/SocialMediaButton/SocialMediaButton.js +4 -4
  51. package/dist/cjs/b/ThemeSelector/ThemeSelector.js +1 -1
  52. package/dist/cjs/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.js +16 -9
  53. package/dist/cjs/c/ContentSlides/common/Navigator/Navigator.js +4 -3
  54. package/dist/cjs/c/ContentSlides/styles.scss +10 -4
  55. package/dist/cjs/c/{SiteHeaderCTA/SiteHeaderCTA.js → SocialMediaShareButton/SocialMediaShareButton.js} +46 -43
  56. package/dist/cjs/c/SocialMediaShareButton/index.js +15 -0
  57. package/dist/cjs/c/SocialMediaShareButton/styles.scss +39 -0
  58. package/dist/cjs/c/index.js +9 -1
  59. package/dist/cjs/f/FormInput/FormInput.js +26 -3
  60. package/dist/cjs/f/FormInput/styles.scss +11 -0
  61. package/dist/cjs/f/common/Debugger/Debugger.js +1 -1
  62. package/dist/cjs/f/common/Description/Description.js +20 -14
  63. package/dist/cjs/f/common/Label/Label.js +1 -1
  64. package/dist/cjs/f/common/Label/styles.scss +1 -1
  65. package/dist/cjs/f/fields/ChoicesInput/ChoicesInput.js +1 -1
  66. package/dist/cjs/f/fields/ChoicesInput/styles.scss +17 -2
  67. package/dist/cjs/f/fields/QueryCombobox/QueryCombobox.js +235 -0
  68. package/dist/cjs/f/fields/QueryCombobox/common/Combobox/Combobox.js +208 -0
  69. package/dist/cjs/f/fields/QueryCombobox/common/Combobox/index.js +15 -0
  70. package/dist/cjs/{c/BlogCategoryButton/BlogCategoryButton.js → f/fields/QueryCombobox/common/Menu/Menu.js} +39 -31
  71. package/dist/cjs/f/fields/QueryCombobox/common/Menu/index.js +15 -0
  72. package/dist/cjs/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +307 -0
  73. package/dist/cjs/f/fields/QueryCombobox/common/MultipleCombobox/index.js +15 -0
  74. package/dist/cjs/f/fields/QueryCombobox/common/index.js +29 -0
  75. package/dist/cjs/{c/AcceptCookies → f/fields/QueryCombobox}/index.js +3 -3
  76. package/dist/cjs/f/fields/QueryCombobox/styles.scss +90 -0
  77. package/dist/cjs/f/fields/QuerySelect/QuerySelect.js +201 -0
  78. package/dist/cjs/{c/TeamGallery → f/fields/QuerySelect}/index.js +3 -3
  79. package/dist/cjs/f/fields/RatingsInput/RatingsInput.js +39 -6
  80. package/dist/cjs/f/fields/RatingsInput/styles.scss +29 -20
  81. package/dist/cjs/f/fields/SelectInput/SelectInput.js +59 -14
  82. package/dist/cjs/f/fields/SelectInput/styles.scss +33 -13
  83. package/dist/cjs/f/fields/TaskRecommendationInput/TaskRecommendationInput.js +2 -2
  84. package/dist/cjs/f/fields/TaskRecommendationInput/styles.scss +0 -4
  85. package/dist/cjs/f/fields/TextInput/TextInput.js +50 -13
  86. package/dist/cjs/f/fields/TextInput/styles.scss +16 -7
  87. package/dist/cjs/f/fields/TextareaInput/TextareaInput.js +41 -15
  88. package/dist/cjs/f/fields/TextareaInput/styles.scss +19 -6
  89. package/dist/cjs/f/fields/index.js +15 -23
  90. package/dist/cjs/form-reset.scss +1 -1
  91. package/dist/cjs/index.js +26 -0
  92. package/dist/cjs/test/QueryLoader/QueryLoader.js +41 -0
  93. package/dist/cjs/test/QueryLoader/__generated__/QueryLoaderHelloQuery.graphql.js +71 -0
  94. package/dist/cjs/{c/BlogContext/ContextProvider.js → test/QueryLoader/common/PreloadedTestData/PreloadedTestData.js} +13 -27
  95. package/dist/cjs/test/QueryLoader/common/PreloadedTestData/index.js +15 -0
  96. package/dist/cjs/test/QueryLoader/common/index.js +13 -0
  97. package/dist/cjs/test/QueryLoader/index.js +15 -0
  98. package/dist/cjs/{c/TeamGallery/common → test}/index.js +3 -3
  99. package/dist/cjs/utils/hooks/index.js +23 -0
  100. package/dist/cjs/utils/hooks/useDynamicPosition.js +107 -0
  101. package/dist/cjs/utils/hooks/useWindowSize.js +39 -0
  102. package/dist/cjs/utils/index.js +19 -0
  103. package/dist/es/a/Alert/Alert.js +118 -0
  104. package/dist/es/{c/SiteFooter/common/Section → a/Alert}/index.js +1 -1
  105. package/dist/es/a/Alert/styles.scss +74 -0
  106. package/dist/es/{c/BlogContext → a/AppContext}/Context.js +0 -0
  107. package/dist/es/a/AppContext/ContextProvider.js +78 -0
  108. package/dist/es/a/AppContext/index.js +5 -0
  109. package/dist/es/{c/BlogContext/useBlog.js → a/AppContext/useApp.js} +0 -0
  110. package/dist/es/a/AppContext/useTheme.js +34 -0
  111. package/dist/es/{c/SiteFooter/SiteFooter.js → a/BackgroundGradient/BackgroundGradient.js} +14 -15
  112. package/dist/es/a/BackgroundGradient/index.js +2 -0
  113. package/dist/es/a/BackgroundGradient/styles.scss +16 -0
  114. package/dist/es/a/ColumnLabel/ColumnLabel.js +78 -0
  115. package/dist/es/a/ColumnLabel/index.js +2 -0
  116. package/dist/es/a/ColumnLabel/styles.scss +22 -0
  117. package/dist/es/a/ContentTree/ContentTree.js +67 -0
  118. package/dist/es/a/ContentTree/common/Tree/Tree.js +98 -0
  119. package/dist/es/{c/BlogPostsList/common/Card → a/ContentTree/common/Tree}/index.js +1 -1
  120. package/dist/es/a/ContentTree/common/index.js +3 -0
  121. package/dist/es/a/ContentTree/common/useContentTree.js +74 -0
  122. package/dist/es/a/ContentTree/common/useFirstVisibleNode.js +54 -0
  123. package/dist/es/a/ContentTree/index.js +2 -0
  124. package/dist/es/a/ContentTree/styles.scss +33 -0
  125. package/dist/es/a/Conversation/Conversation.js +14 -8
  126. package/dist/es/a/Conversation/common/Message/Message.js +32 -6
  127. package/dist/es/a/Conversation/styles.scss +132 -33
  128. package/dist/es/{c/TeamGallery/TeamGallery.js → a/Label/Label.js} +30 -23
  129. package/dist/es/{f/fields/TextArea → a/Label}/index.js +1 -1
  130. package/dist/es/a/Label/styles.scss +34 -0
  131. package/dist/es/a/OvalIllustration/OvalIllustration.js +111 -0
  132. package/dist/es/a/OvalIllustration/index.js +2 -0
  133. package/dist/es/a/OvalIllustration/styles.scss +102 -0
  134. package/dist/es/a/Popover/Popover.js +118 -0
  135. package/dist/es/{c/BlogPost → a/Popover}/index.js +1 -1
  136. package/dist/es/a/Popover/styles.scss +33 -0
  137. package/dist/es/a/Shapes/Shapes.js +9 -1
  138. package/dist/es/a/Shapes/styles.scss +42 -9
  139. package/dist/es/{c/BlogPostsList/BlogPostsList.js → a/SnapScroller/SnapScroller.js} +16 -11
  140. package/dist/es/a/SnapScroller/index.js +2 -0
  141. package/dist/es/a/SnapScroller/styles.scss +38 -0
  142. package/dist/es/a/index.js +9 -2
  143. package/dist/es/b/Button/Button.js +8 -2
  144. package/dist/es/b/Button/styles.scss +55 -10
  145. package/dist/es/b/Logo/Logo.js +41 -41
  146. package/dist/es/b/Logo/styles.scss +0 -138
  147. package/dist/es/b/Page/common/PageHelmet/PageHelmet.js +2 -2
  148. package/dist/es/b/Page/common/Section/Section.js +17 -3
  149. package/dist/es/b/SocialMediaButton/SocialMediaButton.js +5 -5
  150. package/dist/es/b/ThemeSelector/ThemeSelector.js +2 -2
  151. package/dist/es/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.js +16 -9
  152. package/dist/es/c/ContentSlides/common/Navigator/Navigator.js +4 -3
  153. package/dist/es/c/ContentSlides/styles.scss +10 -4
  154. package/dist/es/c/SocialMediaShareButton/SocialMediaShareButton.js +95 -0
  155. package/dist/es/c/SocialMediaShareButton/index.js +2 -0
  156. package/dist/es/c/SocialMediaShareButton/styles.scss +39 -0
  157. package/dist/es/c/index.js +2 -1
  158. package/dist/es/f/FormInput/FormInput.js +26 -3
  159. package/dist/es/f/FormInput/styles.scss +11 -0
  160. package/dist/es/f/common/Debugger/Debugger.js +1 -1
  161. package/dist/es/f/common/Description/Description.js +19 -14
  162. package/dist/es/f/common/Label/Label.js +1 -1
  163. package/dist/es/f/common/Label/styles.scss +1 -1
  164. package/dist/es/f/fields/ChoicesInput/ChoicesInput.js +1 -1
  165. package/dist/es/f/fields/ChoicesInput/styles.scss +17 -2
  166. package/dist/es/f/fields/QueryCombobox/QueryCombobox.js +212 -0
  167. package/dist/es/f/fields/QueryCombobox/common/Combobox/Combobox.js +188 -0
  168. package/dist/es/f/fields/QueryCombobox/common/Combobox/index.js +2 -0
  169. package/dist/es/f/fields/QueryCombobox/common/Menu/Menu.js +77 -0
  170. package/dist/es/f/fields/QueryCombobox/common/Menu/index.js +2 -0
  171. package/dist/es/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +279 -0
  172. package/dist/es/f/fields/QueryCombobox/common/MultipleCombobox/index.js +2 -0
  173. package/dist/es/f/fields/QueryCombobox/common/index.js +3 -0
  174. package/dist/es/f/fields/QueryCombobox/index.js +2 -0
  175. package/dist/es/f/fields/QueryCombobox/styles.scss +90 -0
  176. package/dist/es/f/fields/QuerySelect/QuerySelect.js +179 -0
  177. package/dist/es/f/fields/QuerySelect/index.js +2 -0
  178. package/dist/es/f/fields/RatingsInput/RatingsInput.js +38 -6
  179. package/dist/es/f/fields/RatingsInput/styles.scss +29 -20
  180. package/dist/es/f/fields/SelectInput/SelectInput.js +58 -14
  181. package/dist/es/f/fields/SelectInput/styles.scss +33 -13
  182. package/dist/es/f/fields/TaskRecommendationInput/TaskRecommendationInput.js +2 -2
  183. package/dist/es/f/fields/TaskRecommendationInput/styles.scss +0 -4
  184. package/dist/es/f/fields/TextInput/TextInput.js +50 -13
  185. package/dist/es/f/fields/TextInput/styles.scss +16 -7
  186. package/dist/es/f/fields/TextareaInput/TextareaInput.js +41 -15
  187. package/dist/es/f/fields/TextareaInput/styles.scss +19 -6
  188. package/dist/es/f/fields/index.js +3 -4
  189. package/dist/es/form-reset.scss +1 -1
  190. package/dist/es/index.js +3 -1
  191. package/dist/es/test/QueryLoader/QueryLoader.js +29 -0
  192. package/dist/es/test/QueryLoader/__generated__/QueryLoaderHelloQuery.graphql.js +71 -0
  193. package/dist/es/test/QueryLoader/common/PreloadedTestData/PreloadedTestData.js +31 -0
  194. package/dist/es/test/QueryLoader/common/PreloadedTestData/index.js +2 -0
  195. package/dist/es/test/QueryLoader/common/index.js +1 -0
  196. package/dist/es/test/QueryLoader/index.js +2 -0
  197. package/dist/es/test/index.js +1 -0
  198. package/dist/es/utils/hooks/index.js +2 -0
  199. package/dist/es/utils/hooks/useDynamicPosition.js +93 -0
  200. package/dist/es/utils/hooks/useWindowSize.js +27 -0
  201. package/dist/es/utils/index.js +1 -0
  202. package/package.json +18 -4
  203. package/relay.config.js +12 -0
  204. package/schema.graphql +4075 -0
  205. package/scripts/fetchSchema.js +74 -0
  206. package/src/__snapshots__/Storyshots.test.js.snap +12174 -7164
  207. package/src/local.scss +4 -2
  208. package/src/stories/StyleGuide/Sprites.stories.mdx +25 -0
  209. package/src/stories/StyleGuide/helpers.js +16 -0
  210. package/src/stories/a/Alert.stories.jsx +75 -0
  211. package/src/stories/a/{SiteContext.stories.jsx → AppContext.stories.jsx} +8 -8
  212. package/src/stories/a/BackgroundGradient.stories.jsx +38 -0
  213. package/src/stories/a/ContentTree.stories.jsx +662 -0
  214. package/src/stories/a/Conversation.stories.jsx +78 -1
  215. package/src/stories/a/DotInfo.stories.jsx +14 -13
  216. package/src/stories/a/Label.stories.jsx +49 -0
  217. package/src/stories/a/OvalIllustration.stories.jsx +59 -0
  218. package/src/stories/a/Popover.stories.jsx +106 -0
  219. package/src/stories/a/ProgressBar.stories.jsx +16 -7
  220. package/src/stories/a/Shapes.stories.jsx +18 -0
  221. package/src/stories/a/SnapScroller.stories.jsx +98 -0
  222. package/src/stories/a/Timestamp.stories.jsx +35 -39
  223. package/src/stories/b/Button.stories.jsx +27 -4
  224. package/src/stories/b/Logo.stories.jsx +23 -14
  225. package/src/stories/b/Page.stories.jsx +25 -1
  226. package/src/stories/b/QuestionDropdown.stories.jsx +20 -30
  227. package/src/stories/b/SocialMediaButton.stories.jsx +36 -53
  228. package/src/stories/b/ThemeSelector.stories.jsx +5 -5
  229. package/src/stories/b/Title.stories.jsx +13 -15
  230. package/src/stories/c/ContentSlides.stories.jsx +35 -151
  231. package/src/stories/c/Shortener.stories.jsx +9 -3
  232. package/src/stories/c/SocialMediaShareButton.stories.jsx +33 -0
  233. package/src/stories/f/ChoicesInput.stories.jsx +66 -130
  234. package/src/stories/f/Description.stories.jsx +22 -4
  235. package/src/stories/f/FormInput.stories.jsx +259 -0
  236. package/src/stories/f/QueryCombobox.stories.jsx +273 -0
  237. package/src/stories/f/QuerySelect.stories.jsx +135 -0
  238. package/src/stories/f/RatingsInput.stories.jsx +29 -22
  239. package/src/stories/f/SelectInput.stories.jsx +41 -49
  240. package/src/stories/f/TextInput.stories.jsx +63 -43
  241. package/src/stories/f/TextareaInput.stories.jsx +63 -19
  242. package/src/stories/f/__generated__/FormInputAllTaskStatusesQuery.graphql.js +122 -0
  243. package/src/stories/f/__generated__/FormInputAllTeamsQuery.graphql.js +139 -0
  244. package/src/stories/f/__generated__/QueryComboboxAllTeamsQuery.graphql.js +139 -0
  245. package/src/stories/f/__generated__/QuerySelectAllTaskStatusesQuery.graphql.js +122 -0
  246. package/src/stories/test/QueryLoader.stories.jsx +36 -0
  247. package/src/stories/utils/generateNodeId.js +12 -0
  248. package/src/stories/utils/lorem.js +15 -0
  249. package/src/stories/utils/relay/EnvironmentProvider.jsx +14 -0
  250. package/src/stories/utils/relay/environment.js +5 -0
  251. package/src/stories/utils/relay/index.js +4 -0
  252. package/src/stories/utils/relay/mockRelayOperation.js +14 -0
  253. package/src/stories/utils/relay/mockResolvers.js +299 -0
  254. package/src/stories/utils/testData.js +63 -0
  255. package/src/ui/a/Alert/Alert.jsx +144 -0
  256. package/src/ui/a/Alert/index.js +2 -0
  257. package/src/ui/a/Alert/styles.scss +74 -0
  258. package/src/ui/a/{SiteContext → AppContext}/Context.js +0 -0
  259. package/src/ui/a/{SiteContext → AppContext}/ContextProvider.jsx +8 -7
  260. package/src/ui/a/AppContext/index.js +5 -0
  261. package/src/ui/a/{SiteContext/useSite.js → AppContext/useApp.js} +0 -0
  262. package/src/ui/a/{SiteContext → AppContext}/useTheme.js +0 -0
  263. package/src/ui/a/BackgroundGradient/BackgroundGradient.jsx +76 -0
  264. package/src/ui/a/BackgroundGradient/index.js +2 -0
  265. package/src/ui/a/BackgroundGradient/styles.scss +16 -0
  266. package/src/ui/a/ContentTree/ContentTree.jsx +88 -0
  267. package/src/ui/a/ContentTree/common/Tree/Tree.jsx +138 -0
  268. package/src/ui/a/ContentTree/common/Tree/index.js +2 -0
  269. package/src/ui/a/ContentTree/common/index.js +3 -0
  270. package/src/ui/a/ContentTree/common/useContentTree.js +83 -0
  271. package/src/ui/a/ContentTree/common/useFirstVisibleNode.js +59 -0
  272. package/src/ui/a/ContentTree/index.js +2 -0
  273. package/src/ui/a/ContentTree/styles.scss +33 -0
  274. package/src/ui/a/Conversation/Conversation.jsx +15 -7
  275. package/src/ui/a/Conversation/common/Message/Message.jsx +38 -6
  276. package/src/ui/a/Conversation/styles.scss +132 -33
  277. package/src/ui/a/Label/Label.jsx +93 -0
  278. package/src/ui/a/Label/index.js +2 -0
  279. package/src/ui/a/Label/styles.scss +34 -0
  280. package/src/ui/a/OvalIllustration/OvalIllustration.jsx +134 -0
  281. package/src/ui/a/OvalIllustration/index.js +2 -0
  282. package/src/ui/a/OvalIllustration/styles.scss +102 -0
  283. package/src/ui/a/Popover/Popover.jsx +157 -0
  284. package/src/ui/a/Popover/index.js +2 -0
  285. package/src/ui/a/Popover/styles.scss +33 -0
  286. package/src/ui/a/Shapes/Shapes.jsx +10 -0
  287. package/src/ui/a/Shapes/styles.scss +42 -9
  288. package/src/ui/a/SnapScroller/SnapScroller.jsx +83 -0
  289. package/src/ui/a/SnapScroller/index.js +2 -0
  290. package/src/ui/a/SnapScroller/styles.scss +38 -0
  291. package/src/ui/a/index.js +11 -4
  292. package/src/ui/b/Button/Button.jsx +9 -1
  293. package/src/ui/b/Button/styles.scss +55 -10
  294. package/src/ui/b/Logo/Logo.jsx +41 -41
  295. package/src/ui/b/Logo/styles.scss +0 -138
  296. package/src/ui/b/Page/common/PageHelmet/PageHelmet.jsx +2 -2
  297. package/src/ui/b/Page/common/Section/Section.jsx +19 -2
  298. package/src/ui/b/SocialMediaButton/SocialMediaButton.jsx +4 -4
  299. package/src/ui/b/ThemeSelector/ThemeSelector.jsx +2 -2
  300. package/src/ui/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.jsx +12 -5
  301. package/src/ui/c/ContentSlides/common/Navigator/Navigator.jsx +3 -2
  302. package/src/ui/c/ContentSlides/styles.scss +10 -4
  303. package/src/ui/c/SocialMediaShareButton/SocialMediaShareButton.jsx +121 -0
  304. package/src/ui/c/SocialMediaShareButton/index.js +2 -0
  305. package/src/ui/c/SocialMediaShareButton/styles.scss +39 -0
  306. package/src/ui/c/index.js +1 -0
  307. package/src/ui/f/FormInput/FormInput.jsx +38 -1
  308. package/src/ui/f/FormInput/styles.scss +11 -0
  309. package/src/ui/f/common/Debugger/Debugger.jsx +1 -1
  310. package/src/ui/f/common/Description/Description.jsx +34 -29
  311. package/src/ui/f/common/Label/Label.jsx +1 -1
  312. package/src/ui/f/common/Label/styles.scss +1 -1
  313. package/src/ui/f/fields/ChoicesInput/ChoicesInput.jsx +1 -1
  314. package/src/ui/f/fields/ChoicesInput/styles.scss +17 -2
  315. package/src/ui/f/fields/QueryCombobox/QueryCombobox.jsx +227 -0
  316. package/src/ui/f/fields/QueryCombobox/common/Combobox/Combobox.jsx +218 -0
  317. package/src/ui/f/fields/QueryCombobox/common/Combobox/index.js +2 -0
  318. package/src/ui/f/fields/QueryCombobox/common/Menu/Menu.jsx +103 -0
  319. package/src/ui/f/fields/QueryCombobox/common/Menu/index.js +2 -0
  320. package/src/ui/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.jsx +314 -0
  321. package/src/ui/f/fields/QueryCombobox/common/MultipleCombobox/index.js +2 -0
  322. package/src/ui/f/fields/QueryCombobox/common/index.js +3 -0
  323. package/src/ui/f/fields/QueryCombobox/index.js +2 -0
  324. package/src/ui/f/fields/QueryCombobox/styles.scss +90 -0
  325. package/src/ui/f/fields/QuerySelect/QuerySelect.jsx +200 -0
  326. package/src/ui/f/fields/QuerySelect/index.js +2 -0
  327. package/src/ui/f/fields/RatingsInput/RatingsInput.jsx +54 -19
  328. package/src/ui/f/fields/RatingsInput/styles.scss +29 -20
  329. package/src/ui/f/fields/SelectInput/SelectInput.jsx +66 -8
  330. package/src/ui/f/fields/SelectInput/styles.scss +33 -13
  331. package/src/ui/f/fields/TextInput/TextInput.jsx +44 -10
  332. package/src/ui/f/fields/TextInput/styles.scss +16 -7
  333. package/src/ui/f/fields/TextareaInput/TextareaInput.jsx +42 -21
  334. package/src/ui/f/fields/TextareaInput/styles.scss +19 -6
  335. package/src/ui/f/fields/index.js +2 -3
  336. package/src/ui/form-reset.scss +1 -1
  337. package/src/ui/index.js +2 -0
  338. package/src/ui/test/QueryLoader/QueryLoader.jsx +41 -0
  339. package/src/ui/test/QueryLoader/__generated__/QueryLoaderHelloQuery.graphql.js +68 -0
  340. package/src/ui/test/QueryLoader/common/PreloadedTestData/PreloadedTestData.jsx +51 -0
  341. package/src/ui/test/QueryLoader/common/PreloadedTestData/index.js +2 -0
  342. package/src/ui/test/QueryLoader/common/index.js +1 -0
  343. package/src/ui/test/QueryLoader/index.js +2 -0
  344. package/src/ui/test/index.js +1 -0
  345. package/src/ui/utils/hooks/index.js +2 -0
  346. package/src/ui/utils/hooks/useDynamicPosition.js +104 -0
  347. package/src/ui/utils/hooks/useWindowSize.js +32 -0
  348. package/src/ui/utils/index.js +1 -0
  349. package/stylelint.config.js +13 -13
  350. package/dist/cjs/a/GradientBackground/index.js +0 -15
  351. package/dist/cjs/a/GradientBackground/styles.scss +0 -191
  352. package/dist/cjs/c/AcceptCookies/styles.scss +0 -49
  353. package/dist/cjs/c/BlogCategoryButton/index.js +0 -15
  354. package/dist/cjs/c/BlogContext/BlogContextProvider.js +0 -63
  355. package/dist/cjs/c/BlogPost/BlogPost.js +0 -147
  356. package/dist/cjs/c/BlogPost/styles.scss +0 -33
  357. package/dist/cjs/c/BlogPostsList/common/Card/Card.js +0 -170
  358. package/dist/cjs/c/BlogPostsList/common/index.js +0 -13
  359. package/dist/cjs/c/BlogPostsList/index.js +0 -15
  360. package/dist/cjs/c/BlogPostsList/styles.scss +0 -72
  361. package/dist/cjs/c/SiteFooter/common/index.js +0 -13
  362. package/dist/cjs/c/SiteFooter/styles.scss +0 -34
  363. package/dist/cjs/c/SiteHeaderCTA/index.js +0 -15
  364. package/dist/cjs/c/SiteHeaderCTA/styles.scss +0 -44
  365. package/dist/cjs/c/SiteMission/SiteMission.js +0 -113
  366. package/dist/cjs/c/SiteMission/styles.scss +0 -30
  367. package/dist/cjs/c/SiteNavigation/SiteNavigation.js +0 -130
  368. package/dist/cjs/c/SiteNavigation/index.js +0 -15
  369. package/dist/cjs/c/SiteNavigation/styles.scss +0 -118
  370. package/dist/cjs/c/SiteOnboardingStep/SiteOnboardingStep.js +0 -98
  371. package/dist/cjs/c/SiteOnboardingStep/index.js +0 -15
  372. package/dist/cjs/c/SiteOnboardingStep/styles.scss +0 -51
  373. package/dist/cjs/c/SitePricing/SitePricing.js +0 -108
  374. package/dist/cjs/c/SitePricing/styles.scss +0 -73
  375. package/dist/cjs/c/SiteServices/SiteServices.js +0 -211
  376. package/dist/cjs/c/SiteServices/index.js +0 -15
  377. package/dist/cjs/c/SiteServices/styles.scss +0 -138
  378. package/dist/cjs/c/TeamGallery/common/PersonCard/PersonCard.js +0 -84
  379. package/dist/cjs/c/TeamGallery/common/PersonCard/index.js +0 -15
  380. package/dist/cjs/c/TeamGallery/styles.scss +0 -100
  381. package/dist/cjs/c/Testimonials/Testimonials.js +0 -119
  382. package/dist/cjs/c/Testimonials/index.js +0 -15
  383. package/dist/cjs/c/Testimonials/styles.scss +0 -112
  384. package/dist/cjs/experimental/GradientBackground/index.js +0 -15
  385. package/dist/cjs/experimental/GradientBackground/styles.scss +0 -64
  386. package/dist/cjs/experimental/index.js +0 -13
  387. package/dist/cjs/f/fields/TaskRecommendation/TaskRecommendation.js +0 -129
  388. package/dist/cjs/f/fields/TaskRecommendation/index.js +0 -15
  389. package/dist/cjs/f/fields/TaskRecommendation/styles.scss +0 -37
  390. package/dist/cjs/f/fields/TextArea/TextArea.js +0 -141
  391. package/dist/cjs/f/fields/TextArea/styles.scss +0 -19
  392. package/dist/es/a/GradientBackground/GradientBackground.js +0 -118
  393. package/dist/es/a/GradientBackground/index.js +0 -2
  394. package/dist/es/a/GradientBackground/styles.scss +0 -191
  395. package/dist/es/c/AcceptCookies/AcceptCookies.js +0 -117
  396. package/dist/es/c/AcceptCookies/index.js +0 -2
  397. package/dist/es/c/AcceptCookies/styles.scss +0 -49
  398. package/dist/es/c/BlogCategoryButton/BlogCategoryButton.js +0 -68
  399. package/dist/es/c/BlogCategoryButton/index.js +0 -2
  400. package/dist/es/c/BlogContext/BlogContextProvider.js +0 -45
  401. package/dist/es/c/BlogContext/ContextProvider.js +0 -45
  402. package/dist/es/c/BlogContext/index.js +0 -4
  403. package/dist/es/c/BlogPost/BlogPost.js +0 -128
  404. package/dist/es/c/BlogPost/styles.scss +0 -33
  405. package/dist/es/c/BlogPostsList/common/Card/Card.js +0 -143
  406. package/dist/es/c/BlogPostsList/common/index.js +0 -1
  407. package/dist/es/c/BlogPostsList/index.js +0 -2
  408. package/dist/es/c/BlogPostsList/styles.scss +0 -72
  409. package/dist/es/c/SiteFooter/common/Section/Section.js +0 -73
  410. package/dist/es/c/SiteFooter/common/index.js +0 -1
  411. package/dist/es/c/SiteFooter/index.js +0 -2
  412. package/dist/es/c/SiteFooter/styles.scss +0 -34
  413. package/dist/es/c/SiteHeaderCTA/SiteHeaderCTA.js +0 -92
  414. package/dist/es/c/SiteHeaderCTA/index.js +0 -2
  415. package/dist/es/c/SiteHeaderCTA/styles.scss +0 -44
  416. package/dist/es/c/SiteMission/SiteMission.js +0 -96
  417. package/dist/es/c/SiteMission/index.js +0 -2
  418. package/dist/es/c/SiteMission/styles.scss +0 -30
  419. package/dist/es/c/SiteNavigation/SiteNavigation.js +0 -111
  420. package/dist/es/c/SiteNavigation/index.js +0 -2
  421. package/dist/es/c/SiteNavigation/styles.scss +0 -118
  422. package/dist/es/c/SiteOnboardingStep/SiteOnboardingStep.js +0 -81
  423. package/dist/es/c/SiteOnboardingStep/index.js +0 -2
  424. package/dist/es/c/SiteOnboardingStep/styles.scss +0 -51
  425. package/dist/es/c/SitePricing/SitePricing.js +0 -91
  426. package/dist/es/c/SitePricing/index.js +0 -2
  427. package/dist/es/c/SitePricing/styles.scss +0 -73
  428. package/dist/es/c/SiteServices/SiteServices.js +0 -195
  429. package/dist/es/c/SiteServices/index.js +0 -2
  430. package/dist/es/c/SiteServices/styles.scss +0 -138
  431. package/dist/es/c/TeamGallery/common/PersonCard/PersonCard.js +0 -64
  432. package/dist/es/c/TeamGallery/common/PersonCard/index.js +0 -2
  433. package/dist/es/c/TeamGallery/common/index.js +0 -1
  434. package/dist/es/c/TeamGallery/index.js +0 -2
  435. package/dist/es/c/TeamGallery/styles.scss +0 -100
  436. package/dist/es/c/Testimonials/Testimonials.js +0 -99
  437. package/dist/es/c/Testimonials/index.js +0 -2
  438. package/dist/es/c/Testimonials/styles.scss +0 -112
  439. package/dist/es/experimental/GradientBackground/GradientBackground.js +0 -76
  440. package/dist/es/experimental/GradientBackground/index.js +0 -2
  441. package/dist/es/experimental/GradientBackground/styles.scss +0 -64
  442. package/dist/es/experimental/index.js +0 -1
  443. package/dist/es/f/fields/TaskRecommendation/TaskRecommendation.js +0 -111
  444. package/dist/es/f/fields/TaskRecommendation/index.js +0 -2
  445. package/dist/es/f/fields/TaskRecommendation/styles.scss +0 -37
  446. package/dist/es/f/fields/TextArea/TextArea.js +0 -124
  447. package/dist/es/f/fields/TextArea/styles.scss +0 -19
  448. package/src/stories/f/CheckboxInput.stories.jsx +0 -37
  449. package/src/stories/f/RadioInput.stories.jsx +0 -37
  450. package/src/stories/f/TaskRecommendationInput.stories.jsx +0 -38
  451. package/src/ui/a/SiteContext/index.js +0 -5
  452. package/src/ui/f/fields/CheckboxInput/CheckboxInput.jsx +0 -107
  453. package/src/ui/f/fields/CheckboxInput/index.js +0 -2
  454. package/src/ui/f/fields/CheckboxInput/styles.scss +0 -28
  455. package/src/ui/f/fields/RadioInput/RadioInput.jsx +0 -112
  456. package/src/ui/f/fields/RadioInput/index.js +0 -2
  457. package/src/ui/f/fields/RadioInput/styles.scss +0 -26
  458. package/src/ui/f/fields/TaskRecommendationInput/TaskRecommendationInput.jsx +0 -130
  459. package/src/ui/f/fields/TaskRecommendationInput/index.js +0 -2
  460. package/src/ui/f/fields/TaskRecommendationInput/styles.scss +0 -41
@@ -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
@@ -90,7 +90,7 @@ Label.propTypes = {
90
90
  Label.defaultProps = {
91
91
  // someProp:false
92
92
  as :'label',
93
- color:'main1',
93
+ color:'main2',
94
94
  }
95
95
 
96
96
  export default Label
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
  .#{bem.$base}.label {
8
- color: var(--x);
8
+ color: var(--dark-x);
9
9
  }
10
10
 
11
11
 
@@ -148,7 +148,7 @@ ChoicesInput.defaultProps = {
148
148
  gridColumnsMobile :2,
149
149
  gridColumnsDesktop:3,
150
150
  color :'background2',
151
- colorChecked :'main1',
151
+ colorChecked :'main2',
152
152
  disabled :false,
153
153
  }
154
154
 
@@ -29,10 +29,21 @@ $default-transition:all .3s;
29
29
  z-index: -1;
30
30
  }
31
31
 
32
+ input:disabled + label {
33
+ background-color: var(--dark-x);
34
+ }
35
+
36
+ input:not(:disabled) + label {
37
+ &:hover {
38
+ border-color: var(--light-y);
39
+ }
40
+ }
41
+
32
42
  label {
33
- background: var(--x);
34
- border-radius: var(--theme-border-radius);
43
+ border: var(--theme-border-style) var(--dark-x);
44
+ background: var(--light-x);
35
45
  color: var(--on-x);
46
+ border-radius: var(--theme-border-radius);
36
47
  display: block;
37
48
  height: 100%;
38
49
  padding: $default-padding;
@@ -44,6 +55,10 @@ $default-transition:all .3s;
44
55
  input:checked + label {
45
56
  background: var(--y);
46
57
  color: var(--on-y);
58
+
59
+ &:hover {
60
+ border-color: var(--y);
61
+ }
47
62
  }
48
63
  }
49
64
  }
@@ -0,0 +1,227 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ import * as React from 'react'
3
+
4
+ import { useState, useLayoutEffect } from 'react'
5
+
6
+ import { useField } from 'formik'
7
+
8
+ import { useRelayEnvironment, fetchQuery } from 'react-relay'
9
+
10
+ import PropTypes from 'prop-types'
11
+
12
+ // Local Definitions
13
+
14
+ import { Combobox, MultipleCombobox } from './common'
15
+
16
+ /**
17
+ * This is the component description.
18
+ */
19
+ const QueryCombobox = ({
20
+ id,
21
+ style,
22
+ className,
23
+ query,
24
+ multiple,
25
+ name,
26
+ label,
27
+ color,
28
+ description,
29
+ disabled,
30
+ debounceMs,
31
+ searchVariable,
32
+ extraVariables,
33
+ optionsKeyMap,
34
+ minLength,
35
+ transformSearch,
36
+ // ...otherProps
37
+ }) => {
38
+ useLayoutEffect(() => {
39
+ import('./styles.scss')
40
+ }, [])
41
+
42
+ const [, meta, helpers] = useField(name)
43
+
44
+ const { setValue, setError } = helpers
45
+
46
+ const { value } = meta
47
+
48
+ const environment = useRelayEnvironment()
49
+
50
+ const [isFetching, setIsFetching] = useState(false)
51
+
52
+ const [options, setOptions] = useState([])
53
+
54
+ const { graphql, accessor } = query
55
+
56
+ const getOptions = (inputValue) => {
57
+ if (isFetching) return
58
+
59
+ let variables = { [searchVariable]: inputValue }
60
+
61
+ if (extraVariables) {
62
+ variables = {
63
+ ...variables,
64
+ ...extraVariables,
65
+ }
66
+ }
67
+
68
+ fetchQuery(
69
+ environment,
70
+ graphql,
71
+ variables,
72
+ )
73
+ .subscribe({
74
+ start:() => {
75
+ setIsFetching(true)
76
+ },
77
+ complete:() => {
78
+ setIsFetching(false)
79
+ },
80
+ error:(fetchError) => {
81
+ setIsFetching(false)
82
+ if (setError)setError(fetchError.message)
83
+ },
84
+ next:(data) => {
85
+ setOptions(data[accessor].edges.map(({ node }) => ({
86
+ value:node[optionsKeyMap.value],
87
+ label:optionsKeyMap.getLabel(node),
88
+ })))
89
+ },
90
+ })
91
+ }
92
+
93
+ const comboboxProps = {
94
+ id,
95
+ style,
96
+ options,
97
+ getOptions,
98
+ debounceMs,
99
+ disabled,
100
+ name,
101
+ label,
102
+ description,
103
+ setValue,
104
+ value,
105
+ color,
106
+ isFetching,
107
+ className,
108
+ minLength,
109
+ transformSearch,
110
+ }
111
+
112
+ const Input = multiple ? MultipleCombobox : Combobox
113
+
114
+ return <Input {...comboboxProps} />
115
+ }
116
+
117
+ QueryCombobox.propTypes = {
118
+ /**
119
+ * The HTML id for this element
120
+ */
121
+ id:PropTypes.string,
122
+
123
+ /**
124
+ * The HTML class names for this element
125
+ */
126
+ className:PropTypes.string,
127
+
128
+ /**
129
+ * The React-written, css properties for this element.
130
+ */
131
+ style:PropTypes.objectOf(PropTypes.string),
132
+
133
+ /**
134
+ * The name of the custom select input
135
+ */
136
+ name:PropTypes.string,
137
+
138
+ /**
139
+ * The label of the custom select input
140
+ */
141
+ label:PropTypes.string,
142
+
143
+ /**
144
+ * The custom select input description
145
+ */
146
+ description:PropTypes.string,
147
+
148
+ /**
149
+ * Whether the input should be disabled
150
+ */
151
+ disabled:PropTypes.bool,
152
+
153
+ /**
154
+ * The base color of the custom select input
155
+ */
156
+ color:PropTypes.string,
157
+
158
+ /**
159
+ * The debounce time in milliseconds
160
+ */
161
+ debounceMs:PropTypes.number,
162
+
163
+ /**
164
+ * The graphql query to fetch the options and the accessor to destructure the results from
165
+ */
166
+ query:PropTypes.shape({
167
+ accessor:PropTypes.string,
168
+ graphql :PropTypes.oneOfType([
169
+ PropTypes.string,
170
+ PropTypes.object,
171
+ ]).isRequired,
172
+ }),
173
+
174
+ /**
175
+ * The extra variables required to be used in the query.
176
+ */
177
+ extraVariables:PropTypes.objectOf(PropTypes.string),
178
+
179
+ /**
180
+ * The select option keys to be used to map the data to the select options.
181
+ * i.e `{ value: 'id', label: 'name' }`
182
+ */
183
+ optionsKeyMap:PropTypes.shape({
184
+ value :PropTypes.string.isRequired,
185
+ getLabel:PropTypes.func.isRequired,
186
+ }),
187
+
188
+ /**
189
+ * Whether to allow multiple items selection
190
+ */
191
+ multiple:PropTypes.bool,
192
+
193
+ /**
194
+ * The graphql node to be used to destructure the fetched data
195
+ */
196
+ graphQlNode:PropTypes.string.isRequired,
197
+
198
+ /**
199
+ * The variable to be used to search the data
200
+ */
201
+ searchVariable:PropTypes.string,
202
+
203
+ /**
204
+ * The minimum length of the search input to start fetching the options
205
+ */
206
+ minLength:PropTypes.number,
207
+
208
+ /**
209
+ * The function to transform the search input
210
+ */
211
+ transformSearch:PropTypes.func,
212
+ }
213
+
214
+ QueryCombobox.defaultProps = {
215
+ optionsKeyMap:{
216
+ value :'id',
217
+ getLabel:(node) => node.name,
218
+ },
219
+ multiple :false,
220
+ color :'background2',
221
+ searchVariable :'search',
222
+ transformSearch:(search) => search,
223
+ minLength :2,
224
+ disabled :false,
225
+ }
226
+
227
+ export default QueryCombobox
@@ -0,0 +1,218 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ import * as React from 'react'
3
+
4
+ import { useEffect, useRef } from 'react'
5
+
6
+ import PropTypes from 'prop-types'
7
+
8
+ import { useCombobox } from 'downshift'
9
+
10
+ import styleNames from '@pareto-engineering/bem'
11
+
12
+ import { FormLabel, FormDescription } from 'ui/f'
13
+
14
+ import { Popover, LoadingCircle } from 'ui/a'
15
+
16
+ // Local Definitions
17
+
18
+ import { Menu } from '../Menu'
19
+
20
+ const baseClassName = styleNames.base
21
+
22
+ const componentClassName = 'combobox'
23
+
24
+ /**
25
+ * This is the component description.
26
+ */
27
+ const Combobox = ({
28
+ id,
29
+ className:userClassName,
30
+ style,
31
+ label,
32
+ name,
33
+ options:items,
34
+ getOptions,
35
+ setValue,
36
+ description,
37
+ value,
38
+ color,
39
+ minLength,
40
+ isFetching,
41
+ transformSearch,
42
+ disabled,
43
+ // ...otherProps
44
+ }) => {
45
+ const {
46
+ isOpen,
47
+ selectItem,
48
+ selectedItem,
49
+ getLabelProps,
50
+ getMenuProps,
51
+ getInputProps,
52
+ highlightedIndex,
53
+ getComboboxProps,
54
+ getItemProps,
55
+ } = useCombobox({
56
+ items,
57
+ initialSelectedItem:value,
58
+ itemToString :(item) => (item ? item.label : ''),
59
+ onInputValueChange :({ inputValue }) => {
60
+ const transformedInput = transformSearch(inputValue)
61
+ if (transformedInput.length > minLength) {
62
+ getOptions(transformedInput)
63
+ }
64
+ },
65
+ })
66
+
67
+ // If the user has selected an item, we'll set the value of the field
68
+ // or if the combobox state has a selected item, we'll set the value to the formik state
69
+ useEffect(() => {
70
+ if (selectedItem) {
71
+ setValue(selectedItem)
72
+ }
73
+ }, [selectedItem])
74
+
75
+ // If the formik state has a value, we'll set the selected item to the combobox state
76
+ useEffect(() => {
77
+ if (value?.value !== selectedItem?.value) {
78
+ selectItem(value)
79
+ }
80
+ }, [value])
81
+
82
+ const parentRef = useRef(null)
83
+
84
+ return (
85
+ <div
86
+ id={id}
87
+ className={[
88
+
89
+ baseClassName,
90
+
91
+ componentClassName,
92
+ userClassName,
93
+ `y-${color}`,
94
+ ]
95
+ .filter((e) => e)
96
+ .join(' ')}
97
+ style={style}
98
+ ref={parentRef}
99
+ >
100
+ <FormLabel {...getLabelProps()} name={name}>
101
+ {label}
102
+ </FormLabel>
103
+
104
+ <div {...getComboboxProps()} className="input-wrapper">
105
+ <input {...getInputProps()} className="input" disabled={disabled} />
106
+ {isFetching && (
107
+ <LoadingCircle className="x-main2" />
108
+ )}
109
+ </div>
110
+
111
+ <Popover
112
+ isOpen={isOpen}
113
+ parentRef={parentRef}
114
+ >
115
+ <Menu
116
+ isOpen={isOpen}
117
+ getItemProps={getItemProps}
118
+ highlightedIndex={highlightedIndex}
119
+ items={items}
120
+ {...getMenuProps()}
121
+ />
122
+ </Popover>
123
+
124
+ <FormDescription className="v50 mt-v s-1" description={description} name={name} />
125
+ </div>
126
+ )
127
+ }
128
+
129
+ Combobox.propTypes = {
130
+ /**
131
+ * The HTML id for this element
132
+ */
133
+ id:PropTypes.string,
134
+
135
+ /**
136
+ * The HTML class names for this element
137
+ */
138
+ className:PropTypes.string,
139
+
140
+ /**
141
+ * The React-written, css properties for this element.
142
+ */
143
+ style:PropTypes.objectOf(PropTypes.string),
144
+
145
+ /**
146
+ * The label of the custom select input
147
+ */
148
+ label:PropTypes.string,
149
+
150
+ /**
151
+ * The custom select input options from the backend
152
+ */
153
+ options:PropTypes.arrayOf(
154
+ PropTypes.shape({
155
+ value:PropTypes.string,
156
+ label:PropTypes.string,
157
+ }),
158
+ ),
159
+
160
+ /**
161
+ * The name of the custom select input
162
+ */
163
+ name:PropTypes.string,
164
+
165
+ /**
166
+ * The function to fetch the options from the backend
167
+ */
168
+ getOptions:PropTypes.func,
169
+
170
+ /**
171
+ * The function to set the value of the custom select input
172
+ */
173
+ setValue:PropTypes.func.isRequired,
174
+
175
+ /**
176
+ * The custom select input description
177
+ */
178
+ description:PropTypes.string,
179
+
180
+ /**
181
+ * The value of the custom select input
182
+ */
183
+ value:PropTypes.shape({
184
+ value:PropTypes.string,
185
+ label:PropTypes.string,
186
+ }),
187
+
188
+ /**
189
+ * The base color of the combobox custom select input
190
+ */
191
+ color:PropTypes.string,
192
+
193
+ /**
194
+ * Whether the query getting the combobox options is inFlight
195
+ */
196
+ isFetching:PropTypes.bool.isRequired,
197
+
198
+ /**
199
+ * The minimum length of the search input to start fetching the options
200
+ */
201
+ minLength:PropTypes.number,
202
+
203
+ /**
204
+ * The function to transform the search input
205
+ */
206
+ transformSearch:PropTypes.func,
207
+
208
+ /**
209
+ * Whether the input filed shpuld be disabled
210
+ */
211
+ disabled:PropTypes.bool,
212
+ }
213
+
214
+ Combobox.defaultProps = {
215
+ // someProp: false
216
+ }
217
+
218
+ export default Combobox
@@ -0,0 +1,2 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ export { default as Combobox } from './Combobox'
@@ -0,0 +1,103 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ import * as React from 'react'
3
+
4
+ import PropTypes from 'prop-types'
5
+
6
+ import styleNames from '@pareto-engineering/bem'
7
+
8
+ // Local Definitions
9
+
10
+ const baseClassName = styleNames.base
11
+
12
+ const componentClassName = 'menu'
13
+
14
+ /**
15
+ * This is the component description.
16
+ */
17
+ const Menu = React.forwardRef(({
18
+ id,
19
+ className:userClassName,
20
+ style,
21
+ items,
22
+ isOpen,
23
+ highlightedIndex,
24
+ getItemProps,
25
+ ...otherProps
26
+ }, ref) => (
27
+ <ul
28
+ id={id}
29
+ className={[
30
+
31
+ baseClassName,
32
+
33
+ componentClassName,
34
+ userClassName,
35
+ ]
36
+ .filter((e) => e)
37
+ .join(' ')}
38
+ style={style}
39
+ ref={ref}
40
+ {...otherProps}
41
+ >
42
+ {isOpen && items.map((item, index) => (
43
+ <li
44
+ key={item.label}
45
+ {...getItemProps({ item, index })}
46
+ className={[
47
+ 'item',
48
+ highlightedIndex === index && styleNames.modifierActive,
49
+ ].filter(Boolean)
50
+ .join(' ')}
51
+ >
52
+ <p>
53
+ {item.label}
54
+ </p>
55
+ </li>
56
+ ))}
57
+ </ul>
58
+ ))
59
+ Menu.propTypes = {
60
+ /**
61
+ * The HTML id for this element
62
+ */
63
+ id:PropTypes.string,
64
+
65
+ /**
66
+ * The HTML class names for this element
67
+ */
68
+ className:PropTypes.string,
69
+
70
+ /**
71
+ * The React-written, css properties for this element.
72
+ */
73
+ style:PropTypes.objectOf(PropTypes.string),
74
+
75
+ /**
76
+ * The items to be displayed in the menu
77
+ */
78
+ items:PropTypes.arrayOf(PropTypes.shape({
79
+ value:PropTypes.string,
80
+ label:PropTypes.string,
81
+ })),
82
+
83
+ /**
84
+ * Whether or not the menu is open
85
+ */
86
+ isOpen:PropTypes.bool,
87
+
88
+ /**
89
+ * The index of the highlighted item
90
+ */
91
+ highlightedIndex:PropTypes.number,
92
+
93
+ /**
94
+ * The function to get the item props
95
+ */
96
+ getItemProps:PropTypes.func,
97
+ }
98
+
99
+ Menu.defaultProps = {
100
+ // someProp:false
101
+ }
102
+
103
+ export default Menu
@@ -0,0 +1,2 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ export { default as Menu } from './Menu'