math-main-components 0.0.224 → 0.0.226
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,7 @@
|
|
1
1
|
import React, { ChangeEvent, HTMLAttributes, ReactNode } from 'react';
|
2
|
-
export declare function Checkbox({ id, name,
|
2
|
+
export declare function Checkbox({ id, name, defaultChecked, onInput, children, ...props }: {
|
3
3
|
id?: string;
|
4
4
|
name: string;
|
5
|
-
checked?: boolean;
|
6
5
|
onInput?: (event: ChangeEvent<HTMLInputElement>) => void;
|
7
6
|
defaultChecked?: boolean;
|
8
7
|
children: ReactNode;
|
package/dist/index.cjs.js
CHANGED
@@ -9456,13 +9456,15 @@ function Button2({ id, children, type = "submit", theme = "primary", iconName =
|
|
9456
9456
|
React__default["default"].createElement(SvgIcon, { iconName: iconName }))));
|
9457
9457
|
}
|
9458
9458
|
|
9459
|
-
var css_248z$v = ".styles-module_container__gCCnD {\n margin-bottom: 20px;\n color: var(--foreground-3);\n width: 100%;\n}\n.styles-module_container__gCCnD [type=checkbox] {\n position: relative;\n left: 15px;\n top: -4px;\n z-index: 0;\n appearance: none;\n -webkit-appearance: none;\n cursor: pointer;\n margin-left: -3.5px;\n display: none;\n}\n.styles-module_container__gCCnD [type=checkbox] + label {\n position: relative;\n cursor: pointer;\n user-select: none;\n -webkit-user-select: none;\n}\n.styles-module_container__gCCnD [type=checkbox] + label::before {\n width: 17px;\n height: 17px;\n border-radius: 5px;\n border: 2px solid var(--border-2);\n display: block;\n content: \"\";\n float: left;\n margin-right: 8px;\n z-index: 5;\n position: relative;\n transition: 0.2s ease-in-out;\n}\n.styles-module_container__gCCnD [type=checkbox] ~ span {\n position: absolute;\n opacity: 1;\n color: var(--background-2);\n z-index: 100;\n user-select: none;\n pointer-events: none;\n -webkit-user-select: none;\n font-weight: 500;\n top:
|
9459
|
+
var css_248z$v = ".styles-module_container__gCCnD {\n margin-bottom: 20px;\n color: var(--foreground-3);\n width: 100%;\n position: relative;\n}\n.styles-module_container__gCCnD [type=checkbox] {\n position: relative;\n left: 15px;\n top: -4px;\n z-index: 0;\n appearance: none;\n -webkit-appearance: none;\n cursor: pointer;\n margin-left: -3.5px;\n display: none;\n}\n.styles-module_container__gCCnD [type=checkbox] + label {\n position: relative;\n cursor: pointer;\n user-select: none;\n -webkit-user-select: none;\n}\n.styles-module_container__gCCnD [type=checkbox] + label::before {\n width: 17px;\n height: 17px;\n border-radius: 5px;\n border: 2px solid var(--border-2);\n display: block;\n content: \"\";\n float: left;\n margin-right: 8px;\n z-index: 5;\n position: relative;\n transition: 0.2s ease-in-out;\n}\n.styles-module_container__gCCnD [type=checkbox] ~ span {\n position: absolute;\n opacity: 1;\n color: var(--background-2);\n z-index: 100;\n user-select: none;\n pointer-events: none;\n -webkit-user-select: none;\n font-weight: 500;\n top: 0px;\n left: 0px;\n}\n.styles-module_container__gCCnD [type=checkbox]:checked + label::before {\n background-color: var(--primary-1);\n border-color: var(--primary-1);\n}\n.styles-module_container__gCCnD [type=checkbox]:hover:not(:checked) + label::before {\n background-color: var(--background-4);\n border-color: var(--border-2);\n}";
|
9460
9460
|
var styles$v = {"container":"styles-module_container__gCCnD"};
|
9461
9461
|
styleInject(css_248z$v);
|
9462
9462
|
|
9463
|
-
function Checkbox({ id, name,
|
9463
|
+
function Checkbox({ id, name, defaultChecked = false, onInput = () => { }, children, ...props }) {
|
9464
|
+
const [checked, setChecked] = React__default["default"].useState(defaultChecked);
|
9465
|
+
React.useEffect(() => setChecked(defaultChecked), [defaultChecked]);
|
9464
9466
|
return (React__default["default"].createElement("div", { className: styles$v.container, ...props },
|
9465
|
-
React__default["default"].createElement("input", { type: "checkbox", onInput: onInput, name: name,
|
9467
|
+
React__default["default"].createElement("input", { type: "checkbox", onInput: onInput, name: name, defaultChecked: checked, id: id || name }),
|
9466
9468
|
React__default["default"].createElement("label", { htmlFor: id || name }, children),
|
9467
9469
|
React__default["default"].createElement(SvgIcon, { iconName: "done", size: "21px" })));
|
9468
9470
|
}
|
package/dist/index.esm.js
CHANGED
@@ -9430,13 +9430,15 @@ function Button2({ id, children, type = "submit", theme = "primary", iconName =
|
|
9430
9430
|
React__default.createElement(SvgIcon, { iconName: iconName }))));
|
9431
9431
|
}
|
9432
9432
|
|
9433
|
-
var css_248z$v = ".styles-module_container__gCCnD {\n margin-bottom: 20px;\n color: var(--foreground-3);\n width: 100%;\n}\n.styles-module_container__gCCnD [type=checkbox] {\n position: relative;\n left: 15px;\n top: -4px;\n z-index: 0;\n appearance: none;\n -webkit-appearance: none;\n cursor: pointer;\n margin-left: -3.5px;\n display: none;\n}\n.styles-module_container__gCCnD [type=checkbox] + label {\n position: relative;\n cursor: pointer;\n user-select: none;\n -webkit-user-select: none;\n}\n.styles-module_container__gCCnD [type=checkbox] + label::before {\n width: 17px;\n height: 17px;\n border-radius: 5px;\n border: 2px solid var(--border-2);\n display: block;\n content: \"\";\n float: left;\n margin-right: 8px;\n z-index: 5;\n position: relative;\n transition: 0.2s ease-in-out;\n}\n.styles-module_container__gCCnD [type=checkbox] ~ span {\n position: absolute;\n opacity: 1;\n color: var(--background-2);\n z-index: 100;\n user-select: none;\n pointer-events: none;\n -webkit-user-select: none;\n font-weight: 500;\n top:
|
9433
|
+
var css_248z$v = ".styles-module_container__gCCnD {\n margin-bottom: 20px;\n color: var(--foreground-3);\n width: 100%;\n position: relative;\n}\n.styles-module_container__gCCnD [type=checkbox] {\n position: relative;\n left: 15px;\n top: -4px;\n z-index: 0;\n appearance: none;\n -webkit-appearance: none;\n cursor: pointer;\n margin-left: -3.5px;\n display: none;\n}\n.styles-module_container__gCCnD [type=checkbox] + label {\n position: relative;\n cursor: pointer;\n user-select: none;\n -webkit-user-select: none;\n}\n.styles-module_container__gCCnD [type=checkbox] + label::before {\n width: 17px;\n height: 17px;\n border-radius: 5px;\n border: 2px solid var(--border-2);\n display: block;\n content: \"\";\n float: left;\n margin-right: 8px;\n z-index: 5;\n position: relative;\n transition: 0.2s ease-in-out;\n}\n.styles-module_container__gCCnD [type=checkbox] ~ span {\n position: absolute;\n opacity: 1;\n color: var(--background-2);\n z-index: 100;\n user-select: none;\n pointer-events: none;\n -webkit-user-select: none;\n font-weight: 500;\n top: 0px;\n left: 0px;\n}\n.styles-module_container__gCCnD [type=checkbox]:checked + label::before {\n background-color: var(--primary-1);\n border-color: var(--primary-1);\n}\n.styles-module_container__gCCnD [type=checkbox]:hover:not(:checked) + label::before {\n background-color: var(--background-4);\n border-color: var(--border-2);\n}";
|
9434
9434
|
var styles$v = {"container":"styles-module_container__gCCnD"};
|
9435
9435
|
styleInject(css_248z$v);
|
9436
9436
|
|
9437
|
-
function Checkbox({ id, name,
|
9437
|
+
function Checkbox({ id, name, defaultChecked = false, onInput = () => { }, children, ...props }) {
|
9438
|
+
const [checked, setChecked] = React__default.useState(defaultChecked);
|
9439
|
+
useEffect(() => setChecked(defaultChecked), [defaultChecked]);
|
9438
9440
|
return (React__default.createElement("div", { className: styles$v.container, ...props },
|
9439
|
-
React__default.createElement("input", { type: "checkbox", onInput: onInput, name: name,
|
9441
|
+
React__default.createElement("input", { type: "checkbox", onInput: onInput, name: name, defaultChecked: checked, id: id || name }),
|
9440
9442
|
React__default.createElement("label", { htmlFor: id || name }, children),
|
9441
9443
|
React__default.createElement(SvgIcon, { iconName: "done", size: "21px" })));
|
9442
9444
|
}
|