mogh_ui 0.1.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/color.cjs +62 -0
- package/dist/color.cjs.map +1 -0
- package/dist/color.d.cts +5 -0
- package/dist/color.d.ts +5 -0
- package/dist/color.js +37 -0
- package/dist/color.js.map +1 -0
- package/dist/components/back-button.cjs +43 -0
- package/dist/components/back-button.cjs.map +1 -0
- package/dist/components/back-button.d.cts +9 -0
- package/dist/components/back-button.d.ts +9 -0
- package/dist/components/back-button.js +19 -0
- package/dist/components/back-button.js.map +1 -0
- package/dist/components/config/confirm.cjs +191 -0
- package/dist/components/config/confirm.cjs.map +1 -0
- package/dist/components/config/confirm.d.cts +20 -0
- package/dist/components/config/confirm.d.ts +20 -0
- package/dist/components/config/confirm.js +167 -0
- package/dist/components/config/confirm.js.map +1 -0
- package/dist/components/config/group.cjs +102 -0
- package/dist/components/config/group.cjs.map +1 -0
- package/dist/components/config/group.d.cts +11 -0
- package/dist/components/config/group.d.ts +11 -0
- package/dist/components/config/group.js +78 -0
- package/dist/components/config/group.js.map +1 -0
- package/dist/components/config/index.cjs +237 -0
- package/dist/components/config/index.cjs.map +1 -0
- package/dist/components/config/index.d.cts +62 -0
- package/dist/components/config/index.d.ts +62 -0
- package/dist/components/config/index.js +217 -0
- package/dist/components/config/index.js.map +1 -0
- package/dist/components/config/item.cjs +139 -0
- package/dist/components/config/item.cjs.map +1 -0
- package/dist/components/config/item.d.cts +45 -0
- package/dist/components/config/item.d.ts +45 -0
- package/dist/components/config/item.js +119 -0
- package/dist/components/config/item.js.map +1 -0
- package/dist/components/config/layout.cjs +44 -0
- package/dist/components/config/layout.cjs.map +1 -0
- package/dist/components/config/layout.d.cts +11 -0
- package/dist/components/config/layout.d.ts +11 -0
- package/dist/components/config/layout.js +20 -0
- package/dist/components/config/layout.js.map +1 -0
- package/dist/components/config/unsaved-changes.cjs +47 -0
- package/dist/components/config/unsaved-changes.cjs.map +1 -0
- package/dist/components/config/unsaved-changes.d.cts +7 -0
- package/dist/components/config/unsaved-changes.d.ts +7 -0
- package/dist/components/config/unsaved-changes.js +23 -0
- package/dist/components/config/unsaved-changes.js.map +1 -0
- package/dist/components/confirm-button.cjs +85 -0
- package/dist/components/confirm-button.cjs.map +1 -0
- package/dist/components/confirm-button.d.cts +23 -0
- package/dist/components/confirm-button.d.ts +23 -0
- package/dist/components/confirm-button.js +69 -0
- package/dist/components/confirm-button.js.map +1 -0
- package/dist/components/confirm-icon.cjs +70 -0
- package/dist/components/confirm-icon.cjs.map +1 -0
- package/dist/components/confirm-icon.d.cts +20 -0
- package/dist/components/confirm-icon.d.ts +20 -0
- package/dist/components/confirm-icon.js +54 -0
- package/dist/components/confirm-icon.js.map +1 -0
- package/dist/components/confirm-modal.cjs +146 -0
- package/dist/components/confirm-modal.cjs.map +1 -0
- package/dist/components/confirm-modal.d.cts +25 -0
- package/dist/components/confirm-modal.d.ts +25 -0
- package/dist/components/confirm-modal.js +130 -0
- package/dist/components/confirm-modal.js.map +1 -0
- package/dist/components/copy-button.cjs +68 -0
- package/dist/components/copy-button.cjs.map +1 -0
- package/dist/components/copy-button.d.cts +15 -0
- package/dist/components/copy-button.d.ts +15 -0
- package/dist/components/copy-button.js +46 -0
- package/dist/components/copy-button.js.map +1 -0
- package/dist/components/copy-text.cjs +63 -0
- package/dist/components/copy-text.cjs.map +1 -0
- package/dist/components/copy-text.d.cts +11 -0
- package/dist/components/copy-text.d.ts +11 -0
- package/dist/components/copy-text.js +39 -0
- package/dist/components/copy-text.js.map +1 -0
- package/dist/components/create-modal.cjs +100 -0
- package/dist/components/create-modal.cjs.map +1 -0
- package/dist/components/create-modal.d.cts +18 -0
- package/dist/components/create-modal.d.ts +18 -0
- package/dist/components/create-modal.js +82 -0
- package/dist/components/create-modal.js.map +1 -0
- package/dist/components/data-table.cjs +240 -0
- package/dist/components/data-table.cjs.map +1 -0
- package/dist/components/data-table.d.cts +36 -0
- package/dist/components/data-table.d.ts +36 -0
- package/dist/components/data-table.js +233 -0
- package/dist/components/data-table.js.map +1 -0
- package/dist/components/divided-children/index.cjs +53 -0
- package/dist/components/divided-children/index.cjs.map +1 -0
- package/dist/components/divided-children/index.d.cts +15 -0
- package/dist/components/divided-children/index.d.ts +15 -0
- package/dist/components/divided-children/index.js +19 -0
- package/dist/components/divided-children/index.js.map +1 -0
- package/dist/components/divided-children/index.module.scss +4 -0
- package/dist/components/enable-switch.cjs +67 -0
- package/dist/components/enable-switch.cjs.map +1 -0
- package/dist/components/enable-switch.d.cts +12 -0
- package/dist/components/enable-switch.d.ts +12 -0
- package/dist/components/enable-switch.js +43 -0
- package/dist/components/enable-switch.js.map +1 -0
- package/dist/components/entity-header.cjs +137 -0
- package/dist/components/entity-header.cjs.map +1 -0
- package/dist/components/entity-header.d.cts +20 -0
- package/dist/components/entity-header.d.ts +20 -0
- package/dist/components/entity-header.js +113 -0
- package/dist/components/entity-header.js.map +1 -0
- package/dist/components/entity-page.cjs +45 -0
- package/dist/components/entity-page.cjs.map +1 -0
- package/dist/components/entity-page.d.cts +11 -0
- package/dist/components/entity-page.d.ts +11 -0
- package/dist/components/entity-page.js +21 -0
- package/dist/components/entity-page.js.map +1 -0
- package/dist/components/fancy-card/index.cjs +52 -0
- package/dist/components/fancy-card/index.cjs.map +1 -0
- package/dist/components/fancy-card/index.d.cts +17 -0
- package/dist/components/fancy-card/index.d.ts +17 -0
- package/dist/components/fancy-card/index.js +18 -0
- package/dist/components/fancy-card/index.js.map +1 -0
- package/dist/components/fancy-card/index.module.scss +13 -0
- package/dist/components/hover-error.cjs +60 -0
- package/dist/components/hover-error.cjs.map +1 -0
- package/dist/components/hover-error.d.cts +9 -0
- package/dist/components/hover-error.d.ts +9 -0
- package/dist/components/hover-error.js +36 -0
- package/dist/components/hover-error.js.map +1 -0
- package/dist/components/info-card.cjs +44 -0
- package/dist/components/info-card.cjs.map +1 -0
- package/dist/components/info-card.d.cts +21 -0
- package/dist/components/info-card.d.ts +21 -0
- package/dist/components/info-card.js +25 -0
- package/dist/components/info-card.js.map +1 -0
- package/dist/components/input-list.cjs +68 -0
- package/dist/components/input-list.cjs.map +1 -0
- package/dist/components/input-list.d.cts +14 -0
- package/dist/components/input-list.d.ts +14 -0
- package/dist/components/input-list.js +44 -0
- package/dist/components/input-list.js.map +1 -0
- package/dist/components/labelled-switch.cjs +68 -0
- package/dist/components/labelled-switch.cjs.map +1 -0
- package/dist/components/labelled-switch.d.cts +14 -0
- package/dist/components/labelled-switch.d.ts +14 -0
- package/dist/components/labelled-switch.js +48 -0
- package/dist/components/labelled-switch.js.map +1 -0
- package/dist/components/labels-group.cjs +44 -0
- package/dist/components/labels-group.cjs.map +1 -0
- package/dist/components/labels-group.d.cts +10 -0
- package/dist/components/labels-group.d.ts +10 -0
- package/dist/components/labels-group.js +20 -0
- package/dist/components/labels-group.js.map +1 -0
- package/dist/components/loading-screen.cjs +37 -0
- package/dist/components/loading-screen.cjs.map +1 -0
- package/dist/components/loading-screen.d.cts +8 -0
- package/dist/components/loading-screen.d.ts +8 -0
- package/dist/components/loading-screen.js +13 -0
- package/dist/components/loading-screen.js.map +1 -0
- package/dist/components/mobile-friendly-tabs.cjs +141 -0
- package/dist/components/mobile-friendly-tabs.cjs.map +1 -0
- package/dist/components/mobile-friendly-tabs.d.cts +43 -0
- package/dist/components/mobile-friendly-tabs.d.ts +43 -0
- package/dist/components/mobile-friendly-tabs.js +120 -0
- package/dist/components/mobile-friendly-tabs.js.map +1 -0
- package/dist/components/monaco/index.cjs +244 -0
- package/dist/components/monaco/index.cjs.map +1 -0
- package/dist/components/monaco/index.d.cts +32 -0
- package/dist/components/monaco/index.d.ts +32 -0
- package/dist/components/monaco/index.js +208 -0
- package/dist/components/monaco/index.js.map +1 -0
- package/dist/components/monaco/index.scss +3 -0
- package/dist/components/monaco/init.cjs +73 -0
- package/dist/components/monaco/init.cjs.map +1 -0
- package/dist/components/monaco/init.d.cts +2 -0
- package/dist/components/monaco/init.d.ts +2 -0
- package/dist/components/monaco/init.js +49 -0
- package/dist/components/monaco/init.js.map +1 -0
- package/dist/components/monaco/syntax/fancy_toml.cjs +241 -0
- package/dist/components/monaco/syntax/fancy_toml.cjs.map +1 -0
- package/dist/components/monaco/syntax/fancy_toml.d.cts +2 -0
- package/dist/components/monaco/syntax/fancy_toml.d.ts +2 -0
- package/dist/components/monaco/syntax/fancy_toml.js +218 -0
- package/dist/components/monaco/syntax/fancy_toml.js.map +1 -0
- package/dist/components/monaco/syntax/key_value.cjs +107 -0
- package/dist/components/monaco/syntax/key_value.cjs.map +1 -0
- package/dist/components/monaco/syntax/key_value.d.cts +2 -0
- package/dist/components/monaco/syntax/key_value.d.ts +2 -0
- package/dist/components/monaco/syntax/key_value.js +84 -0
- package/dist/components/monaco/syntax/key_value.js.map +1 -0
- package/dist/components/monaco/syntax/shell.cjs +246 -0
- package/dist/components/monaco/syntax/shell.cjs.map +1 -0
- package/dist/components/monaco/syntax/shell.d.cts +2 -0
- package/dist/components/monaco/syntax/shell.d.ts +2 -0
- package/dist/components/monaco/syntax/shell.js +223 -0
- package/dist/components/monaco/syntax/shell.js.map +1 -0
- package/dist/components/monaco/syntax/string_list.cjs +75 -0
- package/dist/components/monaco/syntax/string_list.cjs.map +1 -0
- package/dist/components/monaco/syntax/string_list.d.cts +2 -0
- package/dist/components/monaco/syntax/string_list.d.ts +2 -0
- package/dist/components/monaco/syntax/string_list.js +52 -0
- package/dist/components/monaco/syntax/string_list.js.map +1 -0
- package/dist/components/monaco/syntax/toml.cjs +157 -0
- package/dist/components/monaco/syntax/toml.cjs.map +1 -0
- package/dist/components/monaco/syntax/toml.d.cts +2 -0
- package/dist/components/monaco/syntax/toml.d.ts +2 -0
- package/dist/components/monaco/syntax/toml.js +134 -0
- package/dist/components/monaco/syntax/toml.js.map +1 -0
- package/dist/components/monaco/syntax/yaml.cjs +250 -0
- package/dist/components/monaco/syntax/yaml.cjs.map +1 -0
- package/dist/components/monaco/syntax/yaml.d.cts +2 -0
- package/dist/components/monaco/syntax/yaml.d.ts +2 -0
- package/dist/components/monaco/syntax/yaml.js +227 -0
- package/dist/components/monaco/syntax/yaml.js.map +1 -0
- package/dist/components/monaco/theme.cjs +721 -0
- package/dist/components/monaco/theme.cjs.map +1 -0
- package/dist/components/monaco/theme.d.cts +2 -0
- package/dist/components/monaco/theme.d.ts +2 -0
- package/dist/components/monaco/theme.js +698 -0
- package/dist/components/monaco/theme.js.map +1 -0
- package/dist/components/page-guard.cjs +44 -0
- package/dist/components/page-guard.cjs.map +1 -0
- package/dist/components/page-guard.d.cts +13 -0
- package/dist/components/page-guard.d.ts +13 -0
- package/dist/components/page-guard.js +20 -0
- package/dist/components/page-guard.js.map +1 -0
- package/dist/components/page.cjs +81 -0
- package/dist/components/page.cjs.map +1 -0
- package/dist/components/page.d.cts +31 -0
- package/dist/components/page.d.ts +31 -0
- package/dist/components/page.js +63 -0
- package/dist/components/page.js.map +1 -0
- package/dist/components/search-input.cjs +51 -0
- package/dist/components/search-input.cjs.map +1 -0
- package/dist/components/search-input.d.cts +9 -0
- package/dist/components/search-input.d.ts +9 -0
- package/dist/components/search-input.js +27 -0
- package/dist/components/search-input.js.map +1 -0
- package/dist/components/section.cjs +100 -0
- package/dist/components/section.cjs.map +1 -0
- package/dist/components/section.d.cts +33 -0
- package/dist/components/section.d.ts +33 -0
- package/dist/components/section.js +83 -0
- package/dist/components/section.js.map +1 -0
- package/dist/components/shared-text-update.cjs +83 -0
- package/dist/components/shared-text-update.cjs.map +1 -0
- package/dist/components/shared-text-update.d.cts +20 -0
- package/dist/components/shared-text-update.d.ts +20 -0
- package/dist/components/shared-text-update.js +65 -0
- package/dist/components/shared-text-update.js.map +1 -0
- package/dist/components/show-hide-button.cjs +48 -0
- package/dist/components/show-hide-button.cjs.map +1 -0
- package/dist/components/show-hide-button.d.cts +8 -0
- package/dist/components/show-hide-button.d.ts +8 -0
- package/dist/components/show-hide-button.js +24 -0
- package/dist/components/show-hide-button.js.map +1 -0
- package/dist/components/stat-bar.cjs +68 -0
- package/dist/components/stat-bar.cjs.map +1 -0
- package/dist/components/stat-bar.d.cts +15 -0
- package/dist/components/stat-bar.d.ts +15 -0
- package/dist/components/stat-bar.js +44 -0
- package/dist/components/stat-bar.js.map +1 -0
- package/dist/components/stat-cell.cjs +72 -0
- package/dist/components/stat-cell.cjs.map +1 -0
- package/dist/components/stat-cell.d.cts +17 -0
- package/dist/components/stat-cell.d.ts +17 -0
- package/dist/components/stat-cell.js +54 -0
- package/dist/components/stat-cell.js.map +1 -0
- package/dist/components/status-badge.cjs +63 -0
- package/dist/components/status-badge.cjs.map +1 -0
- package/dist/components/status-badge.d.cts +20 -0
- package/dist/components/status-badge.d.ts +20 -0
- package/dist/components/status-badge.js +39 -0
- package/dist/components/status-badge.js.map +1 -0
- package/dist/components/tabbed-page.cjs +64 -0
- package/dist/components/tabbed-page.cjs.map +1 -0
- package/dist/components/tabbed-page.d.cts +18 -0
- package/dist/components/tabbed-page.d.ts +18 -0
- package/dist/components/tabbed-page.js +40 -0
- package/dist/components/tabbed-page.js.map +1 -0
- package/dist/components/table-skeleton.cjs +36 -0
- package/dist/components/table-skeleton.cjs.map +1 -0
- package/dist/components/table-skeleton.d.cts +8 -0
- package/dist/components/table-skeleton.d.ts +8 -0
- package/dist/components/table-skeleton.js +12 -0
- package/dist/components/table-skeleton.js.map +1 -0
- package/dist/components/text-update-modal.cjs +102 -0
- package/dist/components/text-update-modal.cjs.map +1 -0
- package/dist/components/text-update-modal.d.cts +19 -0
- package/dist/components/text-update-modal.d.ts +19 -0
- package/dist/components/text-update-modal.js +85 -0
- package/dist/components/text-update-modal.js.map +1 -0
- package/dist/components/theme-toggle.cjs +73 -0
- package/dist/components/theme-toggle.cjs.map +1 -0
- package/dist/components/theme-toggle.d.cts +5 -0
- package/dist/components/theme-toggle.d.ts +5 -0
- package/dist/components/theme-toggle.js +54 -0
- package/dist/components/theme-toggle.js.map +1 -0
- package/dist/formatting.cjs +124 -0
- package/dist/formatting.cjs.map +1 -0
- package/dist/formatting.d.cts +14 -0
- package/dist/formatting.d.ts +14 -0
- package/dist/formatting.js +89 -0
- package/dist/formatting.js.map +1 -0
- package/dist/hooks.cjs +117 -0
- package/dist/hooks.cjs.map +1 -0
- package/dist/hooks.d.cts +30 -0
- package/dist/hooks.d.ts +30 -0
- package/dist/hooks.js +88 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index.cjs +99 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +47 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/dist/index.scss +81 -0
- package/dist/theme.cjs +332 -0
- package/dist/theme.cjs.map +1 -0
- package/dist/theme.d.cts +15 -0
- package/dist/theme.d.ts +15 -0
- package/dist/theme.js +330 -0
- package/dist/theme.js.map +1 -0
- package/dist/theme.scss +76 -0
- package/dist/utils.cjs +48 -0
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.cts +15 -0
- package/dist/utils.d.ts +15 -0
- package/dist/utils.js +24 -0
- package/dist/utils.js.map +1 -0
- package/package.json +61 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var confirm_modal_exports = {};
|
|
20
|
+
__export(confirm_modal_exports, {
|
|
21
|
+
ConfirmModal: () => ConfirmModal
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(confirm_modal_exports);
|
|
24
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
+
var import_core = require("@mantine/core");
|
|
26
|
+
var import_hooks = require("@mantine/hooks");
|
|
27
|
+
var import_react = require("react");
|
|
28
|
+
var import_confirm_button = require("./confirm-button");
|
|
29
|
+
var import_copy_button = require("./copy-button");
|
|
30
|
+
function ConfirmModal({
|
|
31
|
+
children,
|
|
32
|
+
icon,
|
|
33
|
+
disabled,
|
|
34
|
+
confirmText,
|
|
35
|
+
title,
|
|
36
|
+
confirmButtonContent,
|
|
37
|
+
onConfirm,
|
|
38
|
+
loading,
|
|
39
|
+
additional,
|
|
40
|
+
topAdditonal,
|
|
41
|
+
targetProps,
|
|
42
|
+
targetNoIcon,
|
|
43
|
+
confirmProps,
|
|
44
|
+
disableModal,
|
|
45
|
+
...modalProps
|
|
46
|
+
}) {
|
|
47
|
+
const [opened, { open, close }] = (0, import_hooks.useDisclosure)();
|
|
48
|
+
const [input, setInput] = (0, import_react.useState)("");
|
|
49
|
+
if (disableModal) {
|
|
50
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
51
|
+
import_confirm_button.ConfirmButton,
|
|
52
|
+
{
|
|
53
|
+
icon,
|
|
54
|
+
onClick: onConfirm,
|
|
55
|
+
disabled,
|
|
56
|
+
loading,
|
|
57
|
+
...targetProps,
|
|
58
|
+
children
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
63
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
64
|
+
import_core.Modal,
|
|
65
|
+
{
|
|
66
|
+
opened,
|
|
67
|
+
onClose: close,
|
|
68
|
+
title: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Text, { fz: "h3", children: title ?? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
69
|
+
"Confirm ",
|
|
70
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("b", { children })
|
|
71
|
+
] }) }),
|
|
72
|
+
styles: { content: { padding: "0.5rem" } },
|
|
73
|
+
size: "lg",
|
|
74
|
+
onClick: (e) => e.stopPropagation(),
|
|
75
|
+
...modalProps,
|
|
76
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.Stack, { children: [
|
|
77
|
+
topAdditonal,
|
|
78
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
79
|
+
import_core.Text,
|
|
80
|
+
{
|
|
81
|
+
onClick: () => {
|
|
82
|
+
navigator.clipboard.writeText(confirmText);
|
|
83
|
+
(0, import_copy_button.sendCopyNotification)();
|
|
84
|
+
},
|
|
85
|
+
style: { cursor: "pointer" },
|
|
86
|
+
children: [
|
|
87
|
+
"Please enter ",
|
|
88
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("b", { children: confirmText }),
|
|
89
|
+
" below to confirm this action.",
|
|
90
|
+
(location.origin.startsWith("https") || // For dev
|
|
91
|
+
location.origin.startsWith("http://localhost:")) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Text, { fz: "sm", c: "dimmed", children: "You may click the text in bold to copy it" })
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
96
|
+
import_core.TextInput,
|
|
97
|
+
{
|
|
98
|
+
value: input,
|
|
99
|
+
onChange: (e) => setInput(e.target.value),
|
|
100
|
+
error: input === confirmText ? void 0 : "Does not match"
|
|
101
|
+
}
|
|
102
|
+
),
|
|
103
|
+
additional,
|
|
104
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Group, { justify: "end", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
105
|
+
import_core.Button,
|
|
106
|
+
{
|
|
107
|
+
justify: "space-between",
|
|
108
|
+
w: { base: "100%", xs: 190 },
|
|
109
|
+
miw: "fit-content",
|
|
110
|
+
rightSection: loading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Loader, { color: "white", size: "1rem" }) : icon,
|
|
111
|
+
disabled: loading || disabled || input !== confirmText,
|
|
112
|
+
onClick: (e) => {
|
|
113
|
+
e.stopPropagation();
|
|
114
|
+
onConfirm ? onConfirm().then(() => close()) : close();
|
|
115
|
+
},
|
|
116
|
+
...confirmProps,
|
|
117
|
+
children: confirmButtonContent ?? children
|
|
118
|
+
}
|
|
119
|
+
) })
|
|
120
|
+
] })
|
|
121
|
+
}
|
|
122
|
+
),
|
|
123
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
124
|
+
import_core.Button,
|
|
125
|
+
{
|
|
126
|
+
onClick: (e) => {
|
|
127
|
+
e.stopPropagation();
|
|
128
|
+
open();
|
|
129
|
+
},
|
|
130
|
+
justify: "space-between",
|
|
131
|
+
w: { base: "100%", xs: 190 },
|
|
132
|
+
miw: "fit-content",
|
|
133
|
+
rightSection: targetNoIcon ? void 0 : loading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Loader, { color: "white", size: "1rem" }) : icon,
|
|
134
|
+
loading: targetNoIcon ? loading : void 0,
|
|
135
|
+
disabled: disabled || loading,
|
|
136
|
+
...targetProps,
|
|
137
|
+
children
|
|
138
|
+
}
|
|
139
|
+
)
|
|
140
|
+
] });
|
|
141
|
+
}
|
|
142
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
143
|
+
0 && (module.exports = {
|
|
144
|
+
ConfirmModal
|
|
145
|
+
});
|
|
146
|
+
//# sourceMappingURL=confirm-modal.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/confirm-modal.tsx"],"sourcesContent":["import {\n Button,\n ButtonProps,\n Group,\n Loader,\n Modal,\n ModalProps,\n Stack,\n Text,\n TextInput,\n} from \"@mantine/core\";\nimport { useDisclosure } from \"@mantine/hooks\";\nimport { ReactNode, useState } from \"react\";\nimport { ConfirmButton } from \"./confirm-button\";\nimport { sendCopyNotification } from \"./copy-button\";\n\nexport interface ConfirmModalProps extends Omit<\n Omit<Omit<ModalProps, \"opened\">, \"onClose\">,\n \"onClick\"\n> {\n children?: ReactNode;\n icon?: ReactNode;\n disabled?: boolean;\n /** User must enter this text to confirm */\n confirmText: string;\n title?: ReactNode;\n confirmButtonContent?: ReactNode;\n onConfirm?: () => Promise<unknown>;\n loading?: boolean;\n additional?: ReactNode;\n topAdditonal?: ReactNode;\n targetProps?: ButtonProps;\n targetNoIcon?: boolean;\n confirmProps?: ButtonProps;\n /** Converts into ConfirmButton */\n disableModal?: boolean;\n}\n\nexport function ConfirmModal({\n children,\n icon,\n disabled,\n confirmText,\n title,\n confirmButtonContent,\n onConfirm,\n loading,\n additional,\n topAdditonal,\n targetProps,\n targetNoIcon,\n confirmProps,\n disableModal,\n ...modalProps\n}: ConfirmModalProps) {\n const [opened, { open, close }] = useDisclosure();\n const [input, setInput] = useState(\"\");\n\n if (disableModal) {\n return (\n <ConfirmButton\n icon={icon}\n onClick={onConfirm}\n disabled={disabled}\n loading={loading}\n {...targetProps}\n >\n {children}\n </ConfirmButton>\n );\n }\n\n return (\n <>\n <Modal\n opened={opened}\n onClose={close}\n title={\n <Text fz=\"h3\">\n {title ?? (\n <>\n Confirm <b>{children}</b>\n </>\n )}\n </Text>\n }\n styles={{ content: { padding: \"0.5rem\" } }}\n size=\"lg\"\n onClick={(e) => e.stopPropagation()}\n {...modalProps}\n >\n <Stack>\n {topAdditonal}\n\n <Text\n onClick={() => {\n navigator.clipboard.writeText(confirmText);\n sendCopyNotification();\n }}\n style={{ cursor: \"pointer\" }}\n >\n Please enter <b>{confirmText}</b> below to confirm this action.\n {(location.origin.startsWith(\"https\") ||\n // For dev\n location.origin.startsWith(\"http://localhost:\")) && (\n <Text fz=\"sm\" c=\"dimmed\">\n You may click the text in bold to copy it\n </Text>\n )}\n </Text>\n\n <TextInput\n value={input}\n onChange={(e) => setInput(e.target.value)}\n error={input === confirmText ? undefined : \"Does not match\"}\n />\n\n {additional}\n\n <Group justify=\"end\">\n <Button\n justify=\"space-between\"\n w={{ base: \"100%\", xs: 190 }}\n miw=\"fit-content\"\n rightSection={\n loading ? <Loader color=\"white\" size=\"1rem\" /> : icon\n }\n disabled={loading || disabled || input !== confirmText}\n onClick={(e) => {\n e.stopPropagation();\n onConfirm ? onConfirm().then(() => close()) : close();\n }}\n {...confirmProps}\n >\n {confirmButtonContent ?? children}\n </Button>\n </Group>\n </Stack>\n </Modal>\n\n <Button\n onClick={(e) => {\n e.stopPropagation();\n open();\n }}\n justify=\"space-between\"\n w={{ base: \"100%\", xs: 190 }}\n miw=\"fit-content\"\n rightSection={\n targetNoIcon ? undefined : loading ? (\n <Loader color=\"white\" size=\"1rem\" />\n ) : (\n icon\n )\n }\n loading={targetNoIcon ? loading : undefined}\n disabled={disabled || loading}\n {...targetProps}\n >\n {children}\n </Button>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA4DM;AA5DN,kBAUO;AACP,mBAA8B;AAC9B,mBAAoC;AACpC,4BAA8B;AAC9B,yBAAqC;AAwB9B,SAAS,aAAa;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAsB;AACpB,QAAM,CAAC,QAAQ,EAAE,MAAM,MAAM,CAAC,QAAI,4BAAc;AAChD,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAS,EAAE;AAErC,MAAI,cAAc;AAChB,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,SAAS;AAAA,QACT;AAAA,QACA;AAAA,QACC,GAAG;AAAA,QAEH;AAAA;AAAA,IACH;AAAA,EAEJ;AAEA,SACE,4EACE;AAAA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,SAAS;AAAA,QACT,OACE,4CAAC,oBAAK,IAAG,MACN,mBACC,4EAAE;AAAA;AAAA,UACQ,4CAAC,OAAG,UAAS;AAAA,WACvB,GAEJ;AAAA,QAEF,QAAQ,EAAE,SAAS,EAAE,SAAS,SAAS,EAAE;AAAA,QACzC,MAAK;AAAA,QACL,SAAS,CAAC,MAAM,EAAE,gBAAgB;AAAA,QACjC,GAAG;AAAA,QAEJ,uDAAC,qBACE;AAAA;AAAA,UAED;AAAA,YAAC;AAAA;AAAA,cACC,SAAS,MAAM;AACb,0BAAU,UAAU,UAAU,WAAW;AACzC,6DAAqB;AAAA,cACvB;AAAA,cACA,OAAO,EAAE,QAAQ,UAAU;AAAA,cAC5B;AAAA;AAAA,gBACc,4CAAC,OAAG,uBAAY;AAAA,gBAAI;AAAA,iBAC/B,SAAS,OAAO,WAAW,OAAO;AAAA,gBAElC,SAAS,OAAO,WAAW,mBAAmB,MAC9C,4CAAC,oBAAK,IAAG,MAAK,GAAE,UAAS,uDAEzB;AAAA;AAAA;AAAA,UAEJ;AAAA,UAEA;AAAA,YAAC;AAAA;AAAA,cACC,OAAO;AAAA,cACP,UAAU,CAAC,MAAM,SAAS,EAAE,OAAO,KAAK;AAAA,cACxC,OAAO,UAAU,cAAc,SAAY;AAAA;AAAA,UAC7C;AAAA,UAEC;AAAA,UAED,4CAAC,qBAAM,SAAQ,OACb;AAAA,YAAC;AAAA;AAAA,cACC,SAAQ;AAAA,cACR,GAAG,EAAE,MAAM,QAAQ,IAAI,IAAI;AAAA,cAC3B,KAAI;AAAA,cACJ,cACE,UAAU,4CAAC,sBAAO,OAAM,SAAQ,MAAK,QAAO,IAAK;AAAA,cAEnD,UAAU,WAAW,YAAY,UAAU;AAAA,cAC3C,SAAS,CAAC,MAAM;AACd,kBAAE,gBAAgB;AAClB,4BAAY,UAAU,EAAE,KAAK,MAAM,MAAM,CAAC,IAAI,MAAM;AAAA,cACtD;AAAA,cACC,GAAG;AAAA,cAEH,kCAAwB;AAAA;AAAA,UAC3B,GACF;AAAA,WACF;AAAA;AAAA,IACF;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,SAAS,CAAC,MAAM;AACd,YAAE,gBAAgB;AAClB,eAAK;AAAA,QACP;AAAA,QACA,SAAQ;AAAA,QACR,GAAG,EAAE,MAAM,QAAQ,IAAI,IAAI;AAAA,QAC3B,KAAI;AAAA,QACJ,cACE,eAAe,SAAY,UACzB,4CAAC,sBAAO,OAAM,SAAQ,MAAK,QAAO,IAElC;AAAA,QAGJ,SAAS,eAAe,UAAU;AAAA,QAClC,UAAU,YAAY;AAAA,QACrB,GAAG;AAAA,QAEH;AAAA;AAAA,IACH;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ModalProps, ButtonProps } from '@mantine/core';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
interface ConfirmModalProps extends Omit<Omit<Omit<ModalProps, "opened">, "onClose">, "onClick"> {
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
icon?: ReactNode;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
/** User must enter this text to confirm */
|
|
10
|
+
confirmText: string;
|
|
11
|
+
title?: ReactNode;
|
|
12
|
+
confirmButtonContent?: ReactNode;
|
|
13
|
+
onConfirm?: () => Promise<unknown>;
|
|
14
|
+
loading?: boolean;
|
|
15
|
+
additional?: ReactNode;
|
|
16
|
+
topAdditonal?: ReactNode;
|
|
17
|
+
targetProps?: ButtonProps;
|
|
18
|
+
targetNoIcon?: boolean;
|
|
19
|
+
confirmProps?: ButtonProps;
|
|
20
|
+
/** Converts into ConfirmButton */
|
|
21
|
+
disableModal?: boolean;
|
|
22
|
+
}
|
|
23
|
+
declare function ConfirmModal({ children, icon, disabled, confirmText, title, confirmButtonContent, onConfirm, loading, additional, topAdditonal, targetProps, targetNoIcon, confirmProps, disableModal, ...modalProps }: ConfirmModalProps): react_jsx_runtime.JSX.Element;
|
|
24
|
+
|
|
25
|
+
export { ConfirmModal, type ConfirmModalProps };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ModalProps, ButtonProps } from '@mantine/core';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
interface ConfirmModalProps extends Omit<Omit<Omit<ModalProps, "opened">, "onClose">, "onClick"> {
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
icon?: ReactNode;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
/** User must enter this text to confirm */
|
|
10
|
+
confirmText: string;
|
|
11
|
+
title?: ReactNode;
|
|
12
|
+
confirmButtonContent?: ReactNode;
|
|
13
|
+
onConfirm?: () => Promise<unknown>;
|
|
14
|
+
loading?: boolean;
|
|
15
|
+
additional?: ReactNode;
|
|
16
|
+
topAdditonal?: ReactNode;
|
|
17
|
+
targetProps?: ButtonProps;
|
|
18
|
+
targetNoIcon?: boolean;
|
|
19
|
+
confirmProps?: ButtonProps;
|
|
20
|
+
/** Converts into ConfirmButton */
|
|
21
|
+
disableModal?: boolean;
|
|
22
|
+
}
|
|
23
|
+
declare function ConfirmModal({ children, icon, disabled, confirmText, title, confirmButtonContent, onConfirm, loading, additional, topAdditonal, targetProps, targetNoIcon, confirmProps, disableModal, ...modalProps }: ConfirmModalProps): react_jsx_runtime.JSX.Element;
|
|
24
|
+
|
|
25
|
+
export { ConfirmModal, type ConfirmModalProps };
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import {
|
|
3
|
+
Button,
|
|
4
|
+
Group,
|
|
5
|
+
Loader,
|
|
6
|
+
Modal,
|
|
7
|
+
Stack,
|
|
8
|
+
Text,
|
|
9
|
+
TextInput
|
|
10
|
+
} from "@mantine/core";
|
|
11
|
+
import { useDisclosure } from "@mantine/hooks";
|
|
12
|
+
import { useState } from "react";
|
|
13
|
+
import { ConfirmButton } from "./confirm-button";
|
|
14
|
+
import { sendCopyNotification } from "./copy-button";
|
|
15
|
+
function ConfirmModal({
|
|
16
|
+
children,
|
|
17
|
+
icon,
|
|
18
|
+
disabled,
|
|
19
|
+
confirmText,
|
|
20
|
+
title,
|
|
21
|
+
confirmButtonContent,
|
|
22
|
+
onConfirm,
|
|
23
|
+
loading,
|
|
24
|
+
additional,
|
|
25
|
+
topAdditonal,
|
|
26
|
+
targetProps,
|
|
27
|
+
targetNoIcon,
|
|
28
|
+
confirmProps,
|
|
29
|
+
disableModal,
|
|
30
|
+
...modalProps
|
|
31
|
+
}) {
|
|
32
|
+
const [opened, { open, close }] = useDisclosure();
|
|
33
|
+
const [input, setInput] = useState("");
|
|
34
|
+
if (disableModal) {
|
|
35
|
+
return /* @__PURE__ */ jsx(
|
|
36
|
+
ConfirmButton,
|
|
37
|
+
{
|
|
38
|
+
icon,
|
|
39
|
+
onClick: onConfirm,
|
|
40
|
+
disabled,
|
|
41
|
+
loading,
|
|
42
|
+
...targetProps,
|
|
43
|
+
children
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
48
|
+
/* @__PURE__ */ jsx(
|
|
49
|
+
Modal,
|
|
50
|
+
{
|
|
51
|
+
opened,
|
|
52
|
+
onClose: close,
|
|
53
|
+
title: /* @__PURE__ */ jsx(Text, { fz: "h3", children: title ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
54
|
+
"Confirm ",
|
|
55
|
+
/* @__PURE__ */ jsx("b", { children })
|
|
56
|
+
] }) }),
|
|
57
|
+
styles: { content: { padding: "0.5rem" } },
|
|
58
|
+
size: "lg",
|
|
59
|
+
onClick: (e) => e.stopPropagation(),
|
|
60
|
+
...modalProps,
|
|
61
|
+
children: /* @__PURE__ */ jsxs(Stack, { children: [
|
|
62
|
+
topAdditonal,
|
|
63
|
+
/* @__PURE__ */ jsxs(
|
|
64
|
+
Text,
|
|
65
|
+
{
|
|
66
|
+
onClick: () => {
|
|
67
|
+
navigator.clipboard.writeText(confirmText);
|
|
68
|
+
sendCopyNotification();
|
|
69
|
+
},
|
|
70
|
+
style: { cursor: "pointer" },
|
|
71
|
+
children: [
|
|
72
|
+
"Please enter ",
|
|
73
|
+
/* @__PURE__ */ jsx("b", { children: confirmText }),
|
|
74
|
+
" below to confirm this action.",
|
|
75
|
+
(location.origin.startsWith("https") || // For dev
|
|
76
|
+
location.origin.startsWith("http://localhost:")) && /* @__PURE__ */ jsx(Text, { fz: "sm", c: "dimmed", children: "You may click the text in bold to copy it" })
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
),
|
|
80
|
+
/* @__PURE__ */ jsx(
|
|
81
|
+
TextInput,
|
|
82
|
+
{
|
|
83
|
+
value: input,
|
|
84
|
+
onChange: (e) => setInput(e.target.value),
|
|
85
|
+
error: input === confirmText ? void 0 : "Does not match"
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
additional,
|
|
89
|
+
/* @__PURE__ */ jsx(Group, { justify: "end", children: /* @__PURE__ */ jsx(
|
|
90
|
+
Button,
|
|
91
|
+
{
|
|
92
|
+
justify: "space-between",
|
|
93
|
+
w: { base: "100%", xs: 190 },
|
|
94
|
+
miw: "fit-content",
|
|
95
|
+
rightSection: loading ? /* @__PURE__ */ jsx(Loader, { color: "white", size: "1rem" }) : icon,
|
|
96
|
+
disabled: loading || disabled || input !== confirmText,
|
|
97
|
+
onClick: (e) => {
|
|
98
|
+
e.stopPropagation();
|
|
99
|
+
onConfirm ? onConfirm().then(() => close()) : close();
|
|
100
|
+
},
|
|
101
|
+
...confirmProps,
|
|
102
|
+
children: confirmButtonContent ?? children
|
|
103
|
+
}
|
|
104
|
+
) })
|
|
105
|
+
] })
|
|
106
|
+
}
|
|
107
|
+
),
|
|
108
|
+
/* @__PURE__ */ jsx(
|
|
109
|
+
Button,
|
|
110
|
+
{
|
|
111
|
+
onClick: (e) => {
|
|
112
|
+
e.stopPropagation();
|
|
113
|
+
open();
|
|
114
|
+
},
|
|
115
|
+
justify: "space-between",
|
|
116
|
+
w: { base: "100%", xs: 190 },
|
|
117
|
+
miw: "fit-content",
|
|
118
|
+
rightSection: targetNoIcon ? void 0 : loading ? /* @__PURE__ */ jsx(Loader, { color: "white", size: "1rem" }) : icon,
|
|
119
|
+
loading: targetNoIcon ? loading : void 0,
|
|
120
|
+
disabled: disabled || loading,
|
|
121
|
+
...targetProps,
|
|
122
|
+
children
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
] });
|
|
126
|
+
}
|
|
127
|
+
export {
|
|
128
|
+
ConfirmModal
|
|
129
|
+
};
|
|
130
|
+
//# sourceMappingURL=confirm-modal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/confirm-modal.tsx"],"sourcesContent":["import {\n Button,\n ButtonProps,\n Group,\n Loader,\n Modal,\n ModalProps,\n Stack,\n Text,\n TextInput,\n} from \"@mantine/core\";\nimport { useDisclosure } from \"@mantine/hooks\";\nimport { ReactNode, useState } from \"react\";\nimport { ConfirmButton } from \"./confirm-button\";\nimport { sendCopyNotification } from \"./copy-button\";\n\nexport interface ConfirmModalProps extends Omit<\n Omit<Omit<ModalProps, \"opened\">, \"onClose\">,\n \"onClick\"\n> {\n children?: ReactNode;\n icon?: ReactNode;\n disabled?: boolean;\n /** User must enter this text to confirm */\n confirmText: string;\n title?: ReactNode;\n confirmButtonContent?: ReactNode;\n onConfirm?: () => Promise<unknown>;\n loading?: boolean;\n additional?: ReactNode;\n topAdditonal?: ReactNode;\n targetProps?: ButtonProps;\n targetNoIcon?: boolean;\n confirmProps?: ButtonProps;\n /** Converts into ConfirmButton */\n disableModal?: boolean;\n}\n\nexport function ConfirmModal({\n children,\n icon,\n disabled,\n confirmText,\n title,\n confirmButtonContent,\n onConfirm,\n loading,\n additional,\n topAdditonal,\n targetProps,\n targetNoIcon,\n confirmProps,\n disableModal,\n ...modalProps\n}: ConfirmModalProps) {\n const [opened, { open, close }] = useDisclosure();\n const [input, setInput] = useState(\"\");\n\n if (disableModal) {\n return (\n <ConfirmButton\n icon={icon}\n onClick={onConfirm}\n disabled={disabled}\n loading={loading}\n {...targetProps}\n >\n {children}\n </ConfirmButton>\n );\n }\n\n return (\n <>\n <Modal\n opened={opened}\n onClose={close}\n title={\n <Text fz=\"h3\">\n {title ?? (\n <>\n Confirm <b>{children}</b>\n </>\n )}\n </Text>\n }\n styles={{ content: { padding: \"0.5rem\" } }}\n size=\"lg\"\n onClick={(e) => e.stopPropagation()}\n {...modalProps}\n >\n <Stack>\n {topAdditonal}\n\n <Text\n onClick={() => {\n navigator.clipboard.writeText(confirmText);\n sendCopyNotification();\n }}\n style={{ cursor: \"pointer\" }}\n >\n Please enter <b>{confirmText}</b> below to confirm this action.\n {(location.origin.startsWith(\"https\") ||\n // For dev\n location.origin.startsWith(\"http://localhost:\")) && (\n <Text fz=\"sm\" c=\"dimmed\">\n You may click the text in bold to copy it\n </Text>\n )}\n </Text>\n\n <TextInput\n value={input}\n onChange={(e) => setInput(e.target.value)}\n error={input === confirmText ? undefined : \"Does not match\"}\n />\n\n {additional}\n\n <Group justify=\"end\">\n <Button\n justify=\"space-between\"\n w={{ base: \"100%\", xs: 190 }}\n miw=\"fit-content\"\n rightSection={\n loading ? <Loader color=\"white\" size=\"1rem\" /> : icon\n }\n disabled={loading || disabled || input !== confirmText}\n onClick={(e) => {\n e.stopPropagation();\n onConfirm ? onConfirm().then(() => close()) : close();\n }}\n {...confirmProps}\n >\n {confirmButtonContent ?? children}\n </Button>\n </Group>\n </Stack>\n </Modal>\n\n <Button\n onClick={(e) => {\n e.stopPropagation();\n open();\n }}\n justify=\"space-between\"\n w={{ base: \"100%\", xs: 190 }}\n miw=\"fit-content\"\n rightSection={\n targetNoIcon ? undefined : loading ? (\n <Loader color=\"white\" size=\"1rem\" />\n ) : (\n icon\n )\n }\n loading={targetNoIcon ? loading : undefined}\n disabled={disabled || loading}\n {...targetProps}\n >\n {children}\n </Button>\n </>\n );\n}\n"],"mappings":"AA4DM,SAoBQ,UApBR,KAoBQ,YApBR;AA5DN;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,qBAAqB;AAC9B,SAAoB,gBAAgB;AACpC,SAAS,qBAAqB;AAC9B,SAAS,4BAA4B;AAwB9B,SAAS,aAAa;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAsB;AACpB,QAAM,CAAC,QAAQ,EAAE,MAAM,MAAM,CAAC,IAAI,cAAc;AAChD,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAS,EAAE;AAErC,MAAI,cAAc;AAChB,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,SAAS;AAAA,QACT;AAAA,QACA;AAAA,QACC,GAAG;AAAA,QAEH;AAAA;AAAA,IACH;AAAA,EAEJ;AAEA,SACE,iCACE;AAAA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,SAAS;AAAA,QACT,OACE,oBAAC,QAAK,IAAG,MACN,mBACC,iCAAE;AAAA;AAAA,UACQ,oBAAC,OAAG,UAAS;AAAA,WACvB,GAEJ;AAAA,QAEF,QAAQ,EAAE,SAAS,EAAE,SAAS,SAAS,EAAE;AAAA,QACzC,MAAK;AAAA,QACL,SAAS,CAAC,MAAM,EAAE,gBAAgB;AAAA,QACjC,GAAG;AAAA,QAEJ,+BAAC,SACE;AAAA;AAAA,UAED;AAAA,YAAC;AAAA;AAAA,cACC,SAAS,MAAM;AACb,0BAAU,UAAU,UAAU,WAAW;AACzC,qCAAqB;AAAA,cACvB;AAAA,cACA,OAAO,EAAE,QAAQ,UAAU;AAAA,cAC5B;AAAA;AAAA,gBACc,oBAAC,OAAG,uBAAY;AAAA,gBAAI;AAAA,iBAC/B,SAAS,OAAO,WAAW,OAAO;AAAA,gBAElC,SAAS,OAAO,WAAW,mBAAmB,MAC9C,oBAAC,QAAK,IAAG,MAAK,GAAE,UAAS,uDAEzB;AAAA;AAAA;AAAA,UAEJ;AAAA,UAEA;AAAA,YAAC;AAAA;AAAA,cACC,OAAO;AAAA,cACP,UAAU,CAAC,MAAM,SAAS,EAAE,OAAO,KAAK;AAAA,cACxC,OAAO,UAAU,cAAc,SAAY;AAAA;AAAA,UAC7C;AAAA,UAEC;AAAA,UAED,oBAAC,SAAM,SAAQ,OACb;AAAA,YAAC;AAAA;AAAA,cACC,SAAQ;AAAA,cACR,GAAG,EAAE,MAAM,QAAQ,IAAI,IAAI;AAAA,cAC3B,KAAI;AAAA,cACJ,cACE,UAAU,oBAAC,UAAO,OAAM,SAAQ,MAAK,QAAO,IAAK;AAAA,cAEnD,UAAU,WAAW,YAAY,UAAU;AAAA,cAC3C,SAAS,CAAC,MAAM;AACd,kBAAE,gBAAgB;AAClB,4BAAY,UAAU,EAAE,KAAK,MAAM,MAAM,CAAC,IAAI,MAAM;AAAA,cACtD;AAAA,cACC,GAAG;AAAA,cAEH,kCAAwB;AAAA;AAAA,UAC3B,GACF;AAAA,WACF;AAAA;AAAA,IACF;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,SAAS,CAAC,MAAM;AACd,YAAE,gBAAgB;AAClB,eAAK;AAAA,QACP;AAAA,QACA,SAAQ;AAAA,QACR,GAAG,EAAE,MAAM,QAAQ,IAAI,IAAI;AAAA,QAC3B,KAAI;AAAA,QACJ,cACE,eAAe,SAAY,UACzB,oBAAC,UAAO,OAAM,SAAQ,MAAK,QAAO,IAElC;AAAA,QAGJ,SAAS,eAAe,UAAU;AAAA,QAClC,UAAU,YAAY;AAAA,QACrB,GAAG;AAAA,QAEH;AAAA;AAAA,IACH;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var copy_button_exports = {};
|
|
20
|
+
__export(copy_button_exports, {
|
|
21
|
+
CopyButton: () => CopyButton,
|
|
22
|
+
sendCopyNotification: () => sendCopyNotification
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(copy_button_exports);
|
|
25
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
+
var import_core = require("@mantine/core");
|
|
27
|
+
var import_notifications = require("@mantine/notifications");
|
|
28
|
+
var import_lucide_react = require("lucide-react");
|
|
29
|
+
function CopyButton({
|
|
30
|
+
content,
|
|
31
|
+
icon,
|
|
32
|
+
label = "content",
|
|
33
|
+
size = "1.1rem",
|
|
34
|
+
buttonSize = "lg"
|
|
35
|
+
}) {
|
|
36
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.CopyButton, { value: content, children: ({ copied, copy }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
37
|
+
import_core.ActionIcon,
|
|
38
|
+
{
|
|
39
|
+
variant: "default",
|
|
40
|
+
onClick: (e) => {
|
|
41
|
+
e.stopPropagation();
|
|
42
|
+
copy();
|
|
43
|
+
sendCopyNotification(label);
|
|
44
|
+
},
|
|
45
|
+
size: buttonSize,
|
|
46
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Check, { size }) : icon ?? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Copy, { size })
|
|
47
|
+
}
|
|
48
|
+
) });
|
|
49
|
+
}
|
|
50
|
+
function sendCopyNotification(label = "content") {
|
|
51
|
+
if (location.origin.startsWith("https")) {
|
|
52
|
+
import_notifications.notifications.show({
|
|
53
|
+
message: `Copied ${label} to clipboard.`,
|
|
54
|
+
color: "green"
|
|
55
|
+
});
|
|
56
|
+
} else {
|
|
57
|
+
import_notifications.notifications.show({
|
|
58
|
+
message: "Cannot copy to clipboard without HTTPS.",
|
|
59
|
+
color: "red"
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
64
|
+
0 && (module.exports = {
|
|
65
|
+
CopyButton,
|
|
66
|
+
sendCopyNotification
|
|
67
|
+
});
|
|
68
|
+
//# sourceMappingURL=copy-button.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/copy-button.tsx"],"sourcesContent":["import {\n ActionIcon,\n ActionIconProps,\n CopyButton as MantineCopyButton,\n} from \"@mantine/core\";\nimport { notifications } from \"@mantine/notifications\";\nimport { Check, Copy } from \"lucide-react\";\nimport { ReactNode } from \"react\";\n\nexport interface CopyButtonProps {\n content: string;\n icon?: ReactNode;\n label?: string;\n size?: string | number;\n buttonSize?: ActionIconProps[\"size\"];\n}\n\nexport function CopyButton({\n content,\n icon,\n label = \"content\",\n size = \"1.1rem\",\n buttonSize = \"lg\",\n}: CopyButtonProps) {\n return (\n <MantineCopyButton value={content}>\n {({ copied, copy }) => (\n <ActionIcon\n variant=\"default\"\n onClick={(e) => {\n e.stopPropagation();\n copy();\n sendCopyNotification(label);\n }}\n size={buttonSize}\n >\n {copied ? <Check size={size} /> : (icon ?? <Copy size={size} />)}\n </ActionIcon>\n )}\n </MantineCopyButton>\n );\n}\n\nexport function sendCopyNotification(label = \"content\") {\n if (location.origin.startsWith(\"https\")) {\n notifications.show({\n message: `Copied ${label} to clipboard.`,\n color: \"green\",\n });\n } else {\n notifications.show({\n message: \"Cannot copy to clipboard without HTTPS.\",\n color: \"red\",\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoCoB;AApCpB,kBAIO;AACP,2BAA8B;AAC9B,0BAA4B;AAWrB,SAAS,WAAW;AAAA,EACzB;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,aAAa;AACf,GAAoB;AAClB,SACE,4CAAC,YAAAA,YAAA,EAAkB,OAAO,SACvB,WAAC,EAAE,QAAQ,KAAK,MACf;AAAA,IAAC;AAAA;AAAA,MACC,SAAQ;AAAA,MACR,SAAS,CAAC,MAAM;AACd,UAAE,gBAAgB;AAClB,aAAK;AACL,6BAAqB,KAAK;AAAA,MAC5B;AAAA,MACA,MAAM;AAAA,MAEL,mBAAS,4CAAC,6BAAM,MAAY,IAAM,QAAQ,4CAAC,4BAAK,MAAY;AAAA;AAAA,EAC/D,GAEJ;AAEJ;AAEO,SAAS,qBAAqB,QAAQ,WAAW;AACtD,MAAI,SAAS,OAAO,WAAW,OAAO,GAAG;AACvC,uCAAc,KAAK;AAAA,MACjB,SAAS,UAAU,KAAK;AAAA,MACxB,OAAO;AAAA,IACT,CAAC;AAAA,EACH,OAAO;AACL,uCAAc,KAAK;AAAA,MACjB,SAAS;AAAA,MACT,OAAO;AAAA,IACT,CAAC;AAAA,EACH;AACF;","names":["MantineCopyButton"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ActionIconProps } from '@mantine/core';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
interface CopyButtonProps {
|
|
6
|
+
content: string;
|
|
7
|
+
icon?: ReactNode;
|
|
8
|
+
label?: string;
|
|
9
|
+
size?: string | number;
|
|
10
|
+
buttonSize?: ActionIconProps["size"];
|
|
11
|
+
}
|
|
12
|
+
declare function CopyButton({ content, icon, label, size, buttonSize, }: CopyButtonProps): react_jsx_runtime.JSX.Element;
|
|
13
|
+
declare function sendCopyNotification(label?: string): void;
|
|
14
|
+
|
|
15
|
+
export { CopyButton, type CopyButtonProps, sendCopyNotification };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ActionIconProps } from '@mantine/core';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
interface CopyButtonProps {
|
|
6
|
+
content: string;
|
|
7
|
+
icon?: ReactNode;
|
|
8
|
+
label?: string;
|
|
9
|
+
size?: string | number;
|
|
10
|
+
buttonSize?: ActionIconProps["size"];
|
|
11
|
+
}
|
|
12
|
+
declare function CopyButton({ content, icon, label, size, buttonSize, }: CopyButtonProps): react_jsx_runtime.JSX.Element;
|
|
13
|
+
declare function sendCopyNotification(label?: string): void;
|
|
14
|
+
|
|
15
|
+
export { CopyButton, type CopyButtonProps, sendCopyNotification };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import {
|
|
3
|
+
ActionIcon,
|
|
4
|
+
CopyButton as MantineCopyButton
|
|
5
|
+
} from "@mantine/core";
|
|
6
|
+
import { notifications } from "@mantine/notifications";
|
|
7
|
+
import { Check, Copy } from "lucide-react";
|
|
8
|
+
function CopyButton({
|
|
9
|
+
content,
|
|
10
|
+
icon,
|
|
11
|
+
label = "content",
|
|
12
|
+
size = "1.1rem",
|
|
13
|
+
buttonSize = "lg"
|
|
14
|
+
}) {
|
|
15
|
+
return /* @__PURE__ */ jsx(MantineCopyButton, { value: content, children: ({ copied, copy }) => /* @__PURE__ */ jsx(
|
|
16
|
+
ActionIcon,
|
|
17
|
+
{
|
|
18
|
+
variant: "default",
|
|
19
|
+
onClick: (e) => {
|
|
20
|
+
e.stopPropagation();
|
|
21
|
+
copy();
|
|
22
|
+
sendCopyNotification(label);
|
|
23
|
+
},
|
|
24
|
+
size: buttonSize,
|
|
25
|
+
children: copied ? /* @__PURE__ */ jsx(Check, { size }) : icon ?? /* @__PURE__ */ jsx(Copy, { size })
|
|
26
|
+
}
|
|
27
|
+
) });
|
|
28
|
+
}
|
|
29
|
+
function sendCopyNotification(label = "content") {
|
|
30
|
+
if (location.origin.startsWith("https")) {
|
|
31
|
+
notifications.show({
|
|
32
|
+
message: `Copied ${label} to clipboard.`,
|
|
33
|
+
color: "green"
|
|
34
|
+
});
|
|
35
|
+
} else {
|
|
36
|
+
notifications.show({
|
|
37
|
+
message: "Cannot copy to clipboard without HTTPS.",
|
|
38
|
+
color: "red"
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
CopyButton,
|
|
44
|
+
sendCopyNotification
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=copy-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/copy-button.tsx"],"sourcesContent":["import {\n ActionIcon,\n ActionIconProps,\n CopyButton as MantineCopyButton,\n} from \"@mantine/core\";\nimport { notifications } from \"@mantine/notifications\";\nimport { Check, Copy } from \"lucide-react\";\nimport { ReactNode } from \"react\";\n\nexport interface CopyButtonProps {\n content: string;\n icon?: ReactNode;\n label?: string;\n size?: string | number;\n buttonSize?: ActionIconProps[\"size\"];\n}\n\nexport function CopyButton({\n content,\n icon,\n label = \"content\",\n size = \"1.1rem\",\n buttonSize = \"lg\",\n}: CopyButtonProps) {\n return (\n <MantineCopyButton value={content}>\n {({ copied, copy }) => (\n <ActionIcon\n variant=\"default\"\n onClick={(e) => {\n e.stopPropagation();\n copy();\n sendCopyNotification(label);\n }}\n size={buttonSize}\n >\n {copied ? <Check size={size} /> : (icon ?? <Copy size={size} />)}\n </ActionIcon>\n )}\n </MantineCopyButton>\n );\n}\n\nexport function sendCopyNotification(label = \"content\") {\n if (location.origin.startsWith(\"https\")) {\n notifications.show({\n message: `Copied ${label} to clipboard.`,\n color: \"green\",\n });\n } else {\n notifications.show({\n message: \"Cannot copy to clipboard without HTTPS.\",\n color: \"red\",\n });\n }\n}\n"],"mappings":"AAoCoB;AApCpB;AAAA,EACE;AAAA,EAEA,cAAc;AAAA,OACT;AACP,SAAS,qBAAqB;AAC9B,SAAS,OAAO,YAAY;AAWrB,SAAS,WAAW;AAAA,EACzB;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,aAAa;AACf,GAAoB;AAClB,SACE,oBAAC,qBAAkB,OAAO,SACvB,WAAC,EAAE,QAAQ,KAAK,MACf;AAAA,IAAC;AAAA;AAAA,MACC,SAAQ;AAAA,MACR,SAAS,CAAC,MAAM;AACd,UAAE,gBAAgB;AAClB,aAAK;AACL,6BAAqB,KAAK;AAAA,MAC5B;AAAA,MACA,MAAM;AAAA,MAEL,mBAAS,oBAAC,SAAM,MAAY,IAAM,QAAQ,oBAAC,QAAK,MAAY;AAAA;AAAA,EAC/D,GAEJ;AAEJ;AAEO,SAAS,qBAAqB,QAAQ,WAAW;AACtD,MAAI,SAAS,OAAO,WAAW,OAAO,GAAG;AACvC,kBAAc,KAAK;AAAA,MACjB,SAAS,UAAU,KAAK;AAAA,MACxB,OAAO;AAAA,IACT,CAAC;AAAA,EACH,OAAO;AACL,kBAAc,KAAK;AAAA,MACjB,SAAS;AAAA,MACT,OAAO;AAAA,IACT,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var copy_text_exports = {};
|
|
20
|
+
__export(copy_text_exports, {
|
|
21
|
+
CopyText: () => CopyText
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(copy_text_exports);
|
|
24
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
+
var import_core = require("@mantine/core");
|
|
26
|
+
var import_copy_button = require("./copy-button");
|
|
27
|
+
function CopyText({
|
|
28
|
+
content,
|
|
29
|
+
label,
|
|
30
|
+
groupProps,
|
|
31
|
+
...textProps
|
|
32
|
+
}) {
|
|
33
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.Group, { gap: "sm", wrap: "nowrap", ...groupProps, children: [
|
|
34
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
35
|
+
import_core.Text,
|
|
36
|
+
{
|
|
37
|
+
title: content,
|
|
38
|
+
w: { base: 230, lg: 330 },
|
|
39
|
+
p: "xs",
|
|
40
|
+
bdrs: "sm",
|
|
41
|
+
style: {
|
|
42
|
+
overflow: "hidden",
|
|
43
|
+
whiteSpace: "nowrap",
|
|
44
|
+
cursor: "pointer"
|
|
45
|
+
},
|
|
46
|
+
className: "text-ellipsis bordered-light",
|
|
47
|
+
size: "sm",
|
|
48
|
+
onClick: () => {
|
|
49
|
+
navigator.clipboard.writeText(content);
|
|
50
|
+
(0, import_copy_button.sendCopyNotification)(label);
|
|
51
|
+
},
|
|
52
|
+
...textProps,
|
|
53
|
+
children: content
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_copy_button.CopyButton, { content })
|
|
57
|
+
] });
|
|
58
|
+
}
|
|
59
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
60
|
+
0 && (module.exports = {
|
|
61
|
+
CopyText
|
|
62
|
+
});
|
|
63
|
+
//# sourceMappingURL=copy-text.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/copy-text.tsx"],"sourcesContent":["import { Group, GroupProps, Text, TextProps } from \"@mantine/core\";\nimport { CopyButton, sendCopyNotification } from \"./copy-button\";\n\nexport interface CopyTextProps extends TextProps {\n content: string;\n label?: string;\n groupProps?: GroupProps;\n}\n\nexport function CopyText({\n content,\n label,\n groupProps,\n ...textProps\n}: CopyTextProps) {\n return (\n <Group gap=\"sm\" wrap=\"nowrap\" {...groupProps}>\n <Text\n title={content}\n w={{ base: 230, lg: 330 }}\n p=\"xs\"\n bdrs=\"sm\"\n style={{\n overflow: \"hidden\",\n whiteSpace: \"nowrap\",\n cursor: \"pointer\",\n }}\n className=\"text-ellipsis bordered-light\"\n size=\"sm\"\n onClick={() => {\n navigator.clipboard.writeText(content);\n sendCopyNotification(label);\n }}\n {...textProps}\n >\n {content}\n </Text>\n <CopyButton content={content} />\n </Group>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBI;AAhBJ,kBAAmD;AACnD,yBAAiD;AAQ1C,SAAS,SAAS;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAkB;AAChB,SACE,6CAAC,qBAAM,KAAI,MAAK,MAAK,UAAU,GAAG,YAChC;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,OAAO;AAAA,QACP,GAAG,EAAE,MAAM,KAAK,IAAI,IAAI;AAAA,QACxB,GAAE;AAAA,QACF,MAAK;AAAA,QACL,OAAO;AAAA,UACL,UAAU;AAAA,UACV,YAAY;AAAA,UACZ,QAAQ;AAAA,QACV;AAAA,QACA,WAAU;AAAA,QACV,MAAK;AAAA,QACL,SAAS,MAAM;AACb,oBAAU,UAAU,UAAU,OAAO;AACrC,uDAAqB,KAAK;AAAA,QAC5B;AAAA,QACC,GAAG;AAAA,QAEH;AAAA;AAAA,IACH;AAAA,IACA,4CAAC,iCAAW,SAAkB;AAAA,KAChC;AAEJ;","names":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { TextProps, GroupProps } from '@mantine/core';
|
|
3
|
+
|
|
4
|
+
interface CopyTextProps extends TextProps {
|
|
5
|
+
content: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
groupProps?: GroupProps;
|
|
8
|
+
}
|
|
9
|
+
declare function CopyText({ content, label, groupProps, ...textProps }: CopyTextProps): react_jsx_runtime.JSX.Element;
|
|
10
|
+
|
|
11
|
+
export { CopyText, type CopyTextProps };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { TextProps, GroupProps } from '@mantine/core';
|
|
3
|
+
|
|
4
|
+
interface CopyTextProps extends TextProps {
|
|
5
|
+
content: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
groupProps?: GroupProps;
|
|
8
|
+
}
|
|
9
|
+
declare function CopyText({ content, label, groupProps, ...textProps }: CopyTextProps): react_jsx_runtime.JSX.Element;
|
|
10
|
+
|
|
11
|
+
export { CopyText, type CopyTextProps };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Group, Text } from "@mantine/core";
|
|
3
|
+
import { CopyButton, sendCopyNotification } from "./copy-button";
|
|
4
|
+
function CopyText({
|
|
5
|
+
content,
|
|
6
|
+
label,
|
|
7
|
+
groupProps,
|
|
8
|
+
...textProps
|
|
9
|
+
}) {
|
|
10
|
+
return /* @__PURE__ */ jsxs(Group, { gap: "sm", wrap: "nowrap", ...groupProps, children: [
|
|
11
|
+
/* @__PURE__ */ jsx(
|
|
12
|
+
Text,
|
|
13
|
+
{
|
|
14
|
+
title: content,
|
|
15
|
+
w: { base: 230, lg: 330 },
|
|
16
|
+
p: "xs",
|
|
17
|
+
bdrs: "sm",
|
|
18
|
+
style: {
|
|
19
|
+
overflow: "hidden",
|
|
20
|
+
whiteSpace: "nowrap",
|
|
21
|
+
cursor: "pointer"
|
|
22
|
+
},
|
|
23
|
+
className: "text-ellipsis bordered-light",
|
|
24
|
+
size: "sm",
|
|
25
|
+
onClick: () => {
|
|
26
|
+
navigator.clipboard.writeText(content);
|
|
27
|
+
sendCopyNotification(label);
|
|
28
|
+
},
|
|
29
|
+
...textProps,
|
|
30
|
+
children: content
|
|
31
|
+
}
|
|
32
|
+
),
|
|
33
|
+
/* @__PURE__ */ jsx(CopyButton, { content })
|
|
34
|
+
] });
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
CopyText
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=copy-text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/copy-text.tsx"],"sourcesContent":["import { Group, GroupProps, Text, TextProps } from \"@mantine/core\";\nimport { CopyButton, sendCopyNotification } from \"./copy-button\";\n\nexport interface CopyTextProps extends TextProps {\n content: string;\n label?: string;\n groupProps?: GroupProps;\n}\n\nexport function CopyText({\n content,\n label,\n groupProps,\n ...textProps\n}: CopyTextProps) {\n return (\n <Group gap=\"sm\" wrap=\"nowrap\" {...groupProps}>\n <Text\n title={content}\n w={{ base: 230, lg: 330 }}\n p=\"xs\"\n bdrs=\"sm\"\n style={{\n overflow: \"hidden\",\n whiteSpace: \"nowrap\",\n cursor: \"pointer\",\n }}\n className=\"text-ellipsis bordered-light\"\n size=\"sm\"\n onClick={() => {\n navigator.clipboard.writeText(content);\n sendCopyNotification(label);\n }}\n {...textProps}\n >\n {content}\n </Text>\n <CopyButton content={content} />\n </Group>\n );\n}\n"],"mappings":"AAgBI,SACE,KADF;AAhBJ,SAAS,OAAmB,YAAuB;AACnD,SAAS,YAAY,4BAA4B;AAQ1C,SAAS,SAAS;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAkB;AAChB,SACE,qBAAC,SAAM,KAAI,MAAK,MAAK,UAAU,GAAG,YAChC;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,OAAO;AAAA,QACP,GAAG,EAAE,MAAM,KAAK,IAAI,IAAI;AAAA,QACxB,GAAE;AAAA,QACF,MAAK;AAAA,QACL,OAAO;AAAA,UACL,UAAU;AAAA,UACV,YAAY;AAAA,UACZ,QAAQ;AAAA,QACV;AAAA,QACA,WAAU;AAAA,QACV,MAAK;AAAA,QACL,SAAS,MAAM;AACb,oBAAU,UAAU,UAAU,OAAO;AACrC,+BAAqB,KAAK;AAAA,QAC5B;AAAA,QACC,GAAG;AAAA,QAEH;AAAA;AAAA,IACH;AAAA,IACA,oBAAC,cAAW,SAAkB;AAAA,KAChC;AAEJ;","names":[]}
|