Skip to content

Commit 60a628d

Browse files
authored
feat(popover): add warning and error variants (#3056)
* feat(popover): add warning and error variants chore(popover): fix linter issues * feat(popover): add nubbin colors * chore(popover): add header id * chore(popover): switch to error-dark chore(popover): update snapshots * chore(popover): change colors and padding * feat(popover): add scrollable and flush modifiers * chore(popover): remove tokens and update tests * feat(popover): update scroll and create body classnames chore(popover): switch to current color * feat(popovers): change docked form footer example * feat(popover): add new error popover to data table example chore(popover): update popover tests fix(popover): fix linter issues * fix(popover): change popover id * fix(popover): use correct icon * chore(popover): clean up and update restriction rule * fix(docked-form-footer): edit inline styles
1 parent 0dec41e commit 60a628d

File tree

16 files changed

+585
-77
lines changed

16 files changed

+585
-77
lines changed

ui/components/_index.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@
9292
'popovers/nubbins/index',
9393
'popovers/walkthrough/index',
9494
'popovers/einstein/index',
95+
'popovers/error/index',
96+
'popovers/warning/index',
97+
9598

9699
// Tooltips
97100
'tooltips/base/index',

ui/components/data-tables/index.jsx

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ export const ErrorTd = props => (
573573
}
574574
)}
575575
id={'error-0' + props.index}
576-
symbol="warning"
576+
symbol="ban"
577577
tabIndex={props.actionableMode && props.hasError ? null : '-1'}
578578
title={`Item ${props.index} has errors`}
579579
/>
@@ -920,20 +920,6 @@ export const EditPopover = props => (
920920
</section>
921921
);
922922

923-
/**
924-
* @name ErrorTooltip - Tooltip used to display a row error
925-
* @param {*} props
926-
*/
927-
export const ErrorTooltip = props => (
928-
<Tooltip
929-
className="slds-nubbin_bottom-left slds-theme_error"
930-
id="error-tooltip-01"
931-
style={{ position: 'absolute', top: '-1rem', left: '0', width: 'auto' }}
932-
>
933-
Company encountered an error.
934-
</Tooltip>
935-
);
936-
937923
/**
938924
* @name ProductDataTableTr - Table row for advanced data table components
939925
* @param {*} props

ui/components/data-tables/inline-edit/example.jsx

Lines changed: 57 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@ import {
88
InlineEditTableContainer as Container,
99
AdvancedDataTable as Table,
1010
Thead,
11-
InlineEditTr,
12-
ErrorTooltip
11+
InlineEditTr
1312
} from '../';
1413

14+
import { Popover } from '../../popovers/base/example';
15+
import { FeedbackHeader } from '../../popovers/error/example';
16+
17+
const headingUniqueId = _.uniqueId('dialog-heading-id-');
18+
1519
const columns = [
1620
'Name',
1721
'Account Name',
@@ -52,6 +56,12 @@ const rows = [
5256
}
5357
];
5458

59+
let Demo = props => (
60+
<div className="demo-only" {...props}>
61+
{props.children}
62+
</div>
63+
);
64+
5565
export const InlineEditTable = () => (
5666
<Container>
5767
<Table isEditable style={{ width: '66.75rem' }}>
@@ -348,32 +358,52 @@ export let states = [
348358
id: 'row-error-focused',
349359
label: 'Error indicator - Focused (Actionable mode)',
350360
element: (
351-
<Container>
352-
<Table isEditable style={{ width: '66.75rem' }}>
353-
<Thead
354-
actionableMode
355-
columns={columns}
356-
hasErrorColumn
357-
mainColumnWidth="8.75rem"
358-
/>
359-
<tbody>
360-
{_.times(rows.length, i => (
361-
<InlineEditTr
362-
key={i}
363-
index={i + 1}
364-
{...rows[i]}
365-
actionableMode
366-
focusableCell="error"
367-
focusedCell="error"
368-
showCellError
369-
showRowError
370-
showRowErrorTooltip
361+
<Demo style={{ marginTop: '100px', marginLeft: '10px' }}>
362+
<Container>
363+
<Table isEditable style={{ width: '66.75rem' }}>
364+
<Thead
365+
actionableMode
366+
columns={columns}
367+
hasErrorColumn
368+
mainColumnWidth="8.75rem"
369+
/>
370+
<tbody>
371+
{_.times(rows.length, i => (
372+
<InlineEditTr
373+
key={i}
374+
index={i + 1}
375+
{...rows[i]}
376+
actionableMode
377+
focusableCell="error"
378+
focusedCell="error"
379+
showCellError
380+
showRowError
381+
/>
382+
))}
383+
</tbody>
384+
</Table>
385+
<Popover
386+
className="slds-popover_error slds-nubbin_bottom-left"
387+
headingId={headingUniqueId}
388+
popoverId="error-tooltip-01"
389+
header={
390+
<FeedbackHeader
391+
headingId={headingUniqueId}
392+
title="Resolve error"
393+
symbol="ban"
371394
/>
372-
))}
373-
</tbody>
374-
</Table>
375-
<ErrorTooltip />
376-
</Container>
395+
}
396+
style={{
397+
position: 'absolute',
398+
top: '-56px'
399+
}}
400+
closeButton
401+
inverse
402+
>
403+
<p>Company encountered an error</p>
404+
</Popover>
405+
</Container>
406+
</Demo>
377407
),
378408
script: `
379409
document.getElementById('error-01').focus()

ui/components/docked-form-footer/base/example.jsx

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
import React from 'react';
55
import ButtonIcon from '../../button-icons/';
66
import SvgIcon from '../../../shared/svg-icon';
7+
import { Popover } from '../../popovers/base/example';
8+
import { FeedbackHeader } from '../../popovers/error/example';
9+
import _ from '../../../shared/helpers';
10+
11+
const headingUniqueId = _.uniqueId('dialog-heading-id-');
712

813
export const Context = props => (
914
<div style={{ height: '180px' }}>{props.children}</div>
@@ -27,11 +32,11 @@ export let states = [
2732
element: (
2833
<div className="slds-docked-form-footer">
2934
<ButtonIcon
30-
assistiveText="Review the Following Errors"
35+
assistiveText="Resolve error"
3136
className="slds-button_icon slds-button_icon-error"
3237
iconClassName="slds-button__icon_large"
33-
symbol="warning"
34-
title="Review the Following Errors"
38+
symbol="ban"
39+
title="Resolve error"
3540
/>
3641
<button type="button" className="slds-button slds-button_neutral">
3742
Cancel
@@ -48,48 +53,46 @@ export let states = [
4853
element: (
4954
<div className="slds-docked-form-footer">
5055
<ButtonIcon
51-
assistiveText="Review the Following Errors"
56+
assistiveText="Resolve error"
5257
className="slds-button_icon slds-button_icon-error"
5358
iconClassName="slds-button__icon_large"
54-
symbol="warning"
55-
title="Review the Following Errors"
59+
symbol="ban"
60+
title="Resolve error"
5661
/>
5762
<button type="button" className="slds-button slds-button_neutral">
5863
Cancel
5964
</button>
6065
<button type="button" className="slds-button slds-button_brand">
6166
Save
6267
</button>
63-
<section
64-
className="slds-popover slds-nubbin_bottom-left slds-theme_error"
65-
role="dialog"
66-
aria-label="Contextual title of this dialog"
67-
aria-describedby="dialog-description-01"
68+
<Popover
69+
className="slds-popover_error slds-nubbin_bottom-left"
70+
headingId={headingUniqueId}
71+
header={
72+
<FeedbackHeader
73+
headingId={headingUniqueId}
74+
title="Resolve error"
75+
symbol="ban"
76+
/>
77+
}
78+
closeButton
79+
inverse
6880
style={{
6981
position: 'absolute',
7082
bottom: '56px',
7183
left: '50%',
72-
marginLeft: '66px',
84+
marginLeft: '62px',
7385
transform: 'translateX(-50%)'
7486
}}
7587
>
76-
<ButtonIcon
77-
className="slds-button_icon-inverse slds-button_icon-small slds-float_right slds-popover__close"
78-
symbol="close"
79-
assistiveText="Close"
80-
title="Close"
81-
/>
82-
<div
83-
className="slds-popover__body slds-text-longform"
84-
id="dialog-description-01"
85-
>
86-
<p>
87-
Sit nulla est ex deserunt exercitation anim occaecat. Nostrud
88-
ullamco deserunt aute id consequat veniam incididunt duis in sint
89-
irure nisi.
90-
</p>
91-
</div>
92-
</section>
88+
<p>
89+
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
90+
eiusmod tempor incididunt ut labore et dolore.{' '}
91+
<a href="javascript:void(0);" title="Learn More">
92+
Learn More
93+
</a>
94+
</p>
95+
</Popover>
9396
</div>
9497
)
9598
}

0 commit comments

Comments
 (0)