@sula-tech/webcomponents 0.9.1 → 0.10.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.
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{sula-avatar_19.cjs.entry.js → sula-avatar_20.cjs.entry.js} +116 -38
- package/dist/cjs/sula-avatar_20.cjs.entry.js.map +1 -0
- package/dist/cjs/webcomponents.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/sula-avatar/sula-avatar.css +1 -1
- package/dist/collection/components/sula-badge/sula-badge.css +1 -1
- package/dist/collection/components/sula-button/sula-button.css +1 -1
- package/dist/collection/components/sula-checkbox/sula-checkbox.css +1 -1
- package/dist/collection/components/sula-chip/sula-chip.css +1 -1
- package/dist/collection/components/sula-dropdown/sula-dropdown.css +1 -1
- package/dist/collection/components/sula-icon/sula-icon.css +1 -1
- package/dist/collection/components/sula-loader/sula-loader.css +1 -1
- package/dist/collection/components/sula-menu-select-list/sula-menu-select-list.css +1 -1
- package/dist/collection/components/sula-modal/sula-modal.css +1 -1
- package/dist/collection/components/sula-progress-bar/sula-progress-bar.css +1 -1
- package/dist/collection/components/sula-radio-button/sula-radio-button.css +1 -1
- package/dist/collection/components/sula-search-bar/sula-search-bar.css +1 -1
- package/dist/collection/components/sula-segmented-control/model/sula-segmented-control.model.js +16 -0
- package/dist/collection/components/sula-segmented-control/model/sula-segmented-control.model.js.map +1 -0
- package/dist/collection/components/sula-segmented-control/sula-segmented-control.css +1 -0
- package/dist/collection/components/sula-segmented-control/sula-segmented-control.js +241 -0
- package/dist/collection/components/sula-segmented-control/sula-segmented-control.js.map +1 -0
- package/dist/collection/components/sula-segmented-control/sula-segmented-control.stories.js +352 -0
- package/dist/collection/components/sula-segmented-control/sula-segmented-control.stories.js.map +1 -0
- package/dist/collection/components/sula-switch/sula-switch.css +1 -1
- package/dist/collection/components/sula-switch/sula-switch.js +4 -4
- package/dist/collection/components/sula-tag/sula-tag.css +1 -1
- package/dist/collection/components/sula-tag/sula-tag.js +3 -3
- package/dist/collection/components/sula-textarea/sula-textarea.css +1 -1
- package/dist/collection/components/sula-textarea/sula-textarea.js +6 -6
- package/dist/collection/components/sula-textfield/sula-textfield.css +1 -1
- package/dist/collection/components/sula-textfield/sula-textfield.js +2 -2
- package/dist/collection/components/sula-tiles/sula-tiles.css +1 -1
- package/dist/collection/components/sula-tiles/sula-tiles.js +1 -1
- package/dist/collection/components/sula-timeline-list/sula-timeline-list.css +1 -1
- package/dist/collection/components/sula-timeline-list/sula-timeline-list.js +1 -1
- package/dist/collection/testing/e2e-setup.js +47 -0
- package/dist/collection/testing/e2e-setup.js.map +1 -0
- package/dist/components/{p-CyIObO0v.js → p-BUnU7bjf.js} +3 -3
- package/dist/components/{p-CyIObO0v.js.map → p-BUnU7bjf.js.map} +1 -1
- package/dist/components/{p-BSYnh0jH.js → p-BZgImhEG.js} +5 -5
- package/dist/components/p-BZgImhEG.js.map +1 -0
- package/dist/components/{p-CN1-5xeF.js → p-BuA_ueQn.js} +3 -3
- package/dist/components/{p-CN1-5xeF.js.map → p-BuA_ueQn.js.map} +1 -1
- package/dist/components/{p-DvWN7hVP.js → p-QU2wuzIe.js} +3 -3
- package/dist/components/{p-DvWN7hVP.js.map → p-QU2wuzIe.js.map} +1 -1
- package/dist/components/sula-avatar.js +2 -2
- package/dist/components/sula-avatar.js.map +1 -1
- package/dist/components/sula-badge.js +2 -2
- package/dist/components/sula-badge.js.map +1 -1
- package/dist/components/sula-button.js +1 -1
- package/dist/components/sula-checkbox.js +2 -2
- package/dist/components/sula-checkbox.js.map +1 -1
- package/dist/components/sula-chip.js +3 -3
- package/dist/components/sula-chip.js.map +1 -1
- package/dist/components/sula-dropdown.js +3 -3
- package/dist/components/sula-dropdown.js.map +1 -1
- package/dist/components/sula-icon.js +1 -1
- package/dist/components/sula-loader.js +1 -1
- package/dist/components/sula-menu-select-list.js +1 -1
- package/dist/components/sula-modal.js +4 -4
- package/dist/components/sula-modal.js.map +1 -1
- package/dist/components/sula-progress-bar.js +2 -2
- package/dist/components/sula-progress-bar.js.map +1 -1
- package/dist/components/sula-radio-button.js +1 -1
- package/dist/components/sula-radio-button.js.map +1 -1
- package/dist/components/sula-search-bar.js +2 -2
- package/dist/components/sula-search-bar.js.map +1 -1
- package/dist/components/sula-segmented-control.d.ts +11 -0
- package/dist/components/sula-segmented-control.js +113 -0
- package/dist/components/sula-segmented-control.js.map +1 -0
- package/dist/components/sula-switch.js +5 -5
- package/dist/components/sula-switch.js.map +1 -1
- package/dist/components/sula-tag.js +5 -5
- package/dist/components/sula-tag.js.map +1 -1
- package/dist/components/sula-textarea.js +7 -7
- package/dist/components/sula-textarea.js.map +1 -1
- package/dist/components/sula-textfield.js +4 -4
- package/dist/components/sula-textfield.js.map +1 -1
- package/dist/components/sula-tiles.js +3 -3
- package/dist/components/sula-tiles.js.map +1 -1
- package/dist/components/sula-timeline-list.js +3 -3
- package/dist/components/sula-timeline-list.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{sula-avatar_19.entry.js → sula-avatar_20.entry.js} +116 -39
- package/dist/esm/sula-avatar_20.entry.js.map +1 -0
- package/dist/esm/webcomponents.js +1 -1
- package/dist/types/components/sula-segmented-control/model/sula-segmented-control.model.d.ts +19 -0
- package/dist/types/components/sula-segmented-control/sula-segmented-control.d.ts +37 -0
- package/dist/types/components/sula-segmented-control/sula-segmented-control.stories.d.ts +136 -0
- package/dist/types/components.d.ts +84 -0
- package/dist/types/testing/e2e-setup.d.ts +1 -0
- package/dist/webcomponents/{p-6f5c973c.entry.js → p-fbc8b4d8.entry.js} +615 -512
- package/dist/webcomponents/p-fbc8b4d8.entry.js.map +1 -0
- package/dist/webcomponents/webcomponents.esm.js +6 -1
- package/package.json +5 -2
- package/dist/cjs/sula-avatar_19.cjs.entry.js.map +0 -1
- package/dist/components/p-BSYnh0jH.js.map +0 -1
- package/dist/esm/sula-avatar_19.entry.js.map +0 -1
- package/dist/webcomponents/p-6f5c973c.entry.js.map +0 -1
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
import { SulaSegmentedControlColor, SulaSegmentedControlSize, SulaSegmentedControlType } from "./model/sula-segmented-control.model";
|
|
3
|
+
export class SulaSegmentedControl {
|
|
4
|
+
constructor() {
|
|
5
|
+
/**
|
|
6
|
+
* Items for the segmented control.
|
|
7
|
+
*/
|
|
8
|
+
this.items = [];
|
|
9
|
+
/**
|
|
10
|
+
* Segmented control type.
|
|
11
|
+
*/
|
|
12
|
+
this.type = SulaSegmentedControlType.Text;
|
|
13
|
+
/**
|
|
14
|
+
* Segmented control size.
|
|
15
|
+
*/
|
|
16
|
+
this.size = SulaSegmentedControlSize.Default;
|
|
17
|
+
/**
|
|
18
|
+
* Segmented control color.
|
|
19
|
+
*/
|
|
20
|
+
this.color = SulaSegmentedControlColor.White;
|
|
21
|
+
}
|
|
22
|
+
handleItemClick(selectedItem) {
|
|
23
|
+
this.items = this.items.map(item => (Object.assign(Object.assign({}, item), { selected: item.value === selectedItem.value })));
|
|
24
|
+
this.itemClicked.emit(Object.assign(Object.assign({}, selectedItem), { selected: true }));
|
|
25
|
+
}
|
|
26
|
+
handleItemHover(hoveredItem) {
|
|
27
|
+
this.itemHovered.emit(hoveredItem);
|
|
28
|
+
}
|
|
29
|
+
handleItemBlur(blurredItem) {
|
|
30
|
+
this.itemBlur.emit(blurredItem);
|
|
31
|
+
}
|
|
32
|
+
getCaretIconClass(item) {
|
|
33
|
+
if (this.type === SulaSegmentedControlType.Icon) {
|
|
34
|
+
return item.selected ? 'text-negative-negative-1' : 'text-icon-primary';
|
|
35
|
+
}
|
|
36
|
+
return item.selected ? 'text-brand-primary' : 'text-text-primary';
|
|
37
|
+
}
|
|
38
|
+
render() {
|
|
39
|
+
return (h(Host, { key: 'e1dfe69feaf9d299a87c3006849751fb053e1410' }, h("div", { key: '77ce9955a1ed4a99c3dc35c76b4367a90b2dad61', class: {
|
|
40
|
+
'flex flex-row items-center rounded-xxl p-2 w-fit backdrop-blur-[20px]': true,
|
|
41
|
+
'bg-opacity-on-body': this.color === SulaSegmentedControlColor.Gray,
|
|
42
|
+
'bg-opacity-body': this.color === SulaSegmentedControlColor.White,
|
|
43
|
+
} }, this.items.map(item => (h("div", { class: {
|
|
44
|
+
'rounded-3xl flex justify-center items-center cursor-pointer transition': true,
|
|
45
|
+
'py-12 px-20': this.size === SulaSegmentedControlSize.Default,
|
|
46
|
+
'py-8 px-16': this.size === SulaSegmentedControlSize.Small,
|
|
47
|
+
'bg-box-shadow-body': this.type === SulaSegmentedControlType.Text && item.selected,
|
|
48
|
+
'bg-brand-primary': this.type === SulaSegmentedControlType.Icon && item.selected,
|
|
49
|
+
'hover:bg-box-shadow-body': !item.selected,
|
|
50
|
+
}, onClick: () => this.handleItemClick(item), onMouseEnter: () => this.handleItemHover(item), onMouseLeave: () => this.handleItemBlur(item) }, this.type === SulaSegmentedControlType.Text ? (h("span", { class: {
|
|
51
|
+
'text-brand-primary text-label-medium-bold leading-5': item.selected,
|
|
52
|
+
'text-text-secondary text-paragraph-medium-regular leading-5': !item.selected,
|
|
53
|
+
} }, item.label)) : (h("sula-icon", { class: "flex items-center justify-center", icon: item.icon, customClass: `${item.selected ? 'text-negative-negative-1' : 'text-icon-primary'} text-xl leading-4` })), item.addChevron && h("sula-icon", { class: "ml-4 flex", icon: "ph-bold ph-caret-down", customClass: `${this.getCaretIconClass(item)} text-base leading-4` })))))));
|
|
54
|
+
}
|
|
55
|
+
static get is() { return "sula-segmented-control"; }
|
|
56
|
+
static get encapsulation() { return "shadow"; }
|
|
57
|
+
static get originalStyleUrls() {
|
|
58
|
+
return {
|
|
59
|
+
"$": ["sula-segmented-control.scss"]
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
static get styleUrls() {
|
|
63
|
+
return {
|
|
64
|
+
"$": ["sula-segmented-control.css"]
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
static get properties() {
|
|
68
|
+
return {
|
|
69
|
+
"items": {
|
|
70
|
+
"type": "unknown",
|
|
71
|
+
"attribute": "items",
|
|
72
|
+
"mutable": true,
|
|
73
|
+
"complexType": {
|
|
74
|
+
"original": "SulaSegmentedControlOption[]",
|
|
75
|
+
"resolved": "SulaSegmentedControlOption[]",
|
|
76
|
+
"references": {
|
|
77
|
+
"SulaSegmentedControlOption": {
|
|
78
|
+
"location": "import",
|
|
79
|
+
"path": "./model/sula-segmented-control.model",
|
|
80
|
+
"id": "src/components/sula-segmented-control/model/sula-segmented-control.model.ts::SulaSegmentedControlOption"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"required": false,
|
|
85
|
+
"optional": false,
|
|
86
|
+
"docs": {
|
|
87
|
+
"tags": [],
|
|
88
|
+
"text": "Items for the segmented control."
|
|
89
|
+
},
|
|
90
|
+
"getter": false,
|
|
91
|
+
"setter": false,
|
|
92
|
+
"defaultValue": "[]"
|
|
93
|
+
},
|
|
94
|
+
"type": {
|
|
95
|
+
"type": "string",
|
|
96
|
+
"attribute": "type",
|
|
97
|
+
"mutable": true,
|
|
98
|
+
"complexType": {
|
|
99
|
+
"original": "SulaSegmentedControlType",
|
|
100
|
+
"resolved": "SulaSegmentedControlType.Icon | SulaSegmentedControlType.Text",
|
|
101
|
+
"references": {
|
|
102
|
+
"SulaSegmentedControlType": {
|
|
103
|
+
"location": "import",
|
|
104
|
+
"path": "./model/sula-segmented-control.model",
|
|
105
|
+
"id": "src/components/sula-segmented-control/model/sula-segmented-control.model.ts::SulaSegmentedControlType"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"required": false,
|
|
110
|
+
"optional": false,
|
|
111
|
+
"docs": {
|
|
112
|
+
"tags": [],
|
|
113
|
+
"text": "Segmented control type."
|
|
114
|
+
},
|
|
115
|
+
"getter": false,
|
|
116
|
+
"setter": false,
|
|
117
|
+
"reflect": false,
|
|
118
|
+
"defaultValue": "SulaSegmentedControlType.Text"
|
|
119
|
+
},
|
|
120
|
+
"size": {
|
|
121
|
+
"type": "string",
|
|
122
|
+
"attribute": "size",
|
|
123
|
+
"mutable": true,
|
|
124
|
+
"complexType": {
|
|
125
|
+
"original": "SulaSegmentedControlSize",
|
|
126
|
+
"resolved": "SulaSegmentedControlSize.Default | SulaSegmentedControlSize.Small",
|
|
127
|
+
"references": {
|
|
128
|
+
"SulaSegmentedControlSize": {
|
|
129
|
+
"location": "import",
|
|
130
|
+
"path": "./model/sula-segmented-control.model",
|
|
131
|
+
"id": "src/components/sula-segmented-control/model/sula-segmented-control.model.ts::SulaSegmentedControlSize"
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
"required": false,
|
|
136
|
+
"optional": false,
|
|
137
|
+
"docs": {
|
|
138
|
+
"tags": [],
|
|
139
|
+
"text": "Segmented control size."
|
|
140
|
+
},
|
|
141
|
+
"getter": false,
|
|
142
|
+
"setter": false,
|
|
143
|
+
"reflect": false,
|
|
144
|
+
"defaultValue": "SulaSegmentedControlSize.Default"
|
|
145
|
+
},
|
|
146
|
+
"color": {
|
|
147
|
+
"type": "string",
|
|
148
|
+
"attribute": "color",
|
|
149
|
+
"mutable": true,
|
|
150
|
+
"complexType": {
|
|
151
|
+
"original": "SulaSegmentedControlColor",
|
|
152
|
+
"resolved": "SulaSegmentedControlColor.Gray | SulaSegmentedControlColor.White",
|
|
153
|
+
"references": {
|
|
154
|
+
"SulaSegmentedControlColor": {
|
|
155
|
+
"location": "import",
|
|
156
|
+
"path": "./model/sula-segmented-control.model",
|
|
157
|
+
"id": "src/components/sula-segmented-control/model/sula-segmented-control.model.ts::SulaSegmentedControlColor"
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
"required": false,
|
|
162
|
+
"optional": false,
|
|
163
|
+
"docs": {
|
|
164
|
+
"tags": [],
|
|
165
|
+
"text": "Segmented control color."
|
|
166
|
+
},
|
|
167
|
+
"getter": false,
|
|
168
|
+
"setter": false,
|
|
169
|
+
"reflect": false,
|
|
170
|
+
"defaultValue": "SulaSegmentedControlColor.White"
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
static get events() {
|
|
175
|
+
return [{
|
|
176
|
+
"method": "itemClicked",
|
|
177
|
+
"name": "itemClicked",
|
|
178
|
+
"bubbles": true,
|
|
179
|
+
"cancelable": true,
|
|
180
|
+
"composed": true,
|
|
181
|
+
"docs": {
|
|
182
|
+
"tags": [],
|
|
183
|
+
"text": "Emitted when an item is clicked."
|
|
184
|
+
},
|
|
185
|
+
"complexType": {
|
|
186
|
+
"original": "SulaSegmentedControlOption",
|
|
187
|
+
"resolved": "SulaSegmentedControlOption",
|
|
188
|
+
"references": {
|
|
189
|
+
"SulaSegmentedControlOption": {
|
|
190
|
+
"location": "import",
|
|
191
|
+
"path": "./model/sula-segmented-control.model",
|
|
192
|
+
"id": "src/components/sula-segmented-control/model/sula-segmented-control.model.ts::SulaSegmentedControlOption"
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}, {
|
|
197
|
+
"method": "itemHovered",
|
|
198
|
+
"name": "itemHovered",
|
|
199
|
+
"bubbles": true,
|
|
200
|
+
"cancelable": true,
|
|
201
|
+
"composed": true,
|
|
202
|
+
"docs": {
|
|
203
|
+
"tags": [],
|
|
204
|
+
"text": "Emitted when an item is hovered."
|
|
205
|
+
},
|
|
206
|
+
"complexType": {
|
|
207
|
+
"original": "SulaSegmentedControlOption",
|
|
208
|
+
"resolved": "SulaSegmentedControlOption",
|
|
209
|
+
"references": {
|
|
210
|
+
"SulaSegmentedControlOption": {
|
|
211
|
+
"location": "import",
|
|
212
|
+
"path": "./model/sula-segmented-control.model",
|
|
213
|
+
"id": "src/components/sula-segmented-control/model/sula-segmented-control.model.ts::SulaSegmentedControlOption"
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}, {
|
|
218
|
+
"method": "itemBlur",
|
|
219
|
+
"name": "itemBlur",
|
|
220
|
+
"bubbles": true,
|
|
221
|
+
"cancelable": true,
|
|
222
|
+
"composed": true,
|
|
223
|
+
"docs": {
|
|
224
|
+
"tags": [],
|
|
225
|
+
"text": "Emitted when an item is blurred."
|
|
226
|
+
},
|
|
227
|
+
"complexType": {
|
|
228
|
+
"original": "SulaSegmentedControlOption",
|
|
229
|
+
"resolved": "SulaSegmentedControlOption",
|
|
230
|
+
"references": {
|
|
231
|
+
"SulaSegmentedControlOption": {
|
|
232
|
+
"location": "import",
|
|
233
|
+
"path": "./model/sula-segmented-control.model",
|
|
234
|
+
"id": "src/components/sula-segmented-control/model/sula-segmented-control.model.ts::SulaSegmentedControlOption"
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}];
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
//# sourceMappingURL=sula-segmented-control.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sula-segmented-control.js","sourceRoot":"","sources":["../../../src/components/sula-segmented-control/sula-segmented-control.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAE,yBAAyB,EAA8B,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAOjK,MAAM,OAAO,oBAAoB;IALjC;QAME;;WAEG;QAEH,UAAK,GAAiC,EAAE,CAAC;QAEzC;;WAEG;QAEH,SAAI,GAA6B,wBAAwB,CAAC,IAAI,CAAC;QAE/D;;WAEG;QAEH,SAAI,GAA6B,wBAAwB,CAAC,OAAO,CAAC;QAElE;;WAEG;QAEH,UAAK,GAA8B,yBAAyB,CAAC,KAAK,CAAC;KA2FpE;IAvEC,eAAe,CAAC,YAAwC;QACtD,IAAI,CAAC,KAAK,GAAG,IAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Event, EventEmitter, Host, Prop, h } from '@stencil/core';\nimport { SulaSegmentedControlColor, SulaSegmentedControlOption, SulaSegmentedControlSize, SulaSegmentedControlType } from './model/sula-segmented-control.model';\n\n@Component({\n tag: 'sula-segmented-control',\n styleUrl: 'sula-segmented-control.scss',\n shadow: true,\n})\nexport class SulaSegmentedControl {\n /**\n * Items for the segmented control.\n */\n @Prop({ mutable: true })\n items: SulaSegmentedControlOption[] = [];\n\n /**\n * Segmented control type.\n */\n @Prop({ mutable: true })\n type: SulaSegmentedControlType = SulaSegmentedControlType.Text;\n\n /**\n * Segmented control size.\n */\n @Prop({ mutable: true })\n size: SulaSegmentedControlSize = SulaSegmentedControlSize.Default;\n\n /**\n * Segmented control color.\n */\n @Prop({ mutable: true })\n color: SulaSegmentedControlColor = SulaSegmentedControlColor.White;\n\n /**\n * Emitted when an item is clicked.\n */\n @Event()\n itemClicked: EventEmitter<SulaSegmentedControlOption>;\n\n /**\n * Emitted when an item is hovered.\n */\n @Event()\n itemHovered: EventEmitter<SulaSegmentedControlOption>;\n\n /**\n * Emitted when an item is blurred.\n */\n @Event()\n itemBlur: EventEmitter<SulaSegmentedControlOption>;\n\n handleItemClick(selectedItem: SulaSegmentedControlOption) {\n this.items = this.items.map(item => ({\n ...item,\n selected: item.value === selectedItem.value,\n }));\n\n this.itemClicked.emit({ ...selectedItem, selected: true });\n }\n\n handleItemHover(hoveredItem: SulaSegmentedControlOption) {\n this.itemHovered.emit(hoveredItem);\n }\n\n handleItemBlur(blurredItem: SulaSegmentedControlOption) {\n this.itemBlur.emit(blurredItem);\n }\n\n getCaretIconClass(item: SulaSegmentedControlOption) {\n if (this.type === SulaSegmentedControlType.Icon) {\n return item.selected ? 'text-negative-negative-1' : 'text-icon-primary';\n }\n return item.selected ? 'text-brand-primary' : 'text-text-primary';\n }\n\n render() {\n return (\n <Host>\n <div\n class={{\n 'flex flex-row items-center rounded-xxl p-2 w-fit backdrop-blur-[20px]': true,\n 'bg-opacity-on-body': this.color === SulaSegmentedControlColor.Gray,\n 'bg-opacity-body': this.color === SulaSegmentedControlColor.White,\n }}\n >\n {this.items.map(item => (\n <div\n class={{\n 'rounded-3xl flex justify-center items-center cursor-pointer transition': true,\n 'py-12 px-20': this.size === SulaSegmentedControlSize.Default,\n 'py-8 px-16': this.size === SulaSegmentedControlSize.Small,\n 'bg-box-shadow-body': this.type === SulaSegmentedControlType.Text && item.selected,\n 'bg-brand-primary': this.type === SulaSegmentedControlType.Icon && item.selected,\n 'hover:bg-box-shadow-body': !item.selected,\n }}\n onClick={() => this.handleItemClick(item)}\n onMouseEnter={() => this.handleItemHover(item)}\n onMouseLeave={() => this.handleItemBlur(item)}\n >\n {this.type === SulaSegmentedControlType.Text ? (\n <span\n class={{\n 'text-brand-primary text-label-medium-bold leading-5': item.selected,\n 'text-text-secondary text-paragraph-medium-regular leading-5': !item.selected,\n }}\n >\n {item.label}\n </span>\n ) : (\n <sula-icon\n class=\"flex items-center justify-center\"\n icon={item.icon}\n customClass={`${item.selected ? 'text-negative-negative-1' : 'text-icon-primary'} text-xl leading-4`}\n ></sula-icon>\n )}\n {item.addChevron && <sula-icon class=\"ml-4 flex\" icon=\"ph-bold ph-caret-down\" customClass={`${this.getCaretIconClass(item)} text-base leading-4`}></sula-icon>}\n </div>\n ))}\n </div>\n </Host>\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
import { SulaSegmentedControlColor, SulaSegmentedControlSize, SulaSegmentedControlType } from "./model/sula-segmented-control.model";
|
|
2
|
+
export default {
|
|
3
|
+
title: 'Components/sula-segmented-control',
|
|
4
|
+
tags: ['autodocs'],
|
|
5
|
+
argTypes: {
|
|
6
|
+
items: {
|
|
7
|
+
control: 'object',
|
|
8
|
+
description: 'Array de opções para o controle segmentado',
|
|
9
|
+
table: {
|
|
10
|
+
type: { summary: 'SulaSegmentedControlOption[]' },
|
|
11
|
+
defaultValue: { summary: '[]' },
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
type: {
|
|
15
|
+
control: { type: 'select' },
|
|
16
|
+
options: Object.values(SulaSegmentedControlType),
|
|
17
|
+
description: 'Tipo do controle segmentado (texto ou ícone)',
|
|
18
|
+
table: {
|
|
19
|
+
type: { summary: 'SulaSegmentedControlType' },
|
|
20
|
+
defaultValue: { summary: 'SulaSegmentedControlType.Text' },
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
size: {
|
|
24
|
+
control: { type: 'select' },
|
|
25
|
+
options: Object.values(SulaSegmentedControlSize),
|
|
26
|
+
description: 'Tamanho do controle segmentado',
|
|
27
|
+
table: {
|
|
28
|
+
type: { summary: 'SulaSegmentedControlSize' },
|
|
29
|
+
defaultValue: { summary: 'SulaSegmentedControlSize.Default' },
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
color: {
|
|
33
|
+
control: { type: 'select' },
|
|
34
|
+
options: Object.values(SulaSegmentedControlColor),
|
|
35
|
+
description: 'Cor de fundo do controle segmentado',
|
|
36
|
+
table: {
|
|
37
|
+
type: { summary: 'SulaSegmentedControlColor' },
|
|
38
|
+
defaultValue: { summary: 'SulaSegmentedControlColor.White' },
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
itemClicked: {
|
|
42
|
+
action: 'itemClicked',
|
|
43
|
+
description: 'Evento emitido quando um item é clicado',
|
|
44
|
+
table: {
|
|
45
|
+
type: { summary: 'CustomEvent<SulaSegmentedControlOption>' },
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
itemHovered: {
|
|
49
|
+
action: 'itemHovered',
|
|
50
|
+
description: 'Evento emitido quando um item recebe hover',
|
|
51
|
+
table: {
|
|
52
|
+
type: { summary: 'CustomEvent<SulaSegmentedControlOption>' },
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
itemBlur: {
|
|
56
|
+
action: 'itemBlur',
|
|
57
|
+
description: 'Evento emitido quando um item perde o foco',
|
|
58
|
+
table: {
|
|
59
|
+
type: { summary: 'CustomEvent<SulaSegmentedControlOption>' },
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
parameters: {
|
|
64
|
+
docs: {
|
|
65
|
+
description: {
|
|
66
|
+
component: `
|
|
67
|
+
O componente **Sula Segmented Control** é utilizado para permitir que os usuários escolham entre
|
|
68
|
+
múltiplas opções mutuamente exclusivas. É ideal para navegação entre visualizações ou filtros.
|
|
69
|
+
|
|
70
|
+
### Características principais:
|
|
71
|
+
- Suporte a diferentes tipos (Texto e Ícone)
|
|
72
|
+
- Diferentes tamanhos (Default e Small)
|
|
73
|
+
- Cores de fundo personalizáveis (White e Gray)
|
|
74
|
+
- Suporte a chevron adicional nas opções
|
|
75
|
+
- Eventos de clique, hover e blur
|
|
76
|
+
`,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
const Template = args => {
|
|
82
|
+
const container = document.createElement('div');
|
|
83
|
+
container.style.margin = '20px';
|
|
84
|
+
container.style.display = 'flex';
|
|
85
|
+
container.style.alignItems = 'center';
|
|
86
|
+
container.style.justifyContent = 'center';
|
|
87
|
+
container.style.minHeight = '80px';
|
|
88
|
+
if (args.color === SulaSegmentedControlColor.White) {
|
|
89
|
+
container.style.backgroundColor = '#f5f5f5';
|
|
90
|
+
container.style.padding = '20px';
|
|
91
|
+
container.style.borderRadius = '8px';
|
|
92
|
+
}
|
|
93
|
+
const el = document.createElement('sula-segmented-control');
|
|
94
|
+
el.items = args.items;
|
|
95
|
+
el.setAttribute('type', args.type);
|
|
96
|
+
el.setAttribute('size', args.size);
|
|
97
|
+
el.setAttribute('color', args.color);
|
|
98
|
+
el.addEventListener('itemClicked', args.itemClicked);
|
|
99
|
+
el.addEventListener('itemHovered', args.itemHovered);
|
|
100
|
+
el.addEventListener('itemBlur', args.itemBlur);
|
|
101
|
+
container.appendChild(el);
|
|
102
|
+
return container;
|
|
103
|
+
};
|
|
104
|
+
export const Playground = Template.bind({});
|
|
105
|
+
Playground.args = {
|
|
106
|
+
items: [
|
|
107
|
+
{ label: 'Opção 1', value: '1', selected: true },
|
|
108
|
+
{ label: 'Opção 2', value: '2' },
|
|
109
|
+
{ label: 'Opção 3', value: '3' },
|
|
110
|
+
],
|
|
111
|
+
type: SulaSegmentedControlType.Text,
|
|
112
|
+
size: SulaSegmentedControlSize.Default,
|
|
113
|
+
color: SulaSegmentedControlColor.White,
|
|
114
|
+
};
|
|
115
|
+
export const TextType = Template.bind({});
|
|
116
|
+
TextType.args = {
|
|
117
|
+
items: [
|
|
118
|
+
{ label: 'Todos', value: 'all', selected: true },
|
|
119
|
+
{ label: 'Ativos', value: 'active' },
|
|
120
|
+
{ label: 'Inativos', value: 'inactive' },
|
|
121
|
+
],
|
|
122
|
+
type: SulaSegmentedControlType.Text,
|
|
123
|
+
size: SulaSegmentedControlSize.Default,
|
|
124
|
+
color: SulaSegmentedControlColor.White,
|
|
125
|
+
};
|
|
126
|
+
TextType.parameters = {
|
|
127
|
+
docs: {
|
|
128
|
+
description: {
|
|
129
|
+
story: 'Controle segmentado com texto.',
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
export const IconType = Template.bind({});
|
|
134
|
+
IconType.args = {
|
|
135
|
+
items: [
|
|
136
|
+
{ icon: 'ph ph-house', value: 'home', selected: true },
|
|
137
|
+
{ icon: 'ph ph-user', value: 'user' },
|
|
138
|
+
{ icon: 'ph ph-gear', value: 'settings' },
|
|
139
|
+
],
|
|
140
|
+
type: SulaSegmentedControlType.Icon,
|
|
141
|
+
size: SulaSegmentedControlSize.Default,
|
|
142
|
+
color: SulaSegmentedControlColor.White,
|
|
143
|
+
};
|
|
144
|
+
IconType.parameters = {
|
|
145
|
+
docs: {
|
|
146
|
+
description: {
|
|
147
|
+
story: 'Controle segmentado com ícones.',
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
export const WithChevron = Template.bind({});
|
|
152
|
+
WithChevron.args = {
|
|
153
|
+
items: [
|
|
154
|
+
{ label: 'Filtro 1', value: '1', addChevron: true, selected: true },
|
|
155
|
+
{ label: 'Filtro 2', value: '2', addChevron: true },
|
|
156
|
+
{ label: 'Filtro 3', value: '3', addChevron: true },
|
|
157
|
+
],
|
|
158
|
+
type: SulaSegmentedControlType.Text,
|
|
159
|
+
size: SulaSegmentedControlSize.Default,
|
|
160
|
+
color: SulaSegmentedControlColor.White,
|
|
161
|
+
};
|
|
162
|
+
WithChevron.parameters = {
|
|
163
|
+
docs: {
|
|
164
|
+
description: {
|
|
165
|
+
story: 'Controle segmentado com chevron nas opções.',
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
};
|
|
169
|
+
export const SmallSize = Template.bind({});
|
|
170
|
+
SmallSize.args = {
|
|
171
|
+
items: [
|
|
172
|
+
{ label: 'Pequeno 1', value: '1', selected: true },
|
|
173
|
+
{ label: 'Pequeno 2', value: '2' },
|
|
174
|
+
{ label: 'Pequeno 3', value: '3' },
|
|
175
|
+
],
|
|
176
|
+
type: SulaSegmentedControlType.Text,
|
|
177
|
+
size: SulaSegmentedControlSize.Small,
|
|
178
|
+
color: SulaSegmentedControlColor.White,
|
|
179
|
+
};
|
|
180
|
+
SmallSize.parameters = {
|
|
181
|
+
docs: {
|
|
182
|
+
description: {
|
|
183
|
+
story: 'Controle segmentado em tamanho pequeno.',
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
export const Sizes = () => {
|
|
188
|
+
const container = document.createElement('div');
|
|
189
|
+
container.style.display = 'flex';
|
|
190
|
+
container.style.flexDirection = 'column';
|
|
191
|
+
container.style.gap = '16px';
|
|
192
|
+
container.style.alignItems = 'center';
|
|
193
|
+
container.style.padding = '20px';
|
|
194
|
+
container.style.backgroundColor = '#f5f5f5';
|
|
195
|
+
container.style.borderRadius = '8px';
|
|
196
|
+
const defaultControl = document.createElement('sula-segmented-control');
|
|
197
|
+
defaultControl.items = [
|
|
198
|
+
{ label: 'Default 1', value: '1', selected: true },
|
|
199
|
+
{ label: 'Default 2', value: '2' },
|
|
200
|
+
{ label: 'Default 3', value: '3' },
|
|
201
|
+
];
|
|
202
|
+
defaultControl.setAttribute('size', SulaSegmentedControlSize.Default);
|
|
203
|
+
const smallControl = document.createElement('sula-segmented-control');
|
|
204
|
+
smallControl.items = [
|
|
205
|
+
{ label: 'Small 1', value: '1', selected: true },
|
|
206
|
+
{ label: 'Small 2', value: '2' },
|
|
207
|
+
{ label: 'Small 3', value: '3' },
|
|
208
|
+
];
|
|
209
|
+
smallControl.setAttribute('size', SulaSegmentedControlSize.Small);
|
|
210
|
+
container.appendChild(defaultControl);
|
|
211
|
+
container.appendChild(smallControl);
|
|
212
|
+
return container;
|
|
213
|
+
};
|
|
214
|
+
Sizes.parameters = {
|
|
215
|
+
docs: {
|
|
216
|
+
description: {
|
|
217
|
+
story: 'Comparação entre os diferentes tamanhos disponíveis.',
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
};
|
|
221
|
+
export const GrayBackground = Template.bind({});
|
|
222
|
+
GrayBackground.args = {
|
|
223
|
+
items: [
|
|
224
|
+
{ label: 'Opção 1', value: '1', selected: true },
|
|
225
|
+
{ label: 'Opção 2', value: '2' },
|
|
226
|
+
{ label: 'Opção 3', value: '3' },
|
|
227
|
+
],
|
|
228
|
+
type: SulaSegmentedControlType.Text,
|
|
229
|
+
size: SulaSegmentedControlSize.Default,
|
|
230
|
+
color: SulaSegmentedControlColor.Gray,
|
|
231
|
+
};
|
|
232
|
+
GrayBackground.parameters = {
|
|
233
|
+
docs: {
|
|
234
|
+
description: {
|
|
235
|
+
story: 'Controle segmentado com fundo cinza.',
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
};
|
|
239
|
+
export const ColorVariations = () => {
|
|
240
|
+
const container = document.createElement('div');
|
|
241
|
+
container.style.display = 'flex';
|
|
242
|
+
container.style.flexDirection = 'column';
|
|
243
|
+
container.style.gap = '16px';
|
|
244
|
+
container.style.alignItems = 'center';
|
|
245
|
+
container.style.padding = '20px';
|
|
246
|
+
container.style.backgroundColor = '#f5f5f5';
|
|
247
|
+
container.style.borderRadius = '8px';
|
|
248
|
+
const whiteControl = document.createElement('sula-segmented-control');
|
|
249
|
+
whiteControl.items = [
|
|
250
|
+
{ label: 'White 1', value: '1', selected: true },
|
|
251
|
+
{ label: 'White 2', value: '2' },
|
|
252
|
+
{ label: 'White 3', value: '3' },
|
|
253
|
+
];
|
|
254
|
+
whiteControl.setAttribute('color', SulaSegmentedControlColor.White);
|
|
255
|
+
const grayControl = document.createElement('sula-segmented-control');
|
|
256
|
+
grayControl.items = [
|
|
257
|
+
{ label: 'Gray 1', value: '1', selected: true },
|
|
258
|
+
{ label: 'Gray 2', value: '2' },
|
|
259
|
+
{ label: 'Gray 3', value: '3' },
|
|
260
|
+
];
|
|
261
|
+
grayControl.setAttribute('color', SulaSegmentedControlColor.Gray);
|
|
262
|
+
container.appendChild(whiteControl);
|
|
263
|
+
container.appendChild(grayControl);
|
|
264
|
+
return container;
|
|
265
|
+
};
|
|
266
|
+
ColorVariations.parameters = {
|
|
267
|
+
docs: {
|
|
268
|
+
description: {
|
|
269
|
+
story: 'Diferentes cores de fundo disponíveis.',
|
|
270
|
+
},
|
|
271
|
+
},
|
|
272
|
+
};
|
|
273
|
+
export const ManyOptions = Template.bind({});
|
|
274
|
+
ManyOptions.args = {
|
|
275
|
+
items: [
|
|
276
|
+
{ label: 'Janeiro', value: '1', selected: true },
|
|
277
|
+
{ label: 'Fevereiro', value: '2' },
|
|
278
|
+
{ label: 'Março', value: '3' },
|
|
279
|
+
{ label: 'Abril', value: '4' },
|
|
280
|
+
{ label: 'Maio', value: '5' },
|
|
281
|
+
],
|
|
282
|
+
type: SulaSegmentedControlType.Text,
|
|
283
|
+
size: SulaSegmentedControlSize.Default,
|
|
284
|
+
color: SulaSegmentedControlColor.White,
|
|
285
|
+
};
|
|
286
|
+
ManyOptions.parameters = {
|
|
287
|
+
docs: {
|
|
288
|
+
description: {
|
|
289
|
+
story: 'Controle segmentado com múltiplas opções.',
|
|
290
|
+
},
|
|
291
|
+
},
|
|
292
|
+
};
|
|
293
|
+
export const AllVariations = () => {
|
|
294
|
+
const container = document.createElement('div');
|
|
295
|
+
container.style.display = 'grid';
|
|
296
|
+
container.style.gridTemplateColumns = 'repeat(auto-fit, minmax(300px, 1fr))';
|
|
297
|
+
container.style.gap = '24px';
|
|
298
|
+
container.style.padding = '20px';
|
|
299
|
+
container.style.backgroundColor = '#f5f5f5';
|
|
300
|
+
container.style.borderRadius = '8px';
|
|
301
|
+
const variations = [
|
|
302
|
+
{
|
|
303
|
+
items: [
|
|
304
|
+
{ label: 'Text White', value: '1', selected: true },
|
|
305
|
+
{ label: 'Opção 2', value: '2' },
|
|
306
|
+
],
|
|
307
|
+
type: SulaSegmentedControlType.Text,
|
|
308
|
+
color: SulaSegmentedControlColor.White,
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
items: [
|
|
312
|
+
{ label: 'Text Gray', value: '1', selected: true },
|
|
313
|
+
{ label: 'Opção 2', value: '2' },
|
|
314
|
+
],
|
|
315
|
+
type: SulaSegmentedControlType.Text,
|
|
316
|
+
color: SulaSegmentedControlColor.Gray,
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
items: [
|
|
320
|
+
{ icon: 'ph ph-house', value: '1', selected: true },
|
|
321
|
+
{ icon: 'ph ph-user', value: '2' },
|
|
322
|
+
],
|
|
323
|
+
type: SulaSegmentedControlType.Icon,
|
|
324
|
+
color: SulaSegmentedControlColor.White,
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
items: [
|
|
328
|
+
{ icon: 'ph ph-house', value: '1', selected: true },
|
|
329
|
+
{ icon: 'ph ph-user', value: '2' },
|
|
330
|
+
],
|
|
331
|
+
type: SulaSegmentedControlType.Icon,
|
|
332
|
+
color: SulaSegmentedControlColor.Gray,
|
|
333
|
+
},
|
|
334
|
+
];
|
|
335
|
+
variations.forEach(variation => {
|
|
336
|
+
const control = document.createElement('sula-segmented-control');
|
|
337
|
+
control.items = variation.items;
|
|
338
|
+
control.setAttribute('type', variation.type);
|
|
339
|
+
control.setAttribute('color', variation.color);
|
|
340
|
+
control.setAttribute('size', SulaSegmentedControlSize.Default);
|
|
341
|
+
container.appendChild(control);
|
|
342
|
+
});
|
|
343
|
+
return container;
|
|
344
|
+
};
|
|
345
|
+
AllVariations.parameters = {
|
|
346
|
+
docs: {
|
|
347
|
+
description: {
|
|
348
|
+
story: 'Visão geral de todas as combinações de tipo e cor.',
|
|
349
|
+
},
|
|
350
|
+
},
|
|
351
|
+
};
|
|
352
|
+
//# sourceMappingURL=sula-segmented-control.stories.js.map
|
package/dist/collection/components/sula-segmented-control/sula-segmented-control.stories.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sula-segmented-control.stories.js","sourceRoot":"","sources":["../../../src/components/sula-segmented-control/sula-segmented-control.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAErI,eAAe;IACb,KAAK,EAAE,mCAAmC;IAC1C,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,QAAQ,EAAE;QACR,KAAK,EAAE;YACL,OAAO,EAAE,QAAQ;YACjB,WAAW,EAAE,4CAA4C;YACzD,KAAK,EAAE;gBACL,IAAI,EAAE,EAAE,OAAO,EAAE,8BAA8B,EAAE;gBACjD,YAAY,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;aAChC;SACF;QACD,IAAI,EAAE;YACJ,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC3B,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,wBAAwB,CAAC;YAChD,WAAW,EAAE,8CAA8C;YAC3D,KAAK,EAAE;gBACL,IAAI,EAA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E,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,EAAE;aACnC;YACD,IAAI,EAAE,wBAAwB,CAAC,IAAI;YACnC,KAAK,EAAE,yBAAyB,CAAC,IAAI;SACtC;KACF,CAAC;IAEF,UAAU,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;QAC7B,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,wBAAwB,CAAC,CAAC;QACjE,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC;QAChC,OAAO,CAAC,YAAY,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;QAC7C,OAAO,CAAC,YAAY,CAAC,OAAO,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;QAC/C,OAAO,CAAC,YAAY,CAAC,MAAM,EAAE,wBAAwB,CAAC,OAAO,CAAC,CAAC;QAC/D,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AACF,aAAa,CAAC,UAAU,GAAG;IACzB,IAAI,EAAE;QACJ,WAAW,EAAE;YACX,KAAK,EAAE,oDAAoD;SAC5D;KACF;CACF,CAAC","sourcesContent":["import { SulaSegmentedControlColor, SulaSegmentedControlSize, SulaSegmentedControlType } from './model/sula-segmented-control.model';\n\nexport default {\n title: 'Components/sula-segmented-control',\n tags: ['autodocs'],\n argTypes: {\n items: {\n control: 'object',\n description: 'Array de opções para o controle segmentado',\n table: {\n type: { summary: 'SulaSegmentedControlOption[]' },\n defaultValue: { summary: '[]' },\n },\n },\n type: {\n control: { type: 'select' },\n options: Object.values(SulaSegmentedControlType),\n description: 'Tipo do controle segmentado (texto ou ícone)',\n table: {\n type: { summary: 'SulaSegmentedControlType' },\n defaultValue: { summary: 'SulaSegmentedControlType.Text' },\n },\n },\n size: {\n control: { type: 'select' },\n options: Object.values(SulaSegmentedControlSize),\n description: 'Tamanho do controle segmentado',\n table: {\n type: { summary: 'SulaSegmentedControlSize' },\n defaultValue: { summary: 'SulaSegmentedControlSize.Default' },\n },\n },\n color: {\n control: { type: 'select' },\n options: Object.values(SulaSegmentedControlColor),\n description: 'Cor de fundo do controle segmentado',\n table: {\n type: { summary: 'SulaSegmentedControlColor' },\n defaultValue: { summary: 'SulaSegmentedControlColor.White' },\n },\n },\n itemClicked: {\n action: 'itemClicked',\n description: 'Evento emitido quando um item é clicado',\n table: {\n type: { summary: 'CustomEvent<SulaSegmentedControlOption>' },\n },\n },\n itemHovered: {\n action: 'itemHovered',\n description: 'Evento emitido quando um item recebe hover',\n table: {\n type: { summary: 'CustomEvent<SulaSegmentedControlOption>' },\n },\n },\n itemBlur: {\n action: 'itemBlur',\n description: 'Evento emitido quando um item perde o foco',\n table: {\n type: { summary: 'CustomEvent<SulaSegmentedControlOption>' },\n },\n },\n },\n parameters: {\n docs: {\n description: {\n component: `\nO componente **Sula Segmented Control** é utilizado para permitir que os usuários escolham entre\nmúltiplas opções mutuamente exclusivas. É ideal para navegação entre visualizações ou filtros.\n\n### Características principais:\n- Suporte a diferentes tipos (Texto e Ícone)\n- Diferentes tamanhos (Default e Small)\n- Cores de fundo personalizáveis (White e Gray)\n- Suporte a chevron adicional nas opções\n- Eventos de clique, hover e blur\n `,\n },\n },\n },\n};\n\nconst Template = args => {\n const container = document.createElement('div');\n container.style.margin = '20px';\n container.style.display = 'flex';\n container.style.alignItems = 'center';\n container.style.justifyContent = 'center';\n container.style.minHeight = '80px';\n\n if (args.color === SulaSegmentedControlColor.White) {\n container.style.backgroundColor = '#f5f5f5';\n container.style.padding = '20px';\n container.style.borderRadius = '8px';\n }\n\n const el = document.createElement('sula-segmented-control');\n\n el.items = args.items;\n el.setAttribute('type', args.type);\n el.setAttribute('size', args.size);\n el.setAttribute('color', args.color);\n\n el.addEventListener('itemClicked', args.itemClicked);\n el.addEventListener('itemHovered', args.itemHovered);\n el.addEventListener('itemBlur', args.itemBlur);\n\n container.appendChild(el);\n return container;\n};\n\nexport const Playground = Template.bind({});\nPlayground.args = {\n items: [\n { label: 'Opção 1', value: '1', selected: true },\n { label: 'Opção 2', value: '2' },\n { label: 'Opção 3', value: '3' },\n ],\n type: SulaSegmentedControlType.Text,\n size: SulaSegmentedControlSize.Default,\n color: SulaSegmentedControlColor.White,\n};\n\nexport const TextType = Template.bind({});\nTextType.args = {\n items: [\n { label: 'Todos', value: 'all', selected: true },\n { label: 'Ativos', value: 'active' },\n { label: 'Inativos', value: 'inactive' },\n ],\n type: SulaSegmentedControlType.Text,\n size: SulaSegmentedControlSize.Default,\n color: SulaSegmentedControlColor.White,\n};\nTextType.parameters = {\n docs: {\n description: {\n story: 'Controle segmentado com texto.',\n },\n },\n};\n\nexport const IconType = Template.bind({});\nIconType.args = {\n items: [\n { icon: 'ph ph-house', value: 'home', selected: true },\n { icon: 'ph ph-user', value: 'user' },\n { icon: 'ph ph-gear', value: 'settings' },\n ],\n type: SulaSegmentedControlType.Icon,\n size: SulaSegmentedControlSize.Default,\n color: SulaSegmentedControlColor.White,\n};\nIconType.parameters = {\n docs: {\n description: {\n story: 'Controle segmentado com ícones.',\n },\n },\n};\n\nexport const WithChevron = Template.bind({});\nWithChevron.args = {\n items: [\n { label: 'Filtro 1', value: '1', addChevron: true, selected: true },\n { label: 'Filtro 2', value: '2', addChevron: true },\n { label: 'Filtro 3', value: '3', addChevron: true },\n ],\n type: SulaSegmentedControlType.Text,\n size: SulaSegmentedControlSize.Default,\n color: SulaSegmentedControlColor.White,\n};\nWithChevron.parameters = {\n docs: {\n description: {\n story: 'Controle segmentado com chevron nas opções.',\n },\n },\n};\n\nexport const SmallSize = Template.bind({});\nSmallSize.args = {\n items: [\n { label: 'Pequeno 1', value: '1', selected: true },\n { label: 'Pequeno 2', value: '2' },\n { label: 'Pequeno 3', value: '3' },\n ],\n type: SulaSegmentedControlType.Text,\n size: SulaSegmentedControlSize.Small,\n color: SulaSegmentedControlColor.White,\n};\nSmallSize.parameters = {\n docs: {\n description: {\n story: 'Controle segmentado em tamanho pequeno.',\n },\n },\n};\n\nexport const Sizes = () => {\n const container = document.createElement('div');\n container.style.display = 'flex';\n container.style.flexDirection = 'column';\n container.style.gap = '16px';\n container.style.alignItems = 'center';\n container.style.padding = '20px';\n container.style.backgroundColor = '#f5f5f5';\n container.style.borderRadius = '8px';\n\n const defaultControl = document.createElement('sula-segmented-control');\n defaultControl.items = [\n { label: 'Default 1', value: '1', selected: true },\n { label: 'Default 2', value: '2' },\n { label: 'Default 3', value: '3' },\n ];\n defaultControl.setAttribute('size', SulaSegmentedControlSize.Default);\n\n const smallControl = document.createElement('sula-segmented-control');\n smallControl.items = [\n { label: 'Small 1', value: '1', selected: true },\n { label: 'Small 2', value: '2' },\n { label: 'Small 3', value: '3' },\n ];\n smallControl.setAttribute('size', SulaSegmentedControlSize.Small);\n\n container.appendChild(defaultControl);\n container.appendChild(smallControl);\n\n return container;\n};\nSizes.parameters = {\n docs: {\n description: {\n story: 'Comparação entre os diferentes tamanhos disponíveis.',\n },\n },\n};\n\nexport const GrayBackground = Template.bind({});\nGrayBackground.args = {\n items: [\n { label: 'Opção 1', value: '1', selected: true },\n { label: 'Opção 2', value: '2' },\n { label: 'Opção 3', value: '3' },\n ],\n type: SulaSegmentedControlType.Text,\n size: SulaSegmentedControlSize.Default,\n color: SulaSegmentedControlColor.Gray,\n};\nGrayBackground.parameters = {\n docs: {\n description: {\n story: 'Controle segmentado com fundo cinza.',\n },\n },\n};\n\nexport const ColorVariations = () => {\n const container = document.createElement('div');\n container.style.display = 'flex';\n container.style.flexDirection = 'column';\n container.style.gap = '16px';\n container.style.alignItems = 'center';\n container.style.padding = '20px';\n container.style.backgroundColor = '#f5f5f5';\n container.style.borderRadius = '8px';\n\n const whiteControl = document.createElement('sula-segmented-control');\n whiteControl.items = [\n { label: 'White 1', value: '1', selected: true },\n { label: 'White 2', value: '2' },\n { label: 'White 3', value: '3' },\n ];\n whiteControl.setAttribute('color', SulaSegmentedControlColor.White);\n\n const grayControl = document.createElement('sula-segmented-control');\n grayControl.items = [\n { label: 'Gray 1', value: '1', selected: true },\n { label: 'Gray 2', value: '2' },\n { label: 'Gray 3', value: '3' },\n ];\n grayControl.setAttribute('color', SulaSegmentedControlColor.Gray);\n\n container.appendChild(whiteControl);\n container.appendChild(grayControl);\n\n return container;\n};\nColorVariations.parameters = {\n docs: {\n description: {\n story: 'Diferentes cores de fundo disponíveis.',\n },\n },\n};\n\nexport const ManyOptions = Template.bind({});\nManyOptions.args = {\n items: [\n { label: 'Janeiro', value: '1', selected: true },\n { label: 'Fevereiro', value: '2' },\n { label: 'Março', value: '3' },\n { label: 'Abril', value: '4' },\n { label: 'Maio', value: '5' },\n ],\n type: SulaSegmentedControlType.Text,\n size: SulaSegmentedControlSize.Default,\n color: SulaSegmentedControlColor.White,\n};\nManyOptions.parameters = {\n docs: {\n description: {\n story: 'Controle segmentado com múltiplas opções.',\n },\n },\n};\n\nexport const AllVariations = () => {\n const container = document.createElement('div');\n container.style.display = 'grid';\n container.style.gridTemplateColumns = 'repeat(auto-fit, minmax(300px, 1fr))';\n container.style.gap = '24px';\n container.style.padding = '20px';\n container.style.backgroundColor = '#f5f5f5';\n container.style.borderRadius = '8px';\n\n const variations = [\n {\n items: [\n { label: 'Text White', value: '1', selected: true },\n { label: 'Opção 2', value: '2' },\n ],\n type: SulaSegmentedControlType.Text,\n color: SulaSegmentedControlColor.White,\n },\n {\n items: [\n { label: 'Text Gray', value: '1', selected: true },\n { label: 'Opção 2', value: '2' },\n ],\n type: SulaSegmentedControlType.Text,\n color: SulaSegmentedControlColor.Gray,\n },\n {\n items: [\n { icon: 'ph ph-house', value: '1', selected: true },\n { icon: 'ph ph-user', value: '2' },\n ],\n type: SulaSegmentedControlType.Icon,\n color: SulaSegmentedControlColor.White,\n },\n {\n items: [\n { icon: 'ph ph-house', value: '1', selected: true },\n { icon: 'ph ph-user', value: '2' },\n ],\n type: SulaSegmentedControlType.Icon,\n color: SulaSegmentedControlColor.Gray,\n },\n ];\n\n variations.forEach(variation => {\n const control = document.createElement('sula-segmented-control');\n control.items = variation.items;\n control.setAttribute('type', variation.type);\n control.setAttribute('color', variation.color);\n control.setAttribute('size', SulaSegmentedControlSize.Default);\n container.appendChild(control);\n });\n\n return container;\n};\nAllVariations.parameters = {\n docs: {\n description: {\n story: 'Visão geral de todas as combinações de tipo e cor.',\n },\n },\n};\n"]}
|