@traky-app/ui 1.2.0 → 1.3.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@traky-app/ui",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Componentes Traky UI para importar desde @traky-app/ui, más el registro copy-paste.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -0,0 +1,20 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "entity-icon",
4
+ "type": "registry:ui",
5
+ "author": "Traky (https://traky.app)",
6
+ "dependencies": [
7
+ "class-variance-authority"
8
+ ],
9
+ "registryDependencies": [
10
+ "card"
11
+ ],
12
+ "files": [
13
+ {
14
+ "path": "ui/entity-icon.tsx",
15
+ "content": "import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Card } from \"@/components/ui/card\"\n\nconst entityIconVariants = cva(\n \"w-fit shrink-0 bg-primary text-primary-foreground [&_svg]:shrink-0\",\n {\n variants: {\n size: {\n xs: \"p-1 [&_svg]:size-3.5\",\n sm: \"p-1.5 [&_svg]:size-5\",\n md: \"p-2 [&_svg]:size-6\",\n lg: \"p-2 [&_svg]:size-7\",\n xl: \"p-2.5 [&_svg]:size-8\",\n },\n },\n defaultVariants: {\n size: \"md\",\n },\n },\n)\n\ntype IconComponent = React.ComponentType<{\n className?: string\n stroke?: number\n}>\n\nfunction EntityIcon({\n icon: Icon,\n size = \"md\",\n className,\n iconClassName,\n ...props\n}: React.ComponentProps<typeof Card> &\n VariantProps<typeof entityIconVariants> & {\n icon: IconComponent\n iconClassName?: string\n }) {\n return (\n <Card\n data-slot=\"entity-icon\"\n data-size={size}\n className={cn(entityIconVariants({ size }), className)}\n {...props}\n >\n <Icon className={iconClassName} stroke={1.75} />\n </Card>\n )\n}\n\nexport { EntityIcon, entityIconVariants }\n",
16
+ "type": "registry:ui",
17
+ "target": ""
18
+ }
19
+ ]
20
+ }
@@ -263,6 +263,16 @@
263
263
  }
264
264
  ]
265
265
  },
266
+ {
267
+ "name": "entity-icon",
268
+ "type": "registry:ui",
269
+ "files": [
270
+ {
271
+ "path": "json/entity-icon.json",
272
+ "type": "registry:file"
273
+ }
274
+ ]
275
+ },
266
276
  {
267
277
  "name": "field",
268
278
  "type": "registry:ui",
@@ -0,0 +1,53 @@
1
+ import * as React from "react"
2
+ import { cva, type VariantProps } from "class-variance-authority"
3
+
4
+ import { cn } from "@/lib/utils"
5
+ import { Card } from "@/components/ui/card"
6
+
7
+ const entityIconVariants = cva(
8
+ "w-fit shrink-0 bg-primary text-primary-foreground [&_svg]:shrink-0",
9
+ {
10
+ variants: {
11
+ size: {
12
+ xs: "p-1 [&_svg]:size-3.5",
13
+ sm: "p-1.5 [&_svg]:size-5",
14
+ md: "p-2 [&_svg]:size-6",
15
+ lg: "p-2 [&_svg]:size-7",
16
+ xl: "p-2.5 [&_svg]:size-8",
17
+ },
18
+ },
19
+ defaultVariants: {
20
+ size: "md",
21
+ },
22
+ },
23
+ )
24
+
25
+ type IconComponent = React.ComponentType<{
26
+ className?: string
27
+ stroke?: number
28
+ }>
29
+
30
+ function EntityIcon({
31
+ icon: Icon,
32
+ size = "md",
33
+ className,
34
+ iconClassName,
35
+ ...props
36
+ }: React.ComponentProps<typeof Card> &
37
+ VariantProps<typeof entityIconVariants> & {
38
+ icon: IconComponent
39
+ iconClassName?: string
40
+ }) {
41
+ return (
42
+ <Card
43
+ data-slot="entity-icon"
44
+ data-size={size}
45
+ className={cn(entityIconVariants({ size }), className)}
46
+ {...props}
47
+ >
48
+ <Icon className={iconClassName} stroke={1.75} />
49
+ </Card>
50
+ )
51
+ }
52
+
53
+ export { EntityIcon, entityIconVariants }
@@ -0,0 +1,53 @@
1
+ import * as React from "react"
2
+ import { cva, type VariantProps } from "class-variance-authority"
3
+
4
+ import { cn } from "../lib/utils"
5
+ import { Card } from "./card"
6
+
7
+ const entityIconVariants = cva(
8
+ "w-fit shrink-0 bg-primary text-primary-foreground [&_svg]:shrink-0",
9
+ {
10
+ variants: {
11
+ size: {
12
+ xs: "p-1 [&_svg]:size-3.5",
13
+ sm: "p-1.5 [&_svg]:size-5",
14
+ md: "p-2 [&_svg]:size-6",
15
+ lg: "p-2 [&_svg]:size-7",
16
+ xl: "p-2.5 [&_svg]:size-8",
17
+ },
18
+ },
19
+ defaultVariants: {
20
+ size: "md",
21
+ },
22
+ },
23
+ )
24
+
25
+ type IconComponent = React.ComponentType<{
26
+ className?: string
27
+ stroke?: number
28
+ }>
29
+
30
+ function EntityIcon({
31
+ icon: Icon,
32
+ size = "md",
33
+ className,
34
+ iconClassName,
35
+ ...props
36
+ }: React.ComponentProps<typeof Card> &
37
+ VariantProps<typeof entityIconVariants> & {
38
+ icon: IconComponent
39
+ iconClassName?: string
40
+ }) {
41
+ return (
42
+ <Card
43
+ data-slot="entity-icon"
44
+ data-size={size}
45
+ className={cn(entityIconVariants({ size }), className)}
46
+ {...props}
47
+ >
48
+ <Icon className={iconClassName} stroke={1.75} />
49
+ </Card>
50
+ )
51
+ }
52
+
53
+ export { EntityIcon, entityIconVariants }