@turtleclub/ui 0.7.0-beta.32 → 0.7.0-beta.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/dist/index.cjs +10331 -110
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +7652 -47844
  4. package/dist/index.js.map +1 -1
  5. package/dist/types/components/features/sidebar-layout.d.ts +2 -0
  6. package/dist/types/components/features/sidebar-layout.d.ts.map +1 -1
  7. package/dist/types/components/ui/chart.d.ts +1 -1
  8. package/dist/types/components/ui/chart.d.ts.map +1 -1
  9. package/package.json +26 -22
  10. package/.prettierrc.json +0 -4
  11. package/.turbo/turbo-build.log +0 -182
  12. package/CHANGELOG.md +0 -795
  13. package/components.json +0 -21
  14. package/src/components/charts/QUICK_REFERENCE.md +0 -323
  15. package/src/components/charts/README.md +0 -658
  16. package/src/components/charts/RECHARTS_FEATURES.md +0 -458
  17. package/src/components/charts/area-chart.tsx +0 -248
  18. package/src/components/charts/bar-chart.tsx +0 -362
  19. package/src/components/charts/index.ts +0 -4
  20. package/src/components/charts/pie-chart.tsx +0 -277
  21. package/src/components/charts/radial-chart.tsx +0 -312
  22. package/src/components/features/api-status/index.tsx +0 -23
  23. package/src/components/features/data-table/data-table.tsx +0 -538
  24. package/src/components/features/data-table/expand-toggle.tsx +0 -17
  25. package/src/components/features/data-table/fuzzy-filter.tsx +0 -34
  26. package/src/components/features/data-table/index.ts +0 -3
  27. package/src/components/features/data-table/item-info.tsx +0 -19
  28. package/src/components/features/data-table/skeleton.tsx +0 -23
  29. package/src/components/features/data-table/sort-dropdown.tsx +0 -118
  30. package/src/components/features/data-table/sortable-header.tsx +0 -37
  31. package/src/components/features/index.ts +0 -6
  32. package/src/components/features/page-heading.tsx +0 -27
  33. package/src/components/features/search-bar.tsx +0 -55
  34. package/src/components/features/segmented-navigation.tsx +0 -18
  35. package/src/components/features/sidebar-layout.tsx +0 -193
  36. package/src/components/features/turtle-tooltip.tsx +0 -67
  37. package/src/components/icons/arrow.tsx +0 -23
  38. package/src/components/icons/beta.tsx +0 -95
  39. package/src/components/icons/dot.tsx +0 -102
  40. package/src/components/icons/index.ts +0 -7
  41. package/src/components/icons/issue.tsx +0 -106
  42. package/src/components/icons/turtle.tsx +0 -156
  43. package/src/components/icons/update.tsx +0 -113
  44. package/src/components/icons/warning.tsx +0 -95
  45. package/src/components/molecules/index.ts +0 -9
  46. package/src/components/molecules/opportunity/index.ts +0 -10
  47. package/src/components/molecules/opportunity/opportunity-apr.tsx +0 -129
  48. package/src/components/molecules/opportunity/opportunity-disclaimer.tsx +0 -46
  49. package/src/components/molecules/opportunity/opportunity-rate-estimator.tsx +0 -62
  50. package/src/components/molecules/opportunity/opportunity-section.tsx +0 -113
  51. package/src/components/molecules/opportunity/opportunity-selector.tsx +0 -30
  52. package/src/components/molecules/opportunity/opportunity-type.tsx +0 -16
  53. package/src/components/molecules/route-details.tsx +0 -112
  54. package/src/components/molecules/slippage-selector.tsx +0 -200
  55. package/src/components/molecules/swap-details.tsx +0 -55
  56. package/src/components/molecules/swap-input.tsx +0 -186
  57. package/src/components/molecules/tabs.tsx +0 -79
  58. package/src/components/molecules/token-selector.tsx +0 -180
  59. package/src/components/molecules/tx-status.tsx +0 -312
  60. package/src/components/molecules/widget/asset-list/asset-filters.tsx +0 -113
  61. package/src/components/molecules/widget/asset-list/asset-list.tsx +0 -178
  62. package/src/components/molecules/widget/asset-list/asset-row.tsx +0 -45
  63. package/src/components/molecules/widget/asset-list/hooks/index.ts +0 -2
  64. package/src/components/molecules/widget/asset-list/hooks/use-asset-filtering.ts +0 -44
  65. package/src/components/molecules/widget/asset-list/hooks/use-asset-grouping.ts +0 -87
  66. package/src/components/molecules/widget/asset-list/index.ts +0 -3
  67. package/src/components/molecules/widget/base-selector.tsx +0 -121
  68. package/src/components/molecules/widget/campaign-item.tsx +0 -82
  69. package/src/components/molecules/widget/deal-item.tsx +0 -92
  70. package/src/components/molecules/widget/index.ts +0 -36
  71. package/src/components/molecules/widget/opportunity-item.tsx +0 -105
  72. package/src/components/molecules/widget/widget-item-stats.tsx +0 -50
  73. package/src/components/molecules/widget/widget-item.tsx +0 -139
  74. package/src/components/molecules/widget/widget-list-items.tsx +0 -86
  75. package/src/components/ui/alert-dialog.tsx +0 -163
  76. package/src/components/ui/animated-background/animated-background.tsx +0 -182
  77. package/src/components/ui/animated-background/index.ts +0 -1
  78. package/src/components/ui/avatar.tsx +0 -73
  79. package/src/components/ui/badge.tsx +0 -59
  80. package/src/components/ui/banner.tsx +0 -84
  81. package/src/components/ui/button.tsx +0 -100
  82. package/src/components/ui/card.tsx +0 -119
  83. package/src/components/ui/chart.tsx +0 -346
  84. package/src/components/ui/checkbox.tsx +0 -32
  85. package/src/components/ui/chip.tsx +0 -52
  86. package/src/components/ui/collapsible.tsx +0 -34
  87. package/src/components/ui/combobox.tsx +0 -730
  88. package/src/components/ui/command.tsx +0 -184
  89. package/src/components/ui/dialog.tsx +0 -129
  90. package/src/components/ui/dropdown.tsx +0 -316
  91. package/src/components/ui/field.tsx +0 -244
  92. package/src/components/ui/heading.tsx +0 -74
  93. package/src/components/ui/hover-card.tsx +0 -139
  94. package/src/components/ui/icon-animation.tsx +0 -82
  95. package/src/components/ui/icon-list.tsx +0 -168
  96. package/src/components/ui/index.ts +0 -48
  97. package/src/components/ui/info-card.tsx +0 -110
  98. package/src/components/ui/input-group.tsx +0 -170
  99. package/src/components/ui/input.tsx +0 -72
  100. package/src/components/ui/label-with-icon.tsx +0 -122
  101. package/src/components/ui/label.tsx +0 -24
  102. package/src/components/ui/multi-select.tsx +0 -1090
  103. package/src/components/ui/navigation-bar.tsx +0 -153
  104. package/src/components/ui/navigation-menu.tsx +0 -188
  105. package/src/components/ui/opportunity-details-v1.tsx +0 -104
  106. package/src/components/ui/pagination.tsx +0 -127
  107. package/src/components/ui/popover.tsx +0 -48
  108. package/src/components/ui/scroll-area.tsx +0 -64
  109. package/src/components/ui/segment-control.tsx +0 -146
  110. package/src/components/ui/select.tsx +0 -199
  111. package/src/components/ui/separator.tsx +0 -26
  112. package/src/components/ui/sheet.tsx +0 -139
  113. package/src/components/ui/sidebar.tsx +0 -728
  114. package/src/components/ui/skeleton.tsx +0 -14
  115. package/src/components/ui/slider.tsx +0 -58
  116. package/src/components/ui/sonner.tsx +0 -24
  117. package/src/components/ui/switch.tsx +0 -29
  118. package/src/components/ui/table-shadcn.tsx +0 -110
  119. package/src/components/ui/table.tsx +0 -117
  120. package/src/components/ui/textarea.tsx +0 -22
  121. package/src/components/ui/toggle-group.tsx +0 -71
  122. package/src/components/ui/toggle.tsx +0 -47
  123. package/src/components/ui/tooltip.tsx +0 -66
  124. package/src/hooks/index.ts +0 -1
  125. package/src/hooks/useIsMobile.ts +0 -77
  126. package/src/index.ts +0 -16
  127. package/src/lib/utils.ts +0 -6
  128. package/src/styles/globals.css +0 -181
  129. package/src/styles/themes/index.css +0 -9
  130. package/src/styles/themes/semantic.css +0 -117
  131. package/src/styles/tokens/colors.css +0 -124
  132. package/src/styles/tokens/index.css +0 -15
  133. package/src/styles/tokens/radius.css +0 -18
  134. package/src/styles/tokens/spacing.css +0 -58
  135. package/src/styles/tokens/typography.css +0 -87
  136. package/src/tokens/index.ts +0 -108
  137. package/tsconfig.json +0 -20
  138. package/vite.config.js +0 -49
  139. /package/{src/images/enso.png → dist/enso-22FJ4GNK.png} +0 -0
@@ -1,48 +0,0 @@
1
- export * from "./sonner";
2
- export * from "./switch";
3
- export * from "./toggle-group";
4
- export * from "./toggle";
5
- export * from "./chip";
6
- export * from "./icon-animation";
7
- export * from "./label-with-icon";
8
- export * from "./navigation-bar";
9
- export * from "./info-card";
10
- export * from "./opportunity-details-v1";
11
- export * from "./table";
12
- export * from "./hover-card";
13
- export * from "./icon-list";
14
- export * from "./animated-background";
15
- export * from "./chart";
16
- // What Mati created / touched / reviewed goes below this line.
17
- export * from "./separator";
18
- export * from "./select";
19
- export * from "./button";
20
- export * from "./card";
21
- export * from "./dialog";
22
- export * from "./avatar";
23
- export * from "./badge";
24
- export * from "./table-shadcn";
25
- export * from "./checkbox";
26
- export * from "./dropdown";
27
- export * from "./segment-control";
28
- export * from "./input";
29
- export * from "./input-group";
30
- export * from "./tooltip";
31
- export * from "./navigation-menu";
32
- export * from "./slider";
33
- export * from "./alert-dialog";
34
- export * from "./heading";
35
- export * from "./textarea";
36
- export * from "./field";
37
- export * from "./label";
38
- export * from "./popover";
39
- export * from "./command";
40
- export * from "./multi-select";
41
- export * from "./combobox";
42
- export * from "./scroll-area";
43
- export * from "./sidebar";
44
- export * from "./collapsible";
45
- export * from "./banner";
46
- export * from "./skeleton";
47
- export * from "./pagination";
48
- export * from "./sheet";
@@ -1,110 +0,0 @@
1
- import * as React from "react";
2
- import { cn } from "@/lib/utils";
3
- import { Card } from "./card";
4
- import type { VariantProps } from "class-variance-authority";
5
- import { cva } from "class-variance-authority";
6
-
7
- const infoCardVariants = cva("space-y-1", {
8
- variants: {
9
- align: {
10
- left: "text-left",
11
- center: "text-center",
12
- right: "text-right",
13
- },
14
- },
15
- defaultVariants: {
16
- align: "center",
17
- },
18
- });
19
-
20
- const valueVariants = cva("font-bold", {
21
- variants: {
22
- color: {
23
- primary: "text-foreground",
24
- secondary: "text-muted-foreground",
25
- accent: "text-primary",
26
- success: "text-green-600",
27
- warning: "text-yellow-600",
28
- error: "text-red-600",
29
- },
30
- },
31
- defaultVariants: {
32
- color: "primary",
33
- },
34
- });
35
-
36
- const titleVariants = cva("text-muted-foreground font-medium", {
37
- variants: {
38
- size: {
39
- sm: "text-xs",
40
- default: "text-xs",
41
- lg: "text-sm",
42
- },
43
- },
44
- defaultVariants: {
45
- size: "default",
46
- },
47
- });
48
-
49
- interface InfoCardProps
50
- extends Omit<React.HTMLAttributes<HTMLDivElement>, "color">,
51
- VariantProps<typeof infoCardVariants> {
52
- title: string;
53
- value: string;
54
- color?: VariantProps<typeof valueVariants>["color"];
55
- titleSize?: VariantProps<typeof titleVariants>["size"];
56
- align?: VariantProps<typeof infoCardVariants>["align"];
57
- iconUrl?: string;
58
- subtitle?: string;
59
- }
60
-
61
- const InfoCard = React.forwardRef<HTMLDivElement, InfoCardProps>(
62
- (
63
- {
64
- title,
65
- value,
66
- color = "primary",
67
- titleSize = "default",
68
- align = "center",
69
- iconUrl,
70
- subtitle,
71
- className,
72
- ...props
73
- },
74
- ref,
75
- ) => {
76
- return (
77
- <Card
78
- ref={ref}
79
- variant="shadow"
80
- rounded="infoCard"
81
- className={cn(infoCardVariants({ align }), className)}
82
- {...props}
83
- >
84
- {/* Icon & Title */}
85
- <div className="flex gap-2">
86
- {iconUrl && (
87
- <img
88
- src={iconUrl}
89
- alt={`${title}-icon`}
90
- className="h-5 w-5 rounded-full"
91
- />
92
- )}
93
- <p className={titleVariants({ size: titleSize })}>{title}</p>
94
- </div>
95
-
96
- {/* Value */}
97
- <p className={cn("text-foreground")}>{value}</p>
98
-
99
- {/* Subtitle */}
100
- {subtitle && (
101
- <p className="text-muted-foreground/70 text-xs">{subtitle}</p>
102
- )}
103
- </Card>
104
- );
105
- },
106
- );
107
-
108
- InfoCard.displayName = "InfoCard";
109
-
110
- export { InfoCard };
@@ -1,170 +0,0 @@
1
- "use client";
2
-
3
- import * as React from "react";
4
- import { cva, type VariantProps } from "class-variance-authority";
5
-
6
- import { cn } from "@/lib/utils";
7
- import { Button } from "@/components/ui/button";
8
- import { Input } from "@/components/ui/input";
9
- import { Textarea } from "@/components/ui/textarea";
10
-
11
- function InputGroup({ className, ...props }: React.ComponentProps<"div">) {
12
- return (
13
- <div
14
- data-slot="input-group"
15
- role="group"
16
- className={cn(
17
- "group/input-group border-input relative flex w-full items-center rounded-md border shadow-xs transition-[color,box-shadow] outline-none",
18
- "h-9 min-w-0 has-[>textarea]:h-auto",
19
-
20
- // Variants based on alignment.
21
- "has-[>[data-align=inline-start]]:[&>input]:pl-2",
22
- "has-[>[data-align=inline-end]]:[&>input]:pr-2",
23
- "has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3",
24
- "has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3",
25
-
26
- // Focus state.
27
- "has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot=input-group-control]:focus-visible]:ring-[3px]",
28
-
29
- // Error state.
30
- "has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive",
31
-
32
- className,
33
- )}
34
- {...props}
35
- />
36
- );
37
- }
38
-
39
- const inputGroupAddonVariants = cva(
40
- "text-muted-foreground flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",
41
- {
42
- variants: {
43
- align: {
44
- "inline-start":
45
- "order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]",
46
- "inline-end":
47
- "order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]",
48
- "block-start":
49
- "order-first w-full justify-start px-3 pt-3 group-has-[>input]/input-group:pt-2.5 [.border-b]:pb-3",
50
- "block-end":
51
- "order-last w-full justify-start px-3 pb-3 group-has-[>input]/input-group:pb-2.5 [.border-t]:pt-3",
52
- },
53
- },
54
- defaultVariants: {
55
- align: "inline-start",
56
- },
57
- },
58
- );
59
-
60
- function InputGroupAddon({
61
- className,
62
- align = "inline-start",
63
- ...props
64
- }: React.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>) {
65
- return (
66
- <div
67
- role="group"
68
- data-slot="input-group-addon"
69
- data-align={align}
70
- className={cn(inputGroupAddonVariants({ align }), className)}
71
- onClick={(e) => {
72
- if ((e.target as HTMLElement).closest("button")) {
73
- return;
74
- }
75
- e.currentTarget.parentElement?.querySelector("input")?.focus();
76
- }}
77
- {...props}
78
- />
79
- );
80
- }
81
-
82
- const inputGroupButtonVariants = cva(
83
- "flex items-center gap-2 text-sm shadow-none",
84
- {
85
- variants: {
86
- size: {
87
- xs: "h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-2 has-[>svg]:px-2 [&>svg:not([class*='size-'])]:size-3.5",
88
- sm: "h-8 gap-1.5 rounded-md px-2.5 has-[>svg]:px-2.5",
89
- "icon-xs":
90
- "size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0",
91
- "icon-sm": "size-8 p-0 has-[>svg]:p-0",
92
- },
93
- },
94
- defaultVariants: {
95
- size: "xs",
96
- },
97
- },
98
- );
99
-
100
- function InputGroupButton({
101
- className,
102
- type = "button",
103
- variant = "default",
104
- size = "xs",
105
- ...props
106
- }: Omit<React.ComponentProps<typeof Button>, "size"> &
107
- VariantProps<typeof inputGroupButtonVariants>) {
108
- return (
109
- <Button
110
- type={type}
111
- data-size={size}
112
- variant={variant}
113
- className={cn(inputGroupButtonVariants({ size }), className)}
114
- {...props}
115
- />
116
- );
117
- }
118
-
119
- function InputGroupText({ className, ...props }: React.ComponentProps<"span">) {
120
- return (
121
- <span
122
- className={cn(
123
- "text-muted-foreground flex items-center gap-2 text-sm [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
124
- className,
125
- )}
126
- {...props}
127
- />
128
- );
129
- }
130
-
131
- function InputGroupInput({
132
- className,
133
- ...props
134
- }: React.ComponentProps<"input">) {
135
- return (
136
- <Input
137
- data-slot="input-group-control"
138
- className={cn(
139
- "flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0",
140
- className,
141
- )}
142
- {...props}
143
- />
144
- );
145
- }
146
-
147
- function InputGroupTextarea({
148
- className,
149
- ...props
150
- }: React.ComponentProps<"textarea">) {
151
- return (
152
- <Textarea
153
- data-slot="input-group-control"
154
- className={cn(
155
- "flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0",
156
- className,
157
- )}
158
- {...props}
159
- />
160
- );
161
- }
162
-
163
- export {
164
- InputGroup,
165
- InputGroupAddon,
166
- InputGroupButton,
167
- InputGroupText,
168
- InputGroupInput,
169
- InputGroupTextarea,
170
- };
@@ -1,72 +0,0 @@
1
- import * as React from "react";
2
- import { cva, type VariantProps } from "class-variance-authority";
3
- import { cn } from "@/lib/utils";
4
-
5
- const inputVariants = cva(
6
- [
7
- "placeholder:text-muted-foreground flex w-full px-4 py-2.5 text-base md:text-sm",
8
- "data-invalid:ring-destructive/80 data-invalid:border-destructive",
9
- "disabled:cursor-not-allowed disabled:opacity-50",
10
- "caret-primary shadow transition-[color,box-shadow]",
11
- ],
12
- {
13
- variants: {
14
- variant: {
15
- // Turtle Design System - transparent input with no borders
16
- default:
17
- "bg-neutral-alpha-2 focus-visible:border-ring focus-visible:ring-ring/50 rounded-lg border border-none outline-none focus-visible:ring-2",
18
- // Optional bordered version for other use cases
19
- bordered:
20
- "bg-neutral-alpha-2 border-border focus:border-primary focus:ring-primary/20 caret-primary rounded-lg border focus:ring-2",
21
- // No focus variant - cursor color only, no focus styles
22
- nofocus:
23
- "rounded-none border-none bg-transparent focus:border-none focus:ring-0 focus:outline-none",
24
- },
25
- },
26
- defaultVariants: {
27
- variant: "default",
28
- },
29
- },
30
- );
31
-
32
- export interface InputProps
33
- extends Omit<React.ComponentProps<"input">, "size">,
34
- VariantProps<typeof inputVariants> {
35
- // Optional prompt text that appears before the input
36
- prompt?: string;
37
- }
38
-
39
- const Input = React.forwardRef<HTMLInputElement, InputProps>(
40
- ({ className, variant, type, prompt, ...props }, ref) => {
41
- if (prompt) {
42
- return (
43
- <div className="flex items-center gap-2">
44
- <span className="text-primary shrink-0 text-sm font-medium">
45
- {prompt}
46
- </span>
47
- <input
48
- type={type}
49
- data-slot="input"
50
- className={cn(inputVariants({ variant, className }))}
51
- ref={ref}
52
- {...props}
53
- />
54
- </div>
55
- );
56
- }
57
-
58
- return (
59
- <input
60
- type={type}
61
- data-slot="control"
62
- className={cn(inputVariants({ variant, className }))}
63
- ref={ref}
64
- {...props}
65
- />
66
- );
67
- },
68
- );
69
-
70
- Input.displayName = "Input";
71
-
72
- export { Input, inputVariants };
@@ -1,122 +0,0 @@
1
- import * as React from "react";
2
- import { cva, type VariantProps } from "class-variance-authority";
3
-
4
- import { cn } from "@/lib/utils";
5
-
6
- const labelWithIconVariants = cva(
7
- "inline-flex items-center gap-2 font-medium",
8
- {
9
- variants: {
10
- variant: {
11
- default: "text-foreground",
12
- muted: "text-muted-foreground",
13
- primary: "text-primary",
14
- secondary: "text-secondary-foreground",
15
- },
16
- textSize: {
17
- xs: "text-xs",
18
- sm: "text-sm",
19
- base: "text-base",
20
- lg: "text-lg",
21
- xl: "text-xl",
22
- "2xl": "text-2xl",
23
- "3xl": "text-3xl",
24
- "4xl": "text-4xl",
25
- "5xl": "text-5xl",
26
- "6xl": "text-6xl",
27
- "7xl": "text-7xl",
28
- "8xl": "text-8xl",
29
- },
30
- },
31
- defaultVariants: {
32
- variant: "default",
33
- textSize: "sm",
34
- },
35
- },
36
- );
37
-
38
- const iconSizeClasses = {
39
- xs: "w-3 h-3",
40
- sm: "w-4 h-4",
41
- base: "w-5 h-5",
42
- lg: "w-6 h-6",
43
- xl: "w-8 h-8",
44
- };
45
-
46
- export interface LabelWithIconProps
47
- extends React.ComponentProps<"div">,
48
- VariantProps<typeof labelWithIconVariants> {
49
- icon: React.ReactNode | string; // Can be a component or URL string
50
- children: React.ReactNode;
51
- iconPosition?: "left" | "right";
52
- iconSize?: keyof typeof iconSizeClasses;
53
- iconClassName?: string; // Additional classes for the icon
54
- }
55
-
56
- const LabelWithIcon = React.forwardRef<HTMLDivElement, LabelWithIconProps>(
57
- (
58
- {
59
- className,
60
- variant,
61
- textSize,
62
- icon,
63
- children,
64
- iconPosition = "left",
65
- iconSize = "sm",
66
- iconClassName,
67
- ...props
68
- },
69
- ref,
70
- ) => {
71
- const renderIcon = () => {
72
- // If icon is a string (URL), render as img
73
- if (typeof icon === "string") {
74
- return (
75
- <img
76
- src={icon}
77
- alt=""
78
- className={cn(
79
- iconSizeClasses[iconSize],
80
- "rounded-full object-contain",
81
- iconClassName,
82
- )}
83
- />
84
- );
85
- }
86
-
87
- // If icon is a React component, render it directly
88
- // If it's a Lucide icon or any other component, it will be rendered as-is
89
- return (
90
- <span className={cn("shrink-0", iconClassName)}>
91
- {React.isValidElement(icon)
92
- ? React.cloneElement(icon as React.ReactElement<any>, {
93
- className: cn(
94
- iconSizeClasses[iconSize],
95
- (icon as any).props?.className,
96
- ),
97
- })
98
- : icon}
99
- </span>
100
- );
101
- };
102
-
103
- return (
104
- <div
105
- ref={ref}
106
- className={cn(
107
- labelWithIconVariants({ variant, textSize }),
108
- iconPosition === "right" && "flex-row-reverse",
109
- className,
110
- )}
111
- {...props}
112
- >
113
- {renderIcon()}
114
- <span>{children}</span>
115
- </div>
116
- );
117
- },
118
- );
119
-
120
- LabelWithIcon.displayName = "LabelWithIcon";
121
-
122
- export { LabelWithIcon, labelWithIconVariants };
@@ -1,24 +0,0 @@
1
- "use client";
2
-
3
- import * as React from "react";
4
- import * as LabelPrimitive from "@radix-ui/react-label";
5
-
6
- import { cn } from "@/lib/utils";
7
-
8
- function Label({
9
- className,
10
- ...props
11
- }: React.ComponentProps<typeof LabelPrimitive.Root>) {
12
- return (
13
- <LabelPrimitive.Root
14
- data-slot="label"
15
- className={cn(
16
- "flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
17
- className,
18
- )}
19
- {...props}
20
- />
21
- );
22
- }
23
-
24
- export { Label };