@traky-app/ui 1.1.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.1.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",
@@ -55,6 +55,8 @@
55
55
  "@radix-ui/react-tooltip": "^1.2.16",
56
56
  "@tabler/icons-react": "^3.46.0",
57
57
  "@types/geojson": "^7946.0.16",
58
+ "@types/react": "^19.3.0",
59
+ "@types/react-dom": "^19.3.0",
58
60
  "class-variance-authority": "^0.7.1",
59
61
  "clsx": "^2.1.1",
60
62
  "cmdk": "^1.1.1",
@@ -14,7 +14,7 @@
14
14
  "files": [
15
15
  {
16
16
  "path": "ui/command.tsx",
17
- "content": "\"use client\"\n\nimport { IconSearch } from \"@tabler/icons-react\";\nimport * as React from \"react\"\nimport { Command as CommandPrimitive } from \"cmdk\"\nimport { DISABLE_INPUT_AUTOFILL } from \"@/lib/disable-input-autofill\"\nimport { cn } from \"@/lib/utils\"\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogHeader,\n DialogTitle,\n} from \"@/components/ui/dialog\"\n\nfunction Command({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive>) {\n return (\n <CommandPrimitive\n data-slot=\"command\"\n className={cn(\n \"bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CommandDialog({\n title = \"Command Palette\",\n description = \"Search for a command to run...\",\n children,\n className,\n showCloseButton = true,\n ...props\n}: React.ComponentProps<typeof Dialog> & {\n title?: string\n description?: string\n className?: string\n showCloseButton?: boolean\n}) {\n return (\n <Dialog {...props}>\n <DialogHeader className=\"sr-only\">\n <DialogTitle>{title}</DialogTitle>\n <DialogDescription>{description}</DialogDescription>\n </DialogHeader>\n <DialogContent\n className={cn(\"overflow-hidden p-0\", className)}\n showCloseButton={showCloseButton}\n >\n <Command className=\"[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5\">\n {children}\n </Command>\n </DialogContent>\n </Dialog>\n )\n}\n\nfunction CommandInput({\n className,\n name,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Input>) {\n return (\n <div\n data-slot=\"command-input-wrapper\"\n className=\"flex h-9 items-center gap-2 border-b px-3\"\n >\n <IconSearch className=\"size-4 shrink-0 opacity-50\" />\n <CommandPrimitive.Input\n data-slot=\"command-input\"\n // type=search + anti-autofill: evita iCloud Password / gestores\n // en “Buscar usuario”, “Buscar dirección”, etc.\n {...DISABLE_INPUT_AUTOFILL}\n type=\"search\"\n enterKeyHint=\"search\"\n name={name ?? \"traky-command-search\"}\n className={cn(\n \"placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50\",\n className\n )}\n {...props}\n />\n </div>\n )\n}\n\nfunction CommandList({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.List>) {\n return (\n <CommandPrimitive.List\n data-slot=\"command-list\"\n className={cn(\n \"max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CommandEmpty({\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Empty>) {\n return (\n <CommandPrimitive.Empty\n data-slot=\"command-empty\"\n className=\"py-6 text-center text-sm\"\n {...props}\n />\n )\n}\n\nfunction CommandGroup({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Group>) {\n return (\n <CommandPrimitive.Group\n data-slot=\"command-group\"\n className={cn(\n \"text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CommandSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Separator>) {\n return (\n <CommandPrimitive.Separator\n data-slot=\"command-separator\"\n className={cn(\"bg-border -mx-1 h-px\", className)}\n {...props}\n />\n )\n}\n\nfunction CommandItem({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Item>) {\n return (\n <CommandPrimitive.Item\n data-slot=\"command-item\"\n className={cn(\n \"data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CommandShortcut({\n className,\n ...props\n}: React.ComponentProps<\"span\">) {\n return (\n <span\n data-slot=\"command-shortcut\"\n className={cn(\n \"text-muted-foreground ml-auto text-xs tracking-widest\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n Command,\n CommandDialog,\n CommandInput,\n CommandList,\n CommandEmpty,\n CommandGroup,\n CommandItem,\n CommandShortcut,\n CommandSeparator,\n}\n",
17
+ "content": "\"use client\"\n\nimport { IconSearch } from \"@tabler/icons-react\";\nimport * as React from \"react\"\nimport { Command as CommandPrimitive } from \"cmdk\"\nimport { DISABLE_INPUT_AUTOFILL } from \"@/lib/disable-input-autofill\"\nimport { cn } from \"@/lib/utils\"\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogHeader,\n DialogTitle,\n} from \"@/components/ui/dialog\"\n\nfunction Command({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive>) {\n return (\n <CommandPrimitive\n data-slot=\"command\"\n className={cn(\n \"bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CommandDialog({\n title = \"Command Palette\",\n description = \"Search for a command to run...\",\n children,\n className,\n showCloseButton = true,\n ...props\n}: React.ComponentProps<typeof Dialog> & {\n title?: string\n description?: string\n className?: string\n showCloseButton?: boolean\n}) {\n return (\n <Dialog {...props}>\n <DialogHeader className=\"sr-only\">\n <DialogTitle>{title}</DialogTitle>\n <DialogDescription>{description}</DialogDescription>\n </DialogHeader>\n <DialogContent\n className={cn(\"overflow-hidden p-0\", className)}\n showCloseButton={showCloseButton}\n >\n <Command className=\"[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5\">\n {children}\n </Command>\n </DialogContent>\n </Dialog>\n )\n}\n\nfunction CommandInput({\n className,\n name,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Input>) {\n return (\n <div\n data-slot=\"command-input-wrapper\"\n className=\"flex h-9 items-center gap-2 border-b px-3\"\n >\n <IconSearch className=\"size-4 shrink-0 opacity-50\" />\n <CommandPrimitive.Input\n data-slot=\"command-input\"\n // type=search + anti-autofill: evita iCloud Password / gestores\n // en “Buscar usuario”, “Buscar dirección”, etc.\n {...DISABLE_INPUT_AUTOFILL}\n // cmdk omite `type` de sus props, pero el input sí lo recibe.\n {...({ type: \"search\" } as React.ComponentProps<typeof CommandPrimitive.Input>)}\n enterKeyHint=\"search\"\n name={name ?? \"traky-command-search\"}\n className={cn(\n \"placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50\",\n className\n )}\n {...props}\n />\n </div>\n )\n}\n\nfunction CommandList({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.List>) {\n return (\n <CommandPrimitive.List\n data-slot=\"command-list\"\n className={cn(\n \"max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CommandEmpty({\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Empty>) {\n return (\n <CommandPrimitive.Empty\n data-slot=\"command-empty\"\n className=\"py-6 text-center text-sm\"\n {...props}\n />\n )\n}\n\nfunction CommandGroup({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Group>) {\n return (\n <CommandPrimitive.Group\n data-slot=\"command-group\"\n className={cn(\n \"text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CommandSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Separator>) {\n return (\n <CommandPrimitive.Separator\n data-slot=\"command-separator\"\n className={cn(\"bg-border -mx-1 h-px\", className)}\n {...props}\n />\n )\n}\n\nfunction CommandItem({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Item>) {\n return (\n <CommandPrimitive.Item\n data-slot=\"command-item\"\n className={cn(\n \"data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CommandShortcut({\n className,\n ...props\n}: React.ComponentProps<\"span\">) {\n return (\n <span\n data-slot=\"command-shortcut\"\n className={cn(\n \"text-muted-foreground ml-auto text-xs tracking-widest\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n Command,\n CommandDialog,\n CommandInput,\n CommandList,\n CommandEmpty,\n CommandGroup,\n CommandItem,\n CommandShortcut,\n CommandSeparator,\n}\n",
18
18
  "type": "registry:ui",
19
19
  "target": ""
20
20
  }
@@ -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
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "icon",
4
+ "type": "registry:ui",
5
+ "author": "Traky (https://traky.app)",
6
+ "dependencies": [
7
+ "class-variance-authority"
8
+ ],
9
+ "files": [
10
+ {
11
+ "path": "ui/icon.tsx",
12
+ "content": "import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst iconVariants = cva(\"inline-flex items-start\", {\n variants: {\n variant: {\n green: \"text-[#a5dd64]\",\n blue: \"text-[#000b27]\",\n white: \"text-white\",\n },\n size: {\n xs: \"[&_svg]:h-6\",\n sm: \"[&_svg]:h-10\",\n md: \"[&_svg]:h-14\",\n lg: \"[&_svg]:h-20\",\n },\n },\n defaultVariants: {\n variant: \"green\",\n size: \"md\",\n },\n})\n\nconst ICON_PATH =\n \"M137.5,137.32c32.32-32.32,31.39-85.48-2.79-116.6-30.34-27.63-78.03-27.63-108.37,0C-2.4,46.89-7.62,88.67,10.67,120.51c7.17,12.47,18.17,22.28,31.67,27.27,11.56,4.27,23.9,5.5,33.94,3.23l-20.23,19.95,23.62,23.62s55.88-55.31,57.83-57.26ZM55.69,105.19c-13.7-13.7-13.7-35.99,0-49.69,13.7-13.7,35.99-13.7,49.69,0,13.7,13.7,13.7,35.99,0,49.69-13.7,13.7-35.99,13.7-49.69,0Z\"\n\ntype IconProps = React.ComponentProps<\"span\"> &\n VariantProps<typeof iconVariants> & {\n /** Muestra ® junto al isotipo. */\n registered?: boolean\n }\n\nfunction Icon({\n className,\n variant = \"green\",\n size = \"md\",\n registered = false,\n ...props\n}: IconProps) {\n return (\n <span\n data-slot=\"icon\"\n data-variant={variant}\n data-size={size}\n className={cn(iconVariants({ variant, size }), className)}\n {...props}\n >\n <svg\n viewBox=\"0 0 161.06 194.58\"\n role=\"img\"\n aria-label=\"Traky\"\n className=\"block w-auto fill-current\"\n >\n <path d={ICON_PATH} />\n </svg>\n {registered ? (\n <sup\n className=\"ml-0.5 text-[0.55em] leading-none font-semibold select-none opacity-80\"\n aria-hidden\n >\n ®\n </sup>\n ) : null}\n </span>\n )\n}\n\nexport { Icon, iconVariants }\nexport type { IconProps }\n",
13
+ "type": "registry:ui",
14
+ "target": ""
15
+ }
16
+ ]
17
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "logo",
4
+ "type": "registry:ui",
5
+ "author": "Traky (https://traky.app)",
6
+ "dependencies": [
7
+ "class-variance-authority"
8
+ ],
9
+ "files": [
10
+ {
11
+ "path": "ui/logo.tsx",
12
+ "content": "import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst logoVariants = cva(\"inline-flex items-start\", {\n variants: {\n variant: {\n green: \"text-[#a5dd64]\",\n blue: \"text-[#000b27]\",\n white: \"text-white\",\n },\n size: {\n xs: \"[&_svg]:h-6\",\n sm: \"[&_svg]:h-10\",\n md: \"[&_svg]:h-14\",\n lg: \"[&_svg]:h-20\",\n },\n },\n defaultVariants: {\n variant: \"green\",\n size: \"md\",\n },\n})\n\nconst LOGO_PATHS = [\n \"M259.89,30.16l-12,44.79h-5.2c-14.45,0-17.26-8.8-14.36-19.61l6.76-25.24h-14.21l-6.76,25.24c-5,18.65,6.11,33.82,24.76,33.82h5.2l-1.84,6.08c-2.9,10.81-14.06,19.61-24.87,19.61h-16.38l-3.81,14.21h16.38c18.65,0,37.89-15.17,42.88-33.82l17.65-65.08h-14.21Z\",\n \"M15.4,55.45l2.72-10.15h28.64l4-14.91h-28.64L30.26,0h-14.21L1.2,55.45c-5,18.65,6.11,33.82,24.76,33.82h9.02l3.81-14.21h-9.02c-10.82,0-17.26-8.8-14.36-19.62Z\",\n \"M186.36,56.58l25.6-16.04,2.71-10.11h-10.01l-38.7,24.32,6.53-24.38h-13.6l-15.77,58.85h13.6l5.47-20.43h10.6c10.56,0,16.85,8.59,14.02,19.15l-.33,1.23h13.87l.33-1.23c3.91-14.61-2.31-27.01-14.32-31.35Z\",\n \"M122.83,28.78c-11.62,0-23.48,6.65-31.07,16.33l3.78-14.1h-4.37c-7.07,0-14.34,2.25-20.93,6.04l1.78-6.64h-15.15l-4.06,15.15h6.4c-5.58,5.6-9.85,12.4-11.81,19.68l-6.52,24.33h14.98s6.63-24.74,6.63-24.74c2.9-10.81,14.06-19.61,24.87-19.61h4.32c-3.18,4.09-5.62,8.7-6.93,13.6-4.44,16.56,5.43,30.03,21.99,30.03,6.5,0,13.07-2.1,18.94-5.62l-1.59,5.92h12.45s8-29.31,8.28-30.33c4.44-16.56-5.43-30.03-21.99-30.03ZM110.45,74.99c-8.91,0-14.22-7.25-11.84-16.17,2.39-8.91,11.59-16.17,20.5-16.17s14.22,7.25,11.84,16.17c-2.39,8.91-11.59,16.17-20.5,16.17Z\",\n] as const\n\ntype LogoProps = React.ComponentProps<\"span\"> &\n VariantProps<typeof logoVariants> & {\n /** Muestra ® junto al wordmark. */\n registered?: boolean\n }\n\nfunction Logo({\n className,\n variant = \"green\",\n size = \"md\",\n registered = false,\n ...props\n}: LogoProps) {\n return (\n <span\n data-slot=\"logo\"\n data-variant={variant}\n data-size={size}\n className={cn(logoVariants({ variant, size }), className)}\n {...props}\n >\n <svg\n viewBox=\"0 0 274.1 129.06\"\n role=\"img\"\n aria-label=\"Traky\"\n className=\"block w-auto fill-current\"\n >\n {LOGO_PATHS.map((d) => (\n <path key={d.slice(0, 12)} d={d} />\n ))}\n </svg>\n {registered ? (\n <sup\n className=\"ml-0.5 text-[0.55em] leading-none font-semibold select-none opacity-80\"\n aria-hidden\n >\n ®\n </sup>\n ) : null}\n </span>\n )\n}\n\nexport { Logo, logoVariants }\nexport type { LogoProps }\n",
13
+ "type": "registry:ui",
14
+ "target": ""
15
+ }
16
+ ]
17
+ }
@@ -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",
@@ -293,6 +303,16 @@
293
303
  }
294
304
  ]
295
305
  },
306
+ {
307
+ "name": "icon",
308
+ "type": "registry:ui",
309
+ "files": [
310
+ {
311
+ "path": "json/icon.json",
312
+ "type": "registry:file"
313
+ }
314
+ ]
315
+ },
296
316
  {
297
317
  "name": "input-group",
298
318
  "type": "registry:ui",
@@ -353,6 +373,16 @@
353
373
  }
354
374
  ]
355
375
  },
376
+ {
377
+ "name": "logo",
378
+ "type": "registry:ui",
379
+ "files": [
380
+ {
381
+ "path": "json/logo.json",
382
+ "type": "registry:file"
383
+ }
384
+ ]
385
+ },
356
386
  {
357
387
  "name": "map",
358
388
  "type": "registry:ui",
@@ -76,7 +76,8 @@ function CommandInput({
76
76
  // type=search + anti-autofill: evita iCloud Password / gestores
77
77
  // en “Buscar usuario”, “Buscar dirección”, etc.
78
78
  {...DISABLE_INPUT_AUTOFILL}
79
- type="search"
79
+ // cmdk omite `type` de sus props, pero el input sí lo recibe.
80
+ {...({ type: "search" } as React.ComponentProps<typeof CommandPrimitive.Input>)}
80
81
  enterKeyHint="search"
81
82
  name={name ?? "traky-command-search"}
82
83
  className={cn(
@@ -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,71 @@
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 iconVariants = cva("inline-flex items-start", {
7
+ variants: {
8
+ variant: {
9
+ green: "text-[#a5dd64]",
10
+ blue: "text-[#000b27]",
11
+ white: "text-white",
12
+ },
13
+ size: {
14
+ xs: "[&_svg]:h-6",
15
+ sm: "[&_svg]:h-10",
16
+ md: "[&_svg]:h-14",
17
+ lg: "[&_svg]:h-20",
18
+ },
19
+ },
20
+ defaultVariants: {
21
+ variant: "green",
22
+ size: "md",
23
+ },
24
+ })
25
+
26
+ const ICON_PATH =
27
+ "M137.5,137.32c32.32-32.32,31.39-85.48-2.79-116.6-30.34-27.63-78.03-27.63-108.37,0C-2.4,46.89-7.62,88.67,10.67,120.51c7.17,12.47,18.17,22.28,31.67,27.27,11.56,4.27,23.9,5.5,33.94,3.23l-20.23,19.95,23.62,23.62s55.88-55.31,57.83-57.26ZM55.69,105.19c-13.7-13.7-13.7-35.99,0-49.69,13.7-13.7,35.99-13.7,49.69,0,13.7,13.7,13.7,35.99,0,49.69-13.7,13.7-35.99,13.7-49.69,0Z"
28
+
29
+ type IconProps = React.ComponentProps<"span"> &
30
+ VariantProps<typeof iconVariants> & {
31
+ /** Muestra ® junto al isotipo. */
32
+ registered?: boolean
33
+ }
34
+
35
+ function Icon({
36
+ className,
37
+ variant = "green",
38
+ size = "md",
39
+ registered = false,
40
+ ...props
41
+ }: IconProps) {
42
+ return (
43
+ <span
44
+ data-slot="icon"
45
+ data-variant={variant}
46
+ data-size={size}
47
+ className={cn(iconVariants({ variant, size }), className)}
48
+ {...props}
49
+ >
50
+ <svg
51
+ viewBox="0 0 161.06 194.58"
52
+ role="img"
53
+ aria-label="Traky"
54
+ className="block w-auto fill-current"
55
+ >
56
+ <path d={ICON_PATH} />
57
+ </svg>
58
+ {registered ? (
59
+ <sup
60
+ className="ml-0.5 text-[0.55em] leading-none font-semibold select-none opacity-80"
61
+ aria-hidden
62
+ >
63
+ ®
64
+ </sup>
65
+ ) : null}
66
+ </span>
67
+ )
68
+ }
69
+
70
+ export { Icon, iconVariants }
71
+ export type { IconProps }
@@ -0,0 +1,77 @@
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 logoVariants = cva("inline-flex items-start", {
7
+ variants: {
8
+ variant: {
9
+ green: "text-[#a5dd64]",
10
+ blue: "text-[#000b27]",
11
+ white: "text-white",
12
+ },
13
+ size: {
14
+ xs: "[&_svg]:h-6",
15
+ sm: "[&_svg]:h-10",
16
+ md: "[&_svg]:h-14",
17
+ lg: "[&_svg]:h-20",
18
+ },
19
+ },
20
+ defaultVariants: {
21
+ variant: "green",
22
+ size: "md",
23
+ },
24
+ })
25
+
26
+ const LOGO_PATHS = [
27
+ "M259.89,30.16l-12,44.79h-5.2c-14.45,0-17.26-8.8-14.36-19.61l6.76-25.24h-14.21l-6.76,25.24c-5,18.65,6.11,33.82,24.76,33.82h5.2l-1.84,6.08c-2.9,10.81-14.06,19.61-24.87,19.61h-16.38l-3.81,14.21h16.38c18.65,0,37.89-15.17,42.88-33.82l17.65-65.08h-14.21Z",
28
+ "M15.4,55.45l2.72-10.15h28.64l4-14.91h-28.64L30.26,0h-14.21L1.2,55.45c-5,18.65,6.11,33.82,24.76,33.82h9.02l3.81-14.21h-9.02c-10.82,0-17.26-8.8-14.36-19.62Z",
29
+ "M186.36,56.58l25.6-16.04,2.71-10.11h-10.01l-38.7,24.32,6.53-24.38h-13.6l-15.77,58.85h13.6l5.47-20.43h10.6c10.56,0,16.85,8.59,14.02,19.15l-.33,1.23h13.87l.33-1.23c3.91-14.61-2.31-27.01-14.32-31.35Z",
30
+ "M122.83,28.78c-11.62,0-23.48,6.65-31.07,16.33l3.78-14.1h-4.37c-7.07,0-14.34,2.25-20.93,6.04l1.78-6.64h-15.15l-4.06,15.15h6.4c-5.58,5.6-9.85,12.4-11.81,19.68l-6.52,24.33h14.98s6.63-24.74,6.63-24.74c2.9-10.81,14.06-19.61,24.87-19.61h4.32c-3.18,4.09-5.62,8.7-6.93,13.6-4.44,16.56,5.43,30.03,21.99,30.03,6.5,0,13.07-2.1,18.94-5.62l-1.59,5.92h12.45s8-29.31,8.28-30.33c4.44-16.56-5.43-30.03-21.99-30.03ZM110.45,74.99c-8.91,0-14.22-7.25-11.84-16.17,2.39-8.91,11.59-16.17,20.5-16.17s14.22,7.25,11.84,16.17c-2.39,8.91-11.59,16.17-20.5,16.17Z",
31
+ ] as const
32
+
33
+ type LogoProps = React.ComponentProps<"span"> &
34
+ VariantProps<typeof logoVariants> & {
35
+ /** Muestra ® junto al wordmark. */
36
+ registered?: boolean
37
+ }
38
+
39
+ function Logo({
40
+ className,
41
+ variant = "green",
42
+ size = "md",
43
+ registered = false,
44
+ ...props
45
+ }: LogoProps) {
46
+ return (
47
+ <span
48
+ data-slot="logo"
49
+ data-variant={variant}
50
+ data-size={size}
51
+ className={cn(logoVariants({ variant, size }), className)}
52
+ {...props}
53
+ >
54
+ <svg
55
+ viewBox="0 0 274.1 129.06"
56
+ role="img"
57
+ aria-label="Traky"
58
+ className="block w-auto fill-current"
59
+ >
60
+ {LOGO_PATHS.map((d) => (
61
+ <path key={d.slice(0, 12)} d={d} />
62
+ ))}
63
+ </svg>
64
+ {registered ? (
65
+ <sup
66
+ className="ml-0.5 text-[0.55em] leading-none font-semibold select-none opacity-80"
67
+ aria-hidden
68
+ >
69
+ ®
70
+ </sup>
71
+ ) : null}
72
+ </span>
73
+ )
74
+ }
75
+
76
+ export { Logo, logoVariants }
77
+ export type { LogoProps }
@@ -76,7 +76,8 @@ function CommandInput({
76
76
  // type=search + anti-autofill: evita iCloud Password / gestores
77
77
  // en “Buscar usuario”, “Buscar dirección”, etc.
78
78
  {...DISABLE_INPUT_AUTOFILL}
79
- type="search"
79
+ // cmdk omite `type` de sus props, pero el input sí lo recibe.
80
+ {...({ type: "search" } as React.ComponentProps<typeof CommandPrimitive.Input>)}
80
81
  enterKeyHint="search"
81
82
  name={name ?? "traky-command-search"}
82
83
  className={cn(
@@ -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 }
@@ -0,0 +1,71 @@
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 iconVariants = cva("inline-flex items-start", {
7
+ variants: {
8
+ variant: {
9
+ green: "text-[#a5dd64]",
10
+ blue: "text-[#000b27]",
11
+ white: "text-white",
12
+ },
13
+ size: {
14
+ xs: "[&_svg]:h-6",
15
+ sm: "[&_svg]:h-10",
16
+ md: "[&_svg]:h-14",
17
+ lg: "[&_svg]:h-20",
18
+ },
19
+ },
20
+ defaultVariants: {
21
+ variant: "green",
22
+ size: "md",
23
+ },
24
+ })
25
+
26
+ const ICON_PATH =
27
+ "M137.5,137.32c32.32-32.32,31.39-85.48-2.79-116.6-30.34-27.63-78.03-27.63-108.37,0C-2.4,46.89-7.62,88.67,10.67,120.51c7.17,12.47,18.17,22.28,31.67,27.27,11.56,4.27,23.9,5.5,33.94,3.23l-20.23,19.95,23.62,23.62s55.88-55.31,57.83-57.26ZM55.69,105.19c-13.7-13.7-13.7-35.99,0-49.69,13.7-13.7,35.99-13.7,49.69,0,13.7,13.7,13.7,35.99,0,49.69-13.7,13.7-35.99,13.7-49.69,0Z"
28
+
29
+ type IconProps = React.ComponentProps<"span"> &
30
+ VariantProps<typeof iconVariants> & {
31
+ /** Muestra ® junto al isotipo. */
32
+ registered?: boolean
33
+ }
34
+
35
+ function Icon({
36
+ className,
37
+ variant = "green",
38
+ size = "md",
39
+ registered = false,
40
+ ...props
41
+ }: IconProps) {
42
+ return (
43
+ <span
44
+ data-slot="icon"
45
+ data-variant={variant}
46
+ data-size={size}
47
+ className={cn(iconVariants({ variant, size }), className)}
48
+ {...props}
49
+ >
50
+ <svg
51
+ viewBox="0 0 161.06 194.58"
52
+ role="img"
53
+ aria-label="Traky"
54
+ className="block w-auto fill-current"
55
+ >
56
+ <path d={ICON_PATH} />
57
+ </svg>
58
+ {registered ? (
59
+ <sup
60
+ className="ml-0.5 text-[0.55em] leading-none font-semibold select-none opacity-80"
61
+ aria-hidden
62
+ >
63
+ ®
64
+ </sup>
65
+ ) : null}
66
+ </span>
67
+ )
68
+ }
69
+
70
+ export { Icon, iconVariants }
71
+ export type { IconProps }
@@ -0,0 +1,77 @@
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 logoVariants = cva("inline-flex items-start", {
7
+ variants: {
8
+ variant: {
9
+ green: "text-[#a5dd64]",
10
+ blue: "text-[#000b27]",
11
+ white: "text-white",
12
+ },
13
+ size: {
14
+ xs: "[&_svg]:h-6",
15
+ sm: "[&_svg]:h-10",
16
+ md: "[&_svg]:h-14",
17
+ lg: "[&_svg]:h-20",
18
+ },
19
+ },
20
+ defaultVariants: {
21
+ variant: "green",
22
+ size: "md",
23
+ },
24
+ })
25
+
26
+ const LOGO_PATHS = [
27
+ "M259.89,30.16l-12,44.79h-5.2c-14.45,0-17.26-8.8-14.36-19.61l6.76-25.24h-14.21l-6.76,25.24c-5,18.65,6.11,33.82,24.76,33.82h5.2l-1.84,6.08c-2.9,10.81-14.06,19.61-24.87,19.61h-16.38l-3.81,14.21h16.38c18.65,0,37.89-15.17,42.88-33.82l17.65-65.08h-14.21Z",
28
+ "M15.4,55.45l2.72-10.15h28.64l4-14.91h-28.64L30.26,0h-14.21L1.2,55.45c-5,18.65,6.11,33.82,24.76,33.82h9.02l3.81-14.21h-9.02c-10.82,0-17.26-8.8-14.36-19.62Z",
29
+ "M186.36,56.58l25.6-16.04,2.71-10.11h-10.01l-38.7,24.32,6.53-24.38h-13.6l-15.77,58.85h13.6l5.47-20.43h10.6c10.56,0,16.85,8.59,14.02,19.15l-.33,1.23h13.87l.33-1.23c3.91-14.61-2.31-27.01-14.32-31.35Z",
30
+ "M122.83,28.78c-11.62,0-23.48,6.65-31.07,16.33l3.78-14.1h-4.37c-7.07,0-14.34,2.25-20.93,6.04l1.78-6.64h-15.15l-4.06,15.15h6.4c-5.58,5.6-9.85,12.4-11.81,19.68l-6.52,24.33h14.98s6.63-24.74,6.63-24.74c2.9-10.81,14.06-19.61,24.87-19.61h4.32c-3.18,4.09-5.62,8.7-6.93,13.6-4.44,16.56,5.43,30.03,21.99,30.03,6.5,0,13.07-2.1,18.94-5.62l-1.59,5.92h12.45s8-29.31,8.28-30.33c4.44-16.56-5.43-30.03-21.99-30.03ZM110.45,74.99c-8.91,0-14.22-7.25-11.84-16.17,2.39-8.91,11.59-16.17,20.5-16.17s14.22,7.25,11.84,16.17c-2.39,8.91-11.59,16.17-20.5,16.17Z",
31
+ ] as const
32
+
33
+ type LogoProps = React.ComponentProps<"span"> &
34
+ VariantProps<typeof logoVariants> & {
35
+ /** Muestra ® junto al wordmark. */
36
+ registered?: boolean
37
+ }
38
+
39
+ function Logo({
40
+ className,
41
+ variant = "green",
42
+ size = "md",
43
+ registered = false,
44
+ ...props
45
+ }: LogoProps) {
46
+ return (
47
+ <span
48
+ data-slot="logo"
49
+ data-variant={variant}
50
+ data-size={size}
51
+ className={cn(logoVariants({ variant, size }), className)}
52
+ {...props}
53
+ >
54
+ <svg
55
+ viewBox="0 0 274.1 129.06"
56
+ role="img"
57
+ aria-label="Traky"
58
+ className="block w-auto fill-current"
59
+ >
60
+ {LOGO_PATHS.map((d) => (
61
+ <path key={d.slice(0, 12)} d={d} />
62
+ ))}
63
+ </svg>
64
+ {registered ? (
65
+ <sup
66
+ className="ml-0.5 text-[0.55em] leading-none font-semibold select-none opacity-80"
67
+ aria-hidden
68
+ >
69
+ ®
70
+ </sup>
71
+ ) : null}
72
+ </span>
73
+ )
74
+ }
75
+
76
+ export { Logo, logoVariants }
77
+ export type { LogoProps }