norma-library 0.5.126 → 0.5.128
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.
|
@@ -6,9 +6,10 @@ var RadioStyled = styled(MuiRadio)({});
|
|
|
6
6
|
var sizes = ['small', 'medium'];
|
|
7
7
|
export var RadioGroup = function (_a) {
|
|
8
8
|
var props = __rest(_a, []);
|
|
9
|
+
var onChange = props.onChange;
|
|
9
10
|
return (React.createElement(FormControl, null,
|
|
10
11
|
React.createElement(FormLabel, { id: props.id }, props.label),
|
|
11
|
-
React.createElement(MuiRadioGroup, { "aria-labelledby": props.id, defaultValue: props.checked, name: "radio-buttons-group", row: props.direction === 'horizontal' ? true : false }, props.options &&
|
|
12
|
-
props.options.map(function (item, key) { return (React.createElement(FormControlLabel, { value: item.value, control: React.createElement(RadioStyled, { color: props.color, size: item.size ? item.size : sizes[1] }), label: item.label, key: key })); }))));
|
|
12
|
+
React.createElement(MuiRadioGroup, { "aria-labelledby": props.id, defaultValue: props.checked, name: "radio-buttons-group", row: props.direction === 'horizontal' ? true : false, onChange: !!onChange ? function (event, value) { return onChange(event, value); } : undefined }, props.options &&
|
|
13
|
+
props.options.map(function (item, key) { return (React.createElement(FormControlLabel, { value: item.value, control: React.createElement(RadioStyled, { color: props.color, size: item.size ? item.size : sizes[1] }), label: item.label, key: key, sx: { alignItems: "start" } })); }))));
|
|
13
14
|
};
|
|
14
15
|
//# sourceMappingURL=RadioGroup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroup.js","sourceRoot":"","sources":["../../../src/components/RadioGroup.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,SAAS,EACT,KAAK,IAAI,QAAQ,EACjB,UAAU,IAAI,aAAa,GAC5B,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CA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C,EAAtB,CAAsB,CAAC,CAAC,CAAC,SAAS,IAE1E,KAAK,CAAC,OAAO;YACZ,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,UAAC,IAAI,EAAE,GAAG,IAAK,OAAA,CAC/B,oBAAC,gBAAgB,IACf,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,OAAO,EAAE,oBAAC,WAAW,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAI,EACpF,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,EAAC,UAAU,EAAE,OAAO,EAAC,GACzB,CACH,EARgC,CAQhC,CAAC,CACU,CACJ,CACf,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { CheckBoxColorVariant, DirectionVariant, MuiRadioBaseProps, OptionsRadios, TextFieldSizeVariant } from '../types';
|
|
3
3
|
import { CheckboxPropsColorOverrides, RadioPropsSizeOverrides } from '@mui/material';
|
|
4
4
|
import { OverridableStringUnion } from '@mui/types';
|
|
5
|
-
export interface RadioBaseProps extends MuiRadioBaseProps {
|
|
5
|
+
export interface RadioBaseProps extends Omit<MuiRadioBaseProps, 'onChange'> {
|
|
6
6
|
id?: string;
|
|
7
7
|
name?: string;
|
|
8
8
|
options?: OptionsRadios[];
|
|
@@ -12,4 +12,5 @@ export interface RadioBaseProps extends MuiRadioBaseProps {
|
|
|
12
12
|
size?: OverridableStringUnion<TextFieldSizeVariant, RadioPropsSizeOverrides>;
|
|
13
13
|
color?: OverridableStringUnion<CheckBoxColorVariant, CheckboxPropsColorOverrides>;
|
|
14
14
|
checked?: string;
|
|
15
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>, value: string) => void;
|
|
15
16
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "norma-library",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.128",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Olos/Norma-DS. Design System based on Material UI, developed with TypeScript and Styled Components to create reusable and consistent components in web applications.",
|
|
6
6
|
"scripts": {
|
|
@@ -15,6 +15,7 @@ const RadioStyled = styled(MuiRadio)({});
|
|
|
15
15
|
const sizes: TextFieldSizeVariant[] = ['small', 'medium'];
|
|
16
16
|
|
|
17
17
|
export const RadioGroup = ({ ...props }: RadioBaseProps) => {
|
|
18
|
+
const { onChange } = props;
|
|
18
19
|
|
|
19
20
|
return (
|
|
20
21
|
<FormControl>
|
|
@@ -24,6 +25,7 @@ export const RadioGroup = ({ ...props }: RadioBaseProps) => {
|
|
|
24
25
|
defaultValue={props.checked}
|
|
25
26
|
name="radio-buttons-group"
|
|
26
27
|
row={props.direction === 'horizontal' ? true : false}
|
|
28
|
+
onChange={!!onChange ? (event, value) => onChange(event, value) : undefined}
|
|
27
29
|
>
|
|
28
30
|
{props.options &&
|
|
29
31
|
props.options.map((item, key) => (
|
|
@@ -32,6 +34,7 @@ export const RadioGroup = ({ ...props }: RadioBaseProps) => {
|
|
|
32
34
|
control={<RadioStyled color={props.color} size={item.size ? item.size : sizes[1]} />}
|
|
33
35
|
label={item.label}
|
|
34
36
|
key={key}
|
|
37
|
+
sx={{alignItems: "start"}}
|
|
35
38
|
/>
|
|
36
39
|
))}
|
|
37
40
|
</MuiRadioGroup>
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import { CheckboxPropsColorOverrides, RadioPropsSizeOverrides } from '@mui/material';
|
|
10
10
|
import { OverridableStringUnion } from '@mui/types';
|
|
11
11
|
|
|
12
|
-
export interface RadioBaseProps extends MuiRadioBaseProps {
|
|
12
|
+
export interface RadioBaseProps extends Omit<MuiRadioBaseProps, 'onChange'> {
|
|
13
13
|
id?: string;
|
|
14
14
|
name?: string;
|
|
15
15
|
options?: OptionsRadios[];
|
|
@@ -19,4 +19,5 @@ export interface RadioBaseProps extends MuiRadioBaseProps {
|
|
|
19
19
|
size?: OverridableStringUnion<TextFieldSizeVariant, RadioPropsSizeOverrides>;
|
|
20
20
|
color?: OverridableStringUnion<CheckBoxColorVariant, CheckboxPropsColorOverrides>;
|
|
21
21
|
checked?: string;
|
|
22
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>, value: string) => void;
|
|
22
23
|
}
|