@ggem-farming/ui 0.0.0-stage → 0.0.0

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 (93) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +15 -2
  3. package/dist/accordion/accordion.d.ts +41 -0
  4. package/dist/accordion/accordion.js +89 -0
  5. package/dist/avatar/avatar.d.ts +20 -0
  6. package/dist/avatar/avatar.js +38 -0
  7. package/dist/badge/badge.d.ts +16 -0
  8. package/dist/badge/badge.js +85 -0
  9. package/dist/breadcrumbs/breadcrumbs.d.ts +19 -0
  10. package/dist/breadcrumbs/breadcrumbs.js +44 -0
  11. package/dist/button/button.d.ts +16 -0
  12. package/dist/button/button.js +49 -0
  13. package/dist/button/icon-button.d.ts +17 -0
  14. package/dist/button/icon-button.js +33 -0
  15. package/dist/card/card.d.ts +16 -0
  16. package/dist/card/card.js +56 -0
  17. package/dist/checkbox/checkbox.d.ts +15 -0
  18. package/dist/checkbox/checkbox.js +47 -0
  19. package/dist/combobox/combobox.d.ts +37 -0
  20. package/dist/combobox/combobox.js +155 -0
  21. package/dist/command/command-palette.d.ts +50 -0
  22. package/dist/command/command-palette.js +170 -0
  23. package/dist/command/kbd.d.ts +6 -0
  24. package/dist/command/kbd.js +16 -0
  25. package/dist/data/data-table.d.ts +105 -0
  26. package/dist/data/data-table.js +269 -0
  27. package/dist/data/export-button.d.ts +19 -0
  28. package/dist/data/export-button.js +34 -0
  29. package/dist/data/filter-bar.d.ts +54 -0
  30. package/dist/data/filter-bar.js +187 -0
  31. package/dist/data/pagination.d.ts +13 -0
  32. package/dist/data/pagination.js +84 -0
  33. package/dist/data/selection-bar.d.ts +21 -0
  34. package/dist/data/selection-bar.js +31 -0
  35. package/dist/date/date-input.d.ts +41 -0
  36. package/dist/date/date-input.js +71 -0
  37. package/dist/dialog/confirm-dialog.d.ts +24 -0
  38. package/dist/dialog/confirm-dialog.js +77 -0
  39. package/dist/dialog/dialog.d.ts +46 -0
  40. package/dist/dialog/dialog.js +102 -0
  41. package/dist/dialog/form-panel.d.ts +28 -0
  42. package/dist/dialog/form-panel.js +51 -0
  43. package/dist/feedback/alert.d.ts +29 -0
  44. package/dist/feedback/alert.js +70 -0
  45. package/dist/feedback/progress.d.ts +25 -0
  46. package/dist/feedback/progress.js +54 -0
  47. package/dist/feedback/toaster.d.ts +7 -0
  48. package/dist/feedback/toaster.js +35 -0
  49. package/dist/field/field.d.ts +40 -0
  50. package/dist/field/field.js +83 -0
  51. package/dist/field/text-field.d.ts +9 -0
  52. package/dist/field/text-field.js +16 -0
  53. package/dist/file-input/file-input.d.ts +26 -0
  54. package/dist/file-input/file-input.js +149 -0
  55. package/dist/fonts.css +3 -0
  56. package/dist/index.d.ts +43 -0
  57. package/dist/index.js +43 -0
  58. package/dist/input/input.d.ts +13 -0
  59. package/dist/input/input.js +25 -0
  60. package/dist/layout/app-shell.d.ts +100 -0
  61. package/dist/layout/app-shell.js +433 -0
  62. package/dist/layout/page.d.ts +20 -0
  63. package/dist/layout/page.js +53 -0
  64. package/dist/layout/record.d.ts +39 -0
  65. package/dist/layout/record.js +79 -0
  66. package/dist/lib/cn.d.ts +3 -0
  67. package/dist/lib/cn.js +18 -0
  68. package/dist/lib/control.js +14 -0
  69. package/dist/lib/popup.js +20 -0
  70. package/dist/menu/menu.d.ts +45 -0
  71. package/dist/menu/menu.js +85 -0
  72. package/dist/popover/popover.d.ts +22 -0
  73. package/dist/popover/popover.js +39 -0
  74. package/dist/radio/radio.d.ts +12 -0
  75. package/dist/radio/radio.js +25 -0
  76. package/dist/select/select.d.ts +23 -0
  77. package/dist/select/select.js +66 -0
  78. package/dist/separator/separator.d.ts +6 -0
  79. package/dist/separator/separator.js +14 -0
  80. package/dist/stat/stat.d.ts +28 -0
  81. package/dist/stat/stat.js +55 -0
  82. package/dist/state/states.d.ts +36 -0
  83. package/dist/state/states.js +108 -0
  84. package/dist/styles.css +42 -0
  85. package/dist/switch/switch.d.ts +9 -0
  86. package/dist/switch/switch.js +18 -0
  87. package/dist/table/table.d.ts +28 -0
  88. package/dist/table/table.js +72 -0
  89. package/dist/tabs/tabs.d.ts +26 -0
  90. package/dist/tabs/tabs.js +45 -0
  91. package/dist/tooltip/tooltip.d.ts +17 -0
  92. package/dist/tooltip/tooltip.js +27 -0
  93. package/package.json +57 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 GGEM Farming
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,16 @@
1
- # Temporary Holding Version
1
+ # @ggem-farming/ui
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Accessible React components for GGEM Farming, built on Base UI and styled with Tailwind CSS v4
4
+ and [`@ggem-farming/tokens`](../tokens).
5
+
6
+ ```css
7
+ @import 'tailwindcss';
8
+ @import '@ggem-farming/ui/styles.css';
9
+ ```
10
+
11
+ ```tsx
12
+ import { Button } from '@ggem-farming/ui';
13
+ ```
14
+
15
+ Requires React 18.2+ or 19 and Tailwind CSS 4.1+. See the Storybook for components and usage.
16
+ MIT licensed.
@@ -0,0 +1,41 @@
1
+ import { ReactNode } from "react";
2
+ import { Collapsible as Collapsible$1 } from "@base-ui/react/collapsible";
3
+ import { Accordion as Accordion$1 } from "@base-ui/react/accordion";
4
+ export interface AccordionProps extends Omit<Accordion$1.Root.Props, 'className'> {
5
+ className?: string;
6
+ }
7
+ /**
8
+ * Sections that expand one at a time (or several with `multiple`). Use for secondary detail such
9
+ * as per-item breakdowns, never to hide a page's main content.
10
+ */
11
+ export declare function Accordion({ className, ...props }: AccordionProps): import("react").JSX.Element;
12
+ export interface AccordionItemProps extends Omit<Accordion$1.Item.Props, 'className'> {
13
+ className?: string;
14
+ }
15
+ export declare function AccordionItem({ className, ...props }: AccordionItemProps): import("react").JSX.Element;
16
+ export interface AccordionTriggerProps {
17
+ children: ReactNode;
18
+ /** Extra content on the right of the heading, e.g. a count or status badge. */
19
+ meta?: ReactNode;
20
+ className?: string;
21
+ }
22
+ /** The heading button of an item. Rendered inside an `h3`. */
23
+ export declare function AccordionTrigger({ children, meta, className }: AccordionTriggerProps): import("react").JSX.Element;
24
+ export interface AccordionPanelProps extends Omit<Accordion$1.Panel.Props, 'className'> {
25
+ className?: string;
26
+ }
27
+ export declare function AccordionPanel({ className, children, ...props }: AccordionPanelProps): import("react").JSX.Element;
28
+ export interface CollapsibleProps extends Omit<Collapsible$1.Root.Props, 'className'> {
29
+ className?: string;
30
+ }
31
+ /** One section that shows and hides, e.g. "Show advanced filters". */
32
+ export declare function Collapsible({ className, ...props }: CollapsibleProps): import("react").JSX.Element;
33
+ export interface CollapsibleTriggerProps extends Omit<Collapsible$1.Trigger.Props, 'className' | 'children'> {
34
+ children: ReactNode;
35
+ className?: string;
36
+ }
37
+ export declare function CollapsibleTrigger({ children, className, ...props }: CollapsibleTriggerProps): import("react").JSX.Element;
38
+ export interface CollapsiblePanelProps extends Omit<Collapsible$1.Panel.Props, 'className'> {
39
+ className?: string;
40
+ }
41
+ export declare function CollapsiblePanel({ className, children, ...props }: CollapsiblePanelProps): import("react").JSX.Element;
@@ -0,0 +1,89 @@
1
+ import { cn } from "../lib/cn.js";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { ChevronDown } from "lucide-react";
4
+ import { Collapsible as Collapsible$1 } from "@base-ui/react/collapsible";
5
+ import { Accordion as Accordion$1 } from "@base-ui/react/accordion";
6
+ // src/accordion/accordion.tsx
7
+ const panelMotion = "overflow-hidden transition-[height] duration-normal ease-standard data-starting-style:h-0 data-ending-style:h-0 motion-reduce:transition-none";
8
+ const triggerClass = [
9
+ "group flex w-full items-center gap-2 py-3 text-left text-sm font-medium",
10
+ "hover:text-fg focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",
11
+ "pointer-coarse:min-h-11"
12
+ ].join(" ");
13
+ /**
14
+ * Sections that expand one at a time (or several with `multiple`). Use for secondary detail such
15
+ * as per-item breakdowns, never to hide a page's main content.
16
+ */
17
+ function Accordion({ className, ...props }) {
18
+ return /* @__PURE__ */ jsx(Accordion$1.Root, {
19
+ className: cn("divide-y divide-border border-y border-border", className),
20
+ ...props
21
+ });
22
+ }
23
+ function AccordionItem({ className, ...props }) {
24
+ return /* @__PURE__ */ jsx(Accordion$1.Item, {
25
+ className: cn(className),
26
+ ...props
27
+ });
28
+ }
29
+ /** The heading button of an item. Rendered inside an `h3`. */
30
+ function AccordionTrigger({ children, meta, className }) {
31
+ return /* @__PURE__ */ jsx(Accordion$1.Header, {
32
+ className: "m-0",
33
+ children: /* @__PURE__ */ jsxs(Accordion$1.Trigger, {
34
+ className: cn(triggerClass, className),
35
+ children: [
36
+ /* @__PURE__ */ jsx("span", {
37
+ className: "min-w-0 flex-1",
38
+ children
39
+ }),
40
+ meta && /* @__PURE__ */ jsx("span", {
41
+ className: "shrink-0 text-fg-muted",
42
+ children: meta
43
+ }),
44
+ /* @__PURE__ */ jsx(ChevronDown, {
45
+ className: "size-4 shrink-0 text-fg-muted transition-transform duration-fast group-data-panel-open:rotate-180",
46
+ "aria-hidden": true
47
+ })
48
+ ]
49
+ })
50
+ });
51
+ }
52
+ function AccordionPanel({ className, children, ...props }) {
53
+ return /* @__PURE__ */ jsx(Accordion$1.Panel, {
54
+ className: cn("h-(--accordion-panel-height)", panelMotion),
55
+ ...props,
56
+ children: /* @__PURE__ */ jsx("div", {
57
+ className: cn("pb-4 text-sm", className),
58
+ children
59
+ })
60
+ });
61
+ }
62
+ /** One section that shows and hides, e.g. "Show advanced filters". */
63
+ function Collapsible({ className, ...props }) {
64
+ return /* @__PURE__ */ jsx(Collapsible$1.Root, {
65
+ className: cn(className),
66
+ ...props
67
+ });
68
+ }
69
+ function CollapsibleTrigger({ children, className, ...props }) {
70
+ return /* @__PURE__ */ jsxs(Collapsible$1.Trigger, {
71
+ className: cn("group inline-flex items-center gap-1.5 rounded-md text-sm font-medium text-fg-muted hover:text-fg", "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus pointer-coarse:min-h-11", className),
72
+ ...props,
73
+ children: [children, /* @__PURE__ */ jsx(ChevronDown, {
74
+ className: "size-4 transition-transform duration-fast group-data-panel-open:rotate-180",
75
+ "aria-hidden": true
76
+ })]
77
+ });
78
+ }
79
+ function CollapsiblePanel({ className, children, ...props }) {
80
+ return /* @__PURE__ */ jsx(Collapsible$1.Panel, {
81
+ className: cn("h-(--collapsible-panel-height)", panelMotion),
82
+ ...props,
83
+ children: /* @__PURE__ */ jsx("div", {
84
+ className: cn("pt-3", className),
85
+ children
86
+ })
87
+ });
88
+ }
89
+ export { Accordion, AccordionItem, AccordionPanel, AccordionTrigger, Collapsible, CollapsiblePanel, CollapsibleTrigger };
@@ -0,0 +1,20 @@
1
+ import { VariantProps } from "class-variance-authority";
2
+ declare const avatar: (props?: ({
3
+ size?: "sm" | "md" | "lg" | null | undefined;
4
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
5
+ /** "Chikondi Banda" → "CB". */
6
+ export declare function initials(name: string): string;
7
+ export interface AvatarProps extends VariantProps<typeof avatar> {
8
+ /** The person's name: used for the initials and, with `labelled`, as the accessible name. */
9
+ name: string;
10
+ /** Photo URL. Initials show while it loads or if it fails. */
11
+ src?: string;
12
+ /**
13
+ * Announce the avatar to screen readers. Leave off (default) when the name is already shown
14
+ * next to it, so it isn't read twice.
15
+ */
16
+ labelled?: boolean;
17
+ className?: string;
18
+ }
19
+ export declare const Avatar: import("react").ForwardRefExoticComponent<AvatarProps & import("react").RefAttributes<HTMLSpanElement>>;
20
+ export {};
@@ -0,0 +1,38 @@
1
+ import { cn } from "../lib/cn.js";
2
+ import { cva } from "class-variance-authority";
3
+ import { forwardRef } from "react";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { Avatar as Avatar$1 } from "@base-ui/react/avatar";
6
+ // src/avatar/avatar.tsx
7
+ const avatar = cva("inline-flex shrink-0 items-center justify-center overflow-hidden rounded-full bg-brand-soft font-semibold text-on-brand-soft select-none", {
8
+ variants: { size: {
9
+ sm: "size-6 text-[0.6875rem]",
10
+ md: "size-8 text-xs",
11
+ lg: "size-10 text-sm"
12
+ } },
13
+ defaultVariants: { size: "md" }
14
+ });
15
+ /** "Chikondi Banda" → "CB". */
16
+ function initials(name) {
17
+ const words = name.trim().split(/\s+/).filter(Boolean);
18
+ return `${words[0]?.[0] ?? ""}${words.length > 1 ? words[words.length - 1]?.[0] ?? "" : ""}`.toUpperCase();
19
+ }
20
+ const Avatar = forwardRef(function Avatar({ name, src, size, labelled = false, className }, ref) {
21
+ return /* @__PURE__ */ jsxs(Avatar$1.Root, {
22
+ ref,
23
+ className: cn(avatar({ size }), className),
24
+ ...labelled ? {
25
+ role: "img",
26
+ "aria-label": name
27
+ } : { "aria-hidden": true },
28
+ children: [src && /* @__PURE__ */ jsx(Avatar$1.Image, {
29
+ src,
30
+ alt: "",
31
+ className: "size-full object-cover"
32
+ }), /* @__PURE__ */ jsx(Avatar$1.Fallback, {
33
+ delay: src ? 300 : 0,
34
+ children: initials(name)
35
+ })]
36
+ });
37
+ });
38
+ export { Avatar, initials };
@@ -0,0 +1,16 @@
1
+ import { VariantProps } from "class-variance-authority";
2
+ import { HTMLAttributes } from "react";
3
+ declare const badge: (props?: ({
4
+ variant?: "soft" | "outline" | null | undefined;
5
+ tone?: "danger" | "neutral" | "brand" | "success" | "warning" | "info" | null | undefined;
6
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
+ export interface BadgeProps extends HTMLAttributes<HTMLSpanElement>, VariantProps<typeof badge> {
8
+ /** Show a coloured dot before the text (the default for `outline`). */
9
+ dot?: boolean;
10
+ }
11
+ /**
12
+ * A short status or category label. The text must carry the meaning on its own; colour only
13
+ * reinforces it. Map statuses to tones in one place (a status registry), not per screen.
14
+ */
15
+ export declare const Badge: import("react").ForwardRefExoticComponent<BadgeProps & import("react").RefAttributes<HTMLSpanElement>>;
16
+ export {};
@@ -0,0 +1,85 @@
1
+ import { cn } from "../lib/cn.js";
2
+ import { cva } from "class-variance-authority";
3
+ import { forwardRef } from "react";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ // src/badge/badge.tsx
6
+ const badge = cva("inline-flex shrink-0 items-center gap-1.5 rounded-full px-2 py-0.5 text-xs font-medium whitespace-nowrap", {
7
+ variants: {
8
+ variant: {
9
+ soft: "",
10
+ outline: "border border-border bg-surface text-fg"
11
+ },
12
+ tone: {
13
+ neutral: "",
14
+ brand: "",
15
+ success: "",
16
+ warning: "",
17
+ danger: "",
18
+ info: ""
19
+ }
20
+ },
21
+ compoundVariants: [
22
+ {
23
+ variant: "soft",
24
+ tone: "neutral",
25
+ className: "bg-neutral-soft text-on-neutral-soft"
26
+ },
27
+ {
28
+ variant: "soft",
29
+ tone: "brand",
30
+ className: "bg-brand-soft text-on-brand-soft"
31
+ },
32
+ {
33
+ variant: "soft",
34
+ tone: "success",
35
+ className: "bg-success-soft text-on-success-soft"
36
+ },
37
+ {
38
+ variant: "soft",
39
+ tone: "warning",
40
+ className: "bg-warning-soft text-on-warning-soft"
41
+ },
42
+ {
43
+ variant: "soft",
44
+ tone: "danger",
45
+ className: "bg-danger-soft text-on-danger-soft"
46
+ },
47
+ {
48
+ variant: "soft",
49
+ tone: "info",
50
+ className: "bg-info-soft text-on-info-soft"
51
+ }
52
+ ],
53
+ defaultVariants: {
54
+ variant: "soft",
55
+ tone: "neutral"
56
+ }
57
+ });
58
+ const dotTone = {
59
+ neutral: "bg-neutral",
60
+ brand: "bg-brand",
61
+ success: "bg-success",
62
+ warning: "bg-warning",
63
+ danger: "bg-danger",
64
+ info: "bg-info"
65
+ };
66
+ /**
67
+ * A short status or category label. The text must carry the meaning on its own; colour only
68
+ * reinforces it. Map statuses to tones in one place (a status registry), not per screen.
69
+ */
70
+ const Badge = forwardRef(function Badge({ className, variant, tone, dot, children, ...props }, ref) {
71
+ const showDot = dot ?? variant === "outline";
72
+ return /* @__PURE__ */ jsxs("span", {
73
+ ref,
74
+ className: cn(badge({
75
+ variant,
76
+ tone
77
+ }), className),
78
+ ...props,
79
+ children: [showDot && /* @__PURE__ */ jsx("span", {
80
+ className: cn("size-1.5 rounded-full", dotTone[tone ?? "neutral"]),
81
+ "aria-hidden": true
82
+ }), children]
83
+ });
84
+ });
85
+ export { Badge };
@@ -0,0 +1,19 @@
1
+ import { HTMLAttributes, ReactNode } from "react";
2
+ import { useRender } from "@base-ui/react/use-render";
3
+ export interface BreadcrumbsProps extends HTMLAttributes<HTMLElement> {
4
+ /** `BreadcrumbItem`s from the top level down to the current page. */
5
+ children: ReactNode;
6
+ /** Name for screen readers. Default "Breadcrumb". */
7
+ 'aria-label'?: string;
8
+ }
9
+ /**
10
+ * Where the current page sits, e.g. Farmers › GGEM farmers › Jane Banda. Fits in
11
+ * `PageHeader eyebrow` or above a record header. The last item is the current page.
12
+ */
13
+ export declare function Breadcrumbs({ children, className, 'aria-label': ariaLabel, ...props }: BreadcrumbsProps): import("react").JSX.Element;
14
+ export interface BreadcrumbItemProps extends useRender.ComponentProps<'a'> {
15
+ /** The current page: plain text with `aria-current="page"`, not a link. */
16
+ current?: boolean;
17
+ }
18
+ /** One step. Pass `href`, or `render={<Link to="/farmers" />}` for your router. */
19
+ export declare function BreadcrumbItem({ current, render, className, ...props }: BreadcrumbItemProps): import("react").JSX.Element;
@@ -0,0 +1,44 @@
1
+ import { cn } from "../lib/cn.js";
2
+ import { Children, isValidElement } from "react";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { ChevronRight } from "lucide-react";
5
+ import { mergeProps } from "@base-ui/react/merge-props";
6
+ import { useRender } from "@base-ui/react/use-render";
7
+ // src/breadcrumbs/breadcrumbs.tsx
8
+ /**
9
+ * Where the current page sits, e.g. Farmers › GGEM farmers › Jane Banda. Fits in
10
+ * `PageHeader eyebrow` or above a record header. The last item is the current page.
11
+ */
12
+ function Breadcrumbs({ children, className, "aria-label": ariaLabel = "Breadcrumb", ...props }) {
13
+ const items = Children.toArray(children).filter(isValidElement);
14
+ return /* @__PURE__ */ jsx("nav", {
15
+ "aria-label": ariaLabel,
16
+ className,
17
+ ...props,
18
+ children: /* @__PURE__ */ jsx("ol", {
19
+ className: "flex flex-wrap items-center gap-1 text-sm text-fg-muted",
20
+ children: items.map((item, i) => /* @__PURE__ */ jsxs("li", {
21
+ className: "inline-flex min-w-0 items-center gap-1",
22
+ children: [i > 0 && /* @__PURE__ */ jsx(ChevronRight, {
23
+ className: "size-3.5 shrink-0",
24
+ "aria-hidden": true
25
+ }), item]
26
+ }, item.key ?? i))
27
+ })
28
+ });
29
+ }
30
+ /** One step. Pass `href`, or `render={<Link to="/farmers" />}` for your router. */
31
+ function BreadcrumbItem({ current = false, render, className, ...props }) {
32
+ const element = useRender({
33
+ defaultTagName: "a",
34
+ render,
35
+ props: mergeProps({ className: cn("max-w-[24ch] truncate rounded-sm hover:text-fg hover:underline", "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus", typeof className === "string" ? className : void 0) }, props)
36
+ });
37
+ if (current) return /* @__PURE__ */ jsx("span", {
38
+ "aria-current": "page",
39
+ className: "max-w-[32ch] truncate font-medium text-fg",
40
+ children: props.children
41
+ });
42
+ return element;
43
+ }
44
+ export { BreadcrumbItem, Breadcrumbs };
@@ -0,0 +1,16 @@
1
+ import { Button as Button$1 } from "@base-ui/react/button";
2
+ import { VariantProps } from "class-variance-authority";
3
+ export declare const buttonVariants: (props?: ({
4
+ variant?: "primary" | "secondary" | "ghost" | "danger" | null | undefined;
5
+ size?: "sm" | "md" | "lg" | null | undefined;
6
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
+ export interface ButtonProps extends Omit<Button$1.Props, 'className'>, VariantProps<typeof buttonVariants> {
8
+ className?: string;
9
+ }
10
+ /**
11
+ * An action button. Use `primary` for the main action of a view (one per view), `secondary` for
12
+ * other actions, `ghost` for low-emphasis actions in toolbars and tables, and `danger` only for
13
+ * destructive confirmations. For navigation, style a link instead so it keeps the link role:
14
+ * `<a href="…" className={buttonVariants({ variant: 'secondary' })}>`.
15
+ */
16
+ export declare const Button: import("react").ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & import("react").RefAttributes<HTMLElement>>;
@@ -0,0 +1,49 @@
1
+ import { cn } from "../lib/cn.js";
2
+ import { Button as Button$1 } from "@base-ui/react/button";
3
+ import { cva } from "class-variance-authority";
4
+ import { forwardRef } from "react";
5
+ import { jsx } from "react/jsx-runtime";
6
+ // src/button/button.tsx
7
+ const buttonVariants = cva([
8
+ "inline-flex shrink-0 cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap",
9
+ "rounded-md border font-medium transition-colors duration-fast ease-standard select-none",
10
+ "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",
11
+ "data-disabled:cursor-not-allowed data-disabled:opacity-50",
12
+ "[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
13
+ "pointer-coarse:min-h-11"
14
+ ], {
15
+ variants: {
16
+ variant: {
17
+ primary: "border-transparent bg-primary text-on-primary shadow-xs hover:not-data-disabled:bg-primary-hover",
18
+ secondary: "border-border bg-surface text-fg shadow-xs hover:not-data-disabled:bg-surface-muted",
19
+ ghost: "border-transparent bg-transparent text-fg-muted hover:not-data-disabled:bg-surface-muted hover:not-data-disabled:text-fg",
20
+ danger: "border-transparent bg-danger text-on-danger shadow-xs hover:not-data-disabled:bg-danger-hover"
21
+ },
22
+ size: {
23
+ sm: "h-7 px-2.5 text-sm",
24
+ md: "h-8 px-3 text-base",
25
+ lg: "h-10 px-4 text-base"
26
+ }
27
+ },
28
+ defaultVariants: {
29
+ variant: "primary",
30
+ size: "md"
31
+ }
32
+ });
33
+ /**
34
+ * An action button. Use `primary` for the main action of a view (one per view), `secondary` for
35
+ * other actions, `ghost` for low-emphasis actions in toolbars and tables, and `danger` only for
36
+ * destructive confirmations. For navigation, style a link instead so it keeps the link role:
37
+ * `<a href="…" className={buttonVariants({ variant: 'secondary' })}>`.
38
+ */
39
+ const Button = forwardRef(function Button({ className, variant, size, ...props }, ref) {
40
+ return /* @__PURE__ */ jsx(Button$1, {
41
+ ref,
42
+ className: cn(buttonVariants({
43
+ variant,
44
+ size
45
+ }), className),
46
+ ...props
47
+ });
48
+ });
49
+ export { Button, buttonVariants };
@@ -0,0 +1,17 @@
1
+ import { ButtonProps } from "./button.js";
2
+ import { VariantProps } from "class-variance-authority";
3
+ declare const iconButtonSize: (props?: ({
4
+ size?: "sm" | "md" | "lg" | null | undefined;
5
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
+ export interface IconButtonProps extends Omit<ButtonProps, 'size' | 'aria-label'>, VariantProps<typeof iconButtonSize> {
7
+ /** What the button does, e.g. "Close" or "Next page". Read by screen readers. */
8
+ label: string;
9
+ /** Show `label` as a tooltip on hover and keyboard focus. Defaults to true. */
10
+ tooltip?: boolean;
11
+ }
12
+ /**
13
+ * A square button showing only an icon. `label` is required: it is the accessible name and, by
14
+ * default, a tooltip.
15
+ */
16
+ export declare const IconButton: import("react").ForwardRefExoticComponent<Omit<IconButtonProps, "ref"> & import("react").RefAttributes<HTMLElement>>;
17
+ export {};
@@ -0,0 +1,33 @@
1
+ import { cn } from "../lib/cn.js";
2
+ import { Tooltip } from "../tooltip/tooltip.js";
3
+ import { Button } from "./button.js";
4
+ import { cva } from "class-variance-authority";
5
+ import { forwardRef } from "react";
6
+ import { jsx } from "react/jsx-runtime";
7
+ // src/button/icon-button.tsx
8
+ const iconButtonSize = cva("px-0", {
9
+ variants: { size: {
10
+ sm: "size-7 pointer-coarse:size-11",
11
+ md: "size-8 pointer-coarse:size-11",
12
+ lg: "size-10 pointer-coarse:size-11"
13
+ } },
14
+ defaultVariants: { size: "md" }
15
+ });
16
+ /**
17
+ * A square button showing only an icon. `label` is required: it is the accessible name and, by
18
+ * default, a tooltip.
19
+ */
20
+ const IconButton = forwardRef(function IconButton({ label, size, variant = "ghost", tooltip = true, className, ...props }, ref) {
21
+ const button = /* @__PURE__ */ jsx(Button, {
22
+ ref,
23
+ "aria-label": label,
24
+ variant,
25
+ className: cn(iconButtonSize({ size }), className),
26
+ ...props
27
+ });
28
+ return tooltip ? /* @__PURE__ */ jsx(Tooltip, {
29
+ content: label,
30
+ children: button
31
+ }) : button;
32
+ });
33
+ export { IconButton };
@@ -0,0 +1,16 @@
1
+ import { HTMLAttributes } from "react";
2
+ type DivProps = HTMLAttributes<HTMLDivElement>;
3
+ /** A bordered surface grouping one piece of content: a chart, a list, a set of details. */
4
+ export declare const Card: import("react").ForwardRefExoticComponent<DivProps & import("react").RefAttributes<HTMLDivElement>>;
5
+ /** Title area; put a `CardAction` last to place a link or button on the right. */
6
+ export declare const CardHeader: import("react").ForwardRefExoticComponent<DivProps & import("react").RefAttributes<HTMLDivElement>>;
7
+ export interface CardTitleProps extends HTMLAttributes<HTMLHeadingElement> {
8
+ /** Heading level that fits the page outline. Defaults to h2. */
9
+ as?: 'h2' | 'h3' | 'h4';
10
+ }
11
+ export declare const CardTitle: import("react").ForwardRefExoticComponent<CardTitleProps & import("react").RefAttributes<HTMLHeadingElement>>;
12
+ export declare const CardDescription: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLParagraphElement> & import("react").RefAttributes<HTMLParagraphElement>>;
13
+ export declare const CardAction: import("react").ForwardRefExoticComponent<DivProps & import("react").RefAttributes<HTMLDivElement>>;
14
+ export declare const CardContent: import("react").ForwardRefExoticComponent<DivProps & import("react").RefAttributes<HTMLDivElement>>;
15
+ export declare const CardFooter: import("react").ForwardRefExoticComponent<DivProps & import("react").RefAttributes<HTMLDivElement>>;
16
+ export {};
@@ -0,0 +1,56 @@
1
+ import { cn } from "../lib/cn.js";
2
+ import { forwardRef } from "react";
3
+ import { jsx } from "react/jsx-runtime";
4
+ // src/card/card.tsx
5
+ /** A bordered surface grouping one piece of content: a chart, a list, a set of details. */
6
+ const Card = forwardRef(function Card({ className, ...props }, ref) {
7
+ return /* @__PURE__ */ jsx("div", {
8
+ ref,
9
+ className: cn("flex flex-col rounded-xl border border-border bg-surface text-fg", className),
10
+ ...props
11
+ });
12
+ });
13
+ /** Title area; put a `CardAction` last to place a link or button on the right. */
14
+ const CardHeader = forwardRef(function CardHeader({ className, ...props }, ref) {
15
+ return /* @__PURE__ */ jsx("div", {
16
+ ref,
17
+ className: cn("flex items-start justify-between gap-3 px-5 pt-4", className),
18
+ ...props
19
+ });
20
+ });
21
+ const CardTitle = forwardRef(function CardTitle({ as: Heading = "h2", className, ...props }, ref) {
22
+ return /* @__PURE__ */ jsx(Heading, {
23
+ ref,
24
+ className: cn("text-base font-semibold", className),
25
+ ...props
26
+ });
27
+ });
28
+ const CardDescription = forwardRef(function CardDescription({ className, ...props }, ref) {
29
+ return /* @__PURE__ */ jsx("p", {
30
+ ref,
31
+ className: cn("text-sm text-fg-muted", className),
32
+ ...props
33
+ });
34
+ });
35
+ const CardAction = forwardRef(function CardAction({ className, ...props }, ref) {
36
+ return /* @__PURE__ */ jsx("div", {
37
+ ref,
38
+ className: cn("flex shrink-0 items-center gap-2", className),
39
+ ...props
40
+ });
41
+ });
42
+ const CardContent = forwardRef(function CardContent({ className, ...props }, ref) {
43
+ return /* @__PURE__ */ jsx("div", {
44
+ ref,
45
+ className: cn("flex-1 px-5 pt-3 pb-5", className),
46
+ ...props
47
+ });
48
+ });
49
+ const CardFooter = forwardRef(function CardFooter({ className, ...props }, ref) {
50
+ return /* @__PURE__ */ jsx("div", {
51
+ ref,
52
+ className: cn("flex items-center gap-2 border-t border-border px-5 py-3", className),
53
+ ...props
54
+ });
55
+ });
56
+ export { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
@@ -0,0 +1,15 @@
1
+ import { Checkbox as Checkbox$1 } from "@base-ui/react/checkbox";
2
+ import { CheckboxGroup as CheckboxGroup$1 } from "@base-ui/react/checkbox-group";
3
+ export interface CheckboxProps extends Omit<Checkbox$1.Root.Props, 'className'> {
4
+ className?: string;
5
+ }
6
+ /**
7
+ * A checkbox. Label it by wrapping it in `FieldLabel` (or a `<label>`), or with `aria-label`.
8
+ * Set `indeterminate` for a "some selected" state, e.g. a select-all box in a table header.
9
+ */
10
+ export declare const Checkbox: import("react").ForwardRefExoticComponent<Omit<CheckboxProps, "ref"> & import("react").RefAttributes<HTMLElement>>;
11
+ export interface CheckboxGroupProps extends Omit<CheckboxGroup$1.Props, 'className'> {
12
+ className?: string;
13
+ }
14
+ /** Holds several checkboxes that share one array value. Pair with `Fieldset` for a label. */
15
+ export declare const CheckboxGroup: import("react").ForwardRefExoticComponent<Omit<CheckboxGroupProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,47 @@
1
+ import { cn } from "../lib/cn.js";
2
+ import { forwardRef } from "react";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { Checkbox as Checkbox$1 } from "@base-ui/react/checkbox";
5
+ import { CheckboxGroup as CheckboxGroup$1 } from "@base-ui/react/checkbox-group";
6
+ import { Check, Minus } from "lucide-react";
7
+ // src/checkbox/checkbox.tsx
8
+ /** Classes for small toggles (checkbox, radio): 16px box, 44px hit area on touch screens. */
9
+ const toggleBox = [
10
+ "group relative inline-flex size-4 shrink-0 items-center justify-center border border-input bg-surface shadow-xs",
11
+ "transition-colors duration-fast ease-standard",
12
+ "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",
13
+ "data-invalid:border-danger data-disabled:cursor-not-allowed data-disabled:opacity-50",
14
+ "pointer-coarse:before:absolute pointer-coarse:before:-inset-3.5"
15
+ ].join(" ");
16
+ /**
17
+ * A checkbox. Label it by wrapping it in `FieldLabel` (or a `<label>`), or with `aria-label`.
18
+ * Set `indeterminate` for a "some selected" state, e.g. a select-all box in a table header.
19
+ */
20
+ const Checkbox = forwardRef(function Checkbox({ className, ...props }, ref) {
21
+ return /* @__PURE__ */ jsx(Checkbox$1.Root, {
22
+ ref,
23
+ className: cn(toggleBox, "mt-0.5 rounded-sm data-checked:border-primary data-checked:bg-primary data-checked:text-on-primary", "data-indeterminate:border-primary data-indeterminate:bg-primary data-indeterminate:text-on-primary", className),
24
+ ...props,
25
+ children: /* @__PURE__ */ jsxs(Checkbox$1.Indicator, {
26
+ className: "flex data-unchecked:hidden",
27
+ children: [/* @__PURE__ */ jsx(Check, {
28
+ className: "size-3 group-data-indeterminate:hidden",
29
+ strokeWidth: 3,
30
+ "aria-hidden": true
31
+ }), /* @__PURE__ */ jsx(Minus, {
32
+ className: "hidden size-3 group-data-indeterminate:block",
33
+ strokeWidth: 3,
34
+ "aria-hidden": true
35
+ })]
36
+ })
37
+ });
38
+ });
39
+ /** Holds several checkboxes that share one array value. Pair with `Fieldset` for a label. */
40
+ const CheckboxGroup = forwardRef(function CheckboxGroup({ className, ...props }, ref) {
41
+ return /* @__PURE__ */ jsx(CheckboxGroup$1, {
42
+ ref,
43
+ className: cn("flex flex-col gap-2", className),
44
+ ...props
45
+ });
46
+ });
47
+ export { Checkbox, CheckboxGroup, toggleBox };