-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2296 from innovaccer/develop
Develop
- Loading branch information
Showing
95 changed files
with
4,324 additions
and
351 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -104,3 +104,4 @@ docs/node_modules | |
docs/static/sb/ | ||
docs/cypress/videos | ||
docs/cypress/screenshots | ||
.env |
This file contains 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 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 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 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 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 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 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 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 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,98 @@ | ||
import * as React from 'react'; | ||
import { IconProps } from '@/index.type'; | ||
import { Icon, Text } from '@/index'; | ||
import classNames from 'classnames'; | ||
import { BaseProps, extractBaseProps } from '@/utils/types'; | ||
|
||
type IconPosition = 'left' | 'right'; | ||
|
||
export interface KeyElementProps extends BaseProps { | ||
/** | ||
* React Element to be added inside `KeyElement` | ||
*/ | ||
children?: React.ReactNode; | ||
/** | ||
* Specify label to be displayed in `KeyElement` | ||
*/ | ||
label?: React.ReactText; | ||
/** | ||
* Specify Icon name to displayed in `KeyElement` | ||
*/ | ||
icon?: string; | ||
/** | ||
* List of icon options | ||
* | ||
* <pre className="DocPage-codeBlock"> | ||
* IconProps: { | ||
* name?: string; | ||
* size: number; | ||
* type?: 'rounded' | 'outlined'; | ||
* appearance?: IconAppearance; | ||
* onClick?: (e: React.MouseEvent<HTMLElement>) => void; | ||
* onKeyDown?: (e: React.KeyboardEvent<HTMLElement>) => void; | ||
* children?: React.ReactNode; | ||
* tabIndex?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>['tabIndex']; | ||
* } | ||
* </pre> | ||
*/ | ||
iconOptions?: IconProps; | ||
/** | ||
* Align icon left or right | ||
*/ | ||
iconAlign?: IconPosition; | ||
} | ||
|
||
export const KeyElement = (props: KeyElementProps) => { | ||
const { children, icon, iconOptions, iconAlign, label, className } = props; | ||
|
||
const baseProps = extractBaseProps(props); | ||
|
||
const iconClassNames = classNames('py-2', { | ||
'mr-3': iconAlign === 'left', | ||
'ml-3': iconAlign === 'right', | ||
}); | ||
|
||
const keyClassNames = classNames('d-flex', 'align-items-center', className); | ||
|
||
if (children) { | ||
return ( | ||
<dt data-test="DesignSystem-KeyValuePair-KeyElement" {...baseProps}> | ||
{children} | ||
</dt> | ||
); | ||
} | ||
|
||
return ( | ||
<dt data-test="DesignSystem-KeyValuePair-KeyElement" {...baseProps} className={keyClassNames}> | ||
{icon && iconAlign === 'left' && ( | ||
<Icon | ||
appearance="subtle" | ||
name={icon} | ||
className={iconClassNames} | ||
data-test="DesignSystem-KeyValuePair-Icon--Left" | ||
{...iconOptions} | ||
/> | ||
)} | ||
{label && ( | ||
<Text weight="medium" appearance="subtle"> | ||
{label} | ||
</Text> | ||
)} | ||
{icon && iconAlign === 'right' && ( | ||
<Icon | ||
appearance="subtle" | ||
name={icon} | ||
className={iconClassNames} | ||
data-test="DesignSystem-KeyValuePair-Icon--Right" | ||
{...iconOptions} | ||
/> | ||
)} | ||
</dt> | ||
); | ||
}; | ||
|
||
KeyElement.defaultProps = { | ||
iconAlign: 'left', | ||
}; | ||
|
||
export default KeyElement; |
This file contains 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,29 @@ | ||
import * as React from 'react'; | ||
import KeyElement from './KeyElement'; | ||
import ValueElement from './ValueElement'; | ||
import { BaseProps } from '@/utils/types'; | ||
import classNames from 'classnames'; | ||
|
||
export interface KeyValuePairProps extends BaseProps { | ||
/** | ||
* React Element to be added inside `KeyValuePair` | ||
*/ | ||
children: React.ReactNode; | ||
} | ||
|
||
export const KeyValuePair = (props: KeyValuePairProps) => { | ||
const { children, className } = props; | ||
|
||
const pairClassNames = classNames('m-0', className); | ||
|
||
return ( | ||
<dl data-test="DesignSystem-KeyValuePair" {...props} className={pairClassNames}> | ||
{children} | ||
</dl> | ||
); | ||
}; | ||
|
||
KeyValuePair.Key = KeyElement; | ||
KeyValuePair.Value = ValueElement; | ||
|
||
export default KeyValuePair; |
This file contains 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,39 @@ | ||
import * as React from 'react'; | ||
import { Text } from '@/index'; | ||
import classNames from 'classnames'; | ||
import { BaseProps, extractBaseProps } from '@/utils/types'; | ||
|
||
export interface ValueElementProps extends BaseProps { | ||
/** | ||
* React Element to be added inside `ValueElement` | ||
*/ | ||
children?: React.ReactNode; | ||
/** | ||
* Specify value to be displayed in `ValueElement` | ||
*/ | ||
value?: React.ReactText; | ||
} | ||
|
||
export const ValueElement = (props: ValueElementProps) => { | ||
const { children, value, className } = props; | ||
|
||
const baseProps = extractBaseProps(props); | ||
|
||
const valueClassNames = classNames('m-0', className); | ||
|
||
if (children) { | ||
return ( | ||
<dd data-test="DesignSystem-KeyValuePair-ValueElement" {...baseProps} className={valueClassNames}> | ||
{children} | ||
</dd> | ||
); | ||
} | ||
|
||
return ( | ||
<dd data-test="DesignSystem-KeyValuePair-ValueElement" {...baseProps} className={valueClassNames}> | ||
{value && <Text>{value}</Text>} | ||
</dd> | ||
); | ||
}; | ||
|
||
export default ValueElement; |
Oops, something went wrong.