@nice2dev/ui 1.2.0 → 1.2.2
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/CHANGELOG.md +150 -0
- package/dist/NiceApiExplorer.doc-CFJndg5h.js +25 -0
- package/dist/NiceApiExplorer.doc-TEx67kV5.cjs +1 -0
- package/dist/NiceBPMNDesigner.doc-6lK1pXRq.js +32 -0
- package/dist/NiceBPMNDesigner.doc-BY8t7qOi.cjs +8 -0
- package/dist/NiceBackupDiffViewer.doc-CYvOeX19.js +25 -0
- package/dist/NiceBackupDiffViewer.doc-ChQaZCg1.cjs +1 -0
- package/dist/NiceBackupList.doc-BdQCw0_D.cjs +1 -0
- package/dist/NiceBackupList.doc-BwjIAoqz.js +25 -0
- package/dist/NiceBackupRestoreDialog.doc-B2iiqTps.cjs +1 -0
- package/dist/NiceBackupRestoreDialog.doc-DuXSGJiD.js +25 -0
- package/dist/NiceBackupScheduler.doc-BpY45181.js +31 -0
- package/dist/NiceBackupScheduler.doc-ByeL3iH1.cjs +7 -0
- package/dist/NiceBackupStatusBadge.doc-BA3dYgiW.cjs +1 -0
- package/dist/NiceBackupStatusBadge.doc-CxwkVarP.js +25 -0
- package/dist/NiceBackupTagEditor.doc-Bej1KHco.cjs +7 -0
- package/dist/NiceBackupTagEditor.doc-CNy4uNws.js +31 -0
- package/dist/NiceBottomSheet.doc-keq-Fzlz.cjs +8 -0
- package/dist/NiceBottomSheet.doc-v-UPUKQk.js +32 -0
- package/dist/NiceBranchManager.doc-BTyRjX7X.cjs +6 -0
- package/dist/NiceBranchManager.doc-Cz4SyEqE.js +30 -0
- package/dist/NiceButton-3AcJJ15c.cjs +1 -0
- package/dist/NiceButton-vkI07DP0.js +88 -0
- package/dist/NiceCodeEditor-C43xFG8v.cjs +260 -0
- package/dist/NiceCodeEditor-CspuYLh6.js +1174 -0
- package/dist/NiceCodeEditor-VGIDWSkS.js +1181 -0
- package/dist/NiceCodeEditor-qX39PSnQ.cjs +260 -0
- package/dist/NiceColorPicker-CQhhjZ8w.cjs +1 -0
- package/dist/NiceColorPicker-Cbop7VMu.js +491 -0
- package/dist/NiceConnectorConfigForm.doc-BKrDuhXw.cjs +7 -0
- package/dist/NiceConnectorConfigForm.doc-BsHeXz3M.js +31 -0
- package/dist/NiceDataBranchGraph.doc-Axidz41W.js +29 -0
- package/dist/NiceDataBranchGraph.doc-sjLmrrtE.cjs +5 -0
- package/dist/NiceDataBranchManager.doc-B1-Rp2X4.cjs +6 -0
- package/dist/NiceDataBranchManager.doc-GUqfTFvW.js +30 -0
- package/dist/NiceDataConflictResolver.doc-CjQryrTu.cjs +5 -0
- package/dist/NiceDataConflictResolver.doc-L-TcnQMX.js +29 -0
- package/dist/NiceDataDiffViewer.doc-BzGrf0U-.cjs +6 -0
- package/dist/NiceDataDiffViewer.doc-goxhSldH.js +30 -0
- package/dist/NiceDataGrid-BDEIbuBS.js +2218 -0
- package/dist/NiceDataGrid-CS5aB-EN.cjs +10 -0
- package/dist/NiceDataGrid-CrD4HPlO.cjs +10 -0
- package/dist/NiceDataGrid-Dfg1DVbU.js +2224 -0
- package/dist/NiceDataMapper.doc-QmnmnvVq.js +30 -0
- package/dist/NiceDataMapper.doc-ytGVtYVr.cjs +6 -0
- package/dist/NiceDataMergeBuilder.doc-BcmzKxh2.cjs +6 -0
- package/dist/NiceDataMergeBuilder.doc-BvYa4aUJ.js +30 -0
- package/dist/NiceDataSnapshot.doc-C73K1biG.cjs +6 -0
- package/dist/NiceDataSnapshot.doc-hU7wnOzM.js +30 -0
- package/dist/NiceDesktopViews.doc-DJjYlyP2.cjs +1 -0
- package/dist/NiceDesktopViews.doc-ly-VUAJj.js +25 -0
- package/dist/NiceDeviceControlCard.doc-BZIo92-w.cjs +1 -0
- package/dist/NiceDeviceControlCard.doc-DIzZcW9L.js +25 -0
- package/dist/NiceDocumentViewer-B9VIVKyw.js +726 -0
- package/dist/NiceDocumentViewer-CDXAmPp7.cjs +180 -0
- package/dist/NiceDocumentationViewer.doc-BSNGa7a_.js +25 -0
- package/dist/NiceDocumentationViewer.doc-CrwlvPFg.cjs +1 -0
- package/dist/NiceEnergyChart.doc-DW-jllDV.cjs +1 -0
- package/dist/NiceEnergyChart.doc-DnEehTff.js +25 -0
- package/dist/NiceFeatureGate.doc-DN17uS_B.cjs +3 -0
- package/dist/NiceFeatureGate.doc-DNfFSRrh.js +27 -0
- package/dist/NiceForm-BcN4p2kG.cjs +1 -0
- package/dist/NiceForm-CISJyzoW.cjs +1 -0
- package/dist/NiceForm-DmH6k1b_.js +4775 -0
- package/dist/NiceForm-tIXS-M6b.js +4770 -0
- package/dist/NiceFormItem.doc-BJwEnDz2.js +36 -0
- package/dist/NiceFormItem.doc-Ck3PgaPD.cjs +12 -0
- package/dist/NiceGantt-CHnq-n8f.cjs +1 -0
- package/dist/NiceGantt-CTbqCuwv.cjs +1 -0
- package/dist/NiceGantt-CX3jVNaF.js +330 -0
- package/dist/NiceGantt-Dao7pN9z.js +328 -0
- package/dist/NiceGantt.doc-B6YZcJvG.cjs +11 -0
- package/dist/NiceGantt.doc-DsI1QXly.js +48 -0
- package/dist/NiceGitBlame.doc-BQ2KvGkD.js +30 -0
- package/dist/NiceGitBlame.doc-DuTSjZVN.cjs +6 -0
- package/dist/NiceGitDiffViewer.doc-D24AGos_.js +30 -0
- package/dist/NiceGitDiffViewer.doc-D9FVquBC.cjs +6 -0
- package/dist/NiceGitGraph.doc-C-8VGMIz.js +29 -0
- package/dist/NiceGitGraph.doc-eRvTmefl.cjs +5 -0
- package/dist/NiceGitHooks.doc-DCTVw7HX.cjs +5 -0
- package/dist/NiceGitHooks.doc-OCFj5w6v.js +29 -0
- package/dist/NiceHtmlEditor-DUwcqj5N.cjs +10 -0
- package/dist/NiceHtmlEditor-DeK0Of98.js +883 -0
- package/dist/NiceHtmlEditor-DiAphF1k.js +889 -0
- package/dist/NiceHtmlEditor-DvVxl4Fu.cjs +10 -0
- package/dist/NiceInstanceMonitor.doc-BSDZp5xa.js +31 -0
- package/dist/NiceInstanceMonitor.doc-HVbLufnh.cjs +7 -0
- package/dist/NiceLocaleManager.doc-CbVHDEWu.js +25 -0
- package/dist/NiceLocaleManager.doc-XH6hMW0Z.cjs +1 -0
- package/dist/NiceLockButton.doc-BMhSj3TB.cjs +1 -0
- package/dist/NiceLockButton.doc-DvHGhcfm.js +25 -0
- package/dist/NiceLoginForm-CHXbz0eu.js +747 -0
- package/dist/NiceLoginForm-DQe77Isv.js +747 -0
- package/dist/NiceLoginForm-NBCo-DUZ.cjs +1 -0
- package/dist/NiceLoginForm-ix6J1adA.cjs +1 -0
- package/dist/NiceLoginForm.css +1 -1
- package/dist/NiceMAM.doc-CsQ57saR.cjs +8 -0
- package/dist/NiceMAM.doc-hjW7buTH.js +32 -0
- package/dist/NiceMention--3P3vO-W.cjs +430 -0
- package/dist/NiceMention-Co2cqkVM.js +11316 -0
- package/dist/NiceMention-DKhk3xdM.js +11321 -0
- package/dist/NiceMention-wp1AJ5oh.cjs +430 -0
- package/dist/NiceMention.css +1 -1
- package/dist/NiceModal-BbQwiEOp.cjs +1 -0
- package/dist/NiceModal-DQEfTcnZ.js +85 -0
- package/dist/NiceModuleLifecyclePanel-22CEEVbA.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-BCd9Wv5Y.js +6825 -0
- package/dist/NiceModuleLifecyclePanel-DV3F_QdI.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-gaZkIEtK.js +6825 -0
- package/dist/NiceModuleLifecyclePanel.css +1 -1
- package/dist/NiceNetworkDiscoveryPanel.doc-B0RtGaS3.js +25 -0
- package/dist/NiceNetworkDiscoveryPanel.doc-BFgFZI5G.cjs +1 -0
- package/dist/NicePagination-B3nZDZem.js +165 -0
- package/dist/NicePagination-B8rg1Y67.cjs +1 -0
- package/dist/NicePagination-BFGt1v0a.js +165 -0
- package/dist/NicePagination-DltL3-Sz.cjs +1 -0
- package/dist/NicePipelineEditor.doc-CjqDKe2x.js +29 -0
- package/dist/NicePipelineEditor.doc-DZ0pTVTp.cjs +5 -0
- package/dist/NicePipelineMonitor.doc-C88-TagI.cjs +5 -0
- package/dist/NicePipelineMonitor.doc-CFtH4XJx.js +29 -0
- package/dist/NicePivotGrid-BD87Na7P.js +1163 -0
- package/dist/NicePivotGrid-BPmnvbPQ.cjs +152 -0
- package/dist/NicePivotGrid-BaZa2YZW.js +1157 -0
- package/dist/NicePivotGrid-DyOPhPO8.cjs +152 -0
- package/dist/NiceRoomGrid.doc-DJPVUQVg.cjs +8 -0
- package/dist/NiceRoomGrid.doc-DLHJS_Wb.js +32 -0
- package/dist/NiceSavedQueryPanel-BC84uRfh.cjs +586 -0
- package/dist/NiceSavedQueryPanel-BSTiZvFg.js +5130 -0
- package/dist/NiceSavedQueryPanel-CMfcODIO.js +5120 -0
- package/dist/NiceSavedQueryPanel-DrR3sw4T.cjs +586 -0
- package/dist/NiceSavedQueryPanel.css +1 -1
- package/dist/NiceSceneBar.doc-09sc3yuF.cjs +1 -0
- package/dist/NiceSceneBar.doc-DLePMuVU.js +25 -0
- package/dist/NiceSceneSelector.doc-CPzCAy-d.cjs +7 -0
- package/dist/NiceSceneSelector.doc-FCLZvPc0.js +31 -0
- package/dist/NiceScheduler-BAJRzFQN.js +1690 -0
- package/dist/NiceScheduler-DvxJ8N0I.js +1698 -0
- package/dist/NiceScheduler-TIksdF0k.cjs +5 -0
- package/dist/NiceScheduler-dJ7gHDv7.cjs +5 -0
- package/dist/NiceSchedulerViews.doc-C9opZpgg.cjs +1 -0
- package/dist/NiceSchedulerViews.doc-Dy7ZH1iL.js +25 -0
- package/dist/NiceSelect-CZR8Zu_k.js +420 -0
- package/dist/NiceSelect-DIKGbaJo.cjs +1 -0
- package/dist/NiceSensorGaugePanel.doc-BHirbWLn.cjs +8 -0
- package/dist/NiceSensorGaugePanel.doc-DjKmooI6.js +32 -0
- package/dist/NiceSpotlight.doc-BVZFfDVI.cjs +10 -0
- package/dist/NiceSpotlight.doc-JqwkzrEm.js +34 -0
- package/dist/NiceStateDesigner.doc-CfnwiwfU.js +29 -0
- package/dist/NiceStateDesigner.doc-DV4zEC50.cjs +5 -0
- package/dist/NiceStepper.doc-5VjaLM6r.js +31 -0
- package/dist/NiceStepper.doc-f8lYpr33.cjs +7 -0
- package/dist/NiceTaskInbox.doc-CHrxthqp.js +32 -0
- package/dist/NiceTaskInbox.doc-CdCTfgBq.cjs +8 -0
- package/dist/NiceTestBuilder.doc-BoBzLfa0.js +30 -0
- package/dist/NiceTestBuilder.doc-Cj1fNTvk.cjs +6 -0
- package/dist/NiceTranscoder.doc-Dnirl3wg.cjs +7 -0
- package/dist/NiceTranscoder.doc-cInCYZh7.js +31 -0
- package/dist/NiceVideoAnnotator.doc-C1iEi7OM.cjs +7 -0
- package/dist/NiceVideoAnnotator.doc-C8zyfKH_.js +31 -0
- package/dist/NiceVideoEditor.doc-C6mhEb-q.cjs +7 -0
- package/dist/NiceVideoEditor.doc-lrwmKjqj.js +31 -0
- package/dist/NiceWindow-CWN8OCHF.js +2109 -0
- package/dist/NiceWindow-Dd8qjkIW.cjs +1 -0
- package/dist/NiceWindow.css +1 -1
- package/dist/charts-Bo2WAI5T.cjs +768 -0
- package/dist/charts-BpELGDXh.cjs +768 -0
- package/dist/charts-ByrdMeQP.js +4767 -0
- package/dist/charts-M6LuVI7F.js +4776 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.css +1 -1
- package/dist/charts.d.ts +28 -46
- package/dist/charts.mjs +1 -1
- package/dist/core-B8eBUE4m.js +438 -0
- package/dist/core-lBFqvT0V.cjs +1 -0
- package/dist/core-lazy-Bh2yg4Et.js +351 -0
- package/dist/core-lazy-CkWKjfc6.cjs +1 -0
- package/dist/core-lazy-Ctin_LwS.cjs +1 -0
- package/dist/core-lazy-iDiropM6.js +351 -0
- package/dist/data-branching-BgIAw01q.cjs +1 -0
- package/dist/data-branching-Dak1_ZKR.cjs +1 -0
- package/dist/data-branching-DiLAO4Qt.js +6386 -0
- package/dist/data-branching-bvB9K6KS.js +6386 -0
- package/dist/data-branching.cjs +1 -1
- package/dist/data-branching.mjs +1 -1
- package/dist/data.cjs +1 -1
- package/dist/data.d.ts +22 -18
- package/dist/data.mjs +3 -3
- package/dist/devops-Bp-_aA-9.js +8682 -0
- package/dist/devops-CXBSjnyX.cjs +17 -0
- package/dist/devops-DkVluHBp.cjs +17 -0
- package/dist/devops-zsMUueTd.js +8648 -0
- package/dist/devops.cjs +1 -1
- package/dist/devops.d.ts +3 -3
- package/dist/devops.mjs +1 -1
- package/dist/editors.cjs +1 -1
- package/dist/editors.d.ts +100 -38
- package/dist/editors.mjs +8 -8
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.d.ts +71 -2
- package/dist/feedback.mjs +10 -9
- package/dist/index.cjs +263 -263
- package/dist/index.css +1 -1
- package/dist/index.d.ts +641 -253
- package/dist/index.mjs +26438 -26260
- package/dist/injectStyleOnce-BzC_BCs_.js +9 -0
- package/dist/injectStyleOnce-DeWaxcdf.cjs +1 -0
- package/dist/lazy.cjs +1 -1
- package/dist/lazy.d.ts +9 -7
- package/dist/lazy.mjs +51 -51
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.css +1 -0
- package/dist/navigation.d.ts +99 -43
- package/dist/navigation.mjs +504 -547
- package/dist/no-code-BNFk_BDO.js +8275 -0
- package/dist/no-code-CFdTp543.cjs +331 -0
- package/dist/no-code-DiTEnuRv.js +8288 -0
- package/dist/no-code-wG9c0z_T.cjs +331 -0
- package/dist/no-code.cjs +1 -1
- package/dist/no-code.css +1 -1
- package/dist/no-code.mjs +1 -1
- package/dist/overlays.cjs +1 -1
- package/dist/overlays.d.ts +12 -6
- package/dist/overlays.mjs +1 -1
- package/dist/pickerCommons-BCRiHDE_.cjs +1 -0
- package/dist/pickerCommons-CMxFt9SW.js +548 -0
- package/dist/pickerCommons-Dc_hlz-e.cjs +1 -0
- package/dist/pickerCommons-DkumQ3KE.js +548 -0
- package/dist/style.css +12 -9
- package/package.json +3 -3
|
@@ -0,0 +1,2109 @@
|
|
|
1
|
+
import { jsxs as E, Fragment as _e, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useNiceTranslation as ge, useComponentDisplayClass as xt, NiceIcon as ce, useFocusTrap as Ve, triggerHaptic as Xe, useClickOutside as tt, usePan as Nt, NiceThemeContext as kt, useControlId as Ge, sanitizeHtml as Et, useNiceAccessMode as Mt } from "@nice2dev/ui-core";
|
|
3
|
+
import Tt, { useRef as K, useState as Y, useCallback as k, useEffect as q, useContext as Qe, useReducer as zt, useMemo as Pe, createContext as nt, forwardRef as Ze } from "react";
|
|
4
|
+
import { createPortal as Me } from "react-dom";
|
|
5
|
+
const It = [], Zt = ({
|
|
6
|
+
visible: e,
|
|
7
|
+
onClose: n,
|
|
8
|
+
title: r,
|
|
9
|
+
items: o = It,
|
|
10
|
+
showCancelButton: d = !0,
|
|
11
|
+
cancelText: l,
|
|
12
|
+
size: u = "md",
|
|
13
|
+
disabled: w,
|
|
14
|
+
readOnly: m,
|
|
15
|
+
loading: N,
|
|
16
|
+
error: M,
|
|
17
|
+
className: C,
|
|
18
|
+
style: L
|
|
19
|
+
}) => {
|
|
20
|
+
const { t: a } = ge();
|
|
21
|
+
if (!e)
|
|
22
|
+
return null;
|
|
23
|
+
const f = w || N || m;
|
|
24
|
+
return /* @__PURE__ */ E(_e, { children: [
|
|
25
|
+
/* @__PURE__ */ t("div", { className: "nice-actionsheet__overlay", onClick: n }),
|
|
26
|
+
/* @__PURE__ */ E(
|
|
27
|
+
"div",
|
|
28
|
+
{
|
|
29
|
+
className: `nice-actionsheet nice-actionsheet--${u} ${w ? "nice-actionsheet--disabled" : ""} ${m ? "nice-actionsheet--readonly" : ""} ${N ? "nice-actionsheet--loading" : ""} ${M ? "nice-actionsheet--error" : ""} ${C || ""}`,
|
|
30
|
+
style: L,
|
|
31
|
+
"aria-disabled": w || void 0,
|
|
32
|
+
"aria-readonly": m || void 0,
|
|
33
|
+
"aria-busy": N || void 0,
|
|
34
|
+
children: [
|
|
35
|
+
M && /* @__PURE__ */ t("div", { className: "nice-actionsheet__error", role: "alert", children: M }),
|
|
36
|
+
N && /* @__PURE__ */ t("span", { className: "nice-actionsheet__spinner", "aria-hidden": "true", children: /* @__PURE__ */ t("span", { className: "nice-spinner nice-spinner--sm" }) }),
|
|
37
|
+
r && /* @__PURE__ */ t("div", { className: "nice-actionsheet__title", children: r }),
|
|
38
|
+
/* @__PURE__ */ t("div", { className: "nice-actionsheet__items", children: o.map((_, h) => /* @__PURE__ */ E(
|
|
39
|
+
"button",
|
|
40
|
+
{
|
|
41
|
+
className: `nice-actionsheet__item ${_.type === "danger" ? "nice-actionsheet__item--danger" : ""}`,
|
|
42
|
+
disabled: _.disabled || f,
|
|
43
|
+
onClick: () => {
|
|
44
|
+
f || (_.onClick?.(), n());
|
|
45
|
+
},
|
|
46
|
+
children: [
|
|
47
|
+
_.icon && /* @__PURE__ */ t("span", { className: "nice-actionsheet__icon", children: _.icon }),
|
|
48
|
+
_.text
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
h
|
|
52
|
+
)) }),
|
|
53
|
+
d && /* @__PURE__ */ t("button", { className: "nice-actionsheet__cancel", onClick: n, children: l || a("cancel", "Cancel") })
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
] });
|
|
58
|
+
}, Jt = ({
|
|
59
|
+
visible: e,
|
|
60
|
+
onClose: n,
|
|
61
|
+
targetRef: r,
|
|
62
|
+
position: o = "bottom",
|
|
63
|
+
title: d,
|
|
64
|
+
showArrow: l = !0,
|
|
65
|
+
width: u,
|
|
66
|
+
children: w,
|
|
67
|
+
className: m,
|
|
68
|
+
style: N,
|
|
69
|
+
displayStyle: M
|
|
70
|
+
}) => {
|
|
71
|
+
xt("tooltip", M);
|
|
72
|
+
const C = K(null), [L, a] = Y({ top: 0, left: 0 }), f = k(() => {
|
|
73
|
+
const _ = r.current, h = C.current;
|
|
74
|
+
if (!_ || !h)
|
|
75
|
+
return;
|
|
76
|
+
const c = _.getBoundingClientRect(), b = h.getBoundingClientRect();
|
|
77
|
+
let p = 0, x = 0;
|
|
78
|
+
const P = 8;
|
|
79
|
+
switch (o) {
|
|
80
|
+
case "top":
|
|
81
|
+
p = c.top - b.height - P, x = c.left + (c.width - b.width) / 2;
|
|
82
|
+
break;
|
|
83
|
+
case "bottom":
|
|
84
|
+
p = c.bottom + P, x = c.left + (c.width - b.width) / 2;
|
|
85
|
+
break;
|
|
86
|
+
case "left":
|
|
87
|
+
p = c.top + (c.height - b.height) / 2, x = c.left - b.width - P;
|
|
88
|
+
break;
|
|
89
|
+
case "right":
|
|
90
|
+
p = c.top + (c.height - b.height) / 2, x = c.right + P;
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
a({ top: p + window.scrollY, left: x + window.scrollX });
|
|
94
|
+
}, [r, o]);
|
|
95
|
+
return q(() => {
|
|
96
|
+
if (e) {
|
|
97
|
+
requestAnimationFrame(f);
|
|
98
|
+
const _ = (h) => {
|
|
99
|
+
C.current && !C.current.contains(h.target) && r.current && !r.current.contains(h.target) && n();
|
|
100
|
+
};
|
|
101
|
+
return document.addEventListener("mousedown", _), () => document.removeEventListener("mousedown", _);
|
|
102
|
+
}
|
|
103
|
+
}, [e, f, n, r]), e ? /* @__PURE__ */ E(
|
|
104
|
+
"div",
|
|
105
|
+
{
|
|
106
|
+
ref: C,
|
|
107
|
+
className: `nice-popover nice-popover--${o} ${m || ""}`,
|
|
108
|
+
style: { ...N, position: "absolute", top: L.top, left: L.left, width: u },
|
|
109
|
+
children: [
|
|
110
|
+
l && /* @__PURE__ */ t("div", { className: `nice-popover__arrow nice-popover__arrow--${o}` }),
|
|
111
|
+
d && /* @__PURE__ */ t("div", { className: "nice-popover__title", children: d }),
|
|
112
|
+
/* @__PURE__ */ t("div", { className: "nice-popover__content", children: w })
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
) : null;
|
|
116
|
+
}, en = ({
|
|
117
|
+
visible: e,
|
|
118
|
+
message: n,
|
|
119
|
+
container: r,
|
|
120
|
+
showIndicator: o = !0,
|
|
121
|
+
shading: d = !0,
|
|
122
|
+
className: l,
|
|
123
|
+
style: u
|
|
124
|
+
}) => {
|
|
125
|
+
const { t: w } = ge();
|
|
126
|
+
if (!e)
|
|
127
|
+
return null;
|
|
128
|
+
const m = !!r?.current, N = /* @__PURE__ */ E("div", { className: `nice-loadpanel ${l || ""}`, style: u, children: [
|
|
129
|
+
d && /* @__PURE__ */ t("div", { className: "nice-loadpanel__shade" }),
|
|
130
|
+
/* @__PURE__ */ E("div", { className: "nice-loadpanel__box", children: [
|
|
131
|
+
o && /* @__PURE__ */ t("div", { className: "nice-spinner nice-spinner--md" }),
|
|
132
|
+
/* @__PURE__ */ t("span", { className: "nice-loadpanel__text", children: n || w("loading", "Loading...") })
|
|
133
|
+
] })
|
|
134
|
+
] });
|
|
135
|
+
if (m && r.current) {
|
|
136
|
+
const M = r.current;
|
|
137
|
+
return M.style.position = M.style.position || "relative", N;
|
|
138
|
+
}
|
|
139
|
+
return N;
|
|
140
|
+
}, tn = ({
|
|
141
|
+
direction: e = "row",
|
|
142
|
+
align: n,
|
|
143
|
+
justify: r,
|
|
144
|
+
wrap: o,
|
|
145
|
+
gap: d,
|
|
146
|
+
flex: l,
|
|
147
|
+
children: u,
|
|
148
|
+
className: w,
|
|
149
|
+
style: m
|
|
150
|
+
}) => /* @__PURE__ */ t(
|
|
151
|
+
"div",
|
|
152
|
+
{
|
|
153
|
+
className: `nice-box ${w || ""}`,
|
|
154
|
+
style: {
|
|
155
|
+
display: "flex",
|
|
156
|
+
flexDirection: e,
|
|
157
|
+
alignItems: n,
|
|
158
|
+
justifyContent: r,
|
|
159
|
+
flexWrap: o ? "wrap" : void 0,
|
|
160
|
+
gap: d,
|
|
161
|
+
flex: l,
|
|
162
|
+
...m
|
|
163
|
+
},
|
|
164
|
+
children: u
|
|
165
|
+
}
|
|
166
|
+
), Ct = [], nn = ({
|
|
167
|
+
direction: e = "row",
|
|
168
|
+
items: n = Ct,
|
|
169
|
+
gap: r,
|
|
170
|
+
className: o,
|
|
171
|
+
style: d
|
|
172
|
+
}) => /* @__PURE__ */ t(
|
|
173
|
+
"div",
|
|
174
|
+
{
|
|
175
|
+
className: `nice-responsivebox ${o || ""}`,
|
|
176
|
+
style: { display: "flex", flexDirection: e, gap: r, ...d },
|
|
177
|
+
children: n.map((l, u) => /* @__PURE__ */ t(
|
|
178
|
+
"div",
|
|
179
|
+
{
|
|
180
|
+
style: { flex: l.ratio ?? 1, flexBasis: l.baseSize, flexShrink: l.shrink ?? 1 },
|
|
181
|
+
children: l.children
|
|
182
|
+
},
|
|
183
|
+
u
|
|
184
|
+
))
|
|
185
|
+
}
|
|
186
|
+
), on = ({
|
|
187
|
+
width: e = 200,
|
|
188
|
+
height: n = 200,
|
|
189
|
+
minWidth: r = 50,
|
|
190
|
+
minHeight: o = 50,
|
|
191
|
+
maxWidth: d = 1 / 0,
|
|
192
|
+
maxHeight: l = 1 / 0,
|
|
193
|
+
handles: u = ["right", "bottom", "bottomRight"],
|
|
194
|
+
onResize: w,
|
|
195
|
+
children: m,
|
|
196
|
+
className: N,
|
|
197
|
+
style: M
|
|
198
|
+
}) => {
|
|
199
|
+
const [C, L] = Y({ width: e, height: n }), a = K(null), f = (c, b) => {
|
|
200
|
+
b.preventDefault();
|
|
201
|
+
const p = b.clientX, x = b.clientY, P = C.width, z = C.height, y = {
|
|
202
|
+
n: "top",
|
|
203
|
+
s: "bottom",
|
|
204
|
+
e: "right",
|
|
205
|
+
w: "left",
|
|
206
|
+
ne: "topRight",
|
|
207
|
+
se: "bottomRight",
|
|
208
|
+
sw: "bottomLeft",
|
|
209
|
+
nw: "topLeft"
|
|
210
|
+
}[c] ?? c, i = y === "right" || y === "topRight" || y === "bottomRight", v = y === "left" || y === "topLeft" || y === "bottomLeft", I = y === "bottom" || y === "bottomRight" || y === "bottomLeft", T = y === "top" || y === "topRight" || y === "topLeft", D = (O) => {
|
|
211
|
+
const g = O.clientX - p, $ = O.clientY - x;
|
|
212
|
+
let s = P, B = z;
|
|
213
|
+
i && (s = P + g), v && (s = P - g), I && (B = z + $), T && (B = z - $), s = Math.max(r, Math.min(d, s)), B = Math.max(o, Math.min(l, B)), L({ width: s, height: B }), w?.({ width: s, height: B });
|
|
214
|
+
}, R = () => {
|
|
215
|
+
document.removeEventListener("pointermove", D), document.removeEventListener("pointerup", R);
|
|
216
|
+
};
|
|
217
|
+
document.addEventListener("pointermove", D), document.addEventListener("pointerup", R);
|
|
218
|
+
}, _ = (c) => {
|
|
219
|
+
switch (c) {
|
|
220
|
+
case "top":
|
|
221
|
+
case "bottom":
|
|
222
|
+
return "ns-resize";
|
|
223
|
+
case "left":
|
|
224
|
+
case "right":
|
|
225
|
+
return "ew-resize";
|
|
226
|
+
case "topLeft":
|
|
227
|
+
case "bottomRight":
|
|
228
|
+
return "nwse-resize";
|
|
229
|
+
case "topRight":
|
|
230
|
+
case "bottomLeft":
|
|
231
|
+
return "nesw-resize";
|
|
232
|
+
default:
|
|
233
|
+
return "default";
|
|
234
|
+
}
|
|
235
|
+
}, h = (c) => {
|
|
236
|
+
const b = { position: "absolute", zIndex: 1 }, p = 8;
|
|
237
|
+
return c === "right" ? {
|
|
238
|
+
...b,
|
|
239
|
+
top: 0,
|
|
240
|
+
right: -p / 2,
|
|
241
|
+
width: p,
|
|
242
|
+
height: "100%",
|
|
243
|
+
cursor: _(c)
|
|
244
|
+
} : c === "bottom" ? {
|
|
245
|
+
...b,
|
|
246
|
+
left: 0,
|
|
247
|
+
bottom: -p / 2,
|
|
248
|
+
width: "100%",
|
|
249
|
+
height: p,
|
|
250
|
+
cursor: _(c)
|
|
251
|
+
} : c === "left" ? { ...b, top: 0, left: -p / 2, width: p, height: "100%", cursor: _(c) } : c === "top" ? { ...b, top: -p / 2, left: 0, width: "100%", height: p, cursor: _(c) } : c === "bottomRight" ? {
|
|
252
|
+
...b,
|
|
253
|
+
bottom: -p / 2,
|
|
254
|
+
right: -p / 2,
|
|
255
|
+
width: p * 2,
|
|
256
|
+
height: p * 2,
|
|
257
|
+
cursor: _(c)
|
|
258
|
+
} : c === "bottomLeft" ? {
|
|
259
|
+
...b,
|
|
260
|
+
bottom: -p / 2,
|
|
261
|
+
left: -p / 2,
|
|
262
|
+
width: p * 2,
|
|
263
|
+
height: p * 2,
|
|
264
|
+
cursor: _(c)
|
|
265
|
+
} : c === "topRight" ? {
|
|
266
|
+
...b,
|
|
267
|
+
top: -p / 2,
|
|
268
|
+
right: -p / 2,
|
|
269
|
+
width: p * 2,
|
|
270
|
+
height: p * 2,
|
|
271
|
+
cursor: _(c)
|
|
272
|
+
} : c === "topLeft" ? {
|
|
273
|
+
...b,
|
|
274
|
+
top: -p / 2,
|
|
275
|
+
left: -p / 2,
|
|
276
|
+
width: p * 2,
|
|
277
|
+
height: p * 2,
|
|
278
|
+
cursor: _(c)
|
|
279
|
+
} : b;
|
|
280
|
+
};
|
|
281
|
+
return /* @__PURE__ */ E(
|
|
282
|
+
"div",
|
|
283
|
+
{
|
|
284
|
+
ref: a,
|
|
285
|
+
className: `nice-resizable ${N || ""}`,
|
|
286
|
+
style: {
|
|
287
|
+
...M,
|
|
288
|
+
width: C.width,
|
|
289
|
+
height: C.height,
|
|
290
|
+
position: "relative",
|
|
291
|
+
overflow: "hidden"
|
|
292
|
+
},
|
|
293
|
+
children: [
|
|
294
|
+
m,
|
|
295
|
+
u.map((c) => /* @__PURE__ */ t("div", { style: h(c), onPointerDown: (b) => f(c, b) }, c))
|
|
296
|
+
]
|
|
297
|
+
}
|
|
298
|
+
);
|
|
299
|
+
}, rn = ({
|
|
300
|
+
direction: e = "vertical",
|
|
301
|
+
showScrollbar: n = "onInteraction",
|
|
302
|
+
width: r,
|
|
303
|
+
height: o,
|
|
304
|
+
onScroll: d,
|
|
305
|
+
children: l,
|
|
306
|
+
className: u,
|
|
307
|
+
style: w
|
|
308
|
+
}) => {
|
|
309
|
+
const m = e === "horizontal" || e === "both" ? "auto" : "hidden", N = e === "vertical" || e === "both" ? "auto" : "hidden";
|
|
310
|
+
return /* @__PURE__ */ t(
|
|
311
|
+
"div",
|
|
312
|
+
{
|
|
313
|
+
className: `nice-scrollview ${n === "never" ? "nice-scrollview--hide-sb" : n === "always" ? "nice-scrollview--show-sb" : ""} ${u || ""}`,
|
|
314
|
+
style: { ...w, width: r, height: o, overflowX: m, overflowY: N },
|
|
315
|
+
onScroll: d,
|
|
316
|
+
children: l
|
|
317
|
+
}
|
|
318
|
+
);
|
|
319
|
+
}, $t = [];
|
|
320
|
+
function Te() {
|
|
321
|
+
const e = Qe(kt);
|
|
322
|
+
return e?.portalTarget ? e.portalTarget : typeof document < "u" ? document.body : null;
|
|
323
|
+
}
|
|
324
|
+
const cn = ({
|
|
325
|
+
open: e,
|
|
326
|
+
onClose: n,
|
|
327
|
+
children: r,
|
|
328
|
+
title: o,
|
|
329
|
+
size: d = "md",
|
|
330
|
+
closeOnBackdropClick: l = !0,
|
|
331
|
+
closeOnEscape: u = !0,
|
|
332
|
+
disableFocusTrap: w = !1,
|
|
333
|
+
disableBodyScroll: m = !0,
|
|
334
|
+
zIndex: N = 1e3,
|
|
335
|
+
className: M,
|
|
336
|
+
style: C
|
|
337
|
+
}) => {
|
|
338
|
+
const L = K(null);
|
|
339
|
+
Ve(L, e && !w);
|
|
340
|
+
const a = Te();
|
|
341
|
+
q(() => {
|
|
342
|
+
if (!m && e) {
|
|
343
|
+
const h = document.body.style.overflow;
|
|
344
|
+
return document.body.style.overflow = "hidden", () => {
|
|
345
|
+
document.body.style.overflow = h;
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
}, [e, m]), q(() => {
|
|
349
|
+
if (!u || !e)
|
|
350
|
+
return;
|
|
351
|
+
const h = (c) => {
|
|
352
|
+
c.key === "Escape" && (c.preventDefault(), n());
|
|
353
|
+
};
|
|
354
|
+
return document.addEventListener("keydown", h), () => document.removeEventListener("keydown", h);
|
|
355
|
+
}, [u, e, n]);
|
|
356
|
+
const f = k(
|
|
357
|
+
(h) => {
|
|
358
|
+
l && h.target === h.currentTarget && n();
|
|
359
|
+
},
|
|
360
|
+
[l, n]
|
|
361
|
+
);
|
|
362
|
+
if (!e)
|
|
363
|
+
return null;
|
|
364
|
+
const _ = {
|
|
365
|
+
sm: "nice-modal--sm",
|
|
366
|
+
md: "nice-modal--md",
|
|
367
|
+
lg: "nice-modal--lg",
|
|
368
|
+
xl: "nice-modal--xl",
|
|
369
|
+
full: "nice-modal--full"
|
|
370
|
+
}[d];
|
|
371
|
+
return Me(
|
|
372
|
+
/* @__PURE__ */ t(
|
|
373
|
+
"div",
|
|
374
|
+
{
|
|
375
|
+
className: "nice-modal__overlay",
|
|
376
|
+
style: { zIndex: N },
|
|
377
|
+
onClick: f,
|
|
378
|
+
role: "presentation",
|
|
379
|
+
children: /* @__PURE__ */ t(
|
|
380
|
+
"div",
|
|
381
|
+
{
|
|
382
|
+
ref: L,
|
|
383
|
+
className: `nice-modal ${_} ${M || ""}`,
|
|
384
|
+
role: "dialog",
|
|
385
|
+
"aria-modal": "true",
|
|
386
|
+
"aria-label": o,
|
|
387
|
+
style: C,
|
|
388
|
+
tabIndex: -1,
|
|
389
|
+
children: r
|
|
390
|
+
}
|
|
391
|
+
)
|
|
392
|
+
}
|
|
393
|
+
),
|
|
394
|
+
a
|
|
395
|
+
);
|
|
396
|
+
}, sn = ({
|
|
397
|
+
children: e,
|
|
398
|
+
showClose: n = !0,
|
|
399
|
+
onClose: r,
|
|
400
|
+
className: o
|
|
401
|
+
}) => {
|
|
402
|
+
const { t: d } = ge();
|
|
403
|
+
return /* @__PURE__ */ E("div", { className: `nice-modal__header ${o || ""}`, children: [
|
|
404
|
+
/* @__PURE__ */ t("div", { className: "nice-modal__title", children: e }),
|
|
405
|
+
n && r && /* @__PURE__ */ t(
|
|
406
|
+
"button",
|
|
407
|
+
{
|
|
408
|
+
type: "button",
|
|
409
|
+
className: "nice-modal__close",
|
|
410
|
+
onClick: r,
|
|
411
|
+
"aria-label": d("overlays.close", "Close"),
|
|
412
|
+
children: /* @__PURE__ */ t(ce, { name: "close", size: 20 })
|
|
413
|
+
}
|
|
414
|
+
)
|
|
415
|
+
] });
|
|
416
|
+
}, an = ({ children: e, className: n }) => /* @__PURE__ */ t("div", { className: `nice-modal__body ${n || ""}`, children: e }), ln = ({ children: e, className: n }) => /* @__PURE__ */ t("div", { className: `nice-modal__footer ${n || ""}`, children: e }), dn = ({
|
|
417
|
+
open: e,
|
|
418
|
+
onClose: n,
|
|
419
|
+
children: r,
|
|
420
|
+
position: o = "right",
|
|
421
|
+
size: d = 320,
|
|
422
|
+
title: l,
|
|
423
|
+
closeOnBackdropClick: u = !0,
|
|
424
|
+
closeOnEscape: w = !0,
|
|
425
|
+
swipeToClose: m = !0,
|
|
426
|
+
zIndex: N = 1e3,
|
|
427
|
+
className: M,
|
|
428
|
+
style: C
|
|
429
|
+
}) => {
|
|
430
|
+
const L = K(null), [a, f] = Y(!1), [_, h] = Y(0);
|
|
431
|
+
Ve(L, e);
|
|
432
|
+
const c = Te();
|
|
433
|
+
q(() => {
|
|
434
|
+
if (!w || !e)
|
|
435
|
+
return;
|
|
436
|
+
const i = (v) => {
|
|
437
|
+
v.key === "Escape" && (v.preventDefault(), n());
|
|
438
|
+
};
|
|
439
|
+
return document.addEventListener("keydown", i), () => document.removeEventListener("keydown", i);
|
|
440
|
+
}, [w, e, n]);
|
|
441
|
+
const b = k(
|
|
442
|
+
(i) => {
|
|
443
|
+
let v = 0;
|
|
444
|
+
switch (o) {
|
|
445
|
+
case "left":
|
|
446
|
+
v = Math.min(0, i.deltaX);
|
|
447
|
+
break;
|
|
448
|
+
case "right":
|
|
449
|
+
v = Math.max(0, i.deltaX);
|
|
450
|
+
break;
|
|
451
|
+
case "top":
|
|
452
|
+
v = Math.min(0, i.deltaY);
|
|
453
|
+
break;
|
|
454
|
+
case "bottom":
|
|
455
|
+
v = Math.max(0, i.deltaY);
|
|
456
|
+
break;
|
|
457
|
+
}
|
|
458
|
+
h(v);
|
|
459
|
+
},
|
|
460
|
+
[o]
|
|
461
|
+
), p = k(
|
|
462
|
+
(i) => {
|
|
463
|
+
let I = !1;
|
|
464
|
+
switch (o) {
|
|
465
|
+
case "left":
|
|
466
|
+
I = i.deltaX < -100;
|
|
467
|
+
break;
|
|
468
|
+
case "right":
|
|
469
|
+
I = i.deltaX > 100;
|
|
470
|
+
break;
|
|
471
|
+
case "top":
|
|
472
|
+
I = i.deltaY < -100;
|
|
473
|
+
break;
|
|
474
|
+
case "bottom":
|
|
475
|
+
I = i.deltaY > 100;
|
|
476
|
+
break;
|
|
477
|
+
}
|
|
478
|
+
I && (Xe("light"), n()), h(0), f(!1);
|
|
479
|
+
},
|
|
480
|
+
[o, n]
|
|
481
|
+
), { ref: x } = Nt({
|
|
482
|
+
enabled: m && e,
|
|
483
|
+
onPanStart: () => f(!0),
|
|
484
|
+
onPan: b,
|
|
485
|
+
onPanEnd: p
|
|
486
|
+
}), P = k(
|
|
487
|
+
(i) => {
|
|
488
|
+
u && i.target === i.currentTarget && n();
|
|
489
|
+
},
|
|
490
|
+
[u, n]
|
|
491
|
+
);
|
|
492
|
+
if (!e)
|
|
493
|
+
return null;
|
|
494
|
+
const z = o === "left" || o === "right", A = z ? { width: typeof d == "number" ? `${d}px` : d } : { height: typeof d == "number" ? `${d}px` : d }, y = () => {
|
|
495
|
+
if (a)
|
|
496
|
+
return z ? `translateX(${_}px)` : `translateY(${_}px)`;
|
|
497
|
+
};
|
|
498
|
+
return Me(
|
|
499
|
+
/* @__PURE__ */ E(_e, { children: [
|
|
500
|
+
/* @__PURE__ */ t(
|
|
501
|
+
"div",
|
|
502
|
+
{
|
|
503
|
+
className: `nice-drawer__overlay ${e ? "nice-drawer__overlay--visible" : ""}`,
|
|
504
|
+
style: { zIndex: N },
|
|
505
|
+
onClick: P
|
|
506
|
+
}
|
|
507
|
+
),
|
|
508
|
+
/* @__PURE__ */ t(
|
|
509
|
+
"div",
|
|
510
|
+
{
|
|
511
|
+
ref: (i) => {
|
|
512
|
+
L.current = i, x.current = i;
|
|
513
|
+
},
|
|
514
|
+
className: `nice-drawer nice-drawer--${o} ${e ? "nice-drawer--open" : ""} ${M || ""}`,
|
|
515
|
+
style: {
|
|
516
|
+
...A,
|
|
517
|
+
zIndex: N + 1,
|
|
518
|
+
transform: y(),
|
|
519
|
+
transition: a ? "none" : void 0,
|
|
520
|
+
...C
|
|
521
|
+
},
|
|
522
|
+
role: "dialog",
|
|
523
|
+
"aria-modal": "true",
|
|
524
|
+
"aria-label": l,
|
|
525
|
+
tabIndex: -1,
|
|
526
|
+
children: r
|
|
527
|
+
}
|
|
528
|
+
)
|
|
529
|
+
] }),
|
|
530
|
+
c
|
|
531
|
+
);
|
|
532
|
+
}, un = ({
|
|
533
|
+
open: e,
|
|
534
|
+
onClose: n,
|
|
535
|
+
children: r,
|
|
536
|
+
title: o,
|
|
537
|
+
showHandle: d = !0,
|
|
538
|
+
snapPoints: l = [0.5, 0.9],
|
|
539
|
+
initialSnap: u = 0,
|
|
540
|
+
expandable: w = !0,
|
|
541
|
+
closeOnBackdropClick: m = !0,
|
|
542
|
+
closeOnEscape: N = !0,
|
|
543
|
+
hapticFeedback: M = !0,
|
|
544
|
+
zIndex: C = 1e3,
|
|
545
|
+
className: L,
|
|
546
|
+
style: a
|
|
547
|
+
}) => {
|
|
548
|
+
const f = K(null), _ = K(null), [h, c] = Y(u), [b, p] = Y(!1), [x, P] = Y(0), z = K(0);
|
|
549
|
+
q(() => {
|
|
550
|
+
e && (c(u), P(0));
|
|
551
|
+
}, [e, u]), Ve(f, e);
|
|
552
|
+
const A = Te();
|
|
553
|
+
q(() => {
|
|
554
|
+
if (!N || !e)
|
|
555
|
+
return;
|
|
556
|
+
const R = (O) => {
|
|
557
|
+
O.key === "Escape" && (O.preventDefault(), n());
|
|
558
|
+
};
|
|
559
|
+
return document.addEventListener("keydown", R), () => document.removeEventListener("keydown", R);
|
|
560
|
+
}, [N, e, n]), q(() => {
|
|
561
|
+
if (e) {
|
|
562
|
+
const R = document.body.style.overflow;
|
|
563
|
+
return document.body.style.overflow = "hidden", () => {
|
|
564
|
+
document.body.style.overflow = R;
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
}, [e]);
|
|
568
|
+
const y = k((R) => {
|
|
569
|
+
const O = R.target.closest(".nice-bottom-sheet__handle"), g = _.current, $ = !g || g.scrollTop <= 0;
|
|
570
|
+
!O && !$ || (p(!0), z.current = R.touches[0].clientY);
|
|
571
|
+
}, []), i = k(
|
|
572
|
+
(R) => {
|
|
573
|
+
if (!b)
|
|
574
|
+
return;
|
|
575
|
+
const O = R.touches[0].clientY - z.current;
|
|
576
|
+
(O > 0 || h < l.length - 1) && P(O);
|
|
577
|
+
},
|
|
578
|
+
[b, h, l.length]
|
|
579
|
+
), v = k(() => {
|
|
580
|
+
if (!b)
|
|
581
|
+
return;
|
|
582
|
+
const R = window.innerHeight;
|
|
583
|
+
l[h] * R;
|
|
584
|
+
const O = -x, g = R * 0.15;
|
|
585
|
+
O > g && w && h < l.length - 1 ? (c(h + 1), M && Xe("selection")) : O < -g && (h > 0 ? (c(h - 1), M && Xe("selection")) : (M && Xe("light"), n())), p(!1), P(0);
|
|
586
|
+
}, [b, x, h, l, w, M, n]), I = k(() => {
|
|
587
|
+
m && n();
|
|
588
|
+
}, [m, n]);
|
|
589
|
+
if (!e)
|
|
590
|
+
return null;
|
|
591
|
+
const T = l[h] * 100, D = b ? x : 0;
|
|
592
|
+
return Me(
|
|
593
|
+
/* @__PURE__ */ E(_e, { children: [
|
|
594
|
+
/* @__PURE__ */ t(
|
|
595
|
+
"div",
|
|
596
|
+
{
|
|
597
|
+
className: `nice-bottom-sheet__overlay ${e ? "nice-bottom-sheet__overlay--visible" : ""}`,
|
|
598
|
+
style: { zIndex: C },
|
|
599
|
+
onClick: I
|
|
600
|
+
}
|
|
601
|
+
),
|
|
602
|
+
/* @__PURE__ */ E(
|
|
603
|
+
"div",
|
|
604
|
+
{
|
|
605
|
+
ref: f,
|
|
606
|
+
className: `nice-bottom-sheet ${e ? "nice-bottom-sheet--open" : ""} ${L || ""}`,
|
|
607
|
+
style: {
|
|
608
|
+
zIndex: C + 1,
|
|
609
|
+
height: `${T}vh`,
|
|
610
|
+
transform: `translateY(${Math.max(0, D)}px)`,
|
|
611
|
+
transition: b ? "none" : "transform 0.3s ease-out, height 0.3s ease-out",
|
|
612
|
+
...a
|
|
613
|
+
},
|
|
614
|
+
role: "dialog",
|
|
615
|
+
"aria-modal": "true",
|
|
616
|
+
"aria-label": o,
|
|
617
|
+
tabIndex: -1,
|
|
618
|
+
onTouchStart: y,
|
|
619
|
+
onTouchMove: i,
|
|
620
|
+
onTouchEnd: v,
|
|
621
|
+
children: [
|
|
622
|
+
d && /* @__PURE__ */ t("div", { className: "nice-bottom-sheet__handle", "aria-hidden": "true" }),
|
|
623
|
+
o && /* @__PURE__ */ t("div", { className: "nice-bottom-sheet__title", children: o }),
|
|
624
|
+
/* @__PURE__ */ t("div", { ref: _, className: "nice-bottom-sheet__content", children: r })
|
|
625
|
+
]
|
|
626
|
+
}
|
|
627
|
+
)
|
|
628
|
+
] }),
|
|
629
|
+
A
|
|
630
|
+
);
|
|
631
|
+
}, mn = ({
|
|
632
|
+
trigger: e,
|
|
633
|
+
children: n,
|
|
634
|
+
placement: r = "bottom",
|
|
635
|
+
triggerMode: o = "click",
|
|
636
|
+
open: d,
|
|
637
|
+
onOpenChange: l,
|
|
638
|
+
hoverDelay: u = 200,
|
|
639
|
+
offset: w = 8,
|
|
640
|
+
className: m,
|
|
641
|
+
showArrow: N = !0
|
|
642
|
+
}) => {
|
|
643
|
+
const [M, C] = Y(!1), L = K(null), a = K(null), f = K(null), _ = Te(), h = d !== void 0, c = h ? d : M, b = k(
|
|
644
|
+
(y) => {
|
|
645
|
+
h || C(y), l?.(y);
|
|
646
|
+
},
|
|
647
|
+
[h, l]
|
|
648
|
+
);
|
|
649
|
+
tt(a, () => {
|
|
650
|
+
o !== "manual" && c && b(!1);
|
|
651
|
+
});
|
|
652
|
+
const p = k(() => {
|
|
653
|
+
o === "click" && b(!c);
|
|
654
|
+
}, [o, c, b]), x = k(() => {
|
|
655
|
+
o === "hover" && (f.current && window.clearTimeout(f.current), f.current = window.setTimeout(() => b(!0), u));
|
|
656
|
+
}, [o, u, b]), P = k(() => {
|
|
657
|
+
o === "hover" && (f.current && window.clearTimeout(f.current), f.current = window.setTimeout(() => b(!1), u));
|
|
658
|
+
}, [o, u, b]), [z, A] = Y({ top: 0, left: 0 });
|
|
659
|
+
return q(() => {
|
|
660
|
+
if (!c || !L.current || !a.current)
|
|
661
|
+
return;
|
|
662
|
+
const y = L.current.getBoundingClientRect(), i = a.current.getBoundingClientRect(), v = window.innerWidth, I = window.innerHeight;
|
|
663
|
+
let T = 0, D = 0;
|
|
664
|
+
const [R, O = "center"] = r.split("-");
|
|
665
|
+
switch (R) {
|
|
666
|
+
case "top":
|
|
667
|
+
T = y.top - i.height - w, D = y.left + (y.width - i.width) / 2;
|
|
668
|
+
break;
|
|
669
|
+
case "bottom":
|
|
670
|
+
T = y.bottom + w, D = y.left + (y.width - i.width) / 2;
|
|
671
|
+
break;
|
|
672
|
+
case "left":
|
|
673
|
+
T = y.top + (y.height - i.height) / 2, D = y.left - i.width - w;
|
|
674
|
+
break;
|
|
675
|
+
case "right":
|
|
676
|
+
T = y.top + (y.height - i.height) / 2, D = y.right + w;
|
|
677
|
+
break;
|
|
678
|
+
}
|
|
679
|
+
R === "top" || R === "bottom" ? (O === "start" && (D = y.left), O === "end" && (D = y.right - i.width)) : (O === "start" && (T = y.top), O === "end" && (T = y.bottom - i.height)), D = Math.max(8, Math.min(v - i.width - 8, D)), T = Math.max(8, Math.min(I - i.height - 8, T)), A({ top: T, left: D });
|
|
680
|
+
}, [c, r, w]), /* @__PURE__ */ E(_e, { children: [
|
|
681
|
+
/* @__PURE__ */ t(
|
|
682
|
+
"div",
|
|
683
|
+
{
|
|
684
|
+
ref: L,
|
|
685
|
+
className: "nice-popover__trigger",
|
|
686
|
+
onClick: p,
|
|
687
|
+
onMouseEnter: x,
|
|
688
|
+
onMouseLeave: P,
|
|
689
|
+
style: { display: "inline-block" },
|
|
690
|
+
children: e
|
|
691
|
+
}
|
|
692
|
+
),
|
|
693
|
+
c && Me(
|
|
694
|
+
/* @__PURE__ */ E(
|
|
695
|
+
"div",
|
|
696
|
+
{
|
|
697
|
+
ref: a,
|
|
698
|
+
className: `nice-popover nice-popover--${r} ${m || ""}`,
|
|
699
|
+
style: {
|
|
700
|
+
position: "fixed",
|
|
701
|
+
top: z.top,
|
|
702
|
+
left: z.left,
|
|
703
|
+
zIndex: 1100
|
|
704
|
+
},
|
|
705
|
+
onMouseEnter: x,
|
|
706
|
+
onMouseLeave: P,
|
|
707
|
+
role: "tooltip",
|
|
708
|
+
children: [
|
|
709
|
+
N && /* @__PURE__ */ t("div", { className: "nice-popover__arrow" }),
|
|
710
|
+
/* @__PURE__ */ t("div", { className: "nice-popover__content", children: n })
|
|
711
|
+
]
|
|
712
|
+
}
|
|
713
|
+
),
|
|
714
|
+
_
|
|
715
|
+
)
|
|
716
|
+
] });
|
|
717
|
+
}, hn = ({
|
|
718
|
+
items: e = $t,
|
|
719
|
+
children: n,
|
|
720
|
+
onOpen: r,
|
|
721
|
+
onClose: o,
|
|
722
|
+
className: d
|
|
723
|
+
}) => {
|
|
724
|
+
const [l, u] = Y(!1), [w, m] = Y({ x: 0, y: 0 }), N = K(null), M = K(null), C = Te();
|
|
725
|
+
tt(N, () => {
|
|
726
|
+
l && (u(!1), o?.());
|
|
727
|
+
});
|
|
728
|
+
const L = k(
|
|
729
|
+
(_) => {
|
|
730
|
+
_.preventDefault(), m({ x: _.clientX, y: _.clientY }), u(!0), r?.();
|
|
731
|
+
},
|
|
732
|
+
[r]
|
|
733
|
+
), a = k(
|
|
734
|
+
(_) => {
|
|
735
|
+
!_.disabled && _.onClick && (_.onClick(), u(!1), o?.());
|
|
736
|
+
},
|
|
737
|
+
[o]
|
|
738
|
+
);
|
|
739
|
+
q(() => {
|
|
740
|
+
if (!l)
|
|
741
|
+
return;
|
|
742
|
+
const _ = (h) => {
|
|
743
|
+
h.key === "Escape" && (u(!1), o?.());
|
|
744
|
+
};
|
|
745
|
+
return document.addEventListener("keydown", _), () => document.removeEventListener("keydown", _);
|
|
746
|
+
}, [l, o]);
|
|
747
|
+
const f = (_) => /* @__PURE__ */ t("ul", { className: "nice-context-menu__list", role: "menu", children: _.map((h) => h.divider ? /* @__PURE__ */ t("li", { className: "nice-context-menu__divider", role: "separator" }, h.key) : /* @__PURE__ */ t("li", { role: "presentation", children: /* @__PURE__ */ E(
|
|
748
|
+
"button",
|
|
749
|
+
{
|
|
750
|
+
type: "button",
|
|
751
|
+
className: `nice-context-menu__item ${h.disabled ? "nice-context-menu__item--disabled" : ""} ${h.danger ? "nice-context-menu__item--danger" : ""}`,
|
|
752
|
+
role: "menuitem",
|
|
753
|
+
disabled: h.disabled,
|
|
754
|
+
onClick: () => a(h),
|
|
755
|
+
children: [
|
|
756
|
+
h.icon && /* @__PURE__ */ t("span", { className: "nice-context-menu__icon", children: h.icon }),
|
|
757
|
+
/* @__PURE__ */ t("span", { className: "nice-context-menu__label", children: h.label })
|
|
758
|
+
]
|
|
759
|
+
}
|
|
760
|
+
) }, h.key)) });
|
|
761
|
+
return /* @__PURE__ */ E(_e, { children: [
|
|
762
|
+
/* @__PURE__ */ t("div", { ref: M, onContextMenu: L, style: { display: "contents" }, children: n }),
|
|
763
|
+
l && Me(
|
|
764
|
+
/* @__PURE__ */ t(
|
|
765
|
+
"div",
|
|
766
|
+
{
|
|
767
|
+
ref: N,
|
|
768
|
+
className: `nice-context-menu ${d || ""}`,
|
|
769
|
+
style: {
|
|
770
|
+
position: "fixed",
|
|
771
|
+
left: w.x,
|
|
772
|
+
top: w.y,
|
|
773
|
+
zIndex: 1200
|
|
774
|
+
},
|
|
775
|
+
role: "menu",
|
|
776
|
+
children: f(e)
|
|
777
|
+
}
|
|
778
|
+
),
|
|
779
|
+
C
|
|
780
|
+
)
|
|
781
|
+
] });
|
|
782
|
+
};
|
|
783
|
+
function je(e, n) {
|
|
784
|
+
if (!e)
|
|
785
|
+
return { score: 1, indices: [] };
|
|
786
|
+
const r = e.toLowerCase(), o = n.toLowerCase();
|
|
787
|
+
let d = 0;
|
|
788
|
+
const l = [];
|
|
789
|
+
let u = 0, w = -1;
|
|
790
|
+
for (let m = 0; m < o.length && d < r.length; m++)
|
|
791
|
+
o[m] === r[d] && (l.push(m), w === m - 1 && (u += 3), (m === 0 || /[\s\-_/.]/.test(n[m - 1])) && (u += 5), n[m] === e[d] && (u += 1), u += 1, w = m, d++);
|
|
792
|
+
return d < r.length ? null : (u -= l[0] * 0.1, { score: u, indices: l });
|
|
793
|
+
}
|
|
794
|
+
function Lt(e, n) {
|
|
795
|
+
if (n.length === 0)
|
|
796
|
+
return [e];
|
|
797
|
+
const r = [];
|
|
798
|
+
let o = 0;
|
|
799
|
+
const d = new Set(n);
|
|
800
|
+
for (let l = 0; l < e.length; l++)
|
|
801
|
+
d.has(l) && (o < l && r.push(e.slice(o, l)), r.push(
|
|
802
|
+
Tt.createElement(
|
|
803
|
+
"mark",
|
|
804
|
+
{ key: `m-${l}`, className: "nice-command-palette__match" },
|
|
805
|
+
e[l]
|
|
806
|
+
)
|
|
807
|
+
), o = l + 1);
|
|
808
|
+
return o < e.length && r.push(e.slice(o)), r;
|
|
809
|
+
}
|
|
810
|
+
function Rt(e, n) {
|
|
811
|
+
switch (n.type) {
|
|
812
|
+
case "REGISTER": {
|
|
813
|
+
const r = new Map(e.commands);
|
|
814
|
+
return r.set(n.command.id, n.command), { ...e, commands: r };
|
|
815
|
+
}
|
|
816
|
+
case "REGISTER_BATCH": {
|
|
817
|
+
const r = new Map(e.commands);
|
|
818
|
+
for (const o of n.commands)
|
|
819
|
+
r.set(o.id, o);
|
|
820
|
+
return { ...e, commands: r };
|
|
821
|
+
}
|
|
822
|
+
case "UNREGISTER": {
|
|
823
|
+
const r = new Map(e.commands);
|
|
824
|
+
return r.delete(n.id), { ...e, commands: r };
|
|
825
|
+
}
|
|
826
|
+
case "OPEN":
|
|
827
|
+
return { ...e, isOpen: !0, query: "", selectedIndex: 0 };
|
|
828
|
+
case "CLOSE":
|
|
829
|
+
return { ...e, isOpen: !1, query: "", selectedIndex: 0 };
|
|
830
|
+
case "SET_QUERY":
|
|
831
|
+
return { ...e, query: n.query, selectedIndex: 0 };
|
|
832
|
+
case "SET_SELECTED":
|
|
833
|
+
return { ...e, selectedIndex: n.index };
|
|
834
|
+
case "ADD_RECENT": {
|
|
835
|
+
const r = e.recentIds.filter((o) => o !== n.id);
|
|
836
|
+
return {
|
|
837
|
+
...e,
|
|
838
|
+
recentIds: [n.id, ...r].slice(0, n.maxRecent)
|
|
839
|
+
};
|
|
840
|
+
}
|
|
841
|
+
default:
|
|
842
|
+
return e;
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
const it = /* @__PURE__ */ nt(
|
|
846
|
+
null
|
|
847
|
+
);
|
|
848
|
+
function St() {
|
|
849
|
+
const e = Qe(it);
|
|
850
|
+
if (!e)
|
|
851
|
+
throw new Error("useCommandPalette must be used within NiceCommandPaletteProvider");
|
|
852
|
+
return e;
|
|
853
|
+
}
|
|
854
|
+
const Pt = ({
|
|
855
|
+
children: e,
|
|
856
|
+
commands: n,
|
|
857
|
+
placeholder: r,
|
|
858
|
+
maxVisible: o = 10,
|
|
859
|
+
maxRecent: d = 5,
|
|
860
|
+
className: l,
|
|
861
|
+
emptyText: u,
|
|
862
|
+
closeOnAction: w = !0,
|
|
863
|
+
onOpen: m,
|
|
864
|
+
onClose: N
|
|
865
|
+
}) => {
|
|
866
|
+
const { t: M } = ge(), C = M("commandPalette.general", "General"), L = Te(), [a, f] = zt(Rt, {
|
|
867
|
+
commands: new Map(n?.map((g) => [g.id, g]) ?? []),
|
|
868
|
+
isOpen: !1,
|
|
869
|
+
query: "",
|
|
870
|
+
selectedIndex: 0,
|
|
871
|
+
recentIds: []
|
|
872
|
+
}), _ = K(null), h = K(null), [c, b] = Y(!1), p = k((g) => {
|
|
873
|
+
f({ type: "REGISTER", command: g });
|
|
874
|
+
}, []), x = k((g) => {
|
|
875
|
+
f({ type: "UNREGISTER", id: g });
|
|
876
|
+
}, []), P = k((g) => {
|
|
877
|
+
f({ type: "REGISTER_BATCH", commands: g });
|
|
878
|
+
}, []), z = k(() => {
|
|
879
|
+
f({ type: "OPEN" }), m?.();
|
|
880
|
+
}, [m]), A = k(() => {
|
|
881
|
+
f({ type: "CLOSE" }), N?.();
|
|
882
|
+
}, [N]), y = k(() => {
|
|
883
|
+
a.isOpen ? A() : z();
|
|
884
|
+
}, [a.isOpen, A, z]), v = Pe(() => {
|
|
885
|
+
const g = Array.from(a.commands.values()).filter((s) => !s.hidden);
|
|
886
|
+
if (!a.query.trim()) {
|
|
887
|
+
const s = a.recentIds.map((W) => a.commands.get(W)).filter((W) => !!W && !W.hidden), B = g.filter((W) => !a.recentIds.includes(W.id));
|
|
888
|
+
return B.sort((W, J) => W.label.localeCompare(J.label)), [...s, ...B].map((W) => ({
|
|
889
|
+
command: W,
|
|
890
|
+
match: null,
|
|
891
|
+
isRecent: a.recentIds.includes(W.id)
|
|
892
|
+
}));
|
|
893
|
+
}
|
|
894
|
+
return g.map((s) => {
|
|
895
|
+
const B = je(a.query, s.label), W = s.description ? je(a.query, s.description) : null, J = s.keywords?.map((te) => je(a.query, te)).filter(Boolean)[0] ?? null, ee = [B, W, J].filter(Boolean).sort((te, ie) => (ie?.score ?? 0) - (te?.score ?? 0))[0] ?? null;
|
|
896
|
+
return { command: s, match: ee, isRecent: !1 };
|
|
897
|
+
}).filter((s) => s.match !== null).sort((s, B) => (B.match?.score ?? 0) - (s.match?.score ?? 0));
|
|
898
|
+
}, [a.commands, a.query, a.recentIds]).slice(0, o), I = k(
|
|
899
|
+
async (g) => {
|
|
900
|
+
const $ = a.commands.get(g);
|
|
901
|
+
if (!(!$ || $.disabled)) {
|
|
902
|
+
b(!0);
|
|
903
|
+
try {
|
|
904
|
+
await $.action(), f({ type: "ADD_RECENT", id: g, maxRecent: d });
|
|
905
|
+
} finally {
|
|
906
|
+
b(!1), w && A();
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
},
|
|
910
|
+
[a.commands, d, w, A]
|
|
911
|
+
);
|
|
912
|
+
q(() => {
|
|
913
|
+
const g = ($) => {
|
|
914
|
+
($.metaKey || $.ctrlKey) && $.key === "k" && ($.preventDefault(), y()), $.key === "Escape" && a.isOpen && ($.preventDefault(), A());
|
|
915
|
+
};
|
|
916
|
+
return document.addEventListener("keydown", g), () => document.removeEventListener("keydown", g);
|
|
917
|
+
}, [y, a.isOpen, A]), q(() => {
|
|
918
|
+
a.isOpen && requestAnimationFrame(() => _.current?.focus());
|
|
919
|
+
}, [a.isOpen]);
|
|
920
|
+
const T = k(
|
|
921
|
+
(g) => {
|
|
922
|
+
const $ = v.length;
|
|
923
|
+
if ($) {
|
|
924
|
+
if (g.key === "ArrowDown")
|
|
925
|
+
g.preventDefault(), f({ type: "SET_SELECTED", index: (a.selectedIndex + 1) % $ });
|
|
926
|
+
else if (g.key === "ArrowUp")
|
|
927
|
+
g.preventDefault(), f({ type: "SET_SELECTED", index: (a.selectedIndex - 1 + $) % $ });
|
|
928
|
+
else if (g.key === "Enter") {
|
|
929
|
+
g.preventDefault();
|
|
930
|
+
const s = v[a.selectedIndex];
|
|
931
|
+
s && I(s.command.id);
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
},
|
|
935
|
+
[v, a.selectedIndex, I]
|
|
936
|
+
);
|
|
937
|
+
q(() => {
|
|
938
|
+
if (!h.current)
|
|
939
|
+
return;
|
|
940
|
+
h.current.children[a.selectedIndex]?.scrollIntoView({ block: "nearest" });
|
|
941
|
+
}, [a.selectedIndex]);
|
|
942
|
+
const D = Pe(
|
|
943
|
+
() => ({
|
|
944
|
+
registerCommand: p,
|
|
945
|
+
unregisterCommand: x,
|
|
946
|
+
registerCommands: P,
|
|
947
|
+
open: z,
|
|
948
|
+
close: A,
|
|
949
|
+
toggle: y,
|
|
950
|
+
isOpen: a.isOpen,
|
|
951
|
+
executeCommand: I
|
|
952
|
+
}),
|
|
953
|
+
[
|
|
954
|
+
p,
|
|
955
|
+
x,
|
|
956
|
+
P,
|
|
957
|
+
z,
|
|
958
|
+
A,
|
|
959
|
+
y,
|
|
960
|
+
a.isOpen,
|
|
961
|
+
I
|
|
962
|
+
]
|
|
963
|
+
), R = Pe(() => {
|
|
964
|
+
const g = /* @__PURE__ */ new Map();
|
|
965
|
+
for (const $ of v) {
|
|
966
|
+
const s = $.command.category ?? C;
|
|
967
|
+
g.has(s) || g.set(s, []), g.get(s).push($);
|
|
968
|
+
}
|
|
969
|
+
return g;
|
|
970
|
+
}, [v, C]);
|
|
971
|
+
let O = 0;
|
|
972
|
+
return /* @__PURE__ */ E(it.Provider, { value: D, children: [
|
|
973
|
+
e,
|
|
974
|
+
a.isOpen && Me(
|
|
975
|
+
/* @__PURE__ */ t("div", { className: `nice-command-palette__overlay ${l ?? ""}`, onClick: A, children: /* @__PURE__ */ E(
|
|
976
|
+
"div",
|
|
977
|
+
{
|
|
978
|
+
className: "nice-command-palette",
|
|
979
|
+
role: "dialog",
|
|
980
|
+
"aria-label": M("commandPalette.title", "Command palette"),
|
|
981
|
+
"aria-modal": "true",
|
|
982
|
+
onClick: (g) => g.stopPropagation(),
|
|
983
|
+
children: [
|
|
984
|
+
/* @__PURE__ */ t("div", { className: "nice-command-palette__input-wrapper", children: /* @__PURE__ */ t(
|
|
985
|
+
"input",
|
|
986
|
+
{
|
|
987
|
+
ref: _,
|
|
988
|
+
className: "nice-command-palette__input",
|
|
989
|
+
type: "text",
|
|
990
|
+
placeholder: r ?? M("commandPalette.placeholder", "Type a command..."),
|
|
991
|
+
value: a.query,
|
|
992
|
+
onChange: (g) => f({ type: "SET_QUERY", query: g.target.value }),
|
|
993
|
+
onKeyDown: T,
|
|
994
|
+
"aria-label": M("commandPalette.search", "Search commands"),
|
|
995
|
+
"aria-autocomplete": "list",
|
|
996
|
+
"aria-controls": "nice-command-palette-list",
|
|
997
|
+
"aria-activedescendant": v[a.selectedIndex] ? `nice-cmd-${v[a.selectedIndex].command.id}` : void 0
|
|
998
|
+
}
|
|
999
|
+
) }),
|
|
1000
|
+
/* @__PURE__ */ E(
|
|
1001
|
+
"div",
|
|
1002
|
+
{
|
|
1003
|
+
ref: h,
|
|
1004
|
+
id: "nice-command-palette-list",
|
|
1005
|
+
className: "nice-command-palette__list",
|
|
1006
|
+
role: "listbox",
|
|
1007
|
+
children: [
|
|
1008
|
+
v.length === 0 && /* @__PURE__ */ t("div", { className: "nice-command-palette__empty", children: u ?? M("commandPalette.empty", "No commands found") }),
|
|
1009
|
+
Array.from(R.entries()).map(([g, $]) => /* @__PURE__ */ E("div", { className: "nice-command-palette__group", children: [
|
|
1010
|
+
/* @__PURE__ */ t("div", { className: "nice-command-palette__category", children: g }),
|
|
1011
|
+
$.map((s) => {
|
|
1012
|
+
const B = O++, W = B === a.selectedIndex;
|
|
1013
|
+
return /* @__PURE__ */ E(
|
|
1014
|
+
"div",
|
|
1015
|
+
{
|
|
1016
|
+
id: `nice-cmd-${s.command.id}`,
|
|
1017
|
+
className: `nice-command-palette__item ${W ? "nice-command-palette__item--selected" : ""} ${s.command.disabled ? "nice-command-palette__item--disabled" : ""}`,
|
|
1018
|
+
role: "option",
|
|
1019
|
+
"aria-selected": W,
|
|
1020
|
+
"aria-disabled": s.command.disabled,
|
|
1021
|
+
onClick: () => !s.command.disabled && I(s.command.id),
|
|
1022
|
+
onMouseEnter: () => f({ type: "SET_SELECTED", index: B }),
|
|
1023
|
+
children: [
|
|
1024
|
+
s.command.icon && /* @__PURE__ */ t("span", { className: "nice-command-palette__icon", children: s.command.icon }),
|
|
1025
|
+
/* @__PURE__ */ E("div", { className: "nice-command-palette__label-group", children: [
|
|
1026
|
+
/* @__PURE__ */ t("span", { className: "nice-command-palette__label", children: s.match && a.query ? Lt(s.command.label, s.match.indices) : s.command.label }),
|
|
1027
|
+
s.command.description && /* @__PURE__ */ t("span", { className: "nice-command-palette__description", children: s.command.description })
|
|
1028
|
+
] }),
|
|
1029
|
+
s.command.shortcut && /* @__PURE__ */ t("kbd", { className: "nice-command-palette__shortcut", children: s.command.shortcut }),
|
|
1030
|
+
s.isRecent && /* @__PURE__ */ t("span", { className: "nice-command-palette__recent-badge", children: M("commandPalette.recent", "Recent") })
|
|
1031
|
+
]
|
|
1032
|
+
},
|
|
1033
|
+
s.command.id
|
|
1034
|
+
);
|
|
1035
|
+
})
|
|
1036
|
+
] }, g))
|
|
1037
|
+
]
|
|
1038
|
+
}
|
|
1039
|
+
),
|
|
1040
|
+
c && /* @__PURE__ */ t("div", { className: "nice-command-palette__executing", children: M("commandPalette.executing", "Executing...") })
|
|
1041
|
+
]
|
|
1042
|
+
}
|
|
1043
|
+
) }),
|
|
1044
|
+
L
|
|
1045
|
+
)
|
|
1046
|
+
] });
|
|
1047
|
+
};
|
|
1048
|
+
process.env.NODE_ENV !== "production" && (Pt.displayName = "NiceCommandPaletteProvider");
|
|
1049
|
+
function fn(e) {
|
|
1050
|
+
const { registerCommands: n, unregisterCommand: r } = St();
|
|
1051
|
+
q(() => (n(e), () => {
|
|
1052
|
+
for (const o of e)
|
|
1053
|
+
r(o.id);
|
|
1054
|
+
}), []);
|
|
1055
|
+
}
|
|
1056
|
+
const pn = /* @__PURE__ */ Object.assign(
|
|
1057
|
+
/* @__PURE__ */ Ze(
|
|
1058
|
+
({ blocked: e, message: n, spinner: r, blur: o, children: d, className: l, style: u, id: w }, m) => {
|
|
1059
|
+
const N = Ge(w);
|
|
1060
|
+
return /* @__PURE__ */ E(
|
|
1061
|
+
"div",
|
|
1062
|
+
{
|
|
1063
|
+
ref: m,
|
|
1064
|
+
id: N,
|
|
1065
|
+
className: `nice-block-ui ${l || ""}`,
|
|
1066
|
+
style: { position: "relative", ...u },
|
|
1067
|
+
children: [
|
|
1068
|
+
d,
|
|
1069
|
+
e && /* @__PURE__ */ t(
|
|
1070
|
+
"div",
|
|
1071
|
+
{
|
|
1072
|
+
className: `nice-block-ui__overlay${o ? " nice-block-ui__overlay--blur" : ""}`,
|
|
1073
|
+
"aria-busy": "true",
|
|
1074
|
+
role: "alert",
|
|
1075
|
+
children: (r || n) && /* @__PURE__ */ E("div", { className: "nice-block-ui__content", children: [
|
|
1076
|
+
r && /* @__PURE__ */ t("div", { className: "nice-block-ui__spinner", "aria-hidden": "true" }),
|
|
1077
|
+
n && /* @__PURE__ */ t("div", { className: "nice-block-ui__message", children: n })
|
|
1078
|
+
] })
|
|
1079
|
+
}
|
|
1080
|
+
)
|
|
1081
|
+
]
|
|
1082
|
+
}
|
|
1083
|
+
);
|
|
1084
|
+
}
|
|
1085
|
+
),
|
|
1086
|
+
{ displayName: "NiceBlockUI" }
|
|
1087
|
+
), wn = /* @__PURE__ */ Object.assign(
|
|
1088
|
+
/* @__PURE__ */ Ze(
|
|
1089
|
+
({
|
|
1090
|
+
windows: e,
|
|
1091
|
+
children: n,
|
|
1092
|
+
onChange: r,
|
|
1093
|
+
onClose: o,
|
|
1094
|
+
onFocus: d,
|
|
1095
|
+
showTaskbar: l = !0,
|
|
1096
|
+
size: u = "md",
|
|
1097
|
+
className: w,
|
|
1098
|
+
style: m,
|
|
1099
|
+
id: N,
|
|
1100
|
+
...M
|
|
1101
|
+
}, C) => {
|
|
1102
|
+
const L = Ge(N), { t: a } = ge(), [f, _] = Y(null), h = K(null), c = Pe(() => e ?? [], [e]), b = Math.max(1, ...c.map((i) => i.zIndex ?? 1)), p = k(
|
|
1103
|
+
(i, v) => {
|
|
1104
|
+
const I = c.map((T) => T.key === i ? { ...T, ...v } : T);
|
|
1105
|
+
r?.(I);
|
|
1106
|
+
},
|
|
1107
|
+
[c, r]
|
|
1108
|
+
), x = k(
|
|
1109
|
+
(i) => {
|
|
1110
|
+
p(i, { zIndex: b + 1 }), d?.(i);
|
|
1111
|
+
},
|
|
1112
|
+
[p, b, d]
|
|
1113
|
+
), P = k(
|
|
1114
|
+
(i) => {
|
|
1115
|
+
o?.(i), r?.(c.filter((v) => v.key !== i));
|
|
1116
|
+
},
|
|
1117
|
+
[c, r, o]
|
|
1118
|
+
), z = k(
|
|
1119
|
+
(i) => {
|
|
1120
|
+
const v = c.find((I) => I.key === i);
|
|
1121
|
+
v && p(i, { minimized: !v.minimized, maximized: !1 });
|
|
1122
|
+
},
|
|
1123
|
+
[c, p]
|
|
1124
|
+
), A = k(
|
|
1125
|
+
(i) => {
|
|
1126
|
+
const v = c.find((I) => I.key === i);
|
|
1127
|
+
v && p(i, { maximized: !v.maximized, minimized: !1 });
|
|
1128
|
+
},
|
|
1129
|
+
[c, p]
|
|
1130
|
+
);
|
|
1131
|
+
q(() => {
|
|
1132
|
+
if (!f)
|
|
1133
|
+
return;
|
|
1134
|
+
const i = (I) => {
|
|
1135
|
+
const T = c.find((D) => D.key === f.key);
|
|
1136
|
+
if (T)
|
|
1137
|
+
if (f.mode === "move")
|
|
1138
|
+
p(f.key, {
|
|
1139
|
+
x: I.clientX - f.offsetX,
|
|
1140
|
+
y: I.clientY - f.offsetY
|
|
1141
|
+
});
|
|
1142
|
+
else {
|
|
1143
|
+
const R = h.current?.getBoundingClientRect(), O = R?.left ?? 0, g = R?.top ?? 0;
|
|
1144
|
+
p(f.key, {
|
|
1145
|
+
width: Math.max(200, I.clientX - O - T.x),
|
|
1146
|
+
height: Math.max(100, I.clientY - g - T.y)
|
|
1147
|
+
});
|
|
1148
|
+
}
|
|
1149
|
+
}, v = () => _(null);
|
|
1150
|
+
return document.addEventListener("mousemove", i), document.addEventListener("mouseup", v), () => {
|
|
1151
|
+
document.removeEventListener("mousemove", i), document.removeEventListener("mouseup", v);
|
|
1152
|
+
};
|
|
1153
|
+
}, [f, c, p]);
|
|
1154
|
+
const y = k(
|
|
1155
|
+
(i, v, I) => {
|
|
1156
|
+
v.preventDefault();
|
|
1157
|
+
const T = c.find((D) => D.key === i);
|
|
1158
|
+
T && (x(i), _({
|
|
1159
|
+
key: i,
|
|
1160
|
+
offsetX: I === "move" ? v.clientX - T.x : 0,
|
|
1161
|
+
offsetY: I === "move" ? v.clientY - T.y : 0,
|
|
1162
|
+
mode: I
|
|
1163
|
+
}));
|
|
1164
|
+
},
|
|
1165
|
+
[c, x]
|
|
1166
|
+
);
|
|
1167
|
+
return /* @__PURE__ */ E(
|
|
1168
|
+
"div",
|
|
1169
|
+
{
|
|
1170
|
+
ref: (i) => {
|
|
1171
|
+
h.current = i, typeof C == "function" ? C(i) : C && (C.current = i);
|
|
1172
|
+
},
|
|
1173
|
+
id: L,
|
|
1174
|
+
className: `nice-wm nice-wm--${u} ${w ?? ""}`,
|
|
1175
|
+
style: { ...m, position: "relative", overflow: "hidden" },
|
|
1176
|
+
...M,
|
|
1177
|
+
children: [
|
|
1178
|
+
c.map((i) => {
|
|
1179
|
+
if (i.minimized)
|
|
1180
|
+
return null;
|
|
1181
|
+
const v = i.maximized, I = v ? {
|
|
1182
|
+
position: "absolute",
|
|
1183
|
+
top: 0,
|
|
1184
|
+
left: 0,
|
|
1185
|
+
width: "100%",
|
|
1186
|
+
height: "100%",
|
|
1187
|
+
zIndex: i.zIndex ?? 1
|
|
1188
|
+
} : {
|
|
1189
|
+
position: "absolute",
|
|
1190
|
+
top: i.y,
|
|
1191
|
+
left: i.x,
|
|
1192
|
+
width: i.width,
|
|
1193
|
+
height: i.height,
|
|
1194
|
+
zIndex: i.zIndex ?? 1
|
|
1195
|
+
};
|
|
1196
|
+
return /* @__PURE__ */ E(
|
|
1197
|
+
"div",
|
|
1198
|
+
{
|
|
1199
|
+
className: `nice-wm__window ${v ? "nice-wm__window--maximized" : ""}`,
|
|
1200
|
+
style: I,
|
|
1201
|
+
onMouseDown: () => x(i.key),
|
|
1202
|
+
role: "dialog",
|
|
1203
|
+
"aria-label": i.title,
|
|
1204
|
+
children: [
|
|
1205
|
+
/* @__PURE__ */ E(
|
|
1206
|
+
"div",
|
|
1207
|
+
{
|
|
1208
|
+
className: "nice-wm__titlebar",
|
|
1209
|
+
onMouseDown: (T) => !v && y(i.key, T, "move"),
|
|
1210
|
+
children: [
|
|
1211
|
+
i.icon && /* @__PURE__ */ t("span", { className: "nice-wm__icon", children: i.icon }),
|
|
1212
|
+
/* @__PURE__ */ t("span", { className: "nice-wm__title", children: i.title }),
|
|
1213
|
+
/* @__PURE__ */ E("div", { className: "nice-wm__controls", children: [
|
|
1214
|
+
(i.minimizable ?? !0) && /* @__PURE__ */ t(
|
|
1215
|
+
"button",
|
|
1216
|
+
{
|
|
1217
|
+
type: "button",
|
|
1218
|
+
className: "nice-wm__ctrl-btn nice-wm__ctrl-btn--min",
|
|
1219
|
+
onClick: () => z(i.key),
|
|
1220
|
+
title: a("wm.minimize", "Minimize"),
|
|
1221
|
+
children: /* @__PURE__ */ t(ce, { name: "minus", size: 14 })
|
|
1222
|
+
}
|
|
1223
|
+
),
|
|
1224
|
+
(i.maximizable ?? !0) && /* @__PURE__ */ t(
|
|
1225
|
+
"button",
|
|
1226
|
+
{
|
|
1227
|
+
type: "button",
|
|
1228
|
+
className: "nice-wm__ctrl-btn nice-wm__ctrl-btn--max",
|
|
1229
|
+
onClick: () => A(i.key),
|
|
1230
|
+
title: a("wm.maximize", "Maximize"),
|
|
1231
|
+
children: /* @__PURE__ */ t(ce, { name: v ? "copy" : "window", size: 14 })
|
|
1232
|
+
}
|
|
1233
|
+
),
|
|
1234
|
+
(i.closable ?? !0) && /* @__PURE__ */ t(
|
|
1235
|
+
"button",
|
|
1236
|
+
{
|
|
1237
|
+
type: "button",
|
|
1238
|
+
className: "nice-wm__ctrl-btn nice-wm__ctrl-btn--close",
|
|
1239
|
+
onClick: () => P(i.key),
|
|
1240
|
+
title: a("wm.close", "Close"),
|
|
1241
|
+
children: /* @__PURE__ */ t(ce, { name: "close", size: 14 })
|
|
1242
|
+
}
|
|
1243
|
+
)
|
|
1244
|
+
] })
|
|
1245
|
+
]
|
|
1246
|
+
}
|
|
1247
|
+
),
|
|
1248
|
+
/* @__PURE__ */ t("div", { className: "nice-wm__body", children: i.content }),
|
|
1249
|
+
(i.resizable ?? !0) && !v && /* @__PURE__ */ t(
|
|
1250
|
+
"div",
|
|
1251
|
+
{
|
|
1252
|
+
className: "nice-wm__resize-handle",
|
|
1253
|
+
onMouseDown: (T) => y(i.key, T, "resize")
|
|
1254
|
+
}
|
|
1255
|
+
)
|
|
1256
|
+
]
|
|
1257
|
+
},
|
|
1258
|
+
i.key
|
|
1259
|
+
);
|
|
1260
|
+
}),
|
|
1261
|
+
e === void 0 && n,
|
|
1262
|
+
l && /* @__PURE__ */ t(
|
|
1263
|
+
"div",
|
|
1264
|
+
{
|
|
1265
|
+
className: "nice-wm__taskbar",
|
|
1266
|
+
role: "toolbar",
|
|
1267
|
+
"aria-label": a("wm.taskbar", "Taskbar"),
|
|
1268
|
+
children: c.map((i) => /* @__PURE__ */ E(
|
|
1269
|
+
"button",
|
|
1270
|
+
{
|
|
1271
|
+
type: "button",
|
|
1272
|
+
className: `nice-wm__taskbar-btn ${i.minimized ? "nice-wm__taskbar-btn--minimized" : ""}`,
|
|
1273
|
+
onClick: () => {
|
|
1274
|
+
i.minimized && z(i.key), x(i.key);
|
|
1275
|
+
},
|
|
1276
|
+
children: [
|
|
1277
|
+
i.icon && /* @__PURE__ */ t("span", { className: "nice-wm__taskbar-icon", children: i.icon }),
|
|
1278
|
+
/* @__PURE__ */ t("span", { className: "nice-wm__taskbar-label", children: i.title })
|
|
1279
|
+
]
|
|
1280
|
+
},
|
|
1281
|
+
i.key
|
|
1282
|
+
))
|
|
1283
|
+
}
|
|
1284
|
+
)
|
|
1285
|
+
]
|
|
1286
|
+
}
|
|
1287
|
+
);
|
|
1288
|
+
}
|
|
1289
|
+
),
|
|
1290
|
+
{ displayName: "NiceWindowManager" }
|
|
1291
|
+
);
|
|
1292
|
+
function Yt(e, n) {
|
|
1293
|
+
const r = document.querySelector(e);
|
|
1294
|
+
if (!r)
|
|
1295
|
+
return null;
|
|
1296
|
+
const o = r.getBoundingClientRect();
|
|
1297
|
+
return {
|
|
1298
|
+
top: o.top - n + window.scrollY,
|
|
1299
|
+
left: o.left - n + window.scrollX,
|
|
1300
|
+
width: o.width + n * 2,
|
|
1301
|
+
height: o.height + n * 2
|
|
1302
|
+
};
|
|
1303
|
+
}
|
|
1304
|
+
function Dt(e, n, r, o) {
|
|
1305
|
+
const l = { w: window.innerWidth, h: window.innerHeight + window.scrollY }, u = {
|
|
1306
|
+
top: {
|
|
1307
|
+
top: e.top - r - 12,
|
|
1308
|
+
left: e.left + e.width / 2 - n / 2
|
|
1309
|
+
},
|
|
1310
|
+
bottom: {
|
|
1311
|
+
top: e.top + e.height + 12,
|
|
1312
|
+
left: e.left + e.width / 2 - n / 2
|
|
1313
|
+
},
|
|
1314
|
+
left: {
|
|
1315
|
+
top: e.top + e.height / 2 - r / 2,
|
|
1316
|
+
left: e.left - n - 12
|
|
1317
|
+
},
|
|
1318
|
+
right: {
|
|
1319
|
+
top: e.top + e.height / 2 - r / 2,
|
|
1320
|
+
left: e.left + e.width + 12
|
|
1321
|
+
}
|
|
1322
|
+
};
|
|
1323
|
+
if (o && o !== "auto")
|
|
1324
|
+
return { ...u[o], actualPlacement: o };
|
|
1325
|
+
for (const w of ["bottom", "top", "right", "left"]) {
|
|
1326
|
+
const m = u[w];
|
|
1327
|
+
if (m.top >= 0 && m.left >= 0 && m.top + r <= l.h && m.left + n <= l.w)
|
|
1328
|
+
return { ...m, actualPlacement: w };
|
|
1329
|
+
}
|
|
1330
|
+
return { ...u.bottom, actualPlacement: "bottom" };
|
|
1331
|
+
}
|
|
1332
|
+
const ze = {
|
|
1333
|
+
width: 16,
|
|
1334
|
+
height: 16,
|
|
1335
|
+
viewBox: "0 0 24 24",
|
|
1336
|
+
fill: "none",
|
|
1337
|
+
stroke: "currentColor",
|
|
1338
|
+
strokeWidth: 2,
|
|
1339
|
+
strokeLinecap: "round",
|
|
1340
|
+
strokeLinejoin: "round",
|
|
1341
|
+
"aria-hidden": !0
|
|
1342
|
+
};
|
|
1343
|
+
function Ot() {
|
|
1344
|
+
return /* @__PURE__ */ E("svg", { ...ze, children: [
|
|
1345
|
+
/* @__PURE__ */ t("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
1346
|
+
/* @__PURE__ */ t("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
1347
|
+
] });
|
|
1348
|
+
}
|
|
1349
|
+
function Xt() {
|
|
1350
|
+
return /* @__PURE__ */ t("svg", { ...ze, children: /* @__PURE__ */ t("polyline", { points: "15 18 9 12 15 6" }) });
|
|
1351
|
+
}
|
|
1352
|
+
function Bt() {
|
|
1353
|
+
return /* @__PURE__ */ t("svg", { ...ze, children: /* @__PURE__ */ t("polyline", { points: "9 18 15 12 9 6" }) });
|
|
1354
|
+
}
|
|
1355
|
+
function Ht() {
|
|
1356
|
+
return /* @__PURE__ */ E("svg", { ...ze, children: [
|
|
1357
|
+
/* @__PURE__ */ t("polygon", { points: "5 4 15 12 5 20 5 4" }),
|
|
1358
|
+
/* @__PURE__ */ t("line", { x1: "19", y1: "5", x2: "19", y2: "19" })
|
|
1359
|
+
] });
|
|
1360
|
+
}
|
|
1361
|
+
function qt() {
|
|
1362
|
+
return /* @__PURE__ */ t("svg", { ...ze, children: /* @__PURE__ */ t("polygon", { points: "6 4 20 12 6 20 6 4", fill: "currentColor" }) });
|
|
1363
|
+
}
|
|
1364
|
+
function Wt() {
|
|
1365
|
+
return /* @__PURE__ */ E("svg", { ...ze, children: [
|
|
1366
|
+
/* @__PURE__ */ t("rect", { x: "6", y: "4", width: "4", height: "16", fill: "currentColor" }),
|
|
1367
|
+
/* @__PURE__ */ t("rect", { x: "14", y: "4", width: "4", height: "16", fill: "currentColor" })
|
|
1368
|
+
] });
|
|
1369
|
+
}
|
|
1370
|
+
function Oe(e, n, r) {
|
|
1371
|
+
return r === "text" ? /* @__PURE__ */ t("span", { className: "nice-tutorial__btn-label", children: n }) : r === "icon-text" ? /* @__PURE__ */ E(_e, { children: [
|
|
1372
|
+
e,
|
|
1373
|
+
/* @__PURE__ */ t("span", { className: "nice-tutorial__btn-label", children: n })
|
|
1374
|
+
] }) : e;
|
|
1375
|
+
}
|
|
1376
|
+
const At = [], ot = ({
|
|
1377
|
+
steps: e = At,
|
|
1378
|
+
active: n,
|
|
1379
|
+
onFinish: r,
|
|
1380
|
+
onSkip: o,
|
|
1381
|
+
onStepChange: d,
|
|
1382
|
+
closeOnEscape: l = !0,
|
|
1383
|
+
closeOnOverlayClick: u = !1,
|
|
1384
|
+
showProgress: w = !0,
|
|
1385
|
+
showSkipButton: m = !0,
|
|
1386
|
+
labels: N,
|
|
1387
|
+
animationDuration: M = 300,
|
|
1388
|
+
overlayOpacity: C = 0.6,
|
|
1389
|
+
zIndex: L = 1e4,
|
|
1390
|
+
buttonsPlacement: a = "floating-bottom",
|
|
1391
|
+
buttonsDisplay: f = "icon",
|
|
1392
|
+
showAutoplay: _ = !0,
|
|
1393
|
+
autoplayInterval: h = 5e3,
|
|
1394
|
+
autoplaySpeedRange: c = { min: 2e3, max: 15e3 },
|
|
1395
|
+
onAutoplayChange: b
|
|
1396
|
+
}) => {
|
|
1397
|
+
const { t: p } = ge(), [x, P] = Y(0), [z, A] = Y(null), [y, i] = Y({ w: 340, h: 200 }), [v, I] = Y(!0), [T, D] = Y(!1), [R, O] = Y(h), g = K(null), $ = K(-1), s = e[x], B = x === e.length - 1, W = x === 0, J = N?.next ?? "Next", ee = N?.back ?? "Back", te = N?.finish ?? "Finish", ie = N?.skip ?? "Skip", Ie = N?.stepOf ?? "of", ve = N?.play ?? "Play", be = N?.pause ?? "Pause", Ce = N?.speed ?? "Speed", Ye = N?.close ?? "Close";
|
|
1398
|
+
q(() => {
|
|
1399
|
+
n && (P(0), D(!1), O(h));
|
|
1400
|
+
}, [n, h]), q(() => {
|
|
1401
|
+
if (g.current) {
|
|
1402
|
+
const X = g.current.getBoundingClientRect();
|
|
1403
|
+
i({ w: X.width, h: X.height });
|
|
1404
|
+
}
|
|
1405
|
+
}, [x, n]), q(() => {
|
|
1406
|
+
if (!n || !s)
|
|
1407
|
+
return;
|
|
1408
|
+
const X = s.highlightPadding ?? 0, H = () => {
|
|
1409
|
+
const j = Yt(s.target, X);
|
|
1410
|
+
A(j);
|
|
1411
|
+
};
|
|
1412
|
+
if (H(), s.scrollIntoView !== !1) {
|
|
1413
|
+
document.querySelector(s.target)?.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
1414
|
+
const ae = setTimeout(H, 350);
|
|
1415
|
+
return () => clearTimeout(ae);
|
|
1416
|
+
}
|
|
1417
|
+
}, [n, s, x]), q(() => {
|
|
1418
|
+
!n || !s || $.current !== x && ($.current >= 0 && $.current < e.length && e[$.current]?.onLeave?.(), s.onEnter?.(), $.current = x);
|
|
1419
|
+
}, [n, s, x, e]);
|
|
1420
|
+
const se = k(() => {
|
|
1421
|
+
if (B)
|
|
1422
|
+
s?.onLeave?.(), r?.();
|
|
1423
|
+
else {
|
|
1424
|
+
const X = x + 1;
|
|
1425
|
+
P(X), d?.(X);
|
|
1426
|
+
}
|
|
1427
|
+
}, [x, B, r, d, s]), ye = k(() => {
|
|
1428
|
+
if (!W) {
|
|
1429
|
+
const X = x - 1;
|
|
1430
|
+
P(X), d?.(X);
|
|
1431
|
+
}
|
|
1432
|
+
}, [x, W, d]);
|
|
1433
|
+
q(() => {
|
|
1434
|
+
if (!n || !s?.advanceOn)
|
|
1435
|
+
return;
|
|
1436
|
+
const X = document.querySelector(s.target);
|
|
1437
|
+
if (!X)
|
|
1438
|
+
return;
|
|
1439
|
+
const H = () => se();
|
|
1440
|
+
return X.addEventListener(s.advanceOn.event, H), () => X.removeEventListener(s.advanceOn.event, H);
|
|
1441
|
+
}, [n, s, x, se]), q(() => {
|
|
1442
|
+
if (!n)
|
|
1443
|
+
return;
|
|
1444
|
+
const X = (H) => {
|
|
1445
|
+
H.key === "Escape" && l ? o?.() : H.key === "ArrowRight" ? se() : H.key === "ArrowLeft" && ye();
|
|
1446
|
+
};
|
|
1447
|
+
return document.addEventListener("keydown", X), () => document.removeEventListener("keydown", X);
|
|
1448
|
+
}, [n, x, l, se, ye, o]), q(() => {
|
|
1449
|
+
I(!0);
|
|
1450
|
+
const X = setTimeout(() => I(!1), M);
|
|
1451
|
+
return () => clearTimeout(X);
|
|
1452
|
+
}, [x, M]), q(() => {
|
|
1453
|
+
if (!n || !T)
|
|
1454
|
+
return;
|
|
1455
|
+
const X = setInterval(
|
|
1456
|
+
() => {
|
|
1457
|
+
P((H) => {
|
|
1458
|
+
if (H >= e.length - 1)
|
|
1459
|
+
return D(!1), b?.(!1), e[H]?.onLeave?.(), r?.(), H;
|
|
1460
|
+
const j = H + 1;
|
|
1461
|
+
return d?.(j), j;
|
|
1462
|
+
});
|
|
1463
|
+
},
|
|
1464
|
+
Math.max(500, R)
|
|
1465
|
+
);
|
|
1466
|
+
return () => clearInterval(X);
|
|
1467
|
+
}, [n, T, R, e, b, r, d]);
|
|
1468
|
+
const De = k(() => {
|
|
1469
|
+
D((X) => {
|
|
1470
|
+
const H = !X;
|
|
1471
|
+
return b?.(H), H;
|
|
1472
|
+
});
|
|
1473
|
+
}, [b]), xe = Pe(() => z ? Dt(z, y.w, y.h, s?.placement) : {
|
|
1474
|
+
top: typeof window < "u" ? window.innerHeight / 2 : 0,
|
|
1475
|
+
left: typeof window < "u" ? window.innerWidth / 2 : 0,
|
|
1476
|
+
actualPlacement: "bottom"
|
|
1477
|
+
}, [z, y, s?.placement]), G = e.length === 0 ? 0 : (x + 1) / e.length * 100, Ne = k(
|
|
1478
|
+
(X) => {
|
|
1479
|
+
const H = _ && e.length > 1, j = m && !B && /* @__PURE__ */ t(
|
|
1480
|
+
"button",
|
|
1481
|
+
{
|
|
1482
|
+
type: "button",
|
|
1483
|
+
className: `nice-tutorial__btn nice-tutorial__btn--skip nice-tutorial__btn--${f}`,
|
|
1484
|
+
onClick: o,
|
|
1485
|
+
"aria-label": ie,
|
|
1486
|
+
title: ie,
|
|
1487
|
+
children: Oe(/* @__PURE__ */ t(Ht, {}), ie, f)
|
|
1488
|
+
}
|
|
1489
|
+
), ae = !W && /* @__PURE__ */ t(
|
|
1490
|
+
"button",
|
|
1491
|
+
{
|
|
1492
|
+
type: "button",
|
|
1493
|
+
className: `nice-tutorial__btn nice-tutorial__btn--back nice-tutorial__btn--${f}`,
|
|
1494
|
+
onClick: ye,
|
|
1495
|
+
"aria-label": ee,
|
|
1496
|
+
title: ee,
|
|
1497
|
+
children: Oe(/* @__PURE__ */ t(Xt, {}), ee, f)
|
|
1498
|
+
}
|
|
1499
|
+
), ke = !s?.waitForAction && /* @__PURE__ */ t(
|
|
1500
|
+
"button",
|
|
1501
|
+
{
|
|
1502
|
+
type: "button",
|
|
1503
|
+
className: `nice-tutorial__btn nice-tutorial__btn--next nice-tutorial__btn--${f}`,
|
|
1504
|
+
onClick: se,
|
|
1505
|
+
"aria-label": B ? te : J,
|
|
1506
|
+
title: B ? te : J,
|
|
1507
|
+
children: Oe(/* @__PURE__ */ t(Bt, {}), B ? te : J, f)
|
|
1508
|
+
}
|
|
1509
|
+
), He = H && /* @__PURE__ */ t(
|
|
1510
|
+
"button",
|
|
1511
|
+
{
|
|
1512
|
+
type: "button",
|
|
1513
|
+
className: [
|
|
1514
|
+
"nice-tutorial__btn",
|
|
1515
|
+
"nice-tutorial__btn--play",
|
|
1516
|
+
`nice-tutorial__btn--${f}`,
|
|
1517
|
+
T ? "nice-tutorial__btn--active" : ""
|
|
1518
|
+
].filter(Boolean).join(" "),
|
|
1519
|
+
onClick: De,
|
|
1520
|
+
"aria-label": T ? be : ve,
|
|
1521
|
+
title: T ? be : ve,
|
|
1522
|
+
"aria-pressed": T,
|
|
1523
|
+
children: Oe(
|
|
1524
|
+
T ? /* @__PURE__ */ t(Wt, {}) : /* @__PURE__ */ t(qt, {}),
|
|
1525
|
+
T ? be : ve,
|
|
1526
|
+
f
|
|
1527
|
+
)
|
|
1528
|
+
}
|
|
1529
|
+
);
|
|
1530
|
+
return /* @__PURE__ */ E(
|
|
1531
|
+
"div",
|
|
1532
|
+
{
|
|
1533
|
+
className: [
|
|
1534
|
+
"nice-tutorial__controls",
|
|
1535
|
+
X ? "nice-tutorial__controls--inline" : "nice-tutorial__controls--floating-bottom"
|
|
1536
|
+
].join(" "),
|
|
1537
|
+
style: X ? void 0 : { zIndex: L + 2 },
|
|
1538
|
+
role: "group",
|
|
1539
|
+
"aria-label": p("tutorial.tutorialControls", "Tutorial controls"),
|
|
1540
|
+
children: [
|
|
1541
|
+
j,
|
|
1542
|
+
ae,
|
|
1543
|
+
w && /* @__PURE__ */ E("span", { className: "nice-tutorial__step-label", "aria-live": "polite", children: [
|
|
1544
|
+
x + 1,
|
|
1545
|
+
" ",
|
|
1546
|
+
Ie,
|
|
1547
|
+
" ",
|
|
1548
|
+
e.length
|
|
1549
|
+
] }),
|
|
1550
|
+
ke,
|
|
1551
|
+
H && /* @__PURE__ */ t(
|
|
1552
|
+
"div",
|
|
1553
|
+
{
|
|
1554
|
+
className: "nice-tutorial__progress-bar",
|
|
1555
|
+
role: "progressbar",
|
|
1556
|
+
"aria-valuenow": Math.round(G),
|
|
1557
|
+
"aria-valuemin": 0,
|
|
1558
|
+
"aria-valuemax": 100,
|
|
1559
|
+
"aria-label": `${x + 1} ${Ie} ${e.length}`,
|
|
1560
|
+
children: /* @__PURE__ */ t(
|
|
1561
|
+
"div",
|
|
1562
|
+
{
|
|
1563
|
+
className: "nice-tutorial__progress-bar-fill",
|
|
1564
|
+
style: { width: `${G}%` }
|
|
1565
|
+
}
|
|
1566
|
+
)
|
|
1567
|
+
}
|
|
1568
|
+
),
|
|
1569
|
+
He,
|
|
1570
|
+
H && /* @__PURE__ */ E("label", { className: "nice-tutorial__speed", children: [
|
|
1571
|
+
/* @__PURE__ */ t(
|
|
1572
|
+
"input",
|
|
1573
|
+
{
|
|
1574
|
+
type: "range",
|
|
1575
|
+
className: "nice-tutorial__speed-slider",
|
|
1576
|
+
min: c.min,
|
|
1577
|
+
max: c.max,
|
|
1578
|
+
step: 500,
|
|
1579
|
+
value: c.min + c.max - R,
|
|
1580
|
+
onChange: (qe) => O(c.min + c.max - Number(qe.target.value)),
|
|
1581
|
+
"aria-label": Ce
|
|
1582
|
+
}
|
|
1583
|
+
),
|
|
1584
|
+
/* @__PURE__ */ E("span", { className: "nice-tutorial__speed-value", children: [
|
|
1585
|
+
(R / 1e3).toFixed(1),
|
|
1586
|
+
"s"
|
|
1587
|
+
] })
|
|
1588
|
+
] })
|
|
1589
|
+
]
|
|
1590
|
+
}
|
|
1591
|
+
);
|
|
1592
|
+
},
|
|
1593
|
+
[
|
|
1594
|
+
_,
|
|
1595
|
+
m,
|
|
1596
|
+
w,
|
|
1597
|
+
f,
|
|
1598
|
+
W,
|
|
1599
|
+
B,
|
|
1600
|
+
o,
|
|
1601
|
+
ie,
|
|
1602
|
+
ee,
|
|
1603
|
+
J,
|
|
1604
|
+
te,
|
|
1605
|
+
ve,
|
|
1606
|
+
be,
|
|
1607
|
+
Ce,
|
|
1608
|
+
Ie,
|
|
1609
|
+
ye,
|
|
1610
|
+
se,
|
|
1611
|
+
s,
|
|
1612
|
+
T,
|
|
1613
|
+
De,
|
|
1614
|
+
x,
|
|
1615
|
+
e.length,
|
|
1616
|
+
G,
|
|
1617
|
+
R,
|
|
1618
|
+
c,
|
|
1619
|
+
L,
|
|
1620
|
+
p
|
|
1621
|
+
]
|
|
1622
|
+
);
|
|
1623
|
+
if (!n || !s)
|
|
1624
|
+
return null;
|
|
1625
|
+
const U = typeof document < "u" ? Math.max(document.documentElement.scrollWidth, window.innerWidth) : 0, Be = typeof document < "u" ? Math.max(document.documentElement.scrollHeight, window.innerHeight) : 0;
|
|
1626
|
+
return /* @__PURE__ */ E(
|
|
1627
|
+
"div",
|
|
1628
|
+
{
|
|
1629
|
+
className: "nice-tutorial",
|
|
1630
|
+
style: { zIndex: L },
|
|
1631
|
+
"aria-modal": "true",
|
|
1632
|
+
role: "dialog",
|
|
1633
|
+
"aria-label": p("tutorial.tutorial", "Tutorial"),
|
|
1634
|
+
children: [
|
|
1635
|
+
/* @__PURE__ */ E(
|
|
1636
|
+
"svg",
|
|
1637
|
+
{
|
|
1638
|
+
className: "nice-tutorial__overlay",
|
|
1639
|
+
style: {
|
|
1640
|
+
position: "absolute",
|
|
1641
|
+
top: 0,
|
|
1642
|
+
left: 0,
|
|
1643
|
+
width: U,
|
|
1644
|
+
height: Be,
|
|
1645
|
+
pointerEvents: "auto"
|
|
1646
|
+
},
|
|
1647
|
+
onClick: u ? o : void 0,
|
|
1648
|
+
children: [
|
|
1649
|
+
/* @__PURE__ */ t("defs", { children: /* @__PURE__ */ E("mask", { id: "nice-tutorial-mask", children: [
|
|
1650
|
+
/* @__PURE__ */ t("rect", { x: "0", y: "0", width: "100%", height: "100%", fill: "white" }),
|
|
1651
|
+
z && /* @__PURE__ */ t(
|
|
1652
|
+
"rect",
|
|
1653
|
+
{
|
|
1654
|
+
x: z.left,
|
|
1655
|
+
y: z.top,
|
|
1656
|
+
width: z.width,
|
|
1657
|
+
height: z.height,
|
|
1658
|
+
rx: "4",
|
|
1659
|
+
fill: "black",
|
|
1660
|
+
className: v ? "nice-tutorial__spotlight--entering" : ""
|
|
1661
|
+
}
|
|
1662
|
+
)
|
|
1663
|
+
] }) }),
|
|
1664
|
+
/* @__PURE__ */ t(
|
|
1665
|
+
"rect",
|
|
1666
|
+
{
|
|
1667
|
+
x: "0",
|
|
1668
|
+
y: "0",
|
|
1669
|
+
width: "100%",
|
|
1670
|
+
height: "100%",
|
|
1671
|
+
fill: `rgba(0,0,0,${C})`,
|
|
1672
|
+
mask: "url(#nice-tutorial-mask)"
|
|
1673
|
+
}
|
|
1674
|
+
)
|
|
1675
|
+
]
|
|
1676
|
+
}
|
|
1677
|
+
),
|
|
1678
|
+
z && /* @__PURE__ */ t(
|
|
1679
|
+
"div",
|
|
1680
|
+
{
|
|
1681
|
+
className: `nice-tutorial__highlight ${v ? "nice-tutorial__highlight--entering" : ""}`,
|
|
1682
|
+
style: {
|
|
1683
|
+
position: "absolute",
|
|
1684
|
+
top: z.top,
|
|
1685
|
+
left: z.left,
|
|
1686
|
+
width: z.width,
|
|
1687
|
+
height: z.height,
|
|
1688
|
+
transition: `all ${M}ms ease`
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
),
|
|
1692
|
+
s.disableInteraction && z && /* @__PURE__ */ t(
|
|
1693
|
+
"div",
|
|
1694
|
+
{
|
|
1695
|
+
className: "nice-tutorial__blocker",
|
|
1696
|
+
style: {
|
|
1697
|
+
position: "absolute",
|
|
1698
|
+
top: z.top,
|
|
1699
|
+
left: z.left,
|
|
1700
|
+
width: z.width,
|
|
1701
|
+
height: z.height
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
),
|
|
1705
|
+
/* @__PURE__ */ E(
|
|
1706
|
+
"div",
|
|
1707
|
+
{
|
|
1708
|
+
ref: g,
|
|
1709
|
+
className: `nice-tutorial__tooltip nice-tutorial__tooltip--${xe.actualPlacement} ${v ? "nice-tutorial__tooltip--entering" : ""}`,
|
|
1710
|
+
style: {
|
|
1711
|
+
position: "absolute",
|
|
1712
|
+
top: xe.top,
|
|
1713
|
+
left: xe.left,
|
|
1714
|
+
transition: `all ${M}ms ease`,
|
|
1715
|
+
maxWidth: 380,
|
|
1716
|
+
zIndex: L + 1
|
|
1717
|
+
},
|
|
1718
|
+
children: [
|
|
1719
|
+
s.showArrow !== !1 && /* @__PURE__ */ t(
|
|
1720
|
+
"div",
|
|
1721
|
+
{
|
|
1722
|
+
className: `nice-tutorial__arrow nice-tutorial__arrow--${xe.actualPlacement}`
|
|
1723
|
+
}
|
|
1724
|
+
),
|
|
1725
|
+
/* @__PURE__ */ E("div", { className: "nice-tutorial__header", children: [
|
|
1726
|
+
/* @__PURE__ */ t("h4", { className: "nice-tutorial__title", children: s.title }),
|
|
1727
|
+
m && /* @__PURE__ */ t(
|
|
1728
|
+
"button",
|
|
1729
|
+
{
|
|
1730
|
+
type: "button",
|
|
1731
|
+
className: "nice-tutorial__close",
|
|
1732
|
+
onClick: o,
|
|
1733
|
+
"aria-label": Ye,
|
|
1734
|
+
title: Ye,
|
|
1735
|
+
children: /* @__PURE__ */ t(Ot, {})
|
|
1736
|
+
}
|
|
1737
|
+
)
|
|
1738
|
+
] }),
|
|
1739
|
+
/* @__PURE__ */ t(
|
|
1740
|
+
"div",
|
|
1741
|
+
{
|
|
1742
|
+
className: "nice-tutorial__content",
|
|
1743
|
+
dangerouslySetInnerHTML: { __html: Et(s.content) }
|
|
1744
|
+
}
|
|
1745
|
+
),
|
|
1746
|
+
a === "inline" && Ne(!0)
|
|
1747
|
+
]
|
|
1748
|
+
}
|
|
1749
|
+
),
|
|
1750
|
+
a === "floating-bottom" && Ne(!1)
|
|
1751
|
+
]
|
|
1752
|
+
}
|
|
1753
|
+
);
|
|
1754
|
+
};
|
|
1755
|
+
process.env.NODE_ENV !== "production" && (ot.displayName = "NiceTutorial");
|
|
1756
|
+
const rt = /* @__PURE__ */ nt({
|
|
1757
|
+
startTutorial: () => {
|
|
1758
|
+
},
|
|
1759
|
+
stopTutorial: () => {
|
|
1760
|
+
},
|
|
1761
|
+
isActive: !1,
|
|
1762
|
+
currentStep: 0,
|
|
1763
|
+
nextStep: () => {
|
|
1764
|
+
},
|
|
1765
|
+
prevStep: () => {
|
|
1766
|
+
},
|
|
1767
|
+
goToStep: () => {
|
|
1768
|
+
}
|
|
1769
|
+
});
|
|
1770
|
+
function _n() {
|
|
1771
|
+
return Qe(rt);
|
|
1772
|
+
}
|
|
1773
|
+
const Kt = ({ children: e }) => {
|
|
1774
|
+
const [n, r] = Y([]), [o, d] = Y(!1), [l, u] = Y(0), w = k((a) => {
|
|
1775
|
+
r(a), u(0), d(!0);
|
|
1776
|
+
}, []), m = k(() => {
|
|
1777
|
+
d(!1), u(0), r([]);
|
|
1778
|
+
}, []), N = k(() => {
|
|
1779
|
+
u((a) => Math.min(a + 1, n.length - 1));
|
|
1780
|
+
}, [n.length]), M = k(() => {
|
|
1781
|
+
u((a) => Math.max(a - 1, 0));
|
|
1782
|
+
}, []), C = k(
|
|
1783
|
+
(a) => {
|
|
1784
|
+
u(Math.max(0, Math.min(a, n.length - 1)));
|
|
1785
|
+
},
|
|
1786
|
+
[n.length]
|
|
1787
|
+
), L = {
|
|
1788
|
+
startTutorial: w,
|
|
1789
|
+
stopTutorial: m,
|
|
1790
|
+
isActive: o,
|
|
1791
|
+
currentStep: l,
|
|
1792
|
+
nextStep: N,
|
|
1793
|
+
prevStep: M,
|
|
1794
|
+
goToStep: C
|
|
1795
|
+
};
|
|
1796
|
+
return /* @__PURE__ */ E(rt.Provider, { value: L, children: [
|
|
1797
|
+
e,
|
|
1798
|
+
o && n.length > 0 && /* @__PURE__ */ t(
|
|
1799
|
+
ot,
|
|
1800
|
+
{
|
|
1801
|
+
steps: n,
|
|
1802
|
+
active: o,
|
|
1803
|
+
onFinish: m,
|
|
1804
|
+
onSkip: m,
|
|
1805
|
+
onStepChange: u
|
|
1806
|
+
}
|
|
1807
|
+
)
|
|
1808
|
+
] });
|
|
1809
|
+
};
|
|
1810
|
+
process.env.NODE_ENV !== "production" && (Kt.displayName = "NiceTutorialProvider");
|
|
1811
|
+
function Ft(e, n, r, o, d) {
|
|
1812
|
+
const l = e <= d, u = e + d >= r, w = n <= d, m = n + d >= o;
|
|
1813
|
+
return w && l ? "top-left" : w && u ? "top-right" : m && l ? "bottom-left" : m && u ? "bottom-right" : l ? "left" : u ? "right" : w ? "top" : m ? "bottom" : "none";
|
|
1814
|
+
}
|
|
1815
|
+
function Ut(e) {
|
|
1816
|
+
switch (e) {
|
|
1817
|
+
case "left":
|
|
1818
|
+
return { left: 0, top: 0, width: "50%", height: "100%" };
|
|
1819
|
+
case "right":
|
|
1820
|
+
return { left: "50%", top: 0, width: "50%", height: "100%" };
|
|
1821
|
+
case "top":
|
|
1822
|
+
return { left: 0, top: 0, width: "100%", height: "50%" };
|
|
1823
|
+
case "bottom":
|
|
1824
|
+
return { left: 0, top: "50%", width: "100%", height: "50%" };
|
|
1825
|
+
case "top-left":
|
|
1826
|
+
return { left: 0, top: 0, width: "50%", height: "50%" };
|
|
1827
|
+
case "top-right":
|
|
1828
|
+
return { left: "50%", top: 0, width: "50%", height: "50%" };
|
|
1829
|
+
case "bottom-left":
|
|
1830
|
+
return { left: 0, top: "50%", width: "50%", height: "50%" };
|
|
1831
|
+
case "bottom-right":
|
|
1832
|
+
return { left: "50%", top: "50%", width: "50%", height: "50%" };
|
|
1833
|
+
default:
|
|
1834
|
+
return null;
|
|
1835
|
+
}
|
|
1836
|
+
}
|
|
1837
|
+
const gn = /* @__PURE__ */ Object.assign(
|
|
1838
|
+
/* @__PURE__ */ Ze(
|
|
1839
|
+
({
|
|
1840
|
+
windowKey: e,
|
|
1841
|
+
title: n,
|
|
1842
|
+
icon: r,
|
|
1843
|
+
children: o,
|
|
1844
|
+
footer: d,
|
|
1845
|
+
x: l,
|
|
1846
|
+
y: u,
|
|
1847
|
+
defaultPosition: w,
|
|
1848
|
+
width: m = 480,
|
|
1849
|
+
height: N = 360,
|
|
1850
|
+
minWidth: M = 200,
|
|
1851
|
+
minHeight: C = 120,
|
|
1852
|
+
maxWidth: L,
|
|
1853
|
+
maxHeight: a,
|
|
1854
|
+
zIndex: f = 1,
|
|
1855
|
+
closable: _ = !0,
|
|
1856
|
+
minimizable: h = !0,
|
|
1857
|
+
maximizable: c = !0,
|
|
1858
|
+
fullscreenable: b = !1,
|
|
1859
|
+
pinnable: p = !1,
|
|
1860
|
+
resizable: x = !0,
|
|
1861
|
+
draggable: P = !0,
|
|
1862
|
+
snappable: z = !0,
|
|
1863
|
+
snapThreshold: A = 20,
|
|
1864
|
+
minimized: y,
|
|
1865
|
+
maximized: i,
|
|
1866
|
+
fullscreen: v,
|
|
1867
|
+
pinned: I,
|
|
1868
|
+
focused: T,
|
|
1869
|
+
onClose: D,
|
|
1870
|
+
onMinimize: R,
|
|
1871
|
+
onMaximize: O,
|
|
1872
|
+
onFullscreen: g,
|
|
1873
|
+
onPin: $,
|
|
1874
|
+
onFocus: s,
|
|
1875
|
+
onMove: B,
|
|
1876
|
+
onResize: W,
|
|
1877
|
+
onSnap: J,
|
|
1878
|
+
onTitleBarDoubleClick: ee,
|
|
1879
|
+
size: te = "md",
|
|
1880
|
+
statusBar: ie,
|
|
1881
|
+
titleBarActions: Ie,
|
|
1882
|
+
className: ve,
|
|
1883
|
+
style: be,
|
|
1884
|
+
id: Ce,
|
|
1885
|
+
accessMode: Ye,
|
|
1886
|
+
...se
|
|
1887
|
+
}, ye) => {
|
|
1888
|
+
const De = Ge(Ce), xe = Mt(Ye, Ce), { t: G } = ge(), Ne = K(null);
|
|
1889
|
+
Ne.current == null && (Ne.current = `nice-window-${Math.random().toString(36).slice(2, 10)}`);
|
|
1890
|
+
const U = e ?? Ne.current, Be = l ?? w?.x ?? 100, X = u ?? w?.y ?? 100, [H, j] = Y({ x: Be, y: X }), [ae, ke] = Y({ width: m, height: N }), [He, qe] = Y(!1), [ct, st] = Y(!1), [at, lt] = Y(!1), [dt, ut] = Y(!1), [oe, We] = Y("none"), mt = y ?? He, ne = i ?? ct, Q = v ?? at, $e = I ?? dt, Ae = T ?? !0, pe = H.x, we = H.y, le = ae.width, de = ae.height, ue = K(null), Z = K(null), F = K(null), ht = k(() => {
|
|
1891
|
+
D?.(U);
|
|
1892
|
+
}, [U, D]), ft = k(() => {
|
|
1893
|
+
qe(!0), R?.(U);
|
|
1894
|
+
}, [U, R]), Ke = k(() => {
|
|
1895
|
+
const S = !ne;
|
|
1896
|
+
st(S), !S && F.current ? (j({ x: F.current.x, y: F.current.y }), ke({ width: F.current.w, height: F.current.h }), F.current = null) : S && (F.current = { x: pe, y: we, w: le, h: de }), We("none"), O?.(U, S);
|
|
1897
|
+
}, [U, ne, pe, we, le, de, O]), Fe = k(() => {
|
|
1898
|
+
const S = !Q;
|
|
1899
|
+
lt(S), S ? F.current = { x: pe, y: we, w: le, h: de } : F.current && (j({ x: F.current.x, y: F.current.y }), ke({ width: F.current.w, height: F.current.h }), F.current = null), g?.(U, S);
|
|
1900
|
+
}, [U, Q, pe, we, le, de, g]), pt = k(() => {
|
|
1901
|
+
const S = !$e;
|
|
1902
|
+
ut(S), $?.(U, S);
|
|
1903
|
+
}, [U, $e, $]), Le = k(() => {
|
|
1904
|
+
s?.(U);
|
|
1905
|
+
}, [U, s]), wt = k(() => {
|
|
1906
|
+
ee ? ee(U) : c && Ke();
|
|
1907
|
+
}, [U, c, Ke, ee]);
|
|
1908
|
+
q(() => {
|
|
1909
|
+
const S = (me) => {
|
|
1910
|
+
if (!ue.current)
|
|
1911
|
+
return;
|
|
1912
|
+
const re = me.clientX - ue.current.startX + ue.current.origX, Re = me.clientY - ue.current.startY + ue.current.origY;
|
|
1913
|
+
j({ x: re, y: Re }), B?.(U, { x: re, y: Re });
|
|
1914
|
+
}, V = (me) => {
|
|
1915
|
+
if (ue.current) {
|
|
1916
|
+
if (z) {
|
|
1917
|
+
const re = Ft(
|
|
1918
|
+
me.clientX,
|
|
1919
|
+
me.clientY,
|
|
1920
|
+
window.innerWidth,
|
|
1921
|
+
window.innerHeight,
|
|
1922
|
+
A
|
|
1923
|
+
);
|
|
1924
|
+
re !== "none" && (F.current = { x: H.x, y: H.y, w: le, h: de }, We(re), J?.(U, re));
|
|
1925
|
+
}
|
|
1926
|
+
ue.current = null;
|
|
1927
|
+
}
|
|
1928
|
+
};
|
|
1929
|
+
return document.addEventListener("mousemove", S), document.addEventListener("mouseup", V), () => {
|
|
1930
|
+
document.removeEventListener("mousemove", S), document.removeEventListener("mouseup", V);
|
|
1931
|
+
};
|
|
1932
|
+
});
|
|
1933
|
+
const _t = k(
|
|
1934
|
+
(S) => {
|
|
1935
|
+
!P || ne || Q || (S.preventDefault(), oe !== "none" && (F.current && (j({ x: F.current.x, y: F.current.y }), ke({ width: F.current.w, height: F.current.h })), We("none")), Le(), ue.current = { startX: S.clientX, startY: S.clientY, origX: pe, origY: we });
|
|
1936
|
+
},
|
|
1937
|
+
[P, ne, Q, oe, pe, we, Le]
|
|
1938
|
+
);
|
|
1939
|
+
q(() => {
|
|
1940
|
+
const S = (me) => {
|
|
1941
|
+
if (!Z.current)
|
|
1942
|
+
return;
|
|
1943
|
+
const re = me.clientX - Z.current.startX, Re = me.clientY - Z.current.startY, Ee = Z.current.handle;
|
|
1944
|
+
let he = Z.current.origW, fe = Z.current.origH;
|
|
1945
|
+
if (Ee.includes("e") && (he = Z.current.origW + re), Ee.includes("w") && (he = Z.current.origW - re), Ee.includes("s") && (fe = Z.current.origH + Re), Ee.includes("n") && (fe = Z.current.origH - Re), he = Math.max(M, L ? Math.min(L, he) : he), fe = Math.max(C, a ? Math.min(a, fe) : fe), Ee.includes("w")) {
|
|
1946
|
+
const Ue = ae.width - he;
|
|
1947
|
+
j((Se) => ({ ...Se, x: Se.x + Ue }));
|
|
1948
|
+
}
|
|
1949
|
+
if (Ee.includes("n")) {
|
|
1950
|
+
const Ue = ae.height - fe;
|
|
1951
|
+
j((Se) => ({ ...Se, y: Se.y + Ue }));
|
|
1952
|
+
}
|
|
1953
|
+
ke({ width: he, height: fe }), W?.(U, { width: he, height: fe });
|
|
1954
|
+
}, V = () => {
|
|
1955
|
+
Z.current = null;
|
|
1956
|
+
};
|
|
1957
|
+
return document.addEventListener("mousemove", S), document.addEventListener("mouseup", V), () => {
|
|
1958
|
+
document.removeEventListener("mousemove", S), document.removeEventListener("mouseup", V);
|
|
1959
|
+
};
|
|
1960
|
+
});
|
|
1961
|
+
const gt = k(
|
|
1962
|
+
(S, V) => {
|
|
1963
|
+
!x || ne || Q || oe !== "none" || (V.preventDefault(), V.stopPropagation(), Le(), Z.current = { startX: V.clientX, startY: V.clientY, origW: le, origH: de, handle: S });
|
|
1964
|
+
},
|
|
1965
|
+
[x, ne, Q, oe, le, de, Le]
|
|
1966
|
+
);
|
|
1967
|
+
if (q(() => {
|
|
1968
|
+
if (!Ae)
|
|
1969
|
+
return;
|
|
1970
|
+
const S = (V) => {
|
|
1971
|
+
V.key === "Escape" && Q && Fe();
|
|
1972
|
+
};
|
|
1973
|
+
return document.addEventListener("keydown", S), () => document.removeEventListener("keydown", S);
|
|
1974
|
+
}, [Ae, Q, Fe]), xe === "hidden" || mt)
|
|
1975
|
+
return null;
|
|
1976
|
+
const Je = oe !== "none" ? Ut(oe) : null, et = ne || Q, vt = Q ? { position: "fixed", top: 0, left: 0, width: "100vw", height: "100vh", zIndex: 999999 } : ne ? { position: "absolute", top: 0, left: 0, width: "100%", height: "100%", zIndex: f } : Je ? { position: "absolute", ...Je, zIndex: f } : { position: "absolute", top: we, left: pe, width: le, height: de, zIndex: f }, bt = ["n", "e", "s", "w", "ne", "se", "sw", "nw"], yt = {
|
|
1977
|
+
n: "ns-resize",
|
|
1978
|
+
s: "ns-resize",
|
|
1979
|
+
e: "ew-resize",
|
|
1980
|
+
w: "ew-resize",
|
|
1981
|
+
ne: "nesw-resize",
|
|
1982
|
+
sw: "nesw-resize",
|
|
1983
|
+
nw: "nwse-resize",
|
|
1984
|
+
se: "nwse-resize"
|
|
1985
|
+
};
|
|
1986
|
+
return /* @__PURE__ */ E(
|
|
1987
|
+
"div",
|
|
1988
|
+
{
|
|
1989
|
+
ref: ye,
|
|
1990
|
+
id: De,
|
|
1991
|
+
className: `nice-window nice-window--${te} ${Ae ? "nice-window--focused" : ""} ${$e ? "nice-window--pinned" : ""} ${et ? "nice-window--maximized" : ""} ${oe !== "none" ? `nice-window--snapped-${oe}` : ""} ${ve ?? ""}`,
|
|
1992
|
+
style: { ...vt, ...be },
|
|
1993
|
+
onMouseDown: Le,
|
|
1994
|
+
role: "dialog",
|
|
1995
|
+
"aria-label": n,
|
|
1996
|
+
...se,
|
|
1997
|
+
children: [
|
|
1998
|
+
/* @__PURE__ */ E(
|
|
1999
|
+
"div",
|
|
2000
|
+
{
|
|
2001
|
+
className: "nice-window__titlebar",
|
|
2002
|
+
onMouseDown: _t,
|
|
2003
|
+
onDoubleClick: wt,
|
|
2004
|
+
children: [
|
|
2005
|
+
r && /* @__PURE__ */ t("span", { className: "nice-window__icon", children: r }),
|
|
2006
|
+
/* @__PURE__ */ t("span", { className: "nice-window__title", children: n }),
|
|
2007
|
+
/* @__PURE__ */ E("div", { className: "nice-window__actions", children: [
|
|
2008
|
+
Ie,
|
|
2009
|
+
p && /* @__PURE__ */ t(
|
|
2010
|
+
"button",
|
|
2011
|
+
{
|
|
2012
|
+
type: "button",
|
|
2013
|
+
className: `nice-window__action nice-window__action--pin ${$e ? "nice-window__action--active" : ""}`,
|
|
2014
|
+
onClick: pt,
|
|
2015
|
+
title: $e ? G("window.unpin", "Unpin") : G("window.pin", "Pin"),
|
|
2016
|
+
children: /* @__PURE__ */ t(ce, { name: "paperclip", size: 14 })
|
|
2017
|
+
}
|
|
2018
|
+
),
|
|
2019
|
+
h && /* @__PURE__ */ t(
|
|
2020
|
+
"button",
|
|
2021
|
+
{
|
|
2022
|
+
type: "button",
|
|
2023
|
+
className: "nice-window__action nice-window__action--minimize",
|
|
2024
|
+
onClick: ft,
|
|
2025
|
+
title: G("window.minimize", "Minimize"),
|
|
2026
|
+
children: /* @__PURE__ */ t(ce, { name: "minus", size: 14 })
|
|
2027
|
+
}
|
|
2028
|
+
),
|
|
2029
|
+
c && /* @__PURE__ */ t(
|
|
2030
|
+
"button",
|
|
2031
|
+
{
|
|
2032
|
+
type: "button",
|
|
2033
|
+
className: "nice-window__action nice-window__action--maximize",
|
|
2034
|
+
onClick: Ke,
|
|
2035
|
+
title: ne ? G("window.restore", "Restore") : G("window.maximize", "Maximize"),
|
|
2036
|
+
children: /* @__PURE__ */ t(ce, { name: ne ? "copy" : "window", size: 14 })
|
|
2037
|
+
}
|
|
2038
|
+
),
|
|
2039
|
+
b && /* @__PURE__ */ t(
|
|
2040
|
+
"button",
|
|
2041
|
+
{
|
|
2042
|
+
type: "button",
|
|
2043
|
+
className: "nice-window__action nice-window__action--fullscreen",
|
|
2044
|
+
onClick: Fe,
|
|
2045
|
+
title: Q ? G("window.exitFullscreen", "Exit Full Screen") : G("window.fullscreen", "Full Screen"),
|
|
2046
|
+
children: /* @__PURE__ */ t(ce, { name: Q ? "collapse" : "expand", size: 14 })
|
|
2047
|
+
}
|
|
2048
|
+
),
|
|
2049
|
+
_ && /* @__PURE__ */ t(
|
|
2050
|
+
"button",
|
|
2051
|
+
{
|
|
2052
|
+
type: "button",
|
|
2053
|
+
className: "nice-window__action nice-window__action--close",
|
|
2054
|
+
onClick: ht,
|
|
2055
|
+
title: G("window.close", "Close"),
|
|
2056
|
+
children: /* @__PURE__ */ t(ce, { name: "close", size: 14 })
|
|
2057
|
+
}
|
|
2058
|
+
)
|
|
2059
|
+
] })
|
|
2060
|
+
]
|
|
2061
|
+
}
|
|
2062
|
+
),
|
|
2063
|
+
/* @__PURE__ */ t("div", { className: "nice-window__body", children: o }),
|
|
2064
|
+
d && /* @__PURE__ */ t("div", { className: "nice-window__footer", children: d }),
|
|
2065
|
+
ie && /* @__PURE__ */ t("div", { className: "nice-window__statusbar", children: ie }),
|
|
2066
|
+
x && !et && oe === "none" && /* @__PURE__ */ t(_e, { children: bt.map((S) => /* @__PURE__ */ t(
|
|
2067
|
+
"div",
|
|
2068
|
+
{
|
|
2069
|
+
className: `nice-window__resize nice-window__resize--${S}`,
|
|
2070
|
+
style: { cursor: yt[S] },
|
|
2071
|
+
onMouseDown: (V) => gt(S, V)
|
|
2072
|
+
},
|
|
2073
|
+
S
|
|
2074
|
+
)) })
|
|
2075
|
+
]
|
|
2076
|
+
}
|
|
2077
|
+
);
|
|
2078
|
+
}
|
|
2079
|
+
),
|
|
2080
|
+
{ displayName: "NiceWindow" }
|
|
2081
|
+
);
|
|
2082
|
+
export {
|
|
2083
|
+
Zt as N,
|
|
2084
|
+
pn as a,
|
|
2085
|
+
tn as b,
|
|
2086
|
+
Pt as c,
|
|
2087
|
+
en as d,
|
|
2088
|
+
an as e,
|
|
2089
|
+
ln as f,
|
|
2090
|
+
sn as g,
|
|
2091
|
+
un as h,
|
|
2092
|
+
hn as i,
|
|
2093
|
+
dn as j,
|
|
2094
|
+
cn as k,
|
|
2095
|
+
mn as l,
|
|
2096
|
+
Jt as m,
|
|
2097
|
+
on as n,
|
|
2098
|
+
nn as o,
|
|
2099
|
+
rn as p,
|
|
2100
|
+
ot as q,
|
|
2101
|
+
Kt as r,
|
|
2102
|
+
gn as s,
|
|
2103
|
+
wn as t,
|
|
2104
|
+
St as u,
|
|
2105
|
+
fn as v,
|
|
2106
|
+
je as w,
|
|
2107
|
+
Lt as x,
|
|
2108
|
+
_n as y
|
|
2109
|
+
};
|