@instructure/ui-skeleton 0.0.1-bootstrap-0 → 11.7.11-pr-snapshot-1794841957152
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 +20 -0
- package/es/SkeletonCircle/index.js +21 -57
- package/es/SkeletonCircle/props.js +6 -26
- package/es/SkeletonCircle/styles.js +16 -44
- package/es/SkeletonLoader/index.js +50 -92
- package/es/SkeletonLoader/props.js +12 -26
- package/es/SkeletonLoader/styles.js +16 -44
- package/es/SkeletonRectangle/index.js +24 -63
- package/es/SkeletonRectangle/props.js +9 -26
- package/es/SkeletonRectangle/styles.js +18 -49
- package/es/SkeletonText/index.js +27 -65
- package/es/SkeletonText/props.js +9 -26
- package/es/SkeletonText/styles.js +51 -88
- package/es/index.js +1 -25
- package/es/utils/shimmer.js +21 -70
- package/package.json +10 -15
- package/src/SkeletonLoader/index.tsx +3 -3
- package/tsconfig.build.json +0 -3
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/SkeletonLoader/index.d.ts +3 -3
- package/types/SkeletonLoader/index.d.ts.map +1 -1
- package/lib/SkeletonCircle/index.js +0 -75
- package/lib/SkeletonCircle/props.js +0 -31
- package/lib/SkeletonCircle/styles.js +0 -53
- package/lib/SkeletonLoader/index.js +0 -110
- package/lib/SkeletonLoader/props.js +0 -31
- package/lib/SkeletonLoader/styles.js +0 -51
- package/lib/SkeletonRectangle/index.js +0 -81
- package/lib/SkeletonRectangle/props.js +0 -31
- package/lib/SkeletonRectangle/styles.js +0 -58
- package/lib/SkeletonText/index.js +0 -83
- package/lib/SkeletonText/props.js +0 -31
- package/lib/SkeletonText/styles.js +0 -101
- package/lib/index.js +0 -12
- package/lib/package.json +0 -1
- package/lib/utils/shimmer.js +0 -87
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
## [11.7.11-pr-snapshot-1794841957152](https://github.com/instructure/instructure-ui/compare/v11.7.10...v11.7.11-pr-snapshot-1794841957152) (2026-11-16)
|
|
7
|
+
|
|
8
|
+
### Build System
|
|
9
|
+
|
|
10
|
+
* **many:** replace babel with swc ([9c2e562](https://github.com/instructure/instructure-ui/commit/9c2e5629e7c509fdfc0d1770d1b81e70e60e083b))
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* **INSTUI-5156:** new skeleton loader ([#2720](https://github.com/instructure/instructure-ui/issues/2720)) ([f83433e](https://github.com/instructure/instructure-ui/commit/f83433ee71854ecc409ee042fabbcf9b92336a3a))
|
|
15
|
+
|
|
16
|
+
### BREAKING CHANGES
|
|
17
|
+
|
|
18
|
+
* **many:** `@instructure/ui-babel-preset` and
|
|
19
|
+
`@instructure/browserslist-config-instui` are removed and will no longer be
|
|
20
|
+
published. Packages depend on `@swc/helpers` instead of `@babel/runtime`.
|
|
@@ -1,68 +1,32 @@
|
|
|
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 { useContext } from 'react';
|
|
26
3
|
import { useStyleNew } from '@instructure/emotion';
|
|
27
4
|
import { TextDirectionContext } from '@instructure/ui-i18n';
|
|
28
5
|
import { omitProps } from '@instructure/ui-react-utils';
|
|
29
6
|
import generateStyle from './styles.js';
|
|
30
7
|
import { allowedProps } from './props.js';
|
|
31
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
32
|
-
/**
|
|
33
|
-
---
|
|
34
|
-
parent: SkeletonLoader
|
|
35
|
-
id: SkeletonLoader.Circle
|
|
36
|
-
---
|
|
37
|
-
A placeholder for avatars and other round content. It's hidden from screen
|
|
38
|
-
readers.
|
|
39
|
-
**/
|
|
40
8
|
function SkeletonCircle(props) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
css: styles.skeletonCircle,
|
|
61
|
-
"aria-hidden": "true",
|
|
62
|
-
"data-skeleton-shape": "circle"
|
|
63
|
-
});
|
|
9
|
+
const { animate, diameter, elementRef } = props;
|
|
10
|
+
const textDirection = useContext(TextDirectionContext);
|
|
11
|
+
const styles = useStyleNew({
|
|
12
|
+
generateStyle,
|
|
13
|
+
componentId: 'SkeletonLoader',
|
|
14
|
+
displayName: 'SkeletonCircle',
|
|
15
|
+
params: {
|
|
16
|
+
animate,
|
|
17
|
+
diameter,
|
|
18
|
+
textDirection
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
return /*#__PURE__*/ _jsx("span", {
|
|
22
|
+
...omitProps(props, allowedProps),
|
|
23
|
+
ref: elementRef,
|
|
24
|
+
css: styles.skeletonCircle,
|
|
25
|
+
"aria-hidden": "true",
|
|
26
|
+
"data-skeleton-shape": "circle"
|
|
27
|
+
});
|
|
64
28
|
}
|
|
65
29
|
SkeletonCircle.displayName = 'SkeletonCircle';
|
|
66
30
|
SkeletonCircle.allowedProps = allowedProps;
|
|
67
31
|
export default SkeletonCircle;
|
|
68
|
-
export { SkeletonCircle };
|
|
32
|
+
export { SkeletonCircle };
|
|
@@ -1,26 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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 = ['animate', 'diameter', 'elementRef'];
|
|
26
|
-
export { allowedProps };
|
|
1
|
+
const allowedProps = [
|
|
2
|
+
'animate',
|
|
3
|
+
'diameter',
|
|
4
|
+
'elementRef'
|
|
5
|
+
];
|
|
6
|
+
export { allowedProps };
|
|
@@ -1,47 +1,19 @@
|
|
|
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 { shimmerStyles } from '../utils/shimmer.js';
|
|
26
|
-
const generateStyle = (componentTheme, params, _sharedTokens)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
borderRadius: componentTheme.avatarBorderRadius,
|
|
42
|
-
...shimmerStyles(componentTheme, textDirection === 'rtl', animate)
|
|
43
|
-
}
|
|
44
|
-
};
|
|
2
|
+
const generateStyle = (componentTheme, params, _sharedTokens)=>{
|
|
3
|
+
const { animate = true, diameter = '2rem', textDirection } = params;
|
|
4
|
+
return {
|
|
5
|
+
skeletonCircle: {
|
|
6
|
+
label: 'skeletonCircle',
|
|
7
|
+
display: 'inline-block',
|
|
8
|
+
verticalAlign: 'middle',
|
|
9
|
+
boxSizing: 'border-box',
|
|
10
|
+
width: diameter,
|
|
11
|
+
height: diameter,
|
|
12
|
+
flex: '0 0 auto',
|
|
13
|
+
borderRadius: componentTheme.avatarBorderRadius,
|
|
14
|
+
...shimmerStyles(componentTheme, textDirection === 'rtl', animate)
|
|
15
|
+
}
|
|
16
|
+
};
|
|
45
17
|
};
|
|
46
18
|
export default generateStyle;
|
|
47
|
-
export { generateStyle };
|
|
19
|
+
export { generateStyle };
|
|
@@ -1,99 +1,57 @@
|
|
|
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, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
|
|
25
2
|
import { useEffect, useState } from 'react';
|
|
26
3
|
import { useIsHydratedContext, omitProps } from '@instructure/ui-react-utils';
|
|
27
4
|
import generateStyle from './styles.js';
|
|
28
5
|
import { allowedProps } from './props.js';
|
|
29
|
-
import { SkeletonText } from
|
|
30
|
-
import { SkeletonRectangle } from
|
|
31
|
-
import { SkeletonCircle } from
|
|
32
|
-
/**
|
|
33
|
-
---
|
|
34
|
-
category: components
|
|
35
|
-
---
|
|
36
|
-
Shows a placeholder while part of the page is loading, and tells screen reader
|
|
37
|
-
users when loading starts and finishes.
|
|
38
|
-
|
|
39
|
-
Use one `SkeletonLoader` for each loading area, not one per card or row, so
|
|
40
|
-
screen readers announce it once.
|
|
41
|
-
@module SkeletonLoader
|
|
42
|
-
**/
|
|
43
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
6
|
+
import { SkeletonText } from '../SkeletonText/index.js';
|
|
7
|
+
import { SkeletonRectangle } from '../SkeletonRectangle/index.js';
|
|
8
|
+
import { SkeletonCircle } from '../SkeletonCircle/index.js';
|
|
44
9
|
function SkeletonLoader(props) {
|
|
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
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
children: loading ? skeleton : children
|
|
91
|
-
}), isError && errorLabel ? _jsx("span", {
|
|
92
|
-
role: "alert",
|
|
93
|
-
css: styles.srOnly,
|
|
94
|
-
children: errorLabel
|
|
95
|
-
}) : null]
|
|
96
|
-
});
|
|
10
|
+
const { announcementDelay = 400, children, elementRef, errorLabel, isError = false, isLoading, loadedLabel, loadingLabel, skeleton } = props;
|
|
11
|
+
const isHydrated = useIsHydratedContext();
|
|
12
|
+
const loading = isError ? false : isLoading ?? !isHydrated;
|
|
13
|
+
const [status, setStatus] = useState('');
|
|
14
|
+
const styles = generateStyle();
|
|
15
|
+
useEffect(()=>{
|
|
16
|
+
if (isError) {
|
|
17
|
+
setStatus('');
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if (loading) {
|
|
21
|
+
const timeout = setTimeout(()=>setStatus(loadingLabel), announcementDelay);
|
|
22
|
+
return ()=>clearTimeout(timeout);
|
|
23
|
+
}
|
|
24
|
+
setStatus(loadedLabel);
|
|
25
|
+
return undefined;
|
|
26
|
+
}, [
|
|
27
|
+
loading,
|
|
28
|
+
isError,
|
|
29
|
+
loadingLabel,
|
|
30
|
+
loadedLabel,
|
|
31
|
+
announcementDelay
|
|
32
|
+
]);
|
|
33
|
+
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
34
|
+
children: [
|
|
35
|
+
/*#__PURE__*/ _jsx("span", {
|
|
36
|
+
role: "status",
|
|
37
|
+
"aria-live": "polite",
|
|
38
|
+
"aria-atomic": "true",
|
|
39
|
+
css: styles.srOnly,
|
|
40
|
+
children: status
|
|
41
|
+
}),
|
|
42
|
+
/*#__PURE__*/ _jsx("div", {
|
|
43
|
+
...omitProps(props, allowedProps),
|
|
44
|
+
ref: elementRef,
|
|
45
|
+
"aria-busy": loading || undefined,
|
|
46
|
+
children: loading ? skeleton : children
|
|
47
|
+
}),
|
|
48
|
+
isError && errorLabel ? /*#__PURE__*/ _jsx("span", {
|
|
49
|
+
role: "alert",
|
|
50
|
+
css: styles.srOnly,
|
|
51
|
+
children: errorLabel
|
|
52
|
+
}) : null
|
|
53
|
+
]
|
|
54
|
+
});
|
|
97
55
|
}
|
|
98
56
|
SkeletonLoader.displayName = 'SkeletonLoader';
|
|
99
57
|
SkeletonLoader.allowedProps = allowedProps;
|
|
@@ -101,4 +59,4 @@ SkeletonLoader.Text = SkeletonText;
|
|
|
101
59
|
SkeletonLoader.Rectangle = SkeletonRectangle;
|
|
102
60
|
SkeletonLoader.Circle = SkeletonCircle;
|
|
103
61
|
export default SkeletonLoader;
|
|
104
|
-
export { SkeletonLoader };
|
|
62
|
+
export { SkeletonLoader };
|
|
@@ -1,26 +1,12 @@
|
|
|
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
|
-
const allowedProps = ['announcementDelay', 'children', 'elementRef', 'errorLabel', 'isError', 'isLoading', 'loadedLabel', 'loadingLabel', 'skeleton'];
|
|
26
|
-
export { allowedProps };
|
|
1
|
+
const allowedProps = [
|
|
2
|
+
'announcementDelay',
|
|
3
|
+
'children',
|
|
4
|
+
'elementRef',
|
|
5
|
+
'errorLabel',
|
|
6
|
+
'isError',
|
|
7
|
+
'isLoading',
|
|
8
|
+
'loadedLabel',
|
|
9
|
+
'loadingLabel',
|
|
10
|
+
'skeleton'
|
|
11
|
+
];
|
|
12
|
+
export { allowedProps };
|
|
@@ -1,45 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
* Visually hidden but still announced. Not `display: none`, which would remove
|
|
27
|
-
* the live region from the accessibility tree and stop it announcing at all.
|
|
28
|
-
*/
|
|
29
|
-
const generateStyle = () => ({
|
|
30
|
-
srOnly: {
|
|
31
|
-
label: 'skeletonLoader__srOnly',
|
|
32
|
-
position: 'absolute',
|
|
33
|
-
width: '1px',
|
|
34
|
-
height: '1px',
|
|
35
|
-
margin: '-1px',
|
|
36
|
-
padding: 0,
|
|
37
|
-
border: 0,
|
|
38
|
-
overflow: 'hidden',
|
|
39
|
-
clip: 'rect(0 0 0 0)',
|
|
40
|
-
clipPath: 'inset(50%)',
|
|
41
|
-
whiteSpace: 'nowrap'
|
|
42
|
-
}
|
|
43
|
-
});
|
|
1
|
+
const generateStyle = ()=>({
|
|
2
|
+
srOnly: {
|
|
3
|
+
label: 'skeletonLoader__srOnly',
|
|
4
|
+
position: 'absolute',
|
|
5
|
+
width: '1px',
|
|
6
|
+
height: '1px',
|
|
7
|
+
margin: '-1px',
|
|
8
|
+
padding: 0,
|
|
9
|
+
border: 0,
|
|
10
|
+
overflow: 'hidden',
|
|
11
|
+
clip: 'rect(0 0 0 0)',
|
|
12
|
+
clipPath: 'inset(50%)',
|
|
13
|
+
whiteSpace: 'nowrap'
|
|
14
|
+
}
|
|
15
|
+
});
|
|
44
16
|
export default generateStyle;
|
|
45
|
-
export { generateStyle };
|
|
17
|
+
export { generateStyle };
|
|
@@ -1,74 +1,35 @@
|
|
|
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 { useContext } from 'react';
|
|
26
3
|
import { useStyleNew } from '@instructure/emotion';
|
|
27
4
|
import { TextDirectionContext } from '@instructure/ui-i18n';
|
|
28
5
|
import { omitProps } from '@instructure/ui-react-utils';
|
|
29
6
|
import generateStyle from './styles.js';
|
|
30
7
|
import { allowedProps } from './props.js';
|
|
31
|
-
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
32
|
-
/**
|
|
33
|
-
---
|
|
34
|
-
parent: SkeletonLoader
|
|
35
|
-
id: SkeletonLoader.Rectangle
|
|
36
|
-
---
|
|
37
|
-
A placeholder for images, video, and other media. It's hidden from screen
|
|
38
|
-
readers.
|
|
39
|
-
**/
|
|
40
8
|
function SkeletonRectangle(props) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return _jsx("span", {
|
|
64
|
-
...omitProps(props, allowedProps),
|
|
65
|
-
ref: elementRef,
|
|
66
|
-
css: styles.skeletonRectangle,
|
|
67
|
-
"aria-hidden": "true",
|
|
68
|
-
"data-skeleton-shape": "rectangle"
|
|
69
|
-
});
|
|
9
|
+
const { animate, aspectRatio, elementRef, height, radius, width } = props;
|
|
10
|
+
const textDirection = useContext(TextDirectionContext);
|
|
11
|
+
const styles = useStyleNew({
|
|
12
|
+
generateStyle,
|
|
13
|
+
componentId: 'SkeletonLoader',
|
|
14
|
+
displayName: 'SkeletonRectangle',
|
|
15
|
+
params: {
|
|
16
|
+
animate,
|
|
17
|
+
aspectRatio,
|
|
18
|
+
height,
|
|
19
|
+
radius,
|
|
20
|
+
width,
|
|
21
|
+
textDirection
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
return /*#__PURE__*/ _jsx("span", {
|
|
25
|
+
...omitProps(props, allowedProps),
|
|
26
|
+
ref: elementRef,
|
|
27
|
+
css: styles.skeletonRectangle,
|
|
28
|
+
"aria-hidden": "true",
|
|
29
|
+
"data-skeleton-shape": "rectangle"
|
|
30
|
+
});
|
|
70
31
|
}
|
|
71
32
|
SkeletonRectangle.displayName = 'SkeletonRectangle';
|
|
72
33
|
SkeletonRectangle.allowedProps = allowedProps;
|
|
73
34
|
export default SkeletonRectangle;
|
|
74
|
-
export { SkeletonRectangle };
|
|
35
|
+
export { SkeletonRectangle };
|
|
@@ -1,26 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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 = ['animate', 'aspectRatio', 'elementRef', 'height', 'radius', 'width'];
|
|
26
|
-
export { allowedProps };
|
|
1
|
+
const allowedProps = [
|
|
2
|
+
'animate',
|
|
3
|
+
'aspectRatio',
|
|
4
|
+
'elementRef',
|
|
5
|
+
'height',
|
|
6
|
+
'radius',
|
|
7
|
+
'width'
|
|
8
|
+
];
|
|
9
|
+
export { allowedProps };
|