@ember-eui/core 7.1.1 → 7.1.2

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.
@@ -69,44 +69,44 @@
69
69
  {{/each}}
70
70
  {{/if}}
71
71
  {{#if @searchEnabled}}
72
- {{! template-lint-disable }}
73
72
  {{#if (and this.maybePlaceholder (not @select.searchText))}}
74
73
  <p class="euiComboBoxPlaceholder">
75
74
  {{this.maybePlaceholder}}
76
75
  </p>
77
76
  {{/if}}
78
- <div
79
- class="euiComboBox__input"
80
- style="font-size: 14px; display: inline-block; position: relative;"
81
- >
82
- <input
83
- tabindex="-1"
84
- style="opacity: 0px; width:0px; height:0px; position: absolute; top: 40%; border:solid 1px transparent !important; margin:0px !important;"
85
- class="fake-input-for-html-form-validity"
86
- {{validatable-control @isInvalid}}
87
- />
88
- <input
89
- class="ember-power-select-trigger-multiple-input euiComboBox__input"
90
- autocomplete="off"
91
- autocorrect="off"
92
- autocapitalize="off"
93
- autofocus={{@autoFocus}}
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 }}
77
+
78
+ {{#let
79
+ (component
80
+ "eui-combo-box/trigger/input"
81
+ select=@select
82
+ ariaActiveDescendant=@ariaActiveDescendant
83
+ ariaLabelledBy=@ariaLabelledBy
84
+ ariaLabel=@ariaLabel
85
+ listboxId=@listboxId
86
+ tabindex=@tabindex
87
+ buildSelection=@buildSelection
88
+ placeholder=@placeholder
89
+ placeholderComponent=@placeholderComponent
90
+ searchField=@searchField
91
+ onFocus=@onFocus
92
+ onBlur=@onBlur
93
+ onKeydown=@onKeydown
94
+ onInput=@onInput
95
+ onCreateOption=@onCreateOption
96
+ )
97
+ as |InputComponent|
98
+ }}
99
+ {{component
100
+ (ensure-safe-component @placeholderComponent)
101
+ select=@select
102
+ placeholder=@placeholder
103
+ isMutlipleWithSearch=true
104
+ inputComponent=InputComponent
105
+ displayPlaceholder=(and
106
+ (not @select.searchText) (not @select.selected)
107
+ )
108
+ }}
109
+ {{/let}}
110
110
  {{else}}
111
111
  {{! template-lint-disable }}
112
112
  <div
@@ -117,4 +117,4 @@
117
117
  {{/if}}
118
118
  </ul>
119
119
  </:field>
120
- </EuiFormControlLayout>
120
+ </EuiFormControlLayout>
@@ -1,57 +1,3 @@
1
1
  import EmberPowerSelectMultipleTrigger from 'ember-power-select/components/power-select-multiple/trigger';
2
- import { action } from '@ember/object';
3
- import { isBlank } from '@ember/utils';
4
- import { scheduleOnce } from '@ember/runloop';
5
- import { htmlSafe } from '@ember/template';
6
2
 
7
- export default class EuiComboBoxTriggerComponent extends EmberPowerSelectMultipleTrigger {
8
- get triggerMultipleInputStyle() {
9
- scheduleOnce('actions', null, this.args.select.actions.reposition);
10
-
11
- let textWidth = 0;
12
- if (this.inputFont) {
13
- textWidth = this.textMeasurer.width(
14
- this.args.select.searchText,
15
- this.inputFont
16
- );
17
- }
18
- return htmlSafe(`box-sizing: content-box; width: ${textWidth + 2}px`);
19
- }
20
-
21
- @action
22
- handleKeydown(e) {
23
- if (e.target === null) return;
24
- if (this.args.onKeydown && this.args.onKeydown(e) === false) {
25
- if (
26
- this.args.onCreateOption && //if user wants to create an option and
27
- e.keyCode === 13 && //presses [Enter] and
28
- (this.args.select.options.length === 0 || //If There are no options or
29
- this.args.select.results.length === 0) && //Last search made returned no results and
30
- this.args.select.searchText.length >= 1 //There's something in the searchText box
31
- ) {
32
- this.args.onCreateOption();
33
- return false;
34
- }
35
- e.stopPropagation();
36
- return false;
37
- }
38
- if (e.keyCode === 8) {
39
- e.stopPropagation();
40
- if (isBlank(e.target.value)) {
41
- let lastSelection =
42
- this.args.select.selected[this.args.select.selected.length - 1];
43
- if (lastSelection) {
44
- this.args.select.actions.select(
45
- this.args.buildSelection(lastSelection, this.args.select),
46
- e
47
- );
48
- this.args.select.actions.search('');
49
- this.args.select.actions.open(e);
50
- }
51
- }
52
- } else if ((e.keyCode >= 48 && e.keyCode <= 90) || e.keyCode === 32) {
53
- // Keys 0-9, a-z or SPACE
54
- e.stopPropagation();
55
- }
56
- }
57
- }
3
+ export default class EuiComboBoxTriggerComponent extends EmberPowerSelectMultipleTrigger {}
@@ -0,0 +1,38 @@
1
+ {{!template-lint-disable}}
2
+ {{#if (and this.maybePlaceholder (not @select.searchText))}}
3
+ <p class="euiComboBoxPlaceholder">
4
+ {{this.maybePlaceholder}}
5
+ </p>
6
+ {{/if}}
7
+ <div
8
+ class="euiComboBox__input"
9
+ style="font-size: 14px; display: inline-block; position: relative;"
10
+ >
11
+ <input
12
+ tabindex="-1"
13
+ style="opacity: 0px; width:0px; height:0px; position: absolute; top: 40%; border:solid 1px transparent !important; margin:0px !important;"
14
+ class="fake-input-for-html-form-validity"
15
+ {{validatable-control @isInvalid}}
16
+ />
17
+ <input
18
+ class="ember-power-select-trigger-multiple-input euiComboBox__input"
19
+ autocomplete="off"
20
+ autocorrect="off"
21
+ autocapitalize="off"
22
+ autofocus={{@autoFocus}}
23
+ spellcheck={{false}}
24
+ id="ember-power-select-trigger-multiple-input-{{@select.uniqueId}}"
25
+ value={{@select.searchText}}
26
+ aria-controls={{@listboxId}}
27
+ style={{this.triggerMultipleInputStyle}}
28
+ disabled={{@select.disabled}}
29
+ tabindex={{@tabindex}}
30
+ form="power-select-fake-form"
31
+ {{on "focus" @onFocus}}
32
+ {{on "blur" @onBlur}}
33
+ {{on "input" this.handleInput}}
34
+ {{on "keydown" this.handleKeydown}}
35
+ {{did-insert this.storeInputStyles}}
36
+ />
37
+ </div>
38
+ {{!template-lint-enable}}
@@ -0,0 +1,63 @@
1
+ import EmberPowerSelectPowerSelectMultipleTriggerInputComponent from 'ember-power-select/components/power-select-multiple/input';
2
+ import { action } from '@ember/object';
3
+ import { isBlank } from '@ember/utils';
4
+
5
+ import { htmlSafe } from '@ember/template';
6
+
7
+ import { scheduleOnce } from '@ember/runloop';
8
+
9
+ export default class EuiComboBoxTriggerInputComponent extends EmberPowerSelectPowerSelectMultipleTriggerInputComponent {
10
+ get triggerMultipleInputStyle() {
11
+ scheduleOnce('actions', null, this.args.select.actions.reposition);
12
+
13
+ let textWidth = 0;
14
+ // @ts-expect-error
15
+ if (this.inputFont) {
16
+ textWidth = this.textMeasurer.width(
17
+ this.args.select.searchText,
18
+ // @ts-expect-error
19
+ this.inputFont
20
+ );
21
+ }
22
+ return htmlSafe(`box-sizing: content-box; width: ${textWidth + 2}px`);
23
+ }
24
+
25
+ @action
26
+ handleKeydown(e: KeyboardEvent): false | void {
27
+ if (e.target === null) return;
28
+ if (this.args.onKeydown && this.args.onKeydown(e) === false) {
29
+ if (
30
+ // @ts-expect-error
31
+ this.args.onCreateOption && //if user wants to create an option and
32
+ e.keyCode === 13 && //presses [Enter] and
33
+ (this.args.select.options.length === 0 || //If There are no options or
34
+ this.args.select.results.length === 0) && //Last search made returned no results and
35
+ this.args.select.searchText.length >= 1 //There's something in the searchText box
36
+ ) {
37
+ // @ts-expect-error
38
+ this.args.onCreateOption();
39
+ return false;
40
+ }
41
+ e.stopPropagation();
42
+ return false;
43
+ }
44
+ if (e.keyCode === 8) {
45
+ e.stopPropagation();
46
+ if (isBlank((e.target as HTMLInputElement).value)) {
47
+ let lastSelection =
48
+ this.args.select.selected[this.args.select.selected.length - 1];
49
+ if (lastSelection) {
50
+ this.args.select.actions.select(
51
+ this.args.buildSelection(lastSelection, this.args.select),
52
+ e
53
+ );
54
+ this.args.select.actions.search('');
55
+ this.args.select.actions.open(e);
56
+ }
57
+ }
58
+ } else if ((e.keyCode >= 48 && e.keyCode <= 90) || e.keyCode === 32) {
59
+ // Keys 0-9, a-z or SPACE
60
+ e.stopPropagation();
61
+ }
62
+ }
63
+ }
@@ -0,0 +1 @@
1
+ export { default } from '@ember-eui/core/components/eui-combo-box/trigger/input';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ember-eui/core",
3
- "version": "7.1.1",
3
+ "version": "7.1.2",
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": "e6b8e2ea6871b8a0da0a1792af948185fcba1074"
189
+ "gitHead": "9c16b0e87a391d095b04b549c431a8adbc8c9ddc"
190
190
  }