Skip to content

Commit 5b6ac54

Browse files
Release commit for 0.6.10-commonjs [ci skip]
0 parents  commit 5b6ac54

File tree

913 files changed

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

913 files changed

+65872
-0
lines changed

.gitignore

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

CONTRIBUTING.md

Lines changed: 522 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: 284 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,284 @@
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+
(function () {
165+
var input = component.querySelector('input');
166+
if (input) {
167+
// push to end of stack so click event doesn't blur the focus
168+
setTimeout(function () {
169+
input.focus();
170+
_this.focusedOnSearch = true;
171+
}, 0);
172+
}
173+
})();
174+
}
175+
} else {
176+
_this.focusedOnSearch = false;
177+
}
178+
}
179+
},
180+
this.props.search
181+
);
182+
}
183+
184+
return returnVal;
185+
},
186+
render: function render() {
187+
var isOpen = this.props.isOpen !== undefined ? this.props.isOpen : this.state.isOpen;
188+
189+
// Should be removed in the future by adding a reset class of some sort.
190+
var style = this.props.noTruncate ? { maxWidth: 'none' } : null;
191+
192+
var customModalHeader = _react2.default.createElement(
193+
'div',
194+
{ className: 'slds-grid slds-grid--align-spread slds-grid--vertical-align-center' },
195+
_react2.default.createElement(
196+
'h2',
197+
{ className: 'slds-text-heading--medium' },
198+
this.props.title
199+
),
200+
this.renderSearch(),
201+
this.props.modalHeaderButton ? this.props.modalHeaderButton : _react2.default.createElement('span', { className: 'slds-size--1-of-7' })
202+
);
203+
204+
// 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.
205+
var modalContentStaticHeight = '90%';
206+
207+
return _react2.default.createElement(
208+
'div',
209+
{ className: 'slds-context-bar__item slds-no-hover', style: style },
210+
_react2.default.createElement(
211+
'div',
212+
{ className: 'slds-context-bar__icon-action' },
213+
_react2.default.createElement(
214+
'button',
215+
{
216+
'aria-haspopup': 'true',
217+
className: 'slds-button slds-icon-waffle_container slds-context-bar__button',
218+
onClick: this.openAppLauncher
219+
},
220+
_react2.default.createElement(
221+
'span',
222+
{ className: 'slds-icon-waffle' },
223+
_react2.default.createElement('span', { className: 'slds-r1' }),
224+
_react2.default.createElement('span', { className: 'slds-r2' }),
225+
_react2.default.createElement('span', { className: 'slds-r3' }),
226+
_react2.default.createElement('span', { className: 'slds-r4' }),
227+
_react2.default.createElement('span', { className: 'slds-r5' }),
228+
_react2.default.createElement('span', { className: 'slds-r6' }),
229+
_react2.default.createElement('span', { className: 'slds-r7' }),
230+
_react2.default.createElement('span', { className: 'slds-r8' }),
231+
_react2.default.createElement('span', { className: 'slds-r9' })
232+
),
233+
this.props.triggerAssistiveText && _react2.default.createElement(
234+
'span',
235+
{ className: 'slds-assistive-text' },
236+
this.props.triggerAssistiveText
237+
)
238+
)
239+
),
240+
_react2.default.createElement(
241+
_modal2.default,
242+
{
243+
contentClassName: 'slds-modal__content slds-app-launcher__content slds-p-around--medium',
244+
contentStyle: { minHeight: modalContentStaticHeight },
245+
isOpen: isOpen,
246+
onRequestClose: this.closeAppLauncher,
247+
containerClassName: (0, _classnames2.default)('app-launcher', this.props.modalClassName),
248+
size: 'large',
249+
header: customModalHeader,
250+
headerClassName: 'slds-app-launcher__header'
251+
},
252+
this.props.children
253+
),
254+
this.props.triggerName ? _react2.default.createElement(
255+
'span',
256+
{
257+
className: (0, _classnames2.default)('slds-context-bar__label-action slds-context-bar__app-name', { 'slds-truncate': !this.props.noTruncate })
258+
},
259+
this.props.triggerName
260+
) : null
261+
);
262+
}
263+
});
264+
265+
// ## Constants
266+
267+
268+
// This component's `checkProps` which issues warnings to developers about properties when in development mode (similar to React's built in development tools)
269+
270+
271+
// ### classNames
272+
/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */
273+
/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */
274+
275+
// # App Launcher Component
276+
277+
// Based on SLDS v2.1.0-rc.2
278+
279+
// ## Dependencies
280+
281+
// ### React
282+
283+
284+
module.exports = AppLauncher;

0 commit comments

Comments
 (0)