Skip to content

Commit 5188e2f

Browse files
authored
Merge pull request #4525 from Ivy-Interactive/4502-remove-gray-background-from-searchinput-affix
(inputs): make suffixes and affixes in consistency
2 parents 367c323 + 157da2d commit 5188e2f

40 files changed

Lines changed: 3345 additions & 949 deletions

src/Ivy.Samples.Shared/Apps/Tests/InputAffixesGalleryApp.cs

Lines changed: 901 additions & 0 deletions
Large diffs are not rendered by default.

src/Ivy.Samples.Shared/Apps/Widgets/Inputs/TextInputApp.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,6 @@ public override object Build()
274274
| Text.Monospaced("Nullable with prefix/suffix")
275275
| nullableState.ToTextInput().Prefix("$").Placeholder("Amount")
276276
| nullableState.ToTextInput().Suffix("%").Placeholder("Percentage")
277-
| nullableState.ToTextInput().Prefix("https://").Suffix(".com").Placeholder("domain")
278-
279-
| Text.Monospaced("Nullable + Invalid + ShortcutKey")
280-
| nullableState.ToTextInput().Prefix("@").Invalid("Required field").ShortcutKey("Ctrl+P")
281-
| nullableState.ToTextInput().Suffix(Icons.Search).Invalid("Invalid input").ShortcutKey("Ctrl+F")
282-
| nullableState.ToTextInput().Prefix(Icons.Mail).Suffix(".com").Invalid("Error").ShortcutKey("Ctrl+B");
277+
| nullableState.ToTextInput().Prefix("https://").Suffix(".com").Placeholder("domain");
283278
}
284279
}

src/frontend/src/components/InvalidIcon.tsx

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,32 @@ import { InfoIcon } from "lucide-react";
22
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./ui/tooltip";
33
import { cn } from "@/lib/utils";
44

5-
export const InvalidIcon: React.FC<{ message: string; className?: string }> = ({
6-
message,
7-
className,
8-
}) => {
5+
export const InvalidIcon: React.FC<{
6+
message: string;
7+
className?: string;
8+
iconClassName?: string;
9+
}> = ({ message, className, iconClassName }) => {
910
return (
1011
<TooltipProvider>
11-
<Tooltip>
12-
<TooltipTrigger
13-
className={cn(className, "cursor-pointer pointer-events-auto")}
14-
data-invalid-icon="true"
15-
>
16-
<InfoIcon className="size-4 text-red-900 hover:text-red-400 transition-colors duration-200" />
12+
<Tooltip className="contents">
13+
<TooltipTrigger asChild>
14+
<button
15+
type="button"
16+
tabIndex={-1}
17+
data-invalid-icon="true"
18+
className={cn(
19+
"inline-flex shrink-0 cursor-pointer items-center justify-center border-0 bg-transparent p-0 shadow-none outline-none leading-none",
20+
"pointer-events-auto focus-visible:ring-1 focus-visible:ring-ring",
21+
className,
22+
)}
23+
>
24+
<InfoIcon
25+
className={cn(
26+
"block shrink-0 text-red-900 transition-colors duration-200 hover:text-red-400",
27+
iconClassName ?? "size-4",
28+
)}
29+
/>
30+
</button>
1731
</TooltipTrigger>
1832
<TooltipContent className="bg-popover text-popover-foreground shadow-md">
1933
<div className="max-w-60">{message}</div>

src/frontend/src/components/ui/input/bool-input-variant.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
import { cva } from "class-variance-authority";
22

3+
/** Gap between control and label — scales with density. */
4+
export const boolInputControlGapVariant = cva("", {
5+
variants: {
6+
density: {
7+
Small: "gap-1.5",
8+
Medium: "gap-2",
9+
Large: "gap-2.5",
10+
},
11+
},
12+
defaultVariants: {
13+
density: "Medium",
14+
},
15+
});
16+
317
// Row min-height variants - matches TextInput heights for consistent form field alignment
418
export const boolInputRowMinHeightVariant = cva("", {
519
variants: {

src/frontend/src/components/ui/input/color-input-variant.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,20 @@ export const colorInputVariant = cva(
1616
},
1717
);
1818

19+
/** Affix row min-height — matches bool/text field heights. */
20+
export const colorInputRowMinHeightVariant = cva("", {
21+
variants: {
22+
density: {
23+
Small: "min-h-7",
24+
Medium: "min-h-9",
25+
Large: "min-h-11",
26+
},
27+
},
28+
defaultVariants: {
29+
density: "Medium",
30+
},
31+
});
32+
1933
export const colorInputPickerVariant = cva("", {
2034
variants: {
2135
density: {

src/frontend/src/components/ui/input/date-range-input-variant.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { cva } from "class-variance-authority";
22

33
export const dateRangeInputVariant = cva(
4-
"w-full justify-start text-left font-normal pr-20 cursor-pointer bg-transparent",
4+
"w-full justify-start text-left font-normal cursor-pointer bg-transparent",
55
{
66
variants: {
77
density: {
8-
Small: "h-8 px-3",
9-
Medium: "h-9 px-4 py-2",
10-
Large: "h-10 px-5 py-2",
8+
Small: "h-7 min-h-7 max-h-7 px-2 py-0 text-xs [&_svg]:!size-3",
9+
Medium: "h-9 min-h-9 max-h-9 px-3 py-0 text-sm [&_svg]:!size-4",
10+
Large: "h-11 min-h-11 max-h-11 px-4 py-0 text-base [&_svg]:!size-5",
1111
},
1212
},
1313
defaultVariants: {
@@ -16,12 +16,12 @@ export const dateRangeInputVariant = cva(
1616
},
1717
);
1818

19-
export const dateRangeInputIconVariant = cva("", {
19+
export const dateRangeInputIconVariant = cva("shrink-0", {
2020
variants: {
2121
density: {
22-
Small: "size-3",
23-
Medium: "size-4",
24-
Large: "size-5",
22+
Small: "!size-3",
23+
Medium: "!size-4",
24+
Large: "!size-5",
2525
},
2626
},
2727
defaultVariants: {

src/frontend/src/components/ui/input/date-time-input-variant.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { cva } from "class-variance-authority";
22

33
export const dateTimeInputVariant = cva(
4-
"w-full justify-start text-left font-normal pr-20 cursor-pointer bg-transparent",
4+
"w-full justify-start text-left font-normal cursor-pointer bg-transparent",
55
{
66
variants: {
77
density: {
8-
Small: "h-7 px-2 text-xs",
9-
Medium: "h-9 px-3 py-2 text-sm",
10-
Large: "h-11 px-4 py-2 text-base",
8+
Small: "h-7 min-h-7 max-h-7 px-2 py-0 text-xs [&_svg]:!size-3",
9+
Medium: "h-9 min-h-9 max-h-9 px-3 py-0 text-sm [&_svg]:!size-4",
10+
Large: "h-11 min-h-11 max-h-11 px-4 py-0 text-base [&_svg]:!size-5",
1111
},
1212
},
1313
defaultVariants: {
@@ -16,7 +16,7 @@ export const dateTimeInputVariant = cva(
1616
},
1717
);
1818

19-
export const dateTimeInputIconVariant = cva("", {
19+
export const dateTimeInputIconVariant = cva("shrink-0", {
2020
variants: {
2121
density: {
2222
Small: "!size-3",

src/frontend/src/components/ui/input/icon-input-variant.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,23 @@ export const iconInputTriggerVariant = cva(
1616
},
1717
);
1818

19+
/** Trigger inside affix shell — heights match textInputSizeVariant (h-7 / h-9 / h-11). */
20+
export const iconInputAffixTriggerVariant = cva(
21+
"justify-start font-normal min-w-0 max-w-none rounded-none border-0 bg-transparent px-0! py-0! shadow-none dark:border-transparent dark:bg-transparent",
22+
{
23+
variants: {
24+
density: {
25+
Small: "h-7 text-xs",
26+
Medium: "h-9 text-sm",
27+
Large: "h-11 text-base",
28+
},
29+
},
30+
defaultVariants: {
31+
density: "Medium",
32+
},
33+
},
34+
);
35+
1936
export const iconInputIconVariant = cva("", {
2037
variants: {
2138
density: {

0 commit comments

Comments
 (0)