@taicode/common-web 1.1.19 → 1.1.21
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.jsx +55 -0
- package/output/catalyst/auth-layout.jsx +7 -0
- package/output/catalyst/avatar.jsx +45 -0
- package/output/catalyst/badge.jsx +53 -0
- package/output/catalyst/button.d.ts +1 -1
- package/output/catalyst/button.d.ts.map +1 -1
- package/output/catalyst/button.jsx +187 -0
- package/output/catalyst/checkbox.jsx +105 -0
- package/output/catalyst/combobox.jsx +120 -0
- package/output/catalyst/description-list.jsx +24 -0
- package/output/catalyst/dialog.jsx +55 -0
- package/output/catalyst/divider.jsx +16 -0
- package/output/catalyst/dropdown.jsx +102 -0
- package/output/catalyst/fieldset.jsx +41 -0
- package/output/catalyst/heading.jsx +22 -0
- package/output/catalyst/input.jsx +73 -0
- package/output/catalyst/link.jsx +14 -0
- package/output/catalyst/listbox.jsx +120 -0
- package/output/catalyst/navbar.jsx +67 -0
- package/output/catalyst/pagination.jsx +52 -0
- package/output/catalyst/radio.jsx +103 -0
- package/output/catalyst/select.jsx +59 -0
- package/output/catalyst/sidebar-layout.jsx +58 -0
- package/output/catalyst/sidebar.jsx +85 -0
- package/output/catalyst/stacked-layout.jsx +55 -0
- package/output/catalyst/switch.jsx +161 -0
- package/output/catalyst/table.jsx +68 -0
- package/output/catalyst/text.jsx +29 -0
- package/output/catalyst/textarea.jsx +49 -0
- package/output/helpers/cache-api/cache-api.d.ts +13 -0
- package/output/helpers/cache-api/cache-api.d.ts.map +1 -0
- package/output/helpers/cache-api/cache-api.js +114 -0
- package/output/helpers/cache-api/cache-api.test.d.ts +2 -0
- package/output/helpers/cache-api/cache-api.test.d.ts.map +1 -0
- package/output/helpers/cache-api/cache-api.test.js +348 -0
- package/output/helpers/cache-api/index.d.ts +2 -0
- package/output/helpers/cache-api/index.d.ts.map +1 -0
- package/output/helpers/cache-api/index.js +1 -0
- package/output/helpers/service/index.d.ts +1 -0
- package/output/helpers/service/index.d.ts.map +1 -0
- package/output/helpers/service/index.js +1 -0
- package/output/helpers/service/service.d.ts +5 -0
- package/output/helpers/service/service.d.ts.map +1 -0
- package/output/helpers/service/service.js +2 -0
- package/output/helpers/side-cache/index.d.ts +2 -0
- package/output/helpers/side-cache/index.d.ts.map +1 -0
- package/output/helpers/side-cache/index.js +1 -0
- package/output/helpers/side-cache/side-cache.d.ts +10 -0
- package/output/helpers/side-cache/side-cache.d.ts.map +1 -0
- package/output/helpers/side-cache/side-cache.js +137 -0
- package/output/helpers/side-cache/side-cache.test.d.ts +2 -0
- package/output/helpers/side-cache/side-cache.test.d.ts.map +1 -0
- package/output/helpers/side-cache/side-cache.test.js +179 -0
- package/output/helpers/use-observer/index.d.ts +2 -0
- package/output/helpers/use-observer/index.d.ts.map +1 -0
- package/output/helpers/use-observer/index.js +1 -0
- package/output/helpers/use-observer/use-observer.d.ts +3 -0
- package/output/helpers/use-observer/use-observer.d.ts.map +1 -0
- package/output/helpers/use-observer/use-observer.js +16 -0
- package/output/helpers/use-observer/use-observer.test.d.ts +2 -0
- package/output/helpers/use-observer/use-observer.test.d.ts.map +1 -0
- package/output/helpers/use-observer/use-observer.test.jsx +134 -0
- package/output/loading-button/index.d.ts +26 -0
- package/output/loading-button/index.d.ts.map +1 -0
- package/output/loading-button/index.js +55 -0
- package/output/service/service.test.jsx +367 -0
- package/output/signin/index.d.ts +2 -2
- package/output/signin/index.d.ts.map +1 -1
- package/output/signin/index.js +1 -1
- package/output/signin/service.d.ts.map +1 -1
- package/output/signin/service.js +1 -2
- package/output/toaster/index.d.ts +1 -2
- package/output/toaster/index.d.ts.map +1 -1
- package/output/toaster/index.js +0 -6
- package/output/use-observer/use-observer.test.jsx +134 -0
- package/package.json +1 -1
|
@@ -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 Dialog(_a) {
|
|
27
|
+
var { size = 'lg', 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/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"/>
|
|
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] justify-items-center sm:grid-rows-[1fr_auto_3fr] sm:p-4">
|
|
33
|
+
<Headless.DialogPanel transition 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')}>
|
|
34
|
+
{children}
|
|
35
|
+
</Headless.DialogPanel>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</Headless.Dialog>);
|
|
39
|
+
}
|
|
40
|
+
export function DialogTitle(_a) {
|
|
41
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
42
|
+
return (<Headless.DialogTitle {...props} className={clsx(className, 'text-lg/6 font-semibold text-balance text-zinc-950 sm:text-base/6 dark:text-white')}/>);
|
|
43
|
+
}
|
|
44
|
+
export function DialogDescription(_a) {
|
|
45
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
46
|
+
return <Headless.Description as={Text} {...props} className={clsx(className, 'mt-2 text-pretty')}/>;
|
|
47
|
+
}
|
|
48
|
+
export function DialogBody(_a) {
|
|
49
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
50
|
+
return <div {...props} className={clsx(className, 'mt-6')}/>;
|
|
51
|
+
}
|
|
52
|
+
export function DialogActions(_a) {
|
|
53
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
54
|
+
return (<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')}/>);
|
|
55
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
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 clsx from 'clsx';
|
|
13
|
+
export function Divider(_a) {
|
|
14
|
+
var { soft = false, className } = _a, props = __rest(_a, ["soft", "className"]);
|
|
15
|
+
return (<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')}/>);
|
|
16
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import * as Headless from '@headlessui/react';
|
|
14
|
+
import clsx from 'clsx';
|
|
15
|
+
import { Button } from './button';
|
|
16
|
+
import { Link } from './link';
|
|
17
|
+
export function Dropdown(props) {
|
|
18
|
+
return <Headless.Menu {...props}/>;
|
|
19
|
+
}
|
|
20
|
+
export function DropdownButton(_a) {
|
|
21
|
+
var { as = Button } = _a, props = __rest(_a, ["as"]);
|
|
22
|
+
return <Headless.MenuButton as={as} {...props}/>;
|
|
23
|
+
}
|
|
24
|
+
export function DropdownMenu(_a) {
|
|
25
|
+
var { anchor = 'bottom', className } = _a, props = __rest(_a, ["anchor", "className"]);
|
|
26
|
+
return (<Headless.MenuItems {...props} transition anchor={anchor} className={clsx(className,
|
|
27
|
+
// Anchor positioning
|
|
28
|
+
'[--anchor-gap:--spacing(2)] [--anchor-padding:--spacing(1)] data-[anchor~=end]:[--anchor-offset:6px] data-[anchor~=start]:[--anchor-offset:-6px] sm:data-[anchor~=end]:[--anchor-offset:4px] sm:data-[anchor~=start]:[--anchor-offset:-4px]',
|
|
29
|
+
// Base styles
|
|
30
|
+
'isolate w-max rounded-xl p-1',
|
|
31
|
+
// Invisible border that is only visible in `forced-colors` mode for accessibility purposes
|
|
32
|
+
'outline outline-transparent focus:outline-hidden',
|
|
33
|
+
// Handle scrolling when menu won't fit in viewport
|
|
34
|
+
'overflow-y-auto',
|
|
35
|
+
// Popover background
|
|
36
|
+
'bg-white/75 backdrop-blur-xl dark:bg-zinc-800/75',
|
|
37
|
+
// Shadows
|
|
38
|
+
'shadow-lg ring-1 ring-zinc-950/10 dark:ring-white/10 dark:ring-inset',
|
|
39
|
+
// Define grid at the menu level if subgrid is supported
|
|
40
|
+
'supports-[grid-template-columns:subgrid]:grid supports-[grid-template-columns:subgrid]:grid-cols-[auto_1fr_1.5rem_0.5rem_auto]',
|
|
41
|
+
// Transitions
|
|
42
|
+
'transition data-leave:duration-100 data-leave:ease-in data-closed:data-leave:opacity-0')}/>);
|
|
43
|
+
}
|
|
44
|
+
export function DropdownItem(_a) {
|
|
45
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
46
|
+
let classes = clsx(className,
|
|
47
|
+
// Base styles
|
|
48
|
+
'group cursor-default rounded-lg px-3.5 py-2.5 focus:outline-hidden sm:px-3 sm:py-1.5',
|
|
49
|
+
// Text styles
|
|
50
|
+
'text-left text-base/6 text-zinc-950 sm:text-sm/6 dark:text-white forced-colors:text-[CanvasText]',
|
|
51
|
+
// Focus
|
|
52
|
+
'data-focus:bg-blue-500 data-focus:text-white',
|
|
53
|
+
// Disabled state
|
|
54
|
+
'data-disabled:opacity-50',
|
|
55
|
+
// Forced colors mode
|
|
56
|
+
'forced-color-adjust-none forced-colors:data-focus:bg-[Highlight] forced-colors:data-focus:text-[HighlightText] forced-colors:data-focus:*:data-[slot=icon]:text-[HighlightText]',
|
|
57
|
+
// Use subgrid when available but fallback to an explicit grid layout if not
|
|
58
|
+
'col-span-full grid grid-cols-[auto_1fr_1.5rem_0.5rem_auto] items-center supports-[grid-template-columns:subgrid]:grid-cols-subgrid',
|
|
59
|
+
// Icons
|
|
60
|
+
'*:data-[slot=icon]:col-start-1 *:data-[slot=icon]:row-start-1 *:data-[slot=icon]:mr-2.5 *:data-[slot=icon]:-ml-0.5 *:data-[slot=icon]:size-5 sm:*:data-[slot=icon]:mr-2 sm:*:data-[slot=icon]:size-4', '*:data-[slot=icon]:text-zinc-500 data-focus:*:data-[slot=icon]:text-white dark:*:data-[slot=icon]:text-zinc-400 dark:data-focus:*:data-[slot=icon]:text-white',
|
|
61
|
+
// Avatar
|
|
62
|
+
'*:data-[slot=avatar]:mr-2.5 *:data-[slot=avatar]:-ml-1 *:data-[slot=avatar]:size-6 sm:*:data-[slot=avatar]:mr-2 sm:*:data-[slot=avatar]:size-5');
|
|
63
|
+
return 'href' in props ? (<Headless.MenuItem as={Link} {...props} className={classes}/>) : (<Headless.MenuItem as="button" type="button" {...props} className={classes}/>);
|
|
64
|
+
}
|
|
65
|
+
export function DropdownHeader(_a) {
|
|
66
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
67
|
+
return <div {...props} className={clsx(className, 'col-span-5 px-3.5 pt-2.5 pb-1 sm:px-3')}/>;
|
|
68
|
+
}
|
|
69
|
+
export function DropdownSection(_a) {
|
|
70
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
71
|
+
return (<Headless.MenuSection {...props} className={clsx(className,
|
|
72
|
+
// Define grid at the section level instead of the item level if subgrid is supported
|
|
73
|
+
'col-span-full supports-[grid-template-columns:subgrid]:grid supports-[grid-template-columns:subgrid]:grid-cols-[auto_1fr_1.5rem_0.5rem_auto]')}/>);
|
|
74
|
+
}
|
|
75
|
+
export function DropdownHeading(_a) {
|
|
76
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
77
|
+
return (<Headless.MenuHeading {...props} className={clsx(className, 'col-span-full grid grid-cols-[1fr_auto] gap-x-12 px-3.5 pt-2 pb-1 text-sm/5 font-medium text-zinc-500 sm:px-3 sm:text-xs/5 dark:text-zinc-400')}/>);
|
|
78
|
+
}
|
|
79
|
+
export function DropdownDivider(_a) {
|
|
80
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
81
|
+
return (<Headless.MenuSeparator {...props} className={clsx(className, 'col-span-full mx-3.5 my-1 h-px border-0 bg-zinc-950/5 sm:mx-3 dark:bg-white/10 forced-colors:bg-[CanvasText]')}/>);
|
|
82
|
+
}
|
|
83
|
+
export function DropdownLabel(_a) {
|
|
84
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
85
|
+
return <div {...props} data-slot="label" className={clsx(className, 'col-start-2 row-start-1')} {...props}/>;
|
|
86
|
+
}
|
|
87
|
+
export function DropdownDescription(_a) {
|
|
88
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
89
|
+
return (<Headless.Description data-slot="description" {...props} className={clsx(className, 'col-span-2 col-start-2 row-start-2 text-sm/5 text-zinc-500 group-data-focus:text-white sm:text-xs/5 dark:text-zinc-400 forced-colors:group-data-focus:text-[HighlightText]')}/>);
|
|
90
|
+
}
|
|
91
|
+
export function DropdownShortcut(_a) {
|
|
92
|
+
var { keys, className } = _a, props = __rest(_a, ["keys", "className"]);
|
|
93
|
+
return (<Headless.Description as="kbd" {...props} className={clsx(className, 'col-start-5 row-start-1 flex justify-self-end')}>
|
|
94
|
+
{(Array.isArray(keys) ? keys : keys.split('')).map((char, index) => (<kbd key={index} className={clsx([
|
|
95
|
+
'min-w-[2ch] text-center font-sans text-zinc-400 capitalize group-data-focus:text-white forced-colors:group-data-focus:text-[HighlightText]',
|
|
96
|
+
// Make sure key names that are longer than one character (like "Tab") have extra space
|
|
97
|
+
index > 0 && char.length > 1 && 'pl-1',
|
|
98
|
+
])}>
|
|
99
|
+
{char}
|
|
100
|
+
</kbd>))}
|
|
101
|
+
</Headless.Description>);
|
|
102
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
export function Fieldset(_a) {
|
|
15
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
16
|
+
return (<Headless.Fieldset {...props} className={clsx(className, '*:data-[slot=text]:mt-1 [&>*+[data-slot=control]]:mt-6')}/>);
|
|
17
|
+
}
|
|
18
|
+
export function Legend(_a) {
|
|
19
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
20
|
+
return (<Headless.Legend data-slot="legend" {...props} className={clsx(className, 'text-base/6 font-semibold text-zinc-950 data-disabled:opacity-50 sm:text-sm/6 dark:text-white')}/>);
|
|
21
|
+
}
|
|
22
|
+
export function FieldGroup(_a) {
|
|
23
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
24
|
+
return <div data-slot="control" {...props} className={clsx(className, 'space-y-8')}/>;
|
|
25
|
+
}
|
|
26
|
+
export function Field(_a) {
|
|
27
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
28
|
+
return (<Headless.Field {...props} className={clsx(className, '[&>[data-slot=label]+[data-slot=control]]:mt-3', '[&>[data-slot=label]+[data-slot=description]]:mt-1', '[&>[data-slot=description]+[data-slot=control]]:mt-3', '[&>[data-slot=control]+[data-slot=description]]:mt-3', '[&>[data-slot=control]+[data-slot=error]]:mt-3', '*:data-[slot=label]:font-medium')}/>);
|
|
29
|
+
}
|
|
30
|
+
export function Label(_a) {
|
|
31
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
32
|
+
return (<Headless.Label data-slot="label" {...props} className={clsx(className, 'text-base/6 text-zinc-950 select-none data-disabled:opacity-50 sm:text-sm/6 dark:text-white')}/>);
|
|
33
|
+
}
|
|
34
|
+
export function Description(_a) {
|
|
35
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
36
|
+
return (<Headless.Description data-slot="description" {...props} className={clsx(className, 'text-base/6 text-zinc-500 data-disabled:opacity-50 sm:text-sm/6 dark:text-zinc-400')}/>);
|
|
37
|
+
}
|
|
38
|
+
export function ErrorMessage(_a) {
|
|
39
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
40
|
+
return (<Headless.Description data-slot="error" {...props} className={clsx(className, 'text-base/6 text-red-600 data-disabled:opacity-50 sm:text-sm/6 dark:text-red-500')}/>);
|
|
41
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
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 clsx from 'clsx';
|
|
13
|
+
export function Heading(_a) {
|
|
14
|
+
var { className, level = 1 } = _a, props = __rest(_a, ["className", "level"]);
|
|
15
|
+
let Element = `h${level}`;
|
|
16
|
+
return (<Element {...props} className={clsx(className, 'text-2xl/8 font-semibold text-zinc-950 sm:text-xl/8 dark:text-white')}/>);
|
|
17
|
+
}
|
|
18
|
+
export function Subheading(_a) {
|
|
19
|
+
var { className, level = 2 } = _a, props = __rest(_a, ["className", "level"]);
|
|
20
|
+
let Element = `h${level}`;
|
|
21
|
+
return (<Element {...props} className={clsx(className, 'text-base/7 font-semibold text-zinc-950 sm:text-sm/6 dark:text-white')}/>);
|
|
22
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
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
|
+
export function InputGroup({ children }) {
|
|
16
|
+
return (<span data-slot="control" className={clsx('relative isolate block', 'has-[[data-slot=icon]:first-child]:[&_input]:pl-10 has-[[data-slot=icon]:last-child]:[&_input]:pr-10 sm:has-[[data-slot=icon]:first-child]:[&_input]:pl-8 sm:has-[[data-slot=icon]:last-child]:[&_input]:pr-8', '*:data-[slot=icon]:pointer-events-none *:data-[slot=icon]:absolute *:data-[slot=icon]:top-3 *:data-[slot=icon]:z-10 *:data-[slot=icon]:size-5 sm:*:data-[slot=icon]:top-2.5 sm:*:data-[slot=icon]:size-4', '[&>[data-slot=icon]:first-child]:left-3 sm:[&>[data-slot=icon]:first-child]:left-2.5 [&>[data-slot=icon]:last-child]:right-3 sm:[&>[data-slot=icon]:last-child]:right-2.5', '*:data-[slot=icon]:text-zinc-500 dark:*:data-[slot=icon]:text-zinc-400')}>
|
|
17
|
+
{children}
|
|
18
|
+
</span>);
|
|
19
|
+
}
|
|
20
|
+
const dateTypes = ['date', 'datetime-local', 'month', 'time', 'week'];
|
|
21
|
+
export const Input = forwardRef(function Input(_a, ref) {
|
|
22
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
23
|
+
return (<span data-slot="control" className={clsx([
|
|
24
|
+
className,
|
|
25
|
+
// Basic layout
|
|
26
|
+
'relative block w-full',
|
|
27
|
+
// Background color + shadow applied to inset pseudo element, so shadow blends with border in light mode
|
|
28
|
+
'before:absolute before:inset-px before:rounded-[calc(var(--radius-lg)-1px)] before:bg-white before:shadow-sm',
|
|
29
|
+
// Background color is moved to control and shadow is removed in dark mode so hide `before` pseudo
|
|
30
|
+
'dark:before:hidden',
|
|
31
|
+
// Focus ring
|
|
32
|
+
'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',
|
|
33
|
+
// Disabled state
|
|
34
|
+
'has-data-disabled:opacity-50 has-data-disabled:before:bg-zinc-950/5 has-data-disabled:before:shadow-none',
|
|
35
|
+
// Invalid state
|
|
36
|
+
'has-data-invalid:before:shadow-red-500/10',
|
|
37
|
+
])}>
|
|
38
|
+
<Headless.Input ref={ref} {...props} className={clsx([
|
|
39
|
+
// Date classes
|
|
40
|
+
props.type &&
|
|
41
|
+
dateTypes.includes(props.type) && [
|
|
42
|
+
'[&::-webkit-datetime-edit-fields-wrapper]:p-0',
|
|
43
|
+
'[&::-webkit-date-and-time-value]:min-h-[1.5em]',
|
|
44
|
+
'[&::-webkit-datetime-edit]:inline-flex',
|
|
45
|
+
'[&::-webkit-datetime-edit]:p-0',
|
|
46
|
+
'[&::-webkit-datetime-edit-year-field]:p-0',
|
|
47
|
+
'[&::-webkit-datetime-edit-month-field]:p-0',
|
|
48
|
+
'[&::-webkit-datetime-edit-day-field]:p-0',
|
|
49
|
+
'[&::-webkit-datetime-edit-hour-field]:p-0',
|
|
50
|
+
'[&::-webkit-datetime-edit-minute-field]:p-0',
|
|
51
|
+
'[&::-webkit-datetime-edit-second-field]:p-0',
|
|
52
|
+
'[&::-webkit-datetime-edit-millisecond-field]:p-0',
|
|
53
|
+
'[&::-webkit-datetime-edit-meridiem-field]:p-0',
|
|
54
|
+
],
|
|
55
|
+
// Basic layout
|
|
56
|
+
'relative block 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)]',
|
|
57
|
+
// Typography
|
|
58
|
+
'text-base/6 text-zinc-950 placeholder:text-zinc-500 sm:text-sm/6 dark:text-white',
|
|
59
|
+
// Border
|
|
60
|
+
'border border-zinc-950/10 data-hover:border-zinc-950/20 dark:border-white/10 dark:data-hover:border-white/20',
|
|
61
|
+
// Background color
|
|
62
|
+
'bg-transparent dark:bg-white/5',
|
|
63
|
+
// Hide default focus styles
|
|
64
|
+
'focus:outline-hidden',
|
|
65
|
+
// Invalid state
|
|
66
|
+
'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',
|
|
67
|
+
// Disabled state
|
|
68
|
+
'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',
|
|
69
|
+
// System icons
|
|
70
|
+
'dark:scheme-dark',
|
|
71
|
+
])}/>
|
|
72
|
+
</span>);
|
|
73
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TODO: Update this component to use your client-side framework's link
|
|
3
|
+
* component. We've provided examples of how to do this for Next.js, Remix, and
|
|
4
|
+
* Inertia.js in the Catalyst documentation:
|
|
5
|
+
*
|
|
6
|
+
* https://catalyst.tailwindui.com/docs#client-side-router-integration
|
|
7
|
+
*/
|
|
8
|
+
import * as Headless from '@headlessui/react';
|
|
9
|
+
import React, { forwardRef } from 'react';
|
|
10
|
+
export const Link = forwardRef(function Link(props, ref) {
|
|
11
|
+
return (<Headless.DataInteractive>
|
|
12
|
+
<a {...props} ref={ref}/>
|
|
13
|
+
</Headless.DataInteractive>);
|
|
14
|
+
});
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import * as Headless from '@headlessui/react';
|
|
14
|
+
import clsx from 'clsx';
|
|
15
|
+
import { Fragment } from 'react';
|
|
16
|
+
export function Listbox(_a) {
|
|
17
|
+
var { className, placeholder, autoFocus, 'aria-label': ariaLabel, children: options } = _a, props = __rest(_a, ["className", "placeholder", "autoFocus", 'aria-label', "children"]);
|
|
18
|
+
return (<Headless.Listbox {...props} multiple={false}>
|
|
19
|
+
<Headless.ListboxButton autoFocus={autoFocus} data-slot="control" aria-label={ariaLabel} className={clsx([
|
|
20
|
+
className,
|
|
21
|
+
// Basic layout
|
|
22
|
+
'group relative block w-full',
|
|
23
|
+
// Background color + shadow applied to inset pseudo element, so shadow blends with border in light mode
|
|
24
|
+
'before:absolute before:inset-px before:rounded-[calc(var(--radius-lg)-1px)] before:bg-white before:shadow-sm',
|
|
25
|
+
// Background color is moved to control and shadow is removed in dark mode so hide `before` pseudo
|
|
26
|
+
'dark:before:hidden',
|
|
27
|
+
// Hide default focus styles
|
|
28
|
+
'focus:outline-hidden',
|
|
29
|
+
// Focus ring
|
|
30
|
+
'after:pointer-events-none after:absolute after:inset-0 after:rounded-lg after:ring-transparent after:ring-inset data-focus:after:ring-2 data-focus:after:ring-blue-500',
|
|
31
|
+
// Disabled state
|
|
32
|
+
'data-disabled:opacity-50 data-disabled:before:bg-zinc-950/5 data-disabled:before:shadow-none',
|
|
33
|
+
])}>
|
|
34
|
+
<Headless.ListboxSelectedOption as="span" options={options} placeholder={placeholder && <span className="block truncate text-zinc-500">{placeholder}</span>} className={clsx([
|
|
35
|
+
// Basic layout
|
|
36
|
+
'relative block w-full appearance-none rounded-lg py-[calc(--spacing(2.5)-1px)] sm:py-[calc(--spacing(1.5)-1px)]',
|
|
37
|
+
// Set minimum height for when no value is selected
|
|
38
|
+
'min-h-11 sm:min-h-9',
|
|
39
|
+
// Horizontal padding
|
|
40
|
+
'pr-[calc(--spacing(7)-1px)] pl-[calc(--spacing(3.5)-1px)] sm:pl-[calc(--spacing(3)-1px)]',
|
|
41
|
+
// Typography
|
|
42
|
+
'text-left text-base/6 text-zinc-950 placeholder:text-zinc-500 sm:text-sm/6 dark:text-white forced-colors:text-[CanvasText]',
|
|
43
|
+
// Border
|
|
44
|
+
'border border-zinc-950/10 group-data-active:border-zinc-950/20 group-data-hover:border-zinc-950/20 dark:border-white/10 dark:group-data-active:border-white/20 dark:group-data-hover:border-white/20',
|
|
45
|
+
// Background color
|
|
46
|
+
'bg-transparent dark:bg-white/5',
|
|
47
|
+
// Invalid state
|
|
48
|
+
'group-data-invalid:border-red-500 group-data-hover:group-data-invalid:border-red-500 dark:group-data-invalid:border-red-600 dark:data-hover:group-data-invalid:border-red-600',
|
|
49
|
+
// Disabled state
|
|
50
|
+
'group-data-disabled:border-zinc-950/20 group-data-disabled:opacity-100 dark:group-data-disabled:border-white/15 dark:group-data-disabled:bg-white/2.5 dark:group-data-disabled:data-hover:border-white/15',
|
|
51
|
+
])}/>
|
|
52
|
+
<span className="pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2">
|
|
53
|
+
<svg className="size-5 stroke-zinc-500 group-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">
|
|
54
|
+
<path d="M5.75 10.75L8 13L10.25 10.75" strokeWidth={1.5} strokeLinecap="round" strokeLinejoin="round"/>
|
|
55
|
+
<path d="M10.25 5.25L8 3L5.75 5.25" strokeWidth={1.5} strokeLinecap="round" strokeLinejoin="round"/>
|
|
56
|
+
</svg>
|
|
57
|
+
</span>
|
|
58
|
+
</Headless.ListboxButton>
|
|
59
|
+
<Headless.ListboxOptions transition anchor="selection start" className={clsx(
|
|
60
|
+
// Anchor positioning
|
|
61
|
+
'[--anchor-offset:-1.625rem] [--anchor-padding:--spacing(4)] sm:[--anchor-offset:-1.375rem]',
|
|
62
|
+
// Base styles
|
|
63
|
+
'isolate w-max min-w-[calc(var(--button-width)+1.75rem)] scroll-py-1 rounded-xl p-1 select-none',
|
|
64
|
+
// Invisible border that is only visible in `forced-colors` mode for accessibility purposes
|
|
65
|
+
'outline outline-transparent focus:outline-hidden',
|
|
66
|
+
// Handle scrolling when menu won't fit in viewport
|
|
67
|
+
'overflow-y-scroll overscroll-contain',
|
|
68
|
+
// Popover background
|
|
69
|
+
'bg-white/75 backdrop-blur-xl dark:bg-zinc-800/75',
|
|
70
|
+
// Shadows
|
|
71
|
+
'shadow-lg ring-1 ring-zinc-950/10 dark:ring-white/10 dark:ring-inset',
|
|
72
|
+
// Transitions
|
|
73
|
+
'transition-opacity duration-100 ease-in data-closed:data-leave:opacity-0 data-transition:pointer-events-none')}>
|
|
74
|
+
{options}
|
|
75
|
+
</Headless.ListboxOptions>
|
|
76
|
+
</Headless.Listbox>);
|
|
77
|
+
}
|
|
78
|
+
export function ListboxOption(_a) {
|
|
79
|
+
var { children, className } = _a, props = __rest(_a, ["children", "className"]);
|
|
80
|
+
let sharedClasses = clsx(
|
|
81
|
+
// Base
|
|
82
|
+
'flex min-w-0 items-center',
|
|
83
|
+
// Icons
|
|
84
|
+
'*: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]',
|
|
85
|
+
// Avatars
|
|
86
|
+
'*:data-[slot=avatar]:-mx-0.5 *:data-[slot=avatar]:size-6 sm:*:data-[slot=avatar]:size-5');
|
|
87
|
+
return (<Headless.ListboxOption as={Fragment} {...props}>
|
|
88
|
+
{({ selectedOption }) => {
|
|
89
|
+
if (selectedOption) {
|
|
90
|
+
return <div className={clsx(className, sharedClasses)}>{children}</div>;
|
|
91
|
+
}
|
|
92
|
+
return (<div className={clsx(
|
|
93
|
+
// Basic layout
|
|
94
|
+
'group/option grid cursor-default grid-cols-[--spacing(5)_1fr] items-baseline gap-x-2 rounded-lg py-2.5 pr-3.5 pl-2 sm:grid-cols-[--spacing(4)_1fr] sm:py-1.5 sm:pr-3 sm:pl-1.5',
|
|
95
|
+
// Typography
|
|
96
|
+
'text-base/6 text-zinc-950 sm:text-sm/6 dark:text-white forced-colors:text-[CanvasText]',
|
|
97
|
+
// Focus
|
|
98
|
+
'outline-hidden data-focus:bg-blue-500 data-focus:text-white',
|
|
99
|
+
// Forced colors mode
|
|
100
|
+
'forced-color-adjust-none forced-colors:data-focus:bg-[Highlight] forced-colors:data-focus:text-[HighlightText]',
|
|
101
|
+
// Disabled
|
|
102
|
+
'data-disabled:opacity-50')}>
|
|
103
|
+
<svg className="relative 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">
|
|
104
|
+
<path d="M4 8.5l3 3L12 4" strokeWidth={1.5} strokeLinecap="round" strokeLinejoin="round"/>
|
|
105
|
+
</svg>
|
|
106
|
+
<span className={clsx(className, sharedClasses, 'col-start-2')}>{children}</span>
|
|
107
|
+
</div>);
|
|
108
|
+
}}
|
|
109
|
+
</Headless.ListboxOption>);
|
|
110
|
+
}
|
|
111
|
+
export function ListboxLabel(_a) {
|
|
112
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
113
|
+
return <span {...props} className={clsx(className, 'ml-2.5 truncate first:ml-0 sm:ml-2 sm:first:ml-0')}/>;
|
|
114
|
+
}
|
|
115
|
+
export function ListboxDescription(_a) {
|
|
116
|
+
var { className, children } = _a, props = __rest(_a, ["className", "children"]);
|
|
117
|
+
return (<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')}>
|
|
118
|
+
<span className="flex-1 truncate">{children}</span>
|
|
119
|
+
</span>);
|
|
120
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import * as Headless from '@headlessui/react';
|
|
14
|
+
import clsx from 'clsx';
|
|
15
|
+
import { LayoutGroup, motion } from 'framer-motion';
|
|
16
|
+
import React, { forwardRef, useId } from 'react';
|
|
17
|
+
import { TouchTarget } from './button';
|
|
18
|
+
import { Link } from './link';
|
|
19
|
+
export function Navbar(_a) {
|
|
20
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
21
|
+
return <nav {...props} className={clsx(className, 'flex flex-1 items-center gap-4 py-2.5')}/>;
|
|
22
|
+
}
|
|
23
|
+
export function NavbarDivider(_a) {
|
|
24
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
25
|
+
return <div aria-hidden="true" {...props} className={clsx(className, 'h-6 w-px bg-zinc-950/10 dark:bg-white/10')}/>;
|
|
26
|
+
}
|
|
27
|
+
export function NavbarSection(_a) {
|
|
28
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
29
|
+
let id = useId();
|
|
30
|
+
return (<LayoutGroup id={id}>
|
|
31
|
+
<div {...props} className={clsx(className, 'flex items-center gap-3')}/>
|
|
32
|
+
</LayoutGroup>);
|
|
33
|
+
}
|
|
34
|
+
export function NavbarSpacer(_a) {
|
|
35
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
36
|
+
return <div aria-hidden="true" {...props} className={clsx(className, '-ml-4 flex-1')}/>;
|
|
37
|
+
}
|
|
38
|
+
export const NavbarItem = forwardRef(function NavbarItem(_a, ref) {
|
|
39
|
+
var { current, className, children } = _a, props = __rest(_a, ["current", "className", "children"]);
|
|
40
|
+
let classes = clsx(
|
|
41
|
+
// Base
|
|
42
|
+
'relative flex min-w-0 items-center gap-3 rounded-lg p-2 text-left text-base/6 font-medium text-zinc-950 sm:text-sm/5',
|
|
43
|
+
// Leading icon/icon-only
|
|
44
|
+
'*:data-[slot=icon]:size-6 *:data-[slot=icon]:shrink-0 *:data-[slot=icon]:fill-zinc-500 sm:*:data-[slot=icon]:size-5',
|
|
45
|
+
// Trailing icon (down chevron or similar)
|
|
46
|
+
'*:not-nth-2:last:data-[slot=icon]:ml-auto *:not-nth-2:last:data-[slot=icon]:size-5 sm:*:not-nth-2:last:data-[slot=icon]:size-4',
|
|
47
|
+
// Avatar
|
|
48
|
+
'*:data-[slot=avatar]:-m-0.5 *:data-[slot=avatar]:size-7 *:data-[slot=avatar]:[--avatar-radius:var(--radius-md)] sm:*:data-[slot=avatar]:size-6',
|
|
49
|
+
// Hover
|
|
50
|
+
'data-hover:bg-zinc-950/5 data-hover:*:data-[slot=icon]:fill-zinc-950',
|
|
51
|
+
// Active
|
|
52
|
+
'data-active:bg-zinc-950/5 data-active:*:data-[slot=icon]:fill-zinc-950',
|
|
53
|
+
// Dark mode
|
|
54
|
+
'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');
|
|
55
|
+
return (<span className={clsx(className, 'relative')}>
|
|
56
|
+
{current && (<motion.span layoutId="current-indicator" className="absolute inset-x-2 -bottom-2.5 h-0.5 rounded-full bg-zinc-950 dark:bg-white"/>)}
|
|
57
|
+
{'href' in props ? (<Link {...props} className={classes} data-current={current ? 'true' : undefined} ref={ref}>
|
|
58
|
+
<TouchTarget>{children}</TouchTarget>
|
|
59
|
+
</Link>) : (<Headless.Button {...props} className={clsx('cursor-default', classes)} data-current={current ? 'true' : undefined} ref={ref}>
|
|
60
|
+
<TouchTarget>{children}</TouchTarget>
|
|
61
|
+
</Headless.Button>)}
|
|
62
|
+
</span>);
|
|
63
|
+
});
|
|
64
|
+
export function NavbarLabel(_a) {
|
|
65
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
66
|
+
return <span {...props} className={clsx(className, 'truncate')}/>;
|
|
67
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
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 clsx from 'clsx';
|
|
13
|
+
import { Button } from './button';
|
|
14
|
+
export function Pagination(_a) {
|
|
15
|
+
var { 'aria-label': ariaLabel = 'Page navigation', className } = _a, props = __rest(_a, ['aria-label', "className"]);
|
|
16
|
+
return <nav aria-label={ariaLabel} {...props} className={clsx(className, 'flex gap-x-2')}/>;
|
|
17
|
+
}
|
|
18
|
+
export function PaginationPrevious({ href = null, className, children = 'Previous', }) {
|
|
19
|
+
return (<span className={clsx(className, 'grow basis-0')}>
|
|
20
|
+
<Button {...(href === null ? { disabled: true } : { href })} plain aria-label="Previous page">
|
|
21
|
+
<svg className="stroke-current" data-slot="icon" viewBox="0 0 16 16" fill="none" aria-hidden="true">
|
|
22
|
+
<path d="M2.75 8H13.25M2.75 8L5.25 5.5M2.75 8L5.25 10.5" strokeWidth={1.5} strokeLinecap="round" strokeLinejoin="round"/>
|
|
23
|
+
</svg>
|
|
24
|
+
{children}
|
|
25
|
+
</Button>
|
|
26
|
+
</span>);
|
|
27
|
+
}
|
|
28
|
+
export function PaginationNext({ href = null, className, children = 'Next', }) {
|
|
29
|
+
return (<span className={clsx(className, 'flex grow basis-0 justify-end')}>
|
|
30
|
+
<Button {...(href === null ? { disabled: true } : { href })} plain aria-label="Next page">
|
|
31
|
+
{children}
|
|
32
|
+
<svg className="stroke-current" data-slot="icon" viewBox="0 0 16 16" fill="none" aria-hidden="true">
|
|
33
|
+
<path d="M13.25 8L2.75 8M13.25 8L10.75 10.5M13.25 8L10.75 5.5" strokeWidth={1.5} strokeLinecap="round" strokeLinejoin="round"/>
|
|
34
|
+
</svg>
|
|
35
|
+
</Button>
|
|
36
|
+
</span>);
|
|
37
|
+
}
|
|
38
|
+
export function PaginationList(_a) {
|
|
39
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
40
|
+
return <span {...props} className={clsx(className, 'hidden items-baseline gap-x-2 sm:flex')}/>;
|
|
41
|
+
}
|
|
42
|
+
export function PaginationPage({ href, className, current = false, children, }) {
|
|
43
|
+
return (<Button href={href} plain aria-label={`Page ${children}`} aria-current={current ? 'page' : undefined} className={clsx(className, 'min-w-9 before:absolute before:-inset-px before:rounded-lg', current && 'before:bg-zinc-950/5 dark:before:bg-white/10')}>
|
|
44
|
+
<span className="-mx-0.5">{children}</span>
|
|
45
|
+
</Button>);
|
|
46
|
+
}
|
|
47
|
+
export function PaginationGap(_a) {
|
|
48
|
+
var { className, children = <>…</> } = _a, props = __rest(_a, ["className", "children"]);
|
|
49
|
+
return (<span aria-hidden="true" {...props} className={clsx(className, 'w-9 text-center text-sm/6 font-semibold text-zinc-950 select-none dark:text-white')}>
|
|
50
|
+
{children}
|
|
51
|
+
</span>);
|
|
52
|
+
}
|