@vamos-ui/react 0.4.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-link.js +1 -1
- package/dist/blocks/index.d.ts +3 -3
- package/dist/blocks/index.js +3 -3
- 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/feature-tabs.js +1 -1
- package/dist/blocks/site/footer.d.ts +10 -1
- package/dist/blocks/site/footer.js +28 -4
- package/dist/blocks/site/registry-2.js +3 -1
- package/dist/blocks/site/shared/labels-2.d.ts +8 -0
- package/dist/blocks/site/shared/labels-2.js +808 -0
- package/dist/blocks/site/site-shell.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-list.js +1 -1
- package/dist/charts/chart-shell.js +1 -1
- package/dist/charts/donut-chart.js +1 -1
- package/dist/charts/funnel.js +1 -1
- package/dist/charts/gauge.js +2 -2
- package/dist/components/accordion.d.ts +1 -1
- package/dist/components/accordion.js +8 -8
- package/dist/components/activity-timeline.js +6 -6
- 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.js +2 -2
- 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.js +9 -9
- package/dist/components/checkbox.d.ts +1 -1
- package/dist/components/checkbox.js +6 -6
- package/dist/components/collapsible.d.ts +1 -1
- package/dist/components/collapsible.js +4 -4
- 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.js +5 -5
- 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 +1 -1
- package/dist/components/menubar.js +12 -12
- 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.js +1 -1
- 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 -94
- package/dist/index.js +94 -94
- 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/variants.js +2 -2
- 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 +3 -3
- 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.js +1 -1
- package/dist/motion/ticker.js +1 -1
- package/dist/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
- 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/package.json +1 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
import
|
|
4
|
+
import * as Collapsible from "radix-ui/collapsible";
|
|
5
|
+
import * as PopoverPrimitive from "radix-ui/popover";
|
|
5
6
|
import { ArrowUpRight, Check, ChevronDown, ChevronRight, ChevronsUpDown, PanelLeftClose, PanelLeftOpen } from "lucide-react";
|
|
6
7
|
import { cn } from "../lib/cn.js";
|
|
7
8
|
import { useLabels } from "../lib/labels.js";
|
|
@@ -27,7 +28,7 @@ const sidebarLabels = {
|
|
|
27
28
|
workspaces: "Workspaces",
|
|
28
29
|
loading: "Loading menu",
|
|
29
30
|
};
|
|
30
|
-
const SidebarContext = React.createContext(null);
|
|
31
|
+
const SidebarContext = /*#__PURE__*/ React.createContext(null);
|
|
31
32
|
/** Collapsed state and helpers of the nearest `Sidebar`. */
|
|
32
33
|
export function useSidebar() {
|
|
33
34
|
const ctx = React.useContext(SidebarContext);
|
|
@@ -42,8 +43,8 @@ const useSidebarCtx = () => {
|
|
|
42
43
|
return ctx;
|
|
43
44
|
};
|
|
44
45
|
/** Active trail from `SidebarNav` (data-driven); `null` in the compound API (each item checks its own href). */
|
|
45
|
-
const TrailContext = React.createContext(null);
|
|
46
|
-
const SubContext = React.createContext({ placement: "inline", depth: 1 });
|
|
46
|
+
const TrailContext = /*#__PURE__*/ React.createContext(null);
|
|
47
|
+
const SubContext = /*#__PURE__*/ React.createContext({ placement: "inline", depth: 1 });
|
|
47
48
|
/**
|
|
48
49
|
* The primary app navigation. Dark in both themes; the active section's submenu stays open in
|
|
49
50
|
* place, other sections open as flyouts, and the rail turns every submenu into a flyout.
|
|
@@ -57,7 +58,7 @@ const SubContext = React.createContext({ placement: "inline", depth: 1 });
|
|
|
57
58
|
* </Sidebar>
|
|
58
59
|
* ```
|
|
59
60
|
*/
|
|
60
|
-
export const Sidebar = React.forwardRef(function Sidebar({ variant = "nav", collapsed: collapsedProp, defaultCollapsed = false, onCollapsedChange, collapsible = true, mode = "desktop", shortcut = false, onNavigate, labels, className, children, ...props }, ref) {
|
|
61
|
+
export const Sidebar = /*#__PURE__*/ React.forwardRef(function Sidebar({ variant = "nav", collapsed: collapsedProp, defaultCollapsed = false, onCollapsedChange, collapsible = true, mode = "desktop", shortcut = false, onNavigate, labels, className, children, ...props }, ref) {
|
|
61
62
|
const t = useLabels("sidebar", sidebarLabels, labels);
|
|
62
63
|
const [collapsedState, setCollapsed] = useControllableState({ value: collapsedProp, defaultValue: defaultCollapsed, onChange: onCollapsedChange, name: "Sidebar" });
|
|
63
64
|
const collapsed = mode === "desktop" && collapsible && collapsedState;
|
|
@@ -66,20 +67,20 @@ export const Sidebar = React.forwardRef(function Sidebar({ variant = "nav", coll
|
|
|
66
67
|
return (_jsx(SidebarContext.Provider, { value: ctx, children: _jsx("aside", { ref: ref, "data-slot": "sidebar", "data-variant": variant, "data-mode": mode, "data-collapsed": collapsed ? "" : undefined, className: cn("vui-sidebar surface-nav relative flex h-full min-h-0 shrink-0 flex-col text-[13.5px]", mode === "desktop" && "border-e border-nav-line", variant === "surface" && "border-line", className), ...props, children: children }) }));
|
|
67
68
|
});
|
|
68
69
|
/** Top slot: app switcher, workspace switcher, logo. */
|
|
69
|
-
export const SidebarHeader = React.forwardRef(function SidebarHeader({ className, ...props }, ref) {
|
|
70
|
+
export const SidebarHeader = /*#__PURE__*/ React.forwardRef(function SidebarHeader({ className, ...props }, ref) {
|
|
70
71
|
return _jsx("div", { ref: ref, "data-slot": "sidebar-header", className: cn("grid gap-1 border-b border-nav-line p-2", className), ...props });
|
|
71
72
|
});
|
|
72
73
|
/** The scrolling `<nav>` with the menu. */
|
|
73
|
-
export const SidebarContent = React.forwardRef(function SidebarContent({ className, ...props }, ref) {
|
|
74
|
+
export const SidebarContent = /*#__PURE__*/ React.forwardRef(function SidebarContent({ className, ...props }, ref) {
|
|
74
75
|
const { t } = useSidebarCtx();
|
|
75
76
|
return (_jsx("nav", { ref: ref, "data-slot": "sidebar-content", "aria-label": props["aria-label"] ?? t("label"), className: cn("min-h-0 flex-1 overflow-y-auto overflow-x-hidden overscroll-contain py-2 scrollbar-none", className), ...props }));
|
|
76
77
|
});
|
|
77
78
|
/** Bottom slot: shared menu, collapse button, user. */
|
|
78
|
-
export const SidebarFooter = React.forwardRef(function SidebarFooter({ className, ...props }, ref) {
|
|
79
|
+
export const SidebarFooter = /*#__PURE__*/ React.forwardRef(function SidebarFooter({ className, ...props }, ref) {
|
|
79
80
|
return _jsx("div", { ref: ref, "data-slot": "sidebar-footer", className: cn("border-t border-nav-line", className), ...props });
|
|
80
81
|
});
|
|
81
82
|
/** A section: optional heading plus a list of `SidebarItem`s. */
|
|
82
|
-
export const SidebarGroup = React.forwardRef(function SidebarGroup({ label, className, children, ...props }, ref) {
|
|
83
|
+
export const SidebarGroup = /*#__PURE__*/ React.forwardRef(function SidebarGroup({ label, className, children, ...props }, ref) {
|
|
83
84
|
const { collapsed } = useSidebarCtx();
|
|
84
85
|
const id = React.useId();
|
|
85
86
|
return (_jsxs("div", { ref: ref, "data-slot": "sidebar-group", role: label ? "group" : undefined, "aria-labelledby": label ? id : undefined, className: cn("grid", className), ...props, children: [label ? (collapsed ? (_jsxs(_Fragment, { children: [_jsx("span", { id: id, className: "sr-only", children: label }), _jsx("span", { "aria-hidden": true, className: "mx-4 my-2 h-px bg-nav-line" })] })) : (_jsx("span", { id: id, className: "px-4.5 pt-4 pb-1.5 text-[11px] font-medium tracking-[0.06em] text-nav-fg/70", children: label }))) : null, _jsx("ul", { className: "grid gap-px", children: children })] }));
|
|
@@ -149,7 +150,7 @@ function useItemActive(id, href, children, explicit) {
|
|
|
149
150
|
}
|
|
150
151
|
const rowBase = "relative flex w-full items-center gap-3 rounded-ui-sm text-start outline-none transition-colors focus-ring";
|
|
151
152
|
/** An `<a>` through the app router, a `<button>` (no href) or a disabled `<span>`. */
|
|
152
|
-
const LinkRow = React.forwardRef(function LinkRow({ href, external, disabled, className, children, onClick, buttonProps, ...rest }, ref) {
|
|
153
|
+
const LinkRow = /*#__PURE__*/ React.forwardRef(function LinkRow({ href, external, disabled, className, children, onClick, buttonProps, ...rest }, ref) {
|
|
153
154
|
const Link = useLink();
|
|
154
155
|
const { onNavigate } = useSidebarCtx();
|
|
155
156
|
if (disabled) {
|
|
@@ -356,7 +357,7 @@ export function SidebarNav({ items, badges, features, trail: trailProp, classNam
|
|
|
356
357
|
/* Collapse button, skeleton */
|
|
357
358
|
/* ------------------------------------------------------------------ */
|
|
358
359
|
/** Toggles the rail. `aria-pressed` is true while collapsed. */
|
|
359
|
-
export const SidebarCollapseButton = React.forwardRef(function SidebarCollapseButton({ className, onClick, ...props }, ref) {
|
|
360
|
+
export const SidebarCollapseButton = /*#__PURE__*/ React.forwardRef(function SidebarCollapseButton({ className, onClick, ...props }, ref) {
|
|
360
361
|
const { collapsed, setCollapsed, collapsible, mode, t } = useSidebarCtx();
|
|
361
362
|
const { dir } = useLocale();
|
|
362
363
|
if (!collapsible || mode === "mobile")
|
|
@@ -109,7 +109,7 @@ const signatureLabels = {
|
|
|
109
109
|
* <Field label="Customer signature" required><SignaturePad name="signature" exportPng /></Field>
|
|
110
110
|
* ```
|
|
111
111
|
*/
|
|
112
|
-
export const SignaturePad = React.forwardRef(function SignaturePad(props, ref) {
|
|
112
|
+
export const SignaturePad = /*#__PURE__*/ React.forwardRef(function SignaturePad(props, ref) {
|
|
113
113
|
const { value, defaultValue, onValueChange, modes = ["draw", "type"], height = 176, penColor = "fg", exportPng = false, name, disabled: disabledProp, readOnly: readOnlyProp, invalid: invalidProp, required: requiredProp, labels, className, id, "aria-describedby": describedBy, ...rest } = props;
|
|
114
114
|
const field = useFieldContext();
|
|
115
115
|
const disabled = disabledProp ?? field?.disabled ?? false;
|
|
@@ -3,7 +3,7 @@ import * as React from "react";
|
|
|
3
3
|
import { cva } from "class-variance-authority";
|
|
4
4
|
import { cn } from "../lib/cn.js";
|
|
5
5
|
import { LocalizedText } from "../lib/islands.js";
|
|
6
|
-
export const skeletonVariants = cva("block bg-skeleton", {
|
|
6
|
+
export const skeletonVariants = /*#__PURE__*/ cva("block bg-skeleton", {
|
|
7
7
|
variants: {
|
|
8
8
|
shape: {
|
|
9
9
|
rect: "rounded-ui-sm",
|
|
@@ -22,11 +22,11 @@ export const skeletonVariants = cva("block bg-skeleton", {
|
|
|
22
22
|
*
|
|
23
23
|
* The shimmer runs in the reading direction (RTL-aware) and stops under `prefers-reduced-motion`.
|
|
24
24
|
*/
|
|
25
|
-
export const Skeleton = React.forwardRef(function Skeleton({ className, shape, shimmer, ...props }, ref) {
|
|
25
|
+
export const Skeleton = /*#__PURE__*/ React.forwardRef(function Skeleton({ className, shape, shimmer, ...props }, ref) {
|
|
26
26
|
return _jsx("div", { ref: ref, "aria-hidden": true, "data-slot": "skeleton", className: cn(skeletonVariants({ shape, shimmer }), className), ...props });
|
|
27
27
|
});
|
|
28
28
|
/** Paragraph placeholder: full-width lines with a shorter last line. */
|
|
29
|
-
export const SkeletonText = React.forwardRef(function SkeletonText({ lines = 3, lastLineWidth = "62%", shimmer, lineClassName, className, ...props }, ref) {
|
|
29
|
+
export const SkeletonText = /*#__PURE__*/ React.forwardRef(function SkeletonText({ lines = 3, lastLineWidth = "62%", shimmer, lineClassName, className, ...props }, ref) {
|
|
30
30
|
return (_jsx("div", { ref: ref, "aria-hidden": true, "data-slot": "skeleton-text", className: cn("grid gap-2.5 text-sm", className), ...props, children: Array.from({ length: lines }, (_, i) => (_jsx(Skeleton, { shape: "text", shimmer: shimmer, className: lineClassName, style: i === lines - 1 && lines > 1 ? { width: lastLineWidth } : undefined }, i))) }));
|
|
31
31
|
});
|
|
32
32
|
const AVATAR = { xs: "size-5", sm: "size-6", md: "size-8", lg: "size-10", xl: "size-14" };
|
|
@@ -36,7 +36,7 @@ export function SkeletonAvatar({ size = "md", shape = "circle", className, ...pr
|
|
|
36
36
|
}
|
|
37
37
|
const COLUMN_WIDTHS = ["72%", "48%", "60%", "36%", "54%", "40%"];
|
|
38
38
|
/** A table/list row placeholder; height follows `--row-h`, padding `--cell-px`. */
|
|
39
|
-
export const SkeletonRow = React.forwardRef(function SkeletonRow({ columns = 4, avatar, shimmer, className, ...props }, ref) {
|
|
39
|
+
export const SkeletonRow = /*#__PURE__*/ React.forwardRef(function SkeletonRow({ columns = 4, avatar, shimmer, className, ...props }, ref) {
|
|
40
40
|
return (_jsx("div", { ref: ref, "aria-hidden": true, "data-slot": "skeleton-row", className: cn("grid h-(--row-h) items-center gap-4 border-b border-line px-(--cell-px) text-sm last:border-b-0", className), style: { gridTemplateColumns: `minmax(0,2fr) repeat(${Math.max(columns - 1, 0)}, minmax(0,1fr))` }, ...props, children: Array.from({ length: columns }, (_, i) => i === 0 && avatar ? (_jsxs("div", { className: "flex min-w-0 items-center gap-3", children: [_jsx(SkeletonAvatar, { size: "md", shimmer: shimmer }), _jsxs("div", { className: "grid min-w-0 flex-1 gap-1.5", children: [_jsx(Skeleton, { shape: "text", shimmer: shimmer, style: { width: "70%" } }), _jsx(Skeleton, { shape: "text", shimmer: shimmer, className: "h-[0.65em]", style: { width: "45%" } })] })] }, i)) : (_jsx(Skeleton, { shape: "text", shimmer: shimmer, style: { width: COLUMN_WIDTHS[i % COLUMN_WIDTHS.length] } }, i))) }));
|
|
41
41
|
});
|
|
42
42
|
const skeletonLabels = { loading: "Loading…" };
|
|
@@ -48,6 +48,6 @@ const skeletonLabels = { loading: "Loading…" };
|
|
|
48
48
|
* <SkeletonGroup loading={isLoading}>{isLoading ? <SkeletonText /> : <Article />}</SkeletonGroup>
|
|
49
49
|
* ```
|
|
50
50
|
*/
|
|
51
|
-
export const SkeletonGroup = React.forwardRef(function SkeletonGroup({ label, loading = true, children, ...props }, ref) {
|
|
51
|
+
export const SkeletonGroup = /*#__PURE__*/ React.forwardRef(function SkeletonGroup({ label, loading = true, children, ...props }, ref) {
|
|
52
52
|
return (_jsxs("div", { ref: ref, "data-slot": "skeleton-group", "aria-busy": loading || undefined, ...props, children: [loading ? (_jsx("span", { role: "status", className: "sr-only", children: label ?? _jsx(LocalizedText, { namespace: "skeleton", id: "loading", defaults: skeletonLabels }) })) : null, children] }));
|
|
53
53
|
});
|
|
@@ -40,7 +40,7 @@ export function slaState({ due, start, completedAt, pausedAt, now, warnAt = 0.25
|
|
|
40
40
|
const threshold = warnMinutes != null ? warnMinutes * 60_000 : startMs != null ? (dueMs - startMs) * warnAt : 30 * 60_000;
|
|
41
41
|
return { state: remaining <= threshold ? "at-risk" : "on-track", remaining, used };
|
|
42
42
|
}
|
|
43
|
-
const slaTimerVariants = cva("inline-flex items-center gap-1.5 whitespace-nowrap font-medium tabular", {
|
|
43
|
+
const slaTimerVariants = /*#__PURE__*/ cva("inline-flex items-center gap-1.5 whitespace-nowrap font-medium tabular", {
|
|
44
44
|
variants: {
|
|
45
45
|
variant: {
|
|
46
46
|
/** Tinted pill — list rows, inbox items. */
|
|
@@ -117,7 +117,7 @@ function useNow(fixed, remaining, live) {
|
|
|
117
117
|
* <SlaTimer variant="bar" label="Resolution" start={t.createdAt} due={t.resolveDue} completedAt={t.solvedAt} />
|
|
118
118
|
* ```
|
|
119
119
|
*/
|
|
120
|
-
export const SlaTimer = React.forwardRef(function SlaTimer({ due, start, completedAt, pausedAt, now: fixedNow, warnAt, warnMinutes, variant = "badge", label, seconds = true, hideIcon, labels, className, ...props }, ref) {
|
|
120
|
+
export const SlaTimer = /*#__PURE__*/ React.forwardRef(function SlaTimer({ due, start, completedAt, pausedAt, now: fixedNow, warnAt, warnMinutes, variant = "badge", label, seconds = true, hideIcon, labels, className, ...props }, ref) {
|
|
121
121
|
const t = useLabels("slaTimer", slaTimerLabels, labels);
|
|
122
122
|
const f = useFormat();
|
|
123
123
|
const frozen = completedAt != null || pausedAt != null;
|
|
@@ -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 SliderPrimitive from "radix-ui/slider";
|
|
5
5
|
import { cn } from "../lib/cn.js";
|
|
6
6
|
import { mergeIds } from "../lib/compose-refs.js";
|
|
7
7
|
import { FieldContextReset, useFieldContext } from "../lib/field-context.js";
|
|
@@ -36,7 +36,7 @@ const snap = (n, min, step) => {
|
|
|
36
36
|
* <Slider defaultValue={[60]} marks={[0, 25, 50, 75, 100]} aria-label="Deal probability" />
|
|
37
37
|
* ```
|
|
38
38
|
*/
|
|
39
|
-
export const Slider = React.forwardRef(function Slider({ value: valueProp, defaultValue, onValueChange, onValueCommit, min = 0, max = 100, step = 1, marks, formatValue, formatOptions, showValue = "hover", withInputs, size = "md", thumbLabels, name, names, invalid, readOnly, required, disabled, labels, id, className, orientation = "horizontal", "aria-label": ariaLabel, "aria-labelledby": labelledBy, "aria-describedby": describedBy, ...props }, ref) {
|
|
39
|
+
export const Slider = /*#__PURE__*/ React.forwardRef(function Slider({ value: valueProp, defaultValue, onValueChange, onValueCommit, min = 0, max = 100, step = 1, marks, formatValue, formatOptions, showValue = "hover", withInputs, size = "md", thumbLabels, name, names, invalid, readOnly, required, disabled, labels, id, className, orientation = "horizontal", "aria-label": ariaLabel, "aria-labelledby": labelledBy, "aria-describedby": describedBy, ...props }, ref) {
|
|
40
40
|
const field = useFieldContext();
|
|
41
41
|
const t = useLabels("slider", sliderLabels, labels);
|
|
42
42
|
const f = useFormat();
|
|
@@ -39,7 +39,7 @@ const slugLabels = {
|
|
|
39
39
|
* <SlugInput variant="permalink" source={title} prefix="https://vamos.ist/blog/" />
|
|
40
40
|
* ```
|
|
41
41
|
*/
|
|
42
|
-
export const SlugInput = React.forwardRef(function SlugInput(props, forwardedRef) {
|
|
42
|
+
export const SlugInput = /*#__PURE__*/ React.forwardRef(function SlugInput(props, forwardedRef) {
|
|
43
43
|
const { value, defaultValue, onValueChange, source, locked: lockedProp, defaultLocked, onLockedChange, prefix, maxLength = 80, locale: localeProp, validate, suggestUnique, validateDelay = 350, variant = "field", href, size, name, id, disabled, invalid, placeholder, labels, className, "aria-label": ariaLabel, "aria-describedby": describedByProp, ...rest } = props;
|
|
44
44
|
const { locale: providerLocale } = useLocale();
|
|
45
45
|
const locale = localeProp ?? providerLocale;
|
|
@@ -14,7 +14,7 @@ const SIZES = { xs: [64, 20], sm: [96, 32], md: [160, 40] };
|
|
|
14
14
|
* <Sparkline values={weekly} variant="bars" size="xs" domain={[0, 120]} label={sparklineSummary(weekly)} />
|
|
15
15
|
* ```
|
|
16
16
|
*/
|
|
17
|
-
export const Sparkline = React.forwardRef(function Sparkline({ values, variant = "line", size = "sm", width, height, color, strokeWidth = 1.6, showLast, showMinMax, reference, domain, label, className, style, ...props }, ref) {
|
|
17
|
+
export const Sparkline = /*#__PURE__*/ React.forwardRef(function Sparkline({ values, variant = "line", size = "sm", width, height, color, strokeWidth = 1.6, showLast, showMinMax, reference, domain, label, className, style, ...props }, ref) {
|
|
18
18
|
const gradientId = `spark-${React.useId().replace(/:/g, "")}`;
|
|
19
19
|
const fluid = width === "100%";
|
|
20
20
|
const w = typeof width === "number" ? width : SIZES[size][0];
|
|
@@ -4,7 +4,7 @@ import { cva } from "class-variance-authority";
|
|
|
4
4
|
import { cn } from "../lib/cn.js";
|
|
5
5
|
const SIZES = { xs: 12, sm: 16, md: 20, lg: 28 };
|
|
6
6
|
const STROKE = { xs: 3, sm: 2.75, md: 2.5, lg: 2.25 };
|
|
7
|
-
export const spinnerVariants = cva("ui-spinner inline-block shrink-0 align-middle", {
|
|
7
|
+
export const spinnerVariants = /*#__PURE__*/ cva("ui-spinner inline-block shrink-0 align-middle", {
|
|
8
8
|
variants: {
|
|
9
9
|
tone: {
|
|
10
10
|
/** Inherits the text colour — the default inside buttons. */
|
|
@@ -24,7 +24,7 @@ export const spinnerVariants = cva("ui-spinner inline-block shrink-0 align-middl
|
|
|
24
24
|
* <Button loading>Save</Button> // uses a decorative Spinner
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
|
-
export const Spinner = React.forwardRef(function Spinner({ size = "sm", tone, label, delay, className, style, ...props }, ref) {
|
|
27
|
+
export const Spinner = /*#__PURE__*/ React.forwardRef(function Spinner({ size = "sm", tone, label, delay, className, style, ...props }, ref) {
|
|
28
28
|
const px = typeof size === "number" ? size : SIZES[size];
|
|
29
29
|
const stroke = typeof size === "number" ? (size <= 14 ? 3 : size >= 26 ? 2.25 : 2.5) : STROKE[size];
|
|
30
30
|
const svg = (_jsxs("svg", { ref: ref, "data-slot": "spinner", viewBox: "0 0 24 24", width: px, height: px, fill: "none", "aria-hidden": true, focusable: "false", className: cn(spinnerVariants({ tone }), delay ? "ui-spinner-delayed" : undefined, className), style: delay ? { ...style, "--spinner-delay": `${delay}ms` } : style, ...props, children: [_jsx("circle", { cx: "12", cy: "12", r: "9.25", stroke: "currentColor", strokeOpacity: 0.18, strokeWidth: stroke }), _jsx("circle", { className: "ui-spinner-arc", cx: "12", cy: "12", r: "9.25", stroke: "currentColor", strokeWidth: stroke, strokeLinecap: "round", transform: "rotate(-90 12 12)" })] }));
|
package/dist/components/stat.js
CHANGED
|
@@ -10,7 +10,7 @@ import { Sparkline, sparklineDirection } from "./sparkline.js";
|
|
|
10
10
|
/* ------------------------------------------------------------------ */
|
|
11
11
|
/* Delta */
|
|
12
12
|
/* ------------------------------------------------------------------ */
|
|
13
|
-
const deltaVariants = cva("inline-flex shrink-0 items-center gap-0.5 whitespace-nowrap font-medium leading-none [&_svg]:shrink-0", {
|
|
13
|
+
const deltaVariants = /*#__PURE__*/ cva("inline-flex shrink-0 items-center gap-0.5 whitespace-nowrap font-medium leading-none [&_svg]:shrink-0", {
|
|
14
14
|
variants: {
|
|
15
15
|
variant: {
|
|
16
16
|
text: "text-xs [&_svg]:size-3.5",
|
|
@@ -34,7 +34,7 @@ const deltaVariants = cva("inline-flex shrink-0 items-center gap-0.5 whitespace-
|
|
|
34
34
|
* <Delta value={1250} kind="currency" variant="badge" />
|
|
35
35
|
* ```
|
|
36
36
|
*/
|
|
37
|
-
export const Delta = React.forwardRef(function Delta({ value, kind = "percent", currency, intent = "higher-is-better", variant, precision, srLabel, comparison, labels, className, ...props }, ref) {
|
|
37
|
+
export const Delta = /*#__PURE__*/ React.forwardRef(function Delta({ value, kind = "percent", currency, intent = "higher-is-better", variant, precision, srLabel, comparison, labels, className, ...props }, ref) {
|
|
38
38
|
const has = typeof value === "number" && Number.isFinite(value);
|
|
39
39
|
const dir = has ? Math.sign(value) : 0;
|
|
40
40
|
const good = intent === "neutral" || dir === 0 ? 0 : intent === "higher-is-better" ? dir : -dir;
|
|
@@ -45,7 +45,7 @@ export const Delta = React.forwardRef(function Delta({ value, kind = "percent",
|
|
|
45
45
|
/* ------------------------------------------------------------------ */
|
|
46
46
|
/* Stat parts */
|
|
47
47
|
/* ------------------------------------------------------------------ */
|
|
48
|
-
const statVariants = cva("group/stat relative grid min-w-0 grid-cols-[minmax(0,1fr)_auto] content-start items-start gap-x-3 [grid-template-areas:'label_delta'_'value_trend'_'target_target'_'foot_foot']" +
|
|
48
|
+
const statVariants = /*#__PURE__*/ cva("group/stat relative grid min-w-0 grid-cols-[minmax(0,1fr)_auto] content-start items-start gap-x-3 [grid-template-areas:'label_delta'_'value_trend'_'target_target'_'foot_foot']" +
|
|
49
49
|
// without a sparkline the value may use the full width (a wide delta must not squeeze "$3,815,400.00")
|
|
50
50
|
" [&:not(:has([data-slot=stat-trend]))_[data-slot=stat-value]]:[grid-column:1/-1]", {
|
|
51
51
|
variants: {
|
|
@@ -74,7 +74,7 @@ const statVariants = cva("group/stat relative grid min-w-0 grid-cols-[minmax(0,1
|
|
|
74
74
|
*
|
|
75
75
|
* Compose for custom layouts: `<Stat><StatLabel/><StatValue/><StatDelta/><StatTrend/><StatFooter/></Stat>`.
|
|
76
76
|
*/
|
|
77
|
-
export const Stat = React.forwardRef(function Stat({ label, value, format, delta, deltaKind = "percent", deltaVariant, intent = "higher-is-better", comparison, trend, trendVariant = "line", target, icon: Icon, href, loading, error, errorAction, variant = "card", size = "md", labels, className, children, ...props }, ref) {
|
|
77
|
+
export const Stat = /*#__PURE__*/ React.forwardRef(function Stat({ label, value, format, delta, deltaKind = "percent", deltaVariant, intent = "higher-is-better", comparison, trend, trendVariant = "line", target, icon: Icon, href, loading, error, errorAction, variant = "card", size = "md", labels, className, children, ...props }, ref) {
|
|
78
78
|
const trendId = React.useId();
|
|
79
79
|
const dir = trend ? sparklineDirection(trend) : 0;
|
|
80
80
|
const good = intent === "neutral" || dir === 0 ? 0 : intent === "higher-is-better" ? dir : -dir;
|
|
@@ -125,6 +125,6 @@ const columnClasses = {
|
|
|
125
125
|
* A responsive row of Stats. Columns follow the container width, not the viewport, so the same
|
|
126
126
|
* row works in a page, a sheet or a dashboard widget.
|
|
127
127
|
*/
|
|
128
|
-
export const StatGroup = React.forwardRef(function StatGroup({ columns = 4, variant = "cards", className, children, ...props }, ref) {
|
|
128
|
+
export const StatGroup = /*#__PURE__*/ React.forwardRef(function StatGroup({ columns = 4, variant = "cards", className, children, ...props }, ref) {
|
|
129
129
|
return (_jsx("div", { ref: ref, "data-slot": "stat-group", className: cn("@container", className), ...props, children: _jsx("div", { className: cn("grid grid-cols-1", columnClasses[columns], variant === "cards" ? "gap-(--gap)" : "surface overflow-hidden rounded-ui-lg [&>*]:shadow-[-1px_-1px_0_0_var(--line)]"), children: children }) }));
|
|
130
130
|
});
|
|
@@ -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 SelectPrimitive from "radix-ui/select";
|
|
5
5
|
import { Check, ChevronDown } from "lucide-react";
|
|
6
6
|
import { cn } from "../lib/cn.js";
|
|
7
7
|
import { useFieldControl } from "../lib/field-context.js";
|
|
@@ -83,7 +83,7 @@ export function StatusBadge({ status, size = "md", className }) {
|
|
|
83
83
|
* confirm={(s) => s.value === "rejected" && { title: "Reject request?", requireNote: true, tone: "danger" }} />
|
|
84
84
|
* ```
|
|
85
85
|
*/
|
|
86
|
-
export const StatusPicker = React.forwardRef(function StatusPicker({ statuses, value: valueProp, defaultValue, onValueChange, transitions, confirm, onError, trigger = "badge", groupByCategory, name, size = "md", disabled: disabledProp, readOnly: readOnlyProp, loading, fieldLabel, labels, className, ...rest }, ref) {
|
|
86
|
+
export const StatusPicker = /*#__PURE__*/ React.forwardRef(function StatusPicker({ statuses, value: valueProp, defaultValue, onValueChange, transitions, confirm, onError, trigger = "badge", groupByCategory, name, size = "md", disabled: disabledProp, readOnly: readOnlyProp, loading, fieldLabel, labels, className, ...rest }, ref) {
|
|
87
87
|
const t = useLabels("statusPicker", statusPickerLabels, labels);
|
|
88
88
|
const control = useFieldControl({
|
|
89
89
|
id: rest.id,
|
|
@@ -41,7 +41,7 @@ export function StepIndicator({ status, number, icon, loading, size = "md", clas
|
|
|
41
41
|
* An ordered list; the current step has `aria-current="step"` and every step's name includes its
|
|
42
42
|
* position and status ("Step 2 of 4, Map columns, current").
|
|
43
43
|
*/
|
|
44
|
-
export const Stepper = React.forwardRef(function Stepper({ value, onValueChange, navigable = "completed", orientation = "horizontal", variant = "numbered", size = "md", steps: stepsProp, loading, responsive = true, labels, className, children, "aria-label": ariaLabel, ...props }, ref) {
|
|
44
|
+
export const Stepper = /*#__PURE__*/ React.forwardRef(function Stepper({ value, onValueChange, navigable = "completed", orientation = "horizontal", variant = "numbered", size = "md", steps: stepsProp, loading, responsive = true, labels, className, children, "aria-label": ariaLabel, ...props }, ref) {
|
|
45
45
|
const t = useLabels("stepper", stepperLabels, labels);
|
|
46
46
|
const raw = stepsProp ??
|
|
47
47
|
React.Children.toArray(children)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import
|
|
2
|
+
import * as SwitchPrimitive from "radix-ui/switch";
|
|
3
3
|
export declare const switchVariants: (props?: ({
|
|
4
4
|
size?: "sm" | "md" | null | undefined;
|
|
5
5
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -1,14 +1,14 @@
|
|
|
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 SwitchPrimitive from "radix-ui/switch";
|
|
5
5
|
import { cva } from "class-variance-authority";
|
|
6
6
|
import { cn } from "../lib/cn.js";
|
|
7
7
|
import { mergeIds } from "../lib/compose-refs.js";
|
|
8
8
|
import { useFieldControl } from "../lib/field-context.js";
|
|
9
9
|
import { useControllableState } from "../lib/use-controllable-state.js";
|
|
10
10
|
import { Spinner } from "./spinner.js";
|
|
11
|
-
export const switchVariants = cva([
|
|
11
|
+
export const switchVariants = /*#__PURE__*/ cva([
|
|
12
12
|
"group/switch relative inline-flex shrink-0 cursor-pointer items-center rounded-full border border-transparent p-[2px] outline-none",
|
|
13
13
|
"bg-track transition-[background-color,box-shadow] duration-200",
|
|
14
14
|
"data-[state=unchecked]:hover:bg-[color-mix(in_srgb,var(--track),var(--fg)_9%)]",
|
|
@@ -36,7 +36,7 @@ export const switchVariants = cva([
|
|
|
36
36
|
* <Switch size="sm" checked={active} onCheckedChange={save} loading={saving} aria-label="Active" />
|
|
37
37
|
* ```
|
|
38
38
|
*/
|
|
39
|
-
export const Switch = React.forwardRef(function Switch(rawProps, ref) {
|
|
39
|
+
export const Switch = /*#__PURE__*/ React.forwardRef(function Switch(rawProps, ref) {
|
|
40
40
|
const { checked: checkedProp, defaultChecked, onCheckedChange, label, description, labelPosition = "end", size = "md", loading, invalid, className, controlClassName, style, ...rest } = rawProps;
|
|
41
41
|
const control = useFieldControl({ ...rest, "aria-invalid": invalid ? true : rest["aria-invalid"] });
|
|
42
42
|
const { readOnly, required, ...controlProps } = control;
|
package/dist/components/table.js
CHANGED
|
@@ -9,7 +9,7 @@ const alignClass = { start: "text-start", center: "text-center", end: "text-end"
|
|
|
9
9
|
* Scroll wrapper for a Table: horizontal (and optional vertical) scrolling with soft edge fades
|
|
10
10
|
* that show there is more content. It is a focusable, named region so keyboard users can scroll.
|
|
11
11
|
*/
|
|
12
|
-
export const TableContainer = React.forwardRef(function TableContainer({ className, maxHeight, style, ...props }, ref) {
|
|
12
|
+
export const TableContainer = /*#__PURE__*/ React.forwardRef(function TableContainer({ className, maxHeight, style, ...props }, ref) {
|
|
13
13
|
return (_jsx("div", { ref: ref, role: "region", tabIndex: 0, "data-slot": "table-container", className: cn("ui-table-scroll relative w-full overflow-auto overscroll-x-contain rounded-[inherit] focus-ring", className), style: maxHeight ? { maxHeight, ...style } : style, ...props }));
|
|
14
14
|
});
|
|
15
15
|
/**
|
|
@@ -26,7 +26,7 @@ export const TableContainer = React.forwardRef(function TableContainer({ classNa
|
|
|
26
26
|
* </TableContainer>
|
|
27
27
|
* ```
|
|
28
28
|
*/
|
|
29
|
-
export const Table = React.forwardRef(function Table({ className, density = "inherit", striped, hover = true, bordered = "rows", stickyHeader, stickyFirstColumn, layout = "auto", children, ...props }, ref) {
|
|
29
|
+
export const Table = /*#__PURE__*/ React.forwardRef(function Table({ className, density = "inherit", striped, hover = true, bordered = "rows", stickyHeader, stickyFirstColumn, layout = "auto", children, ...props }, ref) {
|
|
30
30
|
if (process.env.NODE_ENV !== "production" && !props["aria-label"] && !props["aria-labelledby"]) {
|
|
31
31
|
const hasCaption = React.Children.toArray(children).some((c) => React.isValidElement(c) && c.type === TableCaption);
|
|
32
32
|
if (!hasCaption)
|
|
@@ -35,38 +35,38 @@ export const Table = React.forwardRef(function Table({ className, density = "inh
|
|
|
35
35
|
return (_jsx("table", { ref: ref, "data-slot": "table", "data-density": density === "inherit" ? undefined : density, "data-striped": striped ? "" : undefined, "data-hover": hover ? "" : undefined, "data-bordered": bordered, "data-sticky-header": stickyHeader ? "" : undefined, "data-sticky-column": stickyFirstColumn ? "" : undefined, className: cn("ui-table w-full caption-bottom border-separate border-spacing-0 text-[13px] text-fg", layout === "fixed" && "table-fixed", className), ...props, children: children }));
|
|
36
36
|
});
|
|
37
37
|
/** Names the table. Visible under the table by default; `visuallyHidden` keeps it for screen readers. */
|
|
38
|
-
export const TableCaption = React.forwardRef(function TableCaption({ className, visuallyHidden, side = "bottom", ...props }, ref) {
|
|
38
|
+
export const TableCaption = /*#__PURE__*/ React.forwardRef(function TableCaption({ className, visuallyHidden, side = "bottom", ...props }, ref) {
|
|
39
39
|
return (_jsx("caption", { ref: ref, "data-slot": "table-caption", className: cn(visuallyHidden ? "sr-only" : "px-(--cell-px) py-3 text-start text-xs text-fg-subtle", side === "top" && "caption-top pt-0", className), ...props }));
|
|
40
40
|
});
|
|
41
|
-
export const TableHeader = React.forwardRef(function TableHeader({ className, ...props }, ref) {
|
|
41
|
+
export const TableHeader = /*#__PURE__*/ React.forwardRef(function TableHeader({ className, ...props }, ref) {
|
|
42
42
|
return _jsx("thead", { ref: ref, "data-slot": "table-header", className: className, ...props });
|
|
43
43
|
});
|
|
44
|
-
export const TableBody = React.forwardRef(function TableBody({ className, ...props }, ref) {
|
|
44
|
+
export const TableBody = /*#__PURE__*/ React.forwardRef(function TableBody({ className, ...props }, ref) {
|
|
45
45
|
return _jsx("tbody", { ref: ref, "data-slot": "table-body", className: className, ...props });
|
|
46
46
|
});
|
|
47
|
-
export const TableFooter = React.forwardRef(function TableFooter({ className, ...props }, ref) {
|
|
47
|
+
export const TableFooter = /*#__PURE__*/ React.forwardRef(function TableFooter({ className, ...props }, ref) {
|
|
48
48
|
return _jsx("tfoot", { ref: ref, "data-slot": "table-footer", className: cn("font-medium", className), ...props });
|
|
49
49
|
});
|
|
50
|
-
export const TableRow = React.forwardRef(function TableRow({ className, selected, disabled, highlighted, ...props }, ref) {
|
|
50
|
+
export const TableRow = /*#__PURE__*/ React.forwardRef(function TableRow({ className, selected, disabled, highlighted, ...props }, ref) {
|
|
51
51
|
return (_jsx("tr", { ref: ref, "data-slot": "table-row", "data-state": selected ? "selected" : undefined, "data-disabled": disabled ? "" : undefined, "data-highlighted": highlighted ? "" : undefined, "aria-selected": selected === undefined ? undefined : selected, "aria-disabled": disabled || undefined, className: className, ...props }));
|
|
52
52
|
});
|
|
53
53
|
/**
|
|
54
54
|
* Column header (`<th scope="col">`). With `onSort` the label becomes a button and the cell
|
|
55
55
|
* gets `aria-sort`.
|
|
56
56
|
*/
|
|
57
|
-
export const TableHead = React.forwardRef(function TableHead({ className, align, numeric, sort, onSort, scope = "col", children, ...props }, ref) {
|
|
57
|
+
export const TableHead = /*#__PURE__*/ React.forwardRef(function TableHead({ className, align, numeric, sort, onSort, scope = "col", children, ...props }, ref) {
|
|
58
58
|
const a = align ?? (numeric ? "end" : "start");
|
|
59
59
|
const sortable = sort !== undefined || onSort !== undefined;
|
|
60
60
|
const SortIcon = sort === "asc" ? ArrowUp : sort === "desc" ? ArrowDown : ChevronsUpDown;
|
|
61
61
|
return (_jsx("th", { ref: ref, scope: scope, "data-slot": "table-head", "data-numeric": numeric ? "" : undefined, "aria-sort": sortable ? (sort === "asc" ? "ascending" : sort === "desc" ? "descending" : "none") : undefined, className: cn("h-[calc(var(--row-h)*0.78)] px-(--cell-px) align-middle text-xs font-medium whitespace-nowrap text-fg-muted", alignClass[a], className), ...props, children: sortable ? (_jsxs("button", { type: "button", onClick: onSort, "data-sorted": sort ? "" : undefined, className: cn("-mx-1.5 inline-flex items-center gap-1 rounded-ui-sm px-1.5 py-1 font-medium transition-colors hover:bg-hover hover:text-fg focus-ring data-sorted:text-fg", a === "end" && "flex-row-reverse"), children: [children, _jsx(SortIcon, { "aria-hidden": true, className: cn("size-3.5 shrink-0", sort ? "text-fg" : "text-fg-subtle") })] })) : (children) }));
|
|
62
62
|
});
|
|
63
|
-
export const TableCell = React.forwardRef(function TableCell({ className, align, numeric, truncate, rowHeader, children, ...props }, ref) {
|
|
63
|
+
export const TableCell = /*#__PURE__*/ React.forwardRef(function TableCell({ className, align, numeric, truncate, rowHeader, children, ...props }, ref) {
|
|
64
64
|
const a = align ?? (numeric ? "end" : "start");
|
|
65
65
|
const Comp = rowHeader ? "th" : "td";
|
|
66
66
|
const clamp = typeof truncate === "number" && truncate > 1;
|
|
67
67
|
return (_jsx(Comp, { ref: ref, ...(rowHeader ? { scope: "row" } : {}), "data-slot": "table-cell", "data-numeric": numeric ? "" : undefined, className: cn("h-(--row-h) px-(--cell-px) py-2 align-middle", alignClass[a], numeric && "font-mono text-[12.5px] whitespace-nowrap tabular", rowHeader && "font-medium", truncate === true || truncate === 1 ? "max-w-0 truncate" : null, className), ...props, children: clamp ? (_jsx("span", { className: "line-clamp-(--lines)", style: { ["--lines"]: truncate }, children: children })) : (children) }));
|
|
68
68
|
});
|
|
69
69
|
/** A single full-width row for an empty table body. */
|
|
70
|
-
export const TableEmpty = React.forwardRef(function TableEmpty({ colSpan, icon, title, description, className, children, ...props }, ref) {
|
|
70
|
+
export const TableEmpty = /*#__PURE__*/ React.forwardRef(function TableEmpty({ colSpan, icon, title, description, className, children, ...props }, ref) {
|
|
71
71
|
return (_jsx("tr", { ref: ref, "data-slot": "table-empty", className: className, ...props, children: _jsx("td", { colSpan: colSpan, className: "px-(--cell-px) py-8", children: _jsx(EmptyState, { kind: "no-results", size: "sm", icon: icon, title: title ?? _jsx(DataLabel, { ns: "table", id: "empty" }), description: description, actions: children }) }) }));
|
|
72
72
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import
|
|
2
|
+
import * as RadixTabs from "radix-ui/tabs";
|
|
3
3
|
import { type VariantProps } from "class-variance-authority";
|
|
4
4
|
import { type BadgeProps } from "./badge.js";
|
|
5
5
|
export declare const tabsListVariants: (props?: ({
|
package/dist/components/tabs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
import
|
|
4
|
+
import * as RadixTabs from "radix-ui/tabs";
|
|
5
5
|
import { cva } from "class-variance-authority";
|
|
6
6
|
import { cn } from "../lib/cn.js";
|
|
7
7
|
import { useControllableState } from "../lib/use-controllable-state.js";
|
|
@@ -12,7 +12,7 @@ import { Badge } from "./badge.js";
|
|
|
12
12
|
/* ------------------------------------------------------------------ */
|
|
13
13
|
/* Variants (shared by Radix tabs and link tabs) */
|
|
14
14
|
/* ------------------------------------------------------------------ */
|
|
15
|
-
export const tabsListVariants = cva("relative flex min-w-max", {
|
|
15
|
+
export const tabsListVariants = /*#__PURE__*/ cva("relative flex min-w-max", {
|
|
16
16
|
variants: {
|
|
17
17
|
variant: {
|
|
18
18
|
/** Pages and records: hairline rule with an accent underline on the selected tab. */
|
|
@@ -26,7 +26,7 @@ export const tabsListVariants = cva("relative flex min-w-max", {
|
|
|
26
26
|
},
|
|
27
27
|
defaultVariants: { variant: "underline" },
|
|
28
28
|
});
|
|
29
|
-
export const tabsTriggerVariants = cva([
|
|
29
|
+
export const tabsTriggerVariants = /*#__PURE__*/ cva([
|
|
30
30
|
"group/tab relative inline-flex shrink-0 select-none items-center gap-2 whitespace-nowrap font-medium text-fg-muted outline-none",
|
|
31
31
|
"transition-[color,background-color,box-shadow] duration-150 focus-ring",
|
|
32
32
|
"hover:text-fg data-selected:text-fg",
|
|
@@ -60,8 +60,8 @@ export const tabsTriggerVariants = cva([
|
|
|
60
60
|
],
|
|
61
61
|
defaultVariants: { variant: "underline", size: "md" },
|
|
62
62
|
});
|
|
63
|
-
const TabsContext = React.createContext({ value: "", orientation: "horizontal" });
|
|
64
|
-
const TabsListContext = React.createContext({ variant: "underline", size: "md" });
|
|
63
|
+
const TabsContext = /*#__PURE__*/ React.createContext({ value: "", orientation: "horizontal" });
|
|
64
|
+
const TabsListContext = /*#__PURE__*/ React.createContext({ variant: "underline", size: "md" });
|
|
65
65
|
/**
|
|
66
66
|
* Switches between views of the same context (WAI-ARIA Tabs: arrows, Home/End).
|
|
67
67
|
* Inactive panels unmount by default; pass `forceMount` on a `TabsContent` to keep it.
|
|
@@ -79,13 +79,13 @@ const TabsListContext = React.createContext({ variant: "underline", size: "md" }
|
|
|
79
79
|
* `activationMode="manual"` for heavy panels (focus moves with arrows, Enter/Space selects).
|
|
80
80
|
* For route-based tabs use `TabsLinkList` — that is navigation, not the Tabs pattern.
|
|
81
81
|
*/
|
|
82
|
-
export const Tabs = React.forwardRef(function Tabs({ value: valueProp, defaultValue, onValueChange, orientation = "horizontal", className, ...props }, ref) {
|
|
82
|
+
export const Tabs = /*#__PURE__*/ React.forwardRef(function Tabs({ value: valueProp, defaultValue, onValueChange, orientation = "horizontal", className, ...props }, ref) {
|
|
83
83
|
const [value, setValue] = useControllableState({ value: valueProp, defaultValue: defaultValue ?? "", onChange: onValueChange, name: "Tabs" });
|
|
84
84
|
const ctx = React.useMemo(() => ({ value, orientation }), [value, orientation]);
|
|
85
85
|
return (_jsx(TabsContext.Provider, { value: ctx, children: _jsx(RadixTabs.Root, { ref: ref, "data-slot": "tabs", value: value, onValueChange: setValue, orientation: orientation, className: cn("flex flex-col gap-4 data-[orientation=vertical]:flex-row data-[orientation=vertical]:gap-6", className), ...props }) }));
|
|
86
86
|
});
|
|
87
87
|
/** The row (or column) of tab triggers. */
|
|
88
|
-
export const TabsList = React.forwardRef(function TabsList({ variant = "underline", size = "md", fill, overflow = "scroll", className, children, ...props }, ref) {
|
|
88
|
+
export const TabsList = /*#__PURE__*/ React.forwardRef(function TabsList({ variant = "underline", size = "md", fill, overflow = "scroll", className, children, ...props }, ref) {
|
|
89
89
|
const { value, orientation } = React.useContext(TabsContext);
|
|
90
90
|
const scrollRef = React.useRef(null);
|
|
91
91
|
const scrolls = overflow === "scroll" && orientation === "horizontal" && !fill;
|
|
@@ -109,7 +109,7 @@ export const TabsList = React.forwardRef(function TabsList({ variant = "underlin
|
|
|
109
109
|
return (_jsx(TabsListContext.Provider, { value: ctx, children: scrolls ? (_jsx("div", { ref: scrollRef, "data-slot": "tabs-scroller", "data-edge-fade": "x", className: "min-w-0 scrollbar-none overflow-x-auto overscroll-x-contain", children: list })) : (list) }));
|
|
110
110
|
});
|
|
111
111
|
/** One tab. `value` must match a `TabsContent`. */
|
|
112
|
-
export const TabsTrigger = React.forwardRef(function TabsTrigger({ value, icon, count, badgeTone, className, children, ...props }, ref) {
|
|
112
|
+
export const TabsTrigger = /*#__PURE__*/ React.forwardRef(function TabsTrigger({ value, icon, count, badgeTone, className, children, ...props }, ref) {
|
|
113
113
|
const { variant, size } = React.useContext(TabsListContext);
|
|
114
114
|
const selected = React.useContext(TabsContext).value === value;
|
|
115
115
|
// Tabs used as a filter (no TabsContent) would point aria-controls at a panel that never
|
|
@@ -134,7 +134,7 @@ function TabContent({ icon, count, badgeTone, children }) {
|
|
|
134
134
|
return (_jsxs(_Fragment, { children: [icon ? (_jsx("span", { "aria-hidden": true, className: "inline-flex text-fg-subtle transition-colors group-hover/tab:text-fg-muted group-data-selected/tab:text-current", children: icon })) : null, _jsx("span", { className: "truncate", children: children }), count !== undefined ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "sr-only", children: ", " }), _jsx(Badge, { count: count, tone: badgeTone ?? "neutral", className: "-me-0.5" })] })) : null] }));
|
|
135
135
|
}
|
|
136
136
|
/** The panel for one tab. Unmounted while inactive unless `forceMount`. */
|
|
137
|
-
export const TabsContent = React.forwardRef(function TabsContent({ className, ...props }, ref) {
|
|
137
|
+
export const TabsContent = /*#__PURE__*/ React.forwardRef(function TabsContent({ className, ...props }, ref) {
|
|
138
138
|
return _jsx(RadixTabs.Content, { ref: ref, "data-slot": "tabs-content", className: cn("min-w-0 flex-1 rounded-ui outline-none focus-ring", className), ...props });
|
|
139
139
|
});
|
|
140
140
|
/**
|
|
@@ -149,7 +149,7 @@ export const TabsContent = React.forwardRef(function TabsContent({ className, ..
|
|
|
149
149
|
* </TabsLinkList>
|
|
150
150
|
* ```
|
|
151
151
|
*/
|
|
152
|
-
export const TabsLinkList = React.forwardRef(function TabsLinkList({ variant = "underline", size = "md", fill, orientation = "horizontal", overflow = "scroll", className, children, ...props }, ref) {
|
|
152
|
+
export const TabsLinkList = /*#__PURE__*/ React.forwardRef(function TabsLinkList({ variant = "underline", size = "md", fill, orientation = "horizontal", overflow = "scroll", className, children, ...props }, ref) {
|
|
153
153
|
const scrollRef = React.useRef(null);
|
|
154
154
|
const composed = useComposedRefs(ref, scrollRef);
|
|
155
155
|
const scrolls = overflow === "scroll" && orientation === "horizontal" && !fill;
|
|
@@ -164,7 +164,7 @@ export const TabsLinkList = React.forwardRef(function TabsLinkList({ variant = "
|
|
|
164
164
|
return (_jsx(TabsListContext.Provider, { value: ctx, children: _jsx("nav", { ref: composed, "data-slot": "tabs-link-list", "data-edge-fade": scrolls ? "x" : undefined, className: cn(scrolls && "min-w-0 scrollbar-none overflow-x-auto overscroll-x-contain", className), ...props, children: _jsx("div", { "data-orientation": orientation, "data-variant": variant, className: tabsListVariants({ variant, fill }), children: React.Children.map(children, (child) => React.isValidElement(child) ? React.cloneElement(child, { "data-orientation": orientation }) : child) }) }) }));
|
|
165
165
|
});
|
|
166
166
|
/** One route tab. Renders the app's `Link`. */
|
|
167
|
-
export const TabsLink = React.forwardRef(function TabsLink({ href, active, exact, icon, count, badgeTone, disabled, className, children, ...props }, ref) {
|
|
167
|
+
export const TabsLink = /*#__PURE__*/ React.forwardRef(function TabsLink({ href, active, exact, icon, count, badgeTone, disabled, className, children, ...props }, ref) {
|
|
168
168
|
const Link = useLink();
|
|
169
169
|
const { isActive } = useNavigation();
|
|
170
170
|
const { variant, size } = React.useContext(TabsListContext);
|
|
@@ -40,7 +40,7 @@ const PASTE_SPLIT = /[,;\n\r\t]+/;
|
|
|
40
40
|
* <TagInput validate={(v) => /^\S+@\S+\.\S+$/.test(v) || "Not an email address"} />
|
|
41
41
|
* ```
|
|
42
42
|
*/
|
|
43
|
-
export const TagInput = React.forwardRef(function TagInput(props, forwardedRef) {
|
|
43
|
+
export const TagInput = /*#__PURE__*/ React.forwardRef(function TagInput(props, forwardedRef) {
|
|
44
44
|
const { value: valueProp, defaultValue, onValueChange, suggestions, allowCustom = true, delimiters = ["Enter", "Tab", ","], max, maxLength, validate, transform = defaultTransform, dedupe = "fold", tagTone, addOnBlur = false, name: nameProp, placeholder, size = "md", variant = "default", invalid, className, labels, } = props;
|
|
45
45
|
const t = useLabels("tagInput", tagInputLabels, labels);
|
|
46
46
|
const { locale } = useLocale();
|
|
@@ -55,7 +55,7 @@ function applyDone(items, overrides) {
|
|
|
55
55
|
* <TaskList variant="checklist" items={prePublish} onToggle={toggle} />
|
|
56
56
|
* ```
|
|
57
57
|
*/
|
|
58
|
-
export const TaskList = React.forwardRef(function TaskList({ items, onToggle, onAdd, onEdit, onRemove, onReorder, title, hideCompleted: hideProp, defaultHideCompleted = false, onHideCompletedChange, showProgress = true, sortCompleted, variant = "list", today, readOnly, labels, className, ...props }, ref) {
|
|
58
|
+
export const TaskList = /*#__PURE__*/ React.forwardRef(function TaskList({ items, onToggle, onAdd, onEdit, onRemove, onReorder, title, hideCompleted: hideProp, defaultHideCompleted = false, onHideCompletedChange, showProgress = true, sortCompleted, variant = "list", today, readOnly, labels, className, ...props }, ref) {
|
|
59
59
|
const t = useLabels("taskList", taskListLabels, labels);
|
|
60
60
|
const f = useFormat();
|
|
61
61
|
const { timeZone } = useLocale();
|
|
@@ -51,7 +51,7 @@ export function isTimeOutOfRange(value, opts) {
|
|
|
51
51
|
* <Field label="Start"><TimeInput value={time} onValueChange={setTime} /></Field>
|
|
52
52
|
* ```
|
|
53
53
|
*/
|
|
54
|
-
export const TimeInput = React.forwardRef(function TimeInput(rawProps, ref) {
|
|
54
|
+
export const TimeInput = /*#__PURE__*/ React.forwardRef(function TimeInput(rawProps, ref) {
|
|
55
55
|
const field = useFieldContext();
|
|
56
56
|
const { value: valueProp, defaultValue, onValueChange, hourCycle: hourCycleProp, step = 1, seconds = false, min, max, disabledTimes, name, size = "md", variant = "default", invalid, icon, trailing, className, labels, onBlur, ...rest } = rawProps;
|
|
57
57
|
const props = useFieldControl({ ...rest, name, "aria-invalid": invalid ? true : rest["aria-invalid"] });
|
|
@@ -308,7 +308,7 @@ export const TimeInput = React.forwardRef(function TimeInput(rawProps, ref) {
|
|
|
308
308
|
* <TimePicker value={time} onValueChange={setTime} slots step={30} min="09:00" max="18:00" />
|
|
309
309
|
* ```
|
|
310
310
|
*/
|
|
311
|
-
export const TimePicker = React.forwardRef(function TimePicker({ slots = false, step = 15, slotRange, open: openProp, onOpenChange, value: valueProp, defaultValue, onValueChange, labels, ...props }, ref) {
|
|
311
|
+
export const TimePicker = /*#__PURE__*/ React.forwardRef(function TimePicker({ slots = false, step = 15, slotRange, open: openProp, onOpenChange, value: valueProp, defaultValue, onValueChange, labels, ...props }, ref) {
|
|
312
312
|
const t = useLabels("timePicker", timePickerLabels, labels);
|
|
313
313
|
const { locale } = useLocale();
|
|
314
314
|
const [value, setValue] = useControllableState({ value: valueProp, defaultValue: defaultValue ?? null, onChange: onValueChange, name: "TimePicker" });
|
|
@@ -383,7 +383,7 @@ export function timeRangeMinutes(range, overnight = false) {
|
|
|
383
383
|
* Start and end time with a duration hint (shift start/end, opening hours). The end must be after
|
|
384
384
|
* the start unless `overnight` is set.
|
|
385
385
|
*/
|
|
386
|
-
export const TimeRangePicker = React.forwardRef(function TimeRangePicker({ value: valueProp, defaultValue, onValueChange, overnight = false, showDuration = true, nameStart, nameEnd, labels, className, size = "md", ...props }, ref) {
|
|
386
|
+
export const TimeRangePicker = /*#__PURE__*/ React.forwardRef(function TimeRangePicker({ value: valueProp, defaultValue, onValueChange, overnight = false, showDuration = true, nameStart, nameEnd, labels, className, size = "md", ...props }, ref) {
|
|
387
387
|
const t = useLabels("timePicker", timePickerLabels, labels);
|
|
388
388
|
const [value, setValue] = useControllableState({ value: valueProp, defaultValue: defaultValue ?? { start: null, end: null }, onChange: onValueChange, name: "TimeRangePicker" });
|
|
389
389
|
const minutes = timeRangeMinutes(value, overnight);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import
|
|
2
|
+
import * as TogglePrimitive from "radix-ui/toggle";
|
|
3
|
+
import * as ToggleGroupPrimitive from "radix-ui/toggle-group";
|
|
3
4
|
export declare const toggleVariants: (props?: ({
|
|
4
5
|
variant?: "outline" | "ghost" | "segmented" | null | undefined;
|
|
5
6
|
size?: "sm" | "md" | "lg" | "xs" | null | undefined;
|