@vamos-ui/react 0.3.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/blocks/block-heading.js +1 -1
- package/dist/blocks/block-image.js +1 -1
- package/dist/blocks/block-link.js +2 -2
- package/dist/blocks/index.d.ts +5 -5
- package/dist/blocks/index.js +5 -5
- package/dist/blocks/labels.d.ts +8 -0
- package/dist/blocks/labels.js +60 -0
- package/dist/blocks/section-header.js +1 -1
- package/dist/blocks/section.js +2 -2
- package/dist/blocks/site/_kit-1.js +1 -1
- package/dist/blocks/site/announcement-bar.js +1 -1
- package/dist/blocks/site/article-layout.d.ts +1 -0
- package/dist/blocks/site/article-layout.js +2 -1
- package/dist/blocks/site/blog-list.d.ts +1 -0
- package/dist/blocks/site/blog-list.js +3 -2
- package/dist/blocks/site/contact-dock.js +3 -1
- package/dist/blocks/site/contact-form.js +1 -1
- package/dist/blocks/site/cta.d.ts +2 -2
- package/dist/blocks/site/cta.js +6 -4
- package/dist/blocks/site/feature-grid.d.ts +1 -0
- package/dist/blocks/site/feature-grid.js +5 -4
- package/dist/blocks/site/feature-tabs.js +1 -1
- package/dist/blocks/site/footer.d.ts +11 -2
- package/dist/blocks/site/footer.js +36 -11
- package/dist/blocks/site/gallery-section.d.ts +6 -1
- package/dist/blocks/site/gallery-section.js +5 -4
- package/dist/blocks/site/hero.d.ts +3 -2
- package/dist/blocks/site/hero.js +7 -5
- package/dist/blocks/site/logo-strip.d.ts +1 -0
- package/dist/blocks/site/logo-strip.js +1 -1
- package/dist/blocks/site/map-hours.d.ts +2 -2
- package/dist/blocks/site/map-hours.js +4 -2
- package/dist/blocks/site/media-text.d.ts +4 -1
- package/dist/blocks/site/media-text.js +4 -3
- package/dist/blocks/site/menu-list.d.ts +7 -3
- package/dist/blocks/site/menu-list.js +34 -7
- package/dist/blocks/site/navbar.d.ts +1 -0
- package/dist/blocks/site/navbar.js +6 -5
- package/dist/blocks/site/not-found.js +2 -1
- package/dist/blocks/site/page-intro.d.ts +1 -0
- package/dist/blocks/site/page-intro.js +2 -1
- package/dist/blocks/site/process.d.ts +1 -0
- package/dist/blocks/site/process.js +2 -1
- package/dist/blocks/site/registry-1.d.ts +1 -1
- package/dist/blocks/site/registry-2.d.ts +5 -0
- package/dist/blocks/site/registry-2.js +5 -3
- package/dist/blocks/site/rich-text-section.js +2 -1
- package/dist/blocks/site/shared/heading-lines.d.ts +9 -0
- package/dist/blocks/site/shared/heading-lines.js +32 -0
- package/dist/blocks/site/shared/image-sizes.d.ts +25 -0
- package/dist/blocks/site/shared/image-sizes.js +37 -0
- package/dist/blocks/site/shared/island-keys.d.ts +1 -1
- package/dist/blocks/site/shared/island-keys.js +1 -1
- package/dist/blocks/site/shared/labels-2.d.ts +17 -1
- package/dist/blocks/site/shared/labels-2.js +832 -6
- package/dist/blocks/site/shared/open-now.d.ts +1 -1
- package/dist/blocks/site/shared/open-now.js +1 -1
- package/dist/blocks/site/shared/opening-hours.d.ts +18 -2
- package/dist/blocks/site/shared/opening-hours.js +36 -7
- package/dist/blocks/site/shared/tap.d.ts +9 -0
- package/dist/blocks/site/shared/tap.js +16 -0
- package/dist/blocks/site/site-shell.js +3 -3
- package/dist/blocks/site/team.d.ts +1 -1
- package/dist/blocks/site/team.js +4 -3
- package/dist/blocks/site/testimonials.d.ts +2 -2
- package/dist/blocks/site/testimonials.js +3 -3
- package/dist/business/approval-flow.js +2 -2
- package/dist/business/import-wizard.js +1 -1
- package/dist/business/line-items.js +1 -1
- package/dist/business/multi-step-form.js +2 -2
- package/dist/business/permission-matrix.js +1 -1
- package/dist/business/setup-checklist.js +2 -2
- package/dist/business/signer-status.js +1 -1
- package/dist/charts/bar-chart.js +1 -1
- package/dist/charts/bar-list.js +1 -1
- package/dist/charts/chart-shell.d.ts +9 -2
- package/dist/charts/chart-shell.js +11 -5
- package/dist/charts/chart.js +1 -1
- package/dist/charts/combo-chart.js +5 -7
- package/dist/charts/donut-chart.js +1 -1
- package/dist/charts/funnel.js +1 -1
- package/dist/charts/gauge.js +2 -2
- package/dist/charts/utils.d.ts +10 -0
- package/dist/charts/utils.js +46 -0
- package/dist/components/accordion.d.ts +1 -1
- package/dist/components/accordion.js +8 -8
- package/dist/components/activity-timeline.js +11 -11
- package/dist/components/address-field.js +3 -3
- package/dist/components/alert-dialog.d.ts +1 -1
- package/dist/components/alert-dialog.js +8 -8
- package/dist/components/alert.js +2 -2
- package/dist/components/app-shell.js +3 -3
- package/dist/components/aspect-ratio.d.ts +26 -0
- package/dist/components/aspect-ratio.js +42 -0
- package/dist/components/attachment-list.js +2 -2
- package/dist/components/audit-log.js +1 -1
- package/dist/components/avatar.d.ts +1 -1
- package/dist/components/avatar.js +8 -8
- package/dist/components/backup-codes.js +1 -1
- package/dist/components/badge.js +3 -3
- package/dist/components/breadcrumb.js +10 -9
- package/dist/components/button-group.js +4 -4
- package/dist/components/button.js +4 -4
- package/dist/components/calendar.js +5 -5
- package/dist/components/card.js +8 -8
- package/dist/components/carousel.d.ts +12 -3
- package/dist/components/carousel.js +17 -14
- package/dist/components/checkbox.d.ts +1 -1
- package/dist/components/checkbox.js +6 -6
- package/dist/components/collapsible.d.ts +36 -0
- package/dist/components/collapsible.js +37 -0
- package/dist/components/color-picker.js +3 -3
- package/dist/components/combobox.js +1 -1
- package/dist/components/command.js +9 -9
- package/dist/components/comment-thread.js +3 -3
- package/dist/components/context-menu.d.ts +1 -1
- package/dist/components/context-menu.js +9 -9
- package/dist/components/currency-input.js +1 -1
- package/dist/components/date-picker.js +2 -2
- package/dist/components/date-range-picker.js +1 -1
- package/dist/components/description-list.js +2 -2
- package/dist/components/dialog.d.ts +1 -1
- package/dist/components/dialog.js +9 -9
- package/dist/components/dropdown-menu.d.ts +1 -1
- package/dist/components/dropdown-menu.js +9 -9
- package/dist/components/editor-layout.js +9 -9
- package/dist/components/empty-state.js +2 -2
- package/dist/components/entity-card.js +1 -1
- package/dist/components/file-upload.js +5 -5
- package/dist/components/formatted-input.js +3 -3
- package/dist/components/hierarchy-chart.js +1 -1
- package/dist/components/hover-card.d.ts +1 -1
- package/dist/components/hover-card.js +3 -3
- package/dist/components/iban-input.js +1 -1
- package/dist/components/id-input.js +3 -3
- package/dist/components/image.d.ts +18 -2
- package/dist/components/image.js +16 -9
- package/dist/components/input-otp.js +6 -6
- package/dist/components/input.d.ts +1 -1
- package/dist/components/input.js +6 -6
- package/dist/components/item.js +4 -4
- package/dist/components/kbd.js +3 -3
- package/dist/components/list-layout.js +9 -9
- package/dist/components/menubar.d.ts +96 -0
- package/dist/components/menubar.js +123 -0
- package/dist/components/native-select.js +1 -1
- package/dist/components/navigation-menu.d.ts +1 -1
- package/dist/components/navigation-menu.js +12 -11
- package/dist/components/notification-center.js +4 -4
- package/dist/components/page-header.js +3 -3
- package/dist/components/pagination.js +9 -9
- package/dist/components/phone-input.js +1 -1
- package/dist/components/pin-map.js +1 -1
- package/dist/components/placeholder-art.d.ts +51 -0
- package/dist/components/placeholder-art.js +82 -0
- package/dist/components/popover.d.ts +1 -1
- package/dist/components/popover.js +7 -7
- package/dist/components/progress.js +3 -3
- package/dist/components/qr-code.js +1 -1
- package/dist/components/radio-group.d.ts +1 -1
- package/dist/components/radio-group.js +4 -4
- package/dist/components/record-detail-layout.js +10 -10
- package/dist/components/record-picker.js +2 -2
- package/dist/components/resizable.js +2 -2
- package/dist/components/scroll-area.d.ts +1 -1
- package/dist/components/scroll-area.js +4 -4
- package/dist/components/select.d.ts +1 -1
- package/dist/components/select.js +10 -10
- package/dist/components/separator.d.ts +1 -1
- package/dist/components/separator.js +3 -3
- package/dist/components/settings-layout.js +6 -6
- package/dist/components/sheet.js +3 -3
- package/dist/components/sidebar.js +12 -11
- package/dist/components/signature-pad.js +1 -1
- package/dist/components/skeleton.js +5 -5
- package/dist/components/sla-timer.js +2 -2
- package/dist/components/slider.d.ts +1 -1
- package/dist/components/slider.js +2 -2
- package/dist/components/slug-input.js +1 -1
- package/dist/components/sparkline.js +1 -1
- package/dist/components/spinner.js +2 -2
- package/dist/components/stat.js +5 -5
- package/dist/components/status-picker.js +2 -2
- package/dist/components/stepper.js +1 -1
- package/dist/components/switch.d.ts +1 -1
- package/dist/components/switch.js +3 -3
- package/dist/components/table.js +10 -10
- package/dist/components/tabs.d.ts +1 -1
- package/dist/components/tabs.js +11 -11
- package/dist/components/tag-input.js +1 -1
- package/dist/components/task-list.js +1 -1
- package/dist/components/time-picker.js +3 -3
- package/dist/components/toggle.d.ts +2 -1
- package/dist/components/toggle.js +7 -6
- package/dist/components/tooltip.d.ts +1 -1
- package/dist/components/tooltip.js +5 -4
- package/dist/components/top-bar.js +4 -4
- package/dist/components/tour.js +1 -1
- package/dist/components/tree-select.js +2 -2
- package/dist/components/tree-view.js +3 -3
- package/dist/components/typography.js +11 -11
- package/dist/components/user-picker.js +2 -2
- package/dist/components/version-history.js +3 -3
- package/dist/data-table/data-table.js +1 -1
- package/dist/data-table/filter-bar.js +2 -2
- package/dist/data-table/index.d.ts +15 -8
- package/dist/data-table/index.js +9 -8
- package/dist/data-table/saved-views.js +1 -1
- package/dist/editor/block-editor.js +1 -1
- package/dist/editor/context.js +1 -1
- package/dist/editor/menus.js +1 -1
- package/dist/fonts/font-picker.js +3 -3
- package/dist/fonts/pairing-picker.js +1 -1
- package/dist/fonts/provider.js +1 -1
- package/dist/index.d.ts +188 -90
- package/dist/index.js +94 -90
- package/dist/lib/data-islands.js +1 -1
- package/dist/lib/field-context.js +1 -1
- package/dist/lib/floating-arrow.js +1 -1
- package/dist/lib/islands.js +1 -1
- package/dist/lib/layer.js +3 -3
- package/dist/lib/locale.js +2 -2
- package/dist/lib/menu.js +2 -2
- package/dist/lib/provider.js +4 -4
- package/dist/lib/theme-scope.js +4 -3
- package/dist/lib/value-format.js +1 -1
- package/dist/lib/variants.js +2 -2
- package/dist/locales/ar.d.ts +2087 -0
- package/dist/locales/ar.js +2088 -0
- package/dist/locales/de.d.ts +2087 -0
- package/dist/locales/de.js +2088 -0
- package/dist/locales/en.d.ts +1 -0
- package/dist/locales/en.js +1 -0
- package/dist/locales/es.d.ts +2087 -0
- package/dist/locales/es.js +2087 -0
- package/dist/locales/fr.d.ts +2087 -0
- package/dist/locales/fr.js +2088 -0
- package/dist/locales/tr.d.ts +1 -0
- package/dist/locales/tr.js +1 -0
- package/dist/media/focal-point.js +1 -1
- package/dist/media/gallery.js +1 -1
- package/dist/media/image-cropper.js +1 -1
- package/dist/media/image-field.js +2 -2
- package/dist/media/lightbox.js +4 -3
- package/dist/media/link-preview.js +3 -3
- package/dist/media/media-library.js +4 -4
- package/dist/media/media-picker.js +1 -1
- package/dist/media/media-provider.js +1 -1
- package/dist/media/video-player.js +4 -4
- package/dist/motion/count-up.js +1 -1
- package/dist/motion/motion-scope.js +2 -2
- package/dist/motion/page-transition.js +1 -1
- package/dist/motion/parallax.js +2 -2
- package/dist/motion/pointer.js +3 -3
- package/dist/motion/reveal.js +3 -3
- package/dist/motion/skeleton-swap.js +1 -1
- package/dist/motion/text-reveal.d.ts +3 -1
- package/dist/motion/text-reveal.js +6 -4
- package/dist/motion/ticker.js +1 -1
- package/dist/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
- package/dist/render/block-renderer.js +1 -1
- package/dist/scheduler/gantt.js +2 -2
- package/dist/scheduler/resource-calendar.js +2 -2
- package/dist/scheduler/scheduler.js +3 -3
- package/dist/scheduler/time-tracker.js +4 -4
- package/dist/sortable/kanban.js +2 -2
- package/dist/sortable/sortable-list.js +2 -2
- package/dist/sortable/sortable.js +4 -4
- package/dist/styles/blocks.css +18 -9
- package/dist/styles/editors.css +2 -1
- package/dist/styles/media.css +31 -5
- package/dist/styles.css +39 -9
- package/package.json +1 -1
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import * as MenubarPrimitive from "radix-ui/menubar";
|
|
5
|
+
import { cva } from "class-variance-authority";
|
|
6
|
+
import { cn } from "../lib/cn.js";
|
|
7
|
+
import { usePortalContainer } from "../lib/theme-scope.js";
|
|
8
|
+
import { Layer } from "../lib/layer.js";
|
|
9
|
+
import { useCan } from "../lib/provider.js";
|
|
10
|
+
import { MenuCheckIcon, MenuEntries, MenuItemContent, MenuRadioDot, MenuSizeContext, menuContentVariants, menuIndicatorClass, menuItemClass, menuLabelClass, menuSeparatorClass, useVisibleEntries, } from "../lib/menu.js";
|
|
11
|
+
/* ------------------------------------------------------------------ */
|
|
12
|
+
/* Bar */
|
|
13
|
+
/* ------------------------------------------------------------------ */
|
|
14
|
+
export const menubarVariants = /*#__PURE__*/ cva("flex min-w-0 items-center gap-0.5 overflow-x-auto [scrollbar-width:none]", {
|
|
15
|
+
variants: {
|
|
16
|
+
variant: {
|
|
17
|
+
/** A hairline surface strip — the top of an editor or a desktop-style app window. */
|
|
18
|
+
bar: "surface rounded-ui-lg p-1",
|
|
19
|
+
/** No chrome: sits inside a Top bar, toolbar or window header. */
|
|
20
|
+
ghost: "",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
defaultVariants: { variant: "bar" },
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* A desktop-app menu bar (WAI-ARIA `menubar`): File / Edit / View… One tab stop; ← → move between
|
|
27
|
+
* menus (and keep the open one open), ↓ / Enter / Space open, Esc closes, typeahead inside a menu.
|
|
28
|
+
*
|
|
29
|
+
* ```tsx
|
|
30
|
+
* <Menubar aria-label="Editor" menus={[
|
|
31
|
+
* { id: "file", label: "File", items: [{ id: "new", label: "New document", shortcut: "mod+n", onSelect: create }] },
|
|
32
|
+
* ]} />
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export const Menubar = /*#__PURE__*/ React.forwardRef(function Menubar({ className, variant, menus, size = "md", children, loop = true, ...props }, ref) {
|
|
36
|
+
return (_jsx(MenuSizeContext.Provider, { value: size, children: _jsxs(MenubarPrimitive.Root, { ref: ref, "data-slot": "menubar", "data-variant": variant ?? "bar", loop: loop, className: cn(menubarVariants({ variant }), className), ...props, children: [menus ? _jsx(MenubarMenus, { menus: menus }) : null, children] }) }));
|
|
37
|
+
});
|
|
38
|
+
/** One menu: a `MenubarTrigger` plus its `MenubarContent`. `value` is needed only for a controlled bar. */
|
|
39
|
+
export const MenubarMenu = MenubarPrimitive.Menu;
|
|
40
|
+
export const MenubarGroup = MenubarPrimitive.Group;
|
|
41
|
+
export const MenubarSub = MenubarPrimitive.Sub;
|
|
42
|
+
export const MenubarRadioGroup = MenubarPrimitive.RadioGroup;
|
|
43
|
+
/** The top-level button ("File"). */
|
|
44
|
+
export const MenubarTrigger = /*#__PURE__*/ React.forwardRef(function MenubarTrigger({ className, ...props }, ref) {
|
|
45
|
+
return (_jsx(MenubarPrimitive.Trigger, { ref: ref, "data-slot": "menubar-trigger", className: cn("inline-flex h-[calc(var(--control-h)-0.5rem)] shrink-0 cursor-default select-none items-center gap-1.5 rounded-ui-sm px-2.5 text-[13px] font-medium text-fg outline-none", "transition-colors duration-100 hover:bg-hover focus-visible:bg-hover focus-ring", "data-highlighted:bg-hover data-[state=open]:bg-selected", "disabled:pointer-events-none disabled:opacity-45 data-disabled:pointer-events-none data-disabled:opacity-45", "[&_svg]:size-3.5 [&_svg]:shrink-0 [&_svg]:text-fg-muted", className), ...props }));
|
|
46
|
+
});
|
|
47
|
+
/** A menu panel under its trigger. Portals into the nearest `ThemeScope`; only this first layer blurs in glass mode. */
|
|
48
|
+
export const MenubarContent = /*#__PURE__*/ React.forwardRef(function MenubarContent({ className, size: sizeProp, sideOffset = 6, alignOffset = -4, collisionPadding = 12, align = "start", ...props }, ref) {
|
|
49
|
+
const container = usePortalContainer();
|
|
50
|
+
const barSize = React.useContext(MenuSizeContext);
|
|
51
|
+
const size = sizeProp ?? barSize;
|
|
52
|
+
return (_jsx(MenubarPrimitive.Portal, { container: container, children: _jsx(MenuSizeContext.Provider, { value: size, children: _jsx(Layer, { asChild: true, children: _jsx(MenubarPrimitive.Content, { ref: ref, "data-slot": "menubar-content", sideOffset: sideOffset, alignOffset: alignOffset, collisionPadding: collisionPadding, align: align, className: cn(menuContentVariants({ size }), "max-h-(--radix-menubar-content-available-height) origin-(--radix-menubar-content-transform-origin)", className), ...props }) }) }) }));
|
|
53
|
+
});
|
|
54
|
+
/** One command. `onSelect` fires on click, Enter and Space, then the menu closes (`event.preventDefault()` keeps it open). */
|
|
55
|
+
export const MenubarItem = /*#__PURE__*/ React.forwardRef(function MenubarItem({ className, icon, description, shortcut, badge, tone = "default", inset, asChild, children, ...props }, ref) {
|
|
56
|
+
const size = React.useContext(MenuSizeContext);
|
|
57
|
+
return (_jsx(MenubarPrimitive.Item, { ref: ref, "data-slot": "menubar-item", "data-tone": tone, asChild: asChild, className: menuItemClass({ size, tone, inset, className }), ...props, children: asChild ? (children) : (_jsx(MenuItemContent, { icon: icon, description: description, shortcut: shortcut, badge: badge, children: children })) }));
|
|
58
|
+
});
|
|
59
|
+
/** A toggle (`menuitemcheckbox`) — "Show ruler", "Word wrap". */
|
|
60
|
+
export const MenubarCheckboxItem = /*#__PURE__*/ React.forwardRef(function MenubarCheckboxItem({ className, shortcut, description, children, ...props }, ref) {
|
|
61
|
+
const size = React.useContext(MenuSizeContext);
|
|
62
|
+
return (_jsxs(MenubarPrimitive.CheckboxItem, { ref: ref, "data-slot": "menubar-checkbox-item", className: menuItemClass({ size, inset: true, className }), ...props, children: [_jsx("span", { className: menuIndicatorClass, children: _jsx(MenubarPrimitive.ItemIndicator, { children: _jsx(MenuCheckIcon, {}) }) }), _jsx(MenuItemContent, { shortcut: shortcut, description: description, children: children })] }));
|
|
63
|
+
});
|
|
64
|
+
/** One choice inside a `MenubarRadioGroup` (`menuitemradio`) — zoom level, sort order. */
|
|
65
|
+
export const MenubarRadioItem = /*#__PURE__*/ React.forwardRef(function MenubarRadioItem({ className, shortcut, description, children, ...props }, ref) {
|
|
66
|
+
const size = React.useContext(MenuSizeContext);
|
|
67
|
+
return (_jsxs(MenubarPrimitive.RadioItem, { ref: ref, "data-slot": "menubar-radio-item", className: menuItemClass({ size, inset: true, className }), ...props, children: [_jsx("span", { className: menuIndicatorClass, children: _jsx(MenubarPrimitive.ItemIndicator, { children: _jsx(MenuRadioDot, {}) }) }), _jsx(MenuItemContent, { shortcut: shortcut, description: description, children: children })] }));
|
|
68
|
+
});
|
|
69
|
+
export const MenubarLabel = /*#__PURE__*/ React.forwardRef(function MenubarLabel({ className, inset, ...props }, ref) {
|
|
70
|
+
return _jsx(MenubarPrimitive.Label, { ref: ref, "data-slot": "menubar-label", className: cn(menuLabelClass, inset && "ps-8", className), ...props });
|
|
71
|
+
});
|
|
72
|
+
export const MenubarSeparator = /*#__PURE__*/ React.forwardRef(function MenubarSeparator({ className, ...props }, ref) {
|
|
73
|
+
return _jsx(MenubarPrimitive.Separator, { ref: ref, "data-slot": "menubar-separator", className: cn(menuSeparatorClass, className), ...props });
|
|
74
|
+
});
|
|
75
|
+
/** Trailing text hint (when you don't want keycaps). */
|
|
76
|
+
export function MenubarShortcut({ className, ...props }) {
|
|
77
|
+
return _jsx("span", { "data-slot": "menubar-shortcut", className: cn("ms-auto ps-4 font-mono text-[11px] tracking-wide text-fg-subtle", className), ...props });
|
|
78
|
+
}
|
|
79
|
+
/** Opens a submenu on hover, Enter, Space or → (← in RTL). */
|
|
80
|
+
export const MenubarSubTrigger = /*#__PURE__*/ React.forwardRef(function MenubarSubTrigger({ className, icon, inset, children, ...props }, ref) {
|
|
81
|
+
const size = React.useContext(MenuSizeContext);
|
|
82
|
+
return (_jsx(MenubarPrimitive.SubTrigger, { ref: ref, "data-slot": "menubar-sub-trigger", className: menuItemClass({ size, inset, className: cn("data-[state=open]:bg-hover", className) }), ...props, children: _jsx(MenuItemContent, { icon: icon, chevron: true, children: children }) }));
|
|
83
|
+
});
|
|
84
|
+
/** A submenu panel. One layer deeper, so it is opaque in glass mode. */
|
|
85
|
+
export const MenubarSubContent = /*#__PURE__*/ React.forwardRef(function MenubarSubContent({ className, size: sizeProp, sideOffset = 4, alignOffset = -5, collisionPadding = 12, ...props }, ref) {
|
|
86
|
+
const container = usePortalContainer();
|
|
87
|
+
const parentSize = React.useContext(MenuSizeContext);
|
|
88
|
+
const size = sizeProp ?? parentSize;
|
|
89
|
+
return (_jsx(MenubarPrimitive.Portal, { container: container, children: _jsx(Layer, { asChild: true, children: _jsx(MenubarPrimitive.SubContent, { ref: ref, "data-slot": "menubar-sub-content", sideOffset: sideOffset, alignOffset: alignOffset, collisionPadding: collisionPadding, className: cn(menuContentVariants({ size }), "max-h-(--radix-menubar-content-available-height)", className), ...props }) }) }));
|
|
90
|
+
});
|
|
91
|
+
/* ------------------------------------------------------------------ */
|
|
92
|
+
/* Data-driven */
|
|
93
|
+
/* ------------------------------------------------------------------ */
|
|
94
|
+
const menubarParts = {
|
|
95
|
+
Item: MenubarItem,
|
|
96
|
+
CheckboxItem: MenubarCheckboxItem,
|
|
97
|
+
RadioGroup: MenubarRadioGroup,
|
|
98
|
+
RadioItem: MenubarRadioItem,
|
|
99
|
+
Label: MenubarLabel,
|
|
100
|
+
Separator: MenubarSeparator,
|
|
101
|
+
Group: MenubarGroup,
|
|
102
|
+
Sub: MenubarSub,
|
|
103
|
+
SubTrigger: MenubarSubTrigger,
|
|
104
|
+
SubContent: MenubarSubContent,
|
|
105
|
+
};
|
|
106
|
+
/** Renders `MenuEntry[]` as menubar items (inside your own `MenubarContent`). */
|
|
107
|
+
export function MenubarEntries({ items }) {
|
|
108
|
+
const visible = useVisibleEntries(items);
|
|
109
|
+
return _jsx(MenuEntries, { entries: visible, parts: menubarParts });
|
|
110
|
+
}
|
|
111
|
+
function MenubarDataMenu({ menu }) {
|
|
112
|
+
const visible = useVisibleEntries(menu.items);
|
|
113
|
+
if (visible.length === 0)
|
|
114
|
+
return null;
|
|
115
|
+
return (_jsxs(MenubarMenu, { value: menu.id, children: [_jsx(MenubarTrigger, { disabled: menu.disabled, children: menu.label }), _jsx(MenubarContent, { children: _jsx(MenuEntries, { entries: visible, parts: menubarParts }) })] }));
|
|
116
|
+
}
|
|
117
|
+
/** Renders `MenubarMenuEntry[]` (what `Menubar menus` uses). Menus with no visible entries are dropped. */
|
|
118
|
+
export function MenubarMenus({ menus }) {
|
|
119
|
+
const can = useCan();
|
|
120
|
+
return (_jsx(_Fragment, { children: menus
|
|
121
|
+
.filter((m) => !m.permission || can(m.permission))
|
|
122
|
+
.map((m) => (_jsx(MenubarDataMenu, { menu: m }, m.id))) }));
|
|
123
|
+
}
|
|
@@ -16,7 +16,7 @@ import { controlVariants } from "../lib/variants.js";
|
|
|
16
16
|
* </Field>
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
|
-
export const NativeSelect = React.forwardRef(function NativeSelect({ className, selectClassName, size = "md", variant = "default", invalid, placeholder, items, children, ...rest }, ref) {
|
|
19
|
+
export const NativeSelect = /*#__PURE__*/ React.forwardRef(function NativeSelect({ className, selectClassName, size = "md", variant = "default", invalid, placeholder, items, children, ...rest }, ref) {
|
|
20
20
|
const props = useFieldControl({ ...rest, "aria-invalid": invalid ? true : rest["aria-invalid"] });
|
|
21
21
|
const { readOnly, ...selectProps } = props;
|
|
22
22
|
let options = children;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
import
|
|
4
|
+
import * as Dialog from "radix-ui/dialog";
|
|
5
|
+
import * as RadixNav from "radix-ui/navigation-menu";
|
|
5
6
|
import { ChevronDown, Menu, X } from "lucide-react";
|
|
6
7
|
import { cva } from "class-variance-authority";
|
|
7
8
|
import { cn } from "../lib/cn.js";
|
|
@@ -19,7 +20,7 @@ const navLabels = {
|
|
|
19
20
|
/* ------------------------------------------------------------------ */
|
|
20
21
|
/* Root */
|
|
21
22
|
/* ------------------------------------------------------------------ */
|
|
22
|
-
const rootVariants = cva("relative z-(--z-nav) flex max-w-max flex-1 items-center justify-center", {
|
|
23
|
+
const rootVariants = /*#__PURE__*/ cva("relative z-(--z-nav) flex max-w-max flex-1 items-center justify-center", {
|
|
23
24
|
variants: {
|
|
24
25
|
variant: {
|
|
25
26
|
/** Sits in a site header. */
|
|
@@ -49,7 +50,7 @@ const rootVariants = cva("relative z-(--z-nav) flex max-w-max flex-1 items-cente
|
|
|
49
50
|
* </NavigationMenu>
|
|
50
51
|
* ```
|
|
51
52
|
*/
|
|
52
|
-
export const NavigationMenu = React.forwardRef(function NavigationMenu({ variant = "bar", viewport = true, items, labels, className, children, "aria-label": ariaLabel, ...props }, ref) {
|
|
53
|
+
export const NavigationMenu = /*#__PURE__*/ React.forwardRef(function NavigationMenu({ variant = "bar", viewport = true, items, labels, className, children, "aria-label": ariaLabel, ...props }, ref) {
|
|
53
54
|
const t = useLabels("navigationMenu", navLabels, labels);
|
|
54
55
|
return (_jsxs(RadixNav.Root, { ref: ref, "data-slot": "navigation-menu", "data-variant": variant, "data-viewport": viewport || undefined, "aria-label": ariaLabel ?? t("label"), className: cn(rootVariants({ variant }), className), ...props, children: [items ? _jsx(NavigationMenuItems, { items: items, viewport: viewport }) : children, viewport ? _jsx(NavigationMenuViewport, {}) : null] }));
|
|
55
56
|
});
|
|
@@ -57,16 +58,16 @@ function NavigationMenuItems({ items, viewport }) {
|
|
|
57
58
|
return (_jsx(NavigationMenuList, { children: items.map((item, i) => (_jsx(NavigationMenuItem, { children: item.children?.length ? (_jsxs(_Fragment, { children: [_jsx(NavigationMenuTrigger, { children: item.label }), _jsxs(NavigationMenuContent, { layout: item.layout, inline: !viewport, children: [item.layout === "featured" && item.featured ? _jsx(NavigationMenuFeatured, { ...item.featured }) : null, _jsx(NavigationMenuGroup, { children: item.children.map((child, j) => (_jsx("li", { children: _jsx(NavigationMenuLink, { href: child.href ?? "#", title: child.label, description: child.description, icon: child.icon }) }, child.id ?? j))) })] })] })) : (_jsx(NavigationMenuLink, { href: item.href ?? "#", variant: "top", children: item.label })) }, item.id ?? i))) }));
|
|
58
59
|
}
|
|
59
60
|
/** The row of top-level items. */
|
|
60
|
-
export const NavigationMenuList = React.forwardRef(function NavigationMenuList({ className, ...props }, ref) {
|
|
61
|
+
export const NavigationMenuList = /*#__PURE__*/ React.forwardRef(function NavigationMenuList({ className, ...props }, ref) {
|
|
61
62
|
return _jsx(RadixNav.List, { ref: ref, "data-slot": "navigation-menu-list", className: cn("flex flex-1 list-none items-center justify-center gap-0.5", className), ...props });
|
|
62
63
|
});
|
|
63
64
|
/** One top-level item (a trigger + content, or a plain link). */
|
|
64
|
-
export const NavigationMenuItem = React.forwardRef(function NavigationMenuItem({ className, ...props }, ref) {
|
|
65
|
+
export const NavigationMenuItem = /*#__PURE__*/ React.forwardRef(function NavigationMenuItem({ className, ...props }, ref) {
|
|
65
66
|
return _jsx(RadixNav.Item, { ref: ref, "data-slot": "navigation-menu-item", className: cn("relative", className), ...props });
|
|
66
67
|
});
|
|
67
68
|
const topItemClass = cn("group/nav inline-flex h-9 select-none items-center justify-center gap-1 rounded-full px-3.5 text-sm font-medium text-fg-muted outline-none", "transition-colors duration-150 hover:bg-hover hover:text-fg focus-ring", "data-[state=open]:bg-hover data-[state=open]:text-fg data-active:text-fg aria-[current=page]:text-fg");
|
|
68
69
|
/** Opens a panel. Hover (with intent delay), click, Enter/Space or ↓. */
|
|
69
|
-
export const NavigationMenuTrigger = React.forwardRef(function NavigationMenuTrigger({ className, children, ...props }, ref) {
|
|
70
|
+
export const NavigationMenuTrigger = /*#__PURE__*/ React.forwardRef(function NavigationMenuTrigger({ className, children, ...props }, ref) {
|
|
70
71
|
return (_jsxs(RadixNav.Trigger, { ref: ref, "data-slot": "navigation-menu-trigger", className: cn(topItemClass, className), ...props, children: [children, _jsx(ChevronDown, { "aria-hidden": true, className: "relative top-px size-3.5 text-fg-subtle transition-transform duration-200 motion-reduce:transition-none group-data-[state=open]/nav:rotate-180" })] }));
|
|
71
72
|
});
|
|
72
73
|
const contentLayouts = {
|
|
@@ -75,19 +76,19 @@ const contentLayouts = {
|
|
|
75
76
|
featured: "grid w-[min(42rem,calc(100vw-2rem))] grid-cols-[minmax(0,15rem)_minmax(0,1fr)] gap-2",
|
|
76
77
|
};
|
|
77
78
|
/** The panel of an item. */
|
|
78
|
-
export const NavigationMenuContent = React.forwardRef(function NavigationMenuContent({ layout = "list", inline, className, ...props }, ref) {
|
|
79
|
+
export const NavigationMenuContent = /*#__PURE__*/ React.forwardRef(function NavigationMenuContent({ layout = "list", inline, className, ...props }, ref) {
|
|
79
80
|
return (_jsx(RadixNav.Content, { ref: ref, "data-slot": "navigation-menu-content", "data-layout": layout, className: cn("ui-nav-content p-2", inline ? "surface-popover ui-pop absolute start-0 top-full z-(--z-popover) mt-2 rounded-ui-lg" : "start-0 top-0 md:absolute", contentLayouts[layout], className), ...props }));
|
|
80
81
|
});
|
|
81
82
|
/** The shared, animated container all panels render into. Rendered by `NavigationMenu` unless `viewport={false}`. */
|
|
82
|
-
export const NavigationMenuViewport = React.forwardRef(function NavigationMenuViewport({ className, ...props }, ref) {
|
|
83
|
+
export const NavigationMenuViewport = /*#__PURE__*/ React.forwardRef(function NavigationMenuViewport({ className, ...props }, ref) {
|
|
83
84
|
return (_jsx("div", { className: "absolute start-0 top-full z-(--z-popover) flex w-full justify-center pt-2", children: _jsx(Layer, { asChild: true, children: _jsx(RadixNav.Viewport, { ref: ref, "data-slot": "navigation-menu-viewport", className: cn("ui-pop ui-nav-viewport surface-popover relative shrink-0 origin-top overflow-hidden rounded-ui-lg", "h-(--radix-navigation-menu-viewport-height) w-full md:w-(--radix-navigation-menu-viewport-width)", className), ...props }) }) }));
|
|
84
85
|
});
|
|
85
86
|
/** A list of links inside a panel (`ul`). */
|
|
86
|
-
export const NavigationMenuGroup = React.forwardRef(function NavigationMenuGroup({ heading, className, children, ...props }, ref) {
|
|
87
|
+
export const NavigationMenuGroup = /*#__PURE__*/ React.forwardRef(function NavigationMenuGroup({ heading, className, children, ...props }, ref) {
|
|
87
88
|
return (_jsxs("div", { className: "min-w-0", children: [heading ? _jsx("p", { className: "px-3 pt-2 pb-1 text-[11px] font-medium tracking-[0.06em] text-fg-subtle", children: heading }) : null, _jsx("ul", { ref: ref, "data-slot": "navigation-menu-group", className: cn("grid list-none gap-0.5", className), ...props, children: children })] }));
|
|
88
89
|
});
|
|
89
90
|
/** A link — in the bar (`variant="top"`) or in a panel with icon and description. Uses the app's router `Link`. */
|
|
90
|
-
export const NavigationMenuLink = React.forwardRef(function NavigationMenuLink({ href, variant = "panel", title, description, icon, active, className, children, ...props }, ref) {
|
|
91
|
+
export const NavigationMenuLink = /*#__PURE__*/ React.forwardRef(function NavigationMenuLink({ href, variant = "panel", title, description, icon, active, className, children, ...props }, ref) {
|
|
91
92
|
const { isActive } = useNavigation();
|
|
92
93
|
const current = active ?? isActive(href);
|
|
93
94
|
if (variant === "top") {
|
|
@@ -100,7 +101,7 @@ export function NavigationMenuFeatured({ title, description, href, eyebrow, clas
|
|
|
100
101
|
return (_jsx(RadixNav.Link, { asChild: true, children: _jsxs(SmartLink, { href: href, "data-slot": "navigation-menu-featured", className: cn("group/feat relative flex min-h-full flex-col justify-end overflow-hidden rounded-ui bg-fg p-5 text-scene outline-none focus-ring", className), children: [_jsx("span", { "aria-hidden": true, className: "absolute -end-10 -top-10 size-40 rounded-full border-[18px] border-accent opacity-90 transition-transform duration-300 group-hover/feat:scale-105 motion-reduce:transition-none" }), eyebrow ? _jsx("span", { className: "relative mb-auto text-[11px] font-medium tracking-[0.08em] opacity-70", children: eyebrow }) : null, _jsx("span", { className: "relative mt-10 font-display text-[1.375rem] leading-tight", children: title }), description ? _jsx("span", { className: "relative mt-1.5 text-[13px] leading-snug opacity-75", children: description }) : null] }) }));
|
|
101
102
|
}
|
|
102
103
|
/** Optional arrow under the open trigger. */
|
|
103
|
-
export const NavigationMenuIndicator = React.forwardRef(function NavigationMenuIndicator({ className, ...props }, ref) {
|
|
104
|
+
export const NavigationMenuIndicator = /*#__PURE__*/ React.forwardRef(function NavigationMenuIndicator({ className, ...props }, ref) {
|
|
104
105
|
return (_jsx(RadixNav.Indicator, { ref: ref, "data-slot": "navigation-menu-indicator", className: cn("top-full z-[1] flex h-2 items-end justify-center overflow-hidden ui-fade", className), ...props, children: _jsx("span", { className: "relative top-[60%] size-2.5 rotate-45 rounded-tl-sm border-s border-t border-popover-border bg-popover" }) }));
|
|
105
106
|
});
|
|
106
107
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
import
|
|
4
|
+
import * as PopoverPrimitive from "radix-ui/popover";
|
|
5
5
|
import { Bell, Check, CheckCheck, Settings } from "lucide-react";
|
|
6
6
|
import { cn } from "../lib/cn.js";
|
|
7
7
|
import { useLabels } from "../lib/labels.js";
|
|
@@ -92,7 +92,7 @@ export function createMemoryNotificationAdapter(initial, options = {}) {
|
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
94
|
const emptyList = { items: [], status: "idle", loadingMore: false };
|
|
95
|
-
const NotificationContext = React.createContext(null);
|
|
95
|
+
const NotificationContext = /*#__PURE__*/ React.createContext(null);
|
|
96
96
|
const useNC = () => {
|
|
97
97
|
const ctx = React.useContext(NotificationContext);
|
|
98
98
|
if (!ctx)
|
|
@@ -270,7 +270,7 @@ export function NotificationCenter({ adapter, tabs: tabsProp, toastOnNew, pollIn
|
|
|
270
270
|
/* Trigger */
|
|
271
271
|
/* ------------------------------------------------------------------ */
|
|
272
272
|
/** The bell with the unread badge (99+). `aria-label` includes the count. */
|
|
273
|
-
export const NotificationTrigger = React.forwardRef(function NotificationTrigger({ className, size = "sm", onClick, ...props }, ref) {
|
|
273
|
+
export const NotificationTrigger = /*#__PURE__*/ React.forwardRef(function NotificationTrigger({ className, size = "sm", onClick, ...props }, ref) {
|
|
274
274
|
const { open, setOpen, unread, important, triggerRef, t } = useNC();
|
|
275
275
|
const { format } = useLocale();
|
|
276
276
|
const label = unread > 0 ? t("triggerUnread", { count: unread }) : t("trigger");
|
|
@@ -379,7 +379,7 @@ const toneWell = {
|
|
|
379
379
|
danger: "tone-danger",
|
|
380
380
|
};
|
|
381
381
|
/** One notification. Usable on its own — e.g. a full "/notifications" page. */
|
|
382
|
-
export const NotificationItem = React.forwardRef(function NotificationItem({ notification: n, onOpen, onMarkRead, onAction, pendingAction, posinset, setsize, labels, className, ...props }, ref) {
|
|
382
|
+
export const NotificationItem = /*#__PURE__*/ React.forwardRef(function NotificationItem({ notification: n, onOpen, onMarkRead, onAction, pendingAction, posinset, setsize, labels, className, ...props }, ref) {
|
|
383
383
|
const t = useLabels("notifications", notificationLabels, labels);
|
|
384
384
|
const { format } = useLocale();
|
|
385
385
|
const titleId = React.useId();
|
|
@@ -9,7 +9,7 @@ import { ActionMenu } from "./dropdown-menu.js";
|
|
|
9
9
|
import { AppShellBreadcrumb } from "./app-shell.js";
|
|
10
10
|
// Server-safe nav helpers (this module has no "use client"), so server layouts can call them.
|
|
11
11
|
export { filterNav, resolveActive, flattenNav, matchPath, navItems, findNavItem, navTrailItems, normaliseBadge, isNavGroup, isNavItem, isNavSeparator, SIDEBAR_COOKIE, parseSidebarCookie, } from "../lib/nav.js";
|
|
12
|
-
export const pageHeaderTitleVariants = cva("font-display min-w-0 text-fg [text-wrap:balance]", {
|
|
12
|
+
export const pageHeaderTitleVariants = /*#__PURE__*/ cva("font-display min-w-0 text-fg [text-wrap:balance]", {
|
|
13
13
|
variants: {
|
|
14
14
|
size: {
|
|
15
15
|
/** Record pages. */
|
|
@@ -36,12 +36,12 @@ export const pageHeaderTitleVariants = cva("font-display min-w-0 text-fg [text-w
|
|
|
36
36
|
* />
|
|
37
37
|
* ```
|
|
38
38
|
*/
|
|
39
|
-
export const PageHeader = React.forwardRef(function PageHeader({ title, eyebrow, breadcrumb, back, description, meta, actions, menu, tabs, size = "md", sticky, align = "start", loading, className, children, ...props }, ref) {
|
|
39
|
+
export const PageHeader = /*#__PURE__*/ React.forwardRef(function PageHeader({ title, eyebrow, breadcrumb, back, description, meta, actions, menu, tabs, size = "md", sticky, align = "start", loading, className, children, ...props }, ref) {
|
|
40
40
|
const centered = align === "center";
|
|
41
41
|
return (_jsxs("header", { ref: ref, "data-slot": "page-header", "data-size": size, className: cn("grid gap-3", tabs ? "mb-6" : size === "lg" ? "mb-8" : "mb-6", sticky && "surface-bar sticky top-(--topbar-h) z-(--z-sticky) -mx-[var(--page-px,1.5rem)] px-[var(--page-px,1.5rem)] pt-3", sticky && !tabs && "pb-3", centered && "justify-items-center text-center", className), ...props, children: [breadcrumb === "auto" ? _jsx(AppShellBreadcrumb, {}) : breadcrumb ? breadcrumb : null, back ? (_jsxs(SmartLink, { href: back.href, className: "-ms-0.5 inline-flex w-fit items-center gap-1.5 rounded-ui-sm text-[13px] text-fg-muted transition-colors hover:text-fg focus-ring", children: [_jsx(ArrowLeft, { "aria-hidden": true, className: "size-3.5 rtl:-scale-x-100" }), back.label] })) : null, _jsxs("div", { className: cn("flex flex-wrap items-end gap-x-6 gap-y-4", centered ? "justify-center" : "justify-between"), children: [_jsxs("div", { className: cn("min-w-0", centered ? "max-w-2xl" : "max-w-3xl flex-[1_1_22rem]"), children: [eyebrow ? _jsx(PageHeaderEyebrow, { className: "mb-1.5", children: eyebrow }) : null, _jsxs("div", { className: cn("flex flex-wrap items-center gap-x-3 gap-y-1.5", centered && "justify-center"), children: [_jsx(PageHeaderTitle, { size: size, "aria-busy": loading || undefined, children: loading ? _jsx(Skeleton, { className: "inline-block h-[0.8em] w-[min(18rem,60vw)] rounded-ui-sm align-middle" }) : title }), meta ? _jsx("div", { className: "flex flex-wrap items-center gap-2 text-[13px] text-fg-subtle", children: meta }) : null] }), description ? _jsx(PageHeaderDescription, { className: cn(size === "lg" ? "mt-2.5" : "mt-1.5", centered && "mx-auto"), children: description }) : null] }), actions || menu?.length ? (_jsxs(PageHeaderActions, { children: [actions, menu?.length ? _jsx(ActionMenu, { items: menu, triggerSize: "md" }) : null] })) : null] }), children, tabs ? _jsx(PageHeaderTabs, { children: tabs }) : null] }));
|
|
42
42
|
});
|
|
43
43
|
/** The `<h1>`. */
|
|
44
|
-
export const PageHeaderTitle = React.forwardRef(function PageHeaderTitle({ size, className, ...props }, ref) {
|
|
44
|
+
export const PageHeaderTitle = /*#__PURE__*/ React.forwardRef(function PageHeaderTitle({ size, className, ...props }, ref) {
|
|
45
45
|
return _jsx("h1", { ref: ref, "data-slot": "page-header-title", className: cn(pageHeaderTitleVariants({ size }), className), ...props });
|
|
46
46
|
});
|
|
47
47
|
/** The small line above the title. Not uppercased with CSS: `text-transform` breaks Turkish i/İ without the right `lang`. */
|
|
@@ -59,21 +59,21 @@ export function usePaginationRange(options) {
|
|
|
59
59
|
const { page, pageCount, siblingCount, boundaryCount } = options;
|
|
60
60
|
return React.useMemo(() => paginationRange({ page, pageCount, siblingCount, boundaryCount }), [page, pageCount, siblingCount, boundaryCount]);
|
|
61
61
|
}
|
|
62
|
-
const SizeContext = React.createContext("md");
|
|
62
|
+
const SizeContext = /*#__PURE__*/ React.createContext("md");
|
|
63
63
|
const itemSize = {
|
|
64
64
|
sm: "h-8 min-w-8 px-2 text-[13px] rounded-ui-sm [&_svg]:size-3.5",
|
|
65
65
|
md: "h-(--control-h) min-w-(--control-h) px-2.5 text-sm rounded-ui [&_svg]:size-4",
|
|
66
66
|
};
|
|
67
67
|
/** The `<ul>` of page items. */
|
|
68
|
-
export const PaginationList = React.forwardRef(function PaginationList({ className, ...props }, ref) {
|
|
68
|
+
export const PaginationList = /*#__PURE__*/ React.forwardRef(function PaginationList({ className, ...props }, ref) {
|
|
69
69
|
return _jsx("ul", { ref: ref, "data-slot": "pagination-list", className: cn("flex items-center gap-1", className), ...props });
|
|
70
70
|
});
|
|
71
71
|
/** One `<li>`. */
|
|
72
|
-
export const PaginationItem = React.forwardRef(function PaginationItem({ className, ...props }, ref) {
|
|
72
|
+
export const PaginationItem = /*#__PURE__*/ React.forwardRef(function PaginationItem({ className, ...props }, ref) {
|
|
73
73
|
return _jsx("li", { ref: ref, "data-slot": "pagination-item", className: cn("inline-flex", className), ...props });
|
|
74
74
|
});
|
|
75
75
|
/** A page number, or the shell for Previous / Next. Router `Link` when `href` is set, else a button. */
|
|
76
|
-
export const PaginationLink = React.forwardRef(function PaginationLink({ href, isActive, disabled, loading, className, children, onClick, ...props }, ref) {
|
|
76
|
+
export const PaginationLink = /*#__PURE__*/ React.forwardRef(function PaginationLink({ href, isActive, disabled, loading, className, children, onClick, ...props }, ref) {
|
|
77
77
|
const Link = useLink();
|
|
78
78
|
const size = React.useContext(SizeContext);
|
|
79
79
|
const classes = cn(buttonVariants({ variant: "ghost" }), itemSize[size], "tabular font-normal text-fg-muted hover:text-fg", isActive && "bg-selected font-semibold text-fg hover:bg-selected", className);
|
|
@@ -88,12 +88,12 @@ export const PaginationLink = React.forwardRef(function PaginationLink({ href, i
|
|
|
88
88
|
return (_jsx("button", { ref: ref, type: "button", "aria-current": isActive ? "page" : undefined, "aria-busy": loading || undefined, disabled: disabled, className: classes, "data-slot": "pagination-link", onClick: onClick, ...props, children: content }));
|
|
89
89
|
});
|
|
90
90
|
/** Previous-page control. The arrow flips in RTL. */
|
|
91
|
-
export const PaginationPrevious = React.forwardRef(function PaginationPrevious({ showLabel, labels, className, ...props }, ref) {
|
|
91
|
+
export const PaginationPrevious = /*#__PURE__*/ React.forwardRef(function PaginationPrevious({ showLabel, labels, className, ...props }, ref) {
|
|
92
92
|
const t = useLabels("pagination", paginationLabels, labels);
|
|
93
93
|
return (_jsxs(PaginationLink, { ref: ref, "aria-label": t("previousPage"), className: cn(showLabel && "gap-1 ps-2 pe-3", className), "data-slot": "pagination-previous", ...props, children: [_jsx(ChevronLeft, { "aria-hidden": true, className: "rtl:-scale-x-100" }), showLabel ? _jsx("span", { children: t("previous") }) : null] }));
|
|
94
94
|
});
|
|
95
95
|
/** Next-page control. The arrow flips in RTL. */
|
|
96
|
-
export const PaginationNext = React.forwardRef(function PaginationNext({ showLabel, labels, className, ...props }, ref) {
|
|
96
|
+
export const PaginationNext = /*#__PURE__*/ React.forwardRef(function PaginationNext({ showLabel, labels, className, ...props }, ref) {
|
|
97
97
|
const t = useLabels("pagination", paginationLabels, labels);
|
|
98
98
|
return (_jsxs(PaginationLink, { ref: ref, "aria-label": t("nextPage"), className: cn(showLabel && "gap-1 ps-3 pe-2", className), "data-slot": "pagination-next", ...props, children: [showLabel ? _jsx("span", { children: t("next") }) : null, _jsx(ChevronRight, { "aria-hidden": true, className: "rtl:-scale-x-100" })] }));
|
|
99
99
|
});
|
|
@@ -113,7 +113,7 @@ export function PaginationEllipsis({ className, labels, ...props }) {
|
|
|
113
113
|
*
|
|
114
114
|
* Moving focus to the top of the list after a page change is the consumer's job.
|
|
115
115
|
*/
|
|
116
|
-
export const Pagination = React.forwardRef(function Pagination({ page, pageCount, onPageChange, getHref, siblingCount, boundaryCount, variant = "numbers", size = "md", hideOnSinglePage = true, loading, labels, className, ...props }, ref) {
|
|
116
|
+
export const Pagination = /*#__PURE__*/ React.forwardRef(function Pagination({ page, pageCount, onPageChange, getHref, siblingCount, boundaryCount, variant = "numbers", size = "md", hideOnSinglePage = true, loading, labels, className, ...props }, ref) {
|
|
117
117
|
const t = useLabels("pagination", paginationLabels, labels);
|
|
118
118
|
const range = usePaginationRange({ page, pageCount, siblingCount, boundaryCount });
|
|
119
119
|
if (pageCount < 1 || (hideOnSinglePage && pageCount <= 1))
|
|
@@ -137,7 +137,7 @@ export const Pagination = React.forwardRef(function Pagination({ page, pageCount
|
|
|
137
137
|
* The table footer: "1–20 of 312" + rows per page + page numbers. Changing the page size keeps the
|
|
138
138
|
* first visible row on screen (the page is recomputed) — the consumer receives both callbacks.
|
|
139
139
|
*/
|
|
140
|
-
export const PaginationBar = React.forwardRef(function PaginationBar({ total, pageSize, pageSizeOptions = [10, 20, 50, 100], onPageSizeChange, page, onPageChange, labels, size = "md", className, style, id, ...props }, ref) {
|
|
140
|
+
export const PaginationBar = /*#__PURE__*/ React.forwardRef(function PaginationBar({ total, pageSize, pageSizeOptions = [10, 20, 50, 100], onPageSizeChange, page, onPageChange, labels, size = "md", className, style, id, ...props }, ref) {
|
|
141
141
|
const t = useLabels("pagination", paginationLabels, labels);
|
|
142
142
|
const f = useFormat();
|
|
143
143
|
const selectId = React.useId();
|
|
@@ -156,7 +156,7 @@ export const PaginationBar = React.forwardRef(function PaginationBar({ total, pa
|
|
|
156
156
|
}, className: cn(controlVariants({ size: "sm" }), "tabular w-auto appearance-none pe-7 text-fg"), children: options.map((o) => (_jsx("option", { value: o, children: f.number(o) }, o))) }), _jsx(ChevronDown, { "aria-hidden": true, className: "pointer-events-none absolute end-2 top-1/2 size-3.5 -translate-y-1/2 text-fg-subtle" })] })] })) : null, _jsx(Pagination, { page: current, pageCount: pageCount, onPageChange: onPageChange, labels: labels, size: size, hideOnSinglePage: false, ...props })] }));
|
|
157
157
|
});
|
|
158
158
|
/** Previous / Next for cursor APIs where the total is unknown. */
|
|
159
|
-
export const CursorPagination = React.forwardRef(function CursorPagination({ hasPrev, hasNext, onPrev, onNext, loading, status, size = "md", labels, className, ...props }, ref) {
|
|
159
|
+
export const CursorPagination = /*#__PURE__*/ React.forwardRef(function CursorPagination({ hasPrev, hasNext, onPrev, onNext, loading, status, size = "md", labels, className, ...props }, ref) {
|
|
160
160
|
const t = useLabels("pagination", paginationLabels, labels);
|
|
161
161
|
const [pressed, setPressed] = React.useState(null);
|
|
162
162
|
React.useEffect(() => {
|
|
@@ -53,7 +53,7 @@ const accept = (ch) => (ch >= "0" && ch <= "9") || ch === "+";
|
|
|
53
53
|
* <Field label="Mobile"><PhoneInput defaultCountry="TR" onValueChange={(e164) => save(e164)} /></Field>
|
|
54
54
|
* ```
|
|
55
55
|
*/
|
|
56
|
-
export const PhoneInput = React.forwardRef(function PhoneInput(props, forwardedRef) {
|
|
56
|
+
export const PhoneInput = /*#__PURE__*/ React.forwardRef(function PhoneInput(props, forwardedRef) {
|
|
57
57
|
const { country: countryProp, defaultCountry, onCountryChange, countries, preferredCountries, display: displayMode = "national", hideCountry, value, defaultValue, onValueChange, validateOn = "blur", onValidate, mono, labels, name, invalid, inputClassName, onBlur, onKeyDown, disabled, readOnly, size, ...rest } = props;
|
|
58
58
|
const { locale } = useLocale();
|
|
59
59
|
const t = useLabels("phoneInput", phoneInputLabels, labels);
|
|
@@ -69,7 +69,7 @@ function niceStep(span, target) {
|
|
|
69
69
|
* selectedId={selected} onSelectedIdChange={setSelected} />
|
|
70
70
|
* ```
|
|
71
71
|
*/
|
|
72
|
-
export const PinMap = React.forwardRef(function PinMap({ pins, bounds, aspectRatio = 16 / 10, variant = "pin", selectedId: selectedProp, defaultSelectedId = null, onSelectedIdChange, callout, showLabels, backdrop, bare, className, style, children, ...props }, ref) {
|
|
72
|
+
export const PinMap = /*#__PURE__*/ React.forwardRef(function PinMap({ pins, bounds, aspectRatio = 16 / 10, variant = "pin", selectedId: selectedProp, defaultSelectedId = null, onSelectedIdChange, callout, showLabels, backdrop, bare, className, style, children, ...props }, ref) {
|
|
73
73
|
const f = useFormat();
|
|
74
74
|
const [selectedId, setSelectedId] = useControllableState({ value: selectedProp, defaultValue: defaultSelectedId, onChange: onSelectedIdChange, name: "PinMap" });
|
|
75
75
|
const [focusId, setFocusId] = React.useState(null);
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type PlaceholderArtPattern = "grid" | "dots" | "lines" | "rings" | "glow";
|
|
3
|
+
export declare const PLACEHOLDER_ART_PATTERNS: PlaceholderArtPattern[];
|
|
4
|
+
/** FNV-1a 32-bit — stable across server and client, so SSR and hydration agree. */
|
|
5
|
+
export declare function hashSeed(seed: string): number;
|
|
6
|
+
export interface PlaceholderArtRecipe {
|
|
7
|
+
pattern: PlaceholderArtPattern;
|
|
8
|
+
/** Chart palette slot (1–6) used as the tint. */
|
|
9
|
+
hue: number;
|
|
10
|
+
/** Second slot for the glow. */
|
|
11
|
+
hue2: number;
|
|
12
|
+
/** Line angle in degrees (lines). */
|
|
13
|
+
angle: number;
|
|
14
|
+
/** Pattern cell in px. */
|
|
15
|
+
cell: number;
|
|
16
|
+
/** Focal point in % (rings, glow, highlight). */
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
}
|
|
20
|
+
/** The same seed always gives the same recipe. `pattern` overrides the seeded choice. */
|
|
21
|
+
export declare function placeholderArtRecipe(seed: string, pattern?: PlaceholderArtPattern | "auto"): PlaceholderArtRecipe;
|
|
22
|
+
/** CSS background for a recipe. Token colours only, mixed per theme by the browser. */
|
|
23
|
+
export declare function placeholderArtStyle(recipe: PlaceholderArtRecipe, strength?: "subtle" | "bold"): React.CSSProperties;
|
|
24
|
+
export interface PlaceholderArtProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children"> {
|
|
25
|
+
/** Any stable string (a slug, a name, a record id). Same seed → same art, on server and client. */
|
|
26
|
+
seed?: string;
|
|
27
|
+
/** Force a pattern. Default `"auto"` (picked from the seed). */
|
|
28
|
+
pattern?: PlaceholderArtPattern | "auto";
|
|
29
|
+
/** Centre icon. Default: an image glyph. `false` hides it. */
|
|
30
|
+
icon?: React.ReactNode | false;
|
|
31
|
+
/**
|
|
32
|
+
* What the missing image would show. Set → `role="img"` with this as its name; empty → decorative
|
|
33
|
+
* (`aria-hidden`).
|
|
34
|
+
*/
|
|
35
|
+
label?: string;
|
|
36
|
+
/** Print the label (or a custom node) in the bottom corner, e.g. "Photo · Harbour terrace". */
|
|
37
|
+
caption?: boolean | React.ReactNode;
|
|
38
|
+
/** `bold` doubles the tint — for large hero areas on plain pages. Default `subtle`. */
|
|
39
|
+
strength?: "subtle" | "bold";
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* A tasteful, deterministic stand-in for a missing image: a token-tinted pattern (grid, dots, lines,
|
|
43
|
+
* rings or glow) chosen from a seed, an optional glyph and caption. No assets, no network, no
|
|
44
|
+
* dependencies; follows theme and accent. Fills its parent — give the parent a size, or use it inside
|
|
45
|
+
* `AspectRatio` / `Image`.
|
|
46
|
+
*
|
|
47
|
+
* ```tsx
|
|
48
|
+
* <AspectRatio ratio="4/3"><PlaceholderArt seed="harbour-terrace" label="Harbour terrace at dusk" /></AspectRatio>
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export declare const PlaceholderArt: React.ForwardRefExoticComponent<PlaceholderArtProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Image as ImageIcon } from "lucide-react";
|
|
4
|
+
import { cn } from "../lib/cn.js";
|
|
5
|
+
export const PLACEHOLDER_ART_PATTERNS = ["grid", "dots", "lines", "rings", "glow"];
|
|
6
|
+
/** FNV-1a 32-bit — stable across server and client, so SSR and hydration agree. */
|
|
7
|
+
export function hashSeed(seed) {
|
|
8
|
+
let h = 0x811c9dc5;
|
|
9
|
+
for (let i = 0; i < seed.length; i++) {
|
|
10
|
+
h ^= seed.charCodeAt(i);
|
|
11
|
+
h = Math.imul(h, 0x01000193);
|
|
12
|
+
}
|
|
13
|
+
return h >>> 0;
|
|
14
|
+
}
|
|
15
|
+
/** The same seed always gives the same recipe. `pattern` overrides the seeded choice. */
|
|
16
|
+
export function placeholderArtRecipe(seed, pattern) {
|
|
17
|
+
const h = hashSeed(seed || "vamos");
|
|
18
|
+
const pick = (shift, n) => (h >>> shift) % n;
|
|
19
|
+
const hue = pick(0, 6) + 1;
|
|
20
|
+
return {
|
|
21
|
+
pattern: pattern && pattern !== "auto" ? pattern : PLACEHOLDER_ART_PATTERNS[pick(3, PLACEHOLDER_ART_PATTERNS.length)],
|
|
22
|
+
hue,
|
|
23
|
+
hue2: ((hue + pick(6, 4)) % 6) + 1,
|
|
24
|
+
angle: [30, 45, 60, 120, 135, 150][pick(9, 6)],
|
|
25
|
+
cell: [14, 18, 22, 26][pick(12, 4)],
|
|
26
|
+
x: 15 + pick(14, 70),
|
|
27
|
+
y: 10 + pick(21, 60),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/** CSS background for a recipe. Token colours only, mixed per theme by the browser. */
|
|
31
|
+
export function placeholderArtStyle(recipe, strength = "subtle") {
|
|
32
|
+
const { pattern, hue, hue2, angle, cell, x, y } = recipe;
|
|
33
|
+
const tint = `var(--chart-${hue})`;
|
|
34
|
+
const k = strength === "bold" ? 1.6 : 1;
|
|
35
|
+
const ink = `color-mix(in oklab, ${tint} ${Math.round(30 * k)}%, transparent)`;
|
|
36
|
+
const base = `color-mix(in oklab, ${tint} ${Math.round(9 * k)}%, var(--surface-2))`;
|
|
37
|
+
const highlight = `radial-gradient(120% 90% at ${x}% ${y}%, color-mix(in oklab, ${tint} ${Math.round(16 * k)}%, transparent), transparent 65%)`;
|
|
38
|
+
let layers;
|
|
39
|
+
let sizes;
|
|
40
|
+
switch (pattern) {
|
|
41
|
+
case "grid":
|
|
42
|
+
layers = [highlight, `linear-gradient(${ink} 1px, transparent 1px)`, `linear-gradient(90deg, ${ink} 1px, transparent 1px)`];
|
|
43
|
+
sizes = ["100% 100%", `${cell}px ${cell}px`, `${cell}px ${cell}px`];
|
|
44
|
+
break;
|
|
45
|
+
case "dots":
|
|
46
|
+
layers = [highlight, `radial-gradient(circle, ${ink} 1.1px, transparent 1.6px)`];
|
|
47
|
+
sizes = ["100% 100%", `${cell}px ${cell}px`];
|
|
48
|
+
break;
|
|
49
|
+
case "lines":
|
|
50
|
+
layers = [highlight, `repeating-linear-gradient(${angle}deg, ${ink} 0 1px, transparent 1px ${Math.round(cell / 2)}px)`];
|
|
51
|
+
sizes = ["100% 100%", "100% 100%"];
|
|
52
|
+
break;
|
|
53
|
+
case "rings":
|
|
54
|
+
layers = [highlight, `repeating-radial-gradient(circle at ${x}% ${y}%, transparent 0 ${cell - 1}px, ${ink} ${cell - 1}px ${cell}px)`];
|
|
55
|
+
sizes = ["100% 100%", "100% 100%"];
|
|
56
|
+
break;
|
|
57
|
+
case "glow":
|
|
58
|
+
default:
|
|
59
|
+
layers = [
|
|
60
|
+
`radial-gradient(70% 80% at ${x}% ${y}%, color-mix(in oklab, ${tint} ${Math.round(34 * k)}%, transparent), transparent 70%)`,
|
|
61
|
+
`radial-gradient(60% 70% at ${100 - x}% ${100 - y}%, color-mix(in oklab, var(--chart-${hue2}) ${Math.round(26 * k)}%, transparent), transparent 70%)`,
|
|
62
|
+
];
|
|
63
|
+
sizes = ["100% 100%", "100% 100%"];
|
|
64
|
+
}
|
|
65
|
+
return { backgroundColor: base, backgroundImage: layers.join(", "), backgroundSize: sizes.join(", "), backgroundPosition: "center" };
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* A tasteful, deterministic stand-in for a missing image: a token-tinted pattern (grid, dots, lines,
|
|
69
|
+
* rings or glow) chosen from a seed, an optional glyph and caption. No assets, no network, no
|
|
70
|
+
* dependencies; follows theme and accent. Fills its parent — give the parent a size, or use it inside
|
|
71
|
+
* `AspectRatio` / `Image`.
|
|
72
|
+
*
|
|
73
|
+
* ```tsx
|
|
74
|
+
* <AspectRatio ratio="4/3"><PlaceholderArt seed="harbour-terrace" label="Harbour terrace at dusk" /></AspectRatio>
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
export const PlaceholderArt = /*#__PURE__*/ React.forwardRef(function PlaceholderArt({ seed, pattern = "auto", icon, label, caption, strength = "subtle", className, style, ...props }, ref) {
|
|
78
|
+
const recipe = placeholderArtRecipe(seed ?? label ?? "", pattern);
|
|
79
|
+
const a11y = label ? { role: "img", "aria-label": label } : { "aria-hidden": true };
|
|
80
|
+
const captionNode = caption === true ? label : caption || null;
|
|
81
|
+
return (_jsxs("div", { ref: ref, "data-slot": "placeholder-art", "data-pattern": recipe.pattern, ...a11y, className: cn("relative flex size-full min-h-16 items-center justify-center overflow-hidden text-fg-subtle", className), style: { ...placeholderArtStyle(recipe, strength), ...style }, ...props, children: [icon !== false ? (_jsx("span", { "aria-hidden": true, "data-slot": "placeholder-art-icon", className: "inline-flex size-10 items-center justify-center rounded-full border border-line bg-[color-mix(in_oklab,var(--surface)_72%,transparent)] [&_svg]:size-[18px]", children: icon ?? _jsx(ImageIcon, { strokeWidth: 1.5 }) })) : null, captionNode ? (_jsx("span", { "aria-hidden": true, "data-slot": "placeholder-art-caption", className: "absolute start-3 bottom-2.5 max-w-[calc(100%-1.5rem)] truncate font-mono text-[10.5px] tracking-[0.06em] text-fg-muted uppercase", children: captionNode })) : null] }));
|
|
82
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import
|
|
2
|
+
import * as PopoverPrimitive from "radix-ui/popover";
|
|
3
3
|
import { type VariantProps } from "class-variance-authority";
|
|
4
4
|
/** Root. Controlled (`open` / `onOpenChange`) or uncontrolled (`defaultOpen`). */
|
|
5
5
|
export declare const Popover: React.FC<PopoverPrimitive.PopoverProps>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
import
|
|
4
|
+
import * as PopoverPrimitive from "radix-ui/popover";
|
|
5
5
|
import { cva } from "class-variance-authority";
|
|
6
6
|
import { cn } from "../lib/cn.js";
|
|
7
7
|
import { usePortalContainer } from "../lib/theme-scope.js";
|
|
@@ -14,7 +14,7 @@ export const PopoverTrigger = PopoverPrimitive.Trigger;
|
|
|
14
14
|
export const PopoverAnchor = PopoverPrimitive.Anchor;
|
|
15
15
|
/** Closes the popover; use `asChild` with a Button. */
|
|
16
16
|
export const PopoverClose = PopoverPrimitive.Close;
|
|
17
|
-
export const popoverContentVariants = cva(["surface-popover ui-pop z-(--z-popover) rounded-ui-lg outline-none", "max-h-(--radix-popover-content-available-height) overflow-y-auto overscroll-contain"], {
|
|
17
|
+
export const popoverContentVariants = /*#__PURE__*/ cva(["surface-popover ui-pop z-(--z-popover) rounded-ui-lg outline-none", "max-h-(--radix-popover-content-available-height) overflow-y-auto overscroll-contain"], {
|
|
18
18
|
variants: {
|
|
19
19
|
size: {
|
|
20
20
|
auto: "w-auto max-w-[calc(100vw-1.5rem)]",
|
|
@@ -31,13 +31,13 @@ export const popoverContentVariants = cva(["surface-popover ui-pop z-(--z-popove
|
|
|
31
31
|
},
|
|
32
32
|
defaultVariants: { size: "md", padded: true },
|
|
33
33
|
});
|
|
34
|
-
const PopoverTitleContext = React.createContext(null);
|
|
34
|
+
const PopoverTitleContext = /*#__PURE__*/ React.createContext(null);
|
|
35
35
|
/**
|
|
36
36
|
* The floating panel. Portals into the nearest `ThemeScope`, sets the layer depth
|
|
37
37
|
* (only the first layer blurs in glass mode; a popover inside a dialog turns opaque),
|
|
38
38
|
* and is labelled by its `PopoverTitle` when one is rendered.
|
|
39
39
|
*/
|
|
40
|
-
export const PopoverContent = React.forwardRef(function PopoverContent({ className, size, padded, arrow = false, sideOffset = 6, collisionPadding = 12, align = "center", children, ...props }, ref) {
|
|
40
|
+
export const PopoverContent = /*#__PURE__*/ React.forwardRef(function PopoverContent({ className, size, padded, arrow = false, sideOffset = 6, collisionPadding = 12, align = "center", children, ...props }, ref) {
|
|
41
41
|
const container = usePortalContainer();
|
|
42
42
|
const titleId = React.useId();
|
|
43
43
|
const [hasTitle, setHasTitle] = React.useState(false);
|
|
@@ -45,11 +45,11 @@ export const PopoverContent = React.forwardRef(function PopoverContent({ classNa
|
|
|
45
45
|
return (_jsx(PopoverPrimitive.Portal, { container: container, children: _jsx(Layer, { asChild: true, children: _jsxs(PopoverPrimitive.Content, { ref: ref, "data-slot": "popover-content", sideOffset: sideOffset, collisionPadding: collisionPadding, align: align, "aria-labelledby": hasTitle ? titleId : undefined, className: cn(popoverContentVariants({ size, padded }), className), ...props, children: [_jsx(PopoverTitleContext.Provider, { value: titleCtx, children: children }), arrow ? (_jsx(PopoverPrimitive.Arrow, { asChild: true, width: 14, height: 7, children: _jsx(FloatingArrow, {}) })) : null] }) }) }));
|
|
46
46
|
});
|
|
47
47
|
/** Title + optional description at the top of the content. */
|
|
48
|
-
export const PopoverHeader = React.forwardRef(function PopoverHeader({ title, description, action, className, children, ...props }, ref) {
|
|
48
|
+
export const PopoverHeader = /*#__PURE__*/ React.forwardRef(function PopoverHeader({ title, description, action, className, children, ...props }, ref) {
|
|
49
49
|
return (_jsxs("div", { ref: ref, "data-slot": "popover-header", className: cn("mb-3 flex items-start gap-3", className), ...props, children: [_jsxs("div", { className: "grid min-w-0 flex-1 gap-0.5", children: [title != null ? _jsx(PopoverTitle, { children: title }) : null, description != null ? _jsx(PopoverDescription, { children: description }) : null, children] }), action ? _jsx("div", { className: "-me-1 -mt-1 shrink-0", children: action }) : null] }));
|
|
50
50
|
});
|
|
51
51
|
/** Heading inside the content; wired to `aria-labelledby`. */
|
|
52
|
-
export const PopoverTitle = React.forwardRef(function PopoverTitle({ className, id, ...props }, ref) {
|
|
52
|
+
export const PopoverTitle = /*#__PURE__*/ React.forwardRef(function PopoverTitle({ className, id, ...props }, ref) {
|
|
53
53
|
const ctx = React.useContext(PopoverTitleContext);
|
|
54
54
|
const register = ctx?.register;
|
|
55
55
|
React.useEffect(() => {
|
|
@@ -64,6 +64,6 @@ export function PopoverDescription({ className, ...props }) {
|
|
|
64
64
|
return _jsx("p", { "data-slot": "popover-description", className: cn("text-[13px] leading-snug text-fg-muted", className), ...props });
|
|
65
65
|
}
|
|
66
66
|
/** Bottom row for actions. Bleeds to the panel edge with a hairline on top. */
|
|
67
|
-
export const PopoverFooter = React.forwardRef(function PopoverFooter({ className, ...props }, ref) {
|
|
67
|
+
export const PopoverFooter = /*#__PURE__*/ React.forwardRef(function PopoverFooter({ className, ...props }, ref) {
|
|
68
68
|
return (_jsx("div", { ref: ref, "data-slot": "popover-footer", className: cn("-mx-(--popover-p) -mb-(--popover-p) mt-4 flex items-center justify-end gap-2 border-t border-line px-(--popover-p) py-[calc(var(--popover-p)*0.7)]", className), ...props }));
|
|
69
69
|
});
|
|
@@ -46,7 +46,7 @@ const valueColor = {
|
|
|
46
46
|
/* ------------------------------------------------------------------ */
|
|
47
47
|
/* Linear */
|
|
48
48
|
/* ------------------------------------------------------------------ */
|
|
49
|
-
export const progressTrackVariants = cva("relative w-full overflow-hidden rounded-full bg-track", {
|
|
49
|
+
export const progressTrackVariants = /*#__PURE__*/ cva("relative w-full overflow-hidden rounded-full bg-track", {
|
|
50
50
|
variants: {
|
|
51
51
|
size: { xs: "h-0.5", sm: "h-1", md: "h-2" },
|
|
52
52
|
},
|
|
@@ -63,7 +63,7 @@ export const progressTrackVariants = cva("relative w-full overflow-hidden rounde
|
|
|
63
63
|
* <Progress aria-label="Loading" value={null} />
|
|
64
64
|
* ```
|
|
65
65
|
*/
|
|
66
|
-
export const Progress = React.forwardRef(function Progress({ value, max, tone, display, valueText, labels, size, label, showValue, hint, className, id, ...props }, ref) {
|
|
66
|
+
export const Progress = /*#__PURE__*/ React.forwardRef(function Progress({ value, max, tone, display, valueText, labels, size, label, showValue, hint, className, id, ...props }, ref) {
|
|
67
67
|
const m = useProgressModel({ value, max, tone, display, valueText, labels });
|
|
68
68
|
const autoId = React.useId();
|
|
69
69
|
const baseId = id ?? `progress${autoId.replace(/:/g, "")}`;
|
|
@@ -87,7 +87,7 @@ const CIRCLE = { sm: { px: 18, stroke: 2.5 }, md: { px: 40, stroke: 3.5 }, lg: {
|
|
|
87
87
|
* <ProgressCircle aria-label="Profile complete" value={72} size="lg" />
|
|
88
88
|
* ```
|
|
89
89
|
*/
|
|
90
|
-
export const ProgressCircle = React.forwardRef(function ProgressCircle({ value, max, tone, display, valueText, labels, size = "md", showValue, children, className, ...props }, ref) {
|
|
90
|
+
export const ProgressCircle = /*#__PURE__*/ React.forwardRef(function ProgressCircle({ value, max, tone, display, valueText, labels, size = "md", showValue, children, className, ...props }, ref) {
|
|
91
91
|
const m = useProgressModel({ value, max, tone, display, valueText, labels });
|
|
92
92
|
const { px, stroke } = CIRCLE[size];
|
|
93
93
|
const r = (px - stroke) / 2;
|