@grantbii/design-system 1.0.41 → 1.0.42
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,7 +1,9 @@
|
|
|
1
1
|
import { DetailedHTMLProps, InputHTMLAttributes } from "react";
|
|
2
2
|
import { Option } from "../foundations";
|
|
3
|
+
type RadioOption = Option & DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
|
3
4
|
type RadioButtonProps = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
name: string;
|
|
6
|
+
options: RadioOption[];
|
|
7
|
+
};
|
|
8
|
+
declare const RadioButtons: ({ name, options }: RadioButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
9
|
export default RadioButtons;
|
|
@@ -13,9 +13,11 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
13
13
|
import { createElement as _createElement } from "react";
|
|
14
14
|
import styled from "styled-components";
|
|
15
15
|
import { RadioButton } from "../atoms";
|
|
16
|
-
const RadioButtons = (
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
const RadioButtons = ({ name, options }) => {
|
|
17
|
+
return (_jsx(RadioGroup, { children: options.map((_a) => {
|
|
18
|
+
var { value } = _a, props = __rest(_a, ["value"]);
|
|
19
|
+
return (_createElement(RadioButton, Object.assign({}, props, { key: `${value}-radio-button`, id: `${value}-radio-button`, value: value, name: name })));
|
|
20
|
+
}) }));
|
|
19
21
|
};
|
|
20
22
|
export default RadioButtons;
|
|
21
23
|
const RadioGroup = styled.div `
|
package/package.json
CHANGED
|
@@ -12,8 +12,16 @@ export const TextOnly = {
|
|
|
12
12
|
args: {
|
|
13
13
|
name: "location ",
|
|
14
14
|
options: [
|
|
15
|
-
{
|
|
16
|
-
|
|
15
|
+
{
|
|
16
|
+
label: "Singapore",
|
|
17
|
+
value: "Singapore",
|
|
18
|
+
onChange: () => alert("Selected Singapore!"),
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
label: "Hong Kong",
|
|
22
|
+
value: "Hong Kong",
|
|
23
|
+
onChange: () => alert("Selected Hong Kong!"),
|
|
24
|
+
},
|
|
17
25
|
],
|
|
18
26
|
},
|
|
19
27
|
};
|