Skip to content

Commit

Permalink
Merge pull request #1979 from anuradha9712/feat-input-icon-variations
Browse files Browse the repository at this point in the history
feat(input): add icon variations property in input component
  • Loading branch information
anuradha9712 authored Sep 15, 2023
2 parents e52217f + 5990257 commit b1b6424
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions core/components/atoms/input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import classNames from 'classnames';
import { Tooltip, Icon, Text } from '@/index';
import { IconProps } from '@/index.type';
import { BaseHtmlProps, BaseProps, extractBaseProps } from '@/utils/types';
import { AutoComplete } from '@/common.type';
import { AutoComplete, FontVariationType } from '@/common.type';
import ActionButton from './actionButton';

export type InputType = 'text' | 'password' | 'number' | 'email' | 'tel' | 'url';
Expand Down Expand Up @@ -41,6 +41,19 @@ export interface InputProps extends BaseProps, BaseHtmlProps<HTMLInputElement> {
* Material icon name
*/
icon?: string;
/**
* Set font-variation-settings CSS property for Icons
*
* <pre className="DocPage-codeBlock">
* FontVariationType: {
* fill?: number;
* weight?: number; Range: [100, 700]
* grade?: number; Range: [-25, 200]
* opticalSize?: number; Range: [20px, 48px]
* }
* </pre>
*/
iconVariations?: FontVariationType;
/**
* Label to be displayed inside `Input`
*/
Expand Down Expand Up @@ -170,6 +183,7 @@ export const Input = React.forwardRef<HTMLInputElement, InputProps>((props, forw
autoFocus,
disabled,
readOnly,
iconVariations,
...rest
} = props;

Expand Down Expand Up @@ -238,7 +252,7 @@ export const Input = React.forwardRef<HTMLInputElement, InputProps>((props, forw
)}
{size !== 'tiny' && icon && (
<div className={leftIconClass}>
<Icon name={icon} size={sizeMapping[size]} />
<Icon name={icon} size={sizeMapping[size]} variations={iconVariations} />
</div>
)}
<input
Expand Down

0 comments on commit b1b6424

Please sign in to comment.