From 51d5de49c5b81b105237e08bd8c2c428ff6bd90e Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 27 Feb 2026 16:14:30 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Palette:=20Enhance=20CustomCheck?= =?UTF-8?q?box=20with=20grid=20support=20and=20required=20indicator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Added support for Materialize grid props (s, m, l, xl, offset) to CustomCheckbox. - Added 'required' prop for visual asterisk and aria-required attribute. - Added 'wrapperClassName' prop for flexible container styling. - Created unit tests in CustomCheckbox.test.jsx. - Cleaned up unused import in PlayerCasoContainer.jsx. - Updated UX journal in .Jules/palette.md. Co-authored-by: godie <227743+godie@users.noreply.github.com> --- .Jules/palette.md | 4 ++ src/components/PlayerCasoContainer.jsx | 1 - src/components/custom/CustomCheckbox.jsx | 63 +++++++++++++++++-- src/components/custom/CustomCheckbox.test.jsx | 55 ++++++++++++++++ 4 files changed, 116 insertions(+), 7 deletions(-) create mode 100644 src/components/custom/CustomCheckbox.test.jsx 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 ( -