-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
1,636 additions
and
153,671 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ | |
node_modules | ||
dist | ||
coverage | ||
.DS_Store | ||
.DS_Store | ||
.yarn-error.log |
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 |
---|---|---|
|
@@ -3,4 +3,5 @@ dist | |
.history | ||
node_modules | ||
yarn.lock | ||
coverage | ||
coverage | ||
storybook-static |
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,45 @@ | ||
# test directories | ||
__tests__ | ||
test | ||
tests | ||
powered-test | ||
|
||
# asset directories | ||
docs | ||
doc | ||
website | ||
images | ||
assets | ||
|
||
# examples | ||
example | ||
examples | ||
|
||
# code coverage directories | ||
coverage | ||
.nyc_output | ||
|
||
# build scripts | ||
Makefile | ||
Gulpfile.js | ||
Gruntfile.js | ||
|
||
# configs | ||
appveyor.yml | ||
circle.yml | ||
codeship-services.yml | ||
codeship-steps.yml | ||
wercker.yml | ||
.tern-project | ||
.gitattributes | ||
.editorconfig | ||
.*ignore | ||
.eslintrc | ||
.jshintrc | ||
.flowconfig | ||
.documentup.json | ||
.yarn-metadata.json | ||
.travis.yml | ||
|
||
# misc | ||
*.md |
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
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,3 @@ | ||
export const enum KeyCodes { | ||
ENTER = 'Enter', | ||
} |
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,43 @@ | ||
import './style.scss'; | ||
import * as React from 'react'; | ||
import { ComponentProps } from 'react'; | ||
import { prefixClaName, classNames, getBEMElement } from 'mo/common/className'; | ||
|
||
export interface ICheckbox extends ComponentProps<any> { | ||
id: string; | ||
value?: string; | ||
children?: ReactNode; | ||
onChange?(e: React.ChangeEvent, options?: ICheckbox): void; | ||
} | ||
|
||
export const checkboxClassName = prefixClaName('checkbox'); | ||
const checkboxLabelClassName = getBEMElement(checkboxClassName, 'label'); | ||
const checkboxInputClassName = getBEMElement(checkboxClassName, 'input'); | ||
|
||
export function Checkbox(props: ICheckbox) { | ||
const { className, id, children, value, onChange, ...custom } = props; | ||
|
||
const claNames = classNames(checkboxClassName, className); | ||
|
||
const handleCheckboxChange = (e: React.ChangeEvent<HTMLInputElement>) => { | ||
onChange?.(e, { id, value: e.target.value }); | ||
}; | ||
|
||
return ( | ||
<div className={claNames} {...(custom as any)}> | ||
<input | ||
id={id} | ||
type="checkbox" | ||
className={checkboxInputClassName} | ||
value={value} | ||
onChange={handleCheckboxChange} | ||
></input> | ||
<label | ||
htmlFor={id} | ||
className={classNames(checkboxLabelClassName, 'codicon')} | ||
> | ||
{children} | ||
</label> | ||
</div> | ||
); | ||
} |
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 @@ | ||
export * from './checkbox'; |
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,44 @@ | ||
@import 'mo/style/common'; | ||
$checkbox: prefix('checkbox'); | ||
|
||
#{$checkbox} { | ||
user-select: none; | ||
|
||
&__input { | ||
height: 0; | ||
visibility: hidden; | ||
width: 0; | ||
|
||
&[type='checkbox']:checked + label::before { | ||
content: '\eab2'; | ||
} | ||
} | ||
|
||
&__label { | ||
cursor: pointer; | ||
outline: none; | ||
padding-left: 26px; | ||
position: relative; | ||
|
||
&::before { | ||
border: 1px solid transparent; | ||
border-radius: 3px; | ||
box-sizing: border-box; | ||
content: ' '; | ||
display: inline-block; | ||
font: normal normal normal 16px/1 codicon; | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
height: 18px; | ||
left: 0; | ||
outline: 1px solid transparent; | ||
position: absolute; | ||
text-align: center; | ||
text-decoration: none; | ||
text-rendering: auto; | ||
top: 0; | ||
user-select: none; | ||
width: 18px; | ||
} | ||
} | ||
} |
Oops, something went wrong.