@sula-tech/webcomponents 0.5.0 → 0.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.
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{sula-avatar_16.cjs.entry.js → sula-avatar_18.cjs.entry.js} +224 -50
- package/dist/cjs/sula-avatar_18.cjs.entry.js.map +1 -0
- package/dist/cjs/webcomponents.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/sula-button/sula-button.css +1 -1
- package/dist/collection/components/sula-button/sula-button.js +90 -6
- package/dist/collection/components/sula-button/sula-button.js.map +1 -1
- package/dist/collection/components/sula-button/sula-button.stories.js +283 -96
- package/dist/collection/components/sula-button/sula-button.stories.js.map +1 -1
- package/dist/collection/components/sula-checkbox/sula-checkbox.js +3 -3
- package/dist/collection/components/sula-chip/sula-chip.js +3 -3
- package/dist/collection/components/sula-dropdown/sula-dropdown.js +4 -4
- package/dist/collection/components/sula-icon/sula-icon.css +1 -1
- package/dist/collection/components/sula-icon/sula-icon.js +1 -1
- package/dist/collection/components/sula-loader/sula-loader.css +1 -1
- package/dist/collection/components/sula-loader/sula-loader.js +1 -1
- package/dist/collection/components/sula-menu-select-list/sula-menu-select-list.js +1 -1
- package/dist/collection/components/sula-progress-bar/model/sula-progress-bar.model.js +15 -0
- package/dist/collection/components/sula-progress-bar/model/sula-progress-bar.model.js.map +1 -0
- package/dist/collection/components/sula-progress-bar/sula-progress-bar.css +1 -0
- package/dist/collection/components/sula-progress-bar/sula-progress-bar.js +213 -0
- package/dist/collection/components/sula-progress-bar/sula-progress-bar.js.map +1 -0
- package/dist/collection/components/sula-progress-bar/sula-progress.stories.js +172 -0
- package/dist/collection/components/sula-progress-bar/sula-progress.stories.js.map +1 -0
- package/dist/collection/components/sula-radio-button/sula-radio-button.js +2 -2
- package/dist/collection/components/sula-search-bar/model/sula-search.bar-model.js +6 -0
- package/dist/collection/components/sula-search-bar/model/sula-search.bar-model.js.map +1 -0
- package/dist/collection/components/sula-search-bar/sula-search-bar.css +1 -0
- package/dist/collection/components/sula-search-bar/sula-search-bar.js +240 -0
- package/dist/collection/components/sula-search-bar/sula-search-bar.js.map +1 -0
- package/dist/collection/components/sula-search-bar/sula-search-bar.stories.js +119 -0
- package/dist/collection/components/sula-search-bar/sula-search-bar.stories.js.map +1 -0
- package/dist/collection/components/sula-switch/sula-switch.js +4 -4
- package/dist/collection/components/sula-tag/sula-tag.js +3 -3
- package/dist/collection/components/sula-textarea/sula-textarea.js +6 -6
- package/dist/collection/components/sula-textfield/sula-textfield.js +2 -2
- package/dist/collection/components/sula-tiles/sula-tiles.js +1 -1
- package/dist/collection/components/sula-timeline-list/sula-timeline-list.js +1 -1
- package/dist/components/{p-CYhL1fU6.js → p-5IbiLIg7.js} +4 -4
- package/dist/components/{p-CYhL1fU6.js.map → p-5IbiLIg7.js.map} +1 -1
- package/dist/components/{p-CjYWDIHR.js → p-BNtk_d_S.js} +3 -3
- package/dist/components/{p-CjYWDIHR.js.map → p-BNtk_d_S.js.map} +1 -1
- package/dist/components/p-D4nvaSNA.js +27129 -0
- package/dist/components/p-D4nvaSNA.js.map +1 -0
- package/dist/components/sula-avatar.js +1 -1
- package/dist/components/sula-badge.js +1 -1
- package/dist/components/sula-button.js +44 -10
- package/dist/components/sula-button.js.map +1 -1
- package/dist/components/sula-checkbox.js +4 -4
- package/dist/components/sula-chip.js +5 -5
- package/dist/components/sula-dropdown.js +6 -6
- package/dist/components/sula-icon.js +1 -1
- package/dist/components/sula-loader.js +1 -27124
- package/dist/components/sula-loader.js.map +1 -1
- package/dist/components/sula-menu-select-list.js +1 -1
- package/dist/components/sula-progress-bar.d.ts +11 -0
- package/dist/components/sula-progress-bar.js +122 -0
- package/dist/components/sula-progress-bar.js.map +1 -0
- package/dist/components/sula-radio-button.js +2 -2
- package/dist/components/sula-search-bar.d.ts +11 -0
- package/dist/components/sula-search-bar.js +104 -0
- package/dist/components/sula-search-bar.js.map +1 -0
- package/dist/components/sula-switch.js +4 -4
- package/dist/components/sula-tag.js +4 -4
- package/dist/components/sula-textarea.js +6 -6
- package/dist/components/sula-textfield.js +3 -3
- package/dist/components/sula-tiles.js +2 -2
- package/dist/components/sula-timeline-list.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{sula-avatar_16.entry.js → sula-avatar_18.entry.js} +223 -51
- package/dist/esm/sula-avatar_18.entry.js.map +1 -0
- package/dist/esm/webcomponents.js +1 -1
- package/dist/types/components/sula-button/sula-button.d.ts +15 -1
- package/dist/types/components/sula-button/sula-button.stories.d.ts +137 -33
- package/dist/types/components/sula-progress-bar/model/sula-progress-bar.model.d.ts +12 -0
- package/dist/types/components/sula-progress-bar/sula-progress-bar.d.ts +33 -0
- package/dist/types/components/sula-progress-bar/sula-progress.stories.d.ts +84 -0
- package/dist/types/components/sula-search-bar/model/sula-search.bar-model.d.ts +4 -0
- package/dist/types/components/sula-search-bar/sula-search-bar.d.ts +50 -0
- package/dist/types/components/sula-search-bar/sula-search-bar.stories.d.ts +84 -0
- package/dist/types/components.d.ts +186 -0
- package/dist/webcomponents/{p-51f9d6a5.entry.js → p-da741505.entry.js} +2792 -2538
- package/dist/webcomponents/p-da741505.entry.js.map +1 -0
- package/dist/webcomponents/webcomponents.esm.js +34 -14
- package/package.json +1 -1
- package/readme.md +79 -19
- package/dist/cjs/sula-avatar.sula-badge.sula-button.sula-checkbox.sula-chip.sula-dropdown.sula-icon.sula-loader.sula-menu-select-list.sula-radio-button.sula-switch.sula-tag.sula-textarea.sula-textfield.sula-tiles.sula-timeline-list.entry.cjs.js.map +0 -1
- package/dist/cjs/sula-avatar_16.cjs.entry.js.map +0 -1
- package/dist/esm/sula-avatar.sula-badge.sula-button.sula-checkbox.sula-chip.sula-dropdown.sula-icon.sula-loader.sula-menu-select-list.sula-radio-button.sula-switch.sula-tag.sula-textarea.sula-textfield.sula-tiles.sula-timeline-list.entry.js.map +0 -1
- package/dist/esm/sula-avatar_16.entry.js.map +0 -1
- package/dist/webcomponents/p-51f9d6a5.entry.js.map +0 -1
- package/dist/webcomponents/sula-avatar.sula-badge.sula-button.sula-checkbox.sula-chip.sula-dropdown.sula-icon.sula-loader.sula-menu-select-list.sula-radio-button.sula-switch.sula-tag.sula-textarea.sula-textfield.sula-tiles.sula-timeline-list.entry.esm.js.map +0 -1
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
import { SulaSearchBarStyle } from "./model/sula-search.bar-model";
|
|
3
|
+
export class SulaSearchBar {
|
|
4
|
+
constructor() {
|
|
5
|
+
/**
|
|
6
|
+
* Search bar style
|
|
7
|
+
*/
|
|
8
|
+
this.searchBarStyle = SulaSearchBarStyle.Default;
|
|
9
|
+
this.isFocused = false;
|
|
10
|
+
this.textValue = '';
|
|
11
|
+
this.handleInputFocus = () => {
|
|
12
|
+
this.isFocused = true;
|
|
13
|
+
this.inputElement.focus();
|
|
14
|
+
this.focusedOn.emit();
|
|
15
|
+
};
|
|
16
|
+
this.handleInputBlur = () => {
|
|
17
|
+
this.isFocused = false;
|
|
18
|
+
this.inputElement.blur();
|
|
19
|
+
this.focusedOut.emit();
|
|
20
|
+
};
|
|
21
|
+
this.handleRightIconClick = (event) => {
|
|
22
|
+
this.rightIconClicked.emit();
|
|
23
|
+
event.stopPropagation();
|
|
24
|
+
event.preventDefault();
|
|
25
|
+
};
|
|
26
|
+
this.handleValueChanges = (event) => {
|
|
27
|
+
const newValue = event.target.value;
|
|
28
|
+
this.textValue = newValue;
|
|
29
|
+
this.value = newValue;
|
|
30
|
+
this.valueChanged.emit(newValue);
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
componentWillLoad() {
|
|
34
|
+
if (this.value && this.value.trim().length > 0) {
|
|
35
|
+
this.textValue = this.value;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
getStyleClass() {
|
|
39
|
+
const style = {
|
|
40
|
+
[SulaSearchBarStyle.Default]: 'bg-surface-on-body hover:bg-states-empty-bg-hover',
|
|
41
|
+
[SulaSearchBarStyle.Highlight]: 'bg-surface-body search-bar-shadow border border-surface-on-body',
|
|
42
|
+
};
|
|
43
|
+
return style[this.searchBarStyle];
|
|
44
|
+
}
|
|
45
|
+
render() {
|
|
46
|
+
return (h(Host, { key: 'd4d90e7c772577043a926f5c4da9940cb5540fb9' }, h("div", { key: '9d99122174667fca977c37e3cd707571f2fb5d54', class: {
|
|
47
|
+
'flex flex-row items-center space-x-12 px-16 rounded-xxl h-44 caret-brand-primary outline-none group': true,
|
|
48
|
+
[this.getStyleClass()]: true,
|
|
49
|
+
'search-bar-focus': this.isFocused,
|
|
50
|
+
}, tabIndex: 0, onFocus: this.handleInputFocus, onClick: this.handleInputFocus }, !this.isFocused && this.leftIcon && (h("div", { key: 'c95b9cdde31fcae4c990a9b1fd31e26354925903', class: "flex justify-center items-center leading-6" }, h("sula-icon", { key: '7c8087041097973cbef0a2b694c80e17545b1667', icon: this.leftIcon, customClass: "text-2xl text-icon-primary group-hover:text-brand-primary" }))), h("input", { key: 'a637dbc3e075bd9262140adf932ec828b5c2c4eb', ref: node => (this.inputElement = node), type: "text", class: "outline-none border-none w-full bg-transparent text-text-primary", placeholder: this.placeholder, onBlur: this.handleInputBlur, value: this.textValue, onInput: this.handleValueChanges }), this.rightIcon && (h("div", { key: '76c21444a58564a0fdcb741f38623005d2c445b5', class: "flex justify-center items-center leading-6 cursor-pointer", onClick: this.handleRightIconClick, onMouseDown: e => e.preventDefault() }, h("sula-icon", { key: '9e10c4ead0b0563277e0ddf0e0cf6e9ee79171f8', icon: this.rightIcon, customClass: "text-2xl text-icon-primary" }))))));
|
|
51
|
+
}
|
|
52
|
+
static get is() { return "sula-search-bar"; }
|
|
53
|
+
static get encapsulation() { return "shadow"; }
|
|
54
|
+
static get originalStyleUrls() {
|
|
55
|
+
return {
|
|
56
|
+
"$": ["sula-search-bar.scss"]
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
static get styleUrls() {
|
|
60
|
+
return {
|
|
61
|
+
"$": ["sula-search-bar.css"]
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
static get properties() {
|
|
65
|
+
return {
|
|
66
|
+
"value": {
|
|
67
|
+
"type": "string",
|
|
68
|
+
"attribute": "value",
|
|
69
|
+
"mutable": true,
|
|
70
|
+
"complexType": {
|
|
71
|
+
"original": "string",
|
|
72
|
+
"resolved": "string",
|
|
73
|
+
"references": {}
|
|
74
|
+
},
|
|
75
|
+
"required": false,
|
|
76
|
+
"optional": true,
|
|
77
|
+
"docs": {
|
|
78
|
+
"tags": [],
|
|
79
|
+
"text": "Value for the search bar."
|
|
80
|
+
},
|
|
81
|
+
"getter": false,
|
|
82
|
+
"setter": false,
|
|
83
|
+
"reflect": false
|
|
84
|
+
},
|
|
85
|
+
"searchBarStyle": {
|
|
86
|
+
"type": "string",
|
|
87
|
+
"attribute": "search-bar-style",
|
|
88
|
+
"mutable": true,
|
|
89
|
+
"complexType": {
|
|
90
|
+
"original": "SulaSearchBarStyle",
|
|
91
|
+
"resolved": "SulaSearchBarStyle.Default | SulaSearchBarStyle.Highlight",
|
|
92
|
+
"references": {
|
|
93
|
+
"SulaSearchBarStyle": {
|
|
94
|
+
"location": "import",
|
|
95
|
+
"path": "./model/sula-search.bar-model",
|
|
96
|
+
"id": "src/components/sula-search-bar/model/sula-search.bar-model.ts::SulaSearchBarStyle"
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"required": false,
|
|
101
|
+
"optional": false,
|
|
102
|
+
"docs": {
|
|
103
|
+
"tags": [],
|
|
104
|
+
"text": "Search bar style"
|
|
105
|
+
},
|
|
106
|
+
"getter": false,
|
|
107
|
+
"setter": false,
|
|
108
|
+
"reflect": false,
|
|
109
|
+
"defaultValue": "SulaSearchBarStyle.Default"
|
|
110
|
+
},
|
|
111
|
+
"placeholder": {
|
|
112
|
+
"type": "string",
|
|
113
|
+
"attribute": "placeholder",
|
|
114
|
+
"mutable": true,
|
|
115
|
+
"complexType": {
|
|
116
|
+
"original": "string",
|
|
117
|
+
"resolved": "string",
|
|
118
|
+
"references": {}
|
|
119
|
+
},
|
|
120
|
+
"required": false,
|
|
121
|
+
"optional": false,
|
|
122
|
+
"docs": {
|
|
123
|
+
"tags": [],
|
|
124
|
+
"text": "Search bar placeholder"
|
|
125
|
+
},
|
|
126
|
+
"getter": false,
|
|
127
|
+
"setter": false,
|
|
128
|
+
"reflect": false
|
|
129
|
+
},
|
|
130
|
+
"leftIcon": {
|
|
131
|
+
"type": "string",
|
|
132
|
+
"attribute": "left-icon",
|
|
133
|
+
"mutable": true,
|
|
134
|
+
"complexType": {
|
|
135
|
+
"original": "string",
|
|
136
|
+
"resolved": "string",
|
|
137
|
+
"references": {}
|
|
138
|
+
},
|
|
139
|
+
"required": false,
|
|
140
|
+
"optional": false,
|
|
141
|
+
"docs": {
|
|
142
|
+
"tags": [],
|
|
143
|
+
"text": "Search bar left icon"
|
|
144
|
+
},
|
|
145
|
+
"getter": false,
|
|
146
|
+
"setter": false,
|
|
147
|
+
"reflect": false
|
|
148
|
+
},
|
|
149
|
+
"rightIcon": {
|
|
150
|
+
"type": "string",
|
|
151
|
+
"attribute": "right-icon",
|
|
152
|
+
"mutable": true,
|
|
153
|
+
"complexType": {
|
|
154
|
+
"original": "string",
|
|
155
|
+
"resolved": "string",
|
|
156
|
+
"references": {}
|
|
157
|
+
},
|
|
158
|
+
"required": false,
|
|
159
|
+
"optional": false,
|
|
160
|
+
"docs": {
|
|
161
|
+
"tags": [],
|
|
162
|
+
"text": "Search bar right icon"
|
|
163
|
+
},
|
|
164
|
+
"getter": false,
|
|
165
|
+
"setter": false,
|
|
166
|
+
"reflect": false
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
static get states() {
|
|
171
|
+
return {
|
|
172
|
+
"isFocused": {},
|
|
173
|
+
"textValue": {}
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
static get events() {
|
|
177
|
+
return [{
|
|
178
|
+
"method": "valueChanged",
|
|
179
|
+
"name": "valueChanged",
|
|
180
|
+
"bubbles": true,
|
|
181
|
+
"cancelable": true,
|
|
182
|
+
"composed": true,
|
|
183
|
+
"docs": {
|
|
184
|
+
"tags": [],
|
|
185
|
+
"text": "Event emitted when search bar value changes."
|
|
186
|
+
},
|
|
187
|
+
"complexType": {
|
|
188
|
+
"original": "string",
|
|
189
|
+
"resolved": "string",
|
|
190
|
+
"references": {}
|
|
191
|
+
}
|
|
192
|
+
}, {
|
|
193
|
+
"method": "focusedOn",
|
|
194
|
+
"name": "focusedOn",
|
|
195
|
+
"bubbles": true,
|
|
196
|
+
"cancelable": true,
|
|
197
|
+
"composed": true,
|
|
198
|
+
"docs": {
|
|
199
|
+
"tags": [],
|
|
200
|
+
"text": "Event emitted when search bar is focused."
|
|
201
|
+
},
|
|
202
|
+
"complexType": {
|
|
203
|
+
"original": "void",
|
|
204
|
+
"resolved": "void",
|
|
205
|
+
"references": {}
|
|
206
|
+
}
|
|
207
|
+
}, {
|
|
208
|
+
"method": "focusedOut",
|
|
209
|
+
"name": "focusedOut",
|
|
210
|
+
"bubbles": true,
|
|
211
|
+
"cancelable": true,
|
|
212
|
+
"composed": true,
|
|
213
|
+
"docs": {
|
|
214
|
+
"tags": [],
|
|
215
|
+
"text": "Event emitted when search bar is focused out."
|
|
216
|
+
},
|
|
217
|
+
"complexType": {
|
|
218
|
+
"original": "void",
|
|
219
|
+
"resolved": "void",
|
|
220
|
+
"references": {}
|
|
221
|
+
}
|
|
222
|
+
}, {
|
|
223
|
+
"method": "rightIconClicked",
|
|
224
|
+
"name": "rightIconClicked",
|
|
225
|
+
"bubbles": true,
|
|
226
|
+
"cancelable": true,
|
|
227
|
+
"composed": true,
|
|
228
|
+
"docs": {
|
|
229
|
+
"tags": [],
|
|
230
|
+
"text": "Event emitted when right icon is clicked"
|
|
231
|
+
},
|
|
232
|
+
"complexType": {
|
|
233
|
+
"original": "void",
|
|
234
|
+
"resolved": "void",
|
|
235
|
+
"references": {}
|
|
236
|
+
}
|
|
237
|
+
}];
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
//# sourceMappingURL=sula-search-bar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sula-search-bar.js","sourceRoot":"","sources":["../../../src/components/sula-search-bar/sula-search-bar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAOnE,MAAM,OAAO,aAAa;IAL1B;QAYE;;WAEG;QAEH,mBAAc,GAAuB,kBAAkB,CAAC,OAAO,CAAC;QA6ChE,cAAS,GAAG,KAAK,CAAC;QAGlB,cAAS,GAAW,EAAE,CAAC;QAmBvB,qBAAgB,GAAG,GAAG,EAAE;YACtB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;YACtB,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;YAC1B,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;QACxB,CAAC,CAAC;QAEF,oBAAe,GAAG,GAAG,EAAE;YACrB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;YACvB,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;YACzB,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;QACzB,CAAC,CAAC;QAEF,yBAAoB,GAAG,CAAC,KAAiB,EAAE,EAAE;YAC3C,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC;YAE7B,KAAK,CAAC,eAAe,EAAE,CAAC;YACxB,KAAK,CAAC,cAAc,EAAE,CAAC;QACzB,CAAC,CAAC;QAEF,uBAAkB,GAAG,CAAC,KAAiB,EAAE,EAAE;YACzC,MAAM,QAAQ,GAAI,K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ACX,KAAK,EAAC,kEAAkE,EACxE,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,MAAM,EAAE,IAAI,CAAC,eAAe,EAC5B,KAAK,EAAE,IAAI,CAAC,SAAS,EACrB,OAAO,EAAE,IAAI,CAAC,kBAAkB,GAChC;gBAED,IAAI,CAAC,SAAS,IAAI,CACjB,4DAAK,KAAK,EAAC,2DAA2D,EAAC,OAAO,EAAE,IAAI,CAAC,oBAAoB,EAAE,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,cAAc,EAAE;oBAC7I,kEAAW,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,WAAW,EAAC,4BAA4B,GAAa,CAClF,CACP,CACG,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Event, EventEmitter, Host, Prop, State, h } from '@stencil/core';\nimport { SulaSearchBarStyle } from './model/sula-search.bar-model';\n\n@Component({\n tag: 'sula-search-bar',\n styleUrl: 'sula-search-bar.scss',\n shadow: true,\n})\nexport class SulaSearchBar {\n /**\n * Value for the search bar.\n */\n @Prop({ mutable: true })\n value?: string;\n\n /**\n * Search bar style\n */\n @Prop({ mutable: true })\n searchBarStyle: SulaSearchBarStyle = SulaSearchBarStyle.Default;\n\n /**\n * Search bar placeholder\n */\n @Prop({ mutable: true })\n placeholder: string;\n\n /**\n * Search bar left icon\n */\n @Prop({ mutable: true })\n leftIcon: string;\n\n /**\n * Search bar right icon\n */\n @Prop({ mutable: true })\n rightIcon: string;\n\n /**\n * Event emitted when search bar value changes.\n */\n @Event()\n valueChanged: EventEmitter<string>;\n\n /**\n * Event emitted when search bar is focused.\n */\n @Event()\n focusedOn: EventEmitter<void>;\n\n /**\n * Event emitted when search bar is focused out.\n */\n @Event()\n focusedOut: EventEmitter<void>;\n\n /**\n * Event emitted when right icon is clicked\n */\n @Event()\n rightIconClicked: EventEmitter<void>;\n\n @State()\n isFocused = false;\n\n @State()\n textValue: string = '';\n\n inputElement: HTMLInputElement;\n\n componentWillLoad() {\n if (this.value && this.value.trim().length > 0) {\n this.textValue = this.value;\n }\n }\n\n getStyleClass() {\n const style = {\n [SulaSearchBarStyle.Default]: 'bg-surface-on-body hover:bg-states-empty-bg-hover',\n [SulaSearchBarStyle.Highlight]: 'bg-surface-body search-bar-shadow border border-surface-on-body',\n };\n\n return style[this.searchBarStyle];\n }\n\n handleInputFocus = () => {\n this.isFocused = true;\n this.inputElement.focus();\n this.focusedOn.emit();\n };\n\n handleInputBlur = () => {\n this.isFocused = false;\n this.inputElement.blur();\n this.focusedOut.emit();\n };\n\n handleRightIconClick = (event: MouseEvent) => {\n this.rightIconClicked.emit();\n\n event.stopPropagation();\n event.preventDefault();\n };\n\n handleValueChanges = (event: InputEvent) => {\n const newValue = (event.target as HTMLTextAreaElement).value;\n this.textValue = newValue;\n this.value = newValue;\n\n this.valueChanged.emit(newValue);\n };\n\n render() {\n return (\n <Host>\n <div\n class={{\n 'flex flex-row items-center space-x-12 px-16 rounded-xxl h-44 caret-brand-primary outline-none group': true,\n [this.getStyleClass()]: true,\n 'search-bar-focus': this.isFocused,\n }}\n tabIndex={0}\n onFocus={this.handleInputFocus}\n onClick={this.handleInputFocus}\n >\n {!this.isFocused && this.leftIcon && (\n <div class=\"flex justify-center items-center leading-6\">\n <sula-icon icon={this.leftIcon} customClass=\"text-2xl text-icon-primary group-hover:text-brand-primary\"></sula-icon>\n </div>\n )}\n\n <input\n ref={node => (this.inputElement = node)}\n type=\"text\"\n class=\"outline-none border-none w-full bg-transparent text-text-primary\"\n placeholder={this.placeholder}\n onBlur={this.handleInputBlur}\n value={this.textValue}\n onInput={this.handleValueChanges}\n />\n\n {this.rightIcon && (\n <div class=\"flex justify-center items-center leading-6 cursor-pointer\" onClick={this.handleRightIconClick} onMouseDown={e => e.preventDefault()}>\n <sula-icon icon={this.rightIcon} customClass=\"text-2xl text-icon-primary\"></sula-icon>\n </div>\n )}\n </div>\n </Host>\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { SulaSearchBarStyle } from "./model/sula-search.bar-model";
|
|
2
|
+
export default {
|
|
3
|
+
title: 'Components/sula-search-bar',
|
|
4
|
+
tags: ['autodocs'],
|
|
5
|
+
argTypes: {
|
|
6
|
+
value: {
|
|
7
|
+
control: 'text',
|
|
8
|
+
defaultValue: '',
|
|
9
|
+
description: 'Value for the search bar',
|
|
10
|
+
type: {
|
|
11
|
+
required: false,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
searchBarStyle: {
|
|
15
|
+
control: { type: 'select' },
|
|
16
|
+
options: Object.values(SulaSearchBarStyle),
|
|
17
|
+
defaultValue: SulaSearchBarStyle.Default,
|
|
18
|
+
description: 'The search bar style',
|
|
19
|
+
type: {
|
|
20
|
+
required: false,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
placeholder: {
|
|
24
|
+
control: 'text',
|
|
25
|
+
defaultValue: 'Pesquisar...',
|
|
26
|
+
description: 'The search bar placeholder',
|
|
27
|
+
type: {
|
|
28
|
+
required: false,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
leftIcon: {
|
|
32
|
+
control: 'text',
|
|
33
|
+
defaultValue: 'ph ph-magnifying-glass',
|
|
34
|
+
description: 'The search bar left icon',
|
|
35
|
+
type: {
|
|
36
|
+
required: false,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
rightIcon: {
|
|
40
|
+
control: 'text',
|
|
41
|
+
defaultValue: 'ph ph-x',
|
|
42
|
+
description: 'The search bar right icon',
|
|
43
|
+
type: {
|
|
44
|
+
required: false,
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
valueChanged: {
|
|
48
|
+
action: 'valueChanged',
|
|
49
|
+
description: 'Evento emitido quando o valor da busca muda',
|
|
50
|
+
},
|
|
51
|
+
focusedOn: {
|
|
52
|
+
action: 'focusedOn',
|
|
53
|
+
description: 'Evento emitido quando a barra de busca recebe foco',
|
|
54
|
+
},
|
|
55
|
+
focusedOut: {
|
|
56
|
+
action: 'focusedOut',
|
|
57
|
+
description: 'Evento emitido quando a barra de busca perde foco',
|
|
58
|
+
},
|
|
59
|
+
rightIconClicked: {
|
|
60
|
+
action: 'rightIconClicked',
|
|
61
|
+
description: 'Evento emitido quando o ícone da direita é clicado',
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
parameters: {
|
|
65
|
+
docs: {
|
|
66
|
+
description: {
|
|
67
|
+
component: 'O componente Search Bar do Sula Design System é utilizado para implementar funcionalidades de busca em aplicações. Suporta diferentes estilos, ícones personalizáveis e eventos para interação completa.',
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
const Template = args => {
|
|
73
|
+
const container = document.createElement('div');
|
|
74
|
+
container.style.maxWidth = '400px';
|
|
75
|
+
container.style.margin = '20px';
|
|
76
|
+
const el = document.createElement('sula-search-bar');
|
|
77
|
+
if (args.value)
|
|
78
|
+
el.setAttribute('value', args.value);
|
|
79
|
+
el.setAttribute('search-bar-style', args.searchBarStyle);
|
|
80
|
+
if (args.placeholder)
|
|
81
|
+
el.setAttribute('placeholder', args.placeholder);
|
|
82
|
+
if (args.leftIcon)
|
|
83
|
+
el.setAttribute('left-icon', args.leftIcon);
|
|
84
|
+
if (args.rightIcon)
|
|
85
|
+
el.setAttribute('right-icon', args.rightIcon);
|
|
86
|
+
el.addEventListener('valueChanged', args.valueChanged);
|
|
87
|
+
el.addEventListener('focusedOn', args.focusedOn);
|
|
88
|
+
el.addEventListener('focusedOut', args.focusedOut);
|
|
89
|
+
el.addEventListener('rightIconClicked', args.rightIconClicked);
|
|
90
|
+
container.appendChild(el);
|
|
91
|
+
return container;
|
|
92
|
+
};
|
|
93
|
+
export const Default = Template.bind({});
|
|
94
|
+
Default.args = {
|
|
95
|
+
value: '',
|
|
96
|
+
searchBarStyle: SulaSearchBarStyle.Default,
|
|
97
|
+
placeholder: 'Pesquisar...',
|
|
98
|
+
leftIcon: 'ph ph-magnifying-glass',
|
|
99
|
+
rightIcon: '',
|
|
100
|
+
};
|
|
101
|
+
export const WithValue = Template.bind({});
|
|
102
|
+
WithValue.args = Object.assign(Object.assign({}, Default.args), { value: 'Texto de busca' });
|
|
103
|
+
export const WithRightIcon = Template.bind({});
|
|
104
|
+
WithRightIcon.args = Object.assign(Object.assign({}, Default.args), { rightIcon: 'ph ph-x' });
|
|
105
|
+
export const HighlightStyle = Template.bind({});
|
|
106
|
+
HighlightStyle.args = Object.assign(Object.assign({}, Default.args), { searchBarStyle: SulaSearchBarStyle.Highlight });
|
|
107
|
+
export const WithoutLeftIcon = Template.bind({});
|
|
108
|
+
WithoutLeftIcon.args = Object.assign(Object.assign({}, Default.args), { leftIcon: '', placeholder: 'Busca sem ícone esquerdo' });
|
|
109
|
+
export const WithBothIcons = Template.bind({});
|
|
110
|
+
WithBothIcons.args = Object.assign(Object.assign({}, Default.args), { leftIcon: 'ph ph-magnifying-glass', rightIcon: 'ph ph-x', placeholder: 'Busca com ambos ícones' });
|
|
111
|
+
export const CustomPlaceholder = Template.bind({});
|
|
112
|
+
CustomPlaceholder.args = Object.assign(Object.assign({}, Default.args), { placeholder: 'Digite para buscar produtos...' });
|
|
113
|
+
export const HighlightWithIcons = Template.bind({});
|
|
114
|
+
HighlightWithIcons.args = Object.assign(Object.assign({}, Default.args), { searchBarStyle: SulaSearchBarStyle.Highlight, leftIcon: 'ph ph-magnifying-glass', rightIcon: 'ph ph-x' });
|
|
115
|
+
export const CustomIcons = Template.bind({});
|
|
116
|
+
CustomIcons.args = Object.assign(Object.assign({}, Default.args), { leftIcon: 'ph ph-funnel', rightIcon: 'ph ph-sliders', placeholder: 'Filtrar resultados...' });
|
|
117
|
+
export const WithValueAndRightIcon = Template.bind({});
|
|
118
|
+
WithValueAndRightIcon.args = Object.assign(Object.assign({}, Default.args), { value: 'Texto de busca', rightIcon: 'ph ph-x' });
|
|
119
|
+
//# sourceMappingURL=sula-search-bar.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sula-search-bar.stories.js","sourceRoot":"","sources":["../../../src/components/sula-search-bar/sula-search-bar.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,eAAe;IACb,KAAK,EAAE,4BAA4B;IACnC,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,QAAQ,EAAE;QACR,KAAK,EAAE;YACL,OAAO,EAAE,MAAM;YACf,YAAY,EAAE,EAAE;YAChB,WAAW,EAAE,0BAA0B;YACvC,IAAI,EAAE;gBACJ,QAAQ,EAAE,KAAK;aAChB;SACF;QACD,cAAc,EAAE;YACd,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC3B,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC;YAC1C,YAAY,EAAE,kBAAkB,CAAC,OAAO;YACxC,WAAW,EAAE,sBAAsB;YACnC,IAAI,EAAE;gBACJ,QAAQ,EAAE,KAAK;aAChB;SACF;QACD,WAAW,EAAE;YACX,OAAO,EAAE,MAAM;YACf,YAAY,EAAE,cAAc;YAC5B,WAAW,EAAE,4BAA4B;YACzC,IAAI,EAAE;gBACJ,QAAQ,EAAE,KAAK;aAChB;SACF;QACD,QAAQ,EAAE;YACR,OAAO,EAAE,MAAM;YACf,YAAY,EAAE,wBAAwB;YACtC,WAAW,EAAE,0BAA0B;YACvC,IAAI,EAAE;gBACJ,QAAQ,EAAE,KAAK;aAChB;SACF;QACD,SAAS,EAAE;YACT,OAAO,EAAE,MAAM;YACf,YAAY,EAAE,SAAS;YACvB,WAAW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port default {\n title: 'Components/sula-search-bar',\n tags: ['autodocs'],\n argTypes: {\n value: {\n control: 'text',\n defaultValue: '',\n description: 'Value for the search bar',\n type: {\n required: false,\n },\n },\n searchBarStyle: {\n control: { type: 'select' },\n options: Object.values(SulaSearchBarStyle),\n defaultValue: SulaSearchBarStyle.Default,\n description: 'The search bar style',\n type: {\n required: false,\n },\n },\n placeholder: {\n control: 'text',\n defaultValue: 'Pesquisar...',\n description: 'The search bar placeholder',\n type: {\n required: false,\n },\n },\n leftIcon: {\n control: 'text',\n defaultValue: 'ph ph-magnifying-glass',\n description: 'The search bar left icon',\n type: {\n required: false,\n },\n },\n rightIcon: {\n control: 'text',\n defaultValue: 'ph ph-x',\n description: 'The search bar right icon',\n type: {\n required: false,\n },\n },\n valueChanged: {\n action: 'valueChanged',\n description: 'Evento emitido quando o valor da busca muda',\n },\n focusedOn: {\n action: 'focusedOn',\n description: 'Evento emitido quando a barra de busca recebe foco',\n },\n focusedOut: {\n action: 'focusedOut',\n description: 'Evento emitido quando a barra de busca perde foco',\n },\n rightIconClicked: {\n action: 'rightIconClicked',\n description: 'Evento emitido quando o ícone da direita é clicado',\n },\n },\n parameters: {\n docs: {\n description: {\n component:\n 'O componente Search Bar do Sula Design System é utilizado para implementar funcionalidades de busca em aplicações. Suporta diferentes estilos, ícones personalizáveis e eventos para interação completa.',\n },\n },\n },\n};\n\nconst Template = args => {\n const container = document.createElement('div');\n container.style.maxWidth = '400px';\n container.style.margin = '20px';\n\n const el = document.createElement('sula-search-bar');\n\n if (args.value) el.setAttribute('value', args.value);\n el.setAttribute('search-bar-style', args.searchBarStyle);\n if (args.placeholder) el.setAttribute('placeholder', args.placeholder);\n if (args.leftIcon) el.setAttribute('left-icon', args.leftIcon);\n if (args.rightIcon) el.setAttribute('right-icon', args.rightIcon);\n\n el.addEventListener('valueChanged', args.valueChanged);\n el.addEventListener('focusedOn', args.focusedOn);\n el.addEventListener('focusedOut', args.focusedOut);\n el.addEventListener('rightIconClicked', args.rightIconClicked);\n\n container.appendChild(el);\n\n return container;\n};\n\nexport const Default = Template.bind({});\nDefault.args = {\n value: '',\n searchBarStyle: SulaSearchBarStyle.Default,\n placeholder: 'Pesquisar...',\n leftIcon: 'ph ph-magnifying-glass',\n rightIcon: '',\n};\n\nexport const WithValue = Template.bind({});\nWithValue.args = {\n ...Default.args,\n value: 'Texto de busca',\n};\n\nexport const WithRightIcon = Template.bind({});\nWithRightIcon.args = {\n ...Default.args,\n rightIcon: 'ph ph-x',\n};\n\nexport const HighlightStyle = Template.bind({});\nHighlightStyle.args = {\n ...Default.args,\n searchBarStyle: SulaSearchBarStyle.Highlight,\n};\n\nexport const WithoutLeftIcon = Template.bind({});\nWithoutLeftIcon.args = {\n ...Default.args,\n leftIcon: '',\n placeholder: 'Busca sem ícone esquerdo',\n};\n\nexport const WithBothIcons = Template.bind({});\nWithBothIcons.args = {\n ...Default.args,\n leftIcon: 'ph ph-magnifying-glass',\n rightIcon: 'ph ph-x',\n placeholder: 'Busca com ambos ícones',\n};\n\nexport const CustomPlaceholder = Template.bind({});\nCustomPlaceholder.args = {\n ...Default.args,\n placeholder: 'Digite para buscar produtos...',\n};\n\nexport const HighlightWithIcons = Template.bind({});\nHighlightWithIcons.args = {\n ...Default.args,\n searchBarStyle: SulaSearchBarStyle.Highlight,\n leftIcon: 'ph ph-magnifying-glass',\n rightIcon: 'ph ph-x',\n};\n\nexport const CustomIcons = Template.bind({});\nCustomIcons.args = {\n ...Default.args,\n leftIcon: 'ph ph-funnel',\n rightIcon: 'ph ph-sliders',\n placeholder: 'Filtrar resultados...',\n};\n\nexport const WithValueAndRightIcon = Template.bind({});\nWithValueAndRightIcon.args = {\n ...Default.args,\n value: 'Texto de busca',\n rightIcon: 'ph ph-x',\n};\n"]}
|
|
@@ -35,23 +35,23 @@ export class SulaSwitch {
|
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
render() {
|
|
38
|
-
return (h(Host, { key: '
|
|
38
|
+
return (h(Host, { key: 'e920dbb868a5bdde5e34ac4d015529aef08a8e3d' }, h("div", { key: '7552191cc1632d04c0c496f382fdbbb166547236', class: {
|
|
39
39
|
'outline-none': true,
|
|
40
40
|
'flex items-center space-x-12': !!this.label && this.type === SulaSwitchType.Default,
|
|
41
41
|
'flex items-center justify-between bg-surface-on-body rounded-md w-[280px] min-h-[85px] px-24 py-16': this.type === SulaSwitchType.List,
|
|
42
42
|
'hover:bg-states-empty-bg-hover active:bg-states-empty-bg-pressed cursor-pointer': this.type === SulaSwitchType.List && !this.disabled,
|
|
43
43
|
'container-focus': this.isFocus && this.type === SulaSwitchType.List,
|
|
44
|
-
}, onFocus: this.handleFocus, onBlur: this.handleBlur, onClick: this.handleClick, tabIndex: 0 }, this.type === SulaSwitchType.List && (h("div", { key: '
|
|
44
|
+
}, onFocus: this.handleFocus, onBlur: this.handleBlur, onClick: this.handleClick, tabIndex: 0 }, this.type === SulaSwitchType.List && (h("div", { key: '322c268b6e010f49cb1b61509398d9f7a1b9b8a1', class: "flex flex-col flex-1 mr-16 overflow-hidden" }, !!this.label && h("label", { key: '0da8b536c781a7d0fdfc1539b115c11171328455', class: "text-text-primary font-bold text-base cursor-pointer break-words" }, this.label), !!this.subTitle && h("span", { key: '8ff30bb13d52d759c6b2a2892ec608d14e9ece86', class: "text-text-secondary text-base break-words" }, this.subTitle))), h("div", { key: 'cec3a0d3f3620af6e25c2ae1e6ac771eb7acaef2', class: {
|
|
45
45
|
'switch-container w-56 h-32 flex items-center rounded-xxl p-2 outline-none': true,
|
|
46
46
|
'switch-on bg-brand-primary justify-end': this.active,
|
|
47
47
|
'switch-off bg-neutral-neutral-3 justify-start': !this.active,
|
|
48
48
|
'cursor-not-allowed bg-states-bg-disabled': this.disabled,
|
|
49
49
|
'switch-focus': this.isFocus && this.type === SulaSwitchType.Default,
|
|
50
|
-
}, tabIndex: 0, onFocus: this.handleFocus, onBlur: this.handleBlur }, h("div", { key: '
|
|
50
|
+
}, tabIndex: 0, onFocus: this.handleFocus, onBlur: this.handleBlur }, h("div", { key: 'ae01eb32010e93fbc3fb652c0fdd653df57b7835', class: {
|
|
51
51
|
'switch-thumb w-[28px] h-[28px] rounded-full flex justify-center items-center': true,
|
|
52
52
|
'bg-negative-negative-1': !this.disabled,
|
|
53
53
|
'bg-states-bg-disabled shadow-md': this.disabled,
|
|
54
|
-
} }, h("div", { key: '
|
|
54
|
+
} }, h("div", { key: 'f965f1fa8af298f87383c8549a82990a9daeafee', class: {
|
|
55
55
|
'switch-indicator rounded-full': true,
|
|
56
56
|
'switch-indicator-on w-12 h-12 bg-brand-primary': this.active,
|
|
57
57
|
'switch-indicator-off w-[10px] h-4 bg-neutral-neutral-4': !this.active,
|
|
@@ -72,14 +72,14 @@ export class SulaTag {
|
|
|
72
72
|
return iconStatusStyles[this.iconStatus];
|
|
73
73
|
}
|
|
74
74
|
render() {
|
|
75
|
-
return (h(Host, { key: '
|
|
75
|
+
return (h(Host, { key: 'ea42eeb4ee80620a790938eb08c6322fa4dee214' }, h("div", { key: '29745dd127c152c8e2e74534f8fa53cc8d305534', class: {
|
|
76
76
|
'flex items-center rounded-xxl w-fit': true,
|
|
77
77
|
[this.getSizeClass()]: true,
|
|
78
78
|
[this.getAppearanceClass()]: true,
|
|
79
|
-
} }, this.icon && (h("div", { key: '
|
|
79
|
+
} }, this.icon && (h("div", { key: '2eb1b3d506d98a12b5513c947237289fcacfe035', class: {
|
|
80
80
|
'flex justify-center items-center mr-8 rounded-full leading-4 px-2 py-1': true,
|
|
81
81
|
[this.getIconStatusClass()]: true,
|
|
82
|
-
} }, h("sula-icon", { key: '
|
|
82
|
+
} }, h("sula-icon", { key: 'b3daed5248632ce22ee43f9d64987939a3682242', icon: this.icon, "custom-class": "text-base text-negative-negative-1 leading-4" }))), h("span", { key: 'd436740cbce0feab73152447b7694818fe87f90e', class: {
|
|
83
83
|
'text-base leading-4': true,
|
|
84
84
|
[this.getTextColorClass()]: true,
|
|
85
85
|
[this.getTextWeightClass()]: true,
|
|
@@ -94,34 +94,34 @@ export class SulaTextarea {
|
|
|
94
94
|
}
|
|
95
95
|
render() {
|
|
96
96
|
const containerHeight = this.rows * 24 + 48;
|
|
97
|
-
return (h(Host, { key: '
|
|
97
|
+
return (h(Host, { key: 'ed754651792554736de45340f7a2eca30303517e', ref: node => (this.node = node) }, h("div", { key: '7c8422829a17136e4f98792da018fa4a4c531de4' }, h("div", { key: '16f16305b5b1a059e8d1e0b956eb78d2443bd9e0', id: "textarea-container", class: {
|
|
98
98
|
'relative border rounded-sm px-16 py-12 outline-none caret-brand-primary': true,
|
|
99
99
|
'textarea-focus': this.textareaIsFocused && !this.disabled && this.status === SulaTextareaStatus.Default,
|
|
100
100
|
'textarea-error': this.status === SulaTextareaStatus.Error && !this.disabled,
|
|
101
101
|
'bg-states-bg-disabled border-line-general cursor-not-allowed': this.disabled,
|
|
102
102
|
'bg-surface-body border-line-input cursor-text': !this.disabled,
|
|
103
|
-
}, style: { height: `${containerHeight}px` }, tabIndex: 0, onFocus: this.handleFocus, onClick: this.handleTextareaClick }, h("label", { key: '
|
|
103
|
+
}, style: { height: `${containerHeight}px` }, tabIndex: 0, onFocus: this.handleFocus, onClick: this.handleTextareaClick }, h("label", { key: 'ca41cf5b404b52684d6597a6976b86a596bb613f', class: {
|
|
104
104
|
'text-base top-16 left-12 absolute transition-all duration-200 ease-in-out pointer-events-none z-10 w-[85%]': true,
|
|
105
105
|
'text-text-primary': !this.disabled && (this.isActive || this.status === SulaTextareaStatus.Default),
|
|
106
106
|
'text-text-disabled': this.disabled,
|
|
107
107
|
'bg-surface-body': !this.disabled && this.isActive,
|
|
108
|
-
}, ref: node => (this.labelElement = node) }, this.label), h("label", { key: '
|
|
108
|
+
}, ref: node => (this.labelElement = node) }, this.label), h("label", { key: 'cfcb85fadb260a530be91f347c55e6f98ae3168b', class: {
|
|
109
109
|
'absolute font-bold transition-all duration-200 ease-in-out pointer-events-none z-10 active-label hidden from-down': true,
|
|
110
110
|
'text-sm top-12 left-16': this.isActive,
|
|
111
111
|
'text-text-primary': !this.disabled && (this.isActive || this.status === SulaTextareaStatus.Default),
|
|
112
112
|
'text-text-disabled': this.disabled,
|
|
113
113
|
'bg-surface-body': !this.disabled && this.isActive,
|
|
114
|
-
}, ref: node => (this.activeLabelElement = node) }, this.label), h("textarea", { key: '
|
|
114
|
+
}, ref: node => (this.activeLabelElement = node) }, this.label), h("textarea", { key: 'b020d47c6e676defc7af5703142bf28b27235b68', ref: node => (this.textareaElement = node), placeholder: this.isActive ? this.placeholder : '', rows: this.rows, maxLength: this.maxLength, disabled: this.disabled, class: {
|
|
115
115
|
'w-full h-full outline-none text-base bg-transparent border-none resize-none': true,
|
|
116
116
|
'pt-6': this.isActive,
|
|
117
117
|
'pt-0': !this.isActive,
|
|
118
118
|
'text-text-primary': !this.disabled,
|
|
119
119
|
'text-text-disabled cursor-not-allowed overflow-hidden': this.disabled,
|
|
120
|
-
}, onInput: this.handleTextareaChanges, onFocus: this.handleTextareaFocus, onBlur: this.handleBlur, value: this.textValue })), (this.helpText || this.maxLength) && (h("div", { key: '
|
|
120
|
+
}, onInput: this.handleTextareaChanges, onFocus: this.handleTextareaFocus, onBlur: this.handleBlur, value: this.textValue })), (this.helpText || this.maxLength) && (h("div", { key: '5772c4879f4a2e680423a025ddf371b0682fdbfc', class: "flex justify-between items-center px-16 mt-4 text-sm" }, this.helpText && (h("div", { key: 'f85f4b9195cf845d110a8f3a9b4a34e8cd522783', id: "textarea-help-text", class: {
|
|
121
121
|
'text-text-primary': this.status === SulaTextareaStatus.Default && !this.disabled,
|
|
122
122
|
'text-feedback-error': this.status === SulaTextareaStatus.Error && !this.disabled,
|
|
123
123
|
'text-text-disabled': this.disabled,
|
|
124
|
-
} }, this.helpText)), this.maxLength && (h("div", { key: '
|
|
124
|
+
} }, this.helpText)), this.maxLength && (h("div", { key: 'dffd4ae72ce81a460589f6cbb58f7615529547ea', id: "max-length-container", class: {
|
|
125
125
|
'text-text-primary': this.status === SulaTextareaStatus.Default && !this.disabled,
|
|
126
126
|
'text-feedback-error': this.status === SulaTextareaStatus.Error && !this.disabled,
|
|
127
127
|
'text-text-disabled': this.disabled,
|
|
@@ -97,14 +97,14 @@ export class SulaTextfield {
|
|
|
97
97
|
return this.icon;
|
|
98
98
|
}
|
|
99
99
|
render() {
|
|
100
|
-
return (h(Host, { key: '
|
|
100
|
+
return (h(Host, { key: '3805ff5fefc6ccc3b903384ac54bcf01ebd9527a', ref: node => (this.node = node) }, h("div", { key: 'e90a85b46e51d9c0c989bc4e0ff53b5996cc6c49' }, h("div", { key: '258fa53c0386cc3cc231a53d5d0e8da483cc51ce', id: "button-container", class: {
|
|
101
101
|
'flex items-center border rounded-sm px-16 outline-none h-[72px] caret-brand-primary': true,
|
|
102
102
|
'flex-row justify-between': !!this.icon || this.type === SulaTextfieldType.Password,
|
|
103
103
|
'button-focus': this.inputIsFocused && !this.disabled && this.status === SulaTextfieldStatus.Default,
|
|
104
104
|
'button-error': this.status === SulaTextfieldStatus.Error && !this.disabled,
|
|
105
105
|
'bg-states-bg-disabled border-line-general cursor-not-allowed': this.disabled,
|
|
106
106
|
'bg-surface-body border-line-input cursor-pointer': !this.disabled,
|
|
107
|
-
}, tabIndex: 0, onFocus: this.handleFocus, onClick: this.handleInputClick }, !this.disabled && (h("div", { key: '
|
|
107
|
+
}, tabIndex: 0, onFocus: this.handleFocus, onClick: this.handleInputClick }, !this.disabled && (h("div", { key: '0e16b2a5f2bd115b65a6d8e572bde900606fb97c', class: { 'hidden flex-col w-full': true, 'pr-12': !!this.icon }, ref: node => (this.inputContainer = node) }, h("label", { key: '1a487915bfd317c1f1b3c04917096f402e7cb7ba', class: "font-bold text-sm text-text-primary from-down" }, this.label), h("input", { key: 'b2cd0285ef6cdaa4956ac1e7dc7a9d2fb850ffed', type: this.type, ref: node => (this.inputElement = node), placeholder: this.placeholder, class: "outline-none text-base text-text-primary bg-transparent", onInput: this.handleInputChanges, onFocus: this.handleInputFocus, value: this.value }))), h("div", { key: 'c26f72728243abca768732d758f7a9992c32d146', id: "textfield-label", class: { 'text-base flex items-center': true, 'text-text-primary': !this.disabled, 'text-text-disabled': this.disabled }, ref: node => (this.labelElement = node) }, this.label), (!!this.icon || this.type === SulaTextfieldType.Password) && (h("div", { key: 'b1f375f8291a67455ae0e252321e4a0fa577bb64', class: "flex items-center justify-center", onClick: this.handleIconClick }, h("sula-icon", { key: 'a780572571be2d1b4e754ccb149b768bb9195800', icon: this.getInputIcon(), customClass: `text-2xl ${this.disabled ? 'text-icon-disabled' : 'text-icon-primary'}` })))), (this.helpText || this.maxLength) && !this.disabled && (h("div", { key: '6ac0ac18b014923a1b6a432e181beaea2f557dca', class: "flex justify-between items-center px-16 mt-4 text-sm" }, this.helpText && (h("div", { key: 'f8aa196b22755380105da258fa8e218ceb3894c0', id: "textfield-help-text", class: { 'text-text-primary': this.status === SulaTextfieldStatus.Default, 'text-feedback-error': this.status === SulaTextfieldStatus.Error } }, this.helpText)), this.maxLength && (h("div", { key: '9a9359a270f5f84175829e2e8347e992c89a2639', id: "max-length-container", class: { 'text-text-primary': this.status === SulaTextfieldStatus.Default, 'text-feedback-error': this.status === SulaTextfieldStatus.Error } }, this.textValue ? this.textValue.length : 0, "/", this.maxLength)))))));
|
|
108
108
|
}
|
|
109
109
|
static get is() { return "sula-textfield"; }
|
|
110
110
|
static get encapsulation() { return "shadow"; }
|
|
@@ -121,7 +121,7 @@ export class SulaTiles {
|
|
|
121
121
|
return (h("div", { class: this.getTextContainerClasses() }, h("span", { class: this.getTextClasses(true), title: this.ellipsis ? this.text : undefined }, this.text), this.hasSubText && (h("span", { class: this.getTextClasses(false), title: this.ellipsis ? this.subText : undefined }, this.subText))));
|
|
122
122
|
}
|
|
123
123
|
render() {
|
|
124
|
-
return (h(Host, { key: '
|
|
124
|
+
return (h(Host, { key: 'bd93893ff89e978258ceb3621a260b305de320f5' }, h("div", { key: '661f7050d9a816aa3437e2d1c0de179cfb9d605d', class: this.getContainerClasses(), tabIndex: this.getTabIndex(this.isSquare), onClick: this.handleClick }, this.renderIcon(), this.renderText())));
|
|
125
125
|
}
|
|
126
126
|
static get is() { return "sula-tiles"; }
|
|
127
127
|
static get encapsulation() { return "shadow"; }
|
|
@@ -37,7 +37,7 @@ export class SulaTimelineList {
|
|
|
37
37
|
return iconByStatus[status];
|
|
38
38
|
}
|
|
39
39
|
render() {
|
|
40
|
-
return (h(Host, { key: '
|
|
40
|
+
return (h(Host, { key: 'be18bb7bcb5cff8b45b1dc33fe9f4a14b6e21d5e' }, h("div", { key: '1a2bd5e50d78223c0ef3824beef028b0d6b8fa27', class: "flex flex-col bg-surface-on-body px-24 py-32 w-fit rounded-md" }, this.sulaTimelineList.map((item, index) => {
|
|
41
41
|
const isLastItem = index === this.sulaTimelineList.length - 1;
|
|
42
42
|
return (h("div", { class: {
|
|
43
43
|
'relative timeline-item': true,
|