@nar-bus/lena-ui-shared 1.3.10 → 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;
@@ -1283,6 +1319,33 @@ declare interface EntityDeleteDialogProps {
1283
1319
  description?: string;
1284
1320
  }
1285
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
+
1286
1349
  /**
1287
1350
  * Error Boundary Component
1288
1351
  * Catches JavaScript errors in child component tree and displays fallback UI
@@ -1756,6 +1819,12 @@ export declare interface InfoSectionProps {
1756
1819
 
1757
1820
  export declare function Input({ className, type, ...props }: React_2.ComponentProps<"input">): JSX.Element;
1758
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
+
1759
1828
  /**
1760
1829
  * Check if a filter has a valid value
1761
1830
  */
@@ -2431,6 +2500,12 @@ declare interface RadioOption {
2431
2500
  icon?: React.ReactNode;
2432
2501
  }
2433
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
+
2434
2509
  /**
2435
2510
  * Relative time cell for displaying "time ago" values.
2436
2511
  * Changes color based on how old the timestamp is.
@@ -2446,6 +2521,12 @@ declare interface RelativeTimeCellProps {
2446
2521
  errorThresholdMs?: number;
2447
2522
  }
2448
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
+
2449
2530
  export declare function ResizableHandle({ withHandle, className, ...props }: React.ComponentProps<typeof Separator_2> & {
2450
2531
  withHandle?: boolean;
2451
2532
  }): JSX.Element;
@@ -3174,6 +3255,9 @@ export declare function TooltipProvider({ delayDuration, ...props }: React_2.Com
3174
3255
 
3175
3256
  export declare function TooltipTrigger({ ...props }: React_2.ComponentProps<typeof TooltipPrimitive.Trigger>): JSX.Element;
3176
3257
 
3258
+ /** CachedEnumValue[] → SelectOption[] dönüşümü */
3259
+ export declare function toSelectOptions(values: CachedEnumValue[]): SelectOption[];
3260
+
3177
3261
  /**
3178
3262
  * Convert UrlSearchParams to URLSearchParams for navigation
3179
3263
  */
@@ -3344,6 +3428,35 @@ export declare interface UseDoubleClickHandlerOptions<T> {
3344
3428
  delay?: number;
3345
3429
  }
3346
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
+
3347
3460
  export declare function useJsonTree({ value, onChange }: UseJsonTreeOptions): UseJsonTreeReturn;
3348
3461
 
3349
3462
  declare interface UseJsonTreeOptions {
@@ -3527,6 +3640,22 @@ export declare function useOptimisticPageResponse<T extends {
3527
3640
  deleteItem: (id: number | string) => void;
3528
3641
  };
3529
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
+
3530
3659
  /**
3531
3660
  * useTabUrlSync — Synchronizes active tab state with URL search params.
3532
3661
  *