@richardmcquiston01/dashboard-widgets-toolkit 0.7.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/core.cjs +100 -19
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +99 -20
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +100 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +99 -20
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +458 -153
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +50 -3
- package/dist/react.d.ts +50 -3
- package/dist/react.js +458 -153
- package/dist/react.js.map +1 -1
- package/dist/{scale-W60sXwlI.d.cts → scale-CrXxawQn.d.cts} +57 -5
- package/dist/{scale-W60sXwlI.d.ts → scale-CrXxawQn.d.ts} +57 -5
- package/dist/styles.css +35 -0
- package/package.json +1 -1
package/dist/react.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
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, 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 TextWidgetData, i as WidgetData, j as ResolveOptions, k as WidgetContext, l as WidgetProviders } from './scale-
|
|
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, 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 TextWidgetData, i as WidgetData, j as ResolveOptions, k as WidgetContext, l as WidgetProviders } from './scale-CrXxawQn.cjs';
|
|
3
3
|
|
|
4
4
|
interface WidgetCardProps {
|
|
5
5
|
readonly title: string;
|
|
@@ -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. */
|
|
@@ -230,6 +253,30 @@ interface DashboardProps extends WidgetSettings {
|
|
|
230
253
|
* restore; persist it. Without it the layout is read-only (no controls).
|
|
231
254
|
*/
|
|
232
255
|
readonly onLayoutChange?: (layout: DashboardLayout) => void;
|
|
256
|
+
/**
|
|
257
|
+
* Ignore widget `locked` settings, so locked widgets can be moved, hidden
|
|
258
|
+
* and minimized. For administrators editing the default layout: pass it
|
|
259
|
+
* only for roles you trust, and enforce locks again on the server for
|
|
260
|
+
* everyone else (`enforceLocks`). It never changes the locks themselves.
|
|
261
|
+
*/
|
|
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;
|
|
233
280
|
readonly onRetry?: (key: string) => void;
|
|
234
281
|
/**
|
|
235
282
|
* Loads the full data for a widget's detail view (widgets whose definition
|
package/dist/react.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
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, 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 TextWidgetData, i as WidgetData, j as ResolveOptions, k as WidgetContext, l as WidgetProviders } from './scale-
|
|
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, 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 TextWidgetData, i as WidgetData, j as ResolveOptions, k as WidgetContext, l as WidgetProviders } from './scale-CrXxawQn.js';
|
|
3
3
|
|
|
4
4
|
interface WidgetCardProps {
|
|
5
5
|
readonly title: string;
|
|
@@ -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. */
|
|
@@ -230,6 +253,30 @@ interface DashboardProps extends WidgetSettings {
|
|
|
230
253
|
* restore; persist it. Without it the layout is read-only (no controls).
|
|
231
254
|
*/
|
|
232
255
|
readonly onLayoutChange?: (layout: DashboardLayout) => void;
|
|
256
|
+
/**
|
|
257
|
+
* Ignore widget `locked` settings, so locked widgets can be moved, hidden
|
|
258
|
+
* and minimized. For administrators editing the default layout: pass it
|
|
259
|
+
* only for roles you trust, and enforce locks again on the server for
|
|
260
|
+
* everyone else (`enforceLocks`). It never changes the locks themselves.
|
|
261
|
+
*/
|
|
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;
|
|
233
280
|
readonly onRetry?: (key: string) => void;
|
|
234
281
|
/**
|
|
235
282
|
* Loads the full data for a widget's detail view (widgets whose definition
|