Skip to content

Commit 242c9b0

Browse files
Release commit for 0.6.17-commonjs [ci skip]
0 parents  commit 242c9b0

File tree

953 files changed

+65666
-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.

953 files changed

+65666
-0
lines changed

.gitignore

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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

CONTRIBUTING.md

Lines changed: 530 additions & 0 deletions
Large diffs are not rendered by default.

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: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
'use strict';
2+
3+
var _settings = require('./settings');
4+
5+
var _settings2 = _interopRequireDefault(_settings);
6+
7+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8+
9+
module.exports = _settings2.default; // Alias
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
'use strict';
2+
3+
Object.defineProperty(exports, "__esModule", {
4+
value: true
5+
});
6+
7+
var _oneOfComponent = require('../../utilities/warning/one-of-component');
8+
9+
var _oneOfComponent2 = _interopRequireDefault(_oneOfComponent);
10+
11+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12+
13+
var checkProps = function checkProps() {}; /* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */
14+
/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */
15+
/* eslint-disable import/no-mutable-exports */
16+
17+
if (process.env.NODE_ENV !== 'production') {
18+
checkProps = function checkProps(COMPONENT, props) {
19+
if (props.modalHeaderButton !== undefined) {
20+
(0, _oneOfComponent2.default)(COMPONENT, props, 'modalHeaderButton', ['SLDSButton']);
21+
}
22+
};
23+
}
24+
25+
exports.default = checkProps;

components/app-launcher/index.js

Lines changed: 282 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,282 @@
1+
'use strict';
2+
3+
var _react = require('react');
4+
5+
var _react2 = _interopRequireDefault(_react);
6+
7+
var _propTypes = require('prop-types');
8+
9+
var _propTypes2 = _interopRequireDefault(_propTypes);
10+
11+
var _classnames = require('classnames');
12+
13+
var _classnames2 = _interopRequireDefault(_classnames);
14+
15+
var _lodash = require('lodash.isfunction');
16+
17+
var _lodash2 = _interopRequireDefault(_lodash);
18+
19+
var _checkProps = require('./check-props');
20+
21+
var _checkProps2 = _interopRequireDefault(_checkProps);
22+
23+
var _modal = require('../modal');
24+
25+
var _modal2 = _interopRequireDefault(_modal);
26+
27+
var _constants = require('../../utilities/constants');
28+
29+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
30+
31+
/**
32+
* The App Launcher allows the user to quickly access all the apps and functionality with their organization.
33+
* The App Launcher should generally only be used as a sub-component of the [Global Navigation Bar](/components/global-navigation-bar)
34+
*
35+
* Also note: App Launcher is not included in the standard component export. To import it, you must reference it directly via its path.
36+
* Example:
37+
* ```
38+
* import AppLauncher from 'design-system-react/components/app-launcher';
39+
* import AppLauncherTile from 'design-system-react/components/app-launcher/tile';
40+
* import AppLauncherSection from 'design-system-react/components/app-launcher/section';
41+
* ```
42+
*
43+
* USAGE EXAMPLE:
44+
* ```
45+
* <AppLauncher>
46+
* <AppLauncherSection>
47+
* <AppLauncherTile />
48+
* <AppLauncherTile />
49+
* <AppLauncherTile />
50+
* </AppLauncherSection>
51+
* <AppLauncherSection>
52+
* <AppLauncherTile />
53+
* <AppLauncherTile />
54+
* </AppLauncherSection>
55+
* </AppLauncher>
56+
* ```
57+
*
58+
* By default, `Modal`, a child component of App Launcher, will add `aria-hidden=true` to the `body` tag, but this disables some assistive technologies. To prevent this you can add the following to your application with `#mount` being the root node of your application that you would like to hide from assistive technologies when the `Modal` is open.
59+
* ```
60+
* import settings from 'design-system-react/components/settings';
61+
* settings.setAppElement('#mount');
62+
* ```
63+
*/
64+
65+
// ## Children
66+
67+
68+
// ### isFunction
69+
var AppLauncher = _react2.default.createClass({
70+
// ### Display Name
71+
// Always use the canonical component name as the React display name.
72+
displayName: _constants.APP_LAUNCHER,
73+
74+
// ### Prop Types
75+
propTypes: {
76+
/**
77+
* One or more `<AppLauncherSection />`s each containing one or more `<AppLauncherTile />`s
78+
*/
79+
children: _propTypes2.default.node.isRequired,
80+
/**
81+
* Control the open/close state of the App Launcher
82+
*/
83+
isOpen: _propTypes2.default.bool,
84+
/**
85+
* CSS classes to be added to App Launcher Modal.
86+
*/
87+
modalClassName: _propTypes2.default.oneOfType([_propTypes2.default.array, _propTypes2.default.object, _propTypes2.default.string]),
88+
/**
89+
* Button that exists in the upper right hand corner of the App Launcher modal
90+
*/
91+
modalHeaderButton: _propTypes2.default.node,
92+
/**
93+
* Allows longer application names without truncating them.
94+
*/
95+
noTruncate: _propTypes2.default.bool,
96+
/**
97+
* Callback when the App Launcher Modal is closed
98+
*/
99+
onClose: _propTypes2.default.func,
100+
/**
101+
* Search bar for the Modal's header. Will typically be an instance of `design-system-react/forms/input/search`
102+
*/
103+
search: _propTypes2.default.node,
104+
/**
105+
* Set the App Launcher's title text (for localization)
106+
*/
107+
title: _propTypes2.default.string,
108+
/**
109+
* Assistive text for app launcher icon
110+
*/
111+
triggerAssistiveText: _propTypes2.default.string,
112+
/**
113+
* This is typically the name of the cloud or application
114+
*/
115+
triggerName: _propTypes2.default.node,
116+
/**
117+
* Callback when the App Launcher icon is clicked
118+
*/
119+
triggerOnClick: _propTypes2.default.func
120+
},
121+
122+
componentWillMount: function componentWillMount() {
123+
// `checkProps` issues warnings to developers about properties (similar to React's built in development tools)
124+
(0, _checkProps2.default)(_constants.APP_LAUNCHER, this.props);
125+
},
126+
getDefaultProps: function getDefaultProps() {
127+
return {
128+
triggerAssistiveText: 'Open App Launcher',
129+
title: 'App Launcher'
130+
};
131+
},
132+
getInitialState: function getInitialState() {
133+
return {
134+
isOpen: false
135+
};
136+
},
137+
openAppLauncher: function openAppLauncher(event) {
138+
this.setState({ isOpen: true });
139+
140+
if ((0, _lodash2.default)(this.props.triggerOnClick)) {
141+
this.props.triggerOnClick(event);
142+
}
143+
},
144+
closeAppLauncher: function closeAppLauncher(event) {
145+
this.setState({ isOpen: false });
146+
147+
if ((0, _lodash2.default)(this.props.onClose)) {
148+
this.props.onClose(event);
149+
}
150+
},
151+
renderSearch: function renderSearch() {
152+
var _this = this;
153+
154+
var returnVal = void 0;
155+
156+
if (this.props.search) {
157+
returnVal = _react2.default.createElement(
158+
'div',
159+
{
160+
className: 'slds-app-launcher__header-search',
161+
ref: function ref(component) {
162+
if (component) {
163+
if (!_this.focusedOnSearch) {
164+
var input = component.querySelector('input');
165+
if (input) {
166+
// push to end of stack so click event doesn't blur the focus
167+
setTimeout(function () {
168+
input.focus();
169+
_this.focusedOnSearch = true;
170+
}, 0);
171+
}
172+
}
173+
} else {
174+
_this.focusedOnSearch = false;
175+
}
176+
}
177+
},
178+
this.props.search
179+
);
180+
}
181+
182+
return returnVal;
183+
},
184+
render: function render() {
185+
var isOpen = this.props.isOpen !== undefined ? this.props.isOpen : this.state.isOpen;
186+
187+
// Should be removed in the future by adding a reset class of some sort.
188+
var style = this.props.noTruncate ? { maxWidth: 'none' } : null;
189+
190+
var customModalHeader = _react2.default.createElement(
191+
'div',
192+
{ className: 'slds-grid slds-grid--align-spread slds-grid--vertical-align-center' },
193+
_react2.default.createElement(
194+
'h2',
195+
{ className: 'slds-text-heading--medium' },
196+
this.props.title
197+
),
198+
this.renderSearch(),
199+
this.props.modalHeaderButton ? this.props.modalHeaderButton : _react2.default.createElement('span', { className: 'slds-size--1-of-7' })
200+
);
201+
202+
// Not present in SLDS, but is consistent with other implementations of App Launcher. This also prevents resizing/jumping around when filtering. It will start clipping the modal close button at 600px viewport height.
203+
var modalContentStaticHeight = '90%';
204+
205+
return _react2.default.createElement(
206+
'div',
207+
{ className: 'slds-context-bar__item slds-no-hover', style: style },
208+
_react2.default.createElement(
209+
'div',
210+
{ className: 'slds-context-bar__icon-action' },
211+
_react2.default.createElement(
212+
'button',
213+
{
214+
'aria-haspopup': 'true',
215+
className: 'slds-button slds-icon-waffle_container slds-context-bar__button',
216+
onClick: this.openAppLauncher
217+
},
218+
_react2.default.createElement(
219+
'span',
220+
{ className: 'slds-icon-waffle' },
221+
_react2.default.createElement('span', { className: 'slds-r1' }),
222+
_react2.default.createElement('span', { className: 'slds-r2' }),
223+
_react2.default.createElement('span', { className: 'slds-r3' }),
224+
_react2.default.createElement('span', { className: 'slds-r4' }),
225+
_react2.default.createElement('span', { className: 'slds-r5' }),
226+
_react2.default.createElement('span', { className: 'slds-r6' }),
227+
_react2.default.createElement('span', { className: 'slds-r7' }),
228+
_react2.default.createElement('span', { className: 'slds-r8' }),
229+
_react2.default.createElement('span', { className: 'slds-r9' })
230+
),
231+
this.props.triggerAssistiveText && _react2.default.createElement(
232+
'span',
233+
{ className: 'slds-assistive-text' },
234+
this.props.triggerAssistiveText
235+
)
236+
)
237+
),
238+
_react2.default.createElement(
239+
_modal2.default,
240+
{
241+
contentClassName: 'slds-modal__content slds-app-launcher__content slds-p-around--medium',
242+
contentStyle: { minHeight: modalContentStaticHeight },
243+
isOpen: isOpen,
244+
onRequestClose: this.closeAppLauncher,
245+
containerClassName: (0, _classnames2.default)('app-launcher', this.props.modalClassName),
246+
size: 'large',
247+
header: customModalHeader,
248+
headerClassName: 'slds-app-launcher__header'
249+
},
250+
this.props.children
251+
),
252+
this.props.triggerName ? _react2.default.createElement(
253+
'span',
254+
{
255+
className: (0, _classnames2.default)('slds-context-bar__label-action slds-context-bar__app-name', { 'slds-truncate': !this.props.noTruncate })
256+
},
257+
this.props.triggerName
258+
) : null
259+
);
260+
}
261+
});
262+
263+
// ## Constants
264+
265+
266+
// This component's `checkProps` which issues warnings to developers about properties when in development mode (similar to React's built in development tools)
267+
268+
269+
// ### classNames
270+
/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */
271+
/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */
272+
273+
// # App Launcher Component
274+
275+
// Based on SLDS v2.1.0-rc.2
276+
277+
// ## Dependencies
278+
279+
// ### React
280+
281+
282+
module.exports = AppLauncher;

0 commit comments

Comments
 (0)