diff --git a/.Jules/palette.md b/.Jules/palette.md index ee2d8f0..5aee456 100644 --- a/.Jules/palette.md +++ b/.Jules/palette.md @@ -94,3 +94,7 @@ ## 2025-06-16 - [Functional Matchers for Complex Buttons and Utility-First Layout] **Learning:** React Testing Library's `findByText` can fail on buttons containing Materialize icons due to text node fragmentation and the icon's name being part of the `textContent`. Using a functional matcher that checks for partial content and tag name is more robust. Additionally, strictly adhering to utility classes (e.g., 'center-align') instead of inline styles ensures compliance with repository constraints and theme consistency. **Action:** Always use functional matchers for testing interactive elements with icons and avoid inline styles by leveraging existing CSS utility classes. + +## 2025-06-17 - [Accessible Checkboxes and Consistent Prop Spreading] +**Learning:** Enhancing base form components like `CustomCheckbox` with standardized `required` indicators (visual asterisk and `aria-required`) and grid support (`s`, `m`, `l`, `xl`, `offset`) improves both accessibility and developer productivity. Ensuring that `...props` are consistently applied to the inner `input` regardless of the presence of a wrapper `div` maintains a predictable component API. +**Action:** Always provide visual and semantic cues for mandatory fields and ensure consistent prop-spreading behavior in multi-layered components. diff --git a/src/components/PlayerCasoContainer.jsx b/src/components/PlayerCasoContainer.jsx index 44ffcf7..e8d138c 100644 --- a/src/components/PlayerCasoContainer.jsx +++ b/src/components/PlayerCasoContainer.jsx @@ -5,7 +5,6 @@ import ExamService from "../services/ExamService"; import { useHistory } from 'react-router-dom'; import { alertError, alertSuccess } from "../services/AlertService"; import CasoContext from "../context/CasoContext"; -import { CustomButton } from "./custom"; import EnarmUtil from "../modules/EnarmUtil"; import ContributionTypeSelector from "./ContributionTypeSelector"; import ContributionsSummary from "./ContributionsSummary"; diff --git a/src/components/custom/CustomCheckbox.jsx b/src/components/custom/CustomCheckbox.jsx index ec92c05..5506b22 100644 --- a/src/components/custom/CustomCheckbox.jsx +++ b/src/components/custom/CustomCheckbox.jsx @@ -4,13 +4,20 @@ import PropTypes from 'prop-types'; const CustomCheckbox = ({ id, label, - checked = false, // Renamed from 'value' for clarity with checkbox 'checked' attribute + checked = false, onChange, disabled = false, className = '', // Applied to the input element labelClassName = '', // Applied to the label element indeterminate = false, value, // HTML value attribute, not for checked state + s, + m, + l, + xl, + offset, + required = false, + wrapperClassName = '', ...props }) => { const inputRef = useRef(null); @@ -26,9 +33,26 @@ const CustomCheckbox = ({ inputClasses += ' indeterminate-checkbox'; } - // The main wrapper is the label for Materialize checkboxes - return ( -