@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.
Files changed (109) hide show
  1. package/components/brand-band/__docs__/__snapshots__/storybook-stories.storyshot +47 -157
  2. package/components/brand-band/__docs__/storybook-stories.jsx +4 -2
  3. package/components/brand-band/__examples__/{lightning-blue-theme.jsx → group-image.jsx} +1 -11
  4. package/components/brand-band/__examples__/no-image.jsx +1 -2
  5. package/{lib/components/brand-band/__examples__/lightning-blue-theme.jsx → components/brand-band/__examples__/user-image.jsx} +1 -11
  6. package/components/brand-band/check-props.js +18 -0
  7. package/components/brand-band/component.json +8 -4
  8. package/components/brand-band/index.jsx +23 -66
  9. package/components/brand-band.d.ts +1 -26
  10. package/components/button/__tests__/button.browser-test.jsx +0 -1
  11. package/components/combobox/__tests__/combobox.browser-test.jsx +18 -0
  12. package/components/combobox/combobox.jsx +4 -1
  13. package/components/component-docs.json +13 -38
  14. package/components/data-table/cell.jsx +2 -2
  15. package/components/data-table/index.jsx +130 -85
  16. package/components/data-table/private/context-helper.js +26 -14
  17. package/components/data-table/private/head.jsx +269 -260
  18. package/components/data-table/private/header-cell.jsx +204 -230
  19. package/components/data-table/private/row.jsx +140 -105
  20. package/components/data-table/row-actions.jsx +2 -2
  21. package/components/icon/__docs__/__snapshots__/storybook-stories.storyshot +49 -2
  22. package/components/icon/__docs__/storybook-stories.jsx +2 -0
  23. package/components/icon/__examples__/color-success.jsx +24 -0
  24. package/components/icon/__examples__/colors.jsx +10 -2
  25. package/components/icon/index.jsx +2 -0
  26. package/components/icon.d.ts +1 -1
  27. package/components/site-stories.js +8 -4
  28. package/components/utilities/truncate/index.jsx +1 -1
  29. package/lib/components/brand-band/__docs__/__snapshots__/storybook-stories.storyshot +47 -157
  30. package/lib/components/brand-band/__docs__/storybook-stories.jsx +4 -2
  31. package/lib/components/brand-band/__examples__/group-image.jsx +12 -0
  32. package/lib/components/brand-band/__examples__/no-image.jsx +1 -2
  33. package/lib/components/brand-band/__examples__/user-image.jsx +12 -0
  34. package/lib/components/brand-band/check-props.js +29 -0
  35. package/lib/components/brand-band/component.json +8 -4
  36. package/lib/components/brand-band/index.js +9 -50
  37. package/lib/components/brand-band.d.ts +1 -26
  38. package/lib/components/button/__tests__/button.browser-test.jsx +0 -1
  39. package/lib/components/combobox/__tests__/combobox.browser-test.jsx +18 -0
  40. package/lib/components/combobox/combobox.js +6 -2
  41. package/lib/components/component-docs.json +13 -38
  42. package/lib/components/data-table/cell.js +6 -6
  43. package/lib/components/data-table/index.js +127 -99
  44. package/lib/components/data-table/private/context-helper.js +13 -14
  45. package/lib/components/data-table/private/head.js +233 -252
  46. package/lib/components/data-table/private/header-cell.js +185 -221
  47. package/lib/components/data-table/private/row.js +97 -89
  48. package/lib/components/data-table/row-actions.js +6 -6
  49. package/lib/components/icon/__docs__/__snapshots__/storybook-stories.storyshot +49 -2
  50. package/lib/components/icon/__docs__/storybook-stories.jsx +2 -0
  51. package/lib/components/icon/__examples__/color-success.jsx +24 -0
  52. package/lib/components/icon/__examples__/colors.jsx +10 -2
  53. package/lib/components/icon/index.js +2 -1
  54. package/lib/components/icon.d.ts +1 -1
  55. package/lib/components/site-stories.js +6 -3
  56. package/lib/components/utilities/truncate/index.js +2 -2
  57. package/lib/package.json +13 -9
  58. package/module/components/brand-band/__docs__/__snapshots__/storybook-stories.storyshot +47 -157
  59. package/module/components/brand-band/__docs__/storybook-stories.js +6 -3
  60. package/module/components/brand-band/__docs__/storybook-stories.js.map +1 -1
  61. package/module/components/brand-band/__examples__/{lightning-blue-theme.js → group-image.js} +4 -9
  62. package/module/components/brand-band/__examples__/group-image.js.map +1 -0
  63. package/module/components/brand-band/__examples__/no-image.js +2 -4
  64. package/module/components/brand-band/__examples__/no-image.js.map +1 -1
  65. package/module/components/brand-band/__examples__/user-image.js +52 -0
  66. package/module/components/brand-band/__examples__/user-image.js.map +1 -0
  67. package/module/components/brand-band/check-props.js +20 -0
  68. package/module/components/brand-band/check-props.js.map +1 -0
  69. package/module/components/brand-band/component.json +8 -4
  70. package/module/components/brand-band/index.js +10 -51
  71. package/module/components/brand-band/index.js.map +1 -1
  72. package/module/components/brand-band.d.ts +1 -26
  73. package/module/components/button/__tests__/button.browser-test.js +0 -1
  74. package/module/components/button/__tests__/button.browser-test.js.map +1 -1
  75. package/module/components/combobox/__tests__/combobox.browser-test.js +22 -0
  76. package/module/components/combobox/__tests__/combobox.browser-test.js.map +1 -1
  77. package/module/components/combobox/combobox.js +6 -2
  78. package/module/components/combobox/combobox.js.map +1 -1
  79. package/module/components/component-docs.json +13 -38
  80. package/module/components/data-table/cell.js +6 -6
  81. package/module/components/data-table/cell.js.map +1 -1
  82. package/module/components/data-table/index.js +120 -95
  83. package/module/components/data-table/index.js.map +1 -1
  84. package/module/components/data-table/private/context-helper.js +12 -12
  85. package/module/components/data-table/private/context-helper.js.map +1 -1
  86. package/module/components/data-table/private/head.js +230 -255
  87. package/module/components/data-table/private/head.js.map +1 -1
  88. package/module/components/data-table/private/header-cell.js +184 -225
  89. package/module/components/data-table/private/header-cell.js.map +1 -1
  90. package/module/components/data-table/private/row.js +95 -87
  91. package/module/components/data-table/private/row.js.map +1 -1
  92. package/module/components/data-table/row-actions.js +6 -6
  93. package/module/components/data-table/row-actions.js.map +1 -1
  94. package/module/components/icon/__docs__/__snapshots__/storybook-stories.storyshot +49 -2
  95. package/module/components/icon/__docs__/storybook-stories.js +3 -0
  96. package/module/components/icon/__docs__/storybook-stories.js.map +1 -1
  97. package/module/components/icon/__examples__/color-success.js +64 -0
  98. package/module/components/icon/__examples__/color-success.js.map +1 -0
  99. package/module/components/icon/__examples__/colors.js +11 -2
  100. package/module/components/icon/__examples__/colors.js.map +1 -1
  101. package/module/components/icon/index.js +2 -1
  102. package/module/components/icon/index.js.map +1 -1
  103. package/module/components/icon.d.ts +1 -1
  104. package/module/components/site-stories.js +6 -3
  105. package/module/components/site-stories.js.map +1 -1
  106. package/module/components/utilities/truncate/index.js +1 -1
  107. package/module/components/utilities/truncate/index.js.map +1 -1
  108. package/package.json +13 -9
  109. package/module/components/brand-band/__examples__/lightning-blue-theme.js.map +0 -1
@@ -1,34 +1,10 @@
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
1
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
2
 
5
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
-
7
- 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); } }
8
-
9
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
10
-
11
- 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); }
12
-
13
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
14
-
15
- 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); }; }
16
-
17
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
18
-
19
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
20
-
21
- 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; } }
22
-
23
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
24
-
25
- 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; }
26
-
27
3
  /* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */
28
4
 
29
5
  /* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */
30
6
  // ### React
31
- import React from 'react';
7
+ import React, { useContext } from 'react';
32
8
  import PropTypes from 'prop-types';
33
9
  import classNames from 'classnames'; // ## Children
34
10
 
@@ -38,237 +14,12 @@ import HeaderCell from './header-cell';
38
14
  import InteractiveElement from '../interactive-element';
39
15
  import CellContext from '../private/cell-context';
40
16
  import TableContext from '../private/table-context';
41
- import contextHelper from './context-helper'; // ## Constants
17
+ import useContextHelper from './context-helper'; // ## Constants
42
18
 
43
19
  import { DATA_TABLE_HEAD } from '../../../utilities/constants';
44
- var InteractiveCheckbox = InteractiveElement(Checkbox);
45
- /**
46
- * Used internally, provides header row rendering to the DataTable.
47
- */
48
-
49
- var DataTableHead = /*#__PURE__*/function (_React$Component) {
50
- _inherits(DataTableHead, _React$Component);
51
-
52
- var _super = _createSuper(DataTableHead);
53
-
54
- function DataTableHead() {
55
- var _this;
56
-
57
- _classCallCheck(this, DataTableHead);
58
-
59
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
60
- args[_key] = arguments[_key];
61
- }
62
-
63
- _this = _super.call.apply(_super, [this].concat(args));
64
-
65
- _defineProperty(_assertThisInitialized(_this), "getActionsHeader", function () {
66
- var fixedHeader = _this.props.fixedHeader;
67
-
68
- var getContent = function getContent(style) {
69
- return /*#__PURE__*/React.createElement("div", {
70
- className: "slds-th__action",
71
- style: style
72
- }, /*#__PURE__*/React.createElement("span", {
73
- className: "slds-assistive-text"
74
- }, _this.props.assistiveText.actionsHeader));
75
- };
76
-
77
- var actionsHeader = null;
78
-
79
- if (_this.props.showRowActions) {
80
- actionsHeader = /*#__PURE__*/React.createElement(TableContext.Consumer, null, function (tableContext) {
81
- var columnIndex = _this.props.canSelectRows ? _this.props.columns.length + 1 : _this.props.columns.length;
82
- var cellContext = {
83
- columnIndex: columnIndex,
84
- rowIndex: 0
85
- };
86
-
87
- var _contextHelper = contextHelper(tableContext, cellContext, _this.props.fixedLayout),
88
- tabIndex = _contextHelper.tabIndex,
89
- hasFocus = _contextHelper.hasFocus,
90
- handleFocus = _contextHelper.handleFocus,
91
- handleKeyDown = _contextHelper.handleKeyDown;
92
-
93
- return /*#__PURE__*/React.createElement("th", {
94
- className: classNames({
95
- 'slds-has-focus': hasFocus
96
- }),
97
- ref: function ref(_ref) {
98
- if (_this.props.headerRefs) {
99
- _this.props.headerRefs(_ref, 'action');
100
- }
101
-
102
- if (_ref && hasFocus) {
103
- _ref.focus();
104
- }
105
- },
106
- scope: "col",
107
- style: {
108
- height: fixedHeader ? 0 : null,
109
- lineHeight: fixedHeader ? 0 : null,
110
- width: '3.25rem'
111
- },
112
- onFocus: handleFocus,
113
- onKeyDown: handleKeyDown,
114
- tabIndex: tabIndex
115
- }, getContent(fixedHeader ? {
116
- height: 0,
117
- overflow: 'hidden',
118
- paddingBottom: 0,
119
- paddingTop: 0,
120
- visibility: 'hidden'
121
- } : null), fixedHeader ? /*#__PURE__*/React.createElement(CellFixed, null, getContent({
122
- lineHeight: 1,
123
- width: '100%'
124
- })) : null);
125
- });
126
- }
127
-
128
- return actionsHeader;
129
- });
130
-
131
- _defineProperty(_assertThisInitialized(_this), "getSelectHeader", function () {
132
- var _this$props = _this.props,
133
- canSelectRows = _this$props.canSelectRows,
134
- fixedHeader = _this$props.fixedHeader;
135
-
136
- var getContent = function getContent(idSuffix, style, ariaHidden) {
137
- var render = null;
138
-
139
- if (canSelectRows === 'radio') {
140
- render = !ariaHidden ? /*#__PURE__*/React.createElement("div", {
141
- className: "slds-truncate slds-assistive-text",
142
- id: "".concat(_this.props.id, "-column-group-header-row-select"),
143
- title: _this.props.assistiveText.selectRowGroup
144
- }, _this.props.assistiveText.selectRowGroup) : null;
145
- } else if (canSelectRows === true || canSelectRows === 'checkbox') {
146
- render = /*#__PURE__*/React.createElement("div", {
147
- className: "slds-th__action slds-th__action_form",
148
- "aria-hidden": ariaHidden && true,
149
- style: style
150
- }, !ariaHidden ? /*#__PURE__*/React.createElement("span", {
151
- id: "".concat(_this.props.id, "-column-group-header-row-select"),
152
- className: "slds-assistive-text"
153
- }, _this.props.assistiveText.selectAllRows) : null, /*#__PURE__*/React.createElement(InteractiveCheckbox, {
154
- assistiveText: {
155
- label: _this.props.assistiveText.selectAllRows
156
- },
157
- checked: _this.props.allSelected,
158
- indeterminate: _this.props.indeterminateSelected,
159
- id: "".concat(_this.props.id, "-").concat(idSuffix) // There is a checkbox for user interaction and a checkbox for positioning. ariaHidden is for the checkbox for positioning and it should be removed from the accessibility tree.
160
- ,
161
- name: !ariaHidden ? 'SelectAll' : undefined,
162
- onChange: _this.props.onToggleAll
163
- }));
164
- }
20
+ var InteractiveCheckbox = InteractiveElement(Checkbox); // ### Prop Types
165
21
 
166
- return render;
167
- };
168
-
169
- var selectHeader = null;
170
-
171
- if (canSelectRows) {
172
- selectHeader = /*#__PURE__*/React.createElement(TableContext.Consumer, null, function (tableContext) {
173
- var cellContext = {
174
- columnIndex: 0,
175
- rowIndex: 0
176
- };
177
-
178
- var _contextHelper2 = contextHelper(tableContext, cellContext, _this.props.fixedLayout),
179
- tabIndex = _contextHelper2.tabIndex,
180
- hasFocus = _contextHelper2.hasFocus,
181
- handleFocus = _contextHelper2.handleFocus,
182
- handleKeyDown = _contextHelper2.handleKeyDown;
183
-
184
- return /*#__PURE__*/React.createElement("th", {
185
- className: classNames('slds-text-align_right', {
186
- 'slds-has-focus': hasFocus
187
- }),
188
- ref: function ref(_ref2) {
189
- if (_this.props.headerRefs) {
190
- _this.props.headerRefs(_ref2, 'select');
191
- }
192
-
193
- if (_ref2 && hasFocus) {
194
- _ref2.focus();
195
- }
196
- },
197
- scope: "col",
198
- style: {
199
- height: fixedHeader ? 0 : null,
200
- lineHeight: fixedHeader ? 0 : null,
201
- width: '3.25rem'
202
- },
203
- onFocus: handleFocus,
204
- onKeyDown: handleKeyDown,
205
- tabIndex: tabIndex
206
- }, /*#__PURE__*/React.createElement(CellContext.Provider, {
207
- value: cellContext
208
- }, getContent('SelectAll-fixed-header', fixedHeader ? {
209
- display: 'flex',
210
- height: 0,
211
- overflow: 'hidden',
212
- paddingBottom: 0,
213
- paddingTop: 0,
214
- visibility: 'hidden'
215
- } : null, fixedHeader && 'ariaHidden'), fixedHeader ? /*#__PURE__*/React.createElement(CellFixed, null, getContent('SelectAll', {
216
- display: 'flex',
217
- justifyContent: 'flex-end',
218
- lineHeight: 1,
219
- width: '100%'
220
- })) : null));
221
- });
222
- }
223
-
224
- return selectHeader;
225
- });
226
-
227
- return _this;
228
- }
229
-
230
- _createClass(DataTableHead, [{
231
- key: "render",
232
- value: // ### Render
233
- function render() {
234
- var _this2 = this;
235
-
236
- var actionsHeader = this.getActionsHeader();
237
- var selectHeader = this.getSelectHeader();
238
- return /*#__PURE__*/React.createElement("thead", {
239
- className: classNames({
240
- 'slds-assistive-text': this.props.isHidden
241
- })
242
- }, /*#__PURE__*/React.createElement("tr", {
243
- className: "slds-line-height_reset"
244
- }, selectHeader, this.props.columns.map(function (column, index) {
245
- return /*#__PURE__*/React.createElement(CellContext.Provider, {
246
- key: "".concat(_this2.props.id, "-").concat(column.props.property),
247
- value: {
248
- columnIndex: _this2.props.canSelectRows ? index + 1 : index,
249
- rowIndex: 0
250
- }
251
- }, /*#__PURE__*/React.createElement(HeaderCell, _extends({
252
- assistiveText: _this2.props.assistiveText,
253
- cellRef: function cellRef(ref) {
254
- if (_this2.props.headerRefs) {
255
- _this2.props.headerRefs(ref, index);
256
- }
257
- },
258
- fixedHeader: _this2.props.fixedHeader,
259
- id: "".concat(_this2.props.id, "-").concat(column.props.property),
260
- onSort: _this2.props.onSort
261
- }, column.props)));
262
- }), actionsHeader));
263
- }
264
- }]);
265
-
266
- return DataTableHead;
267
- }(React.Component);
268
-
269
- _defineProperty(DataTableHead, "displayName", DATA_TABLE_HEAD);
270
-
271
- _defineProperty(DataTableHead, "propTypes", {
22
+ var propTypes = {
272
23
  assistiveText: PropTypes.shape({
273
24
  actionsHeader: PropTypes.string,
274
25
  columnSort: PropTypes.string,
@@ -283,7 +34,7 @@ _defineProperty(DataTableHead, "propTypes", {
283
34
  indeterminateSelected: PropTypes.bool,
284
35
  canSelectRows: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['checkbox', 'radio'])]),
285
36
  columns: PropTypes.arrayOf(PropTypes.shape({
286
- Cell: PropTypes.func,
37
+ Cell: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
287
38
  props: PropTypes.object
288
39
  })),
289
40
  fixedHeader: PropTypes.bool,
@@ -291,7 +42,231 @@ _defineProperty(DataTableHead, "propTypes", {
291
42
  onToggleAll: PropTypes.func,
292
43
  onSort: PropTypes.func,
293
44
  showRowActions: PropTypes.bool
294
- });
45
+ };
46
+
47
+ var ActionsHeader = function ActionsHeader(props) {
48
+ var tableContext = useContext(TableContext);
49
+ var cellContext = {
50
+ columnIndex: props.columnIndex,
51
+ rowIndex: 0
52
+ };
53
+
54
+ var _useContextHelper = useContextHelper(tableContext, cellContext, props.fixedLayout),
55
+ tabIndex = _useContextHelper.tabIndex,
56
+ hasFocus = _useContextHelper.hasFocus,
57
+ handleFocus = _useContextHelper.handleFocus,
58
+ handleKeyDown = _useContextHelper.handleKeyDown;
59
+
60
+ var fixedHeader = props.fixedHeader;
61
+
62
+ var getContent = function getContent(style) {
63
+ return /*#__PURE__*/React.createElement("div", {
64
+ className: "slds-th__action",
65
+ style: style
66
+ }, /*#__PURE__*/React.createElement("span", {
67
+ className: "slds-assistive-text"
68
+ }, props.assistiveText));
69
+ };
70
+
71
+ return /*#__PURE__*/React.createElement("th", {
72
+ className: classNames({
73
+ 'slds-has-focus': hasFocus
74
+ }),
75
+ ref: function ref(_ref) {
76
+ if (props.headerRefs) {
77
+ props.headerRefs(_ref, 'action');
78
+ }
79
+
80
+ if (_ref && hasFocus) {
81
+ _ref.focus();
82
+ }
83
+ },
84
+ scope: "col",
85
+ style: {
86
+ height: fixedHeader ? 0 : null,
87
+ lineHeight: fixedHeader ? 0 : null,
88
+ width: '3.25rem'
89
+ },
90
+ onFocus: handleFocus,
91
+ onKeyDown: handleKeyDown,
92
+ tabIndex: tabIndex
93
+ }, getContent(fixedHeader ? {
94
+ height: 0,
95
+ overflow: 'hidden',
96
+ paddingBottom: 0,
97
+ paddingTop: 0,
98
+ visibility: 'hidden'
99
+ } : null), fixedHeader ? /*#__PURE__*/React.createElement(CellFixed, null, getContent({
100
+ lineHeight: 1,
101
+ width: '100%'
102
+ })) : null);
103
+ };
104
+
105
+ var SelectHeader = function SelectHeader(props) {
106
+ var tableContext = useContext(TableContext);
107
+ var cellContext = {
108
+ columnIndex: 0,
109
+ rowIndex: 0
110
+ };
111
+
112
+ var _useContextHelper2 = useContextHelper(tableContext, cellContext, props.fixedLayout),
113
+ tabIndex = _useContextHelper2.tabIndex,
114
+ hasFocus = _useContextHelper2.hasFocus,
115
+ handleFocus = _useContextHelper2.handleFocus,
116
+ handleKeyDown = _useContextHelper2.handleKeyDown;
117
+
118
+ var fixedHeader = props.fixedHeader,
119
+ canSelectRows = props.canSelectRows;
120
+
121
+ var getContent = function getContent(idSuffix, style, ariaHidden) {
122
+ var render = null;
123
+
124
+ if (canSelectRows === 'radio') {
125
+ render = !ariaHidden ? /*#__PURE__*/React.createElement("div", {
126
+ className: "slds-truncate slds-assistive-text",
127
+ id: "".concat(props.id, "-column-group-header-row-select"),
128
+ title: props.assistiveText.selectRowGroup
129
+ }, props.assistiveText.selectRowGroup) : null;
130
+ } else if (canSelectRows === true || canSelectRows === 'checkbox') {
131
+ render = /*#__PURE__*/React.createElement("div", {
132
+ className: "slds-th__action slds-th__action_form",
133
+ "aria-hidden": ariaHidden && true,
134
+ style: style
135
+ }, !ariaHidden ? /*#__PURE__*/React.createElement("span", {
136
+ id: "".concat(props.id, "-column-group-header-row-select"),
137
+ className: "slds-assistive-text"
138
+ }, props.assistiveText.selectAllRows) : null, /*#__PURE__*/React.createElement(InteractiveCheckbox, {
139
+ assistiveText: {
140
+ label: props.assistiveText.selectAllRows
141
+ },
142
+ checked: props.allSelected,
143
+ indeterminate: props.indeterminateSelected,
144
+ id: "".concat(props.id, "-").concat(idSuffix) // There is a checkbox for user interaction and a checkbox for positioning. ariaHidden is for the checkbox for positioning and it should be removed from the accessibility tree.
145
+ ,
146
+ name: !ariaHidden ? 'SelectAll' : undefined,
147
+ onChange: props.onToggleAll
148
+ }));
149
+ }
150
+
151
+ return render;
152
+ };
153
+
154
+ return /*#__PURE__*/React.createElement("th", {
155
+ className: classNames('slds-text-align_right', {
156
+ 'slds-has-focus': hasFocus
157
+ }),
158
+ ref: function ref(_ref2) {
159
+ if (props.headerRefs) {
160
+ props.headerRefs(_ref2, 'select');
161
+ }
162
+
163
+ if (_ref2 && hasFocus) {
164
+ _ref2.focus();
165
+ }
166
+ },
167
+ scope: "col",
168
+ style: {
169
+ height: fixedHeader ? 0 : null,
170
+ lineHeight: fixedHeader ? 0 : null,
171
+ width: '3.25rem'
172
+ },
173
+ onFocus: handleFocus,
174
+ onKeyDown: handleKeyDown,
175
+ tabIndex: tabIndex
176
+ }, /*#__PURE__*/React.createElement(CellContext.Provider, {
177
+ value: cellContext
178
+ }, getContent('SelectAll-fixed-header', fixedHeader ? {
179
+ display: 'flex',
180
+ height: 0,
181
+ overflow: 'hidden',
182
+ paddingBottom: 0,
183
+ paddingTop: 0,
184
+ visibility: 'hidden'
185
+ } : null, fixedHeader && 'ariaHidden'), fixedHeader ? /*#__PURE__*/React.createElement(CellFixed, null, getContent('SelectAll', {
186
+ display: 'flex',
187
+ justifyContent: 'flex-end',
188
+ lineHeight: 1,
189
+ width: '100%'
190
+ })) : null));
191
+ };
192
+ /**
193
+ * Used internally, provides header row rendering to the DataTable.
194
+ */
295
195
 
196
+
197
+ var DataTableHead = function DataTableHead(props) {
198
+ var getActionsHeader = function getActionsHeader() {
199
+ var actionsHeader = null;
200
+
201
+ if (props.showRowActions) {
202
+ actionsHeader = /*#__PURE__*/React.createElement(ActionsHeader, {
203
+ assistiveText: props.assistiveText.actionsHeader,
204
+ columnIndex: props.canSelectRows ? props.columns.length + 1 : props.columns.length,
205
+ fixedLayout: props.fixedLayout,
206
+ fixedHeader: props.fixedHeader,
207
+ headerRefs: props.headerRefs
208
+ });
209
+ }
210
+
211
+ return actionsHeader;
212
+ };
213
+
214
+ var getSelectHeader = function getSelectHeader() {
215
+ var canSelectRows = props.canSelectRows;
216
+ var selectHeader = null;
217
+
218
+ if (canSelectRows) {
219
+ selectHeader = /*#__PURE__*/React.createElement(SelectHeader, {
220
+ allSelected: props.allSelected,
221
+ assistiveText: {
222
+ selectAllRows: props.assistiveText.selectAllRows,
223
+ selectRowGroup: props.assistiveText.selectRowGroup
224
+ },
225
+ canSelectRows: canSelectRows,
226
+ fixedHeader: props.fixedHeader,
227
+ fixedLayout: props.fixedLayout,
228
+ headerRefs: props.headerRefs,
229
+ id: props.id,
230
+ indeterminateSelected: props.indeterminateSelected,
231
+ onToggleAll: props.onToggleAll
232
+ });
233
+ }
234
+
235
+ return selectHeader;
236
+ };
237
+
238
+ var actionsHeader = getActionsHeader();
239
+ var selectHeader = getSelectHeader();
240
+ return /*#__PURE__*/React.createElement("thead", {
241
+ className: classNames({
242
+ 'slds-assistive-text': props.isHidden
243
+ })
244
+ }, /*#__PURE__*/React.createElement("tr", {
245
+ className: "slds-line-height_reset"
246
+ }, selectHeader, props.columns.map(function (column, index) {
247
+ return /*#__PURE__*/React.createElement(CellContext.Provider, {
248
+ key: "".concat(props.id, "-").concat(column.props.property),
249
+ value: {
250
+ columnIndex: props.canSelectRows ? index + 1 : index,
251
+ rowIndex: 0
252
+ }
253
+ }, /*#__PURE__*/React.createElement(HeaderCell, _extends({
254
+ assistiveText: props.assistiveText,
255
+ cellRef: function cellRef(ref) {
256
+ if (props.headerRefs) {
257
+ props.headerRefs(ref, index);
258
+ }
259
+ },
260
+ fixedHeader: props.fixedHeader,
261
+ id: "".concat(props.id, "-").concat(column.props.property),
262
+ onSort: props.onSort
263
+ }, column.props)));
264
+ }), actionsHeader));
265
+ }; // ### Display Name
266
+ // Always use the canonical component name as the React display name.
267
+
268
+
269
+ DataTableHead.displayName = DATA_TABLE_HEAD;
270
+ DataTableHead.propTypes = propTypes;
296
271
  export default DataTableHead;
297
272
  //# sourceMappingURL=head.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../.tmp-es/components/data-table/private/head.jsx"],"names":["React","PropTypes","classNames","CellFixed","Checkbox","HeaderCell","InteractiveElement","CellContext","TableContext","contextHelper","DATA_TABLE_HEAD","InteractiveCheckbox","DataTableHead","fixedHeader","props","getContent","style","assistiveText","actionsHeader","showRowActions","tableContext","columnIndex","canSelectRows","columns","length","cellContext","rowIndex","fixedLayout","tabIndex","hasFocus","handleFocus","handleKeyDown","ref","headerRefs","focus","height","lineHeight","width","overflow","paddingBottom","paddingTop","visibility","idSuffix","ariaHidden","render","id","selectRowGroup","selectAllRows","label","allSelected","indeterminateSelected","undefined","onToggleAll","selectHeader","display","justifyContent","getActionsHeader","getSelectHeader","isHidden","map","column","index","property","onSort","Component","shape","string","columnSort","columnSortedAscending","columnSortedDescending","selectRow","bool","func","oneOfType","oneOf","arrayOf","Cell","object"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;AAEA;AACA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB,C,CAEA;;AACA,OAAOC,SAAP,MAAsB,cAAtB;AACA,OAAOC,QAAP,MAAqB,gBAArB;AACA,OAAOC,UAAP,MAAuB,eAAvB;AACA,OAAOC,kBAAP,MAA+B,wBAA/B;AACA,OAAOC,WAAP,MAAwB,yBAAxB;AACA,OAAOC,YAAP,MAAyB,0BAAzB;AACA,OAAOC,aAAP,MAA0B,kBAA1B,C,CAEA;;AACA,SAASC,eAAT,QAAgC,8BAAhC;AAEA,IAAMC,mBAAmB,GAAGL,kBAAkB,CAACF,QAAD,CAA9C;AAEA;AACA;AACA;;IACMQ,a;;;;;;;;;;;;;;;;uEAoCc,YAAM;AACxB,UAAQC,WAAR,GAAwB,MAAKC,KAA7B,CAAQD,WAAR;;AACA,UAAME,UAAU,GAAG,SAAbA,UAAa,CAACC,KAAD;AAAA,4BAClB;AAAK,UAAA,SAAS,EAAC,iBAAf;AAAiC,UAAA,KAAK,EAAEA;AAAxC,wBACC;AAAM,UAAA,SAAS,EAAC;AAAhB,WACE,MAAKF,KAAL,CAAWG,aAAX,CAAyBC,aAD3B,CADD,CADkB;AAAA,OAAnB;;AAOA,UAAIA,aAAa,GAAG,IAApB;;AAEA,UAAI,MAAKJ,KAAL,CAAWK,cAAf,EAA+B;AAC9BD,QAAAA,aAAa,gBACZ,oBAAC,YAAD,CAAc,QAAd,QACE,UAACE,YAAD,EAAkB;AAClB,cAAMC,WAAW,GAAG,MA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AAE9BC,IAAAA,UAAU,EAAElE,SAAS,CAACiE,MAFQ;AAG9BE,IAAAA,qBAAqB,EAAEnE,SAAS,CAACiE,MAHH;AAI9BG,IAAAA,sBAAsB,EAAEpE,SAAS,CAACiE,MAJJ;AAK9BnB,IAAAA,aAAa,EAAE9C,SAAS,CAACiE,MALK;AAM9BI,IAAAA,SAAS,EAAErE,SAAS,CAACiE;AANS,GAAhB,CADG;AASlBjB,EAAAA,WAAW,EAAEhD,SAAS,CAACsE,IATL;AAUlBtC,EAAAA,UAAU,EAAEhC,SAAS,CAACuE,IAVJ;AAWlBd,EAAAA,QAAQ,EAAEzD,SAAS,CAACsE,IAXF;AAYlBrB,EAAAA,qBAAqB,EAAEjD,SAAS,CAACsE,IAZf;AAalBjD,EAAAA,aAAa,EAAErB,SAAS,CAACwE,SAAV,CAAoB,CAClCxE,SAAS,CAACsE,IADwB,EAElCtE,SAAS,CAACyE,KAAV,CAAgB,CAAC,UAAD,EAAa,OAAb,CAAhB,CAFkC,CAApB,CAbG;AAiBlBnD,EAAAA,OAAO,EAAEtB,SAAS,CAAC0E,OAAV,CACR1E,SAAS,CAACgE,KAAV,CAAgB;AACfW,IAAAA,IAAI,EAAE3E,SAAS,CAACuE,IADD;AAEf1D,IAAAA,KAAK,EAAEb,SAAS,CAAC4E;AAFF,GAAhB,CADQ,CAjBS;AAuBlBhE,EAAAA,WAAW,EAAEZ,SAAS,CAACsE,IAvBL;AAwBlB1B,EAAAA,EAAE,EAAE5C,SAAS,CAACiE,MAxBI;AAyBlBd,EAAAA,WAAW,EAAEnD,SAAS,CAACuE,IAzBL;AA0BlBT,EAAAA,MAAM,EAAE9D,SAAS,CAACuE,IA1BA;AA2BlBrD,EAAAA,cAAc,EAAElB,SAAS,CAACsE;AA3BR,C;;AAmRpB,eAAe3D,aAAf","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// ### React\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\n\n// ## Children\nimport CellFixed from './cell-fixed';\nimport Checkbox from '../../checkbox';\nimport HeaderCell from './header-cell';\nimport InteractiveElement from '../interactive-element';\nimport CellContext from '../private/cell-context';\nimport TableContext from '../private/table-context';\nimport contextHelper from './context-helper';\n\n// ## Constants\nimport { DATA_TABLE_HEAD } from '../../../utilities/constants';\n\nconst InteractiveCheckbox = InteractiveElement(Checkbox);\n\n/**\n * Used internally, provides header row rendering to the DataTable.\n */\nclass DataTableHead extends React.Component {\n\t// ### Display Name\n\t// Always use the canonical component name as the React display name.\n\tstatic displayName = DATA_TABLE_HEAD;\n\n\t// ### Prop Types\n\tstatic propTypes = {\n\t\tassistiveText: PropTypes.shape({\n\t\t\tactionsHeader: PropTypes.string,\n\t\t\tcolumnSort: PropTypes.string,\n\t\t\tcolumnSortedAscending: PropTypes.string,\n\t\t\tcolumnSortedDescending: PropTypes.string,\n\t\t\tselectAllRows: PropTypes.string,\n\t\t\tselectRow: PropTypes.string,\n\t\t}),\n\t\tallSelected: PropTypes.bool,\n\t\theaderRefs: PropTypes.func,\n\t\tisHidden: PropTypes.bool,\n\t\tindeterminateSelected: PropTypes.bool,\n\t\tcanSelectRows: PropTypes.oneOfType([\n\t\t\tPropTypes.bool,\n\t\t\tPropTypes.oneOf(['checkbox', 'radio']),\n\t\t]),\n\t\tcolumns: PropTypes.arrayOf(\n\t\t\tPropTypes.shape({\n\t\t\t\tCell: PropTypes.func,\n\t\t\t\tprops: PropTypes.object,\n\t\t\t})\n\t\t),\n\t\tfixedHeader: PropTypes.bool,\n\t\tid: PropTypes.string,\n\t\tonToggleAll: PropTypes.func,\n\t\tonSort: PropTypes.func,\n\t\tshowRowActions: PropTypes.bool,\n\t};\n\n\tgetActionsHeader = () => {\n\t\tconst { fixedHeader } = this.props;\n\t\tconst getContent = (style) => (\n\t\t\t<div className=\"slds-th__action\" style={style}>\n\t\t\t\t<span className=\"slds-assistive-text\">\n\t\t\t\t\t{this.props.assistiveText.actionsHeader}\n\t\t\t\t</span>\n\t\t\t</div>\n\t\t);\n\t\tlet actionsHeader = null;\n\n\t\tif (this.props.showRowActions) {\n\t\t\tactionsHeader = (\n\t\t\t\t<TableContext.Consumer>\n\t\t\t\t\t{(tableContext) => {\n\t\t\t\t\t\tconst columnIndex = this.props.canSelectRows\n\t\t\t\t\t\t\t? this.props.columns.length + 1\n\t\t\t\t\t\t\t: this.props.columns.length;\n\t\t\t\t\t\tconst cellContext = { columnIndex, rowIndex: 0 };\n\t\t\t\t\t\tconst {\n\t\t\t\t\t\t\ttabIndex,\n\t\t\t\t\t\t\thasFocus,\n\t\t\t\t\t\t\thandleFocus,\n\t\t\t\t\t\t\thandleKeyDown,\n\t\t\t\t\t\t} = contextHelper(\n\t\t\t\t\t\t\ttableContext,\n\t\t\t\t\t\t\tcellContext,\n\t\t\t\t\t\t\tthis.props.fixedLayout\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<th\n\t\t\t\t\t\t\t\tclassName={classNames({ 'slds-has-focus': hasFocus })}\n\t\t\t\t\t\t\t\tref={(ref) => {\n\t\t\t\t\t\t\t\t\tif (this.props.headerRefs) {\n\t\t\t\t\t\t\t\t\t\tthis.props.headerRefs(ref, 'action');\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif (ref && hasFocus) {\n\t\t\t\t\t\t\t\t\t\tref.focus();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\tscope=\"col\"\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\theight: fixedHeader ? 0 : null,\n\t\t\t\t\t\t\t\t\tlineHeight: fixedHeader ? 0 : null,\n\t\t\t\t\t\t\t\t\twidth: '3.25rem',\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\tonFocus={handleFocus}\n\t\t\t\t\t\t\t\tonKeyDown={handleKeyDown}\n\t\t\t\t\t\t\t\ttabIndex={tabIndex}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{getContent(\n\t\t\t\t\t\t\t\t\tfixedHeader\n\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\theight: 0,\n\t\t\t\t\t\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\t\t\t\t\t\tpaddingBottom: 0,\n\t\t\t\t\t\t\t\t\t\t\t\tpaddingTop: 0,\n\t\t\t\t\t\t\t\t\t\t\t\tvisibility: 'hidden',\n\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\t: null\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t{fixedHeader ? (\n\t\t\t\t\t\t\t\t\t<CellFixed>\n\t\t\t\t\t\t\t\t\t\t{getContent({\n\t\t\t\t\t\t\t\t\t\t\tlineHeight: 1,\n\t\t\t\t\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\t\t\t</CellFixed>\n\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t</th>\n\t\t\t\t\t\t);\n\t\t\t\t\t}}\n\t\t\t\t</TableContext.Consumer>\n\t\t\t);\n\t\t}\n\n\t\treturn actionsHeader;\n\t};\n\n\tgetSelectHeader = () => {\n\t\tconst { canSelectRows, fixedHeader } = this.props;\n\t\tconst getContent = (idSuffix, style, ariaHidden) => {\n\t\t\tlet render = null;\n\n\t\t\tif (canSelectRows === 'radio') {\n\t\t\t\trender = !ariaHidden ? (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"slds-truncate slds-assistive-text\"\n\t\t\t\t\t\tid={`${this.props.id}-column-group-header-row-select`}\n\t\t\t\t\t\ttitle={this.props.assistiveText.selectRowGroup}\n\t\t\t\t\t>\n\t\t\t\t\t\t{this.props.assistiveText.selectRowGroup}\n\t\t\t\t\t</div>\n\t\t\t\t) : null;\n\t\t\t} else if (canSelectRows === true || canSelectRows === 'checkbox') {\n\t\t\t\trender = (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"slds-th__action slds-th__action_form\"\n\t\t\t\t\t\taria-hidden={ariaHidden && true}\n\t\t\t\t\t\tstyle={style}\n\t\t\t\t\t>\n\t\t\t\t\t\t{!ariaHidden ? (\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tid={`${this.props.id}-column-group-header-row-select`}\n\t\t\t\t\t\t\t\tclassName=\"slds-assistive-text\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{this.props.assistiveText.selectAllRows}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t<InteractiveCheckbox\n\t\t\t\t\t\t\tassistiveText={{\n\t\t\t\t\t\t\t\tlabel: this.props.assistiveText.selectAllRows,\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tchecked={this.props.allSelected}\n\t\t\t\t\t\t\tindeterminate={this.props.indeterminateSelected}\n\t\t\t\t\t\t\tid={`${this.props.id}-${idSuffix}`}\n\t\t\t\t\t\t\t// There is a checkbox for user interaction and a checkbox for positioning. ariaHidden is for the checkbox for positioning and it should be removed from the accessibility tree.\n\t\t\t\t\t\t\tname={!ariaHidden ? 'SelectAll' : undefined}\n\t\t\t\t\t\t\tonChange={this.props.onToggleAll}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn render;\n\t\t};\n\n\t\tlet selectHeader = null;\n\n\t\tif (canSelectRows) {\n\t\t\tselectHeader = (\n\t\t\t\t<TableContext.Consumer>\n\t\t\t\t\t{(tableContext) => {\n\t\t\t\t\t\tconst cellContext = { columnIndex: 0, rowIndex: 0 };\n\t\t\t\t\t\tconst {\n\t\t\t\t\t\t\ttabIndex,\n\t\t\t\t\t\t\thasFocus,\n\t\t\t\t\t\t\thandleFocus,\n\t\t\t\t\t\t\thandleKeyDown,\n\t\t\t\t\t\t} = contextHelper(\n\t\t\t\t\t\t\ttableContext,\n\t\t\t\t\t\t\tcellContext,\n\t\t\t\t\t\t\tthis.props.fixedLayout\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<th\n\t\t\t\t\t\t\t\tclassName={classNames('slds-text-align_right', {\n\t\t\t\t\t\t\t\t\t'slds-has-focus': hasFocus,\n\t\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\t\tref={(ref) => {\n\t\t\t\t\t\t\t\t\tif (this.props.headerRefs) {\n\t\t\t\t\t\t\t\t\t\tthis.props.headerRefs(ref, 'select');\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif (ref && hasFocus) {\n\t\t\t\t\t\t\t\t\t\tref.focus();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\tscope=\"col\"\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\theight: fixedHeader ? 0 : null,\n\t\t\t\t\t\t\t\t\tlineHeight: fixedHeader ? 0 : null,\n\t\t\t\t\t\t\t\t\twidth: '3.25rem',\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\tonFocus={handleFocus}\n\t\t\t\t\t\t\t\tonKeyDown={handleKeyDown}\n\t\t\t\t\t\t\t\ttabIndex={tabIndex}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<CellContext.Provider value={cellContext}>\n\t\t\t\t\t\t\t\t\t{getContent(\n\t\t\t\t\t\t\t\t\t\t'SelectAll-fixed-header',\n\t\t\t\t\t\t\t\t\t\tfixedHeader\n\t\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\t\t\t\t\t\t\theight: 0,\n\t\t\t\t\t\t\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\t\t\t\t\t\t\tpaddingBottom: 0,\n\t\t\t\t\t\t\t\t\t\t\t\t\tpaddingTop: 0,\n\t\t\t\t\t\t\t\t\t\t\t\t\tvisibility: 'hidden',\n\t\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\t\t: null,\n\t\t\t\t\t\t\t\t\t\tfixedHeader && 'ariaHidden'\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t{fixedHeader ? (\n\t\t\t\t\t\t\t\t\t\t<CellFixed>\n\t\t\t\t\t\t\t\t\t\t\t{getContent('SelectAll', {\n\t\t\t\t\t\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\t\t\t\t\t\tjustifyContent: 'flex-end',\n\t\t\t\t\t\t\t\t\t\t\t\tlineHeight: 1,\n\t\t\t\t\t\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\t\t\t\t</CellFixed>\n\t\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t\t</CellContext.Provider>\n\t\t\t\t\t\t\t</th>\n\t\t\t\t\t\t);\n\t\t\t\t\t}}\n\t\t\t\t</TableContext.Consumer>\n\t\t\t);\n\t\t}\n\n\t\treturn selectHeader;\n\t};\n\n\t// ### Render\n\trender() {\n\t\tconst actionsHeader = this.getActionsHeader();\n\t\tconst selectHeader = this.getSelectHeader();\n\n\t\treturn (\n\t\t\t<thead\n\t\t\t\tclassName={classNames({\n\t\t\t\t\t'slds-assistive-text': this.props.isHidden,\n\t\t\t\t})}\n\t\t\t>\n\t\t\t\t<tr className=\"slds-line-height_reset\">\n\t\t\t\t\t{selectHeader}\n\t\t\t\t\t{this.props.columns.map((column, index) => (\n\t\t\t\t\t\t<CellContext.Provider\n\t\t\t\t\t\t\tkey={`${this.props.id}-${column.props.property}`}\n\t\t\t\t\t\t\tvalue={{\n\t\t\t\t\t\t\t\tcolumnIndex: this.props.canSelectRows ? index + 1 : index,\n\t\t\t\t\t\t\t\trowIndex: 0,\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<HeaderCell\n\t\t\t\t\t\t\t\tassistiveText={this.props.assistiveText}\n\t\t\t\t\t\t\t\tcellRef={(ref) => {\n\t\t\t\t\t\t\t\t\tif (this.props.headerRefs) {\n\t\t\t\t\t\t\t\t\t\tthis.props.headerRefs(ref, index);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\tfixedHeader={this.props.fixedHeader}\n\t\t\t\t\t\t\t\tid={`${this.props.id}-${column.props.property}`}\n\t\t\t\t\t\t\t\tonSort={this.props.onSort}\n\t\t\t\t\t\t\t\t{...column.props}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</CellContext.Provider>\n\t\t\t\t\t))}\n\t\t\t\t\t{actionsHeader}\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t);\n\t}\n}\n\nexport default DataTableHead;\n"],"file":"head.js"}
1
+ {"version":3,"sources":["../../../../.tmp-es/components/data-table/private/head.jsx"],"names":["React","useContext","PropTypes","classNames","CellFixed","Checkbox","HeaderCell","InteractiveElement","CellContext","TableContext","useContextHelper","DATA_TABLE_HEAD","InteractiveCheckbox","propTypes","assistiveText","shape","actionsHeader","string","columnSort","columnSortedAscending","columnSortedDescending","selectAllRows","selectRow","allSelected","bool","headerRefs","func","isHidden","indeterminateSelected","canSelectRows","oneOfType","oneOf","columns","arrayOf","Cell","object","props","fixedHeader","id","onToggleAll","onSort","showRowActions","ActionsHeader","tableContext","cellContext","columnIndex","rowIndex","fixedLayout","tabIndex","hasFocus","handleFocus","handleKeyDown","getContent","style","ref","focus","height","lineHeight","width","overflow","paddingBottom","paddingTop","visibility","SelectHeader","idSuffix","ariaHidden","render","selectRowGroup","label","undefined","display","justifyContent","DataTableHead","getActionsHeader","length","getSelectHeader","selectHeader","map","column","index","property","displayName"],"mappings":";;AAAA;;AACA;AAEA;AAC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K,CAACX,UAAV,EAAsB;AACrBW,UAAAA,KAAK,CAACX,UAAN,CAAiB6B,GAAjB,EAAsByB,KAAtB;AACA;AACD,OANF;AAOC,MAAA,WAAW,EAAE3C,KAAK,CAACC,WAPpB;AAQC,MAAA,EAAE,YAAKD,KAAK,CAACE,EAAX,cAAiBwC,MAAM,CAAC1C,KAAP,CAAa4C,QAA9B,CARH;AASC,MAAA,MAAM,EAAE5C,KAAK,CAACI;AATf,OAUKsC,MAAM,CAAC1C,KAVZ,EAPD,CADkB;AAAA,GAAlB,CAFF,EAwBEpB,aAxBF,CALD,CADD;AAkCA,CAtFD,C,CAwFA;AACA;;;AACAwD,aAAa,CAACS,WAAd,GAA4BtE,eAA5B;AACA6D,aAAa,CAAC3D,SAAd,GAA0BA,SAA1B;AAEA,eAAe2D,aAAf","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// ### React\nimport React, { useContext } from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\n\n// ## Children\nimport CellFixed from './cell-fixed';\nimport Checkbox from '../../checkbox';\nimport HeaderCell from './header-cell';\nimport InteractiveElement from '../interactive-element';\nimport CellContext from '../private/cell-context';\nimport TableContext from '../private/table-context';\nimport useContextHelper from './context-helper';\n\n// ## Constants\nimport { DATA_TABLE_HEAD } from '../../../utilities/constants';\n\nconst InteractiveCheckbox = InteractiveElement(Checkbox);\n\n// ### Prop Types\nconst propTypes = {\n\tassistiveText: PropTypes.shape({\n\t\tactionsHeader: PropTypes.string,\n\t\tcolumnSort: PropTypes.string,\n\t\tcolumnSortedAscending: PropTypes.string,\n\t\tcolumnSortedDescending: PropTypes.string,\n\t\tselectAllRows: PropTypes.string,\n\t\tselectRow: PropTypes.string,\n\t}),\n\tallSelected: PropTypes.bool,\n\theaderRefs: PropTypes.func,\n\tisHidden: PropTypes.bool,\n\tindeterminateSelected: PropTypes.bool,\n\tcanSelectRows: PropTypes.oneOfType([\n\t\tPropTypes.bool,\n\t\tPropTypes.oneOf(['checkbox', 'radio']),\n\t]),\n\tcolumns: PropTypes.arrayOf(\n\t\tPropTypes.shape({\n\t\t\tCell: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),\n\t\t\tprops: PropTypes.object,\n\t\t})\n\t),\n\tfixedHeader: PropTypes.bool,\n\tid: PropTypes.string,\n\tonToggleAll: PropTypes.func,\n\tonSort: PropTypes.func,\n\tshowRowActions: PropTypes.bool,\n};\n\nconst ActionsHeader = (props) => {\n\tconst tableContext = useContext(TableContext);\n\tconst cellContext = { columnIndex: props.columnIndex, rowIndex: 0 };\n\tconst { tabIndex, hasFocus, handleFocus, handleKeyDown } = useContextHelper(\n\t\ttableContext,\n\t\tcellContext,\n\t\tprops.fixedLayout\n\t);\n\tconst { fixedHeader } = props;\n\tconst getContent = (style) => (\n\t\t<div className=\"slds-th__action\" style={style}>\n\t\t\t<span className=\"slds-assistive-text\">{props.assistiveText}</span>\n\t\t</div>\n\t);\n\n\treturn (\n\t\t<th\n\t\t\tclassName={classNames({ 'slds-has-focus': hasFocus })}\n\t\t\tref={(ref) => {\n\t\t\t\tif (props.headerRefs) {\n\t\t\t\t\tprops.headerRefs(ref, 'action');\n\t\t\t\t}\n\t\t\t\tif (ref && hasFocus) {\n\t\t\t\t\tref.focus();\n\t\t\t\t}\n\t\t\t}}\n\t\t\tscope=\"col\"\n\t\t\tstyle={{\n\t\t\t\theight: fixedHeader ? 0 : null,\n\t\t\t\tlineHeight: fixedHeader ? 0 : null,\n\t\t\t\twidth: '3.25rem',\n\t\t\t}}\n\t\t\tonFocus={handleFocus}\n\t\t\tonKeyDown={handleKeyDown}\n\t\t\ttabIndex={tabIndex}\n\t\t>\n\t\t\t{getContent(\n\t\t\t\tfixedHeader\n\t\t\t\t\t? {\n\t\t\t\t\t\t\theight: 0,\n\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\tpaddingBottom: 0,\n\t\t\t\t\t\t\tpaddingTop: 0,\n\t\t\t\t\t\t\tvisibility: 'hidden',\n\t\t\t\t\t }\n\t\t\t\t\t: null\n\t\t\t)}\n\t\t\t{fixedHeader ? (\n\t\t\t\t<CellFixed>\n\t\t\t\t\t{getContent({\n\t\t\t\t\t\tlineHeight: 1,\n\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t})}\n\t\t\t\t</CellFixed>\n\t\t\t) : null}\n\t\t</th>\n\t);\n};\n\nconst SelectHeader = (props) => {\n\tconst tableContext = useContext(TableContext);\n\tconst cellContext = { columnIndex: 0, rowIndex: 0 };\n\tconst { tabIndex, hasFocus, handleFocus, handleKeyDown } = useContextHelper(\n\t\ttableContext,\n\t\tcellContext,\n\t\tprops.fixedLayout\n\t);\n\tconst { fixedHeader, canSelectRows } = props;\n\tconst getContent = (idSuffix, style, ariaHidden) => {\n\t\tlet render = null;\n\n\t\tif (canSelectRows === 'radio') {\n\t\t\trender = !ariaHidden ? (\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"slds-truncate slds-assistive-text\"\n\t\t\t\t\tid={`${props.id}-column-group-header-row-select`}\n\t\t\t\t\ttitle={props.assistiveText.selectRowGroup}\n\t\t\t\t>\n\t\t\t\t\t{props.assistiveText.selectRowGroup}\n\t\t\t\t</div>\n\t\t\t) : null;\n\t\t} else if (canSelectRows === true || canSelectRows === 'checkbox') {\n\t\t\trender = (\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"slds-th__action slds-th__action_form\"\n\t\t\t\t\taria-hidden={ariaHidden && true}\n\t\t\t\t\tstyle={style}\n\t\t\t\t>\n\t\t\t\t\t{!ariaHidden ? (\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tid={`${props.id}-column-group-header-row-select`}\n\t\t\t\t\t\t\tclassName=\"slds-assistive-text\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{props.assistiveText.selectAllRows}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) : null}\n\t\t\t\t\t<InteractiveCheckbox\n\t\t\t\t\t\tassistiveText={{\n\t\t\t\t\t\t\tlabel: props.assistiveText.selectAllRows,\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tchecked={props.allSelected}\n\t\t\t\t\t\tindeterminate={props.indeterminateSelected}\n\t\t\t\t\t\tid={`${props.id}-${idSuffix}`}\n\t\t\t\t\t\t// There is a checkbox for user interaction and a checkbox for positioning. ariaHidden is for the checkbox for positioning and it should be removed from the accessibility tree.\n\t\t\t\t\t\tname={!ariaHidden ? 'SelectAll' : undefined}\n\t\t\t\t\t\tonChange={props.onToggleAll}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\n\t\treturn render;\n\t};\n\treturn (\n\t\t<th\n\t\t\tclassName={classNames('slds-text-align_right', {\n\t\t\t\t'slds-has-focus': hasFocus,\n\t\t\t})}\n\t\t\tref={(ref) => {\n\t\t\t\tif (props.headerRefs) {\n\t\t\t\t\tprops.headerRefs(ref, 'select');\n\t\t\t\t}\n\t\t\t\tif (ref && hasFocus) {\n\t\t\t\t\tref.focus();\n\t\t\t\t}\n\t\t\t}}\n\t\t\tscope=\"col\"\n\t\t\tstyle={{\n\t\t\t\theight: fixedHeader ? 0 : null,\n\t\t\t\tlineHeight: fixedHeader ? 0 : null,\n\t\t\t\twidth: '3.25rem',\n\t\t\t}}\n\t\t\tonFocus={handleFocus}\n\t\t\tonKeyDown={handleKeyDown}\n\t\t\ttabIndex={tabIndex}\n\t\t>\n\t\t\t<CellContext.Provider value={cellContext}>\n\t\t\t\t{getContent(\n\t\t\t\t\t'SelectAll-fixed-header',\n\t\t\t\t\tfixedHeader\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\t\theight: 0,\n\t\t\t\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\t\t\t\tpaddingBottom: 0,\n\t\t\t\t\t\t\t\tpaddingTop: 0,\n\t\t\t\t\t\t\t\tvisibility: 'hidden',\n\t\t\t\t\t\t }\n\t\t\t\t\t\t: null,\n\t\t\t\t\tfixedHeader && 'ariaHidden'\n\t\t\t\t)}\n\t\t\t\t{fixedHeader ? (\n\t\t\t\t\t<CellFixed>\n\t\t\t\t\t\t{getContent('SelectAll', {\n\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\tjustifyContent: 'flex-end',\n\t\t\t\t\t\t\tlineHeight: 1,\n\t\t\t\t\t\t\twidth: '100%',\n\t\t\t\t\t\t})}\n\t\t\t\t\t</CellFixed>\n\t\t\t\t) : null}\n\t\t\t</CellContext.Provider>\n\t\t</th>\n\t);\n};\n\n/**\n * Used internally, provides header row rendering to the DataTable.\n */\nconst DataTableHead = (props) => {\n\tconst getActionsHeader = () => {\n\t\tlet actionsHeader = null;\n\n\t\tif (props.showRowActions) {\n\t\t\tactionsHeader = (\n\t\t\t\t<ActionsHeader\n\t\t\t\t\tassistiveText={props.assistiveText.actionsHeader}\n\t\t\t\t\tcolumnIndex={\n\t\t\t\t\t\tprops.canSelectRows\n\t\t\t\t\t\t\t? props.columns.length + 1\n\t\t\t\t\t\t\t: props.columns.length\n\t\t\t\t\t}\n\t\t\t\t\tfixedLayout={props.fixedLayout}\n\t\t\t\t\tfixedHeader={props.fixedHeader}\n\t\t\t\t\theaderRefs={props.headerRefs}\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\treturn actionsHeader;\n\t};\n\n\tconst getSelectHeader = () => {\n\t\tconst { canSelectRows } = props;\n\t\tlet selectHeader = null;\n\n\t\tif (canSelectRows) {\n\t\t\tselectHeader = (\n\t\t\t\t<SelectHeader\n\t\t\t\t\tallSelected={props.allSelected}\n\t\t\t\t\tassistiveText={{\n\t\t\t\t\t\tselectAllRows: props.assistiveText.selectAllRows,\n\t\t\t\t\t\tselectRowGroup: props.assistiveText.selectRowGroup,\n\t\t\t\t\t}}\n\t\t\t\t\tcanSelectRows={canSelectRows}\n\t\t\t\t\tfixedHeader={props.fixedHeader}\n\t\t\t\t\tfixedLayout={props.fixedLayout}\n\t\t\t\t\theaderRefs={props.headerRefs}\n\t\t\t\t\tid={props.id}\n\t\t\t\t\tindeterminateSelected={props.indeterminateSelected}\n\t\t\t\t\tonToggleAll={props.onToggleAll}\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\treturn selectHeader;\n\t};\n\n\tconst actionsHeader = getActionsHeader();\n\tconst selectHeader = getSelectHeader();\n\n\treturn (\n\t\t<thead\n\t\t\tclassName={classNames({\n\t\t\t\t'slds-assistive-text': props.isHidden,\n\t\t\t})}\n\t\t>\n\t\t\t<tr className=\"slds-line-height_reset\">\n\t\t\t\t{selectHeader}\n\t\t\t\t{props.columns.map((column, index) => (\n\t\t\t\t\t<CellContext.Provider\n\t\t\t\t\t\tkey={`${props.id}-${column.props.property}`}\n\t\t\t\t\t\tvalue={{\n\t\t\t\t\t\t\tcolumnIndex: props.canSelectRows ? index + 1 : index,\n\t\t\t\t\t\t\trowIndex: 0,\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t<HeaderCell\n\t\t\t\t\t\t\tassistiveText={props.assistiveText}\n\t\t\t\t\t\t\tcellRef={(ref) => {\n\t\t\t\t\t\t\t\tif (props.headerRefs) {\n\t\t\t\t\t\t\t\t\tprops.headerRefs(ref, index);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tfixedHeader={props.fixedHeader}\n\t\t\t\t\t\t\tid={`${props.id}-${column.props.property}`}\n\t\t\t\t\t\t\tonSort={props.onSort}\n\t\t\t\t\t\t\t{...column.props}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</CellContext.Provider>\n\t\t\t\t))}\n\t\t\t\t{actionsHeader}\n\t\t\t</tr>\n\t\t</thead>\n\t);\n};\n\n// ### Display Name\n// Always use the canonical component name as the React display name.\nDataTableHead.displayName = DATA_TABLE_HEAD;\nDataTableHead.propTypes = propTypes;\n\nexport default DataTableHead;\n"],"file":"head.js"}