math-main-components 0.0.210 → 0.0.213
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.
- package/dist/components/Checkbox/Checkbox.d.ts +3 -3
- package/dist/components/Dropdown/Dropdown.stories.d.ts +3 -3
- package/dist/components/Dropdown/index.d.ts +4 -4
- package/dist/components/RadioButtons/RadioButtons.d.ts +2 -2
- package/dist/index.cjs.js +10 -10
- package/dist/index.esm.js +10 -10
- package/package.json +1 -1
@@ -1,9 +1,9 @@
|
|
1
|
-
import React, { ChangeEvent, ReactNode } from 'react';
|
2
|
-
export declare function Checkbox({ id, name, checked, defaultChecked, onInput, children }: {
|
1
|
+
import React, { ChangeEvent, HTMLAttributes, ReactNode } from 'react';
|
2
|
+
export declare function Checkbox({ id, name, checked, defaultChecked, onInput, children, ...props }: {
|
3
3
|
id?: string;
|
4
4
|
name: string;
|
5
5
|
checked?: boolean;
|
6
6
|
onInput?: (event: ChangeEvent<HTMLInputElement>) => void;
|
7
7
|
defaultChecked?: boolean;
|
8
8
|
children: ReactNode;
|
9
|
-
}): React.JSX.Element;
|
9
|
+
} & HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
@@ -3,11 +3,11 @@ import type { StoryObj } from '@storybook/react';
|
|
3
3
|
import { Dropdown } from '.';
|
4
4
|
declare const meta: {
|
5
5
|
title: string;
|
6
|
-
component: <Type extends string>({ options, unit,
|
6
|
+
component: <Type extends string>({ options, unit, onInput, ...props }: {
|
7
7
|
options: Dropdown<Type>[];
|
8
|
-
|
8
|
+
onInput?: ((value: Type) => void) | undefined;
|
9
9
|
unit?: string | undefined;
|
10
|
-
} & import("react").
|
10
|
+
} & import("react").HTMLAttributes<HTMLSelectElement>) => import("react").JSX.Element;
|
11
11
|
parameters: {
|
12
12
|
layout: string;
|
13
13
|
};
|
@@ -1,10 +1,10 @@
|
|
1
|
-
import React, {
|
1
|
+
import React, { HTMLAttributes } from 'react';
|
2
2
|
export type Dropdown<Type> = {
|
3
3
|
value: Type;
|
4
4
|
label: string;
|
5
5
|
};
|
6
|
-
export declare const Dropdown: <Type extends string>({ options, unit,
|
6
|
+
export declare const Dropdown: <Type extends string>({ options, unit, onInput, ...props }: {
|
7
7
|
options: Dropdown<Type>[];
|
8
|
-
|
8
|
+
onInput?: ((value: Type) => void) | undefined;
|
9
9
|
unit?: string | undefined;
|
10
|
-
} & React.
|
10
|
+
} & React.HTMLAttributes<HTMLSelectElement>) => React.JSX.Element;
|
@@ -3,10 +3,10 @@ export type RadioOption = {
|
|
3
3
|
text: string;
|
4
4
|
name: string;
|
5
5
|
};
|
6
|
-
export declare function RadioButtons({ options, group, selected,
|
6
|
+
export declare function RadioButtons({ options, group, selected, onInput, width }: {
|
7
7
|
options: RadioOption[];
|
8
8
|
group: string;
|
9
9
|
selected?: string;
|
10
|
-
|
10
|
+
onInput?: (event: ChangeEvent<HTMLInputElement>) => void;
|
11
11
|
width?: string;
|
12
12
|
}): React.JSX.Element;
|
package/dist/index.cjs.js
CHANGED
@@ -9471,12 +9471,12 @@ function CardButton({ id, children, iconName, onClick, ...props }) {
|
|
9471
9471
|
React__default["default"].createElement("h2", null, children)));
|
9472
9472
|
}
|
9473
9473
|
|
9474
|
-
var css_248z$u = ".styles-module_container__gCCnD {\n margin-bottom: 20px;\n
|
9474
|
+
var css_248z$u = ".styles-module_container__gCCnD {\n margin-bottom: 20px;\n color: var(--foreground-3);\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}\n.styles-module_container__gCCnD [type=checkbox] + label {\n position: absolute;\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}\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(--background-2);\n}";
|
9475
9475
|
var styles$u = {"container":"styles-module_container__gCCnD"};
|
9476
9476
|
styleInject(css_248z$u);
|
9477
9477
|
|
9478
|
-
function Checkbox({ id, name, checked, defaultChecked = false, onInput = () => { }, children }) {
|
9479
|
-
return (React__default["default"].createElement("div", { className: styles$u.container },
|
9478
|
+
function Checkbox({ id, name, checked, defaultChecked = false, onInput = () => { }, children, ...props }) {
|
9479
|
+
return (React__default["default"].createElement("div", { className: styles$u.container, ...props },
|
9480
9480
|
React__default["default"].createElement("input", { type: "checkbox", onInput: onInput, name: name, checked: checked, defaultChecked: defaultChecked, id: id || name }),
|
9481
9481
|
React__default["default"].createElement("label", { htmlFor: id || name }, children),
|
9482
9482
|
React__default["default"].createElement(SvgIcon, { iconName: "done", size: "21px" })));
|
@@ -9539,12 +9539,12 @@ var css_248z$q = ".styles-module_container__hGVir {\n display: flex;\n align-i
|
|
9539
9539
|
var styles$q = {"container":"styles-module_container__hGVir","input":"styles-module_input__h-BA2","input_container":"styles-module_input_container__2u56C","unit_label":"styles-module_unit_label__EVP9q"};
|
9540
9540
|
styleInject(css_248z$q);
|
9541
9541
|
|
9542
|
-
const Dropdown = ({ options = [], unit = "",
|
9542
|
+
const Dropdown = ({ options = [], unit = "", onInput = () => { }, ...props }) => {
|
9543
9543
|
const onDropdownChange = (event) => {
|
9544
|
-
|
9544
|
+
onInput(event.target.value);
|
9545
9545
|
};
|
9546
9546
|
return (React__default["default"].createElement("div", { className: styles$q.container },
|
9547
|
-
React__default["default"].createElement("select", { className: styles$q.select, onChange: onDropdownChange },
|
9547
|
+
React__default["default"].createElement("select", { className: styles$q.select, onChange: onDropdownChange, ...props },
|
9548
9548
|
React__default["default"].createElement("option", { value: "none" }, "Ausw\u00E4hlen"),
|
9549
9549
|
options.map((option, index) => (React__default["default"].createElement("option", { key: index, value: option.value }, option.label))))));
|
9550
9550
|
};
|
@@ -9916,15 +9916,15 @@ var css_248z$7 = ".styles-module_container__Grkzw {\n display: flex;\n flex-di
|
|
9916
9916
|
var styles$7 = {"container":"styles-module_container__Grkzw","option":"styles-module_option__nijjM"};
|
9917
9917
|
styleInject(css_248z$7);
|
9918
9918
|
|
9919
|
-
function RadioButtons({ options, group, selected,
|
9919
|
+
function RadioButtons({ options, group, selected, onInput = () => { }, width = "100%" }) {
|
9920
9920
|
const [selectedOption, setSelected] = React.useState(selected);
|
9921
|
+
React.useEffect(() => setSelected(selected), [selected]);
|
9921
9922
|
function onUpdateSelected(event) {
|
9922
9923
|
setSelected(event.target.value);
|
9923
|
-
|
9924
|
-
onClick(event);
|
9924
|
+
onInput(event);
|
9925
9925
|
}
|
9926
9926
|
return (React__default["default"].createElement("div", { className: styles$7.container, style: { width: width } }, options.map((option) => React__default["default"].createElement("div", { className: styles$7.option, key: option.name },
|
9927
|
-
|
9927
|
+
selectedOption == option.name ?
|
9928
9928
|
React__default["default"].createElement("input", { type: "radio", id: option.name, name: group, value: option.name, onInput: onUpdateSelected, defaultChecked: true })
|
9929
9929
|
:
|
9930
9930
|
React__default["default"].createElement("input", { type: "radio", id: option.name, name: group, value: option.name, onInput: onUpdateSelected }),
|
package/dist/index.esm.js
CHANGED
@@ -9445,12 +9445,12 @@ function CardButton({ id, children, iconName, onClick, ...props }) {
|
|
9445
9445
|
React__default.createElement("h2", null, children)));
|
9446
9446
|
}
|
9447
9447
|
|
9448
|
-
var css_248z$u = ".styles-module_container__gCCnD {\n margin-bottom: 20px;\n
|
9448
|
+
var css_248z$u = ".styles-module_container__gCCnD {\n margin-bottom: 20px;\n color: var(--foreground-3);\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}\n.styles-module_container__gCCnD [type=checkbox] + label {\n position: absolute;\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}\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(--background-2);\n}";
|
9449
9449
|
var styles$u = {"container":"styles-module_container__gCCnD"};
|
9450
9450
|
styleInject(css_248z$u);
|
9451
9451
|
|
9452
|
-
function Checkbox({ id, name, checked, defaultChecked = false, onInput = () => { }, children }) {
|
9453
|
-
return (React__default.createElement("div", { className: styles$u.container },
|
9452
|
+
function Checkbox({ id, name, checked, defaultChecked = false, onInput = () => { }, children, ...props }) {
|
9453
|
+
return (React__default.createElement("div", { className: styles$u.container, ...props },
|
9454
9454
|
React__default.createElement("input", { type: "checkbox", onInput: onInput, name: name, checked: checked, defaultChecked: defaultChecked, id: id || name }),
|
9455
9455
|
React__default.createElement("label", { htmlFor: id || name }, children),
|
9456
9456
|
React__default.createElement(SvgIcon, { iconName: "done", size: "21px" })));
|
@@ -9513,12 +9513,12 @@ var css_248z$q = ".styles-module_container__hGVir {\n display: flex;\n align-i
|
|
9513
9513
|
var styles$q = {"container":"styles-module_container__hGVir","input":"styles-module_input__h-BA2","input_container":"styles-module_input_container__2u56C","unit_label":"styles-module_unit_label__EVP9q"};
|
9514
9514
|
styleInject(css_248z$q);
|
9515
9515
|
|
9516
|
-
const Dropdown = ({ options = [], unit = "",
|
9516
|
+
const Dropdown = ({ options = [], unit = "", onInput = () => { }, ...props }) => {
|
9517
9517
|
const onDropdownChange = (event) => {
|
9518
|
-
|
9518
|
+
onInput(event.target.value);
|
9519
9519
|
};
|
9520
9520
|
return (React__default.createElement("div", { className: styles$q.container },
|
9521
|
-
React__default.createElement("select", { className: styles$q.select, onChange: onDropdownChange },
|
9521
|
+
React__default.createElement("select", { className: styles$q.select, onChange: onDropdownChange, ...props },
|
9522
9522
|
React__default.createElement("option", { value: "none" }, "Ausw\u00E4hlen"),
|
9523
9523
|
options.map((option, index) => (React__default.createElement("option", { key: index, value: option.value }, option.label))))));
|
9524
9524
|
};
|
@@ -9890,15 +9890,15 @@ var css_248z$7 = ".styles-module_container__Grkzw {\n display: flex;\n flex-di
|
|
9890
9890
|
var styles$7 = {"container":"styles-module_container__Grkzw","option":"styles-module_option__nijjM"};
|
9891
9891
|
styleInject(css_248z$7);
|
9892
9892
|
|
9893
|
-
function RadioButtons({ options, group, selected,
|
9893
|
+
function RadioButtons({ options, group, selected, onInput = () => { }, width = "100%" }) {
|
9894
9894
|
const [selectedOption, setSelected] = useState(selected);
|
9895
|
+
useEffect(() => setSelected(selected), [selected]);
|
9895
9896
|
function onUpdateSelected(event) {
|
9896
9897
|
setSelected(event.target.value);
|
9897
|
-
|
9898
|
-
onClick(event);
|
9898
|
+
onInput(event);
|
9899
9899
|
}
|
9900
9900
|
return (React__default.createElement("div", { className: styles$7.container, style: { width: width } }, options.map((option) => React__default.createElement("div", { className: styles$7.option, key: option.name },
|
9901
|
-
|
9901
|
+
selectedOption == option.name ?
|
9902
9902
|
React__default.createElement("input", { type: "radio", id: option.name, name: group, value: option.name, onInput: onUpdateSelected, defaultChecked: true })
|
9903
9903
|
:
|
9904
9904
|
React__default.createElement("input", { type: "radio", id: option.name, name: group, value: option.name, onInput: onUpdateSelected }),
|