@sankhyalabs/ezui 4.2.1 → 4.4.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 (53) hide show
  1. package/dist/cjs/ez-badge.cjs.entry.js +120 -0
  2. package/dist/cjs/ez-breadcrumb.cjs.entry.js +3 -14
  3. package/dist/cjs/ez-filter-input_4.cjs.entry.js +2 -1
  4. package/dist/cjs/ez-icon.cjs.entry.js +1 -1
  5. package/dist/cjs/ez-list.cjs.entry.js +7 -5
  6. package/dist/cjs/ez-popover.cjs.entry.js +6 -0
  7. package/dist/cjs/ezui.cjs.js +1 -1
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/collection/collection-manifest.json +1 -0
  10. package/dist/collection/components/ez-badge/enum/sizes.js +9 -0
  11. package/dist/collection/components/ez-badge/ez-badge.css +165 -0
  12. package/dist/collection/components/ez-badge/ez-badge.js +211 -0
  13. package/dist/collection/components/ez-badge/interfaces/IPosition.js +1 -0
  14. package/dist/collection/components/ez-breadcrumb/ez-breadcrumb.css +4 -0
  15. package/dist/collection/components/ez-breadcrumb/subcomponents/breadcrumb-item.js +2 -13
  16. package/dist/collection/components/ez-filter-input/ez-filter-input.js +20 -1
  17. package/dist/collection/components/ez-icon/ez-icon.css +141 -139
  18. package/dist/collection/components/ez-list/ez-list.css +6 -12
  19. package/dist/collection/components/ez-list/ez-list.js +25 -5
  20. package/dist/collection/components/ez-popover/ez-popover.js +6 -0
  21. package/dist/custom-elements/index.d.ts +6 -0
  22. package/dist/custom-elements/index.js +137 -23
  23. package/dist/esm/ez-badge.entry.js +116 -0
  24. package/dist/esm/ez-breadcrumb.entry.js +3 -14
  25. package/dist/esm/ez-filter-input_4.entry.js +2 -1
  26. package/dist/esm/ez-icon.entry.js +1 -1
  27. package/dist/esm/ez-list.entry.js +8 -6
  28. package/dist/esm/ez-popover.entry.js +6 -0
  29. package/dist/esm/ezui.js +1 -1
  30. package/dist/esm/loader.js +1 -1
  31. package/dist/ezui/ezui.esm.js +1 -1
  32. package/dist/ezui/p-02fc35a6.entry.js +1 -0
  33. package/dist/ezui/p-077a6943.entry.js +1 -0
  34. package/dist/ezui/p-0d04119a.entry.js +1 -0
  35. package/dist/ezui/p-2a848666.entry.js +1 -0
  36. package/dist/ezui/p-6388d982.entry.js +1 -0
  37. package/dist/ezui/p-759e37b7.entry.js +1 -0
  38. package/dist/types/components/ez-badge/enum/sizes.d.ts +8 -0
  39. package/dist/types/components/ez-badge/ez-badge.d.ts +35 -0
  40. package/dist/types/components/ez-badge/interfaces/IPosition.d.ts +4 -0
  41. package/dist/types/components/ez-filter-input/ez-filter-input.d.ts +4 -0
  42. package/dist/types/components/ez-list/ez-list.d.ts +4 -0
  43. package/dist/types/components/ez-popover/ez-popover.d.ts +1 -1
  44. package/dist/types/components.d.ts +66 -0
  45. package/package.json +2 -2
  46. package/react/components.d.ts +1 -0
  47. package/react/components.js +1 -0
  48. package/react/components.js.map +1 -1
  49. package/dist/ezui/p-62481744.entry.js +0 -1
  50. package/dist/ezui/p-6cf406ff.entry.js +0 -1
  51. package/dist/ezui/p-8d5ec02b.entry.js +0 -1
  52. package/dist/ezui/p-9a1549c2.entry.js +0 -1
  53. package/dist/ezui/p-cc40fcb3.entry.js +0 -1
@@ -0,0 +1,165 @@
1
+ :host {
2
+ --ez-badge--size-2xs: var(--space--2xs, 8px);
3
+ --ez-badge--size-xs: var(--space--xs, 12px);
4
+ --ez-badge--size-sm: var(--space--sm, 16px);
5
+ --ez-badge--size-md: var(--space--md, 20px);
6
+ --ez-badge--size-lg: var(--space--lg, 24px);
7
+ --ez-badge--size-xl: var(--space--xl, 32px);
8
+
9
+ --ez-badge--padding-2xs: 0;
10
+ --ez-badge--padding-xs: var(--space--nano, 2px);
11
+ --ez-badge--padding-sm: calc(var(--space--nano, 2px) + 1px);
12
+ --ez-badge--padding-md: var(--space--3xs, 4px);
13
+ --ez-badge--padding-lg: calc(var(--space--3xs, 4px) + 2px);
14
+ --ez-badge--padding-xl: var(--space--2xs);
15
+
16
+ --ez-badge--border-radius: calc(var(--border--radius-medium, 12px) + 8px);
17
+ --ez-badge--font-family: var(--font-pattern, Roboto);
18
+ --ez-badge--font-weight-medium: var(--text-weight--medium, 400);
19
+ --ez-badge--background-color: var(--color--primary, #008561);
20
+ --ez-badge--border-none: 0;
21
+ --ez-badge--color: var(--text--inverted, #ffffff);
22
+ --ez-badge--gap: calc(var(--ez-badge--padding-xs) + 1px);
23
+
24
+ --ez-badge--font-size-md: var(--text--medium);
25
+ --ez-badge--font-size-sm: var(--text--medium);
26
+ --ez-badge--font-size-xs: var(--text--small);
27
+ }
28
+ ez-icon {
29
+ --ez-icon--color: inherit;
30
+ }
31
+ .badge {
32
+ /*private*/
33
+ display: flex;
34
+ justify-content: center;
35
+ align-items: center;
36
+ position: relative;
37
+ }
38
+ .badge__content {
39
+ /*public*/
40
+ font-family: var(--ez-badge--font-family, Roboto);
41
+ font-weight: var(--ez-badge--font-weight-medium, 400);
42
+ background-color: var(--ez-badge--background-color, #008561);
43
+ border: var(--ez-badge--border-none, 0);
44
+ color: var(--ez-badge--color, #ffffff);
45
+ border-radius: var(--ez-badge--border-radius, 20px);
46
+ gap: var(--ez-badge--gap, 3px);
47
+
48
+ /*private*/
49
+ display: flex;
50
+ justify-content: center;
51
+ align-items: center;
52
+ }
53
+
54
+ .badge__content--fill-xs {
55
+ /*public*/
56
+ height: var(--ez-badge--size-xs, 12px);
57
+ min-width: var(--ez-badge--size-xs, 12px);
58
+ }
59
+ .badge__content--fill-2xs {
60
+ /*public*/
61
+ height: var(--ez-badge--size-2xs, 8px);
62
+ min-width: var(--ez-badge--size-2xs, 8px);
63
+ }
64
+
65
+ .badge__content--text-md {
66
+ /*public*/
67
+ height: calc(var(--ez-badge--size-md, 20px) - 2px);
68
+ min-width: var(--ez-badge--size-sm, 20px);
69
+ padding-top: var(--ez-badge--padding-sm);
70
+ padding-bottom: var(--ez-badge--padding-sm);
71
+ padding-right: var(--ez-badge--padding-xl);
72
+ padding-left: var(--ez-badge--padding-xl);
73
+ font-size: var(--ez-badge--font-size-md);
74
+ }
75
+ .badge__content--text-sm {
76
+ /*public*/
77
+ height: calc(var(--ez-badge--size-sm, 16px) - 2px);
78
+ min-width: var(--ez-badge--size-sm, 16px);
79
+ padding-top: var(--ez-badge--padding-sm);
80
+ padding-bottom: var(--ez-badge--padding-sm);
81
+ padding-right: var(--ez-badge--padding-xl);
82
+ padding-left: var(--ez-badge--padding-xl);
83
+ font-size: var(--ez-badge--font-size-sm);
84
+ }
85
+ .badge__content--text-xs {
86
+ /*public*/
87
+ height: var(--ez-badge--size-sm, 16px);
88
+ min-width: var(--ez-badge--size-sm, 16px);
89
+ padding-top: var(--ez-badge--padding-2xs);
90
+ padding-bottom: var(--ez-badge--padding-2xs);
91
+ padding-right: var(--ez-badge--padding-lg);
92
+ padding-left: var(--ez-badge--padding-lg);
93
+ font-size: var(--ez-badge--font-size-xs);
94
+ }
95
+
96
+ .badge__content--icon-lg {
97
+ /*public*/
98
+ height: var(--ez-badge--size-lg, 24px);
99
+ min-width: var(--ez-badge--size-lg, 24px);
100
+ padding: var(--ez-badge--padding-md);
101
+ }
102
+ .badge__content--icon-md {
103
+ /*public*/
104
+ height: var(--ez-badge--size-sm, 16px);
105
+ min-width: var(--ez-badge--size-sm, 16px);
106
+ padding: var(--ez-badge--padding-md);
107
+ }
108
+ .badge__content--icon-sm {
109
+ /*public*/
110
+ height: var(--ez-badge--size-sm, 16px);
111
+ min-width: var(--ez-badge--size-sm, 16px);
112
+ padding: var(--ez-badge--padding-xs);
113
+ }
114
+ .badge__content--icon-xs {
115
+ /*public*/
116
+ height: var(--ez-badge--size-xs, 12px);
117
+ min-width: var(--ez-badge--size-xs, 12px);
118
+ padding: var(--ez-badge--padding-xs);
119
+ }
120
+
121
+ .badge__content--fill {
122
+ /*public*/
123
+ position: absolute;
124
+ top: 0;
125
+ inset-inline-end: 0;
126
+
127
+ /*private*/
128
+ z-index: var(--most-visible, 2);
129
+ }
130
+ .badge__content--fill-top-right {
131
+ /*public*/
132
+ transform: translate(50%, -50%);
133
+
134
+ /*private*/
135
+ position: absolute;
136
+ top: 0;
137
+ right: 0;
138
+ }
139
+ .badge__content--fill-top-left {
140
+ /*public*/
141
+ transform: translate(-50%, -50%);
142
+
143
+ /*private*/
144
+ position: absolute;
145
+ top: 0;
146
+ left: 0;
147
+ }
148
+ .badge__content--fill-bottom-left {
149
+ /*public*/
150
+ transform: translate(-50%, 50%);
151
+
152
+ /*private*/
153
+ position: absolute;
154
+ bottom: 0;
155
+ left: 0;
156
+ }
157
+ .badge__content--fill-bottom-right {
158
+ /*public*/
159
+ transform: translate(50%, 50%);
160
+
161
+ /*private*/
162
+ position: absolute;
163
+ bottom: 0;
164
+ right: 0;
165
+ }
@@ -0,0 +1,211 @@
1
+ import { ElementIDUtils } from "@sankhyalabs/core";
2
+ import { h, Host } from "@stencil/core";
3
+ import { Sizes } from "./enum/sizes";
4
+ export class EzBadge {
5
+ constructor() {
6
+ this._sizes = {
7
+ [Sizes.EXTRA_LARGE]: {
8
+ sufix: "xl",
9
+ },
10
+ [Sizes.LARGE]: {
11
+ sufix: "lg",
12
+ },
13
+ [Sizes.MEDIUM]: {
14
+ sufix: "md",
15
+ },
16
+ [Sizes.SMALL_MEDIUM]: {
17
+ sufix: "sm",
18
+ },
19
+ [Sizes.SMALL]: {
20
+ sufix: "xs",
21
+ },
22
+ [Sizes.EXTRA_SMALL]: {
23
+ sufix: "2xs",
24
+ },
25
+ };
26
+ this.hasSlot = false;
27
+ this.size = "small";
28
+ this.label = undefined;
29
+ this.iconLeft = undefined;
30
+ this.iconRight = undefined;
31
+ this.position = { horizontal: "right", vertical: "top" };
32
+ }
33
+ getIconSize() {
34
+ switch (this.size) {
35
+ case "large":
36
+ return "large";
37
+ case "medium":
38
+ case "small-medium":
39
+ return "small";
40
+ case "small":
41
+ return "x-small";
42
+ default:
43
+ return null;
44
+ }
45
+ }
46
+ componentDidLoad() {
47
+ if (this._element) {
48
+ ElementIDUtils.addIDInfo(this._element);
49
+ }
50
+ if (this._badge) {
51
+ const dataInfo = { id: 'embedded' };
52
+ ElementIDUtils.addIDInfo(this._badge, 'ezBadge', dataInfo);
53
+ }
54
+ }
55
+ handleSlotChange() {
56
+ this.hasSlot = true;
57
+ }
58
+ validateIconLeft() {
59
+ return (this.iconLeft) && this.iconLeft.trim() !== "";
60
+ }
61
+ validateIconRight() {
62
+ return (this.iconRight) && this.iconRight.trim() !== "";
63
+ }
64
+ validateLabel() {
65
+ return (this.label) && this.label.trim() !== "";
66
+ }
67
+ createContainerClassName() {
68
+ let sizeSufix = this._sizes[this.size].sufix;
69
+ let containerClassNames = ["badge__content"];
70
+ if (this.hasSlot) {
71
+ containerClassNames.push("badge__content--fill-" + sizeSufix);
72
+ if (this.position.vertical == "bottom" && this.position.horizontal == "right") {
73
+ containerClassNames.push("badge__content--fill-bottom-right");
74
+ }
75
+ if (this.position.vertical == "bottom" && this.position.horizontal == "left") {
76
+ containerClassNames.push("badge__content--fill-bottom-left");
77
+ }
78
+ if (this.position.vertical == "top" && this.position.horizontal == "right") {
79
+ containerClassNames.push("badge__content--fill-top-right");
80
+ }
81
+ if (this.position.vertical == "top" && this.position.horizontal == "left") {
82
+ containerClassNames.push("badge__content--fill-top-left");
83
+ }
84
+ }
85
+ if (this.label) {
86
+ containerClassNames.push("badge__content--text-" + sizeSufix);
87
+ }
88
+ else if (this.iconLeft || this.iconRight) {
89
+ containerClassNames.push("badge__content--icon-" + sizeSufix);
90
+ }
91
+ else {
92
+ containerClassNames.push("badge__content--fill-" + sizeSufix);
93
+ }
94
+ return containerClassNames.join(" ");
95
+ }
96
+ render() {
97
+ return (h(Host, null, h("div", { class: "badge" }, h("div", null, h("slot", { name: "child-badge", onSlotchange: () => { this.handleSlotChange(); } })), h("div", { class: this.createContainerClassName(), ref: (el) => this._badge = el }, this.validateIconLeft() && h("ez-icon", { class: "icon", iconName: this.iconLeft, size: this.getIconSize() }), this.validateLabel() && h("label", { title: this.label }, this.label), this.validateIconRight() && h("ez-icon", { class: "icon", iconName: this.iconRight, size: this.getIconSize() })))));
98
+ }
99
+ static get is() { return "ez-badge"; }
100
+ static get encapsulation() { return "shadow"; }
101
+ static get originalStyleUrls() {
102
+ return {
103
+ "$": ["ez-badge.css"]
104
+ };
105
+ }
106
+ static get styleUrls() {
107
+ return {
108
+ "$": ["ez-badge.css"]
109
+ };
110
+ }
111
+ static get properties() {
112
+ return {
113
+ "size": {
114
+ "type": "string",
115
+ "mutable": false,
116
+ "complexType": {
117
+ "original": "\"extra-large\" | \"large\" | \"medium\" | \"small-medium\" | \"small\" | \"extra-small\"",
118
+ "resolved": "\"extra-large\" | \"extra-small\" | \"large\" | \"medium\" | \"small\" | \"small-medium\"",
119
+ "references": {}
120
+ },
121
+ "required": false,
122
+ "optional": false,
123
+ "docs": {
124
+ "tags": [],
125
+ "text": "Define o tamanho de acordo com o tipo utilizado pelo componente."
126
+ },
127
+ "attribute": "size",
128
+ "reflect": true,
129
+ "defaultValue": "\"small\""
130
+ },
131
+ "label": {
132
+ "type": "string",
133
+ "mutable": false,
134
+ "complexType": {
135
+ "original": "string",
136
+ "resolved": "string",
137
+ "references": {}
138
+ },
139
+ "required": false,
140
+ "optional": false,
141
+ "docs": {
142
+ "tags": [],
143
+ "text": "Define o conte\u00FAdo textual ou num\u00E9rico do componente."
144
+ },
145
+ "attribute": "label",
146
+ "reflect": true
147
+ },
148
+ "iconLeft": {
149
+ "type": "string",
150
+ "mutable": false,
151
+ "complexType": {
152
+ "original": "string",
153
+ "resolved": "string",
154
+ "references": {}
155
+ },
156
+ "required": false,
157
+ "optional": false,
158
+ "docs": {
159
+ "tags": [],
160
+ "text": "Define o \u00EDcone a ser usado no lado esquerdo do badge: [ez-icons](https://sankhyalabs-storybook.herokuapp.com/themes/default/icons/fonts/index.html)"
161
+ },
162
+ "attribute": "icon-left",
163
+ "reflect": true
164
+ },
165
+ "iconRight": {
166
+ "type": "string",
167
+ "mutable": false,
168
+ "complexType": {
169
+ "original": "string",
170
+ "resolved": "string",
171
+ "references": {}
172
+ },
173
+ "required": false,
174
+ "optional": false,
175
+ "docs": {
176
+ "tags": [],
177
+ "text": "Define o \u00EDcone a ser usado no lado direito do badge: [ez-icons](https://sankhyalabs-storybook.herokuapp.com/themes/default/icons/fonts/index.html)"
178
+ },
179
+ "attribute": "icon-right",
180
+ "reflect": true
181
+ },
182
+ "position": {
183
+ "type": "unknown",
184
+ "mutable": true,
185
+ "complexType": {
186
+ "original": "IPosition",
187
+ "resolved": "IPosition",
188
+ "references": {
189
+ "IPosition": {
190
+ "location": "import",
191
+ "path": "./interfaces/IPosition"
192
+ }
193
+ }
194
+ },
195
+ "required": false,
196
+ "optional": false,
197
+ "docs": {
198
+ "tags": [],
199
+ "text": "Define a posi\u00E7\u00E3o do \u00EDcone em rela\u00E7\u00E3o ao elemento filho."
200
+ },
201
+ "defaultValue": "{ horizontal: \"right\", vertical: \"top\" }"
202
+ }
203
+ };
204
+ }
205
+ static get states() {
206
+ return {
207
+ "hasSlot": {}
208
+ };
209
+ }
210
+ static get elementRef() { return "_element"; }
211
+ }
@@ -12,6 +12,10 @@
12
12
  font-weight: var(--text-weight--medium, 400);
13
13
  }
14
14
 
15
+ .breadcrumb {
16
+ display: flex;
17
+ }
18
+
15
19
  .breadcrumb__group{
16
20
  display: flex;
17
21
  }
@@ -3,15 +3,7 @@ import { ElementIDUtils } from '@sankhyalabs/core';
3
3
  export const BreadcrumbItem = (props) => {
4
4
  const { items, selectedItem, itemsHidden, showDropdown, handleShowDropdown, collapseConfigPosition, ellipsesPositionedEnd } = props;
5
5
  const formatDropdownItems = () => {
6
- return itemsHidden.map((item) => ({
7
- id: item.id,
8
- label: item.label,
9
- type: 'item',
10
- children: null,
11
- iconName: item.iconName || null,
12
- subAction: null,
13
- group: null
14
- }));
6
+ return itemsHidden.map((item) => (Object.assign(Object.assign({}, item), { type: 'item', children: null, iconName: item.iconName || null, subAction: null, group: null })));
15
7
  };
16
8
  const onClickEllipsis = (evt) => {
17
9
  evt.stopPropagation();
@@ -19,10 +11,7 @@ export const BreadcrumbItem = (props) => {
19
11
  };
20
12
  const createEllipsis = (item) => {
21
13
  return (h("li", Object.assign({ class: "breadcrumb__item", onClick: evt => onClickEllipsis(evt) }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: ElementIDUtils.getInternalIDInfo(`ezBreadcrumbItem_ellipsis`) }), ellipsesPositionedEnd && h("ez-icon", Object.assign({ class: "breadcrumb__item--chevron", size: "small", iconName: "chevron-right" }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo(`iconPath${item.id}`)}` })), h("span", { class: "ellipses__item" }, "..."), ellipsesPositionedEnd || h("ez-icon", Object.assign({ class: "breadcrumb__item--chevron", size: "small", iconName: "chevron-right" }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo(`iconPath${item.id}`)}` })), showDropdown &&
22
- h("ez-dropdown", Object.assign({ class: "dropdown-ellipsis", items: formatDropdownItems(), onEzClick: (evt) => {
23
- const { id, label, iconName } = evt.detail;
24
- selectedItem.emit({ id, label, iconName });
25
- } }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("dropdown")}` }))));
14
+ h("ez-dropdown", Object.assign({ class: "dropdown-ellipsis", items: formatDropdownItems(), onEzClick: (evt) => selectedItem.emit(evt.detail) }, { [ElementIDUtils.DATA_ELEMENT_ID_ATTRIBUTE_NAME]: `${ElementIDUtils.getInternalIDInfo("dropdown")}` }))));
26
15
  };
27
16
  return (h("div", { class: "breadcrumb__items" }, items.map((item, index) => {
28
17
  const isLastItem = index === (items.length - 1);
@@ -20,6 +20,7 @@ export class EzFilterInput {
20
20
  this.restrict = undefined;
21
21
  this.mode = "regular";
22
22
  this.asyncSearch = false;
23
+ this.canShowError = true;
23
24
  }
24
25
  observeLabel() {
25
26
  if (this._textInput) {
@@ -97,7 +98,7 @@ export class EzFilterInput {
97
98
  }
98
99
  render() {
99
100
  ElementIDUtils.addIDInfoIfNotExists(this._elem, 'input');
100
- return (h("ez-text-input", { "data-element-id": ElementIDUtils.getInternalIDInfo("textInput"), ref: elem => this._textInput = elem, label: this.label, onEzChange: evt => this.handleChange(evt), value: this.value, enabled: this.enabled, errorMessage: this.errorMessage, restrict: this.restrict, mode: this.mode, onFocusin: this.handleFocus }, h("ez-icon", { slot: "leftIcon", iconName: "search" })));
101
+ return (h("ez-text-input", { "data-element-id": ElementIDUtils.getInternalIDInfo("textInput"), ref: elem => this._textInput = elem, label: this.label, onEzChange: evt => this.handleChange(evt), value: this.value, enabled: this.enabled, errorMessage: this.errorMessage, restrict: this.restrict, mode: this.mode, onFocusin: this.handleFocus, canShowError: this.canShowError }, h("ez-icon", { slot: "leftIcon", iconName: "search" })));
101
102
  }
102
103
  static get is() { return "ez-filter-input"; }
103
104
  static get encapsulation() { return "shadow"; }
@@ -234,6 +235,24 @@ export class EzFilterInput {
234
235
  "attribute": "async-search",
235
236
  "reflect": true,
236
237
  "defaultValue": "false"
238
+ },
239
+ "canShowError": {
240
+ "type": "boolean",
241
+ "mutable": false,
242
+ "complexType": {
243
+ "original": "boolean",
244
+ "resolved": "boolean",
245
+ "references": {}
246
+ },
247
+ "required": false,
248
+ "optional": false,
249
+ "docs": {
250
+ "tags": [],
251
+ "text": "Se false deixa de exibir a mensagem de erro dentro do campo."
252
+ },
253
+ "attribute": "can-show-error",
254
+ "reflect": true,
255
+ "defaultValue": "true"
237
256
  }
238
257
  };
239
258
  }