@salesforce/design-system-react 0.10.41 → 0.10.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/brand-band/__docs__/__snapshots__/storybook-stories.storyshot +47 -157
- package/components/brand-band/__docs__/storybook-stories.jsx +4 -2
- package/components/brand-band/__examples__/{lightning-blue-theme.jsx → group-image.jsx} +1 -11
- package/components/brand-band/__examples__/no-image.jsx +1 -2
- package/{lib/components/brand-band/__examples__/lightning-blue-theme.jsx → components/brand-band/__examples__/user-image.jsx} +1 -11
- package/components/brand-band/check-props.js +18 -0
- package/components/brand-band/component.json +8 -4
- package/components/brand-band/index.jsx +23 -66
- package/components/brand-band.d.ts +1 -26
- package/components/button/__tests__/button.browser-test.jsx +0 -1
- package/components/combobox/__tests__/combobox.browser-test.jsx +18 -0
- package/components/combobox/combobox.jsx +4 -1
- package/components/component-docs.json +13 -38
- package/components/data-table/cell.jsx +2 -2
- package/components/data-table/index.jsx +130 -85
- package/components/data-table/private/context-helper.js +26 -14
- package/components/data-table/private/head.jsx +269 -260
- package/components/data-table/private/header-cell.jsx +204 -230
- package/components/data-table/private/row.jsx +140 -105
- package/components/data-table/row-actions.jsx +2 -2
- package/components/icon/__docs__/__snapshots__/storybook-stories.storyshot +49 -2
- package/components/icon/__docs__/storybook-stories.jsx +2 -0
- package/components/icon/__examples__/color-success.jsx +24 -0
- package/components/icon/__examples__/colors.jsx +10 -2
- package/components/icon/index.jsx +2 -0
- package/components/icon.d.ts +1 -1
- package/components/site-stories.js +8 -4
- package/components/utilities/truncate/index.jsx +1 -1
- package/lib/components/brand-band/__docs__/__snapshots__/storybook-stories.storyshot +47 -157
- package/lib/components/brand-band/__docs__/storybook-stories.jsx +4 -2
- package/lib/components/brand-band/__examples__/group-image.jsx +12 -0
- package/lib/components/brand-band/__examples__/no-image.jsx +1 -2
- package/lib/components/brand-band/__examples__/user-image.jsx +12 -0
- package/lib/components/brand-band/check-props.js +29 -0
- package/lib/components/brand-band/component.json +8 -4
- package/lib/components/brand-band/index.js +9 -50
- package/lib/components/brand-band.d.ts +1 -26
- package/lib/components/button/__tests__/button.browser-test.jsx +0 -1
- package/lib/components/combobox/__tests__/combobox.browser-test.jsx +18 -0
- package/lib/components/combobox/combobox.js +6 -2
- package/lib/components/component-docs.json +13 -38
- package/lib/components/data-table/cell.js +6 -6
- package/lib/components/data-table/index.js +127 -99
- package/lib/components/data-table/private/context-helper.js +13 -14
- package/lib/components/data-table/private/head.js +233 -252
- package/lib/components/data-table/private/header-cell.js +185 -221
- package/lib/components/data-table/private/row.js +97 -89
- package/lib/components/data-table/row-actions.js +6 -6
- package/lib/components/icon/__docs__/__snapshots__/storybook-stories.storyshot +49 -2
- package/lib/components/icon/__docs__/storybook-stories.jsx +2 -0
- package/lib/components/icon/__examples__/color-success.jsx +24 -0
- package/lib/components/icon/__examples__/colors.jsx +10 -2
- package/lib/components/icon/index.js +2 -1
- package/lib/components/icon.d.ts +1 -1
- package/lib/components/site-stories.js +6 -3
- package/lib/components/utilities/truncate/index.js +2 -2
- package/lib/package.json +13 -9
- package/module/components/brand-band/__docs__/__snapshots__/storybook-stories.storyshot +47 -157
- package/module/components/brand-band/__docs__/storybook-stories.js +6 -3
- package/module/components/brand-band/__docs__/storybook-stories.js.map +1 -1
- package/module/components/brand-band/__examples__/{lightning-blue-theme.js → group-image.js} +4 -9
- package/module/components/brand-band/__examples__/group-image.js.map +1 -0
- package/module/components/brand-band/__examples__/no-image.js +2 -4
- package/module/components/brand-band/__examples__/no-image.js.map +1 -1
- package/module/components/brand-band/__examples__/user-image.js +52 -0
- package/module/components/brand-band/__examples__/user-image.js.map +1 -0
- package/module/components/brand-band/check-props.js +20 -0
- package/module/components/brand-band/check-props.js.map +1 -0
- package/module/components/brand-band/component.json +8 -4
- package/module/components/brand-band/index.js +10 -51
- package/module/components/brand-band/index.js.map +1 -1
- package/module/components/brand-band.d.ts +1 -26
- package/module/components/button/__tests__/button.browser-test.js +0 -1
- package/module/components/button/__tests__/button.browser-test.js.map +1 -1
- package/module/components/combobox/__tests__/combobox.browser-test.js +22 -0
- package/module/components/combobox/__tests__/combobox.browser-test.js.map +1 -1
- package/module/components/combobox/combobox.js +6 -2
- package/module/components/combobox/combobox.js.map +1 -1
- package/module/components/component-docs.json +13 -38
- package/module/components/data-table/cell.js +6 -6
- package/module/components/data-table/cell.js.map +1 -1
- package/module/components/data-table/index.js +120 -95
- package/module/components/data-table/index.js.map +1 -1
- package/module/components/data-table/private/context-helper.js +12 -12
- package/module/components/data-table/private/context-helper.js.map +1 -1
- package/module/components/data-table/private/head.js +230 -255
- package/module/components/data-table/private/head.js.map +1 -1
- package/module/components/data-table/private/header-cell.js +184 -225
- package/module/components/data-table/private/header-cell.js.map +1 -1
- package/module/components/data-table/private/row.js +95 -87
- package/module/components/data-table/private/row.js.map +1 -1
- package/module/components/data-table/row-actions.js +6 -6
- package/module/components/data-table/row-actions.js.map +1 -1
- package/module/components/icon/__docs__/__snapshots__/storybook-stories.storyshot +49 -2
- package/module/components/icon/__docs__/storybook-stories.js +3 -0
- package/module/components/icon/__docs__/storybook-stories.js.map +1 -1
- package/module/components/icon/__examples__/color-success.js +64 -0
- package/module/components/icon/__examples__/color-success.js.map +1 -0
- package/module/components/icon/__examples__/colors.js +11 -2
- package/module/components/icon/__examples__/colors.js.map +1 -1
- package/module/components/icon/index.js +2 -1
- package/module/components/icon/index.js.map +1 -1
- package/module/components/icon.d.ts +1 -1
- package/module/components/site-stories.js +6 -3
- package/module/components/site-stories.js.map +1 -1
- package/module/components/utilities/truncate/index.js +1 -1
- package/module/components/utilities/truncate/index.js.map +1 -1
- package/package.json +13 -9
- package/module/components/brand-band/__examples__/lightning-blue-theme.js.map +0 -1
|
@@ -4,7 +4,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
4
4
|
|
|
5
5
|
/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */
|
|
6
6
|
// ### React
|
|
7
|
-
import React, { useContext } from 'react';
|
|
7
|
+
import React, { useCallback, useContext, useMemo } from 'react';
|
|
8
8
|
import PropTypes from 'prop-types'; // ### classNames
|
|
9
9
|
|
|
10
10
|
import classNames from 'classnames'; // ### find
|
|
@@ -18,7 +18,7 @@ import { DATA_TABLE_ROW, DATA_TABLE_ROW_ACTIONS, DATA_TABLE_CELL } from '../../.
|
|
|
18
18
|
import InteractiveElement from '../interactive-element';
|
|
19
19
|
import CellContext from '../private/cell-context';
|
|
20
20
|
import TableContext from '../private/table-context';
|
|
21
|
-
import
|
|
21
|
+
import useContextHelper from './context-helper';
|
|
22
22
|
var InteractiveCheckbox = InteractiveElement(Checkbox);
|
|
23
23
|
var InteractiveRadio = InteractiveElement(Radio);
|
|
24
24
|
var propTypes = {
|
|
@@ -54,29 +54,35 @@ var propTypes = {
|
|
|
54
54
|
|
|
55
55
|
var DataTableRow = function DataTableRow(props) {
|
|
56
56
|
var tableContext = useContext(TableContext);
|
|
57
|
-
var selectRowCellContext = {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
var selectRowCellContext = useMemo(function () {
|
|
58
|
+
return {
|
|
59
|
+
rowIndex: props.rowIndex,
|
|
60
|
+
columnIndex: 0
|
|
61
|
+
};
|
|
62
|
+
}, [props.rowIndex]);
|
|
61
63
|
|
|
62
|
-
var
|
|
63
|
-
tabIndex =
|
|
64
|
-
hasFocus =
|
|
65
|
-
handleFocus =
|
|
66
|
-
handleKeyDown =
|
|
64
|
+
var _useContextHelper = useContextHelper(tableContext, selectRowCellContext, props.fixedLayout),
|
|
65
|
+
tabIndex = _useContextHelper.tabIndex,
|
|
66
|
+
hasFocus = _useContextHelper.hasFocus,
|
|
67
|
+
handleFocus = _useContextHelper.handleFocus,
|
|
68
|
+
handleKeyDown = _useContextHelper.handleKeyDown;
|
|
67
69
|
|
|
68
|
-
var
|
|
70
|
+
var item = props.item,
|
|
71
|
+
onToggle = props.onToggle;
|
|
72
|
+
var handleToggle = useCallback(function (e, _ref) {
|
|
69
73
|
var checked = _ref.checked;
|
|
70
|
-
return
|
|
71
|
-
};
|
|
74
|
+
return onToggle(item, checked, e);
|
|
75
|
+
}, [item, onToggle]);
|
|
76
|
+
var isSelected = !!find(props.selection, item);
|
|
77
|
+
var ariaProps = useMemo(function () {
|
|
78
|
+
var result = {};
|
|
72
79
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
if (props.canSelectRows) {
|
|
77
|
-
ariaProps['aria-selected'] = isSelected ? 'true' : 'false';
|
|
78
|
-
} // i18n
|
|
80
|
+
if (props.canSelectRows) {
|
|
81
|
+
result['aria-selected'] = isSelected ? 'true' : 'false';
|
|
82
|
+
}
|
|
79
83
|
|
|
84
|
+
return result;
|
|
85
|
+
}, [isSelected, props.canSelectRows]); // i18n
|
|
80
86
|
|
|
81
87
|
return /*#__PURE__*/React.createElement("tr", _extends({}, ariaProps, {
|
|
82
88
|
className: classNames(props.className, {
|
|
@@ -84,76 +90,78 @@ var DataTableRow = function DataTableRow(props) {
|
|
|
84
90
|
'slds-is-selected': props.canSelectRows && isSelected,
|
|
85
91
|
'slds-has-focus': hasFocus
|
|
86
92
|
})
|
|
87
|
-
}),
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
_ref2
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
93
|
+
}), useMemo(function () {
|
|
94
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, props.canSelectRows ?
|
|
95
|
+
/*#__PURE__*/
|
|
96
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
|
97
|
+
React.createElement("td", {
|
|
98
|
+
role: props.fixedLayout ? 'gridcell' : null,
|
|
99
|
+
className: "slds-text-align_right",
|
|
100
|
+
"data-label": props.stacked ? 'Select Row' : undefined,
|
|
101
|
+
style: {
|
|
102
|
+
width: '3.25rem'
|
|
103
|
+
},
|
|
104
|
+
onFocus: handleFocus,
|
|
105
|
+
onKeyDown: handleKeyDown,
|
|
106
|
+
ref: function ref(_ref2) {
|
|
107
|
+
if (_ref2 && hasFocus) {
|
|
108
|
+
_ref2.focus();
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
tabIndex: tabIndex
|
|
112
|
+
}, /*#__PURE__*/React.createElement(CellContext.Provider, {
|
|
113
|
+
value: selectRowCellContext
|
|
114
|
+
}, props.canSelectRows === 'radio' ? /*#__PURE__*/React.createElement(InteractiveRadio, {
|
|
115
|
+
assistiveText: {
|
|
116
|
+
label: "".concat(props.assistiveText.selectRow, " ").concat(Number(props.index) + 1)
|
|
117
|
+
},
|
|
118
|
+
"aria-labelledby": "".concat(props.id, "-SelectRow-label ").concat(props.tableId, "-SLDSDataTableHead-column-group-header-row-select"),
|
|
119
|
+
checked: isSelected,
|
|
120
|
+
className: "slds-m-right_x-small",
|
|
121
|
+
id: "".concat(props.id, "-SelectRow"),
|
|
122
|
+
labelId: "".concat(props.id, "-SelectRow-label"),
|
|
123
|
+
name: "".concat(props.tableId, "-SelectRow"),
|
|
124
|
+
onChange: handleToggle
|
|
125
|
+
}) : /*#__PURE__*/React.createElement(InteractiveCheckbox, {
|
|
126
|
+
assistiveText: {
|
|
127
|
+
label: "".concat(props.assistiveText.selectRow, " ").concat(Number(props.index) + 1)
|
|
128
|
+
},
|
|
129
|
+
"aria-labelledby": "".concat(props.id, "-SelectRow-label ").concat(props.tableId, "-SLDSDataTableHead-column-group-header-row-select"),
|
|
130
|
+
checked: isSelected,
|
|
131
|
+
id: "".concat(props.id, "-SelectRow"),
|
|
132
|
+
labelId: "".concat(props.id, "-SelectRow-label"),
|
|
133
|
+
name: "SelectRow".concat(props.index + 1),
|
|
134
|
+
onChange: handleToggle
|
|
135
|
+
}))) : null, props.columns.map(function (column, index) {
|
|
136
|
+
var Cell = column.Cell;
|
|
137
|
+
var cellId = "".concat(props.id, "-").concat(DATA_TABLE_CELL, "-").concat(column.props.property);
|
|
138
|
+
return /*#__PURE__*/React.createElement(CellContext.Provider, {
|
|
139
|
+
key: cellId,
|
|
140
|
+
value: {
|
|
141
|
+
columnIndex: props.canSelectRows ? index + 1 : index,
|
|
142
|
+
rowIndex: props.rowIndex
|
|
143
|
+
}
|
|
144
|
+
}, /*#__PURE__*/React.createElement(Cell, _extends({}, column.props, {
|
|
145
|
+
className: column.props.truncate ? 'slds-truncate' : null,
|
|
146
|
+
fixedLayout: props.fixedLayout,
|
|
147
|
+
rowHeader: column.props.primaryColumn,
|
|
148
|
+
id: cellId,
|
|
149
|
+
item: item,
|
|
150
|
+
width: column.props.width,
|
|
151
|
+
headerId: item.headerId,
|
|
152
|
+
columns: props.columns
|
|
153
|
+
}), item[column.props.property]));
|
|
154
|
+
}), /*#__PURE__*/React.createElement(CellContext.Provider, {
|
|
133
155
|
value: {
|
|
134
|
-
columnIndex: props.canSelectRows ?
|
|
156
|
+
columnIndex: props.canSelectRows ? props.columns.length + 1 : props.columns.length,
|
|
135
157
|
rowIndex: props.rowIndex
|
|
136
158
|
}
|
|
137
|
-
}, /*#__PURE__*/React.
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
width: column.props.width,
|
|
144
|
-
headerId: props.item.headerId,
|
|
145
|
-
columns: props.columns
|
|
146
|
-
}), props.item[column.props.property]));
|
|
147
|
-
}), /*#__PURE__*/React.createElement(CellContext.Provider, {
|
|
148
|
-
value: {
|
|
149
|
-
columnIndex: props.canSelectRows ? props.columns.length + 1 : props.columns.length,
|
|
150
|
-
rowIndex: props.rowIndex
|
|
151
|
-
}
|
|
152
|
-
}, props.rowActions ? /*#__PURE__*/React.cloneElement(props.rowActions, {
|
|
153
|
-
id: "".concat(props.id, "-").concat(DATA_TABLE_ROW_ACTIONS),
|
|
154
|
-
item: props.item,
|
|
155
|
-
fixedLayout: props.fixedLayout
|
|
156
|
-
}) : null));
|
|
159
|
+
}, props.rowActions ? /*#__PURE__*/React.cloneElement(props.rowActions, {
|
|
160
|
+
id: "".concat(props.id, "-").concat(DATA_TABLE_ROW_ACTIONS),
|
|
161
|
+
item: item,
|
|
162
|
+
fixedLayout: props.fixedLayout
|
|
163
|
+
}) : null));
|
|
164
|
+
}, [handleFocus, handleKeyDown, handleToggle, hasFocus, isSelected, item, tabIndex, props.assistiveText.selectRow, props.canSelectRows, props.columns, props.fixedLayout, props.id, props.index, props.rowActions, props.rowIndex, props.stacked, props.tableId, selectRowCellContext]));
|
|
157
165
|
};
|
|
158
166
|
|
|
159
167
|
DataTableRow.displayName = DATA_TABLE_ROW;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../.tmp-es/components/data-table/private/row.jsx"],"names":["React","useContext","PropTypes","classNames","find","Checkbox","Radio","DATA_TABLE_ROW","DATA_TABLE_ROW_ACTIONS","DATA_TABLE_CELL","InteractiveElement","CellContext","TableContext","contextHelper","InteractiveCheckbox","InteractiveRadio","propTypes","assistiveText","shape","actionsHeader","string","columnSort","columnSortedAscending","columnSortedDescending","selectAllRows","selectRow","canSelectRows","oneOfType","bool","oneOf","className","columns","arrayOf","Cell","func","props","object","fixedLayout","id","isRequired","item","onToggle","rowActions","element","selection","array","tableId","DataTableRow","tableContext","selectRowCellContext","rowIndex","columnIndex","tabIndex","hasFocus","handleFocus","handleKeyDown","handleToggle","e","checked","ariaProps","isSelected","stacked","undefined","width","ref","focus","label","Number","index","map","column","cellId","property","truncate","primaryColumn","headerId","length","cloneElement","displayName"],"mappings":";;AAAA;;AACA;AAEA;AACA,OAAOA,KAAP,IAAgBC,UAAhB,QAAkC,OAAlC;AACA,OAAOC,SAAP,MAAsB,YAAtB,C,CAEA;;AACA,OAAOC,UAAP,MAAuB,YAAvB,C,CAEA;;AACA,OAAOC,IAAP,MAAiB,aAAjB,C,CAEA;;AACA,OAAOC,QAAP,MAAqB,gBAArB;AACA,OAAOC,KAAP,MAAkB,aAAlB,C,CAEA;;AACA,SACCC,cADD,EAECC,sBAFD,EAGCC,eAHD,QAIO,8BAJP;AAMA,OAAOC,kBAAP,MAA+B,wBAA/B;AACA,OAAOC,WAAP,MAAwB,yBAAxB;AACA,OAAOC,YAAP,MAAyB,0BAAzB;AACA,OAAOC,aAAP,MAA0B,kBAA1B;AAEA,IAAMC,mBAAmB,GAAGJ,kBAAkB,CAACL,QAAD,CAA9C;AACA,IAAMU,gBAAgB,GAAGL,kBAAkB,CAACJ,KAAD,CAA3C;AAEA,IAAMU,SAAS,GAAG;AACjBC,EAAAA,aAAa,EAAEf,SAAS,CAACgB,KAAV,CAAgB;AAC9BC,IAAAA,aAAa,EAAEjB,SAAS,CAACkB,MADK;AAE9BC,IAAAA,UAAU,EAAEnB,SAAS,CAACkB,MAFQ;AAG9BE,IAAAA,qBAAqB,EAAEpB,SAAS,CAACkB,MAHH;AAI9BG,IAAAA,sBAAsB,EAAErB,SAAS,CAACkB,MAJJ;AAK9BI,IAAAA,aAAa,EAAEtB,SAAS,CAACkB,MALK;AAM9BK,IAAAA,SAAS,EAAEvB,SAAS,CAACkB;AANS,GAAhB,CADE;AASjBM,EAAAA,aAAa,EAAExB,SAAS,CAACyB,SAAV,CAAoB,CAClCzB,SAAS,CAAC0B,IADwB,EAElC1B,SAAS,CAAC2B,KAAV,CAAgB,CAAC,UAAD,EAAa,OAAb,C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B,CADmC;AAErCgC,IAAAA,IAAI,EAAEL,KAAK,CAACK,IAFyB;AAGrCH,IAAAA,WAAW,EAAEF,KAAK,CAACE;AAHkB,GAArC,CADF,GAME,IAdJ,CAtFD,CADD;AAyGA,CAhID;;AAkIAU,YAAY,CAAC+B,WAAb,GAA2BvE,cAA3B;AACAwC,YAAY,CAAC/B,SAAb,GAAyBA,SAAzB;AACA,eAAe+B,YAAf","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';\n\n// ### classNames\nimport classNames from 'classnames';\n\n// ### find\nimport find from 'lodash.find';\n\n// ## Children\nimport Checkbox from '../../checkbox';\nimport Radio from '../../radio';\n\n// ## Constants\nimport {\n\tDATA_TABLE_ROW,\n\tDATA_TABLE_ROW_ACTIONS,\n\tDATA_TABLE_CELL,\n} from '../../../utilities/constants';\n\nimport InteractiveElement from '../interactive-element';\nimport CellContext from '../private/cell-context';\nimport TableContext from '../private/table-context';\nimport contextHelper from './context-helper';\n\nconst InteractiveCheckbox = InteractiveElement(Checkbox);\nconst InteractiveRadio = InteractiveElement(Radio);\n\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\tcanSelectRows: PropTypes.oneOfType([\n\t\tPropTypes.bool,\n\t\tPropTypes.oneOf(['checkbox', 'radio']),\n\t]),\n\tclassName: PropTypes.string,\n\tcolumns: PropTypes.arrayOf(\n\t\tPropTypes.shape({\n\t\t\tCell: PropTypes.func,\n\t\t\tprops: PropTypes.object,\n\t\t})\n\t),\n\t/**\n\t * Use this if you are creating an advanced table (selectable, sortable, or resizable rows)\n\t */\n\tfixedLayout: PropTypes.bool,\n\tid: PropTypes.string.isRequired,\n\titem: PropTypes.object.isRequired,\n\tonToggle: PropTypes.func,\n\trowActions: PropTypes.element,\n\tselection: PropTypes.array,\n\ttableId: PropTypes.string,\n};\n\n/**\n * Used internally, provides row rendering to the DataTable.\n */\nconst DataTableRow = (props) => {\n\tconst tableContext = useContext(TableContext);\n\tconst selectRowCellContext = {\n\t\trowIndex: props.rowIndex,\n\t\tcolumnIndex: 0,\n\t};\n\tconst { tabIndex, hasFocus, handleFocus, handleKeyDown } = contextHelper(\n\t\ttableContext,\n\t\tselectRowCellContext,\n\t\tprops.fixedLayout\n\t);\n\n\tconst handleToggle = (e, { checked }) =>\n\t\tprops.onToggle(props.item, checked, e);\n\n\tconst ariaProps = {};\n\tconst isSelected = !!find(props.selection, props.item);\n\n\tif (props.canSelectRows) {\n\t\tariaProps['aria-selected'] = isSelected ? 'true' : 'false';\n\t}\n\n\t// i18n\n\treturn (\n\t\t<tr\n\t\t\t{...ariaProps}\n\t\t\tclassName={classNames(props.className, {\n\t\t\t\t'slds-hint-parent': props.rowActions,\n\t\t\t\t'slds-is-selected': props.canSelectRows && isSelected,\n\t\t\t\t'slds-has-focus': hasFocus,\n\t\t\t})}\n\t\t>\n\t\t\t{props.canSelectRows ? (\n\t\t\t\t// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions\n\t\t\t\t<td\n\t\t\t\t\trole={props.fixedLayout ? 'gridcell' : null}\n\t\t\t\t\tclassName=\"slds-text-align_right\"\n\t\t\t\t\tdata-label={props.stacked ? 'Select Row' : undefined}\n\t\t\t\t\tstyle={{ width: '3.25rem' }}\n\t\t\t\t\tonFocus={handleFocus}\n\t\t\t\t\tonKeyDown={handleKeyDown}\n\t\t\t\t\tref={(ref) => {\n\t\t\t\t\t\tif (ref && hasFocus) {\n\t\t\t\t\t\t\tref.focus();\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t\ttabIndex={tabIndex}\n\t\t\t\t>\n\t\t\t\t\t<CellContext.Provider value={selectRowCellContext}>\n\t\t\t\t\t\t{props.canSelectRows === 'radio' ? (\n\t\t\t\t\t\t\t<InteractiveRadio\n\t\t\t\t\t\t\t\tassistiveText={{\n\t\t\t\t\t\t\t\t\tlabel: `${props.assistiveText.selectRow} ${\n\t\t\t\t\t\t\t\t\t\tNumber(props.index) + 1\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\taria-labelledby={`${props.id}-SelectRow-label ${props.tableId}-SLDSDataTableHead-column-group-header-row-select`}\n\t\t\t\t\t\t\t\tchecked={isSelected}\n\t\t\t\t\t\t\t\tclassName=\"slds-m-right_x-small\"\n\t\t\t\t\t\t\t\tid={`${props.id}-SelectRow`}\n\t\t\t\t\t\t\t\tlabelId={`${props.id}-SelectRow-label`}\n\t\t\t\t\t\t\t\tname={`${props.tableId}-SelectRow`}\n\t\t\t\t\t\t\t\tonChange={handleToggle}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<InteractiveCheckbox\n\t\t\t\t\t\t\t\tassistiveText={{\n\t\t\t\t\t\t\t\t\tlabel: `${props.assistiveText.selectRow} ${\n\t\t\t\t\t\t\t\t\t\tNumber(props.index) + 1\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\taria-labelledby={`${props.id}-SelectRow-label ${props.tableId}-SLDSDataTableHead-column-group-header-row-select`}\n\t\t\t\t\t\t\t\tchecked={isSelected}\n\t\t\t\t\t\t\t\tid={`${props.id}-SelectRow`}\n\t\t\t\t\t\t\t\tlabelId={`${props.id}-SelectRow-label`}\n\t\t\t\t\t\t\t\tname={`SelectRow${props.index + 1}`}\n\t\t\t\t\t\t\t\tonChange={handleToggle}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</CellContext.Provider>\n\t\t\t\t</td>\n\t\t\t) : null}\n\t\t\t{props.columns.map((column, index) => {\n\t\t\t\tconst { Cell } = column;\n\t\t\t\tconst cellId = `${props.id}-${DATA_TABLE_CELL}-${column.props.property}`;\n\n\t\t\t\treturn (\n\t\t\t\t\t<CellContext.Provider\n\t\t\t\t\t\tkey={cellId}\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: props.rowIndex,\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t<Cell\n\t\t\t\t\t\t\t{...column.props}\n\t\t\t\t\t\t\tclassName={column.props.truncate ? 'slds-truncate' : null}\n\t\t\t\t\t\t\tfixedLayout={props.fixedLayout}\n\t\t\t\t\t\t\trowHeader={column.props.primaryColumn}\n\t\t\t\t\t\t\tid={cellId}\n\t\t\t\t\t\t\titem={props.item}\n\t\t\t\t\t\t\twidth={column.props.width}\n\t\t\t\t\t\t\theaderId={props.item.headerId}\n\t\t\t\t\t\t\tcolumns={props.columns}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{props.item[column.props.property]}\n\t\t\t\t\t\t</Cell>\n\t\t\t\t\t</CellContext.Provider>\n\t\t\t\t);\n\t\t\t})}\n\t\t\t<CellContext.Provider\n\t\t\t\tvalue={{\n\t\t\t\t\tcolumnIndex: props.canSelectRows\n\t\t\t\t\t\t? props.columns.length + 1\n\t\t\t\t\t\t: props.columns.length,\n\t\t\t\t\trowIndex: props.rowIndex,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{props.rowActions\n\t\t\t\t\t? React.cloneElement(props.rowActions, {\n\t\t\t\t\t\t\tid: `${props.id}-${DATA_TABLE_ROW_ACTIONS}`,\n\t\t\t\t\t\t\titem: props.item,\n\t\t\t\t\t\t\tfixedLayout: props.fixedLayout,\n\t\t\t\t\t })\n\t\t\t\t\t: null}\n\t\t\t</CellContext.Provider>\n\t\t</tr>\n\t);\n};\n\nDataTableRow.displayName = DATA_TABLE_ROW;\nDataTableRow.propTypes = propTypes;\nexport default DataTableRow;\n"],"file":"row.js"}
|
|
1
|
+
{"version":3,"sources":["../../../../.tmp-es/components/data-table/private/row.jsx"],"names":["React","useCallback","useContext","useMemo","PropTypes","classNames","find","Checkbox","Radio","DATA_TABLE_ROW","DATA_TABLE_ROW_ACTIONS","DATA_TABLE_CELL","InteractiveElement","CellContext","TableContext","useContextHelper","InteractiveCheckbox","InteractiveRadio","propTypes","assistiveText","shape","actionsHeader","string","columnSort","columnSortedAscending","columnSortedDescending","selectAllRows","selectRow","canSelectRows","oneOfType","bool","oneOf","className","columns","arrayOf","Cell","func","props","object","fixedLayout","id","isRequired","item","onToggle","rowActions","element","selection","array","tableId","DataTableRow","tableContext","selectRowCellContext","rowIndex","columnIndex","tabIndex","hasFocus","handleFocus","handleKeyDown","handleToggle","e","checked","isSelected","ariaProps","result","stacked","undefined","width","ref","focus","label","Number","index","map","column","cellId","property","truncate","primaryColumn","headerId","length","cloneElement","displayName"],"mappings":";;AAAA;;AACA;AAEA;AACA,OAAOA,KAAP,IAAgBC,WAAhB,EAA6BC,UAA7B,EAAyCC,OAAzC,QAAwD,OAAxD;AACA,OAAOC,SAAP,MAAsB,YAAtB,C,CAEA;;AACA,OAAOC,UAAP,MAAuB,YAAvB,C,CAEA;;AACA,OAAOC,IAAP,MAAiB,aAAjB,C,CAEA;;AACA,OAAOC,QAAP,MAAqB,gBAArB;AACA,OAAOC,KAAP,MAAkB,aAAlB,C,CAEA;;AACA,SACCC,cADD,EAECC,sBAFD,EAGCC,eAHD,QAIO,8BAJP;AAMA,OAAOC,kBAAP,MAA+B,wBAA/B;AACA,OAAOC,WAAP,MAAwB,yBAAxB;AACA,OAAOC,YAAP,MAAyB,0BAAzB;AACA,OAAOC,gBAAP,MAA6B,kBAA7B;AAEA,IAAMC,mBAAmB,GAAGJ,kBAAkB,CAACL,QAAD,CAA9C;AACA,IAAMU,gBAAgB,GAAGL,kBAAkB,CAACJ,KAAD,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I,KAAK,CAACE,WAXP,EAYCF,KAAK,CAACG,EAZP,EAaCH,KAAK,CAACkC,KAbP,EAcClC,KAAK,CAACO,UAdP,EAeCP,KAAK,CAACe,QAfP,EAgBCf,KAAK,CAAC2B,OAhBP,EAiBC3B,KAAK,CAACW,OAjBP,EAkBCG,oBAlBD,CAnGO,CART,CADD;AAmIA,CAnKD;;AAqKAF,YAAY,CAACgC,WAAb,GAA2BxE,cAA3B;AACAwC,YAAY,CAAC/B,SAAb,GAAyBA,SAAzB;AACA,eAAe+B,YAAf","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, { useCallback, useContext, useMemo } from 'react';\nimport PropTypes from 'prop-types';\n\n// ### classNames\nimport classNames from 'classnames';\n\n// ### find\nimport find from 'lodash.find';\n\n// ## Children\nimport Checkbox from '../../checkbox';\nimport Radio from '../../radio';\n\n// ## Constants\nimport {\n\tDATA_TABLE_ROW,\n\tDATA_TABLE_ROW_ACTIONS,\n\tDATA_TABLE_CELL,\n} from '../../../utilities/constants';\n\nimport InteractiveElement from '../interactive-element';\nimport CellContext from '../private/cell-context';\nimport TableContext from '../private/table-context';\nimport useContextHelper from './context-helper';\n\nconst InteractiveCheckbox = InteractiveElement(Checkbox);\nconst InteractiveRadio = InteractiveElement(Radio);\n\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\tcanSelectRows: PropTypes.oneOfType([\n\t\tPropTypes.bool,\n\t\tPropTypes.oneOf(['checkbox', 'radio']),\n\t]),\n\tclassName: PropTypes.string,\n\tcolumns: PropTypes.arrayOf(\n\t\tPropTypes.shape({\n\t\t\tCell: PropTypes.func,\n\t\t\tprops: PropTypes.object,\n\t\t})\n\t),\n\t/**\n\t * Use this if you are creating an advanced table (selectable, sortable, or resizable rows)\n\t */\n\tfixedLayout: PropTypes.bool,\n\tid: PropTypes.string.isRequired,\n\titem: PropTypes.object.isRequired,\n\tonToggle: PropTypes.func,\n\trowActions: PropTypes.element,\n\tselection: PropTypes.array,\n\ttableId: PropTypes.string,\n};\n\n/**\n * Used internally, provides row rendering to the DataTable.\n */\nconst DataTableRow = (props) => {\n\tconst tableContext = useContext(TableContext);\n\tconst selectRowCellContext = useMemo(\n\t\t() => ({\n\t\t\trowIndex: props.rowIndex,\n\t\t\tcolumnIndex: 0,\n\t\t}),\n\t\t[props.rowIndex]\n\t);\n\tconst { tabIndex, hasFocus, handleFocus, handleKeyDown } = useContextHelper(\n\t\ttableContext,\n\t\tselectRowCellContext,\n\t\tprops.fixedLayout\n\t);\n\n\tconst { item, onToggle } = props;\n\tconst handleToggle = useCallback(\n\t\t(e, { checked }) => onToggle(item, checked, e),\n\t\t[item, onToggle]\n\t);\n\n\tconst isSelected = !!find(props.selection, item);\n\tconst ariaProps = useMemo(() => {\n\t\tconst result = {};\n\n\t\tif (props.canSelectRows) {\n\t\t\tresult['aria-selected'] = isSelected ? 'true' : 'false';\n\t\t}\n\t\treturn result;\n\t}, [isSelected, props.canSelectRows]);\n\n\t// i18n\n\treturn (\n\t\t<tr\n\t\t\t{...ariaProps}\n\t\t\tclassName={classNames(props.className, {\n\t\t\t\t'slds-hint-parent': props.rowActions,\n\t\t\t\t'slds-is-selected': props.canSelectRows && isSelected,\n\t\t\t\t'slds-has-focus': hasFocus,\n\t\t\t})}\n\t\t>\n\t\t\t{useMemo(\n\t\t\t\t() => (\n\t\t\t\t\t<React.Fragment>\n\t\t\t\t\t\t{props.canSelectRows ? (\n\t\t\t\t\t\t\t// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions\n\t\t\t\t\t\t\t<td\n\t\t\t\t\t\t\t\trole={props.fixedLayout ? 'gridcell' : null}\n\t\t\t\t\t\t\t\tclassName=\"slds-text-align_right\"\n\t\t\t\t\t\t\t\tdata-label={props.stacked ? 'Select Row' : undefined}\n\t\t\t\t\t\t\t\tstyle={{ width: '3.25rem' }}\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\tref={(ref) => {\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\ttabIndex={tabIndex}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<CellContext.Provider value={selectRowCellContext}>\n\t\t\t\t\t\t\t\t\t{props.canSelectRows === 'radio' ? (\n\t\t\t\t\t\t\t\t\t\t<InteractiveRadio\n\t\t\t\t\t\t\t\t\t\t\tassistiveText={{\n\t\t\t\t\t\t\t\t\t\t\t\tlabel: `${props.assistiveText.selectRow} ${\n\t\t\t\t\t\t\t\t\t\t\t\t\tNumber(props.index) + 1\n\t\t\t\t\t\t\t\t\t\t\t\t}`,\n\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\taria-labelledby={`${props.id}-SelectRow-label ${props.tableId}-SLDSDataTableHead-column-group-header-row-select`}\n\t\t\t\t\t\t\t\t\t\t\tchecked={isSelected}\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"slds-m-right_x-small\"\n\t\t\t\t\t\t\t\t\t\t\tid={`${props.id}-SelectRow`}\n\t\t\t\t\t\t\t\t\t\t\tlabelId={`${props.id}-SelectRow-label`}\n\t\t\t\t\t\t\t\t\t\t\tname={`${props.tableId}-SelectRow`}\n\t\t\t\t\t\t\t\t\t\t\tonChange={handleToggle}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t<InteractiveCheckbox\n\t\t\t\t\t\t\t\t\t\t\tassistiveText={{\n\t\t\t\t\t\t\t\t\t\t\t\tlabel: `${props.assistiveText.selectRow} ${\n\t\t\t\t\t\t\t\t\t\t\t\t\tNumber(props.index) + 1\n\t\t\t\t\t\t\t\t\t\t\t\t}`,\n\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\taria-labelledby={`${props.id}-SelectRow-label ${props.tableId}-SLDSDataTableHead-column-group-header-row-select`}\n\t\t\t\t\t\t\t\t\t\t\tchecked={isSelected}\n\t\t\t\t\t\t\t\t\t\t\tid={`${props.id}-SelectRow`}\n\t\t\t\t\t\t\t\t\t\t\tlabelId={`${props.id}-SelectRow-label`}\n\t\t\t\t\t\t\t\t\t\t\tname={`SelectRow${props.index + 1}`}\n\t\t\t\t\t\t\t\t\t\t\tonChange={handleToggle}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t</CellContext.Provider>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t{props.columns.map((column, index) => {\n\t\t\t\t\t\t\tconst { Cell } = column;\n\t\t\t\t\t\t\tconst cellId = `${props.id}-${DATA_TABLE_CELL}-${column.props.property}`;\n\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<CellContext.Provider\n\t\t\t\t\t\t\t\t\tkey={cellId}\n\t\t\t\t\t\t\t\t\tvalue={{\n\t\t\t\t\t\t\t\t\t\tcolumnIndex: props.canSelectRows ? index + 1 : index,\n\t\t\t\t\t\t\t\t\t\trowIndex: props.rowIndex,\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\t\t<Cell\n\t\t\t\t\t\t\t\t\t\t{...column.props}\n\t\t\t\t\t\t\t\t\t\tclassName={column.props.truncate ? 'slds-truncate' : null}\n\t\t\t\t\t\t\t\t\t\tfixedLayout={props.fixedLayout}\n\t\t\t\t\t\t\t\t\t\trowHeader={column.props.primaryColumn}\n\t\t\t\t\t\t\t\t\t\tid={cellId}\n\t\t\t\t\t\t\t\t\t\titem={item}\n\t\t\t\t\t\t\t\t\t\twidth={column.props.width}\n\t\t\t\t\t\t\t\t\t\theaderId={item.headerId}\n\t\t\t\t\t\t\t\t\t\tcolumns={props.columns}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{item[column.props.property]}\n\t\t\t\t\t\t\t\t\t</Cell>\n\t\t\t\t\t\t\t\t</CellContext.Provider>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t})}\n\t\t\t\t\t\t<CellContext.Provider\n\t\t\t\t\t\t\tvalue={{\n\t\t\t\t\t\t\t\tcolumnIndex: props.canSelectRows\n\t\t\t\t\t\t\t\t\t? props.columns.length + 1\n\t\t\t\t\t\t\t\t\t: props.columns.length,\n\t\t\t\t\t\t\t\trowIndex: props.rowIndex,\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{props.rowActions\n\t\t\t\t\t\t\t\t? React.cloneElement(props.rowActions, {\n\t\t\t\t\t\t\t\t\t\tid: `${props.id}-${DATA_TABLE_ROW_ACTIONS}`,\n\t\t\t\t\t\t\t\t\t\titem,\n\t\t\t\t\t\t\t\t\t\tfixedLayout: props.fixedLayout,\n\t\t\t\t\t\t\t\t })\n\t\t\t\t\t\t\t\t: null}\n\t\t\t\t\t\t</CellContext.Provider>\n\t\t\t\t\t</React.Fragment>\n\t\t\t\t),\n\t\t\t\t[\n\t\t\t\t\thandleFocus,\n\t\t\t\t\thandleKeyDown,\n\t\t\t\t\thandleToggle,\n\t\t\t\t\thasFocus,\n\t\t\t\t\tisSelected,\n\t\t\t\t\titem,\n\t\t\t\t\ttabIndex,\n\t\t\t\t\tprops.assistiveText.selectRow,\n\t\t\t\t\tprops.canSelectRows,\n\t\t\t\t\tprops.columns,\n\t\t\t\t\tprops.fixedLayout,\n\t\t\t\t\tprops.id,\n\t\t\t\t\tprops.index,\n\t\t\t\t\tprops.rowActions,\n\t\t\t\t\tprops.rowIndex,\n\t\t\t\t\tprops.stacked,\n\t\t\t\t\tprops.tableId,\n\t\t\t\t\tselectRowCellContext,\n\t\t\t\t]\n\t\t\t)}\n\t\t</tr>\n\t);\n};\n\nDataTableRow.displayName = DATA_TABLE_ROW;\nDataTableRow.propTypes = propTypes;\nexport default DataTableRow;\n"],"file":"row.js"}
|
|
@@ -22,7 +22,7 @@ import EventUtil from '../../utilities/event';
|
|
|
22
22
|
import InteractiveElement from './interactive-element';
|
|
23
23
|
import CellContext from './private/cell-context';
|
|
24
24
|
import TableContext from './private/table-context';
|
|
25
|
-
import
|
|
25
|
+
import useContextHelper from './private/context-helper'; // ## Constants
|
|
26
26
|
|
|
27
27
|
import { DATA_TABLE_ROW_ACTIONS } from '../../utilities/constants';
|
|
28
28
|
var InteractiveDropdown = InteractiveElement(Dropdown);
|
|
@@ -83,11 +83,11 @@ var DataTableRowActions = function DataTableRowActions(props) {
|
|
|
83
83
|
var tableContext = useContext(TableContext);
|
|
84
84
|
var cellContext = useContext(CellContext);
|
|
85
85
|
|
|
86
|
-
var
|
|
87
|
-
tabIndex =
|
|
88
|
-
hasFocus =
|
|
89
|
-
handleFocus =
|
|
90
|
-
handleKeyDown =
|
|
86
|
+
var _useContextHelper = useContextHelper(tableContext, cellContext, props.fixedLayout),
|
|
87
|
+
tabIndex = _useContextHelper.tabIndex,
|
|
88
|
+
hasFocus = _useContextHelper.hasFocus,
|
|
89
|
+
handleFocus = _useContextHelper.handleFocus,
|
|
90
|
+
handleKeyDown = _useContextHelper.handleKeyDown;
|
|
91
91
|
|
|
92
92
|
var handleClick = function handleClick(e) {
|
|
93
93
|
EventUtil.trap(e);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../.tmp-es/components/data-table/row-actions.jsx"],"names":["React","useContext","PropTypes","classNames","isFunction","Dropdown","EventUtil","InteractiveElement","CellContext","TableContext","
|
|
1
|
+
{"version":3,"sources":["../../../.tmp-es/components/data-table/row-actions.jsx"],"names":["React","useContext","PropTypes","classNames","isFunction","Dropdown","EventUtil","InteractiveElement","CellContext","TableContext","useContextHelper","DATA_TABLE_ROW_ACTIONS","InteractiveDropdown","propTypes","assistiveText","object","className","string","id","item","noHint","bool","onAction","func","options","array","dropdown","node","defaultProps","icon","DataTableRowActions","props","tableContext","cellContext","fixedLayout","tabIndex","hasFocus","handleFocus","handleKeyDown","handleClick","e","trap","handleSelect","selection","onSelect","defaultDropdownProps","align","buttonClassName","buttonVariant","iconCategory","iconName","iconSize","iconVariant","hint","dropdownProps","width","ref","focus","displayName"],"mappings":";;;;;;AAAA;;AACA;;AAEA;AAEA;AACA,OAAOA,KAAP,IAAgBC,UAAhB,QAAkC,OAAlC;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB,C,CAEA;;AACA,OAAOC,UAAP,MAAuB,mBAAvB,C,CAEA;;AACA,OAAOC,QAAP,MAAqB,kBAArB,C,CAEA;;AACA,OAAOC,SAAP,MAAsB,uBAAtB;AAEA,OAAOC,kBAAP,MAA+B,uBAA/B;AACA,OAAOC,WAAP,MAAwB,wBAAxB;AACA,OAAOC,YAAP,MAAyB,yBAAzB;AACA,OAAOC,gBAAP,MAA6B,0BAA7B,C,CAEA;;AACA,SAASC,sBAAT,QAAuC,2BAAvC;AAEA,IAAMC,mBAAmB,GAAGL,kBAAkB,CAACF,QAAD,CAA9C;AAEA,IAAMQ,SAAS,GAAG;AACjB;AACD;AACA;AACCC,EAAAA,aAAa,EAAEZ,SAAS,CAACa,MAJR;;AAKjB;AACD;AACA;AACCC,EAAAA,SAAS,EAAEd,SAAS,CAACe,MARJ;;AASjB;AACD;AACA;AACCC,EAAAA,EAAE,EAAEhB,SAAS,CAACe,MAZG;;AAajB;AACD;AACA;AACCE,EAAAA,IAAI,EAAEjB,SAAS,CAACa,MAhBC;;AAiBjB;AACD;AAC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oB,UAAAA,IAAG,CAACC,KAAJ;AACA;AACD,OAXF;AAYC,MAAA,IAAI,EAAE1B,KAAK,CAACG,WAAN,GAAoB,UAApB,GAAiC,IAZxC;AAaC,MAAA,QAAQ,EAAEC;AAbX,oBAgBC,oBAAC,mBAAD,EAAyBmB,aAAzB,CAhBD;AAFD;AAqBA,CAlED;;AAoEAxB,mBAAmB,CAACjB,SAApB,GAAgCA,SAAhC;AACAiB,mBAAmB,CAACF,YAApB,GAAmCA,YAAnC;AACAE,mBAAmB,CAAC4B,WAApB,GAAkC/C,sBAAlC;AACA,eAAemB,mBAAf","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/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */\n\n// ### React\nimport React, { useContext } from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\n\n// ### isFunction\nimport isFunction from 'lodash.isfunction';\n\n// ## Children\nimport Dropdown from '../menu-dropdown';\n\n// ### Event Helpers\nimport EventUtil from '../../utilities/event';\n\nimport InteractiveElement from './interactive-element';\nimport CellContext from './private/cell-context';\nimport TableContext from './private/table-context';\nimport useContextHelper from './private/context-helper';\n\n// ## Constants\nimport { DATA_TABLE_ROW_ACTIONS } from '../../utilities/constants';\n\nconst InteractiveDropdown = InteractiveElement(Dropdown);\n\nconst propTypes = {\n\t/**\n\t * Description of the menu for screenreaders.\n\t */\n\tassistiveText: PropTypes.object,\n\t/**\n\t * Class names to be added to the actions menu.\n\t */\n\tclassName: PropTypes.string,\n\t/**\n\t * HTML ID to be added to the actions menu.\n\t */\n\tid: PropTypes.string,\n\t/**\n\t * `DataTable` row item\n\t */\n\titem: PropTypes.object,\n\t/**\n\t * Disable hint styling which changes the color of the dropdown svg on hover over.\n\t */\n\tnoHint: PropTypes.bool,\n\t/**\n\t * Triggered when an item is selected.\n\t */\n\tonAction: PropTypes.func,\n\t/**\n\t * `Dropdown` options. See `Dropdown`.\n\t */\n\toptions: PropTypes.array,\n\t/**\n\t * A [Dropdown](http://react.lightningdesignsystem.com/components/dropdown-menus/) component. The props from this drop will be merged and override any default props.\n\t * **Note:** onAction will not be overridden, both `DropDown`'s onSelect(dropDownActionOption) and onAction(rowItem, dropdownActionOption) will be called with appropriate parameters\n\t */\n\tdropdown: PropTypes.node,\n};\n\nconst defaultProps = {\n\tassistiveText: { icon: 'Actions' },\n\tnoHint: false,\n\toptions: [],\n};\n\n/**\n * RowActions provide a mechanism for defining a menu to display alongside each row in the DataTable.\n */\nconst DataTableRowActions = (props) => {\n\tconst tableContext = useContext(TableContext);\n\tconst cellContext = useContext(CellContext);\n\tconst { tabIndex, hasFocus, handleFocus, handleKeyDown } = useContextHelper(\n\t\ttableContext,\n\t\tcellContext,\n\t\tprops.fixedLayout\n\t);\n\n\tconst handleClick = (e) => {\n\t\tEventUtil.trap(e);\n\t};\n\n\tconst handleSelect = (selection) => {\n\t\tif (isFunction(props.onAction)) {\n\t\t\tprops.onAction(props.item, selection);\n\t\t}\n\t\tif (props.dropdown && isFunction(props.dropdown.props.onSelect)) {\n\t\t\tprops.dropdown.props.onSelect(selection);\n\t\t}\n\t};\n\n\t// i18n\n\tconst defaultDropdownProps = {\n\t\talign: 'right',\n\t\tbuttonClassName: 'slds-button_icon-x-small',\n\t\tbuttonVariant: 'icon',\n\t\ticonCategory: 'utility',\n\t\ticonName: 'down',\n\t\ticonSize: 'small',\n\t\ticonVariant: 'border-filled',\n\t\tassistiveText: props.assistiveText,\n\t\tclassName: props.className,\n\t\toptions: props.options,\n\t\thint: !props.noHint,\n\t\tid: props.id,\n\t};\n\n\tlet dropdownProps = props.dropdown ? props.dropdown.props : {};\n\tdropdownProps = {\n\t\t...defaultDropdownProps,\n\t\t...dropdownProps,\n\t\tonSelect: handleSelect,\n\t};\n\n\treturn (\n\t\t/* eslint-disable jsx-a11y/no-static-element-interactions */\n\t\t<td\n\t\t\tclassName={classNames({ 'slds-has-focus': hasFocus })}\n\t\t\tdata-label=\"Actions\"\n\t\t\tonClick={handleClick}\n\t\t\tstyle={{ width: '3.25rem' }}\n\t\t\tonFocus={handleFocus}\n\t\t\tonKeyDown={handleKeyDown}\n\t\t\tref={(ref) => {\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\trole={props.fixedLayout ? 'gridcell' : null}\n\t\t\ttabIndex={tabIndex}\n\t\t>\n\t\t\t{/* eslint-enable jsx-a11y/no-static-element-interactions */}\n\t\t\t<InteractiveDropdown {...dropdownProps} />\n\t\t</td>\n\t);\n};\n\nDataTableRowActions.propTypes = propTypes;\nDataTableRowActions.defaultProps = defaultProps;\nDataTableRowActions.displayName = DATA_TABLE_ROW_ACTIONS;\nexport default DataTableRowActions;\n"],"file":"row-actions.js"}
|
|
@@ -340,6 +340,30 @@ exports[`DOM snapshots SLDSIcon Color: Light 1`] = `
|
|
|
340
340
|
</div>
|
|
341
341
|
`;
|
|
342
342
|
|
|
343
|
+
exports[`DOM snapshots SLDSIcon Color: Success 1`] = `
|
|
344
|
+
<div
|
|
345
|
+
className="slds-p-around_medium"
|
|
346
|
+
>
|
|
347
|
+
<span
|
|
348
|
+
title="description of icon"
|
|
349
|
+
>
|
|
350
|
+
<svg
|
|
351
|
+
aria-hidden="true"
|
|
352
|
+
className="slds-icon slds-icon-text-success"
|
|
353
|
+
>
|
|
354
|
+
<use
|
|
355
|
+
href="/assets/icons/utility-sprite/svg/symbols.svg#announcement"
|
|
356
|
+
/>
|
|
357
|
+
</svg>
|
|
358
|
+
<span
|
|
359
|
+
className="slds-assistive-text"
|
|
360
|
+
>
|
|
361
|
+
Description of icon
|
|
362
|
+
</span>
|
|
363
|
+
</span>
|
|
364
|
+
</div>
|
|
365
|
+
`;
|
|
366
|
+
|
|
343
367
|
exports[`DOM snapshots SLDSIcon Color: Warning 1`] = `
|
|
344
368
|
<div
|
|
345
369
|
className="slds-p-around_medium"
|
|
@@ -544,6 +568,25 @@ exports[`DOM snapshots SLDSIcon Docs site Colors 1`] = `
|
|
|
544
568
|
</span>
|
|
545
569
|
</span>
|
|
546
570
|
</div>
|
|
571
|
+
<div
|
|
572
|
+
className="slds-col_padded"
|
|
573
|
+
>
|
|
574
|
+
<span>
|
|
575
|
+
<svg
|
|
576
|
+
aria-hidden="true"
|
|
577
|
+
className="slds-icon slds-icon-text-success"
|
|
578
|
+
>
|
|
579
|
+
<use
|
|
580
|
+
href="/assets/icons/utility-sprite/svg/symbols.svg#success"
|
|
581
|
+
/>
|
|
582
|
+
</svg>
|
|
583
|
+
<span
|
|
584
|
+
className="slds-assistive-text"
|
|
585
|
+
>
|
|
586
|
+
Success
|
|
587
|
+
</span>
|
|
588
|
+
</span>
|
|
589
|
+
</div>
|
|
547
590
|
<div
|
|
548
591
|
className="slds-col_padded"
|
|
549
592
|
>
|
|
@@ -572,10 +615,14 @@ exports[`DOM snapshots SLDSIcon Docs site Colors 1`] = `
|
|
|
572
615
|
className="slds-icon slds-icon-text-error"
|
|
573
616
|
>
|
|
574
617
|
<use
|
|
575
|
-
href="/assets/icons/utility-sprite/svg/symbols.svg#
|
|
618
|
+
href="/assets/icons/utility-sprite/svg/symbols.svg#error"
|
|
576
619
|
/>
|
|
577
620
|
</svg>
|
|
578
|
-
|
|
621
|
+
<span
|
|
622
|
+
className="slds-assistive-text"
|
|
623
|
+
>
|
|
624
|
+
Warning
|
|
625
|
+
</span>
|
|
579
626
|
</span>
|
|
580
627
|
</div>
|
|
581
628
|
</div>
|
|
@@ -12,6 +12,7 @@ import Custom from '../__examples__/custom';
|
|
|
12
12
|
import ExternalPath from '../__examples__/external-path';
|
|
13
13
|
import ColorBase from '../__examples__/color-base';
|
|
14
14
|
import ColorDefault from '../__examples__/color-default';
|
|
15
|
+
import ColorSuccess from '../__examples__/color-success';
|
|
15
16
|
import ColorError from '../__examples__/color-error';
|
|
16
17
|
import ColorWarning from '../__examples__/color-warning';
|
|
17
18
|
import ColorLight from '../__examples__/color-light';
|
|
@@ -75,6 +76,8 @@ storiesOf(ICON, module).addDecorator(function (getStory) {
|
|
|
75
76
|
}, /*#__PURE__*/React.createElement(ColorBase, null));
|
|
76
77
|
}).add('Color: Default', function () {
|
|
77
78
|
return /*#__PURE__*/React.createElement(ColorDefault, null);
|
|
79
|
+
}).add('Color: Success', function () {
|
|
80
|
+
return /*#__PURE__*/React.createElement(ColorSuccess, null);
|
|
78
81
|
}).add('Color: Error', function () {
|
|
79
82
|
return /*#__PURE__*/React.createElement(ColorError, null);
|
|
80
83
|
}).add('Color: Warning', function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../.tmp-es/components/icon/__docs__/storybook-stories.jsx"],"names":["React","storiesOf","ICON","Icon","IconSettings","download","Standard","Utility","Action","Doctype","Custom","ExternalPath","ColorBase","ColorDefault","ColorError","ColorWarning","ColorLight","SizesExtraSmall","SizesSmall","SizesMedium","SizesLarge","Categories","Colors","Sizes","UNSAFE_DirectionSettings","ProductThemes","makeRtl","component","module","addDecorator","getStory","add","backgroundColor","padding","label","fill"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,IAAT,QAAqB,8BAArB;AACA,OAAOC,IAAP,MAAiB,YAAjB;AACA,OAAOC,YAAP,MAAyB,qBAAzB;AACA,OAAOC,QAAP,MAAqB,iCAArB;AACA,OAAOC,QAAP,MAAqB,0BAArB;AACA,OAAOC,OAAP,MAAoB,yBAApB;AACA,OAAOC,MAAP,MAAmB,wBAAnB;AACA,OAAOC,OAAP,MAAoB,yBAApB;AACA,OAAOC,MAAP,MAAmB,wBAAnB;AACA,OAAOC,YAAP,MAAyB,+BAAzB;AACA,OAAOC,SAAP,MAAsB,4BAAtB;AACA,OAAOC,YAAP,MAAyB,+BAAzB;AACA,OAAOC,UAAP,MAAuB,6BAAvB;AACA,OAAOC,YAAP,MAAyB,+BAAzB;AACA,OAAOC,UAAP,MAAuB,6BAAvB;AACA,OAAOC,eAAP,MAA4B,mCAA5B;AACA,OAAOC,UAAP,MAAuB,6BAAvB;AACA,OAAOC,WAAP,MAAwB,8BAAxB;AACA,OAAOC,UAAP,MAAuB,6BAAvB;AACA,OAAOC,UAAP,MAAuB,4BAAvB;AACA,OAAOC,MAAP,MAAmB,wBAAnB;AACA,OAAOC,KAAP,MAAkB,uBAAlB,C,CACA;;AACA,OAAOC,wBAAP,MAAqC,kCAArC;AACA,OAAOC,aAAP,MAA0B,oCAA1B;;AAEA,IAAMC,OAAO,GAAG,SAAVA,OAAU,CAACC,SAAD;AAAA;AAAA;AACf;AACA,wBAAC,wBAAD,CAA0B,QAA1B;AAAmC,MAAA,KAAK,EAAC;AAAzC,oBACC;AAAK,MAAA,GAAG,EAAC;AAAT,OAAgBA,SAAhB,CADD;AAFe;AAAA,CAAhB;;
|
|
1
|
+
{"version":3,"sources":["../../../../.tmp-es/components/icon/__docs__/storybook-stories.jsx"],"names":["React","storiesOf","ICON","Icon","IconSettings","download","Standard","Utility","Action","Doctype","Custom","ExternalPath","ColorBase","ColorDefault","ColorSuccess","ColorError","ColorWarning","ColorLight","SizesExtraSmall","SizesSmall","SizesMedium","SizesLarge","Categories","Colors","Sizes","UNSAFE_DirectionSettings","ProductThemes","makeRtl","component","module","addDecorator","getStory","add","backgroundColor","padding","label","fill"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,IAAT,QAAqB,8BAArB;AACA,OAAOC,IAAP,MAAiB,YAAjB;AACA,OAAOC,YAAP,MAAyB,qBAAzB;AACA,OAAOC,QAAP,MAAqB,iCAArB;AACA,OAAOC,QAAP,MAAqB,0BAArB;AACA,OAAOC,OAAP,MAAoB,yBAApB;AACA,OAAOC,MAAP,MAAmB,wBAAnB;AACA,OAAOC,OAAP,MAAoB,yBAApB;AACA,OAAOC,MAAP,MAAmB,wBAAnB;AACA,OAAOC,Y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A,GAhCF,CAgCM,gCAhCN,EAgCwC;AAAA,sBACtC,oBAAC,IAAD;AACC,IAAA,aAAa,EAAE;AACdG,MAAAA,KAAK,EAAE;AADO,KADhB;AAIC,IAAA,QAAQ,EAAC,UAJV;AAKC,IAAA,IAAI,EAAC,SALN;AAMC,IAAA,KAAK,EAAE;AACNF,MAAAA,eAAe,EAAE,SADX;AAENG,MAAAA,IAAI,EAAE;AAFA,KANR;AAUC,IAAA,KAAK,EAAC;AAVP,IADsC;AAAA,CAhCxC,EA8CEJ,GA9CF,CA8CM,gBA9CN,EA8CwB;AAAA,sBACtB,oBAAC,IAAD;AACC,IAAA,aAAa,EAAE;AACdG,MAAAA,KAAK,EAAE;AADO,KADhB;AAIC,IAAA,QAAQ,EAAC,SAJV;AAKC,IAAA,IAAI,EAAE9B;AALP,IADsB;AAAA,CA9CxB,EAuDE2B,GAvDF,CAuDM,gBAvDN,EAuDwB;AAAA,sBAAM,oBAAC,aAAD,OAAN;AAAA,CAvDxB,EAwDEA,GAxDF,CAwDM,sBAxDN,EAwD8B;AAAA,sBAAM,oBAAC,UAAD,OAAN;AAAA,CAxD9B,EAyDEA,GAzDF,CAyDM,kBAzDN,EAyD0B;AAAA,sBAAM,oBAAC,MAAD,OAAN;AAAA,CAzD1B,EA0DEA,GA1DF,CA0DM,iBA1DN,EA0DyB;AAAA,sBAAM,oBAAC,KAAD,OAAN;AAAA,CA1DzB","sourcesContent":["import React from 'react';\nimport { storiesOf } from '@storybook/react';\nimport { ICON } from '../../../utilities/constants';\nimport Icon from '../../icon';\nimport IconSettings from '../../icon-settings';\nimport download from '../../../icons/utility/download';\nimport Standard from '../__examples__/standard';\nimport Utility from '../__examples__/utility';\nimport Action from '../__examples__/action';\nimport Doctype from '../__examples__/doctype';\nimport Custom from '../__examples__/custom';\nimport ExternalPath from '../__examples__/external-path';\nimport ColorBase from '../__examples__/color-base';\nimport ColorDefault from '../__examples__/color-default';\nimport ColorSuccess from '../__examples__/color-success';\nimport ColorError from '../__examples__/color-error';\nimport ColorWarning from '../__examples__/color-warning';\nimport ColorLight from '../__examples__/color-light';\nimport SizesExtraSmall from '../__examples__/sizes-extra-small';\nimport SizesSmall from '../__examples__/sizes-small';\nimport SizesMedium from '../__examples__/sizes-medium';\nimport SizesLarge from '../__examples__/sizes-large';\nimport Categories from '../__examples__/categories';\nimport Colors from '../__examples__/colors';\nimport Sizes from '../__examples__/sizes';\n// eslint-disable-next-line camelcase\nimport UNSAFE_DirectionSettings from '../../utilities/UNSAFE_direction';\nimport ProductThemes from '../__examples__/product-themes.jsx';\n\nconst makeRtl = (component) => (\n\t// eslint-disable-next-line\n\t<UNSAFE_DirectionSettings.Provider value=\"rtl\">\n\t\t<div dir=\"rtl\">{component}</div>\n\t</UNSAFE_DirectionSettings.Provider>\n);\n\nstoriesOf(ICON, module)\n\t.addDecorator((getStory) => (\n\t\t<div className=\"slds-p-around_medium\">\n\t\t\t<IconSettings iconPath=\"/assets/icons\">{getStory()}</IconSettings>\n\t\t</div>\n\t))\n\t.add('Category: Standard', () => <Standard />)\n\t.add('Category: Standard - Right to Left (RTL)', () => makeRtl(<Standard />))\n\t.add('Category: Utility', () => <Utility />)\n\t.add('Category: Action', () => <Action />)\n\t.add('Category: Doctype', () => <Doctype />)\n\t.add('Category: Custom', () => <Custom />)\n\t.add('Category: External Path', () => <ExternalPath />)\n\t.add('Size: X-Small', () => <SizesExtraSmall />)\n\t.add('Size: Small', () => <SizesSmall />)\n\t.add('Size: Medium (default)', () => <SizesMedium />)\n\t.add('Size: Large', () => <SizesLarge />)\n\t.add('Color: Base', () => (\n\t\t<div\n\t\t\tstyle={{\n\t\t\t\tbackgroundColor: 'goldenrod',\n\t\t\t\tpadding: '10px',\n\t\t\t}}\n\t\t>\n\t\t\t<ColorBase />\n\t\t</div>\n\t))\n\t.add('Color: Default', () => <ColorDefault />)\n\t.add('Color: Success', () => <ColorSuccess />)\n\t.add('Color: Error', () => <ColorError />)\n\t.add('Color: Warning', () => <ColorWarning />)\n\t.add('Color: Light', () => <ColorLight />)\n\t.add('Base: Standard (custom styles)', () => (\n\t\t<Icon\n\t\t\tassistiveText={{\n\t\t\t\tlabel: 'Account',\n\t\t\t}}\n\t\t\tcategory=\"standard\"\n\t\t\tname=\"account\"\n\t\t\tstyle={{\n\t\t\t\tbackgroundColor: '#aceace',\n\t\t\t\tfill: 'orangered',\n\t\t\t}}\n\t\t\ttitle=\"This is a title\"\n\t\t/>\n\t))\n\t.add('Base: Imported', () => (\n\t\t<Icon\n\t\t\tassistiveText={{\n\t\t\t\tlabel: 'Download',\n\t\t\t}}\n\t\t\tcategory=\"utility\"\n\t\t\ticon={download}\n\t\t/>\n\t))\n\t.add('Product Themes', () => <ProductThemes />)\n\t.add('Docs site Categories', () => <Categories />)\n\t.add('Docs site Colors', () => <Colors />)\n\t.add('Docs site Sizes', () => <Sizes />);\n"],"file":"storybook-stories.js"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
2
|
+
|
|
3
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4
|
+
|
|
5
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
6
|
+
|
|
7
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
8
|
+
|
|
9
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
10
|
+
|
|
11
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
12
|
+
|
|
13
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
14
|
+
|
|
15
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
16
|
+
|
|
17
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
18
|
+
|
|
19
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
20
|
+
|
|
21
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
22
|
+
|
|
23
|
+
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; }
|
|
24
|
+
|
|
25
|
+
import React from 'react';
|
|
26
|
+
import Icon from "../../../../components/icon"; // `~` is replaced with design-system-react at runtime
|
|
27
|
+
|
|
28
|
+
import IconSettings from "../../../../components/icon-settings";
|
|
29
|
+
|
|
30
|
+
var Example = /*#__PURE__*/function (_React$Component) {
|
|
31
|
+
_inherits(Example, _React$Component);
|
|
32
|
+
|
|
33
|
+
var _super = _createSuper(Example);
|
|
34
|
+
|
|
35
|
+
function Example() {
|
|
36
|
+
_classCallCheck(this, Example);
|
|
37
|
+
|
|
38
|
+
return _super.apply(this, arguments);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
_createClass(Example, [{
|
|
42
|
+
key: "render",
|
|
43
|
+
value: function render() {
|
|
44
|
+
return /*#__PURE__*/React.createElement(IconSettings, {
|
|
45
|
+
iconPath: "/assets/icons"
|
|
46
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
47
|
+
assistiveText: {
|
|
48
|
+
label: 'Description of icon'
|
|
49
|
+
},
|
|
50
|
+
category: "utility",
|
|
51
|
+
colorVariant: "success",
|
|
52
|
+
name: "announcement",
|
|
53
|
+
title: "description of icon"
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
}]);
|
|
57
|
+
|
|
58
|
+
return Example;
|
|
59
|
+
}(React.Component);
|
|
60
|
+
|
|
61
|
+
_defineProperty(Example, "displayName", 'IconExample');
|
|
62
|
+
|
|
63
|
+
export default Example; // export is replaced with `ReactDOM.render(<Example />, mountNode);` at runtime
|
|
64
|
+
//# sourceMappingURL=color-success.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../.tmp-es/components/icon/__examples__/color-success.jsx"],"names":["React","Icon","IconSettings","Example","label","Component"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAEA,OAAOC,IAAP,MAAiB,6BAAjB,C,CAAsC;;AACtC,OAAOC,YAAP,MAAyB,sCAAzB;;IAEMC,O;;;;;;;;;;;;;WAGL,kBAAS;AACR,0BACC,oBAAC,YAAD;AAAc,QAAA,QAAQ,EAAC;AAAvB,sBACC,oBAAC,IAAD;AACC,QAAA,aAAa,EAAE;AAAEC,UAAAA,KAAK,EAAE;AAAT,SADhB;AAEC,QAAA,QAAQ,EAAC,SAFV;AAGC,QAAA,YAAY,EAAC,SAHd;AAIC,QAAA,IAAI,EAAC,cAJN;AAKC,QAAA,KAAK,EAAC;AALP,QADD,CADD;AAWA;;;;EAfoBJ,KAAK,CAACK,S;;gBAAtBF,O,iBACgB,a;;AAiBtB,eAAeA,OAAf,C,CAAwB","sourcesContent":["import React from 'react';\n\nimport Icon from '~/components/icon'; // `~` is replaced with design-system-react at runtime\nimport IconSettings from '~/components/icon-settings';\n\nclass Example extends React.Component {\n\tstatic displayName = 'IconExample';\n\n\trender() {\n\t\treturn (\n\t\t\t<IconSettings iconPath=\"/assets/icons\">\n\t\t\t\t<Icon\n\t\t\t\t\tassistiveText={{ label: 'Description of icon' }}\n\t\t\t\t\tcategory=\"utility\"\n\t\t\t\t\tcolorVariant=\"success\"\n\t\t\t\t\tname=\"announcement\"\n\t\t\t\t\ttitle=\"description of icon\"\n\t\t\t\t/>\n\t\t\t</IconSettings>\n\t\t);\n\t}\n}\n\nexport default Example; // export is replaced with `ReactDOM.render(<Example />, mountNode);` at runtime\n"],"file":"color-success.js"}
|
|
@@ -73,6 +73,15 @@ var Example = /*#__PURE__*/function (_React$Component) {
|
|
|
73
73
|
name: "lock"
|
|
74
74
|
})), /*#__PURE__*/React.createElement("div", {
|
|
75
75
|
className: "slds-col_padded"
|
|
76
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
77
|
+
assistiveText: {
|
|
78
|
+
label: 'Success'
|
|
79
|
+
},
|
|
80
|
+
category: "utility",
|
|
81
|
+
colorVariant: "success",
|
|
82
|
+
name: "success"
|
|
83
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
84
|
+
className: "slds-col_padded"
|
|
76
85
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
77
86
|
assistiveText: {
|
|
78
87
|
label: 'Warning'
|
|
@@ -84,11 +93,11 @@ var Example = /*#__PURE__*/function (_React$Component) {
|
|
|
84
93
|
className: "slds-col_padded"
|
|
85
94
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
86
95
|
assistiveText: {
|
|
87
|
-
|
|
96
|
+
label: 'Warning'
|
|
88
97
|
},
|
|
89
98
|
category: "utility",
|
|
90
99
|
colorVariant: "error",
|
|
91
|
-
name: "
|
|
100
|
+
name: "error"
|
|
92
101
|
}))));
|
|
93
102
|
}
|
|
94
103
|
}]);
|