Skip to content

Commit f5c3bf8

Browse files
committed
fix(checkbox): 🩹 use separate variable for input
1 parent 6c12f41 commit f5c3bf8

File tree

3 files changed

+20
-17
lines changed

3 files changed

+20
-17
lines changed

src/icons/CaretRight.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ export const CaretRightIcon = createIcon({
55
viewBox: "0 0 12 12",
66
path: (
77
<path
8-
fill="currentColor"
98
fillRule="evenodd"
109
clipRule="evenodd"
11-
d="M4.026 1.805a.65.65 0 0 1 .919-.03l4 3.75a.65.65 0 0 1 0 .95l-4 3.75a.65.65 0 0 1-.89-.95L7.55 6 4.056 2.724a.65.65 0 0 1-.03-.919Z"
10+
d="M4.027 1.807a.65.65 0 0 1 .92-.03l4 3.75a.65.65 0 0 1 0 .949l-4 3.75a.65.65 0 0 1-.89-.949l3.494-3.275-3.494-3.276a.65.65 0 0 1-.03-.919Z"
11+
fill="currentColor"
1212
/>
1313
),
1414
});

src/input/InputProps.tsx

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,14 @@ export const useInputProps = ({
6565
const inputInlineStyles = React.useRef<Record<string, any>>({});
6666
let prefixRef = React.useRef<HTMLElement>(null);
6767
let suffixRef = React.useRef<HTMLElement>(null);
68-
prefixRef = useForkRef(
69-
prefixRef,
70-
componentProps?.prefixProps?.ref,
71-
) as unknown as React.RefObject<HTMLElement>;
72-
suffixRef = useForkRef(
73-
suffixRef,
74-
componentProps?.suffixProps?.ref,
75-
) as unknown as React.RefObject<HTMLElement>;
68+
7669
useSafeLayoutEffect(() => {
7770
let key = "";
7871

7972
const prefixElement = prefixRef.current;
73+
console.log("%cprefixElement", "color: #007300", prefixElement);
8074
const suffixElement = suffixRef.current;
75+
console.log("%csuffixElement", "color: #006dcc", suffixElement);
8176
if (uiProps.prefix && prefixElement) {
8277
key = "paddingLeft";
8378

@@ -118,26 +113,34 @@ export const useInputProps = ({
118113
[componentProps.baseProps, disabled, restProps, uiProps],
119114
);
120115

116+
const _prefixRef = useForkRef(
117+
prefixRef,
118+
componentProps?.prefixProps?.ref,
119+
) as unknown as React.RefObject<HTMLElement>;
121120
const prefixProps: InputPrefixProps = React.useMemo(
122121
() => ({
123122
...uiProps,
124123
disabled,
125124
...componentProps.prefixProps,
126-
ref: prefixRef,
125+
ref: _prefixRef,
127126
children: withIconA11y(uiProps.prefix, uiProps),
128127
}),
129-
[componentProps.prefixProps, disabled, uiProps],
128+
[_prefixRef, componentProps.prefixProps, disabled, uiProps],
130129
);
131130

131+
const _suffixRef = useForkRef(
132+
suffixRef,
133+
componentProps?.suffixProps?.ref,
134+
) as unknown as React.RefObject<HTMLElement>;
132135
const suffixProps: InputSuffixProps = React.useMemo(
133136
() => ({
134137
...uiProps,
135138
disabled,
136139
...componentProps.suffixProps,
137-
ref: suffixRef,
140+
ref: _suffixRef,
138141
children: uiProps.suffix,
139142
}),
140-
[componentProps.suffixProps, disabled, uiProps],
143+
[componentProps.suffixProps, _suffixRef, disabled, uiProps],
141144
);
142145

143146
return {

src/theme/defaultTheme/input.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ export const input = {
106106
},
107107
underline: {
108108
default: {
109-
base: "text-gray-800 placeholder:text-gray-600 border border-x-transparent border-t-transparent border-b-gray-400 rounded-none px-0.5",
110-
prefix: "text-gray-600",
111-
suffix: "text-gray-600",
109+
base: "text-gray-800 placeholder:text-gray-600 border border-x-transparent border-t-transparent border-b-gray-400 rounded-none",
110+
prefix: "text-gray-600 pl-0",
111+
suffix: "text-gray-600 pr-0",
112112
},
113113
hover: {
114114
base: "hover:placeholder:text-gray-700 hover:border-b-gray-500",

0 commit comments

Comments
 (0)