Skip to content

Commit 8409380

Browse files
committed
fix(input-stepper): tweak styles
1 parent b833fc1 commit 8409380

File tree

2 files changed

+24
-13
lines changed

2 files changed

+24
-13
lines changed

src/components/input-stepper/input-stepper.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import styles from './input-stepper.styles.js';
88
*
99
* @link https://www.nngroup.com/articles/input-steppers/
1010
* @link https://developer.apple.com/documentation/uikit/uistepper
11+
*
12+
* - https://khagwal.com/interactions/
1113
*/
1214
export default class InputStepper extends LitElement {
1315
static styles: CSSResultGroup = [componentStyles, styles];

src/components/input-stepper/input-stepper.styles.ts

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import { css } from 'lit';
22

33
export default css`
44
:host {
5-
--input-stepper-border-color: #e2e8f0;
6-
--input-stepper-border-radius: 2px;
7-
--input-stepper-color: #f7fafc;
8-
--input-stepper-color-hover: #edf2f7;
9-
--input-stepper-button-width: 48px;
5+
--border-color: oklch(0.872 0.01 258.338); /* gray.300 */
6+
--border-radius: 4px;
7+
--button-background-color: oklch(0.985 0.002 247.839); /* gray.50 */
8+
--button-background-color-hover: oklch(0.967 0.003 264.542); /* gray.100 */
9+
--button-width: 42px;
1010
1111
display: inline-flex;
1212
outline: none;
@@ -17,32 +17,40 @@ export default css`
1717
display: flex;
1818
align-items: stretch;
1919
white-space: nowrap;
20-
border: 1px solid var(--input-stepper-border-color);
21-
border-radius: var(--input-stepper-border-radius);
22-
min-height: var(--input-stepper-button-width);
20+
border: 1px solid var(--border-color);
21+
border-radius: var(--border-radius);
22+
min-height: var(--button-width);
2323
}
2424
2525
button {
26-
box-sizing: border-box;
2726
padding: 0;
2827
appearance: none;
2928
background: none;
3029
border: 0;
3130
font-family: inherit;
3231
font-size: inherit;
33-
width: var(--input-stepper-button-width);
32+
width: var(--button-width);
33+
aspect-ratio: 1/1;
3434
cursor: pointer;
3535
touch-action: manipulation;
3636
-webkit-tap-highlight-color: transparent;
3737
}
3838
39+
button:first-of-type {
40+
border-radius: var(--border-radius) 0 0 var(--border-radius);
41+
}
42+
43+
button:last-of-type {
44+
border-radius: 0 var(--border-radius) var(--border-radius) 0;
45+
}
46+
3947
button:not(:disabled) {
40-
background-color: var(--input-stepper-color);
48+
background-color: var(--button-background-color);
4149
}
4250
4351
@media (hover: hover) {
4452
button:hover:not(:disabled) {
45-
background-color: var(--input-stepper-color-hover);
53+
background-color: var(--button-background-color-hover);
4654
}
4755
}
4856
@@ -53,7 +61,8 @@ export default css`
5361
font-size: inherit;
5462
border: 0;
5563
text-align: center;
56-
max-width: calc(var(--input-stepper-button-width) * 1.2);
64+
margin-inline: 1px;
65+
max-width: calc(var(--button-width) * 1.15);
5766
}
5867
5968
input:disabled {

0 commit comments

Comments
 (0)