Skip to content

Commit

Permalink
feat(metricInput): add icon variations property in metric input compo…
Browse files Browse the repository at this point in the history
…nent
  • Loading branch information
anuradha9712 authored and satyamyadav committed Sep 15, 2023
1 parent ed8d27f commit 3469d1b
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion core/components/atoms/metricInput/MetricInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import classNames from 'classnames';
import { Button, Icon, Text } from '@/index';
import { BaseHtmlProps, BaseProps, extractBaseProps } from '@/utils/types';
import { AutoComplete } from '@/common.type';
import { AutoComplete, FontVariationType } from '@/common.type';

export type MetricInputSize = 'regular' | 'large';

Expand Down Expand Up @@ -32,6 +32,19 @@ export interface MetricInputProps extends BaseProps, BaseHtmlProps<HTMLInputElem
* 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 `MetricInput` before value
*/
Expand Down Expand Up @@ -134,6 +147,7 @@ export const MetricInput = React.forwardRef<HTMLInputElement, MetricInputProps>(
value: valueProp,
showActionButton = true,
onKeyDown,
iconVariations,
...rest
} = props;

Expand Down Expand Up @@ -262,6 +276,7 @@ export const MetricInput = React.forwardRef<HTMLInputElement, MetricInputProps>(
<Icon
data-test="DesignSystem-MetricInput--icon"
name={icon}
variations={iconVariations}
size={sizeMapping[size]}
appearance={!value ? 'disabled' : 'subtle'}
className={iconClass}
Expand Down

0 comments on commit 3469d1b

Please sign in to comment.