-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: release updates to Chip, SearchField, Pagination, Form.Autosug…
…gest (#2995) BREAKING CHANGE: Many of the SCSS variables (i.e., tokens) surrounding `Chip` were removed. Consumers should verify no longer using any of the removed SCSS variables in custom Paragon brands/themes. BREAKING CHANGE: Many of the SCSS variables (i.e., tokens) surrounding `Pagination` were removed. Consumers should verify no longer using any of the removed SCSS variables in custom Paragon brands/themes. BREAKING CHANGE: `icons` prop on `SearchField` now accepts the icon src instead of an `Icon` component. BREAKING CHANGE: `icons` prop on `Pagination` now accepts the icon src instead of an `Icon` component. BREAKING CHANGE: `value` prop of `Form.Autosuggest` is now an object instead of a string BREAKING CHANGE: `Form.Autosuggest` now uses `onChange` instead of `onSelected` BREAKING CHANGE: `Form.Autosuggest` now takes in different error messages for value/selection required, and custom errors
- Loading branch information
1 parent
4ba0b6d
commit 970b102
Showing
47 changed files
with
2,488 additions
and
1,476 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
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,54 @@ | ||
import React, { KeyboardEventHandler, MouseEventHandler } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import Icon from '../Icon'; | ||
// @ts-ignore | ||
import IconButton from '../IconButton'; | ||
// @ts-ignore | ||
import { STYLE_VARIANTS } from './constants'; | ||
|
||
export interface ChipIconProps { | ||
className: string, | ||
src: React.ReactElement | Function, | ||
onClick?: KeyboardEventHandler & MouseEventHandler, | ||
alt?: string, | ||
variant: string, | ||
disabled?: boolean, | ||
} | ||
|
||
function ChipIcon({ | ||
className, src, onClick, alt, variant, disabled, | ||
}: ChipIconProps) { | ||
if (onClick) { | ||
return ( | ||
<IconButton | ||
className={className} | ||
src={src} | ||
onClick={onClick} | ||
iconAs={Icon} | ||
alt={alt} | ||
invertColors={variant === STYLE_VARIANTS.DARK} | ||
tabIndex={disabled ? -1 : 0} | ||
/> | ||
); | ||
} | ||
|
||
return <Icon src={src} className={className} size="sm" />; | ||
} | ||
|
||
ChipIcon.propTypes = { | ||
className: PropTypes.string.isRequired, | ||
src: PropTypes.oneOfType([PropTypes.element, PropTypes.func]).isRequired, | ||
onClick: PropTypes.func, | ||
alt: PropTypes.string, | ||
variant: PropTypes.string, | ||
disabled: PropTypes.bool, | ||
}; | ||
|
||
ChipIcon.defaultProps = { | ||
onClick: undefined, | ||
alt: undefined, | ||
variant: STYLE_VARIANTS.LIGHT, | ||
disabled: false, | ||
}; | ||
|
||
export default ChipIcon; |
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
Oops, something went wrong.