@florianke/components 0.0.2 → 0.0.3
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 +1 -1
- package/dist/alert-dialog.d.mts +42 -0
- package/dist/alert-dialog.d.mts.map +1 -0
- package/dist/alert-dialog.mjs +57 -0
- package/dist/alert-dialog.mjs.map +1 -0
- package/dist/avatar.mjs +1 -1
- package/dist/button.d.mts +1 -1
- package/dist/button.d.mts.map +1 -1
- package/dist/button.mjs +3 -2
- package/dist/button.mjs.map +1 -1
- package/dist/field.d.mts +11 -0
- package/dist/field.d.mts.map +1 -0
- package/dist/field.mjs +14 -0
- package/dist/field.mjs.map +1 -0
- package/dist/heading.d.mts +17 -0
- package/dist/heading.d.mts.map +1 -0
- package/dist/heading.mjs +20 -0
- package/dist/heading.mjs.map +1 -0
- package/dist/hint.d.mts +17 -0
- package/dist/hint.d.mts.map +1 -0
- package/dist/hint.mjs +22 -0
- package/dist/hint.mjs.map +1 -0
- package/dist/hooks/use-confirm.d.mts +23 -0
- package/dist/hooks/use-confirm.d.mts.map +1 -0
- package/dist/hooks/use-confirm.mjs +97 -0
- package/dist/hooks/use-confirm.mjs.map +1 -0
- package/dist/index.d.mts +11 -1
- package/dist/index.mjs +12 -2
- package/dist/input.d.mts +1 -0
- package/dist/input.d.mts.map +1 -1
- package/dist/input.mjs +73 -6
- package/dist/input.mjs.map +1 -1
- package/dist/label.d.mts +20 -0
- package/dist/label.d.mts.map +1 -0
- package/dist/label.mjs +19 -0
- package/dist/label.mjs.map +1 -0
- package/dist/providers.d.mts +12 -0
- package/dist/providers.d.mts.map +1 -0
- package/dist/providers.mjs +14 -0
- package/dist/providers.mjs.map +1 -0
- package/dist/text.d.mts +30 -0
- package/dist/text.d.mts.map +1 -0
- package/dist/text.mjs +37 -0
- package/dist/text.mjs.map +1 -0
- package/dist/toast.d.mts +56 -0
- package/dist/toast.d.mts.map +1 -0
- package/dist/toast.mjs +166 -0
- package/dist/toast.mjs.map +1 -0
- package/dist/tooltip.d.mts +35 -0
- package/dist/tooltip.d.mts.map +1 -0
- package/dist/tooltip.mjs +45 -0
- package/dist/tooltip.mjs.map +1 -0
- package/package.json +1 -1
- package/src/styles.css +13 -1
package/README.md
CHANGED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { AlertDialog as AlertDialog$1 } from "@base-ui/react/alert-dialog";
|
|
3
|
+
|
|
4
|
+
//#region src/components/alert-dialog/alert-dialog.d.ts
|
|
5
|
+
type AlertDialogRootProps = React.ComponentPropsWithoutRef<typeof AlertDialog$1.Root>;
|
|
6
|
+
declare function AlertDialogRoot(props: AlertDialogRootProps): React.JSX.Element;
|
|
7
|
+
type AlertDialogTriggerProps = React.ComponentPropsWithoutRef<typeof AlertDialog$1.Trigger>;
|
|
8
|
+
declare function AlertDialogTrigger({
|
|
9
|
+
className,
|
|
10
|
+
...props
|
|
11
|
+
}: AlertDialogTriggerProps): React.JSX.Element;
|
|
12
|
+
type AlertDialogContentProps = React.ComponentPropsWithoutRef<typeof AlertDialog$1.Popup>;
|
|
13
|
+
declare function AlertDialogContent({
|
|
14
|
+
className,
|
|
15
|
+
children,
|
|
16
|
+
...props
|
|
17
|
+
}: AlertDialogContentProps): React.JSX.Element;
|
|
18
|
+
type AlertDialogTitleProps = React.ComponentPropsWithoutRef<typeof AlertDialog$1.Title>;
|
|
19
|
+
declare function AlertDialogTitle({
|
|
20
|
+
className,
|
|
21
|
+
...props
|
|
22
|
+
}: AlertDialogTitleProps): React.JSX.Element;
|
|
23
|
+
type AlertDialogDescriptionProps = React.ComponentPropsWithoutRef<typeof AlertDialog$1.Description>;
|
|
24
|
+
declare function AlertDialogDescription({
|
|
25
|
+
className,
|
|
26
|
+
...props
|
|
27
|
+
}: AlertDialogDescriptionProps): React.JSX.Element;
|
|
28
|
+
type AlertDialogCloseProps = React.ComponentPropsWithoutRef<typeof AlertDialog$1.Close>;
|
|
29
|
+
declare function AlertDialogClose({
|
|
30
|
+
render,
|
|
31
|
+
...props
|
|
32
|
+
}: AlertDialogCloseProps): React.JSX.Element;
|
|
33
|
+
declare const AlertDialog: typeof AlertDialogRoot & {
|
|
34
|
+
Trigger: typeof AlertDialogTrigger;
|
|
35
|
+
Content: typeof AlertDialogContent;
|
|
36
|
+
Title: typeof AlertDialogTitle;
|
|
37
|
+
Description: typeof AlertDialogDescription;
|
|
38
|
+
Close: typeof AlertDialogClose;
|
|
39
|
+
};
|
|
40
|
+
//#endregion
|
|
41
|
+
export { AlertDialog };
|
|
42
|
+
//# sourceMappingURL=alert-dialog.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert-dialog.d.mts","names":[],"sources":["../src/components/alert-dialog/alert-dialog.tsx"],"mappings":";;;;KAQK,oBAAA,GAAuB,KAAA,CAAM,wBAAA,QACzB,aAAA,CAAgB,IAAA;AAAA,iBAGhB,eAAA,CAAgB,KAAA,EAAO,oBAAA,GAAoB,KAAA,CAAA,GAAA,CAAA,OAAA;AAAA,KAI/C,uBAAA,GAA0B,KAAA,CAAM,wBAAA,QAC5B,aAAA,CAAgB,OAAA;AAAA,iBAGhB,kBAAA,CAAA;EAAqB,SAAA;EAAA,GAAc;AAAA,GAAS,uBAAA,GAAuB,KAAA,CAAA,GAAA,CAAA,OAAA;AAAA,KAYvE,uBAAA,GAA0B,KAAA,CAAM,wBAAA,QAC5B,aAAA,CAAgB,KAAA;AAAA,iBAGhB,kBAAA,CAAA;EACP,SAAA;EACA,QAAA;EAAA,GACG;AAAA,GACF,uBAAA,GAAuB,KAAA,CAAA,GAAA,CAAA,OAAA;AAAA,KA0BrB,qBAAA,GAAwB,KAAA,CAAM,wBAAA,QAC1B,aAAA,CAAgB,KAAA;AAAA,iBAGhB,gBAAA,CAAA;EAAmB,SAAA;EAAA,GAAc;AAAA,GAAS,qBAAA,GAAqB,KAAA,CAAA,GAAA,CAAA,OAAA;AAAA,KASnE,2BAAA,GAA8B,KAAA,CAAM,wBAAA,QAChC,aAAA,CAAgB,WAAA;AAAA,iBAGhB,sBAAA,CAAA;EACP,SAAA;EAAA,GACG;AAAA,GACF,2BAAA,GAA2B,KAAA,CAAA,GAAA,CAAA,OAAA;AAAA,KAUzB,qBAAA,GAAwB,KAAA,CAAM,wBAAA,QAC1B,aAAA,CAAgB,KAAA;AAAA,iBAGhB,gBAAA,CAAA;EAAmB,MAAA;EAAA,GAAW;AAAA,GAAS,qBAAA,GAAqB,KAAA,CAAA,GAAA,CAAA,OAAA;AAAA,cASxD,WAAA,SAAW,eAAA"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as cn } from "./cn-BpvCVwZv.mjs";
|
|
3
|
+
import { Button } from "./button.mjs";
|
|
4
|
+
import { Text } from "./text.mjs";
|
|
5
|
+
import "react";
|
|
6
|
+
import { AlertDialog as AlertDialog$1 } from "@base-ui/react/alert-dialog";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/alert-dialog/alert-dialog.tsx
|
|
9
|
+
function AlertDialogRoot(props) {
|
|
10
|
+
return /* @__PURE__ */ jsx(AlertDialog$1.Root, { ...props });
|
|
11
|
+
}
|
|
12
|
+
function AlertDialogTrigger({ className, ...props }) {
|
|
13
|
+
return /* @__PURE__ */ jsx(AlertDialog$1.Trigger, {
|
|
14
|
+
className: cn("rounded-md outline-none focus-visible:ring-2 focus-visible:ring-(--ring)/30", className),
|
|
15
|
+
...props
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function AlertDialogContent({ className, children, ...props }) {
|
|
19
|
+
return /* @__PURE__ */ jsxs(AlertDialog$1.Portal, { children: [/* @__PURE__ */ jsx(AlertDialog$1.Backdrop, { className: cn("fixed inset-0 z-50 bg-black/20 transition-opacity duration-150 dark:bg-black/50", "data-starting-style:opacity-0 data-ending-style:opacity-0", "supports-[-webkit-touch-callout:none]:absolute") }), /* @__PURE__ */ jsx(AlertDialog$1.Popup, {
|
|
20
|
+
className: cn("fixed top-1/2 left-1/2 z-50 flex w-96 max-w-[calc(100vw-3rem)] -translate-x-1/2 -translate-y-1/2 flex-col gap-4 rounded-lg border border-(--border) bg-(--popover) p-4 text-(--popover-foreground) shadow-lg outline-none", "transition-[transform,opacity] duration-150 ease-out", "data-starting-style:scale-95 data-starting-style:opacity-0", "data-ending-style:scale-95 data-ending-style:opacity-0", className),
|
|
21
|
+
...props,
|
|
22
|
+
children
|
|
23
|
+
})] });
|
|
24
|
+
}
|
|
25
|
+
function AlertDialogTitle({ className, ...props }) {
|
|
26
|
+
return /* @__PURE__ */ jsx(AlertDialog$1.Title, {
|
|
27
|
+
className: cn("text-base font-semibold", className),
|
|
28
|
+
...props
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function AlertDialogDescription({ className, ...props }) {
|
|
32
|
+
return /* @__PURE__ */ jsx(AlertDialog$1.Description, {
|
|
33
|
+
render: /* @__PURE__ */ jsx(Text, {
|
|
34
|
+
as: "p",
|
|
35
|
+
size: "base"
|
|
36
|
+
}),
|
|
37
|
+
className: cn("text-(--muted-foreground)", className),
|
|
38
|
+
...props
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function AlertDialogClose({ render, ...props }) {
|
|
42
|
+
return /* @__PURE__ */ jsx(AlertDialog$1.Close, {
|
|
43
|
+
render: render ?? /* @__PURE__ */ jsx(Button, { variant: "outline" }),
|
|
44
|
+
...props
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
const AlertDialog = Object.assign(AlertDialogRoot, {
|
|
48
|
+
Trigger: AlertDialogTrigger,
|
|
49
|
+
Content: AlertDialogContent,
|
|
50
|
+
Title: AlertDialogTitle,
|
|
51
|
+
Description: AlertDialogDescription,
|
|
52
|
+
Close: AlertDialogClose
|
|
53
|
+
});
|
|
54
|
+
//#endregion
|
|
55
|
+
export { AlertDialog };
|
|
56
|
+
|
|
57
|
+
//# sourceMappingURL=alert-dialog.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert-dialog.mjs","names":["BaseAlertDialog"],"sources":["../src/components/alert-dialog/alert-dialog.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { AlertDialog as BaseAlertDialog } from \"@base-ui/react/alert-dialog\";\nimport { cn } from \"@/lib/cn\";\nimport { Button } from \"../button/button\";\nimport { Text } from \"../text/text\";\n\ntype AlertDialogRootProps = React.ComponentPropsWithoutRef<\n typeof BaseAlertDialog.Root\n>;\n\nfunction AlertDialogRoot(props: AlertDialogRootProps) {\n return <BaseAlertDialog.Root {...props} />;\n}\n\ntype AlertDialogTriggerProps = React.ComponentPropsWithoutRef<\n typeof BaseAlertDialog.Trigger\n>;\n\nfunction AlertDialogTrigger({ className, ...props }: AlertDialogTriggerProps) {\n return (\n <BaseAlertDialog.Trigger\n className={cn(\n \"rounded-md outline-none focus-visible:ring-2 focus-visible:ring-(--ring)/30\",\n className,\n )}\n {...props}\n />\n );\n}\n\ntype AlertDialogContentProps = React.ComponentPropsWithoutRef<\n typeof BaseAlertDialog.Popup\n>;\n\nfunction AlertDialogContent({\n className,\n children,\n ...props\n}: AlertDialogContentProps) {\n return (\n <BaseAlertDialog.Portal>\n <BaseAlertDialog.Backdrop\n className={cn(\n \"fixed inset-0 z-50 bg-black/20 transition-opacity duration-150 dark:bg-black/50\",\n \"data-starting-style:opacity-0 data-ending-style:opacity-0\",\n \"supports-[-webkit-touch-callout:none]:absolute\",\n )}\n />\n <BaseAlertDialog.Popup\n className={cn(\n \"fixed top-1/2 left-1/2 z-50 flex w-96 max-w-[calc(100vw-3rem)] -translate-x-1/2 -translate-y-1/2 flex-col gap-4 rounded-lg border border-(--border) bg-(--popover) p-4 text-(--popover-foreground) shadow-lg outline-none\",\n \"transition-[transform,opacity] duration-150 ease-out\",\n \"data-starting-style:scale-95 data-starting-style:opacity-0\",\n \"data-ending-style:scale-95 data-ending-style:opacity-0\",\n className,\n )}\n {...props}\n >\n {children}\n </BaseAlertDialog.Popup>\n </BaseAlertDialog.Portal>\n );\n}\n\ntype AlertDialogTitleProps = React.ComponentPropsWithoutRef<\n typeof BaseAlertDialog.Title\n>;\n\nfunction AlertDialogTitle({ className, ...props }: AlertDialogTitleProps) {\n return (\n <BaseAlertDialog.Title\n className={cn(\"text-base font-semibold\", className)}\n {...props}\n />\n );\n}\n\ntype AlertDialogDescriptionProps = React.ComponentPropsWithoutRef<\n typeof BaseAlertDialog.Description\n>;\n\nfunction AlertDialogDescription({\n className,\n ...props\n}: AlertDialogDescriptionProps) {\n return (\n <BaseAlertDialog.Description\n render={<Text as=\"p\" size=\"base\" />}\n className={cn(\"text-(--muted-foreground)\", className)}\n {...props}\n />\n );\n}\n\ntype AlertDialogCloseProps = React.ComponentPropsWithoutRef<\n typeof BaseAlertDialog.Close\n>;\n\nfunction AlertDialogClose({ render, ...props }: AlertDialogCloseProps) {\n return (\n <BaseAlertDialog.Close\n render={render ?? <Button variant=\"outline\" />}\n {...props}\n />\n );\n}\n\nexport const AlertDialog = Object.assign(AlertDialogRoot, {\n Trigger: AlertDialogTrigger,\n Content: AlertDialogContent,\n Title: AlertDialogTitle,\n Description: AlertDialogDescription,\n Close: AlertDialogClose,\n});\n"],"mappings":";;;;;;;;AAYA,SAAS,gBAAgB,OAA6B;AACpD,QAAO,oBAACA,cAAgB,MAAjB,EAAsB,GAAI,OAAS,CAAA;;AAO5C,SAAS,mBAAmB,EAAE,WAAW,GAAG,SAAkC;AAC5E,QACE,oBAACA,cAAgB,SAAjB;EACE,WAAW,GACT,+EACA,UACD;EACD,GAAI;EACJ,CAAA;;AAQN,SAAS,mBAAmB,EAC1B,WACA,UACA,GAAG,SACuB;AAC1B,QACE,qBAACA,cAAgB,QAAjB,EAAA,UAAA,CACE,oBAACA,cAAgB,UAAjB,EACE,WAAW,GACT,mFACA,6DACA,iDACD,EACD,CAAA,EACF,oBAACA,cAAgB,OAAjB;EACE,WAAW,GACT,6NACA,wDACA,8DACA,0DACA,UACD;EACD,GAAI;EAEH;EACqB,CAAA,CACD,EAAA,CAAA;;AAQ7B,SAAS,iBAAiB,EAAE,WAAW,GAAG,SAAgC;AACxE,QACE,oBAACA,cAAgB,OAAjB;EACE,WAAW,GAAG,2BAA2B,UAAU;EACnD,GAAI;EACJ,CAAA;;AAQN,SAAS,uBAAuB,EAC9B,WACA,GAAG,SAC2B;AAC9B,QACE,oBAACA,cAAgB,aAAjB;EACE,QAAQ,oBAAC,MAAD;GAAM,IAAG;GAAI,MAAK;GAAS,CAAA;EACnC,WAAW,GAAG,6BAA6B,UAAU;EACrD,GAAI;EACJ,CAAA;;AAQN,SAAS,iBAAiB,EAAE,QAAQ,GAAG,SAAgC;AACrE,QACE,oBAACA,cAAgB,OAAjB;EACE,QAAQ,UAAU,oBAAC,QAAD,EAAQ,SAAQ,WAAY,CAAA;EAC9C,GAAI;EACJ,CAAA;;AAIN,MAAa,cAAc,OAAO,OAAO,iBAAiB;CACxD,SAAS;CACT,SAAS;CACT,OAAO;CACP,aAAa;CACb,OAAO;CACR,CAAC"}
|
package/dist/avatar.mjs
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { t as cn } from "./cn-BpvCVwZv.mjs";
|
|
3
3
|
import { useInitials } from "./hooks/use-initials.mjs";
|
|
4
4
|
import "react";
|
|
5
|
-
import { Avatar as Avatar$1 } from "@base-ui/react/avatar";
|
|
6
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { Avatar as Avatar$1 } from "@base-ui/react/avatar";
|
|
7
7
|
//#region src/components/avatar/avatar.tsx
|
|
8
8
|
const rootSizes = {
|
|
9
9
|
small: "size-7",
|
package/dist/button.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
import { Button as Button$1 } from "@base-ui/react/button";
|
|
3
3
|
|
|
4
4
|
//#region src/components/button/button.d.ts
|
|
5
|
-
type ButtonVariant = "primary" | "secondary" | "outline" | "ghost" | "link";
|
|
5
|
+
type ButtonVariant = "primary" | "secondary" | "outline" | "ghost" | "link" | "destructive";
|
|
6
6
|
type ButtonSize = "sm" | "md";
|
|
7
7
|
type ButtonProps = React.ComponentPropsWithoutRef<typeof Button$1> & {
|
|
8
8
|
variant?: ButtonVariant;
|
package/dist/button.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.mts","names":[],"sources":["../src/components/button/button.tsx"],"mappings":";;;;KAIK,aAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"button.d.mts","names":[],"sources":["../src/components/button/button.tsx"],"mappings":";;;;KAIK,aAAA;AAAA,KAOA,UAAA;AAAA,KAEA,WAAA,GAAc,KAAA,CAAM,wBAAA,QAAgC,QAAA;EACvD,OAAA,GAAU,aAAA;EACV,IAAA,GAAO,UAAA;AAAA;AAAA,iBAuBO,MAAA,CAAA;EACd,SAAA;EACA,OAAA;EACA,IAAA;EAAA,GACG;AAAA,GACF,WAAA,GAAW,KAAA,CAAA,GAAA,CAAA,OAAA"}
|
package/dist/button.mjs
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { t as cn } from "./cn-BpvCVwZv.mjs";
|
|
2
2
|
import "react";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
3
|
import { Button as Button$1 } from "@base-ui/react/button";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
//#region src/components/button/button.tsx
|
|
6
6
|
const variants = {
|
|
7
7
|
primary: "bg-(--foreground) text-(--background) hover:bg-(--foreground)/85 active:bg-(--foreground)/75",
|
|
8
8
|
secondary: "bg-(--border) text-(--foreground) hover:bg-(--input-border) active:bg-(--input-border)",
|
|
9
9
|
outline: "border border-(--border) bg-transparent text-(--foreground) hover:bg-(--muted) active:bg-(--border)",
|
|
10
10
|
ghost: "text-(--foreground) hover:bg-(--muted) active:bg-(--border)",
|
|
11
|
-
link: "h-auto p-0 text-(--foreground) underline-offset-4 hover:underline"
|
|
11
|
+
link: "h-auto p-0 text-(--foreground) underline-offset-4 hover:underline",
|
|
12
|
+
destructive: "bg-(--destructive) text-white hover:bg-(--destructive)/90 active:bg-(--destructive)/80 dark:bg-(--destructive)/60"
|
|
12
13
|
};
|
|
13
14
|
const sizes = {
|
|
14
15
|
sm: "h-7 rounded-md px-3 gap-1.5 text-[12px] [&_svg]:size-3.5 [&_svg]:shrink-0",
|
package/dist/button.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.mjs","names":["BaseButton"],"sources":["../src/components/button/button.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Button as BaseButton } from \"@base-ui/react/button\";\nimport { cn } from \"@/lib/cn\";\n\ntype ButtonVariant
|
|
1
|
+
{"version":3,"file":"button.mjs","names":["BaseButton"],"sources":["../src/components/button/button.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Button as BaseButton } from \"@base-ui/react/button\";\nimport { cn } from \"@/lib/cn\";\n\ntype ButtonVariant =\n | \"primary\"\n | \"secondary\"\n | \"outline\"\n | \"ghost\"\n | \"link\"\n | \"destructive\";\ntype ButtonSize = \"sm\" | \"md\";\n\ntype ButtonProps = React.ComponentPropsWithoutRef<typeof BaseButton> & {\n variant?: ButtonVariant;\n size?: ButtonSize;\n};\n\nconst variants: Record<ButtonVariant, string> = {\n primary:\n \"bg-(--foreground) text-(--background) hover:bg-(--foreground)/85 active:bg-(--foreground)/75\",\n secondary:\n \"bg-(--border) text-(--foreground) hover:bg-(--input-border) active:bg-(--input-border)\",\n outline:\n \"border border-(--border) bg-transparent text-(--foreground) hover:bg-(--muted) active:bg-(--border)\",\n ghost:\n \"text-(--foreground) hover:bg-(--muted) active:bg-(--border)\",\n link:\n \"h-auto p-0 text-(--foreground) underline-offset-4 hover:underline\",\n destructive:\n \"bg-(--destructive) text-white hover:bg-(--destructive)/90 active:bg-(--destructive)/80 dark:bg-(--destructive)/60\",\n};\n\nconst sizes: Record<ButtonSize, string> = {\n sm: \"h-7 rounded-md px-3 gap-1.5 text-[12px] [&_svg]:size-3.5 [&_svg]:shrink-0\",\n md: \"h-8 rounded-md px-4 gap-2 text-[14px] [&_svg]:size-4 [&_svg]:shrink-0\",\n};\n\nexport function Button({\n className,\n variant = \"primary\",\n size = \"md\",\n ...props\n}: ButtonProps) {\n return (\n <BaseButton\n className={cn(\n \"inline-flex items-center justify-center font-medium transition-colors\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--ring)/30\",\n variants[variant],\n variant !== \"link\" && sizes[size],\n className,\n )}\n {...props}\n />\n );\n}\n"],"mappings":";;;;;AAkBA,MAAM,WAA0C;CAC9C,SACE;CACF,WACE;CACF,SACE;CACF,OACE;CACF,MACE;CACF,aACE;CACH;AAED,MAAM,QAAoC;CACxC,IAAI;CACJ,IAAI;CACL;AAED,SAAgB,OAAO,EACrB,WACA,UAAU,WACV,OAAO,MACP,GAAG,SACW;AACd,QACE,oBAACA,UAAD;EACE,WAAW,GACT,yEACA,oDACA,kFACA,SAAS,UACT,YAAY,UAAU,MAAM,OAC5B,UACD;EACD,GAAI;EACJ,CAAA"}
|
package/dist/field.d.mts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/components/field/field.d.ts
|
|
4
|
+
type FieldProps = React.HTMLAttributes<HTMLDivElement>;
|
|
5
|
+
declare function Field({
|
|
6
|
+
className,
|
|
7
|
+
...props
|
|
8
|
+
}: FieldProps): React.JSX.Element;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { Field };
|
|
11
|
+
//# sourceMappingURL=field.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field.d.mts","names":[],"sources":["../src/components/field/field.tsx"],"mappings":";;;KAGK,UAAA,GAAa,KAAA,CAAM,cAAA,CAAe,cAAA;AAAA,iBAEvB,KAAA,CAAA;EAAQ,SAAA;EAAA,GAAc;AAAA,GAAS,UAAA,GAAU,KAAA,CAAA,GAAA,CAAA,OAAA"}
|
package/dist/field.mjs
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { t as cn } from "./cn-BpvCVwZv.mjs";
|
|
2
|
+
import "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/field/field.tsx
|
|
5
|
+
function Field({ className, ...props }) {
|
|
6
|
+
return /* @__PURE__ */ jsx("div", {
|
|
7
|
+
className: cn("flex flex-col gap-y-1.5", className),
|
|
8
|
+
...props
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { Field };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=field.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field.mjs","names":[],"sources":["../src/components/field/field.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@/lib/cn\";\n\ntype FieldProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport function Field({ className, ...props }: FieldProps) {\n return (\n <div className={cn(\"flex flex-col gap-y-1.5\", className)} {...props} />\n );\n}\n"],"mappings":";;;;AAKA,SAAgB,MAAM,EAAE,WAAW,GAAG,SAAqB;AACzD,QACE,oBAAC,OAAD;EAAK,WAAW,GAAG,2BAA2B,UAAU;EAAE,GAAI;EAAS,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/components/heading/heading.d.ts
|
|
4
|
+
type HeadingLevel = "h1" | "h2" | "h3";
|
|
5
|
+
type HeadingProps = React.HTMLAttributes<HTMLHeadingElement> & {
|
|
6
|
+
level?: HeadingLevel;
|
|
7
|
+
ref?: React.Ref<HTMLHeadingElement>;
|
|
8
|
+
};
|
|
9
|
+
declare function Heading({
|
|
10
|
+
level,
|
|
11
|
+
className,
|
|
12
|
+
ref,
|
|
13
|
+
...props
|
|
14
|
+
}: HeadingProps): React.JSX.Element;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { Heading };
|
|
17
|
+
//# sourceMappingURL=heading.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heading.d.mts","names":[],"sources":["../src/components/heading/heading.tsx"],"mappings":";;;KAGK,YAAA;AAAA,KAQA,YAAA,GAAe,KAAA,CAAM,cAAA,CAAe,kBAAA;EACvC,KAAA,GAAQ,YAAA;EACR,GAAA,GAAM,KAAA,CAAM,GAAA,CAAI,kBAAA;AAAA;AAAA,iBAGF,OAAA,CAAA;EAAU,KAAA;EAAc,SAAA;EAAW,GAAA;EAAA,GAAQ;AAAA,GAAS,YAAA,GAAY,KAAA,CAAA,GAAA,CAAA,OAAA"}
|
package/dist/heading.mjs
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { t as cn } from "./cn-BpvCVwZv.mjs";
|
|
2
|
+
import "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/heading/heading.tsx
|
|
5
|
+
const levels = {
|
|
6
|
+
h1: "text-3xl leading-tight tracking-tight",
|
|
7
|
+
h2: "text-xl leading-snug",
|
|
8
|
+
h3: "text-sm leading-5"
|
|
9
|
+
};
|
|
10
|
+
function Heading({ level = "h1", className, ref, ...props }) {
|
|
11
|
+
return /* @__PURE__ */ jsx(level, {
|
|
12
|
+
ref,
|
|
13
|
+
className: cn("font-sans font-medium text-(--foreground)", levels[level], className),
|
|
14
|
+
...props
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { Heading };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=heading.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heading.mjs","names":["Component"],"sources":["../src/components/heading/heading.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@/lib/cn\";\n\ntype HeadingLevel = \"h1\" | \"h2\" | \"h3\";\n\nconst levels: Record<HeadingLevel, string> = {\n h1: \"text-3xl leading-tight tracking-tight\",\n h2: \"text-xl leading-snug\",\n h3: \"text-sm leading-5\",\n};\n\ntype HeadingProps = React.HTMLAttributes<HTMLHeadingElement> & {\n level?: HeadingLevel;\n ref?: React.Ref<HTMLHeadingElement>;\n};\n\nexport function Heading({ level = \"h1\", className, ref, ...props }: HeadingProps) {\n const Component = level;\n\n return (\n <Component\n ref={ref}\n className={cn(\n \"font-sans font-medium text-(--foreground)\",\n levels[level],\n className,\n )}\n {...props}\n />\n );\n}\n"],"mappings":";;;;AAKA,MAAM,SAAuC;CAC3C,IAAI;CACJ,IAAI;CACJ,IAAI;CACL;AAOD,SAAgB,QAAQ,EAAE,QAAQ,MAAM,WAAW,KAAK,GAAG,SAAuB;AAGhF,QACE,oBAACA,OAAD;EACO;EACL,WAAW,GACT,6CACA,OAAO,QACP,UACD;EACD,GAAI;EACJ,CAAA"}
|
package/dist/hint.d.mts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/components/hint/hint.d.ts
|
|
4
|
+
type HintVariant = "info" | "error";
|
|
5
|
+
type HintProps = React.ComponentPropsWithoutRef<"span"> & {
|
|
6
|
+
variant?: HintVariant;
|
|
7
|
+
ref?: React.Ref<HTMLElement>;
|
|
8
|
+
};
|
|
9
|
+
declare function Hint({
|
|
10
|
+
className,
|
|
11
|
+
variant,
|
|
12
|
+
ref,
|
|
13
|
+
...props
|
|
14
|
+
}: HintProps): React.JSX.Element;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { Hint };
|
|
17
|
+
//# sourceMappingURL=hint.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hint.d.mts","names":[],"sources":["../src/components/hint/hint.tsx"],"mappings":";;;KAIK,WAAA;AAAA,KAOA,SAAA,GAAY,KAAA,CAAM,wBAAA;EACrB,OAAA,GAAU,WAAA;EACV,GAAA,GAAM,KAAA,CAAM,GAAA,CAAI,WAAA;AAAA;AAAA,iBAGF,IAAA,CAAA;EAAO,SAAA;EAAW,OAAA;EAAkB,GAAA;EAAA,GAAQ;AAAA,GAAS,SAAA,GAAS,KAAA,CAAA,GAAA,CAAA,OAAA"}
|
package/dist/hint.mjs
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { t as cn } from "./cn-BpvCVwZv.mjs";
|
|
2
|
+
import { Text } from "./text.mjs";
|
|
3
|
+
import "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/hint/hint.tsx
|
|
6
|
+
const variants = {
|
|
7
|
+
info: "text-(--muted-foreground)",
|
|
8
|
+
error: "text-(--destructive)"
|
|
9
|
+
};
|
|
10
|
+
function Hint({ className, variant = "info", ref, ...props }) {
|
|
11
|
+
return /* @__PURE__ */ jsx(Text, {
|
|
12
|
+
as: "span",
|
|
13
|
+
size: "small",
|
|
14
|
+
ref,
|
|
15
|
+
className: cn(variants[variant], className),
|
|
16
|
+
...props
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { Hint };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=hint.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hint.mjs","names":[],"sources":["../src/components/hint/hint.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@/lib/cn\";\nimport { Text } from \"../text/text\";\n\ntype HintVariant = \"info\" | \"error\";\n\nconst variants: Record<HintVariant, string> = {\n info: \"text-(--muted-foreground)\",\n error: \"text-(--destructive)\",\n};\n\ntype HintProps = React.ComponentPropsWithoutRef<\"span\"> & {\n variant?: HintVariant;\n ref?: React.Ref<HTMLElement>;\n};\n\nexport function Hint({ className, variant = \"info\", ref, ...props }: HintProps) {\n return (\n <Text\n as=\"span\"\n size=\"small\"\n ref={ref}\n className={cn(variants[variant], className)}\n {...props}\n />\n );\n}\n"],"mappings":";;;;;AAMA,MAAM,WAAwC;CAC5C,MAAM;CACN,OAAO;CACR;AAOD,SAAgB,KAAK,EAAE,WAAW,UAAU,QAAQ,KAAK,GAAG,SAAoB;AAC9E,QACE,oBAAC,MAAD;EACE,IAAG;EACH,MAAK;EACA;EACL,WAAW,GAAG,SAAS,UAAU,UAAU;EAC3C,GAAI;EACJ,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/hooks/use-confirm.d.ts
|
|
4
|
+
type ConfirmVariant = "default" | "danger";
|
|
5
|
+
type ConfirmOptions = {
|
|
6
|
+
title?: React.ReactNode;
|
|
7
|
+
description?: React.ReactNode;
|
|
8
|
+
confirmText?: string;
|
|
9
|
+
cancelText?: string;
|
|
10
|
+
variant?: ConfirmVariant;
|
|
11
|
+
verificationText?: string;
|
|
12
|
+
verificationInstruction?: React.ReactNode;
|
|
13
|
+
};
|
|
14
|
+
type ConfirmFn = (options?: ConfirmOptions) => Promise<boolean>;
|
|
15
|
+
declare function ConfirmProvider({
|
|
16
|
+
children
|
|
17
|
+
}: {
|
|
18
|
+
children?: React.ReactNode;
|
|
19
|
+
}): React.JSX.Element;
|
|
20
|
+
declare function useConfirm(): ConfirmFn;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { ConfirmProvider, useConfirm };
|
|
23
|
+
//# sourceMappingURL=use-confirm.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-confirm.d.mts","names":[],"sources":["../../src/hooks/use-confirm.tsx"],"mappings":";;;KAQK,cAAA;AAAA,KAEA,cAAA;EACH,KAAA,GAAQ,KAAA,CAAM,SAAA;EACd,WAAA,GAAc,KAAA,CAAM,SAAA;EACpB,WAAA;EACA,UAAA;EACA,OAAA,GAAU,cAAA;EACV,gBAAA;EACA,uBAAA,GAA0B,KAAA,CAAM,SAAA;AAAA;AAAA,KAQ7B,SAAA,IAAa,OAAA,GAAU,cAAA,KAAmB,OAAA;AAAA,iBAI/B,eAAA,CAAA;EAAkB;AAAA;EAAc,QAAA,GAAW,KAAA,CAAM,SAAA;AAAA,IAAW,KAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBAiG5D,UAAA,CAAA,GAAc,SAAA"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Button } from "../button.mjs";
|
|
3
|
+
import { AlertDialog } from "../alert-dialog.mjs";
|
|
4
|
+
import { Input } from "../input.mjs";
|
|
5
|
+
import { Label } from "../label.mjs";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
//#region src/hooks/use-confirm.tsx
|
|
9
|
+
const ConfirmContext = React.createContext(null);
|
|
10
|
+
function ConfirmProvider({ children }) {
|
|
11
|
+
const [request, setRequest] = React.useState(null);
|
|
12
|
+
const [verification, setVerification] = React.useState("");
|
|
13
|
+
const resolvedRef = React.useRef(false);
|
|
14
|
+
const confirm = React.useCallback((options = {}) => {
|
|
15
|
+
return new Promise((resolve) => {
|
|
16
|
+
setVerification("");
|
|
17
|
+
setRequest({
|
|
18
|
+
options,
|
|
19
|
+
resolve
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
}, []);
|
|
23
|
+
function close(value) {
|
|
24
|
+
request?.resolve(value);
|
|
25
|
+
resolvedRef.current = true;
|
|
26
|
+
setRequest(null);
|
|
27
|
+
setVerification("");
|
|
28
|
+
}
|
|
29
|
+
function handleOpenChange(open) {
|
|
30
|
+
if (open) return;
|
|
31
|
+
if (!resolvedRef.current) request?.resolve(false);
|
|
32
|
+
resolvedRef.current = false;
|
|
33
|
+
setRequest(null);
|
|
34
|
+
setVerification("");
|
|
35
|
+
}
|
|
36
|
+
const verificationText = request?.options.verificationText;
|
|
37
|
+
const requiresVerification = !!verificationText;
|
|
38
|
+
const canConfirm = !requiresVerification || verification === verificationText;
|
|
39
|
+
return /* @__PURE__ */ jsxs(ConfirmContext.Provider, {
|
|
40
|
+
value: confirm,
|
|
41
|
+
children: [children, /* @__PURE__ */ jsx(AlertDialog, {
|
|
42
|
+
open: request !== null,
|
|
43
|
+
onOpenChange: handleOpenChange,
|
|
44
|
+
children: /* @__PURE__ */ jsxs(AlertDialog.Content, { children: [
|
|
45
|
+
/* @__PURE__ */ jsxs("div", {
|
|
46
|
+
className: "flex flex-col gap-1",
|
|
47
|
+
children: [/* @__PURE__ */ jsx(AlertDialog.Title, { children: request?.options.title ?? "Are you sure?" }), request?.options.description && /* @__PURE__ */ jsx(AlertDialog.Description, { children: request.options.description })]
|
|
48
|
+
}),
|
|
49
|
+
requiresVerification && /* @__PURE__ */ jsxs("div", {
|
|
50
|
+
className: "flex flex-col gap-1.5",
|
|
51
|
+
children: [/* @__PURE__ */ jsx(Label, {
|
|
52
|
+
size: "small",
|
|
53
|
+
htmlFor: "confirm-verification-text",
|
|
54
|
+
children: request?.options.verificationInstruction ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
55
|
+
"Type ",
|
|
56
|
+
/* @__PURE__ */ jsx("span", {
|
|
57
|
+
className: "font-semibold",
|
|
58
|
+
children: verificationText
|
|
59
|
+
}),
|
|
60
|
+
" ",
|
|
61
|
+
"to confirm."
|
|
62
|
+
] })
|
|
63
|
+
}), /* @__PURE__ */ jsx(Input, {
|
|
64
|
+
id: "confirm-verification-text",
|
|
65
|
+
autoFocus: true,
|
|
66
|
+
value: verification,
|
|
67
|
+
onValueChange: (value) => setVerification(value),
|
|
68
|
+
onKeyDown: (event) => {
|
|
69
|
+
if (event.key === "Enter" && verification === verificationText) close(true);
|
|
70
|
+
}
|
|
71
|
+
})]
|
|
72
|
+
}),
|
|
73
|
+
/* @__PURE__ */ jsxs("div", {
|
|
74
|
+
className: "flex justify-end gap-2",
|
|
75
|
+
children: [/* @__PURE__ */ jsx(AlertDialog.Close, {
|
|
76
|
+
onClick: () => close(false),
|
|
77
|
+
children: request?.options.cancelText ?? "Cancel"
|
|
78
|
+
}), /* @__PURE__ */ jsx(AlertDialog.Close, {
|
|
79
|
+
render: /* @__PURE__ */ jsx(Button, { variant: request?.options.variant === "danger" ? "destructive" : "primary" }),
|
|
80
|
+
disabled: !canConfirm,
|
|
81
|
+
onClick: () => close(true),
|
|
82
|
+
children: request?.options.confirmText ?? "Confirm"
|
|
83
|
+
})]
|
|
84
|
+
})
|
|
85
|
+
] })
|
|
86
|
+
})]
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
function useConfirm() {
|
|
90
|
+
const confirm = React.useContext(ConfirmContext);
|
|
91
|
+
if (!confirm) throw new Error("useConfirm must be used within a ConfirmProvider");
|
|
92
|
+
return confirm;
|
|
93
|
+
}
|
|
94
|
+
//#endregion
|
|
95
|
+
export { ConfirmProvider, useConfirm };
|
|
96
|
+
|
|
97
|
+
//# sourceMappingURL=use-confirm.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-confirm.mjs","names":[],"sources":["../../src/hooks/use-confirm.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { AlertDialog } from \"../components/alert-dialog/alert-dialog\";\nimport { Button } from \"../components/button/button\";\nimport { Input } from \"../components/input/input\";\nimport { Label } from \"../components/label/label\";\n\ntype ConfirmVariant = \"default\" | \"danger\";\n\ntype ConfirmOptions = {\n title?: React.ReactNode;\n description?: React.ReactNode;\n confirmText?: string;\n cancelText?: string;\n variant?: ConfirmVariant;\n verificationText?: string;\n verificationInstruction?: React.ReactNode;\n};\n\ntype ConfirmRequest = {\n options: ConfirmOptions;\n resolve: (value: boolean) => void;\n};\n\ntype ConfirmFn = (options?: ConfirmOptions) => Promise<boolean>;\n\nconst ConfirmContext = React.createContext<ConfirmFn | null>(null);\n\nexport function ConfirmProvider({ children }: { children?: React.ReactNode }) {\n const [request, setRequest] = React.useState<ConfirmRequest | null>(null);\n const [verification, setVerification] = React.useState(\"\");\n const resolvedRef = React.useRef(false);\n\n const confirm = React.useCallback<ConfirmFn>((options = {}) => {\n return new Promise<boolean>((resolve) => {\n setVerification(\"\");\n setRequest({ options, resolve });\n });\n }, []);\n\n function close(value: boolean) {\n request?.resolve(value);\n resolvedRef.current = true;\n setRequest(null);\n setVerification(\"\");\n }\n\n function handleOpenChange(open: boolean) {\n if (open) return;\n if (!resolvedRef.current) {\n request?.resolve(false);\n }\n resolvedRef.current = false;\n setRequest(null);\n setVerification(\"\");\n }\n\n const verificationText = request?.options.verificationText;\n const requiresVerification = !!verificationText;\n const canConfirm = !requiresVerification || verification === verificationText;\n\n return (\n <ConfirmContext.Provider value={confirm}>\n {children}\n <AlertDialog open={request !== null} onOpenChange={handleOpenChange}>\n <AlertDialog.Content>\n <div className=\"flex flex-col gap-1\">\n <AlertDialog.Title>\n {request?.options.title ?? \"Are you sure?\"}\n </AlertDialog.Title>\n {request?.options.description && (\n <AlertDialog.Description>\n {request.options.description}\n </AlertDialog.Description>\n )}\n </div>\n {requiresVerification && (\n <div className=\"flex flex-col gap-1.5\">\n <Label size=\"small\" htmlFor=\"confirm-verification-text\">\n {request?.options.verificationInstruction ?? (\n <>\n Type <span className=\"font-semibold\">{verificationText}</span>{\" \"}\n to confirm.\n </>\n )}\n </Label>\n <Input\n id=\"confirm-verification-text\"\n autoFocus\n value={verification}\n onValueChange={(value) => setVerification(value)}\n onKeyDown={(event) => {\n if (event.key === \"Enter\" && verification === verificationText) {\n close(true);\n }\n }}\n />\n </div>\n )}\n <div className=\"flex justify-end gap-2\">\n <AlertDialog.Close onClick={() => close(false)}>\n {request?.options.cancelText ?? \"Cancel\"}\n </AlertDialog.Close>\n <AlertDialog.Close\n render={\n <Button\n variant={\n request?.options.variant === \"danger\"\n ? \"destructive\"\n : \"primary\"\n }\n />\n }\n disabled={!canConfirm}\n onClick={() => close(true)}\n >\n {request?.options.confirmText ?? \"Confirm\"}\n </AlertDialog.Close>\n </div>\n </AlertDialog.Content>\n </AlertDialog>\n </ConfirmContext.Provider>\n );\n}\n\nexport function useConfirm(): ConfirmFn {\n const confirm = React.useContext(ConfirmContext);\n if (!confirm) {\n throw new Error(\"useConfirm must be used within a ConfirmProvider\");\n }\n return confirm;\n}\n"],"mappings":";;;;;;;;AA2BA,MAAM,iBAAiB,MAAM,cAAgC,KAAK;AAElE,SAAgB,gBAAgB,EAAE,YAA4C;CAC5E,MAAM,CAAC,SAAS,cAAc,MAAM,SAAgC,KAAK;CACzE,MAAM,CAAC,cAAc,mBAAmB,MAAM,SAAS,GAAG;CAC1D,MAAM,cAAc,MAAM,OAAO,MAAM;CAEvC,MAAM,UAAU,MAAM,aAAwB,UAAU,EAAE,KAAK;AAC7D,SAAO,IAAI,SAAkB,YAAY;AACvC,mBAAgB,GAAG;AACnB,cAAW;IAAE;IAAS;IAAS,CAAC;IAChC;IACD,EAAE,CAAC;CAEN,SAAS,MAAM,OAAgB;AAC7B,WAAS,QAAQ,MAAM;AACvB,cAAY,UAAU;AACtB,aAAW,KAAK;AAChB,kBAAgB,GAAG;;CAGrB,SAAS,iBAAiB,MAAe;AACvC,MAAI,KAAM;AACV,MAAI,CAAC,YAAY,QACf,UAAS,QAAQ,MAAM;AAEzB,cAAY,UAAU;AACtB,aAAW,KAAK;AAChB,kBAAgB,GAAG;;CAGrB,MAAM,mBAAmB,SAAS,QAAQ;CAC1C,MAAM,uBAAuB,CAAC,CAAC;CAC/B,MAAM,aAAa,CAAC,wBAAwB,iBAAiB;AAE7D,QACE,qBAAC,eAAe,UAAhB;EAAyB,OAAO;YAAhC,CACG,UACD,oBAAC,aAAD;GAAa,MAAM,YAAY;GAAM,cAAc;aACjD,qBAAC,YAAY,SAAb,EAAA,UAAA;IACE,qBAAC,OAAD;KAAK,WAAU;eAAf,CACE,oBAAC,YAAY,OAAb,EAAA,UACG,SAAS,QAAQ,SAAS,iBACT,CAAA,EACnB,SAAS,QAAQ,eAChB,oBAAC,YAAY,aAAb,EAAA,UACG,QAAQ,QAAQ,aACO,CAAA,CAExB;;IACL,wBACC,qBAAC,OAAD;KAAK,WAAU;eAAf,CACE,oBAAC,OAAD;MAAO,MAAK;MAAQ,SAAQ;gBACzB,SAAS,QAAQ,2BAChB,qBAAA,UAAA,EAAA,UAAA;OAAE;OACK,oBAAC,QAAD;QAAM,WAAU;kBAAiB;QAAwB,CAAA;OAAC;OAAI;OAElE,EAAA,CAAA;MAEC,CAAA,EACR,oBAAC,OAAD;MACE,IAAG;MACH,WAAA;MACA,OAAO;MACP,gBAAgB,UAAU,gBAAgB,MAAM;MAChD,YAAY,UAAU;AACpB,WAAI,MAAM,QAAQ,WAAW,iBAAiB,iBAC5C,OAAM,KAAK;;MAGf,CAAA,CACE;;IAER,qBAAC,OAAD;KAAK,WAAU;eAAf,CACE,oBAAC,YAAY,OAAb;MAAmB,eAAe,MAAM,MAAM;gBAC3C,SAAS,QAAQ,cAAc;MACd,CAAA,EACpB,oBAAC,YAAY,OAAb;MACE,QACE,oBAAC,QAAD,EACE,SACE,SAAS,QAAQ,YAAY,WACzB,gBACA,WAEN,CAAA;MAEJ,UAAU,CAAC;MACX,eAAe,MAAM,KAAK;gBAEzB,SAAS,QAAQ,eAAe;MACf,CAAA,CAChB;;IACc,EAAA,CAAA;GACV,CAAA,CACU;;;AAI9B,SAAgB,aAAwB;CACtC,MAAM,UAAU,MAAM,WAAW,eAAe;AAChD,KAAI,CAAC,QACH,OAAM,IAAI,MAAM,mDAAmD;AAErE,QAAO"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
|
+
import { AlertDialog } from "./alert-dialog.mjs";
|
|
1
2
|
import { Avatar } from "./avatar.mjs";
|
|
2
3
|
import { Button } from "./button.mjs";
|
|
3
4
|
import { Card } from "./card.mjs";
|
|
4
5
|
import { DropdownMenu } from "./dropdown-menu.mjs";
|
|
6
|
+
import { Field } from "./field.mjs";
|
|
7
|
+
import { Heading } from "./heading.mjs";
|
|
8
|
+
import { Hint } from "./hint.mjs";
|
|
5
9
|
import { Input } from "./input.mjs";
|
|
10
|
+
import { Label } from "./label.mjs";
|
|
11
|
+
import { Providers } from "./providers.mjs";
|
|
6
12
|
import { Select } from "./select.mjs";
|
|
13
|
+
import { Text } from "./text.mjs";
|
|
14
|
+
import { Toast } from "./toast.mjs";
|
|
15
|
+
import { Tooltip } from "./tooltip.mjs";
|
|
16
|
+
import { ConfirmProvider, useConfirm } from "./hooks/use-confirm.mjs";
|
|
7
17
|
import { useInitials } from "./hooks/use-initials.mjs";
|
|
8
|
-
export { Avatar, Button, Card, DropdownMenu, Input, Select, useInitials };
|
|
18
|
+
export { AlertDialog, Avatar, Button, Card, ConfirmProvider, DropdownMenu, Field, Heading, Hint, Input, Label, Providers, Select, Text, Toast, Tooltip, useConfirm, useInitials };
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
|
+
import { Button } from "./button.mjs";
|
|
2
|
+
import { Text } from "./text.mjs";
|
|
3
|
+
import { AlertDialog } from "./alert-dialog.mjs";
|
|
1
4
|
import { useInitials } from "./hooks/use-initials.mjs";
|
|
2
5
|
import { Avatar } from "./avatar.mjs";
|
|
3
|
-
import { Button } from "./button.mjs";
|
|
4
6
|
import { Card } from "./card.mjs";
|
|
5
7
|
import { DropdownMenu } from "./dropdown-menu.mjs";
|
|
8
|
+
import { Field } from "./field.mjs";
|
|
9
|
+
import { Heading } from "./heading.mjs";
|
|
10
|
+
import { Hint } from "./hint.mjs";
|
|
6
11
|
import { Input } from "./input.mjs";
|
|
12
|
+
import { Label } from "./label.mjs";
|
|
13
|
+
import { ConfirmProvider, useConfirm } from "./hooks/use-confirm.mjs";
|
|
14
|
+
import { Toast } from "./toast.mjs";
|
|
15
|
+
import { Tooltip } from "./tooltip.mjs";
|
|
16
|
+
import { Providers } from "./providers.mjs";
|
|
7
17
|
import { Select } from "./select.mjs";
|
|
8
|
-
export { Avatar, Button, Card, DropdownMenu, Input, Select, useInitials };
|
|
18
|
+
export { AlertDialog, Avatar, Button, Card, ConfirmProvider, DropdownMenu, Field, Heading, Hint, Input, Label, Providers, Select, Text, Toast, Tooltip, useConfirm, useInitials };
|
package/dist/input.d.mts
CHANGED
package/dist/input.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.d.mts","names":[],"sources":["../src/components/input/input.tsx"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"input.d.mts","names":[],"sources":["../src/components/input/input.tsx"],"mappings":";;;;KAMK,SAAA;AAAA,KAEA,UAAA,GAAa,IAAA,CAChB,KAAA,CAAM,wBAAA,QAAgC,OAAA;EAGtC,IAAA,GAAO,SAAA;AAAA;AAAA,iBAaO,KAAA,CAAA;EAAQ,SAAA;EAAW,IAAA;EAAa,IAAA;EAAA,GAAS;AAAA,GAAS,UAAA,GAAU,KAAA,CAAA,GAAA,CAAA,OAAA"}
|
package/dist/input.mjs
CHANGED
|
@@ -1,18 +1,85 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { t as cn } from "./cn-BpvCVwZv.mjs";
|
|
2
|
-
import "react";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
5
|
import { Input as Input$1 } from "@base-ui/react/input";
|
|
5
6
|
//#region src/components/input/input.tsx
|
|
6
7
|
const sizes = {
|
|
7
|
-
sm: "h-7 rounded-md
|
|
8
|
-
md: "h-8 rounded-md
|
|
8
|
+
sm: "h-7 rounded-md text-[12px]",
|
|
9
|
+
md: "h-8 rounded-md text-[14px]"
|
|
9
10
|
};
|
|
10
|
-
|
|
11
|
+
const paddingX = {
|
|
12
|
+
sm: "px-1.5",
|
|
13
|
+
md: "px-2"
|
|
14
|
+
};
|
|
15
|
+
function Input({ className, size = "md", type, ...props }) {
|
|
16
|
+
if (type === "password") return /* @__PURE__ */ jsx(PasswordInput, {
|
|
17
|
+
className,
|
|
18
|
+
size,
|
|
19
|
+
...props
|
|
20
|
+
});
|
|
11
21
|
return /* @__PURE__ */ jsx(Input$1, {
|
|
12
|
-
|
|
22
|
+
type,
|
|
23
|
+
className: cn("w-full min-w-0 border bg-(--input) text-(--foreground) outline-none", "placeholder:text-(--muted-foreground)", "selection:bg-(--ring)/30 selection:text-(--foreground)", "border-(--input-border) transition-[border-color,box-shadow] duration-150 ease-out", "hover:bg-(--foreground)/4", "focus-visible:border-(--ring) focus-visible:ring-[3px] focus-visible:ring-(--ring)/20", "aria-invalid:border-(--destructive) aria-invalid:ring-[3px] aria-invalid:ring-(--destructive)/20", "aria-invalid:focus-visible:border-(--destructive) aria-invalid:focus-visible:ring-(--destructive)/20", "disabled:pointer-events-none disabled:opacity-50", "any-pointer-coarse:text-base", sizes[size], paddingX[size], className),
|
|
13
24
|
...props
|
|
14
25
|
});
|
|
15
26
|
}
|
|
27
|
+
function PasswordInput({ className, size = "md", disabled, ...props }) {
|
|
28
|
+
const [visible, setVisible] = React.useState(false);
|
|
29
|
+
const ariaInvalid = props["aria-invalid"];
|
|
30
|
+
const invalid = ariaInvalid === true || ariaInvalid === "true";
|
|
31
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
32
|
+
className: cn("flex w-full min-w-0 items-stretch border bg-(--input) text-(--foreground)", "border-(--input-border) transition-[border-color,box-shadow] duration-150 ease-out", "hover:bg-(--foreground)/4", "focus-within:border-(--ring) focus-within:ring-[3px] focus-within:ring-(--ring)/20", invalid && "border-(--destructive) ring-[3px] ring-(--destructive)/20", invalid && "focus-within:border-(--destructive) focus-within:ring-(--destructive)/20", disabled && "pointer-events-none opacity-50", sizes[size], className),
|
|
33
|
+
children: [/* @__PURE__ */ jsx(Input$1, {
|
|
34
|
+
type: visible ? "text" : "password",
|
|
35
|
+
disabled,
|
|
36
|
+
className: cn("min-w-0 flex-1 border-0 bg-transparent text-inherit outline-none", "placeholder:text-(--muted-foreground)", "selection:bg-(--ring)/30 selection:text-(--foreground)", "any-pointer-coarse:text-base", paddingX[size]),
|
|
37
|
+
...props
|
|
38
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
39
|
+
type: "button",
|
|
40
|
+
onClick: () => setVisible((current) => !current),
|
|
41
|
+
disabled,
|
|
42
|
+
"aria-label": visible ? "Passwort verbergen" : "Passwort anzeigen",
|
|
43
|
+
"aria-pressed": visible,
|
|
44
|
+
className: cn("flex shrink-0 items-center justify-center border-l border-(--input-border) text-(--muted-foreground) outline-none transition-colors duration-150 ease-out", "hover:bg-(--foreground)/4 hover:text-(--foreground)", "focus-visible:bg-(--foreground)/4 focus-visible:text-(--foreground)", "disabled:pointer-events-none", paddingX[size]),
|
|
45
|
+
children: visible ? /* @__PURE__ */ jsx(EyeOffIcon, { className: "size-4" }) : /* @__PURE__ */ jsx(EyeIcon, { className: "size-4" })
|
|
46
|
+
})]
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function EyeIcon(props) {
|
|
50
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
51
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
52
|
+
viewBox: "0 0 24 24",
|
|
53
|
+
fill: "none",
|
|
54
|
+
stroke: "currentColor",
|
|
55
|
+
strokeWidth: "2",
|
|
56
|
+
strokeLinecap: "round",
|
|
57
|
+
strokeLinejoin: "round",
|
|
58
|
+
...props,
|
|
59
|
+
children: [/* @__PURE__ */ jsx("path", { d: "M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7Z" }), /* @__PURE__ */ jsx("circle", {
|
|
60
|
+
cx: "12",
|
|
61
|
+
cy: "12",
|
|
62
|
+
r: "3"
|
|
63
|
+
})]
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function EyeOffIcon(props) {
|
|
67
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
68
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
69
|
+
viewBox: "0 0 24 24",
|
|
70
|
+
fill: "none",
|
|
71
|
+
stroke: "currentColor",
|
|
72
|
+
strokeWidth: "2",
|
|
73
|
+
strokeLinecap: "round",
|
|
74
|
+
strokeLinejoin: "round",
|
|
75
|
+
...props,
|
|
76
|
+
children: [
|
|
77
|
+
/* @__PURE__ */ jsx("path", { d: "M9.9 5.1A9.4 9.4 0 0 1 12 5c6.5 0 10 7 10 7a16.8 16.8 0 0 1-3.1 4.1M6.2 6.2C3.7 7.9 2 12 2 12s3.5 7 10 7a9.7 9.7 0 0 0 5-1.4" }),
|
|
78
|
+
/* @__PURE__ */ jsx("path", { d: "M14.1 14.1a3 3 0 1 1-4.2-4.2" }),
|
|
79
|
+
/* @__PURE__ */ jsx("path", { d: "M2 2l20 20" })
|
|
80
|
+
]
|
|
81
|
+
});
|
|
82
|
+
}
|
|
16
83
|
//#endregion
|
|
17
84
|
export { Input };
|
|
18
85
|
|