@pareto-engineering/design-system 4.0.0-alpha.59 → 4.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 (208) hide show
  1. package/dist/cjs/a/AnimatedBlobs/AnimatedBlobs.js +6 -7
  2. package/dist/cjs/a/AnimatedGradient/AnimatedGradient.js +9 -9
  3. package/dist/cjs/a/AppContext/Context.js +3 -4
  4. package/dist/cjs/a/AppContext/ContextProvider.js +6 -6
  5. package/dist/cjs/a/AppContext/useTheme.js +2 -3
  6. package/dist/cjs/a/BlurOverlay/BlurOverlay.js +6 -7
  7. package/dist/cjs/a/ContentTree/ContentTree.js +8 -7
  8. package/dist/cjs/a/ContentTree/common/Tree/Tree.js +8 -8
  9. package/dist/cjs/a/ContentTree/common/useContentTree.js +1 -2
  10. package/dist/cjs/a/ContentTree/common/useFirstVisibleNode.js +1 -2
  11. package/dist/cjs/a/Conversation/Context.js +3 -4
  12. package/dist/cjs/a/Conversation/Conversation.js +8 -7
  13. package/dist/cjs/a/Conversation/common/Message/Message.js +3 -4
  14. package/dist/cjs/a/DotInfo/DotInfo.js +6 -7
  15. package/dist/cjs/a/Figure/Figure.js +6 -7
  16. package/dist/cjs/a/HamburgerButton/HamburgerButton.js +5 -8
  17. package/dist/cjs/a/IconList/IconList.js +5 -8
  18. package/dist/cjs/a/IconList/common/Item/Item.js +3 -4
  19. package/dist/cjs/a/Label/Label.js +5 -8
  20. package/dist/cjs/a/LoadingCircle/LoadingCircle.js +6 -7
  21. package/dist/cjs/a/MetaCard/MetaCard.js +6 -7
  22. package/dist/cjs/a/People/People.js +8 -7
  23. package/dist/cjs/a/People/common/Person/Person.js +3 -4
  24. package/dist/cjs/a/Popover/Popover.js +11 -9
  25. package/dist/cjs/a/ProgressBar/ProgressBar.js +6 -7
  26. package/dist/cjs/a/Quote/Quote.js +6 -7
  27. package/dist/cjs/a/Removable/Removable.js +6 -7
  28. package/dist/cjs/a/SVG/SVG.js +8 -10
  29. package/dist/cjs/a/SVG/common/UseSVG/UseSVG.js +3 -4
  30. package/dist/cjs/a/SnapScroller/SnapScroller.js +12 -12
  31. package/dist/cjs/a/Spinner/Spinner.js +6 -7
  32. package/dist/cjs/a/TextSteps/TextSteps.js +4 -7
  33. package/dist/cjs/a/Timestamp/Timestamp.js +12 -12
  34. package/dist/cjs/a/Tip/Tip.js +6 -7
  35. package/dist/cjs/a/ToggleSwitch/ToggleSwitch.js +10 -11
  36. package/dist/cjs/b/Button/Button.js +4 -8
  37. package/dist/cjs/b/Button/common/Group/Group.js +5 -8
  38. package/dist/cjs/b/Card/Card.js +6 -7
  39. package/dist/cjs/b/Card/common/Group/Group.js +5 -8
  40. package/dist/cjs/b/Card/common/Section/Section.js +3 -4
  41. package/dist/cjs/b/Logo/Logo.js +9 -9
  42. package/dist/cjs/b/Page/Context.js +3 -4
  43. package/dist/cjs/b/Page/Page.js +8 -11
  44. package/dist/cjs/b/Page/common/PageHelmet/PageHelmet.js +6 -6
  45. package/dist/cjs/b/Page/common/Section/Section.js +3 -4
  46. package/dist/cjs/b/SocialMediaButton/SocialMediaButton.js +5 -8
  47. package/dist/cjs/b/ThemeSelector/ThemeSelector.js +10 -10
  48. package/dist/cjs/b/Title/Title.js +4 -10
  49. package/dist/cjs/c/ContentSlides/ContentSlides.js +10 -10
  50. package/dist/cjs/c/ContentSlides/Context.js +3 -4
  51. package/dist/cjs/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.js +3 -4
  52. package/dist/cjs/c/ContentSlides/common/Navigator/Navigator.js +3 -4
  53. package/dist/cjs/c/ContentSlides/common/Sidebar/Sidebar.js +3 -4
  54. package/dist/cjs/c/ContentSlides/common/Slide/Slide.js +3 -4
  55. package/dist/cjs/c/Modal/Modal.js +6 -7
  56. package/dist/cjs/c/Modal/common/ModalHeader/ModalHeader.js +3 -4
  57. package/dist/cjs/c/Shortener/Shortener.js +11 -9
  58. package/dist/cjs/c/SocialMediaShareButton/SocialMediaShareButton.js +6 -7
  59. package/dist/cjs/f/FormInput/FormInput.js +7 -9
  60. package/dist/cjs/f/common/Debugger/Debugger.js +10 -10
  61. package/dist/cjs/f/common/Description/Description.js +6 -7
  62. package/dist/cjs/f/common/InputWrapper/InputWrapper.js +6 -7
  63. package/dist/cjs/f/common/Label/Label.js +6 -7
  64. package/dist/cjs/f/common/index.js +19 -1
  65. package/dist/cjs/f/common/utils/index.js +12 -0
  66. package/dist/cjs/f/common/utils/lookUpInputValueFromFetchedOptions.js +29 -0
  67. package/dist/cjs/f/fields/Checkbox/Checkbox.js +5 -8
  68. package/dist/cjs/f/fields/ChoicesInput/ChoicesInput.js +7 -9
  69. package/dist/cjs/f/fields/ChoicesInput/common/Choice/Choice.js +3 -4
  70. package/dist/cjs/f/fields/EditorInput/EditorInput.js +11 -8
  71. package/dist/cjs/f/fields/EditorInput/common/Toolbar.js +17 -17
  72. package/dist/cjs/f/fields/EditorInput/common/TreeViewPlugin.js +1 -2
  73. package/dist/cjs/f/fields/LinkInput/LinkInput.js +7 -9
  74. package/dist/cjs/f/fields/QueryChoices/QueryChoices.js +8 -8
  75. package/dist/cjs/f/fields/QueryCombobox/QueryCombobox.js +27 -14
  76. package/dist/cjs/f/fields/QueryCombobox/common/Combobox/Combobox.js +29 -11
  77. package/dist/cjs/f/fields/QueryCombobox/common/Menu/Menu.js +3 -4
  78. package/dist/cjs/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +30 -12
  79. package/dist/cjs/f/fields/QuerySelect/QuerySelect.js +8 -8
  80. package/dist/cjs/f/fields/RatingsInput/RatingsInput.js +11 -9
  81. package/dist/cjs/f/fields/RatingsInput/common/Rating/Rating.js +3 -4
  82. package/dist/cjs/f/fields/SelectInput/SelectInput.js +7 -9
  83. package/dist/cjs/f/fields/TextInput/TextInput.js +7 -9
  84. package/dist/cjs/f/fields/TextareaInput/TextareaInput.js +7 -9
  85. package/dist/cjs/r/SwitchRouteMap/SwitchRouteMap.js +3 -4
  86. package/dist/cjs/r/common/PrivateRoute/PrivateRoute.js +6 -6
  87. package/dist/cjs/test/QueryLoader/QueryLoader.js +7 -7
  88. package/dist/cjs/test/QueryLoader/common/PreloadedTestData/PreloadedTestData.js +3 -4
  89. package/dist/cjs/utils/hooks/useDynamicPosition.js +1 -2
  90. package/dist/cjs/utils/hooks/useWindowSize.js +1 -2
  91. package/dist/es/a/AnimatedBlobs/AnimatedBlobs.js +18 -23
  92. package/dist/es/a/AnimatedGradient/AnimatedGradient.js +2 -4
  93. package/dist/es/a/BlurOverlay/BlurOverlay.js +6 -11
  94. package/dist/es/a/ContentTree/ContentTree.js +1 -4
  95. package/dist/es/a/Conversation/Conversation.js +11 -16
  96. package/dist/es/a/DotInfo/DotInfo.js +9 -14
  97. package/dist/es/a/Figure/Figure.js +10 -15
  98. package/dist/es/a/HamburgerButton/HamburgerButton.js +13 -18
  99. package/dist/es/a/IconList/IconList.js +10 -15
  100. package/dist/es/a/Label/Label.js +6 -11
  101. package/dist/es/a/LoadingCircle/LoadingCircle.js +32 -37
  102. package/dist/es/a/MetaCard/MetaCard.js +6 -11
  103. package/dist/es/a/People/People.js +11 -16
  104. package/dist/es/a/Popover/Popover.js +2 -4
  105. package/dist/es/a/ProgressBar/ProgressBar.js +12 -17
  106. package/dist/es/a/Quote/Quote.js +14 -19
  107. package/dist/es/a/Removable/Removable.js +13 -18
  108. package/dist/es/a/SVG/SVG.js +2 -4
  109. package/dist/es/a/SnapScroller/SnapScroller.js +2 -4
  110. package/dist/es/a/Spinner/Spinner.js +9 -14
  111. package/dist/es/a/TextSteps/TextSteps.js +12 -17
  112. package/dist/es/a/Timestamp/Timestamp.js +3 -5
  113. package/dist/es/a/Tip/Tip.js +9 -14
  114. package/dist/es/a/ToggleSwitch/ToggleSwitch.js +20 -25
  115. package/dist/es/b/Button/Button.js +0 -4
  116. package/dist/es/b/Button/common/Group/Group.js +6 -11
  117. package/dist/es/b/Card/Card.js +11 -16
  118. package/dist/es/b/Card/common/Group/Group.js +1 -4
  119. package/dist/es/b/Logo/Logo.js +2 -4
  120. package/dist/es/b/Page/Page.js +2 -6
  121. package/dist/es/b/SocialMediaButton/SocialMediaButton.js +1 -4
  122. package/dist/es/b/ThemeSelector/ThemeSelector.js +3 -5
  123. package/dist/es/b/Title/Title.js +11 -20
  124. package/dist/es/c/ContentSlides/ContentSlides.js +1 -3
  125. package/dist/es/c/Modal/Modal.js +13 -18
  126. package/dist/es/c/Shortener/Shortener.js +2 -4
  127. package/dist/es/c/SocialMediaShareButton/SocialMediaShareButton.js +1 -4
  128. package/dist/es/f/FormInput/FormInput.js +2 -4
  129. package/dist/es/f/common/Debugger/Debugger.js +2 -4
  130. package/dist/es/f/common/Description/Description.js +1 -4
  131. package/dist/es/f/common/InputWrapper/InputWrapper.js +10 -15
  132. package/dist/es/f/common/Label/Label.js +12 -17
  133. package/dist/es/f/common/index.js +2 -1
  134. package/dist/es/f/common/utils/index.js +1 -0
  135. package/dist/es/f/common/utils/lookUpInputValueFromFetchedOptions.js +20 -0
  136. package/dist/es/f/fields/Checkbox/Checkbox.js +1 -4
  137. package/dist/es/f/fields/ChoicesInput/ChoicesInput.js +30 -34
  138. package/dist/es/f/fields/EditorInput/EditorInput.js +2 -4
  139. package/dist/es/f/fields/LinkInput/LinkInput.js +2 -4
  140. package/dist/es/f/fields/QueryCombobox/QueryCombobox.js +17 -8
  141. package/dist/es/f/fields/QueryCombobox/common/Combobox/Combobox.js +22 -4
  142. package/dist/es/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +22 -4
  143. package/dist/es/f/fields/RatingsInput/RatingsInput.js +2 -4
  144. package/dist/es/f/fields/SelectInput/SelectInput.js +2 -4
  145. package/dist/es/f/fields/TextInput/TextInput.js +2 -4
  146. package/dist/es/f/fields/TextareaInput/TextareaInput.js +2 -4
  147. package/package.json +4 -3
  148. package/src/stories/f/QueryCombobox.stories.jsx +18 -0
  149. package/src/ui/a/AnimatedBlobs/AnimatedBlobs.jsx +25 -31
  150. package/src/ui/a/AnimatedGradient/AnimatedGradient.jsx +2 -5
  151. package/src/ui/a/BlurOverlay/BlurOverlay.jsx +18 -24
  152. package/src/ui/a/ContentTree/ContentTree.jsx +2 -6
  153. package/src/ui/a/Conversation/Conversation.jsx +26 -32
  154. package/src/ui/a/DotInfo/DotInfo.jsx +23 -29
  155. package/src/ui/a/Figure/Figure.jsx +21 -27
  156. package/src/ui/a/HamburgerButton/HamburgerButton.jsx +27 -33
  157. package/src/ui/a/IconList/IconList.jsx +22 -28
  158. package/src/ui/a/Label/Label.jsx +21 -27
  159. package/src/ui/a/LoadingCircle/LoadingCircle.jsx +43 -49
  160. package/src/ui/a/MetaCard/MetaCard.jsx +19 -25
  161. package/src/ui/a/People/People.jsx +25 -31
  162. package/src/ui/a/Popover/Popover.jsx +3 -5
  163. package/src/ui/a/ProgressBar/ProgressBar.jsx +25 -31
  164. package/src/ui/a/Quote/Quote.jsx +26 -32
  165. package/src/ui/a/Removable/Removable.jsx +22 -29
  166. package/src/ui/a/SVG/SVG.jsx +3 -5
  167. package/src/ui/a/SnapScroller/SnapScroller.jsx +2 -4
  168. package/src/ui/a/Spinner/Spinner.jsx +19 -25
  169. package/src/ui/a/TextSteps/TextSteps.jsx +27 -34
  170. package/src/ui/a/Timestamp/Timestamp.jsx +5 -7
  171. package/src/ui/a/Tip/Tip.jsx +22 -28
  172. package/src/ui/a/ToggleSwitch/ToggleSwitch.jsx +33 -35
  173. package/src/ui/b/Button/Button.jsx +0 -5
  174. package/src/ui/b/Button/common/Group/Group.jsx +18 -24
  175. package/src/ui/b/Card/Card.jsx +25 -31
  176. package/src/ui/b/Card/common/Group/Group.jsx +2 -5
  177. package/src/ui/b/Logo/Logo.jsx +3 -5
  178. package/src/ui/b/Page/Page.jsx +2 -7
  179. package/src/ui/b/SocialMediaButton/SocialMediaButton.jsx +2 -7
  180. package/src/ui/b/ThemeSelector/ThemeSelector.jsx +4 -6
  181. package/src/ui/b/Title/Title.jsx +36 -46
  182. package/src/ui/c/ContentSlides/ContentSlides.jsx +2 -4
  183. package/src/ui/c/Modal/Modal.jsx +24 -30
  184. package/src/ui/c/Shortener/Shortener.jsx +3 -5
  185. package/src/ui/c/SocialMediaShareButton/SocialMediaShareButton.jsx +2 -6
  186. package/src/ui/f/FormInput/FormInput.jsx +3 -5
  187. package/src/ui/f/common/Debugger/Debugger.jsx +3 -5
  188. package/src/ui/f/common/Description/Description.jsx +2 -6
  189. package/src/ui/f/common/InputWrapper/InputWrapper.jsx +21 -27
  190. package/src/ui/f/common/Label/Label.jsx +25 -31
  191. package/src/ui/f/common/index.js +1 -0
  192. package/src/ui/f/common/utils/index.js +1 -0
  193. package/src/ui/f/common/utils/lookUpInputValueFromFetchedOptions.js +23 -0
  194. package/src/ui/f/fields/Checkbox/Checkbox.jsx +2 -6
  195. package/src/ui/f/fields/ChoicesInput/ChoicesInput.jsx +48 -52
  196. package/src/ui/f/fields/EditorInput/EditorInput.jsx +2 -5
  197. package/src/ui/f/fields/LinkInput/LinkInput.jsx +2 -5
  198. package/src/ui/f/fields/QueryCombobox/QueryCombobox.jsx +21 -11
  199. package/src/ui/f/fields/QueryCombobox/common/Combobox/Combobox.jsx +18 -2
  200. package/src/ui/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.jsx +18 -1
  201. package/src/ui/f/fields/RatingsInput/RatingsInput.jsx +3 -5
  202. package/src/ui/f/fields/SelectInput/SelectInput.jsx +3 -5
  203. package/src/ui/f/fields/TextInput/TextInput.jsx +3 -5
  204. package/src/ui/f/fields/TextareaInput/TextareaInput.jsx +3 -5
  205. package/tests/__snapshots__/Storyshots.test.js.snap +269 -20
  206. package/dist/cjs/b/Title/styles.scss +0 -16
  207. package/dist/es/b/Title/styles.scss +0 -16
  208. package/src/ui/b/Title/styles.scss +0 -16
@@ -1,9 +1,10 @@
1
1
  /* @pareto-engineering/generator-front 1.0.12 */
2
2
  import * as React from 'react';
3
- import { useState, useInsertionEffect, useContext } from 'react';
3
+ import { useState, useContext } from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import { Button } from "../../../b";
6
6
  import { FormikContext } from 'formik';
7
+ import "./styles.scss";
7
8
 
8
9
  // Local Definitions
9
10
 
@@ -19,9 +20,6 @@ const Debugger = ({
19
20
  initialIsOpen
20
21
  // ...otherProps
21
22
  }) => {
22
- useInsertionEffect(() => {
23
- import("./styles.scss");
24
- }, []);
25
23
  const [isOpen, setIsOpen] = useState(initialIsOpen);
26
24
  const toggleDebugger = () => setIsOpen(!isOpen);
27
25
  const formikContext = useContext(FormikContext);
@@ -1,9 +1,9 @@
1
1
  /* @pareto-engineering/generator-front 1.0.12 */
2
2
  import * as React from 'react';
3
- import { useInsertionEffect } from 'react';
4
3
  import { useField } from 'formik';
5
4
  import PropTypes from 'prop-types';
6
5
  import styleNames from '@pareto-engineering/bem/exports';
6
+ import "./styles.scss";
7
7
 
8
8
  // Local Definitions
9
9
 
@@ -22,9 +22,6 @@ const Description = ({
22
22
  color
23
23
  // ...otherProps
24
24
  }) => {
25
- useInsertionEffect(() => {
26
- import("./styles.scss");
27
- }, []);
28
25
  const [, meta] = useField(name);
29
26
  const hasError = meta.touched && meta.error;
30
27
  if (hasError || description) {
@@ -1,8 +1,8 @@
1
1
  /* @pareto-engineering/generator-front 1.0.12 */
2
2
  import * as React from 'react';
3
- import { useInsertionEffect } from 'react';
4
3
  import PropTypes from 'prop-types';
5
4
  import styleNames from '@pareto-engineering/bem/exports';
5
+ import "./styles.scss";
6
6
 
7
7
  // Local Definitions
8
8
 
@@ -20,20 +20,15 @@ const InputWrapper = ({
20
20
  columnSpan,
21
21
  desktopColumnSpan
22
22
  // ...otherProps
23
- }) => {
24
- useInsertionEffect(() => {
25
- import("./styles.scss");
26
- }, []);
27
- return /*#__PURE__*/React.createElement("div", {
28
- id: id,
29
- className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
30
- style: {
31
- ...style,
32
- '--column-span': columnSpan || 'var(--columns)',
33
- '--column-span-md': desktopColumnSpan || 'var(--columns)'
34
- }
35
- }, children);
36
- };
23
+ }) => /*#__PURE__*/React.createElement("div", {
24
+ id: id,
25
+ className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
26
+ style: {
27
+ ...style,
28
+ '--column-span': columnSpan || 'var(--columns)',
29
+ '--column-span-md': desktopColumnSpan || 'var(--columns)'
30
+ }
31
+ }, children);
37
32
  InputWrapper.propTypes = {
38
33
  /**
39
34
  * The HTML id for this element
@@ -1,8 +1,8 @@
1
1
  /* @pareto-engineering/generator-front 1.0.12 */
2
2
  import * as React from 'react';
3
- import { useInsertionEffect } from 'react';
4
3
  import PropTypes from 'prop-types';
5
4
  import styleNames from '@pareto-engineering/bem/exports';
5
+ import "./styles.scss";
6
6
 
7
7
  // Local Definitions
8
8
 
@@ -24,22 +24,17 @@ const Label = ({
24
24
  columnSpan,
25
25
  desktopColumnSpan
26
26
  // ...otherProps
27
- }) => {
28
- useInsertionEffect(() => {
29
- import("./styles.scss");
30
- }, []);
31
- return /*#__PURE__*/React.createElement(Wrapper, {
32
- htmlFor: Wrapper === 'label' ? name : undefined,
33
- id: id,
34
- className: [baseClassName, componentClassName, userClassName, `x-${color}`].filter(e => e).join(' '),
35
- style: {
36
- ...style,
37
- '--column-span': columnSpan || 'var(--columns)',
38
- '--column-span-md': desktopColumnSpan || 'var(--columns)'
39
- }
40
- // {...otherProps}
41
- }, children, optional && ' (Optional)');
42
- };
27
+ }) => /*#__PURE__*/React.createElement(Wrapper, {
28
+ htmlFor: Wrapper === 'label' ? name : undefined,
29
+ id: id,
30
+ className: [baseClassName, componentClassName, userClassName, `x-${color}`].filter(e => e).join(' '),
31
+ style: {
32
+ ...style,
33
+ '--column-span': columnSpan || 'var(--columns)',
34
+ '--column-span-md': desktopColumnSpan || 'var(--columns)'
35
+ }
36
+ // {...otherProps}
37
+ }, children, optional && ' (Optional)');
43
38
  Label.propTypes = {
44
39
  /**
45
40
  * The HTML id for this element
@@ -1,4 +1,5 @@
1
1
  export { Label as FormLabel } from "./Label";
2
2
  export { Description as FormDescription } from "./Description";
3
3
  export { Debugger as FormDebugger } from "./Debugger";
4
- export { InputWrapper } from "./InputWrapper";
4
+ export { InputWrapper } from "./InputWrapper";
5
+ export * from "./utils";
@@ -0,0 +1 @@
1
+ export { lookUpInputValueFromFetchedOptions } from "./lookUpInputValueFromFetchedOptions";
@@ -0,0 +1,20 @@
1
+ import Fuse from 'fuse.js';
2
+ const fuseOptions = {
3
+ findAllMatches: true,
4
+ keys: ['label']
5
+ };
6
+ export const lookUpInputValueFromFetchedOptions = ({
7
+ items,
8
+ inputValue,
9
+ setOptions,
10
+ minLength
11
+ }) => {
12
+ const fuseSearch = new Fuse(items, fuseOptions);
13
+ const result = fuseSearch.search(inputValue);
14
+ if (result.length === 0 && inputValue.length > minLength) {
15
+ setOptions(prevItems => [...prevItems, {
16
+ label: `${inputValue} (Create new)`,
17
+ value: inputValue
18
+ }]);
19
+ }
20
+ };
@@ -1,11 +1,11 @@
1
1
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
  /* @pareto-engineering/generator-front 1.0.12 */
3
3
  import * as React from 'react';
4
- import { useInsertionEffect } from 'react';
5
4
  import PropTypes from 'prop-types';
6
5
  import styleNames from '@pareto-engineering/bem/exports';
7
6
  import { useField } from 'formik';
8
7
  import { FormLabel, FormDescription, InputWrapper } from "../../common";
8
+ import "./styles.scss";
9
9
 
10
10
  // Local Definitions
11
11
 
@@ -31,9 +31,6 @@ const Checkbox = ({
31
31
  desktopInputSpan
32
32
  // ...otherProps
33
33
  }) => {
34
- useInsertionEffect(() => {
35
- import("./styles.scss");
36
- }, []);
37
34
  const [field] = useField({
38
35
  name,
39
36
  type: 'checkbox'
@@ -1,7 +1,7 @@
1
1
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
  /* @pareto-engineering/generator-front 1.0.12 */
3
3
  import * as React from 'react';
4
- import { useInsertionEffect, memo } from 'react';
4
+ import { memo } from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import styleNames from '@pareto-engineering/bem/exports';
7
7
 
@@ -9,6 +9,7 @@ import styleNames from '@pareto-engineering/bem/exports';
9
9
 
10
10
  import { Choice } from "./common";
11
11
  import { FormDescription, FormLabel, InputWrapper } from "../../common";
12
+ import "./styles.scss";
12
13
  const baseClassName = styleNames.base;
13
14
  const componentClassName = 'choices-input';
14
15
 
@@ -35,39 +36,34 @@ const ChoicesInput = ({
35
36
  inputSpan,
36
37
  desktopInputSpan,
37
38
  ...otherProps
38
- }) => {
39
- useInsertionEffect(() => {
40
- import("./styles.scss");
41
- }, []);
42
- return /*#__PURE__*/React.createElement(React.Fragment, null, label && /*#__PURE__*/React.createElement(FormLabel, {
43
- name: name,
44
- color: labelColor,
45
- optional: optional,
46
- columnSpan: labelSpan,
47
- desktopColumnSpan: desktopLabelSpan
48
- // {...otherProps}
49
- }, label), /*#__PURE__*/React.createElement(InputWrapper, {
50
- id: id,
51
- className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
52
- style: style,
53
- columnSpan: inputSpan,
54
- desktopColumnSpan: desktopInputSpan
55
- }, /*#__PURE__*/React.createElement("div", {
56
- className: ['choices', spaceBetween && 'space-between'].filter(Boolean).join(' ')
57
- }, options.map(choice => /*#__PURE__*/React.createElement(Choice, _extends({
58
- className: `x-${color}`,
59
- key: choice.value,
60
- name: name,
61
- id: `${name}-${choice.value}`,
62
- multiple: multiple,
63
- validate: validate,
64
- disabled: disabled
65
- }, otherProps, choice)))), /*#__PURE__*/React.createElement(FormDescription, {
66
- className: "s-1",
67
- description: description,
68
- name: name
69
- })));
70
- };
39
+ }) => /*#__PURE__*/React.createElement(React.Fragment, null, label && /*#__PURE__*/React.createElement(FormLabel, {
40
+ name: name,
41
+ color: labelColor,
42
+ optional: optional,
43
+ columnSpan: labelSpan,
44
+ desktopColumnSpan: desktopLabelSpan
45
+ // {...otherProps}
46
+ }, label), /*#__PURE__*/React.createElement(InputWrapper, {
47
+ id: id,
48
+ className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
49
+ style: style,
50
+ columnSpan: inputSpan,
51
+ desktopColumnSpan: desktopInputSpan
52
+ }, /*#__PURE__*/React.createElement("div", {
53
+ className: ['choices', spaceBetween && 'space-between'].filter(Boolean).join(' ')
54
+ }, options.map(choice => /*#__PURE__*/React.createElement(Choice, _extends({
55
+ className: `x-${color}`,
56
+ key: choice.value,
57
+ name: name,
58
+ id: `${name}-${choice.value}`,
59
+ multiple: multiple,
60
+ validate: validate,
61
+ disabled: disabled
62
+ }, otherProps, choice)))), /*#__PURE__*/React.createElement(FormDescription, {
63
+ className: "s-1",
64
+ description: description,
65
+ name: name
66
+ })));
71
67
  ChoicesInput.propTypes = {
72
68
  /**
73
69
  * The HTML id for this element
@@ -1,7 +1,7 @@
1
1
  /* @pareto-engineering/generator-front 1.0.12 */
2
2
  /* eslint-disable import/no-extraneous-dependencies -- required here */
3
3
  import * as React from 'react';
4
- import { useInsertionEffect, memo } from 'react';
4
+ import { memo } from 'react';
5
5
  import { useFormikContext } from 'formik';
6
6
  import { LexicalComposer } from '@lexical/react/LexicalComposer';
7
7
  import { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin';
@@ -15,6 +15,7 @@ import { AutoLinkNode, LinkNode } from '@lexical/link';
15
15
  import { ListItemNode, ListNode } from '@lexical/list';
16
16
  import PropTypes from 'prop-types';
17
17
  import styleNames from '@pareto-engineering/bem/exports';
18
+ import "./styles.scss";
18
19
 
19
20
  // Local Definitions
20
21
 
@@ -47,9 +48,6 @@ const EditorInput = ({
47
48
  showDebugger
48
49
  // ...otherProps
49
50
  }) => {
50
- useInsertionEffect(() => {
51
- import("./styles.scss");
52
- }, []);
53
51
  const formik = useFormikContext();
54
52
  const setInitialValue = () => {
55
53
  const value = formik.values[name];
@@ -1,11 +1,12 @@
1
1
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
  /* @pareto-engineering/generator-front 1.0.12 */
3
3
  import * as React from 'react';
4
- import { useInsertionEffect, memo } from 'react';
4
+ import { memo } from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import styleNames from '@pareto-engineering/bem/exports';
7
7
  import { useField } from 'formik';
8
8
  import { FormLabel, FormDescription, InputWrapper } from "../../common";
9
+ import "./styles.scss";
9
10
 
10
11
  // Local Definitions
11
12
 
@@ -35,9 +36,6 @@ const LinkInput = ({
35
36
  desktopInputSpan
36
37
  // ...otherProps
37
38
  }) => {
38
- useInsertionEffect(() => {
39
- import("./styles.scss");
40
- }, []);
41
39
  const [field] = useField({
42
40
  name,
43
41
  validate
@@ -1,9 +1,10 @@
1
1
  /* @pareto-engineering/generator-front 1.0.12 */
2
2
  import * as React from 'react';
3
- import { useState, useInsertionEffect } from 'react';
3
+ import { useState } from 'react';
4
4
  import { useField } from 'formik';
5
5
  import { useRelayEnvironment, fetchQuery } from 'react-relay';
6
6
  import PropTypes from 'prop-types';
7
+ import "./styles.scss";
7
8
 
8
9
  // Local Definitions
9
10
 
@@ -35,12 +36,11 @@ const QueryCombobox = ({
35
36
  labelSpan,
36
37
  desktopLabelSpan,
37
38
  inputSpan,
38
- desktopInputSpan
39
+ desktopInputSpan,
40
+ placeholder,
41
+ promptCreateNewOption
39
42
  // ...otherProps
40
43
  }) => {
41
- useInsertionEffect(() => {
42
- import("./styles.scss");
43
- }, []);
44
44
  const [, meta, helpers] = useField({
45
45
  name,
46
46
  validate
@@ -96,6 +96,7 @@ const QueryCombobox = ({
96
96
  style,
97
97
  options,
98
98
  getOptions,
99
+ setOptions,
99
100
  debounceMs,
100
101
  disabled,
101
102
  name,
@@ -113,7 +114,9 @@ const QueryCombobox = ({
113
114
  labelSpan,
114
115
  desktopLabelSpan,
115
116
  inputSpan,
116
- desktopInputSpan
117
+ desktopInputSpan,
118
+ placeholder,
119
+ promptCreateNewOption
117
120
  };
118
121
  const Input = multiple ? MultipleCombobox : Combobox;
119
122
  return /*#__PURE__*/React.createElement(Input, comboboxProps);
@@ -217,7 +220,12 @@ QueryCombobox.propTypes = {
217
220
  /**
218
221
  * The number of columns the input should span on desktop
219
222
  */
220
- desktopInputSpan: PropTypes.number
223
+ desktopInputSpan: PropTypes.number,
224
+ /**
225
+ * Whether to prompt the user to create a new option if the search input
226
+ * does not match any of the options
227
+ */
228
+ promptCreateNewOption: PropTypes.bool
221
229
  };
222
230
  QueryCombobox.defaultProps = {
223
231
  optionsKeyMap: {
@@ -229,6 +237,7 @@ QueryCombobox.defaultProps = {
229
237
  searchVariable: 'search',
230
238
  transformSearch: search => search,
231
239
  minLength: 2,
232
- disabled: false
240
+ disabled: false,
241
+ promptCreateNewOption: false
233
242
  };
234
243
  export default QueryCombobox;
@@ -8,7 +8,7 @@ import styleNames from '@pareto-engineering/bem/exports';
8
8
  import { FormLabel, FormDescription } from "../../../..";
9
9
  import { Popover, LoadingCircle } from "../../../../../a";
10
10
  import { Button } from "../../../../../b";
11
- import { InputWrapper } from "../../../../common";
11
+ import { InputWrapper, lookUpInputValueFromFetchedOptions } from "../../../../common";
12
12
 
13
13
  // Local Definitions
14
14
 
@@ -28,6 +28,7 @@ const Combobox = ({
28
28
  name,
29
29
  options: items,
30
30
  getOptions,
31
+ setOptions,
31
32
  setValue,
32
33
  description,
33
34
  value,
@@ -40,7 +41,9 @@ const Combobox = ({
40
41
  labelSpan,
41
42
  desktopLabelSpan,
42
43
  inputSpan,
43
- desktopInputSpan
44
+ desktopInputSpan,
45
+ placeholder,
46
+ promptCreateNewOption
44
47
  // ...otherProps
45
48
  }) => {
46
49
  const {
@@ -68,6 +71,16 @@ const Combobox = ({
68
71
  }
69
72
  }
70
73
  });
74
+ useEffect(() => {
75
+ if (promptCreateNewOption) {
76
+ lookUpInputValueFromFetchedOptions({
77
+ items,
78
+ inputValue,
79
+ setOptions,
80
+ minLength
81
+ });
82
+ }
83
+ }, [inputValue, items, promptCreateNewOption]);
71
84
 
72
85
  // If the user has selected an item, we'll set the value of the field
73
86
  // or if the combobox state has a selected item, we'll set the value to the formik state
@@ -101,7 +114,8 @@ const Combobox = ({
101
114
  desktopColumnSpan: desktopInputSpan
102
115
  }), /*#__PURE__*/React.createElement("input", _extends({}, getInputProps(), {
103
116
  className: "input",
104
- disabled: disabled
117
+ disabled: disabled,
118
+ placeholder: placeholder
105
119
  })), isFetching && /*#__PURE__*/React.createElement(LoadingCircle, {
106
120
  className: "x-main"
107
121
  }), inputValue.length > minLength && !isFetching && /*#__PURE__*/React.createElement(Button, {
@@ -212,7 +226,11 @@ Combobox.propTypes = {
212
226
  /**
213
227
  * Whether the input is optional or not
214
228
  */
215
- optional: PropTypes.bool
229
+ optional: PropTypes.bool,
230
+ /**
231
+ * The placeholder text for the input
232
+ */
233
+ placeholder: PropTypes.string
216
234
  };
217
235
  Combobox.defaultProps = {
218
236
  // someProp: false
@@ -8,7 +8,7 @@ import { useCombobox, useMultipleSelection } from 'downshift';
8
8
  import { Button } from "../../../../../b";
9
9
  import { Popover, LoadingCircle } from "../../../../../a";
10
10
  import { FormDescription, FormLabel } from "../../../..";
11
- import { InputWrapper } from "../../../../common";
11
+ import { InputWrapper, lookUpInputValueFromFetchedOptions } from "../../../../common";
12
12
 
13
13
  // Local Definitions
14
14
 
@@ -48,7 +48,10 @@ const MultipleCombobox = ({
48
48
  labelSpan,
49
49
  desktopLabelSpan,
50
50
  inputSpan,
51
- desktopInputSpan
51
+ placeholder,
52
+ desktopInputSpan,
53
+ setOptions,
54
+ promptCreateNewOption
52
55
  // ...otherProps
53
56
  }) => {
54
57
  const [searchInputValue, setSearchInputValue] = useState('');
@@ -136,6 +139,16 @@ const MultipleCombobox = ({
136
139
  setValue(selectedItems);
137
140
  }
138
141
  }, [selectedItems]);
142
+ useEffect(() => {
143
+ if (promptCreateNewOption) {
144
+ lookUpInputValueFromFetchedOptions({
145
+ items,
146
+ inputValue,
147
+ setOptions,
148
+ minLength
149
+ });
150
+ }
151
+ }, [inputValue, items, promptCreateNewOption]);
139
152
  useEffect(() => {
140
153
  if (value?.length > 0 && (testIfArraysAreUnique(value, selectedItems) || testIfArraysAreUnique(selectedItems, value))) {
141
154
  setSelectedItems(value);
@@ -180,7 +193,8 @@ const MultipleCombobox = ({
180
193
  preventKeyAction: isOpen
181
194
  })), {
182
195
  className: "input",
183
- disabled: disabled
196
+ disabled: disabled,
197
+ placeholder: placeholder
184
198
  })), isFetching && /*#__PURE__*/React.createElement(LoadingCircle, {
185
199
  className: "x-main"
186
200
  }), inputValue.length > minLength && !isFetching && /*#__PURE__*/React.createElement(Button, {
@@ -275,7 +289,11 @@ MultipleCombobox.propTypes = {
275
289
  /**
276
290
  * Whether the input is optional or not
277
291
  */
278
- optional: PropTypes.bool
292
+ optional: PropTypes.bool,
293
+ /**
294
+ * The placeholder text for the input
295
+ */
296
+ placeholder: PropTypes.string
279
297
  };
280
298
  MultipleCombobox.defaultProps = {
281
299
  // someProp: false
@@ -1,6 +1,6 @@
1
1
  /* @pareto-engineering/generator-front 1.0.12 */
2
2
  import * as React from 'react';
3
- import { useState, useInsertionEffect, memo } from 'react';
3
+ import { useState, memo } from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import styleNames from '@pareto-engineering/bem/exports';
6
6
 
@@ -8,6 +8,7 @@ import styleNames from '@pareto-engineering/bem/exports';
8
8
 
9
9
  import { Rating } from "./common";
10
10
  import { FormLabel, InputWrapper } from "../../common";
11
+ import "./styles.scss";
11
12
  const baseClassName = styleNames.base;
12
13
  const componentClassName = 'ratings-input';
13
14
 
@@ -34,9 +35,6 @@ const RatingsInput = ({
34
35
  desktopInputSpan
35
36
  // ...otherProps
36
37
  }) => {
37
- useInsertionEffect(() => {
38
- import("./styles.scss");
39
- }, []);
40
38
  const [hover, setHover] = useState(null);
41
39
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormLabel, {
42
40
  name: name,
@@ -1,12 +1,13 @@
1
1
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
  /* @pareto-engineering/generator-front 1.0.12 */
3
3
  import * as React from 'react';
4
- import { useInsertionEffect, memo } from 'react';
4
+ import { memo } from 'react';
5
5
  import { useField } from 'formik';
6
6
  import PropTypes from 'prop-types';
7
7
  import styleNames from '@pareto-engineering/bem/exports';
8
8
  import { LoadingCircle } from "../../../a";
9
9
  import { FormLabel, FormDescription, InputWrapper } from "../../common";
10
+ import "./styles.scss";
10
11
 
11
12
  // Local Definitions
12
13
 
@@ -37,9 +38,6 @@ const SelectInput = ({
37
38
  desktopInputSpan
38
39
  // ...otherProps
39
40
  }) => {
40
- useInsertionEffect(() => {
41
- import("./styles.scss");
42
- }, []);
43
41
  const [field] = useField({
44
42
  name,
45
43
  validate
@@ -1,11 +1,12 @@
1
1
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
  /* @pareto-engineering/generator-front 1.0.12 */
3
3
  import * as React from 'react';
4
- import { useInsertionEffect, memo } from 'react';
4
+ import { memo } from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import styleNames from '@pareto-engineering/bem/exports';
7
7
  import { useField } from 'formik';
8
8
  import { FormLabel, FormDescription, InputWrapper } from "../../common";
9
+ import "./styles.scss";
9
10
 
10
11
  // Local Definitions
11
12
 
@@ -37,9 +38,6 @@ const TextInput = ({
37
38
  symbol,
38
39
  ...otherProps
39
40
  }) => {
40
- useInsertionEffect(() => {
41
- import("./styles.scss");
42
- }, []);
43
41
  const [field] = useField({
44
42
  name,
45
43
  validate
@@ -1,7 +1,7 @@
1
1
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
  /* @pareto-engineering/generator-front 1.0.12 */
3
3
  import * as React from 'react';
4
- import { useInsertionEffect, memo } from 'react';
4
+ import { memo } from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import styleNames from '@pareto-engineering/bem/exports';
7
7
  import { useField } from 'formik';
@@ -9,6 +9,7 @@ import { useField } from 'formik';
9
9
  // Local Definitions
10
10
 
11
11
  import { FormLabel, FormDescription, InputWrapper } from "../../common";
12
+ import "./styles.scss";
12
13
  const baseClassName = styleNames.base;
13
14
  const componentClassName = 'text-area-input';
14
15
 
@@ -37,9 +38,6 @@ const TextareaInput = ({
37
38
  desktopInputSpan
38
39
  // ...otherProps
39
40
  }) => {
40
- useInsertionEffect(() => {
41
- import("./styles.scss");
42
- }, []);
43
41
  const [field] = useField({
44
42
  name,
45
43
  validate
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pareto-engineering/design-system",
3
- "version": "4.0.0-alpha.59",
3
+ "version": "4.0.0-alpha.61",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/es/index.js",
@@ -51,13 +51,14 @@
51
51
  },
52
52
  "dependencies": {
53
53
  "@lexical/react": "^0.11.3",
54
- "@pareto-engineering/assets": "^4.0.0-alpha.59",
54
+ "@pareto-engineering/assets": "^4.0.0-alpha.61",
55
55
  "@pareto-engineering/bem": "^4.0.0-alpha.20",
56
56
  "@pareto-engineering/styles": "^4.0.0-alpha.57",
57
57
  "@pareto-engineering/utils": "^4.0.0-alpha.46",
58
58
  "date-fns": "^2.29.3",
59
59
  "downshift": "^6.1.12",
60
60
  "formik": "^2.2.9",
61
+ "fuse.js": "^7.0.0",
61
62
  "hamburgers": "^1.2.1",
62
63
  "lexical": "^0.11.3",
63
64
  "lodash": "^4.17.21",
@@ -70,5 +71,5 @@
70
71
  "relay-test-utils": "^15.0.0"
71
72
  },
72
73
  "browserslist": "> 2%",
73
- "gitHead": "2d7315603950316a4dc7b8c4a0ccfbc0584e405f"
74
+ "gitHead": "b369858a6dea3f90d666846140b2b2a666850c30"
74
75
  }