@richardmcquiston01/dashboard-widgets-toolkit 0.8.0 → 0.9.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
@@ -37,6 +37,8 @@ interface WidgetCardProps {
37
37
  * which card scrolled into view. `ResolvedWidgetCard` sets it for you.
38
38
  */
39
39
  readonly widgetKey?: string;
40
+ /** Marks the card as being edited (dashed outline); set by `Dashboard`. */
41
+ readonly editing?: boolean;
40
42
  /** 2 to 6; default 2. */
41
43
  readonly headingLevel?: 2 | 3 | 4 | 5 | 6;
42
44
  readonly className?: string;
@@ -46,7 +48,7 @@ interface WidgetCardProps {
46
48
  * The frame every widget sits in: title, optional description and actions,
47
49
  * a minimize toggle, and loading, empty and error states.
48
50
  */
49
- declare function WidgetCard({ title, description, actions, minimized, onToggleMinimized, onView, status, emptyText, error, onRetry, footer, size, fill, columnSpan, width, widgetKey, headingLevel, className, children, }: WidgetCardProps): ReactNode;
51
+ declare function WidgetCard({ title, description, actions, minimized, onToggleMinimized, onView, status, emptyText, error, onRetry, footer, size, fill, columnSpan, width, widgetKey, editing, headingLevel, className, children, }: WidgetCardProps): ReactNode;
50
52
  /** The title to show: alert lists add their total, e.g. "Low stock (3)". */
51
53
  declare function widgetTitle(widget: DashboardWidget): string;
52
54
  interface ResolvedWidgetCardProps {
@@ -61,6 +63,8 @@ interface ResolvedWidgetCardProps {
61
63
  /** See `WidgetCardProps.onView`. */
62
64
  readonly onView?: () => void;
63
65
  readonly onRetry?: () => void;
66
+ /** See `WidgetCardProps.editing`. */
67
+ readonly editing?: boolean;
64
68
  readonly headingLevel?: 2 | 3 | 4 | 5 | 6;
65
69
  readonly className?: string;
66
70
  }
@@ -148,7 +152,7 @@ declare function useDetailData(definition: WidgetDefinition, load: DetailLoader
148
152
  };
149
153
 
150
154
  /** Every element that carries a stable `dwt-*` class, for `classNames`. */
151
- type DashboardClassSlot = 'dashboard' | 'hiddenBar' | 'grid' | 'card' | 'cardHeader' | 'cardTitle' | 'cardDescription' | 'cardActions' | 'cardBody' | 'cardFooter' | 'button' | 'status' | 'empty' | 'error' | 'text' | 'kpi' | 'gauge' | 'table' | 'barList' | 'alertList' | 'chart' | 'legend' | 'tooltip' | 'tableTwin' | 'detail';
155
+ type DashboardClassSlot = 'dashboard' | 'hiddenBar' | 'toolbar' | 'grid' | 'card' | 'cardHeader' | 'cardTitle' | 'cardDescription' | 'cardActions' | 'cardBody' | 'cardFooter' | 'button' | 'status' | 'empty' | 'error' | 'text' | 'kpi' | 'gauge' | 'table' | 'barList' | 'alertList' | 'chart' | 'legend' | 'tooltip' | 'tableTwin' | 'detail';
152
156
  /**
153
157
  * Extra classes per slot, appended to the `dwt-*` class (never replacing
154
158
  * it), e.g. `{ card: 'rounded-lg shadow-sm' }` for Tailwind.
@@ -167,6 +171,25 @@ interface DashboardLabels {
167
171
  readonly moveLater: (title: string) => string;
168
172
  readonly hiddenWidgets: string;
169
173
  readonly minimizedWidgets: string;
174
+ /** Edit mode toolbar (`editMode="toggle"`). */
175
+ readonly customize: string;
176
+ readonly done: string;
177
+ readonly reset: string;
178
+ readonly revertChanges: string;
179
+ readonly confirmReset: string;
180
+ readonly confirmRevert: string;
181
+ /** Accessible names of the inline "✓" and "X" confirmation buttons. */
182
+ readonly confirmYes: string;
183
+ readonly confirmNo: string;
184
+ /** Announced when edit mode starts and ends. */
185
+ readonly editingOn: string;
186
+ readonly editingOff: string;
187
+ /** Names the toolbar group for assistive technology. */
188
+ readonly dashboardControls: string;
189
+ /** The lock icon on a locked card, e.g. "Revenue is locked". */
190
+ readonly locked: (title: string) => string;
191
+ /** The lock icon on a card shown to an administrator (`overrideLocks`). */
192
+ readonly lockedForViewers: (title: string) => string;
170
193
  /** Added to the accessible name of links that open in a new tab. */
171
194
  readonly opensInNewTab: string;
172
195
  /** The card's View button, opening the detail view. */
@@ -237,6 +260,23 @@ interface DashboardProps extends WidgetSettings {
237
260
  * everyone else (`enforceLocks`). It never changes the locks themselves.
238
261
  */
239
262
  readonly overrideLocks?: boolean;
263
+ /**
264
+ * `always` (default): move and hide controls show whenever `onLayoutChange`
265
+ * is set. `toggle`: they show only while editing, behind a Customize
266
+ * button, so a stray click can't rearrange the page. Minimize and its bar
267
+ * work in both modes.
268
+ */
269
+ readonly editMode?: 'always' | 'toggle';
270
+ /** Controlled editing state (`editMode="toggle"`). */
271
+ readonly editing?: boolean;
272
+ /** Initial editing state when uncontrolled. Default false. */
273
+ readonly defaultEditing?: boolean;
274
+ /** Called when the viewer starts or finishes editing. */
275
+ readonly onEditingChange?: (editing: boolean) => void;
276
+ /** What Reset layout restores. Default: the empty layout (sortOrder order). */
277
+ readonly defaultLayout?: DashboardLayout;
278
+ /** Show the built-in Customize/Done/Reset toolbar (toggle mode). Default true. */
279
+ readonly toolbar?: boolean;
240
280
  readonly onRetry?: (key: string) => void;
241
281
  /**
242
282
  * Loads the full data for a widget's detail view (widgets whose definition
package/dist/react.d.ts CHANGED
@@ -37,6 +37,8 @@ interface WidgetCardProps {
37
37
  * which card scrolled into view. `ResolvedWidgetCard` sets it for you.
38
38
  */
39
39
  readonly widgetKey?: string;
40
+ /** Marks the card as being edited (dashed outline); set by `Dashboard`. */
41
+ readonly editing?: boolean;
40
42
  /** 2 to 6; default 2. */
41
43
  readonly headingLevel?: 2 | 3 | 4 | 5 | 6;
42
44
  readonly className?: string;
@@ -46,7 +48,7 @@ interface WidgetCardProps {
46
48
  * The frame every widget sits in: title, optional description and actions,
47
49
  * a minimize toggle, and loading, empty and error states.
48
50
  */
49
- declare function WidgetCard({ title, description, actions, minimized, onToggleMinimized, onView, status, emptyText, error, onRetry, footer, size, fill, columnSpan, width, widgetKey, headingLevel, className, children, }: WidgetCardProps): ReactNode;
51
+ declare function WidgetCard({ title, description, actions, minimized, onToggleMinimized, onView, status, emptyText, error, onRetry, footer, size, fill, columnSpan, width, widgetKey, editing, headingLevel, className, children, }: WidgetCardProps): ReactNode;
50
52
  /** The title to show: alert lists add their total, e.g. "Low stock (3)". */
51
53
  declare function widgetTitle(widget: DashboardWidget): string;
52
54
  interface ResolvedWidgetCardProps {
@@ -61,6 +63,8 @@ interface ResolvedWidgetCardProps {
61
63
  /** See `WidgetCardProps.onView`. */
62
64
  readonly onView?: () => void;
63
65
  readonly onRetry?: () => void;
66
+ /** See `WidgetCardProps.editing`. */
67
+ readonly editing?: boolean;
64
68
  readonly headingLevel?: 2 | 3 | 4 | 5 | 6;
65
69
  readonly className?: string;
66
70
  }
@@ -148,7 +152,7 @@ declare function useDetailData(definition: WidgetDefinition, load: DetailLoader
148
152
  };
149
153
 
150
154
  /** Every element that carries a stable `dwt-*` class, for `classNames`. */
151
- type DashboardClassSlot = 'dashboard' | 'hiddenBar' | 'grid' | 'card' | 'cardHeader' | 'cardTitle' | 'cardDescription' | 'cardActions' | 'cardBody' | 'cardFooter' | 'button' | 'status' | 'empty' | 'error' | 'text' | 'kpi' | 'gauge' | 'table' | 'barList' | 'alertList' | 'chart' | 'legend' | 'tooltip' | 'tableTwin' | 'detail';
155
+ type DashboardClassSlot = 'dashboard' | 'hiddenBar' | 'toolbar' | 'grid' | 'card' | 'cardHeader' | 'cardTitle' | 'cardDescription' | 'cardActions' | 'cardBody' | 'cardFooter' | 'button' | 'status' | 'empty' | 'error' | 'text' | 'kpi' | 'gauge' | 'table' | 'barList' | 'alertList' | 'chart' | 'legend' | 'tooltip' | 'tableTwin' | 'detail';
152
156
  /**
153
157
  * Extra classes per slot, appended to the `dwt-*` class (never replacing
154
158
  * it), e.g. `{ card: 'rounded-lg shadow-sm' }` for Tailwind.
@@ -167,6 +171,25 @@ interface DashboardLabels {
167
171
  readonly moveLater: (title: string) => string;
168
172
  readonly hiddenWidgets: string;
169
173
  readonly minimizedWidgets: string;
174
+ /** Edit mode toolbar (`editMode="toggle"`). */
175
+ readonly customize: string;
176
+ readonly done: string;
177
+ readonly reset: string;
178
+ readonly revertChanges: string;
179
+ readonly confirmReset: string;
180
+ readonly confirmRevert: string;
181
+ /** Accessible names of the inline "✓" and "X" confirmation buttons. */
182
+ readonly confirmYes: string;
183
+ readonly confirmNo: string;
184
+ /** Announced when edit mode starts and ends. */
185
+ readonly editingOn: string;
186
+ readonly editingOff: string;
187
+ /** Names the toolbar group for assistive technology. */
188
+ readonly dashboardControls: string;
189
+ /** The lock icon on a locked card, e.g. "Revenue is locked". */
190
+ readonly locked: (title: string) => string;
191
+ /** The lock icon on a card shown to an administrator (`overrideLocks`). */
192
+ readonly lockedForViewers: (title: string) => string;
170
193
  /** Added to the accessible name of links that open in a new tab. */
171
194
  readonly opensInNewTab: string;
172
195
  /** The card's View button, opening the detail view. */
@@ -237,6 +260,23 @@ interface DashboardProps extends WidgetSettings {
237
260
  * everyone else (`enforceLocks`). It never changes the locks themselves.
238
261
  */
239
262
  readonly overrideLocks?: boolean;
263
+ /**
264
+ * `always` (default): move and hide controls show whenever `onLayoutChange`
265
+ * is set. `toggle`: they show only while editing, behind a Customize
266
+ * button, so a stray click can't rearrange the page. Minimize and its bar
267
+ * work in both modes.
268
+ */
269
+ readonly editMode?: 'always' | 'toggle';
270
+ /** Controlled editing state (`editMode="toggle"`). */
271
+ readonly editing?: boolean;
272
+ /** Initial editing state when uncontrolled. Default false. */
273
+ readonly defaultEditing?: boolean;
274
+ /** Called when the viewer starts or finishes editing. */
275
+ readonly onEditingChange?: (editing: boolean) => void;
276
+ /** What Reset layout restores. Default: the empty layout (sortOrder order). */
277
+ readonly defaultLayout?: DashboardLayout;
278
+ /** Show the built-in Customize/Done/Reset toolbar (toggle mode). Default true. */
279
+ readonly toolbar?: boolean;
240
280
  readonly onRetry?: (key: string) => void;
241
281
  /**
242
282
  * Loads the full data for a widget's detail view (widgets whose definition