diff --git a/packages/ods/src/components/input/package.json b/packages/ods/src/components/input/package.json index 422efb6b42..b425a2e9a7 100644 --- a/packages/ods/src/components/input/package.json +++ b/packages/ods/src/components/input/package.json @@ -9,7 +9,7 @@ "clean": "rimraf .stencil coverage dist docs-api www", "doc": "typedoc --pretty --plugin ../../../scripts/typedoc-plugin-decorator.js && node ../../../scripts/generate-typedoc-md.js", "lint:scss": "stylelint 'src/components/**/*.scss'", - "lint:ts": "eslint 'src/**/*.{js,ts,tsx}'", + "lint:ts": "eslint '{src,tests}/**/*.{js,ts,tsx}'", "start": "stencil build --dev --watch --serve", "test:e2e": "stencil test --e2e --config stencil.config.ts", "test:e2e:ci": "tsc --noEmit && stencil test --e2e --ci --config stencil.config.ts", diff --git a/packages/ods/src/components/input/src/components/ods-input/ods-input.scss b/packages/ods/src/components/input/src/components/ods-input/ods-input.scss index fe75181775..82460399ca 100644 --- a/packages/ods/src/components/input/src/components/ods-input/ods-input.scss +++ b/packages/ods/src/components/input/src/components/ods-input/ods-input.scss @@ -6,12 +6,14 @@ position: relative; } +$ods-input__button-right: 4px; + .ods-input { &__button { display: inline-flex; position: absolute; top: 0; - right: 4px; + right: $ods-input__button-right; border: none; background: none; color: theme.$ods-color-primary-500; @@ -41,7 +43,7 @@ } &--disabled { - background: theme.$ods-color-neutral-100; + background-color: theme.$ods-color-neutral-100; cursor: not-allowed; user-select: none; @@ -58,12 +60,12 @@ &__spinner { position: absolute; top: 0; - right: 4px; + right: $ods-input__button-right; padding: 0 4px; &::part(spinner) { - width: 16px; - height: 16px; + width: 1rem; + height: 1rem; } } } diff --git a/packages/ods/src/components/input/src/components/ods-input/ods-input.tsx b/packages/ods/src/components/input/src/components/ods-input/ods-input.tsx index fec910c7a2..494c70901c 100644 --- a/packages/ods/src/components/input/src/components/ods-input/ods-input.tsx +++ b/packages/ods/src/components/input/src/components/ods-input/ods-input.tsx @@ -1,7 +1,7 @@ import { AttachInternals, Component, Element, Event, type EventEmitter, type FunctionalComponent, Host, Method, Prop, State, Watch, h } from '@stencil/core'; import { ODS_ICON_NAME } from '../../../../icon/src'; import { ODS_INPUT_TYPE, type OdsInputType } from '../../constants/input-type'; -import { handleKeySpace, isPassword } from '../../controller/ods-input'; +import { handleKeySpace, isPassword, setFormValue } from '../../controller/ods-input'; import { type OdsInputEventValueChange } from '../../interfaces/events'; @Component({ @@ -24,12 +24,12 @@ export class OdsInput { @Prop({ reflect: true }) public ariaLabelledby?: string; @Prop({ reflect: true }) public defaultValue?: string | number; @Prop({ reflect: true }) public hasError: boolean = false; - @Prop({ reflect: true }) public isClearable?: boolean; + @Prop({ reflect: true }) public isClearable?: boolean = false; @Prop({ reflect: true }) public isDisabled: boolean = false; - @Prop({ reflect: true }) public isLoading?: boolean; + @Prop({ reflect: true }) public isLoading?: boolean = false; @Prop({ mutable: true, reflect: true }) public isMasked?: boolean; - @Prop({ reflect: true }) public isReadonly?: boolean; - @Prop({ reflect: true }) public isRequired?: boolean; + @Prop({ reflect: true }) public isReadonly?: boolean = false; + @Prop({ reflect: true }) public isRequired?: boolean = false; @Prop({ reflect: true }) public max?: number; @Prop({ reflect: true }) public maxlength?: number; @Prop({ reflect: true }) public min?: number; @@ -94,7 +94,7 @@ export class OdsInput { @Watch('value') onValueChange(value: string | number, oldValue?: string | number): void { - this.internals?.setFormValue?.(this.value?.toString() ?? ''); + setFormValue(this.internals, this.value); this.onErrorChange(); this.odsValueChange.emit({ name: this.name, @@ -109,7 +109,7 @@ export class OdsInput { if (!this.value) { this.value = this.defaultValue; } - this.internals?.setFormValue?.(this.value?.toString() ?? ''); + setFormValue(this.internals, this.value); } async formResetCallback(): Promise { @@ -129,7 +129,7 @@ export class OdsInput {