@nar-bus/lena-ui-shared 1.3.3 → 1.3.5

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
@@ -16,14 +16,21 @@ import { CSSProperties } from 'react';
16
16
  import { DayPicker } from 'react-day-picker';
17
17
  import * as DialogPrimitive from '@radix-ui/react-dialog';
18
18
  import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
19
+ import { Feature } from 'geojson';
20
+ import { FeatureCollection } from 'geojson';
19
21
  import { FieldPath } from 'react-hook-form';
20
22
  import { FieldValues } from 'react-hook-form';
21
23
  import { Group } from 'react-resizable-panels';
22
24
  import { JSX } from 'react/jsx-runtime';
25
+ import { default as L_2 } from 'leaflet';
23
26
  import * as LabelPrimitive from '@radix-ui/react-label';
27
+ import { Layer } from 'leaflet';
28
+ import { LeafletMouseEvent } from 'leaflet';
24
29
  import { LucideIcon } from 'lucide-react';
30
+ import { MultiPolygon } from 'geojson';
25
31
  import { NamedExoticComponent } from 'react';
26
32
  import { Panel } from 'react-resizable-panels';
33
+ import { Polygon } from 'geojson';
27
34
  import * as PopoverPrimitive from '@radix-ui/react-popover';
28
35
  import * as ProgressPrimitive from '@radix-ui/react-progress';
29
36
  import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
@@ -40,11 +47,15 @@ import * as TabsPrimitive from '@radix-ui/react-tabs';
40
47
  import { ToasterProps } from 'sonner';
41
48
  import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';
42
49
  import * as TogglePrimitive from '@radix-ui/react-toggle';
50
+ import { TooltipOptions } from 'leaflet';
43
51
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
44
52
  import { UseBoundStore } from 'zustand';
53
+ import { useMap } from 'react-leaflet';
45
54
  import { VariantProps } from 'class-variance-authority';
46
55
  import { z } from 'zod';
47
56
 
57
+ declare type AccentPosition = 'left' | 'top';
58
+
48
59
  export declare function Accordion({ ...props }: React_2.ComponentProps<typeof AccordionPrimitive.Root>): JSX.Element;
49
60
 
50
61
  export declare function AccordionContent({ className, children, ...props }: React_2.ComponentProps<typeof AccordionPrimitive.Content>): JSX.Element;
@@ -177,6 +188,28 @@ export declare interface AppSidebarProps {
177
188
  groups?: SidebarNavGroup[];
178
189
  }
179
190
 
191
+ /** Configuration for a single area series */
192
+ export declare interface AreaSeriesConfig {
193
+ /** Data key matching a field in the data array */
194
+ dataKey: string;
195
+ /** Display name (shown in tooltip/legend) */
196
+ name: string;
197
+ /** Stroke color */
198
+ color: string;
199
+ /** Fill gradient colors: [topColor, bottomColor] */
200
+ gradient: GradientPair;
201
+ /** Top gradient stop opacity (default: 0.3) */
202
+ topOpacity?: number;
203
+ /** Bottom gradient stop opacity (default: 0) */
204
+ bottomOpacity?: number;
205
+ /** Stroke width (default: 2) */
206
+ strokeWidth?: number;
207
+ /** Stroke dash pattern (e.g. "6 3") */
208
+ strokeDasharray?: string;
209
+ /** Curve interpolation type (default: "monotone") */
210
+ type?: 'monotone' | 'linear' | 'basis' | 'natural' | 'step';
211
+ }
212
+
180
213
  /**
181
214
  * Operators that use the `values` array instead of single `value`
182
215
  */
@@ -229,6 +262,26 @@ export declare const badgeVariants: (props?: ({
229
262
  variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
230
263
  } & ClassProp) | undefined) => string;
231
264
 
265
+ /** Configuration for a single bar series */
266
+ export declare interface BarSeriesConfig {
267
+ /** Data key matching a field in the data array */
268
+ dataKey: string;
269
+ /** Display name (shown in tooltip/legend) */
270
+ name: string;
271
+ /** Gradient colors: [topColor, bottomColor] */
272
+ gradient: GradientPair;
273
+ /** Top gradient stop opacity (default: 0.95) */
274
+ topOpacity?: number;
275
+ /** Bottom gradient stop opacity (default: 0.8) */
276
+ bottomOpacity?: number;
277
+ /** Stack ID for stacked bars */
278
+ stackId?: string;
279
+ /** Border radius [topLeft, topRight, bottomLeft, bottomRight] */
280
+ radius?: [number, number, number, number];
281
+ /** Maximum bar width in px (default: 28) */
282
+ maxBarSize?: number;
283
+ }
284
+
232
285
  /**
233
286
  * Boolean cell for displaying true/false values.
234
287
  * Shows check/X icons with consistent styling.
@@ -346,6 +399,29 @@ export declare function CardTitle({ className, ...props }: React_2.ComponentProp
346
399
  */
347
400
  export declare function CellNullState(): JSX.Element;
348
401
 
402
+ /** Configuration for a single centroid label on the map */
403
+ export declare interface CentroidLabelConfig {
404
+ /** Label position [lat, lng] */
405
+ position: [number, number];
406
+ /**
407
+ * HTML content for the label.
408
+ * @security Bu değer doğrudan innerHTML olarak render edilir.
409
+ * Kullanıcı girdisi ASLA doğrudan geçilmemeli — sanitize edin.
410
+ */
411
+ html: string;
412
+ /** Icon size [width, height] (default: [50, 18]) */
413
+ iconSize?: [number, number];
414
+ }
415
+
416
+ /** Renders HTML labels at specified positions using Leaflet divIcon markers */
417
+ export declare function CentroidLabels({ labels }: CentroidLabelsProps): null;
418
+
419
+ /** Props for CentroidLabels component */
420
+ export declare interface CentroidLabelsProps {
421
+ /** Array of label configurations */
422
+ labels: CentroidLabelConfig[];
423
+ }
424
+
349
425
  export declare function Checkbox({ className, ...props }: React_2.ComponentProps<typeof CheckboxPrimitive.Root>): JSX.Element;
350
426
 
351
427
  export declare function CheckboxField<TFieldValues extends FieldValues>({ name, control, label, description, disabled, className, cols, }: CheckboxFieldProps<TFieldValues>): JSX.Element;
@@ -471,6 +547,13 @@ export declare interface CommonLabels {
471
547
  addNew: string;
472
548
  }
473
549
 
550
+ /** Compact number formatter for chart Y-axis (1500→"1,5B" TR / "1.5K" EN) */
551
+ export declare function compactNumber(v: number, locale?: 'tr' | 'en'): string;
552
+
553
+ declare function Content({ children, padding, className }: LenaPanelContentProps): JSX.Element;
554
+
555
+ declare type ContentPadding = 'none' | 'compact' | 'sm' | 'md' | 'lg';
556
+
474
557
  export declare function ContextMenu({ ...props }: React_2.ComponentProps<typeof ContextMenuPrimitive.Root>): JSX.Element;
475
558
 
476
559
  export declare function ContextMenuCheckboxItem({ className, children, checked, ...props }: React_2.ComponentProps<typeof ContextMenuPrimitive.CheckboxItem>): JSX.Element;
@@ -1027,6 +1110,14 @@ declare interface DateRangeFieldProps<TFieldValues extends FieldValues> {
1027
1110
  */
1028
1111
  export declare function dateStringToTimestamp(dateStr: string, endOfDay?: boolean): number;
1029
1112
 
1113
+ export declare const DEFAULT_HOVER_STYLE: {
1114
+ readonly weight: 2.5;
1115
+ readonly color: "var(--map-hover-color)";
1116
+ readonly fillOpacity: 0.9;
1117
+ };
1118
+
1119
+ export declare const DEFAULT_MAP_BG = "var(--map-bg)";
1120
+
1030
1121
  /**
1031
1122
  * Default pagination options
1032
1123
  */
@@ -1044,6 +1135,8 @@ export declare const DEFAULT_PAGINATION: {
1044
1135
  readonly hasPrevious: false;
1045
1136
  };
1046
1137
 
1138
+ export declare const DEFAULT_TILE_URL = "https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png";
1139
+
1047
1140
  /**
1048
1141
  * Default values
1049
1142
  */
@@ -1234,6 +1327,19 @@ declare interface ErrorBoundaryState {
1234
1327
  errorInfo: React.ErrorInfo | null;
1235
1328
  }
1236
1329
 
1330
+ export { Feature }
1331
+
1332
+ export { FeatureCollection }
1333
+
1334
+ /** Style object returned by the feature style function */
1335
+ export declare interface FeatureStyleResult {
1336
+ fillColor: string;
1337
+ weight: number;
1338
+ opacity: number;
1339
+ color: string;
1340
+ fillOpacity: number;
1341
+ }
1342
+
1237
1343
  export declare interface FieldConfig {
1238
1344
  /** API field path - supports dot notation (e.g., 'gatewayModel.id') */
1239
1345
  field: string;
@@ -1361,6 +1467,8 @@ export declare interface FilterState {
1361
1467
  enabled: boolean;
1362
1468
  }
1363
1469
 
1470
+ declare function Footer({ children, className }: LenaPanelFooterProps): JSX.Element;
1471
+
1364
1472
  /**
1365
1473
  * Format backend timestamp to short datetime (e.g., "27 Oca 00:44")
1366
1474
  */
@@ -1376,6 +1484,16 @@ export declare function formatDate(timestamp: DateInput_3): string;
1376
1484
  */
1377
1485
  export declare function formatDateTime(timestamp: DateInput_3): string;
1378
1486
 
1487
+ /**
1488
+ * Format a timestamp to compact date with time (e.g., "27.03.26 15:30")
1489
+ */
1490
+ export declare function formatDateTimeCompact(timestamp: DateInput_3): string;
1491
+
1492
+ /**
1493
+ * Format a timestamp to compact date with time and seconds (e.g., "27.03.26 15:30:45")
1494
+ */
1495
+ export declare function formatDateTimeCompactFull(timestamp: DateInput_3): string;
1496
+
1379
1497
  /**
1380
1498
  * Format a timestamp to full date with seconds (e.g., "Jan 1, 2024 14:30:45")
1381
1499
  */
@@ -1511,6 +1629,13 @@ export declare function getStatusColor<T extends string>(value: T | null | undef
1511
1629
  */
1512
1630
  export declare function getTabDirection(tabIds: string[], fromTab: string | null, toTab: string): -1 | 0 | 1;
1513
1631
 
1632
+ /** Gradient stop pair: [topColor, bottomColor] */
1633
+ export declare type GradientPair = [topColor: string, bottomColor: string];
1634
+
1635
+ declare function Header({ children, icon: Icon, iconClassName, subtitle, actions, gradient, className, }: LenaPanelHeaderProps): JSX.Element;
1636
+
1637
+ export declare type HeaderGradient = 'teal' | 'navy' | 'cherry' | 'emerald' | 'amber' | 'violet';
1638
+
1514
1639
  export declare function HeaderQuickSearch({ placeholder, value, onValueChange, open, onOpenChange, loading, shortcutKey, shouldFilter, className, children, }: HeaderQuickSearchProps): JSX.Element;
1515
1640
 
1516
1641
  export declare interface HeaderQuickSearchProps {
@@ -1722,8 +1847,134 @@ declare interface JsonViewerProps {
1722
1847
  className?: string;
1723
1848
  }
1724
1849
 
1850
+ export { L_2 as L }
1851
+
1725
1852
  export declare function Label({ className, ...props }: React_2.ComponentProps<typeof LabelPrimitive.Root>): JSX.Element;
1726
1853
 
1854
+ export { Layer }
1855
+
1856
+ export { LeafletMouseEvent }
1857
+
1858
+ export declare function LenaAreaChart<T extends object>({ data, series, xAxisDataKey, height, showLegend, yAxisWidth, yAxisTickFormatter, tooltipItemColor, margin, className, }: LenaAreaChartProps<T>): JSX.Element;
1859
+
1860
+ /** Props for LenaAreaChart */
1861
+ export declare interface LenaAreaChartProps<T extends object> extends LenaChartBaseProps<T> {
1862
+ /** Area series configurations */
1863
+ series: AreaSeriesConfig[];
1864
+ }
1865
+
1866
+ export declare function LenaBarChart<T extends object>({ data, series, xAxisDataKey, height, showLegend, yAxisWidth, yAxisTickFormatter, tooltipItemColor, margin, barCategoryGap, barGap, className, }: LenaBarChartProps<T>): JSX.Element;
1867
+
1868
+ /** Props for LenaBarChart */
1869
+ export declare interface LenaBarChartProps<T extends object> extends LenaChartBaseProps<T> {
1870
+ /** Bar series configurations */
1871
+ series: BarSeriesConfig[];
1872
+ /** Gap between bar categories (default: "20%") */
1873
+ barCategoryGap?: string;
1874
+ /** Gap between bars in same category */
1875
+ barGap?: number;
1876
+ }
1877
+
1878
+ /** Common props shared by all Lena chart components */
1879
+ export declare interface LenaChartBaseProps<T extends object> {
1880
+ /** Chart data array */
1881
+ data: T[];
1882
+ /** Key in data used for the X axis (category axis) */
1883
+ xAxisDataKey: string;
1884
+ /** Chart height in px (default: 180) */
1885
+ height?: number;
1886
+ /** Show legend below the chart */
1887
+ showLegend?: boolean;
1888
+ /** Y-axis width in px (default: 40) */
1889
+ yAxisWidth?: number;
1890
+ /** Custom tooltip item style color override */
1891
+ tooltipItemColor?: string;
1892
+ /** Chart margin override */
1893
+ margin?: {
1894
+ top?: number;
1895
+ right?: number;
1896
+ left?: number;
1897
+ bottom?: number;
1898
+ };
1899
+ /** Custom Y-axis tick formatter (e.g. 420000 → "420K") */
1900
+ yAxisTickFormatter?: (value: number) => string;
1901
+ /** Additional CSS class on the outer container */
1902
+ className?: string;
1903
+ }
1904
+
1905
+ export declare function LenaChoroplethMap({ geojsonData, getFeatureStyle, onEachFeature, center, zoom, minZoom, maxZoom, tileUrl, height, interactive, background, geojsonKey, children, className, }: LenaChoroplethMapProps): JSX.Element;
1906
+
1907
+ /** Props for LenaChoroplethMap */
1908
+ export declare interface LenaChoroplethMapProps {
1909
+ /** GeoJSON FeatureCollection data */
1910
+ geojsonData: FeatureCollection;
1911
+ /** Style function called for each GeoJSON feature */
1912
+ getFeatureStyle: (feature?: Feature) => FeatureStyleResult;
1913
+ /** Event handler for each feature (tooltip binding, click etc.) */
1914
+ onEachFeature?: (feature: Feature, layer: Layer) => void;
1915
+ /** Map center [lat, lng] (default: Turkey center) */
1916
+ center?: [number, number];
1917
+ /** Initial zoom level (default: 6) */
1918
+ zoom?: number;
1919
+ /** Min zoom level */
1920
+ minZoom?: number;
1921
+ /** Max zoom level */
1922
+ maxZoom?: number;
1923
+ /** Tile layer URL template */
1924
+ tileUrl?: string;
1925
+ /** Map container height (default: '100%') */
1926
+ height?: number | string;
1927
+ /** Enable zoom/drag/scroll controls (default: false) */
1928
+ interactive?: boolean;
1929
+ /** Map background color (default: '#f8fafc') */
1930
+ background?: string;
1931
+ /** GeoJSON key for re-rendering when data/filter changes */
1932
+ geojsonKey?: string | number;
1933
+ /** Additional children rendered inside MapContainer (markers, labels etc.) */
1934
+ children?: ReactNode;
1935
+ /** CSS class for outer container */
1936
+ className?: string;
1937
+ }
1938
+
1939
+ export declare const LenaPanel: typeof _LenaPanel & {
1940
+ Header: typeof Header;
1941
+ Content: typeof Content;
1942
+ Footer: typeof Footer;
1943
+ };
1944
+
1945
+ declare function _LenaPanel({ variant, animation, animationDelay, accentBorder, accentColor, className, children, }: LenaPanelProps): JSX.Element;
1946
+
1947
+ export declare interface LenaPanelContentProps {
1948
+ children: ReactNode;
1949
+ padding?: ContentPadding;
1950
+ className?: string;
1951
+ }
1952
+
1953
+ export declare interface LenaPanelFooterProps {
1954
+ children: ReactNode;
1955
+ className?: string;
1956
+ }
1957
+
1958
+ export declare interface LenaPanelHeaderProps {
1959
+ children: ReactNode;
1960
+ icon?: LucideIcon;
1961
+ iconClassName?: string;
1962
+ subtitle?: string;
1963
+ actions?: ReactNode;
1964
+ gradient?: HeaderGradient;
1965
+ className?: string;
1966
+ }
1967
+
1968
+ export declare interface LenaPanelProps {
1969
+ variant?: PanelVariant;
1970
+ animation?: PanelAnimation;
1971
+ animationDelay?: number;
1972
+ accentBorder?: AccentPosition;
1973
+ accentColor?: string;
1974
+ className?: string;
1975
+ children: ReactNode;
1976
+ }
1977
+
1727
1978
  export declare interface LenaUILabels {
1728
1979
  dataTable: DataTableLabels;
1729
1980
  form: FormLabels;
@@ -1797,14 +2048,41 @@ export declare interface LocationMapProps {
1797
2048
  className?: string;
1798
2049
  }
1799
2050
 
2051
+ export declare const MAP_TOOLTIP_OPTIONS: Partial<TooltipOptions>;
2052
+
2053
+ /** Fixes Leaflet map sizing when rendered inside hidden tabs or collapsible panels */
2054
+ export declare function MapSizeInvalidator(): null;
2055
+
1800
2056
  export declare interface MetaInfo {
1801
2057
  timestamp: string;
1802
2058
  version: string;
1803
2059
  requestId: string;
1804
2060
  }
1805
2061
 
2062
+ export declare function MetricCard({ title, value, unit, trend, status, icon, sparklineData, className, animationDelay, isLoading, }: MetricCardProps): JSX.Element;
2063
+
2064
+ export declare interface MetricCardProps {
2065
+ title: string;
2066
+ value: string | number;
2067
+ unit?: string;
2068
+ trend?: {
2069
+ value: number;
2070
+ direction: 'up' | 'down' | 'neutral';
2071
+ };
2072
+ status?: MetricStatus;
2073
+ icon?: ReactNode;
2074
+ sparklineData?: number[];
2075
+ className?: string;
2076
+ animationDelay?: number;
2077
+ isLoading?: boolean;
2078
+ }
2079
+
2080
+ export declare type MetricStatus = 'online' | 'warning' | 'error' | 'neutral';
2081
+
1806
2082
  export declare type MountStrategy = 'eager' | 'lazy-persist' | 'lazy-remount';
1807
2083
 
2084
+ export { MultiPolygon }
2085
+
1808
2086
  export declare function MultiSelectField<TFieldValues extends FieldValues>({ name, control, label, description, required, placeholder: placeholderProp, searchPlaceholder: searchPlaceholderProp, emptyText: emptyTextProp, options, maxItems, disabled, className, cols, errorHint, }: MultiSelectFieldProps<TFieldValues>): JSX.Element;
1809
2087
 
1810
2088
  declare interface MultiSelectFieldProps<TFieldValues extends FieldValues> {
@@ -1901,7 +2179,7 @@ export declare interface OverviewPanelTopBarProps {
1901
2179
  segments: string[];
1902
2180
  actions?: ReactNode;
1903
2181
  className?: string;
1904
- variant?: 'default' | 'navy' | 'cherry' | 'emerald' | 'amber';
2182
+ variant?: 'default' | 'navy' | 'cherry' | 'emerald' | 'amber' | 'teal';
1905
2183
  }
1906
2184
 
1907
2185
  export declare interface PagedResponse<T> {
@@ -1959,6 +2237,10 @@ export declare function PaginationNext({ className, ...props }: React_2.Componen
1959
2237
 
1960
2238
  export declare function PaginationPrevious({ className, ...props }: React_2.ComponentProps<typeof PaginationLink>): JSX.Element;
1961
2239
 
2240
+ declare type PanelAnimation = 'slide-up' | 'slide-down' | 'fade' | 'none';
2241
+
2242
+ declare type PanelVariant = 'elevated' | 'flat' | 'ghost';
2243
+
1962
2244
  /**
1963
2245
  * Parse backend timestamp format (YYYYMMDDHHmmssSSS) to Date
1964
2246
  * Example: 20260127004431907 -> Date(2026, 0, 27, 0, 44, 31)
@@ -1986,6 +2268,8 @@ declare interface PasswordFieldProps<TFieldValues extends FieldValues> {
1986
2268
  errorHint?: string;
1987
2269
  }
1988
2270
 
2271
+ export { Polygon }
2272
+
1989
2273
  export declare function Popover({ ...props }: React_2.ComponentProps<typeof PopoverPrimitive.Root>): JSX.Element;
1990
2274
 
1991
2275
  export declare function PopoverContent({ className, align, sideOffset, ...props }: React_2.ComponentProps<typeof PopoverPrimitive.Content>): JSX.Element;
@@ -2736,7 +3020,7 @@ declare interface TextFieldProps<TFieldValues extends FieldValues> {
2736
3020
  suggestions?: string[];
2737
3021
  }
2738
3022
 
2739
- export declare function Timeline({ items, className, relativeTime, maxItems, emptyMessage, animated, animationDelay, }: TimelineProps): JSX.Element;
3023
+ export declare function Timeline({ items, className, relativeTime, maxItems, emptyMessage, animated, animationDelay, variant, formatDate: formatDateProp, }: TimelineProps): JSX.Element;
2740
3024
 
2741
3025
  export declare interface TimelineItem {
2742
3026
  id: string | number;
@@ -2762,6 +3046,10 @@ declare interface TimelineProps {
2762
3046
  animated?: boolean;
2763
3047
  /** Animation delay offset in ms */
2764
3048
  animationDelay?: number;
3049
+ /** Timeline display variant */
3050
+ variant?: 'default' | 'activity';
3051
+ /** Custom date formatter (overrides built-in relative/absolute) */
3052
+ formatDate?: (date: string | Date | number) => string;
2765
3053
  }
2766
3054
 
2767
3055
  /**
@@ -2830,6 +3118,10 @@ declare interface TreeNodeOperation {
2830
3118
 
2831
3119
  export declare const trLabels: LenaUILabels;
2832
3120
 
3121
+ export declare const TURKEY_CENTER: [number, number];
3122
+
3123
+ export declare const TURKEY_ZOOM = 6;
3124
+
2833
3125
  export declare function UnderConstructionPage({ title, description, homeLabel, onGoHome, }: UnderConstructionPageProps): JSX.Element;
2834
3126
 
2835
3127
  export declare interface UnderConstructionPageProps {
@@ -3041,6 +3333,8 @@ export declare interface UseLazyTabsReturn {
3041
3333
  */
3042
3334
  export declare function useLenaLabels<K extends keyof LenaUILabels>(namespace: K, overrides?: Partial<LenaUILabels[K]>): LenaUILabels[K];
3043
3335
 
3336
+ export { useMap }
3337
+
3044
3338
  /**
3045
3339
  * Hook specifically for numeric ID params (most common case)
3046
3340
  * Returns validated numeric ID or redirects