UNPKG

@wordpress/widget-dashboard

Version:

Stateless rendering engine for widget dashboards: the WidgetDashboard compound component and its grid-settings kit.

66 lines (64 loc) • 2.54 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // packages/widget-dashboard/src/components/reset-confirmation/reset-confirmation.tsx var reset_confirmation_exports = {}; __export(reset_confirmation_exports, { ResetConfirmation: () => ResetConfirmation }); module.exports = __toCommonJS(reset_confirmation_exports); var import_i18n = require("@wordpress/i18n"); var import_ui = require("@wordpress/ui"); var import_dashboard_context = require("../../context/dashboard-context.cjs"); var import_ui_context = require("../../context/ui-context.cjs"); var import_jsx_runtime = require("react/jsx-runtime"); function ResetConfirmation() { const { onLayoutReset, onEditChange, canPerform } = (0, import_dashboard_context.useDashboardInternalContext)(); const { resetDialogOpen, setResetDialogOpen } = (0, import_ui_context.useDashboardUIContext)(); if (!canPerform({ operation: "reset" })) { return null; } return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( import_ui.AlertDialog.Root, { open: resetDialogOpen, onOpenChange: setResetDialogOpen, onConfirm: async () => { await onLayoutReset?.(); onEditChange?.(false); setResetDialogOpen(false); }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)( import_ui.AlertDialog.Popup, { intent: "irreversible", title: (0, import_i18n.__)("Reset dashboard to default?"), description: (0, import_i18n.__)( "All customizations will be permanently lost." ), confirmButtonText: (0, import_i18n.__)("Reset") } ) } ); } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { ResetConfirmation }); //# sourceMappingURL=reset-confirmation.cjs.map