-
Notifications
You must be signed in to change notification settings - Fork 1
IS-11152: haapi stepper password input #111
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
aleixsuau
merged 9 commits into
integration/IS-5161/login-web-app
from
feature/IS-11152/password-field-final
Apr 9, 2026
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
20dc15d
IS-11152: haapi stepper password input
aleixsuau 4bae2a4
IS-11152: fix copilot feedback
aleixsuau 3f2b3cd
IS-11152: remove TODO
aleixsuau c8ac1b4
IS-11152: fix linting issue
aleixsuau c2110a7
IS-11152: Replace password visibility toggle text with eye icons
urre 9390cea
IS-11152 Add gap
urre 16fef11
IS-11152 Use spacing variable
urre a04ebb5
IS-11152 Fix ui-kit-icons import by adding workspace dependency.
aleixsuau 23fc3cc
IS-11152: remove ui-kit icons dependency
aleixsuau 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
31 changes: 31 additions & 0 deletions
31
src/common/icons/src/components/general/IconGeneralEye.tsx
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,31 @@ | ||
| import * as React from 'react'; | ||
| import type { SVGProps } from 'react'; | ||
| const SvgIconGeneralEye = (props: SVGProps<SVGSVGElement>) => ( | ||
| <svg | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| viewBox="0 0 256 256" | ||
| width={props.width || `100%`} | ||
| height={props.height || `100%`} | ||
| stroke="currentColor" | ||
| fill="none" | ||
| {...props} | ||
| > | ||
| <path | ||
| fill="none" | ||
| strokeLinecap="round" | ||
| strokeLinejoin="round" | ||
| strokeWidth={14} | ||
| d="M44.48 124.51s29.7-59.41 81.68-59.41 81.68 59.41 81.68 59.41-29.7 59.41-81.68 59.41-81.68-59.41-81.68-59.41" | ||
| /> | ||
| <circle | ||
| cx={126.17} | ||
| cy={124.51} | ||
| r={22.28} | ||
| fill="none" | ||
| strokeLinecap="round" | ||
| strokeLinejoin="round" | ||
| strokeWidth={14} | ||
| /> | ||
| </svg> | ||
| ); | ||
| export default SvgIconGeneralEye; |
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
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
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
67 changes: 67 additions & 0 deletions
67
...n-web-app/src/haapi-stepper/feature/actions/form/fields/HaapiStepperPasswordFormField.tsx
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,67 @@ | ||
| /* | ||
| * Copyright (C) 2025 Curity AB. All rights reserved. | ||
| * | ||
| * The contents of this file are the property of Curity AB. | ||
| * You may not copy or use this file, in either source code | ||
| * or executable form, except in compliance with terms | ||
| * set by Curity AB. | ||
| * | ||
| * For further information, please contact Curity AB. | ||
| */ | ||
|
|
||
| import type { ReactElement } from 'react'; | ||
| import { useState } from 'react'; | ||
| import { IconGeneralEye, IconGeneralEyeHide } from '@curity/ui-kit-icons'; | ||
|
|
||
| import { HAAPI_FORM_ACTION_KINDS, HAAPI_FORM_ACTION_KINDS_TYPE } from '../../../../data-access/types/haapi-action.types'; | ||
| import { HAAPI_FORM_FIELDS, HaapiPasswordFormField } from '../../../../data-access/types/haapi-form.types'; | ||
| import { useHaapiStepperForm } from '../HaapiStepperFormContext'; | ||
|
|
||
| export function HaapiStepperPasswordFormField({ field }: { field: HaapiPasswordFormField }): ReactElement { | ||
| const { formState, action } = useHaapiStepperForm(); | ||
| const [isVisible, setIsVisible] = useState(false); | ||
| const inputId = `${action.id}-${field.name}-input`; | ||
| const autoComplete = getPasswordAutoComplete(action.kind); | ||
| const ariaLabel = `${isVisible ? 'Hide' : 'Show'} password`; | ||
|
|
||
| return ( | ||
| <label className="haapi-stepper-form-field-password-label" htmlFor={inputId}> | ||
| {field.label ?? field.name} | ||
| <div className="haapi-stepper-form-field-password-wrapper"> | ||
| <input | ||
| id={inputId} | ||
| data-testid={`haapi-form-field-${HAAPI_FORM_FIELDS.PASSWORD}-${field.name}`} | ||
| type={isVisible ? 'text' : 'password'} | ||
| className="haapi-stepper-form-field-password-input" | ||
| name={field.name} | ||
| value={formState.get(field)} | ||
| placeholder={field.placeholder} | ||
| autoComplete={autoComplete} | ||
| onChange={event => formState.set(field, event.target.value)} | ||
| /> | ||
| <button | ||
| type="button" | ||
| className="haapi-stepper-form-field-password-visibility-toggle" | ||
| aria-label={ariaLabel} | ||
| aria-pressed={isVisible} | ||
| aria-controls={inputId} | ||
| onClick={() => setIsVisible(current => !current)} | ||
| > | ||
| {isVisible ? <IconGeneralEyeHide /> : <IconGeneralEye />} | ||
| </button> | ||
| </div> | ||
| </label> | ||
| ); | ||
| } | ||
|
|
||
| const getPasswordAutoComplete = ( | ||
| actionKind: HAAPI_FORM_ACTION_KINDS_TYPE | ||
| ): 'current-password' | 'new-password' => { | ||
| const isRegistrationFlow = actionKind === HAAPI_FORM_ACTION_KINDS.USER_REGISTER; | ||
|
|
||
| if (isRegistrationFlow) { | ||
| return 'new-password'; | ||
| } | ||
|
|
||
| return 'current-password'; | ||
| }; | ||
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.