@sula-tech/webcomponents 0.3.3 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{index-87eec792.js → index-BtkenDV1.js} +205 -156
- package/dist/cjs/index-BtkenDV1.js.map +1 -0
- package/dist/cjs/index.cjs.js +1 -0
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +4 -6
- package/dist/cjs/loader.cjs.js.map +1 -1
- package/dist/cjs/sula-avatar.sula-badge.sula-button.sula-checkbox.sula-chip.sula-icon.sula-loader.sula-menu-select-list.sula-radio-button.sula-switch.sula-tag.sula-textarea.sula-textfield.sula-tiles.entry.cjs.js.map +1 -0
- package/dist/cjs/sula-avatar_14.cjs.entry.js +28270 -0
- package/dist/cjs/sula-avatar_14.cjs.entry.js.map +1 -0
- package/dist/cjs/webcomponents.cjs.js +8 -8
- package/dist/cjs/webcomponents.cjs.js.map +1 -1
- package/dist/collection/assets/lottie/loader.json +1 -0
- package/dist/collection/collection-manifest.json +7 -2
- package/dist/collection/components/sula-avatar/sula-avatar.css +1 -1
- package/dist/collection/components/sula-avatar/sula-avatar.js +4 -4
- package/dist/collection/components/sula-avatar/sula-avatar.stories.js +7 -0
- package/dist/collection/components/sula-avatar/sula-avatar.stories.js.map +1 -1
- package/dist/collection/components/sula-badge/sula-badge.css +1 -1
- package/dist/collection/components/sula-badge/sula-badge.js +5 -5
- package/dist/collection/components/sula-badge/sula-badge.stories.js +7 -0
- package/dist/collection/components/sula-badge/sula-badge.stories.js.map +1 -1
- package/dist/collection/components/sula-button/sula-button.css +1 -1
- package/dist/collection/components/sula-button/sula-button.js +8 -8
- package/dist/collection/components/sula-button/sula-button.stories.js +7 -0
- package/dist/collection/components/sula-button/sula-button.stories.js.map +1 -1
- package/dist/collection/components/sula-checkbox/sula-checkbox.css +1 -1
- package/dist/collection/components/sula-checkbox/sula-checkbox.js +5 -5
- package/dist/collection/components/sula-checkbox/sula-checkbox.stories.js +7 -0
- package/dist/collection/components/sula-checkbox/sula-checkbox.stories.js.map +1 -1
- package/dist/collection/components/sula-chip/model/sula-chip.model.js +6 -0
- package/dist/collection/components/sula-chip/model/sula-chip.model.js.map +1 -0
- package/dist/collection/components/sula-chip/sula-chip.css +1 -0
- package/dist/collection/components/sula-chip/sula-chip.js +243 -0
- package/dist/collection/components/sula-chip/sula-chip.js.map +1 -0
- package/dist/collection/components/sula-chip/sula-chip.stories.js +125 -0
- package/dist/collection/components/sula-chip/sula-chip.stories.js.map +1 -0
- package/dist/collection/components/sula-icon/sula-icon.css +1 -1
- package/dist/collection/components/sula-icon/sula-icon.js +3 -3
- package/dist/collection/components/sula-loader/model/sula-loader.model.js +7 -0
- package/dist/collection/components/sula-loader/model/sula-loader.model.js.map +1 -0
- package/dist/collection/components/sula-loader/sula-loader.css +1 -0
- package/dist/collection/components/sula-loader/sula-loader.js +102 -0
- package/dist/collection/components/sula-loader/sula-loader.js.map +1 -0
- package/dist/collection/components/sula-loader/sula-loader.stories.js +48 -0
- package/dist/collection/components/sula-loader/sula-loader.stories.js.map +1 -0
- package/dist/collection/components/sula-loader/test/__mocks__/lottie-web.js +10 -0
- package/dist/collection/components/sula-loader/test/__mocks__/lottie-web.js.map +1 -0
- package/dist/collection/components/sula-menu-select-list/model/sula-menu-select-list.model.js +2 -0
- package/dist/collection/components/sula-menu-select-list/model/sula-menu-select-list.model.js.map +1 -0
- package/dist/collection/components/sula-menu-select-list/sula-menu-select-list.css +1 -0
- package/dist/collection/components/sula-menu-select-list/sula-menu-select-list.js +81 -0
- package/dist/collection/components/sula-menu-select-list/sula-menu-select-list.js.map +1 -0
- package/dist/collection/components/sula-menu-select-list/sula-menu-select-list.stories.js +91 -0
- package/dist/collection/components/sula-menu-select-list/sula-menu-select-list.stories.js.map +1 -0
- package/dist/collection/components/sula-radio-button/sula-radio-button.css +1 -0
- package/dist/collection/components/sula-radio-button/sula-radio-button.js +176 -0
- package/dist/collection/components/sula-radio-button/sula-radio-button.js.map +1 -0
- package/dist/collection/components/sula-radio-button/sula-radio-button.stories.js +123 -0
- package/dist/collection/components/sula-radio-button/sula-radio-button.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 +9 -9
- package/dist/collection/components/sula-switch/sula-switch.stories.js +7 -0
- package/dist/collection/components/sula-switch/sula-switch.stories.js.map +1 -1
- package/dist/collection/components/sula-tag/sula-tag.css +1 -1
- package/dist/collection/components/sula-tag/sula-tag.js +9 -9
- package/dist/collection/components/sula-tag/sula-tag.stories.js +7 -0
- package/dist/collection/components/sula-tag/sula-tag.stories.js.map +1 -1
- package/dist/collection/components/sula-textarea/sula-textarea.css +1 -1
- package/dist/collection/components/sula-textarea/sula-textarea.js +14 -14
- package/dist/collection/components/sula-textarea/sula-textarea.js.map +1 -1
- package/dist/collection/components/sula-textarea/sula-textarea.stories.js +7 -0
- package/dist/collection/components/sula-textarea/sula-textarea.stories.js.map +1 -1
- package/dist/collection/components/sula-textfield/sula-textfield.css +1 -1
- package/dist/collection/components/sula-textfield/sula-textfield.js +12 -12
- package/dist/collection/components/sula-textfield/sula-textfield.js.map +1 -1
- package/dist/collection/components/sula-textfield/sula-textfield.stories.js +7 -0
- package/dist/collection/components/sula-textfield/sula-textfield.stories.js.map +1 -1
- package/dist/collection/components/sula-tiles/model/sula-tiles.model.js +11 -0
- package/dist/collection/components/sula-tiles/model/sula-tiles.model.js.map +1 -0
- package/dist/collection/components/sula-tiles/sula-tiles.css +1 -0
- package/dist/collection/components/sula-tiles/sula-tiles.js +316 -0
- package/dist/collection/components/sula-tiles/sula-tiles.js.map +1 -0
- package/dist/collection/components/sula-tiles/sula-tiles.stories.js +420 -0
- package/dist/collection/components/sula-tiles/sula-tiles.stories.js.map +1 -0
- package/dist/components/index.js +1251 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/{p-b0d1214f.js → p-CEU3PNQs.js} +6 -6
- package/dist/components/p-CEU3PNQs.js.map +1 -0
- package/dist/components/p-DJGFqp8r.js +44 -0
- package/dist/components/p-DJGFqp8r.js.map +1 -0
- package/dist/components/sula-avatar.js +5 -5
- package/dist/components/sula-avatar.js.map +1 -1
- package/dist/components/sula-badge.js +5 -5
- package/dist/components/sula-badge.js.map +1 -1
- package/dist/components/sula-button.js +6 -6
- package/dist/components/sula-button.js.map +1 -1
- package/dist/components/sula-checkbox.js +8 -8
- package/dist/components/sula-checkbox.js.map +1 -1
- package/dist/components/sula-chip.d.ts +11 -0
- package/dist/components/sula-chip.js +136 -0
- package/dist/components/sula-chip.js.map +1 -0
- package/dist/components/sula-icon.js +2 -1
- package/dist/components/sula-loader.d.ts +11 -0
- package/dist/components/sula-loader.js +27132 -0
- package/dist/components/sula-loader.js.map +1 -0
- package/dist/components/sula-menu-select-list.d.ts +11 -0
- package/dist/components/sula-menu-select-list.js +9 -0
- package/dist/components/sula-menu-select-list.js.map +1 -0
- package/dist/components/sula-radio-button.d.ts +11 -0
- package/dist/components/sula-radio-button.js +83 -0
- package/dist/components/sula-radio-button.js.map +1 -0
- package/dist/components/sula-switch.js +11 -11
- package/dist/components/sula-switch.js.map +1 -1
- package/dist/components/sula-tag.js +8 -8
- package/dist/components/sula-tag.js.map +1 -1
- package/dist/components/sula-textarea.js +13 -13
- package/dist/components/sula-textarea.js.map +1 -1
- package/dist/components/sula-textfield.js +11 -11
- package/dist/components/sula-textfield.js.map +1 -1
- package/dist/components/sula-tiles.d.ts +11 -0
- package/dist/components/sula-tiles.js +180 -0
- package/dist/components/sula-tiles.js.map +1 -0
- package/dist/esm/{index-aa1c5f36.js → index-Yyeke16a.js} +203 -135
- package/dist/esm/index-Yyeke16a.js.map +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loader.js +4 -4
- package/dist/esm/loader.js.map +1 -1
- package/dist/esm/sula-avatar.sula-badge.sula-button.sula-checkbox.sula-chip.sula-icon.sula-loader.sula-menu-select-list.sula-radio-button.sula-switch.sula-tag.sula-textarea.sula-textfield.sula-tiles.entry.js.map +1 -0
- package/dist/esm/sula-avatar_14.entry.js +28255 -0
- package/dist/esm/sula-avatar_14.entry.js.map +1 -0
- package/dist/esm/webcomponents.js +6 -5
- package/dist/esm/webcomponents.js.map +1 -1
- package/dist/types/components/sula-avatar/sula-avatar.stories.d.ts +7 -0
- package/dist/types/components/sula-badge/sula-badge.stories.d.ts +7 -0
- package/dist/types/components/sula-button/sula-button.stories.d.ts +7 -0
- package/dist/types/components/sula-checkbox/sula-checkbox.stories.d.ts +7 -0
- package/dist/types/components/sula-chip/model/sula-chip.model.d.ts +4 -0
- package/dist/types/components/sula-chip/sula-chip.d.ts +40 -0
- package/dist/types/components/sula-chip/sula-chip.stories.d.ts +64 -0
- package/dist/types/components/sula-loader/model/sula-loader.model.d.ts +5 -0
- package/dist/types/components/sula-loader/sula-loader.d.ts +19 -0
- package/dist/types/components/sula-loader/sula-loader.stories.d.ts +29 -0
- package/dist/types/components/sula-loader/test/__mocks__/lottie-web.d.ts +4 -0
- package/dist/types/components/sula-menu-select-list/model/sula-menu-select-list.model.d.ts +4 -0
- package/dist/types/components/sula-menu-select-list/sula-menu-select-list.d.ts +14 -0
- package/dist/types/components/sula-menu-select-list/sula-menu-select-list.stories.d.ts +32 -0
- package/dist/types/components/sula-radio-button/sula-radio-button.d.ts +32 -0
- package/dist/types/components/sula-radio-button/sula-radio-button.stories.d.ts +57 -0
- package/dist/types/components/sula-switch/sula-switch.stories.d.ts +7 -0
- package/dist/types/components/sula-tag/sula-tag.stories.d.ts +7 -0
- package/dist/types/components/sula-textarea/sula-textarea.stories.d.ts +7 -0
- package/dist/types/components/sula-textfield/sula-textfield.stories.d.ts +7 -0
- package/dist/types/components/sula-tiles/model/sula-tiles.model.d.ts +8 -0
- package/dist/types/components/sula-tiles/sula-tiles.d.ts +54 -0
- package/dist/types/components/sula-tiles/sula-tiles.stories.d.ts +99 -0
- package/dist/types/components.d.ts +383 -0
- package/dist/types/stencil-public-runtime.d.ts +23 -1
- package/dist/webcomponents/assets/lottie/loader.json +1 -0
- package/dist/webcomponents/index.esm.js +1 -0
- package/dist/webcomponents/index.esm.js.map +1 -1
- package/dist/webcomponents/loader.esm.js.map +1 -0
- package/dist/webcomponents/p-67f9fa90.entry.js +21628 -0
- package/dist/webcomponents/p-67f9fa90.entry.js.map +1 -0
- package/dist/webcomponents/p-Yyeke16a.js +1469 -0
- package/dist/webcomponents/p-Yyeke16a.js.map +1 -0
- package/dist/webcomponents/sula-avatar.sula-badge.sula-button.sula-checkbox.sula-chip.sula-icon.sula-loader.sula-menu-select-list.sula-radio-button.sula-switch.sula-tag.sula-textarea.sula-textfield.sula-tiles.entry.esm.js.map +1 -0
- package/dist/webcomponents/webcomponents.esm.js +33 -9
- package/dist/webcomponents/webcomponents.esm.js.map +1 -1
- package/package.json +5 -2
- package/dist/cjs/app-globals-3a1e7e63.js +0 -7
- package/dist/cjs/app-globals-3a1e7e63.js.map +0 -1
- package/dist/cjs/index-87eec792.js.map +0 -1
- package/dist/cjs/sula-avatar_9.cjs.entry.js +0 -865
- package/dist/cjs/sula-avatar_9.cjs.entry.js.map +0 -1
- package/dist/components/p-881c6b35.js +0 -1198
- package/dist/components/p-881c6b35.js.map +0 -1
- package/dist/components/p-b0d1214f.js.map +0 -1
- package/dist/esm/app-globals-0f993ce5.js +0 -5
- package/dist/esm/app-globals-0f993ce5.js.map +0 -1
- package/dist/esm/index-aa1c5f36.js.map +0 -1
- package/dist/esm/sula-avatar_9.entry.js +0 -853
- package/dist/esm/sula-avatar_9.entry.js.map +0 -1
- package/dist/webcomponents/p-5a36af0f.js +0 -1492
- package/dist/webcomponents/p-5a36af0f.js.map +0 -1
- package/dist/webcomponents/p-7cde1edf.entry.js +0 -1123
- package/dist/webcomponents/p-7cde1edf.entry.js.map +0 -1
- package/dist/webcomponents/p-e1255160.js +0 -4
- package/dist/webcomponents/p-e1255160.js.map +0 -1
- package/loader/package.json +0 -11
|
@@ -45,7 +45,7 @@ export class SulaTextfield {
|
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
handleClick(event) {
|
|
48
|
-
if (!this.node)
|
|
48
|
+
if (!this.node || !this.inputIsFocused)
|
|
49
49
|
return;
|
|
50
50
|
const clickInside = this.node.contains(event.target);
|
|
51
51
|
if (!clickInside) {
|
|
@@ -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: '9c4193ba6e336add0d1c51605afd361af3066b71', ref: node => (this.node = node) }, h("div", { key: 'd54d4a4e3476dce6465152110926d911cd6fe76f' }, h("div", { key: 'ad310e6e6665b7b4dc86d063c6eb231b30da03d6', 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: '7c95cc92de32eb596c005d54244feb8a0431c024', class: { 'hidden flex-col w-full': true, 'pr-12': !!this.icon }, ref: node => (this.inputContainer = node) }, h("label", { key: '5368c5c52c308503ac6bf004fec6b61cff70e585', class: "font-bold text-sm text-text-primary from-down" }, this.label), h("input", { key: 'aecd88e5ab8c717ecc8b94e49f8f363b09be5da9', 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: '11db876fe9c49527ba3b25e57f23fbc2eb14fc0e', 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: '2f4200a031dbe7afa38b69873822f92a84bcf87b', class: "flex items-center justify-center", onClick: this.handleIconClick }, h("sula-icon", { key: 'd0d7d25d69685a37c46fb4139f5432efa415e7fa', icon: this.getInputIcon(), customClass: `text-2xl ${this.disabled ? 'text-icon-disabled' : 'text-icon-primary'}` })))), (this.helpText || this.maxLength) && !this.disabled && (h("div", { key: '20b99afe2b36b2ee1c5c3eca47cc928238d767ca', class: "flex justify-between items-center px-16 mt-4 text-sm" }, this.helpText && (h("div", { key: '70d9144ca98f4bd429ed02a9220130ef3e249c26', 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: '13218dba2cbd936c8b37d0b0bcd6633b07827746', 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"; }
|
|
@@ -122,6 +122,7 @@ export class SulaTextfield {
|
|
|
122
122
|
return {
|
|
123
123
|
"value": {
|
|
124
124
|
"type": "string",
|
|
125
|
+
"attribute": "value",
|
|
125
126
|
"mutable": true,
|
|
126
127
|
"complexType": {
|
|
127
128
|
"original": "string",
|
|
@@ -136,11 +137,11 @@ export class SulaTextfield {
|
|
|
136
137
|
},
|
|
137
138
|
"getter": false,
|
|
138
139
|
"setter": false,
|
|
139
|
-
"attribute": "value",
|
|
140
140
|
"reflect": false
|
|
141
141
|
},
|
|
142
142
|
"type": {
|
|
143
143
|
"type": "string",
|
|
144
|
+
"attribute": "type",
|
|
144
145
|
"mutable": false,
|
|
145
146
|
"complexType": {
|
|
146
147
|
"original": "SulaTextfieldType",
|
|
@@ -161,12 +162,12 @@ export class SulaTextfield {
|
|
|
161
162
|
},
|
|
162
163
|
"getter": false,
|
|
163
164
|
"setter": false,
|
|
164
|
-
"attribute": "type",
|
|
165
165
|
"reflect": false,
|
|
166
166
|
"defaultValue": "SulaTextfieldType.Text"
|
|
167
167
|
},
|
|
168
168
|
"status": {
|
|
169
169
|
"type": "string",
|
|
170
|
+
"attribute": "status",
|
|
170
171
|
"mutable": true,
|
|
171
172
|
"complexType": {
|
|
172
173
|
"original": "SulaTextfieldStatus",
|
|
@@ -187,12 +188,12 @@ export class SulaTextfield {
|
|
|
187
188
|
},
|
|
188
189
|
"getter": false,
|
|
189
190
|
"setter": false,
|
|
190
|
-
"attribute": "status",
|
|
191
191
|
"reflect": false,
|
|
192
192
|
"defaultValue": "SulaTextfieldStatus.Default"
|
|
193
193
|
},
|
|
194
194
|
"label": {
|
|
195
195
|
"type": "string",
|
|
196
|
+
"attribute": "label",
|
|
196
197
|
"mutable": false,
|
|
197
198
|
"complexType": {
|
|
198
199
|
"original": "string",
|
|
@@ -207,11 +208,11 @@ export class SulaTextfield {
|
|
|
207
208
|
},
|
|
208
209
|
"getter": false,
|
|
209
210
|
"setter": false,
|
|
210
|
-
"attribute": "label",
|
|
211
211
|
"reflect": false
|
|
212
212
|
},
|
|
213
213
|
"placeholder": {
|
|
214
214
|
"type": "string",
|
|
215
|
+
"attribute": "placeholder",
|
|
215
216
|
"mutable": false,
|
|
216
217
|
"complexType": {
|
|
217
218
|
"original": "string",
|
|
@@ -226,11 +227,11 @@ export class SulaTextfield {
|
|
|
226
227
|
},
|
|
227
228
|
"getter": false,
|
|
228
229
|
"setter": false,
|
|
229
|
-
"attribute": "placeholder",
|
|
230
230
|
"reflect": false
|
|
231
231
|
},
|
|
232
232
|
"disabled": {
|
|
233
233
|
"type": "boolean",
|
|
234
|
+
"attribute": "disabled",
|
|
234
235
|
"mutable": true,
|
|
235
236
|
"complexType": {
|
|
236
237
|
"original": "boolean",
|
|
@@ -245,11 +246,11 @@ export class SulaTextfield {
|
|
|
245
246
|
},
|
|
246
247
|
"getter": false,
|
|
247
248
|
"setter": false,
|
|
248
|
-
"attribute": "disabled",
|
|
249
249
|
"reflect": false
|
|
250
250
|
},
|
|
251
251
|
"helpText": {
|
|
252
252
|
"type": "string",
|
|
253
|
+
"attribute": "help-text",
|
|
253
254
|
"mutable": false,
|
|
254
255
|
"complexType": {
|
|
255
256
|
"original": "string",
|
|
@@ -264,11 +265,11 @@ export class SulaTextfield {
|
|
|
264
265
|
},
|
|
265
266
|
"getter": false,
|
|
266
267
|
"setter": false,
|
|
267
|
-
"attribute": "help-text",
|
|
268
268
|
"reflect": false
|
|
269
269
|
},
|
|
270
270
|
"maxLength": {
|
|
271
271
|
"type": "number",
|
|
272
|
+
"attribute": "max-length",
|
|
272
273
|
"mutable": false,
|
|
273
274
|
"complexType": {
|
|
274
275
|
"original": "number",
|
|
@@ -283,11 +284,11 @@ export class SulaTextfield {
|
|
|
283
284
|
},
|
|
284
285
|
"getter": false,
|
|
285
286
|
"setter": false,
|
|
286
|
-
"attribute": "max-length",
|
|
287
287
|
"reflect": false
|
|
288
288
|
},
|
|
289
289
|
"icon": {
|
|
290
290
|
"type": "string",
|
|
291
|
+
"attribute": "icon",
|
|
291
292
|
"mutable": false,
|
|
292
293
|
"complexType": {
|
|
293
294
|
"original": "string",
|
|
@@ -302,7 +303,6 @@ export class SulaTextfield {
|
|
|
302
303
|
},
|
|
303
304
|
"getter": false,
|
|
304
305
|
"setter": false,
|
|
305
|
-
"attribute": "icon",
|
|
306
306
|
"reflect": false
|
|
307
307
|
}
|
|
308
308
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|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E,EAAC,qBAAqB,EACxB,KAAK,EAAE,EAAE,mBAAmB,EAAE,IAAI,CAAC,MAAM,KAAK,mBAAmB,CAAC,OAAO,EAAE,qBAAqB,EAAE,IAAI,CAAC,MAAM,KAAK,mBAAmB,CAAC,KAAK,EAAE,IAE5I,IAAI,CAAC,QAAQ,CACV,CACP;oBACA,IAAI,CAAC,SAAS,IAAI,CACjB,4DACE,EAAE,EAAC,sBAAsB,EACzB,KAAK,EAAE,EAAE,mBAAmB,EAAE,IAAI,CAAC,MAAM,KAAK,mBAAmB,CAAC,OAAO,EAAE,qBAAqB,EAAE,IAAI,CAAC,MAAM,KAAK,mBAAmB,CAAC,KAAK,EAAE;wBAE5I,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;;wBAAG,IAAI,CAAC,SAAS,CACxD,CACP,CACG,CACP,CACG,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Event, EventEmitter, Host, Listen, Prop, State, h } from '@stencil/core';\nimport { SulaTextfieldStatus, SulaTextfieldType } from './model/sula-textfield.model';\n\n@Component({\n tag: 'sula-textfield',\n styleUrl: 'sula-textfield.scss',\n shadow: true,\n})\nexport class SulaTextfield {\n /**\n * Value for the input.\n */\n @Prop({ mutable: true })\n value?: string;\n\n /**\n * The textfield type\n */\n @Prop() type: SulaTextfieldType = SulaTextfieldType.Text;\n\n /**\n * The textfield status\n */\n @Prop({ mutable: true }) status: SulaTextfieldStatus = SulaTextfieldStatus.Default;\n\n /**\n * The textfield label\n */\n @Prop() label: string;\n\n /**\n * The textfield placeholder\n */\n @Prop() placeholder: string;\n\n /**\n * The textfield is disabled\n */\n @Prop({ mutable: true }) disabled: boolean;\n\n /**\n * The help text for textfield\n */\n @Prop() helpText?: string;\n\n /**\n * The textfield max length\n */\n @Prop() maxLength?: number;\n\n /**\n * The textfield icon\n */\n @Prop() icon?: string;\n\n /**\n * Event emitted when input value changes.\n */\n @Event()\n valueChanged: EventEmitter<string>;\n\n /**\n * Event emitted when input is focused.\n */\n @Event()\n focusedOn: EventEmitter<void>;\n\n /**\n * Event emitted when input is focused out.\n */\n @Event()\n focusedOut: EventEmitter<void>;\n\n @State()\n inputIsOpen = false;\n\n @State()\n textValue: string = '';\n\n @State()\n showPassword = false;\n\n @State()\n inputIsFocused = false;\n\n inputContainer: HTMLDivElement;\n inputElement: HTMLInputElement;\n labelElement: HTMLDivElement;\n\n node?: HTMLElement;\n\n @Listen('click', { target: 'document' })\n handleClick(event: Event) {\n if (!this.node) return;\n\n const clickInside = this.node.contains(event.target as Node);\n\n if (!clickInside) {\n this.toggleOptions(false);\n this.focusedOut.emit();\n this.inputIsFocused = false;\n }\n }\n\n componentWillLoad() {\n if (this.value && this.value.trim().length > 0) {\n this.textValue = this.value;\n this.inputIsOpen = true;\n }\n }\n\n componentDidLoad() {\n if (this.textValue && this.textValue.trim().length > 0) {\n this.changeElementsStyle();\n }\n }\n\n handleInputClick = () => {\n this.toggleOptions(true);\n };\n\n toggleOptions(inputIsOpen: boolean) {\n if ((this.inputIsOpen && this.textValue && this.textValue.length > 0) || this.disabled) return;\n\n this.inputIsOpen = inputIsOpen;\n this.changeElementsStyle();\n this.inputElement.focus();\n }\n\n changeElementsStyle() {\n this.inputContainer.style.display = this.inputIsOpen ? 'flex' : 'none';\n this.labelElement.style.display = this.inputIsOpen ? 'none' : 'block';\n if (!this.inputIsOpen) {\n this.labelElement.classList.add('from-up');\n }\n }\n\n handleInputChanges = (event: InputEvent) => {\n const newValue = (event.target as HTMLInputElement).value;\n this.textValue = newValue;\n\n this.valueChanged.emit(newValue);\n };\n\n handleFocus = () => {\n if (this.disabled) return;\n this.toggleOptions(true);\n this.inputElement.focus();\n };\n\n handleBlur = () => {\n this.toggleOptions(false);\n\n this.focusedOut.emit();\n this.inputIsFocused = false;\n };\n\n handleInputFocus = () => {\n this.focusedOn.emit();\n this.inputIsFocused = true;\n };\n\n handleIconClick = (event: MouseEvent) => {\n if (this.type === SulaTextfieldType.Password) {\n event.stopPropagation();\n this.handlePasswordIconClicked();\n }\n };\n\n handlePasswordIconClicked() {\n const cursorPosition = this.inputElement.selectionStart;\n const inputValue = this.inputElement.value;\n const inputType = this.showPassword ? SulaTextfieldType.Password : SulaTextfieldType.Text;\n\n this.inputElement.setAttribute('type', inputType);\n this.showPassword = !this.showPassword;\n\n setTimeout(() => {\n this.inputElement.value = inputValue;\n\n this.inputElement.setSelectionRange(cursorPosition, cursorPosition);\n }, 0);\n }\n\n getInputIcon() {\n if (this.type === SulaTextfieldType.Password) {\n return this.showPassword ? 'ph ph-eye' : 'ph ph-eye-slash';\n }\n\n return this.icon;\n }\n\n render() {\n return (\n <Host ref={node => (this.node = node)}>\n <div>\n <div\n id=\"button-container\"\n class={{\n 'flex items-center border rounded-sm px-16 outline-none h-[72px] caret-brand-primary': true,\n 'flex-row justify-between': !!this.icon || this.type === SulaTextfieldType.Password,\n 'button-focus': this.inputIsFocused && !this.disabled && this.status === SulaTextfieldStatus.Default,\n 'button-error': this.status === SulaTextfieldStatus.Error && !this.disabled,\n 'bg-states-bg-disabled border-line-general cursor-not-allowed': this.disabled,\n 'bg-surface-body border-line-input cursor-pointer': !this.disabled,\n }}\n tabIndex={0}\n onFocus={this.handleFocus}\n onClick={this.handleInputClick}\n >\n {!this.disabled && (\n <div class={{ 'hidden flex-col w-full': true, 'pr-12': !!this.icon }} ref={node => (this.inputContainer = node)}>\n <label class=\"font-bold text-sm text-text-primary from-down\">{this.label}</label>\n <input\n type={this.type}\n ref={node => (this.inputElement = node)}\n placeholder={this.placeholder}\n class=\"outline-none text-base text-text-primary bg-transparent\"\n onInput={this.handleInputChanges}\n onFocus={this.handleInputFocus}\n value={this.value}\n />\n </div>\n )}\n\n <div\n id=\"textfield-label\"\n class={{ 'text-base flex items-center': true, 'text-text-primary': !this.disabled, 'text-text-disabled': this.disabled }}\n ref={node => (this.labelElement = node)}\n >\n {this.label}\n </div>\n\n {(!!this.icon || this.type === SulaTextfieldType.Password) && (\n <div class=\"flex items-center justify-center\" onClick={this.handleIconClick}>\n <sula-icon icon={this.getInputIcon()} customClass={`text-2xl ${this.disabled ? 'text-icon-disabled' : 'text-icon-primary'}`} />\n </div>\n )}\n </div>\n\n {(this.helpText || this.maxLength) && !this.disabled && (\n <div class=\"flex justify-between items-center px-16 mt-4 text-sm\">\n {this.helpText && (\n <div\n id=\"textfield-help-text\"\n class={{ 'text-text-primary': this.status === SulaTextfieldStatus.Default, 'text-feedback-error': this.status === SulaTextfieldStatus.Error }}\n >\n {this.helpText}\n </div>\n )}\n {this.maxLength && (\n <div\n id=\"max-length-container\"\n class={{ 'text-text-primary': this.status === SulaTextfieldStatus.Default, 'text-feedback-error': this.status === SulaTextfieldStatus.Error }}\n >\n {this.textValue ? this.textValue.length : 0}/{this.maxLength}\n </div>\n )}\n </div>\n )}\n </div>\n </Host>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sula-textfield.js","sourceRoot":"","sources":["../../../src/components/sula-textfield/sula-textfield.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAC7F,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAOtF,MAAM,OAAO,aAAa;IAL1B;QAYE;;WAEG;QACK,SAAI,GAAsB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AAI,CAAC,MAAM,KAAK,mBAAmB,CAAC,OAAO,EAAE,qBAAqB,EAAE,IAAI,CAAC,MAAM,KAAK,mBAAmB,CAAC,KAAK,EAAE;wBAE5I,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;;wBAAG,IAAI,CAAC,SAAS,CACxD,CACP,CACG,CACP,CACG,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Event, EventEmitter, Host, Listen, Prop, State, h } from '@stencil/core';\nimport { SulaTextfieldStatus, SulaTextfieldType } from './model/sula-textfield.model';\n\n@Component({\n tag: 'sula-textfield',\n styleUrl: 'sula-textfield.scss',\n shadow: true,\n})\nexport class SulaTextfield {\n /**\n * Value for the input.\n */\n @Prop({ mutable: true })\n value?: string;\n\n /**\n * The textfield type\n */\n @Prop() type: SulaTextfieldType = SulaTextfieldType.Text;\n\n /**\n * The textfield status\n */\n @Prop({ mutable: true }) status: SulaTextfieldStatus = SulaTextfieldStatus.Default;\n\n /**\n * The textfield label\n */\n @Prop() label: string;\n\n /**\n * The textfield placeholder\n */\n @Prop() placeholder: string;\n\n /**\n * The textfield is disabled\n */\n @Prop({ mutable: true }) disabled: boolean;\n\n /**\n * The help text for textfield\n */\n @Prop() helpText?: string;\n\n /**\n * The textfield max length\n */\n @Prop() maxLength?: number;\n\n /**\n * The textfield icon\n */\n @Prop() icon?: string;\n\n /**\n * Event emitted when input value changes.\n */\n @Event()\n valueChanged: EventEmitter<string>;\n\n /**\n * Event emitted when input is focused.\n */\n @Event()\n focusedOn: EventEmitter<void>;\n\n /**\n * Event emitted when input is focused out.\n */\n @Event()\n focusedOut: EventEmitter<void>;\n\n @State()\n inputIsOpen = false;\n\n @State()\n textValue: string = '';\n\n @State()\n showPassword = false;\n\n @State()\n inputIsFocused = false;\n\n inputContainer: HTMLDivElement;\n inputElement: HTMLInputElement;\n labelElement: HTMLDivElement;\n\n node?: HTMLElement;\n\n @Listen('click', { target: 'document' })\n handleClick(event: Event) {\n if (!this.node || !this.inputIsFocused) return;\n\n const clickInside = this.node.contains(event.target as Node);\n\n if (!clickInside) {\n this.toggleOptions(false);\n this.focusedOut.emit();\n this.inputIsFocused = false;\n }\n }\n\n componentWillLoad() {\n if (this.value && this.value.trim().length > 0) {\n this.textValue = this.value;\n this.inputIsOpen = true;\n }\n }\n\n componentDidLoad() {\n if (this.textValue && this.textValue.trim().length > 0) {\n this.changeElementsStyle();\n }\n }\n\n handleInputClick = () => {\n this.toggleOptions(true);\n };\n\n toggleOptions(inputIsOpen: boolean) {\n if ((this.inputIsOpen && this.textValue && this.textValue.length > 0) || this.disabled) return;\n\n this.inputIsOpen = inputIsOpen;\n this.changeElementsStyle();\n this.inputElement.focus();\n }\n\n changeElementsStyle() {\n this.inputContainer.style.display = this.inputIsOpen ? 'flex' : 'none';\n this.labelElement.style.display = this.inputIsOpen ? 'none' : 'block';\n if (!this.inputIsOpen) {\n this.labelElement.classList.add('from-up');\n }\n }\n\n handleInputChanges = (event: InputEvent) => {\n const newValue = (event.target as HTMLInputElement).value;\n this.textValue = newValue;\n\n this.valueChanged.emit(newValue);\n };\n\n handleFocus = () => {\n if (this.disabled) return;\n this.toggleOptions(true);\n this.inputElement.focus();\n };\n\n handleBlur = () => {\n this.toggleOptions(false);\n\n this.focusedOut.emit();\n this.inputIsFocused = false;\n };\n\n handleInputFocus = () => {\n this.focusedOn.emit();\n this.inputIsFocused = true;\n };\n\n handleIconClick = (event: MouseEvent) => {\n if (this.type === SulaTextfieldType.Password) {\n event.stopPropagation();\n this.handlePasswordIconClicked();\n }\n };\n\n handlePasswordIconClicked() {\n const cursorPosition = this.inputElement.selectionStart;\n const inputValue = this.inputElement.value;\n const inputType = this.showPassword ? SulaTextfieldType.Password : SulaTextfieldType.Text;\n\n this.inputElement.setAttribute('type', inputType);\n this.showPassword = !this.showPassword;\n\n setTimeout(() => {\n this.inputElement.value = inputValue;\n\n this.inputElement.setSelectionRange(cursorPosition, cursorPosition);\n }, 0);\n }\n\n getInputIcon() {\n if (this.type === SulaTextfieldType.Password) {\n return this.showPassword ? 'ph ph-eye' : 'ph ph-eye-slash';\n }\n\n return this.icon;\n }\n\n render() {\n return (\n <Host ref={node => (this.node = node)}>\n <div>\n <div\n id=\"button-container\"\n class={{\n 'flex items-center border rounded-sm px-16 outline-none h-[72px] caret-brand-primary': true,\n 'flex-row justify-between': !!this.icon || this.type === SulaTextfieldType.Password,\n 'button-focus': this.inputIsFocused && !this.disabled && this.status === SulaTextfieldStatus.Default,\n 'button-error': this.status === SulaTextfieldStatus.Error && !this.disabled,\n 'bg-states-bg-disabled border-line-general cursor-not-allowed': this.disabled,\n 'bg-surface-body border-line-input cursor-pointer': !this.disabled,\n }}\n tabIndex={0}\n onFocus={this.handleFocus}\n onClick={this.handleInputClick}\n >\n {!this.disabled && (\n <div class={{ 'hidden flex-col w-full': true, 'pr-12': !!this.icon }} ref={node => (this.inputContainer = node)}>\n <label class=\"font-bold text-sm text-text-primary from-down\">{this.label}</label>\n <input\n type={this.type}\n ref={node => (this.inputElement = node)}\n placeholder={this.placeholder}\n class=\"outline-none text-base text-text-primary bg-transparent\"\n onInput={this.handleInputChanges}\n onFocus={this.handleInputFocus}\n value={this.value}\n />\n </div>\n )}\n\n <div\n id=\"textfield-label\"\n class={{ 'text-base flex items-center': true, 'text-text-primary': !this.disabled, 'text-text-disabled': this.disabled }}\n ref={node => (this.labelElement = node)}\n >\n {this.label}\n </div>\n\n {(!!this.icon || this.type === SulaTextfieldType.Password) && (\n <div class=\"flex items-center justify-center\" onClick={this.handleIconClick}>\n <sula-icon icon={this.getInputIcon()} customClass={`text-2xl ${this.disabled ? 'text-icon-disabled' : 'text-icon-primary'}`} />\n </div>\n )}\n </div>\n\n {(this.helpText || this.maxLength) && !this.disabled && (\n <div class=\"flex justify-between items-center px-16 mt-4 text-sm\">\n {this.helpText && (\n <div\n id=\"textfield-help-text\"\n class={{ 'text-text-primary': this.status === SulaTextfieldStatus.Default, 'text-feedback-error': this.status === SulaTextfieldStatus.Error }}\n >\n {this.helpText}\n </div>\n )}\n {this.maxLength && (\n <div\n id=\"max-length-container\"\n class={{ 'text-text-primary': this.status === SulaTextfieldStatus.Default, 'text-feedback-error': this.status === SulaTextfieldStatus.Error }}\n >\n {this.textValue ? this.textValue.length : 0}/{this.maxLength}\n </div>\n )}\n </div>\n )}\n </div>\n </Host>\n );\n }\n}\n"]}
|
|
@@ -90,6 +90,13 @@ export default {
|
|
|
90
90
|
description: 'Evento emitido quando o campo perde foco',
|
|
91
91
|
},
|
|
92
92
|
},
|
|
93
|
+
parameters: {
|
|
94
|
+
docs: {
|
|
95
|
+
description: {
|
|
96
|
+
component: 'O componente Textfield Sula Design System é utilizado para inclusão de informações em formulários e telas de cadastro. Foi desenvolvido suportando feedback text, helped text, ícones e senhas.',
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
},
|
|
93
100
|
};
|
|
94
101
|
const Template = args => {
|
|
95
102
|
const container = document.createElement('div');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sula-textfield.stories.js","sourceRoot":"","sources":["../../../src/components/sula-textfield/sula-textfield.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEtF,eAAe;IACb,KAAK,EAAE,2BAA2B;IAClC,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,QAAQ,EAAE;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AQ,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC1C,QAAQ,CAAC,IAAI,mCACR,OAAO,CAAC,IAAI,KACf,QAAQ,EAAE,IAAI,EACd,KAAK,EAAE,oBAAoB,GAC5B,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACrD,mBAAmB,CAAC,IAAI,mCACnB,OAAO,CAAC,IAAI,KACf,KAAK,EAAE,UAAU,EACjB,WAAW,EAAE,qBAAqB,EAClC,IAAI,EAAE,eAAe,EACrB,QAAQ,EAAE,6BAA6B,GACxC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACpD,kBAAkB,CAAC,IAAI,mCAClB,OAAO,CAAC,IAAI,KACf,MAAM,EAAE,mBAAmB,CAAC,KAAK,EACjC,KAAK,EAAE,UAAU,EACjB,WAAW,EAAE,qBAAqB,EAClC,SAAS,EAAE,EAAE,EACb,QAAQ,EAAE,gCAAgC,EAC1C,KAAK,EAAE,0EAA0E,GAClF,CAAC","sourcesContent":["import { SulaTextfieldStatus, SulaTextfieldType } from './model/sula-textfield.model';\n\nexport default {\n title: 'Components/sula-textfield',\n tags: ['autodocs'],\n argTypes: {\n value: {\n control: 'text',\n defaultValue: '',\n description: 'Value for the input',\n type: {\n required: false,\n },\n },\n type: {\n control: { type: 'select' },\n options: Object.values(SulaTextfieldType),\n defaultValue: SulaTextfieldType.Text,\n description: 'The textfield type',\n type: {\n required: false,\n },\n },\n status: {\n control: { type: 'select' },\n options: Object.values(SulaTextfieldStatus),\n defaultValue: SulaTextfieldStatus.Default,\n description: 'The textfield status',\n type: {\n required: false,\n },\n },\n label: {\n control: 'text',\n defaultValue: 'Label',\n description: 'The textfield label',\n type: {\n required: false,\n },\n },\n placeholder: {\n control: 'text',\n defaultValue: 'Placeholder',\n description: 'The textfield placeholder',\n type: {\n required: false,\n },\n },\n disabled: {\n control: 'boolean',\n defaultValue: false,\n description: 'The textfield is disabled',\n type: {\n required: false,\n },\n },\n helpText: {\n control: 'text',\n defaultValue: '',\n description: 'The help text for textfield',\n type: {\n required: false,\n },\n },\n maxLength: {\n control: 'number',\n defaultValue: 0,\n description: 'The textfield max length',\n type: {\n required: false,\n },\n },\n icon: {\n control: 'text',\n defaultValue: '',\n description: 'The textfield icon',\n type: {\n required: false,\n },\n },\n valueChanged: {\n action: 'valueChanged',\n description: 'Evento emitido quando o valor muda',\n },\n focusedOn: {\n action: 'focusedOn',\n description: 'Evento emitido quando o campo recebe foco',\n },\n focusedOut: {\n action: 'focusedOut',\n description: 'Evento emitido quando o campo perde foco',\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-textfield');\n\n if (args.value) el.setAttribute('value', args.value);\n el.setAttribute('type', args.type);\n el.setAttribute('status', args.status);\n el.setAttribute('label', args.label);\n el.setAttribute('placeholder', args.placeholder);\n el.setAttribute('disabled', args.disabled.toString());\n\n if (args.helpText) el.setAttribute('help-text', args.helpText);\n if (args.maxLength > 0) el.setAttribute('max-length', args.maxLength.toString());\n if (args.icon) el.setAttribute('icon', args.icon);\n\n el.addEventListener('valueChanged', args.valueChanged);\n el.addEventListener('focusedOn', args.focusedOn);\n el.addEventListener('focusedOut', args.focusedOut);\n\n container.appendChild(el);\n\n return container;\n};\n\nexport const Default = Template.bind({});\nDefault.args = {\n value: '',\n type: SulaTextfieldType.Text,\n status: SulaTextfieldStatus.Default,\n label: 'Nome',\n placeholder: 'Digite seu nome',\n disabled: false,\n helpText: '',\n maxLength: 0,\n icon: '',\n};\n\nexport const WithValue = Template.bind({});\nWithValue.args = {\n ...Default.args,\n value: 'John Doe',\n label: 'Nome completo',\n};\n\nexport const WithHelpText = Template.bind({});\nWithHelpText.args = {\n ...Default.args,\n label: 'E-mail',\n placeholder: 'Digite seu e-mail',\n helpText: 'Informe um e-mail válido',\n};\n\nexport const WithMaxLength = Template.bind({});\nWithMaxLength.args = {\n ...Default.args,\n label: 'Descrição',\n placeholder: 'Digite uma descrição',\n maxLength: 100,\n helpText: 'Máximo de 100 caracteres',\n};\n\nexport const WithIcon = Template.bind({});\nWithIcon.args = {\n ...Default.args,\n label: 'Pesquisar',\n placeholder: 'Digite sua busca',\n icon: 'ph ph-magnifying-glass',\n};\n\nexport const Password = Template.bind({});\nPassword.args = {\n ...Default.args,\n type: SulaTextfieldType.Password,\n label: 'Senha',\n placeholder: 'Digite sua senha',\n};\n\nexport const Error = Template.bind({});\nError.args = {\n ...Default.args,\n status: SulaTextfieldStatus.Error,\n label: 'E-mail',\n placeholder: 'Digite seu e-mail',\n helpText: 'E-mail inválido',\n};\n\nexport const Disabled = Template.bind({});\nDisabled.args = {\n ...Default.args,\n disabled: true,\n label: 'Campo desabilitado',\n};\n\nexport const WithIconAndHelpText = Template.bind({});\nWithIconAndHelpText.args = {\n ...Default.args,\n label: 'Endereço',\n placeholder: 'Digite seu endereço',\n icon: 'ph ph-map-pin',\n helpText: 'Informe o endereço completo',\n};\n\nexport const ErrorWithMaxLength = Template.bind({});\nErrorWithMaxLength.args = {\n ...Default.args,\n status: SulaTextfieldStatus.Error,\n label: 'Mensagem',\n placeholder: 'Digite sua mensagem',\n maxLength: 50,\n helpText: 'Excedeu o limite de caracteres',\n value: 'Esta é uma mensagem de teste que excede o limite de caracteres permitido',\n};\n"]}
|
|
1
|
+
{"version":3,"file":"sula-textfield.stories.js","sourceRoot":"","sources":["../../../src/components/sula-textfield/sula-textfield.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEtF,eAAe;IACb,KAAK,EAAE,2BAA2B;IAClC,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,QAAQ,EAAE;QACR,KAAK,EAAE;YACL,OAAO,EAAE,MAAM;YACf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,iBAAiB,GAC5B,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC1C,QAAQ,CAAC,IAAI,mCACR,OAAO,CAAC,IAAI,KACf,QAAQ,EAAE,IAAI,EACd,KAAK,EAAE,oBAAoB,GAC5B,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACrD,mBAAmB,CAAC,IAAI,mCACnB,OAAO,CAAC,IAAI,KACf,KAAK,EAAE,UAAU,EACjB,WAAW,EAAE,qBAAqB,EAClC,IAAI,EAAE,eAAe,EACrB,QAAQ,EAAE,6BAA6B,GACxC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACpD,kBAAkB,CAAC,IAAI,mCAClB,OAAO,CAAC,IAAI,KACf,MAAM,EAAE,mBAAmB,CAAC,KAAK,EACjC,KAAK,EAAE,UAAU,EACjB,WAAW,EAAE,qBAAqB,EAClC,SAAS,EAAE,EAAE,EACb,QAAQ,EAAE,gCAAgC,EAC1C,KAAK,EAAE,0EAA0E,GAClF,CAAC","sourcesContent":["import { SulaTextfieldStatus, SulaTextfieldType } from './model/sula-textfield.model';\n\nexport default {\n title: 'Components/sula-textfield',\n tags: ['autodocs'],\n argTypes: {\n value: {\n control: 'text',\n defaultValue: '',\n description: 'Value for the input',\n type: {\n required: false,\n },\n },\n type: {\n control: { type: 'select' },\n options: Object.values(SulaTextfieldType),\n defaultValue: SulaTextfieldType.Text,\n description: 'The textfield type',\n type: {\n required: false,\n },\n },\n status: {\n control: { type: 'select' },\n options: Object.values(SulaTextfieldStatus),\n defaultValue: SulaTextfieldStatus.Default,\n description: 'The textfield status',\n type: {\n required: false,\n },\n },\n label: {\n control: 'text',\n defaultValue: 'Label',\n description: 'The textfield label',\n type: {\n required: false,\n },\n },\n placeholder: {\n control: 'text',\n defaultValue: 'Placeholder',\n description: 'The textfield placeholder',\n type: {\n required: false,\n },\n },\n disabled: {\n control: 'boolean',\n defaultValue: false,\n description: 'The textfield is disabled',\n type: {\n required: false,\n },\n },\n helpText: {\n control: 'text',\n defaultValue: '',\n description: 'The help text for textfield',\n type: {\n required: false,\n },\n },\n maxLength: {\n control: 'number',\n defaultValue: 0,\n description: 'The textfield max length',\n type: {\n required: false,\n },\n },\n icon: {\n control: 'text',\n defaultValue: '',\n description: 'The textfield icon',\n type: {\n required: false,\n },\n },\n valueChanged: {\n action: 'valueChanged',\n description: 'Evento emitido quando o valor muda',\n },\n focusedOn: {\n action: 'focusedOn',\n description: 'Evento emitido quando o campo recebe foco',\n },\n focusedOut: {\n action: 'focusedOut',\n description: 'Evento emitido quando o campo perde foco',\n },\n },\n parameters: {\n docs: {\n description: {\n component:\n 'O componente Textfield Sula Design System é utilizado para inclusão de informações em formulários e telas de cadastro. Foi desenvolvido suportando feedback text, helped text, ícones e senhas.',\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-textfield');\n\n if (args.value) el.setAttribute('value', args.value);\n el.setAttribute('type', args.type);\n el.setAttribute('status', args.status);\n el.setAttribute('label', args.label);\n el.setAttribute('placeholder', args.placeholder);\n el.setAttribute('disabled', args.disabled.toString());\n\n if (args.helpText) el.setAttribute('help-text', args.helpText);\n if (args.maxLength > 0) el.setAttribute('max-length', args.maxLength.toString());\n if (args.icon) el.setAttribute('icon', args.icon);\n\n el.addEventListener('valueChanged', args.valueChanged);\n el.addEventListener('focusedOn', args.focusedOn);\n el.addEventListener('focusedOut', args.focusedOut);\n\n container.appendChild(el);\n\n return container;\n};\n\nexport const Default = Template.bind({});\nDefault.args = {\n value: '',\n type: SulaTextfieldType.Text,\n status: SulaTextfieldStatus.Default,\n label: 'Nome',\n placeholder: 'Digite seu nome',\n disabled: false,\n helpText: '',\n maxLength: 0,\n icon: '',\n};\n\nexport const WithValue = Template.bind({});\nWithValue.args = {\n ...Default.args,\n value: 'John Doe',\n label: 'Nome completo',\n};\n\nexport const WithHelpText = Template.bind({});\nWithHelpText.args = {\n ...Default.args,\n label: 'E-mail',\n placeholder: 'Digite seu e-mail',\n helpText: 'Informe um e-mail válido',\n};\n\nexport const WithMaxLength = Template.bind({});\nWithMaxLength.args = {\n ...Default.args,\n label: 'Descrição',\n placeholder: 'Digite uma descrição',\n maxLength: 100,\n helpText: 'Máximo de 100 caracteres',\n};\n\nexport const WithIcon = Template.bind({});\nWithIcon.args = {\n ...Default.args,\n label: 'Pesquisar',\n placeholder: 'Digite sua busca',\n icon: 'ph ph-magnifying-glass',\n};\n\nexport const Password = Template.bind({});\nPassword.args = {\n ...Default.args,\n type: SulaTextfieldType.Password,\n label: 'Senha',\n placeholder: 'Digite sua senha',\n};\n\nexport const Error = Template.bind({});\nError.args = {\n ...Default.args,\n status: SulaTextfieldStatus.Error,\n label: 'E-mail',\n placeholder: 'Digite seu e-mail',\n helpText: 'E-mail inválido',\n};\n\nexport const Disabled = Template.bind({});\nDisabled.args = {\n ...Default.args,\n disabled: true,\n label: 'Campo desabilitado',\n};\n\nexport const WithIconAndHelpText = Template.bind({});\nWithIconAndHelpText.args = {\n ...Default.args,\n label: 'Endereço',\n placeholder: 'Digite seu endereço',\n icon: 'ph ph-map-pin',\n helpText: 'Informe o endereço completo',\n};\n\nexport const ErrorWithMaxLength = Template.bind({});\nErrorWithMaxLength.args = {\n ...Default.args,\n status: SulaTextfieldStatus.Error,\n label: 'Mensagem',\n placeholder: 'Digite sua mensagem',\n maxLength: 50,\n helpText: 'Excedeu o limite de caracteres',\n value: 'Esta é uma mensagem de teste que excede o limite de caracteres permitido',\n};\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export var SulaTilesType;
|
|
2
|
+
(function (SulaTilesType) {
|
|
3
|
+
SulaTilesType["Rounded"] = "rounded";
|
|
4
|
+
SulaTilesType["Square"] = "square";
|
|
5
|
+
})(SulaTilesType || (SulaTilesType = {}));
|
|
6
|
+
export var SulaTilesSize;
|
|
7
|
+
(function (SulaTilesSize) {
|
|
8
|
+
SulaTilesSize["Default"] = "default";
|
|
9
|
+
SulaTilesSize["Large"] = "large";
|
|
10
|
+
})(SulaTilesSize || (SulaTilesSize = {}));
|
|
11
|
+
//# sourceMappingURL=sula-tiles.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sula-tiles.model.js","sourceRoot":"","sources":["../../../../src/components/sula-tiles/model/sula-tiles.model.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,oCAAmB,CAAA;IACnB,kCAAiB,CAAA;AACnB,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB;AAED,MAAM,CAAN,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,oCAAmB,CAAA;IACnB,gCAAe,CAAA;AACjB,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB","sourcesContent":["export enum SulaTilesType {\n Rounded = 'rounded',\n Square = 'square',\n}\n\nexport enum SulaTilesSize {\n Default = 'default',\n Large = 'large',\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
*,:after,:before{--tw-ring-color:rgba(59,130,246,.5);--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: ;border:0 solid #e5e7eb;box-sizing:border-box}::backdrop{--tw-ring-color:rgba(59,130,246,.5);--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/:after,:before{--tw-content:""}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,fieldset,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}.block{display:block}:host{display:block}:root{--color-green-50:#f1f9f4;--color-green-100:#e6f4ed;--color-green-200:#cae7d8;--color-green-300:#a0d4b8;--color-green-400:#68bb8e;--color-green-500:#04843f;--color-green-600:#037236;--color-green-700:#03632f;--color-green-800:#035428;--color-green-900:#024521;--color-green-950:#02361a;--color-red-50:#fef6f6;--color-red-100:#fde8e8;--color-red-200:#fad1d1;--color-red-300:#f7abab;--color-red-400:#f17474;--color-red-500:#c80505;--color-red-600:#b30404;--color-red-700:#9f0404;--color-red-800:#860303;--color-red-900:#6d0303;--color-red-950:#500202;--color-yellow-50:#fdf4e7;--color-yellow-100:#fcedd9;--color-yellow-200:#fae0bd;--color-yellow-300:#f6c788;--color-yellow-400:#f3b159;--color-yellow-500:#ef9928;--color-yellow-600:#e49226;--color-yellow-700:#d17e10;--color-yellow-800:#b46d0e;--color-yellow-900:#93590b;--color-yellow-950:#683f08;--color-orange-50:#fef4f1;--color-orange-100:#fde8e2;--color-orange-200:#fbd2c6;--color-orange-300:#f8b4a0;--color-orange-400:#f58e70;--color-orange-500:#f05223;--color-orange-600:#ea4210;--color-orange-700:#d23b0e;--color-orange-800:#b5330c;--color-orange-900:#942a0a;--color-orange-950:#691e07;--color-blue-50:#ecf0f9;--color-blue-100:#dde3f4;--color-blue-200:#b2c2e5;--color-blue-300:#7994d2;--color-blue-400:#4066bf;--color-blue-500:#001e64;--color-blue-600:#001c5c;--color-blue-700:#00174c;--color-blue-800:#00123d;--color-blue-900:#000f33;--color-blue-950:#000d2b;--color-ambar-50:#fff6eb;--color-ambar-100:#ffefdc;--color-ambar-200:#fedfb9;--color-ambar-300:#fdca8b;--color-ambar-400:#fdb359;--color-ambar-500:#fc9c26;--color-ambar-600:#ec8403;--color-ambar-700:#d87803;--color-ambar-800:#ba6803;--color-ambar-900:#975402;--color-ambar-950:#6a3b01;--color-gray-50:#fff;--color-gray-100:#f4f4f4;--color-gray-200:#e6e6e6;--color-gray-300:#c3c3c3;--color-gray-400:#b9b9b9;--color-gray-500:#949494;--color-gray-600:#737373;--color-gray-700:#5c5c5c;--color-gray-800:#323232;--color-gray-900:#292929;--color-gray-950:#141414;--color-white-opacity-50:#ffffff0d;--color-white-opacity-100:#ffffff1a;--color-white-opacity-200:#ffffff26;--color-white-opacity-300:#ffffff45;--color-white-opacity-400:#ffffff5c;--color-white-opacity-500:#ffffff80;--color-white-opacity-600:#ffffff8c;--color-white-opacity-700:#ffffffa3;--color-white-opacity-800:#ffffffba;--color-white-opacity-900:#fffc;--color-white-opacity-950:#ffffffe8;--color-ciano-50:#f1f6fe;--color-ciano-100:#dfeafc;--color-ciano-200:#c3d9f9;--color-ciano-300:#90b9f4;--color-ciano-400:#5d98ee;--color-ciano-500:#1769e0;--color-ciano-600:#155fcb;--color-ciano-700:#1355b4;--color-ciano-800:#104899;--color-ciano-900:#0d3b7d;--color-ciano-950:#0a2e61;--color-extra-color-blue-light:#e7f0f4;--color-extra-color-blue-dark:#162931;--color-black-opacity-50:#14141405;--color-black-opacity-100:#1414141a;--color-black-opacity-200:#14141426;--color-black-opacity-300:#14141445;--color-black-opacity-400:#1414145c;--color-black-opacity-500:#14141480;--color-black-opacity-600:#1414148c;--color-black-opacity-700:#141414a3;--color-black-opacity-800:#141414ba;--color-black-opacity-900:#141414cc;--color-black-opacity-950:#141414e8;--color-feedback-success:#04843f;--color-feedback-error:#c80505;--color-feedback-informational:#1355b4;--color-feedback-alert:#ef9928;--color-brand-primary:#f05223;--color-brand-secondary:#001c5c;--color-brand-tertiary-1:#1769e0;--color-brand-tertiary-2:#fc9c26;--color-surface-body:#fff;--color-surface-on-body:#f4f4f4;--color-surface-on-body-blue:#e7f0f4;--color-surface-on-body-brand:#fff6eb;--color-surface-on-body-feedback-success:#e6f4ed;--color-surface-on-body-feedback-error:#fde8e8;--color-surface-on-body-feedback-alert:#fdf4e7;--color-surface-on-body-feedback-info:#dfeafc;--color-text-brand:#f05223;--color-text-primary:#323232;--color-text-secondary:#5c5c5c;--color-text-disabled:#949494;--color-text-link:#1355b4;--color-states-empty-bg-hover:#1414141a;--color-states-empty-bg-pressed:#14141426;--color-states-bg-disabled:#14141405;--color-states-bg-focus:#1355b4;--color-states-primary-hover:#ea4210;--color-states-primary-pressed:#d23b0e;--color-states-danger-hover:#b30404;--color-states-danger-pressed:#9f0404;--color-states-negative-hover:#e6e6e6;--color-states-negative-pressed:#c3c3c3;--color-icon-primary:#5c5c5c;--color-icon-secondary:#fff;--color-icon-tertiary:#b30404;--color-icon-disabled:#b9b9b9;--color-neutral-neutral-1:#fff;--color-neutral-neutral-2:#f4f4f4;--color-neutral-neutral-3:#b9b9b9;--color-neutral-neutral-4:#949494;--color-neutral-neutral-5:#737373;--color-neutral-neutral-6:#5c5c5c;--color-neutral-neutral-7:#323232;--color-neutral-neutral-8:#292929;--color-negative-negative-1:#fff;--color-negative-negative-2:#323232;--color-opacity-body:#fffc;--color-opacity-on-body:#14141405;--color-opacity-overlay:#1414148c;--color-opacity-on-overlay:#ffffff1a;--color-line-input:#949494;--color-line-general-strong:#c3c3c3;--color-line-general:#e6e6e6}.static{position:static}.ml-12{margin-left:.75rem}.mt-36{margin-top:2.25rem}.mt-8{margin-top:.5rem}.flex{display:flex}.h-120{height:7.5rem}.h-80{height:5rem}.w-120{width:7.5rem}.w-80{width:5rem}.w-\[167px\]{width:167px}.max-w-full{max-width:100%}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.25rem*var(--tw-space-y-reverse));margin-top:calc(.25rem*(1 - var(--tw-space-y-reverse)))}.overflow-hidden,.truncate{overflow:hidden}.truncate{text-overflow:ellipsis;white-space:nowrap}.whitespace-normal{white-space:normal}.whitespace-nowrap{white-space:nowrap}.rounded-full{border-radius:9999px}.rounded-md{border-radius:1.25rem}.bg-states-bg-disabled{background-color:var(--color-states-bg-disabled)}.bg-surface-on-body{background-color:var(--color-surface-on-body)}.p-20{padding:1.25rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-base{font-size:1rem;line-height:1.5rem}.font-bold{font-weight:700}.leading-4{line-height:1rem}.text-icon-disabled{color:var(--color-icon-disabled)}.text-icon-primary{color:var(--color-icon-primary)}.text-text-primary{color:var(--color-text-primary)}.text-text-secondary{color:var(--color-text-secondary)}.shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.outline-2{outline-width:2px}.outline-offset-2{outline-offset:2px}.outline-feedback-informational{outline-color:var(--color-feedback-informational)}.container{width:100%}@media (min-width:360px){.container{max-width:360px}}@media (min-width:744px){.container{max-width:744px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1366px){.container{max-width:1366px}}@media (min-width:1680px){.container{max-width:1680px}}.hover\:bg-states-empty-bg-hover:hover{background-color:var(--color-states-empty-bg-hover)}.active\:bg-states-empty-bg-pressed:active{background-color:var(--color-states-empty-bg-pressed)}
|