@phsa.tec/design-system-react
Version:
A modern React component library built with TypeScript, Tailwind CSS, and Radix UI.
1,351 lines (1,317 loc) • 150 kB
JavaScript
"use client"
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
}) : x)(function(x) {
if (typeof require !== "undefined") return require.apply(this, arguments);
throw Error('Dynamic require of "' + x + '" is not supported');
});
var __objRest = (source, exclude) => {
var target = {};
for (var prop in source)
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
target[prop] = source[prop];
if (source != null && __getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(source)) {
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
target[prop] = source[prop];
}
return target;
};
// src/components/dataDisplay/Table/components/DynamicTable/index.tsx
import * as React5 from "react";
import {
flexRender,
getCoreRowModel,
getSortedRowModel,
getPaginationRowModel,
useReactTable
} from "@tanstack/react-table";
// src/components/ui/table.tsx
import * as React from "react";
// src/lib/utils.ts
import { clsx } from "clsx";
import { twMerge } from "tailwind-merge";
function cn(...inputs) {
return twMerge(clsx(inputs));
}
// src/components/ui/table.tsx
import { jsx } from "react/jsx-runtime";
var Table = React.forwardRef((_a, ref) => {
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
return /* @__PURE__ */ jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsx(
"table",
__spreadValues({
ref,
className: cn("w-full caption-bottom text-sm", className)
}, props)
) });
});
Table.displayName = "Table";
var TableHeader = React.forwardRef((_a, ref) => {
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
return /* @__PURE__ */ jsx("thead", __spreadValues({ ref, className: cn("[&_tr]:border-b", className) }, props));
});
TableHeader.displayName = "TableHeader";
var TableBody = React.forwardRef((_a, ref) => {
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
return /* @__PURE__ */ jsx(
"tbody",
__spreadValues({
ref,
className: cn("[&_tr:last-child]:border-0", className)
}, props)
);
});
TableBody.displayName = "TableBody";
var TableFooter = React.forwardRef((_a, ref) => {
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
return /* @__PURE__ */ jsx(
"tfoot",
__spreadValues({
ref,
className: cn(
"border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",
className
)
}, props)
);
});
TableFooter.displayName = "TableFooter";
var TableRow = React.forwardRef((_a, ref) => {
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
return /* @__PURE__ */ jsx(
"tr",
__spreadValues({
ref,
className: cn(
"border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
className
)
}, props)
);
});
TableRow.displayName = "TableRow";
var TableHead = React.forwardRef((_a, ref) => {
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
return /* @__PURE__ */ jsx(
"th",
__spreadValues({
ref,
className: cn(
"h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
className
)
}, props)
);
});
TableHead.displayName = "TableHead";
var TableCell = React.forwardRef((_a, ref) => {
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
return /* @__PURE__ */ jsx(
"td",
__spreadValues({
ref,
className: cn(
"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
className
)
}, props)
);
});
TableCell.displayName = "TableCell";
var TableCaption = React.forwardRef((_a, ref) => {
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
return /* @__PURE__ */ jsx(
"caption",
__spreadValues({
ref,
className: cn("mt-4 text-sm text-muted-foreground", className)
}, props)
);
});
TableCaption.displayName = "TableCaption";
// src/components/dataDisplay/Table/components/DynamicTable/data-table-view-options.tsx
import { DropdownMenuTrigger as DropdownMenuTrigger2 } from "@radix-ui/react-dropdown-menu";
import { MixerHorizontalIcon } from "@radix-ui/react-icons";
// src/components/ui/button.tsx
import * as React2 from "react";
import { Slot } from "@radix-ui/react-slot";
import { cva } from "class-variance-authority";
import { jsx as jsx2 } from "react/jsx-runtime";
var buttonVariants = cva(
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
{
variants: {
variant: {
default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
ghost: "hover:bg-accent hover:text-accent-foreground",
link: "text-primary underline-offset-4 hover:underline"
},
size: {
default: "h-9 px-4 py-2",
sm: "h-8 rounded-md px-3 text-xs",
lg: "h-10 rounded-md px-8",
icon: "h-9 w-9"
}
},
defaultVariants: {
variant: "default",
size: "default"
}
}
);
var Button = React2.forwardRef(
(_a, ref) => {
var _b = _a, { className, variant, size, asChild = false } = _b, props = __objRest(_b, ["className", "variant", "size", "asChild"]);
const Comp = asChild ? Slot : "button";
return /* @__PURE__ */ jsx2(
Comp,
__spreadValues({
className: cn(buttonVariants({ variant, size, className })),
ref
}, props)
);
}
);
Button.displayName = "Button";
// src/components/ui/dropdown-menu.tsx
import * as React3 from "react";
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
import { Check, ChevronRight, Circle } from "lucide-react";
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
var DropdownMenu = DropdownMenuPrimitive.Root;
var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
var DropdownMenuGroup = DropdownMenuPrimitive.Group;
var DropdownMenuPortal = DropdownMenuPrimitive.Portal;
var DropdownMenuSub = DropdownMenuPrimitive.Sub;
var DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
var DropdownMenuSubTrigger = React3.forwardRef((_a, ref) => {
var _b = _a, { className, inset, children } = _b, props = __objRest(_b, ["className", "inset", "children"]);
return /* @__PURE__ */ jsxs(
DropdownMenuPrimitive.SubTrigger,
__spreadProps(__spreadValues({
ref,
className: cn(
"flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
inset && "pl-8",
className
)
}, props), {
children: [
children,
/* @__PURE__ */ jsx3(ChevronRight, { className: "ml-auto" })
]
})
);
});
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
var DropdownMenuSubContent = React3.forwardRef((_a, ref) => {
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
return /* @__PURE__ */ jsx3(
DropdownMenuPrimitive.SubContent,
__spreadValues({
ref,
className: cn(
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
className
)
}, props)
);
});
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
var DropdownMenuContent = React3.forwardRef((_a, ref) => {
var _b = _a, { className, sideOffset = 4 } = _b, props = __objRest(_b, ["className", "sideOffset"]);
return /* @__PURE__ */ jsx3(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx3(
DropdownMenuPrimitive.Content,
__spreadValues({
ref,
sideOffset,
className: cn(
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
"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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
className
)
}, props)
) });
});
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
var DropdownMenuItem = React3.forwardRef((_a, ref) => {
var _b = _a, { className, inset } = _b, props = __objRest(_b, ["className", "inset"]);
return /* @__PURE__ */ jsx3(
DropdownMenuPrimitive.Item,
__spreadValues({
ref,
className: cn(
"relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",
inset && "pl-8",
className
)
}, props)
);
});
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
var DropdownMenuCheckboxItem = React3.forwardRef((_a, ref) => {
var _b = _a, { className, children, checked } = _b, props = __objRest(_b, ["className", "children", "checked"]);
return /* @__PURE__ */ jsxs(
DropdownMenuPrimitive.CheckboxItem,
__spreadProps(__spreadValues({
ref,
className: cn(
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
className
),
checked
}, props), {
children: [
/* @__PURE__ */ jsx3("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx3(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx3(Check, { className: "h-4 w-4" }) }) }),
children
]
})
);
});
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
var DropdownMenuRadioItem = React3.forwardRef((_a, ref) => {
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
return /* @__PURE__ */ jsxs(
DropdownMenuPrimitive.RadioItem,
__spreadProps(__spreadValues({
ref,
className: cn(
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
className
)
}, props), {
children: [
/* @__PURE__ */ jsx3("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx3(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx3(Circle, { className: "h-2 w-2 fill-current" }) }) }),
children
]
})
);
});
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
var DropdownMenuLabel = React3.forwardRef((_a, ref) => {
var _b = _a, { className, inset } = _b, props = __objRest(_b, ["className", "inset"]);
return /* @__PURE__ */ jsx3(
DropdownMenuPrimitive.Label,
__spreadValues({
ref,
className: cn(
"px-2 py-1.5 text-sm font-semibold",
inset && "pl-8",
className
)
}, props)
);
});
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
var DropdownMenuSeparator = React3.forwardRef((_a, ref) => {
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
return /* @__PURE__ */ jsx3(
DropdownMenuPrimitive.Separator,
__spreadValues({
ref,
className: cn("-mx-1 my-1 h-px bg-muted", className)
}, props)
);
});
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
var DropdownMenuShortcut = (_a) => {
var _b = _a, {
className
} = _b, props = __objRest(_b, [
"className"
]);
return /* @__PURE__ */ jsx3(
"span",
__spreadValues({
className: cn("ml-auto text-xs tracking-widest opacity-60", className)
}, props)
);
};
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
// src/components/dataDisplay/Table/components/DynamicTable/data-table-view-options.tsx
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
function DataTableViewOptions({
table
}) {
return /* @__PURE__ */ jsxs2(DropdownMenu, { children: [
/* @__PURE__ */ jsx4(DropdownMenuTrigger2, { asChild: true, children: /* @__PURE__ */ jsxs2(
Button,
{
variant: "outline",
size: "sm",
className: "ml-auto hidden h-8 lg:flex",
children: [
/* @__PURE__ */ jsx4(MixerHorizontalIcon, { className: "mr-2 h-4 w-4" }),
"Colunas"
]
}
) }),
/* @__PURE__ */ jsxs2(DropdownMenuContent, { align: "end", className: "w-[150px]", children: [
/* @__PURE__ */ jsx4(DropdownMenuLabel, { children: "Colunas vis\xEDveis" }),
/* @__PURE__ */ jsx4(DropdownMenuSeparator, {}),
table.getAllColumns().filter(
(column) => typeof column.accessorFn !== "undefined" && column.getCanHide()
).map((column) => {
return /* @__PURE__ */ jsx4(
DropdownMenuCheckboxItem,
{
className: "capitalize",
checked: column.getIsVisible(),
onCheckedChange: (value) => column.toggleVisibility(!!value),
children: column.id
},
column.id
);
})
] })
] });
}
// src/components/dataDisplay/Table/components/DynamicTable/data-table-toolbar.tsx
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
function DataTableToolbar({
table,
filters,
showColumnVisibility
}) {
return /* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between", children: [
/* @__PURE__ */ jsx5("div", { className: "flex flex-1 items-center space-x-2", children: filters }),
showColumnVisibility && /* @__PURE__ */ jsx5(DataTableViewOptions, { table })
] });
}
// src/components/dataDisplay/Table/components/DynamicTable/data-table-pagination.tsx
import {
ChevronLeftIcon,
ChevronRightIcon,
DoubleArrowLeftIcon,
DoubleArrowRightIcon
} from "@radix-ui/react-icons";
// src/components/ui/select.tsx
import * as React4 from "react";
import * as SelectPrimitive from "@radix-ui/react-select";
import { Check as Check2, ChevronDown, ChevronUp } from "lucide-react";
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
var Select = SelectPrimitive.Root;
var SelectValue = SelectPrimitive.Value;
var SelectTrigger = React4.forwardRef((_a, ref) => {
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
return /* @__PURE__ */ jsxs4(
SelectPrimitive.Trigger,
__spreadProps(__spreadValues({
ref,
className: cn(
"flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
className
)
}, props), {
children: [
children,
/* @__PURE__ */ jsx6(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx6(ChevronDown, { className: "h-4 w-4 opacity-50" }) })
]
})
);
});
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
var SelectScrollUpButton = React4.forwardRef((_a, ref) => {
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
return /* @__PURE__ */ jsx6(
SelectPrimitive.ScrollUpButton,
__spreadProps(__spreadValues({
ref,
className: cn(
"flex cursor-default items-center justify-center py-1",
className
)
}, props), {
children: /* @__PURE__ */ jsx6(ChevronUp, { className: "h-4 w-4" })
})
);
});
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
var SelectScrollDownButton = React4.forwardRef((_a, ref) => {
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
return /* @__PURE__ */ jsx6(
SelectPrimitive.ScrollDownButton,
__spreadProps(__spreadValues({
ref,
className: cn(
"flex cursor-default items-center justify-center py-1",
className
)
}, props), {
children: /* @__PURE__ */ jsx6(ChevronDown, { className: "h-4 w-4" })
})
);
});
SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
var SelectContent = React4.forwardRef((_a, ref) => {
var _b = _a, { className, children, position = "popper" } = _b, props = __objRest(_b, ["className", "children", "position"]);
return /* @__PURE__ */ jsx6(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs4(
SelectPrimitive.Content,
__spreadProps(__spreadValues({
ref,
className: cn(
"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
className
),
position
}, props), {
children: [
/* @__PURE__ */ jsx6(SelectScrollUpButton, {}),
/* @__PURE__ */ jsx6(
SelectPrimitive.Viewport,
{
className: cn(
"p-1",
position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
),
children
}
),
/* @__PURE__ */ jsx6(SelectScrollDownButton, {})
]
})
) });
});
SelectContent.displayName = SelectPrimitive.Content.displayName;
var SelectLabel = React4.forwardRef((_a, ref) => {
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
return /* @__PURE__ */ jsx6(
SelectPrimitive.Label,
__spreadValues({
ref,
className: cn("px-2 py-1.5 text-sm font-semibold", className)
}, props)
);
});
SelectLabel.displayName = SelectPrimitive.Label.displayName;
var SelectItem = React4.forwardRef((_a, ref) => {
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
return /* @__PURE__ */ jsxs4(
SelectPrimitive.Item,
__spreadProps(__spreadValues({
ref,
className: cn(
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
className
)
}, props), {
children: [
/* @__PURE__ */ jsx6("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx6(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx6(Check2, { className: "h-4 w-4" }) }) }),
/* @__PURE__ */ jsx6(SelectPrimitive.ItemText, { children })
]
})
);
});
SelectItem.displayName = SelectPrimitive.Item.displayName;
var SelectSeparator = React4.forwardRef((_a, ref) => {
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
return /* @__PURE__ */ jsx6(
SelectPrimitive.Separator,
__spreadValues({
ref,
className: cn("-mx-1 my-1 h-px bg-muted", className)
}, props)
);
});
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
// src/components/dataDisplay/Table/components/DynamicTable/data-table-pagination.tsx
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
function DataTablePagination({
table,
pageSizeOptions = [10, 20, 30, 40, 50]
}) {
return /* @__PURE__ */ jsxs5("div", { className: "flex items-center justify-between px-2", children: [
/* @__PURE__ */ jsxs5("div", { className: "flex-1 text-sm text-muted-foreground", children: [
table.getFilteredSelectedRowModel().rows.length,
" de",
" ",
table.getFilteredRowModel().rows.length,
" linha(s) selecionada(s)."
] }),
/* @__PURE__ */ jsxs5("div", { className: "flex items-center space-x-6 lg:space-x-8", children: [
/* @__PURE__ */ jsxs5("div", { className: "flex items-center space-x-2", children: [
/* @__PURE__ */ jsx7("p", { className: "text-sm font-medium", children: "Linhas por p\xE1gina" }),
/* @__PURE__ */ jsxs5(
Select,
{
value: `${table.getState().pagination.pageSize}`,
onValueChange: (value) => {
table.setPageSize(Number(value));
},
children: [
/* @__PURE__ */ jsx7(SelectTrigger, { className: "h-8 w-[70px]", children: /* @__PURE__ */ jsx7(SelectValue, { placeholder: table.getState().pagination.pageSize }) }),
/* @__PURE__ */ jsx7(SelectContent, { side: "top", children: pageSizeOptions.map((pageSize) => /* @__PURE__ */ jsx7(SelectItem, { value: `${pageSize}`, children: pageSize }, pageSize)) })
]
}
)
] }),
/* @__PURE__ */ jsxs5("div", { className: "flex w-[100px] items-center justify-center text-sm font-medium", children: [
"P\xE1gina ",
table.getState().pagination.pageIndex + 1,
" de",
" ",
table.getPageCount()
] }),
/* @__PURE__ */ jsxs5("div", { className: "flex items-center space-x-2", children: [
/* @__PURE__ */ jsx7(
Button,
{
variant: "outline",
className: "hidden h-8 w-8 p-0 lg:flex",
onClick: () => table.setPageIndex(0),
disabled: !table.getCanPreviousPage(),
children: /* @__PURE__ */ jsx7(DoubleArrowLeftIcon, { className: "h-4 w-4" })
}
),
/* @__PURE__ */ jsx7(
Button,
{
variant: "outline",
className: "h-8 w-8 p-0",
onClick: () => table.previousPage(),
disabled: !table.getCanPreviousPage(),
children: /* @__PURE__ */ jsx7(ChevronLeftIcon, { className: "h-4 w-4" })
}
),
/* @__PURE__ */ jsx7(
Button,
{
variant: "outline",
className: "h-8 w-8 p-0",
onClick: () => table.nextPage(),
disabled: !table.getCanNextPage(),
children: /* @__PURE__ */ jsx7(ChevronRightIcon, { className: "h-4 w-4" })
}
),
/* @__PURE__ */ jsx7(
Button,
{
variant: "outline",
className: "hidden h-8 w-8 p-0 lg:flex",
onClick: () => table.setPageIndex(table.getPageCount() - 1),
disabled: !table.getCanNextPage(),
children: /* @__PURE__ */ jsx7(DoubleArrowRightIcon, { className: "h-4 w-4" })
}
)
] })
] })
] });
}
// src/components/dataDisplay/Table/components/DynamicTable/data-table-column-header.tsx
import {
ArrowDownIcon,
ArrowUpIcon,
CaretSortIcon,
EyeNoneIcon
} from "@radix-ui/react-icons";
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
function DataTableColumnHeader({
column,
title,
className
}) {
if (!column.getCanSort()) {
return /* @__PURE__ */ jsx8("div", { className: cn(className), children: title });
}
return /* @__PURE__ */ jsx8("div", { className: cn("flex items-center space-x-2", className), children: /* @__PURE__ */ jsxs6(DropdownMenu, { children: [
/* @__PURE__ */ jsx8(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs6(
Button,
{
variant: "ghost",
size: "sm",
className: "-ml-3 h-8 data-[state=open]:bg-accent",
children: [
/* @__PURE__ */ jsx8("span", { children: title }),
column.getIsSorted() === "desc" ? /* @__PURE__ */ jsx8(ArrowDownIcon, { className: "ml-2 h-4 w-4" }) : column.getIsSorted() === "asc" ? /* @__PURE__ */ jsx8(ArrowUpIcon, { className: "ml-2 h-4 w-4" }) : /* @__PURE__ */ jsx8(CaretSortIcon, { className: "ml-2 h-4 w-4" })
]
}
) }),
/* @__PURE__ */ jsxs6(DropdownMenuContent, { align: "start", children: [
/* @__PURE__ */ jsxs6(DropdownMenuItem, { onClick: () => column.toggleSorting(false), children: [
/* @__PURE__ */ jsx8(ArrowUpIcon, { className: "mr-2 h-3.5 w-3.5 text-muted-foreground/70" }),
"Crescente"
] }),
/* @__PURE__ */ jsxs6(DropdownMenuItem, { onClick: () => column.toggleSorting(true), children: [
/* @__PURE__ */ jsx8(ArrowDownIcon, { className: "mr-2 h-3.5 w-3.5 text-muted-foreground/70" }),
"Decrescente"
] }),
/* @__PURE__ */ jsx8(DropdownMenuSeparator, {}),
/* @__PURE__ */ jsxs6(DropdownMenuItem, { onClick: () => column.toggleVisibility(false), children: [
/* @__PURE__ */ jsx8(EyeNoneIcon, { className: "mr-2 h-3.5 w-3.5 text-muted-foreground/70" }),
"Ocultar"
] })
] })
] }) });
}
// src/components/dataDisplay/Table/components/DynamicTable/index.tsx
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
function DynamicTable({
data,
columns,
className,
toolbar,
pagination: showPagination = true,
sorting: showSorting = true,
columnVisibility: showColumnVisibility = true,
filters,
rowsPerPage = [10, 20, 30, 40, 50],
defaultSort = [],
defaultVisibility = {}
}) {
var _a;
const [sorting, setSorting] = React5.useState(defaultSort);
const [columnVisibility, setColumnVisibility] = React5.useState(defaultVisibility);
const [{ pageIndex, pageSize }, setPagination] = React5.useState({
pageIndex: 0,
pageSize: rowsPerPage[0]
});
const pagination = React5.useMemo(
() => ({
pageIndex,
pageSize
}),
[pageIndex, pageSize]
);
const table = useReactTable({
data,
columns,
getCoreRowModel: getCoreRowModel(),
onSortingChange: setSorting,
getSortedRowModel: showSorting ? getSortedRowModel() : void 0,
getPaginationRowModel: getPaginationRowModel(),
onColumnVisibilityChange: setColumnVisibility,
onPaginationChange: setPagination,
manualPagination: false,
pageCount: Math.ceil(data.length / pageSize),
state: {
sorting,
columnVisibility,
pagination
},
enableSorting: showSorting
});
return /* @__PURE__ */ jsxs7("div", { className: "space-y-4", children: [
(toolbar || filters || showColumnVisibility) && /* @__PURE__ */ jsx9(
DataTableToolbar,
{
table,
filters,
showColumnVisibility
}
),
/* @__PURE__ */ jsx9("div", { className: cn("rounded-md border", className), children: /* @__PURE__ */ jsxs7(Table, { children: [
/* @__PURE__ */ jsx9(TableHeader, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx9(TableRow, { children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx9(TableHead, { children: header.isPlaceholder ? null : /* @__PURE__ */ jsx9(
DataTableColumnHeader,
{
column: header.column,
title: header.column.columnDef.header
}
) }, header.id)) }, headerGroup.id)) }),
/* @__PURE__ */ jsx9(TableBody, { children: ((_a = table.getRowModel().rows) == null ? void 0 : _a.length) ? table.getRowModel().rows.map((row) => /* @__PURE__ */ jsx9(TableRow, { children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx9(TableCell, { children: flexRender(
cell.column.columnDef.cell,
cell.getContext()
) }, cell.id)) }, row.id)) : /* @__PURE__ */ jsx9(TableRow, { children: /* @__PURE__ */ jsx9(
TableCell,
{
colSpan: columns.length,
className: "h-24 text-center",
children: "Nenhum resultado encontrado."
}
) }) })
] }) }),
showPagination && /* @__PURE__ */ jsx9(DataTablePagination, { table, pageSizeOptions: rowsPerPage })
] });
}
// src/components/ui/badge.tsx
import { cva as cva2 } from "class-variance-authority";
import { jsx as jsx10 } from "react/jsx-runtime";
var badgeVariants = cva2(
"inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
{
variants: {
variant: {
default: "border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",
secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
destructive: "border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",
success: "border-transparent bg-success text-primary-foreground shadow hover:bg-success/80",
warning: "border-transparent bg-warning text-primary-foreground shadow hover:bg-warning/80",
outline: "text-foreground"
}
},
defaultVariants: {
variant: "default"
}
}
);
function Badge(_a) {
var _b = _a, { className, variant } = _b, props = __objRest(_b, ["className", "variant"]);
return /* @__PURE__ */ jsx10("div", __spreadValues({ className: cn(badgeVariants({ variant }), className) }, props));
}
// src/components/dataDisplay/Icon/Icon.tsx
import { useCallback, useMemo as useMemo2 } from "react";
import { IconContext } from "react-icons";
import { Fragment, jsx as jsx11 } from "react/jsx-runtime";
var Icon2 = (_a) => {
var _b = _a, { name, size = 24 } = _b, rest = __objRest(_b, ["name", "size"]);
const nameIcon = useMemo2(() => name, [name]);
const iconsModulePath = useMemo2(
() => ({
// eslint-disable-next-line @typescript-eslint/no-require-imports
md: __require("react-icons/md"),
// eslint-disable-next-line @typescript-eslint/no-require-imports
fa: __require("react-icons/fa"),
// eslint-disable-next-line @typescript-eslint/no-require-imports
bs: __require("react-icons/bs")
}),
[]
);
const typeIcon = useMemo2(() => {
var _a2;
const matches = [...nameIcon.matchAll(/[A-Z]/g)];
return String(
nameIcon.slice(0, (_a2 = matches[1]) == null ? void 0 : _a2.index) || ""
).toLocaleLowerCase();
}, [nameIcon]);
const Icon3 = useCallback(
(props) => {
var _a2, _b2;
try {
if (!typeIcon || !nameIcon) return /* @__PURE__ */ jsx11(Fragment, {});
return (_b2 = (_a2 = iconsModulePath[typeIcon])[nameIcon]) == null ? void 0 : _b2.call(_a2, props);
} catch (e) {
return /* @__PURE__ */ jsx11(Fragment, {});
}
},
[iconsModulePath, nameIcon, typeIcon]
);
return /* @__PURE__ */ jsx11(IconContext.Provider, { value: { size: String(size) }, children: /* @__PURE__ */ jsx11(Icon3, __spreadValues({}, rest)) });
};
// src/components/ui/avatar.tsx
import * as React7 from "react";
import * as AvatarPrimitive from "@radix-ui/react-avatar";
import { jsx as jsx12 } from "react/jsx-runtime";
var Avatar = React7.forwardRef((_a, ref) => {
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
return /* @__PURE__ */ jsx12(
AvatarPrimitive.Root,
__spreadValues({
ref,
className: cn(
"relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
className
)
}, props)
);
});
Avatar.displayName = AvatarPrimitive.Root.displayName;
var AvatarImage = React7.forwardRef((_a, ref) => {
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
return /* @__PURE__ */ jsx12(
AvatarPrimitive.Image,
__spreadValues({
ref,
className: cn("aspect-square h-full w-full", className)
}, props)
);
});
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
var AvatarFallback = React7.forwardRef((_a, ref) => {
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
return /* @__PURE__ */ jsx12(
AvatarPrimitive.Fallback,
__spreadValues({
ref,
className: cn(
"flex h-full w-full items-center justify-center rounded-full bg-muted",
className
)
}, props)
);
});
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
// src/components/dataDisplay/DataPairList/DataPairList.tsx
import { isEmpty } from "lodash";
// src/components/dataDisplay/Text/Text.tsx
import { cva as cva3 } from "class-variance-authority";
import { jsx as jsx13 } from "react/jsx-runtime";
var textVariants = cva3("", {
variants: {
variant: {
display: "text-5xl font-extrabold tracking-tight",
title: "text-3xl font-bold tracking-tight",
subtitle: "text-2xl font-semibold",
normal: "text-base font-normal",
caption: "text-sm font-medium",
muted: "text-sm font-normal text-muted-foreground"
},
align: {
left: "text-left",
center: "text-center",
right: "text-right",
justify: "text-justify"
}
},
defaultVariants: {
variant: "normal",
align: "left"
}
});
var tagMap = {
display: "h1",
title: "h2",
subtitle: "h3",
normal: "p",
caption: "small",
muted: "p"
};
function Text({
variant = "normal",
align,
className,
children
}) {
const Tag = tagMap[variant || "normal"] || "p";
return /* @__PURE__ */ jsx13(Tag, { className: cn(textVariants({ variant, align }), className), children });
}
// src/components/dataDisplay/DataPairList/DataPairList.tsx
import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
var DataPairList = ({
title,
data,
labels,
className,
infoDirection = "horizontal",
direction = "vertical",
withBorder = false,
header = /* @__PURE__ */ jsx14(Fragment2, {})
}) => {
if (isEmpty(data)) return null;
return /* @__PURE__ */ jsxs8(
"div",
{
className: cn(
"flex flex-col gap-2 rounded-md p-4",
withBorder && "border border-muted",
className
),
children: [
/* @__PURE__ */ jsxs8("div", { className: "flex gap-3", children: [
title && /* @__PURE__ */ jsx14(Text, { variant: "title", children: title }),
header
] }),
/* @__PURE__ */ jsx14(
"div",
{
className: cn(
"grid grid-cols-1 mt-5",
direction === "vertical" ? "gap-3" : "sm:grid-cols-2 md:grid-cols-4 gap-10"
),
children: Object.entries(data || {}).map(([key, value], index) => /* @__PURE__ */ jsxs8(
"div",
{
className: cn(
"flex gap-3",
infoDirection === "horizontal" ? "flex-row" : "flex-col"
),
children: [
/* @__PURE__ */ jsxs8(Text, { className: "uppercase text-muted-foreground font-bold", children: [
(labels == null ? void 0 : labels[key]) || key,
":"
] }),
/* @__PURE__ */ jsx14(Text, { children: value })
]
},
index
))
}
)
]
}
);
};
// src/components/dataInput/checkbox/Checkbox.tsx
import { useFormContext as useFormContext3 } from "react-hook-form";
// src/components/ui/checkbox.tsx
import * as React8 from "react";
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
import { Check as Check3 } from "lucide-react";
import { jsx as jsx15 } from "react/jsx-runtime";
var Checkbox = React8.forwardRef((_a, ref) => {
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
return /* @__PURE__ */ jsx15(
CheckboxPrimitive.Root,
__spreadProps(__spreadValues({
ref,
className: cn(
"peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
className
)
}, props), {
children: /* @__PURE__ */ jsx15(
CheckboxPrimitive.Indicator,
{
className: cn("flex items-center justify-center text-current"),
children: /* @__PURE__ */ jsx15(Check3, { className: "h-4 w-4" })
}
)
})
);
});
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
// src/components/ui/label.tsx
import * as React9 from "react";
import * as LabelPrimitive from "@radix-ui/react-label";
import { cva as cva4 } from "class-variance-authority";
import { jsx as jsx16 } from "react/jsx-runtime";
var labelVariants = cva4(
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
);
var Label3 = React9.forwardRef((_a, ref) => {
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
return /* @__PURE__ */ jsx16(
LabelPrimitive.Root,
__spreadValues({
ref,
className: cn(labelVariants(), className)
}, props)
);
});
Label3.displayName = LabelPrimitive.Root.displayName;
// src/components/dataInput/form/index.ts
import { useFormContext as useFormContext2 } from "react-hook-form";
// src/components/ui/form.tsx
import * as React10 from "react";
import { Slot as Slot2 } from "@radix-ui/react-slot";
import {
Controller,
FormProvider,
useFormContext
} from "react-hook-form";
import { jsx as jsx17 } from "react/jsx-runtime";
var Form = FormProvider;
var FormFieldContext = React10.createContext(
{}
);
var FormField = (_a) => {
var props = __objRest(_a, []);
return /* @__PURE__ */ jsx17(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx17(Controller, __spreadValues({}, props)) });
};
var useFormField = () => {
const fieldContext = React10.useContext(FormFieldContext);
const itemContext = React10.useContext(FormItemContext);
const { getFieldState, formState } = useFormContext();
const fieldState = getFieldState(fieldContext.name, formState);
if (!fieldContext) {
throw new Error("useFormField should be used within <FormField>");
}
const { id } = itemContext;
return __spreadValues({
id,
name: fieldContext.name,
formItemId: `${id}-form-item`,
formDescriptionId: `${id}-form-item-description`,
formMessageId: `${id}-form-item-message`
}, fieldState);
};
var FormItemContext = React10.createContext(
{}
);
var FormItem = React10.forwardRef((_a, ref) => {
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
const id = React10.useId();
return /* @__PURE__ */ jsx17(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx17("div", __spreadValues({ ref, className: cn("space-y-2", className) }, props)) });
});
FormItem.displayName = "FormItem";
var FormLabel = React10.forwardRef((_a, ref) => {
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
const { error, formItemId } = useFormField();
return /* @__PURE__ */ jsx17(
Label3,
__spreadValues({
ref,
className: cn(error && "text-destructive", className),
htmlFor: formItemId
}, props)
);
});
FormLabel.displayName = "FormLabel";
var FormControl = React10.forwardRef((_a, ref) => {
var props = __objRest(_a, []);
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
return /* @__PURE__ */ jsx17(
Slot2,
__spreadValues({
ref,
id: formItemId,
"aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
"aria-invalid": !!error
}, props)
);
});
FormControl.displayName = "FormControl";
var FormDescription = React10.forwardRef((_a, ref) => {
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
const { formDescriptionId } = useFormField();
return /* @__PURE__ */ jsx17(
"p",
__spreadValues({
ref,
id: formDescriptionId,
className: cn("text-[0.8rem] text-muted-foreground", className)
}, props)
);
});
FormDescription.displayName = "FormDescription";
var FormMessage = React10.forwardRef((_a, ref) => {
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
const { error, formMessageId } = useFormField();
const body = error ? String(error == null ? void 0 : error.message) : children;
if (!body) {
return null;
}
return /* @__PURE__ */ jsx17(
"p",
__spreadProps(__spreadValues({
ref,
id: formMessageId,
className: cn("text-[0.8rem] font-medium text-destructive", className)
}, props), {
children: body
})
);
});
FormMessage.displayName = "FormMessage";
// src/components/dataDisplay/ErrorMessage/ErrorMessage.tsx
import { jsx as jsx18 } from "react/jsx-runtime";
var ErrorMessage = ({ children }) => {
return /* @__PURE__ */ jsx18("p", { className: "text-sm font-medium text-destructive", children });
};
// src/components/dataInput/checkbox/Checkbox.tsx
import { jsx as jsx19, jsxs as jsxs9 } from "react/jsx-runtime";
var Checkbox2 = (_a) => {
var _b = _a, {
label,
error,
withoutForm
} = _b, props = __objRest(_b, [
"label",
"error",
"withoutForm"
]);
var _a2;
const form = useFormContext3();
const hasForm = !withoutForm && !!form && !!props.name;
if (!hasForm)
return /* @__PURE__ */ jsxs9("div", { className: "flex items-center space-x-2", children: [
/* @__PURE__ */ jsx19(Checkbox, __spreadValues({}, props)),
label && /* @__PURE__ */ jsx19(Label3, { htmlFor: props.id, children: label }),
error && /* @__PURE__ */ jsx19(ErrorMessage, { children: error })
] });
return /* @__PURE__ */ jsx19(
FormField,
{
control: form.control,
name: (_a2 = props.name) != null ? _a2 : "",
render: ({ field }) => /* @__PURE__ */ jsxs9(FormItem, { className: "flex flex-row items-start space-x-3 space-y-0 rounded-md border p-4", children: [
/* @__PURE__ */ jsx19(FormControl, { children: /* @__PURE__ */ jsx19(
Checkbox,
{
checked: field.value,
onCheckedChange: field.onChange
}
) }),
label && /* @__PURE__ */ jsx19("div", { className: "space-y-1 leading-none", children: /* @__PURE__ */ jsx19(FormLabel, { children: label }) })
] })
}
);
};
// src/components/ui/input.tsx
import * as React11 from "react";
import { jsx as jsx20 } from "react/jsx-runtime";
var Input = React11.forwardRef(
(_a, ref) => {
var _b = _a, { className, type } = _b, props = __objRest(_b, ["className", "type"]);
return /* @__PURE__ */ jsx20(
"input",
__spreadValues({
type,
className: cn(
"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
className
),
ref
}, props)
);
}
);
Input.displayName = "Input";
// src/components/dataInput/Input/components/Input/index.tsx
import { useMemo as useMemo4 } from "react";
// src/components/feedback/ErrorLabel/index.tsx
import { jsx as jsx21, jsxs as jsxs10 } from "react/jsx-runtime";
var ErrorLabel = ({
children,
className,
"data-testid": dataTestId
}) => {
return /* @__PURE__ */ jsxs10(
"div",
{
className: cn("flex items-center gap-2 my-2", className),
"data-testid": `${dataTestId}-error-label`,
children: [
/* @__PURE__ */ jsx21(Icon2, { name: "MdErrorOutline", size: 18, className: "text-destructive" }),
/* @__PURE__ */ jsx21("span", { className: "text-destructive text-sm", children })
]
}
);
};
// src/components/dataInput/Input/components/InputBase/index.tsx
import { jsx as jsx22, jsxs as jsxs11 } from "react/jsx-runtime";
var InputBase = ({
label,
error,
children,
required,
"data-testid": testId
}) => {
return /* @__PURE__ */ jsxs11("div", { children: [
label && /* @__PURE__ */ jsxs11(Label3, { "data-testid": `${testId}-label`, children: [
`${label} ${required ? "*" : ""}`,
" "
] }),
children,
error && /* @__PURE__ */ jsx22(ErrorLabel, { "data-testid": testId, children: error })
] });
};
// src/hooks/use-conditional-controller.tsx
import { useMemo as useMemo3 } from "react";
import {
useController,
useForm,
useFormContext as useFormContext4
} from "react-hook-form";
var useConditionalController = ({
name,
withoutForm
}) => {
const form = useFormContext4();
const hasForm = useMemo3(() => {
return !withoutForm && !!(form == null ? void 0 : form.control);
}, [withoutForm, form]);
const tempForm = useForm();
const controlToUse = useMemo3(() => {
return hasForm ? form.control : tempForm.control;
}, [tempForm, form, hasForm]);
const controller = useController({
control: controlToUse,
name: name || "temp"
});
return hasForm ? controller.field : {};
};
// src/components/dataInput/Input/components/Input/index.tsx
import { jsx as jsx23, jsxs as jsxs12 } from "react/jsx-runtime";
var Input2 = (_a) => {
var _b = _a, {
"data-testid": dataTestId,
withoutForm = false,
extraElement,
containerClassName
} = _b, props = __objRest(_b, [
"data-testid",
"withoutForm",
"extraElement",
"containerClassName"
]);
const formData = useConditionalController({
name: props.name || "",
withoutForm
});
const inputProps = useMemo4(() => {
return __spreadValues(__spreadValues({}, formData), props);
}, [formData, props]);
return /* @__PURE__ */ jsx23(
InputBase,
{
label: props.label,
error: props.error,
required: props.required,
"data-testid": dataTestId,
children: /* @__PURE__ */ jsxs12("div", { className: cn("flex items-center gap-2", containerClassName), children: [
/* @__PURE__ */ jsx23(
Input,
__spreadProps(__spreadValues({}, inputProps), {
"data-testid": dataTestId,
className: cn(
props.className,
props.error && "border-destructive focus:border-destructive focus-visible:ring-0"
)
})
),
extraElement
] })
}
);
};
// src/components/dataInput/Input/components/NumberInput/number-input.tsx
import {
NumericFormat
} from "react-number-format";
import { useCallback as useCallback2, useMemo as useMemo5 } from "react";
import { jsx as jsx24 } from "react/jsx-runtime";
var NumberInput = (props) => {
const formData = useConditionalController({
name: props.name || "",
withoutForm: props.withoutForm
});
const inputProps = useMemo5(() => {
return __spreadValues(__spreadValues({}, formData), props);
}, [formData, props]);
const onValueChange = useCallback2(
(data, sourceInfo) => {
var _a, _b;
const syntheticEvent = {
target: {
value: data.formattedValue,
name: props.name
},
currentTarget: {
value: data.formattedValue,
name: props.name
}
};
(_a = props.onChange) == null ? void 0 : _a.call(props, syntheticEvent);
(_b = props.onValueChange) == null ? void 0 : _b.call(props, data, sourceInfo);
if (formData.onChange) {
formData.onChange(data.formattedValue);
}
},
[props, formData]
);
return /* @__PURE__ */ jsx24(InputBase, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsx24(
NumericFormat,
__spreadProps(__spreadVa