-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(sdds-serv): Fix switch types and auto fix docs
- Loading branch information
Showing
10 changed files
with
66 additions
and
277 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.