@gaulatti/bleecker 0.1.35 → 0.1.36
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 +75 -0
- package/dist/components/accordion.js +3 -2
- package/dist/components/activity-item.js +1 -1
- package/dist/components/alert-dialog.js +24 -11
- package/dist/components/alert.d.ts +2 -1
- package/dist/components/alert.js +11 -10
- package/dist/components/avatar.d.ts +2 -1
- package/dist/components/avatar.js +1 -0
- package/dist/components/bauhaus-background.js +1 -1
- package/dist/components/brand-lockup.js +1 -1
- package/dist/components/breadcrumb.js +3 -2
- package/dist/components/button.d.ts +3 -5
- package/dist/components/button.js +17 -12
- package/dist/components/card.d.ts +5 -1
- package/dist/components/card.js +3 -2
- package/dist/components/checkbox.js +1 -1
- package/dist/components/collection-filters.d.ts +2 -1
- package/dist/components/collection-filters.js +40 -7
- package/dist/components/command-spotlight.js +10 -5
- package/dist/components/context-menu.js +2 -2
- package/dist/components/dashboard-section.js +1 -1
- package/dist/components/data-list.js +1 -1
- package/dist/components/data-table-column-toggle.js +8 -20
- package/dist/components/data-table.js +2 -1
- package/dist/components/date-picker.d.ts +3 -1
- package/dist/components/date-picker.js +11 -29
- package/dist/components/date-range-picker.d.ts +3 -3
- package/dist/components/date-range-picker.js +24 -9
- package/dist/components/dialog-close-button.js +2 -2
- package/dist/components/donut-chart.js +1 -1
- package/dist/components/drawer.js +8 -22
- package/dist/components/dropdown-menu.js +7 -7
- package/dist/components/empty.js +1 -1
- package/dist/components/error-state.js +1 -1
- package/dist/components/feed-item.js +1 -1
- package/dist/components/field-help-tooltip.js +1 -1
- package/dist/components/field.d.ts +17 -0
- package/dist/components/field.js +16 -0
- package/dist/components/file-input.js +1 -1
- package/dist/components/filter-chip.js +2 -2
- package/dist/components/header-select.d.ts +13 -2
- package/dist/components/header-select.js +7 -3
- package/dist/components/hero-carousel.js +3 -2
- package/dist/components/hover-card.js +1 -1
- package/dist/components/icon-badge.d.ts +5 -2
- package/dist/components/icon-badge.js +2 -2
- package/dist/components/icon-button.d.ts +4 -0
- package/dist/components/icon-button.js +3 -2
- package/dist/components/input.d.ts +2 -3
- package/dist/components/input.js +5 -5
- package/dist/components/label.js +1 -1
- package/dist/components/loading-overlay.js +1 -1
- package/dist/components/loading-spinner.d.ts +3 -1
- package/dist/components/media-library.js +5 -3
- package/dist/components/menubar.js +17 -7
- package/dist/components/metric.d.ts +2 -2
- package/dist/components/metric.js +1 -0
- package/dist/components/modal.js +53 -13
- package/dist/components/navigation-menu.js +15 -5
- package/dist/components/notification-badge.js +1 -1
- package/dist/components/otp-input.js +2 -1
- package/dist/components/page-header.js +1 -1
- package/dist/components/pagination.js +3 -3
- package/dist/components/panel.js +1 -1
- package/dist/components/popover.d.ts +3 -2
- package/dist/components/popover.js +4 -91
- package/dist/components/progress.d.ts +4 -2
- package/dist/components/progress.js +3 -3
- package/dist/components/radio-group.d.ts +3 -1
- package/dist/components/radio-group.js +2 -2
- package/dist/components/sankey-chart.js +1 -0
- package/dist/components/search-input.js +1 -1
- package/dist/components/section-header.js +1 -1
- package/dist/components/select.d.ts +12 -1
- package/dist/components/select.js +13 -64
- package/dist/components/sheet.js +8 -24
- package/dist/components/sidebar.js +4 -3
- package/dist/components/slider.js +2 -2
- package/dist/components/sonner.js +3 -2
- package/dist/components/stat-card.js +1 -1
- package/dist/components/status-badge.d.ts +2 -1
- package/dist/components/status-badge.js +5 -6
- package/dist/components/stepper.js +2 -2
- package/dist/components/sunburst-chart.js +1 -0
- package/dist/components/switch.js +1 -1
- package/dist/components/table.js +10 -8
- package/dist/components/tabs.d.ts +6 -1
- package/dist/components/tabs.js +30 -7
- package/dist/components/textarea.d.ts +2 -3
- package/dist/components/textarea.js +2 -2
- package/dist/components/theme-toggle.js +1 -0
- package/dist/components/timeline.js +1 -1
- package/dist/components/toggle-group.js +2 -1
- package/dist/components/toggle.d.ts +4 -2
- package/dist/components/toggle.js +1 -1
- package/dist/components/tooltip.d.ts +2 -1
- package/dist/components/tooltip.js +3 -21
- package/dist/core/contracts.d.ts +48 -0
- package/dist/core/contracts.js +23 -0
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.js +2 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/layout/admin-shell.js +1 -1
- package/dist/layout/app-shell.js +1 -1
- package/dist/layout/footer.js +4 -4
- package/dist/layout/header.js +2 -1
- package/dist/styles.css +1 -1
- package/dist/theme/theme-provider.js +1 -0
- package/dist/theme/theme-script.d.ts +1 -2
- package/dist/theme/theme-script.js +1 -3
- package/dist/theme/types.d.ts +2 -1
- package/dist/tokens/index.d.ts +1 -0
- package/dist/tokens/index.js +1 -0
- package/dist/tokens/source.d.ts +221 -0
- package/dist/tokens/source.js +140 -0
- package/dist/utils/hooks.d.ts +14 -0
- package/dist/utils/hooks.js +101 -0
- package/package.json +41 -7
- package/src/styles/global.css +82 -175
- package/src/styles/tokens.generated.css +171 -0
package/README.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Bleecker
|
|
2
|
+
|
|
3
|
+
Bleecker is a refined React component library built around the Encode Sans typeface and a warm, restrained palette of sand, sea, desert, and terracotta.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install @gaulatti/bleecker
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Import the compiled component styles once in your application:
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import '@gaulatti/bleecker/styles.css';
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { Button, Field, Input } from '@gaulatti/bleecker';
|
|
19
|
+
|
|
20
|
+
export function AccountForm() {
|
|
21
|
+
return (
|
|
22
|
+
<Field label='Email address' description='Used for account notifications.'>
|
|
23
|
+
<Input type='email' />
|
|
24
|
+
</Field>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Individual component entry points are also available:
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
import { Button } from '@gaulatti/bleecker/components/button';
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Design principles
|
|
36
|
+
|
|
37
|
+
- Encode Sans is the primary voice. Use the `font-secondary` utility to opt specific supporting or editorial copy into Libre Franklin.
|
|
38
|
+
- Spacing follows a deliberate 4, 8, 12, 16, 24, 32, 48, and 64 pixel rhythm.
|
|
39
|
+
- Borders carry surface hierarchy; shadows are reserved for elevated surfaces and overlays.
|
|
40
|
+
- Controls use consistent 32, 40, and 48 pixel heights.
|
|
41
|
+
- Motion is brief and functional, with reduced-motion behavior included globally.
|
|
42
|
+
|
|
43
|
+
## Theming
|
|
44
|
+
|
|
45
|
+
The default light and dark themes are defined with `--app-*` custom properties in the stylesheet. Override those properties after importing Bleecker styles to adapt the theme without changing component markup.
|
|
46
|
+
|
|
47
|
+
The `ThemeProvider`, `ThemeToggle`, and `BleeckerThemeScript` exports provide persisted light, dark, and system modes. Render `BleeckerThemeScript` in the document head when server rendering to avoid a theme flash.
|
|
48
|
+
|
|
49
|
+
## Accessibility
|
|
50
|
+
|
|
51
|
+
Interactive overlays and selection controls use accessible behavioral primitives. Form controls forward native attributes; `Field` connects labels, descriptions, errors, and invalid state automatically.
|
|
52
|
+
|
|
53
|
+
Applications are still responsible for meaningful labels, logical page structure, and testing complete user flows in their own context.
|
|
54
|
+
|
|
55
|
+
## Shared foundations
|
|
56
|
+
|
|
57
|
+
Bleecker is the source of truth for platform-neutral component contracts and design tokens. These leaf exports do not import DOM components, CSS, Radix, Recharts, or ReactDOM:
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
import { buttonVariants, resolveTheme, type ButtonContract } from '@gaulatti/bleecker/core';
|
|
61
|
+
import { radii, spacing, themes } from '@gaulatti/bleecker/tokens';
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
`src/tokens/source.ts` is canonical. The web CSS token layer is generated from it during the build and checked for drift in CI. [Thompson](https://github.com/gaulatti/thompson), Bleecker's React Native sibling, consumes these exports and supplies native renderers.
|
|
65
|
+
|
|
66
|
+
## Development
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
npm ci
|
|
70
|
+
npm run check
|
|
71
|
+
npm run build-storybook
|
|
72
|
+
npm run build
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
The build cleans generated output before compilation so removed modules cannot remain in published packages.
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
import { ChevronDown } from 'lucide-react';
|
|
3
4
|
import React from 'react';
|
|
4
5
|
import { cn } from '../utils/cn.js';
|
|
5
6
|
export function Accordion({ className, defaultExpandedId = null, items }) {
|
|
6
7
|
const [expandedId, setExpandedId] = React.useState(defaultExpandedId);
|
|
7
|
-
return (_jsx("div", { className: cn('overflow-hidden rounded-
|
|
8
|
+
return (_jsx("div", { className: cn('overflow-hidden rounded-[var(--radius-card)] border border-sand/30 bg-white shadow-[var(--shadow-surface)] dark:border-white/10 dark:bg-deep-sea', className), children: _jsx("ul", { className: 'divide-y divide-sand/20 dark:divide-white/[0.07]', children: items.map((item) => {
|
|
8
9
|
const isExpanded = expandedId === item.id;
|
|
9
|
-
return (_jsxs("li", { children: [_jsxs("div", { className: 'flex
|
|
10
|
+
return (_jsxs("li", { children: [_jsxs("div", { className: 'flex items-center transition-colors duration-[var(--motion-surface)] ease-premium hover:bg-light-sand/35 dark:hover:bg-white/[0.03]', children: [_jsxs("button", { type: 'button', "aria-expanded": isExpanded, className: 'flex min-w-0 flex-1 items-center gap-3 px-4 py-4 text-left outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-sea/25 sm:px-5', onClick: () => setExpandedId(isExpanded ? null : item.id), children: [_jsx(ChevronDown, { size: 16, className: cn('shrink-0 text-text-secondary transition-transform duration-200 ease-out-expo', isExpanded ? 'rotate-0' : '-rotate-90') }), _jsxs("div", { className: 'min-w-0', children: [_jsx("div", { className: 'text-sm font-medium text-text-primary dark:text-text-primary', children: item.title }), item.subtitle ? _jsx("div", { className: 'font-secondary mt-1 text-xs text-text-secondary dark:text-text-secondary', children: item.subtitle }) : null] })] }), item.actions ? (_jsx("div", { className: 'mr-4 flex shrink-0 items-center gap-2 sm:mr-5', children: item.actions })) : null] }), _jsx("div", { className: cn('grid transition-[grid-template-rows] duration-200 ease-out-expo', isExpanded ? 'grid-rows-[1fr]' : 'grid-rows-[0fr]'), children: _jsx("div", { className: 'overflow-hidden', children: _jsx("div", { className: 'border-t border-sand/15 bg-light-sand/25 dark:border-white/[0.05] dark:bg-white/[0.02]', children: item.content }) }) })] }, item.id));
|
|
10
11
|
}) }) }));
|
|
11
12
|
}
|
|
@@ -2,5 +2,5 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Avatar } from './avatar.js';
|
|
3
3
|
import { cn } from '../utils/cn.js';
|
|
4
4
|
export function ActivityItem({ className, init, time, title }) {
|
|
5
|
-
return (_jsxs("div", { className: cn('flex cursor-pointer gap-
|
|
5
|
+
return (_jsxs("div", { className: cn('flex cursor-pointer gap-3.5 border-b border-sand/20 px-4 py-4 transition-colors duration-[var(--motion-surface)] ease-premium hover:bg-light-sand/35 dark:border-white/[0.07] dark:hover:bg-white/[0.03]', className), children: [_jsx(Avatar, { fallback: init, size: 'sm' }), _jsxs("div", { className: 'min-w-0 flex-1 space-y-1.5', children: [_jsx("p", { className: 'text-[13px] font-medium leading-5 text-text-primary', children: title }), _jsx("p", { className: 'font-secondary text-[11px] text-text-secondary', children: time })] })] }));
|
|
6
6
|
}
|
|
@@ -1,22 +1,28 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
import { AlertTriangle, Loader2 } from 'lucide-react';
|
|
3
4
|
import React from 'react';
|
|
4
5
|
import { createPortal } from 'react-dom';
|
|
5
6
|
import { Button } from './button.js';
|
|
6
7
|
import { cn } from '../utils/cn.js';
|
|
8
|
+
import { usePresence } from '../utils/hooks.js';
|
|
7
9
|
export function AlertDialog({ cancelLabel = 'Cancel', className, confirmLabel = 'Continue', confirmLoading = false, description, isOpen, onCancel, onConfirm, title, variant = 'default' }) {
|
|
8
10
|
const dialogRef = React.useRef(null);
|
|
9
|
-
React.
|
|
11
|
+
const titleId = React.useId();
|
|
12
|
+
const descriptionId = React.useId();
|
|
13
|
+
const { present, visible } = usePresence(isOpen, 150);
|
|
14
|
+
React.useLayoutEffect(() => {
|
|
10
15
|
const dialog = dialogRef.current;
|
|
11
|
-
if (!dialog)
|
|
16
|
+
if (!present || !dialog)
|
|
12
17
|
return;
|
|
13
18
|
if (isOpen && !dialog.open) {
|
|
14
19
|
dialog.showModal();
|
|
15
20
|
}
|
|
16
|
-
|
|
17
|
-
dialog.
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
return () => {
|
|
22
|
+
if (!isOpen && dialog.open)
|
|
23
|
+
dialog.close();
|
|
24
|
+
};
|
|
25
|
+
}, [isOpen, present]);
|
|
20
26
|
// Trap focus & handle keyboard dismissal
|
|
21
27
|
React.useEffect(() => {
|
|
22
28
|
if (!isOpen)
|
|
@@ -31,14 +37,21 @@ export function AlertDialog({ cancelLabel = 'Cancel', className, confirmLabel =
|
|
|
31
37
|
document.addEventListener('keydown', handleKeyDown);
|
|
32
38
|
return () => document.removeEventListener('keydown', handleKeyDown);
|
|
33
39
|
}, [isOpen, onCancel, confirmLoading]);
|
|
34
|
-
if (typeof document === 'undefined' || !
|
|
40
|
+
if (typeof document === 'undefined' || !present) {
|
|
35
41
|
return null;
|
|
36
42
|
}
|
|
37
|
-
return createPortal(_jsx("dialog", { ref: dialogRef, className: cn('m-auto w-full max-w-md rounded-[
|
|
43
|
+
return createPortal(_jsx("dialog", { ref: dialogRef, "aria-labelledby": titleId, "aria-describedby": description ? descriptionId : undefined, "data-state": visible ? 'open' : 'closing', className: cn('modal-motion m-auto w-full max-w-md rounded-[var(--radius-dialog)] border border-sand/30 bg-white p-0 text-text-primary shadow-[var(--shadow-overlay)] outline-none backdrop:bg-deep-sea/38 backdrop:backdrop-blur-[2px] dark:border-white/12 dark:bg-deep-sea dark:text-text-primary dark:backdrop:bg-black/65', className), onClick: (event) => {
|
|
38
44
|
if (event.target === dialogRef.current) {
|
|
39
45
|
onCancel();
|
|
40
46
|
}
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
|
|
47
|
+
}, onCancel: (event) => {
|
|
48
|
+
event.preventDefault();
|
|
49
|
+
if (!confirmLoading)
|
|
50
|
+
onCancel();
|
|
51
|
+
}, onClose: () => {
|
|
52
|
+
if (isOpen)
|
|
53
|
+
onCancel();
|
|
54
|
+
}, children: _jsxs("div", { className: 'p-6 md:p-8', children: [_jsxs("div", { className: 'mb-6 flex items-start gap-4', children: [_jsx("div", { className: cn('flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-[9px] border', variant === 'destructive'
|
|
55
|
+
? 'border-terracotta/15 bg-terracotta/[0.07] text-terracotta dark:bg-terracotta/15'
|
|
56
|
+
: 'border-desert/15 bg-desert/[0.07] text-desert dark:bg-desert/15 dark:text-accent-gold'), children: _jsx(AlertTriangle, { size: 20 }) }), _jsxs("div", { className: 'min-w-0 flex-1', children: [_jsx("h2", { id: titleId, className: 'text-xl font-medium leading-tight text-text-primary dark:text-text-primary', children: title }), description ? _jsx("p", { id: descriptionId, className: 'font-secondary mt-2 text-sm leading-relaxed text-text-secondary dark:text-text-secondary', children: description }) : null] })] }), _jsxs("div", { className: 'flex justify-end gap-3 border-t border-sand/20 pt-5 dark:border-white/10', children: [_jsx(Button, { variant: 'secondary', size: 'sm', onClick: onCancel, disabled: confirmLoading, children: cancelLabel }), _jsx(Button, { variant: variant === 'destructive' ? 'destructive' : 'primary', size: 'sm', onClick: onConfirm, disabled: confirmLoading, children: confirmLoading ? (_jsxs("span", { className: 'flex items-center gap-2', children: [_jsx(Loader2, { size: 16, className: 'animate-spin' }), confirmLabel] })) : (confirmLabel) })] })] }) }), document.body);
|
|
44
57
|
}
|
package/dist/components/alert.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
3
|
import { AlertCircle, AlertTriangle, CheckCircle, Info, X } from 'lucide-react';
|
|
3
4
|
import React from 'react';
|
|
@@ -6,29 +7,29 @@ import { cn } from '../utils/cn.js';
|
|
|
6
7
|
const alertConfig = {
|
|
7
8
|
success: {
|
|
8
9
|
icon: CheckCircle,
|
|
9
|
-
bgColor: 'bg-white
|
|
10
|
-
borderColor: '
|
|
10
|
+
bgColor: 'bg-white dark:bg-deep-sea',
|
|
11
|
+
borderColor: 'border-sea/25 dark:border-accent-blue/25',
|
|
11
12
|
textColor: 'text-text-primary dark:text-text-primary',
|
|
12
13
|
iconColor: 'text-sea dark:text-accent-blue'
|
|
13
14
|
},
|
|
14
15
|
error: {
|
|
15
16
|
icon: AlertCircle,
|
|
16
|
-
bgColor: 'bg-white
|
|
17
|
-
borderColor: '
|
|
17
|
+
bgColor: 'bg-white dark:bg-deep-sea',
|
|
18
|
+
borderColor: 'border-terracotta/25 dark:border-terracotta/30',
|
|
18
19
|
textColor: 'text-text-primary dark:text-text-primary',
|
|
19
20
|
iconColor: 'text-terracotta dark:text-terracotta'
|
|
20
21
|
},
|
|
21
22
|
warning: {
|
|
22
23
|
icon: AlertTriangle,
|
|
23
|
-
bgColor: 'bg-white
|
|
24
|
-
borderColor: '
|
|
24
|
+
bgColor: 'bg-white dark:bg-deep-sea',
|
|
25
|
+
borderColor: 'border-sunset/30 dark:border-sunset/20',
|
|
25
26
|
textColor: 'text-text-primary dark:text-text-primary',
|
|
26
27
|
iconColor: 'text-sunset dark:text-accent-gold'
|
|
27
28
|
},
|
|
28
29
|
info: {
|
|
29
30
|
icon: Info,
|
|
30
|
-
bgColor: 'bg-white
|
|
31
|
-
borderColor: '
|
|
31
|
+
bgColor: 'bg-white dark:bg-deep-sea',
|
|
32
|
+
borderColor: 'border-desert/25 dark:border-desert/25',
|
|
32
33
|
textColor: 'text-text-primary dark:text-text-primary',
|
|
33
34
|
iconColor: 'text-desert dark:text-accent-gold'
|
|
34
35
|
}
|
|
@@ -58,12 +59,12 @@ export function Alert({ className, duration = 5000, message, onClose, type = 'in
|
|
|
58
59
|
onClose();
|
|
59
60
|
return;
|
|
60
61
|
}
|
|
61
|
-
window.setTimeout(onClose,
|
|
62
|
+
window.setTimeout(onClose, 220);
|
|
62
63
|
};
|
|
63
64
|
if (typeof document === 'undefined') {
|
|
64
65
|
return null;
|
|
65
66
|
}
|
|
66
|
-
return createPortal(_jsx("div", { className: 'pointer-events-none fixed inset-0 z-[9999] flex items-start justify-center px-4 pt-24', children: _jsx("div", { className: cn('pointer-events-auto w-full max-w-md rounded-[var(--radius-
|
|
67
|
+
return createPortal(_jsx("div", { className: 'pointer-events-none fixed inset-0 z-[9999] flex items-start justify-center px-4 pt-24', children: _jsx("div", { className: cn('pointer-events-auto w-full max-w-md rounded-[var(--radius-card)] border shadow-[var(--shadow-overlay)] transition-[opacity,transform] duration-[var(--motion-surface)] ease-premium', config.bgColor, config.borderColor, isVisible ? 'translate-y-0 opacity-100' : 'translate-y-1 opacity-0', className), children: _jsxs("div", { className: 'flex items-start gap-3 p-4', children: [_jsx(Icon, { className: cn('mt-0.5 h-5 w-5 flex-shrink-0', config.iconColor) }), _jsx("p", { className: cn('flex-1 text-sm font-medium leading-6', config.textColor), children: message }), _jsx("button", { type: 'button', onClick: handleClose, className: cn('-mr-1 -mt-0.5 scale-100 rounded-md p-1 transition-[background-color,transform] duration-[var(--motion-control)] ease-premium hover:bg-black/5 active:scale-[0.9] dark:hover:bg-white/10', config.textColor), "aria-label": 'Close alert', children: _jsx(X, { className: 'h-4 w-4' }) })] }) }) }), document.body);
|
|
67
68
|
}
|
|
68
69
|
let alertsState = [];
|
|
69
70
|
let listeners = [];
|
|
@@ -21,5 +21,5 @@ const patternConfig = {
|
|
|
21
21
|
export function BauhausBackground({ className, defaultImageUrl = '/hero/pompeii.avif', imageUrl, type }) {
|
|
22
22
|
const { bgClassName, pattern } = patternConfig[type];
|
|
23
23
|
const resolvedImageUrl = imageUrl ?? defaultImageUrl;
|
|
24
|
-
return (_jsxs("div", { className: cn('relative h-full w-full overflow-hidden', className), children: [_jsxs("div", { className: 'absolute inset-0', children: [_jsx("img", { src: resolvedImageUrl, alt: '', className: 'h-full w-full object-cover' }), _jsx("div", { className: 'absolute inset-0 bg-gradient-to-t from-black/30 to-transparent mix-blend-multiply' })] }), _jsxs("div", { className: cn('absolute inset-0 mix-blend-soft-light', bgClassName), children: [pattern === 'circles' ? (_jsxs("div", { className: 'absolute inset-0', children: [_jsx("div", { className: 'shape-rotate absolute left-1/4 top-1/4 h-1/2 w-1/2 rounded-full border-8 border-white' }), _jsx("div", { className: 'shape-rotate absolute left-1/3 top-1/3 h-1/3 w-1/3 rounded-full border-4 border-white [animation-direction:reverse]' })] })) : null, pattern === 'lines' ? (_jsx("div", { className: 'absolute inset-0', children: _jsx("div", { className: 'grid h-full grid-cols-6', children: Array.from({ length: 6 }).map((_, index) => (_jsx("div", { className: 'h-full border-l-2 border-white
|
|
24
|
+
return (_jsxs("div", { className: cn('relative h-full w-full overflow-hidden', className), children: [_jsxs("div", { className: 'absolute inset-0', children: [_jsx("img", { src: resolvedImageUrl, alt: '', className: 'h-full w-full object-cover' }), _jsx("div", { className: 'absolute inset-0 bg-gradient-to-t from-black/30 to-transparent mix-blend-multiply' })] }), _jsxs("div", { className: cn('absolute inset-0 mix-blend-soft-light', bgClassName), children: [pattern === 'circles' ? (_jsxs("div", { className: 'absolute inset-0', children: [_jsx("div", { className: 'shape-rotate absolute left-1/4 top-1/4 h-1/2 w-1/2 rounded-full border-8 border-white' }), _jsx("div", { className: 'shape-rotate absolute left-1/3 top-1/3 h-1/3 w-1/3 rounded-full border-4 border-white [animation-direction:reverse]' })] })) : null, pattern === 'lines' ? (_jsx("div", { className: 'absolute inset-0', children: _jsx("div", { className: 'grid h-full grid-cols-6', children: Array.from({ length: 6 }).map((_, index) => (_jsx("div", { className: 'h-full border-l-2 border-white/85', style: { transitionDelay: `${index * 100}ms` } }, `line-${index}`))) }) })) : null, pattern === 'squares' ? (_jsx("div", { className: 'absolute inset-0', children: _jsx("div", { className: 'grid h-full grid-cols-3 grid-rows-3 gap-4 p-4', children: Array.from({ length: 9 }).map((_, index) => (_jsx("div", { className: 'border-2 border-white/85' }, `square-${index}`))) }) })) : null] })] }));
|
|
25
25
|
}
|
|
@@ -11,6 +11,6 @@ export function BrandLockup({ className, href, logoAlt = 'gaulatti', logoSrc = g
|
|
|
11
11
|
label: name
|
|
12
12
|
},
|
|
13
13
|
className: cn('group inline-flex items-center gap-4 transition-all duration-400', className),
|
|
14
|
-
children: (_jsxs(_Fragment, { children: [_jsx("img", { src: logoSrc, alt: logoAlt, className: cn('w-auto opacity-90 transition-opacity duration-400 group-hover:opacity-100 dark:invert', isLarge ? 'h-12' : 'h-8') }), _jsx("div", { className: cn('w-px bg-
|
|
14
|
+
children: (_jsxs(_Fragment, { children: [_jsx("img", { src: logoSrc, alt: logoAlt, className: cn('w-auto opacity-90 transition-opacity duration-400 group-hover:opacity-100 dark:invert', isLarge ? 'h-12' : 'h-8') }), _jsx("div", { className: cn('w-px bg-sand/55 dark:bg-white/18', isLarge ? 'h-12' : 'h-8') }), _jsx("span", { className: cn('font-[family-name:var(--font-display)] font-semibold tracking-refined text-text-primary dark:text-text-primary', isLarge ? 'text-3xl' : 'text-xl'), children: name })] }))
|
|
15
15
|
}) }));
|
|
16
16
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
import { ChevronRight, Ellipsis } from 'lucide-react';
|
|
3
4
|
import React from 'react';
|
|
@@ -13,11 +14,11 @@ export function Breadcrumb({ className, collapsedAfter = 0, items, renderLink, s
|
|
|
13
14
|
const isLast = index === visibleItems.length - 1;
|
|
14
15
|
if (item === null) {
|
|
15
16
|
// Collapsed placeholder
|
|
16
|
-
return (_jsxs(React.Fragment, { children: [_jsx("li", { className: 'flex items-center', children: _jsx("button", { type: 'button', onClick: () => setExpanded(true), "aria-label": 'Show full path', className: 'inline-flex h-6 w-6 items-center justify-center rounded-md text-text-secondary transition-
|
|
17
|
+
return (_jsxs(React.Fragment, { children: [_jsx("li", { className: 'flex items-center', children: _jsx("button", { type: 'button', onClick: () => setExpanded(true), "aria-label": 'Show full path', className: 'inline-flex h-6 w-6 scale-100 items-center justify-center rounded-md text-text-secondary transition-[background-color,color,transform] duration-[var(--motion-control)] ease-premium hover:bg-sand/10 hover:text-text-primary active:scale-[0.9] dark:hover:bg-sand/20 dark:hover:text-text-primary', children: _jsx(Ellipsis, { size: 14 }) }) }), _jsx("li", { "aria-hidden": 'true', className: 'flex items-center', children: separatorNode })] }, 'ellipsis'));
|
|
17
18
|
}
|
|
18
19
|
return (_jsxs(React.Fragment, { children: [_jsx("li", { className: 'flex items-center', children: isLast ? (_jsx("span", { "aria-current": 'page', className: 'text-sm font-medium text-text-primary dark:text-text-primary', children: item.label })) : (linkRenderer({
|
|
19
20
|
item,
|
|
20
|
-
className: 'text-sm text-text-secondary transition-colors hover:text-text-primary dark:text-text-secondary dark:hover:text-text-primary',
|
|
21
|
+
className: 'text-sm text-text-secondary transition-colors duration-[var(--motion-control)] ease-premium hover:text-text-primary dark:text-text-secondary dark:hover:text-text-primary',
|
|
21
22
|
children: item.label
|
|
22
23
|
})) }), !isLast && (_jsx("li", { "aria-hidden": 'true', className: 'flex items-center', children: separatorNode }))] }, `${item.href}:${item.label}`));
|
|
23
24
|
}) }) }));
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
export type ButtonSize
|
|
4
|
-
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement
|
|
5
|
-
variant?: ButtonVariant;
|
|
6
|
-
size?: ButtonSize;
|
|
2
|
+
import type { ButtonContract } from '../core';
|
|
3
|
+
export type { ButtonSize, ButtonVariant } from '../core';
|
|
4
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, ButtonContract {
|
|
7
5
|
as?: 'button' | 'a';
|
|
8
6
|
href?: string;
|
|
9
7
|
}
|
|
@@ -1,21 +1,26 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { LoaderCircle } from 'lucide-react';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import { cn } from '../utils/cn.js';
|
|
4
5
|
const variantClasses = {
|
|
5
|
-
primary: 'bg-sea text-white hover:
|
|
6
|
-
secondary: 'bg-white
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
primary: 'border-sea bg-sea text-white shadow-[0_1px_2px_rgba(21,48,66,0.16)] hover:border-deep-sea hover:bg-deep-sea hover:shadow-[0_4px_12px_-7px_rgba(26,55,77,0.42)] dark:border-accent-blue dark:bg-accent-blue dark:text-deep-sea dark:hover:border-accent-blue dark:hover:bg-accent-blue/90',
|
|
7
|
+
secondary: 'border-sand/45 bg-white text-text-primary shadow-[0_1px_2px_rgba(26,55,77,0.035)] hover:border-sand/75 hover:bg-light-sand/35 hover:shadow-[0_3px_10px_-7px_rgba(26,55,77,0.26)] dark:border-white/18 dark:bg-deep-sea dark:text-text-primary dark:hover:bg-white/[0.06]',
|
|
8
|
+
outline: 'border-sea/45 bg-transparent text-sea hover:border-sea/70 hover:bg-sea/[0.045] dark:border-accent-blue/45 dark:text-accent-blue dark:hover:border-accent-blue/70 dark:hover:bg-accent-blue/[0.07]',
|
|
9
|
+
subtle: 'border-transparent bg-light-sand/75 text-deep-sea hover:bg-sand/25 dark:bg-white/[0.07] dark:text-text-primary dark:hover:bg-white/[0.11]',
|
|
10
|
+
ghost: 'border-transparent bg-transparent text-text-primary hover:bg-sand/12 dark:text-text-primary dark:hover:bg-white/[0.06]',
|
|
11
|
+
link: 'h-auto border-transparent bg-transparent px-0 text-sea underline-offset-4 hover:text-deep-sea hover:underline active:translate-y-0 active:scale-100 dark:text-accent-blue dark:hover:text-light-sand',
|
|
12
|
+
destructive: 'border-terracotta bg-terracotta text-white shadow-[0_1px_2px_rgba(133,71,47,0.14)] hover:border-terracotta/90 hover:bg-terracotta/90 hover:shadow-[0_4px_12px_-7px_rgba(133,71,47,0.38)]'
|
|
9
13
|
};
|
|
10
14
|
const sizeClasses = {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
xs: 'h-7 gap-1.5 px-2.5 text-xs',
|
|
16
|
+
sm: 'h-9 px-3.5 text-[13px]',
|
|
17
|
+
md: 'h-10 px-[18px] text-sm',
|
|
18
|
+
lg: 'h-12 px-6 text-[15px]'
|
|
14
19
|
};
|
|
15
|
-
export const Button = React.forwardRef(function Button({ className, size = 'md', type = 'button', variant = 'primary', as = 'button', href, ...props }, ref) {
|
|
16
|
-
const classes = cn('inline-flex items-center justify-center gap-2 rounded-[var(--radius-button)] border font-[
|
|
20
|
+
export const Button = React.forwardRef(function Button({ children, className, disabled, fullWidth = false, loading = false, size = 'md', type = 'button', variant = 'primary', as = 'button', href, ...props }, ref) {
|
|
21
|
+
const classes = cn('inline-flex shrink-0 translate-y-0 scale-100 items-center justify-center gap-2 whitespace-nowrap rounded-[var(--radius-button)] border font-medium tracking-ui transition-[background-color,border-color,color,box-shadow,transform,opacity] duration-[var(--motion-control)] ease-premium outline-none active:translate-y-px active:scale-[0.99] active:shadow-none focus-visible:ring-2 focus-visible:ring-sea/35 focus-visible:ring-offset-2 focus-visible:ring-offset-white disabled:pointer-events-none disabled:transform-none disabled:opacity-45 dark:focus-visible:ring-accent-blue/45 dark:focus-visible:ring-offset-deep-sea', variantClasses[variant], variant !== 'link' && sizeClasses[size], fullWidth && 'w-full', className);
|
|
17
22
|
if (as === 'a' || href) {
|
|
18
|
-
return (
|
|
23
|
+
return (_jsxs("a", { ref: ref, href: href, "aria-busy": loading || undefined, "aria-disabled": disabled || loading || undefined, className: classes, ...props, children: [loading ? _jsx(LoaderCircle, { className: 'size-4 animate-spin', "aria-hidden": 'true' }) : null, children] }));
|
|
19
24
|
}
|
|
20
|
-
return (
|
|
25
|
+
return (_jsxs("button", { ref: ref, type: type, disabled: disabled || loading, "aria-busy": loading || undefined, className: classes, ...props, children: [loading ? _jsx(LoaderCircle, { className: 'size-4 animate-spin', "aria-hidden": 'true' }) : null, children] }));
|
|
21
26
|
});
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { CardPadding, CardVariant } from '../core';
|
|
3
|
+
export type { CardPadding, CardVariant } from '../core';
|
|
2
4
|
export interface CardProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
padding?: CardPadding;
|
|
6
|
+
variant?: CardVariant;
|
|
3
7
|
}
|
|
4
|
-
export declare function Card({ className, ...props }: CardProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function Card({ className, padding, variant, ...props }: CardProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/components/card.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { cn } from '../utils/cn.js';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
const paddingClasses = { none: 'p-0', sm: 'p-4', md: 'p-6', lg: 'p-8' };
|
|
4
|
+
export function Card({ className, padding = 'md', variant = 'surface', ...props }) {
|
|
5
|
+
return (_jsx("div", { className: cn('relative overflow-hidden rounded-[var(--radius-card)] transition-[background-color,border-color,box-shadow,transform] duration-[var(--motion-surface)] ease-premium', paddingClasses[padding], variant === 'surface' && 'border border-sand/30 bg-white shadow-[var(--shadow-surface)] dark:border-white/[0.09] dark:bg-deep-sea dark:shadow-none', variant === 'outlined' && 'border border-sand/40 bg-white shadow-none dark:border-white/15 dark:bg-deep-sea', variant === 'elevated' && 'border border-sand/25 bg-white shadow-[var(--shadow-raised)] dark:border-white/10 dark:bg-deep-sea', variant === 'subtle' && 'border border-sand/20 bg-light-sand/45 shadow-none dark:border-white/[0.07] dark:bg-white/[0.035]', variant === 'transparent' && 'border border-transparent bg-transparent shadow-none', className), ...props }));
|
|
5
6
|
}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { cn } from '../utils/cn.js';
|
|
4
4
|
export const Checkbox = React.forwardRef(function Checkbox({ className, containerClassName, description, id, label, ...props }, ref) {
|
|
5
|
-
const checkbox = (_jsxs("div", { className: 'relative flex h-5 w-5 shrink-0 items-center justify-center', children: [_jsx("input", { ref: ref, id: id, type: 'checkbox', className: cn('peer absolute inset-0 m-0 h-full w-full appearance-none rounded
|
|
5
|
+
const checkbox = (_jsxs("div", { className: 'relative flex h-5 w-5 shrink-0 items-center justify-center', children: [_jsx("input", { ref: ref, id: id, type: 'checkbox', className: cn('peer absolute inset-0 m-0 h-full w-full appearance-none rounded border border-sand/60 bg-white transition-[background-color,border-color,box-shadow,opacity] duration-[var(--motion-control)] ease-premium hover:border-sea/50 checked:border-sea checked:bg-sea focus:outline-none focus-visible:ring-2 focus-visible:ring-sea/20 focus-visible:ring-offset-2 focus-visible:ring-offset-white disabled:cursor-not-allowed disabled:opacity-50 dark:border-white/20 dark:bg-deep-sea dark:checked:border-accent-blue dark:checked:bg-accent-blue dark:focus-visible:ring-offset-deep-sea', className), ...props }), _jsx("svg", { className: 'pointer-events-none relative z-10 h-3.5 w-3.5 text-white opacity-0 transition-opacity duration-[var(--motion-control)] ease-premium peer-checked:opacity-100', viewBox: '0 0 14 10', fill: 'none', xmlns: 'http://www.w3.org/2000/svg', children: _jsx("path", { d: 'M1 5L4.5 8.5L13 1', stroke: 'currentColor', strokeWidth: '2', strokeLinecap: 'round', strokeLinejoin: 'round' }) })] }));
|
|
6
6
|
if (!label && !description) {
|
|
7
7
|
return checkbox;
|
|
8
8
|
}
|
|
@@ -16,9 +16,10 @@ export interface CollectionFiltersProps {
|
|
|
16
16
|
className?: string;
|
|
17
17
|
currentFilters: Record<string, boolean | string>;
|
|
18
18
|
currentSort: SortState;
|
|
19
|
+
defaultExpanded?: boolean;
|
|
19
20
|
filterOptions: CollectionFilterOption[];
|
|
20
21
|
onFilterChange: (filters: Record<string, boolean | string>) => void;
|
|
21
22
|
onSortChange: (sort: SortState) => void;
|
|
22
23
|
sortOptions: CollectionSortOption[];
|
|
23
24
|
}
|
|
24
|
-
export declare function CollectionFilters({ className, currentFilters, currentSort, filterOptions, onFilterChange, onSortChange, sortOptions }: CollectionFiltersProps): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export declare function CollectionFilters({ className, currentFilters, currentSort, defaultExpanded, filterOptions, onFilterChange, onSortChange, sortOptions }: CollectionFiltersProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,13 +1,43 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
import { ArrowUpDown, Filter, X } from 'lucide-react';
|
|
3
4
|
import React from 'react';
|
|
4
5
|
import { Button } from './button.js';
|
|
6
|
+
import { DatePicker } from './date-picker.js';
|
|
5
7
|
import { IconButton } from './icon-button.js';
|
|
6
8
|
import { Select } from './select.js';
|
|
7
9
|
import { cn } from '../utils/cn.js';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
function parseDateValue(value) {
|
|
11
|
+
if (!value)
|
|
12
|
+
return null;
|
|
13
|
+
const [year, month, day] = value.split('-').map(Number);
|
|
14
|
+
if (!year || !month || !day)
|
|
15
|
+
return null;
|
|
16
|
+
return new Date(year, month - 1, day);
|
|
17
|
+
}
|
|
18
|
+
function serializeDateValue(value) {
|
|
19
|
+
if (!value)
|
|
20
|
+
return '';
|
|
21
|
+
const year = value.getFullYear();
|
|
22
|
+
const month = String(value.getMonth() + 1).padStart(2, '0');
|
|
23
|
+
const day = String(value.getDate()).padStart(2, '0');
|
|
24
|
+
return `${year}-${month}-${day}`;
|
|
25
|
+
}
|
|
26
|
+
export function CollectionFilters({ className, currentFilters, currentSort, defaultExpanded = false, filterOptions, onFilterChange, onSortChange, sortOptions }) {
|
|
27
|
+
const [showFilters, setShowFilters] = React.useState(defaultExpanded);
|
|
10
28
|
const activeFilterCount = Object.keys(currentFilters).length;
|
|
29
|
+
if (filterOptions.length === 0 && sortOptions.length === 0)
|
|
30
|
+
return null;
|
|
31
|
+
const getFilterDisplayValue = (field, value) => {
|
|
32
|
+
const option = filterOptions.find((item) => item.field === field);
|
|
33
|
+
if (typeof value === 'boolean')
|
|
34
|
+
return value ? 'Yes' : 'No';
|
|
35
|
+
if (option?.type === 'date') {
|
|
36
|
+
const date = parseDateValue(value);
|
|
37
|
+
return date?.toLocaleDateString(undefined, { day: 'numeric', month: 'short', year: 'numeric' }) ?? value;
|
|
38
|
+
}
|
|
39
|
+
return option?.options?.find((item) => item.value === value)?.label ?? value;
|
|
40
|
+
};
|
|
11
41
|
const handleFilterChange = (field, value) => {
|
|
12
42
|
const nextFilters = { ...currentFilters };
|
|
13
43
|
if (value === '' || value === null || value === undefined) {
|
|
@@ -18,9 +48,12 @@ export function CollectionFilters({ className, currentFilters, currentSort, filt
|
|
|
18
48
|
}
|
|
19
49
|
onFilterChange(nextFilters);
|
|
20
50
|
};
|
|
21
|
-
return (_jsxs("
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
51
|
+
return (_jsxs("section", { className: cn('mb-6 overflow-hidden rounded-[var(--radius-card)] border border-sand/30 bg-white shadow-[var(--shadow-surface)] dark:border-white/10 dark:bg-deep-sea', className), children: [_jsxs("div", { className: 'flex min-h-14 flex-wrap items-center justify-between gap-3 px-4 py-3 sm:px-5', children: [_jsxs("div", { className: 'flex flex-wrap items-center gap-2', children: [_jsxs(Button, { variant: showFilters ? 'subtle' : 'outline', size: 'sm', onClick: () => setShowFilters((open) => !open), "aria-expanded": showFilters, children: [_jsx(Filter, { size: 15 }), "Filters", activeFilterCount > 0 ? (_jsx("span", { className: 'ml-0.5 flex h-5 min-w-5 items-center justify-center rounded-[5px] bg-sea px-1.5 text-[11px] font-semibold tabular-nums text-white dark:bg-accent-blue dark:text-deep-sea', children: activeFilterCount })) : null] }), activeFilterCount > 0 ? (_jsx(Button, { variant: 'link', size: 'sm', onClick: () => onFilterChange({}), className: 'ml-1 text-[12px] text-text-secondary hover:text-terracotta', children: "Clear all" })) : null] }), sortOptions.length > 0 ? _jsxs("div", { className: 'flex items-center gap-2', children: [_jsx("span", { className: 'hidden text-[11px] font-medium uppercase tracking-[0.08em] text-text-secondary sm:inline', children: "Sort" }), _jsx("div", { className: 'w-44', children: _jsx(Select, { "aria-label": 'Sort collection by', value: currentSort.field, onChange: (value) => onSortChange({ field: value, order: currentSort.order }), options: sortOptions.map((option) => ({ label: option.label, value: option.field })) }) }), _jsx(IconButton, { onClick: () => onSortChange({ field: currentSort.field, order: currentSort.order === 'asc' ? 'desc' : 'asc' }), size: 'md', variant: 'ghost', title: `Sort ${currentSort.order === 'asc' ? 'Descending' : 'Ascending'}`, "aria-label": `Sort ${currentSort.order === 'asc' ? 'descending' : 'ascending'}`, children: _jsx(ArrowUpDown, { size: 16, className: cn('transition-transform duration-[var(--motion-surface)] ease-premium', currentSort.order === 'desc' && 'rotate-180') }) })] }) : null] }), activeFilterCount > 0 ? (_jsx("div", { className: 'flex flex-wrap items-center gap-2 border-t border-sand/20 bg-light-sand/20 px-4 py-2.5 dark:border-white/[0.07] dark:bg-white/[0.025] sm:px-5', children: Object.entries(currentFilters).map(([field, value]) => {
|
|
52
|
+
const label = filterOptions.find((option) => option.field === field)?.label ?? field;
|
|
53
|
+
return (_jsxs("button", { type: 'button', onClick: () => handleFilterChange(field, null), className: 'group inline-flex h-7 scale-100 items-center gap-1.5 rounded-[6px] border border-sand/35 bg-white px-2.5 text-[12px] text-text-secondary transition-[background-color,border-color,color,transform] duration-[var(--motion-control)] ease-premium hover:border-terracotta/35 hover:text-text-primary active:scale-[0.98] dark:border-white/10 dark:bg-deep-sea', "aria-label": `Remove ${label} filter`, children: [_jsx("span", { className: 'font-medium text-text-primary', children: label }), _jsx("span", { children: getFilterDisplayValue(field, value) }), _jsx(X, { size: 12, className: 'ml-0.5 opacity-55 transition-[color,opacity] duration-[var(--motion-control)] ease-premium group-hover:text-terracotta group-hover:opacity-100' })] }, field));
|
|
54
|
+
}) })) : null, showFilters ? (_jsxs("div", { className: 'border-t border-sand/25 bg-light-sand/25 px-4 py-5 dark:border-white/[0.08] dark:bg-white/[0.025] sm:px-5', children: [_jsxs("div", { className: 'mb-4', children: [_jsx("p", { className: 'text-sm font-medium text-text-primary', children: "Refine results" }), _jsx("p", { className: 'font-secondary mt-0.5 text-xs text-text-secondary', children: "Selections apply immediately." })] }), _jsx("div", { className: 'grid grid-cols-1 gap-x-5 gap-y-5 md:grid-cols-2 lg:grid-cols-3', children: filterOptions.map((option) => (_jsxs("div", { className: 'space-y-2.5', children: [_jsx("label", { className: 'block text-[12px] font-medium tracking-ui text-text-primary dark:text-text-primary', children: option.label }), option.type === 'select' && option.options ? (_jsx(Select, { "aria-label": option.label, value: currentFilters[option.field] || '', onChange: (value) => handleFilterChange(option.field, value), options: [{ label: 'All', value: '' }, ...option.options] })) : null, option.type === 'boolean' ? (_jsx(Select, { "aria-label": option.label, value: currentFilters[option.field] === undefined ? '' : String(currentFilters[option.field]), onChange: (value) => handleFilterChange(option.field, value === '' ? null : value === 'true'), options: [
|
|
55
|
+
{ label: 'All', value: '' },
|
|
56
|
+
{ label: 'Yes', value: 'true' },
|
|
57
|
+
{ label: 'No', value: 'false' }
|
|
58
|
+
] })) : null, option.type === 'date' ? (_jsx(DatePicker, { "aria-label": option.label, className: 'w-full', triggerClassName: 'w-full', placeholder: `Choose ${option.label.toLowerCase()}`, value: parseDateValue(currentFilters[option.field]), onChange: (date) => handleFilterChange(option.field, serializeDateValue(date)) })) : null] }, option.field))) })] })) : null] }));
|
|
26
59
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
import { Search } from 'lucide-react';
|
|
3
4
|
import React from 'react';
|
|
@@ -5,6 +6,7 @@ import { createPortal } from 'react-dom';
|
|
|
5
6
|
import { Button } from './button.js';
|
|
6
7
|
import { Kbd } from './kbd.js';
|
|
7
8
|
import { cn } from '../utils/cn.js';
|
|
9
|
+
import { usePresence } from '../utils/hooks.js';
|
|
8
10
|
const DEFAULT_GROUP = 'Actions';
|
|
9
11
|
function normalize(text) {
|
|
10
12
|
return text.trim().toLowerCase();
|
|
@@ -28,6 +30,7 @@ export function CommandSpotlight({ actions, className, dialogClassName, emptyMes
|
|
|
28
30
|
const actionRefs = React.useRef({});
|
|
29
31
|
const isControlled = typeof open === 'boolean';
|
|
30
32
|
const isOpen = isControlled ? open : isOpenInternal;
|
|
33
|
+
const { present: isOverlayPresent, visible: isOverlayVisible } = usePresence(isOpen, 160);
|
|
31
34
|
const setIsOpen = React.useCallback((nextIsOpen) => {
|
|
32
35
|
if (!isControlled) {
|
|
33
36
|
setIsOpenInternal(nextIsOpen);
|
|
@@ -169,9 +172,11 @@ export function CommandSpotlight({ actions, className, dialogClassName, emptyMes
|
|
|
169
172
|
}, [hotkey, isMacLike]);
|
|
170
173
|
const renderTrigger = showTrigger ? (_jsxs(Button, { type: 'button', variant: 'secondary', size: 'sm', onClick: () => {
|
|
171
174
|
setIsOpen(true);
|
|
172
|
-
}, className: cn('border-sand/
|
|
173
|
-
const renderOverlay =
|
|
174
|
-
? createPortal(_jsxs("div", { className: cn('fixed inset-0 z-9999 flex items-start justify-center px-4 pt-[12vh]', overlayClassName), children: [_jsx("button", { type: 'button', onClick: closeSpotlight, className: 'absolute inset-0 bg-black/45 backdrop-blur-sm', "aria-label": 'Close command spotlight' }), _jsxs("div", { role: 'dialog', "aria-modal": 'true', className: cn('relative z-10 w-full max-w-2xl overflow-hidden rounded-[
|
|
175
|
+
}, className: cn('border-sand/35 bg-white px-3 py-1.5 text-text-primary shadow-[0_1px_2px_rgba(26,55,77,0.03)] hover:border-sand/65 hover:bg-light-sand/35 dark:border-white/15 dark:bg-deep-sea dark:hover:bg-white/[0.06]', triggerClassName), "aria-label": 'Open command spotlight', children: [_jsx(Search, { size: 15, className: 'text-text-secondary dark:text-text-secondary' }), _jsx("span", { className: 'hidden sm:inline', children: triggerLabel }), _jsx(Kbd, { keys: hotkeyHint, className: 'hidden sm:inline-flex' })] })) : null;
|
|
176
|
+
const renderOverlay = isOverlayPresent && typeof document !== 'undefined'
|
|
177
|
+
? createPortal(_jsxs("div", { className: cn('fixed inset-0 z-9999 flex items-start justify-center px-4 pt-[12vh]', overlayClassName), children: [_jsx("button", { type: 'button', onClick: closeSpotlight, className: cn('absolute inset-0 bg-black/45 backdrop-blur-sm transition-opacity', isOverlayVisible ? 'opacity-100 duration-[var(--motion-overlay)] ease-premium' : 'opacity-0 duration-[160ms] ease-in'), "aria-label": 'Close command spotlight' }), _jsxs("div", { role: 'dialog', "aria-modal": 'true', className: cn('relative z-10 w-full max-w-2xl overflow-hidden rounded-[var(--radius-dialog)] border border-sand/30 bg-white text-text-primary shadow-[var(--shadow-overlay)] transition-[opacity,transform] dark:border-white/12 dark:bg-deep-sea dark:text-text-primary', isOverlayVisible
|
|
178
|
+
? 'translate-y-0 scale-100 opacity-100 duration-[var(--motion-overlay)] ease-premium'
|
|
179
|
+
: '-translate-y-1 scale-[0.992] opacity-0 duration-[160ms] ease-in', dialogClassName), onClick: (event) => event.stopPropagation(), children: [_jsxs("div", { className: 'flex items-center gap-3 border-b border-sand/15 px-4 py-3 dark:border-sand/20', children: [_jsx(Search, { size: 18, className: 'shrink-0 text-text-secondary dark:text-text-secondary' }), _jsx("input", { ref: inputRef, type: 'text', value: query, onChange: (event) => setQuery(event.target.value), onKeyDown: (event) => {
|
|
175
180
|
if (event.key === 'ArrowDown') {
|
|
176
181
|
event.preventDefault();
|
|
177
182
|
moveSelection(1);
|
|
@@ -200,9 +205,9 @@ export function CommandSpotlight({ actions, className, dialogClassName, emptyMes
|
|
|
200
205
|
if (!action.disabled) {
|
|
201
206
|
setSelectedActionId(action.id);
|
|
202
207
|
}
|
|
203
|
-
}, className: cn('flex w-full items-center justify-between gap-3 rounded-
|
|
208
|
+
}, className: cn('flex w-full items-center justify-between gap-3 rounded-[var(--radius-ui)] px-3 py-2.5 text-left transition-colors duration-[var(--motion-control)] ease-premium', isSelected
|
|
204
209
|
? 'bg-sea/10 text-sea dark:bg-accent-blue/15 dark:text-accent-blue'
|
|
205
|
-
: 'text-text-primary hover:bg-sand/10 dark:text-text-primary dark:hover:bg-sand/15', action.disabled && 'cursor-not-allowed opacity-40'), children: [_jsxs("div", { className: 'flex min-w-0 items-center gap-3', children: [action.icon ? (_jsx("span", { className: 'flex h-8 w-8 shrink-0 items-center justify-center rounded-
|
|
210
|
+
: 'text-text-primary hover:bg-sand/10 dark:text-text-primary dark:hover:bg-sand/15', action.disabled && 'cursor-not-allowed opacity-40'), children: [_jsxs("div", { className: 'flex min-w-0 items-center gap-3', children: [action.icon ? (_jsx("span", { className: 'flex h-8 w-8 shrink-0 items-center justify-center rounded-[7px] border border-sand/15 bg-light-sand/50 text-text-secondary dark:border-white/[0.06] dark:bg-white/[0.05] dark:text-text-secondary', children: action.icon })) : null, _jsxs("div", { className: 'min-w-0', children: [_jsx("p", { className: 'truncate text-sm font-medium', children: action.title }), action.description ? (_jsx("p", { className: 'truncate text-xs text-text-secondary dark:text-text-secondary', children: action.description })) : null] })] }), action.shortcut && action.shortcut.length > 0 ? _jsx(Kbd, { keys: action.shortcut }) : null] }, action.id));
|
|
206
211
|
}) })] }, group)))) })] })] }), document.body)
|
|
207
212
|
: null;
|
|
208
213
|
return (_jsxs("div", { className: className, children: [renderTrigger, renderOverlay] }));
|
|
@@ -4,8 +4,8 @@ import * as ContextMenuPrimitive from '@radix-ui/react-context-menu';
|
|
|
4
4
|
import { cn } from '../utils/cn.js';
|
|
5
5
|
const ContextMenu = ContextMenuPrimitive.Root;
|
|
6
6
|
const ContextMenuTrigger = ContextMenuPrimitive.Trigger;
|
|
7
|
-
const ContextMenuContent = React.forwardRef(({ className, ...props }, ref) => (_jsx(ContextMenuPrimitive.Portal, { children: _jsx(ContextMenuPrimitive.Content, { ref: ref, className: cn('z-50 min-w-[
|
|
7
|
+
const ContextMenuContent = React.forwardRef(({ className, ...props }, ref) => (_jsx(ContextMenuPrimitive.Portal, { children: _jsx(ContextMenuPrimitive.Content, { ref: ref, className: cn('z-50 min-w-[10rem] overflow-hidden rounded-[var(--radius-ui)] border border-sand/35 bg-white p-1.5 text-text-primary shadow-[var(--shadow-overlay)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0 data-[state=open]:zoom-in-[0.99] data-[state=closed]:zoom-out-[0.99] data-[state=open]:duration-[var(--motion-surface)] data-[state=closed]:duration-[var(--motion-exit)] data-[state=open]:ease-premium data-[state=closed]:ease-in dark:border-white/15 dark:bg-deep-sea dark:text-text-primary', className), ...props }) })));
|
|
8
8
|
ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;
|
|
9
|
-
const ContextMenuItem = React.forwardRef(({ className, inset, ...props }, ref) => (_jsx(ContextMenuPrimitive.Item, { ref: ref, className: cn('relative flex cursor-default select-none items-center rounded-
|
|
9
|
+
const ContextMenuItem = React.forwardRef(({ className, inset, ...props }, ref) => (_jsx(ContextMenuPrimitive.Item, { ref: ref, className: cn('relative flex min-h-9 cursor-default select-none items-center rounded-[5px] px-2.5 py-1.5 text-[13px] text-text-primary outline-none transition-colors duration-[var(--motion-control)] ease-premium focus:bg-light-sand data-[disabled]:pointer-events-none data-[disabled]:opacity-40 dark:text-text-primary dark:focus:bg-white/[0.07]', inset && 'pl-8', className), ...props })));
|
|
10
10
|
ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;
|
|
11
11
|
export { ContextMenu, ContextMenuTrigger, ContextMenuContent, ContextMenuItem };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cn } from '../utils/cn.js';
|
|
3
3
|
export function DashboardSection({ title, description, children, className, headerClassName, action }) {
|
|
4
|
-
return (_jsxs("section", { className: cn('space-y-
|
|
4
|
+
return (_jsxs("section", { className: cn('space-y-5', className), children: [(title || description || action) && (_jsxs("div", { className: cn('flex flex-col gap-2 sm:flex-row sm:items-end sm:justify-between', headerClassName), children: [_jsxs("div", { children: [title && _jsx("h2", { className: 'text-lg font-medium tracking-refined text-text-primary dark:text-text-primary', children: title }), description && _jsx("p", { className: 'font-secondary mt-1 text-sm text-text-secondary dark:text-text-secondary', children: description })] }), action && _jsx("div", { className: 'flex items-center gap-2', children: action })] })), children] }));
|
|
5
5
|
}
|