@indinno/digicode-ui 0.1.0 → 0.1.1
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/README.md +39 -143
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.css +1496 -0
- package/dist/ui.d.ts +78 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +76 -0
- package/dist/ui.js.map +1 -0
- package/package.json +43 -22
- package/LICENSE +0 -21
- package/bin/digicode.mjs +0 -136
- package/registry/components/accordion.tsx +0 -41
- package/registry/components/alert.tsx +0 -21
- package/registry/components/avatar.tsx +0 -18
- package/registry/components/badge.tsx +0 -9
- package/registry/components/breadcrumb.tsx +0 -22
- package/registry/components/button.tsx +0 -38
- package/registry/components/card.tsx +0 -10
- package/registry/components/checkbox.tsx +0 -15
- package/registry/components/dialog.tsx +0 -46
- package/registry/components/drawer.tsx +0 -42
- package/registry/components/dropdown-menu.tsx +0 -38
- package/registry/components/empty-state.tsx +0 -20
- package/registry/components/input.tsx +0 -28
- package/registry/components/pagination.tsx +0 -21
- package/registry/components/progress.tsx +0 -17
- package/registry/components/radio-group.tsx +0 -40
- package/registry/components/select.tsx +0 -33
- package/registry/components/separator.tsx +0 -10
- package/registry/components/skeleton.tsx +0 -6
- package/registry/components/spinner.tsx +0 -11
- package/registry/components/stat-card.tsx +0 -21
- package/registry/components/switch.tsx +0 -15
- package/registry/components/table.tsx +0 -11
- package/registry/components/tabs.tsx +0 -52
- package/registry/components/textarea.tsx +0 -22
- package/registry/components/tooltip.tsx +0 -16
- package/registry/lib/cn.ts +0 -3
- package/registry/registry.json +0 -32
- package/registry/styles/digicode.css +0 -253
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { useEffect, useRef, type ReactNode } from "react";
|
|
4
|
-
|
|
5
|
-
export interface DialogProps {
|
|
6
|
-
open: boolean;
|
|
7
|
-
onOpenChange: (open: boolean) => void;
|
|
8
|
-
title: ReactNode;
|
|
9
|
-
description?: ReactNode;
|
|
10
|
-
children?: ReactNode;
|
|
11
|
-
footer?: ReactNode;
|
|
12
|
-
className?: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function Dialog({ open, onOpenChange, title, description, children, footer, className }: DialogProps) {
|
|
16
|
-
const ref = useRef<HTMLDialogElement>(null);
|
|
17
|
-
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
const node = ref.current;
|
|
20
|
-
if (!node) return;
|
|
21
|
-
if (open && !node.open) node.showModal();
|
|
22
|
-
if (!open && node.open) node.close();
|
|
23
|
-
}, [open]);
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<dialog
|
|
27
|
-
ref={ref}
|
|
28
|
-
className={className ? `digicode-dialog-native ${className}` : "digicode-dialog-native"}
|
|
29
|
-
onClose={() => onOpenChange(false)}
|
|
30
|
-
onCancel={(event) => {
|
|
31
|
-
event.preventDefault();
|
|
32
|
-
onOpenChange(false);
|
|
33
|
-
}}
|
|
34
|
-
>
|
|
35
|
-
<div className="digicode-dialog__header">
|
|
36
|
-
<div>
|
|
37
|
-
<h2 className="digicode-dialog__title">{title}</h2>
|
|
38
|
-
{description && <p className="digicode-dialog__description">{description}</p>}
|
|
39
|
-
</div>
|
|
40
|
-
<button type="button" className="digicode-dialog__close" aria-label="Close dialog" onClick={() => onOpenChange(false)}>×</button>
|
|
41
|
-
</div>
|
|
42
|
-
{children && <div className="digicode-dialog__body">{children}</div>}
|
|
43
|
-
{footer && <div className="digicode-dialog__footer">{footer}</div>}
|
|
44
|
-
</dialog>
|
|
45
|
-
);
|
|
46
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { useEffect, useRef, type ReactNode } from "react";
|
|
4
|
-
|
|
5
|
-
export interface DrawerProps {
|
|
6
|
-
open: boolean;
|
|
7
|
-
onOpenChange: (open: boolean) => void;
|
|
8
|
-
title: ReactNode;
|
|
9
|
-
children?: ReactNode;
|
|
10
|
-
footer?: ReactNode;
|
|
11
|
-
className?: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function Drawer({ open, onOpenChange, title, children, footer, className }: DrawerProps) {
|
|
15
|
-
const ref = useRef<HTMLDialogElement>(null);
|
|
16
|
-
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
const node = ref.current;
|
|
19
|
-
if (!node) return;
|
|
20
|
-
if (open && !node.open) node.showModal();
|
|
21
|
-
if (!open && node.open) node.close();
|
|
22
|
-
}, [open]);
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<dialog
|
|
26
|
-
ref={ref}
|
|
27
|
-
className={className ? `digicode-drawer-native ${className}` : "digicode-drawer-native"}
|
|
28
|
-
onClose={() => onOpenChange(false)}
|
|
29
|
-
onCancel={(event) => {
|
|
30
|
-
event.preventDefault();
|
|
31
|
-
onOpenChange(false);
|
|
32
|
-
}}
|
|
33
|
-
>
|
|
34
|
-
<div className="digicode-drawer__header">
|
|
35
|
-
<h2 className="digicode-dialog__title">{title}</h2>
|
|
36
|
-
<button type="button" className="digicode-dialog__close" aria-label="Close drawer" onClick={() => onOpenChange(false)}>×</button>
|
|
37
|
-
</div>
|
|
38
|
-
{children && <div className="digicode-drawer__body">{children}</div>}
|
|
39
|
-
{footer && <div className="digicode-drawer__footer">{footer}</div>}
|
|
40
|
-
</dialog>
|
|
41
|
-
);
|
|
42
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { ButtonHTMLAttributes, DetailsHTMLAttributes, ReactNode } from "react";
|
|
2
|
-
import { cn } from "../../lib/cn";
|
|
3
|
-
|
|
4
|
-
export interface DropdownMenuProps extends DetailsHTMLAttributes<HTMLDetailsElement> {
|
|
5
|
-
trigger: ReactNode;
|
|
6
|
-
children: ReactNode;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function DropdownMenu({ className, trigger, children, ...props }: DropdownMenuProps) {
|
|
10
|
-
return (
|
|
11
|
-
<details className={cn("digicode-dropdown", className)} {...props}>
|
|
12
|
-
<summary>{trigger}</summary>
|
|
13
|
-
<div className="digicode-dropdown__menu">{children}</div>
|
|
14
|
-
</details>
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function DropdownMenuLabel({ children }: { children: ReactNode }) {
|
|
19
|
-
return <div className="digicode-dropdown__label">{children}</div>;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function DropdownMenuSeparator() {
|
|
23
|
-
return <div className="digicode-dropdown__separator" role="separator" />;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface DropdownMenuItemProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
27
|
-
danger?: boolean;
|
|
28
|
-
icon?: ReactNode;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function DropdownMenuItem({ className, danger = false, icon, children, ...props }: DropdownMenuItemProps) {
|
|
32
|
-
return (
|
|
33
|
-
<button type="button" className={cn("digicode-dropdown__item", danger && "digicode-dropdown__item--danger", className)} {...props}>
|
|
34
|
-
{icon}
|
|
35
|
-
<span>{children}</span>
|
|
36
|
-
</button>
|
|
37
|
-
);
|
|
38
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
|
|
3
|
-
export interface EmptyStateProps {
|
|
4
|
-
icon?: ReactNode;
|
|
5
|
-
title: ReactNode;
|
|
6
|
-
description?: ReactNode;
|
|
7
|
-
actions?: ReactNode;
|
|
8
|
-
className?: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function EmptyState({ icon, title, description, actions, className }: EmptyStateProps) {
|
|
12
|
-
return (
|
|
13
|
-
<div className={className ? `digicode-empty ${className}` : "digicode-empty"}>
|
|
14
|
-
{icon && <div className="digicode-empty__icon">{icon}</div>}
|
|
15
|
-
<h3 className="digicode-empty__title">{title}</h3>
|
|
16
|
-
{description && <p className="digicode-empty__description">{description}</p>}
|
|
17
|
-
{actions && <div className="digicode-empty__actions">{actions}</div>}
|
|
18
|
-
</div>
|
|
19
|
-
);
|
|
20
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { forwardRef, type InputHTMLAttributes, type ReactNode } from "react";
|
|
2
|
-
import { cn } from "../../lib/cn";
|
|
3
|
-
|
|
4
|
-
export interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
5
|
-
label?: string;
|
|
6
|
-
hint?: string;
|
|
7
|
-
error?: string;
|
|
8
|
-
prefix?: ReactNode;
|
|
9
|
-
suffix?: ReactNode;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const Input = forwardRef<HTMLInputElement, InputProps>(function Input(
|
|
13
|
-
{ className, id, label, hint, error, prefix, suffix, ...props },
|
|
14
|
-
ref
|
|
15
|
-
) {
|
|
16
|
-
const inputId = id || props.name;
|
|
17
|
-
return (
|
|
18
|
-
<label className="digicode-field" htmlFor={inputId}>
|
|
19
|
-
{label && <span className="digicode-field__label">{label}</span>}
|
|
20
|
-
<span className={cn("digicode-input-wrap", error && "digicode-input-wrap--error")}>
|
|
21
|
-
{prefix && <span className="digicode-input__affix">{prefix}</span>}
|
|
22
|
-
<input ref={ref} id={inputId} className={cn("digicode-input", className)} aria-invalid={!!error || undefined} {...props} />
|
|
23
|
-
{suffix && <span className="digicode-input__affix">{suffix}</span>}
|
|
24
|
-
</span>
|
|
25
|
-
{error ? <span className="digicode-field__error">{error}</span> : hint && <span className="digicode-field__hint">{hint}</span>}
|
|
26
|
-
</label>
|
|
27
|
-
);
|
|
28
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
export interface PaginationProps {
|
|
4
|
-
page: number;
|
|
5
|
-
totalPages: number;
|
|
6
|
-
onPageChange?: (page: number) => void;
|
|
7
|
-
className?: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function Pagination({ page, totalPages, onPageChange, className }: PaginationProps) {
|
|
11
|
-
const pages = Array.from({ length: totalPages }, (_, i) => i + 1);
|
|
12
|
-
return (
|
|
13
|
-
<nav aria-label="Pagination" className={className ? `digicode-pagination ${className}` : "digicode-pagination"}>
|
|
14
|
-
<button type="button" className="digicode-pagination__item" disabled={page <= 1} onClick={() => onPageChange?.(page - 1)} aria-label="Previous page">‹</button>
|
|
15
|
-
{pages.map((value) => (
|
|
16
|
-
<button key={value} type="button" className="digicode-pagination__item" data-active={page === value} aria-current={page === value ? "page" : undefined} onClick={() => onPageChange?.(value)}>{value}</button>
|
|
17
|
-
))}
|
|
18
|
-
<button type="button" className="digicode-pagination__item" disabled={page >= totalPages} onClick={() => onPageChange?.(page + 1)} aria-label="Next page">›</button>
|
|
19
|
-
</nav>
|
|
20
|
-
);
|
|
21
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { HTMLAttributes } from "react";
|
|
2
|
-
import { cn } from "../../lib/cn";
|
|
3
|
-
|
|
4
|
-
export interface ProgressProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
-
value: number;
|
|
6
|
-
max?: number;
|
|
7
|
-
label?: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function Progress({ className, value, max = 100, label = "Progress", ...props }: ProgressProps) {
|
|
11
|
-
const percent = Math.max(0, Math.min(100, (value / max) * 100));
|
|
12
|
-
return (
|
|
13
|
-
<div className={cn("digicode-progress", className)} role="progressbar" aria-label={label} aria-valuenow={value} aria-valuemin={0} aria-valuemax={max} {...props}>
|
|
14
|
-
<div className="digicode-progress__bar" style={{ width: `${percent}%` }} />
|
|
15
|
-
</div>
|
|
16
|
-
);
|
|
17
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import type { InputHTMLAttributes } from "react";
|
|
4
|
-
|
|
5
|
-
export interface RadioOption {
|
|
6
|
-
label: string;
|
|
7
|
-
value: string;
|
|
8
|
-
disabled?: boolean;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface RadioGroupProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "value" | "onChange"> {
|
|
12
|
-
name: string;
|
|
13
|
-
value?: string;
|
|
14
|
-
defaultValue?: string;
|
|
15
|
-
options: RadioOption[];
|
|
16
|
-
onValueChange?: (value: string) => void;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export function RadioGroup({ name, value, defaultValue, options, onValueChange, ...props }: RadioGroupProps) {
|
|
20
|
-
return (
|
|
21
|
-
<div className="digicode-radio-group" role="radiogroup">
|
|
22
|
-
{options.map((option) => (
|
|
23
|
-
<label className="digicode-checkline" key={option.value}>
|
|
24
|
-
<input
|
|
25
|
-
type="radio"
|
|
26
|
-
className="digicode-radio"
|
|
27
|
-
name={name}
|
|
28
|
-
value={option.value}
|
|
29
|
-
checked={value !== undefined ? value === option.value : undefined}
|
|
30
|
-
defaultChecked={value === undefined ? defaultValue === option.value : undefined}
|
|
31
|
-
disabled={option.disabled}
|
|
32
|
-
onChange={() => onValueChange?.(option.value)}
|
|
33
|
-
{...props}
|
|
34
|
-
/>
|
|
35
|
-
<span>{option.label}</span>
|
|
36
|
-
</label>
|
|
37
|
-
))}
|
|
38
|
-
</div>
|
|
39
|
-
);
|
|
40
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { forwardRef, type SelectHTMLAttributes } from "react";
|
|
2
|
-
import { cn } from "../../lib/cn";
|
|
3
|
-
|
|
4
|
-
export interface SelectOption {
|
|
5
|
-
label: string;
|
|
6
|
-
value: string;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface SelectProps extends SelectHTMLAttributes<HTMLSelectElement> {
|
|
11
|
-
label?: string;
|
|
12
|
-
hint?: string;
|
|
13
|
-
error?: string;
|
|
14
|
-
options?: SelectOption[];
|
|
15
|
-
placeholder?: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const Select = forwardRef<HTMLSelectElement, SelectProps>(function Select(
|
|
19
|
-
{ className, id, label, hint, error, options = [], placeholder, children, ...props },
|
|
20
|
-
ref
|
|
21
|
-
) {
|
|
22
|
-
const selectId = id || props.name;
|
|
23
|
-
return (
|
|
24
|
-
<label className="digicode-field" htmlFor={selectId}>
|
|
25
|
-
{label && <span className="digicode-field__label">{label}</span>}
|
|
26
|
-
<select ref={ref} id={selectId} className={cn("digicode-select", className)} aria-invalid={!!error || undefined} {...props}>
|
|
27
|
-
{placeholder && <option value="">{placeholder}</option>}
|
|
28
|
-
{children || options.map((option) => <option key={option.value} value={option.value} disabled={option.disabled}>{option.label}</option>)}
|
|
29
|
-
</select>
|
|
30
|
-
{error ? <span className="digicode-field__error">{error}</span> : hint && <span className="digicode-field__hint">{hint}</span>}
|
|
31
|
-
</label>
|
|
32
|
-
);
|
|
33
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { HTMLAttributes } from "react";
|
|
2
|
-
import { cn } from "../../lib/cn";
|
|
3
|
-
|
|
4
|
-
export interface SeparatorProps extends HTMLAttributes<HTMLHRElement> {
|
|
5
|
-
orientation?: "horizontal" | "vertical";
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export function Separator({ className, orientation = "horizontal", ...props }: SeparatorProps) {
|
|
9
|
-
return <hr role="separator" aria-orientation={orientation} className={cn("digicode-separator", `digicode-separator--${orientation}`, className)} {...props} />;
|
|
10
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { HTMLAttributes } from "react";
|
|
2
|
-
import { cn } from "../../lib/cn";
|
|
3
|
-
|
|
4
|
-
export interface SpinnerProps extends HTMLAttributes<HTMLSpanElement> {
|
|
5
|
-
size?: "sm" | "md" | "lg";
|
|
6
|
-
label?: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function Spinner({ className, size = "md", label = "Loading", ...props }: SpinnerProps) {
|
|
10
|
-
return <span role="status" aria-label={label} className={cn("digicode-spinner", size !== "md" && `digicode-spinner--${size}`, className)} {...props} />;
|
|
11
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
import { cn } from "../../lib/cn";
|
|
3
|
-
|
|
4
|
-
export interface StatCardProps {
|
|
5
|
-
label: ReactNode;
|
|
6
|
-
value: ReactNode;
|
|
7
|
-
icon?: ReactNode;
|
|
8
|
-
delta?: ReactNode;
|
|
9
|
-
trend?: "up" | "down" | "neutral";
|
|
10
|
-
className?: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function StatCard({ label, value, icon, delta, trend = "neutral", className }: StatCardProps) {
|
|
14
|
-
return (
|
|
15
|
-
<div className={cn("digicode-stat", className)}>
|
|
16
|
-
<div className="digicode-stat__top"><span className="digicode-stat__label">{label}</span>{icon && <span className="digicode-stat__icon">{icon}</span>}</div>
|
|
17
|
-
<div className="digicode-stat__value">{value}</div>
|
|
18
|
-
{delta && <div className={cn("digicode-stat__delta", trend !== "neutral" && `digicode-stat__delta--${trend}`)}>{delta}</div>}
|
|
19
|
-
</div>
|
|
20
|
-
);
|
|
21
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { forwardRef, type InputHTMLAttributes, type ReactNode } from "react";
|
|
2
|
-
import { cn } from "../../lib/cn";
|
|
3
|
-
|
|
4
|
-
export interface SwitchProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type"> {
|
|
5
|
-
label?: ReactNode;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export const Switch = forwardRef<HTMLInputElement, SwitchProps>(function Switch({ className, label, ...props }, ref) {
|
|
9
|
-
return (
|
|
10
|
-
<label className="digicode-switch-wrap">
|
|
11
|
-
<input ref={ref} type="checkbox" role="switch" className={cn("digicode-switch", className)} {...props} />
|
|
12
|
-
{label && <span>{label}</span>}
|
|
13
|
-
</label>
|
|
14
|
-
);
|
|
15
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { ComponentPropsWithoutRef } from "react";
|
|
2
|
-
import { cn } from "../../lib/cn";
|
|
3
|
-
|
|
4
|
-
export function Table({ className, ...props }: ComponentPropsWithoutRef<"table">) {
|
|
5
|
-
return <div className="digicode-table-wrap"><table className={cn("digicode-table", className)} {...props} /></div>;
|
|
6
|
-
}
|
|
7
|
-
export function TableHeader(props: ComponentPropsWithoutRef<"thead">) { return <thead {...props} />; }
|
|
8
|
-
export function TableBody(props: ComponentPropsWithoutRef<"tbody">) { return <tbody {...props} />; }
|
|
9
|
-
export function TableRow(props: ComponentPropsWithoutRef<"tr">) { return <tr {...props} />; }
|
|
10
|
-
export function TableHead(props: ComponentPropsWithoutRef<"th">) { return <th {...props} />; }
|
|
11
|
-
export function TableCell(props: ComponentPropsWithoutRef<"td">) { return <td {...props} />; }
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { useMemo, useState, type ReactNode } from "react";
|
|
4
|
-
|
|
5
|
-
export interface TabItem {
|
|
6
|
-
value: string;
|
|
7
|
-
label: ReactNode;
|
|
8
|
-
content: ReactNode;
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface TabsProps {
|
|
13
|
-
items: TabItem[];
|
|
14
|
-
defaultValue?: string;
|
|
15
|
-
value?: string;
|
|
16
|
-
onValueChange?: (value: string) => void;
|
|
17
|
-
className?: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function Tabs({ items, defaultValue, value, onValueChange, className }: TabsProps) {
|
|
21
|
-
const first = useMemo(() => items.find((item) => !item.disabled)?.value ?? "", [items]);
|
|
22
|
-
const [internal, setInternal] = useState(defaultValue ?? first);
|
|
23
|
-
const active = value ?? internal;
|
|
24
|
-
const current = items.find((item) => item.value === active) ?? items[0];
|
|
25
|
-
|
|
26
|
-
function select(next: string) {
|
|
27
|
-
if (value === undefined) setInternal(next);
|
|
28
|
-
onValueChange?.(next);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<div className={className ? `digicode-tabs ${className}` : "digicode-tabs"}>
|
|
33
|
-
<div className="digicode-tabs__list" role="tablist">
|
|
34
|
-
{items.map((item) => (
|
|
35
|
-
<button
|
|
36
|
-
type="button"
|
|
37
|
-
role="tab"
|
|
38
|
-
key={item.value}
|
|
39
|
-
disabled={item.disabled}
|
|
40
|
-
aria-selected={active === item.value}
|
|
41
|
-
data-active={active === item.value}
|
|
42
|
-
className="digicode-tabs__trigger"
|
|
43
|
-
onClick={() => select(item.value)}
|
|
44
|
-
>
|
|
45
|
-
{item.label}
|
|
46
|
-
</button>
|
|
47
|
-
))}
|
|
48
|
-
</div>
|
|
49
|
-
<div className="digicode-tabs__panel" role="tabpanel">{current?.content}</div>
|
|
50
|
-
</div>
|
|
51
|
-
);
|
|
52
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { forwardRef, type TextareaHTMLAttributes } from "react";
|
|
2
|
-
import { cn } from "../../lib/cn";
|
|
3
|
-
|
|
4
|
-
export interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
5
|
-
label?: string;
|
|
6
|
-
hint?: string;
|
|
7
|
-
error?: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(function Textarea(
|
|
11
|
-
{ className, id, label, hint, error, ...props },
|
|
12
|
-
ref
|
|
13
|
-
) {
|
|
14
|
-
const textareaId = id || props.name;
|
|
15
|
-
return (
|
|
16
|
-
<label className="digicode-field" htmlFor={textareaId}>
|
|
17
|
-
{label && <span className="digicode-field__label">{label}</span>}
|
|
18
|
-
<textarea ref={ref} id={textareaId} className={cn("digicode-textarea", className)} aria-invalid={!!error || undefined} {...props} />
|
|
19
|
-
{error ? <span className="digicode-field__error">{error}</span> : hint && <span className="digicode-field__hint">{hint}</span>}
|
|
20
|
-
</label>
|
|
21
|
-
);
|
|
22
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
|
|
3
|
-
export interface TooltipProps {
|
|
4
|
-
content: ReactNode;
|
|
5
|
-
children: ReactNode;
|
|
6
|
-
className?: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function Tooltip({ content, children, className }: TooltipProps) {
|
|
10
|
-
return (
|
|
11
|
-
<span className={className ? `digicode-tooltip ${className}` : "digicode-tooltip"}>
|
|
12
|
-
{children}
|
|
13
|
-
<span role="tooltip" className="digicode-tooltip__content">{content}</span>
|
|
14
|
-
</span>
|
|
15
|
-
);
|
|
16
|
-
}
|
package/registry/lib/cn.ts
DELETED
package/registry/registry.json
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "DigiCode",
|
|
3
|
-
"style": "digicode",
|
|
4
|
-
"components": [
|
|
5
|
-
"accordion",
|
|
6
|
-
"alert",
|
|
7
|
-
"avatar",
|
|
8
|
-
"badge",
|
|
9
|
-
"breadcrumb",
|
|
10
|
-
"button",
|
|
11
|
-
"card",
|
|
12
|
-
"checkbox",
|
|
13
|
-
"dialog",
|
|
14
|
-
"drawer",
|
|
15
|
-
"dropdown-menu",
|
|
16
|
-
"empty-state",
|
|
17
|
-
"input",
|
|
18
|
-
"pagination",
|
|
19
|
-
"progress",
|
|
20
|
-
"radio-group",
|
|
21
|
-
"select",
|
|
22
|
-
"separator",
|
|
23
|
-
"skeleton",
|
|
24
|
-
"spinner",
|
|
25
|
-
"stat-card",
|
|
26
|
-
"switch",
|
|
27
|
-
"table",
|
|
28
|
-
"tabs",
|
|
29
|
-
"textarea",
|
|
30
|
-
"tooltip"
|
|
31
|
-
]
|
|
32
|
-
}
|