@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,33 @@
|
|
|
1
|
+
import * as Headless from '@headlessui/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
declare const colors: {
|
|
4
|
+
red: string;
|
|
5
|
+
orange: string;
|
|
6
|
+
amber: string;
|
|
7
|
+
yellow: string;
|
|
8
|
+
lime: string;
|
|
9
|
+
green: string;
|
|
10
|
+
emerald: string;
|
|
11
|
+
teal: string;
|
|
12
|
+
cyan: string;
|
|
13
|
+
sky: string;
|
|
14
|
+
blue: string;
|
|
15
|
+
indigo: string;
|
|
16
|
+
violet: string;
|
|
17
|
+
purple: string;
|
|
18
|
+
fuchsia: string;
|
|
19
|
+
pink: string;
|
|
20
|
+
rose: string;
|
|
21
|
+
zinc: string;
|
|
22
|
+
};
|
|
23
|
+
type BadgeProps = {
|
|
24
|
+
color?: keyof typeof colors;
|
|
25
|
+
};
|
|
26
|
+
export declare function Badge({ color, className, ...props }: BadgeProps & React.ComponentPropsWithoutRef<'span'>): import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export declare const BadgeButton: React.ForwardRefExoticComponent<(BadgeProps & ({
|
|
28
|
+
className?: string;
|
|
29
|
+
children: React.ReactNode;
|
|
30
|
+
} & (Omit<Headless.ButtonProps<"button">, "className" | "as"> | Omit<Omit<{
|
|
31
|
+
href: string;
|
|
32
|
+
} & Omit<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref"> & React.RefAttributes<HTMLAnchorElement>, "ref">, "className">))) & React.RefAttributes<HTMLElement>>;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
import { TouchTarget } from './button.js';
|
|
6
|
+
import { Link } from './link.js';
|
|
7
|
+
const colors = {
|
|
8
|
+
red: 'bg-red-500/15 text-red-700 group-data-hover:bg-red-500/25 dark:bg-red-500/10 dark:text-red-400 dark:group-data-hover:bg-red-500/20',
|
|
9
|
+
orange: 'bg-orange-500/15 text-orange-700 group-data-hover:bg-orange-500/25 dark:bg-orange-500/10 dark:text-orange-400 dark:group-data-hover:bg-orange-500/20',
|
|
10
|
+
amber: 'bg-amber-400/20 text-amber-700 group-data-hover:bg-amber-400/30 dark:bg-amber-400/10 dark:text-amber-400 dark:group-data-hover:bg-amber-400/15',
|
|
11
|
+
yellow: 'bg-yellow-400/20 text-yellow-700 group-data-hover:bg-yellow-400/30 dark:bg-yellow-400/10 dark:text-yellow-300 dark:group-data-hover:bg-yellow-400/15',
|
|
12
|
+
lime: 'bg-lime-400/20 text-lime-700 group-data-hover:bg-lime-400/30 dark:bg-lime-400/10 dark:text-lime-300 dark:group-data-hover:bg-lime-400/15',
|
|
13
|
+
green: 'bg-green-500/15 text-green-700 group-data-hover:bg-green-500/25 dark:bg-green-500/10 dark:text-green-400 dark:group-data-hover:bg-green-500/20',
|
|
14
|
+
emerald: 'bg-emerald-500/15 text-emerald-700 group-data-hover:bg-emerald-500/25 dark:bg-emerald-500/10 dark:text-emerald-400 dark:group-data-hover:bg-emerald-500/20',
|
|
15
|
+
teal: 'bg-teal-500/15 text-teal-700 group-data-hover:bg-teal-500/25 dark:bg-teal-500/10 dark:text-teal-300 dark:group-data-hover:bg-teal-500/20',
|
|
16
|
+
cyan: 'bg-cyan-400/20 text-cyan-700 group-data-hover:bg-cyan-400/30 dark:bg-cyan-400/10 dark:text-cyan-300 dark:group-data-hover:bg-cyan-400/15',
|
|
17
|
+
sky: 'bg-sky-500/15 text-sky-700 group-data-hover:bg-sky-500/25 dark:bg-sky-500/10 dark:text-sky-300 dark:group-data-hover:bg-sky-500/20',
|
|
18
|
+
blue: 'bg-blue-500/15 text-blue-700 group-data-hover:bg-blue-500/25 dark:text-blue-400 dark:group-data-hover:bg-blue-500/25',
|
|
19
|
+
indigo: 'bg-indigo-500/15 text-indigo-700 group-data-hover:bg-indigo-500/25 dark:text-indigo-400 dark:group-data-hover:bg-indigo-500/20',
|
|
20
|
+
violet: 'bg-violet-500/15 text-violet-700 group-data-hover:bg-violet-500/25 dark:text-violet-400 dark:group-data-hover:bg-violet-500/20',
|
|
21
|
+
purple: 'bg-purple-500/15 text-purple-700 group-data-hover:bg-purple-500/25 dark:text-purple-400 dark:group-data-hover:bg-purple-500/20',
|
|
22
|
+
fuchsia: 'bg-fuchsia-400/15 text-fuchsia-700 group-data-hover:bg-fuchsia-400/25 dark:bg-fuchsia-400/10 dark:text-fuchsia-400 dark:group-data-hover:bg-fuchsia-400/20',
|
|
23
|
+
pink: 'bg-pink-400/15 text-pink-700 group-data-hover:bg-pink-400/25 dark:bg-pink-400/10 dark:text-pink-400 dark:group-data-hover:bg-pink-400/20',
|
|
24
|
+
rose: 'bg-rose-400/15 text-rose-700 group-data-hover:bg-rose-400/25 dark:bg-rose-400/10 dark:text-rose-400 dark:group-data-hover:bg-rose-400/20',
|
|
25
|
+
zinc: 'bg-zinc-600/10 text-zinc-700 group-data-hover:bg-zinc-600/20 dark:bg-white/5 dark:text-zinc-400 dark:group-data-hover:bg-white/10',
|
|
26
|
+
};
|
|
27
|
+
export function Badge({ color = 'zinc', className, ...props }) {
|
|
28
|
+
return (_jsx("span", { ...props, className: clsx(className, 'inline-flex items-center gap-x-1.5 rounded-md px-1.5 py-0.5 text-sm/5 font-medium sm:text-xs/5 forced-colors:outline', colors[color]) }));
|
|
29
|
+
}
|
|
30
|
+
export const BadgeButton = forwardRef(function BadgeButton({ color = 'zinc', className, children, ...props }, ref) {
|
|
31
|
+
const classes = clsx(className, 'group relative inline-flex rounded-md focus:not-data-focus:outline-hidden data-focus:outline-2 data-focus:outline-offset-2 data-focus:outline-blue-500');
|
|
32
|
+
return 'href' in props ? (_jsx(Link, { ...props, className: classes, ref: ref, children: _jsx(TouchTarget, { children: _jsx(Badge, { color: color, children: children }) }) })) : (_jsx(Headless.Button, { ...props, className: classes, ref: ref, children: _jsx(TouchTarget, { children: _jsx(Badge, { color: color, children: children }) }) }));
|
|
33
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import * as Headless from '@headlessui/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Link } from './link.js';
|
|
4
|
+
declare const styles: {
|
|
5
|
+
base: string[];
|
|
6
|
+
solid: string[];
|
|
7
|
+
outline: string[];
|
|
8
|
+
plain: string[];
|
|
9
|
+
colors: {
|
|
10
|
+
'dark/zinc': string[];
|
|
11
|
+
light: string[];
|
|
12
|
+
'dark/white': string[];
|
|
13
|
+
dark: string[];
|
|
14
|
+
white: string[];
|
|
15
|
+
zinc: string[];
|
|
16
|
+
indigo: string[];
|
|
17
|
+
cyan: string[];
|
|
18
|
+
red: string[];
|
|
19
|
+
orange: string[];
|
|
20
|
+
amber: string[];
|
|
21
|
+
yellow: string[];
|
|
22
|
+
lime: string[];
|
|
23
|
+
green: string[];
|
|
24
|
+
emerald: string[];
|
|
25
|
+
teal: string[];
|
|
26
|
+
sky: string[];
|
|
27
|
+
blue: string[];
|
|
28
|
+
violet: string[];
|
|
29
|
+
purple: string[];
|
|
30
|
+
fuchsia: string[];
|
|
31
|
+
pink: string[];
|
|
32
|
+
rose: string[];
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
type ButtonProps = ({
|
|
36
|
+
color?: keyof typeof styles.colors;
|
|
37
|
+
outline?: never;
|
|
38
|
+
plain?: never;
|
|
39
|
+
} | {
|
|
40
|
+
color?: never;
|
|
41
|
+
outline: true;
|
|
42
|
+
plain?: never;
|
|
43
|
+
} | {
|
|
44
|
+
color?: never;
|
|
45
|
+
outline?: never;
|
|
46
|
+
plain: true;
|
|
47
|
+
}) & {
|
|
48
|
+
className?: string;
|
|
49
|
+
children: React.ReactNode;
|
|
50
|
+
} & (Omit<Headless.ButtonProps, 'as' | 'className'> | Omit<React.ComponentPropsWithoutRef<typeof Link>, 'className'>);
|
|
51
|
+
export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLElement>>;
|
|
52
|
+
/**
|
|
53
|
+
* Expand the hit area to at least 44×44px on touch devices
|
|
54
|
+
*/
|
|
55
|
+
export declare function TouchTarget({ children }: {
|
|
56
|
+
children: React.ReactNode;
|
|
57
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
58
|
+
export {};
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, 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
|
+
import { Link } from './link.js';
|
|
6
|
+
const styles = {
|
|
7
|
+
base: [
|
|
8
|
+
// Base
|
|
9
|
+
'relative isolate inline-flex items-baseline justify-center gap-x-2 rounded-lg border text-base/6 font-semibold',
|
|
10
|
+
// Sizing
|
|
11
|
+
'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)] sm:text-sm/6',
|
|
12
|
+
// Focus
|
|
13
|
+
'focus:not-data-focus:outline-hidden data-focus:outline-2 data-focus:outline-offset-2 data-focus:outline-blue-500',
|
|
14
|
+
// Disabled
|
|
15
|
+
'data-disabled:opacity-50',
|
|
16
|
+
// Icon
|
|
17
|
+
'*:data-[slot=icon]:-mx-0.5 *:data-[slot=icon]:my-0.5 *:data-[slot=icon]:size-5 *:data-[slot=icon]:shrink-0 *:data-[slot=icon]:self-center *:data-[slot=icon]:text-(--btn-icon) sm:*:data-[slot=icon]:my-1 sm:*:data-[slot=icon]:size-4 forced-colors:[--btn-icon:ButtonText] forced-colors:data-hover:[--btn-icon:ButtonText]',
|
|
18
|
+
],
|
|
19
|
+
solid: [
|
|
20
|
+
// Optical border, implemented as the button background to avoid corner artifacts
|
|
21
|
+
'border-transparent bg-(--btn-border)',
|
|
22
|
+
// Dark mode: border is rendered on `after` so background is set to button background
|
|
23
|
+
'dark:bg-(--btn-bg)',
|
|
24
|
+
// Button background, implemented as foreground layer to stack on top of pseudo-border layer
|
|
25
|
+
'before:absolute before:inset-0 before:-z-10 before:rounded-[calc(var(--radius-lg)-1px)] before:bg-(--btn-bg)',
|
|
26
|
+
// Drop shadow, applied to the inset `before` layer so it blends with the border
|
|
27
|
+
'before:shadow-sm',
|
|
28
|
+
// Background color is moved to control and shadow is removed in dark mode so hide `before` pseudo
|
|
29
|
+
'dark:before:hidden',
|
|
30
|
+
// Dark mode: Subtle white outline is applied using a border
|
|
31
|
+
'dark:border-white/5',
|
|
32
|
+
// Shim/overlay, inset to match button foreground and used for hover state + highlight shadow
|
|
33
|
+
'after:absolute after:inset-0 after:-z-10 after:rounded-[calc(var(--radius-lg)-1px)]',
|
|
34
|
+
// Inner highlight shadow
|
|
35
|
+
'after:shadow-[inset_0_1px_--theme(--color-white/15%)]',
|
|
36
|
+
// White overlay on hover
|
|
37
|
+
'data-active:after:bg-(--btn-hover-overlay) data-hover:after:bg-(--btn-hover-overlay)',
|
|
38
|
+
// Dark mode: `after` layer expands to cover entire button
|
|
39
|
+
'dark:after:-inset-px dark:after:rounded-lg',
|
|
40
|
+
// Disabled
|
|
41
|
+
'data-disabled:before:shadow-none data-disabled:after:shadow-none',
|
|
42
|
+
],
|
|
43
|
+
outline: [
|
|
44
|
+
// Base
|
|
45
|
+
'border-zinc-950/10 text-zinc-950 data-active:bg-zinc-950/2.5 data-hover:bg-zinc-950/2.5',
|
|
46
|
+
// Dark mode
|
|
47
|
+
'dark:border-white/15 dark:text-white dark:[--btn-bg:transparent] dark:data-active:bg-white/5 dark:data-hover:bg-white/5',
|
|
48
|
+
// Icon
|
|
49
|
+
'[--btn-icon:var(--color-zinc-500)] data-active:[--btn-icon:var(--color-zinc-700)] data-hover:[--btn-icon:var(--color-zinc-700)] dark:data-active:[--btn-icon:var(--color-zinc-400)] dark:data-hover:[--btn-icon:var(--color-zinc-400)]',
|
|
50
|
+
],
|
|
51
|
+
plain: [
|
|
52
|
+
// Base
|
|
53
|
+
'border-transparent text-zinc-950 data-active:bg-zinc-950/5 data-hover:bg-zinc-950/5',
|
|
54
|
+
// Dark mode
|
|
55
|
+
'dark:text-white dark:data-active:bg-white/10 dark:data-hover:bg-white/10',
|
|
56
|
+
// Icon
|
|
57
|
+
'[--btn-icon:var(--color-zinc-500)] data-active:[--btn-icon:var(--color-zinc-700)] data-hover:[--btn-icon:var(--color-zinc-700)] dark:[--btn-icon:var(--color-zinc-500)] dark:data-active:[--btn-icon:var(--color-zinc-400)] dark:data-hover:[--btn-icon:var(--color-zinc-400)]',
|
|
58
|
+
],
|
|
59
|
+
colors: {
|
|
60
|
+
'dark/zinc': [
|
|
61
|
+
'text-white [--btn-bg:var(--color-zinc-900)] [--btn-border:var(--color-zinc-950)]/90 [--btn-hover-overlay:var(--color-white)]/10',
|
|
62
|
+
'dark:text-white dark:[--btn-bg:var(--color-zinc-600)] dark:[--btn-hover-overlay:var(--color-white)]/5',
|
|
63
|
+
'[--btn-icon:var(--color-zinc-400)] data-active:[--btn-icon:var(--color-zinc-300)] data-hover:[--btn-icon:var(--color-zinc-300)]',
|
|
64
|
+
],
|
|
65
|
+
light: [
|
|
66
|
+
'text-zinc-950 [--btn-bg:white] [--btn-border:var(--color-zinc-950)]/10 [--btn-hover-overlay:var(--color-zinc-950)]/2.5 data-active:[--btn-border:var(--color-zinc-950)]/15 data-hover:[--btn-border:var(--color-zinc-950)]/15',
|
|
67
|
+
'dark:text-white dark:[--btn-hover-overlay:var(--color-white)]/5 dark:[--btn-bg:var(--color-zinc-800)]',
|
|
68
|
+
'[--btn-icon:var(--color-zinc-500)] data-active:[--btn-icon:var(--color-zinc-700)] data-hover:[--btn-icon:var(--color-zinc-700)] dark:[--btn-icon:var(--color-zinc-500)] dark:data-active:[--btn-icon:var(--color-zinc-400)] dark:data-hover:[--btn-icon:var(--color-zinc-400)]',
|
|
69
|
+
],
|
|
70
|
+
'dark/white': [
|
|
71
|
+
'text-white [--btn-bg:var(--color-zinc-900)] [--btn-border:var(--color-zinc-950)]/90 [--btn-hover-overlay:var(--color-white)]/10',
|
|
72
|
+
'dark:text-zinc-950 dark:[--btn-bg:white] dark:[--btn-hover-overlay:var(--color-zinc-950)]/5',
|
|
73
|
+
'[--btn-icon:var(--color-zinc-400)] data-active:[--btn-icon:var(--color-zinc-300)] data-hover:[--btn-icon:var(--color-zinc-300)] dark:[--btn-icon:var(--color-zinc-500)] dark:data-active:[--btn-icon:var(--color-zinc-400)] dark:data-hover:[--btn-icon:var(--color-zinc-400)]',
|
|
74
|
+
],
|
|
75
|
+
dark: [
|
|
76
|
+
'text-white [--btn-bg:var(--color-zinc-900)] [--btn-border:var(--color-zinc-950)]/90 [--btn-hover-overlay:var(--color-white)]/10',
|
|
77
|
+
'dark:[--btn-hover-overlay:var(--color-white)]/5 dark:[--btn-bg:var(--color-zinc-800)]',
|
|
78
|
+
'[--btn-icon:var(--color-zinc-400)] data-active:[--btn-icon:var(--color-zinc-300)] data-hover:[--btn-icon:var(--color-zinc-300)]',
|
|
79
|
+
],
|
|
80
|
+
white: [
|
|
81
|
+
'text-zinc-950 [--btn-bg:white] [--btn-border:var(--color-zinc-950)]/10 [--btn-hover-overlay:var(--color-zinc-950)]/2.5 data-active:[--btn-border:var(--color-zinc-950)]/15 data-hover:[--btn-border:var(--color-zinc-950)]/15',
|
|
82
|
+
'dark:[--btn-hover-overlay:var(--color-zinc-950)]/5',
|
|
83
|
+
'[--btn-icon:var(--color-zinc-400)] data-active:[--btn-icon:var(--color-zinc-500)] data-hover:[--btn-icon:var(--color-zinc-500)]',
|
|
84
|
+
],
|
|
85
|
+
zinc: [
|
|
86
|
+
'text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-zinc-600)] [--btn-border:var(--color-zinc-700)]/90',
|
|
87
|
+
'dark:[--btn-hover-overlay:var(--color-white)]/5',
|
|
88
|
+
'[--btn-icon:var(--color-zinc-400)] data-active:[--btn-icon:var(--color-zinc-300)] data-hover:[--btn-icon:var(--color-zinc-300)]',
|
|
89
|
+
],
|
|
90
|
+
indigo: [
|
|
91
|
+
'text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-indigo-500)] [--btn-border:var(--color-indigo-600)]/90',
|
|
92
|
+
'[--btn-icon:var(--color-indigo-300)] data-active:[--btn-icon:var(--color-indigo-200)] data-hover:[--btn-icon:var(--color-indigo-200)]',
|
|
93
|
+
],
|
|
94
|
+
cyan: [
|
|
95
|
+
'text-cyan-950 [--btn-bg:var(--color-cyan-300)] [--btn-border:var(--color-cyan-400)]/80 [--btn-hover-overlay:var(--color-white)]/25',
|
|
96
|
+
'[--btn-icon:var(--color-cyan-500)]',
|
|
97
|
+
],
|
|
98
|
+
red: [
|
|
99
|
+
'text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-red-600)] [--btn-border:var(--color-red-700)]/90',
|
|
100
|
+
'[--btn-icon:var(--color-red-300)] data-active:[--btn-icon:var(--color-red-200)] data-hover:[--btn-icon:var(--color-red-200)]',
|
|
101
|
+
],
|
|
102
|
+
orange: [
|
|
103
|
+
'text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-orange-500)] [--btn-border:var(--color-orange-600)]/90',
|
|
104
|
+
'[--btn-icon:var(--color-orange-300)] data-active:[--btn-icon:var(--color-orange-200)] data-hover:[--btn-icon:var(--color-orange-200)]',
|
|
105
|
+
],
|
|
106
|
+
amber: [
|
|
107
|
+
'text-amber-950 [--btn-hover-overlay:var(--color-white)]/25 [--btn-bg:var(--color-amber-400)] [--btn-border:var(--color-amber-500)]/80',
|
|
108
|
+
'[--btn-icon:var(--color-amber-600)]',
|
|
109
|
+
],
|
|
110
|
+
yellow: [
|
|
111
|
+
'text-yellow-950 [--btn-hover-overlay:var(--color-white)]/25 [--btn-bg:var(--color-yellow-300)] [--btn-border:var(--color-yellow-400)]/80',
|
|
112
|
+
'[--btn-icon:var(--color-yellow-600)] data-active:[--btn-icon:var(--color-yellow-700)] data-hover:[--btn-icon:var(--color-yellow-700)]',
|
|
113
|
+
],
|
|
114
|
+
lime: [
|
|
115
|
+
'text-lime-950 [--btn-hover-overlay:var(--color-white)]/25 [--btn-bg:var(--color-lime-300)] [--btn-border:var(--color-lime-400)]/80',
|
|
116
|
+
'[--btn-icon:var(--color-lime-600)] data-active:[--btn-icon:var(--color-lime-700)] data-hover:[--btn-icon:var(--color-lime-700)]',
|
|
117
|
+
],
|
|
118
|
+
green: [
|
|
119
|
+
'text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-green-600)] [--btn-border:var(--color-green-700)]/90',
|
|
120
|
+
'[--btn-icon:var(--color-white)]/60 data-active:[--btn-icon:var(--color-white)]/80 data-hover:[--btn-icon:var(--color-white)]/80',
|
|
121
|
+
],
|
|
122
|
+
emerald: [
|
|
123
|
+
'text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-emerald-600)] [--btn-border:var(--color-emerald-700)]/90',
|
|
124
|
+
'[--btn-icon:var(--color-white)]/60 data-active:[--btn-icon:var(--color-white)]/80 data-hover:[--btn-icon:var(--color-white)]/80',
|
|
125
|
+
],
|
|
126
|
+
teal: [
|
|
127
|
+
'text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-teal-600)] [--btn-border:var(--color-teal-700)]/90',
|
|
128
|
+
'[--btn-icon:var(--color-white)]/60 data-active:[--btn-icon:var(--color-white)]/80 data-hover:[--btn-icon:var(--color-white)]/80',
|
|
129
|
+
],
|
|
130
|
+
sky: [
|
|
131
|
+
'text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-sky-500)] [--btn-border:var(--color-sky-600)]/80',
|
|
132
|
+
'[--btn-icon:var(--color-white)]/60 data-active:[--btn-icon:var(--color-white)]/80 data-hover:[--btn-icon:var(--color-white)]/80',
|
|
133
|
+
],
|
|
134
|
+
blue: [
|
|
135
|
+
'text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-blue-600)] [--btn-border:var(--color-blue-700)]/90',
|
|
136
|
+
'[--btn-icon:var(--color-blue-400)] data-active:[--btn-icon:var(--color-blue-300)] data-hover:[--btn-icon:var(--color-blue-300)]',
|
|
137
|
+
],
|
|
138
|
+
violet: [
|
|
139
|
+
'text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-violet-500)] [--btn-border:var(--color-violet-600)]/90',
|
|
140
|
+
'[--btn-icon:var(--color-violet-300)] data-active:[--btn-icon:var(--color-violet-200)] data-hover:[--btn-icon:var(--color-violet-200)]',
|
|
141
|
+
],
|
|
142
|
+
purple: [
|
|
143
|
+
'text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-purple-500)] [--btn-border:var(--color-purple-600)]/90',
|
|
144
|
+
'[--btn-icon:var(--color-purple-300)] data-active:[--btn-icon:var(--color-purple-200)] data-hover:[--btn-icon:var(--color-purple-200)]',
|
|
145
|
+
],
|
|
146
|
+
fuchsia: [
|
|
147
|
+
'text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-fuchsia-500)] [--btn-border:var(--color-fuchsia-600)]/90',
|
|
148
|
+
'[--btn-icon:var(--color-fuchsia-300)] data-active:[--btn-icon:var(--color-fuchsia-200)] data-hover:[--btn-icon:var(--color-fuchsia-200)]',
|
|
149
|
+
],
|
|
150
|
+
pink: [
|
|
151
|
+
'text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-pink-500)] [--btn-border:var(--color-pink-600)]/90',
|
|
152
|
+
'[--btn-icon:var(--color-pink-300)] data-active:[--btn-icon:var(--color-pink-200)] data-hover:[--btn-icon:var(--color-pink-200)]',
|
|
153
|
+
],
|
|
154
|
+
rose: [
|
|
155
|
+
'text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-rose-500)] [--btn-border:var(--color-rose-600)]/90',
|
|
156
|
+
'[--btn-icon:var(--color-rose-300)] data-active:[--btn-icon:var(--color-rose-200)] data-hover:[--btn-icon:var(--color-rose-200)]',
|
|
157
|
+
],
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
export const Button = forwardRef(function Button({ color, outline, plain, className, children, ...props }, ref) {
|
|
161
|
+
const classes = clsx(className, styles.base, outline ? styles.outline : plain ? styles.plain : clsx(styles.solid, styles.colors[color ?? 'dark/zinc']));
|
|
162
|
+
return 'href' in props ? (_jsx(Link, { ...props, className: classes, ref: ref, children: _jsx(TouchTarget, { children: children }) })) : (_jsx(Headless.Button, { ...props, className: clsx(classes, 'cursor-default'), ref: ref, children: _jsx(TouchTarget, { children: children }) }));
|
|
163
|
+
});
|
|
164
|
+
/**
|
|
165
|
+
* Expand the hit area to at least 44×44px on touch devices
|
|
166
|
+
*/
|
|
167
|
+
export function TouchTarget({ children }) {
|
|
168
|
+
return (_jsxs(_Fragment, { children: [_jsx("span", { className: "absolute top-1/2 left-1/2 size-[max(100%,2.75rem)] -translate-x-1/2 -translate-y-1/2 pointer-fine:hidden", "aria-hidden": "true" }), children] }));
|
|
169
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as Headless from '@headlessui/react';
|
|
2
|
+
import type React from 'react';
|
|
3
|
+
export declare function CheckboxGroup({ className, ...props }: React.ComponentPropsWithoutRef<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare function CheckboxField({ 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
|
+
white: string;
|
|
11
|
+
dark: string;
|
|
12
|
+
zinc: 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 Checkbox({ color, className, ...props }: {
|
|
33
|
+
color?: Color;
|
|
34
|
+
className?: string;
|
|
35
|
+
} & Omit<Headless.CheckboxProps, 'as' | 'className'>): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
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
|
+
export function CheckboxGroup({ className, ...props }) {
|
|
5
|
+
return (_jsx("div", { "data-slot": "control", ...props, className: clsx(className,
|
|
6
|
+
// Basic groups
|
|
7
|
+
'space-y-3',
|
|
8
|
+
// With descriptions
|
|
9
|
+
'has-data-[slot=description]:space-y-6 has-data-[slot=description]:**:data-[slot=label]:font-medium') }));
|
|
10
|
+
}
|
|
11
|
+
export function CheckboxField({ 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.5 items-center justify-center rounded-[0.3125rem] sm:size-4',
|
|
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-[calc(0.3125rem-1px)] before:bg-white before:shadow-sm',
|
|
29
|
+
// Background color when checked
|
|
30
|
+
'group-data-checked:before:bg-(--checkbox-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-(--checkbox-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-(--checkbox-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-[calc(0.3125rem-1px)] after:shadow-[inset_0_1px_--theme(--color-white/15%)]',
|
|
40
|
+
'dark:after:-inset-px dark:after:hidden dark:after:rounded-[0.3125rem] dark:group-data-checked:after:block',
|
|
41
|
+
// Focus ring
|
|
42
|
+
'group-data-focus:outline-2 group-data-focus:outline-offset-2 group-data-focus:outline-blue-500',
|
|
43
|
+
// Disabled state
|
|
44
|
+
'group-data-disabled:opacity-50',
|
|
45
|
+
'group-data-disabled:border-zinc-950/25 group-data-disabled:bg-zinc-950/5 group-data-disabled:[--checkbox-check:var(--color-zinc-950)]/50 group-data-disabled:before:bg-transparent',
|
|
46
|
+
'dark:group-data-disabled:border-white/20 dark:group-data-disabled:bg-white/2.5 dark:group-data-disabled:[--checkbox-check:var(--color-white)]/50 dark:group-data-checked:group-data-disabled:after:hidden',
|
|
47
|
+
// Forced colors mode
|
|
48
|
+
'forced-colors:[--checkbox-check:HighlightText] forced-colors:[--checkbox-checked-bg:Highlight] forced-colors:group-data-disabled:[--checkbox-check:Highlight]',
|
|
49
|
+
'dark:forced-colors:[--checkbox-check:HighlightText] dark:forced-colors:[--checkbox-checked-bg:Highlight] dark:forced-colors:group-data-disabled:[--checkbox-check:Highlight]',
|
|
50
|
+
];
|
|
51
|
+
const colors = {
|
|
52
|
+
'dark/zinc': [
|
|
53
|
+
'[--checkbox-check:var(--color-white)] [--checkbox-checked-bg:var(--color-zinc-900)] [--checkbox-checked-border:var(--color-zinc-950)]/90',
|
|
54
|
+
'dark:[--checkbox-checked-bg:var(--color-zinc-600)]',
|
|
55
|
+
],
|
|
56
|
+
'dark/white': [
|
|
57
|
+
'[--checkbox-check:var(--color-white)] [--checkbox-checked-bg:var(--color-zinc-900)] [--checkbox-checked-border:var(--color-zinc-950)]/90',
|
|
58
|
+
'dark:[--checkbox-check:var(--color-zinc-900)] dark:[--checkbox-checked-bg:var(--color-white)] dark:[--checkbox-checked-border:var(--color-zinc-950)]/15',
|
|
59
|
+
],
|
|
60
|
+
white: '[--checkbox-check:var(--color-zinc-900)] [--checkbox-checked-bg:var(--color-white)] [--checkbox-checked-border:var(--color-zinc-950)]/15',
|
|
61
|
+
dark: '[--checkbox-check:var(--color-white)] [--checkbox-checked-bg:var(--color-zinc-900)] [--checkbox-checked-border:var(--color-zinc-950)]/90',
|
|
62
|
+
zinc: '[--checkbox-check:var(--color-white)] [--checkbox-checked-bg:var(--color-zinc-600)] [--checkbox-checked-border:var(--color-zinc-700)]/90',
|
|
63
|
+
red: '[--checkbox-check:var(--color-white)] [--checkbox-checked-bg:var(--color-red-600)] [--checkbox-checked-border:var(--color-red-700)]/90',
|
|
64
|
+
orange: '[--checkbox-check:var(--color-white)] [--checkbox-checked-bg:var(--color-orange-500)] [--checkbox-checked-border:var(--color-orange-600)]/90',
|
|
65
|
+
amber: '[--checkbox-check:var(--color-amber-950)] [--checkbox-checked-bg:var(--color-amber-400)] [--checkbox-checked-border:var(--color-amber-500)]/80',
|
|
66
|
+
yellow: '[--checkbox-check:var(--color-yellow-950)] [--checkbox-checked-bg:var(--color-yellow-300)] [--checkbox-checked-border:var(--color-yellow-400)]/80',
|
|
67
|
+
lime: '[--checkbox-check:var(--color-lime-950)] [--checkbox-checked-bg:var(--color-lime-300)] [--checkbox-checked-border:var(--color-lime-400)]/80',
|
|
68
|
+
green: '[--checkbox-check:var(--color-white)] [--checkbox-checked-bg:var(--color-green-600)] [--checkbox-checked-border:var(--color-green-700)]/90',
|
|
69
|
+
emerald: '[--checkbox-check:var(--color-white)] [--checkbox-checked-bg:var(--color-emerald-600)] [--checkbox-checked-border:var(--color-emerald-700)]/90',
|
|
70
|
+
teal: '[--checkbox-check:var(--color-white)] [--checkbox-checked-bg:var(--color-teal-600)] [--checkbox-checked-border:var(--color-teal-700)]/90',
|
|
71
|
+
cyan: '[--checkbox-check:var(--color-cyan-950)] [--checkbox-checked-bg:var(--color-cyan-300)] [--checkbox-checked-border:var(--color-cyan-400)]/80',
|
|
72
|
+
sky: '[--checkbox-check:var(--color-white)] [--checkbox-checked-bg:var(--color-sky-500)] [--checkbox-checked-border:var(--color-sky-600)]/80',
|
|
73
|
+
blue: '[--checkbox-check:var(--color-white)] [--checkbox-checked-bg:var(--color-blue-600)] [--checkbox-checked-border:var(--color-blue-700)]/90',
|
|
74
|
+
indigo: '[--checkbox-check:var(--color-white)] [--checkbox-checked-bg:var(--color-indigo-500)] [--checkbox-checked-border:var(--color-indigo-600)]/90',
|
|
75
|
+
violet: '[--checkbox-check:var(--color-white)] [--checkbox-checked-bg:var(--color-violet-500)] [--checkbox-checked-border:var(--color-violet-600)]/90',
|
|
76
|
+
purple: '[--checkbox-check:var(--color-white)] [--checkbox-checked-bg:var(--color-purple-500)] [--checkbox-checked-border:var(--color-purple-600)]/90',
|
|
77
|
+
fuchsia: '[--checkbox-check:var(--color-white)] [--checkbox-checked-bg:var(--color-fuchsia-500)] [--checkbox-checked-border:var(--color-fuchsia-600)]/90',
|
|
78
|
+
pink: '[--checkbox-check:var(--color-white)] [--checkbox-checked-bg:var(--color-pink-500)] [--checkbox-checked-border:var(--color-pink-600)]/90',
|
|
79
|
+
rose: '[--checkbox-check:var(--color-white)] [--checkbox-checked-bg:var(--color-rose-500)] [--checkbox-checked-border:var(--color-rose-600)]/90',
|
|
80
|
+
};
|
|
81
|
+
export function Checkbox({ color = 'dark/zinc', className, ...props }) {
|
|
82
|
+
return (_jsx(Headless.Checkbox, { "data-slot": "control", ...props, className: clsx(className, 'group inline-flex focus:outline-hidden'), children: _jsx("span", { className: clsx([base, colors[color]]), children: _jsxs("svg", { className: "size-4 stroke-(--checkbox-check) opacity-0 group-data-checked:opacity-100 sm:h-3.5 sm:w-3.5", viewBox: "0 0 14 14", fill: "none", children: [_jsx("path", { className: "opacity-100 group-data-indeterminate:opacity-0", d: "M3 8L6 11L11 3.5", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { className: "opacity-0 group-data-indeterminate:opacity-100", d: "M3 7H11", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" })] }) }) }));
|
|
83
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as Headless from '@headlessui/react';
|
|
2
|
+
export declare function Combobox<T>({ options, displayValue, filter, anchor, className, placeholder, autoFocus, 'aria-label': ariaLabel, children, ...props }: {
|
|
3
|
+
options: T[];
|
|
4
|
+
displayValue: (value: T | null) => string | undefined;
|
|
5
|
+
filter?: (value: T, query: string) => boolean;
|
|
6
|
+
className?: string;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
autoFocus?: boolean;
|
|
9
|
+
'aria-label'?: string;
|
|
10
|
+
children: (value: NonNullable<T>) => React.ReactElement;
|
|
11
|
+
} & Omit<Headless.ComboboxProps<T, false>, 'as' | 'multiple' | 'children'> & {
|
|
12
|
+
anchor?: 'top' | 'bottom';
|
|
13
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare function ComboboxOption<T>({ children, className, ...props }: {
|
|
15
|
+
className?: string;
|
|
16
|
+
children?: React.ReactNode;
|
|
17
|
+
} & Omit<Headless.ComboboxOptionProps<'div', T>, 'as' | 'className'>): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare function ComboboxLabel({ className, ...props }: React.ComponentPropsWithoutRef<'span'>): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare function ComboboxDescription({ className, children, ...props }: React.ComponentPropsWithoutRef<'span'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,86 @@
|
|
|
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 { useState } from 'react';
|
|
6
|
+
export function Combobox({ options, displayValue, filter, anchor = 'bottom', className, placeholder, autoFocus, 'aria-label': ariaLabel, children, ...props }) {
|
|
7
|
+
const [query, setQuery] = useState('');
|
|
8
|
+
const filteredOptions = query === ''
|
|
9
|
+
? options
|
|
10
|
+
: options.filter((option) => filter ? filter(option, query) : displayValue(option)?.toLowerCase().includes(query.toLowerCase()));
|
|
11
|
+
return (_jsxs(Headless.Combobox, { ...props, multiple: false, virtual: { options: filteredOptions }, onClose: () => setQuery(''), children: [_jsxs("span", { "data-slot": "control", className: clsx([
|
|
12
|
+
className,
|
|
13
|
+
// Basic layout
|
|
14
|
+
'relative block w-full',
|
|
15
|
+
// Background color + shadow applied to inset pseudo element, so shadow blends with border in light mode
|
|
16
|
+
'before:absolute before:inset-px before:rounded-[calc(var(--radius-lg)-1px)] before:bg-white before:shadow-sm',
|
|
17
|
+
// Background color is moved to control and shadow is removed in dark mode so hide `before` pseudo
|
|
18
|
+
'dark:before:hidden',
|
|
19
|
+
// Focus ring
|
|
20
|
+
'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',
|
|
21
|
+
// Disabled state
|
|
22
|
+
'has-data-disabled:opacity-50 has-data-disabled:before:bg-zinc-950/5 has-data-disabled:before:shadow-none',
|
|
23
|
+
// Invalid state
|
|
24
|
+
'has-data-invalid:before:shadow-red-500/10',
|
|
25
|
+
]), children: [_jsx(Headless.ComboboxInput, { autoFocus: autoFocus, "data-slot": "control", "aria-label": ariaLabel, displayValue: (option) => displayValue(option) ?? '', onChange: (event) => setQuery(event.target.value), placeholder: placeholder, className: clsx([
|
|
26
|
+
className,
|
|
27
|
+
// Basic layout
|
|
28
|
+
'relative block w-full appearance-none rounded-lg py-[calc(--spacing(2.5)-1px)] sm:py-[calc(--spacing(1.5)-1px)]',
|
|
29
|
+
// Horizontal padding
|
|
30
|
+
'pr-[calc(--spacing(10)-1px)] pl-[calc(--spacing(3.5)-1px)] sm:pr-[calc(--spacing(9)-1px)] sm:pl-[calc(--spacing(3)-1px)]',
|
|
31
|
+
// Typography
|
|
32
|
+
'text-base/6 text-zinc-950 placeholder:text-zinc-500 sm:text-sm/6 dark:text-white',
|
|
33
|
+
// Border
|
|
34
|
+
'border border-zinc-950/10 data-hover:border-zinc-950/20 dark:border-white/10 dark:data-hover:border-white/20',
|
|
35
|
+
// Background color
|
|
36
|
+
'bg-transparent dark:bg-white/5',
|
|
37
|
+
// Hide default focus styles
|
|
38
|
+
'focus:outline-hidden',
|
|
39
|
+
// Invalid state
|
|
40
|
+
'data-invalid:border-red-500 data-invalid:data-hover:border-red-500 dark:data-invalid:border-red-500 dark:data-invalid:data-hover:border-red-500',
|
|
41
|
+
// Disabled state
|
|
42
|
+
'data-disabled:border-zinc-950/20 dark:data-disabled:border-white/15 dark:data-disabled:bg-white/2.5 dark:data-hover:data-disabled:border-white/15',
|
|
43
|
+
// System icons
|
|
44
|
+
'dark:scheme-dark',
|
|
45
|
+
]) }), _jsx(Headless.ComboboxButton, { className: "group absolute inset-y-0 right-0 flex items-center px-2", children: _jsxs("svg", { className: "size-5 stroke-zinc-500 group-data-disabled:stroke-zinc-600 group-data-hover:stroke-zinc-700 sm:size-4 dark:stroke-zinc-400 dark:group-data-hover:stroke-zinc-300 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" })] }) })] }), _jsx(Headless.ComboboxOptions, { transition: true, anchor: anchor, className: clsx(
|
|
46
|
+
// Anchor positioning
|
|
47
|
+
'[--anchor-gap:--spacing(2)] [--anchor-padding:--spacing(4)] sm:data-[anchor~=start]:[--anchor-offset:-4px]',
|
|
48
|
+
// Base styles,
|
|
49
|
+
'isolate min-w-[calc(var(--input-width)+8px)] scroll-py-1 rounded-xl p-1 select-none empty:invisible',
|
|
50
|
+
// Invisible border that is only visible in `forced-colors` mode for accessibility purposes
|
|
51
|
+
'outline outline-transparent focus:outline-hidden',
|
|
52
|
+
// Handle scrolling when menu won't fit in viewport
|
|
53
|
+
'overflow-y-scroll overscroll-contain',
|
|
54
|
+
// Popover background
|
|
55
|
+
'bg-white/75 backdrop-blur-xl dark:bg-zinc-800/75',
|
|
56
|
+
// Shadows
|
|
57
|
+
'shadow-lg ring-1 ring-zinc-950/10 dark:ring-white/10 dark:ring-inset',
|
|
58
|
+
// Transitions
|
|
59
|
+
'transition-opacity duration-100 ease-in data-closed:data-leave:opacity-0 data-transition:pointer-events-none'), children: ({ option }) => children(option) })] }));
|
|
60
|
+
}
|
|
61
|
+
export function ComboboxOption({ children, className, ...props }) {
|
|
62
|
+
const sharedClasses = clsx(
|
|
63
|
+
// Base
|
|
64
|
+
'flex min-w-0 items-center',
|
|
65
|
+
// Icons
|
|
66
|
+
'*:data-[slot=icon]:size-5 *:data-[slot=icon]:shrink-0 sm:*:data-[slot=icon]:size-4', '*:data-[slot=icon]:text-zinc-500 group-data-focus/option:*:data-[slot=icon]:text-white dark:*:data-[slot=icon]:text-zinc-400', 'forced-colors:*:data-[slot=icon]:text-[CanvasText] forced-colors:group-data-focus/option:*:data-[slot=icon]:text-[Canvas]',
|
|
67
|
+
// Avatars
|
|
68
|
+
'*:data-[slot=avatar]:-mx-0.5 *:data-[slot=avatar]:size-6 sm:*:data-[slot=avatar]:size-5');
|
|
69
|
+
return (_jsxs(Headless.ComboboxOption, { ...props, className: clsx(
|
|
70
|
+
// Basic layout
|
|
71
|
+
'group/option grid w-full cursor-default grid-cols-[1fr_--spacing(5)] items-baseline gap-x-2 rounded-lg py-2.5 pr-2 pl-3.5 sm:grid-cols-[1fr_--spacing(4)] sm:py-1.5 sm:pr-2 sm:pl-3',
|
|
72
|
+
// Typography
|
|
73
|
+
'text-base/6 text-zinc-950 sm:text-sm/6 dark:text-white forced-colors:text-[CanvasText]',
|
|
74
|
+
// Focus
|
|
75
|
+
'outline-hidden data-focus:bg-blue-500 data-focus:text-white',
|
|
76
|
+
// Forced colors mode
|
|
77
|
+
'forced-color-adjust-none forced-colors:data-focus:bg-[Highlight] forced-colors:data-focus:text-[HighlightText]',
|
|
78
|
+
// Disabled
|
|
79
|
+
'data-disabled:opacity-50'), children: [_jsx("span", { className: clsx(className, sharedClasses), children: children }), _jsx("svg", { className: "relative col-start-2 hidden size-5 self-center stroke-current group-data-selected/option:inline sm:size-4", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: _jsx("path", { d: "M4 8.5l3 3L12 4", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round" }) })] }));
|
|
80
|
+
}
|
|
81
|
+
export function ComboboxLabel({ className, ...props }) {
|
|
82
|
+
return _jsx("span", { ...props, className: clsx(className, 'ml-2.5 truncate first:ml-0 sm:ml-2 sm:first:ml-0') });
|
|
83
|
+
}
|
|
84
|
+
export function ComboboxDescription({ className, children, ...props }) {
|
|
85
|
+
return (_jsx("span", { ...props, className: clsx(className, 'flex flex-1 overflow-hidden text-zinc-500 group-data-focus/option:text-white before:w-2 before:min-w-0 before:shrink dark:text-zinc-400'), children: _jsx("span", { className: "flex-1 truncate", children: children }) }));
|
|
86
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare function DescriptionList({ className, ...props }: React.ComponentPropsWithoutRef<'dl'>): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function DescriptionTerm({ className, ...props }: React.ComponentPropsWithoutRef<'dt'>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function DescriptionDetails({ className, ...props }: React.ComponentPropsWithoutRef<'dd'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
export function DescriptionList({ className, ...props }) {
|
|
4
|
+
return (_jsx("dl", { ...props, className: clsx(className, 'grid grid-cols-1 text-base/6 sm:grid-cols-[min(50%,--spacing(80))_auto] sm:text-sm/6') }));
|
|
5
|
+
}
|
|
6
|
+
export function DescriptionTerm({ className, ...props }) {
|
|
7
|
+
return (_jsx("dt", { ...props, className: clsx(className, 'col-start-1 border-t border-zinc-950/5 pt-3 text-zinc-500 first:border-none sm:border-t sm:border-zinc-950/5 sm:py-3 dark:border-white/5 dark:text-zinc-400 sm:dark:border-white/5') }));
|
|
8
|
+
}
|
|
9
|
+
export function DescriptionDetails({ className, ...props }) {
|
|
10
|
+
return (_jsx("dd", { ...props, className: clsx(className, 'pt-1 pb-3 text-zinc-950 sm:border-t sm:border-zinc-950/5 sm:py-3 sm:nth-2:border-none dark:text-white dark:sm:border-white/5') }));
|
|
11
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as Headless from '@headlessui/react';
|
|
2
|
+
import type React from 'react';
|
|
3
|
+
import { Text } from './text.js';
|
|
4
|
+
declare const sizes: {
|
|
5
|
+
xs: string;
|
|
6
|
+
sm: string;
|
|
7
|
+
md: string;
|
|
8
|
+
lg: string;
|
|
9
|
+
xl: string;
|
|
10
|
+
'2xl': string;
|
|
11
|
+
'3xl': string;
|
|
12
|
+
'4xl': string;
|
|
13
|
+
'5xl': string;
|
|
14
|
+
};
|
|
15
|
+
export declare function Dialog({ size, className, children, ...props }: {
|
|
16
|
+
size?: keyof typeof sizes;
|
|
17
|
+
className?: string;
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
} & Omit<Headless.DialogProps, 'as' | 'className'>): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export declare function DialogTitle({ className, ...props }: {
|
|
21
|
+
className?: string;
|
|
22
|
+
} & Omit<Headless.DialogTitleProps, 'as' | 'className'>): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export declare function DialogDescription({ className, ...props }: {
|
|
24
|
+
className?: string;
|
|
25
|
+
} & Omit<Headless.DescriptionProps<typeof Text>, 'as' | 'className'>): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export declare function DialogBody({ className, ...props }: React.ComponentPropsWithoutRef<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export declare function DialogActions({ className, ...props }: React.ComponentPropsWithoutRef<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
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 { Text } from './text.js';
|
|
5
|
+
const sizes = {
|
|
6
|
+
xs: 'sm:max-w-xs',
|
|
7
|
+
sm: 'sm:max-w-sm',
|
|
8
|
+
md: 'sm:max-w-md',
|
|
9
|
+
lg: 'sm:max-w-lg',
|
|
10
|
+
xl: 'sm:max-w-xl',
|
|
11
|
+
'2xl': 'sm:max-w-2xl',
|
|
12
|
+
'3xl': 'sm:max-w-3xl',
|
|
13
|
+
'4xl': 'sm:max-w-4xl',
|
|
14
|
+
'5xl': 'sm:max-w-5xl',
|
|
15
|
+
};
|
|
16
|
+
export function Dialog({ size = 'lg', className, children, ...props }) {
|
|
17
|
+
return (_jsxs(Headless.Dialog, { ...props, children: [_jsx(Headless.DialogBackdrop, { transition: true, className: "fixed inset-0 flex w-screen justify-center overflow-y-auto bg-zinc-950/25 px-2 py-2 transition duration-100 focus:outline-0 data-closed:opacity-0 data-enter:ease-out data-leave:ease-in sm:px-6 sm:py-8 lg:px-8 lg:py-16 dark:bg-zinc-950/50" }), _jsx("div", { className: "fixed inset-0 w-screen overflow-y-auto pt-6 sm:pt-0", children: _jsx("div", { className: "grid min-h-full grid-rows-[1fr_auto] justify-items-center sm:grid-rows-[1fr_auto_3fr] sm:p-4", children: _jsx(Headless.DialogPanel, { transition: true, className: clsx(className, sizes[size], 'row-start-2 w-full min-w-0 rounded-t-3xl bg-white p-(--gutter) shadow-lg ring-1 ring-zinc-950/10 [--gutter:--spacing(8)] sm:mb-auto sm:rounded-2xl dark:bg-zinc-900 dark:ring-white/10 forced-colors:outline', 'transition duration-100 will-change-transform data-closed:translate-y-12 data-closed:opacity-0 data-enter:ease-out data-leave:ease-in sm:data-closed:translate-y-0 sm:data-closed:data-enter:scale-95'), children: children }) }) })] }));
|
|
18
|
+
}
|
|
19
|
+
export function DialogTitle({ className, ...props }) {
|
|
20
|
+
return (_jsx(Headless.DialogTitle, { ...props, className: clsx(className, 'text-lg/6 font-semibold text-balance text-zinc-950 sm:text-base/6 dark:text-white') }));
|
|
21
|
+
}
|
|
22
|
+
export function DialogDescription({ className, ...props }) {
|
|
23
|
+
return _jsx(Headless.Description, { as: Text, ...props, className: clsx(className, 'mt-2 text-pretty') });
|
|
24
|
+
}
|
|
25
|
+
export function DialogBody({ className, ...props }) {
|
|
26
|
+
return _jsx("div", { ...props, className: clsx(className, 'mt-6') });
|
|
27
|
+
}
|
|
28
|
+
export function DialogActions({ className, ...props }) {
|
|
29
|
+
return (_jsx("div", { ...props, className: clsx(className, 'mt-8 flex flex-col-reverse items-center justify-end gap-3 *:w-full sm:flex-row sm:*:w-auto') }));
|
|
30
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
export function Divider({ soft = false, className, ...props }) {
|
|
4
|
+
return (_jsx("hr", { role: "presentation", ...props, className: clsx(className, 'w-full border-t', soft && 'border-zinc-950/5 dark:border-white/5', !soft && 'border-zinc-950/10 dark:border-white/10') }));
|
|
5
|
+
}
|