@nice2dev/ui 1.4.23 → 1.4.25
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 +100 -0
- package/README.md +2 -4
- package/dist/NiceModuleLifecyclePanel-bsHwj1pO.cjs +1 -0
- package/dist/{NicePivotGrid-B5Fgi5E_.cjs → NicePivotGrid-D53CQ2cY.cjs} +1 -1
- package/dist/{NiceStreamDashboard.doc-74KUXya1.cjs → NiceStreamDashboard.doc-CdkHFf4Y.cjs} +2 -2
- package/dist/charts/NiceAdvancedCharts.mjs +586 -773
- package/dist/charts/NiceChartRangeSelector.mjs +159 -0
- package/dist/charts/NiceHeatMap.mjs +140 -70
- package/dist/charts/NiceOrganizationChart.mjs +183 -90
- package/dist/charts/NiceSankey.mjs +166 -93
- package/dist/charts/NiceStockChart.mjs +258 -157
- package/dist/charts-CSgOgfES.cjs +867 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.d.ts +126 -102
- package/dist/charts.mjs +22 -24
- package/dist/core/lazy.mjs +50 -63
- package/dist/core-lazy-sO0xvg64.cjs +1 -0
- package/dist/data.cjs +1 -1
- package/dist/demo/docs/docPreviews.mjs +504 -546
- package/dist/demo/docs/docRegistry.mjs +9 -94
- package/dist/docs/NiceStreamDashboard.doc.json.mjs +1 -1
- package/dist/documentation/utils.mjs +1 -1
- package/dist/index.cjs +95 -121
- package/dist/index.d.ts +126 -217
- package/dist/index.mjs +829 -836
- package/dist/lazy.cjs +1 -1
- package/dist/lazy.d.ts +41 -23
- package/dist/lazy.mjs +1 -1
- package/dist/navigation/NiceDock.mjs +55 -48
- package/dist/navigation/NiceMenuTypes.mjs +197 -251
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.d.ts +5 -16
- package/dist/navigation.mjs +53 -54
- package/dist/style.css +2 -2
- package/dist/tools/NiceShowcase.mjs +2 -4
- package/package.json +4 -4
- package/dist/NiceDiagram.doc-CASS0Tnj.cjs +0 -8
- package/dist/NiceModuleLifecyclePanel-jckyVqqt.cjs +0 -1
- package/dist/charts/NiceRangeSelector.mjs +0 -135
- package/dist/charts/NiceTreeMap.mjs +0 -100
- package/dist/charts/NiceVectorMap.mjs +0 -59
- package/dist/charts-C9B548D2.cjs +0 -924
- package/dist/core-lazy-B54FdghB.cjs +0 -1
- package/dist/docs/NiceDiagram.doc.json.mjs +0 -32
- package/dist/tools/NiceChat.mjs +0 -98
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const r=require("react/jsx-runtime"),C=require("@nice2dev/ui-core"),o=require("react"),f=({height:e=200})=>r.jsx("div",{className:"ntd-lazy-loading",style:{display:"flex",alignItems:"center",justifyContent:"center",height:e,background:"var(--ntd-color-surface, #f5f5f5)",borderRadius:"var(--ntd-radius, 8px)",animation:"ntd-pulse 1.5s ease-in-out infinite"},children:r.jsx("div",{className:"ntd-lazy-loading-spinner",style:{width:24,height:24,border:"2px solid var(--ntd-color-border, #ddd)",borderTopColor:"var(--ntd-color-primary, #6366f1)",borderRadius:"50%",animation:"ntd-spin 0.8s linear infinite"}})}),L=(e,t)=>{const{t:a}=C.useNiceTranslation();return r.jsxs("div",{className:"ntd-lazy-error",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:24,background:"var(--ntd-color-error-bg, #fee2e2)",borderRadius:"var(--ntd-radius, 8px)",color:"var(--ntd-color-error, #dc2626)"},children:[r.jsx(C.NiceIcon,{name:"error",size:32}),r.jsx("p",{style:{margin:"12px 0 8px",fontWeight:500},children:a("lazy.failedToLoadComponent","Failed to load component")}),r.jsx("p",{style:{margin:0,fontSize:"0.875em",opacity:.8},children:e.message}),r.jsx("button",{onClick:t,style:{marginTop:16,padding:"8px 16px",border:"none",borderRadius:"var(--ntd-radius, 8px)",background:"var(--ntd-color-error, #dc2626)",color:"var(--nice-color-white, #fff)",cursor:"pointer",fontSize:"0.875em"},children:a("lazy.retry","Retry")})]})};class D extends o.Component{constructor(){super(...arguments),this.state={error:null},this.handleRetry=()=>{this.setState({error:null})}}static getDerivedStateFromError(t){return{error:t}}render(){return this.state.error?this.props.fallback(this.state.error,this.handleRetry):this.props.children}}function i(e,t={}){const{fallback:a=r.jsx(f,{}),preloadOnMount:l=!1,preloadOnHover:p=!1,preloadAfterIdle:n,minLoadingTime:m=0,ssrFallback:c,errorFallback:S=L,displayName:P}=t;let b=null,h=!1;const y=async()=>{if(b)return b;const x=Date.now();b=e();const v=await b;if(m>0){const w=Date.now()-x;w<m&&await new Promise(u=>setTimeout(u,m-w))}return h=!0,v},I=o.lazy(y),q=x=>{const v=o.useRef(null);return o.useEffect(()=>{l&&!h&&y()},[]),o.useEffect(()=>{if(n&&!h){const u="requestIdleCallback"in window?window.requestIdleCallback(()=>y(),{timeout:n}):setTimeout(()=>y(),n);return()=>{"cancelIdleCallback"in window?window.cancelIdleCallback(u):clearTimeout(u)}}},[]),o.useEffect(()=>{if(!p||h)return;const u=v.current;if(!u)return;const N=()=>{h||y()};return u.addEventListener("mouseenter",N,{once:!0}),()=>u.removeEventListener("mouseenter",N)},[]),typeof window>"u"&&c?r.jsx(r.Fragment,{children:c}):r.jsx("div",{ref:v,className:"ntd-lazy-wrapper",children:r.jsx(D,{fallback:S,children:r.jsx(o.Suspense,{fallback:a,children:r.jsx(I,{...x})})})})},R=async()=>{h||await y()},k=q;return k.preload=R,k.displayName=P||"LazyComponent",k}function G(e=.1,t="100px"){const a=o.useRef(null),[l,p]=o.useState(!1);return o.useEffect(()=>{if(!a.current||l)return;const n=new IntersectionObserver(([m])=>{m.isIntersecting&&(p(!0),n.disconnect())},{threshold:e,rootMargin:t});return n.observe(a.current),()=>n.disconnect()},[e,t,l]),[a,l]}function V(e,t=2e3){o.useEffect(()=>{if("requestIdleCallback"in window){const a=window.requestIdleCallback(()=>{e.forEach(l=>l())},{timeout:t});return()=>window.cancelIdleCallback(a)}else{const a=setTimeout(()=>{e.forEach(l=>l())},t);return()=>clearTimeout(a)}},[])}function T(e,t){const a=o.useRef(new Set);o.useEffect(()=>{const l=document.querySelectorAll("a[href]"),p=n=>{const c=n.currentTarget.getAttribute("href");c&&e[c]&&!a.current.has(c)&&(e[c](),a.current.add(c))};return l.forEach(n=>{n.addEventListener("mouseenter",p)}),()=>{l.forEach(n=>{n.removeEventListener("mouseenter",p)})}},[t,e])}const z=()=>r.jsx(f,{height:400}),g=()=>r.jsx(f,{height:300}),j=()=>r.jsx(f,{height:500}),E=()=>r.jsx(f,{height:600}),d=e=>e,s={CodeEditor:i(d(()=>Promise.resolve().then(()=>require("./NiceCodeEditor-CBgbzwjx.cjs")).then(e=>({default:e.NiceCodeEditor}))),{fallback:r.jsx(z,{}),preloadOnHover:!0,displayName:"LazyCodeEditor"}),HtmlEditor:i(d(()=>Promise.resolve().then(()=>require("./NiceHtmlEditor-BEWNA_UI.cjs")).then(e=>({default:e.NiceHtmlEditor}))),{fallback:r.jsx(z,{}),preloadOnHover:!0,displayName:"LazyHtmlEditor"}),DocumentViewer:i(d(()=>Promise.resolve().then(()=>require("./NiceDocumentViewer-CDXAmPp7.cjs")).then(e=>({default:e.NiceDocumentViewer}))),{fallback:r.jsx(f,{height:600}),displayName:"LazyDocumentViewer"}),Chart:i(d(()=>Promise.resolve().then(()=>require("./charts-C9B548D2.cjs")).then(e=>e.NiceChart$1).then(e=>({default:e.NiceChart}))),{fallback:r.jsx(g,{}),preloadAfterIdle:3e3,displayName:"LazyChart"}),VectorMap:i(d(()=>Promise.resolve().then(()=>require("./charts-C9B548D2.cjs")).then(e=>e.NiceVectorMap$1).then(e=>({default:e.NiceVectorMap}))),{fallback:r.jsx(f,{height:400}),displayName:"LazyVectorMap"}),Sankey:i(d(()=>Promise.resolve().then(()=>require("./charts-C9B548D2.cjs")).then(e=>e.NiceSankey$1).then(e=>({default:e.NiceSankey}))),{fallback:r.jsx(g,{}),displayName:"LazySankey"}),Scheduler:i(d(()=>Promise.resolve().then(()=>require("./NiceScheduler-Dff8fuq_.cjs")).then(e=>e.NiceScheduler$1).then(e=>({default:e.NiceScheduler}))),{fallback:r.jsx(E,{}),displayName:"LazyScheduler"}),Gantt:i(d(()=>Promise.resolve().then(()=>require("./NiceGantt-Drl4gvw9.cjs")).then(e=>({default:e.NiceGantt}))),{fallback:r.jsx(E,{}),displayName:"LazyGantt"}),PivotGrid:i(d(()=>Promise.resolve().then(()=>require("./NicePivotGrid-B5Fgi5E_.cjs")).then(e=>e.NicePivotGrid$1).then(e=>({default:e.NicePivotGrid}))),{fallback:r.jsx(j,{}),displayName:"LazyPivotGrid"}),DataGrid:i(d(()=>Promise.resolve().then(()=>require("./NiceDataGrid-Cszjz8NV.cjs")).then(e=>e.NiceDataGrid$1).then(e=>({default:e.NiceDataGrid}))),{fallback:r.jsx(j,{}),preloadAfterIdle:2e3,displayName:"LazyDataGrid"})};async function H(){await Promise.all([s.CodeEditor.preload(),s.HtmlEditor.preload(),s.DocumentViewer.preload(),s.Chart.preload(),s.VectorMap.preload(),s.Sankey.preload(),s.Scheduler.preload(),s.Gantt.preload(),s.PivotGrid.preload()])}async function O(e){await Promise.all(e.map(t=>s[t].preload()))}exports.DefaultErrorFallback=L;exports.DefaultLoadingFallback=f;exports.LazyComponents=s;exports.createLazyComponent=i;exports.preloadAllHeavyComponents=H;exports.preloadComponents=O;exports.useLazyOnVisible=G;exports.usePreloadOnIdle=V;exports.usePreloadOnRouteHint=T;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
const e = "https://nice2dev.com/schemas/component-doc-v1.json", a = "NiceDiagram", i = "Diagram renderer for flowcharts, network diagrams, and graphs.", n = "planning", o = "1.0.0", t = "planned", r = [{ name: "nodes", type: "DiagramNode[]", required: !0, description: "Diagram nodes" }, { name: "edges", type: "DiagramEdge[]", required: !0, description: "Diagram edges" }, { name: "onChange", type: "(nodes: DiagramNode[], edges: DiagramEdge[]) => void", description: "Change callback" }, { name: "layout", type: "'auto' | 'manual' | 'hierarchical' | 'circular'", default: "'auto'", description: "Layout algorithm" }, { name: "interactive", type: "boolean", default: "true", description: "Allow interactions" }, { name: "showMinimap", type: "boolean", default: "false", description: "Show minimap" }, { name: "fitView", type: "boolean", default: "true", description: "Fit diagram to view" }, { name: "onNodeClick", type: "(node: DiagramNode) => void", description: "Node click callback" }], s = [{ title: "Diagram", description: "Render diagram", code: `<NiceDiagram
|
|
2
|
-
nodes={diagramNodes}
|
|
3
|
-
edges={diagramEdges}
|
|
4
|
-
onChange={updateDiagram}
|
|
5
|
-
layout="hierarchical"
|
|
6
|
-
interactive
|
|
7
|
-
showMinimap
|
|
8
|
-
/>` }], c = { keyboard: ["Tab through nodes", "Arrow keys to pan"], aria: ["Diagram region", "Node descriptions"] }, d = ["NiceDiagramDesigner", "NiceFlowChart"], m = {
|
|
9
|
-
$schema: e,
|
|
10
|
-
name: a,
|
|
11
|
-
description: i,
|
|
12
|
-
category: n,
|
|
13
|
-
since: o,
|
|
14
|
-
status: t,
|
|
15
|
-
props: r,
|
|
16
|
-
examples: s,
|
|
17
|
-
accessibility: c,
|
|
18
|
-
seeAlso: d
|
|
19
|
-
};
|
|
20
|
-
export {
|
|
21
|
-
e as $schema,
|
|
22
|
-
c as accessibility,
|
|
23
|
-
n as category,
|
|
24
|
-
m as default,
|
|
25
|
-
i as description,
|
|
26
|
-
s as examples,
|
|
27
|
-
a as name,
|
|
28
|
-
r as props,
|
|
29
|
-
d as seeAlso,
|
|
30
|
-
o as since,
|
|
31
|
-
t as status
|
|
32
|
-
};
|
package/dist/tools/NiceChat.mjs
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { jsxs as a, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { useControlId as S, useNiceAccessMode as I, useNiceTranslation as R } from "@nice2dev/ui-core";
|
|
3
|
-
import { forwardRef as T, useState as j, useRef as A, useEffect as K } from "react";
|
|
4
|
-
const $ = [], L = /* @__PURE__ */ Object.assign(
|
|
5
|
-
/* @__PURE__ */ T(
|
|
6
|
-
({
|
|
7
|
-
messages: d = $,
|
|
8
|
-
onSend: c,
|
|
9
|
-
placeholder: p,
|
|
10
|
-
title: l,
|
|
11
|
-
disabled: v,
|
|
12
|
-
showTimestamp: N = !0,
|
|
13
|
-
showAvatar: f = !0,
|
|
14
|
-
renderMessage: o,
|
|
15
|
-
className: b,
|
|
16
|
-
style: y,
|
|
17
|
-
id: w,
|
|
18
|
-
accessMode: x,
|
|
19
|
-
"data-testid": O
|
|
20
|
-
}, C) => {
|
|
21
|
-
const D = S(w), i = I(x), { t: h } = R(), [n, u] = j(""), _ = A(null), s = v || i === "disabled", r = i === "readOnly", E = i === "hidden";
|
|
22
|
-
K(() => {
|
|
23
|
-
_.current?.scrollIntoView({ behavior: "smooth" });
|
|
24
|
-
}, [d.length]);
|
|
25
|
-
const m = () => {
|
|
26
|
-
const e = n.trim();
|
|
27
|
-
!e || s || r || !c || (c(e), u(""));
|
|
28
|
-
}, M = (e) => {
|
|
29
|
-
e.key === "Enter" && !e.shiftKey && (e.preventDefault(), m());
|
|
30
|
-
};
|
|
31
|
-
return E ? null : /* @__PURE__ */ a(
|
|
32
|
-
"div",
|
|
33
|
-
{
|
|
34
|
-
ref: C,
|
|
35
|
-
id: D,
|
|
36
|
-
className: `nice-chat ${b || ""}`,
|
|
37
|
-
style: y,
|
|
38
|
-
"data-testid": O,
|
|
39
|
-
children: [
|
|
40
|
-
l && /* @__PURE__ */ t("div", { className: "nice-chat__header", children: l }),
|
|
41
|
-
/* @__PURE__ */ a("div", { className: "nice-chat__messages", children: [
|
|
42
|
-
d.map((e) => /* @__PURE__ */ a(
|
|
43
|
-
"div",
|
|
44
|
-
{
|
|
45
|
-
className: `nice-chat__message ${e.isOwn ? "nice-chat__message--own" : ""}`,
|
|
46
|
-
children: [
|
|
47
|
-
f && !e.isOwn && /* @__PURE__ */ t("div", { className: "nice-chat__avatar", children: e.avatar ? /* @__PURE__ */ t("img", { src: e.avatar, alt: e.author }) : e.author.charAt(0).toUpperCase() }),
|
|
48
|
-
/* @__PURE__ */ a("div", { className: "nice-chat__bubble", children: [
|
|
49
|
-
!e.isOwn && /* @__PURE__ */ t("div", { className: "nice-chat__author", children: e.author }),
|
|
50
|
-
o ? o(e) : /* @__PURE__ */ t("div", { className: "nice-chat__text", children: e.text }),
|
|
51
|
-
N && /* @__PURE__ */ a("div", { className: "nice-chat__time", children: [
|
|
52
|
-
new Date(e.timestamp).toLocaleTimeString([], {
|
|
53
|
-
hour: "2-digit",
|
|
54
|
-
minute: "2-digit"
|
|
55
|
-
}),
|
|
56
|
-
e.status && /* @__PURE__ */ t("span", { className: `nice-chat__status nice-chat__status--${e.status}` })
|
|
57
|
-
] })
|
|
58
|
-
] })
|
|
59
|
-
]
|
|
60
|
-
},
|
|
61
|
-
e.id
|
|
62
|
-
)),
|
|
63
|
-
/* @__PURE__ */ t("div", { ref: _ })
|
|
64
|
-
] }),
|
|
65
|
-
c && /* @__PURE__ */ a("div", { className: "nice-chat__input", children: [
|
|
66
|
-
/* @__PURE__ */ t(
|
|
67
|
-
"textarea",
|
|
68
|
-
{
|
|
69
|
-
value: n,
|
|
70
|
-
onChange: (e) => u(e.target.value),
|
|
71
|
-
onKeyDown: M,
|
|
72
|
-
placeholder: p || h("typeMessage", "Type a message..."),
|
|
73
|
-
disabled: s,
|
|
74
|
-
readOnly: r,
|
|
75
|
-
rows: 1,
|
|
76
|
-
className: "nice-chat__textarea"
|
|
77
|
-
}
|
|
78
|
-
),
|
|
79
|
-
/* @__PURE__ */ t(
|
|
80
|
-
"button",
|
|
81
|
-
{
|
|
82
|
-
className: "nice-btn nice-btn--primary nice-btn--sm",
|
|
83
|
-
onClick: m,
|
|
84
|
-
disabled: s || r || !n.trim(),
|
|
85
|
-
children: h("send", "Send")
|
|
86
|
-
}
|
|
87
|
-
)
|
|
88
|
-
] })
|
|
89
|
-
]
|
|
90
|
-
}
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
),
|
|
94
|
-
{ displayName: "NiceChat" }
|
|
95
|
-
);
|
|
96
|
-
export {
|
|
97
|
-
L as NiceChat
|
|
98
|
-
};
|