@sula-tech/webcomponents 0.11.2 → 0.11.3
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/sula-avatar_21.cjs.entry.js +6 -2
- package/dist/cjs/sula-avatar_21.cjs.entry.js.map +1 -1
- package/dist/collection/components/sula-textfield/sula-textfield.js +6 -2
- package/dist/collection/components/sula-textfield/sula-textfield.js.map +1 -1
- package/dist/collection/components/sula-textfield/sula-textfield.stories.js +61 -11
- package/dist/collection/components/sula-textfield/sula-textfield.stories.js.map +1 -1
- package/dist/components/sula-textfield.js +6 -2
- package/dist/components/sula-textfield.js.map +1 -1
- package/dist/esm/sula-avatar_21.entry.js +6 -2
- package/dist/esm/sula-avatar_21.entry.js.map +1 -1
- package/dist/webcomponents/{p-1b6e77dc.entry.js → p-0749814d.entry.js} +17 -13
- package/dist/webcomponents/{p-1b6e77dc.entry.js.map → p-0749814d.entry.js.map} +1 -1
- package/dist/webcomponents/webcomponents.esm.js +1 -1
- package/package.json +1 -1
|
@@ -85,6 +85,10 @@ export class SulaTextfield {
|
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
componentDidLoad() {
|
|
88
|
+
if (this.value && this.value.trim().length > 0 && this.inputElement) {
|
|
89
|
+
this.inputElement.value = this.value;
|
|
90
|
+
this.textValue = this.value;
|
|
91
|
+
}
|
|
88
92
|
if (this.textValue && this.textValue.trim().length > 0) {
|
|
89
93
|
this.changeElementsStyle();
|
|
90
94
|
}
|
|
@@ -129,14 +133,14 @@ export class SulaTextfield {
|
|
|
129
133
|
return this.icon;
|
|
130
134
|
}
|
|
131
135
|
render() {
|
|
132
|
-
return (h(Host, { key: '
|
|
136
|
+
return (h(Host, { key: 'b06e08483a4e05c4c0458991eee33683493e906a', ref: node => (this.node = node) }, h("div", { key: '16fa77d77f98e1dc9b4884f4d55eaae54fe1ecf6' }, h("div", { key: '194098398ef8219420a48cabb0b1b36b44d5d727', id: "button-container", class: {
|
|
133
137
|
'flex items-center border rounded-sm px-16 outline-none h-[72px] caret-brand-primary': true,
|
|
134
138
|
'flex-row justify-between': !!this.icon || this.type === SulaTextfieldType.Password,
|
|
135
139
|
'button-focus': this.inputIsFocused && !this.disabled && this.status === SulaTextfieldStatus.Default,
|
|
136
140
|
'button-error': this.status === SulaTextfieldStatus.Error && !this.disabled,
|
|
137
141
|
'bg-states-bg-disabled border-line-general cursor-not-allowed': this.disabled,
|
|
138
142
|
'bg-surface-body border-line-input cursor-pointer': !this.disabled,
|
|
139
|
-
}, tabIndex: 0, onFocus: this.handleFocus, onClick: this.handleInputClick }, !this.disabled && (h("div", { key: '
|
|
143
|
+
}, tabIndex: 0, onFocus: this.handleFocus, onClick: this.handleInputClick }, !this.disabled && (h("div", { key: '9795339bc40d505837b673b1350bd863829e4daa', class: { 'hidden flex-col w-full': true, 'pr-12': !!this.icon }, ref: node => (this.inputContainer = node) }, h("label", { key: '289548d1e1da0ef6a18106155c732307f2fedf67', class: "font-bold text-sm text-text-primary from-down" }, this.label), h("input", { key: 'e737484f921f93ca54f249b6e575e8c22a5e6660', 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 }))), h("div", { key: '44213cd6c32eb17d918f7087c58551c75a18206a', 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: '6ab542e64b6c48163ae8fc5d873258237ca253b2', class: "flex items-center justify-center", onClick: this.handleIconClick }, h("sula-icon", { key: '915aeca122f4ee3a28742b441c0f2067f4a8ce8a', icon: this.getInputIcon(), customClass: `text-2xl ${this.disabled ? 'text-icon-disabled' : 'text-icon-primary'}` })))), (this.helpText || this.maxLength) && !this.disabled && (h("div", { key: '81edcd13a69c02c31f913cd36768540417095e77', class: "flex justify-between items-center px-16 mt-4 text-sm" }, this.helpText && (h("div", { key: 'ff99921f928181450f106413cca5ba8ead39c897', 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: '29c954591b2426eb5cf3bdeedd7ae78161573647', 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)))))));
|
|
140
144
|
}
|
|
141
145
|
static get is() { return "sula-textfield"; }
|
|
142
146
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1 +1 @@
|
|
|
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,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AACpG,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACtF,OAAO,OAAO,MAAM,gBAAgB,CAAC;AAOrC,MAAM,OAAO,aAAa;IAL1B;QAYE;;WAEG;QACK,SAAI,GAAsB,iBAAiB,CAAC,IAAI,CAAC;QAEzD;;WAEG;QACsB,WAAM,GAAwB,mBAAmB,CAAC,OAAO,CAAC;QA2DnF,gBAAW,GAAG,KAAK,CAAC;QAGpB,cAAS,GAAW,EAAE,CAAC;QAGvB,iBAAY,GAAG,KAAK,CAAC;QAGrB,mBAAc,GAAG,KAAK,CAAC;QA6DvB,qBAAgB,GAAG,GAAG,EAAE;YACtB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC,CAAC;QAoBF,uBAAkB,GAAG,CAAC,KAAiB,EAAE,EAAE;YACzC,IAAI,IAAI,C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,CACP,CACG,CACP,CACG,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Event, EventEmitter, Host, Listen, Prop, State, Watch, h } from '@stencil/core';\nimport { SulaTextfieldStatus, SulaTextfieldType } from './model/sula-textfield.model';\nimport VMasker from 'vanilla-masker';\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 * The textfield mask pattern\n * The mask pattern should follow the VMasker pattern format\n * More info: https://github.com/vanilla-masker/vanilla-masker?tab=readme-ov-file#custom-pattern\n */\n @Prop()\n maskPattern?: 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 @Watch('value')\n watchValueHandler(newValue: string) {\n this.textValue = newValue;\n\n if (this.inputElement && this.inputElement.value !== newValue) {\n const cursorPosition = this.inputElement.selectionStart;\n this.inputElement.value = newValue || '';\n\n if (this.inputIsFocused && cursorPosition !== null) {\n const newPosition = Math.min(cursorPosition, (newValue || '').length);\n this.inputElement.setSelectionRange(newPosition, newPosition);\n }\n }\n\n if (newValue && newValue.trim().length > 0) {\n this.inputIsOpen = true;\n this.changeElementsStyle();\n } else if (!this.inputIsFocused) {\n this.inputIsOpen = false;\n this.changeElementsStyle();\n }\n }\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 if (this.maskPattern && this.inputElement) {\n this.handleInputMask();\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 if (!this.inputContainer || !this.labelElement) return;\n\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 if (this.maskPattern && this.inputElement) {\n this.handleInputMask();\n }\n const newValue = (event.target as HTMLInputElement).value;\n this.textValue = newValue;\n this.value = 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 handleInputMask() {\n VMasker(this.inputElement).maskPattern(this.maskPattern);\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.textValue}\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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;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Event, EventEmitter, Host, Listen, Prop, State, Watch, h } from '@stencil/core';\nimport { SulaTextfieldStatus, SulaTextfieldType } from './model/sula-textfield.model';\nimport VMasker from 'vanilla-masker';\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 * The textfield mask pattern\n * The mask pattern should follow the VMasker pattern format\n * More info: https://github.com/vanilla-masker/vanilla-masker?tab=readme-ov-file#custom-pattern\n */\n @Prop()\n maskPattern?: 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 @Watch('value')\n watchValueHandler(newValue: string) {\n this.textValue = newValue;\n\n if (this.inputElement && this.inputElement.value !== newValue) {\n const cursorPosition = this.inputElement.selectionStart;\n this.inputElement.value = newValue || '';\n\n if (this.inputIsFocused && cursorPosition !== null) {\n const newPosition = Math.min(cursorPosition, (newValue || '').length);\n this.inputElement.setSelectionRange(newPosition, newPosition);\n }\n }\n\n if (newValue && newValue.trim().length > 0) {\n this.inputIsOpen = true;\n this.changeElementsStyle();\n } else if (!this.inputIsFocused) {\n this.inputIsOpen = false;\n this.changeElementsStyle();\n }\n }\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.value && this.value.trim().length > 0 && this.inputElement) {\n this.inputElement.value = this.value;\n this.textValue = this.value;\n }\n \n if (this.textValue && this.textValue.trim().length > 0) {\n this.changeElementsStyle();\n }\n\n if (this.maskPattern && this.inputElement) {\n this.handleInputMask();\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 if (!this.inputContainer || !this.labelElement) return;\n\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 if (this.maskPattern && this.inputElement) {\n this.handleInputMask();\n }\n const newValue = (event.target as HTMLInputElement).value;\n this.textValue = newValue;\n this.value = 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 handleInputMask() {\n VMasker(this.inputElement).maskPattern(this.maskPattern);\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.textValue}\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"]}
|
|
@@ -40,7 +40,56 @@ export default {
|
|
|
40
40
|
maskPattern: {
|
|
41
41
|
control: 'text',
|
|
42
42
|
defaultValue: '',
|
|
43
|
-
description:
|
|
43
|
+
description: `Padrão de máscara utilizando vanilla-masker.
|
|
44
|
+
|
|
45
|
+
**Caracteres disponíveis:**
|
|
46
|
+
- \`9\` → Aceita apenas números (0-9)
|
|
47
|
+
- \`A\` → Aceita apenas letras (a-z, A-Z)
|
|
48
|
+
- \`S\` → Aceita letras e números
|
|
49
|
+
- Outros caracteres são tratados como literais (parênteses, traços, pontos, etc.)
|
|
50
|
+
|
|
51
|
+
**Exemplos de máscaras comuns:**
|
|
52
|
+
- Telefone: \`(99) 99999-9999\`
|
|
53
|
+
- CPF: \`999.999.999-99\`
|
|
54
|
+
- CNPJ: \`SS.SSS.SSS/SSSS-99\` (alfanumérico)
|
|
55
|
+
- CEP: \`99999-999\`
|
|
56
|
+
- Data: \`99/99/9999\`
|
|
57
|
+
- Cartão de crédito: \`9999 9999 9999 9999\`
|
|
58
|
+
- Hora: \`99:99\`
|
|
59
|
+
- Placa de carro: \`AAA-9A99\`
|
|
60
|
+
|
|
61
|
+
**Formas de uso:**
|
|
62
|
+
|
|
63
|
+
1. **Via HTML:**
|
|
64
|
+
\`\`\`html
|
|
65
|
+
<sula-textfield
|
|
66
|
+
label="Telefone"
|
|
67
|
+
mask-pattern="(99) 99999-9999"
|
|
68
|
+
placeholder="(00) 00000-0000">
|
|
69
|
+
</sula-textfield>
|
|
70
|
+
\`\`\`
|
|
71
|
+
|
|
72
|
+
2. **Via JavaScript:**
|
|
73
|
+
\`\`\`javascript
|
|
74
|
+
const textfield = document.createElement('sula-textfield');
|
|
75
|
+
textfield.label = 'CNPJ';
|
|
76
|
+
textfield.maskPattern = 'SS.SSS.SSS/SSSS-99';
|
|
77
|
+
textfield.placeholder = '00.000.000/0000-00';
|
|
78
|
+
\`\`\`
|
|
79
|
+
|
|
80
|
+
3. **Via Framework (React, Angular, Vue):**
|
|
81
|
+
\`\`\`jsx
|
|
82
|
+
<sula-textfield
|
|
83
|
+
label="CEP"
|
|
84
|
+
mask-pattern="99999-999"
|
|
85
|
+
placeholder="00000-000">
|
|
86
|
+
</sula-textfield>
|
|
87
|
+
\`\`\`
|
|
88
|
+
|
|
89
|
+
**Observações:**
|
|
90
|
+
- A máscara é apenas visual (formata mas não valida)
|
|
91
|
+
- O valor emitido no evento \`valueChanged\` já vem formatado
|
|
92
|
+
- A máscara é aplicada automaticamente conforme o usuário digita`,
|
|
44
93
|
type: {
|
|
45
94
|
required: false,
|
|
46
95
|
},
|
|
@@ -112,19 +161,20 @@ const Template = args => {
|
|
|
112
161
|
container.style.margin = '20px';
|
|
113
162
|
const el = document.createElement('sula-textfield');
|
|
114
163
|
if (args.value)
|
|
115
|
-
el.
|
|
116
|
-
el.
|
|
117
|
-
el.
|
|
118
|
-
el.
|
|
119
|
-
el.
|
|
120
|
-
el.
|
|
121
|
-
|
|
164
|
+
el.value = args.value;
|
|
165
|
+
el.type = args.type;
|
|
166
|
+
el.status = args.status;
|
|
167
|
+
el.label = args.label;
|
|
168
|
+
el.placeholder = args.placeholder;
|
|
169
|
+
el.disabled = args.disabled;
|
|
170
|
+
if (args.maskPattern)
|
|
171
|
+
el.maskPattern = args.maskPattern;
|
|
122
172
|
if (args.helpText)
|
|
123
|
-
el.
|
|
173
|
+
el.helpText = args.helpText;
|
|
124
174
|
if (args.maxLength > 0)
|
|
125
|
-
el.
|
|
175
|
+
el.maxLength = args.maxLength;
|
|
126
176
|
if (args.icon)
|
|
127
|
-
el.
|
|
177
|
+
el.icon = args.icon;
|
|
128
178
|
el.addEventListener('valueChanged', args.valueChanged);
|
|
129
179
|
el.addEventListener('focusedOn', args.focusedOn);
|
|
130
180
|
el.addEventListener('focusedOut', args.focusedOut);
|
|
@@ -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;QACR,KAAK,EAAE;YACL,OAAO,EAAE,MAAM;YACf,YAAY,EAAE,EAAE;YAChB,WAAW,EAAE,qBAAqB;YAClC,IAAI,EAAE;gBACJ,QAAQ,EAAE,KAAK;aAChB;SACF;QACD,IAAI,EAAE;YACJ,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC3B,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC;YACzC,YAA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ula-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 maskPattern: {\n control: 'text',\n defaultValue: '',\n description: 'The textfield mask pattern',\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 el.setAttribute('mask-pattern', args.maskPattern);\n\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 WithMask = Template.bind({});\nWithMask.args = {\n value: '',\n type: SulaTextfieldType.Text,\n status: SulaTextfieldStatus.Default,\n label: 'Telefone',\n placeholder: 'Digite seu telefone',\n disabled: false,\n helpText: '',\n maxLength: 0,\n icon: '',\n maskPattern: '(99) 99999-9999',\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,YAAY,EAAE,EAAE;YAChB,WAAW,EAAE,qBAAqB;YAClC,IAAI,EAAE;gBACJ,QAAQ,EAAE,KAAK;aAChB;SACF;QACD,IAAI,EAAE;YACJ,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC3B,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC;YACzC,YAAY,EAAE,iBAAiB,CAAC,IAAI;YACpC,WAAW,EAAE,oBAAoB;YACjC,IAAI,EAAE;gBACJ,QAAQ,EAAE,KAAK;aAChB;SACF;QACD,MAAM,EAAE;YACN,OAAO,EAAE,EAAE,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ACf,MAAM,EAAE,mBAAmB,CAAC,KAAK,EACjC,KAAK,EAAE,QAAQ,EACf,WAAW,EAAE,mBAAmB,EAChC,QAAQ,EAAE,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 maskPattern: {\n control: 'text',\n defaultValue: '',\n description: `Padrão de máscara utilizando vanilla-masker.\n\n**Caracteres disponíveis:**\n- \\`9\\` → Aceita apenas números (0-9)\n- \\`A\\` → Aceita apenas letras (a-z, A-Z)\n- \\`S\\` → Aceita letras e números\n- Outros caracteres são tratados como literais (parênteses, traços, pontos, etc.)\n\n**Exemplos de máscaras comuns:**\n- Telefone: \\`(99) 99999-9999\\`\n- CPF: \\`999.999.999-99\\`\n- CNPJ: \\`SS.SSS.SSS/SSSS-99\\` (alfanumérico)\n- CEP: \\`99999-999\\`\n- Data: \\`99/99/9999\\`\n- Cartão de crédito: \\`9999 9999 9999 9999\\`\n- Hora: \\`99:99\\`\n- Placa de carro: \\`AAA-9A99\\`\n\n**Formas de uso:**\n\n1. **Via HTML:**\n\\`\\`\\`html\n<sula-textfield \n label=\"Telefone\" \n mask-pattern=\"(99) 99999-9999\"\n placeholder=\"(00) 00000-0000\">\n</sula-textfield>\n\\`\\`\\`\n\n2. **Via JavaScript:**\n\\`\\`\\`javascript\nconst textfield = document.createElement('sula-textfield');\ntextfield.label = 'CNPJ';\ntextfield.maskPattern = 'SS.SSS.SSS/SSSS-99';\ntextfield.placeholder = '00.000.000/0000-00';\n\\`\\`\\`\n\n3. **Via Framework (React, Angular, Vue):**\n\\`\\`\\`jsx\n<sula-textfield \n label=\"CEP\"\n mask-pattern=\"99999-999\"\n placeholder=\"00000-000\">\n</sula-textfield>\n\\`\\`\\`\n\n**Observações:**\n- A máscara é apenas visual (formata mas não valida)\n- O valor emitido no evento \\`valueChanged\\` já vem formatado\n- A máscara é aplicada automaticamente conforme o usuário digita`,\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.value = args.value;\n el.type = args.type;\n el.status = args.status;\n el.label = args.label;\n el.placeholder = args.placeholder;\n el.disabled = args.disabled;\n if (args.maskPattern) el.maskPattern = args.maskPattern;\n if (args.helpText) el.helpText = args.helpText;\n if (args.maxLength > 0) el.maxLength = args.maxLength;\n if (args.icon) el.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 WithMask = Template.bind({});\nWithMask.args = {\n value: '',\n type: SulaTextfieldType.Text,\n status: SulaTextfieldStatus.Default,\n label: 'Telefone',\n placeholder: 'Digite seu telefone',\n disabled: false,\n helpText: '',\n maxLength: 0,\n icon: '',\n maskPattern: '(99) 99999-9999',\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"]}
|
|
@@ -340,6 +340,10 @@ const SulaTextfield$1 = /*@__PURE__*/ proxyCustomElement(class SulaTextfield ext
|
|
|
340
340
|
}
|
|
341
341
|
}
|
|
342
342
|
componentDidLoad() {
|
|
343
|
+
if (this.value && this.value.trim().length > 0 && this.inputElement) {
|
|
344
|
+
this.inputElement.value = this.value;
|
|
345
|
+
this.textValue = this.value;
|
|
346
|
+
}
|
|
343
347
|
if (this.textValue && this.textValue.trim().length > 0) {
|
|
344
348
|
this.changeElementsStyle();
|
|
345
349
|
}
|
|
@@ -384,14 +388,14 @@ const SulaTextfield$1 = /*@__PURE__*/ proxyCustomElement(class SulaTextfield ext
|
|
|
384
388
|
return this.icon;
|
|
385
389
|
}
|
|
386
390
|
render() {
|
|
387
|
-
return (h(Host, { key: '
|
|
391
|
+
return (h(Host, { key: 'b06e08483a4e05c4c0458991eee33683493e906a', ref: node => (this.node = node) }, h("div", { key: '16fa77d77f98e1dc9b4884f4d55eaae54fe1ecf6' }, h("div", { key: '194098398ef8219420a48cabb0b1b36b44d5d727', id: "button-container", class: {
|
|
388
392
|
'flex items-center border rounded-sm px-16 outline-none h-[72px] caret-brand-primary': true,
|
|
389
393
|
'flex-row justify-between': !!this.icon || this.type === SulaTextfieldType.Password,
|
|
390
394
|
'button-focus': this.inputIsFocused && !this.disabled && this.status === SulaTextfieldStatus.Default,
|
|
391
395
|
'button-error': this.status === SulaTextfieldStatus.Error && !this.disabled,
|
|
392
396
|
'bg-states-bg-disabled border-line-general cursor-not-allowed': this.disabled,
|
|
393
397
|
'bg-surface-body border-line-input cursor-pointer': !this.disabled,
|
|
394
|
-
}, tabIndex: 0, onFocus: this.handleFocus, onClick: this.handleInputClick }, !this.disabled && (h("div", { key: '
|
|
398
|
+
}, tabIndex: 0, onFocus: this.handleFocus, onClick: this.handleInputClick }, !this.disabled && (h("div", { key: '9795339bc40d505837b673b1350bd863829e4daa', class: { 'hidden flex-col w-full': true, 'pr-12': !!this.icon }, ref: node => (this.inputContainer = node) }, h("label", { key: '289548d1e1da0ef6a18106155c732307f2fedf67', class: "font-bold text-sm text-text-primary from-down" }, this.label), h("input", { key: 'e737484f921f93ca54f249b6e575e8c22a5e6660', 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 }))), h("div", { key: '44213cd6c32eb17d918f7087c58551c75a18206a', 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: '6ab542e64b6c48163ae8fc5d873258237ca253b2', class: "flex items-center justify-center", onClick: this.handleIconClick }, h("sula-icon", { key: '915aeca122f4ee3a28742b441c0f2067f4a8ce8a', icon: this.getInputIcon(), customClass: `text-2xl ${this.disabled ? 'text-icon-disabled' : 'text-icon-primary'}` })))), (this.helpText || this.maxLength) && !this.disabled && (h("div", { key: '81edcd13a69c02c31f913cd36768540417095e77', class: "flex justify-between items-center px-16 mt-4 text-sm" }, this.helpText && (h("div", { key: 'ff99921f928181450f106413cca5ba8ead39c897', 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: '29c954591b2426eb5cf3bdeedd7ae78161573647', 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)))))));
|
|
395
399
|
}
|
|
396
400
|
static get watchers() { return {
|
|
397
401
|
"value": ["watchValueHandler"]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"sula-textfield.js","mappings":";;;;AAAA,IAAY,iBAGX;AAHD,CAAA,UAAY,iBAAiB,EAAA;AAC3B,IAAA,iBAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,iBAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACvB,CAAC,EAHW,iBAAiB,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AAmB,EAAE,IAAI,CAAC,MAAM,KAAK,mBAAmB,CAAC,OAAO,EAAE,qBAAqB,EAAE,IAAI,CAAC,MAAM,KAAK,mBAAmB,CAAC,KAAK,EAAE,EAAA,EAE5I,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,OAAG,IAAI,CAAC,SAAS,CACxD,CACP,CACG,CACP,CACG,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["this","SulaTextfield","__stencil_proxyCustomElement","HTMLElement"],"sources":["src/components/sula-textfield/model/sula-textfield.model.ts","node_modules/.pnpm/vanilla-masker@1.2.0/node_modules/vanilla-masker/lib/vanilla-masker.js","src/components/sula-textfield/sula-textfield.scss?tag=sula-textfield&encapsulation=shadow","src/components/sula-textfield/sula-textfield.tsx"],"sourcesContent":["export enum SulaTextfieldType {\n Text = 'text',\n Password = 'password',\n}\n\nexport enum SulaTextfieldStatus {\n Default = 'default',\n Error = 'error',\n}\n","(function(root, factory) {\n if (typeof define === 'function' && define.amd) {\n define(factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.VMasker = factory();\n }\n}(this, function() {\n var DIGIT = \"9\",\n ALPHA = \"A\",\n ALPHANUM = \"S\",\n BY_PASS_KEYS = [9, 16, 17, 18, 36, 37, 38, 39, 40, 91, 92, 93],\n isAllowedKeyCode = function(keyCode) {\n for (var i = 0, len = BY_PASS_KEYS.length; i < len; i++) {\n if (keyCode == BY_PASS_KEYS[i]) {\n return false;\n }\n }\n return true;\n },\n mergeMoneyOptions = function(opts) {\n opts = opts || {};\n opts = {\n delimiter: opts.delimiter || \".\",\n lastOutput: opts.lastOutput,\n precision: opts.hasOwnProperty(\"precision\") ? opts.precision : 2,\n separator: opts.separator || \",\",\n showSignal: opts.showSignal,\n suffixUnit: opts.suffixUnit && (\" \" + opts.suffixUnit.replace(/[\\s]/g,'')) || \"\",\n unit: opts.unit && (opts.unit.replace(/[\\s]/g,'') + \" \") || \"\",\n zeroCents: opts.zeroCents\n };\n opts.moneyPrecision = opts.zeroCents ? 0 : opts.precision;\n return opts;\n },\n // Fill wildcards past index in output with placeholder\n addPlaceholdersToOutput = function(output, index, placeholder) {\n for (; index < output.length; index++) {\n if(output[index] === DIGIT || output[index] === ALPHA || output[index] === ALPHANUM) {\n output[index] = placeholder;\n }\n }\n return output;\n }\n ;\n\n var VanillaMasker = function(elements) {\n this.elements = elements;\n };\n\n VanillaMasker.prototype.unbindElementToMask = function() {\n for (var i = 0, len = this.elements.length; i < len; i++) {\n this.elements[i].lastOutput = \"\";\n this.elements[i].onkeyup = false;\n this.elements[i].onkeydown = false;\n\n if (this.elements[i].value.length) {\n this.elements[i].value = this.elements[i].value.replace(/\\D/g, '');\n }\n }\n };\n\n VanillaMasker.prototype.bindElementToMask = function(maskFunction) {\n var that = this,\n onType = function(e) {\n e = e || window.event;\n var source = e.target || e.srcElement;\n\n if (isAllowedKeyCode(e.keyCode)) {\n setTimeout(function() {\n that.opts.lastOutput = source.lastOutput;\n source.value = VMasker[maskFunction](source.value, that.opts);\n source.lastOutput = source.value;\n if (source.setSelectionRange && that.opts.suffixUnit) {\n source.setSelectionRange(source.value.length, (source.value.length - that.opts.suffixUnit.length));\n }\n }, 0);\n }\n }\n ;\n for (var i = 0, len = this.elements.length; i < len; i++) {\n this.elements[i].lastOutput = \"\";\n this.elements[i].onkeyup = onType;\n if (this.elements[i].value.length) {\n this.elements[i].value = VMasker[maskFunction](this.elements[i].value, this.opts);\n }\n }\n };\n\n VanillaMasker.prototype.maskMoney = function(opts) {\n this.opts = mergeMoneyOptions(opts);\n this.bindElementToMask(\"toMoney\");\n };\n\n VanillaMasker.prototype.maskNumber = function() {\n this.opts = {};\n this.bindElementToMask(\"toNumber\");\n };\n \n VanillaMasker.prototype.maskAlphaNum = function() {\n this.opts = {};\n this.bindElementToMask(\"toAlphaNumeric\");\n };\n\n VanillaMasker.prototype.maskPattern = function(pattern) {\n this.opts = {pattern: pattern};\n this.bindElementToMask(\"toPattern\");\n };\n\n VanillaMasker.prototype.unMask = function() {\n this.unbindElementToMask();\n };\n\n var VMasker = function(el) {\n if (!el) {\n throw new Error(\"VanillaMasker: There is no element to bind.\");\n }\n var elements = (\"length\" in el) ? (el.length ? el : []) : [el];\n return new VanillaMasker(elements);\n };\n\n VMasker.toMoney = function(value, opts) {\n opts = mergeMoneyOptions(opts);\n if (opts.zeroCents) {\n opts.lastOutput = opts.lastOutput || \"\";\n var zeroMatcher = (\"(\"+ opts.separator +\"[0]{0,\"+ opts.precision +\"})\"),\n zeroRegExp = new RegExp(zeroMatcher, \"g\"),\n digitsLength = value.toString().replace(/[\\D]/g, \"\").length || 0,\n lastDigitLength = opts.lastOutput.toString().replace(/[\\D]/g, \"\").length || 0\n ;\n value = value.toString().replace(zeroRegExp, \"\");\n if (digitsLength < lastDigitLength) {\n value = value.slice(0, value.length - 1);\n }\n }\n var number = value.toString().replace(/[\\D]/g, \"\"),\n clearDelimiter = new RegExp(\"^(0|\\\\\"+ opts.delimiter +\")\"),\n clearSeparator = new RegExp(\"(\\\\\"+ opts.separator +\")$\"),\n money = number.substr(0, number.length - opts.moneyPrecision),\n masked = money.substr(0, money.length % 3),\n cents = new Array(opts.precision + 1).join(\"0\")\n ;\n money = money.substr(money.length % 3, money.length);\n for (var i = 0, len = money.length; i < len; i++) {\n if (i % 3 === 0) {\n masked += opts.delimiter;\n }\n masked += money[i];\n }\n masked = masked.replace(clearDelimiter, \"\");\n masked = masked.length ? masked : \"0\";\n var signal = \"\";\n if(opts.showSignal === true) {\n signal = value < 0 || (value.startsWith && value.startsWith('-')) ? \"-\" : \"\";\n }\n if (!opts.zeroCents) {\n var beginCents = number.length - opts.precision,\n centsValue = number.substr(beginCents, opts.precision),\n centsLength = centsValue.length,\n centsSliced = (opts.precision > centsLength) ? opts.precision : centsLength\n ;\n cents = (cents + centsValue).slice(-centsSliced);\n }\n var output = opts.unit + signal + masked + opts.separator + cents;\n return output.replace(clearSeparator, \"\") + opts.suffixUnit;\n };\n\n VMasker.toPattern = function(value, opts) {\n var pattern = (typeof opts === 'object' ? opts.pattern : opts),\n patternChars = pattern.replace(/\\W/g, ''),\n output = pattern.split(\"\"),\n values = value.toString().replace(/\\W/g, \"\"),\n charsValues = values.replace(/\\W/g, ''),\n index = 0,\n i,\n outputLength = output.length,\n placeholder = (typeof opts === 'object' ? opts.placeholder : undefined)\n ;\n \n for (i = 0; i < outputLength; i++) {\n // Reached the end of input\n if (index >= values.length) {\n if (patternChars.length == charsValues.length) {\n return output.join(\"\");\n }\n else if ((placeholder !== undefined) && (patternChars.length > charsValues.length)) {\n return addPlaceholdersToOutput(output, i, placeholder).join(\"\");\n }\n else {\n break;\n }\n }\n // Remaining chars in input\n else{\n if ((output[i] === DIGIT && values[index].match(/[0-9]/)) ||\n (output[i] === ALPHA && values[index].match(/[a-zA-Z]/)) ||\n (output[i] === ALPHANUM && values[index].match(/[0-9a-zA-Z]/))) {\n output[i] = values[index++];\n } else if (output[i] === DIGIT || output[i] === ALPHA || output[i] === ALPHANUM) {\n if(placeholder !== undefined){\n return addPlaceholdersToOutput(output, i, placeholder).join(\"\");\n }\n else{\n return output.slice(0, i).join(\"\");\n }\n }\n }\n }\n return output.join(\"\").substr(0, i);\n };\n\n VMasker.toNumber = function(value) {\n return value.toString().replace(/(?!^-)[^0-9]/g, \"\");\n };\n \n VMasker.toAlphaNumeric = function(value) {\n return value.toString().replace(/[^a-z0-9 ]+/i, \"\");\n };\n\n return VMasker;\n}));\n",":host {\n display: block;\n}\n\n.button-focus {\n outline: 2px solid var(--color-feedback-informational) !important;\n outline-offset: 2px !important;\n}\n\n.button-error {\n outline: 2px solid var(--color-feedback-error) !important;\n outline-offset: 2px !important;\n}\n\n.from-down {\n animation: from-down 0.2s ease-in-out;\n}\n\n.from-up {\n animation: from-up 0.2s ease-in-out;\n}\n\n@keyframes from-down {\n from {\n transform: translateY(75%);\n opacity: 0;\n }\n to {\n transform: translateY(0);\n opacity: 1;\n }\n}\n\n@keyframes from-up {\n from {\n transform: translateY(-75%);\n opacity: 0;\n }\n to {\n transform: translateY(0);\n opacity: 1;\n }\n}\n","import { Component, Event, EventEmitter, Host, Listen, Prop, State, Watch, h } from '@stencil/core';\nimport { SulaTextfieldStatus, SulaTextfieldType } from './model/sula-textfield.model';\nimport VMasker from 'vanilla-masker';\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 * The textfield mask pattern\n * The mask pattern should follow the VMasker pattern format\n * More info: https://github.com/vanilla-masker/vanilla-masker?tab=readme-ov-file#custom-pattern\n */\n @Prop()\n maskPattern?: 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 @Watch('value')\n watchValueHandler(newValue: string) {\n this.textValue = newValue;\n\n if (this.inputElement && this.inputElement.value !== newValue) {\n const cursorPosition = this.inputElement.selectionStart;\n this.inputElement.value = newValue || '';\n\n if (this.inputIsFocused && cursorPosition !== null) {\n const newPosition = Math.min(cursorPosition, (newValue || '').length);\n this.inputElement.setSelectionRange(newPosition, newPosition);\n }\n }\n\n if (newValue && newValue.trim().length > 0) {\n this.inputIsOpen = true;\n this.changeElementsStyle();\n } else if (!this.inputIsFocused) {\n this.inputIsOpen = false;\n this.changeElementsStyle();\n }\n }\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 if (this.maskPattern && this.inputElement) {\n this.handleInputMask();\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 if (!this.inputContainer || !this.labelElement) return;\n\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 if (this.maskPattern && this.inputElement) {\n this.handleInputMask();\n }\n const newValue = (event.target as HTMLInputElement).value;\n this.textValue = newValue;\n this.value = 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 handleInputMask() {\n VMasker(this.inputElement).maskPattern(this.maskPattern);\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.textValue}\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"],"version":3}
|
|
1
|
+
{"file":"sula-textfield.js","mappings":";;;;AAAA,IAAY,iBAGX;AAHD,CAAA,UAAY,iBAAiB,EAAA;AAC3B,IAAA,iBAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,iBAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACvB,CAAC,EAHW,iBAAiB,KAAjB,iBAAiB,GAG5B,EAAA,CAAA,CAAA;AAED,IAAY,mBAGX;AAHD,CAAA,UAAY,mBAAmB,EAAA;AAC7B,IAAA,mBAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,mBAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACjB,CAAC,EAHW,mBAAmB,KAAnB,mBA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AAK,EAAE,EAAE,mBAAmB,EAAE,IAAI,CAAC,MAAM,KAAK,mBAAmB,CAAC,OAAO,EAAE,qBAAqB,EAAE,IAAI,CAAC,MAAM,KAAK,mBAAmB,CAAC,KAAK,EAAE,EAAA,EAE5I,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,OAAG,IAAI,CAAC,SAAS,CACxD,CACP,CACG,CACP,CACG,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["this","SulaTextfield","__stencil_proxyCustomElement","HTMLElement"],"sources":["src/components/sula-textfield/model/sula-textfield.model.ts","node_modules/.pnpm/vanilla-masker@1.2.0/node_modules/vanilla-masker/lib/vanilla-masker.js","src/components/sula-textfield/sula-textfield.scss?tag=sula-textfield&encapsulation=shadow","src/components/sula-textfield/sula-textfield.tsx"],"sourcesContent":["export enum SulaTextfieldType {\n Text = 'text',\n Password = 'password',\n}\n\nexport enum SulaTextfieldStatus {\n Default = 'default',\n Error = 'error',\n}\n","(function(root, factory) {\n if (typeof define === 'function' && define.amd) {\n define(factory);\n } else if (typeof exports === 'object') {\n module.exports = factory();\n } else {\n root.VMasker = factory();\n }\n}(this, function() {\n var DIGIT = \"9\",\n ALPHA = \"A\",\n ALPHANUM = \"S\",\n BY_PASS_KEYS = [9, 16, 17, 18, 36, 37, 38, 39, 40, 91, 92, 93],\n isAllowedKeyCode = function(keyCode) {\n for (var i = 0, len = BY_PASS_KEYS.length; i < len; i++) {\n if (keyCode == BY_PASS_KEYS[i]) {\n return false;\n }\n }\n return true;\n },\n mergeMoneyOptions = function(opts) {\n opts = opts || {};\n opts = {\n delimiter: opts.delimiter || \".\",\n lastOutput: opts.lastOutput,\n precision: opts.hasOwnProperty(\"precision\") ? opts.precision : 2,\n separator: opts.separator || \",\",\n showSignal: opts.showSignal,\n suffixUnit: opts.suffixUnit && (\" \" + opts.suffixUnit.replace(/[\\s]/g,'')) || \"\",\n unit: opts.unit && (opts.unit.replace(/[\\s]/g,'') + \" \") || \"\",\n zeroCents: opts.zeroCents\n };\n opts.moneyPrecision = opts.zeroCents ? 0 : opts.precision;\n return opts;\n },\n // Fill wildcards past index in output with placeholder\n addPlaceholdersToOutput = function(output, index, placeholder) {\n for (; index < output.length; index++) {\n if(output[index] === DIGIT || output[index] === ALPHA || output[index] === ALPHANUM) {\n output[index] = placeholder;\n }\n }\n return output;\n }\n ;\n\n var VanillaMasker = function(elements) {\n this.elements = elements;\n };\n\n VanillaMasker.prototype.unbindElementToMask = function() {\n for (var i = 0, len = this.elements.length; i < len; i++) {\n this.elements[i].lastOutput = \"\";\n this.elements[i].onkeyup = false;\n this.elements[i].onkeydown = false;\n\n if (this.elements[i].value.length) {\n this.elements[i].value = this.elements[i].value.replace(/\\D/g, '');\n }\n }\n };\n\n VanillaMasker.prototype.bindElementToMask = function(maskFunction) {\n var that = this,\n onType = function(e) {\n e = e || window.event;\n var source = e.target || e.srcElement;\n\n if (isAllowedKeyCode(e.keyCode)) {\n setTimeout(function() {\n that.opts.lastOutput = source.lastOutput;\n source.value = VMasker[maskFunction](source.value, that.opts);\n source.lastOutput = source.value;\n if (source.setSelectionRange && that.opts.suffixUnit) {\n source.setSelectionRange(source.value.length, (source.value.length - that.opts.suffixUnit.length));\n }\n }, 0);\n }\n }\n ;\n for (var i = 0, len = this.elements.length; i < len; i++) {\n this.elements[i].lastOutput = \"\";\n this.elements[i].onkeyup = onType;\n if (this.elements[i].value.length) {\n this.elements[i].value = VMasker[maskFunction](this.elements[i].value, this.opts);\n }\n }\n };\n\n VanillaMasker.prototype.maskMoney = function(opts) {\n this.opts = mergeMoneyOptions(opts);\n this.bindElementToMask(\"toMoney\");\n };\n\n VanillaMasker.prototype.maskNumber = function() {\n this.opts = {};\n this.bindElementToMask(\"toNumber\");\n };\n \n VanillaMasker.prototype.maskAlphaNum = function() {\n this.opts = {};\n this.bindElementToMask(\"toAlphaNumeric\");\n };\n\n VanillaMasker.prototype.maskPattern = function(pattern) {\n this.opts = {pattern: pattern};\n this.bindElementToMask(\"toPattern\");\n };\n\n VanillaMasker.prototype.unMask = function() {\n this.unbindElementToMask();\n };\n\n var VMasker = function(el) {\n if (!el) {\n throw new Error(\"VanillaMasker: There is no element to bind.\");\n }\n var elements = (\"length\" in el) ? (el.length ? el : []) : [el];\n return new VanillaMasker(elements);\n };\n\n VMasker.toMoney = function(value, opts) {\n opts = mergeMoneyOptions(opts);\n if (opts.zeroCents) {\n opts.lastOutput = opts.lastOutput || \"\";\n var zeroMatcher = (\"(\"+ opts.separator +\"[0]{0,\"+ opts.precision +\"})\"),\n zeroRegExp = new RegExp(zeroMatcher, \"g\"),\n digitsLength = value.toString().replace(/[\\D]/g, \"\").length || 0,\n lastDigitLength = opts.lastOutput.toString().replace(/[\\D]/g, \"\").length || 0\n ;\n value = value.toString().replace(zeroRegExp, \"\");\n if (digitsLength < lastDigitLength) {\n value = value.slice(0, value.length - 1);\n }\n }\n var number = value.toString().replace(/[\\D]/g, \"\"),\n clearDelimiter = new RegExp(\"^(0|\\\\\"+ opts.delimiter +\")\"),\n clearSeparator = new RegExp(\"(\\\\\"+ opts.separator +\")$\"),\n money = number.substr(0, number.length - opts.moneyPrecision),\n masked = money.substr(0, money.length % 3),\n cents = new Array(opts.precision + 1).join(\"0\")\n ;\n money = money.substr(money.length % 3, money.length);\n for (var i = 0, len = money.length; i < len; i++) {\n if (i % 3 === 0) {\n masked += opts.delimiter;\n }\n masked += money[i];\n }\n masked = masked.replace(clearDelimiter, \"\");\n masked = masked.length ? masked : \"0\";\n var signal = \"\";\n if(opts.showSignal === true) {\n signal = value < 0 || (value.startsWith && value.startsWith('-')) ? \"-\" : \"\";\n }\n if (!opts.zeroCents) {\n var beginCents = number.length - opts.precision,\n centsValue = number.substr(beginCents, opts.precision),\n centsLength = centsValue.length,\n centsSliced = (opts.precision > centsLength) ? opts.precision : centsLength\n ;\n cents = (cents + centsValue).slice(-centsSliced);\n }\n var output = opts.unit + signal + masked + opts.separator + cents;\n return output.replace(clearSeparator, \"\") + opts.suffixUnit;\n };\n\n VMasker.toPattern = function(value, opts) {\n var pattern = (typeof opts === 'object' ? opts.pattern : opts),\n patternChars = pattern.replace(/\\W/g, ''),\n output = pattern.split(\"\"),\n values = value.toString().replace(/\\W/g, \"\"),\n charsValues = values.replace(/\\W/g, ''),\n index = 0,\n i,\n outputLength = output.length,\n placeholder = (typeof opts === 'object' ? opts.placeholder : undefined)\n ;\n \n for (i = 0; i < outputLength; i++) {\n // Reached the end of input\n if (index >= values.length) {\n if (patternChars.length == charsValues.length) {\n return output.join(\"\");\n }\n else if ((placeholder !== undefined) && (patternChars.length > charsValues.length)) {\n return addPlaceholdersToOutput(output, i, placeholder).join(\"\");\n }\n else {\n break;\n }\n }\n // Remaining chars in input\n else{\n if ((output[i] === DIGIT && values[index].match(/[0-9]/)) ||\n (output[i] === ALPHA && values[index].match(/[a-zA-Z]/)) ||\n (output[i] === ALPHANUM && values[index].match(/[0-9a-zA-Z]/))) {\n output[i] = values[index++];\n } else if (output[i] === DIGIT || output[i] === ALPHA || output[i] === ALPHANUM) {\n if(placeholder !== undefined){\n return addPlaceholdersToOutput(output, i, placeholder).join(\"\");\n }\n else{\n return output.slice(0, i).join(\"\");\n }\n }\n }\n }\n return output.join(\"\").substr(0, i);\n };\n\n VMasker.toNumber = function(value) {\n return value.toString().replace(/(?!^-)[^0-9]/g, \"\");\n };\n \n VMasker.toAlphaNumeric = function(value) {\n return value.toString().replace(/[^a-z0-9 ]+/i, \"\");\n };\n\n return VMasker;\n}));\n",":host {\n display: block;\n}\n\n.button-focus {\n outline: 2px solid var(--color-feedback-informational) !important;\n outline-offset: 2px !important;\n}\n\n.button-error {\n outline: 2px solid var(--color-feedback-error) !important;\n outline-offset: 2px !important;\n}\n\n.from-down {\n animation: from-down 0.2s ease-in-out;\n}\n\n.from-up {\n animation: from-up 0.2s ease-in-out;\n}\n\n@keyframes from-down {\n from {\n transform: translateY(75%);\n opacity: 0;\n }\n to {\n transform: translateY(0);\n opacity: 1;\n }\n}\n\n@keyframes from-up {\n from {\n transform: translateY(-75%);\n opacity: 0;\n }\n to {\n transform: translateY(0);\n opacity: 1;\n }\n}\n","import { Component, Event, EventEmitter, Host, Listen, Prop, State, Watch, h } from '@stencil/core';\nimport { SulaTextfieldStatus, SulaTextfieldType } from './model/sula-textfield.model';\nimport VMasker from 'vanilla-masker';\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 * The textfield mask pattern\n * The mask pattern should follow the VMasker pattern format\n * More info: https://github.com/vanilla-masker/vanilla-masker?tab=readme-ov-file#custom-pattern\n */\n @Prop()\n maskPattern?: 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 @Watch('value')\n watchValueHandler(newValue: string) {\n this.textValue = newValue;\n\n if (this.inputElement && this.inputElement.value !== newValue) {\n const cursorPosition = this.inputElement.selectionStart;\n this.inputElement.value = newValue || '';\n\n if (this.inputIsFocused && cursorPosition !== null) {\n const newPosition = Math.min(cursorPosition, (newValue || '').length);\n this.inputElement.setSelectionRange(newPosition, newPosition);\n }\n }\n\n if (newValue && newValue.trim().length > 0) {\n this.inputIsOpen = true;\n this.changeElementsStyle();\n } else if (!this.inputIsFocused) {\n this.inputIsOpen = false;\n this.changeElementsStyle();\n }\n }\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.value && this.value.trim().length > 0 && this.inputElement) {\n this.inputElement.value = this.value;\n this.textValue = this.value;\n }\n \n if (this.textValue && this.textValue.trim().length > 0) {\n this.changeElementsStyle();\n }\n\n if (this.maskPattern && this.inputElement) {\n this.handleInputMask();\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 if (!this.inputContainer || !this.labelElement) return;\n\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 if (this.maskPattern && this.inputElement) {\n this.handleInputMask();\n }\n const newValue = (event.target as HTMLInputElement).value;\n this.textValue = newValue;\n this.value = 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 handleInputMask() {\n VMasker(this.inputElement).maskPattern(this.maskPattern);\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.textValue}\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"],"version":3}
|
|
@@ -29116,6 +29116,10 @@ const SulaTextfield = class {
|
|
|
29116
29116
|
}
|
|
29117
29117
|
}
|
|
29118
29118
|
componentDidLoad() {
|
|
29119
|
+
if (this.value && this.value.trim().length > 0 && this.inputElement) {
|
|
29120
|
+
this.inputElement.value = this.value;
|
|
29121
|
+
this.textValue = this.value;
|
|
29122
|
+
}
|
|
29119
29123
|
if (this.textValue && this.textValue.trim().length > 0) {
|
|
29120
29124
|
this.changeElementsStyle();
|
|
29121
29125
|
}
|
|
@@ -29160,14 +29164,14 @@ const SulaTextfield = class {
|
|
|
29160
29164
|
return this.icon;
|
|
29161
29165
|
}
|
|
29162
29166
|
render() {
|
|
29163
|
-
return (h$1(Host, { key: '
|
|
29167
|
+
return (h$1(Host, { key: 'b06e08483a4e05c4c0458991eee33683493e906a', ref: node => (this.node = node) }, h$1("div", { key: '16fa77d77f98e1dc9b4884f4d55eaae54fe1ecf6' }, h$1("div", { key: '194098398ef8219420a48cabb0b1b36b44d5d727', id: "button-container", class: {
|
|
29164
29168
|
'flex items-center border rounded-sm px-16 outline-none h-[72px] caret-brand-primary': true,
|
|
29165
29169
|
'flex-row justify-between': !!this.icon || this.type === SulaTextfieldType.Password,
|
|
29166
29170
|
'button-focus': this.inputIsFocused && !this.disabled && this.status === SulaTextfieldStatus.Default,
|
|
29167
29171
|
'button-error': this.status === SulaTextfieldStatus.Error && !this.disabled,
|
|
29168
29172
|
'bg-states-bg-disabled border-line-general cursor-not-allowed': this.disabled,
|
|
29169
29173
|
'bg-surface-body border-line-input cursor-pointer': !this.disabled,
|
|
29170
|
-
}, tabIndex: 0, onFocus: this.handleFocus, onClick: this.handleInputClick }, !this.disabled && (h$1("div", { key: '
|
|
29174
|
+
}, tabIndex: 0, onFocus: this.handleFocus, onClick: this.handleInputClick }, !this.disabled && (h$1("div", { key: '9795339bc40d505837b673b1350bd863829e4daa', class: { 'hidden flex-col w-full': true, 'pr-12': !!this.icon }, ref: node => (this.inputContainer = node) }, h$1("label", { key: '289548d1e1da0ef6a18106155c732307f2fedf67', class: "font-bold text-sm text-text-primary from-down" }, this.label), h$1("input", { key: 'e737484f921f93ca54f249b6e575e8c22a5e6660', 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 }))), h$1("div", { key: '44213cd6c32eb17d918f7087c58551c75a18206a', 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$1("div", { key: '6ab542e64b6c48163ae8fc5d873258237ca253b2', class: "flex items-center justify-center", onClick: this.handleIconClick }, h$1("sula-icon", { key: '915aeca122f4ee3a28742b441c0f2067f4a8ce8a', icon: this.getInputIcon(), customClass: `text-2xl ${this.disabled ? 'text-icon-disabled' : 'text-icon-primary'}` })))), (this.helpText || this.maxLength) && !this.disabled && (h$1("div", { key: '81edcd13a69c02c31f913cd36768540417095e77', class: "flex justify-between items-center px-16 mt-4 text-sm" }, this.helpText && (h$1("div", { key: 'ff99921f928181450f106413cca5ba8ead39c897', id: "textfield-help-text", class: { 'text-text-primary': this.status === SulaTextfieldStatus.Default, 'text-feedback-error': this.status === SulaTextfieldStatus.Error } }, this.helpText)), this.maxLength && (h$1("div", { key: '29c954591b2426eb5cf3bdeedd7ae78161573647', 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)))))));
|
|
29171
29175
|
}
|
|
29172
29176
|
static get watchers() { return {
|
|
29173
29177
|
"value": ["watchValueHandler"]
|