@rededor/cura 0.4.7 → 0.4.8

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 (80) hide show
  1. package/dist/assets/icons/iconset-default-list.ts +1 -1
  2. package/dist/assets/icons/iconset-default-tmp.svg +18 -5
  3. package/dist/assets/icons/iconset-default.svg +1 -1
  4. package/dist/cjs/{cura-button_10.cjs.entry.js → cura-accordion_12.cjs.entry.js} +129 -3
  5. package/dist/cjs/cura-accordion_12.cjs.entry.js.map +1 -0
  6. package/dist/cjs/cura.cjs.js +2 -2
  7. package/dist/cjs/{index-0e874533.js → index-72217b50.js} +10 -2
  8. package/dist/cjs/index-72217b50.js.map +1 -0
  9. package/dist/cjs/loader.cjs.js +2 -2
  10. package/dist/collection/assets/icons/iconset-default-list.js +1 -1
  11. package/dist/collection/assets/icons/iconset-default-list.js.map +1 -1
  12. package/dist/collection/assets/icons/iconset-default-tmp.svg +18 -5
  13. package/dist/collection/assets/icons/iconset-default.svg +1 -1
  14. package/dist/collection/assets-raw/icons/default/siren.svg +12 -0
  15. package/dist/collection/collection-manifest.json +2 -0
  16. package/dist/collection/components/accordion/cura-accordion/cura-accordion.css +14 -0
  17. package/dist/collection/components/accordion/cura-accordion/cura-accordion.js +272 -0
  18. package/dist/collection/components/accordion/cura-accordion/cura-accordion.js.map +1 -0
  19. package/dist/collection/components/accordion/cura-accordion/cura-accordion.stories.js +160 -0
  20. package/dist/collection/components/accordion/cura-accordion/cura-accordion.stories.js.map +1 -0
  21. package/dist/collection/components/accordion/cura-accordion-item/cura-accordion-item.css +139 -0
  22. package/dist/collection/components/accordion/cura-accordion-item/cura-accordion-item.js +199 -0
  23. package/dist/collection/components/accordion/cura-accordion-item/cura-accordion-item.js.map +1 -0
  24. package/dist/components/cura-accordion-item.d.ts +11 -0
  25. package/dist/components/cura-accordion-item.js +76 -0
  26. package/dist/components/cura-accordion-item.js.map +1 -0
  27. package/dist/components/cura-accordion.d.ts +11 -0
  28. package/dist/components/cura-accordion.js +121 -0
  29. package/dist/components/cura-accordion.js.map +1 -0
  30. package/dist/components/cura-icons-view.js +1 -1
  31. package/dist/components/cura-icons-view.js.map +1 -1
  32. package/dist/components/index.js +4 -0
  33. package/dist/components/index.js.map +1 -1
  34. package/dist/cura/cura.esm.js +1 -1
  35. package/dist/cura/cura.esm.js.map +1 -1
  36. package/dist/cura/cura.js +1 -1
  37. package/dist/cura/p-03b4f9a3.system.js +2 -0
  38. package/dist/cura/p-03b4f9a3.system.js.map +1 -0
  39. package/dist/cura/p-2cbf52f1.js +3 -0
  40. package/dist/cura/p-2cbf52f1.js.map +1 -0
  41. package/dist/cura/p-74e2e763.entry.js +2 -0
  42. package/dist/cura/p-74e2e763.entry.js.map +1 -0
  43. package/dist/cura/{p-a84ae34f.system.js → p-8da635b7.system.js} +3 -3
  44. package/dist/cura/{p-cbc91ac5.js.map → p-8da635b7.system.js.map} +1 -1
  45. package/dist/cura/p-d6eee1ad.system.entry.js +2 -0
  46. package/dist/cura/p-d6eee1ad.system.entry.js.map +1 -0
  47. package/dist/esm/{cura-button_10.entry.js → cura-accordion_12.entry.js} +128 -4
  48. package/dist/esm/cura-accordion_12.entry.js.map +1 -0
  49. package/dist/esm/cura.js +3 -3
  50. package/dist/esm/{index-92c824be.js → index-9af0cdbd.js} +10 -2
  51. package/dist/esm/index-9af0cdbd.js.map +1 -0
  52. package/dist/esm/loader.js +3 -3
  53. package/dist/esm-es5/cura-accordion_12.entry.js +2 -0
  54. package/dist/esm-es5/cura-accordion_12.entry.js.map +1 -0
  55. package/dist/esm-es5/cura.js +1 -1
  56. package/dist/esm-es5/cura.js.map +1 -1
  57. package/dist/esm-es5/{index-92c824be.js → index-9af0cdbd.js} +2 -2
  58. package/dist/esm-es5/index-9af0cdbd.js.map +1 -0
  59. package/dist/esm-es5/loader.js +1 -1
  60. package/dist/esm-es5/loader.js.map +1 -1
  61. package/dist/types/components/accordion/cura-accordion/cura-accordion.d.ts +39 -0
  62. package/dist/types/components/accordion/cura-accordion/cura-accordion.stories.d.ts +154 -0
  63. package/dist/types/components/accordion/cura-accordion-item/cura-accordion-item.d.ts +29 -0
  64. package/dist/types/components.d.ts +114 -0
  65. package/package.json +2 -2
  66. package/dist/cjs/cura-button_10.cjs.entry.js.map +0 -1
  67. package/dist/cjs/index-0e874533.js.map +0 -1
  68. package/dist/cura/p-19176c44.system.js +0 -2
  69. package/dist/cura/p-19176c44.system.js.map +0 -1
  70. package/dist/cura/p-a84ae34f.system.js.map +0 -1
  71. package/dist/cura/p-cbc91ac5.js +0 -3
  72. package/dist/cura/p-d184517b.entry.js +0 -2
  73. package/dist/cura/p-d184517b.entry.js.map +0 -1
  74. package/dist/cura/p-eec653ca.system.entry.js +0 -2
  75. package/dist/cura/p-eec653ca.system.entry.js.map +0 -1
  76. package/dist/esm/cura-button_10.entry.js.map +0 -1
  77. package/dist/esm/index-92c824be.js.map +0 -1
  78. package/dist/esm-es5/cura-button_10.entry.js +0 -2
  79. package/dist/esm-es5/cura-button_10.entry.js.map +0 -1
  80. package/dist/esm-es5/index-92c824be.js.map +0 -1
@@ -0,0 +1,272 @@
1
+ import { Host, h } from '@stencil/core';
2
+ export class CuraAccordion {
3
+ constructor() {
4
+ this.mutationObserverCallback = (mutations, _) => {
5
+ var _a;
6
+ for (const mutation of mutations) {
7
+ if (mutation.type === 'attributes' && mutation.attributeName === 'opened' && ((_a = mutation.target) === null || _a === void 0 ? void 0 : _a['opened'])) {
8
+ if (this.behavior !== 'default')
9
+ continue;
10
+ this.host.querySelectorAll('cura-accordion-item').forEach(item => {
11
+ if (item != mutation.target) {
12
+ item.opened = false;
13
+ }
14
+ });
15
+ }
16
+ if (mutation.type === 'childList') {
17
+ const addedNodes = Array.from(mutation.addedNodes || []);
18
+ for (let node of addedNodes) {
19
+ this.setChildProperties(node);
20
+ }
21
+ }
22
+ }
23
+ };
24
+ this.mutationObserver = new MutationObserver(this.mutationObserverCallback);
25
+ this.color = 'primary';
26
+ this.activeColor = 'accent';
27
+ this.colorMode = 'dark';
28
+ this.iconSize = 32;
29
+ this.openIcon = 'down';
30
+ this.closeIcon = 'up';
31
+ this.iconColor = '';
32
+ this.iconActiveColor = '';
33
+ this.behavior = 'default';
34
+ this.styles = {};
35
+ }
36
+ handleChangeColor() {
37
+ this.setColors();
38
+ }
39
+ connectedCallback() {
40
+ const weights = window.CuraAPI.theme.fonts.getWeights();
41
+ this.styles['--base-spacing'] = window.CuraAPI.theme.spacing.getSpacing();
42
+ this.styles['--neutral-purewhite'] = window.CuraAPI.theme.colors.getColor(`neutral-purewhite`);
43
+ this.styles['--neutral-lighter'] = window.CuraAPI.theme.colors.getColor(`neutral-lighter`);
44
+ this.styles['--neutral-base'] = window.CuraAPI.theme.colors.getColor(`neutral-base`);
45
+ this.styles['--font-size'] = window.CuraAPI.theme.fonts.getSize();
46
+ this.styles['--font-color'] = window.CuraAPI.theme.fonts.getColor();
47
+ this.styles['--font-family'] = window.CuraAPI.theme.fonts.getFamily();
48
+ this.styles['--font-weight-regular'] = weights.regular;
49
+ this.styles['--font-weight-light'] = weights.light;
50
+ this.setColors();
51
+ }
52
+ componentDidLoad() {
53
+ this.host.querySelectorAll('cura-accordion-item').forEach(item => {
54
+ this.setChildProperties(item);
55
+ });
56
+ const options = { childList: true, subtree: true, attributes: true };
57
+ this.mutationObserver.observe(this.host, options);
58
+ }
59
+ disconnectedCallback() {
60
+ this.mutationObserver.disconnect();
61
+ }
62
+ setChildProperties(item) {
63
+ // Theme
64
+ item.colorMode = this.colorMode;
65
+ item.iconColor = this.iconColor || this.color;
66
+ item.iconActiveColor = this.iconActiveColor || this.activeColor;
67
+ // Icon
68
+ item.iconSize = this.iconSize;
69
+ item.openIcon = this.openIcon;
70
+ item.closeIcon = this.closeIcon;
71
+ }
72
+ setColors() {
73
+ this.styles = Object.assign(Object.assign({}, this.styles), { '--color-lighter': window.CuraAPI.theme.colors.getColor(`${this.color}-lighter`), '--color-light': window.CuraAPI.theme.colors.getColor(`${this.color}-light`), '--color-base': window.CuraAPI.theme.colors.getColor(`${this.color}-base`), '--color-dark': window.CuraAPI.theme.colors.getColor(`${this.color}-dark`), '--color-active-lighter': window.CuraAPI.theme.colors.getColor(`${this.activeColor}-lighter`), '--color-active-light': window.CuraAPI.theme.colors.getColor(`${this.activeColor}-light`), '--color-active-base': window.CuraAPI.theme.colors.getColor(`${this.activeColor}-base`), '--color-active-dark': window.CuraAPI.theme.colors.getColor(`${this.activeColor}-dark`), '--icon-color-lighter': window.CuraAPI.theme.colors.getColor(`${this.iconColor || this.color}-lighter`), '--icon-color-light': window.CuraAPI.theme.colors.getColor(`${this.iconColor || this.color}-light`), '--icon-color-base': window.CuraAPI.theme.colors.getColor(`${this.iconColor || this.color}-base`), '--icon-color-dark': window.CuraAPI.theme.colors.getColor(`${this.iconColor || this.color}-dark`), '--icon-color-active-lighter': window.CuraAPI.theme.colors.getColor(`${this.iconActiveColor || this.activeColor}-lighter`), '--icon-color-active-light': window.CuraAPI.theme.colors.getColor(`${this.iconActiveColor || this.activeColor}-light`), '--icon-color-active-base': window.CuraAPI.theme.colors.getColor(`${this.iconActiveColor || this.activeColor}-base`), '--icon-color-active-dark': window.CuraAPI.theme.colors.getColor(`${this.iconActiveColor || this.activeColor}-dark`) });
74
+ }
75
+ render() {
76
+ return (h(Host, { style: this.styles }, h("slot", { name: 'accordion-item' })));
77
+ }
78
+ static get is() { return "cura-accordion"; }
79
+ static get encapsulation() { return "shadow"; }
80
+ static get originalStyleUrls() {
81
+ return {
82
+ "$": ["cura-accordion.scss"]
83
+ };
84
+ }
85
+ static get styleUrls() {
86
+ return {
87
+ "$": ["cura-accordion.css"]
88
+ };
89
+ }
90
+ static get properties() {
91
+ return {
92
+ "color": {
93
+ "type": "string",
94
+ "mutable": false,
95
+ "complexType": {
96
+ "original": "string",
97
+ "resolved": "string",
98
+ "references": {}
99
+ },
100
+ "required": false,
101
+ "optional": false,
102
+ "docs": {
103
+ "tags": [],
104
+ "text": "Color scheme base color"
105
+ },
106
+ "attribute": "color",
107
+ "reflect": true,
108
+ "defaultValue": "'primary'"
109
+ },
110
+ "activeColor": {
111
+ "type": "string",
112
+ "mutable": false,
113
+ "complexType": {
114
+ "original": "string",
115
+ "resolved": "string",
116
+ "references": {}
117
+ },
118
+ "required": false,
119
+ "optional": false,
120
+ "docs": {
121
+ "tags": [],
122
+ "text": ""
123
+ },
124
+ "attribute": "active-color",
125
+ "reflect": true,
126
+ "defaultValue": "'accent'"
127
+ },
128
+ "colorMode": {
129
+ "type": "string",
130
+ "mutable": false,
131
+ "complexType": {
132
+ "original": "'dark' | 'light'",
133
+ "resolved": "\"dark\" | \"light\"",
134
+ "references": {}
135
+ },
136
+ "required": false,
137
+ "optional": false,
138
+ "docs": {
139
+ "tags": [],
140
+ "text": "Set the color mode to dark or light"
141
+ },
142
+ "attribute": "color-mode",
143
+ "reflect": true,
144
+ "defaultValue": "'dark'"
145
+ },
146
+ "iconSize": {
147
+ "type": "number",
148
+ "mutable": false,
149
+ "complexType": {
150
+ "original": "number",
151
+ "resolved": "number",
152
+ "references": {}
153
+ },
154
+ "required": false,
155
+ "optional": false,
156
+ "docs": {
157
+ "tags": [],
158
+ "text": "Accordion items icons"
159
+ },
160
+ "attribute": "icon-size",
161
+ "reflect": true,
162
+ "defaultValue": "32"
163
+ },
164
+ "openIcon": {
165
+ "type": "string",
166
+ "mutable": false,
167
+ "complexType": {
168
+ "original": "string",
169
+ "resolved": "string",
170
+ "references": {}
171
+ },
172
+ "required": false,
173
+ "optional": false,
174
+ "docs": {
175
+ "tags": [],
176
+ "text": ""
177
+ },
178
+ "attribute": "open-icon",
179
+ "reflect": true,
180
+ "defaultValue": "'down'"
181
+ },
182
+ "closeIcon": {
183
+ "type": "string",
184
+ "mutable": false,
185
+ "complexType": {
186
+ "original": "string",
187
+ "resolved": "string",
188
+ "references": {}
189
+ },
190
+ "required": false,
191
+ "optional": false,
192
+ "docs": {
193
+ "tags": [],
194
+ "text": ""
195
+ },
196
+ "attribute": "close-icon",
197
+ "reflect": true,
198
+ "defaultValue": "'up'"
199
+ },
200
+ "iconColor": {
201
+ "type": "string",
202
+ "mutable": false,
203
+ "complexType": {
204
+ "original": "string",
205
+ "resolved": "string",
206
+ "references": {}
207
+ },
208
+ "required": false,
209
+ "optional": false,
210
+ "docs": {
211
+ "tags": [],
212
+ "text": "Color scheme base color\n(By default, the icon will use the same color of 'color' and 'activeColor')"
213
+ },
214
+ "attribute": "icon-color",
215
+ "reflect": true,
216
+ "defaultValue": "''"
217
+ },
218
+ "iconActiveColor": {
219
+ "type": "string",
220
+ "mutable": false,
221
+ "complexType": {
222
+ "original": "string",
223
+ "resolved": "string",
224
+ "references": {}
225
+ },
226
+ "required": false,
227
+ "optional": false,
228
+ "docs": {
229
+ "tags": [],
230
+ "text": ""
231
+ },
232
+ "attribute": "icon-active-color",
233
+ "reflect": true,
234
+ "defaultValue": "''"
235
+ },
236
+ "behavior": {
237
+ "type": "string",
238
+ "mutable": false,
239
+ "complexType": {
240
+ "original": "'default' | 'keep-open'",
241
+ "resolved": "\"default\" | \"keep-open\"",
242
+ "references": {}
243
+ },
244
+ "required": false,
245
+ "optional": false,
246
+ "docs": {
247
+ "tags": [],
248
+ "text": "Accordion behavior when item is clicked\n(The default will close all items except the current one)"
249
+ },
250
+ "attribute": "behavior",
251
+ "reflect": true,
252
+ "defaultValue": "'default'"
253
+ }
254
+ };
255
+ }
256
+ static get states() {
257
+ return {
258
+ "styles": {}
259
+ };
260
+ }
261
+ static get elementRef() { return "host"; }
262
+ static get watchers() {
263
+ return [{
264
+ "propName": "color",
265
+ "methodName": "handleChangeColor"
266
+ }, {
267
+ "propName": "activeColor",
268
+ "methodName": "handleChangeColor"
269
+ }];
270
+ }
271
+ }
272
+ //# sourceMappingURL=cura-accordion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cura-accordion.js","sourceRoot":"","sources":["../../../../src/components/accordion/cura-accordion/cura-accordion.tsx"],"names":[],"mappings":"AAAA,OAAO,EA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AC,GAAG,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,WAAW,UAAU,CAAC,EAC1H,2BAA2B,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,WAAW,QAAQ,CAAC,EACtH,0BAA0B,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,WAAW,OAAO,CAAC,EACpH,0BAA0B,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,WAAW,OAAO,CAAC,GACrH,CAAC;EACJ,CAAC;EAED,MAAM;IACJ,OAAO,CACL,EAAC,IAAI,IAAC,KAAK,EAAE,IAAI,CAAC,MAAM;MACtB,YAAM,IAAI,EAAC,gBAAgB,GAAQ,CAC9B,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEF","sourcesContent":["import { Component, Element, Host, Prop, State, Watch, h } from '@stencil/core';\n\n@Component({\n tag: 'cura-accordion',\n styleUrl: 'cura-accordion.scss',\n shadow: true,\n})\nexport class CuraAccordion {\n\n @Element() host: HTMLElement;\n\n /**\n * Color scheme base color\n */\n @Prop({reflect: true}) color = 'primary';\n @Prop({reflect: true}) activeColor = 'accent';\n @Watch('color')\n @Watch('activeColor')\n handleChangeColor() {\n this.setColors();\n }\n\n /**\n * Set the color mode to dark or light\n */\n @Prop({reflect: true}) colorMode: 'dark' | 'light' = 'dark';\n\n /**\n * Accordion items icons\n */\n @Prop({reflect: true}) iconSize = 32;\n @Prop({reflect: true}) openIcon = 'down';\n @Prop({reflect: true}) closeIcon = 'up';\n\n /**\n * Color scheme base color\n * (By default, the icon will use the same color of 'color' and 'activeColor')\n */\n @Prop({reflect: true}) iconColor = '';\n @Prop({reflect: true}) iconActiveColor = '';\n\n /**\n * Accordion behavior when item is clicked\n * (The default will close all items except the current one)\n */\n @Prop({reflect: true}) behavior: 'default' | 'keep-open' = 'default';\n\n mutationObserverCallback = (mutations: MutationRecord[], _: MutationObserver) => {\n for (const mutation of mutations) {\n if (mutation.type === 'attributes' && mutation.attributeName === 'opened' && mutation.target?.['opened']) {\n if (this.behavior !== 'default') continue;\n this.host.querySelectorAll('cura-accordion-item').forEach(item => {\n if (item != mutation.target) {\n item.opened = false;\n }\n });\n }\n if (mutation.type === 'childList') {\n const addedNodes = Array.from(mutation.addedNodes || []);\n for(let node of addedNodes) {\n this.setChildProperties(node as HTMLCuraAccordionItemElement);\n }\n }\n }\n }\n mutationObserver: MutationObserver = new MutationObserver(this.mutationObserverCallback);\n\n @State() styles = {};\n\n connectedCallback() {\n const weights = window.CuraAPI.theme.fonts.getWeights();\n this.styles['--base-spacing'] = window.CuraAPI.theme.spacing.getSpacing();\n this.styles['--neutral-purewhite'] = window.CuraAPI.theme.colors.getColor(`neutral-purewhite`);\n this.styles['--neutral-lighter'] = window.CuraAPI.theme.colors.getColor(`neutral-lighter`);\n this.styles['--neutral-base'] = window.CuraAPI.theme.colors.getColor(`neutral-base`);\n this.styles['--font-size'] = window.CuraAPI.theme.fonts.getSize();\n this.styles['--font-color'] = window.CuraAPI.theme.fonts.getColor();\n this.styles['--font-family'] = window.CuraAPI.theme.fonts.getFamily();\n this.styles['--font-weight-regular'] = weights.regular;\n this.styles['--font-weight-light'] = weights.light;\n this.setColors();\n }\n\n componentDidLoad() {\n this.host.querySelectorAll('cura-accordion-item').forEach(item => {\n this.setChildProperties(item);\n });\n const options: MutationObserverInit = {childList: true, subtree: true, attributes: true}\n this.mutationObserver.observe(this.host, options)\n }\n\n disconnectedCallback() {\n this.mutationObserver.disconnect();\n }\n\n setChildProperties(item: HTMLCuraAccordionItemElement) {\n // Theme\n item.colorMode = this.colorMode;\n item.iconColor = this.iconColor || this.color;\n item.iconActiveColor = this.iconActiveColor || this.activeColor;\n // Icon\n item.iconSize = this.iconSize;\n item.openIcon = this.openIcon;\n item.closeIcon = this.closeIcon;\n }\n\n setColors() {\n this.styles = {\n ...this.styles,\n '--color-lighter': window.CuraAPI.theme.colors.getColor(`${this.color}-lighter`),\n '--color-light': window.CuraAPI.theme.colors.getColor(`${this.color}-light`),\n '--color-base': window.CuraAPI.theme.colors.getColor(`${this.color}-base`),\n '--color-dark': window.CuraAPI.theme.colors.getColor(`${this.color}-dark`),\n '--color-active-lighter': window.CuraAPI.theme.colors.getColor(`${this.activeColor}-lighter`),\n '--color-active-light': window.CuraAPI.theme.colors.getColor(`${this.activeColor}-light`),\n '--color-active-base': window.CuraAPI.theme.colors.getColor(`${this.activeColor}-base`),\n '--color-active-dark': window.CuraAPI.theme.colors.getColor(`${this.activeColor}-dark`),\n\n '--icon-color-lighter': window.CuraAPI.theme.colors.getColor(`${this.iconColor || this.color}-lighter`),\n '--icon-color-light': window.CuraAPI.theme.colors.getColor(`${this.iconColor || this.color}-light`),\n '--icon-color-base': window.CuraAPI.theme.colors.getColor(`${this.iconColor || this.color}-base`),\n '--icon-color-dark': window.CuraAPI.theme.colors.getColor(`${this.iconColor || this.color}-dark`),\n '--icon-color-active-lighter': window.CuraAPI.theme.colors.getColor(`${this.iconActiveColor || this.activeColor}-lighter`),\n '--icon-color-active-light': window.CuraAPI.theme.colors.getColor(`${this.iconActiveColor || this.activeColor}-light`),\n '--icon-color-active-base': window.CuraAPI.theme.colors.getColor(`${this.iconActiveColor || this.activeColor}-base`),\n '--icon-color-active-dark': window.CuraAPI.theme.colors.getColor(`${this.iconActiveColor || this.activeColor}-dark`),\n };\n }\n\n render() {\n return (\n <Host style={this.styles}>\n <slot name='accordion-item'></slot>\n </Host>\n );\n }\n\n}\n"]}
@@ -0,0 +1,160 @@
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
+ export default {
15
+ title: 'Components/Accordion/Accordion',
16
+ tags: ['autodocs'],
17
+ render: (_a) => {
18
+ var args = __rest(_a, []);
19
+ // You can either use a function to create DOM elements or use a plain html string!
20
+ // return `<div>${label}</div>`;
21
+ return `<cura-accordion
22
+ color="${args.color}"
23
+ active-color="${args.activeColor}"
24
+ color-mode="${args.colorMode}"
25
+ open-icon="${args.openIcon}"
26
+ close-icon="${args.closeIcon}"
27
+ icon-size="${args.iconSize}"
28
+ icon-color="${args.iconColor}"
29
+ icon-active-color="${args.iconActiveColor}"
30
+ behavior="${args.behavior}"
31
+ style="${args.darkBackground ? 'background-color: #999; padding: 10px' : 'padding: 10px'}"
32
+ >
33
+ <cura-accordion-item label="Item 1">
34
+ Texto 1
35
+ </cura-accordion-item>
36
+ <cura-accordion-item label="Item 2">
37
+ Texto 2
38
+ </cura-accordion-item>
39
+ <cura-accordion-item label="Item 3">
40
+ Texto 3
41
+ </cura-accordion-item>
42
+ <cura-accordion-item label="Item 4">
43
+ Texto 4
44
+ </cura-accordion-item>
45
+ </cura-accordion>`;
46
+ },
47
+ argTypes: {
48
+ color: {
49
+ control: { type: 'select' },
50
+ options: ['primary', 'secondary', 'accent', 'info', 'success', 'error', 'warning', 'neutral'],
51
+ description: 'Define cor base do item. Cor do DS sem profundidade (ex: primary).',
52
+ table: {
53
+ category: 'Properties',
54
+ defaultValue: { summary: 'primary' }
55
+ },
56
+ name: 'color'
57
+ },
58
+ activeColor: {
59
+ control: { type: 'select' },
60
+ options: ['primary', 'secondary', 'accent', 'info', 'success', 'error', 'warning', 'neutral'],
61
+ description: 'Define cor base do item ativo. Cor do DS sem profundidade (ex: accent).',
62
+ table: {
63
+ category: 'Properties',
64
+ defaultValue: { summary: 'accent' }
65
+ },
66
+ name: 'active-color'
67
+ },
68
+ colorMode: {
69
+ control: { type: 'inline-radio' },
70
+ options: ['dark', 'light'],
71
+ description: 'Seta tema claro ou escuro.',
72
+ table: {
73
+ category: 'Properties',
74
+ defaultValue: { summary: 'dark' }
75
+ },
76
+ name: 'color-mode'
77
+ },
78
+ behavior: {
79
+ control: { type: 'inline-radio' },
80
+ options: ['default', 'keep-open'],
81
+ description: 'Comportamento do accordion.',
82
+ table: {
83
+ category: 'Properties',
84
+ defaultValue: { summary: 'default' }
85
+ },
86
+ name: 'behavior'
87
+ },
88
+ openIcon: {
89
+ control: { type: 'select' },
90
+ options: iconNames,
91
+ description: 'Ícone para abrir o item.',
92
+ table: {
93
+ category: 'Icons',
94
+ defaultValue: { summary: 'down' }
95
+ },
96
+ name: 'open-icon'
97
+ },
98
+ closeIcon: {
99
+ control: { type: 'select' },
100
+ options: iconNames,
101
+ description: 'Ícone para fechar o item.',
102
+ table: {
103
+ category: 'Icons',
104
+ defaultValue: { summary: 'up' }
105
+ },
106
+ name: 'close-icon'
107
+ },
108
+ iconSize: {
109
+ control: { type: 'select' },
110
+ options: ["128", "72", "64", "48", "40", "32", "24", "20", "16"],
111
+ description: 'Tamanho do ícone.',
112
+ table: {
113
+ category: 'Icons',
114
+ defaultValue: { summary: '24' }
115
+ },
116
+ name: 'icon-size'
117
+ },
118
+ iconColor: {
119
+ control: { type: 'select' },
120
+ options: ['', 'primary', 'secondary', 'accent', 'info', 'success', 'error', 'warning', 'neutral'],
121
+ description: 'Cor do ícone. (Por padrão ele utiliza a mesma cor da propriedade \'color\').',
122
+ table: {
123
+ category: 'Icons',
124
+ },
125
+ name: 'icon-color'
126
+ },
127
+ iconActiveColor: {
128
+ control: { type: 'select' },
129
+ options: ['', 'primary', 'secondary', 'accent', 'info', 'success', 'error', 'warning', 'neutral'],
130
+ description: 'Cor do ícone ativo. (Por padrão ele utiliza a mesma cor da propriedade \'active-color\').',
131
+ table: {
132
+ category: 'Icons',
133
+ },
134
+ name: 'icon-active-color'
135
+ },
136
+ darkBackground: {
137
+ control: 'boolean',
138
+ description: 'Não é uma propriedade do componente. Aplicado como estilo CSS diretamente para visualização em temas escuros de background',
139
+ table: {
140
+ category: 'CSS',
141
+ defaultValue: { summary: 'false' }
142
+ }
143
+ },
144
+ },
145
+ };
146
+ export const Accordion = {
147
+ args: {
148
+ color: 'primary',
149
+ activeColor: 'accent',
150
+ colorMode: 'dark',
151
+ openIcon: 'down',
152
+ closeIcon: 'up',
153
+ iconSize: '24',
154
+ iconColor: "",
155
+ iconActiveColor: "",
156
+ behavior: 'default',
157
+ darkBackground: false,
158
+ },
159
+ };
160
+ //# sourceMappingURL=cura-accordion.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cura-accordion.stories.js","sourceRoot":"","sources":["../../../../src/components/accordion/cura-accordion/cura-accordion.stories.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,SAAS,MAAM,4CAA4C,CAAC;AAEnE,eAAe;EACb,KAAK,EAAE,gCAAgC;EACvC,IAAI,EAAE,CAAC,UAAU,CAAC;EAClB,MAAM,EAAE,CAAC,EAAW,EAAE,EAAE;QAAV,IAAI,cAAT,EAAW,CAAF;IAChB,mFAAmF;IACnF,gCAAgC;IAChC,OAAO;aACE,IAAI,CAAC,KAAK;oBACH,IAAI,CAAC,WAAW;kBAClB,IAAI,CAAC,SAAS;iBACf,IAAI,CAAC,QAAQ;kBACZ,IAAI,CAAC,SAAS;iBACf,IAAI,CAAC,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AAC;MACjG,WAAW,EAAE,8EAA8E;MAC3F,KAAK,EAAE;QACL,QAAQ,EAAE,OAAO;OAClB;MACD,IAAI,EAAE,YAAY;KACnB;IACD,eAAe,EAAE;MACf,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;MAC3B,OAAO,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,CAAC;MACjG,WAAW,EAAE,2FAA2F;MACxG,KAAK,EAAE;QACL,QAAQ,EAAE,OAAO;OAClB;MACD,IAAI,EAAE,mBAAmB;KAC1B;IAED,cAAc,EAAE;MACd,OAAO,EAAE,SAAS;MAClB,WAAW,EAAE,4HAA4H;MACzI,KAAK,EAAE;QACL,QAAQ,EAAE,KAAK;QACf,YAAY,EAAE,EAAE,OAAO,EAAE,OAAO,EAAC;OAClC;KACF;GACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG;EACvB,IAAI,EAAE;IACJ,KAAK,EAAE,SAAS;IAChB,WAAW,EAAE,QAAQ;IACrB,SAAS,EAAE,MAAM;IACjB,QAAQ,EAAE,MAAM;IAChB,SAAS,EAAE,IAAI;IACf,QAAQ,EAAE,IAAI;IACd,SAAS,EAAE,EAAE;IACb,eAAe,EAAE,EAAE;IACnB,QAAQ,EAAE,SAAS;IACnB,cAAc,EAAE,KAAK;GACtB;CACF,CAAC","sourcesContent":["import iconNames from '../../../assets/icons/iconset-default-list';\n\nexport default {\n title: 'Components/Accordion/Accordion',\n tags: ['autodocs'],\n render: ({ ...args }) => {\n // You can either use a function to create DOM elements or use a plain html string!\n // return `<div>${label}</div>`;\n return `<cura-accordion\n color=\"${args.color}\"\n active-color=\"${args.activeColor}\"\n color-mode=\"${args.colorMode}\"\n open-icon=\"${args.openIcon}\"\n close-icon=\"${args.closeIcon}\"\n icon-size=\"${args.iconSize}\"\n icon-color=\"${args.iconColor}\"\n icon-active-color=\"${args.iconActiveColor}\"\n behavior=\"${args.behavior}\"\n style=\"${args.darkBackground ? 'background-color: #999; padding: 10px' : 'padding: 10px'}\"\n >\n <cura-accordion-item label=\"Item 1\">\n Texto 1\n </cura-accordion-item>\n <cura-accordion-item label=\"Item 2\">\n Texto 2\n </cura-accordion-item>\n <cura-accordion-item label=\"Item 3\">\n Texto 3\n </cura-accordion-item>\n <cura-accordion-item label=\"Item 4\">\n Texto 4\n </cura-accordion-item>\n </cura-accordion>`;\n },\n argTypes: {\n color: {\n control: { type: 'select' },\n options: ['primary', 'secondary', 'accent', 'info', 'success', 'error', 'warning', 'neutral'],\n description: 'Define cor base do item. Cor do DS sem profundidade (ex: primary).',\n table: {\n category: 'Properties',\n defaultValue: { summary: 'primary'}\n },\n name: 'color'\n },\n activeColor: {\n control: { type: 'select' },\n options: ['primary', 'secondary', 'accent', 'info', 'success', 'error', 'warning', 'neutral'],\n description: 'Define cor base do item ativo. Cor do DS sem profundidade (ex: accent).',\n table: {\n category: 'Properties',\n defaultValue: { summary: 'accent'}\n },\n name: 'active-color'\n },\n colorMode: {\n control: { type: 'inline-radio' },\n options: ['dark', 'light'],\n description: 'Seta tema claro ou escuro.',\n table: {\n category: 'Properties',\n defaultValue: { summary: 'dark'}\n },\n name: 'color-mode'\n },\n behavior: {\n control: { type: 'inline-radio' },\n options: ['default', 'keep-open'],\n description: 'Comportamento do accordion.',\n table: {\n category: 'Properties',\n defaultValue: { summary: 'default'}\n },\n name: 'behavior'\n },\n openIcon: {\n control: { type: 'select' },\n options: iconNames,\n description: 'Ícone para abrir o item.',\n table: {\n category: 'Icons',\n defaultValue: { summary: 'down'}\n },\n name: 'open-icon'\n },\n closeIcon: {\n control: { type: 'select' },\n options: iconNames,\n description: 'Ícone para fechar o item.',\n table: {\n category: 'Icons',\n defaultValue: { summary: 'up'}\n },\n name: 'close-icon'\n },\n iconSize: {\n control: { type: 'select' },\n options: [\"128\", \"72\", \"64\", \"48\", \"40\", \"32\", \"24\", \"20\", \"16\"],\n description: 'Tamanho do ícone.',\n table: {\n category: 'Icons',\n defaultValue: { summary: '24'}\n },\n name: 'icon-size'\n },\n iconColor: {\n control: { type: 'select' },\n options: ['', 'primary', 'secondary', 'accent', 'info', 'success', 'error', 'warning', 'neutral'],\n description: 'Cor do ícone. (Por padrão ele utiliza a mesma cor da propriedade \\'color\\').',\n table: {\n category: 'Icons',\n },\n name: 'icon-color'\n },\n iconActiveColor: {\n control: { type: 'select' },\n options: ['', 'primary', 'secondary', 'accent', 'info', 'success', 'error', 'warning', 'neutral'],\n description: 'Cor do ícone ativo. (Por padrão ele utiliza a mesma cor da propriedade \\'active-color\\').',\n table: {\n category: 'Icons',\n },\n name: 'icon-active-color'\n },\n\n darkBackground: {\n control: 'boolean',\n description: 'Não é uma propriedade do componente. Aplicado como estilo CSS diretamente para visualização em temas escuros de background',\n table: {\n category: 'CSS',\n defaultValue: { summary: 'false'}\n }\n },\n },\n};\n\nexport const Accordion = {\n args: {\n color: 'primary',\n activeColor: 'accent',\n colorMode: 'dark',\n openIcon: 'down',\n closeIcon: 'up',\n iconSize: '24',\n iconColor: \"\",\n iconActiveColor: \"\",\n behavior: 'default',\n darkBackground: false,\n },\n};\n"]}
@@ -0,0 +1,139 @@
1
+ /* Breakpoints variables */
2
+ /**
3
+ * Responsive media for mobile (small) only.
4
+ * Use: @include mobile-only() { ... }
5
+ */
6
+ /**
7
+ * Responsive media for medium only.
8
+ * Use: @include medium-only() { ... }
9
+ */
10
+ /**
11
+ * Responsive media for large only.
12
+ * Use: @include large-only() { ... }
13
+ */
14
+ /**
15
+ * Responsive media for large and up.
16
+ * Use: @include large-up() { ... }
17
+ */
18
+ /**
19
+ * Responsive media for xlarge only.
20
+ * Use: @include xlarge-only() { ... }
21
+ */
22
+ :host {
23
+ display: block;
24
+ }
25
+ :host .accordion-item {
26
+ width: 100%;
27
+ }
28
+ :host .accordion-item .label {
29
+ display: flex;
30
+ flex-direction: column;
31
+ }
32
+ :host .accordion-item .label::before {
33
+ content: "";
34
+ display: block;
35
+ border-top: solid 1px var(--neutral-base);
36
+ width: 100%;
37
+ }
38
+ :host .accordion-item .label .label-container {
39
+ display: flex;
40
+ flex-grow: 1;
41
+ justify-content: space-between;
42
+ align-items: center;
43
+ gap: calc(var(--base-spacing) * 2px);
44
+ min-height: 40px;
45
+ word-break: break-word;
46
+ cursor: pointer;
47
+ font-size: 1.14em;
48
+ font-weight: var(--font-weight-light);
49
+ color: var(--color-base);
50
+ padding: calc(var(--base-spacing) * 1px) 0px calc(var(--base-spacing) * 1px) 0px;
51
+ }
52
+ :host .accordion-item .label .label-container:hover {
53
+ color: var(--color-light);
54
+ }
55
+ :host .accordion-item .label .label-container:hover cura-icon {
56
+ --color: var(--icon-color-light) !important;
57
+ }
58
+ :host .accordion-item .label .label-container:active {
59
+ color: var(--color-dark);
60
+ }
61
+ :host .accordion-item .label .label-container:active cura-icon {
62
+ --color: var(--icon-color-dark) !important;
63
+ }
64
+ :host .accordion-item .content {
65
+ font-size: 1em;
66
+ overflow: hidden;
67
+ max-height: 0;
68
+ transition: max-height 0.25s ease;
69
+ }
70
+ :host .accordion-item .content .content-wrapper {
71
+ padding: calc(var(--base-spacing) * 2px) 0px;
72
+ border-top: solid 1px var(--neutral-base);
73
+ }
74
+ :host .accordion-item.active .label .label-container {
75
+ color: var(--color-active-base);
76
+ }
77
+ :host .accordion-item.active .label .label-container:hover {
78
+ color: var(--color-active-light);
79
+ }
80
+ :host .accordion-item.active .label .label-container:hover cura-icon {
81
+ --color: var(--icon-color-active-light) !important;
82
+ }
83
+ :host .accordion-item.active .label .label-container:active {
84
+ color: var(--color-active-dark);
85
+ }
86
+ :host .accordion-item.active .label .label-container:active cura-icon {
87
+ --color: var(--icon-color-active-dark) !important;
88
+ }
89
+ :host .accordion-item.active .content {
90
+ max-height: 200vh;
91
+ overflow-y: auto;
92
+ transition: max-height 0.5s ease 0.14s;
93
+ }
94
+ :host .accordion-item.inverted .label .label-container {
95
+ color: var(--neutral-lighter);
96
+ }
97
+ :host .accordion-item.inverted .label .label-container:hover {
98
+ color: var(--color-lighter);
99
+ }
100
+ :host .accordion-item.inverted .label .label-container:hover cura-icon {
101
+ --color: var(--icon-color-lighter) !important;
102
+ }
103
+ :host .accordion-item.inverted .label .label-container:active {
104
+ color: var(--color-light);
105
+ }
106
+ :host .accordion-item.inverted .label .label-container:active cura-icon {
107
+ --color: var(--icon-color-light) !important;
108
+ }
109
+ :host .accordion-item.active.inverted .label .label-container {
110
+ color: var(--neutral-purewhite);
111
+ }
112
+ :host .accordion-item.active.inverted .label .label-container:hover {
113
+ color: var(--color-active-lighter);
114
+ }
115
+ :host .accordion-item.active.inverted .label .label-container:hover cura-icon {
116
+ --color: var(--icon-color-active-lighter) !important;
117
+ }
118
+ :host .accordion-item.active.inverted .label .label-container:active {
119
+ color: var(--color-active-light);
120
+ }
121
+ :host .accordion-item.active.inverted .label .label-container:active cura-icon {
122
+ --color: var(--icon-color-active-light) !important;
123
+ }
124
+ @media (min-width: 768px) and (max-width: 1365px) {
125
+ :host .accordion-item .label .label-container {
126
+ font-size: 1.29em;
127
+ }
128
+ :host .accordion-item .content {
129
+ font-size: 1.14em;
130
+ }
131
+ }
132
+ @media (min-width: 1366px) {
133
+ :host .accordion-item .label .label-container {
134
+ font-size: 1.29em;
135
+ }
136
+ :host .accordion-item .content {
137
+ font-size: 1.14em;
138
+ }
139
+ }