Skip to content

Commit 1b33023

Browse files
Release commit for 0.8.0-commonjs [ci skip]
0 parents  commit 1b33023

File tree

1,264 files changed

+144069
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,264 files changed

+144069
-0
lines changed

.gitignore

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# filesystem
2+
.DS_Store
3+
4+
# dependencies
5+
node_modules
6+
7+
# gh-pages
8+
_site/*
9+
10+
# Editors / IDEs
11+
.idea
12+
.vscode
13+
*.sublime-project
14+
*.sublime-workspace
15+
16+
# node_module cache for TravisCI, etc.
17+
node_modules.tar.gz
18+
19+
npm-debug.log
20+
.esformatter
21+
.npm
22+
.tmp*
23+
server/node_modules
24+
server/public/assets/bundle
25+
scripts/pre-commit.sh
26+
coverage/
27+
storybook/
28+
29+
# For build server
30+
design-system-react
31+
32+
package-lock.json

CONTRIBUTING.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Contributing to Design System React
2+
3+
## The process
4+
1. Read the [Codebase Overview](docs/codebase-overview.md) to learn concepts and best practices for the codebase and to confirm it is within project scope.
5+
1. Create a new issue before starting your solution to keep track of what you are trying to contribute. That way, we can also offer suggestions or let you know if there is already an effort in progress.
6+
1. Fork this repository, clone your fork locally. Create a topic branch locally.
7+
1. Add the component to `/components` folder
8+
1. Add the component name to `constants.js`
9+
1. Add Storybook examples to `/examples`
10+
1. Add documentation site examples to `/examples/index.js`
11+
1. Add tests to `/tests`.
12+
1. Push to your username's forked repository.
13+
1. Send us a well-documented pull request based on `master` from your forked repository. GitHub pull requests should have a descriptive title, a brief summary, @mention several relevant people to review the code, add helpful GitHub comments on lines where you have questions or concerns.
14+
1. We'll review your code, suggest any needed changes, and hopefully merge it in. Thank you!
15+
16+
## Contributing Guidelines
17+
- UX pattern / design must exist in [SLDS](https://www.lightningdesignsystem.com/). Components in the process of being added to SLDS will be considered as prototypes.
18+
- All new props and components need tests. **Please review the [testing readme](/tests/README.md)**
19+
- Follow Eslint settings.
20+
- If you are adding a feature, [add a story](https://storybook.js.org/basics/writing-stories/) to the React Storybook that uses your feature, so that reviewers can test it.
21+
- Stories are stored in [examples folder](/examples) along with Documentation site examples. To add a story to the interactive examples on the [documentation site](https://react.lightningdesignsystem.com/components/), add the JSX file to [examples/index.js](/examples/index.js). All examples that are present for a component in the [SLDS website](https://www.lightningdesignsystem.com/) or it's internal site should be created as a Storybook story _and_ listed in `examples/index.js`.
22+
- Prop description tables on the documentation site are generated from propType comments within the component. All props descriptions should have a _Tested with snapshot testing._ or _Tested with Mocha framework._ notice in them.
23+
- Introductory component descriptions are generated from the comment directly before the component declaration with [react-docgen](https://github.com/reactjs/react-docgen).
24+
25+
## The review process (internal)
26+
- `git clone` this repository
27+
- `npm install`
28+
- Pull down the pull requested branch. It will be within the contributor's forked repository. For instance, `git checkout -b interactivellama-data-table-width master` then `git pull [email protected]:interactivellama/design-system-react.git data-table-width`. You could also create an additional remote and pull down the branch directly.
29+
- `npm start` and review the appropriate React Story example at `http://localhost:9001/`. Open `http://localhost:8001/` and confirm that tests are passing in your environment.
30+
- Check that any modified or added examples for the documentation site are working and are present in `examples/index.js`.
31+
4. Request a review of the new component/feature by the Salesforce UX Accessibility Team.
32+
33+
## Testing the documentation site (internal)
34+
1. Pull down the documentation site and place in the same parent folder as this library: `git clone [email protected]:salesforce-ux/design-system-react-site.git` and run `npm install`.
35+
`.
36+
1. Run `npm run local-update` from within `design-system-react-site` to build, copy, and serve a local version of this library into the site. You should be able to now view the updated site at `http://localhost:8080/` and resolve any issues with updated documentation.

LICENSE.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Copyright (c) 2015-present, Salesforce.com, Inc.
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions are met:
6+
* Redistributions of source code must retain the above copyright
7+
notice, this list of conditions and the following disclaimer.
8+
* Redistributions in binary form must reproduce the above copyright
9+
notice, this list of conditions and the following disclaimer in the
10+
documentation and/or other materials provided with the distribution.
11+
* Neither the name of the Salesforce.com nor the
12+
names of its contributors may be used to endorse or promote products
13+
derived from this software without specific prior written permission.
14+
15+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18+
DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
19+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
Welcome to [Design System React](https://react.lightningdesignsystem.com/).
3+
4+
Presented here are Javascript components based on [Lightning Design System](https://www.lightningdesignsystem.com/) and designed for React.
5+
6+
* Tailored for building Salesforce apps: Using Design System React ensures that your app's UI reflect the Salesforce Lightning look, feel, and behaviors.
7+
* Continuously updated: As long as you’re using the latest version of Design System React, your pages are always up to date with Salesforce UI changes.
8+
9+
## Documentation
10+
11+
[Design System React website](https://react.lightningdesignsystem.com/)
12+
13+
[Salesforce Lightning Design System website](https://www.lightningdesignsystem.com/)

components/SLDSSettings.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
'use strict';
2+
3+
Object.defineProperty(exports, "__esModule", {
4+
value: true
5+
});
6+
7+
var _settings = require('./settings');
8+
9+
var _settings2 = _interopRequireDefault(_settings);
10+
11+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12+
13+
exports.default = _settings2.default; // Alias
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
'use strict';
2+
3+
// This object is imported into the documentation site. An example for the documentation site should be part of the pull request for the component. The object key is the kabob case of the "URL folder". In the case of `http://localhost:8080/components/app-launcher/`, `app-launcher` is the `key`. The folder name is created by `components.component` value in `package.json`. Keep in mind, some components like `forms/checkbox` will be changed to `forms-checkbox`. The following uses webpack's raw-loader plugin to get "text files" that will be eval()'d by CodeMirror within the documentation site on page load.
4+
5+
/* eslint-env node */
6+
/* eslint-disable global-require */
7+
8+
var siteStories = [require('raw-loader!design-system-react/components/accordion/__examples__/base.jsx')];
9+
10+
module.exports = siteStories;
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
'use strict';
2+
3+
var _react = require('react');
4+
5+
var _react2 = _interopRequireDefault(_react);
6+
7+
var _react3 = require('@storybook/react');
8+
9+
var _constants = require('../../../utilities/constants');
10+
11+
var _base = require('../__examples__/base');
12+
13+
var _base2 = _interopRequireDefault(_base);
14+
15+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16+
17+
(0, _react3.storiesOf)(_constants.ACCORDION, module).addDecorator(function (getStory) {
18+
return _react2.default.createElement(
19+
'div',
20+
{ className: 'slds-p-around--medium' },
21+
getStory()
22+
);
23+
}).add('Base', function () {
24+
return _react2.default.createElement(_base2.default, { action: _react3.action });
25+
});
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
'use strict';
2+
3+
Object.defineProperty(exports, "__esModule", {
4+
value: true
5+
});
6+
7+
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
8+
9+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
10+
11+
var _react = require('react');
12+
13+
var _react2 = _interopRequireDefault(_react);
14+
15+
var _accordion = require('../../../../components/accordion');
16+
17+
var _accordion2 = _interopRequireDefault(_accordion);
18+
19+
var _panel = require('../../../../components/accordion/panel');
20+
21+
var _panel2 = _interopRequireDefault(_panel);
22+
23+
var _iconSettings = require('../../../../components/icon-settings');
24+
25+
var _iconSettings2 = _interopRequireDefault(_iconSettings);
26+
27+
var _menuDropdown = require('../../../../components/menu-dropdown');
28+
29+
var _menuDropdown2 = _interopRequireDefault(_menuDropdown);
30+
31+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
32+
33+
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
34+
35+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
36+
37+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
38+
39+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
40+
41+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // `~` is replaced with design-system-react at runtime
42+
// `~` is replaced with design-system-react at runtime
43+
// `~` is replaced with design-system-react at runtime
44+
45+
46+
// `~` is replaced with design-system-react at runtime
47+
48+
var Example = function (_React$Component) {
49+
_inherits(Example, _React$Component);
50+
51+
function Example(props) {
52+
_classCallCheck(this, Example);
53+
54+
var _this = _possibleConstructorReturn(this, (Example.__proto__ || Object.getPrototypeOf(Example)).call(this, props));
55+
56+
_this.state = {
57+
expandedPanels: {},
58+
items: [{
59+
id: '1',
60+
summary: 'Accordion Summary',
61+
details: 'Accordion details - A'
62+
}, {
63+
id: '2',
64+
summary: 'Accordion Summary',
65+
details: 'Accordion details - B'
66+
}, {
67+
id: '3',
68+
summary: 'Accordion Summary',
69+
details: 'Accordion details - C'
70+
}]
71+
};
72+
return _this;
73+
}
74+
75+
_createClass(Example, [{
76+
key: 'menuDropdown',
77+
value: function menuDropdown(selectedItem) {
78+
var _this2 = this;
79+
80+
return _react2.default.createElement(_menuDropdown2.default, {
81+
align: 'right',
82+
id: 'ButtonGroupExampleDropdown',
83+
assistiveText: 'More Options',
84+
buttonVariant: 'icon',
85+
buttonClassName: 'slds-shrink-none',
86+
iconName: 'down',
87+
iconVariant: 'border-filled',
88+
onSelect: function onSelect(option) {
89+
if (option.label === 'delete') {
90+
_this2.setState(function (state) {
91+
return _extends({}, state, {
92+
items: state.items.filter(function (item) {
93+
return item.id !== selectedItem.id;
94+
})
95+
});
96+
});
97+
} else if (console) {
98+
console.log('onSelect', event, option);
99+
}
100+
},
101+
options: [{
102+
label: 'delete',
103+
value: 'A0'
104+
}, {
105+
label: 'redo',
106+
value: 'B0'
107+
}, {
108+
label: 'activate',
109+
value: 'C0'
110+
}],
111+
iconSize: 'x-small'
112+
});
113+
}
114+
}, {
115+
key: 'togglePanel',
116+
value: function togglePanel(event, data) {
117+
this.setState(function (state) {
118+
return _extends({}, state, {
119+
expandedPanels: _extends({}, state.expandedPanels, _defineProperty({}, data.id, !state.expandedPanels[data.id]))
120+
});
121+
});
122+
if (this.props.action) {
123+
var dataAsArray = Object.keys(data).map(function (id) {
124+
return data[id];
125+
});
126+
this.props.action('onClick').apply(undefined, [event].concat(_toConsumableArray(dataAsArray)));
127+
} else if (console) {
128+
console.log('[onSelect] (event, data)', event, data);
129+
}
130+
}
131+
}, {
132+
key: 'render',
133+
value: function render() {
134+
var _this3 = this;
135+
136+
return _react2.default.createElement(
137+
_iconSettings2.default,
138+
{ iconPath: '/assets/icons' },
139+
_react2.default.createElement(
140+
_accordion2.default,
141+
{ id: 'base-example-accordion' },
142+
this.state.items.map(function (item, i) {
143+
return _react2.default.createElement(
144+
_panel2.default,
145+
{
146+
expanded: !!_this3.state.expandedPanels[item.id],
147+
id: item.id,
148+
panelContentActions: _this3.menuDropdown(item),
149+
key: item.id,
150+
onTogglePanel: function onTogglePanel() {
151+
return _this3.togglePanel(event, item);
152+
},
153+
summary: item.summary
154+
},
155+
item.details
156+
);
157+
})
158+
)
159+
);
160+
}
161+
}]);
162+
163+
return Example;
164+
}(_react2.default.Component);
165+
166+
Example.displayName = 'AccordionExample';
167+
exports.default = Example; // export is replaced with `ReactDOM.render(<Example />, mountNode);` at runtime

0 commit comments

Comments
 (0)