@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
|
@@ -1,93 +1,6 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
2
|
-
import
|
|
3
|
-
import { createPortal } from 'react-dom';
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
4
3
|
import { cn } from '../utils/cn.js';
|
|
5
|
-
export function Popover({ align = 'center', children, className, content, onOpenChange, open
|
|
6
|
-
|
|
7
|
-
const isOpen = controlledOpen !== undefined ? controlledOpen : internalOpen;
|
|
8
|
-
const setOpen = (v) => {
|
|
9
|
-
setInternalOpen(v);
|
|
10
|
-
onOpenChange?.(v);
|
|
11
|
-
};
|
|
12
|
-
const triggerRef = React.useRef(null);
|
|
13
|
-
const panelRef = React.useRef(null);
|
|
14
|
-
const [coords, setCoords] = React.useState({ top: 0, left: 0 });
|
|
15
|
-
const reposition = React.useCallback(() => {
|
|
16
|
-
if (!triggerRef.current)
|
|
17
|
-
return;
|
|
18
|
-
const rect = triggerRef.current.getBoundingClientRect();
|
|
19
|
-
const scroll = { x: window.scrollX, y: window.scrollY };
|
|
20
|
-
let top = 0;
|
|
21
|
-
let left = 0;
|
|
22
|
-
const panelW = panelRef.current?.offsetWidth ?? 220;
|
|
23
|
-
const panelH = panelRef.current?.offsetHeight ?? 100;
|
|
24
|
-
const gap = 8;
|
|
25
|
-
if (side === 'bottom')
|
|
26
|
-
top = rect.bottom + scroll.y + gap;
|
|
27
|
-
if (side === 'top')
|
|
28
|
-
top = rect.top + scroll.y - panelH - gap;
|
|
29
|
-
if (side === 'left') {
|
|
30
|
-
top = rect.top + scroll.y;
|
|
31
|
-
left = rect.left + scroll.x - panelW - gap;
|
|
32
|
-
}
|
|
33
|
-
if (side === 'right') {
|
|
34
|
-
top = rect.top + scroll.y;
|
|
35
|
-
left = rect.right + scroll.x + gap;
|
|
36
|
-
}
|
|
37
|
-
if (side === 'bottom' || side === 'top') {
|
|
38
|
-
if (align === 'start')
|
|
39
|
-
left = rect.left + scroll.x;
|
|
40
|
-
else if (align === 'end')
|
|
41
|
-
left = rect.right + scroll.x - panelW;
|
|
42
|
-
else
|
|
43
|
-
left = rect.left + scroll.x + rect.width / 2 - panelW / 2;
|
|
44
|
-
}
|
|
45
|
-
if (side === 'left' || side === 'right') {
|
|
46
|
-
if (align === 'start')
|
|
47
|
-
top = rect.top + scroll.y;
|
|
48
|
-
else if (align === 'end')
|
|
49
|
-
top = rect.bottom + scroll.y - panelH;
|
|
50
|
-
else
|
|
51
|
-
top = rect.top + scroll.y + rect.height / 2 - panelH / 2;
|
|
52
|
-
}
|
|
53
|
-
setCoords({ top, left });
|
|
54
|
-
}, [side, align]);
|
|
55
|
-
React.useEffect(() => {
|
|
56
|
-
if (!isOpen)
|
|
57
|
-
return;
|
|
58
|
-
reposition();
|
|
59
|
-
window.addEventListener('resize', reposition);
|
|
60
|
-
window.addEventListener('scroll', reposition, true);
|
|
61
|
-
return () => {
|
|
62
|
-
window.removeEventListener('resize', reposition);
|
|
63
|
-
window.removeEventListener('scroll', reposition, true);
|
|
64
|
-
};
|
|
65
|
-
}, [isOpen, reposition]);
|
|
66
|
-
// Close on outside click
|
|
67
|
-
React.useEffect(() => {
|
|
68
|
-
if (!isOpen)
|
|
69
|
-
return;
|
|
70
|
-
const handlePointerDown = (e) => {
|
|
71
|
-
if (!triggerRef.current?.contains(e.target) && !panelRef.current?.contains(e.target)) {
|
|
72
|
-
setOpen(false);
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
document.addEventListener('pointerdown', handlePointerDown);
|
|
76
|
-
return () => document.removeEventListener('pointerdown', handlePointerDown);
|
|
77
|
-
}, [isOpen]);
|
|
78
|
-
// Close on Escape
|
|
79
|
-
React.useEffect(() => {
|
|
80
|
-
if (!isOpen)
|
|
81
|
-
return;
|
|
82
|
-
const handleKey = (e) => {
|
|
83
|
-
if (e.key === 'Escape')
|
|
84
|
-
setOpen(false);
|
|
85
|
-
};
|
|
86
|
-
document.addEventListener('keydown', handleKey);
|
|
87
|
-
return () => document.removeEventListener('keydown', handleKey);
|
|
88
|
-
}, [isOpen]);
|
|
89
|
-
const panel = isOpen && typeof document !== 'undefined'
|
|
90
|
-
? createPortal(_jsx("div", { ref: panelRef, role: 'dialog', className: cn('absolute z-50 min-w-[14rem] rounded-[var(--radius-card)] border-0 ring-1 ring-black/5 bg-white/95 backdrop-blur-xl p-1 shadow-[0_8px_32px_rgba(0,0,0,0.08)] outline-none dark:ring-white/10 dark:bg-deep-sea/95 dark:shadow-[0_8px_32px_rgba(0,0,0,0.3)]', 'animate-in fade-in-0 zoom-in-95 duration-200 ease-out-expo', className), style: { top: coords.top, left: coords.left }, children: content }), document.body)
|
|
91
|
-
: null;
|
|
92
|
-
return (_jsxs(_Fragment, { children: [_jsx("span", { ref: triggerRef, className: 'inline-flex', onClick: () => setOpen(!isOpen), children: children }), panel] }));
|
|
4
|
+
export function Popover({ align = 'center', children, className, content, defaultOpen, onOpenChange, open, side = 'bottom', sideOffset = 4 }) {
|
|
5
|
+
return (_jsxs(PopoverPrimitive.Root, { defaultOpen: defaultOpen, onOpenChange: onOpenChange, open: open, children: [_jsx(PopoverPrimitive.Trigger, { asChild: true, children: children }), _jsx(PopoverPrimitive.Portal, { children: _jsx(PopoverPrimitive.Content, { align: align, side: side, sideOffset: sideOffset, collisionPadding: 12, className: cn('z-50 min-w-56 rounded-[var(--radius-ui)] border border-sand/35 bg-white p-2 text-text-primary shadow-[var(--shadow-overlay)] outline-none 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), children: content }) })] }));
|
|
93
6
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { ProgressSize, ProgressVariant } from '../core';
|
|
3
|
+
export type { ProgressSize, ProgressVariant } from '../core';
|
|
2
4
|
export interface ProgressProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
5
|
/** 0–100 */
|
|
4
6
|
value?: number;
|
|
5
7
|
max?: number;
|
|
6
8
|
/** Show the numeric label inside/next to the bar */
|
|
7
9
|
showLabel?: boolean;
|
|
8
|
-
size?:
|
|
9
|
-
variant?:
|
|
10
|
+
size?: ProgressSize;
|
|
11
|
+
variant?: ProgressVariant;
|
|
10
12
|
}
|
|
11
13
|
export declare function Progress({ className, max, showLabel, size, value, variant, ...props }: ProgressProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,8 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { cn } from '../utils/cn.js';
|
|
3
3
|
const sizeClasses = {
|
|
4
4
|
sm: 'h-1.5',
|
|
5
|
-
md: 'h-2
|
|
6
|
-
lg: 'h-
|
|
5
|
+
md: 'h-2',
|
|
6
|
+
lg: 'h-3'
|
|
7
7
|
};
|
|
8
8
|
const variantFill = {
|
|
9
9
|
default: 'bg-sea dark:bg-accent-blue',
|
|
@@ -13,5 +13,5 @@ const variantFill = {
|
|
|
13
13
|
};
|
|
14
14
|
export function Progress({ className, max = 100, showLabel = false, size = 'md', value = 0, variant = 'default', ...props }) {
|
|
15
15
|
const pct = Math.min(100, Math.max(0, (value / max) * 100));
|
|
16
|
-
return (_jsxs("div", { className: cn('flex items-center gap-3', className), ...props, children: [_jsx("div", { role: 'progressbar', "aria-valuenow": value, "aria-valuemin": 0, "aria-valuemax": max, className: cn('flex-1 overflow-hidden rounded-full bg-sand/15 dark:bg-sand/20', sizeClasses[size]), children: _jsx("div", { className: cn('h-full rounded-full transition-[width] duration-
|
|
16
|
+
return (_jsxs("div", { className: cn('flex items-center gap-3', className), ...props, children: [_jsx("div", { role: 'progressbar', "aria-valuenow": value, "aria-valuemin": 0, "aria-valuemax": max, className: cn('flex-1 overflow-hidden rounded-full bg-sand/15 dark:bg-sand/20', sizeClasses[size]), children: _jsx("div", { className: cn('h-full rounded-full transition-[width] duration-[var(--motion-overlay)] ease-premium', variantFill[variant]), style: { width: `${pct}%` } }) }), showLabel && (_jsxs("span", { className: 'min-w-[2.5rem] text-right text-xs font-medium tabular-nums text-text-secondary dark:text-text-primary', children: [Math.round(pct), "%"] }))] }));
|
|
17
17
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { SelectionOrientation } from '../core';
|
|
2
|
+
export type { SelectionOrientation } from '../core';
|
|
1
3
|
export interface RadioOption {
|
|
2
4
|
description?: string;
|
|
3
5
|
disabled?: boolean;
|
|
@@ -10,7 +12,7 @@ export interface RadioGroupProps {
|
|
|
10
12
|
name?: string;
|
|
11
13
|
onChange?: (value: string) => void;
|
|
12
14
|
options: RadioOption[];
|
|
13
|
-
orientation?:
|
|
15
|
+
orientation?: SelectionOrientation;
|
|
14
16
|
value?: string;
|
|
15
17
|
}
|
|
16
18
|
export declare function RadioGroup({ className, disabled, name, onChange, options, orientation, value }: RadioGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,8 +7,8 @@ export function RadioGroup({ className, disabled, name, onChange, options, orien
|
|
|
7
7
|
const isChecked = option.value === value;
|
|
8
8
|
const isDisabled = disabled || option.disabled;
|
|
9
9
|
const id = `${groupName}-${option.value}`;
|
|
10
|
-
return (_jsxs("label", { htmlFor: id, className: cn('group flex cursor-pointer select-none items-start gap-3', isDisabled && 'cursor-not-allowed opacity-50'), children: [_jsxs("span", { className: 'relative mt-0.5 flex-shrink-0', children: [_jsx("input", { id: id, type: 'radio', name: groupName, value: option.value, checked: isChecked, disabled: isDisabled, onChange: () => onChange?.(option.value), className: 'sr-only' }), _jsx("span", { className: cn('flex h-4.5 w-4.5 items-center justify-center rounded-full border-2 transition-colors duration-
|
|
10
|
+
return (_jsxs("label", { htmlFor: id, className: cn('group flex cursor-pointer select-none items-start gap-3', isDisabled && 'cursor-not-allowed opacity-50'), children: [_jsxs("span", { className: 'relative mt-0.5 flex-shrink-0', children: [_jsx("input", { id: id, type: 'radio', name: groupName, value: option.value, checked: isChecked, disabled: isDisabled, onChange: () => onChange?.(option.value), className: 'sr-only' }), _jsx("span", { className: cn('flex h-4.5 w-4.5 items-center justify-center rounded-full border-2 transition-colors duration-[var(--motion-control)] ease-premium', isChecked
|
|
11
11
|
? 'border-sea dark:border-accent-blue'
|
|
12
|
-
: 'border-sand/40 group-hover:border-sea/60 dark:border-sand/60 dark:group-hover:border-accent-blue/60'), children: _jsx("span", { className: cn('h-2 w-2 rounded-full bg-sea transition-transform duration-
|
|
12
|
+
: 'border-sand/40 group-hover:border-sea/60 dark:border-sand/60 dark:group-hover:border-accent-blue/60'), children: _jsx("span", { className: cn('h-2 w-2 rounded-full bg-sea transition-transform duration-[var(--motion-surface)] ease-premium dark:bg-accent-blue', isChecked ? 'scale-100' : 'scale-0') }) })] }), _jsxs("span", { children: [_jsx("span", { className: 'block text-sm font-medium text-text-primary dark:text-text-primary', children: option.label }), option.description ? (_jsx("span", { className: 'block text-xs leading-relaxed text-text-secondary dark:text-text-secondary', children: option.description })) : null] })] }, option.value));
|
|
13
13
|
}) }));
|
|
14
14
|
}
|
|
@@ -5,5 +5,5 @@ import { cn } from '../utils/cn.js';
|
|
|
5
5
|
import { Input } from './input.js';
|
|
6
6
|
export const SearchInput = React.forwardRef(function SearchInput({ className, onClear, value, onChange, ...props }, ref) {
|
|
7
7
|
const inputValue = typeof value === 'string' ? value : '';
|
|
8
|
-
return (_jsxs("div", { className: cn('relative', className), children: [_jsx(Input, { ref: ref, type: 'search', value: value, onChange: onChange, startIcon: _jsx(Search, { className: 'h-4 w-4' }), className: 'pr-8', ...props }), inputValue && onClear && (_jsx("button", { type: 'button', onClick: onClear, className: 'absolute right-2.5 top-1/2 -translate-y-1/2 rounded-
|
|
8
|
+
return (_jsxs("div", { className: cn('relative', className), children: [_jsx(Input, { ref: ref, type: 'search', value: value, onChange: onChange, startIcon: _jsx(Search, { className: 'h-4 w-4' }), className: 'pr-8', ...props }), inputValue && onClear && (_jsx("button", { type: 'button', onClick: onClear, className: 'absolute right-2.5 top-1/2 scale-100 -translate-y-1/2 rounded-[4px] p-0.5 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.92] dark:hover:bg-sand/15', "aria-label": 'Clear search', children: _jsx(X, { size: 14 }) }))] }));
|
|
9
9
|
});
|
|
@@ -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 SectionHeader({ className, description, eyebrow, title, ...props }) {
|
|
4
|
-
return (_jsxs("div", { className: cn('space-y-3', className), ...props, children: [eyebrow ? _jsx("p", { className: 'text-
|
|
4
|
+
return (_jsxs("div", { className: cn('space-y-3.5', className), ...props, children: [eyebrow ? _jsx("p", { className: 'text-[11px] font-semibold uppercase tracking-[0.12em] text-desert', children: eyebrow }) : null, _jsxs("div", { className: 'space-y-3', children: [_jsx("h2", { className: 'text-[1.75rem] font-semibold leading-tight tracking-refined text-text-primary dark:text-text-primary', children: title }), description ? _jsx("p", { className: 'font-secondary max-w-2xl text-base leading-7 text-text-secondary dark:text-text-secondary', children: description }) : null] })] }));
|
|
5
5
|
}
|
|
@@ -1,14 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
export interface SelectOption {
|
|
3
|
+
disabled?: boolean;
|
|
2
4
|
label: string;
|
|
3
5
|
value: string;
|
|
4
6
|
}
|
|
5
7
|
export interface SelectProps {
|
|
8
|
+
'aria-describedby'?: string;
|
|
9
|
+
'aria-label'?: string;
|
|
10
|
+
autoFocus?: boolean;
|
|
6
11
|
className?: string;
|
|
12
|
+
contentClassName?: string;
|
|
7
13
|
disabled?: boolean;
|
|
8
14
|
error?: boolean;
|
|
15
|
+
id?: string;
|
|
16
|
+
name?: string;
|
|
9
17
|
onChange: (value: string) => void;
|
|
10
18
|
options: SelectOption[];
|
|
11
19
|
placeholder?: string;
|
|
20
|
+
required?: boolean;
|
|
21
|
+
size?: 'sm' | 'md' | 'lg';
|
|
22
|
+
startIcon?: React.ReactNode;
|
|
12
23
|
value: string;
|
|
13
24
|
}
|
|
14
|
-
export declare function Select({ className, disabled, error, onChange, options, placeholder, value }: SelectProps): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export declare function Select({ 'aria-label': ariaLabel, 'aria-describedby': ariaDescribedBy, autoFocus, className, contentClassName, disabled, error, id, name, onChange, options, placeholder, required, size, startIcon, value }: SelectProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,67 +1,16 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { createPortal } from 'react-dom';
|
|
3
|
+
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
4
|
+
import { Check, ChevronDown, ChevronUp } from 'lucide-react';
|
|
5
5
|
import { cn } from '../utils/cn.js';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return undefined;
|
|
17
|
-
}
|
|
18
|
-
const handleClickOutside = (event) => {
|
|
19
|
-
if (dropdownRef.current &&
|
|
20
|
-
!dropdownRef.current.contains(event.target) &&
|
|
21
|
-
buttonRef.current &&
|
|
22
|
-
!buttonRef.current.contains(event.target)) {
|
|
23
|
-
setIsOpen(false);
|
|
24
|
-
setSearchTerm('');
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
document.addEventListener('mousedown', handleClickOutside);
|
|
28
|
-
return () => document.removeEventListener('mousedown', handleClickOutside);
|
|
29
|
-
}, [isOpen]);
|
|
30
|
-
const handleSelect = (nextValue) => {
|
|
31
|
-
onChange(nextValue);
|
|
32
|
-
setIsOpen(false);
|
|
33
|
-
setSearchTerm('');
|
|
34
|
-
};
|
|
35
|
-
const openMenu = () => {
|
|
36
|
-
if (disabled)
|
|
37
|
-
return;
|
|
38
|
-
const rect = buttonRef.current?.getBoundingClientRect();
|
|
39
|
-
if (rect) {
|
|
40
|
-
setMenuStyle({
|
|
41
|
-
position: 'fixed',
|
|
42
|
-
top: `${rect.bottom}px`,
|
|
43
|
-
left: `${rect.left}px`,
|
|
44
|
-
width: `${rect.width}px`,
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
setIsOpen(true);
|
|
48
|
-
};
|
|
49
|
-
return (_jsxs("div", { className: cn('relative', className), children: [_jsx("button", { ref: buttonRef, type: 'button', disabled: disabled, onClick: openMenu, onKeyDown: (event) => {
|
|
50
|
-
if (disabled) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
if (event.key === 'Enter' || event.key === ' ') {
|
|
54
|
-
event.preventDefault();
|
|
55
|
-
openMenu();
|
|
56
|
-
}
|
|
57
|
-
if (event.key === 'Escape') {
|
|
58
|
-
setIsOpen(false);
|
|
59
|
-
setSearchTerm('');
|
|
60
|
-
}
|
|
61
|
-
}, className: cn('w-full rounded-[var(--radius-ui)] border-0 ring-1 ring-inset ring-black/10 bg-light-sand/50 px-4 py-2.5 text-left text-text-primary outline-none transition-all duration-200 hover:bg-white hover:ring-black/20 focus:bg-white focus:ring-2 focus:ring-inset focus:ring-sea dark:bg-deep-sea/50 dark:text-text-primary dark:ring-white/10 dark:hover:bg-deep-sea dark:focus:ring-accent-blue', disabled ? 'cursor-not-allowed opacity-50 bg-sand/10' : 'cursor-pointer', error ? 'ring-terracotta/50 focus:ring-terracotta dark:ring-terracotta/50' : '', isOpen && 'bg-white ring-2 ring-inset ring-sea dark:bg-deep-sea dark:ring-accent-blue'), children: _jsxs("div", { className: 'flex items-center justify-between gap-3', children: [_jsx("span", { className: selectedOption ? 'text-text-primary dark:text-text-primary' : 'text-text-secondary dark:text-text-secondary', children: selectedOption ? selectedOption.label : placeholder }), _jsx(ChevronDown, { size: 18, className: cn('text-text-secondary transition-transform duration-200 dark:text-text-secondary', isOpen && 'rotate-180') })] }) }), isOpen ? createPortal(_jsxs("div", { ref: dropdownRef, style: menuStyle, className: 'z-50 overflow-hidden animate-in fade-in slide-in-from-top-2 duration-200 ease-out-expo rounded-[var(--radius-ui)] border-0 ring-1 ring-black/5 bg-white shadow-[0_8px_32px_rgba(0,0,0,0.08)] dark:bg-deep-sea dark:ring-white/10 dark:shadow-[0_8px_32px_rgba(0,0,0,0.3)]', children: [options.length > 5 ? (_jsx("div", { className: 'border-b border-sand/20 p-2 dark:border-sand/40', children: _jsx("input", { type: 'text', value: searchTerm, onChange: (event) => setSearchTerm(event.target.value), placeholder: 'Search...', className: 'w-full rounded-lg border border-sand/20 bg-sand/5 px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-1 focus:ring-sea dark:border-sand/30 dark:bg-sand/10 dark:text-text-primary dark:placeholder:text-text-secondary dark:focus:ring-accent-blue', onClick: (event) => event.stopPropagation() }) })) : null, _jsx("div", { className: 'max-h-60 overflow-y-auto py-1', children: filteredOptions.length === 0 ? (_jsx("div", { className: 'px-4 py-3 text-center text-sm text-text-secondary dark:text-text-secondary', children: "No options found" })) : (filteredOptions.map((option) => {
|
|
62
|
-
const isSelected = option.value === value;
|
|
63
|
-
return (_jsxs("button", { type: 'button', onClick: () => handleSelect(option.value), className: cn('flex w-full items-center justify-between gap-2 px-4 py-2.5 text-left text-sm transition-colors duration-150', isSelected
|
|
64
|
-
? 'bg-sea/10 font-medium text-sea dark:bg-accent-blue/10 dark:text-accent-blue'
|
|
65
|
-
: 'text-text-primary hover:bg-sand/10 dark:text-text-primary dark:hover:bg-sand/20'), children: [_jsx("span", { className: 'flex-1 tracking-refined', children: option.label }), isSelected ? _jsx(Check, { size: 16, className: 'flex-shrink-0 text-sea dark:text-accent-blue' }) : null] }, option.value));
|
|
66
|
-
})) })] }), document.body) : null] }));
|
|
6
|
+
const EMPTY_OPTION_VALUE = '__bleecker_empty_option__';
|
|
7
|
+
const triggerSizeClasses = {
|
|
8
|
+
sm: 'h-9 gap-2 px-3 text-[13px]',
|
|
9
|
+
md: 'h-10 gap-3 px-3.5 text-sm',
|
|
10
|
+
lg: 'h-11 gap-3 px-4 text-[15px]'
|
|
11
|
+
};
|
|
12
|
+
export function Select({ 'aria-label': ariaLabel, 'aria-describedby': ariaDescribedBy, autoFocus, className, contentClassName, disabled = false, error = false, id, name, onChange, options, placeholder = 'Select…', required, size = 'md', startIcon, value }) {
|
|
13
|
+
const hasEmptyOption = options.some((option) => option.value === '');
|
|
14
|
+
const internalValue = value === '' && hasEmptyOption ? EMPTY_OPTION_VALUE : value || undefined;
|
|
15
|
+
return (_jsxs(SelectPrimitive.Root, { disabled: disabled, name: name, required: required, value: internalValue, onValueChange: (nextValue) => onChange(nextValue === EMPTY_OPTION_VALUE ? '' : nextValue), children: [_jsxs(SelectPrimitive.Trigger, { id: id, autoFocus: autoFocus, "aria-label": ariaLabel ?? placeholder, "aria-describedby": ariaDescribedBy, "aria-invalid": error || undefined, className: cn('flex w-full items-center rounded-[var(--radius-ui)] border border-sand/40 bg-white text-left text-text-primary shadow-[0_1px_2px_rgba(26,55,77,0.025)] outline-none transition-[background-color,border-color,box-shadow,opacity] duration-[var(--motion-control)] ease-premium hover:border-sand/70 hover:shadow-[0_3px_10px_-8px_rgba(26,55,77,0.25)] focus:border-sea/70 focus:ring-2 focus:ring-sea/10 data-[state=open]:border-sea/70 data-[state=open]:ring-2 data-[state=open]:ring-sea/10 data-[disabled]:cursor-not-allowed data-[disabled]:bg-light-sand/65 data-[disabled]:opacity-60 dark:border-white/15 dark:bg-deep-sea dark:text-text-primary dark:hover:border-white/25 dark:focus:border-accent-blue dark:focus:ring-accent-blue/12 dark:data-[state=open]:border-accent-blue dark:data-[state=open]:ring-accent-blue/12', triggerSizeClasses[size], error && 'border-terracotta focus:border-terracotta focus:ring-terracotta/15 dark:border-terracotta', className), children: [startIcon ? _jsx("span", { className: 'flex shrink-0 items-center text-sea dark:text-accent-blue', "aria-hidden": 'true', children: startIcon }) : null, _jsx("span", { className: 'min-w-0 flex-1 truncate', children: _jsx(SelectPrimitive.Value, { placeholder: placeholder }) }), _jsx(SelectPrimitive.Icon, { asChild: true, children: _jsx(ChevronDown, { size: 17, className: 'shrink-0 text-text-secondary', "aria-hidden": 'true' }) })] }), _jsx(SelectPrimitive.Portal, { children: _jsxs(SelectPrimitive.Content, { position: 'popper', side: 'bottom', align: 'start', sideOffset: 4, collisionPadding: 8, sticky: 'always', updatePositionStrategy: 'always', className: cn('z-50 w-[var(--radix-select-trigger-width)] overflow-hidden rounded-[var(--radius-ui)] border border-sand/40 bg-white shadow-[var(--shadow-overlay)] outline-none data-[side=bottom]:origin-top data-[side=top]:origin-bottom 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', contentClassName), children: [_jsx(SelectPrimitive.ScrollUpButton, { className: 'flex h-7 items-center justify-center border-b border-sand/15 bg-white text-text-secondary dark:border-white/10 dark:bg-deep-sea', children: _jsx(ChevronUp, { size: 15, "aria-hidden": 'true' }) }), _jsx(SelectPrimitive.Viewport, { className: 'max-h-[min(18rem,var(--radix-select-content-available-height))] p-1', children: options.map((option) => (_jsxs(SelectPrimitive.Item, { value: option.value === '' ? EMPTY_OPTION_VALUE : option.value, disabled: option.disabled, className: cn('relative flex cursor-default select-none items-center rounded-[5px] pl-3 pr-9 text-text-primary outline-none transition-[background-color,color,opacity] duration-[var(--motion-control)] ease-premium data-[disabled]:pointer-events-none data-[highlighted]:bg-light-sand data-[disabled]:opacity-40 data-[state=checked]:font-medium data-[state=checked]:text-sea dark:text-text-primary dark:data-[highlighted]:bg-white/[0.07] dark:data-[state=checked]:text-accent-blue', size === 'sm' ? 'min-h-8 py-1.5 text-[13px]' : size === 'lg' ? 'min-h-10 py-2 text-[15px]' : 'min-h-9 py-1.5 text-sm'), children: [_jsx(SelectPrimitive.ItemText, { children: option.label }), _jsx(SelectPrimitive.ItemIndicator, { className: 'absolute right-3 inline-flex items-center', children: _jsx(Check, { size: 15, "aria-hidden": 'true' }) })] }, option.value))) }), _jsx(SelectPrimitive.ScrollDownButton, { className: 'flex h-7 items-center justify-center border-t border-sand/15 bg-white text-text-secondary dark:border-white/10 dark:bg-deep-sea', children: _jsx(ChevronDown, { size: 15, "aria-hidden": 'true' }) })] }) })] }));
|
|
67
16
|
}
|
package/dist/components/sheet.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
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 { createPortal } from 'react-dom';
|
|
4
5
|
import { DialogCloseButton } from './dialog-close-button.js';
|
|
5
6
|
import { cn } from '../utils/cn.js';
|
|
7
|
+
import { useModalLayer, usePresence } from '../utils/hooks.js';
|
|
6
8
|
const sideStyles = {
|
|
7
9
|
right: {
|
|
8
10
|
panel: 'inset-y-0 right-0 h-full w-full max-w-sm',
|
|
@@ -26,30 +28,12 @@ const sideStyles = {
|
|
|
26
28
|
}
|
|
27
29
|
};
|
|
28
30
|
export function Sheet({ children, className, description, isOpen, onClose, scrollContent = true, side = 'right', title }) {
|
|
29
|
-
const
|
|
31
|
+
const { present, visible } = usePresence(isOpen, 180);
|
|
30
32
|
const { panel, enter, leave } = sideStyles[side];
|
|
31
|
-
React.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
setVisible(false);
|
|
39
|
-
}
|
|
40
|
-
}, [isOpen]);
|
|
41
|
-
// Close on Escape
|
|
42
|
-
React.useEffect(() => {
|
|
43
|
-
if (!isOpen)
|
|
44
|
-
return;
|
|
45
|
-
const handler = (e) => {
|
|
46
|
-
if (e.key === 'Escape')
|
|
47
|
-
onClose();
|
|
48
|
-
};
|
|
49
|
-
document.addEventListener('keydown', handler);
|
|
50
|
-
return () => document.removeEventListener('keydown', handler);
|
|
51
|
-
}, [isOpen, onClose]);
|
|
52
|
-
if (typeof document === 'undefined' || !isOpen)
|
|
33
|
+
const titleId = React.useId();
|
|
34
|
+
const descriptionId = React.useId();
|
|
35
|
+
const panelRef = useModalLayer(isOpen, onClose);
|
|
36
|
+
if (typeof document === 'undefined' || !present)
|
|
53
37
|
return null;
|
|
54
|
-
return createPortal(_jsxs("div", { className: 'fixed inset-0 z-50 flex', children: [_jsx("div", { className: cn('absolute inset-0 bg-
|
|
38
|
+
return createPortal(_jsxs("div", { className: 'fixed inset-0 z-50 flex', children: [_jsx("div", { className: cn('absolute inset-0 bg-deep-sea/38 backdrop-blur-[2px] transition-opacity dark:bg-black/65', visible ? 'opacity-100 duration-[var(--motion-overlay)] ease-premium' : 'opacity-0 duration-[180ms] ease-in'), onClick: onClose, "aria-hidden": 'true' }), _jsx("div", { ref: panelRef, role: 'dialog', "aria-modal": 'true', "aria-label": title ? undefined : 'Dialog', "aria-labelledby": title ? titleId : undefined, "aria-describedby": description ? descriptionId : undefined, tabIndex: -1, className: cn('absolute flex flex-col overflow-hidden border border-sand/30 bg-white text-text-primary shadow-[var(--shadow-overlay)] outline-none transition-transform dark:border-white/12 dark:bg-deep-sea dark:text-text-primary', panel, visible ? `${enter} duration-[var(--motion-overlay)] ease-premium` : `${leave} duration-[180ms] ease-in`, (side === 'left' || side === 'right') && 'rounded-none', side === 'top' && 'rounded-b-[var(--radius-dialog)]', side === 'bottom' && 'rounded-t-[var(--radius-dialog)]', className), children: _jsxs("div", { className: 'flex h-full min-h-0 flex-1 flex-col overflow-hidden p-6 md:p-8', children: [title || description ? (_jsxs("div", { className: 'mb-5 flex shrink-0 items-start justify-between gap-4', children: [_jsxs("div", { className: 'min-w-0 flex-1', children: [title ? _jsx("h2", { id: titleId, className: 'text-2xl font-medium text-text-primary dark:text-text-primary', children: title }) : null, description ? _jsx("p", { id: descriptionId, className: 'font-secondary mt-2 text-sm leading-relaxed text-text-secondary dark:text-text-secondary', children: description }) : null] }), _jsx(DialogCloseButton, { onClick: onClose, "aria-label": 'Close' })] })) : (_jsx("div", { className: 'mb-5 flex shrink-0 justify-end', children: _jsx(DialogCloseButton, { onClick: onClose, "aria-label": 'Close' }) })), _jsx("div", { className: cn(scrollContent ? 'min-h-0 flex-1 overflow-y-auto' : 'flex min-h-0 flex-1 flex-col overflow-hidden'), children: children })] }) })] }), document.body);
|
|
55
39
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
import * as React from 'react';
|
|
3
4
|
import { ChevronRight } from 'lucide-react';
|
|
@@ -5,7 +6,7 @@ import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
|
5
6
|
import { cn } from '../utils/cn.js';
|
|
6
7
|
function SidebarLink({ item, collapsed, renderLink, onClick }) {
|
|
7
8
|
const content = (_jsxs(_Fragment, { children: [item.icon && _jsx("span", { className: 'flex h-5 w-5 shrink-0 items-center justify-center', children: item.icon }), !collapsed && (_jsxs(_Fragment, { children: [_jsx("span", { className: 'flex-1 truncate text-sm font-medium', children: item.label }), item.badge && _jsx("span", { className: 'ml-auto shrink-0', children: item.badge })] }))] }));
|
|
8
|
-
const className = cn('flex items-center gap-3 rounded-[var(--radius-ui)] px-3
|
|
9
|
+
const className = cn('flex min-h-10 items-center gap-3 rounded-[var(--radius-ui)] px-3 text-text-secondary transition-[background-color,color,box-shadow,transform] duration-[var(--motion-control)] ease-premium hover:bg-light-sand/55 hover:text-text-primary active:translate-y-px dark:text-text-secondary dark:hover:bg-white/[0.05] dark:hover:text-text-primary', item.active && 'bg-light-sand/80 font-medium text-deep-sea shadow-[inset_2px_0_0_var(--color-sea)] dark:bg-white/[0.07] dark:text-accent-blue dark:shadow-[inset_2px_0_0_var(--color-accent-blue)]', item.disabled && 'pointer-events-none opacity-50');
|
|
9
10
|
if (renderLink) {
|
|
10
11
|
return renderLink({ item, className, children: content, onClick });
|
|
11
12
|
}
|
|
@@ -19,8 +20,8 @@ function SidebarGroup({ item, collapsed, renderLink, onItemClick }) {
|
|
|
19
20
|
}
|
|
20
21
|
return null;
|
|
21
22
|
}
|
|
22
|
-
return (_jsxs(CollapsiblePrimitive.Root, { open: open, onOpenChange: setOpen, children: [_jsx(CollapsiblePrimitive.Trigger, { asChild: true, children: _jsxs("button", { type: 'button', className: cn('flex w-full items-center gap-3 rounded-[var(--radius-ui)] px-3
|
|
23
|
+
return (_jsxs(CollapsiblePrimitive.Root, { open: open, onOpenChange: setOpen, children: [_jsx(CollapsiblePrimitive.Trigger, { asChild: true, children: _jsxs("button", { type: 'button', className: cn('flex min-h-10 w-full items-center gap-3 rounded-[var(--radius-ui)] px-3 text-text-secondary transition-[background-color,color,transform] duration-[var(--motion-control)] ease-premium hover:bg-light-sand/55 hover:text-text-primary active:translate-y-px dark:text-text-secondary dark:hover:bg-white/[0.05] dark:hover:text-text-primary', item.active && 'bg-light-sand/80 font-medium text-deep-sea dark:bg-white/[0.07] dark:text-accent-blue'), children: [item.icon && _jsx("span", { className: 'flex h-5 w-5 shrink-0 items-center justify-center', children: item.icon }), _jsx("span", { className: 'flex-1 truncate text-left text-sm font-medium', children: item.label }), item.badge && _jsx("span", { className: 'ml-auto shrink-0', children: item.badge }), _jsx(ChevronRight, { size: 14, className: cn('shrink-0 transition-transform duration-[var(--motion-surface)] ease-premium', open && 'rotate-90') })] }) }), _jsx(CollapsiblePrimitive.Content, { className: 'overflow-hidden', children: _jsx("div", { className: 'relative ml-5 mt-1 border-l border-sand/20 pl-4 dark:border-sand/20', children: item.items.map((child) => child.href ? (_jsx(SidebarLink, { item: child, collapsed: collapsed, renderLink: renderLink, onClick: () => onItemClick?.(child) }, child.id)) : null) }) })] }));
|
|
23
24
|
}
|
|
24
25
|
export function Sidebar({ items, header, footer, className, collapsed = false, onItemClick, renderLink }) {
|
|
25
|
-
return (_jsxs("aside", { className: cn('flex h-full flex-col border-r border-
|
|
26
|
+
return (_jsxs("aside", { className: cn('flex h-full flex-col border-r border-sand/25 bg-white transition-[width,padding] duration-200 dark:border-white/[0.08] dark:bg-deep-sea', collapsed ? 'w-16 px-2 py-5' : 'w-64 px-3 py-5', className), children: [header && _jsx("div", { className: cn('mb-5 border-b border-sand/20 pb-5 dark:border-white/[0.07]', collapsed && 'flex justify-center'), children: header }), _jsx("nav", { className: 'flex-1 space-y-1 overflow-y-auto scrollbar-thin', children: items.map((item) => (_jsx(SidebarGroup, { item: item, collapsed: collapsed, renderLink: renderLink, onItemClick: onItemClick }, item.id))) }), footer && _jsx("div", { className: cn('mt-auto border-t border-sand/20 pt-4 dark:border-white/[0.07]', collapsed && 'flex justify-center'), children: footer })] }));
|
|
26
27
|
}
|
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { cn } from '../utils/cn.js';
|
|
4
4
|
export const Slider = React.forwardRef(function Slider({ className, disabled, label, max = 100, min = 0, onChange, showValue = false, step = 1, value = 0, ...props }, ref) {
|
|
5
5
|
const pct = ((value - min) / (max - min)) * 100;
|
|
6
|
-
return (_jsxs("div", { className: cn('space-y-2', className), children: [(label || showValue) && (_jsxs("div", { className: 'flex items-center justify-between', children: [label ? _jsx("span", { className: 'text-sm font-medium text-text-primary dark:text-text-primary', children: label }) : _jsx("span", {}), showValue && _jsx("span", { className: 'text-sm tabular-nums text-text-secondary dark:text-text-primary', children: value })] })), _jsxs("div", { className: 'relative flex h-5 items-center', children: [_jsx("div", { className: 'pointer-events-none absolute inset-y-0 flex w-full items-center', children: _jsx("div", { className: 'h-2 w-full overflow-hidden rounded-full bg-sand/20 dark:bg-sand/30', children: _jsx("div", { className: 'h-full rounded-full bg-sea transition-[width] duration-
|
|
6
|
+
return (_jsxs("div", { className: cn('space-y-2', className), children: [(label || showValue) && (_jsxs("div", { className: 'flex items-center justify-between', children: [label ? _jsx("span", { className: 'text-sm font-medium text-text-primary dark:text-text-primary', children: label }) : _jsx("span", {}), showValue && _jsx("span", { className: 'text-sm tabular-nums text-text-secondary dark:text-text-primary', children: value })] })), _jsxs("div", { className: 'relative flex h-5 items-center', children: [_jsx("div", { className: 'pointer-events-none absolute inset-y-0 flex w-full items-center', children: _jsx("div", { className: 'h-2 w-full overflow-hidden rounded-full bg-sand/20 dark:bg-sand/30', children: _jsx("div", { className: 'h-full rounded-full bg-sea transition-[width] duration-[var(--motion-control)] ease-premium dark:bg-accent-blue', style: { width: `${pct}%` } }) }) }), _jsx("input", { ref: ref, type: 'range', min: min, max: max, step: step, value: value, disabled: disabled, onChange: (e) => onChange?.(Number(e.target.value)), className: cn('relative h-2 w-full cursor-pointer appearance-none rounded-full bg-transparent',
|
|
7
7
|
// Thumb styling via arbitrary CSS
|
|
8
|
-
'[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:h-5 [&::-webkit-slider-thumb]:w-5 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:border-2 [&::-webkit-slider-thumb]:border-sea [&::-webkit-slider-thumb]:bg-white [&::-webkit-slider-thumb]:shadow-sm [&::-webkit-slider-thumb]:transition-
|
|
8
|
+
'[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:h-5 [&::-webkit-slider-thumb]:w-5 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:border-2 [&::-webkit-slider-thumb]:border-sea [&::-webkit-slider-thumb]:bg-white [&::-webkit-slider-thumb]:shadow-sm [&::-webkit-slider-thumb]:transition-shadow [&::-webkit-slider-thumb]:duration-[var(--motion-control)] [&::-webkit-slider-thumb]:ease-premium [&::-webkit-slider-thumb]:hover:shadow-md dark:[&::-webkit-slider-thumb]:border-accent-blue', '[&::-moz-range-thumb]:h-5 [&::-moz-range-thumb]:w-5 [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:border-2 [&::-moz-range-thumb]:border-sea [&::-moz-range-thumb]:bg-white [&::-moz-range-thumb]:shadow-sm dark:[&::-moz-range-thumb]:border-accent-blue', 'focus:outline-none focus-visible:ring-2 focus-visible:ring-sea focus-visible:ring-offset-2 dark:focus-visible:ring-accent-blue', disabled && 'cursor-not-allowed opacity-50'), ...props })] })] }));
|
|
9
9
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
import { AlertCircle, AlertTriangle, CheckCircle, Info, X } from 'lucide-react';
|
|
3
4
|
import React from 'react';
|
|
@@ -38,10 +39,10 @@ function ToastItem({ toast, onDismiss }) {
|
|
|
38
39
|
}, toast.duration);
|
|
39
40
|
return () => clearTimeout(t);
|
|
40
41
|
}, []);
|
|
41
|
-
return (_jsxs("div", { className: cn('flex w-full items-start gap-3 rounded-
|
|
42
|
+
return (_jsxs("div", { className: cn('flex w-full items-start gap-3 rounded-[var(--radius-card)] border border-sand/25 bg-white p-4 shadow-[var(--shadow-overlay)] transition-[opacity,transform] duration-200 dark:border-white/10 dark:bg-deep-sea', visible ? 'translate-y-0 opacity-100' : 'translate-y-2 opacity-0'), role: 'alert', children: [_jsx(Icon, { size: 18, className: cn('mt-0.5 flex-shrink-0', color) }), _jsxs("div", { className: 'min-w-0 flex-1', children: [_jsx("p", { className: 'text-sm font-medium text-text-primary dark:text-text-primary', children: toast.title }), toast.description ? _jsx("p", { className: 'mt-0.5 text-xs text-text-secondary dark:text-text-secondary', children: toast.description }) : null, toast.action?.variant === 'link' ? (_jsx("button", { type: 'button', onClick: toast.action.onClick, className: 'mt-2 text-xs font-medium text-sea underline underline-offset-2 transition-colors duration-[var(--motion-control)] ease-premium hover:text-deep-sea dark:text-accent-blue dark:hover:text-text-primary', children: toast.action.label })) : toast.action ? (_jsx(Button, { variant: toast.action.variant, size: 'sm', className: 'mt-2 text-xs', onClick: toast.action.onClick, children: toast.action.label })) : null] }), _jsx("button", { type: 'button', onClick: () => {
|
|
42
43
|
setVisible(false);
|
|
43
44
|
setTimeout(onDismiss, 300);
|
|
44
|
-
}, className: 'flex-shrink-0 rounded-md p-0.5 text-text-secondary transition-
|
|
45
|
+
}, className: 'flex-shrink-0 scale-100 rounded-md p-0.5 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', "aria-label": 'Dismiss', children: _jsx(X, { size: 14 }) })] }));
|
|
45
46
|
}
|
|
46
47
|
// ─── Position classes ────────────────────────────────────────────────────────
|
|
47
48
|
const positionClasses = {
|
|
@@ -15,5 +15,5 @@ const trendClasses = {
|
|
|
15
15
|
};
|
|
16
16
|
export function StatCard({ title, value, description, trend, icon, className, sparklineData, sparklineDataKey, sparklineColor, footer }) {
|
|
17
17
|
const TrendIcon = trend ? trendIcons[trend.direction] : null;
|
|
18
|
-
return (_jsxs(Card, { className: cn('flex flex-col gap-
|
|
18
|
+
return (_jsxs(Card, { className: cn('flex flex-col gap-5', className), children: [_jsxs("div", { className: 'flex items-start justify-between gap-6', children: [_jsxs("div", { className: 'min-w-0 flex-1 space-y-2', children: [_jsx("p", { className: 'text-[11px] font-semibold uppercase tracking-[0.09em] text-text-secondary dark:text-text-secondary', children: title }), _jsx("p", { className: 'text-[1.875rem] font-semibold leading-none tracking-refined text-text-primary dark:text-text-primary', children: value }), trend && (_jsxs("div", { className: 'flex items-center gap-2 text-sm', children: [TrendIcon && _jsx(TrendIcon, { size: 14, className: cn('flex-shrink-0', trendClasses[trend.direction]) }), _jsx("span", { className: cn('font-medium', trendClasses[trend.direction]), children: trend.value }), trend.label && _jsx("span", { className: 'text-text-secondary dark:text-text-secondary', children: trend.label })] })), description && !trend && _jsx("p", { className: 'text-sm text-text-secondary dark:text-text-secondary', children: description })] }), icon && (_jsx("div", { className: 'flex h-10 w-10 shrink-0 items-center justify-center rounded-[9px] border border-sea/12 bg-sea/[0.045] text-sea dark:border-accent-blue/18 dark:bg-accent-blue/[0.08] dark:text-accent-blue', children: icon }))] }), sparklineData && sparklineDataKey && (_jsx("div", { className: '-mx-1', children: _jsx(Sparkline, { data: sparklineData, dataKey: sparklineDataKey, height: 48, color: sparklineColor, showArea: true }) })), footer && _jsx("div", { className: 'border-t border-sand/20 pt-4 dark:border-white/10', children: footer })] }));
|
|
19
19
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import type { StatusBadgeVariant } from '../core';
|
|
2
|
+
export type { StatusBadgeVariant } from '../core';
|
|
2
3
|
export interface StatusBadgeProps {
|
|
3
4
|
className?: string;
|
|
4
5
|
description?: string;
|
|
@@ -3,19 +3,19 @@ import { cn } from '../utils/cn.js';
|
|
|
3
3
|
const variantClasses = {
|
|
4
4
|
live: {
|
|
5
5
|
badge: 'bg-emerald-500/10 border-emerald-500/20 text-emerald-500 dark:bg-emerald-500/10 dark:border-emerald-500/20 dark:text-emerald-400',
|
|
6
|
-
dot: 'bg-emerald-500
|
|
6
|
+
dot: 'bg-emerald-500'
|
|
7
7
|
},
|
|
8
8
|
offline: {
|
|
9
9
|
badge: 'bg-terracotta/10 border-terracotta/20 text-terracotta dark:bg-terracotta/10 dark:border-terracotta/20 dark:text-terracotta',
|
|
10
|
-
dot: 'bg-terracotta
|
|
10
|
+
dot: 'bg-terracotta'
|
|
11
11
|
},
|
|
12
12
|
warning: {
|
|
13
13
|
badge: 'bg-desert/10 border-desert/20 text-desert dark:bg-desert/10 dark:border-desert/20 dark:text-desert',
|
|
14
|
-
dot: 'bg-desert
|
|
14
|
+
dot: 'bg-desert'
|
|
15
15
|
},
|
|
16
16
|
info: {
|
|
17
17
|
badge: 'bg-sea/10 border-sea/20 text-sea dark:bg-accent-blue/10 dark:border-accent-blue/20 dark:text-accent-blue',
|
|
18
|
-
dot: 'bg-sea dark:bg-accent-blue
|
|
18
|
+
dot: 'bg-sea dark:bg-accent-blue'
|
|
19
19
|
},
|
|
20
20
|
default: {
|
|
21
21
|
badge: 'bg-sand/20 border-sand/30 text-text-secondary dark:bg-sand/10 dark:border-sand/20 dark:text-text-secondary',
|
|
@@ -24,6 +24,5 @@ const variantClasses = {
|
|
|
24
24
|
};
|
|
25
25
|
export function StatusBadge({ className, description, label, variant = 'default' }) {
|
|
26
26
|
const { badge, dot } = variantClasses[variant];
|
|
27
|
-
|
|
28
|
-
return (_jsxs("div", { className: cn('inline-flex items-center gap-2', className), children: [_jsxs("span", { className: cn('inline-flex items-center gap-2 rounded-full border px-3 py-1 text-xs font-semibold uppercase tracking-wider', badge), children: [_jsx("span", { className: cn('h-2 w-2 rounded-full', animate && 'animate-pulse', dot) }), label] }), description ? _jsx("span", { className: 'text-xs text-text-secondary dark:text-text-secondary', children: description }) : null] }));
|
|
27
|
+
return (_jsxs("div", { className: cn('inline-flex items-center gap-2', className), children: [_jsxs("span", { className: cn('inline-flex min-h-6 items-center gap-1.5 rounded-[6px] border px-2.5 py-0.5 text-[11px] font-semibold tracking-ui', badge), children: [_jsx("span", { className: cn('h-1.5 w-1.5 rounded-full', dot) }), label] }), description ? _jsx("span", { className: 'text-xs text-text-secondary dark:text-text-secondary', children: description }) : null] }));
|
|
29
28
|
}
|
|
@@ -26,8 +26,8 @@ export function Stepper({ steps, activeStep, className, onStepClick, orientation
|
|
|
26
26
|
const status = step.status ?? (index < activeIndex ? 'completed' : index === activeIndex ? 'active' : 'pending');
|
|
27
27
|
const isLast = index === steps.length - 1;
|
|
28
28
|
const styles = statusClasses[status];
|
|
29
|
-
return (_jsxs("div", { className: cn('relative flex', isHorizontal ? 'flex-1 flex-col items-center' : 'items-start gap-4'), children: [!isLast && (_jsx("div", { className: cn('absolute transition-colors', isHorizontal
|
|
29
|
+
return (_jsxs("div", { className: cn('relative flex', isHorizontal ? 'flex-1 flex-col items-center' : 'items-start gap-4'), children: [!isLast && (_jsx("div", { className: cn('absolute transition-colors duration-[var(--motion-surface)] ease-premium', isHorizontal
|
|
30
30
|
? 'left-1/2 top-4 h-0.5 w-[calc(100%-2rem)]'
|
|
31
|
-
: 'left-4 top-9 h-[calc(100%-2rem)] w-0.5'), children: _jsx("div", { className: cn('h-full w-full', status === 'completed' ? styles.line : 'bg-sand/20 dark:bg-sand/20') }) })), _jsx("button", { type: 'button', disabled: step.disabled || !onStepClick, onClick: () => onStepClick?.(step), className: cn('relative z-10 flex h-8 w-8 items-center justify-center rounded-full text-sm font-semibold transition-
|
|
31
|
+
: 'left-4 top-9 h-[calc(100%-2rem)] w-0.5'), children: _jsx("div", { className: cn('h-full w-full', status === 'completed' ? styles.line : 'bg-sand/20 dark:bg-sand/20') }) })), _jsx("button", { type: 'button', disabled: step.disabled || !onStepClick, onClick: () => onStepClick?.(step), className: cn('relative z-10 flex h-8 w-8 scale-100 items-center justify-center rounded-full text-sm font-semibold transition-[background-color,border-color,color,transform] duration-[var(--motion-control)] ease-premium active:scale-[0.94] focus:outline-none focus-visible:ring-2 focus-visible:ring-sea focus-visible:ring-offset-2', styles.circle, onStepClick && !step.disabled && 'cursor-pointer', step.disabled && 'cursor-not-allowed opacity-50'), children: status === 'completed' ? _jsx(Check, { size: 16 }) : index + 1 }), _jsxs("div", { className: cn('mt-2 text-center', isHorizontal ? 'max-w-[8rem]' : 'text-left'), children: [_jsx("p", { className: cn('text-sm font-medium', status === 'active' ? 'text-text-primary dark:text-text-primary' : 'text-text-secondary dark:text-text-secondary'), children: step.label }), step.description && _jsx("p", { className: 'mt-0.5 text-xs text-text-secondary dark:text-text-secondary', children: step.description })] })] }, step.id));
|
|
32
32
|
}) }));
|
|
33
33
|
}
|
|
@@ -3,5 +3,5 @@ import React from 'react';
|
|
|
3
3
|
import { cn } from '../utils/cn.js';
|
|
4
4
|
export const Switch = React.forwardRef(function Switch({ checked = false, className, disabled, id, label, onCheckedChange, ...props }, ref) {
|
|
5
5
|
const inputId = id ?? React.useId();
|
|
6
|
-
return (_jsxs("label", { htmlFor: inputId, className: cn('inline-flex cursor-pointer select-none items-center gap-3', disabled && 'cursor-not-allowed opacity-50', className), children: [_jsxs("span", { className: 'relative inline-flex', children: [_jsx("input", { ref: ref, id: inputId, type: 'checkbox', role: 'switch', checked: checked, disabled: disabled, onChange: (e) => onCheckedChange?.(e.target.checked), className: 'sr-only', "aria-checked": checked, ...props }), _jsx("span", { className: cn('block h-
|
|
6
|
+
return (_jsxs("label", { htmlFor: inputId, className: cn('inline-flex cursor-pointer select-none items-center gap-3', disabled && 'cursor-not-allowed opacity-50', className), children: [_jsxs("span", { className: 'relative inline-flex', children: [_jsx("input", { ref: ref, id: inputId, type: 'checkbox', role: 'switch', checked: checked, disabled: disabled, onChange: (e) => onCheckedChange?.(e.target.checked), className: 'sr-only', "aria-checked": checked, ...props }), _jsx("span", { className: cn('block h-5 w-9 rounded-full border border-transparent transition-colors duration-[var(--motion-control)] ease-premium', checked ? 'bg-sea dark:bg-accent-blue' : 'border-sand/35 bg-sand/25 dark:border-white/10 dark:bg-white/15') }), _jsx("span", { className: cn('absolute left-0.5 top-0.5 block h-4 w-4 rounded-full bg-white shadow-[0_1px_2px_rgba(26,55,77,0.18)] transition-transform duration-[var(--motion-surface)] ease-premium', checked ? 'translate-x-4' : 'translate-x-0') })] }), label ? _jsx("span", { className: 'text-sm font-medium text-text-primary dark:text-text-primary', children: label }) : null] }));
|
|
7
7
|
});
|