From f7472a0428b388eb1ec40cd36ca436735dfef21e Mon Sep 17 00:00:00 2001 From: Krivonos Aleksandr Date: Thu, 7 Nov 2024 16:01:58 +0300 Subject: [PATCH] feat(sdds-*): update stories and configs for Badge --- .../src/components/Badge/Badge.config.ts | 8 +++++--- .../src/components/Badge/Badge.stories.tsx | 10 ++++++++-- .../src/components/Badge/Badge.config.ts | 20 ++++++++++--------- .../src/components/Badge/Badge.stories.tsx | 10 ++++++++-- .../src/components/Badge/Badge.config.ts | 20 ++++++++++--------- .../src/components/Badge/Badge.stories.tsx | 10 ++++++++-- .../src/components/Badge/Badge.config.ts | 20 ++++++++++--------- .../src/components/Badge/Badge.stories.tsx | 10 ++++++++-- .../src/components/Badge/Badge.config.ts | 20 ++++++++++--------- .../src/components/Badge/Badge.stories.tsx | 10 ++++++++-- 10 files changed, 89 insertions(+), 49 deletions(-) diff --git a/packages/sdds-cs/src/components/Badge/Badge.config.ts b/packages/sdds-cs/src/components/Badge/Badge.config.ts index 2b16ba6fde..9a3561a159 100644 --- a/packages/sdds-cs/src/components/Badge/Badge.config.ts +++ b/packages/sdds-cs/src/components/Badge/Badge.config.ts @@ -39,8 +39,8 @@ export const config = { s: css` ${badgeTokens.borderRadius}: 0.375rem; ${badgeTokens.height}: 1.5rem; - ${badgeTokens.paddingRight}: 0.5rem; - ${badgeTokens.paddingLeft}: 0.5rem; + ${badgeTokens.padding}: 0 0.5rem; + ${badgeTokens.paddingIconOnly}: 0 0.375rem; ${badgeTokens.fontFamily}: var(--plasma-typo-body-s-font-family); ${badgeTokens.fontSize}: var(--plasma-typo-body-s-font-size); @@ -65,7 +65,9 @@ export const config = { true: css``, }, clear: { - true: css``, + true: css` + ${badgeTokens.backgroundClear}: var(--surface-clear); + `, }, }, }; diff --git a/packages/sdds-cs/src/components/Badge/Badge.stories.tsx b/packages/sdds-cs/src/components/Badge/Badge.stories.tsx index 22b570de0c..8e16a6cd02 100644 --- a/packages/sdds-cs/src/components/Badge/Badge.stories.tsx +++ b/packages/sdds-cs/src/components/Badge/Badge.stories.tsx @@ -25,6 +25,10 @@ const meta: Meta = { control: { type: 'boolean' }, if: { arg: 'clear', truthy: false }, }, + text: { + control: { type: 'text' }, + if: { arg: 'enableText', truthy: true }, + }, ...disableProps(['contentLeft', 'contentRight', 'transparent', 'size']), }, }; @@ -34,6 +38,7 @@ export default meta; type StoryProps = ComponentProps & { enableContentLeft: boolean; enableContentRight: boolean; + enableText: boolean; }; type Story = StoryObj; @@ -54,13 +59,14 @@ export const Default: Story = { }, enableContentRight: { control: { type: 'boolean' }, - if: { arg: 'enableContentLeft', truthy: false }, + if: { arg: 'enableText', truthy: true }, }, }, args: { - text: 'Hello', view: 'default', size: 's', + enableText: true, + text: 'Hello', enableContentLeft: false, enableContentRight: false, clear: false, diff --git a/packages/sdds-dfa/src/components/Badge/Badge.config.ts b/packages/sdds-dfa/src/components/Badge/Badge.config.ts index 81ca50b364..3d8e8df196 100644 --- a/packages/sdds-dfa/src/components/Badge/Badge.config.ts +++ b/packages/sdds-dfa/src/components/Badge/Badge.config.ts @@ -75,8 +75,8 @@ export const config = { l: css` ${badgeTokens.borderRadius}: 0.5rem; ${badgeTokens.height}: 1.75rem; - ${badgeTokens.paddingRight}: 0.6875rem; - ${badgeTokens.paddingLeft}: 0.6875rem; + ${badgeTokens.padding}: 0 0.6875rem; + ${badgeTokens.paddingIconOnly}: 0 0.375rem; ${badgeTokens.fontFamily}: var(--plasma-typo-body-s-font-family); ${badgeTokens.fontSize}: var(--plasma-typo-body-s-font-size); @@ -94,8 +94,8 @@ export const config = { m: css` ${badgeTokens.borderRadius}: 0.375rem; ${badgeTokens.height}: 1.5rem; - ${badgeTokens.paddingRight}: 0.5625rem; - ${badgeTokens.paddingLeft}: 0.5625rem; + ${badgeTokens.padding}: 0 0.5625rem; + ${badgeTokens.paddingIconOnly}: 0 0.375rem; ${badgeTokens.fontFamily}: var(--plasma-typo-body-xs-font-family); ${badgeTokens.fontSize}: var(--plasma-typo-body-xs-font-size); @@ -113,8 +113,8 @@ export const config = { s: css` ${badgeTokens.borderRadius}: 0.375rem; ${badgeTokens.height}: 1.25rem; - ${badgeTokens.paddingRight}: 0.4375rem; - ${badgeTokens.paddingLeft}: 0.4375rem; + ${badgeTokens.padding}: 0 0.4375rem; + ${badgeTokens.paddingIconOnly}: 0 0.25rem; ${badgeTokens.fontFamily}: var(--plasma-typo-body-xxs-font-family); ${badgeTokens.fontSize}: var(--plasma-typo-body-xxs-font-size); @@ -132,8 +132,8 @@ export const config = { xs: css` ${badgeTokens.borderRadius}: 0.25rem; ${badgeTokens.height}: 1rem; - ${badgeTokens.paddingRight}: 0.25rem; - ${badgeTokens.paddingLeft}: 0.25rem; + ${badgeTokens.padding}: 0 0.25rem; + ${badgeTokens.paddingIconOnly}: 0 0.188rem; ${badgeTokens.fontFamily}: var(--plasma-typo-body-xxs-font-family); ${badgeTokens.fontSize}: var(--plasma-typo-body-xxs-font-size); @@ -158,7 +158,9 @@ export const config = { true: css``, }, clear: { - true: css``, + true: css` + ${badgeTokens.backgroundClear}: var(--surface-clear); + `, }, }, }; diff --git a/packages/sdds-dfa/src/components/Badge/Badge.stories.tsx b/packages/sdds-dfa/src/components/Badge/Badge.stories.tsx index 8b0cc1dca7..e58d6de412 100644 --- a/packages/sdds-dfa/src/components/Badge/Badge.stories.tsx +++ b/packages/sdds-dfa/src/components/Badge/Badge.stories.tsx @@ -29,6 +29,10 @@ const meta: Meta = { control: { type: 'boolean' }, if: { arg: 'clear', truthy: false }, }, + text: { + control: { type: 'text' }, + if: { arg: 'enableText', truthy: true }, + }, ...disableProps(['contentLeft', 'contentRight']), }, }; @@ -38,6 +42,7 @@ export default meta; type StoryProps = ComponentProps & { enableContentLeft: boolean; enableContentRight: boolean; + enableText: boolean; }; type Story = StoryObj; @@ -58,13 +63,14 @@ export const Default: Story = { }, enableContentRight: { control: { type: 'boolean' }, - if: { arg: 'enableContentLeft', truthy: false }, + if: { arg: 'enableText', truthy: true }, }, }, args: { - text: 'Hello', view: 'default', size: 'm', + enableText: true, + text: 'Hello', enableContentLeft: false, enableContentRight: false, clear: false, diff --git a/packages/sdds-finportal/src/components/Badge/Badge.config.ts b/packages/sdds-finportal/src/components/Badge/Badge.config.ts index 81ca50b364..3d8e8df196 100644 --- a/packages/sdds-finportal/src/components/Badge/Badge.config.ts +++ b/packages/sdds-finportal/src/components/Badge/Badge.config.ts @@ -75,8 +75,8 @@ export const config = { l: css` ${badgeTokens.borderRadius}: 0.5rem; ${badgeTokens.height}: 1.75rem; - ${badgeTokens.paddingRight}: 0.6875rem; - ${badgeTokens.paddingLeft}: 0.6875rem; + ${badgeTokens.padding}: 0 0.6875rem; + ${badgeTokens.paddingIconOnly}: 0 0.375rem; ${badgeTokens.fontFamily}: var(--plasma-typo-body-s-font-family); ${badgeTokens.fontSize}: var(--plasma-typo-body-s-font-size); @@ -94,8 +94,8 @@ export const config = { m: css` ${badgeTokens.borderRadius}: 0.375rem; ${badgeTokens.height}: 1.5rem; - ${badgeTokens.paddingRight}: 0.5625rem; - ${badgeTokens.paddingLeft}: 0.5625rem; + ${badgeTokens.padding}: 0 0.5625rem; + ${badgeTokens.paddingIconOnly}: 0 0.375rem; ${badgeTokens.fontFamily}: var(--plasma-typo-body-xs-font-family); ${badgeTokens.fontSize}: var(--plasma-typo-body-xs-font-size); @@ -113,8 +113,8 @@ export const config = { s: css` ${badgeTokens.borderRadius}: 0.375rem; ${badgeTokens.height}: 1.25rem; - ${badgeTokens.paddingRight}: 0.4375rem; - ${badgeTokens.paddingLeft}: 0.4375rem; + ${badgeTokens.padding}: 0 0.4375rem; + ${badgeTokens.paddingIconOnly}: 0 0.25rem; ${badgeTokens.fontFamily}: var(--plasma-typo-body-xxs-font-family); ${badgeTokens.fontSize}: var(--plasma-typo-body-xxs-font-size); @@ -132,8 +132,8 @@ export const config = { xs: css` ${badgeTokens.borderRadius}: 0.25rem; ${badgeTokens.height}: 1rem; - ${badgeTokens.paddingRight}: 0.25rem; - ${badgeTokens.paddingLeft}: 0.25rem; + ${badgeTokens.padding}: 0 0.25rem; + ${badgeTokens.paddingIconOnly}: 0 0.188rem; ${badgeTokens.fontFamily}: var(--plasma-typo-body-xxs-font-family); ${badgeTokens.fontSize}: var(--plasma-typo-body-xxs-font-size); @@ -158,7 +158,9 @@ export const config = { true: css``, }, clear: { - true: css``, + true: css` + ${badgeTokens.backgroundClear}: var(--surface-clear); + `, }, }, }; diff --git a/packages/sdds-finportal/src/components/Badge/Badge.stories.tsx b/packages/sdds-finportal/src/components/Badge/Badge.stories.tsx index 8b0cc1dca7..e58d6de412 100644 --- a/packages/sdds-finportal/src/components/Badge/Badge.stories.tsx +++ b/packages/sdds-finportal/src/components/Badge/Badge.stories.tsx @@ -29,6 +29,10 @@ const meta: Meta = { control: { type: 'boolean' }, if: { arg: 'clear', truthy: false }, }, + text: { + control: { type: 'text' }, + if: { arg: 'enableText', truthy: true }, + }, ...disableProps(['contentLeft', 'contentRight']), }, }; @@ -38,6 +42,7 @@ export default meta; type StoryProps = ComponentProps & { enableContentLeft: boolean; enableContentRight: boolean; + enableText: boolean; }; type Story = StoryObj; @@ -58,13 +63,14 @@ export const Default: Story = { }, enableContentRight: { control: { type: 'boolean' }, - if: { arg: 'enableContentLeft', truthy: false }, + if: { arg: 'enableText', truthy: true }, }, }, args: { - text: 'Hello', view: 'default', size: 'm', + enableText: true, + text: 'Hello', enableContentLeft: false, enableContentRight: false, clear: false, diff --git a/packages/sdds-insol/src/components/Badge/Badge.config.ts b/packages/sdds-insol/src/components/Badge/Badge.config.ts index 81ca50b364..3d8e8df196 100644 --- a/packages/sdds-insol/src/components/Badge/Badge.config.ts +++ b/packages/sdds-insol/src/components/Badge/Badge.config.ts @@ -75,8 +75,8 @@ export const config = { l: css` ${badgeTokens.borderRadius}: 0.5rem; ${badgeTokens.height}: 1.75rem; - ${badgeTokens.paddingRight}: 0.6875rem; - ${badgeTokens.paddingLeft}: 0.6875rem; + ${badgeTokens.padding}: 0 0.6875rem; + ${badgeTokens.paddingIconOnly}: 0 0.375rem; ${badgeTokens.fontFamily}: var(--plasma-typo-body-s-font-family); ${badgeTokens.fontSize}: var(--plasma-typo-body-s-font-size); @@ -94,8 +94,8 @@ export const config = { m: css` ${badgeTokens.borderRadius}: 0.375rem; ${badgeTokens.height}: 1.5rem; - ${badgeTokens.paddingRight}: 0.5625rem; - ${badgeTokens.paddingLeft}: 0.5625rem; + ${badgeTokens.padding}: 0 0.5625rem; + ${badgeTokens.paddingIconOnly}: 0 0.375rem; ${badgeTokens.fontFamily}: var(--plasma-typo-body-xs-font-family); ${badgeTokens.fontSize}: var(--plasma-typo-body-xs-font-size); @@ -113,8 +113,8 @@ export const config = { s: css` ${badgeTokens.borderRadius}: 0.375rem; ${badgeTokens.height}: 1.25rem; - ${badgeTokens.paddingRight}: 0.4375rem; - ${badgeTokens.paddingLeft}: 0.4375rem; + ${badgeTokens.padding}: 0 0.4375rem; + ${badgeTokens.paddingIconOnly}: 0 0.25rem; ${badgeTokens.fontFamily}: var(--plasma-typo-body-xxs-font-family); ${badgeTokens.fontSize}: var(--plasma-typo-body-xxs-font-size); @@ -132,8 +132,8 @@ export const config = { xs: css` ${badgeTokens.borderRadius}: 0.25rem; ${badgeTokens.height}: 1rem; - ${badgeTokens.paddingRight}: 0.25rem; - ${badgeTokens.paddingLeft}: 0.25rem; + ${badgeTokens.padding}: 0 0.25rem; + ${badgeTokens.paddingIconOnly}: 0 0.188rem; ${badgeTokens.fontFamily}: var(--plasma-typo-body-xxs-font-family); ${badgeTokens.fontSize}: var(--plasma-typo-body-xxs-font-size); @@ -158,7 +158,9 @@ export const config = { true: css``, }, clear: { - true: css``, + true: css` + ${badgeTokens.backgroundClear}: var(--surface-clear); + `, }, }, }; diff --git a/packages/sdds-insol/src/components/Badge/Badge.stories.tsx b/packages/sdds-insol/src/components/Badge/Badge.stories.tsx index 8b0cc1dca7..e58d6de412 100644 --- a/packages/sdds-insol/src/components/Badge/Badge.stories.tsx +++ b/packages/sdds-insol/src/components/Badge/Badge.stories.tsx @@ -29,6 +29,10 @@ const meta: Meta = { control: { type: 'boolean' }, if: { arg: 'clear', truthy: false }, }, + text: { + control: { type: 'text' }, + if: { arg: 'enableText', truthy: true }, + }, ...disableProps(['contentLeft', 'contentRight']), }, }; @@ -38,6 +42,7 @@ export default meta; type StoryProps = ComponentProps & { enableContentLeft: boolean; enableContentRight: boolean; + enableText: boolean; }; type Story = StoryObj; @@ -58,13 +63,14 @@ export const Default: Story = { }, enableContentRight: { control: { type: 'boolean' }, - if: { arg: 'enableContentLeft', truthy: false }, + if: { arg: 'enableText', truthy: true }, }, }, args: { - text: 'Hello', view: 'default', size: 'm', + enableText: true, + text: 'Hello', enableContentLeft: false, enableContentRight: false, clear: false, diff --git a/packages/sdds-serv/src/components/Badge/Badge.config.ts b/packages/sdds-serv/src/components/Badge/Badge.config.ts index 81ca50b364..3d8e8df196 100644 --- a/packages/sdds-serv/src/components/Badge/Badge.config.ts +++ b/packages/sdds-serv/src/components/Badge/Badge.config.ts @@ -75,8 +75,8 @@ export const config = { l: css` ${badgeTokens.borderRadius}: 0.5rem; ${badgeTokens.height}: 1.75rem; - ${badgeTokens.paddingRight}: 0.6875rem; - ${badgeTokens.paddingLeft}: 0.6875rem; + ${badgeTokens.padding}: 0 0.6875rem; + ${badgeTokens.paddingIconOnly}: 0 0.375rem; ${badgeTokens.fontFamily}: var(--plasma-typo-body-s-font-family); ${badgeTokens.fontSize}: var(--plasma-typo-body-s-font-size); @@ -94,8 +94,8 @@ export const config = { m: css` ${badgeTokens.borderRadius}: 0.375rem; ${badgeTokens.height}: 1.5rem; - ${badgeTokens.paddingRight}: 0.5625rem; - ${badgeTokens.paddingLeft}: 0.5625rem; + ${badgeTokens.padding}: 0 0.5625rem; + ${badgeTokens.paddingIconOnly}: 0 0.375rem; ${badgeTokens.fontFamily}: var(--plasma-typo-body-xs-font-family); ${badgeTokens.fontSize}: var(--plasma-typo-body-xs-font-size); @@ -113,8 +113,8 @@ export const config = { s: css` ${badgeTokens.borderRadius}: 0.375rem; ${badgeTokens.height}: 1.25rem; - ${badgeTokens.paddingRight}: 0.4375rem; - ${badgeTokens.paddingLeft}: 0.4375rem; + ${badgeTokens.padding}: 0 0.4375rem; + ${badgeTokens.paddingIconOnly}: 0 0.25rem; ${badgeTokens.fontFamily}: var(--plasma-typo-body-xxs-font-family); ${badgeTokens.fontSize}: var(--plasma-typo-body-xxs-font-size); @@ -132,8 +132,8 @@ export const config = { xs: css` ${badgeTokens.borderRadius}: 0.25rem; ${badgeTokens.height}: 1rem; - ${badgeTokens.paddingRight}: 0.25rem; - ${badgeTokens.paddingLeft}: 0.25rem; + ${badgeTokens.padding}: 0 0.25rem; + ${badgeTokens.paddingIconOnly}: 0 0.188rem; ${badgeTokens.fontFamily}: var(--plasma-typo-body-xxs-font-family); ${badgeTokens.fontSize}: var(--plasma-typo-body-xxs-font-size); @@ -158,7 +158,9 @@ export const config = { true: css``, }, clear: { - true: css``, + true: css` + ${badgeTokens.backgroundClear}: var(--surface-clear); + `, }, }, }; diff --git a/packages/sdds-serv/src/components/Badge/Badge.stories.tsx b/packages/sdds-serv/src/components/Badge/Badge.stories.tsx index 8b0cc1dca7..e58d6de412 100644 --- a/packages/sdds-serv/src/components/Badge/Badge.stories.tsx +++ b/packages/sdds-serv/src/components/Badge/Badge.stories.tsx @@ -29,6 +29,10 @@ const meta: Meta = { control: { type: 'boolean' }, if: { arg: 'clear', truthy: false }, }, + text: { + control: { type: 'text' }, + if: { arg: 'enableText', truthy: true }, + }, ...disableProps(['contentLeft', 'contentRight']), }, }; @@ -38,6 +42,7 @@ export default meta; type StoryProps = ComponentProps & { enableContentLeft: boolean; enableContentRight: boolean; + enableText: boolean; }; type Story = StoryObj; @@ -58,13 +63,14 @@ export const Default: Story = { }, enableContentRight: { control: { type: 'boolean' }, - if: { arg: 'enableContentLeft', truthy: false }, + if: { arg: 'enableText', truthy: true }, }, }, args: { - text: 'Hello', view: 'default', size: 'm', + enableText: true, + text: 'Hello', enableContentLeft: false, enableContentRight: false, clear: false,