@juv/codego-react-ui 3.4.1 → 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) => {
@@ -12908,6 +12907,13 @@ var setupInterceptors = () => {
12908
12907
  // src/lib/codego/provider.tsx
12909
12908
  var React51 = __toESM(require("react"), 1);
12910
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
+ }
12911
12917
 
12912
12918
  // src/lib/codego/index.ts
12913
12919
  setupInterceptors();
@@ -12974,6 +12980,7 @@ function createStore(initialValue, sessionName, expireInterval) {
12974
12980
  ChartWidget,
12975
12981
  Checkbox,
12976
12982
  CircularProgress,
12983
+ CodegoApiProvider,
12977
12984
  ColorPicker,
12978
12985
  Combobox,
12979
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 };
@@ -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) => {
@@ -76464,6 +76463,13 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
76464
76463
  // src/lib/codego/provider.tsx
76465
76464
  var React53 = __toESM(require_react(), 1);
76466
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
+ }
76467
76473
 
76468
76474
  // src/lib/codego/index.ts
76469
76475
  setupInterceptors();
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) => {
@@ -12788,6 +12786,13 @@ var setupInterceptors = () => {
12788
12786
  // src/lib/codego/provider.tsx
12789
12787
  import * as React51 from "react";
12790
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
+ }
12791
12796
 
12792
12797
  // src/lib/codego/index.ts
12793
12798
  setupInterceptors();
@@ -12853,6 +12858,7 @@ export {
12853
12858
  ChartWidget,
12854
12859
  Checkbox,
12855
12860
  CircularProgress,
12861
+ CodegoApiProvider,
12856
12862
  ColorPicker,
12857
12863
  Combobox,
12858
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.1",
7
+ "version": "3.4.2",
8
8
  "description": "Reusable React UI components",
9
9
  "license": "MIT",
10
10
  "main": "dist/index.js",