@meldgrove/ui 0.0.0-stage → 0.1.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.
Files changed (139) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +213 -2
  3. package/dist/components/alert-dialog.d.ts +18 -0
  4. package/dist/components/alert-dialog.js +44 -0
  5. package/dist/components/alert.d.ts +9 -0
  6. package/dist/components/alert.js +25 -0
  7. package/dist/components/avatar.d.ts +11 -0
  8. package/dist/components/avatar.js +24 -0
  9. package/dist/components/badge.d.ts +9 -0
  10. package/dist/components/badge.js +25 -0
  11. package/dist/components/breadcrumb.d.ts +11 -0
  12. package/dist/components/breadcrumb.js +28 -0
  13. package/dist/components/button-group.d.ts +11 -0
  14. package/dist/components/button-group.js +27 -0
  15. package/dist/components/button.d.ts +10 -0
  16. package/dist/components/button.js +36 -0
  17. package/dist/components/calendar.d.ts +8 -0
  18. package/dist/components/calendar.js +73 -0
  19. package/dist/components/card.d.ts +9 -0
  20. package/dist/components/card.js +25 -0
  21. package/dist/components/chart.d.ts +44 -0
  22. package/dist/components/chart.js +117 -0
  23. package/dist/components/checkbox.d.ts +4 -0
  24. package/dist/components/checkbox.js +10 -0
  25. package/dist/components/collapsible.d.ts +5 -0
  26. package/dist/components/collapsible.js +13 -0
  27. package/dist/components/command.d.ts +18 -0
  28. package/dist/components/command.js +35 -0
  29. package/dist/components/confirm-dialog.d.ts +15 -0
  30. package/dist/components/confirm-dialog.js +26 -0
  31. package/dist/components/copy-button.d.ts +6 -0
  32. package/dist/components/copy-button.js +23 -0
  33. package/dist/components/dialog.d.ts +17 -0
  34. package/dist/components/dialog.js +39 -0
  35. package/dist/components/dropdown-menu.d.ts +25 -0
  36. package/dist/components/dropdown-menu.js +53 -0
  37. package/dist/components/empty.d.ts +11 -0
  38. package/dist/components/empty.js +33 -0
  39. package/dist/components/field.d.ts +24 -0
  40. package/dist/components/field.js +74 -0
  41. package/dist/components/hover-card.d.ts +6 -0
  42. package/dist/components/hover-card.js +16 -0
  43. package/dist/components/input-group.d.ts +16 -0
  44. package/dist/components/input-group.js +64 -0
  45. package/dist/components/input.d.ts +3 -0
  46. package/dist/components/input.js +7 -0
  47. package/dist/components/item.d.ts +23 -0
  48. package/dist/components/item.js +67 -0
  49. package/dist/components/kbd.d.ts +3 -0
  50. package/dist/components/kbd.js +11 -0
  51. package/dist/components/label.d.ts +4 -0
  52. package/dist/components/label.js +9 -0
  53. package/dist/components/native-select.d.ts +8 -0
  54. package/dist/components/native-select.js +14 -0
  55. package/dist/components/pager.d.ts +7 -0
  56. package/dist/components/pager.js +11 -0
  57. package/dist/components/pagination.d.ts +13 -0
  58. package/dist/components/pagination.js +30 -0
  59. package/dist/components/popover.d.ts +10 -0
  60. package/dist/components/popover.js +28 -0
  61. package/dist/components/progress.d.ts +4 -0
  62. package/dist/components/progress.js +9 -0
  63. package/dist/components/radio-group.d.ts +5 -0
  64. package/dist/components/radio-group.js +13 -0
  65. package/dist/components/scroll-area.d.ts +5 -0
  66. package/dist/components/scroll-area.js +12 -0
  67. package/dist/components/secret-field.d.ts +23 -0
  68. package/dist/components/secret-field.js +47 -0
  69. package/dist/components/select.d.ts +15 -0
  70. package/dist/components/select.js +40 -0
  71. package/dist/components/separator.d.ts +4 -0
  72. package/dist/components/separator.js +9 -0
  73. package/dist/components/sheet.d.ts +14 -0
  74. package/dist/components/sheet.js +42 -0
  75. package/dist/components/sidebar.d.ts +70 -0
  76. package/dist/components/sidebar.js +212 -0
  77. package/dist/components/skeleton.d.ts +2 -0
  78. package/dist/components/skeleton.js +6 -0
  79. package/dist/components/sonner.d.ts +5 -0
  80. package/dist/components/sonner.js +14 -0
  81. package/dist/components/spinner.d.ts +2 -0
  82. package/dist/components/spinner.js +7 -0
  83. package/dist/components/states.d.ts +14 -0
  84. package/dist/components/states.js +18 -0
  85. package/dist/components/switch.d.ts +6 -0
  86. package/dist/components/switch.js +9 -0
  87. package/dist/components/table.d.ts +17 -0
  88. package/dist/components/table.js +34 -0
  89. package/dist/components/tabs.d.ts +11 -0
  90. package/dist/components/tabs.js +30 -0
  91. package/dist/components/textarea.d.ts +3 -0
  92. package/dist/components/textarea.js +7 -0
  93. package/dist/components/toggle-group.d.ts +9 -0
  94. package/dist/components/toggle-group.js +23 -0
  95. package/dist/components/toggle.d.ts +9 -0
  96. package/dist/components/toggle.js +27 -0
  97. package/dist/components/tooltip.d.ts +7 -0
  98. package/dist/components/tooltip.js +19 -0
  99. package/dist/hooks/use-mobile.d.ts +2 -0
  100. package/dist/hooks/use-mobile.js +13 -0
  101. package/dist/lib/format.d.ts +8 -0
  102. package/dist/lib/format.js +38 -0
  103. package/dist/lib/i18n-core.d.ts +38 -0
  104. package/dist/lib/i18n-core.js +61 -0
  105. package/dist/lib/i18n.d.ts +11 -0
  106. package/dist/lib/i18n.js +19 -0
  107. package/dist/lib/portal.d.ts +13 -0
  108. package/dist/lib/portal.js +17 -0
  109. package/dist/lib/theme.d.ts +5 -0
  110. package/dist/lib/theme.js +17 -0
  111. package/dist/lib/utils.d.ts +2 -0
  112. package/dist/lib/utils.js +5 -0
  113. package/dist/standalone/meldgrove-updates.js +57 -0
  114. package/dist/styles.css +11 -0
  115. package/dist/theme.css +62 -0
  116. package/dist/tokens.css +94 -0
  117. package/dist/updates/controller.d.ts +249 -0
  118. package/dist/updates/controller.js +657 -0
  119. package/dist/updates/core.d.ts +10 -0
  120. package/dist/updates/core.js +10 -0
  121. package/dist/updates/index.d.ts +15 -0
  122. package/dist/updates/index.js +15 -0
  123. package/dist/updates/messages.d.ts +92 -0
  124. package/dist/updates/messages.js +182 -0
  125. package/dist/updates/notice.d.ts +3 -0
  126. package/dist/updates/notice.js +6 -0
  127. package/dist/updates/react.d.ts +56 -0
  128. package/dist/updates/react.js +72 -0
  129. package/dist/updates/state.d.ts +224 -0
  130. package/dist/updates/state.js +411 -0
  131. package/dist/updates/transport.d.ts +50 -0
  132. package/dist/updates/transport.js +76 -0
  133. package/dist/updates/types.d.ts +77 -0
  134. package/dist/updates/types.js +68 -0
  135. package/dist/updates/update-button.d.ts +9 -0
  136. package/dist/updates/update-button.js +161 -0
  137. package/dist/updates/updates-settings.d.ts +17 -0
  138. package/dist/updates/updates-settings.js +97 -0
  139. package/package.json +159 -4
@@ -0,0 +1,5 @@
1
+ import type * as React from "react";
2
+ import { type ToasterProps } from "sonner";
3
+ /** Toasts in the app's theme: follows the `dark` class on <html> unless `theme` is given. */
4
+ declare function Toaster(props: ToasterProps): React.JSX.Element;
5
+ export { Toaster };
@@ -0,0 +1,14 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { Toaster as Sonner } from "sonner";
4
+ import { useDocumentTheme } from "../lib/theme.js";
5
+ /** Toasts in the app's theme: follows the `dark` class on <html> unless `theme` is given. */
6
+ function Toaster(props) {
7
+ const documentTheme = useDocumentTheme();
8
+ return (_jsx(Sonner, { theme: documentTheme, className: "toaster group", style: {
9
+ "--normal-bg": "var(--popover)",
10
+ "--normal-text": "var(--popover-foreground)",
11
+ "--normal-border": "var(--border)",
12
+ }, ...props }));
13
+ }
14
+ export { Toaster };
@@ -0,0 +1,2 @@
1
+ declare function Spinner({ className, ...props }: React.ComponentProps<"svg">): import("react").JSX.Element;
2
+ export { Spinner };
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from "../lib/utils.js";
3
+ import { Loader2Icon } from "lucide-react";
4
+ function Spinner({ className, ...props }) {
5
+ return (_jsx(Loader2Icon, { role: "status", "aria-label": "Loading", className: cn("size-4 animate-spin", className), ...props }));
6
+ }
7
+ export { Spinner };
@@ -0,0 +1,14 @@
1
+ import type { ReactNode } from "react";
2
+ export declare function LoadingState({ label }: {
3
+ label?: string;
4
+ }): import("react").JSX.Element;
5
+ export declare function ErrorState({ error, onRetry }: {
6
+ error: unknown;
7
+ onRetry?: () => void;
8
+ }): import("react").JSX.Element;
9
+ export declare function EmptyState(props: {
10
+ title: ReactNode;
11
+ description?: ReactNode;
12
+ icon?: ReactNode;
13
+ action?: ReactNode;
14
+ }): import("react").JSX.Element;
@@ -0,0 +1,18 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { AlertCircle, Inbox } from "lucide-react";
4
+ import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "./empty.js";
5
+ import { Spinner } from "./spinner.js";
6
+ import { Button } from "./button.js";
7
+ import { common, errorMessage, useT } from "../lib/i18n.js";
8
+ export function LoadingState({ label }) {
9
+ const t = useT(common);
10
+ return (_jsxs("div", { className: "text-muted-foreground flex items-center justify-center gap-2 py-12 text-sm", role: "status", children: [_jsx(Spinner, {}), _jsx("span", { children: label ?? t("loading") })] }));
11
+ }
12
+ export function ErrorState({ error, onRetry }) {
13
+ const t = useT(common);
14
+ return (_jsxs(Empty, { children: [_jsxs(EmptyHeader, { children: [_jsx(EmptyMedia, { variant: "icon", children: _jsx(AlertCircle, {}) }), _jsx(EmptyTitle, { children: t("error") }), _jsx(EmptyDescription, { children: errorMessage(error) })] }), onRetry ? (_jsx(EmptyContent, { children: _jsx(Button, { variant: "outline", onClick: onRetry, children: t("retry") }) })) : null] }));
15
+ }
16
+ export function EmptyState(props) {
17
+ return (_jsxs(Empty, { children: [_jsxs(EmptyHeader, { children: [_jsx(EmptyMedia, { variant: "icon", children: props.icon ?? _jsx(Inbox, {}) }), _jsx(EmptyTitle, { children: props.title }), props.description ? _jsx(EmptyDescription, { children: props.description }) : null] }), props.action ? _jsx(EmptyContent, { children: props.action }) : null] }));
18
+ }
@@ -0,0 +1,6 @@
1
+ import * as React from "react";
2
+ import { Switch as SwitchPrimitive } from "radix-ui";
3
+ declare function Switch({ className, size, ...props }: React.ComponentProps<typeof SwitchPrimitive.Root> & {
4
+ size?: "sm" | "default";
5
+ }): React.JSX.Element;
6
+ export { Switch };
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { cn } from "../lib/utils.js";
5
+ import { Switch as SwitchPrimitive } from "radix-ui";
6
+ function Switch({ className, size = "default", ...props }) {
7
+ return (_jsx(SwitchPrimitive.Root, { "data-slot": "switch", "data-size": size, className: cn("peer group/switch inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-input/80", className), ...props, children: _jsx(SwitchPrimitive.Thumb, { "data-slot": "switch-thumb", className: cn("pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0 dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground") }) }));
8
+ }
9
+ export { Switch };
@@ -0,0 +1,17 @@
1
+ import * as React from "react";
2
+ /**
3
+ * Changed from shadcn: `scrollLabel` makes the scroll container a labelled,
4
+ * focusable region, so keyboard users can scroll a table wider than the page
5
+ * (WCAG 2.1.1).
6
+ */
7
+ declare function Table({ className, scrollLabel, ...props }: React.ComponentProps<"table"> & {
8
+ scrollLabel?: string;
9
+ }): React.JSX.Element;
10
+ declare function TableHeader({ className, ...props }: React.ComponentProps<"thead">): React.JSX.Element;
11
+ declare function TableBody({ className, ...props }: React.ComponentProps<"tbody">): React.JSX.Element;
12
+ declare function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">): React.JSX.Element;
13
+ declare function TableRow({ className, ...props }: React.ComponentProps<"tr">): React.JSX.Element;
14
+ declare function TableHead({ className, ...props }: React.ComponentProps<"th">): React.JSX.Element;
15
+ declare function TableCell({ className, ...props }: React.ComponentProps<"td">): React.JSX.Element;
16
+ declare function TableCaption({ className, ...props }: React.ComponentProps<"caption">): React.JSX.Element;
17
+ export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption };
@@ -0,0 +1,34 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { cn } from "../lib/utils.js";
5
+ /**
6
+ * Changed from shadcn: `scrollLabel` makes the scroll container a labelled,
7
+ * focusable region, so keyboard users can scroll a table wider than the page
8
+ * (WCAG 2.1.1).
9
+ */
10
+ function Table({ className, scrollLabel, ...props }) {
11
+ return (_jsx("div", { "data-slot": "table-container", className: "relative w-full overflow-x-auto", ...(scrollLabel ? { role: "region", "aria-label": scrollLabel, tabIndex: 0 } : {}), children: _jsx("table", { "data-slot": "table", className: cn("w-full caption-bottom text-sm", className), ...props }) }));
12
+ }
13
+ function TableHeader({ className, ...props }) {
14
+ return _jsx("thead", { "data-slot": "table-header", className: cn("[&_tr]:border-b", className), ...props });
15
+ }
16
+ function TableBody({ className, ...props }) {
17
+ return _jsx("tbody", { "data-slot": "table-body", className: cn("[&_tr:last-child]:border-0", className), ...props });
18
+ }
19
+ function TableFooter({ className, ...props }) {
20
+ return (_jsx("tfoot", { "data-slot": "table-footer", className: cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className), ...props }));
21
+ }
22
+ function TableRow({ className, ...props }) {
23
+ return (_jsx("tr", { "data-slot": "table-row", className: cn("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted", className), ...props }));
24
+ }
25
+ function TableHead({ className, ...props }) {
26
+ return (_jsx("th", { "data-slot": "table-head", className: cn("h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className), ...props }));
27
+ }
28
+ function TableCell({ className, ...props }) {
29
+ return (_jsx("td", { "data-slot": "table-cell", className: cn("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className), ...props }));
30
+ }
31
+ function TableCaption({ className, ...props }) {
32
+ return (_jsx("caption", { "data-slot": "table-caption", className: cn("mt-4 text-sm text-muted-foreground", className), ...props }));
33
+ }
34
+ export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption };
@@ -0,0 +1,11 @@
1
+ import * as React from "react";
2
+ import { type VariantProps } from "class-variance-authority";
3
+ import { Tabs as TabsPrimitive } from "radix-ui";
4
+ declare function Tabs({ className, orientation, ...props }: React.ComponentProps<typeof TabsPrimitive.Root>): React.JSX.Element;
5
+ declare const tabsListVariants: (props?: ({
6
+ variant?: "default" | "line" | null | undefined;
7
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
+ declare function TabsList({ className, variant, ...props }: React.ComponentProps<typeof TabsPrimitive.List> & VariantProps<typeof tabsListVariants>): React.JSX.Element;
9
+ declare function TabsTrigger({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Trigger>): React.JSX.Element;
10
+ declare function TabsContent({ className, ...props }: React.ComponentProps<typeof TabsPrimitive.Content>): React.JSX.Element;
11
+ export { Tabs, TabsList, TabsTrigger, TabsContent, tabsListVariants };
@@ -0,0 +1,30 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { cva } from "class-variance-authority";
5
+ import { cn } from "../lib/utils.js";
6
+ import { Tabs as TabsPrimitive } from "radix-ui";
7
+ function Tabs({ className, orientation = "horizontal", ...props }) {
8
+ return (_jsx(TabsPrimitive.Root, { "data-slot": "tabs", "data-orientation": orientation, orientation: orientation, className: cn("group/tabs flex gap-2 data-[orientation=horizontal]:flex-col", className), ...props }));
9
+ }
10
+ const tabsListVariants = cva("group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-[orientation=horizontal]/tabs:h-9 group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col data-[variant=line]:rounded-none", {
11
+ variants: {
12
+ variant: {
13
+ default: "bg-muted",
14
+ line: "gap-1 bg-transparent",
15
+ },
16
+ },
17
+ defaultVariants: {
18
+ variant: "default",
19
+ },
20
+ });
21
+ function TabsList({ className, variant = "default", ...props }) {
22
+ return (_jsx(TabsPrimitive.List, { "data-slot": "tabs-list", "data-variant": variant, className: cn(tabsListVariants({ variant }), className), ...props }));
23
+ }
24
+ function TabsTrigger({ className, ...props }) {
25
+ return (_jsx(TabsPrimitive.Trigger, { "data-slot": "tabs-trigger", className: cn("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-sm group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none dark:text-muted-foreground dark:hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", "group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:border-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent", "data-[state=active]:bg-background data-[state=active]:text-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 dark:data-[state=active]:text-foreground", "after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100", className), ...props }));
26
+ }
27
+ function TabsContent({ className, ...props }) {
28
+ return (_jsx(TabsPrimitive.Content, { "data-slot": "tabs-content", className: cn("flex-1 outline-none", className), ...props }));
29
+ }
30
+ export { Tabs, TabsList, TabsTrigger, TabsContent, tabsListVariants };
@@ -0,0 +1,3 @@
1
+ import * as React from "react";
2
+ declare function Textarea({ className, ...props }: React.ComponentProps<"textarea">): React.JSX.Element;
3
+ export { Textarea };
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import { cn } from "../lib/utils.js";
4
+ function Textarea({ className, ...props }) {
5
+ return (_jsx("textarea", { "data-slot": "textarea", className: cn("flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:ring-destructive/40", className), ...props }));
6
+ }
7
+ export { Textarea };
@@ -0,0 +1,9 @@
1
+ import * as React from "react";
2
+ import { type VariantProps } from "class-variance-authority";
3
+ import { ToggleGroup as ToggleGroupPrimitive } from "radix-ui";
4
+ import { toggleVariants } from "./toggle.tsx";
5
+ declare function ToggleGroup({ className, variant, size, spacing, children, ...props }: React.ComponentProps<typeof ToggleGroupPrimitive.Root> & VariantProps<typeof toggleVariants> & {
6
+ spacing?: number;
7
+ }): React.JSX.Element;
8
+ declare function ToggleGroupItem({ className, children, variant, size, ...props }: React.ComponentProps<typeof ToggleGroupPrimitive.Item> & VariantProps<typeof toggleVariants>): React.JSX.Element;
9
+ export { ToggleGroup, ToggleGroupItem };
@@ -0,0 +1,23 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import {} from "class-variance-authority";
5
+ import { cn } from "../lib/utils.js";
6
+ import { ToggleGroup as ToggleGroupPrimitive } from "radix-ui";
7
+ import { toggleVariants } from "./toggle.js";
8
+ const ToggleGroupContext = React.createContext({
9
+ size: "default",
10
+ variant: "default",
11
+ spacing: 0,
12
+ });
13
+ function ToggleGroup({ className, variant, size, spacing = 0, children, ...props }) {
14
+ return (_jsx(ToggleGroupPrimitive.Root, { "data-slot": "toggle-group", "data-variant": variant, "data-size": size, "data-spacing": spacing, style: { "--gap": spacing }, className: cn("group/toggle-group flex w-fit items-center gap-[--spacing(var(--gap))] rounded-md data-[spacing=default]:data-[variant=outline]:shadow-xs", className), ...props, children: _jsx(ToggleGroupContext.Provider, { value: { variant, size, spacing }, children: children }) }));
15
+ }
16
+ function ToggleGroupItem({ className, children, variant, size, ...props }) {
17
+ const context = React.useContext(ToggleGroupContext);
18
+ return (_jsx(ToggleGroupPrimitive.Item, { "data-slot": "toggle-group-item", "data-variant": context.variant || variant, "data-size": context.size || size, "data-spacing": context.spacing, className: cn(toggleVariants({
19
+ variant: context.variant || variant,
20
+ size: context.size || size,
21
+ }), "w-auto min-w-0 shrink-0 px-3 focus:z-10 focus-visible:z-10", "data-[spacing=0]:rounded-none data-[spacing=0]:shadow-none data-[spacing=0]:first:rounded-l-md data-[spacing=0]:last:rounded-r-md data-[spacing=0]:data-[variant=outline]:border-l-0 data-[spacing=0]:data-[variant=outline]:first:border-l", className), ...props, children: children }));
22
+ }
23
+ export { ToggleGroup, ToggleGroupItem };
@@ -0,0 +1,9 @@
1
+ import * as React from "react";
2
+ import { type VariantProps } from "class-variance-authority";
3
+ import { Toggle as TogglePrimitive } from "radix-ui";
4
+ declare const toggleVariants: (props?: ({
5
+ variant?: "default" | "outline" | null | undefined;
6
+ size?: "default" | "sm" | "lg" | null | undefined;
7
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
+ declare function Toggle({ className, variant, size, ...props }: React.ComponentProps<typeof TogglePrimitive.Root> & VariantProps<typeof toggleVariants>): React.JSX.Element;
9
+ export { Toggle, toggleVariants };
@@ -0,0 +1,27 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { cva } from "class-variance-authority";
5
+ import { cn } from "../lib/utils.js";
6
+ import { Toggle as TogglePrimitive } from "radix-ui";
7
+ const toggleVariants = cva("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-[color,box-shadow] outline-none hover:bg-muted hover:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
8
+ variants: {
9
+ variant: {
10
+ default: "bg-transparent",
11
+ outline: "border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground",
12
+ },
13
+ size: {
14
+ default: "h-9 min-w-9 px-2",
15
+ sm: "h-8 min-w-8 px-1.5",
16
+ lg: "h-10 min-w-10 px-2.5",
17
+ },
18
+ },
19
+ defaultVariants: {
20
+ variant: "default",
21
+ size: "default",
22
+ },
23
+ });
24
+ function Toggle({ className, variant, size, ...props }) {
25
+ return (_jsx(TogglePrimitive.Root, { "data-slot": "toggle", className: cn(toggleVariants({ variant, size, className })), ...props }));
26
+ }
27
+ export { Toggle, toggleVariants };
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ import { Tooltip as TooltipPrimitive } from "radix-ui";
3
+ declare function TooltipProvider({ delayDuration, ...props }: React.ComponentProps<typeof TooltipPrimitive.Provider>): React.JSX.Element;
4
+ declare function Tooltip({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Root>): React.JSX.Element;
5
+ declare function TooltipTrigger({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Trigger>): React.JSX.Element;
6
+ declare function TooltipContent({ className, sideOffset, children, ...props }: React.ComponentProps<typeof TooltipPrimitive.Content>): React.JSX.Element;
7
+ export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
@@ -0,0 +1,19 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { cn } from "../lib/utils.js";
5
+ import { Tooltip as TooltipPrimitive } from "radix-ui";
6
+ import { usePortalContainer } from "../lib/portal.js";
7
+ function TooltipProvider({ delayDuration = 0, ...props }) {
8
+ return _jsx(TooltipPrimitive.Provider, { "data-slot": "tooltip-provider", delayDuration: delayDuration, ...props });
9
+ }
10
+ function Tooltip({ ...props }) {
11
+ return _jsx(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props });
12
+ }
13
+ function TooltipTrigger({ ...props }) {
14
+ return _jsx(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", ...props });
15
+ }
16
+ function TooltipContent({ className, sideOffset = 0, children, ...props }) {
17
+ return (_jsx(TooltipPrimitive.Portal, { container: usePortalContainer(), children: _jsxs(TooltipPrimitive.Content, { "data-slot": "tooltip-content", sideOffset: sideOffset, className: cn("z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95", className), ...props, children: [children, _jsx(TooltipPrimitive.Arrow, { className: "z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground" })] }) }));
18
+ }
19
+ export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
@@ -0,0 +1,2 @@
1
+ /** True below the `md` breakpoint. False on the server and during hydration. */
2
+ export declare function useIsMobile(): boolean;
@@ -0,0 +1,13 @@
1
+ "use client";
2
+ import * as React from "react";
3
+ const MOBILE_BREAKPOINT = 768;
4
+ const MOBILE_QUERY = `(max-width: ${MOBILE_BREAKPOINT - 1}px)`;
5
+ function subscribe(onChange) {
6
+ const mql = window.matchMedia(MOBILE_QUERY);
7
+ mql.addEventListener("change", onChange);
8
+ return () => mql.removeEventListener("change", onChange);
9
+ }
10
+ /** True below the `md` breakpoint. False on the server and during hydration. */
11
+ export function useIsMobile() {
12
+ return React.useSyncExternalStore(subscribe, () => window.matchMedia(MOBILE_QUERY).matches, () => false);
13
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * "19 Nov 2026, 14:05" in the locale (a BCP 47 tag, e.g. "en-GB") and the
3
+ * time zone (IANA, e.g. "Europe/Berlin"; default: the browser's). An unknown
4
+ * time zone falls back to the browser's.
5
+ */
6
+ export declare function formatDateTime(value: string | number | Date, locale: string, timeZone?: string): string;
7
+ /** "5 minutes ago", "in 2 days", "just now" (under a minute) relative to `now`. */
8
+ export declare function formatRelative(value: string | number | Date, locale: string, now?: number): string;
@@ -0,0 +1,38 @@
1
+ const UNITS = [
2
+ ["year", 365 * 86_400_000],
3
+ ["month", 30 * 86_400_000],
4
+ ["week", 7 * 86_400_000],
5
+ ["day", 86_400_000],
6
+ ["hour", 3_600_000],
7
+ ["minute", 60_000],
8
+ ];
9
+ /**
10
+ * "19 Nov 2026, 14:05" in the locale (a BCP 47 tag, e.g. "en-GB") and the
11
+ * time zone (IANA, e.g. "Europe/Berlin"; default: the browser's). An unknown
12
+ * time zone falls back to the browser's.
13
+ */
14
+ export function formatDateTime(value, locale, timeZone) {
15
+ const date = new Date(value);
16
+ if (Number.isNaN(date.getTime()))
17
+ return String(value);
18
+ const options = { dateStyle: "medium", timeStyle: "short" };
19
+ try {
20
+ return new Intl.DateTimeFormat(locale, { ...options, timeZone }).format(date);
21
+ }
22
+ catch {
23
+ return new Intl.DateTimeFormat(locale, options).format(date);
24
+ }
25
+ }
26
+ /** "5 minutes ago", "in 2 days", "just now" (under a minute) relative to `now`. */
27
+ export function formatRelative(value, locale, now = Date.now()) {
28
+ const time = new Date(value).getTime();
29
+ if (Number.isNaN(time))
30
+ return String(value);
31
+ const diff = time - now;
32
+ const format = new Intl.RelativeTimeFormat(locale, { numeric: "auto" });
33
+ for (const [unit, ms] of UNITS) {
34
+ if (Math.abs(diff) >= ms)
35
+ return format.format(Math.round(diff / ms), unit);
36
+ }
37
+ return format.format(0, "second");
38
+ }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * The package's texts in English and German. Apps pass their locale once
3
+ * with `<UIProvider locale="de">`; without it, components speak English.
4
+ *
5
+ * Catalogs work like the apps' own: `{ members: "{count} members",
6
+ * members_one: "1 member" }`, where `<key>_one` wins when `count` is 1.
7
+ */
8
+ export type Locale = "en" | "de";
9
+ export declare const LOCALES: readonly Locale[];
10
+ export type Catalog = Record<string, string>;
11
+ export type Messages<T extends Catalog> = {
12
+ en: T;
13
+ de: {
14
+ [K in keyof T]: string;
15
+ };
16
+ };
17
+ export type Params = Record<string, string | number>;
18
+ export type Translate<T extends Catalog> = (key: keyof T & string, params?: Params) => string;
19
+ export declare function defineMessages<T extends Catalog>(messages: Messages<T>): Messages<T>;
20
+ export declare function interpolate(template: string, params?: Params): string;
21
+ export declare function translate<T extends Catalog>(messages: Messages<T>, locale: Locale): Translate<T>;
22
+ /** Words the package's components share. */
23
+ export declare const common: Messages<{
24
+ cancel: string;
25
+ confirm: string;
26
+ back: string;
27
+ next: string;
28
+ loading: string;
29
+ retry: string;
30
+ copy: string;
31
+ copied: string;
32
+ error: string;
33
+ page: string;
34
+ total: string;
35
+ total_one: string;
36
+ }>;
37
+ /** The message of an error of any kind; English fallback for values without one. */
38
+ export declare function errorMessage(error: unknown): string;
@@ -0,0 +1,61 @@
1
+ // Texts and translation without React, so that server code can import them.
2
+ export const LOCALES = ["en", "de"];
3
+ export function defineMessages(messages) {
4
+ return messages;
5
+ }
6
+ export function interpolate(template, params) {
7
+ if (!params)
8
+ return template;
9
+ return template.replace(/\{(\w+)\}/g, (match, key) => key in params ? String(params[key]) : match);
10
+ }
11
+ export function translate(messages, locale) {
12
+ const catalog = messages[locale];
13
+ const english = messages.en;
14
+ return (key, params) => {
15
+ const one = params !== undefined && Number(params.count) === 1 ? `${key}_one` : null;
16
+ const template = (one ? (catalog[one] ?? english[one]) : undefined) ?? catalog[key] ?? english[key] ?? key;
17
+ return interpolate(template, params);
18
+ };
19
+ }
20
+ /** Words the package's components share. */
21
+ export const common = defineMessages({
22
+ en: {
23
+ cancel: "Cancel",
24
+ confirm: "Confirm",
25
+ back: "Back",
26
+ next: "Next",
27
+ loading: "Loading…",
28
+ retry: "Retry",
29
+ copy: "Copy",
30
+ copied: "Copied",
31
+ error: "Something went wrong",
32
+ page: "Page {page} of {pages}",
33
+ total: "{count} entries",
34
+ total_one: "1 entry",
35
+ },
36
+ de: {
37
+ cancel: "Abbrechen",
38
+ confirm: "Bestätigen",
39
+ back: "Zurück",
40
+ next: "Weiter",
41
+ loading: "Wird geladen…",
42
+ retry: "Erneut versuchen",
43
+ copy: "Kopieren",
44
+ copied: "Kopiert",
45
+ error: "Etwas ist schiefgelaufen",
46
+ page: "Seite {page} von {pages}",
47
+ total: "{count} Einträge",
48
+ total_one: "1 Eintrag",
49
+ },
50
+ });
51
+ /** The message of an error of any kind; English fallback for values without one. */
52
+ export function errorMessage(error) {
53
+ if (error instanceof Error)
54
+ return error.message;
55
+ if (typeof error === "string" && error !== "")
56
+ return error;
57
+ const message = error?.message;
58
+ if (typeof message === "string" && message !== "")
59
+ return message;
60
+ return "Something went wrong";
61
+ }
@@ -0,0 +1,11 @@
1
+ import { type ReactNode } from "react";
2
+ import { type Catalog, type Locale, type Messages, type Translate } from "./i18n-core.ts";
3
+ export * from "./i18n-core.ts";
4
+ /** Sets the language of every component of the package below it. */
5
+ export declare function UIProvider(props: {
6
+ locale: Locale;
7
+ children: ReactNode;
8
+ }): import("react").JSX.Element;
9
+ export declare function useLocale(): Locale;
10
+ /** The translate function for a catalog in the current locale. */
11
+ export declare function useT<T extends Catalog>(messages: Messages<T>): Translate<T>;
@@ -0,0 +1,19 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { createContext, useCallback, useContext } from "react";
4
+ import { translate } from "./i18n-core.js";
5
+ export * from "./i18n-core.js";
6
+ const LocaleContext = createContext("en");
7
+ /** Sets the language of every component of the package below it. */
8
+ export function UIProvider(props) {
9
+ return _jsx(LocaleContext.Provider, { value: props.locale, children: props.children });
10
+ }
11
+ export function useLocale() {
12
+ return useContext(LocaleContext);
13
+ }
14
+ /** The translate function for a catalog in the current locale. */
15
+ export function useT(messages) {
16
+ const locale = useLocale();
17
+ // eslint-disable-next-line react-hooks/exhaustive-deps
18
+ return useCallback(translate(messages, locale), [messages, locale]);
19
+ }
@@ -0,0 +1,13 @@
1
+ import { type ReactNode } from "react";
2
+ /**
3
+ * Where popovers, tooltips, menus and dialogs render: `document.body` by
4
+ * default. A page that embeds components in a shadow root (the standalone
5
+ * update button) passes an element inside it, so the shadow root's styles
6
+ * apply to them too.
7
+ */
8
+ export declare function PortalContainerProvider(props: {
9
+ container: HTMLElement | null;
10
+ children: ReactNode;
11
+ }): import("react").JSX.Element;
12
+ /** The element portals render into; undefined: `document.body`. */
13
+ export declare function usePortalContainer(): HTMLElement | undefined;
@@ -0,0 +1,17 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { createContext, useContext } from "react";
4
+ const PortalContainerContext = createContext(null);
5
+ /**
6
+ * Where popovers, tooltips, menus and dialogs render: `document.body` by
7
+ * default. A page that embeds components in a shadow root (the standalone
8
+ * update button) passes an element inside it, so the shadow root's styles
9
+ * apply to them too.
10
+ */
11
+ export function PortalContainerProvider(props) {
12
+ return (_jsx(PortalContainerContext.Provider, { value: props.container, children: props.children }));
13
+ }
14
+ /** The element portals render into; undefined: `document.body`. */
15
+ export function usePortalContainer() {
16
+ return useContext(PortalContainerContext) ?? undefined;
17
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * The theme a page shows: "dark" while <html> has the class `dark` (the class
3
+ * every Meldgrove app's theme switch sets), else "light". Follows changes.
4
+ */
5
+ export declare function useDocumentTheme(): "light" | "dark";
@@ -0,0 +1,17 @@
1
+ "use client";
2
+ import { useSyncExternalStore } from "react";
3
+ /**
4
+ * The theme a page shows: "dark" while <html> has the class `dark` (the class
5
+ * every Meldgrove app's theme switch sets), else "light". Follows changes.
6
+ */
7
+ export function useDocumentTheme() {
8
+ return useSyncExternalStore(subscribe, snapshot, () => "light");
9
+ }
10
+ function snapshot() {
11
+ return document.documentElement.classList.contains("dark") ? "dark" : "light";
12
+ }
13
+ function subscribe(onChange) {
14
+ const observer = new MutationObserver(onChange);
15
+ observer.observe(document.documentElement, { attributes: true, attributeFilter: ["class"] });
16
+ return () => observer.disconnect();
17
+ }
@@ -0,0 +1,2 @@
1
+ import { type ClassValue } from "clsx";
2
+ export declare function cn(...inputs: ClassValue[]): string;
@@ -0,0 +1,5 @@
1
+ import { clsx } from "clsx";
2
+ import { twMerge } from "tailwind-merge";
3
+ export function cn(...inputs) {
4
+ return twMerge(clsx(inputs));
5
+ }