@gaulatti/bleecker 0.1.41 → 0.1.42

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Javier Godoy and contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -104,6 +104,11 @@ Interactive overlays and selection controls use accessible behavioral primitives
104
104
 
105
105
  Applications are still responsible for meaningful labels, logical page structure, and testing complete user flows in their own context.
106
106
 
107
+ Modal surfaces activate keyboard focus when their panels mount, contain Tab
108
+ navigation, and restore focus and scrolling after dismissal, including nested
109
+ panels. See the [modal keyboard lifecycle](docs/modal-keyboard-lifecycle.md) for
110
+ the contract, interaction fixtures, and browser evidence.
111
+
107
112
  ## Shared foundations
108
113
 
109
114
  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:
@@ -115,6 +120,14 @@ import { radii, spacing, themes } from '@gaulatti/bleecker/tokens';
115
120
 
116
121
  `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.
117
122
 
123
+ ## Generated contract conformance
124
+
125
+ Bleecker may consume a pinned renderer-neutral artifact as conformance input,
126
+ but generated output never overwrites its hand-authored components. The
127
+ [Kolibri Toggle parity decision](docs/kolibri-toggle-parity.md) documents the
128
+ first bounded proof, its immutable fixture, browser accessibility and visual
129
+ evidence, unsupported `ToggleGroup` boundary, and proceed-with-adapter result.
130
+
118
131
  ## Development
119
132
 
120
133
  ```sh
@@ -125,3 +138,8 @@ npm run build
125
138
  ```
126
139
 
127
140
  The build cleans generated output before compilation so removed modules cannot remain in published packages.
141
+
142
+ ## License
143
+
144
+ Bleecker, including its published npm versions, is available under the
145
+ [MIT License](LICENSE).
@@ -5,53 +5,18 @@ import React from 'react';
5
5
  import { createPortal } from 'react-dom';
6
6
  import { Button } from './button.js';
7
7
  import { cn } from '../utils/cn.js';
8
- import { usePresence } from '../utils/hooks.js';
8
+ import { ModalLayerScope, useModalLayer, usePresence } from '../utils/hooks.js';
9
9
  export function AlertDialog({ cancelLabel = 'Cancel', className, confirmLabel = 'Continue', confirmLoading = false, description, isOpen, onCancel, onConfirm, title, variant = 'default' }) {
10
- const dialogRef = React.useRef(null);
10
+ const requestCancel = () => { if (isOpen && !confirmLoading)
11
+ onCancel(); };
12
+ const dialogRef = useModalLayer(isOpen, requestCancel);
11
13
  const titleId = React.useId();
12
14
  const descriptionId = React.useId();
13
15
  const { present, visible } = usePresence(isOpen, 150);
14
- React.useLayoutEffect(() => {
15
- const dialog = dialogRef.current;
16
- if (!present || !dialog)
17
- return;
18
- if (isOpen && !dialog.open) {
19
- dialog.showModal();
20
- }
21
- return () => {
22
- if (!isOpen && dialog.open)
23
- dialog.close();
24
- };
25
- }, [isOpen, present]);
26
- // Trap focus & handle keyboard dismissal
27
- React.useEffect(() => {
28
- if (!isOpen)
29
- return;
30
- const handleKeyDown = (event) => {
31
- if (event.key === 'Escape') {
32
- event.preventDefault();
33
- if (!confirmLoading)
34
- onCancel();
35
- }
36
- };
37
- document.addEventListener('keydown', handleKeyDown);
38
- return () => document.removeEventListener('keydown', handleKeyDown);
39
- }, [isOpen, onCancel, confirmLoading]);
40
16
  if (typeof document === 'undefined' || !present) {
41
17
  return null;
42
18
  }
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) => {
44
- if (event.target === dialogRef.current) {
45
- onCancel();
46
- }
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);
19
+ return createPortal(_jsx(ModalLayerScope, { layerRef: dialogRef, children: _jsxs("div", { "data-bleecker-modal-overlay": true, className: cn('fixed inset-0 z-50 flex p-4', !isOpen && 'pointer-events-none'), "aria-hidden": !isOpen || undefined, children: [_jsx("div", { "aria-hidden": 'true', onClick: requestCancel, className: cn('absolute inset-0 bg-deep-sea/38 backdrop-blur-[2px] transition-opacity dark:bg-black/65', visible ? 'opacity-100 duration-[var(--motion-control)]' : 'opacity-0 duration-[var(--motion-exit)]') }), _jsx("div", { ref: dialogRef, role: 'alertdialog', "aria-modal": 'true', tabIndex: -1, "aria-labelledby": titleId, "aria-describedby": description ? descriptionId : undefined, "data-state": visible ? 'open' : 'closing', className: cn('modal-motion relative m-auto max-h-[calc(100dvh-2rem)] w-full max-w-md overflow-auto rounded-[var(--radius-dialog)] border border-sand/30 bg-white p-0 text-text-primary shadow-[var(--shadow-overlay)] outline-none dark:border-white/12 dark:bg-deep-sea dark:text-text-primary', className), 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'
20
+ ? 'border-terracotta/15 bg-terracotta/[0.07] text-terracotta dark:bg-terracotta/15'
21
+ : '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);
57
22
  }
@@ -6,7 +6,7 @@ import { createPortal } from 'react-dom';
6
6
  import { Button } from './button.js';
7
7
  import { Kbd } from './kbd.js';
8
8
  import { cn } from '../utils/cn.js';
9
- import { usePresence } from '../utils/hooks.js';
9
+ import { ModalLayerScope, useModalLayer, usePresence } from '../utils/hooks.js';
10
10
  const DEFAULT_GROUP = 'Actions';
11
11
  function normalize(text) {
12
12
  return text.trim().toLowerCase();
@@ -108,17 +108,6 @@ export function CommandSpotlight({ actions, className, dialogClassName, emptyMes
108
108
  }
109
109
  setIsMacLike(/mac|iphone|ipad|ipod/i.test(navigator.platform));
110
110
  }, []);
111
- React.useEffect(() => {
112
- if (!isOpen) {
113
- return;
114
- }
115
- const timeout = window.setTimeout(() => {
116
- inputRef.current?.focus();
117
- }, 0);
118
- return () => {
119
- window.clearTimeout(timeout);
120
- };
121
- }, [isOpen]);
122
111
  React.useEffect(() => {
123
112
  if (!isOpen) {
124
113
  return;
@@ -155,17 +144,13 @@ export function CommandSpotlight({ actions, className, dialogClassName, emptyMes
155
144
  }
156
145
  return;
157
146
  }
158
- if (!isOpen || pressedKey !== 'escape') {
159
- return;
160
- }
161
- event.preventDefault();
162
- closeSpotlight();
163
147
  };
164
148
  window.addEventListener('keydown', handleWindowKeyDown);
165
149
  return () => {
166
150
  window.removeEventListener('keydown', handleWindowKeyDown);
167
151
  };
168
152
  }, [closeSpotlight, hotkey, isOpen, setIsOpen]);
153
+ const panelRef = useModalLayer(isOpen, closeSpotlight);
169
154
  const hotkeyHint = React.useMemo(() => {
170
155
  const modifier = isMacLike ? '⌘' : 'Ctrl';
171
156
  return [modifier, hotkey.toUpperCase()];
@@ -174,41 +159,41 @@ export function CommandSpotlight({ actions, className, dialogClassName, emptyMes
174
159
  setIsOpen(true);
175
160
  }, 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
161
  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) => {
180
- if (event.key === 'ArrowDown') {
181
- event.preventDefault();
182
- moveSelection(1);
183
- return;
184
- }
185
- if (event.key === 'ArrowUp') {
186
- event.preventDefault();
187
- moveSelection(-1);
188
- return;
189
- }
190
- if (event.key === 'Enter') {
191
- event.preventDefault();
192
- if (!selectedActionId) {
162
+ ? createPortal(_jsx(ModalLayerScope, { layerRef: panelRef, children: _jsxs("div", { "data-bleecker-modal-overlay": true, "aria-hidden": !isOpen || undefined, className: cn('fixed inset-0 z-9999 flex items-start justify-center px-4 pt-[12vh]', !isOpen && 'pointer-events-none', 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", { ref: panelRef, tabIndex: -1, "aria-label": 'Command spotlight', 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
163
+ ? 'translate-y-0 scale-100 opacity-100 duration-[var(--motion-overlay)] ease-premium'
164
+ : '-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) => {
165
+ if (event.key === 'ArrowDown') {
166
+ event.preventDefault();
167
+ moveSelection(1);
168
+ return;
169
+ }
170
+ if (event.key === 'ArrowUp') {
171
+ event.preventDefault();
172
+ moveSelection(-1);
193
173
  return;
194
174
  }
195
- const selectedAction = filteredActions.find((action) => action.id === selectedActionId);
196
- if (selectedAction) {
197
- runAction(selectedAction);
175
+ if (event.key === 'Enter') {
176
+ event.preventDefault();
177
+ if (!selectedActionId) {
178
+ return;
179
+ }
180
+ const selectedAction = filteredActions.find((action) => action.id === selectedActionId);
181
+ if (selectedAction) {
182
+ runAction(selectedAction);
183
+ }
198
184
  }
199
- }
200
- }, placeholder: placeholder, className: 'w-full bg-transparent text-base text-text-primary outline-none placeholder:text-text-secondary dark:text-text-primary dark:placeholder:text-text-secondary' }), _jsx(Kbd, { keys: hotkeyHint })] }), _jsx("div", { className: 'max-h-[55vh] overflow-y-auto p-2', children: groupedActions.length === 0 ? (_jsx("p", { className: 'px-3 py-12 text-center text-sm text-text-secondary dark:text-text-secondary', children: emptyMessage })) : (groupedActions.map(([group, groupActions]) => (_jsxs("section", { className: 'mb-3 last:mb-0', children: [_jsx("p", { className: 'px-3 pb-1 text-[11px] font-semibold uppercase tracking-wider text-text-secondary dark:text-text-secondary', children: group }), _jsx("div", { className: 'space-y-1', children: groupActions.map((action) => {
201
- const isSelected = action.id === selectedActionId;
202
- return (_jsxs("button", { type: 'button', ref: (element) => {
203
- actionRefs.current[action.id] = element;
204
- }, disabled: action.disabled, onClick: () => runAction(action), onMouseEnter: () => {
205
- if (!action.disabled) {
206
- setSelectedActionId(action.id);
207
- }
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
209
- ? 'bg-sea/10 text-sea dark:bg-accent-blue/15 dark:text-accent-blue'
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));
211
- }) })] }, group)))) })] })] }), document.body)
185
+ }, placeholder: placeholder, className: 'w-full bg-transparent text-base text-text-primary outline-none placeholder:text-text-secondary dark:text-text-primary dark:placeholder:text-text-secondary' }), _jsx(Kbd, { keys: hotkeyHint })] }), _jsx("div", { className: 'max-h-[55vh] overflow-y-auto p-2', children: groupedActions.length === 0 ? (_jsx("p", { className: 'px-3 py-12 text-center text-sm text-text-secondary dark:text-text-secondary', children: emptyMessage })) : (groupedActions.map(([group, groupActions]) => (_jsxs("section", { className: 'mb-3 last:mb-0', children: [_jsx("p", { className: 'px-3 pb-1 text-[11px] font-semibold uppercase tracking-wider text-text-secondary dark:text-text-secondary', children: group }), _jsx("div", { className: 'space-y-1', children: groupActions.map((action) => {
186
+ const isSelected = action.id === selectedActionId;
187
+ return (_jsxs("button", { type: 'button', ref: (element) => {
188
+ actionRefs.current[action.id] = element;
189
+ }, disabled: action.disabled, onClick: () => runAction(action), onMouseEnter: () => {
190
+ if (!action.disabled) {
191
+ setSelectedActionId(action.id);
192
+ }
193
+ }, 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
194
+ ? 'bg-sea/10 text-sea dark:bg-accent-blue/15 dark:text-accent-blue'
195
+ : '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));
196
+ }) })] }, group)))) })] })] }) }), document.body)
212
197
  : null;
213
198
  return (_jsxs("div", { className: className, children: [renderTrigger, renderOverlay] }));
214
199
  }
@@ -2,9 +2,15 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as React from 'react';
3
3
  import * as ContextMenuPrimitive from '@radix-ui/react-context-menu';
4
4
  import { cn } from '../utils/cn.js';
5
+ import { useModalBranch } from '../utils/hooks.js';
6
+ import { useComposedRefs } from '@radix-ui/react-compose-refs';
5
7
  const ContextMenu = ContextMenuPrimitive.Root;
6
8
  const ContextMenuTrigger = ContextMenuPrimitive.Trigger;
7
- const ContextMenuContent = React.forwardRef(({ className, ...props }, ref) => (_jsx(ContextMenuPrimitive.Portal, { children: _jsx(ContextMenuPrimitive.Content, { ref: ref, className: cn('z-50 min-w-[10rem] overflow-hidden rounded-[var(--radius-ui)] border border-sand/35 bg-white p-1.5 text-text-primary shadow-[var(--shadow-overlay)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0 data-[state=open]:zoom-in-[0.99] data-[state=closed]:zoom-out-[0.99] data-[state=open]:duration-[var(--motion-surface)] data-[state=closed]:duration-[var(--motion-exit)] data-[state=open]:ease-premium data-[state=closed]:ease-in dark:border-white/15 dark:bg-deep-sea dark:text-text-primary', className), ...props }) })));
9
+ const ContextMenuContent = React.forwardRef(({ className, ...props }, ref) => {
10
+ const branchRef = useModalBranch();
11
+ const composedRef = useComposedRefs(ref, branchRef);
12
+ return (_jsx(ContextMenuPrimitive.Portal, { children: _jsx(ContextMenuPrimitive.Content, { ref: composedRef, className: cn('z-50 min-w-[10rem] overflow-hidden rounded-[var(--radius-ui)] border border-sand/35 bg-white p-1.5 text-text-primary shadow-[var(--shadow-overlay)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0 data-[state=open]:zoom-in-[0.99] data-[state=closed]:zoom-out-[0.99] data-[state=open]:duration-[var(--motion-surface)] data-[state=closed]:duration-[var(--motion-exit)] data-[state=open]:ease-premium data-[state=closed]:ease-in dark:border-white/15 dark:bg-deep-sea dark:text-text-primary', className), ...props }) }));
13
+ });
8
14
  ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;
9
15
  const ContextMenuItem = React.forwardRef(({ className, inset, ...props }, ref) => (_jsx(ContextMenuPrimitive.Item, { ref: ref, className: cn('relative flex min-h-9 cursor-default select-none items-center rounded-[5px] px-2.5 py-1.5 text-[13px] text-text-primary outline-none transition-colors duration-[var(--motion-control)] ease-premium focus:bg-light-sand data-[disabled]:pointer-events-none data-[disabled]:opacity-40 dark:text-text-primary dark:focus:bg-white/[0.07]', inset && 'pl-8', className), ...props })));
10
16
  ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName;
@@ -4,7 +4,7 @@ import { Minus } from 'lucide-react';
4
4
  import React from 'react';
5
5
  import { createPortal } from 'react-dom';
6
6
  import { cn } from '../utils/cn.js';
7
- import { useModalLayer, usePresence } from '../utils/hooks.js';
7
+ import { ModalLayerScope, useModalLayer, usePresence } from '../utils/hooks.js';
8
8
  export function Drawer({ children, className, description, isOpen, onClose, title }) {
9
9
  const { present, visible } = usePresence(isOpen, 180);
10
10
  const startYRef = React.useRef(null);
@@ -24,5 +24,5 @@ export function Drawer({ children, className, description, isOpen, onClose, titl
24
24
  };
25
25
  if (typeof document === 'undefined' || !present)
26
26
  return null;
27
- return createPortal(_jsxs("div", { className: 'fixed inset-0 z-50', children: [_jsx("div", { className: cn('absolute inset-0 bg-deep-sea/38 backdrop-blur-[2px] transition-opacity ease-premium dark:bg-black/65', visible ? 'duration-[var(--motion-overlay)]' : 'duration-[180ms] ease-in', visible ? 'opacity-100' : 'opacity-0'), onClick: onClose, "aria-hidden": 'true' }), _jsxs("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, onTouchStart: handleTouchStart, onTouchEnd: handleTouchEnd, className: cn('absolute inset-x-0 bottom-0 flex max-h-[90dvh] flex-col rounded-t-[var(--radius-dialog)] border-t border-sand/30 bg-white shadow-[var(--shadow-overlay)] transition-transform dark:border-white/12 dark:bg-deep-sea', visible ? 'duration-[var(--motion-overlay)] ease-premium' : 'duration-[180ms] ease-in', visible ? 'translate-y-0' : 'translate-y-full', className), children: [_jsx("div", { className: 'flex items-center justify-center pt-3 pb-1', children: _jsx(Minus, { size: 24, className: 'text-sand/40 dark:text-sand/50', strokeWidth: 3, "aria-hidden": 'true' }) }), (title || description) && (_jsxs("div", { className: 'px-6 pb-4 pt-1', children: [title ? _jsx("h2", { id: titleId, className: 'text-lg 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("div", { className: 'flex-1 overflow-y-auto px-6 pb-6 pt-0', children: children })] })] }), document.body);
27
+ return createPortal(_jsx(ModalLayerScope, { layerRef: panelRef, children: _jsxs("div", { "data-bleecker-modal-overlay": true, className: cn('fixed inset-0 z-50', !isOpen && 'pointer-events-none'), "aria-hidden": !isOpen || undefined, children: [_jsx("div", { className: cn('absolute inset-0 bg-deep-sea/38 backdrop-blur-[2px] transition-opacity ease-premium dark:bg-black/65', visible ? 'duration-[var(--motion-overlay)]' : 'duration-[180ms] ease-in', visible ? 'opacity-100' : 'opacity-0'), onClick: onClose, "aria-hidden": 'true' }), _jsxs("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, onTouchStart: handleTouchStart, onTouchEnd: handleTouchEnd, className: cn('absolute inset-x-0 bottom-0 flex max-h-[90dvh] flex-col rounded-t-[var(--radius-dialog)] border-t border-sand/30 bg-white shadow-[var(--shadow-overlay)] transition-transform dark:border-white/12 dark:bg-deep-sea', visible ? 'duration-[var(--motion-overlay)] ease-premium' : 'duration-[180ms] ease-in', visible ? 'translate-y-0' : 'translate-y-full', className), children: [_jsx("div", { className: 'flex items-center justify-center pt-3 pb-1', children: _jsx(Minus, { size: 24, className: 'text-sand/40 dark:text-sand/50', strokeWidth: 3, "aria-hidden": 'true' }) }), (title || description) && (_jsxs("div", { className: 'px-6 pb-4 pt-1', children: [title ? _jsx("h2", { id: titleId, className: 'text-lg 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("div", { className: 'flex-1 overflow-y-auto px-6 pb-6 pt-0', children: children })] })] }) }), document.body);
28
28
  }
@@ -3,6 +3,8 @@ import * as React from 'react';
3
3
  import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
4
4
  import { Check, ChevronRight, Circle } from 'lucide-react';
5
5
  import { cn } from '../utils/cn.js';
6
+ import { useModalBranch } from '../utils/hooks.js';
7
+ import { useComposedRefs } from '@radix-ui/react-compose-refs';
6
8
  const DropdownMenu = DropdownMenuPrimitive.Root;
7
9
  const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
8
10
  const DropdownMenuGroup = DropdownMenuPrimitive.Group;
@@ -11,9 +13,17 @@ const DropdownMenuSub = DropdownMenuPrimitive.Sub;
11
13
  const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
12
14
  const DropdownMenuSubTrigger = React.forwardRef(({ className, inset, children, ...props }, ref) => (_jsxs(DropdownMenuPrimitive.SubTrigger, { ref: ref, className: cn('flex cursor-default select-none items-center rounded-[var(--radius-ui)] px-2 py-1.5 text-sm text-text-primary outline-none transition-colors duration-[var(--motion-control)] ease-premium focus:bg-sand/10 data-[state=open]:bg-sand/10 dark:text-text-primary dark:focus:bg-sand/15', inset && 'pl-8', className), ...props, children: [children, _jsx(ChevronRight, { size: 16, className: 'ml-auto' })] })));
13
15
  DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
14
- const DropdownMenuSubContent = React.forwardRef(({ className, ...props }, ref) => (_jsx(DropdownMenuPrimitive.SubContent, { ref: ref, className: cn('z-50 min-w-[9rem] overflow-hidden rounded-[var(--radius-ui)] border border-sand/35 bg-card p-1.5 shadow-[var(--shadow-overlay)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-[0.99] data-[state=open]:zoom-in-[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', className), ...props })));
16
+ const DropdownMenuSubContent = React.forwardRef(({ className, ...props }, ref) => {
17
+ const branchRef = useModalBranch();
18
+ const composedRef = useComposedRefs(ref, branchRef);
19
+ return (_jsx(DropdownMenuPrimitive.SubContent, { ref: composedRef, className: cn('z-50 min-w-[9rem] overflow-hidden rounded-[var(--radius-ui)] border border-sand/35 bg-card p-1.5 shadow-[var(--shadow-overlay)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-[0.99] data-[state=open]:zoom-in-[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', className), ...props }));
20
+ });
15
21
  DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
16
- const DropdownMenuContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => (_jsx(DropdownMenuPrimitive.Portal, { children: _jsx(DropdownMenuPrimitive.Content, { ref: ref, sideOffset: sideOffset, className: cn('z-50 min-w-[11rem] overflow-hidden rounded-[var(--radius-ui)] border border-sand/35 bg-card p-1.5 shadow-[var(--shadow-overlay)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-[0.99] data-[state=open]:zoom-in-[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', className), ...props }) })));
22
+ const DropdownMenuContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => {
23
+ const branchRef = useModalBranch();
24
+ const composedRef = useComposedRefs(ref, branchRef);
25
+ return (_jsx(DropdownMenuPrimitive.Portal, { children: _jsx(DropdownMenuPrimitive.Content, { ref: composedRef, sideOffset: sideOffset, className: cn('z-50 min-w-[11rem] overflow-hidden rounded-[var(--radius-ui)] border border-sand/35 bg-card p-1.5 shadow-[var(--shadow-overlay)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-[0.99] data-[state=open]:zoom-in-[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', className), ...props }) }));
26
+ });
17
27
  DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
18
28
  const DropdownMenuItem = React.forwardRef(({ className, inset, ...props }, ref) => (_jsx(DropdownMenuPrimitive.Item, { ref: ref, className: cn('relative flex cursor-pointer select-none items-center rounded-[var(--radius-ui)] px-2 py-1.5 text-sm text-text-primary outline-none transition-colors duration-[var(--motion-control)] ease-premium focus:bg-sand/10 focus:text-text-primary data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:text-text-primary dark:focus:bg-sand/15', inset && 'pl-8', className), ...props })));
19
29
  DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
@@ -4,66 +4,16 @@ import React from 'react';
4
4
  import { createPortal } from 'react-dom';
5
5
  import { DialogCloseButton } from './dialog-close-button.js';
6
6
  import { cn } from '../utils/cn.js';
7
+ import { ModalLayerScope, useModalLayer, usePresence } from '../utils/hooks.js';
7
8
  export function Modal({ children, className, isOpen, onClose, title }) {
8
- const dialogRef = React.useRef(null);
9
- const closeTimerRef = React.useRef(null);
10
- const openTimerRef = React.useRef(null);
9
+ const { present: isPresent, visible } = usePresence(isOpen, 150);
10
+ const dialogRef = useModalLayer(isOpen, onClose);
11
11
  const titleId = React.useId();
12
- const [isPresent, setIsPresent] = React.useState(isOpen);
13
- const [motionState, setMotionState] = React.useState(isOpen ? 'opening' : 'closing');
14
- React.useEffect(() => {
15
- if (isOpen) {
16
- if (closeTimerRef.current)
17
- clearTimeout(closeTimerRef.current);
18
- setIsPresent(true);
19
- setMotionState('opening');
20
- return;
21
- }
22
- if (isPresent) {
23
- setMotionState('closing');
24
- closeTimerRef.current = setTimeout(() => {
25
- dialogRef.current?.close();
26
- setIsPresent(false);
27
- }, 150);
28
- }
29
- }, [isOpen, isPresent]);
30
- React.useLayoutEffect(() => {
31
- const dialog = dialogRef.current;
32
- if (!isPresent || !isOpen || !dialog)
33
- return;
34
- if (!dialog.open)
35
- dialog.showModal();
36
- openTimerRef.current = setTimeout(() => setMotionState('open'), 20);
37
- return () => {
38
- if (openTimerRef.current)
39
- clearTimeout(openTimerRef.current);
40
- };
41
- }, [isOpen, isPresent]);
42
- React.useEffect(() => {
43
- return () => {
44
- if (closeTimerRef.current)
45
- clearTimeout(closeTimerRef.current);
46
- if (openTimerRef.current)
47
- clearTimeout(openTimerRef.current);
48
- dialogRef.current?.close();
49
- };
50
- }, []);
51
- const requestClose = () => {
52
- if (motionState !== 'closing')
53
- onClose();
54
- };
12
+ const motionState = visible ? 'open' : 'closing';
13
+ const requestClose = () => { if (isOpen)
14
+ onClose(); };
55
15
  if (typeof document === 'undefined' || !isPresent) {
56
16
  return null;
57
17
  }
58
- return createPortal(_jsx("dialog", { ref: dialogRef, "aria-labelledby": titleId, "data-state": motionState, className: cn('modal-motion m-auto w-full max-w-xl 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) => {
59
- if (event.target === dialogRef.current) {
60
- requestClose();
61
- }
62
- }, onCancel: (event) => {
63
- event.preventDefault();
64
- requestClose();
65
- }, onClose: () => {
66
- if (isOpen)
67
- onClose();
68
- }, children: _jsxs("div", { children: [_jsxs("div", { className: 'flex items-center justify-between gap-4 border-b border-sand/20 px-6 py-5 dark:border-white/[0.08] md:px-7', children: [_jsx("h2", { id: titleId, className: 'text-xl font-semibold tracking-refined text-text-primary dark:text-text-primary', children: title }), _jsx(DialogCloseButton, { onClick: requestClose, "aria-label": 'Close' })] }), _jsx("div", { className: 'px-6 py-6 md:px-7 md:py-7', children: children })] }) }), document.body);
18
+ return createPortal(_jsx(ModalLayerScope, { layerRef: dialogRef, children: _jsxs("div", { "data-bleecker-modal-overlay": true, className: cn('fixed inset-0 z-50 flex p-4', !isOpen && 'pointer-events-none'), "aria-hidden": !isOpen || undefined, children: [_jsx("div", { "aria-hidden": 'true', onClick: requestClose, className: cn('absolute inset-0 bg-deep-sea/38 backdrop-blur-[2px] transition-opacity dark:bg-black/65', visible ? 'opacity-100 duration-[var(--motion-control)]' : 'opacity-0 duration-[var(--motion-exit)]') }), _jsx("div", { ref: dialogRef, role: 'dialog', "aria-modal": 'true', "aria-labelledby": titleId, tabIndex: -1, "data-state": motionState, className: cn('modal-motion relative m-auto max-h-[calc(100dvh-2rem)] w-full max-w-xl overflow-auto rounded-[var(--radius-dialog)] border border-sand/30 bg-white p-0 text-text-primary shadow-[var(--shadow-overlay)] outline-none dark:border-white/12 dark:bg-deep-sea dark:text-text-primary', className), children: _jsxs("div", { children: [_jsxs("div", { className: 'flex items-center justify-between gap-4 border-b border-sand/20 px-6 py-5 dark:border-white/[0.08] md:px-7', children: [_jsx("h2", { id: titleId, className: 'text-xl font-semibold tracking-refined text-text-primary dark:text-text-primary', children: title }), _jsx(DialogCloseButton, { onClick: requestClose, "aria-label": 'Close' })] }), _jsx("div", { className: 'px-6 py-6 md:px-7 md:py-7', children: children })] }) })] }) }), document.body);
69
19
  }
@@ -1,6 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import * as PopoverPrimitive from '@radix-ui/react-popover';
3
3
  import { cn } from '../utils/cn.js';
4
+ import { useModalBranch } from '../utils/hooks.js';
4
5
  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 }) })] }));
6
+ const branchRef = useModalBranch();
7
+ 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, { ref: branchRef, 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 }) })] }));
6
8
  }
@@ -3,6 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import * as SelectPrimitive from '@radix-ui/react-select';
4
4
  import { Check, ChevronDown, ChevronUp } from 'lucide-react';
5
5
  import { cn } from '../utils/cn.js';
6
+ import { useModalBranch } from '../utils/hooks.js';
6
7
  const EMPTY_OPTION_VALUE = '__bleecker_empty_option__';
7
8
  const triggerSizeClasses = {
8
9
  sm: 'h-9 gap-2 px-3 text-[13px]',
@@ -12,5 +13,6 @@ const triggerSizeClasses = {
12
13
  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
14
  const hasEmptyOption = options.some((option) => option.value === '');
14
15
  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' }) })] }) })] }));
16
+ const branchRef = useModalBranch();
17
+ 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, { ref: branchRef, 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' }) })] }) })] }));
16
18
  }
@@ -4,7 +4,7 @@ import React from 'react';
4
4
  import { createPortal } from 'react-dom';
5
5
  import { DialogCloseButton } from './dialog-close-button.js';
6
6
  import { cn } from '../utils/cn.js';
7
- import { useModalLayer, usePresence } from '../utils/hooks.js';
7
+ import { ModalLayerScope, useModalLayer, usePresence } from '../utils/hooks.js';
8
8
  const sideStyles = {
9
9
  right: {
10
10
  panel: 'inset-y-0 right-0 h-full w-full max-w-sm',
@@ -35,5 +35,5 @@ export function Sheet({ children, className, description, isOpen, onClose, scrol
35
35
  const panelRef = useModalLayer(isOpen, onClose);
36
36
  if (typeof document === 'undefined' || !present)
37
37
  return null;
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);
38
+ return createPortal(_jsx(ModalLayerScope, { layerRef: panelRef, children: _jsxs("div", { "data-bleecker-modal-overlay": true, className: cn('fixed inset-0 z-50 flex', !isOpen && 'pointer-events-none'), "aria-hidden": !isOpen || undefined, 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);
39
39
  }
@@ -1,6 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
3
3
  import { cn } from '../utils/cn.js';
4
+ import { useModalBranch } from '../utils/hooks.js';
4
5
  export function Tooltip({ children, className, content, delayDuration = 400, side = 'top' }) {
5
- return (_jsx(TooltipPrimitive.Provider, { delayDuration: delayDuration, skipDelayDuration: 150, children: _jsxs(TooltipPrimitive.Root, { children: [_jsx(TooltipPrimitive.Trigger, { asChild: true, children: children }), _jsx(TooltipPrimitive.Portal, { children: _jsxs(TooltipPrimitive.Content, { side: side, sideOffset: 7, collisionPadding: 10, className: cn('z-[180] max-w-56 rounded-md bg-deep-sea px-3 py-2 text-xs leading-relaxed text-white shadow-[var(--shadow-overlay)] data-[state=delayed-open]:animate-in data-[state=closed]:animate-out data-[state=delayed-open]:fade-in-0 data-[state=closed]:fade-out-0 data-[state=delayed-open]:zoom-in-[0.98] data-[state=closed]:zoom-out-[0.98] data-[state=delayed-open]:duration-[var(--motion-surface)] data-[state=closed]:duration-[var(--motion-exit)] data-[state=delayed-open]:ease-premium data-[state=closed]:ease-in dark:bg-sand dark:text-deep-sea', className), children: [content, _jsx(TooltipPrimitive.Arrow, { className: 'fill-deep-sea dark:fill-sand' })] }) })] }) }));
6
+ const branchRef = useModalBranch();
7
+ return (_jsx(TooltipPrimitive.Provider, { delayDuration: delayDuration, skipDelayDuration: 150, children: _jsxs(TooltipPrimitive.Root, { children: [_jsx(TooltipPrimitive.Trigger, { asChild: true, children: children }), _jsx(TooltipPrimitive.Portal, { children: _jsxs(TooltipPrimitive.Content, { ref: branchRef, side: side, sideOffset: 7, collisionPadding: 10, className: cn('z-[180] max-w-56 rounded-md bg-deep-sea px-3 py-2 text-xs leading-relaxed text-white shadow-[var(--shadow-overlay)] data-[state=delayed-open]:animate-in data-[state=closed]:animate-out data-[state=delayed-open]:fade-in-0 data-[state=closed]:fade-out-0 data-[state=delayed-open]:zoom-in-[0.98] data-[state=closed]:zoom-out-[0.98] data-[state=delayed-open]:duration-[var(--motion-surface)] data-[state=closed]:duration-[var(--motion-exit)] data-[state=delayed-open]:ease-premium data-[state=closed]:ease-in dark:bg-sand dark:text-text-primary', className), children: [content, _jsx(TooltipPrimitive.Arrow, { className: 'fill-deep-sea dark:fill-sand' })] }) })] }) }));
6
8
  }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export * from './core';
2
- export * from './tokens';
1
+ export * from './core/index';
2
+ export * from './tokens/index';
3
3
  export * from './components/brand-lockup';
4
4
  export * from './components/bauhaus-background';
5
5
  export * from './components/activity-item';
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- export * from './core.js';
2
- export * from './tokens.js';
1
+ export * from './core/index.js';
2
+ export * from './tokens/index.js';
3
3
  export * from './components/brand-lockup.js';
4
4
  export * from './components/bauhaus-background.js';
5
5
  export * from './components/activity-item.js';