Skip to content

Commit

Permalink
refactor(inputs): adjust missing parts
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosCortizasCT committed Dec 18, 2024
1 parent 48f9768 commit 85bfc0a
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,13 @@ const CheckboxInput = ({
isHovered={props.isHovered}
isIndeterminate={props.isIndeterminate}
>
<Checkbox {...props} id={id} />
<Checkbox
{...props}
id={id}
isChecked={isChecked}
isDisabled={isDisabled}
hasError={hasError}
/>
<CheckboxIcon
hasError={hasError}
isDisabled={isDisabled}
Expand Down
10 changes: 6 additions & 4 deletions packages/components/inputs/radio-input/src/radio-option.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export type TStylesProps = Pick<
| 'isChecked'
>;

const Option = ({ ...props }: TOptionProps) => {
const Option = (props: TOptionProps) => {
const labelProps = props.id ? { htmlFor: props.id } : {};

if (!props.isReadOnly) {
Expand Down Expand Up @@ -120,9 +120,7 @@ const Option = ({ ...props }: TOptionProps) => {
checked={props.isChecked}
type="radio"
readOnly={props.isReadOnly}
{...filterDataAttributes({
...props,
})}
{...filterDataAttributes(props)}
/>
<RadioOptionContainer {...stylesProps}>
<RadioOptionBorder {...stylesProps}>
Expand All @@ -143,4 +141,8 @@ const Option = ({ ...props }: TOptionProps) => {
};
Option.displayName = 'RadioOption';

Option.defaultProps = {
components: {},
};

export default Option;
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,11 @@ const SearchSelectInput = ({
>
<AsyncSelectInput
{...props}
value={value}
menuPortalZIndex={menuPortalZIndex}
maxMenuHeight={maxMenuHeight}
appearance={appearance}
optionStyle={optionStyle}
components={components as ReactSelectAsyncProps['components']}
placeholder={placeholder}
iconLeft={props.iconLeft}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ const TestComponent = ({
</label>
<SelectableSearchInput
{...props}
id={id}
name={name}
options={options}
value={_value}
onSubmit={onSubmit}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,14 @@ const SelectableSearchInput = ({
const containerRef = useRef<HTMLDivElement>(null);
const textInputRef = useRef<HTMLInputElement>(null);

const allProps = {
horizontalConstraint,
isClearable,
menuHorizontalConstraint,
showSubmitButton,
menuPortalZIndex,
...props,
};
const legacyDataProps = filterDataAttributes(props);
const transformedSelectDataProps = transformDataProps(props.selectDataProps);
const transformedInputDataProps = transformDataProps(props.inputDataProps);
Expand Down Expand Up @@ -452,7 +460,7 @@ const SelectableSearchInput = ({
>
<Constraints.Horizontal max={menuHorizontalConstraint}>
<SelectableSelect
{...props}
{...allProps}
id={SelectableSearchInput.getDropdownId(selectablSearchInputId)}
name={getDropdownName(props.name)}
dropdownHasFocus={dropdownHasFocus}
Expand All @@ -468,10 +476,7 @@ const SelectableSearchInput = ({
</Constraints.Horizontal>
<div
css={[
getSelectableSearchInputContainerStyles({
horizontalConstraint,
...props,
}),
getSelectableSearchInputContainerStyles(allProps),
dropdownHasFocus &&
!props.isReadOnly &&
css`
Expand All @@ -498,10 +503,7 @@ const SelectableSearchInput = ({
autoComplete={props.autoComplete}
aria-readonly={props.isReadOnly}
contentEditable={!props.isReadOnly}
css={getSelectableSearchInputStyles({
horizontalConstraint,
...props,
})}
css={getSelectableSearchInputStyles(allProps)}
{...transformedInputDataProps}
{...legacyDataProps}
/* ARIA */
Expand All @@ -523,10 +525,7 @@ const SelectableSearchInput = ({
size={props.isCondensed ? '10' : '20'}
label={'clear-button'}
onClick={handleClear}
css={getClearIconButtonStyles({
horizontalConstraint,
...props,
})}
css={getClearIconButtonStyles(allProps)}
/>
)}
{showSubmitButton && (
Expand All @@ -535,10 +534,7 @@ const SelectableSearchInput = ({
size={props.isCondensed ? '20' : '40'}
label={'search-button'}
onClick={handleSubmit}
css={getSearchIconButtonStyles({
horizontalConstraint,
...props,
})}
css={getSearchIconButtonStyles(allProps)}
isDisabled={props.isDisabled}
/>
)}
Expand Down

0 comments on commit 85bfc0a

Please sign in to comment.