Skip to content

Commit b992cb7

Browse files
Jeffrey Lauwersclaude
andcommitted
fix(date-time-input): correct button padding formula and width tokens
Button position: - inset-inline-end: form-control-padding-inline-end (12px) → space-inline.sm (4px) - New token: --dsn-*-input-button-inset-inline-end = space-inline.sm Padding formula corrected: - Was: icon-size-md + icon-gap + form-control-padding-inline-end - Now: (button-icon-only-padding × 2) + icon-size-sm + button-inset + icon-gap - Icon size aligned to actual small button icon (icon-size-sm, not md) Width tokens widened to prevent text clipping: - xs: 8ch → 10ch (postcode, year, CVV) - sm: 12ch → 14ch (time input, short codes) Docs updated with new ch values. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 943cc98 commit b992cb7

8 files changed

Lines changed: 35 additions & 25 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
max-inline-size: var(--dsn-form-control-width-md);
1515
}
1616

17-
/* Calendar button — centered vertically, positioned at inline-end */
17+
/* Calendar button — centered vertically, positioned at inline-end with reduced margin */
1818
.dsn-date-input__button {
1919
position: absolute;
2020
inset-block-start: 50%;
21-
inset-inline-end: var(--dsn-form-control-padding-inline-end);
21+
inset-inline-end: var(--dsn-date-input-button-inset-inline-end);
2222
transform: translateY(-50%);
2323
}
2424

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
max-inline-size: var(--dsn-form-control-width-sm);
1515
}
1616

17-
/* Clock button — centered vertically, positioned at inline-end */
17+
/* Clock button — centered vertically, positioned at inline-end with reduced margin */
1818
.dsn-time-input__button {
1919
position: absolute;
2020
inset-block-start: 50%;
21-
inset-inline-end: var(--dsn-form-control-padding-inline-end);
21+
inset-inline-end: var(--dsn-time-input-button-inset-inline-end);
2222
transform: translateY(-50%);
2323
}
2424

packages/design-tokens/src/tokens/components/date-input.json

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,24 @@
22
"dsn": {
33
"date-input": {
44
"icon-size": {
5-
"value": "{dsn.icon.size.md}",
5+
"value": "{dsn.button.size.small.icon-size}",
66
"type": "dimension",
7-
"comment": "Date input icon size"
7+
"comment": "Calendar icon size — matches the small button icon size"
88
},
99
"icon-gap": {
1010
"value": "{dsn.space.text.md}",
1111
"type": "dimension",
12-
"comment": "Gap between calendar icon and input text"
12+
"comment": "Gap between calendar button and input text"
13+
},
14+
"button-inset-inline-end": {
15+
"value": "{dsn.space.inline.sm}",
16+
"type": "dimension",
17+
"comment": "Distance from the inline-end border to the calendar button (4px)"
1318
},
1419
"padding-inline-end-with-icon": {
15-
"value": "calc({dsn.date-input.icon-size} + {dsn.date-input.icon-gap} + {dsn.form-control.padding-inline-end})",
20+
"value": "calc(({dsn.button.size.small.icon-only-padding} * 2) + {dsn.date-input.icon-size} + {dsn.date-input.button-inset-inline-end} + {dsn.date-input.icon-gap})",
1621
"type": "dimension",
17-
"comment": "Right padding when icon is present"
22+
"comment": "Right padding when icon is present: (button-padding × 2) + icon-size + button-inset + gap"
1823
}
1924
}
2025
}

packages/design-tokens/src/tokens/components/time-input.json

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,24 @@
22
"dsn": {
33
"time-input": {
44
"icon-size": {
5-
"value": "{dsn.icon.size.md}",
5+
"value": "{dsn.button.size.small.icon-size}",
66
"type": "dimension",
7-
"comment": "Time input icon size"
7+
"comment": "Clock icon size — matches the small button icon size"
88
},
99
"icon-gap": {
1010
"value": "{dsn.space.text.md}",
1111
"type": "dimension",
12-
"comment": "Gap between clock icon and input text"
12+
"comment": "Gap between clock button and input text"
13+
},
14+
"button-inset-inline-end": {
15+
"value": "{dsn.space.inline.sm}",
16+
"type": "dimension",
17+
"comment": "Distance from the inline-end border to the clock button (4px)"
1318
},
1419
"padding-inline-end-with-icon": {
15-
"value": "calc({dsn.time-input.icon-size} + {dsn.time-input.icon-gap} + {dsn.form-control.padding-inline-end})",
20+
"value": "calc(({dsn.button.size.small.icon-only-padding} * 2) + {dsn.time-input.icon-size} + {dsn.time-input.button-inset-inline-end} + {dsn.time-input.icon-gap})",
1621
"type": "dimension",
17-
"comment": "Right padding when icon is present"
22+
"comment": "Right padding when icon is present: (button-padding × 2) + icon-size + button-inset + gap"
1823
},
1924
"icon-color": {
2025
"value": "{dsn.color.action-2.color-default}",

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,12 +440,12 @@
440440
},
441441
"width": {
442442
"xs": {
443-
"value": "8ch",
443+
"value": "10ch",
444444
"type": "dimension",
445445
"comment": "Extra small width - for very short inputs (e.g., postal code, year, CVV)"
446446
},
447447
"sm": {
448-
"value": "12ch",
448+
"value": "14ch",
449449
"type": "dimension",
450450
"comment": "Small width - for short inputs (e.g., time HH:MM, short codes)"
451451
},

packages/storybook/src/TextInput.docs.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ 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) - Zeer korte codes (postcode, jaar, CVV)
27-
- `sm` (12ch) - Korte invoer (tijdstip, korte codes)
26+
- `xs` (10ch) - Zeer korte codes (postcode, jaar, CVV)
27+
- `sm` (14ch) - Korte invoer (tijdstip, korte codes)
2828
- `md` (20ch) - Medium invoer (datum, telefoonnummer)
2929
- `lg` (32ch) - Standaard (naam, email) - **DEFAULT**
3030
- `xl` (48ch) - Langere tekst (URL)
@@ -39,8 +39,8 @@ De TextInput component is een gestandaardiseerd invoerveld voor single-line teks
3939

4040
| Variant | Width | Gebruik |
4141
| ------- | ----- | -------------------------------------------------- |
42-
| `xs` | 8ch | Zeer korte codes (postcode "1234 AB", CVV "123") |
43-
| `sm` | 12ch | Korte invoer (tijdstip "14:30", korte codes) |
42+
| `xs` | 10ch | Zeer korte codes (postcode "1234 AB", CVV "123") |
43+
| `sm` | 14ch | Korte invoer (tijdstip "14:30", korte codes) |
4444
| `md` | 20ch | Medium invoer (datum "15-03-2025", telefoonnummer) |
4545
| `lg` | 32ch | **Standaard** - naam, email, etc. |
4646
| `xl` | 48ch | Langere tekst (URL "https://example.com") |
@@ -78,8 +78,8 @@ De TextInput component is een gestandaardiseerd invoerveld voor single-line teks
7878
| `--dsn-text-input-invalid-color` | Invalid text color |
7979
| `--dsn-text-input-invalid-background-color` | Invalid background color |
8080
| `--dsn-text-input-invalid-border-color` | Invalid border color |
81-
| `--dsn-form-control-width-xs` | Extra small width (8ch) |
82-
| `--dsn-form-control-width-sm` | Small width (12ch) |
81+
| `--dsn-form-control-width-xs` | Extra small width (10ch) |
82+
| `--dsn-form-control-width-sm` | Small width (14ch) |
8383
| `--dsn-form-control-width-md` | Medium width (20ch) |
8484
| `--dsn-form-control-width-lg` | Large width (32ch) |
8585
| `--dsn-form-control-width-xl` | Extra large width (48ch) |

packages/storybook/src/TextInput.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ export const Widths: Story = {
7777
name: 'Width variants',
7878
render: () => (
7979
<div style={{ display: 'flex', flexDirection: 'column', gap: '1rem' }}>
80-
<TextInput width="xs" placeholder="xs — 8ch (postcode, CVV)" />
81-
<TextInput width="sm" placeholder="sm — 12ch (tijdstip, korte codes)" />
80+
<TextInput width="xs" placeholder="xs — 10ch (postcode, CVV)" />
81+
<TextInput width="sm" placeholder="sm — 14ch (tijdstip, korte codes)" />
8282
<TextInput width="md" placeholder="md — 20ch (datum, telefoonnummer)" />
8383
<TextInput width="lg" placeholder="lg — 32ch (naam, email)" />
8484
<TextInput width="xl" placeholder="xl — 48ch (URL)" />

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 (12ch) — 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 (14ch) — tijdvelden hebben een voorspelbare inhoudsbreedte waarvoor dit altijd voldoende is.
88

99
<!-- VOORBEELD -->
1010

0 commit comments

Comments
 (0)