From 8107f1c8d2314efee77184f89534f07e4f6cdf48 Mon Sep 17 00:00:00 2001 From: uttam12331 Date: Mon, 29 Jun 2026 14:57:57 +0530 Subject: [PATCH 1/3] feat(modal): add radio element support Add a new `radio` input type to the modal component. A radio field renders its `options` as a single-selection group sharing one name; the selected option's value is stored in `data[name]`. - elements.json: register the `radio` element (`requires-options`, input tag, radiogroup aria role). - constants.js: expose `DYVIX_MODAL_ELEMENT.RADIO`. - modal.jsx: compute options for any `requires-options` element (covers select, d-select and radio) and render a dedicated accessible radiogroup with per-option labels and checked state bound to `data`. - elements.css: styles for the radio group, legend and inputs. - devbench: add a radio example. Closes #85 --- devbench/src/component/modal.jsx | 34 +++++++++++++++ .../modal/dependencies/elements.json | 16 ++++++++ .../modal/dependencies/style/elements.css | 22 ++++++++++ src/components/modal/modal.jsx | 41 ++++++++++++++++--- src/constants.js | 1 + 5 files changed, 108 insertions(+), 6 deletions(-) diff --git a/devbench/src/component/modal.jsx b/devbench/src/component/modal.jsx index fa34e097..07688733 100644 --- a/devbench/src/component/modal.jsx +++ b/devbench/src/component/modal.jsx @@ -39,6 +39,40 @@ export function ModalTest() { return props; }); + // Radio element example. Toggle `useRadio` to preview the new `radio` + // input type (single-selection group, value is the chosen option). + const useRadio = true; + const radioElements = [ + { + type: 'text', + name: 'fullName', + placeholder: 'Full Name', + amount: 1 + }, + { + type: 'radio', + name: 'plan', + placeholder: 'Choose a plan', + options: ['Free', 'Pro', 'Enterprise'], + amount: 1 + } + ]; + + if (useRadio) { + return ( + console.log('submitted', data)} + onChange={(data) => console.log(data)} + /> + ); + } + return ( ))} + ) : field.type === 'radio' ? ( +
+ {field.placeholder?.[j] && + field.placeholder[j] !== '!/' && ( + + {field.placeholder[j]} + + )} + {options.map((opt, index) => ( + + ))} +
) : field.type === 'checkbox' ? (