Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F99855678
InputAdornment.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
Sun, Jan 26, 23:50
Size
6 KB
Mime Type
text/x-java
Expires
Tue, Jan 28, 23:50 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23833091
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
InputAdornment.js
View Options
import
_objectWithoutPropertiesLoose
from
"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"
;
import
_extends
from
"@babel/runtime/helpers/esm/extends"
;
var
_span
;
const
_excluded
=
[
"children"
,
"className"
,
"component"
,
"disablePointerEvents"
,
"disableTypography"
,
"position"
,
"variant"
];
import
*
as
React
from
'react'
;
import
PropTypes
from
'prop-types'
;
import
clsx
from
'clsx'
;
import
{
unstable_composeClasses
as
composeClasses
}
from
'@mui/base'
;
import
capitalize
from
'../utils/capitalize'
;
import
Typography
from
'../Typography'
;
import
FormControlContext
from
'../FormControl/FormControlContext'
;
import
useFormControl
from
'../FormControl/useFormControl'
;
import
styled
from
'../styles/styled'
;
import
inputAdornmentClasses
,
{
getInputAdornmentUtilityClass
}
from
'./inputAdornmentClasses'
;
import
useThemeProps
from
'../styles/useThemeProps'
;
import
{
jsx
as
_jsx
}
from
"react/jsx-runtime"
;
import
{
jsxs
as
_jsxs
}
from
"react/jsx-runtime"
;
const
overridesResolver
=
(
props
,
styles
)
=>
{
const
{
ownerState
}
=
props
;
return
[
styles
.
root
,
styles
[
`
position$
{
capitalize
(
ownerState
.
position
)}
`
],
ownerState
.
disablePointerEvents
===
true
&&
styles
.
disablePointerEvents
,
styles
[
ownerState
.
variant
]];
};
const
useUtilityClasses
=
ownerState
=>
{
const
{
classes
,
disablePointerEvents
,
hiddenLabel
,
position
,
size
,
variant
}
=
ownerState
;
const
slots
=
{
root
:
[
'root'
,
disablePointerEvents
&&
'disablePointerEvents'
,
position
&&
`
position$
{
capitalize
(
position
)}
`
,
variant
,
hiddenLabel
&&
'hiddenLabel'
,
size
&&
`
size$
{
capitalize
(
size
)}
`
]
};
return
composeClasses
(
slots
,
getInputAdornmentUtilityClass
,
classes
);
};
const
InputAdornmentRoot
=
styled
(
'div'
,
{
name
:
'MuiInputAdornment'
,
slot
:
'Root'
,
overridesResolver
})(({
theme
,
ownerState
})
=>
_extends
({
display
:
'flex'
,
height
:
'0.01em'
,
// Fix IE11 flexbox alignment. To remove at some point.
maxHeight
:
'2em'
,
alignItems
:
'center'
,
whiteSpace
:
'nowrap'
,
color
:
(
theme
.
vars
||
theme
).
palette
.
action
.
active
},
ownerState
.
variant
===
'filled'
&&
{
// Styles applied to the root element if `variant="filled"`.
[
`
&
.
$
{
inputAdornmentClasses
.
positionStart
}
&:
not
(.
$
{
inputAdornmentClasses
.
hiddenLabel
})
`
]
:
{
marginTop
:
16
}
},
ownerState
.
position
===
'start'
&&
{
// Styles applied to the root element if `position="start"`.
marginRight
:
8
},
ownerState
.
position
===
'end'
&&
{
// Styles applied to the root element if `position="end"`.
marginLeft
:
8
},
ownerState
.
disablePointerEvents
===
true
&&
{
// Styles applied to the root element if `disablePointerEvents={true}`.
pointerEvents
:
'none'
}));
const
InputAdornment
=
/*#__PURE__*/
React
.
forwardRef
(
function
InputAdornment
(
inProps
,
ref
)
{
const
props
=
useThemeProps
({
props
:
inProps
,
name
:
'MuiInputAdornment'
});
const
{
children
,
className
,
component
=
'div'
,
disablePointerEvents
=
false
,
disableTypography
=
false
,
position
,
variant
:
variantProp
}
=
props
,
other
=
_objectWithoutPropertiesLoose
(
props
,
_excluded
);
const
muiFormControl
=
useFormControl
()
||
{};
let
variant
=
variantProp
;
if
(
variantProp
&&
muiFormControl
.
variant
)
{
if
(
process
.
env
.
NODE_ENV
!==
'production'
)
{
if
(
variantProp
===
muiFormControl
.
variant
)
{
console
.
error
(
'MUI: The `InputAdornment` variant infers the variant prop '
+
'you do not have to provide one.'
);
}
}
}
if
(
muiFormControl
&&
!
variant
)
{
variant
=
muiFormControl
.
variant
;
}
const
ownerState
=
_extends
({},
props
,
{
hiddenLabel
:
muiFormControl
.
hiddenLabel
,
size
:
muiFormControl
.
size
,
disablePointerEvents
,
position
,
variant
});
const
classes
=
useUtilityClasses
(
ownerState
);
return
/*#__PURE__*/
_jsx
(
FormControlContext
.
Provider
,
{
value
:
null
,
children
:
/*#__PURE__*/
_jsx
(
InputAdornmentRoot
,
_extends
({
as
:
component
,
ownerState
:
ownerState
,
className
:
clsx
(
classes
.
root
,
className
),
ref
:
ref
},
other
,
{
children
:
typeof
children
===
'string'
&&
!
disableTypography
?
/*#__PURE__*/
_jsx
(
Typography
,
{
color
:
"text.secondary"
,
children
:
children
})
:
/*#__PURE__*/
_jsxs
(
React
.
Fragment
,
{
children
:
[
position
===
'start'
?
/* notranslate needed while Google Translate will not fix zero-width space issue */
_span
||
(
_span
=
/*#__PURE__*/
_jsx
(
"span"
,
{
className
:
"notranslate"
,
children
:
"\u200B"
}))
:
null
,
children
]
})
}))
});
});
process
.
env
.
NODE_ENV
!==
"production"
?
InputAdornment
.
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 content of the component, normally an `IconButton` or string.
*/
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
,
/**
* Disable pointer events on the root.
* This allows for the content of the adornment to focus the `input` on click.
* @default false
*/
disablePointerEvents
:
PropTypes
.
bool
,
/**
* If children is a string then disable wrapping in a Typography component.
* @default false
*/
disableTypography
:
PropTypes
.
bool
,
/**
* The position this adornment should appear relative to the `Input`.
*/
position
:
PropTypes
.
oneOf
([
'end'
,
'start'
]).
isRequired
,
/**
* 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 variant to use.
* Note: If you are using the `TextField` component or the `FormControl` component
* you do not have to set this manually.
*/
variant
:
PropTypes
.
oneOf
([
'filled'
,
'outlined'
,
'standard'
])
}
:
void
0
;
export
default
InputAdornment
;
Event Timeline
Log In to Comment