@nice2dev/ui 1.4.20 → 1.4.21

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.
Files changed (35) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/dist/NiceGantt-Drl4gvw9.cjs +1 -0
  3. package/dist/{NiceGantt.doc-B6YZcJvG.cjs → NiceGantt.doc-DTv0r7bP.cjs} +2 -2
  4. package/dist/NiceModuleLifecyclePanel-jckyVqqt.cjs +1 -0
  5. package/dist/NiceWindow-DQyf5wat.cjs +1 -0
  6. package/dist/{core-lazy-BhQxFuLf.cjs → core-lazy-DirbU7jp.cjs} +1 -1
  7. package/dist/display/NiceDocumentApprovalFlow.mjs +67 -89
  8. package/dist/display/NiceLeaderboard.mjs +47 -40
  9. package/dist/display/NiceQuestCard.mjs +93 -76
  10. package/dist/docs/NiceGantt.doc.json.mjs +9 -9
  11. package/dist/documentation/utils.mjs +1 -1
  12. package/dist/index.cjs +94 -94
  13. package/dist/index.d.ts +58 -2
  14. package/dist/index.mjs +778 -776
  15. package/dist/navigation/NiceMenu.mjs +249 -248
  16. package/dist/navigation.cjs +1 -1
  17. package/dist/navigation.d.ts +6 -0
  18. package/dist/overlays/NiceResponsiveBox.mjs +51 -24
  19. package/dist/overlays/NiceTutorial.mjs +136 -127
  20. package/dist/overlays.cjs +1 -1
  21. package/dist/overlays.d.ts +25 -2
  22. package/dist/planning/NiceGantt.mjs +130 -121
  23. package/dist/planning/NiceStepper.mjs +36 -35
  24. package/dist/style.css +2 -2
  25. package/dist/tools/NiceDraggable.mjs +44 -29
  26. package/dist/tools/NiceSortable.mjs +66 -48
  27. package/dist/tools/NiceSpeechToText.mjs +67 -52
  28. package/dist/tools/NiceValidationBuilder.mjs +210 -119
  29. package/dist/tools/NiceViewRegistry.mjs +67 -34
  30. package/package.json +4 -4
  31. package/dist/NiceBottomSheet.doc-keq-Fzlz.cjs +0 -8
  32. package/dist/NiceGantt-BygumlaY.cjs +0 -1
  33. package/dist/NiceModuleLifecyclePanel-DAIbzfZd.cjs +0 -1
  34. package/dist/NiceWindow-BklnkBpu.cjs +0 -1
  35. package/dist/docs/NiceBottomSheet.doc.json.mjs +0 -32
package/CHANGELOG.md CHANGED
@@ -1,5 +1,55 @@
1
1
  # [1.0.27] — 2026-06-07
2
2
 
3
+ ## 1.4.21
4
+
5
+ ### Patch Changes
6
+
7
+ - 15ed387: Controls A (round 44, 1.4.21): forms, navigation and layout fixes from the showcase feedback.
8
+
9
+ - **NiceStepper** (and NiceWizard, which uses it):
10
+ - connectors sit level with the middle of the circle, however many lines a description has;
11
+ - vertical steps centre the circle on the item;
12
+ - steps take `status` (`completed`, `active`, `pending`, `error`, `skipped`) and `description`.
13
+ - **NiceDocumentApprovalFlow** draws its steps with NiceStepper. The decision panel stays.
14
+ - **NiceMenu:** new `panelAnchor: 'item' | 'menu'`. With `'menu'`, `panelAlign` lines the panel up
15
+ with the whole bar.
16
+ - **NiceBottomSheet:**
17
+ - snap points are visible dots (`showSnapPoints`), and clicking one jumps there;
18
+ - the handle is a slider (arrow keys, Home, End);
19
+ - a new `initialSnap` or new `snapPoints` move an open sheet.
20
+ - **NiceSortable:** the drop line is measured from the items. It sits midway between two items, and
21
+ in a row it is as tall as an item. Dragging down drops after the hovered item.
22
+ - **NiceDraggable:** marks itself while dragged (`nice-draggable--dragging`). `NICE_DRAG_MIME` and
23
+ `readNiceDrag()` read a drop.
24
+ - **NiceResponsiveBox** follows its own width with a ResizeObserver: it stacks below `stackBelow`
25
+ (480) and wraps at `minItemWidth`.
26
+ - **NiceIconRail, NiceSortableTree:** `size` scales the buttons, the icons and the text, not only the
27
+ spacing.
28
+ - **NiceLoginForm** (auth): an empty `title` hides the heading.
29
+ - **NiceSpeechToText:** errors read as translated sentences, not browser codes, and a new
30
+ `onError(code)` reports the code.
31
+ - **NiceQuestCard:** at 100 % the bar turns green and shows a check mark.
32
+ - **NiceLeaderboard:** players without a photo get initials on one of six theme tones.
33
+ - **NiceTutorial:** new `showBackButton`, `showCloseButton`, `showProgressBar` and `showSpeedControl`.
34
+ - **NiceEntityEditor:** "Add field" and "New entity" open dialogs.
35
+ - **NiceI18nEditor:**
36
+ - removals ask first (`confirmRemove`);
37
+ - Undo and Redo (Ctrl+Z, Ctrl+Y);
38
+ - `onSave` adds a Save button (Ctrl+S);
39
+ - the buttons are icon-only.
40
+ - **Validation:**
41
+ - rules take a `group`, and NiceValidationBuilder has "+ Group";
42
+ - `evaluateValidation(rules, record, { groups, includeUngrouped })` and `isRecordValid` check only
43
+ the chosen groups.
44
+ - **NiceViewRegistry:** the default registry renders `dataGrid`, `chart`, `kpi` and `badge`, so the
45
+ studio's view preview no longer shows "Unknown control".
46
+ - **NiceGantt:** `dependencyStyle="rounded"` draws curves on every route, including arrows that run
47
+ back to the left and links within one row.
48
+
49
+ - Updated dependencies [15ed387]
50
+ - @nice2dev/ui-core@1.4.21
51
+ - @nice2dev/i18n@1.4.21
52
+
3
53
  ## 1.4.20
4
54
 
5
55
  ### Patch Changes
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),M=require("@nice2dev/ui-core"),m=require("react"),ie=[],b=(_,x)=>{const w=new Date(_);return w.setDate(w.getDate()+x),w},j=(_,x)=>Math.ceil((x.getTime()-_.getTime())/864e5),P=({tasks:_=ie,columns:x,scale:w="day",rowHeight:f=36,dayWidth:Q=30,onTaskClick:D,onTaskUpdate:p,showDependencies:F=!0,dependencyStyle:G="square",draggable:N,zoomControls:J,className:K,style:Y,accessMode:V,id:Z,"data-testid":k})=>{const{t:H}=M.useNiceTranslation(),U=M.useNiceAccessMode(V,Z)==="hidden",{t:oe}=M.useNiceTranslation(),[d,R]=m.useState(Q),[v,W]=m.useState(null),L=x||[{field:"title",title:H("gantt.task","Task"),width:200}],A=L.reduce((e,t)=>e+(t.width||120),0),C=m.useRef(null),q=m.useRef(null),E=m.useRef(!1);m.useEffect(()=>{const e=C.current,t=q.current;if(!e||!t)return;const s=(o,i)=>()=>{E.current||(E.current=!0,i.scrollTop=o.scrollTop,requestAnimationFrame(()=>{E.current=!1}))},n=s(e,t),r=s(t,e);return e.addEventListener("scroll",n,{passive:!0}),t.addEventListener("scroll",r,{passive:!0}),()=>{e.removeEventListener("scroll",n),t.removeEventListener("scroll",r)}},[]);const u=m.useMemo(()=>{const e=t=>_.filter(n=>(n.parentId??null)===t).flatMap(n=>[n,...e(n.id)]);return e(null)},[_]),g=m.useMemo(()=>{if(u.length===0)return{start:new Date,end:new Date,days:30};let e=new Date(u[0].start),t=new Date(u[0].end);return u.forEach(s=>{new Date(s.start)<e&&(e=new Date(s.start)),new Date(s.end)>t&&(t=new Date(s.end))}),e=b(e,-2),t=b(t,2),{start:e,end:t,days:j(e,t)}},[u]),z=g.days*d;m.useEffect(()=>{if(!v||!p)return;const e=s=>{const n=s.clientX-v.startX,r=Math.round(n/d);if(r===0)return;const o=_.find(i=>i.id===v.taskId);if(o)if(v.mode==="move")p({...o,start:b(v.origStart,r),end:b(v.origEnd,r)});else{const i=b(v.origEnd,r);i>v.origStart&&p({...o,end:i})}},t=()=>W(null);return document.addEventListener("mousemove",e),document.addEventListener("mouseup",t),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t)}},[v,d,_,p]);const B=m.useCallback((e,t,s)=>{if(!N||!p)return;s.stopPropagation();const n=_.find(r=>r.id===e);n&&W({taskId:e,mode:t,startX:s.clientX,origStart:new Date(n.start),origEnd:new Date(n.end)})},[N,_,p]),ee=m.useCallback(()=>R(e=>Math.min(100,e+5)),[]),te=m.useCallback(()=>R(e=>Math.max(8,e-5)),[]),ne=()=>{const e=[],t=[];new Date(g.start);const s=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];if(w==="day"){let n=-1,r=0;for(let o=0;o<g.days;o++){const i=b(g.start,o);i.getMonth()!==n&&(n>=0&&e.push(a.jsxs("div",{className:"nice-gantt__header-cell",style:{width:(o-r)*d},children:[s[n]," ",i.getFullYear()]},`m${n}-${r}`)),n=i.getMonth(),r=o);const c=i.getDay()===0||i.getDay()===6;t.push(a.jsx("div",{className:`nice-gantt__header-cell nice-gantt__header-cell--sub ${c?"nice-gantt__header-cell--weekend":""}`,style:{width:d},children:i.getDate()},o))}n>=0&&e.push(a.jsx("div",{className:"nice-gantt__header-cell",style:{width:(g.days-r)*d},children:s[n]},`m${n}-last`))}return a.jsxs("div",{className:"nice-gantt__chart-header",children:[a.jsx("div",{className:"nice-gantt__header-row",children:e}),a.jsx("div",{className:"nice-gantt__header-row",children:t})]})},se=(e,t)=>{const s=j(g.start,new Date(e.start))*d,n=Math.max(j(new Date(e.start),new Date(e.end))*d,d),r=t*f+4,o=f-8,i=e.progress??0;return a.jsxs("div",{role:D?"button":void 0,tabIndex:D?0:void 0,onKeyDown:D?M.clickOnActivationKey:void 0,className:`nice-gantt__bar ${N?"nice-gantt__bar--draggable":""}`,title:`${e.title} (${Math.round(i)}%)`,style:{left:s,top:r,width:n,height:o,backgroundColor:e.color||"var(--nice-color-primary, #3b82f6)"},onClick:()=>D?.(e),onMouseDown:N?c=>B(e.id,"move",c):void 0,children:[i>0&&a.jsx("div",{className:"nice-gantt__bar-progress",style:{width:`${i}%`}}),a.jsx("span",{className:"nice-gantt__bar-label",children:e.title}),N&&a.jsx("div",{className:"nice-gantt__bar-resize",onMouseDown:c=>B(e.id,"resize",c)})]},e.id)},ae=(e,t,s,n,r)=>{const c=e+10,l=s-14,y=Math.abs(n-t)<1,S=l<=c+4;if(y&&!S)return`M ${e} ${t} L ${s} ${n}`;const h=y?t+f/2:(t+n)/2,I=[`M ${e} ${t}`,`L ${c} ${t}`,`L ${c} ${h}`,`L ${l} ${h}`,`L ${l} ${n}`,`L ${s} ${n}`].join(" ");if(!r)return I;const O=h>=t?1:-1,T=n>=h?1:-1,X=l>=c?1:-1,$=Math.min(8,10,Math.abs(h-t)/2,Math.abs(n-h)/2,Math.abs(l-c)/2);return $<1?I:[`M ${e} ${t}`,`L ${c-$} ${t}`,`Q ${c} ${t} ${c} ${t+O*$}`,`L ${c} ${h-O*$}`,`Q ${c} ${h} ${c+X*$} ${h}`,`L ${l-X*$} ${h}`,`Q ${l} ${h} ${l} ${h+T*$}`,`L ${l} ${n-T*$}`,`Q ${l} ${n} ${l+$} ${n}`,`L ${s} ${n}`].join(" ")},re=()=>{if(!F)return null;const e=[],t=new Map(u.map((s,n)=>[s.id,n]));return u.forEach(s=>{(s.dependencies||[]).forEach(n=>{const r=t.get(n),o=t.get(s.id);if(r==null||o==null)return;const i=u[r],c=j(g.start,new Date(i.end))*d,l=r*f+f/2,y=j(g.start,new Date(s.start))*d,S=o*f+f/2;e.push(a.jsx("path",{d:ae(c,l,y,S,G==="rounded"),fill:"none",stroke:"var(--nice-text-secondary, #6b7280)",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round",markerEnd:"url(#arrowhead)"},`${n}-${s.id}`))})}),a.jsxs("svg",{className:"nice-gantt__deps",width:z,height:u.length*f,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[a.jsx("defs",{children:a.jsx("marker",{id:"arrowhead",markerWidth:"6",markerHeight:"4",refX:"5",refY:"2",orient:"auto",children:a.jsx("polygon",{points:"0 0, 6 2, 0 4",fill:"var(--nice-text-secondary, #6b7280)"})})}),e]})};return U?null:a.jsxs("div",{className:`nice-gantt ${K||""}`,style:Y,"data-testid":k,children:[J&&a.jsxs("div",{className:"nice-gantt__zoom-controls",children:[a.jsx("button",{type:"button",className:"nice-btn nice-btn--sm",onClick:te,children:"−"}),a.jsxs("span",{className:"nice-gantt__zoom-label",children:[d,"px"]}),a.jsx("button",{type:"button",className:"nice-btn nice-btn--sm",onClick:ee,children:"+"})]}),a.jsxs("div",{className:"nice-gantt__container",children:[a.jsxs("div",{className:"nice-gantt__table",style:{width:A,minWidth:A},children:[a.jsxs("div",{className:"nice-gantt__table-header",children:[a.jsx("div",{className:"nice-gantt__table-header-row nice-gantt__table-header-row--main","aria-hidden":"true",children:" "}),a.jsx("div",{className:"nice-gantt__table-header-row nice-gantt__table-header-row--sub",children:L.map((e,t)=>a.jsx("div",{className:"nice-gantt__table-header-cell",style:{width:e.width||120},children:e.title},t))})]}),a.jsx("div",{className:"nice-gantt__table-body",ref:C,children:u.map((e,t)=>a.jsx("div",{className:"nice-gantt__table-row",style:{height:f},children:L.map((s,n)=>a.jsx("div",{className:"nice-gantt__table-cell",style:{width:s.width||120},children:e[s.field]},n))},e.id))})]}),a.jsx("div",{className:"nice-gantt__chart",children:a.jsxs("div",{className:"nice-gantt__chart-body-wrap",ref:q,children:[ne(),a.jsxs("div",{className:"nice-gantt__chart-body",style:{width:z,height:u.length*f,position:"relative"},children:[Array.from({length:g.days},(e,t)=>{const s=b(g.start,t),n=s.getDay()===0||s.getDay()===6;return a.jsx("div",{className:`nice-gantt__gridline ${n?"nice-gantt__gridline--weekend":""}`,style:{left:t*d,width:d,height:"100%",position:"absolute",top:0}},t)}),u.map((e,t)=>se(e,t)),re()]})]})})]})]})};process.env.NODE_ENV!=="production"&&(P.displayName="NiceGantt");exports.NiceGantt=P;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="https://nice2dev.com/schemas/component-doc-v1.json",t="NiceGantt",a="Gantt Chart",s="1.0.0",n="stable",o="planning",i="scheduling",r="Project Gantt chart with draggable bars, dependencies, and zoom controls.",c="1.0.0",d=["web","desktop"],l=["gantt","project","timeline","scheduling","tasks"],p=[{name:"tasks",type:"NiceGanttTask[]",required:!1,default:"[]",description:"Tasks (id, title, start, end, progress, color, parentId, dependencies)."},{name:"columns",type:"NiceGanttColumn[]",required:!1,description:"Left panel columns configuration."},{name:"scale",type:"'day' | 'week' | 'month'",required:!1,default:"'day'",description:"Time scale."},{name:"rowHeight",type:"number",required:!1,description:"Row height in px."},{name:"dayWidth",type:"number",required:!1,description:"Day column width in px."},{name:"showDependencies",type:"boolean",required:!1,default:"true",description:"Show dependency arrows."},{name:"draggable",type:"boolean",required:!1,description:"Enable drag to move/resize tasks."},{name:"zoomControls",type:"boolean",required:!1,description:"Show zoom controls."}],m=[{name:"onTaskClick",parameters:[{name:"task",type:"NiceGanttTask"}],description:"Called when task clicked."},{name:"onTaskUpdate",parameters:[{name:"task",type:"NiceGanttTask"}],description:"Called after task drag/resize."}],u=[],h=[{title:"Project Gantt",code:`<NiceGantt
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="https://nice2dev.com/schemas/component-doc-v1.json",t="NiceGantt",a="Gantt Chart",s="1.0.0",n="stable",o="planning",r="scheduling",i="Project Gantt chart with draggable bars, dependencies, and zoom controls.",c="1.0.0",d=["web","desktop"],l=["gantt","project","timeline","scheduling","tasks"],p=[{name:"tasks",type:"NiceGanttTask[]",required:!1,default:"[]",description:"Tasks (id, title, start, end, progress, color, parentId, dependencies)."},{name:"columns",type:"NiceGanttColumn[]",required:!1,description:"Left panel columns configuration."},{name:"scale",type:"'day' | 'week' | 'month'",required:!1,default:"'day'",description:"Time scale."},{name:"rowHeight",type:"number",required:!1,description:"Row height in px."},{name:"dayWidth",type:"number",required:!1,description:"Day column width in px."},{name:"showDependencies",type:"boolean",required:!1,default:"true",description:"Show dependency arrows."},{name:"dependencyStyle",type:"'square' | 'rounded'",required:!1,default:"'square'",description:"Dependency arrows with square or rounded corners."},{name:"draggable",type:"boolean",required:!1,description:"Enable drag to move/resize tasks."},{name:"zoomControls",type:"boolean",required:!1,description:"Show zoom controls."}],m=[{name:"onTaskClick",parameters:[{name:"task",type:"NiceGanttTask"}],description:"Called when task clicked."},{name:"onTaskUpdate",parameters:[{name:"task",type:"NiceGanttTask"}],description:"Called after task drag/resize."}],u=[],h=[{title:"Project Gantt",code:`<NiceGantt
2
2
  tasks={projectTasks}
3
3
  columns={[
4
4
  { field: 'title', header: 'Task', width: 200 },
@@ -8,4 +8,4 @@
8
8
  draggable
9
9
  showDependencies
10
10
  onTaskUpdate={handleTaskUpdate}
11
- />`,language:"tsx"}],g=[{name:"NiceScheduler",relationship:"calendar"},{name:"NiceTimeline",relationship:"simple"}],k={$schema:e,name:t,displayName:a,version:s,status:n,category:o,subcategory:i,package:"@nicetoDev/ui",description:r,since:c,platforms:d,keywords:l,props:p,events:m,cssVariables:u,examples:h,related:g};exports.$schema=e;exports.category=o;exports.cssVariables=u;exports.default=k;exports.description=r;exports.displayName=a;exports.events=m;exports.examples=h;exports.keywords=l;exports.name=t;exports.platforms=d;exports.props=p;exports.related=g;exports.since=c;exports.status=n;exports.subcategory=i;exports.version=s;
11
+ />`,language:"tsx"}],y=[{name:"NiceScheduler",relationship:"calendar"},{name:"NiceTimeline",relationship:"simple"}],g={$schema:e,name:t,displayName:a,version:s,status:n,category:o,subcategory:r,package:"@nicetoDev/ui",description:i,since:c,platforms:d,keywords:l,props:p,events:m,cssVariables:u,examples:h,related:y};exports.$schema=e;exports.category=o;exports.cssVariables=u;exports.default=g;exports.description=i;exports.displayName=a;exports.events=m;exports.examples=h;exports.keywords=l;exports.name=t;exports.platforms=d;exports.props=p;exports.related=y;exports.since=c;exports.status=n;exports.subcategory=r;exports.version=s;