@enmera/panel-kit 0.0.0-stage → 0.2.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/CHANGELOG.md +13 -0
- package/LICENSE +21 -0
- package/README.md +98 -2
- package/README.tr.md +59 -0
- package/dist/config.d.ts +18 -0
- package/dist/config.js +14 -0
- package/dist/empty-state.d.ts +7 -0
- package/dist/empty-state.js +5 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/hooks/use-mobile.js +15 -0
- package/dist/section-card.d.ts +16 -0
- package/dist/section-card.js +13 -0
- package/dist/stat-cards.d.ts +15 -0
- package/dist/stat-cards.js +32 -0
- package/dist/status-badge.d.ts +29 -0
- package/dist/status-badge.js +27 -0
- package/dist/summary-strip.d.ts +18 -0
- package/dist/summary-strip.js +15 -0
- package/dist/text.d.ts +7 -0
- package/dist/text.js +8 -0
- package/dist/ui/alert-dialog.d.ts +22 -0
- package/dist/ui/alert-dialog.js +38 -0
- package/dist/ui/avatar.d.ts +10 -0
- package/dist/ui/avatar.js +23 -0
- package/dist/ui/badge.d.ts +8 -0
- package/dist/ui/badge.js +31 -0
- package/dist/ui/breadcrumb.d.ts +11 -0
- package/dist/ui/breadcrumb.js +25 -0
- package/dist/ui/button.d.ts +14 -0
- package/dist/ui/button.js +67 -0
- package/dist/ui/calendar.d.ts +24 -0
- package/dist/ui/calendar.js +54 -0
- package/dist/ui/card.d.ts +11 -0
- package/dist/ui/card.js +24 -0
- package/dist/ui/chart.d.ts +44 -0
- package/dist/ui/chart.js +137 -0
- package/dist/ui/checkbox.d.ts +3 -0
- package/dist/ui/checkbox.js +9 -0
- package/dist/ui/chip.d.ts +11 -0
- package/dist/ui/chip.js +10 -0
- package/dist/ui/code.d.ts +2 -0
- package/dist/ui/code.js +6 -0
- package/dist/ui/collapsible.d.ts +5 -0
- package/dist/ui/collapsible.js +12 -0
- package/dist/ui/combobox.d.ts +32 -0
- package/dist/ui/combobox.js +77 -0
- package/dist/ui/command.d.ts +27 -0
- package/dist/ui/command.js +36 -0
- package/dist/ui/dialog.d.ts +21 -0
- package/dist/ui/dialog.js +32 -0
- package/dist/ui/dropdown-menu.d.ts +26 -0
- package/dist/ui/dropdown-menu.js +48 -0
- package/dist/ui/field.d.ts +24 -0
- package/dist/ui/field.js +67 -0
- package/dist/ui/heading.d.ts +24 -0
- package/dist/ui/heading.js +24 -0
- package/dist/ui/icon-tile.d.ts +17 -0
- package/dist/ui/icon-tile.js +17 -0
- package/dist/ui/input-group.d.ts +19 -0
- package/dist/ui/input-group.js +58 -0
- package/dist/ui/input.d.ts +8 -0
- package/dist/ui/input.js +7 -0
- package/dist/ui/label.d.ts +3 -0
- package/dist/ui/label.js +12 -0
- package/dist/ui/meta.d.ts +13 -0
- package/dist/ui/meta.js +18 -0
- package/dist/ui/option-card.d.ts +9 -0
- package/dist/ui/option-card.js +10 -0
- package/dist/ui/pagination.d.ts +17 -0
- package/dist/ui/pagination.js +27 -0
- package/dist/ui/popover.d.ts +10 -0
- package/dist/ui/popover.js +19 -0
- package/dist/ui/radio-group.d.ts +4 -0
- package/dist/ui/radio-group.js +11 -0
- package/dist/ui/row-button.d.ts +9 -0
- package/dist/ui/row-button.js +16 -0
- package/dist/ui/scroll-area.d.ts +3 -0
- package/dist/ui/scroll-area.js +7 -0
- package/dist/ui/segmented.d.ts +22 -0
- package/dist/ui/segmented.js +16 -0
- package/dist/ui/select.d.ts +26 -0
- package/dist/ui/select.js +45 -0
- package/dist/ui/separator.d.ts +3 -0
- package/dist/ui/separator.js +8 -0
- package/dist/ui/sheet.d.ts +20 -0
- package/dist/ui/sheet.js +34 -0
- package/dist/ui/sidebar.d.ts +77 -0
- package/dist/ui/sidebar.js +204 -0
- package/dist/ui/skeleton.d.ts +2 -0
- package/dist/ui/skeleton.js +6 -0
- package/dist/ui/slider.d.ts +11 -0
- package/dist/ui/slider.js +13 -0
- package/dist/ui/sonner.d.ts +7 -0
- package/dist/ui/sonner.js +38 -0
- package/dist/ui/switch.d.ts +5 -0
- package/dist/ui/switch.js +8 -0
- package/dist/ui/table.d.ts +11 -0
- package/dist/ui/table.js +28 -0
- package/dist/ui/tabs.d.ts +15 -0
- package/dist/ui/tabs.js +73 -0
- package/dist/ui/text-button.d.ts +21 -0
- package/dist/ui/text-button.js +21 -0
- package/dist/ui/textarea.d.ts +9 -0
- package/dist/ui/textarea.js +7 -0
- package/dist/ui/tile.d.ts +27 -0
- package/dist/ui/tile.js +30 -0
- package/dist/ui/tooltip.d.ts +8 -0
- package/dist/ui/tooltip.js +24 -0
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +1 -0
- package/lang/tr.json +16 -0
- package/package.json +83 -4
- package/theme.css +17 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "../utils.js";
|
|
5
|
+
import { Button as ButtonPrimitive, Collection, ComboBox as ComboBoxPrimitive, ComboBoxStateContext, ComboBoxValue as ComboBoxValuePrimitive, composeRenderProps, Group, Header as HeaderPrimitive, Input as InputPrimitive, ListBoxItem as ListBoxItemPrimitive, ListBox as ListBoxPrimitive, ListBoxSection as ListBoxSectionPrimitive, Popover as PopoverPrimitive, Separator as SeparatorPrimitive, TagGroup as TagGroupPrimitive, TagList as TagListPrimitive, Tag as TagPrimitive, } from "react-aria-components";
|
|
6
|
+
import { Button } from "./button.js";
|
|
7
|
+
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, } from "./input-group.js";
|
|
8
|
+
import { ChevronDownIcon, XIcon, CheckIcon } from "lucide-react";
|
|
9
|
+
import { t } from '../config.js';
|
|
10
|
+
function ComboboxValue({ ...props }) {
|
|
11
|
+
return _jsx(ComboBoxValuePrimitive, { "data-slot": "combobox-value", ...props });
|
|
12
|
+
}
|
|
13
|
+
function ComboboxTrigger({ className, children, ...props }) {
|
|
14
|
+
return (_jsxs(ButtonPrimitive, { "data-slot": "combobox-trigger", className: cn("[&_svg:not([class*='size-'])]:size-4", className), ...props, children: [children, _jsx(ChevronDownIcon, { className: "pointer-events-none size-4 text-muted-foreground" })] }));
|
|
15
|
+
}
|
|
16
|
+
function ComboboxClear({ className, ...props }) {
|
|
17
|
+
const state = React.useContext(ComboBoxStateContext);
|
|
18
|
+
if (state?.inputValue === "") {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
return (_jsx(InputGroupButton, { "data-slot": "combobox-clear", variant: "ghost", size: "icon-xs", "aria-label": t("Clear"), className: cn(className), onPress: () => {
|
|
22
|
+
state?.setValue(null);
|
|
23
|
+
}, slot: null, ...props, children: _jsx(XIcon, { className: "pointer-events-none" }) }));
|
|
24
|
+
}
|
|
25
|
+
function ComboboxInput({ className, children, disabled = false, showTrigger = true, showClear = false, ...props }) {
|
|
26
|
+
return (_jsxs(InputGroup, { className: cn("w-auto", className), children: [_jsx(InputGroupInput, { disabled: disabled, ...props }), _jsxs(InputGroupAddon, { align: "inline-end", children: [showTrigger && (_jsx(InputGroupButton, { size: "icon-xs", variant: "ghost", "data-slot": "combobox-trigger", className: "group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent [&_svg:not([class*='size-'])]:size-4", isDisabled: disabled, children: _jsx(ChevronDownIcon, { className: "pointer-events-none size-4 text-muted-foreground" }) })), showClear && _jsx(ComboboxClear, { isDisabled: disabled })] }), children] }));
|
|
27
|
+
}
|
|
28
|
+
function ComboboxContent({ className, placement = "bottom", offset = 6, crossOffset = 0, anchor, ...props }) {
|
|
29
|
+
return (_jsx(PopoverPrimitive, { "data-slot": "combobox-content", placement: placement, offset: offset, crossOffset: crossOffset, triggerRef: anchor, className: cn("relative isolate z-50 max-h-72 w-(--trigger-width) min-w-36 origin-(--trigger-anchor-point) overflow-hidden rounded-3xl bg-popover text-popover-foreground shadow-lg ring-1 ring-foreground/5 duration-100 data-entering:animate-in data-entering:fade-in-0 data-entering:zoom-in-95 data-exiting:animate-out data-exiting:fade-out-0 data-exiting:zoom-out-95 data-[placement=bottom]:slide-in-from-top-2 data-[placement=left]:slide-in-from-right-2 data-[placement=right]:slide-in-from-left-2 data-[placement=top]:slide-in-from-bottom-2 **:data-[slot$=-item]:data-focused:bg-foreground/10 *:data-[slot=input-group]:m-1.5 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-8 *:data-[slot=input-group]:border-input/30 *:data-[slot=input-group]:bg-input/50 *:data-[slot=input-group]:shadow-none dark:ring-foreground/10", className), ...props }));
|
|
30
|
+
}
|
|
31
|
+
function ComboboxList({ className, ...props }) {
|
|
32
|
+
return (_jsx(ListBoxPrimitive, { "data-slot": "combobox-list", className: cn("group/combobox-content no-scrollbar max-h-[inherit] scroll-py-1.5 overflow-y-auto overscroll-contain p-1.5 data-empty:p-0", className), ...props }));
|
|
33
|
+
}
|
|
34
|
+
function ComboboxItem({ className, children, ...props }) {
|
|
35
|
+
return (_jsx(ListBoxItemPrimitive, { "data-slot": "combobox-item", textValue: typeof children === "string" ? children : undefined, className: cn("relative flex w-full cursor-default items-center gap-2.5 rounded-2xl py-2 pr-8 pl-3 text-sm font-medium outline-hidden select-none data-focused:bg-accent data-focused:text-accent-foreground not-data-[variant=destructive]:data-focused:**:text-accent-foreground data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className), ...props, children: composeRenderProps(children, (children, { isSelected }) => (_jsxs(_Fragment, { children: [children, _jsx("span", { className: "pointer-events-none absolute right-2 flex size-4 items-center justify-center", children: isSelected ? (_jsx(CheckIcon, { className: "pointer-events-none" })) : null })] }))) }));
|
|
36
|
+
}
|
|
37
|
+
function ComboboxGroup({ className, ...props }) {
|
|
38
|
+
return (_jsx(ListBoxSectionPrimitive, { "data-slot": "combobox-group", className: cn(className), ...props }));
|
|
39
|
+
}
|
|
40
|
+
function ComboboxLabel({ className, ...props }) {
|
|
41
|
+
return (_jsx(HeaderPrimitive, { "data-slot": "combobox-label", className: cn("px-3 py-2.5 text-xs text-muted-foreground", className), ...props }));
|
|
42
|
+
}
|
|
43
|
+
function ComboboxEmpty({ className, ...props }) {
|
|
44
|
+
return (_jsx("div", { "data-slot": "combobox-empty", className: cn("hidden w-full justify-center py-2 text-center text-sm text-muted-foreground group-data-empty/combobox-content:flex", className), ...props }));
|
|
45
|
+
}
|
|
46
|
+
function ComboboxSeparator({ className, ...props }) {
|
|
47
|
+
return (_jsx(SeparatorPrimitive, { "data-slot": "combobox-separator", className: cn("-mx-1.5 my-1.5 h-px bg-border", className), ...props }));
|
|
48
|
+
}
|
|
49
|
+
function ComboboxChips({ children, className, ...props }) {
|
|
50
|
+
return (_jsx(Group, { "data-slot": "combobox-chips", className: cn("flex min-h-9 flex-wrap items-center gap-1.5 rounded-3xl border border-transparent bg-input/50 bg-clip-padding px-3 py-1.5 text-sm transition-[color,box-shadow,background-color] focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/30 has-aria-invalid:border-destructive has-aria-invalid:ring-3 has-aria-invalid:ring-destructive/20 has-data-[slot=combobox-chip]:px-1.5 dark:has-aria-invalid:border-destructive/50 dark:has-aria-invalid:ring-destructive/40", className), ...props, children: children }));
|
|
51
|
+
}
|
|
52
|
+
function ComboboxChipList({ className, ...props }) {
|
|
53
|
+
return (_jsx(ComboBoxValuePrimitive, { className: "contents", children: ({ selectedItems, state }) => (_jsx(TagGroupPrimitive, { "data-slot": "combobox-chip-list", className: cn("contents", className), onRemove: (keys) => {
|
|
54
|
+
if (Array.isArray(state.value)) {
|
|
55
|
+
state.setValue(state.value.filter((k) => !keys.has(k)));
|
|
56
|
+
}
|
|
57
|
+
}, children: _jsx(TagListPrimitive, { className: "contents", items: selectedItems.filter((item) => item != null), ...props }) })) }));
|
|
58
|
+
}
|
|
59
|
+
function ComboboxChip({ className, children, showRemove = true, ...props }) {
|
|
60
|
+
return (_jsxs(TagPrimitive, { "data-slot": "combobox-chip", className: cn("flex h-[calc(--spacing(5.5))] w-fit items-center justify-center gap-1 rounded-3xl bg-input px-2 text-xs font-medium whitespace-nowrap text-foreground has-disabled:pointer-events-none has-disabled:cursor-not-allowed has-disabled:opacity-50 has-data-[slot=combobox-chip-remove]:pr-0 dark:bg-input/60", className), ...props, children: [children, showRemove && (_jsx(Button, { slot: "remove", variant: "ghost", size: "icon-xs", className: "-ml-1 opacity-50 hover:opacity-100", "data-slot": "combobox-chip-remove", children: _jsx(XIcon, { className: "pointer-events-none" }) }))] }));
|
|
61
|
+
}
|
|
62
|
+
function ComboboxChipsInput({ className, ...props }) {
|
|
63
|
+
const state = React.useContext(ComboBoxStateContext);
|
|
64
|
+
return (_jsx(InputPrimitive, { "data-slot": "combobox-chip-input", className: cn("min-w-16 flex-1 outline-none", className), onKeyDown: (e) => {
|
|
65
|
+
if (e.key === "Backspace" &&
|
|
66
|
+
e.currentTarget.value === "" &&
|
|
67
|
+
Array.isArray(state?.value) &&
|
|
68
|
+
state.value.length > 0) {
|
|
69
|
+
e.preventDefault();
|
|
70
|
+
state.setValue(state.value.slice(0, -1));
|
|
71
|
+
}
|
|
72
|
+
}, ...props }));
|
|
73
|
+
}
|
|
74
|
+
function useComboboxAnchor() {
|
|
75
|
+
return React.useRef(null);
|
|
76
|
+
}
|
|
77
|
+
export { ComboBoxPrimitive as Combobox, ComboboxInput, ComboboxContent, ComboboxList, ComboboxItem, ComboboxGroup, ComboboxLabel, Collection as ComboboxCollection, ComboboxEmpty, ComboboxSeparator, ComboboxChips, ComboboxChip, ComboboxChipList, ComboboxChipsInput, ComboboxTrigger, ComboboxValue, useComboboxAnchor, };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type AutocompleteProps, type InputProps, type MenuItemProps, type MenuProps, type MenuSectionProps, type SeparatorProps } from "react-aria-components";
|
|
3
|
+
import { Dialog } from "./dialog.js";
|
|
4
|
+
declare function Command({ className, dir, style, ...props }: Omit<AutocompleteProps, "className" | "style"> & {
|
|
5
|
+
className?: string;
|
|
6
|
+
dir?: React.HTMLAttributes<HTMLDivElement>["dir"];
|
|
7
|
+
style?: React.CSSProperties;
|
|
8
|
+
}): React.JSX.Element;
|
|
9
|
+
declare function CommandDialog({ title, description, children, open, onOpenChange, className, showCloseButton, ...props }: Omit<React.ComponentProps<typeof Dialog>, "children" | "className" | "isOpen" | "onOpenChange"> & {
|
|
10
|
+
title?: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
open?: boolean;
|
|
13
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
14
|
+
className?: string;
|
|
15
|
+
showCloseButton?: boolean;
|
|
16
|
+
children: React.ReactNode;
|
|
17
|
+
}): React.JSX.Element;
|
|
18
|
+
declare function CommandInput({ className, ...props }: InputProps): React.JSX.Element;
|
|
19
|
+
declare function CommandList<T extends object>({ className, ...props }: MenuProps<T>): React.JSX.Element;
|
|
20
|
+
declare function CommandEmpty({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
21
|
+
declare function CommandGroup<T extends object>({ className, children, items, heading, ...props }: MenuSectionProps<T> & {
|
|
22
|
+
heading?: string;
|
|
23
|
+
}): React.JSX.Element;
|
|
24
|
+
declare function CommandSeparator({ className, ...props }: SeparatorProps): React.JSX.Element;
|
|
25
|
+
declare function CommandItem<T extends object>({ className, children, textValue, ...props }: MenuItemProps<T>): React.JSX.Element;
|
|
26
|
+
declare function CommandShortcut({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
27
|
+
export { Command, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandShortcut, CommandSeparator, };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../utils.js";
|
|
3
|
+
import { Autocomplete, Collection, composeRenderProps, Header, Input, Menu, MenuItem, MenuSection, SearchField, Separator, useFilter, } from "react-aria-components";
|
|
4
|
+
import { Dialog, DialogDescription, DialogHeader, DialogTitle, } from "./dialog.js";
|
|
5
|
+
import { InputGroup, InputGroupAddon, } from "./input-group.js";
|
|
6
|
+
import { SearchIcon, CheckIcon } from "lucide-react";
|
|
7
|
+
import { t } from '../config.js';
|
|
8
|
+
function Command({ className, dir, style, ...props }) {
|
|
9
|
+
const { contains } = useFilter({ sensitivity: "base" });
|
|
10
|
+
return (_jsx("div", { "data-slot": "command", dir: dir, className: cn("flex size-full flex-col overflow-hidden rounded-4xl bg-popover p-1 text-popover-foreground", className), style: style, children: _jsx(Autocomplete, { ...props, filter: props.filter || contains, children: props.children }) }));
|
|
11
|
+
}
|
|
12
|
+
function CommandDialog({ title = t("Command palette"), description = t("Search for a screen or command"), children, open, onOpenChange, className, showCloseButton = false, ...props }) {
|
|
13
|
+
return (_jsxs(Dialog, { isOpen: open, onOpenChange: onOpenChange, className: cn("top-1/3 translate-y-0 overflow-hidden rounded-4xl! p-0", className), showCloseButton: showCloseButton, isDismissable: true, ...props, children: [_jsxs(DialogHeader, { className: "sr-only", children: [_jsx(DialogTitle, { children: title }), _jsx(DialogDescription, { children: description })] }), children] }));
|
|
14
|
+
}
|
|
15
|
+
function CommandInput({ className, ...props }) {
|
|
16
|
+
return (_jsx(SearchField, { autoFocus: true, "aria-label": props.placeholder || t("Search"), "data-slot": "command-input-wrapper", className: "p-1 pb-0", children: _jsxs(InputGroup, { className: "h-9 bg-input/50", children: [_jsx(Input, { ...props, "data-slot": "command-input", className: cn("w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50 [&::-webkit-search-cancel-button]:hidden", className) }), _jsx(InputGroupAddon, { children: _jsx(SearchIcon, { className: "size-4 shrink-0 opacity-50" }) })] }) }));
|
|
17
|
+
}
|
|
18
|
+
function CommandList({ className, ...props }) {
|
|
19
|
+
return (_jsx(Menu, { ...props, "data-slot": "command-list", className: cn("no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none", className) }));
|
|
20
|
+
}
|
|
21
|
+
function CommandEmpty({ className, ...props }) {
|
|
22
|
+
return (_jsx("div", { "data-slot": "command-empty", className: cn("py-6 text-center text-sm", className), ...props }));
|
|
23
|
+
}
|
|
24
|
+
function CommandGroup({ className, children, items, heading, ...props }) {
|
|
25
|
+
return (_jsxs(MenuSection, { "data-slot": "command-group", className: cn("overflow-hidden p-1.5 text-foreground **:[[cmdk-group-heading]]:px-3 **:[[cmdk-group-heading]]:py-2 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground", className), ...props, children: [heading && _jsx(Header, { "cmdk-group-heading": "", children: heading }), _jsx(Collection, { items: items, children: children })] }));
|
|
26
|
+
}
|
|
27
|
+
function CommandSeparator({ className, ...props }) {
|
|
28
|
+
return (_jsx(Separator, { "data-slot": "command-separator", className: cn("my-1.5 h-px bg-border/50", className), ...props }));
|
|
29
|
+
}
|
|
30
|
+
function CommandItem({ className, children, textValue, ...props }) {
|
|
31
|
+
return (_jsx(MenuItem, { ...props, "data-slot": "command-item", className: cn("group/command-item relative flex cursor-default items-center gap-2 rounded-2xl px-3 py-2 text-sm font-medium outline-hidden select-none in-data-[slot=dialog-content]:rounded-3xl data-focused:bg-muted data-focused:text-foreground data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-focused:*:[svg]:text-foreground data-selected:*:[svg]:text-foreground", className), textValue: textValue || (typeof children === "string" ? children : undefined), children: composeRenderProps(children, (children) => (_jsxs(_Fragment, { children: [children, _jsx(CheckIcon, { className: "ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100" })] }))) }));
|
|
32
|
+
}
|
|
33
|
+
function CommandShortcut({ className, ...props }) {
|
|
34
|
+
return (_jsx("span", { "data-slot": "command-shortcut", className: cn("ml-auto text-xs tracking-widest text-muted-foreground group-data-focused/command-item:text-foreground group-data-selected/command-item:text-foreground", className), ...props }));
|
|
35
|
+
}
|
|
36
|
+
export { Command, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandShortcut, CommandSeparator, };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Heading, Modal as ModalPrimitive, type DialogProps as DialogPrimitiveProps, type DialogTriggerProps as DialogTriggerPrimitiveProps, type ModalOverlayProps as ModalOverlayPrimitiveProps } from "react-aria-components";
|
|
3
|
+
import { Button } from "./button.js";
|
|
4
|
+
declare function DialogTrigger({ ...props }: DialogTriggerPrimitiveProps): React.JSX.Element;
|
|
5
|
+
declare function DialogClose({ className, variant, size, ...props }: React.ComponentProps<typeof Button>): React.JSX.Element;
|
|
6
|
+
declare function DialogOverlay({ className, children, ...props }: Omit<ModalOverlayPrimitiveProps, "className" | "children"> & {
|
|
7
|
+
className?: string;
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
}): React.JSX.Element;
|
|
10
|
+
declare function Dialog({ className, children, showCloseButton, isDismissable, ...props }: Omit<ModalOverlayPrimitiveProps, "className" | "children"> & Pick<React.ComponentProps<typeof ModalPrimitive>, "isDismissable"> & {
|
|
11
|
+
className?: string;
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
showCloseButton?: boolean;
|
|
14
|
+
}): React.JSX.Element;
|
|
15
|
+
declare function DialogHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
16
|
+
declare function DialogFooter({ className, showCloseButton, children, ...props }: React.ComponentProps<"div"> & {
|
|
17
|
+
showCloseButton?: boolean;
|
|
18
|
+
}): React.JSX.Element;
|
|
19
|
+
declare function DialogTitle({ className, ...props }: Omit<React.ComponentProps<typeof Heading>, "slot">): React.JSX.Element;
|
|
20
|
+
declare function DialogDescription({ className, ...props }: Omit<React.ComponentProps<"div">, "slot">): React.JSX.Element;
|
|
21
|
+
export { type DialogPrimitiveProps, type DialogTriggerPrimitiveProps, Dialog, DialogClose, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogTitle, DialogTrigger, };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "../utils.js";
|
|
4
|
+
import { Dialog as DialogPrimitive, DialogTrigger as DialogTriggerPrimitive, Heading, ModalOverlay as ModalOverlayPrimitive, Modal as ModalPrimitive, } from "react-aria-components";
|
|
5
|
+
import { Button } from "./button.js";
|
|
6
|
+
import { XIcon } from "lucide-react";
|
|
7
|
+
import { t } from '../config.js';
|
|
8
|
+
function DialogTrigger({ ...props }) {
|
|
9
|
+
return _jsx(DialogTriggerPrimitive, { "data-slot": "dialog-trigger", ...props });
|
|
10
|
+
}
|
|
11
|
+
function DialogClose({ className, variant = "outline", size = "default", ...props }) {
|
|
12
|
+
return (_jsx(Button, { slot: "close", "data-slot": "dialog-close", variant: variant, size: size, className: cn(className), ...props }));
|
|
13
|
+
}
|
|
14
|
+
function DialogOverlay({ className, children, ...props }) {
|
|
15
|
+
return (_jsx(ModalOverlayPrimitive, { "data-slot": "dialog-overlay", className: cn("fixed inset-0 isolate z-50 bg-black/30 duration-100 data-entering:animate-in data-entering:fade-in-0 data-exiting:animate-out data-exiting:fade-out-0 supports-backdrop-filter:backdrop-blur-sm", className), ...props, children: children }));
|
|
16
|
+
}
|
|
17
|
+
function Dialog({ className, children, showCloseButton = true, isDismissable = true, ...props }) {
|
|
18
|
+
return (_jsx(DialogOverlay, { isDismissable: isDismissable, ...props, children: _jsx(ModalPrimitive, { "data-slot": "dialog-content", className: cn("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] grid-cols-[minmax(0,1fr)] -translate-x-1/2 -translate-y-1/2 gap-6 rounded-4xl bg-popover p-6 text-sm text-popover-foreground shadow-xl ring-1 ring-foreground/5 duration-100 outline-none data-entering:animate-in data-entering:fade-in-0 data-entering:zoom-in-95 data-exiting:animate-out data-exiting:fade-out-0 data-exiting:zoom-out-95 sm:max-w-md dark:ring-foreground/10", className), children: _jsxs(DialogPrimitive, { "data-slot": "dialog", className: "grid-cols-[minmax(0,1fr)] [display:inherit] [gap:inherit] min-w-0 outline-none", children: [children, showCloseButton && (_jsxs(DialogClose, { variant: "ghost", className: "absolute top-4 right-4 bg-secondary", size: "icon-sm", children: [_jsx(XIcon, {}), _jsx("span", { className: "sr-only", children: t("Close") })] }))] }) }) }));
|
|
19
|
+
}
|
|
20
|
+
function DialogHeader({ className, ...props }) {
|
|
21
|
+
return (_jsx("div", { "data-slot": "dialog-header", className: cn("flex flex-col gap-1.5", className), ...props }));
|
|
22
|
+
}
|
|
23
|
+
function DialogFooter({ className, showCloseButton = false, children, ...props }) {
|
|
24
|
+
return (_jsxs("div", { "data-slot": "dialog-footer", className: cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className), ...props, children: [children, showCloseButton && _jsx(DialogClose, { variant: "outline", children: t("Close") })] }));
|
|
25
|
+
}
|
|
26
|
+
function DialogTitle({ className, ...props }) {
|
|
27
|
+
return (_jsx(Heading, { slot: "title", "data-slot": "dialog-title", className: cn("font-heading text-base leading-none font-medium", className), ...props }));
|
|
28
|
+
}
|
|
29
|
+
function DialogDescription({ className, ...props }) {
|
|
30
|
+
return (_jsx("div", { "data-slot": "dialog-description", className: cn("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground", className), ...props }));
|
|
31
|
+
}
|
|
32
|
+
export { Dialog, DialogClose, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogTitle, DialogTrigger, };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Header as HeaderPrimitive, Menu as MenuPrimitive, MenuTrigger as MenuTriggerPrimitive, Popover as PopoverPrimitive, Separator as SeparatorPrimitive, SubmenuTrigger as SubmenuTriggerPrimitive, type MenuItemProps as MenuItemPrimitiveProps, type MenuSectionProps as MenuSectionPrimitiveProps } from "react-aria-components";
|
|
3
|
+
declare function DropdownMenuTrigger({ ...props }: React.ComponentProps<typeof MenuTriggerPrimitive>): React.JSX.Element;
|
|
4
|
+
declare function DropdownMenu({ "data-slot": dataSlot, placement, offset, crossOffset, className, children, ...props }: Omit<React.ComponentProps<typeof MenuPrimitive<object>>, "children" | "className"> & Pick<React.ComponentProps<typeof PopoverPrimitive>, "placement" | "offset" | "crossOffset"> & {
|
|
5
|
+
"data-slot"?: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
}): React.JSX.Element;
|
|
9
|
+
declare function DropdownMenuGroup({ ...props }: Omit<MenuSectionPrimitiveProps<object>, "children"> & {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
}): React.JSX.Element;
|
|
12
|
+
declare function DropdownMenuLabel({ className, inset, ...props }: React.ComponentProps<typeof HeaderPrimitive> & {
|
|
13
|
+
inset?: boolean;
|
|
14
|
+
}): React.JSX.Element;
|
|
15
|
+
declare function DropdownMenuItem({ className, inset, variant, children, ...props }: MenuItemPrimitiveProps<object> & {
|
|
16
|
+
inset?: boolean;
|
|
17
|
+
variant?: "default" | "destructive";
|
|
18
|
+
}): React.JSX.Element;
|
|
19
|
+
declare function DropdownMenuSub({ ...props }: React.ComponentProps<typeof SubmenuTriggerPrimitive>): React.JSX.Element;
|
|
20
|
+
declare function DropdownMenuSubTrigger({ className, inset, children, ...props }: MenuItemPrimitiveProps<object> & {
|
|
21
|
+
inset?: boolean;
|
|
22
|
+
}): React.JSX.Element;
|
|
23
|
+
declare function DropdownMenuSubContent({ placement, crossOffset, offset, className, ...props }: React.ComponentProps<typeof DropdownMenu>): React.JSX.Element;
|
|
24
|
+
declare function DropdownMenuSeparator({ className, ...props }: React.ComponentProps<typeof SeparatorPrimitive>): React.JSX.Element;
|
|
25
|
+
declare function DropdownMenuShortcut({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
26
|
+
export { DropdownMenuTrigger, DropdownMenu, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { cn } from "../utils.js";
|
|
5
|
+
import { composeRenderProps, Header as HeaderPrimitive, MenuItem as MenuItemPrimitive, Menu as MenuPrimitive, MenuSection as MenuSectionPrimitive, MenuTrigger as MenuTriggerPrimitive, Popover as PopoverPrimitive, Separator as SeparatorPrimitive, SubmenuTrigger as SubmenuTriggerPrimitive, } from "react-aria-components";
|
|
6
|
+
import { CheckIcon, ChevronRightIcon } from "lucide-react";
|
|
7
|
+
function DropdownMenuTrigger({ ...props }) {
|
|
8
|
+
return _jsx(MenuTriggerPrimitive, { "data-slot": "dropdown-menu-trigger", ...props });
|
|
9
|
+
}
|
|
10
|
+
function DropdownMenu({ "data-slot": dataSlot = "dropdown-menu-content", placement = "bottom start", offset = 4, crossOffset = 0, className, children, ...props }) {
|
|
11
|
+
return (_jsx(PopoverPrimitive, { "data-slot": dataSlot, placement: placement, offset: offset, crossOffset: crossOffset, className: cn("z-50 w-(--trigger-width) min-w-48 origin-(--trigger-anchor-point) overflow-x-hidden overflow-y-auto rounded-3xl bg-popover p-1.5 text-popover-foreground shadow-lg ring-1 ring-foreground/5 duration-100 outline-none data-entering:animate-in data-entering:fade-in-0 data-entering:zoom-in-95 data-exiting:animate-out data-exiting:overflow-hidden data-exiting:fade-out-0 data-exiting:zoom-out-95 data-[placement=bottom]:slide-in-from-top-2 data-[placement=left]:slide-in-from-right-2 data-[placement=right]:slide-in-from-left-2 data-[placement=top]:slide-in-from-bottom-2 **:data-[slot$=-item]:data-focused:bg-foreground/10 dark:ring-foreground/10", className), children: _jsx(MenuPrimitive, { className: "max-h-[inherit] overflow-x-hidden overflow-y-auto outline-hidden", ...props, children: children }) }));
|
|
12
|
+
}
|
|
13
|
+
function DropdownMenuGroup({ ...props }) {
|
|
14
|
+
return _jsx(MenuSectionPrimitive, { "data-slot": "dropdown-menu-group", ...props });
|
|
15
|
+
}
|
|
16
|
+
function DropdownMenuLabel({ className, inset, ...props }) {
|
|
17
|
+
return (_jsx(HeaderPrimitive, { "data-slot": "dropdown-menu-label", "data-inset": inset, className: cn("px-3 py-2.5 text-xs text-muted-foreground data-inset:pl-9.5", className), ...props }));
|
|
18
|
+
}
|
|
19
|
+
const dropdownMenuItemVariants = cva("group/dropdown-menu-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0", {
|
|
20
|
+
variants: {
|
|
21
|
+
selectionMode: {
|
|
22
|
+
none: "gap-2.5 rounded-2xl px-3 py-2 text-sm font-medium focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-9.5 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",
|
|
23
|
+
single: "gap-2.5 rounded-2xl py-2 pr-8 pl-3 text-sm font-medium focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-9.5 [&_svg:not([class*='size-'])]:size-4",
|
|
24
|
+
multiple: "gap-2.5 rounded-2xl py-2 pr-8 pl-3 text-sm font-medium focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-9.5 [&_svg:not([class*='size-'])]:size-4",
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
function DropdownMenuItem({ className, inset, variant = "default", children, ...props }) {
|
|
29
|
+
return (_jsx(MenuItemPrimitive, { "data-slot": "dropdown-menu-item", "data-inset": inset, "data-variant": variant, textValue: typeof children === "string" ? children : props.textValue, className: composeRenderProps(className, (className, { selectionMode }) => cn(dropdownMenuItemVariants({ selectionMode }), className)), ...props, children: composeRenderProps(children, (children, { isSelected, selectionMode }) => (_jsxs(_Fragment, { children: [selectionMode !== "none" ? (_jsx("span", { className: "pointer-events-none absolute right-2 flex items-center justify-center", "data-slot": selectionMode === "single"
|
|
30
|
+
? "dropdown-menu-radio-item-indicator"
|
|
31
|
+
: "dropdown-menu-checkbox-item-indicator", children: isSelected ? (_jsx(CheckIcon, {})) : null })) : null, children] }))) }));
|
|
32
|
+
}
|
|
33
|
+
function DropdownMenuSub({ ...props }) {
|
|
34
|
+
return _jsx(SubmenuTriggerPrimitive, { "data-slot": "dropdown-menu-sub", ...props });
|
|
35
|
+
}
|
|
36
|
+
function DropdownMenuSubTrigger({ className, inset, children, ...props }) {
|
|
37
|
+
return (_jsx(MenuItemPrimitive, { "data-slot": "dropdown-menu-sub-trigger", "data-inset": inset, textValue: typeof children === "string" ? children : props.textValue, className: cn("flex cursor-default items-center gap-2 rounded-2xl px-3 py-2 text-sm font-medium outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-9.5 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className), ...props, children: composeRenderProps(children, (children) => (_jsxs(_Fragment, { children: [children, _jsx(ChevronRightIcon, { className: "ml-auto" })] }))) }));
|
|
38
|
+
}
|
|
39
|
+
function DropdownMenuSubContent({ placement = "end top", crossOffset = -3, offset = 0, className, ...props }) {
|
|
40
|
+
return (_jsx(DropdownMenu, { "data-slot": "dropdown-menu-sub-content", className: cn("w-auto min-w-36 rounded-3xl bg-popover p-1.5 text-popover-foreground shadow-lg ring-1 ring-foreground/5 duration-100 dark:ring-foreground/10", className), placement: placement, crossOffset: crossOffset, offset: offset, ...props }));
|
|
41
|
+
}
|
|
42
|
+
function DropdownMenuSeparator({ className, ...props }) {
|
|
43
|
+
return (_jsx(SeparatorPrimitive, { "data-slot": "dropdown-menu-separator", className: cn("-mx-1.5 my-1.5 h-px bg-border/50", className), ...props }));
|
|
44
|
+
}
|
|
45
|
+
function DropdownMenuShortcut({ className, ...props }) {
|
|
46
|
+
return (_jsx("span", { "data-slot": "dropdown-menu-shortcut", className: cn("ml-auto text-xs tracking-widest text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground", className), ...props }));
|
|
47
|
+
}
|
|
48
|
+
export { DropdownMenuTrigger, DropdownMenu, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type VariantProps } from "class-variance-authority";
|
|
2
|
+
import { Label } from "./label.js";
|
|
3
|
+
declare function FieldSet({ className, ...props }: React.ComponentProps<"fieldset">): import("react").JSX.Element;
|
|
4
|
+
declare function FieldLegend({ className, variant, ...props }: React.ComponentProps<"legend"> & {
|
|
5
|
+
variant?: "legend" | "label";
|
|
6
|
+
}): import("react").JSX.Element;
|
|
7
|
+
declare function FieldGroup({ className, ...props }: React.ComponentProps<"div">): import("react").JSX.Element;
|
|
8
|
+
declare const fieldVariants: (props?: ({
|
|
9
|
+
orientation?: "horizontal" | "responsive" | "vertical" | null | undefined;
|
|
10
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
11
|
+
declare function Field({ className, orientation, ...props }: React.ComponentProps<"div"> & VariantProps<typeof fieldVariants>): import("react").JSX.Element;
|
|
12
|
+
declare function FieldContent({ className, ...props }: React.ComponentProps<"div">): import("react").JSX.Element;
|
|
13
|
+
declare function FieldLabel({ className, ...props }: React.ComponentProps<typeof Label>): import("react").JSX.Element;
|
|
14
|
+
declare function FieldTitle({ className, ...props }: React.ComponentProps<"div">): import("react").JSX.Element;
|
|
15
|
+
declare function FieldDescription({ className, ...props }: React.ComponentProps<"p">): import("react").JSX.Element;
|
|
16
|
+
declare function FieldSeparator({ children, className, ...props }: React.ComponentProps<"div"> & {
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
}): import("react").JSX.Element;
|
|
19
|
+
declare function FieldError({ className, children, errors, ...props }: React.ComponentProps<"div"> & {
|
|
20
|
+
errors?: Array<{
|
|
21
|
+
message?: string;
|
|
22
|
+
} | undefined>;
|
|
23
|
+
}): import("react").JSX.Element | null;
|
|
24
|
+
export { Field, FieldLabel, FieldDescription, FieldError, FieldGroup, FieldLegend, FieldSeparator, FieldSet, FieldContent, FieldTitle, };
|
package/dist/ui/field.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { cn } from "../utils.js";
|
|
5
|
+
import { Label } from "./label.js";
|
|
6
|
+
import { Separator } from "./separator.js";
|
|
7
|
+
function FieldSet({ className, ...props }) {
|
|
8
|
+
return (_jsx("fieldset", { "data-slot": "field-set", className: cn("flex flex-col gap-6 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3", className), ...props }));
|
|
9
|
+
}
|
|
10
|
+
function FieldLegend({ className, variant = "legend", ...props }) {
|
|
11
|
+
return (_jsx("legend", { "data-slot": "field-legend", "data-variant": variant, className: cn("mb-3 font-medium data-[variant=label]:text-sm data-[variant=legend]:text-base", className), ...props }));
|
|
12
|
+
}
|
|
13
|
+
function FieldGroup({ className, ...props }) {
|
|
14
|
+
return (_jsx("div", { "data-slot": "field-group", className: cn("group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4", className), ...props }));
|
|
15
|
+
}
|
|
16
|
+
const fieldVariants = cva("group/field flex w-full gap-3 data-[invalid=true]:text-destructive", {
|
|
17
|
+
variants: {
|
|
18
|
+
orientation: {
|
|
19
|
+
vertical: "flex-col *:w-full [&>.sr-only]:w-auto",
|
|
20
|
+
horizontal: "flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
|
|
21
|
+
responsive: "flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
defaultVariants: {
|
|
25
|
+
orientation: "vertical",
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
function Field({ className, orientation = "vertical", ...props }) {
|
|
29
|
+
return (_jsx("div", { role: "group", "data-slot": "field", "data-orientation": orientation, className: cn(fieldVariants({ orientation }), className), ...props }));
|
|
30
|
+
}
|
|
31
|
+
function FieldContent({ className, ...props }) {
|
|
32
|
+
return (_jsx("div", { "data-slot": "field-content", className: cn("group/field-content flex flex-1 flex-col gap-1 leading-snug", className), ...props }));
|
|
33
|
+
}
|
|
34
|
+
function FieldLabel({ className, ...props }) {
|
|
35
|
+
return (_jsx(Label, { "data-slot": "field-label", className: cn("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:bg-input/30 has-data-selected:bg-input/30 has-[>[data-slot=field]]:rounded-2xl has-[>[data-slot=field]]:border has-[>[data-slot=field]]:not-has-[:disabled,[data-disabled]]:hover:bg-input/40 has-[>[data-slot=field]]:has-[:focus-visible]:border-ring has-[>[data-slot=field]]:has-[:focus-visible]:ring-3 has-[>[data-slot=field]]:has-[:focus-visible]:ring-ring/50 *:data-[slot=field]:p-4", "has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col", className), ...props }));
|
|
36
|
+
}
|
|
37
|
+
function FieldTitle({ className, ...props }) {
|
|
38
|
+
return (_jsx("div", { "data-slot": "field-label", className: cn("flex w-fit items-center gap-2 text-sm font-medium group-data-[disabled=true]/field:opacity-50", className), ...props }));
|
|
39
|
+
}
|
|
40
|
+
function FieldDescription({ className, ...props }) {
|
|
41
|
+
return (_jsx("p", { "data-slot": "field-description", className: cn("text-left text-sm leading-normal font-normal text-muted-foreground group-has-data-horizontal/field:text-balance [[data-variant=legend]+&]:-mt-1.5", "last:mt-0 nth-last-2:-mt-1", "[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary", className), ...props }));
|
|
42
|
+
}
|
|
43
|
+
function FieldSeparator({ children, className, ...props }) {
|
|
44
|
+
return (_jsxs("div", { "data-slot": "field-separator", "data-content": !!children, className: cn("relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2", className), ...props, children: [_jsx(Separator, { className: "absolute inset-0 top-1/2" }), children && (_jsx("span", { className: "relative mx-auto block w-fit bg-background px-2 text-muted-foreground", "data-slot": "field-separator-content", children: children }))] }));
|
|
45
|
+
}
|
|
46
|
+
function FieldError({ className, children, errors, ...props }) {
|
|
47
|
+
const content = useMemo(() => {
|
|
48
|
+
if (children) {
|
|
49
|
+
return children;
|
|
50
|
+
}
|
|
51
|
+
if (!errors?.length) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
const uniqueErrors = [
|
|
55
|
+
...new Map(errors.map((error) => [error?.message, error])).values(),
|
|
56
|
+
];
|
|
57
|
+
if (uniqueErrors?.length == 1) {
|
|
58
|
+
return uniqueErrors[0]?.message;
|
|
59
|
+
}
|
|
60
|
+
return (_jsx("ul", { className: "ml-4 flex list-disc flex-col gap-1", children: uniqueErrors.map((error, index) => error?.message && _jsx("li", { children: error.message }, index)) }));
|
|
61
|
+
}, [children, errors]);
|
|
62
|
+
if (!content) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
return (_jsx("div", { role: "alert", "data-slot": "field-error", className: cn("text-sm font-normal text-destructive", className), ...props, children: content }));
|
|
66
|
+
}
|
|
67
|
+
export { Field, FieldLabel, FieldDescription, FieldError, FieldGroup, FieldLegend, FieldSeparator, FieldSet, FieldContent, FieldTitle, };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ürünün tek başlık ölçeği (panel ve tanıtım sitesi): yazı tipi, kalınlık, satır ve harf aralığı burada; sayfa yalnız
|
|
3
|
+
* boyutu seçer (renk ve yerleşim className'den). Büyük boyutlar görüntü yazı tipiyle, `base` ve `sm` metin yazı tipiyle.
|
|
4
|
+
* Ölçek dışı boyut eklenmez.
|
|
5
|
+
*/
|
|
6
|
+
declare const sizes: {
|
|
7
|
+
readonly mega: 'font-display text-5xl leading-[1.02] tracking-[-0.035em] sm:text-7xl';
|
|
8
|
+
readonly hero: 'font-display text-4xl leading-[1.05] tracking-[-0.03em] sm:text-6xl';
|
|
9
|
+
readonly display: 'font-display text-4xl leading-tight tracking-tight sm:text-5xl';
|
|
10
|
+
readonly section: 'font-display text-3xl tracking-tight sm:text-4xl';
|
|
11
|
+
readonly title: 'font-display text-2xl tracking-tight sm:text-3xl';
|
|
12
|
+
readonly subtitle: 'font-display text-2xl tracking-tight';
|
|
13
|
+
readonly card: 'font-display text-xl tracking-tight';
|
|
14
|
+
readonly small: 'font-display text-lg tracking-tight';
|
|
15
|
+
readonly base: 'text-base';
|
|
16
|
+
readonly sm: 'text-sm';
|
|
17
|
+
readonly xs: 'text-xs';
|
|
18
|
+
};
|
|
19
|
+
export type HeadingSize = keyof typeof sizes;
|
|
20
|
+
export declare function Heading({ as: Tag, size, className, ...props }: React.HTMLAttributes<HTMLHeadingElement> & {
|
|
21
|
+
as?: 'h1' | 'h2' | 'h3' | 'h4';
|
|
22
|
+
size: HeadingSize;
|
|
23
|
+
}): import("react").JSX.Element;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from '../utils.js';
|
|
3
|
+
/**
|
|
4
|
+
* Ürünün tek başlık ölçeği (panel ve tanıtım sitesi): yazı tipi, kalınlık, satır ve harf aralığı burada; sayfa yalnız
|
|
5
|
+
* boyutu seçer (renk ve yerleşim className'den). Büyük boyutlar görüntü yazı tipiyle, `base` ve `sm` metin yazı tipiyle.
|
|
6
|
+
* Ölçek dışı boyut eklenmez.
|
|
7
|
+
*/
|
|
8
|
+
const sizes = {
|
|
9
|
+
mega: 'font-display text-5xl leading-[1.02] tracking-[-0.035em] sm:text-7xl',
|
|
10
|
+
hero: 'font-display text-4xl leading-[1.05] tracking-[-0.03em] sm:text-6xl',
|
|
11
|
+
display: 'font-display text-4xl leading-tight tracking-tight sm:text-5xl',
|
|
12
|
+
section: 'font-display text-3xl tracking-tight sm:text-4xl',
|
|
13
|
+
title: 'font-display text-2xl tracking-tight sm:text-3xl',
|
|
14
|
+
subtitle: 'font-display text-2xl tracking-tight',
|
|
15
|
+
card: 'font-display text-xl tracking-tight',
|
|
16
|
+
small: 'font-display text-lg tracking-tight',
|
|
17
|
+
base: 'text-base',
|
|
18
|
+
sm: 'text-sm',
|
|
19
|
+
// Yoğun araç panellerindeki küçük bölüm başlığı.
|
|
20
|
+
xs: 'text-xs',
|
|
21
|
+
};
|
|
22
|
+
export function Heading({ as: Tag = 'h2', size, className, ...props }) {
|
|
23
|
+
return _jsx(Tag, { className: cn('font-semibold text-balance', sizes[size], className), ...props });
|
|
24
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare const tones: {
|
|
2
|
+
readonly primary: 'bg-primary/10 text-primary';
|
|
3
|
+
readonly neutral: 'bg-muted text-muted-foreground';
|
|
4
|
+
readonly success: 'bg-emerald-500/10 text-emerald-700 dark:text-emerald-400';
|
|
5
|
+
readonly warning: 'bg-amber-500/10 text-amber-700 dark:text-amber-400';
|
|
6
|
+
readonly danger: 'bg-red-500/10 text-red-700 dark:text-red-400';
|
|
7
|
+
};
|
|
8
|
+
declare const sizes: {
|
|
9
|
+
readonly sm: 'size-8 rounded-xl [&_svg]:size-4';
|
|
10
|
+
readonly default: 'size-10 rounded-2xl [&_svg]:size-5';
|
|
11
|
+
};
|
|
12
|
+
/** Kartın başındaki kare ikon zemini (özellik, öneri, adım). */
|
|
13
|
+
export declare function IconTile({ tone, size, className, ...props }: React.ComponentProps<'span'> & {
|
|
14
|
+
tone?: keyof typeof tones;
|
|
15
|
+
size?: keyof typeof sizes;
|
|
16
|
+
}): import("react").JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from '../utils.js';
|
|
3
|
+
const tones = {
|
|
4
|
+
primary: 'bg-primary/10 text-primary',
|
|
5
|
+
neutral: 'bg-muted text-muted-foreground',
|
|
6
|
+
success: 'bg-emerald-500/10 text-emerald-700 dark:text-emerald-400',
|
|
7
|
+
warning: 'bg-amber-500/10 text-amber-700 dark:text-amber-400',
|
|
8
|
+
danger: 'bg-red-500/10 text-red-700 dark:text-red-400',
|
|
9
|
+
};
|
|
10
|
+
const sizes = {
|
|
11
|
+
sm: 'size-8 rounded-xl [&_svg]:size-4',
|
|
12
|
+
default: 'size-10 rounded-2xl [&_svg]:size-5',
|
|
13
|
+
};
|
|
14
|
+
/** Kartın başındaki kare ikon zemini (özellik, öneri, adım). */
|
|
15
|
+
export function IconTile({ tone = 'primary', size = 'default', className, ...props }) {
|
|
16
|
+
return _jsx("span", { className: cn('flex shrink-0 items-center justify-center [&_svg]:shrink-0', sizes[size], tones[tone], className), ...props });
|
|
17
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
import { type GroupProps } from "react-aria-components";
|
|
4
|
+
import { Button } from "./button.js";
|
|
5
|
+
declare function InputGroup({ className, ...props }: GroupProps): React.JSX.Element;
|
|
6
|
+
declare const inputGroupAddonVariants: (props?: ({
|
|
7
|
+
align?: "block-end" | "block-start" | "inline-end" | "inline-start" | null | undefined;
|
|
8
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
9
|
+
declare function InputGroupAddon({ className, align, ...props }: React.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>): React.JSX.Element;
|
|
10
|
+
declare const inputGroupButtonVariants: (props?: ({
|
|
11
|
+
size?: "icon-sm" | "icon-xs" | "sm" | "xs" | null | undefined;
|
|
12
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
13
|
+
declare function InputGroupButton({ className, type, variant, size, ...props }: Omit<React.ComponentProps<typeof Button>, "size" | "type"> & VariantProps<typeof inputGroupButtonVariants> & {
|
|
14
|
+
type?: "button" | "submit" | "reset";
|
|
15
|
+
}): React.JSX.Element;
|
|
16
|
+
declare function InputGroupText({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
17
|
+
declare function InputGroupInput({ className, ...props }: Omit<React.ComponentProps<"input">, "size">): React.JSX.Element;
|
|
18
|
+
declare function InputGroupTextarea({ className, ...props }: React.ComponentProps<"textarea">): React.JSX.Element;
|
|
19
|
+
export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupText, InputGroupInput, InputGroupTextarea, };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { cn } from "../utils.js";
|
|
5
|
+
import { Group } from "react-aria-components";
|
|
6
|
+
import { Button } from "./button.js";
|
|
7
|
+
import { Input } from "./input.js";
|
|
8
|
+
import { Textarea } from "./textarea.js";
|
|
9
|
+
function InputGroup({ className, ...props }) {
|
|
10
|
+
return (_jsx(Group, { "data-slot": "input-group", className: cn("group/input-group relative flex h-9 w-full min-w-0 items-center rounded-4xl border border-transparent bg-input/50 transition-[color,box-shadow,background-color] outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-data-[align=block-end]:rounded-3xl has-data-[align=block-start]:rounded-3xl has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/30 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[textarea]:rounded-2xl has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5", className), ...props }));
|
|
11
|
+
}
|
|
12
|
+
const inputGroupAddonVariants = cva("flex h-auto cursor-text items-center justify-center gap-2 py-2 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 **:data-[slot=kbd]:rounded-3xl **:data-[slot=kbd]:bg-muted-foreground/10 **:data-[slot=kbd]:px-1.5 [&>svg:not([class*='size-'])]:size-4", {
|
|
13
|
+
variants: {
|
|
14
|
+
align: {
|
|
15
|
+
"inline-start": "order-first pl-3 has-[>button]:-ml-1 has-[>kbd]:-ml-1",
|
|
16
|
+
"inline-end": "order-last pr-3 has-[>button]:-mr-1 has-[>kbd]:-mr-1",
|
|
17
|
+
"block-start": "order-first w-full justify-start px-3 pt-3 group-has-[>input]/input-group:pt-3.5 [.border-b]:pb-3.5",
|
|
18
|
+
"block-end": "order-last w-full justify-start px-3 pb-3 group-has-[>input]/input-group:pb-3.5 [.border-t]:pt-3.5",
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
defaultVariants: {
|
|
22
|
+
align: "inline-start",
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
function InputGroupAddon({ className, align = "inline-start", ...props }) {
|
|
26
|
+
return (_jsx("div", { role: "group", "data-slot": "input-group-addon", "data-align": align, className: cn(inputGroupAddonVariants({ align }), className), onClick: (e) => {
|
|
27
|
+
if (e.target.closest("button")) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
e.currentTarget.parentElement?.querySelector("input")?.focus();
|
|
31
|
+
}, ...props }));
|
|
32
|
+
}
|
|
33
|
+
const inputGroupButtonVariants = cva("flex items-center gap-2 rounded-4xl text-sm shadow-none", {
|
|
34
|
+
variants: {
|
|
35
|
+
size: {
|
|
36
|
+
xs: "h-6 gap-1 rounded-xl px-1.5 [&>svg:not([class*='size-'])]:size-3.5",
|
|
37
|
+
sm: "",
|
|
38
|
+
"icon-xs": "size-6 rounded-xl p-0 has-[>svg]:p-0",
|
|
39
|
+
"icon-sm": "size-8 p-0 has-[>svg]:p-0",
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
defaultVariants: {
|
|
43
|
+
size: "xs",
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
function InputGroupButton({ className, type = "button", variant = "ghost", size = "xs", ...props }) {
|
|
47
|
+
return (_jsx(Button, { type: type, "data-size": size, variant: variant, className: cn(inputGroupButtonVariants({ size }), className), ...props }));
|
|
48
|
+
}
|
|
49
|
+
function InputGroupText({ className, ...props }) {
|
|
50
|
+
return (_jsx("span", { className: cn("flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4", className), ...props }));
|
|
51
|
+
}
|
|
52
|
+
function InputGroupInput({ className, ...props }) {
|
|
53
|
+
return (_jsx(Input, { "data-slot": "input-group-control", className: cn("flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent", className), ...props }));
|
|
54
|
+
}
|
|
55
|
+
function InputGroupTextarea({ className, ...props }) {
|
|
56
|
+
return (_jsx(Textarea, { "data-slot": "input-group-control", className: cn("flex-1 resize-none rounded-none border-0 bg-transparent py-2.5 shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent", className), ...props }));
|
|
57
|
+
}
|
|
58
|
+
export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupText, InputGroupInput, InputGroupTextarea, };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Input as InputPrimitive } from "react-aria-components";
|
|
3
|
+
declare function Input({ className, type, size, mono, ...props }: Omit<React.ComponentProps<typeof InputPrimitive>, "size"> & {
|
|
4
|
+
size?: "default" | "sm" | "xs";
|
|
5
|
+
/** Kod, anahtar, adres gibi eş aralıklı yazılması gereken değerler. */
|
|
6
|
+
mono?: boolean;
|
|
7
|
+
}): React.JSX.Element;
|
|
8
|
+
export { Input };
|
package/dist/ui/input.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../utils.js";
|
|
3
|
+
import { composeRenderProps, Input as InputPrimitive, } from "react-aria-components";
|
|
4
|
+
function Input({ className, type, size = "default", mono = false, ...props }) {
|
|
5
|
+
return (_jsx(InputPrimitive, { type: type, "data-slot": "input", "data-size": size, "data-mono": mono || undefined, className: composeRenderProps(className, (className) => cn("h-9 data-[size=sm]:h-8 data-[size=sm]:text-sm data-[size=xs]:h-7 data-[size=xs]:px-2.5 data-[size=xs]:text-xs data-mono:font-mono w-full min-w-0 rounded-3xl border border-transparent bg-input/50 px-3 py-1 text-base transition-[color,box-shadow,background-color] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/30 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40", className)), ...props }));
|
|
6
|
+
}
|
|
7
|
+
export { Input };
|
package/dist/ui/label.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "../utils.js";
|
|
4
|
+
import { LabelContext, Label as LabelPrimitive, } from "react-aria-components";
|
|
5
|
+
function Label({ className, htmlFor, slot, ...props }) {
|
|
6
|
+
const label = (_jsx(LabelPrimitive, { "data-slot": "label", className: cn("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50 peer-data-disabled:opacity-50", className), ...props, htmlFor: htmlFor, slot: slot }));
|
|
7
|
+
if (htmlFor && slot === undefined) {
|
|
8
|
+
return _jsx(LabelContext.Provider, { value: null, children: label });
|
|
9
|
+
}
|
|
10
|
+
return label;
|
|
11
|
+
}
|
|
12
|
+
export { Label };
|