Skip to content

Commit 6a55da4

Browse files
feat(theme/number-input): add iterations variant
1 parent 59fa5b4 commit 6a55da4

File tree

2 files changed

+48
-2
lines changed

2 files changed

+48
-2
lines changed

lib/theme/components/number-input.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,56 @@ const filled = definePartsStyle((props) => {
4141
};
4242
});
4343

44+
const variantIterations = definePartsStyle((props) => {
45+
return {
46+
root: { h: '28px' },
47+
field: {
48+
...getInputFilledStyles(props),
49+
pe: 6,
50+
ps: 6,
51+
borderInlineStartRadius: 'base',
52+
h: 'full',
53+
textAlign: 'center',
54+
fontSize: 'md',
55+
fontWeight: 'semibold',
56+
},
57+
stepperGroup: {
58+
border: 'none',
59+
w: 6,
60+
},
61+
stepper: {
62+
color: 'base.200',
63+
_hover: {
64+
bg: 'base.700',
65+
color: 'base.100',
66+
},
67+
_disabled: {
68+
_hover: {
69+
bg: 'base.800',
70+
color: 'base.200',
71+
},
72+
},
73+
_first: {
74+
border: 'none',
75+
margin: 0,
76+
borderTopEndRadius: 'base',
77+
borderBottomStartRadius: 'base',
78+
},
79+
_last: {
80+
border: 'none',
81+
margin: 0,
82+
borderBottomEndRadius: 'base',
83+
borderTopStartRadius: 'base',
84+
},
85+
},
86+
};
87+
});
88+
4489
export const numberInputTheme: ReturnType<typeof defineMultiStyleConfig> = defineMultiStyleConfig({
4590
variants: {
4691
filled,
4792
darkFilled: filled,
93+
iterations: variantIterations,
4894
},
4995
defaultProps: {
5096
size: 'sm',

lib/theme/util/getInputFilledStyles.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import type { StyleFunctionProps, SystemStyleObject } from '@chakra-ui/styled-sy
33
export const getInputFilledStyles = (props: StyleFunctionProps): SystemStyleObject => {
44
const { variant } = props;
55

6-
const bg = variant === 'darkFilled' ? 'base.800' : 'base.700';
7-
const bgHover = variant === 'darkFilled' ? 'base.750' : 'base.650';
6+
const bg = variant === 'darkFilled' || variant === 'iterations' ? 'base.800' : 'base.700';
7+
const bgHover = variant === 'darkFilled' || variant === 'iterations' ? 'base.750' : 'base.650';
88
const error = 'error.600';
99
const errorHover = 'error.500';
1010
const fg = 'base.100';

0 commit comments

Comments
 (0)