Text input component #30

Merged
stne3960 merged 35 commits from text_input into main 2025-12-16 17:59:33 +01:00
Owner

Addresses issue #17

Note: TheSans is a commercial font I don't have access to.

Addresses issue #17 Note: TheSans is a commercial font I don't have access to.
stne3960 added the
Design Review
Code Review
labels 2025-11-30 17:47:50 +01:00
stne3960 added 8 commits 2025-11-30 17:47:50 +01:00
stne3960 removed the
Code Review
label 2025-11-30 17:56:13 +01:00
stne3960 added 1 commit 2025-12-01 10:48:23 +01:00
Merge branch 'main' into text_input
All checks were successful
Deploy to branch.dsv.su.se / deploy (pull_request) Successful in 3m25s
3d93230d9a
stne3960 added 1 commit 2025-12-01 13:27:15 +01:00
Add component library to index, until routing is fixed
All checks were successful
Deploy to branch.dsv.su.se / deploy (pull_request) Successful in 3m32s
67f45746ca
Author
Owner
Can be viewed on: https://studentportalen-textinput.branch.dsv.su.se/
Owner
  • Wrong placeholder color (or not set)
  • Wrong text input color (or not set)
  • When focusing on an input with an error state, the error-styling should be replaced by focus-styling.
  • Make sure the component have the option for an instance to not have any placeholder text (there is no example of this in the example)
- [x] Wrong placeholder color (or not set) - [x] Wrong text input color (or not set) - [x] When focusing on an input with an error state, the error-styling should be replaced by focus-styling. - [x] Make sure the component have the option for an instance to not have any placeholder text (there is no example of this in the example)
stne3960 added 13 commits 2025-12-02 15:19:51 +01:00
Merge branch 'main' into button-component
All checks were successful
Deploy to branch.dsv.su.se / deploy (pull_request) Successful in 5m26s
617492a87f
Add component library to index, until routing is fixed
Some checks failed
Deploy to branch.dsv.su.se / deploy (pull_request) Failing after 33s
f2a5cd9d26
Remove import
All checks were successful
Deploy to branch.dsv.su.se / deploy (pull_request) Successful in 4m4s
32376bf9ac
Add correct font
All checks were successful
Deploy to branch.dsv.su.se / deploy (pull_request) Successful in 4m9s
5f9e62569d
Add text styles
All checks were successful
Deploy to branch.dsv.su.se / deploy (pull_request) Successful in 5m42s
69cb86d417
Reconverted fonts
All checks were successful
Deploy to branch.dsv.su.se / deploy (pull_request) Successful in 3m30s
f37e55f34d
Fix borders and text style, run prettier
All checks were successful
Deploy to branch.dsv.su.se / deploy (pull_request) Successful in 3m27s
ed7fb36745
Fix merge conflict
All checks were successful
Deploy to branch.dsv.su.se / deploy (pull_request) Successful in 3m32s
91f694b1c3
stne3960 added 2 commits 2025-12-02 21:44:30 +01:00
Add no placeholder example
All checks were successful
Deploy to branch.dsv.su.se / deploy (pull_request) Successful in 3m35s
2f9dbc08aa
stne3960 requested review from jare2473 2025-12-03 10:32:08 +01:00
jare2473 requested changes 2025-12-03 10:59:26 +01:00
Dismissed
jare2473 left a comment
Owner

Perfect! The input text color did not feel right to me (not enough contrast to the placeholder), so I looked at the SU website and saw that they are using black (#FFFFFF) in (some) text input fields.

So I say, let us also "break the rules" of the SU graphic profile and add this to the color palette. I have updated the text input overview and the color overview in figma.

In short, change the text input color from Base/Ink/Strong to Base/Ink/Max.

Perfect! The input text color did not feel right to me (not enough contrast to the placeholder), so I looked at the SU website and saw that they are using black (#FFFFFF) in (some) text input fields. So I say, let us also "break the rules" of the SU graphic profile and add this to the color palette. I have updated the text input overview and the color overview in figma. In short, change the text input color from Base/Ink/Strong to Base/Ink/Max.
stne3960 added 1 commit 2025-12-03 13:00:22 +01:00
Use base-ink-max for text input
All checks were successful
Deploy to branch.dsv.su.se / deploy (pull_request) Successful in 4m4s
bf5a7dc9aa
stne3960 requested review from jare2473 2025-12-04 09:07:26 +01:00
jare2473 approved these changes 2025-12-04 11:06:47 +01:00
jare2473 added
Code Review
and removed
Design Review
labels 2025-12-04 11:07:40 +01:00
stne3960 removed the
Code Review
label 2025-12-09 18:01:25 +01:00
stne3960 added 1 commit 2025-12-10 00:33:34 +01:00
Convert unnecessary inline styles to classes
All checks were successful
Deploy to branch.dsv.su.se / deploy (pull_request) Successful in 3m27s
1fe96800ca
stne3960 added 1 commit 2025-12-12 12:17:27 +01:00
Merge branch 'main' into text_input
All checks were successful
Deploy to branch.dsv.su.se / deploy (pull_request) Successful in 4m52s
6f2280b753
stne3960 added 1 commit 2025-12-12 12:19:36 +01:00
Unmerged paths
Some checks failed
Deploy to branch.dsv.su.se / deploy (pull_request) Failing after 3m1s
9904566a15
stne3960 added 1 commit 2025-12-12 12:21:30 +01:00
Merge package
All checks were successful
Deploy to branch.dsv.su.se / deploy (pull_request) Successful in 4m32s
c03d577487
stne3960 added 3 commits 2025-12-16 13:17:33 +01:00
Update Component library
All checks were successful
Deploy to branch.dsv.su.se / deploy (pull_request) Successful in 3m49s
cb510e4ce1
stne3960 added the
Code Review
label 2025-12-16 13:23:19 +01:00
stne3960 requested review from ansv7779 2025-12-16 13:23:26 +01:00
ansv7779 reviewed 2025-12-16 14:02:26 +01:00
@ -0,0 +4,4 @@
/**
* Icon sizes matching the design system control sizes.
*/
export type IconSize = "sm" | "md" | "lg";
Owner

Shouldn't icons inherit their size from their context? Like if I add an icon to a small button or a large heading I would assume it would scale to that context rather than having its own independent size.

Shouldn't icons inherit their size from their context? Like if I add an icon to a small button or a large heading I would assume it would scale to that context rather than having its own independent size.
Author
Owner

For certain cases, yes, it probably should. I've added inherit as a default. However, we need to be able to override it like in the TextInput component. Here, the icon is in a dedicated container that's sized by --control-height-* tokens, not font-size. There's no text for it to "inherit" from since the icon container and the input text are siblings, not parent/child.

For certain cases, yes, it probably should. I've added inherit as a default. However, we need to be able to override it like in the TextInput component. Here, the icon is in a dedicated container that's sized by --control-height-* tokens, not font-size. There's no text for it to "inherit" from since the icon container and the input text are siblings, not parent/child.
stne3960 marked this conversation as resolved
@ -0,0 +8,4 @@
export interface TextInputProps
extends Omit<InputHTMLAttributes<HTMLInputElement>, "size"> {
size?: TextInputSize;
Icon?: IconComponent;
Owner

Icon with capital I?

`Icon` with capital `I`?
Author
Owner

Yes, it's a component

Yes, it's a component
stne3960 marked this conversation as resolved
@ -0,0 +9,4 @@
extends Omit<InputHTMLAttributes<HTMLInputElement>, "size"> {
size?: TextInputSize;
Icon?: IconComponent;
error?: boolean;
Owner

Without having seen an example of a full form with validation it's hard to tell if this is the path forward. We can probably leave it for now.

I am wondering about using built-in form validation and the :valid and related pseudo-selectors and how it works with accessibility without it.

Without having seen an example of a full form with validation it's hard to tell if this is the path forward. We can probably leave it for now. I am wondering about using built-in form validation and the `:valid` and related pseudo-selectors and how it works with accessibility without it.
Author
Owner

I’d keep the error prop for now. Native validation works for some cases but gets awkward once you have server errors or custom validation. An explicit error state keeps the component predictable.

I’d keep the error prop for now. Native validation works for some cases but gets awkward once you have server errors or custom validation. An explicit error state keeps the component predictable.
stne3960 marked this conversation as resolved
@ -0,0 +12,4 @@
error?: boolean;
fullWidth?: boolean;
customWidth?: string;
label?: string;
Owner

Should label really be optional? Will that not lead to accessibility issues?

Should label really be optional? Will that not lead to accessibility issues?
Author
Owner

In practical implementation, probably not, that was how the component was designed in the specification.

In practical implementation, probably not, that was how the component was designed in the specification.
stne3960 marked this conversation as resolved
stne3960 added 1 commit 2025-12-16 14:52:32 +01:00
Make icons inherit size
All checks were successful
Deploy to branch.dsv.su.se / deploy (pull_request) Successful in 4m21s
d6a65eee0b
stne3960 added 1 commit 2025-12-16 15:47:41 +01:00
Force label, use aria-label when hidden
All checks were successful
Deploy to branch.dsv.su.se / deploy (pull_request) Successful in 3m56s
Remove branch deployment from branch.dsv.su.se / cleanup (pull_request) Successful in 5s
a4657951fb
ansv7779 approved these changes 2025-12-16 16:12:49 +01:00
stne3960 merged commit e359e1cf06 into main 2025-12-16 17:59:33 +01:00
stne3960 deleted branch text_input 2025-12-16 17:59:33 +01:00
stne3960 referenced this issue from a commit 2025-12-16 17:59:35 +01:00
stne3960 removed the
Code Review
label 2025-12-16 17:59:40 +01:00
Sign in to join this conversation.
No Reviewers
No Milestone
No project
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DMC/studentportalen#30
No description provided.