Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
"outputDir": "dist/storybook-static",
"styles": [
"./src/styles/index",
"./node_modules/@tedi-design-system/core/index.scss"
"./node_modules/@tedi-design-system/core/index.scss",
"./node_modules/@tedi-design-system/core/tedi-storybook-styles.scss"
],
"experimentalZoneless": true
}
Expand Down
3 changes: 3 additions & 0 deletions community/components/form/input/input.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import {
export type InputSize = "small" | "default";
export type InputState = "valid" | "error" | "default";

/**
* @deprecated Use TextField from TEDI-ready instead. This component will be removed from future versions.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add the deprecated badge to this components story as well (as i mentioned in StatusBadge PR)

  parameters: {
    status: {
      type: ["deprecated"],
    },
  },

*/
@Component({
selector: "[tedi-input]",
standalone: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
color: var(--general-text-tertiary);

&--valid {
color: var(--general-status-success-text);
color: var(--form-general-feedback-success-text);
}

&--error {
color: var(--general-status-danger-text);
color: var(--form-general-feedback-error-text);
}

&--left {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,14 @@
grid-column: span 2;
width: 100%;
font-size: var(--heading-h6-size);
color: var(--form-input-text-filled);
text-align: center;
outline: none;
background-color: var(--form-input-background-default);
border: 0;
border-radius: 0;

// /* Chrome, Safari, Edge, Opera */
/* Chrome, Safari, Edge, Opera */
&::-webkit-outer-spin-button,
&::-webkit-inner-spin-button {
appearance: none;
Expand Down
2 changes: 1 addition & 1 deletion tedi/components/form/number-field/number-field.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export default {
},
feedbackText: {
description:
"[FeedbackText](/?path=/docs/community-angular-form-feedbacktext--docs) component inputs.",
"[FeedbackText](/?path=/docs/tedi-ready-components-form-feedbacktext--docs) component inputs.",
control: {
type: "object",
},
Expand Down
72 changes: 72 additions & 0 deletions tedi/components/form/text-field/text-field.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
@if (label()) {
<label
[for]="inputId()"
tedi-label
[required]="required()"
[size]="size() === 'small' ? 'small' : 'default'"
>
{{ label() }}
</label>
}

<div [ngClass]="containerClasses()">
<input
[ngClass]="inputClasses()"
[id]="inputId()"
[value]="value()"
[disabled]="isDisabled()"
[required]="required()"
[placeholder]="placeholder()"
[readonly]="readOnly()"
[attr.name]="name()"
[attr.aria-invalid]="validationState() === 'invalid' ? true : null"
[attr.aria-describedby]="
validationState() === 'invalid' ? feedbackId() : null
"
[tediSpreadAttrs]="inputAttrs()"
(input)="handleInputChange($event)"
(blur)="handleBlur()"
/>

@if (showClearButton()) {
<div class="tedi-text-field__input-buttons">
<button
class="tedi-text-field__clear"
tedi-closing-button
type="button"
size="small"
[attr.aria-label]="'clear' | tediTranslate"
[iconSize]="18"
[disabled]="isDisabled()"
(click)="clearInput()"
></button>
@if (icon()) {
<tedi-separator axis="vertical" size="1rem" />
}
</div>
}

@if (resolvedIcon(); as icon) {
<div class="tedi-text-field__icon">
<tedi-icon
[name]="icon.name"
[size]="icon.size ?? (size() === 'small' ? 16 : 18)"
[color]="icon.color ?? 'secondary'"
[type]="icon.type ?? 'outlined'"
[variant]="icon.variant ?? 'outlined'"
[attr.aria-hidden]="true"
/>
</div>
}
</div>

@if (helper(); as feedback) {
<div class="tedi-text-field__feedback">
<tedi-feedback-text
[id]="feedbackId()"
[type]="feedback.type"
[text]="feedback.text"
[position]="feedback.position"
/>
</div>
}
131 changes: 131 additions & 0 deletions tedi/components/form/text-field/text-field.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
.tedi-text-field {
position: relative;
display: flex;
gap: var(--form-field-inner-spacing);
align-items: center;
width: 100%;
height: var(--form-field-height);
background: var(--form-input-background-default);
border: 1px solid var(--form-input-border-default);
border-radius: var(--form-field-radius);

&:hover,
&--hover {
border-color: var(--form-input-border-hover);
}

&:focus-within,
&--focus {
border-color: var(--form-input-border-focus);
box-shadow: 0 0 0 1px var(--form-input-border-focus);
}

&:active,
&--active {
border-color: var(--form-input-border-active);
box-shadow: 0 0 0 1px var(--form-input-border-active);
}

&.tedi-text-field--valid {
border-color: var(--form-general-feedback-success-border);

&:focus-within {
box-shadow: 0 0 0 1px var(--form-general-feedback-success-border);
}
}

&.tedi-text-field--invalid {
border-color: var(--form-general-feedback-error-border);

&:focus-within {
box-shadow: 0 0 0 1px var(--form-general-feedback-error-border);
}
}

&.tedi-text-field--disabled {
cursor: not-allowed;
background: var(--form-input-background-disabled);
border-color: var(--form-input-border-disabled);
box-shadow: none;
}

&--small {
height: var(--form-field-height-sm);

.tedi-text-field__input {
padding-block: var(--form-field-padding-y-sm);
padding-inline: var(--form-field-padding-x-md-default);
}
}

&--large {
height: var(--form-field-height-lg);

.tedi-text-field__input {
padding-block: var(--form-field-padding-y-lg);
padding-inline: var(--form-field-padding-x-lg);
}
}

&--with-icon {
padding-right: var(--form-field-padding-x-md-default);

&.tedi-text-field--large {
padding-right: var(--form-field-padding-x-lg);
}

.tedi-text-field__input {
padding-right: 0;
}
}

&__clear {
&:disabled {
cursor: not-allowed;
}
}
}

.tedi-text-field__input {
flex: 1;
padding: var(--form-field-padding-y-md-default)
var(--form-field-padding-x-md-default);
font-size: var(--body-regular-size);
font-weight: var(--body-regular-weight);
line-height: var(--body-regular-line-height);
color: var(--form-input-text-filled);
outline: none;
background: transparent;
border: 0;

&::placeholder {
color: var(--form-input-text-placeholder);
}

&:disabled {
color: var(--form-input-text-disabled);
cursor: not-allowed;
background: transparent;
}

/* Chrome, Safari, Edge, Opera */
&--arrows-hidden::-webkit-outer-spin-button,
&--arrows-hidden::-webkit-inner-spin-button {
appearance: none;
}

/* Firefox */
&--arrows-hidden[type="number"] {
appearance: textfield;
}
}

.tedi-text-field__input-buttons {
display: flex;
gap: var(--layout-grid-gutters-04);
align-items: center;
}

.tedi-text-field__feedback {
margin-top: var(--form-field-outer-spacing);
}
Loading