Grabbed dndbeyond's source code
``` ~/go/bin/sourcemapper -output ddb -jsurl https://media.dndbeyond.com/character-app/static/js/main.90aa78c5.js ```
This commit is contained in:
+273
@@ -0,0 +1,273 @@
|
||||
'use client';
|
||||
|
||||
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
||||
import _extends from "@babel/runtime/helpers/esm/extends";
|
||||
const _excluded = ["autoFocus", "checked", "checkedIcon", "className", "defaultChecked", "disabled", "disableFocusRipple", "edge", "icon", "id", "inputProps", "inputRef", "name", "onBlur", "onChange", "onFocus", "readOnly", "required", "tabIndex", "type", "value"];
|
||||
import * as React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import clsx from 'clsx';
|
||||
import refType from '@mui/utils/refType';
|
||||
import composeClasses from '@mui/utils/composeClasses';
|
||||
import capitalize from '../utils/capitalize';
|
||||
import styled, { rootShouldForwardProp } from '../styles/styled';
|
||||
import useControlled from '../utils/useControlled';
|
||||
import useFormControl from '../FormControl/useFormControl';
|
||||
import ButtonBase from '../ButtonBase';
|
||||
import { getSwitchBaseUtilityClass } from './switchBaseClasses';
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
import { jsxs as _jsxs } from "react/jsx-runtime";
|
||||
const useUtilityClasses = ownerState => {
|
||||
const {
|
||||
classes,
|
||||
checked,
|
||||
disabled,
|
||||
edge
|
||||
} = ownerState;
|
||||
const slots = {
|
||||
root: ['root', checked && 'checked', disabled && 'disabled', edge && `edge${capitalize(edge)}`],
|
||||
input: ['input']
|
||||
};
|
||||
return composeClasses(slots, getSwitchBaseUtilityClass, classes);
|
||||
};
|
||||
const SwitchBaseRoot = styled(ButtonBase)(({
|
||||
ownerState
|
||||
}) => _extends({
|
||||
padding: 9,
|
||||
borderRadius: '50%'
|
||||
}, ownerState.edge === 'start' && {
|
||||
marginLeft: ownerState.size === 'small' ? -3 : -12
|
||||
}, ownerState.edge === 'end' && {
|
||||
marginRight: ownerState.size === 'small' ? -3 : -12
|
||||
}));
|
||||
const SwitchBaseInput = styled('input', {
|
||||
shouldForwardProp: rootShouldForwardProp
|
||||
})({
|
||||
cursor: 'inherit',
|
||||
position: 'absolute',
|
||||
opacity: 0,
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
top: 0,
|
||||
left: 0,
|
||||
margin: 0,
|
||||
padding: 0,
|
||||
zIndex: 1
|
||||
});
|
||||
|
||||
/**
|
||||
* @ignore - internal component.
|
||||
*/
|
||||
const SwitchBase = /*#__PURE__*/React.forwardRef(function SwitchBase(props, ref) {
|
||||
const {
|
||||
autoFocus,
|
||||
checked: checkedProp,
|
||||
checkedIcon,
|
||||
className,
|
||||
defaultChecked,
|
||||
disabled: disabledProp,
|
||||
disableFocusRipple = false,
|
||||
edge = false,
|
||||
icon,
|
||||
id,
|
||||
inputProps,
|
||||
inputRef,
|
||||
name,
|
||||
onBlur,
|
||||
onChange,
|
||||
onFocus,
|
||||
readOnly,
|
||||
required = false,
|
||||
tabIndex,
|
||||
type,
|
||||
value
|
||||
} = props,
|
||||
other = _objectWithoutPropertiesLoose(props, _excluded);
|
||||
const [checked, setCheckedState] = useControlled({
|
||||
controlled: checkedProp,
|
||||
default: Boolean(defaultChecked),
|
||||
name: 'SwitchBase',
|
||||
state: 'checked'
|
||||
});
|
||||
const muiFormControl = useFormControl();
|
||||
const handleFocus = event => {
|
||||
if (onFocus) {
|
||||
onFocus(event);
|
||||
}
|
||||
if (muiFormControl && muiFormControl.onFocus) {
|
||||
muiFormControl.onFocus(event);
|
||||
}
|
||||
};
|
||||
const handleBlur = event => {
|
||||
if (onBlur) {
|
||||
onBlur(event);
|
||||
}
|
||||
if (muiFormControl && muiFormControl.onBlur) {
|
||||
muiFormControl.onBlur(event);
|
||||
}
|
||||
};
|
||||
const handleInputChange = event => {
|
||||
// Workaround for https://github.com/facebook/react/issues/9023
|
||||
if (event.nativeEvent.defaultPrevented) {
|
||||
return;
|
||||
}
|
||||
const newChecked = event.target.checked;
|
||||
setCheckedState(newChecked);
|
||||
if (onChange) {
|
||||
// TODO v6: remove the second argument.
|
||||
onChange(event, newChecked);
|
||||
}
|
||||
};
|
||||
let disabled = disabledProp;
|
||||
if (muiFormControl) {
|
||||
if (typeof disabled === 'undefined') {
|
||||
disabled = muiFormControl.disabled;
|
||||
}
|
||||
}
|
||||
const hasLabelFor = type === 'checkbox' || type === 'radio';
|
||||
const ownerState = _extends({}, props, {
|
||||
checked,
|
||||
disabled,
|
||||
disableFocusRipple,
|
||||
edge
|
||||
});
|
||||
const classes = useUtilityClasses(ownerState);
|
||||
return /*#__PURE__*/_jsxs(SwitchBaseRoot, _extends({
|
||||
component: "span",
|
||||
className: clsx(classes.root, className),
|
||||
centerRipple: true,
|
||||
focusRipple: !disableFocusRipple,
|
||||
disabled: disabled,
|
||||
tabIndex: null,
|
||||
role: undefined,
|
||||
onFocus: handleFocus,
|
||||
onBlur: handleBlur,
|
||||
ownerState: ownerState,
|
||||
ref: ref
|
||||
}, other, {
|
||||
children: [/*#__PURE__*/_jsx(SwitchBaseInput, _extends({
|
||||
autoFocus: autoFocus,
|
||||
checked: checkedProp,
|
||||
defaultChecked: defaultChecked,
|
||||
className: classes.input,
|
||||
disabled: disabled,
|
||||
id: hasLabelFor ? id : undefined,
|
||||
name: name,
|
||||
onChange: handleInputChange,
|
||||
readOnly: readOnly,
|
||||
ref: inputRef,
|
||||
required: required,
|
||||
ownerState: ownerState,
|
||||
tabIndex: tabIndex,
|
||||
type: type
|
||||
}, type === 'checkbox' && value === undefined ? {} : {
|
||||
value
|
||||
}, inputProps)), checked ? checkedIcon : icon]
|
||||
}));
|
||||
});
|
||||
|
||||
// NB: If changed, please update Checkbox, Switch and Radio
|
||||
// so that the API documentation is updated.
|
||||
process.env.NODE_ENV !== "production" ? SwitchBase.propTypes = {
|
||||
/**
|
||||
* If `true`, the `input` element is focused during the first mount.
|
||||
*/
|
||||
autoFocus: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, the component is checked.
|
||||
*/
|
||||
checked: PropTypes.bool,
|
||||
/**
|
||||
* The icon to display when the component is checked.
|
||||
*/
|
||||
checkedIcon: PropTypes.node.isRequired,
|
||||
/**
|
||||
* Override or extend the styles applied to the component.
|
||||
*/
|
||||
classes: PropTypes.object,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
className: PropTypes.string,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
defaultChecked: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, the component is disabled.
|
||||
*/
|
||||
disabled: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, the keyboard focus ripple is disabled.
|
||||
* @default false
|
||||
*/
|
||||
disableFocusRipple: PropTypes.bool,
|
||||
/**
|
||||
* If given, uses a negative margin to counteract the padding on one
|
||||
* side (this is often helpful for aligning the left or right
|
||||
* side of the icon with content above or below, without ruining the border
|
||||
* size and shape).
|
||||
* @default false
|
||||
*/
|
||||
edge: PropTypes.oneOf(['end', 'start', false]),
|
||||
/**
|
||||
* The icon to display when the component is unchecked.
|
||||
*/
|
||||
icon: PropTypes.node.isRequired,
|
||||
/**
|
||||
* The id of the `input` element.
|
||||
*/
|
||||
id: PropTypes.string,
|
||||
/**
|
||||
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.
|
||||
*/
|
||||
inputProps: PropTypes.object,
|
||||
/**
|
||||
* Pass a ref to the `input` element.
|
||||
*/
|
||||
inputRef: refType,
|
||||
/*
|
||||
* @ignore
|
||||
*/
|
||||
name: PropTypes.string,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onBlur: PropTypes.func,
|
||||
/**
|
||||
* Callback fired when the state is changed.
|
||||
*
|
||||
* @param {object} event The event source of the callback.
|
||||
* You can pull out the new checked state by accessing `event.target.checked` (boolean).
|
||||
*/
|
||||
onChange: PropTypes.func,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
onFocus: PropTypes.func,
|
||||
/**
|
||||
* It prevents the user from changing the value of the field
|
||||
* (not from interacting with the field).
|
||||
*/
|
||||
readOnly: PropTypes.bool,
|
||||
/**
|
||||
* If `true`, the `input` element is required.
|
||||
*/
|
||||
required: PropTypes.bool,
|
||||
/**
|
||||
* The system prop that allows defining system overrides as well as additional CSS styles.
|
||||
*/
|
||||
sx: PropTypes.object,
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
tabIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
||||
/**
|
||||
* The input component prop `type`.
|
||||
*/
|
||||
type: PropTypes.string.isRequired,
|
||||
/**
|
||||
* The value of the component.
|
||||
*/
|
||||
value: PropTypes.any
|
||||
} : void 0;
|
||||
export default SwitchBase;
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
function easeInOutSin(time) {
|
||||
return (1 + Math.sin(Math.PI * time - Math.PI / 2)) / 2;
|
||||
}
|
||||
export default function animate(property, element, to, options = {}, cb = () => {}) {
|
||||
const {
|
||||
ease = easeInOutSin,
|
||||
duration = 300 // standard
|
||||
} = options;
|
||||
let start = null;
|
||||
const from = element[property];
|
||||
let cancelled = false;
|
||||
const cancel = () => {
|
||||
cancelled = true;
|
||||
};
|
||||
const step = timestamp => {
|
||||
if (cancelled) {
|
||||
cb(new Error('Animation cancelled'));
|
||||
return;
|
||||
}
|
||||
if (start === null) {
|
||||
start = timestamp;
|
||||
}
|
||||
const time = Math.min(1, (timestamp - start) / duration);
|
||||
element[property] = ease(time) * (to - from) + from;
|
||||
if (time >= 1) {
|
||||
requestAnimationFrame(() => {
|
||||
cb(null);
|
||||
});
|
||||
return;
|
||||
}
|
||||
requestAnimationFrame(step);
|
||||
};
|
||||
if (from === to) {
|
||||
cb(new Error('Element already at target position'));
|
||||
return cancel;
|
||||
}
|
||||
requestAnimationFrame(step);
|
||||
return cancel;
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
'use client';
|
||||
|
||||
import * as React from 'react';
|
||||
import createSvgIcon from '../../utils/createSvgIcon';
|
||||
|
||||
/**
|
||||
* @ignore - internal component.
|
||||
*/
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
export default createSvgIcon( /*#__PURE__*/_jsx("path", {
|
||||
d: "M7 10l5 5 5-5z"
|
||||
}), 'ArrowDropDown');
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
'use client';
|
||||
|
||||
import * as React from 'react';
|
||||
import createSvgIcon from '../../utils/createSvgIcon';
|
||||
|
||||
/**
|
||||
* @ignore - internal component.
|
||||
*/
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
export default createSvgIcon( /*#__PURE__*/_jsx("path", {
|
||||
d: "M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z"
|
||||
}), 'Cancel');
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
'use client';
|
||||
|
||||
import * as React from 'react';
|
||||
import createSvgIcon from '../../utils/createSvgIcon';
|
||||
|
||||
/**
|
||||
* @ignore - internal component.
|
||||
*/
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
export default createSvgIcon( /*#__PURE__*/_jsx("path", {
|
||||
d: "M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"
|
||||
}), 'CheckBox');
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
'use client';
|
||||
|
||||
import * as React from 'react';
|
||||
import createSvgIcon from '../../utils/createSvgIcon';
|
||||
|
||||
/**
|
||||
* @ignore - internal component.
|
||||
*/
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
export default createSvgIcon( /*#__PURE__*/_jsx("path", {
|
||||
d: "M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"
|
||||
}), 'CheckBoxOutlineBlank');
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
'use client';
|
||||
|
||||
import * as React from 'react';
|
||||
import createSvgIcon from '../../utils/createSvgIcon';
|
||||
|
||||
/**
|
||||
* @ignore - internal component.
|
||||
*
|
||||
* Alias to `Clear`.
|
||||
*/
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
export default createSvgIcon( /*#__PURE__*/_jsx("path", {
|
||||
d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"
|
||||
}), 'Close');
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
'use client';
|
||||
|
||||
import * as React from 'react';
|
||||
import createSvgIcon from '../../utils/createSvgIcon';
|
||||
|
||||
/**
|
||||
* @ignore - internal component.
|
||||
*/
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
export default createSvgIcon( /*#__PURE__*/_jsx("path", {
|
||||
d: "M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"
|
||||
}), 'ErrorOutline');
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
'use client';
|
||||
|
||||
import * as React from 'react';
|
||||
import createSvgIcon from '../../utils/createSvgIcon';
|
||||
|
||||
/**
|
||||
* @ignore - internal component.
|
||||
*/
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
export default createSvgIcon( /*#__PURE__*/_jsx("path", {
|
||||
d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z"
|
||||
}), 'IndeterminateCheckBox');
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
'use client';
|
||||
|
||||
import * as React from 'react';
|
||||
import createSvgIcon from '../../utils/createSvgIcon';
|
||||
|
||||
/**
|
||||
* @ignore - internal component.
|
||||
*/
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
export default createSvgIcon( /*#__PURE__*/_jsx("path", {
|
||||
d: "M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20, 12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10, 10 0 0,0 12,2M11,17H13V11H11V17Z"
|
||||
}), 'InfoOutlined');
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
'use client';
|
||||
|
||||
import * as React from 'react';
|
||||
import createSvgIcon from '../../utils/createSvgIcon';
|
||||
|
||||
/**
|
||||
* @ignore - internal component.
|
||||
*/
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
export default createSvgIcon( /*#__PURE__*/_jsx("path", {
|
||||
d: "M15.41 16.09l-4.58-4.59 4.58-4.59L14 5.5l-6 6 6 6z"
|
||||
}), 'KeyboardArrowLeft');
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
'use client';
|
||||
|
||||
import * as React from 'react';
|
||||
import createSvgIcon from '../../utils/createSvgIcon';
|
||||
|
||||
/**
|
||||
* @ignore - internal component.
|
||||
*/
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
export default createSvgIcon( /*#__PURE__*/_jsx("path", {
|
||||
d: "M8.59 16.34l4.58-4.59-4.58-4.59L10 5.75l6 6-6 6z"
|
||||
}), 'KeyboardArrowRight');
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
'use client';
|
||||
|
||||
import * as React from 'react';
|
||||
import createSvgIcon from '../../utils/createSvgIcon';
|
||||
|
||||
/**
|
||||
* @ignore - internal component.
|
||||
*/
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
export default createSvgIcon( /*#__PURE__*/_jsx("path", {
|
||||
d: "M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"
|
||||
}), 'Person');
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
'use client';
|
||||
|
||||
import * as React from 'react';
|
||||
import createSvgIcon from '../../utils/createSvgIcon';
|
||||
|
||||
/**
|
||||
* @ignore - internal component.
|
||||
*/
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
export default createSvgIcon( /*#__PURE__*/_jsx("path", {
|
||||
d: "M8.465 8.465C9.37 7.56 10.62 7 12 7C14.76 7 17 9.24 17 12C17 13.38 16.44 14.63 15.535 15.535C14.63 16.44 13.38 17 12 17C9.24 17 7 14.76 7 12C7 10.62 7.56 9.37 8.465 8.465Z"
|
||||
}), 'RadioButtonChecked');
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
'use client';
|
||||
|
||||
import * as React from 'react';
|
||||
import createSvgIcon from '../../utils/createSvgIcon';
|
||||
|
||||
/**
|
||||
* @ignore - internal component.
|
||||
*/
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
export default createSvgIcon( /*#__PURE__*/_jsx("path", {
|
||||
d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"
|
||||
}), 'RadioButtonUnchecked');
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
'use client';
|
||||
|
||||
import * as React from 'react';
|
||||
import createSvgIcon from '../../utils/createSvgIcon';
|
||||
|
||||
/**
|
||||
* @ignore - internal component.
|
||||
*/
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
export default createSvgIcon( /*#__PURE__*/_jsx("path", {
|
||||
d: "M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"
|
||||
}), 'ReportProblemOutlined');
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
'use client';
|
||||
|
||||
import * as React from 'react';
|
||||
import createSvgIcon from '../../utils/createSvgIcon';
|
||||
|
||||
/**
|
||||
* @ignore - internal component.
|
||||
*/
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
export default createSvgIcon( /*#__PURE__*/_jsx("path", {
|
||||
d: "M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z"
|
||||
}), 'SuccessOutlined');
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
||||
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
||||
export function getSwitchBaseUtilityClass(slot) {
|
||||
return generateUtilityClass('PrivateSwitchBase', slot);
|
||||
}
|
||||
const switchBaseClasses = generateUtilityClasses('PrivateSwitchBase', ['root', 'checked', 'disabled', 'input', 'edgeStart', 'edgeEnd']);
|
||||
export default switchBaseClasses;
|
||||
Reference in New Issue
Block a user