@florianke/components 0.0.2 → 0.0.6

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.
Files changed (79) hide show
  1. package/README.md +467 -31
  2. package/dist/alert-dialog.d.mts +13 -0
  3. package/dist/alert-dialog.d.mts.map +1 -0
  4. package/dist/alert-dialog.mjs +13 -0
  5. package/dist/alert-dialog.mjs.map +1 -0
  6. package/dist/avatar.mjs +2 -2
  7. package/dist/button.d.mts +1 -1
  8. package/dist/button.d.mts.map +1 -1
  9. package/dist/button.mjs +4 -3
  10. package/dist/button.mjs.map +1 -1
  11. package/dist/card.mjs +1 -1
  12. package/dist/components/alert-dialog/alert-dialog.d.mts +35 -0
  13. package/dist/components/alert-dialog/alert-dialog.d.mts.map +1 -0
  14. package/dist/components/alert-dialog/alert-dialog.mjs +50 -0
  15. package/dist/components/alert-dialog/alert-dialog.mjs.map +1 -0
  16. package/dist/components/select/select.d.mts +42 -0
  17. package/dist/components/select/select.d.mts.map +1 -0
  18. package/dist/components/select/select.mjs +102 -0
  19. package/dist/components/select/select.mjs.map +1 -0
  20. package/dist/components/toast/toast.d.mts +45 -0
  21. package/dist/components/toast/toast.d.mts.map +1 -0
  22. package/dist/components/toast/toast.mjs +156 -0
  23. package/dist/components/toast/toast.mjs.map +1 -0
  24. package/dist/components/tooltip/tooltip.d.mts +30 -0
  25. package/dist/components/tooltip/tooltip.d.mts.map +1 -0
  26. package/dist/components/tooltip/tooltip.mjs +40 -0
  27. package/dist/components/tooltip/tooltip.mjs.map +1 -0
  28. package/dist/dropdown-menu.mjs +1 -1
  29. package/dist/field.d.mts +11 -0
  30. package/dist/field.d.mts.map +1 -0
  31. package/dist/field.mjs +14 -0
  32. package/dist/field.mjs.map +1 -0
  33. package/dist/heading.d.mts +17 -0
  34. package/dist/heading.d.mts.map +1 -0
  35. package/dist/heading.mjs +20 -0
  36. package/dist/heading.mjs.map +1 -0
  37. package/dist/hint.d.mts +17 -0
  38. package/dist/hint.d.mts.map +1 -0
  39. package/dist/hint.mjs +22 -0
  40. package/dist/hint.mjs.map +1 -0
  41. package/dist/hooks/use-confirm.d.mts +23 -0
  42. package/dist/hooks/use-confirm.d.mts.map +1 -0
  43. package/dist/hooks/use-confirm.mjs +97 -0
  44. package/dist/hooks/use-confirm.mjs.map +1 -0
  45. package/dist/index.d.mts +11 -1
  46. package/dist/index.mjs +12 -2
  47. package/dist/input.d.mts +1 -0
  48. package/dist/input.d.mts.map +1 -1
  49. package/dist/input.mjs +74 -7
  50. package/dist/input.mjs.map +1 -1
  51. package/dist/label.d.mts +20 -0
  52. package/dist/label.d.mts.map +1 -0
  53. package/dist/label.mjs +19 -0
  54. package/dist/label.mjs.map +1 -0
  55. package/dist/{cn-BpvCVwZv.mjs → lib/cn.mjs} +2 -2
  56. package/dist/lib/cn.mjs.map +1 -0
  57. package/dist/providers.d.mts +12 -0
  58. package/dist/providers.d.mts.map +1 -0
  59. package/dist/providers.mjs +14 -0
  60. package/dist/providers.mjs.map +1 -0
  61. package/dist/select.d.mts +2 -38
  62. package/dist/select.d.mts.map +1 -1
  63. package/dist/select.mjs +2 -98
  64. package/dist/select.mjs.map +1 -1
  65. package/dist/text.d.mts +30 -0
  66. package/dist/text.d.mts.map +1 -0
  67. package/dist/text.mjs +37 -0
  68. package/dist/text.mjs.map +1 -0
  69. package/dist/toast.d.mts +18 -0
  70. package/dist/toast.d.mts.map +1 -0
  71. package/dist/toast.mjs +17 -0
  72. package/dist/toast.mjs.map +1 -0
  73. package/dist/tooltip.d.mts +11 -0
  74. package/dist/tooltip.d.mts.map +1 -0
  75. package/dist/tooltip.mjs +11 -0
  76. package/dist/tooltip.mjs.map +1 -0
  77. package/package.json +41 -1
  78. package/src/styles.css +13 -1
  79. package/dist/cn-BpvCVwZv.mjs.map +0 -1
@@ -0,0 +1,40 @@
1
+ "use client";
2
+ import { cn } from "../../lib/cn.mjs";
3
+ import "react";
4
+ import { jsx } from "react/jsx-runtime";
5
+ import { Tooltip } from "@base-ui/react/tooltip";
6
+ //#region src/components/tooltip/tooltip.tsx
7
+ function TooltipProvider({ delay = 150, closeDelay = 0, ...props }) {
8
+ return /* @__PURE__ */ jsx(Tooltip.Provider, {
9
+ delay,
10
+ closeDelay,
11
+ ...props
12
+ });
13
+ }
14
+ function TooltipRoot(props) {
15
+ return /* @__PURE__ */ jsx(Tooltip.Root, { ...props });
16
+ }
17
+ function TooltipTrigger({ className, ...props }) {
18
+ return /* @__PURE__ */ jsx(Tooltip.Trigger, {
19
+ className: cn("rounded-md outline-none focus-visible:ring-2 focus-visible:ring-(--ring)/30", className),
20
+ ...props
21
+ });
22
+ }
23
+ function TooltipContent({ className, side, align = "center", sideOffset = 8, alignOffset, children, ...props }) {
24
+ return /* @__PURE__ */ jsx(Tooltip.Portal, { children: /* @__PURE__ */ jsx(Tooltip.Positioner, {
25
+ side,
26
+ align,
27
+ sideOffset,
28
+ alignOffset,
29
+ className: "z-50 outline-none",
30
+ children: /* @__PURE__ */ jsx(Tooltip.Popup, {
31
+ className: cn("relative max-w-64 origin-(--transform-origin) text-pretty rounded-md border border-(--border) bg-(--popover) px-2 py-1 text-[12px] text-(--popover-foreground) shadow-md outline-none", "transition-[transform,opacity] duration-150 ease-out", "data-starting-style:scale-90 data-starting-style:opacity-0", "data-ending-style:scale-90 data-ending-style:opacity-0", "data-instant:transition-none", className),
32
+ ...props,
33
+ children
34
+ })
35
+ }) });
36
+ }
37
+ //#endregion
38
+ export { TooltipContent, TooltipProvider, TooltipRoot, TooltipTrigger };
39
+
40
+ //# sourceMappingURL=tooltip.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tooltip.mjs","names":["BaseTooltip"],"sources":["../../../src/components/tooltip/tooltip.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Tooltip as BaseTooltip } from \"@base-ui/react/tooltip\";\nimport { cn } from \"@/lib/cn\";\n\ntype TooltipProviderProps = React.ComponentPropsWithoutRef<\n typeof BaseTooltip.Provider\n>;\n\nexport function TooltipProvider({\n delay = 150,\n closeDelay = 0,\n ...props\n}: TooltipProviderProps) {\n return (\n <BaseTooltip.Provider delay={delay} closeDelay={closeDelay} {...props} />\n );\n}\n\ntype TooltipRootProps = React.ComponentPropsWithoutRef<typeof BaseTooltip.Root>;\n\nexport function TooltipRoot(props: TooltipRootProps) {\n return <BaseTooltip.Root {...props} />;\n}\n\ntype TooltipTriggerProps = React.ComponentPropsWithoutRef<\n typeof BaseTooltip.Trigger\n>;\n\nexport function TooltipTrigger({ className, ...props }: TooltipTriggerProps) {\n return (\n <BaseTooltip.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 TooltipContentProps = React.ComponentPropsWithoutRef<\n typeof BaseTooltip.Popup\n> &\n Pick<\n React.ComponentPropsWithoutRef<typeof BaseTooltip.Positioner>,\n \"side\" | \"align\" | \"sideOffset\" | \"alignOffset\"\n >;\n\nexport function TooltipContent({\n className,\n side,\n align = \"center\",\n sideOffset = 8,\n alignOffset,\n children,\n ...props\n}: TooltipContentProps) {\n return (\n <BaseTooltip.Portal>\n <BaseTooltip.Positioner\n side={side}\n align={align}\n sideOffset={sideOffset}\n alignOffset={alignOffset}\n className=\"z-50 outline-none\"\n >\n <BaseTooltip.Popup\n className={cn(\n \"relative max-w-64 origin-(--transform-origin) text-pretty rounded-md border border-(--border) bg-(--popover) px-2 py-1 text-[12px] text-(--popover-foreground) shadow-md outline-none\",\n \"transition-[transform,opacity] duration-150 ease-out\",\n \"data-starting-style:scale-90 data-starting-style:opacity-0\",\n \"data-ending-style:scale-90 data-ending-style:opacity-0\",\n \"data-instant:transition-none\",\n className,\n )}\n {...props}\n >\n {children}\n </BaseTooltip.Popup>\n </BaseTooltip.Positioner>\n </BaseTooltip.Portal>\n );\n}\n"],"mappings":";;;;;;AAUA,SAAgB,gBAAgB,EAC9B,QAAQ,KACR,aAAa,GACb,GAAG,SACoB;AACvB,QACE,oBAACA,QAAY,UAAb;EAA6B;EAAmB;EAAY,GAAI;EAAS,CAAA;;AAM7E,SAAgB,YAAY,OAAyB;AACnD,QAAO,oBAACA,QAAY,MAAb,EAAkB,GAAI,OAAS,CAAA;;AAOxC,SAAgB,eAAe,EAAE,WAAW,GAAG,SAA8B;AAC3E,QACE,oBAACA,QAAY,SAAb;EACE,WAAW,GACT,+EACA,UACD;EACD,GAAI;EACJ,CAAA;;AAYN,SAAgB,eAAe,EAC7B,WACA,MACA,QAAQ,UACR,aAAa,GACb,aACA,UACA,GAAG,SACmB;AACtB,QACE,oBAACA,QAAY,QAAb,EAAA,UACE,oBAACA,QAAY,YAAb;EACQ;EACC;EACK;EACC;EACb,WAAU;YAEV,oBAACA,QAAY,OAAb;GACE,WAAW,GACT,yLACA,wDACA,8DACA,0DACA,gCACA,UACD;GACD,GAAI;GAEH;GACiB,CAAA;EACG,CAAA,EACN,CAAA"}
@@ -1,4 +1,4 @@
1
- import { t as cn } from "./cn-BpvCVwZv.mjs";
1
+ import { cn } from "./lib/cn.mjs";
2
2
  import "react";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  import { Menu } from "@base-ui/react/menu";
@@ -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 { cn } from "./lib/cn.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"}
@@ -0,0 +1,20 @@
1
+ import { cn } from "./lib/cn.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"}
@@ -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 { cn } from "./lib/cn.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\";\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
@@ -9,6 +9,7 @@ type InputProps = Omit<React.ComponentPropsWithoutRef<typeof Input$1>, "size"> &
9
9
  declare function Input({
10
10
  className,
11
11
  size,
12
+ type,
12
13
  ...props
13
14
  }: InputProps): React.JSX.Element;
14
15
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"input.d.mts","names":[],"sources":["../src/components/input/input.tsx"],"mappings":";;;;KAIK,SAAA;AAAA,KAEA,UAAA,GAAa,IAAA,CAChB,KAAA,CAAM,wBAAA,QAAgC,OAAA;EAGtC,IAAA,GAAO,SAAA;AAAA;AAAA,iBAQO,KAAA,CAAA;EAAQ,SAAA;EAAW,IAAA;EAAA,GAAgB;AAAA,GAAS,UAAA,GAAU,KAAA,CAAA,GAAA,CAAA,OAAA"}
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
- import { t as cn } from "./cn-BpvCVwZv.mjs";
2
- import "react";
3
- import { jsx } from "react/jsx-runtime";
1
+ "use client";
2
+ import { cn } from "./lib/cn.mjs";
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 px-1.5 text-[12px]",
8
- md: "h-8 rounded-md px-2 text-[14px]"
8
+ sm: "h-7 rounded-md text-[12px]",
9
+ md: "h-8 rounded-md text-[14px]"
9
10
  };
10
- function Input({ className, size = "md", ...props }) {
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
- 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", "disabled:pointer-events-none disabled:opacity-50", "any-pointer-coarse:text-base", sizes[size], className),
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
 
@@ -1 +1 @@
1
- {"version":3,"file":"input.mjs","names":["BaseInput"],"sources":["../src/components/input/input.tsx"],"sourcesContent":["import * 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 px-1.5 text-[12px]\",\n md: \"h-8 rounded-md px-2 text-[14px]\",\n};\n\nexport function Input({ className, size = \"md\", ...props }: InputProps) {\n return (\n <BaseInput\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 \"disabled:pointer-events-none disabled:opacity-50\",\n \"any-pointer-coarse:text-base\",\n sizes[size],\n className,\n )}\n {...props}\n />\n );\n}\n"],"mappings":";;;;;AAaA,MAAM,QAAmC;CACvC,IAAI;CACJ,IAAI;CACL;AAED,SAAgB,MAAM,EAAE,WAAW,OAAO,MAAM,GAAG,SAAqB;AACtE,QACE,oBAACA,SAAD;EACE,WAAW,GACT,uEACA,yCACA,0DACA,sFACA,6BACA,yFACA,oDACA,gCACA,MAAM,OACN,UACD;EACD,GAAI;EACJ,CAAA"}
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"}
@@ -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 { cn } from "./lib/cn.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"}
@@ -5,6 +5,6 @@ function cn(...inputs) {
5
5
  return twMerge(clsx(inputs));
6
6
  }
7
7
  //#endregion
8
- export { cn as t };
8
+ export { cn };
9
9
 
10
- //# sourceMappingURL=cn-BpvCVwZv.mjs.map
10
+ //# sourceMappingURL=cn.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cn.mjs","names":[],"sources":["../../src/lib/cn.ts"],"sourcesContent":["import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n"],"mappings":";;;AAGA,SAAgB,GAAG,GAAG,QAAsB;AAC1C,QAAO,QAAQ,KAAK,OAAO,CAAC"}
@@ -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\";\nimport { Tooltip } from \"../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"}