Home / File/ color-format-selector.tsx — ui Source File

color-format-selector.tsx — ui Source File

Architecture documentation for color-format-selector.tsx, a tsx file in the ui codebase. 6 imports, 0 dependents.

File tsx ComponentRegistry UIPrimitives 6 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  3056a87d_7560_e6d6_f9bd_68d4966fb0a1["color-format-selector.tsx"]
  1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"]
  3056a87d_7560_e6d6_f9bd_68d4966fb0a1 --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2
  5281a958_99ee_42f0_65d8_3fb6d850517a["colors"]
  3056a87d_7560_e6d6_f9bd_68d4966fb0a1 --> 5281a958_99ee_42f0_65d8_3fb6d850517a
  79081a1f_55a3_945a_fb8c_d53d6d3eab81["utils"]
  3056a87d_7560_e6d6_f9bd_68d4966fb0a1 --> 79081a1f_55a3_945a_fb8c_d53d6d3eab81
  a5ebc15d_0ba5_30f8_7c37_f009f0a1b271["use-colors"]
  3056a87d_7560_e6d6_f9bd_68d4966fb0a1 --> a5ebc15d_0ba5_30f8_7c37_f009f0a1b271
  d493776b_8734_5d8d_382d_0f77f309a72b["select"]
  3056a87d_7560_e6d6_f9bd_68d4966fb0a1 --> d493776b_8734_5d8d_382d_0f77f309a72b
  3119ffb8_7316_4004_c2c7_61f58afcb2f8["skeleton"]
  3056a87d_7560_e6d6_f9bd_68d4966fb0a1 --> 3119ffb8_7316_4004_c2c7_61f58afcb2f8
  style 3056a87d_7560_e6d6_f9bd_68d4966fb0a1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"use client"

import * as React from "react"

import { getColorFormat, type Color } from "@/lib/colors"
import { cn } from "@/lib/utils"
import { useColors } from "@/hooks/use-colors"
import {
  Select,
  SelectContent,
  SelectItem,
  SelectTrigger,
  SelectValue,
} from "@/registry/new-york/ui/select"
import { Skeleton } from "@/registry/new-york/ui/skeleton"

export function ColorFormatSelector({
  color,
  className,
  ...props
}: Omit<React.ComponentProps<typeof SelectTrigger>, "color"> & {
  color: Color
}) {
  const { format, setFormat, isLoading } = useColors()
  const formats = React.useMemo(() => getColorFormat(color), [color])

  if (isLoading) {
    return <ColorFormatSelectorSkeleton />
  }

  return (
    <Select value={format} onValueChange={setFormat}>
      <SelectTrigger
        className={cn("h-7 w-auto gap-1.5 rounded-lg pr-2 text-xs", className)}
        {...props}
      >
        <span className="font-medium">Format: </span>
        <span className="font-mono text-xs text-muted-foreground">
          {format}
        </span>
      </SelectTrigger>
      <SelectContent align="end" className="rounded-xl">
        {Object.entries(formats).map(([format, value]) => (
          <SelectItem
            key={format}
            value={format}
            className="gap-2 rounded-lg [&>span]:flex [&>span]:items-center [&>span]:gap-2"
          >
            <span className="font-medium">{format}</span>
            <span className="font-mono text-xs text-muted-foreground">
              {value}
            </span>
          </SelectItem>
        ))}
      </SelectContent>
    </Select>
  )
}

export function ColorFormatSelectorSkeleton({
  className,
  ...props
}: React.ComponentProps<typeof Skeleton>) {
  return (
    <Skeleton
      className={cn("h-7 w-[116px] gap-1.5 rounded-lg", className)}
      {...props}
    />
  )
}

Subdomains

Dependencies

  • colors
  • react
  • select
  • skeleton
  • use-colors
  • utils

Frequently Asked Questions

What does color-format-selector.tsx do?
color-format-selector.tsx is a source file in the ui codebase, written in tsx. It belongs to the ComponentRegistry domain, UIPrimitives subdomain.
What functions are defined in color-format-selector.tsx?
color-format-selector.tsx defines 2 function(s): ColorFormatSelector, ColorFormatSelectorSkeleton.
What does color-format-selector.tsx depend on?
color-format-selector.tsx imports 6 module(s): colors, react, select, skeleton, use-colors, utils.
Where is color-format-selector.tsx in the architecture?
color-format-selector.tsx is located at deprecated/www/components/color-format-selector.tsx (domain: ComponentRegistry, subdomain: UIPrimitives, directory: deprecated/www/components).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free