@sula-tech/webcomponents 0.3.1 → 0.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 (190) hide show
  1. package/dist/cjs/{index-87eec792.js → index-BtkenDV1.js} +205 -156
  2. package/dist/cjs/index-BtkenDV1.js.map +1 -0
  3. package/dist/cjs/index.cjs.js +1 -0
  4. package/dist/cjs/index.cjs.js.map +1 -1
  5. package/dist/cjs/loader.cjs.js +4 -6
  6. package/dist/cjs/loader.cjs.js.map +1 -1
  7. package/dist/cjs/sula-avatar.sula-badge.sula-button.sula-checkbox.sula-chip.sula-icon.sula-loader.sula-menu-select-list.sula-radio-button.sula-switch.sula-tag.sula-textarea.sula-textfield.sula-tiles.entry.cjs.js.map +1 -0
  8. package/dist/cjs/sula-avatar_14.cjs.entry.js +28270 -0
  9. package/dist/cjs/sula-avatar_14.cjs.entry.js.map +1 -0
  10. package/dist/cjs/webcomponents.cjs.js +8 -8
  11. package/dist/cjs/webcomponents.cjs.js.map +1 -1
  12. package/dist/collection/assets/lottie/loader.json +1 -0
  13. package/dist/collection/collection-manifest.json +7 -2
  14. package/dist/collection/components/sula-avatar/sula-avatar.css +1 -1
  15. package/dist/collection/components/sula-avatar/sula-avatar.js +4 -4
  16. package/dist/collection/components/sula-avatar/sula-avatar.stories.js +7 -0
  17. package/dist/collection/components/sula-avatar/sula-avatar.stories.js.map +1 -1
  18. package/dist/collection/components/sula-badge/sula-badge.css +1 -1
  19. package/dist/collection/components/sula-badge/sula-badge.js +5 -5
  20. package/dist/collection/components/sula-badge/sula-badge.stories.js +7 -0
  21. package/dist/collection/components/sula-badge/sula-badge.stories.js.map +1 -1
  22. package/dist/collection/components/sula-button/sula-button.css +1 -1
  23. package/dist/collection/components/sula-button/sula-button.js +8 -8
  24. package/dist/collection/components/sula-button/sula-button.stories.js +7 -0
  25. package/dist/collection/components/sula-button/sula-button.stories.js.map +1 -1
  26. package/dist/collection/components/sula-checkbox/sula-checkbox.css +1 -1
  27. package/dist/collection/components/sula-checkbox/sula-checkbox.js +5 -5
  28. package/dist/collection/components/sula-checkbox/sula-checkbox.stories.js +7 -0
  29. package/dist/collection/components/sula-checkbox/sula-checkbox.stories.js.map +1 -1
  30. package/dist/collection/components/sula-chip/model/sula-chip.model.js +6 -0
  31. package/dist/collection/components/sula-chip/model/sula-chip.model.js.map +1 -0
  32. package/dist/collection/components/sula-chip/sula-chip.css +1 -0
  33. package/dist/collection/components/sula-chip/sula-chip.js +243 -0
  34. package/dist/collection/components/sula-chip/sula-chip.js.map +1 -0
  35. package/dist/collection/components/sula-chip/sula-chip.stories.js +125 -0
  36. package/dist/collection/components/sula-chip/sula-chip.stories.js.map +1 -0
  37. package/dist/collection/components/sula-icon/sula-icon.css +1 -1
  38. package/dist/collection/components/sula-icon/sula-icon.js +3 -3
  39. package/dist/collection/components/sula-loader/model/sula-loader.model.js +7 -0
  40. package/dist/collection/components/sula-loader/model/sula-loader.model.js.map +1 -0
  41. package/dist/collection/components/sula-loader/sula-loader.css +1 -0
  42. package/dist/collection/components/sula-loader/sula-loader.js +102 -0
  43. package/dist/collection/components/sula-loader/sula-loader.js.map +1 -0
  44. package/dist/collection/components/sula-loader/sula-loader.stories.js +48 -0
  45. package/dist/collection/components/sula-loader/sula-loader.stories.js.map +1 -0
  46. package/dist/collection/components/sula-loader/test/__mocks__/lottie-web.js +10 -0
  47. package/dist/collection/components/sula-loader/test/__mocks__/lottie-web.js.map +1 -0
  48. package/dist/collection/components/sula-menu-select-list/model/sula-menu-select-list.model.js +2 -0
  49. package/dist/collection/components/sula-menu-select-list/model/sula-menu-select-list.model.js.map +1 -0
  50. package/dist/collection/components/sula-menu-select-list/sula-menu-select-list.css +1 -0
  51. package/dist/collection/components/sula-menu-select-list/sula-menu-select-list.js +81 -0
  52. package/dist/collection/components/sula-menu-select-list/sula-menu-select-list.js.map +1 -0
  53. package/dist/collection/components/sula-menu-select-list/sula-menu-select-list.stories.js +91 -0
  54. package/dist/collection/components/sula-menu-select-list/sula-menu-select-list.stories.js.map +1 -0
  55. package/dist/collection/components/sula-radio-button/sula-radio-button.css +1 -0
  56. package/dist/collection/components/sula-radio-button/sula-radio-button.js +176 -0
  57. package/dist/collection/components/sula-radio-button/sula-radio-button.js.map +1 -0
  58. package/dist/collection/components/sula-radio-button/sula-radio-button.stories.js +123 -0
  59. package/dist/collection/components/sula-radio-button/sula-radio-button.stories.js.map +1 -0
  60. package/dist/collection/components/sula-switch/sula-switch.css +1 -1
  61. package/dist/collection/components/sula-switch/sula-switch.js +9 -9
  62. package/dist/collection/components/sula-switch/sula-switch.stories.js +7 -0
  63. package/dist/collection/components/sula-switch/sula-switch.stories.js.map +1 -1
  64. package/dist/collection/components/sula-tag/sula-tag.css +1 -1
  65. package/dist/collection/components/sula-tag/sula-tag.js +9 -9
  66. package/dist/collection/components/sula-tag/sula-tag.stories.js +7 -0
  67. package/dist/collection/components/sula-tag/sula-tag.stories.js.map +1 -1
  68. package/dist/collection/components/sula-textarea/sula-textarea.css +1 -1
  69. package/dist/collection/components/sula-textarea/sula-textarea.js +14 -14
  70. package/dist/collection/components/sula-textarea/sula-textarea.js.map +1 -1
  71. package/dist/collection/components/sula-textarea/sula-textarea.stories.js +7 -0
  72. package/dist/collection/components/sula-textarea/sula-textarea.stories.js.map +1 -1
  73. package/dist/collection/components/sula-textfield/sula-textfield.css +1 -1
  74. package/dist/collection/components/sula-textfield/sula-textfield.js +12 -12
  75. package/dist/collection/components/sula-textfield/sula-textfield.js.map +1 -1
  76. package/dist/collection/components/sula-textfield/sula-textfield.stories.js +7 -0
  77. package/dist/collection/components/sula-textfield/sula-textfield.stories.js.map +1 -1
  78. package/dist/collection/components/sula-tiles/model/sula-tiles.model.js +11 -0
  79. package/dist/collection/components/sula-tiles/model/sula-tiles.model.js.map +1 -0
  80. package/dist/collection/components/sula-tiles/sula-tiles.css +1 -0
  81. package/dist/collection/components/sula-tiles/sula-tiles.js +316 -0
  82. package/dist/collection/components/sula-tiles/sula-tiles.js.map +1 -0
  83. package/dist/collection/components/sula-tiles/sula-tiles.stories.js +420 -0
  84. package/dist/collection/components/sula-tiles/sula-tiles.stories.js.map +1 -0
  85. package/dist/components/index.js +1251 -1
  86. package/dist/components/index.js.map +1 -1
  87. package/dist/components/{p-694eb028.js → p-CEU3PNQs.js} +6 -6
  88. package/dist/components/p-CEU3PNQs.js.map +1 -0
  89. package/dist/components/p-DJGFqp8r.js +44 -0
  90. package/dist/components/p-DJGFqp8r.js.map +1 -0
  91. package/dist/components/sula-avatar.js +5 -5
  92. package/dist/components/sula-avatar.js.map +1 -1
  93. package/dist/components/sula-badge.js +5 -5
  94. package/dist/components/sula-badge.js.map +1 -1
  95. package/dist/components/sula-button.js +6 -6
  96. package/dist/components/sula-button.js.map +1 -1
  97. package/dist/components/sula-checkbox.js +8 -8
  98. package/dist/components/sula-checkbox.js.map +1 -1
  99. package/dist/components/sula-chip.d.ts +11 -0
  100. package/dist/components/sula-chip.js +136 -0
  101. package/dist/components/sula-chip.js.map +1 -0
  102. package/dist/components/sula-icon.js +2 -1
  103. package/dist/components/sula-loader.d.ts +11 -0
  104. package/dist/components/sula-loader.js +27132 -0
  105. package/dist/components/sula-loader.js.map +1 -0
  106. package/dist/components/sula-menu-select-list.d.ts +11 -0
  107. package/dist/components/sula-menu-select-list.js +9 -0
  108. package/dist/components/sula-menu-select-list.js.map +1 -0
  109. package/dist/components/sula-radio-button.d.ts +11 -0
  110. package/dist/components/sula-radio-button.js +83 -0
  111. package/dist/components/sula-radio-button.js.map +1 -0
  112. package/dist/components/sula-switch.js +11 -11
  113. package/dist/components/sula-switch.js.map +1 -1
  114. package/dist/components/sula-tag.js +8 -8
  115. package/dist/components/sula-tag.js.map +1 -1
  116. package/dist/components/sula-textarea.js +13 -13
  117. package/dist/components/sula-textarea.js.map +1 -1
  118. package/dist/components/sula-textfield.js +11 -11
  119. package/dist/components/sula-textfield.js.map +1 -1
  120. package/dist/components/sula-tiles.d.ts +11 -0
  121. package/dist/components/sula-tiles.js +180 -0
  122. package/dist/components/sula-tiles.js.map +1 -0
  123. package/dist/esm/{index-aa1c5f36.js → index-Yyeke16a.js} +203 -135
  124. package/dist/esm/index-Yyeke16a.js.map +1 -0
  125. package/dist/esm/index.js +1 -0
  126. package/dist/esm/index.js.map +1 -1
  127. package/dist/esm/loader.js +4 -4
  128. package/dist/esm/loader.js.map +1 -1
  129. package/dist/esm/sula-avatar.sula-badge.sula-button.sula-checkbox.sula-chip.sula-icon.sula-loader.sula-menu-select-list.sula-radio-button.sula-switch.sula-tag.sula-textarea.sula-textfield.sula-tiles.entry.js.map +1 -0
  130. package/dist/esm/sula-avatar_14.entry.js +28255 -0
  131. package/dist/esm/sula-avatar_14.entry.js.map +1 -0
  132. package/dist/esm/webcomponents.js +6 -5
  133. package/dist/esm/webcomponents.js.map +1 -1
  134. package/dist/types/components/sula-avatar/sula-avatar.stories.d.ts +7 -0
  135. package/dist/types/components/sula-badge/sula-badge.stories.d.ts +7 -0
  136. package/dist/types/components/sula-button/sula-button.stories.d.ts +7 -0
  137. package/dist/types/components/sula-checkbox/sula-checkbox.stories.d.ts +7 -0
  138. package/dist/types/components/sula-chip/model/sula-chip.model.d.ts +4 -0
  139. package/dist/types/components/sula-chip/sula-chip.d.ts +40 -0
  140. package/dist/types/components/sula-chip/sula-chip.stories.d.ts +64 -0
  141. package/dist/types/components/sula-loader/model/sula-loader.model.d.ts +5 -0
  142. package/dist/types/components/sula-loader/sula-loader.d.ts +19 -0
  143. package/dist/types/components/sula-loader/sula-loader.stories.d.ts +29 -0
  144. package/dist/types/components/sula-loader/test/__mocks__/lottie-web.d.ts +4 -0
  145. package/dist/types/components/sula-menu-select-list/model/sula-menu-select-list.model.d.ts +4 -0
  146. package/dist/types/components/sula-menu-select-list/sula-menu-select-list.d.ts +14 -0
  147. package/dist/types/components/sula-menu-select-list/sula-menu-select-list.stories.d.ts +32 -0
  148. package/dist/types/components/sula-radio-button/sula-radio-button.d.ts +32 -0
  149. package/dist/types/components/sula-radio-button/sula-radio-button.stories.d.ts +57 -0
  150. package/dist/types/components/sula-switch/sula-switch.stories.d.ts +7 -0
  151. package/dist/types/components/sula-tag/sula-tag.stories.d.ts +7 -0
  152. package/dist/types/components/sula-textarea/sula-textarea.stories.d.ts +7 -0
  153. package/dist/types/components/sula-textfield/sula-textfield.stories.d.ts +7 -0
  154. package/dist/types/components/sula-tiles/model/sula-tiles.model.d.ts +8 -0
  155. package/dist/types/components/sula-tiles/sula-tiles.d.ts +54 -0
  156. package/dist/types/components/sula-tiles/sula-tiles.stories.d.ts +99 -0
  157. package/dist/types/components.d.ts +383 -0
  158. package/dist/types/stencil-public-runtime.d.ts +23 -1
  159. package/dist/webcomponents/assets/lottie/loader.json +1 -0
  160. package/dist/webcomponents/index.esm.js +1 -0
  161. package/dist/webcomponents/index.esm.js.map +1 -1
  162. package/dist/webcomponents/loader.esm.js.map +1 -0
  163. package/dist/webcomponents/p-67f9fa90.entry.js +21628 -0
  164. package/dist/webcomponents/p-67f9fa90.entry.js.map +1 -0
  165. package/dist/webcomponents/p-Yyeke16a.js +1469 -0
  166. package/dist/webcomponents/p-Yyeke16a.js.map +1 -0
  167. package/dist/webcomponents/sula-avatar.sula-badge.sula-button.sula-checkbox.sula-chip.sula-icon.sula-loader.sula-menu-select-list.sula-radio-button.sula-switch.sula-tag.sula-textarea.sula-textfield.sula-tiles.entry.esm.js.map +1 -0
  168. package/dist/webcomponents/webcomponents.esm.js +33 -9
  169. package/dist/webcomponents/webcomponents.esm.js.map +1 -1
  170. package/package.json +5 -2
  171. package/dist/cjs/app-globals-3a1e7e63.js +0 -7
  172. package/dist/cjs/app-globals-3a1e7e63.js.map +0 -1
  173. package/dist/cjs/index-87eec792.js.map +0 -1
  174. package/dist/cjs/sula-avatar_9.cjs.entry.js +0 -865
  175. package/dist/cjs/sula-avatar_9.cjs.entry.js.map +0 -1
  176. package/dist/components/p-694eb028.js.map +0 -1
  177. package/dist/components/p-881c6b35.js +0 -1198
  178. package/dist/components/p-881c6b35.js.map +0 -1
  179. package/dist/esm/app-globals-0f993ce5.js +0 -5
  180. package/dist/esm/app-globals-0f993ce5.js.map +0 -1
  181. package/dist/esm/index-aa1c5f36.js.map +0 -1
  182. package/dist/esm/sula-avatar_9.entry.js +0 -853
  183. package/dist/esm/sula-avatar_9.entry.js.map +0 -1
  184. package/dist/webcomponents/p-5a36af0f.js +0 -1492
  185. package/dist/webcomponents/p-5a36af0f.js.map +0 -1
  186. package/dist/webcomponents/p-cc81e2c5.entry.js +0 -1123
  187. package/dist/webcomponents/p-cc81e2c5.entry.js.map +0 -1
  188. package/dist/webcomponents/p-e1255160.js +0 -4
  189. package/dist/webcomponents/p-e1255160.js.map +0 -1
  190. package/loader/package.json +0 -11
@@ -0,0 +1,243 @@
1
+ import { Host, h } from "@stencil/core";
2
+ import { SulaChipAppearance } from "./model/sula-chip.model";
3
+ export class SulaChip {
4
+ constructor() {
5
+ /**
6
+ * Chip text
7
+ */
8
+ this.text = '';
9
+ /**
10
+ * Chip appearance
11
+ */
12
+ this.appearance = SulaChipAppearance.Default;
13
+ /**
14
+ * Chip is disabled
15
+ */
16
+ this.disabled = false;
17
+ /**
18
+ * Items for list
19
+ */
20
+ this.items = [];
21
+ this.isFocused = false;
22
+ this.showItems = false;
23
+ this.handleFocus = () => {
24
+ if (this.disabled)
25
+ return;
26
+ this.isFocused = true;
27
+ };
28
+ this.handleBlur = () => {
29
+ if (this.disabled)
30
+ return;
31
+ this.isFocused = false;
32
+ };
33
+ this.handleClick = () => {
34
+ if (this.disabled)
35
+ return;
36
+ this.itemClicked.emit();
37
+ if (this.items.length > 0) {
38
+ this.showItems = !this.showItems;
39
+ this.isFocused = false;
40
+ }
41
+ };
42
+ this.handleItemSelected = (item) => {
43
+ this.menuItemSelected.emit(item.detail);
44
+ this.showItems = false;
45
+ };
46
+ }
47
+ handleDocumentClick(event) {
48
+ if (!this.node)
49
+ return;
50
+ const clickInside = this.node.contains(event.target);
51
+ if (!clickInside) {
52
+ this.showItems = false;
53
+ }
54
+ }
55
+ getIconClass() {
56
+ if (this.disabled)
57
+ return 'text-text-disabled';
58
+ if (this.appearance === SulaChipAppearance.Default) {
59
+ return 'text-text-primary';
60
+ }
61
+ else {
62
+ return 'text-negative-negative-2';
63
+ }
64
+ }
65
+ render() {
66
+ return (h(Host, { key: '0c92444ee99a6001fc4e660378a34d1edf35330a', ref: node => (this.node = node) }, h("div", { key: '99ed8d8663a3e99ccfa672a92526e86faeff7c63', class: "w-fit relative" }, h("div", { key: '602fa80f7d43c953d50eb4456361477532f04859', class: {
67
+ 'flex justify-center items-center px-16 py-2 rounded-xxl min-h-40 w-fit outline-none': true,
68
+ 'bg-surface-on-body hover:bg-states-empty-bg-hover active:bg-states-empty-bg-pressed': this.appearance === SulaChipAppearance.Default && !this.disabled,
69
+ 'bg-negative-negative-1 hover:bg-states-negative-hover active:bg-states-negative-pressed': this.appearance === SulaChipAppearance.Negative && !this.disabled,
70
+ 'bg-states-bg-disabled cursor-not-allowed': this.disabled,
71
+ 'cursor-pointer': !this.disabled,
72
+ 'border border-line-input chip-opened': !this.disabled && this.showItems,
73
+ 'chip-focus': this.isFocused,
74
+ }, tabIndex: 0, onClick: this.handleClick, onFocus: this.handleFocus, onBlur: this.handleBlur }, h("span", { key: 'c8008a1bccf957ceb5e1b90edc5e90d67ec4258f', class: {
75
+ 'text-base font-bold leading-4': true,
76
+ 'text-text-primary': this.appearance === SulaChipAppearance.Default && !this.disabled,
77
+ 'text-negative-negative-2': this.appearance === SulaChipAppearance.Negative && !this.disabled,
78
+ 'text-text-disabled': this.disabled,
79
+ } }, this.text), this.items.length > 0 && (h("div", { key: '2c0deb381c6b12c174f1128130add11a9c7d1077', class: "flex items-center justify-center ml-8 leading-4" }, h("sula-icon", { key: '0938769d19c69368560f9e5812310580cf81f984', icon: `ph-bold ph-caret-${this.showItems ? 'up' : 'down'}`, customClass: this.getIconClass() })))), this.showItems && (h("div", { key: 'e422f0479abecc1b8e5cb7924b59b89f2349c960', class: "absolute z-50 top-40 left-0" }, h("sula-menu-select-list", { key: '6e9c82f9bed0832cb2e545ef56ea6b3b4789485b', items: this.items, onItemSelected: this.handleItemSelected }))))));
80
+ }
81
+ static get is() { return "sula-chip"; }
82
+ static get encapsulation() { return "shadow"; }
83
+ static get originalStyleUrls() {
84
+ return {
85
+ "$": ["sula-chip.scss"]
86
+ };
87
+ }
88
+ static get styleUrls() {
89
+ return {
90
+ "$": ["sula-chip.css"]
91
+ };
92
+ }
93
+ static get properties() {
94
+ return {
95
+ "text": {
96
+ "type": "string",
97
+ "attribute": "text",
98
+ "mutable": true,
99
+ "complexType": {
100
+ "original": "string",
101
+ "resolved": "string",
102
+ "references": {}
103
+ },
104
+ "required": false,
105
+ "optional": false,
106
+ "docs": {
107
+ "tags": [],
108
+ "text": "Chip text"
109
+ },
110
+ "getter": false,
111
+ "setter": false,
112
+ "reflect": false,
113
+ "defaultValue": "''"
114
+ },
115
+ "appearance": {
116
+ "type": "string",
117
+ "attribute": "appearance",
118
+ "mutable": true,
119
+ "complexType": {
120
+ "original": "SulaChipAppearance",
121
+ "resolved": "SulaChipAppearance.Default | SulaChipAppearance.Negative",
122
+ "references": {
123
+ "SulaChipAppearance": {
124
+ "location": "import",
125
+ "path": "./model/sula-chip.model",
126
+ "id": "src/components/sula-chip/model/sula-chip.model.ts::SulaChipAppearance"
127
+ }
128
+ }
129
+ },
130
+ "required": false,
131
+ "optional": false,
132
+ "docs": {
133
+ "tags": [],
134
+ "text": "Chip appearance"
135
+ },
136
+ "getter": false,
137
+ "setter": false,
138
+ "reflect": false,
139
+ "defaultValue": "SulaChipAppearance.Default"
140
+ },
141
+ "disabled": {
142
+ "type": "boolean",
143
+ "attribute": "disabled",
144
+ "mutable": true,
145
+ "complexType": {
146
+ "original": "boolean",
147
+ "resolved": "boolean",
148
+ "references": {}
149
+ },
150
+ "required": false,
151
+ "optional": false,
152
+ "docs": {
153
+ "tags": [],
154
+ "text": "Chip is disabled"
155
+ },
156
+ "getter": false,
157
+ "setter": false,
158
+ "reflect": false,
159
+ "defaultValue": "false"
160
+ },
161
+ "items": {
162
+ "type": "unknown",
163
+ "attribute": "items",
164
+ "mutable": true,
165
+ "complexType": {
166
+ "original": "SulaMenuListItem[]",
167
+ "resolved": "SulaMenuListItem[]",
168
+ "references": {
169
+ "SulaMenuListItem": {
170
+ "location": "import",
171
+ "path": "../sula-menu-select-list/model/sula-menu-select-list.model",
172
+ "id": "src/components/sula-menu-select-list/model/sula-menu-select-list.model.ts::SulaMenuListItem"
173
+ }
174
+ }
175
+ },
176
+ "required": false,
177
+ "optional": false,
178
+ "docs": {
179
+ "tags": [],
180
+ "text": "Items for list"
181
+ },
182
+ "getter": false,
183
+ "setter": false,
184
+ "defaultValue": "[]"
185
+ }
186
+ };
187
+ }
188
+ static get states() {
189
+ return {
190
+ "isFocused": {},
191
+ "showItems": {}
192
+ };
193
+ }
194
+ static get events() {
195
+ return [{
196
+ "method": "itemClicked",
197
+ "name": "itemClicked",
198
+ "bubbles": true,
199
+ "cancelable": true,
200
+ "composed": true,
201
+ "docs": {
202
+ "tags": [],
203
+ "text": "Event emitted when chip is clicked"
204
+ },
205
+ "complexType": {
206
+ "original": "void",
207
+ "resolved": "void",
208
+ "references": {}
209
+ }
210
+ }, {
211
+ "method": "menuItemSelected",
212
+ "name": "menuItemSelected",
213
+ "bubbles": true,
214
+ "cancelable": true,
215
+ "composed": true,
216
+ "docs": {
217
+ "tags": [],
218
+ "text": "Event emitted when item is selected"
219
+ },
220
+ "complexType": {
221
+ "original": "SulaMenuListItem",
222
+ "resolved": "SulaMenuListItem",
223
+ "references": {
224
+ "SulaMenuListItem": {
225
+ "location": "import",
226
+ "path": "../sula-menu-select-list/model/sula-menu-select-list.model",
227
+ "id": "src/components/sula-menu-select-list/model/sula-menu-select-list.model.ts::SulaMenuListItem"
228
+ }
229
+ }
230
+ }
231
+ }];
232
+ }
233
+ static get listeners() {
234
+ return [{
235
+ "name": "click",
236
+ "method": "handleDocumentClick",
237
+ "target": "document",
238
+ "capture": false,
239
+ "passive": false
240
+ }];
241
+ }
242
+ }
243
+ //# sourceMappingURL=sula-chip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sula-chip.js","sourceRoot":"","sources":["../../../src/components/sula-chip/sula-chip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAE7F,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAQ7D,MAAM,OAAO,QAAQ;IALrB;QAME;;WAEG;QAEH,SAAI,GAAW,EAAE,CAAC;QAElB;;WAEG;QAEH,eAAU,GAAuB,kBAAkB,CAAC,OAAO,CAAC;QAE5D;;WAEG;QAEH,aAAQ,GAAY,KAAK,CAAC;QAE1B;;WAEG;QAEH,UAAK,GAAuB,EAAE,CAAC;QAe/B,cAAS,GAAG,KAAK,CAAC;QAGlB,cAAS,GAAG,KAAK,CAAC;QAelB,gBAAW,GAAG,GAAG,EAAE;YACjB,IAAI,IAAI,CAAC,QAAQ;gBAAE,OAAO;YAC1B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACxB,CAAC,CAAC;QAEF,eAAU,GAAG,GAAG,EAAE;YAChB,IAAI,IAAI,CAAC,QAAQ;gBAAE,OAAO;YAC1B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACzB,CAAC,CAAC;QAEF,gBAAW,GAAG,GAAG,EAAE;YACjB,IAAI,IAAI,CAAC,QAAQ;gBAAE,OAAO;YAE1B,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;YAExB,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC1B,IAAI,CAAC,SAAS,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC;gBACjC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;YAC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ventEmitter, Host, Listen, Prop, State, h } from '@stencil/core';\nimport { SulaMenuListItem } from '../sula-menu-select-list/model/sula-menu-select-list.model';\nimport { SulaChipAppearance } from './model/sula-chip.model';\nimport { SulaMenuSelectListCustomEvent } from '../../components';\n\n@Component({\n tag: 'sula-chip',\n styleUrl: 'sula-chip.scss',\n shadow: true,\n})\nexport class SulaChip {\n /**\n * Chip text\n */\n @Prop({ mutable: true })\n text: string = '';\n\n /**\n * Chip appearance\n */\n @Prop({ mutable: true })\n appearance: SulaChipAppearance = SulaChipAppearance.Default;\n\n /**\n * Chip is disabled\n */\n @Prop({ mutable: true })\n disabled: boolean = false;\n\n /**\n * Items for list\n */\n @Prop({ mutable: true })\n items: SulaMenuListItem[] = [];\n\n /**\n * Event emitted when chip is clicked\n */\n @Event()\n itemClicked: EventEmitter<void>;\n\n /**\n * Event emitted when item is selected\n */\n @Event()\n menuItemSelected: EventEmitter<SulaMenuListItem>;\n\n @State()\n isFocused = false;\n\n @State()\n showItems = false;\n\n node?: HTMLElement;\n\n @Listen('click', { target: 'document' })\n handleDocumentClick(event: Event) {\n if (!this.node) return;\n\n const clickInside = this.node.contains(event.target as Node);\n\n if (!clickInside) {\n this.showItems = false;\n }\n }\n\n handleFocus = () => {\n if (this.disabled) return;\n this.isFocused = true;\n };\n\n handleBlur = () => {\n if (this.disabled) return;\n this.isFocused = false;\n };\n\n handleClick = () => {\n if (this.disabled) return;\n\n this.itemClicked.emit();\n\n if (this.items.length > 0) {\n this.showItems = !this.showItems;\n this.isFocused = false;\n }\n };\n\n handleItemSelected = (item: SulaMenuSelectListCustomEvent<SulaMenuListItem>) => {\n this.menuItemSelected.emit(item.detail);\n this.showItems = false;\n };\n\n getIconClass() {\n if (this.disabled) return 'text-text-disabled';\n\n if (this.appearance === SulaChipAppearance.Default) {\n return 'text-text-primary';\n } else {\n return 'text-negative-negative-2';\n }\n }\n\n render() {\n return (\n <Host ref={node => (this.node = node)}>\n <div class=\"w-fit relative\">\n <div\n class={{\n 'flex justify-center items-center px-16 py-2 rounded-xxl min-h-40 w-fit outline-none': true,\n 'bg-surface-on-body hover:bg-states-empty-bg-hover active:bg-states-empty-bg-pressed': this.appearance === SulaChipAppearance.Default && !this.disabled,\n 'bg-negative-negative-1 hover:bg-states-negative-hover active:bg-states-negative-pressed': this.appearance === SulaChipAppearance.Negative && !this.disabled,\n 'bg-states-bg-disabled cursor-not-allowed': this.disabled,\n 'cursor-pointer': !this.disabled,\n 'border border-line-input chip-opened': !this.disabled && this.showItems,\n 'chip-focus': this.isFocused,\n }}\n tabIndex={0}\n onClick={this.handleClick}\n onFocus={this.handleFocus}\n onBlur={this.handleBlur}\n >\n <span\n class={{\n 'text-base font-bold leading-4': true,\n 'text-text-primary': this.appearance === SulaChipAppearance.Default && !this.disabled,\n 'text-negative-negative-2': this.appearance === SulaChipAppearance.Negative && !this.disabled,\n 'text-text-disabled': this.disabled,\n }}\n >\n {this.text}\n </span>\n\n {this.items.length > 0 && (\n <div class=\"flex items-center justify-center ml-8 leading-4\">\n <sula-icon icon={`ph-bold ph-caret-${this.showItems ? 'up' : 'down'}`} customClass={this.getIconClass()}></sula-icon>\n </div>\n )}\n </div>\n {this.showItems && (\n <div class=\"absolute z-50 top-40 left-0\">\n <sula-menu-select-list items={this.items} onItemSelected={this.handleItemSelected}></sula-menu-select-list>\n </div>\n )}\n </div>\n </Host>\n );\n }\n}\n"]}
@@ -0,0 +1,125 @@
1
+ import { SulaChipAppearance } from "./model/sula-chip.model";
2
+ export default {
3
+ title: 'Components/sula-chip',
4
+ tags: ['autodocs'],
5
+ argTypes: {
6
+ text: {
7
+ control: 'text',
8
+ defaultValue: 'Chip Text',
9
+ description: 'Chip text',
10
+ type: {
11
+ required: false,
12
+ },
13
+ },
14
+ appearance: {
15
+ control: { type: 'select' },
16
+ options: Object.values(SulaChipAppearance),
17
+ defaultValue: SulaChipAppearance.Default,
18
+ description: 'Chip appearance',
19
+ type: {
20
+ required: false,
21
+ },
22
+ },
23
+ disabled: {
24
+ control: 'boolean',
25
+ defaultValue: false,
26
+ description: 'Is chip disabled',
27
+ type: {
28
+ required: false,
29
+ },
30
+ },
31
+ items: {
32
+ control: 'object',
33
+ defaultValue: [],
34
+ description: 'Items for dropdown list',
35
+ type: {
36
+ required: false,
37
+ },
38
+ },
39
+ itemClicked: {
40
+ action: 'itemClicked',
41
+ description: 'Evento emitido quando o chip é clicado',
42
+ },
43
+ itemSelected: {
44
+ action: 'itemSelected',
45
+ description: 'Evento emitido quando um item é selecionado',
46
+ },
47
+ },
48
+ parameters: {
49
+ docs: {
50
+ description: {
51
+ component: 'O componente Chip Sula Design System é utilizado como filtro, substituí botões pequenos e deve ser usado dentro de componentes de lista. ',
52
+ },
53
+ },
54
+ },
55
+ };
56
+ const Template = args => {
57
+ const container = document.createElement('div');
58
+ container.style.margin = '20px';
59
+ const el = document.createElement('sula-chip');
60
+ if (args.text)
61
+ el.setAttribute('text', args.text);
62
+ el.setAttribute('appearance', args.appearance);
63
+ el.setAttribute('disabled', args.disabled.toString());
64
+ if (args.items && args.items.length > 0) {
65
+ el.items = args.items;
66
+ }
67
+ el.addEventListener('itemClicked', args.itemClicked);
68
+ el.addEventListener('itemSelected', args.itemSelected);
69
+ container.appendChild(el);
70
+ return container;
71
+ };
72
+ export const Default = Template.bind({});
73
+ Default.args = {
74
+ text: 'Default Chip',
75
+ appearance: SulaChipAppearance.Default,
76
+ disabled: false,
77
+ items: [],
78
+ };
79
+ export const NegativeAppearance = Template.bind({});
80
+ NegativeAppearance.args = {
81
+ text: 'Negative Chip',
82
+ appearance: SulaChipAppearance.Negative,
83
+ disabled: false,
84
+ items: [],
85
+ };
86
+ export const DisabledChip = Template.bind({});
87
+ DisabledChip.args = {
88
+ text: 'Disabled Chip',
89
+ appearance: SulaChipAppearance.Default,
90
+ disabled: true,
91
+ items: [],
92
+ };
93
+ export const ChipWithDropdown = Template.bind({});
94
+ ChipWithDropdown.args = {
95
+ text: 'Chip with Options',
96
+ appearance: SulaChipAppearance.Default,
97
+ disabled: false,
98
+ items: [
99
+ { id: '1', title: 'Option 1' },
100
+ { id: '2', title: 'Option 2' },
101
+ { id: '3', title: 'Option 3' },
102
+ ],
103
+ };
104
+ export const NegativeChipWithDropdown = Template.bind({});
105
+ NegativeChipWithDropdown.args = {
106
+ text: 'Negative with Options',
107
+ appearance: SulaChipAppearance.Negative,
108
+ disabled: false,
109
+ items: [
110
+ { id: '1', title: 'Remove Item 1' },
111
+ { id: '2', title: 'Remove Item 2' },
112
+ { id: '3', title: 'Remove Item 3' },
113
+ ],
114
+ };
115
+ export const DisabledChipWithItems = Template.bind({});
116
+ DisabledChipWithItems.args = {
117
+ text: 'Disabled with Items',
118
+ appearance: SulaChipAppearance.Default,
119
+ disabled: true,
120
+ items: [
121
+ { id: '1', title: 'Option 1' },
122
+ { id: '2', title: 'Option 2' },
123
+ ],
124
+ };
125
+ //# sourceMappingURL=sula-chip.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sula-chip.stories.js","sourceRoot":"","sources":["../../../src/components/sula-chip/sula-chip.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,eAAe;IACb,KAAK,EAAE,sBAAsB;IAC7B,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,OAAO,EAAE,MAAM;YACf,YAAY,EAAE,WAAW;YACzB,WAAW,EAAE,WAAW;YACxB,IAAI,EAAE;gBACJ,QAAQ,EAAE,KAAK;aAChB;SACF;QACD,UAAU,EAAE;YACV,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC3B,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC;YAC1C,YAAY,EAAE,kBAAkB,CAAC,OAAO;YACxC,WAAW,EAAE,iBAAiB;YAC9B,IAAI,EAAE;gBACJ,QAAQ,EAAE,KAAK;aAChB;SACF;QACD,QAAQ,EAAE;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UAAU,EAAE;QAC9B,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,UAAU,EAAE;KAC/B;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC1D,wBAAwB,CAAC,IAAI,GAAG;IAC9B,IAAI,EAAE,uBAAuB;IAC7B,UAAU,EAAE,kBAAkB,CAAC,QAAQ;IACvC,QAAQ,EAAE,KAAK;IACf,KAAK,EAAE;QACL,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,eAAe,EAAE;QACnC,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,eAAe,EAAE;QACnC,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,eAAe,EAAE;KACpC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACvD,qBAAqB,CAAC,IAAI,GAAG;IAC3B,IAAI,EAAE,qBAAqB;IAC3B,UAAU,EAAE,kBAAkB,CAAC,OAAO;IACtC,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE;QACL,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,UAAU,EAAE;QAC9B,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,UAAU,EAAE;KAC/B;CACF,CAAC","sourcesContent":["import { SulaChipAppearance } from './model/sula-chip.model';\n\nexport default {\n title: 'Components/sula-chip',\n tags: ['autodocs'],\n argTypes: {\n text: {\n control: 'text',\n defaultValue: 'Chip Text',\n description: 'Chip text',\n type: {\n required: false,\n },\n },\n appearance: {\n control: { type: 'select' },\n options: Object.values(SulaChipAppearance),\n defaultValue: SulaChipAppearance.Default,\n description: 'Chip appearance',\n type: {\n required: false,\n },\n },\n disabled: {\n control: 'boolean',\n defaultValue: false,\n description: 'Is chip disabled',\n type: {\n required: false,\n },\n },\n items: {\n control: 'object',\n defaultValue: [],\n description: 'Items for dropdown list',\n type: {\n required: false,\n },\n },\n itemClicked: {\n action: 'itemClicked',\n description: 'Evento emitido quando o chip é clicado',\n },\n itemSelected: {\n action: 'itemSelected',\n description: 'Evento emitido quando um item é selecionado',\n },\n },\n parameters: {\n docs: {\n description: {\n component: 'O componente Chip Sula Design System é utilizado como filtro, substituí botões pequenos e deve ser usado dentro de componentes de lista. ',\n },\n },\n },\n};\n\nconst Template = args => {\n const container = document.createElement('div');\n container.style.margin = '20px';\n\n const el = document.createElement('sula-chip');\n\n if (args.text) el.setAttribute('text', args.text);\n el.setAttribute('appearance', args.appearance);\n el.setAttribute('disabled', args.disabled.toString());\n\n if (args.items && args.items.length > 0) {\n el.items = args.items;\n }\n\n el.addEventListener('itemClicked', args.itemClicked);\n el.addEventListener('itemSelected', args.itemSelected);\n\n container.appendChild(el);\n\n return container;\n};\n\nexport const Default = Template.bind({});\nDefault.args = {\n text: 'Default Chip',\n appearance: SulaChipAppearance.Default,\n disabled: false,\n items: [],\n};\n\nexport const NegativeAppearance = Template.bind({});\nNegativeAppearance.args = {\n text: 'Negative Chip',\n appearance: SulaChipAppearance.Negative,\n disabled: false,\n items: [],\n};\n\nexport const DisabledChip = Template.bind({});\nDisabledChip.args = {\n text: 'Disabled Chip',\n appearance: SulaChipAppearance.Default,\n disabled: true,\n items: [],\n};\n\nexport const ChipWithDropdown = Template.bind({});\nChipWithDropdown.args = {\n text: 'Chip with Options',\n appearance: SulaChipAppearance.Default,\n disabled: false,\n items: [\n { id: '1', title: 'Option 1' },\n { id: '2', title: 'Option 2' },\n { id: '3', title: 'Option 3' },\n ],\n};\n\nexport const NegativeChipWithDropdown = Template.bind({});\nNegativeChipWithDropdown.args = {\n text: 'Negative with Options',\n appearance: SulaChipAppearance.Negative,\n disabled: false,\n items: [\n { id: '1', title: 'Remove Item 1' },\n { id: '2', title: 'Remove Item 2' },\n { id: '3', title: 'Remove Item 3' },\n ],\n};\n\nexport const DisabledChipWithItems = Template.bind({});\nDisabledChipWithItems.args = {\n text: 'Disabled with Items',\n appearance: SulaChipAppearance.Default,\n disabled: true,\n items: [\n { id: '1', title: 'Option 1' },\n { id: '2', title: 'Option 2' },\n ],\n};\n"]}