@gaulatti/bleecker 0.1.35 → 0.1.37

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.
Files changed (122) hide show
  1. package/README.md +75 -0
  2. package/dist/components/accordion.js +3 -2
  3. package/dist/components/activity-item.js +1 -1
  4. package/dist/components/alert-dialog.js +24 -11
  5. package/dist/components/alert.d.ts +2 -1
  6. package/dist/components/alert.js +11 -10
  7. package/dist/components/avatar.d.ts +2 -1
  8. package/dist/components/avatar.js +1 -0
  9. package/dist/components/bauhaus-background.js +1 -1
  10. package/dist/components/brand-lockup.d.ts +1 -1
  11. package/dist/components/brand-lockup.js +3 -3
  12. package/dist/components/breadcrumb.js +3 -2
  13. package/dist/components/button.d.ts +3 -5
  14. package/dist/components/button.js +17 -12
  15. package/dist/components/card.d.ts +5 -1
  16. package/dist/components/card.js +3 -2
  17. package/dist/components/checkbox.js +1 -1
  18. package/dist/components/collection-filters.d.ts +2 -1
  19. package/dist/components/collection-filters.js +40 -7
  20. package/dist/components/command-spotlight.js +10 -5
  21. package/dist/components/context-menu.js +2 -2
  22. package/dist/components/dashboard-section.js +1 -1
  23. package/dist/components/data-list.js +1 -1
  24. package/dist/components/data-table-column-toggle.js +8 -20
  25. package/dist/components/data-table.js +2 -1
  26. package/dist/components/date-picker.d.ts +3 -1
  27. package/dist/components/date-picker.js +11 -29
  28. package/dist/components/date-range-picker.d.ts +3 -3
  29. package/dist/components/date-range-picker.js +24 -9
  30. package/dist/components/dialog-close-button.js +2 -2
  31. package/dist/components/donut-chart.js +1 -1
  32. package/dist/components/drawer.js +8 -22
  33. package/dist/components/dropdown-menu.js +7 -7
  34. package/dist/components/empty.js +1 -1
  35. package/dist/components/error-state.js +1 -1
  36. package/dist/components/feed-item.js +1 -1
  37. package/dist/components/field-help-tooltip.js +1 -1
  38. package/dist/components/field.d.ts +17 -0
  39. package/dist/components/field.js +16 -0
  40. package/dist/components/file-input.js +1 -1
  41. package/dist/components/filter-chip.js +2 -2
  42. package/dist/components/header-select.d.ts +13 -2
  43. package/dist/components/header-select.js +7 -3
  44. package/dist/components/hero-carousel.js +3 -2
  45. package/dist/components/hover-card.js +1 -1
  46. package/dist/components/icon-badge.d.ts +5 -2
  47. package/dist/components/icon-badge.js +2 -2
  48. package/dist/components/icon-button.d.ts +4 -0
  49. package/dist/components/icon-button.js +3 -2
  50. package/dist/components/input.d.ts +2 -3
  51. package/dist/components/input.js +5 -5
  52. package/dist/components/label.js +1 -1
  53. package/dist/components/loading-overlay.js +1 -1
  54. package/dist/components/loading-spinner.d.ts +3 -1
  55. package/dist/components/media-library.js +5 -3
  56. package/dist/components/menubar.js +17 -7
  57. package/dist/components/metric.d.ts +2 -2
  58. package/dist/components/metric.js +1 -0
  59. package/dist/components/modal.js +53 -13
  60. package/dist/components/navigation-menu.js +15 -5
  61. package/dist/components/notification-badge.js +1 -1
  62. package/dist/components/otp-input.js +2 -1
  63. package/dist/components/page-header.js +1 -1
  64. package/dist/components/pagination.js +3 -3
  65. package/dist/components/panel.js +1 -1
  66. package/dist/components/popover.d.ts +3 -2
  67. package/dist/components/popover.js +4 -91
  68. package/dist/components/progress.d.ts +4 -2
  69. package/dist/components/progress.js +3 -3
  70. package/dist/components/radio-group.d.ts +3 -1
  71. package/dist/components/radio-group.js +2 -2
  72. package/dist/components/sankey-chart.js +1 -0
  73. package/dist/components/search-input.js +1 -1
  74. package/dist/components/section-header.js +1 -1
  75. package/dist/components/select.d.ts +12 -1
  76. package/dist/components/select.js +13 -64
  77. package/dist/components/sheet.js +8 -24
  78. package/dist/components/sidebar.js +4 -3
  79. package/dist/components/slider.js +2 -2
  80. package/dist/components/sonner.js +3 -2
  81. package/dist/components/stat-card.js +1 -1
  82. package/dist/components/status-badge.d.ts +2 -1
  83. package/dist/components/status-badge.js +5 -6
  84. package/dist/components/stepper.js +2 -2
  85. package/dist/components/sunburst-chart.js +1 -0
  86. package/dist/components/switch.js +1 -1
  87. package/dist/components/table.js +10 -8
  88. package/dist/components/tabs.d.ts +6 -1
  89. package/dist/components/tabs.js +30 -7
  90. package/dist/components/textarea.d.ts +2 -3
  91. package/dist/components/textarea.js +2 -2
  92. package/dist/components/theme-toggle.js +1 -0
  93. package/dist/components/timeline.js +1 -1
  94. package/dist/components/toggle-group.js +2 -1
  95. package/dist/components/toggle.d.ts +4 -2
  96. package/dist/components/toggle.js +1 -1
  97. package/dist/components/tooltip.d.ts +2 -1
  98. package/dist/components/tooltip.js +3 -21
  99. package/dist/core/contracts.d.ts +48 -0
  100. package/dist/core/contracts.js +23 -0
  101. package/dist/core/index.d.ts +2 -0
  102. package/dist/core/index.js +2 -0
  103. package/dist/index.d.ts +3 -0
  104. package/dist/index.js +3 -0
  105. package/dist/layout/admin-shell.js +1 -1
  106. package/dist/layout/app-shell.js +1 -1
  107. package/dist/layout/footer.js +4 -4
  108. package/dist/layout/header.js +2 -1
  109. package/dist/styles.css +1 -1
  110. package/dist/theme/theme-provider.js +1 -0
  111. package/dist/theme/theme-script.d.ts +1 -2
  112. package/dist/theme/theme-script.js +1 -3
  113. package/dist/theme/types.d.ts +2 -1
  114. package/dist/tokens/index.d.ts +1 -0
  115. package/dist/tokens/index.js +1 -0
  116. package/dist/tokens/source.d.ts +221 -0
  117. package/dist/tokens/source.js +140 -0
  118. package/dist/utils/hooks.d.ts +14 -0
  119. package/dist/utils/hooks.js +101 -0
  120. package/package.json +41 -7
  121. package/src/styles/global.css +82 -175
  122. 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-xl border border-sand/10 bg-white shadow-sm dark:border-sand/20 dark:bg-sand/10', className), children: _jsx("ul", { className: 'divide-y divide-sand/10 dark:divide-sand/20', children: items.map((item) => {
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 cursor-pointer items-center justify-between px-4 py-4 transition-colors hover:bg-sand/5 dark:hover:bg-sand/10 sm:px-6', onClick: () => setExpandedId(isExpanded ? null : item.id), children: [_jsxs("div", { className: 'flex min-w-0 items-center gap-3', children: [_jsx(ChevronDown, { size: 16, className: cn('flex-shrink-0 text-text-secondary transition-transform duration-300 ease-in-out', 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: 'mt-0.5 text-xs text-text-secondary dark:text-text-secondary', children: item.subtitle }) : null] })] }), item.actions ? (_jsx("div", { className: 'ml-4 flex items-center gap-2', onClick: (event) => event.stopPropagation(), children: item.actions })) : null] }), _jsx("div", { className: cn('grid transition-[grid-template-rows] duration-300 ease-in-out', isExpanded ? 'grid-rows-[1fr]' : 'grid-rows-[0fr]'), children: _jsx("div", { className: 'overflow-hidden', children: _jsx("div", { className: 'bg-sand/5 dark:bg-sand/5', children: item.content }) }) })] }, item.id));
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-4 border-b border-black/[0.04] p-4 transition-colors hover:bg-black/[0.02] dark:border-white/[0.04] dark:hover:bg-white/[0.02]', className), children: [_jsx(Avatar, { fallback: init, size: 'sm' }), _jsxs("div", { className: 'flex-1 space-y-1', children: [_jsx("p", { className: 'text-sm font-medium leading-none text-text-primary', children: title }), _jsx("p", { className: 'text-xs text-text-secondary', children: time })] })] }));
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.useEffect(() => {
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
- else if (!isOpen && dialog.open) {
17
- dialog.close();
18
- }
19
- }, [isOpen]);
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' || !isOpen) {
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-[24px] border border-sand/10 bg-white p-0 text-text-primary shadow-xl outline-none backdrop:bg-black/50 backdrop:backdrop-blur-sm dark:border-sand/20 dark:bg-dark-sand dark:text-text-primary dark:backdrop:bg-black/70', className), onClick: (event) => {
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
- }, onClose: onCancel, children: _jsxs("div", { className: 'p-6', children: [_jsxs("div", { className: 'mb-4 flex items-start gap-4', children: [_jsx("div", { className: cn('flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-full', variant === 'destructive'
42
- ? 'bg-terracotta/10 text-terracotta dark:bg-terracotta/20'
43
- : 'bg-desert/10 text-desert dark:bg-desert/20 dark:text-accent-gold'), children: _jsx(AlertTriangle, { size: 20 }) }), _jsxs("div", { className: 'min-w-0 flex-1', children: [_jsx("h3", { className: 'text-lg font-semibold leading-tight text-text-primary dark:text-text-primary', children: title }), description ? _jsx("p", { className: 'mt-1.5 text-sm leading-relaxed text-text-secondary dark:text-text-secondary', children: description }) : null] })] }), _jsxs("div", { className: 'flex justify-end gap-3', 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);
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
  }
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
- export type AlertType = 'success' | 'error' | 'info' | 'warning';
2
+ import type { AlertType } from '../core';
3
+ export type { AlertType } from '../core';
3
4
  export interface AlertProps {
4
5
  className?: string;
5
6
  duration?: number;
@@ -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/80 dark:bg-deep-sea/80',
10
- borderColor: 'ring-sea/20 dark:ring-accent-blue/20',
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/80 dark:bg-deep-sea/80',
17
- borderColor: 'ring-terracotta/20 dark:ring-terracotta/30',
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/80 dark:bg-deep-sea/80',
24
- borderColor: 'ring-sunset/30 dark:ring-sunset/20',
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/80 dark:bg-deep-sea/80',
31
- borderColor: 'ring-desert/20 dark:ring-desert/20',
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, 300);
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-button)] ring-1 ring-inset shadow-[0_8px_32px_rgba(0,0,0,0.08)] backdrop-blur-xl transition-all duration-400 ease-out-expo dark:shadow-[0_8px_32px_rgba(0,0,0,0.3)]', config.bgColor, config.borderColor, isVisible ? 'translate-y-0 scale-100 opacity-100' : 'translate-y-4 scale-95 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 tracking-refined', config.textColor), children: message }), _jsx("button", { type: 'button', onClick: handleClose, className: cn('hover:bg-black/5 dark:hover:bg-white/10 -mr-1 -mt-0.5 rounded-md p-1 transition-colors duration-200', config.textColor), "aria-label": 'Close alert', children: _jsx(X, { className: 'h-4 w-4' }) })] }) }) }), document.body);
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 = [];
@@ -1,4 +1,5 @@
1
- export type AvatarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
1
+ import type { AvatarSize } from '../core';
2
+ export type { AvatarSize } from '../core';
2
3
  export interface AvatarProps {
3
4
  alt?: string;
4
5
  className?: string;
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  import React from 'react';
3
4
  import { cn } from '../utils/cn.js';
@@ -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 transition-transform duration-300 hover:rotate-3', 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 transition-transform duration-300 hover:rotate-3' }, `square-${index}`))) }) })) : null] })] }));
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
  }
@@ -4,7 +4,7 @@ export interface BrandLockupProps {
4
4
  href: string;
5
5
  logoAlt?: string;
6
6
  logoSrc?: string;
7
- name: string;
7
+ name?: string;
8
8
  renderLink?: RenderLink<NavItem>;
9
9
  size?: 'sm' | 'lg';
10
10
  }
@@ -8,9 +8,9 @@ export function BrandLockup({ className, href, logoAlt = 'gaulatti', logoSrc = g
8
8
  return (_jsx(_Fragment, { children: linkRenderer({
9
9
  item: {
10
10
  href,
11
- label: name
11
+ label: name ?? logoAlt
12
12
  },
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-gradient-to-b from-sunset/0 via-sunset to-sunset/0', isLarge ? 'h-12' : 'h-8') }), _jsx("span", { className: cn('font-[family-name:var(--font-display)] font-bold tracking-tight text-text-primary dark:text-text-primary', isLarge ? 'text-3xl' : 'text-xl'), children: name })] }))
13
+ className: cn('group inline-flex items-center transition-all duration-400', name && 'gap-4', 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') }), name ? (_jsxs(_Fragment, { children: [_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 })] })) : null] }))
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-colors hover:bg-sand/10 hover:text-text-primary 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
+ 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
- export type ButtonVariant = 'primary' | 'secondary' | 'ghost' | 'destructive';
3
- export type ButtonSize = 'sm' | 'md' | 'lg';
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:opacity-90 border-transparent shadow-sm',
6
- secondary: 'bg-white/65 text-text-primary border-sand/20 hover:bg-white shadow-[0_2px_8px_rgba(26,55,77,0.04)] dark:bg-sand/10 dark:text-text-primary dark:border-sand/30 dark:hover:bg-sand/20',
7
- ghost: 'bg-transparent text-text-primary border-transparent hover:bg-sand/10 dark:text-text-primary dark:hover:bg-sand/15',
8
- destructive: 'bg-terracotta text-white hover:opacity-90 border-transparent shadow-sm'
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
- sm: 'px-3 py-1.5 text-sm',
12
- md: 'px-4 py-2 text-sm',
13
- lg: 'px-6 py-2.5 text-base'
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-[family-name:var(--font-header)] font-medium tracking-ui transition-all duration-200 active:scale-[0.98] outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-offset-white focus-visible:ring-sea disabled:pointer-events-none disabled:opacity-50 dark:focus-visible:ring-offset-deep-sea dark:focus-visible:ring-accent-blue', variantClasses[variant], sizeClasses[size], className);
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 (_jsx("a", { ref: ref, href: href, className: classes, ...props }));
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 (_jsx("button", { ref: ref, type: type, className: classes, ...props }));
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;
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { cn } from '../utils/cn.js';
3
- export function Card({ className, ...props }) {
4
- return (_jsx("div", { className: cn('relative overflow-hidden rounded-[var(--radius-card)] bg-white p-6 shadow-[0_2px_10px_rgba(0,0,0,0.02),0_8px_32px_rgba(26,55,77,0.04)] ring-1 ring-black/[0.04] backdrop-blur-md transition-all duration-300 dark:bg-deep-sea/90 dark:ring-white/[0.08] dark:shadow-[0_8px_32px_rgba(0,0,0,0.4)]', className), ...props }));
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-[5px] border border-sand/60 bg-light-sand shadow-[inset_0_1px_2px_rgba(0,0,0,0.02)] transition-all duration-200 hover:border-sea/40 hover:bg-white checked:border-sea checked:bg-sea checked:shadow-none 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-dark-sand/50 dark:bg-dark-sand/30 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 scale-50 text-white opacity-0 transition-all duration-200 ease-bouncy peer-checked:scale-100 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' }) })] }));
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
- export function CollectionFilters({ className, currentFilters, currentSort, filterOptions, onFilterChange, onSortChange, sortOptions }) {
9
- const [showFilters, setShowFilters] = React.useState(false);
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("div", { className: cn('mb-6 space-y-4', className), children: [_jsxs("div", { className: 'flex flex-wrap items-center gap-3', children: [_jsxs(Button, { variant: 'secondary', size: 'sm', onClick: () => setShowFilters((open) => !open), className: 'rounded-lg border-sand/30 bg-white hover:bg-sand/5 dark:border-sand/50 dark:bg-sand/10 dark:hover:bg-sand/20', children: [_jsx(Filter, { size: 18 }), "Filters", activeFilterCount > 0 ? (_jsx("span", { className: 'ml-1 rounded-full bg-sea px-2 py-0.5 text-xs text-white dark:bg-accent-blue', children: activeFilterCount })) : null] }), _jsxs("div", { className: 'flex items-center gap-2', children: [_jsx(Select, { 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' }), className: 'rounded-lg border-sand/30 bg-white p-2 shadow-none backdrop-blur-none hover:translate-y-0 hover:scale-100 hover:bg-sand/5 dark:border-sand/50 dark:bg-sand/10 dark:hover:bg-sand/20', title: `Sort ${currentSort.order === 'asc' ? 'Descending' : 'Ascending'}`, "aria-label": `Sort ${currentSort.order === 'asc' ? 'descending' : 'ascending'}`, children: _jsx(ArrowUpDown, { size: 18, className: currentSort.order === 'desc' ? 'rotate-180' : '' }) })] }), activeFilterCount > 0 ? (_jsxs(Button, { variant: 'ghost', size: 'sm', onClick: () => onFilterChange({}), className: 'rounded-lg px-3 text-terracotta hover:bg-sand/5 hover:text-terracotta dark:hover:bg-sand/10 dark:hover:text-terracotta', children: [_jsx(X, { size: 16 }), "Clear all"] })) : null] }), showFilters ? (_jsx("div", { className: 'rounded-lg border border-sand/30 bg-white p-4 dark:border-sand/50 dark:bg-sand/10', children: _jsx("div", { className: 'grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3', children: filterOptions.map((option) => (_jsxs("div", { className: 'space-y-2', children: [_jsx("label", { className: 'block text-sm font-medium text-text-primary dark:text-text-primary', children: option.label }), option.type === 'select' && option.options ? (_jsx(Select, { value: currentFilters[option.field] || '', onChange: (value) => handleFilterChange(option.field, value), options: [{ label: 'All', value: '' }, ...option.options] })) : null, option.type === 'boolean' ? (_jsx(Select, { value: currentFilters[option.field] === undefined ? '' : String(currentFilters[option.field]), onChange: (value) => handleFilterChange(option.field, value === '' ? null : value === 'true'), options: [
22
- { label: 'All', value: '' },
23
- { label: 'Yes', value: 'true' },
24
- { label: 'No', value: 'false' }
25
- ] })) : null, option.type === 'date' ? (_jsx("input", { type: 'date', value: currentFilters[option.field] || '', onChange: (event) => handleFilterChange(option.field, event.target.value), className: 'w-full rounded-lg border border-sand/30 bg-white px-3 py-2 text-text-primary outline-none focus:ring-2 focus:ring-sea dark:border-sand/50 dark:bg-sand/5 dark:text-text-primary dark:focus:ring-accent-blue' })) : null] }, option.field))) }) })) : null] }));
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/20 bg-white/35 px-3 py-1.5 text-text-primary shadow-sm backdrop-blur-md hover:bg-white/65 dark:border-sand/70 dark:bg-sand/25 dark:hover:bg-sand/35', 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;
173
- const renderOverlay = isOpen && typeof document !== 'undefined'
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-[28px] border border-sand/10 bg-white/95 text-text-primary shadow-2xl backdrop-blur-xl dark:border-sand/20 dark:bg-dark-sand/95 dark:text-text-primary', 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
+ }, 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-xl px-3 py-2.5 text-left transition-colors', isSelected
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-full bg-sand/10 text-text-secondary dark:bg-sand/20 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));
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] }));