@instructure/ui-pages 11.7.8 → 11.7.9-pr-snapshot-1792147648392
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 +13 -0
- package/es/Pages/v1/Page/index.js +61 -89
- package/es/Pages/v1/Page/props.js +7 -26
- package/es/Pages/v1/PagesContext.js +4 -28
- package/es/Pages/v1/index.js +117 -142
- package/es/Pages/v1/props.js +8 -26
- package/es/Pages/v1/styles.js +12 -46
- package/es/Pages/v1/theme.js +10 -42
- package/es/exports/a.js +1 -24
- package/package.json +13 -19
- package/tsconfig.build.json +0 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/lib/Pages/v1/Page/index.js +0 -109
- package/lib/Pages/v1/Page/props.js +0 -31
- package/lib/Pages/v1/PagesContext.js +0 -36
- package/lib/Pages/v1/index.js +0 -169
- package/lib/Pages/v1/props.js +0 -31
- package/lib/Pages/v1/styles.js +0 -53
- package/lib/Pages/v1/theme.js +0 -49
- package/lib/exports/a.js +0 -19
- package/lib/package.json +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,19 @@
|
|
|
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.9-pr-snapshot-1792147648392](https://github.com/instructure/instructure-ui/compare/v11.7.8...v11.7.9-pr-snapshot-1792147648392) (2026-10-16)
|
|
7
|
+
|
|
8
|
+
### Build System
|
|
9
|
+
|
|
10
|
+
* **many:** replace babel with swc ([7e36c54](https://github.com/instructure/instructure-ui/commit/7e36c54d240b4fa483801c03ab18e7f860f561e2))
|
|
11
|
+
|
|
12
|
+
### BREAKING CHANGES
|
|
13
|
+
|
|
14
|
+
* **many:** `@instructure/ui-babel-preset` and
|
|
15
|
+
`@instructure/browserslist-config-instui` are removed and will no longer be
|
|
16
|
+
published. Packages depend on `@swc/helpers` instead of `@babel/runtime`.
|
|
17
|
+
|
|
18
|
+
|
|
6
19
|
## [11.7.8](https://github.com/instructure/instructure-ui/compare/v11.7.7...v11.7.8) (2026-10-02)
|
|
7
20
|
|
|
8
21
|
**Note:** Version bump only for package @instructure/ui-pages
|
|
@@ -1,102 +1,74 @@
|
|
|
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
|
-
|
|
1
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
25
2
|
import { Component } from 'react';
|
|
26
3
|
import { findDOMNode, findTabbable } from '@instructure/ui-dom-utils';
|
|
27
4
|
import { logError as error } from '@instructure/console';
|
|
28
5
|
import { View } from '@instructure/ui-view/v11_6';
|
|
29
6
|
import { PagesContext } from '../PagesContext.js';
|
|
30
7
|
import { allowedProps } from './props.js';
|
|
31
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
32
|
-
/**
|
|
33
|
-
---
|
|
34
|
-
parent: Pages
|
|
35
|
-
id: Pages.Page
|
|
36
|
-
---
|
|
37
|
-
**/
|
|
38
8
|
class Page extends Component {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
9
|
+
static{
|
|
10
|
+
this.displayName = 'Page';
|
|
11
|
+
}
|
|
12
|
+
static{
|
|
13
|
+
this.componentId = 'Pages.Page';
|
|
14
|
+
}
|
|
15
|
+
static{
|
|
16
|
+
this.allowedProps = allowedProps;
|
|
17
|
+
}
|
|
18
|
+
static{
|
|
19
|
+
this.defaultProps = {
|
|
20
|
+
defaultFocusElement: null,
|
|
21
|
+
padding: 'small',
|
|
22
|
+
textAlign: 'start',
|
|
23
|
+
children: null
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
get _content() {
|
|
27
|
+
void 0;
|
|
28
|
+
return this.ref;
|
|
29
|
+
}
|
|
30
|
+
get defaultFocusElement() {
|
|
31
|
+
let { defaultFocusElement } = this.props;
|
|
32
|
+
if (typeof defaultFocusElement === 'function') {
|
|
33
|
+
defaultFocusElement = defaultFocusElement();
|
|
34
|
+
}
|
|
35
|
+
if (defaultFocusElement) {
|
|
36
|
+
defaultFocusElement = findDOMNode(defaultFocusElement);
|
|
37
|
+
}
|
|
38
|
+
if (!defaultFocusElement) {
|
|
39
|
+
const tabbable = findTabbable(this.ref);
|
|
40
|
+
defaultFocusElement = tabbable && tabbable[0];
|
|
41
|
+
}
|
|
42
|
+
error(defaultFocusElement && !!defaultFocusElement.focus, '[Page] A default focusable element is required or focus will be lost.');
|
|
43
|
+
return defaultFocusElement;
|
|
44
|
+
}
|
|
45
|
+
get focusable() {
|
|
46
|
+
const element = this.defaultFocusElement;
|
|
47
|
+
return !!element && typeof element.focus === 'function';
|
|
61
48
|
}
|
|
62
|
-
|
|
63
|
-
|
|
49
|
+
focus() {
|
|
50
|
+
if (this.focusable) {
|
|
51
|
+
;
|
|
52
|
+
this.defaultFocusElement.focus();
|
|
53
|
+
}
|
|
64
54
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
55
|
+
render() {
|
|
56
|
+
const { children, ...props } = this.props;
|
|
57
|
+
return /*#__PURE__*/ _jsx(PagesContext.Consumer, {
|
|
58
|
+
children: ({ history, navigateToPreviousPage })=>/*#__PURE__*/ _jsx(View, {
|
|
59
|
+
as: "div",
|
|
60
|
+
padding: props.padding,
|
|
61
|
+
textAlign: props.textAlign,
|
|
62
|
+
elementRef: this.handleRef,
|
|
63
|
+
children: children && typeof children === 'function' ? children(history, navigateToPreviousPage) : children
|
|
64
|
+
})
|
|
65
|
+
});
|
|
68
66
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const element = this.defaultFocusElement;
|
|
74
|
-
return !!element && typeof element.focus === 'function';
|
|
75
|
-
}
|
|
76
|
-
focus() {
|
|
77
|
-
if (this.focusable) {
|
|
78
|
-
;
|
|
79
|
-
this.defaultFocusElement.focus();
|
|
67
|
+
constructor(...args){
|
|
68
|
+
super(...args), this.ref = null, this.handleRef = (el)=>{
|
|
69
|
+
this.ref = el;
|
|
70
|
+
};
|
|
80
71
|
}
|
|
81
|
-
}
|
|
82
|
-
render() {
|
|
83
|
-
const {
|
|
84
|
-
children,
|
|
85
|
-
...props
|
|
86
|
-
} = this.props;
|
|
87
|
-
return _jsx(PagesContext.Consumer, {
|
|
88
|
-
children: ({
|
|
89
|
-
history,
|
|
90
|
-
navigateToPreviousPage
|
|
91
|
-
}) => _jsx(View, {
|
|
92
|
-
as: "div",
|
|
93
|
-
padding: props.padding,
|
|
94
|
-
textAlign: props.textAlign,
|
|
95
|
-
elementRef: this.handleRef,
|
|
96
|
-
children: children && typeof children === 'function' ? children(history, navigateToPreviousPage) : children
|
|
97
|
-
})
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
72
|
}
|
|
101
73
|
export default Page;
|
|
102
|
-
export { Page };
|
|
74
|
+
export { Page };
|
|
@@ -1,26 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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 = ['children', 'defaultFocusElement', 'padding', 'textAlign'];
|
|
26
|
-
export { allowedProps };
|
|
1
|
+
const allowedProps = [
|
|
2
|
+
'children',
|
|
3
|
+
'defaultFocusElement',
|
|
4
|
+
'padding',
|
|
5
|
+
'textAlign'
|
|
6
|
+
];
|
|
7
|
+
export { allowedProps };
|
|
@@ -1,31 +1,7 @@
|
|
|
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
1
|
import { createContext } from 'react';
|
|
26
|
-
const PagesContext =
|
|
27
|
-
|
|
28
|
-
|
|
2
|
+
const PagesContext = createContext({
|
|
3
|
+
history: [],
|
|
4
|
+
navigateToPreviousPage: ()=>{}
|
|
29
5
|
});
|
|
30
6
|
export default PagesContext;
|
|
31
|
-
export { PagesContext };
|
|
7
|
+
export { PagesContext };
|
package/es/Pages/v1/index.js
CHANGED
|
@@ -1,28 +1,5 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
1
|
+
import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate";
|
|
2
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
26
3
|
import { Children, Component } from 'react';
|
|
27
4
|
import { View } from '@instructure/ui-view/v11_6';
|
|
28
5
|
import { containsActiveElement, findTabbable } from '@instructure/ui-dom-utils';
|
|
@@ -34,123 +11,121 @@ import generateStyle from './styles.js';
|
|
|
34
11
|
import generateComponentTheme from './theme.js';
|
|
35
12
|
import { PagesContext } from './PagesContext.js';
|
|
36
13
|
import { allowedProps } from './props.js';
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
};
|
|
80
|
-
componentDidUpdate() {
|
|
81
|
-
const {
|
|
82
|
-
activePageIndex
|
|
83
|
-
} = this.props;
|
|
84
|
-
const {
|
|
85
|
-
history
|
|
86
|
-
} = this.state;
|
|
87
|
-
if (typeof activePageIndex === 'number' && (history.length === 0 || activePageIndex !== history[history.length - 1])) {
|
|
88
|
-
this.setState({
|
|
89
|
-
history: [...history, activePageIndex]
|
|
90
|
-
});
|
|
14
|
+
class Pages extends Component {
|
|
15
|
+
static{
|
|
16
|
+
this.displayName = 'Pages';
|
|
17
|
+
}
|
|
18
|
+
static{
|
|
19
|
+
this.componentId = 'Pages';
|
|
20
|
+
}
|
|
21
|
+
static{
|
|
22
|
+
this.allowedProps = allowedProps;
|
|
23
|
+
}
|
|
24
|
+
static{
|
|
25
|
+
this.defaultProps = {
|
|
26
|
+
activePageIndex: 0
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
static{
|
|
30
|
+
this.Page = Page;
|
|
31
|
+
}
|
|
32
|
+
get _contentElement() {
|
|
33
|
+
void 0;
|
|
34
|
+
return this.ref;
|
|
35
|
+
}
|
|
36
|
+
constructor(props){
|
|
37
|
+
super(props), this._timeouts = [], this._activePage = null, this.ref = null, this.handleRef = (el)=>{
|
|
38
|
+
this.ref = el;
|
|
39
|
+
}, this.handleBackButtonClick = ()=>{
|
|
40
|
+
const history = [
|
|
41
|
+
...this.state.history
|
|
42
|
+
];
|
|
43
|
+
const oldPageIndex = history.pop();
|
|
44
|
+
const newPageIndex = history[history.length - 1];
|
|
45
|
+
this.setState({
|
|
46
|
+
history
|
|
47
|
+
});
|
|
48
|
+
this.props.onPageIndexChange?.(newPageIndex || 0, oldPageIndex);
|
|
49
|
+
};
|
|
50
|
+
this.state = {
|
|
51
|
+
history: [
|
|
52
|
+
typeof props.defaultPageIndex === 'number' ? props.defaultPageIndex : props.activePageIndex
|
|
53
|
+
]
|
|
54
|
+
};
|
|
55
|
+
this._contentId = props.deterministicId();
|
|
91
56
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
const activePage = this._activePage;
|
|
106
|
-
|
|
107
|
-
// Attempt to focus active page
|
|
108
|
-
if (activePage && activePage.focusable) {
|
|
109
|
-
activePage.focus();
|
|
110
|
-
} else {
|
|
111
|
-
// Use first tabbable as last ditch effort
|
|
112
|
-
const tabbable = findTabbable(this.ref);
|
|
113
|
-
const element = tabbable && tabbable[0];
|
|
114
|
-
element && element.focus();
|
|
115
|
-
}
|
|
116
|
-
}));
|
|
117
|
-
}
|
|
118
|
-
get activePage() {
|
|
119
|
-
const {
|
|
120
|
-
activePageIndex,
|
|
121
|
-
children
|
|
122
|
-
} = this.props;
|
|
123
|
-
const pages = Children.toArray(children);
|
|
124
|
-
const activePage = activePageIndex < pages.length ? pages[activePageIndex] : null;
|
|
125
|
-
error(!!activePage, '[Pages] Invalid `activePageIndex`.');
|
|
126
|
-
return activePage ? safeCloneElement(activePage, {
|
|
127
|
-
ref: el => {
|
|
128
|
-
this._activePage = el;
|
|
129
|
-
}
|
|
130
|
-
}) : null;
|
|
131
|
-
}
|
|
132
|
-
render() {
|
|
133
|
-
const {
|
|
134
|
-
activePage
|
|
135
|
-
} = this;
|
|
136
|
-
return activePage ? _jsx(PagesContext.Provider, {
|
|
137
|
-
value: {
|
|
138
|
-
history: this.state.history,
|
|
139
|
-
navigateToPreviousPage: () => {
|
|
140
|
-
this.handleBackButtonClick();
|
|
57
|
+
componentDidMount() {
|
|
58
|
+
this.props.makeStyles?.();
|
|
59
|
+
}
|
|
60
|
+
componentDidUpdate() {
|
|
61
|
+
const { activePageIndex } = this.props;
|
|
62
|
+
const { history } = this.state;
|
|
63
|
+
if (typeof activePageIndex === 'number' && (history.length === 0 || activePageIndex !== history[history.length - 1])) {
|
|
64
|
+
this.setState({
|
|
65
|
+
history: [
|
|
66
|
+
...history,
|
|
67
|
+
activePageIndex
|
|
68
|
+
]
|
|
69
|
+
});
|
|
141
70
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
|
|
71
|
+
this._timeouts.push(setTimeout(()=>{
|
|
72
|
+
!this.focused && this.focus();
|
|
73
|
+
}, 0));
|
|
74
|
+
this.props.makeStyles?.();
|
|
75
|
+
}
|
|
76
|
+
componentWillUnmount() {
|
|
77
|
+
this._timeouts.forEach(clearTimeout);
|
|
78
|
+
}
|
|
79
|
+
get focused() {
|
|
80
|
+
return containsActiveElement(this.ref);
|
|
81
|
+
}
|
|
82
|
+
focus() {
|
|
83
|
+
this._timeouts.push(setTimeout(()=>{
|
|
84
|
+
const activePage = this._activePage;
|
|
85
|
+
if (activePage && activePage.focusable) {
|
|
86
|
+
activePage.focus();
|
|
87
|
+
} else {
|
|
88
|
+
const tabbable = findTabbable(this.ref);
|
|
89
|
+
const element = tabbable && tabbable[0];
|
|
90
|
+
element && element.focus();
|
|
91
|
+
}
|
|
92
|
+
}));
|
|
93
|
+
}
|
|
94
|
+
get activePage() {
|
|
95
|
+
const { activePageIndex, children } = this.props;
|
|
96
|
+
const pages = Children.toArray(children);
|
|
97
|
+
const activePage = activePageIndex < pages.length ? pages[activePageIndex] : null;
|
|
98
|
+
error(!!activePage, '[Pages] Invalid `activePageIndex`.');
|
|
99
|
+
return activePage ? safeCloneElement(activePage, {
|
|
100
|
+
ref: (el)=>{
|
|
101
|
+
this._activePage = el;
|
|
102
|
+
}
|
|
103
|
+
}) : null;
|
|
104
|
+
}
|
|
105
|
+
render() {
|
|
106
|
+
const { activePage } = this;
|
|
107
|
+
return activePage ? /*#__PURE__*/ _jsx(PagesContext.Provider, {
|
|
108
|
+
value: {
|
|
109
|
+
history: this.state.history,
|
|
110
|
+
navigateToPreviousPage: ()=>{
|
|
111
|
+
this.handleBackButtonClick();
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
children: /*#__PURE__*/ _jsx(View, {
|
|
115
|
+
as: "div",
|
|
116
|
+
id: this._contentId,
|
|
117
|
+
css: this.props.styles?.pages,
|
|
118
|
+
margin: this.props.margin,
|
|
119
|
+
role: "region",
|
|
120
|
+
elementRef: this.handleRef,
|
|
121
|
+
children: activePage
|
|
122
|
+
})
|
|
123
|
+
}) : null;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
Pages = _ts_decorate([
|
|
127
|
+
withDeterministicId(),
|
|
128
|
+
withStyle(generateStyle, generateComponentTheme)
|
|
129
|
+
], Pages);
|
|
155
130
|
export default Pages;
|
|
156
|
-
export { Pages, Page };
|
|
131
|
+
export { Pages, Page };
|
package/es/Pages/v1/props.js
CHANGED
|
@@ -1,26 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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 = ['children', 'defaultPageIndex', 'activePageIndex', 'onPageIndexChange', 'margin'];
|
|
26
|
-
export { allowedProps };
|
|
1
|
+
const allowedProps = [
|
|
2
|
+
'children',
|
|
3
|
+
'defaultPageIndex',
|
|
4
|
+
'activePageIndex',
|
|
5
|
+
'onPageIndexChange',
|
|
6
|
+
'margin'
|
|
7
|
+
];
|
|
8
|
+
export { allowedProps };
|
package/es/Pages/v1/styles.js
CHANGED
|
@@ -1,47 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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} state the state of the component, the style is applied to
|
|
33
|
-
* @return {Object} The final style object, which will be used in the component
|
|
34
|
-
*/
|
|
35
|
-
const generateStyle = componentTheme => {
|
|
36
|
-
return {
|
|
37
|
-
pages: {
|
|
38
|
-
fontSize: componentTheme.fontSize,
|
|
39
|
-
fontFamily: componentTheme.fontFamily,
|
|
40
|
-
fontWeight: componentTheme.fontWeight,
|
|
41
|
-
color: componentTheme.color,
|
|
42
|
-
background: componentTheme.background,
|
|
43
|
-
display: 'block'
|
|
44
|
-
}
|
|
45
|
-
};
|
|
1
|
+
const generateStyle = (componentTheme)=>{
|
|
2
|
+
return {
|
|
3
|
+
pages: {
|
|
4
|
+
fontSize: componentTheme.fontSize,
|
|
5
|
+
fontFamily: componentTheme.fontFamily,
|
|
6
|
+
fontWeight: componentTheme.fontWeight,
|
|
7
|
+
color: componentTheme.color,
|
|
8
|
+
background: componentTheme.background,
|
|
9
|
+
display: 'block'
|
|
10
|
+
}
|
|
11
|
+
};
|
|
46
12
|
};
|
|
47
|
-
export default generateStyle;
|
|
13
|
+
export default generateStyle;
|