@instructure/ui-skeleton 0.0.0-stage → 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.
Files changed (64) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/LICENSE.md +28 -0
  3. package/README.md +50 -2
  4. package/es/SkeletonCircle/index.js +32 -0
  5. package/es/SkeletonCircle/props.js +6 -0
  6. package/es/SkeletonCircle/styles.js +19 -0
  7. package/es/SkeletonLoader/index.js +62 -0
  8. package/es/SkeletonLoader/props.js +12 -0
  9. package/es/SkeletonLoader/styles.js +17 -0
  10. package/es/SkeletonRectangle/index.js +35 -0
  11. package/es/SkeletonRectangle/props.js +9 -0
  12. package/es/SkeletonRectangle/styles.js +21 -0
  13. package/es/SkeletonText/index.js +38 -0
  14. package/es/SkeletonText/props.js +9 -0
  15. package/es/SkeletonText/styles.js +58 -0
  16. package/es/index.js +1 -0
  17. package/es/utils/shimmer.js +32 -0
  18. package/package.json +65 -3
  19. package/src/SkeletonCircle/index.tsx +71 -0
  20. package/src/SkeletonCircle/props.ts +58 -0
  21. package/src/SkeletonCircle/styles.ts +61 -0
  22. package/src/SkeletonLoader/README.md +237 -0
  23. package/src/SkeletonLoader/index.tsx +126 -0
  24. package/src/SkeletonLoader/props.ts +100 -0
  25. package/src/SkeletonLoader/styles.ts +51 -0
  26. package/src/SkeletonRectangle/index.tsx +71 -0
  27. package/src/SkeletonRectangle/props.ts +81 -0
  28. package/src/SkeletonRectangle/styles.ts +69 -0
  29. package/src/SkeletonText/index.tsx +74 -0
  30. package/src/SkeletonText/props.ts +91 -0
  31. package/src/SkeletonText/styles.ts +115 -0
  32. package/src/index.ts +38 -0
  33. package/src/utils/shimmer.ts +101 -0
  34. package/tsconfig.build.json +29 -0
  35. package/tsconfig.build.tsbuildinfo +1 -0
  36. package/tsconfig.json +4 -0
  37. package/types/SkeletonCircle/index.d.ts +18 -0
  38. package/types/SkeletonCircle/index.d.ts.map +1 -0
  39. package/types/SkeletonCircle/props.d.ts +23 -0
  40. package/types/SkeletonCircle/props.d.ts.map +1 -0
  41. package/types/SkeletonCircle/styles.d.ts +13 -0
  42. package/types/SkeletonCircle/styles.d.ts.map +1 -0
  43. package/types/SkeletonLoader/index.d.ts +27 -0
  44. package/types/SkeletonLoader/index.d.ts.map +1 -0
  45. package/types/SkeletonLoader/props.d.ts +52 -0
  46. package/types/SkeletonLoader/props.d.ts.map +1 -0
  47. package/types/SkeletonLoader/styles.d.ts +11 -0
  48. package/types/SkeletonLoader/styles.d.ts.map +1 -0
  49. package/types/SkeletonRectangle/index.d.ts +18 -0
  50. package/types/SkeletonRectangle/index.d.ts.map +1 -0
  51. package/types/SkeletonRectangle/props.d.ts +36 -0
  52. package/types/SkeletonRectangle/props.d.ts.map +1 -0
  53. package/types/SkeletonRectangle/styles.d.ts +16 -0
  54. package/types/SkeletonRectangle/styles.d.ts.map +1 -0
  55. package/types/SkeletonText/index.d.ts +17 -0
  56. package/types/SkeletonText/index.d.ts.map +1 -0
  57. package/types/SkeletonText/props.d.ts +43 -0
  58. package/types/SkeletonText/props.d.ts.map +1 -0
  59. package/types/SkeletonText/styles.d.ts +16 -0
  60. package/types/SkeletonText/styles.d.ts.map +1 -0
  61. package/types/index.d.ts +7 -0
  62. package/types/index.d.ts.map +1 -0
  63. package/types/utils/shimmer.d.ts +28 -0
  64. package/types/utils/shimmer.d.ts.map +1 -0
package/CHANGELOG.md ADDED
@@ -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`.
package/LICENSE.md ADDED
@@ -0,0 +1,28 @@
1
+ ---
2
+ title: The MIT License (MIT)
3
+ category: Getting Started
4
+ order: 9
5
+ isWIP: true
6
+ ---
7
+
8
+ # The MIT License (MIT)
9
+
10
+ Copyright (c) 2015 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.
package/README.md CHANGED
@@ -1,3 +1,51 @@
1
- # Temporary Holding Version
1
+ ## ui-skeleton
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![npm][npm]][npm-url]
4
+ [![MIT License][license-badge]][license]
5
+ [![Code of Conduct][coc-badge]][coc]
6
+
7
+ Placeholders to show while content loads. They're sized with CSS only, so they
8
+ also work in server-rendered HTML.
9
+
10
+ ### Components
11
+
12
+ The `ui-skeleton` package contains the following:
13
+
14
+ - [SkeletonLoader](SkeletonLoader)
15
+
16
+ ### Installation
17
+
18
+ ```sh
19
+ npm install @instructure/ui-skeleton
20
+ ```
21
+
22
+ ### Usage
23
+
24
+ ```jsx
25
+ import React from 'react'
26
+ import { SkeletonLoader } from '@instructure/ui-skeleton'
27
+
28
+ const CourseList = ({ isLoading, courses }) => {
29
+ return (
30
+ <SkeletonLoader
31
+ isLoading={isLoading}
32
+ loadingLabel="Loading courses"
33
+ loadedLabel={`${courses.length} courses`}
34
+ skeleton={<SkeletonLoader.Text lines={5} />}
35
+ >
36
+ <ul>
37
+ {courses.map((c) => (
38
+ <li key={c.id}>{c.name}</li>
39
+ ))}
40
+ </ul>
41
+ </SkeletonLoader>
42
+ )
43
+ }
44
+ ```
45
+
46
+ [npm]: https://img.shields.io/npm/v/@instructure/ui-skeleton.svg
47
+ [npm-url]: https://npmjs.com/package/@instructure/ui-skeleton
48
+ [license-badge]: https://img.shields.io/npm/l/instructure-ui.svg?style=flat-square
49
+ [license]: https://github.com/instructure/instructure-ui/blob/master/LICENSE.md
50
+ [coc-badge]: https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square
51
+ [coc]: https://github.com/instructure/instructure-ui/blob/master/CODE_OF_CONDUCT.md
@@ -0,0 +1,32 @@
1
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
2
+ import { useContext } from 'react';
3
+ import { useStyleNew } from '@instructure/emotion';
4
+ import { TextDirectionContext } from '@instructure/ui-i18n';
5
+ import { omitProps } from '@instructure/ui-react-utils';
6
+ import generateStyle from './styles.js';
7
+ import { allowedProps } from './props.js';
8
+ function SkeletonCircle(props) {
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
+ });
28
+ }
29
+ SkeletonCircle.displayName = 'SkeletonCircle';
30
+ SkeletonCircle.allowedProps = allowedProps;
31
+ export default SkeletonCircle;
32
+ export { SkeletonCircle };
@@ -0,0 +1,6 @@
1
+ const allowedProps = [
2
+ 'animate',
3
+ 'diameter',
4
+ 'elementRef'
5
+ ];
6
+ export { allowedProps };
@@ -0,0 +1,19 @@
1
+ import { shimmerStyles } from '../utils/shimmer.js';
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
+ };
17
+ };
18
+ export default generateStyle;
19
+ export { generateStyle };
@@ -0,0 +1,62 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
2
+ import { useEffect, useState } from 'react';
3
+ import { useIsHydratedContext, omitProps } from '@instructure/ui-react-utils';
4
+ import generateStyle from './styles.js';
5
+ import { allowedProps } from './props.js';
6
+ import { SkeletonText } from '../SkeletonText/index.js';
7
+ import { SkeletonRectangle } from '../SkeletonRectangle/index.js';
8
+ import { SkeletonCircle } from '../SkeletonCircle/index.js';
9
+ function SkeletonLoader(props) {
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
+ });
55
+ }
56
+ SkeletonLoader.displayName = 'SkeletonLoader';
57
+ SkeletonLoader.allowedProps = allowedProps;
58
+ SkeletonLoader.Text = SkeletonText;
59
+ SkeletonLoader.Rectangle = SkeletonRectangle;
60
+ SkeletonLoader.Circle = SkeletonCircle;
61
+ export default SkeletonLoader;
62
+ export { SkeletonLoader };
@@ -0,0 +1,12 @@
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 };
@@ -0,0 +1,17 @@
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
+ });
16
+ export default generateStyle;
17
+ export { generateStyle };
@@ -0,0 +1,35 @@
1
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
2
+ import { useContext } from 'react';
3
+ import { useStyleNew } from '@instructure/emotion';
4
+ import { TextDirectionContext } from '@instructure/ui-i18n';
5
+ import { omitProps } from '@instructure/ui-react-utils';
6
+ import generateStyle from './styles.js';
7
+ import { allowedProps } from './props.js';
8
+ function SkeletonRectangle(props) {
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
+ });
31
+ }
32
+ SkeletonRectangle.displayName = 'SkeletonRectangle';
33
+ SkeletonRectangle.allowedProps = allowedProps;
34
+ export default SkeletonRectangle;
35
+ export { SkeletonRectangle };
@@ -0,0 +1,9 @@
1
+ const allowedProps = [
2
+ 'animate',
3
+ 'aspectRatio',
4
+ 'elementRef',
5
+ 'height',
6
+ 'radius',
7
+ 'width'
8
+ ];
9
+ export { allowedProps };
@@ -0,0 +1,21 @@
1
+ import { shimmerStyles } from '../utils/shimmer.js';
2
+ const generateStyle = (componentTheme, params, _sharedTokens)=>{
3
+ const { animate = true, aspectRatio = '16 / 9', height, radius, width, textDirection } = params;
4
+ return {
5
+ skeletonRectangle: {
6
+ label: 'skeletonRectangle',
7
+ display: 'block',
8
+ boxSizing: 'border-box',
9
+ width: width ?? '100%',
10
+ ...height ? {
11
+ height
12
+ } : {
13
+ aspectRatio
14
+ },
15
+ borderRadius: radius ?? componentTheme.imageBorderRadius,
16
+ ...shimmerStyles(componentTheme, textDirection === 'rtl', animate)
17
+ }
18
+ };
19
+ };
20
+ export default generateStyle;
21
+ export { generateStyle };
@@ -0,0 +1,38 @@
1
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
2
+ import { useContext } from 'react';
3
+ import { useStyleNew } from '@instructure/emotion';
4
+ import { TextDirectionContext } from '@instructure/ui-i18n';
5
+ import { omitProps } from '@instructure/ui-react-utils';
6
+ import generateStyle from './styles.js';
7
+ import { allowedProps } from './props.js';
8
+ function SkeletonText(props) {
9
+ const { animate, elementRef, lineHeight, lines, size, width } = props;
10
+ const textDirection = useContext(TextDirectionContext);
11
+ const styles = useStyleNew({
12
+ generateStyle,
13
+ componentId: 'SkeletonLoader',
14
+ displayName: 'SkeletonText',
15
+ params: {
16
+ animate,
17
+ lineHeight,
18
+ lines,
19
+ size,
20
+ width,
21
+ textDirection
22
+ }
23
+ });
24
+ return /*#__PURE__*/ _jsx("span", {
25
+ ...omitProps(props, allowedProps),
26
+ ref: elementRef,
27
+ css: styles.skeletonText,
28
+ "aria-hidden": "true",
29
+ "data-skeleton-shape": "text",
30
+ children: styles.rows.map((rowStyle, i)=>/*#__PURE__*/ _jsx("span", {
31
+ css: rowStyle
32
+ }, i))
33
+ });
34
+ }
35
+ SkeletonText.displayName = 'SkeletonText';
36
+ SkeletonText.allowedProps = allowedProps;
37
+ export default SkeletonText;
38
+ export { SkeletonText };
@@ -0,0 +1,9 @@
1
+ const allowedProps = [
2
+ 'animate',
3
+ 'elementRef',
4
+ 'lineHeight',
5
+ 'lines',
6
+ 'size',
7
+ 'width'
8
+ ];
9
+ export { allowedProps };
@@ -0,0 +1,58 @@
1
+ import { shimmerStyles } from '../utils/shimmer.js';
2
+ const LINE_HEIGHTS = {
3
+ heading: 1.25,
4
+ text: 1.5
5
+ };
6
+ const generateStyle = (componentTheme, params, _sharedTokens)=>{
7
+ const { animate = true, lineHeight = 'heading', lines = 1, size = 'md', width, textDirection } = params;
8
+ const shimmer = shimmerStyles(componentTheme, textDirection === 'rtl', animate);
9
+ const fontSizes = {
10
+ xs: componentTheme.textHeightXs,
11
+ sm: componentTheme.textHeightSm,
12
+ md: componentTheme.textHeightMd,
13
+ lg: componentTheme.textHeightLg,
14
+ xl: componentTheme.textHeightXl,
15
+ xxl: componentTheme.textHeightXxl
16
+ };
17
+ const row = `${LINE_HEIGHTS[lineHeight]}em`;
18
+ const bar = {
19
+ display: 'block',
20
+ boxSizing: 'content-box',
21
+ height: '1em',
22
+ padding: `calc((${row} - 1em) / 2) 0`,
23
+ backgroundClip: 'content-box',
24
+ borderRadius: componentTheme.textBorderRadius,
25
+ ...shimmer
26
+ };
27
+ const block = {
28
+ label: 'skeletonText',
29
+ display: 'block',
30
+ fontSize: fontSizes[size] ?? componentTheme.textHeightMd,
31
+ width: width ?? '100%'
32
+ };
33
+ if (lines <= 1) {
34
+ return {
35
+ skeletonText: {
36
+ ...block,
37
+ ...bar
38
+ },
39
+ rows: []
40
+ };
41
+ }
42
+ return {
43
+ skeletonText: {
44
+ ...block,
45
+ boxSizing: 'border-box',
46
+ height: `calc(${lines} * ${row})`
47
+ },
48
+ rows: Array.from({
49
+ length: lines
50
+ }, (_unused, i)=>({
51
+ label: 'skeletonText__row',
52
+ ...bar,
53
+ width: i === lines - 1 ? '75%' : '100%'
54
+ }))
55
+ };
56
+ };
57
+ export default generateStyle;
58
+ export { generateStyle };
package/es/index.js ADDED
@@ -0,0 +1 @@
1
+ export { SkeletonLoader } from './SkeletonLoader/index.js';
@@ -0,0 +1,32 @@
1
+ import { keyframes } from '@instructure/emotion';
2
+ const GRADIENT_SCALE = 2;
3
+ const HIGHLIGHT_ENTER = -0.5;
4
+ const HIGHLIGHT_EXIT = 1.5;
5
+ const HIGHLIGHT_REST = 0.3;
6
+ const positionFor = (highlight)=>`${(1 - highlight) * 100 * (GRADIENT_SCALE - 1)}% 0`;
7
+ const sweep = (isRtl)=>keyframes`
8
+ from { background-position: ${positionFor(isRtl ? HIGHLIGHT_EXIT : HIGHLIGHT_ENTER)}; }
9
+ to { background-position: ${positionFor(isRtl ? HIGHLIGHT_ENTER : HIGHLIGHT_EXIT)}; }
10
+ `;
11
+ const sweepLtr = sweep(false);
12
+ const sweepRtl = sweep(true);
13
+ const shimmerStyles = (componentTheme, isRtl, animate)=>{
14
+ const base = componentTheme.backgroundColor;
15
+ const highlight = componentTheme.shimmerColor;
16
+ return {
17
+ backgroundColor: base,
18
+ backgroundImage: `linear-gradient(90deg, ${base} 0%, ${base} 25%, ${highlight} 50%, ${base} 75%, ${base} 100%)`,
19
+ backgroundRepeat: 'no-repeat',
20
+ backgroundSize: `${GRADIENT_SCALE * 100}% 100%`,
21
+ backgroundPosition: positionFor(isRtl ? 1 - HIGHLIGHT_REST : HIGHLIGHT_REST),
22
+ ...animate ? {
23
+ '@media (prefers-reduced-motion: no-preference)': {
24
+ animationName: isRtl ? sweepRtl : sweepLtr,
25
+ animationDuration: componentTheme.duration,
26
+ animationTimingFunction: `cubic-bezier(${componentTheme.bezier})`,
27
+ animationIterationCount: 'infinite'
28
+ }
29
+ } : {}
30
+ };
31
+ };
32
+ export { shimmerStyles };
package/package.json CHANGED
@@ -1,6 +1,68 @@
1
1
  {
2
2
  "name": "@instructure/ui-skeleton",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "11.7.11-pr-snapshot-1794841957152",
4
+ "type": "module",
5
+ "description": "Skeleton loader primitives that render a correctly sized placeholder from server HTML, with no DOM measurement.",
6
+ "author": "Instructure, Inc. Engineering and Product Design",
7
+ "module": "./es/index.js",
8
+ "types": "./types/index.d.ts",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/instructure/instructure-ui.git"
12
+ },
13
+ "homepage": "https://instructure.github.io/instructure-ui/",
14
+ "bugs": "https://github.com/instructure/instructure-ui/issues",
15
+ "license": "MIT",
16
+ "dependencies": {
17
+ "@instructure/emotion": "11.7.11-pr-snapshot-1794841957152",
18
+ "@instructure/shared-types": "11.7.11-pr-snapshot-1794841957152",
19
+ "@instructure/ui-i18n": "11.7.11-pr-snapshot-1794841957152",
20
+ "@instructure/ui-react-utils": "11.7.11-pr-snapshot-1794841957152",
21
+ "@instructure/ui-themes": "11.7.11-pr-snapshot-1794841957152",
22
+ "@swc/helpers": "^0.5.23"
23
+ },
24
+ "devDependencies": {
25
+ "@instructure/ui-axe-check": "11.7.11-pr-snapshot-1794841957152",
26
+ "vitest": "^5.0.0"
27
+ },
28
+ "peerDependencies": {
29
+ "react": ">=18 <=19"
30
+ },
31
+ "publishConfig": {
32
+ "access": "public"
33
+ },
34
+ "sideEffects": false,
35
+ "exports": {
36
+ "./es/*": "./es/*",
37
+ "./types/*": "./types/*",
38
+ "./package.json": "./package.json",
39
+ "./src/*": "./src/*",
40
+ ".": {
41
+ "src": "./src/index.ts",
42
+ "types": "./types/index.d.ts",
43
+ "import": "./es/index.js",
44
+ "default": "./es/index.js"
45
+ },
46
+ "./v11_7": {
47
+ "src": "./src/index.ts",
48
+ "types": "./types/index.d.ts",
49
+ "import": "./es/index.js",
50
+ "default": "./es/index.js"
51
+ },
52
+ "./latest": {
53
+ "src": "./src/index.ts",
54
+ "types": "./types/index.d.ts",
55
+ "import": "./es/index.js",
56
+ "default": "./es/index.js"
57
+ }
58
+ },
59
+ "scripts": {
60
+ "lint": "ui-scripts lint",
61
+ "lint:fix": "ui-scripts lint --fix",
62
+ "clean": "ui-scripts clean",
63
+ "build": "ui-scripts build",
64
+ "build:watch": "pnpm run ts:check -- --watch & ui-scripts build --watch",
65
+ "build:types": "tsc -p tsconfig.build.json",
66
+ "ts:check": "tsc -p tsconfig.build.json --noEmit --emitDeclarationOnly false"
67
+ }
6
68
  }
@@ -0,0 +1,71 @@
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 { useContext } from 'react'
26
+
27
+ import { useStyleNew } from '@instructure/emotion'
28
+ import { TextDirectionContext } from '@instructure/ui-i18n'
29
+ import { omitProps } from '@instructure/ui-react-utils'
30
+
31
+ import generateStyle from './styles.js'
32
+ import { allowedProps } from './props.js'
33
+ import type { SkeletonLoaderTheme } from '../utils/shimmer'
34
+ import type { SkeletonCircleProps } from './props'
35
+
36
+ /**
37
+ ---
38
+ parent: SkeletonLoader
39
+ id: SkeletonLoader.Circle
40
+ ---
41
+ A placeholder for avatars and other round content. It's hidden from screen
42
+ readers.
43
+ **/
44
+ function SkeletonCircle(props: SkeletonCircleProps) {
45
+ const { animate, diameter, elementRef } = props
46
+
47
+ const textDirection = useContext(TextDirectionContext)
48
+
49
+ const styles = useStyleNew<SkeletonLoaderTheme, typeof generateStyle>({
50
+ generateStyle,
51
+ componentId: 'SkeletonLoader',
52
+ displayName: 'SkeletonCircle',
53
+ params: { animate, diameter, textDirection }
54
+ })
55
+
56
+ return (
57
+ <span
58
+ {...omitProps(props, allowedProps)}
59
+ ref={elementRef}
60
+ css={styles.skeletonCircle}
61
+ aria-hidden="true"
62
+ data-skeleton-shape="circle"
63
+ />
64
+ )
65
+ }
66
+
67
+ SkeletonCircle.displayName = 'SkeletonCircle'
68
+ SkeletonCircle.allowedProps = allowedProps
69
+
70
+ export default SkeletonCircle
71
+ export { SkeletonCircle }