@instructure/ui-drawer-layout 8.8.1-snapshot.8 → 8.9.1
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.
- package/CHANGELOG.md +10 -0
- package/es/DrawerLayout/DrawerContent/index.js +5 -17
- package/{src/DrawerLayout/DrawerContent/types.ts → es/DrawerLayout/DrawerContent/props.js} +13 -12
- package/es/DrawerLayout/DrawerTray/index.js +7 -114
- package/es/DrawerLayout/DrawerTray/props.js +126 -0
- package/es/DrawerLayout/index.js +5 -27
- package/es/DrawerLayout/props.js +49 -0
- package/lib/DrawerLayout/DrawerContent/index.js +6 -18
- package/{src/DrawerLayout/types.ts → lib/DrawerLayout/DrawerContent/props.js} +24 -10
- package/lib/DrawerLayout/DrawerTray/index.js +8 -116
- package/lib/DrawerLayout/DrawerTray/props.js +139 -0
- package/lib/DrawerLayout/index.js +6 -29
- package/lib/DrawerLayout/props.js +64 -0
- package/package.json +22 -23
- package/src/DrawerLayout/DrawerContent/index.tsx +9 -19
- package/src/DrawerLayout/DrawerContent/props.ts +69 -0
- package/src/DrawerLayout/DrawerContent/styles.ts +1 -1
- package/src/DrawerLayout/DrawerTray/index.tsx +33 -108
- package/src/DrawerLayout/DrawerTray/props.ts +205 -0
- package/src/DrawerLayout/DrawerTray/styles.ts +1 -1
- package/src/DrawerLayout/index.tsx +6 -27
- package/src/DrawerLayout/props.ts +75 -0
- package/src/index.ts +3 -3
- package/types/DrawerLayout/DrawerContent/index.d.ts +15 -14
- package/types/DrawerLayout/DrawerContent/index.d.ts.map +1 -1
- package/types/DrawerLayout/DrawerContent/props.d.ts +21 -0
- package/types/DrawerLayout/DrawerContent/props.d.ts.map +1 -0
- package/types/DrawerLayout/DrawerContent/styles.d.ts +1 -1
- package/types/DrawerLayout/DrawerTray/index.d.ts +3 -91
- package/types/DrawerLayout/DrawerTray/index.d.ts.map +1 -1
- package/types/DrawerLayout/DrawerTray/{types.d.ts → props.d.ts} +17 -10
- package/types/DrawerLayout/DrawerTray/props.d.ts.map +1 -0
- package/types/DrawerLayout/DrawerTray/styles.d.ts +1 -1
- package/types/DrawerLayout/index.d.ts +3 -21
- package/types/DrawerLayout/index.d.ts.map +1 -1
- package/types/DrawerLayout/props.d.ts +17 -0
- package/types/DrawerLayout/props.d.ts.map +1 -0
- package/types/index.d.ts +3 -3
- package/LICENSE.md +0 -27
- package/es/DrawerLayout/DrawerContent/types.js +0 -1
- package/es/DrawerLayout/DrawerTray/types.js +0 -1
- package/es/DrawerLayout/types.js +0 -1
- package/lib/DrawerLayout/DrawerContent/types.js +0 -1
- package/lib/DrawerLayout/DrawerTray/types.js +0 -1
- package/lib/DrawerLayout/types.js +0 -1
- package/src/DrawerLayout/DrawerTray/types.ts +0 -72
- package/types/DrawerLayout/DrawerContent/types.d.ts +0 -12
- package/types/DrawerLayout/DrawerContent/types.d.ts.map +0 -1
- package/types/DrawerLayout/DrawerTray/types.d.ts.map +0 -1
- package/types/DrawerLayout/types.d.ts +0 -9
- package/types/DrawerLayout/types.d.ts.map +0 -1
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import React from 'react'
|
|
26
|
+
import PropTypes from 'prop-types'
|
|
27
|
+
|
|
28
|
+
import { element } from '@instructure/ui-prop-types'
|
|
29
|
+
import { bidirectional } from '@instructure/ui-i18n'
|
|
30
|
+
|
|
31
|
+
import type { PositionMountNode } from '@instructure/ui-position'
|
|
32
|
+
import type { BidirectionalProps } from '@instructure/ui-i18n'
|
|
33
|
+
import type { WithStyleProps } from '@instructure/emotion'
|
|
34
|
+
import type { PropValidators } from '@instructure/shared-types'
|
|
35
|
+
|
|
36
|
+
type DrawerTrayPlacement = 'start' | 'end'
|
|
37
|
+
|
|
38
|
+
type DrawerLayoutTrayOwnProps = {
|
|
39
|
+
label: string
|
|
40
|
+
children?: React.ReactNode | ((...args: any[]) => React.ReactNode)
|
|
41
|
+
render?: (...args: any[]) => any
|
|
42
|
+
placement?: DrawerTrayPlacement
|
|
43
|
+
open?: boolean
|
|
44
|
+
onOpen?: (...args: any[]) => any
|
|
45
|
+
onClose?: (...args: any[]) => any
|
|
46
|
+
border?: boolean
|
|
47
|
+
shadow?: boolean
|
|
48
|
+
onTransition?: (...args: any[]) => any
|
|
49
|
+
onEnter?: (...args: any[]) => any
|
|
50
|
+
onEntering?: (...args: any[]) => any
|
|
51
|
+
onEntered?: (...args: any[]) => any
|
|
52
|
+
onExit?: (...args: any[]) => any
|
|
53
|
+
onExiting?: (...args: any[]) => any
|
|
54
|
+
onExited?: (...args: any[]) => any
|
|
55
|
+
contentRef?: (...args: any[]) => any
|
|
56
|
+
mountNode?: PositionMountNode
|
|
57
|
+
defaultFocusElement?: React.ReactElement | ((...args: any[]) => any)
|
|
58
|
+
liveRegion?:
|
|
59
|
+
| React.ReactElement[]
|
|
60
|
+
| React.ReactElement
|
|
61
|
+
| ((...args: any[]) => any)
|
|
62
|
+
onDismiss?: (...args: any[]) => any
|
|
63
|
+
shouldContainFocus?: boolean
|
|
64
|
+
shouldReturnFocus?: boolean
|
|
65
|
+
shouldCloseOnDocumentClick?: boolean
|
|
66
|
+
shouldCloseOnEscape?: boolean
|
|
67
|
+
} & BidirectionalProps
|
|
68
|
+
|
|
69
|
+
type DrawerLayoutTrayState = {
|
|
70
|
+
transitioning: boolean
|
|
71
|
+
portalOpen: boolean
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
type DrawerLayoutTrayStyleProps = {
|
|
75
|
+
placement: DrawerTrayPlacement
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
type PropKeys = keyof DrawerLayoutTrayOwnProps
|
|
79
|
+
|
|
80
|
+
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
81
|
+
|
|
82
|
+
type DrawerLayoutTrayProps = DrawerLayoutTrayOwnProps & WithStyleProps
|
|
83
|
+
|
|
84
|
+
const propTypes: PropValidators<PropKeys> = {
|
|
85
|
+
label: PropTypes.string.isRequired,
|
|
86
|
+
children: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
|
|
87
|
+
render: PropTypes.func,
|
|
88
|
+
/**
|
|
89
|
+
* Placement of the `<DrawerLayout.Tray />`
|
|
90
|
+
*/
|
|
91
|
+
placement: PropTypes.oneOf(['start', 'end']),
|
|
92
|
+
/**
|
|
93
|
+
* If the tray is open or closed.
|
|
94
|
+
*/
|
|
95
|
+
open: PropTypes.bool,
|
|
96
|
+
/**
|
|
97
|
+
* Called when the `<DrawerLayout.Tray />` is opened
|
|
98
|
+
*/
|
|
99
|
+
onOpen: PropTypes.func,
|
|
100
|
+
/**
|
|
101
|
+
* Called when the `<DrawerLayout.Tray />` is closed
|
|
102
|
+
*/
|
|
103
|
+
onClose: PropTypes.func,
|
|
104
|
+
/**
|
|
105
|
+
* Should the `<DrawerLayout.Tray />` have a border
|
|
106
|
+
*/
|
|
107
|
+
border: PropTypes.bool,
|
|
108
|
+
/**
|
|
109
|
+
* Should the `<DrawerLayout.Tray />` have a shadow
|
|
110
|
+
*/
|
|
111
|
+
shadow: PropTypes.bool,
|
|
112
|
+
/**
|
|
113
|
+
* Callback fired when the `<DrawerLayout.Tray />` transitions in/out
|
|
114
|
+
*/
|
|
115
|
+
onTransition: PropTypes.func,
|
|
116
|
+
/**
|
|
117
|
+
* Callback fired before the `<DrawerLayout.Tray />` transitions in
|
|
118
|
+
*/
|
|
119
|
+
onEnter: PropTypes.func,
|
|
120
|
+
/**
|
|
121
|
+
* Callback fired as the `<DrawerLayout.Tray />` begins to transition in
|
|
122
|
+
*/
|
|
123
|
+
onEntering: PropTypes.func,
|
|
124
|
+
/**
|
|
125
|
+
* Callback fired after the `<DrawerLayout.Tray />` finishes transitioning in
|
|
126
|
+
*/
|
|
127
|
+
onEntered: PropTypes.func,
|
|
128
|
+
/**
|
|
129
|
+
* Callback fired right before the `<DrawerLayout.Tray />` transitions out
|
|
130
|
+
*/
|
|
131
|
+
onExit: PropTypes.func,
|
|
132
|
+
/**
|
|
133
|
+
* Callback fired as the `<DrawerLayout.Tray />` begins to transition out
|
|
134
|
+
*/
|
|
135
|
+
onExiting: PropTypes.func,
|
|
136
|
+
/**
|
|
137
|
+
* Callback fired after the `<DrawerLayout.Tray />` finishes transitioning out
|
|
138
|
+
*/
|
|
139
|
+
onExited: PropTypes.func,
|
|
140
|
+
/**
|
|
141
|
+
* Ref function for the `<DrawerLayout.Tray />` content
|
|
142
|
+
*/
|
|
143
|
+
contentRef: PropTypes.func,
|
|
144
|
+
/**
|
|
145
|
+
* An element or a function returning an element to use as the mount node
|
|
146
|
+
* for the `<DrawerLayout.Tray />` when tray is overlaying content
|
|
147
|
+
*/
|
|
148
|
+
mountNode: PropTypes.oneOfType([element, PropTypes.func]),
|
|
149
|
+
/**
|
|
150
|
+
* An element or a function returning an element to focus by default
|
|
151
|
+
*/
|
|
152
|
+
defaultFocusElement: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
|
|
153
|
+
/**
|
|
154
|
+
* An element, function returning an element, or array of elements that will not be hidden from
|
|
155
|
+
* the screen reader when the `<DrawerLayout.Tray />` is open
|
|
156
|
+
*/
|
|
157
|
+
liveRegion: PropTypes.oneOfType([
|
|
158
|
+
PropTypes.arrayOf(PropTypes.element),
|
|
159
|
+
PropTypes.element,
|
|
160
|
+
PropTypes.func
|
|
161
|
+
]),
|
|
162
|
+
onDismiss: PropTypes.func,
|
|
163
|
+
shouldContainFocus: PropTypes.bool,
|
|
164
|
+
shouldReturnFocus: PropTypes.bool,
|
|
165
|
+
shouldCloseOnDocumentClick: PropTypes.bool,
|
|
166
|
+
shouldCloseOnEscape: PropTypes.bool,
|
|
167
|
+
dir: PropTypes.oneOf(Object.values(bidirectional.DIRECTION))
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const allowedProps: AllowedPropKeys = [
|
|
171
|
+
'label',
|
|
172
|
+
'children',
|
|
173
|
+
'render',
|
|
174
|
+
'placement',
|
|
175
|
+
'open',
|
|
176
|
+
'onOpen',
|
|
177
|
+
'onClose',
|
|
178
|
+
'border',
|
|
179
|
+
'shadow',
|
|
180
|
+
'onTransition',
|
|
181
|
+
'onEnter',
|
|
182
|
+
'onEntering',
|
|
183
|
+
'onEntered',
|
|
184
|
+
'onExit',
|
|
185
|
+
'onExiting',
|
|
186
|
+
'onExited',
|
|
187
|
+
'contentRef',
|
|
188
|
+
'mountNode',
|
|
189
|
+
'defaultFocusElement',
|
|
190
|
+
'liveRegion',
|
|
191
|
+
'onDismiss',
|
|
192
|
+
'shouldContainFocus',
|
|
193
|
+
'shouldReturnFocus',
|
|
194
|
+
'shouldCloseOnDocumentClick',
|
|
195
|
+
'shouldCloseOnEscape',
|
|
196
|
+
'dir'
|
|
197
|
+
]
|
|
198
|
+
|
|
199
|
+
export type {
|
|
200
|
+
DrawerLayoutTrayProps,
|
|
201
|
+
DrawerLayoutTrayState,
|
|
202
|
+
DrawerLayoutTrayStyleProps,
|
|
203
|
+
DrawerTrayPlacement
|
|
204
|
+
}
|
|
205
|
+
export { propTypes, allowedProps }
|
|
@@ -24,10 +24,8 @@
|
|
|
24
24
|
|
|
25
25
|
/** @jsx jsx */
|
|
26
26
|
import { Children, Component, createContext } from 'react'
|
|
27
|
-
import PropTypes from 'prop-types'
|
|
28
27
|
|
|
29
28
|
import { bidirectional } from '@instructure/ui-i18n'
|
|
30
|
-
import { Children as ChildrenPropTypes } from '@instructure/ui-prop-types'
|
|
31
29
|
import {
|
|
32
30
|
matchComponentTypes,
|
|
33
31
|
safeCloneElement
|
|
@@ -44,7 +42,9 @@ import { DrawerTray } from './DrawerTray'
|
|
|
44
42
|
|
|
45
43
|
import { withStyle, jsx } from '@instructure/emotion'
|
|
46
44
|
import generateStyle from './styles'
|
|
47
|
-
|
|
45
|
+
|
|
46
|
+
import { propTypes, allowedProps } from './props'
|
|
47
|
+
import type { DrawerLayoutProps } from './props'
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
50
|
---
|
|
@@ -58,29 +58,8 @@ class DrawerLayout extends Component<DrawerLayoutProps> {
|
|
|
58
58
|
static readonly componentId = 'DrawerLayout'
|
|
59
59
|
|
|
60
60
|
static locatorAttribute = 'data-drawer-layout'
|
|
61
|
-
static propTypes =
|
|
62
|
-
|
|
63
|
-
* Exactly one of each of the following child types: `DrawerLayout.Content`, `DrawerLayout.Tray`
|
|
64
|
-
*/
|
|
65
|
-
children: ChildrenPropTypes.oneOfEach([DrawerContent, DrawerTray]),
|
|
66
|
-
/**
|
|
67
|
-
* Min width for the `<DrawerLayout.Content />`
|
|
68
|
-
*/
|
|
69
|
-
minWidth: PropTypes.string,
|
|
70
|
-
/**
|
|
71
|
-
* Function called when the `<DrawerLayout.Content />` is resized and hits the `minWidth` breakpoint
|
|
72
|
-
* Called with a boolean value, `true` if the tray is now overlaying the content or `false` if
|
|
73
|
-
* it is side by side
|
|
74
|
-
*/
|
|
75
|
-
onOverlayTrayChange: PropTypes.func,
|
|
76
|
-
// eslint-disable-next-line react/require-default-props
|
|
77
|
-
makeStyles: PropTypes.func,
|
|
78
|
-
// eslint-disable-next-line react/require-default-props
|
|
79
|
-
styles: PropTypes.object,
|
|
80
|
-
// eslint-disable-next-line react/require-default-props
|
|
81
|
-
dir: PropTypes.oneOf(Object.values(bidirectional.DIRECTION))
|
|
82
|
-
}
|
|
83
|
-
|
|
61
|
+
static propTypes = propTypes
|
|
62
|
+
static allowedProps = allowedProps
|
|
84
63
|
static defaultProps = {
|
|
85
64
|
children: null,
|
|
86
65
|
minWidth: '30rem',
|
|
@@ -346,7 +325,7 @@ class DrawerLayout extends Component<DrawerLayoutProps> {
|
|
|
346
325
|
return (
|
|
347
326
|
// @ts-expect-error ts-migrate(2339) FIXME: Property 'shouldOverlayTray' does not exist on typ... Remove this comment to see the full error message
|
|
348
327
|
<DrawerLayoutContext.Provider value={this.state.shouldOverlayTray}>
|
|
349
|
-
<div {...props} css={this.props.styles
|
|
328
|
+
<div {...props} css={this.props.styles?.drawerLayout}>
|
|
350
329
|
{this.renderChildren()}
|
|
351
330
|
</div>
|
|
352
331
|
</DrawerLayoutContext.Provider>
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import PropTypes from 'prop-types'
|
|
26
|
+
|
|
27
|
+
import { Children as ChildrenPropTypes } from '@instructure/ui-prop-types'
|
|
28
|
+
import { bidirectional } from '@instructure/ui-i18n'
|
|
29
|
+
|
|
30
|
+
import { DrawerContent } from './DrawerContent'
|
|
31
|
+
import { DrawerTray } from './DrawerTray'
|
|
32
|
+
|
|
33
|
+
import type { BidirectionalProps } from '@instructure/ui-i18n'
|
|
34
|
+
import type { WithStyleProps } from '@instructure/emotion'
|
|
35
|
+
import type { PropValidators } from '@instructure/shared-types'
|
|
36
|
+
|
|
37
|
+
type DrawerLayoutOwnProps = {
|
|
38
|
+
children?: React.ReactNode // TODO: oneOfEach([DrawerContent, DrawerTray])
|
|
39
|
+
minWidth?: string
|
|
40
|
+
onOverlayTrayChange?: (...args: any[]) => any
|
|
41
|
+
} & BidirectionalProps
|
|
42
|
+
|
|
43
|
+
type PropKeys = keyof DrawerLayoutOwnProps
|
|
44
|
+
|
|
45
|
+
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
46
|
+
|
|
47
|
+
type DrawerLayoutProps = DrawerLayoutOwnProps & WithStyleProps
|
|
48
|
+
|
|
49
|
+
const propTypes: PropValidators<PropKeys> = {
|
|
50
|
+
/**
|
|
51
|
+
* Exactly one of each of the following child types: `DrawerLayout.Content`, `DrawerLayout.Tray`
|
|
52
|
+
*/
|
|
53
|
+
children: ChildrenPropTypes.oneOfEach([DrawerContent, DrawerTray]),
|
|
54
|
+
/**
|
|
55
|
+
* Min width for the `<DrawerLayout.Content />`
|
|
56
|
+
*/
|
|
57
|
+
minWidth: PropTypes.string,
|
|
58
|
+
/**
|
|
59
|
+
* Function called when the `<DrawerLayout.Content />` is resized and hits the `minWidth` breakpoint
|
|
60
|
+
* Called with a boolean value, `true` if the tray is now overlaying the content or `false` if
|
|
61
|
+
* it is side by side
|
|
62
|
+
*/
|
|
63
|
+
onOverlayTrayChange: PropTypes.func,
|
|
64
|
+
dir: PropTypes.oneOf(Object.values(bidirectional.DIRECTION))
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const allowedProps: AllowedPropKeys = [
|
|
68
|
+
'children',
|
|
69
|
+
'minWidth',
|
|
70
|
+
'onOverlayTrayChange',
|
|
71
|
+
'dir'
|
|
72
|
+
]
|
|
73
|
+
|
|
74
|
+
export type { DrawerLayoutProps }
|
|
75
|
+
export { propTypes, allowedProps }
|
package/src/index.ts
CHANGED
|
@@ -24,6 +24,6 @@
|
|
|
24
24
|
|
|
25
25
|
export { DrawerLayout, DrawerContent } from './DrawerLayout'
|
|
26
26
|
|
|
27
|
-
export type { DrawerLayoutProps } from './DrawerLayout/
|
|
28
|
-
export type { DrawerLayoutContentProps } from './DrawerLayout/DrawerContent/
|
|
29
|
-
export type { DrawerLayoutTrayProps } from './DrawerLayout/DrawerTray/
|
|
27
|
+
export type { DrawerLayoutProps } from './DrawerLayout/props'
|
|
28
|
+
export type { DrawerLayoutContentProps } from './DrawerLayout/DrawerContent/props'
|
|
29
|
+
export type { DrawerLayoutTrayProps } from './DrawerLayout/DrawerTray/props'
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { Component } from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
3
|
import { jsx } from '@instructure/emotion';
|
|
5
|
-
import { DrawerLayoutContentProps, DrawerLayoutContentState } from './
|
|
4
|
+
import type { DrawerLayoutContentProps, DrawerLayoutContentState } from './props';
|
|
6
5
|
/**
|
|
7
6
|
---
|
|
8
7
|
parent: DrawerLayout
|
|
@@ -12,18 +11,20 @@ id: DrawerLayout.Content
|
|
|
12
11
|
declare class DrawerContent extends Component<DrawerLayoutContentProps, DrawerLayoutContentState> {
|
|
13
12
|
static readonly componentId = "DrawerLayout.Content";
|
|
14
13
|
static locatorAttribute: string;
|
|
15
|
-
static propTypes: {
|
|
16
|
-
label:
|
|
17
|
-
children
|
|
18
|
-
contentRef
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
14
|
+
static propTypes: import("@instructure/shared-types/types/UtilityTypes").PropValidators<keyof {
|
|
15
|
+
label: string;
|
|
16
|
+
children?: import("react").ReactNode;
|
|
17
|
+
contentRef?: ((...args: any[]) => any) | undefined;
|
|
18
|
+
onSizeChange?: ((...args: any[]) => any) | undefined;
|
|
19
|
+
role?: string | undefined;
|
|
20
|
+
}>;
|
|
21
|
+
static allowedProps: readonly (keyof {
|
|
22
|
+
label: string;
|
|
23
|
+
children?: import("react").ReactNode;
|
|
24
|
+
contentRef?: ((...args: any[]) => any) | undefined;
|
|
25
|
+
onSizeChange?: ((...args: any[]) => any) | undefined;
|
|
26
|
+
role?: string | undefined;
|
|
27
|
+
})[];
|
|
27
28
|
static defaultProps: {
|
|
28
29
|
children: null;
|
|
29
30
|
contentRef: (el: any) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/DrawerLayout/DrawerContent/index.tsx"],"names":[],"mappings":"AAwBA,eAAe;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/DrawerLayout/DrawerContent/index.tsx"],"names":[],"mappings":"AAwBA,eAAe;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAMjC,OAAO,EAAa,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAMrD,OAAO,KAAK,EACV,wBAAwB,EACxB,wBAAwB,EACzB,MAAM,SAAS,CAAA;AAEhB;;;;;GAKG;AACH,cAEM,aAAc,SAAQ,SAAS,CACnC,wBAAwB,EACxB,wBAAwB,CACzB;IACC,MAAM,CAAC,QAAQ,CAAC,WAAW,0BAAyB;IAEpD,MAAM,CAAC,gBAAgB,SAAwB;IAC/C,MAAM,CAAC,SAAS;;;;;;OAAY;IAC5B,MAAM,CAAC,YAAY;;;;;;SAAe;IAClC,MAAM,CAAC,YAAY;;yBAGA,GAAG;6BAEC,GAAG;;MAEzB;IAED,KAAK,EAAE,wBAAwB,CAE9B;IAED,QAAQ,OAAO;IACf,eAAe,OAAO;IAEtB,UAAU,OAAO;IACjB,SAAS,UAAK;IAEd,iBAAiB;IAkCjB,kBAAkB,CAAC,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG;IAKhE,oBAAoB;IAgBpB,gBAAgB,SAAU,GAAG,UAK5B;IAED,MAAM;CAuBP;AAED,eAAe,aAAa,CAAA;AAC5B,OAAO,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { PropValidators } from '@instructure/shared-types';
|
|
3
|
+
import type { WithStyleProps } from '@instructure/emotion';
|
|
4
|
+
declare type DrawerLayoutContentOwnProps = {
|
|
5
|
+
label: string;
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
contentRef?: (...args: any[]) => any;
|
|
8
|
+
onSizeChange?: (...args: any[]) => any;
|
|
9
|
+
role?: string;
|
|
10
|
+
};
|
|
11
|
+
declare type DrawerLayoutContentState = {
|
|
12
|
+
shouldTransition: boolean;
|
|
13
|
+
};
|
|
14
|
+
declare type PropKeys = keyof DrawerLayoutContentOwnProps;
|
|
15
|
+
declare type AllowedPropKeys = Readonly<Array<PropKeys>>;
|
|
16
|
+
declare type DrawerLayoutContentProps = DrawerLayoutContentOwnProps & WithStyleProps;
|
|
17
|
+
declare const propTypes: PropValidators<PropKeys>;
|
|
18
|
+
declare const allowedProps: AllowedPropKeys;
|
|
19
|
+
export type { DrawerLayoutContentProps, DrawerLayoutContentState };
|
|
20
|
+
export { propTypes, allowedProps };
|
|
21
|
+
//# sourceMappingURL=props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/DrawerLayout/DrawerContent/props.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAE1D,aAAK,2BAA2B,GAAG;IACjC,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,UAAU,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;IACpC,YAAY,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;IACtC,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAED,aAAK,wBAAwB,GAAG;IAC9B,gBAAgB,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED,aAAK,QAAQ,GAAG,MAAM,2BAA2B,CAAA;AAEjD,aAAK,eAAe,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;AAEhD,aAAK,wBAAwB,GAAG,2BAA2B,GAAG,cAAc,CAAA;AAE5E,QAAA,MAAM,SAAS,EAAE,cAAc,CAAC,QAAQ,CASvC,CAAA;AAED,QAAA,MAAM,YAAY,EAAE,eAMnB,CAAA;AAED,YAAY,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,CAAA;AAClE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { Component } from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
3
|
import { jsx } from '@instructure/emotion';
|
|
5
4
|
import type { PortalNode } from '@instructure/ui-portal';
|
|
6
|
-
import { DrawerLayoutTrayProps, DrawerLayoutTrayState, DrawerLayoutTrayStyleProps, DrawerTrayPlacement } from './
|
|
5
|
+
import type { DrawerLayoutTrayProps, DrawerLayoutTrayState, DrawerLayoutTrayStyleProps, DrawerTrayPlacement } from './props';
|
|
7
6
|
/**
|
|
8
7
|
---
|
|
9
8
|
parent: DrawerLayout
|
|
@@ -13,92 +12,10 @@ id: DrawerLayout.Tray
|
|
|
13
12
|
declare class DrawerTray extends Component<DrawerLayoutTrayProps, DrawerLayoutTrayState> {
|
|
14
13
|
static readonly componentId: "DrawerLayout.Tray";
|
|
15
14
|
static locatorAttribute: string;
|
|
16
|
-
static propTypes:
|
|
17
|
-
|
|
18
|
-
children: PropTypes.Requireable<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
|
|
19
|
-
render: PropTypes.Requireable<(...args: any[]) => any>;
|
|
20
|
-
/**
|
|
21
|
-
* Placement of the `<DrawerLayout.Tray />`
|
|
22
|
-
*/
|
|
23
|
-
placement: PropTypes.Requireable<string>;
|
|
24
|
-
/**
|
|
25
|
-
* If the tray is open or closed.
|
|
26
|
-
*/
|
|
27
|
-
open: PropTypes.Requireable<boolean>;
|
|
28
|
-
/**
|
|
29
|
-
* Called when the `<DrawerLayout.Tray />` is opened
|
|
30
|
-
*/
|
|
31
|
-
onOpen: PropTypes.Requireable<(...args: any[]) => any>;
|
|
32
|
-
/**
|
|
33
|
-
* Called when the `<DrawerLayout.Tray />` is closed
|
|
34
|
-
*/
|
|
35
|
-
onClose: PropTypes.Requireable<(...args: any[]) => any>;
|
|
36
|
-
/**
|
|
37
|
-
* Should the `<DrawerLayout.Tray />` have a border
|
|
38
|
-
*/
|
|
39
|
-
border: PropTypes.Requireable<boolean>;
|
|
40
|
-
/**
|
|
41
|
-
* Should the `<DrawerLayout.Tray />` have a shadow
|
|
42
|
-
*/
|
|
43
|
-
shadow: PropTypes.Requireable<boolean>;
|
|
44
|
-
/**
|
|
45
|
-
* Callback fired when the `<DrawerLayout.Tray />` transitions in/out
|
|
46
|
-
*/
|
|
47
|
-
onTransition: PropTypes.Requireable<(...args: any[]) => any>;
|
|
48
|
-
/**
|
|
49
|
-
* Callback fired before the `<DrawerLayout.Tray />` transitions in
|
|
50
|
-
*/
|
|
51
|
-
onEnter: PropTypes.Requireable<(...args: any[]) => any>;
|
|
52
|
-
/**
|
|
53
|
-
* Callback fired as the `<DrawerLayout.Tray />` begins to transition in
|
|
54
|
-
*/
|
|
55
|
-
onEntering: PropTypes.Requireable<(...args: any[]) => any>;
|
|
56
|
-
/**
|
|
57
|
-
* Callback fired after the `<DrawerLayout.Tray />` finishes transitioning in
|
|
58
|
-
*/
|
|
59
|
-
onEntered: PropTypes.Requireable<(...args: any[]) => any>;
|
|
60
|
-
/**
|
|
61
|
-
* Callback fired right before the `<DrawerLayout.Tray />` transitions out
|
|
62
|
-
*/
|
|
63
|
-
onExit: PropTypes.Requireable<(...args: any[]) => any>;
|
|
64
|
-
/**
|
|
65
|
-
* Callback fired as the `<DrawerLayout.Tray />` begins to transition out
|
|
66
|
-
*/
|
|
67
|
-
onExiting: PropTypes.Requireable<(...args: any[]) => any>;
|
|
68
|
-
/**
|
|
69
|
-
* Callback fired after the `<DrawerLayout.Tray />` finishes transitioning out
|
|
70
|
-
*/
|
|
71
|
-
onExited: PropTypes.Requireable<(...args: any[]) => any>;
|
|
72
|
-
/**
|
|
73
|
-
* Ref function for the `<DrawerLayout.Tray />` content
|
|
74
|
-
*/
|
|
75
|
-
contentRef: PropTypes.Requireable<(...args: any[]) => any>;
|
|
76
|
-
/**
|
|
77
|
-
* An element or a function returning an element to use as the mount node
|
|
78
|
-
* for the `<DrawerLayout.Tray />` when tray is overlaying content
|
|
79
|
-
*/
|
|
80
|
-
mountNode: PropTypes.Requireable<PropTypes.ReactElementLike | ((...args: any[]) => any) | Element>;
|
|
81
|
-
/**
|
|
82
|
-
* An element or a function returning an element to focus by default
|
|
83
|
-
*/
|
|
84
|
-
defaultFocusElement: PropTypes.Requireable<PropTypes.ReactElementLike | ((...args: any[]) => any)>;
|
|
85
|
-
/**
|
|
86
|
-
* An element, function returning an element, or array of elements that will not be hidden from
|
|
87
|
-
* the screen reader when the `<DrawerLayout.Tray />` is open
|
|
88
|
-
*/
|
|
89
|
-
liveRegion: PropTypes.Requireable<PropTypes.ReactElementLike | ((...args: any[]) => any) | (PropTypes.ReactElementLike | null | undefined)[]>;
|
|
90
|
-
onDismiss: PropTypes.Requireable<(...args: any[]) => any>;
|
|
91
|
-
shouldContainFocus: PropTypes.Requireable<boolean>;
|
|
92
|
-
shouldReturnFocus: PropTypes.Requireable<boolean>;
|
|
93
|
-
shouldCloseOnDocumentClick: PropTypes.Requireable<boolean>;
|
|
94
|
-
shouldCloseOnEscape: PropTypes.Requireable<boolean>;
|
|
95
|
-
makeStyles: PropTypes.Requireable<(...args: any[]) => any>;
|
|
96
|
-
styles: PropTypes.Requireable<object>;
|
|
97
|
-
dir: PropTypes.Requireable<string>;
|
|
98
|
-
};
|
|
15
|
+
static propTypes: import("@instructure/shared-types/types/UtilityTypes").PropValidators<"label" | "children" | "contentRef" | "dir" | "border" | "render" | "placement" | "open" | "onOpen" | "onClose" | "shadow" | "onTransition" | "onEnter" | "onEntering" | "onEntered" | "onExit" | "onExiting" | "onExited" | "mountNode" | "defaultFocusElement" | "liveRegion" | "onDismiss" | "shouldContainFocus" | "shouldReturnFocus" | "shouldCloseOnDocumentClick" | "shouldCloseOnEscape">;
|
|
16
|
+
static allowedProps: readonly ("label" | "children" | "contentRef" | "dir" | "border" | "render" | "placement" | "open" | "onOpen" | "onClose" | "shadow" | "onTransition" | "onEnter" | "onEntering" | "onEntered" | "onExit" | "onExiting" | "onExited" | "mountNode" | "defaultFocusElement" | "liveRegion" | "onDismiss" | "shouldContainFocus" | "shouldReturnFocus" | "shouldCloseOnDocumentClick" | "shouldCloseOnEscape")[];
|
|
99
17
|
static defaultProps: {
|
|
100
18
|
children: null;
|
|
101
|
-
render: undefined;
|
|
102
19
|
shouldContainFocus: boolean;
|
|
103
20
|
shouldCloseOnEscape: boolean;
|
|
104
21
|
shouldCloseOnDocumentClick: boolean;
|
|
@@ -116,11 +33,6 @@ declare class DrawerTray extends Component<DrawerLayoutTrayProps, DrawerLayoutTr
|
|
|
116
33
|
onExiting: () => void;
|
|
117
34
|
onExited: () => void;
|
|
118
35
|
contentRef: (node: any) => void;
|
|
119
|
-
onClose: undefined;
|
|
120
|
-
onDismiss: undefined;
|
|
121
|
-
defaultFocusElement: undefined;
|
|
122
|
-
liveRegion: undefined;
|
|
123
|
-
onTransition: undefined;
|
|
124
36
|
};
|
|
125
37
|
state: DrawerLayoutTrayState;
|
|
126
38
|
_DOMNode?: PortalNode;
|