Skip to content

Commit

Permalink
feat(sdds-cs): omit hint props
Browse files Browse the repository at this point in the history
  • Loading branch information
TitanKuzmich committed Jan 21, 2025
1 parent ccf1ca5 commit 5c18a1f
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 132 deletions.
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -96,6 +96,19 @@ const meta: Meta<StoryProps> = {
},
if: { arg: 'required', truthy: false },
},
...disableProps([
'hintText',
'hintTrigger',
'hintView',
'hintSize',
'hintTargetIcon',
'hintTargetPlacement',
'hintPlacement',
'hintHasArrow',
'hintOffset',
'hintWidth',
'hintContentLeft',
]),
},
args: {
view: 'default',
Expand Down
15 changes: 14 additions & 1 deletion packages/sdds-cs/src/components/Combobox/Combobox.stories.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -82,6 +82,19 @@ const meta: Meta<StorySelectProps> = {
},
if: { arg: 'required', truthy: false },
},
...disableProps([
'hintText',
'hintTrigger',
'hintView',
'hintSize',
'hintTargetIcon',
'hintTargetPlacement',
'hintPlacement',
'hintHasArrow',
'hintOffset',
'hintWidth',
'hintContentLeft',
]),
},
args: {
label: 'Label',
Expand Down
15 changes: 14 additions & 1 deletion packages/sdds-cs/src/components/Select/Select.stories.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -84,6 +84,19 @@ const meta: Meta<StorySelectProps> = {
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',
Expand Down
68 changes: 10 additions & 58 deletions packages/sdds-cs/src/components/TextArea/TextArea.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ type StoryTextAreaPropsCustom = {

type StoryTextAreaProps = ComponentProps<typeof TextArea> & StoryTextAreaPropsCustom;

const hintViews = ['default'];
const hintSizes = ['m', 's'];
const hintTriggers = ['hover', 'click'];

const meta: Meta<StoryTextAreaProps> = {
title: 'Data Entry/TextArea',
decorators: [InSpacingDecorator],
Expand Down Expand Up @@ -72,52 +68,6 @@ const meta: Meta<StoryTextAreaProps> = {
},
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' },
},
Expand Down Expand Up @@ -161,7 +111,17 @@ const meta: Meta<StoryTextAreaProps> = {
'width',
'helperText',
'labelPlacement',
'hintText',
'hintTrigger',
'hintView',
'hintSize',
'hintTargetIcon',
'hintTargetPlacement',
'hintPlacement',
'hintHasArrow',
'hintOffset',
'hintWidth',
'hintContentLeft',
]),
},
args: {
Expand All @@ -186,14 +146,6 @@ const meta: Meta<StoryTextAreaProps> = {
labelPlacement: 'outer',
clear: false,
hasDivider: false,
hasHint: true,
hintText: 'Текст подсказки',
hintTrigger: 'hover',
hintView: 'default',
hintSize: 'm',
hintPlacement: 'auto',
hintWidth: '10rem',
hintHasArrow: true,
},
};

Expand Down
77 changes: 11 additions & 66 deletions packages/sdds-cs/src/components/TextField/TextField.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,17 @@ 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 '.';

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<PopoverPlacement> = [
'top',
'top-start',
'top-end',

'bottom',
'bottom-start',
'bottom-end',

'left',
'left-start',
'left-end',

'right',
'right-start',
'right-end',

'auto',
];

const meta: Meta<typeof TextField> = {
title: 'Data Entry/TextField',
Expand Down Expand Up @@ -92,40 +69,6 @@ const meta: Meta<typeof TextField> = {
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'],
Expand Down Expand Up @@ -153,6 +96,17 @@ const meta: Meta<typeof TextField> = {
'minLength',
'maxLength',
'checked',
'hintText',
'hintTrigger',
'hintView',
'hintSize',
'hintTargetIcon',
'hintTargetPlacement',
'hintPlacement',
'hintHasArrow',
'hintOffset',
'hintWidth',
'hintContentLeft',
]),
},
};
Expand All @@ -179,7 +133,6 @@ type StoryPropsDefault = Omit<
| 'chips'
| 'onChangeChips'
> & {
hasHint: boolean;
enableContentLeft: boolean;
enableContentRight: boolean;
};
Expand Down Expand Up @@ -243,14 +196,6 @@ export const Default: StoryObj<StoryPropsDefault> = {
enableContentRight: true,
clear: false,
hasDivider: false,
hasHint: true,
hintText: 'Текст подсказки',
hintTrigger: 'hover',
hintView: 'default',
hintSize: 'm',
hintPlacement: 'auto',
hintWidth: '10rem',
hintHasArrow: true,
},
parameters: {
controls: {
Expand Down
2 changes: 1 addition & 1 deletion website/sdds-cs-docs/docs/components/Autocomplete.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import TabItem from '@theme/TabItem';
Поле ввода с подсказками в выпадающем списке.

<Description name="Autocomplete" />
<PropsTable name="Autocomplete" />
<PropsTable name="Autocomplete" exclude={['hintText', 'hintTrigger', 'hintView', 'hintSize', 'hintTargetIcon', 'hintTargetPlacement', 'hintPlacement', 'hintHasArrow', 'hintOffset', 'hintWidth', 'hintContentLeft']} />

## Использование
Расширенная версия компонента `TextField`. Добавилась возможность использования выпадающего списка с подсказками.\
Expand Down
2 changes: 1 addition & 1 deletion website/sdds-cs-docs/docs/components/Combobox.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import TabItem from '@theme/TabItem';
# Combobox

<Description name="Combobox" />
<PropsTable name="Combobox" />
<PropsTable name="Combobox" exclude={['hintText', 'hintTrigger', 'hintView', 'hintSize', 'hintTargetIcon', 'hintTargetPlacement', 'hintPlacement', 'hintHasArrow', 'hintOffset', 'hintWidth', 'hintContentLeft']} />

## Использование
Обязательным параметром является только `items`. Внутри items может быть такой же вложенный массив items. Формат следующий:
Expand Down
2 changes: 1 addition & 1 deletion website/sdds-cs-docs/docs/components/Select.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import TabItem from '@theme/TabItem';

# Select
<Description name="Select" />
<PropsTable name="Select" />
<PropsTable name="Select" exclude={['hintText', 'hintTrigger', 'hintView', 'hintSize', 'hintTargetIcon', 'hintTargetPlacement', 'hintPlacement', 'hintHasArrow', 'hintOffset', 'hintWidth', 'hintContentLeft']} />

## Использование
Обязательным параметром являются: `items`, `value` и `onChange`. Внутри items может быть такой же вложенный массив items. Формат следующий:
Expand Down
2 changes: 1 addition & 1 deletion website/sdds-cs-docs/docs/components/TextArea.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { PropsTable, Description } from '@site/src/components';

# TextArea
<Description name="TextArea" />
<PropsTable name="TextArea" exclude={['$isFocused']} />
<PropsTable name="TextArea" exclude={['$isFocused', 'hintText', 'hintTrigger', 'hintView', 'hintSize', 'hintTargetIcon', 'hintTargetPlacement', 'hintPlacement', 'hintHasArrow', 'hintOffset', 'hintWidth', 'hintContentLeft']} />

## Использование
Компонент `TextArea` может содержать иконку (или кнопку) справа.
Expand Down
2 changes: 1 addition & 1 deletion website/sdds-cs-docs/docs/components/TextField.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { PropsTable, Description } from '@site/src/components';

# TextField
<Description name="TextField" />
<PropsTable name="TextField" exclude={['css']} />
<PropsTable name="TextField" exclude={['css', 'hintText', 'hintTrigger', 'hintView', 'hintSize', 'hintTargetIcon', 'hintTargetPlacement', 'hintPlacement', 'hintHasArrow', 'hintOffset', 'hintWidth', 'hintContentLeft']} />

## Использование
Компонент `TextField` может содержать иконку (или кнопку) слева и справа.
Expand Down

0 comments on commit 5c18a1f

Please sign in to comment.