@jp-poc/xyx
Version:
Szum-Tech design system with tailwindcss support
909 lines (903 loc) • 34.6 kB
JavaScript
'use strict';
var chunkH2BWO3SI_cjs = require('./chunk-H2BWO3SI.cjs');
var chunkTSN5DAKH_cjs = require('./chunk-TSN5DAKH.cjs');
var radixUi = require('radix-ui');
var classVarianceAuthority = require('class-variance-authority');
var jsxRuntime = require('react/jsx-runtime');
var React = require('react');
var reactSlot = require('@radix-ui/react-slot');
var reactIcons = require('@radix-ui/react-icons');
var tailwindMerge = require('tailwind-merge');
var reactHookForm = require('react-hook-form');
function _interopNamespace(e) {
if (e && e.__esModule) return e;
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n.default = e;
return Object.freeze(n);
}
var React__namespace = /*#__PURE__*/_interopNamespace(React);
var avatarCva = classVarianceAuthority.cva("relative flex shrink-0 overflow-hidden rounded text-gray-100", {
variants: {
size: {
sm: "size-6 text-xs",
md: "size-10 text-lg",
lg: "size-14 text-2xl"
}
},
defaultVariants: {
size: "md"
}
});
function Avatar({ className, size, ref, ...props }) {
const avatarStyles = avatarCva({ size });
return /* @__PURE__ */ jsxRuntime.jsx(radixUi.Avatar.Root, { ref, className: chunkH2BWO3SI_cjs.cn(avatarStyles, className), ...props });
}
function AvatarImage({ className, ref, ...props }) {
return /* @__PURE__ */ jsxRuntime.jsx(radixUi.Avatar.Image, { ref, className: chunkH2BWO3SI_cjs.cn("aspect-square h-full w-full", className), ...props });
}
function AvatarFallback({ className, ref, ...props }) {
return /* @__PURE__ */ jsxRuntime.jsx(
radixUi.Avatar.Fallback,
{
ref,
className: chunkH2BWO3SI_cjs.cn("bg-gray-350 flex h-full w-full items-center justify-center", className),
...props
}
);
}
var buttonCva = classVarianceAuthority.cva(
[
"inline-flex cursor-pointer items-center justify-center align-middle no-underline transition-colors duration-300 ease-in-out",
"select-none appearance-none rounded-sm border font-sans font-medium tracking-[.02857em]",
"aria-disabled:pointer-events-none aria-disabled:cursor-not-allowed aria-disabled:opacity-50"
],
{
variants: {
fullWidth: {
true: "w-full"
},
color: {
neutral: "",
primary: "",
success: "",
warning: "",
error: ""
},
size: {
sm: "px-2.5 py-1 text-[.8125rem] leading-4",
md: "px-4 py-1.5 text-[0.875rem] leading-5",
lg: "px-5 py-2 text-[.9375rem] leading-6"
},
variant: {
text: "border-transparent bg-transparent",
outlined: "bg-transparent",
contained: ""
}
},
compoundVariants: [
// ---------- TEXT ---------- //
{
variant: "text",
color: "neutral",
class: [
"text-gray-100",
"hover:border-gray-350 hover:bg-gray-350 hover:text-gray-100",
"active:border-gray-400 active:bg-gray-400"
]
},
{
variant: "text",
color: "primary",
class: [
"text-primary-500",
"hover:border-primary-500 hover:bg-primary-500 hover:text-white",
"active:border-primary-600 active:bg-primary-600 active:text-white"
]
},
{
variant: "text",
color: "success",
class: [
"text-success-500",
"hover:border-success-500 hover:bg-success-500 hover:text-white",
"active:border-success-600 active:bg-success-600 active:text-white"
]
},
{
variant: "text",
color: "warning",
class: [
"text-warning-500",
"hover:border-warning-500 hover:bg-warning-500 hover:text-white",
"active:border-warning-600 active:bg-warning-600 active:text-white"
]
},
{
variant: "text",
color: "error",
class: [
"text-error-500",
"hover:border-error-500 hover:bg-error-500 hover:text-white",
"active:border-error-600 active:bg-error-600 active:text-white"
]
},
// ---------- OUTLINED ---------- //
{
variant: "outlined",
color: "neutral",
class: ["border-gray-350 text-gray-100", "hover:bg-gray-350", "active:bg-gray-400"]
},
{
variant: "outlined",
color: "primary",
class: [
"text-primary-500 border-primary-500",
"hover:bg-primary-500 hover:text-white",
"active:bg-primary-600 active:text-white"
]
},
{
variant: "outlined",
color: "success",
class: [
"text-success-500 border-success-500",
"hover:bg-success-500 hover:text-white",
"active:bg-success-600 active:text-white"
]
},
{
variant: "outlined",
color: "warning",
class: [
"text-warning-500 border-warning-500",
"hover:bg-warning-500 hover:text-white",
"active:bg-warning-600 active:text-white"
]
},
{
variant: "outlined",
color: "error",
class: [
"text-error-500 border-error-500",
"hover:bg-error-500 hover:text-white",
"active:bg-error-600 active:text-white"
]
},
// ---------- OUTLINED ---------- //
{
variant: "contained",
color: "neutral",
class: [
"border-gray-350 bg-gray-350 text-gray-100",
"hover:border-gray-300 hover:bg-gray-300",
"active:border-gray-400 active:bg-gray-400"
]
},
{
variant: "contained",
color: "primary",
class: [
"border-primary-500 bg-primary-500 text-white",
"hover:border-primary-400 hover:bg-primary-400",
"active:border-primary-600 active:bg-primary-600"
]
},
{
variant: "contained",
color: "success",
class: [
"border-success-500 bg-success-500 text-white",
"hover:border-success-400 hover:bg-success-400",
"active:border-success-600 active:bg-success-600"
]
},
{
variant: "contained",
color: "warning",
class: [
"border-warning-500 bg-warning-500 text-white",
"hover:border-warning-400 hover:bg-warning-400",
"active:border-warning-600 active:bg-warning-600"
]
},
{
variant: "contained",
color: "error",
class: [
"border-error-500 bg-error-500 text-white",
"hover:border-error-400 hover:bg-error-400",
"active:border-error-600 active:bg-error-600"
]
}
],
defaultVariants: {
fullWidth: false,
color: "primary",
size: "md",
variant: "text"
}
}
);
var iconContainerCva = classVarianceAuthority.cva("", {
variants: {
site: {
left: "",
right: ""
},
size: {
sm: "",
md: "",
lg: ""
}
},
compoundVariants: [
// ---------- LEFT ---------- //
{
site: "left",
size: "sm",
class: "-ml-0.5 mr-1.5"
},
{
site: "left",
size: "md",
class: "-ml-1 mr-2"
},
{
site: "left",
size: "lg",
class: "-ml-1.5 mr-2.5"
},
// ---------- RIGHT ---------- //
{
site: "right",
size: "sm",
class: "-mr-0.5 ml-1.5"
},
{
site: "right",
size: "md",
class: "-mr-1 ml-2"
},
{
site: "right",
size: "lg",
class: "-mr-1.5 ml-2.5"
}
],
defaultVariants: {
site: "left",
size: "md"
}
});
var iconCva = classVarianceAuthority.cva("", {
variants: {
loading: {
true: "animate-spin motion-reduce:hidden"
},
size: {
sm: "h-4.5 w-4.5",
md: "size-5",
lg: "h-5.5 w-5.5"
}
},
defaultVariants: {
loading: false,
size: "md"
}
});
function Button({
asChild = false,
variant = "text",
color = "primary",
disabled = false,
fullWidth = false,
loadingPosition = "start",
ref,
...props
}) {
const {
children,
type = "button",
loading = false,
size = "md",
endIcon,
startIcon,
...rest
} = { ...props, loadingPosition };
const Comp = asChild ? reactSlot.Slot : "button";
const buttonStyles = buttonCva({ fullWidth, size, variant, color });
const isDisabled = disabled || loading;
return /* @__PURE__ */ jsxRuntime.jsx(
Comp,
{
...asChild ? props : rest,
"aria-disabled": isDisabled || void 0,
className: buttonStyles,
"data-state": loading ? "loading" : void 0,
disabled: isDisabled,
ref,
role: Comp !== "button" ? "button" : void 0,
tabIndex: isDisabled ? -1 : 0,
type: Comp === "button" ? type : void 0,
children: asChild ? /* @__PURE__ */ jsxRuntime.jsx(ButtonContent, { children }) : /* @__PURE__ */ jsxRuntime.jsx(ButtonContent, { ...props })
}
);
}
function ButtonContent({
children,
loading = false,
size = "md",
loadingPosition = "start",
startIcon,
endIcon,
...props
}) {
const isStartLoading = loading && loadingPosition === "start";
const StartIcon = isStartLoading ? /* @__PURE__ */ jsxRuntime.jsx(chunkTSN5DAKH_cjs.LoadingIcon, { "aria-label": "Loading" }) : startIcon || null;
const startIconStyles = iconCva({ size, loading: isStartLoading });
const startIconContainerStyles = iconContainerCva({ size, site: "left" });
const isEndLoading = loading && loadingPosition === "end";
const EndIcon = isEndLoading ? /* @__PURE__ */ jsxRuntime.jsx(chunkTSN5DAKH_cjs.LoadingIcon, { "aria-label": "Loading" }) : endIcon || null;
const endIconStyles = iconCva({ size, loading: isEndLoading });
const endIconContainerStyles = iconContainerCva({ size, site: "right" });
const LeadingIcon = StartIcon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: startIconContainerStyles, role: isStartLoading ? "progressbar" : void 0, children: React__namespace.cloneElement(StartIcon, { className: startIconStyles }) }) : null;
const TrailingIcon = EndIcon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: endIconContainerStyles, role: isEndLoading ? "progressbar" : void 0, children: React__namespace.cloneElement(EndIcon, { className: endIconStyles }) }) : null;
return React__namespace.isValidElement(children) ? React__namespace.cloneElement(
children,
props,
/* @__PURE__ */ jsxRuntime.jsxs(React__namespace.Fragment, { children: [
LeadingIcon,
React__namespace.isValidElement(children) ? children.props?.children : null,
TrailingIcon
] })
) : /* @__PURE__ */ jsxRuntime.jsxs(React__namespace.Fragment, { children: [
LeadingIcon,
children,
TrailingIcon
] });
}
var inputCva = classVarianceAuthority.cva(
[
"bg-app-foreground font-poppins h-10 w-full appearance-none border py-2 outline-0 transition-colors duration-300 ease-in-out",
"placeholder:select-none placeholder:text-gray-200",
"invalid:border-error-500 focus:border-primary-400 active:border-primary-400",
"disabled:border-gray-400 disabled:text-gray-200 disabled:placeholder:text-gray-300"
],
{
variants: {
invalid: {
true: ["text-error-500 border-error-500 hover:border-error-400 focus:text-gray-100"],
false: ["border-gray-350 hover:border-primary-500 text-gray-100"]
},
withStartIcon: {
true: "pl-11",
false: "pl-3"
},
withEndIcon: {
true: "pr-11",
false: "pr-3"
}
},
defaultVariants: {
invalid: false,
withStartIcon: false,
withEndIcon: false
}
}
);
var inputIconContainerCva = classVarianceAuthority.cva(
["pointer-events-none absolute inset-y-2 inline-flex w-10 place-content-center items-center text-center"],
{
variants: {
disabled: {
true: "text-gray-200"
},
site: {
right: "right-0 border-l border-l-gray-400 pr-1",
left: "left-0 border-r border-r-gray-400 pl-1"
}
},
defaultVariants: {
disabled: false
}
}
);
function Input({ invalid = false, startIcon, endIcon, disabled = false, className, ...props }) {
const inputStyles = inputCva({ withEndIcon: !!endIcon, withStartIcon: !!startIcon, invalid });
const inputIconStartContainer = inputIconContainerCva({ site: "left", disabled });
const inputIconEndContainer = inputIconContainerCva({ site: "right", disabled });
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-body-2 relative text-gray-100", children: [
startIcon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: inputIconStartContainer, children: startIcon }) : null,
/* @__PURE__ */ jsxRuntime.jsx(
"input",
{
"aria-invalid": invalid || void 0,
disabled,
className: chunkH2BWO3SI_cjs.cn(inputStyles, className),
...props
}
),
endIcon ? /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": true, className: inputIconEndContainer, children: endIcon }) : null
] });
}
function Tooltip({
defaultOpen,
content,
open,
onOpenChange,
children,
side,
align,
collisionPadding = 8,
sideOffset = 8,
...props
}) {
return /* @__PURE__ */ jsxRuntime.jsxs(radixUi.Tooltip.Root, { delayDuration: 0, open, defaultOpen, onOpenChange, children: [
/* @__PURE__ */ jsxRuntime.jsx(radixUi.Tooltip.Trigger, { asChild: true, children }),
content ? /* @__PURE__ */ jsxRuntime.jsx(radixUi.Tooltip.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
radixUi.Tooltip.Content,
{
className: "text-body-1 data-[state=delayed-open]:data-[side=bottom]:animate-slideUpAndFade data-[state=delayed-open]:data-[side=left]:animate-slideRightAndFade data-[state=delayed-open]:data-[side=right]:animate-slideLeftAndFade data-[state=delayed-open]:data-[side=top]:animate-slideDownAndFade rounded bg-white p-2 text-gray-100 will-change-[transform,opacity] select-none",
sideOffset,
side,
align,
collisionPadding,
...props,
children: [
content,
/* @__PURE__ */ jsxRuntime.jsx(radixUi.Tooltip.Arrow, { width: 8, height: 4, className: "fill-white" })
]
}
) }) : null
] });
}
function TooltipProvider({ children }) {
return /* @__PURE__ */ jsxRuntime.jsx(radixUi.Tooltip.Provider, { skipDelayDuration: 500, children });
}
var textareaCva = classVarianceAuthority.cva(
[
"bg-app-primary font-poppins text-body-2 h-28 min-h-10 w-full appearance-none border px-3 py-2 outline-0 transition-colors duration-300 ease-in-out placeholder:select-none placeholder:text-gray-200",
"focus:border-primary-400",
"active:border-primary-400",
"disabled:border-gray-400 disabled:text-gray-200 disabled:placeholder:text-gray-300"
],
{
variants: {
invalid: {
true: ["text-error-500 border-error-500", "hover:border-error-400", "focus:text-gray-100"],
false: ["border-gray-350 text-gray-100", "hover:border-primary-500"]
}
},
defaultVariants: {
invalid: false
}
}
);
function Textarea({ invalid = false, ...props }) {
const textareaStyles = textareaCva({ invalid });
return /* @__PURE__ */ jsxRuntime.jsx("textarea", { "aria-invalid": invalid || void 0, className: textareaStyles, ...props });
}
var selectCva = classVarianceAuthority.cva(
[
"bg-app-foreground text-body-2 inline-flex h-10 w-full appearance-none items-center justify-between gap-2 border px-3 py-2 text-gray-100 outline-0 transition-colors duration-300 ease-in-out",
"placeholder:select-none placeholder:text-gray-200",
"invalid:border-error-500 focus:border-primary-400 active:border-primary-400",
"disabled:border-gray-400 disabled:text-gray-200 disabled:placeholder:text-gray-300"
],
{
variants: {
invalid: {
true: ["text-error-500 border-error-500 hover:border-error-400 focus:text-gray-100"],
false: ["border-gray-350 hover:border-primary-500 text-gray-100"]
}
},
defaultVariants: {
invalid: false
}
}
);
function Select({ children, placeholder, invalid = false, ref, ...props }) {
const selectStyles = selectCva({ invalid });
return /* @__PURE__ */ jsxRuntime.jsxs(radixUi.Select.Root, { ...props, children: [
/* @__PURE__ */ jsxRuntime.jsxs(radixUi.Select.Trigger, { className: selectStyles, ref, children: [
/* @__PURE__ */ jsxRuntime.jsx(radixUi.Select.Value, { placeholder }),
/* @__PURE__ */ jsxRuntime.jsx(radixUi.Select.Icon, { className: "-mr-1.5", children: /* @__PURE__ */ jsxRuntime.jsx(reactIcons.CaretSortIcon, { className: "size-5 text-gray-200" }) })
] }),
/* @__PURE__ */ jsxRuntime.jsx(radixUi.Select.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
radixUi.Select.Content,
{
sideOffset: 4,
className: "bg-app-foreground z-50 w-full overflow-hidden border border-gray-400 py-1",
children: /* @__PURE__ */ jsxRuntime.jsx(radixUi.Select.Viewport, { children })
}
) })
] });
}
function SelectItem({ children, ...props }) {
return /* @__PURE__ */ jsxRuntime.jsxs(
radixUi.Select.Item,
{
className: "text-body-2 data-[state=checked]:bg-primary-300 flex w-full flex-row items-center justify-between px-3 py-2 text-gray-100 select-none data-[disabled]:pointer-events-none data-[highlighted]:bg-gray-400 data-[highlighted]:outline-none",
...props,
children: [
/* @__PURE__ */ jsxRuntime.jsx(radixUi.Select.ItemText, { className: "flex-1", children }),
/* @__PURE__ */ jsxRuntime.jsx(radixUi.Select.ItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(reactIcons.CheckIcon, { className: "size-4" }) })
]
}
);
}
function Card({ className, ...props }) {
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: tailwindMerge.twMerge("bg-app-foreground h-full rounded border border-gray-400", className), ...props });
}
function CardHeader({ className, ...props }) {
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: tailwindMerge.twMerge("flex flex-col p-6", className), ...props });
}
function CardTitle({ className, ...props }) {
return /* @__PURE__ */ jsxRuntime.jsx("h3", { className: tailwindMerge.twMerge("text-heading-5", className), ...props });
}
function CardDescription({ className, ...props }) {
return /* @__PURE__ */ jsxRuntime.jsx("p", { className: tailwindMerge.twMerge("text-body-2 text-gray-200", className), ...props });
}
function CardContent({ className, ...props }) {
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: tailwindMerge.twMerge("p-6 pt-0", className), ...props });
}
function CardFooter({ className, ...props }) {
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: tailwindMerge.twMerge("flex items-center p-6 pt-0", className), ...props });
}
var Sheet = radixUi.Dialog.Root;
var SheetTrigger = radixUi.Dialog.Trigger;
var SheetClose = radixUi.Dialog.Close;
var sheetContentStyles = classVarianceAuthority.cva(
"bg-foreground data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col border-gray-400 p-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
{
variants: {
side: {
top: "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 border-b",
bottom: "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 border-t",
left: "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",
right: "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm"
}
},
defaultVariants: {
side: "right"
}
}
);
function SheetContent({ side = "right", className, children, ...props }) {
return /* @__PURE__ */ jsxRuntime.jsxs(radixUi.Dialog.Portal, { children: [
/* @__PURE__ */ jsxRuntime.jsx(
radixUi.Dialog.Overlay,
{
className: "bg-background/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 backdrop-blur-sm",
...props
}
),
/* @__PURE__ */ jsxRuntime.jsxs(radixUi.Dialog.Content, { className: tailwindMerge.twMerge(sheetContentStyles({ side }), className), ...props, children: [
children,
/* @__PURE__ */ jsxRuntime.jsxs(radixUi.Dialog.Close, { className: "focus:ring-ring ring-primary-500 ring-offset-foreground data-[state=open]:bg-foreground absolute top-4 right-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-none disabled:pointer-events-none", children: [
/* @__PURE__ */ jsxRuntime.jsx(reactIcons.Cross1Icon, { className: "size-4" }),
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Close" })
] })
] })
] });
}
function SheetHeader({ className, ...props }) {
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: tailwindMerge.twMerge("flex flex-col space-y-2 text-center sm:text-left", className), ...props });
}
function SheetFooter({ className, ...props }) {
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: tailwindMerge.twMerge("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className), ...props });
}
function SheetTitle({ className, ...props }) {
return /* @__PURE__ */ jsxRuntime.jsx(radixUi.Dialog.Title, { className: tailwindMerge.twMerge("typography-heading-6", className), ...props });
}
function SheetDescription({ className, ...props }) {
return /* @__PURE__ */ jsxRuntime.jsx(radixUi.Dialog.Description, { className: tailwindMerge.twMerge("typography-body-2 text-gray-200", className), ...props });
}
function Separator({ className, orientation = "horizontal", decorative = false, ...props }) {
return /* @__PURE__ */ jsxRuntime.jsx(
radixUi.Separator.Root,
{
decorative,
orientation,
"aria-orientation": orientation,
className: chunkH2BWO3SI_cjs.cn(
"shrink-0 bg-gray-400",
orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
className
),
...props
}
);
}
function Header({ children, ...props }) {
return /* @__PURE__ */ jsxRuntime.jsx(
"header",
{
className: "bg-foreground/95 supports-[backdrop-filter]:bg-foreground/60 sticky top-0 z-50 w-full border-b border-gray-400 backdrop-blur",
...props,
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "container flex h-16 items-center", children })
}
);
}
var Dialog = radixUi.Dialog.Root;
var DialogClose = radixUi.Dialog.Close;
var dialogContentStyles = classVarianceAuthority.cva(
[
"bg-foreground fixed left-1/2 top-1/2 z-50 flex w-full -translate-x-1/2 -translate-y-1/2 flex-col rounded border border-gray-400 p-4 shadow-lg",
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] duration-200"
],
{
variants: {
width: {
xs: "max-w-xs",
sm: "max-w-sm",
md: "max-w-md",
lg: "max-w-lg",
xl: "max-w-xl",
"2xl": "max-w-2xl",
"3xl": "max-w-3xl",
"4xl": "max-w-4xl",
"5xl": "max-w-5xl",
"6xl": "max-w-6xl",
full: "max-w-full"
}
},
defaultVariants: {
width: "md"
}
}
);
function DialogOverlay(props) {
return /* @__PURE__ */ jsxRuntime.jsx(
radixUi.Dialog.Overlay,
{
className: "bg-background/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 backdrop-blur-xs",
...props
}
);
}
function DialogContent({ className, children, width = "md", ...props }) {
return /* @__PURE__ */ jsxRuntime.jsxs(radixUi.Dialog.Portal, { children: [
/* @__PURE__ */ jsxRuntime.jsx(DialogOverlay, {}),
/* @__PURE__ */ jsxRuntime.jsxs(radixUi.Dialog.Content, { className: tailwindMerge.twMerge(dialogContentStyles({ width }), className), ...props, children: [
children,
/* @__PURE__ */ jsxRuntime.jsxs(radixUi.Dialog.Close, { className: "focus:ring-ring ring-primary-500 ring-offset-foreground data-[state=open]:bg-foreground absolute top-4 right-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-none disabled:pointer-events-none", children: [
/* @__PURE__ */ jsxRuntime.jsx(reactIcons.Cross1Icon, { className: "size-4" }),
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Close" })
] })
] })
] });
}
var DialogTrigger = radixUi.Dialog.Trigger;
function DialogHeader({ className, ...props }) {
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: tailwindMerge.twMerge("mb-4 flex flex-col space-y-1.5 text-center sm:text-left", className), ...props });
}
function DialogFooter({ className, ...props }) {
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: tailwindMerge.twMerge("mt-4 flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className), ...props });
}
function DialogTitle({ className, ...props }) {
return /* @__PURE__ */ jsxRuntime.jsx(radixUi.Dialog.Title, { className: tailwindMerge.twMerge("text-heading-6", className), ...props });
}
function DialogDescription({ className, ...props }) {
return /* @__PURE__ */ jsxRuntime.jsx(radixUi.Dialog.Description, { className: tailwindMerge.twMerge("text-body-2 text-gray-200", className), ...props });
}
var Form = reactHookForm.FormProvider;
var FormItemContext = React__namespace.createContext({});
var FormItem = React__namespace.forwardRef(function({ className, ...props }, ref) {
const id = React__namespace.useId();
return /* @__PURE__ */ jsxRuntime.jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: tailwindMerge.twMerge("space-y-2", className), ...props }) });
});
FormItem.displayName = "FormItem";
var FormFieldContext = React__namespace.createContext({});
var FormField = ({
...props
}) => {
return /* @__PURE__ */ jsxRuntime.jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsxRuntime.jsx(reactHookForm.Controller, { ...props }) });
};
function Label({ className, ...props }) {
return /* @__PURE__ */ jsxRuntime.jsx(
radixUi.Label.Root,
{
className: tailwindMerge.twMerge("text-subtitle-1 peer-disabled:cursor-not-allowed peer-disabled:opacity-70", className),
...props
}
);
}
var useFormField = () => {
const fieldContext = React__namespace.useContext(FormFieldContext);
const itemContext = React__namespace.useContext(FormItemContext);
const { getFieldState, formState } = reactHookForm.useFormContext();
const fieldState = getFieldState(fieldContext.name, formState);
if (!fieldContext) {
throw new Error("useFormField should be used within <FormField>");
}
const { id } = itemContext;
return {
id,
name: fieldContext.name,
formItemId: `${id}-form-item`,
formDescriptionId: `${id}-form-item-description`,
formMessageId: `${id}-form-item-message`,
...fieldState
};
};
var FormLabel = React__namespace.forwardRef(
({ className, caption, ...props }, ref) => {
const { error, formItemId } = useFormField();
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-row items-end justify-between", children: [
/* @__PURE__ */ jsxRuntime.jsx(
Label,
{
ref,
className: tailwindMerge.twMerge(error ? "text-error-500" : null, className),
htmlFor: formItemId,
...props
}
),
caption ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "typography-caption text-gray-200", children: caption }) : null
] });
}
);
FormLabel.displayName = "FormLabel";
var FormControl = React__namespace.forwardRef(function(props, ref) {
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
const newProps = { ...props, invalid: !!error };
return /* @__PURE__ */ jsxRuntime.jsx(
reactSlot.Slot,
{
ref,
id: formItemId,
"aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
"aria-invalid": !!error,
...newProps
}
);
});
FormControl.displayName = "FormControl";
var FormMessage = React__namespace.forwardRef(function({ children, ...props }, ref) {
const { error, formMessageId } = useFormField();
const body = error ? String(error?.message) : children;
if (!body) {
return null;
}
return /* @__PURE__ */ jsxRuntime.jsx(HelperText, { ref, type: "error", id: formMessageId, ...props, children: body });
});
FormMessage.displayName = "FormMessage";
var FormDescription = React__namespace.forwardRef(function(props, ref) {
const { formDescriptionId } = useFormField();
return /* @__PURE__ */ jsxRuntime.jsx(HelperText, { ref, id: formDescriptionId, ...props });
});
FormDescription.displayName = "FormDescription";
var helperTextCva = classVarianceAuthority.cva("", {
variants: {
type: {
description: "text-body-2 text-gray-200",
error: "text-caption text-error-500"
}
},
defaultVariants: {
type: "description"
}
});
function HelperText({ className, children, type = "description", role, ref, ...props }) {
return /* @__PURE__ */ jsxRuntime.jsx(
"p",
{
ref,
className: tailwindMerge.twMerge(helperTextCva({ type }), className),
role: type === "error" ? "alert" : role,
...props,
children
}
);
}
var AlertDialog = radixUi.AlertDialog.Root;
var AlertDialogTrigger = radixUi.AlertDialog.Trigger;
function AlertDialogOverlay({ className, ...props }) {
return /* @__PURE__ */ jsxRuntime.jsx(
radixUi.AlertDialog.Overlay,
{
className: chunkH2BWO3SI_cjs.cn(
"bg-background/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 backdrop-blur-xs",
className
),
...props
}
);
}
function AlertDialogContent({ className, ...props }) {
return /* @__PURE__ */ jsxRuntime.jsxs(radixUi.AlertDialog.Portal, { children: [
/* @__PURE__ */ jsxRuntime.jsx(AlertDialogOverlay, {}),
/* @__PURE__ */ jsxRuntime.jsx(
radixUi.AlertDialog.Content,
{
className: chunkH2BWO3SI_cjs.cn(
"bg-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] fixed top-1/2 left-1/2 z-50 flex w-full max-w-lg -translate-x-1/2 -translate-y-1/2 flex-col rounded border border-gray-400 p-4 shadow-lg duration-200",
className
),
...props
}
)
] });
}
function AlertDialogHeader({ className, ...props }) {
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: tailwindMerge.twMerge("mb-4 flex flex-col space-y-2 text-center sm:text-left", className), ...props });
}
function AlertDialogFooter({ className, ...props }) {
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: tailwindMerge.twMerge("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className), ...props });
}
function AlertDialogTitle({ className, ref, ...props }) {
return /* @__PURE__ */ jsxRuntime.jsx(radixUi.AlertDialog.Title, { ref, className: chunkH2BWO3SI_cjs.cn("text-heading-6", className), ...props });
}
function AlertDialogDescription({ className, ...props }) {
return /* @__PURE__ */ jsxRuntime.jsx(radixUi.AlertDialog.Description, { className: chunkH2BWO3SI_cjs.cn("text-body-2 text-gray-200", className), ...props });
}
var AlertDialogAction = radixUi.AlertDialog.Action;
var AlertDialogCancel = radixUi.AlertDialog.Cancel;
Object.defineProperty(exports, "cn", {
enumerable: true,
get: function () { return chunkH2BWO3SI_cjs.cn; }
});
exports.AlertDialog = AlertDialog;
exports.AlertDialogAction = AlertDialogAction;
exports.AlertDialogCancel = AlertDialogCancel;
exports.AlertDialogContent = AlertDialogContent;
exports.AlertDialogDescription = AlertDialogDescription;
exports.AlertDialogFooter = AlertDialogFooter;
exports.AlertDialogHeader = AlertDialogHeader;
exports.AlertDialogTitle = AlertDialogTitle;
exports.AlertDialogTrigger = AlertDialogTrigger;
exports.Avatar = Avatar;
exports.AvatarFallback = AvatarFallback;
exports.AvatarImage = AvatarImage;
exports.Button = Button;
exports.Card = Card;
exports.CardContent = CardContent;
exports.CardDescription = CardDescription;
exports.CardFooter = CardFooter;
exports.CardHeader = CardHeader;
exports.CardTitle = CardTitle;
exports.Dialog = Dialog;
exports.DialogClose = DialogClose;
exports.DialogContent = DialogContent;
exports.DialogDescription = DialogDescription;
exports.DialogFooter = DialogFooter;
exports.DialogHeader = DialogHeader;
exports.DialogTitle = DialogTitle;
exports.DialogTrigger = DialogTrigger;
exports.Form = Form;
exports.FormControl = FormControl;
exports.FormDescription = FormDescription;
exports.FormField = FormField;
exports.FormItem = FormItem;
exports.FormLabel = FormLabel;
exports.FormMessage = FormMessage;
exports.Header = Header;
exports.HelperText = HelperText;
exports.Input = Input;
exports.Label = Label;
exports.Select = Select;
exports.SelectItem = SelectItem;
exports.Separator = Separator;
exports.Sheet = Sheet;
exports.SheetClose = SheetClose;
exports.SheetContent = SheetContent;
exports.SheetDescription = SheetDescription;
exports.SheetFooter = SheetFooter;
exports.SheetHeader = SheetHeader;
exports.SheetTitle = SheetTitle;
exports.SheetTrigger = SheetTrigger;
exports.Textarea = Textarea;
exports.Tooltip = Tooltip;
exports.TooltipProvider = TooltipProvider;