From 5c18a1f5df63da7a3197fe72de21fd6aee47d272 Mon Sep 17 00:00:00 2001 From: TitanKuzmich Date: Tue, 21 Jan 2025 13:00:38 +0300 Subject: [PATCH] feat(sdds-cs): omit hint props --- .../Autocomplete/Autocomplete.stories.tsx | 15 +++- .../components/Combobox/Combobox.stories.tsx | 15 +++- .../src/components/Select/Select.stories.tsx | 15 +++- .../components/TextArea/TextArea.stories.tsx | 68 +++------------- .../TextField/TextField.stories.tsx | 77 +++---------------- .../docs/components/Autocomplete.mdx | 2 +- .../sdds-cs-docs/docs/components/Combobox.mdx | 2 +- .../sdds-cs-docs/docs/components/Select.mdx | 2 +- .../sdds-cs-docs/docs/components/TextArea.mdx | 2 +- .../docs/components/TextField.mdx | 2 +- 10 files changed, 68 insertions(+), 132 deletions(-) diff --git a/packages/sdds-cs/src/components/Autocomplete/Autocomplete.stories.tsx b/packages/sdds-cs/src/components/Autocomplete/Autocomplete.stories.tsx index d3d12e33dd..7e11e84e22 100644 --- a/packages/sdds-cs/src/components/Autocomplete/Autocomplete.stories.tsx +++ b/packages/sdds-cs/src/components/Autocomplete/Autocomplete.stories.tsx @@ -1,7 +1,7 @@ import type { ComponentProps } from 'react'; import * as React from 'react'; import type { Meta, StoryObj } from '@storybook/react'; -import { InSpacingDecorator } from '@salutejs/plasma-sb-utils'; +import { disableProps, InSpacingDecorator } from '@salutejs/plasma-sb-utils'; import { IconPlasma } from '@salutejs/plasma-icons'; import { Autocomplete } from './Autocomplete'; @@ -96,6 +96,19 @@ const meta: Meta = { }, if: { arg: 'required', truthy: false }, }, + ...disableProps([ + 'hintText', + 'hintTrigger', + 'hintView', + 'hintSize', + 'hintTargetIcon', + 'hintTargetPlacement', + 'hintPlacement', + 'hintHasArrow', + 'hintOffset', + 'hintWidth', + 'hintContentLeft', + ]), }, args: { view: 'default', diff --git a/packages/sdds-cs/src/components/Combobox/Combobox.stories.tsx b/packages/sdds-cs/src/components/Combobox/Combobox.stories.tsx index 66f636913b..529fb53308 100644 --- a/packages/sdds-cs/src/components/Combobox/Combobox.stories.tsx +++ b/packages/sdds-cs/src/components/Combobox/Combobox.stories.tsx @@ -1,7 +1,7 @@ import React, { useState } from 'react'; import type { ComponentProps } from 'react'; import type { Meta, StoryObj } from '@storybook/react'; -import { InSpacingDecorator } from '@salutejs/plasma-sb-utils'; +import { disableProps, InSpacingDecorator } from '@salutejs/plasma-sb-utils'; import { IconDone } from '@salutejs/plasma-icons'; import { Combobox } from './Combobox'; @@ -82,6 +82,19 @@ const meta: Meta = { }, if: { arg: 'required', truthy: false }, }, + ...disableProps([ + 'hintText', + 'hintTrigger', + 'hintView', + 'hintSize', + 'hintTargetIcon', + 'hintTargetPlacement', + 'hintPlacement', + 'hintHasArrow', + 'hintOffset', + 'hintWidth', + 'hintContentLeft', + ]), }, args: { label: 'Label', diff --git a/packages/sdds-cs/src/components/Select/Select.stories.tsx b/packages/sdds-cs/src/components/Select/Select.stories.tsx index 8dc9913497..439cf6510e 100644 --- a/packages/sdds-cs/src/components/Select/Select.stories.tsx +++ b/packages/sdds-cs/src/components/Select/Select.stories.tsx @@ -1,7 +1,7 @@ import React, { useState } from 'react'; import type { ComponentProps } from 'react'; import type { Meta, StoryObj } from '@storybook/react'; -import { InSpacingDecorator } from '@salutejs/plasma-sb-utils'; +import { disableProps, InSpacingDecorator } from '@salutejs/plasma-sb-utils'; import { IconPlasma } from '@salutejs/plasma-icons'; import './style.css'; @@ -84,6 +84,19 @@ const meta: Meta = { options: ['default', 'text'], if: { arg: 'target', eq: 'textfield-like' }, }, + ...disableProps([ + 'hintText', + 'hintTrigger', + 'hintView', + 'hintSize', + 'hintTargetIcon', + 'hintTargetPlacement', + 'hintPlacement', + 'hintHasArrow', + 'hintOffset', + 'hintWidth', + 'hintContentLeft', + ]), }, args: { target: 'textfield-like', diff --git a/packages/sdds-cs/src/components/TextArea/TextArea.stories.tsx b/packages/sdds-cs/src/components/TextArea/TextArea.stories.tsx index ae2a87a53a..e54df2fec6 100644 --- a/packages/sdds-cs/src/components/TextArea/TextArea.stories.tsx +++ b/packages/sdds-cs/src/components/TextArea/TextArea.stories.tsx @@ -16,10 +16,6 @@ type StoryTextAreaPropsCustom = { type StoryTextAreaProps = ComponentProps & StoryTextAreaPropsCustom; -const hintViews = ['default']; -const hintSizes = ['m', 's']; -const hintTriggers = ['hover', 'click']; - const meta: Meta = { title: 'Data Entry/TextArea', decorators: [InSpacingDecorator], @@ -72,52 +68,6 @@ const meta: Meta = { }, if: { arg: 'clear', truthy: false }, }, - hasHint: { - control: { - type: 'boolean', - }, - }, - hintText: { - control: { type: 'text' }, - if: { arg: 'hasHint', truthy: true }, - }, - hintView: { - options: hintViews, - control: { - type: 'select', - }, - if: { arg: 'hasHint', truthy: true }, - }, - hintSize: { - options: hintSizes, - control: { - type: 'select', - }, - if: { arg: 'hasHint', truthy: true }, - }, - hintTrigger: { - options: hintTriggers, - control: { - type: 'inline-radio', - }, - if: { arg: 'hasHint', truthy: true }, - }, - hintPlacement: { - options: placements, - control: { - type: 'select', - }, - if: { arg: 'hasHint', truthy: true }, - mappers: placements, - }, - hintHasArrow: { - control: { type: 'boolean' }, - if: { arg: 'hasHint', truthy: true }, - }, - hintWidth: { - control: { type: 'text' }, - if: { arg: 'hasHint', truthy: true }, - }, helperText: { control: { type: 'text' }, }, @@ -161,7 +111,17 @@ const meta: Meta = { 'width', 'helperText', 'labelPlacement', + 'hintText', + 'hintTrigger', 'hintView', + 'hintSize', + 'hintTargetIcon', + 'hintTargetPlacement', + 'hintPlacement', + 'hintHasArrow', + 'hintOffset', + 'hintWidth', + 'hintContentLeft', ]), }, args: { @@ -186,14 +146,6 @@ const meta: Meta = { labelPlacement: 'outer', clear: false, hasDivider: false, - hasHint: true, - hintText: 'Текст подсказки', - hintTrigger: 'hover', - hintView: 'default', - hintSize: 'm', - hintPlacement: 'auto', - hintWidth: '10rem', - hintHasArrow: true, }, }; diff --git a/packages/sdds-cs/src/components/TextField/TextField.stories.tsx b/packages/sdds-cs/src/components/TextField/TextField.stories.tsx index 33bb7cc9e6..b6eeddf3cb 100644 --- a/packages/sdds-cs/src/components/TextField/TextField.stories.tsx +++ b/packages/sdds-cs/src/components/TextField/TextField.stories.tsx @@ -4,7 +4,6 @@ import type { StoryObj, Meta } from '@storybook/react'; import { action } from '@storybook/addon-actions'; import { InSpacingDecorator, disableProps } from '@salutejs/plasma-sb-utils'; import { IconPlasma } from '@salutejs/plasma-icons'; -import type { PopoverPlacement } from '@salutejs/plasma-new-hope'; import { TextField } from '.'; @@ -12,32 +11,10 @@ const onChange = action('onChange'); const onFocus = action('onFocus'); const onBlur = action('onBlur'); const onSearch = action('onSearch'); -const onChipsChange = action('onChipsChange'); const sizes = ['s']; const views = ['default', 'negative']; const labelPlacements = ['outer']; -const hintSizes = ['m', 's']; -const hintTriggers = ['hover', 'click']; -const placements: Array = [ - 'top', - 'top-start', - 'top-end', - - 'bottom', - 'bottom-start', - 'bottom-end', - - 'left', - 'left-start', - 'left-end', - - 'right', - 'right-start', - 'right-end', - - 'auto', -]; const meta: Meta = { title: 'Data Entry/TextField', @@ -92,40 +69,6 @@ const meta: Meta = { type: 'inline-radio', }, }, - hintText: { - control: { type: 'text' }, - if: { arg: 'hasHint', truthy: true }, - }, - hintSize: { - options: hintSizes, - control: { - type: 'select', - }, - if: { arg: 'hasHint', truthy: true }, - }, - hintTrigger: { - options: hintTriggers, - control: { - type: 'inline-radio', - }, - if: { arg: 'hasHint', truthy: true }, - }, - hintPlacement: { - options: placements, - control: { - type: 'select', - }, - if: { arg: 'hasHint', truthy: true }, - mappers: placements, - }, - hintHasArrow: { - control: { type: 'boolean' }, - if: { arg: 'hasHint', truthy: true }, - }, - hintWidth: { - control: { type: 'text' }, - if: { arg: 'hasHint', truthy: true }, - }, chipType: { control: 'select', options: ['default', 'text'], @@ -153,6 +96,17 @@ const meta: Meta = { 'minLength', 'maxLength', 'checked', + 'hintText', + 'hintTrigger', + 'hintView', + 'hintSize', + 'hintTargetIcon', + 'hintTargetPlacement', + 'hintPlacement', + 'hintHasArrow', + 'hintOffset', + 'hintWidth', + 'hintContentLeft', ]), }, }; @@ -179,7 +133,6 @@ type StoryPropsDefault = Omit< | 'chips' | 'onChangeChips' > & { - hasHint: boolean; enableContentLeft: boolean; enableContentRight: boolean; }; @@ -243,14 +196,6 @@ export const Default: StoryObj = { enableContentRight: true, clear: false, hasDivider: false, - hasHint: true, - hintText: 'Текст подсказки', - hintTrigger: 'hover', - hintView: 'default', - hintSize: 'm', - hintPlacement: 'auto', - hintWidth: '10rem', - hintHasArrow: true, }, parameters: { controls: { diff --git a/website/sdds-cs-docs/docs/components/Autocomplete.mdx b/website/sdds-cs-docs/docs/components/Autocomplete.mdx index 653604dcac..0c0b9b1d81 100644 --- a/website/sdds-cs-docs/docs/components/Autocomplete.mdx +++ b/website/sdds-cs-docs/docs/components/Autocomplete.mdx @@ -11,7 +11,7 @@ import TabItem from '@theme/TabItem'; Поле ввода с подсказками в выпадающем списке. - + ## Использование Расширенная версия компонента `TextField`. Добавилась возможность использования выпадающего списка с подсказками.\ diff --git a/website/sdds-cs-docs/docs/components/Combobox.mdx b/website/sdds-cs-docs/docs/components/Combobox.mdx index d2a64bb5ab..98533700b0 100644 --- a/website/sdds-cs-docs/docs/components/Combobox.mdx +++ b/website/sdds-cs-docs/docs/components/Combobox.mdx @@ -10,7 +10,7 @@ import TabItem from '@theme/TabItem'; # Combobox - + ## Использование Обязательным параметром является только `items`. Внутри items может быть такой же вложенный массив items. Формат следующий: diff --git a/website/sdds-cs-docs/docs/components/Select.mdx b/website/sdds-cs-docs/docs/components/Select.mdx index 0b00c8ff45..92f4722b1a 100644 --- a/website/sdds-cs-docs/docs/components/Select.mdx +++ b/website/sdds-cs-docs/docs/components/Select.mdx @@ -9,7 +9,7 @@ import TabItem from '@theme/TabItem'; # Select - + ## Использование Обязательным параметром являются: `items`, `value` и `onChange`. Внутри items может быть такой же вложенный массив items. Формат следующий: diff --git a/website/sdds-cs-docs/docs/components/TextArea.mdx b/website/sdds-cs-docs/docs/components/TextArea.mdx index 9979ff56a1..d6d2a764d5 100644 --- a/website/sdds-cs-docs/docs/components/TextArea.mdx +++ b/website/sdds-cs-docs/docs/components/TextArea.mdx @@ -7,7 +7,7 @@ import { PropsTable, Description } from '@site/src/components'; # TextArea - + ## Использование Компонент `TextArea` может содержать иконку (или кнопку) справа. diff --git a/website/sdds-cs-docs/docs/components/TextField.mdx b/website/sdds-cs-docs/docs/components/TextField.mdx index 6d9e320e44..bc9fea0156 100644 --- a/website/sdds-cs-docs/docs/components/TextField.mdx +++ b/website/sdds-cs-docs/docs/components/TextField.mdx @@ -7,7 +7,7 @@ import { PropsTable, Description } from '@site/src/components'; # TextField - + ## Использование Компонент `TextField` может содержать иконку (или кнопку) слева и справа.