allaw-ui 0.1.18 → 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.
@@ -0,0 +1,14 @@
1
+ .radio-form {
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: 16px;
5
+ }
6
+
7
+ .radio-form-required {
8
+ color: #e15151;
9
+ }
10
+
11
+ .radio-form-options {
12
+ display: flex;
13
+ gap: 32px;
14
+ }
@@ -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,2 @@
1
+ export { default as RadioForm } from "./RadioForm";
2
+ export type { RadioFormProps } from "./RadioForm";
@@ -0,0 +1 @@
1
+ export { default as RadioForm } from "./RadioForm";
@@ -1,6 +1,7 @@
1
1
  .stepper-container {
2
2
  display: flex;
3
- width: 100%;
3
+ width: 100vw;
4
+ max-width: 768px;
4
5
  padding: 48px;
5
6
  flex-direction: column;
6
7
  justify-content: center;
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "allaw-ui",
3
- "version": "0.1.18",
3
+ "version": "0.1.21",
4
4
  "description": "Composants UI pour l'application Allaw",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",