Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions packages/assets/src/scss/_choice-input-field.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,30 @@
@use 'functions' as *;
@use 'variables' as *;

.ids-choice-input-field {
--ids-input-hover-border-color: var(--ids-input-hover-color, #{$color-primary-80});
--ids-input-hover-text-color: var(--ids-input-hover-color, #{$color-primary-80});

display: flex;
align-items: center;
gap: calculateRem(8px);

&--disabled {
.ids-choice-input-label {
color: var(--ids-input-disabled-text-color, #{$color-neutral-150});
pointer-events: none;
}
}

&--error {
.ids-choice-input-label {
color: var(--ids-input-error-text-color, #{$color-error-80});
}
}

&:hover:not(&--disabled) {
.ids-choice-input-label {
color: var(--ids-input-hover-text-color);
}
}
}
2 changes: 1 addition & 1 deletion packages/assets/src/scss/mixins/_inputs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
pointer-events: none;
}

&:hover {
&:hover:not(&--disabled) {
border-color: var(--ids-input-hover-border-color, #{$color-primary-80});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { RadioButtonFieldProps } from './RadioButtonField.types';

export const RadioButtonField = ({
className = '',
label,
inputWrapperClassName = '',
label,
labelClassName = '',
...inputProps
}: RadioButtonFieldProps) => {
Expand All @@ -25,6 +25,8 @@ export const RadioButtonField = ({
return (
<BaseChoiceInputField
className={fieldClassName}
disabled={inputProps.disabled}
error={inputProps.error}
id={inputProps.id}
inputWrapperClassName={inputWrapperClassName}
labelClassName={labelClassName}
Expand Down
6 changes: 5 additions & 1 deletion packages/components/src/hoc/withStateChecked.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC, useState } from 'react';
import React, { FC, useEffect, useState } from 'react';

type OnChangeFn = (checked: boolean, ...args: any[]) => any; // eslint-disable-line @typescript-eslint/no-explicit-any

Expand All @@ -22,6 +22,10 @@ export const withStateChecked = <T extends object>(WrappedComponent: FC<any>) =>
}
};

useEffect(() => {
setComponentChecked(checked);
}, [checked]);
Copy link

Copilot AI Dec 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The useEffect hook should also include setComponentChecked in its dependency array to follow React Hook exhaustive-deps rules. While setComponentChecked is stable due to being from useState, explicitly including it ensures compliance with linting rules and makes dependencies clear.

Suggested change
}, [checked]);
}, [checked, setComponentChecked]);

Copilot uses AI. Check for mistakes.

return <WrappedComponent {...restProps} checked={componentChecked} onChange={handleChange} />;
};

Expand Down
6 changes: 5 additions & 1 deletion packages/components/src/hoc/withStateValue.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FC, useState } from 'react';
import React, { FC, useEffect, useState } from 'react';

type OnChangeFn<T> = (value: T, ...args: any[]) => any; // eslint-disable-line @typescript-eslint/no-explicit-any

Expand All @@ -22,6 +22,10 @@ export const withStateValue = <Props, ValueType>(WrappedComponent: FC<any>) => {
}
};

useEffect(() => {
setComponentValue(value);
}, [value]);
Copy link

Copilot AI Dec 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The useEffect hook should also include setComponentValue in its dependency array to follow React Hook exhaustive-deps rules. While setComponentValue is stable due to being from useState, explicitly including it ensures compliance with linting rules and makes dependencies clear.

Suggested change
}, [value]);
}, [value, setComponentValue]);

Copilot uses AI. Check for mistakes.

return <WrappedComponent {...restProps} onChange={handleChange} value={componentValue} />;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export const BaseChoiceInput = ({
id = undefined,
inputClassName = '',
ref,
required = false,
title = '',
value = '',
}: BaseChoiceInputProps) => {
Expand Down Expand Up @@ -58,7 +57,6 @@ export const BaseChoiceInput = ({
id={id}
name={name}
ref={ref}
required={required}
title={title}
type={type}
value={value}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ export interface BaseChoiceInputProps extends BaseComponentAriaAttributes {
id?: string;
inputClassName?: string;
ref?: Ref<HTMLInputElement>;
required?: boolean;
value?: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@ import { BaseChoiceInputFieldProps } from './BaseChoiceInputField.types';
export const BaseChoiceInputField = ({
children,
className = '',
disabled = false,
error = false,
id,
inputWrapperClassName = '',
labelClassName = '',
renderInput,
}: BaseChoiceInputFieldProps) => {
const componentClassName = createCssClassNames({
'ids-choice-input-field': true,
'ids-choice-input-field--disabled': disabled,
'ids-choice-input-field--error': error,
[className]: true,
});
const componentInputWrapperClassName = createCssClassNames({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { BaseComponentAriaAttributes } from '@ids-types/general';

export interface BaseChoiceInputFieldProps extends BaseComponentAriaAttributes {
children: React.ReactNode;
disabled?: boolean;
error?: boolean;
id: string;
inputWrapperClassName?: string;
labelClassName?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ interface BaseInputPropsProps extends BaseComponentAttributes {
}

interface BaseInputVisibleProps extends BaseInputPropsProps {
required: boolean;
required?: boolean;
type?: Exclude<BaseInputType, 'hidden'>;
extraInputAttrs?: Omit<InputHTMLAttributes<HTMLInputElement>, keyof BaseInputVisibleProps>;
}
Expand Down