@instructure/ui-drawer-layout 10.26.1-snapshot-2 → 10.26.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 +2 -23
- package/es/DrawerLayout/DrawerContent/index.js +6 -6
- package/es/DrawerLayout/DrawerContent/props.js +9 -1
- package/es/DrawerLayout/DrawerTray/index.js +6 -6
- package/es/DrawerLayout/DrawerTray/props.js +32 -1
- package/es/DrawerLayout/__fixtures__/DrawerLayout.fixture.js +8 -0
- package/es/DrawerLayout/index.js +6 -6
- package/es/DrawerLayout/props.js +12 -1
- package/lib/DrawerLayout/DrawerContent/index.js +5 -5
- package/lib/DrawerLayout/DrawerContent/props.js +10 -1
- package/lib/DrawerLayout/DrawerTray/index.js +5 -5
- package/lib/DrawerLayout/DrawerTray/props.js +33 -1
- package/lib/DrawerLayout/__fixtures__/DrawerLayout.fixture.js +9 -0
- package/lib/DrawerLayout/index.js +5 -5
- package/lib/DrawerLayout/props.js +13 -1
- package/package.json +22 -19
- package/src/DrawerLayout/DrawerContent/index.tsx +4 -2
- package/src/DrawerLayout/DrawerContent/props.ts +12 -1
- package/src/DrawerLayout/DrawerTray/index.tsx +4 -2
- package/src/DrawerLayout/DrawerTray/props.ts +41 -1
- package/src/DrawerLayout/__fixtures__/DrawerLayout.fixture.tsx +9 -0
- package/src/DrawerLayout/index.tsx +4 -2
- package/src/DrawerLayout/props.ts +18 -1
- package/tsconfig.build.json +2 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/DrawerLayout/DrawerContent/index.d.ts +7 -0
- package/types/DrawerLayout/DrawerContent/index.d.ts.map +1 -1
- package/types/DrawerLayout/DrawerContent/props.d.ts +3 -2
- package/types/DrawerLayout/DrawerContent/props.d.ts.map +1 -1
- package/types/DrawerLayout/DrawerTray/index.d.ts +17 -0
- package/types/DrawerLayout/DrawerTray/index.d.ts.map +1 -1
- package/types/DrawerLayout/DrawerTray/props.d.ts +3 -2
- package/types/DrawerLayout/DrawerTray/props.d.ts.map +1 -1
- package/types/DrawerLayout/__fixtures__/DrawerLayout.fixture.d.ts +8 -0
- package/types/DrawerLayout/__fixtures__/DrawerLayout.fixture.d.ts.map +1 -1
- package/types/DrawerLayout/index.d.ts +1 -0
- package/types/DrawerLayout/index.d.ts.map +1 -1
- package/types/DrawerLayout/props.d.ts +3 -1
- package/types/DrawerLayout/props.d.ts.map +1 -1
|
@@ -23,8 +23,10 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import { AriaRole } from 'react'
|
|
26
|
+
import PropTypes from 'prop-types'
|
|
26
27
|
|
|
27
28
|
import type {
|
|
29
|
+
PropValidators,
|
|
28
30
|
DrawerLayoutContentTheme,
|
|
29
31
|
OtherHTMLAttributes
|
|
30
32
|
} from '@instructure/shared-types'
|
|
@@ -56,6 +58,15 @@ type DrawerLayoutContentProps = DrawerLayoutContentOwnProps &
|
|
|
56
58
|
OtherHTMLAttributes<DrawerLayoutContentOwnProps>
|
|
57
59
|
|
|
58
60
|
type DrawerLayoutContentStyle = ComponentStyle<'drawerContent'>
|
|
61
|
+
|
|
62
|
+
const propTypes: PropValidators<PropKeys> = {
|
|
63
|
+
label: PropTypes.string.isRequired,
|
|
64
|
+
children: PropTypes.node,
|
|
65
|
+
contentRef: PropTypes.func,
|
|
66
|
+
onSizeChange: PropTypes.func,
|
|
67
|
+
role: PropTypes.string
|
|
68
|
+
}
|
|
69
|
+
|
|
59
70
|
const allowedProps: AllowedPropKeys = [
|
|
60
71
|
'label',
|
|
61
72
|
'children',
|
|
@@ -70,4 +81,4 @@ export type {
|
|
|
70
81
|
DrawerLayoutContentStyle,
|
|
71
82
|
DrawerContentSize
|
|
72
83
|
}
|
|
73
|
-
export { allowedProps }
|
|
84
|
+
export { propTypes, allowedProps }
|
|
@@ -30,6 +30,7 @@ import { Transition } from '@instructure/ui-motion'
|
|
|
30
30
|
import type { TransitionType } from '@instructure/ui-motion'
|
|
31
31
|
import { omitProps } from '@instructure/ui-react-utils'
|
|
32
32
|
import { createChainedFunction } from '@instructure/ui-utils'
|
|
33
|
+
import { testable } from '@instructure/ui-testable'
|
|
33
34
|
import { Dialog } from '@instructure/ui-dialog'
|
|
34
35
|
import { Portal } from '@instructure/ui-portal'
|
|
35
36
|
import type { PortalNode } from '@instructure/ui-portal'
|
|
@@ -39,7 +40,7 @@ import generateStyle from './styles'
|
|
|
39
40
|
import generateComponentTheme from './theme'
|
|
40
41
|
import { DrawerLayoutContext } from '../index'
|
|
41
42
|
|
|
42
|
-
import { allowedProps } from './props'
|
|
43
|
+
import { propTypes, allowedProps } from './props'
|
|
43
44
|
import type {
|
|
44
45
|
DrawerLayoutTrayProps,
|
|
45
46
|
DrawerLayoutTrayState,
|
|
@@ -55,6 +56,7 @@ id: DrawerLayout.Tray
|
|
|
55
56
|
**/
|
|
56
57
|
@withStyle(generateStyle, generateComponentTheme)
|
|
57
58
|
@textDirectionContextConsumer()
|
|
59
|
+
@testable()
|
|
58
60
|
class DrawerTray extends Component<
|
|
59
61
|
DrawerLayoutTrayProps,
|
|
60
62
|
DrawerLayoutTrayState
|
|
@@ -63,6 +65,7 @@ class DrawerTray extends Component<
|
|
|
63
65
|
|
|
64
66
|
static locatorAttribute = 'data-drawer-tray'
|
|
65
67
|
|
|
68
|
+
static propTypes = propTypes
|
|
66
69
|
static allowedProps = allowedProps
|
|
67
70
|
static defaultProps = {
|
|
68
71
|
shouldContainFocus: true,
|
|
@@ -243,7 +246,6 @@ class DrawerTray extends Component<
|
|
|
243
246
|
{...omitProps(props, DrawerTray.allowedProps)}
|
|
244
247
|
ref={this.handleContentRef}
|
|
245
248
|
css={trayStyles}
|
|
246
|
-
data-cid="DrawerTray"
|
|
247
249
|
>
|
|
248
250
|
<Dialog
|
|
249
251
|
open
|
|
@@ -23,6 +23,11 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import React from 'react'
|
|
26
|
+
import PropTypes from 'prop-types'
|
|
27
|
+
|
|
28
|
+
import { element } from '@instructure/ui-prop-types'
|
|
29
|
+
import { textDirectionContextConsumer } from '@instructure/ui-i18n'
|
|
30
|
+
|
|
26
31
|
import type { PositionMountNode } from '@instructure/ui-position'
|
|
27
32
|
import type { TextDirectionContextConsumerProps } from '@instructure/ui-i18n'
|
|
28
33
|
import type { ComponentStyle, WithStyleProps } from '@instructure/emotion'
|
|
@@ -30,6 +35,7 @@ import type {
|
|
|
30
35
|
DrawerLayoutTrayTheme,
|
|
31
36
|
LiveRegion,
|
|
32
37
|
OtherHTMLAttributes,
|
|
38
|
+
PropValidators,
|
|
33
39
|
UIElement
|
|
34
40
|
} from '@instructure/shared-types'
|
|
35
41
|
import {
|
|
@@ -180,6 +186,40 @@ type DrawerLayoutTrayProps = DrawerLayoutTrayOwnProps &
|
|
|
180
186
|
type DrawerLayoutTrayStyle = ComponentStyle<
|
|
181
187
|
'drawerTray' | 'drawerTrayWithShadow' | 'drawerTrayContent'
|
|
182
188
|
>
|
|
189
|
+
|
|
190
|
+
const propTypes: PropValidators<PropKeys> = {
|
|
191
|
+
label: PropTypes.string.isRequired,
|
|
192
|
+
children: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
|
|
193
|
+
render: PropTypes.func,
|
|
194
|
+
placement: PropTypes.oneOf(['start', 'end']),
|
|
195
|
+
open: PropTypes.bool,
|
|
196
|
+
onOpen: PropTypes.func,
|
|
197
|
+
onClose: PropTypes.func,
|
|
198
|
+
border: PropTypes.bool,
|
|
199
|
+
shadow: PropTypes.bool,
|
|
200
|
+
onTransition: PropTypes.func,
|
|
201
|
+
onEnter: PropTypes.func,
|
|
202
|
+
onEntering: PropTypes.func,
|
|
203
|
+
onEntered: PropTypes.func,
|
|
204
|
+
onExit: PropTypes.func,
|
|
205
|
+
onExiting: PropTypes.func,
|
|
206
|
+
onExited: PropTypes.func,
|
|
207
|
+
contentRef: PropTypes.func,
|
|
208
|
+
mountNode: PropTypes.oneOfType([element, PropTypes.func]),
|
|
209
|
+
defaultFocusElement: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
|
|
210
|
+
liveRegion: PropTypes.oneOfType([
|
|
211
|
+
element,
|
|
212
|
+
PropTypes.arrayOf(element),
|
|
213
|
+
PropTypes.func
|
|
214
|
+
]),
|
|
215
|
+
onDismiss: PropTypes.func,
|
|
216
|
+
shouldContainFocus: PropTypes.bool,
|
|
217
|
+
shouldReturnFocus: PropTypes.bool,
|
|
218
|
+
shouldCloseOnDocumentClick: PropTypes.bool,
|
|
219
|
+
shouldCloseOnEscape: PropTypes.bool,
|
|
220
|
+
dir: PropTypes.oneOf(Object.values(textDirectionContextConsumer.DIRECTION))
|
|
221
|
+
}
|
|
222
|
+
|
|
183
223
|
const allowedProps: AllowedPropKeys = [
|
|
184
224
|
'label',
|
|
185
225
|
'children',
|
|
@@ -216,4 +256,4 @@ export type {
|
|
|
216
256
|
DrawerLayoutTrayStyleProps,
|
|
217
257
|
DrawerTrayPlacement
|
|
218
258
|
}
|
|
219
|
-
export { allowedProps }
|
|
259
|
+
export { allowedProps, propTypes }
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import { Component } from 'react'
|
|
26
|
+
import PropTypes from 'prop-types'
|
|
26
27
|
|
|
27
28
|
import { DrawerLayout } from '../index'
|
|
28
29
|
import type { DrawerLayoutProps } from '../props'
|
|
@@ -37,6 +38,14 @@ type DrawerLayoutFixtureProps = {
|
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
export default class DrawerLayoutFixture extends Component<DrawerLayoutFixtureProps> {
|
|
41
|
+
static propTypes = {
|
|
42
|
+
layoutWidth: PropTypes.string,
|
|
43
|
+
trayWidth: PropTypes.string,
|
|
44
|
+
placement: PropTypes.string,
|
|
45
|
+
open: PropTypes.bool,
|
|
46
|
+
onOverlayTrayChange: PropTypes.func
|
|
47
|
+
}
|
|
48
|
+
|
|
40
49
|
static defaultProps = {
|
|
41
50
|
layoutWidth: '600px',
|
|
42
51
|
trayWidth: '200px',
|
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
import { getBoundingClientRect } from '@instructure/ui-dom-utils'
|
|
34
34
|
import { createChainedFunction, px } from '@instructure/ui-utils'
|
|
35
35
|
import { logError as error } from '@instructure/console'
|
|
36
|
+
import { testable } from '@instructure/ui-testable'
|
|
36
37
|
|
|
37
38
|
import { mirrorHorizontalPlacement } from '@instructure/ui-position'
|
|
38
39
|
import type { PlacementPropValues } from '@instructure/ui-position'
|
|
@@ -48,7 +49,7 @@ import type { DrawerLayoutTrayProps } from './DrawerTray/props'
|
|
|
48
49
|
import { withStyle } from '@instructure/emotion'
|
|
49
50
|
import generateStyle from './styles'
|
|
50
51
|
|
|
51
|
-
import { allowedProps } from './props'
|
|
52
|
+
import { propTypes, allowedProps } from './props'
|
|
52
53
|
import type { DrawerLayoutProps, DrawerLayoutState } from './props'
|
|
53
54
|
|
|
54
55
|
type TrayChild = ComponentElement<
|
|
@@ -69,10 +70,12 @@ category: components
|
|
|
69
70
|
@withDeterministicId()
|
|
70
71
|
@withStyle(generateStyle, null)
|
|
71
72
|
@textDirectionContextConsumer()
|
|
73
|
+
@testable()
|
|
72
74
|
class DrawerLayout extends Component<DrawerLayoutProps, DrawerLayoutState> {
|
|
73
75
|
static readonly componentId = 'DrawerLayout'
|
|
74
76
|
|
|
75
77
|
static locatorAttribute = 'data-drawer-layout'
|
|
78
|
+
static propTypes = propTypes
|
|
76
79
|
static allowedProps = allowedProps
|
|
77
80
|
static defaultProps = {
|
|
78
81
|
minWidth: '30rem'
|
|
@@ -321,7 +324,6 @@ class DrawerLayout extends Component<DrawerLayoutProps, DrawerLayoutState> {
|
|
|
321
324
|
{...props}
|
|
322
325
|
css={this.props.styles?.drawerLayout}
|
|
323
326
|
ref={this.handleRef}
|
|
324
|
-
data-cid="DrawerLayout"
|
|
325
327
|
>
|
|
326
328
|
{this.renderChildren()}
|
|
327
329
|
</div>
|
|
@@ -23,8 +23,17 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import React from 'react'
|
|
26
|
+
import PropTypes from 'prop-types'
|
|
27
|
+
|
|
28
|
+
import { Children as ChildrenPropTypes } from '@instructure/ui-prop-types'
|
|
29
|
+
import { textDirectionContextConsumer } from '@instructure/ui-i18n'
|
|
30
|
+
|
|
31
|
+
import { DrawerContent } from './DrawerContent'
|
|
32
|
+
import { DrawerTray } from './DrawerTray'
|
|
33
|
+
|
|
26
34
|
import type { TextDirectionContextConsumerProps } from '@instructure/ui-i18n'
|
|
27
35
|
import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
|
|
36
|
+
import type { PropValidators } from '@instructure/shared-types'
|
|
28
37
|
import type { WithDeterministicIdProps } from '@instructure/ui-react-utils'
|
|
29
38
|
|
|
30
39
|
type DrawerLayoutOwnProps = {
|
|
@@ -61,6 +70,14 @@ type DrawerLayoutState = {
|
|
|
61
70
|
trayWidth: number
|
|
62
71
|
contentWidth: number
|
|
63
72
|
}
|
|
73
|
+
|
|
74
|
+
const propTypes: PropValidators<PropKeys> = {
|
|
75
|
+
children: ChildrenPropTypes.oneOfEach([DrawerContent, DrawerTray]),
|
|
76
|
+
minWidth: PropTypes.string,
|
|
77
|
+
onOverlayTrayChange: PropTypes.func,
|
|
78
|
+
dir: PropTypes.oneOf(Object.values(textDirectionContextConsumer.DIRECTION))
|
|
79
|
+
}
|
|
80
|
+
|
|
64
81
|
const allowedProps: AllowedPropKeys = [
|
|
65
82
|
'children',
|
|
66
83
|
'minWidth',
|
|
@@ -69,4 +86,4 @@ const allowedProps: AllowedPropKeys = [
|
|
|
69
86
|
]
|
|
70
87
|
|
|
71
88
|
export type { DrawerLayoutProps, DrawerLayoutState, DrawerLayoutStyle }
|
|
72
|
-
export { allowedProps }
|
|
89
|
+
export { propTypes, allowedProps }
|
package/tsconfig.build.json
CHANGED
|
@@ -17,7 +17,9 @@
|
|
|
17
17
|
{ "path": "../ui-motion/tsconfig.build.json" },
|
|
18
18
|
{ "path": "../ui-portal/tsconfig.build.json" },
|
|
19
19
|
{ "path": "../ui-position/tsconfig.build.json" },
|
|
20
|
+
{ "path": "../ui-prop-types/tsconfig.build.json" },
|
|
20
21
|
{ "path": "../ui-react-utils/tsconfig.build.json" },
|
|
22
|
+
{ "path": "../ui-testable/tsconfig.build.json" },
|
|
21
23
|
{ "path": "../ui-utils/tsconfig.build.json" },
|
|
22
24
|
{ "path": "../ui-view/tsconfig.build.json" },
|
|
23
25
|
{ "path": "../uid/tsconfig.build.json" },
|