@sankhyalabs/ezui 0.0.0-bugfix-dev-KB-81596.1 → 0.0.0-bugfix-dev-KB-87154.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.
Files changed (43) hide show
  1. package/dist/cjs/{ez-dropdown_2.cjs.entry.js → ez-dropdown.cjs.entry.js} +0 -61
  2. package/dist/cjs/ez-search-plus.cjs.entry.js +43 -14
  3. package/dist/cjs/ez-search-result-list.cjs.entry.js +2 -3
  4. package/dist/cjs/ez-skeleton.cjs.entry.js +67 -0
  5. package/dist/cjs/ez-text-input.cjs.entry.js +39 -27
  6. package/dist/cjs/ez-tooltip.cjs.entry.js +8 -3
  7. package/dist/cjs/ezui.cjs.js +1 -1
  8. package/dist/cjs/index-a7b0c73d.js +6 -2
  9. package/dist/cjs/loader.cjs.js +1 -1
  10. package/dist/collection/components/ez-search-plus/ez-search-plus.css +1 -1
  11. package/dist/collection/components/ez-search-plus/ez-search-plus.js +51 -19
  12. package/dist/collection/components/ez-search-plus/subcomponent/ez-search-result-list/ez-search-result-list.css +4 -10
  13. package/dist/collection/components/ez-search-plus/subcomponent/ez-search-result-list/ez-search-result-list.js +1 -2
  14. package/dist/collection/components/ez-text-input/ez-text-input.css +3 -1
  15. package/dist/collection/components/ez-text-input/ez-text-input.js +40 -26
  16. package/dist/collection/components/ez-tooltip/ez-tooltip.css +1 -0
  17. package/dist/collection/components/ez-tooltip/ez-tooltip.js +29 -6
  18. package/dist/custom-elements/index.js +94 -49
  19. package/dist/esm/{ez-dropdown_2.entry.js → ez-dropdown.entry.js} +1 -61
  20. package/dist/esm/ez-search-plus.entry.js +43 -14
  21. package/dist/esm/ez-search-result-list.entry.js +2 -3
  22. package/dist/esm/ez-skeleton.entry.js +63 -0
  23. package/dist/esm/ez-text-input.entry.js +39 -27
  24. package/dist/esm/ez-tooltip.entry.js +8 -3
  25. package/dist/esm/ezui.js +1 -1
  26. package/dist/esm/index-baa5e267.js +6 -2
  27. package/dist/esm/loader.js +1 -1
  28. package/dist/ezui/ezui.esm.js +1 -1
  29. package/dist/ezui/p-2a0b2c5e.entry.js +1 -0
  30. package/dist/ezui/p-2b4df33d.entry.js +1 -0
  31. package/dist/ezui/p-4cf0aaeb.entry.js +1 -0
  32. package/dist/ezui/{p-3176a6ef.entry.js → p-61ac2054.entry.js} +1 -1
  33. package/dist/ezui/p-6825bdc7.entry.js +1 -0
  34. package/dist/ezui/p-7742802c.entry.js +1 -0
  35. package/dist/types/components/ez-search-plus/ez-search-plus.d.ts +6 -4
  36. package/dist/types/components/ez-text-input/ez-text-input.d.ts +6 -2
  37. package/dist/types/components/ez-tooltip/ez-tooltip.d.ts +6 -2
  38. package/dist/types/components.d.ts +19 -11
  39. package/package.json +1 -1
  40. package/dist/ezui/p-2f45506d.entry.js +0 -1
  41. package/dist/ezui/p-81145609.entry.js +0 -1
  42. package/dist/ezui/p-9142b27a.entry.js +0 -1
  43. package/dist/ezui/p-c5df78be.entry.js +0 -1
@@ -2,6 +2,7 @@ import { h, Host } from "@stencil/core";
2
2
  import { ElementIDUtils, MaskFormatter } from "@sankhyalabs/core";
3
3
  export class EzTextInput {
4
4
  constructor() {
5
+ this._isOverflowing = false;
5
6
  this.label = undefined;
6
7
  this.value = undefined;
7
8
  this.enabled = true;
@@ -17,29 +18,11 @@ export class EzTextInput {
17
18
  this.autoFocus = false;
18
19
  this.hasRightSlotContent = false;
19
20
  }
20
- observeHasInvalid() {
21
- if (!this._inputElem)
21
+ observeHasInvalid(newValue, oldValue) {
22
+ if (newValue === oldValue) {
22
23
  return;
23
- if (this.hasInvalid) {
24
- this._inputElem.classList.add("hasError");
25
- }
26
- else {
27
- this._inputElem.classList.remove("hasError");
28
- }
29
- }
30
- observeErrorMessage() {
31
- if (this._inputElem) {
32
- this.isInvalid().then((hasError) => {
33
- if (hasError) {
34
- this._inputElem.classList.add("hasError");
35
- // this._tooltipPositioningObserver?.observe(this._inputElem);
36
- }
37
- else {
38
- this._inputElem.classList.remove("hasError");
39
- // this.removeGlobalTooltip();
40
- }
41
- });
42
24
  }
25
+ this.validateErrors();
43
26
  }
44
27
  observeMask() {
45
28
  if (this.mask) {
@@ -57,6 +40,7 @@ export class EzTextInput {
57
40
  this._inputElem.value = this.value || "";
58
41
  this.handleChange();
59
42
  this.adjustFloatingLabel();
43
+ this.checkIsOverflowing();
60
44
  if (!this.isSlaveMode()) {
61
45
  this.errorMessage = "";
62
46
  this.ezChange.emit(this.value);
@@ -67,6 +51,25 @@ export class EzTextInput {
67
51
  //---------------------------------------------
68
52
  // Private methods
69
53
  //---------------------------------------------
54
+ validateErrors() {
55
+ const hasErrorMessage = this.handleValidateErrorMessage(this.errorMessage);
56
+ const hasError = this.canShowError && (hasErrorMessage || this.hasInvalid);
57
+ this.updateClassError(hasError);
58
+ }
59
+ handleValidateErrorMessage(message = this.errorMessage) {
60
+ return typeof message === "string" && message.trim() !== "";
61
+ }
62
+ updateClassError(status) {
63
+ if (!this._inputElem) {
64
+ return;
65
+ }
66
+ if (status) {
67
+ this._inputElem.classList.add("hasError");
68
+ }
69
+ else {
70
+ this._inputElem.classList.remove("hasError");
71
+ }
72
+ }
70
73
  adjustFloatingLabel() {
71
74
  if (this.label && this._labelElem) {
72
75
  if (this._inputElem && !this._inputElem.classList.contains("input--with--label")) {
@@ -125,7 +128,7 @@ export class EzTextInput {
125
128
  * Retorna se o conteúdo é inválido.
126
129
  */
127
130
  async isInvalid() {
128
- return typeof this.errorMessage === "string" && this.errorMessage.trim() !== "";
131
+ return this.handleValidateErrorMessage();
129
132
  }
130
133
  //---------------------------------------------
131
134
  // Event handlers
@@ -236,7 +239,7 @@ export class EzTextInput {
236
239
  }
237
240
  slot.name && ElementIDUtils.addIDInfo(content, slot.name);
238
241
  }
239
- this.observeErrorMessage();
242
+ this.validateErrors();
240
243
  }
241
244
  doFocus() {
242
245
  if (this.label && this._labelElem && !this._labelElem.classList.contains("input__label--floated")) {
@@ -247,6 +250,13 @@ export class EzTextInput {
247
250
  getValue() {
248
251
  return this.mask && this.cleanValueMask ? this.applyMask(this.value) : this.value;
249
252
  }
253
+ checkIsOverflowing() {
254
+ if (this._inputElem) {
255
+ this._isOverflowing = this._inputElem.offsetWidth < this._inputElem.scrollWidth;
256
+ return;
257
+ }
258
+ this._isOverflowing = false;
259
+ }
250
260
  //---------------------------------------------
251
261
  // Lifecycle web component
252
262
  //---------------------------------------------
@@ -274,10 +284,11 @@ export class EzTextInput {
274
284
  }
275
285
  componentDidLoad() {
276
286
  var _a;
277
- this.observeErrorMessage();
287
+ this.validateErrors();
278
288
  this.observeMask();
279
289
  this.adjustFloatingLabel();
280
290
  this.adjustBorderInput();
291
+ this.checkIsOverflowing();
281
292
  if (this.autoFocus) {
282
293
  requestAnimationFrame(() => {
283
294
  this.setFocus({ selectText: true });
@@ -292,7 +303,7 @@ export class EzTextInput {
292
303
  ElementIDUtils.addIDInfoIfNotExists(this._hostElement, 'input');
293
304
  return (h(Host, { style: this._hostElement.classList.contains("grid_editor") ? { "height": "100%" } : null }, h("slot", { name: "leftIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } }), this.label && this.mode != "slim" ?
294
305
  h("label", { ref: (el) => this._labelElem = el, class: `${this.enabled ? "input__label" : "input__label input__label--disabled"} ${this.errorMessage ? "hasError" : ""}`, onClick: () => this._inputElem.focus(), title: this.label }, this.label)
295
- : null, h("input", { "data-element-id": ElementIDUtils.getInternalIDInfo("input"), onFocus: () => this.doFocus(), ref: (el) => this._inputElem = el, type: this.password ? "password" : "text", class: `${this.mode === "slim" ? "input--slim" : ""}`, placeholder: this.mode === "slim" && this.label ? this.label : "", value: this.getValue(), disabled: !this.enabled, onInput: () => { this.handleChange(); }, onFocusout: () => { this.handleFocusout(); } }), h("ez-tooltip", { anchoringElement: this._hostElement, message: this.getValue(), minWidth: 30 }), this.canShowError && this.mode != "slim" && this.errorMessage &&
306
+ : null, h("input", { "data-element-id": ElementIDUtils.getInternalIDInfo("input"), onFocus: () => this.doFocus(), ref: (el) => this._inputElem = el, type: this.password ? "password" : "text", class: `${this.mode === "slim" ? "input--slim" : ""}`, placeholder: this.mode === "slim" && this.label ? this.label : "", value: this.getValue(), disabled: !this.enabled, onInput: () => { this.handleChange(); }, onFocusout: () => { this.handleFocusout(); } }), h("ez-tooltip", { anchoringElement: this._hostElement, message: this.getValue(), active: this._isOverflowing, useAnchorSize: true }), this.canShowError && this.mode != "slim" && this.errorMessage &&
296
307
  h("ez-tooltip", { type: "error", message: this.errorMessage }, h("ez-icon", { class: `tooltip-icon ${this.errorMessage ? "hasError" : ""} ${this.hasRightSlotContent ? "rightIconSlot" : ""}`, "data-element-id": ElementIDUtils.getInternalIDInfo("tooltip-icon"), ref: (el) => this._tooltipIconElem = el, iconName: "alert-circle" })), h("slot", { name: "rightIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } }, " ")));
297
308
  }
298
309
  static get is() { return "ez-text-input"; }
@@ -628,7 +639,10 @@ export class EzTextInput {
628
639
  "methodName": "observeHasInvalid"
629
640
  }, {
630
641
  "propName": "errorMessage",
631
- "methodName": "observeErrorMessage"
642
+ "methodName": "observeHasInvalid"
643
+ }, {
644
+ "propName": "canShowError",
645
+ "methodName": "observeHasInvalid"
632
646
  }, {
633
647
  "propName": "mask",
634
648
  "methodName": "observeMask"
@@ -12,6 +12,7 @@
12
12
  font-size: var(--text--small, 12px);
13
13
  font-weight: var(--text-weight--medium, 400);
14
14
  text-align: center;
15
+ width: max-content;
15
16
  /* Initially hide the tooltip */
16
17
  display: none;
17
18
  }
@@ -11,7 +11,8 @@ export class EzTooltip {
11
11
  this.type = 'default';
12
12
  this.debouncingTime = 500;
13
13
  this.active = true;
14
- this.minWidth = 150;
14
+ this.maxWidth = 200;
15
+ this.useAnchorSize = false;
15
16
  }
16
17
  watchAnchoringElement(newValue, oldValue) {
17
18
  if (newValue) {
@@ -47,6 +48,10 @@ export class EzTooltip {
47
48
  if (!element || !this._opened) {
48
49
  return;
49
50
  }
51
+ if (this.useAnchorSize) {
52
+ const anchorSize = element.getBoundingClientRect().width;
53
+ this._tooltipElement.style.width = `${anchorSize}px`;
54
+ }
50
55
  await computePosition(element, this._tooltipElement, {
51
56
  placement: this.placement,
52
57
  middleware: [
@@ -108,7 +113,7 @@ export class EzTooltip {
108
113
  "tooltip": true,
109
114
  [`${this.type}-tooltip`]: true,
110
115
  }, style: {
111
- minWidth: `${this.minWidth}px`
116
+ maxWidth: (this.maxWidth && !this.useAnchorSize) ? `${this.maxWidth}px` : undefined,
112
117
  }, role: "tooltip", "data-element-id": ElementIDUtils.getInternalIDInfo("tooltip") }), this.message, h("div", { ref: ref => this._arrowElement = ref, class: "arrow" })), h("slot", { onSlotchange: (ev) => { this.handleSlotChange(ev); } })));
113
118
  }
114
119
  static get is() { return "ez-tooltip"; }
@@ -254,7 +259,7 @@ export class EzTooltip {
254
259
  "reflect": false,
255
260
  "defaultValue": "true"
256
261
  },
257
- "minWidth": {
262
+ "maxWidth": {
258
263
  "type": "number",
259
264
  "mutable": false,
260
265
  "complexType": {
@@ -266,11 +271,29 @@ export class EzTooltip {
266
271
  "optional": false,
267
272
  "docs": {
268
273
  "tags": [],
269
- "text": "Define a largura m\u00EDnima do elemento."
274
+ "text": "Define a largura m\u00E1xima do elemento."
275
+ },
276
+ "attribute": "max-width",
277
+ "reflect": false,
278
+ "defaultValue": "200"
279
+ },
280
+ "useAnchorSize": {
281
+ "type": "boolean",
282
+ "mutable": false,
283
+ "complexType": {
284
+ "original": "boolean",
285
+ "resolved": "boolean",
286
+ "references": {}
287
+ },
288
+ "required": false,
289
+ "optional": false,
290
+ "docs": {
291
+ "tags": [],
292
+ "text": "Define se o elemento manter\u00E1 o mesmo tamanho do componente de ancora."
270
293
  },
271
- "attribute": "min-width",
294
+ "attribute": "use-anchor-size",
272
295
  "reflect": false,
273
- "defaultValue": "150"
296
+ "defaultValue": "false"
274
297
  }
275
298
  };
276
299
  }