@gaulatti/bleecker 0.1.41 → 0.1.44
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 +21 -0
- package/README.md +116 -1
- package/dist/components/alert-dialog.js +7 -42
- package/dist/components/alert.js +0 -7
- package/dist/components/breadcrumb.js +1 -1
- package/dist/components/button.js +2 -2
- package/dist/components/chart-theme.d.ts +1 -1
- package/dist/components/command-spotlight.d.ts +2 -1
- package/dist/components/command-spotlight.js +35 -62
- package/dist/components/context-menu.d.ts +1 -1
- package/dist/components/context-menu.js +8 -2
- package/dist/components/dashboard-grid.d.ts +1 -1
- package/dist/components/dashboard-section.d.ts +1 -1
- package/dist/components/data-list.d.ts +1 -1
- package/dist/components/data-table-filters.d.ts +1 -1
- package/dist/components/data-table-toolbar.d.ts +1 -1
- package/dist/components/data-table.js +1 -1
- package/dist/components/drawer.js +2 -2
- package/dist/components/dropdown-menu.d.ts +1 -1
- package/dist/components/dropdown-menu.js +13 -3
- package/dist/components/error-state.d.ts +1 -1
- package/dist/components/eyebrow.d.ts +1 -1
- package/dist/components/feed-item.js +4 -11
- package/dist/components/icon-badge.d.ts +1 -1
- package/dist/components/icon-button.js +1 -1
- package/dist/components/input.js +1 -1
- package/dist/components/label.d.ts +1 -1
- package/dist/components/label.js +1 -1
- package/dist/components/loading-overlay.d.ts +1 -1
- package/dist/components/media-library.js +2 -4
- package/dist/components/metric.d.ts +1 -1
- package/dist/components/metric.js +1 -1
- package/dist/components/modal.js +7 -57
- package/dist/components/page-header.d.ts +1 -1
- package/dist/components/popover.js +3 -1
- package/dist/components/progress.js +2 -1
- package/dist/components/sankey-chart.js +1 -1
- package/dist/components/search-input.d.ts +1 -1
- package/dist/components/search-input.js +1 -1
- package/dist/components/select.js +4 -2
- package/dist/components/sheet.js +2 -2
- package/dist/components/sidebar.d.ts +1 -1
- package/dist/components/sidebar.js +1 -1
- package/dist/components/skeleton.d.ts +1 -1
- package/dist/components/stat-card.d.ts +1 -1
- package/dist/components/sunburst-chart.js +1 -1
- package/dist/components/table.js +3 -16
- package/dist/components/textarea.js +1 -1
- package/dist/components/timeline.d.ts +1 -1
- package/dist/components/tooltip.js +3 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/layout/admin-shell.d.ts +1 -1
- package/dist/layout/auth-shell.d.ts +8 -1
- package/dist/layout/auth-shell.js +8 -1
- package/dist/layout/panel-layout.js +0 -4
- package/dist/styles.css +1 -1
- package/dist/theme/theme-provider.d.ts +2 -2
- package/dist/theme/theme-provider.js +16 -20
- package/dist/theme/theme-script.d.ts +1 -1
- package/dist/theme/theme-script.js +1 -1
- package/dist/theme/types.d.ts +11 -0
- package/dist/utils/attention-color.js +4 -4
- package/dist/utils/avatar-initial.d.ts +1 -0
- package/dist/utils/avatar-initial.js +3 -0
- package/dist/utils/clamp-percent.d.ts +1 -0
- package/dist/utils/clamp-percent.js +3 -0
- package/dist/utils/format.js +17 -14
- package/dist/utils/hooks.d.ts +14 -3
- package/dist/utils/hooks.js +209 -43
- package/dist/utils/source-label.d.ts +1 -0
- package/dist/utils/source-label.js +9 -0
- package/package.json +14 -5
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
|
@@ -2,8 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Bleecker is a refined React component library built around the Encode Sans typeface and a warm, restrained palette of sand, sea, desert, and terracotta.
|
|
4
4
|
|
|
5
|
+
It is published on npm as `@gaulatti/bleecker`.
|
|
6
|
+
|
|
5
7
|
## Install
|
|
6
8
|
|
|
9
|
+
Bleecker ships ES modules only.
|
|
10
|
+
|
|
7
11
|
```sh
|
|
8
12
|
npm install @gaulatti/bleecker
|
|
9
13
|
```
|
|
@@ -21,6 +25,7 @@ Bleecker together with their own utilities:
|
|
|
21
25
|
Do not also import `@gaulatti/bleecker/styles.css` in a Tailwind application.
|
|
22
26
|
Doing so loads a second compiled utility layer and can change responsive layout
|
|
23
27
|
behavior through the cascade.
|
|
28
|
+
Import only one stylesheet integration per application.
|
|
24
29
|
|
|
25
30
|
Applications that do not compile Tailwind should instead import the complete,
|
|
26
31
|
precompiled stylesheet once:
|
|
@@ -29,6 +34,8 @@ precompiled stylesheet once:
|
|
|
29
34
|
import '@gaulatti/bleecker/styles.css';
|
|
30
35
|
```
|
|
31
36
|
|
|
37
|
+
Bleecker requires React 18.2 or newer (see `peerDependencies`).
|
|
38
|
+
|
|
32
39
|
## Attention feeds
|
|
33
40
|
|
|
34
41
|
Use Bleecker's feed primitives for multi-column monitoring, event indexes, and
|
|
@@ -52,6 +59,12 @@ import { FeedGrid } from '@gaulatti/bleecker/layout/feed-grid';
|
|
|
52
59
|
both the category-to-red color mix and the distance traveled by the gradient.
|
|
53
60
|
Consumers decide what intensity means—relevance, magnitude, risk, confidence,
|
|
54
61
|
or another domain measure—but should not reimplement the visual interpolation.
|
|
62
|
+
AttentionSurface renders an article unless `as` says otherwise.
|
|
63
|
+
Items inside a `FeedGrid` keep their source order.
|
|
64
|
+
|
|
65
|
+
Values outside 0–10 are clamped to that range, and a non-finite intensity is
|
|
66
|
+
treated as 0. `FeedGrid` uses a `minColumnWidth` of 340 pixels by default; a
|
|
67
|
+
number is read as pixels and a string is used as a CSS length.
|
|
55
68
|
|
|
56
69
|
```tsx
|
|
57
70
|
import { Button, Field, Input } from '@gaulatti/bleecker';
|
|
@@ -75,34 +88,72 @@ import { Button } from '@gaulatti/bleecker/components/button';
|
|
|
75
88
|
|
|
76
89
|
- Encode Sans is the primary voice. Use the `font-secondary` utility to opt specific supporting or editorial copy into Libre Franklin.
|
|
77
90
|
- Spacing follows a deliberate 4, 8, 12, 16, 24, 32, 48, and 64 pixel rhythm.
|
|
91
|
+
- Prefer the spacing rhythm over ad hoc pixel values.
|
|
78
92
|
- Borders carry surface hierarchy; shadows are reserved for elevated surfaces and overlays.
|
|
79
93
|
- Controls use consistent 32, 40, and 48 pixel heights.
|
|
80
94
|
- Motion is brief and functional, with reduced-motion behavior included globally.
|
|
95
|
+
- Spacing and radii values come from the shared tokens described in Shared foundations.
|
|
81
96
|
|
|
82
97
|
## Luxury composition
|
|
83
98
|
|
|
84
99
|
Luxury in Bleecker comes from editing and proportion, not decoration. The most reliable compositions use one dominant focal plane, one quieter supporting rail, and enough negative space for the hierarchy to remain obvious.
|
|
100
|
+
Jump to the [Development](#development) section.
|
|
85
101
|
|
|
86
102
|
- Start with `PageFrame` so product pages share the same gutters, readable widths, and vertical cadence.
|
|
87
103
|
- Use `DetailLayout` for asymmetric detail pages, editorial views, and sticky summary rails instead of assembling new grid proportions each time.
|
|
88
|
-
- Use `AuthShell` for focused sign-in, invitation, and onboarding moments with an optional narrative panel.
|
|
104
|
+
- Use `AuthShell` for focused sign-in, invitation, and onboarding moments with an optional narrative panel. It is the required outer layout for every React-DOM product login, including its loading, unavailable, and error states; see [the AuthShell standard](docs/auth-shell-standard.md).
|
|
89
105
|
- Prefer hairline borders for default surfaces. Reserve `Card`'s `elevated` variant and stronger shadows for the single surface that truly sits above the page.
|
|
90
106
|
- Keep supporting copy in `font-secondary`, eyebrow copy brief, and data labels at a readable contrast. A restrained accent should guide attention rather than tint every section.
|
|
91
107
|
- Avoid grids of equally weighted cards when one number, action, or story is more important. Give that item more scale or span and quiet the rest.
|
|
108
|
+
- One dominant focal plane per page keeps the hierarchy obvious.
|
|
92
109
|
|
|
93
110
|
Storybook's **Templates** section includes complete public, operational, commerce, hospitality, and private-client compositions. Treat them as starting points: keep their hierarchy and rhythm, then replace the domain copy and content.
|
|
111
|
+
Templates are examples, not required structure.
|
|
94
112
|
|
|
95
113
|
## Theming
|
|
96
114
|
|
|
97
115
|
The default light and dark themes are defined with `--app-*` custom properties in the stylesheet. Override those properties after importing Bleecker styles to adapt the theme without changing component markup.
|
|
116
|
+
The `--app-*` properties are listed in the stylesheet.
|
|
98
117
|
|
|
99
118
|
The `ThemeProvider`, `ThemeToggle`, and `BleeckerThemeScript` exports provide persisted light, dark, and system modes. Render `BleeckerThemeScript` in the document head when server rendering to avoid a theme flash.
|
|
119
|
+
Controlled hosts omit this script.
|
|
120
|
+
|
|
121
|
+
Pass `theme` and the required `onThemeChange` together for a parent-controlled,
|
|
122
|
+
storage-free provider. Requests do not change the provider until its parent
|
|
123
|
+
updates `theme`. Controlled hosts omit the persisted head script. See the
|
|
124
|
+
[controlled-theme contract](docs/controlled-theme.md).
|
|
125
|
+
|
|
126
|
+
The transparent link Button's themed-surface and hover checks are documented
|
|
127
|
+
in the [link contrast contract](docs/button-link-contrast.md).
|
|
128
|
+
Button and IconButton keyboard-focus indicators and their dedicated browser
|
|
129
|
+
checks are documented in the [focus contrast contract](docs/control-focus-contrast.md).
|
|
100
130
|
|
|
101
131
|
## Accessibility
|
|
102
132
|
|
|
103
133
|
Interactive overlays and selection controls use accessible behavioral primitives. Form controls forward native attributes; `Field` connects labels, descriptions, errors, and invalid state automatically.
|
|
104
134
|
|
|
105
135
|
Applications are still responsible for meaningful labels, logical page structure, and testing complete user flows in their own context.
|
|
136
|
+
Automated checks do not replace manual review.
|
|
137
|
+
The Accessibility section lists the supporting contracts.
|
|
138
|
+
The Accessibility section lists the supporting contracts.
|
|
139
|
+
|
|
140
|
+
Input and Textarea default placeholder contrast is covered by the mounted
|
|
141
|
+
[field-placeholder contract](docs/field-placeholders.md); explicit caller color
|
|
142
|
+
overrides remain the caller's responsibility.
|
|
143
|
+
|
|
144
|
+
`Select` stays controlled by its required string `value`, including `''`. Without
|
|
145
|
+
an explicit empty-valued option, clearing the parent value restores the supplied
|
|
146
|
+
placeholder and empty native form entry. An explicit empty-valued option keeps
|
|
147
|
+
its existing label and callback translation. The **Components/Select/Controlled
|
|
148
|
+
Empty** fixture exposes choice, callbacks, native value and submitted form value;
|
|
149
|
+
**Empty Option And Reading** covers the existing empty option and disabled saved
|
|
150
|
+
selection. See the [controlled reset contract](docs/select-controlled-reset.md)
|
|
151
|
+
for the feature boundary and remaining acceptance.
|
|
152
|
+
|
|
153
|
+
Modal surfaces activate keyboard focus when their panels mount, contain Tab
|
|
154
|
+
navigation, and restore focus and scrolling after dismissal, including nested
|
|
155
|
+
panels. See the [modal keyboard lifecycle](docs/modal-keyboard-lifecycle.md) for
|
|
156
|
+
the contract, interaction fixtures, and browser evidence.
|
|
106
157
|
|
|
107
158
|
## Shared foundations
|
|
108
159
|
|
|
@@ -114,6 +165,16 @@ import { radii, spacing, themes } from '@gaulatti/bleecker/tokens';
|
|
|
114
165
|
```
|
|
115
166
|
|
|
116
167
|
`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.
|
|
168
|
+
Edit the token source rather than the generated CSS.
|
|
169
|
+
|
|
170
|
+
## Generated contract conformance
|
|
171
|
+
|
|
172
|
+
Bleecker may consume a pinned renderer-neutral artifact as conformance input,
|
|
173
|
+
but generated output never overwrites its hand-authored components. The
|
|
174
|
+
[Kolibri Toggle parity decision](docs/kolibri-toggle-parity.md) documents the
|
|
175
|
+
first bounded proof, its immutable fixture, browser accessibility and visual
|
|
176
|
+
evidence, unsupported `ToggleGroup` boundary, and proceed-with-adapter result.
|
|
177
|
+
Hand-authored components remain the source of truth.
|
|
117
178
|
|
|
118
179
|
## Development
|
|
119
180
|
|
|
@@ -125,3 +186,57 @@ npm run build
|
|
|
125
186
|
```
|
|
126
187
|
|
|
127
188
|
The build cleans generated output before compilation so removed modules cannot remain in published packages.
|
|
189
|
+
|
|
190
|
+
### Tests and coverage
|
|
191
|
+
|
|
192
|
+
`npm test` runs every Vitest project: the Storybook interaction stories, the
|
|
193
|
+
button/focus contrast checks, the `unit` project (`tests/unit`, real Chromium
|
|
194
|
+
through Playwright) and the `ssr` project (`tests/ssr`, Node server rendering
|
|
195
|
+
for components that render nothing without a `document`). Run
|
|
196
|
+
`npx playwright install chromium` once before the browser projects.
|
|
197
|
+
|
|
198
|
+
`npm run test:coverage` writes an Istanbul-format V8 report to
|
|
199
|
+
`coverage/coverage-final.json`. The Clouseau gate requires exactly 100% line
|
|
200
|
+
and branch coverage over every non-test file in `src`; new behaviour needs a
|
|
201
|
+
test in `tests/unit` or `tests/ssr`, never a coverage pragma.
|
|
202
|
+
Coverage pragmas are not accepted.
|
|
203
|
+
|
|
204
|
+
## Pull request verification
|
|
205
|
+
|
|
206
|
+
Local agent review uses the shared `clouseau` skill with the developer's
|
|
207
|
+
authenticated coding harness and the `.clouseau-local.json` recipe; it needs no
|
|
208
|
+
CI provider keys. `AGENTS.md` owns the rule: run it against the final committed
|
|
209
|
+
change before opening a PR, repair findings, and publish the passing signed
|
|
210
|
+
receipt in the initial ready PR body. Never push directly to `main`.
|
|
211
|
+
|
|
212
|
+
Every PR runs, on `ubuntu-24.04` with Chromium installed for Playwright:
|
|
213
|
+
|
|
214
|
+
- the token, type, export/story, Kolibri, select-reset and theme checks,
|
|
215
|
+
- `npm run test:coverage`: every Vitest project (Storybook interactions, contrast,
|
|
216
|
+
unit and SSR) in one run, with exactly 100% line and branch coverage over `src`
|
|
217
|
+
(CI retries a failed Storybook story twice before reporting it),
|
|
218
|
+
- `npm run build` and `npm run build-storybook`,
|
|
219
|
+
- the workflow-contract tests in `.github/tests`.
|
|
220
|
+
|
|
221
|
+
A PR carrying an authenticated local review stamp is verified by the pinned
|
|
222
|
+
Clouseau engine without AI credentials; unstamped PRs use the CI reviewer.
|
|
223
|
+
Passing reviews receive a bot approval and native auto-merge. Unresolved
|
|
224
|
+
product-direction questions go to the owner, and changes to review controls need
|
|
225
|
+
the owner's `/approve-intent <head SHA>` comment. See [the purpose
|
|
226
|
+
contract](.github/clouseau.md). The CI engine is resolved from protected
|
|
227
|
+
Clouseau `main` at the start of each run (see
|
|
228
|
+
[automatic Clouseau CI upgrades](https://github.com/gaulatti/clouseau/blob/main/docs/automatic-ci-upgrades.md)).
|
|
229
|
+
|
|
230
|
+
A merge to `main` is not an npm release: package publication stays a separate,
|
|
231
|
+
explicitly authorized tag-triggered workflow, and the Storybook deployment
|
|
232
|
+
workflow is outside this review contract.
|
|
233
|
+
|
|
234
|
+
CI needs these repository secrets: `DEEPSEEK_API_KEY` and `TYPESAFE_API_KEY` for
|
|
235
|
+
the CI reviewer, and `DEPLOYMENT_TOKEN` (a token with contents write access
|
|
236
|
+
from an identity other than `github-actions[bot]`) for automatic repairs.
|
|
237
|
+
|
|
238
|
+
## License
|
|
239
|
+
|
|
240
|
+
Bleecker, including its published npm versions, is available under the
|
|
241
|
+
[MIT License](LICENSE).
|
|
242
|
+
See the `LICENSE` file for the full text.
|
|
@@ -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
|
|
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("
|
|
44
|
-
|
|
45
|
-
|
|
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
|
}
|
package/dist/components/alert.js
CHANGED
|
@@ -39,9 +39,6 @@ export function Alert({ className, duration = 5000, message, onClose, type = 'in
|
|
|
39
39
|
const config = alertConfig[type];
|
|
40
40
|
const Icon = config.icon;
|
|
41
41
|
React.useEffect(() => {
|
|
42
|
-
if (typeof window === 'undefined') {
|
|
43
|
-
return undefined;
|
|
44
|
-
}
|
|
45
42
|
window.requestAnimationFrame(() => {
|
|
46
43
|
setIsVisible(true);
|
|
47
44
|
});
|
|
@@ -55,10 +52,6 @@ export function Alert({ className, duration = 5000, message, onClose, type = 'in
|
|
|
55
52
|
}, [duration]);
|
|
56
53
|
const handleClose = () => {
|
|
57
54
|
setIsVisible(false);
|
|
58
|
-
if (typeof window === 'undefined') {
|
|
59
|
-
onClose();
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
55
|
window.setTimeout(onClose, 220);
|
|
63
56
|
};
|
|
64
57
|
if (typeof document === 'undefined') {
|
|
@@ -9,7 +9,7 @@ export function Breadcrumb({ className, collapsedAfter = 0, items, renderLink, s
|
|
|
9
9
|
const linkRenderer = renderLink ?? (renderDefaultLink);
|
|
10
10
|
const separatorNode = separator ?? _jsx(ChevronRight, { size: 14, className: 'flex-shrink-0 text-text-secondary', "aria-hidden": 'true' });
|
|
11
11
|
const shouldCollapse = collapsedAfter > 0 && !expanded && items.length > collapsedAfter + 1;
|
|
12
|
-
const visibleItems = shouldCollapse ? [items[0], null, ...items.slice(-
|
|
12
|
+
const visibleItems = shouldCollapse ? [items[0], null, ...items.slice(-1)] : items;
|
|
13
13
|
return (_jsx("nav", { "aria-label": 'Breadcrumb', className: cn('flex items-center', className), children: _jsx("ol", { className: 'flex flex-wrap items-center gap-1.5', children: visibleItems.map((item, index) => {
|
|
14
14
|
const isLast = index === visibleItems.length - 1;
|
|
15
15
|
if (item === null) {
|
|
@@ -8,7 +8,7 @@ const variantClasses = {
|
|
|
8
8
|
outline: 'border-sea/45 bg-transparent text-sea hover:border-sea/70 hover:bg-sea/[0.045] dark:border-accent-blue/45 dark:text-accent-blue dark:hover:border-accent-blue/70 dark:hover:bg-accent-blue/[0.07]',
|
|
9
9
|
subtle: 'border-transparent bg-light-sand/75 text-deep-sea hover:bg-sand/25 dark:bg-white/[0.07] dark:text-text-primary dark:hover:bg-white/[0.11]',
|
|
10
10
|
ghost: 'border-transparent bg-transparent text-text-primary hover:bg-sand/12 dark:text-text-primary dark:hover:bg-white/[0.06]',
|
|
11
|
-
link: 'h-auto border-transparent bg-transparent px-0 text-sea underline-offset-4 hover:text-deep-sea hover:underline active:translate-y-0 active:scale-100 dark:text-accent-blue dark:hover:text-
|
|
11
|
+
link: 'h-auto border-transparent bg-transparent px-0 text-sea underline-offset-4 hover:text-deep-sea hover:underline active:translate-y-0 active:scale-100 dark:text-accent-blue dark:hover:text-accent-blue',
|
|
12
12
|
destructive: 'border-terracotta bg-terracotta text-white shadow-[0_1px_2px_rgba(133,71,47,0.14)] hover:border-terracotta/90 hover:bg-terracotta/90 hover:shadow-[0_4px_12px_-7px_rgba(133,71,47,0.38)]'
|
|
13
13
|
};
|
|
14
14
|
const sizeClasses = {
|
|
@@ -18,7 +18,7 @@ const sizeClasses = {
|
|
|
18
18
|
lg: 'h-12 px-6 text-[15px]'
|
|
19
19
|
};
|
|
20
20
|
export const Button = React.forwardRef(function Button({ children, className, disabled, fullWidth = false, loading = false, size = 'md', type = 'button', variant = 'primary', as = 'button', href, ...props }, ref) {
|
|
21
|
-
const classes = cn('inline-flex shrink-0 translate-y-0 scale-100 items-center justify-center gap-2 whitespace-nowrap rounded-[var(--radius-button)] border font-medium tracking-ui transition-[background-color,border-color,color,box-shadow,transform,opacity] duration-[var(--motion-control)] ease-premium outline-none active:translate-y-px active:scale-[0.99] active:shadow-none focus-visible:ring-2 focus-visible:ring-sea
|
|
21
|
+
const classes = cn('inline-flex shrink-0 translate-y-0 scale-100 items-center justify-center gap-2 whitespace-nowrap rounded-[var(--radius-button)] border font-medium tracking-ui transition-[background-color,border-color,color,box-shadow,transform,opacity] duration-[var(--motion-control)] ease-premium outline-none active:translate-y-px active:scale-[0.99] active:shadow-none focus-visible:ring-2 focus-visible:ring-sea focus-visible:ring-offset-2 focus-visible:ring-offset-white disabled:pointer-events-none disabled:transform-none disabled:opacity-45 dark:focus-visible:ring-accent-blue dark:focus-visible:ring-offset-deep-sea', variantClasses[variant], variant !== 'link' && sizeClasses[size], fullWidth && 'w-full', className);
|
|
22
22
|
if (as === 'a' || href) {
|
|
23
23
|
return (_jsxs("a", { ref: ref, href: href, "aria-busy": loading || undefined, "aria-disabled": disabled || loading || undefined, className: classes, ...props, children: [loading ? _jsx(LoaderCircle, { className: 'size-4 animate-spin', "aria-hidden": 'true' }) : null, children] }));
|
|
24
24
|
}
|
|
@@ -18,6 +18,7 @@ export interface CommandSpotlightProps {
|
|
|
18
18
|
dialogClassName?: string;
|
|
19
19
|
emptyMessage?: string;
|
|
20
20
|
hotkey?: string;
|
|
21
|
+
inputLabel?: string;
|
|
21
22
|
onActionSelect?: (action: CommandSpotlightAction) => void;
|
|
22
23
|
onOpenChange?: (isOpen: boolean) => void;
|
|
23
24
|
open?: boolean;
|
|
@@ -27,4 +28,4 @@ export interface CommandSpotlightProps {
|
|
|
27
28
|
triggerClassName?: string;
|
|
28
29
|
triggerLabel?: string;
|
|
29
30
|
}
|
|
30
|
-
export declare function CommandSpotlight({ actions, className, dialogClassName, emptyMessage, hotkey, onActionSelect, onOpenChange, open, overlayClassName, placeholder, showTrigger, triggerClassName, triggerLabel }: CommandSpotlightProps): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export declare function CommandSpotlight({ actions, className, dialogClassName, emptyMessage, hotkey, inputLabel, onActionSelect, onOpenChange, open, overlayClassName, placeholder, showTrigger, triggerClassName, triggerLabel }: CommandSpotlightProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -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();
|
|
@@ -21,7 +21,8 @@ function isEditableTarget(target) {
|
|
|
21
21
|
const tagName = target.tagName;
|
|
22
22
|
return tagName === 'INPUT' || tagName === 'TEXTAREA' || tagName === 'SELECT';
|
|
23
23
|
}
|
|
24
|
-
export function CommandSpotlight({ actions, className, dialogClassName, emptyMessage = 'No matching commands.', hotkey = 'k', onActionSelect, onOpenChange, open, overlayClassName, placeholder = 'Search commands...', showTrigger = true, triggerClassName, triggerLabel = 'Search' }) {
|
|
24
|
+
export function CommandSpotlight({ actions, className, dialogClassName, emptyMessage = 'No matching commands.', hotkey = 'k', inputLabel = 'Search commands', onActionSelect, onOpenChange, open, overlayClassName, placeholder = 'Search commands...', showTrigger = true, triggerClassName, triggerLabel = 'Search' }) {
|
|
25
|
+
const inputId = React.useId();
|
|
25
26
|
const [isOpenInternal, setIsOpenInternal] = React.useState(false);
|
|
26
27
|
const [query, setQuery] = React.useState('');
|
|
27
28
|
const [selectedActionId, setSelectedActionId] = React.useState(null);
|
|
@@ -70,14 +71,13 @@ export function CommandSpotlight({ actions, className, dialogClassName, emptyMes
|
|
|
70
71
|
setSelectedActionId(null);
|
|
71
72
|
return;
|
|
72
73
|
}
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
// The selection effect keeps selectedActionId inside the selectable ids
|
|
75
|
+
// whenever any exist, so the current index is always found.
|
|
76
|
+
const currentIndex = selectableActionIds.indexOf(selectedActionId);
|
|
77
|
+
const nextIndex = (currentIndex + direction + selectableActionIds.length) % selectableActionIds.length;
|
|
75
78
|
setSelectedActionId(selectableActionIds[nextIndex]);
|
|
76
79
|
}, [selectableActionIds, selectedActionId]);
|
|
77
80
|
const runAction = React.useCallback((action) => {
|
|
78
|
-
if (action.disabled) {
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
81
|
onActionSelect?.(action);
|
|
82
82
|
if (action.onSelect) {
|
|
83
83
|
try {
|
|
@@ -92,7 +92,7 @@ export function CommandSpotlight({ actions, className, dialogClassName, emptyMes
|
|
|
92
92
|
console.error('Command spotlight action failed:', error);
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
-
else if (action.href
|
|
95
|
+
else if (action.href) {
|
|
96
96
|
if (action.external) {
|
|
97
97
|
window.open(action.href, '_blank', 'noopener,noreferrer');
|
|
98
98
|
}
|
|
@@ -103,22 +103,8 @@ export function CommandSpotlight({ actions, className, dialogClassName, emptyMes
|
|
|
103
103
|
closeSpotlight();
|
|
104
104
|
}, [closeSpotlight, onActionSelect]);
|
|
105
105
|
React.useEffect(() => {
|
|
106
|
-
if (typeof navigator === 'undefined') {
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
106
|
setIsMacLike(/mac|iphone|ipad|ipod/i.test(navigator.platform));
|
|
110
107
|
}, []);
|
|
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
108
|
React.useEffect(() => {
|
|
123
109
|
if (!isOpen) {
|
|
124
110
|
return;
|
|
@@ -137,9 +123,6 @@ export function CommandSpotlight({ actions, className, dialogClassName, emptyMes
|
|
|
137
123
|
actionRefs.current[selectedActionId]?.scrollIntoView({ block: 'nearest' });
|
|
138
124
|
}, [isOpen, selectedActionId]);
|
|
139
125
|
React.useEffect(() => {
|
|
140
|
-
if (typeof window === 'undefined') {
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
126
|
const normalizedHotkey = hotkey.toLowerCase();
|
|
144
127
|
const handleWindowKeyDown = (event) => {
|
|
145
128
|
const pressedKey = event.key.toLowerCase();
|
|
@@ -155,17 +138,13 @@ export function CommandSpotlight({ actions, className, dialogClassName, emptyMes
|
|
|
155
138
|
}
|
|
156
139
|
return;
|
|
157
140
|
}
|
|
158
|
-
if (!isOpen || pressedKey !== 'escape') {
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
event.preventDefault();
|
|
162
|
-
closeSpotlight();
|
|
163
141
|
};
|
|
164
142
|
window.addEventListener('keydown', handleWindowKeyDown);
|
|
165
143
|
return () => {
|
|
166
144
|
window.removeEventListener('keydown', handleWindowKeyDown);
|
|
167
145
|
};
|
|
168
146
|
}, [closeSpotlight, hotkey, isOpen, setIsOpen]);
|
|
147
|
+
const panelRef = useModalLayer(isOpen, closeSpotlight);
|
|
169
148
|
const hotkeyHint = React.useMemo(() => {
|
|
170
149
|
const modifier = isMacLike ? '⌘' : 'Ctrl';
|
|
171
150
|
return [modifier, hotkey.toUpperCase()];
|
|
@@ -174,41 +153,35 @@ export function CommandSpotlight({ actions, className, dialogClassName, emptyMes
|
|
|
174
153
|
setIsOpen(true);
|
|
175
154
|
}, 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
155
|
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
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
if (event.key === 'Enter') {
|
|
191
|
-
event.preventDefault();
|
|
192
|
-
if (!selectedActionId) {
|
|
156
|
+
? 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
|
|
157
|
+
? 'translate-y-0 scale-100 opacity-100 duration-[var(--motion-overlay)] ease-premium'
|
|
158
|
+
: '-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, id: inputId, "aria-label": inputLabel, type: 'text', value: query, onChange: (event) => setQuery(event.target.value), onKeyDown: (event) => {
|
|
159
|
+
if (event.key === 'ArrowDown') {
|
|
160
|
+
event.preventDefault();
|
|
161
|
+
moveSelection(1);
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
if (event.key === 'ArrowUp') {
|
|
165
|
+
event.preventDefault();
|
|
166
|
+
moveSelection(-1);
|
|
193
167
|
return;
|
|
194
168
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
169
|
+
if (event.key === 'Enter') {
|
|
170
|
+
event.preventDefault();
|
|
171
|
+
if (!selectedActionId) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
// The selection is always one of the filtered, enabled actions.
|
|
175
|
+
runAction(filteredActions.find((action) => action.id === selectedActionId));
|
|
198
176
|
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
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)
|
|
177
|
+
}, 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) => {
|
|
178
|
+
const isSelected = action.id === selectedActionId;
|
|
179
|
+
return (_jsxs("button", { type: 'button', ref: (element) => {
|
|
180
|
+
actionRefs.current[action.id] = element;
|
|
181
|
+
}, disabled: action.disabled, onClick: () => runAction(action), onMouseEnter: () => setSelectedActionId(action.id), 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
|
|
182
|
+
? 'bg-sea/10 text-sea dark:bg-accent-blue/15 dark:text-accent-blue'
|
|
183
|
+
: '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));
|
|
184
|
+
}) })] }, group)))) })] })] }) }), document.body)
|
|
212
185
|
: null;
|
|
213
186
|
return (_jsxs("div", { className: className, children: [renderTrigger, renderOverlay] }));
|
|
214
187
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import * as ContextMenuPrimitive from '@radix-ui/react-context-menu';
|
|
3
3
|
declare const ContextMenu: React.FC<ContextMenuPrimitive.ContextMenuProps>;
|
|
4
4
|
declare const ContextMenuTrigger: React.ForwardRefExoticComponent<ContextMenuPrimitive.ContextMenuTriggerProps & React.RefAttributes<HTMLSpanElement>>;
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import 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) =>
|
|
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;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
3
|
+
import React from 'react';
|
|
4
4
|
import { flexRender, getCoreRowModel, getFilteredRowModel, getPaginationRowModel, getSortedRowModel, useReactTable } from '@tanstack/react-table';
|
|
5
5
|
import { Search, ChevronLeft, ChevronRight } from 'lucide-react';
|
|
6
6
|
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from './table.js';
|