@salesforce/design-system-react 0.10.41 → 0.10.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/brand-band/__docs__/__snapshots__/storybook-stories.storyshot +47 -157
- package/components/brand-band/__docs__/storybook-stories.jsx +4 -2
- package/components/brand-band/__examples__/{lightning-blue-theme.jsx → group-image.jsx} +1 -11
- package/components/brand-band/__examples__/no-image.jsx +1 -2
- package/{lib/components/brand-band/__examples__/lightning-blue-theme.jsx → components/brand-band/__examples__/user-image.jsx} +1 -11
- package/components/brand-band/check-props.js +18 -0
- package/components/brand-band/component.json +8 -4
- package/components/brand-band/index.jsx +23 -66
- package/components/brand-band.d.ts +1 -26
- package/components/button/__tests__/button.browser-test.jsx +0 -1
- package/components/combobox/__tests__/combobox.browser-test.jsx +18 -0
- package/components/combobox/combobox.jsx +4 -1
- package/components/component-docs.json +13 -38
- package/components/data-table/cell.jsx +2 -2
- package/components/data-table/index.jsx +130 -85
- package/components/data-table/private/context-helper.js +26 -14
- package/components/data-table/private/head.jsx +269 -260
- package/components/data-table/private/header-cell.jsx +204 -230
- package/components/data-table/private/row.jsx +140 -105
- package/components/data-table/row-actions.jsx +2 -2
- package/components/icon/__docs__/__snapshots__/storybook-stories.storyshot +49 -2
- package/components/icon/__docs__/storybook-stories.jsx +2 -0
- package/components/icon/__examples__/color-success.jsx +24 -0
- package/components/icon/__examples__/colors.jsx +10 -2
- package/components/icon/index.jsx +2 -0
- package/components/icon.d.ts +1 -1
- package/components/site-stories.js +8 -4
- package/components/utilities/truncate/index.jsx +1 -1
- package/lib/components/brand-band/__docs__/__snapshots__/storybook-stories.storyshot +47 -157
- package/lib/components/brand-band/__docs__/storybook-stories.jsx +4 -2
- package/lib/components/brand-band/__examples__/group-image.jsx +12 -0
- package/lib/components/brand-band/__examples__/no-image.jsx +1 -2
- package/lib/components/brand-band/__examples__/user-image.jsx +12 -0
- package/lib/components/brand-band/check-props.js +29 -0
- package/lib/components/brand-band/component.json +8 -4
- package/lib/components/brand-band/index.js +9 -50
- package/lib/components/brand-band.d.ts +1 -26
- package/lib/components/button/__tests__/button.browser-test.jsx +0 -1
- package/lib/components/combobox/__tests__/combobox.browser-test.jsx +18 -0
- package/lib/components/combobox/combobox.js +6 -2
- package/lib/components/component-docs.json +13 -38
- package/lib/components/data-table/cell.js +6 -6
- package/lib/components/data-table/index.js +127 -99
- package/lib/components/data-table/private/context-helper.js +13 -14
- package/lib/components/data-table/private/head.js +233 -252
- package/lib/components/data-table/private/header-cell.js +185 -221
- package/lib/components/data-table/private/row.js +97 -89
- package/lib/components/data-table/row-actions.js +6 -6
- package/lib/components/icon/__docs__/__snapshots__/storybook-stories.storyshot +49 -2
- package/lib/components/icon/__docs__/storybook-stories.jsx +2 -0
- package/lib/components/icon/__examples__/color-success.jsx +24 -0
- package/lib/components/icon/__examples__/colors.jsx +10 -2
- package/lib/components/icon/index.js +2 -1
- package/lib/components/icon.d.ts +1 -1
- package/lib/components/site-stories.js +6 -3
- package/lib/components/utilities/truncate/index.js +2 -2
- package/lib/package.json +13 -9
- package/module/components/brand-band/__docs__/__snapshots__/storybook-stories.storyshot +47 -157
- package/module/components/brand-band/__docs__/storybook-stories.js +6 -3
- package/module/components/brand-band/__docs__/storybook-stories.js.map +1 -1
- package/module/components/brand-band/__examples__/{lightning-blue-theme.js → group-image.js} +4 -9
- package/module/components/brand-band/__examples__/group-image.js.map +1 -0
- package/module/components/brand-band/__examples__/no-image.js +2 -4
- package/module/components/brand-band/__examples__/no-image.js.map +1 -1
- package/module/components/brand-band/__examples__/user-image.js +52 -0
- package/module/components/brand-band/__examples__/user-image.js.map +1 -0
- package/module/components/brand-band/check-props.js +20 -0
- package/module/components/brand-band/check-props.js.map +1 -0
- package/module/components/brand-band/component.json +8 -4
- package/module/components/brand-band/index.js +10 -51
- package/module/components/brand-band/index.js.map +1 -1
- package/module/components/brand-band.d.ts +1 -26
- package/module/components/button/__tests__/button.browser-test.js +0 -1
- package/module/components/button/__tests__/button.browser-test.js.map +1 -1
- package/module/components/combobox/__tests__/combobox.browser-test.js +22 -0
- package/module/components/combobox/__tests__/combobox.browser-test.js.map +1 -1
- package/module/components/combobox/combobox.js +6 -2
- package/module/components/combobox/combobox.js.map +1 -1
- package/module/components/component-docs.json +13 -38
- package/module/components/data-table/cell.js +6 -6
- package/module/components/data-table/cell.js.map +1 -1
- package/module/components/data-table/index.js +120 -95
- package/module/components/data-table/index.js.map +1 -1
- package/module/components/data-table/private/context-helper.js +12 -12
- package/module/components/data-table/private/context-helper.js.map +1 -1
- package/module/components/data-table/private/head.js +230 -255
- package/module/components/data-table/private/head.js.map +1 -1
- package/module/components/data-table/private/header-cell.js +184 -225
- package/module/components/data-table/private/header-cell.js.map +1 -1
- package/module/components/data-table/private/row.js +95 -87
- package/module/components/data-table/private/row.js.map +1 -1
- package/module/components/data-table/row-actions.js +6 -6
- package/module/components/data-table/row-actions.js.map +1 -1
- package/module/components/icon/__docs__/__snapshots__/storybook-stories.storyshot +49 -2
- package/module/components/icon/__docs__/storybook-stories.js +3 -0
- package/module/components/icon/__docs__/storybook-stories.js.map +1 -1
- package/module/components/icon/__examples__/color-success.js +64 -0
- package/module/components/icon/__examples__/color-success.js.map +1 -0
- package/module/components/icon/__examples__/colors.js +11 -2
- package/module/components/icon/__examples__/colors.js.map +1 -1
- package/module/components/icon/index.js +2 -1
- package/module/components/icon/index.js.map +1 -1
- package/module/components/icon.d.ts +1 -1
- package/module/components/site-stories.js +6 -3
- package/module/components/site-stories.js.map +1 -1
- package/module/components/utilities/truncate/index.js +1 -1
- package/module/components/utilities/truncate/index.js.map +1 -1
- package/package.json +13 -9
- package/module/components/brand-band/__examples__/lightning-blue-theme.js.map +0 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
2
|
+
|
|
3
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4
|
+
|
|
5
|
+
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); } }
|
|
6
|
+
|
|
7
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
8
|
+
|
|
9
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
10
|
+
|
|
11
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
12
|
+
|
|
13
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
14
|
+
|
|
15
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
16
|
+
|
|
17
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
18
|
+
|
|
19
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
20
|
+
|
|
21
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
22
|
+
|
|
23
|
+
import React from 'react';
|
|
24
|
+
import BrandBand from "../../../../components/brand-band"; // `~` is replaced with design-system-react at runtime
|
|
25
|
+
|
|
26
|
+
var Example = /*#__PURE__*/function (_React$Component) {
|
|
27
|
+
_inherits(Example, _React$Component);
|
|
28
|
+
|
|
29
|
+
var _super = _createSuper(Example);
|
|
30
|
+
|
|
31
|
+
function Example() {
|
|
32
|
+
_classCallCheck(this, Example);
|
|
33
|
+
|
|
34
|
+
return _super.apply(this, arguments);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
_createClass(Example, [{
|
|
38
|
+
key: "render",
|
|
39
|
+
value: function render() {
|
|
40
|
+
return /*#__PURE__*/React.createElement(BrandBand, {
|
|
41
|
+
id: "brand-band-user-image",
|
|
42
|
+
image: "user"
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}]);
|
|
46
|
+
|
|
47
|
+
return Example;
|
|
48
|
+
}(React.Component);
|
|
49
|
+
|
|
50
|
+
Example.displayName = 'BrandBandExample';
|
|
51
|
+
export default Example; // export is replaced with `ReactDOM.render(<Example />, mountNode);` at runtime
|
|
52
|
+
//# sourceMappingURL=user-image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../.tmp-es/components/brand-band/__examples__/user-image.jsx"],"names":["React","BrandBand","Example","Component","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,mCAAtB,C,CAAiD;;IAE3CC,O;;;;;;;;;;;;;WACL,kBAAS;AACR,0BAAO,oBAAC,SAAD;AAAW,QAAA,EAAE,EAAC,uBAAd;AAAsC,QAAA,KAAK,EAAC;AAA5C,QAAP;AACA;;;;EAHoBF,KAAK,CAACG,S;;AAM5BD,OAAO,CAACE,WAAR,GAAsB,kBAAtB;AAEA,eAAeF,OAAf,C,CAAwB","sourcesContent":["import React from 'react';\nimport BrandBand from '~/components/brand-band'; // `~` is replaced with design-system-react at runtime\n\nclass Example extends React.Component {\n\trender() {\n\t\treturn <BrandBand id=\"brand-band-user-image\" image=\"user\" />;\n\t}\n}\n\nExample.displayName = 'BrandBandExample';\n\nexport default Example; // export is replaced with `ReactDOM.render(<Example />, mountNode);` at runtime\n"],"file":"user-image.js"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */
|
|
2
|
+
|
|
3
|
+
/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */
|
|
4
|
+
|
|
5
|
+
/* eslint-disable import/no-mutable-exports */
|
|
6
|
+
|
|
7
|
+
/* eslint-disable max-len */
|
|
8
|
+
import sunsetProperty from '../../utilities/warning/sunset-property';
|
|
9
|
+
|
|
10
|
+
var checkProps = function checkPropsFunction() {};
|
|
11
|
+
|
|
12
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
13
|
+
checkProps = function checkPropsFunction(COMPONENT, props) {
|
|
14
|
+
sunsetProperty(COMPONENT, props.styleContainer, 'styleContainer');
|
|
15
|
+
sunsetProperty(COMPONENT, props.theme, 'theme');
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default checkProps;
|
|
20
|
+
//# sourceMappingURL=check-props.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../.tmp-es/components/brand-band/check-props.js"],"names":["sunsetProperty","checkProps","checkPropsFunction","process","env","NODE_ENV","COMPONENT","props","styleContainer","theme"],"mappings":"AAAA;;AACA;;AACA;;AACA;AAEA,OAAOA,cAAP,MAA2B,yCAA3B;;AAEA,IAAIC,UAAU,GAAG,SAASC,kBAAT,GAA8B,CAAE,CAAjD;;AAEA,IAAIC,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,YAA7B,EAA2C;AAC1CJ,EAAAA,UAAU,GAAG,SAASC,kBAAT,CAA4BI,SAA5B,EAAuCC,KAAvC,EAA8C;AAC1DP,IAAAA,cAAc,CAACM,SAAD,EAAYC,KAAK,CAACC,cAAlB,EAAkC,gBAAlC,CAAd;AAEAR,IAAAA,cAAc,CAACM,SAAD,EAAYC,KAAK,CAACE,KAAlB,EAAyB,OAAzB,CAAd;AACA,GAJD;AAKA;;AAED,eAAeR,UAAf","sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n/* eslint-disable import/no-mutable-exports */\n/* eslint-disable max-len */\n\nimport sunsetProperty from '../../utilities/warning/sunset-property';\n\nlet checkProps = function checkPropsFunction() {};\n\nif (process.env.NODE_ENV !== 'production') {\n\tcheckProps = function checkPropsFunction(COMPONENT, props) {\n\t\tsunsetProperty(COMPONENT, props.styleContainer, 'styleContainer');\n\n\t\tsunsetProperty(COMPONENT, props.theme, 'theme');\n\t};\n}\n\nexport default checkProps;\n"],"file":"check-props.js"}
|
|
@@ -9,10 +9,6 @@
|
|
|
9
9
|
},
|
|
10
10
|
"SLDS-component-path": "/components/brand-band",
|
|
11
11
|
"site-stories": [
|
|
12
|
-
{
|
|
13
|
-
"heading": "Lightning Blue",
|
|
14
|
-
"path": "/__examples__/lightning-blue-theme.jsx"
|
|
15
|
-
},
|
|
16
12
|
{
|
|
17
13
|
"heading": "Default",
|
|
18
14
|
"path": "/__examples__/default.jsx"
|
|
@@ -28,6 +24,14 @@
|
|
|
28
24
|
{
|
|
29
25
|
"heading": "No Image",
|
|
30
26
|
"path": "/__examples__/no-image.jsx"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"heading": "User Image",
|
|
30
|
+
"path": "/__examples__/user-image.jsx"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"heading": "Group Image",
|
|
34
|
+
"path": "/__examples__/group-image.jsx"
|
|
31
35
|
}
|
|
32
36
|
],
|
|
33
37
|
"url-slug": "brand-band"
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
2
2
|
|
|
3
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
-
|
|
5
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
6
|
-
|
|
7
|
-
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; }
|
|
8
|
-
|
|
9
3
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
10
4
|
|
|
11
5
|
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); } }
|
|
@@ -42,25 +36,13 @@ import shortid from 'shortid'; // ### classNames
|
|
|
42
36
|
// [github.com/JedWatson/classnames](https://github.com/JedWatson/classnames)
|
|
43
37
|
// A simple javascript utility for conditionally joining classNames together.
|
|
44
38
|
|
|
45
|
-
import classNames from '../../utilities/class-names'; //
|
|
39
|
+
import classNames from '../../utilities/class-names'; // This component's `checkProps` which issues warnings to developers about properties when in development mode (similar to React's built in development tools)
|
|
40
|
+
|
|
41
|
+
import checkProps from './check-props'; // ## Constants
|
|
46
42
|
|
|
47
43
|
import { BRAND_BAND } from '../../utilities/constants';
|
|
48
44
|
/**
|
|
49
45
|
* The brand band provides theming capability that adds personality and improves information density and contrast.
|
|
50
|
-
*
|
|
51
|
-
* NOTE: you may find that themes other than 'default' fail to load the appropriate styling in your application.
|
|
52
|
-
* If this occurs the cause is very likely to be CSP settings on the server hosting your application protecting against style injections.
|
|
53
|
-
* Changing these settings is not recommended. Instead, add the following styles to any stylesheet provided by the server itself (such as an external stylesheet):
|
|
54
|
-
*
|
|
55
|
-
* When using 'lightning-theme':
|
|
56
|
-
* .slds-brand-band.dsr-brand-band_lightning-blue:before {
|
|
57
|
-
* background-image: url(/assets/images/themes/oneSalesforce/banner-brand-default.png), linear-gradient(to top, rgba(175, 197, 222, 0) 0, #1B5F9E);
|
|
58
|
-
* }
|
|
59
|
-
* .slds-brand-band.dsr-brand-band_lightning-blue:after {
|
|
60
|
-
* background-image: linear-gradient(to bottom, rgba(175, 197, 222, 0) 60%, #AFC5DE);
|
|
61
|
-
* }
|
|
62
|
-
*
|
|
63
|
-
* For more information on the problem, [see this Stack Overflow question](https://stackoverflow.com/questions/17766817/refused-to-apply-inline-style-because-it-violates-the-following-content-security)
|
|
64
46
|
*/
|
|
65
47
|
|
|
66
48
|
var BrandBand = /*#__PURE__*/function (_React$Component) {
|
|
@@ -74,6 +56,7 @@ var BrandBand = /*#__PURE__*/function (_React$Component) {
|
|
|
74
56
|
_classCallCheck(this, BrandBand);
|
|
75
57
|
|
|
76
58
|
_this = _super.call(this, props);
|
|
59
|
+
checkProps(BRAND_BAND, _this.props);
|
|
77
60
|
_this.generatedId = shortid.generate();
|
|
78
61
|
return _this;
|
|
79
62
|
}
|
|
@@ -88,30 +71,18 @@ var BrandBand = /*#__PURE__*/function (_React$Component) {
|
|
|
88
71
|
value: function render() {
|
|
89
72
|
var props = this.props;
|
|
90
73
|
return /*#__PURE__*/React.createElement("div", {
|
|
91
|
-
style: _objectSpread({
|
|
92
|
-
background: 'rgb(176, 196, 223)',
|
|
93
|
-
height: '100%',
|
|
94
|
-
position: 'relative',
|
|
95
|
-
width: '100%',
|
|
96
|
-
zIndex: 1
|
|
97
|
-
}, props.styleContainer)
|
|
98
|
-
}, BrandBand.injectLightningBlueStyles(), /*#__PURE__*/React.createElement("div", {
|
|
99
74
|
className: classNames('slds-brand-band', {
|
|
100
75
|
'slds-brand-band_small': props.size === 'small',
|
|
101
76
|
'slds-brand-band_medium': props.size === 'medium',
|
|
102
77
|
'slds-brand-band_large': props.size === 'large',
|
|
103
78
|
'slds-brand-band_cover': props.backgroundSize === 'cover',
|
|
104
79
|
'slds-brand-band_none': props.image === 'none',
|
|
105
|
-
'
|
|
80
|
+
'slds-brand-band_group': props.image === 'group',
|
|
81
|
+
'slds-brand-band_user': props.image === 'user'
|
|
106
82
|
}, props.className),
|
|
107
83
|
id: this.getId(),
|
|
108
84
|
style: props.style
|
|
109
|
-
}, props.children)
|
|
110
|
-
}
|
|
111
|
-
}], [{
|
|
112
|
-
key: "injectLightningBlueStyles",
|
|
113
|
-
value: function injectLightningBlueStyles() {
|
|
114
|
-
return /*#__PURE__*/React.createElement("style", null, ".slds-brand-band.dsr-brand-band_lightning-blue:before {\n\tbackground-image: url(/assets/images/themes/oneSalesforce/banner-brand-default.png), linear-gradient(to top, rgba(175, 197, 222, 0) 0, #1B5F9E);\n}\n.slds-brand-band.dsr-brand-band_lightning-blue:after {\n\tbackground-image: linear-gradient(to bottom, rgba(175, 197, 222, 0) 60%, #AFC5DE);\n}");
|
|
85
|
+
}, props.children);
|
|
115
86
|
}
|
|
116
87
|
}]);
|
|
117
88
|
|
|
@@ -138,7 +109,7 @@ BrandBand.propTypes = {
|
|
|
138
109
|
/**
|
|
139
110
|
* Image of the brand band
|
|
140
111
|
*/
|
|
141
|
-
image: PropTypes.oneOf(['default', 'none']),
|
|
112
|
+
image: PropTypes.oneOf(['default', 'none', 'group', 'user']),
|
|
142
113
|
|
|
143
114
|
/**
|
|
144
115
|
* Background size of the brand band. Default is 'contain'
|
|
@@ -153,24 +124,12 @@ BrandBand.propTypes = {
|
|
|
153
124
|
/**
|
|
154
125
|
* Custom styles to be passed to the component
|
|
155
126
|
*/
|
|
156
|
-
style: PropTypes.object
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Custom styles to be passed to the component container
|
|
160
|
-
*/
|
|
161
|
-
styleContainer: PropTypes.object,
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Different brand band styling.
|
|
165
|
-
* NOTE: using 'lightning-blue' may result in incorrect styling depending on server CSP settings. See opening component documentation above for details.
|
|
166
|
-
*/
|
|
167
|
-
theme: PropTypes.oneOf(['default', 'lightning-blue'])
|
|
127
|
+
style: PropTypes.object
|
|
168
128
|
};
|
|
169
129
|
BrandBand.defaultProps = {
|
|
170
130
|
backgroundSize: 'contain',
|
|
171
131
|
image: 'default',
|
|
172
|
-
size: 'medium'
|
|
173
|
-
theme: 'default'
|
|
132
|
+
size: 'medium'
|
|
174
133
|
};
|
|
175
134
|
export default BrandBand;
|
|
176
135
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../.tmp-es/components/brand-band/index.jsx"],"names":["React","PropTypes","shortid","classNames","BRAND_BAND","BrandBand","props","generatedId","generate","id","
|
|
1
|
+
{"version":3,"sources":["../../../.tmp-es/components/brand-band/index.jsx"],"names":["React","PropTypes","shortid","classNames","checkProps","BRAND_BAND","BrandBand","props","generatedId","generate","id","size","backgroundSize","image","className","getId","style","children","Component","displayName","propTypes","node","oneOfType","array","object","string","oneOf","defaultProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;AAEA;AAEA;AAEA;AAEA;AACA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB,C,CAEA;AACA;AACA;;AACA,OAAOC,OAAP,MAAoB,SAApB,C,CAEA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,6BAAvB,C,CAEA;;AACA,OAAOC,UAAP,MAAuB,eAAvB,C,CAEA;;AACA,SAASC,UAAT,QAA2B,2BAA3B;AAEA;AACA;AACA;;IACMC,S;;;;;AACL,qBAAYC,KAAZ,EAAmB;AAAA;;AAAA;;AAClB,8BAAMA,KAAN;AAEAH,IAAAA,UAAU,CAACC,UAAD,EAAa,MAAKE,KAAlB,CAAV;AACA,UAAKC,WAAL,GAAmBN,OAAO,CAACO,QAAR,EAAnB;AAJkB;AAKlB;;;;WAED,iBAAQ;AACP,aAAO,KAAKF,KAAL,CAAWG,EAAX,IAAiB,KAAKF,WAA7B;AACA;;;WAED,kBAAS;AACR,UAAQD,KAAR,GAAkB,IAAlB,CAAQA,KAAR;AAEA,0BACC;AACC,QAAA,SAAS,EAAEJ,UAAU,CACpB,iBADoB,EAEpB;AACC,mCAAyBI,KAAK,CAACI,IAAN,KAAe,OADzC;AAEC,oCAA0BJ,KAAK,CAACI,IAAN,KAAe,QAF1C;AAGC,mCAAyBJ,KAAK,CAACI,IAAN,KAAe,OAHzC;AAIC,mCAAyBJ,KAAK,CAACK,cAAN,KAAyB,OAJnD;AAKC,kCAAwBL,KAAK,CAACM,KAAN,KAAgB,MALzC;AAMC,mCAAyBN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AHkB,CAAzB;AAMA,eAAeL,SAAf","sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\n// # Brand Band Component\n\n// Implements the [Brand Band design pattern](https://latest-216.lightningdesignsystem.com/components/brand-band/) in React.\n\n// ## Dependencies\n\n// ### React\nimport React from 'react';\nimport PropTypes from 'prop-types';\n\n// ### shortid\n// [npmjs.com/package/shortid](https://www.npmjs.com/package/shortid)\n// shortid is a short, non-sequential, url-friendly, unique id generator\nimport shortid from 'shortid';\n\n// ### classNames\n// [github.com/JedWatson/classnames](https://github.com/JedWatson/classnames)\n// A simple javascript utility for conditionally joining classNames together.\nimport classNames from '../../utilities/class-names';\n\n// This component's `checkProps` which issues warnings to developers about properties when in development mode (similar to React's built in development tools)\nimport checkProps from './check-props';\n\n// ## Constants\nimport { BRAND_BAND } from '../../utilities/constants';\n\n/**\n * The brand band provides theming capability that adds personality and improves information density and contrast.\n */\nclass BrandBand extends React.Component {\n\tconstructor(props) {\n\t\tsuper(props);\n\n\t\tcheckProps(BRAND_BAND, this.props);\n\t\tthis.generatedId = shortid.generate();\n\t}\n\n\tgetId() {\n\t\treturn this.props.id || this.generatedId;\n\t}\n\n\trender() {\n\t\tconst { props } = this;\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tclassName={classNames(\n\t\t\t\t\t'slds-brand-band',\n\t\t\t\t\t{\n\t\t\t\t\t\t'slds-brand-band_small': props.size === 'small',\n\t\t\t\t\t\t'slds-brand-band_medium': props.size === 'medium',\n\t\t\t\t\t\t'slds-brand-band_large': props.size === 'large',\n\t\t\t\t\t\t'slds-brand-band_cover': props.backgroundSize === 'cover',\n\t\t\t\t\t\t'slds-brand-band_none': props.image === 'none',\n\t\t\t\t\t\t'slds-brand-band_group': props.image === 'group',\n\t\t\t\t\t\t'slds-brand-band_user': props.image === 'user',\n\t\t\t\t\t},\n\t\t\t\t\tprops.className\n\t\t\t\t)}\n\t\t\t\tid={this.getId()}\n\t\t\t\tstyle={props.style}\n\t\t\t>\n\t\t\t\t{props.children}\n\t\t\t</div>\n\t\t);\n\t}\n}\n\nBrandBand.displayName = BRAND_BAND;\n\nBrandBand.propTypes = {\n\t/**\n\t * Primary application grid layout or a white background component such as a `Card` should be passed into this component.\n\t */\n\tchildren: PropTypes.node,\n\n\t/**\n\t * CSS classes that are applied to the component\n\t */\n\tclassName: PropTypes.oneOfType([\n\t\tPropTypes.array,\n\t\tPropTypes.object,\n\t\tPropTypes.string,\n\t]),\n\n\t/**\n\t * Id of component, if desired. If not provided an id is automatically generated\n\t */\n\tid: PropTypes.string,\n\n\t/**\n\t * Image of the brand band\n\t */\n\timage: PropTypes.oneOf(['default', 'none', 'group', 'user']),\n\n\t/**\n\t * Background size of the brand band. Default is 'contain'\n\t */\n\tbackgroundSize: PropTypes.oneOf(['contain', 'cover']),\n\n\t/**\n\t * Size of the brand band. Default is 'medium'\n\t */\n\tsize: PropTypes.oneOf(['small', 'medium', 'large']),\n\n\t/**\n\t * Custom styles to be passed to the component\n\t */\n\tstyle: PropTypes.object,\n};\n\nBrandBand.defaultProps = {\n\tbackgroundSize: 'contain',\n\timage: 'default',\n\tsize: 'medium',\n};\n\nexport default BrandBand;\n"],"file":"index.js"}
|
|
@@ -19,7 +19,7 @@ declare module '@salesforce/design-system-react/components/brand-band' {
|
|
|
19
19
|
/**
|
|
20
20
|
* Image of the brand band
|
|
21
21
|
*/
|
|
22
|
-
image?: 'default' | 'none';
|
|
22
|
+
image?: 'default' | 'none' | 'user' | 'group';
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* Background size of the brand band. Default is 'contain'
|
|
@@ -34,34 +34,9 @@ declare module '@salesforce/design-system-react/components/brand-band' {
|
|
|
34
34
|
* Custom styles to be passed to the component
|
|
35
35
|
*/
|
|
36
36
|
style?: Record<string, any>;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Custom styles to be passed to the component container
|
|
40
|
-
*/
|
|
41
|
-
styleContainer?: Record<string, any>;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Different brand band styling.
|
|
45
|
-
* NOTE: using 'lightning-blue' may result in incorrect styling depending on server CSP settings. See opening component documentation above for details.
|
|
46
|
-
*/
|
|
47
|
-
theme?: 'default' | 'lightning-blue';
|
|
48
37
|
};
|
|
49
38
|
/**
|
|
50
39
|
* The brand band provides theming capability that adds personality and improves information density and contrast.
|
|
51
|
-
*
|
|
52
|
-
* NOTE: you may find that themes other than 'default' fail to load the appropriate styling in your application.
|
|
53
|
-
* If this occurs the cause is very likely to be CSP settings on the server hosting your application protecting against style injections.
|
|
54
|
-
* Changing these settings is not recommended. Instead, add the following styles to any stylesheet provided by the server itself (such as an external stylesheet):
|
|
55
|
-
*
|
|
56
|
-
* When using 'lightning-theme':
|
|
57
|
-
* .slds-brand-band.dsr-brand-band_lightning-blue:before {
|
|
58
|
-
* background-image: url(/assets/images/themes/oneSalesforce/banner-brand-default.png), linear-gradient(to top, rgba(175, 197, 222, 0) 0, #1B5F9E);
|
|
59
|
-
* }
|
|
60
|
-
* .slds-brand-band.dsr-brand-band_lightning-blue:after {
|
|
61
|
-
* background-image: linear-gradient(to bottom, rgba(175, 197, 222, 0) 60%, #AFC5DE);
|
|
62
|
-
* }
|
|
63
|
-
*
|
|
64
|
-
* For more information on the problem, [see this Stack Overflow question](https://stackoverflow.com/questions/17766817/refused-to-apply-inline-style-because-it-violates-the-following-content-security)
|
|
65
40
|
*/
|
|
66
41
|
function Component(props: Props): JSX.Element;
|
|
67
42
|
export default Component;
|
|
@@ -65,7 +65,6 @@ describe('SLDSButton: ', function () {
|
|
|
65
65
|
var _cmp$getElementsByCla2 = _slicedToArray(_cmp$getElementsByCla, 1);
|
|
66
66
|
|
|
67
67
|
btn = _cmp$getElementsByCla2[0];
|
|
68
|
-
console.log('!!!!!', cmp, btn);
|
|
69
68
|
});
|
|
70
69
|
it('renders correct label', function () {
|
|
71
70
|
expect(btn.textContent).to.equal('Neutral');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../.tmp-es/components/button/__tests__/button.browser-test.jsx"],"names":["React","ReactDOM","TestUtils","expect","assign","SLDSButton","IconSettings","Simulate","mockCallback","sinon","spy","describe","defaultProps","label","onClick","variant","renderButton","instance","ref","createRef","renderIntoDocument","findDOMNode","current","createButton","props","createElement","getButton","cmp","btn","beforeEach","id","text","theme","style","background","getElementsByClassName","console","log","it","textContent","to","equal","className","include","getAttribute","backgroundColor","should","formAction","svg","iconName","iconCategory","iconPosition","baseVal","asstText","assistiveText","icon","iconSize","iconVariant","getElementsByTagName","iconPath","title","use","svgHref","before","clicked","setClick","be","false","click","true"],"mappings":";;;;;;;;;;;;AAAA;;AACA;AACA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,QAAP,MAAqB,WAArB;AACA,OAAOC,SAAP,MAAsB,sBAAtB;AACA,SAASC,MAAT,QAAuB,MAAvB;AACA,OAAOC,MAAP,MAAmB,eAAnB;AAEA,OAAOC,UAAP,MAAuB,cAAvB;AACA,OAAOC,YAAP,MAAyB,qBAAzB;AAEA,IAAQC,QAAR,GAAqBL,SAArB,CAAQK,QAAR;AAEA,IAAMC,YAAY,GAAGC,KAAK,CAACC,GAAN,EAArB;AAEAC,QAAQ,CAAC,cAAD,EAAiB,YAAM;AAC9B,MAAMC,YAAY,GAAG;AACpBC,IAAAA,KAAK,EAAE,SADa;AAEpBC,IAAAA,OAAO,EAAEN,YAFW;AAGpBO,IAAAA,OAAO,EAAE;AAHW,GAArB;;AAMA,MAAMC,YAAY,GAAG,SAAfA,YAAe,CAACC,QAAD,EAAc;AAClC,QAAMC,GAAG,gBAAGlB,KAAK,CAACmB,SAAN,EAAZ;AACAjB,IAAAA,SAAS,CAACkB,kBAAV,eACC,oBAAC,YAAD;AAAc,MAAA,QAAQ,EAAC;AAAvB,oBACC;AAAK,MAAA,GAAG,EAAEF;AAAV,OAAgBD,QAAhB,CADD,CAD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AAC,YAAM;AAChBmC,MAAAA,OAAO,GAAG,KAAV;AACArC,MAAAA,GAAG,GAAGD,SAAS,CAAC;AACfb,QAAAA,KAAK,EAAE,SADQ;AAEfE,QAAAA,OAAO,EAAE,SAFM;AAGfD,QAAAA,OAAO,EAAEmD;AAHM,OAAD,CAAf;;AAFgB,oCAORtC,GAAG,CAACQ,sBAAJ,CAA2B,aAA3B,CAPQ;;AAAA;;AAOfP,MAAAA,GAPe;AAQhB,KARS,CAAV;AAUAU,IAAAA,EAAE,CAAC,gBAAD,EAAmB,YAAM;AAC1B;AACAnC,MAAAA,MAAM,CAAC6D,OAAD,CAAN,CAAgBxB,EAAhB,CAAmB0B,EAAnB,CAAsBC,KAAtB;AACA5D,MAAAA,QAAQ,CAAC6D,KAAT,CAAexC,GAAf,EAAoB,EAApB;AACAzB,MAAAA,MAAM,CAAC6D,OAAD,CAAN,CAAgBxB,EAAhB,CAAmB0B,EAAnB,CAAsBG,IAAtB;AACA;AACA,KANC,CAAF;AAOA,GA1BO,CAAR;AA2BA,CAnNO,CAAR","sourcesContent":["/* eslint-disable react/no-render-return-value */\n/* eslint-disable react/no-find-dom-node */\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport TestUtils from 'react-dom/test-utils';\nimport { expect } from 'chai';\nimport assign from 'lodash.assign';\n\nimport SLDSButton from '../../button';\nimport IconSettings from '../../icon-settings';\n\nconst { Simulate } = TestUtils;\n\nconst mockCallback = sinon.spy();\n\ndescribe('SLDSButton: ', () => {\n\tconst defaultProps = {\n\t\tlabel: 'Neutral',\n\t\tonClick: mockCallback,\n\t\tvariant: 'neutral',\n\t};\n\n\tconst renderButton = (instance) => {\n\t\tconst ref = React.createRef();\n\t\tTestUtils.renderIntoDocument(\n\t\t\t<IconSettings iconPath=\"/assets/icons\">\n\t\t\t\t<div ref={ref}>{instance}</div>\n\t\t\t</IconSettings>\n\t\t);\n\t\treturn ReactDOM.findDOMNode(ref.current);\n\t};\n\n\tconst createButton = (props) =>\n\t\tReact.createElement(SLDSButton, assign({}, defaultProps, props));\n\tconst getButton = (props) => renderButton(createButton(props));\n\n\tdescribe('Basic Button Props Render', () => {\n\t\tlet cmp;\n\t\tlet btn;\n\n\t\tbeforeEach(() => {\n\t\t\tcmp = getButton({\n\t\t\t\tid: 'custom-id',\n\t\t\t\ttext: 'Brand',\n\t\t\t\ttheme: 'brand',\n\t\t\t\tstyle: { background: 'rgb(18, 49, 35)' },\n\t\t\t});\n\t\t\t[btn] = cmp.getElementsByClassName('slds-button');\n\t\t\tconsole.log('!!!!!', cmp, btn);\n\t\t});\n\n\t\tit('renders correct label', () => {\n\t\t\texpect(btn.textContent).to.equal('Neutral');\n\t\t});\n\n\t\tit('renders correct variant styles', () => {\n\t\t\texpect(btn.className).to.include('slds-button_neutral');\n\t\t});\n\n\t\tit('renders custom id', () => {\n\t\t\texpect(btn.getAttribute('id')).to.equal('custom-id');\n\t\t});\n\n\t\tit('renders custom styles', function () {\n\t\t\tbtn.style.backgroundColor.should.equal('rgb(18, 49, 35)');\n\t\t});\n\t});\n\n\tdescribe('Form Props Render ', () => {\n\t\tlet cmp;\n\t\tlet btn;\n\t\tconst formAction = 'http://localhost/some/url';\n\n\t\tbeforeEach(() => {\n\t\t\tcmp = getButton({\n\t\t\t\tid: 'custom-id',\n\t\t\t\tformAction,\n\t\t\t});\n\t\t\t[btn] = cmp.getElementsByClassName('slds-button');\n\t\t});\n\n\t\tit('renders formAction prop', () => {\n\t\t\texpect(btn.formAction).to.equal(formAction);\n\t\t});\n\t});\n\n\tdescribe('Data Props Render ', () => {\n\t\tlet cmp;\n\t\tlet btn;\n\n\t\tbeforeEach(() => {\n\t\t\tcmp = getButton({\n\t\t\t\tid: 'custom-id',\n\t\t\t\t'data-some-attribute': 'some value',\n\t\t\t});\n\t\t\t[btn] = cmp.getElementsByClassName('slds-button');\n\t\t});\n\n\t\tit('renders data-some-attribute prop', () => {\n\t\t\texpect(btn.getAttribute('data-some-attribute')).to.equal('some value');\n\t\t});\n\t});\n\n\tdescribe('Icon with Label Button Props Render', () => {\n\t\tlet cmp;\n\t\tlet btn;\n\t\tlet svg;\n\n\t\tbeforeEach(() => {\n\t\t\tcmp = getButton({\n\t\t\t\tlabel: 'Neutral with Icon',\n\t\t\t\ticonName: 'download',\n\t\t\t\ticonCategory: 'action',\n\t\t\t\ticonPosition: 'right',\n\t\t\t\tvariant: 'neutral',\n\t\t\t});\n\t\t\t[btn] = cmp.getElementsByClassName('slds-button');\n\t\t\t[svg] = cmp.getElementsByClassName('slds-button__icon');\n\t\t});\n\n\t\tit('renders label', () => {\n\t\t\texpect(btn.textContent).to.equal('Neutral with Icon');\n\t\t});\n\n\t\tit('renders icon', () => {\n\t\t\texpect(svg.className.baseVal).to.include('slds-button__icon_right');\n\t\t});\n\t});\n\n\tdescribe('Icon Button Props render', () => {\n\t\tlet cmp;\n\t\tlet asstText;\n\t\tlet svg;\n\n\t\tbeforeEach(() => {\n\t\t\tcmp = getButton({\n\t\t\t\tassistiveText: { icon: 'my settings' },\n\t\t\t\tvariant: 'icon',\n\t\t\t\ticonCategory: 'utility',\n\t\t\t\ticonName: 'settings',\n\t\t\t\ticonSize: 'small',\n\t\t\t\ticonVariant: 'bare',\n\t\t\t});\n\t\t\t[asstText] = cmp.getElementsByClassName('slds-assistive-text');\n\t\t\t[svg] = cmp.getElementsByTagName('svg');\n\t\t});\n\n\t\tit('renders label', () => {\n\t\t\texpect(asstText.textContent).to.equal('my settings');\n\t\t});\n\n\t\tit('renders icon styles', () => {\n\t\t\texpect(svg.className.baseVal).to.include('slds-button__icon');\n\t\t});\n\t});\n\n\tdescribe('(icon path) Icon Button renders assistive text', () => {\n\t\tlet cmp;\n\t\tlet asstText;\n\n\t\tbeforeEach(() => {\n\t\t\tcmp = getButton({\n\t\t\t\tassistiveText: { icon: 'News' },\n\t\t\t\ticonSize: 'large',\n\t\t\t\ticonPath: '/assets/icons/utility-sprite/svg/symbols.svg#announcement',\n\t\t\t\ttitle: 'announcement',\n\t\t\t});\n\t\t\t[asstText] = cmp.getElementsByClassName('slds-assistive-text');\n\t\t});\n\n\t\tit('renders label', () => {\n\t\t\texpect(asstText.textContent).to.equal('News');\n\t\t});\n\t});\n\n\tdescribe('External Path Icon Button renders', () => {\n\t\tlet cmp;\n\t\tlet use;\n\t\tlet svgHref;\n\n\t\tbefore(() => {\n\t\t\tcmp = getButton({\n\t\t\t\tassistiveText: { icon: 'announcement' },\n\t\t\t\tvariant: 'icon',\n\t\t\t\ticonPath: '/assets/icons/utility-sprite/svg/symbols.svg#announcement',\n\t\t\t\ticonSize: 'large',\n\t\t\t\ticonVariant: 'bare',\n\t\t\t});\n\t\t\t[use] = cmp.getElementsByTagName('use');\n\t\t\tsvgHref = use.getAttribute('href');\n\t\t});\n\n\t\tit('renders svg', () => {\n\t\t\texpect(svgHref).to.equal(\n\t\t\t\t'/assets/icons/utility-sprite/svg/symbols.svg#announcement'\n\t\t\t);\n\t\t});\n\t});\n\n\tdescribe('Button Clickable', () => {\n\t\tlet cmp;\n\t\tlet btn;\n\t\tlet clicked;\n\n\t\tfunction setClick() {\n\t\t\tclicked = true;\n\t\t}\n\n\t\tbeforeEach(() => {\n\t\t\tclicked = false;\n\t\t\tcmp = getButton({\n\t\t\t\tlabel: 'Neutral',\n\t\t\t\tvariant: 'neutral',\n\t\t\t\tonClick: setClick,\n\t\t\t});\n\t\t\t[btn] = cmp.getElementsByClassName('slds-button');\n\t\t});\n\n\t\tit('can be clicked', () => {\n\t\t\t/* eslint-disable no-unused-expressions */\n\t\t\texpect(clicked).to.be.false;\n\t\t\tSimulate.click(btn, {});\n\t\t\texpect(clicked).to.be.true;\n\t\t\t/* eslint-enable no-unused-expressions */\n\t\t});\n\t});\n});\n"],"file":"button.browser-test.js"}
|
|
1
|
+
{"version":3,"sources":["../../../../.tmp-es/components/button/__tests__/button.browser-test.jsx"],"names":["React","ReactDOM","TestUtils","expect","assign","SLDSButton","IconSettings","Simulate","mockCallback","sinon","spy","describe","defaultProps","label","onClick","variant","renderButton","instance","ref","createRef","renderIntoDocument","findDOMNode","current","createButton","props","createElement","getButton","cmp","btn","beforeEach","id","text","theme","style","background","getElementsByClassName","it","textContent","to","equal","className","include","getAttribute","backgroundColor","should","formAction","svg","iconName","iconCategory","iconPosition","baseVal","asstText","assistiveText","icon","iconSize","iconVariant","getElementsByTagName","iconPath","title","use","svgHref","before","clicked","setClick","be","false","click","true"],"mappings":";;;;;;;;;;;;AAAA;;AACA;AACA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,QAAP,MAAqB,WAArB;AACA,OAAOC,SAAP,MAAsB,sBAAtB;AACA,SAASC,MAAT,QAAuB,MAAvB;AACA,OAAOC,MAAP,MAAmB,eAAnB;AAEA,OAAOC,UAAP,MAAuB,cAAvB;AACA,OAAOC,YAAP,MAAyB,qBAAzB;AAEA,IAAQC,QAAR,GAAqBL,SAArB,CAAQK,QAAR;AAEA,IAAMC,YAAY,GAAGC,KAAK,CAACC,GAAN,EAArB;AAEAC,QAAQ,CAAC,cAAD,EAAiB,YAAM;AAC9B,MAAMC,YAAY,GAAG;AACpBC,IAAAA,KAAK,EAAE,SADa;AAEpBC,IAAAA,OAAO,EAAEN,YAFW;AAGpBO,IAAAA,OAAO,EAAE;AAHW,GAArB;;AAMA,MAAMC,YAAY,GAAG,SAAfA,YAAe,CAACC,QAAD,EAAc;AAClC,QAAMC,GAAG,gBAAGlB,KAAK,CAACmB,SAAN,EAAZ;AACAjB,IAAAA,SAAS,CAACkB,kBAAV,eACC,oBAAC,YAAD;AAAc,MAAA,QAAQ,EAAC;AAAvB,oBACC;AAAK,MAAA,GAAG,EAAEF;AAAV,OAAgBD,QAAhB,CADD,CADD;AAKA,WAAOhB,QAAQ,CAACoB,WAAT,CAAqBH,GAAG,CAACI,OAAzB,CAAP;AACA,GARD;;AAUA,MAAMC,YAAY,GAAG,SAAfA,YAAe,CAACC,KAAD;AAAA,wBACpBxB,KAAK,CAACyB,aAAN,CAAoBpB,UAApB,EAAgCD,MAAM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,GAPe;AAQhB,KARS,CAAV;AAUAQ,IAAAA,EAAE,CAAC,gBAAD,EAAmB,YAAM;AAC1B;AACAjC,MAAAA,MAAM,CAAC2D,OAAD,CAAN,CAAgBxB,EAAhB,CAAmB0B,EAAnB,CAAsBC,KAAtB;AACA1D,MAAAA,QAAQ,CAAC2D,KAAT,CAAetC,GAAf,EAAoB,EAApB;AACAzB,MAAAA,MAAM,CAAC2D,OAAD,CAAN,CAAgBxB,EAAhB,CAAmB0B,EAAnB,CAAsBG,IAAtB;AACA;AACA,KANC,CAAF;AAOA,GA1BO,CAAR;AA2BA,CAlNO,CAAR","sourcesContent":["/* eslint-disable react/no-render-return-value */\n/* eslint-disable react/no-find-dom-node */\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport TestUtils from 'react-dom/test-utils';\nimport { expect } from 'chai';\nimport assign from 'lodash.assign';\n\nimport SLDSButton from '../../button';\nimport IconSettings from '../../icon-settings';\n\nconst { Simulate } = TestUtils;\n\nconst mockCallback = sinon.spy();\n\ndescribe('SLDSButton: ', () => {\n\tconst defaultProps = {\n\t\tlabel: 'Neutral',\n\t\tonClick: mockCallback,\n\t\tvariant: 'neutral',\n\t};\n\n\tconst renderButton = (instance) => {\n\t\tconst ref = React.createRef();\n\t\tTestUtils.renderIntoDocument(\n\t\t\t<IconSettings iconPath=\"/assets/icons\">\n\t\t\t\t<div ref={ref}>{instance}</div>\n\t\t\t</IconSettings>\n\t\t);\n\t\treturn ReactDOM.findDOMNode(ref.current);\n\t};\n\n\tconst createButton = (props) =>\n\t\tReact.createElement(SLDSButton, assign({}, defaultProps, props));\n\tconst getButton = (props) => renderButton(createButton(props));\n\n\tdescribe('Basic Button Props Render', () => {\n\t\tlet cmp;\n\t\tlet btn;\n\n\t\tbeforeEach(() => {\n\t\t\tcmp = getButton({\n\t\t\t\tid: 'custom-id',\n\t\t\t\ttext: 'Brand',\n\t\t\t\ttheme: 'brand',\n\t\t\t\tstyle: { background: 'rgb(18, 49, 35)' },\n\t\t\t});\n\t\t\t[btn] = cmp.getElementsByClassName('slds-button');\n\t\t});\n\n\t\tit('renders correct label', () => {\n\t\t\texpect(btn.textContent).to.equal('Neutral');\n\t\t});\n\n\t\tit('renders correct variant styles', () => {\n\t\t\texpect(btn.className).to.include('slds-button_neutral');\n\t\t});\n\n\t\tit('renders custom id', () => {\n\t\t\texpect(btn.getAttribute('id')).to.equal('custom-id');\n\t\t});\n\n\t\tit('renders custom styles', function () {\n\t\t\tbtn.style.backgroundColor.should.equal('rgb(18, 49, 35)');\n\t\t});\n\t});\n\n\tdescribe('Form Props Render ', () => {\n\t\tlet cmp;\n\t\tlet btn;\n\t\tconst formAction = 'http://localhost/some/url';\n\n\t\tbeforeEach(() => {\n\t\t\tcmp = getButton({\n\t\t\t\tid: 'custom-id',\n\t\t\t\tformAction,\n\t\t\t});\n\t\t\t[btn] = cmp.getElementsByClassName('slds-button');\n\t\t});\n\n\t\tit('renders formAction prop', () => {\n\t\t\texpect(btn.formAction).to.equal(formAction);\n\t\t});\n\t});\n\n\tdescribe('Data Props Render ', () => {\n\t\tlet cmp;\n\t\tlet btn;\n\n\t\tbeforeEach(() => {\n\t\t\tcmp = getButton({\n\t\t\t\tid: 'custom-id',\n\t\t\t\t'data-some-attribute': 'some value',\n\t\t\t});\n\t\t\t[btn] = cmp.getElementsByClassName('slds-button');\n\t\t});\n\n\t\tit('renders data-some-attribute prop', () => {\n\t\t\texpect(btn.getAttribute('data-some-attribute')).to.equal('some value');\n\t\t});\n\t});\n\n\tdescribe('Icon with Label Button Props Render', () => {\n\t\tlet cmp;\n\t\tlet btn;\n\t\tlet svg;\n\n\t\tbeforeEach(() => {\n\t\t\tcmp = getButton({\n\t\t\t\tlabel: 'Neutral with Icon',\n\t\t\t\ticonName: 'download',\n\t\t\t\ticonCategory: 'action',\n\t\t\t\ticonPosition: 'right',\n\t\t\t\tvariant: 'neutral',\n\t\t\t});\n\t\t\t[btn] = cmp.getElementsByClassName('slds-button');\n\t\t\t[svg] = cmp.getElementsByClassName('slds-button__icon');\n\t\t});\n\n\t\tit('renders label', () => {\n\t\t\texpect(btn.textContent).to.equal('Neutral with Icon');\n\t\t});\n\n\t\tit('renders icon', () => {\n\t\t\texpect(svg.className.baseVal).to.include('slds-button__icon_right');\n\t\t});\n\t});\n\n\tdescribe('Icon Button Props render', () => {\n\t\tlet cmp;\n\t\tlet asstText;\n\t\tlet svg;\n\n\t\tbeforeEach(() => {\n\t\t\tcmp = getButton({\n\t\t\t\tassistiveText: { icon: 'my settings' },\n\t\t\t\tvariant: 'icon',\n\t\t\t\ticonCategory: 'utility',\n\t\t\t\ticonName: 'settings',\n\t\t\t\ticonSize: 'small',\n\t\t\t\ticonVariant: 'bare',\n\t\t\t});\n\t\t\t[asstText] = cmp.getElementsByClassName('slds-assistive-text');\n\t\t\t[svg] = cmp.getElementsByTagName('svg');\n\t\t});\n\n\t\tit('renders label', () => {\n\t\t\texpect(asstText.textContent).to.equal('my settings');\n\t\t});\n\n\t\tit('renders icon styles', () => {\n\t\t\texpect(svg.className.baseVal).to.include('slds-button__icon');\n\t\t});\n\t});\n\n\tdescribe('(icon path) Icon Button renders assistive text', () => {\n\t\tlet cmp;\n\t\tlet asstText;\n\n\t\tbeforeEach(() => {\n\t\t\tcmp = getButton({\n\t\t\t\tassistiveText: { icon: 'News' },\n\t\t\t\ticonSize: 'large',\n\t\t\t\ticonPath: '/assets/icons/utility-sprite/svg/symbols.svg#announcement',\n\t\t\t\ttitle: 'announcement',\n\t\t\t});\n\t\t\t[asstText] = cmp.getElementsByClassName('slds-assistive-text');\n\t\t});\n\n\t\tit('renders label', () => {\n\t\t\texpect(asstText.textContent).to.equal('News');\n\t\t});\n\t});\n\n\tdescribe('External Path Icon Button renders', () => {\n\t\tlet cmp;\n\t\tlet use;\n\t\tlet svgHref;\n\n\t\tbefore(() => {\n\t\t\tcmp = getButton({\n\t\t\t\tassistiveText: { icon: 'announcement' },\n\t\t\t\tvariant: 'icon',\n\t\t\t\ticonPath: '/assets/icons/utility-sprite/svg/symbols.svg#announcement',\n\t\t\t\ticonSize: 'large',\n\t\t\t\ticonVariant: 'bare',\n\t\t\t});\n\t\t\t[use] = cmp.getElementsByTagName('use');\n\t\t\tsvgHref = use.getAttribute('href');\n\t\t});\n\n\t\tit('renders svg', () => {\n\t\t\texpect(svgHref).to.equal(\n\t\t\t\t'/assets/icons/utility-sprite/svg/symbols.svg#announcement'\n\t\t\t);\n\t\t});\n\t});\n\n\tdescribe('Button Clickable', () => {\n\t\tlet cmp;\n\t\tlet btn;\n\t\tlet clicked;\n\n\t\tfunction setClick() {\n\t\t\tclicked = true;\n\t\t}\n\n\t\tbeforeEach(() => {\n\t\t\tclicked = false;\n\t\t\tcmp = getButton({\n\t\t\t\tlabel: 'Neutral',\n\t\t\t\tvariant: 'neutral',\n\t\t\t\tonClick: setClick,\n\t\t\t});\n\t\t\t[btn] = cmp.getElementsByClassName('slds-button');\n\t\t});\n\n\t\tit('can be clicked', () => {\n\t\t\t/* eslint-disable no-unused-expressions */\n\t\t\texpect(clicked).to.be.false;\n\t\t\tSimulate.click(btn, {});\n\t\t\texpect(clicked).to.be.true;\n\t\t\t/* eslint-enable no-unused-expressions */\n\t\t});\n\t});\n});\n"],"file":"button.browser-test.js"}
|
|
@@ -62,6 +62,9 @@ import IconSettings from '../../../components/icon-settings';
|
|
|
62
62
|
*/
|
|
63
63
|
|
|
64
64
|
chai.use(chaiEnzyme());
|
|
65
|
+
|
|
66
|
+
var callbacks = require('../../../utilities/key-callbacks');
|
|
67
|
+
|
|
65
68
|
var accounts = [{
|
|
66
69
|
id: '1',
|
|
67
70
|
label: 'Acme',
|
|
@@ -522,6 +525,25 @@ describe('SLDSCombobox', function describeFunction() {
|
|
|
522
525
|
|
|
523
526
|
expect(scrollTop2 === 4 || scrollTop2 === 0).to.eql(true); // done because menu and menu item size in phantomjs is weird
|
|
524
527
|
});
|
|
528
|
+
it('propagates keyboard events when menu is closed', function () {
|
|
529
|
+
var spiedCallbacks = sinon.spy(callbacks, 'default');
|
|
530
|
+
wrapper = mount( /*#__PURE__*/React.createElement(DemoComponent, {
|
|
531
|
+
variant: "inline-listbox"
|
|
532
|
+
}), {
|
|
533
|
+
attachTo: mountNode
|
|
534
|
+
});
|
|
535
|
+
var nodes = getNodes({
|
|
536
|
+
wrapper: wrapper
|
|
537
|
+
}); // click in the input to open up menu
|
|
538
|
+
|
|
539
|
+
nodes.input.simulate('click', {}); // esc to close the menu and stop event propagation
|
|
540
|
+
|
|
541
|
+
nodes.input.simulate('keyDown', keyObjects.ESCAPE);
|
|
542
|
+
expect(spiedCallbacks.getCall(0).lastArg.stopPropagation).to.equal(true); // esc to propagate the events further up
|
|
543
|
+
|
|
544
|
+
nodes.input.simulate('keyDown', keyObjects.ESCAPE);
|
|
545
|
+
expect(spiedCallbacks.getCall(1).lastArg.stopPropagation).to.equal(false);
|
|
546
|
+
});
|
|
525
547
|
});
|
|
526
548
|
describe('Variant-specific', function () {
|
|
527
549
|
beforeEach(function () {
|