@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.
- package/LICENSE +21 -0
- package/README.md +15 -2
- package/dist/accordion/accordion.d.ts +41 -0
- package/dist/accordion/accordion.js +89 -0
- package/dist/avatar/avatar.d.ts +20 -0
- package/dist/avatar/avatar.js +38 -0
- package/dist/badge/badge.d.ts +16 -0
- package/dist/badge/badge.js +85 -0
- package/dist/breadcrumbs/breadcrumbs.d.ts +19 -0
- package/dist/breadcrumbs/breadcrumbs.js +44 -0
- package/dist/button/button.d.ts +16 -0
- package/dist/button/button.js +49 -0
- package/dist/button/icon-button.d.ts +17 -0
- package/dist/button/icon-button.js +33 -0
- package/dist/card/card.d.ts +16 -0
- package/dist/card/card.js +56 -0
- package/dist/checkbox/checkbox.d.ts +15 -0
- package/dist/checkbox/checkbox.js +47 -0
- package/dist/combobox/combobox.d.ts +37 -0
- package/dist/combobox/combobox.js +155 -0
- package/dist/command/command-palette.d.ts +50 -0
- package/dist/command/command-palette.js +170 -0
- package/dist/command/kbd.d.ts +6 -0
- package/dist/command/kbd.js +16 -0
- package/dist/data/data-table.d.ts +105 -0
- package/dist/data/data-table.js +269 -0
- package/dist/data/export-button.d.ts +19 -0
- package/dist/data/export-button.js +34 -0
- package/dist/data/filter-bar.d.ts +54 -0
- package/dist/data/filter-bar.js +187 -0
- package/dist/data/pagination.d.ts +13 -0
- package/dist/data/pagination.js +84 -0
- package/dist/data/selection-bar.d.ts +21 -0
- package/dist/data/selection-bar.js +31 -0
- package/dist/date/date-input.d.ts +41 -0
- package/dist/date/date-input.js +71 -0
- package/dist/dialog/confirm-dialog.d.ts +24 -0
- package/dist/dialog/confirm-dialog.js +77 -0
- package/dist/dialog/dialog.d.ts +46 -0
- package/dist/dialog/dialog.js +102 -0
- package/dist/dialog/form-panel.d.ts +28 -0
- package/dist/dialog/form-panel.js +51 -0
- package/dist/feedback/alert.d.ts +29 -0
- package/dist/feedback/alert.js +70 -0
- package/dist/feedback/progress.d.ts +25 -0
- package/dist/feedback/progress.js +54 -0
- package/dist/feedback/toaster.d.ts +7 -0
- package/dist/feedback/toaster.js +35 -0
- package/dist/field/field.d.ts +40 -0
- package/dist/field/field.js +83 -0
- package/dist/field/text-field.d.ts +9 -0
- package/dist/field/text-field.js +16 -0
- package/dist/file-input/file-input.d.ts +26 -0
- package/dist/file-input/file-input.js +149 -0
- package/dist/fonts.css +3 -0
- package/dist/index.d.ts +43 -0
- package/dist/index.js +43 -0
- package/dist/input/input.d.ts +13 -0
- package/dist/input/input.js +25 -0
- package/dist/layout/app-shell.d.ts +100 -0
- package/dist/layout/app-shell.js +433 -0
- package/dist/layout/page.d.ts +20 -0
- package/dist/layout/page.js +53 -0
- package/dist/layout/record.d.ts +39 -0
- package/dist/layout/record.js +79 -0
- package/dist/lib/cn.d.ts +3 -0
- package/dist/lib/cn.js +18 -0
- package/dist/lib/control.js +14 -0
- package/dist/lib/popup.js +20 -0
- package/dist/menu/menu.d.ts +45 -0
- package/dist/menu/menu.js +85 -0
- package/dist/popover/popover.d.ts +22 -0
- package/dist/popover/popover.js +39 -0
- package/dist/radio/radio.d.ts +12 -0
- package/dist/radio/radio.js +25 -0
- package/dist/select/select.d.ts +23 -0
- package/dist/select/select.js +66 -0
- package/dist/separator/separator.d.ts +6 -0
- package/dist/separator/separator.js +14 -0
- package/dist/stat/stat.d.ts +28 -0
- package/dist/stat/stat.js +55 -0
- package/dist/state/states.d.ts +36 -0
- package/dist/state/states.js +108 -0
- package/dist/styles.css +42 -0
- package/dist/switch/switch.d.ts +9 -0
- package/dist/switch/switch.js +18 -0
- package/dist/table/table.d.ts +28 -0
- package/dist/table/table.js +72 -0
- package/dist/tabs/tabs.d.ts +26 -0
- package/dist/tabs/tabs.js +45 -0
- package/dist/tooltip/tooltip.d.ts +17 -0
- package/dist/tooltip/tooltip.js +27 -0
- package/package.json +57 -4
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { Button } from "../button/button.js";
|
|
2
|
+
import { cn } from "../lib/cn.js";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { AlertTriangle, RefreshCw } from "lucide-react";
|
|
6
|
+
// src/state/states.tsx
|
|
7
|
+
/**
|
|
8
|
+
* A placeholder shape while data loads. Size it like the content it replaces. Skeletons are
|
|
9
|
+
* hidden from screen readers, so wrap them in a region that says what is loading:
|
|
10
|
+
* `<div role="status" aria-busy="true"><span className="sr-only">Loading farmers…</span>…</div>`.
|
|
11
|
+
*/
|
|
12
|
+
function Skeleton({ className }) {
|
|
13
|
+
return /* @__PURE__ */ jsx("div", {
|
|
14
|
+
"aria-hidden": true,
|
|
15
|
+
className: cn("animate-pulse rounded-md bg-surface-hover motion-reduce:animate-none", className)
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
/** Shown when a list or region has no data. Always say why and offer the next step. */
|
|
19
|
+
const EmptyState = forwardRef(function EmptyState({ icon, title, description, action, className, ...props }, ref) {
|
|
20
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
21
|
+
ref,
|
|
22
|
+
className: cn("flex flex-col items-center px-6 py-12 text-center", className),
|
|
23
|
+
...props,
|
|
24
|
+
children: [
|
|
25
|
+
icon && /* @__PURE__ */ jsx("div", {
|
|
26
|
+
className: "mb-3 grid size-10 place-items-center rounded-lg border border-border bg-surface text-fg-muted shadow-xs [&_svg]:size-5",
|
|
27
|
+
children: icon
|
|
28
|
+
}),
|
|
29
|
+
/* @__PURE__ */ jsx("p", {
|
|
30
|
+
className: "text-base font-semibold",
|
|
31
|
+
children: title
|
|
32
|
+
}),
|
|
33
|
+
description && /* @__PURE__ */ jsx("p", {
|
|
34
|
+
className: "mt-1 max-w-sm text-sm text-fg-muted",
|
|
35
|
+
children: description
|
|
36
|
+
}),
|
|
37
|
+
action && /* @__PURE__ */ jsx("div", {
|
|
38
|
+
className: "mt-4 flex flex-wrap justify-center gap-2",
|
|
39
|
+
children: action
|
|
40
|
+
})
|
|
41
|
+
]
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
/**
|
|
45
|
+
* Shown when data fails to load. Never show zeros or "no results" for a failed load.
|
|
46
|
+
* Announced to screen readers when it appears.
|
|
47
|
+
*/
|
|
48
|
+
const ErrorState = forwardRef(function ErrorState({ title = "Couldn't load this", description = "Check your connection and try again.", onRetry, retrying = false, variant = "block", className, ...props }, ref) {
|
|
49
|
+
const retry = onRetry && /* @__PURE__ */ jsxs(Button, {
|
|
50
|
+
variant: "secondary",
|
|
51
|
+
size: "sm",
|
|
52
|
+
disabled: retrying,
|
|
53
|
+
focusableWhenDisabled: true,
|
|
54
|
+
onClick: onRetry,
|
|
55
|
+
children: [/* @__PURE__ */ jsx(RefreshCw, {
|
|
56
|
+
className: cn(retrying && "animate-spin motion-reduce:animate-none"),
|
|
57
|
+
"aria-hidden": true
|
|
58
|
+
}), "Try again"]
|
|
59
|
+
});
|
|
60
|
+
if (variant === "banner") return /* @__PURE__ */ jsxs("div", {
|
|
61
|
+
ref,
|
|
62
|
+
role: "alert",
|
|
63
|
+
className: cn("flex flex-wrap items-center gap-3 rounded-lg border border-border bg-danger-soft px-4 py-3 text-on-danger-soft", className),
|
|
64
|
+
...props,
|
|
65
|
+
children: [
|
|
66
|
+
/* @__PURE__ */ jsx(AlertTriangle, {
|
|
67
|
+
className: "size-4 shrink-0",
|
|
68
|
+
"aria-hidden": true
|
|
69
|
+
}),
|
|
70
|
+
/* @__PURE__ */ jsxs("div", {
|
|
71
|
+
className: "min-w-0 flex-1 text-sm",
|
|
72
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
73
|
+
className: "font-semibold",
|
|
74
|
+
children: title
|
|
75
|
+
}), description && /* @__PURE__ */ jsx("p", { children: description })]
|
|
76
|
+
}),
|
|
77
|
+
retry
|
|
78
|
+
]
|
|
79
|
+
});
|
|
80
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
81
|
+
ref,
|
|
82
|
+
role: "alert",
|
|
83
|
+
className: cn("flex flex-col items-center px-6 py-12 text-center", className),
|
|
84
|
+
...props,
|
|
85
|
+
children: [
|
|
86
|
+
/* @__PURE__ */ jsx("div", {
|
|
87
|
+
className: "mb-3 grid size-10 place-items-center rounded-lg bg-danger-soft text-on-danger-soft",
|
|
88
|
+
children: /* @__PURE__ */ jsx(AlertTriangle, {
|
|
89
|
+
className: "size-5",
|
|
90
|
+
"aria-hidden": true
|
|
91
|
+
})
|
|
92
|
+
}),
|
|
93
|
+
/* @__PURE__ */ jsx("p", {
|
|
94
|
+
className: "text-base font-semibold",
|
|
95
|
+
children: title
|
|
96
|
+
}),
|
|
97
|
+
description && /* @__PURE__ */ jsx("p", {
|
|
98
|
+
className: "mt-1 max-w-sm text-sm text-fg-muted",
|
|
99
|
+
children: description
|
|
100
|
+
}),
|
|
101
|
+
retry && /* @__PURE__ */ jsx("div", {
|
|
102
|
+
className: "mt-4",
|
|
103
|
+
children: retry
|
|
104
|
+
})
|
|
105
|
+
]
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
export { EmptyState, ErrorState, Skeleton };
|
package/dist/styles.css
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* GGEM UI styles. In the app's main CSS file:
|
|
3
|
+
* @import "tailwindcss";
|
|
4
|
+
* @import "@ggem-farming/ui/styles.css";
|
|
5
|
+
* @import "@ggem-farming/ui/fonts.css"; (optional: self-hosted Archivo, Source Sans 3, JetBrains Mono)
|
|
6
|
+
*/
|
|
7
|
+
@import '@ggem-farming/tokens/theme.css';
|
|
8
|
+
|
|
9
|
+
/* Generate the utilities used by the kit's components. */
|
|
10
|
+
@source './';
|
|
11
|
+
|
|
12
|
+
@layer base {
|
|
13
|
+
/* Keep the root font size at the browser default so rem-based tokens keep their values. */
|
|
14
|
+
:where(html) {
|
|
15
|
+
background-color: var(--color-bg);
|
|
16
|
+
color: var(--color-fg);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
:where(body) {
|
|
20
|
+
font-family: var(--font-sans);
|
|
21
|
+
font-size: var(--text-base);
|
|
22
|
+
line-height: var(--text-base--line-height);
|
|
23
|
+
font-feature-settings: 'cv11', 'ss03';
|
|
24
|
+
-webkit-font-smoothing: antialiased;
|
|
25
|
+
text-rendering: optimizeLegibility;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
:where(:focus-visible) {
|
|
29
|
+
outline: 2px solid var(--color-focus);
|
|
30
|
+
outline-offset: 2px;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* Indeterminate progress line used while tables refetch. */
|
|
35
|
+
@keyframes ggem-progress {
|
|
36
|
+
from {
|
|
37
|
+
translate: -100% 0;
|
|
38
|
+
}
|
|
39
|
+
to {
|
|
40
|
+
translate: 300% 0;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Switch as Switch$1 } from "@base-ui/react/switch";
|
|
2
|
+
export interface SwitchProps extends Omit<Switch$1.Root.Props, 'className'> {
|
|
3
|
+
className?: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* An on/off switch for settings that apply immediately. Use a Checkbox inside forms that are
|
|
7
|
+
* submitted. Label it by wrapping it in `FieldLabel`, or with `aria-label`.
|
|
8
|
+
*/
|
|
9
|
+
export declare const Switch: import("react").ForwardRefExoticComponent<Omit<SwitchProps, "ref"> & import("react").RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { cn } from "../lib/cn.js";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { Switch as Switch$1 } from "@base-ui/react/switch";
|
|
5
|
+
// src/switch/switch.tsx
|
|
6
|
+
/**
|
|
7
|
+
* An on/off switch for settings that apply immediately. Use a Checkbox inside forms that are
|
|
8
|
+
* submitted. Label it by wrapping it in `FieldLabel`, or with `aria-label`.
|
|
9
|
+
*/
|
|
10
|
+
const Switch = forwardRef(function Switch({ className, ...props }, ref) {
|
|
11
|
+
return /* @__PURE__ */ jsx(Switch$1.Root, {
|
|
12
|
+
ref,
|
|
13
|
+
className: cn("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full bg-input p-0.5", "transition-colors duration-fast ease-standard data-checked:bg-primary", "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus", "data-disabled:cursor-not-allowed data-disabled:opacity-50", "pointer-coarse:before:absolute pointer-coarse:before:-inset-x-1 pointer-coarse:before:-inset-y-3", className),
|
|
14
|
+
...props,
|
|
15
|
+
children: /* @__PURE__ */ jsx(Switch$1.Thumb, { className: cn("size-4 rounded-full bg-surface shadow-sm transition-transform duration-fast ease-standard", "data-checked:translate-x-4") })
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
export { Switch };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { HTMLAttributes, TdHTMLAttributes, ThHTMLAttributes } from "react";
|
|
2
|
+
type Align = 'left' | 'center' | 'right';
|
|
3
|
+
export interface TableProps extends HTMLAttributes<HTMLTableElement> {
|
|
4
|
+
/** Classes for the scrolling wrapper. */
|
|
5
|
+
containerClassName?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A small static table: a summary, a breakdown, a comparison. It scrolls sideways when narrow.
|
|
9
|
+
* For lists with sorting, paging or many rows use `DataTable`.
|
|
10
|
+
*/
|
|
11
|
+
export declare const Table: import("react").ForwardRefExoticComponent<TableProps & import("react").RefAttributes<HTMLTableElement>>;
|
|
12
|
+
export declare const TableCaption: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLTableCaptionElement> & import("react").RefAttributes<HTMLTableCaptionElement>>;
|
|
13
|
+
export declare const TableHeader: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLTableSectionElement> & import("react").RefAttributes<HTMLTableSectionElement>>;
|
|
14
|
+
export declare const TableBody: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLTableSectionElement> & import("react").RefAttributes<HTMLTableSectionElement>>;
|
|
15
|
+
/** Totals row. Put the label in the first cell and right-align the amounts. */
|
|
16
|
+
export declare const TableFooter: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLTableSectionElement> & import("react").RefAttributes<HTMLTableSectionElement>>;
|
|
17
|
+
export declare const TableRow: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLTableRowElement> & import("react").RefAttributes<HTMLTableRowElement>>;
|
|
18
|
+
export interface TableHeadProps extends ThHTMLAttributes<HTMLTableCellElement> {
|
|
19
|
+
align?: Align;
|
|
20
|
+
}
|
|
21
|
+
/** A column header (`scope="col"` by default). Use `scope="row"` for a row's label cell. */
|
|
22
|
+
export declare const TableHead: import("react").ForwardRefExoticComponent<TableHeadProps & import("react").RefAttributes<HTMLTableCellElement>>;
|
|
23
|
+
export interface TableCellProps extends TdHTMLAttributes<HTMLTableCellElement> {
|
|
24
|
+
/** `right` for numbers and money; it also uses tabular figures. */
|
|
25
|
+
align?: Align;
|
|
26
|
+
}
|
|
27
|
+
export declare const TableCell: import("react").ForwardRefExoticComponent<TableCellProps & import("react").RefAttributes<HTMLTableCellElement>>;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { cn } from "../lib/cn.js";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
// src/table/table.tsx
|
|
5
|
+
const alignClass = (align) => align === "right" ? "text-right tabular-nums" : align === "center" ? "text-center" : "text-left";
|
|
6
|
+
/**
|
|
7
|
+
* A small static table: a summary, a breakdown, a comparison. It scrolls sideways when narrow.
|
|
8
|
+
* For lists with sorting, paging or many rows use `DataTable`.
|
|
9
|
+
*/
|
|
10
|
+
const Table = forwardRef(function Table({ className, containerClassName, ...props }, ref) {
|
|
11
|
+
return /* @__PURE__ */ jsx("div", {
|
|
12
|
+
className: cn("w-full overflow-x-auto", containerClassName),
|
|
13
|
+
children: /* @__PURE__ */ jsx("table", {
|
|
14
|
+
ref,
|
|
15
|
+
className: cn("w-full text-sm", className),
|
|
16
|
+
...props
|
|
17
|
+
})
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
const TableCaption = forwardRef(function TableCaption({ className, ...props }, ref) {
|
|
21
|
+
return /* @__PURE__ */ jsx("caption", {
|
|
22
|
+
ref,
|
|
23
|
+
className: cn("caption-top pb-2 text-left text-sm font-medium", className),
|
|
24
|
+
...props
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
const TableHeader = forwardRef(function TableHeader({ className, ...props }, ref) {
|
|
28
|
+
return /* @__PURE__ */ jsx("thead", {
|
|
29
|
+
ref,
|
|
30
|
+
className: cn("bg-surface-muted text-xs text-fg-muted", className),
|
|
31
|
+
...props
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
const TableBody = forwardRef(function TableBody({ className, ...props }, ref) {
|
|
35
|
+
return /* @__PURE__ */ jsx("tbody", {
|
|
36
|
+
ref,
|
|
37
|
+
className: cn("[&>tr:last-child]:border-0", className),
|
|
38
|
+
...props
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
/** Totals row. Put the label in the first cell and right-align the amounts. */
|
|
42
|
+
const TableFooter = forwardRef(function TableFooter({ className, ...props }, ref) {
|
|
43
|
+
return /* @__PURE__ */ jsx("tfoot", {
|
|
44
|
+
ref,
|
|
45
|
+
className: cn("border-t border-border bg-surface-muted font-medium", className),
|
|
46
|
+
...props
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
const TableRow = forwardRef(function TableRow({ className, ...props }, ref) {
|
|
50
|
+
return /* @__PURE__ */ jsx("tr", {
|
|
51
|
+
ref,
|
|
52
|
+
className: cn("border-b border-border", className),
|
|
53
|
+
...props
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
/** A column header (`scope="col"` by default). Use `scope="row"` for a row's label cell. */
|
|
57
|
+
const TableHead = forwardRef(function TableHead({ className, align, scope = "col", ...props }, ref) {
|
|
58
|
+
return /* @__PURE__ */ jsx("th", {
|
|
59
|
+
ref,
|
|
60
|
+
scope,
|
|
61
|
+
className: cn("h-9 px-3 font-medium whitespace-nowrap first:pl-4 last:pr-4", alignClass(align), className),
|
|
62
|
+
...props
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
const TableCell = forwardRef(function TableCell({ className, align, ...props }, ref) {
|
|
66
|
+
return /* @__PURE__ */ jsx("td", {
|
|
67
|
+
ref,
|
|
68
|
+
className: cn("h-10 px-3 py-2 first:pl-4 last:pr-4", alignClass(align), className),
|
|
69
|
+
...props
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Tabs as Tabs$1 } from "@base-ui/react/tabs";
|
|
2
|
+
type Variant = 'underline' | 'segmented';
|
|
3
|
+
export type TabsProps = Omit<Tabs$1.Root.Props, 'className'> & {
|
|
4
|
+
className?: string;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Switches between views of one subject. Keep the active tab in the URL: pass `value` and
|
|
8
|
+
* `onValueChange` from your router's search params.
|
|
9
|
+
*/
|
|
10
|
+
export declare const Tabs: import("react").ForwardRefExoticComponent<Omit<TabsProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
11
|
+
export interface TabsListProps extends Omit<Tabs$1.List.Props, 'className'> {
|
|
12
|
+
className?: string;
|
|
13
|
+
/** `underline` for page and record sections; `segmented` for a compact switch. */
|
|
14
|
+
variant?: Variant;
|
|
15
|
+
}
|
|
16
|
+
export declare const TabsList: import("react").ForwardRefExoticComponent<Omit<TabsListProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
17
|
+
export type TabProps = Omit<Tabs$1.Tab.Props, 'className'> & {
|
|
18
|
+
className?: string;
|
|
19
|
+
};
|
|
20
|
+
/** One tab. Counts can go inside: `Contracts <span>12</span>`. */
|
|
21
|
+
export declare const Tab: import("react").ForwardRefExoticComponent<Omit<TabProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
22
|
+
export type TabsPanelProps = Omit<Tabs$1.Panel.Props, 'className'> & {
|
|
23
|
+
className?: string;
|
|
24
|
+
};
|
|
25
|
+
export declare const TabsPanel: import("react").ForwardRefExoticComponent<Omit<TabsPanelProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { cn } from "../lib/cn.js";
|
|
2
|
+
import { createContext, forwardRef, useContext } from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { Tabs as Tabs$1 } from "@base-ui/react/tabs";
|
|
5
|
+
// src/tabs/tabs.tsx
|
|
6
|
+
const VariantContext = createContext("underline");
|
|
7
|
+
/**
|
|
8
|
+
* Switches between views of one subject. Keep the active tab in the URL: pass `value` and
|
|
9
|
+
* `onValueChange` from your router's search params.
|
|
10
|
+
*/
|
|
11
|
+
const Tabs = forwardRef(function Tabs({ className, ...props }, ref) {
|
|
12
|
+
return /* @__PURE__ */ jsx(Tabs$1.Root, {
|
|
13
|
+
ref,
|
|
14
|
+
className: cn("flex flex-col gap-4", className),
|
|
15
|
+
...props
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
const TabsList = forwardRef(function TabsList({ className, variant = "underline", children, ...props }, ref) {
|
|
19
|
+
return /* @__PURE__ */ jsx(VariantContext.Provider, {
|
|
20
|
+
value: variant,
|
|
21
|
+
children: /* @__PURE__ */ jsxs(Tabs$1.List, {
|
|
22
|
+
ref,
|
|
23
|
+
className: cn("relative z-0 flex max-w-full overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden", variant === "underline" ? "gap-5 border-b border-border" : "w-fit gap-1 rounded-lg border border-border bg-surface-muted p-0.5", className),
|
|
24
|
+
...props,
|
|
25
|
+
children: [children, /* @__PURE__ */ jsx(Tabs$1.Indicator, { className: cn("absolute left-0 -z-1 w-(--active-tab-width) translate-x-(--active-tab-left)", "transition-[translate,width] duration-normal ease-standard", variant === "underline" ? "bottom-0 h-0.5 bg-primary" : "top-(--active-tab-top) h-(--active-tab-height) rounded-md border border-border bg-surface shadow-xs") })]
|
|
26
|
+
})
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
/** One tab. Counts can go inside: `Contracts <span>12</span>`. */
|
|
30
|
+
const Tab = forwardRef(function Tab({ className, ...props }, ref) {
|
|
31
|
+
const variant = useContext(VariantContext);
|
|
32
|
+
return /* @__PURE__ */ jsx(Tabs$1.Tab, {
|
|
33
|
+
ref,
|
|
34
|
+
className: cn("inline-flex shrink-0 cursor-pointer items-center gap-1.5 text-sm font-medium whitespace-nowrap text-fg-muted select-none", "hover:text-fg data-active:text-fg data-disabled:cursor-not-allowed data-disabled:opacity-50", "focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus", variant === "underline" ? "h-10 px-0.5" : "h-7 rounded-md px-2.5", "pointer-coarse:h-11", className),
|
|
35
|
+
...props
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
const TabsPanel = forwardRef(function TabsPanel({ className, ...props }, ref) {
|
|
39
|
+
return /* @__PURE__ */ jsx(Tabs$1.Panel, {
|
|
40
|
+
ref,
|
|
41
|
+
className: cn("focus-visible:outline-2 focus-visible:outline-focus", className),
|
|
42
|
+
...props
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
export { Tab, Tabs, TabsList, TabsPanel };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactElement, ReactNode } from "react";
|
|
2
|
+
import { Tooltip as Tooltip$1 } from "@base-ui/react/tooltip";
|
|
3
|
+
export type TooltipProviderProps = Tooltip$1.Provider.Props;
|
|
4
|
+
/**
|
|
5
|
+
* Optional: wrap the app once so moving between tooltips shows the next one without a delay.
|
|
6
|
+
*/
|
|
7
|
+
export declare function TooltipProvider({ delay, closeDelay, ...props }: TooltipProviderProps): import("react").JSX.Element;
|
|
8
|
+
export interface TooltipProps {
|
|
9
|
+
/** Short text shown on hover and keyboard focus. Never put essential information only here. */
|
|
10
|
+
content: ReactNode;
|
|
11
|
+
/** The element that triggers the tooltip; it must accept a ref and props (e.g. a Button). */
|
|
12
|
+
children: ReactElement;
|
|
13
|
+
side?: Tooltip$1.Positioner.Props['side'];
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
/** A small hint for a control. Icon-only controls still need their own accessible name. */
|
|
17
|
+
export declare function Tooltip({ content, children, side, className }: TooltipProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { cn } from "../lib/cn.js";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Tooltip as Tooltip$1 } from "@base-ui/react/tooltip";
|
|
4
|
+
// src/tooltip/tooltip.tsx
|
|
5
|
+
/**
|
|
6
|
+
* Optional: wrap the app once so moving between tooltips shows the next one without a delay.
|
|
7
|
+
*/
|
|
8
|
+
function TooltipProvider({ delay = 500, closeDelay = 0, ...props }) {
|
|
9
|
+
return /* @__PURE__ */ jsx(Tooltip$1.Provider, {
|
|
10
|
+
delay,
|
|
11
|
+
closeDelay,
|
|
12
|
+
...props
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
/** A small hint for a control. Icon-only controls still need their own accessible name. */
|
|
16
|
+
function Tooltip({ content, children, side = "top", className }) {
|
|
17
|
+
return /* @__PURE__ */ jsxs(Tooltip$1.Root, { children: [/* @__PURE__ */ jsx(Tooltip$1.Trigger, { render: children }), /* @__PURE__ */ jsx(Tooltip$1.Portal, { children: /* @__PURE__ */ jsx(Tooltip$1.Positioner, {
|
|
18
|
+
side,
|
|
19
|
+
sideOffset: 6,
|
|
20
|
+
className: "z-(--z-tooltip)",
|
|
21
|
+
children: /* @__PURE__ */ jsx(Tooltip$1.Popup, {
|
|
22
|
+
className: cn("origin-(--transform-origin) rounded-md bg-primary px-2 py-1 text-xs font-medium text-on-primary shadow-md", "transition-[scale,opacity] duration-fast ease-standard", "data-starting-style:scale-95 data-starting-style:opacity-0", "data-ending-style:scale-95 data-ending-style:opacity-0 data-instant:transition-none", className),
|
|
23
|
+
children: content
|
|
24
|
+
})
|
|
25
|
+
}) })] });
|
|
26
|
+
}
|
|
27
|
+
export { Tooltip, TooltipProvider };
|
package/package.json
CHANGED
|
@@ -1,6 +1,59 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ggem-farming/ui",
|
|
3
|
-
"version": "0.0.0
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "GGEM React components built on Base UI and Tailwind CSS v4",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"sideEffects": [
|
|
8
|
+
"*.css"
|
|
9
|
+
],
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./styles.css": "./dist/styles.css",
|
|
16
|
+
"./fonts.css": "./dist/fonts.css",
|
|
17
|
+
"./package.json": "./package.json"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "tsdown",
|
|
24
|
+
"typecheck": "tsc --noEmit"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@base-ui/react": "^1.9.0",
|
|
28
|
+
"@fontsource-variable/inter": "^5.3.0",
|
|
29
|
+
"@fontsource-variable/jetbrains-mono": "^5.3.0",
|
|
30
|
+
"@ggem-farming/tokens": "^0.0.0",
|
|
31
|
+
"@tanstack/react-table": "^9.3.1",
|
|
32
|
+
"@tanstack/table-core": "9.3.1",
|
|
33
|
+
"class-variance-authority": "^0.7.1",
|
|
34
|
+
"clsx": "^2.1.1",
|
|
35
|
+
"lucide-react": "^1.72.0",
|
|
36
|
+
"tailwind-merge": "^3.7.0"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"react": "^18.2.0 || ^19.0.0",
|
|
40
|
+
"react-dom": "^18.2.0 || ^19.0.0",
|
|
41
|
+
"tailwindcss": "^4.1.0",
|
|
42
|
+
"sonner": "^1.5.0 || ^2.0.0"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"sonner": "^2.0.8",
|
|
46
|
+
"tailwindcss": "^4.3.5"
|
|
47
|
+
},
|
|
48
|
+
"repository": {
|
|
49
|
+
"type": "git",
|
|
50
|
+
"url": "git+https://github.com/ggem-farming/ui.git",
|
|
51
|
+
"directory": "packages/ui"
|
|
52
|
+
},
|
|
53
|
+
"publishConfig": {
|
|
54
|
+
"access": "public"
|
|
55
|
+
},
|
|
56
|
+
"engines": {
|
|
57
|
+
"node": ">=20"
|
|
58
|
+
}
|
|
59
|
+
}
|