-
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.
feat(plasma-web): Replace
Checkbox
from plasma-new-hope
- Loading branch information
1 parent
f7f085e
commit 42e38cc
Showing
5 changed files
with
137 additions
and
10 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
75 changes: 75 additions & 0 deletions
75
packages/plasma-web/src/components/Checkbox/Checkbox.config.tsx
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 |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import { css } from '@salutejs/plasma-new-hope/styled-components'; | ||
|
||
export const config = { | ||
defaults: { | ||
view: 'accent', | ||
stories: 'm', | ||
focused: 'true', | ||
}, | ||
variations: { | ||
/** | ||
* Размер контрола. | ||
*/ | ||
size: { | ||
s: css` | ||
--plasma-checkbox-trigger-width: 0.875rem; | ||
--plasma-checkbox-trigger-height: 0.875rem; | ||
--plasma-checkbox-trigger-border-radius: 0.25rem; | ||
--plasma-checkbox-content-top-offset: 0.063rem; | ||
--plasma-checkbox-content-left-offset: 0.563rem; | ||
--plasma-checkbox-label-font-family: var(--plasma-typo-body-s-font-family); | ||
--plasma-checkbox-label-font-size: var(--plasma-typo-body-s-font-size); | ||
--plasma-checkbox-label-font-style: var(--plasma-typo-body-s-font-style); | ||
--plasma-checkbox-label-font-weight: var(--plasma-typo-body-s-font-weight); | ||
--plasma-checkbox-label-letter-spacing: var(--plasma-typo-body-s-letter-spacing); | ||
--plasma-checkbox-label-line-height: var(--plasma-typo-body-s-line-height); | ||
--plasma-checkbox-description-font-family: var(--plasma-typo-body-xs-font-family); | ||
--plasma-checkbox-description-font-size: var(--plasma-typo-body-xs-font-size); | ||
--plasma-checkbox-description-font-style: var(--plasma-typo-body-xs-font-style); | ||
--plasma-checkbox-description-font-weight: var(--plasma-typo-body-xs-font-weight); | ||
--plasma-checkbox-description-letter-spacing: var(--plasma-typo-body-xs-letter-spacing); | ||
--plasma-checkbox-description-line-height: var(--plasma-typo-body-xs-line-height); | ||
`, | ||
m: css` | ||
--plasma-checkbox-trigger-width: 1.25rem; | ||
--plasma-checkbox-trigger-height: 1.25rem; | ||
--plasma-checkbox-trigger-border-radius: 0.375rem; | ||
--plasma-checkbox-content-top-offset: 0.188rem; | ||
--plasma-checkbox-content-left-offset: 0.75rem; | ||
--plasma-checkbox-label-font-family: var(--plasma-typo-body-m-font-family); | ||
--plasma-checkbox-label-font-size: var(--plasma-typo-body-m-font-size); | ||
--plasma-checkbox-label-font-style: var(--plasma-typo-body-m-font-style); | ||
--plasma-checkbox-label-font-weight: var(--plasma-typo-body-m-font-weight); | ||
--plasma-checkbox-label-letter-spacing: var(--plasma-typo-body-m-letter-spacing); | ||
--plasma-checkbox-label-line-height: var(--plasma-typo-body-m-line-height); | ||
--plasma-checkbox-description-font-family: var(--plasma-typo-body-s-font-family); | ||
--plasma-checkbox-description-font-size: var(--plasma-typo-body-s-font-size); | ||
--plasma-checkbox-description-font-style: var(--plasma-typo-body-s-font-style); | ||
--plasma-checkbox-description-font-weight: var(--plasma-typo-body-s-font-weight); | ||
--plasma-checkbox-description-letter-spacing: var(--plasma-typo-body-s-letter-spacing); | ||
--plasma-checkbox-description-line-height: var(--plasma-typo-body-s-line-height); | ||
`, | ||
}, | ||
/** | ||
* Вид контрола. | ||
*/ | ||
view: { | ||
accent: css` | ||
--plasma-checkbox-view: var(--plasma-colors-accent); | ||
--plasma-checkbox-icon-color: var(--plasma-colors-white); | ||
--plasma-checkbox-description-color: var(--plasma-colors-secondary); | ||
--plasma-checkbox-trigger-border-color: var(--plasma-colors-secondary); | ||
`, | ||
}, | ||
disabled: { | ||
true: css` | ||
--plasma-checkbox-disabled-opacity: 0.4; | ||
`, | ||
}, | ||
focused: { | ||
true: css` | ||
--plasma-checkbox-focus-color: var(--plasma-colors-accent); | ||
`, | ||
}, | ||
}, | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { checkboxConfig, component, mergeConfig } from '@salutejs/plasma-new-hope/styled-components'; | ||
|
||
import { config } from './Checkbox.config'; | ||
|
||
const mergedConfig = mergeConfig(checkboxConfig, config); | ||
const CheckboxComponent = component(mergedConfig); | ||
|
||
export type CheckboxProps = typeof CheckboxComponent; | ||
|
||
/** | ||
* Флажок или чекбокс. Позволяет пользователю управлять параметром с двумя состояниями — ☑ включено и ☐ отключено. | ||
*/ | ||
export const Checkbox = CheckboxComponent; |
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,2 +1,2 @@ | ||
export { Checkbox } from '@salutejs/plasma-hope'; | ||
export type { CheckboxProps } from '@salutejs/plasma-hope'; | ||
export { Checkbox } from './Checkbox'; | ||
export type { CheckboxProps } from './Checkbox'; |