@nar-bus/lena-ui-shared 1.3.10 → 1.3.12

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
  */
@@ -2351,6 +2420,43 @@ export declare function PopoverContent({ className, align, sideOffset, ...props
2351
2420
 
2352
2421
  export declare function PopoverTrigger({ ...props }: React_2.ComponentProps<typeof PopoverPrimitive.Trigger>): JSX.Element;
2353
2422
 
2423
+ export declare function PreviewSection({ title, children, className }: PreviewSectionProps): JSX.Element;
2424
+
2425
+ export declare interface PreviewSectionProps {
2426
+ title: string;
2427
+ children: ReactNode;
2428
+ className?: string;
2429
+ }
2430
+
2431
+ export declare function PreviewSheet({ open, onOpenChange, title, icon: Icon, headerGradient, badge, headerActions, footerActions, children, className, maxWidth, isLoading, closeLabel, }: PreviewSheetProps): JSX.Element;
2432
+
2433
+ export declare interface PreviewSheetProps {
2434
+ open: boolean;
2435
+ onOpenChange: (open: boolean) => void;
2436
+ title: string;
2437
+ /** Icon component rendered in the gradient header */
2438
+ icon?: ComponentType<{
2439
+ className?: string;
2440
+ style?: CSSProperties;
2441
+ }>;
2442
+ /** Gradient color theme for the header */
2443
+ headerGradient?: FormSheetGradient;
2444
+ /** Optional badge rendered next to the title */
2445
+ badge?: ReactNode;
2446
+ /** Action buttons rendered in the header (right side, replaces close button) */
2447
+ headerActions?: ReactNode;
2448
+ /** Action buttons rendered in the footer (right side) */
2449
+ footerActions?: ReactNode;
2450
+ children: ReactNode;
2451
+ className?: string;
2452
+ /** Sheet max width — defaults to 'lg' */
2453
+ maxWidth?: 'lg' | 'xl' | '2xl';
2454
+ /** Shows a centered loading spinner instead of children */
2455
+ isLoading?: boolean;
2456
+ /** Close button label override */
2457
+ closeLabel?: string;
2458
+ }
2459
+
2354
2460
  export declare const priorityColors: {
2355
2461
  readonly HIGH: "bg-status-error/10 text-status-error border-status-error/30 ring-status-error/30";
2356
2462
  readonly MEDIUM: "bg-status-warning/10 text-status-warning border-status-warning/30 ring-status-warning/30";
@@ -2431,6 +2537,12 @@ declare interface RadioOption {
2431
2537
  icon?: React.ReactNode;
2432
2538
  }
2433
2539
 
2540
+ /**
2541
+ * Tek bir enum'u backend'den çekip cache'e merge eder.
2542
+ * CRUD başarılı olduktan sonra çağrılır.
2543
+ */
2544
+ export declare function refreshEnum(queryClient: QueryClient, code: string): Promise<void>;
2545
+
2434
2546
  /**
2435
2547
  * Relative time cell for displaying "time ago" values.
2436
2548
  * Changes color based on how old the timestamp is.
@@ -2446,6 +2558,12 @@ declare interface RelativeTimeCellProps {
2446
2558
  errorThresholdMs?: number;
2447
2559
  }
2448
2560
 
2561
+ /**
2562
+ * Cache'den tek bir enum'u kaldırır (silme sonrası).
2563
+ * Backend'e istek atmaz.
2564
+ */
2565
+ export declare function removeEnumFromCache(queryClient: QueryClient, code: string): void;
2566
+
2449
2567
  export declare function ResizableHandle({ withHandle, className, ...props }: React.ComponentProps<typeof Separator_2> & {
2450
2568
  withHandle?: boolean;
2451
2569
  }): JSX.Element;
@@ -3174,6 +3292,9 @@ export declare function TooltipProvider({ delayDuration, ...props }: React_2.Com
3174
3292
 
3175
3293
  export declare function TooltipTrigger({ ...props }: React_2.ComponentProps<typeof TooltipPrimitive.Trigger>): JSX.Element;
3176
3294
 
3295
+ /** CachedEnumValue[] → SelectOption[] dönüşümü */
3296
+ export declare function toSelectOptions(values: CachedEnumValue[]): SelectOption[];
3297
+
3177
3298
  /**
3178
3299
  * Convert UrlSearchParams to URLSearchParams for navigation
3179
3300
  */
@@ -3344,6 +3465,35 @@ export declare interface UseDoubleClickHandlerOptions<T> {
3344
3465
  delay?: number;
3345
3466
  }
3346
3467
 
3468
+ /**
3469
+ * Tüm enum tanımlarının listesini döner.
3470
+ */
3471
+ export declare function useEnumDefinitions(): CachedEnumDefinition[];
3472
+
3473
+ /**
3474
+ * Belirli bir enum code'unun SelectOption[] listesini döner.
3475
+ *
3476
+ * @example
3477
+ * ```tsx
3478
+ * const { options } = useEnumOptions('METER_TYPE');
3479
+ * <SelectField options={options} />
3480
+ * ```
3481
+ */
3482
+ export declare function useEnumOptions(key: string, fallback?: SelectOption[]): {
3483
+ options: SelectOption[];
3484
+ isLoading: boolean;
3485
+ };
3486
+
3487
+ /**
3488
+ * Belirli bir enum code'unun ham CachedEnumValue[] değerlerini döner.
3489
+ */
3490
+ export declare function useEnumValues(key: string): CachedEnumValue[];
3491
+
3492
+ /**
3493
+ * Tüm enum cache'ini temizler.
3494
+ */
3495
+ export declare function useInvalidateEnumCache(): () => void;
3496
+
3347
3497
  export declare function useJsonTree({ value, onChange }: UseJsonTreeOptions): UseJsonTreeReturn;
3348
3498
 
3349
3499
  declare interface UseJsonTreeOptions {
@@ -3527,6 +3677,22 @@ export declare function useOptimisticPageResponse<T extends {
3527
3677
  deleteItem: (id: number | string) => void;
3528
3678
  };
3529
3679
 
3680
+ /**
3681
+ * Tek bir enum'u yeniden çeker ve cache'e merge eder.
3682
+ *
3683
+ * @example
3684
+ * ```tsx
3685
+ * const refresh = useRefreshEnum();
3686
+ * if (result.success) await refresh(data.code);
3687
+ * ```
3688
+ */
3689
+ export declare function useRefreshEnum(): (code: string) => Promise<void>;
3690
+
3691
+ /**
3692
+ * Cache'den tek bir enum'u kaldırır (silme sonrası).
3693
+ */
3694
+ export declare function useRemoveEnumFromCache(): (code: string) => void;
3695
+
3530
3696
  /**
3531
3697
  * useTabUrlSync — Synchronizes active tab state with URL search params.
3532
3698
  *