@salesforce/design-system-react 0.10.44 → 0.10.47

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.
Files changed (81) hide show
  1. package/components/button/__tests__/button.browser-test.jsx +0 -1
  2. package/components/combobox/combobox.d.ts +3 -0
  3. package/components/combobox/combobox.jsx +4 -1
  4. package/components/component-docs.json +6 -3
  5. package/components/data-table/cell.jsx +2 -2
  6. package/components/data-table/index.jsx +134 -85
  7. package/components/data-table/private/context-helper.js +26 -14
  8. package/components/data-table/private/head.jsx +269 -260
  9. package/components/data-table/private/header-cell.jsx +204 -230
  10. package/components/data-table/private/row.jsx +140 -105
  11. package/components/data-table/row-actions.jsx +2 -2
  12. package/components/pill-container/__docs__/__snapshots__/storybook-stories.storyshot +15 -15
  13. package/components/pill-container/private/selected-listbox.jsx +1 -0
  14. package/components/popover/__tests__/popover.browser-test.jsx +28 -0
  15. package/components/progress-indicator.d.ts +29 -8
  16. package/components/slider.d.ts +10 -4
  17. package/components/utilities/truncate/index.jsx +1 -1
  18. package/design-system-react-components.js +62406 -0
  19. package/design-system-react-components.js.map +1 -0
  20. package/design-system-react-components.min.js +3 -0
  21. package/design-system-react-components.min.js.LICENSE.txt +83 -0
  22. package/design-system-react-components.min.js.map +1 -0
  23. package/design-system-react.js +73800 -0
  24. package/design-system-react.js.map +1 -0
  25. package/design-system-react.min.js +3 -0
  26. package/design-system-react.min.js.LICENSE.txt +83 -0
  27. package/design-system-react.min.js.map +1 -0
  28. package/lib/components/button/__tests__/button.browser-test.jsx +0 -1
  29. package/lib/components/combobox/combobox.d.ts +3 -0
  30. package/lib/components/combobox/combobox.js +4 -1
  31. package/lib/components/component-docs.json +6 -3
  32. package/lib/components/data-table/cell.js +6 -6
  33. package/lib/components/data-table/index.js +131 -99
  34. package/lib/components/data-table/private/context-helper.js +13 -14
  35. package/lib/components/data-table/private/head.js +233 -252
  36. package/lib/components/data-table/private/header-cell.js +185 -221
  37. package/lib/components/data-table/private/row.js +97 -89
  38. package/lib/components/data-table/row-actions.js +6 -6
  39. package/lib/components/pill-container/__docs__/__snapshots__/storybook-stories.storyshot +15 -15
  40. package/lib/components/pill-container/private/selected-listbox.js +3 -0
  41. package/lib/components/popover/__tests__/popover.browser-test.jsx +28 -0
  42. package/lib/components/progress-indicator.d.ts +29 -8
  43. package/lib/components/slider.d.ts +10 -4
  44. package/lib/components/utilities/truncate/index.js +2 -2
  45. package/lib/design-system-react-components.min.js.LICENSE.txt +83 -0
  46. package/lib/design-system-react.min.js.LICENSE.txt +83 -0
  47. package/lib/package.json +5 -5
  48. package/lib/utilities/keyboard-navigable-dialog.js +6 -1
  49. package/module/components/button/__tests__/button.browser-test.js +0 -1
  50. package/module/components/button/__tests__/button.browser-test.js.map +1 -1
  51. package/module/components/combobox/combobox.d.ts +3 -0
  52. package/module/components/combobox/combobox.js +4 -1
  53. package/module/components/combobox/combobox.js.map +1 -1
  54. package/module/components/component-docs.json +6 -3
  55. package/module/components/data-table/cell.js +6 -6
  56. package/module/components/data-table/cell.js.map +1 -1
  57. package/module/components/data-table/index.js +124 -95
  58. package/module/components/data-table/index.js.map +1 -1
  59. package/module/components/data-table/private/context-helper.js +12 -12
  60. package/module/components/data-table/private/context-helper.js.map +1 -1
  61. package/module/components/data-table/private/head.js +230 -255
  62. package/module/components/data-table/private/head.js.map +1 -1
  63. package/module/components/data-table/private/header-cell.js +184 -225
  64. package/module/components/data-table/private/header-cell.js.map +1 -1
  65. package/module/components/data-table/private/row.js +95 -87
  66. package/module/components/data-table/private/row.js.map +1 -1
  67. package/module/components/data-table/row-actions.js +6 -6
  68. package/module/components/data-table/row-actions.js.map +1 -1
  69. package/module/components/pill-container/__docs__/__snapshots__/storybook-stories.storyshot +15 -15
  70. package/module/components/pill-container/private/selected-listbox.js +3 -0
  71. package/module/components/pill-container/private/selected-listbox.js.map +1 -1
  72. package/module/components/popover/__tests__/popover.browser-test.js +25 -0
  73. package/module/components/popover/__tests__/popover.browser-test.js.map +1 -1
  74. package/module/components/progress-indicator.d.ts +29 -8
  75. package/module/components/slider.d.ts +10 -4
  76. package/module/components/utilities/truncate/index.js +1 -1
  77. package/module/components/utilities/truncate/index.js.map +1 -1
  78. package/module/utilities/keyboard-navigable-dialog.js +4 -1
  79. package/module/utilities/keyboard-navigable-dialog.js.map +1 -1
  80. package/package.json +5 -5
  81. package/utilities/keyboard-navigable-dialog.js +3 -0
@@ -25,7 +25,7 @@ var _cellContext = _interopRequireDefault(require("./private/cell-context"));
25
25
 
26
26
  var _tableContext = _interopRequireDefault(require("./private/table-context"));
27
27
 
28
- var _contextHelper2 = _interopRequireDefault(require("./private/context-helper"));
28
+ var _contextHelper = _interopRequireDefault(require("./private/context-helper"));
29
29
 
30
30
  var _constants = require("../../utilities/constants");
31
31
 
@@ -99,11 +99,11 @@ var DataTableRowActions = function DataTableRowActions(props) {
99
99
  var tableContext = (0, _react.useContext)(_tableContext.default);
100
100
  var cellContext = (0, _react.useContext)(_cellContext.default);
101
101
 
102
- var _contextHelper = (0, _contextHelper2.default)(tableContext, cellContext, props.fixedLayout),
103
- tabIndex = _contextHelper.tabIndex,
104
- hasFocus = _contextHelper.hasFocus,
105
- handleFocus = _contextHelper.handleFocus,
106
- handleKeyDown = _contextHelper.handleKeyDown;
102
+ var _useContextHelper = (0, _contextHelper.default)(tableContext, cellContext, props.fixedLayout),
103
+ tabIndex = _useContextHelper.tabIndex,
104
+ hasFocus = _useContextHelper.hasFocus,
105
+ handleFocus = _useContextHelper.handleFocus,
106
+ handleKeyDown = _useContextHelper.handleKeyDown;
107
107
 
108
108
  var handleClick = function handleClick(e) {
109
109
  _event.default.trap(e);
@@ -43,7 +43,7 @@ exports[`DOM snapshots SLDSPillContainer Bare Pill Container 1`] = `
43
43
  >
44
44
  <span
45
45
  className="slds-pill__label"
46
- title="Pill Label 1"
46
+ title="Full pill label verbiage mirrored here"
47
47
  >
48
48
  Pill Label 1
49
49
  </span>
@@ -89,7 +89,7 @@ exports[`DOM snapshots SLDSPillContainer Bare Pill Container 1`] = `
89
89
  >
90
90
  <span
91
91
  className="slds-pill__label"
92
- title="Pill Label 2"
92
+ title="Full pill label verbiage mirrored here"
93
93
  >
94
94
  Pill Label 2
95
95
  </span>
@@ -169,7 +169,7 @@ exports[`DOM snapshots SLDSPillContainer Base Pill Container 1`] = `
169
169
  >
170
170
  <span
171
171
  className="slds-pill__label"
172
- title="Pill Label 1"
172
+ title="Full pill label verbiage mirrored here"
173
173
  >
174
174
  Pill Label 1
175
175
  </span>
@@ -215,7 +215,7 @@ exports[`DOM snapshots SLDSPillContainer Base Pill Container 1`] = `
215
215
  >
216
216
  <span
217
217
  className="slds-pill__label"
218
- title="Pill Label 2"
218
+ title="Full pill label verbiage mirrored here"
219
219
  >
220
220
  Pill Label 2
221
221
  </span>
@@ -311,7 +311,7 @@ exports[`DOM snapshots SLDSPillContainer Pill Container With Avatars 1`] = `
311
311
  </span>
312
312
  <span
313
313
  className="slds-pill__label"
314
- title="Pill Label 1"
314
+ title="Full pill label verbiage mirrored here"
315
315
  >
316
316
  Pill Label 1
317
317
  </span>
@@ -373,7 +373,7 @@ exports[`DOM snapshots SLDSPillContainer Pill Container With Avatars 1`] = `
373
373
  </span>
374
374
  <span
375
375
  className="slds-pill__label"
376
- title="Pill Label 2"
376
+ title="Full pill label verbiage mirrored here"
377
377
  >
378
378
  Pill Label 2
379
379
  </span>
@@ -471,7 +471,7 @@ exports[`DOM snapshots SLDSPillContainer Pill Container With Icons 1`] = `
471
471
  </span>
472
472
  <span
473
473
  className="slds-pill__label"
474
- title="Pill Label 1"
474
+ title="Full pill label verbiage mirrored here"
475
475
  >
476
476
  Pill Label 1
477
477
  </span>
@@ -535,7 +535,7 @@ exports[`DOM snapshots SLDSPillContainer Pill Container With Icons 1`] = `
535
535
  </span>
536
536
  <span
537
537
  className="slds-pill__label"
538
- title="Pill Label 2"
538
+ title="Full pill label verbiage mirrored here"
539
539
  >
540
540
  Pill Label 2
541
541
  </span>
@@ -598,7 +598,7 @@ exports[`DOM snapshots SLDSPillContainer Pill Container With Icons 1`] = `
598
598
  </span>
599
599
  <span
600
600
  className="slds-pill__label"
601
- title="Pill Label 3"
601
+ title="Full pill label verbiage mirrored here"
602
602
  >
603
603
  Pill Label 3
604
604
  </span>
@@ -662,7 +662,7 @@ exports[`DOM snapshots SLDSPillContainer Pill Container With Icons 1`] = `
662
662
  </span>
663
663
  <span
664
664
  className="slds-pill__label"
665
- title="Pill Label 4"
665
+ title="Full pill label verbiage mirrored here"
666
666
  >
667
667
  Pill Label 4
668
668
  </span>
@@ -726,7 +726,7 @@ exports[`DOM snapshots SLDSPillContainer Pill Container With Icons 1`] = `
726
726
  </span>
727
727
  <span
728
728
  className="slds-pill__label"
729
- title="Pill Label 5"
729
+ title="Full pill label verbiage mirrored here"
730
730
  >
731
731
  Pill Label 5
732
732
  </span>
@@ -790,7 +790,7 @@ exports[`DOM snapshots SLDSPillContainer Pill Container With Icons 1`] = `
790
790
  </span>
791
791
  <span
792
792
  className="slds-pill__label"
793
- title="Pill Label 6"
793
+ title="Full pill label verbiage mirrored here"
794
794
  >
795
795
  Pill Label 6
796
796
  </span>
@@ -854,7 +854,7 @@ exports[`DOM snapshots SLDSPillContainer Pill Container With Icons 1`] = `
854
854
  </span>
855
855
  <span
856
856
  className="slds-pill__label"
857
- title="Pill Label 7"
857
+ title="Full pill label verbiage mirrored here"
858
858
  >
859
859
  Pill Label 7
860
860
  </span>
@@ -918,7 +918,7 @@ exports[`DOM snapshots SLDSPillContainer Pill Container With Icons 1`] = `
918
918
  </span>
919
919
  <span
920
920
  className="slds-pill__label"
921
- title="Pill Label 8"
921
+ title="Full pill label verbiage mirrored here"
922
922
  >
923
923
  Pill Label 8
924
924
  </span>
@@ -982,7 +982,7 @@ exports[`DOM snapshots SLDSPillContainer Pill Container With Icons 1`] = `
982
982
  </span>
983
983
  <span
984
984
  className="slds-pill__label"
985
- title="Pill Label 9"
985
+ title="Full pill label verbiage mirrored here"
986
986
  >
987
987
  Pill Label 9
988
988
  </span>
@@ -217,6 +217,8 @@ var SelectedListBox = function SelectedListBox(props) {
217
217
  role: props.listboxRole,
218
218
  "aria-orientation": props.listboxAriaOrientation
219
219
  }, props.selection.map(function (option, renderIndex) {
220
+ var _option$title;
221
+
220
222
  var hasTabIndex = renderIndex === props.activeOptionIndex;
221
223
  var icon = getIcon(option);
222
224
  var avatar = !icon ? getAvatar(option) : null;
@@ -260,6 +262,7 @@ var SelectedListBox = function SelectedListBox(props) {
260
262
  icon: icon,
261
263
  labels: {
262
264
  label: option.label,
265
+ title: (_option$title = option.title) !== null && _option$title !== void 0 ? _option$title : option.label,
263
266
  removeTitle: props.labels.removePillTitle
264
267
  },
265
268
  requestFocus: props.listboxHasFocus,
@@ -238,6 +238,34 @@ describe('SLDSPopover', function () {
238
238
  const trigger = wrapper.find(defaultIds.trigger);
239
239
  trigger.simulate('click');
240
240
  });
241
+
242
+ it('stops event propagation after closing on ESC', function (done) {
243
+ const mockEvent = {
244
+ key: 'Esc',
245
+ keyCode: 27,
246
+ which: 27,
247
+ stopPropagation: sinon.spy(),
248
+ };
249
+ wrapper = mount(
250
+ <DemoComponent
251
+ onOpen={() => {
252
+ wrapper.update();
253
+ const popover = wrapper.find(`#${defaultIds.popover}`);
254
+ popover.simulate('keyDown', mockEvent);
255
+ }}
256
+ onKeyDown={() => {
257
+ setTimeout(() => {
258
+ expect(mockEvent.stopPropagation.callCount).to.equal(1);
259
+ done();
260
+ }, 0);
261
+ }}
262
+ />,
263
+ { attachTo: mountNode }
264
+ );
265
+
266
+ const trigger = wrapper.find(defaultIds.trigger);
267
+ trigger.simulate('click');
268
+ });
241
269
  });
242
270
  });
243
271
 
@@ -1,5 +1,20 @@
1
1
  declare module '@salesforce/design-system-react/components/progress-indicator' {
2
2
  import React from 'react';
3
+
4
+ type Step = {
5
+ id: string | number;
6
+ label: string | JSX.Element;
7
+ assistiveText?: string;
8
+ };
9
+
10
+ type StepState = {
11
+ isCompleted: boolean;
12
+ isDisabled: boolean;
13
+ isError: boolean;
14
+ isSelected: boolean;
15
+ step: Step;
16
+ };
17
+
3
18
  type Props = {
4
19
  /**
5
20
  * **Assistive text for accessibility**
@@ -23,16 +38,16 @@ declare module '@salesforce/design-system-react/components/progress-indicator' {
23
38
  /**
24
39
  * Stores all completed steps. It is an array of step objects.
25
40
  */
26
- completedSteps?: any[];
41
+ completedSteps?: Step[];
27
42
  /**
28
43
  * Stores all disabled steps. It is an array of step objects. Steps are still clickable/focusable,
29
44
  * this only disables cursor change and removes onClick and onFocus event callbacks.
30
45
  */
31
- disabledSteps?: any[];
46
+ disabledSteps?: Step[];
32
47
  /**
33
48
  * Stores all error steps. It is an array of step objects and usually there is only one error step, the current step. If an error occurs a second error icon should be placed to the left of related confirmation buttons (e.g. Cancel, Save) and an Error Popover should appear indicating there are errors. These additional items are NOT part of this component. This note was included for visibility purposes. Please refer to [SLDS website](https://www.lightningdesignsystem.com/components/progress-indicator/) for full details **
34
49
  */
35
- errorSteps?: any[];
50
+ errorSteps?: Step[];
36
51
  /**
37
52
  * HTML id for component.
38
53
  */
@@ -48,7 +63,10 @@ declare module '@salesforce/design-system-react/components/progress-indicator' {
48
63
  * <ProgressIndicator onStepClick={handleStepClick} />
49
64
  * ```
50
65
  */
51
- onStepClick?: (v: any) => any;
66
+ onStepClick?: (
67
+ event: React.ChangeEvent<HTMLInputElement>,
68
+ data: StepState
69
+ ) => void;
52
70
  /**
53
71
  * Triggered when an individual step is focused. By default, it receives an event and returns step state and the step object clicked: `{ isCompleted, isDisabled, isError, isSelected, step }`. Users are able to pass a callback handleClick function in forms of: <function name>(event, data) where data is the callback result.
54
72
  * ```
@@ -56,11 +74,14 @@ declare module '@salesforce/design-system-react/components/progress-indicator' {
56
74
  * <ProgressIndicator onStepFocus={handleStepFocus} />
57
75
  * ```
58
76
  */
59
- onStepFocus?: (v: any) => any;
77
+ onStepFocus?: (
78
+ event: React.ChangeEvent<HTMLInputElement>,
79
+ data: StepState
80
+ ) => void;
60
81
  /**
61
82
  * Represents the currently selected or active step. It is a step object.
62
83
  */
63
- selectedStep: Record<string, any> /*.isRequired*/;
84
+ selectedStep: Step /* .isRequired */;
64
85
  /**
65
86
  * It is an array of step objects in the following form:
66
87
  * ```
@@ -71,11 +92,11 @@ declare module '@salesforce/design-system-react/components/progress-indicator' {
71
92
  * }],
72
93
  * ```
73
94
  */
74
- steps: any[] /*.isRequired*/;
95
+ steps: Step[] /* .isRequired */;
75
96
  /**
76
97
  * Stores all steps with opened tooltips. This property is mainly for development purposes. The tooltip should only show on hover for the user.
77
98
  */
78
- tooltipIsOpenSteps?: any[];
99
+ tooltipIsOpenSteps?: Step[];
79
100
  /**
80
101
  * Determines component style.
81
102
  */
@@ -55,13 +55,19 @@ declare module '@salesforce/design-system-react/components/slider' {
55
55
  */
56
56
  name?: string;
57
57
  /**
58
- * This event fires whenever the user has modified the data of the control. This callback recieves the following parameters `event, { value: [string] }`.
58
+ * This event fires whenever the user has modified the data of the control. This callback recieves the following parameters `event, { value: number }`.
59
59
  */
60
- onChange?: (v: any) => any;
60
+ onChange?: (
61
+ event: React.ChangeEvent<HTMLInputElement>,
62
+ { value: number }
63
+ ) => void;
61
64
  /**
62
- * This event fires when the value is committed. This callback recieves the following parameters `event, { value: [string] }`.
65
+ * This event fires when the value is committed. This callback recieves the following parameters `event, { value: number }`.
63
66
  */
64
- onInput?: (v: any) => any;
67
+ onInput?: (
68
+ event: React.ChangeEvent<HTMLInputElement>,
69
+ { value: number }
70
+ ) => void;
65
71
  /**
66
72
  * Size of the slider.
67
73
  */
@@ -11,7 +11,7 @@ var _react = _interopRequireDefault(require("react"));
11
11
 
12
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
13
 
14
- var _lodash = _interopRequireDefault(require("lodash.memoize"));
14
+ var _memoizeOne = _interopRequireDefault(require("memoize-one"));
15
15
 
16
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
17
 
@@ -57,7 +57,7 @@ if (documentDefined) {
57
57
  docFragment = document.createDocumentFragment();
58
58
  docFragment.appendChild(canvas);
59
59
  canvasContext = canvas.getContext('2d');
60
- measureWidth = (0, _lodash.default)(function (text, font) {
60
+ measureWidth = (0, _memoizeOne.default)(function (text, font) {
61
61
  canvasContext.font = font;
62
62
  return canvasContext.measureText(text).width;
63
63
  });
@@ -0,0 +1,83 @@
1
+ /*
2
+ object-assign
3
+ (c) Sindre Sorhus
4
+ @license MIT
5
+ */
6
+
7
+ /*!
8
+ Copyright (c) 2015 Jed Watson.
9
+ Based on code that is Copyright 2013-2015, Facebook, Inc.
10
+ All rights reserved.
11
+ */
12
+
13
+ /*!
14
+ Copyright (c) 2017 Jed Watson.
15
+ Licensed under the MIT License (MIT), see
16
+ http://jedwatson.github.io/classnames
17
+ */
18
+
19
+ /*!
20
+ * Adapted from jQuery UI core
21
+ *
22
+ * http://jqueryui.com
23
+ *
24
+ * Copyright 2014 jQuery Foundation and other contributors
25
+ * Released under the MIT license.
26
+ * http://jquery.org/license
27
+ *
28
+ * http://api.jqueryui.com/category/ui-core/
29
+ */
30
+
31
+ /*!
32
+ * design-system-react
33
+ * v0.10.47
34
+ * Copyright (c) 2015-present, Salesforce.com, Inc.
35
+ * All rights reserved.
36
+ *
37
+ * Redistribution and use in source and binary forms, with or without
38
+ * modification, are permitted provided that the following conditions are met:
39
+ * * Redistributions of source code must retain the above copyright
40
+ * notice, this list of conditions and the following disclaimer.
41
+ * * Redistributions in binary form must reproduce the above copyright
42
+ * notice, this list of conditions and the following disclaimer in the
43
+ * documentation and/or other materials provided with the distribution.
44
+ * * Neither the name of the Salesforce.com nor the
45
+ * names of its contributors may be used to endorse or promote products
46
+ * derived from this software without specific prior written permission.
47
+ *
48
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
49
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
50
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
51
+ * DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
52
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
53
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
54
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
55
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
56
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
57
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
58
+ */
59
+
60
+ /**!
61
+ * @fileOverview Kickass library to create and place poppers near their reference elements.
62
+ * @version 1.12.9
63
+ * @license
64
+ * Copyright (c) 2016 Federico Zivolo and contributors
65
+ *
66
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
67
+ * of this software and associated documentation files (the "Software"), to deal
68
+ * in the Software without restriction, including without limitation the rights
69
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
70
+ * copies of the Software, and to permit persons to whom the Software is
71
+ * furnished to do so, subject to the following conditions:
72
+ *
73
+ * The above copyright notice and this permission notice shall be included in all
74
+ * copies or substantial portions of the Software.
75
+ *
76
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
77
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
78
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
79
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
80
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
81
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
82
+ * SOFTWARE.
83
+ */
@@ -0,0 +1,83 @@
1
+ /*
2
+ object-assign
3
+ (c) Sindre Sorhus
4
+ @license MIT
5
+ */
6
+
7
+ /*!
8
+ Copyright (c) 2015 Jed Watson.
9
+ Based on code that is Copyright 2013-2015, Facebook, Inc.
10
+ All rights reserved.
11
+ */
12
+
13
+ /*!
14
+ Copyright (c) 2017 Jed Watson.
15
+ Licensed under the MIT License (MIT), see
16
+ http://jedwatson.github.io/classnames
17
+ */
18
+
19
+ /*!
20
+ * Adapted from jQuery UI core
21
+ *
22
+ * http://jqueryui.com
23
+ *
24
+ * Copyright 2014 jQuery Foundation and other contributors
25
+ * Released under the MIT license.
26
+ * http://jquery.org/license
27
+ *
28
+ * http://api.jqueryui.com/category/ui-core/
29
+ */
30
+
31
+ /*!
32
+ * design-system-react
33
+ * v0.10.47
34
+ * Copyright (c) 2015-present, Salesforce.com, Inc.
35
+ * All rights reserved.
36
+ *
37
+ * Redistribution and use in source and binary forms, with or without
38
+ * modification, are permitted provided that the following conditions are met:
39
+ * * Redistributions of source code must retain the above copyright
40
+ * notice, this list of conditions and the following disclaimer.
41
+ * * Redistributions in binary form must reproduce the above copyright
42
+ * notice, this list of conditions and the following disclaimer in the
43
+ * documentation and/or other materials provided with the distribution.
44
+ * * Neither the name of the Salesforce.com nor the
45
+ * names of its contributors may be used to endorse or promote products
46
+ * derived from this software without specific prior written permission.
47
+ *
48
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
49
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
50
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
51
+ * DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
52
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
53
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
54
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
55
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
56
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
57
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
58
+ */
59
+
60
+ /**!
61
+ * @fileOverview Kickass library to create and place poppers near their reference elements.
62
+ * @version 1.12.9
63
+ * @license
64
+ * Copyright (c) 2016 Federico Zivolo and contributors
65
+ *
66
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
67
+ * of this software and associated documentation files (the "Software"), to deal
68
+ * in the Software without restriction, including without limitation the rights
69
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
70
+ * copies of the Software, and to permit persons to whom the Software is
71
+ * furnished to do so, subject to the following conditions:
72
+ *
73
+ * The above copyright notice and this permission notice shall be included in all
74
+ * copies or substantial portions of the Software.
75
+ *
76
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
77
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
78
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
79
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
80
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
81
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
82
+ * SOFTWARE.
83
+ */
package/lib/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "design-system-react",
3
- "version": "0.10.44",
3
+ "version": "0.10.47",
4
4
  "description": "Salesforce Lightning Design System for React",
5
- "license": "SEE LICENSE IN README.md",
5
+ "license": "BSD-3-Clause",
6
6
  "engines": {},
7
7
  "husky": {
8
8
  "hooks": {
@@ -44,8 +44,8 @@
44
44
  "lodash.isdate": "^4.0.1",
45
45
  "lodash.isequal": "^4.5.0",
46
46
  "lodash.isfunction": "^3.0.9",
47
- "lodash.memoize": "^4.1.2",
48
47
  "lodash.reject": "^4.6.0",
48
+ "memoize-one": "^6.0.0",
49
49
  "popper.js": "^1.10.8",
50
50
  "prop-types": ">=15.7.2",
51
51
  "react-contenteditable": "^3.3.5",
@@ -59,8 +59,8 @@
59
59
  },
60
60
  "peerDependencies": {
61
61
  "@salesforce-ux/design-system": "^2.14.3",
62
- "react": ">=16.3",
63
- "react-dom": ">=16.3"
62
+ "react": ">=16.8",
63
+ "react-dom": ">=16.8"
64
64
  },
65
65
  "components": [
66
66
  {
@@ -9,6 +9,8 @@ var _reactDom = _interopRequireDefault(require("react-dom"));
9
9
 
10
10
  var _keyCode = _interopRequireDefault(require("./key-code"));
11
11
 
12
+ var _event = _interopRequireDefault(require("./event"));
13
+
12
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
15
 
14
16
  /* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */
@@ -44,7 +46,8 @@ var internalHandleClick = function internalHandleClick(_ref) {
44
46
  };
45
47
 
46
48
  var KeyboardNavigableDialog = function KeyboardNavigableDialog(_ref2) {
47
- var isOpen = _ref2.isOpen,
49
+ var event = _ref2.event,
50
+ isOpen = _ref2.isOpen,
48
51
  handleClick = _ref2.handleClick,
49
52
  keyCode = _ref2.keyCode,
50
53
  eventTarget = _ref2.eventTarget,
@@ -55,6 +58,8 @@ var KeyboardNavigableDialog = function KeyboardNavigableDialog(_ref2) {
55
58
  case _keyCode.default.ESCAPE:
56
59
  if (isOpen) {
57
60
  toggleOpen();
61
+
62
+ _event.default.trapEvent(event);
58
63
  }
59
64
 
60
65
  break;
@@ -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,EAA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,MAAM,CAAC2D,OAAD,CAAN,CAAgBtB,EAAhB,CAAmBC,KAAnB,CACC,2DADD;AAGA,KAJC,CAAF;AAKA,GAtBO,CAAR;AAwBA9B,EAAAA,QAAQ,CAAC,kBAAD,EAAqB,YAAM;AAClC,QAAIgB,GAAJ;AACA,QAAIC,GAAJ;AACA,QAAIoC,OAAJ;;AAEA,aAASC,QAAT,GAAoB;AACnBD,MAAAA,OAAO,GAAG,IAAV;AACA;;AAEDnC,IAAAA,UAAU,CAAC,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,o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;AAEDjC,IAAAA,UAAU,CAAC,YAAM;AAChBiC,MAAAA,OAAO,GAAG,KAAV;AACAnC,MAAAA,GAAG,GAAGD,SAAS,CAAC;AACfb,QAAAA,KAAK,EAAE,SADQ;AAEfE,QAAAA,OAAO,EAAE,SAFM;AAGfD,QAAAA,OAAO,EAAEiD;AAHM,OAAD,CAAf;;AAFgB,oCAORpC,GAAG,CAACQ,sBAAJ,CAA2B,aAA3B,CAPQ;;AAAA;;AAOfP,MAAAA,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"}