Skip to content

Fix CommonJS constant import #1513

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 23, 2018
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
6 changes: 3 additions & 3 deletions components/checkbox/__docs__/storybook-stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { storiesOf } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import IconSettings from '../../icon-settings';

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

import DefaultCheckbox from '../__examples__/default';

class CheckboxIndeterminate extends React.Component {
static displayName = `${FORMS_CHECKBOX}_INDETERMINATE`;
static displayName = `${CHECKBOX}_INDETERMINATE`;

state = {
indeterminate: true,
Expand Down Expand Up @@ -106,7 +106,7 @@ class CheckboxIndeterminate extends React.Component {
}
}

storiesOf(FORMS_CHECKBOX, module)
storiesOf(CHECKBOX, module)
.addDecorator((getStory) => (
<div className="slds-p-around--medium">
<IconSettings iconPath="/assets/icons">{getStory()}</IconSettings>
Expand Down
6 changes: 3 additions & 3 deletions components/checkbox/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import EventUtil from '../../utilities/event';
// This component's `checkProps` which issues warnings to developers about properties when in development mode (similar to React's built in development tools)
import checkProps from './check-props';

import { FORMS_CHECKBOX } from '../../utilities/constants';
import { CHECKBOX } from '../../utilities/constants';

const propTypes = {
/**
Expand Down Expand Up @@ -159,7 +159,7 @@ const defaultProps = {
*/
class Checkbox extends React.Component {
componentWillMount () {
checkProps(FORMS_CHECKBOX, this.props);
checkProps(CHECKBOX, this.props);
this.generatedId = shortid.generate();
}

Expand Down Expand Up @@ -384,7 +384,7 @@ class Checkbox extends React.Component {
}
}

Checkbox.displayName = FORMS_CHECKBOX;
Checkbox.displayName = CHECKBOX;
Checkbox.propTypes = propTypes;
Checkbox.defaultProps = defaultProps;

Expand Down
4 changes: 2 additions & 2 deletions components/input/__docs__/search/storybook-stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import React from 'react';
import { storiesOf, action } from '@storybook/react';
import IconSettings from '../../../icon-settings';

import { FORMS_SEARCH } from '../../../../utilities/constants';
import { SEARCH } from '../../../../utilities/constants';
import Search from '../../search';

storiesOf(FORMS_SEARCH, module)
storiesOf(SEARCH, module)
.addDecorator((getStory) => (
<div className="slds-p-around--medium">
<IconSettings iconPath="/assets/icons">{getStory()}</IconSettings>
Expand Down
4 changes: 2 additions & 2 deletions components/input/__docs__/storybook-stories.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { storiesOf, action } from '@storybook/react';

import { FORMS_INPUT } from '../../../utilities/constants';
import { INPUT } from '../../../utilities/constants';
import Button from '../../button';
import IconSettings from '../../icon-settings';
import Input from '../';
Expand Down Expand Up @@ -38,7 +38,7 @@ const searchIconClickable = (
/>
);

storiesOf(FORMS_INPUT, module)
storiesOf(INPUT, module)
.addDecorator((getStory) => (
<div className="slds-p-around--medium">{getStory()}</div>
))
Expand Down
6 changes: 3 additions & 3 deletions components/input/check-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import sunsetProperty from '../../utilities/warning/sunset-property';
// import oneOfRequiredProperty from '../../../utilities/warning/one-of-required-property';
import onlyOneOfProperties from '../../utilities/warning/only-one-of-properties';

import { FORMS_INPUT, FORMS_SEARCH } from '../../utilities/constants';
import { INPUT, SEARCH } from '../../utilities/constants';

let checkProps = function () {};

if (process.env.NODE_ENV !== 'production') {
checkProps = function (COMPONENT, props) {
if (COMPONENT === FORMS_INPUT) {
if (COMPONENT === INPUT) {
// Deprecated and changed to another property
deprecatedProperty(
COMPONENT,
Expand Down Expand Up @@ -81,7 +81,7 @@ if (process.env.NODE_ENV !== 'production') {
});
}
*/
} else if (COMPONENT === FORMS_SEARCH) {
} else if (COMPONENT === SEARCH) {
if (typeof props.assistiveText === 'string') {
sunsetProperty(
COMPONENT,
Expand Down
6 changes: 3 additions & 3 deletions components/input/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import Label from '../utilities/label';
// This component's `checkProps` which issues warnings to developers about properties when in development mode (similar to React's built in development tools)
import checkProps from './check-props';

import { FORMS_INPUT } from '../../utilities/constants';
import { INPUT } from '../../utilities/constants';

const defaultProps = {
assistiveText: {
Expand All @@ -47,7 +47,7 @@ const defaultProps = {
* The HTML `input` with a label and error messaging.
*/
const Input = createReactClass({
displayName: FORMS_INPUT,
displayName: INPUT,

propTypes: {
/**
Expand Down Expand Up @@ -279,7 +279,7 @@ const Input = createReactClass({

componentWillMount () {
// `checkProps` issues warnings to developers about properties (similar to React's built in development tools)
checkProps(FORMS_INPUT, this.props);
checkProps(INPUT, this.props);

this.generatedId = shortid.generate();
if (this.props.errorText) {
Expand Down
6 changes: 3 additions & 3 deletions components/input/search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import KEYS from '../../utilities/key-code';
import EventUtil from '../../utilities/event';

// ## Constants
import { FORMS_SEARCH } from '../../utilities/constants';
import { SEARCH } from '../../utilities/constants';

const handleKeyDown = (event, onSearch) => {
if (event.keyCode === KEYS.ENTER) {
Expand All @@ -39,7 +39,7 @@ const defaultProps = {
* A `Search` is an `Input` which renders the search icon by default. It can be cleared, too. All `Input` props not specified as props already may be used with this component and will override defaults.
*/
const Search = ({ clearable, onClear, onSearch, placeholder, ...props }) => {
checkProps(FORMS_SEARCH, props);
checkProps(SEARCH, props);
const assistiveText =
typeof props.assistiveText === 'string'
? props.assistiveText
Expand Down Expand Up @@ -75,7 +75,7 @@ const Search = ({ clearable, onClear, onSearch, placeholder, ...props }) => {
);
};

Search.displayName = FORMS_SEARCH;
Search.displayName = SEARCH;

Search.propTypes = {
/**
Expand Down
4 changes: 2 additions & 2 deletions components/navigation/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
// Alias
import VerticalNavigation from '../vertical-navigation';
import componentHasMoved from '../../utilities/warning/component-has-moved';
import { NAVIGATION } from '../../utilities/constants';
import { VERTICAL_NAVIGATION } from '../../utilities/constants';

componentHasMoved(NAVIGATION, {
componentHasMoved(VERTICAL_NAVIGATION, {
oldFileLocation: 'components/navigation',
newFileLocation: 'components/vertical-navigation',
});
Expand Down
4 changes: 2 additions & 2 deletions components/textarea/__docs__/storybook-stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import React from 'react';
import { storiesOf } from '@storybook/react';
import IconSettings from '../../icon-settings';

import { FORMS_TEXTAREA } from '../../../utilities/constants';
import { TEXTAREA } from '../../../utilities/constants';
import Textarea from '../';

storiesOf(FORMS_TEXTAREA, module)
storiesOf(TEXTAREA, module)
.addDecorator((getStory) => (
<div className="slds-p-around--medium">
<IconSettings iconPath="/assets/icons">{getStory()}</IconSettings>
Expand Down
6 changes: 3 additions & 3 deletions components/textarea/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ import shortid from 'shortid';
// This component's `checkProps` which issues warnings to developers about properties when in development mode (similar to React's built in development tools)
import checkProps from './check-props';

import { FORMS_TEXTAREA } from '../../utilities/constants';
import { TEXTAREA } from '../../utilities/constants';

/**
* A multi-line plain-text editing control.
*/
const Textarea = createReactClass({
displayName: FORMS_TEXTAREA,
displayName: TEXTAREA,

propTypes: {
/**
Expand Down Expand Up @@ -206,7 +206,7 @@ const Textarea = createReactClass({

componentWillMount () {
// `checkProps` issues warnings to developers about properties (similar to React's built in development tools)
checkProps(FORMS_TEXTAREA, this.props);
checkProps(TEXTAREA, this.props);

this.generatedId = shortid.generate();
if (this.props.errorText) {
Expand Down
8 changes: 4 additions & 4 deletions utilities/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ export const DATA_TABLE_ROW = 'SLDSDataTableRow';
export const DATE_PICKER = 'SLDSDatePicker';
export const DIALOG = 'SLDSDialog';
export const FILTER = 'SLDSFilter';
export const FORMS_CHECKBOX = 'SLDSCheckbox';
export const CHECKBOX = 'SLDSCheckbox';
export const FORMS_INLINE_EDIT = 'SLDSInlineEdit';
export const FORMS_INPUT = 'SLDSInput';
export const FORMS_TEXTAREA = 'SLDSTextarea';
export const FORMS_SEARCH = 'SLDSSearch';
export const INPUT = 'SLDSInput';
export const TEXTAREA = 'SLDSTextarea';
export const SEARCH = 'SLDSSearch';
export const GLOBAL_HEADER = 'SLDSGlobalHeader';
export const GLOBAL_HEADER_PROFILE = 'SLDSGlobalHeaderProfile';
export const GLOBAL_HEADER_SEARCH = 'SLDSGlobalHeaderSearch';
Expand Down
8 changes: 4 additions & 4 deletions utilities/warning/is-trigger-tabbable.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import {
BUTTON,
BUTTON_STATEFUL,
BUTTON_GROUP,
FORMS_CHECKBOX,
CHECKBOX,
DATE_PICKER,
FORMS_INPUT,
INPUT,
LOOKUP,
TIME_PICKER,
} from '../../utilities/constants';
Expand Down Expand Up @@ -40,9 +40,9 @@ if (process.env.NODE_ENV !== 'production') {
trigger.type.displayName !== BUTTON &&
trigger.type.displayName !== BUTTON_STATEFUL &&
trigger.type.displayName !== BUTTON_GROUP &&
trigger.type.displayName !== FORMS_CHECKBOX &&
trigger.type.displayName !== CHECKBOX &&
trigger.type.displayName !== DATE_PICKER &&
trigger.type.displayName !== FORMS_INPUT &&
trigger.type.displayName !== INPUT &&
trigger.type.displayName !== LOOKUP &&
trigger.type.displayName !== TIME_PICKER
) {
Expand Down