Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: New icon library #24433

Merged
merged 42 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
dfb3b0e
First pass at removing old icons
cdedreuille Oct 9, 2023
a2f60ba
Remove string icon on ListIem
cdedreuille Oct 11, 2023
cb165de
Merge branch 'release-8-0' into new-icon-library
cdedreuille Oct 11, 2023
5ae9d99
Merge branch 'release-8-0' into new-icon-library
cdedreuille Oct 11, 2023
1d858b3
Fix some stories
cdedreuille Oct 11, 2023
bda3488
Add migration notes
cdedreuille Oct 11, 2023
9ee1439
Fix types
cdedreuille Oct 11, 2023
a27510a
Update icon.tsx
cdedreuille Oct 11, 2023
6630637
Fix some types
cdedreuille Oct 11, 2023
72f52d7
Update Object.tsx
cdedreuille Oct 11, 2023
cc388f8
Update App.tsx
cdedreuille Oct 11, 2023
11c8213
Remove withSymbol
cdedreuille Oct 11, 2023
cbac1f0
Change colour
cdedreuille Oct 11, 2023
d8c6111
Fix some issues
cdedreuille Oct 12, 2023
0137b86
Clean
cdedreuille Oct 12, 2023
4977bad
Fix icons with 1.2.0
cdedreuille Oct 12, 2023
ebed6a6
Merge branch 'release-8-0' into new-icon-library
cdedreuille Oct 12, 2023
1c50fe4
Update verdaccio.yaml
cdedreuille Oct 12, 2023
7f185bf
Merge branch 'release-8-0' into new-icon-library
cdedreuille Oct 12, 2023
ea5cf24
Fix the icon component
cdedreuille Oct 13, 2023
d4b040c
Update TooltipLinkList.tsx
cdedreuille Oct 13, 2023
38e01af
Improve how to call "use" in svgs
cdedreuille Oct 13, 2023
c3520ab
Oops
cdedreuille Oct 13, 2023
186eb91
Merge branch 'release-8-0' into new-icon-library
cdedreuille Oct 13, 2023
ad7f7e0
Move icons to dependencies
cdedreuille Oct 13, 2023
8242722
Fix some icons
cdedreuille Oct 13, 2023
f89fbfd
Merge branch 'release-8-0' into new-icon-library
cdedreuille Oct 18, 2023
f3cf822
Update all icons dependencies
cdedreuille Oct 18, 2023
63c9f1a
Update icons on backgrounds addon
cdedreuille Oct 18, 2023
e3f9c71
Update icons in all addons
cdedreuille Oct 18, 2023
1384764
Update canary
cdedreuille Oct 18, 2023
c217690
Update Toolbar.tsx
cdedreuille Oct 18, 2023
f76ff1f
Renaming
cdedreuille Oct 18, 2023
7a10141
Updates most of the easy icons
cdedreuille Oct 18, 2023
9901392
Update Panel.stories.tsx
cdedreuille Oct 18, 2023
be6af4b
globalize new icons
ndelangen Oct 18, 2023
5c758b6
Merge branch 'release-8-0' into new-icon-library
cdedreuille Oct 18, 2023
8bb1a43
add missing typings
ndelangen Oct 18, 2023
bd7e891
Merge branch 'new-icon-library' of github.com:storybookjs/storybook i…
ndelangen Oct 18, 2023
1d4118b
Update icon library
cdedreuille Oct 19, 2023
117bfbd
Merge branch 'release-8-0' into new-icon-library
cdedreuille Oct 19, 2023
b332f40
Fix linting for now
cdedreuille Oct 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- [Core changes](#core-changes)
- [UI layout state has changed shape](#ui-layout-state-has-changed-shape)
- [New UI and props for Button and IconButton components](#new-ui-and-props-for-button-and-iconbutton-components)
- [Icons is deprecated](#icons-is-deprecated)
- [From version 7.4.0 to 7.5.0](#from-version-740-to-750)
- [`storyStoreV6` and `storiesOf` is deprecated](#storystorev6-and-storiesof-is-deprecated)
- [`storyIndexers` is replaced with `experimental_indexers`](#storyindexers-is-replaced-with-experimental_indexers)
Expand Down Expand Up @@ -339,6 +340,10 @@ For the `Button` component, the following props are now deprecated:

The `IconButton` doesn't have any deprecated props but it now uses the new `Button` component under the hood so all props for `IconButton` will be the same as `Button`.

#### Icons is deprecated

In Storybook 8.0 we are introducing a new icon library available with `@storybook/icons`. We are deprecating the `Icons` component in `@storybook/components` and recommend that addon creators and Storybook maintainers use the new `@storybook/icons` component instead.

## From version 7.4.0 to 7.5.0

#### `storyStoreV6` and `storiesOf` is deprecated
Expand Down
1 change: 1 addition & 0 deletions code/addons/a11y/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"@storybook/components": "workspace:*",
"@storybook/core-events": "workspace:*",
"@storybook/global": "^5.0.0",
"@storybook/icons": "^1.2.1",
"@storybook/manager-api": "workspace:*",
"@storybook/preview-api": "workspace:*",
"@storybook/theming": "workspace:*",
Expand Down
11 changes: 5 additions & 6 deletions code/addons/a11y/src/components/A11YPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import React, { useCallback, useMemo, useState } from 'react';

import { styled } from '@storybook/theming';

import { ActionBar, Icons, ScrollArea } from '@storybook/components';
import { ActionBar, ScrollArea } from '@storybook/components';
import { SyncIcon, CheckIcon } from '@storybook/icons';

import type { AxeResults } from 'axe-core';
import { useChannel, useParameter, useStorybookState } from '@storybook/manager-api';
Expand All @@ -21,9 +22,7 @@ export enum RuleType {
INCOMPLETION,
}

const Icon = styled(Icons)({
height: 12,
width: 12,
const Icon = styled(SyncIcon)({
marginRight: 4,
});

Expand Down Expand Up @@ -108,7 +107,7 @@ export const A11YPanel: React.FC = () => {
'Rerun tests'
) : (
<>
<Icon icon="check" /> Tests completed
<CheckIcon /> Tests completed
</>
),
onClick: handleManual,
Expand Down Expand Up @@ -164,7 +163,7 @@ export const A11YPanel: React.FC = () => {
)}
{status === 'running' && (
<Centered>
<RotatingIcon icon="sync" /> Please wait while the accessibility scan is running ...
<RotatingIcon size={12} /> Please wait while the accessibility scan is running ...
</Centered>
)}
{(status === 'ready' || status === 'ran') && (
Expand Down
5 changes: 3 additions & 2 deletions code/addons/a11y/src/components/VisionSimulator.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import type { ReactNode } from 'react';
import React, { useState } from 'react';
import { Global, styled } from '@storybook/theming';
import { Icons, IconButton, WithTooltip, TooltipLinkList } from '@storybook/components';
import { IconButton, WithTooltip, TooltipLinkList } from '@storybook/components';

import { AccessibilityIcon } from '@storybook/icons';
import { Filters } from './ColorFilters';

const iframeId = 'storybook-preview-iframe';
Expand Down Expand Up @@ -144,7 +145,7 @@ export const VisionSimulator = () => {
onDoubleClick={() => setFilter(null)}
>
<IconButton key="filter" active={!!filter} title="Vision simulator">
<Icons icon="accessibility" />
<AccessibilityIcon />
</IconButton>
</WithTooltip>
<Hidden>
Expand Down
1 change: 1 addition & 0 deletions code/addons/backgrounds/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"@storybook/components": "workspace:*",
"@storybook/core-events": "workspace:*",
"@storybook/global": "^5.0.0",
"@storybook/icons": "^1.2.1",
"@storybook/manager-api": "workspace:*",
"@storybook/preview-api": "workspace:*",
"@storybook/theming": "workspace:*",
Expand Down
5 changes: 3 additions & 2 deletions code/addons/backgrounds/src/containers/BackgroundSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import memoize from 'memoizerific';

import { useParameter, useGlobals } from '@storybook/manager-api';
import { logger } from '@storybook/client-logger';
import { Icons, IconButton, WithTooltip, TooltipLinkList } from '@storybook/components';
import { IconButton, WithTooltip, TooltipLinkList } from '@storybook/components';

import { PhotoIcon } from '@storybook/icons';
import { PARAM_KEY as BACKGROUNDS_PARAM_KEY } from '../constants';
import { ColorIcon } from '../components/ColorIcon';
import type {
Expand Down Expand Up @@ -140,7 +141,7 @@ export const BackgroundSelector: FC = memo(function BackgroundSelector() {
title="Change the background of the preview"
active={selectedBackgroundColor !== 'transparent' || isTooltipVisible}
>
<Icons icon="photo" />
<PhotoIcon />
</IconButton>
</WithTooltip>
</Fragment>
Expand Down
5 changes: 3 additions & 2 deletions code/addons/backgrounds/src/containers/GridSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import type { FC } from 'react';
import React, { memo } from 'react';

import { useGlobals, useParameter } from '@storybook/manager-api';
import { Icons, IconButton } from '@storybook/components';
import { IconButton } from '@storybook/components';

import { GridIcon } from '@storybook/icons';
import { PARAM_KEY as BACKGROUNDS_PARAM_KEY } from '../constants';

export const GridSelector: FC = memo(function GridSelector() {
Expand All @@ -30,7 +31,7 @@ export const GridSelector: FC = memo(function GridSelector() {
})
}
>
<Icons icon="grid" />
<GridIcon />
</IconButton>
);
});
1 change: 1 addition & 0 deletions code/addons/interactions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
"@storybook/core-common": "workspace:*",
"@storybook/core-events": "workspace:*",
"@storybook/global": "^5.0.0",
"@storybook/icons": "^1.2.1",
"@storybook/instrumenter": "workspace:*",
"@storybook/manager-api": "workspace:*",
"@storybook/preview-api": "workspace:*",
Expand Down
5 changes: 3 additions & 2 deletions code/addons/interactions/src/components/Interaction.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import * as React from 'react';
import { IconButton, Icons, TooltipNote, WithTooltip } from '@storybook/components';
import { IconButton, TooltipNote, WithTooltip } from '@storybook/components';
import { type Call, CallStates, type ControlStates } from '@storybook/instrumenter';
import { styled, typography } from '@storybook/theming';
import { transparentize } from 'polished';

import { ListUnorderedIcon } from '@storybook/icons';
import { MatcherResult } from './MatcherResult';
import { MethodCall } from './MethodCall';
import { StatusIcon } from './StatusIcon';
Expand Down Expand Up @@ -174,7 +175,7 @@ export const Interaction = ({
tooltip={<Note note={`${isCollapsed ? 'Show' : 'Hide'} interactions`} />}
>
<StyledIconButton containsIcon onClick={toggleCollapsed}>
<Icons icon="listunordered" />
<ListUnorderedIcon />
</StyledIconButton>
</WithTooltip>
)}
Expand Down
18 changes: 12 additions & 6 deletions code/addons/interactions/src/components/Subnav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import React from 'react';
import {
Button,
IconButton,
Icons,
Separator,
P,
TooltipNote,
Expand All @@ -14,6 +13,13 @@ import type { Call, ControlStates } from '@storybook/instrumenter';
import { CallStates } from '@storybook/instrumenter';
import { styled } from '@storybook/theming';

import {
FastForwardIcon,
PlayBackIcon,
PlayNextIcon,
RewindIcon,
SyncIcon,
} from '@storybook/icons';
import { StatusBadge } from './StatusBadge';

import type { Controls } from './InteractionsPanel';
Expand Down Expand Up @@ -135,7 +141,7 @@ export const Subnav: React.FC<SubnavProps> = ({
onClick={controls.start}
disabled={!controlStates.start}
>
<Icons icon="rewind" />
<RewindIcon />
</RewindButton>
</WithTooltip>

Expand All @@ -146,7 +152,7 @@ export const Subnav: React.FC<SubnavProps> = ({
onClick={controls.back}
disabled={!controlStates.back}
>
<Icons icon="playback" />
<PlayBackIcon />
</StyledIconButton>
</WithTooltip>

Expand All @@ -157,7 +163,7 @@ export const Subnav: React.FC<SubnavProps> = ({
onClick={controls.next}
disabled={!controlStates.next}
>
<Icons icon="playnext" />
<PlayNextIcon />
</StyledIconButton>
</WithTooltip>

Expand All @@ -168,13 +174,13 @@ export const Subnav: React.FC<SubnavProps> = ({
onClick={controls.end}
disabled={!controlStates.end}
>
<Icons icon="fastforward" />
<FastForwardIcon />
</StyledIconButton>
</WithTooltip>

<WithTooltip trigger="hover" hasChrome={false} tooltip={<Note note="Rerun" />}>
<RerunButton aria-label="Rerun" containsIcon onClick={controls.rerun}>
<Icons icon="sync" />
<SyncIcon />
</RerunButton>
</WithTooltip>
</Group>
Expand Down
1 change: 1 addition & 0 deletions code/addons/measure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"@storybook/components": "workspace:*",
"@storybook/core-events": "workspace:*",
"@storybook/global": "^5.0.0",
"@storybook/icons": "^1.2.1",
"@storybook/manager-api": "workspace:*",
"@storybook/preview-api": "workspace:*",
"@storybook/types": "workspace:*",
Expand Down
5 changes: 3 additions & 2 deletions code/addons/measure/src/Tool.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useCallback, useEffect } from 'react';
import { useGlobals, useStorybookApi } from '@storybook/manager-api';
import { Icons, IconButton } from '@storybook/components';
import { IconButton } from '@storybook/components';
import { RulerIcon } from '@storybook/icons';
import { TOOL_ID, ADDON_ID } from './constants';

export const Tool = () => {
Expand Down Expand Up @@ -33,7 +34,7 @@ export const Tool = () => {
title="Enable measure"
onClick={toggleMeasure}
>
<Icons icon="ruler" />
<RulerIcon />
</IconButton>
);
};
1 change: 1 addition & 0 deletions code/addons/outline/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
"@storybook/components": "workspace:*",
"@storybook/core-events": "workspace:*",
"@storybook/global": "^5.0.0",
"@storybook/icons": "^1.2.1",
"@storybook/manager-api": "workspace:*",
"@storybook/preview-api": "workspace:*",
"@storybook/types": "workspace:*",
Expand Down
5 changes: 3 additions & 2 deletions code/addons/outline/src/OutlineSelector.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { memo, useCallback, useEffect } from 'react';
import { useGlobals, useStorybookApi } from '@storybook/manager-api';
import { Icons, IconButton } from '@storybook/components';
import { IconButton } from '@storybook/components';
import { OutlineIcon } from '@storybook/icons';
import { ADDON_ID, PARAM_KEY } from './constants';

export const OutlineSelector = memo(function OutlineSelector() {
Expand Down Expand Up @@ -34,7 +35,7 @@ export const OutlineSelector = memo(function OutlineSelector() {
title="Apply outlines to the preview"
onClick={toggleOutline}
>
<Icons icon="outline" />
<OutlineIcon />
</IconButton>
);
});
1 change: 1 addition & 0 deletions code/addons/themes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"@storybook/client-logger": "workspace:*",
"@storybook/components": "workspace:*",
"@storybook/core-events": "workspace:*",
"@storybook/icons": "^1.2.1",
"@storybook/manager-api": "workspace:*",
"@storybook/preview-api": "workspace:*",
"@storybook/theming": "workspace:*",
Expand Down
5 changes: 3 additions & 2 deletions code/addons/themes/src/theme-switcher.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React, { Fragment, useMemo } from 'react';
import { useAddonState, useChannel, useGlobals, useParameter } from '@storybook/manager-api';
import { styled } from '@storybook/theming';
import { Icons, IconButton, WithTooltip, TooltipLinkList } from '@storybook/components';
import { IconButton, WithTooltip, TooltipLinkList } from '@storybook/components';

import { PaintBrushIcon } from '@storybook/icons';
import type { ThemeAddonState, ThemeParameters } from './constants';
import {
PARAM_KEY,
Expand Down Expand Up @@ -74,7 +75,7 @@ export const ThemeSwitcher = () => {
}}
>
<IconButton key={THEME_SWITCHER_ID} active={!themeOverride} title="Theme">
<Icons icon="paintbrush" />
<PaintBrushIcon />
{label && <IconButtonLabel>{label}</IconButtonLabel>}
</IconButton>
</WithTooltip>
Expand Down
5 changes: 2 additions & 3 deletions code/addons/toolbars/src/components/ToolbarMenuListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export type ToolbarMenuListItemProps = {
} & ToolbarItem;

export const ToolbarMenuListItem = ({
left,
right,
title,
value,
Expand All @@ -25,12 +24,12 @@ export const ToolbarMenuListItem = ({
active: currentValue === value,
right,
title,
left,
icon,
onClick,
};

if (icon && !hideIcon) {
Item.left = Icon;
Item.icon = Icon;
}

return Item;
Expand Down
1 change: 1 addition & 0 deletions code/addons/viewport/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
"@storybook/components": "workspace:*",
"@storybook/core-events": "workspace:*",
"@storybook/global": "^5.0.0",
"@storybook/icons": "^1.2.1",
"@storybook/manager-api": "workspace:*",
"@storybook/preview-api": "workspace:*",
"@storybook/theming": "workspace:*",
Expand Down
7 changes: 4 additions & 3 deletions code/addons/viewport/src/Tool.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import memoize from 'memoizerific';

import { styled, Global, type Theme, withTheme } from '@storybook/theming';

import { Icons, IconButton, WithTooltip, TooltipLinkList } from '@storybook/components';
import { IconButton, WithTooltip, TooltipLinkList } from '@storybook/components';

import { useStorybookApi, useParameter, useAddonState } from '@storybook/manager-api';
import { GrowIcon, TransferIcon } from '@storybook/icons';
import { registerShortcuts } from './shortcuts';
import { PARAM_KEY, ADDON_ID } from './constants';
import { MINIMAL_VIEWPORTS } from './defaults';
Expand Down Expand Up @@ -186,7 +187,7 @@ export const ViewportTool: FC = memo(
setState({ ...state, selected: responsiveViewport.id });
}}
>
<Icons icon="grow" />
<GrowIcon />
{styles ? (
<IconButtonLabel>
{isRotated ? `${item.title} (L)` : `${item.title} (P)`}
Expand Down Expand Up @@ -217,7 +218,7 @@ export const ViewportTool: FC = memo(
setState({ ...state, isRotated: !isRotated });
}}
>
<Icons icon="transfer" />
<TransferIcon />
</IconButton>
<ActiveViewportLabel title="Viewport height">
{styles.height.replace('px', '')}
Expand Down
10 changes: 0 additions & 10 deletions code/ui/.storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,6 @@ export const decorators = [
) : (
<Story />
),
/**
* This decorator adds Symbols that the sidebar icons references.
* Any sidebar story that uses the icons must set the parameter withSymbols: true .
*/
(Story, { parameters: { withSymbols } }) => (
<>
{withSymbols && <Symbols icons={['folder', 'component', 'document', 'bookmarkhollow']} />}
<Story />
</>
),
cdedreuille marked this conversation as resolved.
Show resolved Hide resolved
/**
* This decorator renders the stories side-by-side, stacked or default based on the theme switcher in the toolbar
*/
Expand Down
1 change: 1 addition & 0 deletions code/ui/blocks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"@storybook/csf": "^0.1.0",
"@storybook/docs-tools": "workspace:*",
"@storybook/global": "^5.0.0",
"@storybook/icons": "^1.2.1",
"@storybook/manager-api": "workspace:*",
"@storybook/preview-api": "workspace:*",
"@storybook/theming": "workspace:*",
Expand Down
Loading