@richardmcquiston01/dashboard-widgets-toolkit 0.13.0 → 0.15.0

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/react.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { ReactNode, RefObject } from 'react';
2
- import { D as DashboardWidget, W as WidgetSize, a as WidgetFill, G as GraphWidgetData, N as NiceDomain, b as WidgetDefinition, c as DetailProviderOptions, d as DetailData, e as DetailQuery, O as OptionValues, L as Locale, f as DashboardLayout, A as AlertListWidgetData, B as BarListWidgetData, g as GaugeWidgetData, K as KpiWidgetData, T as TableWidgetData, R as ResolvedTableControls, h as DetailSort, i as TextWidgetData, j as WidgetData, k as LayoutPersistence, S as StoreScope, P as PageItem, l as NormalizeOptions, m as ResolveOptions, n as WidgetContext, o as WidgetProviders } from './storage-DNB7gjvT.cjs';
1
+ import { ReactNode, ReactElement, RefObject } from 'react';
2
+ import { D as DashboardWidget, W as WidgetSize, a as WidgetFill, G as GraphWidgetData, N as NiceDomain, b as WidgetDefinition, c as DetailProviderOptions, d as DetailData, e as DetailQuery, O as OptionValues, L as Locale, f as DashboardLayout, g as WidgetViewerSettings, h as WidgetSettingsPatch, A as AlertListWidgetData, B as BarListWidgetData, i as GaugeWidgetData, K as KpiWidgetData, T as TableWidgetData, R as ResolvedTableControls, j as DetailSort, k as TextWidgetData, l as WidgetData, m as LayoutPersistence, S as StoreScope, P as PageItem, n as NormalizeOptions, o as ResolveOptions, p as WidgetContext, q as WidgetProviders } from './storage-DwJ-vGJg.cjs';
3
3
 
4
4
  interface WidgetCardProps {
5
5
  readonly title: string;
@@ -154,7 +154,7 @@ declare function useDetailData(definition: WidgetDefinition, load: DetailLoader
154
154
  };
155
155
 
156
156
  /** Every element that carries a stable `dwt-*` class, for `classNames`. */
157
- type DashboardClassSlot = 'dashboard' | 'hiddenBar' | 'toolbar' | 'pageBar' | 'grid' | 'card' | 'cardHeader' | 'cardTitle' | 'cardDescription' | 'cardActions' | 'cardBody' | 'cardFooter' | 'button' | 'status' | 'empty' | 'error' | 'text' | 'kpi' | 'gauge' | 'table' | 'barList' | 'alertList' | 'chart' | 'legend' | 'tooltip' | 'tableTwin' | 'detail';
157
+ type DashboardClassSlot = 'dashboard' | 'hiddenBar' | 'toolbar' | 'pageBar' | 'grid' | 'card' | 'cardHeader' | 'cardTitle' | 'cardDescription' | 'cardActions' | 'cardBody' | 'cardFooter' | 'button' | 'status' | 'empty' | 'error' | 'text' | 'kpi' | 'gauge' | 'table' | 'barList' | 'alertList' | 'chart' | 'legend' | 'tooltip' | 'tableTwin' | 'detail' | 'dialog';
158
158
  /**
159
159
  * Extra classes per slot, appended to the `dwt-*` class (never replacing
160
160
  * it), e.g. `{ card: 'rounded-lg shadow-sm' }` for Tailwind.
@@ -214,6 +214,38 @@ interface DashboardLabels {
214
214
  readonly menuMoveEarlier: string;
215
215
  readonly menuMoveLater: string;
216
216
  readonly menuHide: string;
217
+ /** The card menu's item that opens the Options dialog. */
218
+ readonly menuOptions: string;
219
+ /** The Options dialog: heading, fields and buttons. */
220
+ readonly optionsFor: (title: string) => string;
221
+ readonly optionsTitleField: string;
222
+ readonly titleInUse: string;
223
+ readonly optionsWidthField: string;
224
+ readonly widthDefault: string;
225
+ /** e.g. "6 of 12 (1/2)". */
226
+ readonly widthOption: (width: number, share: string) => string;
227
+ readonly optionsFlexible: string;
228
+ /** Label of the View field in the Options dialog. */
229
+ readonly optionsViewField: string;
230
+ /** A view's name when it is the one shown until the viewer picks, e.g. "Table (default)". */
231
+ readonly viewDefault: (viewLabel: string) => string;
232
+ readonly optionsDeclared: string;
233
+ readonly apply: string;
234
+ readonly cancel: string;
235
+ readonly resetToDefaults: string;
236
+ readonly revertToBeforeEditing: string;
237
+ readonly confirmApply: string;
238
+ readonly confirmDiscard: string;
239
+ readonly confirmResetOptions: string;
240
+ readonly confirmRevertOptions: string;
241
+ /** Announced after Apply, Reset or Revert. */
242
+ readonly optionsSaved: (title: string) => string;
243
+ readonly sortDefault: string;
244
+ readonly sortAscending: string;
245
+ readonly sortDescending: string;
246
+ readonly moveColumnUp: (column: string) => string;
247
+ readonly moveColumnDown: (column: string) => string;
248
+ readonly customRange: (value: string) => string;
217
249
  /** The card menu's heading over the pages a widget can move to. */
218
250
  readonly moveToPage: (title: string) => string;
219
251
  readonly moveToPagePlaceholder: string;
@@ -346,6 +378,27 @@ interface DashboardProps extends WidgetSettings {
346
378
  */
347
379
  declare function Dashboard({ locale, linkTarget, classNames, labels, ...props }: DashboardProps): ReactNode;
348
380
 
381
+ interface WidgetOptionsDialogProps {
382
+ /** The author's definition, before the viewer's settings. */
383
+ readonly definition: WidgetDefinition;
384
+ /** What the viewer has saved for this widget. */
385
+ readonly settings: WidgetViewerSettings | undefined;
386
+ /**
387
+ * What they had when editing began, for "Revert to before editing". Leave it
388
+ * out to hide that button. `settings` may be `undefined` inside it, which
389
+ * means they had chosen nothing.
390
+ */
391
+ readonly baseline?: {
392
+ readonly settings: WidgetViewerSettings | undefined;
393
+ };
394
+ /** Whether another widget already shows this title; the dialog refuses it. */
395
+ readonly isTitleInUse?: (title: string) => boolean;
396
+ /** Called after the viewer confirms Apply, Reset or Revert. */
397
+ readonly onApply: (patch: WidgetSettingsPatch) => void;
398
+ readonly onClose: () => void;
399
+ }
400
+ declare function WidgetOptionsDialog({ definition, settings, baseline, isTitleInUse, onApply, onClose, }: WidgetOptionsDialogProps): ReactElement;
401
+
349
402
  /**
350
403
  * Default colors, used as `var(--dwt-*, fallback)` so charts read correctly
351
404
  * without the stylesheet. `styles.css` redefines them for dark mode, and an
@@ -520,4 +573,4 @@ interface UseWidgetsResult {
520
573
  */
521
574
  declare function useWidgets<C extends WidgetContext>(definitions: readonly WidgetDefinition[], providers: WidgetProviders<C>, context: C, options?: UseWidgetsOptions): UseWidgetsResult;
522
575
 
523
- export { AlertListWidget, BarListWidget, DEFAULT_LABELS, DEFAULT_SERIES_COLORS, Dashboard, type DashboardClassNames, type DashboardClassSlot, type DashboardLabels, type DashboardProps, type DetailLoadState, type DetailLoader, GaugeWidget, GraphWidget, KpiWidget, ResolvedWidgetCard, type ResolvedWidgetCardProps, type StoredLayoutConflict, type StoredLayoutStatus, TableWidget, TextWidget, Thumbnail, type UseStoredLayoutOptions, type UseStoredLayoutResult, type UseWidgetsOptions, type UseWidgetsResult, WidgetCard, type WidgetCardProps, WidgetContent, WidgetDetail, WidgetDetailDialog, type WidgetDetailDialogProps, type WidgetDetailProps, WidgetGrid, type WidgetGridProps, WidgetLink, type WidgetSettings, WidgetSettingsProvider, barPath, buildChartModel, describeChart, joinClassNames, seriesColor, useDetailData, useStoredLayout, useWidgetSettings, useWidgets, widgetTitle };
576
+ export { AlertListWidget, BarListWidget, DEFAULT_LABELS, DEFAULT_SERIES_COLORS, Dashboard, type DashboardClassNames, type DashboardClassSlot, type DashboardLabels, type DashboardProps, type DetailLoadState, type DetailLoader, GaugeWidget, GraphWidget, KpiWidget, ResolvedWidgetCard, type ResolvedWidgetCardProps, type StoredLayoutConflict, type StoredLayoutStatus, TableWidget, TextWidget, Thumbnail, type UseStoredLayoutOptions, type UseStoredLayoutResult, type UseWidgetsOptions, type UseWidgetsResult, WidgetCard, type WidgetCardProps, WidgetContent, WidgetDetail, WidgetDetailDialog, type WidgetDetailDialogProps, type WidgetDetailProps, WidgetGrid, type WidgetGridProps, WidgetLink, WidgetOptionsDialog, type WidgetOptionsDialogProps, type WidgetSettings, WidgetSettingsProvider, barPath, buildChartModel, describeChart, joinClassNames, seriesColor, useDetailData, useStoredLayout, useWidgetSettings, useWidgets, widgetTitle };
package/dist/react.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { ReactNode, RefObject } from 'react';
2
- import { D as DashboardWidget, W as WidgetSize, a as WidgetFill, G as GraphWidgetData, N as NiceDomain, b as WidgetDefinition, c as DetailProviderOptions, d as DetailData, e as DetailQuery, O as OptionValues, L as Locale, f as DashboardLayout, A as AlertListWidgetData, B as BarListWidgetData, g as GaugeWidgetData, K as KpiWidgetData, T as TableWidgetData, R as ResolvedTableControls, h as DetailSort, i as TextWidgetData, j as WidgetData, k as LayoutPersistence, S as StoreScope, P as PageItem, l as NormalizeOptions, m as ResolveOptions, n as WidgetContext, o as WidgetProviders } from './storage-DNB7gjvT.js';
1
+ import { ReactNode, ReactElement, RefObject } from 'react';
2
+ import { D as DashboardWidget, W as WidgetSize, a as WidgetFill, G as GraphWidgetData, N as NiceDomain, b as WidgetDefinition, c as DetailProviderOptions, d as DetailData, e as DetailQuery, O as OptionValues, L as Locale, f as DashboardLayout, g as WidgetViewerSettings, h as WidgetSettingsPatch, A as AlertListWidgetData, B as BarListWidgetData, i as GaugeWidgetData, K as KpiWidgetData, T as TableWidgetData, R as ResolvedTableControls, j as DetailSort, k as TextWidgetData, l as WidgetData, m as LayoutPersistence, S as StoreScope, P as PageItem, n as NormalizeOptions, o as ResolveOptions, p as WidgetContext, q as WidgetProviders } from './storage-DwJ-vGJg.js';
3
3
 
4
4
  interface WidgetCardProps {
5
5
  readonly title: string;
@@ -154,7 +154,7 @@ declare function useDetailData(definition: WidgetDefinition, load: DetailLoader
154
154
  };
155
155
 
156
156
  /** Every element that carries a stable `dwt-*` class, for `classNames`. */
157
- type DashboardClassSlot = 'dashboard' | 'hiddenBar' | 'toolbar' | 'pageBar' | 'grid' | 'card' | 'cardHeader' | 'cardTitle' | 'cardDescription' | 'cardActions' | 'cardBody' | 'cardFooter' | 'button' | 'status' | 'empty' | 'error' | 'text' | 'kpi' | 'gauge' | 'table' | 'barList' | 'alertList' | 'chart' | 'legend' | 'tooltip' | 'tableTwin' | 'detail';
157
+ type DashboardClassSlot = 'dashboard' | 'hiddenBar' | 'toolbar' | 'pageBar' | 'grid' | 'card' | 'cardHeader' | 'cardTitle' | 'cardDescription' | 'cardActions' | 'cardBody' | 'cardFooter' | 'button' | 'status' | 'empty' | 'error' | 'text' | 'kpi' | 'gauge' | 'table' | 'barList' | 'alertList' | 'chart' | 'legend' | 'tooltip' | 'tableTwin' | 'detail' | 'dialog';
158
158
  /**
159
159
  * Extra classes per slot, appended to the `dwt-*` class (never replacing
160
160
  * it), e.g. `{ card: 'rounded-lg shadow-sm' }` for Tailwind.
@@ -214,6 +214,38 @@ interface DashboardLabels {
214
214
  readonly menuMoveEarlier: string;
215
215
  readonly menuMoveLater: string;
216
216
  readonly menuHide: string;
217
+ /** The card menu's item that opens the Options dialog. */
218
+ readonly menuOptions: string;
219
+ /** The Options dialog: heading, fields and buttons. */
220
+ readonly optionsFor: (title: string) => string;
221
+ readonly optionsTitleField: string;
222
+ readonly titleInUse: string;
223
+ readonly optionsWidthField: string;
224
+ readonly widthDefault: string;
225
+ /** e.g. "6 of 12 (1/2)". */
226
+ readonly widthOption: (width: number, share: string) => string;
227
+ readonly optionsFlexible: string;
228
+ /** Label of the View field in the Options dialog. */
229
+ readonly optionsViewField: string;
230
+ /** A view's name when it is the one shown until the viewer picks, e.g. "Table (default)". */
231
+ readonly viewDefault: (viewLabel: string) => string;
232
+ readonly optionsDeclared: string;
233
+ readonly apply: string;
234
+ readonly cancel: string;
235
+ readonly resetToDefaults: string;
236
+ readonly revertToBeforeEditing: string;
237
+ readonly confirmApply: string;
238
+ readonly confirmDiscard: string;
239
+ readonly confirmResetOptions: string;
240
+ readonly confirmRevertOptions: string;
241
+ /** Announced after Apply, Reset or Revert. */
242
+ readonly optionsSaved: (title: string) => string;
243
+ readonly sortDefault: string;
244
+ readonly sortAscending: string;
245
+ readonly sortDescending: string;
246
+ readonly moveColumnUp: (column: string) => string;
247
+ readonly moveColumnDown: (column: string) => string;
248
+ readonly customRange: (value: string) => string;
217
249
  /** The card menu's heading over the pages a widget can move to. */
218
250
  readonly moveToPage: (title: string) => string;
219
251
  readonly moveToPagePlaceholder: string;
@@ -346,6 +378,27 @@ interface DashboardProps extends WidgetSettings {
346
378
  */
347
379
  declare function Dashboard({ locale, linkTarget, classNames, labels, ...props }: DashboardProps): ReactNode;
348
380
 
381
+ interface WidgetOptionsDialogProps {
382
+ /** The author's definition, before the viewer's settings. */
383
+ readonly definition: WidgetDefinition;
384
+ /** What the viewer has saved for this widget. */
385
+ readonly settings: WidgetViewerSettings | undefined;
386
+ /**
387
+ * What they had when editing began, for "Revert to before editing". Leave it
388
+ * out to hide that button. `settings` may be `undefined` inside it, which
389
+ * means they had chosen nothing.
390
+ */
391
+ readonly baseline?: {
392
+ readonly settings: WidgetViewerSettings | undefined;
393
+ };
394
+ /** Whether another widget already shows this title; the dialog refuses it. */
395
+ readonly isTitleInUse?: (title: string) => boolean;
396
+ /** Called after the viewer confirms Apply, Reset or Revert. */
397
+ readonly onApply: (patch: WidgetSettingsPatch) => void;
398
+ readonly onClose: () => void;
399
+ }
400
+ declare function WidgetOptionsDialog({ definition, settings, baseline, isTitleInUse, onApply, onClose, }: WidgetOptionsDialogProps): ReactElement;
401
+
349
402
  /**
350
403
  * Default colors, used as `var(--dwt-*, fallback)` so charts read correctly
351
404
  * without the stylesheet. `styles.css` redefines them for dark mode, and an
@@ -520,4 +573,4 @@ interface UseWidgetsResult {
520
573
  */
521
574
  declare function useWidgets<C extends WidgetContext>(definitions: readonly WidgetDefinition[], providers: WidgetProviders<C>, context: C, options?: UseWidgetsOptions): UseWidgetsResult;
522
575
 
523
- export { AlertListWidget, BarListWidget, DEFAULT_LABELS, DEFAULT_SERIES_COLORS, Dashboard, type DashboardClassNames, type DashboardClassSlot, type DashboardLabels, type DashboardProps, type DetailLoadState, type DetailLoader, GaugeWidget, GraphWidget, KpiWidget, ResolvedWidgetCard, type ResolvedWidgetCardProps, type StoredLayoutConflict, type StoredLayoutStatus, TableWidget, TextWidget, Thumbnail, type UseStoredLayoutOptions, type UseStoredLayoutResult, type UseWidgetsOptions, type UseWidgetsResult, WidgetCard, type WidgetCardProps, WidgetContent, WidgetDetail, WidgetDetailDialog, type WidgetDetailDialogProps, type WidgetDetailProps, WidgetGrid, type WidgetGridProps, WidgetLink, type WidgetSettings, WidgetSettingsProvider, barPath, buildChartModel, describeChart, joinClassNames, seriesColor, useDetailData, useStoredLayout, useWidgetSettings, useWidgets, widgetTitle };
576
+ export { AlertListWidget, BarListWidget, DEFAULT_LABELS, DEFAULT_SERIES_COLORS, Dashboard, type DashboardClassNames, type DashboardClassSlot, type DashboardLabels, type DashboardProps, type DetailLoadState, type DetailLoader, GaugeWidget, GraphWidget, KpiWidget, ResolvedWidgetCard, type ResolvedWidgetCardProps, type StoredLayoutConflict, type StoredLayoutStatus, TableWidget, TextWidget, Thumbnail, type UseStoredLayoutOptions, type UseStoredLayoutResult, type UseWidgetsOptions, type UseWidgetsResult, WidgetCard, type WidgetCardProps, WidgetContent, WidgetDetail, WidgetDetailDialog, type WidgetDetailDialogProps, type WidgetDetailProps, WidgetGrid, type WidgetGridProps, WidgetLink, WidgetOptionsDialog, type WidgetOptionsDialogProps, type WidgetSettings, WidgetSettingsProvider, barPath, buildChartModel, describeChart, joinClassNames, seriesColor, useDetailData, useStoredLayout, useWidgetSettings, useWidgets, widgetTitle };