@sula-tech/webcomponents 0.7.2 → 0.7.4
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_18.cjs.entry.js +53 -8
- package/dist/cjs/sula-avatar_18.cjs.entry.js.map +1 -1
- package/dist/cjs/webcomponents.cjs.js +1 -1
- package/dist/collection/components/sula-textarea/sula-textarea.js +29 -6
- package/dist/collection/components/sula-textarea/sula-textarea.js.map +1 -1
- package/dist/collection/components/sula-textfield/sula-textfield.js +30 -2
- package/dist/collection/components/sula-textfield/sula-textfield.js.map +1 -1
- package/dist/components/sula-textarea.js +29 -7
- package/dist/components/sula-textarea.js.map +1 -1
- package/dist/components/sula-textfield.js +30 -3
- package/dist/components/sula-textfield.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sula-avatar_18.entry.js +53 -8
- package/dist/esm/sula-avatar_18.entry.js.map +1 -1
- package/dist/esm/webcomponents.js +1 -1
- package/dist/types/components/sula-textarea/sula-textarea.d.ts +1 -0
- package/dist/types/components/sula-textfield/sula-textfield.d.ts +1 -0
- package/dist/webcomponents/{p-226f8631.entry.js → p-0cad4d30.entry.js} +69 -23
- package/dist/webcomponents/p-0cad4d30.entry.js.map +1 -0
- package/dist/webcomponents/webcomponents.esm.js +11 -7
- package/package.json +3 -1
- package/dist/webcomponents/p-226f8631.entry.js.map +0 -1
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -5,7 +5,7 @@ var index = require('./index-Bbryl0vg.js');
|
|
|
5
5
|
const defineCustomElements = async (win, options) => {
|
|
6
6
|
if (typeof window === 'undefined') return undefined;
|
|
7
7
|
await index.globalScripts();
|
|
8
|
-
return index.bootstrapLazy([["sula-avatar_18.cjs",[[1,"sula-button",{"text":[1025],"icon":[1025],"leftIcon":[1025,"left-icon"],"rightIcon":[1025,"right-icon"],"appearance":[1025],"type":[1025],"size":[1025],"status":[1025],"loading":[1028],"buttonDisabled":[1028,"button-disabled"],"fullWidth":[1028,"full-width"]}],[1,"sula-chip",{"text":[1025],"appearance":[1025],"disabled":[1028],"items":[1040],"isFocused":[32],"showItems":[32]},[[4,"click","handleDocumentClick"]]],[1,"sula-dropdown",{"label":[1025],"disabled":[1028],"items":[1040],"value":[1040],"selectedItem":[32],"showItems":[32],"isFocused":[32]},[[4,"click","handleDocumentClick"]],{"value":["handleValueChange"]}],[1,"sula-avatar",{"size":[1],"imageUrl":[1,"image-url"],"text":[1],"icon":[1]}],[1,"sula-badge",{"status":[1025],"size":[1025],"type":[1025],"text":[1025],"icon":[1025],"hasSlotContent":[32]}],[1,"sula-checkbox",{"type":[1025],"label":[1025],"subTitle":[1025,"sub-title"],"disabled":[1028],"checked":[1028],"isFocus":[32]}],[1,"sula-progress-bar",{"appearance":[1025],"state":[1025],"topLabel":[1025,"top-label"],"bottomLabel":[1025,"bottom-label"],"progress":[1026],"showProgress":[1028,"show-progress"]},null,{"progress":["validateProgress"]}],[1,"sula-search-bar",{"value":[1025],"searchBarStyle":[1025,"search-bar-style"],"placeholder":[1025],"leftIcon":[1025,"left-icon"],"rightIcon":[1025,"right-icon"],"isFocused":[32],"textValue":[32]}],[1,"sula-tag",{"label":[1025],"icon":[1025],"iconStatus":[1025,"icon-status"],"size":[1025],"appearance":[1025],"fontWeight":[1025,"font-weight"]}],[1,"sula-textfield",{"value":[1025],"type":[1],"status":[1025],"label":[1],"placeholder":[1],"disabled":[1028],"helpText":[1,"help-text"],"maxLength":[2,"max-length"],"icon":[1],"inputIsOpen":[32],"textValue":[32],"showPassword":[32],"inputIsFocused":[32]},[[4,"click","handleClick"]]],[1,"sula-tiles",{"type":[1],"size":[1],"ellipsis":[4],"icon":[1],"text":[1],"subText":[1,"sub-text"],"disabled":[4]}],[1,"sula-timeline-list",{"sulaTimelineList":[1040,"sula-timeline-list"]}],[1,"sula-radio-button",{"checked":[1028],"label":[1025],"disabled":[1028],"radioIsFocus":[32]}],[1,"sula-switch",{"type":[1025],"active":[1028],"disabled":[1028],"label":[1025],"subTitle":[1025,"sub-title"],"isFocus":[32]}],[1,"sula-textarea",{"value":[1025],"status":[1025],"label":[1],"placeholder":[1],"disabled":[1028],"helpText":[1,"help-text"],"maxLength":[2,"max-length"],"rows":[2],"isActive":[32],"textValue":[32],"textareaIsFocused":[32]},[[4,"click","handleClick"]]],[1,"sula-loader",{"size":[1],"animationInstance":[32]}],[1,"sula-menu-select-list",{"items":[1040],"fullWidth":[4,"full-width"]}],[0,"sula-icon",{"icon":[1],"customClass":[1,"custom-class"]}]]]], options);
|
|
8
|
+
return index.bootstrapLazy([["sula-avatar_18.cjs",[[1,"sula-button",{"text":[1025],"icon":[1025],"leftIcon":[1025,"left-icon"],"rightIcon":[1025,"right-icon"],"appearance":[1025],"type":[1025],"size":[1025],"status":[1025],"loading":[1028],"buttonDisabled":[1028,"button-disabled"],"fullWidth":[1028,"full-width"]}],[1,"sula-chip",{"text":[1025],"appearance":[1025],"disabled":[1028],"items":[1040],"isFocused":[32],"showItems":[32]},[[4,"click","handleDocumentClick"]]],[1,"sula-dropdown",{"label":[1025],"disabled":[1028],"items":[1040],"value":[1040],"selectedItem":[32],"showItems":[32],"isFocused":[32]},[[4,"click","handleDocumentClick"]],{"value":["handleValueChange"]}],[1,"sula-avatar",{"size":[1],"imageUrl":[1,"image-url"],"text":[1],"icon":[1]}],[1,"sula-badge",{"status":[1025],"size":[1025],"type":[1025],"text":[1025],"icon":[1025],"hasSlotContent":[32]}],[1,"sula-checkbox",{"type":[1025],"label":[1025],"subTitle":[1025,"sub-title"],"disabled":[1028],"checked":[1028],"isFocus":[32]}],[1,"sula-progress-bar",{"appearance":[1025],"state":[1025],"topLabel":[1025,"top-label"],"bottomLabel":[1025,"bottom-label"],"progress":[1026],"showProgress":[1028,"show-progress"]},null,{"progress":["validateProgress"]}],[1,"sula-search-bar",{"value":[1025],"searchBarStyle":[1025,"search-bar-style"],"placeholder":[1025],"leftIcon":[1025,"left-icon"],"rightIcon":[1025,"right-icon"],"isFocused":[32],"textValue":[32]}],[1,"sula-tag",{"label":[1025],"icon":[1025],"iconStatus":[1025,"icon-status"],"size":[1025],"appearance":[1025],"fontWeight":[1025,"font-weight"]}],[1,"sula-textfield",{"value":[1025],"type":[1],"status":[1025],"label":[1],"placeholder":[1],"disabled":[1028],"helpText":[1,"help-text"],"maxLength":[2,"max-length"],"icon":[1],"inputIsOpen":[32],"textValue":[32],"showPassword":[32],"inputIsFocused":[32]},[[4,"click","handleClick"]],{"value":["watchValueHandler"]}],[1,"sula-tiles",{"type":[1],"size":[1],"ellipsis":[4],"icon":[1],"text":[1],"subText":[1,"sub-text"],"disabled":[4]}],[1,"sula-timeline-list",{"sulaTimelineList":[1040,"sula-timeline-list"]}],[1,"sula-radio-button",{"checked":[1028],"label":[1025],"disabled":[1028],"radioIsFocus":[32]}],[1,"sula-switch",{"type":[1025],"active":[1028],"disabled":[1028],"label":[1025],"subTitle":[1025,"sub-title"],"isFocus":[32]}],[1,"sula-textarea",{"value":[1025],"status":[1025],"label":[1],"placeholder":[1],"disabled":[1028],"helpText":[1,"help-text"],"maxLength":[2,"max-length"],"rows":[2],"isActive":[32],"textValue":[32],"textareaIsFocused":[32]},[[4,"click","handleClick"]],{"value":["watchValueHandler"]}],[1,"sula-loader",{"size":[1],"animationInstance":[32]}],[1,"sula-menu-select-list",{"items":[1040],"fullWidth":[4,"full-width"]}],[0,"sula-icon",{"icon":[1],"customClass":[1,"custom-class"]}]]]], options);
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
exports.setNonce = index.setNonce;
|
|
@@ -28185,6 +28185,23 @@ const SulaTextarea = class {
|
|
|
28185
28185
|
this.setLabelUp();
|
|
28186
28186
|
};
|
|
28187
28187
|
}
|
|
28188
|
+
watchValueHandler(newValue) {
|
|
28189
|
+
this.textValue = newValue;
|
|
28190
|
+
if (this.textareaElement && this.textareaElement.value !== newValue) {
|
|
28191
|
+
const cursorPosition = this.textareaElement.selectionStart;
|
|
28192
|
+
this.textareaElement.value = newValue || '';
|
|
28193
|
+
if (this.textareaIsFocused && cursorPosition !== null) {
|
|
28194
|
+
const newPosition = Math.min(cursorPosition, (newValue || '').length);
|
|
28195
|
+
this.textareaElement.setSelectionRange(newPosition, newPosition);
|
|
28196
|
+
}
|
|
28197
|
+
}
|
|
28198
|
+
if (newValue && newValue.trim().length > 0) {
|
|
28199
|
+
this.setLabelUp();
|
|
28200
|
+
}
|
|
28201
|
+
else if (!this.textareaIsFocused) {
|
|
28202
|
+
this.setLabelDown();
|
|
28203
|
+
}
|
|
28204
|
+
}
|
|
28188
28205
|
handleClick(event) {
|
|
28189
28206
|
if (!this.node || !this.textareaIsFocused)
|
|
28190
28207
|
return;
|
|
@@ -28232,39 +28249,42 @@ const SulaTextarea = class {
|
|
|
28232
28249
|
}
|
|
28233
28250
|
render() {
|
|
28234
28251
|
const containerHeight = this.rows * 24 + 48;
|
|
28235
|
-
return (index.h(index.Host, { key: '
|
|
28252
|
+
return (index.h(index.Host, { key: '71e17dbbb92c7a05d8988820c0599b39a0f841a2', ref: node => (this.node = node) }, index.h("div", { key: '9be717191ecd92216c42830dfda5ea14a3c5c939' }, index.h("div", { key: '3765ff81f012dce9438d9c00d694fb61864acf79', id: "textarea-container", class: {
|
|
28236
28253
|
'relative border rounded-sm px-16 py-12 outline-none caret-brand-primary': true,
|
|
28237
28254
|
'textarea-focus': this.textareaIsFocused && !this.disabled && this.status === SulaTextareaStatus.Default,
|
|
28238
28255
|
'textarea-error': this.status === SulaTextareaStatus.Error && !this.disabled,
|
|
28239
28256
|
'bg-states-bg-disabled border-line-general cursor-not-allowed': this.disabled,
|
|
28240
28257
|
'bg-surface-body border-line-input cursor-text': !this.disabled,
|
|
28241
|
-
}, style: { height: `${containerHeight}px` }, tabIndex: 0, onFocus: this.handleFocus, onClick: this.handleTextareaClick }, index.h("label", { key: '
|
|
28258
|
+
}, style: { height: `${containerHeight}px` }, tabIndex: 0, onFocus: this.handleFocus, onClick: this.handleTextareaClick }, index.h("label", { key: '252bc2b94a3a39a478a6c919bc181514eeb13891', class: {
|
|
28242
28259
|
'text-base top-16 left-12 absolute transition-all duration-200 ease-in-out pointer-events-none z-10 w-[85%]': true,
|
|
28243
28260
|
'text-text-primary': !this.disabled && (this.isActive || this.status === SulaTextareaStatus.Default),
|
|
28244
28261
|
'text-text-disabled': this.disabled,
|
|
28245
28262
|
'bg-surface-body': !this.disabled && this.isActive,
|
|
28246
|
-
}, ref: node => (this.labelElement = node) }, this.label), index.h("label", { key: '
|
|
28263
|
+
}, ref: node => (this.labelElement = node) }, this.label), index.h("label", { key: '71505a321c84a6c33668cb0f8e67877943225c99', class: {
|
|
28247
28264
|
'absolute font-bold transition-all duration-200 ease-in-out pointer-events-none z-10 active-label hidden from-down': true,
|
|
28248
28265
|
'text-sm top-12 left-16': this.isActive,
|
|
28249
28266
|
'text-text-primary': !this.disabled && (this.isActive || this.status === SulaTextareaStatus.Default),
|
|
28250
28267
|
'text-text-disabled': this.disabled,
|
|
28251
28268
|
'bg-surface-body': !this.disabled && this.isActive,
|
|
28252
|
-
}, ref: node => (this.activeLabelElement = node) }, this.label), index.h("textarea", { key: '
|
|
28269
|
+
}, ref: node => (this.activeLabelElement = node) }, this.label), index.h("textarea", { key: '55fdbfcf690c8198c62299d884cd85bba5f08346', ref: node => (this.textareaElement = node), placeholder: this.isActive ? this.placeholder : '', rows: this.rows, maxLength: this.maxLength, disabled: this.disabled, class: {
|
|
28253
28270
|
'w-full h-full outline-none text-base bg-transparent border-none resize-none': true,
|
|
28254
28271
|
'pt-6': this.isActive,
|
|
28255
28272
|
'pt-0': !this.isActive,
|
|
28256
28273
|
'text-text-primary': !this.disabled,
|
|
28257
28274
|
'text-text-disabled cursor-not-allowed overflow-hidden': this.disabled,
|
|
28258
|
-
}, onInput: this.handleTextareaChanges, onFocus: this.handleTextareaFocus, onBlur: this.handleBlur, value: this.textValue })), (this.helpText || this.maxLength) && (index.h("div", { key: '
|
|
28275
|
+
}, onInput: this.handleTextareaChanges, onFocus: this.handleTextareaFocus, onBlur: this.handleBlur, value: this.textValue })), (this.helpText || this.maxLength) && (index.h("div", { key: 'a4d90c39f337137a50ac71ffdd1f0b0714761de9', class: "flex justify-between items-center px-16 mt-4 text-sm" }, this.helpText && (index.h("div", { key: 'a1368830518a465f2d3bec91eec42966a5eee1c0', id: "textarea-help-text", class: {
|
|
28259
28276
|
'text-text-primary': this.status === SulaTextareaStatus.Default && !this.disabled,
|
|
28260
28277
|
'text-feedback-error': this.status === SulaTextareaStatus.Error && !this.disabled,
|
|
28261
28278
|
'text-text-disabled': this.disabled,
|
|
28262
|
-
} }, this.helpText)), this.maxLength && (index.h("div", { key: '
|
|
28279
|
+
} }, this.helpText)), this.maxLength && (index.h("div", { key: 'a53bdb59f7dfab7c276a9fd34921026f25bccf12', id: "max-length-container", class: {
|
|
28263
28280
|
'text-text-primary': this.status === SulaTextareaStatus.Default && !this.disabled,
|
|
28264
28281
|
'text-feedback-error': this.status === SulaTextareaStatus.Error && !this.disabled,
|
|
28265
28282
|
'text-text-disabled': this.disabled,
|
|
28266
28283
|
} }, this.textValue ? this.textValue.length : 0, "/", this.maxLength)))))));
|
|
28267
28284
|
}
|
|
28285
|
+
static get watchers() { return {
|
|
28286
|
+
"value": ["watchValueHandler"]
|
|
28287
|
+
}; }
|
|
28268
28288
|
};
|
|
28269
28289
|
SulaTextarea.style = sulaTextareaCss;
|
|
28270
28290
|
|
|
@@ -28305,6 +28325,7 @@ const SulaTextfield = class {
|
|
|
28305
28325
|
this.handleInputChanges = (event) => {
|
|
28306
28326
|
const newValue = event.target.value;
|
|
28307
28327
|
this.textValue = newValue;
|
|
28328
|
+
this.value = newValue;
|
|
28308
28329
|
this.valueChanged.emit(newValue);
|
|
28309
28330
|
};
|
|
28310
28331
|
this.handleFocus = () => {
|
|
@@ -28329,6 +28350,25 @@ const SulaTextfield = class {
|
|
|
28329
28350
|
}
|
|
28330
28351
|
};
|
|
28331
28352
|
}
|
|
28353
|
+
watchValueHandler(newValue) {
|
|
28354
|
+
this.textValue = newValue;
|
|
28355
|
+
if (this.inputElement && this.inputElement.value !== newValue) {
|
|
28356
|
+
const cursorPosition = this.inputElement.selectionStart;
|
|
28357
|
+
this.inputElement.value = newValue || '';
|
|
28358
|
+
if (this.inputIsFocused && cursorPosition !== null) {
|
|
28359
|
+
const newPosition = Math.min(cursorPosition, (newValue || '').length);
|
|
28360
|
+
this.inputElement.setSelectionRange(newPosition, newPosition);
|
|
28361
|
+
}
|
|
28362
|
+
}
|
|
28363
|
+
if (newValue && newValue.trim().length > 0) {
|
|
28364
|
+
this.inputIsOpen = true;
|
|
28365
|
+
this.changeElementsStyle();
|
|
28366
|
+
}
|
|
28367
|
+
else if (!this.inputIsFocused) {
|
|
28368
|
+
this.inputIsOpen = false;
|
|
28369
|
+
this.changeElementsStyle();
|
|
28370
|
+
}
|
|
28371
|
+
}
|
|
28332
28372
|
handleClick(event) {
|
|
28333
28373
|
if (!this.node || !this.inputIsFocused)
|
|
28334
28374
|
return;
|
|
@@ -28358,6 +28398,8 @@ const SulaTextfield = class {
|
|
|
28358
28398
|
this.inputElement.focus();
|
|
28359
28399
|
}
|
|
28360
28400
|
changeElementsStyle() {
|
|
28401
|
+
if (!this.inputContainer || !this.labelElement)
|
|
28402
|
+
return;
|
|
28361
28403
|
this.inputContainer.style.display = this.inputIsOpen ? 'flex' : 'none';
|
|
28362
28404
|
this.labelElement.style.display = this.inputIsOpen ? 'none' : 'block';
|
|
28363
28405
|
if (!this.inputIsOpen) {
|
|
@@ -28382,15 +28424,18 @@ const SulaTextfield = class {
|
|
|
28382
28424
|
return this.icon;
|
|
28383
28425
|
}
|
|
28384
28426
|
render() {
|
|
28385
|
-
return (index.h(index.Host, { key: '
|
|
28427
|
+
return (index.h(index.Host, { key: 'db19982329c8a6aa8989b3a68ef61a7453ee4a99', ref: node => (this.node = node) }, index.h("div", { key: 'daf060b490b07b535cb414b11c3c75f307f127aa' }, index.h("div", { key: '1d84aec41f352537a124311c076eceec3271832a', id: "button-container", class: {
|
|
28386
28428
|
'flex items-center border rounded-sm px-16 outline-none h-[72px] caret-brand-primary': true,
|
|
28387
28429
|
'flex-row justify-between': !!this.icon || this.type === SulaTextfieldType.Password,
|
|
28388
28430
|
'button-focus': this.inputIsFocused && !this.disabled && this.status === SulaTextfieldStatus.Default,
|
|
28389
28431
|
'button-error': this.status === SulaTextfieldStatus.Error && !this.disabled,
|
|
28390
28432
|
'bg-states-bg-disabled border-line-general cursor-not-allowed': this.disabled,
|
|
28391
28433
|
'bg-surface-body border-line-input cursor-pointer': !this.disabled,
|
|
28392
|
-
}, tabIndex: 0, onFocus: this.handleFocus, onClick: this.handleInputClick }, !this.disabled && (index.h("div", { key: '
|
|
28434
|
+
}, tabIndex: 0, onFocus: this.handleFocus, onClick: this.handleInputClick }, !this.disabled && (index.h("div", { key: '6ec4a250e1bcd8f053b2dba7e6e6fe6842c1b9bf', class: { 'hidden flex-col w-full': true, 'pr-12': !!this.icon }, ref: node => (this.inputContainer = node) }, index.h("label", { key: '001ef2edc750497dc82a65341f98289fd8d28c6d', class: "font-bold text-sm text-text-primary from-down" }, this.label), index.h("input", { key: '96c0725c63ed92ddbc164f8efcdc003707eb0115', 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.textValue }))), index.h("div", { key: 'f65cd97f9ddcadcc07789d8d3dc9421e82e31d78', 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) && (index.h("div", { key: '27596e159d5bcdd52f587350fa7ed619d5a6346e', class: "flex items-center justify-center", onClick: this.handleIconClick }, index.h("sula-icon", { key: '2fb87a5df61f3ed9f50f404ca8ff2988c71d10a7', icon: this.getInputIcon(), customClass: `text-2xl ${this.disabled ? 'text-icon-disabled' : 'text-icon-primary'}` })))), (this.helpText || this.maxLength) && !this.disabled && (index.h("div", { key: 'd54b53d64879e9a454a72c7e6726c8b0f5905baa', class: "flex justify-between items-center px-16 mt-4 text-sm" }, this.helpText && (index.h("div", { key: '7ded73f462e82f41b8766e4654cd47fabf3b3a40', id: "textfield-help-text", class: { 'text-text-primary': this.status === SulaTextfieldStatus.Default, 'text-feedback-error': this.status === SulaTextfieldStatus.Error } }, this.helpText)), this.maxLength && (index.h("div", { key: 'c62b62d8b8c99a775a31092479f1e4d8f581908c', 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)))))));
|
|
28393
28435
|
}
|
|
28436
|
+
static get watchers() { return {
|
|
28437
|
+
"value": ["watchValueHandler"]
|
|
28438
|
+
}; }
|
|
28394
28439
|
};
|
|
28395
28440
|
SulaTextfield.style = sulaTextfieldCss;
|
|
28396
28441
|
|