@juv/codego-react-ui 3.4.0 → 3.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -49,6 +49,7 @@ __export(index_exports, {
49
49
  ChartWidget: () => ChartWidget,
50
50
  Checkbox: () => Checkbox,
51
51
  CircularProgress: () => CircularProgress,
52
+ CodegoApiProvider: () => CodegoApiProvider,
52
53
  ColorPicker: () => ColorPicker,
53
54
  Combobox: () => Combobox,
54
55
  CommandPalette: () => CommandPalette,
@@ -6405,16 +6406,6 @@ var import_react_dom2 = require("react-dom");
6405
6406
  var import_axios3 = __toESM(require("axios"), 1);
6406
6407
  var import_lucide_react17 = require("lucide-react");
6407
6408
  var import_jsx_runtime32 = require("react/jsx-runtime");
6408
- var csrfAxios = import_axios3.default.create();
6409
- csrfAxios.interceptors.request.use((config) => {
6410
- const method = (config.method ?? "").toUpperCase();
6411
- if (["POST", "PUT", "PATCH", "DELETE"].includes(method)) {
6412
- const token = document.querySelector('meta[name="csrf-token"]')?.getAttribute("content");
6413
- if (!token) throw new Error('[Table] CSRF token not found. Add <meta name="csrf-token" content="..."> to your HTML <head>.');
6414
- config.headers.set("X-CSRF-Token", token);
6415
- }
6416
- return config;
6417
- });
6418
6409
  function useServerTable({ url, params, encrypt, key, decryptPayloadLog, columnOverrides, debounce = 300, transform, manual = false, refresh: refreshEnabled = false, refreshInterval = 0, hardReload, onSuccess, onError }) {
6419
6410
  const [data, setData] = React28.useState([]);
6420
6411
  const [columns, setColumns] = React28.useState([]);
@@ -6564,6 +6555,7 @@ function validateField(field, value) {
6564
6555
  return null;
6565
6556
  }
6566
6557
  function FieldRenderer({ field, value, onChange }) {
6558
+ if (field.component) return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children: field.component });
6567
6559
  if (field.render) return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children: field.render(value, onChange) });
6568
6560
  const toLabelValue = (o) => {
6569
6561
  if (typeof o === "string") return { label: o, value: o };
@@ -6710,7 +6702,7 @@ function ViewModal({
6710
6702
  footer: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Button, { variant: "outline", size: "sm", onClick: onClose, children: "Close" }),
6711
6703
  children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "space-y-3", children: fields.map((f) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { children: [
6712
6704
  /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-xs font-semibold text-muted-foreground mb-1", children: f.label }),
6713
- f.render ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children: f.render(item[f.key], () => {
6705
+ f.component ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children: f.component }) : f.render ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children: f.render(item[f.key], () => {
6714
6706
  }) }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-sm text-foreground break-words", children: item[f.key] === null || item[f.key] === void 0 || item[f.key] === "" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-muted-foreground italic", children: "\u2014" }) : String(item[f.key]) })
6715
6707
  ] }, f.key)) })
6716
6708
  }
@@ -6753,7 +6745,9 @@ function EditModal({
6753
6745
  setLoading(true);
6754
6746
  setError(null);
6755
6747
  try {
6756
- await csrfAxios.put(`${baseUrl}/${itemId}/update`, form);
6748
+ const csrfToken = document.querySelector('meta[name="csrf-token"]')?.getAttribute("content");
6749
+ if (!csrfToken) throw new Error("[Table] CSRF token not found.");
6750
+ await import_axios3.default.put(`${baseUrl}/${itemId}/update`, { ...form, csrfToken }, { headers: { "X-CSRF-Token": csrfToken } });
6757
6751
  const updated = { ...item, ...form };
6758
6752
  if (notif && (notif.type ?? "toast") === "notification") {
6759
6753
  setBanner(true);
@@ -6794,14 +6788,14 @@ function EditModal({
6794
6788
  ),
6795
6789
  notif.action && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { children: notif.action })
6796
6790
  ] }),
6797
- fields.map((f) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
6791
+ fields.map((f) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
6798
6792
  "div",
6799
6793
  {
6800
6794
  style: {
6801
6795
  ...f.colSpan ? { gridColumn: `span ${f.colSpan}` } : {},
6802
6796
  ...f.rowSpan ? { gridRow: `span ${f.rowSpan}` } : {}
6803
6797
  },
6804
- children: [
6798
+ children: f.component ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children: f.component }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
6805
6799
  f.type !== "checkbox" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "block text-xs font-semibold text-muted-foreground mb-1", children: [
6806
6800
  f.label,
6807
6801
  f.required && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-danger ml-0.5", children: "*" })
@@ -6821,7 +6815,7 @@ function EditModal({
6821
6815
  }
6822
6816
  ),
6823
6817
  fieldErrors[f.key] && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-xs text-danger mt-1", children: fieldErrors[f.key] })
6824
- ]
6818
+ ] })
6825
6819
  },
6826
6820
  f.key
6827
6821
  )),
@@ -6844,7 +6838,9 @@ function DeleteModal({
6844
6838
  setLoading(true);
6845
6839
  setError(null);
6846
6840
  try {
6847
- await csrfAxios.delete(`${baseUrl}/${itemId}/delete`);
6841
+ const csrfToken = document.querySelector('meta[name="csrf-token"]')?.getAttribute("content");
6842
+ if (!csrfToken) throw new Error("[Table] CSRF token not found.");
6843
+ await import_axios3.default.delete(`${baseUrl}/${itemId}/delete?csrfToken=${encodeURIComponent(csrfToken)}`, { headers: { "X-CSRF-Token": csrfToken } });
6848
6844
  onSuccess?.(item);
6849
6845
  onClose();
6850
6846
  } catch (err) {
@@ -12865,6 +12861,9 @@ var request = async (config) => {
12865
12861
 
12866
12862
  // src/lib/codego/interceptors.ts
12867
12863
  var toastFn = null;
12864
+ var setToastFunction = (fn) => {
12865
+ toastFn = fn;
12866
+ };
12868
12867
  var setupInterceptors = () => {
12869
12868
  axiosInstance.interceptors.request.use(
12870
12869
  (config) => {
@@ -12880,7 +12879,7 @@ var setupInterceptors = () => {
12880
12879
  (response) => {
12881
12880
  const config = response.config;
12882
12881
  if (config.onSuccessNotification && toastFn) {
12883
- toastFn.toast({
12882
+ toastFn({
12884
12883
  variant: "success",
12885
12884
  title: config.successNotifTitle || "Success",
12886
12885
  description: config.successNotifContent || "Operation completed successfully"
@@ -12891,7 +12890,7 @@ var setupInterceptors = () => {
12891
12890
  (error) => {
12892
12891
  const config = error.config;
12893
12892
  if (config?.onErrorNotification && toastFn) {
12894
- toastFn.toast({
12893
+ toastFn({
12895
12894
  variant: "error",
12896
12895
  title: config.errorNotifTitle || "Error",
12897
12896
  description: config.errorNotifContent || error.response?.data?.message || "Something went wrong"
@@ -12905,6 +12904,17 @@ var setupInterceptors = () => {
12905
12904
  );
12906
12905
  };
12907
12906
 
12907
+ // src/lib/codego/provider.tsx
12908
+ var React51 = __toESM(require("react"), 1);
12909
+ var import_jsx_runtime63 = require("react/jsx-runtime");
12910
+ function CodegoApiProvider({ children }) {
12911
+ const { toast } = useToast();
12912
+ React51.useEffect(() => {
12913
+ setToastFunction(toast);
12914
+ }, [toast]);
12915
+ return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_jsx_runtime63.Fragment, { children });
12916
+ }
12917
+
12908
12918
  // src/lib/codego/index.ts
12909
12919
  setupInterceptors();
12910
12920
  var api = {
@@ -12970,6 +12980,7 @@ function createStore(initialValue, sessionName, expireInterval) {
12970
12980
  ChartWidget,
12971
12981
  Checkbox,
12972
12982
  CircularProgress,
12983
+ CodegoApiProvider,
12973
12984
  ColorPicker,
12974
12985
  Combobox,
12975
12986
  CommandPalette,
package/dist/index.d.cts CHANGED
@@ -360,6 +360,8 @@ interface ActionField {
360
360
  rowSpan?: number;
361
361
  /** Custom render — overrides built-in field renderer */
362
362
  render?: (value: any, onChange: (v: any) => void) => React.ReactNode;
363
+ /** Drop-in React component — rendered as-is, bypasses label and built-in renderer. Use for fully custom fields. */
364
+ component?: React.ReactNode;
363
365
  /** Hide this field from view/edit forms */
364
366
  hidden?: boolean;
365
367
  }
@@ -2412,6 +2414,11 @@ interface RequestConfig<T = any> extends AxiosRequestConfig, NotificationConfig
2412
2414
  skipAuth?: boolean;
2413
2415
  }
2414
2416
 
2417
+ /** Mount once inside ToastProvider to enable api toast notifications. */
2418
+ declare function CodegoApiProvider({ children }: {
2419
+ children: React.ReactNode;
2420
+ }): react_jsx_runtime.JSX.Element;
2421
+
2415
2422
  declare const api: {
2416
2423
  get: <R = any>(url: string, config?: RequestConfig) => Promise<R>;
2417
2424
  post: <T = any, R = any>(url: string, data?: T, config?: RequestConfig<T>) => Promise<R>;
@@ -2435,4 +2442,4 @@ type StoreWrapper<T extends object> = {
2435
2442
  */
2436
2443
  declare function createStore<T extends object>(initialValue: T, sessionName: string, expireInterval?: number): StoreWrapper<T>;
2437
2444
 
2438
- export { Accordion, type AccordionItem, type AccordionProps, type AccordionVariant, type ActionField, type ActionFieldType, type AuthField, type AuthVariant, type AuthView, Authentication, type AuthenticationProps, AvatarStack, type AvatarStackProps, Badge, type BadgeProps, type BadgeSize, type BadgeVariant, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, type BulletinAction, BulletinBoard, type BulletinBoardProps, type BulletinColumns, type BulletinEditField, type BulletinItem, type BulletinLayout, BulletinPreview, type BulletinPreviewProps, type BulletinPriority, type BulletinServerPaginationProp, type BulletinVariant, Button, type ButtonProps, COLOR_PALETTE, Calendar, CalendarDateRangePicker, type CalendarDateRangePickerProps, type CalendarDateRangeVariant, type CalendarEvent, type CalendarProps, type CalendarView, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type ChartDataPoint, ChartWidget, type ChartWidgetProps, Checkbox, type CheckboxProps, CircularProgress, type CircularProgressProps, type ClusterVariant, ColorPicker, type ColorPickerProps, type Column, Combobox, type ComboboxOption, type ComboboxProps, type CommandItem, CommandPalette, type CommandPaletteProps, ComposableWidget, type ComposableWidgetProps, type ConfirmVariant, ContextMenu, type ContextMenuItem, type ContextMenuProps, DataGrid, type DataGridColumn, type DataGridProps, DatePickerPopup, type DateRange, DateRangePicker, type DateRangePickerProps, type DefaultActionsConfig, DocsLayout, Drawer, type DrawerProps, type DrawerSide, Dropdown, DropdownItem, DropdownLabel, type DropdownProps, DropdownSeparator, EVENT_COLORS, type FileTypeValidation, FileUpload, type FileUploadProps, type FlexAlign, type FlexDirection, type FlexGap, FlexItem, type FlexItemProps, type FlexJustify, FlexLayout, type FlexLayoutProps, type FlexWrap, type FlyToOptions, type FormField, type FormFieldType, type GridAlign, type GridCols, type GridGap, GridItem, type GridItemProps, GridLayout, type GridLayoutProps, GroupNavigation, type GroupNavigationProps, type ImageEditorMode, type ImageEditorOptions, Input, type InputProps, KanbanBoard, type KanbanBoardProps, type KanbanCard, type KanbanColumn, Label, LeafletMap, type LeafletMapProps, LeftSidebar, type LeftSidebarProps, type MapLibreClusterVariant, MapLibreMap, type MapLibreMarker, type MapLibreProps, type MapLibreRoute, type MapLibreRouteType, type MapLibreStyle, type MapMarker, type MapRoute, type MarkerColor, type MetricItem, MetricRow, type MetricRowProps, Modal, ModalConfirmation, type ModalConfirmationProps, type ModalProps, ModalUnchange, type ModalUnchangeProps, ModalWithForms, type ModalWithFormsProps, type NavGroup, type NavItem, Navigation, type NavigationProps, NotificationBanner, type NotificationBannerProps, type NotificationItem, NotificationPanel, type NotificationPanelProps, type NotificationVariant, OtpInput, type OtpInputProps, Pagination, type PaginationProps, Panel, type PanelProps, PanelSettings, type PanelSettingsProps, type PanelSettingsTab, PanelSidebarGroup, PanelSidebarItem, Popover, type PopoverPlacement, type PopoverProps, Progress, type ProgressProps, type ProgressSize, type ProgressVariant, type PropRow, PropsTable, RadioGroup, type RadioGroupProps, type RadioOption, type RadioSize, type RadioVariant, RangeSlider, type RangeSliderProps, Repeater, type RepeaterProps, type RequestConfig, ResizablePanels, type ResizablePanelsProps, RichTextEditor, type RichTextEditorProps, RightSidebar, type RightSidebarProps, type RouteType, ScrollArea, type ScrollAreaProps, Section, SectionBlock, type SectionProps, type SectionVariant, Select, type SelectOption, type SelectProps, type SemanticColor, type ServerDataGridProp, type ServerPagination, type ServerPaginationLink, type ServerPaginationProp, type ServerTableResponse, Skeleton, Slider, type SliderProps, type SortDir, StatCard, type StatCardProps, type StatTrend, StatsWidget, type StatsWidgetProps, type Step, type StepStatus, Stepper, type StepperProps, type TabItem, type TabSize, type TabVariant, Table, TableOfContents, type TableProps, TableWidget, type TableWidgetProps, Tabs, type TabsProps, TagInput, type TagInputProps, Textarea, type TextareaProps, type ThemeColors, ThemeProvider, type ThemeSettings, Timeline, type TimelineItem, type TimelineProps, type TimelineVariant, type ToastItem, type ToastPosition, ToastProvider, type ToastProviderProps, type ToastVariant, type TocItem, TocProvider, ToggleSwitch, type ToggleSwitchProps, Tooltip, type TooltipProps, Topbar, type TopbarProps, type TreeNode, TreeView, type TreeViewProps, type TrendDir, type UseServerBulletinOptions, type UseServerBulletinReturn, type UseServerDataGridOptions, type UseServerDataGridReturn, type UseServerTableOptions, type UseServerTableReturn, Widget, type WidgetProps, Wizard, type WizardActionProps, type WizardLayout, type WizardProps, type WizardSize, type WizardStep, type WizardVariant, api, createStore, useServerBulletin, useServerDataGrid, useServerTable, useTheme, useToast, useToc };
2445
+ export { Accordion, type AccordionItem, type AccordionProps, type AccordionVariant, type ActionField, type ActionFieldType, type AuthField, type AuthVariant, type AuthView, Authentication, type AuthenticationProps, AvatarStack, type AvatarStackProps, Badge, type BadgeProps, type BadgeSize, type BadgeVariant, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, type BulletinAction, BulletinBoard, type BulletinBoardProps, type BulletinColumns, type BulletinEditField, type BulletinItem, type BulletinLayout, BulletinPreview, type BulletinPreviewProps, type BulletinPriority, type BulletinServerPaginationProp, type BulletinVariant, Button, type ButtonProps, COLOR_PALETTE, Calendar, CalendarDateRangePicker, type CalendarDateRangePickerProps, type CalendarDateRangeVariant, type CalendarEvent, type CalendarProps, type CalendarView, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type ChartDataPoint, ChartWidget, type ChartWidgetProps, Checkbox, type CheckboxProps, CircularProgress, type CircularProgressProps, type ClusterVariant, CodegoApiProvider, ColorPicker, type ColorPickerProps, type Column, Combobox, type ComboboxOption, type ComboboxProps, type CommandItem, CommandPalette, type CommandPaletteProps, ComposableWidget, type ComposableWidgetProps, type ConfirmVariant, ContextMenu, type ContextMenuItem, type ContextMenuProps, DataGrid, type DataGridColumn, type DataGridProps, DatePickerPopup, type DateRange, DateRangePicker, type DateRangePickerProps, type DefaultActionsConfig, DocsLayout, Drawer, type DrawerProps, type DrawerSide, Dropdown, DropdownItem, DropdownLabel, type DropdownProps, DropdownSeparator, EVENT_COLORS, type FileTypeValidation, FileUpload, type FileUploadProps, type FlexAlign, type FlexDirection, type FlexGap, FlexItem, type FlexItemProps, type FlexJustify, FlexLayout, type FlexLayoutProps, type FlexWrap, type FlyToOptions, type FormField, type FormFieldType, type GridAlign, type GridCols, type GridGap, GridItem, type GridItemProps, GridLayout, type GridLayoutProps, GroupNavigation, type GroupNavigationProps, type ImageEditorMode, type ImageEditorOptions, Input, type InputProps, KanbanBoard, type KanbanBoardProps, type KanbanCard, type KanbanColumn, Label, LeafletMap, type LeafletMapProps, LeftSidebar, type LeftSidebarProps, type MapLibreClusterVariant, MapLibreMap, type MapLibreMarker, type MapLibreProps, type MapLibreRoute, type MapLibreRouteType, type MapLibreStyle, type MapMarker, type MapRoute, type MarkerColor, type MetricItem, MetricRow, type MetricRowProps, Modal, ModalConfirmation, type ModalConfirmationProps, type ModalProps, ModalUnchange, type ModalUnchangeProps, ModalWithForms, type ModalWithFormsProps, type NavGroup, type NavItem, Navigation, type NavigationProps, NotificationBanner, type NotificationBannerProps, type NotificationItem, NotificationPanel, type NotificationPanelProps, type NotificationVariant, OtpInput, type OtpInputProps, Pagination, type PaginationProps, Panel, type PanelProps, PanelSettings, type PanelSettingsProps, type PanelSettingsTab, PanelSidebarGroup, PanelSidebarItem, Popover, type PopoverPlacement, type PopoverProps, Progress, type ProgressProps, type ProgressSize, type ProgressVariant, type PropRow, PropsTable, RadioGroup, type RadioGroupProps, type RadioOption, type RadioSize, type RadioVariant, RangeSlider, type RangeSliderProps, Repeater, type RepeaterProps, type RequestConfig, ResizablePanels, type ResizablePanelsProps, RichTextEditor, type RichTextEditorProps, RightSidebar, type RightSidebarProps, type RouteType, ScrollArea, type ScrollAreaProps, Section, SectionBlock, type SectionProps, type SectionVariant, Select, type SelectOption, type SelectProps, type SemanticColor, type ServerDataGridProp, type ServerPagination, type ServerPaginationLink, type ServerPaginationProp, type ServerTableResponse, Skeleton, Slider, type SliderProps, type SortDir, StatCard, type StatCardProps, type StatTrend, StatsWidget, type StatsWidgetProps, type Step, type StepStatus, Stepper, type StepperProps, type TabItem, type TabSize, type TabVariant, Table, TableOfContents, type TableProps, TableWidget, type TableWidgetProps, Tabs, type TabsProps, TagInput, type TagInputProps, Textarea, type TextareaProps, type ThemeColors, ThemeProvider, type ThemeSettings, Timeline, type TimelineItem, type TimelineProps, type TimelineVariant, type ToastItem, type ToastPosition, ToastProvider, type ToastProviderProps, type ToastVariant, type TocItem, TocProvider, ToggleSwitch, type ToggleSwitchProps, Tooltip, type TooltipProps, Topbar, type TopbarProps, type TreeNode, TreeView, type TreeViewProps, type TrendDir, type UseServerBulletinOptions, type UseServerBulletinReturn, type UseServerDataGridOptions, type UseServerDataGridReturn, type UseServerTableOptions, type UseServerTableReturn, Widget, type WidgetProps, Wizard, type WizardActionProps, type WizardLayout, type WizardProps, type WizardSize, type WizardStep, type WizardVariant, api, createStore, useServerBulletin, useServerDataGrid, useServerTable, useTheme, useToast, useToc };
package/dist/index.d.ts CHANGED
@@ -360,6 +360,8 @@ interface ActionField {
360
360
  rowSpan?: number;
361
361
  /** Custom render — overrides built-in field renderer */
362
362
  render?: (value: any, onChange: (v: any) => void) => React.ReactNode;
363
+ /** Drop-in React component — rendered as-is, bypasses label and built-in renderer. Use for fully custom fields. */
364
+ component?: React.ReactNode;
363
365
  /** Hide this field from view/edit forms */
364
366
  hidden?: boolean;
365
367
  }
@@ -2412,6 +2414,11 @@ interface RequestConfig<T = any> extends AxiosRequestConfig, NotificationConfig
2412
2414
  skipAuth?: boolean;
2413
2415
  }
2414
2416
 
2417
+ /** Mount once inside ToastProvider to enable api toast notifications. */
2418
+ declare function CodegoApiProvider({ children }: {
2419
+ children: React.ReactNode;
2420
+ }): react_jsx_runtime.JSX.Element;
2421
+
2415
2422
  declare const api: {
2416
2423
  get: <R = any>(url: string, config?: RequestConfig) => Promise<R>;
2417
2424
  post: <T = any, R = any>(url: string, data?: T, config?: RequestConfig<T>) => Promise<R>;
@@ -2435,4 +2442,4 @@ type StoreWrapper<T extends object> = {
2435
2442
  */
2436
2443
  declare function createStore<T extends object>(initialValue: T, sessionName: string, expireInterval?: number): StoreWrapper<T>;
2437
2444
 
2438
- export { Accordion, type AccordionItem, type AccordionProps, type AccordionVariant, type ActionField, type ActionFieldType, type AuthField, type AuthVariant, type AuthView, Authentication, type AuthenticationProps, AvatarStack, type AvatarStackProps, Badge, type BadgeProps, type BadgeSize, type BadgeVariant, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, type BulletinAction, BulletinBoard, type BulletinBoardProps, type BulletinColumns, type BulletinEditField, type BulletinItem, type BulletinLayout, BulletinPreview, type BulletinPreviewProps, type BulletinPriority, type BulletinServerPaginationProp, type BulletinVariant, Button, type ButtonProps, COLOR_PALETTE, Calendar, CalendarDateRangePicker, type CalendarDateRangePickerProps, type CalendarDateRangeVariant, type CalendarEvent, type CalendarProps, type CalendarView, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type ChartDataPoint, ChartWidget, type ChartWidgetProps, Checkbox, type CheckboxProps, CircularProgress, type CircularProgressProps, type ClusterVariant, ColorPicker, type ColorPickerProps, type Column, Combobox, type ComboboxOption, type ComboboxProps, type CommandItem, CommandPalette, type CommandPaletteProps, ComposableWidget, type ComposableWidgetProps, type ConfirmVariant, ContextMenu, type ContextMenuItem, type ContextMenuProps, DataGrid, type DataGridColumn, type DataGridProps, DatePickerPopup, type DateRange, DateRangePicker, type DateRangePickerProps, type DefaultActionsConfig, DocsLayout, Drawer, type DrawerProps, type DrawerSide, Dropdown, DropdownItem, DropdownLabel, type DropdownProps, DropdownSeparator, EVENT_COLORS, type FileTypeValidation, FileUpload, type FileUploadProps, type FlexAlign, type FlexDirection, type FlexGap, FlexItem, type FlexItemProps, type FlexJustify, FlexLayout, type FlexLayoutProps, type FlexWrap, type FlyToOptions, type FormField, type FormFieldType, type GridAlign, type GridCols, type GridGap, GridItem, type GridItemProps, GridLayout, type GridLayoutProps, GroupNavigation, type GroupNavigationProps, type ImageEditorMode, type ImageEditorOptions, Input, type InputProps, KanbanBoard, type KanbanBoardProps, type KanbanCard, type KanbanColumn, Label, LeafletMap, type LeafletMapProps, LeftSidebar, type LeftSidebarProps, type MapLibreClusterVariant, MapLibreMap, type MapLibreMarker, type MapLibreProps, type MapLibreRoute, type MapLibreRouteType, type MapLibreStyle, type MapMarker, type MapRoute, type MarkerColor, type MetricItem, MetricRow, type MetricRowProps, Modal, ModalConfirmation, type ModalConfirmationProps, type ModalProps, ModalUnchange, type ModalUnchangeProps, ModalWithForms, type ModalWithFormsProps, type NavGroup, type NavItem, Navigation, type NavigationProps, NotificationBanner, type NotificationBannerProps, type NotificationItem, NotificationPanel, type NotificationPanelProps, type NotificationVariant, OtpInput, type OtpInputProps, Pagination, type PaginationProps, Panel, type PanelProps, PanelSettings, type PanelSettingsProps, type PanelSettingsTab, PanelSidebarGroup, PanelSidebarItem, Popover, type PopoverPlacement, type PopoverProps, Progress, type ProgressProps, type ProgressSize, type ProgressVariant, type PropRow, PropsTable, RadioGroup, type RadioGroupProps, type RadioOption, type RadioSize, type RadioVariant, RangeSlider, type RangeSliderProps, Repeater, type RepeaterProps, type RequestConfig, ResizablePanels, type ResizablePanelsProps, RichTextEditor, type RichTextEditorProps, RightSidebar, type RightSidebarProps, type RouteType, ScrollArea, type ScrollAreaProps, Section, SectionBlock, type SectionProps, type SectionVariant, Select, type SelectOption, type SelectProps, type SemanticColor, type ServerDataGridProp, type ServerPagination, type ServerPaginationLink, type ServerPaginationProp, type ServerTableResponse, Skeleton, Slider, type SliderProps, type SortDir, StatCard, type StatCardProps, type StatTrend, StatsWidget, type StatsWidgetProps, type Step, type StepStatus, Stepper, type StepperProps, type TabItem, type TabSize, type TabVariant, Table, TableOfContents, type TableProps, TableWidget, type TableWidgetProps, Tabs, type TabsProps, TagInput, type TagInputProps, Textarea, type TextareaProps, type ThemeColors, ThemeProvider, type ThemeSettings, Timeline, type TimelineItem, type TimelineProps, type TimelineVariant, type ToastItem, type ToastPosition, ToastProvider, type ToastProviderProps, type ToastVariant, type TocItem, TocProvider, ToggleSwitch, type ToggleSwitchProps, Tooltip, type TooltipProps, Topbar, type TopbarProps, type TreeNode, TreeView, type TreeViewProps, type TrendDir, type UseServerBulletinOptions, type UseServerBulletinReturn, type UseServerDataGridOptions, type UseServerDataGridReturn, type UseServerTableOptions, type UseServerTableReturn, Widget, type WidgetProps, Wizard, type WizardActionProps, type WizardLayout, type WizardProps, type WizardSize, type WizardStep, type WizardVariant, api, createStore, useServerBulletin, useServerDataGrid, useServerTable, useTheme, useToast, useToc };
2445
+ export { Accordion, type AccordionItem, type AccordionProps, type AccordionVariant, type ActionField, type ActionFieldType, type AuthField, type AuthVariant, type AuthView, Authentication, type AuthenticationProps, AvatarStack, type AvatarStackProps, Badge, type BadgeProps, type BadgeSize, type BadgeVariant, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, type BulletinAction, BulletinBoard, type BulletinBoardProps, type BulletinColumns, type BulletinEditField, type BulletinItem, type BulletinLayout, BulletinPreview, type BulletinPreviewProps, type BulletinPriority, type BulletinServerPaginationProp, type BulletinVariant, Button, type ButtonProps, COLOR_PALETTE, Calendar, CalendarDateRangePicker, type CalendarDateRangePickerProps, type CalendarDateRangeVariant, type CalendarEvent, type CalendarProps, type CalendarView, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type ChartDataPoint, ChartWidget, type ChartWidgetProps, Checkbox, type CheckboxProps, CircularProgress, type CircularProgressProps, type ClusterVariant, CodegoApiProvider, ColorPicker, type ColorPickerProps, type Column, Combobox, type ComboboxOption, type ComboboxProps, type CommandItem, CommandPalette, type CommandPaletteProps, ComposableWidget, type ComposableWidgetProps, type ConfirmVariant, ContextMenu, type ContextMenuItem, type ContextMenuProps, DataGrid, type DataGridColumn, type DataGridProps, DatePickerPopup, type DateRange, DateRangePicker, type DateRangePickerProps, type DefaultActionsConfig, DocsLayout, Drawer, type DrawerProps, type DrawerSide, Dropdown, DropdownItem, DropdownLabel, type DropdownProps, DropdownSeparator, EVENT_COLORS, type FileTypeValidation, FileUpload, type FileUploadProps, type FlexAlign, type FlexDirection, type FlexGap, FlexItem, type FlexItemProps, type FlexJustify, FlexLayout, type FlexLayoutProps, type FlexWrap, type FlyToOptions, type FormField, type FormFieldType, type GridAlign, type GridCols, type GridGap, GridItem, type GridItemProps, GridLayout, type GridLayoutProps, GroupNavigation, type GroupNavigationProps, type ImageEditorMode, type ImageEditorOptions, Input, type InputProps, KanbanBoard, type KanbanBoardProps, type KanbanCard, type KanbanColumn, Label, LeafletMap, type LeafletMapProps, LeftSidebar, type LeftSidebarProps, type MapLibreClusterVariant, MapLibreMap, type MapLibreMarker, type MapLibreProps, type MapLibreRoute, type MapLibreRouteType, type MapLibreStyle, type MapMarker, type MapRoute, type MarkerColor, type MetricItem, MetricRow, type MetricRowProps, Modal, ModalConfirmation, type ModalConfirmationProps, type ModalProps, ModalUnchange, type ModalUnchangeProps, ModalWithForms, type ModalWithFormsProps, type NavGroup, type NavItem, Navigation, type NavigationProps, NotificationBanner, type NotificationBannerProps, type NotificationItem, NotificationPanel, type NotificationPanelProps, type NotificationVariant, OtpInput, type OtpInputProps, Pagination, type PaginationProps, Panel, type PanelProps, PanelSettings, type PanelSettingsProps, type PanelSettingsTab, PanelSidebarGroup, PanelSidebarItem, Popover, type PopoverPlacement, type PopoverProps, Progress, type ProgressProps, type ProgressSize, type ProgressVariant, type PropRow, PropsTable, RadioGroup, type RadioGroupProps, type RadioOption, type RadioSize, type RadioVariant, RangeSlider, type RangeSliderProps, Repeater, type RepeaterProps, type RequestConfig, ResizablePanels, type ResizablePanelsProps, RichTextEditor, type RichTextEditorProps, RightSidebar, type RightSidebarProps, type RouteType, ScrollArea, type ScrollAreaProps, Section, SectionBlock, type SectionProps, type SectionVariant, Select, type SelectOption, type SelectProps, type SemanticColor, type ServerDataGridProp, type ServerPagination, type ServerPaginationLink, type ServerPaginationProp, type ServerTableResponse, Skeleton, Slider, type SliderProps, type SortDir, StatCard, type StatCardProps, type StatTrend, StatsWidget, type StatsWidgetProps, type Step, type StepStatus, Stepper, type StepperProps, type TabItem, type TabSize, type TabVariant, Table, TableOfContents, type TableProps, TableWidget, type TableWidgetProps, Tabs, type TabsProps, TagInput, type TagInputProps, Textarea, type TextareaProps, type ThemeColors, ThemeProvider, type ThemeSettings, Timeline, type TimelineItem, type TimelineProps, type TimelineVariant, type ToastItem, type ToastPosition, ToastProvider, type ToastProviderProps, type ToastVariant, type TocItem, TocProvider, ToggleSwitch, type ToggleSwitchProps, Tooltip, type TooltipProps, Topbar, type TopbarProps, type TreeNode, TreeView, type TreeViewProps, type TrendDir, type UseServerBulletinOptions, type UseServerBulletinReturn, type UseServerDataGridOptions, type UseServerDataGridReturn, type UseServerTableOptions, type UseServerTableReturn, Widget, type WidgetProps, Wizard, type WizardActionProps, type WizardLayout, type WizardProps, type WizardSize, type WizardStep, type WizardVariant, api, createStore, useServerBulletin, useServerDataGrid, useServerTable, useTheme, useToast, useToc };
@@ -12968,7 +12968,7 @@ var CodegoUI = (() => {
12968
12968
  var require_react_dom_production = __commonJS({
12969
12969
  "node_modules/react-dom/cjs/react-dom.production.js"(exports) {
12970
12970
  "use strict";
12971
- var React54 = require_react();
12971
+ var React55 = require_react();
12972
12972
  function formatProdErrorMessage(code) {
12973
12973
  var url2 = "https://react.dev/errors/" + code;
12974
12974
  if (1 < arguments.length) {
@@ -13008,7 +13008,7 @@ var CodegoUI = (() => {
13008
13008
  implementation
13009
13009
  };
13010
13010
  }
13011
- var ReactSharedInternals = React54.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
13011
+ var ReactSharedInternals = React55.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
13012
13012
  function getCrossOriginStringAs(as, input) {
13013
13013
  if ("font" === as) return "";
13014
13014
  if ("string" === typeof input)
@@ -13162,7 +13162,7 @@ var CodegoUI = (() => {
13162
13162
  return dispatcher;
13163
13163
  }
13164
13164
  "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
13165
- var React54 = require_react(), Internals = {
13165
+ var React55 = require_react(), Internals = {
13166
13166
  d: {
13167
13167
  f: noop2,
13168
13168
  r: function() {
@@ -13180,7 +13180,7 @@ var CodegoUI = (() => {
13180
13180
  },
13181
13181
  p: 0,
13182
13182
  findDOMNode: null
13183
- }, REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal"), ReactSharedInternals = React54.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
13183
+ }, REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal"), ReactSharedInternals = React55.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
13184
13184
  "function" === typeof Map && null != Map.prototype && "function" === typeof Map.prototype.forEach && "function" === typeof Set && null != Set.prototype && "function" === typeof Set.prototype.clear && "function" === typeof Set.prototype.forEach || console.error(
13185
13185
  "React depends on Map and Set built-in types. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"
13186
13186
  );
@@ -13627,18 +13627,18 @@ var CodegoUI = (() => {
13627
13627
  function isValidElement(object) {
13628
13628
  return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
13629
13629
  }
13630
- var React54 = require_react(), REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = /* @__PURE__ */ Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = /* @__PURE__ */ Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = /* @__PURE__ */ Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = /* @__PURE__ */ Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo"), REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = /* @__PURE__ */ Symbol.for("react.activity"), REACT_CLIENT_REFERENCE = /* @__PURE__ */ Symbol.for("react.client.reference"), ReactSharedInternals = React54.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty2 = Object.prototype.hasOwnProperty, isArrayImpl = Array.isArray, createTask = console.createTask ? console.createTask : function() {
13630
+ var React55 = require_react(), REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = /* @__PURE__ */ Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = /* @__PURE__ */ Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = /* @__PURE__ */ Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = /* @__PURE__ */ Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo"), REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = /* @__PURE__ */ Symbol.for("react.activity"), REACT_CLIENT_REFERENCE = /* @__PURE__ */ Symbol.for("react.client.reference"), ReactSharedInternals = React55.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty2 = Object.prototype.hasOwnProperty, isArrayImpl = Array.isArray, createTask = console.createTask ? console.createTask : function() {
13631
13631
  return null;
13632
13632
  };
13633
- React54 = {
13633
+ React55 = {
13634
13634
  react_stack_bottom_frame: function(callStackForError) {
13635
13635
  return callStackForError();
13636
13636
  }
13637
13637
  };
13638
13638
  var specialPropKeyWarningShown;
13639
13639
  var didWarnAboutElementRef = {};
13640
- var unknownOwnerDebugStack = React54.react_stack_bottom_frame.bind(
13641
- React54,
13640
+ var unknownOwnerDebugStack = React55.react_stack_bottom_frame.bind(
13641
+ React55,
13642
13642
  UnknownOwner
13643
13643
  )();
13644
13644
  var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
@@ -53652,6 +53652,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
53652
53652
  ChartWidget: () => ChartWidget,
53653
53653
  Checkbox: () => Checkbox,
53654
53654
  CircularProgress: () => CircularProgress,
53655
+ CodegoApiProvider: () => CodegoApiProvider,
53655
53656
  ColorPicker: () => ColorPicker,
53656
53657
  Combobox: () => Combobox,
53657
53658
  CommandPalette: () => CommandPalette,
@@ -69551,16 +69552,6 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
69551
69552
  var React28 = __toESM(require_react(), 1);
69552
69553
  var import_react_dom2 = __toESM(require_react_dom(), 1);
69553
69554
  var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1);
69554
- var csrfAxios = axios_default.create();
69555
- csrfAxios.interceptors.request.use((config) => {
69556
- const method = (config.method ?? "").toUpperCase();
69557
- if (["POST", "PUT", "PATCH", "DELETE"].includes(method)) {
69558
- const token = document.querySelector('meta[name="csrf-token"]')?.getAttribute("content");
69559
- if (!token) throw new Error('[Table] CSRF token not found. Add <meta name="csrf-token" content="..."> to your HTML <head>.');
69560
- config.headers.set("X-CSRF-Token", token);
69561
- }
69562
- return config;
69563
- });
69564
69555
  function useServerTable({ url: url2, params, encrypt, key, decryptPayloadLog, columnOverrides, debounce = 300, transform, manual = false, refresh: refreshEnabled = false, refreshInterval = 0, hardReload, onSuccess, onError }) {
69565
69556
  const [data, setData] = React28.useState([]);
69566
69557
  const [columns, setColumns] = React28.useState([]);
@@ -69710,6 +69701,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
69710
69701
  return null;
69711
69702
  }
69712
69703
  function FieldRenderer({ field, value, onChange }) {
69704
+ if (field.component) return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children: field.component });
69713
69705
  if (field.render) return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children: field.render(value, onChange) });
69714
69706
  const toLabelValue = (o) => {
69715
69707
  if (typeof o === "string") return { label: o, value: o };
@@ -69856,7 +69848,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
69856
69848
  footer: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Button, { variant: "outline", size: "sm", onClick: onClose, children: "Close" }),
69857
69849
  children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "space-y-3", children: fields.map((f) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { children: [
69858
69850
  /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-xs font-semibold text-muted-foreground mb-1", children: f.label }),
69859
- f.render ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children: f.render(item[f.key], () => {
69851
+ f.component ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children: f.component }) : f.render ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children: f.render(item[f.key], () => {
69860
69852
  }) }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-sm text-foreground break-words", children: item[f.key] === null || item[f.key] === void 0 || item[f.key] === "" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-muted-foreground italic", children: "\u2014" }) : String(item[f.key]) })
69861
69853
  ] }, f.key)) })
69862
69854
  }
@@ -69899,7 +69891,9 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
69899
69891
  setLoading(true);
69900
69892
  setError(null);
69901
69893
  try {
69902
- await csrfAxios.put(`${baseUrl}/${itemId}/update`, form);
69894
+ const csrfToken = document.querySelector('meta[name="csrf-token"]')?.getAttribute("content");
69895
+ if (!csrfToken) throw new Error("[Table] CSRF token not found.");
69896
+ await axios_default.put(`${baseUrl}/${itemId}/update`, { ...form, csrfToken }, { headers: { "X-CSRF-Token": csrfToken } });
69903
69897
  const updated = { ...item, ...form };
69904
69898
  if (notif && (notif.type ?? "toast") === "notification") {
69905
69899
  setBanner(true);
@@ -69940,14 +69934,14 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
69940
69934
  ),
69941
69935
  notif.action && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { children: notif.action })
69942
69936
  ] }),
69943
- fields.map((f) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
69937
+ fields.map((f) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
69944
69938
  "div",
69945
69939
  {
69946
69940
  style: {
69947
69941
  ...f.colSpan ? { gridColumn: `span ${f.colSpan}` } : {},
69948
69942
  ...f.rowSpan ? { gridRow: `span ${f.rowSpan}` } : {}
69949
69943
  },
69950
- children: [
69944
+ children: f.component ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children: f.component }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
69951
69945
  f.type !== "checkbox" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("label", { className: "block text-xs font-semibold text-muted-foreground mb-1", children: [
69952
69946
  f.label,
69953
69947
  f.required && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-danger ml-0.5", children: "*" })
@@ -69967,7 +69961,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
69967
69961
  }
69968
69962
  ),
69969
69963
  fieldErrors[f.key] && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("p", { className: "text-xs text-danger mt-1", children: fieldErrors[f.key] })
69970
- ]
69964
+ ] })
69971
69965
  },
69972
69966
  f.key
69973
69967
  )),
@@ -69990,7 +69984,9 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
69990
69984
  setLoading(true);
69991
69985
  setError(null);
69992
69986
  try {
69993
- await csrfAxios.delete(`${baseUrl}/${itemId}/delete`);
69987
+ const csrfToken = document.querySelector('meta[name="csrf-token"]')?.getAttribute("content");
69988
+ if (!csrfToken) throw new Error("[Table] CSRF token not found.");
69989
+ await axios_default.delete(`${baseUrl}/${itemId}/delete?csrfToken=${encodeURIComponent(csrfToken)}`, { headers: { "X-CSRF-Token": csrfToken } });
69994
69990
  onSuccess?.(item);
69995
69991
  onClose();
69996
69992
  } catch (err) {
@@ -76421,6 +76417,9 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
76421
76417
 
76422
76418
  // src/lib/codego/interceptors.ts
76423
76419
  var toastFn = null;
76420
+ var setToastFunction = (fn) => {
76421
+ toastFn = fn;
76422
+ };
76424
76423
  var setupInterceptors = () => {
76425
76424
  axiosInstance.interceptors.request.use(
76426
76425
  (config) => {
@@ -76436,7 +76435,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
76436
76435
  (response) => {
76437
76436
  const config = response.config;
76438
76437
  if (config.onSuccessNotification && toastFn) {
76439
- toastFn.toast({
76438
+ toastFn({
76440
76439
  variant: "success",
76441
76440
  title: config.successNotifTitle || "Success",
76442
76441
  description: config.successNotifContent || "Operation completed successfully"
@@ -76447,7 +76446,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
76447
76446
  (error) => {
76448
76447
  const config = error.config;
76449
76448
  if (config?.onErrorNotification && toastFn) {
76450
- toastFn.toast({
76449
+ toastFn({
76451
76450
  variant: "error",
76452
76451
  title: config.errorNotifTitle || "Error",
76453
76452
  description: config.errorNotifContent || error.response?.data?.message || "Something went wrong"
@@ -76461,6 +76460,17 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
76461
76460
  );
76462
76461
  };
76463
76462
 
76463
+ // src/lib/codego/provider.tsx
76464
+ var React53 = __toESM(require_react(), 1);
76465
+ var import_jsx_runtime63 = __toESM(require_jsx_runtime(), 1);
76466
+ function CodegoApiProvider({ children }) {
76467
+ const { toast } = useToast();
76468
+ React53.useEffect(() => {
76469
+ setToastFunction(toast);
76470
+ }, [toast]);
76471
+ return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_jsx_runtime63.Fragment, { children });
76472
+ }
76473
+
76464
76474
  // src/lib/codego/index.ts
76465
76475
  setupInterceptors();
76466
76476
  var api = {
package/dist/index.js CHANGED
@@ -6285,16 +6285,6 @@ import { createPortal as createPortal3 } from "react-dom";
6285
6285
  import axios3 from "axios";
6286
6286
  import { ChevronLeft as ChevronLeft6, ChevronRight as ChevronRight8, Search as Search5, Trash2 as Trash22, ChevronsUpDown, ChevronUp, ChevronDown as ChevronDown4, X as X9, Eye as Eye2, Pencil as Pencil2, Trash as Trash3, Loader2 as Loader22 } from "lucide-react";
6287
6287
  import { Fragment as Fragment11, jsx as jsx32, jsxs as jsxs30 } from "react/jsx-runtime";
6288
- var csrfAxios = axios3.create();
6289
- csrfAxios.interceptors.request.use((config) => {
6290
- const method = (config.method ?? "").toUpperCase();
6291
- if (["POST", "PUT", "PATCH", "DELETE"].includes(method)) {
6292
- const token = document.querySelector('meta[name="csrf-token"]')?.getAttribute("content");
6293
- if (!token) throw new Error('[Table] CSRF token not found. Add <meta name="csrf-token" content="..."> to your HTML <head>.');
6294
- config.headers.set("X-CSRF-Token", token);
6295
- }
6296
- return config;
6297
- });
6298
6288
  function useServerTable({ url, params, encrypt, key, decryptPayloadLog, columnOverrides, debounce = 300, transform, manual = false, refresh: refreshEnabled = false, refreshInterval = 0, hardReload, onSuccess, onError }) {
6299
6289
  const [data, setData] = React28.useState([]);
6300
6290
  const [columns, setColumns] = React28.useState([]);
@@ -6444,6 +6434,7 @@ function validateField(field, value) {
6444
6434
  return null;
6445
6435
  }
6446
6436
  function FieldRenderer({ field, value, onChange }) {
6437
+ if (field.component) return /* @__PURE__ */ jsx32(Fragment11, { children: field.component });
6447
6438
  if (field.render) return /* @__PURE__ */ jsx32(Fragment11, { children: field.render(value, onChange) });
6448
6439
  const toLabelValue = (o) => {
6449
6440
  if (typeof o === "string") return { label: o, value: o };
@@ -6590,7 +6581,7 @@ function ViewModal({
6590
6581
  footer: /* @__PURE__ */ jsx32(Button, { variant: "outline", size: "sm", onClick: onClose, children: "Close" }),
6591
6582
  children: /* @__PURE__ */ jsx32("div", { className: "space-y-3", children: fields.map((f) => /* @__PURE__ */ jsxs30("div", { children: [
6592
6583
  /* @__PURE__ */ jsx32("p", { className: "text-xs font-semibold text-muted-foreground mb-1", children: f.label }),
6593
- f.render ? /* @__PURE__ */ jsx32(Fragment11, { children: f.render(item[f.key], () => {
6584
+ f.component ? /* @__PURE__ */ jsx32(Fragment11, { children: f.component }) : f.render ? /* @__PURE__ */ jsx32(Fragment11, { children: f.render(item[f.key], () => {
6594
6585
  }) }) : /* @__PURE__ */ jsx32("p", { className: "text-sm text-foreground break-words", children: item[f.key] === null || item[f.key] === void 0 || item[f.key] === "" ? /* @__PURE__ */ jsx32("span", { className: "text-muted-foreground italic", children: "\u2014" }) : String(item[f.key]) })
6595
6586
  ] }, f.key)) })
6596
6587
  }
@@ -6633,7 +6624,9 @@ function EditModal({
6633
6624
  setLoading(true);
6634
6625
  setError(null);
6635
6626
  try {
6636
- await csrfAxios.put(`${baseUrl}/${itemId}/update`, form);
6627
+ const csrfToken = document.querySelector('meta[name="csrf-token"]')?.getAttribute("content");
6628
+ if (!csrfToken) throw new Error("[Table] CSRF token not found.");
6629
+ await axios3.put(`${baseUrl}/${itemId}/update`, { ...form, csrfToken }, { headers: { "X-CSRF-Token": csrfToken } });
6637
6630
  const updated = { ...item, ...form };
6638
6631
  if (notif && (notif.type ?? "toast") === "notification") {
6639
6632
  setBanner(true);
@@ -6674,14 +6667,14 @@ function EditModal({
6674
6667
  ),
6675
6668
  notif.action && /* @__PURE__ */ jsx32("div", { children: notif.action })
6676
6669
  ] }),
6677
- fields.map((f) => /* @__PURE__ */ jsxs30(
6670
+ fields.map((f) => /* @__PURE__ */ jsx32(
6678
6671
  "div",
6679
6672
  {
6680
6673
  style: {
6681
6674
  ...f.colSpan ? { gridColumn: `span ${f.colSpan}` } : {},
6682
6675
  ...f.rowSpan ? { gridRow: `span ${f.rowSpan}` } : {}
6683
6676
  },
6684
- children: [
6677
+ children: f.component ? /* @__PURE__ */ jsx32(Fragment11, { children: f.component }) : /* @__PURE__ */ jsxs30(Fragment11, { children: [
6685
6678
  f.type !== "checkbox" && /* @__PURE__ */ jsxs30("label", { className: "block text-xs font-semibold text-muted-foreground mb-1", children: [
6686
6679
  f.label,
6687
6680
  f.required && /* @__PURE__ */ jsx32("span", { className: "text-danger ml-0.5", children: "*" })
@@ -6701,7 +6694,7 @@ function EditModal({
6701
6694
  }
6702
6695
  ),
6703
6696
  fieldErrors[f.key] && /* @__PURE__ */ jsx32("p", { className: "text-xs text-danger mt-1", children: fieldErrors[f.key] })
6704
- ]
6697
+ ] })
6705
6698
  },
6706
6699
  f.key
6707
6700
  )),
@@ -6724,7 +6717,9 @@ function DeleteModal({
6724
6717
  setLoading(true);
6725
6718
  setError(null);
6726
6719
  try {
6727
- await csrfAxios.delete(`${baseUrl}/${itemId}/delete`);
6720
+ const csrfToken = document.querySelector('meta[name="csrf-token"]')?.getAttribute("content");
6721
+ if (!csrfToken) throw new Error("[Table] CSRF token not found.");
6722
+ await axios3.delete(`${baseUrl}/${itemId}/delete?csrfToken=${encodeURIComponent(csrfToken)}`, { headers: { "X-CSRF-Token": csrfToken } });
6728
6723
  onSuccess?.(item);
6729
6724
  onClose();
6730
6725
  } catch (err) {
@@ -12745,6 +12740,9 @@ var request = async (config) => {
12745
12740
 
12746
12741
  // src/lib/codego/interceptors.ts
12747
12742
  var toastFn = null;
12743
+ var setToastFunction = (fn) => {
12744
+ toastFn = fn;
12745
+ };
12748
12746
  var setupInterceptors = () => {
12749
12747
  axiosInstance.interceptors.request.use(
12750
12748
  (config) => {
@@ -12760,7 +12758,7 @@ var setupInterceptors = () => {
12760
12758
  (response) => {
12761
12759
  const config = response.config;
12762
12760
  if (config.onSuccessNotification && toastFn) {
12763
- toastFn.toast({
12761
+ toastFn({
12764
12762
  variant: "success",
12765
12763
  title: config.successNotifTitle || "Success",
12766
12764
  description: config.successNotifContent || "Operation completed successfully"
@@ -12771,7 +12769,7 @@ var setupInterceptors = () => {
12771
12769
  (error) => {
12772
12770
  const config = error.config;
12773
12771
  if (config?.onErrorNotification && toastFn) {
12774
- toastFn.toast({
12772
+ toastFn({
12775
12773
  variant: "error",
12776
12774
  title: config.errorNotifTitle || "Error",
12777
12775
  description: config.errorNotifContent || error.response?.data?.message || "Something went wrong"
@@ -12785,6 +12783,17 @@ var setupInterceptors = () => {
12785
12783
  );
12786
12784
  };
12787
12785
 
12786
+ // src/lib/codego/provider.tsx
12787
+ import * as React51 from "react";
12788
+ import { Fragment as Fragment21, jsx as jsx63 } from "react/jsx-runtime";
12789
+ function CodegoApiProvider({ children }) {
12790
+ const { toast } = useToast();
12791
+ React51.useEffect(() => {
12792
+ setToastFunction(toast);
12793
+ }, [toast]);
12794
+ return /* @__PURE__ */ jsx63(Fragment21, { children });
12795
+ }
12796
+
12788
12797
  // src/lib/codego/index.ts
12789
12798
  setupInterceptors();
12790
12799
  var api = {
@@ -12849,6 +12858,7 @@ export {
12849
12858
  ChartWidget,
12850
12859
  Checkbox,
12851
12860
  CircularProgress,
12861
+ CodegoApiProvider,
12852
12862
  ColorPicker,
12853
12863
  Combobox,
12854
12864
  CommandPalette,
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "registry": "https://registry.npmjs.org/",
5
5
  "access": "public"
6
6
  },
7
- "version": "3.4.0",
7
+ "version": "3.4.2",
8
8
  "description": "Reusable React UI components",
9
9
  "license": "MIT",
10
10
  "main": "dist/index.js",