@ember-eui/core 5.0.0-alpha.4 → 5.0.0-alpha.5
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/addon/components/eui-accordion/index.hbs +2 -2
- package/addon/components/eui-code-block/controls/index.hbs +1 -1
- package/addon/components/eui-loading-logo/index.hbs +1 -1
- package/addon/components/eui-notification-event/index.hbs +89 -0
- package/addon/components/eui-notification-event-messages/index.hbs +49 -0
- package/addon/components/eui-notification-event-meta/index.hbs +83 -0
- package/addon/components/eui-notification-event-read-button/index.hbs +13 -0
- package/addon/components/eui-notification-event-read-icon/index.hbs +21 -0
- package/addon/components/eui-tab/index.hbs +4 -4
- package/addon/utils/css-mappings/eui-image.ts +1 -1
- package/app/components/eui-notification-event/index.js +1 -0
- package/app/components/eui-notification-event-messages/index.js +1 -0
- package/app/components/eui-notification-event-meta/index.js +1 -0
- package/app/components/eui-notification-event-read-button/index.js +1 -0
- package/app/components/eui-notification-event-read-icon/index.js +1 -0
- package/docs/display/avatar-demo/demo1.md +0 -8
- package/docs/display/avatar.md +9 -0
- package/docs/display/badge-demo/demo1.md +0 -8
- package/docs/display/badge.md +7 -0
- package/docs/display/comment-list.md +2 -1
- package/docs/display/description-list.md +2 -1
- package/docs/display/empty-prompt.md +2 -1
- package/docs/display/icons.md +1 -0
- package/docs/display/notification-event/demo/demo1.md +83 -0
- package/docs/display/notification-event/demo/demo2.md +141 -0
- package/docs/display/notification-event/demo/demo3.md +112 -0
- package/docs/display/notification-event/index.md +6 -0
- package/docs/navigation/tabs-demo/demo4.md +1 -1
- package/package.json +2 -2
|
@@ -40,12 +40,12 @@
|
|
|
40
40
|
{{on "click" this.onToggle}}
|
|
41
41
|
>
|
|
42
42
|
<span class={{this.buttonContentClasses}}>
|
|
43
|
-
{{yield to="buttonContent"}}
|
|
43
|
+
{{yield this.isOpen to="buttonContent"}}
|
|
44
44
|
</span>
|
|
45
45
|
</ButtonElement>
|
|
46
46
|
{{#if (and @extraAction (not this.isLoading))}}
|
|
47
47
|
<div class="euiAccordion__optionalAction">
|
|
48
|
-
{{yield to="extraAction"}}
|
|
48
|
+
{{yield this.isOpen to="extraAction"}}
|
|
49
49
|
</div>
|
|
50
50
|
{{else if this.isLoading}}
|
|
51
51
|
<div class="euiAccordion__optionalAction">
|
|
@@ -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}}
|
|
@@ -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>
|
|
@@ -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>
|
|
@@ -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
|
+
/>
|
|
@@ -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>
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
...attributes
|
|
15
15
|
>
|
|
16
16
|
{{#if (has-block "prepend")}}
|
|
17
|
-
<span
|
|
17
|
+
<span class="euiTab__prepend">
|
|
18
18
|
{{yield to="prepend"}}
|
|
19
19
|
</span>
|
|
20
20
|
{{/if}}
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
</span>
|
|
25
25
|
|
|
26
26
|
{{#if (has-block "append")}}
|
|
27
|
-
<span
|
|
27
|
+
<span class="euiTab__append">
|
|
28
28
|
{{yield to="append"}}
|
|
29
29
|
</span>
|
|
30
30
|
{{/if}}
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
...attributes
|
|
45
45
|
>
|
|
46
46
|
{{#if (has-block "prepend")}}
|
|
47
|
-
<span
|
|
47
|
+
<span class="euiTab__prepend">
|
|
48
48
|
{{yield to="prepend"}}
|
|
49
49
|
</span>
|
|
50
50
|
{{/if}}
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
</span>
|
|
55
55
|
|
|
56
56
|
{{#if (has-block "append")}}
|
|
57
|
-
<span
|
|
57
|
+
<span class="euiTab__append">
|
|
58
58
|
{{yield to="append"}}
|
|
59
59
|
</span>
|
|
60
60
|
{{/if}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@ember-eui/core/components/eui-notification-event';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@ember-eui/core/components/eui-notification-event-messages';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@ember-eui/core/components/eui-notification-event-meta';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@ember-eui/core/components/eui-notification-event-read-button';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@ember-eui/core/components/eui-notification-event-read-icon';
|
|
@@ -4,14 +4,6 @@ order: 1
|
|
|
4
4
|
|
|
5
5
|
# Basic
|
|
6
6
|
|
|
7
|
-
<EuiText>
|
|
8
|
-
<p>
|
|
9
|
-
|
|
10
|
-
The <strong>EuiAvatar</strong> component typically creates a user icon. It will accept <EuiCode>name</EuiCode> (required) and <EuiCode>image</EuiCode> props and will configure the display and accessibility as needed. By default, the background colors come from the set of colors used for visualizations. Otherwise you can pass a hex value to the <EuiCode>color</EuiCode> prop.
|
|
11
|
-
|
|
12
|
-
</p>
|
|
13
|
-
</EuiText>
|
|
14
|
-
|
|
15
7
|
```hbs template
|
|
16
8
|
<div>
|
|
17
9
|
<EuiAvatar @size='s' @name='Raphael' />
|
package/docs/display/avatar.md
CHANGED
|
@@ -1 +1,10 @@
|
|
|
1
1
|
<EuiPageHeader @pageTitle="Avatar"/>
|
|
2
|
+
<EuiHorizontalRule />
|
|
3
|
+
<EuiText>
|
|
4
|
+
|
|
5
|
+
<p>
|
|
6
|
+
|
|
7
|
+
The <strong>EuiAvatar</strong> component typically creates a user icon. It will accept <EuiCode>name</EuiCode> (required) and <EuiCode>image</EuiCode> props and will configure the display and accessibility as needed. By default, the background colors come from the set of colors used for visualizations. Otherwise you can pass a hex value to the <EuiCode>color</EuiCode> prop.
|
|
8
|
+
|
|
9
|
+
</p>
|
|
10
|
+
</EuiText>
|
|
@@ -2,14 +2,6 @@
|
|
|
2
2
|
order: 1
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
<EuiText>
|
|
6
|
-
<p>
|
|
7
|
-
|
|
8
|
-
<strong>EuiBadges</strong> are used to focus on important bits of information. Although they will automatically space themselves if you use them in a repetitive fashion it is good form to wrap them using a <strong>EuiBadgeGroup</strong> so that they will wrap when width is constrained (as seen below).
|
|
9
|
-
|
|
10
|
-
</p>
|
|
11
|
-
</EuiText>
|
|
12
|
-
|
|
13
5
|
```hbs template
|
|
14
6
|
<EuiTitle @size='xs'>
|
|
15
7
|
Accepted color names
|
package/docs/display/badge.md
CHANGED
|
@@ -1 +1,8 @@
|
|
|
1
1
|
<EuiPageHeader @pageTitle="Badge"/>
|
|
2
|
+
<EuiHorizontalRule />
|
|
3
|
+
<EuiText>
|
|
4
|
+
|
|
5
|
+
<p>
|
|
6
|
+
<strong>EuiBadges</strong> are used to focus on important bits of information. Although they will automatically space themselves if you use them in a repetitive fashion it is good form to wrap them using a <strong>EuiBadgeGroup</strong> so that they will wrap when width is constrained (as seen below).
|
|
7
|
+
</p>
|
|
8
|
+
</EuiText>
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
<EuiPageHeader @pageTitle="Comment List"/>
|
|
1
|
+
<EuiPageHeader @pageTitle="Comment List"/>
|
|
2
|
+
<EuiHorizontalRule />
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
<EuiPageHeader @pageTitle="Description list"/>
|
|
1
|
+
<EuiPageHeader @pageTitle="Description list"/>
|
|
2
|
+
<EuiHorizontalRule />
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
<EuiPageHeader @pageTitle="Empty Prompt"/>
|
|
1
|
+
<EuiPageHeader @pageTitle="Empty Prompt"/>
|
|
2
|
+
<EuiHorizontalRule />
|
package/docs/display/icons.md
CHANGED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
order: 1
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Basic
|
|
6
|
+
|
|
7
|
+
```hbs template
|
|
8
|
+
{{#let (slice
|
|
9
|
+
0 this.messagesCount this.messages
|
|
10
|
+
) as |msgs|}}
|
|
11
|
+
<EuiPanel @paddingSize='xs'>
|
|
12
|
+
<EuiNotificationEvent
|
|
13
|
+
@type='Hey!'
|
|
14
|
+
@badgeColor='primary'
|
|
15
|
+
@time='1 min'
|
|
16
|
+
@title='Some nice title'
|
|
17
|
+
@messages={{msgs}}
|
|
18
|
+
@iconType='email'
|
|
19
|
+
@accordionButtonText={{concat '+ ' (sub msgs.length 1) ' more'}}
|
|
20
|
+
@accordionHideText='hide'
|
|
21
|
+
>
|
|
22
|
+
|
|
23
|
+
<:primaryAction>
|
|
24
|
+
<EuiButtonEmpty
|
|
25
|
+
style="display: {{if this.showPrimaryAction '' 'none'}};"
|
|
26
|
+
@flush="left"
|
|
27
|
+
@size="s"
|
|
28
|
+
>
|
|
29
|
+
Do something!
|
|
30
|
+
</EuiButtonEmpty>
|
|
31
|
+
</:primaryAction>
|
|
32
|
+
|
|
33
|
+
</EuiNotificationEvent>
|
|
34
|
+
</EuiPanel>
|
|
35
|
+
{{/let}}
|
|
36
|
+
|
|
37
|
+
<EuiSpacer/>
|
|
38
|
+
|
|
39
|
+
Messages count:
|
|
40
|
+
<EuiRange
|
|
41
|
+
@min={{1}}
|
|
42
|
+
@max={{3}}
|
|
43
|
+
@step={{1}}
|
|
44
|
+
@value={{this.messagesCount}}
|
|
45
|
+
@onChange={{this.setMessagesCount}}
|
|
46
|
+
@showLabels={{true}}
|
|
47
|
+
/>
|
|
48
|
+
|
|
49
|
+
<EuiSwitch
|
|
50
|
+
@label='Show primary action'
|
|
51
|
+
@checked={{this.showPrimaryAction}}
|
|
52
|
+
@onChange={{pick 'target.checked' (set this 'showPrimaryAction')}}
|
|
53
|
+
/>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
```js component
|
|
57
|
+
import Component from '@glimmer/component';
|
|
58
|
+
import { tracked } from '@glimmer/tracking';
|
|
59
|
+
import { action } from '@ember/object';
|
|
60
|
+
|
|
61
|
+
export default class NotificationEvent1Component extends Component {
|
|
62
|
+
@tracked messagesCount;
|
|
63
|
+
@tracked showPrimaryAction;
|
|
64
|
+
|
|
65
|
+
messages = [
|
|
66
|
+
'This is a message',
|
|
67
|
+
"Wait, there's more",
|
|
68
|
+
'hmmm...'
|
|
69
|
+
]
|
|
70
|
+
|
|
71
|
+
constructor() {
|
|
72
|
+
super(...arguments);
|
|
73
|
+
this.messagesCount = 1;
|
|
74
|
+
this.showPrimaryAction = false;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@action
|
|
78
|
+
setMessagesCount(e){
|
|
79
|
+
this.messagesCount = e.target.value;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
}
|
|
83
|
+
```
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
---
|
|
2
|
+
order: 2
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Read state
|
|
6
|
+
|
|
7
|
+
```hbs template
|
|
8
|
+
<EuiTabs>
|
|
9
|
+
{{#each this.tabs as |tab|}}
|
|
10
|
+
<EuiTab
|
|
11
|
+
@isSelected={{eq tab.id this.selectedTab.id}}
|
|
12
|
+
{{on 'click' (fn this.onTabSelection tab)}}
|
|
13
|
+
>
|
|
14
|
+
{{tab.name}}
|
|
15
|
+
</EuiTab>
|
|
16
|
+
{{/each}}
|
|
17
|
+
</EuiTabs>
|
|
18
|
+
|
|
19
|
+
<EuiSpacer/>
|
|
20
|
+
|
|
21
|
+
{{#let (slice
|
|
22
|
+
0 this.messagesCount this.messages
|
|
23
|
+
) as |msgs|}}
|
|
24
|
+
<EuiPanel @paddingSize='xs'>
|
|
25
|
+
<EuiNotificationEvent
|
|
26
|
+
@isRead={{this.isRead}}
|
|
27
|
+
@onRead={{this.selectedTab.onRead}}
|
|
28
|
+
@type='Hey!'
|
|
29
|
+
@badgeColor='primary'
|
|
30
|
+
@time='1 min'
|
|
31
|
+
@title='Some nice title'
|
|
32
|
+
@messages={{msgs}}
|
|
33
|
+
@iconType='email'
|
|
34
|
+
@accordionButtonText={{concat '+ ' (sub msgs.length 1) ' more'}}
|
|
35
|
+
@accordionHideText='hide'
|
|
36
|
+
>
|
|
37
|
+
<:contextMenu>
|
|
38
|
+
<!-- ToDo Missing EuiContextMenu component -->
|
|
39
|
+
<button
|
|
40
|
+
class="euiContextMenuItem"
|
|
41
|
+
type="button"
|
|
42
|
+
{{on 'click' this.onRead}}
|
|
43
|
+
>
|
|
44
|
+
<span class="euiContextMenu__itemLayout">
|
|
45
|
+
<span class="euiContextMenuItem__text">
|
|
46
|
+
Mark as {{if this.isRead 'unread' 'read'}}
|
|
47
|
+
</span>
|
|
48
|
+
</span>
|
|
49
|
+
</button>
|
|
50
|
+
</:contextMenu>
|
|
51
|
+
|
|
52
|
+
<:primaryAction>
|
|
53
|
+
<EuiButtonEmpty
|
|
54
|
+
style="display: {{if this.showPrimaryAction '' 'none'}};"
|
|
55
|
+
@flush="left"
|
|
56
|
+
@size="s"
|
|
57
|
+
>
|
|
58
|
+
Do something!
|
|
59
|
+
</EuiButtonEmpty>
|
|
60
|
+
</:primaryAction>
|
|
61
|
+
|
|
62
|
+
</EuiNotificationEvent>
|
|
63
|
+
</EuiPanel>
|
|
64
|
+
{{/let}}
|
|
65
|
+
|
|
66
|
+
<EuiSpacer/>
|
|
67
|
+
|
|
68
|
+
Messages count:
|
|
69
|
+
<EuiRange
|
|
70
|
+
@min={{1}}
|
|
71
|
+
@max={{3}}
|
|
72
|
+
@step={{1}}
|
|
73
|
+
@value={{this.messagesCount}}
|
|
74
|
+
@onChange={{this.setMessagesCount}}
|
|
75
|
+
@showLabels={{true}}
|
|
76
|
+
/>
|
|
77
|
+
|
|
78
|
+
<EuiSwitch
|
|
79
|
+
@label='Show primary action'
|
|
80
|
+
@checked={{this.showPrimaryAction}}
|
|
81
|
+
@onChange={{pick 'target.checked' (set this 'showPrimaryAction')}}
|
|
82
|
+
/>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
```js component
|
|
86
|
+
import Component from '@glimmer/component';
|
|
87
|
+
import { tracked } from '@glimmer/tracking';
|
|
88
|
+
import { action } from '@ember/object';
|
|
89
|
+
|
|
90
|
+
export default class NotificationEvent2Component extends Component {
|
|
91
|
+
@tracked selectedTab;
|
|
92
|
+
@tracked isRead;
|
|
93
|
+
@tracked messagesCount;
|
|
94
|
+
@tracked showPrimaryAction;
|
|
95
|
+
|
|
96
|
+
messages = [
|
|
97
|
+
'This is a message',
|
|
98
|
+
"Wait, there's more",
|
|
99
|
+
'hmmm...'
|
|
100
|
+
]
|
|
101
|
+
|
|
102
|
+
tabs = [
|
|
103
|
+
{
|
|
104
|
+
id: 'icon',
|
|
105
|
+
name: 'Icon',
|
|
106
|
+
isRead: false
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
id: 'button',
|
|
110
|
+
name: 'Button',
|
|
111
|
+
isRead: false,
|
|
112
|
+
onRead: this.onRead
|
|
113
|
+
}
|
|
114
|
+
];
|
|
115
|
+
|
|
116
|
+
constructor() {
|
|
117
|
+
super(...arguments);
|
|
118
|
+
this.messagesCount = 1;
|
|
119
|
+
this.selectedTab = this.tabs[0];
|
|
120
|
+
this.isRead = this.selectedTab.isRead;
|
|
121
|
+
this.showPrimaryAction = false;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
@action
|
|
125
|
+
onRead() {
|
|
126
|
+
this.isRead = !this.isRead
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
@action
|
|
130
|
+
onTabSelection(obj) {
|
|
131
|
+
this.isRead = obj.isRead;
|
|
132
|
+
this.selectedTab = obj
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
@action
|
|
136
|
+
setMessagesCount(e){
|
|
137
|
+
this.messagesCount = e.target.value;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
}
|
|
141
|
+
```
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
---
|
|
2
|
+
order: 3
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Feed
|
|
6
|
+
|
|
7
|
+
```hbs template
|
|
8
|
+
<div>
|
|
9
|
+
{{#each this.items as |item|}}
|
|
10
|
+
{{#let (slice
|
|
11
|
+
0 this.messagesCount (shuffle item.messages)
|
|
12
|
+
) as |msgs|}}
|
|
13
|
+
<EuiNotificationEvent
|
|
14
|
+
@type={{item.type}}
|
|
15
|
+
@badgeColor={{item.badgeColor}}
|
|
16
|
+
@time={{item.time}}
|
|
17
|
+
@title={{item.title}}
|
|
18
|
+
@messages={{msgs}}
|
|
19
|
+
@iconType={{item.iconType}}
|
|
20
|
+
@accordionButtonText={{concat '+ ' (sub msgs.length 1) ' more'}}
|
|
21
|
+
@accordionHideText='hide'
|
|
22
|
+
>
|
|
23
|
+
|
|
24
|
+
<:primaryAction>
|
|
25
|
+
<EuiButtonEmpty
|
|
26
|
+
style="display: {{if this.showPrimaryAction '' 'none'}};"
|
|
27
|
+
@flush="left"
|
|
28
|
+
@size="s"
|
|
29
|
+
>
|
|
30
|
+
Do something!
|
|
31
|
+
</EuiButtonEmpty>
|
|
32
|
+
</:primaryAction>
|
|
33
|
+
|
|
34
|
+
</EuiNotificationEvent>
|
|
35
|
+
{{/let}}
|
|
36
|
+
{{/each}}
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
<EuiSpacer/>
|
|
40
|
+
|
|
41
|
+
Messages count:
|
|
42
|
+
<EuiRange
|
|
43
|
+
@min={{1}}
|
|
44
|
+
@max={{3}}
|
|
45
|
+
@step={{1}}
|
|
46
|
+
@value={{this.messagesCount}}
|
|
47
|
+
@onChange={{this.setMessagesCount}}
|
|
48
|
+
@showLabels={{true}}
|
|
49
|
+
/>
|
|
50
|
+
|
|
51
|
+
<EuiSwitch
|
|
52
|
+
@label='Show primary action'
|
|
53
|
+
@checked={{this.showPrimaryAction}}
|
|
54
|
+
@onChange={{pick 'target.checked' (set this 'showPrimaryAction')}}
|
|
55
|
+
/>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
```js component
|
|
59
|
+
import Component from '@glimmer/component';
|
|
60
|
+
import { tracked } from '@glimmer/tracking';
|
|
61
|
+
import { action } from '@ember/object';
|
|
62
|
+
|
|
63
|
+
export default class NotificationEvent3Component extends Component {
|
|
64
|
+
@tracked messagesCount;
|
|
65
|
+
@tracked showPrimaryAction;
|
|
66
|
+
|
|
67
|
+
messages = [
|
|
68
|
+
'This is a message',
|
|
69
|
+
"Wait, there's more",
|
|
70
|
+
'hmmm...'
|
|
71
|
+
]
|
|
72
|
+
|
|
73
|
+
items = [
|
|
74
|
+
{
|
|
75
|
+
messages: this.messages,
|
|
76
|
+
iconType: 'email',
|
|
77
|
+
badgeColor: 'primary',
|
|
78
|
+
type: 'Hey',
|
|
79
|
+
time: '1 min',
|
|
80
|
+
title: 'Welcome'
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
messages: this.messages,
|
|
84
|
+
iconType: 'tag',
|
|
85
|
+
badgeColor: 'accent',
|
|
86
|
+
type: 'News',
|
|
87
|
+
time: '3 min',
|
|
88
|
+
title: 'Someone tagged you'
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
messages: this.messages,
|
|
92
|
+
iconType: 'bug',
|
|
93
|
+
badgeColor: 'warning',
|
|
94
|
+
type: 'Alert',
|
|
95
|
+
time: '10 min',
|
|
96
|
+
title: 'Found a bug'
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
|
|
100
|
+
constructor() {
|
|
101
|
+
super(...arguments);
|
|
102
|
+
this.messagesCount = 1;
|
|
103
|
+
this.showPrimaryAction = false;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
@action
|
|
107
|
+
setMessagesCount(e){
|
|
108
|
+
this.messagesCount = e.target.value;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
}
|
|
112
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ember-eui/core",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.5",
|
|
4
4
|
"description": "Ember Components for Elastic UI",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon",
|
|
@@ -182,5 +182,5 @@
|
|
|
182
182
|
"volta": {
|
|
183
183
|
"extends": "../../package.json"
|
|
184
184
|
},
|
|
185
|
-
"gitHead": "
|
|
185
|
+
"gitHead": "f51e8c4b246911462dae9af5445e6968516e2ce2"
|
|
186
186
|
}
|