@pareto-engineering/design-system 2.0.0-alpha.43 → 2.0.0-alpha.46

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 (89) 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/f/FormInput/FormInput.js +13 -3
  5. package/dist/cjs/f/FormInput/styles.scss +11 -0
  6. package/dist/cjs/f/fields/QueryCombobox/QueryCombobox.js +214 -0
  7. package/dist/cjs/f/fields/QueryCombobox/common/Combobox/Combobox.js +194 -0
  8. package/dist/cjs/f/fields/QueryCombobox/common/Combobox/index.js +15 -0
  9. package/dist/cjs/f/fields/QueryCombobox/common/Menu/Menu.js +103 -0
  10. package/dist/cjs/f/fields/QueryCombobox/common/Menu/index.js +15 -0
  11. package/dist/cjs/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +281 -0
  12. package/dist/cjs/f/fields/QueryCombobox/common/MultipleCombobox/index.js +15 -0
  13. package/dist/cjs/f/fields/QueryCombobox/common/index.js +21 -0
  14. package/dist/cjs/f/fields/QueryCombobox/index.js +15 -0
  15. package/dist/cjs/f/fields/QueryCombobox/styles.scss +84 -0
  16. package/dist/cjs/f/fields/SelectInput/SelectInput.js +0 -1
  17. package/dist/cjs/f/fields/SelectInput/styles.scss +8 -6
  18. package/dist/cjs/f/fields/index.js +9 -1
  19. package/dist/cjs/index.js +13 -0
  20. package/dist/cjs/test/QueryLoader/QueryLoader.js +41 -0
  21. package/dist/cjs/test/QueryLoader/__generated__/QueryLoaderHelloQuery.graphql.js +71 -0
  22. package/dist/cjs/test/QueryLoader/common/PreloadedTestData/PreloadedTestData.js +49 -0
  23. package/dist/cjs/test/QueryLoader/common/PreloadedTestData/index.js +15 -0
  24. package/dist/cjs/test/QueryLoader/common/index.js +13 -0
  25. package/dist/cjs/test/QueryLoader/index.js +15 -0
  26. package/dist/cjs/test/QueryLoader/styles.scss +9 -0
  27. package/dist/cjs/test/index.js +13 -0
  28. package/dist/es/f/FormInput/FormInput.js +13 -3
  29. package/dist/es/f/FormInput/styles.scss +11 -0
  30. package/dist/es/f/fields/QueryCombobox/QueryCombobox.js +191 -0
  31. package/dist/es/f/fields/QueryCombobox/common/Combobox/Combobox.js +174 -0
  32. package/dist/es/f/fields/QueryCombobox/common/Combobox/index.js +2 -0
  33. package/dist/es/f/fields/QueryCombobox/common/Menu/Menu.js +77 -0
  34. package/dist/es/f/fields/QueryCombobox/common/Menu/index.js +2 -0
  35. package/dist/es/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +253 -0
  36. package/dist/es/f/fields/QueryCombobox/common/MultipleCombobox/index.js +2 -0
  37. package/dist/es/f/fields/QueryCombobox/common/index.js +2 -0
  38. package/dist/es/f/fields/QueryCombobox/index.js +2 -0
  39. package/dist/es/f/fields/QueryCombobox/styles.scss +84 -0
  40. package/dist/es/f/fields/SelectInput/SelectInput.js +0 -1
  41. package/dist/es/f/fields/SelectInput/styles.scss +8 -6
  42. package/dist/es/f/fields/index.js +2 -1
  43. package/dist/es/index.js +2 -1
  44. package/dist/es/test/QueryLoader/QueryLoader.js +29 -0
  45. package/dist/es/test/QueryLoader/__generated__/QueryLoaderHelloQuery.graphql.js +71 -0
  46. package/dist/es/test/QueryLoader/common/PreloadedTestData/PreloadedTestData.js +31 -0
  47. package/dist/es/test/QueryLoader/common/PreloadedTestData/index.js +2 -0
  48. package/dist/es/test/QueryLoader/common/index.js +1 -0
  49. package/dist/es/test/QueryLoader/index.js +2 -0
  50. package/dist/es/test/QueryLoader/styles.scss +9 -0
  51. package/dist/es/test/index.js +1 -0
  52. package/package.json +16 -3
  53. package/relay.config.js +12 -0
  54. package/schema.graphql +4075 -0
  55. package/scripts/fetchSchema.js +74 -0
  56. package/src/__snapshots__/Storyshots.test.js.snap +323 -8
  57. package/src/stories/f/FormInput.stories.jsx +115 -0
  58. package/src/stories/f/QueryCombobox.stories.jsx +220 -0
  59. package/src/stories/f/__generated__/FormInputAllTeamsQuery.graphql.js +139 -0
  60. package/src/stories/f/__generated__/QueryComboboxAllTeamsQuery.graphql.js +139 -0
  61. package/src/stories/test/QueryLoader.stories.jsx +36 -0
  62. package/src/stories/utils/generateNodeId.js +12 -0
  63. package/src/stories/utils/relay/EnvironmentProvider.jsx +14 -0
  64. package/src/stories/utils/relay/environment.js +5 -0
  65. package/src/stories/utils/relay/index.js +4 -0
  66. package/src/stories/utils/relay/mockRelayOperation.js +14 -0
  67. package/src/stories/utils/relay/mockResolvers.js +299 -0
  68. package/src/stories/utils/testData.js +63 -0
  69. package/src/ui/f/FormInput/FormInput.jsx +16 -1
  70. package/src/ui/f/FormInput/styles.scss +11 -0
  71. package/src/ui/f/fields/QueryCombobox/QueryCombobox.jsx +207 -0
  72. package/src/ui/f/fields/QueryCombobox/common/Combobox/Combobox.jsx +214 -0
  73. package/src/ui/f/fields/QueryCombobox/common/Combobox/index.js +2 -0
  74. package/src/ui/f/fields/QueryCombobox/common/Menu/Menu.jsx +103 -0
  75. package/src/ui/f/fields/QueryCombobox/common/Menu/index.js +2 -0
  76. package/src/ui/f/fields/QueryCombobox/common/index.js +2 -0
  77. package/src/ui/f/fields/QueryCombobox/index.js +2 -0
  78. package/src/ui/f/fields/QueryCombobox/styles.scss +84 -0
  79. package/src/ui/f/fields/SelectInput/SelectInput.jsx +1 -1
  80. package/src/ui/f/fields/SelectInput/styles.scss +8 -6
  81. package/src/ui/f/fields/index.js +1 -0
  82. package/src/ui/index.js +1 -0
  83. package/src/ui/test/QueryLoader/QueryLoader.jsx +41 -0
  84. package/src/ui/test/QueryLoader/__generated__/QueryLoaderHelloQuery.graphql.js +68 -0
  85. package/src/ui/test/QueryLoader/common/PreloadedTestData/PreloadedTestData.jsx +51 -0
  86. package/src/ui/test/QueryLoader/common/PreloadedTestData/index.js +2 -0
  87. package/src/ui/test/QueryLoader/common/index.js +1 -0
  88. package/src/ui/test/QueryLoader/index.js +2 -0
  89. package/src/ui/test/index.js +1 -0
@@ -0,0 +1,214 @@
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
+ error,
37
+ description,
38
+ value,
39
+ color,
40
+ loadingCircleColor,
41
+ isFetching,
42
+ // ...otherProps
43
+ }) => {
44
+ const {
45
+ isOpen,
46
+ selectItem,
47
+ selectedItem,
48
+ getLabelProps,
49
+ getMenuProps,
50
+ getInputProps,
51
+ highlightedIndex,
52
+ getComboboxProps,
53
+ getItemProps,
54
+ } = useCombobox({
55
+ items,
56
+ initialSelectedItem:value,
57
+ itemToString :(item) => (item ? item.label : ''),
58
+ onInputValueChange :({ inputValue }) => {
59
+ getOptions(inputValue)
60
+ },
61
+ })
62
+
63
+ // If the user has selected an item, we'll set the value of the field
64
+ // or if the combobox state has a selected item, we'll set the value to the formik state
65
+ useEffect(() => {
66
+ if (selectedItem) {
67
+ setValue(selectedItem)
68
+ }
69
+ }, [selectedItem])
70
+
71
+ // If the formik state has a value, we'll set the selected item to the combobox state
72
+ useEffect(() => {
73
+ if (value?.value !== selectedItem?.value) {
74
+ selectItem(value)
75
+ }
76
+ }, [value])
77
+
78
+ const parentRef = useRef(null)
79
+
80
+ return (
81
+ <div
82
+ id={id}
83
+ className={[
84
+
85
+ baseClassName,
86
+
87
+ componentClassName,
88
+ userClassName,
89
+ `y-${color}`,
90
+ `x-${loadingCircleColor}`,
91
+ ]
92
+ .filter((e) => e)
93
+ .join(' ')}
94
+ style={style}
95
+ ref={parentRef}
96
+ >
97
+ <FormLabel {...getLabelProps()} name={name}>
98
+ {label}
99
+ </FormLabel>
100
+
101
+ <div {...getComboboxProps()} className="input-wrapper">
102
+ <input {...getInputProps()} className="input" />
103
+ {isFetching && (
104
+ <LoadingCircle />
105
+ )}
106
+ </div>
107
+
108
+ <Popover
109
+ isOpen={isOpen}
110
+ parentRef={parentRef}
111
+ >
112
+ <Menu
113
+ isOpen={isOpen}
114
+ getItemProps={getItemProps}
115
+ highlightedIndex={highlightedIndex}
116
+ items={items}
117
+ {...getMenuProps()}
118
+ />
119
+ </Popover>
120
+
121
+ {(description || error) && (
122
+ <FormDescription isError={!!error}>
123
+ { error || description }
124
+ </FormDescription>
125
+ )}
126
+ </div>
127
+ )
128
+ }
129
+
130
+ Combobox.propTypes = {
131
+ /**
132
+ * The HTML id for this element
133
+ */
134
+ id:PropTypes.string,
135
+
136
+ /**
137
+ * The HTML class names for this element
138
+ */
139
+ className:PropTypes.string,
140
+
141
+ /**
142
+ * The React-written, css properties for this element.
143
+ */
144
+ style:PropTypes.objectOf(PropTypes.string),
145
+
146
+ /**
147
+ * The label of the custom select input
148
+ */
149
+ label:PropTypes.string,
150
+
151
+ /**
152
+ * The custom select input options from the backend
153
+ */
154
+ options:PropTypes.arrayOf(
155
+ PropTypes.shape({
156
+ value:PropTypes.string,
157
+ label:PropTypes.string,
158
+ }),
159
+ ),
160
+
161
+ /**
162
+ * The name of the custom select input
163
+ */
164
+ name:PropTypes.string,
165
+
166
+ /**
167
+ * The function to fetch the options from the backend
168
+ */
169
+ getOptions:PropTypes.func,
170
+
171
+ /**
172
+ * The function to set the value of the custom select input
173
+ */
174
+ setValue:PropTypes.func.isRequired,
175
+
176
+ /**
177
+ * The custom select input description
178
+ */
179
+ description:PropTypes.string,
180
+
181
+ /**
182
+ * The error object
183
+ */
184
+ error:PropTypes.objectOf(PropTypes.string),
185
+
186
+ /**
187
+ * The value of the custom select input
188
+ */
189
+ value:PropTypes.shape({
190
+ value:PropTypes.string,
191
+ label:PropTypes.string,
192
+ }),
193
+
194
+ /**
195
+ * The base color of the combobox custom select input
196
+ */
197
+ color:PropTypes.string,
198
+
199
+ /**
200
+ * Whether the query getting the combobox options is inFlight
201
+ */
202
+ isFetching:PropTypes.bool.isRequired,
203
+
204
+ /**
205
+ * The loading circle color
206
+ */
207
+ loadingCircleColor:PropTypes.string,
208
+ }
209
+
210
+ Combobox.defaultProps = {
211
+ loadingCircleColor:'main2',
212
+ }
213
+
214
+ 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'
@@ -0,0 +1,2 @@
1
+ export { Menu } from './Menu'
2
+ export { Combobox } from './Combobox'
@@ -0,0 +1,2 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ export { default as QueryCombobox } from './QueryCombobox'
@@ -0,0 +1,84 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+
3
+ @use "@pareto-engineering/bem";
4
+
5
+ $default-input-padding: .75em .75em .55em;
6
+ $default-padding: 1em;
7
+ $default-margin: 1em;
8
+ $default-loading-circle-displacement: 1em;
9
+
10
+ .#{bem.$base}.combobox,
11
+ .#{bem.$base}.multiple-combobox {
12
+ position: relative;
13
+
14
+ .#{bem.$base}.label {
15
+ margin-bottom: $default-margin
16
+ }
17
+
18
+ .#{bem.$base}.popover {
19
+ width: 100%;
20
+
21
+ >.menu {
22
+ list-style: none;
23
+ margin: 0;
24
+ outline: 0;
25
+ padding: 0;
26
+
27
+ >.item {
28
+ padding: $default-padding / 2;
29
+
30
+ &.#{bem.$modifier-active} {
31
+ background-color: var(--background2);
32
+ }
33
+ }
34
+ }
35
+ }
36
+
37
+ >.input-wrapper {
38
+ position: relative;
39
+
40
+ >.#{bem.$base}.loading-circle {
41
+ position: absolute;
42
+ top: $default-loading-circle-displacement;
43
+ right: $default-loading-circle-displacement;
44
+ }
45
+
46
+ >.input {
47
+ background: var(--light-y);
48
+ border: var(--theme-border-style) var(--dark-y);
49
+ color: var(--on-y);
50
+ padding: $default-input-padding;
51
+ width: 100%;
52
+
53
+ &::placeholder {
54
+ color: var(--metadata);
55
+ }
56
+
57
+ &:not(:disabled):hover {
58
+ border: var(--theme-border-style) var(--light-background4);
59
+ }
60
+
61
+ &:disabled {
62
+ background-color: var(--dark-y);
63
+ }
64
+
65
+ &:focus {
66
+ background: var(--light-background4);
67
+ }
68
+ }
69
+ }
70
+ }
71
+
72
+
73
+ .#{bem.$base}.multiple-combobox {
74
+ >.selected-items {
75
+ display: flex;
76
+
77
+ /* stylelint-disable selector-max-universal -- Allow */
78
+ >*:not(:first-child) {
79
+ margin-left: $default-margin;
80
+ }
81
+
82
+ /* stylelint-enable selector-max-universal */
83
+ }
84
+ }
@@ -55,7 +55,7 @@ const SelectInput = ({
55
55
  style={style}
56
56
  // {...otherProps}
57
57
  >
58
- <FormLabel className="input-label" name={name}>{label}</FormLabel>
58
+ <FormLabel name={name}>{label}</FormLabel>
59
59
  <select className="input" {...field} value={field.value || ''} id={name} disabled={disabled}>
60
60
  {
61
61
  options.map((option) => {
@@ -6,24 +6,27 @@
6
6
 
7
7
 
8
8
  $default-padding: 0.75em;
9
-
9
+ $default-margin: 1em;
10
10
 
11
11
  .#{bem.$base}.select-input {
12
12
  display: flex;
13
13
  flex-direction: column;
14
14
 
15
+ .#{bem.$base}.label {
16
+ margin-bottom: $default-margin
17
+ }
15
18
 
16
19
  .input {
17
20
  border: var(--theme-border-style) var(--dark-y);
18
21
  background: var(--light-y);
19
- color:var(--on-y);
22
+ color: var(--on-y);
20
23
  padding: $default-padding;
21
24
 
22
- &:not(:disabled):hover{
25
+ &:not(:disabled):hover {
23
26
  border: var(--theme-border-style) var(--light-background4);
24
27
  }
25
28
 
26
- &:disabled {
29
+ &:disabled {
27
30
  background-color: var(--dark-y);
28
31
  }
29
32
 
@@ -31,5 +34,4 @@ $default-padding: 0.75em;
31
34
  background: var(--y);
32
35
  }
33
36
  }
34
- }
35
-
37
+ }
@@ -3,3 +3,4 @@ export { SelectInput } from './SelectInput'
3
3
  export { ChoicesInput } from './ChoicesInput'
4
4
  export { TextareaInput } from './TextareaInput'
5
5
  export { RatingsInput } from './RatingsInput'
6
+ export { QueryCombobox } from './QueryCombobox'
package/src/ui/index.js CHANGED
@@ -5,3 +5,4 @@ export * from './c'
5
5
  export * from './d'
6
6
  export * from './f'
7
7
  export * from './utils'
8
+ export * from './test'
@@ -0,0 +1,41 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ import * as React from 'react'
3
+
4
+ import { useEffect, Suspense } from 'react'
5
+
6
+ import { useQueryLoader } from 'react-relay'
7
+
8
+ // Local Definitions
9
+
10
+ import { PreloadedTestData } from './common'
11
+
12
+ const testQuery = graphql`
13
+ query QueryLoaderHelloQuery {
14
+ hello
15
+ }
16
+ `
17
+
18
+ /**
19
+ * This is the component description.
20
+ */
21
+ const QueryLoader = () => {
22
+ const [queryReference, loadQuery] = useQueryLoader(testQuery)
23
+
24
+ useEffect(() => {
25
+ loadQuery({})
26
+ }, [])
27
+
28
+ return (
29
+ <Suspense fallback="loading">
30
+ {queryReference ? (
31
+ <PreloadedTestData queryReference={queryReference} query={testQuery} />
32
+ ) : null}
33
+ </Suspense>
34
+ )
35
+ }
36
+
37
+ QueryLoader.defaultProps = {
38
+ // someProp:false
39
+ }
40
+
41
+ export default QueryLoader
@@ -0,0 +1,68 @@
1
+ /**
2
+ * @flow
3
+ */
4
+
5
+ /* eslint-disable */
6
+
7
+ 'use strict';
8
+
9
+ /*::
10
+ import type { ConcreteRequest } from 'relay-runtime';
11
+ export type QueryLoaderHelloQueryVariables = {||};
12
+ export type QueryLoaderHelloQueryResponse = {|
13
+ +hello: ?string
14
+ |};
15
+ export type QueryLoaderHelloQuery = {|
16
+ variables: QueryLoaderHelloQueryVariables,
17
+ response: QueryLoaderHelloQueryResponse,
18
+ |};
19
+ */
20
+
21
+
22
+ /*
23
+ query QueryLoaderHelloQuery {
24
+ hello
25
+ }
26
+ */
27
+
28
+ const node/*: ConcreteRequest*/ = (function(){
29
+ var v0 = [
30
+ {
31
+ "alias": null,
32
+ "args": null,
33
+ "kind": "ScalarField",
34
+ "name": "hello",
35
+ "storageKey": null
36
+ }
37
+ ];
38
+ return {
39
+ "fragment": {
40
+ "argumentDefinitions": [],
41
+ "kind": "Fragment",
42
+ "metadata": null,
43
+ "name": "QueryLoaderHelloQuery",
44
+ "selections": (v0/*: any*/),
45
+ "type": "Query",
46
+ "abstractKey": null
47
+ },
48
+ "kind": "Request",
49
+ "operation": {
50
+ "argumentDefinitions": [],
51
+ "kind": "Operation",
52
+ "name": "QueryLoaderHelloQuery",
53
+ "selections": (v0/*: any*/)
54
+ },
55
+ "params": {
56
+ "cacheID": "463f9ee8a82dd6ec8dedeb28649cce74",
57
+ "id": null,
58
+ "metadata": {},
59
+ "name": "QueryLoaderHelloQuery",
60
+ "operationKind": "query",
61
+ "text": "query QueryLoaderHelloQuery {\n hello\n}\n"
62
+ }
63
+ };
64
+ })();
65
+ // prettier-ignore
66
+ (node/*: any*/).hash = 'b92d001ab0208bd484a99f77c274d5ef';
67
+
68
+ module.exports = node;
@@ -0,0 +1,51 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ import * as React from 'react'
3
+
4
+ import PropTypes from 'prop-types'
5
+
6
+ import { usePreloadedQuery } from 'react-relay'
7
+
8
+ /**
9
+ * This is the component description.
10
+ */
11
+ const PreloadedTestData = ({
12
+ query,
13
+ queryReference,
14
+ // ...otherProps
15
+ }) => {
16
+ const data = usePreloadedQuery(query, queryReference)
17
+
18
+ return (
19
+ <pre>
20
+ {JSON.stringify(data, null, 2)}
21
+ </pre>
22
+ )
23
+ }
24
+
25
+ PreloadedTestData.propTypes = {
26
+ /**
27
+ * The query to be used to query the test data
28
+ */
29
+ query:PropTypes.objectOf(
30
+ PropTypes.PropTypes.oneOfType([
31
+ PropTypes.string,
32
+ PropTypes.object,
33
+ ]),
34
+ ),
35
+
36
+ /**
37
+ * The query reference to be used to access the preloaded data
38
+ */
39
+ queryReference:PropTypes.objectOf(
40
+ PropTypes.PropTypes.oneOfType([
41
+ PropTypes.string,
42
+ PropTypes.object,
43
+ ]),
44
+ ),
45
+ }
46
+
47
+ PreloadedTestData.defaultProps = {
48
+ // someProp:false
49
+ }
50
+
51
+ export default PreloadedTestData
@@ -0,0 +1,2 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ export { default as PreloadedTestData } from './PreloadedTestData'
@@ -0,0 +1 @@
1
+ export { PreloadedTestData } from './PreloadedTestData'
@@ -0,0 +1,2 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ export { default as QueryLoader } from './QueryLoader'
@@ -0,0 +1 @@
1
+ export { QueryLoader } from './QueryLoader'