@gaulatti/bleecker 0.1.42 → 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.
Files changed (62) hide show
  1. package/README.md +98 -1
  2. package/dist/components/alert.js +0 -7
  3. package/dist/components/breadcrumb.js +1 -1
  4. package/dist/components/button.js +2 -2
  5. package/dist/components/chart-theme.d.ts +1 -1
  6. package/dist/components/command-spotlight.d.ts +2 -1
  7. package/dist/components/command-spotlight.js +11 -23
  8. package/dist/components/context-menu.d.ts +1 -1
  9. package/dist/components/context-menu.js +1 -1
  10. package/dist/components/dashboard-grid.d.ts +1 -1
  11. package/dist/components/dashboard-section.d.ts +1 -1
  12. package/dist/components/data-list.d.ts +1 -1
  13. package/dist/components/data-table-filters.d.ts +1 -1
  14. package/dist/components/data-table-toolbar.d.ts +1 -1
  15. package/dist/components/data-table.js +1 -1
  16. package/dist/components/dropdown-menu.d.ts +1 -1
  17. package/dist/components/dropdown-menu.js +1 -1
  18. package/dist/components/error-state.d.ts +1 -1
  19. package/dist/components/eyebrow.d.ts +1 -1
  20. package/dist/components/feed-item.js +4 -11
  21. package/dist/components/icon-badge.d.ts +1 -1
  22. package/dist/components/icon-button.js +1 -1
  23. package/dist/components/input.js +1 -1
  24. package/dist/components/label.d.ts +1 -1
  25. package/dist/components/label.js +1 -1
  26. package/dist/components/loading-overlay.d.ts +1 -1
  27. package/dist/components/media-library.js +2 -4
  28. package/dist/components/metric.d.ts +1 -1
  29. package/dist/components/metric.js +1 -1
  30. package/dist/components/page-header.d.ts +1 -1
  31. package/dist/components/progress.js +2 -1
  32. package/dist/components/sankey-chart.js +1 -1
  33. package/dist/components/search-input.d.ts +1 -1
  34. package/dist/components/search-input.js +1 -1
  35. package/dist/components/select.js +1 -1
  36. package/dist/components/sidebar.d.ts +1 -1
  37. package/dist/components/sidebar.js +1 -1
  38. package/dist/components/skeleton.d.ts +1 -1
  39. package/dist/components/stat-card.d.ts +1 -1
  40. package/dist/components/sunburst-chart.js +1 -1
  41. package/dist/components/table.js +3 -16
  42. package/dist/components/textarea.js +1 -1
  43. package/dist/components/timeline.d.ts +1 -1
  44. package/dist/layout/admin-shell.d.ts +1 -1
  45. package/dist/layout/auth-shell.d.ts +8 -1
  46. package/dist/layout/auth-shell.js +8 -1
  47. package/dist/layout/panel-layout.js +0 -4
  48. package/dist/styles.css +1 -1
  49. package/dist/theme/theme-provider.d.ts +2 -2
  50. package/dist/theme/theme-provider.js +16 -20
  51. package/dist/theme/types.d.ts +11 -0
  52. package/dist/utils/attention-color.js +4 -4
  53. package/dist/utils/avatar-initial.d.ts +1 -0
  54. package/dist/utils/avatar-initial.js +3 -0
  55. package/dist/utils/clamp-percent.d.ts +1 -0
  56. package/dist/utils/clamp-percent.js +3 -0
  57. package/dist/utils/format.js +17 -14
  58. package/dist/utils/hooks.d.ts +1 -1
  59. package/dist/utils/hooks.js +4 -8
  60. package/dist/utils/source-label.d.ts +1 -0
  61. package/dist/utils/source-label.js +9 -0
  62. package/package.json +8 -3
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,67 @@ 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.
106
152
 
107
153
  Modal surfaces activate keyboard focus when their panels mount, contain Tab
108
154
  navigation, and restore focus and scrolling after dismissal, including nested
@@ -119,6 +165,7 @@ import { radii, spacing, themes } from '@gaulatti/bleecker/tokens';
119
165
  ```
120
166
 
121
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.
122
169
 
123
170
  ## Generated contract conformance
124
171
 
@@ -127,6 +174,7 @@ but generated output never overwrites its hand-authored components. The
127
174
  [Kolibri Toggle parity decision](docs/kolibri-toggle-parity.md) documents the
128
175
  first bounded proof, its immutable fixture, browser accessibility and visual
129
176
  evidence, unsupported `ToggleGroup` boundary, and proceed-with-adapter result.
177
+ Hand-authored components remain the source of truth.
130
178
 
131
179
  ## Development
132
180
 
@@ -139,7 +187,56 @@ npm run build
139
187
 
140
188
  The build cleans generated output before compilation so removed modules cannot remain in published packages.
141
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
+
142
238
  ## License
143
239
 
144
240
  Bleecker, including its published npm versions, is available under the
145
241
  [MIT License](LICENSE).
242
+ See the `LICENSE` file for the full text.
@@ -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(-(collapsedAfter > 0 ? 1 : items.length))] : items;
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-light-sand',
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/35 focus-visible:ring-offset-2 focus-visible:ring-offset-white disabled:pointer-events-none disabled:transform-none disabled:opacity-45 dark:focus-visible:ring-accent-blue/45 dark:focus-visible:ring-offset-deep-sea', variantClasses[variant], variant !== 'link' && sizeClasses[size], fullWidth && 'w-full', className);
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
  }
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import React from 'react';
2
2
  /**
3
3
  * Shared theming helpers for Recharts-based dashboard charts.
4
4
  *
@@ -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;
@@ -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
- const currentIndex = selectedActionId ? selectableActionIds.indexOf(selectedActionId) : -1;
74
- const nextIndex = currentIndex < 0 ? 0 : (currentIndex + direction + selectableActionIds.length) % selectableActionIds.length;
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 && typeof window !== 'undefined') {
95
+ else if (action.href) {
96
96
  if (action.external) {
97
97
  window.open(action.href, '_blank', 'noopener,noreferrer');
98
98
  }
@@ -103,9 +103,6 @@ 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
108
  React.useEffect(() => {
@@ -126,9 +123,6 @@ export function CommandSpotlight({ actions, className, dialogClassName, emptyMes
126
123
  actionRefs.current[selectedActionId]?.scrollIntoView({ block: 'nearest' });
127
124
  }, [isOpen, selectedActionId]);
128
125
  React.useEffect(() => {
129
- if (typeof window === 'undefined') {
130
- return;
131
- }
132
126
  const normalizedHotkey = hotkey.toLowerCase();
133
127
  const handleWindowKeyDown = (event) => {
134
128
  const pressedKey = event.key.toLowerCase();
@@ -161,7 +155,7 @@ export function CommandSpotlight({ actions, className, dialogClassName, emptyMes
161
155
  const renderOverlay = isOverlayPresent && typeof document !== 'undefined'
162
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
163
157
  ? '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) => {
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) => {
165
159
  if (event.key === 'ArrowDown') {
166
160
  event.preventDefault();
167
161
  moveSelection(1);
@@ -177,20 +171,14 @@ export function CommandSpotlight({ actions, className, dialogClassName, emptyMes
177
171
  if (!selectedActionId) {
178
172
  return;
179
173
  }
180
- const selectedAction = filteredActions.find((action) => action.id === selectedActionId);
181
- if (selectedAction) {
182
- runAction(selectedAction);
183
- }
174
+ // The selection is always one of the filtered, enabled actions.
175
+ runAction(filteredActions.find((action) => action.id === selectedActionId));
184
176
  }
185
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) => {
186
178
  const isSelected = action.id === selectedActionId;
187
179
  return (_jsxs("button", { type: 'button', ref: (element) => {
188
180
  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
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
194
182
  ? 'bg-sea/10 text-sea dark:bg-accent-blue/15 dark:text-accent-blue'
195
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));
196
184
  }) })] }, group)))) })] })] }) }), document.body)
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
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,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import * as React from 'react';
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
5
  import { useModalBranch } from '../utils/hooks.js';
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import React from 'react';
2
2
  export interface DashboardGridProps {
3
3
  children: React.ReactNode;
4
4
  className?: string;
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import React from 'react';
2
2
  export interface DashboardSectionProps {
3
3
  title?: string;
4
4
  description?: string;
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import React from 'react';
2
2
  export interface DataListItem {
3
3
  id: string;
4
4
  label: React.ReactNode;
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import React from 'react';
2
2
  import { Table, Column } from '@tanstack/react-table';
3
3
  import { SelectOption } from './select';
4
4
  export interface DataTableSelectFilterProps<TData> {
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import React from 'react';
2
2
  import { Table } from '@tanstack/react-table';
3
3
  export interface DataTableToolbarProps<TData> {
4
4
  table: Table<TData>;
@@ -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 * as React from 'react';
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';
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import React from 'react';
2
2
  import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
3
3
  declare const DropdownMenu: React.FC<DropdownMenuPrimitive.DropdownMenuProps>;
4
4
  declare const DropdownMenuTrigger: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuTriggerProps & React.RefAttributes<HTMLButtonElement>>;
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import * as React from 'react';
2
+ import 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';
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import React from 'react';
2
2
  export interface ErrorStateProps {
3
3
  title?: string;
4
4
  description?: string;
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import React from 'react';
2
2
  export type EyebrowTone = 'accent' | 'muted' | 'inverse';
3
3
  export interface EyebrowProps extends React.HTMLAttributes<HTMLElement> {
4
4
  as?: 'div' | 'p' | 'span';
@@ -2,7 +2,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { ExternalLink } from 'lucide-react';
3
3
  import { Avatar } from './avatar.js';
4
4
  import { Tooltip } from './tooltip.js';
5
+ import { avatarInitial } from '../utils/avatar-initial.js';
5
6
  import { cn } from '../utils/cn.js';
7
+ import { describeSource } from '../utils/source-label.js';
6
8
  function formatPostedAt(postedAt) {
7
9
  const dateValue = postedAt instanceof Date ? postedAt : new Date(postedAt);
8
10
  if (Number.isNaN(dateValue.getTime())) {
@@ -33,23 +35,14 @@ function formatIsoTimestamp(postedAt) {
33
35
  function normalizeCategory(category) {
34
36
  return category.trim().toLowerCase();
35
37
  }
36
- function normalizeSourceLabel(sourceUrl) {
37
- try {
38
- const parsed = new URL(sourceUrl);
39
- return parsed.hostname;
40
- }
41
- catch {
42
- return 'Source article';
43
- }
44
- }
45
38
  function formatRelevance(relevance) {
46
39
  return String(Math.round(relevance));
47
40
  }
48
41
  export function FeedItem({ author, avatarSrc, categories = [], className, content, init, language, postedAt, relevance, sourceUrl }) {
49
- const fallback = init || (author.trim().slice(0, 1) || '?').toUpperCase();
42
+ const fallback = avatarInitial(author, init);
50
43
  const postedAtLabel = formatPostedAt(postedAt);
51
44
  const postedAtIsoLabel = formatIsoTimestamp(postedAt);
52
- const sourceLabel = normalizeSourceLabel(sourceUrl);
45
+ const sourceLabel = describeSource(sourceUrl);
53
46
  const safeCategories = categories
54
47
  .map(normalizeCategory)
55
48
  .filter((value) => value.length > 0);
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { IconBadgeSize, IconBadgeVariant } from '../core';
2
+ import { type IconBadgeSize, type IconBadgeVariant } from '../core';
3
3
  export type { IconBadgeSize, IconBadgeVariant } from '../core';
4
4
  export interface IconBadgeProps extends React.HTMLAttributes<HTMLDivElement> {
5
5
  size?: IconBadgeSize;
@@ -3,5 +3,5 @@ import React from 'react';
3
3
  import { cn } from '../utils/cn.js';
4
4
  const sizes = { sm: 'h-8 w-8', md: 'h-10 w-10', lg: 'h-11 w-11' };
5
5
  export const IconButton = React.forwardRef(function IconButton({ className, size = 'md', type = 'button', variant = 'default', ...props }, ref) {
6
- return (_jsx("button", { ref: ref, type: type, className: cn('inline-flex shrink-0 translate-y-0 scale-100 items-center justify-center rounded-[var(--radius-button)] border text-text-primary transition-[background-color,border-color,color,box-shadow,transform,opacity] duration-[var(--motion-control)] ease-premium active:translate-y-px active:scale-[0.97] active:shadow-none focus:outline-none focus-visible:ring-2 focus-visible:ring-sea/30 focus-visible:ring-offset-2 focus-visible:ring-offset-white disabled:pointer-events-none disabled:transform-none disabled:opacity-45 dark:text-text-primary dark:focus-visible:ring-accent-blue/40 dark:focus-visible:ring-offset-deep-sea', sizes[size], variant === 'default' && 'border-sand/35 bg-white shadow-[0_1px_2px_rgba(26,55,77,0.025)] hover:border-sand/65 hover:bg-light-sand/45 hover:shadow-[0_3px_9px_-6px_rgba(26,55,77,0.28)] dark:border-white/15 dark:bg-deep-sea dark:hover:bg-white/[0.06]', variant === 'subtle' && 'border-transparent bg-light-sand/75 hover:bg-sand/25 dark:bg-white/[0.07] dark:hover:bg-white/[0.11]', variant === 'ghost' && 'border-transparent bg-transparent hover:bg-sand/12 dark:hover:bg-white/[0.06]', className), ...props }));
6
+ return (_jsx("button", { ref: ref, type: type, className: cn('inline-flex shrink-0 translate-y-0 scale-100 items-center justify-center rounded-[var(--radius-button)] border text-text-primary transition-[background-color,border-color,color,box-shadow,transform,opacity] duration-[var(--motion-control)] ease-premium active:translate-y-px active:scale-[0.97] active:shadow-none focus:outline-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:text-text-primary dark:focus-visible:ring-accent-blue dark:focus-visible:ring-offset-deep-sea', sizes[size], variant === 'default' && 'border-sand/35 bg-white shadow-[0_1px_2px_rgba(26,55,77,0.025)] hover:border-sand/65 hover:bg-light-sand/45 hover:shadow-[0_3px_9px_-6px_rgba(26,55,77,0.28)] dark:border-white/15 dark:bg-deep-sea dark:hover:bg-white/[0.06]', variant === 'subtle' && 'border-transparent bg-light-sand/75 hover:bg-sand/25 dark:bg-white/[0.07] dark:hover:bg-white/[0.11]', variant === 'ghost' && 'border-transparent bg-transparent hover:bg-sand/12 dark:hover:bg-white/[0.06]', className), ...props }));
7
7
  });
@@ -7,5 +7,5 @@ const sizeClasses = {
7
7
  lg: 'h-11 px-4 text-[15px]'
8
8
  };
9
9
  export const Input = React.forwardRef(function Input({ 'aria-invalid': ariaInvalid, className, endIcon, error = false, inputSize = 'md', startIcon, type = 'text', ...props }, ref) {
10
- return (_jsxs("div", { className: 'relative w-full', children: [startIcon ? (_jsx("div", { className: 'pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3 text-text-secondary dark:text-text-secondary', children: startIcon })) : null, _jsx("input", { ref: ref, type: type, "aria-invalid": ariaInvalid ?? (error || undefined), className: cn('w-full rounded-[var(--radius-ui)] border border-sand/40 bg-white 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 placeholder:text-text-secondary/55 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 disabled:cursor-not-allowed disabled:bg-light-sand/65 disabled:opacity-60 dark:border-white/15 dark:bg-deep-sea dark:text-text-primary dark:placeholder:text-text-secondary dark:hover:border-white/25 dark:focus:border-accent-blue dark:focus:ring-accent-blue/12 [&::-webkit-search-cancel-button]:appearance-none', error ? 'border-terracotta focus:border-terracotta focus:ring-terracotta/15 dark:border-terracotta' : '', startIcon ? 'pl-10' : sizeClasses[inputSize], startIcon && inputSize === 'sm' && 'h-9 pr-3 text-[13px]', startIcon && inputSize === 'md' && 'h-10 pr-3.5 text-sm', startIcon && inputSize === 'lg' && 'h-11 pr-4 text-[15px]', endIcon ? 'pr-10' : undefined, className), ...props }), endIcon ? (_jsx("div", { className: 'pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3 text-text-secondary dark:text-text-secondary', children: endIcon })) : null] }));
10
+ return (_jsxs("div", { className: 'relative w-full', children: [startIcon ? (_jsx("div", { className: 'pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3 text-text-secondary dark:text-text-secondary', children: startIcon })) : null, _jsx("input", { ref: ref, type: type, "aria-invalid": ariaInvalid ?? (error || undefined), className: cn('w-full rounded-[var(--radius-ui)] border border-sand/40 bg-white 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 placeholder:text-text-secondary 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 disabled:cursor-not-allowed disabled:bg-light-sand/65 disabled:opacity-60 dark:border-white/15 dark:bg-deep-sea dark:text-text-primary dark:placeholder:text-text-secondary dark:hover:border-white/25 dark:focus:border-accent-blue dark:focus:ring-accent-blue/12 [&::-webkit-search-cancel-button]:appearance-none', error ? 'border-terracotta focus:border-terracotta focus:ring-terracotta/15 dark:border-terracotta' : '', startIcon ? 'pl-10' : sizeClasses[inputSize], startIcon && inputSize === 'sm' && 'h-9 pr-3 text-[13px]', startIcon && inputSize === 'md' && 'h-10 pr-3.5 text-sm', startIcon && inputSize === 'lg' && 'h-11 pr-4 text-[15px]', endIcon ? 'pr-10' : undefined, className), ...props }), endIcon ? (_jsx("div", { className: 'pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3 text-text-secondary dark:text-text-secondary', children: endIcon })) : null] }));
11
11
  });
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import React from 'react';
2
2
  import * as LabelPrimitive from '@radix-ui/react-label';
3
3
  declare const Label: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & React.RefAttributes<HTMLLabelElement>>;
4
4
  export { Label };
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import * as React from 'react';
2
+ import React from 'react';
3
3
  import * as LabelPrimitive from '@radix-ui/react-label';
4
4
  import { cn } from '../utils/cn.js';
5
5
  const Label = React.forwardRef(({ className, ...props }, ref) => (_jsx(LabelPrimitive.Root, { ref: ref, className: cn('text-[13px] font-medium leading-none tracking-ui text-text-primary peer-disabled:cursor-not-allowed peer-disabled:opacity-60 dark:text-text-primary', className), ...props })));
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import React from 'react';
2
2
  export interface LoadingOverlayProps {
3
3
  visible: boolean;
4
4
  label?: string;
@@ -13,12 +13,10 @@ export function MediaLibrary({ actions, className, emptyMessage = 'No media foun
13
13
  onCopy(text);
14
14
  return;
15
15
  }
16
- if (typeof navigator !== 'undefined') {
17
- void navigator.clipboard.writeText(text);
18
- }
16
+ void navigator.clipboard.writeText(text);
19
17
  };
20
18
  return (_jsxs("div", { className: cn('px-5 py-6 md:px-8 md:py-9', className), children: [_jsxs("div", { className: 'mb-8 flex flex-col gap-5 md:flex-row md:items-end md:justify-between', children: [_jsxs("div", { children: [_jsx("p", { className: 'mb-2 text-[10px] font-semibold uppercase tracking-[0.11em] text-desert', children: "Media collection" }), _jsx("h1", { className: 'text-[2rem] font-semibold leading-tight tracking-refined text-text-primary dark:text-text-primary', children: title })] }), actions] }), _jsxs("div", { className: 'mb-7 flex flex-col gap-3 md:flex-row', children: [_jsx("div", { className: 'flex-1', children: _jsx(SearchInput, { placeholder: searchPlaceholder, value: searchTerm, onChange: (event) => onSearchTermChange(event.target.value), onClear: () => onSearchTermChange('') }) }), filterSlot ? _jsx("div", { className: 'md:w-64', children: filterSlot }) : null] }), _jsx("div", { className: 'grid grid-cols-2 gap-4 md:grid-cols-4 lg:grid-cols-5', children: items.map((media) => (_jsxs("div", { className: 'group relative aspect-square overflow-hidden rounded-[var(--radius-ui)] border border-sand/30 bg-white shadow-[var(--shadow-surface)] transition-[border-color,box-shadow] duration-[var(--motion-surface)] ease-premium hover:border-sand/55 hover:shadow-[var(--shadow-raised)] focus-within:ring-2 focus-within:ring-sea/25 dark:border-white/10 dark:bg-deep-sea dark:hover:border-white/20', children: [_jsx("button", { type: 'button', className: 'absolute inset-0 z-10 cursor-pointer outline-none', onClick: () => setSelectedMedia(media), "aria-label": `Open ${media.filename}` }), media.thumbnailUrl || media.url ? (_jsx("img", { src: media.thumbnailUrl || media.url, alt: media.alt || media.filename, className: 'h-full w-full object-cover' })) : (_jsx("div", { className: 'font-secondary flex h-full w-full items-center justify-center bg-light-sand/60 text-xs text-text-secondary dark:bg-white/[0.04]', children: "No preview" })), _jsxs("div", { className: 'pointer-events-none absolute inset-x-0 bottom-0 flex translate-y-1 flex-col justify-end bg-deep-sea/82 p-3 opacity-0 backdrop-blur-[2px] transition-[opacity,transform] duration-[var(--motion-surface)] ease-premium group-hover:translate-y-0 group-hover:opacity-100 group-focus-within:translate-y-0 group-focus-within:opacity-100', children: [_jsx("p", { className: 'mb-2 truncate text-[12px] font-medium text-white', children: media.filename }), onDelete ? (_jsx(IconButton, { onClick: (event) => {
21
19
  event.stopPropagation();
22
20
  onDelete(media.id);
23
- }, variant: 'subtle', className: 'pointer-events-auto relative z-20 self-end text-terracotta hover:text-terracotta', title: 'Delete', "aria-label": 'Delete media item', children: _jsx(Trash2, { size: 16 }) })) : null] })] }, media.id))) }), items.length === 0 ? _jsx("div", { className: 'font-secondary rounded-[var(--radius-card)] border border-sand/25 bg-light-sand/25 px-8 py-14 text-center text-sm text-text-secondary dark:border-white/10 dark:bg-white/[0.025]', children: emptyMessage }) : null, _jsx(Modal, { isOpen: !!selectedMedia, onClose: () => setSelectedMedia(null), title: selectedMedia?.filename || 'Media Preview', className: 'max-w-4xl', children: selectedMedia ? (_jsxs("div", { className: 'space-y-6', children: [_jsx("div", { className: 'flex items-center justify-center overflow-hidden rounded-[var(--radius-ui)] border border-sand/20 bg-light-sand/35 dark:border-white/[0.07] dark:bg-black/20', children: selectedMedia.url ? (_jsx("img", { src: selectedMedia.url, alt: selectedMedia.alt || selectedMedia.filename, className: 'max-h-[60vh] w-auto object-contain' })) : null }), _jsxs("div", { className: 'space-y-5', children: [_jsxs("div", { className: 'flex items-center gap-2', children: [_jsx("h3", { className: 'flex-1 text-xl font-semibold tracking-refined text-text-primary dark:text-text-primary', children: selectedMedia.filename }), _jsx(IconButton, { onClick: () => handleCopy(selectedMedia.filename), variant: 'ghost', title: 'Copy filename', "aria-label": 'Copy filename', children: _jsx(Copy, { size: 18 }) })] }), selectedMedia.alt ? (_jsxs("div", { children: [_jsx("p", { className: 'text-[10px] font-semibold uppercase tracking-[0.09em] text-text-secondary', children: "Alt text" }), _jsx("p", { className: 'font-secondary mt-1 text-sm leading-6 text-text-primary dark:text-text-primary', children: selectedMedia.alt })] })) : null, _jsxs("div", { className: 'grid grid-cols-1 gap-6 border-t border-sand/20 pt-5 md:grid-cols-2 dark:border-white/[0.07]', children: [selectedMedia.url ? (_jsxs("div", { children: [_jsx("p", { className: 'mb-1.5 text-[10px] font-semibold uppercase tracking-[0.09em] text-text-secondary', children: "URL" }), _jsxs("div", { className: 'flex items-center gap-2', children: [_jsx("a", { href: selectedMedia.url, target: '_blank', rel: 'noreferrer noopener', className: 'flex-1 break-all text-sm text-sea transition-colors duration-[var(--motion-control)] ease-premium hover:text-deep-sea hover:underline dark:text-accent-blue dark:hover:text-text-primary', children: selectedMedia.url }), _jsx(IconButton, { onClick: () => handleCopy(selectedMedia.url || ''), variant: 'ghost', size: 'sm', title: 'Copy URL', "aria-label": 'Copy URL', children: _jsx(Copy, { size: 14 }) })] })] })) : null, selectedMedia.createdAt ? (_jsxs("div", { children: [_jsx("p", { className: 'mb-1.5 text-[10px] font-semibold uppercase tracking-[0.09em] text-text-secondary', children: "Created" }), _jsx("p", { className: 'font-secondary text-sm text-text-primary dark:text-text-primary', children: new Date(selectedMedia.createdAt).toLocaleDateString() })] })) : null] })] })] })) : null })] }));
21
+ }, variant: 'subtle', className: 'pointer-events-auto relative z-20 self-end text-terracotta hover:text-terracotta', title: 'Delete', "aria-label": 'Delete media item', children: _jsx(Trash2, { size: 16 }) })) : null] })] }, media.id))) }), items.length === 0 ? _jsx("div", { className: 'font-secondary rounded-[var(--radius-card)] border border-sand/25 bg-light-sand/25 px-8 py-14 text-center text-sm text-text-secondary dark:border-white/10 dark:bg-white/[0.025]', children: emptyMessage }) : null, _jsx(Modal, { isOpen: !!selectedMedia, onClose: () => setSelectedMedia(null), title: selectedMedia?.filename || 'Media Preview', className: 'max-w-4xl', children: selectedMedia ? (_jsxs("div", { className: 'space-y-6', children: [_jsx("div", { className: 'flex items-center justify-center overflow-hidden rounded-[var(--radius-ui)] border border-sand/20 bg-light-sand/35 dark:border-white/[0.07] dark:bg-black/20', children: selectedMedia.url ? (_jsx("img", { src: selectedMedia.url, alt: selectedMedia.alt || selectedMedia.filename, className: 'max-h-[60vh] w-auto object-contain' })) : null }), _jsxs("div", { className: 'space-y-5', children: [_jsxs("div", { className: 'flex items-center gap-2', children: [_jsx("h3", { className: 'flex-1 text-xl font-semibold tracking-refined text-text-primary dark:text-text-primary', children: selectedMedia.filename }), _jsx(IconButton, { onClick: () => handleCopy(selectedMedia.filename), variant: 'ghost', title: 'Copy filename', "aria-label": 'Copy filename', children: _jsx(Copy, { size: 18 }) })] }), selectedMedia.alt ? (_jsxs("div", { children: [_jsx("p", { className: 'text-[10px] font-semibold uppercase tracking-[0.09em] text-text-secondary', children: "Alt text" }), _jsx("p", { className: 'font-secondary mt-1 text-sm leading-6 text-text-primary dark:text-text-primary', children: selectedMedia.alt })] })) : null, _jsxs("div", { className: 'grid grid-cols-1 gap-6 border-t border-sand/20 pt-5 md:grid-cols-2 dark:border-white/[0.07]', children: [selectedMedia.url ? (_jsxs("div", { children: [_jsx("p", { className: 'mb-1.5 text-[10px] font-semibold uppercase tracking-[0.09em] text-text-secondary', children: "URL" }), _jsxs("div", { className: 'flex items-center gap-2', children: [_jsx("a", { href: selectedMedia.url, target: '_blank', rel: 'noreferrer noopener', className: 'flex-1 break-all text-sm text-sea transition-colors duration-[var(--motion-control)] ease-premium hover:text-deep-sea hover:underline dark:text-accent-blue dark:hover:text-text-primary', children: selectedMedia.url }), _jsx(IconButton, { onClick: () => handleCopy(selectedMedia.url), variant: 'ghost', size: 'sm', title: 'Copy URL', "aria-label": 'Copy URL', children: _jsx(Copy, { size: 14 }) })] })] })) : null, selectedMedia.createdAt ? (_jsxs("div", { children: [_jsx("p", { className: 'mb-1.5 text-[10px] font-semibold uppercase tracking-[0.09em] text-text-secondary', children: "Created" }), _jsx("p", { className: 'font-secondary text-sm text-text-primary dark:text-text-primary', children: new Date(selectedMedia.createdAt).toLocaleDateString() })] })) : null] })] })] })) : null })] }));
24
22
  }
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import React from 'react';
2
2
  import type { MetricFormat } from '../core';
3
3
  export type { MetricFormat } from '../core';
4
4
  export interface MetricProps {
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import { jsxs as _jsxs } from "react/jsx-runtime";
3
- import * as React from 'react';
3
+ import React from 'react';
4
4
  import { cn } from '../utils/cn.js';
5
5
  import { formatNumber, formatCurrency, formatPercent, formatCompactNumber } from '../utils/format.js';
6
6
  export function Metric({ value, format = 'number', currency = 'USD', className, prefix, suffix, decimals }) {
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import React from 'react';
2
2
  export interface PageHeaderProps {
3
3
  title: string;
4
4
  description?: string;
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { clampPercent } from '../utils/clamp-percent.js';
2
3
  import { cn } from '../utils/cn.js';
3
4
  const sizeClasses = {
4
5
  sm: 'h-1.5',
@@ -12,6 +13,6 @@ const variantFill = {
12
13
  destructive: 'bg-terracotta'
13
14
  };
14
15
  export function Progress({ className, max = 100, showLabel = false, size = 'md', value = 0, variant = 'default', ...props }) {
15
- const pct = Math.min(100, Math.max(0, (value / max) * 100));
16
+ const pct = clampPercent(value, max);
16
17
  return (_jsxs("div", { className: cn('flex items-center gap-3', className), ...props, children: [_jsx("div", { role: 'progressbar', "aria-valuenow": value, "aria-valuemin": 0, "aria-valuemax": max, className: cn('flex-1 overflow-hidden rounded-full bg-sand/15 dark:bg-sand/20', sizeClasses[size]), children: _jsx("div", { className: cn('h-full rounded-full transition-[width] duration-[var(--motion-overlay)] ease-premium', variantFill[variant]), style: { width: `${pct}%` } }) }), showLabel && (_jsxs("span", { className: 'min-w-[2.5rem] text-right text-xs font-medium tabular-nums text-text-secondary dark:text-text-primary', children: [Math.round(pct), "%"] }))] }));
17
18
  }