-
Notifications
You must be signed in to change notification settings - Fork 836
/
drawer.ts
128 lines (125 loc) · 3.27 KB
/
drawer.ts
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
import {Drawer, ANCHOR, SIZE} from 'baseui/drawer';
import {PropTypes} from 'react-view';
import {TConfig} from '../types';
const drawerProps = require('!!extract-react-types-loader!../../../../src/drawer/drawer.js');
const DrawerConfig: TConfig = {
imports: {
'baseui/drawer': {
named: ['Drawer'],
},
},
scope: {Drawer, ANCHOR, SIZE},
theme: [],
props: {
animate: {
value: undefined,
defaultValue: true,
type: PropTypes.Boolean,
description:
'Sets whether the Drawer should be displayed by easing in and out.',
hidden: true,
},
isOpen: {
value: false,
type: PropTypes.Boolean,
description: 'Determines if the drawer is open.',
stateful: true,
},
autoFocus: {
value: true,
type: PropTypes.Boolean,
description:
'If true, focus will shift to the first interactive element within the drawer.',
hidden: true,
},
children: {
value: '<div>drawer content</div>',
type: PropTypes.ReactNode,
description: 'Drawer content.',
},
onClose: {
value: '() => setIsOpen(false);',
type: PropTypes.Function,
description: 'A callback that is invoked when the modal will close.',
propHook: {
what: 'false',
into: 'isOpen',
},
},
size: {
value: 'SIZE.default',
options: SIZE,
defaultValue: 'SIZE.default',
type: PropTypes.Enum,
description: 'Defines the modal size.',
imports: {
'baseui/drawer': {
named: ['SIZE'],
},
},
},
anchor: {
value: 'ANCHOR.default',
options: ANCHOR,
defaultValue: 'ANCHOR.default',
type: PropTypes.Enum,
description: 'Window side from which the drawer originates from.',
imports: {
'baseui/drawer': {
named: ['ANCHOR'],
},
},
},
closeable: {
value: true,
defaultValue: true,
type: PropTypes.Boolean,
description: 'Whether the drawer should be closeable by the user.',
hidden: true,
},
showBackdrop: {
value: false,
type: PropTypes.Boolean,
description: 'Whether the backdrop should be shown.',
hidden: true,
},
onBackdropClick: {
value: false,
type: PropTypes.Function,
description: 'Callback invoked when backdrop is clicked.',
hidden: true,
},
onEscapeKeyDown: {
value: false,
type: PropTypes.Function,
description: 'Callback invoked when escape key is pressed.',
hidden: true,
},
overrides: {
value: undefined,
type: PropTypes.Custom,
description: 'Lets you customize all aspects of the component.',
custom: {
names: ['Root', 'Backdrop', 'DrawerBody', 'DrawerContainer', 'Close'],
sharedProps: {
$animating: {
type: PropTypes.Boolean,
description: 'True if drawer is animating.',
},
$isVisible: {
type: PropTypes.Boolean,
description: 'True if drawer is visible.',
},
$isOpen: 'isOpen',
$size: 'size',
$closeable: 'closeable',
$anchor: 'anchor',
},
},
},
},
mapTokensToProps: {
Drawer: drawerProps,
},
};
export default DrawerConfig;