-
Notifications
You must be signed in to change notification settings - Fork 58
feat: Password Input component #3238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
0b06b21
fix: remplace div by p for helper-text and text-input-error for acces…
nilloq 3a16d20
fix: leading icon position in outlined variant
nilloq 3be7ef5
fix: remove useless form-label class in documentation
nilloq 789fb21
fix: trailing action error gap
nilloq 006fef1
fix: helper link to link-sm
nilloq 80860c1
docs: update migration guides
nilloq 2a60afe
fix: remove data-prefix font icon
nilloq c8618f2
fix: update examples
nilloq 61e3478
fix: latest review
nilloq d64e721
fix: duplicate class
nilloq c63ff1a
feat: text area component WIP
nilloq 06f962f
Merge branch 'ouds/main' into ouds/main-sco-text-area-component
nilloq fc503b3
feat: text area component complement
nilloq 5458f20
docs: add text area migration guides
nilloq e9522a8
docs: update migration guide
nilloq 51f1c7a
Merge branch 'ouds/main' into ouds/main-sco-text-area-component
MaxLardenois f458988
fix: following review
nilloq 3d4d729
fix: some sizes issues
nilloq 2002823
feat: password input component
nilloq 9db4e8a
fix! remplace empy placehold by a placeholder with a single space
nilloq 5e7d25f
Merge branch 'ouds/main' into ouds/main-sco-text-area-component
nilloq 36fcdeb
feat: update textarea resize and default height
nilloq 7cb0f05
docs: update for placeholder space instead of empty
nilloq 96bbc47
feat: prevent label from moving on readonly empty text input
nilloq 0c9211c
fix: regression
nilloq ba6cde4
Merge branch 'ouds/main' into ouds/main-sco-text-area-component
vprothais ccdc8fa
fix: following review
nilloq e3a1285
fix: padding bottom
nilloq f5d3533
Merge branch 'ouds/main-sco-text-area-component' into ouds/main-sco-p…
nilloq 181d940
Merge branch 'ouds/main' into ouds/main-sco-password-input
MaxLardenois dc365f9
chore: update migration after 1.0.0
MaxLardenois ba0a773
Merge branch 'ouds/main' into ouds/main-sco-password-input
nilloq b3e44aa
fix: merge issue
nilloq d61e817
fix: merge issue again
nilloq 5eb019f
fix: doc issue
nilloq d7fb76c
fix: aria issues
nilloq 27bbf59
Merge branch 'ouds/main' into ouds/main-sco-password-input
nilloq 9d0dbf1
fix: merge issue
nilloq 7b07e59
fix: error-text accessibility
nilloq 0e2d920
docs: update migration guide
nilloq 102f1e8
docs: update migration guide
nilloq b6a4539
fix: add missing icon in sosh brand
nilloq 104ab93
fix: following review
nilloq 6836851
Merge branch 'ouds/main' into ouds/main-sco-password-input
nilloq File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,144 @@ | ||
| --- | ||
| title: Password input | ||
| description: A password input is a form field specifically designed to securely capture a user’s confidential password. | ||
| aliases: | ||
| - "/docs/forms/password-input/" | ||
| toc: true | ||
| --- | ||
|
|
||
| import { getVersionedDocsPath } from '@libs/path' | ||
|
|
||
| <Callout type="info"> | ||
| {/* TODO: set the right url for design documentation */} | ||
| You can find here the [OUDS password input design guidelines](https://r.orange.fr/r/S-ouds-doc-password-input). | ||
| </Callout> | ||
|
|
||
| ## Overview | ||
|
|
||
| The password input masks the characters as they are typed, typically replacing them with dots, in order to protect the input from being read by others nearby. | ||
| While the primary goal is to enhance privacy and security, the field may also include usability features such as a "show/hide password" toggle and helper text to guide password creation. | ||
|
|
||
| A password input is a specific configuration of the [text input]([[docsref:/forms/text-input]]). It uses a `.text-input` wrapper to create a textual form field with OUDS styles, then wraps a pair of `<input class="text-input-field">` and `<label>` elements in `.text-input-container`. Note that the `<label>` must come before the `<input>`. | ||
|
|
||
| A `placeholder` attribute is required on each `<input>` as our CSS-only floating label implementation relies on the `:placeholder-shown` pseudo-element to detect when the input is empty. | ||
|
|
||
| <Callout type="info"> | ||
| Even if you don't need a placeholder, <em>you must always define the placeholder attribute with a single space character</em>. This ensures the label behaves correctly by preventing it from overlapping the input text when a value is entered. | ||
| </Callout> | ||
|
|
||
| <Callout type="info"> | ||
| All other available features of the text input component can be used with the password input, such as leading icons, helper text, and validation states. Please refer to the [text input documentation]([[docsref:/forms/text-input]]) for more details. | ||
| </Callout> | ||
|
|
||
| <Example code={`<div class="text-input mb-medium"> | ||
| <div class="text-input-container"> | ||
| <label for="inputPassword">Password</label> | ||
| <input type="password" id="inputPassword" class="text-input-field" placeholder=" "> | ||
| <button class="btn btn-minimal btn-icon"> | ||
| <svg aria-hidden="true"> | ||
| <use xlink:href="${getVersionedDocsPath('/assets/img/ouds-web-sprite.svg#accessibility-vision')}"/> | ||
| </svg> | ||
| <span class="visually-hidden">Show password</span> | ||
| </button> | ||
| </div> | ||
| </div> | ||
| <div class="text-input mb-medium"> | ||
| <div class="text-input-container"> | ||
| <svg aria-hidden="true"> | ||
| <use xlink:href="${getVersionedDocsPath('/assets/img/ouds-web-sprite.svg#lock-closed')}"/> | ||
| </svg> | ||
| <label for="inputPasswordIcon">Password</label> | ||
| <input type="password" id="inputPasswordIcon" class="text-input-field" placeholder="Minimum 8 characters"> | ||
| <button class="btn btn-minimal btn-icon"> | ||
| <svg aria-hidden="true"> | ||
| <use xlink:href="${getVersionedDocsPath('/assets/img/ouds-web-sprite.svg#accessibility-vision')}"/> | ||
| </svg> | ||
| <span class="visually-hidden">Show password</span> | ||
| </button> | ||
| </div> | ||
| </div> | ||
| <div class="text-input mb-medium"> | ||
| <div class="text-input-container"> | ||
| <svg aria-hidden="true"> | ||
| <use xlink:href="${getVersionedDocsPath('/assets/img/ouds-web-sprite.svg#lock-closed')}"/> | ||
| </svg> | ||
| <label for="inputPasswordPrefix">Password</label> | ||
| <div class="input-container" data-bs-prefix="DEV-"> | ||
| <input type="password" id="inputPasswordPrefix" aria-describedby="inputPasswordPrefixHelper" class="text-input-field" placeholder=" "> | ||
| </div> | ||
| <button class="btn btn-minimal btn-icon"> | ||
| <svg aria-hidden="true"> | ||
| <use xlink:href="${getVersionedDocsPath('/assets/img/ouds-web-sprite.svg#accessibility-vision')}"/> | ||
| </svg> | ||
| <span class="visually-hidden">Show password</span> | ||
| </button> | ||
| </div> | ||
| <p id="inputPasswordPrefixHelper" class="helper-text">Enter a password with at least 8 characters (without the DEV- prefix).</p> | ||
| </div> | ||
| <div class="text-input mb-medium"> | ||
| <div class="text-input-container text-input-container-outlined"> | ||
| <svg aria-hidden="true"> | ||
| <use xlink:href="${getVersionedDocsPath('/assets/img/ouds-web-sprite.svg#lock-closed')}"/> | ||
| </svg> | ||
| <label for="inputPasswordOutlined">Password</label> | ||
| <input type="password" id="inputPasswordOutlined" aria-describedby="inputPasswordOutlinedHelper" class="text-input-field" placeholder=" "> | ||
| <button class="btn btn-minimal btn-icon"> | ||
| <svg aria-hidden="true"> | ||
| <use xlink:href="${getVersionedDocsPath('/assets/img/ouds-web-sprite.svg#accessibility-vision')}"/> | ||
| </svg> | ||
| <span class="visually-hidden">Show password</span> | ||
| </button> | ||
| </div> | ||
| <p id="inputPasswordOutlinedHelper" class="helper-text">Enter a password with at least 8 characters</p> | ||
| </div> | ||
| <div class="text-input mb-medium"> | ||
| <div class="text-input-container text-input-container-outlined"> | ||
| <svg aria-hidden="true"> | ||
| <use xlink:href="${getVersionedDocsPath('/assets/img/ouds-web-sprite.svg#lock-closed')}"/> | ||
| </svg> | ||
| <label for="inputPasswordOutlinedValue">Password</label> | ||
| <input type="password" id="inputPasswordOutlinedValue" aria-describedby="inputPasswordOutlinedValueHelper" class="text-input-field" placeholder=" " value="My$ecureP@ssw0rd"> | ||
| <button class="btn btn-minimal btn-icon"> | ||
| <svg aria-hidden="true"> | ||
| <use xlink:href="${getVersionedDocsPath('/assets/img/ouds-web-sprite.svg#accessibility-vision')}"/> | ||
| </svg> | ||
| <span class="visually-hidden">Show password</span> | ||
| </button> | ||
| </div> | ||
| <p id="inputPasswordOutlinedValueHelper" class="helper-text">Enter a password with at least 8 characters</p> | ||
| </div> | ||
| <div class="text-input mb-medium"> | ||
| <div class="text-input-container"> | ||
| <label for="inputPasswordInvalid">Password</label> | ||
| <div class="input-container" data-bs-prefix="DEV-"> | ||
| <input type="password" id="inputPasswordInvalid" class="text-input-field is-invalid" aria-describedby="inputPasswordInvalidError" placeholder=" " value="12345"> | ||
| </div> | ||
| <button class="btn btn-minimal btn-icon"> | ||
| <svg aria-hidden="true"> | ||
| <use xlink:href="${getVersionedDocsPath('/assets/img/ouds-web-sprite.svg#accessibility-vision')}"/> | ||
| </svg> | ||
| <span class="visually-hidden">Show password</span> | ||
| </button> | ||
| </div> | ||
| <p id="inputPasswordInvalidHelper" class="helper-text">Enter a password with at least 8 characters (without the DEV- prefix).</p> | ||
| <p id="inputPasswordInvalidError" class="error-text">Password must be at least 8 characters (without the DEV- prefix).</p> | ||
| </div> | ||
| <div class="text-input"> | ||
| <div class="text-input-container text-input-container-outlined"> | ||
| <svg aria-hidden="true"> | ||
| <use xlink:href="${getVersionedDocsPath('/assets/img/ouds-web-sprite.svg#lock-closed')}"/> | ||
| </svg> | ||
| <label for="inputPasswordOutlinedInvalid">Password</label> | ||
| <div class="input-container" data-bs-prefix="DEV-"> | ||
| <input type="password" id="inputPasswordOutlinedInvalid" class="text-input-field is-invalid" aria-describedby="inputPasswordOutlinedInvalidError" placeholder=" " value="12345"> | ||
| </div> | ||
| <button class="btn btn-minimal btn-icon"> | ||
| <svg aria-hidden="true"> | ||
| <use xlink:href="${getVersionedDocsPath('/assets/img/ouds-web-sprite.svg#accessibility-vision')}"/> | ||
| </svg> | ||
| <span class="visually-hidden">Show password</span> | ||
| </button> | ||
| </div> | ||
| <p id="inputPasswordOutlinedInvalidHelper" class="helper-text">Enter a password with at least 8 characters (without the DEV- prefix).</p> | ||
| <p id="inputPasswordOutlinedInvalidError" class="error-text">Password must be at least 8 characters (without the DEV- prefix).</p> | ||
| </div>`} /> | ||
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We tell in Text Input page that the Prefix should be mentioned in helper text for accessibility reasons. We should do so here, and in all prefix examples, to stick to that point :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. Done!