diff --git a/.storybook/image-snapshots/expected/components_ButtonV2_ButtonV2_Visual Tests Disabled.png b/.storybook/image-snapshots/expected/components_ButtonV2_ButtonV2_Visual Tests Disabled.png index b417f6630..3c2ef61d2 100644 Binary files a/.storybook/image-snapshots/expected/components_ButtonV2_ButtonV2_Visual Tests Disabled.png and b/.storybook/image-snapshots/expected/components_ButtonV2_ButtonV2_Visual Tests Disabled.png differ diff --git a/.storybook/image-snapshots/expected/components_Wizard_Playground.png b/.storybook/image-snapshots/expected/components_Wizard_Playground.png index 6930b0ce3..d62b20146 100644 Binary files a/.storybook/image-snapshots/expected/components_Wizard_Playground.png and b/.storybook/image-snapshots/expected/components_Wizard_Playground.png differ diff --git a/.storybook/image-snapshots/expected/components_Wizard_Two Step Wizard.png b/.storybook/image-snapshots/expected/components_Wizard_Two Step Wizard.png index 0006e4878..cd6d2f2fe 100644 Binary files a/.storybook/image-snapshots/expected/components_Wizard_Two Step Wizard.png and b/.storybook/image-snapshots/expected/components_Wizard_Two Step Wizard.png differ diff --git a/.storybook/image-snapshots/expected/components_Wizard_With Backwards Navigation.png b/.storybook/image-snapshots/expected/components_Wizard_With Backwards Navigation.png index 6930b0ce3..d62b20146 100644 Binary files a/.storybook/image-snapshots/expected/components_Wizard_With Backwards Navigation.png and b/.storybook/image-snapshots/expected/components_Wizard_With Backwards Navigation.png differ diff --git a/.storybook/image-snapshots/expected/components_Wizard_With Initial Step.png b/.storybook/image-snapshots/expected/components_Wizard_With Initial Step.png index 78128674e..f01ab6150 100644 Binary files a/.storybook/image-snapshots/expected/components_Wizard_With Initial Step.png and b/.storybook/image-snapshots/expected/components_Wizard_With Initial Step.png differ diff --git a/.storybook/image-snapshots/expected/components_modals_Modal_Size Lg.png b/.storybook/image-snapshots/expected/components_modals_Modal_Size Lg.png new file mode 100644 index 000000000..f9ed8fe35 Binary files /dev/null and b/.storybook/image-snapshots/expected/components_modals_Modal_Size Lg.png differ diff --git a/.storybook/image-snapshots/expected/components_modals_Modal_Size Md.png b/.storybook/image-snapshots/expected/components_modals_Modal_Size Md.png new file mode 100644 index 000000000..c0bb8647e Binary files /dev/null and b/.storybook/image-snapshots/expected/components_modals_Modal_Size Md.png differ diff --git a/.storybook/image-snapshots/expected/components_modals_Modal_Size Sm.png b/.storybook/image-snapshots/expected/components_modals_Modal_Size Sm.png new file mode 100644 index 000000000..f9dd13be5 Binary files /dev/null and b/.storybook/image-snapshots/expected/components_modals_Modal_Size Sm.png differ diff --git a/.storybook/image-snapshots/expected/components_modals_Modal_Size XL.png b/.storybook/image-snapshots/expected/components_modals_Modal_Size XL.png new file mode 100644 index 000000000..f9ed8fe35 Binary files /dev/null and b/.storybook/image-snapshots/expected/components_modals_Modal_Size XL.png differ diff --git a/.storybook/image-snapshots/expected/components_modals_Modal_Size Xs.png b/.storybook/image-snapshots/expected/components_modals_Modal_Size Xs.png new file mode 100644 index 000000000..c29358f7c Binary files /dev/null and b/.storybook/image-snapshots/expected/components_modals_Modal_Size Xs.png differ diff --git a/.storybook/image-snapshots/expected/components_modals_Modal_Without Footer.png b/.storybook/image-snapshots/expected/components_modals_Modal_Without Footer.png index 19bf10493..3c71888ff 100644 Binary files a/.storybook/image-snapshots/expected/components_modals_Modal_Without Footer.png and b/.storybook/image-snapshots/expected/components_modals_Modal_Without Footer.png differ diff --git a/src/components/ButtonV2/Button.tsx b/src/components/ButtonV2/Button.tsx index 0f42c4b7b..c1ae123d1 100644 --- a/src/components/ButtonV2/Button.tsx +++ b/src/components/ButtonV2/Button.tsx @@ -44,7 +44,7 @@ export const ButtonV2Plain = ( : size === 'sm' ? 'var(--sscds-space-2x)' : 'var(--sscds-space-3x)', - '--sscds-button-width': isExpanded ? '100%' : 'auto', + '--sscds-button-width': isExpanded ? '100%' : 'fit-content', '--sscds-button-width-min': typeof minWidth !== 'undefined' ? pxToRem(minWidth) : 'auto', '--sscds-button-height': getButtonSize(size), diff --git a/src/components/ElementLabel/ElementLabel.tsx b/src/components/ElementLabel/ElementLabel.tsx index e223b2d0d..a11f67087 100644 --- a/src/components/ElementLabel/ElementLabel.tsx +++ b/src/components/ElementLabel/ElementLabel.tsx @@ -1,9 +1,9 @@ -import { ComponentPropsWithoutRef, ReactNode } from 'react'; +import { ElementType, ReactNode, useMemo } from 'react'; import styled from 'styled-components'; -import { WithAsProp } from '../../types/utils.types'; +import { PolymorphicProps } from '../../types/utils.types'; -export type ElementLabelProps = WithAsProp<{ +type ElementLabelOwnProps = { children: ReactNode; /* Font size */ size?: 'sm' | 'md'; @@ -18,8 +18,11 @@ export type ElementLabelProps = WithAsProp<{ | 'link'; /* Font weight. When true ElementLabel will be rendered as bold */ isStrong?: boolean; -}> & - ComponentPropsWithoutRef<'span'>; +}; +export type ElementLabelProps = PolymorphicProps< + ElementLabelOwnProps, + Element +>; const ElementLabelRoot = styled.span` font-family: var(--sscds-font-family-body); @@ -30,24 +33,27 @@ const ElementLabelRoot = styled.span` `; ElementLabelRoot.displayName = 'ElementLabel.Root'; -function ElementLabel({ +function ElementLabel({ children, size = 'sm', color = 'default', isStrong = false, ...props -}: ElementLabelProps) { - const vars = { - '--sscds-elementlabel-font-size': `var(--sscds-font-size-elementlabel-${size})`, - '--sscds-elementlabel-font-weight': isStrong - ? 'var(--sscds-font-weight-elementlabel-strong)' - : 'var(--sscds-font-weight-elementlabel-default)', - '--sscds-elementlabel-color': - color === 'link' - ? 'var(--sscds-color-link-default)' - : `var(--sscds-color-text-${color})`, - ...props.style, - }; +}: ElementLabelProps) { + const vars = useMemo( + () => ({ + '--sscds-elementlabel-font-size': `var(--sscds-font-size-elementlabel-${size})`, + '--sscds-elementlabel-font-weight': isStrong + ? 'var(--sscds-font-weight-elementlabel-strong)' + : 'var(--sscds-font-weight-elementlabel-default)', + '--sscds-elementlabel-color': + color === 'link' + ? 'var(--sscds-color-link-default)' + : `var(--sscds-color-text-${color})`, + ...props.style, + }), + [color, isStrong, props.style, size], + ); return ( diff --git a/src/components/HexGrade/HexGrade.tsx b/src/components/HexGrade/HexGrade.tsx index 764892c92..3d749ac05 100644 --- a/src/components/HexGrade/HexGrade.tsx +++ b/src/components/HexGrade/HexGrade.tsx @@ -2,6 +2,7 @@ import { defaultTo, path, pipe } from 'ramda'; import { isNotUndefined } from 'ramda-adjunct'; import styled, { useTheme } from 'styled-components'; import cls from 'classnames'; +import { ComponentPropsWithoutRef } from 'react'; import { createMarginSpacing, getColor } from '../../utils'; import { HexGradeGrades, HexGradeVariants } from './HexGrade.enums'; @@ -59,7 +60,7 @@ const HexGrade = ({ margin, className, ...props -}: HexGradeProps) => { +}: HexGradeProps & ComponentPropsWithoutRef<'svg'>) => { const theme = useTheme(); const isCSVariant = variant === HexGradeVariants.cs; const gradeColorType = pipe( diff --git a/src/components/IconWrapper/IconWrapper.tsx b/src/components/IconWrapper/IconWrapper.tsx index bbc67d062..00f28d96f 100644 --- a/src/components/IconWrapper/IconWrapper.tsx +++ b/src/components/IconWrapper/IconWrapper.tsx @@ -1,4 +1,5 @@ import styled, { FlattenSimpleInterpolation, css } from 'styled-components'; +import { ComponentPropsWithoutRef } from 'react'; import { getRadii } from '../../utils'; import Icon from '../Icon/Icon'; @@ -18,13 +19,13 @@ const variances: Record< FlattenSimpleInterpolation > = { default: css` - box-shadow: inset 0 0 0 1px var(--slate-a6); + box-shadow: inset 0 0 0 1px var(--sscds-color-neutral-alpha-6); `, strong: css` background-color: var(--sscds-color-info-100); `, subtle: css` - background-color: var(--slate-a3); + background-color: var(--sscds-color-neutral-alpha-3); `, }; @@ -44,7 +45,11 @@ export default function IconWrapper({ size = 'md', variant = 'default', ...rest -}: IconWrapperProps) { +}: IconWrapperProps & + Omit< + ComponentPropsWithoutRef, + 'color' | 'size' | 'hasFixedSize' | 'hasFixedWidth' | 'name' | 'type' + >) { return ( ; + +export default meta; + +type Story = StoryObj; function Footer() { return ( - + ); } -export const Playground: StoryFn = (args) => { - const [isShown, setIsShown] = useState(false); +export const Playground: Story = { + render: function Render(args) { + const [isShown, setIsShown] = useState(false); - return ( - - - - {isShown && ( - } - title="Title" - onClose={() => setIsShown(false)} - {...args} - > -
This is a placeholder
- - You can replace this with a local component. You can also just - override the text, but{' '} - keep in mind that you might - lose content that way in case we happend to change the underlying - component. Lorem ipsum dolor sit amet, consectetur adipiscing - elit, sed do eiusmod tempor incididunt ut labore et dolore magna - aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco - laboris nisi ut aliquip ex ea commodo consequat. - -
- )} -
-
- ); + return ( + + + + {isShown && setIsShown(false)} />} + + + ); + }, + args: { + footer: