@dashnex/ui 0.5.2
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 +522 -0
- package/dashnex.json +1 -0
- package/dist/client.d.ts +10 -0
- package/dist/client.js +12 -0
- package/dist/components/Loading.d.ts +3 -0
- package/dist/components/Loading.js +4 -0
- package/dist/components/tailwind/alert.d.ts +28 -0
- package/dist/components/tailwind/alert.js +30 -0
- package/dist/components/tailwind/auth-layout.d.ts +4 -0
- package/dist/components/tailwind/auth-layout.js +4 -0
- package/dist/components/tailwind/avatar.d.ts +14 -0
- package/dist/components/tailwind/avatar.js +18 -0
- package/dist/components/tailwind/badge.d.ts +33 -0
- package/dist/components/tailwind/badge.js +33 -0
- package/dist/components/tailwind/button.d.ts +58 -0
- package/dist/components/tailwind/button.js +169 -0
- package/dist/components/tailwind/checkbox.d.ts +36 -0
- package/dist/components/tailwind/checkbox.js +83 -0
- package/dist/components/tailwind/combobox.d.ts +19 -0
- package/dist/components/tailwind/combobox.js +86 -0
- package/dist/components/tailwind/description-list.d.ts +3 -0
- package/dist/components/tailwind/description-list.js +11 -0
- package/dist/components/tailwind/dialog.d.ts +28 -0
- package/dist/components/tailwind/dialog.js +30 -0
- package/dist/components/tailwind/divider.d.ts +3 -0
- package/dist/components/tailwind/divider.js +5 -0
- package/dist/components/tailwind/dropdown.d.ts +32 -0
- package/dist/components/tailwind/dropdown.js +78 -0
- package/dist/components/tailwind/fieldset.d.ts +21 -0
- package/dist/components/tailwind/fieldset.js +24 -0
- package/dist/components/tailwind/heading.d.ts +6 -0
- package/dist/components/tailwind/heading.js +10 -0
- package/dist/components/tailwind/index.d.ts +27 -0
- package/dist/components/tailwind/index.js +28 -0
- package/dist/components/tailwind/input.d.ts +10 -0
- package/dist/components/tailwind/input.js +58 -0
- package/dist/components/tailwind/link.d.ts +11 -0
- package/dist/components/tailwind/link.js +13 -0
- package/dist/components/tailwind/listbox.d.ts +15 -0
- package/dist/components/tailwind/listbox.js +84 -0
- package/dist/components/tailwind/navbar.d.ts +14 -0
- package/dist/components/tailwind/navbar.js +42 -0
- package/dist/components/tailwind/pagination.d.ts +17 -0
- package/dist/components/tailwind/pagination.js +21 -0
- package/dist/components/tailwind/radio.d.ts +37 -0
- package/dist/components/tailwind/radio.js +86 -0
- package/dist/components/tailwind/select.d.ts +5 -0
- package/dist/components/tailwind/select.js +40 -0
- package/dist/components/tailwind/sidebar-layout.d.ts +5 -0
- package/dist/components/tailwind/sidebar-layout.js +18 -0
- package/dist/components/tailwind/sidebar.d.ts +18 -0
- package/dist/components/tailwind/sidebar.js +56 -0
- package/dist/components/tailwind/stacked-layout.d.ts +5 -0
- package/dist/components/tailwind/stacked-layout.js +18 -0
- package/dist/components/tailwind/switch.d.ts +36 -0
- package/dist/components/tailwind/switch.js +146 -0
- package/dist/components/tailwind/table.d.ts +16 -0
- package/dist/components/tailwind/table.js +40 -0
- package/dist/components/tailwind/text.d.ts +5 -0
- package/dist/components/tailwind/text.js +15 -0
- package/dist/components/tailwind/textarea.d.ts +6 -0
- package/dist/components/tailwind/textarea.js +36 -0
- package/dist/components/theme/index.d.ts +2 -0
- package/dist/components/theme/index.js +2 -0
- package/dist/components/theme/theme-provider.d.ts +14 -0
- package/dist/components/theme/theme-provider.js +83 -0
- package/dist/components/theme/theme-switcher.d.ts +1 -0
- package/dist/components/theme/theme-switcher.js +12 -0
- package/dist/pages/index.d.ts +2 -0
- package/dist/pages/index.js +1 -0
- package/dist/server.d.ts +8 -0
- package/dist/server.js +10 -0
- package/dist/tailwind.d.ts +1 -0
- package/dist/tailwind.js +1 -0
- package/package.json +73 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as Headless from '@headlessui/react';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
export function RadioGroup({ className, ...props }) {
|
|
5
|
+
return (_jsx(Headless.RadioGroup, { "data-slot": "control", ...props, className: clsx(className,
|
|
6
|
+
// Basic groups
|
|
7
|
+
'space-y-3 **:data-[slot=label]:font-normal',
|
|
8
|
+
// With descriptions
|
|
9
|
+
'has-data-[slot=description]:space-y-6 has-data-[slot=description]:**:data-[slot=label]:font-medium') }));
|
|
10
|
+
}
|
|
11
|
+
export function RadioField({ className, ...props }) {
|
|
12
|
+
return (_jsx(Headless.Field, { "data-slot": "field", ...props, className: clsx(className,
|
|
13
|
+
// Base layout
|
|
14
|
+
'grid grid-cols-[1.125rem_1fr] gap-x-4 gap-y-1 sm:grid-cols-[1rem_1fr]',
|
|
15
|
+
// Control layout
|
|
16
|
+
'*:data-[slot=control]:col-start-1 *:data-[slot=control]:row-start-1 *:data-[slot=control]:mt-0.75 sm:*:data-[slot=control]:mt-1',
|
|
17
|
+
// Label layout
|
|
18
|
+
'*:data-[slot=label]:col-start-2 *:data-[slot=label]:row-start-1',
|
|
19
|
+
// Description layout
|
|
20
|
+
'*:data-[slot=description]:col-start-2 *:data-[slot=description]:row-start-2',
|
|
21
|
+
// With description
|
|
22
|
+
'has-data-[slot=description]:**:data-[slot=label]:font-medium') }));
|
|
23
|
+
}
|
|
24
|
+
const base = [
|
|
25
|
+
// Basic layout
|
|
26
|
+
'relative isolate flex size-4.75 shrink-0 rounded-full sm:size-4.25',
|
|
27
|
+
// Background color + shadow applied to inset pseudo element, so shadow blends with border in light mode
|
|
28
|
+
'before:absolute before:inset-0 before:-z-10 before:rounded-full before:bg-white before:shadow-sm',
|
|
29
|
+
// Background color when checked
|
|
30
|
+
'group-data-checked:before:bg-(--radio-checked-bg)',
|
|
31
|
+
// Background color is moved to control and shadow is removed in dark mode so hide `before` pseudo
|
|
32
|
+
'dark:before:hidden',
|
|
33
|
+
// Background color applied to control in dark mode
|
|
34
|
+
'dark:bg-white/5 dark:group-data-checked:bg-(--radio-checked-bg)',
|
|
35
|
+
// Border
|
|
36
|
+
'border border-zinc-950/15 group-data-checked:border-transparent group-data-hover:group-data-checked:border-transparent group-data-hover:border-zinc-950/30 group-data-checked:bg-(--radio-checked-border)',
|
|
37
|
+
'dark:border-white/15 dark:group-data-checked:border-white/5 dark:group-data-hover:group-data-checked:border-white/5 dark:group-data-hover:border-white/30',
|
|
38
|
+
// Inner highlight shadow
|
|
39
|
+
'after:absolute after:inset-0 after:rounded-full after:shadow-[inset_0_1px_--theme(--color-white/15%)]',
|
|
40
|
+
'dark:after:-inset-px dark:after:hidden dark:after:rounded-full dark:group-data-checked:after:block',
|
|
41
|
+
// Indicator color (light mode)
|
|
42
|
+
'[--radio-indicator:transparent] group-data-checked:[--radio-indicator:var(--radio-checked-indicator)] group-data-hover:group-data-checked:[--radio-indicator:var(--radio-checked-indicator)] group-data-hover:[--radio-indicator:var(--color-zinc-900)]/10',
|
|
43
|
+
// Indicator color (dark mode)
|
|
44
|
+
'dark:group-data-hover:group-data-checked:[--radio-indicator:var(--radio-checked-indicator)] dark:group-data-hover:[--radio-indicator:var(--color-zinc-700)]',
|
|
45
|
+
// Focus ring
|
|
46
|
+
'group-data-focus:outline group-data-focus:outline-2 group-data-focus:outline-offset-2 group-data-focus:outline-blue-500',
|
|
47
|
+
// Disabled state
|
|
48
|
+
'group-data-disabled:opacity-50',
|
|
49
|
+
'group-data-disabled:border-zinc-950/25 group-data-disabled:bg-zinc-950/5 group-data-disabled:[--radio-checked-indicator:var(--color-zinc-950)]/50 group-data-disabled:before:bg-transparent',
|
|
50
|
+
'dark:group-data-disabled:border-white/20 dark:group-data-disabled:bg-white/2.5 dark:group-data-disabled:[--radio-checked-indicator:var(--color-white)]/50 dark:group-data-checked:group-data-disabled:after:hidden',
|
|
51
|
+
];
|
|
52
|
+
const colors = {
|
|
53
|
+
'dark/zinc': [
|
|
54
|
+
'[--radio-checked-bg:var(--color-zinc-900)] [--radio-checked-border:var(--color-zinc-950)]/90 [--radio-checked-indicator:var(--color-white)]',
|
|
55
|
+
'dark:[--radio-checked-bg:var(--color-zinc-600)]',
|
|
56
|
+
],
|
|
57
|
+
'dark/white': [
|
|
58
|
+
'[--radio-checked-bg:var(--color-zinc-900)] [--radio-checked-border:var(--color-zinc-950)]/90 [--radio-checked-indicator:var(--color-white)]',
|
|
59
|
+
'dark:[--radio-checked-bg:var(--color-white)] dark:[--radio-checked-border:var(--color-zinc-950)]/15 dark:[--radio-checked-indicator:var(--color-zinc-900)]',
|
|
60
|
+
],
|
|
61
|
+
white: '[--radio-checked-bg:var(--color-white)] [--radio-checked-border:var(--color-zinc-950)]/15 [--radio-checked-indicator:var(--color-zinc-900)]',
|
|
62
|
+
dark: '[--radio-checked-bg:var(--color-zinc-900)] [--radio-checked-border:var(--color-zinc-950)]/90 [--radio-checked-indicator:var(--color-white)]',
|
|
63
|
+
zinc: '[--radio-checked-indicator:var(--color-white)] [--radio-checked-bg:var(--color-zinc-600)] [--radio-checked-border:var(--color-zinc-700)]/90',
|
|
64
|
+
red: '[--radio-checked-indicator:var(--color-white)] [--radio-checked-bg:var(--color-red-600)] [--radio-checked-border:var(--color-red-700)]/90',
|
|
65
|
+
orange: '[--radio-checked-indicator:var(--color-white)] [--radio-checked-bg:var(--color-orange-500)] [--radio-checked-border:var(--color-orange-600)]/90',
|
|
66
|
+
amber: '[--radio-checked-bg:var(--color-amber-400)] [--radio-checked-border:var(--color-amber-500)]/80 [--radio-checked-indicator:var(--color-amber-950)]',
|
|
67
|
+
yellow: '[--radio-checked-bg:var(--color-yellow-300)] [--radio-checked-border:var(--color-yellow-400)]/80 [--radio-checked-indicator:var(--color-yellow-950)]',
|
|
68
|
+
lime: '[--radio-checked-bg:var(--color-lime-300)] [--radio-checked-border:var(--color-lime-400)]/80 [--radio-checked-indicator:var(--color-lime-950)]',
|
|
69
|
+
green: '[--radio-checked-indicator:var(--color-white)] [--radio-checked-bg:var(--color-green-600)] [--radio-checked-border:var(--color-green-700)]/90',
|
|
70
|
+
emerald: '[--radio-checked-indicator:var(--color-white)] [--radio-checked-bg:var(--color-emerald-600)] [--radio-checked-border:var(--color-emerald-700)]/90',
|
|
71
|
+
teal: '[--radio-checked-indicator:var(--color-white)] [--radio-checked-bg:var(--color-teal-600)] [--radio-checked-border:var(--color-teal-700)]/90',
|
|
72
|
+
cyan: '[--radio-checked-bg:var(--color-cyan-300)] [--radio-checked-border:var(--color-cyan-400)]/80 [--radio-checked-indicator:var(--color-cyan-950)]',
|
|
73
|
+
sky: '[--radio-checked-indicator:var(--color-white)] [--radio-checked-bg:var(--color-sky-500)] [--radio-checked-border:var(--color-sky-600)]/80',
|
|
74
|
+
blue: '[--radio-checked-indicator:var(--color-white)] [--radio-checked-bg:var(--color-blue-600)] [--radio-checked-border:var(--color-blue-700)]/90',
|
|
75
|
+
indigo: '[--radio-checked-indicator:var(--color-white)] [--radio-checked-bg:var(--color-indigo-500)] [--radio-checked-border:var(--color-indigo-600)]/90',
|
|
76
|
+
violet: '[--radio-checked-indicator:var(--color-white)] [--radio-checked-bg:var(--color-violet-500)] [--radio-checked-border:var(--color-violet-600)]/90',
|
|
77
|
+
purple: '[--radio-checked-indicator:var(--color-white)] [--radio-checked-bg:var(--color-purple-500)] [--radio-checked-border:var(--color-purple-600)]/90',
|
|
78
|
+
fuchsia: '[--radio-checked-indicator:var(--color-white)] [--radio-checked-bg:var(--color-fuchsia-500)] [--radio-checked-border:var(--color-fuchsia-600)]/90',
|
|
79
|
+
pink: '[--radio-checked-indicator:var(--color-white)] [--radio-checked-bg:var(--color-pink-500)] [--radio-checked-border:var(--color-pink-600)]/90',
|
|
80
|
+
rose: '[--radio-checked-indicator:var(--color-white)] [--radio-checked-bg:var(--color-rose-500)] [--radio-checked-border:var(--color-rose-600)]/90',
|
|
81
|
+
};
|
|
82
|
+
export function Radio({ color = 'dark/zinc', className, ...props }) {
|
|
83
|
+
return (_jsx(Headless.Radio, { "data-slot": "control", ...props, className: clsx(className, 'group inline-flex focus:outline-hidden'), children: _jsx("span", { className: clsx([base, colors[color]]), children: _jsx("span", { className: clsx('size-full rounded-full border-[4.5px] border-transparent bg-(--radio-indicator) bg-clip-padding',
|
|
84
|
+
// Forced colors mode
|
|
85
|
+
'forced-colors:border-[Canvas] forced-colors:group-data-checked:border-[Highlight]') }) }) }));
|
|
86
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as Headless from '@headlessui/react';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
export const Select = forwardRef(function Select({ className, multiple, ...props }, ref) {
|
|
6
|
+
return (_jsxs("span", { "data-slot": "control", className: clsx([
|
|
7
|
+
className,
|
|
8
|
+
// Basic layout
|
|
9
|
+
'group relative block w-full',
|
|
10
|
+
// Background color + shadow applied to inset pseudo element, so shadow blends with border in light mode
|
|
11
|
+
'before:absolute before:inset-px before:rounded-[calc(var(--radius-lg)-1px)] before:bg-white before:shadow-sm',
|
|
12
|
+
// Background color is moved to control and shadow is removed in dark mode so hide `before` pseudo
|
|
13
|
+
'dark:before:hidden',
|
|
14
|
+
// Focus ring
|
|
15
|
+
'after:pointer-events-none after:absolute after:inset-0 after:rounded-lg after:ring-transparent after:ring-inset has-data-focus:after:ring-2 has-data-focus:after:ring-blue-500',
|
|
16
|
+
// Disabled state
|
|
17
|
+
'has-data-disabled:opacity-50 has-data-disabled:before:bg-zinc-950/5 has-data-disabled:before:shadow-none',
|
|
18
|
+
]), children: [_jsx(Headless.Select, { ref: ref, multiple: multiple, ...props, className: clsx([
|
|
19
|
+
// Basic layout
|
|
20
|
+
'relative block w-full appearance-none rounded-lg py-[calc(--spacing(2.5)-1px)] sm:py-[calc(--spacing(1.5)-1px)]',
|
|
21
|
+
// Horizontal padding
|
|
22
|
+
multiple
|
|
23
|
+
? 'px-[calc(--spacing(3.5)-1px)] sm:px-[calc(--spacing(3)-1px)]'
|
|
24
|
+
: 'pr-[calc(--spacing(10)-1px)] pl-[calc(--spacing(3.5)-1px)] sm:pr-[calc(--spacing(9)-1px)] sm:pl-[calc(--spacing(3)-1px)]',
|
|
25
|
+
// Options (multi-select)
|
|
26
|
+
'[&_optgroup]:font-semibold',
|
|
27
|
+
// Typography
|
|
28
|
+
'text-base/6 text-zinc-950 placeholder:text-zinc-500 sm:text-sm/6 dark:text-white dark:*:text-white',
|
|
29
|
+
// Border
|
|
30
|
+
'border border-zinc-950/10 data-hover:border-zinc-950/20 dark:border-white/10 dark:data-hover:border-white/20',
|
|
31
|
+
// Background color
|
|
32
|
+
'bg-transparent dark:bg-white/5 dark:*:bg-zinc-800',
|
|
33
|
+
// Hide default focus styles
|
|
34
|
+
'focus:outline-hidden',
|
|
35
|
+
// Invalid state
|
|
36
|
+
'data-invalid:border-red-500 data-invalid:data-hover:border-red-500 dark:data-invalid:border-red-600 dark:data-invalid:data-hover:border-red-600',
|
|
37
|
+
// Disabled state
|
|
38
|
+
'data-disabled:border-zinc-950/20 data-disabled:opacity-100 dark:data-disabled:border-white/15 dark:data-disabled:bg-white/2.5 dark:data-hover:data-disabled:border-white/15',
|
|
39
|
+
]) }), !multiple && (_jsx("span", { className: "pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2", children: _jsxs("svg", { className: "size-5 stroke-zinc-500 group-has-data-disabled:stroke-zinc-600 sm:size-4 dark:stroke-zinc-400 forced-colors:stroke-[CanvasText]", viewBox: "0 0 16 16", "aria-hidden": "true", fill: "none", children: [_jsx("path", { d: "M5.75 10.75L8 13L10.25 10.75", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M10.25 5.25L8 3L5.75 5.25", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round" })] }) }))] }));
|
|
40
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as Headless from '@headlessui/react';
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
import { NavbarItem } from './navbar.js';
|
|
6
|
+
function OpenMenuIcon() {
|
|
7
|
+
return (_jsx("svg", { "data-slot": "icon", viewBox: "0 0 20 20", "aria-hidden": "true", children: _jsx("path", { d: "M2 6.75C2 6.33579 2.33579 6 2.75 6H17.25C17.6642 6 18 6.33579 18 6.75C18 7.16421 17.6642 7.5 17.25 7.5H2.75C2.33579 7.5 2 7.16421 2 6.75ZM2 13.25C2 12.8358 2.33579 12.5 2.75 12.5H17.25C17.6642 12.5 18 12.8358 18 13.25C18 13.6642 17.6642 14 17.25 14H2.75C2.33579 14 2 13.6642 2 13.25Z" }) }));
|
|
8
|
+
}
|
|
9
|
+
function CloseMenuIcon() {
|
|
10
|
+
return (_jsx("svg", { "data-slot": "icon", viewBox: "0 0 20 20", "aria-hidden": "true", children: _jsx("path", { d: "M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z" }) }));
|
|
11
|
+
}
|
|
12
|
+
function MobileSidebar({ open, close, children }) {
|
|
13
|
+
return (_jsxs(Headless.Dialog, { open: open, onClose: close, className: "lg:hidden", children: [_jsx(Headless.DialogBackdrop, { transition: true, className: "fixed inset-0 bg-black/30 transition data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in" }), _jsx(Headless.DialogPanel, { transition: true, className: "fixed inset-y-0 w-full max-w-80 p-2 transition duration-300 ease-in-out data-closed:-translate-x-full", children: _jsxs("div", { className: "flex h-full flex-col rounded-lg bg-white shadow-xs ring-1 ring-zinc-950/5 dark:bg-zinc-900 dark:ring-white/10", children: [_jsx("div", { className: "-mb-3 px-4 pt-3", children: _jsx(Headless.CloseButton, { as: NavbarItem, "aria-label": "Close navigation", children: _jsx(CloseMenuIcon, {}) }) }), children] }) })] }));
|
|
14
|
+
}
|
|
15
|
+
export function SidebarLayout({ navbar, sidebar, children, }) {
|
|
16
|
+
const [showSidebar, setShowSidebar] = useState(false);
|
|
17
|
+
return (_jsxs("div", { className: "relative isolate flex min-h-svh w-full bg-white max-lg:flex-col lg:bg-zinc-100 dark:bg-zinc-900 dark:lg:bg-zinc-950", children: [_jsx("div", { className: "fixed inset-y-0 left-0 w-64 max-lg:hidden", children: sidebar }), _jsx(MobileSidebar, { open: showSidebar, close: () => setShowSidebar(false), children: sidebar }), _jsxs("header", { className: "flex items-center px-4 lg:hidden", children: [_jsx("div", { className: "py-2.5", children: _jsx(NavbarItem, { onClick: () => setShowSidebar(true), "aria-label": "Open navigation", children: _jsx(OpenMenuIcon, {}) }) }), _jsx("div", { className: "min-w-0 flex-1", children: navbar })] }), _jsx("main", { className: "flex flex-1 flex-col pb-2 lg:min-w-0 lg:pt-2 lg:pr-2 lg:pl-64", children: _jsx("div", { className: "grow p-6 lg:rounded-lg lg:bg-white lg:p-10 lg:shadow-xs lg:ring-1 lg:ring-zinc-950/5 dark:lg:bg-zinc-900 dark:lg:ring-white/10", children: _jsx("div", { className: "mx-auto max-w-6xl", children: children }) }) })] }));
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as Headless from '@headlessui/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export declare function Sidebar({ className, ...props }: React.ComponentPropsWithoutRef<'nav'>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare function SidebarHeader({ className, ...props }: React.ComponentPropsWithoutRef<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare function SidebarBody({ className, ...props }: React.ComponentPropsWithoutRef<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function SidebarFooter({ className, ...props }: React.ComponentPropsWithoutRef<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function SidebarSection({ className, ...props }: React.ComponentPropsWithoutRef<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function SidebarDivider({ className, ...props }: React.ComponentPropsWithoutRef<'hr'>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function SidebarSpacer({ className, ...props }: React.ComponentPropsWithoutRef<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function SidebarHeading({ className, ...props }: React.ComponentPropsWithoutRef<'h3'>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare const SidebarItem: React.ForwardRefExoticComponent<({
|
|
12
|
+
current?: boolean;
|
|
13
|
+
className?: string;
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
} & (Omit<Headless.ButtonProps<"button">, "className" | "as"> | Omit<Headless.ButtonProps<React.ForwardRefExoticComponent<{
|
|
16
|
+
href: string;
|
|
17
|
+
} & Omit<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref"> & React.RefAttributes<HTMLAnchorElement>>>, "className" | "as">)) & React.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
|
|
18
|
+
export declare function SidebarLabel({ className, ...props }: React.ComponentPropsWithoutRef<'span'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as Headless from '@headlessui/react';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import { LayoutGroup } from 'framer-motion';
|
|
6
|
+
import { forwardRef, useId } from 'react';
|
|
7
|
+
import { TouchTarget } from './button.js';
|
|
8
|
+
import { Link } from './link.js';
|
|
9
|
+
export function Sidebar({ className, ...props }) {
|
|
10
|
+
return _jsx("nav", { ...props, className: clsx(className, 'flex h-full min-h-0 flex-col') });
|
|
11
|
+
}
|
|
12
|
+
export function SidebarHeader({ className, ...props }) {
|
|
13
|
+
return (_jsx("div", { ...props, className: clsx(className, 'flex flex-col border-b border-zinc-950/5 p-4 dark:border-white/5 [&>[data-slot=section]+[data-slot=section]]:mt-2.5') }));
|
|
14
|
+
}
|
|
15
|
+
export function SidebarBody({ className, ...props }) {
|
|
16
|
+
return (_jsx("div", { ...props, className: clsx(className, 'flex flex-1 flex-col overflow-y-auto p-4 [&>[data-slot=section]+[data-slot=section]]:mt-8') }));
|
|
17
|
+
}
|
|
18
|
+
export function SidebarFooter({ className, ...props }) {
|
|
19
|
+
return (_jsx("div", { ...props, className: clsx(className, 'flex flex-col border-t border-zinc-950/5 p-4 dark:border-white/5 [&>[data-slot=section]+[data-slot=section]]:mt-2.5') }));
|
|
20
|
+
}
|
|
21
|
+
export function SidebarSection({ className, ...props }) {
|
|
22
|
+
const id = useId();
|
|
23
|
+
return (_jsx(LayoutGroup, { id: id, children: _jsx("div", { ...props, "data-slot": "section", className: clsx(className, 'flex flex-col gap-0.5') }) }));
|
|
24
|
+
}
|
|
25
|
+
export function SidebarDivider({ className, ...props }) {
|
|
26
|
+
return _jsx("hr", { ...props, className: clsx(className, 'my-4 border-t border-zinc-950/5 lg:-mx-4 dark:border-white/5') });
|
|
27
|
+
}
|
|
28
|
+
export function SidebarSpacer({ className, ...props }) {
|
|
29
|
+
return _jsx("div", { "aria-hidden": "true", ...props, className: clsx(className, 'mt-8 flex-1') });
|
|
30
|
+
}
|
|
31
|
+
export function SidebarHeading({ className, ...props }) {
|
|
32
|
+
return (_jsx("h3", { ...props, className: clsx(className, 'mb-1 px-2 text-xs/6 font-medium text-zinc-500 dark:text-zinc-400') }));
|
|
33
|
+
}
|
|
34
|
+
export const SidebarItem = forwardRef(function SidebarItem({ current, className, children, ...props }, ref) {
|
|
35
|
+
const classes = clsx(
|
|
36
|
+
// Base
|
|
37
|
+
'flex w-full items-center gap-3 rounded-lg px-2 py-2.5 text-left text-base/6 font-medium text-zinc-950 sm:py-2 sm:text-sm/5',
|
|
38
|
+
// Leading icon/icon-only
|
|
39
|
+
'*:data-[slot=icon]:size-6 *:data-[slot=icon]:shrink-0 *:data-[slot=icon]:fill-zinc-500 sm:*:data-[slot=icon]:size-5',
|
|
40
|
+
// Trailing icon (down chevron or similar)
|
|
41
|
+
'*:last:data-[slot=icon]:ml-auto *:last:data-[slot=icon]:size-5 sm:*:last:data-[slot=icon]:size-4',
|
|
42
|
+
// Avatar
|
|
43
|
+
'*:data-[slot=avatar]:-m-0.5 *:data-[slot=avatar]:size-7 sm:*:data-[slot=avatar]:size-6',
|
|
44
|
+
// Hover
|
|
45
|
+
'data-hover:bg-zinc-950/5 data-hover:*:data-[slot=icon]:fill-zinc-950',
|
|
46
|
+
// Active
|
|
47
|
+
'data-active:bg-zinc-950/5 data-active:*:data-[slot=icon]:fill-zinc-950',
|
|
48
|
+
// Current
|
|
49
|
+
'data-current:*:data-[slot=icon]:fill-zinc-950',
|
|
50
|
+
// Dark mode
|
|
51
|
+
'dark:text-white dark:*:data-[slot=icon]:fill-zinc-400', 'dark:data-hover:bg-white/5 dark:data-hover:*:data-[slot=icon]:fill-white', 'dark:data-active:bg-white/5 dark:data-active:*:data-[slot=icon]:fill-white', 'dark:data-current:*:data-[slot=icon]:fill-white');
|
|
52
|
+
return (_jsxs("span", { className: clsx(className, 'relative'), children: [_jsx("span", { className: clsx("absolute inset-y-2 -left-4 w-0.5 rounded-full bg-zinc-950 dark:bg-white transition-opacity", current ? "opacity-100" : "opacity-0") }), 'href' in props ? (_jsx(Headless.CloseButton, { as: Link, ...props, className: classes, "data-current": current ? 'true' : undefined, ref: ref, children: _jsx(TouchTarget, { children: children }) })) : (_jsx(Headless.Button, { ...props, className: clsx('cursor-default', classes), "data-current": current ? 'true' : undefined, ref: ref, children: _jsx(TouchTarget, { children: children }) }))] }));
|
|
53
|
+
});
|
|
54
|
+
export function SidebarLabel({ className, ...props }) {
|
|
55
|
+
return _jsx("span", { ...props, className: clsx(className, 'truncate') });
|
|
56
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as Headless from '@headlessui/react';
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
import { NavbarItem } from './navbar.js';
|
|
6
|
+
function OpenMenuIcon() {
|
|
7
|
+
return (_jsx("svg", { "data-slot": "icon", viewBox: "0 0 20 20", "aria-hidden": "true", children: _jsx("path", { d: "M2 6.75C2 6.33579 2.33579 6 2.75 6H17.25C17.6642 6 18 6.33579 18 6.75C18 7.16421 17.6642 7.5 17.25 7.5H2.75C2.33579 7.5 2 7.16421 2 6.75ZM2 13.25C2 12.8358 2.33579 12.5 2.75 12.5H17.25C17.6642 12.5 18 12.8358 18 13.25C18 13.6642 17.6642 14 17.25 14H2.75C2.33579 14 2 13.6642 2 13.25Z" }) }));
|
|
8
|
+
}
|
|
9
|
+
function CloseMenuIcon() {
|
|
10
|
+
return (_jsx("svg", { "data-slot": "icon", viewBox: "0 0 20 20", "aria-hidden": "true", children: _jsx("path", { d: "M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z" }) }));
|
|
11
|
+
}
|
|
12
|
+
function MobileSidebar({ open, close, children }) {
|
|
13
|
+
return (_jsxs(Headless.Dialog, { open: open, onClose: close, className: "lg:hidden", children: [_jsx(Headless.DialogBackdrop, { transition: true, className: "fixed inset-0 bg-black/30 transition data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in" }), _jsx(Headless.DialogPanel, { transition: true, className: "fixed inset-y-0 w-full max-w-80 p-2 transition duration-300 ease-in-out data-closed:-translate-x-full", children: _jsxs("div", { className: "flex h-full flex-col rounded-lg bg-white shadow-xs ring-1 ring-zinc-950/5 dark:bg-zinc-900 dark:ring-white/10", children: [_jsx("div", { className: "-mb-3 px-4 pt-3", children: _jsx(Headless.CloseButton, { as: NavbarItem, "aria-label": "Close navigation", children: _jsx(CloseMenuIcon, {}) }) }), children] }) })] }));
|
|
14
|
+
}
|
|
15
|
+
export function StackedLayout({ navbar, sidebar, children, }) {
|
|
16
|
+
const [showSidebar, setShowSidebar] = useState(false);
|
|
17
|
+
return (_jsxs("div", { className: "relative isolate flex min-h-svh w-full flex-col bg-white lg:bg-zinc-100 dark:bg-zinc-900 dark:lg:bg-zinc-950", children: [_jsx(MobileSidebar, { open: showSidebar, close: () => setShowSidebar(false), children: sidebar }), _jsxs("header", { className: "flex items-center px-4", children: [_jsx("div", { className: "py-2.5 lg:hidden", children: _jsx(NavbarItem, { onClick: () => setShowSidebar(true), "aria-label": "Open navigation", children: _jsx(OpenMenuIcon, {}) }) }), _jsx("div", { className: "min-w-0 flex-1", children: navbar })] }), _jsx("main", { className: "flex flex-1 flex-col pb-2 lg:px-2", children: _jsx("div", { className: "grow p-6 lg:rounded-lg lg:bg-white lg:p-10 lg:shadow-xs lg:ring-1 lg:ring-zinc-950/5 dark:lg:bg-zinc-900 dark:lg:ring-white/10", children: _jsx("div", { className: "mx-auto max-w-6xl", children: children }) }) })] }));
|
|
18
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as Headless from '@headlessui/react';
|
|
2
|
+
import type React from 'react';
|
|
3
|
+
export declare function SwitchGroup({ className, ...props }: React.ComponentPropsWithoutRef<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare function SwitchField({ className, ...props }: {
|
|
5
|
+
className?: string;
|
|
6
|
+
} & Omit<Headless.FieldProps, 'as' | 'className'>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare const colors: {
|
|
8
|
+
'dark/zinc': string[];
|
|
9
|
+
'dark/white': string[];
|
|
10
|
+
dark: string[];
|
|
11
|
+
zinc: string[];
|
|
12
|
+
white: string[];
|
|
13
|
+
red: string[];
|
|
14
|
+
orange: string[];
|
|
15
|
+
amber: string[];
|
|
16
|
+
yellow: string[];
|
|
17
|
+
lime: string[];
|
|
18
|
+
green: string[];
|
|
19
|
+
emerald: string[];
|
|
20
|
+
teal: string[];
|
|
21
|
+
cyan: string[];
|
|
22
|
+
sky: string[];
|
|
23
|
+
blue: string[];
|
|
24
|
+
indigo: string[];
|
|
25
|
+
violet: string[];
|
|
26
|
+
purple: string[];
|
|
27
|
+
fuchsia: string[];
|
|
28
|
+
pink: string[];
|
|
29
|
+
rose: string[];
|
|
30
|
+
};
|
|
31
|
+
type Color = keyof typeof colors;
|
|
32
|
+
export declare function Switch({ color, className, ...props }: {
|
|
33
|
+
color?: Color;
|
|
34
|
+
className?: string;
|
|
35
|
+
} & Omit<Headless.SwitchProps, 'as' | 'className' | 'children'>): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as Headless from '@headlessui/react';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
export function SwitchGroup({ className, ...props }) {
|
|
5
|
+
return (_jsx("div", { "data-slot": "control", ...props, className: clsx(className,
|
|
6
|
+
// Basic groups
|
|
7
|
+
'space-y-3 **:data-[slot=label]:font-normal',
|
|
8
|
+
// With descriptions
|
|
9
|
+
'has-data-[slot=description]:space-y-6 has-data-[slot=description]:**:data-[slot=label]:font-medium') }));
|
|
10
|
+
}
|
|
11
|
+
export function SwitchField({ className, ...props }) {
|
|
12
|
+
return (_jsx(Headless.Field, { "data-slot": "field", ...props, className: clsx(className,
|
|
13
|
+
// Base layout
|
|
14
|
+
'grid grid-cols-[1fr_auto] gap-x-8 gap-y-1 sm:grid-cols-[1fr_auto]',
|
|
15
|
+
// Control layout
|
|
16
|
+
'*:data-[slot=control]:col-start-2 *:data-[slot=control]:self-start sm:*:data-[slot=control]:mt-0.5',
|
|
17
|
+
// Label layout
|
|
18
|
+
'*:data-[slot=label]:col-start-1 *:data-[slot=label]:row-start-1',
|
|
19
|
+
// Description layout
|
|
20
|
+
'*:data-[slot=description]:col-start-1 *:data-[slot=description]:row-start-2',
|
|
21
|
+
// With description
|
|
22
|
+
'has-data-[slot=description]:**:data-[slot=label]:font-medium') }));
|
|
23
|
+
}
|
|
24
|
+
const colors = {
|
|
25
|
+
'dark/zinc': [
|
|
26
|
+
'[--switch-bg-ring:var(--color-zinc-950)]/90 [--switch-bg:var(--color-zinc-900)] dark:[--switch-bg-ring:transparent] dark:[--switch-bg:var(--color-white)]/25',
|
|
27
|
+
'[--switch-ring:var(--color-zinc-950)]/90 [--switch-shadow:var(--color-black)]/10 [--switch:white] dark:[--switch-ring:var(--color-zinc-700)]/90',
|
|
28
|
+
],
|
|
29
|
+
'dark/white': [
|
|
30
|
+
'[--switch-bg-ring:var(--color-zinc-950)]/90 [--switch-bg:var(--color-zinc-900)] dark:[--switch-bg-ring:transparent] dark:[--switch-bg:var(--color-white)]',
|
|
31
|
+
'[--switch-ring:var(--color-zinc-950)]/90 [--switch-shadow:var(--color-black)]/10 [--switch:white] dark:[--switch-ring:transparent] dark:[--switch:var(--color-zinc-900)]',
|
|
32
|
+
],
|
|
33
|
+
dark: [
|
|
34
|
+
'[--switch-bg-ring:var(--color-zinc-950)]/90 [--switch-bg:var(--color-zinc-900)] dark:[--switch-bg-ring:var(--color-white)]/15',
|
|
35
|
+
'[--switch-ring:var(--color-zinc-950)]/90 [--switch-shadow:var(--color-black)]/10 [--switch:white]',
|
|
36
|
+
],
|
|
37
|
+
zinc: [
|
|
38
|
+
'[--switch-bg-ring:var(--color-zinc-700)]/90 [--switch-bg:var(--color-zinc-600)] dark:[--switch-bg-ring:transparent]',
|
|
39
|
+
'[--switch-shadow:var(--color-black)]/10 [--switch:white] [--switch-ring:var(--color-zinc-700)]/90',
|
|
40
|
+
],
|
|
41
|
+
white: [
|
|
42
|
+
'[--switch-bg-ring:var(--color-black)]/15 [--switch-bg:white] dark:[--switch-bg-ring:transparent]',
|
|
43
|
+
'[--switch-shadow:var(--color-black)]/10 [--switch-ring:transparent] [--switch:var(--color-zinc-950)]',
|
|
44
|
+
],
|
|
45
|
+
red: [
|
|
46
|
+
'[--switch-bg-ring:var(--color-red-700)]/90 [--switch-bg:var(--color-red-600)] dark:[--switch-bg-ring:transparent]',
|
|
47
|
+
'[--switch:white] [--switch-ring:var(--color-red-700)]/90 [--switch-shadow:var(--color-red-900)]/20',
|
|
48
|
+
],
|
|
49
|
+
orange: [
|
|
50
|
+
'[--switch-bg-ring:var(--color-orange-600)]/90 [--switch-bg:var(--color-orange-500)] dark:[--switch-bg-ring:transparent]',
|
|
51
|
+
'[--switch:white] [--switch-ring:var(--color-orange-600)]/90 [--switch-shadow:var(--color-orange-900)]/20',
|
|
52
|
+
],
|
|
53
|
+
amber: [
|
|
54
|
+
'[--switch-bg-ring:var(--color-amber-500)]/80 [--switch-bg:var(--color-amber-400)] dark:[--switch-bg-ring:transparent]',
|
|
55
|
+
'[--switch-ring:transparent] [--switch-shadow:transparent] [--switch:var(--color-amber-950)]',
|
|
56
|
+
],
|
|
57
|
+
yellow: [
|
|
58
|
+
'[--switch-bg-ring:var(--color-yellow-400)]/80 [--switch-bg:var(--color-yellow-300)] dark:[--switch-bg-ring:transparent]',
|
|
59
|
+
'[--switch-ring:transparent] [--switch-shadow:transparent] [--switch:var(--color-yellow-950)]',
|
|
60
|
+
],
|
|
61
|
+
lime: [
|
|
62
|
+
'[--switch-bg-ring:var(--color-lime-400)]/80 [--switch-bg:var(--color-lime-300)] dark:[--switch-bg-ring:transparent]',
|
|
63
|
+
'[--switch-ring:transparent] [--switch-shadow:transparent] [--switch:var(--color-lime-950)]',
|
|
64
|
+
],
|
|
65
|
+
green: [
|
|
66
|
+
'[--switch-bg-ring:var(--color-green-700)]/90 [--switch-bg:var(--color-green-600)] dark:[--switch-bg-ring:transparent]',
|
|
67
|
+
'[--switch:white] [--switch-ring:var(--color-green-700)]/90 [--switch-shadow:var(--color-green-900)]/20',
|
|
68
|
+
],
|
|
69
|
+
emerald: [
|
|
70
|
+
'[--switch-bg-ring:var(--color-emerald-600)]/90 [--switch-bg:var(--color-emerald-500)] dark:[--switch-bg-ring:transparent]',
|
|
71
|
+
'[--switch:white] [--switch-ring:var(--color-emerald-600)]/90 [--switch-shadow:var(--color-emerald-900)]/20',
|
|
72
|
+
],
|
|
73
|
+
teal: [
|
|
74
|
+
'[--switch-bg-ring:var(--color-teal-700)]/90 [--switch-bg:var(--color-teal-600)] dark:[--switch-bg-ring:transparent]',
|
|
75
|
+
'[--switch:white] [--switch-ring:var(--color-teal-700)]/90 [--switch-shadow:var(--color-teal-900)]/20',
|
|
76
|
+
],
|
|
77
|
+
cyan: [
|
|
78
|
+
'[--switch-bg-ring:var(--color-cyan-400)]/80 [--switch-bg:var(--color-cyan-300)] dark:[--switch-bg-ring:transparent]',
|
|
79
|
+
'[--switch-ring:transparent] [--switch-shadow:transparent] [--switch:var(--color-cyan-950)]',
|
|
80
|
+
],
|
|
81
|
+
sky: [
|
|
82
|
+
'[--switch-bg-ring:var(--color-sky-600)]/80 [--switch-bg:var(--color-sky-500)] dark:[--switch-bg-ring:transparent]',
|
|
83
|
+
'[--switch:white] [--switch-ring:var(--color-sky-600)]/80 [--switch-shadow:var(--color-sky-900)]/20',
|
|
84
|
+
],
|
|
85
|
+
blue: [
|
|
86
|
+
'[--switch-bg-ring:var(--color-blue-700)]/90 [--switch-bg:var(--color-blue-600)] dark:[--switch-bg-ring:transparent]',
|
|
87
|
+
'[--switch:white] [--switch-ring:var(--color-blue-700)]/90 [--switch-shadow:var(--color-blue-900)]/20',
|
|
88
|
+
],
|
|
89
|
+
indigo: [
|
|
90
|
+
'[--switch-bg-ring:var(--color-indigo-600)]/90 [--switch-bg:var(--color-indigo-500)] dark:[--switch-bg-ring:transparent]',
|
|
91
|
+
'[--switch:white] [--switch-ring:var(--color-indigo-600)]/90 [--switch-shadow:var(--color-indigo-900)]/20',
|
|
92
|
+
],
|
|
93
|
+
violet: [
|
|
94
|
+
'[--switch-bg-ring:var(--color-violet-600)]/90 [--switch-bg:var(--color-violet-500)] dark:[--switch-bg-ring:transparent]',
|
|
95
|
+
'[--switch:white] [--switch-ring:var(--color-violet-600)]/90 [--switch-shadow:var(--color-violet-900)]/20',
|
|
96
|
+
],
|
|
97
|
+
purple: [
|
|
98
|
+
'[--switch-bg-ring:var(--color-purple-600)]/90 [--switch-bg:var(--color-purple-500)] dark:[--switch-bg-ring:transparent]',
|
|
99
|
+
'[--switch:white] [--switch-ring:var(--color-purple-600)]/90 [--switch-shadow:var(--color-purple-900)]/20',
|
|
100
|
+
],
|
|
101
|
+
fuchsia: [
|
|
102
|
+
'[--switch-bg-ring:var(--color-fuchsia-600)]/90 [--switch-bg:var(--color-fuchsia-500)] dark:[--switch-bg-ring:transparent]',
|
|
103
|
+
'[--switch:white] [--switch-ring:var(--color-fuchsia-600)]/90 [--switch-shadow:var(--color-fuchsia-900)]/20',
|
|
104
|
+
],
|
|
105
|
+
pink: [
|
|
106
|
+
'[--switch-bg-ring:var(--color-pink-600)]/90 [--switch-bg:var(--color-pink-500)] dark:[--switch-bg-ring:transparent]',
|
|
107
|
+
'[--switch:white] [--switch-ring:var(--color-pink-600)]/90 [--switch-shadow:var(--color-pink-900)]/20',
|
|
108
|
+
],
|
|
109
|
+
rose: [
|
|
110
|
+
'[--switch-bg-ring:var(--color-rose-600)]/90 [--switch-bg:var(--color-rose-500)] dark:[--switch-bg-ring:transparent]',
|
|
111
|
+
'[--switch:white] [--switch-ring:var(--color-rose-600)]/90 [--switch-shadow:var(--color-rose-900)]/20',
|
|
112
|
+
],
|
|
113
|
+
};
|
|
114
|
+
export function Switch({ color = 'dark/zinc', className, ...props }) {
|
|
115
|
+
return (_jsx(Headless.Switch, { "data-slot": "control", ...props, className: clsx(className,
|
|
116
|
+
// Base styles
|
|
117
|
+
'group relative isolate inline-flex h-6 w-10 cursor-default rounded-full p-[3px] sm:h-5 sm:w-8',
|
|
118
|
+
// Transitions
|
|
119
|
+
'transition duration-0 ease-in-out data-changing:duration-200',
|
|
120
|
+
// Outline and background color in forced-colors mode so switch is still visible
|
|
121
|
+
'forced-colors:outline forced-colors:[--switch-bg:Highlight] dark:forced-colors:[--switch-bg:Highlight]',
|
|
122
|
+
// Unchecked
|
|
123
|
+
'bg-zinc-200 ring-1 ring-black/5 ring-inset dark:bg-white/5 dark:ring-white/15',
|
|
124
|
+
// Checked
|
|
125
|
+
'data-checked:bg-(--switch-bg) data-checked:ring-(--switch-bg-ring) dark:data-checked:bg-(--switch-bg) dark:data-checked:ring-(--switch-bg-ring)',
|
|
126
|
+
// Focus
|
|
127
|
+
'focus:not-data-focus:outline-hidden data-focus:outline-2 data-focus:outline-offset-2 data-focus:outline-blue-500',
|
|
128
|
+
// Hover
|
|
129
|
+
'data-hover:ring-black/15 data-hover:data-checked:ring-(--switch-bg-ring)', 'dark:data-hover:ring-white/25 dark:data-hover:data-checked:ring-(--switch-bg-ring)',
|
|
130
|
+
// Disabled
|
|
131
|
+
'data-disabled:bg-zinc-200 data-disabled:opacity-50 data-disabled:data-checked:bg-zinc-200 data-disabled:data-checked:ring-black/5', 'dark:data-disabled:bg-white/15 dark:data-disabled:data-checked:bg-white/15 dark:data-disabled:data-checked:ring-white/15',
|
|
132
|
+
// Color specific styles
|
|
133
|
+
colors[color]), children: _jsx("span", { "aria-hidden": "true", className: clsx(
|
|
134
|
+
// Basic layout
|
|
135
|
+
'pointer-events-none relative inline-block size-4.5 rounded-full sm:size-3.5',
|
|
136
|
+
// Transition
|
|
137
|
+
'translate-x-0 transition duration-200 ease-in-out',
|
|
138
|
+
// Invisible border so the switch is still visible in forced-colors mode
|
|
139
|
+
'border border-transparent',
|
|
140
|
+
// Unchecked
|
|
141
|
+
'bg-white shadow-sm ring-1 ring-black/5',
|
|
142
|
+
// Checked
|
|
143
|
+
'group-data-checked:bg-(--switch) group-data-checked:shadow-(--switch-shadow) group-data-checked:ring-(--switch-ring)', 'group-data-checked:translate-x-4 sm:group-data-checked:translate-x-3',
|
|
144
|
+
// Disabled
|
|
145
|
+
'group-data-checked:group-data-disabled:bg-white group-data-checked:group-data-disabled:shadow-sm group-data-checked:group-data-disabled:ring-black/5') }) }));
|
|
146
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
export declare function Table({ bleed, dense, grid, striped, className, children, ...props }: {
|
|
3
|
+
bleed?: boolean;
|
|
4
|
+
dense?: boolean;
|
|
5
|
+
grid?: boolean;
|
|
6
|
+
striped?: boolean;
|
|
7
|
+
} & React.ComponentPropsWithoutRef<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function TableHead({ className, ...props }: React.ComponentPropsWithoutRef<'thead'>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function TableBody(props: React.ComponentPropsWithoutRef<'tbody'>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function TableRow({ href, target, title, className, ...props }: {
|
|
11
|
+
href?: string;
|
|
12
|
+
target?: string;
|
|
13
|
+
title?: string;
|
|
14
|
+
} & React.ComponentPropsWithoutRef<'tr'>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare function TableHeader({ className, ...props }: React.ComponentPropsWithoutRef<'th'>): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare function TableCell({ className, children, ...props }: React.ComponentPropsWithoutRef<'td'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { createContext, useContext, useState } from 'react';
|
|
5
|
+
import { Link } from './link.js';
|
|
6
|
+
const TableContext = createContext({
|
|
7
|
+
bleed: false,
|
|
8
|
+
dense: false,
|
|
9
|
+
grid: false,
|
|
10
|
+
striped: false,
|
|
11
|
+
});
|
|
12
|
+
export function Table({ bleed = false, dense = false, grid = false, striped = false, className, children, ...props }) {
|
|
13
|
+
return (_jsx(TableContext.Provider, { value: { bleed, dense, grid, striped }, children: _jsx("div", { className: "flow-root", children: _jsx("div", { ...props, className: clsx(className, '-mx-(--gutter) overflow-x-auto whitespace-nowrap'), children: _jsx("div", { className: clsx('inline-block min-w-full align-middle', !bleed && 'sm:px-(--gutter)'), children: _jsx("table", { className: "min-w-full text-left text-sm/6 text-zinc-950 dark:text-white", children: children }) }) }) }) }));
|
|
14
|
+
}
|
|
15
|
+
export function TableHead({ className, ...props }) {
|
|
16
|
+
return _jsx("thead", { ...props, className: clsx(className, 'text-zinc-500 dark:text-zinc-400') });
|
|
17
|
+
}
|
|
18
|
+
export function TableBody(props) {
|
|
19
|
+
return _jsx("tbody", { ...props });
|
|
20
|
+
}
|
|
21
|
+
const TableRowContext = createContext({
|
|
22
|
+
href: undefined,
|
|
23
|
+
target: undefined,
|
|
24
|
+
title: undefined,
|
|
25
|
+
});
|
|
26
|
+
export function TableRow({ href, target, title, className, ...props }) {
|
|
27
|
+
const { striped } = useContext(TableContext);
|
|
28
|
+
return (_jsx(TableRowContext.Provider, { value: { href, target, title }, children: _jsx("tr", { ...props, className: clsx(className, href &&
|
|
29
|
+
'has-[[data-row-link][data-focus]]:outline-2 has-[[data-row-link][data-focus]]:-outline-offset-2 has-[[data-row-link][data-focus]]:outline-blue-500 dark:focus-within:bg-white/2.5', striped && 'even:bg-zinc-950/2.5 dark:even:bg-white/2.5', href && striped && 'hover:bg-zinc-950/5 dark:hover:bg-white/5', href && !striped && 'hover:bg-zinc-950/2.5 dark:hover:bg-white/2.5') }) }));
|
|
30
|
+
}
|
|
31
|
+
export function TableHeader({ className, ...props }) {
|
|
32
|
+
const { bleed, grid } = useContext(TableContext);
|
|
33
|
+
return (_jsx("th", { ...props, className: clsx(className, 'border-b border-b-zinc-950/10 px-4 py-2 font-medium first:pl-(--gutter,--spacing(2)) last:pr-(--gutter,--spacing(2)) dark:border-b-white/10', grid && 'border-l border-l-zinc-950/5 first:border-l-0 dark:border-l-white/5', !bleed && 'sm:first:pl-1 sm:last:pr-1') }));
|
|
34
|
+
}
|
|
35
|
+
export function TableCell({ className, children, ...props }) {
|
|
36
|
+
const { bleed, dense, grid, striped } = useContext(TableContext);
|
|
37
|
+
const { href, target, title } = useContext(TableRowContext);
|
|
38
|
+
const [cellRef, setCellRef] = useState(null);
|
|
39
|
+
return (_jsxs("td", { ref: href ? setCellRef : undefined, ...props, className: clsx(className, 'relative px-4 first:pl-(--gutter,--spacing(2)) last:pr-(--gutter,--spacing(2))', !striped && 'border-b border-zinc-950/5 dark:border-white/5', grid && 'border-l border-l-zinc-950/5 first:border-l-0 dark:border-l-white/5', dense ? 'py-2.5' : 'py-4', !bleed && 'sm:first:pl-1 sm:last:pr-1'), children: [href && (_jsx(Link, { "data-row-link": true, href: href, target: target, "aria-label": title, tabIndex: cellRef?.previousElementSibling === null ? 0 : -1, className: "absolute inset-0 focus:outline-hidden" })), children] }));
|
|
40
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Link } from './link.js';
|
|
2
|
+
export declare function Text({ className, ...props }: React.ComponentPropsWithoutRef<'p'>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function TextLink({ className, ...props }: React.ComponentPropsWithoutRef<typeof Link>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare function Strong({ className, ...props }: React.ComponentPropsWithoutRef<'strong'>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare function Code({ className, ...props }: React.ComponentPropsWithoutRef<'code'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { Link } from './link.js';
|
|
4
|
+
export function Text({ className, ...props }) {
|
|
5
|
+
return (_jsx("p", { "data-slot": "text", ...props, className: clsx(className, 'text-base/6 text-zinc-500 sm:text-sm/6 dark:text-zinc-400') }));
|
|
6
|
+
}
|
|
7
|
+
export function TextLink({ className, ...props }) {
|
|
8
|
+
return (_jsx(Link, { ...props, className: clsx(className, 'text-zinc-950 underline decoration-zinc-950/50 data-hover:decoration-zinc-950 dark:text-white dark:decoration-white/50 dark:data-hover:decoration-white') }));
|
|
9
|
+
}
|
|
10
|
+
export function Strong({ className, ...props }) {
|
|
11
|
+
return _jsx("strong", { ...props, className: clsx(className, 'font-medium text-zinc-950 dark:text-white') });
|
|
12
|
+
}
|
|
13
|
+
export function Code({ className, ...props }) {
|
|
14
|
+
return (_jsx("code", { ...props, className: clsx(className, 'rounded-sm border border-zinc-950/10 bg-zinc-950/2.5 px-0.5 text-sm font-medium text-zinc-950 sm:text-[0.8125rem] dark:border-white/20 dark:bg-white/5 dark:text-white') }));
|
|
15
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as Headless from '@headlessui/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export declare const Textarea: React.ForwardRefExoticComponent<{
|
|
4
|
+
className?: string;
|
|
5
|
+
resizable?: boolean;
|
|
6
|
+
} & Omit<Headless.TextareaProps<"textarea">, "className" | "as"> & React.RefAttributes<HTMLTextAreaElement>>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as Headless from '@headlessui/react';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
export const Textarea = forwardRef(function Textarea({ className, resizable = true, ...props }, ref) {
|
|
6
|
+
return (_jsx("span", { "data-slot": "control", className: clsx([
|
|
7
|
+
className,
|
|
8
|
+
// Basic layout
|
|
9
|
+
'relative block w-full',
|
|
10
|
+
// Background color + shadow applied to inset pseudo element, so shadow blends with border in light mode
|
|
11
|
+
'before:absolute before:inset-px before:rounded-[calc(var(--radius-lg)-1px)] before:bg-white before:shadow-sm',
|
|
12
|
+
// Background color is moved to control and shadow is removed in dark mode so hide `before` pseudo
|
|
13
|
+
'dark:before:hidden',
|
|
14
|
+
// Focus ring
|
|
15
|
+
'after:pointer-events-none after:absolute after:inset-0 after:rounded-lg after:ring-transparent after:ring-inset sm:focus-within:after:ring-2 sm:focus-within:after:ring-blue-500',
|
|
16
|
+
// Disabled state
|
|
17
|
+
'has-data-disabled:opacity-50 has-data-disabled:before:bg-zinc-950/5 has-data-disabled:before:shadow-none',
|
|
18
|
+
]), children: _jsx(Headless.Textarea, { ref: ref, ...props, className: clsx([
|
|
19
|
+
// Basic layout
|
|
20
|
+
'relative block h-full w-full appearance-none rounded-lg px-[calc(--spacing(3.5)-1px)] py-[calc(--spacing(2.5)-1px)] sm:px-[calc(--spacing(3)-1px)] sm:py-[calc(--spacing(1.5)-1px)]',
|
|
21
|
+
// Typography
|
|
22
|
+
'text-base/6 text-zinc-950 placeholder:text-zinc-500 sm:text-sm/6 dark:text-white',
|
|
23
|
+
// Border
|
|
24
|
+
'border border-zinc-950/10 data-hover:border-zinc-950/20 dark:border-white/10 dark:data-hover:border-white/20',
|
|
25
|
+
// Background color
|
|
26
|
+
'bg-transparent dark:bg-white/5',
|
|
27
|
+
// Hide default focus styles
|
|
28
|
+
'focus:outline-hidden',
|
|
29
|
+
// Invalid state
|
|
30
|
+
'data-invalid:border-red-500 data-invalid:data-hover:border-red-500 dark:data-invalid:border-red-600 dark:data-invalid:data-hover:border-red-600',
|
|
31
|
+
// Disabled state
|
|
32
|
+
'disabled:border-zinc-950/20 dark:disabled:border-white/15 dark:disabled:bg-white/2.5 dark:data-hover:disabled:border-white/15',
|
|
33
|
+
// Resizable
|
|
34
|
+
resizable ? 'resize-y' : 'resize-none',
|
|
35
|
+
]) }) }));
|
|
36
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type Theme = 'light' | 'dark' | 'system';
|
|
3
|
+
interface ThemeContextType {
|
|
4
|
+
theme: Theme;
|
|
5
|
+
isDark: boolean;
|
|
6
|
+
setTheme: (theme: Theme) => void;
|
|
7
|
+
toggleTheme: () => void;
|
|
8
|
+
mounted: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function ThemeProvider({ children }: {
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare function useTheme(): ThemeContextType;
|
|
14
|
+
export {};
|