@scenid/react-formulator 0.5.2 → 0.5.4

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 (64) hide show
  1. package/dist/index.cjs.js +34 -19
  2. package/dist/index.esm.js +34 -19
  3. package/package.json +4 -1
  4. package/.babelrc +0 -30
  5. package/.eslintignore +0 -22
  6. package/.eslintrc +0 -70
  7. package/.firebaserc +0 -5
  8. package/.storybook/main.js +0 -12
  9. package/.storybook/preview.js +0 -9
  10. package/firebase.json +0 -22
  11. package/functions/.eslintignore +0 -1
  12. package/functions/.eslintrc.js +0 -29
  13. package/functions/index.js +0 -32
  14. package/functions/package-lock.json +0 -6810
  15. package/functions/package.json +0 -29
  16. package/rollup.config.js +0 -40
  17. package/src/Components/HiddenData.jsx +0 -24
  18. package/src/Components/SelectOrCreate.jsx +0 -156
  19. package/src/Editable/FormAutocomplete/FormAutocomplete.jsx +0 -164
  20. package/src/Editable/FormAutocomplete/useFetchOptions.js +0 -83
  21. package/src/Editable/FormBoolean.jsx +0 -46
  22. package/src/Editable/FormCatalogType.jsx +0 -29
  23. package/src/Editable/FormField.jsx +0 -231
  24. package/src/Editable/FormNumber.jsx +0 -36
  25. package/src/Editable/FormRepeater.jsx +0 -218
  26. package/src/Editable/FormSelect.jsx +0 -52
  27. package/src/Editable/FormText.jsx +0 -20
  28. package/src/FormGroupHeader.jsx +0 -85
  29. package/src/FormHelpers.js +0 -191
  30. package/src/FormSectionBlock.jsx +0 -71
  31. package/src/FormSectionCard.jsx +0 -62
  32. package/src/FormulatorForm.jsx +0 -539
  33. package/src/FormulatorFormSection.jsx +0 -457
  34. package/src/ReadOnly/FormReadOnlyBoolean.jsx +0 -36
  35. package/src/ReadOnly/FormReadOnlyField.jsx +0 -126
  36. package/src/ReadOnly/FormReadOnlyMarkdown.jsx +0 -20
  37. package/src/ReadOnly/FormReadOnlyNumber.jsx +0 -17
  38. package/src/ReadOnly/FormReadOnlyRepeater.jsx +0 -36
  39. package/src/ReadOnly/FormReadOnlySelect.jsx +0 -18
  40. package/src/ReadOnly/FormReadOnlyText.jsx +0 -41
  41. package/src/helpers.js +0 -13
  42. package/src/index.js +0 -20
  43. package/stories/CustomRenderField.jsx +0 -46
  44. package/stories/Forms.stories.jsx +0 -267
  45. package/stories/Introduction.stories.mdx +0 -206
  46. package/stories/StoryBase.jsx +0 -35
  47. package/stories/assets/code-brackets.svg +0 -1
  48. package/stories/assets/colors.svg +0 -1
  49. package/stories/assets/comments.svg +0 -1
  50. package/stories/assets/direction.svg +0 -1
  51. package/stories/assets/flow.svg +0 -1
  52. package/stories/assets/plugin.svg +0 -1
  53. package/stories/assets/repo.svg +0 -1
  54. package/stories/assets/stackalt.svg +0 -1
  55. package/stories/forms/login.render.schema.json +0 -23
  56. package/stories/forms/login.validation.schema.json +0 -29
  57. package/stories/forms/markdown.render.schema.json +0 -30
  58. package/stories/forms/markdown.validation.schema.json +0 -18
  59. package/stories/forms/register.render.schema.json +0 -32
  60. package/stories/forms/register.validation.schema.json +0 -34
  61. package/stories/forms/rlp.render.schema.json +0 -153
  62. package/stories/forms/rlp.translations.json +0 -883
  63. package/stories/forms/rlp.validation.schema.json +0 -1631
  64. package/stories/forms/types.schemas.js +0 -319
@@ -1,457 +0,0 @@
1
- import React from 'react'
2
- import PropTypes from 'prop-types'
3
-
4
- import { Input } from '@material-ui/core'
5
-
6
- import { render as mm } from 'micromustache'
7
-
8
- import FormSectionCard from './FormSectionCard'
9
- import FormSectionBlock from './FormSectionBlock'
10
-
11
- import FormField from './Editable/FormField'
12
- import FormText from './Editable/FormText'
13
- import FormNumber from './Editable/FormNumber'
14
- import FormCatalogType from './Editable/FormCatalogType'
15
- import FormBoolean from './Editable/FormBoolean'
16
- import FormRepeater from './Editable/FormRepeater'
17
-
18
- import FormReadOnlyField from './ReadOnly/FormReadOnlyField'
19
- import FormReadOnlyText from './ReadOnly/FormReadOnlyText'
20
- import FormMarkdown from './ReadOnly/FormReadOnlyMarkdown'
21
- import FormReadOnlyNumber from './ReadOnly/FormReadOnlyNumber'
22
- import FormReadOnlySelect from './ReadOnly/FormReadOnlySelect'
23
- import FormReadOnlyBoolean from './ReadOnly/FormReadOnlyBoolean'
24
- import FormReadOnlyRepeater from './ReadOnly/FormReadOnlyRepeater'
25
-
26
- import HiddenData from './Components/HiddenData'
27
-
28
- const formReadOnlyComponentMap = {
29
- default: FormReadOnlyText,
30
- markdown: FormMarkdown,
31
- string: FormReadOnlyText,
32
- number: FormReadOnlyNumber,
33
- select: FormReadOnlySelect,
34
- boolean: FormReadOnlyBoolean,
35
- array: FormReadOnlyRepeater
36
- }
37
-
38
- const formComponentMap = {
39
- default: FormText,
40
- string: FormText,
41
- number: FormNumber,
42
- select: FormCatalogType,
43
- boolean: FormBoolean,
44
- array: FormRepeater
45
- }
46
-
47
- const apComponentMap = {
48
- default: Input,
49
- string: Input,
50
- number: FormNumber,
51
- select: FormCatalogType,
52
- boolean: FormBoolean
53
- }
54
-
55
- class FormulatorFormSection extends React.Component {
56
- getFieldProps(fieldEntry, componentMap) {
57
- const {
58
- schema,
59
- translations,
60
- errorMessages,
61
- results,
62
- data,
63
- fieldStates,
64
- renderComponentMap
65
- } = this.props
66
-
67
- let field = fieldEntry, isRender = false, specialProps = {}
68
- if (Array.isArray(fieldEntry)) {
69
- if (fieldEntry[0] === '@@markdown') {
70
- return ({
71
- type: 'markdown',
72
- name: fieldEntry[1],
73
- component: formReadOnlyComponentMap.markdown,
74
- componentProps: {
75
- content: fieldEntry[2]
76
- }
77
- })
78
- }
79
-
80
- if (fieldEntry[0] === '@@render') {
81
- if (!fieldEntry[1]) throw new Error(`render field "${field}" has no name`)
82
- field = fieldEntry[1]
83
- specialProps = fieldEntry[2] || {}
84
- isRender = true
85
- } else {
86
- field = fieldEntry[0]
87
- if (!fieldEntry[1]) throw new Error(`field "${field}" is defined in an array, but has no props definition`)
88
- specialProps = fieldEntry[1]
89
- }
90
- }
91
-
92
- const { hidden, hideLabel, ...extraProps } = specialProps
93
-
94
- if (hidden === true) return false
95
-
96
- const fieldResult = results[field]
97
- const { prohibited, required, optional, hasErrors, errors, data: fieldData } = fieldResult
98
- if (prohibited === true || (!required && !optional && fieldData === undefined)) return false
99
-
100
- const { type, default: defaultValue } = schema.properties[field]
101
-
102
- let mapKey
103
- if (isRender) mapKey = '@@render'
104
- else if (componentMap[field] !== undefined) mapKey = field
105
- else if (typeof type === 'string' && componentMap[type] !== undefined) mapKey = type
106
- else if (Array.isArray(type)) mapKey = 'select'
107
- else if (componentMap.default !== undefined) mapKey = 'default'
108
- else throw new Error(`Could not find a Component to render for "${field}"`)
109
-
110
- const mapEntry = isRender ? renderComponentMap[field] : componentMap[mapKey]
111
- let component = mapEntry, props = {}
112
-
113
- console.log(schema.properties, fieldEntry)
114
- if (mapKey === 'array' && schema.properties[fieldEntry].options) {
115
- props.options = (
116
- schema.properties[fieldEntry].options
117
- .reduce((l, r) => ({
118
- ...l,
119
- [r]: translations?.[fieldEntry]?.[r] || r
120
- }), {})
121
- )
122
- }
123
-
124
- if (mapKey === 'select') {
125
- props.options = (
126
- type.map(value => ({
127
- label: translations?.field?.value || value,
128
- value
129
- }))
130
- )
131
- }
132
-
133
- if (Array.isArray(mapEntry)) {
134
- /* eslint-disable prefer-destructuring */
135
- component = mapEntry[0]
136
- props = mapEntry[1]
137
- /* eslint-enable prefer-destructuring */
138
- }
139
-
140
- if (!component) throw new Error(`could not find component for field "${field}"`)
141
-
142
- return {
143
- type: isRender ? '@@render' : mapKey,
144
- name: field,
145
- label: hideLabel !== true && ((translations.labels && translations.labels[field]) || field),
146
- defaultValue,
147
- component,
148
- componentProps: extraProps,
149
- value: data[field],
150
- required,
151
- hasErrors,
152
- errors: errors.map(({ message, options, validator: eVal, ...restError }) => {
153
- let finalMessage = message
154
-
155
- if (options && options.human) finalMessage = options.human
156
- else if (errorMessages[eVal]) finalMessage = mm(errorMessages[eVal], options)
157
-
158
- return ({
159
- message: finalMessage,
160
- options,
161
- validator: eVal,
162
- ...restError
163
- })
164
- }),
165
- ...props,
166
- ...fieldStates[field]
167
- }
168
- }
169
-
170
- getSectionContent() {
171
- const {
172
- id,
173
- variant,
174
- inputVariant,
175
- readOnly,
176
- nested = 0,
177
- schema,
178
- fields,
179
- obscuredFields,
180
- results,
181
- data,
182
- fieldStates,
183
- translations,
184
- renderComponentMap,
185
- errorMessages,
186
- onChange,
187
- disabled
188
- } = this.props
189
-
190
- const allFieldProps = (
191
- fields
192
- .filter(f => typeof f === 'string' || Array.isArray(f))
193
- .map(fieldEntry => this.getFieldProps(fieldEntry, readOnly ? formReadOnlyComponentMap : formComponentMap))
194
- )
195
-
196
- return (
197
- Array.isArray(fields)
198
- && (
199
- fields.map((fieldEntry, fieldIndex) => {
200
- if (fieldEntry === false) return false
201
-
202
- if (typeof fieldEntry !== 'string' && !Array.isArray(fieldEntry)) {
203
- return (
204
- <FormulatorFormSection
205
- key={`form-section-${fieldEntry.id}`}
206
- variant={variant}
207
- inputVariant={inputVariant}
208
- readOnly={readOnly}
209
- id={fieldEntry.id}
210
- nested={nested + 1}
211
- sectionId={fieldEntry.id}
212
- schema={schema}
213
- label={fieldEntry.label}
214
- fields={fieldEntry.fields}
215
- results={results}
216
- data={data}
217
- obscuredFields={obscuredFields}
218
- fieldStates={fieldStates}
219
- translations={translations}
220
- errorMessages={errorMessages}
221
- renderComponentMap={renderComponentMap}
222
- onChange={onChange}
223
- disabled={disabled}
224
- />
225
- )
226
- }
227
-
228
- if (Array.isArray(fieldEntry) && (fieldEntry[1].appends || fieldEntry[1].prepends)) return false
229
-
230
- const fieldProps = allFieldProps[fieldIndex]
231
- if (!fieldProps) return false
232
-
233
- const {
234
- type,
235
- name,
236
- component,
237
- componentProps,
238
- label,
239
- value,
240
- defaultValue,
241
- options,
242
- required,
243
- hasErrors,
244
- errors,
245
- validating,
246
- dirty
247
- } = fieldProps
248
-
249
- if (readOnly) {
250
- if (!value) return false
251
- if (Array.isArray(obscuredFields) && obscuredFields.includes(name)) {
252
- return <HiddenData key={`hidden-field-${name}`} subject="Das Feld" label={label} />
253
- }
254
- }
255
-
256
- const apProps = {}
257
-
258
- for (let i = 0; i < fields.length; i++) {
259
- const apField = fields[i]
260
-
261
- if (Array.isArray(apField) && apField[1].appends && apField[1].appends === name) {
262
- if (!apProps.append) apProps.append = []
263
- const aProps = this.getFieldProps(apField, apComponentMap)
264
-
265
- apProps.append.push(
266
- React.createElement(
267
- aProps.component,
268
- {
269
- key: `form-field-${name}-append-${aProps.name}`,
270
- variant: inputVariant,
271
- disabled,
272
- onChange,
273
- ...aProps
274
- }
275
- )
276
- )
277
- }
278
-
279
- if (Array.isArray(apField) && apField[1].prepends && apField[1].prepends === name) {
280
- if (!apProps.prepend) apProps.prepend = []
281
- const aProps = this.getFieldProps(apField, apComponentMap)
282
-
283
- apProps.prepend.push(
284
- React.createElement(
285
- aProps.component,
286
- {
287
- key: `form-field-${name}-append-${aProps.name}`,
288
- variant: inputVariant,
289
- disabled,
290
- onChange,
291
- ...aProps
292
- }
293
- )
294
- )
295
- }
296
- }
297
-
298
- const FormFieldComponent = readOnly ? FormReadOnlyField : FormField
299
-
300
- return (
301
- React.createElement(
302
- FormFieldComponent,
303
- {
304
- key: `form-${id}-${name}`,
305
- variant: inputVariant,
306
- type,
307
- name,
308
- label,
309
- defaultValue,
310
- value,
311
- options,
312
- required,
313
- hasErrors,
314
- errors,
315
- validating,
316
- dirty,
317
- component,
318
- componentProps,
319
- prepend: apProps.prepend,
320
- append: apProps.append,
321
- disabled,
322
- onChange
323
- }
324
- )
325
- )
326
- })
327
- )
328
- )
329
- }
330
-
331
- render() {
332
- const {
333
- variant,
334
- readOnly,
335
- nested = 0,
336
- sectionId,
337
- label,
338
- labelVariant,
339
- desc,
340
- descVariant,
341
- textAlign,
342
- fields
343
- } = this.props
344
-
345
- const allFieldProps = (
346
- fields
347
- .filter(f => typeof f === 'string' || Array.isArray(f))
348
- .map(fieldEntry => this.getFieldProps(fieldEntry, readOnly ? formReadOnlyComponentMap : formComponentMap))
349
- )
350
-
351
- const renderableFields = allFieldProps.filter(fp => {
352
- if (
353
- Array.isArray(fp)
354
- && (
355
- fp[0] === '@@render'
356
- || fp[0] === '@@markdown'
357
- )
358
- ) return false
359
-
360
- return fp !== false
361
- })
362
-
363
- if (renderableFields.length === 0) return false
364
-
365
- const sectionContent = this.getSectionContent()
366
-
367
- if (readOnly && sectionContent.every(c => c === false)) return false
368
-
369
- if (nested === 0) {
370
- const FormSection = variant === 'card' ? FormSectionCard : FormSectionBlock
371
-
372
- return (
373
- React.createElement(
374
- FormSection,
375
- {
376
- key: `form-section-${sectionId}`,
377
- groupId: sectionId,
378
- label,
379
- labelVariant,
380
- desc,
381
- descVariant,
382
- textAlign
383
- },
384
- sectionContent
385
- )
386
- )
387
- }
388
-
389
- return (
390
- <FormSectionBlock
391
- key={`form-section-${sectionId}`}
392
- label={label}
393
- labelVariant={labelVariant}
394
- desc={desc}
395
- descVariant={descVariant}
396
- textAlign={textAlign}
397
- >
398
- {sectionContent}
399
- </FormSectionBlock>
400
- )
401
- }
402
- }
403
-
404
- FormulatorFormSection.propTypes = {
405
- id: PropTypes.string.isRequired,
406
- variant: PropTypes.string.isRequired,
407
- inputVariant: PropTypes.oneOf(['standard', 'filled', 'outlined']),
408
- label: PropTypes.string,
409
- desc: PropTypes.string,
410
- labelVariant: PropTypes.oneOf([
411
- 'h1',
412
- 'h2',
413
- 'h3',
414
- 'h4',
415
- 'h5',
416
- 'h6',
417
- 'subtitle1',
418
- 'subtitle2',
419
- 'body1',
420
- 'body2',
421
- 'button',
422
- 'caption',
423
- 'overline'
424
- ]),
425
- descVariant: PropTypes.oneOf([
426
- 'h1',
427
- 'h2',
428
- 'h3',
429
- 'h4',
430
- 'h5',
431
- 'h6',
432
- 'subtitle1',
433
- 'subtitle2',
434
- 'body1',
435
- 'body2',
436
- 'button',
437
- 'caption',
438
- 'overline'
439
- ]),
440
- textAlign: PropTypes.oneOf(['left', 'center', 'right']),
441
- disabled: PropTypes.bool,
442
- readOnly: PropTypes.bool,
443
- nested: PropTypes.number,
444
- sectionId: PropTypes.string.isRequired,
445
- fields: PropTypes.array.isRequired,
446
- obscuredFields: PropTypes.array,
447
- schema: PropTypes.object.isRequired,
448
- results: PropTypes.object.isRequired,
449
- data: PropTypes.object.isRequired,
450
- fieldStates: PropTypes.object.isRequired,
451
- translations: PropTypes.object.isRequired,
452
- errorMessages: PropTypes.object.isRequired,
453
- renderComponentMap: PropTypes.object,
454
- onChange: PropTypes.func.isRequired
455
- }
456
-
457
- export default FormulatorFormSection
@@ -1,36 +0,0 @@
1
- import React from 'react'
2
- import PropTypes from 'prop-types'
3
-
4
- import { Checkbox, Switch } from '@material-ui/core'
5
-
6
- const isBoolean = val => val === false || val === true
7
- const isChecked = (value, defaultValue) => isBoolean(value) ? value : (defaultValue || false)
8
-
9
- const FormReadOnlyBoolean = ({ variant, name, value, defaultValue }) => {
10
- if (variant === 'checkbox') {
11
- return (
12
- <Checkbox
13
- name={name}
14
- checked={isChecked(value, defaultValue)}
15
- disabled
16
- />
17
- )
18
- }
19
-
20
- return (
21
- <Switch
22
- name={name}
23
- checked={isChecked(value, defaultValue)}
24
- disabled
25
- />
26
- )
27
- }
28
-
29
- FormReadOnlyBoolean.propTypes = {
30
- variant: PropTypes.string,
31
- name: PropTypes.string.isRequired,
32
- value: PropTypes.bool,
33
- defaultValue: PropTypes.bool
34
- }
35
-
36
- export default FormReadOnlyBoolean
@@ -1,126 +0,0 @@
1
- import React from 'react'
2
- import PropTypes from 'prop-types'
3
-
4
- import { Typography, Box } from '@material-ui/core'
5
-
6
- const FormControlField = ({
7
- type,
8
- name,
9
- label,
10
- component,
11
- componentProps,
12
- value,
13
- options,
14
- required
15
- }) => {
16
- const finalProps = {
17
- ...componentProps,
18
- name,
19
- label,
20
- value,
21
- options,
22
- required,
23
- readOnly: true
24
- }
25
-
26
- if (componentProps?.readOnlyHidden === true) {
27
- return false
28
- }
29
-
30
- let control
31
- if (type === '@@render') control = React.cloneElement(component, finalProps)
32
- else control = React.createElement(component, finalProps)
33
-
34
- return (
35
- <Box
36
- width="100%"
37
- display="flex"
38
- flexDirection="column"
39
- mb={1.5}
40
- >
41
- {
42
- label
43
- && (
44
- <Typography
45
- variant="caption"
46
- color="textSecondary"
47
- >
48
- {label}
49
- </Typography>
50
- )
51
- }
52
- {control}
53
- </Box>
54
- )
55
- }
56
-
57
- FormControlField.propTypes = {
58
- component: PropTypes.any.isRequired,
59
- componentProps: PropTypes.object,
60
- name: PropTypes.string.isRequired,
61
- type: PropTypes.string.isRequired,
62
- label: PropTypes.string.isRequired,
63
- value: PropTypes.oneOfType([
64
- PropTypes.string,
65
- PropTypes.number,
66
- PropTypes.bool,
67
- PropTypes.array
68
- ]),
69
- options: PropTypes.arrayOf(PropTypes.shape({
70
- label: PropTypes.string.isRequired,
71
- value: PropTypes.any
72
- })),
73
- required: PropTypes.bool
74
- }
75
-
76
- FormControlField.defaultProps = {
77
- componentProps: {}
78
- }
79
-
80
- const FormReadOnlyField = ({
81
- prepend,
82
- append,
83
- componentProps,
84
- ...fieldProps
85
- }) => {
86
- const finalProps = {
87
- componentProps,
88
- ...fieldProps
89
- }
90
-
91
- if (componentProps?.type === 'hidden') {
92
- return <input type="hidden" name={fieldProps.name} value={fieldProps.value} />
93
- }
94
-
95
- return (
96
- // eslint-disable-next-line react/jsx-props-no-spreading
97
- <FormControlField {...finalProps} />
98
- )
99
- }
100
-
101
- FormReadOnlyField.propTypes = {
102
- component: PropTypes.any.isRequired,
103
- componentProps: PropTypes.object,
104
- type: PropTypes.string.isRequired,
105
- name: PropTypes.string.isRequired,
106
- label: PropTypes.string.isRequired,
107
- value: PropTypes.oneOfType([
108
- PropTypes.string,
109
- PropTypes.number,
110
- PropTypes.bool,
111
- PropTypes.array
112
- ]),
113
- options: PropTypes.arrayOf(PropTypes.shape({
114
- label: PropTypes.string.isRequired,
115
- value: PropTypes.any
116
- })),
117
- prepend: PropTypes.array,
118
- append: PropTypes.array,
119
- hasErrors: PropTypes.bool,
120
- errors: PropTypes.array,
121
- validating: PropTypes.bool,
122
- required: PropTypes.bool,
123
- dirty: PropTypes.bool
124
- }
125
-
126
- export default React.memo(FormReadOnlyField)
@@ -1,20 +0,0 @@
1
- import React from 'react'
2
- import PropTypes from 'prop-types'
3
-
4
- import ReactMarkdown from 'react-markdown'
5
- import remarkGfm from 'remark-gfm'
6
- import rehypeHighlight from 'rehype-highlight'
7
-
8
- const FormReadOnlyMarkdown = ({ content }) => (
9
- <ReactMarkdown
10
- children={content}
11
- remarkPlugins={[remarkGfm]}
12
- rehypePlugins={[rehypeHighlight]}
13
- />
14
- )
15
-
16
- FormReadOnlyMarkdown.propTypes = {
17
- content: PropTypes.string
18
- }
19
-
20
- export default FormReadOnlyMarkdown
@@ -1,17 +0,0 @@
1
- import React from 'react'
2
- import PropTypes from 'prop-types'
3
-
4
- import FormReadOnlyText from './FormReadOnlyText'
5
-
6
- import { castToNumber } from '../helpers'
7
-
8
- const FormReadOnlyNumber = ({ value }) => <FormReadOnlyText value={castToNumber(value)} />
9
-
10
- FormReadOnlyNumber.propTypes = {
11
- value: PropTypes.oneOfType([
12
- PropTypes.number,
13
- PropTypes.string
14
- ])
15
- }
16
-
17
- export default FormReadOnlyNumber
@@ -1,36 +0,0 @@
1
- import React from 'react'
2
- import PropTypes from 'prop-types'
3
-
4
- import {
5
- Box,
6
- List,
7
- ListItem,
8
- ListItemText
9
- } from '@material-ui/core'
10
-
11
- const getValue = (value, catalog) => {
12
- if (catalog && catalog[value] !== undefined) return catalog[value]
13
- return value
14
- }
15
-
16
- const FormReadOnlyRepeater = ({ value, catalog }) => (
17
- <Box>
18
- <List dense>
19
- {
20
- value && value.map((entry, index) => (
21
- // eslint-disable-next-line react/no-array-index-key
22
- <ListItem key={`entry-${index}`}>
23
- <ListItemText primary={getValue(entry, catalog)} />
24
- </ListItem>
25
- ))
26
- }
27
- </List>
28
- </Box>
29
- )
30
-
31
- FormReadOnlyRepeater.propTypes = {
32
- value: PropTypes.array,
33
- catalog: PropTypes.object
34
- }
35
-
36
- export default FormReadOnlyRepeater
@@ -1,18 +0,0 @@
1
- import React from 'react'
2
- import PropTypes from 'prop-types'
3
-
4
- import FormReadOnlyText from './FormReadOnlyText'
5
-
6
- const FormReadOnlySelect = ({ value, options }) => (
7
- <FormReadOnlyText value={options.find(o => o.value === value)?.label} />
8
- )
9
-
10
- FormReadOnlySelect.propTypes = {
11
- value: PropTypes.string,
12
- options: PropTypes.arrayOf(PropTypes.shape({
13
- label: PropTypes.string.isRequired,
14
- value: PropTypes.any
15
- })).isRequired
16
- }
17
-
18
- export default FormReadOnlySelect