diff --git a/.storybook/routes.js b/.storybook/routes.js
index f0dfd354fe..d0896bda64 100644
--- a/.storybook/routes.js
+++ b/.storybook/routes.js
@@ -3,10 +3,9 @@
// and will rewrite the URL to point to the correct URL for the story. The Storybook key will be
// rewritten to something like `?path=/docs/${id}`
const routes = {
- '/assets/accent-icons/': 'tokens-icon--accent-icon',
- '/assets/applet-icons/': 'tokens-icon--applet-icon',
- '/assets/applet-icons/': 'tokens-icon--applet-icon',
- '/assets/system-icons/': 'tokens-icon--system-icon',
+ '/assets/accent-icons/': 'assets-icons-list--accent-icon-list',
+ '/assets/applet-icons/': 'assets-icons-list--applet-icon-list',
+ '/assets/system-icons/': 'assets-icons-list--applet-icon-list',
'/components/buttons/action-bar/': 'components-buttons-action-bar--basic',
'/components/buttons/button/': 'components-buttons--primary',
'/components/buttons/segmented-control/': 'preview-segmented-control--basic',
diff --git a/modules/docs/mdx/11.0-UPGRADE-GUIDE.mdx b/modules/docs/mdx/11.0-UPGRADE-GUIDE.mdx
index 19a4d17927..798a99a022 100644
--- a/modules/docs/mdx/11.0-UPGRADE-GUIDE.mdx
+++ b/modules/docs/mdx/11.0-UPGRADE-GUIDE.mdx
@@ -51,7 +51,9 @@ A note to the reader:
- [Styling API and CSS Tokens](#styling-api-and-css-tokens)
- [CountBadge](#count-badge)
- [Form Field Preview](#form-field-preview)
+ - [Graphic](#graphic)
- [Icons](#icons)
+ - [Image](#image)
- [Status Indicator (Preview)](#status-indicator-preview)
- [Table](#table)
- [Text](#text)
@@ -636,6 +638,12 @@ to check your logic to make sure it sets the appropaite value to the prop.
> **Note:** If you use your own custom `input` you will need to handle the styling for error and
> alert states.
+### Graphic
+
+**PR:** [#3062](https://github.com/Workday/canvas-kit/pull/3062)
+
+We've updated `Graphic` and its `src` prop to accept a `string` value to support images loaded from a CDN or SAS. The previous API is still supported.
+
### Icons
@@ -809,6 +817,13 @@ const MyComponent = StyledRadioButton('div')({
;
```
+### Image
+
+**PR:** [#3062](https://github.com/Workday/canvas-kit/pull/3062)
+
+We've added a new `Image` component under the `@workday/canvas-kit-react/icon` package. This component renders an `img` element and is meant to be used when you need more control over the image attributes like aspect ratio or object fit.
+
+
### Status Indicator (Preview)
diff --git a/modules/react/avatar/stories/stories.tsx b/modules/react/avatar/stories/stories.tsx
index 9e3045a480..967a319f4e 100644
--- a/modules/react/avatar/stories/stories.tsx
+++ b/modules/react/avatar/stories/stories.tsx
@@ -61,13 +61,13 @@ storiesOf('Components/Indicators/Avatar', module)
.add('Non-Square Image', () => (
Original Rectangle Image
-
+
Using Object Fit on a Rectangle Image
-
+
Original Square Image
-
+
Using a Square Image
-
+
))
.add('Lazy Loading', () => (
diff --git a/modules/react/icon/index.ts b/modules/react/icon/index.ts
index af3173fe90..370e7c396c 100644
--- a/modules/react/icon/index.ts
+++ b/modules/react/icon/index.ts
@@ -3,4 +3,5 @@ export * from './lib/AppletIcon';
export * from './lib/SystemIcon';
export * from './lib/SystemIconCircle';
export * from './lib/Graphic';
+export * from './lib/Image';
export {Svg, SvgProps, svgStencil} from './lib/Svg';
diff --git a/modules/react/icon/lib/Graphic.tsx b/modules/react/icon/lib/Graphic.tsx
index 6e9e4a73e5..5d4bd6733e 100644
--- a/modules/react/icon/lib/Graphic.tsx
+++ b/modules/react/icon/lib/Graphic.tsx
@@ -2,8 +2,9 @@ import * as React from 'react';
import {CanvasGraphic, CanvasIconTypes} from '@workday/design-assets-types';
import {CSSObject} from '@emotion/styled';
import {Svg, SvgProps, svgStencil} from './Svg';
-import {createComponent} from '@workday/canvas-kit-react/common';
+import {createComponent, ExtractProps} from '@workday/canvas-kit-react/common';
import {createStencil, handleCsProp, px2rem} from '@workday/canvas-kit-styling';
+import {Image} from './Image';
/**
* @deprecated Interface `GraphicStyles` will be removed in a future version. `grow` prop will be moved inside `GraphicProps`.
@@ -30,9 +31,13 @@ export interface GraphicProps extends GraphicStyles, Pick;
+
+export type GraphicsImageOrSvgProps = GraphicProps | GraphicsImageProps;
+
/**
* @deprecated `graphicStyles` will be removed in in a future version as a part of implementation of stencils and new tokens. Consider to use `graphicStencil` instead.
*/
@@ -66,6 +71,18 @@ export const graphicStyles = ({width, height, grow}: GraphicStyles): CSSObject =
return {};
};
+type GraphicImageProps = ExtractProps;
+
+/**
+ * Returns an overloaded functional component that uses Graphic props by default.
+ */
+type GraphicOverload = {
+ (props: {src: CanvasGraphic} & GraphicProps & {ref?: React.Ref}): React.ReactElement;
+ (
+ props: {src: string} & GraphicImageProps & {ref?: React.Ref}
+ ): React.ReactElement;
+};
+
export const graphicStencil = createStencil({
extends: svgStencil,
base: {},
@@ -79,23 +96,34 @@ export const graphicStencil = createStencil({
},
});
-export const Graphic = createComponent('span')({
+export const Graphic: GraphicOverload = createComponent('span')({
displayName: 'Graphic',
- Component: ({grow, width, height, ...elemProps}: GraphicProps, ref, Element) => {
+ Component: ({src, ...elemProps}: GraphicProps, ref, Element) => {
return (
-