@rededor/cura 1.6.1-alpha.8 → 1.7.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 (206) hide show
  1. package/dist/assets/assets/icons/iconset-default-list.ts +1 -1
  2. package/dist/assets/assets/icons/iconset-default-tmp.svg +4 -0
  3. package/dist/assets/assets/icons/iconset-default.svg +1 -1
  4. package/dist/cjs/{app-globals-28c6f5c4.js → app-globals-6d5b51b6.js} +2 -2
  5. package/dist/cjs/{app-globals-28c6f5c4.js.map → app-globals-6d5b51b6.js.map} +1 -1
  6. package/dist/cjs/{cura-accordion_18.cjs.entry.js → cura-accordion_20.cjs.entry.js} +148 -8
  7. package/dist/cjs/cura-accordion_20.cjs.entry.js.map +1 -0
  8. package/dist/cjs/cura-checkbox.cjs.entry.js +4 -3
  9. package/dist/cjs/cura-checkbox.cjs.entry.js.map +1 -1
  10. package/dist/cjs/cura-display.cjs.entry.js +1 -1
  11. package/dist/cjs/cura-icons-view.cjs.entry.js +1 -1
  12. package/dist/cjs/cura-icons-view.cjs.entry.js.map +1 -1
  13. package/dist/cjs/cura-modal.cjs.entry.js +3 -3
  14. package/dist/cjs/cura-modal.cjs.entry.js.map +1 -1
  15. package/dist/cjs/cura-radio.cjs.entry.js +4 -3
  16. package/dist/cjs/cura-radio.cjs.entry.js.map +1 -1
  17. package/dist/cjs/cura-switch.cjs.entry.js +4 -4
  18. package/dist/cjs/cura-switch.cjs.entry.js.map +1 -1
  19. package/dist/cjs/cura-tabs-button.cjs.entry.js +106 -0
  20. package/dist/cjs/cura-tabs-button.cjs.entry.js.map +1 -0
  21. package/dist/cjs/cura-tabs-transparent.cjs.entry.js +105 -0
  22. package/dist/cjs/cura-tabs-transparent.cjs.entry.js.map +1 -0
  23. package/dist/cjs/cura-tabs.definitions-b8955ad4.js +12 -0
  24. package/dist/cjs/cura-tabs.definitions-b8955ad4.js.map +1 -0
  25. package/dist/cjs/{cura-theme-module-f1e4a309.js → cura-theme-module-09bb63a4.js} +32 -1
  26. package/dist/cjs/cura-theme-module-09bb63a4.js.map +1 -0
  27. package/dist/cjs/cura.cjs.js +3 -3
  28. package/dist/cjs/index.cjs.js +1 -1
  29. package/dist/cjs/loader.cjs.js +3 -3
  30. package/dist/collection/api/theme-presets/theme-perinatal-temporary.js +32 -0
  31. package/dist/collection/api/theme-presets/theme-perinatal-temporary.js.map +1 -0
  32. package/dist/collection/api/theme-presets/theme-presets.js +2 -0
  33. package/dist/collection/api/theme-presets/theme-presets.js.map +1 -1
  34. package/dist/collection/assets/icons/iconset-default-list.js +1 -1
  35. package/dist/collection/assets/icons/iconset-default-list.js.map +1 -1
  36. package/dist/collection/assets/icons/iconset-default-tmp.svg +4 -0
  37. package/dist/collection/assets/icons/iconset-default.svg +1 -1
  38. package/dist/collection/assets-raw/icons/default/vaccine.svg +3 -0
  39. package/dist/collection/collection-manifest.json +4 -0
  40. package/dist/collection/components/cura-avatar/cura-avatar.js +34 -16
  41. package/dist/collection/components/cura-avatar/cura-avatar.js.map +1 -1
  42. package/dist/collection/components/cura-modal/cura-modal.css +1 -1
  43. package/dist/collection/components/cura-modal/cura-modal.js +2 -2
  44. package/dist/collection/components/cura-modal/cura-modal.js.map +1 -1
  45. package/dist/collection/components/forms/cura-checkbox/cura-checkbox.css +5 -7
  46. package/dist/collection/components/forms/cura-checkbox/cura-checkbox.js +31 -6
  47. package/dist/collection/components/forms/cura-checkbox/cura-checkbox.js.map +1 -1
  48. package/dist/collection/components/forms/cura-radio/cura-radio.css +8 -11
  49. package/dist/collection/components/forms/cura-radio/cura-radio.js +31 -6
  50. package/dist/collection/components/forms/cura-radio/cura-radio.js.map +1 -1
  51. package/dist/collection/components/forms/cura-select/cura-select.css +1 -1
  52. package/dist/collection/components/forms/cura-select/cura-select.js +22 -3
  53. package/dist/collection/components/forms/cura-select/cura-select.js.map +1 -1
  54. package/dist/collection/components/forms/cura-select/cura-select.stories.js +12 -0
  55. package/dist/collection/components/forms/cura-select/cura-select.stories.js.map +1 -1
  56. package/dist/collection/components/forms/cura-switch/cura-switch.css +1 -4
  57. package/dist/collection/components/forms/cura-switch/cura-switch.js +31 -7
  58. package/dist/collection/components/forms/cura-switch/cura-switch.js.map +1 -1
  59. package/dist/collection/components/tabs/cura-tabs/cura-tabs.css +170 -0
  60. package/dist/collection/components/tabs/cura-tabs/cura-tabs.js +263 -0
  61. package/dist/collection/components/tabs/cura-tabs/cura-tabs.js.map +1 -0
  62. package/dist/collection/components/tabs/cura-tabs/cura-tabs.stories.js +89 -0
  63. package/dist/collection/components/tabs/cura-tabs/cura-tabs.stories.js.map +1 -0
  64. package/dist/collection/components/tabs/cura-tabs-button/cura-tabs-button.css +176 -0
  65. package/dist/collection/components/tabs/cura-tabs-button/cura-tabs-button.js +259 -0
  66. package/dist/collection/components/tabs/cura-tabs-button/cura-tabs-button.js.map +1 -0
  67. package/dist/collection/components/tabs/cura-tabs-button/cura-tabs-button.stories.js +96 -0
  68. package/dist/collection/components/tabs/cura-tabs-button/cura-tabs-button.stories.js.map +1 -0
  69. package/dist/collection/components/tabs/cura-tabs-group/cura-tabs-group.css +25 -0
  70. package/dist/collection/components/tabs/cura-tabs-group/cura-tabs-group.js +133 -0
  71. package/dist/collection/components/tabs/cura-tabs-group/cura-tabs-group.js.map +1 -0
  72. package/dist/collection/components/tabs/cura-tabs-group/cura-tabs-group.stories.js +65 -0
  73. package/dist/collection/components/tabs/cura-tabs-group/cura-tabs-group.stories.js.map +1 -0
  74. package/dist/collection/components/tabs/cura-tabs-transparent/cura-tabs-transparent.css +168 -0
  75. package/dist/collection/components/tabs/cura-tabs-transparent/cura-tabs-transparent.js +258 -0
  76. package/dist/collection/components/tabs/cura-tabs-transparent/cura-tabs-transparent.js.map +1 -0
  77. package/dist/collection/components/tabs/cura-tabs-transparent/cura-tabs-transparent.stories.js +89 -0
  78. package/dist/collection/components/tabs/cura-tabs-transparent/cura-tabs-transparent.stories.js.map +1 -0
  79. package/dist/collection/components/tabs/cura-tabs.definitions.js +7 -0
  80. package/dist/collection/components/tabs/cura-tabs.definitions.js.map +1 -0
  81. package/dist/collection/components/text/cura-display/cura-display.js +1 -1
  82. package/dist/collection/components/text/cura-heading/cura-heading.js +1 -1
  83. package/dist/collection/components/text/cura-paragraph/cura-paragraph.js +1 -1
  84. package/dist/components/cura-avatar.js +1 -1
  85. package/dist/components/cura-avatar.js.map +1 -1
  86. package/dist/components/cura-checkbox.js +6 -4
  87. package/dist/components/cura-checkbox.js.map +1 -1
  88. package/dist/components/cura-display.js +1 -1
  89. package/dist/components/cura-heading2.js +1 -1
  90. package/dist/components/cura-icons-view.js +1 -1
  91. package/dist/components/cura-icons-view.js.map +1 -1
  92. package/dist/components/cura-modal.js +3 -3
  93. package/dist/components/cura-modal.js.map +1 -1
  94. package/dist/components/cura-paragraph2.js +1 -1
  95. package/dist/components/cura-radio.js +6 -4
  96. package/dist/components/cura-radio.js.map +1 -1
  97. package/dist/components/cura-select2.js +6 -4
  98. package/dist/components/cura-select2.js.map +1 -1
  99. package/dist/components/cura-switch.js +6 -5
  100. package/dist/components/cura-switch.js.map +1 -1
  101. package/dist/components/cura-tabs-button.d.ts +11 -0
  102. package/dist/components/cura-tabs-button.js +150 -0
  103. package/dist/components/cura-tabs-button.js.map +1 -0
  104. package/dist/components/cura-tabs-group.d.ts +11 -0
  105. package/dist/components/cura-tabs-group.js +64 -0
  106. package/dist/components/cura-tabs-group.js.map +1 -0
  107. package/dist/components/cura-tabs-transparent.d.ts +11 -0
  108. package/dist/components/cura-tabs-transparent.js +143 -0
  109. package/dist/components/cura-tabs-transparent.js.map +1 -0
  110. package/dist/components/cura-tabs.d.ts +11 -0
  111. package/dist/components/cura-tabs.definitions.js +10 -0
  112. package/dist/components/cura-tabs.definitions.js.map +1 -0
  113. package/dist/components/cura-tabs.js +148 -0
  114. package/dist/components/cura-tabs.js.map +1 -0
  115. package/dist/components/index.js +39 -0
  116. package/dist/components/index.js.map +1 -1
  117. package/dist/cura/cura.esm.js +1 -1
  118. package/dist/cura/cura.esm.js.map +1 -1
  119. package/dist/cura/index.esm.js +1 -1
  120. package/dist/cura/p-0ccde0ff.entry.js +2 -0
  121. package/dist/cura/p-0ccde0ff.entry.js.map +1 -0
  122. package/dist/cura/p-1ef21ae9.entry.js +2 -0
  123. package/dist/cura/p-1ef21ae9.entry.js.map +1 -0
  124. package/dist/cura/p-53c18ed4.js +2 -0
  125. package/dist/cura/p-53c18ed4.js.map +1 -0
  126. package/dist/cura/p-5c6f9593.entry.js +2 -0
  127. package/dist/cura/p-5c6f9593.entry.js.map +1 -0
  128. package/dist/cura/{p-0c25333f.js → p-6cbd49dd.js} +2 -2
  129. package/dist/cura/p-7a68835f.entry.js +2 -0
  130. package/dist/cura/p-7a68835f.entry.js.map +1 -0
  131. package/dist/cura/p-7e2d1229.entry.js +2 -0
  132. package/dist/cura/p-7e2d1229.entry.js.map +1 -0
  133. package/dist/cura/{p-ac01bec2.entry.js → p-8aade007.entry.js} +2 -2
  134. package/dist/cura/p-9f460031.js +2 -0
  135. package/dist/cura/p-9f460031.js.map +1 -0
  136. package/dist/cura/p-b4ee956b.entry.js +2 -0
  137. package/dist/cura/p-b4ee956b.entry.js.map +1 -0
  138. package/dist/cura/p-b6ff8ac1.entry.js +2 -0
  139. package/dist/cura/p-b6ff8ac1.entry.js.map +1 -0
  140. package/dist/cura/p-d8e1e182.entry.js +2 -0
  141. package/dist/cura/p-d8e1e182.entry.js.map +1 -0
  142. package/dist/esm/{app-globals-ca1945d1.js → app-globals-c2abb41c.js} +2 -2
  143. package/dist/esm/{app-globals-ca1945d1.js.map → app-globals-c2abb41c.js.map} +1 -1
  144. package/dist/esm/{cura-accordion_18.entry.js → cura-accordion_20.entry.js} +147 -9
  145. package/dist/esm/cura-accordion_20.entry.js.map +1 -0
  146. package/dist/esm/cura-checkbox.entry.js +4 -3
  147. package/dist/esm/cura-checkbox.entry.js.map +1 -1
  148. package/dist/esm/cura-display.entry.js +1 -1
  149. package/dist/esm/cura-icons-view.entry.js +1 -1
  150. package/dist/esm/cura-icons-view.entry.js.map +1 -1
  151. package/dist/esm/cura-modal.entry.js +3 -3
  152. package/dist/esm/cura-modal.entry.js.map +1 -1
  153. package/dist/esm/cura-radio.entry.js +4 -3
  154. package/dist/esm/cura-radio.entry.js.map +1 -1
  155. package/dist/esm/cura-switch.entry.js +4 -4
  156. package/dist/esm/cura-switch.entry.js.map +1 -1
  157. package/dist/esm/cura-tabs-button.entry.js +102 -0
  158. package/dist/esm/cura-tabs-button.entry.js.map +1 -0
  159. package/dist/esm/cura-tabs-transparent.entry.js +101 -0
  160. package/dist/esm/cura-tabs-transparent.entry.js.map +1 -0
  161. package/dist/esm/cura-tabs.definitions-a017126e.js +10 -0
  162. package/dist/esm/cura-tabs.definitions-a017126e.js.map +1 -0
  163. package/dist/esm/{cura-theme-module-0fa5ee0b.js → cura-theme-module-bf286f68.js} +32 -1
  164. package/dist/esm/cura-theme-module-bf286f68.js.map +1 -0
  165. package/dist/esm/cura.js +3 -3
  166. package/dist/esm/index.js +1 -1
  167. package/dist/esm/loader.js +3 -3
  168. package/dist/types/api/theme-presets/theme-perinatal-temporary.d.ts +43 -0
  169. package/dist/types/api/theme-presets/theme-presets.d.ts +43 -0
  170. package/dist/types/components/cura-avatar/cura-avatar.d.ts +37 -0
  171. package/dist/types/components/forms/cura-checkbox/cura-checkbox.d.ts +17 -4
  172. package/dist/types/components/forms/cura-radio/cura-radio.d.ts +17 -4
  173. package/dist/types/components/forms/cura-select/cura-select.d.ts +6 -0
  174. package/dist/types/components/forms/cura-select/cura-select.stories.d.ts +11 -0
  175. package/dist/types/components/forms/cura-switch/cura-switch.d.ts +16 -3
  176. package/dist/types/components/tabs/cura-tabs/cura-tabs.d.ts +30 -0
  177. package/dist/types/components/tabs/cura-tabs/cura-tabs.stories.d.ts +99 -0
  178. package/dist/types/components/tabs/cura-tabs-button/cura-tabs-button.d.ts +29 -0
  179. package/dist/types/components/tabs/cura-tabs-button/cura-tabs-button.stories.d.ts +99 -0
  180. package/dist/types/components/tabs/cura-tabs-group/cura-tabs-group.d.ts +18 -0
  181. package/dist/types/components/tabs/cura-tabs-group/cura-tabs-group.stories.d.ts +57 -0
  182. package/dist/types/components/tabs/cura-tabs-transparent/cura-tabs-transparent.d.ts +29 -0
  183. package/dist/types/components/tabs/cura-tabs-transparent/cura-tabs-transparent.stories.d.ts +99 -0
  184. package/dist/types/components/tabs/cura-tabs.definitions.d.ts +6 -0
  185. package/dist/types/components.d.ts +298 -24
  186. package/package.json +2 -2
  187. package/dist/cjs/cura-accordion_18.cjs.entry.js.map +0 -1
  188. package/dist/cjs/cura-theme-module-f1e4a309.js.map +0 -1
  189. package/dist/cura/p-03feed94.entry.js +0 -2
  190. package/dist/cura/p-03feed94.entry.js.map +0 -1
  191. package/dist/cura/p-07817634.entry.js +0 -2
  192. package/dist/cura/p-07817634.entry.js.map +0 -1
  193. package/dist/cura/p-84c18273.entry.js +0 -2
  194. package/dist/cura/p-84c18273.entry.js.map +0 -1
  195. package/dist/cura/p-9fce5ec5.entry.js +0 -2
  196. package/dist/cura/p-9fce5ec5.entry.js.map +0 -1
  197. package/dist/cura/p-b84924e1.entry.js +0 -2
  198. package/dist/cura/p-b84924e1.entry.js.map +0 -1
  199. package/dist/cura/p-b856b946.entry.js +0 -2
  200. package/dist/cura/p-b856b946.entry.js.map +0 -1
  201. package/dist/cura/p-bf8e2037.js +0 -2
  202. package/dist/cura/p-bf8e2037.js.map +0 -1
  203. package/dist/esm/cura-accordion_18.entry.js.map +0 -1
  204. package/dist/esm/cura-theme-module-0fa5ee0b.js.map +0 -1
  205. /package/dist/cura/{p-0c25333f.js.map → p-6cbd49dd.js.map} +0 -0
  206. /package/dist/cura/{p-ac01bec2.entry.js.map → p-8aade007.entry.js.map} +0 -0
@@ -0,0 +1,259 @@
1
+ import { h, Host } from "@stencil/core";
2
+ import { labelSizes } from "../cura-tabs.definitions";
3
+ export class CuraTabs {
4
+ constructor() {
5
+ this.name = undefined;
6
+ this.iconName = undefined;
7
+ this.counter = 1;
8
+ this.selected = false;
9
+ this.disabled = false;
10
+ this.size = 'large';
11
+ this.colorMode = 'light';
12
+ this.hovered = false;
13
+ this.styles = {};
14
+ }
15
+ setColors() {
16
+ const colors = [
17
+ { name: '--background-color-selected', theme: this.colorMode === 'light' ? 'primary-base' : 'primary-light' },
18
+ { name: '--background-color-hover', theme: this.colorMode === 'light' ? 'primary-light' : null },
19
+ {
20
+ name: '--background-disabled-selected',
21
+ theme: this.colorMode === 'light' ? 'neutral-white' : 'neutral-black',
22
+ },
23
+ {
24
+ name: '--border-color',
25
+ theme: this.colorMode === 'light' ? 'primary-base' : 'primary-light',
26
+ },
27
+ ];
28
+ colors.forEach(c => {
29
+ if (c.theme)
30
+ this.styles[c.name] = window.CuraAPI.theme.colors.getColor(c.theme);
31
+ });
32
+ this.styles = Object.assign({}, this.styles);
33
+ }
34
+ computeContentColor() {
35
+ if (this.disabled)
36
+ return 'neutral-dark';
37
+ if (this.colorMode === 'dark') {
38
+ if (this.hovered && !this.selected) {
39
+ return 'neutral-purewhite';
40
+ }
41
+ return this.selected ? 'neutral-black' : 'primary-lighter';
42
+ }
43
+ return this.selected ? 'neutral-purewhite' : 'primary-dark';
44
+ }
45
+ getIcon() {
46
+ if (!this.iconName)
47
+ return '';
48
+ const iconSize = this.size === 'large' ? 20 : 16;
49
+ const iconColor = this.computeContentColor();
50
+ return h("cura-icon", { name: this.iconName, size: iconSize, color: iconColor });
51
+ }
52
+ getClasses() {
53
+ return {
54
+ [this.size]: true,
55
+ [this.colorMode]: true,
56
+ selected: this.selected,
57
+ disabled: this.disabled,
58
+ };
59
+ }
60
+ getCounter() {
61
+ return h("cura-badge-counter", { number: this.counter, color: "primary", disabled: this.disabled, class: "badge-number" });
62
+ }
63
+ connectedCallback() {
64
+ this.styles = Object.assign(Object.assign({}, this.styles), { '--primary-dark': window.CuraAPI.theme.colors.getColor('primary-dark'), '--neutral-purewhite': window.CuraAPI.theme.colors.getColor('neutral-purewhite'), '--neutral-dark': window.CuraAPI.theme.colors.getColor('neutral-dark'), '--base-spacing': window.CuraAPI.theme.spacing.getSpacing() });
65
+ this.setColors();
66
+ }
67
+ handleMouseEnter() {
68
+ if (this.disabled)
69
+ return;
70
+ this.hovered = true;
71
+ }
72
+ handleMouseLeave() {
73
+ this.hovered = false;
74
+ }
75
+ handleClick(e) {
76
+ if (this.disabled) {
77
+ e.preventDefault();
78
+ return;
79
+ }
80
+ this.selected = !this.selected;
81
+ this.tabSelect.emit({ name: this.name });
82
+ }
83
+ render() {
84
+ const labelSize = labelSizes[this.size] || labelSizes['default'];
85
+ const labelColor = this.computeContentColor();
86
+ return (h(Host, { key: '9410b9c68061ffb5d838fe6ab2f409be9b90c6ac', role: "button", "aria-pressed": this.selected, "aria-disabled": this.disabled }, h("button", { key: '1ac26d9b41e072f1ec3668d66fee83679640c54f', class: this.getClasses(), style: this.styles, onClick: e => this.handleClick(e), disabled: this.disabled, onMouseEnter: this.handleMouseEnter.bind(this), onMouseLeave: this.handleMouseLeave.bind(this) }, this.getIcon(), h("cura-label", { key: 'ff854d36883b062d699388e71e6315f76f008f79', size: labelSize, color: labelColor, lineHeight: "0", marginBlock: "0" }, h("slot", { key: '6ab5c0cdea38f9094bb382943fe25c3967a681ab' })), this.counter > 0 && this.getCounter())));
87
+ }
88
+ static get is() { return "cura-tabs-button"; }
89
+ static get encapsulation() { return "shadow"; }
90
+ static get originalStyleUrls() {
91
+ return {
92
+ "$": ["cura-tabs-button.scss"]
93
+ };
94
+ }
95
+ static get styleUrls() {
96
+ return {
97
+ "$": ["cura-tabs-button.css"]
98
+ };
99
+ }
100
+ static get properties() {
101
+ return {
102
+ "name": {
103
+ "type": "string",
104
+ "mutable": false,
105
+ "complexType": {
106
+ "original": "string",
107
+ "resolved": "string",
108
+ "references": {}
109
+ },
110
+ "required": false,
111
+ "optional": false,
112
+ "docs": {
113
+ "tags": [],
114
+ "text": ""
115
+ },
116
+ "attribute": "name",
117
+ "reflect": true
118
+ },
119
+ "iconName": {
120
+ "type": "string",
121
+ "mutable": false,
122
+ "complexType": {
123
+ "original": "string",
124
+ "resolved": "string",
125
+ "references": {}
126
+ },
127
+ "required": false,
128
+ "optional": false,
129
+ "docs": {
130
+ "tags": [],
131
+ "text": ""
132
+ },
133
+ "attribute": "icon-name",
134
+ "reflect": true
135
+ },
136
+ "counter": {
137
+ "type": "number",
138
+ "mutable": true,
139
+ "complexType": {
140
+ "original": "number",
141
+ "resolved": "number",
142
+ "references": {}
143
+ },
144
+ "required": false,
145
+ "optional": true,
146
+ "docs": {
147
+ "tags": [],
148
+ "text": ""
149
+ },
150
+ "attribute": "counter",
151
+ "reflect": true,
152
+ "defaultValue": "1"
153
+ },
154
+ "selected": {
155
+ "type": "boolean",
156
+ "mutable": true,
157
+ "complexType": {
158
+ "original": "boolean",
159
+ "resolved": "boolean",
160
+ "references": {}
161
+ },
162
+ "required": false,
163
+ "optional": false,
164
+ "docs": {
165
+ "tags": [],
166
+ "text": ""
167
+ },
168
+ "attribute": "selected",
169
+ "reflect": true,
170
+ "defaultValue": "false"
171
+ },
172
+ "disabled": {
173
+ "type": "boolean",
174
+ "mutable": true,
175
+ "complexType": {
176
+ "original": "boolean",
177
+ "resolved": "boolean",
178
+ "references": {}
179
+ },
180
+ "required": false,
181
+ "optional": false,
182
+ "docs": {
183
+ "tags": [],
184
+ "text": ""
185
+ },
186
+ "attribute": "disabled",
187
+ "reflect": true,
188
+ "defaultValue": "false"
189
+ },
190
+ "size": {
191
+ "type": "string",
192
+ "mutable": false,
193
+ "complexType": {
194
+ "original": "'small' | 'medium' | 'large'",
195
+ "resolved": "\"large\" | \"medium\" | \"small\"",
196
+ "references": {}
197
+ },
198
+ "required": false,
199
+ "optional": false,
200
+ "docs": {
201
+ "tags": [],
202
+ "text": ""
203
+ },
204
+ "attribute": "size",
205
+ "reflect": true,
206
+ "defaultValue": "'large'"
207
+ },
208
+ "colorMode": {
209
+ "type": "string",
210
+ "mutable": true,
211
+ "complexType": {
212
+ "original": "'dark' | 'light'",
213
+ "resolved": "\"dark\" | \"light\"",
214
+ "references": {}
215
+ },
216
+ "required": false,
217
+ "optional": false,
218
+ "docs": {
219
+ "tags": [],
220
+ "text": ""
221
+ },
222
+ "attribute": "color-mode",
223
+ "reflect": true,
224
+ "defaultValue": "'light'"
225
+ }
226
+ };
227
+ }
228
+ static get states() {
229
+ return {
230
+ "hovered": {},
231
+ "styles": {}
232
+ };
233
+ }
234
+ static get events() {
235
+ return [{
236
+ "method": "tabSelect",
237
+ "name": "tabSelect",
238
+ "bubbles": true,
239
+ "cancelable": true,
240
+ "composed": true,
241
+ "docs": {
242
+ "tags": [],
243
+ "text": ""
244
+ },
245
+ "complexType": {
246
+ "original": "{ name: string }",
247
+ "resolved": "{ name: string; }",
248
+ "references": {}
249
+ }
250
+ }];
251
+ }
252
+ static get watchers() {
253
+ return [{
254
+ "propName": "colorMode",
255
+ "methodName": "setColors"
256
+ }];
257
+ }
258
+ }
259
+ //# sourceMappingURL=cura-tabs-button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cura-tabs-button.js","sourceRoot":"","sources":["../../../../src/components/tabs/cura-tabs-button/cura-tabs-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC5F,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAOtD,MAAM,OAAO,QAAQ;;;;uBAGwC,CAAC;wBACA,KAAK;wBACL,KAAK;oBACH,OAAO;yBACC,OAAO;uBAE1D,KAAK;sBACkB,EAAE;;IAK5C,SAAS;QACP,MAAM,MAAM,GAAG;YACb,EAAE,IAAI,EAAE,6BAA6B,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,KAAK,OAAO,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,eAAe,EAAE;YAC7G,EAAE,IAAI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IAAI,CAAC,UAAU,EAAE,CAC/B,CACJ,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Event, EventEmitter, h, Host, Prop, State, Watch } from '@stencil/core';\nimport { labelSizes } from '../cura-tabs.definitions';\n\n@Component({\n tag: 'cura-tabs-button',\n styleUrl: 'cura-tabs-button.scss',\n shadow: true,\n})\nexport class CuraTabs {\n @Prop({ reflect: true }) name: string;\n @Prop({ reflect: true }) iconName: string;\n @Prop({ reflect: true, mutable: true }) counter?: number = 1;\n @Prop({ reflect: true, mutable: true }) selected: boolean = false;\n @Prop({ reflect: true, mutable: true }) disabled: boolean = false;\n @Prop({ reflect: true }) size: 'small' | 'medium' | 'large' = 'large';\n @Prop({ reflect: true, mutable: true }) colorMode: 'dark' | 'light' = 'light';\n\n @State() hovered = false;\n @State() styles: Record<string, string> = {};\n\n @Event() tabSelect: EventEmitter<{ name: string }>;\n\n @Watch('colorMode')\n setColors() {\n const colors = [\n { name: '--background-color-selected', theme: this.colorMode === 'light' ? 'primary-base' : 'primary-light' },\n { name: '--background-color-hover', theme: this.colorMode === 'light' ? 'primary-light' : null },\n {\n name: '--background-disabled-selected',\n theme: this.colorMode === 'light' ? 'neutral-white' : 'neutral-black',\n },\n {\n name: '--border-color',\n theme: this.colorMode === 'light' ? 'primary-base' : 'primary-light',\n },\n ];\n\n colors.forEach(c => {\n if (c.theme) this.styles[c.name] = window.CuraAPI.theme.colors.getColor(c.theme);\n });\n\n this.styles = { ...this.styles };\n }\n\n computeContentColor(): string {\n if (this.disabled) return 'neutral-dark';\n\n if (this.colorMode === 'dark') {\n if (this.hovered && !this.selected) {\n return 'neutral-purewhite';\n }\n return this.selected ? 'neutral-black' : 'primary-lighter';\n }\n\n return this.selected ? 'neutral-purewhite' : 'primary-dark';\n }\n\n getIcon() {\n if (!this.iconName) return '';\n const iconSize = this.size === 'large' ? 20 : 16;\n const iconColor = this.computeContentColor();\n\n return <cura-icon name={this.iconName} size={iconSize} color={iconColor}></cura-icon>;\n }\n\n getClasses() {\n return {\n [this.size]: true,\n [this.colorMode]: true,\n selected: this.selected,\n disabled: this.disabled,\n };\n }\n\n getCounter() {\n return <cura-badge-counter number={this.counter} color=\"primary\" disabled={this.disabled} class=\"badge-number\"></cura-badge-counter>;\n }\n\n connectedCallback() {\n this.styles = {\n ...this.styles,\n '--primary-dark': window.CuraAPI.theme.colors.getColor('primary-dark'),\n '--neutral-purewhite': window.CuraAPI.theme.colors.getColor('neutral-purewhite'),\n '--neutral-dark': window.CuraAPI.theme.colors.getColor('neutral-dark'),\n '--base-spacing': window.CuraAPI.theme.spacing.getSpacing(),\n };\n\n this.setColors();\n }\n\n handleMouseEnter() {\n if (this.disabled) return;\n this.hovered = true;\n }\n\n handleMouseLeave() {\n this.hovered = false;\n }\n\n handleClick(e: Event) {\n if (this.disabled) {\n e.preventDefault();\n return;\n }\n\n this.selected = !this.selected;\n this.tabSelect.emit({ name: this.name });\n }\n\n render() {\n const labelSize = labelSizes[this.size] || labelSizes['default'];\n const labelColor = this.computeContentColor();\n\n return (\n <Host role=\"button\" aria-pressed={this.selected} aria-disabled={this.disabled}>\n <button\n class={this.getClasses()}\n style={this.styles}\n onClick={e => this.handleClick(e)}\n disabled={this.disabled}\n onMouseEnter={this.handleMouseEnter.bind(this)}\n onMouseLeave={this.handleMouseLeave.bind(this)}\n >\n {this.getIcon()}\n <cura-label size={labelSize} color={labelColor} lineHeight=\"0\" marginBlock=\"0\">\n <slot></slot>\n </cura-label>\n {this.counter > 0 && this.getCounter()}\n </button>\n </Host>\n );\n }\n}\n"]}
@@ -0,0 +1,96 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s)
4
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ import iconNames from "../../../assets/icons/iconset-default-list";
14
+ const renderCuraTabsButton = (args) => `
15
+ <cura-tabs-button
16
+ name=${args.name}
17
+ icon-name=${args.iconName}
18
+ counter=${args.counter}
19
+ selected=${args.selected}
20
+ disabled=${args.disabled}
21
+ size=${args.size}
22
+ color-mode=${args.colorMode}
23
+ >
24
+ Label
25
+ </cura-tabs-button>
26
+ `;
27
+ export default {
28
+ title: 'Componentes/Tabs/Tabs Button',
29
+ tags: ['autodocs'],
30
+ render: (_a) => {
31
+ var args = __rest(_a, []);
32
+ return renderCuraTabsButton(args);
33
+ },
34
+ argTypes: {
35
+ name: {
36
+ control: 'text',
37
+ description: 'Define o identificador único do tabs. Obrigatório definir um "name" distinto para cada cura-tabs-button quando utilizado dentro de um tabs-group, garantindo o controle correto do estado e a seleção da aba ativa.',
38
+ table: {
39
+ category: 'Properties',
40
+ },
41
+ },
42
+ iconName: {
43
+ control: { type: 'select' },
44
+ options: ['', ...iconNames],
45
+ description: 'Define o nome do ícone exibido do iconset.',
46
+ table: {
47
+ category: 'Properties',
48
+ },
49
+ },
50
+ counter: {
51
+ control: 'number',
52
+ description: 'Define o número exibido no badge counter.',
53
+ table: {
54
+ category: 'Properties',
55
+ defaultValue: { summary: '1' },
56
+ },
57
+ },
58
+ selected: { control: 'boolean', description: 'Define se a aba está selecionada.', table: { category: 'State', defaultValue: { summary: false } } },
59
+ disabled: { control: 'boolean', description: 'Define se a aba está desabilitada.', table: { category: 'State', defaultValue: { summary: false } } },
60
+ size: {
61
+ control: 'select',
62
+ options: ['small', 'medium', 'large'],
63
+ description: 'Define o tamanho do elemento.',
64
+ table: {
65
+ category: 'Properties',
66
+ defaultValue: { summary: 'large' },
67
+ },
68
+ },
69
+ colorMode: {
70
+ control: { type: 'inline-radio' },
71
+ options: ['light', 'dark'],
72
+ description: 'Define a cor de tema.',
73
+ table: {
74
+ category: 'Properties',
75
+ defaultValue: { summary: 'light' },
76
+ },
77
+ },
78
+ tabSelect: {
79
+ action: 'tabSelect',
80
+ description: 'Evento disparado ao clicar na aba. Retorna o "name" da aba.',
81
+ table: { category: 'Events' },
82
+ },
83
+ },
84
+ };
85
+ export const CuraTabs = {
86
+ args: {
87
+ name: 'tab1',
88
+ iconName: 'infoCircle',
89
+ counter: 1,
90
+ selected: false,
91
+ disabled: false,
92
+ size: 'large',
93
+ colorMode: 'light',
94
+ },
95
+ };
96
+ //# sourceMappingURL=cura-tabs-button.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cura-tabs-button.stories.js","sourceRoot":"","sources":["../../../../src/components/tabs/cura-tabs-button/cura-tabs-button.stories.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,SAAS,MAAM,4CAA4C,CAAC;AAEnE,MAAM,oBAAoB,GAAG,CAAC,IAAS,EAAE,EAAE,CAAC;;aAE/B,IAAI,CAAC,IAAI;kBACJ,IAAI,CAAC,QAAQ;gBACf,IAAI,CAAC,OAAO;iBACX,IAAI,CAAC,QAAQ;iBACb,IAAI,CAAC,QAAQ;aACjB,IAAI,CAAC,IAAI;mBACH,IAAI,CAAC,SAAS;;;;CAIhC,CAAC;AAEF,eAAe;IACb,KAAK,EAAE,8BAA8B;IACrC,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,MAAM,EAAE,CAAC,EAAW,EAAE,EAAE;YAAV,IAAI,cAAT,EAAW,CAAF;QAChB,OAAO,oBAAoB,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;IACD,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,OAAO,EA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ACtB,YAAY,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE;aACnC;SACF;QACD,SAAS,EAAE;YACT,MAAM,EAAE,WAAW;YACnB,WAAW,EAAE,6DAA6D;YAC1E,KAAK,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE;SAC9B;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,YAAY;QACtB,OAAO,EAAE,CAAC;QACV,QAAQ,EAAE,KAAK;QACf,QAAQ,EAAE,KAAK;QACf,IAAI,EAAE,OAAO;QACb,SAAS,EAAE,OAAO;KACnB;CACF,CAAC","sourcesContent":["import iconNames from '../../../assets/icons/iconset-default-list';\n\nconst renderCuraTabsButton = (args: any) => `\n <cura-tabs-button\n name=${args.name}\n icon-name=${args.iconName}\n counter=${args.counter}\n selected=${args.selected}\n disabled=${args.disabled}\n size=${args.size}\n color-mode=${args.colorMode}\n >\n Label\n </cura-tabs-button>\n`;\n\nexport default {\n title: 'Componentes/Tabs/Tabs Button',\n tags: ['autodocs'],\n render: ({ ...args }) => {\n return renderCuraTabsButton(args);\n },\n argTypes: {\n name: {\n control: 'text',\n description:\n 'Define o identificador único do tabs. Obrigatório definir um \"name\" distinto para cada cura-tabs-button quando utilizado dentro de um tabs-group, garantindo o controle correto do estado e a seleção da aba ativa.',\n table: {\n category: 'Properties',\n },\n },\n iconName: {\n control: { type: 'select' },\n options: ['', ...iconNames],\n description: 'Define o nome do ícone exibido do iconset.',\n table: {\n category: 'Properties',\n },\n },\n counter: {\n control: 'number',\n description: 'Define o número exibido no badge counter.',\n table: {\n category: 'Properties',\n defaultValue: { summary: '1' },\n },\n },\n selected: { control: 'boolean', description: 'Define se a aba está selecionada.', table: { category: 'State', defaultValue: { summary: false } } },\n disabled: { control: 'boolean', description: 'Define se a aba está desabilitada.', table: { category: 'State', defaultValue: { summary: false } } },\n size: {\n control: 'select',\n options: ['small', 'medium', 'large'],\n description: 'Define o tamanho do elemento.',\n table: {\n category: 'Properties',\n defaultValue: { summary: 'large' },\n },\n },\n colorMode: {\n control: { type: 'inline-radio' },\n options: ['light', 'dark'],\n description: 'Define a cor de tema.',\n table: {\n category: 'Properties',\n defaultValue: { summary: 'light' },\n },\n },\n tabSelect: {\n action: 'tabSelect',\n description: 'Evento disparado ao clicar na aba. Retorna o \"name\" da aba.',\n table: { category: 'Events' },\n },\n },\n};\n\nexport const CuraTabs = {\n args: {\n name: 'tab1',\n iconName: 'infoCircle',\n counter: 1,\n selected: false,\n disabled: false,\n size: 'large',\n colorMode: 'light',\n },\n};\n"]}
@@ -0,0 +1,25 @@
1
+ :host {
2
+ display: flex;
3
+ gap: var(--gap);
4
+ }
5
+
6
+ :host(.border-bottom) {
7
+ position: relative;
8
+ }
9
+
10
+ :host(.border-bottom)::after {
11
+ content: "";
12
+ position: absolute;
13
+ bottom: 0;
14
+ left: 0;
15
+ right: 0;
16
+ height: 1px;
17
+ background: var(--border-color);
18
+ z-index: 0;
19
+ }
20
+
21
+ ::slotted(cura-tabs),
22
+ ::slotted(cura-tabs-transparent) {
23
+ position: relative;
24
+ z-index: 1;
25
+ }
@@ -0,0 +1,133 @@
1
+ import { Host, h } from "@stencil/core";
2
+ export class CuraTabsGroup {
3
+ constructor() {
4
+ this.gap = 0;
5
+ this.borderBottom = true;
6
+ this.colorMode = 'light';
7
+ this.styles = {};
8
+ }
9
+ handleTabSelect(ev) {
10
+ this.updateSelectedTab(ev.detail.name);
11
+ }
12
+ updateSelectedTab(value) {
13
+ const tabs = this.host.querySelectorAll('cura-tabs, cura-tabs-transparent, cura-tabs-button');
14
+ tabs.forEach((tab) => {
15
+ tab.selected = tab.name === value;
16
+ });
17
+ }
18
+ getClasses() {
19
+ return {
20
+ 'border-bottom': this.borderBottom,
21
+ };
22
+ }
23
+ connectedCallback() {
24
+ this.styles = Object.assign(Object.assign({}, this.styles), { '--border-color': window.CuraAPI.theme.colors.getColor(this.colorMode === 'light' ? 'neutral-base' : 'primary-base'), '--gap': `${this.gap}px` });
25
+ }
26
+ render() {
27
+ return (h(Host, { key: 'fb6a6ae52fd5bdfb8c3978a75f26be87479ccafa', role: "tablist", style: this.styles, class: this.getClasses() }, h("slot", { key: 'afca97b27c8359f8236331257e4db41f1332e071' })));
28
+ }
29
+ static get is() { return "cura-tabs-group"; }
30
+ static get encapsulation() { return "shadow"; }
31
+ static get originalStyleUrls() {
32
+ return {
33
+ "$": ["cura-tabs-group.scss"]
34
+ };
35
+ }
36
+ static get styleUrls() {
37
+ return {
38
+ "$": ["cura-tabs-group.css"]
39
+ };
40
+ }
41
+ static get properties() {
42
+ return {
43
+ "gap": {
44
+ "type": "number",
45
+ "mutable": false,
46
+ "complexType": {
47
+ "original": "number",
48
+ "resolved": "number",
49
+ "references": {}
50
+ },
51
+ "required": false,
52
+ "optional": false,
53
+ "docs": {
54
+ "tags": [],
55
+ "text": ""
56
+ },
57
+ "attribute": "gap",
58
+ "reflect": true,
59
+ "defaultValue": "0"
60
+ },
61
+ "borderBottom": {
62
+ "type": "boolean",
63
+ "mutable": true,
64
+ "complexType": {
65
+ "original": "boolean",
66
+ "resolved": "boolean",
67
+ "references": {}
68
+ },
69
+ "required": false,
70
+ "optional": false,
71
+ "docs": {
72
+ "tags": [],
73
+ "text": ""
74
+ },
75
+ "attribute": "border-bottom",
76
+ "reflect": true,
77
+ "defaultValue": "true"
78
+ },
79
+ "colorMode": {
80
+ "type": "string",
81
+ "mutable": true,
82
+ "complexType": {
83
+ "original": "'dark' | 'light'",
84
+ "resolved": "\"dark\" | \"light\"",
85
+ "references": {}
86
+ },
87
+ "required": false,
88
+ "optional": false,
89
+ "docs": {
90
+ "tags": [],
91
+ "text": ""
92
+ },
93
+ "attribute": "color-mode",
94
+ "reflect": true,
95
+ "defaultValue": "'light'"
96
+ }
97
+ };
98
+ }
99
+ static get states() {
100
+ return {
101
+ "styles": {}
102
+ };
103
+ }
104
+ static get events() {
105
+ return [{
106
+ "method": "tabChange",
107
+ "name": "tabChange",
108
+ "bubbles": true,
109
+ "cancelable": true,
110
+ "composed": true,
111
+ "docs": {
112
+ "tags": [],
113
+ "text": ""
114
+ },
115
+ "complexType": {
116
+ "original": "string",
117
+ "resolved": "string",
118
+ "references": {}
119
+ }
120
+ }];
121
+ }
122
+ static get elementRef() { return "host"; }
123
+ static get listeners() {
124
+ return [{
125
+ "name": "tabSelect",
126
+ "method": "handleTabSelect",
127
+ "target": undefined,
128
+ "capture": false,
129
+ "passive": false
130
+ }];
131
+ }
132
+ }
133
+ //# sourceMappingURL=cura-tabs-group.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cura-tabs-group.js","sourceRoot":"","sources":["../../../../src/components/tabs/cura-tabs-group/cura-tabs-group.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAOtG,MAAM,OAAO,aAAa;;mBACe,CAAC;4BACwB,IAAI;yBACE,OAAO;sBAEnC,EAAE;;IAO5C,eAAe,CAAC,EAAiC;QAC/C,IAAI,CAAC,iBAAiB,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;IAED,iBAAiB,CAAC,KAAa;QAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,oDAAoD,CAAC,CAAC;QAE9F,IAAI,CAAC,OAAO,CAAC,CAAC,GAAwB,EAAE,EAAE;YACxC,GAAG,CAAC,QAAQ,GAAG,GAAG,CAAC,IAAI,KAAK,KAAK,CAAC;QACpC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,UAAU;QACR,OAAO;YACL,eAAe,EAAE,IAAI,CAAC,YAAY;SACnC,CAAC;IACJ,CAAC;IAED,iBAAiB;QACf,IAAI,CAAC,MAAM,mCACN,IAAI,CAAC,MAAM,KACd,gBAAgB,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,KAAK,OAAO,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,EACpH,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,GACzB,CAAC;IACJ,CAAC;IAED,MAAM;QACJ,OAAO,CACL,EAAC,IAAI,qDAAC,IAAI,EAAC,SAAS,EAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE;YAC/D,8DAAa,CACR,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, Host, Listen, Prop, State, h } from '@stencil/core';\n\n@Component({\n tag: 'cura-tabs-group',\n styleUrl: 'cura-tabs-group.scss',\n shadow: true,\n})\nexport class CuraTabsGroup {\n @Prop({ reflect: true }) gap: number = 0;\n @Prop({ reflect: true, mutable: true }) borderBottom: boolean = true;\n @Prop({ reflect: true, mutable: true }) colorMode: 'dark' | 'light' = 'light';\n\n @State() styles: Record<string, string> = {};\n\n @Element() host: HTMLElement;\n\n @Event() tabChange: EventEmitter<string>;\n\n @Listen('tabSelect')\n handleTabSelect(ev: CustomEvent<{ name: string }>) {\n this.updateSelectedTab(ev.detail.name);\n }\n\n updateSelectedTab(value: string) {\n const tabs = this.host.querySelectorAll('cura-tabs, cura-tabs-transparent, cura-tabs-button');\n\n tabs.forEach((tab: HTMLCuraTabsElement) => {\n tab.selected = tab.name === value;\n });\n }\n\n getClasses() {\n return {\n 'border-bottom': this.borderBottom,\n };\n }\n\n connectedCallback() {\n this.styles = {\n ...this.styles,\n '--border-color': window.CuraAPI.theme.colors.getColor(this.colorMode === 'light' ? 'neutral-base' : 'primary-base'),\n '--gap': `${this.gap}px`,\n };\n }\n\n render() {\n return (\n <Host role=\"tablist\" style={this.styles} class={this.getClasses()}>\n <slot></slot>\n </Host>\n );\n }\n}\n"]}
@@ -0,0 +1,65 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s)
4
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ const renderCuraTabsGroup = (args) => `
14
+ <cura-tabs-group
15
+ gap=${args.gap}
16
+ border-bottom=${args.borderBottom}
17
+ color-mode=${args.colorMode}
18
+ >
19
+ <cura-tabs name="tab1" icon-name="infoCircle" border-bottom="false" selected>Label</cura-tabs>
20
+ <cura-tabs name="tab2" icon-name="infoCircle" border-bottom="false">Label</cura-tabs>
21
+ <cura-tabs name="tab3" icon-name="infoCircle" border-bottom="false">Label</cura-tabs>
22
+ <cura-tabs name="tab4" icon-name="infoCircle" border-bottom="false" disabled>Label</cura-tabs>
23
+ </cura-tabs-group>
24
+ `;
25
+ export default {
26
+ title: 'Componentes/Tabs/Tabs Group',
27
+ tags: ['autodocs'],
28
+ render: (_a) => {
29
+ var args = __rest(_a, []);
30
+ return renderCuraTabsGroup(args);
31
+ },
32
+ argTypes: {
33
+ gap: {
34
+ control: 'number',
35
+ description: 'Define o espaçamento (gap) entre as abas. Valor em pixels.',
36
+ table: {
37
+ category: 'Properties',
38
+ defaultValue: { summary: '0px' },
39
+ },
40
+ },
41
+ borderBottom: { control: 'boolean', description: 'Define se a borda inferior é exibida.', table: { category: 'Properties', defaultValue: { summary: 'true' } } },
42
+ colorMode: {
43
+ control: { type: 'inline-radio' },
44
+ options: ['light', 'dark'],
45
+ description: 'Define a cor de tema.',
46
+ table: {
47
+ category: 'Properties',
48
+ defaultValue: { summary: 'light' },
49
+ },
50
+ },
51
+ tabChange: {
52
+ action: 'tabChange',
53
+ description: 'Evento disparado ao clicar em uma aba. Retorna o "name" da aba clicada.',
54
+ table: { category: 'Events' },
55
+ },
56
+ },
57
+ };
58
+ export const CuraTabs = {
59
+ args: {
60
+ gap: 0,
61
+ borderBottom: true,
62
+ colorMode: 'light',
63
+ },
64
+ };
65
+ //# sourceMappingURL=cura-tabs-group.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cura-tabs-group.stories.js","sourceRoot":"","sources":["../../../../src/components/tabs/cura-tabs-group/cura-tabs-group.stories.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,MAAM,mBAAmB,GAAG,CAAC,IAAS,EAAE,EAAE,CAAC;;YAE/B,IAAI,CAAC,GAAG;sBACE,IAAI,CAAC,YAAY;mBACpB,IAAI,CAAC,SAAS;;;;;;;CAOhC,CAAC;AAEF,eAAe;IACb,KAAK,EAAE,6BAA6B;IACpC,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,MAAM,EAAE,CAAC,EAAW,EAAE,EAAE;YAAV,IAAI,cAAT,EAAW,CAAF;QAChB,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IACD,QAAQ,EAAE;QACR,GAAG,EAAE;YACH,OAAO,EAAE,QAAQ;YACjB,WAAW,EAAE,4DAA4D;YACzE,KAAK,EAAE;gBACL,QAAQ,EAAE,YAAY;gBACtB,YAAY,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;aACjC;SACF;QACD,YAAY,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,uCAAuC,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE;QAChK,SAAS,EAAE;YACT,OAAO,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE;YACjC,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC;YAC1B,WAAW,EAAE,uBAAuB;YACpC,KAAK,EAAE;gBACL,QAAQ,EAAE,YAAY;gBACtB,YAAY,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE;aACnC;SACF;QACD,SAAS,EAAE;YACT,MAAM,EAAE,WAAW;YACnB,WAAW,EAAE,yEAAyE;YACtF,KAAK,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE;SAC9B;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,IAAI,EAAE;QACJ,GAAG,EAAE,CAAC;QACN,YAAY,EAAE,IAAI;QAClB,SAAS,EAAE,OAAO;KACnB;CACF,CAAC","sourcesContent":["const renderCuraTabsGroup = (args: any) => `\n <cura-tabs-group\n gap=${args.gap}\n border-bottom=${args.borderBottom}\n color-mode=${args.colorMode}\n >\n <cura-tabs name=\"tab1\" icon-name=\"infoCircle\" border-bottom=\"false\" selected>Label</cura-tabs>\n <cura-tabs name=\"tab2\" icon-name=\"infoCircle\" border-bottom=\"false\">Label</cura-tabs>\n <cura-tabs name=\"tab3\" icon-name=\"infoCircle\" border-bottom=\"false\">Label</cura-tabs>\n <cura-tabs name=\"tab4\" icon-name=\"infoCircle\" border-bottom=\"false\" disabled>Label</cura-tabs>\n </cura-tabs-group>\n`;\n\nexport default {\n title: 'Componentes/Tabs/Tabs Group',\n tags: ['autodocs'],\n render: ({ ...args }) => {\n return renderCuraTabsGroup(args);\n },\n argTypes: {\n gap: {\n control: 'number',\n description: 'Define o espaçamento (gap) entre as abas. Valor em pixels.',\n table: {\n category: 'Properties',\n defaultValue: { summary: '0px' },\n },\n },\n borderBottom: { control: 'boolean', description: 'Define se a borda inferior é exibida.', table: { category: 'Properties', defaultValue: { summary: 'true' } } },\n colorMode: {\n control: { type: 'inline-radio' },\n options: ['light', 'dark'],\n description: 'Define a cor de tema.',\n table: {\n category: 'Properties',\n defaultValue: { summary: 'light' },\n },\n },\n tabChange: {\n action: 'tabChange',\n description: 'Evento disparado ao clicar em uma aba. Retorna o \"name\" da aba clicada.',\n table: { category: 'Events' },\n },\n },\n};\n\nexport const CuraTabs = {\n args: {\n gap: 0,\n borderBottom: true,\n colorMode: 'light',\n },\n};\n"]}