@refine-studio/ui 0.0.0 → 0.1.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/create-refine-icon.d.ts +13 -0
- package/dist/icons/create-refine-icon.js +37 -0
- package/dist/icons/create-refine-icon.js.map +1 -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 +1857 -0
- package/dist/icons/refine-icon-names.js +471 -0
- package/dist/icons/refine-icon-names.js.map +1 -0
- package/dist/icons/refine-icons.d.ts +1852 -0
- package/dist/icons/refine-icons.js +604 -0
- package/dist/icons/refine-icons.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,75 @@
|
|
|
1
|
+
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { Spinner } from "../spinner/spinner.js";
|
|
3
|
+
import { Slot } from "radix-ui";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { cva } from "class-variance-authority";
|
|
6
|
+
// src/components/button/button.tsx
|
|
7
|
+
var buttonVariants = cva([
|
|
8
|
+
"relative inline-flex shrink-0 items-center justify-center gap-2 rounded-control border border-transparent font-medium whitespace-nowrap select-none",
|
|
9
|
+
"transition-[background-color,border-color,color,box-shadow,transform] duration-150 ease-out-expo",
|
|
10
|
+
"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-[1.15em]",
|
|
11
|
+
"focus-ring",
|
|
12
|
+
"active:scale-[0.98]",
|
|
13
|
+
"disabled:pointer-events-none disabled:opacity-45 aria-disabled:pointer-events-none aria-disabled:opacity-45"
|
|
14
|
+
], {
|
|
15
|
+
variants: {
|
|
16
|
+
variant: {
|
|
17
|
+
primary: "bg-primary text-primary-foreground hover:bg-primary/85",
|
|
18
|
+
gem: "bg-gem-gradient text-gem-foreground hover:shadow-glow",
|
|
19
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-pressed",
|
|
20
|
+
outline: "border-input bg-background/40 text-foreground hover:border-foreground/25 hover:bg-hover",
|
|
21
|
+
ghost: "text-foreground hover:bg-hover active:bg-pressed",
|
|
22
|
+
danger: "bg-danger text-white hover:bg-danger/85",
|
|
23
|
+
link: "h-auto px-0 text-gem-ink underline-offset-4 hover:underline active:scale-100"
|
|
24
|
+
},
|
|
25
|
+
size: {
|
|
26
|
+
xs: "h-control-xs px-2 text-caption",
|
|
27
|
+
sm: "h-control-sm px-3 text-body-sm",
|
|
28
|
+
md: "h-control-md px-4 text-body-sm",
|
|
29
|
+
lg: "h-control-lg px-6 text-body",
|
|
30
|
+
xl: "h-control-xl px-8 text-body-lg font-semibold",
|
|
31
|
+
"icon-sm": "size-control-sm text-body-sm",
|
|
32
|
+
icon: "size-control-md text-body",
|
|
33
|
+
"icon-lg": "size-control-lg text-body-lg"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
compoundVariants: [{
|
|
37
|
+
variant: "link",
|
|
38
|
+
size: [
|
|
39
|
+
"xs",
|
|
40
|
+
"sm",
|
|
41
|
+
"md",
|
|
42
|
+
"lg",
|
|
43
|
+
"xl"
|
|
44
|
+
],
|
|
45
|
+
className: "h-auto px-0"
|
|
46
|
+
}],
|
|
47
|
+
defaultVariants: {
|
|
48
|
+
variant: "primary",
|
|
49
|
+
size: "md"
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
/**
|
|
53
|
+
* Renders an action; while `loading` it keeps its width, swaps its content for a spinner and refuses clicks.
|
|
54
|
+
*/
|
|
55
|
+
var Button = ({ asChild = false, children, className, disabled, loading = false, size, type = "button", variant, ...props }) => {
|
|
56
|
+
const Component = asChild ? Slot.Root : "button";
|
|
57
|
+
return /* @__PURE__ */ jsx(Component, {
|
|
58
|
+
"aria-busy": loading || void 0,
|
|
59
|
+
className: cn(buttonVariants({
|
|
60
|
+
size,
|
|
61
|
+
variant
|
|
62
|
+
}), className),
|
|
63
|
+
"data-slot": "button",
|
|
64
|
+
disabled: disabled || loading,
|
|
65
|
+
type: asChild ? void 0 : type,
|
|
66
|
+
...props,
|
|
67
|
+
children: loading && !asChild ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
68
|
+
className: "invisible inline-flex items-center gap-2",
|
|
69
|
+
children
|
|
70
|
+
}), /* @__PURE__ */ jsx(Spinner, { className: "absolute" })] }) : children
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
export { Button, buttonVariants };
|
|
74
|
+
|
|
75
|
+
//# sourceMappingURL=button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.js","names":["_Fragment"],"sources":["../../../src/components/button/button.tsx"],"sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority';\nimport { Slot } from 'radix-ui';\nimport type { ComponentProps } from 'react';\n\nimport { cn } from '../../lib/cn';\nimport { Spinner } from '../spinner/spinner';\n\nexport const buttonVariants = cva(\n [\n // base\n 'relative inline-flex shrink-0 items-center justify-center gap-2 rounded-control border border-transparent font-medium whitespace-nowrap select-none',\n 'transition-[background-color,border-color,color,box-shadow,transform] duration-150 ease-out-expo',\n \"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-[1.15em]\",\n 'focus-ring',\n // active\n 'active:scale-[0.98]',\n // disabled\n 'disabled:pointer-events-none disabled:opacity-45 aria-disabled:pointer-events-none aria-disabled:opacity-45',\n ],\n {\n variants: {\n variant: {\n primary: 'bg-primary text-primary-foreground hover:bg-primary/85',\n gem: 'bg-gem-gradient text-gem-foreground hover:shadow-glow',\n secondary: 'bg-secondary text-secondary-foreground hover:bg-pressed',\n outline: 'border-input bg-background/40 text-foreground hover:border-foreground/25 hover:bg-hover',\n ghost: 'text-foreground hover:bg-hover active:bg-pressed',\n danger: 'bg-danger text-white hover:bg-danger/85',\n link: 'h-auto px-0 text-gem-ink underline-offset-4 hover:underline active:scale-100',\n },\n size: {\n xs: 'h-control-xs px-2 text-caption',\n sm: 'h-control-sm px-3 text-body-sm',\n md: 'h-control-md px-4 text-body-sm',\n lg: 'h-control-lg px-6 text-body',\n xl: 'h-control-xl px-8 text-body-lg font-semibold',\n 'icon-sm': 'size-control-sm text-body-sm',\n icon: 'size-control-md text-body',\n 'icon-lg': 'size-control-lg text-body-lg',\n },\n },\n compoundVariants: [\n {\n variant: 'link',\n size: ['xs', 'sm', 'md', 'lg', 'xl'],\n className: 'h-auto px-0',\n },\n ],\n defaultVariants: {\n variant: 'primary',\n size: 'md',\n },\n },\n);\n\ninterface ButtonProps extends ComponentProps<'button'>, VariantProps<typeof buttonVariants> {\n asChild?: boolean;\n loading?: boolean;\n}\n\n/**\n * Renders an action; while `loading` it keeps its width, swaps its content for a spinner and refuses clicks.\n */\nexport const Button = ({\n asChild = false,\n children,\n className,\n disabled,\n loading = false,\n size,\n type = 'button',\n variant,\n ...props\n}: ButtonProps) => {\n const Component = asChild ? Slot.Root : 'button';\n\n return (\n <Component\n aria-busy={loading || undefined}\n className={cn(buttonVariants({ size, variant }), className)}\n data-slot=\"button\"\n disabled={disabled || loading}\n type={asChild ? undefined : type}\n {...props}\n >\n {loading && !asChild ? (\n <>\n <span className=\"invisible inline-flex items-center gap-2\">{children}</span>\n <Spinner className=\"absolute\" />\n </>\n ) : (\n children\n )}\n </Component>\n );\n};\n"],"mappings":";;;;;;AAOA,IAAa,iBAAiB,IAC5B;CAEE;CACA;CACA;CACA;CAEA;CAEA;AACF,GACA;CACE,UAAU;EACR,SAAS;GACP,SAAS;GACT,KAAK;GACL,WAAW;GACX,SAAS;GACT,OAAO;GACP,QAAQ;GACR,MAAM;EACR;EACA,MAAM;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,WAAW;GACX,MAAM;GACN,WAAW;EACb;CACF;CACA,kBAAkB,CAChB;EACE,SAAS;EACT,MAAM;GAAC;GAAM;GAAM;GAAM;GAAM;EAAI;EACnC,WAAW;CACb,CACF;CACA,iBAAiB;EACf,SAAS;EACT,MAAM;CACR;AACF,CACF;;;;AAUA,IAAa,UAAU,EACrB,UAAU,OACV,UACA,WACA,UACA,UAAU,OACV,MACA,OAAO,UACP,SACA,GAAG,YACc;CACjB,MAAM,YAAY,UAAU,KAAK,OAAO;CAExC,OACE,oBAAC,WAAD;EACE,aAAW,WAAW,KAAA;EACtB,WAAW,GAAG,eAAe;GAAE;GAAM;EAAQ,CAAC,GAAG,SAAS;EAC1D,aAAU;EACV,UAAU,YAAY;EACtB,MAAM,UAAU,KAAA,IAAY;EAC5B,GAAI;EAEH,UAAA,WAAW,CAAC,UACX,qBAAAA,UAAA,EAAA,UAAA,CACE,oBAAC,QAAD;GAAM,WAAU;GAA4C;EAAe,CAAA,GAC3E,oBAAC,SAAD,EAAS,WAAU,WAAY,CAAA,CAC/B,EAAA,CAAA,IAEF;CAEO,CAAA;AAEf"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
2
|
+
import type { ComponentProps } from 'react';
|
|
3
|
+
export declare const cardVariants: (props?: ({
|
|
4
|
+
variant?: "flat" | "gem" | "default" | "sunken" | null | undefined;
|
|
5
|
+
interactive?: boolean | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
interface CardProps extends ComponentProps<'div'>, VariantProps<typeof cardVariants> {
|
|
8
|
+
asChild?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A raised surface that groups related content; pass `asChild` with a link and `interactive` to make the whole card clickable.
|
|
12
|
+
*/
|
|
13
|
+
export declare const Card: ({ asChild, className, interactive, variant, ...props }: CardProps) => import("react").JSX.Element;
|
|
14
|
+
/**
|
|
15
|
+
* Lays out the eyebrow, title, description and an optional trailing action.
|
|
16
|
+
*/
|
|
17
|
+
export declare const CardHeader: ({ className, ...props }: ComponentProps<"div">) => import("react").JSX.Element;
|
|
18
|
+
/**
|
|
19
|
+
* Pins a button or menu to the top-right of the header.
|
|
20
|
+
*/
|
|
21
|
+
export declare const CardAction: ({ className, ...props }: ComponentProps<"div">) => import("react").JSX.Element;
|
|
22
|
+
/**
|
|
23
|
+
* The mono numbered line above a title, the "01 Services" voice of refine.studio.
|
|
24
|
+
*/
|
|
25
|
+
export declare const CardEyebrow: ({ className, ...props }: ComponentProps<"p">) => import("react").JSX.Element;
|
|
26
|
+
/**
|
|
27
|
+
* The card's heading.
|
|
28
|
+
*/
|
|
29
|
+
export declare const CardTitle: ({ className, ...props }: ComponentProps<"h3">) => import("react").JSX.Element;
|
|
30
|
+
/**
|
|
31
|
+
* Supporting copy under the title.
|
|
32
|
+
*/
|
|
33
|
+
export declare const CardDescription: ({ className, ...props }: ComponentProps<"p">) => import("react").JSX.Element;
|
|
34
|
+
/**
|
|
35
|
+
* The card's main body.
|
|
36
|
+
*/
|
|
37
|
+
export declare const CardContent: ({ className, ...props }: ComponentProps<"div">) => import("react").JSX.Element;
|
|
38
|
+
/**
|
|
39
|
+
* Actions or meta at the bottom edge, separated by a hairline.
|
|
40
|
+
*/
|
|
41
|
+
export declare const CardFooter: ({ className, ...props }: ComponentProps<"div">) => import("react").JSX.Element;
|
|
42
|
+
/**
|
|
43
|
+
* A full-bleed image or illustration area at the top of the card.
|
|
44
|
+
*/
|
|
45
|
+
export declare const CardMedia: ({ className, ...props }: ComponentProps<"div">) => import("react").JSX.Element;
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { Slot } from "radix-ui";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
// src/components/card/card.tsx
|
|
6
|
+
var cardVariants = cva(["@container/card relative flex flex-col overflow-hidden rounded-card border text-card-foreground"], {
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
default: "border-border bg-card shadow-soft",
|
|
10
|
+
flat: "border-border bg-card",
|
|
11
|
+
sunken: "border-transparent bg-muted",
|
|
12
|
+
gem: "border-gem/40 bg-gem-soft"
|
|
13
|
+
},
|
|
14
|
+
interactive: {
|
|
15
|
+
true: [
|
|
16
|
+
"cursor-pointer transition-[transform,box-shadow,border-color] duration-200 ease-out-expo focus-ring",
|
|
17
|
+
"hover:-translate-y-0.5 hover:border-foreground/20 hover:shadow-float",
|
|
18
|
+
"active:translate-y-0 active:scale-[0.995]"
|
|
19
|
+
],
|
|
20
|
+
false: ""
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
defaultVariants: {
|
|
24
|
+
variant: "default",
|
|
25
|
+
interactive: false
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
/**
|
|
29
|
+
* A raised surface that groups related content; pass `asChild` with a link and `interactive` to make the whole card clickable.
|
|
30
|
+
*/
|
|
31
|
+
var Card = ({ asChild = false, className, interactive, variant, ...props }) => {
|
|
32
|
+
const Component = asChild ? Slot.Root : "div";
|
|
33
|
+
return /* @__PURE__ */ jsx(Component, {
|
|
34
|
+
className: cn(cardVariants({
|
|
35
|
+
interactive,
|
|
36
|
+
variant
|
|
37
|
+
}), className),
|
|
38
|
+
"data-slot": "card",
|
|
39
|
+
...props
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Lays out the eyebrow, title, description and an optional trailing action.
|
|
44
|
+
*/
|
|
45
|
+
var CardHeader = ({ className, ...props }) => {
|
|
46
|
+
return /* @__PURE__ */ jsx("div", {
|
|
47
|
+
className: cn("grid auto-rows-min grid-cols-1 items-start gap-x-4 gap-y-1.5 p-6 pb-0 last:pb-6 has-data-[slot=card-action]:grid-cols-[1fr_auto]", className),
|
|
48
|
+
"data-slot": "card-header",
|
|
49
|
+
...props
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Pins a button or menu to the top-right of the header.
|
|
54
|
+
*/
|
|
55
|
+
var CardAction = ({ className, ...props }) => {
|
|
56
|
+
return /* @__PURE__ */ jsx("div", {
|
|
57
|
+
className: cn("col-start-2 row-span-3 row-start-1 self-start justify-self-end", className),
|
|
58
|
+
"data-slot": "card-action",
|
|
59
|
+
...props
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* The mono numbered line above a title, the "01 Services" voice of refine.studio.
|
|
64
|
+
*/
|
|
65
|
+
var CardEyebrow = ({ className, ...props }) => {
|
|
66
|
+
return /* @__PURE__ */ jsx("p", {
|
|
67
|
+
className: cn("eyebrow text-muted-foreground", className),
|
|
68
|
+
"data-slot": "card-eyebrow",
|
|
69
|
+
...props
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* The card's heading.
|
|
74
|
+
*/
|
|
75
|
+
var CardTitle = ({ className, ...props }) => {
|
|
76
|
+
return /* @__PURE__ */ jsx("h3", {
|
|
77
|
+
className: cn("text-headline-sm text-foreground", className),
|
|
78
|
+
"data-slot": "card-title",
|
|
79
|
+
...props
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Supporting copy under the title.
|
|
84
|
+
*/
|
|
85
|
+
var CardDescription = ({ className, ...props }) => {
|
|
86
|
+
return /* @__PURE__ */ jsx("p", {
|
|
87
|
+
className: cn("text-body-sm text-pretty text-muted-foreground", className),
|
|
88
|
+
"data-slot": "card-description",
|
|
89
|
+
...props
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* The card's main body.
|
|
94
|
+
*/
|
|
95
|
+
var CardContent = ({ className, ...props }) => {
|
|
96
|
+
return /* @__PURE__ */ jsx("div", {
|
|
97
|
+
className: cn("flex-1 p-6 text-body-sm", className),
|
|
98
|
+
"data-slot": "card-content",
|
|
99
|
+
...props
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Actions or meta at the bottom edge, separated by a hairline.
|
|
104
|
+
*/
|
|
105
|
+
var CardFooter = ({ className, ...props }) => {
|
|
106
|
+
return /* @__PURE__ */ jsx("div", {
|
|
107
|
+
className: cn("flex items-center gap-3 border-t px-6 py-4 empty:hidden", className),
|
|
108
|
+
"data-slot": "card-footer",
|
|
109
|
+
...props
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* A full-bleed image or illustration area at the top of the card.
|
|
114
|
+
*/
|
|
115
|
+
var CardMedia = ({ className, ...props }) => {
|
|
116
|
+
return /* @__PURE__ */ jsx("div", {
|
|
117
|
+
className: cn("relative aspect-video overflow-hidden bg-muted *:size-full *:object-cover", className),
|
|
118
|
+
"data-slot": "card-media",
|
|
119
|
+
...props
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
export { Card, CardAction, CardContent, CardDescription, CardEyebrow, CardFooter, CardHeader, CardMedia, CardTitle, cardVariants };
|
|
123
|
+
|
|
124
|
+
//# sourceMappingURL=card.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card.js","names":[],"sources":["../../../src/components/card/card.tsx"],"sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority';\nimport { Slot } from 'radix-ui';\nimport type { ComponentProps } from 'react';\n\nimport { cn } from '../../lib/cn';\n\nexport const cardVariants = cva(\n [\n // base\n '@container/card relative flex flex-col overflow-hidden rounded-card border text-card-foreground',\n ],\n {\n variants: {\n variant: {\n default: 'border-border bg-card shadow-soft',\n flat: 'border-border bg-card',\n sunken: 'border-transparent bg-muted',\n gem: 'border-gem/40 bg-gem-soft',\n },\n interactive: {\n true: [\n // base\n 'cursor-pointer transition-[transform,box-shadow,border-color] duration-200 ease-out-expo focus-ring',\n // hover\n 'hover:-translate-y-0.5 hover:border-foreground/20 hover:shadow-float',\n // active\n 'active:translate-y-0 active:scale-[0.995]',\n ],\n false: '',\n },\n },\n defaultVariants: {\n variant: 'default',\n interactive: false,\n },\n },\n);\n\ninterface CardProps extends ComponentProps<'div'>, VariantProps<typeof cardVariants> {\n asChild?: boolean;\n}\n\n/**\n * A raised surface that groups related content; pass `asChild` with a link and `interactive` to make the whole card clickable.\n */\nexport const Card = ({ asChild = false, className, interactive, variant, ...props }: CardProps) => {\n const Component = asChild ? Slot.Root : 'div';\n\n return <Component className={cn(cardVariants({ interactive, variant }), className)} data-slot=\"card\" {...props} />;\n};\n\n/**\n * Lays out the eyebrow, title, description and an optional trailing action.\n */\nexport const CardHeader = ({ className, ...props }: ComponentProps<'div'>) => {\n return (\n <div\n className={cn(\n 'grid auto-rows-min grid-cols-1 items-start gap-x-4 gap-y-1.5 p-6 pb-0 last:pb-6 has-data-[slot=card-action]:grid-cols-[1fr_auto]',\n className,\n )}\n data-slot=\"card-header\"\n {...props}\n />\n );\n};\n\n/**\n * Pins a button or menu to the top-right of the header.\n */\nexport const CardAction = ({ className, ...props }: ComponentProps<'div'>) => {\n return (\n <div\n className={cn('col-start-2 row-span-3 row-start-1 self-start justify-self-end', className)}\n data-slot=\"card-action\"\n {...props}\n />\n );\n};\n\n/**\n * The mono numbered line above a title, the \"01 Services\" voice of refine.studio.\n */\nexport const CardEyebrow = ({ className, ...props }: ComponentProps<'p'>) => {\n return <p className={cn('eyebrow text-muted-foreground', className)} data-slot=\"card-eyebrow\" {...props} />;\n};\n\n/**\n * The card's heading.\n */\nexport const CardTitle = ({ className, ...props }: ComponentProps<'h3'>) => {\n return <h3 className={cn('text-headline-sm text-foreground', className)} data-slot=\"card-title\" {...props} />;\n};\n\n/**\n * Supporting copy under the title.\n */\nexport const CardDescription = ({ className, ...props }: ComponentProps<'p'>) => {\n return (\n <p className={cn('text-body-sm text-pretty text-muted-foreground', className)} data-slot=\"card-description\" {...props} />\n );\n};\n\n/**\n * The card's main body.\n */\nexport const CardContent = ({ className, ...props }: ComponentProps<'div'>) => {\n return <div className={cn('flex-1 p-6 text-body-sm', className)} data-slot=\"card-content\" {...props} />;\n};\n\n/**\n * Actions or meta at the bottom edge, separated by a hairline.\n */\nexport const CardFooter = ({ className, ...props }: ComponentProps<'div'>) => {\n return (\n <div\n className={cn('flex items-center gap-3 border-t px-6 py-4 empty:hidden', className)}\n data-slot=\"card-footer\"\n {...props}\n />\n );\n};\n\n/**\n * A full-bleed image or illustration area at the top of the card.\n */\nexport const CardMedia = ({ className, ...props }: ComponentProps<'div'>) => {\n return (\n <div\n className={cn('relative aspect-video overflow-hidden bg-muted *:size-full *:object-cover', className)}\n data-slot=\"card-media\"\n {...props}\n />\n );\n};\n"],"mappings":";;;;;AAMA,IAAa,eAAe,IAC1B,CAEE,iGACF,GACA;CACE,UAAU;EACR,SAAS;GACP,SAAS;GACT,MAAM;GACN,QAAQ;GACR,KAAK;EACP;EACA,aAAa;GACX,MAAM;IAEJ;IAEA;IAEA;GACF;GACA,OAAO;EACT;CACF;CACA,iBAAiB;EACf,SAAS;EACT,aAAa;CACf;AACF,CACF;;;;AASA,IAAa,QAAQ,EAAE,UAAU,OAAO,WAAW,aAAa,SAAS,GAAG,YAAuB;CACjG,MAAM,YAAY,UAAU,KAAK,OAAO;CAExC,OAAO,oBAAC,WAAD;EAAW,WAAW,GAAG,aAAa;GAAE;GAAa;EAAQ,CAAC,GAAG,SAAS;EAAG,aAAU;EAAO,GAAI;CAAQ,CAAA;AACnH;;;;AAKA,IAAa,cAAc,EAAE,WAAW,GAAG,YAAmC;CAC5E,OACE,oBAAC,OAAD;EACE,WAAW,GACT,oIACA,SACF;EACA,aAAU;EACV,GAAI;CACL,CAAA;AAEL;;;;AAKA,IAAa,cAAc,EAAE,WAAW,GAAG,YAAmC;CAC5E,OACE,oBAAC,OAAD;EACE,WAAW,GAAG,kEAAkE,SAAS;EACzF,aAAU;EACV,GAAI;CACL,CAAA;AAEL;;;;AAKA,IAAa,eAAe,EAAE,WAAW,GAAG,YAAiC;CAC3E,OAAO,oBAAC,KAAD;EAAG,WAAW,GAAG,iCAAiC,SAAS;EAAG,aAAU;EAAe,GAAI;CAAQ,CAAA;AAC5G;;;;AAKA,IAAa,aAAa,EAAE,WAAW,GAAG,YAAkC;CAC1E,OAAO,oBAAC,MAAD;EAAI,WAAW,GAAG,oCAAoC,SAAS;EAAG,aAAU;EAAa,GAAI;CAAQ,CAAA;AAC9G;;;;AAKA,IAAa,mBAAmB,EAAE,WAAW,GAAG,YAAiC;CAC/E,OACE,oBAAC,KAAD;EAAG,WAAW,GAAG,kDAAkD,SAAS;EAAG,aAAU;EAAmB,GAAI;CAAQ,CAAA;AAE5H;;;;AAKA,IAAa,eAAe,EAAE,WAAW,GAAG,YAAmC;CAC7E,OAAO,oBAAC,OAAD;EAAK,WAAW,GAAG,2BAA2B,SAAS;EAAG,aAAU;EAAe,GAAI;CAAQ,CAAA;AACxG;;;;AAKA,IAAa,cAAc,EAAE,WAAW,GAAG,YAAmC;CAC5E,OACE,oBAAC,OAAD;EACE,WAAW,GAAG,2DAA2D,SAAS;EAClF,aAAU;EACV,GAAI;CACL,CAAA;AAEL;;;;AAKA,IAAa,aAAa,EAAE,WAAW,GAAG,YAAmC;CAC3E,OACE,oBAAC,OAAD;EACE,WAAW,GAAG,6EAA6E,SAAS;EACpG,aAAU;EACV,GAAI;CACL,CAAA;AAEL"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Checkbox as CheckboxPrimitive } from 'radix-ui';
|
|
2
|
+
import type { ComponentProps } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Renders a checkbox with checked, unchecked and indeterminate (`checked="indeterminate"`) states.
|
|
5
|
+
*/
|
|
6
|
+
export declare const Checkbox: ({ className, ...props }: ComponentProps<typeof CheckboxPrimitive.Root>) => import("react").JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../lib/cn.js";
|
|
3
|
+
import { useFieldControl } from "../field/field.js";
|
|
4
|
+
import { Check, Minus } from "lucide-react";
|
|
5
|
+
import { Checkbox } from "radix-ui";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
// src/components/checkbox/checkbox.tsx
|
|
8
|
+
/**
|
|
9
|
+
* Renders a checkbox with checked, unchecked and indeterminate (`checked="indeterminate"`) states.
|
|
10
|
+
*/
|
|
11
|
+
var Checkbox$1 = ({ className, ...props }) => {
|
|
12
|
+
const controlProps = useFieldControl(props);
|
|
13
|
+
return /* @__PURE__ */ jsx(Checkbox.Root, {
|
|
14
|
+
className: cn("peer inline-flex size-4.5 shrink-0 items-center justify-center rounded-inner border border-input bg-background text-primary-foreground", "transition-[background-color,border-color] duration-150 ease-out-expo", "focus-ring", "hover:border-foreground/40", "data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=indeterminate]:border-primary data-[state=indeterminate]:bg-primary", "aria-invalid:border-danger", "active:scale-90", "disabled:cursor-not-allowed disabled:opacity-45", className),
|
|
15
|
+
"data-slot": "checkbox",
|
|
16
|
+
...controlProps,
|
|
17
|
+
children: /* @__PURE__ */ jsxs(Checkbox.Indicator, {
|
|
18
|
+
className: "group/indicator flex items-center justify-center animate-in zoom-in-50 duration-150",
|
|
19
|
+
children: [/* @__PURE__ */ jsx(Check, {
|
|
20
|
+
className: "size-3.5 group-data-[state=indeterminate]/indicator:hidden",
|
|
21
|
+
strokeWidth: 3
|
|
22
|
+
}), /* @__PURE__ */ jsx(Minus, {
|
|
23
|
+
className: "hidden size-3.5 group-data-[state=indeterminate]/indicator:block",
|
|
24
|
+
strokeWidth: 3
|
|
25
|
+
})]
|
|
26
|
+
})
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
export { Checkbox$1 as Checkbox };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=checkbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox.js","names":["Checkbox","CheckboxPrimitive"],"sources":["../../../src/components/checkbox/checkbox.tsx"],"sourcesContent":["'use client';\n\nimport { Check, Minus } from 'lucide-react';\nimport { Checkbox as CheckboxPrimitive } from 'radix-ui';\nimport type { ComponentProps } from 'react';\n\nimport { cn } from '../../lib/cn';\nimport { useFieldControl } from '../field/field';\n\n/**\n * Renders a checkbox with checked, unchecked and indeterminate (`checked=\"indeterminate\"`) states.\n */\nexport const Checkbox = ({ className, ...props }: ComponentProps<typeof CheckboxPrimitive.Root>) => {\n const controlProps = useFieldControl(props);\n\n return (\n <CheckboxPrimitive.Root\n className={cn(\n // base\n 'peer inline-flex size-4.5 shrink-0 items-center justify-center rounded-inner border border-input bg-background text-primary-foreground',\n 'transition-[background-color,border-color] duration-150 ease-out-expo',\n 'focus-ring',\n // hover\n 'hover:border-foreground/40',\n // checked\n 'data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=indeterminate]:border-primary data-[state=indeterminate]:bg-primary',\n // invalid\n 'aria-invalid:border-danger',\n // active\n 'active:scale-90',\n // disabled\n 'disabled:cursor-not-allowed disabled:opacity-45',\n className,\n )}\n data-slot=\"checkbox\"\n {...controlProps}\n >\n <CheckboxPrimitive.Indicator className=\"group/indicator flex items-center justify-center animate-in zoom-in-50 duration-150\">\n <Check className=\"size-3.5 group-data-[state=indeterminate]/indicator:hidden\" strokeWidth={3} />\n <Minus className=\"hidden size-3.5 group-data-[state=indeterminate]/indicator:block\" strokeWidth={3} />\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n );\n};\n"],"mappings":";;;;;;;;;;AAYA,IAAaA,cAAY,EAAE,WAAW,GAAG,YAA2D;CAClG,MAAM,eAAe,gBAAgB,KAAK;CAE1C,OACE,oBAACC,SAAkB,MAAnB;EACE,WAAW,GAET,0IACA,yEACA,cAEA,8BAEA,uJAEA,8BAEA,mBAEA,mDACA,SACF;EACA,aAAU;EACV,GAAI;EAEJ,UAAA,qBAACA,SAAkB,WAAnB;GAA6B,WAAU;GAAvC,UAAA,CACE,oBAAC,OAAD;IAAO,WAAU;IAA6D,aAAa;GAAI,CAAA,GAC/F,oBAAC,OAAD;IAAO,WAAU;IAAmE,aAAa;GAAI,CAAA,CAC1E;;CACP,CAAA;AAE5B"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
2
|
+
import type { ComponentProps, ReactNode } from 'react';
|
|
3
|
+
import { badgeVariants } from '../badge/badge';
|
|
4
|
+
/**
|
|
5
|
+
* What a chip adds to the badge's tone table once a person can click it. Hover and press draw the
|
|
6
|
+
* edge in the tone's own ink and never touch its ground, so the label keeps the contrast it has at
|
|
7
|
+
* rest in every tone. A darker ground drops gem ink under 4.5:1 in light mode.
|
|
8
|
+
*/
|
|
9
|
+
export declare const chipVariants: (props?: ({
|
|
10
|
+
interactive?: boolean | null | undefined;
|
|
11
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
12
|
+
interface ChipProps extends Omit<ComponentProps<'button'>, 'type'>, Pick<VariantProps<typeof badgeVariants>, 'size' | 'variant'> {
|
|
13
|
+
asChild?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* A mark before the label, such as an icon or an emoji.
|
|
16
|
+
*/
|
|
17
|
+
icon?: ReactNode;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A status, tone or filter pill. It wears the badge's tones and adds an `icon` before its label.
|
|
21
|
+
* It becomes a button a person can click, hover and reach by keyboard when it has an `onClick`,
|
|
22
|
+
* and a link when `asChild` wraps one; `aria-pressed` marks a filter pill that is on.
|
|
23
|
+
*/
|
|
24
|
+
export declare const Chip: ({ asChild, children, className, icon, onClick, size, variant, ...props }: ChipProps) => import("react").JSX.Element;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { cn } from "../../lib/cn.js";
|
|
2
|
+
import { badgeVariants } from "../badge/badge.js";
|
|
3
|
+
import { Slot } from "radix-ui";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { cva } from "class-variance-authority";
|
|
6
|
+
// src/components/chip/chip.tsx
|
|
7
|
+
/**
|
|
8
|
+
* What a chip adds to the badge's tone table once a person can click it. Hover and press draw the
|
|
9
|
+
* edge in the tone's own ink and never touch its ground, so the label keeps the contrast it has at
|
|
10
|
+
* rest in every tone. A darker ground drops gem ink under 4.5:1 in light mode.
|
|
11
|
+
*/
|
|
12
|
+
var chipVariants = cva("", {
|
|
13
|
+
variants: { interactive: {
|
|
14
|
+
false: "",
|
|
15
|
+
true: [
|
|
16
|
+
"cursor-pointer focus-ring select-none",
|
|
17
|
+
"transition-[border-color,transform] duration-150 ease-out-expo",
|
|
18
|
+
"hover:not-aria-pressed:border-current/35",
|
|
19
|
+
"active:scale-[0.98] active:not-aria-pressed:border-current/60",
|
|
20
|
+
"aria-pressed:border-current",
|
|
21
|
+
"disabled:pointer-events-none disabled:opacity-45 aria-disabled:pointer-events-none aria-disabled:opacity-45"
|
|
22
|
+
]
|
|
23
|
+
} },
|
|
24
|
+
defaultVariants: { interactive: false }
|
|
25
|
+
});
|
|
26
|
+
/**
|
|
27
|
+
* A status, tone or filter pill. It wears the badge's tones and adds an `icon` before its label.
|
|
28
|
+
* It becomes a button a person can click, hover and reach by keyboard when it has an `onClick`,
|
|
29
|
+
* and a link when `asChild` wraps one; `aria-pressed` marks a filter pill that is on.
|
|
30
|
+
*/
|
|
31
|
+
var Chip = ({ asChild = false, children, className, icon, onClick, size = "sm", variant, ...props }) => {
|
|
32
|
+
const interactive = asChild || onClick !== void 0;
|
|
33
|
+
const Component = asChild ? Slot.Root : interactive ? "button" : "span";
|
|
34
|
+
const mark = icon ? /* @__PURE__ */ jsx("span", {
|
|
35
|
+
"aria-hidden": true,
|
|
36
|
+
className: "inline-flex",
|
|
37
|
+
"data-slot": "chip-icon",
|
|
38
|
+
children: icon
|
|
39
|
+
}) : null;
|
|
40
|
+
return /* @__PURE__ */ jsxs(Component, {
|
|
41
|
+
className: cn(badgeVariants({
|
|
42
|
+
size,
|
|
43
|
+
variant
|
|
44
|
+
}), chipVariants({ interactive }), className),
|
|
45
|
+
"data-slot": "chip",
|
|
46
|
+
onClick,
|
|
47
|
+
type: Component === "button" ? "button" : void 0,
|
|
48
|
+
...props,
|
|
49
|
+
children: [mark, asChild ? /* @__PURE__ */ jsx(Slot.Slottable, { children }) : children]
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
export { Chip, chipVariants };
|
|
53
|
+
|
|
54
|
+
//# sourceMappingURL=chip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chip.js","names":[],"sources":["../../../src/components/chip/chip.tsx"],"sourcesContent":["import { cva, type VariantProps } from 'class-variance-authority';\nimport { Slot } from 'radix-ui';\nimport type { ComponentProps, ReactNode } from 'react';\n\nimport { cn } from '../../lib/cn';\nimport { badgeVariants } from '../badge/badge';\n\n/**\n * What a chip adds to the badge's tone table once a person can click it. Hover and press draw the\n * edge in the tone's own ink and never touch its ground, so the label keeps the contrast it has at\n * rest in every tone. A darker ground drops gem ink under 4.5:1 in light mode.\n */\nexport const chipVariants = cva('', {\n variants: {\n interactive: {\n false: '',\n true: [\n // base\n 'cursor-pointer focus-ring select-none',\n 'transition-[border-color,transform] duration-150 ease-out-expo',\n // hover\n 'hover:not-aria-pressed:border-current/35',\n // active\n 'active:scale-[0.98] active:not-aria-pressed:border-current/60',\n // pressed: a filter pill that is on\n 'aria-pressed:border-current',\n // disabled\n 'disabled:pointer-events-none disabled:opacity-45 aria-disabled:pointer-events-none aria-disabled:opacity-45',\n ],\n },\n },\n defaultVariants: {\n interactive: false,\n },\n});\n\ninterface ChipProps\n extends Omit<ComponentProps<'button'>, 'type'>, Pick<VariantProps<typeof badgeVariants>, 'size' | 'variant'> {\n asChild?: boolean;\n /**\n * A mark before the label, such as an icon or an emoji.\n */\n icon?: ReactNode;\n}\n\n/**\n * A status, tone or filter pill. It wears the badge's tones and adds an `icon` before its label.\n * It becomes a button a person can click, hover and reach by keyboard when it has an `onClick`,\n * and a link when `asChild` wraps one; `aria-pressed` marks a filter pill that is on.\n */\nexport const Chip = ({\n asChild = false,\n children,\n className,\n icon,\n onClick,\n size = 'sm',\n variant,\n ...props\n}: ChipProps) => {\n const interactive = asChild || onClick !== undefined;\n const Component = asChild ? Slot.Root : interactive ? 'button' : 'span';\n const mark = icon ? (\n <span aria-hidden className=\"inline-flex\" data-slot=\"chip-icon\">\n {icon}\n </span>\n ) : null;\n\n return (\n <Component\n className={cn(badgeVariants({ size, variant }), chipVariants({ interactive }), className)}\n data-slot=\"chip\"\n onClick={onClick}\n type={Component === 'button' ? 'button' : undefined}\n {...props}\n >\n {mark}\n {asChild ? <Slot.Slottable>{children}</Slot.Slottable> : children}\n </Component>\n );\n};\n"],"mappings":";;;;;;;;;;;AAYA,IAAa,eAAe,IAAI,IAAI;CAClC,UAAU,EACR,aAAa;EACX,OAAO;EACP,MAAM;GAEJ;GACA;GAEA;GAEA;GAEA;GAEA;EACF;CACF,EACF;CACA,iBAAiB,EACf,aAAa,MACf;AACF,CAAC;;;;;;AAgBD,IAAa,QAAQ,EACnB,UAAU,OACV,UACA,WACA,MACA,SACA,OAAO,MACP,SACA,GAAG,YACY;CACf,MAAM,cAAc,WAAW,YAAY,KAAA;CAC3C,MAAM,YAAY,UAAU,KAAK,OAAO,cAAc,WAAW;CACjE,MAAM,OAAO,OACX,oBAAC,QAAD;EAAM,eAAA;EAAY,WAAU;EAAc,aAAU;EACjD,UAAA;CACG,CAAA,IACJ;CAEJ,OACE,qBAAC,WAAD;EACE,WAAW,GAAG,cAAc;GAAE;GAAM;EAAQ,CAAC,GAAG,aAAa,EAAE,YAAY,CAAC,GAAG,SAAS;EACxF,aAAU;EACD;EACT,MAAM,cAAc,WAAW,WAAW,KAAA;EAC1C,GAAI;EALN,UAAA,CAOG,MACA,UAAU,oBAAC,KAAK,WAAN,EAAiB,SAAyB,CAAA,IAAI,QAChD;;AAEf"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ComponentProps } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Inline code in Geist Mono on a muted chip.
|
|
4
|
+
*/
|
|
5
|
+
export declare const Code: ({ className, ...props }: ComponentProps<"code">) => import("react").JSX.Element;
|
|
6
|
+
interface CodeBlockProps extends Omit<ComponentProps<'figure'>, 'children'> {
|
|
7
|
+
code: string;
|
|
8
|
+
copyable?: boolean;
|
|
9
|
+
title?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A pre-formatted snippet with an optional filename bar and a copy-to-clipboard button.
|
|
13
|
+
*/
|
|
14
|
+
export declare const CodeBlock: ({ className, code, copyable, title, ...props }: CodeBlockProps) => import("react").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../lib/cn.js";
|
|
3
|
+
import { Button } from "../button/button.js";
|
|
4
|
+
import { Check, Copy } from "lucide-react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { useState } from "react";
|
|
7
|
+
// src/components/code/code.tsx
|
|
8
|
+
/**
|
|
9
|
+
* Inline code in Geist Mono on a muted chip.
|
|
10
|
+
*/
|
|
11
|
+
var Code = ({ className, ...props }) => {
|
|
12
|
+
return /* @__PURE__ */ jsx("code", {
|
|
13
|
+
className: cn("rounded-sm border bg-muted px-1.5 py-0.5 font-mono text-[0.875em] text-foreground wrap-anywhere", className),
|
|
14
|
+
"data-slot": "code",
|
|
15
|
+
...props
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* A pre-formatted snippet with an optional filename bar and a copy-to-clipboard button.
|
|
20
|
+
*/
|
|
21
|
+
var CodeBlock = ({ className, code, copyable = true, title, ...props }) => {
|
|
22
|
+
const [isCopied, setIsCopied] = useState(false);
|
|
23
|
+
/**
|
|
24
|
+
* Copies the snippet and flips the button to a check mark for two seconds.
|
|
25
|
+
*/
|
|
26
|
+
const handleCopy = async () => {
|
|
27
|
+
await navigator.clipboard.writeText(code);
|
|
28
|
+
setIsCopied(true);
|
|
29
|
+
window.setTimeout(() => {
|
|
30
|
+
setIsCopied(false);
|
|
31
|
+
}, 2e3);
|
|
32
|
+
};
|
|
33
|
+
const copyLabel = isCopied ? "Copied" : "Copy code";
|
|
34
|
+
return /* @__PURE__ */ jsxs("figure", {
|
|
35
|
+
className: cn("group/code relative overflow-hidden rounded-card border bg-muted/60", className),
|
|
36
|
+
"data-slot": "code-block",
|
|
37
|
+
...props,
|
|
38
|
+
children: [
|
|
39
|
+
title && /* @__PURE__ */ jsx("figcaption", {
|
|
40
|
+
className: "flex h-control-sm items-center border-b px-4 font-mono text-caption text-muted-foreground",
|
|
41
|
+
children: title
|
|
42
|
+
}),
|
|
43
|
+
/* @__PURE__ */ jsx("pre", {
|
|
44
|
+
className: "overflow-x-auto p-4 font-mono text-body-sm leading-relaxed",
|
|
45
|
+
children: /* @__PURE__ */ jsx("code", { children: code })
|
|
46
|
+
}),
|
|
47
|
+
copyable && /* @__PURE__ */ jsxs(Button, {
|
|
48
|
+
className: "absolute right-2 bottom-2 opacity-0 group-hover/code:opacity-100 focus-visible:opacity-100",
|
|
49
|
+
size: "icon-sm",
|
|
50
|
+
title: copyLabel,
|
|
51
|
+
variant: "outline",
|
|
52
|
+
onClick: handleCopy,
|
|
53
|
+
children: [isCopied ? /* @__PURE__ */ jsx(Check, { className: "text-success-ink" }) : /* @__PURE__ */ jsx(Copy, {}), /* @__PURE__ */ jsx("span", {
|
|
54
|
+
className: "sr-only",
|
|
55
|
+
children: copyLabel
|
|
56
|
+
})]
|
|
57
|
+
})
|
|
58
|
+
]
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
export { Code, CodeBlock };
|
|
62
|
+
|
|
63
|
+
//# sourceMappingURL=code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code.js","names":[],"sources":["../../../src/components/code/code.tsx"],"sourcesContent":["'use client';\n\nimport { Check, Copy } from 'lucide-react';\nimport { type ComponentProps, useState } from 'react';\n\nimport { cn } from '../../lib/cn';\nimport { Button } from '../button/button';\n\n/**\n * Inline code in Geist Mono on a muted chip.\n */\nexport const Code = ({ className, ...props }: ComponentProps<'code'>) => {\n return (\n <code\n className={cn(\n 'rounded-sm border bg-muted px-1.5 py-0.5 font-mono text-[0.875em] text-foreground wrap-anywhere',\n className,\n )}\n data-slot=\"code\"\n {...props}\n />\n );\n};\n\ninterface CodeBlockProps extends Omit<ComponentProps<'figure'>, 'children'> {\n code: string;\n copyable?: boolean;\n title?: string;\n}\n\n/**\n * A pre-formatted snippet with an optional filename bar and a copy-to-clipboard button.\n */\nexport const CodeBlock = ({ className, code, copyable = true, title, ...props }: CodeBlockProps) => {\n const [isCopied, setIsCopied] = useState(false);\n\n /**\n * Copies the snippet and flips the button to a check mark for two seconds.\n */\n const handleCopy = async () => {\n await navigator.clipboard.writeText(code);\n setIsCopied(true);\n window.setTimeout(() => {\n setIsCopied(false);\n }, 2000);\n };\n\n const copyLabel = isCopied ? 'Copied' : 'Copy code';\n\n return (\n <figure\n className={cn('group/code relative overflow-hidden rounded-card border bg-muted/60', className)}\n data-slot=\"code-block\"\n {...props}\n >\n {title && (\n <figcaption className=\"flex h-control-sm items-center border-b px-4 font-mono text-caption text-muted-foreground\">\n {title}\n </figcaption>\n )}\n <pre className=\"overflow-x-auto p-4 font-mono text-body-sm leading-relaxed\">\n <code>{code}</code>\n </pre>\n {copyable && (\n <Button\n className=\"absolute right-2 bottom-2 opacity-0 group-hover/code:opacity-100 focus-visible:opacity-100\"\n size=\"icon-sm\"\n title={copyLabel}\n variant=\"outline\"\n onClick={handleCopy}\n >\n {isCopied ? <Check className=\"text-success-ink\" /> : <Copy />}\n <span className=\"sr-only\">{copyLabel}</span>\n </Button>\n )}\n </figure>\n );\n};\n"],"mappings":";;;;;;;;;;AAWA,IAAa,QAAQ,EAAE,WAAW,GAAG,YAAoC;CACvE,OACE,oBAAC,QAAD;EACE,WAAW,GACT,mGACA,SACF;EACA,aAAU;EACV,GAAI;CACL,CAAA;AAEL;;;;AAWA,IAAa,aAAa,EAAE,WAAW,MAAM,WAAW,MAAM,OAAO,GAAG,YAA4B;CAClG,MAAM,CAAC,UAAU,eAAe,SAAS,KAAK;;;;CAK9C,MAAM,aAAa,YAAY;EAC7B,MAAM,UAAU,UAAU,UAAU,IAAI;EACxC,YAAY,IAAI;EAChB,OAAO,iBAAiB;GACtB,YAAY,KAAK;EACnB,GAAG,GAAI;CACT;CAEA,MAAM,YAAY,WAAW,WAAW;CAExC,OACE,qBAAC,UAAD;EACE,WAAW,GAAG,uEAAuE,SAAS;EAC9F,aAAU;EACV,GAAI;EAHN,UAAA;GAKG,SACC,oBAAC,cAAD;IAAY,WAAU;IACnB,UAAA;GACS,CAAA;GAEd,oBAAC,OAAD;IAAK,WAAU;IACb,UAAA,oBAAC,QAAD,EAAA,UAAO,KAAW,CAAA;GACf,CAAA;GACJ,YACC,qBAAC,QAAD;IACE,WAAU;IACV,MAAK;IACL,OAAO;IACP,SAAQ;IACR,SAAS;IALX,UAAA,CAOG,WAAW,oBAAC,OAAD,EAAO,WAAU,mBAAoB,CAAA,IAAI,oBAAC,MAAD,CAAO,CAAA,GAC5D,oBAAC,QAAD;KAAM,WAAU;KAAW,UAAA;IAAgB,CAAA,CACrC;;EAEJ;;AAEZ"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Collapsible as CollapsiblePrimitive } from 'radix-ui';
|
|
2
|
+
import type { ComponentProps } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Holds one fold-out section: a trigger that opens and shuts the content under it.
|
|
5
|
+
*/
|
|
6
|
+
export declare const Collapsible: ({ className, ...props }: ComponentProps<typeof CollapsiblePrimitive.Root>) => import("react").JSX.Element;
|
|
7
|
+
/**
|
|
8
|
+
* Toggles its section and turns the chevron to show the state. With `asChild` it renders the child alone, with no chevron and no styles.
|
|
9
|
+
*/
|
|
10
|
+
export declare const CollapsibleTrigger: ({ asChild, children, className, ...props }: ComponentProps<typeof CollapsiblePrimitive.Trigger>) => import("react").JSX.Element;
|
|
11
|
+
/**
|
|
12
|
+
* Reveals its section with a height animation.
|
|
13
|
+
*/
|
|
14
|
+
export declare const CollapsibleContent: ({ children, className, ...props }: ComponentProps<typeof CollapsiblePrimitive.Content>) => import("react").JSX.Element;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../lib/cn.js";
|
|
3
|
+
import { ChevronDown } from "lucide-react";
|
|
4
|
+
import { Collapsible } from "radix-ui";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
// src/components/collapsible/collapsible.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Holds one fold-out section: a trigger that opens and shuts the content under it.
|
|
9
|
+
*/
|
|
10
|
+
var Collapsible$1 = ({ className, ...props }) => {
|
|
11
|
+
return /* @__PURE__ */ jsx(Collapsible.Root, {
|
|
12
|
+
className: cn("w-full", className),
|
|
13
|
+
"data-slot": "collapsible",
|
|
14
|
+
...props
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Toggles its section and turns the chevron to show the state. With `asChild` it renders the child alone, with no chevron and no styles.
|
|
19
|
+
*/
|
|
20
|
+
var CollapsibleTrigger = ({ asChild = false, children, className, ...props }) => {
|
|
21
|
+
if (asChild) return /* @__PURE__ */ jsx(Collapsible.Trigger, {
|
|
22
|
+
asChild: true,
|
|
23
|
+
className,
|
|
24
|
+
"data-slot": "collapsible-trigger",
|
|
25
|
+
...props,
|
|
26
|
+
children
|
|
27
|
+
});
|
|
28
|
+
return /* @__PURE__ */ jsxs(Collapsible.Trigger, {
|
|
29
|
+
className: cn("group/collapsible flex w-full items-center justify-between gap-4 rounded-control py-4 text-left text-body font-medium transition-colors focus-ring", "hover:text-gem-ink", "disabled:pointer-events-none disabled:opacity-45", className),
|
|
30
|
+
"data-slot": "collapsible-trigger",
|
|
31
|
+
...props,
|
|
32
|
+
children: [children, /* @__PURE__ */ jsx(ChevronDown, {
|
|
33
|
+
"aria-hidden": true,
|
|
34
|
+
className: "size-4 shrink-0 text-muted-foreground transition-transform duration-200 ease-out-expo group-data-[state=open]/collapsible:rotate-180",
|
|
35
|
+
role: "presentation"
|
|
36
|
+
})]
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Reveals its section with a height animation.
|
|
41
|
+
*/
|
|
42
|
+
var CollapsibleContent = ({ children, className, ...props }) => {
|
|
43
|
+
return /* @__PURE__ */ jsx(Collapsible.Content, {
|
|
44
|
+
className: "overflow-hidden text-body-sm text-muted-foreground data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down",
|
|
45
|
+
"data-slot": "collapsible-content",
|
|
46
|
+
...props,
|
|
47
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
48
|
+
className: cn("pb-4", className),
|
|
49
|
+
children
|
|
50
|
+
})
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
export { Collapsible$1 as Collapsible, CollapsibleContent, CollapsibleTrigger };
|
|
54
|
+
|
|
55
|
+
//# sourceMappingURL=collapsible.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collapsible.js","names":["Collapsible","CollapsiblePrimitive"],"sources":["../../../src/components/collapsible/collapsible.tsx"],"sourcesContent":["'use client';\n\nimport { ChevronDown } from 'lucide-react';\nimport { Collapsible as CollapsiblePrimitive } from 'radix-ui';\nimport type { ComponentProps } from 'react';\n\nimport { cn } from '../../lib/cn';\n\n/**\n * Holds one fold-out section: a trigger that opens and shuts the content under it.\n */\nexport const Collapsible = ({ className, ...props }: ComponentProps<typeof CollapsiblePrimitive.Root>) => {\n return <CollapsiblePrimitive.Root className={cn('w-full', className)} data-slot=\"collapsible\" {...props} />;\n};\n\n/**\n * Toggles its section and turns the chevron to show the state. With `asChild` it renders the child alone, with no chevron and no styles.\n */\nexport const CollapsibleTrigger = ({\n asChild = false,\n children,\n className,\n ...props\n}: ComponentProps<typeof CollapsiblePrimitive.Trigger>) => {\n if (asChild) {\n return (\n <CollapsiblePrimitive.Trigger asChild className={className} data-slot=\"collapsible-trigger\" {...props}>\n {children}\n </CollapsiblePrimitive.Trigger>\n );\n }\n\n return (\n <CollapsiblePrimitive.Trigger\n className={cn(\n // base\n 'group/collapsible flex w-full items-center justify-between gap-4 rounded-control py-4 text-left text-body font-medium transition-colors focus-ring',\n // hover\n 'hover:text-gem-ink',\n // disabled\n 'disabled:pointer-events-none disabled:opacity-45',\n className,\n )}\n data-slot=\"collapsible-trigger\"\n {...props}\n >\n {children}\n <ChevronDown\n aria-hidden\n className=\"size-4 shrink-0 text-muted-foreground transition-transform duration-200 ease-out-expo group-data-[state=open]/collapsible:rotate-180\"\n role=\"presentation\"\n />\n </CollapsiblePrimitive.Trigger>\n );\n};\n\n/**\n * Reveals its section with a height animation.\n */\nexport const CollapsibleContent = ({\n children,\n className,\n ...props\n}: ComponentProps<typeof CollapsiblePrimitive.Content>) => {\n return (\n <CollapsiblePrimitive.Content\n className=\"overflow-hidden text-body-sm text-muted-foreground data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down\"\n data-slot=\"collapsible-content\"\n {...props}\n >\n <div className={cn('pb-4', className)}>{children}</div>\n </CollapsiblePrimitive.Content>\n );\n};\n"],"mappings":";;;;;;;;;AAWA,IAAaA,iBAAe,EAAE,WAAW,GAAG,YAA8D;CACxG,OAAO,oBAACC,YAAqB,MAAtB;EAA2B,WAAW,GAAG,UAAU,SAAS;EAAG,aAAU;EAAc,GAAI;CAAQ,CAAA;AAC5G;;;;AAKA,IAAa,sBAAsB,EACjC,UAAU,OACV,UACA,WACA,GAAG,YACsD;CACzD,IAAI,SACF,OACE,oBAACA,YAAqB,SAAtB;EAA8B,SAAA;EAAmB;EAAW,aAAU;EAAsB,GAAI;EAC7F;CAC2B,CAAA;CAIlC,OACE,qBAACA,YAAqB,SAAtB;EACE,WAAW,GAET,sJAEA,sBAEA,oDACA,SACF;EACA,aAAU;EACV,GAAI;EAXN,UAAA,CAaG,UACD,oBAAC,aAAD;GACE,eAAA;GACA,WAAU;GACV,MAAK;EACN,CAAA,CAC2B;;AAElC;;;;AAKA,IAAa,sBAAsB,EACjC,UACA,WACA,GAAG,YACsD;CACzD,OACE,oBAACA,YAAqB,SAAtB;EACE,WAAU;EACV,aAAU;EACV,GAAI;EAEJ,UAAA,oBAAC,OAAD;GAAK,WAAW,GAAG,QAAQ,SAAS;GAAI;EAAc,CAAA;CAC1B,CAAA;AAElC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export interface ComboboxOption {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
group?: string;
|
|
7
|
+
hint?: ReactNode;
|
|
8
|
+
keywords?: string[];
|
|
9
|
+
}
|
|
10
|
+
type ComboboxSize = 'lg' | 'md' | 'sm';
|
|
11
|
+
interface ComboboxProps {
|
|
12
|
+
options: ComboboxOption[];
|
|
13
|
+
value: string | null;
|
|
14
|
+
onValueChange: (value: string | null) => void;
|
|
15
|
+
'aria-label'?: string;
|
|
16
|
+
className?: string;
|
|
17
|
+
createLabel?: (query: string) => ReactNode;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
emptyMessage?: ReactNode;
|
|
20
|
+
leading?: ReactNode;
|
|
21
|
+
onCreate?: (query: string) => void;
|
|
22
|
+
onQueryChange?: (query: string) => void;
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
query?: string;
|
|
25
|
+
renderOption?: (option: ComboboxOption) => ReactNode;
|
|
26
|
+
renderValue?: (option: ComboboxOption) => ReactNode;
|
|
27
|
+
size?: ComboboxSize;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Picks one value from a long list by typing; arrows move, Enter picks, Escape closes, and `onCreate` adds a "Create" row for an unmatched query.
|
|
31
|
+
*/
|
|
32
|
+
export declare const Combobox: ({ "aria-label": ariaLabel, className, createLabel, disabled, emptyMessage, leading, onCreate, onQueryChange, onValueChange, options, placeholder, query: controlledQuery, renderOption, renderValue, size, value, }: ComboboxProps) => import("react").JSX.Element;
|
|
33
|
+
export {};
|