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

Plasma 4143 #1668

Draft
wants to merge 4 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
node_modules/
.idea/
.nx/
tsconfig.tsbuildinfo
tsconfig.es.tsbuildinfo
cypress/snapshots/**/__diff_output__
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions packages/plasma-asdk/api/plasma-asdk.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ black: PolymorphicClassName;
white: PolymorphicClassName;
};
size: {
xl: PolymorphicClassName;
xlr: PolymorphicClassName;
l: PolymorphicClassName;
lr: PolymorphicClassName;
m: PolymorphicClassName;
Expand Down
36 changes: 36 additions & 0 deletions packages/plasma-asdk/src/components/Button/Button.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,42 @@ export const config = {
`,
},
size: {
xl: css`
${buttonTokens.buttonHeight}: 4rem;
${buttonTokens.buttonWidth}: 12.5rem;
${buttonTokens.buttonPadding}: 1.75rem;
${buttonTokens.buttonRadius}: 1rem;
${buttonTokens.buttonFontFamily}: var(--plasma-typo-body-l-font-family);
${buttonTokens.buttonFontSize}: var(--plasma-typo-body-l-font-size);
${buttonTokens.buttonFontStyle}: var(--plasma-typo-body-l-font-style);
${buttonTokens.buttonFontWeight}: var(--plasma-typo-body-l-bold-font-weight);
${buttonTokens.buttonLetterSpacing}: var(--plasma-typo-body-l-letter-spacing);
${buttonTokens.buttonLineHeight}: var(--plasma-typo-body-l-line-height);

${buttonTokens.buttonSpinnerSize}: 1.5rem;
${buttonTokens.buttonSpinnerColor}: inherit;

${buttonTokens.buttonLeftContentMargin}: 0 0.625rem 0 -0.125rem;
${buttonTokens.buttonRightContentMargin}: 0 -0.125rem 0 0.625rem;
${buttonTokens.buttonValueMargin}: 0 0 0 0.25rem;
`,
xlr: css`
${buttonTokens.buttonHeight}: 4rem;
${buttonTokens.buttonWidth}: 12.5rem;
${buttonTokens.buttonFontFamily}: var(--plasma-typo-body-l-font-family);
${buttonTokens.buttonFontSize}: var(--plasma-typo-body-l-font-size);
${buttonTokens.buttonFontStyle}: var(--plasma-typo-body-l-font-style);
${buttonTokens.buttonFontWeight}: var(--plasma-typo-body-l-bold-font-weight);
${buttonTokens.buttonLetterSpacing}: var(--plasma-typo-body-l-letter-spacing);
${buttonTokens.buttonLineHeight}: var(--plasma-typo-body-l-line-height);

${buttonTokens.buttonSpinnerSize}: 1.5rem;
${buttonTokens.buttonSpinnerColor}: inherit;

${buttonTokens.buttonLeftContentMargin}: 0 0.625rem 0 0;
${buttonTokens.buttonRightContentMargin}: 0 0 0 0.625rem;
${buttonTokens.buttonValueMargin}: 0 0 0 0.25rem;
`,
l: css`
${buttonTokens.buttonHeight}: 3.5rem;
${buttonTokens.buttonWidth}: 12.5rem;
Expand Down
19 changes: 14 additions & 5 deletions packages/plasma-asdk/src/components/Button/Button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Button } from '.';
type ButtonProps = ComponentProps<typeof Button>;

const views = ['accent', 'default', 'secondary', 'success', 'warning', 'critical', 'clear', 'dark', 'black', 'white'];
const sizes = ['l', 'm', 's', 'xs', 'xxs'];
const sizes = ['xl', 'l', 'm', 's', 'xs', 'xxs'];
const stretchingValues = ['auto', 'filled', 'fixed'];
const pinValues = [
'',
Expand Down Expand Up @@ -95,6 +95,8 @@ const meta: Meta<ButtonProps> = {
'stretch',
'as',
'forwardedAs',
'pin',
'focused',
]),
},
};
Expand All @@ -111,8 +113,10 @@ const StoryDefault = ({ enableContentLeft, enableContentRight, size, ...rest }:

return (
<Button
contentLeft={enableContentLeft ? <IconMic size={iconSize} color="inherit" /> : undefined}
contentRight={enableContentRight ? <IconMic size={iconSize} color="inherit" /> : undefined}
contentLeft={enableContentLeft && size !== 'xxs' ? <IconMic size={iconSize} color="inherit" /> : undefined}
contentRight={
enableContentRight && size !== 'xxs' ? <IconMic size={iconSize} color="inherit" /> : undefined
}
size={size}
onClick={onClick}
onFocus={onFocus}
Expand All @@ -138,6 +142,9 @@ export const WithValue: StoryObj<StoryPropsDefault> = {
args: {
enableContentLeft: false,
},
argTypes: {
...disableProps(['enableContentRight']),
},
render: (args) => <StoryDefault {...args} />,
};

Expand Down Expand Up @@ -195,8 +202,10 @@ const StoryLoading = ({
<Button
autoFocus
onClick={onClickHandle}
contentLeft={enableContentLeft ? <IconMic size={iconSize} color="inherit" /> : undefined}
contentRight={enableContentRight ? <IconMic size={iconSize} color="inherit" /> : undefined}
contentLeft={enableContentLeft && size !== 'xxs' ? <IconMic size={iconSize} color="inherit" /> : undefined}
contentRight={
enableContentRight && size !== 'xxs' ? <IconMic size={iconSize} color="inherit" /> : undefined
}
isLoading={loading}
size={size}
loader={<div>Loading - {count}</div>}
Expand Down
6 changes: 6 additions & 0 deletions packages/plasma-b2c/api/plasma-b2c.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1209,6 +1209,8 @@ black: PolymorphicClassName;
white: PolymorphicClassName;
};
size: {
xl: PolymorphicClassName;
xlr: PolymorphicClassName;
l: PolymorphicClassName;
lr: PolymorphicClassName;
m: PolymorphicClassName;
Expand Down Expand Up @@ -1306,6 +1308,8 @@ black: PolymorphicClassName;
white: PolymorphicClassName;
};
size: {
xl: PolymorphicClassName;
xlr: PolymorphicClassName;
l: PolymorphicClassName;
lr: PolymorphicClassName;
m: PolymorphicClassName;
Expand Down Expand Up @@ -2151,6 +2155,8 @@ black: PolymorphicClassName;
white: PolymorphicClassName;
};
size: {
xl: PolymorphicClassName;
xlr: PolymorphicClassName;
l: PolymorphicClassName;
lr: PolymorphicClassName;
m: PolymorphicClassName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ describe('plasma-b2c: Button', () => {
it('_size', () => {
mount(
<CypressTestDecorator>
<Button text="Button_size_xl" size="xl" contentLeft={<Icon />} />
<PadMe />
<Button text="Button_size_l" size="l" contentLeft={<Icon />} />
<PadMe />
<Button text="Button_size_m" size="m" contentLeft={<Icon />} />
Expand Down
36 changes: 36 additions & 0 deletions packages/plasma-b2c/src/components/Button/Button.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,42 @@ export const config = {
`,
},
size: {
xl: css`
${buttonTokens.buttonHeight}: 4rem;
${buttonTokens.buttonWidth}: 12.5rem;
${buttonTokens.buttonPadding}: 1.75rem;
${buttonTokens.buttonRadius}: 1rem;
${buttonTokens.buttonFontFamily}: var(--plasma-typo-body-l-font-family);
${buttonTokens.buttonFontSize}: var(--plasma-typo-body-l-font-size);
${buttonTokens.buttonFontStyle}: var(--plasma-typo-body-l-font-style);
${buttonTokens.buttonFontWeight}: var(--plasma-typo-body-l-bold-font-weight);
${buttonTokens.buttonLetterSpacing}: var(--plasma-typo-body-l-letter-spacing);
${buttonTokens.buttonLineHeight}: var(--plasma-typo-body-l-line-height);

${buttonTokens.buttonSpinnerSize}: 1.5rem;
${buttonTokens.buttonSpinnerColor}: inherit;

${buttonTokens.buttonLeftContentMargin}: 0 0.625rem 0 -0.125rem;
${buttonTokens.buttonRightContentMargin}: 0 -0.125rem 0 0.625rem;
${buttonTokens.buttonValueMargin}: 0 0 0 0.25rem;
`,
xlr: css`
${buttonTokens.buttonHeight}: 4rem;
${buttonTokens.buttonWidth}: 12.5rem;
${buttonTokens.buttonFontFamily}: var(--plasma-typo-body-l-font-family);
${buttonTokens.buttonFontSize}: var(--plasma-typo-body-l-font-size);
${buttonTokens.buttonFontStyle}: var(--plasma-typo-body-l-font-style);
${buttonTokens.buttonFontWeight}: var(--plasma-typo-body-l-bold-font-weight);
${buttonTokens.buttonLetterSpacing}: var(--plasma-typo-body-l-letter-spacing);
${buttonTokens.buttonLineHeight}: var(--plasma-typo-body-l-line-height);

${buttonTokens.buttonSpinnerSize}: 1.5rem;
${buttonTokens.buttonSpinnerColor}: inherit;

${buttonTokens.buttonLeftContentMargin}: 0 0.625rem 0 0;
${buttonTokens.buttonRightContentMargin}: 0 0 0 0.625rem;
${buttonTokens.buttonValueMargin}: 0 0 0 0.25rem;
`,
l: css`
${buttonTokens.buttonHeight}: 3.5rem;
${buttonTokens.buttonWidth}: 12.5rem;
Expand Down
19 changes: 14 additions & 5 deletions packages/plasma-b2c/src/components/Button/Button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Button } from '.';
type ButtonProps = ComponentProps<typeof Button>;

const views = ['default', 'accent', 'success', 'warning', 'critical', 'dark', 'light'];
const sizes = ['l', 'm', 's', 'xs', 'xxs'];
const sizes = ['xl', 'l', 'm', 's', 'xs', 'xxs'];
const stretchingValues = ['auto', 'filled', 'fixed'];
const pinValues = [
'',
Expand Down Expand Up @@ -95,6 +95,8 @@ const meta: Meta<ButtonProps> = {
'stretch',
'as',
'forwardedAs',
'pin',
'focused',
]),
},
};
Expand All @@ -111,8 +113,10 @@ const StoryDefault = ({ enableContentLeft, enableContentRight, size, ...rest }:

return (
<Button
contentLeft={enableContentLeft ? <IconMic size={iconSize} color="inherit" /> : undefined}
contentRight={enableContentRight ? <IconMic size={iconSize} color="inherit" /> : undefined}
contentLeft={enableContentLeft && size !== 'xxs' ? <IconMic size={iconSize} color="inherit" /> : undefined}
contentRight={
enableContentRight && size !== 'xxs' ? <IconMic size={iconSize} color="inherit" /> : undefined
}
size={size}
onClick={onClick}
onFocus={onFocus}
Expand All @@ -138,6 +142,9 @@ export const WithValue: StoryObj<StoryPropsDefault> = {
args: {
enableContentLeft: false,
},
argTypes: {
...disableProps(['enableContentRight']),
},
render: (args) => <StoryDefault {...args} />,
};

Expand Down Expand Up @@ -195,8 +202,10 @@ const StoryLoading = ({
<Button
autoFocus
onClick={onClickHandle}
contentLeft={enableContentLeft ? <IconMic size={iconSize} color="inherit" /> : undefined}
contentRight={enableContentRight ? <IconMic size={iconSize} color="inherit" /> : undefined}
contentLeft={enableContentLeft && size !== 'xxs' ? <IconMic size={iconSize} color="inherit" /> : undefined}
contentRight={
enableContentRight && size !== 'xxs' ? <IconMic size={iconSize} color="inherit" /> : undefined
}
isLoading={loading}
size={size}
loader={<div>Loading - {count}</div>}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,33 @@ export const config = {
`,
},
size: {
xl: css`
${buttonGroupTokens.buttonDefaultRadius}: 1rem;
${buttonGroupTokens.buttonSegmentedRadius}: 0.5rem;
${buttonGroupTokens.buttonSideRadius}: 1rem;

${buttonGroupTokens.buttonHeight}: 4rem;
${buttonGroupTokens.buttonPadding}: 1.75rem;
${buttonGroupTokens.buttonFontFamily}: var(--plasma-typo-body-l-font-family);
${buttonGroupTokens.buttonFontSize}: var(--plasma-typo-body-l-font-size);
${buttonGroupTokens.buttonFontStyle}: var(--plasma-typo-body-l-font-style);
${buttonGroupTokens.buttonFontWeight}: var(--plasma-typo-body-l-bold-font-weight);
${buttonGroupTokens.buttonLetterSpacing}: var(--plasma-typo-body-l-letter-spacing);
${buttonGroupTokens.buttonLineHeight}: var(--plasma-typo-body-l-line-height);
`,
xlr: css`
${buttonGroupTokens.buttonDefaultRadius}: 1rem;
${buttonGroupTokens.buttonSegmentedRadius}: 0.5rem;
${buttonGroupTokens.buttonSideRadius}: 1rem;

${buttonGroupTokens.buttonHeight}: 4rem;
${buttonGroupTokens.buttonFontFamily}: var(--plasma-typo-body-l-font-family);
${buttonGroupTokens.buttonFontSize}: var(--plasma-typo-body-l-font-size);
${buttonGroupTokens.buttonFontStyle}: var(--plasma-typo-body-l-font-style);
${buttonGroupTokens.buttonFontWeight}: var(--plasma-typo-body-l-bold-font-weight);
${buttonGroupTokens.buttonLetterSpacing}: var(--plasma-typo-body-l-letter-spacing);
${buttonGroupTokens.buttonLineHeight}: var(--plasma-typo-body-l-line-height);
`,
l: css`
${buttonGroupTokens.buttonDefaultRadius}: 0.875rem;
${buttonGroupTokens.buttonSegmentedRadius}: 0.375rem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type StoryProps = ComponentProps<typeof ButtonGroup> & { itemsCount?: number };
type Story = StoryObj<StoryProps>;

const views = ['accent', 'default', 'secondary', 'success', 'warning', 'critical', 'clear'];
const sizes = ['l', 'm', 's', 'xs', 'xxs'];
const sizes = ['xl', 'l', 'm', 's', 'xs', 'xxs'];
const orientationValues = ['horizontal', 'vertical'];
const gapValues = ['none', 'dense', 'wide'];
const shapeValues = ['segmented', 'default'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,34 @@ export const config = {
`,
},
size: {
xl: css`
${iconButtonTokens.iconButtonHeight}: 4rem;
${iconButtonTokens.iconButtonWidth}: 4rem;
${iconButtonTokens.iconButtonPadding}: 1.75rem;
${iconButtonTokens.iconButtonRadius}: 1rem;
${iconButtonTokens.iconButtonFontFamily}: var(--plasma-typo-body-l-font-family);
${iconButtonTokens.iconButtonFontSize}: var(--plasma-typo-body-l-font-size);
${iconButtonTokens.iconButtonFontStyle}: var(--plasma-typo-body-l-font-style);
${iconButtonTokens.iconButtonFontWeight}: var(--plasma-typo-body-l-bold-font-weight);
${iconButtonTokens.iconButtonLetterSpacing}: var(--plasma-typo-body-l-letter-spacing);
${iconButtonTokens.iconButtonLineHeight}: var(--plasma-typo-body-l-line-height);

${iconButtonTokens.iconButtonSpinnerSize}: 1.5rem;
${iconButtonTokens.iconButtonSpinnerColor}: inherit;
`,
xlr: css`
${iconButtonTokens.iconButtonHeight}: 4rem;
${iconButtonTokens.iconButtonWidth}: 4rem;
${iconButtonTokens.iconButtonFontFamily}: var(--plasma-typo-body-l-font-family);
${iconButtonTokens.iconButtonFontSize}: var(--plasma-typo-body-l-font-size);
${iconButtonTokens.iconButtonFontStyle}: var(--plasma-typo-body-l-font-style);
${iconButtonTokens.iconButtonFontWeight}: var(--plasma-typo-body-l-bold-font-weight);
${iconButtonTokens.iconButtonLetterSpacing}: var(--plasma-typo-body-l-letter-spacing);
${iconButtonTokens.iconButtonLineHeight}: var(--plasma-typo-body-l-line-height);

${iconButtonTokens.iconButtonSpinnerSize}: 1.5rem;
${iconButtonTokens.iconButtonSpinnerColor}: inherit;
`,
l: css`
${iconButtonTokens.iconButtonHeight}: 3.5rem;
${iconButtonTokens.iconButtonWidth}: 3.5rem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { IconButton } from './IconButton';
type StoryButtonProps = ComponentProps<typeof IconButton> & { contentType: string; isLoading: boolean };

const views = ['default', 'accent', 'secondary', 'success', 'warning', 'critical', 'clear', 'dark', 'black', 'white'];
const sizes = ['l', 'm', 's', 'xs'];
const sizes = ['xl', 'l', 'm', 's', 'xs'];
const pins = [
'square-square',
'square-clear',
Expand Down Expand Up @@ -53,8 +53,10 @@ const getSizeForIcon = (size) => {
const map = {
mr: 's',
lr: 's',
xlr: 's',
m: 's',
l: 's',
xl: 's',
sr: 's',
xsr: 'xs',
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { PropsTable, Description } from '@site/src/components';
# Button
Кнопки могут отображаться в нескольких размерах и цветах, могут содержать текст и/или иконку.

## Button
<Description name="Button" />
<PropsTable name="Button" />

Expand Down Expand Up @@ -64,7 +63,8 @@ import { Button } from '@salutejs/{{ package }}';

export function App() {
return (
<div>
<div>
<Button text="Button" size="xl" />
<Button text="Button" size="l" />
<Button text="Button" size="m" />
<Button text="Button" size="s" />
Expand Down
Loading
Loading