Files
ISA-Frontend/apps/isa-app/stories/ui/input-controls/text-field.stories.ts
Nino Righi b261273228 Merged PR 1841: feat(ui-input-controls, oms-return-process): introduce text field container,...
feat(ui-input-controls, oms-return-process): introduce text field container, clear, and errors components

- Add `ui-text-field-container`, `ui-text-field-clear`, and `ui-text-field-errors` as standalone components for improved text field composition and error handling.
- Update SCSS to include new styles for container, clear, and errors components, ensuring visual consistency and error highlighting.
- Refactor `ReturnProcessProductQuestionComponent` to use the new containerized text field structure, improving template clarity and error display.
- Update Storybook story for `TextField` to demonstrate new composition and error handling.
- Export new components from the input-controls public API for external usage.

Ref: #4989, #5058
2025-06-05 17:12:28 +00:00

73 lines
1.9 KiB
TypeScript

import { moduleMetadata, type Meta, type StoryObj } from '@storybook/angular';
import {
TextFieldClearComponent,
TextFieldComponent,
TextFieldContainerComponent,
TextFieldErrorsComponent,
} from '@isa/ui/input-controls';
interface TextFieldStoryProps {
showClear: boolean;
showError1: boolean;
showError2: boolean;
errorText1: string;
errorText2: string;
}
const meta: Meta<TextFieldStoryProps> = {
component: TextFieldComponent,
title: 'ui/input-controls/TextField',
argTypes: {
showClear: { control: 'boolean', name: 'Show Clear Button' },
showError1: { control: 'boolean', name: 'Show Error 1' },
showError2: { control: 'boolean', name: 'Show Error 2' },
errorText1: { control: 'text', name: 'Error 1 Text' },
errorText2: { control: 'text', name: 'Error 2 Text' },
},
args: {
showClear: true,
showError1: false,
showError2: false,
errorText1: 'Eingabe ungültig',
errorText2: 'Error Beispiel 2',
},
decorators: [
moduleMetadata({
imports: [
TextFieldClearComponent,
TextFieldContainerComponent,
TextFieldErrorsComponent,
],
}),
],
render: (args) => ({
props: args,
template: `
<ui-text-field-container>
<ui-text-field>
<input type="text" placeholder="Enter your name" />
<ui-text-field-clear *ngIf="showClear"></ui-text-field-clear>
</ui-text-field>
<ui-text-field-errors>
<span *ngIf="showError1">{{ errorText1 }}</span>
<span *ngIf="showError2">{{ errorText2 }}</span>
</ui-text-field-errors>
</ui-text-field-container>
`,
}),
};
export default meta;
type Story = StoryObj<TextFieldStoryProps>;
export const Default: Story = {
args: {
showClear: true,
showError1: false,
showError2: false,
errorText1: 'Eingabe ungültig',
errorText2: 'Error Beispiel 2',
},
};