Skip to content

Commit 257be3b

Browse files
Release commit for 0.6.11-es [ci skip]
0 parents  commit 257be3b

File tree

1,050 files changed

+76950
-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,050 files changed

+76950
-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/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Components
2+
3+
- This folder contains approved SLDS components and "lower order" components that get passed in (typically as children) to the approved SLDS components.
4+
- Components within folders labelled `private` are for internal usage only and are not intended to be a part of the public API of this project.
5+
- Components in `utilities` are shared components that are not part of the public API of this project.

components/SLDSSettings.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// Alias
2+
import settings from './settings';
3+
4+
module.exports = settings;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */
2+
/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */
3+
/* eslint-disable import/no-mutable-exports */
4+
5+
import oneOfComponent from '../../utilities/warning/one-of-component';
6+
7+
let checkProps = function () {};
8+
9+
if (process.env.NODE_ENV !== 'production') {
10+
checkProps = function (COMPONENT, props) {
11+
if (props.modalHeaderButton !== undefined) {
12+
oneOfComponent(COMPONENT, props, 'modalHeaderButton', ['SLDSButton']);
13+
}
14+
};
15+
}
16+
17+
export default checkProps;

components/app-launcher/index.jsx

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

0 commit comments

Comments
 (0)