From 3bbea20b91c172f4ab64c319a6f8be0c7de789c0 Mon Sep 17 00:00:00 2001 From: Norbert de Langen Date: Mon, 21 Aug 2023 16:04:04 +0200 Subject: [PATCH 1/9] Revert "Merge pull request #23680 from storybookjs/charles-icons-updates" This reverts commit 3627472cc2a49ebf2814b280f39840aeaea82caa, reversing changes made to 998926f115259ffe4e9afe03b25daf34556e4756. --- .../a11y/src/components/VisionSimulator.tsx | 5 +-- .../src/containers/BackgroundSelector.tsx | 5 +-- .../src/containers/GridSelector.tsx | 5 +-- .../src/components/Interaction.tsx | 5 +-- .../interactions/src/components/Subnav.tsx | 12 +++--- code/addons/measure/src/Tool.tsx | 5 +-- code/addons/outline/src/OutlineSelector.tsx | 5 +-- code/addons/themes/src/theme-switcher.tsx | 6 +-- code/addons/viewport/src/Tool.tsx | 8 ++-- code/ui/blocks/src/blocks/mdx.tsx | 5 +-- .../src/components/ArgsTable/ArgsTable.tsx | 6 +-- code/ui/blocks/src/components/Toolbar.tsx | 9 ++--- code/ui/blocks/src/controls/Object.tsx | 3 +- .../ui/blocks/src/controls/options/Select.tsx | 31 ++++++++------- code/ui/components/package.json | 2 +- code/ui/components/src/new/Icon/Icon.mdx | 38 ------------------- .../notifications/NotificationItem.tsx | 3 +- .../src/components/panel/panel.stories.tsx | 5 +-- .../ui/manager/src/components/panel/panel.tsx | 7 ++-- .../src/components/preview/toolbar.tsx | 5 +-- .../src/components/preview/tools/addons.tsx | 5 +-- .../src/components/preview/tools/copy.tsx | 5 +-- .../src/components/preview/tools/eject.tsx | 5 +-- .../src/components/preview/tools/menu.tsx | 5 +-- .../src/components/preview/tools/remount.tsx | 5 +-- .../src/components/preview/tools/zoom.tsx | 9 ++--- .../manager/src/components/sidebar/Menu.tsx | 11 +++--- .../src/components/sidebar/RefBlocks.tsx | 9 ++--- .../src/components/sidebar/RefIndicator.tsx | 7 ++-- .../manager/src/components/sidebar/Tree.tsx | 3 +- code/ui/manager/src/containers/menu.tsx | 11 +++--- code/ui/manager/src/settings/index.tsx | 5 +-- code/ui/manager/src/settings/whats_new.tsx | 9 ++--- docs/addons/writing-addons.md | 5 +-- ...addon-consume-and-update-globaltype.js.mdx | 5 +-- .../storybook-addon-tool-initial-setup.ts.mdx | 5 +-- .../storybook-addon-toolbar-example.js.mdx | 5 +-- ...don-toolkit-toolbar-example.toolbar.ts.mdx | 5 +-- .../storybook-addons-api-getchannel.js.mdx | 5 +-- .../storybook-addons-api-useaddonstate.js.mdx | 4 +- .../common/storybook-addons-api-useapi.js.mdx | 6 +-- 41 files changed, 114 insertions(+), 185 deletions(-) delete mode 100644 code/ui/components/src/new/Icon/Icon.mdx diff --git a/code/addons/a11y/src/components/VisionSimulator.tsx b/code/addons/a11y/src/components/VisionSimulator.tsx index b4375689736..b66f8eef297 100644 --- a/code/addons/a11y/src/components/VisionSimulator.tsx +++ b/code/addons/a11y/src/components/VisionSimulator.tsx @@ -1,8 +1,7 @@ import type { ReactNode } from 'react'; import React, { useState } from 'react'; import { Global, styled } from '@storybook/theming'; -import { IconButton, WithTooltip, TooltipLinkList } from '@storybook/components'; -import { Icon } from '@storybook/components/experimental'; +import { Icons, IconButton, WithTooltip, TooltipLinkList } from '@storybook/components'; import { Filters } from './ColorFilters'; @@ -145,7 +144,7 @@ export const VisionSimulator = () => { onDoubleClick={() => setFilter(null)} > - + diff --git a/code/addons/backgrounds/src/containers/BackgroundSelector.tsx b/code/addons/backgrounds/src/containers/BackgroundSelector.tsx index d44d7f58ab6..078a2752a5e 100644 --- a/code/addons/backgrounds/src/containers/BackgroundSelector.tsx +++ b/code/addons/backgrounds/src/containers/BackgroundSelector.tsx @@ -4,8 +4,7 @@ import memoize from 'memoizerific'; import { useParameter, useGlobals } from '@storybook/manager-api'; import { logger } from '@storybook/client-logger'; -import { IconButton, WithTooltip, TooltipLinkList } from '@storybook/components'; -import { Icon } from '@storybook/components/experimental'; +import { Icons, IconButton, WithTooltip, TooltipLinkList } from '@storybook/components'; import { PARAM_KEY as BACKGROUNDS_PARAM_KEY } from '../constants'; import { ColorIcon } from '../components/ColorIcon'; @@ -141,7 +140,7 @@ export const BackgroundSelector: FC = memo(function BackgroundSelector() { title="Change the background of the preview" active={selectedBackgroundColor !== 'transparent' || isTooltipVisible} > - + diff --git a/code/addons/backgrounds/src/containers/GridSelector.tsx b/code/addons/backgrounds/src/containers/GridSelector.tsx index b860209ae0a..80d6477884b 100644 --- a/code/addons/backgrounds/src/containers/GridSelector.tsx +++ b/code/addons/backgrounds/src/containers/GridSelector.tsx @@ -2,8 +2,7 @@ import type { FC } from 'react'; import React, { memo } from 'react'; import { useGlobals, useParameter } from '@storybook/manager-api'; -import { IconButton } from '@storybook/components'; -import { Icon } from '@storybook/components/experimental'; +import { Icons, IconButton } from '@storybook/components'; import { PARAM_KEY as BACKGROUNDS_PARAM_KEY } from '../constants'; @@ -31,7 +30,7 @@ export const GridSelector: FC = memo(function GridSelector() { }) } > - + ); }); diff --git a/code/addons/interactions/src/components/Interaction.tsx b/code/addons/interactions/src/components/Interaction.tsx index c0bf532d907..bacaea0fe35 100644 --- a/code/addons/interactions/src/components/Interaction.tsx +++ b/code/addons/interactions/src/components/Interaction.tsx @@ -1,6 +1,5 @@ import * as React from 'react'; -import { IconButton, TooltipNote, WithTooltip } from '@storybook/components'; -import { Icon } from '@storybook/components/experimental'; +import { IconButton, Icons, TooltipNote, WithTooltip } from '@storybook/components'; import { type Call, CallStates, type ControlStates } from '@storybook/instrumenter'; import { styled, typography } from '@storybook/theming'; import { transparentize } from 'polished'; @@ -175,7 +174,7 @@ export const Interaction = ({ tooltip={} > - + )} diff --git a/code/addons/interactions/src/components/Subnav.tsx b/code/addons/interactions/src/components/Subnav.tsx index de78bf2c94b..3d2e5c41d1a 100644 --- a/code/addons/interactions/src/components/Subnav.tsx +++ b/code/addons/interactions/src/components/Subnav.tsx @@ -3,13 +3,13 @@ import React from 'react'; import { Button, IconButton, + Icons, Separator, P, TooltipNote, WithTooltip, Bar, } from '@storybook/components'; -import { Icon } from '@storybook/components/experimental'; import type { Call, ControlStates } from '@storybook/instrumenter'; import { CallStates } from '@storybook/instrumenter'; import { styled } from '@storybook/theming'; @@ -135,7 +135,7 @@ export const Subnav: React.FC = ({ onClick={controls.start} disabled={!controlStates.start} > - + @@ -146,7 +146,7 @@ export const Subnav: React.FC = ({ onClick={controls.back} disabled={!controlStates.back} > - + @@ -157,7 +157,7 @@ export const Subnav: React.FC = ({ onClick={controls.next} disabled={!controlStates.next} > - + @@ -168,13 +168,13 @@ export const Subnav: React.FC = ({ onClick={controls.end} disabled={!controlStates.end} > - + }> - + diff --git a/code/addons/measure/src/Tool.tsx b/code/addons/measure/src/Tool.tsx index bb78447f852..2e68078aa06 100644 --- a/code/addons/measure/src/Tool.tsx +++ b/code/addons/measure/src/Tool.tsx @@ -1,7 +1,6 @@ import React, { useCallback, useEffect } from 'react'; import { useGlobals, useStorybookApi } from '@storybook/manager-api'; -import { IconButton } from '@storybook/components'; -import { Icon } from '@storybook/components/experimental'; +import { Icons, IconButton } from '@storybook/components'; import { TOOL_ID, ADDON_ID } from './constants'; export const Tool = () => { @@ -34,7 +33,7 @@ export const Tool = () => { title="Enable measure" onClick={toggleMeasure} > - + ); }; diff --git a/code/addons/outline/src/OutlineSelector.tsx b/code/addons/outline/src/OutlineSelector.tsx index 63c826044ef..93bdf321df0 100644 --- a/code/addons/outline/src/OutlineSelector.tsx +++ b/code/addons/outline/src/OutlineSelector.tsx @@ -1,7 +1,6 @@ import React, { memo, useCallback, useEffect } from 'react'; import { useGlobals, useStorybookApi } from '@storybook/manager-api'; -import { IconButton } from '@storybook/components'; -import { Icon } from '@storybook/components/experimental'; +import { Icons, IconButton } from '@storybook/components'; import { ADDON_ID, PARAM_KEY } from './constants'; export const OutlineSelector = memo(function OutlineSelector() { @@ -35,7 +34,7 @@ export const OutlineSelector = memo(function OutlineSelector() { title="Apply outlines to the preview" onClick={toggleOutline} > - + ); }); diff --git a/code/addons/themes/src/theme-switcher.tsx b/code/addons/themes/src/theme-switcher.tsx index b950f780c1d..3658a3ef78c 100644 --- a/code/addons/themes/src/theme-switcher.tsx +++ b/code/addons/themes/src/theme-switcher.tsx @@ -1,8 +1,8 @@ import React, { Fragment, useMemo } from 'react'; import { useAddonState, useChannel, useGlobals, useParameter } from '@storybook/manager-api'; import { styled } from '@storybook/theming'; -import { IconButton, WithTooltip, TooltipLinkList } from '@storybook/components'; -import { Icon } from '@storybook/components/experimental'; +import { Icons, IconButton, WithTooltip, TooltipLinkList } from '@storybook/components'; + import type { ThemeAddonState, ThemeParameters } from './constants'; import { PARAM_KEY, @@ -74,7 +74,7 @@ export const ThemeSwitcher = () => { }} > - + {label && {label}} diff --git a/code/addons/viewport/src/Tool.tsx b/code/addons/viewport/src/Tool.tsx index e62ce3543eb..df65988e509 100644 --- a/code/addons/viewport/src/Tool.tsx +++ b/code/addons/viewport/src/Tool.tsx @@ -4,8 +4,8 @@ import memoize from 'memoizerific'; import { styled, Global, type Theme, withTheme } from '@storybook/theming'; -import { IconButton, WithTooltip, TooltipLinkList } from '@storybook/components'; -import { Icon } from '@storybook/components/experimental'; +import { Icons, IconButton, WithTooltip, TooltipLinkList } from '@storybook/components'; + import { useStorybookApi, useParameter, useAddonState } from '@storybook/manager-api'; import { registerShortcuts } from './shortcuts'; import { PARAM_KEY, ADDON_ID } from './constants'; @@ -188,7 +188,7 @@ export const ViewportTool: FC = memo( setState({ ...state, selected: responsiveViewport.id }); }} > - + {styles ? ( {isRotated ? `${item.title} (L)` : `${item.title} (P)`} @@ -234,7 +234,7 @@ export const ViewportTool: FC = memo( setState({ ...state, isRotated: !isRotated }); }} > - + {styles.height.replace('px', '')} diff --git a/code/ui/blocks/src/blocks/mdx.tsx b/code/ui/blocks/src/blocks/mdx.tsx index eae97528ecb..3c1c69f87fc 100644 --- a/code/ui/blocks/src/blocks/mdx.tsx +++ b/code/ui/blocks/src/blocks/mdx.tsx @@ -1,8 +1,7 @@ import type { FC, MouseEvent, PropsWithChildren, SyntheticEvent } from 'react'; import React, { useContext } from 'react'; import { NAVIGATE_URL } from '@storybook/core-events'; -import { Code, components, nameSpaceClassNames } from '@storybook/components'; -import { Icon } from '@storybook/components/experimental'; +import { Code, components, Icons, nameSpaceClassNames } from '@storybook/components'; import { global } from '@storybook/global'; import { styled } from '@storybook/theming'; import { Source } from '../components'; @@ -191,7 +190,7 @@ const HeaderWithOcticonAnchor: FC - + {children} diff --git a/code/ui/blocks/src/components/ArgsTable/ArgsTable.tsx b/code/ui/blocks/src/components/ArgsTable/ArgsTable.tsx index a528c292e25..74c849f9597 100644 --- a/code/ui/blocks/src/components/ArgsTable/ArgsTable.tsx +++ b/code/ui/blocks/src/components/ArgsTable/ArgsTable.tsx @@ -5,8 +5,8 @@ import { styled } from '@storybook/theming'; import { transparentize } from 'polished'; import { includeConditionalArg } from '@storybook/csf'; import { once } from '@storybook/client-logger'; -import { IconButton, ResetWrapper } from '@storybook/components'; -import { Icon, Link } from '@storybook/components/experimental'; +import { IconButton, Icons, ResetWrapper } from '@storybook/components'; +import { Link } from '@storybook/components/experimental'; import { ArgRow } from './ArgRow'; import { SectionRow } from './SectionRow'; @@ -380,7 +380,7 @@ export const ArgsTable: FC = (props) => { Control{' '} {!isLoading && resetArgs && ( resetArgs()} title="Reset controls"> - + )} diff --git a/code/ui/blocks/src/components/Toolbar.tsx b/code/ui/blocks/src/components/Toolbar.tsx index b454dce0478..392cd7a8a76 100644 --- a/code/ui/blocks/src/components/Toolbar.tsx +++ b/code/ui/blocks/src/components/Toolbar.tsx @@ -1,8 +1,7 @@ import type { FC, MouseEvent } from 'react'; import React, { Fragment } from 'react'; import { styled } from '@storybook/theming'; -import { FlexBar, IconButton, IconButtonSkeleton } from '@storybook/components'; -import { Icon } from '@storybook/components/experimental'; +import { FlexBar, Icons, IconButton, IconButtonSkeleton } from '@storybook/components'; interface ZoomProps { zoom: (val: number) => void; @@ -34,7 +33,7 @@ const Zoom: FC = ({ zoom, resetZoom }) => ( }} title="Zoom in" > - + = ({ zoom, resetZoom }) => ( }} title="Zoom out" > - + = ({ zoom, resetZoom }) => ( }} title="Reset zoom" > - + ); diff --git a/code/ui/blocks/src/controls/Object.tsx b/code/ui/blocks/src/controls/Object.tsx index 8cd8c8bb7be..11c51f8f639 100644 --- a/code/ui/blocks/src/controls/Object.tsx +++ b/code/ui/blocks/src/controls/Object.tsx @@ -4,7 +4,6 @@ import type { ComponentProps, SyntheticEvent, FC, FocusEvent } from 'react'; import React, { useCallback, useMemo, useState, useEffect, useRef } from 'react'; import { styled, useTheme, type Theme } from '@storybook/theming'; import { Form, Icons, type IconsProps, IconButton } from '@storybook/components'; -import { Icon } from '@storybook/components/experimental'; import { JsonTree, getObjectType } from './react-editable-json-tree'; import { getControlId, getControlSetterButtonId } from './helpers'; import type { ControlProps, ObjectValue, ObjectConfig } from './types'; @@ -295,7 +294,7 @@ export const ObjectControl: FC = ({ name, value, onChange }) => { setShowRaw((v) => !v); }} > - {showRaw ? : } + RAW )} diff --git a/code/ui/blocks/src/controls/options/Select.tsx b/code/ui/blocks/src/controls/options/Select.tsx index 43c47cfc340..f033c131bd7 100644 --- a/code/ui/blocks/src/controls/options/Select.tsx +++ b/code/ui/blocks/src/controls/options/Select.tsx @@ -3,7 +3,8 @@ import React from 'react'; import { styled } from '@storybook/theming'; import type { CSSObject } from '@storybook/theming'; import { logger } from '@storybook/client-logger'; -import { Icon } from '@storybook/components/experimental'; +import { Icons } from '@storybook/components'; + import type { ControlProps, OptionsSelection, NormalizedOptionsConfig } from '../types'; import { selectedKey, selectedKeys, selectedValues } from './helpers'; @@ -72,17 +73,21 @@ const SelectWrapper = styled.span(({ theme }) => ({ position: 'relative', verticalAlign: 'top', width: '100%', -})); -const SelectChevronDown = styled.div(({ theme }) => ({ - position: 'absolute', - zIndex: 1, - pointerEvents: 'none', - height: '12px', - marginTop: '-6px', - right: '12px', - top: '50%', - color: theme.textMutedColor, + svg: { + position: 'absolute', + zIndex: 1, + pointerEvents: 'none', + height: '12px', + marginTop: '-6px', + right: '12px', + top: '50%', + fill: theme.textMutedColor, + + path: { + fill: theme.textMutedColor, + }, + }, })); type SelectConfig = NormalizedOptionsConfig & { isMulti: boolean }; @@ -99,9 +104,7 @@ const SingleSelect: FC = ({ name, value, options, onChange }) => { return ( - - - +