@app-garage/switch
Advanced tools
Comparing version 1.2.0 to 1.3.0
# Change Log | ||
## 1.3.0 | ||
### Minor Changes | ||
- [`78c43d3`](https://github.com/electronic33/ag-ui-react/commit/78c43d3087b674a6ee7547738e10c339569569fd) Thanks [@Levi1235](https://github.com/Levi1235)! - checkbox, switch fix | ||
## 1.2.0 | ||
@@ -4,0 +10,0 @@ |
@@ -62,5 +62,5 @@ import React, { forwardRef } from 'react'; | ||
var Switch = forwardRef(function (_a, ref) { | ||
var _b, _c, _d, _e; | ||
var value = _a.value, label = _a.label, onChange = _a.onChange, onBlur = _a.onBlur, containerClassName = _a.containerClassName, isDisabled = _a.isDisabled, _f = _a.notActiveBackGroundColorClass, notActiveBackGroundColorClass = _f === void 0 ? 'switch-not-active-bg-default' : _f, _g = _a.activeBackGroundColorClass, activeBackGroundColorClass = _g === void 0 ? 'switch-active-bg-default' : _g, _h = _a.activeDotBackgroundColorClass, activeDotBackgroundColorClass = _h === void 0 ? 'switch-dot-bg-default' : _h, _j = _a.notActiveDotBackgroundColorClass, notActiveDotBackgroundColorClass = _j === void 0 ? 'switch-dot-bg-default' : _j, name = _a.name, field = _a.field, form = _a.form; | ||
var _k = useBooleanInputValues({ | ||
var _b, _c, _d, _e, _f, _g; | ||
var value = _a.value, label = _a.label, onChange = _a.onChange, onBlur = _a.onBlur, containerClassName = _a.containerClassName, isDisabled = _a.isDisabled, _h = _a.notActiveBackGroundColorClass, notActiveBackGroundColorClass = _h === void 0 ? 'switch-not-active-bg-default' : _h, _j = _a.activeBackGroundColorClass, activeBackGroundColorClass = _j === void 0 ? 'switch-active-bg-default' : _j, _k = _a.activeDotBackgroundColorClass, activeDotBackgroundColorClass = _k === void 0 ? 'switch-dot-bg-default' : _k, _l = _a.notActiveDotBackgroundColorClass, notActiveDotBackgroundColorClass = _l === void 0 ? 'switch-dot-bg-default' : _l, name = _a.name, field = _a.field, form = _a.form, _m = _a.iosMode, iosMode = _m === void 0 ? false : _m; | ||
var _o = useBooleanInputValues({ | ||
value: value, | ||
@@ -72,7 +72,11 @@ field: field, | ||
onChange: onChange, | ||
}), formikCompatibleOnChange = _k.formikCompatibleOnChange, formikCompatibleError = _k.formikCompatibleError, formikCompatibleName = _k.formikCompatibleName, formikCompatibleOnBlur = _k.formikCompatibleOnBlur, formikCompatibleValue = _k.formikCompatibleValue; | ||
}), formikCompatibleOnChange = _o.formikCompatibleOnChange, formikCompatibleError = _o.formikCompatibleError, formikCompatibleName = _o.formikCompatibleName, formikCompatibleOnBlur = _o.formikCompatibleOnBlur, formikCompatibleValue = _o.formikCompatibleValue; | ||
return (React.createElement("div", { className: "switch-container" }, | ||
label && React.createElement(Label, null, label), | ||
React.createElement("button", { type: "button", className: classNames(' switch-button', { | ||
React.createElement("button", { type: "button", className: classNames({ | ||
'switch-button-disabled ': isDisabled, | ||
}, { | ||
'switch-button ': !iosMode, | ||
}, { | ||
'switch-button-ios ': iosMode, | ||
}, containerClassName), disabled: isDisabled, onClick: function () { | ||
@@ -92,6 +96,10 @@ if (formikCompatibleValue !== undefined && formikCompatibleOnChange) { | ||
React.createElement("span", { className: classNames('switch-dot', (_d = {}, | ||
_d["switch-active-dot " + activeDotBackgroundColorClass] = formikCompatibleValue, | ||
_d["switch-active-dot " + activeDotBackgroundColorClass] = formikCompatibleValue && !iosMode, | ||
_d), (_e = {}, | ||
_e["switch-not-active-dot " + notActiveDotBackgroundColorClass] = !formikCompatibleValue, | ||
_e)) })), | ||
_e["switch-not-active-dot " + notActiveDotBackgroundColorClass] = !formikCompatibleValue && !iosMode, | ||
_e), (_f = {}, | ||
_f["switch-active-dot-ios " + activeDotBackgroundColorClass] = formikCompatibleValue && iosMode, | ||
_f), (_g = {}, | ||
_g["switch-not-active-dot-ios " + notActiveDotBackgroundColorClass] = !formikCompatibleValue && iosMode, | ||
_g)) })), | ||
formikCompatibleError && React.createElement("span", { className: "switch-error" }, formikCompatibleError))); | ||
@@ -98,0 +106,0 @@ }); |
@@ -71,5 +71,5 @@ 'use strict'; | ||
var Switch = React.forwardRef(function (_a, ref) { | ||
var _b, _c, _d, _e; | ||
var value = _a.value, label$1 = _a.label, onChange = _a.onChange, onBlur = _a.onBlur, containerClassName = _a.containerClassName, isDisabled = _a.isDisabled, _f = _a.notActiveBackGroundColorClass, notActiveBackGroundColorClass = _f === void 0 ? 'switch-not-active-bg-default' : _f, _g = _a.activeBackGroundColorClass, activeBackGroundColorClass = _g === void 0 ? 'switch-active-bg-default' : _g, _h = _a.activeDotBackgroundColorClass, activeDotBackgroundColorClass = _h === void 0 ? 'switch-dot-bg-default' : _h, _j = _a.notActiveDotBackgroundColorClass, notActiveDotBackgroundColorClass = _j === void 0 ? 'switch-dot-bg-default' : _j, name = _a.name, field = _a.field, form = _a.form; | ||
var _k = useBooleanInputValues({ | ||
var _b, _c, _d, _e, _f, _g; | ||
var value = _a.value, label$1 = _a.label, onChange = _a.onChange, onBlur = _a.onBlur, containerClassName = _a.containerClassName, isDisabled = _a.isDisabled, _h = _a.notActiveBackGroundColorClass, notActiveBackGroundColorClass = _h === void 0 ? 'switch-not-active-bg-default' : _h, _j = _a.activeBackGroundColorClass, activeBackGroundColorClass = _j === void 0 ? 'switch-active-bg-default' : _j, _k = _a.activeDotBackgroundColorClass, activeDotBackgroundColorClass = _k === void 0 ? 'switch-dot-bg-default' : _k, _l = _a.notActiveDotBackgroundColorClass, notActiveDotBackgroundColorClass = _l === void 0 ? 'switch-dot-bg-default' : _l, name = _a.name, field = _a.field, form = _a.form, _m = _a.iosMode, iosMode = _m === void 0 ? false : _m; | ||
var _o = useBooleanInputValues({ | ||
value: value, | ||
@@ -81,7 +81,11 @@ field: field, | ||
onChange: onChange, | ||
}), formikCompatibleOnChange = _k.formikCompatibleOnChange, formikCompatibleError = _k.formikCompatibleError, formikCompatibleName = _k.formikCompatibleName, formikCompatibleOnBlur = _k.formikCompatibleOnBlur, formikCompatibleValue = _k.formikCompatibleValue; | ||
}), formikCompatibleOnChange = _o.formikCompatibleOnChange, formikCompatibleError = _o.formikCompatibleError, formikCompatibleName = _o.formikCompatibleName, formikCompatibleOnBlur = _o.formikCompatibleOnBlur, formikCompatibleValue = _o.formikCompatibleValue; | ||
return (React__default['default'].createElement("div", { className: "switch-container" }, | ||
label$1 && React__default['default'].createElement(label.Label, null, label$1), | ||
React__default['default'].createElement("button", { type: "button", className: classNames__default['default'](' switch-button', { | ||
React__default['default'].createElement("button", { type: "button", className: classNames__default['default']({ | ||
'switch-button-disabled ': isDisabled, | ||
}, { | ||
'switch-button ': !iosMode, | ||
}, { | ||
'switch-button-ios ': iosMode, | ||
}, containerClassName), disabled: isDisabled, onClick: function () { | ||
@@ -101,6 +105,10 @@ if (formikCompatibleValue !== undefined && formikCompatibleOnChange) { | ||
React__default['default'].createElement("span", { className: classNames__default['default']('switch-dot', (_d = {}, | ||
_d["switch-active-dot " + activeDotBackgroundColorClass] = formikCompatibleValue, | ||
_d["switch-active-dot " + activeDotBackgroundColorClass] = formikCompatibleValue && !iosMode, | ||
_d), (_e = {}, | ||
_e["switch-not-active-dot " + notActiveDotBackgroundColorClass] = !formikCompatibleValue, | ||
_e)) })), | ||
_e["switch-not-active-dot " + notActiveDotBackgroundColorClass] = !formikCompatibleValue && !iosMode, | ||
_e), (_f = {}, | ||
_f["switch-active-dot-ios " + activeDotBackgroundColorClass] = formikCompatibleValue && iosMode, | ||
_f), (_g = {}, | ||
_g["switch-not-active-dot-ios " + notActiveDotBackgroundColorClass] = !formikCompatibleValue && iosMode, | ||
_g)) })), | ||
formikCompatibleError && React__default['default'].createElement("span", { className: "switch-error" }, formikCompatibleError))); | ||
@@ -107,0 +115,0 @@ }); |
@@ -17,2 +17,3 @@ import React from 'react'; | ||
form?: BooleanFormikProps; | ||
iosMode?: boolean; | ||
}; | ||
@@ -19,0 +20,0 @@ export declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLInputElement>>; |
{ | ||
"name": "@app-garage/switch", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"author": "Matyas Furtos", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
19381
272