@instructure/ui-drawer-layout 11.6.0 → 11.6.1-snapshot-129
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 +36 -295
- package/es/DrawerLayout/{DrawerContent → v1/DrawerContent}/index.js +1 -1
- package/es/DrawerLayout/{DrawerTray → v1/DrawerTray}/index.js +1 -1
- package/es/DrawerLayout/{index.js → v1/index.js} +1 -1
- package/es/DrawerLayout/v2/DrawerContent/index.js +124 -0
- package/es/DrawerLayout/v2/DrawerContent/props.js +26 -0
- package/es/DrawerLayout/v2/DrawerContent/styles.js +51 -0
- package/es/DrawerLayout/v2/DrawerTray/index.js +227 -0
- package/es/DrawerLayout/v2/DrawerTray/props.js +26 -0
- package/es/DrawerLayout/v2/DrawerTray/styles.js +94 -0
- package/es/DrawerLayout/v2/__fixtures__/DrawerLayout.fixture.js +73 -0
- package/es/DrawerLayout/v2/index.js +224 -0
- package/es/DrawerLayout/v2/props.js +26 -0
- package/es/DrawerLayout/v2/styles.js +44 -0
- package/es/{index.js → exports/a.js} +1 -1
- package/es/exports/b.js +24 -0
- package/lib/DrawerLayout/{DrawerContent → v1/DrawerContent}/index.js +1 -1
- package/lib/DrawerLayout/{DrawerTray → v1/DrawerTray}/index.js +1 -1
- package/lib/DrawerLayout/v1/index.js +245 -0
- package/lib/DrawerLayout/v2/DrawerContent/index.js +129 -0
- package/lib/DrawerLayout/v2/DrawerContent/props.js +31 -0
- package/lib/DrawerLayout/v2/DrawerContent/styles.js +57 -0
- package/lib/DrawerLayout/v2/DrawerTray/index.js +232 -0
- package/lib/DrawerLayout/v2/DrawerTray/props.js +31 -0
- package/lib/DrawerLayout/v2/DrawerTray/styles.js +100 -0
- package/lib/DrawerLayout/v2/__fixtures__/DrawerLayout.fixture.js +79 -0
- package/lib/DrawerLayout/{index.js → v2/index.js} +1 -1
- package/lib/DrawerLayout/v2/props.js +31 -0
- package/lib/DrawerLayout/v2/styles.js +50 -0
- package/lib/{index.js → exports/a.js} +4 -4
- package/lib/exports/b.js +24 -0
- package/package.json +47 -25
- package/src/DrawerLayout/{DrawerContent → v1/DrawerContent}/index.tsx +1 -1
- package/src/DrawerLayout/{DrawerTray → v1/DrawerTray}/index.tsx +1 -1
- package/src/DrawerLayout/v1/index.tsx +334 -0
- package/src/DrawerLayout/v2/DrawerContent/index.tsx +147 -0
- package/src/DrawerLayout/v2/DrawerContent/props.ts +73 -0
- package/src/DrawerLayout/v2/DrawerContent/styles.ts +68 -0
- package/src/DrawerLayout/v2/DrawerTray/index.tsx +288 -0
- package/src/DrawerLayout/v2/DrawerTray/props.ts +228 -0
- package/src/DrawerLayout/v2/DrawerTray/styles.ts +106 -0
- package/src/DrawerLayout/v2/README.md +231 -0
- package/src/DrawerLayout/v2/__fixtures__/DrawerLayout.fixture.tsx +75 -0
- package/src/DrawerLayout/{index.tsx → v2/index.tsx} +1 -1
- package/src/DrawerLayout/v2/props.ts +72 -0
- package/src/DrawerLayout/v2/styles.ts +47 -0
- package/src/{index.ts → exports/a.ts} +4 -4
- package/src/exports/b.ts +29 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/DrawerLayout/v1/DrawerContent/index.d.ts.map +1 -0
- package/types/DrawerLayout/v1/DrawerContent/props.d.ts.map +1 -0
- package/types/DrawerLayout/v1/DrawerContent/styles.d.ts.map +1 -0
- package/types/DrawerLayout/v1/DrawerContent/theme.d.ts.map +1 -0
- package/types/DrawerLayout/v1/DrawerTray/index.d.ts.map +1 -0
- package/types/DrawerLayout/v1/DrawerTray/props.d.ts.map +1 -0
- package/types/DrawerLayout/v1/DrawerTray/styles.d.ts.map +1 -0
- package/types/DrawerLayout/v1/DrawerTray/theme.d.ts.map +1 -0
- package/types/DrawerLayout/v1/__fixtures__/DrawerLayout.fixture.d.ts.map +1 -0
- package/types/DrawerLayout/v1/index.d.ts.map +1 -0
- package/types/DrawerLayout/v1/props.d.ts.map +1 -0
- package/types/DrawerLayout/v1/styles.d.ts.map +1 -0
- package/types/DrawerLayout/v2/DrawerContent/index.d.ts +35 -0
- package/types/DrawerLayout/v2/DrawerContent/index.d.ts.map +1 -0
- package/types/DrawerLayout/v2/DrawerContent/props.d.ts +28 -0
- package/types/DrawerLayout/v2/DrawerContent/props.d.ts.map +1 -0
- package/types/DrawerLayout/v2/DrawerContent/styles.d.ts +16 -0
- package/types/DrawerLayout/v2/DrawerContent/styles.d.ts.map +1 -0
- package/types/DrawerLayout/v2/DrawerTray/index.d.ts +61 -0
- package/types/DrawerLayout/v2/DrawerTray/index.d.ts.map +1 -0
- package/types/DrawerLayout/v2/DrawerTray/props.d.ts +120 -0
- package/types/DrawerLayout/v2/DrawerTray/props.d.ts.map +1 -0
- package/types/DrawerLayout/v2/DrawerTray/styles.d.ts +16 -0
- package/types/DrawerLayout/v2/DrawerTray/styles.d.ts.map +1 -0
- package/types/DrawerLayout/v2/__fixtures__/DrawerLayout.fixture.d.ts +22 -0
- package/types/DrawerLayout/v2/__fixtures__/DrawerLayout.fixture.d.ts.map +1 -0
- package/types/DrawerLayout/v2/index.d.ts +146 -0
- package/types/DrawerLayout/v2/index.d.ts.map +1 -0
- package/types/DrawerLayout/v2/props.d.ts +33 -0
- package/types/DrawerLayout/v2/props.d.ts.map +1 -0
- package/types/DrawerLayout/v2/styles.d.ts +14 -0
- package/types/DrawerLayout/v2/styles.d.ts.map +1 -0
- package/types/exports/a.d.ts +5 -0
- package/types/exports/a.d.ts.map +1 -0
- package/types/exports/b.d.ts +5 -0
- package/types/exports/b.d.ts.map +1 -0
- package/types/DrawerLayout/DrawerContent/index.d.ts.map +0 -1
- package/types/DrawerLayout/DrawerContent/props.d.ts.map +0 -1
- package/types/DrawerLayout/DrawerContent/styles.d.ts.map +0 -1
- package/types/DrawerLayout/DrawerContent/theme.d.ts.map +0 -1
- package/types/DrawerLayout/DrawerTray/index.d.ts.map +0 -1
- package/types/DrawerLayout/DrawerTray/props.d.ts.map +0 -1
- package/types/DrawerLayout/DrawerTray/styles.d.ts.map +0 -1
- package/types/DrawerLayout/DrawerTray/theme.d.ts.map +0 -1
- package/types/DrawerLayout/__fixtures__/DrawerLayout.fixture.d.ts.map +0 -1
- package/types/DrawerLayout/index.d.ts.map +0 -1
- package/types/DrawerLayout/props.d.ts.map +0 -1
- package/types/DrawerLayout/styles.d.ts.map +0 -1
- package/types/index.d.ts +0 -5
- package/types/index.d.ts.map +0 -1
- /package/es/DrawerLayout/{DrawerContent → v1/DrawerContent}/props.js +0 -0
- /package/es/DrawerLayout/{DrawerContent → v1/DrawerContent}/styles.js +0 -0
- /package/es/DrawerLayout/{DrawerContent → v1/DrawerContent}/theme.js +0 -0
- /package/es/DrawerLayout/{DrawerTray → v1/DrawerTray}/props.js +0 -0
- /package/es/DrawerLayout/{DrawerTray → v1/DrawerTray}/styles.js +0 -0
- /package/es/DrawerLayout/{DrawerTray → v1/DrawerTray}/theme.js +0 -0
- /package/es/DrawerLayout/{__fixtures__ → v1/__fixtures__}/DrawerLayout.fixture.js +0 -0
- /package/es/DrawerLayout/{props.js → v1/props.js} +0 -0
- /package/es/DrawerLayout/{styles.js → v1/styles.js} +0 -0
- /package/lib/DrawerLayout/{DrawerContent → v1/DrawerContent}/props.js +0 -0
- /package/lib/DrawerLayout/{DrawerContent → v1/DrawerContent}/styles.js +0 -0
- /package/lib/DrawerLayout/{DrawerContent → v1/DrawerContent}/theme.js +0 -0
- /package/lib/DrawerLayout/{DrawerTray → v1/DrawerTray}/props.js +0 -0
- /package/lib/DrawerLayout/{DrawerTray → v1/DrawerTray}/styles.js +0 -0
- /package/lib/DrawerLayout/{DrawerTray → v1/DrawerTray}/theme.js +0 -0
- /package/lib/DrawerLayout/{__fixtures__ → v1/__fixtures__}/DrawerLayout.fixture.js +0 -0
- /package/lib/DrawerLayout/{props.js → v1/props.js} +0 -0
- /package/lib/DrawerLayout/{styles.js → v1/styles.js} +0 -0
- /package/src/DrawerLayout/{DrawerContent → v1/DrawerContent}/props.ts +0 -0
- /package/src/DrawerLayout/{DrawerContent → v1/DrawerContent}/styles.ts +0 -0
- /package/src/DrawerLayout/{DrawerContent → v1/DrawerContent}/theme.ts +0 -0
- /package/src/DrawerLayout/{DrawerTray → v1/DrawerTray}/props.ts +0 -0
- /package/src/DrawerLayout/{DrawerTray → v1/DrawerTray}/styles.ts +0 -0
- /package/src/DrawerLayout/{DrawerTray → v1/DrawerTray}/theme.ts +0 -0
- /package/src/DrawerLayout/{README.md → v1/README.md} +0 -0
- /package/src/DrawerLayout/{__fixtures__ → v1/__fixtures__}/DrawerLayout.fixture.tsx +0 -0
- /package/src/DrawerLayout/{props.ts → v1/props.ts} +0 -0
- /package/src/DrawerLayout/{styles.ts → v1/styles.ts} +0 -0
- /package/types/DrawerLayout/{DrawerContent → v1/DrawerContent}/index.d.ts +0 -0
- /package/types/DrawerLayout/{DrawerContent → v1/DrawerContent}/props.d.ts +0 -0
- /package/types/DrawerLayout/{DrawerContent → v1/DrawerContent}/styles.d.ts +0 -0
- /package/types/DrawerLayout/{DrawerContent → v1/DrawerContent}/theme.d.ts +0 -0
- /package/types/DrawerLayout/{DrawerTray → v1/DrawerTray}/index.d.ts +0 -0
- /package/types/DrawerLayout/{DrawerTray → v1/DrawerTray}/props.d.ts +0 -0
- /package/types/DrawerLayout/{DrawerTray → v1/DrawerTray}/styles.d.ts +0 -0
- /package/types/DrawerLayout/{DrawerTray → v1/DrawerTray}/theme.d.ts +0 -0
- /package/types/DrawerLayout/{__fixtures__ → v1/__fixtures__}/DrawerLayout.fixture.d.ts +0 -0
- /package/types/DrawerLayout/{index.d.ts → v1/index.d.ts} +0 -0
- /package/types/DrawerLayout/{props.d.ts → v1/props.d.ts} +0 -0
- /package/types/DrawerLayout/{styles.d.ts → v1/styles.d.ts} +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.allowedProps = void 0;
|
|
7
|
+
/*
|
|
8
|
+
* The MIT License (MIT)
|
|
9
|
+
*
|
|
10
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
11
|
+
*
|
|
12
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
* in the Software without restriction, including without limitation the rights
|
|
15
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
* furnished to do so, subject to the following conditions:
|
|
18
|
+
*
|
|
19
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
* copies or substantial portions of the Software.
|
|
21
|
+
*
|
|
22
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
* SOFTWARE.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
const allowedProps = exports.allowedProps = ['children', 'minWidth', 'onOverlayTrayChange', 'dir'];
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
/*
|
|
8
|
+
* The MIT License (MIT)
|
|
9
|
+
*
|
|
10
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
11
|
+
*
|
|
12
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
* in the Software without restriction, including without limitation the rights
|
|
15
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
* furnished to do so, subject to the following conditions:
|
|
18
|
+
*
|
|
19
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
* copies or substantial portions of the Software.
|
|
21
|
+
*
|
|
22
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
* SOFTWARE.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* ---
|
|
33
|
+
* private: true
|
|
34
|
+
* ---
|
|
35
|
+
* Generates the style object from the theme and provided additional information
|
|
36
|
+
* @param {Object} componentTheme The theme variable object.
|
|
37
|
+
* @param {Object} props the props of the component, the style is applied to
|
|
38
|
+
* @param {Object} state the state of the component, the style is applied to
|
|
39
|
+
* @return {Object} The final style object, which will be used in the component
|
|
40
|
+
*/
|
|
41
|
+
const generateStyle = () => {
|
|
42
|
+
return {
|
|
43
|
+
drawerLayout: {
|
|
44
|
+
label: 'drawerLayout',
|
|
45
|
+
position: 'relative',
|
|
46
|
+
height: '100%'
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
var _default = exports.default = generateStyle;
|
|
@@ -6,19 +6,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
Object.defineProperty(exports, "DrawerContent", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function () {
|
|
9
|
-
return
|
|
9
|
+
return _v.DrawerContent;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "DrawerLayout", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
get: function () {
|
|
15
|
-
return
|
|
15
|
+
return _v.DrawerLayout;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "DrawerTray", {
|
|
19
19
|
enumerable: true,
|
|
20
20
|
get: function () {
|
|
21
|
-
return
|
|
21
|
+
return _v.DrawerTray;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
-
var
|
|
24
|
+
var _v = require("../DrawerLayout/v1");
|
package/lib/exports/b.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "DrawerContent", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _v.DrawerContent;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "DrawerLayout", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _v.DrawerLayout;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "DrawerTray", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _v.DrawerTray;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
var _v = require("../DrawerLayout/v2");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-drawer-layout",
|
|
3
|
-
"version": "11.6.
|
|
3
|
+
"version": "11.6.1-snapshot-129",
|
|
4
4
|
"description": "A main-content-plus-tray layout component",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -15,28 +15,28 @@
|
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@babel/runtime": "^7.27.6",
|
|
18
|
-
"@instructure/console": "11.6.
|
|
19
|
-
"@instructure/debounce": "11.6.
|
|
20
|
-
"@instructure/emotion": "11.6.
|
|
21
|
-
"@instructure/shared-types": "11.6.
|
|
22
|
-
"@instructure/ui-dialog": "11.6.
|
|
23
|
-
"@instructure/ui-i18n": "11.6.
|
|
24
|
-
"@instructure/ui-
|
|
25
|
-
"@instructure/ui-
|
|
26
|
-
"@instructure/ui-
|
|
27
|
-
"@instructure/ui-
|
|
28
|
-
"@instructure/ui-view": "11.6.
|
|
29
|
-
"@instructure/ui-
|
|
30
|
-
"@instructure/ui-
|
|
31
|
-
"@instructure/uid": "11.6.
|
|
18
|
+
"@instructure/console": "11.6.1-snapshot-129",
|
|
19
|
+
"@instructure/debounce": "11.6.1-snapshot-129",
|
|
20
|
+
"@instructure/emotion": "11.6.1-snapshot-129",
|
|
21
|
+
"@instructure/shared-types": "11.6.1-snapshot-129",
|
|
22
|
+
"@instructure/ui-dialog": "11.6.1-snapshot-129",
|
|
23
|
+
"@instructure/ui-i18n": "11.6.1-snapshot-129",
|
|
24
|
+
"@instructure/ui-motion": "11.6.1-snapshot-129",
|
|
25
|
+
"@instructure/ui-dom-utils": "11.6.1-snapshot-129",
|
|
26
|
+
"@instructure/ui-portal": "11.6.1-snapshot-129",
|
|
27
|
+
"@instructure/ui-utils": "11.6.1-snapshot-129",
|
|
28
|
+
"@instructure/ui-view": "11.6.1-snapshot-129",
|
|
29
|
+
"@instructure/ui-react-utils": "11.6.1-snapshot-129",
|
|
30
|
+
"@instructure/ui-position": "11.6.1-snapshot-129",
|
|
31
|
+
"@instructure/uid": "11.6.1-snapshot-129"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@testing-library/jest-dom": "^6.6.3",
|
|
35
35
|
"@testing-library/react": "15.0.7",
|
|
36
36
|
"vitest": "^3.2.2",
|
|
37
|
-
"@instructure/ui-babel-preset": "11.6.
|
|
38
|
-
"@instructure/ui-buttons": "11.6.
|
|
39
|
-
"@instructure/ui-themes": "11.6.
|
|
37
|
+
"@instructure/ui-babel-preset": "11.6.1-snapshot-129",
|
|
38
|
+
"@instructure/ui-buttons": "11.6.1-snapshot-129",
|
|
39
|
+
"@instructure/ui-themes": "11.6.1-snapshot-129"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"react": ">=18 <=19"
|
|
@@ -46,17 +46,39 @@
|
|
|
46
46
|
},
|
|
47
47
|
"sideEffects": false,
|
|
48
48
|
"exports": {
|
|
49
|
-
".": {
|
|
50
|
-
"types": "./types/index.d.ts",
|
|
51
|
-
"import": "./es/index.js",
|
|
52
|
-
"require": "./lib/index.js",
|
|
53
|
-
"default": "./es/index.js"
|
|
54
|
-
},
|
|
55
49
|
"./lib/*": "./lib/*",
|
|
56
50
|
"./es/*": "./es/*",
|
|
57
51
|
"./types/*": "./types/*",
|
|
58
52
|
"./package.json": "./package.json",
|
|
59
|
-
"./src/*": "./src/*"
|
|
53
|
+
"./src/*": "./src/*",
|
|
54
|
+
".": {
|
|
55
|
+
"src": "./src/exports/a.ts",
|
|
56
|
+
"types": "./types/exports/a.d.ts",
|
|
57
|
+
"import": "./es/exports/a.js",
|
|
58
|
+
"require": "./lib/exports/a.js",
|
|
59
|
+
"default": "./es/exports/a.js"
|
|
60
|
+
},
|
|
61
|
+
"./v11_6": {
|
|
62
|
+
"src": "./src/exports/a.ts",
|
|
63
|
+
"types": "./types/exports/a.d.ts",
|
|
64
|
+
"import": "./es/exports/a.js",
|
|
65
|
+
"require": "./lib/exports/a.js",
|
|
66
|
+
"default": "./es/exports/a.js"
|
|
67
|
+
},
|
|
68
|
+
"./v11_7": {
|
|
69
|
+
"src": "./src/exports/b.ts",
|
|
70
|
+
"types": "./types/exports/b.d.ts",
|
|
71
|
+
"import": "./es/exports/b.js",
|
|
72
|
+
"require": "./lib/exports/b.js",
|
|
73
|
+
"default": "./es/exports/b.js"
|
|
74
|
+
},
|
|
75
|
+
"./latest": {
|
|
76
|
+
"src": "./src/exports/b.ts",
|
|
77
|
+
"types": "./types/exports/b.d.ts",
|
|
78
|
+
"import": "./es/exports/b.js",
|
|
79
|
+
"require": "./lib/exports/b.js",
|
|
80
|
+
"default": "./es/exports/b.js"
|
|
81
|
+
}
|
|
60
82
|
},
|
|
61
83
|
"scripts": {
|
|
62
84
|
"lint": "ui-scripts lint",
|
|
@@ -28,7 +28,7 @@ import { debounce } from '@instructure/debounce'
|
|
|
28
28
|
import type { Debounced } from '@instructure/debounce'
|
|
29
29
|
import { getBoundingClientRect } from '@instructure/ui-dom-utils'
|
|
30
30
|
import { omitProps } from '@instructure/ui-react-utils'
|
|
31
|
-
import { withStyle } from '@instructure/emotion'
|
|
31
|
+
import { withStyleLegacy as withStyle } from '@instructure/emotion'
|
|
32
32
|
|
|
33
33
|
import generateStyle from './styles'
|
|
34
34
|
import generateComponentTheme from './theme'
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
import { Component } from 'react'
|
|
26
26
|
|
|
27
|
-
import { withStyle } from '@instructure/emotion'
|
|
27
|
+
import { withStyleLegacy as withStyle } from '@instructure/emotion'
|
|
28
28
|
import { textDirectionContextConsumer } from '@instructure/ui-i18n'
|
|
29
29
|
import { Transition } from '@instructure/ui-motion'
|
|
30
30
|
import type { TransitionType } from '@instructure/ui-motion'
|
|
@@ -0,0 +1,334 @@
|
|
|
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 { ComponentElement, Children, Component, createContext } from 'react'
|
|
26
|
+
|
|
27
|
+
import { textDirectionContextConsumer } from '@instructure/ui-i18n'
|
|
28
|
+
import {
|
|
29
|
+
matchComponentTypes,
|
|
30
|
+
safeCloneElement,
|
|
31
|
+
withDeterministicId
|
|
32
|
+
} from '@instructure/ui-react-utils'
|
|
33
|
+
import { getBoundingClientRect } from '@instructure/ui-dom-utils'
|
|
34
|
+
import { createChainedFunction, px } from '@instructure/ui-utils'
|
|
35
|
+
import { logError as error } from '@instructure/console'
|
|
36
|
+
|
|
37
|
+
import { mirrorHorizontalPlacement } from '@instructure/ui-position'
|
|
38
|
+
import type { PlacementPropValues } from '@instructure/ui-position'
|
|
39
|
+
|
|
40
|
+
import { DrawerContent } from './DrawerContent'
|
|
41
|
+
import type {
|
|
42
|
+
DrawerLayoutContentProps,
|
|
43
|
+
DrawerContentSize
|
|
44
|
+
} from './DrawerContent/props'
|
|
45
|
+
import { DrawerTray } from './DrawerTray'
|
|
46
|
+
import type { DrawerLayoutTrayProps } from './DrawerTray/props'
|
|
47
|
+
|
|
48
|
+
import { withStyleLegacy as withStyle } from '@instructure/emotion'
|
|
49
|
+
import generateStyle from './styles'
|
|
50
|
+
|
|
51
|
+
import { allowedProps } from './props'
|
|
52
|
+
import type { DrawerLayoutProps, DrawerLayoutState } from './props'
|
|
53
|
+
|
|
54
|
+
type TrayChild = ComponentElement<
|
|
55
|
+
DrawerLayoutTrayProps & React.Attributes,
|
|
56
|
+
DrawerTray
|
|
57
|
+
>
|
|
58
|
+
type ContentChild = ComponentElement<
|
|
59
|
+
DrawerLayoutContentProps & React.Attributes,
|
|
60
|
+
DrawerContent
|
|
61
|
+
>
|
|
62
|
+
type DrawerChildren = (TrayChild | ContentChild)[]
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
---
|
|
66
|
+
category: components
|
|
67
|
+
---
|
|
68
|
+
**/
|
|
69
|
+
@withDeterministicId()
|
|
70
|
+
@withStyle(generateStyle, null)
|
|
71
|
+
@textDirectionContextConsumer()
|
|
72
|
+
class DrawerLayout extends Component<DrawerLayoutProps, DrawerLayoutState> {
|
|
73
|
+
static readonly componentId = 'DrawerLayout'
|
|
74
|
+
|
|
75
|
+
static locatorAttribute = 'data-drawer-layout'
|
|
76
|
+
static allowedProps = allowedProps
|
|
77
|
+
static defaultProps = {
|
|
78
|
+
minWidth: '30rem'
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
static Content = DrawerContent
|
|
82
|
+
static Tray = DrawerTray
|
|
83
|
+
|
|
84
|
+
constructor(props: DrawerLayoutProps) {
|
|
85
|
+
super(props)
|
|
86
|
+
|
|
87
|
+
this.state = {
|
|
88
|
+
shouldOverlayTray: false,
|
|
89
|
+
trayWidth: 0,
|
|
90
|
+
contentWidth: 0
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
this._id = props.deterministicId!()
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
private readonly _id: string
|
|
97
|
+
private _content: HTMLDivElement | null = null
|
|
98
|
+
private _tray: HTMLDivElement | null = null
|
|
99
|
+
|
|
100
|
+
ref: Element | null = null
|
|
101
|
+
|
|
102
|
+
handleRef = (el: Element | null) => {
|
|
103
|
+
this.ref = el
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
componentDidMount() {
|
|
107
|
+
this.props.makeStyles?.()
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
componentDidUpdate() {
|
|
111
|
+
this.props.makeStyles?.()
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
get trayProps() {
|
|
115
|
+
const tray = (
|
|
116
|
+
Children.toArray(this.props.children) as DrawerChildren
|
|
117
|
+
).filter((child) =>
|
|
118
|
+
matchComponentTypes<TrayChild>(child, [DrawerTray])
|
|
119
|
+
)[0] as TrayChild
|
|
120
|
+
return tray.props
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
get trayPlacement(): PlacementPropValues {
|
|
124
|
+
const { placement, dir = this.props.dir } = this.trayProps
|
|
125
|
+
const isRtl = dir === textDirectionContextConsumer.DIRECTION.rtl
|
|
126
|
+
return isRtl ? mirrorHorizontalPlacement(placement!, ' ') : placement!
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
get contentMargin() {
|
|
130
|
+
const trayWidth = this.state.trayWidth || 0
|
|
131
|
+
return this.state.shouldOverlayTray ? 0 : trayWidth
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
get contentStyle() {
|
|
135
|
+
const shouldOverlayTray = this.shouldOverlayTray(
|
|
136
|
+
this.props.minWidth!,
|
|
137
|
+
this.state.trayWidth,
|
|
138
|
+
this.state.contentWidth,
|
|
139
|
+
this.state.shouldOverlayTray
|
|
140
|
+
)
|
|
141
|
+
let marginLeft = 0
|
|
142
|
+
let marginRight = 0
|
|
143
|
+
|
|
144
|
+
if (!shouldOverlayTray) {
|
|
145
|
+
if (this.trayPlacement === 'start') {
|
|
146
|
+
marginLeft = this.contentMargin
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (this.trayPlacement === 'end') {
|
|
150
|
+
marginRight = this.contentMargin
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return {
|
|
155
|
+
marginLeft: `${marginLeft}px`,
|
|
156
|
+
marginRight: `${marginRight}px`
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
handleTrayContentRef = (el: HTMLDivElement | null) => {
|
|
161
|
+
this._tray = el
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
shouldOverlayTray(
|
|
165
|
+
minWidth: string,
|
|
166
|
+
trayWidth: number,
|
|
167
|
+
contentWidth: number,
|
|
168
|
+
trayIsOverlayed: boolean
|
|
169
|
+
) {
|
|
170
|
+
if (!this._content) return false
|
|
171
|
+
|
|
172
|
+
const minWidthPx = px(minWidth, this._content)
|
|
173
|
+
|
|
174
|
+
if (trayIsOverlayed) {
|
|
175
|
+
return contentWidth - trayWidth < minWidthPx
|
|
176
|
+
} else {
|
|
177
|
+
return contentWidth < minWidthPx
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
getNextState(
|
|
182
|
+
minWidth: string,
|
|
183
|
+
trayWidth: number,
|
|
184
|
+
contentWidth: number,
|
|
185
|
+
trayIsOverlayed: boolean
|
|
186
|
+
) {
|
|
187
|
+
const shouldOverlayTray = this.shouldOverlayTray(
|
|
188
|
+
minWidth,
|
|
189
|
+
trayWidth,
|
|
190
|
+
contentWidth,
|
|
191
|
+
trayIsOverlayed
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
return {
|
|
195
|
+
trayWidth,
|
|
196
|
+
contentWidth,
|
|
197
|
+
shouldOverlayTray
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
notifyOverlayTrayChange(shouldOverlayTray: boolean) {
|
|
202
|
+
const { onOverlayTrayChange } = this.props
|
|
203
|
+
|
|
204
|
+
if (typeof onOverlayTrayChange === 'function') {
|
|
205
|
+
onOverlayTrayChange(shouldOverlayTray)
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
handleContentSizeChange = ({ width }: DrawerContentSize) => {
|
|
210
|
+
this.setState((state, props) => {
|
|
211
|
+
const nextState = this.getNextState(
|
|
212
|
+
props.minWidth!,
|
|
213
|
+
state.trayWidth,
|
|
214
|
+
width,
|
|
215
|
+
state.shouldOverlayTray
|
|
216
|
+
)
|
|
217
|
+
if (state.shouldOverlayTray !== nextState.shouldOverlayTray) {
|
|
218
|
+
this.notifyOverlayTrayChange(nextState.shouldOverlayTray)
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return nextState
|
|
222
|
+
})
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
handleTraySizeChange = ({ width }: { width: number }) => {
|
|
226
|
+
this.setState((state, props) => {
|
|
227
|
+
const nextState = this.getNextState(
|
|
228
|
+
props.minWidth!,
|
|
229
|
+
width,
|
|
230
|
+
state.contentWidth,
|
|
231
|
+
true
|
|
232
|
+
)
|
|
233
|
+
|
|
234
|
+
if (state.shouldOverlayTray !== nextState.shouldOverlayTray) {
|
|
235
|
+
this.notifyOverlayTrayChange(nextState.shouldOverlayTray)
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
return nextState
|
|
239
|
+
})
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
handleTrayTransitionEnter = () => {
|
|
243
|
+
let width = 0
|
|
244
|
+
|
|
245
|
+
if (this._tray) {
|
|
246
|
+
width = getBoundingClientRect(this._tray).width
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
this.handleTraySizeChange({ width })
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
handleTrayTransitionExit = () => {
|
|
253
|
+
this.handleTraySizeChange({ width: 0 })
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
renderChildren() {
|
|
257
|
+
let trayCount = 0
|
|
258
|
+
let contentCount = 0
|
|
259
|
+
|
|
260
|
+
const children = Children.map(
|
|
261
|
+
this.props.children as DrawerChildren,
|
|
262
|
+
(child, _index) => {
|
|
263
|
+
if (matchComponentTypes<TrayChild>(child, [DrawerTray])) {
|
|
264
|
+
trayCount++
|
|
265
|
+
return safeCloneElement(child, {
|
|
266
|
+
label: child.props.label,
|
|
267
|
+
key: child.props.label,
|
|
268
|
+
[DrawerTray.locatorAttribute]: this._id,
|
|
269
|
+
contentRef: this.handleTrayContentRef,
|
|
270
|
+
onEnter: this.handleTrayTransitionEnter,
|
|
271
|
+
onExit: this.handleTrayTransitionExit
|
|
272
|
+
}) as TrayChild
|
|
273
|
+
} else if (matchComponentTypes<ContentChild>(child, [DrawerContent])) {
|
|
274
|
+
contentCount++
|
|
275
|
+
|
|
276
|
+
const handleContentRef = (el: HTMLDivElement | null) => {
|
|
277
|
+
const { contentRef } = child.props
|
|
278
|
+
|
|
279
|
+
this._content = el
|
|
280
|
+
|
|
281
|
+
if (typeof contentRef === 'function') {
|
|
282
|
+
contentRef(el)
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
return this.state.trayWidth !== null
|
|
287
|
+
? (safeCloneElement(child, {
|
|
288
|
+
label: child.props.label,
|
|
289
|
+
key: child.props.label,
|
|
290
|
+
[DrawerContent.locatorAttribute]: this._id,
|
|
291
|
+
style: this.contentStyle,
|
|
292
|
+
onSizeChange: createChainedFunction(
|
|
293
|
+
this.handleContentSizeChange,
|
|
294
|
+
child.props.onSizeChange
|
|
295
|
+
),
|
|
296
|
+
contentRef: handleContentRef
|
|
297
|
+
}) as ContentChild)
|
|
298
|
+
: null
|
|
299
|
+
} else {
|
|
300
|
+
return child as ContentChild | TrayChild
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
)
|
|
304
|
+
|
|
305
|
+
error(
|
|
306
|
+
trayCount <= 1,
|
|
307
|
+
`[DrawerLayout] Only one 'DrawerTray' per 'DrawerLayout' is supported.`
|
|
308
|
+
)
|
|
309
|
+
error(
|
|
310
|
+
contentCount <= 1,
|
|
311
|
+
`[DrawerLayout] Only one 'DrawerContent' per 'DrawerLayout' is supported.`
|
|
312
|
+
)
|
|
313
|
+
return children
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
render() {
|
|
317
|
+
const props = { [DrawerLayout.locatorAttribute]: this._id }
|
|
318
|
+
return (
|
|
319
|
+
<DrawerLayoutContext.Provider value={this.state.shouldOverlayTray}>
|
|
320
|
+
<div
|
|
321
|
+
{...props}
|
|
322
|
+
css={this.props.styles?.drawerLayout}
|
|
323
|
+
ref={this.handleRef}
|
|
324
|
+
data-cid="DrawerLayout"
|
|
325
|
+
>
|
|
326
|
+
{this.renderChildren()}
|
|
327
|
+
</div>
|
|
328
|
+
</DrawerLayoutContext.Provider>
|
|
329
|
+
)
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
export default DrawerLayout
|
|
333
|
+
export { DrawerLayout, DrawerContent, DrawerTray }
|
|
334
|
+
export const DrawerLayoutContext = createContext(false)
|