@nocoo/basalt 2.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +41 -0
- package/dist/charts/area.d.ts +8 -0
- package/dist/charts/area.js +55 -0
- package/dist/charts/area.js.map +1 -0
- package/dist/charts/bar.d.ts +9 -0
- package/dist/charts/bar.js +42 -0
- package/dist/charts/bar.js.map +1 -0
- package/dist/charts/bullet.d.ts +8 -0
- package/dist/charts/bullet.js +50 -0
- package/dist/charts/bullet.js.map +1 -0
- package/dist/charts/chart-colors.d.ts +1 -0
- package/dist/charts/chart-colors.js +3 -0
- package/dist/charts/charts.d.ts +6 -0
- package/dist/charts/charts.js +15 -0
- package/dist/charts/charts.js.map +1 -0
- package/dist/charts/config.d.ts +117 -0
- package/dist/charts/config.js +117 -0
- package/dist/charts/config.js.map +1 -0
- package/dist/charts/custom-chart.d.ts +6 -0
- package/dist/charts/custom-chart.js +15 -0
- package/dist/charts/custom-chart.js.map +1 -0
- package/dist/charts/date-navigation.d.ts +22 -0
- package/dist/charts/date-navigation.js +122 -0
- package/dist/charts/date-navigation.js.map +1 -0
- package/dist/charts/donut.d.ts +8 -0
- package/dist/charts/donut.js +36 -0
- package/dist/charts/donut.js.map +1 -0
- package/dist/charts/frame.d.ts +9 -0
- package/dist/charts/frame.js +22 -0
- package/dist/charts/frame.js.map +1 -0
- package/dist/charts/funnel.d.ts +7 -0
- package/dist/charts/funnel.js +35 -0
- package/dist/charts/funnel.js.map +1 -0
- package/dist/charts/gauge.d.ts +8 -0
- package/dist/charts/gauge.js +46 -0
- package/dist/charts/gauge.js.map +1 -0
- package/dist/charts/grouped-bar.d.ts +7 -0
- package/dist/charts/grouped-bar.js +42 -0
- package/dist/charts/grouped-bar.js.map +1 -0
- package/dist/charts/heatmap-calendar.d.ts +27 -0
- package/dist/charts/heatmap-calendar.js +200 -0
- package/dist/charts/heatmap-calendar.js.map +1 -0
- package/dist/charts/item-list.d.ts +9 -0
- package/dist/charts/item-list.js +22 -0
- package/dist/charts/item-list.js.map +1 -0
- package/dist/charts/line.d.ts +9 -0
- package/dist/charts/line.js +58 -0
- package/dist/charts/line.js.map +1 -0
- package/dist/charts/palette.d.ts +33 -0
- package/dist/charts/palette.js +44 -0
- package/dist/charts/palette.js.map +1 -0
- package/dist/charts/radar.d.ts +6 -0
- package/dist/charts/radar.js +37 -0
- package/dist/charts/radar.js.map +1 -0
- package/dist/charts/sample.d.ts +42 -0
- package/dist/charts/sample.js +124 -0
- package/dist/charts/sample.js.map +1 -0
- package/dist/charts/sankey.d.ts +6 -0
- package/dist/charts/sankey.js +51 -0
- package/dist/charts/sankey.js.map +1 -0
- package/dist/charts/slot-bar.d.ts +15 -0
- package/dist/charts/slot-bar.js +80 -0
- package/dist/charts/slot-bar.js.map +1 -0
- package/dist/charts/sparkline.d.ts +6 -0
- package/dist/charts/sparkline.js +29 -0
- package/dist/charts/sparkline.js.map +1 -0
- package/dist/charts/stacked-bar.d.ts +7 -0
- package/dist/charts/stacked-bar.js +51 -0
- package/dist/charts/stacked-bar.js.map +1 -0
- package/dist/charts/stat-card.d.ts +21 -0
- package/dist/charts/stat-card.js +66 -0
- package/dist/charts/stat-card.js.map +1 -0
- package/dist/charts/timeline.d.ts +17 -0
- package/dist/charts/timeline.js +79 -0
- package/dist/charts/timeline.js.map +1 -0
- package/dist/charts/timeseries.d.ts +6 -0
- package/dist/charts/timeseries.js +15 -0
- package/dist/charts/timeseries.js.map +1 -0
- package/dist/components/accordion.d.ts +6 -0
- package/dist/components/accordion.js +21 -0
- package/dist/components/accordion.js.map +1 -0
- package/dist/components/alert-dialog.d.ts +25 -0
- package/dist/components/alert-dialog.js +61 -0
- package/dist/components/alert-dialog.js.map +1 -0
- package/dist/components/app-header.d.ts +10 -0
- package/dist/components/app-header.js +35 -0
- package/dist/components/app-header.js.map +1 -0
- package/dist/components/app-shell.d.ts +4 -0
- package/dist/components/app-shell.js +29 -0
- package/dist/components/app-shell.js.map +1 -0
- package/dist/components/autocomplete.d.ts +47 -0
- package/dist/components/autocomplete.js +28 -0
- package/dist/components/autocomplete.js.map +1 -0
- package/dist/components/avatar.d.ts +5 -0
- package/dist/components/avatar.js +28 -0
- package/dist/components/avatar.js.map +1 -0
- package/dist/components/badge.d.ts +10 -0
- package/dist/components/badge.js +37 -0
- package/dist/components/badge.js.map +1 -0
- package/dist/components/banner.d.ts +22 -0
- package/dist/components/banner.js +88 -0
- package/dist/components/banner.js.map +1 -0
- package/dist/components/basalt-mark.d.ts +8 -0
- package/dist/components/basalt-mark.js +17 -0
- package/dist/components/basalt-mark.js.map +1 -0
- package/dist/components/breadcrumbs.d.ts +9 -0
- package/dist/components/breadcrumbs.js +38 -0
- package/dist/components/breadcrumbs.js.map +1 -0
- package/dist/components/button.d.ts +17 -0
- package/dist/components/button.js +73 -0
- package/dist/components/button.js.map +1 -0
- package/dist/components/checkbox.d.ts +86 -0
- package/dist/components/checkbox.js +107 -0
- package/dist/components/checkbox.js.map +1 -0
- package/dist/components/clipboard-text.d.ts +5 -0
- package/dist/components/clipboard-text.js +33 -0
- package/dist/components/clipboard-text.js.map +1 -0
- package/dist/components/code.d.ts +26 -0
- package/dist/components/code.js +45 -0
- package/dist/components/code.js.map +1 -0
- package/dist/components/collapsible.d.ts +33 -0
- package/dist/components/collapsible.js +38 -0
- package/dist/components/collapsible.js.map +1 -0
- package/dist/components/combobox.d.ts +47 -0
- package/dist/components/combobox.js +28 -0
- package/dist/components/combobox.js.map +1 -0
- package/dist/components/command-palette.d.ts +83 -0
- package/dist/components/command-palette.js +90 -0
- package/dist/components/command-palette.js.map +1 -0
- package/dist/components/confirm-dialog.d.ts +52 -0
- package/dist/components/confirm-dialog.js +61 -0
- package/dist/components/confirm-dialog.js.map +1 -0
- package/dist/components/context-menu.d.ts +7 -0
- package/dist/components/context-menu.js +23 -0
- package/dist/components/context-menu.js.map +1 -0
- package/dist/components/data-table.d.ts +76 -0
- package/dist/components/data-table.js +230 -0
- package/dist/components/data-table.js.map +1 -0
- package/dist/components/date-picker.d.ts +90 -0
- package/dist/components/date-picker.js +452 -0
- package/dist/components/date-picker.js.map +1 -0
- package/dist/components/dialog.d.ts +37 -0
- package/dist/components/dialog.js +67 -0
- package/dist/components/dialog.js.map +1 -0
- package/dist/components/dropdown-menu.d.ts +38 -0
- package/dist/components/dropdown-menu.js +24 -0
- package/dist/components/dropdown-menu.js.map +1 -0
- package/dist/components/empty.d.ts +6 -0
- package/dist/components/empty.js +28 -0
- package/dist/components/empty.js.map +1 -0
- package/dist/components/field.d.ts +39 -0
- package/dist/components/field.js +52 -0
- package/dist/components/field.js.map +1 -0
- package/dist/components/flow.d.ts +24 -0
- package/dist/components/flow.js +56 -0
- package/dist/components/flow.js.map +1 -0
- package/dist/components/grid.d.ts +15 -0
- package/dist/components/grid.js +24 -0
- package/dist/components/grid.js.map +1 -0
- package/dist/components/hover-card.d.ts +5 -0
- package/dist/components/hover-card.js +18 -0
- package/dist/components/hover-card.js.map +1 -0
- package/dist/components/input-area.d.ts +19 -0
- package/dist/components/input-area.js +27 -0
- package/dist/components/input-area.js.map +1 -0
- package/dist/components/input-group.d.ts +70 -0
- package/dist/components/input-group.js +78 -0
- package/dist/components/input-group.js.map +1 -0
- package/dist/components/input.d.ts +19 -0
- package/dist/components/input.js +28 -0
- package/dist/components/input.js.map +1 -0
- package/dist/components/label.d.ts +20 -0
- package/dist/components/label.js +34 -0
- package/dist/components/label.js.map +1 -0
- package/dist/components/layer-card.d.ts +69 -0
- package/dist/components/layer-card.js +104 -0
- package/dist/components/layer-card.js.map +1 -0
- package/dist/components/link.d.ts +8 -0
- package/dist/components/link.js +18 -0
- package/dist/components/link.js.map +1 -0
- package/dist/components/loader.d.ts +4 -0
- package/dist/components/loader.js +66 -0
- package/dist/components/loader.js.map +1 -0
- package/dist/components/loading-screen.d.ts +5 -0
- package/dist/components/loading-screen.js +24 -0
- package/dist/components/loading-screen.js.map +1 -0
- package/dist/components/menu-bar.d.ts +8 -0
- package/dist/components/menu-bar.js +42 -0
- package/dist/components/menu-bar.js.map +1 -0
- package/dist/components/meter.d.ts +8 -0
- package/dist/components/meter.js +26 -0
- package/dist/components/meter.js.map +1 -0
- package/dist/components/navigation-menu.d.ts +6 -0
- package/dist/components/navigation-menu.js +16 -0
- package/dist/components/navigation-menu.js.map +1 -0
- package/dist/components/overlay.d.ts +16 -0
- package/dist/components/overlay.js +14 -0
- package/dist/components/overlay.js.map +1 -0
- package/dist/components/page-header.d.ts +19 -0
- package/dist/components/page-header.js +43 -0
- package/dist/components/page-header.js.map +1 -0
- package/dist/components/pagination.d.ts +35 -0
- package/dist/components/pagination.js +68 -0
- package/dist/components/pagination.js.map +1 -0
- package/dist/components/popover.d.ts +38 -0
- package/dist/components/popover.js +65 -0
- package/dist/components/popover.js.map +1 -0
- package/dist/components/radio.d.ts +108 -0
- package/dist/components/radio.js +80 -0
- package/dist/components/radio.js.map +1 -0
- package/dist/components/scroll-area.d.ts +15 -0
- package/dist/components/scroll-area.js +49 -0
- package/dist/components/scroll-area.js.map +1 -0
- package/dist/components/segment-control.d.ts +35 -0
- package/dist/components/segment-control.js +46 -0
- package/dist/components/segment-control.js.map +1 -0
- package/dist/components/select.d.ts +99 -0
- package/dist/components/select.js +51 -0
- package/dist/components/select.js.map +1 -0
- package/dist/components/sensitive-input.d.ts +23 -0
- package/dist/components/sensitive-input.js +43 -0
- package/dist/components/sensitive-input.js.map +1 -0
- package/dist/components/separator.d.ts +26 -0
- package/dist/components/separator.js +18 -0
- package/dist/components/separator.js.map +1 -0
- package/dist/components/sheet.d.ts +26 -0
- package/dist/components/sheet.js +49 -0
- package/dist/components/sheet.js.map +1 -0
- package/dist/components/sidebar.d.ts +101 -0
- package/dist/components/sidebar.js +260 -0
- package/dist/components/sidebar.js.map +1 -0
- package/dist/components/skeleton-line.d.ts +6 -0
- package/dist/components/skeleton-line.js +22 -0
- package/dist/components/skeleton-line.js.map +1 -0
- package/dist/components/slider.d.ts +3 -0
- package/dist/components/slider.js +21 -0
- package/dist/components/slider.js.map +1 -0
- package/dist/components/stat-strip.d.ts +19 -0
- package/dist/components/stat-strip.js +27 -0
- package/dist/components/stat-strip.js.map +1 -0
- package/dist/components/switch.d.ts +85 -0
- package/dist/components/switch.js +94 -0
- package/dist/components/switch.js.map +1 -0
- package/dist/components/table-of-contents.d.ts +33 -0
- package/dist/components/table-of-contents.js +37 -0
- package/dist/components/table-of-contents.js.map +1 -0
- package/dist/components/table-pager.d.ts +26 -0
- package/dist/components/table-pager.js +35 -0
- package/dist/components/table-pager.js.map +1 -0
- package/dist/components/table.d.ts +45 -0
- package/dist/components/table.js +32 -0
- package/dist/components/table.js.map +1 -0
- package/dist/components/tabs.d.ts +65 -0
- package/dist/components/tabs.js +56 -0
- package/dist/components/tabs.js.map +1 -0
- package/dist/components/text.d.ts +32 -0
- package/dist/components/text.js +46 -0
- package/dist/components/text.js.map +1 -0
- package/dist/components/theme-toggle.d.ts +7 -0
- package/dist/components/theme-toggle.js +28 -0
- package/dist/components/theme-toggle.js.map +1 -0
- package/dist/components/toast.d.ts +27 -0
- package/dist/components/toast.js +78 -0
- package/dist/components/toast.js.map +1 -0
- package/dist/components/toggle-group.d.ts +4 -0
- package/dist/components/toggle-group.js +48 -0
- package/dist/components/toggle-group.js.map +1 -0
- package/dist/components/toggle.d.ts +7 -0
- package/dist/components/toggle.js +37 -0
- package/dist/components/toggle.js.map +1 -0
- package/dist/components/toolbar.d.ts +58 -0
- package/dist/components/toolbar.js +76 -0
- package/dist/components/toolbar.js.map +1 -0
- package/dist/components/tooltip.d.ts +13 -0
- package/dist/components/tooltip.js +18 -0
- package/dist/components/tooltip.js.map +1 -0
- package/dist/components/typeahead-field.d.ts +24 -0
- package/dist/components/typeahead-field.js +177 -0
- package/dist/components/typeahead-field.js.map +1 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +35 -0
- package/dist/providers/link.d.ts +12 -0
- package/dist/providers/link.js +18 -0
- package/dist/providers/link.js.map +1 -0
- package/dist/providers/theme.d.ts +11 -0
- package/dist/providers/theme.js +43 -0
- package/dist/providers/theme.js.map +1 -0
- package/dist/styles/standalone.css +2233 -0
- package/dist/styles/tailwind.css +103 -0
- package/dist/styles/tokens.css +277 -0
- package/dist/utils/cn.d.ts +2 -0
- package/dist/utils/cn.js +11 -0
- package/dist/utils/cn.js.map +1 -0
- package/dist/utils/control-surface.d.ts +2 -0
- package/dist/utils/control-surface.js +11 -0
- package/dist/utils/control-surface.js.map +1 -0
- package/dist/utils/selection-indicator.d.ts +24 -0
- package/dist/utils/selection-indicator.js +108 -0
- package/dist/utils/selection-indicator.js.map +1 -0
- package/package.json +107 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export type TableOfContentsProps = {
|
|
3
|
+
/**
|
|
4
|
+
* Accessible name and heading. Pass an empty string to hide the heading.
|
|
5
|
+
* @default "On this page"
|
|
6
|
+
*/
|
|
7
|
+
title?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Section items.
|
|
10
|
+
*/
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Additional classes for the nav.
|
|
14
|
+
*/
|
|
15
|
+
className?: string;
|
|
16
|
+
};
|
|
17
|
+
export declare function TableOfContents({ title, children, className, }: TableOfContentsProps): import("react").JSX.Element;
|
|
18
|
+
export type TableOfContentsItemProps = {
|
|
19
|
+
/**
|
|
20
|
+
* Mark the current section.
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
23
|
+
active?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Optional in-page href. Renders a link when set.
|
|
26
|
+
*/
|
|
27
|
+
href?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Section label.
|
|
30
|
+
*/
|
|
31
|
+
children: ReactNode;
|
|
32
|
+
};
|
|
33
|
+
export declare function TableOfContentsItem({ active, href, children }: TableOfContentsItemProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../utils/cn.js";
|
|
3
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/table-of-contents.tsx
|
|
5
|
+
function r({ title: r = "On this page", children: i, className: a }) {
|
|
6
|
+
return /* @__PURE__ */ n("nav", {
|
|
7
|
+
"aria-label": r || "On this page",
|
|
8
|
+
className: e("text-sm", a),
|
|
9
|
+
children: [r ? /* @__PURE__ */ t("p", {
|
|
10
|
+
className: "mb-3 text-xs font-semibold tracking-wide text-basalt-muted-foreground uppercase",
|
|
11
|
+
children: r
|
|
12
|
+
}) : null, /* @__PURE__ */ t("ul", {
|
|
13
|
+
className: "flex flex-col gap-2 border-l-2 border-basalt-border",
|
|
14
|
+
children: i
|
|
15
|
+
})]
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function i({ active: n, href: r, children: i }) {
|
|
19
|
+
let a = e("block border-l-2 py-0.5 pl-4", n ? "border-basalt-primary font-medium text-basalt-foreground" : "border-transparent text-basalt-muted-foreground");
|
|
20
|
+
return /* @__PURE__ */ t("li", {
|
|
21
|
+
className: "-ml-0.5",
|
|
22
|
+
children: r ? /* @__PURE__ */ t("a", {
|
|
23
|
+
href: r,
|
|
24
|
+
"aria-current": n ? "location" : void 0,
|
|
25
|
+
className: a,
|
|
26
|
+
children: i
|
|
27
|
+
}) : /* @__PURE__ */ t("span", {
|
|
28
|
+
"aria-current": n ? "location" : void 0,
|
|
29
|
+
className: a,
|
|
30
|
+
children: i
|
|
31
|
+
})
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { r as TableOfContents, i as TableOfContentsItem };
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=table-of-contents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-of-contents.js","names":[],"sources":["../../src/components/table-of-contents.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport { cn } from \"../utils/cn\";\n\nexport type TableOfContentsProps = {\n\t/**\n\t * Accessible name and heading. Pass an empty string to hide the heading.\n\t * @default \"On this page\"\n\t */\n\ttitle?: string;\n\t/**\n\t * Section items.\n\t */\n\tchildren: ReactNode;\n\t/**\n\t * Additional classes for the nav.\n\t */\n\tclassName?: string;\n};\n\nexport function TableOfContents({\n\ttitle = \"On this page\",\n\tchildren,\n\tclassName,\n}: TableOfContentsProps) {\n\treturn (\n\t\t<nav aria-label={title || \"On this page\"} className={cn(\"text-sm\", className)}>\n\t\t\t{title ? (\n\t\t\t\t<p className=\"mb-3 text-xs font-semibold tracking-wide text-basalt-muted-foreground uppercase\">\n\t\t\t\t\t{title}\n\t\t\t\t</p>\n\t\t\t) : null}\n\t\t\t<ul className=\"flex flex-col gap-2 border-l-2 border-basalt-border\">{children}</ul>\n\t\t</nav>\n\t);\n}\n\nexport type TableOfContentsItemProps = {\n\t/**\n\t * Mark the current section.\n\t * @default false\n\t */\n\tactive?: boolean;\n\t/**\n\t * Optional in-page href. Renders a link when set.\n\t */\n\thref?: string;\n\t/**\n\t * Section label.\n\t */\n\tchildren: ReactNode;\n};\n\nexport function TableOfContentsItem({ active, href, children }: TableOfContentsItemProps) {\n\tconst className = cn(\n\t\t\"block border-l-2 py-0.5 pl-4\",\n\t\tactive\n\t\t\t? \"border-basalt-primary font-medium text-basalt-foreground\"\n\t\t\t: \"border-transparent text-basalt-muted-foreground\",\n\t);\n\treturn (\n\t\t<li className=\"-ml-0.5\">\n\t\t\t{href ? (\n\t\t\t\t<a href={href} aria-current={active ? \"location\" : undefined} className={className}>\n\t\t\t\t\t{children}\n\t\t\t\t</a>\n\t\t\t) : (\n\t\t\t\t<span aria-current={active ? \"location\" : undefined} className={className}>\n\t\t\t\t\t{children}\n\t\t\t\t</span>\n\t\t\t)}\n\t\t</li>\n\t);\n}\n"],"mappings":";;;;AAmBA,SAAgB,EAAgB,EAC/B,WAAQ,gBACR,aACA,gBACwB;CACxB,OACC,kBAAC,OAAD;EAAK,cAAY,KAAS;EAAgB,WAAW,EAAG,WAAW,CAAS;EAA5E,UAAA,CACE,IACA,kBAAC,KAAD;GAAG,WAAU;GACX,UAAA;EACC,CAAA,IACA,MACJ,kBAAC,MAAD;GAAI,WAAU;GAAuD;EAAa,CAAA,CAC9E;;AAEP;AAkBA,SAAgB,EAAoB,EAAE,WAAQ,SAAM,eAAsC;CACzF,IAAM,IAAY,EACjB,gCACA,IACG,6DACA,iDACJ;CACA,OACC,kBAAC,MAAD;EAAI,WAAU;EACZ,UAAA,IACA,kBAAC,KAAD;GAAS;GAAM,gBAAc,IAAS,aAAa,KAAA;GAAsB;GACvE;EACC,CAAA,IAEH,kBAAC,QAAD;GAAM,gBAAc,IAAS,aAAa,KAAA;GAAsB;GAC9D;EACI,CAAA;CAEJ,CAAA;AAEN"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
export interface TablePagerRange {
|
|
3
|
+
start: number;
|
|
4
|
+
end: number;
|
|
5
|
+
totalCount: number;
|
|
6
|
+
}
|
|
7
|
+
export interface TablePagerProps {
|
|
8
|
+
/** 1-based current page. */
|
|
9
|
+
page: number;
|
|
10
|
+
/** Number of rows on each page. */
|
|
11
|
+
pageSize: number;
|
|
12
|
+
/** Total number of rows. */
|
|
13
|
+
totalCount: number;
|
|
14
|
+
/** Called with the next 1-based page. */
|
|
15
|
+
onPageChange: (page: number) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Disable every pagination control while keeping the range visible.
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
/** Replace the default range copy with a custom node. */
|
|
22
|
+
formatRange?: (range: TablePagerRange) => React.ReactNode;
|
|
23
|
+
/** Additional classes for the pager bar. */
|
|
24
|
+
className?: string;
|
|
25
|
+
}
|
|
26
|
+
export declare function TablePager({ className, disabled, formatRange, onPageChange, page, pageSize, totalCount, }: TablePagerProps): React.JSX.Element;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../utils/cn.js";
|
|
3
|
+
import { Pagination as t } from "./pagination.js";
|
|
4
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/table-pager.tsx
|
|
6
|
+
function i({ start: e, end: t, totalCount: n }) {
|
|
7
|
+
return n === 0 ? "No results" : `Showing ${e}–${t} of ${n}`;
|
|
8
|
+
}
|
|
9
|
+
function a({ className: a, disabled: o = !1, formatRange: s, onPageChange: c, page: l, pageSize: u, totalCount: d }) {
|
|
10
|
+
let f = Math.max(1, Math.ceil(d / u)), p = Math.min(f, Math.max(1, l)), m = d === 0 ? {
|
|
11
|
+
start: 0,
|
|
12
|
+
end: 0,
|
|
13
|
+
totalCount: d
|
|
14
|
+
} : {
|
|
15
|
+
start: (p - 1) * u + 1,
|
|
16
|
+
end: Math.min(p * u, d),
|
|
17
|
+
totalCount: d
|
|
18
|
+
};
|
|
19
|
+
return /* @__PURE__ */ r("div", {
|
|
20
|
+
className: e("flex flex-col gap-3 md:flex-row md:items-center md:justify-between", a),
|
|
21
|
+
children: [/* @__PURE__ */ n("p", {
|
|
22
|
+
className: "text-sm text-basalt-muted-foreground",
|
|
23
|
+
children: s ? s(m) : i(m)
|
|
24
|
+
}), /* @__PURE__ */ n(t, {
|
|
25
|
+
page: l,
|
|
26
|
+
pageCount: f,
|
|
27
|
+
disabled: o,
|
|
28
|
+
onPageChange: c
|
|
29
|
+
})]
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { a as TablePager };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=table-pager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-pager.js","names":[],"sources":["../../src/components/table-pager.tsx"],"sourcesContent":["import type * as React from \"react\";\nimport { cn } from \"../utils/cn\";\nimport { Pagination } from \"./pagination\";\n\nexport interface TablePagerRange {\n\tstart: number;\n\tend: number;\n\ttotalCount: number;\n}\n\nexport interface TablePagerProps {\n\t/** 1-based current page. */\n\tpage: number;\n\t/** Number of rows on each page. */\n\tpageSize: number;\n\t/** Total number of rows. */\n\ttotalCount: number;\n\t/** Called with the next 1-based page. */\n\tonPageChange: (page: number) => void;\n\t/**\n\t * Disable every pagination control while keeping the range visible.\n\t * @default false\n\t */\n\tdisabled?: boolean;\n\t/** Replace the default range copy with a custom node. */\n\tformatRange?: (range: TablePagerRange) => React.ReactNode;\n\t/** Additional classes for the pager bar. */\n\tclassName?: string;\n}\n\nfunction defaultRangeText({ start, end, totalCount }: TablePagerRange) {\n\tif (totalCount === 0) {\n\t\treturn \"No results\";\n\t}\n\treturn `Showing ${start}–${end} of ${totalCount}`;\n}\n\nexport function TablePager({\n\tclassName,\n\tdisabled = false,\n\tformatRange,\n\tonPageChange,\n\tpage,\n\tpageSize,\n\ttotalCount,\n}: TablePagerProps) {\n\tconst pageCount = Math.max(1, Math.ceil(totalCount / pageSize));\n\tconst current = Math.min(pageCount, Math.max(1, page));\n\tconst range: TablePagerRange =\n\t\ttotalCount === 0\n\t\t\t? { start: 0, end: 0, totalCount }\n\t\t\t: {\n\t\t\t\t\tstart: (current - 1) * pageSize + 1,\n\t\t\t\t\tend: Math.min(current * pageSize, totalCount),\n\t\t\t\t\ttotalCount,\n\t\t\t\t};\n\n\treturn (\n\t\t<div\n\t\t\tclassName={cn(\n\t\t\t\t\"flex flex-col gap-3 md:flex-row md:items-center md:justify-between\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t>\n\t\t\t<p className=\"text-sm text-basalt-muted-foreground\">\n\t\t\t\t{formatRange ? formatRange(range) : defaultRangeText(range)}\n\t\t\t</p>\n\t\t\t<Pagination\n\t\t\t\tpage={page}\n\t\t\t\tpageCount={pageCount}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tonPageChange={onPageChange}\n\t\t\t/>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;AA8BA,SAAS,EAAiB,EAAE,UAAO,QAAK,iBAA+B;CAItE,OAHI,MAAe,IACX,eAED,WAAW,EAAM,GAAG,EAAI,MAAM;AACtC;AAEA,SAAgB,EAAW,EAC1B,cACA,cAAW,IACX,gBACA,iBACA,SACA,aACA,iBACmB;CACnB,IAAM,IAAY,KAAK,IAAI,GAAG,KAAK,KAAK,IAAa,CAAQ,CAAC,GACxD,IAAU,KAAK,IAAI,GAAW,KAAK,IAAI,GAAG,CAAI,CAAC,GAC/C,IACL,MAAe,IACZ;EAAE,OAAO;EAAG,KAAK;EAAG;CAAW,IAC/B;EACA,QAAQ,IAAU,KAAK,IAAW;EAClC,KAAK,KAAK,IAAI,IAAU,GAAU,CAAU;EAC5C;CACD;CAEH,OACC,kBAAC,OAAD;EACC,WAAW,EACV,sEACA,CACD;EAJD,UAAA,CAMC,kBAAC,KAAD;GAAG,WAAU;GACX,UAAA,IAAc,EAAY,CAAK,IAAI,EAAiB,CAAK;EACxD,CAAA,GACH,kBAAC,GAAD;GACO;GACK;GACD;GACI;EACd,CAAA,CACG;;AAEP"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type TableProps = {
|
|
3
|
+
/**
|
|
4
|
+
* Additional classes for the table.
|
|
5
|
+
*/
|
|
6
|
+
className?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const Table: React.ForwardRefExoticComponent<TableProps & React.HTMLAttributes<HTMLTableElement> & React.RefAttributes<HTMLTableElement>>;
|
|
9
|
+
export declare const TableHeader: (props: React.HTMLAttributes<HTMLTableSectionElement>) => React.JSX.Element;
|
|
10
|
+
export declare const TableBody: (props: React.HTMLAttributes<HTMLTableSectionElement>) => React.JSX.Element;
|
|
11
|
+
export declare const TableFooter: (props: React.HTMLAttributes<HTMLTableSectionElement>) => React.JSX.Element;
|
|
12
|
+
export type TableRowVariant = "default" | "selected";
|
|
13
|
+
export type TableRowProps = {
|
|
14
|
+
/**
|
|
15
|
+
* Highlight the row as selected.
|
|
16
|
+
* @default "default"
|
|
17
|
+
*/
|
|
18
|
+
variant?: TableRowVariant;
|
|
19
|
+
/**
|
|
20
|
+
* Additional classes for the row.
|
|
21
|
+
*/
|
|
22
|
+
className?: string;
|
|
23
|
+
};
|
|
24
|
+
export declare const TableRow: ({ className, variant, ...props }: TableRowProps & React.HTMLAttributes<HTMLTableRowElement>) => React.JSX.Element;
|
|
25
|
+
export type TableHeadProps = {
|
|
26
|
+
/**
|
|
27
|
+
* Additional classes for the header cell.
|
|
28
|
+
*/
|
|
29
|
+
className?: string;
|
|
30
|
+
};
|
|
31
|
+
export declare const TableHead: ({ className, ...props }: TableHeadProps & React.ThHTMLAttributes<HTMLTableCellElement>) => React.JSX.Element;
|
|
32
|
+
export type TableCellProps = {
|
|
33
|
+
/**
|
|
34
|
+
* Additional classes for the cell.
|
|
35
|
+
*/
|
|
36
|
+
className?: string;
|
|
37
|
+
};
|
|
38
|
+
export declare const TableCell: ({ className, ...props }: TableCellProps & React.TdHTMLAttributes<HTMLTableCellElement>) => React.JSX.Element;
|
|
39
|
+
export type TableCaptionProps = {
|
|
40
|
+
/**
|
|
41
|
+
* Additional classes for the caption.
|
|
42
|
+
*/
|
|
43
|
+
className?: string;
|
|
44
|
+
};
|
|
45
|
+
export declare function TableCaption({ className, ...props }: TableCaptionProps & React.HTMLAttributes<HTMLTableCaptionElement>): React.JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../utils/cn.js";
|
|
3
|
+
import * as t from "react";
|
|
4
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/table.tsx
|
|
6
|
+
var r = t.forwardRef(({ className: t, ...r }, i) => /* @__PURE__ */ n("table", {
|
|
7
|
+
ref: i,
|
|
8
|
+
className: e("w-full border-separate border-spacing-0 caption-bottom text-left text-sm text-basalt-foreground", t),
|
|
9
|
+
...r
|
|
10
|
+
}));
|
|
11
|
+
r.displayName = "Table";
|
|
12
|
+
var i = (e) => /* @__PURE__ */ n("thead", { ...e }), a = (e) => /* @__PURE__ */ n("tbody", { ...e }), o = (e) => /* @__PURE__ */ n("tfoot", { ...e }), s = ({ className: t, variant: r = "default", ...i }) => /* @__PURE__ */ n("tr", {
|
|
13
|
+
...i,
|
|
14
|
+
"aria-selected": r === "selected" || i["aria-selected"],
|
|
15
|
+
className: e(r === "selected" ? "[&_td]:bg-basalt-accent" : "even:[&_td]:bg-basalt-secondary", t)
|
|
16
|
+
}), c = ({ className: t, ...r }) => /* @__PURE__ */ n("th", {
|
|
17
|
+
className: e("border-b border-basalt-border bg-basalt-card p-3 text-left font-semibold first:rounded-tl-basalt-md last:rounded-tr-basalt-md", t),
|
|
18
|
+
...r
|
|
19
|
+
}), l = ({ className: t, ...r }) => /* @__PURE__ */ n("td", {
|
|
20
|
+
className: e("p-3", t),
|
|
21
|
+
...r
|
|
22
|
+
});
|
|
23
|
+
function u({ className: t, ...r }) {
|
|
24
|
+
return /* @__PURE__ */ n("caption", {
|
|
25
|
+
className: e("mt-2 text-sm text-basalt-muted-foreground", t),
|
|
26
|
+
...r
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { r as Table, a as TableBody, u as TableCaption, l as TableCell, o as TableFooter, c as TableHead, i as TableHeader, s as TableRow };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.js","names":[],"sources":["../../src/components/table.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../utils/cn\";\n\nexport type TableProps = {\n\t/**\n\t * Additional classes for the table.\n\t */\n\tclassName?: string;\n};\n\nexport const Table = React.forwardRef<\n\tHTMLTableElement,\n\tTableProps & React.HTMLAttributes<HTMLTableElement>\n>(({ className, ...props }, ref) => (\n\t<table\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\t\"w-full border-separate border-spacing-0 caption-bottom text-left text-sm text-basalt-foreground\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n));\nTable.displayName = \"Table\";\n\nexport const TableHeader = (props: React.HTMLAttributes<HTMLTableSectionElement>) => (\n\t<thead {...props} />\n);\nexport const TableBody = (props: React.HTMLAttributes<HTMLTableSectionElement>) => (\n\t<tbody {...props} />\n);\nexport const TableFooter = (props: React.HTMLAttributes<HTMLTableSectionElement>) => (\n\t<tfoot {...props} />\n);\n\nexport type TableRowVariant = \"default\" | \"selected\";\n\nexport type TableRowProps = {\n\t/**\n\t * Highlight the row as selected.\n\t * @default \"default\"\n\t */\n\tvariant?: TableRowVariant;\n\t/**\n\t * Additional classes for the row.\n\t */\n\tclassName?: string;\n};\n\nexport const TableRow = ({\n\tclassName,\n\tvariant = \"default\",\n\t...props\n}: TableRowProps & React.HTMLAttributes<HTMLTableRowElement>) => (\n\t<tr\n\t\t{...props}\n\t\taria-selected={variant === \"selected\" ? true : props[\"aria-selected\"]}\n\t\tclassName={cn(\n\t\t\tvariant === \"selected\" ? \"[&_td]:bg-basalt-accent\" : \"even:[&_td]:bg-basalt-secondary\",\n\t\t\tclassName,\n\t\t)}\n\t/>\n);\n\nexport type TableHeadProps = {\n\t/**\n\t * Additional classes for the header cell.\n\t */\n\tclassName?: string;\n};\n\nexport const TableHead = ({\n\tclassName,\n\t...props\n}: TableHeadProps & React.ThHTMLAttributes<HTMLTableCellElement>) => (\n\t<th\n\t\tclassName={cn(\n\t\t\t\"border-b border-basalt-border bg-basalt-card p-3 text-left font-semibold first:rounded-tl-basalt-md last:rounded-tr-basalt-md\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n);\n\nexport type TableCellProps = {\n\t/**\n\t * Additional classes for the cell.\n\t */\n\tclassName?: string;\n};\n\nexport const TableCell = ({\n\tclassName,\n\t...props\n}: TableCellProps & React.TdHTMLAttributes<HTMLTableCellElement>) => (\n\t<td className={cn(\"p-3\", className)} {...props} />\n);\n\nexport type TableCaptionProps = {\n\t/**\n\t * Additional classes for the caption.\n\t */\n\tclassName?: string;\n};\n\nexport function TableCaption({\n\tclassName,\n\t...props\n}: TableCaptionProps & React.HTMLAttributes<HTMLTableCaptionElement>) {\n\treturn (\n\t\t<caption className={cn(\"mt-2 text-sm text-basalt-muted-foreground\", className)} {...props} />\n\t);\n}\n"],"mappings":";;;;;AAUA,IAAa,IAAQ,EAAM,YAGxB,EAAE,cAAW,GAAG,KAAS,MAC3B,kBAAC,SAAD;CACM;CACL,WAAW,EACV,mGACA,CACD;CACA,GAAI;AACJ,CAAA,CACD;AACD,EAAM,cAAc;AAEpB,IAAa,KAAe,MAC3B,kBAAC,SAAD,EAAO,GAAI,EAAQ,CAAA,GAEP,KAAa,MACzB,kBAAC,SAAD,EAAO,GAAI,EAAQ,CAAA,GAEP,KAAe,MAC3B,kBAAC,SAAD,EAAO,GAAI,EAAQ,CAAA,GAiBP,KAAY,EACxB,cACA,aAAU,WACV,GAAG,QAEH,kBAAC,MAAD;CACC,GAAI;CACJ,iBAAe,MAAY,cAAoB,EAAM;CACrD,WAAW,EACV,MAAY,aAAa,4BAA4B,mCACrD,CACD;AACA,CAAA,GAUW,KAAa,EACzB,cACA,GAAG,QAEH,kBAAC,MAAD;CACC,WAAW,EACV,iIACA,CACD;CACA,GAAI;AACJ,CAAA,GAUW,KAAa,EACzB,cACA,GAAG,QAEH,kBAAC,MAAD;CAAI,WAAW,EAAG,OAAO,CAAS;CAAG,GAAI;AAAQ,CAAA;AAUlD,SAAgB,EAAa,EAC5B,cACA,GAAG,KACkE;CACrE,OACC,kBAAC,WAAD;EAAS,WAAW,EAAG,6CAA6C,CAAS;EAAG,GAAI;CAAQ,CAAA;AAE9F"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export type TabsProps = Omit<React.ComponentPropsWithoutRef<typeof TabsPrimitive.Root>, "value" | "defaultValue" | "onValueChange"> & {
|
|
4
|
+
/**
|
|
5
|
+
* The controlled selected tab.
|
|
6
|
+
*/
|
|
7
|
+
value?: string;
|
|
8
|
+
/**
|
|
9
|
+
* The uncontrolled initial tab.
|
|
10
|
+
*/
|
|
11
|
+
defaultValue?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Called when the selected tab changes.
|
|
14
|
+
*/
|
|
15
|
+
onValueChange?: (value: string) => void;
|
|
16
|
+
};
|
|
17
|
+
export declare const Tabs: React.FC<TabsProps>;
|
|
18
|
+
export type TabsListProps = React.ComponentPropsWithoutRef<typeof TabsPrimitive.List> & {
|
|
19
|
+
/**
|
|
20
|
+
* Show the sliding active underline.
|
|
21
|
+
* @default true
|
|
22
|
+
*/
|
|
23
|
+
showIndicator?: boolean;
|
|
24
|
+
};
|
|
25
|
+
export declare const TabsList: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsListProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
26
|
+
/**
|
|
27
|
+
* Show the sliding active underline.
|
|
28
|
+
* @default true
|
|
29
|
+
*/
|
|
30
|
+
showIndicator?: boolean;
|
|
31
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
32
|
+
export type TabsTriggerProps = Omit<React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>, "disabled" | "value"> & {
|
|
33
|
+
/**
|
|
34
|
+
* The tab value.
|
|
35
|
+
*/
|
|
36
|
+
value: string;
|
|
37
|
+
/**
|
|
38
|
+
* Disable the tab trigger.
|
|
39
|
+
* @default false
|
|
40
|
+
*/
|
|
41
|
+
disabled?: boolean;
|
|
42
|
+
};
|
|
43
|
+
export declare const TabsTrigger: React.ForwardRefExoticComponent<Omit<Omit<TabsPrimitive.TabsTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref">, "disabled" | "value"> & {
|
|
44
|
+
/**
|
|
45
|
+
* The tab value.
|
|
46
|
+
*/
|
|
47
|
+
value: string;
|
|
48
|
+
/**
|
|
49
|
+
* Disable the tab trigger.
|
|
50
|
+
* @default false
|
|
51
|
+
*/
|
|
52
|
+
disabled?: boolean;
|
|
53
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
54
|
+
export type TabsContentProps = Omit<React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>, "value"> & {
|
|
55
|
+
/**
|
|
56
|
+
* The tab value this panel belongs to.
|
|
57
|
+
*/
|
|
58
|
+
value: string;
|
|
59
|
+
};
|
|
60
|
+
export declare const TabsContent: React.ForwardRefExoticComponent<Omit<Omit<TabsPrimitive.TabsContentProps & React.RefAttributes<HTMLDivElement>, "ref">, "value"> & {
|
|
61
|
+
/**
|
|
62
|
+
* The tab value this panel belongs to.
|
|
63
|
+
*/
|
|
64
|
+
value: string;
|
|
65
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../utils/cn.js";
|
|
3
|
+
import { OVERLAY_MOTION as t } from "./overlay.js";
|
|
4
|
+
import { useSelectionIndicator as n } from "../utils/selection-indicator.js";
|
|
5
|
+
import * as r from "react";
|
|
6
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
7
|
+
import * as o from "@radix-ui/react-tabs";
|
|
8
|
+
//#region src/components/tabs.tsx
|
|
9
|
+
function s(e) {
|
|
10
|
+
return {
|
|
11
|
+
left: e.offsetLeft,
|
|
12
|
+
width: e.offsetWidth,
|
|
13
|
+
top: e.offsetTop + e.offsetHeight,
|
|
14
|
+
height: 0
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
var c = o.Root, l = r.forwardRef(({ className: t, children: r, showIndicator: c = !0, ...l }, u) => {
|
|
18
|
+
let { ref: d, state: f, motionClassName: p } = n({
|
|
19
|
+
itemSelector: "[role=\"tab\"][data-state=\"active\"]",
|
|
20
|
+
enabled: c,
|
|
21
|
+
mapGeometry: s,
|
|
22
|
+
ref: u
|
|
23
|
+
});
|
|
24
|
+
return /* @__PURE__ */ a(o.List, {
|
|
25
|
+
ref: d,
|
|
26
|
+
className: e("relative flex flex-wrap items-center gap-1 border-b border-basalt-border", t),
|
|
27
|
+
...l,
|
|
28
|
+
children: [r, c ? /* @__PURE__ */ i("span", {
|
|
29
|
+
"aria-hidden": "true",
|
|
30
|
+
"data-slot": "selection-indicator",
|
|
31
|
+
className: e("pointer-events-none absolute h-0.5 bg-basalt-primary", p),
|
|
32
|
+
style: {
|
|
33
|
+
left: f.left,
|
|
34
|
+
width: f.visible ? f.width : 0,
|
|
35
|
+
top: f.top
|
|
36
|
+
}
|
|
37
|
+
}) : null]
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
l.displayName = o.List.displayName;
|
|
41
|
+
var u = r.forwardRef(({ className: n, ...r }, a) => /* @__PURE__ */ i(o.Trigger, {
|
|
42
|
+
ref: a,
|
|
43
|
+
className: e("inline-flex items-center justify-center px-3 py-2 text-sm font-medium text-basalt-muted-foreground transition-colors hover:text-basalt-foreground data-[state=active]:text-basalt-primary", t, n),
|
|
44
|
+
...r
|
|
45
|
+
}));
|
|
46
|
+
u.displayName = o.Trigger.displayName;
|
|
47
|
+
var d = r.forwardRef(({ className: n, ...r }, a) => /* @__PURE__ */ i(o.Content, {
|
|
48
|
+
ref: a,
|
|
49
|
+
className: e("mt-3 text-sm text-basalt-foreground data-[state=active]:animate-basalt-tab-in", t, n),
|
|
50
|
+
...r
|
|
51
|
+
}));
|
|
52
|
+
d.displayName = o.Content.displayName;
|
|
53
|
+
//#endregion
|
|
54
|
+
export { c as Tabs, d as TabsContent, l as TabsList, u as TabsTrigger };
|
|
55
|
+
|
|
56
|
+
//# sourceMappingURL=tabs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.js","names":[],"sources":["../../src/components/tabs.tsx"],"sourcesContent":["import * as TabsPrimitive from \"@radix-ui/react-tabs\";\nimport * as React from \"react\";\nimport { cn } from \"../utils/cn\";\nimport { useSelectionIndicator } from \"../utils/selection-indicator\";\nimport { OVERLAY_MOTION } from \"./overlay\";\n\nfunction measureTabUnderline(item: HTMLElement): {\n\tleft: number;\n\twidth: number;\n\ttop: number;\n\theight: number;\n} {\n\treturn {\n\t\tleft: item.offsetLeft,\n\t\twidth: item.offsetWidth,\n\t\ttop: item.offsetTop + item.offsetHeight,\n\t\theight: 0,\n\t};\n}\n\nexport type TabsProps = Omit<\n\tReact.ComponentPropsWithoutRef<typeof TabsPrimitive.Root>,\n\t\"value\" | \"defaultValue\" | \"onValueChange\"\n> & {\n\t/**\n\t * The controlled selected tab.\n\t */\n\tvalue?: string;\n\t/**\n\t * The uncontrolled initial tab.\n\t */\n\tdefaultValue?: string;\n\t/**\n\t * Called when the selected tab changes.\n\t */\n\tonValueChange?: (value: string) => void;\n};\nexport const Tabs: React.FC<TabsProps> = TabsPrimitive.Root;\n\nexport type TabsListProps = React.ComponentPropsWithoutRef<typeof TabsPrimitive.List> & {\n\t/**\n\t * Show the sliding active underline.\n\t * @default true\n\t */\n\tshowIndicator?: boolean;\n};\n\nexport const TabsList = React.forwardRef<\n\tReact.ElementRef<typeof TabsPrimitive.List>,\n\tTabsListProps\n>(({ className, children, showIndicator = true, ...props }, ref) => {\n\tconst {\n\t\tref: listRef,\n\t\tstate,\n\t\tmotionClassName,\n\t} = useSelectionIndicator({\n\t\titemSelector: '[role=\"tab\"][data-state=\"active\"]',\n\t\tenabled: showIndicator,\n\t\tmapGeometry: measureTabUnderline,\n\t\tref,\n\t});\n\n\treturn (\n\t\t<TabsPrimitive.List\n\t\t\tref={listRef}\n\t\t\tclassName={cn(\n\t\t\t\t\"relative flex flex-wrap items-center gap-1 border-b border-basalt-border\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t\t{showIndicator ? (\n\t\t\t\t<span\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\tdata-slot=\"selection-indicator\"\n\t\t\t\t\tclassName={cn(\"pointer-events-none absolute h-0.5 bg-basalt-primary\", motionClassName)}\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tleft: state.left,\n\t\t\t\t\t\twidth: state.visible ? state.width : 0,\n\t\t\t\t\t\ttop: state.top,\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t) : null}\n\t\t</TabsPrimitive.List>\n\t);\n});\nTabsList.displayName = TabsPrimitive.List.displayName;\n\nexport type TabsTriggerProps = Omit<\n\tReact.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>,\n\t\"disabled\" | \"value\"\n> & {\n\t/**\n\t * The tab value.\n\t */\n\tvalue: string;\n\t/**\n\t * Disable the tab trigger.\n\t * @default false\n\t */\n\tdisabled?: boolean;\n};\n\nexport const TabsTrigger = React.forwardRef<\n\tReact.ElementRef<typeof TabsPrimitive.Trigger>,\n\tTabsTriggerProps\n>(({ className, ...props }, ref) => (\n\t<TabsPrimitive.Trigger\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\t\"inline-flex items-center justify-center px-3 py-2 text-sm font-medium text-basalt-muted-foreground transition-colors hover:text-basalt-foreground data-[state=active]:text-basalt-primary\",\n\t\t\tOVERLAY_MOTION,\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n));\nTabsTrigger.displayName = TabsPrimitive.Trigger.displayName;\n\nexport type TabsContentProps = Omit<\n\tReact.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>,\n\t\"value\"\n> & {\n\t/**\n\t * The tab value this panel belongs to.\n\t */\n\tvalue: string;\n};\n\nexport const TabsContent = React.forwardRef<\n\tReact.ElementRef<typeof TabsPrimitive.Content>,\n\tTabsContentProps\n>(({ className, ...props }, ref) => (\n\t<TabsPrimitive.Content\n\t\tref={ref}\n\t\tclassName={cn(\n\t\t\t\"mt-3 text-sm text-basalt-foreground data-[state=active]:animate-basalt-tab-in\",\n\t\t\tOVERLAY_MOTION,\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n));\nTabsContent.displayName = TabsPrimitive.Content.displayName;\n"],"mappings":";;;;;;;;AAMA,SAAS,EAAoB,GAK3B;CACD,OAAO;EACN,MAAM,EAAK;EACX,OAAO,EAAK;EACZ,KAAK,EAAK,YAAY,EAAK;EAC3B,QAAQ;CACT;AACD;AAmBA,IAAa,IAA4B,EAAc,MAU1C,IAAW,EAAM,YAG3B,EAAE,cAAW,aAAU,mBAAgB,IAAM,GAAG,KAAS,MAAQ;CACnE,IAAM,EACL,KAAK,GACL,UACA,uBACG,EAAsB;EACzB,cAAc;EACd,SAAS;EACT,aAAa;EACb;CACD,CAAC;CAED,OACC,kBAAC,EAAc,MAAf;EACC,KAAK;EACL,WAAW,EACV,4EACA,CACD;EACA,GAAI;EANL,UAAA,CAQE,GACA,IACA,kBAAC,QAAD;GACC,eAAY;GACZ,aAAU;GACV,WAAW,EAAG,wDAAwD,CAAe;GACrF,OAAO;IACN,MAAM,EAAM;IACZ,OAAO,EAAM,UAAU,EAAM,QAAQ;IACrC,KAAK,EAAM;GACZ;EACA,CAAA,IACE,IACe;;AAEtB,CAAC;AACD,EAAS,cAAc,EAAc,KAAK;AAiB1C,IAAa,IAAc,EAAM,YAG9B,EAAE,cAAW,GAAG,KAAS,MAC3B,kBAAC,EAAc,SAAf;CACM;CACL,WAAW,EACV,6LACA,GACA,CACD;CACA,GAAI;AACJ,CAAA,CACD;AACD,EAAY,cAAc,EAAc,QAAQ;AAYhD,IAAa,IAAc,EAAM,YAG9B,EAAE,cAAW,GAAG,KAAS,MAC3B,kBAAC,EAAc,SAAf;CACM;CACL,WAAW,EACV,iFACA,GACA,CACD;CACA,GAAI;AACJ,CAAA,CACD;AACD,EAAY,cAAc,EAAc,QAAQ"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type TextVariant = "body" | "heading" | "mono";
|
|
3
|
+
export type TextSize = "xs" | "sm" | "md" | "lg" | "xl";
|
|
4
|
+
export type TextTone = "default" | "muted";
|
|
5
|
+
export type TextElement = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | "label" | "dt" | "dd" | "li" | "figcaption" | "legend" | "pre" | "code" | "em" | "strong" | "small" | "abbr" | "time";
|
|
6
|
+
export interface TextProps extends React.HTMLAttributes<HTMLElement> {
|
|
7
|
+
/**
|
|
8
|
+
* Visual role. Does not infer document outline.
|
|
9
|
+
* @default "body"
|
|
10
|
+
*/
|
|
11
|
+
variant?: TextVariant;
|
|
12
|
+
/** Type scale. Defaults by variant: body md, heading lg, mono sm. */
|
|
13
|
+
size?: TextSize;
|
|
14
|
+
/**
|
|
15
|
+
* Foreground tone.
|
|
16
|
+
* @default "default"
|
|
17
|
+
*/
|
|
18
|
+
tone?: TextTone;
|
|
19
|
+
/** Rendered HTML element. Defaults by variant: body p, heading/mono span. */
|
|
20
|
+
as?: TextElement;
|
|
21
|
+
/**
|
|
22
|
+
* Apply semibold weight.
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
bold?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Ellipsize overflow on one line.
|
|
28
|
+
* @default false
|
|
29
|
+
*/
|
|
30
|
+
truncate?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export declare const Text: React.ForwardRefExoticComponent<TextProps & React.RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../utils/cn.js";
|
|
3
|
+
import * as t from "react";
|
|
4
|
+
import { cva as n } from "class-variance-authority";
|
|
5
|
+
//#region src/components/text.tsx
|
|
6
|
+
var r = n("text-basalt-foreground", {
|
|
7
|
+
variants: {
|
|
8
|
+
size: {
|
|
9
|
+
xs: "text-xs",
|
|
10
|
+
sm: "text-sm",
|
|
11
|
+
md: "text-sm leading-6",
|
|
12
|
+
lg: "text-base",
|
|
13
|
+
xl: "text-lg"
|
|
14
|
+
},
|
|
15
|
+
tone: {
|
|
16
|
+
default: "text-basalt-foreground",
|
|
17
|
+
muted: "text-basalt-muted-foreground"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
defaultVariants: {
|
|
21
|
+
size: "md",
|
|
22
|
+
tone: "default"
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
function i(e) {
|
|
26
|
+
return e === "body" ? "p" : "span";
|
|
27
|
+
}
|
|
28
|
+
function a(e) {
|
|
29
|
+
return e === "heading" ? "lg" : e === "mono" ? "sm" : "md";
|
|
30
|
+
}
|
|
31
|
+
var o = t.forwardRef(({ as: n, bold: o = !1, className: s, size: c, tone: l = "default", truncate: u = !1, variant: d = "body", ...f }, p) => {
|
|
32
|
+
let m = n ?? i(d);
|
|
33
|
+
return t.createElement(m, {
|
|
34
|
+
...f,
|
|
35
|
+
ref: p,
|
|
36
|
+
className: e(r({
|
|
37
|
+
size: c ?? a(d),
|
|
38
|
+
tone: l
|
|
39
|
+
}), d === "heading" && "font-semibold", d === "mono" && "font-mono", o && "font-semibold", u && "min-w-0 truncate", s)
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
o.displayName = "Text";
|
|
43
|
+
//#endregion
|
|
44
|
+
export { o as Text };
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.js","names":[],"sources":["../../src/components/text.tsx"],"sourcesContent":["import { cva } from \"class-variance-authority\";\nimport * as React from \"react\";\nimport { cn } from \"../utils/cn\";\n\nexport type TextVariant = \"body\" | \"heading\" | \"mono\";\nexport type TextSize = \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\nexport type TextTone = \"default\" | \"muted\";\nexport type TextElement =\n\t| \"h1\"\n\t| \"h2\"\n\t| \"h3\"\n\t| \"h4\"\n\t| \"h5\"\n\t| \"h6\"\n\t| \"p\"\n\t| \"span\"\n\t| \"label\"\n\t| \"dt\"\n\t| \"dd\"\n\t| \"li\"\n\t| \"figcaption\"\n\t| \"legend\"\n\t| \"pre\"\n\t| \"code\"\n\t| \"em\"\n\t| \"strong\"\n\t| \"small\"\n\t| \"abbr\"\n\t| \"time\";\n\nconst textVariants = cva(\"text-basalt-foreground\", {\n\tvariants: {\n\t\tsize: {\n\t\t\txs: \"text-xs\",\n\t\t\tsm: \"text-sm\",\n\t\t\tmd: \"text-sm leading-6\",\n\t\t\tlg: \"text-base\",\n\t\t\txl: \"text-lg\",\n\t\t},\n\t\ttone: {\n\t\t\tdefault: \"text-basalt-foreground\",\n\t\t\tmuted: \"text-basalt-muted-foreground\",\n\t\t},\n\t},\n\tdefaultVariants: {\n\t\tsize: \"md\",\n\t\ttone: \"default\",\n\t},\n});\n\nexport interface TextProps extends React.HTMLAttributes<HTMLElement> {\n\t/**\n\t * Visual role. Does not infer document outline.\n\t * @default \"body\"\n\t */\n\tvariant?: TextVariant;\n\t/** Type scale. Defaults by variant: body md, heading lg, mono sm. */\n\tsize?: TextSize;\n\t/**\n\t * Foreground tone.\n\t * @default \"default\"\n\t */\n\ttone?: TextTone;\n\t/** Rendered HTML element. Defaults by variant: body p, heading/mono span. */\n\tas?: TextElement;\n\t/**\n\t * Apply semibold weight.\n\t * @default false\n\t */\n\tbold?: boolean;\n\t/**\n\t * Ellipsize overflow on one line.\n\t * @default false\n\t */\n\ttruncate?: boolean;\n}\n\nfunction defaultElement(variant: TextVariant): TextElement {\n\treturn variant === \"body\" ? \"p\" : \"span\";\n}\n\nfunction defaultSize(variant: TextVariant): TextSize {\n\tif (variant === \"heading\") {\n\t\treturn \"lg\";\n\t}\n\tif (variant === \"mono\") {\n\t\treturn \"sm\";\n\t}\n\treturn \"md\";\n}\n\nexport const Text = React.forwardRef<HTMLElement, TextProps>(\n\t(\n\t\t{\n\t\t\tas,\n\t\t\tbold = false,\n\t\t\tclassName,\n\t\t\tsize,\n\t\t\ttone = \"default\",\n\t\t\ttruncate = false,\n\t\t\tvariant = \"body\",\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst Component = as ?? defaultElement(variant);\n\t\treturn React.createElement(Component, {\n\t\t\t...props,\n\t\t\tref,\n\t\t\tclassName: cn(\n\t\t\t\ttextVariants({ size: size ?? defaultSize(variant), tone }),\n\t\t\t\tvariant === \"heading\" && \"font-semibold\",\n\t\t\t\tvariant === \"mono\" && \"font-mono\",\n\t\t\t\tbold && \"font-semibold\",\n\t\t\t\ttruncate && \"min-w-0 truncate\",\n\t\t\t\tclassName,\n\t\t\t),\n\t\t});\n\t},\n);\nText.displayName = \"Text\";\n"],"mappings":";;;;;AA8BA,IAAM,IAAe,EAAI,0BAA0B;CAClD,UAAU;EACT,MAAM;GACL,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;EACL;EACA,MAAM;GACL,SAAS;GACT,OAAO;EACR;CACD;CACA,iBAAiB;EAChB,MAAM;EACN,MAAM;CACP;AACD,CAAC;AA6BD,SAAS,EAAe,GAAmC;CAC1D,OAAO,MAAY,SAAS,MAAM;AACnC;AAEA,SAAS,EAAY,GAAgC;CAOpD,OANI,MAAY,YACR,OAEJ,MAAY,SACR,OAED;AACR;AAEA,IAAa,IAAO,EAAM,YAExB,EACC,OACA,UAAO,IACP,cACA,SACA,UAAO,WACP,cAAW,IACX,aAAU,QACV,GAAG,KAEJ,MACI;CACJ,IAAM,IAAY,KAAM,EAAe,CAAO;CAC9C,OAAO,EAAM,cAAc,GAAW;EACrC,GAAG;EACH;EACA,WAAW,EACV,EAAa;GAAE,MAAM,KAAQ,EAAY,CAAO;GAAG;EAAK,CAAC,GACzD,MAAY,aAAa,iBACzB,MAAY,UAAU,aACtB,KAAQ,iBACR,KAAY,oBACZ,CACD;CACD,CAAC;AACF,CACD;AACA,EAAK,cAAc"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Button as e } from "./button.js";
|
|
3
|
+
import { useTheme as t } from "../providers/theme.js";
|
|
4
|
+
import { Monitor as n, Moon as r, Sun as i } from "lucide-react";
|
|
5
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/theme-toggle.tsx
|
|
7
|
+
var o = {
|
|
8
|
+
className: "h-4 w-4",
|
|
9
|
+
"aria-hidden": !0,
|
|
10
|
+
strokeWidth: 1.5
|
|
11
|
+
};
|
|
12
|
+
function s({ "aria-label": s }) {
|
|
13
|
+
let { theme: c, setTheme: l } = t();
|
|
14
|
+
return /* @__PURE__ */ a(e, {
|
|
15
|
+
type: "button",
|
|
16
|
+
variant: "ghost",
|
|
17
|
+
size: "icon",
|
|
18
|
+
onClick: () => {
|
|
19
|
+
l(c === "system" ? "light" : c === "light" ? "dark" : "system");
|
|
20
|
+
},
|
|
21
|
+
"aria-label": s,
|
|
22
|
+
children: a(c === "system" ? n : c === "dark" ? r : i, { ...o })
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
export { s as ThemeToggle };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=theme-toggle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-toggle.js","names":[],"sources":["../../src/components/theme-toggle.tsx"],"sourcesContent":["import { Monitor, Moon, Sun } from \"lucide-react\";\nimport { useTheme } from \"../providers/theme\";\nimport { Button } from \"./button\";\n\nconst ICON_PROPS = { className: \"h-4 w-4\", \"aria-hidden\": true as const, strokeWidth: 1.5 };\n\nexport interface ThemeToggleProps {\n\t/**\n\t * Accessible name for the toggle.\n\t */\n\t\"aria-label\": string;\n}\n\nexport function ThemeToggle({ \"aria-label\": ariaLabel }: ThemeToggleProps) {\n\tconst { theme, setTheme } = useTheme();\n\tconst cycle = () => {\n\t\tif (theme === \"system\") setTheme(\"light\");\n\t\telse if (theme === \"light\") setTheme(\"dark\");\n\t\telse setTheme(\"system\");\n\t};\n\treturn (\n\t\t<Button type=\"button\" variant=\"ghost\" size=\"icon\" onClick={cycle} aria-label={ariaLabel}>\n\t\t\t{theme === \"system\" ? (\n\t\t\t\t<Monitor {...ICON_PROPS} />\n\t\t\t) : theme === \"dark\" ? (\n\t\t\t\t<Moon {...ICON_PROPS} />\n\t\t\t) : (\n\t\t\t\t<Sun {...ICON_PROPS} />\n\t\t\t)}\n\t\t</Button>\n\t);\n}\n"],"mappings":";;;;;;AAIA,IAAM,IAAa;CAAE,WAAW;CAAW,eAAe;CAAe,aAAa;AAAI;AAS1F,SAAgB,EAAY,EAAE,cAAc,KAA+B;CAC1E,IAAM,EAAE,UAAO,gBAAa,EAAS;CAMrC,OACC,kBAAC,GAAD;EAAQ,MAAK;EAAS,SAAQ;EAAQ,MAAK;EAAO,eAN/B;GACnB,AAAwB,EAApB,MAAU,WAAmB,UACxB,MAAU,UAAkB,SACvB,QAAQ;EACvB;EAEmE,cAAY;EAC5E,UACA,EADA,MAAU,WACT,IACE,MAAU,SACZ,IAEA,GAJD,EAAS,GAAI,EAAa,CAIJ;CAEhB,CAAA;AAEV"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from "react";
|
|
2
|
+
import { Toaster as Sonner } from "sonner";
|
|
3
|
+
export type ToastVariant = "default" | "success" | "error" | "warning" | "info";
|
|
4
|
+
export type ToastOptions = {
|
|
5
|
+
description?: ReactNode;
|
|
6
|
+
icon?: ReactNode | false;
|
|
7
|
+
close?: boolean;
|
|
8
|
+
duration?: number;
|
|
9
|
+
id?: string | number;
|
|
10
|
+
action?: {
|
|
11
|
+
label: string;
|
|
12
|
+
onClick: () => void;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
declare function show(message: ReactNode, options?: ToastOptions & {
|
|
16
|
+
variant?: ToastVariant;
|
|
17
|
+
}): string | number;
|
|
18
|
+
export declare const toast: typeof show & {
|
|
19
|
+
success: (message: ReactNode, options?: ToastOptions) => string | number;
|
|
20
|
+
error: (message: ReactNode, options?: ToastOptions) => string | number;
|
|
21
|
+
warning: (message: ReactNode, options?: ToastOptions) => string | number;
|
|
22
|
+
info: (message: ReactNode, options?: ToastOptions) => string | number;
|
|
23
|
+
dismiss: (id?: number | string) => string | number;
|
|
24
|
+
};
|
|
25
|
+
export declare function Toaster({ closeButton, ...props }: ComponentProps<typeof Sonner>): import("react").JSX.Element;
|
|
26
|
+
export declare const Toast: typeof Toaster;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Check as e, CircleAlert as t, Info as n, TriangleAlert as r, X as i } from "lucide-react";
|
|
3
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
4
|
+
import { Toaster as o, toast as s } from "sonner";
|
|
5
|
+
//#region src/components/toast.tsx
|
|
6
|
+
var c = {
|
|
7
|
+
default: "bg-basalt-popover",
|
|
8
|
+
success: "bg-basalt-heatmap-green-1 [&_[data-icon]]:text-basalt-heatmap-green-4 [&_[data-title]]:text-basalt-heatmap-green-4",
|
|
9
|
+
error: "bg-basalt-danger-tint [&_[data-icon]]:text-basalt-danger [&_[data-title]]:text-basalt-danger",
|
|
10
|
+
warning: "bg-basalt-warning-tint [&_[data-icon]]:text-basalt-warning [&_[data-title]]:text-basalt-warning",
|
|
11
|
+
info: "bg-basalt-info-tint [&_[data-icon]]:text-basalt-info [&_[data-title]]:text-basalt-info"
|
|
12
|
+
}, l = {
|
|
13
|
+
default: null,
|
|
14
|
+
success: /* @__PURE__ */ a(e, { className: "size-4" }),
|
|
15
|
+
error: /* @__PURE__ */ a(t, { className: "size-4" }),
|
|
16
|
+
warning: /* @__PURE__ */ a(r, { className: "size-4" }),
|
|
17
|
+
info: /* @__PURE__ */ a(n, { className: "size-4" })
|
|
18
|
+
};
|
|
19
|
+
function u(e, t) {
|
|
20
|
+
return t === !1 ? !1 : t ?? l[e] ?? void 0;
|
|
21
|
+
}
|
|
22
|
+
function d(e, t = {}) {
|
|
23
|
+
let { variant: n = "default", icon: r, close: i = !0, ...a } = t, o = {
|
|
24
|
+
...a,
|
|
25
|
+
closeButton: i,
|
|
26
|
+
className: c[n],
|
|
27
|
+
icon: u(n, r)
|
|
28
|
+
};
|
|
29
|
+
return n === "success" ? s.success(e, o) : n === "error" ? s.error(e, o) : n === "warning" ? s.warning(e, o) : n === "info" ? s.info(e, o) : s(e, o);
|
|
30
|
+
}
|
|
31
|
+
var f = Object.assign(d, {
|
|
32
|
+
success: (e, t) => d(e, {
|
|
33
|
+
...t,
|
|
34
|
+
variant: "success"
|
|
35
|
+
}),
|
|
36
|
+
error: (e, t) => d(e, {
|
|
37
|
+
...t,
|
|
38
|
+
variant: "error"
|
|
39
|
+
}),
|
|
40
|
+
warning: (e, t) => d(e, {
|
|
41
|
+
...t,
|
|
42
|
+
variant: "warning"
|
|
43
|
+
}),
|
|
44
|
+
info: (e, t) => d(e, {
|
|
45
|
+
...t,
|
|
46
|
+
variant: "info"
|
|
47
|
+
}),
|
|
48
|
+
dismiss: s.dismiss
|
|
49
|
+
});
|
|
50
|
+
function p({ closeButton: s = !0, ...l }) {
|
|
51
|
+
return /* @__PURE__ */ a(o, {
|
|
52
|
+
closeButton: s,
|
|
53
|
+
icons: {
|
|
54
|
+
success: /* @__PURE__ */ a(e, { className: "size-4" }),
|
|
55
|
+
error: /* @__PURE__ */ a(t, { className: "size-4" }),
|
|
56
|
+
warning: /* @__PURE__ */ a(r, { className: "size-4" }),
|
|
57
|
+
info: /* @__PURE__ */ a(n, { className: "size-4" }),
|
|
58
|
+
close: /* @__PURE__ */ a(i, { className: "size-3.5" })
|
|
59
|
+
},
|
|
60
|
+
toastOptions: { classNames: {
|
|
61
|
+
toast: "border border-basalt-border text-basalt-foreground shadow-lg",
|
|
62
|
+
title: "text-sm font-medium",
|
|
63
|
+
description: "text-sm text-basalt-muted-foreground",
|
|
64
|
+
closeButton: "border-basalt-border bg-basalt-popover text-basalt-muted-foreground hover:text-basalt-foreground",
|
|
65
|
+
icon: "size-4",
|
|
66
|
+
success: c.success,
|
|
67
|
+
error: c.error,
|
|
68
|
+
warning: c.warning,
|
|
69
|
+
info: c.info
|
|
70
|
+
} },
|
|
71
|
+
...l
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
var m = p;
|
|
75
|
+
//#endregion
|
|
76
|
+
export { m as Toast, p as Toaster, f as toast };
|
|
77
|
+
|
|
78
|
+
//# sourceMappingURL=toast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast.js","names":[],"sources":["../../src/components/toast.tsx"],"sourcesContent":["import { Check, CircleAlert, Info, TriangleAlert, X } from \"lucide-react\";\nimport type { ComponentProps, ReactNode } from \"react\";\nimport { Toaster as Sonner, toast as sonnerToast } from \"sonner\";\n\nexport type ToastVariant = \"default\" | \"success\" | \"error\" | \"warning\" | \"info\";\n\nexport type ToastOptions = {\n\tdescription?: ReactNode;\n\ticon?: ReactNode | false;\n\tclose?: boolean;\n\tduration?: number;\n\tid?: string | number;\n\taction?: {\n\t\tlabel: string;\n\t\tonClick: () => void;\n\t};\n};\n\nconst VARIANT_CLASS: Record<ToastVariant, string> = {\n\tdefault: \"bg-basalt-popover\",\n\tsuccess:\n\t\t\"bg-basalt-heatmap-green-1 [&_[data-icon]]:text-basalt-heatmap-green-4 [&_[data-title]]:text-basalt-heatmap-green-4\",\n\terror:\n\t\t\"bg-basalt-danger-tint [&_[data-icon]]:text-basalt-danger [&_[data-title]]:text-basalt-danger\",\n\twarning:\n\t\t\"bg-basalt-warning-tint [&_[data-icon]]:text-basalt-warning [&_[data-title]]:text-basalt-warning\",\n\tinfo: \"bg-basalt-info-tint [&_[data-icon]]:text-basalt-info [&_[data-title]]:text-basalt-info\",\n};\n\nconst VARIANT_ICON: Record<ToastVariant, ReactNode> = {\n\tdefault: null,\n\tsuccess: <Check className=\"size-4\" />,\n\terror: <CircleAlert className=\"size-4\" />,\n\twarning: <TriangleAlert className=\"size-4\" />,\n\tinfo: <Info className=\"size-4\" />,\n};\n\nfunction resolveIcon(variant: ToastVariant, icon: ToastOptions[\"icon\"]) {\n\tif (icon === false) {\n\t\treturn false;\n\t}\n\tif (icon != null) {\n\t\treturn icon;\n\t}\n\treturn VARIANT_ICON[variant] ?? undefined;\n}\n\nfunction show(message: ReactNode, options: ToastOptions & { variant?: ToastVariant } = {}) {\n\tconst { variant = \"default\", icon, close = true, ...rest } = options;\n\tconst payload = {\n\t\t...rest,\n\t\tcloseButton: close,\n\t\tclassName: VARIANT_CLASS[variant],\n\t\ticon: resolveIcon(variant, icon),\n\t};\n\tif (variant === \"success\") {\n\t\treturn sonnerToast.success(message, payload);\n\t}\n\tif (variant === \"error\") {\n\t\treturn sonnerToast.error(message, payload);\n\t}\n\tif (variant === \"warning\") {\n\t\treturn sonnerToast.warning(message, payload);\n\t}\n\tif (variant === \"info\") {\n\t\treturn sonnerToast.info(message, payload);\n\t}\n\treturn sonnerToast(message, payload);\n}\n\nexport const toast = Object.assign(show, {\n\tsuccess: (message: ReactNode, options?: ToastOptions) =>\n\t\tshow(message, { ...options, variant: \"success\" }),\n\terror: (message: ReactNode, options?: ToastOptions) =>\n\t\tshow(message, { ...options, variant: \"error\" }),\n\twarning: (message: ReactNode, options?: ToastOptions) =>\n\t\tshow(message, { ...options, variant: \"warning\" }),\n\tinfo: (message: ReactNode, options?: ToastOptions) =>\n\t\tshow(message, { ...options, variant: \"info\" }),\n\tdismiss: sonnerToast.dismiss,\n});\n\nexport function Toaster({ closeButton = true, ...props }: ComponentProps<typeof Sonner>) {\n\treturn (\n\t\t<Sonner\n\t\t\tcloseButton={closeButton}\n\t\t\ticons={{\n\t\t\t\tsuccess: <Check className=\"size-4\" />,\n\t\t\t\terror: <CircleAlert className=\"size-4\" />,\n\t\t\t\twarning: <TriangleAlert className=\"size-4\" />,\n\t\t\t\tinfo: <Info className=\"size-4\" />,\n\t\t\t\tclose: <X className=\"size-3.5\" />,\n\t\t\t}}\n\t\t\ttoastOptions={{\n\t\t\t\tclassNames: {\n\t\t\t\t\ttoast: \"border border-basalt-border text-basalt-foreground shadow-lg\",\n\t\t\t\t\ttitle: \"text-sm font-medium\",\n\t\t\t\t\tdescription: \"text-sm text-basalt-muted-foreground\",\n\t\t\t\t\tcloseButton:\n\t\t\t\t\t\t\"border-basalt-border bg-basalt-popover text-basalt-muted-foreground hover:text-basalt-foreground\",\n\t\t\t\t\ticon: \"size-4\",\n\t\t\t\t\tsuccess: VARIANT_CLASS.success,\n\t\t\t\t\terror: VARIANT_CLASS.error,\n\t\t\t\t\twarning: VARIANT_CLASS.warning,\n\t\t\t\t\tinfo: VARIANT_CLASS.info,\n\t\t\t\t},\n\t\t\t}}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport const Toast = Toaster;\n"],"mappings":";;;;;AAkBA,IAAM,IAA8C;CACnD,SAAS;CACT,SACC;CACD,OACC;CACD,SACC;CACD,MAAM;AACP,GAEM,IAAgD;CACrD,SAAS;CACT,SAAS,kBAAC,GAAD,EAAO,WAAU,SAAU,CAAA;CACpC,OAAO,kBAAC,GAAD,EAAa,WAAU,SAAU,CAAA;CACxC,SAAS,kBAAC,GAAD,EAAe,WAAU,SAAU,CAAA;CAC5C,MAAM,kBAAC,GAAD,EAAM,WAAU,SAAU,CAAA;AACjC;AAEA,SAAS,EAAY,GAAuB,GAA4B;CAOvE,OANI,MAAS,KACL,KAEJ,KAGG,EAAa,MAAY,KAAA;AACjC;AAEA,SAAS,EAAK,GAAoB,IAAqD,CAAC,GAAG;CAC1F,IAAM,EAAE,aAAU,WAAW,SAAM,WAAQ,IAAM,GAAG,MAAS,GACvD,IAAU;EACf,GAAG;EACH,aAAa;EACb,WAAW,EAAc;EACzB,MAAM,EAAY,GAAS,CAAI;CAChC;CAaA,OAZI,MAAY,YACR,EAAY,QAAQ,GAAS,CAAO,IAExC,MAAY,UACR,EAAY,MAAM,GAAS,CAAO,IAEtC,MAAY,YACR,EAAY,QAAQ,GAAS,CAAO,IAExC,MAAY,SACR,EAAY,KAAK,GAAS,CAAO,IAElC,EAAY,GAAS,CAAO;AACpC;AAEA,IAAa,IAAQ,OAAO,OAAO,GAAM;CACxC,UAAU,GAAoB,MAC7B,EAAK,GAAS;EAAE,GAAG;EAAS,SAAS;CAAU,CAAC;CACjD,QAAQ,GAAoB,MAC3B,EAAK,GAAS;EAAE,GAAG;EAAS,SAAS;CAAQ,CAAC;CAC/C,UAAU,GAAoB,MAC7B,EAAK,GAAS;EAAE,GAAG;EAAS,SAAS;CAAU,CAAC;CACjD,OAAO,GAAoB,MAC1B,EAAK,GAAS;EAAE,GAAG;EAAS,SAAS;CAAO,CAAC;CAC9C,SAAS,EAAY;AACtB,CAAC;AAED,SAAgB,EAAQ,EAAE,iBAAc,IAAM,GAAG,KAAwC;CACxF,OACC,kBAAC,GAAD;EACc;EACb,OAAO;GACN,SAAS,kBAAC,GAAD,EAAO,WAAU,SAAU,CAAA;GACpC,OAAO,kBAAC,GAAD,EAAa,WAAU,SAAU,CAAA;GACxC,SAAS,kBAAC,GAAD,EAAe,WAAU,SAAU,CAAA;GAC5C,MAAM,kBAAC,GAAD,EAAM,WAAU,SAAU,CAAA;GAChC,OAAO,kBAAC,GAAD,EAAG,WAAU,WAAY,CAAA;EACjC;EACA,cAAc,EACb,YAAY;GACX,OAAO;GACP,OAAO;GACP,aAAa;GACb,aACC;GACD,MAAM;GACN,SAAS,EAAc;GACvB,OAAO,EAAc;GACrB,SAAS,EAAc;GACvB,MAAM,EAAc;EACrB,EACD;EACA,GAAI;CACJ,CAAA;AAEH;AAEA,IAAa,IAAQ"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export declare const ToggleGroup: React.ForwardRefExoticComponent<(Omit<ToggleGroupPrimitive.ToggleGroupMultipleProps & React.RefAttributes<HTMLDivElement>, "ref"> | Omit<ToggleGroupPrimitive.ToggleGroupSingleProps & React.RefAttributes<HTMLDivElement>, "ref">) & React.RefAttributes<HTMLDivElement>>;
|
|
4
|
+
export declare const ToggleGroupItem: React.ForwardRefExoticComponent<Omit<ToggleGroupPrimitive.ToggleGroupItemProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|