@texturehq/edges 2.2.7 → 2.3.1
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/{colors-DsSW-pdc.d.cts → colors-AT5gFqGB.d.cts} +174 -170
- package/dist/{colors-BR-DX69l.d.ts → colors-DOYgrvZw.d.ts} +174 -170
- package/dist/form/index.cjs +2 -2
- package/dist/form/index.cjs.map +1 -1
- package/dist/form/index.js +2 -2
- package/dist/form/index.js.map +1 -1
- package/dist/index.cjs +10 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1331 -1294
- package/dist/index.d.ts +1331 -1294
- package/dist/index.js +10 -46
- package/dist/index.js.map +1 -1
- package/dist/rhf/index.cjs +2 -2
- package/dist/rhf/index.cjs.map +1 -1
- package/dist/rhf/index.js +2 -2
- package/dist/rhf/index.js.map +1 -1
- package/dist/server.cjs +2 -2
- 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 +2 -2
- package/dist/server.js.map +1 -1
- package/dist/styles.css +2 -112
- package/package.json +8 -13
- package/scripts/check-legacy-action-variants.mjs +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { BreadcrumbProps, BreadcrumbsProps, DateValue, CalendarProps as CalendarProps$1, ValidationResult, DisclosureGroupProps, DisclosurePanelProps, ButtonProps, DisclosureProps, DateRangePickerProps as DateRangePickerProps$1, FormProps, TooltipTriggerComponentProps, TooltipProps as TooltipProps$1, ListBoxProps as ListBoxProps$1, ListBoxItemProps, ModalOverlayProps, Key, PopoverProps as PopoverProps$1, ProgressBarProps as ProgressBarProps$1, RangeCalendarProps as RangeCalendarProps$1, TabProps as TabProps$1, TabListProps as TabListProps$1, TabPanelProps, TabsProps as TabsProps$2 } from 'react-aria-components';
|
|
2
2
|
export { BreadcrumbProps, BreadcrumbsProps, DialogTrigger } from 'react-aria-components';
|
|
3
|
+
import { Virtualizer } from '@tanstack/react-virtual';
|
|
3
4
|
import * as React$1 from 'react';
|
|
4
5
|
import React__default, { RefObject, ComponentType, ReactNode, HTMLAttributes, ComponentProps, CSSProperties, Component, ErrorInfo } from 'react';
|
|
5
|
-
import { U as FieldValue, V as BooleanFormat, W as FormattedValue, X as FieldFormat, Z as CurrentFormat, _ as DateFormat, $ as DistanceFormat, a0 as EnergyUnit, a1 as EnergyFormat, a2 as CurrencyFormat, a3 as NumberFormat, a4 as PhoneFormat, a5 as PowerFormat, a6 as FormatterFunction, a7 as ResistanceFormat, a8 as TemperatureFormat, a9 as TemperatureUnitString, aa as TemperatureUnit, ab as TextFormat, ac as VoltageFormat,
|
|
6
|
-
export { A as ActionItem, am as ActionMenu, a as ActionMenuProps, an as AppShell, b as AppShellProps, ao as Avatar, c as AvatarProps, ap as Badge, aq as BaseFormat, ar as ChartContext, C as ChartMargin, as as CodeEditor, e as CodeEditorProps, f as CodeLanguage, g as CodeTheme, at as ColorSpec, au as ComponentFormatOptions, av as CurrentUnit, aw as CustomFormat, ax as DEFAULT_MAP_TYPE, ay as DateFormatStyle, az as DistanceUnit, aA as ENTITY_CATEGORY_CONFIG, E as ENTITY_CONFIG, aB as EntityCategory, aC as EntityCategoryConfig, h as EntityConfig, i as EntityType, aD as GRID_STATE_COLORS, aE as GridStateColor, H as Heading, aF as InteractiveMap, aG as InteractiveMapHandle, I as InteractiveMapProps, aH as LayerFeature, aI as LayerStyle, L as Loader, j as Logo, aJ as MAP_TYPES, M as MapPoint, aK as MapType, aL as Meter, k as MeterProps, aM as MetricFormat, aN as PercentageFormat, aO as PowerUnit, aP as RenderType, aQ as ResistanceUnit, S as SegmentOption, aR as SegmentedControl, l as SegmentedControlProps, m as SideNav, n as SideNavItem, o as SideNavProps, aS as StackNav, aT as StackNavGroup, aU as StackNavItem, aV as StackNavLinkComponentProps, aW as StackNavProps, aX as StackNavTheme, aY as StaticMap, p as StaticMapProps, T as TextLink, aZ as TextTransform, a_ as TextTruncatePosition, r as TooltipSeries, s as TopNav, t as TopNavProps, a$ as VoltageUnit, Y as YFormatSettings, b0 as ZoomStops, b1 as activeDeviceStates, b2 as baselineFromPoint, v as clearColorCache, w as createCategoryColorMap, x as createXScale, y as createYScale, z as defaultMargin, b3 as deviceStateLabels, b4 as deviceStateMetricFormats, b5 as formatComponentValue, D as getContrastingTextColor, F as getDefaultChartColor, G as getDefaultColors, b6 as getDeviceStateDisplayLabel, b6 as getDeviceStateLabel, b7 as getEntityCategory, J as getEntityConfig, K as getEntityIcon, N as getEntityLabel, b8 as getGridStateLabel, O as getResolvedColor, P as getThemeCategoricalColors, Q as getYFormatSettings, b9 as gridStateLabels, ba as isActiveDeviceState, ba as isActiveState, R as isLightColor, bb as mapValuesToCategoricalColors, bc as useChartContext, bd as useComponentFormatter } from './colors-
|
|
7
|
-
import { Virtualizer } from '@tanstack/react-virtual';
|
|
6
|
+
import { U as FieldValue, V as BooleanFormat, W as FormattedValue, X as FieldFormat, Z as CurrentFormat, _ as DateFormat, $ as DistanceFormat, a0 as EnergyUnit, a1 as EnergyFormat, a2 as CurrencyFormat, a3 as NumberFormat, a4 as PhoneFormat, a5 as PowerFormat, a6 as FormatterFunction, a7 as ResistanceFormat, a8 as TemperatureFormat, a9 as TemperatureUnitString, aa as TemperatureUnit, ab as TextFormat, ac as VoltageFormat, B as BadgeProps, d as BaseDataPoint, u as YFormatType, q as TooltipData, ad as DeviceState, ae as GridState, af as ComponentFormatter, ag as LayerSpec, ah as CustomPinsSpec, ai as GeoJsonLayerSpec, aj as RasterLayerSpec, ak as VectorLayerSpec, al as ClusteredVectorLayerSpec } from './colors-AT5gFqGB.cjs';
|
|
7
|
+
export { A as ActionItem, am as ActionMenu, a as ActionMenuProps, an as AppShell, b as AppShellProps, ao as Avatar, c as AvatarProps, ap as Badge, aq as BaseFormat, ar as ChartContext, C as ChartMargin, as as CodeEditor, e as CodeEditorProps, f as CodeLanguage, g as CodeTheme, at as ColorSpec, au as ComponentFormatOptions, av as CurrentUnit, aw as CustomFormat, ax as DEFAULT_MAP_TYPE, ay as DateFormatStyle, az as DistanceUnit, aA as ENTITY_CATEGORY_CONFIG, E as ENTITY_CONFIG, aB as EntityCategory, aC as EntityCategoryConfig, h as EntityConfig, i as EntityType, aD as GRID_STATE_COLORS, aE as GridStateColor, H as Heading, aF as InteractiveMap, aG as InteractiveMapHandle, I as InteractiveMapProps, aH as LayerFeature, aI as LayerStyle, L as Loader, j as Logo, aJ as MAP_TYPES, M as MapPoint, aK as MapType, aL as Meter, k as MeterProps, aM as MetricFormat, aN as PercentageFormat, aO as PowerUnit, aP as RenderType, aQ as ResistanceUnit, S as SegmentOption, aR as SegmentedControl, l as SegmentedControlProps, m as SideNav, n as SideNavItem, o as SideNavProps, aS as StackNav, aT as StackNavGroup, aU as StackNavItem, aV as StackNavLinkComponentProps, aW as StackNavProps, aX as StackNavTheme, aY as StaticMap, p as StaticMapProps, T as TextLink, aZ as TextTransform, a_ as TextTruncatePosition, r as TooltipSeries, s as TopNav, t as TopNavProps, a$ as VoltageUnit, Y as YFormatSettings, b0 as ZoomStops, b1 as activeDeviceStates, b2 as baselineFromPoint, v as clearColorCache, w as createCategoryColorMap, x as createXScale, y as createYScale, z as defaultMargin, b3 as deviceStateLabels, b4 as deviceStateMetricFormats, b5 as formatComponentValue, D as getContrastingTextColor, F as getDefaultChartColor, G as getDefaultColors, b6 as getDeviceStateDisplayLabel, b6 as getDeviceStateLabel, b7 as getEntityCategory, J as getEntityConfig, K as getEntityIcon, N as getEntityLabel, b8 as getGridStateLabel, O as getResolvedColor, P as getThemeCategoricalColors, Q as getYFormatSettings, b9 as gridStateLabels, ba as isActiveDeviceState, ba as isActiveState, R as isLightColor, bb as mapValuesToCategoricalColors, bc as useChartContext, bd as useComponentFormatter } from './colors-AT5gFqGB.cjs';
|
|
8
8
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
9
9
|
import { I as Icon$1, S as Size, d as IconName$2, B as BaseInputProps } from './RichTextEditor-BNXNpG4s.cjs';
|
|
10
10
|
export { e as BaseProps, C as CUSTOM_ICON_REGISTRY, f as ClearButton, g as CustomIconName, a as DateField, D as DateFieldProps, h as Description, i as DescriptionPlacement, j as DescriptionProps, k as FieldError, l as FieldErrorProps, m as FieldGroup, n as FieldGroupProps, b as FileUpload, F as FileUploadProps, o as Input, p as InputProps, q as InputStyleProps, r as InputWrapper, L as Label, s as LabelProps, P as PhosphorIconName, c as RichTextEditor, R as RichTextEditorProps, t as getFieldGroupStyles, u as getInputBackgroundStyles, v as getInputBaseStyles, w as getInputStateStyles, x as useInputFocus } from './RichTextEditor-BNXNpG4s.cjs';
|
|
@@ -80,1553 +80,1404 @@ type UseBreakpointReturn = BreakpointState;
|
|
|
80
80
|
declare function useBreakpoint(defaultBreakpoint?: Breakpoint | "base"): BreakpointState;
|
|
81
81
|
|
|
82
82
|
/**
|
|
83
|
-
*
|
|
83
|
+
* Data Controls Types
|
|
84
|
+
*
|
|
85
|
+
* Core type definitions for client-side and server-side data filtering,
|
|
86
|
+
* sorting, faceting, and search operations.
|
|
84
87
|
*/
|
|
85
|
-
|
|
88
|
+
type FilterOperator = "eq" | "neq" | "in" | "nin" | "gt" | "gte" | "lt" | "lte" | "contains" | "startsWith" | "endsWith";
|
|
89
|
+
interface FilterCondition {
|
|
90
|
+
/** Field name (supports nested paths like 'user.profile.name') */
|
|
91
|
+
field: string;
|
|
92
|
+
/** Comparison operator */
|
|
93
|
+
operator: FilterOperator;
|
|
94
|
+
/** Value to compare against */
|
|
95
|
+
value: string | number | boolean | (string | number)[];
|
|
96
|
+
}
|
|
97
|
+
interface FilterGroup {
|
|
98
|
+
/** Logical operator combining conditions */
|
|
99
|
+
logic: "AND" | "OR";
|
|
100
|
+
/** Conditions or nested filter groups */
|
|
101
|
+
conditions: (FilterCondition | FilterGroup)[];
|
|
102
|
+
}
|
|
103
|
+
/** Root filter state - can be empty, a single group, or nested groups */
|
|
104
|
+
type FilterState = FilterGroup | null;
|
|
105
|
+
interface SortState {
|
|
106
|
+
/** Field to sort by (supports nested paths) */
|
|
107
|
+
field: string;
|
|
108
|
+
/** Sort direction */
|
|
109
|
+
direction: "asc" | "desc";
|
|
110
|
+
}
|
|
111
|
+
interface SearchConfig {
|
|
112
|
+
/** Search query string */
|
|
113
|
+
query: string;
|
|
114
|
+
/** Fields to search across */
|
|
115
|
+
fields: string[];
|
|
116
|
+
/** Use fuzzy matching (Fuse.js) - default true */
|
|
117
|
+
fuzzy?: boolean;
|
|
118
|
+
/** Fuse.js matching threshold (0.0 = perfect, 1.0 = anything) - default 0.3 */
|
|
119
|
+
threshold?: number;
|
|
120
|
+
}
|
|
121
|
+
type FacetType = "string" | "number" | "boolean" | "date";
|
|
122
|
+
interface FacetConfig {
|
|
123
|
+
/** Field name to facet on */
|
|
124
|
+
field: string;
|
|
125
|
+
/** Display label for the facet */
|
|
126
|
+
label: string;
|
|
127
|
+
/** Data type of the field */
|
|
128
|
+
type?: FacetType;
|
|
129
|
+
/** Optional: Provide predefined values for the facet (useful for enums) */
|
|
130
|
+
values?: Array<{
|
|
131
|
+
value: string | number;
|
|
132
|
+
label: string;
|
|
133
|
+
}>;
|
|
134
|
+
/** Number of options to show before requiring search (default: 10) */
|
|
135
|
+
searchThreshold?: number;
|
|
136
|
+
/** Max options to show initially, with "Show all" button for rest (default: 50) */
|
|
137
|
+
maxVisibleOptions?: number;
|
|
138
|
+
/** Optional description text to show below the label */
|
|
139
|
+
description?: string;
|
|
140
|
+
/** Optional: Custom render function for option labels (e.g., to show Badges) */
|
|
141
|
+
renderLabel?: (value: string, label: string) => React.ReactNode;
|
|
142
|
+
/** Optional: Group name for organizing filters in FilterDialog */
|
|
143
|
+
group?: string;
|
|
144
|
+
}
|
|
145
|
+
interface FacetCounts {
|
|
146
|
+
[field: string]: {
|
|
147
|
+
[value: string]: number;
|
|
148
|
+
};
|
|
149
|
+
}
|
|
86
150
|
/**
|
|
87
|
-
*
|
|
151
|
+
* Create a single filter condition
|
|
88
152
|
*/
|
|
89
|
-
declare
|
|
153
|
+
declare function createFilter(field: string, operator: FilterOperator, value: string | number | boolean | (string | number)[]): FilterCondition;
|
|
90
154
|
/**
|
|
91
|
-
*
|
|
155
|
+
* Create a filter group from multiple conditions with AND logic
|
|
92
156
|
*/
|
|
93
|
-
declare
|
|
157
|
+
declare function createFilters(conditions: FilterCondition[], logic?: "AND" | "OR"): FilterGroup;
|
|
94
158
|
/**
|
|
95
|
-
*
|
|
159
|
+
* Create an empty filter state
|
|
96
160
|
*/
|
|
97
|
-
declare
|
|
161
|
+
declare function createEmptyFilter(): FilterGroup;
|
|
98
162
|
/**
|
|
99
|
-
*
|
|
163
|
+
* Check if a filter state is empty (no conditions)
|
|
100
164
|
*/
|
|
101
|
-
declare
|
|
165
|
+
declare function isFilterEmpty(filter: FilterState): boolean;
|
|
102
166
|
/**
|
|
103
|
-
*
|
|
167
|
+
* Convert structured filter state to simple display chips
|
|
168
|
+
* Used for backward compatibility with existing FilterChips component
|
|
104
169
|
*/
|
|
105
|
-
|
|
170
|
+
interface FilterChip {
|
|
171
|
+
id: string;
|
|
172
|
+
label: string;
|
|
173
|
+
value: string;
|
|
174
|
+
}
|
|
175
|
+
declare function filterToChips(filter: FilterState, facetConfigs?: FacetConfig[]): FilterChip[];
|
|
106
176
|
/**
|
|
107
|
-
*
|
|
177
|
+
* Add a condition to a filter state
|
|
108
178
|
*/
|
|
109
|
-
declare
|
|
179
|
+
declare function addFilterCondition(filter: FilterState, condition: FilterCondition): FilterGroup;
|
|
110
180
|
/**
|
|
111
|
-
*
|
|
181
|
+
* Remove a condition from a filter state by field
|
|
112
182
|
*/
|
|
113
|
-
declare
|
|
183
|
+
declare function removeFilterCondition(filter: FilterState, field: string): FilterGroup;
|
|
114
184
|
/**
|
|
115
|
-
*
|
|
185
|
+
* Get all unique fields being filtered on
|
|
116
186
|
*/
|
|
117
|
-
declare
|
|
187
|
+
declare function getFilterFields(filter: FilterState): string[];
|
|
118
188
|
|
|
189
|
+
interface UseClientDataControlsOptions<T> {
|
|
190
|
+
/** Raw data to process */
|
|
191
|
+
data: T[];
|
|
192
|
+
/** Filter state */
|
|
193
|
+
filters?: FilterState;
|
|
194
|
+
/** Sort state */
|
|
195
|
+
sort?: SortState | null;
|
|
196
|
+
/** Search configuration */
|
|
197
|
+
search?: SearchConfig | null;
|
|
198
|
+
/** Facet configurations */
|
|
199
|
+
facetConfigs?: FacetConfig[];
|
|
200
|
+
}
|
|
201
|
+
interface UseClientDataControlsResult<T> {
|
|
202
|
+
/** Processed data (filtered, sorted, searched) */
|
|
203
|
+
data: T[];
|
|
204
|
+
/** Facet counts computed from filtered data */
|
|
205
|
+
facetCounts: FacetCounts;
|
|
206
|
+
/** Number of results after filtering/searching */
|
|
207
|
+
resultCount: number;
|
|
208
|
+
}
|
|
119
209
|
/**
|
|
120
|
-
*
|
|
210
|
+
* useClientDataControls
|
|
121
211
|
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*/
|
|
125
|
-
/**
|
|
126
|
-
* Format battery capacity (kWh)
|
|
212
|
+
* Client-side hook for filtering, sorting, searching, and faceting data.
|
|
213
|
+
* Uses memoization to avoid unnecessary recomputation.
|
|
127
214
|
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
215
|
+
* Operations are applied in this order:
|
|
216
|
+
* 1. Search (fuzzy or exact matching)
|
|
217
|
+
* 2. Filter (structured conditions)
|
|
218
|
+
* 3. Facet computation (on filtered data)
|
|
219
|
+
* 4. Sort
|
|
131
220
|
*
|
|
132
221
|
* @example
|
|
133
|
-
* ```
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
222
|
+
* ```tsx
|
|
223
|
+
* const { data, facetCounts, resultCount } = useClientDataControls({
|
|
224
|
+
* data: rawData,
|
|
225
|
+
* filters: createFilters([
|
|
226
|
+
* createFilter('department', 'in', ['Engineering', 'Sales'])
|
|
227
|
+
* ]),
|
|
228
|
+
* sort: { field: 'name', direction: 'asc' },
|
|
229
|
+
* search: { query: searchQuery, fields: ['name', 'email'] },
|
|
230
|
+
* facetConfigs: [
|
|
231
|
+
* { field: 'department', label: 'Department' },
|
|
232
|
+
* { field: 'status', label: 'Status' }
|
|
233
|
+
* ]
|
|
234
|
+
* });
|
|
137
235
|
* ```
|
|
138
236
|
*/
|
|
139
|
-
declare function
|
|
237
|
+
declare function useClientDataControls<T>({ data, filters, sort, search, facetConfigs, }: UseClientDataControlsOptions<T>): UseClientDataControlsResult<T>;
|
|
238
|
+
|
|
140
239
|
/**
|
|
141
|
-
*
|
|
240
|
+
* useContainerBreakpoint — measures a container element's width and returns
|
|
241
|
+
* the same BreakpointState shape as useBreakpoint, but derived from the
|
|
242
|
+
* container, not the window.
|
|
142
243
|
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
244
|
+
* Blocks that need to respond to their render width (not the viewport) should
|
|
245
|
+
* use this hook instead of useBreakpoint. When rendered inside a
|
|
246
|
+
* ContainerQueryProvider, the hook reads from context (no ref needed). When
|
|
247
|
+
* no provider is present, it falls back to measuring its own ref, or
|
|
248
|
+
* ultimately to window-based breakpoints.
|
|
146
249
|
*
|
|
147
|
-
* @
|
|
148
|
-
* ```typescript
|
|
149
|
-
* formatPowerRating(5.2); // "5.2 kW"
|
|
150
|
-
* formatPowerRating(2500); // "2.5 MW"
|
|
151
|
-
* formatPowerRating(null); // null
|
|
152
|
-
* ```
|
|
250
|
+
* @returns BreakpointState — same shape as useBreakpoint
|
|
153
251
|
*/
|
|
154
|
-
declare function
|
|
252
|
+
declare function useContainerBreakpoint(containerRef?: React.RefObject<HTMLElement | null>): BreakpointState;
|
|
155
253
|
|
|
254
|
+
interface ServerDataState {
|
|
255
|
+
filters: FilterState;
|
|
256
|
+
sort: SortState | null;
|
|
257
|
+
search: SearchConfig | null;
|
|
258
|
+
}
|
|
259
|
+
interface UseServerDataControlsOptions {
|
|
260
|
+
/** Filter state */
|
|
261
|
+
filters: FilterState;
|
|
262
|
+
/** Sort state */
|
|
263
|
+
sort: SortState | null;
|
|
264
|
+
/** Search configuration */
|
|
265
|
+
search: SearchConfig | null;
|
|
266
|
+
/** Callback when state changes (debounced for search) */
|
|
267
|
+
onStateChange: (state: ServerDataState) => void;
|
|
268
|
+
/** Search debounce delay in ms (default: 300) */
|
|
269
|
+
searchDebounce?: number;
|
|
270
|
+
}
|
|
156
271
|
/**
|
|
157
|
-
*
|
|
272
|
+
* useServerDataControls
|
|
158
273
|
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
* because a human reads them in context, but in a spreadsheet that mixes
|
|
162
|
-
* magnitudes in a single column and makes the data unusable.
|
|
274
|
+
* Server-side hook that notifies the parent when filter/sort/search state changes.
|
|
275
|
+
* Search queries are debounced to avoid excessive API calls.
|
|
163
276
|
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
277
|
+
* This hook doesn't manipulate data - it just provides a clean way to:
|
|
278
|
+
* 1. Debounce search input
|
|
279
|
+
* 2. Notify when any state changes
|
|
280
|
+
* 3. Trigger server refetch
|
|
166
281
|
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
* (hideWhenNull / hideWhenZero / null value).
|
|
282
|
+
* @example
|
|
283
|
+
* ```tsx
|
|
284
|
+
* const [filters, setFilters] = useState(null);
|
|
285
|
+
* const [sort, setSort] = useState({ field: 'name', direction: 'asc' });
|
|
286
|
+
* const [search, setSearch] = useState({ query: '', fields: ['name'] });
|
|
173
287
|
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
288
|
+
* useServerDataControls({
|
|
289
|
+
* filters,
|
|
290
|
+
* sort,
|
|
291
|
+
* search,
|
|
292
|
+
* onStateChange: (state) => {
|
|
293
|
+
* // Refetch data with new parameters
|
|
294
|
+
* refetch({
|
|
295
|
+
* filters: state.filters,
|
|
296
|
+
* sort: state.sort,
|
|
297
|
+
* search: state.search?.query
|
|
298
|
+
* });
|
|
299
|
+
* }
|
|
300
|
+
* });
|
|
301
|
+
* ```
|
|
177
302
|
*/
|
|
303
|
+
declare function useServerDataControls({ filters, sort, search, onStateChange, searchDebounce, }: UseServerDataControlsOptions): void;
|
|
178
304
|
|
|
305
|
+
interface UseDataControlsClientOptions<T> {
|
|
306
|
+
mode: "client";
|
|
307
|
+
/** Raw data to process (required in client mode) */
|
|
308
|
+
data: T[];
|
|
309
|
+
/** Filter state */
|
|
310
|
+
filters?: FilterState;
|
|
311
|
+
/** Sort state */
|
|
312
|
+
sort?: SortState | null;
|
|
313
|
+
/** Search configuration */
|
|
314
|
+
search?: SearchConfig | null;
|
|
315
|
+
/** Facet configurations */
|
|
316
|
+
facetConfigs?: FacetConfig[];
|
|
317
|
+
}
|
|
318
|
+
interface UseDataControlsServerOptions<T> {
|
|
319
|
+
mode: "server";
|
|
320
|
+
/** Data from server (already filtered/sorted) */
|
|
321
|
+
data: T[];
|
|
322
|
+
/** Filter state */
|
|
323
|
+
filters: FilterState;
|
|
324
|
+
/** Sort state */
|
|
325
|
+
sort: SortState | null;
|
|
326
|
+
/** Search configuration */
|
|
327
|
+
search: SearchConfig | null;
|
|
328
|
+
/** Callback when state changes (required in server mode) */
|
|
329
|
+
onStateChange: (state: ServerDataState) => void;
|
|
330
|
+
/** Search debounce delay in ms (default: 300) */
|
|
331
|
+
searchDebounce?: number;
|
|
332
|
+
/** Result count from server */
|
|
333
|
+
resultCount?: number;
|
|
334
|
+
/** Facet counts from server */
|
|
335
|
+
facetCounts?: FacetCounts;
|
|
336
|
+
}
|
|
337
|
+
type UseDataControlsOptions<T> = UseDataControlsClientOptions<T> | UseDataControlsServerOptions<T>;
|
|
338
|
+
interface UseDataControlsResult<T> {
|
|
339
|
+
/** Processed data (client mode) or server data (server mode) */
|
|
340
|
+
data: T[];
|
|
341
|
+
/** Facet counts (computed in client mode, passed through in server mode) */
|
|
342
|
+
facetCounts: FacetCounts;
|
|
343
|
+
/** Result count (computed in client mode, passed through in server mode) */
|
|
344
|
+
resultCount: number;
|
|
345
|
+
}
|
|
179
346
|
/**
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
* -
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
*
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
*
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
*
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
* Format as kiloamps (rarely used but included for completeness)
|
|
221
|
-
*/
|
|
222
|
-
declare const toKiloamps: (value: number | null | undefined, decimals?: number) => string | null;
|
|
223
|
-
/**
|
|
224
|
-
* Auto-scale current to the most appropriate unit
|
|
225
|
-
*/
|
|
226
|
-
declare const autoScaleCurrent: (value: number | null | undefined, decimals?: number) => string | null;
|
|
227
|
-
/**
|
|
228
|
-
* Format current according to CurrentFormat specification
|
|
347
|
+
* useDataControls
|
|
348
|
+
*
|
|
349
|
+
* Unified hook for managing data filtering, sorting, searching, and faceting.
|
|
350
|
+
* Supports both client-side and server-side modes.
|
|
351
|
+
*
|
|
352
|
+
* **Client Mode:**
|
|
353
|
+
* - Processes data locally using pure functions
|
|
354
|
+
* - Computes facet counts automatically
|
|
355
|
+
* - Best for datasets < 5000 rows
|
|
356
|
+
*
|
|
357
|
+
* **Server Mode:**
|
|
358
|
+
* - Notifies parent when state changes (debounced for search)
|
|
359
|
+
* - Passes through server-provided data and counts
|
|
360
|
+
* - Best for large datasets or complex queries
|
|
361
|
+
*
|
|
362
|
+
* @example Client Mode
|
|
363
|
+
* ```tsx
|
|
364
|
+
* const { data, facetCounts, resultCount } = useDataControls({
|
|
365
|
+
* mode: 'client',
|
|
366
|
+
* data: rawData,
|
|
367
|
+
* filters: createFilters([...]),
|
|
368
|
+
* sort: { field: 'name', direction: 'asc' },
|
|
369
|
+
* search: { query: searchQuery, fields: ['name', 'email'] },
|
|
370
|
+
* facetConfigs: [{ field: 'department', label: 'Department' }]
|
|
371
|
+
* });
|
|
372
|
+
* ```
|
|
373
|
+
*
|
|
374
|
+
* @example Server Mode
|
|
375
|
+
* ```tsx
|
|
376
|
+
* const { data, facetCounts, resultCount } = useDataControls({
|
|
377
|
+
* mode: 'server',
|
|
378
|
+
* data: serverData, // Already filtered
|
|
379
|
+
* filters,
|
|
380
|
+
* sort,
|
|
381
|
+
* search,
|
|
382
|
+
* resultCount: totalCount,
|
|
383
|
+
* facetCounts: serverFacets,
|
|
384
|
+
* onStateChange: (state) => refetch(state)
|
|
385
|
+
* });
|
|
386
|
+
* ```
|
|
229
387
|
*/
|
|
230
|
-
declare
|
|
231
|
-
declare const toMA: (value: number | null | undefined, decimals?: number) => string | null;
|
|
232
|
-
declare const toA: (value: number | null | undefined, decimals?: number) => string | null;
|
|
233
|
-
declare const toKA: (value: number | null | undefined, decimals?: number) => string | null;
|
|
388
|
+
declare function useDataControls<T>(options: UseDataControlsOptions<T>): UseDataControlsResult<T>;
|
|
234
389
|
|
|
235
|
-
|
|
236
|
-
* Date formatting utilities using Luxon
|
|
237
|
-
*/
|
|
390
|
+
declare function useDebounce<T>(value: T, delay?: number): T;
|
|
238
391
|
|
|
392
|
+
interface ElementSize {
|
|
393
|
+
width: number;
|
|
394
|
+
height: number;
|
|
395
|
+
}
|
|
396
|
+
interface UseElementSizeResult<T extends HTMLElement = HTMLElement> {
|
|
397
|
+
ref: (node: T | null) => void;
|
|
398
|
+
width: number;
|
|
399
|
+
height: number;
|
|
400
|
+
}
|
|
239
401
|
/**
|
|
240
|
-
*
|
|
402
|
+
* useElementSize
|
|
241
403
|
*
|
|
242
|
-
*
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
*
|
|
404
|
+
* A performant hook that tracks the dimensions of a DOM element using ResizeObserver.
|
|
405
|
+
* Returns a callback ref to attach to the element and its current width/height.
|
|
406
|
+
*
|
|
407
|
+
* Performance optimizations:
|
|
408
|
+
* - Uses ResizeObserver for efficient resize detection
|
|
409
|
+
* - Debounces updates using requestAnimationFrame
|
|
410
|
+
* - Cleans up observer on unmount
|
|
246
411
|
*
|
|
247
412
|
* @example
|
|
248
|
-
* ```
|
|
249
|
-
*
|
|
250
|
-
*
|
|
251
|
-
*
|
|
413
|
+
* ```tsx
|
|
414
|
+
* const { ref, width, height } = useElementSize();
|
|
415
|
+
*
|
|
416
|
+
* return (
|
|
417
|
+
* <div ref={ref}>
|
|
418
|
+
* Width: {width}px, Height: {height}px
|
|
419
|
+
* </div>
|
|
420
|
+
* );
|
|
252
421
|
* ```
|
|
253
422
|
*/
|
|
254
|
-
declare
|
|
423
|
+
declare function useElementSize<T extends HTMLElement = HTMLElement>(): UseElementSizeResult<T>;
|
|
424
|
+
|
|
425
|
+
type LoadingState = "idle" | "loading" | "loading-more" | "error";
|
|
426
|
+
interface UseInfiniteScrollOptions<T = unknown> {
|
|
427
|
+
/** Array of items being displayed */
|
|
428
|
+
items: T[];
|
|
429
|
+
/** Callback to load more items (optional - if not provided, no infinite scroll) */
|
|
430
|
+
onLoadMore?: () => void | Promise<void>;
|
|
431
|
+
/** Whether there are more items to load */
|
|
432
|
+
hasMore?: boolean;
|
|
433
|
+
/** Auto-detects initial vs loading-more from items.length */
|
|
434
|
+
isLoading?: boolean;
|
|
435
|
+
/** Explicit loading state override (takes precedence) */
|
|
436
|
+
loadingState?: LoadingState;
|
|
437
|
+
/** Enable virtualization (default: true for 100+ items) */
|
|
438
|
+
enableVirtualization?: boolean;
|
|
439
|
+
/** Estimated size of each item in pixels */
|
|
440
|
+
estimatedItemSize?: number;
|
|
441
|
+
/** Number of items to render outside viewport */
|
|
442
|
+
overscan?: number;
|
|
443
|
+
/** Custom scroll element (defaults to parent) */
|
|
444
|
+
scrollElement?: HTMLElement | null;
|
|
445
|
+
/** Distance from bottom in pixels to trigger load */
|
|
446
|
+
loadMoreThreshold?: number;
|
|
447
|
+
}
|
|
448
|
+
interface UseInfiniteScrollReturn {
|
|
449
|
+
virtualizer: Virtualizer<HTMLElement, Element> | null;
|
|
450
|
+
virtualItems: ReturnType<Virtualizer<HTMLElement, Element>["getVirtualItems"]>;
|
|
451
|
+
computedLoadingState: LoadingState;
|
|
452
|
+
isInitialLoad: boolean;
|
|
453
|
+
isLoadingMore: boolean;
|
|
454
|
+
scrollRef: RefObject<HTMLDivElement | null>;
|
|
455
|
+
loadMoreRef: RefObject<HTMLDivElement | null>;
|
|
456
|
+
scrollToIndex: (index: number, options?: {
|
|
457
|
+
align?: "start" | "center" | "end";
|
|
458
|
+
}) => void;
|
|
459
|
+
scrollToTop: () => void;
|
|
460
|
+
}
|
|
255
461
|
/**
|
|
256
|
-
*
|
|
257
|
-
* Automatically chooses the most appropriate unit.
|
|
462
|
+
* useInfiniteScroll
|
|
258
463
|
*
|
|
259
|
-
*
|
|
260
|
-
*
|
|
464
|
+
* Hook for implementing infinite scroll with optional virtualization.
|
|
465
|
+
* Intelligently detects initial vs loading-more states from context.
|
|
466
|
+
*
|
|
467
|
+
* Features:
|
|
468
|
+
* - Smart loading state detection (initial vs loading-more)
|
|
469
|
+
* - Optional explicit state control
|
|
470
|
+
* - TanStack Virtual integration for performance
|
|
471
|
+
* - Intersection Observer for load triggering
|
|
472
|
+
* - Configurable virtualization threshold
|
|
261
473
|
*
|
|
262
474
|
* @example
|
|
263
|
-
* ```
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
*
|
|
475
|
+
* ```tsx
|
|
476
|
+
* const { scrollRef, computedLoadingState, isLoadingMore } = useInfiniteScroll({
|
|
477
|
+
* items,
|
|
478
|
+
* onLoadMore: fetchNextPage,
|
|
479
|
+
* hasMore: hasNextPage,
|
|
480
|
+
* isLoading: isFetching,
|
|
481
|
+
* });
|
|
267
482
|
* ```
|
|
268
483
|
*/
|
|
269
|
-
declare
|
|
270
|
-
|
|
271
|
-
* Format date with full date and time including weekday
|
|
272
|
-
*/
|
|
273
|
-
declare const toFullDateTime: (value: string | Date | number | null | undefined, timezone?: string) => string | null;
|
|
274
|
-
/**
|
|
275
|
-
* Format date to ISO string
|
|
276
|
-
*/
|
|
277
|
-
declare const toISOString: (value: string | Date | number | null | undefined) => string | null;
|
|
278
|
-
/**
|
|
279
|
-
* Format date with custom format string
|
|
280
|
-
*/
|
|
281
|
-
declare const toCustomDateFormat: (value: string | Date | number | null | undefined, format: string, timezone?: string) => string | null;
|
|
282
|
-
/**
|
|
283
|
-
* Get formatted date parts
|
|
284
|
-
*/
|
|
285
|
-
declare const getDateParts: (value: string | Date | number | null | undefined) => {
|
|
286
|
-
year: number;
|
|
287
|
-
month: number;
|
|
288
|
-
day: number;
|
|
289
|
-
weekday: number;
|
|
290
|
-
hour: number;
|
|
291
|
-
minute: number;
|
|
292
|
-
second: number;
|
|
293
|
-
millisecond: number;
|
|
294
|
-
weekdayShort: string | null;
|
|
295
|
-
weekdayLong: string | null;
|
|
296
|
-
monthShort: string | null;
|
|
297
|
-
monthLong: string | null;
|
|
298
|
-
} | null;
|
|
484
|
+
declare function useInfiniteScroll<T = unknown>({ items, onLoadMore, hasMore, isLoading, loadingState, enableVirtualization, estimatedItemSize, overscan, scrollElement, loadMoreThreshold, }: UseInfiniteScrollOptions<T>): UseInfiniteScrollReturn;
|
|
485
|
+
|
|
299
486
|
/**
|
|
300
|
-
*
|
|
487
|
+
* Hook for managing localStorage values with React state synchronization
|
|
488
|
+
* @param key - The localStorage key
|
|
489
|
+
* @param initialValue - The initial value if nothing is stored
|
|
490
|
+
* @returns [value, setValue, removeValue] - Current value, setter function, and remove function
|
|
301
491
|
*/
|
|
302
|
-
declare
|
|
492
|
+
declare function useLocalStorage<T>(key: string, initialValue: T): [T, (value: T | ((val: T) => T)) => void, () => void];
|
|
303
493
|
|
|
304
494
|
/**
|
|
305
|
-
*
|
|
495
|
+
* Hook to check if a media query matches the current viewport
|
|
496
|
+
*
|
|
497
|
+
* @param query - A CSS media query string (e.g., "(min-width: 768px)")
|
|
498
|
+
* @param defaultValue - The default value to return during SSR or before the first render
|
|
499
|
+
* @returns A boolean indicating whether the media query matches
|
|
500
|
+
*
|
|
501
|
+
* @example
|
|
502
|
+
* ```tsx
|
|
503
|
+
* const isMobile = useMediaQuery('(max-width: 767px)');
|
|
504
|
+
* const prefersReducedMotion = useMediaQuery('(prefers-reduced-motion: reduce)');
|
|
505
|
+
* const isLandscape = useMediaQuery('(orientation: landscape)');
|
|
506
|
+
* ```
|
|
306
507
|
*/
|
|
508
|
+
declare function useMediaQuery(query: string, defaultValue?: boolean): boolean;
|
|
509
|
+
|
|
510
|
+
type SortDirection = "asc" | "desc";
|
|
511
|
+
type CellAlignment = "left" | "center" | "right";
|
|
512
|
+
type TableDensity = "compact" | "default" | "relaxed";
|
|
513
|
+
type CellEmphasis = "strong" | "high" | "normal" | "low";
|
|
514
|
+
type LinkBehavior = "none" | "hover" | "visible";
|
|
515
|
+
type TableLayout = "auto" | "fixed" | "responsive";
|
|
516
|
+
type TableWidth = "full" | "auto" | "contained";
|
|
517
|
+
type MobileRenderer = "auto" | "cards" | "custom" | "none";
|
|
518
|
+
type MobileBreakpoint = "sm" | "md" | "lg" | "xl";
|
|
519
|
+
interface SortConfig {
|
|
520
|
+
columnId: string;
|
|
521
|
+
direction: SortDirection;
|
|
522
|
+
}
|
|
523
|
+
interface CellContext {
|
|
524
|
+
isLoading: boolean;
|
|
525
|
+
isSelected?: boolean;
|
|
526
|
+
isHovered?: boolean;
|
|
527
|
+
rowIndex: number;
|
|
528
|
+
columnIndex: number;
|
|
529
|
+
density: TableDensity;
|
|
530
|
+
}
|
|
531
|
+
interface CellComponentProps<T = any> {
|
|
532
|
+
value: any;
|
|
533
|
+
row: T;
|
|
534
|
+
context: CellContext;
|
|
535
|
+
[key: string]: any;
|
|
536
|
+
}
|
|
537
|
+
type CellComponent<T = any> = ComponentType<CellComponentProps<T>>;
|
|
538
|
+
interface MobileConfig {
|
|
539
|
+
priority?: 1 | 2 | 3;
|
|
540
|
+
format?: "primary" | "secondary" | "badge" | "inline";
|
|
541
|
+
label?: boolean;
|
|
542
|
+
icon?: string;
|
|
543
|
+
}
|
|
544
|
+
interface Column<T> {
|
|
545
|
+
id: string;
|
|
546
|
+
label: string;
|
|
547
|
+
accessor?: keyof T | ((row: T) => any);
|
|
548
|
+
align?: CellAlignment;
|
|
549
|
+
width?: string | number;
|
|
550
|
+
minWidth?: string | number;
|
|
551
|
+
maxWidth?: string | number;
|
|
552
|
+
flex?: number;
|
|
553
|
+
cell?: CellComponent<T>;
|
|
554
|
+
cellProps?: Record<string, any> | ((value: any, row: T) => Record<string, any>);
|
|
555
|
+
render?: (value: any, row: T, context: CellContext) => ReactNode;
|
|
556
|
+
sortable?: boolean;
|
|
557
|
+
/**
|
|
558
|
+
* Whether this column can be reordered via drag-and-drop.
|
|
559
|
+
* Defaults to true. Set to false to lock a column in place (e.g., sticky first column).
|
|
560
|
+
*/
|
|
561
|
+
reorderable?: boolean;
|
|
562
|
+
noCellPadding?: boolean;
|
|
563
|
+
mobile?: MobileConfig | false;
|
|
564
|
+
popover?: string | ((value: unknown, row: T) => ReactNode) | {
|
|
565
|
+
content: string | ((value: unknown, row: T) => ReactNode);
|
|
566
|
+
placement?: "top" | "bottom" | "left" | "right";
|
|
567
|
+
showArrow?: boolean;
|
|
568
|
+
trigger?: "hover" | "click";
|
|
569
|
+
};
|
|
570
|
+
/** Label to use for this column in CSV export headers. Falls back to `label` if not provided. */
|
|
571
|
+
exportLabel?: string;
|
|
572
|
+
/**
|
|
573
|
+
* Custom function to transform the cell value for export.
|
|
574
|
+
* If not provided, uses the raw accessor value converted to string.
|
|
575
|
+
* @param value - The raw cell value from the accessor
|
|
576
|
+
* @param row - The full row data
|
|
577
|
+
* @returns The value to export (will be converted to string)
|
|
578
|
+
*/
|
|
579
|
+
exportValue?: (value: unknown, row: T) => string | number | boolean | null;
|
|
580
|
+
/**
|
|
581
|
+
* Whether to include this column in CSV exports.
|
|
582
|
+
* Defaults to true. Set to false to exclude columns like action buttons.
|
|
583
|
+
*/
|
|
584
|
+
exportable?: boolean;
|
|
585
|
+
}
|
|
586
|
+
interface DataTableProps<T> {
|
|
587
|
+
columns: Column<T>[];
|
|
588
|
+
data: T[];
|
|
589
|
+
className?: string;
|
|
590
|
+
density?: TableDensity;
|
|
591
|
+
width?: TableWidth;
|
|
592
|
+
height?: string | number;
|
|
593
|
+
maxHeight?: string | number;
|
|
594
|
+
layout?: TableLayout;
|
|
595
|
+
mobileRenderer?: MobileRenderer;
|
|
596
|
+
customMobileRowRender?: (row: T, index: number) => ReactNode;
|
|
597
|
+
mobileBreakpoint?: MobileBreakpoint;
|
|
598
|
+
isLoading?: boolean;
|
|
599
|
+
loadingState?: LoadingState;
|
|
600
|
+
loadingRowCount?: number;
|
|
601
|
+
onLoadMore?: () => void | Promise<void>;
|
|
602
|
+
hasMore?: boolean;
|
|
603
|
+
enableVirtualization?: boolean;
|
|
604
|
+
estimatedRowHeight?: number;
|
|
605
|
+
loadingIndicator?: ReactNode;
|
|
606
|
+
stickyHeader?: boolean;
|
|
607
|
+
/** Make the first column sticky on horizontal scroll */
|
|
608
|
+
stickyFirstColumn?: boolean;
|
|
609
|
+
onRowClick?: (row: T) => void;
|
|
610
|
+
getRowId?: (row: T) => string;
|
|
611
|
+
hideHeader?: boolean;
|
|
612
|
+
/** Controlled sort configuration - when provided, DataTable becomes controlled */
|
|
613
|
+
sortConfig?: SortConfig | null;
|
|
614
|
+
onSort?: (sortConfig: SortConfig | null) => void;
|
|
615
|
+
"aria-label"?: string;
|
|
616
|
+
/**
|
|
617
|
+
* Enable drag-and-drop column reordering (like Notion tables).
|
|
618
|
+
* When enabled, users can drag column headers to reorder columns.
|
|
619
|
+
*/
|
|
620
|
+
enableColumnReorder?: boolean;
|
|
621
|
+
/**
|
|
622
|
+
* Controlled column order - array of column IDs in display order.
|
|
623
|
+
* When provided, DataTable uses this order instead of the columns array order.
|
|
624
|
+
* Use with onColumnOrderChange for controlled behavior.
|
|
625
|
+
*/
|
|
626
|
+
columnOrder?: string[];
|
|
627
|
+
/**
|
|
628
|
+
* Callback fired when column order changes via drag-and-drop.
|
|
629
|
+
* Receives the new array of column IDs in their new order.
|
|
630
|
+
*/
|
|
631
|
+
onColumnOrderChange?: (columnOrder: string[]) => void;
|
|
632
|
+
}
|
|
307
633
|
|
|
308
634
|
/**
|
|
309
|
-
*
|
|
310
|
-
|
|
311
|
-
declare const toMeters: (value: number | null | undefined, decimals?: number) => string | null;
|
|
312
|
-
/**
|
|
313
|
-
* Format as centimeters
|
|
314
|
-
*/
|
|
315
|
-
declare const toCentimeters: (value: number | null | undefined, decimals?: number) => string | null;
|
|
316
|
-
/**
|
|
317
|
-
* Format as millimeters
|
|
635
|
+
* Table export utilities for CSV format
|
|
636
|
+
* Provides export functionality for DataTable data
|
|
318
637
|
*/
|
|
319
|
-
|
|
638
|
+
|
|
639
|
+
interface TableExportMetadata {
|
|
640
|
+
/** Base filename for the exported file (without extension) */
|
|
641
|
+
filename?: string;
|
|
642
|
+
/** Whether to include timestamp in filename. Defaults to true */
|
|
643
|
+
timestamp?: boolean;
|
|
644
|
+
}
|
|
645
|
+
interface TableExportOptions<T> {
|
|
646
|
+
/** Column definitions for the table */
|
|
647
|
+
columns: Column<T>[];
|
|
648
|
+
/** Data rows to export */
|
|
649
|
+
data: T[];
|
|
650
|
+
/** Export metadata */
|
|
651
|
+
metadata?: TableExportMetadata;
|
|
652
|
+
}
|
|
320
653
|
/**
|
|
321
|
-
*
|
|
654
|
+
* Export table data as CSV
|
|
655
|
+
*
|
|
656
|
+
* @param options - Export configuration
|
|
657
|
+
* @returns Promise that resolves when export is complete
|
|
658
|
+
*
|
|
659
|
+
* @example
|
|
660
|
+
* ```typescript
|
|
661
|
+
* await exportTableAsCSV({
|
|
662
|
+
* columns: tableColumns,
|
|
663
|
+
* data: tableData,
|
|
664
|
+
* metadata: {
|
|
665
|
+
* filename: "devices-export",
|
|
666
|
+
* timestamp: true
|
|
667
|
+
* }
|
|
668
|
+
* });
|
|
669
|
+
* ```
|
|
322
670
|
*/
|
|
323
|
-
declare
|
|
671
|
+
declare function exportTableAsCSV<T>(options: TableExportOptions<T>): Promise<void>;
|
|
324
672
|
/**
|
|
325
|
-
*
|
|
673
|
+
* Prepare table data for export (without triggering download)
|
|
674
|
+
* Useful for server-side export where you need the transformed data
|
|
675
|
+
*
|
|
676
|
+
* @param options - Export configuration
|
|
677
|
+
* @returns Array of row objects ready for CSV generation
|
|
326
678
|
*/
|
|
327
|
-
declare
|
|
679
|
+
declare function prepareTableDataForExport<T>(options: Omit<TableExportOptions<T>, "metadata">): Record<string, string | number | boolean>[];
|
|
328
680
|
/**
|
|
329
|
-
*
|
|
681
|
+
* Get column headers for export
|
|
682
|
+
* Useful for generating CSV headers on the server
|
|
330
683
|
*/
|
|
331
|
-
declare
|
|
684
|
+
declare function getExportHeaders<T>(columns: Column<T>[]): string[];
|
|
685
|
+
|
|
686
|
+
interface UseTableExportOptions<T> {
|
|
687
|
+
/** Column definitions for the table */
|
|
688
|
+
columns: Column<T>[];
|
|
689
|
+
/** Data rows to export */
|
|
690
|
+
data: T[];
|
|
691
|
+
/** Export metadata */
|
|
692
|
+
metadata?: TableExportMetadata;
|
|
693
|
+
}
|
|
694
|
+
interface UseTableExportReturn {
|
|
695
|
+
/** Trigger CSV export of the table data */
|
|
696
|
+
exportCSV: () => Promise<void>;
|
|
697
|
+
/** Whether export is available (has data and exportable columns) */
|
|
698
|
+
canExport: boolean;
|
|
699
|
+
}
|
|
332
700
|
/**
|
|
333
|
-
*
|
|
701
|
+
* Hook for exporting DataTable data as CSV.
|
|
702
|
+
* Provides a stable callback for triggering exports with memoized dependencies.
|
|
703
|
+
*
|
|
704
|
+
* For client-side DataTables where all data is in the browser.
|
|
705
|
+
* For server-side exports, use the `onExport` callback pattern instead.
|
|
706
|
+
*
|
|
707
|
+
* @param options - Configuration for table export
|
|
708
|
+
* @returns Object with export function and status
|
|
709
|
+
*
|
|
710
|
+
* @example
|
|
711
|
+
* ```tsx
|
|
712
|
+
* const { exportCSV, canExport } = useTableExport({
|
|
713
|
+
* columns: deviceColumns,
|
|
714
|
+
* data: devices,
|
|
715
|
+
* metadata: {
|
|
716
|
+
* filename: "devices",
|
|
717
|
+
* timestamp: true
|
|
718
|
+
* }
|
|
719
|
+
* });
|
|
720
|
+
*
|
|
721
|
+
* // In your DataControls actions
|
|
722
|
+
* <DataControls
|
|
723
|
+
* actions={{
|
|
724
|
+
* items: [
|
|
725
|
+
* {
|
|
726
|
+
* id: "export",
|
|
727
|
+
* label: "Export CSV",
|
|
728
|
+
* icon: "Export",
|
|
729
|
+
* onClick: exportCSV,
|
|
730
|
+
* disabled: !canExport
|
|
731
|
+
* }
|
|
732
|
+
* ]
|
|
733
|
+
* }}
|
|
734
|
+
* />
|
|
735
|
+
* ```
|
|
334
736
|
*/
|
|
335
|
-
declare
|
|
737
|
+
declare function useTableExport<T>({ columns, data, metadata }: UseTableExportOptions<T>): UseTableExportReturn;
|
|
738
|
+
|
|
336
739
|
/**
|
|
337
|
-
*
|
|
740
|
+
* Data Operations Utilities
|
|
741
|
+
*
|
|
742
|
+
* Pure functions for filtering, sorting, searching, and faceting data.
|
|
743
|
+
* These functions are used by useClientDataControls but can also be used standalone.
|
|
338
744
|
*/
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
declare const milesToFeet: (miles: number) => number;
|
|
353
|
-
declare const metersToMiles: (meters: number) => number;
|
|
354
|
-
declare const milesToMeters: (miles: number) => number;
|
|
355
|
-
declare const yardsToMeters: (yards: number) => number;
|
|
356
|
-
declare const metersToYards: (meters: number) => number;
|
|
357
|
-
declare const inchesToCentimeters: (inches: number) => number;
|
|
358
|
-
declare const centimetersToInches: (cm: number) => number;
|
|
359
|
-
/**
|
|
360
|
-
* Auto-scale distance to the most appropriate unit
|
|
361
|
-
*/
|
|
362
|
-
declare const autoScaleDistance: (value: number | null | undefined, metric?: boolean, decimals?: number) => string | null;
|
|
745
|
+
|
|
746
|
+
interface ApplyDataOperationsOptions<T> {
|
|
747
|
+
data: T[];
|
|
748
|
+
filters?: FilterState;
|
|
749
|
+
sort?: SortState | null;
|
|
750
|
+
search?: SearchConfig | null;
|
|
751
|
+
facetConfigs?: FacetConfig[];
|
|
752
|
+
}
|
|
753
|
+
interface ApplyDataOperationsResult<T> {
|
|
754
|
+
data: T[];
|
|
755
|
+
facetCounts: FacetCounts;
|
|
756
|
+
resultCount: number;
|
|
757
|
+
}
|
|
363
758
|
/**
|
|
364
|
-
*
|
|
759
|
+
* Apply all data operations in the correct order:
|
|
760
|
+
* 1. Search
|
|
761
|
+
* 2. Filter
|
|
762
|
+
* 3. Compute facets (on filtered data)
|
|
763
|
+
* 4. Sort
|
|
365
764
|
*/
|
|
366
|
-
declare
|
|
765
|
+
declare function applyDataOperations<T>({ data, filters, sort, search, facetConfigs, }: ApplyDataOperationsOptions<T>): ApplyDataOperationsResult<T>;
|
|
367
766
|
|
|
368
767
|
/**
|
|
369
|
-
*
|
|
370
|
-
* For power (rate of energy), use power.ts
|
|
371
|
-
* For electrical units (voltage, current), use voltage.ts and current.ts
|
|
768
|
+
* Boolean formatting utilities
|
|
372
769
|
*/
|
|
373
770
|
|
|
374
771
|
/**
|
|
375
|
-
* Format
|
|
772
|
+
* Format boolean value with custom text
|
|
376
773
|
*/
|
|
377
|
-
declare const
|
|
774
|
+
declare const toBoolean: (value: boolean | null | undefined, trueText?: string, falseText?: string) => string | null;
|
|
378
775
|
/**
|
|
379
|
-
* Format as
|
|
776
|
+
* Format boolean as enabled/disabled
|
|
380
777
|
*/
|
|
381
|
-
declare const
|
|
778
|
+
declare const toEnabledDisabled: (value: boolean | null | undefined) => string | null;
|
|
382
779
|
/**
|
|
383
|
-
* Format as
|
|
780
|
+
* Format boolean as on/off
|
|
384
781
|
*/
|
|
385
|
-
declare const
|
|
782
|
+
declare const toOnOff: (value: boolean | null | undefined) => string | null;
|
|
386
783
|
/**
|
|
387
|
-
* Format as
|
|
784
|
+
* Format boolean as active/inactive
|
|
388
785
|
*/
|
|
389
|
-
declare const
|
|
786
|
+
declare const toActiveInactive: (value: boolean | null | undefined) => string | null;
|
|
390
787
|
/**
|
|
391
|
-
*
|
|
788
|
+
* Format boolean as true/false
|
|
392
789
|
*/
|
|
393
|
-
declare const
|
|
790
|
+
declare const toTrueFalse: (value: boolean | null | undefined) => string | null;
|
|
394
791
|
/**
|
|
395
|
-
*
|
|
792
|
+
* Format boolean as checkmark/cross
|
|
396
793
|
*/
|
|
397
|
-
declare const
|
|
794
|
+
declare const toCheckmark: (value: boolean | null | undefined) => string | null;
|
|
398
795
|
/**
|
|
399
|
-
*
|
|
796
|
+
* Parse various truthy/falsy values to boolean
|
|
400
797
|
*/
|
|
798
|
+
declare const parseBoolean: (value: FieldValue) => boolean | null;
|
|
401
799
|
/**
|
|
402
|
-
*
|
|
403
|
-
* reference unit. Keep in sync with `EnergyUnit`.
|
|
800
|
+
* Format boolean according to BooleanFormat specification
|
|
404
801
|
*/
|
|
405
|
-
declare const
|
|
406
|
-
declare const formatEnergy: (value: FieldValue, format: EnergyFormat) => FormattedValue;
|
|
802
|
+
declare const formatBoolean: (value: FieldValue, format: BooleanFormat) => FormattedValue;
|
|
407
803
|
|
|
408
804
|
/**
|
|
409
|
-
*
|
|
410
|
-
* leaf module so downstream helpers (notably `csvUnit.ts`) can depend on the
|
|
411
|
-
* dispatcher without pulling the whole formatting barrel (and any of its
|
|
412
|
-
* transitively-imported React/PostHog side-effects) into a test setup.
|
|
805
|
+
* Capacity formatting utilities for batteries and energy storage
|
|
413
806
|
*
|
|
414
|
-
*
|
|
807
|
+
* Domain-specific formatters for energy capacity (kWh) and power ratings (kW).
|
|
808
|
+
* Auto-scales to appropriate units (MWh, MW for large values).
|
|
415
809
|
*/
|
|
416
|
-
|
|
417
810
|
/**
|
|
418
|
-
*
|
|
419
|
-
*
|
|
811
|
+
* Format battery capacity (kWh)
|
|
812
|
+
*
|
|
813
|
+
* @param value - Capacity in kWh
|
|
814
|
+
* @param decimals - Number of decimal places (default: 1)
|
|
815
|
+
* @returns Formatted capacity string or null
|
|
816
|
+
*
|
|
817
|
+
* @example
|
|
818
|
+
* ```typescript
|
|
819
|
+
* formatCapacity(13.5); // "13.5 kWh"
|
|
820
|
+
* formatCapacity(1500); // "1.5 MWh"
|
|
821
|
+
* formatCapacity(null); // null
|
|
822
|
+
* ```
|
|
420
823
|
*/
|
|
421
|
-
declare
|
|
422
|
-
|
|
824
|
+
declare function formatCapacity(value: number | null | undefined, decimals?: number): string | null;
|
|
423
825
|
/**
|
|
424
|
-
*
|
|
826
|
+
* Format power rating (kW)
|
|
827
|
+
*
|
|
828
|
+
* @param value - Power rating in kW
|
|
829
|
+
* @param decimals - Number of decimal places (default: 1)
|
|
830
|
+
* @returns Formatted power rating string or null
|
|
831
|
+
*
|
|
832
|
+
* @example
|
|
833
|
+
* ```typescript
|
|
834
|
+
* formatPowerRating(5.2); // "5.2 kW"
|
|
835
|
+
* formatPowerRating(2500); // "2.5 MW"
|
|
836
|
+
* formatPowerRating(null); // null
|
|
837
|
+
* ```
|
|
425
838
|
*/
|
|
839
|
+
declare function formatPowerRating(value: number | null | undefined, decimals?: number): string | null;
|
|
426
840
|
|
|
427
841
|
/**
|
|
428
|
-
*
|
|
429
|
-
*/
|
|
430
|
-
declare const isNil: (value: unknown) => value is null | undefined;
|
|
431
|
-
/**
|
|
432
|
-
* Format as percentage
|
|
433
|
-
*/
|
|
434
|
-
declare const toPercentage: (value: number | null | undefined, decimals?: number) => string | null;
|
|
435
|
-
/**
|
|
436
|
-
* Format percentage (simple wrapper for consistency with other formatters)
|
|
842
|
+
* Shared CSV export helpers for unit-bearing FieldFormats.
|
|
437
843
|
*
|
|
438
|
-
*
|
|
439
|
-
*
|
|
440
|
-
*
|
|
844
|
+
* CSV columns need one unit for the whole column, not per-row auto-scaling. The
|
|
845
|
+
* on-screen display can happily render "12 kV" one row and "500 mV" the next
|
|
846
|
+
* because a human reads them in context, but in a spreadsheet that mixes
|
|
847
|
+
* magnitudes in a single column and makes the data unusable.
|
|
848
|
+
*
|
|
849
|
+
* These helpers pick a stable column-wide unit for a given FieldFormat and
|
|
850
|
+
* return the bare number that matches that unit:
|
|
851
|
+
*
|
|
852
|
+
* - `csvUnitFor(format)` → the unit string to show in the column header,
|
|
853
|
+
* or null when the format has no meaningful unit (text, number, date, …).
|
|
854
|
+
* - `csvValueFor(raw, format)` → the bare-number string for a cell in that
|
|
855
|
+
* column. Returns null for non-numeric formats (caller falls back to the
|
|
856
|
+
* regular display formatter), and "" when the display would be blank
|
|
857
|
+
* (hideWhenNull / hideWhenZero / null value).
|
|
858
|
+
*
|
|
859
|
+
* Consumers:
|
|
860
|
+
* - `apps/dashboard/components/Explorer/tables/deviceFieldExport.ts` (Explore CSV)
|
|
861
|
+
* - `packages/edges/src/utils/chartExport.ts` (chart CSV export)
|
|
441
862
|
*/
|
|
442
|
-
|
|
863
|
+
|
|
443
864
|
/**
|
|
444
|
-
*
|
|
865
|
+
* Pick the CSV column unit for a FieldFormat.
|
|
866
|
+
*
|
|
867
|
+
* Rules:
|
|
868
|
+
* - Explicit `unit` on the format wins.
|
|
869
|
+
* - Otherwise fall back to the format's canonical base unit
|
|
870
|
+
* (`DEFAULT_BASE_UNIT` lookup) so every row in the column shares one unit
|
|
871
|
+
* even if the on-screen display would auto-scale.
|
|
872
|
+
* - Energy honours `sourceUnit` (e.g. meter consumption is stored in kWh) as
|
|
873
|
+
* the natural stable unit when neither `unit` nor a base fallback would fit.
|
|
874
|
+
* - Temperature symbols are normalised from `"C"`/`"CELSIUS"` etc. to `"°C"`.
|
|
875
|
+
* - Formats with no meaningful unit (text, number, date, boolean, currency,
|
|
876
|
+
* phone, custom) return null.
|
|
445
877
|
*/
|
|
446
|
-
declare
|
|
878
|
+
declare function csvUnitFor(format: FieldFormat | undefined | null): string | null;
|
|
447
879
|
/**
|
|
448
|
-
*
|
|
880
|
+
* Convert a raw value to a bare-number CSV string in the same unit
|
|
881
|
+
* `csvUnitFor` reports.
|
|
882
|
+
*
|
|
883
|
+
* Returns:
|
|
884
|
+
* - `null` when the format is non-numeric (caller falls back to the display
|
|
885
|
+
* formatter, e.g. text/date/enum).
|
|
886
|
+
* - `""` when the display would suppress the value (hideWhenNull / hideWhenZero).
|
|
887
|
+
* - a bare number string otherwise, with the trailing unit stripped so the
|
|
888
|
+
* cell can be summed / charted in the spreadsheet.
|
|
449
889
|
*/
|
|
450
|
-
declare
|
|
890
|
+
declare function csvValueFor(raw: unknown, format: FieldFormat): string | null;
|
|
891
|
+
|
|
451
892
|
/**
|
|
452
|
-
*
|
|
893
|
+
* Electrical current formatting utilities (flow of electric charge)
|
|
453
894
|
*/
|
|
454
|
-
|
|
895
|
+
|
|
455
896
|
/**
|
|
456
|
-
* Format
|
|
897
|
+
* Format as milliamps
|
|
457
898
|
*/
|
|
458
|
-
declare const
|
|
899
|
+
declare const toMilliamps: (value: number | null | undefined, decimals?: number) => string | null;
|
|
459
900
|
/**
|
|
460
|
-
* Format
|
|
901
|
+
* Format as amperes
|
|
461
902
|
*/
|
|
462
|
-
declare const
|
|
903
|
+
declare const toAmps: (value: number | null | undefined, decimals?: number) => string | null;
|
|
463
904
|
/**
|
|
464
|
-
* Format as
|
|
905
|
+
* Format as kiloamps (rarely used but included for completeness)
|
|
465
906
|
*/
|
|
466
|
-
declare const
|
|
907
|
+
declare const toKiloamps: (value: number | null | undefined, decimals?: number) => string | null;
|
|
467
908
|
/**
|
|
468
|
-
*
|
|
909
|
+
* Auto-scale current to the most appropriate unit
|
|
469
910
|
*/
|
|
470
|
-
declare const
|
|
911
|
+
declare const autoScaleCurrent: (value: number | null | undefined, decimals?: number) => string | null;
|
|
471
912
|
/**
|
|
472
|
-
* Format
|
|
913
|
+
* Format current according to CurrentFormat specification
|
|
473
914
|
*/
|
|
474
|
-
declare const
|
|
915
|
+
declare const formatCurrent: (value: FieldValue, format: CurrentFormat) => FormattedValue;
|
|
916
|
+
declare const toMA: (value: number | null | undefined, decimals?: number) => string | null;
|
|
917
|
+
declare const toA: (value: number | null | undefined, decimals?: number) => string | null;
|
|
918
|
+
declare const toKA: (value: number | null | undefined, decimals?: number) => string | null;
|
|
475
919
|
|
|
476
920
|
/**
|
|
477
|
-
*
|
|
921
|
+
* Date formatting utilities using Luxon
|
|
478
922
|
*/
|
|
479
923
|
|
|
480
924
|
/**
|
|
481
|
-
* Format
|
|
925
|
+
* Format date to a localized string with optional time and timezone.
|
|
926
|
+
*
|
|
927
|
+
* @param value - Date value (string, Date object, or timestamp)
|
|
928
|
+
* @param showTime - Whether to include time in the output (default: false)
|
|
929
|
+
* @param timezone - Optional timezone for display (e.g., "America/New_York")
|
|
930
|
+
* @returns Formatted date string or null
|
|
931
|
+
*
|
|
932
|
+
* @example
|
|
933
|
+
* ```typescript
|
|
934
|
+
* toDateString(new Date()); // "12/25/2023"
|
|
935
|
+
* toDateString(new Date(), true); // "12/25/2023, 3:30 PM"
|
|
936
|
+
* toDateString("2023-12-25T15:30:00Z", true, "America/New_York"); // "12/25/2023, 10:30 AM"
|
|
937
|
+
* ```
|
|
482
938
|
*/
|
|
483
|
-
declare const
|
|
939
|
+
declare const toDateString: (value: string | Date | number | null | undefined, showTime?: boolean, timezone?: string) => string | null;
|
|
484
940
|
/**
|
|
485
|
-
* Format
|
|
941
|
+
* Format date to relative time (e.g., "2 hours ago", "in 3 days").
|
|
942
|
+
* Automatically chooses the most appropriate unit.
|
|
943
|
+
*
|
|
944
|
+
* @param value - Date value (string, Date object, or timestamp)
|
|
945
|
+
* @returns Relative time string or null
|
|
946
|
+
*
|
|
947
|
+
* @example
|
|
948
|
+
* ```typescript
|
|
949
|
+
* toRelativeTime(new Date(Date.now() - 3600000)); // "1 hour ago"
|
|
950
|
+
* toRelativeTime(new Date(Date.now() + 86400000)); // "in 1 day"
|
|
951
|
+
* toRelativeTime(new Date()); // "now"
|
|
952
|
+
* ```
|
|
486
953
|
*/
|
|
487
|
-
declare const
|
|
954
|
+
declare const toRelativeTime: (value: string | Date | number | null | undefined) => string | null;
|
|
488
955
|
/**
|
|
489
|
-
* Format
|
|
956
|
+
* Format date with full date and time including weekday
|
|
490
957
|
*/
|
|
491
|
-
declare const
|
|
958
|
+
declare const toFullDateTime: (value: string | Date | number | null | undefined, timezone?: string) => string | null;
|
|
492
959
|
/**
|
|
493
|
-
* Format
|
|
960
|
+
* Format date to ISO string
|
|
494
961
|
*/
|
|
495
|
-
declare const
|
|
496
|
-
|
|
962
|
+
declare const toISOString: (value: string | Date | number | null | undefined) => string | null;
|
|
497
963
|
/**
|
|
498
|
-
*
|
|
964
|
+
* Format date with custom format string
|
|
499
965
|
*/
|
|
500
|
-
|
|
966
|
+
declare const toCustomDateFormat: (value: string | Date | number | null | undefined, format: string, timezone?: string) => string | null;
|
|
501
967
|
/**
|
|
502
|
-
*
|
|
968
|
+
* Get formatted date parts
|
|
503
969
|
*/
|
|
504
|
-
declare const
|
|
970
|
+
declare const getDateParts: (value: string | Date | number | null | undefined) => {
|
|
971
|
+
year: number;
|
|
972
|
+
month: number;
|
|
973
|
+
day: number;
|
|
974
|
+
weekday: number;
|
|
975
|
+
hour: number;
|
|
976
|
+
minute: number;
|
|
977
|
+
second: number;
|
|
978
|
+
millisecond: number;
|
|
979
|
+
weekdayShort: string | null;
|
|
980
|
+
weekdayLong: string | null;
|
|
981
|
+
monthShort: string | null;
|
|
982
|
+
monthLong: string | null;
|
|
983
|
+
} | null;
|
|
505
984
|
/**
|
|
506
|
-
* Format
|
|
985
|
+
* Format date according to DateFormat specification
|
|
507
986
|
*/
|
|
508
|
-
declare const
|
|
987
|
+
declare const formatDate: (value: FieldValue, format: DateFormat) => FormattedValue;
|
|
988
|
+
|
|
509
989
|
/**
|
|
510
|
-
*
|
|
990
|
+
* Distance and length formatting utilities
|
|
511
991
|
*/
|
|
512
|
-
|
|
992
|
+
|
|
513
993
|
/**
|
|
514
|
-
* Format as
|
|
994
|
+
* Format as meters
|
|
515
995
|
*/
|
|
516
|
-
declare const
|
|
996
|
+
declare const toMeters: (value: number | null | undefined, decimals?: number) => string | null;
|
|
517
997
|
/**
|
|
518
|
-
*
|
|
998
|
+
* Format as centimeters
|
|
519
999
|
*/
|
|
520
|
-
declare const
|
|
1000
|
+
declare const toCentimeters: (value: number | null | undefined, decimals?: number) => string | null;
|
|
521
1001
|
/**
|
|
522
|
-
* Format
|
|
1002
|
+
* Format as millimeters
|
|
523
1003
|
*/
|
|
524
|
-
declare const
|
|
525
|
-
declare const toW: (value: number | null | undefined, decimals?: number) => string | null;
|
|
526
|
-
declare const toKW: (value: number | null | undefined, decimals?: number) => string | null;
|
|
527
|
-
declare const toMW: (value: number | null | undefined, decimals?: number) => string | null;
|
|
528
|
-
declare const toGW: (value: number | null | undefined, decimals?: number) => string | null;
|
|
529
|
-
|
|
1004
|
+
declare const toMillimeters: (value: number | null | undefined, decimals?: number) => string | null;
|
|
530
1005
|
/**
|
|
531
|
-
*
|
|
532
|
-
* Allows registration and retrieval of formatting functions by key
|
|
1006
|
+
* Format as kilometers
|
|
533
1007
|
*/
|
|
534
|
-
|
|
535
|
-
declare class FormatRegistryClass {
|
|
536
|
-
private formatters;
|
|
537
|
-
/**
|
|
538
|
-
* Register a new formatter
|
|
539
|
-
* @param key - Unique identifier for the formatter
|
|
540
|
-
* @param formatter - The formatting function
|
|
541
|
-
*/
|
|
542
|
-
register(key: string, formatter: FormatterFunction): void;
|
|
543
|
-
/**
|
|
544
|
-
* Format a value using a registered formatter
|
|
545
|
-
* @param key - The formatter key
|
|
546
|
-
* @param value - The value to format
|
|
547
|
-
* @param args - Additional arguments to pass to the formatter
|
|
548
|
-
* @returns The formatted value or null
|
|
549
|
-
*/
|
|
550
|
-
format(key: string, value: FieldValue, ...args: unknown[]): FormattedValue;
|
|
551
|
-
/**
|
|
552
|
-
* Check if a formatter is registered
|
|
553
|
-
* @param key - The formatter key
|
|
554
|
-
* @returns True if the formatter exists
|
|
555
|
-
*/
|
|
556
|
-
has(key: string): boolean;
|
|
557
|
-
/**
|
|
558
|
-
* Get all registered formatter keys
|
|
559
|
-
* @returns Array of formatter keys
|
|
560
|
-
*/
|
|
561
|
-
keys(): string[];
|
|
562
|
-
/**
|
|
563
|
-
* Remove a formatter
|
|
564
|
-
* @param key - The formatter key to remove
|
|
565
|
-
*/
|
|
566
|
-
unregister(key: string): void;
|
|
567
|
-
/**
|
|
568
|
-
* Clear all registered formatters
|
|
569
|
-
*/
|
|
570
|
-
clear(): void;
|
|
571
|
-
}
|
|
572
|
-
declare const FormatRegistry: FormatRegistryClass;
|
|
573
|
-
|
|
1008
|
+
declare const toKilometers: (value: number | null | undefined, decimals?: number) => string | null;
|
|
574
1009
|
/**
|
|
575
|
-
*
|
|
1010
|
+
* Format as feet
|
|
576
1011
|
*/
|
|
577
|
-
|
|
1012
|
+
declare const toFeet: (value: number | null | undefined, decimals?: number) => string | null;
|
|
578
1013
|
/**
|
|
579
|
-
* Format as
|
|
1014
|
+
* Format as inches
|
|
580
1015
|
*/
|
|
581
|
-
declare const
|
|
1016
|
+
declare const toInches: (value: number | null | undefined, decimals?: number) => string | null;
|
|
582
1017
|
/**
|
|
583
|
-
* Format as
|
|
1018
|
+
* Format as miles
|
|
584
1019
|
*/
|
|
585
|
-
declare const
|
|
1020
|
+
declare const toMiles: (value: number | null | undefined, decimals?: number) => string | null;
|
|
586
1021
|
/**
|
|
587
|
-
* Format as
|
|
1022
|
+
* Format as yards
|
|
588
1023
|
*/
|
|
589
|
-
declare const
|
|
1024
|
+
declare const toYards: (value: number | null | undefined, decimals?: number) => string | null;
|
|
590
1025
|
/**
|
|
591
|
-
* Format as
|
|
1026
|
+
* Format as nautical miles
|
|
592
1027
|
*/
|
|
593
|
-
declare const
|
|
1028
|
+
declare const toNauticalMiles: (value: number | null | undefined, decimals?: number) => string | null;
|
|
594
1029
|
/**
|
|
595
|
-
*
|
|
1030
|
+
* Conversion utilities
|
|
596
1031
|
*/
|
|
597
|
-
declare const
|
|
1032
|
+
declare const metersToFeet: (meters: number) => number;
|
|
1033
|
+
declare const feetToMeters: (feet: number) => number;
|
|
1034
|
+
declare const milesToKilometers: (miles: number) => number;
|
|
1035
|
+
declare const kilometersToMiles: (km: number) => number;
|
|
1036
|
+
declare const feetToMiles: (feet: number) => number;
|
|
1037
|
+
declare const milesToFeet: (miles: number) => number;
|
|
1038
|
+
declare const metersToMiles: (meters: number) => number;
|
|
1039
|
+
declare const milesToMeters: (miles: number) => number;
|
|
1040
|
+
declare const yardsToMeters: (yards: number) => number;
|
|
1041
|
+
declare const metersToYards: (meters: number) => number;
|
|
1042
|
+
declare const inchesToCentimeters: (inches: number) => number;
|
|
1043
|
+
declare const centimetersToInches: (cm: number) => number;
|
|
598
1044
|
/**
|
|
599
|
-
*
|
|
1045
|
+
* Auto-scale distance to the most appropriate unit
|
|
600
1046
|
*/
|
|
601
|
-
declare const
|
|
602
|
-
|
|
1047
|
+
declare const autoScaleDistance: (value: number | null | undefined, metric?: boolean, decimals?: number) => string | null;
|
|
603
1048
|
/**
|
|
604
|
-
*
|
|
1049
|
+
* Format distance according to DistanceFormat specification
|
|
605
1050
|
*/
|
|
1051
|
+
declare const formatDistance: (value: FieldValue, format: DistanceFormat) => FormattedValue;
|
|
606
1052
|
|
|
607
1053
|
/**
|
|
608
|
-
*
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
/**
|
|
612
|
-
* Format as Fahrenheit
|
|
1054
|
+
* Energy formatting utilities (stored or consumed energy)
|
|
1055
|
+
* For power (rate of energy), use power.ts
|
|
1056
|
+
* For electrical units (voltage, current), use voltage.ts and current.ts
|
|
613
1057
|
*/
|
|
614
|
-
|
|
1058
|
+
|
|
615
1059
|
/**
|
|
616
|
-
* Format as
|
|
1060
|
+
* Format as Watt-hours
|
|
617
1061
|
*/
|
|
618
|
-
declare const
|
|
1062
|
+
declare const toWh: (value: number | null | undefined, decimals?: number) => string | null;
|
|
619
1063
|
/**
|
|
620
|
-
* Format as
|
|
1064
|
+
* Format as kilowatt-hours
|
|
621
1065
|
*/
|
|
622
|
-
declare const
|
|
1066
|
+
declare const tokWh: (value: number | null | undefined, decimals?: number) => string | null;
|
|
623
1067
|
/**
|
|
624
|
-
*
|
|
1068
|
+
* Format as megawatt-hours
|
|
625
1069
|
*/
|
|
626
|
-
declare const
|
|
1070
|
+
declare const toMWh: (value: number | null | undefined, decimals?: number) => string | null;
|
|
627
1071
|
/**
|
|
628
|
-
*
|
|
1072
|
+
* Format as gigawatt-hours
|
|
629
1073
|
*/
|
|
630
|
-
declare const
|
|
1074
|
+
declare const toGWh: (value: number | null | undefined, decimals?: number) => string | null;
|
|
631
1075
|
/**
|
|
632
|
-
*
|
|
1076
|
+
* Pick the display unit auto-scaling would choose for a Wh magnitude.
|
|
633
1077
|
*/
|
|
634
|
-
declare const
|
|
1078
|
+
declare const pickEnergyUnit: (whValue: number) => EnergyUnit;
|
|
635
1079
|
/**
|
|
636
|
-
*
|
|
1080
|
+
* Auto-scale energy to the most appropriate unit
|
|
637
1081
|
*/
|
|
638
|
-
declare const
|
|
1082
|
+
declare const autoScaleEnergy: (value: number | null | undefined, decimals?: number) => string | null;
|
|
639
1083
|
/**
|
|
640
|
-
*
|
|
1084
|
+
* Format energy according to EnergyFormat specification
|
|
641
1085
|
*/
|
|
642
|
-
declare const fahrenheitToKelvin: (fahrenheit: number) => number;
|
|
643
1086
|
/**
|
|
644
|
-
*
|
|
1087
|
+
* Multiplier from the named energy unit to Wh — the formatter's internal
|
|
1088
|
+
* reference unit. Keep in sync with `EnergyUnit`.
|
|
645
1089
|
*/
|
|
646
|
-
declare const
|
|
1090
|
+
declare const SOURCE_UNIT_TO_WH: Record<EnergyUnit, number>;
|
|
1091
|
+
declare const formatEnergy: (value: FieldValue, format: EnergyFormat) => FormattedValue;
|
|
1092
|
+
|
|
647
1093
|
/**
|
|
648
|
-
*
|
|
1094
|
+
* `formatFieldValue` dispatcher — extracted from `./index.ts` into its own
|
|
1095
|
+
* leaf module so downstream helpers (notably `csvUnit.ts`) can depend on the
|
|
1096
|
+
* dispatcher without pulling the whole formatting barrel (and any of its
|
|
1097
|
+
* transitively-imported React/PostHog side-effects) into a test setup.
|
|
1098
|
+
*
|
|
1099
|
+
* `./index.ts` re-exports this module so the public API is unchanged.
|
|
649
1100
|
*/
|
|
650
|
-
|
|
1101
|
+
|
|
651
1102
|
/**
|
|
652
|
-
*
|
|
1103
|
+
* Main formatting function that routes to the appropriate formatter based on
|
|
1104
|
+
* the format type. See `./index.ts` for the fuller doc comment.
|
|
653
1105
|
*/
|
|
654
|
-
declare const
|
|
1106
|
+
declare const formatFieldValue: (value: FieldValue, format: FieldFormat) => FormattedValue;
|
|
655
1107
|
|
|
656
1108
|
/**
|
|
657
|
-
*
|
|
1109
|
+
* Number and currency formatting utilities
|
|
658
1110
|
*/
|
|
659
1111
|
|
|
660
1112
|
/**
|
|
661
|
-
*
|
|
1113
|
+
* Check if a value is null or undefined
|
|
662
1114
|
*/
|
|
663
|
-
declare const
|
|
1115
|
+
declare const isNil: (value: unknown) => value is null | undefined;
|
|
664
1116
|
/**
|
|
665
|
-
*
|
|
1117
|
+
* Format as percentage
|
|
666
1118
|
*/
|
|
667
|
-
declare const
|
|
1119
|
+
declare const toPercentage: (value: number | null | undefined, decimals?: number) => string | null;
|
|
668
1120
|
/**
|
|
669
|
-
*
|
|
670
|
-
*
|
|
671
|
-
* @param text - Text to convert
|
|
672
|
-
* @returns Sentence-cased text
|
|
1121
|
+
* Format percentage (simple wrapper for consistency with other formatters)
|
|
673
1122
|
*
|
|
674
|
-
* @
|
|
675
|
-
*
|
|
676
|
-
*
|
|
677
|
-
* toSentenceCase("hello world"); // "Hello world"
|
|
678
|
-
* ```
|
|
1123
|
+
* @param value - Numeric value (0-100 range)
|
|
1124
|
+
* @param precision - Number of decimal places (default: 0)
|
|
1125
|
+
* @returns Formatted percentage string with % symbol
|
|
679
1126
|
*/
|
|
680
|
-
declare const
|
|
1127
|
+
declare const formatPercent: (value: number | null | undefined, precision?: number) => string;
|
|
681
1128
|
/**
|
|
682
|
-
*
|
|
683
|
-
* Capitalizes the first letter of each word except common articles/prepositions
|
|
684
|
-
* (unless they're the first word).
|
|
685
|
-
*
|
|
686
|
-
* @param text - Text to convert
|
|
687
|
-
* @returns Title-cased text
|
|
688
|
-
*
|
|
689
|
-
* @example
|
|
690
|
-
* ```typescript
|
|
691
|
-
* toTitleCase("the quick brown fox"); // "The Quick Brown Fox"
|
|
692
|
-
* toTitleCase("war and peace"); // "War and Peace"
|
|
693
|
-
* toTitleCase("to be or not to be"); // "To Be or Not to Be"
|
|
694
|
-
* ```
|
|
1129
|
+
* Format as integer
|
|
695
1130
|
*/
|
|
696
|
-
declare const
|
|
1131
|
+
declare const toInteger: (value: number | null | undefined) => string | null;
|
|
697
1132
|
/**
|
|
698
|
-
*
|
|
1133
|
+
* Format as float with specified decimals
|
|
699
1134
|
*/
|
|
700
|
-
declare const
|
|
1135
|
+
declare const toFloat: (value: number | null | undefined, decimals?: number) => string | null;
|
|
701
1136
|
/**
|
|
702
|
-
*
|
|
1137
|
+
* Format number with thousands separator
|
|
703
1138
|
*/
|
|
704
|
-
declare const
|
|
1139
|
+
declare const toFormattedNumber: (value: number | null | undefined, decimals?: number, thousandsSeparator?: boolean) => string | null;
|
|
705
1140
|
/**
|
|
706
|
-
*
|
|
1141
|
+
* Format number with compact notation (1K, 1M, etc.)
|
|
707
1142
|
*/
|
|
708
|
-
declare const
|
|
1143
|
+
declare const toCompactNumber: (value: number | null | undefined, display?: "short" | "long") => string | null;
|
|
709
1144
|
/**
|
|
710
|
-
*
|
|
1145
|
+
* Format number with scientific notation
|
|
711
1146
|
*/
|
|
712
|
-
declare const
|
|
1147
|
+
declare const toScientificNotation: (value: number | null | undefined, decimals?: number) => string | null;
|
|
713
1148
|
/**
|
|
714
|
-
*
|
|
1149
|
+
* Format as currency
|
|
715
1150
|
*/
|
|
716
|
-
declare const
|
|
1151
|
+
declare const toCurrency: (value: number | null | undefined, currency?: string, options?: Partial<CurrencyFormat>) => string | null;
|
|
717
1152
|
/**
|
|
718
|
-
*
|
|
1153
|
+
* Format number according to NumberFormat specification
|
|
719
1154
|
*/
|
|
720
|
-
declare const
|
|
1155
|
+
declare const formatNumber: (value: FieldValue, format: NumberFormat) => FormattedValue;
|
|
721
1156
|
/**
|
|
722
|
-
*
|
|
723
|
-
*/
|
|
724
|
-
declare const truncateStart: (value: string | null | undefined, length?: number) => string;
|
|
725
|
-
/**
|
|
726
|
-
* Truncate text at the end
|
|
727
|
-
*/
|
|
728
|
-
declare const truncateEnd: (value: string | null | undefined, length?: number, ellipsis?: string) => string;
|
|
729
|
-
/**
|
|
730
|
-
* Mask sensitive text (e.g., secrets, API keys)
|
|
731
|
-
*/
|
|
732
|
-
declare const toSecret: (value: string | null | undefined) => string;
|
|
733
|
-
/**
|
|
734
|
-
* Format text according to TextFormat specification
|
|
735
|
-
*/
|
|
736
|
-
declare const formatText: (value: FieldValue, format: TextFormat) => FormattedValue;
|
|
737
|
-
|
|
738
|
-
/**
|
|
739
|
-
* Voltage formatting utilities (electrical potential)
|
|
740
|
-
*/
|
|
741
|
-
|
|
742
|
-
/**
|
|
743
|
-
* Format as millivolts
|
|
744
|
-
*/
|
|
745
|
-
declare const toMillivolts: (value: number | null | undefined, decimals?: number) => string | null;
|
|
746
|
-
/**
|
|
747
|
-
* Format as volts
|
|
748
|
-
*/
|
|
749
|
-
declare const toVolts: (value: number | null | undefined, decimals?: number) => string | null;
|
|
750
|
-
/**
|
|
751
|
-
* Format as kilovolts
|
|
752
|
-
*/
|
|
753
|
-
declare const toKilovolts: (value: number | null | undefined, decimals?: number) => string | null;
|
|
754
|
-
/**
|
|
755
|
-
* Auto-scale voltage to the most appropriate unit
|
|
756
|
-
*/
|
|
757
|
-
declare const autoScaleVoltage: (value: number | null | undefined, decimals?: number) => string | null;
|
|
758
|
-
/**
|
|
759
|
-
* Format voltage according to VoltageFormat specification
|
|
760
|
-
*/
|
|
761
|
-
declare const formatVoltage: (value: FieldValue, format: VoltageFormat) => FormattedValue;
|
|
762
|
-
declare const toMV: (value: number | null | undefined, decimals?: number) => string | null;
|
|
763
|
-
declare const toV: (value: number | null | undefined, decimals?: number) => string | null;
|
|
764
|
-
declare const toKV: (value: number | null | undefined, decimals?: number) => string | null;
|
|
765
|
-
|
|
766
|
-
/**
|
|
767
|
-
* Comprehensive formatting utilities for the Edges design system
|
|
768
|
-
*
|
|
769
|
-
* This module provides a unified formatting system with support for:
|
|
770
|
-
* - Text formatting (case conversion, truncation, etc.)
|
|
771
|
-
* - Number formatting (decimals, thousands separators, compact notation)
|
|
772
|
-
* - Currency formatting (multiple currencies and display options)
|
|
773
|
-
* - Date formatting (relative time, custom formats, timezones)
|
|
774
|
-
* - Boolean formatting (custom true/false text)
|
|
775
|
-
* - Energy units (Wh, kWh, MWh, GWh with auto-scaling)
|
|
776
|
-
* - Temperature units (Celsius, Fahrenheit, Kelvin)
|
|
777
|
-
* - Distance units (meters, kilometers, miles, feet)
|
|
778
|
-
* - Phone number formatting (US and international)
|
|
779
|
-
* - Custom formatters via the FormatRegistry
|
|
780
|
-
*/
|
|
781
|
-
|
|
782
|
-
/**
|
|
783
|
-
* Convenience function to create a format object
|
|
784
|
-
*
|
|
785
|
-
* @example
|
|
786
|
-
* ```typescript
|
|
787
|
-
* const currencyFormat = createFormat("currency", { currency: "EUR" });
|
|
788
|
-
* const dateFormat = createFormat("date", { relative: true });
|
|
789
|
-
* ```
|
|
790
|
-
*/
|
|
791
|
-
declare const createFormat: <T extends FieldFormat["type"]>(type: T, options?: Omit<Extract<FieldFormat, {
|
|
792
|
-
type: T;
|
|
793
|
-
}>, "type">) => Extract<FieldFormat, {
|
|
794
|
-
type: T;
|
|
795
|
-
}>;
|
|
796
|
-
|
|
797
|
-
/**
|
|
798
|
-
* Chart export utilities for CSV, SVG, and PNG formats
|
|
799
|
-
* Provides comprehensive export functionality for chart visualizations
|
|
1157
|
+
* Format currency according to CurrencyFormat specification
|
|
800
1158
|
*/
|
|
1159
|
+
declare const formatCurrency: (value: FieldValue, format: CurrencyFormat) => FormattedValue;
|
|
801
1160
|
|
|
802
|
-
type ExportType = "csv" | "svg" | "png";
|
|
803
|
-
interface ChartExportMetadata {
|
|
804
|
-
xLabel?: string;
|
|
805
|
-
yLabel?: string;
|
|
806
|
-
seriesLabels?: string[];
|
|
807
|
-
filename?: string;
|
|
808
|
-
timestamp?: boolean;
|
|
809
|
-
/**
|
|
810
|
-
* Optional FieldFormat for the y-axis. When present, the CSV export:
|
|
811
|
-
* - suffixes every series header with the format's stable column unit
|
|
812
|
-
* (e.g. "Consumption (kWh)", "Voltage (V)"), and
|
|
813
|
-
* - writes bare numbers in that unit into the cells (no per-row auto-scale).
|
|
814
|
-
*
|
|
815
|
-
* This keeps chart CSVs consistent with the Explore table CSV (BOLT-1431):
|
|
816
|
-
* unit in the header, bare numbers in the cells.
|
|
817
|
-
*/
|
|
818
|
-
yFormat?: FieldFormat;
|
|
819
|
-
}
|
|
820
|
-
/**
|
|
821
|
-
* Main export function that handles all chart export types.
|
|
822
|
-
* Supports CSV, SVG, and PNG formats with automatic filename generation.
|
|
823
|
-
*
|
|
824
|
-
* @param type - Export format: "csv", "svg", or "png"
|
|
825
|
-
* @param datasets - Chart data as single array or array of arrays for multi-series
|
|
826
|
-
* @param metadata - Export metadata including labels and filename options
|
|
827
|
-
* @param svgRef - Reference to the chart's SVG element
|
|
828
|
-
* @returns Promise that resolves when export is complete
|
|
829
|
-
*
|
|
830
|
-
* @example
|
|
831
|
-
* ```typescript
|
|
832
|
-
* // Export single series as CSV
|
|
833
|
-
* await exportChart("csv", data, {
|
|
834
|
-
* xLabel: "Date",
|
|
835
|
-
* yLabel: "Value",
|
|
836
|
-
* filename: "sales-data"
|
|
837
|
-
* }, svgRef);
|
|
838
|
-
*
|
|
839
|
-
* // Export multi-series chart as PNG
|
|
840
|
-
* await exportChart("png", [series1, series2], {
|
|
841
|
-
* seriesLabels: ["Revenue", "Profit"],
|
|
842
|
-
* timestamp: false
|
|
843
|
-
* }, svgRef);
|
|
844
|
-
* ```
|
|
845
|
-
*/
|
|
846
|
-
declare function exportChart(type: ExportType, datasets: BaseDataPoint[][] | BaseDataPoint[], metadata: ChartExportMetadata | undefined, svgRef: React__default.RefObject<SVGSVGElement | null>): Promise<void>;
|
|
847
|
-
/**
|
|
848
|
-
* Utility to check if export is supported in the current environment
|
|
849
|
-
*/
|
|
850
|
-
declare function isExportSupported(type: ExportType): boolean;
|
|
851
1161
|
/**
|
|
852
|
-
*
|
|
1162
|
+
* Phone number formatting utilities
|
|
853
1163
|
*/
|
|
854
|
-
declare function getExportFormatName(type: ExportType): string;
|
|
855
1164
|
|
|
856
1165
|
/**
|
|
857
|
-
*
|
|
858
|
-
*
|
|
859
|
-
* Core type definitions for client-side and server-side data filtering,
|
|
860
|
-
* sorting, faceting, and search operations.
|
|
861
|
-
*/
|
|
862
|
-
type FilterOperator = "eq" | "neq" | "in" | "nin" | "gt" | "gte" | "lt" | "lte" | "contains" | "startsWith" | "endsWith";
|
|
863
|
-
interface FilterCondition {
|
|
864
|
-
/** Field name (supports nested paths like 'user.profile.name') */
|
|
865
|
-
field: string;
|
|
866
|
-
/** Comparison operator */
|
|
867
|
-
operator: FilterOperator;
|
|
868
|
-
/** Value to compare against */
|
|
869
|
-
value: string | number | boolean | (string | number)[];
|
|
870
|
-
}
|
|
871
|
-
interface FilterGroup {
|
|
872
|
-
/** Logical operator combining conditions */
|
|
873
|
-
logic: "AND" | "OR";
|
|
874
|
-
/** Conditions or nested filter groups */
|
|
875
|
-
conditions: (FilterCondition | FilterGroup)[];
|
|
876
|
-
}
|
|
877
|
-
/** Root filter state - can be empty, a single group, or nested groups */
|
|
878
|
-
type FilterState = FilterGroup | null;
|
|
879
|
-
interface SortState {
|
|
880
|
-
/** Field to sort by (supports nested paths) */
|
|
881
|
-
field: string;
|
|
882
|
-
/** Sort direction */
|
|
883
|
-
direction: "asc" | "desc";
|
|
884
|
-
}
|
|
885
|
-
interface SearchConfig {
|
|
886
|
-
/** Search query string */
|
|
887
|
-
query: string;
|
|
888
|
-
/** Fields to search across */
|
|
889
|
-
fields: string[];
|
|
890
|
-
/** Use fuzzy matching (Fuse.js) - default true */
|
|
891
|
-
fuzzy?: boolean;
|
|
892
|
-
/** Fuse.js matching threshold (0.0 = perfect, 1.0 = anything) - default 0.3 */
|
|
893
|
-
threshold?: number;
|
|
894
|
-
}
|
|
895
|
-
type FacetType = "string" | "number" | "boolean" | "date";
|
|
896
|
-
interface FacetConfig {
|
|
897
|
-
/** Field name to facet on */
|
|
898
|
-
field: string;
|
|
899
|
-
/** Display label for the facet */
|
|
900
|
-
label: string;
|
|
901
|
-
/** Data type of the field */
|
|
902
|
-
type?: FacetType;
|
|
903
|
-
/** Optional: Provide predefined values for the facet (useful for enums) */
|
|
904
|
-
values?: Array<{
|
|
905
|
-
value: string | number;
|
|
906
|
-
label: string;
|
|
907
|
-
}>;
|
|
908
|
-
/** Number of options to show before requiring search (default: 10) */
|
|
909
|
-
searchThreshold?: number;
|
|
910
|
-
/** Max options to show initially, with "Show all" button for rest (default: 50) */
|
|
911
|
-
maxVisibleOptions?: number;
|
|
912
|
-
/** Optional description text to show below the label */
|
|
913
|
-
description?: string;
|
|
914
|
-
/** Optional: Custom render function for option labels (e.g., to show Badges) */
|
|
915
|
-
renderLabel?: (value: string, label: string) => React.ReactNode;
|
|
916
|
-
/** Optional: Group name for organizing filters in FilterDialog */
|
|
917
|
-
group?: string;
|
|
918
|
-
}
|
|
919
|
-
interface FacetCounts {
|
|
920
|
-
[field: string]: {
|
|
921
|
-
[value: string]: number;
|
|
922
|
-
};
|
|
923
|
-
}
|
|
924
|
-
/**
|
|
925
|
-
* Create a single filter condition
|
|
926
|
-
*/
|
|
927
|
-
declare function createFilter(field: string, operator: FilterOperator, value: string | number | boolean | (string | number)[]): FilterCondition;
|
|
928
|
-
/**
|
|
929
|
-
* Create a filter group from multiple conditions with AND logic
|
|
930
|
-
*/
|
|
931
|
-
declare function createFilters(conditions: FilterCondition[], logic?: "AND" | "OR"): FilterGroup;
|
|
932
|
-
/**
|
|
933
|
-
* Create an empty filter state
|
|
934
|
-
*/
|
|
935
|
-
declare function createEmptyFilter(): FilterGroup;
|
|
936
|
-
/**
|
|
937
|
-
* Check if a filter state is empty (no conditions)
|
|
938
|
-
*/
|
|
939
|
-
declare function isFilterEmpty(filter: FilterState): boolean;
|
|
940
|
-
/**
|
|
941
|
-
* Convert structured filter state to simple display chips
|
|
942
|
-
* Used for backward compatibility with existing FilterChips component
|
|
943
|
-
*/
|
|
944
|
-
interface FilterChip {
|
|
945
|
-
id: string;
|
|
946
|
-
label: string;
|
|
947
|
-
value: string;
|
|
948
|
-
}
|
|
949
|
-
declare function filterToChips(filter: FilterState, facetConfigs?: FacetConfig[]): FilterChip[];
|
|
950
|
-
/**
|
|
951
|
-
* Add a condition to a filter state
|
|
1166
|
+
* Format US phone number
|
|
952
1167
|
*/
|
|
953
|
-
declare
|
|
1168
|
+
declare const formatUSPhone: (phone: string | null | undefined) => string | null;
|
|
954
1169
|
/**
|
|
955
|
-
*
|
|
1170
|
+
* Format international phone number
|
|
956
1171
|
*/
|
|
957
|
-
declare
|
|
1172
|
+
declare const formatInternationalPhone: (phone: string | null | undefined) => string | null;
|
|
958
1173
|
/**
|
|
959
|
-
*
|
|
1174
|
+
* Format phone number with basic formatting
|
|
960
1175
|
*/
|
|
961
|
-
declare
|
|
962
|
-
|
|
963
|
-
interface UseClientDataControlsOptions<T> {
|
|
964
|
-
/** Raw data to process */
|
|
965
|
-
data: T[];
|
|
966
|
-
/** Filter state */
|
|
967
|
-
filters?: FilterState;
|
|
968
|
-
/** Sort state */
|
|
969
|
-
sort?: SortState | null;
|
|
970
|
-
/** Search configuration */
|
|
971
|
-
search?: SearchConfig | null;
|
|
972
|
-
/** Facet configurations */
|
|
973
|
-
facetConfigs?: FacetConfig[];
|
|
974
|
-
}
|
|
975
|
-
interface UseClientDataControlsResult<T> {
|
|
976
|
-
/** Processed data (filtered, sorted, searched) */
|
|
977
|
-
data: T[];
|
|
978
|
-
/** Facet counts computed from filtered data */
|
|
979
|
-
facetCounts: FacetCounts;
|
|
980
|
-
/** Number of results after filtering/searching */
|
|
981
|
-
resultCount: number;
|
|
982
|
-
}
|
|
1176
|
+
declare const formatPhoneNumber: (phone: string | null | undefined) => string | null;
|
|
983
1177
|
/**
|
|
984
|
-
*
|
|
985
|
-
*
|
|
986
|
-
* Client-side hook for filtering, sorting, searching, and faceting data.
|
|
987
|
-
* Uses memoization to avoid unnecessary recomputation.
|
|
988
|
-
*
|
|
989
|
-
* Operations are applied in this order:
|
|
990
|
-
* 1. Search (fuzzy or exact matching)
|
|
991
|
-
* 2. Filter (structured conditions)
|
|
992
|
-
* 3. Facet computation (on filtered data)
|
|
993
|
-
* 4. Sort
|
|
994
|
-
*
|
|
995
|
-
* @example
|
|
996
|
-
* ```tsx
|
|
997
|
-
* const { data, facetCounts, resultCount } = useClientDataControls({
|
|
998
|
-
* data: rawData,
|
|
999
|
-
* filters: createFilters([
|
|
1000
|
-
* createFilter('department', 'in', ['Engineering', 'Sales'])
|
|
1001
|
-
* ]),
|
|
1002
|
-
* sort: { field: 'name', direction: 'asc' },
|
|
1003
|
-
* search: { query: searchQuery, fields: ['name', 'email'] },
|
|
1004
|
-
* facetConfigs: [
|
|
1005
|
-
* { field: 'department', label: 'Department' },
|
|
1006
|
-
* { field: 'status', label: 'Status' }
|
|
1007
|
-
* ]
|
|
1008
|
-
* });
|
|
1009
|
-
* ```
|
|
1178
|
+
* Format phone according to PhoneFormat specification
|
|
1010
1179
|
*/
|
|
1011
|
-
declare
|
|
1180
|
+
declare const formatPhone: (value: FieldValue, format: PhoneFormat) => FormattedValue;
|
|
1012
1181
|
|
|
1013
|
-
interface ServerDataState {
|
|
1014
|
-
filters: FilterState;
|
|
1015
|
-
sort: SortState | null;
|
|
1016
|
-
search: SearchConfig | null;
|
|
1017
|
-
}
|
|
1018
|
-
interface UseServerDataControlsOptions {
|
|
1019
|
-
/** Filter state */
|
|
1020
|
-
filters: FilterState;
|
|
1021
|
-
/** Sort state */
|
|
1022
|
-
sort: SortState | null;
|
|
1023
|
-
/** Search configuration */
|
|
1024
|
-
search: SearchConfig | null;
|
|
1025
|
-
/** Callback when state changes (debounced for search) */
|
|
1026
|
-
onStateChange: (state: ServerDataState) => void;
|
|
1027
|
-
/** Search debounce delay in ms (default: 300) */
|
|
1028
|
-
searchDebounce?: number;
|
|
1029
|
-
}
|
|
1030
1182
|
/**
|
|
1031
|
-
*
|
|
1032
|
-
*
|
|
1033
|
-
* Server-side hook that notifies the parent when filter/sort/search state changes.
|
|
1034
|
-
* Search queries are debounced to avoid excessive API calls.
|
|
1035
|
-
*
|
|
1036
|
-
* This hook doesn't manipulate data - it just provides a clean way to:
|
|
1037
|
-
* 1. Debounce search input
|
|
1038
|
-
* 2. Notify when any state changes
|
|
1039
|
-
* 3. Trigger server refetch
|
|
1040
|
-
*
|
|
1041
|
-
* @example
|
|
1042
|
-
* ```tsx
|
|
1043
|
-
* const [filters, setFilters] = useState(null);
|
|
1044
|
-
* const [sort, setSort] = useState({ field: 'name', direction: 'asc' });
|
|
1045
|
-
* const [search, setSearch] = useState({ query: '', fields: ['name'] });
|
|
1046
|
-
*
|
|
1047
|
-
* useServerDataControls({
|
|
1048
|
-
* filters,
|
|
1049
|
-
* sort,
|
|
1050
|
-
* search,
|
|
1051
|
-
* onStateChange: (state) => {
|
|
1052
|
-
* // Refetch data with new parameters
|
|
1053
|
-
* refetch({
|
|
1054
|
-
* filters: state.filters,
|
|
1055
|
-
* sort: state.sort,
|
|
1056
|
-
* search: state.search?.query
|
|
1057
|
-
* });
|
|
1058
|
-
* }
|
|
1059
|
-
* });
|
|
1060
|
-
* ```
|
|
1183
|
+
* Power formatting utilities (rate of energy transfer)
|
|
1061
1184
|
*/
|
|
1062
|
-
declare function useServerDataControls({ filters, sort, search, onStateChange, searchDebounce, }: UseServerDataControlsOptions): void;
|
|
1063
1185
|
|
|
1064
|
-
interface UseDataControlsClientOptions<T> {
|
|
1065
|
-
mode: "client";
|
|
1066
|
-
/** Raw data to process (required in client mode) */
|
|
1067
|
-
data: T[];
|
|
1068
|
-
/** Filter state */
|
|
1069
|
-
filters?: FilterState;
|
|
1070
|
-
/** Sort state */
|
|
1071
|
-
sort?: SortState | null;
|
|
1072
|
-
/** Search configuration */
|
|
1073
|
-
search?: SearchConfig | null;
|
|
1074
|
-
/** Facet configurations */
|
|
1075
|
-
facetConfigs?: FacetConfig[];
|
|
1076
|
-
}
|
|
1077
|
-
interface UseDataControlsServerOptions<T> {
|
|
1078
|
-
mode: "server";
|
|
1079
|
-
/** Data from server (already filtered/sorted) */
|
|
1080
|
-
data: T[];
|
|
1081
|
-
/** Filter state */
|
|
1082
|
-
filters: FilterState;
|
|
1083
|
-
/** Sort state */
|
|
1084
|
-
sort: SortState | null;
|
|
1085
|
-
/** Search configuration */
|
|
1086
|
-
search: SearchConfig | null;
|
|
1087
|
-
/** Callback when state changes (required in server mode) */
|
|
1088
|
-
onStateChange: (state: ServerDataState) => void;
|
|
1089
|
-
/** Search debounce delay in ms (default: 300) */
|
|
1090
|
-
searchDebounce?: number;
|
|
1091
|
-
/** Result count from server */
|
|
1092
|
-
resultCount?: number;
|
|
1093
|
-
/** Facet counts from server */
|
|
1094
|
-
facetCounts?: FacetCounts;
|
|
1095
|
-
}
|
|
1096
|
-
type UseDataControlsOptions<T> = UseDataControlsClientOptions<T> | UseDataControlsServerOptions<T>;
|
|
1097
|
-
interface UseDataControlsResult<T> {
|
|
1098
|
-
/** Processed data (client mode) or server data (server mode) */
|
|
1099
|
-
data: T[];
|
|
1100
|
-
/** Facet counts (computed in client mode, passed through in server mode) */
|
|
1101
|
-
facetCounts: FacetCounts;
|
|
1102
|
-
/** Result count (computed in client mode, passed through in server mode) */
|
|
1103
|
-
resultCount: number;
|
|
1104
|
-
}
|
|
1105
1186
|
/**
|
|
1106
|
-
*
|
|
1107
|
-
*
|
|
1108
|
-
* Unified hook for managing data filtering, sorting, searching, and faceting.
|
|
1109
|
-
* Supports both client-side and server-side modes.
|
|
1110
|
-
*
|
|
1111
|
-
* **Client Mode:**
|
|
1112
|
-
* - Processes data locally using pure functions
|
|
1113
|
-
* - Computes facet counts automatically
|
|
1114
|
-
* - Best for datasets < 5000 rows
|
|
1115
|
-
*
|
|
1116
|
-
* **Server Mode:**
|
|
1117
|
-
* - Notifies parent when state changes (debounced for search)
|
|
1118
|
-
* - Passes through server-provided data and counts
|
|
1119
|
-
* - Best for large datasets or complex queries
|
|
1120
|
-
*
|
|
1121
|
-
* @example Client Mode
|
|
1122
|
-
* ```tsx
|
|
1123
|
-
* const { data, facetCounts, resultCount } = useDataControls({
|
|
1124
|
-
* mode: 'client',
|
|
1125
|
-
* data: rawData,
|
|
1126
|
-
* filters: createFilters([...]),
|
|
1127
|
-
* sort: { field: 'name', direction: 'asc' },
|
|
1128
|
-
* search: { query: searchQuery, fields: ['name', 'email'] },
|
|
1129
|
-
* facetConfigs: [{ field: 'department', label: 'Department' }]
|
|
1130
|
-
* });
|
|
1131
|
-
* ```
|
|
1132
|
-
*
|
|
1133
|
-
* @example Server Mode
|
|
1134
|
-
* ```tsx
|
|
1135
|
-
* const { data, facetCounts, resultCount } = useDataControls({
|
|
1136
|
-
* mode: 'server',
|
|
1137
|
-
* data: serverData, // Already filtered
|
|
1138
|
-
* filters,
|
|
1139
|
-
* sort,
|
|
1140
|
-
* search,
|
|
1141
|
-
* resultCount: totalCount,
|
|
1142
|
-
* facetCounts: serverFacets,
|
|
1143
|
-
* onStateChange: (state) => refetch(state)
|
|
1144
|
-
* });
|
|
1145
|
-
* ```
|
|
1187
|
+
* Format as Watts
|
|
1146
1188
|
*/
|
|
1147
|
-
declare
|
|
1148
|
-
|
|
1149
|
-
declare function useDebounce<T>(value: T, delay?: number): T;
|
|
1150
|
-
|
|
1151
|
-
interface ElementSize {
|
|
1152
|
-
width: number;
|
|
1153
|
-
height: number;
|
|
1154
|
-
}
|
|
1155
|
-
interface UseElementSizeResult<T extends HTMLElement = HTMLElement> {
|
|
1156
|
-
ref: (node: T | null) => void;
|
|
1157
|
-
width: number;
|
|
1158
|
-
height: number;
|
|
1159
|
-
}
|
|
1189
|
+
declare const toWatts: (value: number | null | undefined, decimals?: number) => string | null;
|
|
1160
1190
|
/**
|
|
1161
|
-
*
|
|
1162
|
-
*
|
|
1163
|
-
* A performant hook that tracks the dimensions of a DOM element using ResizeObserver.
|
|
1164
|
-
* Returns a callback ref to attach to the element and its current width/height.
|
|
1165
|
-
*
|
|
1166
|
-
* Performance optimizations:
|
|
1167
|
-
* - Uses ResizeObserver for efficient resize detection
|
|
1168
|
-
* - Debounces updates using requestAnimationFrame
|
|
1169
|
-
* - Cleans up observer on unmount
|
|
1170
|
-
*
|
|
1171
|
-
* @example
|
|
1172
|
-
* ```tsx
|
|
1173
|
-
* const { ref, width, height } = useElementSize();
|
|
1174
|
-
*
|
|
1175
|
-
* return (
|
|
1176
|
-
* <div ref={ref}>
|
|
1177
|
-
* Width: {width}px, Height: {height}px
|
|
1178
|
-
* </div>
|
|
1179
|
-
* );
|
|
1180
|
-
* ```
|
|
1191
|
+
* Format as kilowatts
|
|
1181
1192
|
*/
|
|
1182
|
-
declare
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
interface UseInfiniteScrollOptions<T = unknown> {
|
|
1186
|
-
/** Array of items being displayed */
|
|
1187
|
-
items: T[];
|
|
1188
|
-
/** Callback to load more items (optional - if not provided, no infinite scroll) */
|
|
1189
|
-
onLoadMore?: () => void | Promise<void>;
|
|
1190
|
-
/** Whether there are more items to load */
|
|
1191
|
-
hasMore?: boolean;
|
|
1192
|
-
/** Auto-detects initial vs loading-more from items.length */
|
|
1193
|
-
isLoading?: boolean;
|
|
1194
|
-
/** Explicit loading state override (takes precedence) */
|
|
1195
|
-
loadingState?: LoadingState;
|
|
1196
|
-
/** Enable virtualization (default: true for 100+ items) */
|
|
1197
|
-
enableVirtualization?: boolean;
|
|
1198
|
-
/** Estimated size of each item in pixels */
|
|
1199
|
-
estimatedItemSize?: number;
|
|
1200
|
-
/** Number of items to render outside viewport */
|
|
1201
|
-
overscan?: number;
|
|
1202
|
-
/** Custom scroll element (defaults to parent) */
|
|
1203
|
-
scrollElement?: HTMLElement | null;
|
|
1204
|
-
/** Distance from bottom in pixels to trigger load */
|
|
1205
|
-
loadMoreThreshold?: number;
|
|
1206
|
-
}
|
|
1207
|
-
interface UseInfiniteScrollReturn {
|
|
1208
|
-
virtualizer: Virtualizer<HTMLElement, Element> | null;
|
|
1209
|
-
virtualItems: ReturnType<Virtualizer<HTMLElement, Element>["getVirtualItems"]>;
|
|
1210
|
-
computedLoadingState: LoadingState;
|
|
1211
|
-
isInitialLoad: boolean;
|
|
1212
|
-
isLoadingMore: boolean;
|
|
1213
|
-
scrollRef: RefObject<HTMLDivElement | null>;
|
|
1214
|
-
loadMoreRef: RefObject<HTMLDivElement | null>;
|
|
1215
|
-
scrollToIndex: (index: number, options?: {
|
|
1216
|
-
align?: "start" | "center" | "end";
|
|
1217
|
-
}) => void;
|
|
1218
|
-
scrollToTop: () => void;
|
|
1219
|
-
}
|
|
1220
|
-
/**
|
|
1221
|
-
* useInfiniteScroll
|
|
1222
|
-
*
|
|
1223
|
-
* Hook for implementing infinite scroll with optional virtualization.
|
|
1224
|
-
* Intelligently detects initial vs loading-more states from context.
|
|
1225
|
-
*
|
|
1226
|
-
* Features:
|
|
1227
|
-
* - Smart loading state detection (initial vs loading-more)
|
|
1228
|
-
* - Optional explicit state control
|
|
1229
|
-
* - TanStack Virtual integration for performance
|
|
1230
|
-
* - Intersection Observer for load triggering
|
|
1231
|
-
* - Configurable virtualization threshold
|
|
1232
|
-
*
|
|
1233
|
-
* @example
|
|
1234
|
-
* ```tsx
|
|
1235
|
-
* const { scrollRef, computedLoadingState, isLoadingMore } = useInfiniteScroll({
|
|
1236
|
-
* items,
|
|
1237
|
-
* onLoadMore: fetchNextPage,
|
|
1238
|
-
* hasMore: hasNextPage,
|
|
1239
|
-
* isLoading: isFetching,
|
|
1240
|
-
* });
|
|
1241
|
-
* ```
|
|
1193
|
+
declare const toKilowatts: (value: number | null | undefined, decimals?: number) => string | null;
|
|
1194
|
+
/**
|
|
1195
|
+
* Format as megawatts
|
|
1242
1196
|
*/
|
|
1243
|
-
declare
|
|
1244
|
-
|
|
1197
|
+
declare const toMegawatts: (value: number | null | undefined, decimals?: number) => string | null;
|
|
1245
1198
|
/**
|
|
1246
|
-
*
|
|
1247
|
-
* @param key - The localStorage key
|
|
1248
|
-
* @param initialValue - The initial value if nothing is stored
|
|
1249
|
-
* @returns [value, setValue, removeValue] - Current value, setter function, and remove function
|
|
1199
|
+
* Format as gigawatts
|
|
1250
1200
|
*/
|
|
1251
|
-
declare
|
|
1201
|
+
declare const toGigawatts: (value: number | null | undefined, decimals?: number) => string | null;
|
|
1202
|
+
/**
|
|
1203
|
+
* Auto-scale power to the most appropriate unit
|
|
1204
|
+
*/
|
|
1205
|
+
declare const autoScalePower: (value: number | null | undefined, decimals?: number) => string | null;
|
|
1206
|
+
/**
|
|
1207
|
+
* Format power according to PowerFormat specification
|
|
1208
|
+
*/
|
|
1209
|
+
declare const formatPower: (value: FieldValue, format: PowerFormat) => FormattedValue;
|
|
1210
|
+
declare const toW: (value: number | null | undefined, decimals?: number) => string | null;
|
|
1211
|
+
declare const toKW: (value: number | null | undefined, decimals?: number) => string | null;
|
|
1212
|
+
declare const toMW: (value: number | null | undefined, decimals?: number) => string | null;
|
|
1213
|
+
declare const toGW: (value: number | null | undefined, decimals?: number) => string | null;
|
|
1252
1214
|
|
|
1253
1215
|
/**
|
|
1254
|
-
*
|
|
1255
|
-
*
|
|
1256
|
-
* @param query - A CSS media query string (e.g., "(min-width: 768px)")
|
|
1257
|
-
* @param defaultValue - The default value to return during SSR or before the first render
|
|
1258
|
-
* @returns A boolean indicating whether the media query matches
|
|
1259
|
-
*
|
|
1260
|
-
* @example
|
|
1261
|
-
* ```tsx
|
|
1262
|
-
* const isMobile = useMediaQuery('(max-width: 767px)');
|
|
1263
|
-
* const prefersReducedMotion = useMediaQuery('(prefers-reduced-motion: reduce)');
|
|
1264
|
-
* const isLandscape = useMediaQuery('(orientation: landscape)');
|
|
1265
|
-
* ```
|
|
1216
|
+
* FormatRegistry - A singleton pattern for managing formatters
|
|
1217
|
+
* Allows registration and retrieval of formatting functions by key
|
|
1266
1218
|
*/
|
|
1267
|
-
declare function useMediaQuery(query: string, defaultValue?: boolean): boolean;
|
|
1268
1219
|
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
type TableDensity = "compact" | "default" | "relaxed";
|
|
1272
|
-
type CellEmphasis = "strong" | "high" | "normal" | "low";
|
|
1273
|
-
type LinkBehavior = "none" | "hover" | "visible";
|
|
1274
|
-
type TableLayout = "auto" | "fixed" | "responsive";
|
|
1275
|
-
type TableWidth = "full" | "auto" | "contained";
|
|
1276
|
-
type MobileRenderer = "auto" | "cards" | "custom" | "none";
|
|
1277
|
-
type MobileBreakpoint = "sm" | "md" | "lg" | "xl";
|
|
1278
|
-
interface SortConfig {
|
|
1279
|
-
columnId: string;
|
|
1280
|
-
direction: SortDirection;
|
|
1281
|
-
}
|
|
1282
|
-
interface CellContext {
|
|
1283
|
-
isLoading: boolean;
|
|
1284
|
-
isSelected?: boolean;
|
|
1285
|
-
isHovered?: boolean;
|
|
1286
|
-
rowIndex: number;
|
|
1287
|
-
columnIndex: number;
|
|
1288
|
-
density: TableDensity;
|
|
1289
|
-
}
|
|
1290
|
-
interface CellComponentProps<T = any> {
|
|
1291
|
-
value: any;
|
|
1292
|
-
row: T;
|
|
1293
|
-
context: CellContext;
|
|
1294
|
-
[key: string]: any;
|
|
1295
|
-
}
|
|
1296
|
-
type CellComponent<T = any> = ComponentType<CellComponentProps<T>>;
|
|
1297
|
-
interface MobileConfig {
|
|
1298
|
-
priority?: 1 | 2 | 3;
|
|
1299
|
-
format?: "primary" | "secondary" | "badge" | "inline";
|
|
1300
|
-
label?: boolean;
|
|
1301
|
-
icon?: string;
|
|
1302
|
-
}
|
|
1303
|
-
interface Column<T> {
|
|
1304
|
-
id: string;
|
|
1305
|
-
label: string;
|
|
1306
|
-
accessor?: keyof T | ((row: T) => any);
|
|
1307
|
-
align?: CellAlignment;
|
|
1308
|
-
width?: string | number;
|
|
1309
|
-
minWidth?: string | number;
|
|
1310
|
-
maxWidth?: string | number;
|
|
1311
|
-
flex?: number;
|
|
1312
|
-
cell?: CellComponent<T>;
|
|
1313
|
-
cellProps?: Record<string, any> | ((value: any, row: T) => Record<string, any>);
|
|
1314
|
-
render?: (value: any, row: T, context: CellContext) => ReactNode;
|
|
1315
|
-
sortable?: boolean;
|
|
1220
|
+
declare class FormatRegistryClass {
|
|
1221
|
+
private formatters;
|
|
1316
1222
|
/**
|
|
1317
|
-
*
|
|
1318
|
-
*
|
|
1223
|
+
* Register a new formatter
|
|
1224
|
+
* @param key - Unique identifier for the formatter
|
|
1225
|
+
* @param formatter - The formatting function
|
|
1319
1226
|
*/
|
|
1320
|
-
|
|
1321
|
-
noCellPadding?: boolean;
|
|
1322
|
-
mobile?: MobileConfig | false;
|
|
1323
|
-
popover?: string | ((value: unknown, row: T) => ReactNode) | {
|
|
1324
|
-
content: string | ((value: unknown, row: T) => ReactNode);
|
|
1325
|
-
placement?: "top" | "bottom" | "left" | "right";
|
|
1326
|
-
showArrow?: boolean;
|
|
1327
|
-
trigger?: "hover" | "click";
|
|
1328
|
-
};
|
|
1329
|
-
/** Label to use for this column in CSV export headers. Falls back to `label` if not provided. */
|
|
1330
|
-
exportLabel?: string;
|
|
1227
|
+
register(key: string, formatter: FormatterFunction): void;
|
|
1331
1228
|
/**
|
|
1332
|
-
*
|
|
1333
|
-
*
|
|
1334
|
-
* @param value - The
|
|
1335
|
-
* @param
|
|
1336
|
-
* @returns The value
|
|
1229
|
+
* Format a value using a registered formatter
|
|
1230
|
+
* @param key - The formatter key
|
|
1231
|
+
* @param value - The value to format
|
|
1232
|
+
* @param args - Additional arguments to pass to the formatter
|
|
1233
|
+
* @returns The formatted value or null
|
|
1337
1234
|
*/
|
|
1338
|
-
|
|
1235
|
+
format(key: string, value: FieldValue, ...args: unknown[]): FormattedValue;
|
|
1339
1236
|
/**
|
|
1340
|
-
*
|
|
1341
|
-
*
|
|
1237
|
+
* Check if a formatter is registered
|
|
1238
|
+
* @param key - The formatter key
|
|
1239
|
+
* @returns True if the formatter exists
|
|
1342
1240
|
*/
|
|
1343
|
-
|
|
1344
|
-
}
|
|
1345
|
-
interface DataTableProps<T> {
|
|
1346
|
-
columns: Column<T>[];
|
|
1347
|
-
data: T[];
|
|
1348
|
-
className?: string;
|
|
1349
|
-
density?: TableDensity;
|
|
1350
|
-
width?: TableWidth;
|
|
1351
|
-
height?: string | number;
|
|
1352
|
-
maxHeight?: string | number;
|
|
1353
|
-
layout?: TableLayout;
|
|
1354
|
-
mobileRenderer?: MobileRenderer;
|
|
1355
|
-
customMobileRowRender?: (row: T, index: number) => ReactNode;
|
|
1356
|
-
mobileBreakpoint?: MobileBreakpoint;
|
|
1357
|
-
isLoading?: boolean;
|
|
1358
|
-
loadingState?: LoadingState;
|
|
1359
|
-
loadingRowCount?: number;
|
|
1360
|
-
onLoadMore?: () => void | Promise<void>;
|
|
1361
|
-
hasMore?: boolean;
|
|
1362
|
-
enableVirtualization?: boolean;
|
|
1363
|
-
estimatedRowHeight?: number;
|
|
1364
|
-
loadingIndicator?: ReactNode;
|
|
1365
|
-
stickyHeader?: boolean;
|
|
1366
|
-
/** Make the first column sticky on horizontal scroll */
|
|
1367
|
-
stickyFirstColumn?: boolean;
|
|
1368
|
-
onRowClick?: (row: T) => void;
|
|
1369
|
-
getRowId?: (row: T) => string;
|
|
1370
|
-
hideHeader?: boolean;
|
|
1371
|
-
/** Controlled sort configuration - when provided, DataTable becomes controlled */
|
|
1372
|
-
sortConfig?: SortConfig | null;
|
|
1373
|
-
onSort?: (sortConfig: SortConfig | null) => void;
|
|
1374
|
-
"aria-label"?: string;
|
|
1241
|
+
has(key: string): boolean;
|
|
1375
1242
|
/**
|
|
1376
|
-
*
|
|
1377
|
-
*
|
|
1243
|
+
* Get all registered formatter keys
|
|
1244
|
+
* @returns Array of formatter keys
|
|
1378
1245
|
*/
|
|
1379
|
-
|
|
1246
|
+
keys(): string[];
|
|
1380
1247
|
/**
|
|
1381
|
-
*
|
|
1382
|
-
*
|
|
1383
|
-
* Use with onColumnOrderChange for controlled behavior.
|
|
1248
|
+
* Remove a formatter
|
|
1249
|
+
* @param key - The formatter key to remove
|
|
1384
1250
|
*/
|
|
1385
|
-
|
|
1251
|
+
unregister(key: string): void;
|
|
1386
1252
|
/**
|
|
1387
|
-
*
|
|
1388
|
-
* Receives the new array of column IDs in their new order.
|
|
1253
|
+
* Clear all registered formatters
|
|
1389
1254
|
*/
|
|
1390
|
-
|
|
1255
|
+
clear(): void;
|
|
1391
1256
|
}
|
|
1257
|
+
declare const FormatRegistry: FormatRegistryClass;
|
|
1258
|
+
|
|
1259
|
+
/**
|
|
1260
|
+
* Electrical resistance formatting utilities
|
|
1261
|
+
*/
|
|
1262
|
+
|
|
1263
|
+
/**
|
|
1264
|
+
* Format as milliohms
|
|
1265
|
+
*/
|
|
1266
|
+
declare const toMilliohms: (value: number | null | undefined, decimals?: number) => string | null;
|
|
1267
|
+
/**
|
|
1268
|
+
* Format as ohms
|
|
1269
|
+
*/
|
|
1270
|
+
declare const toOhms: (value: number | null | undefined, decimals?: number) => string | null;
|
|
1271
|
+
/**
|
|
1272
|
+
* Format as kilohms
|
|
1273
|
+
*/
|
|
1274
|
+
declare const toKilohms: (value: number | null | undefined, decimals?: number) => string | null;
|
|
1275
|
+
/**
|
|
1276
|
+
* Format as megohms
|
|
1277
|
+
*/
|
|
1278
|
+
declare const toMegohms: (value: number | null | undefined, decimals?: number) => string | null;
|
|
1279
|
+
/**
|
|
1280
|
+
* Auto-scale resistance to the most appropriate unit
|
|
1281
|
+
*/
|
|
1282
|
+
declare const autoScaleResistance: (value: number | null | undefined, decimals?: number) => string | null;
|
|
1283
|
+
/**
|
|
1284
|
+
* Format resistance according to ResistanceFormat specification
|
|
1285
|
+
*/
|
|
1286
|
+
declare const formatResistance: (value: FieldValue, format: ResistanceFormat) => FormattedValue;
|
|
1287
|
+
|
|
1288
|
+
/**
|
|
1289
|
+
* Temperature formatting utilities
|
|
1290
|
+
*/
|
|
1291
|
+
|
|
1292
|
+
/**
|
|
1293
|
+
* Convert temperature unit string to symbol
|
|
1294
|
+
*/
|
|
1295
|
+
declare const temperatureStringToSymbol: (unit: TemperatureUnitString) => TemperatureUnit;
|
|
1296
|
+
/**
|
|
1297
|
+
* Format as Fahrenheit
|
|
1298
|
+
*/
|
|
1299
|
+
declare const toFahrenheit: (value: number | null | undefined, decimals?: number) => string | null;
|
|
1300
|
+
/**
|
|
1301
|
+
* Format as Celsius
|
|
1302
|
+
*/
|
|
1303
|
+
declare const toCelsius: (value: number | null | undefined, fromFahrenheit?: boolean, decimals?: number) => string | null;
|
|
1304
|
+
/**
|
|
1305
|
+
* Format as Kelvin
|
|
1306
|
+
*/
|
|
1307
|
+
declare const toKelvin: (value: number | null | undefined, fromFahrenheit?: boolean, decimals?: number) => string | null;
|
|
1308
|
+
/**
|
|
1309
|
+
* Convert Celsius to Fahrenheit
|
|
1310
|
+
*/
|
|
1311
|
+
declare const celsiusToFahrenheit: (celsius: number) => number;
|
|
1312
|
+
/**
|
|
1313
|
+
* Convert Fahrenheit to Celsius
|
|
1314
|
+
*/
|
|
1315
|
+
declare const fahrenheitToCelsius: (fahrenheit: number) => number;
|
|
1316
|
+
/**
|
|
1317
|
+
* Convert Celsius to Kelvin
|
|
1318
|
+
*/
|
|
1319
|
+
declare const celsiusToKelvin: (celsius: number) => number;
|
|
1320
|
+
/**
|
|
1321
|
+
* Convert Kelvin to Celsius
|
|
1322
|
+
*/
|
|
1323
|
+
declare const kelvinToCelsius: (kelvin: number) => number;
|
|
1324
|
+
/**
|
|
1325
|
+
* Convert Fahrenheit to Kelvin
|
|
1326
|
+
*/
|
|
1327
|
+
declare const fahrenheitToKelvin: (fahrenheit: number) => number;
|
|
1328
|
+
/**
|
|
1329
|
+
* Convert Kelvin to Fahrenheit
|
|
1330
|
+
*/
|
|
1331
|
+
declare const kelvinToFahrenheit: (kelvin: number) => number;
|
|
1332
|
+
/**
|
|
1333
|
+
* Format temperature with specified unit
|
|
1334
|
+
*/
|
|
1335
|
+
declare const toTemperature: (value: number | null | undefined, unit?: TemperatureUnit | TemperatureUnitString, decimals?: number) => string | null;
|
|
1336
|
+
/**
|
|
1337
|
+
* Format temperature according to TemperatureFormat specification
|
|
1338
|
+
*/
|
|
1339
|
+
declare const formatTemperature: (value: FieldValue, format: TemperatureFormat) => FormattedValue;
|
|
1392
1340
|
|
|
1393
1341
|
/**
|
|
1394
|
-
*
|
|
1395
|
-
* Provides export functionality for DataTable data
|
|
1342
|
+
* Text formatting utilities
|
|
1396
1343
|
*/
|
|
1397
1344
|
|
|
1398
|
-
interface TableExportMetadata {
|
|
1399
|
-
/** Base filename for the exported file (without extension) */
|
|
1400
|
-
filename?: string;
|
|
1401
|
-
/** Whether to include timestamp in filename. Defaults to true */
|
|
1402
|
-
timestamp?: boolean;
|
|
1403
|
-
}
|
|
1404
|
-
interface TableExportOptions<T> {
|
|
1405
|
-
/** Column definitions for the table */
|
|
1406
|
-
columns: Column<T>[];
|
|
1407
|
-
/** Data rows to export */
|
|
1408
|
-
data: T[];
|
|
1409
|
-
/** Export metadata */
|
|
1410
|
-
metadata?: TableExportMetadata;
|
|
1411
|
-
}
|
|
1412
1345
|
/**
|
|
1413
|
-
*
|
|
1346
|
+
* Convert text to uppercase
|
|
1347
|
+
*/
|
|
1348
|
+
declare const toUpperCase: (text: string | null | undefined) => string;
|
|
1349
|
+
/**
|
|
1350
|
+
* Convert text to lowercase
|
|
1351
|
+
*/
|
|
1352
|
+
declare const toLowerCase: (text: string | null | undefined) => string;
|
|
1353
|
+
/**
|
|
1354
|
+
* Convert text to sentence case (first letter capitalized, rest lowercase).
|
|
1414
1355
|
*
|
|
1415
|
-
* @param
|
|
1416
|
-
* @returns
|
|
1356
|
+
* @param text - Text to convert
|
|
1357
|
+
* @returns Sentence-cased text
|
|
1417
1358
|
*
|
|
1418
1359
|
* @example
|
|
1419
1360
|
* ```typescript
|
|
1420
|
-
*
|
|
1421
|
-
*
|
|
1422
|
-
* data: tableData,
|
|
1423
|
-
* metadata: {
|
|
1424
|
-
* filename: "devices-export",
|
|
1425
|
-
* timestamp: true
|
|
1426
|
-
* }
|
|
1427
|
-
* });
|
|
1361
|
+
* toSentenceCase("HELLO WORLD"); // "Hello world"
|
|
1362
|
+
* toSentenceCase("hello world"); // "Hello world"
|
|
1428
1363
|
* ```
|
|
1429
1364
|
*/
|
|
1430
|
-
declare
|
|
1365
|
+
declare const toSentenceCase: (text: string | null | undefined) => string;
|
|
1431
1366
|
/**
|
|
1432
|
-
*
|
|
1433
|
-
*
|
|
1367
|
+
* Convert text to title case with proper handling of articles and prepositions.
|
|
1368
|
+
* Capitalizes the first letter of each word except common articles/prepositions
|
|
1369
|
+
* (unless they're the first word).
|
|
1434
1370
|
*
|
|
1435
|
-
* @param
|
|
1436
|
-
* @returns
|
|
1371
|
+
* @param text - Text to convert
|
|
1372
|
+
* @returns Title-cased text
|
|
1373
|
+
*
|
|
1374
|
+
* @example
|
|
1375
|
+
* ```typescript
|
|
1376
|
+
* toTitleCase("the quick brown fox"); // "The Quick Brown Fox"
|
|
1377
|
+
* toTitleCase("war and peace"); // "War and Peace"
|
|
1378
|
+
* toTitleCase("to be or not to be"); // "To Be or Not to Be"
|
|
1379
|
+
* ```
|
|
1437
1380
|
*/
|
|
1438
|
-
declare
|
|
1381
|
+
declare const toTitleCase: (text: string | null | undefined) => string;
|
|
1439
1382
|
/**
|
|
1440
|
-
*
|
|
1441
|
-
* Useful for generating CSV headers on the server
|
|
1383
|
+
* Capitalize first letter of each word
|
|
1442
1384
|
*/
|
|
1443
|
-
declare
|
|
1444
|
-
|
|
1445
|
-
interface UseTableExportOptions<T> {
|
|
1446
|
-
/** Column definitions for the table */
|
|
1447
|
-
columns: Column<T>[];
|
|
1448
|
-
/** Data rows to export */
|
|
1449
|
-
data: T[];
|
|
1450
|
-
/** Export metadata */
|
|
1451
|
-
metadata?: TableExportMetadata;
|
|
1452
|
-
}
|
|
1453
|
-
interface UseTableExportReturn {
|
|
1454
|
-
/** Trigger CSV export of the table data */
|
|
1455
|
-
exportCSV: () => Promise<void>;
|
|
1456
|
-
/** Whether export is available (has data and exportable columns) */
|
|
1457
|
-
canExport: boolean;
|
|
1458
|
-
}
|
|
1385
|
+
declare const capitalize: (text: string | null | undefined) => string;
|
|
1459
1386
|
/**
|
|
1460
|
-
*
|
|
1461
|
-
* Provides a stable callback for triggering exports with memoized dependencies.
|
|
1462
|
-
*
|
|
1463
|
-
* For client-side DataTables where all data is in the browser.
|
|
1464
|
-
* For server-side exports, use the `onExport` callback pattern instead.
|
|
1465
|
-
*
|
|
1466
|
-
* @param options - Configuration for table export
|
|
1467
|
-
* @returns Object with export function and status
|
|
1468
|
-
*
|
|
1469
|
-
* @example
|
|
1470
|
-
* ```tsx
|
|
1471
|
-
* const { exportCSV, canExport } = useTableExport({
|
|
1472
|
-
* columns: deviceColumns,
|
|
1473
|
-
* data: devices,
|
|
1474
|
-
* metadata: {
|
|
1475
|
-
* filename: "devices",
|
|
1476
|
-
* timestamp: true
|
|
1477
|
-
* }
|
|
1478
|
-
* });
|
|
1479
|
-
*
|
|
1480
|
-
* // In your DataControls actions
|
|
1481
|
-
* <DataControls
|
|
1482
|
-
* actions={{
|
|
1483
|
-
* items: [
|
|
1484
|
-
* {
|
|
1485
|
-
* id: "export",
|
|
1486
|
-
* label: "Export CSV",
|
|
1487
|
-
* icon: "Export",
|
|
1488
|
-
* onClick: exportCSV,
|
|
1489
|
-
* disabled: !canExport
|
|
1490
|
-
* }
|
|
1491
|
-
* ]
|
|
1492
|
-
* }}
|
|
1493
|
-
* />
|
|
1494
|
-
* ```
|
|
1387
|
+
* Uppercase first letter only
|
|
1495
1388
|
*/
|
|
1496
|
-
declare
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
/**
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
declare const
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
data?: TileData;
|
|
1530
|
-
error?: Error;
|
|
1531
|
-
};
|
|
1532
|
-
type TileStore = ReadonlyMap<string, TileEntry>;
|
|
1533
|
-
type TileAction = {
|
|
1534
|
-
type: "request";
|
|
1535
|
-
ids: string[];
|
|
1536
|
-
} | {
|
|
1537
|
-
type: "fulfilled";
|
|
1538
|
-
id: string;
|
|
1539
|
-
data: TileData;
|
|
1540
|
-
} | {
|
|
1541
|
-
type: "failed";
|
|
1542
|
-
id: string;
|
|
1543
|
-
error: Error;
|
|
1544
|
-
} | {
|
|
1545
|
-
type: "reset";
|
|
1546
|
-
};
|
|
1547
|
-
declare const emptyStore: TileStore;
|
|
1548
|
-
declare function tileReducer(store: TileStore, action: TileAction): TileStore;
|
|
1389
|
+
declare const ucFirst: (text: string | null | undefined) => string;
|
|
1390
|
+
/**
|
|
1391
|
+
* Convert camelCase to words
|
|
1392
|
+
*/
|
|
1393
|
+
declare const camelCaseToWords: (text: string | null | undefined) => string;
|
|
1394
|
+
/**
|
|
1395
|
+
* Convert snake_case to words
|
|
1396
|
+
*/
|
|
1397
|
+
declare const snakeCaseToWords: (text: string | null | undefined) => string;
|
|
1398
|
+
/**
|
|
1399
|
+
* Convert enum-style text to sentence case
|
|
1400
|
+
*/
|
|
1401
|
+
declare const enumToSentenceCase: (text: string | null | undefined) => string;
|
|
1402
|
+
/**
|
|
1403
|
+
* Truncate text in the middle
|
|
1404
|
+
*/
|
|
1405
|
+
declare const truncateMiddle: (value: string | null | undefined, length?: number) => string;
|
|
1406
|
+
/**
|
|
1407
|
+
* Truncate text at the start
|
|
1408
|
+
*/
|
|
1409
|
+
declare const truncateStart: (value: string | null | undefined, length?: number) => string;
|
|
1410
|
+
/**
|
|
1411
|
+
* Truncate text at the end
|
|
1412
|
+
*/
|
|
1413
|
+
declare const truncateEnd: (value: string | null | undefined, length?: number, ellipsis?: string) => string;
|
|
1414
|
+
/**
|
|
1415
|
+
* Mask sensitive text (e.g., secrets, API keys)
|
|
1416
|
+
*/
|
|
1417
|
+
declare const toSecret: (value: string | null | undefined) => string;
|
|
1418
|
+
/**
|
|
1419
|
+
* Format text according to TextFormat specification
|
|
1420
|
+
*/
|
|
1421
|
+
declare const formatText: (value: FieldValue, format: TextFormat) => FormattedValue;
|
|
1549
1422
|
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
erroredTiles: number;
|
|
1554
|
-
};
|
|
1555
|
-
type AssembledSeries = {
|
|
1556
|
-
line: BaseDataPoint[];
|
|
1557
|
-
band: BaseDataPoint[];
|
|
1558
|
-
renderTier: Tier | null;
|
|
1559
|
-
targetTier: Tier;
|
|
1560
|
-
isFallback: boolean;
|
|
1561
|
-
isStale: boolean;
|
|
1562
|
-
coverage: Coverage;
|
|
1563
|
-
};
|
|
1564
|
-
type AssembleSeriesArgs = {
|
|
1565
|
-
viewport: Viewport;
|
|
1566
|
-
targetTier: Tier;
|
|
1567
|
-
ladder: ResolutionLadder;
|
|
1568
|
-
store: TileStore;
|
|
1569
|
-
overscanTiles: number;
|
|
1570
|
-
prev?: AssembledSeries | null;
|
|
1571
|
-
};
|
|
1572
|
-
declare function assembleSeries({ viewport, targetTier, ladder, store, overscanTiles, prev, }: AssembleSeriesArgs): AssembledSeries;
|
|
1423
|
+
/**
|
|
1424
|
+
* Voltage formatting utilities (electrical potential)
|
|
1425
|
+
*/
|
|
1573
1426
|
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
series: AssembledSeries;
|
|
1598
|
-
loading: boolean;
|
|
1599
|
-
atDataStart: boolean;
|
|
1600
|
-
}
|
|
1601
|
-
declare function useTiledTimeSeries(args: UseTiledTimeSeriesArgs): UseTiledTimeSeriesResult;
|
|
1427
|
+
/**
|
|
1428
|
+
* Format as millivolts
|
|
1429
|
+
*/
|
|
1430
|
+
declare const toMillivolts: (value: number | null | undefined, decimals?: number) => string | null;
|
|
1431
|
+
/**
|
|
1432
|
+
* Format as volts
|
|
1433
|
+
*/
|
|
1434
|
+
declare const toVolts: (value: number | null | undefined, decimals?: number) => string | null;
|
|
1435
|
+
/**
|
|
1436
|
+
* Format as kilovolts
|
|
1437
|
+
*/
|
|
1438
|
+
declare const toKilovolts: (value: number | null | undefined, decimals?: number) => string | null;
|
|
1439
|
+
/**
|
|
1440
|
+
* Auto-scale voltage to the most appropriate unit
|
|
1441
|
+
*/
|
|
1442
|
+
declare const autoScaleVoltage: (value: number | null | undefined, decimals?: number) => string | null;
|
|
1443
|
+
/**
|
|
1444
|
+
* Format voltage according to VoltageFormat specification
|
|
1445
|
+
*/
|
|
1446
|
+
declare const formatVoltage: (value: FieldValue, format: VoltageFormat) => FormattedValue;
|
|
1447
|
+
declare const toMV: (value: number | null | undefined, decimals?: number) => string | null;
|
|
1448
|
+
declare const toV: (value: number | null | undefined, decimals?: number) => string | null;
|
|
1449
|
+
declare const toKV: (value: number | null | undefined, decimals?: number) => string | null;
|
|
1602
1450
|
|
|
1603
1451
|
/**
|
|
1604
|
-
*
|
|
1452
|
+
* Comprehensive formatting utilities for the Edges design system
|
|
1605
1453
|
*
|
|
1606
|
-
*
|
|
1607
|
-
*
|
|
1454
|
+
* This module provides a unified formatting system with support for:
|
|
1455
|
+
* - Text formatting (case conversion, truncation, etc.)
|
|
1456
|
+
* - Number formatting (decimals, thousands separators, compact notation)
|
|
1457
|
+
* - Currency formatting (multiple currencies and display options)
|
|
1458
|
+
* - Date formatting (relative time, custom formats, timezones)
|
|
1459
|
+
* - Boolean formatting (custom true/false text)
|
|
1460
|
+
* - Energy units (Wh, kWh, MWh, GWh with auto-scaling)
|
|
1461
|
+
* - Temperature units (Celsius, Fahrenheit, Kelvin)
|
|
1462
|
+
* - Distance units (meters, kilometers, miles, feet)
|
|
1463
|
+
* - Phone number formatting (US and international)
|
|
1464
|
+
* - Custom formatters via the FormatRegistry
|
|
1608
1465
|
*/
|
|
1609
1466
|
|
|
1610
|
-
interface ApplyDataOperationsOptions<T> {
|
|
1611
|
-
data: T[];
|
|
1612
|
-
filters?: FilterState;
|
|
1613
|
-
sort?: SortState | null;
|
|
1614
|
-
search?: SearchConfig | null;
|
|
1615
|
-
facetConfigs?: FacetConfig[];
|
|
1616
|
-
}
|
|
1617
|
-
interface ApplyDataOperationsResult<T> {
|
|
1618
|
-
data: T[];
|
|
1619
|
-
facetCounts: FacetCounts;
|
|
1620
|
-
resultCount: number;
|
|
1621
|
-
}
|
|
1622
1467
|
/**
|
|
1623
|
-
*
|
|
1624
|
-
*
|
|
1625
|
-
*
|
|
1626
|
-
*
|
|
1627
|
-
*
|
|
1468
|
+
* Convenience function to create a format object
|
|
1469
|
+
*
|
|
1470
|
+
* @example
|
|
1471
|
+
* ```typescript
|
|
1472
|
+
* const currencyFormat = createFormat("currency", { currency: "EUR" });
|
|
1473
|
+
* const dateFormat = createFormat("date", { relative: true });
|
|
1474
|
+
* ```
|
|
1628
1475
|
*/
|
|
1629
|
-
declare
|
|
1476
|
+
declare const createFormat: <T extends FieldFormat["type"]>(type: T, options?: Omit<Extract<FieldFormat, {
|
|
1477
|
+
type: T;
|
|
1478
|
+
}>, "type">) => Extract<FieldFormat, {
|
|
1479
|
+
type: T;
|
|
1480
|
+
}>;
|
|
1630
1481
|
|
|
1631
1482
|
/**
|
|
1632
1483
|
* Semantic typography role classes generated by @texturehq/edges-tokens.
|
|
@@ -2515,6 +2366,21 @@ interface ContactMetaDisplayProps {
|
|
|
2515
2366
|
*/
|
|
2516
2367
|
declare function ContactMetaDisplay({ firstName, lastName, email, avatarUrl, layout, size, href, LinkComponent, linkVariant, emphasis, showEmail, badge, avatarShape, isLoading, className, piiEntity, }: ContactMetaDisplayProps): react_jsx_runtime.JSX.Element;
|
|
2517
2368
|
|
|
2369
|
+
/**
|
|
2370
|
+
* ContainerQueryProvider — measures its own width via ResizeObserver and
|
|
2371
|
+
* provides breakpoint state to all descendant blocks via context.
|
|
2372
|
+
*
|
|
2373
|
+
* Wrap block previews (or board surfaces) in this provider so blocks that
|
|
2374
|
+
* use `useContainerBreakpoint` respond to their actual render width, not
|
|
2375
|
+
* the browser viewport.
|
|
2376
|
+
*
|
|
2377
|
+
* Renders a transparent div wrapper — apply className to control layout.
|
|
2378
|
+
*/
|
|
2379
|
+
declare function ContainerQueryProvider({ children, className }: {
|
|
2380
|
+
children: React.ReactNode;
|
|
2381
|
+
className?: string;
|
|
2382
|
+
}): react_jsx_runtime.JSX.Element;
|
|
2383
|
+
|
|
2518
2384
|
interface CopyToClipboardProps {
|
|
2519
2385
|
/**
|
|
2520
2386
|
* The value to copy to clipboard. If not provided, will use the text content of children
|
|
@@ -2705,6 +2571,65 @@ declare const ChartAxis: {
|
|
|
2705
2571
|
NumericBottom: React__default.FC<NumericAxisBottomProps>;
|
|
2706
2572
|
};
|
|
2707
2573
|
|
|
2574
|
+
/**
|
|
2575
|
+
* Chart export utilities for CSV, SVG, and PNG formats
|
|
2576
|
+
* Provides comprehensive export functionality for chart visualizations
|
|
2577
|
+
*/
|
|
2578
|
+
|
|
2579
|
+
type ExportType = "csv" | "svg" | "png";
|
|
2580
|
+
interface ChartExportMetadata {
|
|
2581
|
+
xLabel?: string;
|
|
2582
|
+
yLabel?: string;
|
|
2583
|
+
seriesLabels?: string[];
|
|
2584
|
+
filename?: string;
|
|
2585
|
+
timestamp?: boolean;
|
|
2586
|
+
/**
|
|
2587
|
+
* Optional FieldFormat for the y-axis. When present, the CSV export:
|
|
2588
|
+
* - suffixes every series header with the format's stable column unit
|
|
2589
|
+
* (e.g. "Consumption (kWh)", "Voltage (V)"), and
|
|
2590
|
+
* - writes bare numbers in that unit into the cells (no per-row auto-scale).
|
|
2591
|
+
*
|
|
2592
|
+
* This keeps chart CSVs consistent with the Explore table CSV (BOLT-1431):
|
|
2593
|
+
* unit in the header, bare numbers in the cells.
|
|
2594
|
+
*/
|
|
2595
|
+
yFormat?: FieldFormat;
|
|
2596
|
+
}
|
|
2597
|
+
/**
|
|
2598
|
+
* Main export function that handles all chart export types.
|
|
2599
|
+
* Supports CSV, SVG, and PNG formats with automatic filename generation.
|
|
2600
|
+
*
|
|
2601
|
+
* @param type - Export format: "csv", "svg", or "png"
|
|
2602
|
+
* @param datasets - Chart data as single array or array of arrays for multi-series
|
|
2603
|
+
* @param metadata - Export metadata including labels and filename options
|
|
2604
|
+
* @param svgRef - Reference to the chart's SVG element
|
|
2605
|
+
* @returns Promise that resolves when export is complete
|
|
2606
|
+
*
|
|
2607
|
+
* @example
|
|
2608
|
+
* ```typescript
|
|
2609
|
+
* // Export single series as CSV
|
|
2610
|
+
* await exportChart("csv", data, {
|
|
2611
|
+
* xLabel: "Date",
|
|
2612
|
+
* yLabel: "Value",
|
|
2613
|
+
* filename: "sales-data"
|
|
2614
|
+
* }, svgRef);
|
|
2615
|
+
*
|
|
2616
|
+
* // Export multi-series chart as PNG
|
|
2617
|
+
* await exportChart("png", [series1, series2], {
|
|
2618
|
+
* seriesLabels: ["Revenue", "Profit"],
|
|
2619
|
+
* timestamp: false
|
|
2620
|
+
* }, svgRef);
|
|
2621
|
+
* ```
|
|
2622
|
+
*/
|
|
2623
|
+
declare function exportChart(type: ExportType, datasets: BaseDataPoint[][] | BaseDataPoint[], metadata: ChartExportMetadata | undefined, svgRef: React__default.RefObject<SVGSVGElement | null>): Promise<void>;
|
|
2624
|
+
/**
|
|
2625
|
+
* Utility to check if export is supported in the current environment
|
|
2626
|
+
*/
|
|
2627
|
+
declare function isExportSupported(type: ExportType): boolean;
|
|
2628
|
+
/**
|
|
2629
|
+
* Get human-readable export format name
|
|
2630
|
+
*/
|
|
2631
|
+
declare function getExportFormatName(type: ExportType): string;
|
|
2632
|
+
|
|
2708
2633
|
interface ChartBottomBarProps {
|
|
2709
2634
|
items: LegendItem[];
|
|
2710
2635
|
onExport: (type: ExportType) => void | Promise<void>;
|
|
@@ -3049,6 +2974,20 @@ interface LineSeriesProps {
|
|
|
3049
2974
|
*/
|
|
3050
2975
|
declare const LineSeries: React__default.FC<LineSeriesProps>;
|
|
3051
2976
|
|
|
2977
|
+
type TiledCameraPreviewDomain = [number, number] | null;
|
|
2978
|
+
interface TiledCameraSyncGroup {
|
|
2979
|
+
publish(source: object, preview: TiledCameraPreviewDomain): void;
|
|
2980
|
+
subscribe(source: object, onPreview: (preview: TiledCameraPreviewDomain) => void): () => void;
|
|
2981
|
+
}
|
|
2982
|
+
/**
|
|
2983
|
+
* Shared camera for a set of TiledTimeSeriesCharts: pass one group to each
|
|
2984
|
+
* chart's `cameraSync` prop and an in-progress pan/zoom on any chart previews
|
|
2985
|
+
* live on the others, frame-by-frame. Purely imperative — sibling charts apply
|
|
2986
|
+
* the previewed domain as a plot-group transform and axis re-tick, so nothing
|
|
2987
|
+
* re-renders through React until the gesture settles.
|
|
2988
|
+
*/
|
|
2989
|
+
declare function createTiledCameraSyncGroup(): TiledCameraSyncGroup;
|
|
2990
|
+
|
|
3052
2991
|
interface TiledTimeSeriesChartViewport {
|
|
3053
2992
|
startMs: number;
|
|
3054
2993
|
endMs: number;
|
|
@@ -3073,6 +3012,12 @@ interface TiledTimeSeriesChartProps {
|
|
|
3073
3012
|
label?: string;
|
|
3074
3013
|
color?: string;
|
|
3075
3014
|
}[];
|
|
3015
|
+
/**
|
|
3016
|
+
* Shared camera group (see `createTiledCameraSyncGroup`). While a gesture is
|
|
3017
|
+
* in progress on any chart in the group, the others mirror its live camera
|
|
3018
|
+
* frame-by-frame; the settled commit still arrives via `onViewportChange`.
|
|
3019
|
+
*/
|
|
3020
|
+
cameraSync?: TiledCameraSyncGroup;
|
|
3076
3021
|
parentWidth?: number;
|
|
3077
3022
|
parentHeight?: number;
|
|
3078
3023
|
}
|
|
@@ -3090,6 +3035,34 @@ declare const TiledTimeSeriesChart: React__default.FC<Omit<TiledTimeSeriesChartP
|
|
|
3090
3035
|
parentHeight?: number;
|
|
3091
3036
|
}>;
|
|
3092
3037
|
|
|
3038
|
+
/** The camera: the visible time window, absolute epoch ms. */
|
|
3039
|
+
type Viewport = {
|
|
3040
|
+
startMs: number;
|
|
3041
|
+
endMs: number;
|
|
3042
|
+
};
|
|
3043
|
+
/** One rung of the resolution ladder. */
|
|
3044
|
+
type Tier = {
|
|
3045
|
+
id: string;
|
|
3046
|
+
bucketMs: number;
|
|
3047
|
+
tileSpanMs: number;
|
|
3048
|
+
};
|
|
3049
|
+
type ResolutionLadder = Tier[];
|
|
3050
|
+
/** A fixed-grid data slice: tile `index` at `tierId`, covering [startMs, endMs). */
|
|
3051
|
+
type TileRef = {
|
|
3052
|
+
tierId: string;
|
|
3053
|
+
index: number;
|
|
3054
|
+
startMs: number;
|
|
3055
|
+
endMs: number;
|
|
3056
|
+
};
|
|
3057
|
+
/** Data a tile carries. `band` optional → engine is metric-agnostic. */
|
|
3058
|
+
type TileData = {
|
|
3059
|
+
line: BaseDataPoint[];
|
|
3060
|
+
band?: BaseDataPoint[];
|
|
3061
|
+
};
|
|
3062
|
+
/** Injected loader: one tile = one bounded fetch. */
|
|
3063
|
+
type FetchTile = (tier: Tier, startMs: number, endMs: number, signal: AbortSignal) => Promise<TileData>;
|
|
3064
|
+
declare const tileKey: (tierId: string, index: number) => string;
|
|
3065
|
+
|
|
3093
3066
|
/**
|
|
3094
3067
|
* Pick the finest tier whose bucket is coarse enough to hit ~targetPointsPerPx
|
|
3095
3068
|
* across the chart and is not finer than the series' native cadence.
|
|
@@ -3099,6 +3072,54 @@ declare function tierForViewport(spanMs: number, widthPx: number, ladder: Resolu
|
|
|
3099
3072
|
nativeMs: number;
|
|
3100
3073
|
}): Tier;
|
|
3101
3074
|
|
|
3075
|
+
type TileStatus = "loading" | "loaded" | "empty" | "error";
|
|
3076
|
+
type TileEntry = {
|
|
3077
|
+
status: TileStatus;
|
|
3078
|
+
data?: TileData;
|
|
3079
|
+
error?: Error;
|
|
3080
|
+
};
|
|
3081
|
+
type TileStore = ReadonlyMap<string, TileEntry>;
|
|
3082
|
+
type TileAction = {
|
|
3083
|
+
type: "request";
|
|
3084
|
+
ids: string[];
|
|
3085
|
+
} | {
|
|
3086
|
+
type: "fulfilled";
|
|
3087
|
+
id: string;
|
|
3088
|
+
data: TileData;
|
|
3089
|
+
} | {
|
|
3090
|
+
type: "failed";
|
|
3091
|
+
id: string;
|
|
3092
|
+
error: Error;
|
|
3093
|
+
} | {
|
|
3094
|
+
type: "reset";
|
|
3095
|
+
};
|
|
3096
|
+
declare const emptyStore: TileStore;
|
|
3097
|
+
declare function tileReducer(store: TileStore, action: TileAction): TileStore;
|
|
3098
|
+
|
|
3099
|
+
type Coverage = {
|
|
3100
|
+
earliestMs?: number;
|
|
3101
|
+
latestMs?: number;
|
|
3102
|
+
erroredTiles: number;
|
|
3103
|
+
};
|
|
3104
|
+
type AssembledSeries = {
|
|
3105
|
+
line: BaseDataPoint[];
|
|
3106
|
+
band: BaseDataPoint[];
|
|
3107
|
+
renderTier: Tier | null;
|
|
3108
|
+
targetTier: Tier;
|
|
3109
|
+
isFallback: boolean;
|
|
3110
|
+
isStale: boolean;
|
|
3111
|
+
coverage: Coverage;
|
|
3112
|
+
};
|
|
3113
|
+
type AssembleSeriesArgs = {
|
|
3114
|
+
viewport: Viewport;
|
|
3115
|
+
targetTier: Tier;
|
|
3116
|
+
ladder: ResolutionLadder;
|
|
3117
|
+
store: TileStore;
|
|
3118
|
+
overscanTiles: number;
|
|
3119
|
+
prev?: AssembledSeries | null;
|
|
3120
|
+
};
|
|
3121
|
+
declare function assembleSeries({ viewport, targetTier, ladder, store, overscanTiles, prev, }: AssembleSeriesArgs): AssembledSeries;
|
|
3122
|
+
|
|
3102
3123
|
declare function tileIndexAt(tsMs: number, tier: Tier): number;
|
|
3103
3124
|
declare function tilesForViewport(viewport: Viewport, tier: Tier, overscanTiles: number): TileRef[];
|
|
3104
3125
|
|
|
@@ -6213,8 +6234,8 @@ declare namespace PageLayout {
|
|
|
6213
6234
|
var Header: typeof Header;
|
|
6214
6235
|
var Tabs: typeof Tabs$1;
|
|
6215
6236
|
var Content: typeof Content;
|
|
6216
|
-
var Aside: typeof Aside
|
|
6217
|
-
var ScrollableContent:
|
|
6237
|
+
var Aside: typeof Aside;
|
|
6238
|
+
var ScrollableContent: ({ children, className }: PageScrollableContentProps) => react_jsx_runtime.JSX.Element;
|
|
6218
6239
|
}
|
|
6219
6240
|
type PageHeaderProps = {
|
|
6220
6241
|
title: React__default.ReactNode;
|
|
@@ -6282,29 +6303,11 @@ type PageAsideProps = {
|
|
|
6282
6303
|
sticky?: boolean;
|
|
6283
6304
|
className?: string;
|
|
6284
6305
|
};
|
|
6285
|
-
declare function Aside
|
|
6306
|
+
declare function Aside({ children, sticky, className }: PageAsideProps): react_jsx_runtime.JSX.Element;
|
|
6286
6307
|
type PageScrollableContentProps = {
|
|
6287
6308
|
children: React__default.ReactNode;
|
|
6288
6309
|
className?: string;
|
|
6289
6310
|
};
|
|
6290
|
-
/**
|
|
6291
|
-
* ScrollableContent
|
|
6292
|
-
*
|
|
6293
|
-
* Helper component for creating scrollable content areas within PageLayout.
|
|
6294
|
-
* Commonly used with sticky headers and controls for data-heavy pages.
|
|
6295
|
-
*
|
|
6296
|
-
* Example usage:
|
|
6297
|
-
* ```tsx
|
|
6298
|
-
* <PageLayout className="flex flex-col h-screen">
|
|
6299
|
-
* <PageLayout.Header sticky={true} />
|
|
6300
|
-
* <DataControls sticky={true} stickyTop="120px" />
|
|
6301
|
-
* <PageLayout.ScrollableContent>
|
|
6302
|
-
* <DataTable data={data} columns={columns} />
|
|
6303
|
-
* </PageLayout.ScrollableContent>
|
|
6304
|
-
* </PageLayout>
|
|
6305
|
-
* ```
|
|
6306
|
-
*/
|
|
6307
|
-
declare function ScrollableContent({ children, className }: PageScrollableContentProps): react_jsx_runtime.JSX.Element;
|
|
6308
6311
|
|
|
6309
6312
|
interface Place {
|
|
6310
6313
|
id: string;
|
|
@@ -6964,11 +6967,9 @@ interface SplitPanePanelProps {
|
|
|
6964
6967
|
}
|
|
6965
6968
|
declare function SplitPane({ asideWidth, asideHeight, minAsideWidth, minAsideHeight, minMainWidth, minMainHeight, orientation, resizable, onAsideResize, onResizeStart, onResizeEnd, className, dividerClassName, children, }: SplitPaneProps): react_jsx_runtime.JSX.Element;
|
|
6966
6969
|
declare namespace SplitPane {
|
|
6967
|
-
var Main:
|
|
6968
|
-
var Aside:
|
|
6970
|
+
var Main: ({ className, children }: SplitPanePanelProps) => react_jsx_runtime.JSX.Element;
|
|
6971
|
+
var Aside: ({ className, children }: SplitPanePanelProps) => react_jsx_runtime.JSX.Element;
|
|
6969
6972
|
}
|
|
6970
|
-
declare function Main({ className, children }: SplitPanePanelProps): react_jsx_runtime.JSX.Element;
|
|
6971
|
-
declare function Aside({ className, children }: SplitPanePanelProps): react_jsx_runtime.JSX.Element;
|
|
6972
6973
|
|
|
6973
6974
|
/**
|
|
6974
6975
|
* StatList — Compact key-value statistics display
|
|
@@ -7292,6 +7293,42 @@ declare namespace Tray {
|
|
|
7292
7293
|
var displayName: string;
|
|
7293
7294
|
}
|
|
7294
7295
|
|
|
7296
|
+
interface UseTileWindowArgs {
|
|
7297
|
+
fetchTile: FetchTile;
|
|
7298
|
+
ladder: ResolutionLadder;
|
|
7299
|
+
nativeMs: number;
|
|
7300
|
+
/** Caller-owned camera. The window re-tiles as this changes. */
|
|
7301
|
+
viewport: Viewport;
|
|
7302
|
+
widthPx: number;
|
|
7303
|
+
maxFutureMs?: number;
|
|
7304
|
+
targetPointsPerPx?: number;
|
|
7305
|
+
concurrency?: number;
|
|
7306
|
+
/**
|
|
7307
|
+
* Approximate backend row multiplier for one bucket, used by the cost guard.
|
|
7308
|
+
* Defaults to the voltage envelope's three fetched series (avg/min/max) to
|
|
7309
|
+
* preserve the current behaviour; a single-series source can pass 1.
|
|
7310
|
+
*/
|
|
7311
|
+
tileCostSeriesCount?: number;
|
|
7312
|
+
/** Changing this aborts in-flight fetches and clears the store (e.g. a new meter). */
|
|
7313
|
+
resetKey?: string;
|
|
7314
|
+
}
|
|
7315
|
+
interface UseTileWindowResult {
|
|
7316
|
+
tier: Tier;
|
|
7317
|
+
series: AssembledSeries;
|
|
7318
|
+
loading: boolean;
|
|
7319
|
+
atDataStart: boolean;
|
|
7320
|
+
}
|
|
7321
|
+
interface UseTiledTimeSeriesArgs extends Omit<UseTileWindowArgs, "viewport"> {
|
|
7322
|
+
initialViewport: Viewport;
|
|
7323
|
+
}
|
|
7324
|
+
interface UseTiledTimeSeriesResult extends UseTileWindowResult {
|
|
7325
|
+
viewport: Viewport;
|
|
7326
|
+
onViewportChange(v: Viewport): void;
|
|
7327
|
+
jumpTo(w: Viewport): void;
|
|
7328
|
+
}
|
|
7329
|
+
declare function useTileWindow(args: UseTileWindowArgs): UseTileWindowResult;
|
|
7330
|
+
declare function useTiledTimeSeries(args: UseTiledTimeSeriesArgs): UseTiledTimeSeriesResult;
|
|
7331
|
+
|
|
7295
7332
|
/**
|
|
7296
7333
|
* CSS variable overrides for white-labeling.
|
|
7297
7334
|
*
|
|
@@ -7430,4 +7467,4 @@ declare function getStateTone(state: DeviceState): StatTone;
|
|
|
7430
7467
|
*/
|
|
7431
7468
|
type LinkComponentType = React.ComponentType<any>;
|
|
7432
7469
|
|
|
7433
|
-
export { type Action, ActionCell, type ActionCellProps, ActivityFeed, ActivityFeedGroup, type ActivityFeedGroupProps, type ActivityFeedProps, type ActivityFeedSize, type ActivityFeedVariant, ActivityItem, type ActivityItemProps, type ActivityItemSurface, type ActivityItemTone, Alert, type AlertProps, type ApplyDataOperationsOptions, type ApplyDataOperationsResult, AreaSeries, type AssembleSeriesArgs, type AssembledSeries, AutoMobileRenderer, BREAKPOINTS, BadgeCell, type BadgeCellProps, BadgeProps, Banner, type BannerAction, type BannerAppearance, type BannerProps, type BannerVariant, BarSeries, BaseDataPoint, BaseInputProps, BooleanCell, type BooleanCellProps, BooleanFormat, BrandProvider, type BrandProviderProps, type BrandVariables, BreadcrumbItem, type BreadcrumbItemProps, Breadcrumbs, type Breakpoint, type BreakpointState, Calendar, Card, CardContent, type CardContentProps, CardFooter, type CardFooterProps, CardHeader, type CardHeaderProps, CardMedia, type CardMediaProps, CardMobileRenderer, type CardProps, type CardVariant, CarouselAutoplayTrigger, CarouselControl, type CarouselControlProps, CarouselIndicator, CarouselIndicatorGroup, type CarouselIndicatorProps, CarouselItem, CarouselItemGroup, type CarouselItemGroupProps, type CarouselItemProps, CarouselNextTrigger, CarouselPrevTrigger, CarouselProgressText, CarouselRoot, type CarouselRootProps, type CarouselTriggerProps, CategoryBarChart, type CategoryDataPoint as CategoryBarChartDataPoint, type CategoryBarChartProps, type CategoryDataPoint, type CellAlignment, type CellComponent, type CellComponentProps, type CellContext, type CellEmphasis, ChartAxis, ChartBottomBar, ChartContainer, ChartEventMarkers, type ChartEventMarkersProps, ChartEventSpans, type ChartEventSpansProps, type ChartExportMetadata, ChartTooltip, Chip, ChipInputField, type ChipInputFieldProps, Collapse, CollapseContent, type CollapseContentProps, type CollapseDensity, CollapseHeader, type CollapseHeaderProps, CollapseItem, type CollapseItemProps, type CollapseProps, type CollapseVariant, ColorModeProvider, type Column, CommandPalette, type CommandPaletteProps, ComponentFormatter, Confirm, type ConfirmProps, ConnectionStatusBadge, type ConnectionStatusBadgeProps, ContactCard, type ContactCardProps, ContactMetaCell, ContactMetaDisplay, type ContactMetaDisplayProps, CopyToClipboard, type Coverage, CurrencyFormat, CurrentFormat, CustomCell, type CustomCellProps, CustomPinsSpec, DataControls, type Filter as DataControlsFilter, type DataControlsProps, type SortOption as DataControlsSortOption, DataTable, type DataTableProps, DateCell, type DateCellProps, DateFormat, DateRangePicker, DeviceHealthBadge, type DeviceHealthBadgeProps, DeviceMetaCell, type DeviceMetaCellProps, DeviceMetaDisplay, type DeviceMetaDisplayProps, DeviceState, DeviceStateBadge, type DeviceStateBadgeProps, DeviceStateCell, type DeviceStateCellProps, DeviceStateWithMetric, type DeviceStateWithMetricProps, type DeviceType, DeviceTypeIcon, type DeviceTypeIconProps, DialogAction, DialogFooterConfig, DialogHeader, DialogHeaderConfig, type DialogHeaderProps, DistanceFormat, type ElementSize, EmptyState, type EmptyStateAction, type EmptyStateAlignment, type EmptyStateProps, type EmptyStateSize, EnergyFormat, EnergyUnit, type EnrollmentStatus, EnrollmentStatusBadge, type EnrollmentStatusBadgeProps, ErrorBoundary, type EventMarker, type EventMarkerType, type EventSpan, type ExportType, type FacetConfig, type FacetCounts, type FacetType, type FetchTile, FieldFormat, FieldValue, type FilterChip, FilterChips, type FilterChipsProps, type FilterCondition, FilterDialog, type FilterDialogProps, type FilterGroup, type FilterOperator, type FilterState, FirmwareVersionBadge, type FirmwareVersionBadgeProps, Form, FormatRegistry, FormattedCell, FormattedValue, FormatterFunction, FunnelSeries, type FunnelSeriesProps, type FunnelStage as FunnelSeriesStage, GeoJsonLayerSpec, GlobalSearch, type GlobalSearchProps, Grid, type GridAlign, type GridCols, type GridFlow, type GridGap, type GridItemProps, type GridJustify, type GridProps, type GridSpan, GridState, GridStateBadge, type GridStateBadgeProps, type HealthStatus, HierarchyExplorer, type HierarchyExplorerProps, type HierarchyNode, HorizontalBarCell, type HorizontalBarCellProps, HoverCard, type HoverCardContentProps, type HoverCardRootProps, Icon$1 as Icon, IconName$2 as IconName, InfiniteScrollIndicator, type InfiniteScrollIndicatorProps, Kpi, KpiGroup, type KpiGroupAlign, type KpiGroupCols, type KpiGroupGap, type KpiGroupProps, type KpiOrientation, type KpiProps, type KpiSize, type KpiStatus, LayerSpec, LineSeries, type LinkBehavior, type LinkComponentType, List, ListBox, ListBoxItem, ListItem, type ListItemProps, ListPane, type ListPaneProps, type ListProps, type LoadingState, MiniBarCell, type MiniBarCellProps, type MobileBreakpoint, type MobileConfig, type MobileRenderer, ModalBackdrop, type ModalBackdropProps, type NodeState, Notice, NoticeContainer, type NoticeContainerProps, type NoticeOptions, type NoticeProps, NoticeProvider, type NoticeProviderProps, type NoticeVariant, NumberCell, type NumberCellProps, NumberFormat, type PageAsideProps, PageBanner, type PageBannerProps, type PageBreadcrumbItem, type PageContentProps, type PageHeaderProps, PageLayout, type PageLayoutProps, type PageScrollableContentProps, PercentBarCell, type PercentBarCellProps, PhoneFormat, type Place, PlaceSearch, type PlaceSearchProps, Popover, PowerFormat, type PresetRange, ProgressBar, Prose, type ProseProps, type ProseSize, type ProseTone, RangeCalendar, RasterLayerSpec, type RegisterPhosphorIconOptions, ResistanceFormat, type ResolutionLadder, type ResponsiveValue, ResultsCount, type ResultsCountProps, SKELETON_SIZES, SOURCE_UNIT_TO_WH, type SearchConfig, SearchControl, type SearchControlProps, SearchEmptyState, type SearchEmptyStateProps, SearchLoadingState, type SearchLoadingStateProps, SearchResultGroup, type SearchResultGroupProps, SearchResultItem, type SearchResultItemProps, SearchResultsList, type SearchResultsListProps, SearchTrigger, type SearchTriggerProps, Section, SectionNav, type SectionNavItem, type SectionNavOrientation, type SectionNavProps, type SectionProps, type SectionSpacing, type SectionVariant, SelectCell, type SelectCellProps, SiteCard, type SiteCardProps, SiteContactCard, type SiteContactCardProps, SiteMetaCell, SiteMetaDisplay, type SiteMetaDisplayProps, Skeleton, Slider, type SortConfig, SortControl, type SortControlProps, type SortDirection, type SortState, SparklineCell, type SparklineCellProps, SplitPane, type SplitPaneOrientation, type SplitPanePanelProps, type SplitPaneProps, type StatAlign, type StatFormatter, type StatItem, type StatLayout, StatList, type StatListProps, type StatThreshold, type StatTone$1 as StatTone, type StatValue, Tab, TabList, TabPanel, type TableDensity, type TableExportMetadata, type TableExportOptions, type TableLayout, type TableWidth, Tabs, type TabsProps$1 as TabsProps, TemperatureFormat, TemperatureUnit, TemperatureUnitString, TextAreaWithChips, TextCell, type TextCellProps, TextFormat, type Tier, type TileAction, type TileData, type TileEntry, type TileRef, type TileStatus, type TileStore, TiledTimeSeriesChart, type TiledTimeSeriesChartProps, type TiledTimeSeriesChartViewport, TiledTimeSeriesExplorer, type TiledTimeSeriesExplorerProps, type TiledTimeSeriesSource, TimeControls, type TimeControlsProps, type TimeRange, Timeline, TimelineItem, type TimelineItemProps, type TimelineItemVariant, ToggleButton, Tooltip, TooltipData, Tray, type TrayProps, type TrendPoint, type TypographyRole, type UseBreakpointReturn, type UseClientDataControlsOptions, type UseClientDataControlsResult, type UseDataControlsClientOptions, type UseDataControlsOptions, type UseDataControlsResult, type UseDataControlsServerOptions, type UseElementSizeResult, type UseInfiniteScrollOptions, type UseInfiniteScrollReturn, type UseServerDataControlsOptions, type UseTableExportOptions, type UseTableExportReturn, type UseTiledTimeSeriesArgs, type UseTiledTimeSeriesResult, VectorLayerSpec, type Viewport, VoltageFormat, type WindowSize, type WindowSizeOption, YFormatType, addFilterCondition, applyDataOperations, assembleSeries, autoScaleCurrent, autoScaleDistance, autoScaleEnergy, autoScalePower, autoScaleResistance, autoScaleVoltage, camelCaseToWords, capitalize, celsiusToFahrenheit, celsiusToKelvin, centimetersToInches, createEmptyFilter, createFilter, createFilters, createFormat, createTextureIcon, csvUnitFor, csvValueFor, emptyStore, enumToSentenceCase, exportChart, exportTableAsCSV, fahrenheitToCelsius, fahrenheitToKelvin, feetToMeters, feetToMiles, filterToChips, formatBoolean, formatCapacity, formatCurrency, formatCurrent, formatDate, formatDistance, formatEmptyValue, formatEnergy, formatFieldValue, formatInternationalPhone, formatNumber, formatPercent, formatPhone, formatPhoneNumber, formatPower, formatPowerRating, formatResistance, formatTemperature, formatText, formatUSPhone, formatVoltage, getBadgeClasses, getBooleanBadgeVariant, getCellAlignmentClasses, getCellContainerClasses, getCellTextClasses, getDateParts, getEventColor, getExportFormatName, getExportHeaders, getFilterFields, getLinkClasses, getNumericColorClasses, getSkeletonSize, getStateTone, inchesToCentimeters, isCustomPinsLayer, isExportSupported, isFilterEmpty, isGeoJsonLayer, isNil, isRasterLayer, isVectorLayer, kelvinToCelsius, kelvinToFahrenheit, kilometersToMiles, layer, metersToFeet, metersToMiles, metersToYards, milesToFeet, milesToKilometers, milesToMeters, parseBoolean, pickEnergyUnit, prepareTableDataForExport, registerPhosphorIcon, removeFilterCondition, resolveValue, snakeCaseToWords, temperatureStringToSymbol, tierForViewport, tileIndexAt, tileKey, tileReducer, tilesForViewport, toA, toActiveInactive, toAmps, toBoolean, toCelsius, toCentimeters, toCheckmark, toCompactNumber, toCurrency, toCustomDateFormat, toDateString, toEnabledDisabled, toFahrenheit, toFeet, toFloat, toFormattedNumber, toFullDateTime, toGW, toGWh, toGigawatts, toISOString, toInches, toInteger, toKA, toKV, toKW, toKelvin, toKiloamps, toKilohms, toKilometers, toKilovolts, toKilowatts, toLowerCase, toMA, toMV, toMW, toMWh, toMegawatts, toMegohms, toMeters, toMiles, toMilliamps, toMillimeters, toMilliohms, toMillivolts, toNauticalMiles, toOhms, toOnOff, toPercentage, toRelativeTime, toScientificNotation, toSecret, toSentenceCase, toTemperature, toTitleCase, toTrueFalse, toUpperCase, toV, toVolts, toW, toWatts, toWh, toYards, tokWh, truncateEnd, truncateMiddle, truncateStart, typeRole, typographyRole, ucFirst, useBreakpoint, useClientDataControls, useColorMode, useDataControls, useDebounce, useElementSize, useInfiniteScroll, useLocalStorage, useMediaQuery, useNotice, useServerDataControls, useTableExport, useTiledTimeSeries, wrapWithLink, yardsToMeters };
|
|
7470
|
+
export { type Action, ActionCell, type ActionCellProps, ActivityFeed, ActivityFeedGroup, type ActivityFeedGroupProps, type ActivityFeedProps, type ActivityFeedSize, type ActivityFeedVariant, ActivityItem, type ActivityItemProps, type ActivityItemSurface, type ActivityItemTone, Alert, type AlertProps, type ApplyDataOperationsOptions, type ApplyDataOperationsResult, AreaSeries, type AssembleSeriesArgs, type AssembledSeries, AutoMobileRenderer, BREAKPOINTS, BadgeCell, type BadgeCellProps, BadgeProps, Banner, type BannerAction, type BannerAppearance, type BannerProps, type BannerVariant, BarSeries, BaseDataPoint, BaseInputProps, BooleanCell, type BooleanCellProps, BooleanFormat, BrandProvider, type BrandProviderProps, type BrandVariables, BreadcrumbItem, type BreadcrumbItemProps, Breadcrumbs, type Breakpoint, type BreakpointState, Calendar, Card, CardContent, type CardContentProps, CardFooter, type CardFooterProps, CardHeader, type CardHeaderProps, CardMedia, type CardMediaProps, CardMobileRenderer, type CardProps, type CardVariant, CarouselAutoplayTrigger, CarouselControl, type CarouselControlProps, CarouselIndicator, CarouselIndicatorGroup, type CarouselIndicatorProps, CarouselItem, CarouselItemGroup, type CarouselItemGroupProps, type CarouselItemProps, CarouselNextTrigger, CarouselPrevTrigger, CarouselProgressText, CarouselRoot, type CarouselRootProps, type CarouselTriggerProps, CategoryBarChart, type CategoryDataPoint as CategoryBarChartDataPoint, type CategoryBarChartProps, type CategoryDataPoint, type CellAlignment, type CellComponent, type CellComponentProps, type CellContext, type CellEmphasis, ChartAxis, ChartBottomBar, ChartContainer, ChartEventMarkers, type ChartEventMarkersProps, ChartEventSpans, type ChartEventSpansProps, type ChartExportMetadata, ChartTooltip, Chip, ChipInputField, type ChipInputFieldProps, Collapse, CollapseContent, type CollapseContentProps, type CollapseDensity, CollapseHeader, type CollapseHeaderProps, CollapseItem, type CollapseItemProps, type CollapseProps, type CollapseVariant, ColorModeProvider, type Column, CommandPalette, type CommandPaletteProps, ComponentFormatter, Confirm, type ConfirmProps, ConnectionStatusBadge, type ConnectionStatusBadgeProps, ContactCard, type ContactCardProps, ContactMetaCell, ContactMetaDisplay, type ContactMetaDisplayProps, ContainerQueryProvider, CopyToClipboard, type Coverage, CurrencyFormat, CurrentFormat, CustomCell, type CustomCellProps, CustomPinsSpec, DataControls, type Filter as DataControlsFilter, type DataControlsProps, type SortOption as DataControlsSortOption, DataTable, type DataTableProps, DateCell, type DateCellProps, DateFormat, DateRangePicker, DeviceHealthBadge, type DeviceHealthBadgeProps, DeviceMetaCell, type DeviceMetaCellProps, DeviceMetaDisplay, type DeviceMetaDisplayProps, DeviceState, DeviceStateBadge, type DeviceStateBadgeProps, DeviceStateCell, type DeviceStateCellProps, DeviceStateWithMetric, type DeviceStateWithMetricProps, type DeviceType, DeviceTypeIcon, type DeviceTypeIconProps, DialogAction, DialogFooterConfig, DialogHeader, DialogHeaderConfig, type DialogHeaderProps, DistanceFormat, type ElementSize, EmptyState, type EmptyStateAction, type EmptyStateAlignment, type EmptyStateProps, type EmptyStateSize, EnergyFormat, EnergyUnit, type EnrollmentStatus, EnrollmentStatusBadge, type EnrollmentStatusBadgeProps, ErrorBoundary, type EventMarker, type EventMarkerType, type EventSpan, type ExportType, type FacetConfig, type FacetCounts, type FacetType, type FetchTile, FieldFormat, FieldValue, type FilterChip, FilterChips, type FilterChipsProps, type FilterCondition, FilterDialog, type FilterDialogProps, type FilterGroup, type FilterOperator, type FilterState, FirmwareVersionBadge, type FirmwareVersionBadgeProps, Form, FormatRegistry, FormattedCell, FormattedValue, FormatterFunction, FunnelSeries, type FunnelSeriesProps, type FunnelStage as FunnelSeriesStage, GeoJsonLayerSpec, GlobalSearch, type GlobalSearchProps, Grid, type GridAlign, type GridCols, type GridFlow, type GridGap, type GridItemProps, type GridJustify, type GridProps, type GridSpan, GridState, GridStateBadge, type GridStateBadgeProps, type HealthStatus, HierarchyExplorer, type HierarchyExplorerProps, type HierarchyNode, HorizontalBarCell, type HorizontalBarCellProps, HoverCard, type HoverCardContentProps, type HoverCardRootProps, Icon$1 as Icon, IconName$2 as IconName, InfiniteScrollIndicator, type InfiniteScrollIndicatorProps, Kpi, KpiGroup, type KpiGroupAlign, type KpiGroupCols, type KpiGroupGap, type KpiGroupProps, type KpiOrientation, type KpiProps, type KpiSize, type KpiStatus, LayerSpec, LineSeries, type LinkBehavior, type LinkComponentType, List, ListBox, ListBoxItem, ListItem, type ListItemProps, ListPane, type ListPaneProps, type ListProps, type LoadingState, MiniBarCell, type MiniBarCellProps, type MobileBreakpoint, type MobileConfig, type MobileRenderer, ModalBackdrop, type ModalBackdropProps, type NodeState, Notice, NoticeContainer, type NoticeContainerProps, type NoticeOptions, type NoticeProps, NoticeProvider, type NoticeProviderProps, type NoticeVariant, NumberCell, type NumberCellProps, NumberFormat, type PageAsideProps, PageBanner, type PageBannerProps, type PageBreadcrumbItem, type PageContentProps, type PageHeaderProps, PageLayout, type PageLayoutProps, type PageScrollableContentProps, PercentBarCell, type PercentBarCellProps, PhoneFormat, type Place, PlaceSearch, type PlaceSearchProps, Popover, PowerFormat, type PresetRange, ProgressBar, Prose, type ProseProps, type ProseSize, type ProseTone, RangeCalendar, RasterLayerSpec, type RegisterPhosphorIconOptions, ResistanceFormat, type ResolutionLadder, type ResponsiveValue, ResultsCount, type ResultsCountProps, SKELETON_SIZES, SOURCE_UNIT_TO_WH, type SearchConfig, SearchControl, type SearchControlProps, SearchEmptyState, type SearchEmptyStateProps, SearchLoadingState, type SearchLoadingStateProps, SearchResultGroup, type SearchResultGroupProps, SearchResultItem, type SearchResultItemProps, SearchResultsList, type SearchResultsListProps, SearchTrigger, type SearchTriggerProps, Section, SectionNav, type SectionNavItem, type SectionNavOrientation, type SectionNavProps, type SectionProps, type SectionSpacing, type SectionVariant, SelectCell, type SelectCellProps, SiteCard, type SiteCardProps, SiteContactCard, type SiteContactCardProps, SiteMetaCell, SiteMetaDisplay, type SiteMetaDisplayProps, Skeleton, Slider, type SortConfig, SortControl, type SortControlProps, type SortDirection, type SortState, SparklineCell, type SparklineCellProps, SplitPane, type SplitPaneOrientation, type SplitPanePanelProps, type SplitPaneProps, type StatAlign, type StatFormatter, type StatItem, type StatLayout, StatList, type StatListProps, type StatThreshold, type StatTone$1 as StatTone, type StatValue, Tab, TabList, TabPanel, type TableDensity, type TableExportMetadata, type TableExportOptions, type TableLayout, type TableWidth, Tabs, type TabsProps$1 as TabsProps, TemperatureFormat, TemperatureUnit, TemperatureUnitString, TextAreaWithChips, TextCell, type TextCellProps, TextFormat, type Tier, type TileAction, type TileData, type TileEntry, type TileRef, type TileStatus, type TileStore, type TiledCameraPreviewDomain, type TiledCameraSyncGroup, TiledTimeSeriesChart, type TiledTimeSeriesChartProps, type TiledTimeSeriesChartViewport, TiledTimeSeriesExplorer, type TiledTimeSeriesExplorerProps, type TiledTimeSeriesSource, TimeControls, type TimeControlsProps, type TimeRange, Timeline, TimelineItem, type TimelineItemProps, type TimelineItemVariant, ToggleButton, Tooltip, TooltipData, Tray, type TrayProps, type TrendPoint, type TypographyRole, type UseBreakpointReturn, type UseClientDataControlsOptions, type UseClientDataControlsResult, type UseDataControlsClientOptions, type UseDataControlsOptions, type UseDataControlsResult, type UseDataControlsServerOptions, type UseElementSizeResult, type UseInfiniteScrollOptions, type UseInfiniteScrollReturn, type UseServerDataControlsOptions, type UseTableExportOptions, type UseTableExportReturn, type UseTileWindowArgs, type UseTileWindowResult, type UseTiledTimeSeriesArgs, type UseTiledTimeSeriesResult, VectorLayerSpec, type Viewport, VoltageFormat, type WindowSize, type WindowSizeOption, YFormatType, addFilterCondition, applyDataOperations, assembleSeries, autoScaleCurrent, autoScaleDistance, autoScaleEnergy, autoScalePower, autoScaleResistance, autoScaleVoltage, camelCaseToWords, capitalize, celsiusToFahrenheit, celsiusToKelvin, centimetersToInches, createEmptyFilter, createFilter, createFilters, createFormat, createTextureIcon, createTiledCameraSyncGroup, csvUnitFor, csvValueFor, emptyStore, enumToSentenceCase, exportChart, exportTableAsCSV, fahrenheitToCelsius, fahrenheitToKelvin, feetToMeters, feetToMiles, filterToChips, formatBoolean, formatCapacity, formatCurrency, formatCurrent, formatDate, formatDistance, formatEmptyValue, formatEnergy, formatFieldValue, formatInternationalPhone, formatNumber, formatPercent, formatPhone, formatPhoneNumber, formatPower, formatPowerRating, formatResistance, formatTemperature, formatText, formatUSPhone, formatVoltage, getBadgeClasses, getBooleanBadgeVariant, getCellAlignmentClasses, getCellContainerClasses, getCellTextClasses, getDateParts, getEventColor, getExportFormatName, getExportHeaders, getFilterFields, getLinkClasses, getNumericColorClasses, getSkeletonSize, getStateTone, inchesToCentimeters, isCustomPinsLayer, isExportSupported, isFilterEmpty, isGeoJsonLayer, isNil, isRasterLayer, isVectorLayer, kelvinToCelsius, kelvinToFahrenheit, kilometersToMiles, layer, metersToFeet, metersToMiles, metersToYards, milesToFeet, milesToKilometers, milesToMeters, parseBoolean, pickEnergyUnit, prepareTableDataForExport, registerPhosphorIcon, removeFilterCondition, resolveValue, snakeCaseToWords, temperatureStringToSymbol, tierForViewport, tileIndexAt, tileKey, tileReducer, tilesForViewport, toA, toActiveInactive, toAmps, toBoolean, toCelsius, toCentimeters, toCheckmark, toCompactNumber, toCurrency, toCustomDateFormat, toDateString, toEnabledDisabled, toFahrenheit, toFeet, toFloat, toFormattedNumber, toFullDateTime, toGW, toGWh, toGigawatts, toISOString, toInches, toInteger, toKA, toKV, toKW, toKelvin, toKiloamps, toKilohms, toKilometers, toKilovolts, toKilowatts, toLowerCase, toMA, toMV, toMW, toMWh, toMegawatts, toMegohms, toMeters, toMiles, toMilliamps, toMillimeters, toMilliohms, toMillivolts, toNauticalMiles, toOhms, toOnOff, toPercentage, toRelativeTime, toScientificNotation, toSecret, toSentenceCase, toTemperature, toTitleCase, toTrueFalse, toUpperCase, toV, toVolts, toW, toWatts, toWh, toYards, tokWh, truncateEnd, truncateMiddle, truncateStart, typeRole, typographyRole, ucFirst, useBreakpoint, useClientDataControls, useColorMode, useContainerBreakpoint, useDataControls, useDebounce, useElementSize, useInfiniteScroll, useLocalStorage, useMediaQuery, useNotice, useServerDataControls, useTableExport, useTileWindow, useTiledTimeSeries, wrapWithLink, yardsToMeters };
|