@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,198 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-88286449.js');
6
+
7
+ const ezTabselectorCss = "@keyframes activate{0%{clip-path:inset(calc(100% - 3px) 50% 0px 50%)}100%{clip-path:inset(calc(100% - 3px) 0px 0px 0px)}}:host{display:flex;position:relative;width:100%;overflow:hidden;--tabselector--backward-icon:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"16px\" width=\"10px\"><path d=\"M 9.7808475,13.860393 3.9204526,8.0000004 9.7808475,2.0624965 7.9301965,0.28895552 0.21915255,8.0000004 7.9301965,15.711044 Z\"/></svg>');--tabselector--forward-icon:url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" height=\"16px\" width=\"10px\"><path d=\"M 0.21915251,13.860393 6.0795475,8.0000007 0.21915251,2.0624968 2.0698036,0.28895588 9.7808475,8.0000007 2.0698036,15.711044 Z\"/></svg>')}.scroll{display:flex;width:100%;scroll-behavior:smooth;overflow-x:auto;scrollbar-width:none}.scroll.startHidden{-webkit-mask-image:linear-gradient(90deg, transparent 20px, #000 48px)}.scroll.midle{-webkit-mask-image:linear-gradient(90deg, transparent 20px, #000 48px, #000 calc(100% - 48px), transparent calc(100% - 20px))}.scroll.endHidden{-webkit-mask-image:linear-gradient(90deg, #000 calc(100% - 48px), transparent calc(100% - 20px))}.tab{display:flex;border:none;min-width:100px;background-color:unset;cursor:pointer;padding:6px 12px;align-items:center;justify-content:center;color:var(--text--primary, #626e82);font-family:var(--font-pattern, \"Sora, Algerian\");font-size:var(--title--small, 14px)}.tab:focus,.forward-button,.backward-button{outline:none}.is-active{position:relative;color:var(--color--primary, #008561)}.is-active::after{content:\"\";position:absolute;width:100%;height:100%;background-color:var(--color--primary, #008561);clip-path:inset(calc(100% - 3px) 0px 0px 0px);animation:activate 0.25s ease-in-out}.is-focused{border:1px dashed var(--color--primary, #000000c5)}.tab-label{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;text-shadow:var(--text-shadow);margin-bottom:var(--space--extra-small, 3px)}.forward-button,.backward-button{position:absolute;z-index:1;display:flex;box-sizing:border-box;padding:0px;top:0px;right:0px;width:16px;height:100%;border:none;background-color:unset;cursor:pointer;justify-content:center;align-items:center}.backward-button{left:0px}.forward-button::after,.backward-button::after{content:'';display:flex;background-color:var(--text--primary, #008561);width:10px;height:16px}.forward-button::after{-webkit-mask-image:var(--tabselector--forward-icon);mask-image:var(--tabselector--forward-icon)}.backward-button::after{-webkit-mask-image:var(--tabselector--backward-icon);mask-image:var(--tabselector--backward-icon)}.forward-button:hover::after,.backward-button:hover::after{background-color:var(--color--primary, #4e4e4e)}.hidden{display:none}.scroll::-webkit-scrollbar{display:none}";
8
+
9
+ let EzTabselector = class {
10
+ constructor(hostRef) {
11
+ index.registerInstance(this, hostRef);
12
+ this.ezChange = index.createEvent(this, "ezChange", 7);
13
+ this.setFocusedParam = (ev) => {
14
+ if (ev.key === "Enter") {
15
+ const selectedTab = this._processedTabs[this._focusedIndex];
16
+ this.handleTabClick(selectedTab);
17
+ ev.preventDefault();
18
+ this.setFocusedTab(selectedTab.index);
19
+ }
20
+ else if (ev.key === "ArrowLeft" || ev.key === "ArrowRight") {
21
+ let operator = undefined;
22
+ if (ev.key === "ArrowLeft") {
23
+ operator = false;
24
+ }
25
+ else if (ev.key === "ArrowRight") {
26
+ operator = true;
27
+ }
28
+ else {
29
+ return;
30
+ }
31
+ if (this._focusedIndex === undefined) {
32
+ if (operator === false) {
33
+ this._focusedIndex = this.selectedIndex !== undefined ? this.selectedIndex - 1 : undefined;
34
+ }
35
+ else {
36
+ this._focusedIndex = this.selectedIndex !== undefined ? this.selectedIndex + 1 : undefined;
37
+ }
38
+ }
39
+ else {
40
+ if (operator === false) {
41
+ this._focusedIndex = this._focusedIndex - 1;
42
+ }
43
+ else {
44
+ this._focusedIndex = this._focusedIndex + 1;
45
+ }
46
+ }
47
+ if (this._focusedIndex < 0) {
48
+ this._focusedIndex = 0;
49
+ }
50
+ else if (this._focusedIndex > this._processedTabs.length - 1) {
51
+ this._focusedIndex = this._processedTabs.length - 1;
52
+ }
53
+ this.setFocusedBtn(true, this._focusedIndex);
54
+ this.setFocusedTab(this._focusedIndex);
55
+ }
56
+ else if (ev.key === "Tab" || ev.key === "Escape") {
57
+ const currentTab = this._processedTabs[this.selectedIndex];
58
+ this._focusedIndex = undefined;
59
+ this.handleTabClick(currentTab);
60
+ ev.preventDefault();
61
+ this.setFocusedTab(this.selectedIndex);
62
+ }
63
+ };
64
+ }
65
+ handleTabClick(tab) {
66
+ this.selectedIndex = tab.index;
67
+ this._focusedIndex = undefined;
68
+ this.selectedTab = tab.tabKey;
69
+ this.ezChange.emit(tab);
70
+ this.setFocusedBtn(false, tab.index);
71
+ }
72
+ componentWillRender() {
73
+ if (!this._processedTabs) {
74
+ this._processedTabs = [];
75
+ if (this.tabs) {
76
+ this.tabs.split(",").forEach((label) => {
77
+ label = label.trim();
78
+ this._processedTabs.push({ label, tabKey: label, index: this._processedTabs.length });
79
+ });
80
+ }
81
+ this._hostElem.querySelectorAll("ez-tab").forEach((elem) => {
82
+ const tabKey = elem.getAttribute("tabKey");
83
+ const label = elem.getAttribute("label");
84
+ const t = { label, tabKey, index: this._processedTabs.length };
85
+ const content = elem.firstChild;
86
+ if (content) {
87
+ content.setAttribute("slot", "tab" + t.index);
88
+ this._hostElem.appendChild(content);
89
+ }
90
+ this._processedTabs.push(t);
91
+ });
92
+ }
93
+ }
94
+ handleSlotChange(ev) {
95
+ const slot = ev.target;
96
+ const content = slot.assignedElements()[0];
97
+ if (content) {
98
+ content.style.marginLeft = "6px";
99
+ }
100
+ }
101
+ scrollBackward() {
102
+ const container = this._scrollContainer;
103
+ if (container) {
104
+ container.scrollLeft -= container.clientWidth;
105
+ }
106
+ }
107
+ scrollFoward() {
108
+ const container = this._scrollContainer;
109
+ if (container) {
110
+ let lastTab = null;
111
+ container.querySelectorAll(".tab").forEach((tab) => {
112
+ if (tab.getBoundingClientRect().right < container.clientWidth) {
113
+ lastTab = tab;
114
+ }
115
+ });
116
+ container.scrollLeft = lastTab.offsetLeft + lastTab.offsetWidth;
117
+ }
118
+ }
119
+ componentDidRender() {
120
+ this.updateScroll();
121
+ }
122
+ updateScroll() {
123
+ const container = this._scrollContainer;
124
+ if (container) {
125
+ const { scrollWidth, clientWidth, scrollLeft } = container;
126
+ const remainingScroll = scrollWidth - clientWidth - Math.ceil(scrollLeft);
127
+ this._startHidden = container.scrollLeft > 0;
128
+ this._endHidden = remainingScroll > 0;
129
+ if (this._startHidden) {
130
+ this._backwardButton.classList.remove("hidden");
131
+ }
132
+ else {
133
+ this._backwardButton.classList.add("hidden");
134
+ }
135
+ if (this._endHidden) {
136
+ this._forwardButton.classList.remove("hidden");
137
+ }
138
+ else {
139
+ this._forwardButton.classList.add("hidden");
140
+ }
141
+ const classNames = ["", "startHidden", "endHidden", "midle"];
142
+ const currentClass = classNames[Number(this._startHidden) | Number(this._endHidden) << 1];
143
+ classNames.forEach((name) => {
144
+ if (name !== currentClass && container.classList.contains(name)) {
145
+ container.classList.remove(name);
146
+ }
147
+ });
148
+ if (currentClass && !container.classList.contains(currentClass)) {
149
+ container.classList.add(currentClass);
150
+ }
151
+ }
152
+ }
153
+ domScrollHandler() {
154
+ window.clearTimeout(this._scrollCallBack);
155
+ this._scrollCallBack = window.setTimeout(() => { this.updateScroll(); }, 200);
156
+ }
157
+ setFocusedTab(index) {
158
+ window.clearTimeout(this._scrollCallBackTest);
159
+ this._scrollCallBackTest = window.setTimeout(() => {
160
+ const tabtoscroll = this._scrollContainer.querySelector(`#tab${index}`);
161
+ tabtoscroll.scrollIntoView();
162
+ }, 200);
163
+ }
164
+ getTextWidth(text) {
165
+ if (this._textMesurement === undefined) {
166
+ this._textMesurement = this._hostElem.shadowRoot.ownerDocument.createElement("canvas");
167
+ }
168
+ const context = this._textMesurement.getContext("2d");
169
+ context.font = "14px Sora, Algerian";
170
+ return Math.min(220, 24 + context.measureText(text).width) + "px";
171
+ }
172
+ ;
173
+ setFocusedBtn(visible, parameter) {
174
+ const tabsButtons = this._scrollContainer.querySelectorAll(".tab");
175
+ tabsButtons.forEach((el) => {
176
+ el.classList.remove("is-focused");
177
+ if (el.id === "tab" + parameter && visible) {
178
+ el.classList.add("is-focused");
179
+ }
180
+ });
181
+ }
182
+ render() {
183
+ return (index.h(index.Host, null, index.h("button", { class: "backward-button", ref: (el) => this._backwardButton = el, onClick: () => this.scrollBackward() }), index.h("div", { class: "scroll", ref: (el) => this._scrollContainer = el, onScroll: () => this.domScrollHandler(), onKeyDown: (ev) => this.setFocusedParam(ev) }, this._processedTabs.map((tab, index$1) => {
184
+ const labelStyle = { "min-width": this.getTextWidth(tab.label) };
185
+ const tabId = "tab" + index$1;
186
+ const isSelected = index$1 === this.selectedIndex || (this.selectedTab && tab.tabKey === this.selectedTab);
187
+ if (isSelected) {
188
+ this.selectedTab = tab.tabKey;
189
+ this.selectedIndex = index$1;
190
+ }
191
+ return index.h("button", { id: tabId, class: `tab${isSelected ? " is-active" : ""}`, onClick: () => this.handleTabClick(tab), style: labelStyle }, index.h("span", { class: "tab-label", title: tab.label }, tab.label), index.h("slot", { name: tabId, onSlotchange: (ev) => { this.handleSlotChange(ev); } }));
192
+ })), index.h("button", { class: "forward-button", ref: (el) => this._forwardButton = el, onClick: () => this.scrollFoward() })));
193
+ }
194
+ get _hostElem() { return index.getElement(this); }
195
+ };
196
+ EzTabselector.style = ezTabselectorCss;
197
+
198
+ exports.ez_tabselector = EzTabselector;
@@ -0,0 +1,114 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-88286449.js');
6
+
7
+ 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)}";
8
+
9
+ let EzTextArea = class {
10
+ constructor(hostRef) {
11
+ index.registerInstance(this, hostRef);
12
+ this.ezChange = index.createEvent(this, "ezChange", 7);
13
+ /**
14
+ * Deixa o campo disponível ou não para digitação.
15
+ */
16
+ this.enabled = true;
17
+ /**
18
+ * Ajusta o número de linhas e consequentemente o height do textarea. Valor default: 4
19
+ */
20
+ this.rows = 4;
21
+ }
22
+ showError() {
23
+ const hasError = typeof this.errorMessage === 'string' && this.errorMessage !== '';
24
+ if (hasError) {
25
+ this._container.classList.add('hasError');
26
+ this._messageBoxElem.classList.add('hasError');
27
+ }
28
+ else {
29
+ this._container.classList.remove('hasError');
30
+ this._messageBoxElem.classList.remove('hasError');
31
+ }
32
+ }
33
+ updateInputValue() {
34
+ this._inputElem.value = this.value === undefined ? "" : this.value;
35
+ this.handleChange();
36
+ this.adjustFloatingLabel();
37
+ this.ezChange.emit(this.value);
38
+ }
39
+ adjustFloatingLabel() {
40
+ if (this.label) {
41
+ const hasValue = this.value && this.value.toString().length > 0;
42
+ const containsFloatedClass = this._labelElem.classList.contains("textarea__label--floated");
43
+ if (hasValue || this.isFocused()) {
44
+ if (!containsFloatedClass) {
45
+ this._labelElem.classList.add("textarea__label--floated");
46
+ }
47
+ }
48
+ else {
49
+ if (containsFloatedClass) {
50
+ this._labelElem.classList.remove("textarea__label--floated");
51
+ }
52
+ }
53
+ }
54
+ }
55
+ isFocused() {
56
+ return this._hostElement.shadowRoot.activeElement !== null;
57
+ }
58
+ //---------------------------------------------
59
+ // Public methods
60
+ //---------------------------------------------
61
+ /**
62
+ * Faz o foco no componente de input
63
+ */
64
+ async setFocus() {
65
+ this._inputElem.focus();
66
+ }
67
+ /**
68
+ * Remove o foco no componente de input
69
+ */
70
+ async setBlur() {
71
+ this._inputElem.blur();
72
+ }
73
+ //---------------------------------------------
74
+ // Event handlers
75
+ //---------------------------------------------
76
+ handleFocusout() {
77
+ this.adjustFloatingLabel();
78
+ if (this._container && this._container.classList.contains("textarea--focus")) {
79
+ this._container.classList.remove("textarea--focus");
80
+ }
81
+ }
82
+ handleChange() {
83
+ this.errorMessage = "";
84
+ this.value = this._inputElem.value;
85
+ }
86
+ handleFocus() {
87
+ if (this.label && this._labelElem && !this._labelElem.classList.contains("textarea__label--floated")) {
88
+ this._labelElem.classList.add("textarea__label--floated");
89
+ }
90
+ if (this._container && !this._container.classList.contains("textarea--focus")) {
91
+ this._container.classList.add("textarea--focus");
92
+ }
93
+ }
94
+ //---------------------------------------------
95
+ // Lifecycle web component
96
+ //---------------------------------------------
97
+ componentDidLoad() {
98
+ this.showError();
99
+ this.adjustFloatingLabel();
100
+ }
101
+ render() {
102
+ return (index.h(index.Host, null, index.h("div", { class: "textarea", ref: (el) => this._container = el }, this.label ?
103
+ index.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)
104
+ : null, index.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 })), index.h("span", { class: "message-box", ref: (el) => this._messageBoxElem = el, title: this.errorMessage }, this.errorMessage)));
105
+ }
106
+ get _hostElement() { return index.getElement(this); }
107
+ static get watchers() { return {
108
+ "errorMessage": ["showError"],
109
+ "value": ["updateInputValue"]
110
+ }; }
111
+ };
112
+ EzTextArea.style = ezTextAreaCss;
113
+
114
+ exports.ez_text_area = EzTextArea;
@@ -0,0 +1,201 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-88286449.js');
6
+ const core = require('@sankhyalabs/core');
7
+
8
+ 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}";
9
+
10
+ let EzTextInput = class {
11
+ constructor(hostRef) {
12
+ index.registerInstance(this, hostRef);
13
+ this.ezChange = index.createEvent(this, "ezChange", 7);
14
+ /**
15
+ * Deixa o campo disponível ou não para digitação.
16
+ */
17
+ this.enabled = true;
18
+ /**
19
+ * Permite exibir a mensagem de erro.
20
+ */
21
+ this.canShowError = true;
22
+ }
23
+ showError() {
24
+ const hasError = typeof this.errorMessage === "string" && this.errorMessage !== "";
25
+ if (hasError) {
26
+ this._inputElem.classList.add("hasError");
27
+ this._messageBoxElem.classList.add("hasError");
28
+ }
29
+ else {
30
+ this._inputElem.classList.remove("hasError");
31
+ this._messageBoxElem.classList.remove("hasError");
32
+ }
33
+ }
34
+ prepareMask() {
35
+ if (this.mask) {
36
+ if (this._maskFormatter == undefined) {
37
+ this._maskFormatter = new core.MaskFormatter(this.mask);
38
+ }
39
+ else {
40
+ this._maskFormatter.mask = this.mask;
41
+ }
42
+ }
43
+ }
44
+ updateInputValue() {
45
+ if (this._inputElem) {
46
+ this._inputElem.value = this.value;
47
+ }
48
+ this.handleChange();
49
+ this.errorMessage = "";
50
+ this.ezChange.emit(this.value);
51
+ this.adjustFloatingLabel();
52
+ }
53
+ adjustFloatingLabel() {
54
+ if (this.label && this._labelElem) {
55
+ if (this._inputElem && !this._inputElem.classList.contains("input--with--label")) {
56
+ this._inputElem.classList.add("input--with--label");
57
+ }
58
+ const hasValue = this.value && this.value.toString().length > 0;
59
+ const containsFloatedClass = this._labelElem.classList.contains("input__label--floated");
60
+ if (hasValue || this.isFocused()) {
61
+ if (!containsFloatedClass) {
62
+ this._labelElem.classList.add("input__label--floated");
63
+ }
64
+ }
65
+ else {
66
+ if (containsFloatedClass) {
67
+ this._labelElem.classList.remove("input__label--floated");
68
+ }
69
+ }
70
+ }
71
+ }
72
+ isFocused() {
73
+ return this._hostElement.shadowRoot.activeElement !== null;
74
+ }
75
+ //---------------------------------------------
76
+ // Public methods
77
+ //---------------------------------------------
78
+ /**
79
+ * Faz o foco no componente de input
80
+ */
81
+ async setFocus() {
82
+ this._inputElem.focus();
83
+ }
84
+ /**
85
+ * Remove o foco no componente de input
86
+ */
87
+ async setBlur() {
88
+ this._inputElem.blur();
89
+ }
90
+ //---------------------------------------------
91
+ // Event handlers
92
+ //---------------------------------------------
93
+ handleFocusout() {
94
+ const value = this._inputElem.value;
95
+ if (value && this._maskFormatter) {
96
+ try {
97
+ this._inputElem.value = this._maskFormatter.format(value);
98
+ }
99
+ catch (e) {
100
+ this.errorMessage = e.message;
101
+ }
102
+ }
103
+ this.value = this._inputElem.value;
104
+ this.adjustFloatingLabel();
105
+ }
106
+ isValidValue(value) {
107
+ if (this.restrict) {
108
+ return Array.from(value).reduce((valid, c) => valid && this.restrict.indexOf(c) > -1, true);
109
+ }
110
+ return true;
111
+ }
112
+ handleChange() {
113
+ if (!this._inputElem) {
114
+ return;
115
+ }
116
+ const value = this._inputElem.value;
117
+ if (this.isValidValue(value)) {
118
+ this._lastValidValue = value;
119
+ }
120
+ else {
121
+ this._inputElem.value = this._lastValidValue === undefined ? "" : this._lastValidValue;
122
+ }
123
+ this.value = this._inputElem.value;
124
+ }
125
+ handleSlotChange(ev) {
126
+ const slot = ev.target;
127
+ const content = slot.assignedElements()[0];
128
+ if (content) {
129
+ content.style.position = "absolute";
130
+ content.style.display = "flex";
131
+ content.style.alignItems = "center";
132
+ content.style.justifyContent = "center";
133
+ content.style.overflow = "hidden";
134
+ content.style.top = "0px";
135
+ content.style.width = "var(--ez-text-input__icon--width)";
136
+ content.style.height = "var(--ez-text-input--height)";
137
+ if (slot.name == "leftIcon") {
138
+ content.style.left = "0px";
139
+ content.style.borderRadius = "var(--ez-text-input--border-radius) 0 0 var(--ez-text-input--border-radius)";
140
+ this._inputElem.classList.add("icon--left");
141
+ if (this._labelElem) {
142
+ this._labelElem.classList.add("input__label--left");
143
+ }
144
+ }
145
+ else if (slot.name == "rightIcon") {
146
+ content.style.right = "0px";
147
+ content.style.borderRadius = "0 var(--ez-text-input--border-radius) var(--ez-text-input--border-radius) 0";
148
+ this._inputElem.classList.add("icon--right");
149
+ if (this._labelElem) {
150
+ this._labelElem.classList.add("input__label--right");
151
+ }
152
+ }
153
+ }
154
+ this.showError();
155
+ }
156
+ doFocus() {
157
+ if (this.label && this._labelElem && !this._labelElem.classList.contains("input__label--floated")) {
158
+ this._labelElem.classList.add("input__label--floated");
159
+ }
160
+ }
161
+ //---------------------------------------------
162
+ // Lifecycle web component
163
+ //---------------------------------------------
164
+ componentDidLoad() {
165
+ this.showError();
166
+ this.prepareMask();
167
+ this.adjustFloatingLabel();
168
+ }
169
+ componentWillLoad() {
170
+ this.prepareMask();
171
+ if (this.value) {
172
+ if (this._maskFormatter) {
173
+ try {
174
+ this.value = this._maskFormatter.format(this.value);
175
+ }
176
+ catch (e) {
177
+ this.errorMessage = e.message;
178
+ }
179
+ }
180
+ if (!this.isValidValue(this.value)) {
181
+ this._lastValidValue = "";
182
+ this.value = "";
183
+ }
184
+ }
185
+ }
186
+ render() {
187
+ return (index.h(index.Host, null, index.h("slot", { name: "leftIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } }), this.label ?
188
+ index.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)
189
+ : null, index.h("input", { onFocus: () => this.doFocus(), ref: (el) => this._inputElem = el, type: "text", value: this.value, disabled: !this.enabled, onInput: () => { this.handleChange(); }, onFocusout: () => { this.handleFocusout(); } }), index.h("slot", { name: "rightIcon", onSlotchange: (ev) => { this.handleSlotChange(ev); } }), this.canShowError &&
190
+ index.h("span", { class: "message-box", ref: (el) => this._messageBoxElem = el, title: this.errorMessage }, this.errorMessage)));
191
+ }
192
+ get _hostElement() { return index.getElement(this); }
193
+ static get watchers() { return {
194
+ "errorMessage": ["showError"],
195
+ "mask": ["prepareMask"],
196
+ "value": ["updateInputValue"]
197
+ }; }
198
+ };
199
+ EzTextInput.style = ezTextInputCss;
200
+
201
+ exports.ez_text_input = EzTextInput;
@@ -0,0 +1,118 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-88286449.js');
6
+ const core = require('@sankhyalabs/core');
7
+ const CSSVarsUtils = require('./CSSVarsUtils-8fbdf2e0.js');
8
+ const AssetsUtils = require('./AssetsUtils-4909c6de.js');
9
+
10
+ const ezTimeInputCss = ":host{display:flex;flex-wrap:wrap;position:relative;width:100%}";
11
+
12
+ let EzTimeInput = class {
13
+ constructor(hostRef) {
14
+ index.registerInstance(this, hostRef);
15
+ /**
16
+ * Deixa o campo disponível ou não para digitação.
17
+ */
18
+ this.enabled = true;
19
+ /**
20
+ * Define se o componente irá ou não considerar os segundos
21
+ */
22
+ this.showSeconds = false;
23
+ }
24
+ prepareMask() {
25
+ if (this.showSeconds) {
26
+ if (this._maskFormatter == undefined) {
27
+ this._maskFormatter = new core.MaskFormatter("##:##:##");
28
+ }
29
+ else {
30
+ this._maskFormatter.mask = "##:##:##";
31
+ }
32
+ }
33
+ else {
34
+ if (this._maskFormatter == undefined) {
35
+ this._maskFormatter = new core.MaskFormatter("##:##");
36
+ }
37
+ else {
38
+ this._maskFormatter.mask = "##:##";
39
+ }
40
+ }
41
+ }
42
+ onValueChanged() {
43
+ if (this.value === NaN) {
44
+ this.value = undefined;
45
+ this.handleFocusout();
46
+ }
47
+ }
48
+ //---------------------------------------------
49
+ // Public methods
50
+ //---------------------------------------------
51
+ /**
52
+ * Faz o foco no componente de input
53
+ */
54
+ async setFocus() {
55
+ this._inputElem.focus();
56
+ }
57
+ /**
58
+ * Remove o foco no componente de input
59
+ */
60
+ async setBlur() {
61
+ this._inputElem.blur();
62
+ }
63
+ //---------------------------------------------
64
+ // Event handlers
65
+ //---------------------------------------------
66
+ handleFocusout() {
67
+ this.errorMessage = "";
68
+ this.prepareValue(this.viewValue);
69
+ if (!core.TimeFormatter.validateTime(this.viewValue, this.showSeconds)) {
70
+ this.clearField();
71
+ this.errorMessage = "Favor inserir um horário válido.";
72
+ }
73
+ }
74
+ prepareValue(value) {
75
+ try {
76
+ this.viewValue = core.TimeFormatter.prepareValue(value, this.showSeconds);
77
+ }
78
+ catch (e) {
79
+ this.clearField();
80
+ this.errorMessage = e.message;
81
+ }
82
+ }
83
+ clearField() {
84
+ this.viewValue = this.value = undefined;
85
+ }
86
+ handleChange() {
87
+ this.viewValue = this._inputElem.value;
88
+ this.value = core.NumberUtils.stringToNumber(this.viewValue.replace(/\D/g, ""));
89
+ }
90
+ //---------------------------------------------
91
+ // Lifecycle web component
92
+ //---------------------------------------------
93
+ componentDidLoad() {
94
+ this.onValueChanged();
95
+ CSSVarsUtils.CSSVarsUtils.applyVarsTextInput(this._elem, this._inputElem);
96
+ }
97
+ componentWillLoad() {
98
+ this.prepareMask();
99
+ if (this.value) {
100
+ this.prepareValue(this.value.toString());
101
+ }
102
+ else if (this.viewValue) {
103
+ this.prepareValue(this.viewValue);
104
+ }
105
+ }
106
+ render() {
107
+ return (index.h(index.Host, null, index.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 }, index.h("ez-icon", { slot: "leftIcon", href: AssetsUtils.getSpritePath("timer-outline") }))));
108
+ }
109
+ static get assetsDirs() { return ["../assets"]; }
110
+ get _elem() { return index.getElement(this); }
111
+ static get watchers() { return {
112
+ "showSeconds": ["prepareMask"],
113
+ "value": ["onValueChanged"]
114
+ }; }
115
+ };
116
+ EzTimeInput.style = ezTimeInputCss;
117
+
118
+ exports.ez_time_input = EzTimeInput;