Skip to content

Commit

Permalink
fix(sdds-serv): Fix switch types and auto fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
iljs committed Jun 17, 2024
1 parent 5a7ef14 commit 4d1e995
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 277 deletions.
43 changes: 7 additions & 36 deletions packages/caldera-online/api/caldera-online.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ import { dsplMBold } from '@salutejs/caldera-online-themes/tokens';
import { dsplS } from '@salutejs/caldera-online-themes/tokens';
import { dsplSBold } from '@salutejs/caldera-online-themes/tokens';
import { Filter } from '@salutejs/plasma-new-hope/types/engines/types';
import { FocusProps } from '@salutejs/plasma-new-hope/styled-components';
import type { ForwardRefExoticComponent } from 'react';
import { ForwardRefExoticComponent } from 'react';
import { FunctionComponent } from 'react';
import { h1 } from '@salutejs/caldera-online-themes/tokens';
import { h1Bold } from '@salutejs/caldera-online-themes/tokens';
Expand All @@ -48,7 +47,6 @@ import { h5 } from '@salutejs/caldera-online-themes/tokens';
import { h5Bold } from '@salutejs/caldera-online-themes/tokens';
import { HTMLAttributes } from 'react';
import { InputHTMLAttributes } from '@salutejs/plasma-new-hope/types/types';
import type { InputHTMLAttributes as InputHTMLAttributes_2 } from 'react';
import { LinkCustomProps } from '@salutejs/plasma-new-hope/types/components/Link/Link';
import { mediaQuery } from '@salutejs/plasma-new-hope/styled-components';
import { modalClasses } from '@salutejs/plasma-new-hope/styled-components';
Expand All @@ -70,7 +68,7 @@ import { ShowToastArgs } from '@salutejs/plasma-new-hope/styled-components';
import { SpacingProps } from '@salutejs/plasma-new-hope/styled-components';
import { SSRProvider } from '@salutejs/plasma-new-hope/styled-components';
import { StyledComponent } from 'styled-components';
import { SwitchPropsVariations } from '@salutejs/plasma-new-hope/types/components/Switch/Switch.types';
import type { SwitchProps } from '@salutejs/plasma-core';
import { textL } from '@salutejs/caldera-online-themes/tokens';
import { textLBold } from '@salutejs/caldera-online-themes/tokens';
import { textM } from '@salutejs/caldera-online-themes/tokens';
Expand Down Expand Up @@ -582,39 +580,12 @@ export type SpinnerProps = HTMLAttributes<HTMLDivElement> & {

export { SSRProvider }

// @public
export const Switch: FunctionComponent<PropsType< {
size: {
m: string;
};
view: {
default: string;
};
labelPosition: {
before: string;
after: string;
};
disabled: {
true: string;
};
focused: {
true: string;
};
}> & Filter<InputHTMLAttributes_2<HTMLInputElement>, "size"> & SwitchPropsVariations & RefAttributes<HTMLInputElement>>;

// @public (undocumented)
export type SwitchProps = {
id?: string;
label?: React.ReactNode;
size?: string;
view?: string;
labelPosition?: 'before' | 'after';
description?: React.ReactNode;
disabled?: boolean;
pressed?: boolean;
focused?: boolean;
outlined?: boolean;
} & FocusProps & Omit<React.LabelHTMLAttributes<HTMLLabelElement>, 'onChange' | 'onFocus' | 'onBlur'> & Pick<InputHTMLAttributes_2<HTMLInputElement>, 'name' | 'value' | 'checked' | 'disabled' | 'readOnly' | 'onChange' | 'onFocus' | 'onBlur'>;
export const Switch: ForwardRefExoticComponent< {
defaultChecked: boolean;
} & SwitchProps & RefAttributes<HTMLInputElement>>;

export { SwitchProps }

// @public (undocumented)
export const TextL: FunctionComponent<PropsType< {
Expand Down
66 changes: 10 additions & 56 deletions packages/caldera-online/src/components/Switch/Switch.tsx
Original file line number Diff line number Diff line change
@@ -1,62 +1,16 @@
import type { InputHTMLAttributes } from 'react';
import { switchConfig, component, mergeConfig, FocusProps } from '@salutejs/plasma-new-hope/styled-components';
import { switchConfig, component, mergeConfig } from '@salutejs/plasma-new-hope/styled-components';
import type { SwitchProps } from '@salutejs/plasma-core';

import { config } from './Switch.config';

type SwitchPropsCustom = {
defaultChecked: boolean;
} & SwitchProps;

const mergedConfig = mergeConfig(switchConfig, config);
const SwitchComponent = component(mergedConfig);

export type SwitchProps = {
/**
* Уникальный идентификатор контрола
*/
id?: string;
/**
* Метка-подпись к элементу
*/
label?: React.ReactNode;
/**
* Размер контрола.
*/
size?: string;
/**
* Вид контрола.
*/
view?: string;
/**
* Расположение подпись
*/
labelPosition?: 'before' | 'after';
/**
* Описание элемента
*/
description?: React.ReactNode;
/**
* Компонент неактивен
*/
disabled?: boolean;
/**
* Нажатие на компонент
* @deprecated
*/
pressed?: boolean;
/**
* Добавить рамку при фокусе
*/
focused?: boolean;
/**
* Добавить рамку при фокусе
* @deprecated
*/
outlined?: boolean;
} & FocusProps &
Omit<React.LabelHTMLAttributes<HTMLLabelElement>, 'onChange' | 'onFocus' | 'onBlur'> &
Pick<
InputHTMLAttributes<HTMLInputElement>,
'name' | 'value' | 'checked' | 'disabled' | 'readOnly' | 'onChange' | 'onFocus' | 'onBlur'
>;

/**
* Визуальный переключатель между двумя взаимоисключающими состояниями — вкл. и выкл.
*/
export const Switch = SwitchComponent;
export const Switch = SwitchComponent as React.ForwardRefExoticComponent<
SwitchPropsCustom & React.RefAttributes<HTMLInputElement>
>;
export type { SwitchProps };
42 changes: 7 additions & 35 deletions packages/plasma-asdk/api/plasma-asdk.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ import { ButtonHTMLAttributes } from 'react';
import { CheckboxProps as CheckboxProps_2 } from '@salutejs/plasma-new-hope/types/components/Checkbox/Checkbox.types';
import { ComponentProps } from 'react';
import { Filter } from '@salutejs/plasma-new-hope/types/engines/types';
import { FocusProps } from '@salutejs/plasma-new-hope/styled-components';
import { ForwardRefExoticComponent } from 'react';
import { FunctionComponent } from 'react';
import { HTMLAttributes } from 'react';
import { InputHTMLAttributes } from '@salutejs/plasma-new-hope/types/types';
import type { InputHTMLAttributes as InputHTMLAttributes_2 } from 'react';
import { LinkCustomProps } from '@salutejs/plasma-new-hope/types/components/Link/Link';
import { PropsType } from '@salutejs/plasma-new-hope/types/engines/types';
import { RadioGroup } from '@salutejs/plasma-new-hope/styled-components';
Expand All @@ -28,7 +27,7 @@ import { SpacingProps } from '@salutejs/plasma-new-hope/styled-components';
import { SSRProvider } from '@salutejs/plasma-new-hope/styled-components';
import { StyledComponent } from 'styled-components';
import { SubtitleProps } from '@salutejs/plasma-new-hope/styled-components';
import { SwitchPropsVariations } from '@salutejs/plasma-new-hope/types/components/Switch/Switch.types';
import type { SwitchProps } from '@salutejs/plasma-core';
import { TypographyOldProps } from '@salutejs/plasma-new-hope/types/components/Typography/Old/TypographyOld';

// @public (undocumented)
Expand Down Expand Up @@ -437,39 +436,12 @@ m: string;
};
}> & SubtitleProps & RefAttributes<HTMLDivElement>>;

// @public
export const Switch: FunctionComponent<PropsType< {
size: {
m: string;
};
view: {
default: string;
};
labelPosition: {
before: string;
after: string;
};
disabled: {
true: string;
};
focused: {
true: string;
};
}> & Filter<InputHTMLAttributes_2<HTMLInputElement>, "size"> & SwitchPropsVariations & RefAttributes<HTMLInputElement>>;

// @public (undocumented)
export type SwitchProps = {
id?: string;
label?: React.ReactNode;
size?: string;
view?: string;
labelPosition?: 'before' | 'after';
description?: React.ReactNode;
disabled?: boolean;
pressed?: boolean;
focused?: boolean;
outlined?: boolean;
} & FocusProps & Omit<React.LabelHTMLAttributes<HTMLLabelElement>, 'onChange' | 'onFocus' | 'onBlur'> & Pick<InputHTMLAttributes_2<HTMLInputElement>, 'name' | 'value' | 'checked' | 'disabled' | 'readOnly' | 'onChange' | 'onFocus' | 'onBlur'>;
export const Switch: ForwardRefExoticComponent< {
defaultChecked: boolean;
} & SwitchProps & RefAttributes<HTMLInputElement>>;

export { SwitchProps }

// @public (undocumented)
export const TextL: FunctionComponent<PropsType< {
Expand Down
66 changes: 10 additions & 56 deletions packages/plasma-asdk/src/components/Switch/Switch.tsx
Original file line number Diff line number Diff line change
@@ -1,62 +1,16 @@
import type { InputHTMLAttributes } from 'react';
import { switchConfig, component, mergeConfig, FocusProps } from '@salutejs/plasma-new-hope/styled-components';
import { switchConfig, component, mergeConfig } from '@salutejs/plasma-new-hope/styled-components';
import type { SwitchProps } from '@salutejs/plasma-core';

import { config } from './Switch.config';

type SwitchPropsCustom = {
defaultChecked: boolean;
} & SwitchProps;

const mergedConfig = mergeConfig(switchConfig, config);
const SwitchComponent = component(mergedConfig);

export type SwitchProps = {
/**
* Уникальный идентификатор контрола
*/
id?: string;
/**
* Метка-подпись к элементу
*/
label?: React.ReactNode;
/**
* Размер контрола.
*/
size?: string;
/**
* Вид контрола.
*/
view?: string;
/**
* Расположение подпись
*/
labelPosition?: 'before' | 'after';
/**
* Описание элемента
*/
description?: React.ReactNode;
/**
* Компонент неактивен
*/
disabled?: boolean;
/**
* Нажатие на компонент
* @deprecated
*/
pressed?: boolean;
/**
* Добавить рамку при фокусе
*/
focused?: boolean;
/**
* Добавить рамку при фокусе
* @deprecated
*/
outlined?: boolean;
} & FocusProps &
Omit<React.LabelHTMLAttributes<HTMLLabelElement>, 'onChange' | 'onFocus' | 'onBlur'> &
Pick<
InputHTMLAttributes<HTMLInputElement>,
'name' | 'value' | 'checked' | 'disabled' | 'readOnly' | 'onChange' | 'onFocus' | 'onBlur'
>;

/**
* Визуальный переключатель между двумя взаимоисключающими состояниями — вкл. и выкл.
*/
export const Switch = SwitchComponent;
export const Switch = SwitchComponent as React.ForwardRefExoticComponent<
SwitchPropsCustom & React.RefAttributes<HTMLInputElement>
>;
export type { SwitchProps };
4 changes: 3 additions & 1 deletion packages/plasma-b2c/api/plasma-b2c.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1907,7 +1907,9 @@ m: string;
}> & SubtitleProps & RefAttributes<HTMLDivElement>>;

// @public (undocumented)
export const Switch: ForwardRefExoticComponent<SwitchProps & RefAttributes<HTMLInputElement>>;
export const Switch: ForwardRefExoticComponent< {
defaultChecked: boolean;
} & SwitchProps & RefAttributes<HTMLInputElement>>;

export { SwitchProps }

Expand Down
6 changes: 5 additions & 1 deletion packages/plasma-b2c/src/components/Switch/Switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@ import type { SwitchProps } from '@salutejs/plasma-core';

import { config } from './Switch.config';

type SwitchPropsCustom = {
defaultChecked: boolean;
} & SwitchProps;

const mergedConfig = mergeConfig(switchConfig, config);
const SwitchComponent = component(mergedConfig);

export const Switch = SwitchComponent as React.ForwardRefExoticComponent<
SwitchProps & React.RefAttributes<HTMLInputElement>
SwitchPropsCustom & React.RefAttributes<HTMLInputElement>
>;
export type { SwitchProps };
4 changes: 3 additions & 1 deletion packages/plasma-web/api/plasma-web.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1909,7 +1909,9 @@ m: string;
}> & SubtitleProps & RefAttributes<HTMLDivElement>>;

// @public (undocumented)
export const Switch: ForwardRefExoticComponent<SwitchProps & RefAttributes<HTMLInputElement>>;
export const Switch: ForwardRefExoticComponent< {
defaultChecked: boolean;
} & SwitchProps & RefAttributes<HTMLInputElement>>;

export { SwitchProps }

Expand Down
6 changes: 5 additions & 1 deletion packages/plasma-web/src/components/Switch/Switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@ import type { SwitchProps } from '@salutejs/plasma-core';

import { config } from './Switch.config';

type SwitchPropsCustom = {
defaultChecked: boolean;
} & SwitchProps;

const mergedConfig = mergeConfig(switchConfig, config);
const SwitchComponent = component(mergedConfig);

export const Switch = SwitchComponent as React.ForwardRefExoticComponent<
SwitchProps & React.RefAttributes<HTMLInputElement>
SwitchPropsCustom & React.RefAttributes<HTMLInputElement>
>;
export type { SwitchProps };
Loading

0 comments on commit 4d1e995

Please sign in to comment.