allaw-ui 0.1.19 → 0.1.21
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/molecules/radioForm/RadioForm.css +14 -0
- package/dist/components/molecules/radioForm/RadioForm.d.ts +12 -0
- package/dist/components/molecules/radioForm/RadioForm.js +27 -0
- package/dist/components/molecules/radioForm/index.d.ts +2 -0
- package/dist/components/molecules/radioForm/index.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./RadioForm.css";
|
|
3
|
+
import "../../../styles/global.css";
|
|
4
|
+
export interface RadioFormProps {
|
|
5
|
+
label: string;
|
|
6
|
+
isRequired: boolean;
|
|
7
|
+
options: string[];
|
|
8
|
+
defaultSelected?: string;
|
|
9
|
+
onChange?: (selectedOption: string | null) => void;
|
|
10
|
+
}
|
|
11
|
+
declare const RadioForm: React.FC<RadioFormProps>;
|
|
12
|
+
export default RadioForm;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
|
2
|
+
import "./RadioForm.css";
|
|
3
|
+
import "../../../styles/global.css";
|
|
4
|
+
import Paragraph from "../../atoms/typography/Paragraph";
|
|
5
|
+
import RadioButton from "../../atoms/radios/RadioButton";
|
|
6
|
+
var RadioForm = function (_a) {
|
|
7
|
+
var label = _a.label, isRequired = _a.isRequired, options = _a.options, defaultSelected = _a.defaultSelected, onChange = _a.onChange;
|
|
8
|
+
var _b = useState(defaultSelected || null), selectedOption = _b[0], setSelectedOption = _b[1];
|
|
9
|
+
useEffect(function () {
|
|
10
|
+
if (defaultSelected) {
|
|
11
|
+
setSelectedOption(defaultSelected);
|
|
12
|
+
}
|
|
13
|
+
}, [defaultSelected]);
|
|
14
|
+
var handleOptionChange = function (option) {
|
|
15
|
+
setSelectedOption(option);
|
|
16
|
+
if (onChange) {
|
|
17
|
+
onChange(option);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
return (React.createElement("div", { className: "radio-form" },
|
|
21
|
+
React.createElement(Paragraph, { variant: "medium", color: "noir", text: React.createElement(React.Fragment, null,
|
|
22
|
+
label,
|
|
23
|
+
" ",
|
|
24
|
+
isRequired && React.createElement("span", { className: "radio-form-required" }, "*")), size: "default" }),
|
|
25
|
+
React.createElement("div", { className: "radio-form-options" }, options.map(function (option, index) { return (React.createElement(RadioButton, { key: index, label: option, style: "hybride", isActive: selectedOption === option, onClick: function () { return handleOptionChange(option); } })); }))));
|
|
26
|
+
};
|
|
27
|
+
export default RadioForm;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as RadioForm } from "./RadioForm";
|
package/dist/index.d.ts
CHANGED
|
@@ -38,5 +38,6 @@ export { default as EmployeeCard } from "./components/molecules/employeeCard/Emp
|
|
|
38
38
|
export { default as Stepper } from "./components/molecules/stepper/Stepper";
|
|
39
39
|
export type { StepperProps } from "./components/molecules/stepper/Stepper";
|
|
40
40
|
export { default as CheckboxForm } from "./components/molecules/checkboxForm/CheckboxForm";
|
|
41
|
+
export { default as RadioForm } from "./components/molecules/radioForm/RadioForm";
|
|
41
42
|
export { default as Breadcrumb } from "./components/molecules/breadcrumb/Breadcrumb";
|
|
42
43
|
export { default as ProCard } from "./components/molecules/proCard/ProCard";
|
package/dist/index.js
CHANGED
|
@@ -54,6 +54,8 @@ export { default as EmployeeCard } from "./components/molecules/employeeCard/Emp
|
|
|
54
54
|
export { default as Stepper } from "./components/molecules/stepper/Stepper";
|
|
55
55
|
// CheckboxForm
|
|
56
56
|
export { default as CheckboxForm } from "./components/molecules/checkboxForm/CheckboxForm";
|
|
57
|
+
// RadioForm
|
|
58
|
+
export { default as RadioForm } from "./components/molecules/radioForm/RadioForm";
|
|
57
59
|
// Breadcrumb
|
|
58
60
|
export { default as Breadcrumb } from "./components/molecules/breadcrumb/Breadcrumb";
|
|
59
61
|
// ProCard
|