0% found this document useful (0 votes)
2 views12 pages

TPS4

The document appears to be a code snippet related to a UI component, specifically a switch element in a React application. It includes various properties and methods for managing the switch's state, appearance, and behavior, such as handling focus, blur, and change events. Additionally, it defines styles and overrides for different states of the switch, including checked, disabled, and various sizes.

Uploaded by

Rivail Silva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views12 pages

TPS4

The document appears to be a code snippet related to a UI component, specifically a switch element in a React application. It includes various properties and methods for managing the switch's state, appearance, and behavior, such as handling focus, blur, and change events. Additionally, it defines styles and overrides for different states of the switch, including checked, disabled, and various sizes.

Uploaded by

Rivail Silva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 12

id 0 !

== f && f

, h = e.icon

, m = e.id

, v = e.inputProps

, y = e.inputRef

, b = e.name

, x = e.onBlur

, _ = e.onChange

, w = e.onFocus

, E = e.readOnly

, S = e.required

, k = void 0 !== S && S

, C = e.tabIndex

, A = e.type

, P = e.value

, T = (0,

hu.Z)(e, Xm)

, R = (0,

dp.Z)({

controlled: r,

default: Boolean(s),

name: "SwitchBase",

state: "checked"

})

, O = (0,

g.Z)(R, 2)

, j = O[0]

, I = O[1]
, N = u.useContext(mm)

, L = l;

N && "undefined" === typeof L && (L = N.disabled);

var M = "checkbox" === A || "radio" === A

, D = (0,

Bc.Z)({}, e, {

checked: j,

disabled: L,

disableFocusRipple: d,

edge: p

})

, F = function(e) {

var t = e.classes

, n = e.checked

, r = e.disabled

, o = e.edge

,i={

root: ["root", n && "checked", r && "disabled", o && "edge".concat((0,

$c.Z)(o))],

input: ["input"]

};

return (0,

Hc.Z)(i, Ym, t)

}(D);

return (0,

a.jsxs)(Jm, (0,

Bc.Z)({

component: "span",
className: (0,

qc.Z)(F.root, i),

centerRipple: !0,

focusRipple: !d,

disabled: L,

tabIndex: null,

role: void 0,

onFocus: function(e) {

w && w(e),

N && N.onFocus && N.onFocus(e)

},

onBlur: function(e) {

x && x(e),

N && N.onBlur && N.onBlur(e)

},

ownerState: D,

ref: t

}, T, {

children: [(0,

a.jsx)($m, (0,

Bc.Z)({

autoFocus: n,

checked: r,

defaultChecked: s,

className: F.input,

disabled: L,

id: M ? m : void 0,

name: b,
onChange: function(e) {

if (!e.nativeEvent.defaultPrevented) {

var t = e.target.checked;

I(t),

_ && _(e, t)

},

readOnly: E,

ref: y,

required: k,

ownerState: D,

tabIndex: C,

type: A

}, "checkbox" === A && void 0 === P ? {} : {

value: P

}, v)), j ? o : h]

}))

))

, tv = ev;

function nv(e) {

return (0,

Bf.Z)("MuiSwitch", e)

var rv, ov, iv, av, sv, lv = (0,

qf.Z)("MuiSwitch", ["root", "edgeStart", "edgeEnd", "switchBase", "colorPrimary",


"colorSecondary", "sizeSmall", "sizeMedium", "checked", "disabled", "input", "thumb",
"track"]), uv = ["className", "color", "edge", "size", "sx"], cv = (0,

Gc.ZP)("span", {
name: "MuiSwitch",

slot: "Root",

overridesResolver: function(e, t) {

var n = e.ownerState;

return [t.root, n.edge && t["edge".concat((0,

$c.Z)(n.edge))], t["size".concat((0,

$c.Z)(n.size))]]

})((function(e) {

var t, n = e.ownerState;

return (0,

Bc.Z)({

display: "inline-flex",

width: 58,

height: 38,

overflow: "hidden",

padding: 12,

boxSizing: "border-box",

position: "relative",

flexShrink: 0,

zIndex: 0,

verticalAlign: "middle",

"@media print": {

colorAdjust: "exact"

}, "start" === n.edge && {

marginLeft: -8

}, "end" === n.edge && {


marginRight: -8

}, "small" === n.size && (t = {

width: 40,

height: 24,

padding: 7

},

(0,

y.Z)(t, "& .".concat(lv.thumb), {

width: 16,

height: 16

}),

(0,

y.Z)(t, "& .".concat(lv.switchBase), (0,

y.Z)({

padding: 4

}, "&.".concat(lv.checked), {

transform: "translateX(16px)"

})),

t))

)), dv = (0,

Gc.ZP)(tv, {

name: "MuiSwitch",

slot: "SwitchBase",

overridesResolver: function(e, t) {

var n = e.ownerState;

return [t.switchBase, (0,


y.Z)({}, "& .".concat(lv.input), t.input), "default" !== n.color &&
t["color".concat((0,

$c.Z)(n.color))]]

})((function(e) {

var t, n = e.theme;

return t = {

position: "absolute",

top: 0,

left: 0,

zIndex: 1,

color: n.vars ? n.vars.palette.Switch.defaultColor : "".concat("light" ===


n.palette.mode ? n.palette.common.white : n.palette.grey[300]),

transition: n.transitions.create(["left", "transform"], {

duration: n.transitions.duration.shortest

})

},

(0,

y.Z)(t, "&.".concat(lv.checked), {

transform: "translateX(20px)"

}),

(0,

y.Z)(t, "&.".concat(lv.disabled), {

color: n.vars ? n.vars.palette.Switch.defaultDisabledColor : "".concat("light"


=== n.palette.mode ? n.palette.grey[100] : n.palette.grey[600])

}),

(0,

y.Z)(t, "&.".concat(lv.checked, " + .").concat(lv.track), {

opacity: .5
}),

(0,

y.Z)(t, "&.".concat(lv.disabled, " + .").concat(lv.track), {

opacity: n.vars ? n.vars.opacity.switchTrackDisabled : "".concat("light" ===


n.palette.mode ? .12 : .2)

}),

(0,

y.Z)(t, "& .".concat(lv.input), {

left: "-100%",

width: "300%"

}),

), (function(e) {

var t, n = e.theme, r = e.ownerState;

return (0,

Bc.Z)({

"&:hover": {

backgroundColor: n.vars ?
"rgba(".concat(n.vars.palette.action.activeChannel, " /
").concat(n.vars.palette.action.hoverOpacity, ")") : (0,

Wc.Fq)(n.palette.action.active, n.palette.action.hoverOpacity),

"@media (hover: none)": {

backgroundColor: "transparent"

}, "default" !== r.color && (t = {},

(0,

y.Z)(t, "&.".concat(lv.checked), (0,


y.Z)({

color: (n.vars || n).palette[r.color].main,

"&:hover": {

backgroundColor: n.vars ?
"rgba(".concat(n.vars.palette[r.color].mainChannel, " /
").concat(n.vars.palette.action.hoverOpacity, ")") : (0,

Wc.Fq)(n.palette[r.color].main, n.palette.action.hoverOpacity),

"@media (hover: none)": {

backgroundColor: "transparent"

}, "&.".concat(lv.disabled), {

color: n.vars ? n.vars.palette.Switch["".concat(r.color, "DisabledColor")] :


"".concat("light" === n.palette.mode ? (0,

Wc.$n)(n.palette[r.color].main, .62) : (0,

Wc._j)(n.palette[r.color].main, .55))

})),

(0,

y.Z)(t, "&.".concat(lv.checked, " + .").concat(lv.track), {

backgroundColor: (n.vars || n).palette[r.color].main

}),

t))

)), fv = (0,

Gc.ZP)("span", {

name: "MuiSwitch",

slot: "Track",

overridesResolver: function(e, t) {

return t.track
}

})((function(e) {

var t = e.theme;

return {

height: "100%",

width: "100%",

borderRadius: 7,

zIndex: -1,

transition: t.transitions.create(["opacity", "background-color"], {

duration: t.transitions.duration.shortest

}),

backgroundColor: t.vars ? t.vars.palette.common.onBackground :


"".concat("light" === t.palette.mode ? t.palette.common.black :
t.palette.common.white),

opacity: t.vars ? t.vars.opacity.switchTrack : "".concat("light" ===


t.palette.mode ? .38 : .3)

)), pv = (0,

Gc.ZP)("span", {

name: "MuiSwitch",

slot: "Thumb",

overridesResolver: function(e, t) {

return t.thumb

})((function(e) {

var t = e.theme;

return {

boxShadow: (t.vars || t).shadows[1],


backgroundColor: "currentColor",

width: 20,

height: 20,

borderRadius: "50%"

)), hv = u.forwardRef((function(e, t) {

var n = (0,

Jc.Z)({

props: e,

name: "MuiSwitch"

})

, r = n.className

, o = n.color

, i = void 0 === o ? "primary" : o

, s = n.edge

, l = void 0 !== s && s

, u = n.size

, c = void 0 === u ? "medium" : u

, d = n.sx

, f = (0,

hu.Z)(n, uv)

, p = (0,

Bc.Z)({}, n, {

color: i,

edge: l,

size: c

})
, h = function(e) {

var t = e.classes

, n = e.edge

, r = e.size

, o = e.color

, i = e.checked

, a = e.disabled

,s={

root: ["root", n && "edge".concat((0,

$c.Z)(n)), "size".concat((0,

$c.Z)(r))],

switchBase: ["switchBase", "color".concat((0,

$c.Z)(o)), i && "checked", a && "disabled"],

thumb: ["thumb"],

You might also like