@umbraco-ui/uui-combobox 1.1.1 → 1.2.0-rc.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.
@@ -23,6 +23,12 @@
23
23
  "type": " string ",
24
24
  "default": "\"\\\"Close\\\"\""
25
25
  },
26
+ {
27
+ "name": "disabled",
28
+ "description": "Disables the uui-combobox.",
29
+ "type": "boolean",
30
+ "default": "\"false\""
31
+ },
26
32
  {
27
33
  "name": "name",
28
34
  "description": "This is a name property of the component.",
@@ -93,6 +99,13 @@
93
99
  "type": " string ",
94
100
  "default": "\"\\\"Close\\\"\""
95
101
  },
102
+ {
103
+ "name": "disabled",
104
+ "attribute": "disabled",
105
+ "description": "Disables the uui-combobox.",
106
+ "type": "boolean",
107
+ "default": "\"false\""
108
+ },
96
109
  {
97
110
  "name": "formAssociated",
98
111
  "description": "This is a static class field indicating that the element is can be used inside a native form and participate in its events.\nIt may require a polyfill, check support here https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/attachInternals.\nRead more about form controls here https://web.dev/more-capable-form-controls/",
@@ -168,7 +181,7 @@
168
181
  ],
169
182
  "slots": [
170
183
  {
171
- "name": "default",
184
+ "name": "",
172
185
  "description": "for uui-combobox-list-options"
173
186
  },
174
187
  {
package/lib/index.js CHANGED
@@ -28,6 +28,7 @@ let UUIComboboxElement = class extends FormControlMixin(LitElement) {
28
28
  super(...arguments);
29
29
  this.open = false;
30
30
  this.closeLabel = "Close";
31
+ this.disabled = false;
31
32
  this._displayValue = "";
32
33
  this._search = "";
33
34
  this._isPhone = false;
@@ -48,6 +49,12 @@ let UUIComboboxElement = class extends FormControlMixin(LitElement) {
48
49
  this.dispatchEvent(new UUIComboboxEvent(UUIComboboxEvent.SEARCH));
49
50
  this._open();
50
51
  };
52
+ this._onSlotChange = () => {
53
+ var _a;
54
+ if (this.value && this.value !== ((_a = this._comboboxList) == null ? void 0 : _a.value)) {
55
+ this._updateValue(this.value);
56
+ }
57
+ };
51
58
  this._onChange = (e) => {
52
59
  var _a;
53
60
  e.stopImmediatePropagation();
@@ -101,11 +108,12 @@ let UUIComboboxElement = class extends FormControlMixin(LitElement) {
101
108
  type="text"
102
109
  .value=${this._displayValue}
103
110
  autocomplete="off"
111
+ .disabled=${this.disabled}
104
112
  @click=${this._open}
105
113
  @input=${this._onInput}
106
114
  @keydown=${this._onKeyDown}>
107
115
  <slot name="input-prepend" slot="prepend"></slot>
108
- ${this._renderClearButton()} ${this._renderCaret()}
116
+ ${this.disabled ? "" : this._renderClearButton()} ${this._renderCaret()}
109
117
  <slot name="input-append" slot="append"></slot>
110
118
  </uui-input>`;
111
119
  };
@@ -183,17 +191,20 @@ let UUIComboboxElement = class extends FormControlMixin(LitElement) {
183
191
  UUIComboboxListEvent.CHANGE,
184
192
  this._onChange
185
193
  );
186
- if (typeof this.value === "string") {
187
- await this.updateComplete;
188
- this._updateValue(this.value);
189
- }
194
+ this._comboboxList.addEventListener(
195
+ UUIComboboxListEvent.SLOT_CHANGE,
196
+ this._onSlotChange
197
+ );
198
+ await this.updateComplete;
199
+ this._updateValue(this.value);
190
200
  }
191
201
  }
192
202
  _updateValue(value) {
193
- var _a;
194
203
  if (this._comboboxList) {
195
204
  this._comboboxList.value = value;
196
- this._displayValue = ((_a = this._comboboxList) == null ? void 0 : _a.displayValue) || "";
205
+ requestAnimationFrame(
206
+ () => this._displayValue = this._comboboxList.displayValue || ""
207
+ );
197
208
  }
198
209
  }
199
210
  getFormElement() {
@@ -259,6 +270,10 @@ UUIComboboxElement.styles = [
259
270
  margin-top: -1px;
260
271
  }
261
272
 
273
+ :host([disabled]) #caret {
274
+ fill: var(--uui-color-disabled-contrast,#c4c4c4);
275
+ }
276
+
262
277
  #phone-wrapper {
263
278
  position: fixed;
264
279
  inset: 0;
@@ -286,6 +301,9 @@ UUIComboboxElement.styles = [
286
301
  }
287
302
  `
288
303
  ];
304
+ __decorateClass([
305
+ property({ attribute: "value", reflect: true })
306
+ ], UUIComboboxElement.prototype, "value", 1);
289
307
  __decorateClass([
290
308
  property({ type: String })
291
309
  ], UUIComboboxElement.prototype, "search", 1);
@@ -295,6 +313,9 @@ __decorateClass([
295
313
  __decorateClass([
296
314
  property({ type: String })
297
315
  ], UUIComboboxElement.prototype, "closeLabel", 2);
316
+ __decorateClass([
317
+ property({ type: Boolean, reflect: true })
318
+ ], UUIComboboxElement.prototype, "disabled", 2);
298
319
  __decorateClass([
299
320
  query("#combobox-input")
300
321
  ], UUIComboboxElement.prototype, "_input", 2);
@@ -0,0 +1,8 @@
1
+ import { LitElement } from 'lit';
2
+ export declare class UUIComboboxAsyncOptionsExampleElement extends LitElement {
3
+ _options: any[];
4
+ connectedCallback(): void;
5
+ private _fetchData;
6
+ preselected: string;
7
+ render(): import("lit-html").TemplateResult<1>;
8
+ }
@@ -4,7 +4,7 @@ declare const UUIComboboxElement_base: (new (...args: any[]) => import("@umbraco
4
4
  * @element uui-combobox
5
5
  * @fires {UUIComboboxEvent} input - fires when search input is changed
6
6
  * @fires {UUIComboboxEvent} change - fires when selection is changed
7
- * @slot default - for uui-combobox-list-options
7
+ * @slot - for uui-combobox-list-options
8
8
  * @slot input-prepend - prepend for the uui-input
9
9
  * @slot input-append - append for the uui-input
10
10
  * @description - Filterable combobox
@@ -35,6 +35,13 @@ export declare class UUIComboboxElement extends UUIComboboxElement_base {
35
35
  * @default "Close"
36
36
  */
37
37
  closeLabel: string;
38
+ /**
39
+ * Disables the uui-combobox.
40
+ * @type {boolean}
41
+ * @attr
42
+ * @default false
43
+ */
44
+ disabled: boolean;
38
45
  private _input;
39
46
  private _comboboxListElements?;
40
47
  private _comboboxList;
@@ -51,6 +58,7 @@ export declare class UUIComboboxElement extends UUIComboboxElement_base {
51
58
  private _onMouseDown;
52
59
  private _onBlur;
53
60
  private _onInput;
61
+ private _onSlotChange;
54
62
  private _onChange;
55
63
  private _open;
56
64
  private _onClose;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umbraco-ui/uui-combobox",
3
- "version": "1.1.1",
3
+ "version": "1.2.0-rc.1",
4
4
  "license": "MIT",
5
5
  "keywords": [
6
6
  "Umbraco",
@@ -30,11 +30,11 @@
30
30
  "custom-elements.json"
31
31
  ],
32
32
  "dependencies": {
33
- "@umbraco-ui/uui-base": "1.0.0",
34
- "@umbraco-ui/uui-button": "1.0.0",
35
- "@umbraco-ui/uui-combobox-list": "1.0.0",
36
- "@umbraco-ui/uui-icon": "1.0.0",
37
- "@umbraco-ui/uui-scroll-container": "1.0.0"
33
+ "@umbraco-ui/uui-base": "1.2.0-rc.1",
34
+ "@umbraco-ui/uui-button": "1.2.0-rc.1",
35
+ "@umbraco-ui/uui-combobox-list": "1.2.0-rc.1",
36
+ "@umbraco-ui/uui-icon": "1.2.0-rc.1",
37
+ "@umbraco-ui/uui-scroll-container": "1.2.0-rc.1"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "npm run analyze && tsc --build --force && rollup -c rollup.config.js",
@@ -45,5 +45,5 @@
45
45
  "access": "public"
46
46
  },
47
47
  "homepage": "https://uui.umbraco.com/?path=/story/uui-combobox",
48
- "gitHead": "be41090c074658278069302f78f668ad362521fe"
48
+ "gitHead": "c85fbce0370213590f8b60119ac39f0473ffa0fb"
49
49
  }