@refine-studio/ui 0.0.0 → 0.2.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 +102 -2
- package/dist/components/accordion/accordion.d.ts +15 -0
- package/dist/components/accordion/accordion.js +58 -0
- package/dist/components/accordion/accordion.js.map +1 -0
- package/dist/components/alert/alert.d.ts +24 -0
- package/dist/components/alert/alert.js +98 -0
- package/dist/components/alert/alert.js.map +1 -0
- package/dist/components/alert-dialog/alert-dialog.d.ts +36 -0
- package/dist/components/alert-dialog/alert-dialog.js +112 -0
- package/dist/components/alert-dialog/alert-dialog.js.map +1 -0
- package/dist/components/app-shell/app-shell.d.ts +77 -0
- package/dist/components/app-shell/app-shell.js +224 -0
- package/dist/components/app-shell/app-shell.js.map +1 -0
- package/dist/components/avatar/avatar.d.ts +32 -0
- package/dist/components/avatar/avatar.js +83 -0
- package/dist/components/avatar/avatar.js.map +1 -0
- package/dist/components/badge/badge.d.ts +15 -0
- package/dist/components/badge/badge.js +50 -0
- package/dist/components/badge/badge.js.map +1 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts +24 -0
- package/dist/components/breadcrumb/breadcrumb.js +82 -0
- package/dist/components/breadcrumb/breadcrumb.js.map +1 -0
- package/dist/components/button/button.d.ts +15 -0
- package/dist/components/button/button.js +75 -0
- package/dist/components/button/button.js.map +1 -0
- package/dist/components/card/card.d.ts +46 -0
- package/dist/components/card/card.js +124 -0
- package/dist/components/card/card.js.map +1 -0
- package/dist/components/checkbox/checkbox.d.ts +6 -0
- package/dist/components/checkbox/checkbox.js +31 -0
- package/dist/components/checkbox/checkbox.js.map +1 -0
- package/dist/components/chip/chip.d.ts +25 -0
- package/dist/components/chip/chip.js +54 -0
- package/dist/components/chip/chip.js.map +1 -0
- package/dist/components/code/code.d.ts +15 -0
- package/dist/components/code/code.js +63 -0
- package/dist/components/code/code.js.map +1 -0
- package/dist/components/collapsible/collapsible.d.ts +14 -0
- package/dist/components/collapsible/collapsible.js +55 -0
- package/dist/components/collapsible/collapsible.js.map +1 -0
- package/dist/components/combobox/combobox.d.ts +33 -0
- package/dist/components/combobox/combobox.js +244 -0
- package/dist/components/combobox/combobox.js.map +1 -0
- package/dist/components/command-menu/command-menu.d.ts +35 -0
- package/dist/components/command-menu/command-menu.js +116 -0
- package/dist/components/command-menu/command-menu.js.map +1 -0
- package/dist/components/context-menu/context-menu.d.ts +45 -0
- package/dist/components/context-menu/context-menu.js +136 -0
- package/dist/components/context-menu/context-menu.js.map +1 -0
- package/dist/components/data-table/data-table.d.ts +49 -0
- package/dist/components/data-table/data-table.js +171 -0
- package/dist/components/data-table/data-table.js.map +1 -0
- package/dist/components/data-table/sort-rows.d.ts +6 -0
- package/dist/components/data-table/sort-rows.js +33 -0
- package/dist/components/data-table/sort-rows.js.map +1 -0
- package/dist/components/dialog/dialog.d.ts +42 -0
- package/dist/components/dialog/dialog.js +118 -0
- package/dist/components/dialog/dialog.js.map +1 -0
- package/dist/components/dropdown-menu/dropdown-menu.d.ts +45 -0
- package/dist/components/dropdown-menu/dropdown-menu.js +137 -0
- package/dist/components/dropdown-menu/dropdown-menu.js.map +1 -0
- package/dist/components/dropdown-menu/menu-styles.d.ts +10 -0
- package/dist/components/dropdown-menu/menu-styles.js +34 -0
- package/dist/components/dropdown-menu/menu-styles.js.map +1 -0
- package/dist/components/empty-state/empty-state.d.ts +12 -0
- package/dist/components/empty-state/empty-state.js +46 -0
- package/dist/components/empty-state/empty-state.js.map +1 -0
- package/dist/components/eyebrow/eyebrow.d.ts +9 -0
- package/dist/components/eyebrow/eyebrow.js +25 -0
- package/dist/components/eyebrow/eyebrow.js.map +1 -0
- package/dist/components/field/field.d.ts +56 -0
- package/dist/components/field/field.js +135 -0
- package/dist/components/field/field.js.map +1 -0
- package/dist/components/glow-border/glow-border.d.ts +9 -0
- package/dist/components/glow-border/glow-border.js +39 -0
- package/dist/components/glow-border/glow-border.js.map +1 -0
- package/dist/components/hex-field/hex-field.d.ts +12 -0
- package/dist/components/hex-field/hex-field.js +86 -0
- package/dist/components/hex-field/hex-field.js.map +1 -0
- package/dist/components/input/input.d.ts +14 -0
- package/dist/components/input/input.js +52 -0
- package/dist/components/input/input.js.map +1 -0
- package/dist/components/kbd/kbd.d.ts +9 -0
- package/dist/components/kbd/kbd.js +26 -0
- package/dist/components/kbd/kbd.js.map +1 -0
- package/dist/components/label/label.d.ts +6 -0
- package/dist/components/label/label.js +17 -0
- package/dist/components/label/label.js.map +1 -0
- package/dist/components/logo/logo-paths.d.ts +5 -0
- package/dist/components/logo/logo-paths.js +20 -0
- package/dist/components/logo/logo-paths.js.map +1 -0
- package/dist/components/logo/logo.d.ts +18 -0
- package/dist/components/logo/logo.js +94 -0
- package/dist/components/logo/logo.js.map +1 -0
- package/dist/components/marquee/marquee.d.ts +15 -0
- package/dist/components/marquee/marquee.js +54 -0
- package/dist/components/marquee/marquee.js.map +1 -0
- package/dist/components/page-header/page-header.d.ts +15 -0
- package/dist/components/page-header/page-header.js +50 -0
- package/dist/components/page-header/page-header.js.map +1 -0
- package/dist/components/pagination/pagination.d.ts +28 -0
- package/dist/components/pagination/pagination.js +95 -0
- package/dist/components/pagination/pagination.js.map +1 -0
- package/dist/components/popover/popover.d.ts +14 -0
- package/dist/components/popover/popover.js +48 -0
- package/dist/components/popover/popover.js.map +1 -0
- package/dist/components/progress/progress.d.ts +14 -0
- package/dist/components/progress/progress.js +41 -0
- package/dist/components/progress/progress.js.map +1 -0
- package/dist/components/radio-group/radio-group.d.ts +10 -0
- package/dist/components/radio-group/radio-group.js +33 -0
- package/dist/components/radio-group/radio-group.js.map +1 -0
- package/dist/components/section-heading/section-heading.d.ts +18 -0
- package/dist/components/section-heading/section-heading.js +57 -0
- package/dist/components/section-heading/section-heading.js.map +1 -0
- package/dist/components/select/select.d.ts +32 -0
- package/dist/components/select/select.js +100 -0
- package/dist/components/select/select.js.map +1 -0
- package/dist/components/separator/separator.d.ts +10 -0
- package/dist/components/separator/separator.js +37 -0
- package/dist/components/separator/separator.js.map +1 -0
- package/dist/components/sheet/sheet.d.ts +29 -0
- package/dist/components/sheet/sheet.js +130 -0
- package/dist/components/sheet/sheet.js.map +1 -0
- package/dist/components/skeleton/skeleton.d.ts +5 -0
- package/dist/components/skeleton/skeleton.js +18 -0
- package/dist/components/skeleton/skeleton.js.map +1 -0
- package/dist/components/slider/slider.d.ts +10 -0
- package/dist/components/slider/slider.js +36 -0
- package/dist/components/slider/slider.js.map +1 -0
- package/dist/components/spinner/spinner.d.ts +9 -0
- package/dist/components/spinner/spinner.js +40 -0
- package/dist/components/spinner/spinner.js.map +1 -0
- package/dist/components/spotlight/spotlight.d.ts +9 -0
- package/dist/components/spotlight/spotlight.js +32 -0
- package/dist/components/spotlight/spotlight.js.map +1 -0
- package/dist/components/starfield/starfield.d.ts +11 -0
- package/dist/components/starfield/starfield.js +76 -0
- package/dist/components/starfield/starfield.js.map +1 -0
- package/dist/components/stat/stat.d.ts +28 -0
- package/dist/components/stat/stat.js +100 -0
- package/dist/components/stat/stat.js.map +1 -0
- package/dist/components/switch/switch.d.ts +13 -0
- package/dist/components/switch/switch.js +44 -0
- package/dist/components/switch/switch.js.map +1 -0
- package/dist/components/table/table.d.ts +52 -0
- package/dist/components/table/table.js +96 -0
- package/dist/components/table/table.js.map +1 -0
- package/dist/components/tabs/tabs.d.ts +24 -0
- package/dist/components/tabs/tabs.js +89 -0
- package/dist/components/tabs/tabs.js.map +1 -0
- package/dist/components/textarea/textarea.d.ts +5 -0
- package/dist/components/textarea/textarea.js +20 -0
- package/dist/components/textarea/textarea.js.map +1 -0
- package/dist/components/theme-switcher/theme-switcher.d.ts +7 -0
- package/dist/components/theme-switcher/theme-switcher.js +57 -0
- package/dist/components/theme-switcher/theme-switcher.js.map +1 -0
- package/dist/components/toaster/toaster.d.ts +7 -0
- package/dist/components/toaster/toaster.js +43 -0
- package/dist/components/toaster/toaster.js.map +1 -0
- package/dist/components/toggle-group/toggle-group.d.ts +24 -0
- package/dist/components/toggle-group/toggle-group.js +84 -0
- package/dist/components/toggle-group/toggle-group.js.map +1 -0
- package/dist/components/tooltip/tooltip.d.ts +19 -0
- package/dist/components/tooltip/tooltip.js +49 -0
- package/dist/components/tooltip/tooltip.js.map +1 -0
- package/dist/fonts/geist-cyrillic-ext-wght-normal.woff2 +0 -0
- package/dist/fonts/geist-cyrillic-wght-normal.woff2 +0 -0
- package/dist/fonts/geist-latin-ext-wght-normal.woff2 +0 -0
- package/dist/fonts/geist-latin-wght-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-cyrillic-ext-wght-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-cyrillic-wght-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-latin-ext-wght-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-latin-wght-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-symbols2-wght-normal.woff2 +0 -0
- package/dist/fonts/geist-mono-vietnamese-wght-normal.woff2 +0 -0
- package/dist/fonts/geist-mono.LICENSE +93 -0
- package/dist/fonts/geist-vietnamese-wght-normal.woff2 +0 -0
- package/dist/fonts/geist.LICENSE +93 -0
- package/dist/icons/icon.d.ts +10 -0
- package/dist/icons/icon.js +13 -0
- package/dist/icons/icon.js.map +1 -0
- package/dist/icons/refine-icon-names.d.ts +5 -0
- package/dist/icons/refine-icon-names.js +16 -0
- package/dist/icons/refine-icon-names.js.map +1 -0
- package/dist/icons/refine-icons.d.ts +467 -0
- package/dist/icons/refine-icons.js +473 -0
- package/dist/icons/refine-icons.js.map +1 -0
- package/dist/icons/with-refine-weight.d.ts +11 -0
- package/dist/icons/with-refine-weight.js +25 -0
- package/dist/icons/with-refine-weight.js.map +1 -0
- package/dist/index.d.ts +61 -0
- package/dist/index.js +61 -0
- package/dist/lib/cn.d.ts +5 -0
- package/dist/lib/cn.js +49 -0
- package/dist/lib/cn.js.map +1 -0
- package/dist/lib/use-breakpoint.d.ts +16 -0
- package/dist/lib/use-breakpoint.js +52 -0
- package/dist/lib/use-breakpoint.js.map +1 -0
- package/dist/styles.css +697 -0
- package/dist/theme/theme-provider.d.ts +31 -0
- package/dist/theme/theme-provider.js +115 -0
- package/dist/theme/theme-provider.js.map +1 -0
- package/dist/theme/theme-scope.d.ts +12 -0
- package/dist/theme/theme-scope.js +22 -0
- package/dist/theme/theme-scope.js.map +1 -0
- package/dist/theme/theme.d.ts +20 -0
- package/dist/theme/theme.js +37 -0
- package/dist/theme/theme.js.map +1 -0
- package/package.json +91 -5
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../lib/cn.js";
|
|
3
|
+
import { RefineIconCloseMD } from "../../icons/refine-icons.js";
|
|
4
|
+
import { DIALOG_CLOSE_CLASS_NAME, DIALOG_OVERLAY_CLASS_NAME } from "../dialog/dialog.js";
|
|
5
|
+
import { Dialog } from "radix-ui";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { cva } from "class-variance-authority";
|
|
8
|
+
// src/components/sheet/sheet.tsx
|
|
9
|
+
var sheetContentVariants = cva(["fixed z-50 flex flex-col bg-popover text-popover-foreground shadow-float outline-none", "ease-out-expo data-[state=closed]:animate-out data-[state=closed]:duration-200 data-[state=open]:animate-in data-[state=open]:duration-300"], {
|
|
10
|
+
variants: {
|
|
11
|
+
side: {
|
|
12
|
+
right: "inset-y-0 right-0 h-full w-[calc(100vw-2rem)] border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right",
|
|
13
|
+
left: "inset-y-0 left-0 h-full w-[calc(100vw-2rem)] border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left",
|
|
14
|
+
top: "inset-x-0 top-0 max-h-[85dvh] border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
|
|
15
|
+
bottom: "inset-x-0 bottom-0 max-h-[85dvh] rounded-t-panel border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom"
|
|
16
|
+
},
|
|
17
|
+
size: {
|
|
18
|
+
sm: "",
|
|
19
|
+
md: "",
|
|
20
|
+
lg: ""
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
compoundVariants: [
|
|
24
|
+
{
|
|
25
|
+
side: ["left", "right"],
|
|
26
|
+
size: "sm",
|
|
27
|
+
className: "max-w-sm"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
side: ["left", "right"],
|
|
31
|
+
size: "md",
|
|
32
|
+
className: "max-w-lg"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
side: ["left", "right"],
|
|
36
|
+
size: "lg",
|
|
37
|
+
className: "max-w-3xl"
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
defaultVariants: {
|
|
41
|
+
side: "right",
|
|
42
|
+
size: "md"
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* Holds the open state of a panel that slides in from an edge of the screen.
|
|
47
|
+
*/
|
|
48
|
+
var Sheet = (props) => {
|
|
49
|
+
return /* @__PURE__ */ jsx(Dialog.Root, {
|
|
50
|
+
"data-slot": "sheet",
|
|
51
|
+
...props
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
var SheetTrigger = (props) => {
|
|
55
|
+
return /* @__PURE__ */ jsx(Dialog.Trigger, {
|
|
56
|
+
"data-slot": "sheet-trigger",
|
|
57
|
+
...props
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
var SheetClose = (props) => {
|
|
61
|
+
return /* @__PURE__ */ jsx(Dialog.Close, {
|
|
62
|
+
"data-slot": "sheet-close",
|
|
63
|
+
...props
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Portals the sliding panel above a blurred scrim, from the given `side`.
|
|
68
|
+
*/
|
|
69
|
+
var SheetContent = ({ children, className, showClose = true, side, size, ...props }) => {
|
|
70
|
+
return /* @__PURE__ */ jsxs(Dialog.Portal, { children: [/* @__PURE__ */ jsx(Dialog.Overlay, {
|
|
71
|
+
className: DIALOG_OVERLAY_CLASS_NAME,
|
|
72
|
+
"data-slot": "sheet-overlay"
|
|
73
|
+
}), /* @__PURE__ */ jsxs(Dialog.Content, {
|
|
74
|
+
className: cn(sheetContentVariants({
|
|
75
|
+
side,
|
|
76
|
+
size
|
|
77
|
+
}), className),
|
|
78
|
+
"data-slot": "sheet-content",
|
|
79
|
+
...props,
|
|
80
|
+
children: [children, showClose && /* @__PURE__ */ jsxs(Dialog.Close, {
|
|
81
|
+
className: DIALOG_CLOSE_CLASS_NAME,
|
|
82
|
+
title: "Close",
|
|
83
|
+
children: [/* @__PURE__ */ jsx(RefineIconCloseMD, { className: "size-4" }), /* @__PURE__ */ jsx("span", {
|
|
84
|
+
className: "sr-only",
|
|
85
|
+
children: "Close"
|
|
86
|
+
})]
|
|
87
|
+
})]
|
|
88
|
+
})] });
|
|
89
|
+
};
|
|
90
|
+
var SheetHeader = ({ className, ...props }) => {
|
|
91
|
+
return /* @__PURE__ */ jsx("div", {
|
|
92
|
+
className: cn("flex flex-col gap-1.5 border-b p-6 pr-14", className),
|
|
93
|
+
"data-slot": "sheet-header",
|
|
94
|
+
...props
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Scrolls the sheet's main content between its header and footer.
|
|
99
|
+
*/
|
|
100
|
+
var SheetBody = ({ className, ...props }) => {
|
|
101
|
+
return /* @__PURE__ */ jsx("div", {
|
|
102
|
+
className: cn("min-h-0 flex-1 overflow-y-auto p-6", className),
|
|
103
|
+
"data-slot": "sheet-body",
|
|
104
|
+
...props
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
var SheetFooter = ({ className, ...props }) => {
|
|
108
|
+
return /* @__PURE__ */ jsx("div", {
|
|
109
|
+
className: cn("mt-auto flex flex-col-reverse gap-2 border-t p-6 sm:flex-row sm:justify-end", className),
|
|
110
|
+
"data-slot": "sheet-footer",
|
|
111
|
+
...props
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
var SheetTitle = ({ className, ...props }) => {
|
|
115
|
+
return /* @__PURE__ */ jsx(Dialog.Title, {
|
|
116
|
+
className: cn("text-headline-sm text-foreground", className),
|
|
117
|
+
"data-slot": "sheet-title",
|
|
118
|
+
...props
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
var SheetDescription = ({ className, ...props }) => {
|
|
122
|
+
return /* @__PURE__ */ jsx(Dialog.Description, {
|
|
123
|
+
className: cn("text-body-sm text-muted-foreground", className),
|
|
124
|
+
"data-slot": "sheet-description",
|
|
125
|
+
...props
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
export { Sheet, SheetBody, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger };
|
|
129
|
+
|
|
130
|
+
//# sourceMappingURL=sheet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sheet.js","names":["SheetPrimitive"],"sources":["../../../src/components/sheet/sheet.tsx"],"sourcesContent":["'use client';\n\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { Dialog as SheetPrimitive } from 'radix-ui';\nimport type { ComponentProps } from 'react';\n\nimport { cn } from '../../lib/cn';\nimport { DIALOG_CLOSE_CLASS_NAME, DIALOG_OVERLAY_CLASS_NAME } from '../dialog/dialog';\nimport { RefineIconCloseMD } from '../../icons/refine-icons';\n\nconst sheetContentVariants = cva(\n [\n // base\n 'fixed z-50 flex flex-col bg-popover text-popover-foreground shadow-float outline-none',\n // animation\n 'ease-out-expo data-[state=closed]:animate-out data-[state=closed]:duration-200 data-[state=open]:animate-in data-[state=open]:duration-300',\n ],\n {\n variants: {\n side: {\n right:\n 'inset-y-0 right-0 h-full w-[calc(100vw-2rem)] border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right',\n left: 'inset-y-0 left-0 h-full w-[calc(100vw-2rem)] border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left',\n top: 'inset-x-0 top-0 max-h-[85dvh] border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top',\n bottom:\n 'inset-x-0 bottom-0 max-h-[85dvh] rounded-t-panel border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom',\n },\n size: {\n sm: '',\n md: '',\n lg: '',\n },\n },\n compoundVariants: [\n {\n side: ['left', 'right'],\n size: 'sm',\n className: 'max-w-sm',\n },\n {\n side: ['left', 'right'],\n size: 'md',\n className: 'max-w-lg',\n },\n {\n side: ['left', 'right'],\n size: 'lg',\n className: 'max-w-3xl',\n },\n ],\n defaultVariants: {\n side: 'right',\n size: 'md',\n },\n },\n);\n\n/**\n * Holds the open state of a panel that slides in from an edge of the screen.\n */\nexport const Sheet = (props: ComponentProps<typeof SheetPrimitive.Root>) => {\n return <SheetPrimitive.Root data-slot=\"sheet\" {...props} />;\n};\n\nexport const SheetTrigger = (props: ComponentProps<typeof SheetPrimitive.Trigger>) => {\n return <SheetPrimitive.Trigger data-slot=\"sheet-trigger\" {...props} />;\n};\n\nexport const SheetClose = (props: ComponentProps<typeof SheetPrimitive.Close>) => {\n return <SheetPrimitive.Close data-slot=\"sheet-close\" {...props} />;\n};\n\ninterface SheetContentProps\n extends ComponentProps<typeof SheetPrimitive.Content>,\n VariantProps<typeof sheetContentVariants> {\n showClose?: boolean;\n}\n\n/**\n * Portals the sliding panel above a blurred scrim, from the given `side`.\n */\nexport const SheetContent = ({ children, className, showClose = true, side, size, ...props }: SheetContentProps) => {\n return (\n <SheetPrimitive.Portal>\n <SheetPrimitive.Overlay className={DIALOG_OVERLAY_CLASS_NAME} data-slot=\"sheet-overlay\" />\n <SheetPrimitive.Content\n className={cn(sheetContentVariants({ side, size }), className)}\n data-slot=\"sheet-content\"\n {...props}\n >\n {children}\n {showClose && (\n <SheetPrimitive.Close className={DIALOG_CLOSE_CLASS_NAME} title=\"Close\">\n <RefineIconCloseMD className=\"size-4\" />\n <span className=\"sr-only\">Close</span>\n </SheetPrimitive.Close>\n )}\n </SheetPrimitive.Content>\n </SheetPrimitive.Portal>\n );\n};\n\nexport const SheetHeader = ({ className, ...props }: ComponentProps<'div'>) => {\n return (\n <div className={cn('flex flex-col gap-1.5 border-b p-6 pr-14', className)} data-slot=\"sheet-header\" {...props} />\n );\n};\n\n/**\n * Scrolls the sheet's main content between its header and footer.\n */\nexport const SheetBody = ({ className, ...props }: ComponentProps<'div'>) => {\n return <div className={cn('min-h-0 flex-1 overflow-y-auto p-6', className)} data-slot=\"sheet-body\" {...props} />;\n};\n\nexport const SheetFooter = ({ className, ...props }: ComponentProps<'div'>) => {\n return (\n <div\n className={cn('mt-auto flex flex-col-reverse gap-2 border-t p-6 sm:flex-row sm:justify-end', className)}\n data-slot=\"sheet-footer\"\n {...props}\n />\n );\n};\n\nexport const SheetTitle = ({ className, ...props }: ComponentProps<typeof SheetPrimitive.Title>) => {\n return (\n <SheetPrimitive.Title\n className={cn('text-headline-sm text-foreground', className)}\n data-slot=\"sheet-title\"\n {...props}\n />\n );\n};\n\nexport const SheetDescription = ({ className, ...props }: ComponentProps<typeof SheetPrimitive.Description>) => {\n return (\n <SheetPrimitive.Description\n className={cn('text-body-sm text-muted-foreground', className)}\n data-slot=\"sheet-description\"\n {...props}\n />\n );\n};\n"],"mappings":";;;;;;;;AAUA,IAAM,uBAAuB,IAC3B,CAEE,yFAEA,4IACF,GACA;CACE,UAAU;EACR,MAAM;GACJ,OACE;GACF,MAAM;GACN,KAAK;GACL,QACE;EACJ;EACA,MAAM;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;EACN;CACF;CACA,kBAAkB;EAChB;GACE,MAAM,CAAC,QAAQ,OAAO;GACtB,MAAM;GACN,WAAW;EACb;EACA;GACE,MAAM,CAAC,QAAQ,OAAO;GACtB,MAAM;GACN,WAAW;EACb;EACA;GACE,MAAM,CAAC,QAAQ,OAAO;GACtB,MAAM;GACN,WAAW;EACb;CACF;CACA,iBAAiB;EACf,MAAM;EACN,MAAM;CACR;AACF,CACF;;;;AAKA,IAAa,SAAS,UAAsD;CAC1E,OAAO,oBAACA,OAAe,MAAhB;EAAqB,aAAU;EAAQ,GAAI;CAAQ,CAAA;AAC5D;AAEA,IAAa,gBAAgB,UAAyD;CACpF,OAAO,oBAACA,OAAe,SAAhB;EAAwB,aAAU;EAAgB,GAAI;CAAQ,CAAA;AACvE;AAEA,IAAa,cAAc,UAAuD;CAChF,OAAO,oBAACA,OAAe,OAAhB;EAAsB,aAAU;EAAc,GAAI;CAAQ,CAAA;AACnE;;;;AAWA,IAAa,gBAAgB,EAAE,UAAU,WAAW,YAAY,MAAM,MAAM,MAAM,GAAG,YAA+B;CAClH,OACE,qBAACA,OAAe,QAAhB,EAAA,UAAA,CACE,oBAACA,OAAe,SAAhB;EAAwB,WAAW;EAA2B,aAAU;CAAiB,CAAA,GACzF,qBAACA,OAAe,SAAhB;EACE,WAAW,GAAG,qBAAqB;GAAE;GAAM;EAAK,CAAC,GAAG,SAAS;EAC7D,aAAU;EACV,GAAI;EAHN,UAAA,CAKG,UACA,aACC,qBAACA,OAAe,OAAhB;GAAsB,WAAW;GAAyB,OAAM;GAAhE,UAAA,CACE,oBAAC,mBAAD,EAAmB,WAAU,SAAU,CAAA,GACvC,oBAAC,QAAD;IAAM,WAAU;IAAU,UAAA;GAAW,CAAA,CACjB;EAEF,CAAA,CAAA;CACH,CAAA,CAAA,EAAA,CAAA;AAE3B;AAEA,IAAa,eAAe,EAAE,WAAW,GAAG,YAAmC;CAC7E,OACE,oBAAC,OAAD;EAAK,WAAW,GAAG,4CAA4C,SAAS;EAAG,aAAU;EAAe,GAAI;CAAQ,CAAA;AAEpH;;;;AAKA,IAAa,aAAa,EAAE,WAAW,GAAG,YAAmC;CAC3E,OAAO,oBAAC,OAAD;EAAK,WAAW,GAAG,sCAAsC,SAAS;EAAG,aAAU;EAAa,GAAI;CAAQ,CAAA;AACjH;AAEA,IAAa,eAAe,EAAE,WAAW,GAAG,YAAmC;CAC7E,OACE,oBAAC,OAAD;EACE,WAAW,GAAG,+EAA+E,SAAS;EACtG,aAAU;EACV,GAAI;CACL,CAAA;AAEL;AAEA,IAAa,cAAc,EAAE,WAAW,GAAG,YAAyD;CAClG,OACE,oBAACA,OAAe,OAAhB;EACE,WAAW,GAAG,oCAAoC,SAAS;EAC3D,aAAU;EACV,GAAI;CACL,CAAA;AAEL;AAEA,IAAa,oBAAoB,EAAE,WAAW,GAAG,YAA+D;CAC9G,OACE,oBAACA,OAAe,aAAhB;EACE,WAAW,GAAG,sCAAsC,SAAS;EAC7D,aAAU;EACV,GAAI;CACL,CAAA;AAEL"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* A shimmering placeholder block; size and shape it with classes to mirror the content that is loading.
|
|
4
|
+
*/
|
|
5
|
+
export declare const Skeleton: ({ className, ...props }: ComponentProps<"div">) => import("react").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
// src/components/skeleton/skeleton.tsx
|
|
4
|
+
/**
|
|
5
|
+
* A shimmering placeholder block; size and shape it with classes to mirror the content that is loading.
|
|
6
|
+
*/
|
|
7
|
+
var Skeleton = ({ className, ...props }) => {
|
|
8
|
+
return /* @__PURE__ */ jsx("div", {
|
|
9
|
+
"aria-hidden": true,
|
|
10
|
+
className: cn("animate-shimmer rounded-control skeleton-shimmer", className),
|
|
11
|
+
"data-slot": "skeleton",
|
|
12
|
+
role: "presentation",
|
|
13
|
+
...props
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
export { Skeleton };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=skeleton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skeleton.js","names":[],"sources":["../../../src/components/skeleton/skeleton.tsx"],"sourcesContent":["import type { ComponentProps } from 'react';\n\nimport { cn } from '../../lib/cn';\n\n/**\n * A shimmering placeholder block; size and shape it with classes to mirror the content that is loading.\n */\nexport const Skeleton = ({ className, ...props }: ComponentProps<'div'>) => {\n return (\n <div\n aria-hidden\n className={cn('animate-shimmer rounded-control skeleton-shimmer', className)}\n data-slot=\"skeleton\"\n role=\"presentation\"\n {...props}\n />\n );\n};\n"],"mappings":";;;;;;AAOA,IAAa,YAAY,EAAE,WAAW,GAAG,YAAmC;CAC1E,OACE,oBAAC,OAAD;EACE,eAAA;EACA,WAAW,GAAG,oDAAoD,SAAS;EAC3E,aAAU;EACV,MAAK;EACL,GAAI;CACL,CAAA;AAEL"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Slider as SliderPrimitive } from 'radix-ui';
|
|
2
|
+
import type { ComponentProps } from 'react';
|
|
3
|
+
interface SliderProps extends ComponentProps<typeof SliderPrimitive.Root> {
|
|
4
|
+
thumbLabelIds?: string[];
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Picks one value, or a range when given two values, along a gem-filled track; `thumbLabelIds` name each thumb through `aria-labelledby`.
|
|
8
|
+
*/
|
|
9
|
+
export declare const Slider: ({ className, defaultValue, max, min, thumbLabelIds, value, ...props }: SliderProps) => import("react").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../lib/cn.js";
|
|
3
|
+
import { useField, useFieldControl } from "../field/field.js";
|
|
4
|
+
import { Slider } from "radix-ui";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
// src/components/slider/slider.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Picks one value, or a range when given two values, along a gem-filled track; `thumbLabelIds` name each thumb through `aria-labelledby`.
|
|
9
|
+
*/
|
|
10
|
+
var Slider$1 = ({ className, defaultValue, max = 100, min = 0, thumbLabelIds, value, ...props }) => {
|
|
11
|
+
const field = useField();
|
|
12
|
+
const { id, ...controlProps } = useFieldControl(props);
|
|
13
|
+
const thumbCount = (value ?? defaultValue ?? [min]).length;
|
|
14
|
+
return /* @__PURE__ */ jsxs(Slider.Root, {
|
|
15
|
+
className: cn("relative flex w-full touch-none items-center select-none data-disabled:opacity-45", "data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-40 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col", className),
|
|
16
|
+
"data-slot": "slider",
|
|
17
|
+
defaultValue,
|
|
18
|
+
max,
|
|
19
|
+
min,
|
|
20
|
+
value,
|
|
21
|
+
...controlProps,
|
|
22
|
+
children: [/* @__PURE__ */ jsx(Slider.Track, {
|
|
23
|
+
className: "relative grow overflow-hidden rounded-full bg-muted data-[orientation=horizontal]:h-1.5 data-[orientation=vertical]:w-1.5",
|
|
24
|
+
children: /* @__PURE__ */ jsx(Slider.Range, { className: "absolute bg-gem-gradient data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full" })
|
|
25
|
+
}), Array.from({ length: thumbCount }, (_, index) => {
|
|
26
|
+
return /* @__PURE__ */ jsx(Slider.Thumb, {
|
|
27
|
+
"aria-labelledby": thumbLabelIds?.[index] ?? (thumbCount === 1 ? field?.labelId : void 0),
|
|
28
|
+
className: cn("block size-4.5 rounded-full border-2 border-gem bg-background shadow-float", "transition-[transform,box-shadow] duration-150 ease-spring", "focus-ring", "hover:scale-110 hover:shadow-glow", "active:scale-95", "data-disabled:pointer-events-none"),
|
|
29
|
+
id: index === 0 ? id : void 0
|
|
30
|
+
}, index);
|
|
31
|
+
})]
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
export { Slider$1 as Slider };
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=slider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slider.js","names":["Slider","SliderPrimitive"],"sources":["../../../src/components/slider/slider.tsx"],"sourcesContent":["'use client';\n\nimport { Slider as SliderPrimitive } from 'radix-ui';\nimport type { ComponentProps } from 'react';\n\nimport { cn } from '../../lib/cn';\nimport { useField, useFieldControl } from '../field/field';\n\ninterface SliderProps extends ComponentProps<typeof SliderPrimitive.Root> {\n thumbLabelIds?: string[];\n}\n\n/**\n * Picks one value, or a range when given two values, along a gem-filled track; `thumbLabelIds` name each thumb through `aria-labelledby`.\n */\nexport const Slider = ({ className, defaultValue, max = 100, min = 0, thumbLabelIds, value, ...props }: SliderProps) => {\n const field = useField();\n const { id, ...controlProps } = useFieldControl(props);\n const thumbCount = (value ?? defaultValue ?? [min]).length;\n\n return (\n <SliderPrimitive.Root\n className={cn(\n 'relative flex w-full touch-none items-center select-none data-disabled:opacity-45',\n 'data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-40 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col',\n className,\n )}\n data-slot=\"slider\"\n defaultValue={defaultValue}\n max={max}\n min={min}\n value={value}\n {...controlProps}\n >\n <SliderPrimitive.Track className=\"relative grow overflow-hidden rounded-full bg-muted data-[orientation=horizontal]:h-1.5 data-[orientation=vertical]:w-1.5\">\n <SliderPrimitive.Range className=\"absolute bg-gem-gradient data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full\" />\n </SliderPrimitive.Track>\n {Array.from(\n {\n length: thumbCount,\n },\n (_, index) => {\n return (\n <SliderPrimitive.Thumb\n aria-labelledby={thumbLabelIds?.[index] ?? (thumbCount === 1 ? field?.labelId : undefined)}\n className={cn(\n // base\n 'block size-4.5 rounded-full border-2 border-gem bg-background shadow-float',\n 'transition-[transform,box-shadow] duration-150 ease-spring',\n 'focus-ring',\n // hover\n 'hover:scale-110 hover:shadow-glow',\n // active\n 'active:scale-95',\n // disabled\n 'data-disabled:pointer-events-none',\n )}\n id={index === 0 ? id : undefined}\n key={index}\n />\n );\n },\n )}\n </SliderPrimitive.Root>\n );\n};\n"],"mappings":";;;;;;;;;AAeA,IAAaA,YAAU,EAAE,WAAW,cAAc,MAAM,KAAK,MAAM,GAAG,eAAe,OAAO,GAAG,YAAyB;CACtH,MAAM,QAAQ,SAAS;CACvB,MAAM,EAAE,IAAI,GAAG,iBAAiB,gBAAgB,KAAK;CACrD,MAAM,cAAc,SAAS,gBAAgB,CAAC,GAAG,EAAA,CAAG;CAEpD,OACE,qBAACC,OAAgB,MAAjB;EACE,WAAW,GACT,qFACA,mJACA,SACF;EACA,aAAU;EACI;EACT;EACA;EACE;EACP,GAAI;EAXN,UAAA,CAaE,oBAACA,OAAgB,OAAjB;GAAuB,WAAU;GAC/B,UAAA,oBAACA,OAAgB,OAAjB,EAAuB,WAAU,mGAAoG,CAAA;EAChH,CAAA,GACtB,MAAM,KACL,EACE,QAAQ,WACV,IACC,GAAG,UAAU;GACZ,OACE,oBAACA,OAAgB,OAAjB;IACE,mBAAiB,gBAAgB,WAAW,eAAe,IAAI,OAAO,UAAU,KAAA;IAChF,WAAW,GAET,8EACA,8DACA,cAEA,qCAEA,mBAEA,mCACF;IACA,IAAI,UAAU,IAAI,KAAK,KAAA;GAExB,GADM,KACN;EAEL,CACF,CACoB;;AAE1B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
interface SpinnerProps extends ComponentProps<'span'> {
|
|
3
|
+
label?: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* A spinning diamond facet that announces `label` to assistive technology while work is pending.
|
|
7
|
+
*/
|
|
8
|
+
export declare const Spinner: ({ className, label, ...props }: SpinnerProps) => import("react").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
// src/components/spinner/spinner.tsx
|
|
4
|
+
/**
|
|
5
|
+
* A spinning diamond facet that announces `label` to assistive technology while work is pending.
|
|
6
|
+
*/
|
|
7
|
+
var Spinner = ({ className, label = "Loading", ...props }) => {
|
|
8
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
9
|
+
className: cn("inline-flex size-[1em] items-center justify-center", className),
|
|
10
|
+
"data-slot": "spinner",
|
|
11
|
+
role: "status",
|
|
12
|
+
...props,
|
|
13
|
+
children: [/* @__PURE__ */ jsxs("svg", {
|
|
14
|
+
"aria-hidden": true,
|
|
15
|
+
className: "size-full animate-facet-spin",
|
|
16
|
+
fill: "none",
|
|
17
|
+
role: "presentation",
|
|
18
|
+
viewBox: "0 0 24 24",
|
|
19
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
20
|
+
d: "M12 2 21 9.5 12 22 3 9.5Z",
|
|
21
|
+
opacity: "0.3",
|
|
22
|
+
stroke: "currentColor",
|
|
23
|
+
strokeLinejoin: "round",
|
|
24
|
+
strokeWidth: "2"
|
|
25
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
26
|
+
d: "M12 2 21 9.5 12 22",
|
|
27
|
+
stroke: "currentColor",
|
|
28
|
+
strokeLinecap: "round",
|
|
29
|
+
strokeLinejoin: "round",
|
|
30
|
+
strokeWidth: "2"
|
|
31
|
+
})]
|
|
32
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
33
|
+
className: "sr-only",
|
|
34
|
+
children: label
|
|
35
|
+
})]
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
export { Spinner };
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=spinner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spinner.js","names":[],"sources":["../../../src/components/spinner/spinner.tsx"],"sourcesContent":["import type { ComponentProps } from 'react';\n\nimport { cn } from '../../lib/cn';\n\ninterface SpinnerProps extends ComponentProps<'span'> {\n label?: string;\n}\n\n/**\n * A spinning diamond facet that announces `label` to assistive technology while work is pending.\n */\nexport const Spinner = ({ className, label = 'Loading', ...props }: SpinnerProps) => {\n return (\n <span className={cn('inline-flex size-[1em] items-center justify-center', className)} data-slot=\"spinner\" role=\"status\" {...props}>\n <svg aria-hidden className=\"size-full animate-facet-spin\" fill=\"none\" role=\"presentation\" viewBox=\"0 0 24 24\">\n <path d=\"M12 2 21 9.5 12 22 3 9.5Z\" opacity=\"0.3\" stroke=\"currentColor\" strokeLinejoin=\"round\" strokeWidth=\"2\" />\n <path d=\"M12 2 21 9.5 12 22\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"2\" />\n </svg>\n <span className=\"sr-only\">{label}</span>\n </span>\n );\n};\n"],"mappings":";;;;;;AAWA,IAAa,WAAW,EAAE,WAAW,QAAQ,WAAW,GAAG,YAA0B;CACnF,OACE,qBAAC,QAAD;EAAM,WAAW,GAAG,sDAAsD,SAAS;EAAG,aAAU;EAAU,MAAK;EAAS,GAAI;EAA5H,UAAA,CACE,qBAAC,OAAD;GAAK,eAAA;GAAY,WAAU;GAA+B,MAAK;GAAO,MAAK;GAAe,SAAQ;GAAlG,UAAA,CACE,oBAAC,QAAD;IAAM,GAAE;IAA4B,SAAQ;IAAM,QAAO;IAAe,gBAAe;IAAQ,aAAY;GAAK,CAAA,GAChH,oBAAC,QAAD;IAAM,GAAE;IAAqB,QAAO;IAAe,eAAc;IAAQ,gBAAe;IAAQ,aAAY;GAAK,CAAA,CAC9G;EACL,CAAA,GAAA,oBAAC,QAAD;GAAM,WAAU;GAAW,UAAA;EAAY,CAAA,CACnC;;AAEV"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
interface SpotlightProps extends ComponentProps<'div'> {
|
|
3
|
+
surface?: boolean;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Wraps content in a surface whose gem glow follows the pointer, without re-rendering on every move.
|
|
7
|
+
*/
|
|
8
|
+
export declare const Spotlight: ({ children, className, onPointerMove, surface, ...props }: SpotlightProps) => import("react").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../lib/cn.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
// src/components/spotlight/spotlight.tsx
|
|
5
|
+
/**
|
|
6
|
+
* Wraps content in a surface whose gem glow follows the pointer, without re-rendering on every move.
|
|
7
|
+
*/
|
|
8
|
+
var Spotlight = ({ children, className, onPointerMove, surface = true, ...props }) => {
|
|
9
|
+
/**
|
|
10
|
+
* Writes the pointer position relative to the element into its `--spot-x` and `--spot-y` custom properties.
|
|
11
|
+
*/
|
|
12
|
+
const handlePointerMove = (event) => {
|
|
13
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
14
|
+
event.currentTarget.style.setProperty("--spot-x", `${event.clientX - rect.left}px`);
|
|
15
|
+
event.currentTarget.style.setProperty("--spot-y", `${event.clientY - rect.top}px`);
|
|
16
|
+
onPointerMove?.(event);
|
|
17
|
+
};
|
|
18
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
19
|
+
className: cn("group/spotlight relative isolate overflow-hidden", { "card-surface": surface }, className),
|
|
20
|
+
"data-slot": "spotlight",
|
|
21
|
+
onPointerMove: handlePointerMove,
|
|
22
|
+
...props,
|
|
23
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
24
|
+
"aria-hidden": true,
|
|
25
|
+
className: cn("pointer-events-none absolute inset-0 -z-10 opacity-0", "bg-[radial-gradient(420px_circle_at_var(--spot-x,50%)_var(--spot-y,0%),oklch(var(--gem-l)_var(--gem-c)_var(--gem-h)/0.22),transparent_65%)]", "group-hover/spotlight:opacity-100", "transition-opacity duration-300"),
|
|
26
|
+
role: "presentation"
|
|
27
|
+
}), children]
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
export { Spotlight };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=spotlight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spotlight.js","names":[],"sources":["../../../src/components/spotlight/spotlight.tsx"],"sourcesContent":["'use client';\n\nimport type { ComponentProps, PointerEvent } from 'react';\n\nimport { cn } from '../../lib/cn';\n\ninterface SpotlightProps extends ComponentProps<'div'> {\n surface?: boolean;\n}\n\n/**\n * Wraps content in a surface whose gem glow follows the pointer, without re-rendering on every move.\n */\nexport const Spotlight = ({ children, className, onPointerMove, surface = true, ...props }: SpotlightProps) => {\n /**\n * Writes the pointer position relative to the element into its `--spot-x` and `--spot-y` custom properties.\n */\n const handlePointerMove = (event: PointerEvent<HTMLDivElement>) => {\n const rect = event.currentTarget.getBoundingClientRect();\n // Writing custom properties straight to the element keeps a 60fps pointer stream out of React state; it is the one sanctioned inline style.\n event.currentTarget.style.setProperty('--spot-x', `${event.clientX - rect.left}px`);\n event.currentTarget.style.setProperty('--spot-y', `${event.clientY - rect.top}px`);\n onPointerMove?.(event);\n };\n\n return (\n <div\n className={cn('group/spotlight relative isolate overflow-hidden', { 'card-surface': surface }, className)}\n data-slot=\"spotlight\"\n onPointerMove={handlePointerMove}\n {...props}\n >\n <div\n aria-hidden\n className={cn(\n // base\n 'pointer-events-none absolute inset-0 -z-10 opacity-0',\n 'bg-[radial-gradient(420px_circle_at_var(--spot-x,50%)_var(--spot-y,0%),oklch(var(--gem-l)_var(--gem-c)_var(--gem-h)/0.22),transparent_65%)]',\n // hover\n 'group-hover/spotlight:opacity-100',\n // animation\n 'transition-opacity duration-300',\n )}\n role=\"presentation\"\n />\n {children}\n </div>\n );\n};\n"],"mappings":";;;;;;;AAaA,IAAa,aAAa,EAAE,UAAU,WAAW,eAAe,UAAU,MAAM,GAAG,YAA4B;;;;CAI7G,MAAM,qBAAqB,UAAwC;EACjE,MAAM,OAAO,MAAM,cAAc,sBAAsB;EAEvD,MAAM,cAAc,MAAM,YAAY,YAAY,GAAG,MAAM,UAAU,KAAK,KAAK,GAAG;EAClF,MAAM,cAAc,MAAM,YAAY,YAAY,GAAG,MAAM,UAAU,KAAK,IAAI,GAAG;EACjF,gBAAgB,KAAK;CACvB;CAEA,OACE,qBAAC,OAAD;EACE,WAAW,GAAG,oDAAoD,EAAE,gBAAgB,QAAQ,GAAG,SAAS;EACxG,aAAU;EACV,eAAe;EACf,GAAI;EAJN,UAAA,CAME,oBAAC,OAAD;GACE,eAAA;GACA,WAAW,GAET,wDACA,+IAEA,qCAEA,iCACF;GACA,MAAK;EACN,CAAA,GACA,QACE;;AAET"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
interface StarfieldProps extends Omit<ComponentProps<'svg'>, 'children'> {
|
|
3
|
+
density?: number;
|
|
4
|
+
seed?: number;
|
|
5
|
+
twinkleEvery?: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Draws a procedural star field in `currentColor` that covers its parent; set the colour with a text utility.
|
|
9
|
+
*/
|
|
10
|
+
export declare const Starfield: ({ className, density, seed, twinkleEvery, ...props }: StarfieldProps) => import("react").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
// src/components/starfield/starfield.tsx
|
|
4
|
+
var VIEW_WIDTH = 1920;
|
|
5
|
+
var VIEW_HEIGHT = 480;
|
|
6
|
+
/**
|
|
7
|
+
* Returns a deterministic pseudo-random generator, so a given seed always draws the same sky on server and client.
|
|
8
|
+
*/
|
|
9
|
+
var createRandom = (seed) => {
|
|
10
|
+
let state = seed;
|
|
11
|
+
return () => {
|
|
12
|
+
state = (state * 1664525 + 1013904223) % 4294967296;
|
|
13
|
+
return state / 4294967296;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Maps a 0–1 brightness roll to a star radius: mostly specks, some mid stars and a rare bright one.
|
|
18
|
+
*/
|
|
19
|
+
var radiusFor = (brightness) => {
|
|
20
|
+
if (brightness > .96) return 2.2;
|
|
21
|
+
if (brightness > .8) return 1.4;
|
|
22
|
+
return .8;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Scatters `starCount` stars across the view box, mostly tiny, a few bright, and roughly one in `twinkleEvery` twinkling.
|
|
26
|
+
*/
|
|
27
|
+
var buildStars = (seed, starCount, twinkleEvery) => {
|
|
28
|
+
const random = createRandom(seed);
|
|
29
|
+
return Array.from({ length: starCount }, (_, index) => {
|
|
30
|
+
const brightness = random();
|
|
31
|
+
return {
|
|
32
|
+
delayIndex: index % 8,
|
|
33
|
+
radius: radiusFor(brightness),
|
|
34
|
+
twinkles: twinkleEvery > 0 && index % twinkleEvery === 0,
|
|
35
|
+
x: random() * VIEW_WIDTH,
|
|
36
|
+
y: random() * VIEW_HEIGHT
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
var DELAY_CLASSES = [
|
|
41
|
+
"[animation-delay:0s]",
|
|
42
|
+
"[animation-delay:-0.5s]",
|
|
43
|
+
"[animation-delay:-1s]",
|
|
44
|
+
"[animation-delay:-1.5s]",
|
|
45
|
+
"[animation-delay:-2s]",
|
|
46
|
+
"[animation-delay:-2.5s]",
|
|
47
|
+
"[animation-delay:-3s]",
|
|
48
|
+
"[animation-delay:-3.5s]"
|
|
49
|
+
];
|
|
50
|
+
/**
|
|
51
|
+
* Draws a procedural star field in `currentColor` that covers its parent; set the colour with a text utility.
|
|
52
|
+
*/
|
|
53
|
+
var Starfield = ({ className, density = 260, seed = 1688, twinkleEvery = 7, ...props }) => {
|
|
54
|
+
const stars = buildStars(seed, density, twinkleEvery);
|
|
55
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
56
|
+
"aria-hidden": true,
|
|
57
|
+
className: cn("pointer-events-none size-full text-foreground/40", className),
|
|
58
|
+
"data-slot": "starfield",
|
|
59
|
+
fill: "currentColor",
|
|
60
|
+
preserveAspectRatio: "xMidYMid slice",
|
|
61
|
+
role: "presentation",
|
|
62
|
+
viewBox: `0 0 ${VIEW_WIDTH} ${VIEW_HEIGHT}`,
|
|
63
|
+
...props,
|
|
64
|
+
children: stars.map((star) => {
|
|
65
|
+
return /* @__PURE__ */ jsx("circle", {
|
|
66
|
+
className: cn({ [`motion-safe:animate-twinkle ${DELAY_CLASSES[star.delayIndex]}`]: star.twinkles }),
|
|
67
|
+
cx: star.x.toFixed(1),
|
|
68
|
+
cy: star.y.toFixed(1),
|
|
69
|
+
r: star.radius
|
|
70
|
+
}, `${star.x}-${star.y}`);
|
|
71
|
+
})
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
export { Starfield };
|
|
75
|
+
|
|
76
|
+
//# sourceMappingURL=starfield.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"starfield.js","names":[],"sources":["../../../src/components/starfield/starfield.tsx"],"sourcesContent":["import type { ComponentProps } from 'react';\n\nimport { cn } from '../../lib/cn';\n\nconst VIEW_WIDTH = 1920;\nconst VIEW_HEIGHT = 480;\n\ninterface Star {\n delayIndex: number;\n radius: number;\n twinkles: boolean;\n x: number;\n y: number;\n}\n\n/**\n * Returns a deterministic pseudo-random generator, so a given seed always draws the same sky on server and client.\n */\nconst createRandom = (seed: number) => {\n let state = seed;\n\n return () => {\n state = (state * 1_664_525 + 1_013_904_223) % 4_294_967_296;\n\n return state / 4_294_967_296;\n };\n};\n\n/**\n * Maps a 0–1 brightness roll to a star radius: mostly specks, some mid stars and a rare bright one.\n */\nconst radiusFor = (brightness: number) => {\n if (brightness > 0.96) return 2.2;\n if (brightness > 0.8) return 1.4;\n\n return 0.8;\n};\n\n/**\n * Scatters `starCount` stars across the view box, mostly tiny, a few bright, and roughly one in `twinkleEvery` twinkling.\n */\nconst buildStars = (seed: number, starCount: number, twinkleEvery: number) => {\n const random = createRandom(seed);\n\n return Array.from(\n {\n length: starCount,\n },\n (_, index): Star => {\n const brightness = random();\n\n return {\n delayIndex: index % 8,\n radius: radiusFor(brightness),\n twinkles: twinkleEvery > 0 && index % twinkleEvery === 0,\n x: random() * VIEW_WIDTH,\n y: random() * VIEW_HEIGHT,\n };\n },\n );\n};\n\nconst DELAY_CLASSES = [\n '[animation-delay:0s]',\n '[animation-delay:-0.5s]',\n '[animation-delay:-1s]',\n '[animation-delay:-1.5s]',\n '[animation-delay:-2s]',\n '[animation-delay:-2.5s]',\n '[animation-delay:-3s]',\n '[animation-delay:-3.5s]',\n];\n\ninterface StarfieldProps extends Omit<ComponentProps<'svg'>, 'children'> {\n density?: number;\n seed?: number;\n twinkleEvery?: number;\n}\n\n/**\n * Draws a procedural star field in `currentColor` that covers its parent; set the colour with a text utility.\n */\nexport const Starfield = ({ className, density = 260, seed = 1688, twinkleEvery = 7, ...props }: StarfieldProps) => {\n const stars = buildStars(seed, density, twinkleEvery);\n\n return (\n <svg\n aria-hidden\n className={cn('pointer-events-none size-full text-foreground/40', className)}\n data-slot=\"starfield\"\n fill=\"currentColor\"\n preserveAspectRatio=\"xMidYMid slice\"\n role=\"presentation\"\n viewBox={`0 0 ${VIEW_WIDTH} ${VIEW_HEIGHT}`}\n {...props}\n >\n {stars.map((star) => {\n return (\n <circle\n className={cn({\n [`motion-safe:animate-twinkle ${DELAY_CLASSES[star.delayIndex]}`]: star.twinkles,\n })}\n cx={star.x.toFixed(1)}\n cy={star.y.toFixed(1)}\n key={`${star.x}-${star.y}`}\n r={star.radius}\n />\n );\n })}\n </svg>\n );\n};\n"],"mappings":";;;AAIA,IAAM,aAAa;AACnB,IAAM,cAAc;;;;AAapB,IAAM,gBAAgB,SAAiB;CACrC,IAAI,QAAQ;CAEZ,aAAa;EACX,SAAS,QAAQ,UAAY,cAAiB;EAE9C,OAAO,QAAQ;CACjB;AACF;;;;AAKA,IAAM,aAAa,eAAuB;CACxC,IAAI,aAAa,KAAM,OAAO;CAC9B,IAAI,aAAa,IAAK,OAAO;CAE7B,OAAO;AACT;;;;AAKA,IAAM,cAAc,MAAc,WAAmB,iBAAyB;CAC5E,MAAM,SAAS,aAAa,IAAI;CAEhC,OAAO,MAAM,KACX,EACE,QAAQ,UACV,IACC,GAAG,UAAgB;EAClB,MAAM,aAAa,OAAO;EAE1B,OAAO;GACL,YAAY,QAAQ;GACpB,QAAQ,UAAU,UAAU;GAC5B,UAAU,eAAe,KAAK,QAAQ,iBAAiB;GACvD,GAAG,OAAO,IAAI;GACd,GAAG,OAAO,IAAI;EAChB;CACF,CACF;AACF;AAEA,IAAM,gBAAgB;CACpB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;;AAWA,IAAa,aAAa,EAAE,WAAW,UAAU,KAAK,OAAO,MAAM,eAAe,GAAG,GAAG,YAA4B;CAClH,MAAM,QAAQ,WAAW,MAAM,SAAS,YAAY;CAEpD,OACE,oBAAC,OAAD;EACE,eAAA;EACA,WAAW,GAAG,oDAAoD,SAAS;EAC3E,aAAU;EACV,MAAK;EACL,qBAAoB;EACpB,MAAK;EACL,SAAS,OAAO,WAAW,GAAG;EAC9B,GAAI;EAEH,UAAA,MAAM,KAAK,SAAS;GACnB,OACE,oBAAC,UAAD;IACE,WAAW,GAAG,GACX,+BAA+B,cAAc,KAAK,gBAAgB,KAAK,SAC1E,CAAC;IACD,IAAI,KAAK,EAAE,QAAQ,CAAC;IACpB,IAAI,KAAK,EAAE,QAAQ,CAAC;IAEpB,GAAG,KAAK;GACT,GAFM,GAAG,KAAK,EAAE,GAAG,KAAK,GAExB;EAEL,CAAC;CACE,CAAA;AAET"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
declare const TREND_CLASS_BY_TREND: {
|
|
3
|
+
down: string;
|
|
4
|
+
flat: string;
|
|
5
|
+
up: string;
|
|
6
|
+
};
|
|
7
|
+
interface StatProps extends Omit<ComponentProps<'div'>, 'children'> {
|
|
8
|
+
delta?: ReactNode;
|
|
9
|
+
index?: string;
|
|
10
|
+
label: ReactNode;
|
|
11
|
+
size?: 'lg' | 'md' | 'sm' | 'xs';
|
|
12
|
+
sparkline?: ReactNode;
|
|
13
|
+
trend?: keyof typeof TREND_CLASS_BY_TREND;
|
|
14
|
+
unit?: ReactNode;
|
|
15
|
+
value: ReactNode;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* An editorial figure: a mono index and label above a heavy tabular number, with an optional trend delta on a tinted pill and sparkline.
|
|
19
|
+
*/
|
|
20
|
+
export declare const Stat: ({ className, delta, index, label, size, sparkline, trend, unit, value, ...props }: StatProps) => import("react").JSX.Element;
|
|
21
|
+
interface SparklineProps extends Omit<ComponentProps<'svg'>, 'values'> {
|
|
22
|
+
values: number[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Draws a minimal line-and-area chart of `values` in the current text colour, scaled to fill its box.
|
|
26
|
+
*/
|
|
27
|
+
export declare const Sparkline: ({ className, values, ...props }: SparklineProps) => import("react").JSX.Element;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { RefineIconArrowDownRightSM, RefineIconArrowUpRightSM, RefineIconRemoveMinus } from "../../icons/refine-icons.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
// src/components/stat/stat.tsx
|
|
5
|
+
var TREND_CLASS_BY_TREND = {
|
|
6
|
+
down: "bg-danger-soft text-danger-ink",
|
|
7
|
+
flat: "bg-muted text-muted-foreground",
|
|
8
|
+
up: "bg-success-soft text-success-ink"
|
|
9
|
+
};
|
|
10
|
+
var TREND_ICON_BY_TREND = {
|
|
11
|
+
down: RefineIconArrowDownRightSM,
|
|
12
|
+
flat: RefineIconRemoveMinus,
|
|
13
|
+
up: RefineIconArrowUpRightSM
|
|
14
|
+
};
|
|
15
|
+
var VALUE_CLASS_BY_SIZE = {
|
|
16
|
+
lg: "text-display-md",
|
|
17
|
+
md: "text-display-sm",
|
|
18
|
+
sm: "text-headline-lg",
|
|
19
|
+
xs: "text-headline-md"
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* An editorial figure: a mono index and label above a heavy tabular number, with an optional trend delta on a tinted pill and sparkline.
|
|
23
|
+
*/
|
|
24
|
+
var Stat = ({ className, delta, index, label, size = "md", sparkline, trend = "flat", unit, value, ...props }) => {
|
|
25
|
+
const TrendIcon = TREND_ICON_BY_TREND[trend];
|
|
26
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
27
|
+
className: cn("flex min-w-0 flex-col gap-3", className),
|
|
28
|
+
"data-slot": "stat",
|
|
29
|
+
...props,
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ jsxs("div", {
|
|
32
|
+
className: "flex items-baseline gap-2 text-muted-foreground",
|
|
33
|
+
children: [index && /* @__PURE__ */ jsx("span", {
|
|
34
|
+
className: "eyebrow text-gem-ink",
|
|
35
|
+
children: index
|
|
36
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
37
|
+
className: "eyebrow truncate",
|
|
38
|
+
children: label
|
|
39
|
+
})]
|
|
40
|
+
}),
|
|
41
|
+
/* @__PURE__ */ jsxs("div", {
|
|
42
|
+
className: "flex items-end justify-between gap-4",
|
|
43
|
+
children: [/* @__PURE__ */ jsxs("p", {
|
|
44
|
+
className: cn("font-display font-black tracking-tight tabular-nums", VALUE_CLASS_BY_SIZE[size]),
|
|
45
|
+
children: [value, unit && /* @__PURE__ */ jsx("span", {
|
|
46
|
+
className: "ml-1 text-body font-semibold tracking-normal text-muted-foreground",
|
|
47
|
+
children: unit
|
|
48
|
+
})]
|
|
49
|
+
}), sparkline && /* @__PURE__ */ jsx("div", {
|
|
50
|
+
className: "h-10 w-24 shrink-0 text-gem",
|
|
51
|
+
children: sparkline
|
|
52
|
+
})]
|
|
53
|
+
}),
|
|
54
|
+
delta && /* @__PURE__ */ jsxs("p", {
|
|
55
|
+
className: cn("flex w-fit items-center gap-1 rounded-full ps-1.5 pe-2 text-body-sm font-semibold tabular-nums", TREND_CLASS_BY_TREND[trend]),
|
|
56
|
+
children: [/* @__PURE__ */ jsx(TrendIcon, {
|
|
57
|
+
"aria-hidden": true,
|
|
58
|
+
className: "size-4",
|
|
59
|
+
role: "presentation"
|
|
60
|
+
}), delta]
|
|
61
|
+
})
|
|
62
|
+
]
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Draws a minimal line-and-area chart of `values` in the current text colour, scaled to fill its box.
|
|
67
|
+
*/
|
|
68
|
+
var Sparkline = ({ className, values, ...props }) => {
|
|
69
|
+
const max = Math.max(...values);
|
|
70
|
+
const min = Math.min(...values);
|
|
71
|
+
const range = max - min || 1;
|
|
72
|
+
const points = values.map((value, index) => {
|
|
73
|
+
return `${index / Math.max(values.length - 1, 1) * 100},${36 - (value - min) / range * 32}`;
|
|
74
|
+
});
|
|
75
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
76
|
+
"aria-hidden": true,
|
|
77
|
+
className: cn("size-full overflow-visible", className),
|
|
78
|
+
"data-slot": "sparkline",
|
|
79
|
+
preserveAspectRatio: "none",
|
|
80
|
+
role: "presentation",
|
|
81
|
+
viewBox: "0 0 100 40",
|
|
82
|
+
...props,
|
|
83
|
+
children: [/* @__PURE__ */ jsx("polygon", {
|
|
84
|
+
fill: "currentColor",
|
|
85
|
+
opacity: "0.12",
|
|
86
|
+
points: `0,40 ${points.join(" ")} 100,40`
|
|
87
|
+
}), /* @__PURE__ */ jsx("polyline", {
|
|
88
|
+
fill: "none",
|
|
89
|
+
points: points.join(" "),
|
|
90
|
+
stroke: "currentColor",
|
|
91
|
+
strokeLinecap: "round",
|
|
92
|
+
strokeLinejoin: "round",
|
|
93
|
+
strokeWidth: "2",
|
|
94
|
+
vectorEffect: "non-scaling-stroke"
|
|
95
|
+
})]
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
export { Sparkline, Stat };
|
|
99
|
+
|
|
100
|
+
//# sourceMappingURL=stat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stat.js","names":[],"sources":["../../../src/components/stat/stat.tsx"],"sourcesContent":["import type { ComponentProps, ReactNode } from 'react';\n\nimport { cn } from '../../lib/cn';\nimport { RefineIconArrowDownRightSM, RefineIconArrowUpRightSM, RefineIconRemoveMinus } from '../../icons/refine-icons';\n\nconst TREND_CLASS_BY_TREND = {\n down: 'bg-danger-soft text-danger-ink',\n flat: 'bg-muted text-muted-foreground',\n up: 'bg-success-soft text-success-ink',\n} satisfies Record<string, string>;\n\nconst TREND_ICON_BY_TREND = {\n down: RefineIconArrowDownRightSM,\n flat: RefineIconRemoveMinus,\n up: RefineIconArrowUpRightSM,\n} satisfies Record<keyof typeof TREND_CLASS_BY_TREND, typeof RefineIconRemoveMinus>;\n\ninterface StatProps extends Omit<ComponentProps<'div'>, 'children'> {\n delta?: ReactNode;\n index?: string;\n label: ReactNode;\n size?: 'lg' | 'md' | 'sm' | 'xs';\n sparkline?: ReactNode;\n trend?: keyof typeof TREND_CLASS_BY_TREND;\n unit?: ReactNode;\n value: ReactNode;\n}\n\nconst VALUE_CLASS_BY_SIZE = {\n lg: 'text-display-md',\n md: 'text-display-sm',\n sm: 'text-headline-lg',\n xs: 'text-headline-md',\n} satisfies Record<NonNullable<StatProps['size']>, string>;\n\n/**\n * An editorial figure: a mono index and label above a heavy tabular number, with an optional trend delta on a tinted pill and sparkline.\n */\nexport const Stat = ({\n className,\n delta,\n index,\n label,\n size = 'md',\n sparkline,\n trend = 'flat',\n unit,\n value,\n ...props\n}: StatProps) => {\n const TrendIcon = TREND_ICON_BY_TREND[trend];\n\n return (\n <div className={cn('flex min-w-0 flex-col gap-3', className)} data-slot=\"stat\" {...props}>\n <div className=\"flex items-baseline gap-2 text-muted-foreground\">\n {index && <span className=\"eyebrow text-gem-ink\">{index}</span>}\n <span className=\"eyebrow truncate\">{label}</span>\n </div>\n <div className=\"flex items-end justify-between gap-4\">\n <p className={cn('font-display font-black tracking-tight tabular-nums', VALUE_CLASS_BY_SIZE[size])}>\n {value}\n {unit && <span className=\"ml-1 text-body font-semibold tracking-normal text-muted-foreground\">{unit}</span>}\n </p>\n {sparkline && <div className=\"h-10 w-24 shrink-0 text-gem\">{sparkline}</div>}\n </div>\n {delta && (\n <p\n className={cn(\n 'flex w-fit items-center gap-1 rounded-full ps-1.5 pe-2 text-body-sm font-semibold tabular-nums',\n TREND_CLASS_BY_TREND[trend],\n )}\n >\n <TrendIcon aria-hidden className=\"size-4\" role=\"presentation\" />\n {delta}\n </p>\n )}\n </div>\n );\n};\n\ninterface SparklineProps extends Omit<ComponentProps<'svg'>, 'values'> {\n values: number[];\n}\n\n/**\n * Draws a minimal line-and-area chart of `values` in the current text colour, scaled to fill its box.\n */\nexport const Sparkline = ({ className, values, ...props }: SparklineProps) => {\n const max = Math.max(...values);\n const min = Math.min(...values);\n const range = max - min || 1;\n const points = values.map((value, index) => {\n return `${(index / Math.max(values.length - 1, 1)) * 100},${36 - ((value - min) / range) * 32}`;\n });\n\n return (\n <svg\n aria-hidden\n className={cn('size-full overflow-visible', className)}\n data-slot=\"sparkline\"\n preserveAspectRatio=\"none\"\n role=\"presentation\"\n viewBox=\"0 0 100 40\"\n {...props}\n >\n <polygon fill=\"currentColor\" opacity=\"0.12\" points={`0,40 ${points.join(' ')} 100,40`} />\n <polyline\n fill=\"none\"\n points={points.join(' ')}\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"2\"\n vectorEffect=\"non-scaling-stroke\"\n />\n </svg>\n );\n};\n"],"mappings":";;;;AAKA,IAAM,uBAAuB;CAC3B,MAAM;CACN,MAAM;CACN,IAAI;AACN;AAEA,IAAM,sBAAsB;CAC1B,MAAM;CACN,MAAM;CACN,IAAI;AACN;AAaA,IAAM,sBAAsB;CAC1B,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;;;;AAKA,IAAa,QAAQ,EACnB,WACA,OACA,OACA,OACA,OAAO,MACP,WACA,QAAQ,QACR,MACA,OACA,GAAG,YACY;CACf,MAAM,YAAY,oBAAoB;CAEtC,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,+BAA+B,SAAS;EAAG,aAAU;EAAO,GAAI;EAAnF,UAAA;GACE,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACG,SAAS,oBAAC,QAAD;KAAM,WAAU;KAAwB,UAAA;IAAY,CAAA,GAC9D,oBAAC,QAAD;KAAM,WAAU;KAAoB,UAAA;IAAY,CAAA,CAC7C;;GACL,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,qBAAC,KAAD;KAAG,WAAW,GAAG,uDAAuD,oBAAoB,KAAK;KAAjG,UAAA,CACG,OACA,QAAQ,oBAAC,QAAD;MAAM,WAAU;MAAsE,UAAA;KAAW,CAAA,CACzG;IACF,CAAA,GAAA,aAAa,oBAAC,OAAD;KAAK,WAAU;KAA+B,UAAA;IAAe,CAAA,CACxE;;GACJ,SACC,qBAAC,KAAD;IACE,WAAW,GACT,kGACA,qBAAqB,MACvB;IAJF,UAAA,CAME,oBAAC,WAAD;KAAW,eAAA;KAAY,WAAU;KAAS,MAAK;IAAgB,CAAA,GAC9D,KACA;;EAEF;;AAET;;;;AASA,IAAa,aAAa,EAAE,WAAW,QAAQ,GAAG,YAA4B;CAC5E,MAAM,MAAM,KAAK,IAAI,GAAG,MAAM;CAC9B,MAAM,MAAM,KAAK,IAAI,GAAG,MAAM;CAC9B,MAAM,QAAQ,MAAM,OAAO;CAC3B,MAAM,SAAS,OAAO,KAAK,OAAO,UAAU;EAC1C,OAAO,GAAI,QAAQ,KAAK,IAAI,OAAO,SAAS,GAAG,CAAC,IAAK,IAAI,GAAG,MAAO,QAAQ,OAAO,QAAS;CAC7F,CAAC;CAED,OACE,qBAAC,OAAD;EACE,eAAA;EACA,WAAW,GAAG,8BAA8B,SAAS;EACrD,aAAU;EACV,qBAAoB;EACpB,MAAK;EACL,SAAQ;EACR,GAAI;EAPN,UAAA,CASE,oBAAC,WAAD;GAAS,MAAK;GAAe,SAAQ;GAAO,QAAQ,QAAQ,OAAO,KAAK,GAAG,EAAE;EAAW,CAAA,GACxF,oBAAC,YAAD;GACE,MAAK;GACL,QAAQ,OAAO,KAAK,GAAG;GACvB,QAAO;GACP,eAAc;GACd,gBAAe;GACf,aAAY;GACZ,cAAa;EACd,CAAA,CACE;;AAET"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
2
|
+
import { Switch as SwitchPrimitive } from 'radix-ui';
|
|
3
|
+
import type { ComponentProps } from 'react';
|
|
4
|
+
declare const switchVariants: (props?: ({
|
|
5
|
+
size?: "sm" | "md" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
interface SwitchProps extends ComponentProps<typeof SwitchPrimitive.Root>, VariantProps<typeof switchVariants> {
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Toggles a setting on or off immediately, filling with the current gem when on.
|
|
11
|
+
*/
|
|
12
|
+
export declare const Switch: ({ className, size, ...props }: SwitchProps) => import("react").JSX.Element;
|
|
13
|
+
export {};
|