Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/app-launcher/__docs__/storybook-stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import AppLauncherTile from '../../app-launcher/tile';
import AppLauncherSection from '../../app-launcher/section';
import Icon from '../../icon';
import Button from '../../button';
import Search from '../../forms/input/search';
import Search from '../../input/search';

import GlobalNavigationBar from '../../global-navigation-bar';
import GlobalNavigationBarRegion from '../../global-navigation-bar/region';
Expand Down
2 changes: 1 addition & 1 deletion components/app-launcher/__examples__/default.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import GlobalNavigationBarRegion from '~/components/global-navigation-bar/region

import Icon from '~/components/icon';
import Button from '~/components/button';
import Search from '~/components/forms/input/search';
import Search from '~/components/input/search';
import IconSettings from '~/components/icon-settings';

const Example = createReactClass({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import IconSettings from '../../icon-settings';
import AppLauncher from '../../app-launcher';
import AppLauncherTile from '../../app-launcher/tile';
import AppLauncherSection from '../../app-launcher/section';
import Search from '../../forms/input/search';
import Search from '../../input/search';
import Button from '../../button';

/* eslint-disable react/no-find-dom-node */
Expand Down
6 changes: 3 additions & 3 deletions components/app-launcher/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const AppLauncher = createReactClass({
*/
onClose: PropTypes.func,
/**
* Search bar for the Modal's header. Will typically be an instance of `design-system-react/forms/input/search`
* Search bar for the Modal's header. Will typically be an instance of `design-system-react/input/search`
*/
search: PropTypes.node,
/**
Expand Down Expand Up @@ -147,15 +147,15 @@ const AppLauncher = createReactClass({
this.setState({ isOpen: true });

if (isFunction(this.props.triggerOnClick)) {
this.props.triggerOnClick(event);
this.props.triggerOnClick(event, {});
}
},

closeAppLauncher (event) {
this.setState({ isOpen: false });

if (isFunction(this.props.onClose)) {
this.props.onClose(event);
this.props.onClose(event, {});
}
},

Expand Down
2 changes: 1 addition & 1 deletion components/app-launcher/section.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const AppLauncherSection = createReactClass({
this.setState({ isOpen: !this.state.isOpen });

if (isFunction(this.props.onToggleClick)) {
this.props.onToggleClick(event);
this.props.onToggleClick(event, {});
}
},

Expand Down
2 changes: 1 addition & 1 deletion components/button-group/__examples__/checkbox-error.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import createReactClass from 'create-react-class';
import ButtonGroup from '~/components/button-group';
import Checkbox from '~/components/forms/checkbox';
import Checkbox from '~/components/checkbox';

const Example = createReactClass({
displayName: 'ButtonGroupExample',
Expand Down
2 changes: 1 addition & 1 deletion components/button-group/__examples__/checkbox.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import createReactClass from 'create-react-class';
import ButtonGroup from '~/components/button-group';
import Checkbox from '~/components/forms/checkbox';
import Checkbox from '~/components/checkbox';

const Example = createReactClass({
displayName: 'ButtonGroupExample',
Expand Down
2 changes: 1 addition & 1 deletion components/button/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ const Button = createReactClass({

handleClick (event) {
if (this.props.onClick) {
this.props.onClick(event);
this.props.onClick(event, {});
}
},

Expand Down
2 changes: 1 addition & 1 deletion components/card/filter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import React from 'react';
import PropTypes from 'prop-types';

import Input from '../forms/input';
import Input from '../input';
import InputIcon from '../icon/input-icon';

import { CARD_FILTER } from '../../utilities/constants';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import React from 'react';
import createReactClass from 'create-react-class';
import { storiesOf, action } from '@storybook/react';
import IconSettings from '../../../icon-settings';
import { storiesOf } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import IconSettings from '../../icon-settings';

import { FORMS_CHECKBOX } from '../../../../utilities/constants';
import { FORMS_CHECKBOX } from '../../../utilities/constants';
import Checkbox from '../';
import Button from '../../../button';
import Button from '../../button';

const CheckboxIndeterminate = createReactClass({
displayName: `${FORMS_CHECKBOX}_INDETERMINATE`,
import DefaultCheckbox from '../__examples__/default';

getInitialState () {
return {
indeterminate: true,
checked: true,
currentStateHelper: 'Indeterminate',
};
},
class CheckboxIndeterminate extends React.Component {
static displayName = `${FORMS_CHECKBOX}_INDETERMINATE`;

state = {
indeterminate: true,
checked: true,
currentStateHelper: 'Indeterminate',
};

handleChange (checked, event, data) {
handleChange = (checked, event, data) => {
const checkedLabel = data.checked ? 'Checked' : 'Unchecked';
this.setState({
checked: data.checked,
Expand All @@ -32,9 +32,9 @@ const CheckboxIndeterminate = createReactClass({
`checked: ${data.checked},
indeterminate: ${data.indeterminate}`
);
},
};

changeToIndeterminate (event) {
changeToIndeterminate = (event) => {
this.setState({
currentStateHelper: 'Indeterminate',
checked: true,
Expand All @@ -44,25 +44,25 @@ const CheckboxIndeterminate = createReactClass({
event,
'checked: true, indeterminate: true'
);
},
};

changeToCheck (event) {
changeToCheck = (event) => {
this.setState({
currentStateHelper: 'Checked',
checked: true,
indeterminate: false,
});
action('changeToCheck')(event, 'checked: true, indeterminate: false');
},
};

changeToUnChecked (event) {
changeToUnChecked = (event) => {
this.setState({
currentStateHelper: 'Unchecked',
checked: false,
indeterminate: false,
});
action('changeToUnChecked')(event, 'checked: false, indeterminate: false');
},
};

render () {
return (
Expand All @@ -74,7 +74,9 @@ const CheckboxIndeterminate = createReactClass({
<strong>Current State:</strong> {this.state.currentStateHelper}
</p>
<Checkbox
assistiveText="Checkbox (indeterminate)"
assistiveText={{
label: 'Checkbox (indeterminate)',
}}
label="Checkbox Label"
name="checkbox-example-standard-indeterminate"
checked={this.state.checked}
Expand All @@ -101,63 +103,31 @@ const CheckboxIndeterminate = createReactClass({
</div>
</div>
);
},
});
}
}

storiesOf(FORMS_CHECKBOX, module)
.addDecorator((getStory) => (
<div className="slds-p-around--medium">
<IconSettings iconPath="/assets/icons">{getStory()}</IconSettings>
</div>
))
.add('Checkbox', () => (
<Checkbox
label="Checkbox Label"
name="checkbox-example-base"
onChange={action('change')}
onBlur={(e) => {
console.log('bluring ', e.target);
}}
/>
))
.add('Checkbox (with error)', () => (
<Checkbox
label="Checkbox Label"
name="checkbox-example-base-error"
errorText="This field has an error."
onChange={action('change')}
onBlur={(e) => {
console.log('bluring ', e.target);
}}
/>
))
.add('Checkbox (required)', () => (
<Checkbox
label="Checkbox Label"
name="checkbox-example-base-required"
onChange={action('change')}
required
/>
))
.add('Checkbox (disabled)', () => (
<Checkbox
label="Checkbox Label"
name="checkbox-example-base-disabled"
onChange={action('change')}
disabled
/>
.add('Checkbox (default, indeterminate, required, disabled', () => (
<DefaultCheckbox />
))
.add('Checkbox (assistive text)', () => (
<div>
<Checkbox
assistiveText="This is my checkbox.
assistiveText={{
label: `This is my checkbox.
There are many like it, but this one is mine.
My checkbox is my best friend.
It is my life.
I must master it as I must master my life.
Without me, my checkbox is useless. Without my checkbox, I am useless.
I must make my checkbox true.
I must make it truer than my radio button who is trying to... "
I must make it truer than my radio button who is trying to... `,
}}
label="Checkbox Label"
name="checkbox-example-base-assistiveText"
onChange={action('change')}
Expand Down Expand Up @@ -236,14 +206,16 @@ storiesOf(FORMS_CHECKBOX, module)
.add('Checkbox Toggle (assistive text)', () => (
<div>
<Checkbox
assistiveText="This is my checkbox.
assistiveText={{
label: `This is my checkbox.
There are many like it, but this one is mine.
My checkbox is my best friend.
It is my life.
I must master it as I must master my life.
Without me, my checkbox is useless. Without my checkbox, I am useless.
I must make my checkbox true.
I must make it truer than my radio button who is trying to... "
I must make it truer than my radio button who is trying to... `,
}}
label="Checkbox Label"
name="checkbox-example-base-assistiveText"
onChange={action('change')}
Expand Down
74 changes: 74 additions & 0 deletions components/checkbox/__examples__/default.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import React from 'react';
// `~` is replaced with design-system-react at runtime
import IconSettings from '~/components/icon-settings';
import Checkbox from '~/components/checkbox';

class Example extends React.Component {
static displayName = 'CheckboxExample';

render () {
return (
<IconSettings iconPath="/assets/icons">
<div className="slds-grid slds-grid--pull-padded slds-grid--vertical-align-center">
<div className="slds-col--padded">
<Checkbox
assistiveText={{
label: 'Default',
}}
labels={{
label: 'Default',
}}
onChange={(e) => {
console.log('onChange ', e.target);
}}
/>
</div>
<div className="slds-col--padded">
<Checkbox
assistiveText={{
label: 'Indeterminate',
}}
indeterminate
labels={{
label: 'Indeterminate',
}}
onChange={(e) => {
console.log('onChange ', e.target);
}}
/>
</div>
<div className="slds-col--padded">
<Checkbox
assistiveText={{
label: 'Indeterminate',
}}
labels={{
label: 'Required',
}}
required
onChange={(e) => {
console.log('onChange ', e.target);
}}
/>
</div>
<div className="slds-col--padded">
<Checkbox
assistiveText={{
label: 'Disabled',
}}
labels={{
label: 'Disabled',
}}
disabled
onChange={(e) => {
console.log('onChange ', e.target);
}}
/>
</div>
</div>
</IconSettings>
);
}
}

export default Example; // export is replaced with `ReactDOM.render(<Example />, mountNode);` at runtime
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import React from 'react';
import createReactClass from 'create-react-class';
// `~` is replaced with design-system-react at runtime
import IconSettings from '~/components/icon-settings';
import Checkbox from '~/components/forms/checkbox'; // `~` is replaced with design-system-react at runtime

const Example = createReactClass({
displayName: 'CheckboxExample',
import Checkbox from '~/components/checkbox';

class Example extends React.Component {
render () {
return (
<IconSettings iconPath="/assets/icons">
Expand All @@ -19,7 +17,9 @@ const Example = createReactClass({
</div>
<div className="slds-col--padded">
<Checkbox
assistiveText="Indeterminate"
assistiveText={{
label: 'Indeterminate',
}}
indeterminate
label="Indeterminate"
/>
Expand All @@ -33,7 +33,9 @@ const Example = createReactClass({
</div>
</IconSettings>
);
},
});
}
}

Example.displayName = 'CheckboxExample';

export default Example; // export is replaced with `ReactDOM.render(<Example />, mountNode);` at runtime
Loading