@ember-eui/core 5.16.0 → 5.17.0

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.
@@ -13,18 +13,17 @@
13
13
  (if (is-array @error) @error (array @error))
14
14
  (and @label (eq @labelType "legend"))
15
15
  (use-state false)
16
- (arg-or-default
17
- @id (unique-id)
18
- )
16
+ (arg-or-default @id (unique-id))
19
17
  (arg-or-default @hasChildLabel true)
20
- as |classes fieldWrapperClasses errors isLegend focusedState rowId hasChildLabel|
18
+ (and (not (arg-or-default @isFakeLabelBlock false)) (has-block "label"))
19
+ as |classes fieldWrapperClasses errors isLegend focusedState rowId hasChildLabel hasLabelBlock|
21
20
  }}
22
21
  {{#if (eq @legendType "legend")}}
23
22
  <fieldset class={{classes}} id="{{rowId}}-row" ...attributes>
24
- {{#if (or @label @labelAppend (has-block "label"))}}
23
+ {{#if (or @label @labelAppend hasLabelBlock)}}
25
24
  <div class="euiFormRow__labelWrapper">
26
25
  {{#if isLegend}}
27
- {{#if (has-block "label")}}
26
+ {{#if hasLabelBlock}}
28
27
  <EuiFormLabel
29
28
  class="euiFormRow__label"
30
29
  for={{rowId}}
@@ -45,14 +44,18 @@
45
44
  {{@label}}
46
45
  </EuiFormLabel>
47
46
  {{/if}}
48
- {{else if (has-block "label")}}
47
+ {{else if hasLabelBlock}}
49
48
  <EuiFormLabel
50
49
  class="euiFormRow__label"
51
50
  aria-invalid={{@isInvalid}}
52
51
  for={{if hasChildLabel rowId}}
53
52
  @isInvalid={{@isInvalid}}
54
53
  @type={{@labelType}}
55
- @isFocused={{and (not @isDisabled) (not isLegend) focusedState.value}}
54
+ @isFocused={{and
55
+ (not @isDisabled)
56
+ (not isLegend)
57
+ focusedState.value
58
+ }}
56
59
  >
57
60
  {{yield @label to="label"}}
58
61
  </EuiFormLabel>
@@ -63,7 +66,11 @@
63
66
  for={{if hasChildLabel rowId}}
64
67
  @isInvalid={{@isInvalid}}
65
68
  @type={{@labelType}}
66
- @isFocused={{and (not @isDisabled) (not isLegend) focusedState.value}}
69
+ @isFocused={{and
70
+ (not @isDisabled)
71
+ (not isLegend)
72
+ focusedState.value
73
+ }}
67
74
  >
68
75
  {{@label}}
69
76
  </EuiFormLabel>
@@ -80,7 +87,12 @@
80
87
  {{else}}
81
88
  {{yield}}
82
89
  {{/if}}
83
- {{#if (or (and (has-block "errors") @isInvalid) (and (gt errors.length 0) @isInvalid))}}
90
+ {{#if
91
+ (or
92
+ (and (has-block "errors") @isInvalid)
93
+ (and (gt errors.length 0) @isInvalid)
94
+ )
95
+ }}
84
96
  {{#if (has-block "errors")}}
85
97
  {{#each errors as |error i|}}
86
98
  <EuiFormErrorText
@@ -116,10 +128,10 @@
116
128
  </fieldset>
117
129
  {{else}}
118
130
  <div class={{classes}} id="{{rowId}}-row" ...attributes>
119
- {{#if (or @label @labelAppend (has-block "label"))}}
131
+ {{#if (or @label @labelAppend hasLabelBlock)}}
120
132
  <div class="euiFormRow__labelWrapper">
121
133
  {{#if isLegend}}
122
- {{#if (has-block "label")}}
134
+ {{#if hasLabelBlock}}
123
135
  <EuiFormLabel
124
136
  class="euiFormRow__label"
125
137
  for={{rowId}}
@@ -140,14 +152,18 @@
140
152
  {{@label}}
141
153
  </EuiFormLabel>
142
154
  {{/if}}
143
- {{else if (has-block "label")}}
155
+ {{else if hasLabelBlock}}
144
156
  <EuiFormLabel
145
157
  class="euiFormRow__label"
146
158
  aria-invalid={{@isInvalid}}
147
159
  for={{if hasChildLabel rowId}}
148
160
  @isInvalid={{@isInvalid}}
149
161
  @type={{@labelType}}
150
- @isFocused={{and (not @isDisabled) (not isLegend) focusedState.value}}
162
+ @isFocused={{and
163
+ (not @isDisabled)
164
+ (not isLegend)
165
+ focusedState.value
166
+ }}
151
167
  >
152
168
  {{yield @label to="label"}}
153
169
  </EuiFormLabel>
@@ -158,7 +174,11 @@
158
174
  for={{if hasChildLabel rowId}}
159
175
  @isInvalid={{@isInvalid}}
160
176
  @type={{@labelType}}
161
- @isFocused={{and (not @isDisabled) (not isLegend) focusedState.value}}
177
+ @isFocused={{and
178
+ (not @isDisabled)
179
+ (not isLegend)
180
+ focusedState.value
181
+ }}
162
182
  >
163
183
  {{@label}}
164
184
  </EuiFormLabel>
@@ -175,7 +195,12 @@
175
195
  {{else}}
176
196
  {{yield}}
177
197
  {{/if}}
178
- {{#if (or (and (has-block "errors") @isInvalid) (and (gt errors.length 0) @isInvalid))}}
198
+ {{#if
199
+ (or
200
+ (and (has-block "errors") @isInvalid)
201
+ (and (gt errors.length 0) @isInvalid)
202
+ )
203
+ }}
179
204
  {{#if (has-block "errors")}}
180
205
  {{#each errors as |error i|}}
181
206
  <EuiFormErrorText
@@ -202,9 +227,15 @@
202
227
  {{yield to="helpText"}}
203
228
  </EuiFormHelpText>
204
229
  {{else}}
205
- {{#let (if (is-array @helpText) @helpText (array @helpText)) as |helpTexts|}}
230
+ {{#let
231
+ (if (is-array @helpText) @helpText (array @helpText))
232
+ as |helpTexts|
233
+ }}
206
234
  {{#each helpTexts as |helpText i|}}
207
- <EuiFormHelpText id="{{rowId}}-help-{{i}}" class={{@helpTextClasses}}>
235
+ <EuiFormHelpText
236
+ id="{{rowId}}-help-{{i}}"
237
+ class={{@helpTextClasses}}
238
+ >
208
239
  {{helpText}}
209
240
  </EuiFormHelpText>
210
241
  {{/each}}
@@ -214,4 +245,4 @@
214
245
  </div>
215
246
  </div>
216
247
  {{/if}}
217
- {{/let}}
248
+ {{/let}}
@@ -6,6 +6,7 @@
6
6
  @size={{@textSize}}
7
7
  @textAlign={{@textAlign}}
8
8
  {{did-insert this.setRootNode}}
9
+ {{did-update this.update @value}}
9
10
  ...attributes
10
11
  >
11
12
  {{#each this.result.components as |CompNode|}}
@@ -5,7 +5,7 @@ import {
5
5
  } from '../../utils/markdown/plugins/markdown-default-plugins';
6
6
  import { cached, tracked } from '@glimmer/tracking';
7
7
  import unified, { Processor } from 'unified';
8
- import { toDOM } from '../../utils/markdown/plugins/to-dom';
8
+ import { DynamicComponent, toDOM } from '../../utils/markdown/plugins/to-dom';
9
9
  import type { RehypeNode } from '../../utils/markdown/markdown-types';
10
10
  import type EuiMarkdownEditorComponent from '../eui-markdown-editor';
11
11
 
@@ -18,6 +18,14 @@ export interface EuiMarkdownEditorToolbarArgs {
18
18
 
19
19
  export default class EuiMarkdownEditorToolbarComponent extends Component<EuiMarkdownEditorToolbarArgs> {
20
20
  @tracked rootNode?: HTMLDivElement;
21
+ @tracked result?:
22
+ | {
23
+ element: Node | undefined;
24
+ components: DynamicComponent[];
25
+ }
26
+ | string;
27
+
28
+ _lastValue?: string;
21
29
 
22
30
  get parsingPluginList() {
23
31
  return this.args.parsingPluginList || defaultParsingPlugins;
@@ -29,6 +37,7 @@ export default class EuiMarkdownEditorToolbarComponent extends Component<EuiMark
29
37
 
30
38
  setRootNode = (node: HTMLDivElement) => {
31
39
  this.rootNode = node;
40
+ this.update();
32
41
  };
33
42
 
34
43
  @cached
@@ -47,17 +56,19 @@ export default class EuiMarkdownEditorToolbarComponent extends Component<EuiMark
47
56
  .use(identityCompiler);
48
57
  }
49
58
 
50
- @cached
51
- get result() {
59
+ update = () => {
52
60
  if (this.rootNode) {
61
+ if (this.args.value === this._lastValue) return;
62
+ this._lastValue = this.args.value;
63
+ this.rootNode.innerHTML = '';
53
64
  try {
54
65
  const processed = this.processor.processSync(this.args.value);
55
- return toDOM(processed.result as RehypeNode, this.rootNode);
66
+ this.result = toDOM(processed.result as RehypeNode, this.rootNode);
56
67
  //eslint-disable-next-line
57
68
  } catch (e) {
58
- return this.args.value;
69
+ this.result = this.args.value;
59
70
  }
60
71
  }
61
- return this.args.value;
62
- }
72
+ this.result = this.args.value;
73
+ };
63
74
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ember-eui/core",
3
- "version": "5.16.0",
3
+ "version": "5.17.0",
4
4
  "description": "Ember Components for Elastic UI",
5
5
  "keywords": [
6
6
  "ember-addon",
@@ -186,5 +186,5 @@
186
186
  "volta": {
187
187
  "extends": "../../package.json"
188
188
  },
189
- "gitHead": "935bd04cef925daf9e98960727a40e96ea895d3f"
189
+ "gitHead": "eae2162b0c491abe81ec6caf9f42c95e1b55400a"
190
190
  }