@texturehq/edges 1.7.1 → 1.7.3
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/components.manifest.json +914 -1406
- package/dist/index.cjs +9 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +98 -275
- package/dist/index.d.ts +98 -275
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/dist/{server-DAd0A202.d.cts → server-7ZzifHri.d.cts} +191 -8
- package/dist/{server-DAd0A202.d.ts → server-7ZzifHri.d.ts} +191 -8
- package/dist/server.cjs +13 -13
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +13 -13
- package/dist/server.js.map +1 -1
- package/dist/styles.css +5 -16
- package/dist/utilities.manifest.json +4 -1039
- package/package.json +2 -2
- package/scripts/generate-edges-docs.js +970 -0
- package/scripts/setup-cursor-rules.js +18 -0
- package/scripts/generate-components-manifest.js +0 -188
- package/scripts/generate-utilities-manifest.js +0 -392
|
@@ -8,7 +8,186 @@ import { ViewState, MapRef } from 'react-map-gl';
|
|
|
8
8
|
import * as d3_scale from 'd3-scale';
|
|
9
9
|
import { ScaleTime, ScaleLinear } from 'd3-scale';
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Core types for the formatting system
|
|
13
|
+
*/
|
|
14
|
+
type FieldValue = string | number | boolean | Date | null | undefined;
|
|
15
|
+
type FormattedValue = string | null;
|
|
16
|
+
type FormatterFunction = (value: FieldValue, ...args: unknown[]) => FormattedValue;
|
|
17
|
+
interface BaseFormat {
|
|
18
|
+
nullText?: string;
|
|
19
|
+
emptyText?: string;
|
|
20
|
+
hideWhenNull?: boolean;
|
|
21
|
+
hideWhenZero?: boolean;
|
|
22
|
+
}
|
|
23
|
+
type TextTransform = "uppercase" | "lowercase" | "capitalize" | "titleCase" | "sentenceCase";
|
|
24
|
+
type TextTruncatePosition = "start" | "middle" | "end";
|
|
25
|
+
interface TextFormat extends BaseFormat {
|
|
26
|
+
type: "text";
|
|
27
|
+
transform?: TextTransform | TextTransform[];
|
|
28
|
+
truncate?: {
|
|
29
|
+
length: number;
|
|
30
|
+
position: TextTruncatePosition;
|
|
31
|
+
ellipsis?: string;
|
|
32
|
+
};
|
|
33
|
+
wrap?: "normal" | "nowrap" | "pre" | "pre-wrap";
|
|
34
|
+
highlight?: {
|
|
35
|
+
pattern: string | RegExp;
|
|
36
|
+
className?: string;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
interface NumberFormat extends BaseFormat {
|
|
40
|
+
type: "number";
|
|
41
|
+
decimals?: number;
|
|
42
|
+
thousandsSeparator?: boolean;
|
|
43
|
+
notation?: "standard" | "scientific" | "compact" | "engineering";
|
|
44
|
+
compactDisplay?: "short" | "long";
|
|
45
|
+
sign?: "auto" | "never" | "always" | "exceptZero";
|
|
46
|
+
}
|
|
47
|
+
interface CurrencyFormat extends BaseFormat {
|
|
48
|
+
type: "currency";
|
|
49
|
+
currency?: string;
|
|
50
|
+
currencyDisplay?: "symbol" | "narrowSymbol" | "code" | "name";
|
|
51
|
+
minimumFractionDigits?: number;
|
|
52
|
+
maximumFractionDigits?: number;
|
|
53
|
+
thousandsSeparator?: boolean;
|
|
54
|
+
}
|
|
55
|
+
type DateFormatStyle = "short" | "medium" | "long" | "full";
|
|
56
|
+
interface DateFormat extends BaseFormat {
|
|
57
|
+
type: "date";
|
|
58
|
+
format?: string;
|
|
59
|
+
dateStyle?: DateFormatStyle;
|
|
60
|
+
timeStyle?: DateFormatStyle;
|
|
61
|
+
relative?: boolean;
|
|
62
|
+
timezone?: string;
|
|
63
|
+
}
|
|
64
|
+
interface BooleanFormat extends BaseFormat {
|
|
65
|
+
type: "boolean";
|
|
66
|
+
trueText?: string;
|
|
67
|
+
falseText?: string;
|
|
68
|
+
trueIcon?: string;
|
|
69
|
+
falseIcon?: string;
|
|
70
|
+
}
|
|
71
|
+
type EnergyUnit = "Wh" | "kWh" | "MWh" | "GWh";
|
|
72
|
+
interface EnergyFormat extends BaseFormat {
|
|
73
|
+
type: "energy";
|
|
74
|
+
unit?: EnergyUnit;
|
|
75
|
+
autoScale?: boolean;
|
|
76
|
+
decimals?: number;
|
|
77
|
+
}
|
|
78
|
+
type PowerUnit = "W" | "kW" | "MW" | "GW";
|
|
79
|
+
interface PowerFormat extends BaseFormat {
|
|
80
|
+
type: "power";
|
|
81
|
+
unit?: PowerUnit;
|
|
82
|
+
autoScale?: boolean;
|
|
83
|
+
decimals?: number;
|
|
84
|
+
}
|
|
85
|
+
type VoltageUnit = "mV" | "V" | "kV";
|
|
86
|
+
interface VoltageFormat extends BaseFormat {
|
|
87
|
+
type: "voltage";
|
|
88
|
+
unit?: VoltageUnit;
|
|
89
|
+
autoScale?: boolean;
|
|
90
|
+
decimals?: number;
|
|
91
|
+
}
|
|
92
|
+
type CurrentUnit = "mA" | "A" | "kA";
|
|
93
|
+
interface CurrentFormat extends BaseFormat {
|
|
94
|
+
type: "current";
|
|
95
|
+
unit?: CurrentUnit;
|
|
96
|
+
autoScale?: boolean;
|
|
97
|
+
decimals?: number;
|
|
98
|
+
}
|
|
99
|
+
type ResistanceUnit = "mΩ" | "Ω" | "kΩ" | "MΩ";
|
|
100
|
+
interface ResistanceFormat extends BaseFormat {
|
|
101
|
+
type: "resistance";
|
|
102
|
+
unit?: ResistanceUnit;
|
|
103
|
+
autoScale?: boolean;
|
|
104
|
+
decimals?: number;
|
|
105
|
+
}
|
|
106
|
+
type TemperatureUnit = "C" | "F" | "K";
|
|
107
|
+
type TemperatureUnitString = "CELSIUS" | "FAHRENHEIT" | "KELVIN";
|
|
108
|
+
interface TemperatureFormat extends BaseFormat {
|
|
109
|
+
type: "temperature";
|
|
110
|
+
unit?: TemperatureUnit | TemperatureUnitString;
|
|
111
|
+
decimals?: number;
|
|
112
|
+
showUnit?: boolean;
|
|
113
|
+
}
|
|
114
|
+
type DistanceUnit = "m" | "km" | "ft" | "mi" | "yd";
|
|
115
|
+
interface DistanceFormat extends BaseFormat {
|
|
116
|
+
type: "distance";
|
|
117
|
+
unit?: DistanceUnit;
|
|
118
|
+
autoScale?: boolean;
|
|
119
|
+
decimals?: number;
|
|
120
|
+
}
|
|
121
|
+
interface PhoneFormat extends BaseFormat {
|
|
122
|
+
type: "phone";
|
|
123
|
+
country?: string;
|
|
124
|
+
international?: boolean;
|
|
125
|
+
}
|
|
126
|
+
interface CustomFormat extends BaseFormat {
|
|
127
|
+
type: "custom";
|
|
128
|
+
formatter: FormatterFunction;
|
|
129
|
+
options?: Record<string, unknown>;
|
|
130
|
+
}
|
|
131
|
+
type FieldFormat = TextFormat | NumberFormat | CurrencyFormat | DateFormat | BooleanFormat | EnergyFormat | PowerFormat | VoltageFormat | CurrentFormat | ResistanceFormat | TemperatureFormat | DistanceFormat | PhoneFormat | CustomFormat;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Centralized formatting utility for UI components
|
|
135
|
+
* Used by Kpi, StatList, and other data display components
|
|
136
|
+
*/
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Common formatter type used by data display components
|
|
140
|
+
* Can be either a custom function or a FieldFormat object
|
|
141
|
+
*/
|
|
142
|
+
type ComponentFormatter = ((value: FieldValue) => React__default.ReactNode) | FieldFormat;
|
|
143
|
+
/**
|
|
144
|
+
* Options for formatting values in components
|
|
145
|
+
*/
|
|
146
|
+
interface ComponentFormatOptions {
|
|
147
|
+
/** The value to format */
|
|
148
|
+
value: FieldValue;
|
|
149
|
+
/** The formatter to apply */
|
|
150
|
+
formatter?: ComponentFormatter;
|
|
151
|
+
/** CSS class for null/empty values */
|
|
152
|
+
emptyClassName?: string;
|
|
153
|
+
/** Text to show for null/empty values */
|
|
154
|
+
emptyText?: React__default.ReactNode;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Format a value for display in a component
|
|
158
|
+
* Centralizes the logic used by Kpi, StatList, and similar components
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* ```tsx
|
|
162
|
+
* // In a component
|
|
163
|
+
* const formatted = formatComponentValue({
|
|
164
|
+
* value: 1500,
|
|
165
|
+
* formatter: { type: "power" }
|
|
166
|
+
* });
|
|
167
|
+
* // Returns: "1.5 kW"
|
|
168
|
+
* ```
|
|
169
|
+
*/
|
|
170
|
+
declare function formatComponentValue({ value, formatter, emptyClassName, emptyText, }: ComponentFormatOptions): React__default.ReactNode;
|
|
171
|
+
/**
|
|
172
|
+
* Hook for using the component formatter
|
|
173
|
+
* Provides memoization for better performance
|
|
174
|
+
*
|
|
175
|
+
* @example
|
|
176
|
+
* ```tsx
|
|
177
|
+
* function MyComponent({ value, formatter }) {
|
|
178
|
+
* const format = useComponentFormatter(formatter);
|
|
179
|
+
* const formatted = format(value);
|
|
180
|
+
* return <span>{formatted}</span>;
|
|
181
|
+
* }
|
|
182
|
+
* ```
|
|
183
|
+
*/
|
|
184
|
+
declare function useComponentFormatter(formatter?: ComponentFormatter, emptyClassName?: string, emptyText?: React__default.ReactNode): (value: FieldValue) => React__default.ReactNode;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Chart Y-axis formatter type
|
|
188
|
+
* Uses the main formatting system for consistency with Kpi, StatList, and DataTable
|
|
189
|
+
*/
|
|
190
|
+
type YFormatType = ComponentFormatter;
|
|
12
191
|
interface TooltipData {
|
|
13
192
|
xValue: Date;
|
|
14
193
|
series: TooltipSeries[];
|
|
@@ -27,7 +206,7 @@ interface ChartContextType {
|
|
|
27
206
|
yScale: ScaleLinear<number, number>;
|
|
28
207
|
width: number;
|
|
29
208
|
height: number;
|
|
30
|
-
|
|
209
|
+
yFormatter: YFormatType;
|
|
31
210
|
animationSettings: {
|
|
32
211
|
duration: number;
|
|
33
212
|
ease: string;
|
|
@@ -61,7 +240,11 @@ interface YFormatSettings {
|
|
|
61
240
|
tickInterval?: number;
|
|
62
241
|
tickFormat?: (value: number) => string;
|
|
63
242
|
}
|
|
64
|
-
|
|
243
|
+
/**
|
|
244
|
+
* Get Y-axis format settings from a ComponentFormatter
|
|
245
|
+
* Uses the main formatting system for consistency across all components
|
|
246
|
+
*/
|
|
247
|
+
declare function getYFormatSettings(formatter?: YFormatType): YFormatSettings;
|
|
65
248
|
declare const createXScale: (data: BaseDataPoint[], width: number) => d3_scale.ScaleTime<number, number, never>;
|
|
66
249
|
declare const createYScale: (data: BaseDataPoint[], height: number, formatType: YFormatType) => d3_scale.ScaleLinear<number, number, never>;
|
|
67
250
|
|
|
@@ -402,10 +585,10 @@ declare namespace Card {
|
|
|
402
585
|
var Content: typeof CardContent;
|
|
403
586
|
var Footer: typeof CardFooter;
|
|
404
587
|
}
|
|
405
|
-
declare function CardHeader({ title, subtitle, actions, className, isLoading }: CardHeaderProps): react_jsx_runtime.JSX.Element | null;
|
|
406
|
-
declare function CardMedia({ src, alt, aspectRatio, className, children, isLoading }: CardMediaProps): react_jsx_runtime.JSX.Element | null;
|
|
588
|
+
declare function CardHeader({ title, subtitle, actions, className, isLoading, }: CardHeaderProps): react_jsx_runtime.JSX.Element | null;
|
|
589
|
+
declare function CardMedia({ src, alt, aspectRatio, className, children, isLoading, }: CardMediaProps): react_jsx_runtime.JSX.Element | null;
|
|
407
590
|
declare function CardContent({ className, children, isLoading }: CardContentProps): react_jsx_runtime.JSX.Element | null;
|
|
408
|
-
declare function CardFooter({ className, children, align, isLoading }: CardFooterProps): react_jsx_runtime.JSX.Element | null;
|
|
591
|
+
declare function CardFooter({ className, children, align, isLoading, }: CardFooterProps): react_jsx_runtime.JSX.Element | null;
|
|
409
592
|
|
|
410
593
|
type CodeLanguage = "json" | "javascript" | "typescript" | "html" | "css" | "markdown" | "yaml" | "xml" | "python" | "sql";
|
|
411
594
|
type CodeTheme = "github" | "github_dark";
|
|
@@ -589,7 +772,7 @@ interface HeadingProps {
|
|
|
589
772
|
className?: string;
|
|
590
773
|
children?: React__default.ReactNode;
|
|
591
774
|
}
|
|
592
|
-
declare function Heading({ tag: Tag, size, height, className, children }: HeadingProps): react_jsx_runtime.JSX.Element;
|
|
775
|
+
declare function Heading({ tag: Tag, size, height, className, children, }: HeadingProps): react_jsx_runtime.JSX.Element;
|
|
593
776
|
|
|
594
777
|
interface LoaderProps {
|
|
595
778
|
/**
|
|
@@ -1473,4 +1656,4 @@ declare const isLightColor: (color: string) => boolean;
|
|
|
1473
1656
|
*/
|
|
1474
1657
|
declare const getContrastingTextColor: (backgroundColor: string) => string;
|
|
1475
1658
|
|
|
1476
|
-
export {
|
|
1659
|
+
export { type ColorSpec as $, type ActionItem as A, type BooleanFormat as B, type CurrentFormat as C, type DateFormat as D, type EnergyFormat as E, type FieldValue as F, type GeoJsonLayerSpec as G, Card as H, Icon as I, type CodeEditorProps as J, type CodeLanguage as K, type LayerSpec as L, type CodeTheme as M, type NumberFormat as N, CodeEditor as O, type PhoneFormat as P, type DateFieldProps as Q, type ResistanceFormat as R, DateField as S, type TemperatureUnitString as T, type FileUploadProps as U, type VoltageFormat as V, FileUpload as W, Heading as X, type YFormatType as Y, Loader as Z, Logo as _, type FormattedValue as a, type InteractiveMapProps as a0, type LayerFeature as a1, type LayerStyle as a2, type MapPoint as a3, type RenderType as a4, type StaticMapProps as a5, type ZoomStops as a6, InteractiveMap as a7, MAP_TYPES as a8, StaticMap as a9, getDefaultColors as aA, getResolvedColor as aB, getThemeCategoricalColors as aC, isLightColor as aD, type ComponentFormatOptions as aE, formatComponentValue as aF, useComponentFormatter as aG, type BaseFormat as aH, type TextTransform as aI, type TextTruncatePosition as aJ, type DateFormatStyle as aK, type EnergyUnit as aL, type PowerUnit as aM, type VoltageUnit as aN, type CurrentUnit as aO, type ResistanceUnit as aP, type DistanceUnit as aQ, type CustomFormat as aR, type MeterProps as aa, Meter as ab, type RichTextEditorProps as ac, RichTextEditor as ad, type SegmentedControlProps as ae, type SegmentOption as af, SegmentedControl as ag, type SideNavItem as ah, type SideNavProps as ai, SideNav as aj, TextLink as ak, type TopNavProps as al, TopNav as am, type TooltipSeries as an, ChartContext as ao, useChartContext as ap, type ChartMargin as aq, createXScale as ar, createYScale as as, defaultMargin as at, getYFormatSettings as au, type YFormatSettings as av, clearColorCache as aw, createCategoryColorMap as ax, getContrastingTextColor as ay, getDefaultChartColor as az, type DistanceFormat as b, type CurrencyFormat as c, type PowerFormat as d, type FormatterFunction as e, type TemperatureUnit as f, type TemperatureFormat as g, type TextFormat as h, type FieldFormat as i, type BaseDataPoint as j, type TooltipData as k, type IconName as l, type ComponentFormatter as m, type CustomPinsSpec as n, type RasterLayerSpec as o, type VectorLayerSpec as p, type ActionMenuProps as q, ActionMenu as r, type AppShellProps as s, AppShell as t, type AvatarProps as u, Avatar as v, type BadgeProps as w, Badge as x, type CardProps as y, type CardVariant as z };
|
|
@@ -8,7 +8,186 @@ import { ViewState, MapRef } from 'react-map-gl';
|
|
|
8
8
|
import * as d3_scale from 'd3-scale';
|
|
9
9
|
import { ScaleTime, ScaleLinear } from 'd3-scale';
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Core types for the formatting system
|
|
13
|
+
*/
|
|
14
|
+
type FieldValue = string | number | boolean | Date | null | undefined;
|
|
15
|
+
type FormattedValue = string | null;
|
|
16
|
+
type FormatterFunction = (value: FieldValue, ...args: unknown[]) => FormattedValue;
|
|
17
|
+
interface BaseFormat {
|
|
18
|
+
nullText?: string;
|
|
19
|
+
emptyText?: string;
|
|
20
|
+
hideWhenNull?: boolean;
|
|
21
|
+
hideWhenZero?: boolean;
|
|
22
|
+
}
|
|
23
|
+
type TextTransform = "uppercase" | "lowercase" | "capitalize" | "titleCase" | "sentenceCase";
|
|
24
|
+
type TextTruncatePosition = "start" | "middle" | "end";
|
|
25
|
+
interface TextFormat extends BaseFormat {
|
|
26
|
+
type: "text";
|
|
27
|
+
transform?: TextTransform | TextTransform[];
|
|
28
|
+
truncate?: {
|
|
29
|
+
length: number;
|
|
30
|
+
position: TextTruncatePosition;
|
|
31
|
+
ellipsis?: string;
|
|
32
|
+
};
|
|
33
|
+
wrap?: "normal" | "nowrap" | "pre" | "pre-wrap";
|
|
34
|
+
highlight?: {
|
|
35
|
+
pattern: string | RegExp;
|
|
36
|
+
className?: string;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
interface NumberFormat extends BaseFormat {
|
|
40
|
+
type: "number";
|
|
41
|
+
decimals?: number;
|
|
42
|
+
thousandsSeparator?: boolean;
|
|
43
|
+
notation?: "standard" | "scientific" | "compact" | "engineering";
|
|
44
|
+
compactDisplay?: "short" | "long";
|
|
45
|
+
sign?: "auto" | "never" | "always" | "exceptZero";
|
|
46
|
+
}
|
|
47
|
+
interface CurrencyFormat extends BaseFormat {
|
|
48
|
+
type: "currency";
|
|
49
|
+
currency?: string;
|
|
50
|
+
currencyDisplay?: "symbol" | "narrowSymbol" | "code" | "name";
|
|
51
|
+
minimumFractionDigits?: number;
|
|
52
|
+
maximumFractionDigits?: number;
|
|
53
|
+
thousandsSeparator?: boolean;
|
|
54
|
+
}
|
|
55
|
+
type DateFormatStyle = "short" | "medium" | "long" | "full";
|
|
56
|
+
interface DateFormat extends BaseFormat {
|
|
57
|
+
type: "date";
|
|
58
|
+
format?: string;
|
|
59
|
+
dateStyle?: DateFormatStyle;
|
|
60
|
+
timeStyle?: DateFormatStyle;
|
|
61
|
+
relative?: boolean;
|
|
62
|
+
timezone?: string;
|
|
63
|
+
}
|
|
64
|
+
interface BooleanFormat extends BaseFormat {
|
|
65
|
+
type: "boolean";
|
|
66
|
+
trueText?: string;
|
|
67
|
+
falseText?: string;
|
|
68
|
+
trueIcon?: string;
|
|
69
|
+
falseIcon?: string;
|
|
70
|
+
}
|
|
71
|
+
type EnergyUnit = "Wh" | "kWh" | "MWh" | "GWh";
|
|
72
|
+
interface EnergyFormat extends BaseFormat {
|
|
73
|
+
type: "energy";
|
|
74
|
+
unit?: EnergyUnit;
|
|
75
|
+
autoScale?: boolean;
|
|
76
|
+
decimals?: number;
|
|
77
|
+
}
|
|
78
|
+
type PowerUnit = "W" | "kW" | "MW" | "GW";
|
|
79
|
+
interface PowerFormat extends BaseFormat {
|
|
80
|
+
type: "power";
|
|
81
|
+
unit?: PowerUnit;
|
|
82
|
+
autoScale?: boolean;
|
|
83
|
+
decimals?: number;
|
|
84
|
+
}
|
|
85
|
+
type VoltageUnit = "mV" | "V" | "kV";
|
|
86
|
+
interface VoltageFormat extends BaseFormat {
|
|
87
|
+
type: "voltage";
|
|
88
|
+
unit?: VoltageUnit;
|
|
89
|
+
autoScale?: boolean;
|
|
90
|
+
decimals?: number;
|
|
91
|
+
}
|
|
92
|
+
type CurrentUnit = "mA" | "A" | "kA";
|
|
93
|
+
interface CurrentFormat extends BaseFormat {
|
|
94
|
+
type: "current";
|
|
95
|
+
unit?: CurrentUnit;
|
|
96
|
+
autoScale?: boolean;
|
|
97
|
+
decimals?: number;
|
|
98
|
+
}
|
|
99
|
+
type ResistanceUnit = "mΩ" | "Ω" | "kΩ" | "MΩ";
|
|
100
|
+
interface ResistanceFormat extends BaseFormat {
|
|
101
|
+
type: "resistance";
|
|
102
|
+
unit?: ResistanceUnit;
|
|
103
|
+
autoScale?: boolean;
|
|
104
|
+
decimals?: number;
|
|
105
|
+
}
|
|
106
|
+
type TemperatureUnit = "C" | "F" | "K";
|
|
107
|
+
type TemperatureUnitString = "CELSIUS" | "FAHRENHEIT" | "KELVIN";
|
|
108
|
+
interface TemperatureFormat extends BaseFormat {
|
|
109
|
+
type: "temperature";
|
|
110
|
+
unit?: TemperatureUnit | TemperatureUnitString;
|
|
111
|
+
decimals?: number;
|
|
112
|
+
showUnit?: boolean;
|
|
113
|
+
}
|
|
114
|
+
type DistanceUnit = "m" | "km" | "ft" | "mi" | "yd";
|
|
115
|
+
interface DistanceFormat extends BaseFormat {
|
|
116
|
+
type: "distance";
|
|
117
|
+
unit?: DistanceUnit;
|
|
118
|
+
autoScale?: boolean;
|
|
119
|
+
decimals?: number;
|
|
120
|
+
}
|
|
121
|
+
interface PhoneFormat extends BaseFormat {
|
|
122
|
+
type: "phone";
|
|
123
|
+
country?: string;
|
|
124
|
+
international?: boolean;
|
|
125
|
+
}
|
|
126
|
+
interface CustomFormat extends BaseFormat {
|
|
127
|
+
type: "custom";
|
|
128
|
+
formatter: FormatterFunction;
|
|
129
|
+
options?: Record<string, unknown>;
|
|
130
|
+
}
|
|
131
|
+
type FieldFormat = TextFormat | NumberFormat | CurrencyFormat | DateFormat | BooleanFormat | EnergyFormat | PowerFormat | VoltageFormat | CurrentFormat | ResistanceFormat | TemperatureFormat | DistanceFormat | PhoneFormat | CustomFormat;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Centralized formatting utility for UI components
|
|
135
|
+
* Used by Kpi, StatList, and other data display components
|
|
136
|
+
*/
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Common formatter type used by data display components
|
|
140
|
+
* Can be either a custom function or a FieldFormat object
|
|
141
|
+
*/
|
|
142
|
+
type ComponentFormatter = ((value: FieldValue) => React__default.ReactNode) | FieldFormat;
|
|
143
|
+
/**
|
|
144
|
+
* Options for formatting values in components
|
|
145
|
+
*/
|
|
146
|
+
interface ComponentFormatOptions {
|
|
147
|
+
/** The value to format */
|
|
148
|
+
value: FieldValue;
|
|
149
|
+
/** The formatter to apply */
|
|
150
|
+
formatter?: ComponentFormatter;
|
|
151
|
+
/** CSS class for null/empty values */
|
|
152
|
+
emptyClassName?: string;
|
|
153
|
+
/** Text to show for null/empty values */
|
|
154
|
+
emptyText?: React__default.ReactNode;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Format a value for display in a component
|
|
158
|
+
* Centralizes the logic used by Kpi, StatList, and similar components
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* ```tsx
|
|
162
|
+
* // In a component
|
|
163
|
+
* const formatted = formatComponentValue({
|
|
164
|
+
* value: 1500,
|
|
165
|
+
* formatter: { type: "power" }
|
|
166
|
+
* });
|
|
167
|
+
* // Returns: "1.5 kW"
|
|
168
|
+
* ```
|
|
169
|
+
*/
|
|
170
|
+
declare function formatComponentValue({ value, formatter, emptyClassName, emptyText, }: ComponentFormatOptions): React__default.ReactNode;
|
|
171
|
+
/**
|
|
172
|
+
* Hook for using the component formatter
|
|
173
|
+
* Provides memoization for better performance
|
|
174
|
+
*
|
|
175
|
+
* @example
|
|
176
|
+
* ```tsx
|
|
177
|
+
* function MyComponent({ value, formatter }) {
|
|
178
|
+
* const format = useComponentFormatter(formatter);
|
|
179
|
+
* const formatted = format(value);
|
|
180
|
+
* return <span>{formatted}</span>;
|
|
181
|
+
* }
|
|
182
|
+
* ```
|
|
183
|
+
*/
|
|
184
|
+
declare function useComponentFormatter(formatter?: ComponentFormatter, emptyClassName?: string, emptyText?: React__default.ReactNode): (value: FieldValue) => React__default.ReactNode;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Chart Y-axis formatter type
|
|
188
|
+
* Uses the main formatting system for consistency with Kpi, StatList, and DataTable
|
|
189
|
+
*/
|
|
190
|
+
type YFormatType = ComponentFormatter;
|
|
12
191
|
interface TooltipData {
|
|
13
192
|
xValue: Date;
|
|
14
193
|
series: TooltipSeries[];
|
|
@@ -27,7 +206,7 @@ interface ChartContextType {
|
|
|
27
206
|
yScale: ScaleLinear<number, number>;
|
|
28
207
|
width: number;
|
|
29
208
|
height: number;
|
|
30
|
-
|
|
209
|
+
yFormatter: YFormatType;
|
|
31
210
|
animationSettings: {
|
|
32
211
|
duration: number;
|
|
33
212
|
ease: string;
|
|
@@ -61,7 +240,11 @@ interface YFormatSettings {
|
|
|
61
240
|
tickInterval?: number;
|
|
62
241
|
tickFormat?: (value: number) => string;
|
|
63
242
|
}
|
|
64
|
-
|
|
243
|
+
/**
|
|
244
|
+
* Get Y-axis format settings from a ComponentFormatter
|
|
245
|
+
* Uses the main formatting system for consistency across all components
|
|
246
|
+
*/
|
|
247
|
+
declare function getYFormatSettings(formatter?: YFormatType): YFormatSettings;
|
|
65
248
|
declare const createXScale: (data: BaseDataPoint[], width: number) => d3_scale.ScaleTime<number, number, never>;
|
|
66
249
|
declare const createYScale: (data: BaseDataPoint[], height: number, formatType: YFormatType) => d3_scale.ScaleLinear<number, number, never>;
|
|
67
250
|
|
|
@@ -402,10 +585,10 @@ declare namespace Card {
|
|
|
402
585
|
var Content: typeof CardContent;
|
|
403
586
|
var Footer: typeof CardFooter;
|
|
404
587
|
}
|
|
405
|
-
declare function CardHeader({ title, subtitle, actions, className, isLoading }: CardHeaderProps): react_jsx_runtime.JSX.Element | null;
|
|
406
|
-
declare function CardMedia({ src, alt, aspectRatio, className, children, isLoading }: CardMediaProps): react_jsx_runtime.JSX.Element | null;
|
|
588
|
+
declare function CardHeader({ title, subtitle, actions, className, isLoading, }: CardHeaderProps): react_jsx_runtime.JSX.Element | null;
|
|
589
|
+
declare function CardMedia({ src, alt, aspectRatio, className, children, isLoading, }: CardMediaProps): react_jsx_runtime.JSX.Element | null;
|
|
407
590
|
declare function CardContent({ className, children, isLoading }: CardContentProps): react_jsx_runtime.JSX.Element | null;
|
|
408
|
-
declare function CardFooter({ className, children, align, isLoading }: CardFooterProps): react_jsx_runtime.JSX.Element | null;
|
|
591
|
+
declare function CardFooter({ className, children, align, isLoading, }: CardFooterProps): react_jsx_runtime.JSX.Element | null;
|
|
409
592
|
|
|
410
593
|
type CodeLanguage = "json" | "javascript" | "typescript" | "html" | "css" | "markdown" | "yaml" | "xml" | "python" | "sql";
|
|
411
594
|
type CodeTheme = "github" | "github_dark";
|
|
@@ -589,7 +772,7 @@ interface HeadingProps {
|
|
|
589
772
|
className?: string;
|
|
590
773
|
children?: React__default.ReactNode;
|
|
591
774
|
}
|
|
592
|
-
declare function Heading({ tag: Tag, size, height, className, children }: HeadingProps): react_jsx_runtime.JSX.Element;
|
|
775
|
+
declare function Heading({ tag: Tag, size, height, className, children, }: HeadingProps): react_jsx_runtime.JSX.Element;
|
|
593
776
|
|
|
594
777
|
interface LoaderProps {
|
|
595
778
|
/**
|
|
@@ -1473,4 +1656,4 @@ declare const isLightColor: (color: string) => boolean;
|
|
|
1473
1656
|
*/
|
|
1474
1657
|
declare const getContrastingTextColor: (backgroundColor: string) => string;
|
|
1475
1658
|
|
|
1476
|
-
export {
|
|
1659
|
+
export { type ColorSpec as $, type ActionItem as A, type BooleanFormat as B, type CurrentFormat as C, type DateFormat as D, type EnergyFormat as E, type FieldValue as F, type GeoJsonLayerSpec as G, Card as H, Icon as I, type CodeEditorProps as J, type CodeLanguage as K, type LayerSpec as L, type CodeTheme as M, type NumberFormat as N, CodeEditor as O, type PhoneFormat as P, type DateFieldProps as Q, type ResistanceFormat as R, DateField as S, type TemperatureUnitString as T, type FileUploadProps as U, type VoltageFormat as V, FileUpload as W, Heading as X, type YFormatType as Y, Loader as Z, Logo as _, type FormattedValue as a, type InteractiveMapProps as a0, type LayerFeature as a1, type LayerStyle as a2, type MapPoint as a3, type RenderType as a4, type StaticMapProps as a5, type ZoomStops as a6, InteractiveMap as a7, MAP_TYPES as a8, StaticMap as a9, getDefaultColors as aA, getResolvedColor as aB, getThemeCategoricalColors as aC, isLightColor as aD, type ComponentFormatOptions as aE, formatComponentValue as aF, useComponentFormatter as aG, type BaseFormat as aH, type TextTransform as aI, type TextTruncatePosition as aJ, type DateFormatStyle as aK, type EnergyUnit as aL, type PowerUnit as aM, type VoltageUnit as aN, type CurrentUnit as aO, type ResistanceUnit as aP, type DistanceUnit as aQ, type CustomFormat as aR, type MeterProps as aa, Meter as ab, type RichTextEditorProps as ac, RichTextEditor as ad, type SegmentedControlProps as ae, type SegmentOption as af, SegmentedControl as ag, type SideNavItem as ah, type SideNavProps as ai, SideNav as aj, TextLink as ak, type TopNavProps as al, TopNav as am, type TooltipSeries as an, ChartContext as ao, useChartContext as ap, type ChartMargin as aq, createXScale as ar, createYScale as as, defaultMargin as at, getYFormatSettings as au, type YFormatSettings as av, clearColorCache as aw, createCategoryColorMap as ax, getContrastingTextColor as ay, getDefaultChartColor as az, type DistanceFormat as b, type CurrencyFormat as c, type PowerFormat as d, type FormatterFunction as e, type TemperatureUnit as f, type TemperatureFormat as g, type TextFormat as h, type FieldFormat as i, type BaseDataPoint as j, type TooltipData as k, type IconName as l, type ComponentFormatter as m, type CustomPinsSpec as n, type RasterLayerSpec as o, type VectorLayerSpec as p, type ActionMenuProps as q, ActionMenu as r, type AppShellProps as s, AppShell as t, type AvatarProps as u, Avatar as v, type BadgeProps as w, Badge as x, type CardProps as y, type CardVariant as z };
|