Skip to content

Commit 943cc98

Browse files
Jeffrey Lauwersclaude
andcommitted
refactor(tokens): rework form-control width scale to fit actual component needs
xs (8ch) → unchanged — postcode, year, CVV sm (16ch → 12ch) — time input (HH:MM), short codes md (32ch → 20ch) — date input (dd/mm/yyyy), phone number lg (48ch → 32ch) — standard default — name, email xl (64ch → 48ch) — longer inputs — URL DateInput wrapper updated from sm to md (20ch). TextInput docs and Width story updated to reflect new scale. TimeInput and DateInput docs updated with correct ch values. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent d9fc725 commit 943cc98

6 files changed

Lines changed: 36 additions & 36 deletions

File tree

packages/components-react/src/DateInput/DateInput.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
* Button hover/focus/color states come from the Button component itself.
77
*/
88

9-
/* Wrapper — fixed sm width, positions calendar button absolutely inside the input */
9+
/* Wrapper — fixed md width (20ch), positions calendar button absolutely inside the input */
1010
.dsn-date-input-wrapper {
1111
position: relative;
1212
display: block;
1313
inline-size: 100%;
14-
max-inline-size: var(--dsn-form-control-width-sm);
14+
max-inline-size: var(--dsn-form-control-width-md);
1515
}
1616

1717
/* Calendar button — centered vertically, positioned at inline-end */

packages/design-tokens/src/tokens/themes/start/base.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -442,27 +442,27 @@
442442
"xs": {
443443
"value": "8ch",
444444
"type": "dimension",
445-
"comment": "Extra small width - for short inputs (e.g., postal code, 6 characters)"
445+
"comment": "Extra small width - for very short inputs (e.g., postal code, year, CVV)"
446446
},
447447
"sm": {
448-
"value": "16ch",
448+
"value": "12ch",
449449
"type": "dimension",
450-
"comment": "Small width - for medium inputs (e.g., phone number, 10-12 digits)"
450+
"comment": "Small width - for short inputs (e.g., time HH:MM, short codes)"
451451
},
452452
"md": {
453-
"value": "32ch",
453+
"value": "20ch",
454454
"type": "dimension",
455-
"comment": "Medium width (default) - for standard inputs (e.g., email, name)"
455+
"comment": "Medium width - for medium inputs (e.g., date dd/mm/yyyy, phone number)"
456456
},
457457
"lg": {
458-
"value": "48ch",
458+
"value": "32ch",
459459
"type": "dimension",
460-
"comment": "Large width - for longer inputs (e.g., URL)"
460+
"comment": "Large width (default) - for standard inputs (e.g., name, email)"
461461
},
462462
"xl": {
463-
"value": "64ch",
463+
"value": "48ch",
464464
"type": "dimension",
465-
"comment": "Extra large width - for very long text fields"
465+
"comment": "Extra large width - for longer inputs (e.g., URL)"
466466
},
467467
"full": {
468468
"value": "100%",

packages/storybook/src/DateInput.docs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Een invoerveld voor datums met een interactieve kalenderknop aan de rechterkant.
44

55
## Doel
66

7-
De DateInput component is een gespecialiseerd invoerveld voor het invoeren van een datum. Een interactieve kalenderknop staat rechts in het veld (`inline-end`) en opent de native datumkiezer van de browser of het mobiele apparaat bij klikken. De `padding-inline-end` van het invoerveld wordt automatisch vergroot zodat tekst nooit achter de knop terechtkomt. Het veld heeft een vaste `sm`-breedte (16ch) — datumvelden hebben een voorspelbare inhoudsbreedte waarvoor dit altijd voldoende is.
7+
De DateInput component is een gespecialiseerd invoerveld voor het invoeren van een datum. Een interactieve kalenderknop staat rechts in het veld (`inline-end`) en opent de native datumkiezer van de browser of het mobiele apparaat bij klikken. De `padding-inline-end` van het invoerveld wordt automatisch vergroot zodat tekst nooit achter de knop terechtkomt. Het veld heeft een vaste `md`-breedte (20ch) — datumvelden hebben een voorspelbare inhoudsbreedte waarvoor dit altijd voldoende is.
88

99
<!-- VOORBEELD -->
1010

packages/storybook/src/TextInput.docs.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ De TextInput component is een gestandaardiseerd invoerveld voor single-line teks
2323
## Best practices
2424

2525
- **Kies de juiste width.** Gebruik `width` om de breedte aan te passen aan het type data:
26-
- `xs` (8ch) - Korte codes (postcode, CVV)
27-
- `sm` (16ch) - Medium tekst (telefoonnummer, 10-12 cijfers)
28-
- `md` (32ch) - Standaard (naam, email) - **DEFAULT**
29-
- `lg` (48ch) - Langere tekst (URL)
30-
- `xl` (64ch) - Zeer lange tekst
26+
- `xs` (8ch) - Zeer korte codes (postcode, jaar, CVV)
27+
- `sm` (12ch) - Korte invoer (tijdstip, korte codes)
28+
- `md` (20ch) - Medium invoer (datum, telefoonnummer)
29+
- `lg` (32ch) - Standaard (naam, email) - **DEFAULT**
30+
- `xl` (48ch) - Langere tekst (URL)
3131
- `full` (100%) - Responsive, neemt volledige breedte
3232
- **Gebruik het juiste type.** Gebruik native input types: `email`, `url`, `tel`, `search`, etc.
3333
- **Duidelijke placeholders.** Gebruik placeholders voor voorbeelden, geen instructies.
@@ -37,14 +37,14 @@ De TextInput component is een gestandaardiseerd invoerveld voor single-line teks
3737

3838
## Width varianten
3939

40-
| Variant | Width | Gebruik |
41-
| ------- | ----- | ------------------------------------------------ |
42-
| `xs` | 8ch | Zeer korte codes (postcode "1234 AB", CVV "123") |
43-
| `sm` | 16ch | Medium tekst (telefoonnummer "06-12345678") |
44-
| `md` | 32ch | **Standaard** - naam, email, etc. |
45-
| `lg` | 48ch | Langere tekst (URL "https://example.com") |
46-
| `xl` | 64ch | Zeer lange tekst |
47-
| `full` | 100% | Responsive, past zich aan container |
40+
| Variant | Width | Gebruik |
41+
| ------- | ----- | -------------------------------------------------- |
42+
| `xs` | 8ch | Zeer korte codes (postcode "1234 AB", CVV "123") |
43+
| `sm` | 12ch | Korte invoer (tijdstip "14:30", korte codes) |
44+
| `md` | 20ch | Medium invoer (datum "15-03-2025", telefoonnummer) |
45+
| `lg` | 32ch | **Standaard** - naam, email, etc. |
46+
| `xl` | 48ch | Langere tekst (URL "https://example.com") |
47+
| `full` | 100% | Responsive, past zich aan container |
4848

4949
## Design tokens
5050

@@ -79,10 +79,10 @@ De TextInput component is een gestandaardiseerd invoerveld voor single-line teks
7979
| `--dsn-text-input-invalid-background-color` | Invalid background color |
8080
| `--dsn-text-input-invalid-border-color` | Invalid border color |
8181
| `--dsn-form-control-width-xs` | Extra small width (8ch) |
82-
| `--dsn-form-control-width-sm` | Small width (16ch) |
83-
| `--dsn-form-control-width-md` | Medium width (32ch) |
84-
| `--dsn-form-control-width-lg` | Large width (48ch) |
85-
| `--dsn-form-control-width-xl` | Extra large width (64ch) |
82+
| `--dsn-form-control-width-sm` | Small width (12ch) |
83+
| `--dsn-form-control-width-md` | Medium width (20ch) |
84+
| `--dsn-form-control-width-lg` | Large width (32ch) |
85+
| `--dsn-form-control-width-xl` | Extra large width (48ch) |
8686
| `--dsn-form-control-width-full` | Full width (100%) |
8787

8888
## Accessibility

packages/storybook/src/TextInput.stories.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,12 @@ export const Widths: Story = {
7777
name: 'Width variants',
7878
render: () => (
7979
<div style={{ display: 'flex', flexDirection: 'column', gap: '1rem' }}>
80-
<TextInput width="xs" placeholder="Extra small (xs)" />
81-
<TextInput width="sm" placeholder="Small (sm)" />
82-
<TextInput width="md" placeholder="Medium (md)" />
83-
<TextInput width="lg" placeholder="Large (lg)" />
84-
<TextInput width="xl" placeholder="Extra large (xl)" />
85-
<TextInput width="full" placeholder="Full width" />
80+
<TextInput width="xs" placeholder="xs — 8ch (postcode, CVV)" />
81+
<TextInput width="sm" placeholder="sm — 12ch (tijdstip, korte codes)" />
82+
<TextInput width="md" placeholder="md — 20ch (datum, telefoonnummer)" />
83+
<TextInput width="lg" placeholder="lg — 32ch (naam, email)" />
84+
<TextInput width="xl" placeholder="xl — 48ch (URL)" />
85+
<TextInput width="full" placeholder="full — 100% (responsive)" />
8686
</div>
8787
),
8888
};

packages/storybook/src/TimeInput.docs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Een invoerveld voor tijden met een interactieve klokknop aan de rechterkant.
44

55
## Doel
66

7-
De TimeInput component is een gespecialiseerd invoerveld voor het invoeren van een tijdstip. Een interactieve klokknop staat rechts in het veld (`inline-end`) en opent de native tijdkiezer van de browser of het mobiele apparaat bij klikken. De `padding-inline-end` van het invoerveld wordt automatisch vergroot zodat tekst nooit achter de knop terechtkomt. Het veld heeft een vaste `sm`-breedte (16ch) — tijdvelden hebben een voorspelbare inhoudsbreedte waarvoor dit altijd voldoende is.
7+
De TimeInput component is een gespecialiseerd invoerveld voor het invoeren van een tijdstip. Een interactieve klokknop staat rechts in het veld (`inline-end`) en opent de native tijdkiezer van de browser of het mobiele apparaat bij klikken. De `padding-inline-end` van het invoerveld wordt automatisch vergroot zodat tekst nooit achter de knop terechtkomt. Het veld heeft een vaste `sm`-breedte (12ch) — tijdvelden hebben een voorspelbare inhoudsbreedte waarvoor dit altijd voldoende is.
88

99
<!-- VOORBEELD -->
1010

0 commit comments

Comments
 (0)