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

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
@@ -147,8 +147,8 @@ export declare interface AppHeaderLogo {
147
147
 
148
148
  export declare interface AppHeaderProps {
149
149
  breadcrumbs: BreadcrumbItem[];
150
- theme: 'light' | 'dark' | 'system';
151
- onThemeChange: (theme: 'light' | 'dark' | 'system') => void;
150
+ theme: 'light' | 'dark';
151
+ onThemeChange: (theme: 'light' | 'dark') => void;
152
152
  locale?: string;
153
153
  onLocaleChange?: (locale: string) => void;
154
154
  user?: AppHeaderUser | null;
@@ -239,6 +239,8 @@ declare interface AsyncSelectFieldProps<TFieldValues extends FieldValues> {
239
239
  cols?: 1 | 2 | 3 | 4 | 6 | 12;
240
240
  }
241
241
 
242
+ export declare function autoStatusColor(value: string): string;
243
+
242
244
  export declare function Avatar({ className, size, ...props }: React_2.ComponentProps<typeof AvatarPrimitive.Root> & {
243
245
  size?: "default" | "sm" | "lg";
244
246
  }): JSX.Element;
@@ -278,6 +280,10 @@ declare interface BadgeCellProps {
278
280
  className?: string;
279
281
  }
280
282
 
283
+ declare type BadgeSize = keyof typeof SIZE_STYLES;
284
+
285
+ declare type BadgeVariant = keyof typeof VARIANT_STYLES;
286
+
281
287
  export declare const badgeVariants: (props?: ({
282
288
  variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
283
289
  } & ClassProp) | undefined) => string;
@@ -347,6 +353,22 @@ export declare function BreadcrumbSeparator({ children, className, ...props }: R
347
353
 
348
354
  export declare function BreadcrumbUIItem({ className, ...props }: React_2.ComponentProps<"li">): JSX.Element;
349
355
 
356
+ /**
357
+ * Manifest groups + current pathname'den breadcrumb zinciri türetir.
358
+ *
359
+ * Children in manifest items are treated as tab-level navigation and are NOT
360
+ * included in the breadcrumb trail. The breadcrumb stops at the parent item.
361
+ *
362
+ * @example
363
+ * buildBreadcrumbsFromManifest(manifest.groups, '/device-management/meters', 'tr')
364
+ * // → [{ label: 'Envanter', href: '/brand-model' }, { label: 'Cihaz Yönetimi' }]
365
+ * // Note: 'Sayaçlar' (tab) is NOT included — breadcrumb stops at parent
366
+ *
367
+ * buildBreadcrumbsFromManifest(manifest.groups, '/simcard', 'tr')
368
+ * // → [{ label: 'Envanter', href: '/brand-model' }, { label: 'SIM Kartlar' }]
369
+ */
370
+ export declare function buildBreadcrumbsFromManifest(groups: ManifestGroup[], pathname: string, locale: string): BreadcrumbItem[];
371
+
350
372
  export declare interface BulkAction<TData> {
351
373
  id: string;
352
374
  label: string;
@@ -1688,6 +1710,17 @@ export declare interface GaugeFooterStat {
1688
1710
  colorClass?: string;
1689
1711
  }
1690
1712
 
1713
+ /**
1714
+ * Get a tone color class string from a base color family.
1715
+ * Each unique value gets a deterministic tone level within the family.
1716
+ * All class strings are pre-defined for Tailwind JIT compatibility.
1717
+ *
1718
+ * @example
1719
+ * generateToneColor('G_2', 'accent') // lighter cyan
1720
+ * generateToneColor('G_5', 'accent') // darker cyan
1721
+ */
1722
+ export declare function generateToneColor(value: string, baseColor: StatusColor): string;
1723
+
1691
1724
  /**
1692
1725
  * Get error path for highlighting in tree view
1693
1726
  */
@@ -1732,7 +1765,7 @@ export declare interface HeaderCreateButtonProps {
1732
1765
 
1733
1766
  export declare type HeaderGradient = 'teal' | 'navy' | 'cherry' | 'emerald' | 'amber' | 'violet' | 'rose' | 'indigo' | 'orange';
1734
1767
 
1735
- export declare function HeaderQuickSearch({ placeholder, value, onValueChange, open, onOpenChange, loading, shortcutKey, shouldFilter, className, children, }: HeaderQuickSearchProps): JSX.Element;
1768
+ export declare function HeaderQuickSearch({ placeholder, value, onValueChange, open, onOpenChange, loading, shortcutKey, shouldFilter, filter, className, children, }: HeaderQuickSearchProps): JSX.Element;
1736
1769
 
1737
1770
  export declare interface HeaderQuickSearchProps {
1738
1771
  placeholder?: string;
@@ -1743,6 +1776,8 @@ export declare interface HeaderQuickSearchProps {
1743
1776
  loading?: boolean;
1744
1777
  shortcutKey?: string;
1745
1778
  shouldFilter?: boolean;
1779
+ /** Custom filter function for cmdk (default: starts-with) */
1780
+ filter?: (value: string, search: string) => number;
1746
1781
  className?: string;
1747
1782
  children?: ReactNode;
1748
1783
  }
@@ -2192,6 +2227,22 @@ export declare interface LocationMapProps {
2192
2227
  className?: string;
2193
2228
  }
2194
2229
 
2230
+ export declare interface ManifestGroup {
2231
+ label?: string | ManifestTitle | null;
2232
+ href?: string;
2233
+ items: ManifestNavItem[];
2234
+ }
2235
+
2236
+ export declare interface ManifestNavItem {
2237
+ title: string | ManifestTitle;
2238
+ href: string;
2239
+ children?: ManifestNavItem[];
2240
+ }
2241
+
2242
+ declare interface ManifestTitle {
2243
+ [key: string]: string;
2244
+ }
2245
+
2195
2246
  export declare const MAP_TOOLTIP_OPTIONS: Partial<TooltipOptions>;
2196
2247
 
2197
2248
  /** Fixes Leaflet map sizing when rendered inside hidden tabs or collapsible panels */
@@ -2339,7 +2390,7 @@ export declare function PageErrorBoundary({ children }: {
2339
2390
  children: ReactNode;
2340
2391
  }): JSX.Element;
2341
2392
 
2342
- export declare function PageHeader({ title, description, icon: Icon, breadcrumbs, actions, className, onBreadcrumbsChange, }: PageHeaderProps): JSX.Element;
2393
+ export declare function PageHeader({ title, description, icon: Icon, actions, className, }: PageHeaderProps): JSX.Element;
2343
2394
 
2344
2395
  export declare interface PageHeaderProps {
2345
2396
  title: string;
@@ -2347,11 +2398,8 @@ export declare interface PageHeaderProps {
2347
2398
  icon: React.ComponentType<{
2348
2399
  className?: string;
2349
2400
  }>;
2350
- breadcrumbs: BreadcrumbItem[];
2351
2401
  actions?: React.ReactNode;
2352
2402
  className?: string;
2353
- /** Callback to sync breadcrumbs with external store (e.g. uiStore) */
2354
- onBreadcrumbsChange?: (breadcrumbs: BreadcrumbItem[]) => void;
2355
2403
  }
2356
2404
 
2357
2405
  export declare function Pagination({ className, ...props }: React_2.ComponentProps<"nav">): JSX.Element;
@@ -2876,6 +2924,12 @@ declare interface SimpleDataTableProps<TData> {
2876
2924
  headerTextColor?: string;
2877
2925
  }
2878
2926
 
2927
+ declare const SIZE_STYLES: {
2928
+ readonly xs: "px-1.5 py-0 text-2xs-plus";
2929
+ readonly sm: "px-2 py-0.5 text-2xs-plus";
2930
+ readonly md: "px-2.5 py-1 text-2xs-plus";
2931
+ };
2932
+
2879
2933
  export declare function Skeleton({ className, ...props }: React.ComponentProps<"div">): JSX.Element;
2880
2934
 
2881
2935
  export declare function Slider({ className, defaultValue, value, min, max, ...props }: React_2.ComponentProps<typeof SliderPrimitive.Root>): JSX.Element;
@@ -2912,41 +2966,72 @@ export declare interface StatCardProps {
2912
2966
  }
2913
2967
 
2914
2968
  /**
2915
- * Status badge for displaying enum/status values.
2916
- * Provides consistent styling across all tables.
2969
+ * Unified badge component for the entire platform.
2970
+ * Single source of truth for all badge styling — status, tags, counters, labels.
2917
2971
  *
2918
- * @example
2972
+ * @example Status badge with color mapping
2973
+ * ```tsx
2974
+ * <StatusBadge value="ACTIVE" colorMap={colors} labelMap={labels} showDot />
2975
+ * ```
2976
+ *
2977
+ * @example Auto-colored enum (no colorMap needed)
2978
+ * ```tsx
2979
+ * <StatusBadge value={row.protocolName} autoColor />
2980
+ * ```
2981
+ *
2982
+ * @example Simple tag/label
2983
+ * ```tsx
2984
+ * <StatusBadge variant="outline">DLMS</StatusBadge>
2985
+ * ```
2986
+ *
2987
+ * @example Counter badge (xs size)
2988
+ * ```tsx
2989
+ * <StatusBadge variant="destructive" size="xs">{count}</StatusBadge>
2990
+ * ```
2991
+ *
2992
+ * @example Compact badge (sm size)
2919
2993
  * ```tsx
2920
- * <StatusBadge
2921
- * value={row.status}
2922
- * colorMap={{
2923
- * ACTIVE: statusColors.success,
2924
- * INACTIVE: statusColors.neutral,
2925
- * }}
2926
- * labelMap={{
2927
- * ACTIVE: 'Active',
2928
- * INACTIVE: 'Inactive',
2929
- * }}
2930
- * showDot
2931
- * icon={<Wifi className="h-3 w-3" />}
2932
- * />
2994
+ * <StatusBadge variant="outline" size="sm">{label}</StatusBadge>
2933
2995
  * ```
2934
2996
  */
2935
- export declare function StatusBadge<T extends string>({ value, colorMap, labelMap, icon, showDot, dotColorMap, pulse, size, showLabel, className, }: StatusBadgeProps<T>): JSX.Element;
2936
-
2937
- declare interface StatusBadgeProps<T extends string> {
2938
- value: T | null | undefined;
2939
- colorMap: Record<T, string>;
2997
+ export declare function StatusBadge<T extends string>({ value, colorMap, autoColor, toneColor, labelMap, icon, iconMap, showDot, dotColorMap, pulse, size, showLabel, variant, accentColorMap, minWidth, children, showNullState, className, ...htmlProps }: StatusBadgeProps<T>): JSX.Element;
2998
+
2999
+ declare interface StatusBadgeBaseProps<T extends string> {
3000
+ /** Enum/status value used with colorMap for semantic coloring */
3001
+ value?: T | null | undefined;
3002
+ /** Map enum values to Tailwind color classes */
3003
+ colorMap?: Record<T, string>;
3004
+ /** Auto-assign color from value string hash (no colorMap needed) */
3005
+ autoColor?: boolean;
3006
+ /** Base color family for graduated tone coloring — each value gets a unique tone within the family */
3007
+ toneColor?: StatusColor;
3008
+ /** Map enum values to display labels */
2940
3009
  labelMap?: Record<T, string>;
3010
+ /** Global icon — same icon for all values */
2941
3011
  icon?: React.ReactNode;
3012
+ /** Per-value icon — different icon per enum value (takes priority over `icon`) */
3013
+ iconMap?: Partial<Record<T, React.ReactNode>>;
2942
3014
  showDot?: boolean;
2943
3015
  dotColorMap?: Record<T, string>;
2944
3016
  pulse?: boolean | Record<T, boolean>;
2945
- size?: 'sm' | 'md';
3017
+ /** xs: counter/mini | sm: compact | md: default */
3018
+ size?: BadgeSize;
2946
3019
  showLabel?: boolean;
3020
+ /** Visual variant */
3021
+ variant?: BadgeVariant;
3022
+ /** Accent bar color map for variant="mono" */
3023
+ accentColorMap?: Partial<Record<T, string>>;
3024
+ /** Optional min-width Tailwind class for table column alignment */
3025
+ minWidth?: string;
3026
+ /** Direct children — for simple tag/label/counter usage without value+colorMap */
3027
+ children?: React.ReactNode;
3028
+ /** Show null state when value is null/undefined. Default: true for value mode, false for children mode */
3029
+ showNullState?: boolean;
2947
3030
  className?: string;
2948
3031
  }
2949
3032
 
3033
+ declare type StatusBadgeProps<T extends string> = StatusBadgeBaseProps<T> & Omit<React.HTMLAttributes<HTMLSpanElement>, keyof StatusBadgeBaseProps<T>>;
3034
+
2950
3035
  export declare type StatusColor = keyof typeof statusColors;
2951
3036
 
2952
3037
  /**
@@ -3384,6 +3469,51 @@ export declare interface UrlState {
3384
3469
  f?: FilterState[];
3385
3470
  }
3386
3471
 
3472
+ /**
3473
+ * Enterprise breadcrumb hook — derives breadcrumbs from manifest groups + current route.
3474
+ *
3475
+ * @example
3476
+ * // Header.tsx
3477
+ * const breadcrumbs = useAutoBreadcrumbs({
3478
+ * groups: manifest.groups,
3479
+ * pathname,
3480
+ * locale,
3481
+ * tail, // from useBreadcrumbs() store
3482
+ * });
3483
+ */
3484
+ export declare function useAutoBreadcrumbs({ groups, pathname, locale, tail, }: UseAutoBreadcrumbsOptions): BreadcrumbItem[];
3485
+
3486
+ export declare interface UseAutoBreadcrumbsOptions {
3487
+ /** Manifest navigation groups (source of truth for breadcrumb hierarchy) */
3488
+ groups: ManifestGroup[];
3489
+ /** Current route pathname */
3490
+ pathname: string;
3491
+ /** Active locale for resolving multilingual titles */
3492
+ locale: string;
3493
+ /** Optional tail items from detail pages (appended to auto-breadcrumbs) */
3494
+ tail?: BreadcrumbItem[];
3495
+ }
3496
+
3497
+ /**
3498
+ * Declarative breadcrumb tail hook for detail pages.
3499
+ * Sets tail items on mount and auto-clears on unmount.
3500
+ * Uses deep comparison to avoid unnecessary updates.
3501
+ *
3502
+ * @param items - Breadcrumb items to append (undefined = skip, e.g. while loading)
3503
+ * @param setBreadcrumbs - Setter from store (e.g. useSetBreadcrumbs from lena-ui-core)
3504
+ *
3505
+ * @example
3506
+ * const setBreadcrumbs = useSetBreadcrumbs();
3507
+ * useBreadcrumbTail(
3508
+ * meter ? [
3509
+ * { label: 'Sayaçlar', href: '/device-management/meters' },
3510
+ * { label: meter.serialNumber },
3511
+ * ] : undefined,
3512
+ * setBreadcrumbs,
3513
+ * );
3514
+ */
3515
+ export declare function useBreadcrumbTail(items: BreadcrumbItem[] | undefined, setBreadcrumbs: (items: BreadcrumbItem[]) => void): void;
3516
+
3387
3517
  export declare function useDataTable<TData>(options: UseDataTableOptions<TData>): UseDataTableReturn<TData>;
3388
3518
 
3389
3519
  declare interface UseDataTableOptions<TData> extends CreateDataTableStoreOptions {
@@ -3777,6 +3907,15 @@ export declare interface ValidationStatusProps {
3777
3907
  showDetails?: boolean;
3778
3908
  }
3779
3909
 
3910
+ declare const VARIANT_STYLES: {
3911
+ readonly default: "";
3912
+ readonly mono: "font-mono tracking-tight";
3913
+ readonly outline: "border-border text-foreground ring-0 border";
3914
+ readonly secondary: "bg-secondary text-secondary-foreground ring-0";
3915
+ readonly destructive: "bg-destructive text-white ring-0";
3916
+ readonly ghost: "ring-0 text-foreground";
3917
+ };
3918
+
3780
3919
  /**
3781
3920
  * Adds monthly average fields to chart data.
3782
3921
  * Date format: "dd/MM" — groups by month part, calculates average per key.