input_otp: replace otp.js with pure Rust and fix demo structure#35
Open
krishpranav wants to merge 1 commit intorust-ui:mainfrom
Open
input_otp: replace otp.js with pure Rust and fix demo structure#35krishpranav wants to merge 1 commit intorust-ui:mainfrom
krishpranav wants to merge 1 commit intorust-ui:mainfrom
Conversation
Replace the OTP JavaScript controller with a Rust/web_sys implementation and wire InputOTP to initialize it directly. Update the docs demo so each OTP scenario renders as an independent block with its own local Preview and Code controls, and bypass the shared demo wrapper toolbar for the OTP page so the layout matches the intended structure.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
The OTP component still depended on a JavaScript controller and the docs page was rendering the OTP demos through one shared wrapper that made the layout feel wrong.
This patch moves the OTP controller into Rust with
web_sys, removes the runtime JS file, and restructures the Input OTP docs page so each demo block behaves independently with its own local Preview and Code controls.What changed:
web_sysimplementation inuse_input_otpInputOTPto initialize the Rust controller directly and removed the script tagpublic/app_components/otp.jsdemo_input_otp.rsso the OTP page renders independent demo blocks for basic input, 4-digit variant, digit filter, focus/blur, and post-hydration initValidation:
Screenshot
Closes #26