@richardmcquiston01/dashboard-widgets-toolkit 0.12.0 → 0.14.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-VaaysVnZ.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-_Eb8Y98-.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,34 @@ 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
+ readonly optionsDeclared: string;
229
+ readonly apply: string;
230
+ readonly cancel: string;
231
+ readonly resetToDefaults: string;
232
+ readonly revertToBeforeEditing: string;
233
+ readonly confirmApply: string;
234
+ readonly confirmDiscard: string;
235
+ readonly confirmResetOptions: string;
236
+ readonly confirmRevertOptions: string;
237
+ /** Announced after Apply, Reset or Revert. */
238
+ readonly optionsSaved: (title: string) => string;
239
+ readonly sortDefault: string;
240
+ readonly sortAscending: string;
241
+ readonly sortDescending: string;
242
+ readonly moveColumnUp: (column: string) => string;
243
+ readonly moveColumnDown: (column: string) => string;
244
+ readonly customRange: (value: string) => string;
217
245
  /** The card menu's heading over the pages a widget can move to. */
218
246
  readonly moveToPage: (title: string) => string;
219
247
  readonly moveToPagePlaceholder: string;
@@ -346,6 +374,27 @@ interface DashboardProps extends WidgetSettings {
346
374
  */
347
375
  declare function Dashboard({ locale, linkTarget, classNames, labels, ...props }: DashboardProps): ReactNode;
348
376
 
377
+ interface WidgetOptionsDialogProps {
378
+ /** The author's definition, before the viewer's settings. */
379
+ readonly definition: WidgetDefinition;
380
+ /** What the viewer has saved for this widget. */
381
+ readonly settings: WidgetViewerSettings | undefined;
382
+ /**
383
+ * What they had when editing began, for "Revert to before editing". Leave it
384
+ * out to hide that button. `settings` may be `undefined` inside it, which
385
+ * means they had chosen nothing.
386
+ */
387
+ readonly baseline?: {
388
+ readonly settings: WidgetViewerSettings | undefined;
389
+ };
390
+ /** Whether another widget already shows this title; the dialog refuses it. */
391
+ readonly isTitleInUse?: (title: string) => boolean;
392
+ /** Called after the viewer confirms Apply, Reset or Revert. */
393
+ readonly onApply: (patch: WidgetSettingsPatch) => void;
394
+ readonly onClose: () => void;
395
+ }
396
+ declare function WidgetOptionsDialog({ definition, settings, baseline, isTitleInUse, onApply, onClose, }: WidgetOptionsDialogProps): ReactElement;
397
+
349
398
  /**
350
399
  * Default colors, used as `var(--dwt-*, fallback)` so charts read correctly
351
400
  * without the stylesheet. `styles.css` redefines them for dark mode, and an
@@ -520,4 +569,4 @@ interface UseWidgetsResult {
520
569
  */
521
570
  declare function useWidgets<C extends WidgetContext>(definitions: readonly WidgetDefinition[], providers: WidgetProviders<C>, context: C, options?: UseWidgetsOptions): UseWidgetsResult;
522
571
 
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 };
572
+ 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-VaaysVnZ.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-_Eb8Y98-.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,34 @@ 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
+ readonly optionsDeclared: string;
229
+ readonly apply: string;
230
+ readonly cancel: string;
231
+ readonly resetToDefaults: string;
232
+ readonly revertToBeforeEditing: string;
233
+ readonly confirmApply: string;
234
+ readonly confirmDiscard: string;
235
+ readonly confirmResetOptions: string;
236
+ readonly confirmRevertOptions: string;
237
+ /** Announced after Apply, Reset or Revert. */
238
+ readonly optionsSaved: (title: string) => string;
239
+ readonly sortDefault: string;
240
+ readonly sortAscending: string;
241
+ readonly sortDescending: string;
242
+ readonly moveColumnUp: (column: string) => string;
243
+ readonly moveColumnDown: (column: string) => string;
244
+ readonly customRange: (value: string) => string;
217
245
  /** The card menu's heading over the pages a widget can move to. */
218
246
  readonly moveToPage: (title: string) => string;
219
247
  readonly moveToPagePlaceholder: string;
@@ -346,6 +374,27 @@ interface DashboardProps extends WidgetSettings {
346
374
  */
347
375
  declare function Dashboard({ locale, linkTarget, classNames, labels, ...props }: DashboardProps): ReactNode;
348
376
 
377
+ interface WidgetOptionsDialogProps {
378
+ /** The author's definition, before the viewer's settings. */
379
+ readonly definition: WidgetDefinition;
380
+ /** What the viewer has saved for this widget. */
381
+ readonly settings: WidgetViewerSettings | undefined;
382
+ /**
383
+ * What they had when editing began, for "Revert to before editing". Leave it
384
+ * out to hide that button. `settings` may be `undefined` inside it, which
385
+ * means they had chosen nothing.
386
+ */
387
+ readonly baseline?: {
388
+ readonly settings: WidgetViewerSettings | undefined;
389
+ };
390
+ /** Whether another widget already shows this title; the dialog refuses it. */
391
+ readonly isTitleInUse?: (title: string) => boolean;
392
+ /** Called after the viewer confirms Apply, Reset or Revert. */
393
+ readonly onApply: (patch: WidgetSettingsPatch) => void;
394
+ readonly onClose: () => void;
395
+ }
396
+ declare function WidgetOptionsDialog({ definition, settings, baseline, isTitleInUse, onApply, onClose, }: WidgetOptionsDialogProps): ReactElement;
397
+
349
398
  /**
350
399
  * Default colors, used as `var(--dwt-*, fallback)` so charts read correctly
351
400
  * without the stylesheet. `styles.css` redefines them for dark mode, and an
@@ -520,4 +569,4 @@ interface UseWidgetsResult {
520
569
  */
521
570
  declare function useWidgets<C extends WidgetContext>(definitions: readonly WidgetDefinition[], providers: WidgetProviders<C>, context: C, options?: UseWidgetsOptions): UseWidgetsResult;
522
571
 
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 };
572
+ 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 };