@nar-bus/lena-ui-shared 1.3.9 → 1.3.11

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.d.ts CHANGED
@@ -34,6 +34,7 @@ import { Panel } from 'react-resizable-panels';
34
34
  import { Polygon } from 'geojson';
35
35
  import * as PopoverPrimitive from '@radix-ui/react-popover';
36
36
  import * as ProgressPrimitive from '@radix-ui/react-progress';
37
+ import { QueryClient } from '@tanstack/react-query';
37
38
  import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
38
39
  import * as React_2 from 'react';
39
40
  import { ReactNode } from 'react';
@@ -246,6 +247,21 @@ export declare function AvatarFallback({ className, ...props }: React_2.Componen
246
247
 
247
248
  export declare function AvatarImage({ className, ...props }: React_2.ComponentProps<typeof AvatarPrimitive.Image>): JSX.Element;
248
249
 
250
+ /** Backend EnumDefinitionResponse (sadece ihtiyacımız olan alanlar) */
251
+ declare interface BackendEnumDefinition {
252
+ code: string;
253
+ name: string;
254
+ enumValues: CachedEnumValue[] | null;
255
+ }
256
+
257
+ /** Backend PagedResponse wrapper */
258
+ declare interface BackendPagedResponse {
259
+ status: number;
260
+ success: boolean;
261
+ message: string;
262
+ data: BackendEnumDefinition[];
263
+ }
264
+
249
265
  export declare function Badge({ className, variant, asChild, ...props }: React_2.ComponentProps<"span"> & VariantProps<typeof badgeVariants> & {
250
266
  asChild?: boolean;
251
267
  }): JSX.Element;
@@ -382,6 +398,26 @@ export declare const buttonVariants: (props?: ({
382
398
  size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
383
399
  } & ClassProp) | undefined) => string;
384
400
 
401
+ /** Bir enum grubunun cache'lenmiş hali */
402
+ export declare interface CachedEnumDefinition {
403
+ code: string;
404
+ name: string;
405
+ values: CachedEnumValue[];
406
+ }
407
+
408
+ /**
409
+ * Enum Cache Types
410
+ * Backend EnumDefinitionResponse / EnumValueItem ile uyumlu cache yapısı.
411
+ */
412
+ /** Backend EnumValueItem — key/value çifti */
413
+ export declare interface CachedEnumValue {
414
+ key: string;
415
+ value: string;
416
+ sortOrder?: number;
417
+ description?: string;
418
+ relationKey?: string;
419
+ }
420
+
385
421
  export declare function Calendar({ className, classNames, showOutsideDays, captionLayout, buttonVariant, formatters, components, ...props }: React_2.ComponentProps<typeof DayPicker> & {
386
422
  buttonVariant?: React_2.ComponentProps<typeof Button>["variant"];
387
423
  }): JSX.Element;
@@ -831,7 +867,7 @@ export declare interface DataRowProps {
831
867
  size?: 'sm' | 'md';
832
868
  }
833
869
 
834
- export declare function DataTable<TData>({ columns, getRowId, data, isLoading, error, pagination, onPageChange, onPageSizeChange, pageSizeOptions, sortBy, sortDirection, onSortChange, searchValue, onSearchChange, searchPlaceholder, searchDebounceMs, fieldConfig, filters, onFiltersChange, enableRowSelection, rowSelection, onRowSelectionChange, bulkActions, rowActions, toolbarStart, toolbarEnd, className, toolbarVariant, emptyIcon, emptyTitle, emptyDescription, onRowClick, rowClassName, meta, headerColor, }: DataTableComponentProps<TData>): JSX.Element;
870
+ export declare function DataTable<TData>({ columns, getRowId, data, isLoading, error, pagination, onPageChange, onPageSizeChange, pageSizeOptions, sortBy, sortDirection, onSortChange, searchValue, onSearchChange, searchPlaceholder, searchDebounceMs, fieldConfig, filters, onFiltersChange, enableRowSelection, rowSelection, onRowSelectionChange, bulkActions, rowActions, toolbarStart, toolbarEnd, className, toolbarVariant, emptyIcon, emptyTitle, emptyDescription, onRowClick, rowClassName, zebra, meta, headerColor, headerTextColor, }: DataTableComponentProps<TData>): JSX.Element;
835
871
 
836
872
  declare interface DataTableActions {
837
873
  setGeneralSearch: (value: string) => void;
@@ -905,10 +941,14 @@ declare interface DataTableComponentProps<TData> {
905
941
  emptyTitle?: string;
906
942
  emptyDescription?: string;
907
943
  onRowClick?: (row: TData) => void;
908
- rowClassName?: (row: TData) => string;
944
+ rowClassName?: (row: TData, index: number) => string;
945
+ /** Enable alternating row background colors */
946
+ zebra?: boolean;
909
947
  meta?: Record<string, unknown>;
910
948
  /** Custom header color (CSS color value). Overrides --table-header variable */
911
949
  headerColor?: string;
950
+ /** Custom header text color (CSS color value). Used with headerColor for gradient backgrounds */
951
+ headerTextColor?: string;
912
952
  }
913
953
 
914
954
  /** Customization props */
@@ -920,7 +960,9 @@ export declare interface DataTableCustomizationProps<TData> {
920
960
  emptyTitle?: string;
921
961
  emptyDescription?: string;
922
962
  onRowClick?: (row: TData) => void;
923
- rowClassName?: (row: TData) => string;
963
+ rowClassName?: (row: TData, index: number) => string;
964
+ /** Enable alternating row background colors */
965
+ zebra?: boolean;
924
966
  }
925
967
 
926
968
  /** Data props for the table */
@@ -1277,6 +1319,33 @@ declare interface EntityDeleteDialogProps {
1277
1319
  description?: string;
1278
1320
  }
1279
1321
 
1322
+ /** Tüm enum cache: code → definition */
1323
+ export declare type EnumCache = Record<string, CachedEnumDefinition>;
1324
+
1325
+ /**
1326
+ * Dışarıdan sağlanabilen fetcher tipi.
1327
+ * EnumPrefetcher'a `fetcher` prop olarak verilir.
1328
+ * Parametresiz çağrılırsa tüm enum'ları, parametreli çağrılırsa filtrelenmiş sonuç döner.
1329
+ */
1330
+ export declare type EnumFetcher = (params?: EnumFetchParams) => Promise<BackendPagedResponse>;
1331
+
1332
+ /** Enum fetch parametreleri */
1333
+ export declare interface EnumFetchParams {
1334
+ generalSearch?: string;
1335
+ size?: number;
1336
+ }
1337
+
1338
+ export declare const enumKeys: {
1339
+ readonly all: readonly ["enums"];
1340
+ };
1341
+
1342
+ export declare function EnumPrefetcher({ fetcher }: EnumPrefetcherProps): null;
1343
+
1344
+ export declare interface EnumPrefetcherProps {
1345
+ /** Enum verilerini çeken fonksiyon. */
1346
+ fetcher: EnumFetcher;
1347
+ }
1348
+
1280
1349
  /**
1281
1350
  * Error Boundary Component
1282
1351
  * Catches JavaScript errors in child component tree and displays fallback UI
@@ -1750,6 +1819,12 @@ export declare interface InfoSectionProps {
1750
1819
 
1751
1820
  export declare function Input({ className, type, ...props }: React_2.ComponentProps<"input">): JSX.Element;
1752
1821
 
1822
+ /**
1823
+ * Tüm enum cache'ini temizler.
1824
+ * Sonraki EnumPrefetcher renderında tümü yeniden çekilir.
1825
+ */
1826
+ export declare function invalidateEnumCache(queryClient: QueryClient): void;
1827
+
1753
1828
  /**
1754
1829
  * Check if a filter has a valid value
1755
1830
  */
@@ -2425,6 +2500,12 @@ declare interface RadioOption {
2425
2500
  icon?: React.ReactNode;
2426
2501
  }
2427
2502
 
2503
+ /**
2504
+ * Tek bir enum'u backend'den çekip cache'e merge eder.
2505
+ * CRUD başarılı olduktan sonra çağrılır.
2506
+ */
2507
+ export declare function refreshEnum(queryClient: QueryClient, code: string): Promise<void>;
2508
+
2428
2509
  /**
2429
2510
  * Relative time cell for displaying "time ago" values.
2430
2511
  * Changes color based on how old the timestamp is.
@@ -2440,6 +2521,12 @@ declare interface RelativeTimeCellProps {
2440
2521
  errorThresholdMs?: number;
2441
2522
  }
2442
2523
 
2524
+ /**
2525
+ * Cache'den tek bir enum'u kaldırır (silme sonrası).
2526
+ * Backend'e istek atmaz.
2527
+ */
2528
+ export declare function removeEnumFromCache(queryClient: QueryClient, code: string): void;
2529
+
2443
2530
  export declare function ResizableHandle({ withHandle, className, ...props }: React.ComponentProps<typeof Separator_2> & {
2444
2531
  withHandle?: boolean;
2445
2532
  }): JSX.Element;
@@ -2709,7 +2796,7 @@ export declare interface SidebarNavItem {
2709
2796
  children?: SidebarNavItem[];
2710
2797
  }
2711
2798
 
2712
- export declare function SimpleDataTable<TData>({ columns, data, getRowId, isLoading, error, meta, enableSearch, searchPlaceholder: searchPlaceholderProp, searchColumn, emptyIcon, emptyTitle: emptyTitleProp, emptyDescription, onRowClick, rowClassName, className, loadingRows, headerColor, }: SimpleDataTableProps<TData>): JSX.Element;
2799
+ export declare function SimpleDataTable<TData>({ columns, data, getRowId, isLoading, error, meta, enableSearch, searchPlaceholder: searchPlaceholderProp, searchColumn, emptyIcon, emptyTitle: emptyTitleProp, emptyDescription, onRowClick, rowClassName, zebra, className, loadingRows, headerColor, headerTextColor, }: SimpleDataTableProps<TData>): JSX.Element;
2713
2800
 
2714
2801
  declare interface SimpleDataTableProps<TData> {
2715
2802
  /** Column definitions */
@@ -2739,13 +2826,17 @@ declare interface SimpleDataTableProps<TData> {
2739
2826
  /** Row click handler */
2740
2827
  onRowClick?: (row: TData) => void;
2741
2828
  /** Custom row class */
2742
- rowClassName?: (row: TData) => string;
2829
+ rowClassName?: (row: TData, index: number) => string;
2830
+ /** Enable alternating row background colors */
2831
+ zebra?: boolean;
2743
2832
  /** Container class */
2744
2833
  className?: string;
2745
2834
  /** Number of skeleton rows for loading state */
2746
2835
  loadingRows?: number;
2747
2836
  /** Custom header color (CSS color value). Overrides --table-header variable */
2748
2837
  headerColor?: string;
2838
+ /** Custom header text color (CSS color value). Used with headerColor for gradient backgrounds */
2839
+ headerTextColor?: string;
2749
2840
  }
2750
2841
 
2751
2842
  export declare function Skeleton({ className, ...props }: React.ComponentProps<"div">): JSX.Element;
@@ -3164,6 +3255,9 @@ export declare function TooltipProvider({ delayDuration, ...props }: React_2.Com
3164
3255
 
3165
3256
  export declare function TooltipTrigger({ ...props }: React_2.ComponentProps<typeof TooltipPrimitive.Trigger>): JSX.Element;
3166
3257
 
3258
+ /** CachedEnumValue[] → SelectOption[] dönüşümü */
3259
+ export declare function toSelectOptions(values: CachedEnumValue[]): SelectOption[];
3260
+
3167
3261
  /**
3168
3262
  * Convert UrlSearchParams to URLSearchParams for navigation
3169
3263
  */
@@ -3334,6 +3428,35 @@ export declare interface UseDoubleClickHandlerOptions<T> {
3334
3428
  delay?: number;
3335
3429
  }
3336
3430
 
3431
+ /**
3432
+ * Tüm enum tanımlarının listesini döner.
3433
+ */
3434
+ export declare function useEnumDefinitions(): CachedEnumDefinition[];
3435
+
3436
+ /**
3437
+ * Belirli bir enum code'unun SelectOption[] listesini döner.
3438
+ *
3439
+ * @example
3440
+ * ```tsx
3441
+ * const { options } = useEnumOptions('METER_TYPE');
3442
+ * <SelectField options={options} />
3443
+ * ```
3444
+ */
3445
+ export declare function useEnumOptions(key: string, fallback?: SelectOption[]): {
3446
+ options: SelectOption[];
3447
+ isLoading: boolean;
3448
+ };
3449
+
3450
+ /**
3451
+ * Belirli bir enum code'unun ham CachedEnumValue[] değerlerini döner.
3452
+ */
3453
+ export declare function useEnumValues(key: string): CachedEnumValue[];
3454
+
3455
+ /**
3456
+ * Tüm enum cache'ini temizler.
3457
+ */
3458
+ export declare function useInvalidateEnumCache(): () => void;
3459
+
3337
3460
  export declare function useJsonTree({ value, onChange }: UseJsonTreeOptions): UseJsonTreeReturn;
3338
3461
 
3339
3462
  declare interface UseJsonTreeOptions {
@@ -3517,6 +3640,22 @@ export declare function useOptimisticPageResponse<T extends {
3517
3640
  deleteItem: (id: number | string) => void;
3518
3641
  };
3519
3642
 
3643
+ /**
3644
+ * Tek bir enum'u yeniden çeker ve cache'e merge eder.
3645
+ *
3646
+ * @example
3647
+ * ```tsx
3648
+ * const refresh = useRefreshEnum();
3649
+ * if (result.success) await refresh(data.code);
3650
+ * ```
3651
+ */
3652
+ export declare function useRefreshEnum(): (code: string) => Promise<void>;
3653
+
3654
+ /**
3655
+ * Cache'den tek bir enum'u kaldırır (silme sonrası).
3656
+ */
3657
+ export declare function useRemoveEnumFromCache(): (code: string) => void;
3658
+
3520
3659
  /**
3521
3660
  * useTabUrlSync — Synchronizes active tab state with URL search params.
3522
3661
  *