@ember-eui/core 1.3.5 → 1.6.1
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/CHANGELOG.md +18 -0
- package/addon/components/eui-markdown-editor/index.hbs +1 -0
- package/addon/components/eui-markdown-format/index.hbs +2 -1
- package/addon/components/eui-markdown-format/index.ts +14 -5
- package/addon/components/eui-stat/description/index.hbs +16 -0
- package/addon/components/eui-stat/index.hbs +83 -0
- package/addon/components/eui-stat/index.ts +45 -0
- package/addon/components/eui-stat/title/index.hbs +18 -0
- package/addon/helpers/class-names.ts +8 -2
- package/addon/utils/css-mappings/eui-stat.ts +26 -0
- package/addon/utils/css-mappings/index.ts +2 -0
- package/addon/utils/markdown/plugins/markdown-default-plugins.ts +1 -24
- package/addon/utils/markdown/plugins/to-dom.ts +4 -0
- package/app/components/eui-stat/description/index.js +1 -0
- package/app/components/eui-stat/index.js +1 -0
- package/app/components/eui-stat/title/index.js +1 -0
- package/app/utils/markdown/plugins/markdown-add-components.js +1 -0
- package/app/utils/markdown/plugins/markdown-default-plugins.js +1 -0
- package/docs/display/stat-demo/demo1.md +131 -0
- package/docs/display/stat-demo/demo2.md +59 -0
- package/docs/display/stat.md +1 -0
- package/docs/editors/markdown-editor/base-editor-demo/demo1.md +34 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
### Master
|
|
4
4
|
|
|
5
|
+
### 1.6.1
|
|
6
|
+
🐛 Bug / Fixes
|
|
7
|
+
`@ember-eui/core`
|
|
8
|
+
- Add default yield block for `<EuiStat />`
|
|
9
|
+
|
|
10
|
+
### 1.6.0
|
|
11
|
+
🚀 Enhancements
|
|
12
|
+
`@ember-eui/core`
|
|
13
|
+
- `<EuiStat/>` component!
|
|
14
|
+
### 1.5.0
|
|
15
|
+
🚀 Enhancements
|
|
16
|
+
`@ember-eui/validated-form`
|
|
17
|
+
- Allow providing an markdown-editor componet for easier composability
|
|
18
|
+
|
|
19
|
+
### 1.4.0
|
|
20
|
+
🚀 Enhancements
|
|
21
|
+
- Easier extending of processing plugins, add demo
|
|
22
|
+
|
|
5
23
|
### 1.3.5
|
|
6
24
|
🐛 Bug / Fixes
|
|
7
25
|
- Urls for markdown editor icons
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
{{! This hbs was inspired by https://github.com/ampatspell/ember-cli-remark-static/blob/v3.0.5/addon/components/remark.hbs }}
|
|
1
2
|
<div class="euiMarkdownFormat">
|
|
2
3
|
{{this.result.element}}
|
|
3
4
|
{{#each this.result.components as |CompNode|}}
|
|
@@ -10,4 +11,4 @@
|
|
|
10
11
|
{{/let}}
|
|
11
12
|
{{/in-element}}
|
|
12
13
|
{{/each}}
|
|
13
|
-
</div>
|
|
14
|
+
</div>
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
|
-
import type MarkdownActions from '../../utils/markdown/markdown-actions';
|
|
3
2
|
import {
|
|
4
3
|
defaultParsingPlugins,
|
|
5
4
|
defaultProcessingPlugins
|
|
6
5
|
} from '../../utils/markdown/plugins/markdown-default-plugins';
|
|
7
6
|
import { cached } from '@glimmer/tracking';
|
|
8
|
-
import unified from 'unified';
|
|
7
|
+
import unified, { Processor } from 'unified';
|
|
9
8
|
import { toDOM } from '../../utils/markdown/plugins/to-dom';
|
|
10
9
|
import type { RehypeNode } from '../../utils/markdown/markdown-types';
|
|
10
|
+
import type EuiMarkdownEditorComponent from '../eui-markdown-editor';
|
|
11
11
|
|
|
12
12
|
export interface EuiMarkdownEditorToolbarArgs {
|
|
13
13
|
parsingPluginList?: typeof defaultParsingPlugins;
|
|
14
14
|
processingPluginList?: typeof defaultProcessingPlugins;
|
|
15
|
-
|
|
16
|
-
markdownActions: MarkdownActions;
|
|
15
|
+
replaceNode?: EuiMarkdownEditorComponent['replaceNode'];
|
|
17
16
|
value: string;
|
|
18
17
|
}
|
|
19
18
|
|
|
@@ -28,7 +27,17 @@ export default class EuiMarkdownEditorToolbarComponent extends Component<EuiMark
|
|
|
28
27
|
|
|
29
28
|
@cached
|
|
30
29
|
get processor() {
|
|
31
|
-
|
|
30
|
+
const Compiler = (tree: any) => {
|
|
31
|
+
return tree;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
function identityCompiler(this: Processor) {
|
|
35
|
+
this.Compiler = Compiler;
|
|
36
|
+
}
|
|
37
|
+
return unified()
|
|
38
|
+
.use(this.parsingPluginList)
|
|
39
|
+
.use(this.processingPluginList)
|
|
40
|
+
.use(identityCompiler);
|
|
32
41
|
}
|
|
33
42
|
|
|
34
43
|
@cached
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{{#if @descriptionElement}}
|
|
2
|
+
{{#let (element @descriptionElement) as |DescriptionElement|}}
|
|
3
|
+
<EuiText class="euiStat__description" @size="s">
|
|
4
|
+
<DescriptionElement aria-hidden="true">
|
|
5
|
+
{{yield}}
|
|
6
|
+
</DescriptionElement>
|
|
7
|
+
</EuiText>
|
|
8
|
+
{{/let}}
|
|
9
|
+
|
|
10
|
+
{{else}}
|
|
11
|
+
<EuiText class="euiStat__description" @size="s">
|
|
12
|
+
<p aria-hidden="true">
|
|
13
|
+
{{yield}}
|
|
14
|
+
</p>
|
|
15
|
+
</EuiText>
|
|
16
|
+
{{/if}}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
{{#let
|
|
2
|
+
(class-names
|
|
3
|
+
textAlign=(arg-or-default @textAlign "left") componentName="EuiStat"
|
|
4
|
+
)
|
|
5
|
+
(class-names
|
|
6
|
+
"euiStat__title"
|
|
7
|
+
(if @isLoading "euiStat__title-isLoading")
|
|
8
|
+
color=(arg-or-default @titleColor "default")
|
|
9
|
+
addBase=false
|
|
10
|
+
componentName="EuiStat"
|
|
11
|
+
)
|
|
12
|
+
(arg-or-default @reverse false)
|
|
13
|
+
(arg-or-default @titleSize "l")
|
|
14
|
+
as |classes titleClasses reverse titleSize|
|
|
15
|
+
}}
|
|
16
|
+
<div class={{classes}} ...attributes>
|
|
17
|
+
{{#if reverse}}
|
|
18
|
+
<EuiStat::Title
|
|
19
|
+
class={{titleClasses}}
|
|
20
|
+
@titleElement={{@titleElement}}
|
|
21
|
+
@titleSize={{titleSize}}
|
|
22
|
+
@isColorClass={{this.isColorClass}}
|
|
23
|
+
>
|
|
24
|
+
{{#if @isLoading}}
|
|
25
|
+
--
|
|
26
|
+
{{else}}
|
|
27
|
+
{{#if (has-block "title")}}
|
|
28
|
+
{{yield to="title"}}
|
|
29
|
+
{{else}}
|
|
30
|
+
{{@title}}
|
|
31
|
+
{{/if}}
|
|
32
|
+
{{/if}}
|
|
33
|
+
</EuiStat::Title>
|
|
34
|
+
<EuiStat::Description
|
|
35
|
+
@descriptionElement={{@descriptionElement}}
|
|
36
|
+
>
|
|
37
|
+
{{#if (has-block "description")}}
|
|
38
|
+
{{yield to="description"}}
|
|
39
|
+
{{else}}
|
|
40
|
+
{{@description}}
|
|
41
|
+
{{/if}}
|
|
42
|
+
</EuiStat::Description>
|
|
43
|
+
{{else}}
|
|
44
|
+
<EuiStat::Description
|
|
45
|
+
@descriptionElement={{@descriptionElement}}
|
|
46
|
+
>
|
|
47
|
+
{{#if (has-block "description")}}
|
|
48
|
+
{{yield to="description"}}
|
|
49
|
+
{{else}}
|
|
50
|
+
{{@description}}
|
|
51
|
+
{{/if}}
|
|
52
|
+
</EuiStat::Description>
|
|
53
|
+
<EuiStat::Title
|
|
54
|
+
class={{titleClasses}}
|
|
55
|
+
@titleElement={{@titleElement}}
|
|
56
|
+
@titleSize={{titleSize}}
|
|
57
|
+
@isColorClass={{this.isColorClass}}
|
|
58
|
+
>
|
|
59
|
+
{{#if @isLoading}}
|
|
60
|
+
--
|
|
61
|
+
{{else}}
|
|
62
|
+
{{#if (has-block "title")}}
|
|
63
|
+
{{yield to="title"}}
|
|
64
|
+
{{else}}
|
|
65
|
+
{{@title}}
|
|
66
|
+
{{/if}}
|
|
67
|
+
{{/if}}
|
|
68
|
+
</EuiStat::Title>
|
|
69
|
+
{{/if}}
|
|
70
|
+
{{#if this.screenReader}}
|
|
71
|
+
<p {{screen-reader-only}}>
|
|
72
|
+
{{#if reverse}}
|
|
73
|
+
{{@title}}
|
|
74
|
+
{{@description}}
|
|
75
|
+
{{else}}
|
|
76
|
+
{{@description}}
|
|
77
|
+
{{@title}}
|
|
78
|
+
{{/if}}
|
|
79
|
+
</p>
|
|
80
|
+
{{/if}}
|
|
81
|
+
{{yield}}
|
|
82
|
+
</div>
|
|
83
|
+
{{/let}}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { colorMapping } from '../../utils/css-mappings/eui-stat';
|
|
3
|
+
import { sizeMapping } from '../../utils/css-mappings/eui-title';
|
|
4
|
+
import { keysOf } from '../common';
|
|
5
|
+
|
|
6
|
+
type EuiTitleSize = keyof typeof sizeMapping;
|
|
7
|
+
|
|
8
|
+
export const COLORS = keysOf(colorMapping);
|
|
9
|
+
|
|
10
|
+
export const isColorClass = (
|
|
11
|
+
input: string
|
|
12
|
+
): input is keyof typeof colorMapping => {
|
|
13
|
+
return colorMapping.hasOwnProperty(input);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
type StatArgs = {
|
|
17
|
+
/**
|
|
18
|
+
* The color of the title text
|
|
19
|
+
*/
|
|
20
|
+
titleColor?: keyof typeof colorMapping | string;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Size of the title. See EuiTitle for options ('s', 'm', 'l'... etc)
|
|
24
|
+
*/
|
|
25
|
+
titleSize?: EuiTitleSize;
|
|
26
|
+
|
|
27
|
+
title?: string | Component;
|
|
28
|
+
description?: string | Component;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default class EuiStart extends Component<StatArgs> {
|
|
32
|
+
get isColorClass() {
|
|
33
|
+
if (this.args.titleColor) {
|
|
34
|
+
return isColorClass(this.args.titleColor);
|
|
35
|
+
}
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
get useScreenReader() {
|
|
40
|
+
return (
|
|
41
|
+
typeof this.args.title === 'string' &&
|
|
42
|
+
typeof this.args.description === 'string'
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{{#if @titleElement}}
|
|
2
|
+
{{#let (element @titleElement) as |TitleElement|}}
|
|
3
|
+
<EuiTitle @size={{@titleSize}} ...attributes>
|
|
4
|
+
<TitleElement
|
|
5
|
+
aria-hidden="true"
|
|
6
|
+
{{style (if @isColorClass (hash color=@titleColor))}}
|
|
7
|
+
>
|
|
8
|
+
{{yield}}
|
|
9
|
+
</TitleElement>
|
|
10
|
+
</EuiTitle>
|
|
11
|
+
{{/let}}
|
|
12
|
+
{{else}}
|
|
13
|
+
<EuiTitle @size={{@titleSize}} ...attributes>
|
|
14
|
+
<p aria-hidden="true" {{style (if @isColorClass (hash color=@titleColor))}}>
|
|
15
|
+
{{yield}}
|
|
16
|
+
</p>
|
|
17
|
+
</EuiTitle>
|
|
18
|
+
{{/if}}
|
|
@@ -40,8 +40,12 @@ interface Options extends IObjectKeys {
|
|
|
40
40
|
*
|
|
41
41
|
* @param classes - List of classes that will be joined
|
|
42
42
|
*/
|
|
43
|
-
export function classNames(
|
|
43
|
+
export function classNames(
|
|
44
|
+
classNames: string[] = [],
|
|
45
|
+
options: Options & { addBase: boolean }
|
|
46
|
+
): string {
|
|
44
47
|
let { componentName, ...rest } = options;
|
|
48
|
+
let includeBase = options.addBase !== false;
|
|
45
49
|
let str = `${classNames.join(' ')}`;
|
|
46
50
|
if (options.componentName) {
|
|
47
51
|
assert(
|
|
@@ -49,7 +53,9 @@ export function classNames(classNames: string[] = [], options: Options): string
|
|
|
49
53
|
cssMappings[options.componentName] !== undefined
|
|
50
54
|
);
|
|
51
55
|
const component = cssMappings[options.componentName];
|
|
52
|
-
|
|
56
|
+
if (includeBase) {
|
|
57
|
+
str = `${str} ${component.base}`;
|
|
58
|
+
}
|
|
53
59
|
|
|
54
60
|
for (let key in rest) {
|
|
55
61
|
if (component.properties[key] && component.properties[key][rest[key]]) {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const baseClass = 'euiStat';
|
|
2
|
+
|
|
3
|
+
export const textAlignMapping = {
|
|
4
|
+
left: `${baseClass}--leftAligned`,
|
|
5
|
+
center: `${baseClass}--centerAligned`,
|
|
6
|
+
right: `${baseClass}--rightAligned`
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const colorMapping = {
|
|
10
|
+
default: '',
|
|
11
|
+
subdued: `${baseClass}__title--subdued`,
|
|
12
|
+
primary: `${baseClass}__title--primary`,
|
|
13
|
+
success: `${baseClass}__title--success`,
|
|
14
|
+
danger: `${baseClass}__title--danger`,
|
|
15
|
+
accent: `${baseClass}__title--accent`
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const mapping: ComponentMapping = {
|
|
19
|
+
base: baseClass,
|
|
20
|
+
properties: {
|
|
21
|
+
textAlign: textAlignMapping,
|
|
22
|
+
color: colorMapping
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default mapping;
|
|
@@ -53,8 +53,10 @@ import EuiToolTip from './eui-tool-tip';
|
|
|
53
53
|
import EuiToast from './eui-toast';
|
|
54
54
|
import EuiGlobalToastList from './eui-global-toast-list';
|
|
55
55
|
import EuiCodeBlockImpl from './eui-code-block-impl';
|
|
56
|
+
import EuiStat from './eui-stat';
|
|
56
57
|
|
|
57
58
|
const mapping: Mapping = {
|
|
59
|
+
EuiStat,
|
|
58
60
|
EuiCodeBlockImpl,
|
|
59
61
|
EuiAccordion,
|
|
60
62
|
EuiIcon,
|
|
@@ -34,12 +34,6 @@ import {
|
|
|
34
34
|
Settings
|
|
35
35
|
} from 'unified';
|
|
36
36
|
import remark2Rehype from 'remark-rehype';
|
|
37
|
-
import { RehypeNode } from '../markdown-types';
|
|
38
|
-
// import * as MarkdownTooltip from './markdown_tooltip';
|
|
39
|
-
// import * as MarkdownCheckbox from './markdown_checkbox';
|
|
40
|
-
// import { markdownLinkValidator } from './markdown_link_validator';
|
|
41
|
-
// import { EuiLink } from '../../link';
|
|
42
|
-
// import { EuiCodeBlock, EuiCode } from '../../code';
|
|
43
37
|
import markdown from 'remark-parse';
|
|
44
38
|
import emoji from 'remark-emoji';
|
|
45
39
|
import all from 'mdast-util-to-hast/lib/all';
|
|
@@ -71,29 +65,12 @@ const unknownHandler: Handler = (h, node) => {
|
|
|
71
65
|
|
|
72
66
|
export const defaultParsingPlugins = getDefaultEuiMarkdownParsingPlugins();
|
|
73
67
|
|
|
74
|
-
class Compiler {
|
|
75
|
-
tree: RehypeNode | null = null;
|
|
76
|
-
constructor(tree: RehypeNode) {
|
|
77
|
-
this.tree = tree;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
compile() {
|
|
81
|
-
return this.tree;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function compiler() {
|
|
86
|
-
//@ts-expect-error
|
|
87
|
-
this.Compiler = Compiler;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
68
|
export const getDefaultEuiMarkdownProcessingPlugins = (): [
|
|
91
69
|
[typeof remark2Rehype, Record<string, unknown>],
|
|
92
70
|
...PluggableList // any additional are generic
|
|
93
71
|
] => [
|
|
94
72
|
[remark2Rehype, { allowDangerousHtml: true, unknownHandler }],
|
|
95
|
-
[MarkdownAddComponents, {}]
|
|
96
|
-
[compiler]
|
|
73
|
+
[MarkdownAddComponents, {}]
|
|
97
74
|
];
|
|
98
75
|
|
|
99
76
|
export const defaultProcessingPlugins =
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@ember-eui/core/components/eui-stat/description';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@ember-eui/core/components/eui-stat';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@ember-eui/core/components/eui-stat/title';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@ember-eui/core/utils/markdown/plugins/markdown-add-components';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@ember-eui/core/utils/markdown/plugins/markdown-default-plugins';
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
---
|
|
2
|
+
order: 1
|
|
3
|
+
---
|
|
4
|
+
# Demo
|
|
5
|
+
|
|
6
|
+
```hbs template
|
|
7
|
+
<div>
|
|
8
|
+
<EuiFlexGroup>
|
|
9
|
+
<EuiFlexItem>
|
|
10
|
+
<EuiStat @title='7,600 mm' @description='Total people' />
|
|
11
|
+
</EuiFlexItem>
|
|
12
|
+
</EuiFlexGroup>
|
|
13
|
+
</div>
|
|
14
|
+
<EuiSpacer />
|
|
15
|
+
<div>
|
|
16
|
+
<EuiFlexGroup>
|
|
17
|
+
<EuiFlexItem>
|
|
18
|
+
<EuiStat
|
|
19
|
+
@title='22,123'
|
|
20
|
+
@description='Total people'
|
|
21
|
+
@titleColor='primary'
|
|
22
|
+
/>
|
|
23
|
+
</EuiFlexItem>
|
|
24
|
+
<EuiFlexItem>
|
|
25
|
+
<EuiStat
|
|
26
|
+
@title='22,123'
|
|
27
|
+
@description='Total people'
|
|
28
|
+
@titleColor='accent'
|
|
29
|
+
/>
|
|
30
|
+
</EuiFlexItem>
|
|
31
|
+
<EuiFlexItem>
|
|
32
|
+
<EuiStat
|
|
33
|
+
@title='22,123'
|
|
34
|
+
@description='Total people'
|
|
35
|
+
@titleColor='danger'
|
|
36
|
+
/>
|
|
37
|
+
</EuiFlexItem>
|
|
38
|
+
</EuiFlexGroup>
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<EuiSpacer />
|
|
42
|
+
<div>
|
|
43
|
+
<EuiFlexGroup>
|
|
44
|
+
<EuiFlexItem>
|
|
45
|
+
<EuiStat
|
|
46
|
+
@title='22,123'
|
|
47
|
+
@description='Total people'
|
|
48
|
+
@isLoading={{this.isLoading}}
|
|
49
|
+
@titleColor='primary'
|
|
50
|
+
/>
|
|
51
|
+
<EuiSpacer />
|
|
52
|
+
<EuiSwitch
|
|
53
|
+
@label='Show as loading'
|
|
54
|
+
@checked={{this.isLoading}}
|
|
55
|
+
@onChange={{pick 'target.checked' (set this 'isLoading')}}
|
|
56
|
+
/>
|
|
57
|
+
</EuiFlexItem>
|
|
58
|
+
</EuiFlexGroup>
|
|
59
|
+
</div>
|
|
60
|
+
<EuiSpacer />
|
|
61
|
+
<div>
|
|
62
|
+
<EuiFlexGroup>
|
|
63
|
+
<EuiFlexItem>
|
|
64
|
+
<EuiPanel>
|
|
65
|
+
<EuiStat
|
|
66
|
+
@title='8,888'
|
|
67
|
+
@description='Total widgets'
|
|
68
|
+
@textAlign='right'
|
|
69
|
+
@isLoading={{this.isLoading}}
|
|
70
|
+
>
|
|
71
|
+
<EuiIcon @type='empty' />
|
|
72
|
+
</EuiStat>
|
|
73
|
+
</EuiPanel>
|
|
74
|
+
</EuiFlexItem>
|
|
75
|
+
<EuiFlexItem>
|
|
76
|
+
<EuiPanel>
|
|
77
|
+
<EuiStat
|
|
78
|
+
@title='2,000'
|
|
79
|
+
@description='Pending widgets'
|
|
80
|
+
@titleColor='accent'
|
|
81
|
+
@textAlign='right'
|
|
82
|
+
@isLoading={{this.Loading}}
|
|
83
|
+
>
|
|
84
|
+
<EuiIcon @type='clock' @color='accent' />
|
|
85
|
+
</EuiStat>
|
|
86
|
+
</EuiPanel>
|
|
87
|
+
</EuiFlexItem>
|
|
88
|
+
<EuiFlexItem>
|
|
89
|
+
<EuiPanel>
|
|
90
|
+
<EuiStat
|
|
91
|
+
@title='6,800'
|
|
92
|
+
@description='Success widgets'
|
|
93
|
+
@titleColor='success'
|
|
94
|
+
@textAlign='right'
|
|
95
|
+
@isLoading={{this.isLoading}}
|
|
96
|
+
>
|
|
97
|
+
<EuiIcon @type='check' @color='success' />
|
|
98
|
+
</EuiStat>
|
|
99
|
+
</EuiPanel>
|
|
100
|
+
</EuiFlexItem>
|
|
101
|
+
<EuiFlexItem>
|
|
102
|
+
<EuiPanel>
|
|
103
|
+
<EuiStat
|
|
104
|
+
@title='88'
|
|
105
|
+
@description='Error widgets'
|
|
106
|
+
@titleColor='danger'
|
|
107
|
+
@textAlign='right'
|
|
108
|
+
@isLoading={{this.isLoading}}
|
|
109
|
+
>
|
|
110
|
+
<EuiIcon @type='alert' @color='danger' />
|
|
111
|
+
</EuiStat>
|
|
112
|
+
</EuiPanel>
|
|
113
|
+
</EuiFlexItem>
|
|
114
|
+
</EuiFlexGroup>
|
|
115
|
+
<EuiSpacer />
|
|
116
|
+
<EuiSwitch
|
|
117
|
+
@label='Show as loading'
|
|
118
|
+
@checked={{this.isLoading}}
|
|
119
|
+
@onChange={{pick 'target.checked' (set this 'isLoading')}}
|
|
120
|
+
/>
|
|
121
|
+
</div>
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
```js component
|
|
125
|
+
import Component from '@glimmer/component';
|
|
126
|
+
import { tracked } from '@glimmer/tracking';
|
|
127
|
+
|
|
128
|
+
export default class StatDemoComponent extends Component {
|
|
129
|
+
@tracked isLoading = true;
|
|
130
|
+
}
|
|
131
|
+
```
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Demo
|
|
2
|
+
|
|
3
|
+
<EuiTitle>Title size</EuiTitle>
|
|
4
|
+
<EuiText>
|
|
5
|
+
title uses the <EuiCode>EuiTitle</EuiCode> component and thus uses the same sizing property
|
|
6
|
+
values (applied via the titleSize property). Although all EuiTitle sizes are
|
|
7
|
+
available, suggested sizes include <EuiCode>'l' | 'm' | 's' | 'xs' | 'xxs' | 'xxxs'</EuiCode>. By
|
|
8
|
+
default, the size is set to large <EuiCode>l</EuiCode>. The @description label cannot be
|
|
9
|
+
re-sized via component properties.
|
|
10
|
+
</EuiText>
|
|
11
|
+
<EuiSpacer/>
|
|
12
|
+
|
|
13
|
+
```hbs template
|
|
14
|
+
<div>
|
|
15
|
+
<EuiFlexGroup>
|
|
16
|
+
<EuiFlexItem>
|
|
17
|
+
<EuiStat @title='1,000,000' @description='Large size' @titleSize='l' />
|
|
18
|
+
</EuiFlexItem>
|
|
19
|
+
<EuiFlexItem>
|
|
20
|
+
<EuiStat @title='1,000,000' @description='Medium size' @titleSize='m' />
|
|
21
|
+
</EuiFlexItem>
|
|
22
|
+
<EuiFlexItem>
|
|
23
|
+
<EuiStat @title='1,000,000' @description='Small size' @titleSize='s' />
|
|
24
|
+
</EuiFlexItem>
|
|
25
|
+
</EuiFlexGroup>
|
|
26
|
+
<EuiFlexGroup>
|
|
27
|
+
<EuiFlexItem>
|
|
28
|
+
<EuiStat
|
|
29
|
+
@title='1,000,000'
|
|
30
|
+
@description='Extra small size'
|
|
31
|
+
@titleSize='xs'
|
|
32
|
+
/>
|
|
33
|
+
</EuiFlexItem>
|
|
34
|
+
<EuiFlexItem>
|
|
35
|
+
<EuiStat
|
|
36
|
+
@title='1,000,000'
|
|
37
|
+
@description='Extra extra small size'
|
|
38
|
+
@titleSize='xxs'
|
|
39
|
+
/>
|
|
40
|
+
</EuiFlexItem>
|
|
41
|
+
<EuiFlexItem>
|
|
42
|
+
<EuiStat
|
|
43
|
+
@title='1,000,000'
|
|
44
|
+
@description='Extra extra extra small size'
|
|
45
|
+
@titleSize='xxxs'
|
|
46
|
+
/>
|
|
47
|
+
</EuiFlexItem>
|
|
48
|
+
</EuiFlexGroup>
|
|
49
|
+
</div>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
```js component
|
|
53
|
+
import Component from '@glimmer/component';
|
|
54
|
+
import { tracked } from '@glimmer/tracking';
|
|
55
|
+
|
|
56
|
+
export default class StatDemoComponent extends Component {
|
|
57
|
+
@tracked isLoading = true;
|
|
58
|
+
}
|
|
59
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Stat
|
|
@@ -8,6 +8,7 @@ order: 1
|
|
|
8
8
|
<EuiMarkdownEditor
|
|
9
9
|
@value={{this.value}}
|
|
10
10
|
@onChange={{set this 'value'}}
|
|
11
|
+
@processingPluginList={{this.processingPlugins}}
|
|
11
12
|
/>
|
|
12
13
|
```
|
|
13
14
|
|
|
@@ -15,8 +16,31 @@ order: 1
|
|
|
15
16
|
import Component from '@glimmer/component';
|
|
16
17
|
import { tracked } from '@glimmer/tracking';
|
|
17
18
|
import { action } from '@ember/object';
|
|
19
|
+
import { visit } from '@ember-eui/core/utils/markdown/plugins/markdown-add-components';
|
|
20
|
+
import { defaultProcessingPlugins } from '@ember-eui/core/utils/markdown/plugins/markdown-default-plugins';
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
Quick example how you can extend plugins, this plugin adds _blank to `a` elements
|
|
25
|
+
*/
|
|
26
|
+
function TargetBlankProcessingPlugin() {
|
|
27
|
+
return (tree) => {
|
|
28
|
+
visit(tree, (node) => {
|
|
29
|
+
if (node.type === 'element' && node.tagName === 'a') {
|
|
30
|
+
node.properties.target = '_blank';
|
|
31
|
+
}
|
|
32
|
+
return node;
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const processingPlugins = [
|
|
38
|
+
...defaultProcessingPlugins,
|
|
39
|
+
[TargetBlankProcessingPlugin, {}]
|
|
40
|
+
];
|
|
18
41
|
|
|
19
42
|
export default class EuiMarkdownEditor1 extends Component {
|
|
43
|
+
processingPlugins = processingPlugins;
|
|
20
44
|
@tracked value = `## 👋 Hello there!
|
|
21
45
|
|
|
22
46
|
I'm a **EuiMarkdownEditor** with:
|
|
@@ -81,6 +105,16 @@ func main() {
|
|
|
81
105
|
|
|
82
106
|
\`\`\`
|
|
83
107
|
|
|
108
|
+
----
|
|
109
|
+
|
|
110
|
+
### You can also add tooltips if you want more explanation!
|
|
111
|
+
|
|
112
|
+
!{tooltip[You can also add tooltips](Some helpful description)}
|
|
113
|
+
|
|
114
|
+
### And links, check the demo source in how to tweak plugins!
|
|
115
|
+
|
|
116
|
+
[Access Google!](https://google.com)
|
|
117
|
+
|
|
84
118
|
`;
|
|
85
119
|
}
|
|
86
120
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ember-eui/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"description": "Ember Components for Elastic UI",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon",
|
|
@@ -154,5 +154,5 @@
|
|
|
154
154
|
"volta": {
|
|
155
155
|
"node": "12.22.1"
|
|
156
156
|
},
|
|
157
|
-
"gitHead": "
|
|
157
|
+
"gitHead": "cd8d70c4fcb1f49e0c2921315fe52b5afffcfbd1"
|
|
158
158
|
}
|