260703_01_FST: First Commit
This commit is contained in:
12
.tooling/components/ui/badge.tsx
Normal file
12
.tooling/components/ui/badge.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
import type { HTMLAttributes } from "react";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export type BadgeVariant = "default" | "secondary" | "outline" | "destructive";
|
||||
|
||||
export interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
|
||||
variant?: BadgeVariant;
|
||||
}
|
||||
|
||||
export function Badge({ className, variant = "default", ...props }: BadgeProps) {
|
||||
return <span data-variant={variant} className={cn(className)} {...props} />;
|
||||
}
|
||||
17
.tooling/components/ui/button.tsx
Normal file
17
.tooling/components/ui/button.tsx
Normal file
@@ -0,0 +1,17 @@
|
||||
import { forwardRef, type ButtonHTMLAttributes } from "react";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export type ButtonVariant = "default" | "outline" | "ghost" | "secondary" | "destructive" | "link";
|
||||
export type ButtonSize = "default" | "sm" | "lg" | "icon" | "icon-sm";
|
||||
|
||||
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
||||
variant?: ButtonVariant;
|
||||
size?: ButtonSize;
|
||||
}
|
||||
|
||||
export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
|
||||
({ className, variant = "default", size = "default", ...props }, ref) => (
|
||||
<button ref={ref} data-variant={variant} data-size={size} className={cn(className)} {...props} />
|
||||
)
|
||||
);
|
||||
Button.displayName = "Button";
|
||||
25
.tooling/components/ui/checkbox.tsx
Normal file
25
.tooling/components/ui/checkbox.tsx
Normal file
@@ -0,0 +1,25 @@
|
||||
import { forwardRef, type ButtonHTMLAttributes } from "react";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
type CheckedState = boolean | "indeterminate";
|
||||
|
||||
export interface CheckboxProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "onChange" | "checked"> {
|
||||
checked?: CheckedState;
|
||||
onCheckedChange?: (checked: CheckedState) => void;
|
||||
}
|
||||
|
||||
export const Checkbox = forwardRef<HTMLButtonElement, CheckboxProps>(
|
||||
({ className, checked, onCheckedChange, ...props }, ref) => (
|
||||
<button
|
||||
ref={ref}
|
||||
type="button"
|
||||
role="checkbox"
|
||||
aria-checked={checked === "indeterminate" ? "mixed" : checked}
|
||||
data-state={checked === "indeterminate" ? "indeterminate" : checked ? "checked" : "unchecked"}
|
||||
onClick={() => onCheckedChange?.(checked !== true)}
|
||||
className={cn(className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
);
|
||||
Checkbox.displayName = "Checkbox";
|
||||
66
.tooling/components/ui/command.tsx
Normal file
66
.tooling/components/ui/command.tsx
Normal file
@@ -0,0 +1,66 @@
|
||||
import type { HTMLAttributes, InputHTMLAttributes } from "react";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export interface CommandProps extends HTMLAttributes<HTMLDivElement> {
|
||||
shouldFilter?: boolean;
|
||||
}
|
||||
|
||||
export function Command({ className, shouldFilter, ...props }: CommandProps) {
|
||||
return <div data-should-filter={shouldFilter} className={cn(className)} {...props} />;
|
||||
}
|
||||
|
||||
export interface CommandInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "onValueChange"> {
|
||||
onValueChange?: (value: string) => void;
|
||||
}
|
||||
|
||||
export function CommandInput({ className, onValueChange, onChange, ...props }: CommandInputProps) {
|
||||
return (
|
||||
<input
|
||||
className={cn(className)}
|
||||
onChange={(e) => {
|
||||
onValueChange?.(e.target.value);
|
||||
onChange?.(e);
|
||||
}}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export function CommandList({ className, ...props }: HTMLAttributes<HTMLDivElement>) {
|
||||
return <div className={cn(className)} {...props} />;
|
||||
}
|
||||
|
||||
export function CommandEmpty({ className, ...props }: HTMLAttributes<HTMLDivElement>) {
|
||||
return <div className={cn(className)} {...props} />;
|
||||
}
|
||||
|
||||
export interface CommandGroupProps extends HTMLAttributes<HTMLDivElement> {
|
||||
heading?: string;
|
||||
}
|
||||
|
||||
export function CommandGroup({ className, heading, ...props }: CommandGroupProps) {
|
||||
return <div data-heading={heading} className={cn(className)} {...props} />;
|
||||
}
|
||||
|
||||
export interface CommandItemProps extends Omit<HTMLAttributes<HTMLDivElement>, "onSelect"> {
|
||||
value?: string;
|
||||
disabled?: boolean;
|
||||
onSelect?: (value: string) => void;
|
||||
}
|
||||
|
||||
export function CommandItem({ className, value, disabled, onSelect, ...props }: CommandItemProps) {
|
||||
return (
|
||||
<div
|
||||
role="option"
|
||||
data-value={value}
|
||||
aria-disabled={disabled}
|
||||
onClick={() => !disabled && onSelect?.(value ?? "")}
|
||||
className={cn(className)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export function CommandSeparator({ className, ...props }: HTMLAttributes<HTMLDivElement>) {
|
||||
return <div role="separator" className={cn(className)} {...props} />;
|
||||
}
|
||||
45
.tooling/components/ui/dialog.tsx
Normal file
45
.tooling/components/ui/dialog.tsx
Normal file
@@ -0,0 +1,45 @@
|
||||
import type { HTMLAttributes, ReactNode } from "react";
|
||||
import { renderAsChild } from "@/lib/as-child";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export interface DialogProps {
|
||||
open?: boolean;
|
||||
onOpenChange?: (open: boolean) => void;
|
||||
children?: ReactNode;
|
||||
}
|
||||
|
||||
export function Dialog({ open, children }: DialogProps) {
|
||||
return open ? <>{children}</> : null;
|
||||
}
|
||||
|
||||
export function DialogClose({
|
||||
asChild,
|
||||
children,
|
||||
...props
|
||||
}: HTMLAttributes<HTMLElement> & { asChild?: boolean }) {
|
||||
return renderAsChild(asChild, children, props);
|
||||
}
|
||||
|
||||
export interface DialogContentProps extends HTMLAttributes<HTMLDivElement> {
|
||||
showCloseButton?: boolean;
|
||||
}
|
||||
|
||||
export function DialogContent({ className, showCloseButton, ...props }: DialogContentProps) {
|
||||
return <div role="dialog" data-show-close-button={showCloseButton} className={cn(className)} {...props} />;
|
||||
}
|
||||
|
||||
export function DialogHeader({ className, ...props }: HTMLAttributes<HTMLDivElement>) {
|
||||
return <div className={cn(className)} {...props} />;
|
||||
}
|
||||
|
||||
export function DialogFooter({ className, ...props }: HTMLAttributes<HTMLDivElement>) {
|
||||
return <div className={cn(className)} {...props} />;
|
||||
}
|
||||
|
||||
export function DialogTitle({ className, ...props }: HTMLAttributes<HTMLHeadingElement>) {
|
||||
return <h2 className={cn(className)} {...props} />;
|
||||
}
|
||||
|
||||
export function DialogDescription({ className, ...props }: HTMLAttributes<HTMLParagraphElement>) {
|
||||
return <p className={cn(className)} {...props} />;
|
||||
}
|
||||
42
.tooling/components/ui/dropdown-menu.tsx
Normal file
42
.tooling/components/ui/dropdown-menu.tsx
Normal file
@@ -0,0 +1,42 @@
|
||||
import type { HTMLAttributes, ReactNode } from "react";
|
||||
import { renderAsChild } from "@/lib/as-child";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export interface DropdownMenuProps {
|
||||
open?: boolean;
|
||||
onOpenChange?: (open: boolean) => void;
|
||||
children?: ReactNode;
|
||||
}
|
||||
|
||||
export function DropdownMenu({ children }: DropdownMenuProps) {
|
||||
return <>{children}</>;
|
||||
}
|
||||
|
||||
export function DropdownMenuTrigger({
|
||||
asChild,
|
||||
children,
|
||||
...props
|
||||
}: HTMLAttributes<HTMLElement> & { asChild?: boolean }) {
|
||||
return renderAsChild(asChild, children, props);
|
||||
}
|
||||
|
||||
export interface DropdownMenuContentProps extends HTMLAttributes<HTMLDivElement> {
|
||||
align?: "start" | "center" | "end";
|
||||
side?: "top" | "right" | "bottom" | "left";
|
||||
sideOffset?: number;
|
||||
}
|
||||
|
||||
export function DropdownMenuContent({ className, align, side, sideOffset, ...props }: DropdownMenuContentProps) {
|
||||
return <div data-align={align} data-side={side} className={cn(className)} {...props} />;
|
||||
}
|
||||
|
||||
export function DropdownMenuItem({
|
||||
className,
|
||||
...props
|
||||
}: HTMLAttributes<HTMLDivElement> & { disabled?: boolean }) {
|
||||
return <div role="menuitem" className={cn(className)} {...props} />;
|
||||
}
|
||||
|
||||
export function DropdownMenuSeparator({ className, ...props }: HTMLAttributes<HTMLDivElement>) {
|
||||
return <div role="separator" className={cn(className)} {...props} />;
|
||||
}
|
||||
9
.tooling/components/ui/input.tsx
Normal file
9
.tooling/components/ui/input.tsx
Normal file
@@ -0,0 +1,9 @@
|
||||
import { forwardRef, type InputHTMLAttributes } from "react";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export const Input = forwardRef<HTMLInputElement, InputHTMLAttributes<HTMLInputElement>>(
|
||||
({ className, type, ...props }, ref) => (
|
||||
<input ref={ref} type={type} className={cn(className)} {...props} />
|
||||
)
|
||||
);
|
||||
Input.displayName = "Input";
|
||||
7
.tooling/components/ui/label.tsx
Normal file
7
.tooling/components/ui/label.tsx
Normal file
@@ -0,0 +1,7 @@
|
||||
import { forwardRef, type LabelHTMLAttributes } from "react";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export const Label = forwardRef<HTMLLabelElement, LabelHTMLAttributes<HTMLLabelElement>>(
|
||||
({ className, ...props }, ref) => <label ref={ref} className={cn(className)} {...props} />
|
||||
);
|
||||
Label.displayName = "Label";
|
||||
23
.tooling/components/ui/pagination.tsx
Normal file
23
.tooling/components/ui/pagination.tsx
Normal file
@@ -0,0 +1,23 @@
|
||||
import type { HTMLAttributes, LiHTMLAttributes } from "react";
|
||||
import { Button, type ButtonProps } from "@/components/ui/button";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export function Pagination({ className, ...props }: HTMLAttributes<HTMLElement>) {
|
||||
return <nav role="navigation" aria-label="pagination" className={cn(className)} {...props} />;
|
||||
}
|
||||
|
||||
export function PaginationContent({ className, ...props }: HTMLAttributes<HTMLUListElement>) {
|
||||
return <ul className={cn(className)} {...props} />;
|
||||
}
|
||||
|
||||
export function PaginationItem({ className, ...props }: LiHTMLAttributes<HTMLLIElement>) {
|
||||
return <li className={cn(className)} {...props} />;
|
||||
}
|
||||
|
||||
export function PaginationLink({ className, isActive, ...props }: ButtonProps & { isActive?: boolean }) {
|
||||
return <Button data-active={isActive} className={cn(className)} {...props} />;
|
||||
}
|
||||
|
||||
export function PaginationEllipsis({ className, ...props }: HTMLAttributes<HTMLSpanElement>) {
|
||||
return <span aria-hidden className={cn(className)} {...props} />;
|
||||
}
|
||||
32
.tooling/components/ui/popover.tsx
Normal file
32
.tooling/components/ui/popover.tsx
Normal file
@@ -0,0 +1,32 @@
|
||||
import type { HTMLAttributes, ReactNode } from "react";
|
||||
import { renderAsChild } from "@/lib/as-child";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export interface PopoverProps {
|
||||
open?: boolean;
|
||||
onOpenChange?: (open: boolean) => void;
|
||||
modal?: boolean;
|
||||
children?: ReactNode;
|
||||
}
|
||||
|
||||
export function Popover({ children }: PopoverProps) {
|
||||
return <>{children}</>;
|
||||
}
|
||||
|
||||
export function PopoverTrigger({
|
||||
asChild,
|
||||
children,
|
||||
...props
|
||||
}: HTMLAttributes<HTMLElement> & { asChild?: boolean }) {
|
||||
return renderAsChild(asChild, children, props);
|
||||
}
|
||||
|
||||
export interface PopoverContentProps extends HTMLAttributes<HTMLDivElement> {
|
||||
align?: "start" | "center" | "end";
|
||||
side?: "top" | "right" | "bottom" | "left";
|
||||
sideOffset?: number;
|
||||
}
|
||||
|
||||
export function PopoverContent({ className, align, side, sideOffset, ...props }: PopoverContentProps) {
|
||||
return <div data-align={align} data-side={side} className={cn(className)} {...props} />;
|
||||
}
|
||||
34
.tooling/components/ui/select.tsx
Normal file
34
.tooling/components/ui/select.tsx
Normal file
@@ -0,0 +1,34 @@
|
||||
import type { HTMLAttributes, ReactNode } from "react";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export interface SelectProps {
|
||||
value?: string;
|
||||
defaultValue?: string;
|
||||
onValueChange?: (value: string) => void;
|
||||
disabled?: boolean;
|
||||
children?: ReactNode;
|
||||
}
|
||||
|
||||
export function Select({ children }: SelectProps) {
|
||||
return <>{children}</>;
|
||||
}
|
||||
|
||||
export function SelectTrigger({ className, ...props }: HTMLAttributes<HTMLButtonElement>) {
|
||||
return <button type="button" className={cn(className)} {...props} />;
|
||||
}
|
||||
|
||||
export function SelectValue({ placeholder, ...props }: HTMLAttributes<HTMLSpanElement> & { placeholder?: string }) {
|
||||
return <span {...props}>{placeholder}</span>;
|
||||
}
|
||||
|
||||
export function SelectContent({ className, ...props }: HTMLAttributes<HTMLDivElement>) {
|
||||
return <div className={cn(className)} {...props} />;
|
||||
}
|
||||
|
||||
export function SelectItem({
|
||||
className,
|
||||
value,
|
||||
...props
|
||||
}: HTMLAttributes<HTMLDivElement> & { value: string }) {
|
||||
return <div data-value={value} role="option" className={cn(className)} {...props} />;
|
||||
}
|
||||
10
.tooling/components/ui/separator.tsx
Normal file
10
.tooling/components/ui/separator.tsx
Normal file
@@ -0,0 +1,10 @@
|
||||
import type { HTMLAttributes } from "react";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export interface SeparatorProps extends HTMLAttributes<HTMLDivElement> {
|
||||
orientation?: "horizontal" | "vertical";
|
||||
}
|
||||
|
||||
export function Separator({ className, orientation = "horizontal", ...props }: SeparatorProps) {
|
||||
return <div role="separator" data-orientation={orientation} className={cn(className)} {...props} />;
|
||||
}
|
||||
26
.tooling/components/ui/table.tsx
Normal file
26
.tooling/components/ui/table.tsx
Normal file
@@ -0,0 +1,26 @@
|
||||
import type { HTMLAttributes, TdHTMLAttributes, ThHTMLAttributes } from "react";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export function Table({ className, ...props }: HTMLAttributes<HTMLTableElement>) {
|
||||
return <table className={cn(className)} {...props} />;
|
||||
}
|
||||
|
||||
export function TableHeader({ className, ...props }: HTMLAttributes<HTMLTableSectionElement>) {
|
||||
return <thead className={cn(className)} {...props} />;
|
||||
}
|
||||
|
||||
export function TableBody({ className, ...props }: HTMLAttributes<HTMLTableSectionElement>) {
|
||||
return <tbody className={cn(className)} {...props} />;
|
||||
}
|
||||
|
||||
export function TableRow({ className, ...props }: HTMLAttributes<HTMLTableRowElement>) {
|
||||
return <tr className={cn(className)} {...props} />;
|
||||
}
|
||||
|
||||
export function TableHead({ className, ...props }: ThHTMLAttributes<HTMLTableCellElement>) {
|
||||
return <th className={cn(className)} {...props} />;
|
||||
}
|
||||
|
||||
export function TableCell({ className, ...props }: TdHTMLAttributes<HTMLTableCellElement>) {
|
||||
return <td className={cn(className)} {...props} />;
|
||||
}
|
||||
Reference in New Issue
Block a user