@florianke/components 0.0.1 → 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 +396 -0
- 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/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
|
|
package/dist/input.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.mjs","names":["BaseInput"],"sources":["../src/components/input/input.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"input.mjs","names":["BaseInput"],"sources":["../src/components/input/input.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Input as BaseInput } from \"@base-ui/react/input\";\nimport { cn } from \"@/lib/cn\";\n\ntype InputSize = \"sm\" | \"md\";\n\ntype InputProps = Omit<\n React.ComponentPropsWithoutRef<typeof BaseInput>,\n \"size\"\n> & {\n size?: InputSize;\n};\n\nconst sizes: Record<InputSize, string> = {\n sm: \"h-7 rounded-md text-[12px]\",\n md: \"h-8 rounded-md text-[14px]\",\n};\n\nconst paddingX: Record<InputSize, string> = {\n sm: \"px-1.5\",\n md: \"px-2\",\n};\n\nexport function Input({ className, size = \"md\", type, ...props }: InputProps) {\n if (type === \"password\") {\n return <PasswordInput className={className} size={size} {...props} />;\n }\n\n return (\n <BaseInput\n type={type}\n className={cn(\n \"w-full min-w-0 border bg-(--input) text-(--foreground) outline-none\",\n \"placeholder:text-(--muted-foreground)\",\n \"selection:bg-(--ring)/30 selection:text-(--foreground)\",\n \"border-(--input-border) transition-[border-color,box-shadow] duration-150 ease-out\",\n \"hover:bg-(--foreground)/4\",\n \"focus-visible:border-(--ring) focus-visible:ring-[3px] focus-visible:ring-(--ring)/20\",\n \"aria-invalid:border-(--destructive) aria-invalid:ring-[3px] aria-invalid:ring-(--destructive)/20\",\n \"aria-invalid:focus-visible:border-(--destructive) aria-invalid:focus-visible:ring-(--destructive)/20\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n \"any-pointer-coarse:text-base\",\n sizes[size],\n paddingX[size],\n className,\n )}\n {...props}\n />\n );\n}\n\ntype PasswordInputProps = Omit<InputProps, \"type\">;\n\nfunction PasswordInput({\n className,\n size = \"md\",\n disabled,\n ...props\n}: PasswordInputProps) {\n const [visible, setVisible] = React.useState(false);\n const ariaInvalid = props[\"aria-invalid\"];\n const invalid = ariaInvalid === true || ariaInvalid === \"true\";\n\n return (\n <div\n className={cn(\n \"flex w-full min-w-0 items-stretch border bg-(--input) text-(--foreground)\",\n \"border-(--input-border) transition-[border-color,box-shadow] duration-150 ease-out\",\n \"hover:bg-(--foreground)/4\",\n \"focus-within:border-(--ring) focus-within:ring-[3px] focus-within:ring-(--ring)/20\",\n invalid && \"border-(--destructive) ring-[3px] ring-(--destructive)/20\",\n invalid &&\n \"focus-within:border-(--destructive) focus-within:ring-(--destructive)/20\",\n disabled && \"pointer-events-none opacity-50\",\n sizes[size],\n className,\n )}\n >\n <BaseInput\n type={visible ? \"text\" : \"password\"}\n disabled={disabled}\n className={cn(\n \"min-w-0 flex-1 border-0 bg-transparent text-inherit outline-none\",\n \"placeholder:text-(--muted-foreground)\",\n \"selection:bg-(--ring)/30 selection:text-(--foreground)\",\n \"any-pointer-coarse:text-base\",\n paddingX[size],\n )}\n {...props}\n />\n <button\n type=\"button\"\n onClick={() => setVisible((current) => !current)}\n disabled={disabled}\n aria-label={visible ? \"Passwort verbergen\" : \"Passwort anzeigen\"}\n aria-pressed={visible}\n className={cn(\n \"flex shrink-0 items-center justify-center border-l border-(--input-border) text-(--muted-foreground) outline-none transition-colors duration-150 ease-out\",\n \"hover:bg-(--foreground)/4 hover:text-(--foreground)\",\n \"focus-visible:bg-(--foreground)/4 focus-visible:text-(--foreground)\",\n \"disabled:pointer-events-none\",\n paddingX[size],\n )}\n >\n {visible ? (\n <EyeOffIcon className=\"size-4\" />\n ) : (\n <EyeIcon className=\"size-4\" />\n )}\n </button>\n </div>\n );\n}\n\nfunction EyeIcon(props: React.ComponentProps<\"svg\">) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n {...props}\n >\n <path d=\"M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7Z\" />\n <circle cx=\"12\" cy=\"12\" r=\"3\" />\n </svg>\n );\n}\n\nfunction EyeOffIcon(props: React.ComponentProps<\"svg\">) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n {...props}\n >\n <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\" />\n <path d=\"M14.1 14.1a3 3 0 1 1-4.2-4.2\" />\n <path d=\"M2 2l20 20\" />\n </svg>\n );\n}\n"],"mappings":";;;;;;AAeA,MAAM,QAAmC;CACvC,IAAI;CACJ,IAAI;CACL;AAED,MAAM,WAAsC;CAC1C,IAAI;CACJ,IAAI;CACL;AAED,SAAgB,MAAM,EAAE,WAAW,OAAO,MAAM,MAAM,GAAG,SAAqB;AAC5E,KAAI,SAAS,WACX,QAAO,oBAAC,eAAD;EAA0B;EAAiB;EAAM,GAAI;EAAS,CAAA;AAGvE,QACE,oBAACA,SAAD;EACQ;EACN,WAAW,GACT,uEACA,yCACA,0DACA,sFACA,6BACA,yFACA,oGACA,wGACA,oDACA,gCACA,MAAM,OACN,SAAS,OACT,UACD;EACD,GAAI;EACJ,CAAA;;AAMN,SAAS,cAAc,EACrB,WACA,OAAO,MACP,UACA,GAAG,SACkB;CACrB,MAAM,CAAC,SAAS,cAAc,MAAM,SAAS,MAAM;CACnD,MAAM,cAAc,MAAM;CAC1B,MAAM,UAAU,gBAAgB,QAAQ,gBAAgB;AAExD,QACE,qBAAC,OAAD;EACE,WAAW,GACT,6EACA,sFACA,6BACA,sFACA,WAAW,6DACX,WACE,4EACF,YAAY,kCACZ,MAAM,OACN,UACD;YAZH,CAcE,oBAACA,SAAD;GACE,MAAM,UAAU,SAAS;GACf;GACV,WAAW,GACT,oEACA,yCACA,0DACA,gCACA,SAAS,MACV;GACD,GAAI;GACJ,CAAA,EACF,oBAAC,UAAD;GACE,MAAK;GACL,eAAe,YAAY,YAAY,CAAC,QAAQ;GACtC;GACV,cAAY,UAAU,uBAAuB;GAC7C,gBAAc;GACd,WAAW,GACT,6JACA,uDACA,uEACA,gCACA,SAAS,MACV;aAEA,UACC,oBAAC,YAAD,EAAY,WAAU,UAAW,CAAA,GAEjC,oBAAC,SAAD,EAAS,WAAU,UAAW,CAAA;GAEzB,CAAA,CACL;;;AAIV,SAAS,QAAQ,OAAoC;AACnD,QACE,qBAAC,OAAD;EACE,OAAM;EACN,SAAQ;EACR,MAAK;EACL,QAAO;EACP,aAAY;EACZ,eAAc;EACd,gBAAe;EACf,GAAI;YARN,CAUE,oBAAC,QAAD,EAAM,GAAE,oDAAqD,CAAA,EAC7D,oBAAC,UAAD;GAAQ,IAAG;GAAK,IAAG;GAAK,GAAE;GAAM,CAAA,CAC5B;;;AAIV,SAAS,WAAW,OAAoC;AACtD,QACE,qBAAC,OAAD;EACE,OAAM;EACN,SAAQ;EACR,MAAK;EACL,QAAO;EACP,aAAY;EACZ,eAAc;EACd,gBAAe;EACf,GAAI;YARN;GAUE,oBAAC,QAAD,EAAM,GAAE,gIAAiI,CAAA;GACzI,oBAAC,QAAD,EAAM,GAAE,gCAAiC,CAAA;GACzC,oBAAC,QAAD,EAAM,GAAE,cAAe,CAAA;GACnB"}
|
package/dist/label.d.mts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/components/label/label.d.ts
|
|
4
|
+
type LabelSize = "small" | "base" | "large";
|
|
5
|
+
type LabelWeight = "regular" | "plus";
|
|
6
|
+
type LabelProps = React.LabelHTMLAttributes<HTMLLabelElement> & {
|
|
7
|
+
size?: LabelSize;
|
|
8
|
+
weight?: LabelWeight;
|
|
9
|
+
ref?: React.Ref<HTMLLabelElement>;
|
|
10
|
+
};
|
|
11
|
+
declare function Label({
|
|
12
|
+
className,
|
|
13
|
+
size,
|
|
14
|
+
weight,
|
|
15
|
+
ref,
|
|
16
|
+
...props
|
|
17
|
+
}: LabelProps): React.JSX.Element;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { Label };
|
|
20
|
+
//# sourceMappingURL=label.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"label.d.mts","names":[],"sources":["../src/components/label/label.tsx"],"mappings":";;;KAIK,SAAA;AAAA,KACA,WAAA;AAAA,KAEA,UAAA,GAAa,KAAA,CAAM,mBAAA,CAAoB,gBAAA;EAC1C,IAAA,GAAO,SAAA;EACP,MAAA,GAAS,WAAA;EACT,GAAA,GAAM,KAAA,CAAM,GAAA,CAAI,gBAAA;AAAA;AAAA,iBAGF,KAAA,CAAA;EACd,SAAA;EACA,IAAA;EACA,MAAA;EACA,GAAA;EAAA,GACG;AAAA,GACF,UAAA,GAAU,KAAA,CAAA,GAAA,CAAA,OAAA"}
|
package/dist/label.mjs
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
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/label/label.tsx
|
|
6
|
+
function Label({ className, size = "base", weight = "plus", ref, ...props }) {
|
|
7
|
+
return /* @__PURE__ */ jsx(Text, {
|
|
8
|
+
as: "label",
|
|
9
|
+
size,
|
|
10
|
+
weight,
|
|
11
|
+
ref,
|
|
12
|
+
className: cn("text-(--foreground)", className),
|
|
13
|
+
...props
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { Label };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=label.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"label.mjs","names":[],"sources":["../src/components/label/label.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@/lib/cn\";\nimport { Text } from \"../text/text\";\n\ntype LabelSize = \"small\" | \"base\" | \"large\";\ntype LabelWeight = \"regular\" | \"plus\";\n\ntype LabelProps = React.LabelHTMLAttributes<HTMLLabelElement> & {\n size?: LabelSize;\n weight?: LabelWeight;\n ref?: React.Ref<HTMLLabelElement>;\n};\n\nexport function Label({\n className,\n size = \"base\",\n weight = \"plus\",\n ref,\n ...props\n}: LabelProps) {\n return (\n <Text\n as=\"label\"\n size={size}\n weight={weight}\n ref={ref as React.Ref<HTMLElement>}\n className={cn(\"text-(--foreground)\", className)}\n {...props}\n />\n );\n}\n"],"mappings":";;;;;AAaA,SAAgB,MAAM,EACpB,WACA,OAAO,QACP,SAAS,QACT,KACA,GAAG,SACU;AACb,QACE,oBAAC,MAAD;EACE,IAAG;EACG;EACE;EACH;EACL,WAAW,GAAG,uBAAuB,UAAU;EAC/C,GAAI;EACJ,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/components/providers/providers.d.ts
|
|
4
|
+
type ProvidersProps = {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
};
|
|
7
|
+
declare function Providers({
|
|
8
|
+
children
|
|
9
|
+
}: ProvidersProps): React.JSX.Element;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { Providers };
|
|
12
|
+
//# sourceMappingURL=providers.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providers.d.mts","names":[],"sources":["../src/components/providers/providers.tsx"],"mappings":";;;KAOK,cAAA;EACH,QAAA,GAAW,KAAA,CAAM,SAAA;AAAA;AAAA,iBAGH,SAAA,CAAA;EAAY;AAAA,GAAY,cAAA,GAAc,KAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { ConfirmProvider } from "./hooks/use-confirm.mjs";
|
|
3
|
+
import { Toast } from "./toast.mjs";
|
|
4
|
+
import { Tooltip } from "./tooltip.mjs";
|
|
5
|
+
import "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/providers/providers.tsx
|
|
8
|
+
function Providers({ children }) {
|
|
9
|
+
return /* @__PURE__ */ jsx(Toast.Provider, { children: /* @__PURE__ */ jsx(Tooltip.Provider, { children: /* @__PURE__ */ jsxs(ConfirmProvider, { children: [children, /* @__PURE__ */ jsx(Toast.Viewport, { children: /* @__PURE__ */ jsx(Toast.List, {}) })] }) }) });
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { Providers };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=providers.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providers.mjs","names":[],"sources":["../src/components/providers/providers.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { ConfirmProvider } from \"../../hooks/use-confirm\";\nimport { Toast } from \"../toast/toast\";\nimport { Tooltip } from \"../tooltip/tooltip\";\n\ntype ProvidersProps = {\n children?: React.ReactNode;\n};\n\nexport function Providers({ children }: ProvidersProps) {\n return (\n <Toast.Provider>\n <Tooltip.Provider>\n <ConfirmProvider>\n {children}\n <Toast.Viewport>\n <Toast.List />\n </Toast.Viewport>\n </ConfirmProvider>\n </Tooltip.Provider>\n </Toast.Provider>\n );\n}\n"],"mappings":";;;;;;;AAWA,SAAgB,UAAU,EAAE,YAA4B;AACtD,QACE,oBAAC,MAAM,UAAP,EAAA,UACE,oBAAC,QAAQ,UAAT,EAAA,UACE,qBAAC,iBAAD,EAAA,UAAA,CACG,UACD,oBAAC,MAAM,UAAP,EAAA,UACE,oBAAC,MAAM,MAAP,EAAc,CAAA,EACC,CAAA,CACD,EAAA,CAAA,EACD,CAAA,EACJ,CAAA"}
|
package/dist/text.d.mts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/components/text/text.d.ts
|
|
4
|
+
type TextSize = "small" | "base" | "large";
|
|
5
|
+
type TextWeight = "regular" | "plus";
|
|
6
|
+
type TextFamily = "sans" | "mono";
|
|
7
|
+
type TextLeading = "normal" | "compact";
|
|
8
|
+
type TextElement = "p" | "span" | "div" | "label";
|
|
9
|
+
type TextProps = React.HTMLAttributes<HTMLElement> & {
|
|
10
|
+
as?: TextElement;
|
|
11
|
+
size?: TextSize;
|
|
12
|
+
weight?: TextWeight;
|
|
13
|
+
family?: TextFamily;
|
|
14
|
+
leading?: TextLeading;
|
|
15
|
+
htmlFor?: string;
|
|
16
|
+
ref?: React.Ref<HTMLElement>;
|
|
17
|
+
};
|
|
18
|
+
declare function Text({
|
|
19
|
+
className,
|
|
20
|
+
as: Tag,
|
|
21
|
+
size,
|
|
22
|
+
weight,
|
|
23
|
+
family,
|
|
24
|
+
leading,
|
|
25
|
+
ref,
|
|
26
|
+
...props
|
|
27
|
+
}: TextProps): React.JSX.Element;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { Text };
|
|
30
|
+
//# sourceMappingURL=text.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.d.mts","names":[],"sources":["../src/components/text/text.tsx"],"mappings":";;;KAGK,QAAA;AAAA,KACA,UAAA;AAAA,KACA,UAAA;AAAA,KACA,WAAA;AAAA,KACA,WAAA;AAAA,KA2BA,SAAA,GAAY,KAAA,CAAM,cAAA,CAAe,WAAA;EACpC,EAAA,GAAK,WAAA;EACL,IAAA,GAAO,QAAA;EACP,MAAA,GAAS,UAAA;EACT,MAAA,GAAS,UAAA;EACT,OAAA,GAAU,WAAA;EACV,OAAA;EACA,GAAA,GAAM,KAAA,CAAM,GAAA,CAAI,WAAA;AAAA;AAAA,iBAGF,IAAA,CAAA;EACd,SAAA;EACA,EAAA,EAAI,GAAA;EACJ,IAAA;EACA,MAAA;EACA,MAAA;EACA,OAAA;EACA,GAAA;EAAA,GACG;AAAA,GACF,SAAA,GAAS,KAAA,CAAA,GAAA,CAAA,OAAA"}
|
package/dist/text.mjs
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { t as cn } from "./cn-BpvCVwZv.mjs";
|
|
2
|
+
import "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/text/text.tsx
|
|
5
|
+
const sizes = {
|
|
6
|
+
small: {
|
|
7
|
+
normal: "text-[0.8125rem] leading-6",
|
|
8
|
+
compact: "text-[0.8125rem] leading-5"
|
|
9
|
+
},
|
|
10
|
+
base: {
|
|
11
|
+
normal: "text-sm leading-6",
|
|
12
|
+
compact: "text-sm leading-5"
|
|
13
|
+
},
|
|
14
|
+
large: {
|
|
15
|
+
normal: "text-base leading-7",
|
|
16
|
+
compact: "text-base leading-5"
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const weights = {
|
|
20
|
+
regular: "font-normal",
|
|
21
|
+
plus: "font-medium"
|
|
22
|
+
};
|
|
23
|
+
const families = {
|
|
24
|
+
sans: "font-sans",
|
|
25
|
+
mono: "font-mono"
|
|
26
|
+
};
|
|
27
|
+
function Text({ className, as: Tag = "p", size = "base", weight = "regular", family = "sans", leading = "normal", ref, ...props }) {
|
|
28
|
+
return /* @__PURE__ */ jsx(Tag, {
|
|
29
|
+
ref,
|
|
30
|
+
className: cn(sizes[size][leading], weights[weight], families[family], className),
|
|
31
|
+
...props
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { Text };
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=text.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.mjs","names":["Element"],"sources":["../src/components/text/text.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@/lib/cn\";\n\ntype TextSize = \"small\" | \"base\" | \"large\";\ntype TextWeight = \"regular\" | \"plus\";\ntype TextFamily = \"sans\" | \"mono\";\ntype TextLeading = \"normal\" | \"compact\";\ntype TextElement = \"p\" | \"span\" | \"div\" | \"label\";\n\nconst sizes: Record<TextSize, Record<TextLeading, string>> = {\n small: {\n normal: \"text-[0.8125rem] leading-6\",\n compact: \"text-[0.8125rem] leading-5\",\n },\n base: {\n normal: \"text-sm leading-6\",\n compact: \"text-sm leading-5\",\n },\n large: {\n normal: \"text-base leading-7\",\n compact: \"text-base leading-5\",\n },\n};\n\nconst weights: Record<TextWeight, string> = {\n regular: \"font-normal\",\n plus: \"font-medium\",\n};\n\nconst families: Record<TextFamily, string> = {\n sans: \"font-sans\",\n mono: \"font-mono\",\n};\n\ntype TextProps = React.HTMLAttributes<HTMLElement> & {\n as?: TextElement;\n size?: TextSize;\n weight?: TextWeight;\n family?: TextFamily;\n leading?: TextLeading;\n htmlFor?: string;\n ref?: React.Ref<HTMLElement>;\n};\n\nexport function Text({\n className,\n as: Tag = \"p\",\n size = \"base\",\n weight = \"regular\",\n family = \"sans\",\n leading = \"normal\",\n ref,\n ...props\n}: TextProps) {\n const Element = Tag as React.ElementType;\n\n return (\n <Element\n ref={ref}\n className={cn(\n sizes[size][leading],\n weights[weight],\n families[family],\n className,\n )}\n {...props}\n />\n );\n}\n"],"mappings":";;;;AASA,MAAM,QAAuD;CAC3D,OAAO;EACL,QAAQ;EACR,SAAS;EACV;CACD,MAAM;EACJ,QAAQ;EACR,SAAS;EACV;CACD,OAAO;EACL,QAAQ;EACR,SAAS;EACV;CACF;AAED,MAAM,UAAsC;CAC1C,SAAS;CACT,MAAM;CACP;AAED,MAAM,WAAuC;CAC3C,MAAM;CACN,MAAM;CACP;AAYD,SAAgB,KAAK,EACnB,WACA,IAAI,MAAM,KACV,OAAO,QACP,SAAS,WACT,SAAS,QACT,UAAU,UACV,KACA,GAAG,SACS;AAGZ,QACE,oBAACA,KAAD;EACO;EACL,WAAW,GACT,MAAM,MAAM,UACZ,QAAQ,SACR,SAAS,SACT,UACD;EACD,GAAI;EACJ,CAAA"}
|
package/dist/toast.d.mts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Toast as Toast$1 } from "@base-ui/react/toast";
|
|
3
|
+
|
|
4
|
+
//#region src/components/toast/toast.d.ts
|
|
5
|
+
type ToastProviderProps = React.ComponentPropsWithoutRef<typeof Toast$1.Provider>;
|
|
6
|
+
declare function ToastProvider(props: ToastProviderProps): React.JSX.Element;
|
|
7
|
+
type ToastViewportProps = React.ComponentPropsWithoutRef<typeof Toast$1.Viewport>;
|
|
8
|
+
declare function ToastViewport({
|
|
9
|
+
className,
|
|
10
|
+
...props
|
|
11
|
+
}: ToastViewportProps): React.JSX.Element;
|
|
12
|
+
type ToastRootProps = React.ComponentPropsWithoutRef<typeof Toast$1.Root>;
|
|
13
|
+
declare function ToastRoot({
|
|
14
|
+
className,
|
|
15
|
+
...props
|
|
16
|
+
}: ToastRootProps): React.JSX.Element;
|
|
17
|
+
type ToastContentProps = React.ComponentPropsWithoutRef<typeof Toast$1.Content>;
|
|
18
|
+
declare function ToastContent({
|
|
19
|
+
className,
|
|
20
|
+
...props
|
|
21
|
+
}: ToastContentProps): React.JSX.Element;
|
|
22
|
+
type ToastTitleProps = React.ComponentPropsWithoutRef<typeof Toast$1.Title>;
|
|
23
|
+
declare function ToastTitle({
|
|
24
|
+
className,
|
|
25
|
+
...props
|
|
26
|
+
}: ToastTitleProps): React.JSX.Element;
|
|
27
|
+
type ToastDescriptionProps = React.ComponentPropsWithoutRef<typeof Toast$1.Description>;
|
|
28
|
+
declare function ToastDescription({
|
|
29
|
+
className,
|
|
30
|
+
...props
|
|
31
|
+
}: ToastDescriptionProps): React.JSX.Element;
|
|
32
|
+
type ToastIconProps = React.SVGProps<SVGSVGElement> & {
|
|
33
|
+
type: string | undefined;
|
|
34
|
+
};
|
|
35
|
+
declare function ToastIcon({
|
|
36
|
+
type,
|
|
37
|
+
className,
|
|
38
|
+
...props
|
|
39
|
+
}: ToastIconProps): React.JSX.Element | null;
|
|
40
|
+
type ToastCloseProps = React.ComponentPropsWithoutRef<typeof Toast$1.Close>;
|
|
41
|
+
declare function ToastClose(props: ToastCloseProps): React.JSX.Element;
|
|
42
|
+
declare function ToastList(): React.JSX.Element[];
|
|
43
|
+
declare const Toast: typeof ToastRoot & {
|
|
44
|
+
Provider: typeof ToastProvider;
|
|
45
|
+
Viewport: typeof ToastViewport;
|
|
46
|
+
Content: typeof ToastContent;
|
|
47
|
+
Title: typeof ToastTitle;
|
|
48
|
+
Description: typeof ToastDescription;
|
|
49
|
+
Close: typeof ToastClose;
|
|
50
|
+
Icon: typeof ToastIcon;
|
|
51
|
+
List: typeof ToastList;
|
|
52
|
+
useToastManager: typeof Toast$1.useToastManager;
|
|
53
|
+
};
|
|
54
|
+
//#endregion
|
|
55
|
+
export { Toast };
|
|
56
|
+
//# sourceMappingURL=toast.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast.d.mts","names":[],"sources":["../src/components/toast/toast.tsx"],"mappings":";;;;KAQK,kBAAA,GAAqB,KAAA,CAAM,wBAAA,QACvB,OAAA,CAAU,QAAA;AAAA,iBAGV,aAAA,CAAc,KAAA,EAAO,kBAAA,GAAkB,KAAA,CAAA,GAAA,CAAA,OAAA;AAAA,KAI3C,kBAAA,GAAqB,KAAA,CAAM,wBAAA,QACvB,OAAA,CAAU,QAAA;AAAA,iBAGV,aAAA,CAAA;EAAgB,SAAA;EAAA,GAAc;AAAA,GAAS,kBAAA,GAAkB,KAAA,CAAA,GAAA,CAAA,OAAA;AAAA,KAc7D,cAAA,GAAiB,KAAA,CAAM,wBAAA,QAAgC,OAAA,CAAU,IAAA;AAAA,iBAE7D,SAAA,CAAA;EAAY,SAAA;EAAA,GAAc;AAAA,GAAS,cAAA,GAAc,KAAA,CAAA,GAAA,CAAA,OAAA;AAAA,KA6BrD,iBAAA,GAAoB,KAAA,CAAM,wBAAA,QACtB,OAAA,CAAU,OAAA;AAAA,iBAGV,YAAA,CAAA;EAAe,SAAA;EAAA,GAAc;AAAA,GAAS,iBAAA,GAAiB,KAAA,CAAA,GAAA,CAAA,OAAA;AAAA,KAa3D,eAAA,GAAkB,KAAA,CAAM,wBAAA,QAAgC,OAAA,CAAU,KAAA;AAAA,iBAE9D,UAAA,CAAA;EAAa,SAAA;EAAA,GAAc;AAAA,GAAS,eAAA,GAAe,KAAA,CAAA,GAAA,CAAA,OAAA;AAAA,KASvD,qBAAA,GAAwB,KAAA,CAAM,wBAAA,QAC1B,OAAA,CAAU,WAAA;AAAA,iBAGV,gBAAA,CAAA;EAAmB,SAAA;EAAA,GAAc;AAAA,GAAS,qBAAA,GAAqB,KAAA,CAAA,GAAA,CAAA,OAAA;AAAA,KAuFnE,cAAA,GAAiB,KAAA,CAAM,QAAA,CAAS,aAAA;EACnC,IAAA;AAAA;AAAA,iBAGO,SAAA,CAAA;EAAY,IAAA;EAAM,SAAA;EAAA,GAAc;AAAA,GAAS,cAAA,GAAc,KAAA,CAAA,GAAA,CAAA,OAAA;AAAA,KAgB3D,eAAA,GAAkB,KAAA,CAAM,wBAAA,QAAgC,OAAA,CAAU,KAAA;AAAA,iBAE9D,UAAA,CAAW,KAAA,EAAO,eAAA,GAAe,KAAA,CAAA,GAAA,CAAA,OAAA;AAAA,iBASjC,SAAA,CAAA,GAAS,KAAA,CAAA,GAAA,CAAA,OAAA;AAAA,cAiBL,KAAA,SAAK,SAAA"}
|