@instructure/ui-overlays 11.7.2-snapshot-12 → 11.7.2-snapshot-18
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 -2
- package/es/Mask/v2/MaskCounter.js +44 -0
- package/es/Mask/v2/index.js +100 -0
- package/es/Mask/v2/props.js +26 -0
- package/es/Mask/v2/styles.js +77 -0
- package/es/Overlay/v1/index.js +3 -1
- package/es/exports/b.js +25 -0
- package/lib/Mask/v2/MaskCounter.js +50 -0
- package/lib/Mask/v2/index.js +106 -0
- package/lib/Mask/v2/props.js +31 -0
- package/lib/Mask/v2/styles.js +83 -0
- package/lib/Overlay/v1/index.js +3 -1
- package/lib/exports/b.js +19 -0
- package/package.json +25 -25
- package/src/Mask/v2/MaskCounter.ts +47 -0
- package/src/Mask/v2/README.md +56 -0
- package/src/Mask/v2/index.tsx +119 -0
- package/src/Mask/v2/props.ts +58 -0
- package/src/Mask/v2/styles.ts +76 -0
- package/src/Overlay/v1/index.tsx +1 -1
- package/src/exports/b.ts +28 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Mask/v2/MaskCounter.d.ts +8 -0
- package/types/Mask/v2/MaskCounter.d.ts.map +1 -0
- package/types/Mask/v2/index.d.ts +32 -0
- package/types/Mask/v2/index.d.ts.map +1 -0
- package/types/Mask/v2/props.d.ts +21 -0
- package/types/Mask/v2/props.d.ts.map +1 -0
- package/types/Mask/v2/styles.d.ts +16 -0
- package/types/Mask/v2/styles.d.ts.map +1 -0
- package/types/Overlay/v1/index.d.ts.map +1 -1
- package/types/exports/b.d.ts +5 -0
- package/types/exports/b.d.ts.map +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,9 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [11.7.2-snapshot-
|
|
6
|
+
## [11.7.2-snapshot-18](https://github.com/instructure/instructure-ui/compare/v11.7.1...v11.7.2-snapshot-18) (2026-04-01)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **many:** small fixes for doc and fix component directory mapping in "dev" script ([39f0c99](https://github.com/instructure/instructure-ui/commit/39f0c991315e39d30e1f24b3142b986d5b9041ee))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* **ui-overlays:** rework Mask ([335cc5b](https://github.com/instructure/instructure-ui/commit/335cc5b00b1a2e346343c79001606f1782ceb9a1))
|
|
9
17
|
|
|
10
18
|
|
|
11
19
|
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
const MaskCounter = (() => {
|
|
26
|
+
let counter = 0;
|
|
27
|
+
const getCounter = () => counter;
|
|
28
|
+
const setCounter = value => {
|
|
29
|
+
counter = value;
|
|
30
|
+
};
|
|
31
|
+
const incrementCounter = () => {
|
|
32
|
+
setCounter(getCounter() + 1);
|
|
33
|
+
};
|
|
34
|
+
const decrementCounter = () => {
|
|
35
|
+
setCounter(getCounter() - 1);
|
|
36
|
+
};
|
|
37
|
+
return {
|
|
38
|
+
getCounter,
|
|
39
|
+
setCounter,
|
|
40
|
+
incrementCounter,
|
|
41
|
+
decrementCounter
|
|
42
|
+
};
|
|
43
|
+
})();
|
|
44
|
+
export default MaskCounter;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
var _dec, _class, _Mask;
|
|
2
|
+
/*
|
|
3
|
+
* The MIT License (MIT)
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
6
|
+
*
|
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
* furnished to do so, subject to the following conditions:
|
|
13
|
+
*
|
|
14
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
* copies or substantial portions of the Software.
|
|
16
|
+
*
|
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
* SOFTWARE.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import { Component } from 'react';
|
|
27
|
+
import noScroll from 'no-scroll';
|
|
28
|
+
import { withStyle } from '@instructure/emotion';
|
|
29
|
+
import { ensureSingleChild, omitProps } from '@instructure/ui-react-utils';
|
|
30
|
+
import generateStyle from "./styles.js";
|
|
31
|
+
import { allowedProps } from "./props.js";
|
|
32
|
+
import MaskCounter from "./MaskCounter.js";
|
|
33
|
+
/**
|
|
34
|
+
---
|
|
35
|
+
category: components/utilities
|
|
36
|
+
---
|
|
37
|
+
**/
|
|
38
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
39
|
+
let Mask = (_dec = withStyle(generateStyle), _dec(_class = (_Mask = class Mask extends Component {
|
|
40
|
+
constructor(...args) {
|
|
41
|
+
super(...args);
|
|
42
|
+
this.ref = null;
|
|
43
|
+
this.handleElementRef = el => {
|
|
44
|
+
const elementRef = this.props.elementRef;
|
|
45
|
+
this.ref = el;
|
|
46
|
+
if (typeof elementRef === 'function') {
|
|
47
|
+
elementRef(el);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
// It can be a ref for any type of child
|
|
51
|
+
this._content = void 0;
|
|
52
|
+
this.contentRef = el => {
|
|
53
|
+
this._content = el;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
componentDidMount() {
|
|
57
|
+
var _this$props$makeStyle, _this$props;
|
|
58
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
59
|
+
if (this.props.fullscreen) {
|
|
60
|
+
noScroll.on();
|
|
61
|
+
MaskCounter.incrementCounter();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
componentDidUpdate() {
|
|
65
|
+
var _this$props$makeStyle2, _this$props2;
|
|
66
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
67
|
+
}
|
|
68
|
+
componentWillUnmount() {
|
|
69
|
+
if (this.props.fullscreen) {
|
|
70
|
+
MaskCounter.decrementCounter();
|
|
71
|
+
if (MaskCounter.getCounter() <= 0) {
|
|
72
|
+
noScroll.off();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
render() {
|
|
77
|
+
var _this$props$styles;
|
|
78
|
+
const content = ensureSingleChild(this.props.children, {
|
|
79
|
+
ref: this.contentRef
|
|
80
|
+
});
|
|
81
|
+
const props = {
|
|
82
|
+
...omitProps(this.props, Mask.allowedProps),
|
|
83
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.mask,
|
|
84
|
+
ref: this.handleElementRef
|
|
85
|
+
};
|
|
86
|
+
if (typeof this.props.onClick === 'function') {
|
|
87
|
+
props.onClick = this.props.onClick;
|
|
88
|
+
props.tabIndex = -1;
|
|
89
|
+
}
|
|
90
|
+
return _jsx("span", {
|
|
91
|
+
...props,
|
|
92
|
+
children: content
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}, _Mask.displayName = "Mask", _Mask.componentId = 'Mask', _Mask.allowedProps = allowedProps, _Mask.defaultProps = {
|
|
96
|
+
placement: 'center',
|
|
97
|
+
fullscreen: false
|
|
98
|
+
}, _Mask)) || _class);
|
|
99
|
+
export default Mask;
|
|
100
|
+
export { Mask };
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
const allowedProps = ['placement', 'fullscreen', 'children', 'onClick', 'elementRef'];
|
|
26
|
+
export { allowedProps };
|
|
@@ -0,0 +1,77 @@
|
|
|
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
|
+
/**
|
|
26
|
+
* ---
|
|
27
|
+
* private: true
|
|
28
|
+
* ---
|
|
29
|
+
* Generates the style object from the theme and provided additional information
|
|
30
|
+
* @param {Object} componentTheme The theme variable object.
|
|
31
|
+
* @param {Object} props the props of the component, the style is applied to
|
|
32
|
+
* @param {Object} sharedTokens Shared token object that stores common values for the theme.
|
|
33
|
+
* @param {Object} state the state of the component, the style is applied to
|
|
34
|
+
* @return {Object} The final style object, which will be used in the component
|
|
35
|
+
*/
|
|
36
|
+
const generateStyle = (componentTheme, props) => {
|
|
37
|
+
const placement = props.placement,
|
|
38
|
+
fullscreen = props.fullscreen;
|
|
39
|
+
const positionStyles = fullscreen ? {
|
|
40
|
+
position: 'fixed'
|
|
41
|
+
} : {
|
|
42
|
+
position: 'absolute'
|
|
43
|
+
};
|
|
44
|
+
const placementStyles = {
|
|
45
|
+
top: {
|
|
46
|
+
alignItems: 'flex-start'
|
|
47
|
+
},
|
|
48
|
+
center: {
|
|
49
|
+
alignItems: 'center'
|
|
50
|
+
},
|
|
51
|
+
bottom: {
|
|
52
|
+
alignItems: 'flex-end'
|
|
53
|
+
},
|
|
54
|
+
stretch: {
|
|
55
|
+
alignItems: 'stretch'
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
return {
|
|
59
|
+
mask: {
|
|
60
|
+
label: 'mask',
|
|
61
|
+
boxSizing: 'border-box',
|
|
62
|
+
background: componentTheme.backgroundColor,
|
|
63
|
+
top: 0,
|
|
64
|
+
left: 0,
|
|
65
|
+
right: 0,
|
|
66
|
+
bottom: 0,
|
|
67
|
+
overflow: 'auto',
|
|
68
|
+
display: 'flex',
|
|
69
|
+
justifyContent: 'center',
|
|
70
|
+
outline: 'none',
|
|
71
|
+
zIndex: 9999,
|
|
72
|
+
...positionStyles,
|
|
73
|
+
...placementStyles[placement]
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
export default generateStyle;
|
package/es/Overlay/v1/index.js
CHANGED
|
@@ -95,7 +95,9 @@ class Overlay extends Component {
|
|
|
95
95
|
unmountOnExit: true,
|
|
96
96
|
type: this.props.transition,
|
|
97
97
|
onExited: createChainedFunction(this.handleTransitionExited, this.props.onExited),
|
|
98
|
-
children:
|
|
98
|
+
children: _jsx("div", {
|
|
99
|
+
children: content
|
|
100
|
+
})
|
|
99
101
|
});
|
|
100
102
|
}
|
|
101
103
|
render() {
|
package/es/exports/b.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
export { Mask } from "../Mask/v2/index.js";
|
|
25
|
+
export { Overlay } from "../Overlay/v1/index.js";
|
|
@@ -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
|
+
const MaskCounter = (() => {
|
|
32
|
+
let counter = 0;
|
|
33
|
+
const getCounter = () => counter;
|
|
34
|
+
const setCounter = value => {
|
|
35
|
+
counter = value;
|
|
36
|
+
};
|
|
37
|
+
const incrementCounter = () => {
|
|
38
|
+
setCounter(getCounter() + 1);
|
|
39
|
+
};
|
|
40
|
+
const decrementCounter = () => {
|
|
41
|
+
setCounter(getCounter() - 1);
|
|
42
|
+
};
|
|
43
|
+
return {
|
|
44
|
+
getCounter,
|
|
45
|
+
setCounter,
|
|
46
|
+
incrementCounter,
|
|
47
|
+
decrementCounter
|
|
48
|
+
};
|
|
49
|
+
})();
|
|
50
|
+
var _default = exports.default = MaskCounter;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = exports.Mask = void 0;
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _noScroll = _interopRequireDefault(require("no-scroll"));
|
|
10
|
+
var _emotion = require("@instructure/emotion");
|
|
11
|
+
var _ensureSingleChild = require("@instructure/ui-react-utils/lib/ensureSingleChild.js");
|
|
12
|
+
var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
|
13
|
+
var _styles = _interopRequireDefault(require("./styles"));
|
|
14
|
+
var _props = require("./props");
|
|
15
|
+
var _MaskCounter = _interopRequireDefault(require("./MaskCounter"));
|
|
16
|
+
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
17
|
+
var _dec, _class, _Mask;
|
|
18
|
+
/*
|
|
19
|
+
* The MIT License (MIT)
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
22
|
+
*
|
|
23
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
24
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
25
|
+
* in the Software without restriction, including without limitation the rights
|
|
26
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
27
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
28
|
+
* furnished to do so, subject to the following conditions:
|
|
29
|
+
*
|
|
30
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
31
|
+
* copies or substantial portions of the Software.
|
|
32
|
+
*
|
|
33
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
34
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
35
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
36
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
37
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
38
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
39
|
+
* SOFTWARE.
|
|
40
|
+
*/
|
|
41
|
+
/**
|
|
42
|
+
---
|
|
43
|
+
category: components/utilities
|
|
44
|
+
---
|
|
45
|
+
**/
|
|
46
|
+
let Mask = exports.Mask = (_dec = (0, _emotion.withStyle)(_styles.default), _dec(_class = (_Mask = class Mask extends _react.Component {
|
|
47
|
+
constructor(...args) {
|
|
48
|
+
super(...args);
|
|
49
|
+
this.ref = null;
|
|
50
|
+
this.handleElementRef = el => {
|
|
51
|
+
const elementRef = this.props.elementRef;
|
|
52
|
+
this.ref = el;
|
|
53
|
+
if (typeof elementRef === 'function') {
|
|
54
|
+
elementRef(el);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
// It can be a ref for any type of child
|
|
58
|
+
this._content = void 0;
|
|
59
|
+
this.contentRef = el => {
|
|
60
|
+
this._content = el;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
componentDidMount() {
|
|
64
|
+
var _this$props$makeStyle, _this$props;
|
|
65
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
66
|
+
if (this.props.fullscreen) {
|
|
67
|
+
_noScroll.default.on();
|
|
68
|
+
_MaskCounter.default.incrementCounter();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
componentDidUpdate() {
|
|
72
|
+
var _this$props$makeStyle2, _this$props2;
|
|
73
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
74
|
+
}
|
|
75
|
+
componentWillUnmount() {
|
|
76
|
+
if (this.props.fullscreen) {
|
|
77
|
+
_MaskCounter.default.decrementCounter();
|
|
78
|
+
if (_MaskCounter.default.getCounter() <= 0) {
|
|
79
|
+
_noScroll.default.off();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
render() {
|
|
84
|
+
var _this$props$styles;
|
|
85
|
+
const content = (0, _ensureSingleChild.ensureSingleChild)(this.props.children, {
|
|
86
|
+
ref: this.contentRef
|
|
87
|
+
});
|
|
88
|
+
const props = {
|
|
89
|
+
...(0, _omitProps.omitProps)(this.props, Mask.allowedProps),
|
|
90
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.mask,
|
|
91
|
+
ref: this.handleElementRef
|
|
92
|
+
};
|
|
93
|
+
if (typeof this.props.onClick === 'function') {
|
|
94
|
+
props.onClick = this.props.onClick;
|
|
95
|
+
props.tabIndex = -1;
|
|
96
|
+
}
|
|
97
|
+
return (0, _jsxRuntime.jsx)("span", {
|
|
98
|
+
...props,
|
|
99
|
+
children: content
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}, _Mask.displayName = "Mask", _Mask.componentId = 'Mask', _Mask.allowedProps = _props.allowedProps, _Mask.defaultProps = {
|
|
103
|
+
placement: 'center',
|
|
104
|
+
fullscreen: false
|
|
105
|
+
}, _Mask)) || _class);
|
|
106
|
+
var _default = exports.default = Mask;
|
|
@@ -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 = ['placement', 'fullscreen', 'children', 'onClick', 'elementRef'];
|
|
@@ -0,0 +1,83 @@
|
|
|
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} sharedTokens Shared token object that stores common values for the theme.
|
|
39
|
+
* @param {Object} state the state of the component, the style is applied to
|
|
40
|
+
* @return {Object} The final style object, which will be used in the component
|
|
41
|
+
*/
|
|
42
|
+
const generateStyle = (componentTheme, props) => {
|
|
43
|
+
const placement = props.placement,
|
|
44
|
+
fullscreen = props.fullscreen;
|
|
45
|
+
const positionStyles = fullscreen ? {
|
|
46
|
+
position: 'fixed'
|
|
47
|
+
} : {
|
|
48
|
+
position: 'absolute'
|
|
49
|
+
};
|
|
50
|
+
const placementStyles = {
|
|
51
|
+
top: {
|
|
52
|
+
alignItems: 'flex-start'
|
|
53
|
+
},
|
|
54
|
+
center: {
|
|
55
|
+
alignItems: 'center'
|
|
56
|
+
},
|
|
57
|
+
bottom: {
|
|
58
|
+
alignItems: 'flex-end'
|
|
59
|
+
},
|
|
60
|
+
stretch: {
|
|
61
|
+
alignItems: 'stretch'
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
return {
|
|
65
|
+
mask: {
|
|
66
|
+
label: 'mask',
|
|
67
|
+
boxSizing: 'border-box',
|
|
68
|
+
background: componentTheme.backgroundColor,
|
|
69
|
+
top: 0,
|
|
70
|
+
left: 0,
|
|
71
|
+
right: 0,
|
|
72
|
+
bottom: 0,
|
|
73
|
+
overflow: 'auto',
|
|
74
|
+
display: 'flex',
|
|
75
|
+
justifyContent: 'center',
|
|
76
|
+
outline: 'none',
|
|
77
|
+
zIndex: 9999,
|
|
78
|
+
...positionStyles,
|
|
79
|
+
...placementStyles[placement]
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
var _default = exports.default = generateStyle;
|
package/lib/Overlay/v1/index.js
CHANGED
|
@@ -101,7 +101,9 @@ category: components
|
|
|
101
101
|
unmountOnExit: true,
|
|
102
102
|
type: this.props.transition,
|
|
103
103
|
onExited: (0, _createChainedFunction.createChainedFunction)(this.handleTransitionExited, this.props.onExited),
|
|
104
|
-
children:
|
|
104
|
+
children: (0, _jsxRuntime.jsx)("div", {
|
|
105
|
+
children: content
|
|
106
|
+
})
|
|
105
107
|
});
|
|
106
108
|
}
|
|
107
109
|
render() {
|
package/lib/exports/b.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "Mask", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _v.Mask;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "Overlay", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _v2.Overlay;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _v = require("../Mask/v2");
|
|
19
|
+
var _v2 = require("../Overlay/v1");
|