@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
@@ -0,0 +1,79 @@
1
+ import { cn } from "../lib/cn.js";
2
+ import { forwardRef } from "react";
3
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
+ // src/layout/record.tsx
5
+ /** One layout for every record page (farmer, contract, partner): header, summary rail, tabs. */
6
+ const RecordLayout = forwardRef(function RecordLayout({ header, aside, asideLabel = "Summary", children, className, ...props }, ref) {
7
+ return /* @__PURE__ */ jsxs("div", {
8
+ ref,
9
+ className: cn("mx-auto flex w-full max-w-7xl flex-col gap-6 px-4 py-6 lg:px-8 lg:py-8", className),
10
+ ...props,
11
+ children: [header, /* @__PURE__ */ jsxs("div", {
12
+ className: cn("grid gap-6", aside !== void 0 && "lg:grid-cols-[minmax(0,1fr)_18rem]"),
13
+ children: [aside !== void 0 && /* @__PURE__ */ jsx("aside", {
14
+ "aria-label": asideLabel,
15
+ className: "flex flex-col gap-4 lg:order-last",
16
+ children: aside
17
+ }), /* @__PURE__ */ jsx("div", {
18
+ className: "min-w-0",
19
+ children
20
+ })]
21
+ })]
22
+ });
23
+ });
24
+ const RecordHeader = forwardRef(function RecordHeader({ title, media, status, meta, actions, as: Heading = "h2", className, ...props }, ref) {
25
+ return /* @__PURE__ */ jsxs("div", {
26
+ ref,
27
+ className: cn("flex flex-wrap items-center gap-3", className),
28
+ ...props,
29
+ children: [
30
+ media,
31
+ /* @__PURE__ */ jsxs("div", {
32
+ className: "min-w-[12rem] flex-1",
33
+ children: [/* @__PURE__ */ jsxs("div", {
34
+ className: "flex flex-wrap items-center gap-2",
35
+ children: [/* @__PURE__ */ jsx(Heading, {
36
+ className: "text-2xl font-semibold tracking-tight",
37
+ children: title
38
+ }), status]
39
+ }), meta && /* @__PURE__ */ jsx("p", {
40
+ className: "text-sm text-fg-muted",
41
+ children: meta
42
+ })]
43
+ }),
44
+ actions && /* @__PURE__ */ jsx("div", {
45
+ className: "flex flex-wrap gap-2",
46
+ children: actions
47
+ })
48
+ ]
49
+ });
50
+ });
51
+ /** Label/value pairs for record details. Never shows raw IDs or true/false: format values first. */
52
+ const DetailList = forwardRef(function DetailList({ items, columns = 1, className, ...props }, ref) {
53
+ return /* @__PURE__ */ jsx("dl", {
54
+ ref,
55
+ className: cn("grid text-sm", columns === 2 && "gap-x-8 sm:grid-cols-2", className),
56
+ ...props,
57
+ children: items.map((item, i) => {
58
+ const empty = item.value === void 0 || item.value === null || item.value === "";
59
+ return /* @__PURE__ */ jsxs("div", {
60
+ className: "flex justify-between gap-4 border-b border-border py-2.5",
61
+ children: [/* @__PURE__ */ jsx("dt", {
62
+ className: "text-fg-muted",
63
+ children: item.label
64
+ }), /* @__PURE__ */ jsx("dd", {
65
+ className: "text-right font-medium",
66
+ children: empty ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
67
+ "aria-hidden": true,
68
+ className: "text-fg-muted",
69
+ children: "—"
70
+ }), /* @__PURE__ */ jsx("span", {
71
+ className: "sr-only",
72
+ children: "Not recorded"
73
+ })] }) : item.value
74
+ })]
75
+ }, i);
76
+ })
77
+ });
78
+ });
79
+ export { DetailList, RecordHeader, RecordLayout };
@@ -0,0 +1,3 @@
1
+ import { ClassValue } from "clsx";
2
+ /** Joins class names and resolves Tailwind conflicts so later classes win. */
3
+ export declare function cn(...inputs: ClassValue[]): string;
package/dist/lib/cn.js ADDED
@@ -0,0 +1,18 @@
1
+ import { clsx } from "clsx";
2
+ import { extendTailwindMerge } from "tailwind-merge";
3
+ // src/lib/cn.ts
4
+ const twMerge = extendTailwindMerge({ extend: { theme: { text: [
5
+ "xs",
6
+ "sm",
7
+ "base",
8
+ "lg",
9
+ "xl",
10
+ "2xl",
11
+ "3xl",
12
+ "4xl"
13
+ ] } } });
14
+ /** Joins class names and resolves Tailwind conflicts so later classes win. */
15
+ function cn(...inputs) {
16
+ return twMerge(clsx(inputs));
17
+ }
18
+ export { cn };
@@ -0,0 +1,14 @@
1
+ // src/lib/control.ts
2
+ /** Shared look for text-entry controls (Input, Textarea, Select trigger, Combobox group). */
3
+ const controlFrame = [
4
+ "w-full rounded-md border border-input bg-surface text-base text-fg shadow-xs",
5
+ "transition-colors duration-fast ease-standard",
6
+ "data-invalid:border-danger",
7
+ "data-disabled:cursor-not-allowed data-disabled:opacity-50",
8
+ "pointer-coarse:text-lg"
9
+ ].join(" ");
10
+ /** Focus ring for a control that is itself focusable. */
11
+ const controlFocus = "focus:outline-2 focus:-outline-offset-1 focus:outline-focus data-invalid:focus:outline-danger";
12
+ /** Single-line height: 32px, 44px on touch screens. */
13
+ const controlHeight = "h-8 pointer-coarse:h-11";
14
+ export { controlFocus, controlFrame, controlHeight };
@@ -0,0 +1,20 @@
1
+ // src/lib/popup.ts
2
+ /** Shared look for floating lists (Select, Combobox, Menu). */
3
+ const popupSurface = [
4
+ "origin-(--transform-origin) rounded-lg border border-border bg-surface-raised text-fg shadow-lg outline-none",
5
+ "transition-[scale,opacity] duration-fast ease-standard",
6
+ "data-starting-style:scale-95 data-starting-style:opacity-0",
7
+ "data-ending-style:scale-95 data-ending-style:opacity-0"
8
+ ].join(" ");
9
+ const popupItem = [
10
+ "relative flex cursor-default items-center gap-2 rounded-md px-2 py-1.5 text-base outline-none select-none",
11
+ "data-highlighted:bg-surface-hover data-disabled:cursor-not-allowed data-disabled:opacity-50",
12
+ "pointer-coarse:min-h-11 pointer-coarse:text-lg"
13
+ ].join(" ");
14
+ /** Small icon button placed inside a control (clear, open). */
15
+ const inlineIconButton = [
16
+ "grid size-6 shrink-0 place-items-center rounded text-fg-muted",
17
+ "hover:bg-surface-hover hover:text-fg focus-visible:outline-2 focus-visible:outline-focus",
18
+ "pointer-coarse:size-9"
19
+ ].join(" ");
20
+ export { inlineIconButton, popupItem, popupSurface };
@@ -0,0 +1,45 @@
1
+ import { Menu as Menu$1 } from "@base-ui/react/menu";
2
+ export declare const Menu: typeof Menu$1.Root;
3
+ export type MenuProps = Menu$1.Root.Props;
4
+ /**
5
+ * Opens the menu. For a row's overflow actions:
6
+ * `<MenuTrigger render={<IconButton label="Actions for Chikondi Banda"><MoreHorizontal /></IconButton>} />`.
7
+ */
8
+ export declare const MenuTrigger: Menu$1.Trigger;
9
+ export interface MenuContentProps extends Omit<Menu$1.Popup.Props, 'className'> {
10
+ className?: string;
11
+ side?: Menu$1.Positioner.Props['side'];
12
+ align?: Menu$1.Positioner.Props['align'];
13
+ sideOffset?: number;
14
+ }
15
+ export declare const MenuContent: import("react").ForwardRefExoticComponent<Omit<MenuContentProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
16
+ export interface MenuItemProps extends Omit<Menu$1.Item.Props, 'className'> {
17
+ className?: string;
18
+ /** `danger` for destructive actions; confirm them with ConfirmDialog. */
19
+ tone?: 'default' | 'danger';
20
+ }
21
+ export declare const MenuItem: import("react").ForwardRefExoticComponent<Omit<MenuItemProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
22
+ export type MenuLinkItemProps = Omit<Menu$1.LinkItem.Props, 'className'> & {
23
+ className?: string;
24
+ };
25
+ /** A menu item that navigates. Pass `href`, or `render` with your router's link. */
26
+ export declare const MenuLinkItem: import("react").ForwardRefExoticComponent<Omit<MenuLinkItemProps, "ref"> & import("react").RefAttributes<HTMLAnchorElement>>;
27
+ export type MenuCheckboxItemProps = Omit<Menu$1.CheckboxItem.Props, 'className'> & {
28
+ className?: string;
29
+ };
30
+ /** A toggle in a menu, e.g. showing or hiding a table column. */
31
+ export declare const MenuCheckboxItem: import("react").ForwardRefExoticComponent<Omit<MenuCheckboxItemProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
32
+ export declare const MenuRadioGroup: import("react").NamedExoticComponent<Omit<import("@base-ui/react").ContextMenuRadioGroupProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
33
+ export type MenuRadioItemProps = Omit<Menu$1.RadioItem.Props, 'className'> & {
34
+ className?: string;
35
+ };
36
+ /** One choice in a MenuRadioGroup, e.g. a sort order. */
37
+ export declare const MenuRadioItem: import("react").ForwardRefExoticComponent<Omit<MenuRadioItemProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
38
+ export declare function MenuSeparator({ className }: {
39
+ className?: string;
40
+ }): import("react").JSX.Element;
41
+ export declare const MenuGroup: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").ContextMenuGroupProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
42
+ export type MenuGroupLabelProps = Omit<Menu$1.GroupLabel.Props, 'className'> & {
43
+ className?: string;
44
+ };
45
+ export declare const MenuGroupLabel: import("react").ForwardRefExoticComponent<Omit<MenuGroupLabelProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,85 @@
1
+ import { cn } from "../lib/cn.js";
2
+ import { popupItem, popupSurface } from "../lib/popup.js";
3
+ import { forwardRef } from "react";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { Check } from "lucide-react";
6
+ import { Menu as Menu$2 } from "@base-ui/react/menu";
7
+ // src/menu/menu.tsx
8
+ const Menu = Menu$2.Root;
9
+ /**
10
+ * Opens the menu. For a row's overflow actions:
11
+ * `<MenuTrigger render={<IconButton label="Actions for Chikondi Banda"><MoreHorizontal /></IconButton>} />`.
12
+ */
13
+ const MenuTrigger = Menu$2.Trigger;
14
+ const MenuContent = forwardRef(function MenuContent({ className, side = "bottom", align = "start", sideOffset = 4, ...props }, ref) {
15
+ return /* @__PURE__ */ jsx(Menu$2.Portal, { children: /* @__PURE__ */ jsx(Menu$2.Positioner, {
16
+ side,
17
+ align,
18
+ sideOffset,
19
+ className: "z-(--z-popover) outline-none",
20
+ children: /* @__PURE__ */ jsx(Menu$2.Popup, {
21
+ ref,
22
+ className: cn(popupSurface, "min-w-48 max-w-(--available-width) p-1", className),
23
+ ...props
24
+ })
25
+ }) });
26
+ });
27
+ const itemIcons = "[&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:text-fg-muted";
28
+ const MenuItem = forwardRef(function MenuItem({ className, tone = "default", ...props }, ref) {
29
+ return /* @__PURE__ */ jsx(Menu$2.Item, {
30
+ ref,
31
+ className: cn(popupItem, itemIcons, tone === "danger" && "text-on-danger-soft data-highlighted:bg-danger-soft [&_svg]:text-on-danger-soft", className),
32
+ ...props
33
+ });
34
+ });
35
+ /** A menu item that navigates. Pass `href`, or `render` with your router's link. */
36
+ const MenuLinkItem = forwardRef(function MenuLinkItem({ className, ...props }, ref) {
37
+ return /* @__PURE__ */ jsx(Menu$2.LinkItem, {
38
+ ref,
39
+ className: cn(popupItem, itemIcons, className),
40
+ ...props
41
+ });
42
+ });
43
+ /** A toggle in a menu, e.g. showing or hiding a table column. */
44
+ const MenuCheckboxItem = forwardRef(function MenuCheckboxItem({ className, children, ...props }, ref) {
45
+ return /* @__PURE__ */ jsxs(Menu$2.CheckboxItem, {
46
+ ref,
47
+ className: cn(popupItem, "pl-8", className),
48
+ ...props,
49
+ children: [/* @__PURE__ */ jsx(Menu$2.CheckboxItemIndicator, {
50
+ className: "absolute left-2 flex",
51
+ children: /* @__PURE__ */ jsx(Check, {
52
+ className: "size-4",
53
+ "aria-hidden": true
54
+ })
55
+ }), children]
56
+ });
57
+ });
58
+ const MenuRadioGroup = Menu$2.RadioGroup;
59
+ /** One choice in a MenuRadioGroup, e.g. a sort order. */
60
+ const MenuRadioItem = forwardRef(function MenuRadioItem({ className, children, ...props }, ref) {
61
+ return /* @__PURE__ */ jsxs(Menu$2.RadioItem, {
62
+ ref,
63
+ className: cn(popupItem, "pl-8", className),
64
+ ...props,
65
+ children: [/* @__PURE__ */ jsx(Menu$2.RadioItemIndicator, {
66
+ className: "absolute left-2 flex",
67
+ children: /* @__PURE__ */ jsx(Check, {
68
+ className: "size-4",
69
+ "aria-hidden": true
70
+ })
71
+ }), children]
72
+ });
73
+ });
74
+ function MenuSeparator({ className }) {
75
+ return /* @__PURE__ */ jsx(Menu$2.Separator, { className: cn("-mx-1 my-1 h-px bg-border", className) });
76
+ }
77
+ const MenuGroup = Menu$2.Group;
78
+ const MenuGroupLabel = forwardRef(function MenuGroupLabel({ className, ...props }, ref) {
79
+ return /* @__PURE__ */ jsx(Menu$2.GroupLabel, {
80
+ ref,
81
+ className: cn("px-2 py-1.5 text-xs font-medium text-fg-muted", className),
82
+ ...props
83
+ });
84
+ });
85
+ export { Menu, MenuCheckboxItem, MenuContent, MenuGroup, MenuGroupLabel, MenuItem, MenuLinkItem, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuTrigger };
@@ -0,0 +1,22 @@
1
+ import { Popover as Popover$1 } from "@base-ui/react/popover";
2
+ export declare const Popover: typeof Popover$1.Root;
3
+ export type PopoverProps = Popover$1.Root.Props;
4
+ /** Opens the popover. Use `render={<Button variant="secondary" />}`. */
5
+ export declare const PopoverTrigger: Popover$1.Trigger;
6
+ export interface PopoverContentProps extends Omit<Popover$1.Popup.Props, 'className'> {
7
+ className?: string;
8
+ side?: Popover$1.Positioner.Props['side'];
9
+ align?: Popover$1.Positioner.Props['align'];
10
+ sideOffset?: number;
11
+ }
12
+ /** Floating panel for small, non-blocking content (a filter, a quick note). */
13
+ export declare const PopoverContent: import("react").ForwardRefExoticComponent<Omit<PopoverContentProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
14
+ export type PopoverTitleProps = Omit<Popover$1.Title.Props, 'className'> & {
15
+ className?: string;
16
+ };
17
+ export declare const PopoverTitle: import("react").ForwardRefExoticComponent<Omit<PopoverTitleProps, "ref"> & import("react").RefAttributes<HTMLHeadingElement>>;
18
+ export type PopoverDescriptionProps = Omit<Popover$1.Description.Props, 'className'> & {
19
+ className?: string;
20
+ };
21
+ export declare const PopoverDescription: import("react").ForwardRefExoticComponent<Omit<PopoverDescriptionProps, "ref"> & import("react").RefAttributes<HTMLParagraphElement>>;
22
+ export declare const PopoverClose: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").PopoverCloseProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,39 @@
1
+ import { cn } from "../lib/cn.js";
2
+ import { popupSurface } from "../lib/popup.js";
3
+ import { forwardRef } from "react";
4
+ import { jsx } from "react/jsx-runtime";
5
+ import { Popover as Popover$1 } from "@base-ui/react/popover";
6
+ // src/popover/popover.tsx
7
+ const Popover = Popover$1.Root;
8
+ /** Opens the popover. Use `render={<Button variant="secondary" />}`. */
9
+ const PopoverTrigger = Popover$1.Trigger;
10
+ /** Floating panel for small, non-blocking content (a filter, a quick note). */
11
+ const PopoverContent = forwardRef(function PopoverContent({ className, side = "bottom", align = "start", sideOffset = 6, ...props }, ref) {
12
+ return /* @__PURE__ */ jsx(Popover$1.Portal, { children: /* @__PURE__ */ jsx(Popover$1.Positioner, {
13
+ side,
14
+ align,
15
+ sideOffset,
16
+ className: "z-(--z-popover)",
17
+ children: /* @__PURE__ */ jsx(Popover$1.Popup, {
18
+ ref,
19
+ className: cn(popupSurface, "w-72 max-w-(--available-width) p-4", className),
20
+ ...props
21
+ })
22
+ }) });
23
+ });
24
+ const PopoverTitle = forwardRef(function PopoverTitle({ className, ...props }, ref) {
25
+ return /* @__PURE__ */ jsx(Popover$1.Title, {
26
+ ref,
27
+ className: cn("text-base font-semibold", className),
28
+ ...props
29
+ });
30
+ });
31
+ const PopoverDescription = forwardRef(function PopoverDescription({ className, ...props }, ref) {
32
+ return /* @__PURE__ */ jsx(Popover$1.Description, {
33
+ ref,
34
+ className: cn("text-sm text-fg-muted", className),
35
+ ...props
36
+ });
37
+ });
38
+ const PopoverClose = Popover$1.Close;
39
+ export { Popover, PopoverClose, PopoverContent, PopoverDescription, PopoverTitle, PopoverTrigger };
@@ -0,0 +1,12 @@
1
+ import { Radio as Radio$1 } from "@base-ui/react/radio";
2
+ import { RadioGroup as RadioGroup$1 } from "@base-ui/react/radio-group";
3
+ export interface RadioGroupProps extends Omit<RadioGroup$1.Props, 'className'> {
4
+ className?: string;
5
+ }
6
+ /** A set of radios with one value. Label it with `Fieldset render={<RadioGroup />}`. */
7
+ export declare const RadioGroup: import("react").ForwardRefExoticComponent<Omit<RadioGroupProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
8
+ export interface RadioProps extends Omit<Radio$1.Root.Props, 'className'> {
9
+ className?: string;
10
+ }
11
+ /** One option in a `RadioGroup`. Label it by wrapping it in `FieldLabel`. */
12
+ export declare const Radio: import("react").ForwardRefExoticComponent<Omit<RadioProps, "ref"> & import("react").RefAttributes<HTMLElement>>;
@@ -0,0 +1,25 @@
1
+ import { toggleBox } from "../checkbox/checkbox.js";
2
+ import { cn } from "../lib/cn.js";
3
+ import { forwardRef } from "react";
4
+ import { jsx } from "react/jsx-runtime";
5
+ import { Radio as Radio$1 } from "@base-ui/react/radio";
6
+ import { RadioGroup as RadioGroup$1 } from "@base-ui/react/radio-group";
7
+ // src/radio/radio.tsx
8
+ /** A set of radios with one value. Label it with `Fieldset render={<RadioGroup />}`. */
9
+ const RadioGroup = forwardRef(function RadioGroup({ className, ...props }, ref) {
10
+ return /* @__PURE__ */ jsx(RadioGroup$1, {
11
+ ref,
12
+ className: cn("flex flex-col gap-2", className),
13
+ ...props
14
+ });
15
+ });
16
+ /** One option in a `RadioGroup`. Label it by wrapping it in `FieldLabel`. */
17
+ const Radio = forwardRef(function Radio({ className, ...props }, ref) {
18
+ return /* @__PURE__ */ jsx(Radio$1.Root, {
19
+ ref,
20
+ className: cn(toggleBox, "mt-0.5 rounded-full data-checked:border-primary data-checked:bg-primary", className),
21
+ ...props,
22
+ children: /* @__PURE__ */ jsx(Radio$1.Indicator, { className: "size-1.5 rounded-full bg-on-primary data-unchecked:hidden" })
23
+ });
24
+ });
25
+ export { Radio, RadioGroup };
@@ -0,0 +1,23 @@
1
+ import { ReactNode } from "react";
2
+ import { Select as Select$1 } from "@base-ui/react/select";
3
+ export interface SelectOption<Value> {
4
+ value: Value;
5
+ label: ReactNode;
6
+ disabled?: boolean;
7
+ }
8
+ export interface SelectProps<Value> extends Omit<Select$1.Root.Props<Value>, 'items' | 'children' | 'multiple'> {
9
+ /** The choices. `value` is what the app stores (usually an ID); `label` is what users see. */
10
+ options: readonly SelectOption<Value>[];
11
+ /** Visible label. Without one, pass `aria-label`. */
12
+ label?: ReactNode;
13
+ 'aria-label'?: string;
14
+ placeholder?: ReactNode;
15
+ /** Classes for the trigger button. */
16
+ className?: string;
17
+ }
18
+ /**
19
+ * Pick one value from a short, fixed list (up to ~15 options). For long or searchable lists use
20
+ * `Combobox`. Inside a `Field` it is described and validated by that field; pass `label` here
21
+ * rather than `FieldLabel`.
22
+ */
23
+ export declare function Select<Value>({ options, label, placeholder, className, 'aria-label': ariaLabel, ...props }: SelectProps<Value>): import("react").JSX.Element;
@@ -0,0 +1,66 @@
1
+ import "../field/field.js";
2
+ import { cn } from "../lib/cn.js";
3
+ import { controlFrame, controlHeight } from "../lib/control.js";
4
+ import { popupItem, popupSurface } from "../lib/popup.js";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { Check, ChevronsUpDown } from "lucide-react";
7
+ import { Select as Select$1 } from "@base-ui/react/select";
8
+ // src/select/select.tsx
9
+ /**
10
+ * Pick one value from a short, fixed list (up to ~15 options). For long or searchable lists use
11
+ * `Combobox`. Inside a `Field` it is described and validated by that field; pass `label` here
12
+ * rather than `FieldLabel`.
13
+ */
14
+ function Select({ options, label, placeholder, className, "aria-label": ariaLabel, ...props }) {
15
+ return /* @__PURE__ */ jsxs(Select$1.Root, {
16
+ items: options,
17
+ ...props,
18
+ children: [
19
+ label !== void 0 && /* @__PURE__ */ jsx(Select$1.Label, {
20
+ className: cn("text-sm font-medium text-fg data-disabled:cursor-not-allowed data-disabled:opacity-50", "cursor-default"),
21
+ children: label
22
+ }),
23
+ /* @__PURE__ */ jsxs(Select$1.Trigger, {
24
+ "aria-label": ariaLabel ?? (typeof label === "string" ? label : void 0),
25
+ className: cn(controlFrame, controlHeight, "flex cursor-default items-center justify-between gap-2 pr-2 pl-2.5 text-left select-none", "hover:not-data-disabled:bg-surface-hover data-popup-open:bg-surface-hover", "focus-visible:outline-2 focus-visible:-outline-offset-1 focus-visible:outline-focus", className),
26
+ children: [/* @__PURE__ */ jsx(Select$1.Value, {
27
+ placeholder,
28
+ className: "min-w-0 truncate data-placeholder:text-fg-muted"
29
+ }), /* @__PURE__ */ jsx(Select$1.Icon, {
30
+ className: "flex text-fg-muted",
31
+ children: /* @__PURE__ */ jsx(ChevronsUpDown, {
32
+ className: "size-4",
33
+ "aria-hidden": true
34
+ })
35
+ })]
36
+ }),
37
+ /* @__PURE__ */ jsx(Select$1.Portal, { children: /* @__PURE__ */ jsx(Select$1.Positioner, {
38
+ alignItemWithTrigger: false,
39
+ sideOffset: 4,
40
+ className: "z-(--z-popover) outline-none select-none",
41
+ children: /* @__PURE__ */ jsx(Select$1.Popup, {
42
+ className: cn(popupSurface, "min-w-(--anchor-width)"),
43
+ children: /* @__PURE__ */ jsx(Select$1.List, {
44
+ className: "max-h-[min(24rem,var(--available-height))] scroll-py-1 overflow-y-auto p-1",
45
+ children: options.map((option) => /* @__PURE__ */ jsxs(Select$1.Item, {
46
+ value: option.value,
47
+ disabled: option.disabled ?? false,
48
+ className: cn(popupItem, "justify-between"),
49
+ children: [/* @__PURE__ */ jsx(Select$1.ItemText, {
50
+ className: "min-w-0 truncate",
51
+ children: option.label
52
+ }), /* @__PURE__ */ jsx(Select$1.ItemIndicator, {
53
+ className: "flex text-fg",
54
+ children: /* @__PURE__ */ jsx(Check, {
55
+ className: "size-4",
56
+ "aria-hidden": true
57
+ })
58
+ })]
59
+ }, String(option.value)))
60
+ })
61
+ })
62
+ }) })
63
+ ]
64
+ });
65
+ }
66
+ export { Select };
@@ -0,0 +1,6 @@
1
+ import { Separator as Separator$1 } from "@base-ui/react/separator";
2
+ export type SeparatorProps = Omit<Separator$1.Props, 'className'> & {
3
+ className?: string;
4
+ };
5
+ /** A dividing line between groups of content. `orientation="vertical"` inside a row. */
6
+ export declare const Separator: import("react").ForwardRefExoticComponent<Omit<SeparatorProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,14 @@
1
+ import { cn } from "../lib/cn.js";
2
+ import { forwardRef } from "react";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { Separator as Separator$1 } from "@base-ui/react/separator";
5
+ // src/separator/separator.tsx
6
+ /** A dividing line between groups of content. `orientation="vertical"` inside a row. */
7
+ const Separator = forwardRef(function Separator({ className, ...props }, ref) {
8
+ return /* @__PURE__ */ jsx(Separator$1, {
9
+ ref,
10
+ className: cn("shrink-0 bg-border", "data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full", "data-[orientation=vertical]:w-px data-[orientation=vertical]:self-stretch", className),
11
+ ...props
12
+ });
13
+ });
14
+ export { Separator };
@@ -0,0 +1,28 @@
1
+ import { HTMLAttributes, ReactNode } from "react";
2
+ /**
3
+ * A strip of key figures (at most 4 per view). Columns are divided by 1px lines at any width.
4
+ * Sizes itself from the space it is given, not the screen: two columns, then one row once there
5
+ * is room, so it fits a full-width dashboard, a record's main column or a phone.
6
+ * Renders a description list; put only `Stat`s inside.
7
+ */
8
+ export declare const StatGroup: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDListElement> & import("react").RefAttributes<HTMLDListElement>>;
9
+ declare const deltaTone: {
10
+ readonly positive: "bg-success-soft text-on-success-soft";
11
+ readonly negative: "bg-danger-soft text-on-danger-soft";
12
+ readonly neutral: "bg-neutral-soft text-on-neutral-soft";
13
+ };
14
+ export interface StatProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
15
+ label: ReactNode;
16
+ /** Formatted value, e.g. "3,527" or "MWK 1.2M". */
17
+ value: ReactNode;
18
+ /** Change or ratio, e.g. "+86" or "82%". Write it so it reads correctly as text. */
19
+ delta?: ReactNode;
20
+ /** Arrow direction for `delta`. Omit for ratios. */
21
+ trend?: 'up' | 'down';
22
+ /** Whether the change is good or bad news (a rising debt is `negative`). */
23
+ deltaTone?: keyof typeof deltaTone;
24
+ /** Context for the delta, e.g. "this month". */
25
+ note?: ReactNode;
26
+ }
27
+ export declare const Stat: import("react").ForwardRefExoticComponent<StatProps & import("react").RefAttributes<HTMLDivElement>>;
28
+ export {};
@@ -0,0 +1,55 @@
1
+ import { cn } from "../lib/cn.js";
2
+ import { forwardRef } from "react";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { ArrowDownRight, ArrowUpRight } from "lucide-react";
5
+ // src/stat/stat.tsx
6
+ /**
7
+ * A strip of key figures (at most 4 per view). Columns are divided by 1px lines at any width.
8
+ * Sizes itself from the space it is given, not the screen: two columns, then one row once there
9
+ * is room, so it fits a full-width dashboard, a record's main column or a phone.
10
+ * Renders a description list; put only `Stat`s inside.
11
+ */
12
+ const StatGroup = forwardRef(function StatGroup({ className, ...props }, ref) {
13
+ return /* @__PURE__ */ jsx("div", {
14
+ className: "@container",
15
+ children: /* @__PURE__ */ jsx("dl", {
16
+ ref,
17
+ className: cn("grid grid-cols-2 gap-px overflow-hidden rounded-xl border border-border bg-border", "[&>:last-child:nth-child(odd)]:col-span-2", "@2xl:auto-cols-fr @2xl:grid-flow-col @2xl:grid-cols-none @2xl:[&>:last-child:nth-child(odd)]:col-span-1", className),
18
+ ...props
19
+ })
20
+ });
21
+ });
22
+ const deltaTone = {
23
+ positive: "bg-success-soft text-on-success-soft",
24
+ negative: "bg-danger-soft text-on-danger-soft",
25
+ neutral: "bg-neutral-soft text-on-neutral-soft"
26
+ };
27
+ const Stat = forwardRef(function Stat({ label, value, delta, trend, deltaTone: tone = "neutral", note, className, ...props }, ref) {
28
+ const Arrow = trend === "down" ? ArrowDownRight : ArrowUpRight;
29
+ return /* @__PURE__ */ jsxs("div", {
30
+ ref,
31
+ className: cn("@container/stat flex flex-col bg-surface px-4 py-4", className),
32
+ ...props,
33
+ children: [
34
+ /* @__PURE__ */ jsx("dt", {
35
+ className: "text-sm text-fg-muted",
36
+ children: label
37
+ }),
38
+ /* @__PURE__ */ jsx("dd", {
39
+ className: "mt-1 text-xl font-medium tracking-tight tabular-nums @min-[10rem]/stat:text-2xl @min-[15rem]/stat:text-3xl",
40
+ children: value
41
+ }),
42
+ (delta !== void 0 || note !== void 0) && /* @__PURE__ */ jsxs("dd", {
43
+ className: "mt-2 flex flex-wrap items-center gap-1.5 text-xs text-fg-muted",
44
+ children: [delta !== void 0 && /* @__PURE__ */ jsxs("span", {
45
+ className: cn("inline-flex items-center gap-0.5 rounded-md px-1.5 py-0.5 font-medium tabular-nums", deltaTone[tone]),
46
+ children: [trend && /* @__PURE__ */ jsx(Arrow, {
47
+ className: "size-3",
48
+ "aria-hidden": true
49
+ }), delta]
50
+ }), note]
51
+ })
52
+ ]
53
+ });
54
+ });
55
+ export { Stat, StatGroup };
@@ -0,0 +1,36 @@
1
+ import { HTMLAttributes, ReactNode } from "react";
2
+ /**
3
+ * A placeholder shape while data loads. Size it like the content it replaces. Skeletons are
4
+ * hidden from screen readers, so wrap them in a region that says what is loading:
5
+ * `<div role="status" aria-busy="true"><span className="sr-only">Loading farmers…</span>…</div>`.
6
+ */
7
+ export declare function Skeleton({ className }: {
8
+ className?: string;
9
+ }): import("react").JSX.Element;
10
+ export interface EmptyStateProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
11
+ /** A simple line icon, e.g. `<Users />`. */
12
+ icon?: ReactNode;
13
+ title: ReactNode;
14
+ /** Why it is empty and what to do next. */
15
+ description?: ReactNode;
16
+ /** The next step, e.g. a "Register farmer" button or "Clear filters". */
17
+ action?: ReactNode;
18
+ }
19
+ /** Shown when a list or region has no data. Always say why and offer the next step. */
20
+ export declare const EmptyState: import("react").ForwardRefExoticComponent<EmptyStateProps & import("react").RefAttributes<HTMLDivElement>>;
21
+ export interface ErrorStateProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
22
+ title?: ReactNode;
23
+ /** What failed and what the user can do. Avoid raw technical messages. */
24
+ description?: ReactNode;
25
+ /** Shows a "Try again" button. */
26
+ onRetry?: () => void;
27
+ /** True while retrying: the button is disabled and spins. */
28
+ retrying?: boolean;
29
+ /** `block` replaces a region; `banner` sits above content that is still shown. */
30
+ variant?: 'block' | 'banner';
31
+ }
32
+ /**
33
+ * Shown when data fails to load. Never show zeros or "no results" for a failed load.
34
+ * Announced to screen readers when it appears.
35
+ */
36
+ export declare const ErrorState: import("react").ForwardRefExoticComponent<ErrorStateProps & import("react").RefAttributes<HTMLDivElement>>;