@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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */
|
|
3
3
|
|
|
4
4
|
// ### React
|
|
5
|
-
import React, { useContext } from 'react';
|
|
5
|
+
import React, { useCallback, useContext, useMemo } from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
|
|
8
8
|
// ### classNames
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
import InteractiveElement from '../interactive-element';
|
|
26
26
|
import CellContext from '../private/cell-context';
|
|
27
27
|
import TableContext from '../private/table-context';
|
|
28
|
-
import
|
|
28
|
+
import useContextHelper from './context-helper';
|
|
29
29
|
|
|
30
30
|
const InteractiveCheckbox = InteractiveElement(Checkbox);
|
|
31
31
|
const InteractiveRadio = InteractiveElement(Radio);
|
|
@@ -67,25 +67,34 @@ const propTypes = {
|
|
|
67
67
|
*/
|
|
68
68
|
const DataTableRow = (props) => {
|
|
69
69
|
const tableContext = useContext(TableContext);
|
|
70
|
-
const selectRowCellContext =
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
const selectRowCellContext = useMemo(
|
|
71
|
+
() => ({
|
|
72
|
+
rowIndex: props.rowIndex,
|
|
73
|
+
columnIndex: 0,
|
|
74
|
+
}),
|
|
75
|
+
[props.rowIndex]
|
|
76
|
+
);
|
|
77
|
+
const { tabIndex, hasFocus, handleFocus, handleKeyDown } = useContextHelper(
|
|
75
78
|
tableContext,
|
|
76
79
|
selectRowCellContext,
|
|
77
80
|
props.fixedLayout
|
|
78
81
|
);
|
|
79
82
|
|
|
80
|
-
const
|
|
81
|
-
|
|
83
|
+
const { item, onToggle } = props;
|
|
84
|
+
const handleToggle = useCallback(
|
|
85
|
+
(e, { checked }) => onToggle(item, checked, e),
|
|
86
|
+
[item, onToggle]
|
|
87
|
+
);
|
|
82
88
|
|
|
83
|
-
const
|
|
84
|
-
const
|
|
89
|
+
const isSelected = !!find(props.selection, item);
|
|
90
|
+
const ariaProps = useMemo(() => {
|
|
91
|
+
const result = {};
|
|
85
92
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
93
|
+
if (props.canSelectRows) {
|
|
94
|
+
result['aria-selected'] = isSelected ? 'true' : 'false';
|
|
95
|
+
}
|
|
96
|
+
return result;
|
|
97
|
+
}, [isSelected, props.canSelectRows]);
|
|
89
98
|
|
|
90
99
|
// i18n
|
|
91
100
|
return (
|
|
@@ -97,100 +106,126 @@ const DataTableRow = (props) => {
|
|
|
97
106
|
'slds-has-focus': hasFocus,
|
|
98
107
|
})}
|
|
99
108
|
>
|
|
100
|
-
{
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
<CellContext.Provider value={selectRowCellContext}>
|
|
117
|
-
{props.canSelectRows === 'radio' ? (
|
|
118
|
-
<InteractiveRadio
|
|
119
|
-
assistiveText={{
|
|
120
|
-
label: `${props.assistiveText.selectRow} ${
|
|
121
|
-
Number(props.index) + 1
|
|
122
|
-
}`,
|
|
109
|
+
{useMemo(
|
|
110
|
+
() => (
|
|
111
|
+
<React.Fragment>
|
|
112
|
+
{props.canSelectRows ? (
|
|
113
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
|
114
|
+
<td
|
|
115
|
+
role={props.fixedLayout ? 'gridcell' : null}
|
|
116
|
+
className="slds-text-align_right"
|
|
117
|
+
data-label={props.stacked ? 'Select Row' : undefined}
|
|
118
|
+
style={{ width: '3.25rem' }}
|
|
119
|
+
onFocus={handleFocus}
|
|
120
|
+
onKeyDown={handleKeyDown}
|
|
121
|
+
ref={(ref) => {
|
|
122
|
+
if (ref && hasFocus) {
|
|
123
|
+
ref.focus();
|
|
124
|
+
}
|
|
123
125
|
}}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
126
|
+
tabIndex={tabIndex}
|
|
127
|
+
>
|
|
128
|
+
<CellContext.Provider value={selectRowCellContext}>
|
|
129
|
+
{props.canSelectRows === 'radio' ? (
|
|
130
|
+
<InteractiveRadio
|
|
131
|
+
assistiveText={{
|
|
132
|
+
label: `${props.assistiveText.selectRow} ${
|
|
133
|
+
Number(props.index) + 1
|
|
134
|
+
}`,
|
|
135
|
+
}}
|
|
136
|
+
aria-labelledby={`${props.id}-SelectRow-label ${props.tableId}-SLDSDataTableHead-column-group-header-row-select`}
|
|
137
|
+
checked={isSelected}
|
|
138
|
+
className="slds-m-right_x-small"
|
|
139
|
+
id={`${props.id}-SelectRow`}
|
|
140
|
+
labelId={`${props.id}-SelectRow-label`}
|
|
141
|
+
name={`${props.tableId}-SelectRow`}
|
|
142
|
+
onChange={handleToggle}
|
|
143
|
+
/>
|
|
144
|
+
) : (
|
|
145
|
+
<InteractiveCheckbox
|
|
146
|
+
assistiveText={{
|
|
147
|
+
label: `${props.assistiveText.selectRow} ${
|
|
148
|
+
Number(props.index) + 1
|
|
149
|
+
}`,
|
|
150
|
+
}}
|
|
151
|
+
aria-labelledby={`${props.id}-SelectRow-label ${props.tableId}-SLDSDataTableHead-column-group-header-row-select`}
|
|
152
|
+
checked={isSelected}
|
|
153
|
+
id={`${props.id}-SelectRow`}
|
|
154
|
+
labelId={`${props.id}-SelectRow-label`}
|
|
155
|
+
name={`SelectRow${props.index + 1}`}
|
|
156
|
+
onChange={handleToggle}
|
|
157
|
+
/>
|
|
158
|
+
)}
|
|
159
|
+
</CellContext.Provider>
|
|
160
|
+
</td>
|
|
161
|
+
) : null}
|
|
162
|
+
{props.columns.map((column, index) => {
|
|
163
|
+
const { Cell } = column;
|
|
164
|
+
const cellId = `${props.id}-${DATA_TABLE_CELL}-${column.props.property}`;
|
|
153
165
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
166
|
+
return (
|
|
167
|
+
<CellContext.Provider
|
|
168
|
+
key={cellId}
|
|
169
|
+
value={{
|
|
170
|
+
columnIndex: props.canSelectRows ? index + 1 : index,
|
|
171
|
+
rowIndex: props.rowIndex,
|
|
172
|
+
}}
|
|
173
|
+
>
|
|
174
|
+
<Cell
|
|
175
|
+
{...column.props}
|
|
176
|
+
className={column.props.truncate ? 'slds-truncate' : null}
|
|
177
|
+
fixedLayout={props.fixedLayout}
|
|
178
|
+
rowHeader={column.props.primaryColumn}
|
|
179
|
+
id={cellId}
|
|
180
|
+
item={item}
|
|
181
|
+
width={column.props.width}
|
|
182
|
+
headerId={item.headerId}
|
|
183
|
+
columns={props.columns}
|
|
184
|
+
>
|
|
185
|
+
{item[column.props.property]}
|
|
186
|
+
</Cell>
|
|
187
|
+
</CellContext.Provider>
|
|
188
|
+
);
|
|
189
|
+
})}
|
|
190
|
+
<CellContext.Provider
|
|
191
|
+
value={{
|
|
192
|
+
columnIndex: props.canSelectRows
|
|
193
|
+
? props.columns.length + 1
|
|
194
|
+
: props.columns.length,
|
|
195
|
+
rowIndex: props.rowIndex,
|
|
196
|
+
}}
|
|
172
197
|
>
|
|
173
|
-
{props.
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
198
|
+
{props.rowActions
|
|
199
|
+
? React.cloneElement(props.rowActions, {
|
|
200
|
+
id: `${props.id}-${DATA_TABLE_ROW_ACTIONS}`,
|
|
201
|
+
item,
|
|
202
|
+
fixedLayout: props.fixedLayout,
|
|
203
|
+
})
|
|
204
|
+
: null}
|
|
205
|
+
</CellContext.Provider>
|
|
206
|
+
</React.Fragment>
|
|
207
|
+
),
|
|
208
|
+
[
|
|
209
|
+
handleFocus,
|
|
210
|
+
handleKeyDown,
|
|
211
|
+
handleToggle,
|
|
212
|
+
hasFocus,
|
|
213
|
+
isSelected,
|
|
214
|
+
item,
|
|
215
|
+
tabIndex,
|
|
216
|
+
props.assistiveText.selectRow,
|
|
217
|
+
props.canSelectRows,
|
|
218
|
+
props.columns,
|
|
219
|
+
props.fixedLayout,
|
|
220
|
+
props.id,
|
|
221
|
+
props.index,
|
|
222
|
+
props.rowActions,
|
|
223
|
+
props.rowIndex,
|
|
224
|
+
props.stacked,
|
|
225
|
+
props.tableId,
|
|
226
|
+
selectRowCellContext,
|
|
227
|
+
]
|
|
228
|
+
)}
|
|
194
229
|
</tr>
|
|
195
230
|
);
|
|
196
231
|
};
|
|
@@ -20,7 +20,7 @@ import EventUtil from '../../utilities/event';
|
|
|
20
20
|
import InteractiveElement from './interactive-element';
|
|
21
21
|
import CellContext from './private/cell-context';
|
|
22
22
|
import TableContext from './private/table-context';
|
|
23
|
-
import
|
|
23
|
+
import useContextHelper from './private/context-helper';
|
|
24
24
|
|
|
25
25
|
// ## Constants
|
|
26
26
|
import { DATA_TABLE_ROW_ACTIONS } from '../../utilities/constants';
|
|
@@ -75,7 +75,7 @@ const defaultProps = {
|
|
|
75
75
|
const DataTableRowActions = (props) => {
|
|
76
76
|
const tableContext = useContext(TableContext);
|
|
77
77
|
const cellContext = useContext(CellContext);
|
|
78
|
-
const { tabIndex, hasFocus, handleFocus, handleKeyDown } =
|
|
78
|
+
const { tabIndex, hasFocus, handleFocus, handleKeyDown } = useContextHelper(
|
|
79
79
|
tableContext,
|
|
80
80
|
cellContext,
|
|
81
81
|
props.fixedLayout
|
|
@@ -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';
|
|
@@ -61,6 +62,7 @@ storiesOf(ICON, module)
|
|
|
61
62
|
</div>
|
|
62
63
|
))
|
|
63
64
|
.add('Color: Default', () => <ColorDefault />)
|
|
65
|
+
.add('Color: Success', () => <ColorSuccess />)
|
|
64
66
|
.add('Color: Error', () => <ColorError />)
|
|
65
67
|
.add('Color: Warning', () => <ColorWarning />)
|
|
66
68
|
.add('Color: Light', () => <ColorLight />)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import Icon from '~/components/icon'; // `~` is replaced with design-system-react at runtime
|
|
4
|
+
import IconSettings from '~/components/icon-settings';
|
|
5
|
+
|
|
6
|
+
class Example extends React.Component {
|
|
7
|
+
static displayName = 'IconExample';
|
|
8
|
+
|
|
9
|
+
render() {
|
|
10
|
+
return (
|
|
11
|
+
<IconSettings iconPath="/assets/icons">
|
|
12
|
+
<Icon
|
|
13
|
+
assistiveText={{ label: 'Description of icon' }}
|
|
14
|
+
category="utility"
|
|
15
|
+
colorVariant="success"
|
|
16
|
+
name="announcement"
|
|
17
|
+
title="description of icon"
|
|
18
|
+
/>
|
|
19
|
+
</IconSettings>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default Example; // export is replaced with `ReactDOM.render(<Example />, mountNode);` at runtime
|
|
@@ -34,6 +34,14 @@ class Example extends React.Component {
|
|
|
34
34
|
name="lock"
|
|
35
35
|
/>
|
|
36
36
|
</div>
|
|
37
|
+
<div className="slds-col_padded">
|
|
38
|
+
<Icon
|
|
39
|
+
assistiveText={{ label: 'Success' }}
|
|
40
|
+
category="utility"
|
|
41
|
+
colorVariant="success"
|
|
42
|
+
name="success"
|
|
43
|
+
/>
|
|
44
|
+
</div>
|
|
37
45
|
<div className="slds-col_padded">
|
|
38
46
|
<Icon
|
|
39
47
|
assistiveText={{ label: 'Warning' }}
|
|
@@ -44,10 +52,10 @@ class Example extends React.Component {
|
|
|
44
52
|
</div>
|
|
45
53
|
<div className="slds-col_padded">
|
|
46
54
|
<Icon
|
|
47
|
-
assistiveText={{
|
|
55
|
+
assistiveText={{ label: 'Warning' }}
|
|
48
56
|
category="utility"
|
|
49
57
|
colorVariant="error"
|
|
50
|
-
name="
|
|
58
|
+
name="error"
|
|
51
59
|
/>
|
|
52
60
|
</div>
|
|
53
61
|
</div>
|
|
@@ -92,6 +92,7 @@ const Icon = (props) => {
|
|
|
92
92
|
colorVariant === 'default' && category === 'utility'
|
|
93
93
|
? !inverse
|
|
94
94
|
: inverse,
|
|
95
|
+
'slds-icon-text-success': colorVariant === 'success',
|
|
95
96
|
'slds-icon-text-warning': colorVariant === 'warning',
|
|
96
97
|
'slds-icon-text-error': colorVariant === 'error',
|
|
97
98
|
'slds-icon-text-light': colorVariant === 'light',
|
|
@@ -163,6 +164,7 @@ Icon.propTypes = {
|
|
|
163
164
|
'error',
|
|
164
165
|
'light',
|
|
165
166
|
'warning',
|
|
167
|
+
'success',
|
|
166
168
|
]),
|
|
167
169
|
/**
|
|
168
170
|
* A custom SVG object to use instead of the supplied SLDS icons, look in `design-system-react/icons` for examples and syntax.
|
package/components/icon.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ declare module '@salesforce/design-system-react/components/icon' {
|
|
|
33
33
|
/**
|
|
34
34
|
* Icon color variants
|
|
35
35
|
*/
|
|
36
|
-
colorVariant?: 'base' | 'default' | 'error' | 'light' | 'warning';
|
|
36
|
+
colorVariant?: 'base' | 'default' | 'success' | 'error' | 'light' | 'warning';
|
|
37
37
|
/**
|
|
38
38
|
* A custom SVG object to use instead of the supplied SLDS icons, look in `design-system-react/icons` for examples and syntax.
|
|
39
39
|
*/
|
|
@@ -77,10 +77,6 @@ const documentationSiteLiveExamples = {
|
|
|
77
77
|
},
|
|
78
78
|
],
|
|
79
79
|
'brand-band': [
|
|
80
|
-
{
|
|
81
|
-
heading: 'Lightning Blue',
|
|
82
|
-
path: require('raw-loader!@salesforce/design-system-react/components/brand-band/__examples__/lightning-blue-theme.jsx'),
|
|
83
|
-
},
|
|
84
80
|
{
|
|
85
81
|
heading: 'Default',
|
|
86
82
|
path: require('raw-loader!@salesforce/design-system-react/components/brand-band/__examples__/default.jsx'),
|
|
@@ -97,6 +93,14 @@ const documentationSiteLiveExamples = {
|
|
|
97
93
|
heading: 'No Image',
|
|
98
94
|
path: require('raw-loader!@salesforce/design-system-react/components/brand-band/__examples__/no-image.jsx'),
|
|
99
95
|
},
|
|
96
|
+
{
|
|
97
|
+
heading: 'User Image',
|
|
98
|
+
path: require('raw-loader!@salesforce/design-system-react/components/brand-band/__examples__/user-image.jsx'),
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
heading: 'Group Image',
|
|
102
|
+
path: require('raw-loader!@salesforce/design-system-react/components/brand-band/__examples__/group-image.jsx'),
|
|
103
|
+
},
|
|
100
104
|
],
|
|
101
105
|
breadcrumb: [
|
|
102
106
|
{
|