-
Notifications
You must be signed in to change notification settings - Fork 72
/
playground.js
79 lines (69 loc) · 1.9 KB
/
playground.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/
import { PropTypes } from 'react-view';
import { OuiAccordion, OuiPanel } from '../../../../src/components/';
import { htmlIdGenerator } from '../../../../src/services';
import {
propUtilityForPlayground,
createOptionalEnum,
dummyFunction,
simulateFunction,
} from '../../services/playground';
export const accordionConfig = () => {
const docgenInfo = Array.isArray(OuiAccordion.__docgenInfo)
? OuiAccordion.__docgenInfo[0]
: OuiAccordion.__docgenInfo;
const propsToUse = propUtilityForPlayground(docgenInfo.props);
propsToUse.buttonContent = {
...propsToUse.buttonContent,
value: 'Click me to toggle',
type: PropTypes.String,
};
propsToUse.id = {
...propsToUse.id,
value: htmlIdGenerator('generated')(),
};
propsToUse.children = {
value: `<OuiPanel color="subdued">
Any content inside of <strong>OuiAccordion</strong> will appear here.
</OuiPanel>`,
type: PropTypes.ReactNode,
hidden: false,
};
propsToUse.onToggle = simulateFunction(propsToUse.onToggle);
propsToUse.forceState = createOptionalEnum(propsToUse.forceState);
propsToUse.extraAction = {
...propsToUse.extraAction,
type: PropTypes.String,
};
propsToUse.isLoadingMessage = {
...propsToUse.isLoadingMessage,
type: PropTypes.String,
};
return {
config: {
componentName: 'OuiAccordion',
props: propsToUse,
scope: {
OuiAccordion,
OuiPanel,
},
imports: {
'@opensearch-project/oui': {
named: ['OuiAccordion', 'OuiPanel'],
},
},
customProps: {
onToggle: dummyFunction,
},
},
};
};