Skip to content

Commit ffb0c8c

Browse files
author
David Brainer-Banker
committed
Merge branch 'master' into GH315_input-icon-accessibility
# Conflicts: # components/forms/input/index.jsx # tests/input/input.test.jsx
2 parents a6c52da + 375c200 commit ffb0c8c

File tree

30 files changed

+737
-94
lines changed

30 files changed

+737
-94
lines changed

README-dist.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
Welcome to [Design System React](https://design-system-react.herokuapp.com).
2+
Welcome to [Design System React](https://react.lightningdesignsystem.com/).
33

44
Presented here are Javascript components based on [Lightning Design System](https://www.lightningdesignsystem.com/) and designed for React.
55

@@ -8,6 +8,6 @@ Presented here are Javascript components based on [Lightning Design System](http
88

99
## Documentation
1010

11-
[Design System React website](https://design-system-react.herokuapp.com)
11+
[Design System React website](https://react.lightningdesignsystem.com/)
1212

13-
[Salesforce Lightning Design System website](https://www.lightningdesignsystem.com)
13+
[Salesforce Lightning Design System website](https://www.lightningdesignsystem.com/)

README.md

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ For example, `SLDSMenuDropdown` represents [Lightning Design System Menu > Dropd
99
and `SLDSLookup` represents [Lightning Design System Lookup > Base](http://www.lightningdesignsystem.com/components/lookups/#base).
1010

1111

12-
This project is in beta and very experimental. Please visit [Design System React](https://react.lightningdesignsystem.com/) for documentation and examples of using the Design System React Components. If you are using the ECMAScript 6 source files in `./components/`, you will need to enable your ES5 transpiler to allow stage-1 proposed features. If you are using Babel, it may be helpful to install the NPM module, `babel-preset-stage-1`, into your project and review the `.babelrc` file in this project.
12+
This project is in beta and very experimental. Please visit [Design System React](https://react.lightningdesignsystem.com/) for documentation and examples of using the Design System React Components. If you are using the ECMAScript 6 source files in `./components/`, you will need to enable your ES5 transpiler to allow stage-1 proposed features. If you are using Babel, it may be helpful to install the NPM module `babel-preset-stage-1` into your project and review the `.babelrc` file in this project.
1313

1414
### Run local server
1515

@@ -33,7 +33,7 @@ npm run dist
3333

3434
## Getting Started
3535

36-
Note: `design-system-react` is optimized for React 0.14.x and uses Lightning Design System 1.0.3.
36+
Note: `design-system-react` is optimized for React 0.14.x and uses Lightning Design System 2.1.0-beta.3. You can find a more complete [getting started guide](https://react.lightningdesignsystem.com/getting-started) on the documentation site.
3737

3838
### NPM
3939

@@ -42,7 +42,7 @@ Because this project is not open-sourced, we cannot publish it to npm. Therefore
4242
```
4343
# package.json
4444
45-
"design-system-react": "git+ssh://[email protected]:salesforce-ux/design-system-react.git#v0.0.30",
45+
"design-system-react": "git+ssh://[email protected]:salesforce-ux/design-system-react.git#v0.0.32",
4646
```
4747

4848
Then, in your React code, import each Lightning Design System component you need.
@@ -71,25 +71,7 @@ Note: the SLDSPopoverTooltip requires a focusable element as a child (ie. either
7171
```
7272

7373
## FAQ
74-
1. **What is the [Lightning Design System](http://www.lightningdesignsystem.com/)?**
75-
76-
It is collection of design patterns, components, and guidelines for creating unified UI in the Salesforce ecosystem.
77-
78-
2. **How is the Design System React Library different than the Lightning Design System?**
79-
80-
The Lightning Design System consists of static markup components. The Design System React Library is the ReactJS implementation.
81-
82-
3. **Are the Design System React components accessible?**
83-
84-
We strive to make all components accessible for keyboard users and screen readers. If you find any accessibility bugs, please submit a [Github Issue](https://github.com/salesforce-ux/design-system-react/issues).
85-
86-
4. **Which version of React and Lightning Design System do you support?**
87-
88-
Design System React is optimized for React 0.14.x and uses Lightning Design System 1.0.3.
89-
90-
5. **Which browsers are supported?**
91-
92-
We support the same browsers as the Lightning Design System. Please visit [Lightning Design System - FAQ](http://www.lightningdesignsystem.com/faq/#what-browsers-are-supported) for details.
74+
Read our [FAQ](https://react.lightningdesignsystem.com/faq) on the documentation site.
9375

9476
## Contributing to the code base
9577

RELEASENOTES.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@
22
# React Components: design-system-react
33
# Release notes
44

5+
## Release 0.0.32
6+
- Added containerClassName prop to Spinner
7+
8+
## Release 0.0.31
9+
10+
**MAJOR CHANGES**
11+
- Added new Spinner component
12+
- Updated the ContextBar component
13+
- Added a highlighting utility
14+
- Added a custom cell type to DataTable using the highlighter
15+
16+
**OTHER**
17+
- Remove isRequired for iconCategory in ButtonGroup
18+
- Additional bug fixes and code cleanup
19+
520
## Release 0.0.29
621

722
**MAJOR CHANGES**

components/button-group/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
1010
*/
1111

1212
import React from 'react';
13-
const classNames = require('classnames');
13+
import classNames from 'classnames';
1414

1515
import { BUTTON_GROUP } from '../../utilities/constants';
1616

components/button/index.jsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,18 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
1010
*/
1111

1212
import React from 'react';
13-
const classNames = require('classnames');
13+
import classNames from 'classnames';
1414
import ButtonIcon from '../icon/button-icon';
1515
import TooltipTrigger from '../popover-tooltip/trigger';
1616
import omit from 'lodash.omit';
1717

1818
import { BUTTON } from '../../utilities/constants';
1919

20+
// ### shortid
21+
// [npmjs.com/package/shortid](https://www.npmjs.com/package/shortid)
22+
// shortid is a short, non-sequential, url-friendly, unique id generator
23+
import shortid from 'shortid';
24+
2025
const displayName = BUTTON;
2126
const propTypes = {
2227
/**
@@ -34,7 +39,7 @@ const propTypes = {
3439
*/
3540
iconName: React.PropTypes.string,
3641

37-
iconCategory: React.PropTypes.oneOf(['action', 'custom', 'doctype', 'standard', 'utility']).isRequired,
42+
iconCategory: React.PropTypes.oneOf(['action', 'custom', 'doctype', 'standard', 'utility']),
3843
/**
3944
* If omitted, icon position is centered.
4045
*/
@@ -65,6 +70,7 @@ const propTypes = {
6570
variant: React.PropTypes.oneOf(['base', 'neutral', 'brand', 'destructive', 'icon', 'inverse', 'icon-inverse'])
6671
};
6772
const defaultProps = {
73+
id: shortid.generate(),
6874
disabled: false,
6975
hint: false,
7076
iconSize: 'medium',

components/card/index.jsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ import Empty from './empty';
3232
// Removes the need for `PropTypes`.
3333
const { PropTypes } = React;
3434

35+
// ### shortid
36+
// [npmjs.com/package/shortid](https://www.npmjs.com/package/shortid)
37+
// shortid is a short, non-sequential, url-friendly, unique id generator
38+
import shortid from 'shortid';
39+
3540
import { CARD } from '../../utilities/constants';
3641

3742
// Allow for predicatable DOM queries with `querySelectorAll(cssClasses.base)`
@@ -84,11 +89,12 @@ const Card = React.createClass({
8489
/**
8590
* Set the HTML `id` of the card. This also sets the `id` of the filter and the header actions.
8691
*/
87-
id: PropTypes.string.isRequired
92+
id: PropTypes.string
8893
},
8994

9095
getDefaultProps () {
9196
return {
97+
id: shortid.generate(),
9298
heading: 'Related Items'
9399
};
94100
},

components/data-table/index.jsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
1818
// ### React
1919
import React from 'react';
2020

21+
// ### shortid
22+
// [npmjs.com/package/shortid](https://www.npmjs.com/package/shortid)
23+
// shortid is a short, non-sequential, url-friendly, unique id generator
24+
import shortid from 'shortid';
25+
2126
// ### classNames
2227
import classNames from 'classnames';
2328

@@ -33,9 +38,6 @@ import isFunction from 'lodash.isfunction';
3338
// ### reject
3439
import reject from 'lodash.reject';
3540

36-
// ### uniqueId
37-
import uniqueId from 'lodash.uniqueid';
38-
3941
// This component's `checkProps` which issues warnings to developers about properties when in development mode (similar to React's built in development tools)
4042
import checkProps from './check-props';
4143

@@ -86,12 +88,15 @@ const DataTable = React.createClass({
8688
* Class names to be added to the table.
8789
*/
8890
className: PropTypes.oneOfType([PropTypes.array, PropTypes.object, PropTypes.string]),
91+
/**
92+
* A unique ID is needed in order to support keyboard navigation and ARIA support.
93+
*/
8994
id: PropTypes.string,
90-
/**
95+
/**
9196
* The collection of items to render in the table.
9297
*/
9398
items: PropTypes.array.isRequired,
94-
/**
99+
/**
95100
* This function fires when the selection of rows changes.
96101
*/
97102
onChange: PropTypes.func,
@@ -124,7 +129,7 @@ const DataTable = React.createClass({
124129
getDefaultProps () {
125130
return {
126131
bordered: false,
127-
id: uniqueId(`${DATA_TABLE}-`),
132+
id: shortid.generate(),
128133
selection: [],
129134
selectRows: false,
130135
stacked: false,

components/forms/checkbox/index.jsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ import React from 'react';
1919
// ### isFunction
2020
import isFunction from 'lodash.isfunction';
2121

22-
// ### uniqueId
23-
import uniqueId from 'lodash.uniqueid';
22+
// ### shortid
23+
// [npmjs.com/package/shortid](https://www.npmjs.com/package/shortid)
24+
// shortid is a short, non-sequential, url-friendly, unique id generator
25+
import shortid from 'shortid';
2426

2527
// ### Event Helpers
2628
import { KEYS, EventUtil } from '../../../utilities';
@@ -68,6 +70,9 @@ const Checkbox = React.createClass({
6870
* Message to display when the Checkbox is in an error state. When this is present, also visually highlights the component as in error.
6971
*/
7072
errorText: React.PropTypes.string,
73+
/**
74+
* A unique ID is needed in order to support keyboard navigation and ARIA support.
75+
*/
7176
id: PropTypes.string,
7277
/**
7378
* An optional label for the Checkbox.
@@ -85,7 +90,7 @@ const Checkbox = React.createClass({
8590

8691
getDefaultProps () {
8792
return {
88-
id: uniqueId(`${FORMS_CHECKBOX}-`)
93+
id: shortid.generate()
8994
};
9095
},
9196

components/forms/input/check-props.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,17 @@ let checkProps = function () {};
1717

1818
if (process.env.NODE_ENV !== 'production') {
1919
checkProps = function (COMPONENT, props) {
20-
/* eslint-disable max-len */
21-
oneOfRequiredProperty(COMPONENT, {
22-
assistiveText: props.assistiveText,
23-
label: props.label
24-
});
20+
if (!props.inlineEditTrigger) {
21+
oneOfRequiredProperty(COMPONENT, {
22+
assistiveText: props.assistiveText,
23+
label: props.label
24+
});
25+
}
26+
2527
onlyOneOfProperties(COMPONENT, {
2628
assistiveText: props.assistiveText,
2729
label: props.label
2830
});
29-
/* eslint-enable max-len */
3031
};
3132
}
3233

components/forms/input/index.jsx

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
1717
// React is an external dependency of the project.
1818
import React from 'react';
1919

20+
// ### shortid
21+
// [npmjs.com/package/shortid](https://www.npmjs.com/package/shortid)
22+
// shortid is a short, non-sequential, url-friendly, unique id generator
23+
import shortid from 'shortid';
24+
2025
// ### classNames
2126
// [github.com/JedWatson/classnames](https://github.com/JedWatson/classnames)
2227
// This project uses `classnames`, "a simple javascript utility for conditionally
@@ -104,7 +109,7 @@ const Input = React.createClass({
104109
/**
105110
* Every input must have a unique ID in order to support keyboard navigation and ARIA support.
106111
*/
107-
id: PropTypes.string.isRequired,
112+
id: PropTypes.string,
108113
/**
109114
* This label appears above the input.
110115
*/
@@ -113,6 +118,10 @@ const Input = React.createClass({
113118
* This event fires when the input changes.
114119
*/
115120
onChange: PropTypes.func,
121+
/**
122+
* This event fires when the input is clicked.
123+
*/
124+
onClick: PropTypes.func,
116125
/**
117126
* This event fires when the icon is clicked.
118127
*/
@@ -161,6 +170,7 @@ const Input = React.createClass({
161170

162171
getDefaultProps () {
163172
return {
173+
id: shortid.generate(),
164174
iconPosition: 'left',
165175
type: 'text'
166176
};
@@ -197,8 +207,11 @@ const Input = React.createClass({
197207
iconName,
198208
iconPosition,
199209
id,
210+
inlineEditTrigger, // eslint-disable-line react/prop-types
200211
label,
201212
onChange,
213+
onClick,
214+
onIconClick, // eslint-disable-line no-unused-vars
202215
placeholder,
203216
readOnly,
204217
required,
@@ -241,7 +254,7 @@ const Input = React.createClass({
241254
'slds-input-has-icon',
242255
`slds-input-has-icon--${iconPosition}`
243256
], {
244-
'slds-has-divider--bottom': readOnly
257+
'slds-has-divider--bottom': readOnly && !inlineEditTrigger
245258
})}
246259
>
247260
{hasIcon && this.getIconRender('left')}
@@ -254,16 +267,17 @@ const Input = React.createClass({
254267
disabled={disabled}
255268
id={id}
256269
onChange={onChange}
270+
onClick={onClick}
257271
placeholder={placeholder}
258272
required={required}
259273
type={type}
260274
value={value}
261275
/>}
262-
263276
{hasIcon && this.getIconRender('right')}
264277

265-
{readOnly && <span className="slds-form-element__static">
278+
{readOnly && <span className="slds-form-element__static" onClick={onClick}>
266279
{value}
280+
{inlineEditTrigger}
267281
</span>}
268282
</div>
269283
{errorText && <div className="slds-form-element__help">{errorText}</div>}

0 commit comments

Comments
 (0)