Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F99927905
Skeleton.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Jan 27, 08:01
Size
6 KB
Mime Type
text/x-java
Expires
Wed, Jan 29, 08:01 (2 d)
Engine
blob
Format
Raw Data
Handle
23801344
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
Skeleton.js
View Options
import
_objectWithoutPropertiesLoose
from
"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"
;
import
_extends
from
"@babel/runtime/helpers/esm/extends"
;
const
_excluded
=
[
"animation"
,
"className"
,
"component"
,
"height"
,
"style"
,
"variant"
,
"width"
];
let
_
=
t
=>
t
,
_t
,
_t2
,
_t3
,
_t4
;
import
*
as
React
from
'react'
;
import
clsx
from
'clsx'
;
import
PropTypes
from
'prop-types'
;
import
{
keyframes
,
css
}
from
'@mui/system'
;
import
{
unstable_composeClasses
as
composeClasses
}
from
'@mui/base'
;
import
{
alpha
,
unstable_getUnit
as
getUnit
,
unstable_toUnitless
as
toUnitless
}
from
'../styles'
;
import
styled
from
'../styles/styled'
;
import
useThemeProps
from
'../styles/useThemeProps'
;
import
{
getSkeletonUtilityClass
}
from
'./skeletonClasses'
;
import
{
jsx
as
_jsx
}
from
"react/jsx-runtime"
;
const
useUtilityClasses
=
ownerState
=>
{
const
{
classes
,
variant
,
animation
,
hasChildren
,
width
,
height
}
=
ownerState
;
const
slots
=
{
root
:
[
'root'
,
variant
,
animation
,
hasChildren
&&
'withChildren'
,
hasChildren
&&
!
width
&&
'fitContent'
,
hasChildren
&&
!
height
&&
'heightAuto'
]
};
return
composeClasses
(
slots
,
getSkeletonUtilityClass
,
classes
);
};
const
pulseKeyframe
=
keyframes
(
_t
||
(
_t
=
_
`
0
%
{
opacity
:
1
;
}
50
%
{
opacity
:
0.4
;
}
100
%
{
opacity
:
1
;
}
`
));
const
waveKeyframe
=
keyframes
(
_t2
||
(
_t2
=
_
`
0
%
{
transform
:
translateX
(
-
100
%
);
}
50
%
{
/* +0.5s of delay between each loop */
transform
:
translateX
(
100
%
);
}
100
%
{
transform
:
translateX
(
100
%
);
}
`
));
const
SkeletonRoot
=
styled
(
'span'
,
{
name
:
'MuiSkeleton'
,
slot
:
'Root'
,
overridesResolver
:
(
props
,
styles
)
=>
{
const
{
ownerState
}
=
props
;
return
[
styles
.
root
,
styles
[
ownerState
.
variant
],
ownerState
.
animation
!==
false
&&
styles
[
ownerState
.
animation
],
ownerState
.
hasChildren
&&
styles
.
withChildren
,
ownerState
.
hasChildren
&&
!
ownerState
.
width
&&
styles
.
fitContent
,
ownerState
.
hasChildren
&&
!
ownerState
.
height
&&
styles
.
heightAuto
];
}
})(({
theme
,
ownerState
})
=>
{
const
radiusUnit
=
getUnit
(
theme
.
shape
.
borderRadius
)
||
'px'
;
const
radiusValue
=
toUnitless
(
theme
.
shape
.
borderRadius
);
return
_extends
({
display
:
'block'
,
// Create a "on paper" color with sufficient contrast retaining the color
backgroundColor
:
theme
.
vars
?
theme
.
vars
.
palette
.
Skeleton
.
bg
:
alpha
(
theme
.
palette
.
text
.
primary
,
theme
.
palette
.
mode
===
'light'
?
0.11
:
0.13
),
height
:
'1.2em'
},
ownerState
.
variant
===
'text'
&&
{
marginTop
:
0
,
marginBottom
:
0
,
height
:
'auto'
,
transformOrigin
:
'0 55%'
,
transform
:
'scale(1, 0.60)'
,
borderRadius
:
`
$
{
radiusValue
}
$
{
radiusUnit
}
/
$
{
Math
.
round
(
radiusValue
/
0.6
*
10
)
/
10
}
$
{
radiusUnit
}
`
,
'&:empty:before'
:
{
content
:
'"\\00a0"'
}
},
ownerState
.
variant
===
'circular'
&&
{
borderRadius
:
'50%'
},
ownerState
.
variant
===
'rounded'
&&
{
borderRadius
:
(
theme
.
vars
||
theme
).
shape
.
borderRadius
},
ownerState
.
hasChildren
&&
{
'& > *'
:
{
visibility
:
'hidden'
}
},
ownerState
.
hasChildren
&&
!
ownerState
.
width
&&
{
maxWidth
:
'fit-content'
},
ownerState
.
hasChildren
&&
!
ownerState
.
height
&&
{
height
:
'auto'
});
},
({
ownerState
})
=>
ownerState
.
animation
===
'pulse'
&&
css
(
_t3
||
(
_t3
=
_
`
animation
:
$
{
0
}
1.5
s
ease
-
in
-
out
0.5
s
infinite
;
`
),
pulseKeyframe
),
({
ownerState
,
theme
})
=>
ownerState
.
animation
===
'wave'
&&
css
(
_t4
||
(
_t4
=
_
`
position
:
relative
;
overflow
:
hidden
;
/* Fix bug in Safari https://bugs.webkit.org/show_bug.cgi?id=68196 */
-
webkit
-
mask
-
image
:
-
webkit
-
radial
-
gradient
(
white
,
black
);
&::
after
{
animation
:
$
{
0
}
1.6
s
linear
0.5
s
infinite
;
background
:
linear
-
gradient
(
90
deg
,
transparent
,
$
{
0
},
transparent
);
content
:
''
;
position
:
absolute
;
transform
:
translateX
(
-
100
%
);
/* Avoid flash during server-side hydration */
bottom
:
0
;
left
:
0
;
right
:
0
;
top
:
0
;
}
`
),
waveKeyframe
,
(
theme
.
vars
||
theme
).
palette
.
action
.
hover
));
const
Skeleton
=
/*#__PURE__*/
React
.
forwardRef
(
function
Skeleton
(
inProps
,
ref
)
{
const
props
=
useThemeProps
({
props
:
inProps
,
name
:
'MuiSkeleton'
});
const
{
animation
=
'pulse'
,
className
,
component
=
'span'
,
height
,
style
,
variant
=
'text'
,
width
}
=
props
,
other
=
_objectWithoutPropertiesLoose
(
props
,
_excluded
);
const
ownerState
=
_extends
({},
props
,
{
animation
,
component
,
variant
,
hasChildren
:
Boolean
(
other
.
children
)
});
const
classes
=
useUtilityClasses
(
ownerState
);
return
/*#__PURE__*/
_jsx
(
SkeletonRoot
,
_extends
({
as
:
component
,
ref
:
ref
,
className
:
clsx
(
classes
.
root
,
className
),
ownerState
:
ownerState
},
other
,
{
style
:
_extends
({
width
,
height
},
style
)
}));
});
process
.
env
.
NODE_ENV
!==
"production"
?
Skeleton
.
propTypes
/* remove-proptypes */
=
{
// ----------------------------- Warning --------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them edit the d.ts file and run "yarn proptypes" |
// ----------------------------------------------------------------------
/**
* The animation.
* If `false` the animation effect is disabled.
* @default 'pulse'
*/
animation
:
PropTypes
.
oneOf
([
'pulse'
,
'wave'
,
false
]),
/**
* Optional children to infer width and height from.
*/
children
:
PropTypes
.
node
,
/**
* Override or extend the styles applied to the component.
*/
classes
:
PropTypes
.
object
,
/**
* @ignore
*/
className
:
PropTypes
.
string
,
/**
* The component used for the root node.
* Either a string to use a HTML element or a component.
*/
component
:
PropTypes
.
elementType
,
/**
* Height of the skeleton.
* Useful when you don't want to adapt the skeleton to a text element but for instance a card.
*/
height
:
PropTypes
.
oneOfType
([
PropTypes
.
number
,
PropTypes
.
string
]),
/**
* @ignore
*/
style
:
PropTypes
.
object
,
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
sx
:
PropTypes
.
oneOfType
([
PropTypes
.
arrayOf
(
PropTypes
.
oneOfType
([
PropTypes
.
func
,
PropTypes
.
object
,
PropTypes
.
bool
])),
PropTypes
.
func
,
PropTypes
.
object
]),
/**
* The type of content that will be rendered.
* @default 'text'
*/
variant
:
PropTypes
/* @typescript-to-proptypes-ignore */
.
oneOfType
([
PropTypes
.
oneOf
([
'circular'
,
'rectangular'
,
'rounded'
,
'text'
]),
PropTypes
.
string
]),
/**
* Width of the skeleton.
* Useful when the skeleton is inside an inline element with no width of its own.
*/
width
:
PropTypes
.
oneOfType
([
PropTypes
.
number
,
PropTypes
.
string
])
}
:
void
0
;
export
default
Skeleton
;
Event Timeline
Log In to Comment