@ember-eui/core 1.2.3 → 1.3.3

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.
Files changed (78) hide show
  1. package/CHANGELOG.md +25 -4
  2. package/README.md +1 -1
  3. package/addon/components/common.ts +13 -0
  4. package/addon/components/eui-button/index.hbs +2 -0
  5. package/addon/components/eui-button-content/index.hbs +1 -0
  6. package/addon/components/eui-button-empty/index.hbs +2 -0
  7. package/addon/components/eui-button-icon/index.hbs +2 -0
  8. package/addon/components/eui-code/index.hbs +9 -0
  9. package/addon/components/eui-code-block/index.d.ts +2 -0
  10. package/addon/components/eui-code-block/index.hbs +10 -0
  11. package/addon/components/eui-code-block-impl/code-block-controls/index.hbs +33 -0
  12. package/addon/components/eui-code-block-impl/index.hbs +111 -0
  13. package/addon/components/eui-code-block-impl/index.ts +121 -0
  14. package/addon/components/eui-combo-box/index.hbs +3 -2
  15. package/addon/components/eui-combo-box/trigger/index.hbs +118 -112
  16. package/addon/components/eui-copy/index.hbs +8 -0
  17. package/addon/components/eui-copy/index.ts +37 -0
  18. package/addon/components/eui-icon/index.hbs +37 -32
  19. package/addon/components/eui-inner-text/index.hbs +1 -0
  20. package/addon/components/eui-inner-text/index.ts +61 -0
  21. package/addon/components/eui-markdown-editor/index.hbs +63 -0
  22. package/addon/components/eui-markdown-editor/index.ts +221 -0
  23. package/addon/components/eui-markdown-editor-drop-zone/index.hbs +21 -0
  24. package/addon/components/eui-markdown-editor-drop-zone/index.ts +5 -0
  25. package/addon/components/eui-markdown-editor-footer/index.hbs +108 -0
  26. package/addon/components/eui-markdown-editor-footer/index.ts +20 -0
  27. package/addon/components/eui-markdown-editor-text-area/index.hbs +8 -0
  28. package/addon/components/eui-markdown-editor-toolbar/index.hbs +86 -0
  29. package/addon/components/eui-markdown-editor-toolbar/index.ts +97 -0
  30. package/addon/components/eui-markdown-format/index.hbs +13 -0
  31. package/addon/components/eui-markdown-format/index.ts +45 -0
  32. package/addon/components/eui-markdown-format/markdown-checkbox/index.hbs +8 -0
  33. package/addon/components/eui-markdown-format/markdown-checkbox/index.ts +28 -0
  34. package/addon/components/eui-markdown-format/markdown-code/index.hbs +3 -0
  35. package/addon/components/eui-markdown-format/markdown-code-block/index.hbs +7 -0
  36. package/addon/components/eui-markdown-format/markdown-tooltip/index.hbs +8 -0
  37. package/addon/components/markdown-checkmark-icon/index.hbs +0 -0
  38. package/addon/modifiers/get-cursor-node.ts +54 -0
  39. package/addon/modifiers/resize-observer.ts +6 -2
  40. package/addon/utils/copy-to-clipboard.ts +70 -0
  41. package/addon/utils/css-mappings/eui-code-block-impl.ts +24 -0
  42. package/addon/utils/css-mappings/index.ts +2 -0
  43. package/addon/utils/markdown/markdown-actions.ts +616 -0
  44. package/addon/utils/markdown/markdown-modes.ts +23 -0
  45. package/addon/utils/markdown/markdown-types.ts +140 -0
  46. package/addon/utils/markdown/markdown-unified-plugins.d.ts +27 -0
  47. package/addon/utils/markdown/plugins/markdown-add-components.ts +63 -0
  48. package/addon/utils/markdown/plugins/markdown-checkbox.ts +80 -0
  49. package/addon/utils/markdown/plugins/markdown-default-plugins.ts +100 -0
  50. package/addon/utils/markdown/plugins/markdown-tooltip.ts +113 -0
  51. package/addon/utils/markdown/plugins/to-dom.ts +93 -0
  52. package/app/components/eui-code/index.js +1 -0
  53. package/app/components/eui-code-block/index.js +1 -0
  54. package/app/components/eui-code-block-impl/code-block-controls/index.js +1 -0
  55. package/app/components/eui-code-block-impl/index.js +1 -0
  56. package/app/components/eui-copy/index.js +1 -0
  57. package/app/components/eui-inner-text/index.js +1 -0
  58. package/app/components/eui-markdown-editor/index.js +1 -0
  59. package/app/components/eui-markdown-editor-drop-zone/index.js +1 -0
  60. package/app/components/eui-markdown-editor-footer/index.js +1 -0
  61. package/app/components/eui-markdown-editor-text-area/index.js +1 -0
  62. package/app/components/eui-markdown-editor-toolbar/index.js +1 -0
  63. package/app/components/eui-markdown-format/index.js +1 -0
  64. package/app/components/eui-markdown-format/markdown-checkbox/index.js +1 -0
  65. package/app/components/eui-markdown-format/markdown-code/index.js +1 -0
  66. package/app/components/eui-markdown-format/markdown-code-block/index.js +1 -0
  67. package/app/components/eui-markdown-format/markdown-tooltip/index.js +1 -0
  68. package/app/modifiers/get-cursor-node.js +1 -0
  69. package/app/styles/ember-eui.scss +13 -0
  70. package/docs/editors/code/code-block-demo/demo1.md +62 -0
  71. package/docs/editors/code/code-block.md +1 -0
  72. package/docs/editors/code/inline-demo/demo1.md +49 -0
  73. package/docs/editors/code/inline.md +1 -0
  74. package/docs/editors/markdown-editor/base-editor-demo/demo1.md +86 -0
  75. package/docs/editors/markdown-editor/base-editor.md +1 -0
  76. package/package.json +32 -6
  77. package/public/markdown-checkmark.svg +3 -0
  78. package/public/markdown-logo.svg +3 -0
package/CHANGELOG.md CHANGED
@@ -2,17 +2,38 @@
2
2
 
3
3
  ### Master
4
4
 
5
-
6
5
  ### 1.3.0
7
- 🏠 Internal
6
+ 🚀 Enhancements
8
7
  `@ember-eui/core`
9
- - update ember-power-select in order to be able to pass attributes to trigger
8
+ - `<EuiMarkdownEditor />` `<EuiMarkdownFormat />` `<EuiCode />` `<EuiCopy />` `<EuiCodeBlock />`
10
9
 
11
- ### 1.3.0
10
+ `@ember-eui/validated-form`
11
+ - `<Form.FieldMarkdownEditor />`
12
+
13
+
14
+ ### 1.2.6
15
+ 🐛 Bug / Fixes
16
+ - Update ember-svg-jar dependency
17
+
18
+ ### 1.2.5
19
+ 🐛 Bug / Fixes
20
+ `@ember-eui/core`
21
+ - Fix `<EuiComboBox/>` isClereable
22
+
23
+ ### 1.2.4
24
+ 🏠 Internal
25
+ `@ember-eui/changeset-form`,`@ember-eui/validated-form`
26
+ - Pass down isCleareable to <EuiComboBox /> wrapped components
27
+
28
+ ### 1.2.3
12
29
  🚀 Enhancements
13
30
  `@ember-eui/core`
14
31
  - add errorMessage for validatable-control for i18n or so
15
32
 
33
+ 🏠 Internal
34
+ `@ember-eui/core`
35
+ - update ember-power-select in order to be able to pass attributes to trigger
36
+
16
37
  ### 1.2.2
17
38
  🐛 Bug / Fixes
18
39
  `@ember-eui/core`
package/README.md CHANGED
@@ -9,7 +9,7 @@ For icons to work you will need to:
9
9
  - install `ember-svg-jar`
10
10
  - add the following `ember-svg-jar` options to your `ember-cli-build.js`:
11
11
  - NOTICE: we are currently using a fork from ember-svg-jar, for the hbs strategy
12
- `"ember-svg-jar": "github:betocantu93/ember-svg-jar#add-bundle-flag"`
12
+ `"ember-svg-jar": "https://github.com/betocantu93/ember-svg-jar.git#add-bundle-flag"`
13
13
 
14
14
  ```javascript
15
15
  // ember-cli-build.js
@@ -1,3 +1,16 @@
1
+ // utility types:
2
+ /**
3
+ * XOR for some properties applied to a type
4
+ * (XOR is one of these but not both or neither)
5
+ *
6
+ * Usage: OneOf<typeToExtend, one | but | not | multiple | of | these | are | required>
7
+ *
8
+ * To require aria-label or aria-labelledby but not both
9
+ * Example: OneOf<Type, 'aria-label' | 'aria-labelledby'>
10
+ */
11
+ export type OneOf<T, K extends keyof T> = Omit<T, K> &
12
+ { [k in K]: Pick<Required<T>, k> & { [k1 in Exclude<K, k>]?: never } }[K];
13
+
1
14
  export interface CommonArgs {
2
15
  'aria-label'?: string;
3
16
  'data-test-subj'?: string;
@@ -20,6 +20,7 @@
20
20
  @iconType={{@iconType}}
21
21
  @iconSide={{@iconSide}}
22
22
  @iconClasses={{@iconClasses}}
23
+ @useSvg={{@useSvg}}
23
24
  @textClasses={{class-names "euiButton__text" @textClasses}}
24
25
  >
25
26
  {{yield}}
@@ -46,6 +47,7 @@
46
47
  @iconType={{@iconType}}
47
48
  @iconSide={{@iconSide}}
48
49
  @iconClasses={{@iconClasses}}
50
+ @useSvg={{@useSvg}}
49
51
  @textClasses={{class-names "euiButton__text" @textClasses}}
50
52
  >
51
53
  {{yield}}
@@ -12,6 +12,7 @@
12
12
  class="euiButtonContent__icon {{@iconClasses}}"
13
13
  @type={{@iconType}}
14
14
  @size="m"
15
+ @useSvg={{@useSvg}}
15
16
  />
16
17
  {{/if}}
17
18
  <span class={{@textClasses}}>
@@ -17,6 +17,7 @@
17
17
  @iconType={{@iconType}}
18
18
  @iconSide={{@iconSide}}
19
19
  @iconClasses={{@iconClasses}}
20
+ @useSvg={{@useSvg}}
20
21
  @textClasses={{class-names "euiButtonEmpty__text" @textClasses}}
21
22
  >
22
23
  {{yield}}
@@ -42,6 +43,7 @@
42
43
  @iconType={{@iconType}}
43
44
  @iconSide={{@iconSide}}
44
45
  @iconClasses={{@iconClasses}}
46
+ @useSvg={{@useSvg}}
45
47
  @textClasses={{class-names "euiButtonEmpty__text" @textClasses}}
46
48
  >
47
49
  {{yield}}
@@ -10,6 +10,7 @@
10
10
  class="euiButtonIcon__icon {{@iconClasses}}"
11
11
  @type={{@iconType}}
12
12
  @size={{arg-or-default @iconSize "m"}}
13
+ @useSvg={{@useSvg}}
13
14
  aria-hidden="true"
14
15
  />
15
16
  {{/if}}
@@ -27,6 +28,7 @@
27
28
  class="euiButtonIcon__icon {{@iconClasses}}"
28
29
  @type={{@iconType}}
29
30
  @size={{@iconSize}}
31
+ @useSvg={{@useSvg}}
30
32
  aria-hidden="true"
31
33
  />
32
34
  {{/if}}
@@ -0,0 +1,9 @@
1
+ <EuiCodeBlockImpl
2
+ @inline={{true}}
3
+ @language={{@language}}
4
+ @transparentBackground={{@transparentBackground}}
5
+ @overflowHeight={{@overflowHeight}}
6
+ ...attributes
7
+ >
8
+ {{yield}}
9
+ </EuiCodeBlockImpl>
@@ -0,0 +1,2 @@
1
+ export type PaddingSize = 'none' | 's' | 'm' | 'l';
2
+ export type FontSize = 's' | 'm' | 'l';
@@ -0,0 +1,10 @@
1
+ <EuiCodeBlockImpl
2
+ @inline={{false}}
3
+ @language={{@language}}
4
+ @transparentBackground={{@transparentBackground}}
5
+ @isCopyable={{@isCopyable}}
6
+ @overflowHeight={{@overflowHeight}}
7
+ ...attributes
8
+ >
9
+ {{yield}}
10
+ </EuiCodeBlockImpl>
@@ -0,0 +1,33 @@
1
+ {{#if (or (and @isCopyable @innerText) @overflowHeight)}}
2
+ <div class="euiCodeBlock__controls">
3
+ {{#if @overflowHeight}}
4
+ <EuiButtonIcon
5
+ class="euiCodeBlock__fullScreenButton"
6
+ @size="s"
7
+ {{on "click" @toggleFullScreen}}
8
+ @iconType={{if @isFullScreen "cross" "fullScreen"}}
9
+ @color="text"
10
+ aria-label={{if @isFullScreen "Collapse" "Expand"}}
11
+ />
12
+
13
+ {{/if}}
14
+ {{#if (and @isCopyable @innerText)}}
15
+ <div class="euiCodeBlock__copyButton">
16
+ <EuiCopy
17
+ @textToCopy={{@innerText}}
18
+ @beforeMessage="Copy"
19
+ @afterMessage="Copied"
20
+ as |copy|
21
+ >
22
+ <EuiButtonIcon
23
+ @size="s"
24
+ {{on "click" copy}}
25
+ @iconType="copy"
26
+ @color="text"
27
+ aria-label="Copy"
28
+ />
29
+ </EuiCopy>
30
+ </div>
31
+ {{/if}}
32
+ </div>
33
+ {{/if}}
@@ -0,0 +1,111 @@
1
+ {{#let
2
+ (class-names
3
+ "euiCodeBlock__pre"
4
+ (if (eq this.whiteSpace "pre") "euiCodeBlock__pre--whiteSpacePre")
5
+ (if (eq this.whiteSpace "pre-wrap") "euiCodeBlock__pre--whiteSpacePreWrap")
6
+ )
7
+ (class-names "euiCodeBlock__code" @language)
8
+ (class-names
9
+ "euiCodeBlock"
10
+ (if this.transparentBackground "euiCodeBlock--transparentBackground")
11
+ (if @inline "euiCodeBlock--inline")
12
+ (if (or @isCopyable @overflowHeight) "euiCodeBlock--hasControls")
13
+ componentName="EuiCodeBlockImpl"
14
+ paddingSize=this.paddingSize
15
+ fontSize=this.fontSize
16
+ )
17
+ as |preClasses codeClasses classes|
18
+ }}
19
+ {{#if @inline}}
20
+ {{#if this.isPortalTargetReady}}
21
+ {{#in-element this.codeTarget}}
22
+ {{yield}}
23
+ {{/in-element}}
24
+ <span
25
+ class={{classes}}
26
+ {{style (if @overflowHeight (hash maxHeight=@overflowHeight))}}
27
+ ><code
28
+ {{did-insert (set this "code")}}
29
+ class={{codeClasses}}
30
+ ></code></span>
31
+ {{/if}}
32
+ {{else}}
33
+ {{! Not inline }}
34
+ {{#if this.isPortalTargetReady}}
35
+ {{#in-element this.codeTarget}}
36
+ {{yield}}
37
+ {{/in-element}}
38
+ <EuiInnerText @fallback="" as |setRef innerText|>
39
+ <div
40
+ class={{classes}}
41
+ {{style (if @overflowHeight (hash maxHeight=@overflowHeight))}}
42
+ >
43
+ <pre
44
+ {{did-insert setRef}}
45
+ class={{preClasses}}
46
+ {{style (if @overflowHeight (hash maxHeight=@overflowHeight))}}
47
+ ><code
48
+ {{did-insert (set this "code")}}
49
+ class={{codeClasses}}
50
+ ></code></pre>
51
+
52
+ <EuiCodeBlockImpl::CodeBlockControls
53
+ @innerText={{innerText}}
54
+ @isCopyable={{@isCopyable}}
55
+ @overflowHeight={{@overflowHeight}}
56
+ @toggleFullScreen={{set this "isFullScreen" (not this.isFullScreen)}}
57
+ @isFullScreen={{this.isFullScreen}}
58
+ />
59
+
60
+ {{#if this.isFullScreen}}
61
+ <EuiOverlayMask>
62
+ <div
63
+ {{focus-trap
64
+ isActive=true
65
+ focusTrapOptions=(hash
66
+ clickOutsideDeactivates=true returnFocusOnDeactivate=true
67
+ )
68
+ }}
69
+ >
70
+ <div
71
+ class={{class-names
72
+ "euiCodeBlock euiCodeBlock-paddingLarge euiCodeBlock-isFullScreen"
73
+ fontSize=this.fontSize
74
+ componentName="EuiCodeBlockImpl"
75
+ }}
76
+ >
77
+ <pre class={{preClasses}}>
78
+ {{!template-lint-disable}}
79
+ <code
80
+ {{did-insert
81
+ (queue (set this "codeFullScreen") this.update)
82
+ }}
83
+ {{will-destroy (set this "codeFullScreen" null)}}
84
+ {{did-update this.update @language}}
85
+ class={{codeClasses}}
86
+ tabIndex={{0}}
87
+ tabIndex={{0}}
88
+ {{on "keydown" this.onKeyDown}}
89
+ ></code>
90
+ {{!template-lint-enable}}
91
+ </pre>
92
+ <EuiCodeBlockImpl::CodeBlockControls
93
+ @innerText={{innerText}}
94
+ @isCopyable={{@isCopyable}}
95
+ @overflowHeight={{@overflowHeight}}
96
+ @toggleFullScreen={{set
97
+ this
98
+ "isFullScreen"
99
+ (not this.isFullScreen)
100
+ }}
101
+ @isFullScreen={{this.isFullScreen}}
102
+ />
103
+ </div>
104
+ </div>
105
+ </EuiOverlayMask>
106
+ {{/if}}
107
+ </div>
108
+ </EuiInnerText>
109
+ {{/if}}
110
+ {{/if}}
111
+ {{/let}}
@@ -0,0 +1,121 @@
1
+ import Component from '@glimmer/component';
2
+ import { action } from '@ember/object';
3
+ import { tracked } from '@glimmer/tracking';
4
+ import { argOrDefaultDecorator as argOrDefault } from '../../helpers/arg-or-default';
5
+ import { PaddingSize, FontSize } from '../eui-code-block';
6
+ //@ts-ignore
7
+ import hljs from 'highlight.js';
8
+ import { keys } from '../../utils/keys';
9
+ import { scheduleOnce } from '@ember/runloop';
10
+
11
+ type EuiCodeImplArgs = {
12
+ fontSize?: FontSize;
13
+
14
+ /**
15
+ * Displays the passed code in an inline format. Also removes any margins set.
16
+ */
17
+ inline?: boolean;
18
+
19
+ /**
20
+ * Displays an icon button to copy the code snippet to the clipboard.
21
+ */
22
+ isCopyable?: boolean;
23
+
24
+ /**
25
+ * Sets the syntax highlighting for a specific language
26
+ */
27
+ language?: string;
28
+ overflowHeight?: number;
29
+ paddingSize?: PaddingSize;
30
+ transparentBackground?: boolean;
31
+ /**
32
+ * Specify how `white-space` inside the element is handled.
33
+ * `pre` respects line breaks/white space but doesn't force them to wrap the line
34
+ * `pre-wrap` respects line breaks/white space but does force them to wrap the line when necessary.
35
+ */
36
+ whiteSpace?: 'pre' | 'pre-wrap';
37
+ };
38
+
39
+ export default class EuiAccordionAccordionComponent extends Component<EuiCodeImplArgs> {
40
+ // Defaults
41
+ @argOrDefault(false) declare transparentBackground: boolean;
42
+ @argOrDefault('l') declare paddingSize: string;
43
+ @argOrDefault('s') declare fontSize: string;
44
+ @argOrDefault(false) declare isCopyable: boolean;
45
+ @argOrDefault('pre-wrap') declare whiteSpace: string;
46
+
47
+ @tracked isFullScreen: boolean = false;
48
+ @tracked isPortalTargetReady: boolean = false;
49
+ @tracked codeTarget: HTMLDivElement | null = null;
50
+ @tracked code: HTMLElement | null = null;
51
+ @tracked codeFullScreen: HTMLElement | null = null;
52
+
53
+ observer: MutationObserver | null = null;
54
+
55
+ constructor(owner: unknown, args: EuiCodeImplArgs) {
56
+ super(owner, args);
57
+ this.codeTarget = document.createElement('div');
58
+ this.isPortalTargetReady = true;
59
+ this.setupObserver();
60
+ }
61
+
62
+ setupObserver() {
63
+ this.observer?.disconnect();
64
+ this.observer = new MutationObserver((mutationsList) => {
65
+ if (mutationsList.length) this.update();
66
+ });
67
+ if (this.codeTarget) {
68
+ this.update();
69
+ this.observer.observe(this.codeTarget, {
70
+ characterData: true,
71
+ subtree: true,
72
+ childList: true
73
+ });
74
+ }
75
+ }
76
+
77
+ willDestroy(): void {
78
+ this.observer?.disconnect();
79
+ }
80
+
81
+ @action
82
+ update() {
83
+ const render = () => {
84
+ const language = this.args.language;
85
+ const html = (
86
+ this.isPortalTargetReady && this.codeTarget?.innerHTML
87
+ ? this.codeTarget.innerHTML
88
+ : ''
89
+ ).trim();
90
+
91
+ const code = this.code;
92
+
93
+ if (code) {
94
+ code.innerHTML = html;
95
+ }
96
+
97
+ if (language) {
98
+ if (code) {
99
+ hljs.highlightBlock(code);
100
+ }
101
+ }
102
+
103
+ if (this.codeFullScreen) {
104
+ this.codeFullScreen.innerHTML = html;
105
+ if (language) {
106
+ hljs.highlightBlock(this.codeFullScreen);
107
+ }
108
+ }
109
+ };
110
+ scheduleOnce('afterRender', this, render);
111
+ }
112
+
113
+ @action
114
+ onKeyDown(event: KeyboardEvent): void {
115
+ if (event.key === keys.ESCAPE) {
116
+ event.preventDefault();
117
+ event.stopPropagation();
118
+ this.isFullScreen = false;
119
+ }
120
+ }
121
+ }
@@ -27,6 +27,7 @@
27
27
  onCreateOption=(if
28
28
  @onCreateOption (pipe this.onCreateOption @onCreateOption)
29
29
  )
30
+ isClearable=@isClearable
30
31
  }}
31
32
  @matcher={{@matcher}}
32
33
  @initiallyOpen={{@initiallyOpen}}
@@ -81,8 +82,8 @@
81
82
  )
82
83
  (component "eui-combo-box/no-matches-message")
83
84
  }}
84
- @dropdownClass="euiComboBoxOptionsList euiPanel euiPanel euiPanel--borderRadiusMedium euiPanel--noShadow euiPanel--plain euiPopover__panel-isAttached euiPopover__panel-noArrow euiPopover__panel--bottom euiPopover__panel-isOpen euiComboBoxOptionsList__rowWrap
85
- {{@dropdownClass}}" as |option i|
85
+ @dropdownClass="euiComboBoxOptionsList euiPanel euiPanel euiPanel--borderRadiusMedium euiPanel--noShadow euiPanel--plain euiPopover__panel-isAttached euiPopover__panel-noArrow euiPopover__panel--bottom euiPopover__panel-isOpen euiComboBoxOptionsList__rowWrap {{@dropdownClass}}"
86
+ as |option i|
86
87
  >
87
88
  {{yield option i}}
88
89
  </PowerSelectMultiple>
@@ -1,115 +1,121 @@
1
- <EuiFormControlLayout
2
- @icon="arrowDown"
3
- @iconSide="right"
4
- @fullWidth={{@fullWidth}}
5
- @compressed={{@compressed}}
6
- @readOnly={{@readOnly}}
7
- @clear={{if (and @select.selected @onClear) @onClear}}
8
- @disabled={{@select.disabled}}
9
- >
10
- <:field>
11
- {{! template-lint-disable }}
12
- <ul
13
- id="ember-power-select-multiple-options-{{@select.uniqueId}}"
14
- class={{class-names
15
- "euiComboBox__inputWrap ember-power-select-multiple-options"
16
- (if @compressed "euiComboBox__inputWrap--compressed")
17
- (if @fullWidth "euiComboBox__inputWrap--fullWidth")
18
- (if @singleSelection "euiComboBox__inputWrap--noWrap")
19
- (if @isLoading "euiComboBox__inputWrap--isLoading")
20
- (if @onClear "euiComboBox__inputWrap--isClearable")
21
- }}
22
- ...attributes
23
- {{did-update this.openChanged @select.isOpen}}
24
- {{on "touchstart" this.chooseOption}}
25
- {{on "mousedown" this.chooseOption}}
26
- >
27
- {{! template-lint-enable }}
28
- {{#if
29
- (or
30
- (and @singleSelection (not @select.searchText)) (not @singleSelection)
31
- )
32
- }}
33
- {{#each @select.selected as |opt idx|}}
34
- {{#if @selectedItemComponent}}
35
- {{component
36
- @selectedItemComponent
37
- extra=@extra
38
- option=opt
39
- select=@select
40
- }}
41
- {{else}}
42
- <EuiComboBoxPill
43
- class="ember-power-select-multiple-option
44
- {{if
45
- opt.disabled
46
- "ember-power-select-multiple-option--disabled"
47
- }}"
48
- @option={{opt}}
49
- @onClose={{if
50
- (or @select.disabled @singleSelection)
51
- false
52
- (if @onClose (fn (optional @onClose) opt) true)
1
+ {{#let (arg-or-default @isClearable true) as |isClearable|}}
2
+ <EuiFormControlLayout
3
+ @icon="arrowDown"
4
+ @iconSide="right"
5
+ @fullWidth={{@fullWidth}}
6
+ @compressed={{@compressed}}
7
+ @readOnly={{@readOnly}}
8
+ @clear={{if
9
+ (and @select.selected isClearable)
10
+ (fn @select.actions.select (array))
11
+ }}
12
+ @disabled={{@select.disabled}}
13
+ >
14
+ <:field>
15
+ {{! template-lint-disable }}
16
+ <ul
17
+ id="ember-power-select-multiple-options-{{@select.uniqueId}}"
18
+ class={{class-names
19
+ "euiComboBox__inputWrap ember-power-select-multiple-options"
20
+ (if @compressed "euiComboBox__inputWrap--compressed")
21
+ (if @fullWidth "euiComboBox__inputWrap--fullWidth")
22
+ (if @singleSelection "euiComboBox__inputWrap--noWrap")
23
+ (if @isLoading "euiComboBox__inputWrap--isLoading")
24
+ (if isClearable "euiComboBox__inputWrap-isClearable")
25
+ }}
26
+ ...attributes
27
+ {{did-update this.openChanged @select.isOpen}}
28
+ {{on "touchstart" this.chooseOption}}
29
+ {{on "mousedown" this.chooseOption}}
30
+ >
31
+ {{! template-lint-enable }}
32
+ {{#if
33
+ (or
34
+ (and @singleSelection (not @select.searchText))
35
+ (not @singleSelection)
36
+ )
37
+ }}
38
+ {{#each @select.selected as |opt idx|}}
39
+ {{#if @selectedItemComponent}}
40
+ {{component
41
+ @selectedItemComponent
42
+ extra=@extra
43
+ option=opt
44
+ select=@select
53
45
  }}
54
- @dataSelectedIconIndex={{idx}}
55
- @color={{opt.color}}
56
- @asPlainText={{@singleSelection.asPlainText}}
57
- >
58
- {{yield opt @select}}
59
- </EuiComboBoxPill>
46
+ {{else}}
47
+ <EuiComboBoxPill
48
+ class="ember-power-select-multiple-option
49
+ {{if
50
+ opt.disabled
51
+ "ember-power-select-multiple-option--disabled"
52
+ }}"
53
+ @option={{opt}}
54
+ @onClose={{if
55
+ (or @select.disabled @singleSelection)
56
+ false
57
+ (if @onClose (fn (optional @onClose) opt) true)
58
+ }}
59
+ @dataSelectedIconIndex={{idx}}
60
+ @color={{opt.color}}
61
+ @asPlainText={{@singleSelection.asPlainText}}
62
+ >
63
+ {{yield opt @select}}
64
+ </EuiComboBoxPill>
65
+ {{/if}}
66
+ {{else if (and @placeholder (not @searchEnabled))}}
67
+ <span class="ember-power-select-placeholder">
68
+ {{@placeholder}}
69
+ </span>
70
+ {{/each}}
71
+ {{/if}}
72
+ {{#if @searchEnabled}}
73
+ {{! template-lint-disable }}
74
+ {{#if (and this.maybePlaceholder (not @select.searchText))}}
75
+ <p class="euiComboBoxPlaceholder">
76
+ {{this.maybePlaceholder}}
77
+ </p>
60
78
  {{/if}}
61
- {{else if (and @placeholder (not @searchEnabled))}}
62
- <span class="ember-power-select-placeholder">
63
- {{@placeholder}}
64
- </span>
65
- {{/each}}
66
- {{/if}}
67
- {{#if @searchEnabled}}
68
- {{! template-lint-disable }}
69
- {{#if (and this.maybePlaceholder (not @select.searchText))}}
70
- <p class="euiComboBoxPlaceholder">
71
- {{this.maybePlaceholder}}
72
- </p>
79
+ <div
80
+ class="euiComboBox__input"
81
+ style="font-size: 14px; display: inline-block; position: relative;"
82
+ >
83
+ <input
84
+ tabindex="-1"
85
+ style="opacity: 0px; width:0px; height:0px; position: absolute; top: 40%; border:solid 1px transparent !important; margin:0px !important;"
86
+ class="fake-input-for-html-form-validity"
87
+ {{validatable-control @isInvalid}}
88
+ />
89
+ <input
90
+ class="ember-power-select-trigger-multiple-input euiComboBox__input"
91
+ autocomplete="off"
92
+ autocorrect="off"
93
+ autocapitalize="off"
94
+ spellcheck={{false}}
95
+ id="ember-power-select-trigger-multiple-input-{{@select.uniqueId}}"
96
+ value={{@select.searchText}}
97
+ aria-controls={{@listboxId}}
98
+ style={{this.triggerMultipleInputStyle}}
99
+ disabled={{@select.disabled}}
100
+ tabindex={{@tabindex}}
101
+ form="power-select-fake-form"
102
+ {{on "focus" @onFocus}}
103
+ {{on "blur" @onBlur}}
104
+ {{on "input" this.handleInput}}
105
+ {{on "keydown" this.handleKeydown}}
106
+ {{did-insert this.storeInputStyles}}
107
+ />
108
+ </div>
109
+ {{! template-lint-enable }}
110
+ {{else}}
111
+ {{! template-lint-disable }}
112
+ <div
113
+ class="euiComboBox__input"
114
+ style="font-size: 14px; display: inline-block;"
115
+ ></div>
116
+ {{! template-lint-enable }}
73
117
  {{/if}}
74
- <div
75
- class="euiComboBox__input"
76
- style="font-size: 14px; display: inline-block; position: relative;"
77
- >
78
- <input
79
- tabindex="-1"
80
- style="opacity: 0px; width:0px; height:0px; position: absolute; top: 40%; border:solid 1px transparent !important; margin:0px !important;"
81
- class="fake-input-for-html-form-validity"
82
- {{validatable-control @isInvalid}}
83
- />
84
- <input
85
- class="ember-power-select-trigger-multiple-input euiComboBox__input"
86
- autocomplete="off"
87
- autocorrect="off"
88
- autocapitalize="off"
89
- spellcheck={{false}}
90
- id="ember-power-select-trigger-multiple-input-{{@select.uniqueId}}"
91
- value={{@select.searchText}}
92
- aria-controls={{@listboxId}}
93
- style={{this.triggerMultipleInputStyle}}
94
- disabled={{@select.disabled}}
95
- tabindex={{@tabindex}}
96
- form="power-select-fake-form"
97
- {{on "focus" @onFocus}}
98
- {{on "blur" @onBlur}}
99
- {{on "input" this.handleInput}}
100
- {{on "keydown" this.handleKeydown}}
101
- {{did-insert this.storeInputStyles}}
102
- />
103
- </div>
104
- {{! template-lint-enable }}
105
- {{else}}
106
- {{! template-lint-disable }}
107
- <div
108
- class="euiComboBox__input"
109
- style="font-size: 14px; display: inline-block;"
110
- ></div>
111
- {{! template-lint-enable }}
112
- {{/if}}
113
- </ul>
114
- </:field>
115
- </EuiFormControlLayout>
118
+ </ul>
119
+ </:field>
120
+ </EuiFormControlLayout>
121
+ {{/let}}