@wordpress/widget-dashboard
Version:
Stateless rendering engine for widget dashboards: the WidgetDashboard compound component and its grid-settings kit.
20 lines (19 loc) • 508 B
JavaScript
// packages/widget-dashboard/src/utils/create-dashboard-widget/create-dashboard-widget.ts
import { v4 as uuid } from "uuid";
var DEFAULT_PLACEMENT = {
width: 1,
height: 2,
order: 0
};
function createDashboardWidget(widgetType, initialAttributes) {
return {
uuid: uuid(),
type: widgetType.name,
attributes: initialAttributes ?? widgetType.example?.attributes,
placement: DEFAULT_PLACEMENT
};
}
export {
createDashboardWidget
};
//# sourceMappingURL=create-dashboard-widget.mjs.map