diff --git a/.changeset/spotty-countries-battle.md b/.changeset/spotty-countries-battle.md new file mode 100644 index 0000000000..2541f81eb4 --- /dev/null +++ b/.changeset/spotty-countries-battle.md @@ -0,0 +1,5 @@ +--- +'@leafygreen-ui/icon': minor +--- + +Adds `Pin` glyph and updates `Warning` glyph to match Figma specs. diff --git a/packages/icon/README.md b/packages/icon/README.md index 1c8cf43a93..0f4fcb98f4 100644 --- a/packages/icon/README.md +++ b/packages/icon/README.md @@ -47,13 +47,13 @@ const SomeComponent = () => ; ## Properties -| Prop | Type | Description | Default | -| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- | -| `glyph` (Required) | `'ActivityFeed'`, `'AddFile'`, `'AllProducts'`, `'Apps'`, `'Array'`, `'ArrowDown'`, `'ArrowLeft'`, `'ArrowRight'`, `'ArrowUp'`, `'Beaker'`, `'Bell'`, `'Biometric'`, `'Building'`, `'Bulb'`, `'Calendar'`, `'CaretDown'`, `'CaretLeft'`, `'CaretRight'`, `'CaretUp'`, `'ChartFilled'`, `'Charts'`, `'Checkmark'`, `'CheckmarkWithCircle'`, `'ChevronDown'`,, `'ChevronLeft'` `'ChevronRight'`,`'ChevronUp'`, `'Clock'`,`'ClockWithArrow'`, `'Clone'`, `'Cloud'`, `'Code'`, `'CodeBlock'`, `'Connect'`,`'Copy'`,`'CreditCard'`, `'CurlyBraces'`, `'Dashboard'`, `'Database'`, `'Diagram'`, `'Diagram2'`, `'Diagram3'`, `'Disconnect'`, `'Download'`, `'Drag'`, `'Edit'`, `'Ellipsis'`, `'Email'`, `'Export'`, `'Favorite'`, `'Federation'`, `'File'`, `'Filter'`,`'Folder'`, `'FullScreenEnter'`, `'FullScreenExit'`, `'Guage'`, `'GlobeAmericas'`, `'GovernmentBuilding'`, `'Highlight'`, `'Home'`, `'Import'`, `'ImportantWithCircle'`, `'InfoWithCircle'`, `'InviteUser'`, `'Key'`, `'Laptop'`, `'Link'`, `'List'`, `'Lock'`, `'LogIn'`, `'LogOut'`, `'MagnifyingGlass'`, `'Megaphone'`, `'Menu'`, `'Minus'`, `'MultiDirectionArrow'`, `'MultiLayers'`, `'NavCollapse'`, `'NavExpand'`, `'NoFilter'`, `'NotAllowed'`, `'Note'`, `'OpenNewTab'`, `'Pause'`, `'Person'`, `'PersonGroup'`, `'PersonWithLock'`, `'Play'`, `'Plus'`, `'PlusWithCircle'`, `'QuestionMarkWithCircle'`, `'Read'`, `'Redo'`, `'Refresh'`,`'Relationship'`, `'ReplicaSet'`,`'Resize'`, `'Return'`, `'Save'`, `'Serverless'`, `'Settings'`, `'ShardedCluster'`, `'Shell'`, `'SMS'`,`'SortAscending'`, `'SortDescending'`, `'SortHorizontal'`, `'SortVertical'`,`'Sparkle'`, `'SplitHorizontal'`, `'SplitVertical'`, `'Stitch'`, `'Support'`, `'Sweep'`, `'Table'`, `'Tag'`, `'ThumbsDown'`, `'ThumbsUp'`, `'TimeSeries'`, `'Trash'`, `'Undo'`, `'University'`, `'Unlock'`, `'Unsorted'`, `'UpDownCarets'`, `'Upload'`, `'VerticalEllipsis'`, `'Visibility'`, `'VisibilityOff'`, `'Warning'`, `'Wizard'`, `'Wrench'`, `'Write'`,`'X'`, `'XWithCircle'` | Specifies the glyph to use. | | -| `size` | `'small'`, `'default'`, `'large'`, `'xlarge'`, `number` | The height and width of the glyph's viewBox. This can be any `number` or one of the following `'small'`, `'default'`, `'large'`, `'xlarge'` | `'default'` | -| `fill` | `string` | The fill color that is passed to the glyph. By default, the glyph will inherit its fill from the CSS color property of its nearest ancestor. | | -| `title` | `string`, `boolean`, `null` | Renders a title tag with the passed string within the SVG element for screen reader accessibility. Setting this value to `false` will entirely unset the title.
If title is `undefined` or `null`, a human-readable title will be generated based on the glyph's name. | | -| ... | `SVGR.ComponentProps` | All other props will be spread on the `svg` element | | +| Prop | Type | Description | Default | +| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- | +| `glyph` (Required) | `'ActivityFeed'`, `'AddFile'`, `'AllProducts'`, `'Apps'`, `'Array'`, `'ArrowDown'`, `'ArrowLeft'`, `'ArrowRight'`, `'ArrowUp'`, `'Beaker'`, `'Bell'`, `'Biometric'`, `'Building'`, `'Bulb'`, `'Calendar'`, `'CaretDown'`, `'CaretLeft'`, `'CaretRight'`, `'CaretUp'`, `'ChartFilled'`, `'Charts'`, `'Checkmark'`, `'CheckmarkWithCircle'`, `'ChevronDown'`,, `'ChevronLeft'` `'ChevronRight'`,`'ChevronUp'`, `'Clock'`,`'ClockWithArrow'`, `'Clone'`, `'Cloud'`, `'Code'`, `'CodeBlock'`, `'Connect'`,`'Copy'`,`'CreditCard'`, `'CurlyBraces'`, `'Dashboard'`, `'Database'`, `'Diagram'`, `'Diagram2'`, `'Diagram3'`, `'Disconnect'`, `'Download'`, `'Drag'`, `'Edit'`, `'Ellipsis'`, `'Email'`, `'Export'`, `'Favorite'`, `'Federation'`, `'File'`, `'Filter'`,`'Folder'`, `'FullScreenEnter'`, `'FullScreenExit'`, `'Guage'`, `'GlobeAmericas'`, `'GovernmentBuilding'`, `'Highlight'`, `'Home'`, `'Import'`, `'ImportantWithCircle'`, `'InfoWithCircle'`, `'InviteUser'`, `'Key'`, `'Laptop'`, `'Link'`, `'List'`, `'Lock'`, `'LogIn'`, `'LogOut'`, `'MagnifyingGlass'`, `'Megaphone'`, `'Menu'`, `'Minus'`, `'MultiDirectionArrow'`, `'MultiLayers'`, `'NavCollapse'`, `'NavExpand'`, `'NoFilter'`, `'NotAllowed'`, `'Note'`, `'OpenNewTab'`, `'Pause'`, `'Person'`, `'PersonGroup'`, `'PersonWithLock'`, `'Pin'`, `'Play'`, `'Plus'`, `'PlusWithCircle'`, `'QuestionMarkWithCircle'`, `'Read'`, `'Redo'`, `'Refresh'`,`'Relationship'`, `'ReplicaSet'`,`'Resize'`, `'Return'`, `'Save'`, `'Serverless'`, `'Settings'`, `'ShardedCluster'`, `'Shell'`, `'SMS'`,`'SortAscending'`, `'SortDescending'`, `'SortHorizontal'`, `'SortVertical'`,`'Sparkle'`, `'SplitHorizontal'`, `'SplitVertical'`, `'Stitch'`, `'Support'`, `'Sweep'`, `'Table'`, `'Tag'`, `'ThumbsDown'`, `'ThumbsUp'`, `'TimeSeries'`, `'Trash'`, `'Undo'`, `'University'`, `'Unlock'`, `'Unsorted'`, `'UpDownCarets'`, `'Upload'`, `'VerticalEllipsis'`, `'Visibility'`, `'VisibilityOff'`, `'Warning'`, `'Wizard'`, `'Wrench'`, `'Write'`,`'X'`, `'XWithCircle'` | Specifies the glyph to use. | | +| `size` | `'small'`, `'default'`, `'large'`, `'xlarge'`, `number` | The height and width of the glyph's viewBox. This can be any `number` or one of the following `'small'`, `'default'`, `'large'`, `'xlarge'` | `'default'` | +| `fill` | `string` | The fill color that is passed to the glyph. By default, the glyph will inherit its fill from the CSS color property of its nearest ancestor. | | +| `title` | `string`, `boolean`, `null` | Renders a title tag with the passed string within the SVG element for screen reader accessibility. Setting this value to `false` will entirely unset the title.
If title is `undefined` or `null`, a human-readable title will be generated based on the glyph's name. | | +| ... | `SVGR.ComponentProps` | All other props will be spread on the `svg` element | | # createIconComponent diff --git a/packages/icon/src/generated/Pin.tsx b/packages/icon/src/generated/Pin.tsx new file mode 100644 index 0000000000..ab02bda418 --- /dev/null +++ b/packages/icon/src/generated/Pin.tsx @@ -0,0 +1,45 @@ +/** +* This is a generated file. Do not modify it manually. +* +* @script ./node_modules/.bin/ts-node packages/icon/scripts/build.ts +* @checksum af3241bbc283fa461885e25ad52d20b7 +*/ +import * as React from "react"; +import PropTypes from 'prop-types'; +import { css, cx } from '@leafygreen-ui/emotion'; +import { generateAccessibleProps, sizeMap } from '../glyphCommon'; +import { LGGlyph } from '../types'; +export interface PinProps extends LGGlyph.ComponentProps {} +const Pin = ({ + className, + size = 16, + title, + ['aria-label']: ariaLabel, + ['aria-labelledby']: ariaLabelledby, + fill, + role = 'img', + ...props +}: PinProps) => { + const fillStyle = css` + color: ${fill}; + `; + const noFlexShrink = css` + flex-shrink: 0; + `; + const accessibleProps = generateAccessibleProps(role, 'Pin', { + title, + ['aria-label']: ariaLabel, + ['aria-labelledby']: ariaLabelledby + }); + return ; +}; +Pin.displayName = 'Pin'; +Pin.isGlyph = true; +Pin.propTypes = { + fill: PropTypes.string, + size: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), + className: PropTypes.string +}; +export default Pin; \ No newline at end of file diff --git a/packages/icon/src/generated/Warning.tsx b/packages/icon/src/generated/Warning.tsx index ce70ab717b..d8572f8607 100644 --- a/packages/icon/src/generated/Warning.tsx +++ b/packages/icon/src/generated/Warning.tsx @@ -2,7 +2,7 @@ * This is a generated file. Do not modify it manually. * * @script ./node_modules/.bin/ts-node packages/icon/scripts/build.ts -* @checksum 3810a5ba691b2f706abc0288a95078a7 +* @checksum e9c2a4040a3148c4e10b1b4d8ea687ac */ import * as React from "react"; import PropTypes from 'prop-types'; @@ -33,7 +33,7 @@ const Warning = ({ }); return ; + }, noFlexShrink, className)} height={typeof size === 'number' ? size : sizeMap[size]} width={typeof size === 'number' ? size : sizeMap[size]} role={role} {...accessibleProps} {...props} viewBox="0 0 16 16">; }; Warning.displayName = 'Warning'; Warning.isGlyph = true; diff --git a/packages/icon/src/glyphs/Pin.svg b/packages/icon/src/glyphs/Pin.svg new file mode 100644 index 0000000000..04557b5469 --- /dev/null +++ b/packages/icon/src/glyphs/Pin.svg @@ -0,0 +1,3 @@ + + + diff --git a/packages/icon/src/glyphs/Warning.svg b/packages/icon/src/glyphs/Warning.svg index 087adcc8b5..34282a4dd0 100644 --- a/packages/icon/src/glyphs/Warning.svg +++ b/packages/icon/src/glyphs/Warning.svg @@ -1,3 +1,3 @@ - + diff --git a/packages/icon/src/glyphs/index.ts b/packages/icon/src/glyphs/index.ts index ab10a1ae84..0a149b4dd7 100644 --- a/packages/icon/src/glyphs/index.ts +++ b/packages/icon/src/glyphs/index.ts @@ -91,6 +91,7 @@ import Pause from './Pause.svg'; import Person from './Person.svg'; import PersonGroup from './PersonGroup.svg'; import PersonWithLock from './PersonWithLock.svg'; +import Pin from './Pin.svg'; import Play from './Play.svg'; import Plus from './Plus.svg'; import PlusWithCircle from './PlusWithCircle.svg'; @@ -228,6 +229,7 @@ const _glyphs = { Person, PersonGroup, PersonWithLock, + Pin, Play, Plus, PlusWithCircle,