@sankhyalabs/ezui 1.1.108 → 1.1.111

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 (101) hide show
  1. package/dist/cjs/ApplicationUtils-c8f07135.js +39 -0
  2. package/dist/cjs/AssetsUtils-4909c6de.js +24 -0
  3. package/dist/cjs/CSSVarsUtils-8fbdf2e0.js +19 -0
  4. package/dist/cjs/ez-button.cjs.entry.js +79 -0
  5. package/dist/cjs/ez-calendar.cjs.entry.js +223 -0
  6. package/dist/cjs/ez-check.cjs.entry.js +76 -0
  7. package/dist/cjs/ez-collapsible-box.cjs.entry.js +47 -0
  8. package/dist/cjs/ez-combo-box.cjs.entry.js +278 -0
  9. package/dist/cjs/ez-date-input.cjs.entry.js +102 -0
  10. package/dist/cjs/ez-date-time-input.cjs.entry.js +145 -0
  11. package/dist/cjs/ez-form.cjs.entry.js +785 -0
  12. package/dist/cjs/ez-grid.cjs.entry.js +9 -8
  13. package/dist/cjs/ez-icon.cjs.entry.js +41 -0
  14. package/dist/cjs/{ez-button_3.cjs.entry.js → ez-list.cjs.entry.js} +0 -89
  15. package/dist/cjs/ez-modal.cjs.entry.js +65 -0
  16. package/dist/cjs/ez-number-input.cjs.entry.js +86 -0
  17. package/dist/cjs/ez-popover.cjs.entry.js +4 -5
  18. package/dist/cjs/ez-search.cjs.entry.js +64 -0
  19. package/dist/cjs/ez-tabselector.cjs.entry.js +198 -0
  20. package/dist/cjs/ez-text-area.cjs.entry.js +114 -0
  21. package/dist/cjs/ez-text-input.cjs.entry.js +201 -0
  22. package/dist/cjs/ez-time-input.cjs.entry.js +118 -0
  23. package/dist/cjs/ez-upload.cjs.entry.js +356 -0
  24. package/dist/cjs/ezui.cjs.js +1 -1
  25. package/dist/cjs/{ez-modal_2.cjs.entry.js → grid-config.cjs.entry.js} +3 -62
  26. package/dist/cjs/loader.cjs.js +1 -1
  27. package/dist/cjs/select-box.cjs.entry.js +22 -0
  28. package/dist/cjs/test-du.cjs.entry.js +76 -0
  29. package/dist/collection/collection-manifest.json +132 -1
  30. package/dist/custom-elements/index.js +3 -1577
  31. package/dist/esm/ApplicationUtils-36e38de9.js +37 -0
  32. package/dist/esm/AssetsUtils-9b1329a3.js +22 -0
  33. package/dist/esm/CSSVarsUtils-667e0016.js +17 -0
  34. package/dist/esm/ez-button.entry.js +75 -0
  35. package/dist/esm/ez-calendar.entry.js +219 -0
  36. package/dist/esm/ez-check.entry.js +72 -0
  37. package/dist/esm/ez-collapsible-box.entry.js +43 -0
  38. package/dist/esm/ez-combo-box.entry.js +274 -0
  39. package/dist/esm/ez-date-input.entry.js +98 -0
  40. package/dist/esm/ez-date-time-input.entry.js +141 -0
  41. package/dist/esm/ez-form.entry.js +781 -0
  42. package/dist/esm/ez-grid.entry.js +2 -1
  43. package/dist/esm/ez-icon.entry.js +37 -0
  44. package/dist/esm/{ez-button_3.entry.js → ez-list.entry.js} +2 -89
  45. package/dist/esm/ez-modal.entry.js +61 -0
  46. package/dist/esm/ez-number-input.entry.js +82 -0
  47. package/dist/esm/ez-popover.entry.js +1 -2
  48. package/dist/esm/ez-search.entry.js +60 -0
  49. package/dist/esm/ez-tabselector.entry.js +194 -0
  50. package/dist/esm/ez-text-area.entry.js +110 -0
  51. package/dist/esm/ez-text-input.entry.js +197 -0
  52. package/dist/esm/ez-time-input.entry.js +114 -0
  53. package/dist/esm/ez-upload.entry.js +352 -0
  54. package/dist/esm/ezui.js +1 -1
  55. package/dist/esm/{ez-modal_2.entry.js → grid-config.entry.js} +3 -61
  56. package/dist/esm/loader.js +1 -1
  57. package/dist/esm/select-box.entry.js +18 -0
  58. package/dist/esm/test-du.entry.js +72 -0
  59. package/dist/ezui/ezui.esm.js +1 -1
  60. package/dist/ezui/p-080045a0.entry.js +1 -0
  61. package/dist/ezui/p-25e87823.entry.js +1 -0
  62. package/dist/ezui/p-31b0e21a.entry.js +1 -0
  63. package/dist/ezui/p-363fc3af.entry.js +1 -0
  64. package/dist/ezui/p-3662c09e.entry.js +1 -0
  65. package/dist/ezui/p-3a8bf0a8.entry.js +1 -0
  66. package/dist/ezui/p-3c954800.entry.js +1 -0
  67. package/dist/ezui/p-44d4f8d6.entry.js +1 -0
  68. package/dist/ezui/p-477bb703.js +1 -0
  69. package/dist/ezui/p-59a8448a.entry.js +1 -0
  70. package/dist/ezui/p-62daf508.js +1 -0
  71. package/dist/ezui/p-65893e25.entry.js +1 -0
  72. package/dist/ezui/p-73d3f767.entry.js +1 -0
  73. package/dist/ezui/p-73d45b12.entry.js +1 -0
  74. package/dist/ezui/p-804c118a.entry.js +1 -0
  75. package/dist/ezui/p-97f77023.entry.js +1 -0
  76. package/dist/ezui/p-9aecc079.entry.js +1 -0
  77. package/dist/ezui/{p-db1797d7.entry.js → p-a038e7a5.entry.js} +28 -28
  78. package/dist/ezui/p-a5f1f9c4.entry.js +1 -0
  79. package/dist/ezui/p-bc2834fa.entry.js +1 -0
  80. package/dist/ezui/p-c27495d9.entry.js +1 -0
  81. package/dist/ezui/p-c6f2aa6c.entry.js +1 -0
  82. package/dist/ezui/p-d54c157f.js +1 -0
  83. package/dist/ezui/p-f26f6d67.entry.js +1 -0
  84. package/dist/ezui/p-f3f9c7e6.entry.js +1 -0
  85. package/dist/ezui/p-f78c7ec9.entry.js +1 -0
  86. package/package.json +5 -4
  87. package/dist/cjs/AssetsUtils-697927e8.js +0 -79
  88. package/dist/cjs/FloatingManager-751368a8.js +0 -126
  89. package/dist/cjs/UnitMetadata-de809a4b.js +0 -1346
  90. package/dist/cjs/ez-calendar_16.cjs.entry.js +0 -2916
  91. package/dist/esm/AssetsUtils-f75711ac.js +0 -76
  92. package/dist/esm/FloatingManager-ee1f7fdf.js +0 -124
  93. package/dist/esm/UnitMetadata-d300ae38.js +0 -1340
  94. package/dist/esm/ez-calendar_16.entry.js +0 -2897
  95. package/dist/ezui/p-3e6fa4ca.entry.js +0 -1
  96. package/dist/ezui/p-47cf74f0.js +0 -1
  97. package/dist/ezui/p-6b257393.entry.js +0 -1
  98. package/dist/ezui/p-780fbe22.entry.js +0 -1
  99. package/dist/ezui/p-81fc41a5.js +0 -1
  100. package/dist/ezui/p-b05feb1f.js +0 -1
  101. package/dist/ezui/p-c451d6e6.entry.js +0 -1
@@ -0,0 +1,110 @@
1
+ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-6b8bfbeb.js';
2
+
3
+ const ezTextAreaCss = ":host{--text-area--width:100%;--text-area--border-radius:var(--border--radius-medium, 12px);--text-area--font-size:var(--text--medium, 14px);--text-area--font-family:var(--font-pattern, Arial);--text-area--font-weight:var(--text-weight--large, 500);--text-area--color:var(--title--primary, #000);--text-area__input--background-color:var(--background--medium, #e0e0e0);--text-area__input--border:var(--border--medium, 2px solid);--text-area__input--border-color:var(--text-area__input--background-color);--text-area__input--focus--border-color:var(--color--primary, #008561);--text-area__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--text-area__input--disabled--color:var(--text--disable, #AFB6C0);--text-area__input--error--border-color:#CC2936;--text-area__message_box--font-size:var(--text--small, 12px);--text-area__message_box--info--color:var(--color--success, #22085d);--text-area__message_box--error--color:var(--color--error, #FF0000);--text-area__label--floating--top:6px;--text-area__label--padding-top:12px;--text-area__label--padding-left:14px;--text-area__label--padding-right:12px;display:flex;flex-wrap:wrap;position:relative;width:var(--text-area--width)}textarea{box-sizing:border-box;border:none;resize:none;margin-top:calc(var(--space--medium, 12px) + 4px);width:100%;font-weight:var(--text-weight--large, 600);font-family:var(--text-area--font-family);font-size:var(--text-area--font-size);color:var(--text-area--color);padding:0;background:none}textarea:focus{outline:none}textarea:disabled{background-color:transparent;color:var(--text-area__input--disabled--color)}.textarea{width:100%;box-sizing:border-box;padding-left:var(--space--medium);padding-right:var(--space--extra-small);border-radius:var(--text-area--border-radius);border:var(--text-area__input--border);border-color:var(--text-area__input--border-color);background-color:var(--text-area__input--background-color)}.textarea--focus{border-color:var(--text-area__input--focus--border-color)}.textarea.hasError{color:var(--text-area--color);border-color:var(--text-area__input--error--border-color)}.message-box{min-height:16px;min-width:100%;margin-top:3px;line-height:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--text-area--font-family);font-size:var(--text-area__message_box--font-size);color:var(--text-area__message_box--info--color)}.hasError{color:var(--text-area__message_box--error--color)}.textarea__label{box-sizing:border-box;position:absolute;z-index:var(--visible);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;-webkit-transition:font-size .05s, top .05s;transition:font-size .05s, top .05s;width:calc(100% - var(--text-area__label--padding-right));left:var(--text-area--space--medium);font-family:var(--text-area--font-family);font-size:var(--text-area--font-size);font-weight:var(--text-area--font-weight);color:var(--text-area--color);top:var(--text-area__label--padding-top);left:var(--text-area__label--padding-left);padding-right:var(--text-area__label--padding-right)}.textarea__label--floated{font-family:var(--text-area--font-family);font-size:var(--text--extra-small);color:var(--text--primary);top:var(--text-area__label--floating--top)}.textarea__label--disabled{color:var(--text-area__input--disabled--color)}";
4
+
5
+ let EzTextArea = class {
6
+ constructor(hostRef) {
7
+ registerInstance(this, hostRef);
8
+ this.ezChange = createEvent(this, "ezChange", 7);
9
+ /**
10
+ * Deixa o campo disponível ou não para digitação.
11
+ */
12
+ this.enabled = true;
13
+ /**
14
+ * Ajusta o número de linhas e consequentemente o height do textarea. Valor default: 4
15
+ */
16
+ this.rows = 4;
17
+ }
18
+ showError() {
19
+ const hasError = typeof this.errorMessage === 'string' && this.errorMessage !== '';
20
+ if (hasError) {
21
+ this._container.classList.add('hasError');
22
+ this._messageBoxElem.classList.add('hasError');
23
+ }
24
+ else {
25
+ this._container.classList.remove('hasError');
26
+ this._messageBoxElem.classList.remove('hasError');
27
+ }
28
+ }
29
+ updateInputValue() {
30
+ this._inputElem.value = this.value === undefined ? "" : this.value;
31
+ this.handleChange();
32
+ this.adjustFloatingLabel();
33
+ this.ezChange.emit(this.value);
34
+ }
35
+ adjustFloatingLabel() {
36
+ if (this.label) {
37
+ const hasValue = this.value && this.value.toString().length > 0;
38
+ const containsFloatedClass = this._labelElem.classList.contains("textarea__label--floated");
39
+ if (hasValue || this.isFocused()) {
40
+ if (!containsFloatedClass) {
41
+ this._labelElem.classList.add("textarea__label--floated");
42
+ }
43
+ }
44
+ else {
45
+ if (containsFloatedClass) {
46
+ this._labelElem.classList.remove("textarea__label--floated");
47
+ }
48
+ }
49
+ }
50
+ }
51
+ isFocused() {
52
+ return this._hostElement.shadowRoot.activeElement !== null;
53
+ }
54
+ //---------------------------------------------
55
+ // Public methods
56
+ //---------------------------------------------
57
+ /**
58
+ * Faz o foco no componente de input
59
+ */
60
+ async setFocus() {
61
+ this._inputElem.focus();
62
+ }
63
+ /**
64
+ * Remove o foco no componente de input
65
+ */
66
+ async setBlur() {
67
+ this._inputElem.blur();
68
+ }
69
+ //---------------------------------------------
70
+ // Event handlers
71
+ //---------------------------------------------
72
+ handleFocusout() {
73
+ this.adjustFloatingLabel();
74
+ if (this._container && this._container.classList.contains("textarea--focus")) {
75
+ this._container.classList.remove("textarea--focus");
76
+ }
77
+ }
78
+ handleChange() {
79
+ this.errorMessage = "";
80
+ this.value = this._inputElem.value;
81
+ }
82
+ handleFocus() {
83
+ if (this.label && this._labelElem && !this._labelElem.classList.contains("textarea__label--floated")) {
84
+ this._labelElem.classList.add("textarea__label--floated");
85
+ }
86
+ if (this._container && !this._container.classList.contains("textarea--focus")) {
87
+ this._container.classList.add("textarea--focus");
88
+ }
89
+ }
90
+ //---------------------------------------------
91
+ // Lifecycle web component
92
+ //---------------------------------------------
93
+ componentDidLoad() {
94
+ this.showError();
95
+ this.adjustFloatingLabel();
96
+ }
97
+ render() {
98
+ return (h(Host, null, h("div", { class: "textarea", ref: (el) => this._container = el }, this.label ?
99
+ h("label", { ref: (el) => this._labelElem = el, class: this.enabled ? "textarea__label" : "textarea__label textarea__label--disabled", onClick: () => this._inputElem.focus(), title: this.label }, this.label)
100
+ : null, h("textarea", { onFocus: () => this.handleFocus(), ref: (el) => this._inputElem = el, value: this.value, disabled: !this.enabled, onInput: () => { this.handleChange(); }, onFocusout: () => { this.handleFocusout(); }, onKeyDown: event => event.stopPropagation(), rows: this.rows })), h("span", { class: "message-box", ref: (el) => this._messageBoxElem = el, title: this.errorMessage }, this.errorMessage)));
101
+ }
102
+ get _hostElement() { return getElement(this); }
103
+ static get watchers() { return {
104
+ "errorMessage": ["showError"],
105
+ "value": ["updateInputValue"]
106
+ }; }
107
+ };
108
+ EzTextArea.style = ezTextAreaCss;
109
+
110
+ export { EzTextArea as ez_text_area };
@@ -0,0 +1,197 @@
1
+ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-6b8bfbeb.js';
2
+ import { MaskFormatter } from '@sankhyalabs/core';
3
+
4
+ const ezTextInputCss = ":host{--ez-text-input--height:42px;--ez-text-input--width:100%;--ez-text-input__icon--width:48px;--ez-text-input--border-radius:var(--border--radius-medium, 12px);--ez-text-input--font-size:var(--text--medium, 14px);--ez-text-input--font-family:var(--font-pattern, Arial);--ez-text-input--font-weight:var(--text-weight--medium, 400);--ez-text-input--color:var(--title--primary, #000);--ez-text-input__input--background-color:var(--background--medium, #e0e0e0);--ez-text-input__input--border:var(--border--medium, 2px solid);--ez-text-input__input--border-color:var(--ez-text-input__input--background-color);--ez-text-input__input--focus--border-color:var(--color--primary, #008561);--ez-text-input__input--disabled--background-color:var(--color--disable-secondary, #F2F5F8);--ez-text-input__input--disabled--color:var(--text--disable, #AFB6C0);--ez-text-input__input--error--border-color:#CC2936;--ez-text-input__message_box--font-size:var(--text--small, 12px);--ez-text-input__message_box--info--color:var(--color--success, #22085d);--ez-text-input__message_box--error--color:var(--color--error, #FF0000);--ez-text-input__label--floating--top:6px;--ez-text-input__label--padding-top:12px;--ez-text-input__label--padding-left:14px;--ez-text-input__label--padding-right:12px;display:flex;flex-wrap:wrap;position:relative;width:var(--ez-text-input--width)}input{width:100%;box-sizing:border-box;padding:var(--space--medium, 6px);font-weight:var(--text-weight--large, 600);height:var(--ez-text-input--height);border-radius:var(--ez-text-input--border-radius);font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);border:var(--ez-text-input__input--border);border-color:var(--ez-text-input__input--border-color);background-color:var(--ez-text-input__input--background-color);color:var(--ez-text-input--color)}input:disabled{background-color:var(--ez-text-input__input--disabled--background-color);color:var(--ez-text-input__input--disabled--color)}input:focus{outline:none;border-color:var(--ez-text-input__input--focus--border-color)}input.icon--left{padding-left:var(--ez-text-input__icon--width)}input.icon--right{padding-right:var(--ez-text-input__icon--width)}input.hasError{color:var(--ez-text-input--color);border-color:var(--ez-text-input__input--error--border-color)}input.text--right{text-align:right}.message-box{min-height:16px;min-width:100%;margin-top:3px;line-height:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input__message_box--font-size);color:var(--ez-text-input__message_box--info--color)}.hasError{color:var(--ez-text-input__message_box--error--color)}.input__label{box-sizing:border-box;position:absolute;z-index:var(--visible);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;-webkit-transition:font-size .05s, top .05s;transition:font-size .05s, top .05s;width:calc(100% - var(--ez-text-input__label--padding-right));left:var(--ez-text-input--space--medium);font-family:var(--ez-text-input--font-family);font-size:var(--ez-text-input--font-size);font-weight:var(--ez-text-input--font-weight);color:var(--ez-text-input--color);top:var(--ez-text-input__label--padding-top);left:var(--ez-text-input__label--padding-left);padding-right:var(--ez-text-input__label--padding-right)}.input__label--floated{font-family:var(--ez-text-input--font-family);font-size:var(--text--extra-small);color:var(--text--primary);top:var(--ez-text-input__label--floating--top)}.input__label--disabled{color:var(--ez-text-input__input--disabled--color)}.input__label--left{text-align:left;left:calc(var(--ez-text-input__icon--width) + 2px);width:calc(100% - var(--ez-text-input__icon--width))}.input__label--right{right:var(--ez-text-input__icon--width);width:calc(100% - var(--ez-text-input__icon--width))}.input__label--left.input__label--right{left:calc(var(--ez-text-input__icon--width) + 2px);width:calc(100% - var(--ez-text-input__icon--width) * 2)}.input--with--label{padding-bottom:0}";
5
+
6
+ let EzTextInput = class {
7
+ constructor(hostRef) {
8
+ registerInstance(this, hostRef);
9
+ this.ezChange = createEvent(this, "ezChange", 7);
10
+ /**
11
+ * Deixa o campo disponível ou não para digitação.
12
+ */
13
+ this.enabled = true;
14
+ /**
15
+ * Permite exibir a mensagem de erro.
16
+ */
17
+ this.canShowError = true;
18
+ }
19
+ showError() {
20
+ const hasError = typeof this.errorMessage === "string" && this.errorMessage !== "";
21
+ if (hasError) {
22
+ this._inputElem.classList.add("hasError");
23
+ this._messageBoxElem.classList.add("hasError");
24
+ }
25
+ else {
26
+ this._inputElem.classList.remove("hasError");
27
+ this._messageBoxElem.classList.remove("hasError");
28
+ }
29
+ }
30
+ prepareMask() {
31
+ if (this.mask) {
32
+ if (this._maskFormatter == undefined) {
33
+ this._maskFormatter = new MaskFormatter(this.mask);
34
+ }
35
+ else {
36
+ this._maskFormatter.mask = this.mask;
37
+ }
38
+ }
39
+ }
40
+ updateInputValue() {
41
+ if (this._inputElem) {
42
+ this._inputElem.value = this.value;
43
+ }
44
+ this.handleChange();
45
+ this.errorMessage = "";
46
+ this.ezChange.emit(this.value);
47
+ this.adjustFloatingLabel();
48
+ }
49
+ adjustFloatingLabel() {
50
+ if (this.label && this._labelElem) {
51
+ if (this._inputElem && !this._inputElem.classList.contains("input--with--label")) {
52
+ this._inputElem.classList.add("input--with--label");
53
+ }
54
+ const hasValue = this.value && this.value.toString().length > 0;
55
+ const containsFloatedClass = this._labelElem.classList.contains("input__label--floated");
56
+ if (hasValue || this.isFocused()) {
57
+ if (!containsFloatedClass) {
58
+ this._labelElem.classList.add("input__label--floated");
59
+ }
60
+ }
61
+ else {
62
+ if (containsFloatedClass) {
63
+ this._labelElem.classList.remove("input__label--floated");
64
+ }
65
+ }
66
+ }
67
+ }
68
+ isFocused() {
69
+ return this._hostElement.shadowRoot.activeElement !== null;
70
+ }
71
+ //---------------------------------------------
72
+ // Public methods
73
+ //---------------------------------------------
74
+ /**
75
+ * Faz o foco no componente de input
76
+ */
77
+ async setFocus() {
78
+ this._inputElem.focus();
79
+ }
80
+ /**
81
+ * Remove o foco no componente de input
82
+ */
83
+ async setBlur() {
84
+ this._inputElem.blur();
85
+ }
86
+ //---------------------------------------------
87
+ // Event handlers
88
+ //---------------------------------------------
89
+ handleFocusout() {
90
+ const value = this._inputElem.value;
91
+ if (value && this._maskFormatter) {
92
+ try {
93
+ this._inputElem.value = this._maskFormatter.format(value);
94
+ }
95
+ catch (e) {
96
+ this.errorMessage = e.message;
97
+ }
98
+ }
99
+ this.value = this._inputElem.value;
100
+ this.adjustFloatingLabel();
101
+ }
102
+ isValidValue(value) {
103
+ if (this.restrict) {
104
+ return Array.from(value).reduce((valid, c) => valid && this.restrict.indexOf(c) > -1, true);
105
+ }
106
+ return true;
107
+ }
108
+ handleChange() {
109
+ if (!this._inputElem) {
110
+ return;
111
+ }
112
+ const value = this._inputElem.value;
113
+ if (this.isValidValue(value)) {
114
+ this._lastValidValue = value;
115
+ }
116
+ else {
117
+ this._inputElem.value = this._lastValidValue === undefined ? "" : this._lastValidValue;
118
+ }
119
+ this.value = this._inputElem.value;
120
+ }
121
+ handleSlotChange(ev) {
122
+ const slot = ev.target;
123
+ const content = slot.assignedElements()[0];
124
+ if (content) {
125
+ content.style.position = "absolute";
126
+ content.style.display = "flex";
127
+ content.style.alignItems = "center";
128
+ content.style.justifyContent = "center";
129
+ content.style.overflow = "hidden";
130
+ content.style.top = "0px";
131
+ content.style.width = "var(--ez-text-input__icon--width)";
132
+ content.style.height = "var(--ez-text-input--height)";
133
+ if (slot.name == "leftIcon") {
134
+ content.style.left = "0px";
135
+ content.style.borderRadius = "var(--ez-text-input--border-radius) 0 0 var(--ez-text-input--border-radius)";
136
+ this._inputElem.classList.add("icon--left");
137
+ if (this._labelElem) {
138
+ this._labelElem.classList.add("input__label--left");
139
+ }
140
+ }
141
+ else if (slot.name == "rightIcon") {
142
+ content.style.right = "0px";
143
+ content.style.borderRadius = "0 var(--ez-text-input--border-radius) var(--ez-text-input--border-radius) 0";
144
+ this._inputElem.classList.add("icon--right");
145
+ if (this._labelElem) {
146
+ this._labelElem.classList.add("input__label--right");
147
+ }
148
+ }
149
+ }
150
+ this.showError();
151
+ }
152
+ doFocus() {
153
+ if (this.label && this._labelElem && !this._labelElem.classList.contains("input__label--floated")) {
154
+ this._labelElem.classList.add("input__label--floated");
155
+ }
156
+ }
157
+ //---------------------------------------------
158
+ // Lifecycle web component
159
+ //---------------------------------------------
160
+ componentDidLoad() {
161
+ this.showError();
162
+ this.prepareMask();
163
+ this.adjustFloatingLabel();
164
+ }
165
+ componentWillLoad() {
166
+ this.prepareMask();
167
+ if (this.value) {
168
+ if (this._maskFormatter) {
169
+ try {
170
+ this.value = this._maskFormatter.format(this.value);
171
+ }
172
+ catch (e) {
173
+ this.errorMessage = e.message;
174
+ }
175
+ }
176
+ if (!this.isValidValue(this.value)) {
177
+ this._lastValidValue = "";
178
+ this.value = "";
179
+ }
180
+ }
181
+ }
182
+ render() {
183
+ return (h(Host, null, h("slot", { name: "leftIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } }), this.label ?
184
+ h("label", { ref: (el) => this._labelElem = el, class: this.enabled ? "input__label" : "input__label input__label--disabled", onClick: () => this._inputElem.focus(), title: this.label }, this.label)
185
+ : null, h("input", { onFocus: () => this.doFocus(), ref: (el) => this._inputElem = el, type: "text", value: this.value, disabled: !this.enabled, onInput: () => { this.handleChange(); }, onFocusout: () => { this.handleFocusout(); } }), h("slot", { name: "rightIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } }), this.canShowError &&
186
+ h("span", { class: "message-box", ref: (el) => this._messageBoxElem = el, title: this.errorMessage }, this.errorMessage)));
187
+ }
188
+ get _hostElement() { return getElement(this); }
189
+ static get watchers() { return {
190
+ "errorMessage": ["showError"],
191
+ "mask": ["prepareMask"],
192
+ "value": ["updateInputValue"]
193
+ }; }
194
+ };
195
+ EzTextInput.style = ezTextInputCss;
196
+
197
+ export { EzTextInput as ez_text_input };
@@ -0,0 +1,114 @@
1
+ import { r as registerInstance, h, H as Host, g as getElement } from './index-6b8bfbeb.js';
2
+ import { MaskFormatter, TimeFormatter, NumberUtils } from '@sankhyalabs/core';
3
+ import { C as CSSVarsUtils } from './CSSVarsUtils-667e0016.js';
4
+ import { g as getSpritePath } from './AssetsUtils-9b1329a3.js';
5
+
6
+ const ezTimeInputCss = ":host{display:flex;flex-wrap:wrap;position:relative;width:100%}";
7
+
8
+ let EzTimeInput = class {
9
+ constructor(hostRef) {
10
+ registerInstance(this, hostRef);
11
+ /**
12
+ * Deixa o campo disponível ou não para digitação.
13
+ */
14
+ this.enabled = true;
15
+ /**
16
+ * Define se o componente irá ou não considerar os segundos
17
+ */
18
+ this.showSeconds = false;
19
+ }
20
+ prepareMask() {
21
+ if (this.showSeconds) {
22
+ if (this._maskFormatter == undefined) {
23
+ this._maskFormatter = new MaskFormatter("##:##:##");
24
+ }
25
+ else {
26
+ this._maskFormatter.mask = "##:##:##";
27
+ }
28
+ }
29
+ else {
30
+ if (this._maskFormatter == undefined) {
31
+ this._maskFormatter = new MaskFormatter("##:##");
32
+ }
33
+ else {
34
+ this._maskFormatter.mask = "##:##";
35
+ }
36
+ }
37
+ }
38
+ onValueChanged() {
39
+ if (this.value === NaN) {
40
+ this.value = undefined;
41
+ this.handleFocusout();
42
+ }
43
+ }
44
+ //---------------------------------------------
45
+ // Public methods
46
+ //---------------------------------------------
47
+ /**
48
+ * Faz o foco no componente de input
49
+ */
50
+ async setFocus() {
51
+ this._inputElem.focus();
52
+ }
53
+ /**
54
+ * Remove o foco no componente de input
55
+ */
56
+ async setBlur() {
57
+ this._inputElem.blur();
58
+ }
59
+ //---------------------------------------------
60
+ // Event handlers
61
+ //---------------------------------------------
62
+ handleFocusout() {
63
+ this.errorMessage = "";
64
+ this.prepareValue(this.viewValue);
65
+ if (!TimeFormatter.validateTime(this.viewValue, this.showSeconds)) {
66
+ this.clearField();
67
+ this.errorMessage = "Favor inserir um horário válido.";
68
+ }
69
+ }
70
+ prepareValue(value) {
71
+ try {
72
+ this.viewValue = TimeFormatter.prepareValue(value, this.showSeconds);
73
+ }
74
+ catch (e) {
75
+ this.clearField();
76
+ this.errorMessage = e.message;
77
+ }
78
+ }
79
+ clearField() {
80
+ this.viewValue = this.value = undefined;
81
+ }
82
+ handleChange() {
83
+ this.viewValue = this._inputElem.value;
84
+ this.value = NumberUtils.stringToNumber(this.viewValue.replace(/\D/g, ""));
85
+ }
86
+ //---------------------------------------------
87
+ // Lifecycle web component
88
+ //---------------------------------------------
89
+ componentDidLoad() {
90
+ this.onValueChanged();
91
+ CSSVarsUtils.applyVarsTextInput(this._elem, this._inputElem);
92
+ }
93
+ componentWillLoad() {
94
+ this.prepareMask();
95
+ if (this.value) {
96
+ this.prepareValue(this.value.toString());
97
+ }
98
+ else if (this.viewValue) {
99
+ this.prepareValue(this.viewValue);
100
+ }
101
+ }
102
+ render() {
103
+ return (h(Host, null, h("ez-text-input", { ref: (el) => this._inputElem = el, value: this.viewValue, enabled: this.enabled, label: this.label, onInput: () => { this.handleChange(); }, onFocusout: () => { this.handleFocusout(); }, errorMessage: this.errorMessage }, h("ez-icon", { slot: "leftIcon", href: getSpritePath("timer-outline") }))));
104
+ }
105
+ static get assetsDirs() { return ["../assets"]; }
106
+ get _elem() { return getElement(this); }
107
+ static get watchers() { return {
108
+ "showSeconds": ["prepareMask"],
109
+ "value": ["onValueChanged"]
110
+ }; }
111
+ };
112
+ EzTimeInput.style = ezTimeInputCss;
113
+
114
+ export { EzTimeInput as ez_time_input };