@taicode/common-web 1.0.4 → 1.0.5
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/output/catalyst/alert.d.ts +29 -0
- package/output/catalyst/alert.d.ts.map +1 -0
- package/output/catalyst/alert.jsx +55 -0
- package/output/catalyst/auth-layout.d.ts +5 -0
- package/output/catalyst/auth-layout.d.ts.map +1 -0
- package/output/catalyst/auth-layout.jsx +7 -0
- package/output/catalyst/avatar.d.ts +15 -0
- package/output/catalyst/avatar.d.ts.map +1 -0
- package/output/catalyst/avatar.jsx +45 -0
- package/output/catalyst/badge.d.ts +34 -0
- package/output/catalyst/badge.d.ts.map +1 -0
- package/output/catalyst/badge.jsx +53 -0
- package/output/catalyst/button.d.ts +59 -0
- package/output/catalyst/button.d.ts.map +1 -0
- package/output/catalyst/button.jsx +187 -0
- package/output/catalyst/checkbox.d.ts +37 -0
- package/output/catalyst/checkbox.d.ts.map +1 -0
- package/output/catalyst/checkbox.jsx +105 -0
- package/output/catalyst/combobox.d.ts +20 -0
- package/output/catalyst/combobox.d.ts.map +1 -0
- package/output/catalyst/combobox.jsx +120 -0
- package/output/catalyst/description-list.d.ts +4 -0
- package/output/catalyst/description-list.d.ts.map +1 -0
- package/output/catalyst/description-list.jsx +24 -0
- package/output/catalyst/dialog.d.ts +29 -0
- package/output/catalyst/dialog.d.ts.map +1 -0
- package/output/catalyst/dialog.jsx +55 -0
- package/output/catalyst/divider.d.ts +4 -0
- package/output/catalyst/divider.d.ts.map +1 -0
- package/output/catalyst/divider.jsx +16 -0
- package/output/catalyst/dropdown.d.ts +33 -0
- package/output/catalyst/dropdown.d.ts.map +1 -0
- package/output/catalyst/dropdown.jsx +102 -0
- package/output/catalyst/fieldset.d.ts +22 -0
- package/output/catalyst/fieldset.d.ts.map +1 -0
- package/output/catalyst/fieldset.jsx +41 -0
- package/output/catalyst/heading.d.ts +7 -0
- package/output/catalyst/heading.d.ts.map +1 -0
- package/output/catalyst/heading.jsx +22 -0
- package/output/catalyst/input.d.ts +11 -0
- package/output/catalyst/input.d.ts.map +1 -0
- package/output/catalyst/input.jsx +73 -0
- package/output/catalyst/link.d.ts +12 -0
- package/output/catalyst/link.d.ts.map +1 -0
- package/output/catalyst/link.jsx +14 -0
- package/output/catalyst/listbox.d.ts +16 -0
- package/output/catalyst/listbox.d.ts.map +1 -0
- package/output/catalyst/listbox.jsx +120 -0
- package/output/catalyst/navbar.d.ts +15 -0
- package/output/catalyst/navbar.d.ts.map +1 -0
- package/output/catalyst/navbar.jsx +67 -0
- package/output/catalyst/pagination.d.ts +18 -0
- package/output/catalyst/pagination.d.ts.map +1 -0
- package/output/catalyst/pagination.jsx +52 -0
- package/output/catalyst/radio.d.ts +38 -0
- package/output/catalyst/radio.d.ts.map +1 -0
- package/output/catalyst/radio.jsx +103 -0
- package/output/catalyst/select.d.ts +6 -0
- package/output/catalyst/select.d.ts.map +1 -0
- package/output/catalyst/select.jsx +59 -0
- package/output/catalyst/sidebar-layout.d.ts +6 -0
- package/output/catalyst/sidebar-layout.d.ts.map +1 -0
- package/output/catalyst/sidebar-layout.jsx +58 -0
- package/output/catalyst/sidebar.d.ts +19 -0
- package/output/catalyst/sidebar.d.ts.map +1 -0
- package/output/catalyst/sidebar.jsx +85 -0
- package/output/catalyst/stacked-layout.d.ts +6 -0
- package/output/catalyst/stacked-layout.d.ts.map +1 -0
- package/output/catalyst/stacked-layout.jsx +55 -0
- package/output/catalyst/switch.d.ts +37 -0
- package/output/catalyst/switch.d.ts.map +1 -0
- package/output/catalyst/switch.jsx +161 -0
- package/output/catalyst/table.d.ts +17 -0
- package/output/catalyst/table.d.ts.map +1 -0
- package/output/catalyst/table.jsx +68 -0
- package/output/catalyst/text.d.ts +6 -0
- package/output/catalyst/text.d.ts.map +1 -0
- package/output/catalyst/text.jsx +29 -0
- package/output/catalyst/textarea.d.ts +7 -0
- package/output/catalyst/textarea.d.ts.map +1 -0
- package/output/catalyst/textarea.jsx +49 -0
- package/output/hooks/mobx.d.ts +3 -0
- package/output/hooks/mobx.d.ts.map +1 -0
- package/output/hooks/mobx.js +16 -0
- package/output/utils/cache/aside.d.ts +7 -0
- package/output/utils/cache/aside.d.ts.map +1 -0
- package/output/utils/cache/aside.js +106 -0
- package/output/utils/cache/index.d.ts +2 -0
- package/output/utils/cache/index.d.ts.map +1 -0
- package/output/utils/cache/index.js +1 -0
- package/package.json +7 -3
- package/tsconfig.json +0 -106
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as Headless from '@headlessui/react';
|
|
2
|
+
import type React from 'react';
|
|
3
|
+
import { Text } from './text';
|
|
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 Alert({ size, className, children, ...props }: {
|
|
16
|
+
size?: keyof typeof sizes;
|
|
17
|
+
className?: string;
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
} & Omit<Headless.DialogProps, 'as' | 'className'>): React.JSX.Element;
|
|
20
|
+
export declare function AlertTitle({ className, ...props }: {
|
|
21
|
+
className?: string;
|
|
22
|
+
} & Omit<Headless.DialogTitleProps, 'as' | 'className'>): React.JSX.Element;
|
|
23
|
+
export declare function AlertDescription({ className, ...props }: {
|
|
24
|
+
className?: string;
|
|
25
|
+
} & Omit<Headless.DescriptionProps<typeof Text>, 'as' | 'className'>): React.JSX.Element;
|
|
26
|
+
export declare function AlertBody({ className, ...props }: React.ComponentPropsWithoutRef<'div'>): React.JSX.Element;
|
|
27
|
+
export declare function AlertActions({ className, ...props }: React.ComponentPropsWithoutRef<'div'>): React.JSX.Element;
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=alert.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../../source/catalyst/alert.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAE7C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAE7B,QAAA,MAAM,KAAK;;;;;;;;;;CAUV,CAAA;AAED,wBAAgB,KAAK,CAAC,EACpB,IAAW,EACX,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,OAAO,KAAK,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,GAAG,IAAI,CACpF,QAAQ,CAAC,WAAW,EACpB,IAAI,GAAG,WAAW,CACnB,qBAyBA;AAED,wBAAgB,UAAU,CAAC,EACzB,SAAS,EACT,GAAG,KAAK,EACT,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,gBAAgB,EAAE,IAAI,GAAG,WAAW,CAAC,qBAU9E;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,SAAS,EACT,GAAG,KAAK,EACT,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,OAAO,IAAI,CAAC,EAAE,IAAI,GAAG,WAAW,CAAC,qBAQ3F;AAED,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,qBAEvF;AAED,wBAAgB,YAAY,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,qBAU1F"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import * as Headless from '@headlessui/react';
|
|
13
|
+
import clsx from 'clsx';
|
|
14
|
+
import { Text } from './text';
|
|
15
|
+
const sizes = {
|
|
16
|
+
xs: 'sm:max-w-xs',
|
|
17
|
+
sm: 'sm:max-w-sm',
|
|
18
|
+
md: 'sm:max-w-md',
|
|
19
|
+
lg: 'sm:max-w-lg',
|
|
20
|
+
xl: 'sm:max-w-xl',
|
|
21
|
+
'2xl': 'sm:max-w-2xl',
|
|
22
|
+
'3xl': 'sm:max-w-3xl',
|
|
23
|
+
'4xl': 'sm:max-w-4xl',
|
|
24
|
+
'5xl': 'sm:max-w-5xl',
|
|
25
|
+
};
|
|
26
|
+
export function Alert(_a) {
|
|
27
|
+
var { size = 'md', className, children } = _a, props = __rest(_a, ["size", "className", "children"]);
|
|
28
|
+
return (<Headless.Dialog {...props}>
|
|
29
|
+
<Headless.DialogBackdrop transition className="fixed inset-0 flex w-screen justify-center overflow-y-auto bg-zinc-950/15 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"/>
|
|
30
|
+
|
|
31
|
+
<div className="fixed inset-0 w-screen overflow-y-auto pt-6 sm:pt-0">
|
|
32
|
+
<div className="grid min-h-full grid-rows-[1fr_auto_1fr] justify-items-center p-8 sm:grid-rows-[1fr_auto_3fr] sm:p-4">
|
|
33
|
+
<Headless.DialogPanel transition className={clsx(className, sizes[size], 'row-start-2 w-full rounded-2xl bg-white p-8 shadow-lg ring-1 ring-zinc-950/10 sm:rounded-2xl sm:p-6 dark:bg-zinc-900 dark:ring-white/10 forced-colors:outline', 'transition duration-100 will-change-transform data-closed:opacity-0 data-enter:ease-out data-closed:data-enter:scale-95 data-leave:ease-in')}>
|
|
34
|
+
{children}
|
|
35
|
+
</Headless.DialogPanel>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</Headless.Dialog>);
|
|
39
|
+
}
|
|
40
|
+
export function AlertTitle(_a) {
|
|
41
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
42
|
+
return (<Headless.DialogTitle {...props} className={clsx(className, 'text-center text-base/6 font-semibold text-balance text-zinc-950 sm:text-left sm:text-sm/6 sm:text-wrap dark:text-white')}/>);
|
|
43
|
+
}
|
|
44
|
+
export function AlertDescription(_a) {
|
|
45
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
46
|
+
return (<Headless.Description as={Text} {...props} className={clsx(className, 'mt-2 text-center text-pretty sm:text-left')}/>);
|
|
47
|
+
}
|
|
48
|
+
export function AlertBody(_a) {
|
|
49
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
50
|
+
return <div {...props} className={clsx(className, 'mt-4')}/>;
|
|
51
|
+
}
|
|
52
|
+
export function AlertActions(_a) {
|
|
53
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
54
|
+
return (<div {...props} className={clsx(className, 'mt-6 flex flex-col-reverse items-center justify-end gap-3 *:w-full sm:mt-4 sm:flex-row sm:*:w-auto')}/>);
|
|
55
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-layout.d.ts","sourceRoot":"","sources":["../../source/catalyst/auth-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,qBAQrE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export function AuthLayout({ children }) {
|
|
2
|
+
return (<main className="flex min-h-dvh flex-col p-2">
|
|
3
|
+
<div className="flex grow items-center justify-center 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">
|
|
4
|
+
{children}
|
|
5
|
+
</div>
|
|
6
|
+
</main>);
|
|
7
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as Headless from '@headlessui/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
type AvatarProps = {
|
|
4
|
+
src?: string | null;
|
|
5
|
+
square?: boolean;
|
|
6
|
+
initials?: string;
|
|
7
|
+
alt?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function Avatar({ src, square, initials, alt, className, ...props }: AvatarProps & React.ComponentPropsWithoutRef<'span'>): React.JSX.Element;
|
|
11
|
+
export declare const AvatarButton: React.ForwardRefExoticComponent<(AvatarProps & (Omit<Headless.ButtonProps<"button">, "className" | "as"> | Omit<Omit<{
|
|
12
|
+
href: string;
|
|
13
|
+
} & Omit<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref"> & React.RefAttributes<HTMLAnchorElement>, "ref">, "className">)) & React.RefAttributes<HTMLElement>>;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=avatar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avatar.d.ts","sourceRoot":"","sources":["../../source/catalyst/avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAE7C,OAAO,KAAqB,MAAM,OAAO,CAAA;AAIzC,KAAK,WAAW,GAAG;IACjB,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,wBAAgB,MAAM,CAAC,EACrB,GAAU,EACV,MAAc,EACd,QAAQ,EACR,GAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,WAAW,GAAG,KAAK,CAAC,wBAAwB,CAAC,MAAM,CAAC,qBA6BtD;AAED,eAAO,MAAM,YAAY;;+MA+BvB,CAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import * as Headless from '@headlessui/react';
|
|
13
|
+
import clsx from 'clsx';
|
|
14
|
+
import React, { forwardRef } from 'react';
|
|
15
|
+
import { TouchTarget } from './button';
|
|
16
|
+
import { Link } from './link';
|
|
17
|
+
export function Avatar(_a) {
|
|
18
|
+
var { src = null, square = false, initials, alt = '', className } = _a, props = __rest(_a, ["src", "square", "initials", "alt", "className"]);
|
|
19
|
+
return (<span data-slot="avatar" {...props} className={clsx(className,
|
|
20
|
+
// Basic layout
|
|
21
|
+
'inline-grid shrink-0 align-middle [--avatar-radius:20%] *:col-start-1 *:row-start-1', 'outline -outline-offset-1 outline-black/10 dark:outline-white/10',
|
|
22
|
+
// Border radius
|
|
23
|
+
square ? 'rounded-(--avatar-radius) *:rounded-(--avatar-radius)' : 'rounded-full *:rounded-full')}>
|
|
24
|
+
{initials && (<svg className="size-full fill-current p-[5%] text-[48px] font-medium uppercase select-none" viewBox="0 0 100 100" aria-hidden={alt ? undefined : 'true'}>
|
|
25
|
+
{alt && <title>{alt}</title>}
|
|
26
|
+
<text x="50%" y="50%" alignmentBaseline="middle" dominantBaseline="middle" textAnchor="middle" dy=".125em">
|
|
27
|
+
{initials}
|
|
28
|
+
</text>
|
|
29
|
+
</svg>)}
|
|
30
|
+
{src && <img className="size-full" src={src} alt={alt}/>}
|
|
31
|
+
</span>);
|
|
32
|
+
}
|
|
33
|
+
export const AvatarButton = forwardRef(function AvatarButton(_a, ref) {
|
|
34
|
+
var { src, square = false, initials, alt, className } = _a, props = __rest(_a, ["src", "square", "initials", "alt", "className"]);
|
|
35
|
+
let classes = clsx(className, square ? 'rounded-[20%]' : 'rounded-full', 'relative inline-grid focus:not-data-focus:outline-hidden data-focus:outline-2 data-focus:outline-offset-2 data-focus:outline-blue-500');
|
|
36
|
+
return 'href' in props ? (<Link {...props} className={classes} ref={ref}>
|
|
37
|
+
<TouchTarget>
|
|
38
|
+
<Avatar src={src} square={square} initials={initials} alt={alt}/>
|
|
39
|
+
</TouchTarget>
|
|
40
|
+
</Link>) : (<Headless.Button {...props} className={classes} ref={ref}>
|
|
41
|
+
<TouchTarget>
|
|
42
|
+
<Avatar src={src} square={square} initials={initials} alt={alt}/>
|
|
43
|
+
</TouchTarget>
|
|
44
|
+
</Headless.Button>);
|
|
45
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
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'>): React.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 {};
|
|
34
|
+
//# sourceMappingURL=badge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../source/catalyst/badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAE7C,OAAO,KAAqB,MAAM,OAAO,CAAA;AAIzC,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;;CA4BX,CAAA;AAED,KAAK,UAAU,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,OAAO,MAAM,CAAA;CAAE,CAAA;AAEjD,wBAAgB,KAAK,CAAC,EAAE,KAAc,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,UAAU,GAAG,KAAK,CAAC,wBAAwB,CAAC,MAAM,CAAC,qBAWjH;AAED,eAAO,MAAM,WAAW;gBAMQ,MAAM;cAAY,KAAK,CAAC,SAAS;;;gNAwB/D,CAAA"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import * as Headless from '@headlessui/react';
|
|
13
|
+
import clsx from 'clsx';
|
|
14
|
+
import React, { forwardRef } from 'react';
|
|
15
|
+
import { TouchTarget } from './button';
|
|
16
|
+
import { Link } from './link';
|
|
17
|
+
const colors = {
|
|
18
|
+
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',
|
|
19
|
+
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',
|
|
20
|
+
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',
|
|
21
|
+
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',
|
|
22
|
+
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',
|
|
23
|
+
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',
|
|
24
|
+
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',
|
|
25
|
+
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',
|
|
26
|
+
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',
|
|
27
|
+
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',
|
|
28
|
+
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',
|
|
29
|
+
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',
|
|
30
|
+
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',
|
|
31
|
+
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',
|
|
32
|
+
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',
|
|
33
|
+
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',
|
|
34
|
+
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',
|
|
35
|
+
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',
|
|
36
|
+
};
|
|
37
|
+
export function Badge(_a) {
|
|
38
|
+
var { color = 'zinc', className } = _a, props = __rest(_a, ["color", "className"]);
|
|
39
|
+
return (<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])}/>);
|
|
40
|
+
}
|
|
41
|
+
export const BadgeButton = forwardRef(function BadgeButton(_a, ref) {
|
|
42
|
+
var { color = 'zinc', className, children } = _a, props = __rest(_a, ["color", "className", "children"]);
|
|
43
|
+
let 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');
|
|
44
|
+
return 'href' in props ? (<Link {...props} className={classes} ref={ref}>
|
|
45
|
+
<TouchTarget>
|
|
46
|
+
<Badge color={color}>{children}</Badge>
|
|
47
|
+
</TouchTarget>
|
|
48
|
+
</Link>) : (<Headless.Button {...props} className={classes} ref={ref}>
|
|
49
|
+
<TouchTarget>
|
|
50
|
+
<Badge color={color}>{children}</Badge>
|
|
51
|
+
</TouchTarget>
|
|
52
|
+
</Headless.Button>);
|
|
53
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as Headless from '@headlessui/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Link } from './link';
|
|
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
|
+
}): React.JSX.Element;
|
|
58
|
+
export {};
|
|
59
|
+
//# sourceMappingURL=button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../source/catalyst/button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAE7C,OAAO,KAAqB,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAE7B,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyJX,CAAA;AAED,KAAK,WAAW,GAAG,CACf;IAAE,KAAK,CAAC,EAAE,MAAM,OAAO,MAAM,CAAC,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,KAAK,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,GACtE;IAAE,KAAK,CAAC,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,IAAI,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,GAC/C;IAAE,KAAK,CAAC,EAAE,KAAK,CAAC;IAAC,OAAO,CAAC,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,IAAI,CAAA;CAAE,CAClD,GAAG;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,GAAG,CAClD,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,GAAG,WAAW,CAAC,GAC9C,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,OAAO,IAAI,CAAC,EAAE,WAAW,CAAC,CACjE,CAAA;AAEH,eAAO,MAAM,MAAM,iFAmBjB,CAAA;AAEF;;GAEG;AACH,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,qBAUtE"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import * as Headless from '@headlessui/react';
|
|
13
|
+
import clsx from 'clsx';
|
|
14
|
+
import React, { forwardRef } from 'react';
|
|
15
|
+
import { Link } from './link';
|
|
16
|
+
const styles = {
|
|
17
|
+
base: [
|
|
18
|
+
// Base
|
|
19
|
+
'relative isolate inline-flex items-baseline justify-center gap-x-2 rounded-lg border text-base/6 font-semibold',
|
|
20
|
+
// Sizing
|
|
21
|
+
'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',
|
|
22
|
+
// Focus
|
|
23
|
+
'focus:not-data-focus:outline-hidden data-focus:outline-2 data-focus:outline-offset-2 data-focus:outline-blue-500',
|
|
24
|
+
// Disabled
|
|
25
|
+
'data-disabled:opacity-50',
|
|
26
|
+
// Icon
|
|
27
|
+
'*: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]',
|
|
28
|
+
],
|
|
29
|
+
solid: [
|
|
30
|
+
// Optical border, implemented as the button background to avoid corner artifacts
|
|
31
|
+
'border-transparent bg-(--btn-border)',
|
|
32
|
+
// Dark mode: border is rendered on `after` so background is set to button background
|
|
33
|
+
'dark:bg-(--btn-bg)',
|
|
34
|
+
// Button background, implemented as foreground layer to stack on top of pseudo-border layer
|
|
35
|
+
'before:absolute before:inset-0 before:-z-10 before:rounded-[calc(var(--radius-lg)-1px)] before:bg-(--btn-bg)',
|
|
36
|
+
// Drop shadow, applied to the inset `before` layer so it blends with the border
|
|
37
|
+
'before:shadow-sm',
|
|
38
|
+
// Background color is moved to control and shadow is removed in dark mode so hide `before` pseudo
|
|
39
|
+
'dark:before:hidden',
|
|
40
|
+
// Dark mode: Subtle white outline is applied using a border
|
|
41
|
+
'dark:border-white/5',
|
|
42
|
+
// Shim/overlay, inset to match button foreground and used for hover state + highlight shadow
|
|
43
|
+
'after:absolute after:inset-0 after:-z-10 after:rounded-[calc(var(--radius-lg)-1px)]',
|
|
44
|
+
// Inner highlight shadow
|
|
45
|
+
'after:shadow-[inset_0_1px_--theme(--color-white/15%)]',
|
|
46
|
+
// White overlay on hover
|
|
47
|
+
'data-active:after:bg-(--btn-hover-overlay) data-hover:after:bg-(--btn-hover-overlay)',
|
|
48
|
+
// Dark mode: `after` layer expands to cover entire button
|
|
49
|
+
'dark:after:-inset-px dark:after:rounded-lg',
|
|
50
|
+
// Disabled
|
|
51
|
+
'data-disabled:before:shadow-none data-disabled:after:shadow-none',
|
|
52
|
+
],
|
|
53
|
+
outline: [
|
|
54
|
+
// Base
|
|
55
|
+
'border-zinc-950/10 text-zinc-950 data-active:bg-zinc-950/2.5 data-hover:bg-zinc-950/2.5',
|
|
56
|
+
// Dark mode
|
|
57
|
+
'dark:border-white/15 dark:text-white dark:[--btn-bg:transparent] dark:data-active:bg-white/5 dark:data-hover:bg-white/5',
|
|
58
|
+
// Icon
|
|
59
|
+
'[--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)]',
|
|
60
|
+
],
|
|
61
|
+
plain: [
|
|
62
|
+
// Base
|
|
63
|
+
'border-transparent text-zinc-950 data-active:bg-zinc-950/5 data-hover:bg-zinc-950/5',
|
|
64
|
+
// Dark mode
|
|
65
|
+
'dark:text-white dark:data-active:bg-white/10 dark:data-hover:bg-white/10',
|
|
66
|
+
// Icon
|
|
67
|
+
'[--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)]',
|
|
68
|
+
],
|
|
69
|
+
colors: {
|
|
70
|
+
'dark/zinc': [
|
|
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-white dark:[--btn-bg:var(--color-zinc-600)] dark:[--btn-hover-overlay:var(--color-white)]/5',
|
|
73
|
+
'[--btn-icon:var(--color-zinc-400)] data-active:[--btn-icon:var(--color-zinc-300)] data-hover:[--btn-icon:var(--color-zinc-300)]',
|
|
74
|
+
],
|
|
75
|
+
light: [
|
|
76
|
+
'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',
|
|
77
|
+
'dark:text-white dark:[--btn-hover-overlay:var(--color-white)]/5 dark:[--btn-bg:var(--color-zinc-800)]',
|
|
78
|
+
'[--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)]',
|
|
79
|
+
],
|
|
80
|
+
'dark/white': [
|
|
81
|
+
'text-white [--btn-bg:var(--color-zinc-900)] [--btn-border:var(--color-zinc-950)]/90 [--btn-hover-overlay:var(--color-white)]/10',
|
|
82
|
+
'dark:text-zinc-950 dark:[--btn-bg:white] dark:[--btn-hover-overlay:var(--color-zinc-950)]/5',
|
|
83
|
+
'[--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)]',
|
|
84
|
+
],
|
|
85
|
+
dark: [
|
|
86
|
+
'text-white [--btn-bg:var(--color-zinc-900)] [--btn-border:var(--color-zinc-950)]/90 [--btn-hover-overlay:var(--color-white)]/10',
|
|
87
|
+
'dark:[--btn-hover-overlay:var(--color-white)]/5 dark:[--btn-bg:var(--color-zinc-800)]',
|
|
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
|
+
white: [
|
|
91
|
+
'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',
|
|
92
|
+
'dark:[--btn-hover-overlay:var(--color-zinc-950)]/5',
|
|
93
|
+
'[--btn-icon:var(--color-zinc-400)] data-active:[--btn-icon:var(--color-zinc-500)] data-hover:[--btn-icon:var(--color-zinc-500)]',
|
|
94
|
+
],
|
|
95
|
+
zinc: [
|
|
96
|
+
'text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-zinc-600)] [--btn-border:var(--color-zinc-700)]/90',
|
|
97
|
+
'dark:[--btn-hover-overlay:var(--color-white)]/5',
|
|
98
|
+
'[--btn-icon:var(--color-zinc-400)] data-active:[--btn-icon:var(--color-zinc-300)] data-hover:[--btn-icon:var(--color-zinc-300)]',
|
|
99
|
+
],
|
|
100
|
+
indigo: [
|
|
101
|
+
'text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-indigo-500)] [--btn-border:var(--color-indigo-600)]/90',
|
|
102
|
+
'[--btn-icon:var(--color-indigo-300)] data-active:[--btn-icon:var(--color-indigo-200)] data-hover:[--btn-icon:var(--color-indigo-200)]',
|
|
103
|
+
],
|
|
104
|
+
cyan: [
|
|
105
|
+
'text-cyan-950 [--btn-bg:var(--color-cyan-300)] [--btn-border:var(--color-cyan-400)]/80 [--btn-hover-overlay:var(--color-white)]/25',
|
|
106
|
+
'[--btn-icon:var(--color-cyan-500)]',
|
|
107
|
+
],
|
|
108
|
+
red: [
|
|
109
|
+
'text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-red-600)] [--btn-border:var(--color-red-700)]/90',
|
|
110
|
+
'[--btn-icon:var(--color-red-300)] data-active:[--btn-icon:var(--color-red-200)] data-hover:[--btn-icon:var(--color-red-200)]',
|
|
111
|
+
],
|
|
112
|
+
orange: [
|
|
113
|
+
'text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-orange-500)] [--btn-border:var(--color-orange-600)]/90',
|
|
114
|
+
'[--btn-icon:var(--color-orange-300)] data-active:[--btn-icon:var(--color-orange-200)] data-hover:[--btn-icon:var(--color-orange-200)]',
|
|
115
|
+
],
|
|
116
|
+
amber: [
|
|
117
|
+
'text-amber-950 [--btn-hover-overlay:var(--color-white)]/25 [--btn-bg:var(--color-amber-400)] [--btn-border:var(--color-amber-500)]/80',
|
|
118
|
+
'[--btn-icon:var(--color-amber-600)]',
|
|
119
|
+
],
|
|
120
|
+
yellow: [
|
|
121
|
+
'text-yellow-950 [--btn-hover-overlay:var(--color-white)]/25 [--btn-bg:var(--color-yellow-300)] [--btn-border:var(--color-yellow-400)]/80',
|
|
122
|
+
'[--btn-icon:var(--color-yellow-600)] data-active:[--btn-icon:var(--color-yellow-700)] data-hover:[--btn-icon:var(--color-yellow-700)]',
|
|
123
|
+
],
|
|
124
|
+
lime: [
|
|
125
|
+
'text-lime-950 [--btn-hover-overlay:var(--color-white)]/25 [--btn-bg:var(--color-lime-300)] [--btn-border:var(--color-lime-400)]/80',
|
|
126
|
+
'[--btn-icon:var(--color-lime-600)] data-active:[--btn-icon:var(--color-lime-700)] data-hover:[--btn-icon:var(--color-lime-700)]',
|
|
127
|
+
],
|
|
128
|
+
green: [
|
|
129
|
+
'text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-green-600)] [--btn-border:var(--color-green-700)]/90',
|
|
130
|
+
'[--btn-icon:var(--color-white)]/60 data-active:[--btn-icon:var(--color-white)]/80 data-hover:[--btn-icon:var(--color-white)]/80',
|
|
131
|
+
],
|
|
132
|
+
emerald: [
|
|
133
|
+
'text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-emerald-600)] [--btn-border:var(--color-emerald-700)]/90',
|
|
134
|
+
'[--btn-icon:var(--color-white)]/60 data-active:[--btn-icon:var(--color-white)]/80 data-hover:[--btn-icon:var(--color-white)]/80',
|
|
135
|
+
],
|
|
136
|
+
teal: [
|
|
137
|
+
'text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-teal-600)] [--btn-border:var(--color-teal-700)]/90',
|
|
138
|
+
'[--btn-icon:var(--color-white)]/60 data-active:[--btn-icon:var(--color-white)]/80 data-hover:[--btn-icon:var(--color-white)]/80',
|
|
139
|
+
],
|
|
140
|
+
sky: [
|
|
141
|
+
'text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-sky-500)] [--btn-border:var(--color-sky-600)]/80',
|
|
142
|
+
'[--btn-icon:var(--color-white)]/60 data-active:[--btn-icon:var(--color-white)]/80 data-hover:[--btn-icon:var(--color-white)]/80',
|
|
143
|
+
],
|
|
144
|
+
blue: [
|
|
145
|
+
'text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-blue-600)] [--btn-border:var(--color-blue-700)]/90',
|
|
146
|
+
'[--btn-icon:var(--color-blue-400)] data-active:[--btn-icon:var(--color-blue-300)] data-hover:[--btn-icon:var(--color-blue-300)]',
|
|
147
|
+
],
|
|
148
|
+
violet: [
|
|
149
|
+
'text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-violet-500)] [--btn-border:var(--color-violet-600)]/90',
|
|
150
|
+
'[--btn-icon:var(--color-violet-300)] data-active:[--btn-icon:var(--color-violet-200)] data-hover:[--btn-icon:var(--color-violet-200)]',
|
|
151
|
+
],
|
|
152
|
+
purple: [
|
|
153
|
+
'text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-purple-500)] [--btn-border:var(--color-purple-600)]/90',
|
|
154
|
+
'[--btn-icon:var(--color-purple-300)] data-active:[--btn-icon:var(--color-purple-200)] data-hover:[--btn-icon:var(--color-purple-200)]',
|
|
155
|
+
],
|
|
156
|
+
fuchsia: [
|
|
157
|
+
'text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-fuchsia-500)] [--btn-border:var(--color-fuchsia-600)]/90',
|
|
158
|
+
'[--btn-icon:var(--color-fuchsia-300)] data-active:[--btn-icon:var(--color-fuchsia-200)] data-hover:[--btn-icon:var(--color-fuchsia-200)]',
|
|
159
|
+
],
|
|
160
|
+
pink: [
|
|
161
|
+
'text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-pink-500)] [--btn-border:var(--color-pink-600)]/90',
|
|
162
|
+
'[--btn-icon:var(--color-pink-300)] data-active:[--btn-icon:var(--color-pink-200)] data-hover:[--btn-icon:var(--color-pink-200)]',
|
|
163
|
+
],
|
|
164
|
+
rose: [
|
|
165
|
+
'text-white [--btn-hover-overlay:var(--color-white)]/10 [--btn-bg:var(--color-rose-500)] [--btn-border:var(--color-rose-600)]/90',
|
|
166
|
+
'[--btn-icon:var(--color-rose-300)] data-active:[--btn-icon:var(--color-rose-200)] data-hover:[--btn-icon:var(--color-rose-200)]',
|
|
167
|
+
],
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
export const Button = forwardRef(function Button(_a, ref) {
|
|
171
|
+
var { color, outline, plain, className, children } = _a, props = __rest(_a, ["color", "outline", "plain", "className", "children"]);
|
|
172
|
+
let classes = clsx(className, styles.base, outline ? styles.outline : plain ? styles.plain : clsx(styles.solid, styles.colors[color !== null && color !== void 0 ? color : 'dark/zinc']));
|
|
173
|
+
return 'href' in props ? (<Link {...props} className={classes} ref={ref}>
|
|
174
|
+
<TouchTarget>{children}</TouchTarget>
|
|
175
|
+
</Link>) : (<Headless.Button {...props} className={clsx(classes, 'cursor-default')} ref={ref}>
|
|
176
|
+
<TouchTarget>{children}</TouchTarget>
|
|
177
|
+
</Headless.Button>);
|
|
178
|
+
});
|
|
179
|
+
/**
|
|
180
|
+
* Expand the hit area to at least 44×44px on touch devices
|
|
181
|
+
*/
|
|
182
|
+
export function TouchTarget({ children }) {
|
|
183
|
+
return (<>
|
|
184
|
+
<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"/>
|
|
185
|
+
{children}
|
|
186
|
+
</>);
|
|
187
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as Headless from '@headlessui/react';
|
|
2
|
+
import type React from 'react';
|
|
3
|
+
export declare function CheckboxGroup({ className, ...props }: React.ComponentPropsWithoutRef<'div'>): React.JSX.Element;
|
|
4
|
+
export declare function CheckboxField({ className, ...props }: {
|
|
5
|
+
className?: string;
|
|
6
|
+
} & Omit<Headless.FieldProps, 'as' | 'className'>): React.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'>): React.JSX.Element;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=checkbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../source/catalyst/checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAE7C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,wBAAgB,aAAa,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,qBAc3F;AAED,wBAAgB,aAAa,CAAC,EAC5B,SAAS,EACT,GAAG,KAAK,EACT,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,IAAI,GAAG,WAAW,CAAC,qBAoBxE;AA8BD,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;CAuCX,CAAA;AAED,KAAK,KAAK,GAAG,MAAM,OAAO,MAAM,CAAA;AAEhC,wBAAgB,QAAQ,CAAC,EACvB,KAAmB,EACnB,SAAS,EACT,GAAG,KAAK,EACT,EAAE;IACD,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,GAAG,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE,IAAI,GAAG,WAAW,CAAC,qBAiCnD"}
|