Skip to content

Commit b67d5f2

Browse files
authored
Merge pull request #140 from prysmex/pv_notification_event
add notification event component
2 parents d32382b + 4aa8da9 commit b67d5f2

File tree

20 files changed

+611
-12
lines changed

20 files changed

+611
-12
lines changed

packages/core/addon/components/eui-accordion/index.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@
4040
{{on "click" this.onToggle}}
4141
>
4242
<span class={{this.buttonContentClasses}}>
43-
{{yield to="buttonContent"}}
43+
{{yield this.isOpen to="buttonContent"}}
4444
</span>
4545
</ButtonElement>
4646
{{#if (and @extraAction (not this.isLoading))}}
4747
<div class="euiAccordion__optionalAction">
48-
{{yield to="extraAction"}}
48+
{{yield this.isOpen to="extraAction"}}
4949
</div>
5050
{{else if this.isLoading}}
5151
<div class="euiAccordion__optionalAction">

packages/core/addon/components/eui-code-block/controls/index.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
{{/if}}
1212

1313
{{#if @showCopyButton}}
14-
<div className="euiCodeBlock__copyButton">
14+
<div class="euiCodeBlock__copyButton">
1515
<EuiCopy @textToCopy={{@textToCopy}} @afterMessage="Copied" as |copy|>
1616
<EuiButtonIcon
1717
{{on "click" copy}}

packages/core/addon/components/eui-loading-logo/index.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
)
99
}}
1010
>
11-
<span className="euiLoadingLogo__icon">
11+
<span class="euiLoadingLogo__icon">
1212
<EuiIcon @type={{arg-or-default @logo "logoKibana"}} @size={{arg-or-default @size "m"}} />
1313
</span>
1414
</span>
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<div
2+
class="euiNotificationEventMessages"
3+
...attributes
4+
>
5+
{{#let
6+
(object-at 0 @messages)
7+
(without (object-at 0 @messages) @messages)
8+
as |first rest|}}
9+
10+
{{#if first}}
11+
<EuiText @size="s" @color="subdued">
12+
<p>{{first}}</p>
13+
</EuiText>
14+
{{/if}}
15+
16+
{{#if rest}}
17+
18+
<EuiAccordion
19+
{{!-- onToggle={{@onToggle}} --}}
20+
{{!-- @buttonProps={{hash
21+
aria-label = accordionAriaLabelButtonText
22+
}} --}}
23+
id={{concat 'euiNotificationEventMessagesAccordion' (unique-id)}}
24+
class="euiNotificationEventMessages__accordion"
25+
@buttonClassName="euiNotificationEventMessages__accordionButton"
26+
@arrowDisplay="none"
27+
>
28+
<:buttonContent as |isOpen|>
29+
{{@accordionButtonText}}
30+
{{#unless isOpen}}
31+
({{@accordionHideText}})
32+
{{/unless}}
33+
</:buttonContent>
34+
35+
<:content>
36+
<div class="euiNotificationEventMessages__accordionContent">
37+
{{#each rest as |msg|}}
38+
<EuiText @size="s" @color="subdued">
39+
<p>{{msg}}</p>
40+
</EuiText>
41+
{{/each}}
42+
</div>
43+
</:content>
44+
45+
</EuiAccordion>
46+
{{/if}}
47+
48+
{{/let}}
49+
</div>
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<div
2+
class={{class-names
3+
'euiNotificationEventMeta'
4+
(if @hasContextMenu 'euiNotificationEventMeta--hasContextMenu')
5+
}}
6+
...attributes
7+
>
8+
<div class="euiNotificationEventMeta__section">
9+
10+
{{#if @iconType}}
11+
<EuiIcon
12+
@iconClasses="euiNotificationEventMeta__icon"
13+
@type={{@iconType}}
14+
{{!-- TODO only add one of the following html attributes --}}
15+
aria-label={{@iconAriaLabel}}
16+
aria-hidden={{if @iconAriaLabel false true}}
17+
/>
18+
{{/if}}
19+
20+
{{#if @type}}
21+
<EuiBadge
22+
class="euiNotificationEventMeta__badge"
23+
@color={{@badgeColor}}
24+
>
25+
{{#if @severity}}
26+
{{@type}}: {{@severity}}
27+
{{else}}
28+
{{@type}}
29+
{{/if}}
30+
</EuiBadge>
31+
{{/if}}
32+
33+
</div>
34+
35+
<div class="euiNotificationEventMeta__section">
36+
<span class="euiNotificationEventMeta__time">{{@time}}</span>
37+
</div>
38+
39+
{{#if @hasContextMenu}}
40+
{{#let (unique-id) (use-state false) as |randomPopoverId isPopoverOpen|}}
41+
<div class="euiNotificationEventMeta__contextMenuWrapper">
42+
<EuiPopover
43+
id={{randomPopoverId}}
44+
@ownFocus={{true}}
45+
@repositionOnScroll={{true}}
46+
@isOpen={{isPopoverOpen.value}}
47+
@panelPaddingSize="none"
48+
@anchorPosition="leftUp"
49+
@closePopover={{fn isPopoverOpen.setState false}}
50+
>
51+
52+
<:button>
53+
<EuiButtonIcon
54+
{{!-- aria-label={contextMenuButton} --}}
55+
aria-controls={{randomPopoverId}}
56+
aria-expanded={{this.isPopoverOpen}}
57+
aria-haspopup="true"
58+
@iconType="boxesVertical"
59+
@color="text"
60+
data-test-subj={{concat @id '-notificationEventMetaButton'}}
61+
{{on 'click' (fn isPopoverOpen.setState true)}}
62+
/>
63+
</:button>
64+
65+
{{!-- The EuiContextMenu is wrapped with a div so it closes after an item is clicked --}}
66+
<:content>
67+
<div
68+
{{on 'click' (queue
69+
(optional @onOpenContextMenu)
70+
(fn isPopoverOpen.setState false)
71+
)}}
72+
role="button"
73+
>
74+
{{yield}}
75+
</div>
76+
</:content>
77+
78+
</EuiPopover>
79+
</div>
80+
{{/let}}
81+
{{/if}}
82+
83+
</div>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{{!-- ToDo: title and aria-label translations --}}
2+
<EuiButtonIcon
3+
@iconType="dot"
4+
aria-label={{if @isRead (concat 'Mark ' @eventName ' as unread') (concat 'Mark ' @eventName ' as read')}}
5+
title={{if @isRead 'Read' 'Unread'}}
6+
class={{class-names
7+
'euiNotificationEventReadButton'
8+
(if @isRead 'euiNotificationEventReadButton--isRead')
9+
}}
10+
data-test-subj={{concat @id '-notificationEventReadButton'}}
11+
id={{@id}}
12+
...attributes
13+
/>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{{!-- ToDo: title and aria-label translations --}}
2+
<div
3+
class={{class-names
4+
'euiNotificationEventReadIcon'
5+
(if @isRead 'euiNotificationEventReadIcon--isRead')
6+
}}
7+
...attributes
8+
>
9+
<EuiIcon
10+
@type="dot"
11+
aria-label={{if
12+
@isRead
13+
(concat @eventName ' is read')
14+
(concat @eventName ' is unread')
15+
}}
16+
title={{if @isRead 'Read' 'Unread'}}
17+
@color="primary"
18+
data-test-subj={{concat @id '-notificationEventReadIcon'}}
19+
id={{@id}}
20+
/>
21+
</div>
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
{{#let (unique-id) as |id|}}
2+
<article
3+
aria-labelledby={{id}}
4+
key={{@id}}
5+
class={{class-names
6+
'euiNotificationEvent'
7+
(if (eq (type-of @isRead) "boolean") 'euiNotificationEvent--withReadState')
8+
}}
9+
...attributes
10+
>
11+
12+
{{#if (eq (type-of @isRead) "boolean")}}
13+
<div class="euiNotificationEvent__readButton">
14+
{{#if @onRead}}
15+
<EuiNotificationEventReadButton
16+
@id={{@id}}
17+
@isRead={{@isRead}}
18+
@eventName={{@title}}
19+
{{on "click" @onRead}}
20+
/>
21+
{{else}}
22+
<EuiNotificationEventReadIcon
23+
@id={{@id}}
24+
@isRead={{@isRead}}
25+
@eventName={{@title}}
26+
/>
27+
{{/if}}
28+
</div>
29+
{{/if}}
30+
31+
<div class="euiNotificationEvent__content">
32+
<EuiNotificationEventMeta
33+
@id={{@id}}
34+
@type={{@type}}
35+
@event={{@title}}
36+
@severity={{@severity}}
37+
@badgeColor={{@badgeColor}}
38+
@iconType={{@iconType}}
39+
@iconAriaLabel={{@iconAriaLabel}}
40+
@time={{@time}}
41+
@onOpenContextMenu={{@onOpenContextMenu}}
42+
@eventName={{@title}}
43+
@hasContextMenu={{has-block 'contextMenu'}}
44+
>
45+
{{yield to='contextMenu'}}
46+
</EuiNotificationEventMeta>
47+
48+
{{#let
49+
(class-names
50+
'euiNotificationEvent__title'
51+
(if @isRead 'euiNotificationEvent__title--isRead')
52+
)
53+
(arg-or-default
54+
@headingLevel
55+
'h2'
56+
)
57+
as |classNames headingLevel|}}
58+
{{#if @onClickTitle}}
59+
<EuiLink
60+
@onClick={{@onClickTitle}}
61+
>
62+
<TextBlock @tagName={{headingLevel}} id={{id}} class={{classNames}}>
63+
{{@title}}
64+
</TextBlock>
65+
</EuiLink>
66+
{{else if @title}}
67+
<TextBlock @tagName={{headingLevel}} id={{id}} class={{classNames}}>
68+
{{@title}}
69+
</TextBlock>
70+
{{/if}}
71+
{{/let}}
72+
73+
<EuiNotificationEventMessages
74+
@messages={{@messages}}
75+
@eventName={{@title}}
76+
@accordionButtonText={{@accordionButtonText}}
77+
@accordionHideText={{@accordionHideText}}
78+
/>
79+
80+
{{#if (has-block 'primaryAction')}}
81+
<div class="euiNotificationEvent__primaryAction">
82+
{{yield to='primaryAction'}}
83+
</div>
84+
{{/if}}
85+
86+
</div>
87+
88+
</article>
89+
{{/let}}

packages/core/addon/components/eui-tab/index.hbs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
...attributes
1515
>
1616
{{#if (has-block "prepend")}}
17-
<span className="euiTab__prepend">
17+
<span class="euiTab__prepend">
1818
{{yield to="prepend"}}
1919
</span>
2020
{{/if}}
@@ -24,7 +24,7 @@
2424
</span>
2525

2626
{{#if (has-block "append")}}
27-
<span className="euiTab__append">
27+
<span class="euiTab__append">
2828
{{yield to="append"}}
2929
</span>
3030
{{/if}}
@@ -44,7 +44,7 @@
4444
...attributes
4545
>
4646
{{#if (has-block "prepend")}}
47-
<span className="euiTab__prepend">
47+
<span class="euiTab__prepend">
4848
{{yield to="prepend"}}
4949
</span>
5050
{{/if}}
@@ -54,7 +54,7 @@
5454
</span>
5555

5656
{{#if (has-block "append")}}
57-
<span className="euiTab__append">
57+
<span class="euiTab__append">
5858
{{yield to="append"}}
5959
</span>
6060
{{/if}}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from '@ember-eui/core/components/eui-notification-event-messages';

0 commit comments

Comments
 (0)