@krizaka/ui 2.0.0-beta.0 → 2.0.0-beta.2
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/README.md +52 -3
- package/dist/alert.d.ts +95 -0
- package/dist/alert.js +38 -0
- package/dist/alert.js.map +1 -0
- package/dist/button-G5qY4qSY.d.ts +68 -0
- package/dist/card.d.ts +227 -0
- package/dist/card.js +108 -0
- package/dist/card.js.map +1 -0
- package/dist/checkbox.d.ts +52 -0
- package/dist/checkbox.js +42 -0
- package/dist/checkbox.js.map +1 -0
- package/dist/chip.d.ts +97 -0
- package/dist/chip.js +93 -0
- package/dist/chip.js.map +1 -0
- package/dist/chunk-5AXLA4LK.js +13 -0
- package/dist/chunk-5AXLA4LK.js.map +1 -0
- package/dist/chunk-5FRYKFTO.js +121 -0
- package/dist/chunk-5FRYKFTO.js.map +1 -0
- package/dist/{chunk-CPMZS4XA.js → chunk-FJDSLNXK.js} +1 -1
- package/dist/chunk-FJDSLNXK.js.map +1 -0
- package/dist/chunk-J3NC6ER4.js +9 -0
- package/dist/chunk-J3NC6ER4.js.map +1 -0
- package/dist/chunk-QRG5RYEI.js +49 -0
- package/dist/chunk-QRG5RYEI.js.map +1 -0
- package/dist/cn.d.ts +3 -0
- package/dist/cn.js +1 -1
- package/dist/command.d.ts +156 -0
- package/dist/command.js +111 -0
- package/dist/command.js.map +1 -0
- package/dist/confirm-button.d.ts +23 -0
- package/dist/confirm-button.js +85 -0
- package/dist/confirm-button.js.map +1 -0
- package/dist/dialog-DGBY2grk.d.ts +147 -0
- package/dist/dialog.d.ts +28 -0
- package/dist/dialog.js +93 -0
- package/dist/dialog.js.map +1 -0
- package/dist/dropdown-menu.d.ts +71 -0
- package/dist/dropdown-menu.js +66 -0
- package/dist/dropdown-menu.js.map +1 -0
- package/dist/field.js +1 -1
- package/dist/kbd.d.ts +24 -0
- package/dist/kbd.js +16 -0
- package/dist/kbd.js.map +1 -0
- package/dist/motion.css +7 -1
- package/dist/page-header.d.ts +77 -0
- package/dist/page-header.js +32 -0
- package/dist/page-header.js.map +1 -0
- package/dist/popover.d.ts +18 -0
- package/dist/popover.js +34 -0
- package/dist/popover.js.map +1 -0
- package/dist/progress.d.ts +87 -0
- package/dist/progress.js +85 -0
- package/dist/progress.js.map +1 -0
- package/dist/radio-group.d.ts +77 -0
- package/dist/radio-group.js +48 -0
- package/dist/radio-group.js.map +1 -0
- package/dist/separator.d.ts +24 -0
- package/dist/separator.js +17 -0
- package/dist/separator.js.map +1 -0
- package/dist/slider.d.ts +88 -0
- package/dist/slider.js +82 -0
- package/dist/slider.js.map +1 -0
- package/dist/stat.d.ts +75 -0
- package/dist/stat.js +42 -0
- package/dist/stat.js.map +1 -0
- package/dist/switch.d.ts +72 -0
- package/dist/switch.js +38 -0
- package/dist/switch.js.map +1 -0
- package/dist/tabs.d.ts +83 -0
- package/dist/tabs.js +60 -0
- package/dist/tabs.js.map +1 -0
- package/dist/theme.d.ts +2 -59
- package/dist/theme.js +13 -34
- package/dist/theme.js.map +1 -1
- package/dist/toast.d.ts +32 -0
- package/dist/toast.js +49 -0
- package/dist/toast.js.map +1 -0
- package/dist/tooltip.d.ts +21 -0
- package/dist/tooltip.js +44 -0
- package/dist/tooltip.js.map +1 -0
- package/package.json +291 -5
- package/dist/chunk-CPMZS4XA.js.map +0 -1
package/dist/dialog.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
Dialog,
|
|
4
|
+
DialogBody,
|
|
5
|
+
DialogContent,
|
|
6
|
+
DialogDescription,
|
|
7
|
+
DialogFooter,
|
|
8
|
+
DialogHeader,
|
|
9
|
+
DialogTitle,
|
|
10
|
+
Sheet,
|
|
11
|
+
dialog
|
|
12
|
+
} from "./chunk-5FRYKFTO.js";
|
|
13
|
+
import {
|
|
14
|
+
Button
|
|
15
|
+
} from "./chunk-QRG5RYEI.js";
|
|
16
|
+
|
|
17
|
+
// src/dialog/alert-dialog.tsx
|
|
18
|
+
import { AlertDialog as AlertDialogPrimitive } from "radix-ui";
|
|
19
|
+
import * as React from "react";
|
|
20
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
21
|
+
var s = dialog({ placement: "center", size: "sm" });
|
|
22
|
+
function AlertDialog({
|
|
23
|
+
open: openProp,
|
|
24
|
+
defaultOpen = false,
|
|
25
|
+
onOpenChange,
|
|
26
|
+
trigger,
|
|
27
|
+
title,
|
|
28
|
+
description,
|
|
29
|
+
children,
|
|
30
|
+
confirmLabel,
|
|
31
|
+
cancelLabel,
|
|
32
|
+
tone = "primary",
|
|
33
|
+
onConfirm,
|
|
34
|
+
container,
|
|
35
|
+
className
|
|
36
|
+
}) {
|
|
37
|
+
const [openState, setOpenState] = React.useState(defaultOpen);
|
|
38
|
+
const [pending, setPending] = React.useState(false);
|
|
39
|
+
const open = openProp ?? openState;
|
|
40
|
+
const setOpen = (next) => {
|
|
41
|
+
if (openProp === void 0) setOpenState(next);
|
|
42
|
+
onOpenChange?.(next);
|
|
43
|
+
};
|
|
44
|
+
const confirm = async () => {
|
|
45
|
+
setPending(true);
|
|
46
|
+
try {
|
|
47
|
+
await onConfirm();
|
|
48
|
+
setOpen(false);
|
|
49
|
+
} catch {
|
|
50
|
+
} finally {
|
|
51
|
+
setPending(false);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
return /* @__PURE__ */ jsxs(AlertDialogPrimitive.Root, { open, onOpenChange: (next) => pending ? void 0 : setOpen(next), children: [
|
|
55
|
+
trigger && /* @__PURE__ */ jsx(AlertDialogPrimitive.Trigger, { asChild: true, children: trigger }),
|
|
56
|
+
/* @__PURE__ */ jsxs(AlertDialogPrimitive.Portal, { container, children: [
|
|
57
|
+
/* @__PURE__ */ jsx(AlertDialogPrimitive.Overlay, { className: s.overlay() }),
|
|
58
|
+
/* @__PURE__ */ jsxs(
|
|
59
|
+
AlertDialogPrimitive.Content,
|
|
60
|
+
{
|
|
61
|
+
"data-tone": tone,
|
|
62
|
+
"aria-busy": pending || void 0,
|
|
63
|
+
className: s.content({ className }),
|
|
64
|
+
onEscapeKeyDown: (event) => pending && event.preventDefault(),
|
|
65
|
+
children: [
|
|
66
|
+
/* @__PURE__ */ jsxs("div", { className: s.header({ className: "pr-5" }), children: [
|
|
67
|
+
/* @__PURE__ */ jsx(AlertDialogPrimitive.Title, { className: s.title(), children: title }),
|
|
68
|
+
description && /* @__PURE__ */ jsx(AlertDialogPrimitive.Description, { className: s.description(), children: description })
|
|
69
|
+
] }),
|
|
70
|
+
children && /* @__PURE__ */ jsx("div", { className: s.body(), children }),
|
|
71
|
+
/* @__PURE__ */ jsxs("div", { className: s.footer(), children: [
|
|
72
|
+
/* @__PURE__ */ jsx(AlertDialogPrimitive.Cancel, { asChild: true, children: /* @__PURE__ */ jsx(Button, { variant: "ghost", disabled: pending, children: cancelLabel }) }),
|
|
73
|
+
/* @__PURE__ */ jsx(Button, { variant: tone === "danger" ? "danger" : "primary", loading: pending, onClick: confirm, children: confirmLabel })
|
|
74
|
+
] })
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
] })
|
|
79
|
+
] });
|
|
80
|
+
}
|
|
81
|
+
export {
|
|
82
|
+
AlertDialog,
|
|
83
|
+
Dialog,
|
|
84
|
+
DialogBody,
|
|
85
|
+
DialogContent,
|
|
86
|
+
DialogDescription,
|
|
87
|
+
DialogFooter,
|
|
88
|
+
DialogHeader,
|
|
89
|
+
DialogTitle,
|
|
90
|
+
Sheet,
|
|
91
|
+
dialog
|
|
92
|
+
};
|
|
93
|
+
//# sourceMappingURL=dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/dialog/alert-dialog.tsx"],"sourcesContent":["// Client. A confirmation that interrupts: Radix AlertDialog (role=\"alertdialog\", no outside click, focus on Cancel).\n// `onConfirm` may be async: the dialog stays open with the confirm button loading until it settles, closes when it\n// resolves, and stays open when it rejects (the product shows the error).\nimport { AlertDialog as AlertDialogPrimitive } from \"radix-ui\";\nimport * as React from \"react\";\n\nimport { Button } from \"../button/button\";\nimport { dialog } from \"./dialog\";\n\nconst s = dialog({ placement: \"center\", size: \"sm\" });\n\nexport type AlertDialogProps = {\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n /** The element that opens the dialog (rendered as is, `asChild`): a Button, an IconButton. */\n trigger?: React.ReactNode;\n title: React.ReactNode;\n description?: React.ReactNode;\n /** More content between the description and the actions. */\n children?: React.ReactNode;\n confirmLabel: string;\n cancelLabel: string;\n /** `danger` for a destructive action (delete, leave, cancel a payment). */\n tone?: \"danger\" | \"primary\";\n /** Runs on confirm. A promise keeps the dialog open and the button loading until it settles. */\n onConfirm: () => void | Promise<unknown>;\n /** The element the portal renders into (default: document.body). */\n container?: HTMLElement | null;\n className?: string;\n};\n\nexport function AlertDialog({\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n trigger,\n title,\n description,\n children,\n confirmLabel,\n cancelLabel,\n tone = \"primary\",\n onConfirm,\n container,\n className,\n}: AlertDialogProps) {\n const [openState, setOpenState] = React.useState(defaultOpen);\n const [pending, setPending] = React.useState(false);\n const open = openProp ?? openState;\n\n const setOpen = (next: boolean) => {\n if (openProp === undefined) setOpenState(next);\n onOpenChange?.(next);\n };\n\n const confirm = async () => {\n setPending(true);\n try {\n await onConfirm();\n setOpen(false);\n } catch {\n // Stays open: the product reports the failure (a toast, an inline error) and the person may retry.\n } finally {\n setPending(false);\n }\n };\n\n return (\n <AlertDialogPrimitive.Root open={open} onOpenChange={(next) => (pending ? undefined : setOpen(next))}>\n {trigger && <AlertDialogPrimitive.Trigger asChild>{trigger}</AlertDialogPrimitive.Trigger>}\n <AlertDialogPrimitive.Portal container={container}>\n <AlertDialogPrimitive.Overlay className={s.overlay()} />\n <AlertDialogPrimitive.Content\n data-tone={tone}\n aria-busy={pending || undefined}\n className={s.content({ className })}\n onEscapeKeyDown={(event) => pending && event.preventDefault()}\n >\n <div className={s.header({ className: \"pr-5\" })}>\n <AlertDialogPrimitive.Title className={s.title()}>{title}</AlertDialogPrimitive.Title>\n {description && <AlertDialogPrimitive.Description className={s.description()}>{description}</AlertDialogPrimitive.Description>}\n </div>\n {children && <div className={s.body()}>{children}</div>}\n <div className={s.footer()}>\n <AlertDialogPrimitive.Cancel asChild>\n <Button variant=\"ghost\" disabled={pending}>\n {cancelLabel}\n </Button>\n </AlertDialogPrimitive.Cancel>\n <Button variant={tone === \"danger\" ? \"danger\" : \"primary\"} loading={pending} onClick={confirm}>\n {confirmLabel}\n </Button>\n </div>\n </AlertDialogPrimitive.Content>\n </AlertDialogPrimitive.Portal>\n </AlertDialogPrimitive.Root>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAGA,SAAS,eAAe,4BAA4B;AACpD,YAAY,WAAW;AAkEL,cASR,YATQ;AA7DlB,IAAM,IAAI,OAAO,EAAE,WAAW,UAAU,MAAM,KAAK,CAAC;AAuB7C,SAAS,YAAY;AAAA,EAC1B,MAAM;AAAA,EACN,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AACF,GAAqB;AACnB,QAAM,CAAC,WAAW,YAAY,IAAU,eAAS,WAAW;AAC5D,QAAM,CAAC,SAAS,UAAU,IAAU,eAAS,KAAK;AAClD,QAAM,OAAO,YAAY;AAEzB,QAAM,UAAU,CAAC,SAAkB;AACjC,QAAI,aAAa,OAAW,cAAa,IAAI;AAC7C,mBAAe,IAAI;AAAA,EACrB;AAEA,QAAM,UAAU,YAAY;AAC1B,eAAW,IAAI;AACf,QAAI;AACF,YAAM,UAAU;AAChB,cAAQ,KAAK;AAAA,IACf,QAAQ;AAAA,IAER,UAAE;AACA,iBAAW,KAAK;AAAA,IAClB;AAAA,EACF;AAEA,SACE,qBAAC,qBAAqB,MAArB,EAA0B,MAAY,cAAc,CAAC,SAAU,UAAU,SAAY,QAAQ,IAAI,GAC/F;AAAA,eAAW,oBAAC,qBAAqB,SAArB,EAA6B,SAAO,MAAE,mBAAQ;AAAA,IAC3D,qBAAC,qBAAqB,QAArB,EAA4B,WAC3B;AAAA,0BAAC,qBAAqB,SAArB,EAA6B,WAAW,EAAE,QAAQ,GAAG;AAAA,MACtD;AAAA,QAAC,qBAAqB;AAAA,QAArB;AAAA,UACC,aAAW;AAAA,UACX,aAAW,WAAW;AAAA,UACtB,WAAW,EAAE,QAAQ,EAAE,UAAU,CAAC;AAAA,UAClC,iBAAiB,CAAC,UAAU,WAAW,MAAM,eAAe;AAAA,UAE5D;AAAA,iCAAC,SAAI,WAAW,EAAE,OAAO,EAAE,WAAW,OAAO,CAAC,GAC5C;AAAA,kCAAC,qBAAqB,OAArB,EAA2B,WAAW,EAAE,MAAM,GAAI,iBAAM;AAAA,cACxD,eAAe,oBAAC,qBAAqB,aAArB,EAAiC,WAAW,EAAE,YAAY,GAAI,uBAAY;AAAA,eAC7F;AAAA,YACC,YAAY,oBAAC,SAAI,WAAW,EAAE,KAAK,GAAI,UAAS;AAAA,YACjD,qBAAC,SAAI,WAAW,EAAE,OAAO,GACvB;AAAA,kCAAC,qBAAqB,QAArB,EAA4B,SAAO,MAClC,8BAAC,UAAO,SAAQ,SAAQ,UAAU,SAC/B,uBACH,GACF;AAAA,cACA,oBAAC,UAAO,SAAS,SAAS,WAAW,WAAW,WAAW,SAAS,SAAS,SAAS,SACnF,wBACH;AAAA,eACF;AAAA;AAAA;AAAA,MACF;AAAA,OACF;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import * as tailwind_variants from 'tailwind-variants';
|
|
2
|
+
import { DropdownMenu as DropdownMenu$1 } from 'radix-ui';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
declare const menu: tailwind_variants.TVReturnType<{
|
|
6
|
+
tone: {
|
|
7
|
+
default: {};
|
|
8
|
+
danger: {
|
|
9
|
+
item: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
}, {
|
|
13
|
+
content: string;
|
|
14
|
+
item: string;
|
|
15
|
+
indicator: string;
|
|
16
|
+
label: string;
|
|
17
|
+
separator: string;
|
|
18
|
+
}, undefined, {
|
|
19
|
+
tone: {
|
|
20
|
+
default: {};
|
|
21
|
+
danger: {
|
|
22
|
+
item: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
}, {
|
|
26
|
+
content: string;
|
|
27
|
+
item: string;
|
|
28
|
+
indicator: string;
|
|
29
|
+
label: string;
|
|
30
|
+
separator: string;
|
|
31
|
+
}, tailwind_variants.TVReturnTypeLike<{
|
|
32
|
+
tone: {
|
|
33
|
+
default: {};
|
|
34
|
+
danger: {
|
|
35
|
+
item: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
}, {
|
|
39
|
+
content: string;
|
|
40
|
+
item: string;
|
|
41
|
+
indicator: string;
|
|
42
|
+
label: string;
|
|
43
|
+
separator: string;
|
|
44
|
+
}>>;
|
|
45
|
+
type DropdownMenuContentProps = React.ComponentProps<typeof DropdownMenu$1.Content> & {
|
|
46
|
+
/** The element the portal renders into (default: document.body). */
|
|
47
|
+
container?: HTMLElement | null;
|
|
48
|
+
};
|
|
49
|
+
declare function DropdownMenuContent({ sideOffset, align, collisionPadding, container, className, ...props }: DropdownMenuContentProps): React.JSX.Element;
|
|
50
|
+
type DropdownMenuItemProps = React.ComponentProps<typeof DropdownMenu$1.Item> & {
|
|
51
|
+
tone?: "default" | "danger";
|
|
52
|
+
};
|
|
53
|
+
/** An action. `tone="danger"` for a destructive one; `onSelect` runs it (the menu closes). */
|
|
54
|
+
declare function DropdownMenuItem({ tone, className, ...props }: DropdownMenuItemProps): React.JSX.Element;
|
|
55
|
+
/** A toggled option: `checked` + `onCheckedChange`. */
|
|
56
|
+
declare function DropdownMenuCheckboxItem({ className, children, ...props }: React.ComponentProps<typeof DropdownMenu$1.CheckboxItem>): React.JSX.Element;
|
|
57
|
+
declare function DropdownMenuLabel({ className, ...props }: React.ComponentProps<typeof DropdownMenu$1.Label>): React.JSX.Element;
|
|
58
|
+
declare function DropdownMenuSeparator({ className, ...props }: React.ComponentProps<typeof DropdownMenu$1.Separator>): React.JSX.Element;
|
|
59
|
+
/** `DropdownMenu.Root/Trigger/Content/Item/CheckboxItem/Label/Separator/Group`. `open`/`defaultOpen` + `onOpenChange`. */
|
|
60
|
+
declare const DropdownMenu: {
|
|
61
|
+
Root: React.FC<DropdownMenu$1.DropdownMenuProps>;
|
|
62
|
+
Trigger: React.ForwardRefExoticComponent<DropdownMenu$1.DropdownMenuTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
63
|
+
Content: typeof DropdownMenuContent;
|
|
64
|
+
Item: typeof DropdownMenuItem;
|
|
65
|
+
CheckboxItem: typeof DropdownMenuCheckboxItem;
|
|
66
|
+
Label: typeof DropdownMenuLabel;
|
|
67
|
+
Separator: typeof DropdownMenuSeparator;
|
|
68
|
+
Group: React.ForwardRefExoticComponent<DropdownMenu$1.DropdownMenuGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, type DropdownMenuContentProps, DropdownMenuItem, type DropdownMenuItemProps, DropdownMenuLabel, DropdownMenuSeparator, menu };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
floating
|
|
4
|
+
} from "./chunk-J3NC6ER4.js";
|
|
5
|
+
import {
|
|
6
|
+
cn
|
|
7
|
+
} from "./chunk-5AXLA4LK.js";
|
|
8
|
+
|
|
9
|
+
// src/dropdown-menu/dropdown-menu.tsx
|
|
10
|
+
import { DropdownMenu as MenuPrimitive } from "radix-ui";
|
|
11
|
+
import { tv } from "tailwind-variants";
|
|
12
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
var menu = tv({
|
|
14
|
+
slots: {
|
|
15
|
+
content: cn(floating, "min-w-48 max-h-(--radix-dropdown-menu-content-available-height) overflow-y-auto p-1 origin-(--radix-dropdown-menu-content-transform-origin)"),
|
|
16
|
+
item: "relative flex cursor-pointer select-none items-center gap-2 rounded-md px-2.5 py-2 text-sm text-fg outline-hidden transition-colors data-highlighted:bg-surface-3 data-disabled:pointer-events-none data-disabled:opacity-40 [&>svg]:h-4 [&>svg]:w-4 [&>svg]:shrink-0 [&>svg]:text-fg-secondary",
|
|
17
|
+
indicator: "ml-auto flex h-4 w-4 items-center justify-center text-accent",
|
|
18
|
+
label: "px-2.5 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wider text-fg-secondary",
|
|
19
|
+
separator: "-mx-1 my-1 h-px bg-border-subtle"
|
|
20
|
+
},
|
|
21
|
+
variants: {
|
|
22
|
+
// The danger token is too light for small text on a light surface: the label stays a text role, the icon and the
|
|
23
|
+
// highlight carry the danger.
|
|
24
|
+
tone: { default: {}, danger: { item: "data-highlighted:bg-danger/15 [&>svg]:text-danger" } }
|
|
25
|
+
},
|
|
26
|
+
defaultVariants: { tone: "default" }
|
|
27
|
+
});
|
|
28
|
+
var s = menu();
|
|
29
|
+
function DropdownMenuContent({ sideOffset = 6, align = "end", collisionPadding = 8, container, className, ...props }) {
|
|
30
|
+
return /* @__PURE__ */ jsx(MenuPrimitive.Portal, { container, children: /* @__PURE__ */ jsx(MenuPrimitive.Content, { sideOffset, align, collisionPadding, className: s.content({ className }), ...props }) });
|
|
31
|
+
}
|
|
32
|
+
function DropdownMenuItem({ tone, className, ...props }) {
|
|
33
|
+
return /* @__PURE__ */ jsx(MenuPrimitive.Item, { "data-tone": tone ?? "default", className: menu({ tone }).item({ className }), ...props });
|
|
34
|
+
}
|
|
35
|
+
function DropdownMenuCheckboxItem({ className, children, ...props }) {
|
|
36
|
+
return /* @__PURE__ */ jsxs(MenuPrimitive.CheckboxItem, { className: s.item({ className }), ...props, children: [
|
|
37
|
+
children,
|
|
38
|
+
/* @__PURE__ */ jsx(MenuPrimitive.ItemIndicator, { className: s.indicator(), children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" }) }) })
|
|
39
|
+
] });
|
|
40
|
+
}
|
|
41
|
+
function DropdownMenuLabel({ className, ...props }) {
|
|
42
|
+
return /* @__PURE__ */ jsx(MenuPrimitive.Label, { className: s.label({ className }), ...props });
|
|
43
|
+
}
|
|
44
|
+
function DropdownMenuSeparator({ className, ...props }) {
|
|
45
|
+
return /* @__PURE__ */ jsx(MenuPrimitive.Separator, { className: s.separator({ className }), ...props });
|
|
46
|
+
}
|
|
47
|
+
var DropdownMenu = {
|
|
48
|
+
Root: MenuPrimitive.Root,
|
|
49
|
+
Trigger: MenuPrimitive.Trigger,
|
|
50
|
+
Content: DropdownMenuContent,
|
|
51
|
+
Item: DropdownMenuItem,
|
|
52
|
+
CheckboxItem: DropdownMenuCheckboxItem,
|
|
53
|
+
Label: DropdownMenuLabel,
|
|
54
|
+
Separator: DropdownMenuSeparator,
|
|
55
|
+
Group: MenuPrimitive.Group
|
|
56
|
+
};
|
|
57
|
+
export {
|
|
58
|
+
DropdownMenu,
|
|
59
|
+
DropdownMenuCheckboxItem,
|
|
60
|
+
DropdownMenuContent,
|
|
61
|
+
DropdownMenuItem,
|
|
62
|
+
DropdownMenuLabel,
|
|
63
|
+
DropdownMenuSeparator,
|
|
64
|
+
menu
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=dropdown-menu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/dropdown-menu/dropdown-menu.tsx"],"sourcesContent":["// Client (a portal). Radix does the roving focus, the arrows, Home/End, typeahead, Escape and the focus return.\nimport { DropdownMenu as MenuPrimitive } from \"radix-ui\";\nimport type * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport { cn } from \"../cn\";\nimport { floating } from \"../floating\";\n\nexport const menu = tv({\n slots: {\n content: cn(floating, \"min-w-48 max-h-(--radix-dropdown-menu-content-available-height) overflow-y-auto p-1 origin-(--radix-dropdown-menu-content-transform-origin)\"),\n item:\n \"relative flex cursor-pointer select-none items-center gap-2 rounded-md px-2.5 py-2 text-sm text-fg outline-hidden transition-colors \" +\n \"data-highlighted:bg-surface-3 data-disabled:pointer-events-none data-disabled:opacity-40 [&>svg]:h-4 [&>svg]:w-4 [&>svg]:shrink-0 \" +\n \"[&>svg]:text-fg-secondary\",\n indicator: \"ml-auto flex h-4 w-4 items-center justify-center text-accent\",\n label: \"px-2.5 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wider text-fg-secondary\",\n separator: \"-mx-1 my-1 h-px bg-border-subtle\",\n },\n variants: {\n // The danger token is too light for small text on a light surface: the label stays a text role, the icon and the\n // highlight carry the danger.\n tone: { default: {}, danger: { item: \"data-highlighted:bg-danger/15 [&>svg]:text-danger\" } },\n },\n defaultVariants: { tone: \"default\" },\n});\nconst s = menu();\n\nexport type DropdownMenuContentProps = React.ComponentProps<typeof MenuPrimitive.Content> & {\n /** The element the portal renders into (default: document.body). */\n container?: HTMLElement | null;\n};\n\nexport function DropdownMenuContent({ sideOffset = 6, align = \"end\", collisionPadding = 8, container, className, ...props }: DropdownMenuContentProps) {\n return (\n <MenuPrimitive.Portal container={container}>\n <MenuPrimitive.Content sideOffset={sideOffset} align={align} collisionPadding={collisionPadding} className={s.content({ className })} {...props} />\n </MenuPrimitive.Portal>\n );\n}\n\nexport type DropdownMenuItemProps = React.ComponentProps<typeof MenuPrimitive.Item> & { tone?: \"default\" | \"danger\" };\n\n/** An action. `tone=\"danger\"` for a destructive one; `onSelect` runs it (the menu closes). */\nexport function DropdownMenuItem({ tone, className, ...props }: DropdownMenuItemProps) {\n return <MenuPrimitive.Item data-tone={tone ?? \"default\"} className={menu({ tone }).item({ className })} {...props} />;\n}\n\n/** A toggled option: `checked` + `onCheckedChange`. */\nexport function DropdownMenuCheckboxItem({ className, children, ...props }: React.ComponentProps<typeof MenuPrimitive.CheckboxItem>) {\n return (\n <MenuPrimitive.CheckboxItem className={s.item({ className })} {...props}>\n {children}\n <MenuPrimitive.ItemIndicator className={s.indicator()}>\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden>\n <path d=\"M20 6 9 17l-5-5\" />\n </svg>\n </MenuPrimitive.ItemIndicator>\n </MenuPrimitive.CheckboxItem>\n );\n}\n\nexport function DropdownMenuLabel({ className, ...props }: React.ComponentProps<typeof MenuPrimitive.Label>) {\n return <MenuPrimitive.Label className={s.label({ className })} {...props} />;\n}\n\nexport function DropdownMenuSeparator({ className, ...props }: React.ComponentProps<typeof MenuPrimitive.Separator>) {\n return <MenuPrimitive.Separator className={s.separator({ className })} {...props} />;\n}\n\n/** `DropdownMenu.Root/Trigger/Content/Item/CheckboxItem/Label/Separator/Group`. `open`/`defaultOpen` + `onOpenChange`. */\nexport const DropdownMenu = {\n Root: MenuPrimitive.Root,\n Trigger: MenuPrimitive.Trigger,\n Content: DropdownMenuContent,\n Item: DropdownMenuItem,\n CheckboxItem: DropdownMenuCheckboxItem,\n Label: DropdownMenuLabel,\n Separator: DropdownMenuSeparator,\n Group: MenuPrimitive.Group,\n};\n"],"mappings":";;;;;;;;;AACA,SAAS,gBAAgB,qBAAqB;AAE9C,SAAS,UAAU;AAiCb,cAeF,YAfE;AA5BC,IAAM,OAAO,GAAG;AAAA,EACrB,OAAO;AAAA,IACL,SAAS,GAAG,UAAU,6IAA6I;AAAA,IACnK,MACE;AAAA,IAGF,WAAW;AAAA,IACX,OAAO;AAAA,IACP,WAAW;AAAA,EACb;AAAA,EACA,UAAU;AAAA;AAAA;AAAA,IAGR,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,EAAE,MAAM,oDAAoD,EAAE;AAAA,EAC7F;AAAA,EACA,iBAAiB,EAAE,MAAM,UAAU;AACrC,CAAC;AACD,IAAM,IAAI,KAAK;AAOR,SAAS,oBAAoB,EAAE,aAAa,GAAG,QAAQ,OAAO,mBAAmB,GAAG,WAAW,WAAW,GAAG,MAAM,GAA6B;AACrJ,SACE,oBAAC,cAAc,QAAd,EAAqB,WACpB,8BAAC,cAAc,SAAd,EAAsB,YAAwB,OAAc,kBAAoC,WAAW,EAAE,QAAQ,EAAE,UAAU,CAAC,GAAI,GAAG,OAAO,GACnJ;AAEJ;AAKO,SAAS,iBAAiB,EAAE,MAAM,WAAW,GAAG,MAAM,GAA0B;AACrF,SAAO,oBAAC,cAAc,MAAd,EAAmB,aAAW,QAAQ,WAAW,WAAW,KAAK,EAAE,KAAK,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,GAAI,GAAG,OAAO;AACrH;AAGO,SAAS,yBAAyB,EAAE,WAAW,UAAU,GAAG,MAAM,GAA4D;AACnI,SACE,qBAAC,cAAc,cAAd,EAA2B,WAAW,EAAE,KAAK,EAAE,UAAU,CAAC,GAAI,GAAG,OAC/D;AAAA;AAAA,IACD,oBAAC,cAAc,eAAd,EAA4B,WAAW,EAAE,UAAU,GAClD,8BAAC,SAAI,SAAQ,aAAY,MAAK,QAAO,QAAO,gBAAe,aAAY,OAAM,eAAc,SAAQ,gBAAe,SAAQ,eAAW,MACnI,8BAAC,UAAK,GAAE,mBAAkB,GAC5B,GACF;AAAA,KACF;AAEJ;AAEO,SAAS,kBAAkB,EAAE,WAAW,GAAG,MAAM,GAAqD;AAC3G,SAAO,oBAAC,cAAc,OAAd,EAAoB,WAAW,EAAE,MAAM,EAAE,UAAU,CAAC,GAAI,GAAG,OAAO;AAC5E;AAEO,SAAS,sBAAsB,EAAE,WAAW,GAAG,MAAM,GAAyD;AACnH,SAAO,oBAAC,cAAc,WAAd,EAAwB,WAAW,EAAE,UAAU,EAAE,UAAU,CAAC,GAAI,GAAG,OAAO;AACpF;AAGO,IAAM,eAAe;AAAA,EAC1B,MAAM,cAAc;AAAA,EACpB,SAAS,cAAc;AAAA,EACvB,SAAS;AAAA,EACT,MAAM;AAAA,EACN,cAAc;AAAA,EACd,OAAO;AAAA,EACP,WAAW;AAAA,EACX,OAAO,cAAc;AACvB;","names":[]}
|
package/dist/field.js
CHANGED
package/dist/kbd.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as tailwind_variants from 'tailwind-variants';
|
|
2
|
+
import { VariantProps } from 'tailwind-variants';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
declare const kbdVariants: tailwind_variants.TVReturnType<{
|
|
6
|
+
size: {
|
|
7
|
+
sm: "h-5 min-w-5 px-1 text-[10px]";
|
|
8
|
+
md: "h-6 min-w-6 px-1.5 text-xs";
|
|
9
|
+
};
|
|
10
|
+
}, undefined, string, {
|
|
11
|
+
size: {
|
|
12
|
+
sm: "h-5 min-w-5 px-1 text-[10px]";
|
|
13
|
+
md: "h-6 min-w-6 px-1.5 text-xs";
|
|
14
|
+
};
|
|
15
|
+
}, undefined, tailwind_variants.TVReturnTypeLike<{
|
|
16
|
+
size: {
|
|
17
|
+
sm: "h-5 min-w-5 px-1 text-[10px]";
|
|
18
|
+
md: "h-6 min-w-6 px-1.5 text-xs";
|
|
19
|
+
};
|
|
20
|
+
}, undefined>>;
|
|
21
|
+
type KbdProps = React.ComponentProps<"kbd"> & VariantProps<typeof kbdVariants>;
|
|
22
|
+
declare function Kbd({ size, className, ...props }: KbdProps): React.JSX.Element;
|
|
23
|
+
|
|
24
|
+
export { Kbd, type KbdProps, kbdVariants };
|
package/dist/kbd.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// src/kbd/kbd.tsx
|
|
2
|
+
import { tv } from "tailwind-variants";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
var kbdVariants = tv({
|
|
5
|
+
base: "inline-flex shrink-0 items-center justify-center rounded-md border border-border-default border-b-2 bg-surface-2 font-mono font-semibold text-fg-secondary",
|
|
6
|
+
variants: { size: { sm: "h-5 min-w-5 px-1 text-[10px]", md: "h-6 min-w-6 px-1.5 text-xs" } },
|
|
7
|
+
defaultVariants: { size: "md" }
|
|
8
|
+
});
|
|
9
|
+
function Kbd({ size, className, ...props }) {
|
|
10
|
+
return /* @__PURE__ */ jsx("kbd", { className: kbdVariants({ size, className }), ...props });
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
Kbd,
|
|
14
|
+
kbdVariants
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=kbd.js.map
|
package/dist/kbd.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/kbd/kbd.tsx"],"sourcesContent":["// Server-safe. A key, or a shortcut of several (`<Kbd>⌘</Kbd><Kbd>K</Kbd>`).\nimport type * as React from \"react\";\nimport { tv, type VariantProps } from \"tailwind-variants\";\n\nexport const kbdVariants = tv({\n base:\n \"inline-flex shrink-0 items-center justify-center rounded-md border border-border-default border-b-2 bg-surface-2 \" +\n \"font-mono font-semibold text-fg-secondary\",\n variants: { size: { sm: \"h-5 min-w-5 px-1 text-[10px]\", md: \"h-6 min-w-6 px-1.5 text-xs\" } },\n defaultVariants: { size: \"md\" },\n});\n\nexport type KbdProps = React.ComponentProps<\"kbd\"> & VariantProps<typeof kbdVariants>;\n\nexport function Kbd({ size, className, ...props }: KbdProps) {\n return <kbd className={kbdVariants({ size, className })} {...props} />;\n}\n"],"mappings":";AAEA,SAAS,UAA6B;AAa7B;AAXF,IAAM,cAAc,GAAG;AAAA,EAC5B,MACE;AAAA,EAEF,UAAU,EAAE,MAAM,EAAE,IAAI,gCAAgC,IAAI,6BAA6B,EAAE;AAAA,EAC3F,iBAAiB,EAAE,MAAM,KAAK;AAChC,CAAC;AAIM,SAAS,IAAI,EAAE,MAAM,WAAW,GAAG,MAAM,GAAa;AAC3D,SAAO,oBAAC,SAAI,WAAW,YAAY,EAAE,MAAM,UAAU,CAAC,GAAI,GAAG,OAAO;AACtE;","names":[]}
|
package/dist/motion.css
CHANGED
|
@@ -145,12 +145,18 @@
|
|
|
145
145
|
from { opacity: 0; transform: translateY(12px) scale(0.97); }
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
|
+
/* An indeterminate progress bar: a segment that crosses the track (Progress, variant bar). */
|
|
149
|
+
.kz-progress[data-state="indeterminate"] { animation: kz-progress-slide 1.4s var(--kz-ease) infinite; }
|
|
150
|
+
@keyframes kz-progress-slide {
|
|
151
|
+
from { transform: translateX(-100%); }
|
|
152
|
+
to { transform: translateX(250%); }
|
|
153
|
+
}
|
|
148
154
|
@keyframes kz-pop-in {
|
|
149
155
|
from { opacity: 0; transform: translateY(-6px) scale(0.96); }
|
|
150
156
|
}
|
|
151
157
|
|
|
152
158
|
@media (prefers-reduced-motion: reduce) {
|
|
153
|
-
.kz-page, .kz-word, .kz-gradient-text, .kz-marquee, .kz-overlay, .kz-dialog, .kz-pop, .kz-fade { animation: none !important; }
|
|
159
|
+
.kz-page, .kz-word, .kz-gradient-text, .kz-marquee, .kz-overlay, .kz-dialog, .kz-pop, .kz-fade, .kz-progress { animation: none !important; }
|
|
154
160
|
[data-reveal] { opacity: 1; transform: none; filter: none; transition: none; }
|
|
155
161
|
.kz-sheen::after { display: none; }
|
|
156
162
|
.kz-lift, .kz-lift:hover { transform: none; transition: none; }
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import * as tailwind_variants from 'tailwind-variants';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
declare const pageHeader: tailwind_variants.TVReturnType<{
|
|
5
|
+
[key: string]: {
|
|
6
|
+
[key: string]: tailwind_variants.ClassValue | {
|
|
7
|
+
root?: tailwind_variants.ClassValue;
|
|
8
|
+
breadcrumb?: tailwind_variants.ClassValue;
|
|
9
|
+
row?: tailwind_variants.ClassValue;
|
|
10
|
+
text?: tailwind_variants.ClassValue;
|
|
11
|
+
title?: tailwind_variants.ClassValue;
|
|
12
|
+
description?: tailwind_variants.ClassValue;
|
|
13
|
+
actions?: tailwind_variants.ClassValue;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
} | {
|
|
17
|
+
[x: string]: {
|
|
18
|
+
[x: string]: tailwind_variants.ClassValue | {
|
|
19
|
+
root?: tailwind_variants.ClassValue;
|
|
20
|
+
breadcrumb?: tailwind_variants.ClassValue;
|
|
21
|
+
row?: tailwind_variants.ClassValue;
|
|
22
|
+
text?: tailwind_variants.ClassValue;
|
|
23
|
+
title?: tailwind_variants.ClassValue;
|
|
24
|
+
description?: tailwind_variants.ClassValue;
|
|
25
|
+
actions?: tailwind_variants.ClassValue;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
} | {}, {
|
|
29
|
+
root: string;
|
|
30
|
+
breadcrumb: string;
|
|
31
|
+
row: string;
|
|
32
|
+
text: string;
|
|
33
|
+
title: string;
|
|
34
|
+
description: string;
|
|
35
|
+
actions: string;
|
|
36
|
+
}, undefined, {
|
|
37
|
+
[key: string]: {
|
|
38
|
+
[key: string]: tailwind_variants.ClassValue | {
|
|
39
|
+
root?: tailwind_variants.ClassValue;
|
|
40
|
+
breadcrumb?: tailwind_variants.ClassValue;
|
|
41
|
+
row?: tailwind_variants.ClassValue;
|
|
42
|
+
text?: tailwind_variants.ClassValue;
|
|
43
|
+
title?: tailwind_variants.ClassValue;
|
|
44
|
+
description?: tailwind_variants.ClassValue;
|
|
45
|
+
actions?: tailwind_variants.ClassValue;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
} | {}, {
|
|
49
|
+
root: string;
|
|
50
|
+
breadcrumb: string;
|
|
51
|
+
row: string;
|
|
52
|
+
text: string;
|
|
53
|
+
title: string;
|
|
54
|
+
description: string;
|
|
55
|
+
actions: string;
|
|
56
|
+
}, tailwind_variants.TVReturnTypeLike<unknown, {
|
|
57
|
+
root: string;
|
|
58
|
+
breadcrumb: string;
|
|
59
|
+
row: string;
|
|
60
|
+
text: string;
|
|
61
|
+
title: string;
|
|
62
|
+
description: string;
|
|
63
|
+
actions: string;
|
|
64
|
+
}>>;
|
|
65
|
+
type PageHeaderProps = Omit<React.ComponentProps<"div">, "title"> & {
|
|
66
|
+
title: React.ReactNode;
|
|
67
|
+
description?: React.ReactNode;
|
|
68
|
+
/** The page's actions: Buttons, a DropdownMenu. */
|
|
69
|
+
actions?: React.ReactNode;
|
|
70
|
+
/** A breadcrumb (the product's own <nav aria-label>), shown above the title. */
|
|
71
|
+
breadcrumb?: React.ReactNode;
|
|
72
|
+
/** The heading level of the title: `h1` for a page, `h2` for a section that looks like one. */
|
|
73
|
+
as?: "h1" | "h2";
|
|
74
|
+
};
|
|
75
|
+
declare function PageHeader({ title, description, actions, breadcrumb, as: Heading, className, ...props }: PageHeaderProps): React.JSX.Element;
|
|
76
|
+
|
|
77
|
+
export { PageHeader, type PageHeaderProps, pageHeader };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// src/page-header/page-header.tsx
|
|
2
|
+
import { tv } from "tailwind-variants";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
var pageHeader = tv({
|
|
5
|
+
slots: {
|
|
6
|
+
root: "flex flex-col gap-3 border-b border-border-subtle pb-6",
|
|
7
|
+
breadcrumb: "text-xs text-fg-secondary",
|
|
8
|
+
row: "flex flex-col gap-4 sm:flex-row sm:items-end sm:justify-between",
|
|
9
|
+
text: "flex min-w-0 flex-col gap-1.5",
|
|
10
|
+
title: "font-display text-2xl font-black tracking-tight text-fg sm:text-3xl",
|
|
11
|
+
description: "max-w-2xl text-sm text-fg-secondary",
|
|
12
|
+
actions: "flex shrink-0 flex-wrap items-center gap-2"
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
var s = pageHeader();
|
|
16
|
+
function PageHeader({ title, description, actions, breadcrumb, as: Heading = "h1", className, ...props }) {
|
|
17
|
+
return /* @__PURE__ */ jsxs("div", { className: s.root({ className }), ...props, children: [
|
|
18
|
+
breadcrumb && /* @__PURE__ */ jsx("div", { className: s.breadcrumb(), children: breadcrumb }),
|
|
19
|
+
/* @__PURE__ */ jsxs("div", { className: s.row(), children: [
|
|
20
|
+
/* @__PURE__ */ jsxs("div", { className: s.text(), children: [
|
|
21
|
+
/* @__PURE__ */ jsx(Heading, { className: s.title(), children: title }),
|
|
22
|
+
description && /* @__PURE__ */ jsx("p", { className: s.description(), children: description })
|
|
23
|
+
] }),
|
|
24
|
+
actions && /* @__PURE__ */ jsx("div", { className: s.actions(), children: actions })
|
|
25
|
+
] })
|
|
26
|
+
] });
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
PageHeader,
|
|
30
|
+
pageHeader
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=page-header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/page-header/page-header.tsx"],"sourcesContent":["// Server-safe. The top of a page: an optional breadcrumb, the title (h1), a description and the page's actions.\nimport type * as React from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nexport const pageHeader = tv({\n slots: {\n root: \"flex flex-col gap-3 border-b border-border-subtle pb-6\",\n breadcrumb: \"text-xs text-fg-secondary\",\n row: \"flex flex-col gap-4 sm:flex-row sm:items-end sm:justify-between\",\n text: \"flex min-w-0 flex-col gap-1.5\",\n title: \"font-display text-2xl font-black tracking-tight text-fg sm:text-3xl\",\n description: \"max-w-2xl text-sm text-fg-secondary\",\n actions: \"flex shrink-0 flex-wrap items-center gap-2\",\n },\n});\nconst s = pageHeader();\n\nexport type PageHeaderProps = Omit<React.ComponentProps<\"div\">, \"title\"> & {\n title: React.ReactNode;\n description?: React.ReactNode;\n /** The page's actions: Buttons, a DropdownMenu. */\n actions?: React.ReactNode;\n /** A breadcrumb (the product's own <nav aria-label>), shown above the title. */\n breadcrumb?: React.ReactNode;\n /** The heading level of the title: `h1` for a page, `h2` for a section that looks like one. */\n as?: \"h1\" | \"h2\";\n};\n\nexport function PageHeader({ title, description, actions, breadcrumb, as: Heading = \"h1\", className, ...props }: PageHeaderProps) {\n return (\n <div className={s.root({ className })} {...props}>\n {breadcrumb && <div className={s.breadcrumb()}>{breadcrumb}</div>}\n <div className={s.row()}>\n <div className={s.text()}>\n <Heading className={s.title()}>{title}</Heading>\n {description && <p className={s.description()}>{description}</p>}\n </div>\n {actions && <div className={s.actions()}>{actions}</div>}\n </div>\n </div>\n );\n}\n"],"mappings":";AAEA,SAAS,UAAU;AA6BE,cAEb,YAFa;AA3Bd,IAAM,aAAa,GAAG;AAAA,EAC3B,OAAO;AAAA,IACL,MAAM;AAAA,IACN,YAAY;AAAA,IACZ,KAAK;AAAA,IACL,MAAM;AAAA,IACN,OAAO;AAAA,IACP,aAAa;AAAA,IACb,SAAS;AAAA,EACX;AACF,CAAC;AACD,IAAM,IAAI,WAAW;AAad,SAAS,WAAW,EAAE,OAAO,aAAa,SAAS,YAAY,IAAI,UAAU,MAAM,WAAW,GAAG,MAAM,GAAoB;AAChI,SACE,qBAAC,SAAI,WAAW,EAAE,KAAK,EAAE,UAAU,CAAC,GAAI,GAAG,OACxC;AAAA,kBAAc,oBAAC,SAAI,WAAW,EAAE,WAAW,GAAI,sBAAW;AAAA,IAC3D,qBAAC,SAAI,WAAW,EAAE,IAAI,GACpB;AAAA,2BAAC,SAAI,WAAW,EAAE,KAAK,GACrB;AAAA,4BAAC,WAAQ,WAAW,EAAE,MAAM,GAAI,iBAAM;AAAA,QACrC,eAAe,oBAAC,OAAE,WAAW,EAAE,YAAY,GAAI,uBAAY;AAAA,SAC9D;AAAA,MACC,WAAW,oBAAC,SAAI,WAAW,EAAE,QAAQ,GAAI,mBAAQ;AAAA,OACpD;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Popover as Popover$1 } from 'radix-ui';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
type PopoverContentProps = React.ComponentProps<typeof Popover$1.Content> & {
|
|
5
|
+
/** The element the portal renders into (default: document.body). */
|
|
6
|
+
container?: HTMLElement | null;
|
|
7
|
+
};
|
|
8
|
+
declare function PopoverContent({ sideOffset, collisionPadding, container, className, ...props }: PopoverContentProps): React.JSX.Element;
|
|
9
|
+
/** `Popover.Root/Trigger/Anchor/Content/Close`. `open`/`defaultOpen` + `onOpenChange`. */
|
|
10
|
+
declare const Popover: {
|
|
11
|
+
Root: React.FC<Popover$1.PopoverProps>;
|
|
12
|
+
Trigger: React.ForwardRefExoticComponent<Popover$1.PopoverTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
13
|
+
Anchor: React.ForwardRefExoticComponent<Popover$1.PopoverAnchorProps & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
Close: React.ForwardRefExoticComponent<Popover$1.PopoverCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
15
|
+
Content: typeof PopoverContent;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { Popover, PopoverContent, type PopoverContentProps };
|
package/dist/popover.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
floating
|
|
4
|
+
} from "./chunk-J3NC6ER4.js";
|
|
5
|
+
import {
|
|
6
|
+
cn
|
|
7
|
+
} from "./chunk-5AXLA4LK.js";
|
|
8
|
+
|
|
9
|
+
// src/popover/popover.tsx
|
|
10
|
+
import { Popover as PopoverPrimitive } from "radix-ui";
|
|
11
|
+
import { jsx } from "react/jsx-runtime";
|
|
12
|
+
function PopoverContent({ sideOffset = 8, collisionPadding = 8, container, className, ...props }) {
|
|
13
|
+
return /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { container, children: /* @__PURE__ */ jsx(
|
|
14
|
+
PopoverPrimitive.Content,
|
|
15
|
+
{
|
|
16
|
+
sideOffset,
|
|
17
|
+
collisionPadding,
|
|
18
|
+
className: cn(floating, "w-72 max-w-(--radix-popover-content-available-width) p-4 origin-(--radix-popover-content-transform-origin)", className),
|
|
19
|
+
...props
|
|
20
|
+
}
|
|
21
|
+
) });
|
|
22
|
+
}
|
|
23
|
+
var Popover = {
|
|
24
|
+
Root: PopoverPrimitive.Root,
|
|
25
|
+
Trigger: PopoverPrimitive.Trigger,
|
|
26
|
+
Anchor: PopoverPrimitive.Anchor,
|
|
27
|
+
Close: PopoverPrimitive.Close,
|
|
28
|
+
Content: PopoverContent
|
|
29
|
+
};
|
|
30
|
+
export {
|
|
31
|
+
Popover,
|
|
32
|
+
PopoverContent
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=popover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/popover/popover.tsx"],"sourcesContent":["// Client (a portal). Radix places the content, traps nothing, closes on Escape and on an outside click, and returns\n// the focus to the trigger.\nimport { Popover as PopoverPrimitive } from \"radix-ui\";\nimport type * as React from \"react\";\n\nimport { cn } from \"../cn\";\nimport { floating } from \"../floating\";\n\nexport type PopoverContentProps = React.ComponentProps<typeof PopoverPrimitive.Content> & {\n /** The element the portal renders into (default: document.body). */\n container?: HTMLElement | null;\n};\n\nexport function PopoverContent({ sideOffset = 8, collisionPadding = 8, container, className, ...props }: PopoverContentProps) {\n return (\n <PopoverPrimitive.Portal container={container}>\n <PopoverPrimitive.Content\n sideOffset={sideOffset}\n collisionPadding={collisionPadding}\n className={cn(floating, \"w-72 max-w-(--radix-popover-content-available-width) p-4 origin-(--radix-popover-content-transform-origin)\", className)}\n {...props}\n />\n </PopoverPrimitive.Portal>\n );\n}\n\n/** `Popover.Root/Trigger/Anchor/Content/Close`. `open`/`defaultOpen` + `onOpenChange`. */\nexport const Popover = {\n Root: PopoverPrimitive.Root,\n Trigger: PopoverPrimitive.Trigger,\n Anchor: PopoverPrimitive.Anchor,\n Close: PopoverPrimitive.Close,\n Content: PopoverContent,\n};\n"],"mappings":";;;;;;;;;AAEA,SAAS,WAAW,wBAAwB;AActC;AAHC,SAAS,eAAe,EAAE,aAAa,GAAG,mBAAmB,GAAG,WAAW,WAAW,GAAG,MAAM,GAAwB;AAC5H,SACE,oBAAC,iBAAiB,QAAjB,EAAwB,WACvB;AAAA,IAAC,iBAAiB;AAAA,IAAjB;AAAA,MACC;AAAA,MACA;AAAA,MACA,WAAW,GAAG,UAAU,8GAA8G,SAAS;AAAA,MAC9I,GAAG;AAAA;AAAA,EACN,GACF;AAEJ;AAGO,IAAM,UAAU;AAAA,EACrB,MAAM,iBAAiB;AAAA,EACvB,SAAS,iBAAiB;AAAA,EAC1B,QAAQ,iBAAiB;AAAA,EACzB,OAAO,iBAAiB;AAAA,EACxB,SAAS;AACX;","names":[]}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import * as tailwind_variants from 'tailwind-variants';
|
|
2
|
+
import { VariantProps } from 'tailwind-variants';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
declare const progress: tailwind_variants.TVReturnType<{
|
|
6
|
+
variant: {
|
|
7
|
+
bar: {
|
|
8
|
+
root: string;
|
|
9
|
+
indicator: string;
|
|
10
|
+
};
|
|
11
|
+
ring: {
|
|
12
|
+
root: string;
|
|
13
|
+
track: string;
|
|
14
|
+
indicator: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
size: {
|
|
18
|
+
sm: {};
|
|
19
|
+
md: {};
|
|
20
|
+
lg: {};
|
|
21
|
+
};
|
|
22
|
+
}, {
|
|
23
|
+
root: string;
|
|
24
|
+
track: string;
|
|
25
|
+
indicator: string;
|
|
26
|
+
center: string;
|
|
27
|
+
}, undefined, {
|
|
28
|
+
variant: {
|
|
29
|
+
bar: {
|
|
30
|
+
root: string;
|
|
31
|
+
indicator: string;
|
|
32
|
+
};
|
|
33
|
+
ring: {
|
|
34
|
+
root: string;
|
|
35
|
+
track: string;
|
|
36
|
+
indicator: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
size: {
|
|
40
|
+
sm: {};
|
|
41
|
+
md: {};
|
|
42
|
+
lg: {};
|
|
43
|
+
};
|
|
44
|
+
}, {
|
|
45
|
+
root: string;
|
|
46
|
+
track: string;
|
|
47
|
+
indicator: string;
|
|
48
|
+
center: string;
|
|
49
|
+
}, tailwind_variants.TVReturnTypeLike<{
|
|
50
|
+
variant: {
|
|
51
|
+
bar: {
|
|
52
|
+
root: string;
|
|
53
|
+
indicator: string;
|
|
54
|
+
};
|
|
55
|
+
ring: {
|
|
56
|
+
root: string;
|
|
57
|
+
track: string;
|
|
58
|
+
indicator: string;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
size: {
|
|
62
|
+
sm: {};
|
|
63
|
+
md: {};
|
|
64
|
+
lg: {};
|
|
65
|
+
};
|
|
66
|
+
}, {
|
|
67
|
+
root: string;
|
|
68
|
+
track: string;
|
|
69
|
+
indicator: string;
|
|
70
|
+
center: string;
|
|
71
|
+
}>>;
|
|
72
|
+
type ProgressVariants = VariantProps<typeof progress>;
|
|
73
|
+
type ProgressProps = Omit<React.ComponentProps<"div">, "children"> & ProgressVariants & {
|
|
74
|
+
/** How far, between 0 and `max`. `null` or absent: indeterminate (a wait of unknown length). */
|
|
75
|
+
value?: number | null;
|
|
76
|
+
max?: number;
|
|
77
|
+
/** The accessible name — passed translated ("Upload", "Raised towards the goal"). */
|
|
78
|
+
label: string;
|
|
79
|
+
/** The value in words for assistive technology ("$420 of $1,000") — default: the percentage. */
|
|
80
|
+
valueText?: string;
|
|
81
|
+
/** A ring's centre: an amount, a percentage, an icon. */
|
|
82
|
+
children?: React.ReactNode;
|
|
83
|
+
};
|
|
84
|
+
/** A progress bar or ring: `value` / `max`, indeterminate without a value. State: `data-state` (loading · complete · indeterminate). */
|
|
85
|
+
declare function Progress({ variant, size, value, max, label, valueText, className, children, ...props }: ProgressProps): React.JSX.Element;
|
|
86
|
+
|
|
87
|
+
export { Progress, type ProgressProps, type ProgressVariants, progress };
|