@nice2dev/ui 1.2.0 → 1.2.1
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 +107 -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-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/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-tIXS-M6b.js +4770 -0
- package/dist/NiceFormItem.doc-BJwEnDz2.js +36 -0
- package/dist/NiceFormItem.doc-Ck3PgaPD.cjs +12 -0
- package/dist/NiceGantt-CTbqCuwv.cjs +1 -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-DiAphF1k.js +889 -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-DQe77Isv.js +747 -0
- package/dist/NiceLoginForm-NBCo-DUZ.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.css +1 -1
- 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/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-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-CMfcODIO.js +5120 -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-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-ByrdMeQP.js +4767 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.css +1 -1
- package/dist/charts.d.ts +28 -18
- 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/data-branching-Dak1_ZKR.cjs +1 -0
- package/dist/data-branching-DiLAO4Qt.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-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 +193 -193
- package/dist/index.css +1 -1
- package/dist/index.d.ts +637 -225
- package/dist/index.mjs +26403 -26405
- 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-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-DkumQ3KE.js +548 -0
- package/dist/style.css +12 -9
- package/package.json +3 -3
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),ce=require("@nice2dev/ui-core"),D=require("react"),ee=require("./NiceButton-3AcJJ15c.cjs"),je=require("./devops-DkVluHBp.cjs"),Se=require("./NiceForm-BcN4p2kG.cjs"),dt=require("./NiceColorPicker-CQhhjZ8w.cjs"),ut=require("./NiceModal-C4p8a82e.cjs"),Ce=({children:e,className:n,style:a,direction:l="horizontal",size:r,disabled:u,readOnly:_,loading:x,error:j,errorPlacement:L="bottom"})=>{const S=t.jsxs("div",{className:`nice-btn-group ${l==="vertical"?"nice-btn-group--vertical":""} ${x?"nice-btn-group--loading":""} ${_?"nice-btn-group--readonly":""} ${n||""}`,style:a,role:"group","aria-busy":x||void 0,children:[D.Children.map(e,C=>{if(!D.isValidElement(C))return C;const s={};return u&&(s.disabled=!0),_&&(s.disabled=!0),x&&(s.disabled=!0),r&&(s.size=r),D.cloneElement(C,s)}),x&&t.jsx("span",{className:"nice-btn-group__spinner",children:t.jsx("span",{className:"nice-spinner nice-spinner--sm"})})]});if(!j)return S;const h=t.jsx("div",{className:"nice-field__error",role:"alert",children:j});return L==="right"?t.jsxs("span",{className:`nice-btn-field nice-btn-field--right ${r?`nice-field--${r}`:""}`,children:[S,h]}):t.jsxs("span",{className:`nice-btn-field nice-btn-field--bottom ${r?`nice-field--${r}`:""}`,children:[S,h]})},A=(e,n)=>{const a=new Date(e);return a.setDate(a.getDate()+n),a},H=(e,n)=>e.getFullYear()===n.getFullYear()&&e.getMonth()===n.getMonth()&&e.getDate()===n.getDate(),mt=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],ht=["January","February","March","April","May","June","July","August","September","October","November","December"],gt=["sun","mon","tue","wed","thu","fri","sat"],pt=["january","february","march","april","may","june","july","august","september","october","november","december"];function ue(e){return gt.map((n,a)=>e(n,mt[a]))}function yt(e){return pt.map((n,a)=>e(n,ht[a]))}function He(e){const n=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return["janShort","febShort","marShort","aprShort","mayShort","junShort","julShort","augShort","sepShort","octShort","novShort","decShort"].map((l,r)=>e(l,n[r]))}const ft=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],vt=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function ke(e){return vt.map((n,a)=>e(n,ft[a]))}function ze(e,n,a,l=1/0){const r=[],u=Math.max(1,Math.floor(e.interval??1)),_=e.until?new Date(e.until):void 0,x=_&&_<a?_:a,j=Math.min(e.count&&e.count>0?e.count:1/0,l),L=e.freq==="weekly"&&e.byDay?.length?[...new Set(e.byDay.filter(h=>Number.isInteger(h)&&h>=0&&h<=6))].sort((h,C)=>h-C):[];if(L.length>0){const h=new Date(n);h.setDate(n.getDate()-n.getDay());for(let C=0;r.length<j;C+=u){const s=new Date(h);if(s.setDate(h.getDate()+C*7),s>x)break;for(const N of L){const w=new Date(s);if(w.setDate(s.getDate()+N),!(w<n)){if(w>x||r.length>=j)break;r.push(w)}}}return r}let S=new Date(n);for(;S<=x&&r.length<j;){r.push(new Date(S));const h=new Date(S);e.freq==="daily"?h.setDate(h.getDate()+u):e.freq==="weekly"?h.setDate(h.getDate()+7*u):e.freq==="monthly"?h.setMonth(h.getMonth()+u):h.setFullYear(h.getFullYear()+u),S=h}return r}function _t(e,n,a){const l=[];for(const r of e){if(!r.recurrence){l.push(r);continue}const u=new Date(r.end).getTime()-new Date(r.start).getTime();ze(r.recurrence,new Date(r.start),a).forEach((_,x)=>{const j=new Date(_.getTime()+u);j>=n&&l.push({...r,id:`${r.id}_${x}`,start:_,end:j})})}return l}function Ve(e,n){return e.filter(a=>{const l=new Date(a.start),r=new Date(a.end);return n>=new Date(l.getFullYear(),l.getMonth(),l.getDate())&&n<=new Date(r.getFullYear(),r.getMonth(),r.getDate())})}function Ke(e="r"){return`${e}_${Math.random().toString(36).slice(2,9)}`}function Ue(e={}){return{id:e.id??Ke(),title:e.title??"",description:e.description??"",servings:e.servings??2,prepMinutes:e.prepMinutes,cookMinutes:e.cookMinutes,difficulty:e.difficulty,cuisine:e.cuisine,tags:e.tags??[],ingredients:e.ingredients??[],steps:e.steps??[],photos:e.photos??[],nutrition:e.nutrition,sourceUrl:e.sourceUrl,createdAt:e.createdAt??new Date,updatedAt:e.updatedAt??new Date}}function Je(e){const n=(e.prepMinutes??0)+(e.cookMinutes??0);return n>0?n:void 0}const me=({ev:e,renderEvent:n,onClick:a,draggable:l,dragRef:r,onHover:u,categoryColor:_})=>{const x=_||e.color||"var(--nice-color-primary, #3b82f6)",L={solid:{backgroundColor:x,color:"var(--nice-color-white, #fff)"},striped:{background:`repeating-linear-gradient(45deg, ${x}, ${x} 4px, transparent 4px, transparent 8px)`,border:`1px solid ${x}`,color:"var(--nice-text-primary, #333)"},outlined:{backgroundColor:"transparent",border:`2px solid ${x}`,color:x},dashed:{backgroundColor:"transparent",border:`2px dashed ${x}`,color:x}}[e.eventStyle||"solid"];return t.jsx("div",{className:`nice-scheduler__event nice-scheduler__event--${e.eventStyle||"solid"}`,style:L,draggable:l,onDragStart:()=>{r.current={event:e}},onDragEnd:()=>{r.current=null},onClick:S=>{S.stopPropagation(),a?.(e)},onMouseEnter:S=>u(e,S.currentTarget.getBoundingClientRect()),onMouseLeave:()=>u(null),children:n?n(e):e.title})};function te(e,n){if(!(!e.category||!n))return n.find(a=>a.key===e.category)?.color}const xt=({events:e,curDate:n,firstDayOfWeek:a,onSlotClick:l,onEventClick:r,draggable:u,dragRef:_,categories:x,renderEvent:j,onHoverEvent:L,readOnly:S,t:h})=>{const C=ue(h),s=n.getFullYear(),N=n.getMonth(),w=new Date(s,N,1),o=new Date(s,N+1,0),d=(w.getDay()-a+7)%7,$=o.getDate(),p=[];for(let m=d-1;m>=0;m--)p.push({date:A(w,-m-1),isCurrentMonth:!1});for(let m=0;m<$;m++)p.push({date:new Date(s,N,m+1),isCurrentMonth:!0});let I=1;for(;p.length<42;)p.push({date:new Date(s,N+1,I++),isCurrentMonth:!1});return t.jsxs("div",{className:"nice-scheduler__month",children:[t.jsx("div",{className:"nice-scheduler__month-header",children:Array.from({length:7},(m,y)=>t.jsx("div",{className:"nice-scheduler__month-dayname",children:C[(a+y)%7]},y))}),t.jsx("div",{className:"nice-scheduler__month-grid",children:p.map((m,y)=>{const E=Ve(e,m.date),g=H(m.date,new Date),b=m.date.getDay(),F=b===0||b===6;return t.jsxs("div",{className:`nice-scheduler__month-cell ${m.isCurrentMonth?"":"nice-scheduler__month-cell--other"} ${g?"nice-scheduler__month-cell--today":""} ${F?"nice-scheduler__month-cell--weekend":""}`,onClick:()=>!S&&l?.(m.date,A(m.date,1)),children:[t.jsx("div",{className:"nice-scheduler__month-date",children:m.date.getDate()}),E.slice(0,3).map(P=>t.jsx(me,{ev:P,renderEvent:j,onClick:r,draggable:u&&!S,dragRef:_,onHover:L,categoryColor:te(P,x)},P.id)),E.length>3&&t.jsxs("div",{className:"nice-scheduler__month-more",children:["+",E.length-3]})]},y)})})]})},Dt=({events:e,days:n,startHour:a,endHour:l,draggable:r,dragRef:u,onEventClick:_,onSlotClick:x,onEventDrop:j,categories:L,workHours:S,showCurrentTime:h,renderEvent:C,onHoverEvent:s,readOnly:N,t:w})=>{const o=[];for(let g=a;g<l;g++)o.push(g);ue(w);const d=ke(w),$=D.useRef(null),p=new Date,I=p.getHours()*60+p.getMinutes(),m=(l-a)*60,y=(I-a*60)/m*100,E=h&&I>=a*60&&I<l*60;return D.useEffect(()=>{const g=$.current;if(!g)return;const b=new Date,F=e.filter(T=>n.some(W=>H(W,new Date(T.start)))),P=F.filter(T=>H(new Date(T.start),b));let q;P.length>0?q=Math.min(...P.map(T=>new Date(T.start).getHours())):F.length>0?q=Math.min(...F.map(T=>new Date(T.start).getHours())):q=8,q=Math.max(a,Math.min(q,l-1));const c=q-a,f=g.children[c];if(f){const T=g.closest(".nice-scheduler__content")??g.closest(".nice-scheduler__timegrid");T&&(T.scrollTop=f.offsetTop-4)}},[]),t.jsxs("div",{className:"nice-scheduler__timegrid",children:[t.jsxs("div",{className:"nice-scheduler__timegrid-header",children:[t.jsx("div",{className:"nice-scheduler__time-gutter"}),n.map((g,b)=>{const F=g.getDay()===0||g.getDay()===6;return t.jsxs("div",{className:`nice-scheduler__timegrid-day-header ${H(g,p)?"nice-scheduler__timegrid-day-header--today":""} ${F?"nice-scheduler__timegrid-day-header--weekend":""}`,children:[t.jsx("div",{className:"nice-scheduler__timegrid-day-name",children:d[g.getDay()]}),t.jsx("div",{className:"nice-scheduler__timegrid-day-num",children:g.getDate()})]},b)})]}),t.jsxs("div",{className:"nice-scheduler__timegrid-body",ref:$,style:{position:"relative"},children:[o.map(g=>{const b=S?g>=S[0]&&g<S[1]:!1;return t.jsxs("div",{className:`nice-scheduler__timegrid-row ${b?"nice-scheduler__timegrid-row--work":""}`,children:[t.jsx("div",{className:"nice-scheduler__time-gutter",children:`${g.toString().padStart(2,"0")}:00`}),n.map((F,P)=>{const q=e.filter(c=>{const f=new Date(c.start);return H(f,F)&&f.getHours()===g});return t.jsx("div",{className:"nice-scheduler__timegrid-cell",onDragOver:r&&!N?c=>c.preventDefault():void 0,onDrop:r&&!N?()=>{if(!u.current||!j)return;const c=u.current.event,f=new Date(c.end).getTime()-new Date(c.start).getTime(),T=new Date(F);T.setHours(g,0,0,0);const W=new Date(T.getTime()+f);j(c,T,W),u.current=null}:void 0,onClick:()=>!N&&(()=>{const c=new Date(F);c.setHours(g);const f=new Date(c);f.setHours(g+1),x?.(c,f)})(),children:q.map(c=>t.jsx(me,{ev:c,renderEvent:C,onClick:_,draggable:r&&!N,dragRef:u,onHover:s,categoryColor:te(c,L)},c.id))},P)})]},g)}),E&&n.some(g=>H(g,p))&&t.jsx("div",{className:"nice-scheduler__now-line",style:{top:`${y}%`},children:t.jsx("div",{className:"nice-scheduler__now-dot"})})]})]})},Nt=({events:e,curDate:n,onEventClick:a,categories:l,t:r})=>{const u=[...e].filter(_=>new Date(_.start)>=new Date(n.getFullYear(),n.getMonth(),n.getDate())).sort((_,x)=>new Date(_.start).getTime()-new Date(x.start).getTime()).slice(0,50);return t.jsxs("div",{className:"nice-scheduler__agenda",children:[u.map(_=>t.jsx(wt,{ev:_,categories:l,onEventClick:a},_.id)),u.length===0&&t.jsx("div",{className:"nice-scheduler__agenda-empty",children:r("noEvents","No upcoming events")})]})},We=({parts:e})=>t.jsx("div",{className:"nice-scheduler__agenda-meta",children:e.map(([n,a],l)=>t.jsxs(D.Fragment,{children:[l>0&&" · ",t.jsx(ce.NiceIcon,{name:n,size:12,style:{verticalAlign:"-2px"}})," ",a]},n))}),Ge=({ev:e})=>{if(e.eventType==="recipe"&&e.recipe){const n=Je(e.recipe),a=[];return n!==void 0&&a.push(["clock",`${n} min`]),e.recipe.ingredients?.length&&a.push(["list",`${e.recipe.ingredients.length} ingredients`]),e.recipe.servings&&a.push(["utensils",`${e.recipe.servings} servings`]),a.length===0?null:t.jsx(We,{parts:a})}if(e.eventType==="service"&&e.service){const n=e.service,a=[];return n.serviceName&&a.push(["bell",n.serviceName]),n.providerName&&a.push(["user",n.providerName]),n.customerName&&a.push(["arrow-right",n.customerName]),typeof n.price=="number"&&a.push(["dollar",`${n.price}${n.currency?" "+n.currency:""}`]),a.length===0?null:t.jsx(We,{parts:a})}return null},wt=({ev:e,categories:n,onEventClick:a})=>{const l=ce.useAccessibleClick({onClick:()=>a?.(e)});return t.jsxs("div",{className:"nice-scheduler__agenda-item","aria-label":`Event ${e.title}`,...l,children:[t.jsx("div",{className:"nice-scheduler__agenda-dot",style:{backgroundColor:te(e,n)||e.color||"var(--nice-color-primary, #3b82f6)"}}),t.jsxs("div",{className:"nice-scheduler__agenda-info",children:[t.jsx("div",{className:"nice-scheduler__agenda-title",children:e.title}),t.jsxs("div",{className:"nice-scheduler__agenda-time",children:[new Date(e.start).toLocaleString()," – ",new Date(e.end).toLocaleString()]}),e.description&&t.jsx("div",{className:"nice-scheduler__agenda-desc",children:e.description}),t.jsx(Ge,{ev:e})]}),e.category&&n&&t.jsx("span",{className:"nice-scheduler__agenda-badge",style:{backgroundColor:te(e,n)||e.color},children:n.find(r=>r.key===e.category)?.label})]})},bt=({events:e,curDate:n,timelineDays:a,resources:l,draggable:r,dragRef:u,onEventClick:_,onSlotClick:x,onEventDrop:j,categories:L,renderEvent:S,onHoverEvent:h,readOnly:C,t:s})=>{const N=Array.from({length:a},(d,$)=>A(n,$)),w=l??[{id:"__default",name:""}],o=ue(s);return t.jsxs("div",{className:"nice-scheduler__timeline",children:[t.jsxs("div",{className:"nice-scheduler__timeline-header",children:[t.jsx("div",{className:"nice-scheduler__timeline-res-label"}),N.map((d,$)=>t.jsxs("div",{className:`nice-scheduler__timeline-day ${H(d,new Date)?"nice-scheduler__timeline-day--today":""}`,children:[o[d.getDay()]," ",d.getDate()]},$))]}),t.jsx("div",{className:"nice-scheduler__timeline-body",children:w.map(d=>{const $=e.filter(p=>!l||p.resourceId===d.id);return t.jsxs("div",{className:"nice-scheduler__timeline-row",children:[t.jsx("div",{className:"nice-scheduler__timeline-res-label",children:d.name}),N.map((p,I)=>{const m=$.filter(y=>H(new Date(y.start),p));return t.jsx("div",{className:"nice-scheduler__timeline-cell",onDragOver:r&&!C?y=>y.preventDefault():void 0,onDrop:r&&!C?()=>{if(!u.current||!j)return;const y=u.current.event,E=new Date(y.end).getTime()-new Date(y.start).getTime(),g=new Date(p);g.setHours(new Date(y.start).getHours(),new Date(y.start).getMinutes()),j(y,g,new Date(g.getTime()+E),d.id),u.current=null}:void 0,onClick:()=>!C&&x?.(p,A(p,1),d.id),children:m.map(y=>t.jsx(me,{ev:y,renderEvent:S,onClick:_,draggable:r&&!C,dragRef:u,onHover:h,categoryColor:te(y,L)},y.id))},I)})]},d.id)})})]})},Be=({categories:e,events:n,filteredCategories:a,onToggleCategory:l,t:r})=>t.jsxs("div",{className:"nice-scheduler__legend",children:[t.jsx("div",{className:"nice-scheduler__legend-title",children:r("legend","Legend")}),e.map(u=>{const _=n.filter(j=>j.category===u.key).length,x=!a.has(u.key);return t.jsxs("button",{className:`nice-scheduler__legend-item ${x?"":"nice-scheduler__legend-item--hidden"}`,onClick:()=>l(u.key),children:[t.jsx("span",{className:"nice-scheduler__legend-dot",style:{backgroundColor:x?u.color:"var(--nice-border-color, #ccc)"}}),t.jsx("span",{className:"nice-scheduler__legend-label",children:u.label}),t.jsx("span",{className:"nice-scheduler__legend-count",children:_})]},u.key)})]}),jt=({curDate:e,onDateSelect:n,firstDayOfWeek:a,t:l})=>{const[r,u]=D.useState(e.getMonth()),[_,x]=D.useState(e.getFullYear()),j=new Date(_,r,1),L=new Date(_,r+1,0),S=(j.getDay()-a+7)%7,h=[];for(let d=S-1;d>=0;d--)h.push(A(j,-d-1));for(let d=0;d<L.getDate();d++)h.push(new Date(_,r,d+1));const C=7-h.length%7;if(C<7)for(let d=1;d<=C;d++)h.push(new Date(_,r+1,d));const s=()=>{r===0?(u(11),x(d=>d-1)):u(d=>d-1)},N=()=>{r===11?(u(0),x(d=>d+1)):u(d=>d+1)},w=He(l),o=ue(l);return t.jsxs("div",{className:"nice-scheduler__mini-cal",children:[t.jsxs("div",{className:"nice-scheduler__mini-cal-header",children:[t.jsx("button",{type:"button",className:"nice-btn nice-btn--xs",onClick:s,"aria-label":l("scheduler.prevMonth","Previous month"),children:t.jsx(ce.NiceIcon,{name:"chevron-left",size:"sm"})}),t.jsxs("span",{children:[w[r]," ",_]}),t.jsx("button",{type:"button",className:"nice-btn nice-btn--xs",onClick:N,"aria-label":l("scheduler.nextMonth","Next month"),children:t.jsx(ce.NiceIcon,{name:"chevron-right",size:"sm"})})]}),t.jsxs("div",{className:"nice-scheduler__mini-cal-grid",children:[o.map((d,$)=>t.jsx("div",{className:"nice-scheduler__mini-cal-dayname",children:o[(a+$)%7].charAt(0)},$)),h.map((d,$)=>{const p=H(d,new Date),I=H(d,e),m=d.getMonth()!==r;return t.jsx("button",{className:`nice-scheduler__mini-cal-day ${p?"nice-scheduler__mini-cal-day--today":""} ${I?"nice-scheduler__mini-cal-day--selected":""} ${m?"nice-scheduler__mini-cal-day--other":""}`,onClick:()=>n(d),children:d.getDate()},$)})]})]})},St=({events:e,rangeStart:n,rangeEnd:a,startHour:l,endHour:r,draggable:u,dragRef:_,onEventClick:x,onSlotClick:j,onEventDrop:L,categories:S,workHours:h,showCurrentTime:C,renderEvent:s,onHoverEvent:N,readOnly:w,t:o})=>{const d=[];let $=new Date(n);for(;$<=a;)d.push(new Date($)),$=A($,1);const p=[];for(let f=l;f<r;f++)p.push(f);const I=ke(o),m=D.useRef(null),y=D.useRef(null),E=D.useRef(null),g=new Date,b=g.getHours()*60+g.getMinutes(),F=(r-l)*60,P=(b-l*60)/F*100,q=C&&b>=l*60&&b<r*60;D.useEffect(()=>{const f=m.current;if(!f)return;const T=new Date,W=e.filter(R=>d.some(k=>H(k,T)&&H(new Date(R.start),T)));let z=W.length>0?Math.min(...W.map(R=>new Date(R.start).getHours())):T.getHours();z=Math.max(l,Math.min(z,r-1));const U=f.children[z-l];if(U){const R=E.current??f.closest(".nice-scheduler__content")??f.closest(".nice-scheduler__timegrid");R&&(R.scrollTop=U.offsetTop-4)}},[]);const c=f=>{y.current&&(y.current.scrollLeft=f.currentTarget.scrollLeft)};return t.jsxs("div",{className:"nice-scheduler__timegrid nice-scheduler__timegrid--range",children:[t.jsx("div",{className:"nice-scheduler__timegrid-header-scroll",ref:y,"aria-hidden":"true",children:t.jsxs("div",{className:"nice-scheduler__timegrid-header",children:[t.jsx("div",{className:"nice-scheduler__time-gutter"}),d.map((f,T)=>{const W=f.getDay()===0||f.getDay()===6;return t.jsxs("div",{className:`nice-scheduler__timegrid-day-header ${H(f,g)?"nice-scheduler__timegrid-day-header--today":""} ${W?"nice-scheduler__timegrid-day-header--weekend":""}`,children:[t.jsx("div",{className:"nice-scheduler__timegrid-day-name",children:I[f.getDay()]}),t.jsx("div",{className:"nice-scheduler__timegrid-day-num",children:f.getDate()})]},T)})]})}),t.jsx("div",{className:"nice-scheduler__timegrid-body-scroll",ref:E,onScroll:c,children:t.jsxs("div",{className:"nice-scheduler__timegrid-body",ref:m,style:{position:"relative"},children:[p.map(f=>{const T=h?f>=h[0]&&f<h[1]:!1;return t.jsxs("div",{className:`nice-scheduler__timegrid-row ${T?"nice-scheduler__timegrid-row--work":""}`,children:[t.jsx("div",{className:"nice-scheduler__time-gutter",children:`${f.toString().padStart(2,"0")}:00`}),d.map((W,z)=>{const U=e.filter(R=>{const k=new Date(R.start);return H(k,W)&&k.getHours()===f});return t.jsx("div",{className:"nice-scheduler__timegrid-cell",onDragOver:u&&!w?R=>R.preventDefault():void 0,onDrop:u&&!w?()=>{if(!_.current||!L)return;const R=_.current.event,k=new Date(R.end).getTime()-new Date(R.start).getTime(),O=new Date(W);O.setHours(f,0,0,0),L(R,O,new Date(O.getTime()+k)),_.current=null}:void 0,onClick:()=>!w&&(()=>{const R=new Date(W);R.setHours(f);const k=new Date(R);k.setHours(f+1),j?.(R,k)})(),children:U.map(R=>t.jsx(me,{ev:R,renderEvent:s,onClick:x,draggable:u&&!w,dragRef:_,onHover:N,categoryColor:te(R,S)},R.id))},z)})]},f)}),q&&d.some(f=>H(f,g))&&t.jsx("div",{className:"nice-scheduler__now-line",style:{top:`${P}%`},children:t.jsx("div",{className:"nice-scheduler__now-dot"})})]})})]})},Ct=({events:e,rangeStart:n,rangeEnd:a,firstDayOfWeek:l,onSlotClick:r,onEventClick:u,draggable:_,dragRef:x,categories:j,renderEvent:L,onHoverEvent:S,readOnly:h,t:C})=>{const s=ue(C);ke(C);const N=[];let w=new Date(n);for(;w<=a;)N.push(new Date(w)),w=A(w,1);const o=(N[0].getDay()-l+7)%7,d=[];for(let p=o-1;p>=0;p--)d.push({date:A(N[0],-p-1),inRange:!1});N.forEach(p=>d.push({date:p,inRange:!0}));const $=7-d.length%7;if($<7){const p=N[N.length-1];for(let I=1;I<=$;I++)d.push({date:A(p,I),inRange:!1})}return t.jsxs("div",{className:"nice-scheduler__month nice-scheduler__month--range",children:[t.jsx("div",{className:"nice-scheduler__month-header",children:Array.from({length:7},(p,I)=>t.jsx("div",{className:"nice-scheduler__month-dayname",children:s[(l+I)%7]},I))}),t.jsx("div",{className:"nice-scheduler__month-grid",children:d.map((p,I)=>{const m=Ve(e,p.date),y=H(p.date,new Date),E=p.date.getDay()===0||p.date.getDay()===6;return t.jsxs("div",{className:`nice-scheduler__month-cell ${p.inRange?"":"nice-scheduler__month-cell--other"} ${y?"nice-scheduler__month-cell--today":""} ${E?"nice-scheduler__month-cell--weekend":""}`,onClick:()=>!h&&r?.(p.date,A(p.date,1)),children:[t.jsx("div",{className:"nice-scheduler__month-date",children:p.date.getDate()===1||I===0?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"nice-scheduler__month-monthname",children:He(C)[p.date.getMonth()]})," ",p.date.getDate()]}):p.date.getDate()}),m.slice(0,3).map(g=>t.jsx(me,{ev:g,renderEvent:L,onClick:u,draggable:_&&!h,dragRef:x,onHover:S,categoryColor:te(g,j)},g.id)),m.length>3&&t.jsxs("div",{className:"nice-scheduler__month-more",children:["+",m.length-3]})]},I)})})]})},kt=({event:e,rect:n,categories:a,renderTooltip:l})=>{if(l)return t.jsx("div",{className:"nice-scheduler__tooltip",style:{position:"fixed",left:n.right+8,top:n.top,zIndex:1e4},children:l(e)});const r=a?.find(u=>u.key===e.category);return t.jsxs("div",{className:"nice-scheduler__tooltip",style:{position:"fixed",left:n.right+8,top:n.top,zIndex:1e4},children:[t.jsx("div",{className:"nice-scheduler__tooltip-title",children:e.title}),t.jsxs("div",{className:"nice-scheduler__tooltip-time",children:[new Date(e.start).toLocaleString()," – ",new Date(e.end).toLocaleString()]}),r&&t.jsxs("div",{className:"nice-scheduler__tooltip-cat",children:[t.jsx("span",{className:"nice-scheduler__tooltip-dot",style:{backgroundColor:r.color}}),r.label]}),e.description&&t.jsx("div",{className:"nice-scheduler__tooltip-desc",children:e.description}),t.jsx(Ge,{ev:e})]})},Mt=({event:e,slotStart:n,slotEnd:a,categories:l,resources:r,formFields:u,formFieldsByType:_,eventTypes:x,renderEditor:j,saving:L,onSave:S,onDelete:h,onClose:C,t:s})=>{const N=!!e,w=D.useMemo(()=>({title:e?.title??"",description:e?.description??"",color:e?.color??"var(--nice-primary, #3b82f6)",category:e?.category??"",eventStyle:e?.eventStyle??"solid",start:e?.start??n??new Date,end:e?.end??a??new Date,allDay:e?.allDay??!1,resourceId:e?.resourceId??"",eventType:e?.eventType??"task",recurring:!!e?.recurrence,recurrenceFreq:e?.recurrence?.freq??"weekly",recurrenceInterval:e?.recurrence?.interval??1,recurrenceCount:e?.recurrence?.count,recipeTitle:e?.recipe?.title??"",recipeServings:e?.recipe?.servings??2,recipePrep:e?.recipe?.prepMinutes,recipeCook:e?.recipe?.cookMinutes,recipeIngredients:(e?.recipe?.ingredients??[]).map(m=>[m.quantity,m.unit,m.name].filter(y=>y!==void 0&&y!=="").join(" ")).join(`
|
|
2
|
+
`),recipeSteps:(e?.recipe?.steps??[]).map(m=>m.instruction).join(`
|
|
3
|
+
`),serviceName:e?.service?.serviceName??"",serviceProvider:e?.service?.providerName??"",serviceCustomer:e?.service?.customerName??"",serviceContact:e?.service?.customerContact??"",serviceLocation:e?.service?.location??"",servicePrice:e?.service?.price,serviceCurrency:e?.service?.currency??"PLN",serviceNotes:e?.service?.notes??""}),[e,n,a]),[o,d]=D.useState(w);D.useEffect(()=>{d(w)},[w]);const $=D.useCallback((m,y)=>{d(E=>({...E,[m]:y}))},[]),p=D.useMemo(()=>{if(u&&u.length>0)return u;const m=c=>c.toString().padStart(2,"0"),y=c=>`${c.getFullYear()}-${m(c.getMonth()+1)}-${m(c.getDate())}`,E=c=>`${m(c.getHours())}:${m(c.getMinutes())}`,g=(c,f)=>{const T=c instanceof Date?c:new Date(c),W=isNaN(T.getTime())?new Date:T,z=y(W),U=E(W),R=(k,O)=>{const[G,V,he]=k.split("-").map(ne=>parseInt(ne,10)),[ge,pe]=O.split(":").map(ne=>parseInt(ne,10)),ae=new Date(W);!isNaN(G)&&!isNaN(V)&&!isNaN(he)&&ae.setFullYear(G,V-1,he),!isNaN(ge)&&!isNaN(pe)&&ae.setHours(ge,pe,0,0),f(ae)};return t.jsxs("div",{style:{display:"flex",gap:12,flexWrap:"wrap",alignItems:"flex-end"},children:[t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[t.jsx("span",{style:{fontSize:"0.7rem",color:"var(--nice-text-muted, #888)"},children:s("date","Date")}),t.jsx(Se.NiceDateTimePicker,{value:z,onChange:k=>R(k,U),size:"sm"})]}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[t.jsx("span",{style:{fontSize:"0.7rem",color:"var(--nice-text-muted, #888)"},children:s("time","Time")}),t.jsx(Se.NiceDateTimePicker,{dateFormatPreset:"time",value:U,onChange:k=>R(z,k),size:"sm"})]})]})},b=[];x&&x.length>1&&b.push({field:"eventType",label:s("eventType","Type"),type:"select",group:s("common","Common"),options:x.map(c=>({label:c.icon?`${c.icon} ${c.label}`:c.label,value:c.type}))}),b.push({field:"title",label:s("title","Title"),type:"text",required:!0,group:s("common","Common")},{field:"start",label:s("start","Start"),render:g,group:s("common","Common")},{field:"end",label:s("end","End"),render:g,group:s("common","Common")},{field:"description",label:s("description","Description"),type:"textarea",group:s("common","Common")},{field:"color",label:s("color","Color"),group:s("common","Common"),render:(c,f)=>t.jsx(dt.NiceColorPicker,{value:typeof c=="string"?c:"var(--nice-primary, #3b82f6)",onChange:f,showInput:!1,showRandom:!1})}),l&&l.length>0&&b.push({field:"category",label:s("category","Category"),type:"select",group:s("common","Common"),options:[{label:s("none","(none)"),value:""},...l.map(c=>({label:c.label,value:c.key}))]}),r&&r.length>0&&b.push({field:"resourceId",label:s("resource","Resource"),type:"select",group:s("common","Common"),options:[{label:s("none","(none)"),value:""},...r.map(c=>({label:c.name,value:String(c.id)}))]});const F=s("recurring","Recurring");b.push({field:"recurring",label:s("repeat","Repeat"),type:"checkbox",group:F}),b.push({field:"recurrenceFreq",label:s("frequency","Frequency"),type:"select",group:F,visibleWhen:c=>!!c.recurring,options:[{label:s("daily","Daily"),value:"daily"},{label:s("weekly","Weekly"),value:"weekly"},{label:s("monthly","Monthly"),value:"monthly"},{label:s("yearly","Yearly"),value:"yearly"}]}),b.push({field:"recurrenceInterval",label:s("interval","Interval"),type:"number",group:F,visibleWhen:c=>!!c.recurring}),b.push({field:"recurrenceCount",label:s("occurrences","Occurrences (optional)"),type:"number",group:F,visibleWhen:c=>!!c.recurring});const P=o.eventType??"task",q=_?.[P];if(q&&q.length>0)b.push(...q);else if(P==="recipe"){const c=s("recipe.section","Recipe");b.push({field:"recipeTitle",label:s("recipe.title","Recipe title"),type:"text",group:c},{field:"recipeServings",label:s("recipe.servings","Servings"),type:"number",group:c},{field:"recipePrep",label:s("recipe.prepMinutes","Prep (min)"),type:"number",group:c},{field:"recipeCook",label:s("recipe.cookMinutes","Cook (min)"),type:"number",group:c},{field:"recipeIngredients",label:s("recipe.ingredients","Ingredients (one per line)"),type:"textarea",group:c,hint:s("recipe.ingredients.hint",'Format: "200 g flour"')},{field:"recipeSteps",label:s("recipe.steps","Steps (one per line)"),type:"textarea",group:c})}else if(P==="service"){const c=s("service.section","Service");b.push({field:"serviceName",label:s("service.name","Service name"),type:"text",group:c,required:!0},{field:"serviceProvider",label:s("service.provider","Provider"),type:"text",group:c},{field:"serviceCustomer",label:s("service.customer","Customer"),type:"text",group:c},{field:"serviceContact",label:s("service.contact","Contact"),type:"text",group:c},{field:"serviceLocation",label:s("service.location","Location"),type:"text",group:c},{field:"servicePrice",label:s("service.price","Price"),type:"number",group:c},{field:"serviceCurrency",label:s("service.currency","Currency"),type:"text",group:c},{field:"serviceNotes",label:s("service.notes","Notes"),type:"textarea",group:c})}return b},[u,_,x,l,r,o.eventType,s]),I=()=>{const m=o.eventType??"task",y={title:o.title,description:o.description||void 0,color:o.color,category:o.category||void 0,eventStyle:o.eventStyle,allDay:o.allDay,start:o.start instanceof Date?o.start:new Date(o.start),end:o.end instanceof Date?o.end:new Date(o.end),resourceId:o.resourceId||void 0,eventType:m};if(o.recurring){const E={freq:o.recurrenceFreq||"weekly",interval:typeof o.recurrenceInterval=="number"&&o.recurrenceInterval>0?o.recurrenceInterval:1};typeof o.recurrenceCount=="number"&&o.recurrenceCount>0&&(E.count=o.recurrenceCount),y.recurrence=E}else y.recurrence=void 0;if(m==="recipe"){const E=String(o.recipeIngredients||"").split(`
|
|
4
|
+
`).map(P=>P.trim()).filter(Boolean).map((P,q)=>{const c=P.match(/^([\d.,/]+)\s*(\S+)?\s+(.+)$/);if(c){const f=parseFloat(c[1].replace(",","."));return{id:`ing-${q}`,name:c[3],quantity:isNaN(f)?void 0:f,unit:c[2]}}return{id:`ing-${q}`,name:P}}),g=String(o.recipeSteps||"").split(`
|
|
5
|
+
`).map(P=>P.trim()).filter(Boolean).map((P,q)=>({id:`step-${q}`,order:q+1,instruction:P})),b=e?.recipe??Ue(),F={...b,title:o.recipeTitle||o.title||b.title,servings:typeof o.recipeServings=="number"?o.recipeServings:b.servings,prepMinutes:typeof o.recipePrep=="number"?o.recipePrep:b.prepMinutes,cookMinutes:typeof o.recipeCook=="number"?o.recipeCook:b.cookMinutes,ingredients:E,steps:g};y.recipe=F,y.service=void 0}else if(m==="service"){const E={serviceName:String(o.serviceName||""),providerName:o.serviceProvider||void 0,customerName:o.serviceCustomer||void 0,customerContact:o.serviceContact||void 0,location:o.serviceLocation||void 0,price:typeof o.servicePrice=="number"?o.servicePrice:void 0,currency:o.serviceCurrency||void 0,notes:o.serviceNotes||void 0};y.service=E,y.recipe=void 0}else y.recipe=void 0,y.service=void 0;return N&&(y.id=e.id),y};return t.jsx(ut.NiceModal,{open:!0,onClose:C,title:N?s("editEvent","Edit Event"):s("newEvent","New Event"),size:"md",footer:j?null:t.jsxs(t.Fragment,{children:[N&&h&&t.jsx(ee.NiceButton,{type:"button",variant:"error",size:"sm",onClick:()=>{h(e),C()},disabled:L,children:s("delete","Delete")}),t.jsx("div",{style:{flex:1}}),t.jsx(ee.NiceButton,{type:"button",variant:"secondary",size:"sm",onClick:C,disabled:L,children:s("cancel","Cancel")}),t.jsx(ee.NiceButton,{type:"button",variant:"primary",size:"sm",onClick:()=>{o.title&&S(I())},disabled:L||!o.title,children:L?s("saving","Saving…"):s("save","Save")})]}),children:t.jsx("div",{className:"nice-scheduler__form-body",onKeyDown:m=>{m.key==="Enter"&&m.target.tagName!=="TEXTAREA"&&(m.preventDefault(),o.title&&S(I()))},children:j?j({event:e,slotStart:n,slotEnd:a,save:S,cancel:C,remove:h}):t.jsx(Se.NiceForm,{items:p,data:o,onFieldChange:$,columns:1,gap:12,size:"sm"})})})},Tt=["day","workWeek","week","dayRange","month","monthRange","timeline","agenda"],Me=({events:e,defaultEvents:n,resources:a,currentDate:l,view:r,onDateChange:u,onViewChange:_,onEventClick:x,onSlotClick:j,onEventDrop:L,draggable:S=!1,timelineDays:h=7,startHour:C=0,endHour:s=24,firstDayOfWeek:N=1,categories:w,showLegend:o,showTooltip:d,renderEvent:$,renderTooltip:p,workHours:I,showCurrentTime:m=!0,showMiniCalendar:y,onEventCreate:E,onEventEdit:g,onEventDelete:b,editable:F=!0,formFields:P,formFieldsByType:q,eventTypes:c,renderEventEditor:f,loadEvents:T,onEventsChange:W,accessMode:z="full",className:U,style:R})=>{const{t:k}=ce.useNiceTranslation(),O=z==="hidden",G=z==="readOnly"||z==="disabled",V=z==="disabled",[he,ge]=D.useState(l??new Date),[pe,ae]=D.useState(r??"week"),ne=l!==void 0&&u!==void 0,Te=r!==void 0&&_!==void 0,Y=ne?l:he,M=Te?r:pe;je.useIgnoredPropChangeWarning("NiceScheduler","currentDate","onDateChange",l,ne),je.useIgnoredPropChangeWarning("NiceScheduler","view","onViewChange",r,Te);const Oe=D.useRef(null),[K,_e]=D.useState(()=>{const i=new Date;return i.setHours(0,0,0,0),i}),[J,xe]=D.useState(()=>A(new Date,13)),[De,$e]=D.useState(null),Xe=D.useCallback((i,v)=>{d&&$e(i&&v?{event:i,rect:v}:null)},[d]),[se,oe]=D.useState(null),[Qe,ye]=D.useState(!1),Ne=e!==void 0&&W!==void 0,[Ze,Ee]=ce.useControllableState({value:Ne?e:void 0,defaultValue:n,fallbackValue:[],onChange:W,componentName:"NiceScheduler"}),[Re,et]=D.useState(!1),[Le,tt]=D.useState(null),[Et,Ie]=D.useState(!1),X=Le??(Ne||Re||e===void 0?Ze:e);je.useIgnoredPropChangeWarning("NiceScheduler","events","onEventsChange",e,Ne||!(Re||Le!==null),"the built-in editor has taken over the list");const[le,nt]=D.useState(new Set),Fe=D.useCallback(i=>{nt(v=>{const B=new Set(v);return B.has(i)?B.delete(i):B.add(i),B})},[]),Q=D.useMemo(()=>{if(M==="month")return{start:new Date(Y.getFullYear(),Y.getMonth(),1),end:new Date(Y.getFullYear(),Y.getMonth()+2,0)};if(M==="timeline")return{start:new Date(Y),end:A(Y,h)};if(M==="dayRange"||M==="monthRange")return{start:new Date(K),end:A(J,1)};const i=(()=>{const v=new Date(Y),B=(v.getDay()-N+7)%7;return A(v,-B)})();return{start:A(i,-1),end:A(i,8)}},[Y,M,N,h,K,J]),we=D.useMemo(()=>{let i=_t(X,Q.start,Q.end);return le.size>0&&(i=i.filter(v=>!v.category||!le.has(v.category))),i},[X,Q,le]),re=i=>{ge(i),u?.(i)},st=i=>{ae(i),_?.(i)},Ae=i=>{if(M==="day")re(A(Y,i));else if(M==="week"||M==="workWeek")re(A(Y,i*7));else if(M==="timeline")re(A(Y,i*h));else if(M==="dayRange"||M==="monthRange"){const v=Math.round((J.getTime()-K.getTime())/864e5)+1;_e(A(K,i*v)),xe(A(J,i*v))}else{const v=new Date(Y);v.setMonth(v.getMonth()+i),re(v)}},be=D.useMemo(()=>{const i=new Date(Y),v=(i.getDay()-N+7)%7;return A(i,-v)},[Y,N]),fe=D.useMemo(()=>{if(M==="day")return[Y];if(M==="workWeek"){const i=[];for(let v=0;v<7;v++){const B=A(be,v),Z=B.getDay();Z!==0&&Z!==6&&i.push(B)}return i}return Array.from({length:7},(i,v)=>A(be,v))},[M,Y,be]),rt=M==="day"?Y.toLocaleDateString():M==="week"||M==="workWeek"?`${fe[0].toLocaleDateString()} – ${fe[fe.length-1].toLocaleDateString()}`:M==="timeline"?`${Y.toLocaleDateString()} – ${A(Y,h-1).toLocaleDateString()}`:M==="dayRange"||M==="monthRange"?`${K.toLocaleDateString()} – ${J.toLocaleDateString()}`:`${yt(k)[Y.getMonth()]} ${Y.getFullYear()}`,it=D.useCallback((i,v,B)=>{G||(F&&oe({mode:"create",slotStart:i,slotEnd:v}),j?.(i,v,B))},[F,j,G]),ct=D.useCallback(i=>{F&&!G&&oe({mode:"edit",event:i}),x?.(i)},[F,x,G]),de=D.useCallback(i=>{et(!0),Ee(i)},[Ee]),at=D.useCallback(async i=>{const v=se?.mode==="create";try{if(ye(!0),v){const Z=(E?await E(i):void 0)??{...i,id:typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`evt_${Date.now()}_${Math.random().toString(36).slice(2,7)}`},ve=X.slice();ve.push(Z),de(ve)}else{const Z=(g?await g(i):void 0)??i,ve=X.map(qe=>qe.id===Z.id?Z:qe);de(ve)}oe(null)}finally{ye(!1)}},[se,E,g,X,de]),ot=D.useCallback(async i=>{try{ye(!0),b&&await b(i);const v=X.filter(B=>B.id!==i.id);de(v),oe(null)}finally{ye(!1)}},[b,X,de]);D.useEffect(()=>{if(!T)return;let i=!1;return Ie(!0),T({start:Q.start,end:Q.end}).then(v=>{i||tt(v)}).finally(()=>{i||Ie(!1)}),()=>{i=!0}},[T,Q.start.getTime(),Q.end.getTime()]);const lt=i=>({day:k("day","Day"),week:k("week","Week"),workWeek:k("workWeek","Work Week"),month:k("month","Month"),timeline:k("timeline","Timeline"),agenda:k("agenda","Agenda"),dayRange:k("dayRange","Day Range"),monthRange:k("monthRange","Month Range")})[i],ie={events:we,curDate:Y,firstDayOfWeek:N,startHour:C,endHour:s,draggable:S,dragRef:Oe,onEventClick:ct,onSlotClick:it,onEventDrop:L,resources:a,timelineDays:h,categories:w,workHours:I,showCurrentTime:m,renderEvent:$,showTooltip:d,renderTooltip:p,onHoverEvent:Xe,readOnly:G,t:k},Pe=M==="dayRange"||M==="monthRange",Ye=i=>{const v=B=>B.toString().padStart(2,"0");return`${i.getFullYear()}-${v(i.getMonth()+1)}-${v(i.getDate())}`};return O?null:t.jsxs("div",{className:`nice-scheduler ${V?"nice-scheduler--disabled":""} ${U||""}`,style:R,children:[t.jsxs("div",{className:"nice-scheduler__toolbar",children:[t.jsxs("div",{className:"nice-scheduler__nav",children:[t.jsxs(Ce,{size:"sm",children:[t.jsx(ee.NiceButton,{onClick:()=>Ae(-1),disabled:V,"aria-label":k("previous","Previous"),children:"‹"}),t.jsx(ee.NiceButton,{onClick:()=>{if(Pe){const i=new Date;i.setHours(0,0,0,0);const v=Math.round((J.getTime()-K.getTime())/864e5);_e(i),xe(A(i,v))}else re(new Date)},disabled:V,children:k("today","Today")}),t.jsx(ee.NiceButton,{onClick:()=>Ae(1),disabled:V,"aria-label":k("next","Next"),children:"›"})]}),Pe?t.jsxs("span",{className:"nice-scheduler__range-picker",children:[t.jsx("input",{type:"date",className:"nice-textinput nice-textinput--sm",value:Ye(K),disabled:V,onChange:i=>{const v=new Date(i.target.value+"T00:00:00");isNaN(v.getTime())||_e(v)}}),t.jsx("span",{style:{margin:"0 4px"},children:"–"}),t.jsx("input",{type:"date",className:"nice-textinput nice-textinput--sm",value:Ye(J),disabled:V,onChange:i=>{const v=new Date(i.target.value+"T00:00:00");!isNaN(v.getTime())&&v>=K&&xe(v)}})]}):t.jsx("span",{className:"nice-scheduler__title",children:rt})]}),t.jsx("div",{className:"nice-scheduler__views",children:t.jsx(Ce,{size:"sm",children:Tt.map(i=>t.jsx(ee.NiceButton,{variant:i===M?"primary":"secondary",onClick:()=>st(i),disabled:V,children:lt(i)},i))})})]}),t.jsxs("div",{className:"nice-scheduler__body",children:[y&&t.jsxs("div",{className:"nice-scheduler__sidebar",children:[t.jsx(jt,{curDate:Y,onDateSelect:i=>re(i),firstDayOfWeek:N,t:k}),o&&w&&t.jsx(Be,{categories:w,events:we,filteredCategories:le,onToggleCategory:Fe,t:k})]}),t.jsxs("div",{className:"nice-scheduler__content",children:[M==="month"&&t.jsx(xt,{...ie}),(M==="week"||M==="day"||M==="workWeek")&&t.jsx(Dt,{...ie,days:fe}),M==="dayRange"&&t.jsx(St,{...ie,rangeStart:K,rangeEnd:J}),M==="monthRange"&&t.jsx(Ct,{...ie,rangeStart:K,rangeEnd:J}),M==="timeline"&&t.jsx(bt,{...ie}),M==="agenda"&&t.jsx(Nt,{...ie})]}),!y&&o&&w&&t.jsx("div",{className:"nice-scheduler__sidebar nice-scheduler__sidebar--right",children:t.jsx(Be,{categories:w,events:we,filteredCategories:le,onToggleCategory:Fe,t:k})})]}),De&&t.jsx(kt,{event:De.event,rect:De.rect,categories:w,renderTooltip:p}),se&&F&&t.jsx(Mt,{event:se.event,slotStart:se.slotStart,slotEnd:se.slotEnd,categories:w,resources:a,formFields:P,formFieldsByType:q,eventTypes:c,renderEditor:f,saving:Qe,onSave:at,onDelete:ot,onClose:()=>oe(null),t:k})]})};process.env.NODE_ENV!=="production"&&(Me.displayName="NiceScheduler");const $t=Object.freeze(Object.defineProperty({__proto__:null,NiceScheduler:Me},Symbol.toStringTag,{value:"Module"}));exports.NiceButtonGroup=Ce;exports.NiceScheduler=Me;exports.NiceScheduler$1=$t;exports.createEmptyRecipe=Ue;exports.newRecipeId=Ke;exports.recipeTotalMinutes=Je;exports.recurrenceDates=ze;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="https://nice2dev.com/schemas/component-doc-v1.json",c="NiceSchedulerViews",s="Scheduler view switcher.",i="display",t="1.0.0",n="stable",o=[{name:"view",type:"'day' | 'week' | 'month' | 'agenda'",required:!0,description:"Current view"},{name:"onViewChange",type:"(view: SchedulerView) => void",required:!0,description:"View change callback"}],a=[{title:"Scheduler Views",code:"<NiceSchedulerViews view={currentView} onViewChange={setView} />"}],r={keyboard:["Tab between views"],aria:["View selection"]},d=["NiceScheduler","NiceCalendar"],l={$schema:e,name:c,description:s,category:i,since:t,status:n,props:o,examples:a,accessibility:r,seeAlso:d};exports.$schema=e;exports.accessibility=r;exports.category=i;exports.default=l;exports.description=s;exports.examples=a;exports.name=c;exports.props=o;exports.seeAlso=d;exports.since=t;exports.status=n;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const e = "https://nice2dev.com/schemas/component-doc-v1.json", c = "NiceSchedulerViews", i = "Scheduler view switcher.", s = "display", t = "1.0.0", n = "stable", o = [{ name: "view", type: "'day' | 'week' | 'month' | 'agenda'", required: !0, description: "Current view" }, { name: "onViewChange", type: "(view: SchedulerView) => void", required: !0, description: "View change callback" }], a = [{ title: "Scheduler Views", code: "<NiceSchedulerViews view={currentView} onViewChange={setView} />" }], r = { keyboard: ["Tab between views"], aria: ["View selection"] }, d = ["NiceScheduler", "NiceCalendar"], w = {
|
|
2
|
+
$schema: e,
|
|
3
|
+
name: c,
|
|
4
|
+
description: i,
|
|
5
|
+
category: s,
|
|
6
|
+
since: t,
|
|
7
|
+
status: n,
|
|
8
|
+
props: o,
|
|
9
|
+
examples: a,
|
|
10
|
+
accessibility: r,
|
|
11
|
+
seeAlso: d
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
e as $schema,
|
|
15
|
+
r as accessibility,
|
|
16
|
+
s as category,
|
|
17
|
+
w as default,
|
|
18
|
+
i as description,
|
|
19
|
+
a as examples,
|
|
20
|
+
c as name,
|
|
21
|
+
o as props,
|
|
22
|
+
d as seeAlso,
|
|
23
|
+
t as since,
|
|
24
|
+
n as status
|
|
25
|
+
};
|
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
import { jsxs as o, jsx as n, Fragment as be } from "react/jsx-runtime";
|
|
2
|
+
import { NiceThemeContext as ze, useNiceAccessMode as He, useNiceTranslation as Ke, useComponentDisplayStyle as We, useComponentDisplayClass as qe, useControlId as Ue, useDisplayModeEdit as Pe, useNiceLookupSource as Be, COMMON_SHORTCUTS as ue, NiceKeyboardHint as Ve, DisplayModeView as Ge, NiceIcon as se } from "@nice2dev/ui-core";
|
|
3
|
+
import Je, { useRef as ce, useState as _, useContext as Qe, useLayoutEffect as fe, useEffect as Xe, forwardRef as Ye, useMemo as q, useCallback as he } from "react";
|
|
4
|
+
import { createPortal as Ze } from "react-dom";
|
|
5
|
+
function en(a) {
|
|
6
|
+
const s = a?.closest?.("[data-theme], .nice-dark, .nice-light, .dark");
|
|
7
|
+
if (!s)
|
|
8
|
+
return "";
|
|
9
|
+
const p = s.getAttribute("data-theme");
|
|
10
|
+
return p === "dark" || s.classList.contains("nice-dark") || s.classList.contains("dark") ? "nice-dark" : p === "light" || s.classList.contains("nice-light") ? "nice-light" : "";
|
|
11
|
+
}
|
|
12
|
+
function nn(a, s, p, d) {
|
|
13
|
+
const U = d?.maxHeight ?? 320, x = d?.anchorKey, $ = ce(null), [pe, P] = _(null), [le, B] = _(!1), [re, O] = _(""), v = Qe(ze)?.portalTarget ?? (typeof document < "u" ? document.body : null), u = ce(p);
|
|
14
|
+
return u.current = p, fe(() => {
|
|
15
|
+
if (!a || !s.current)
|
|
16
|
+
return;
|
|
17
|
+
O(en(s.current)), B(!1);
|
|
18
|
+
const g = () => {
|
|
19
|
+
const C = s.current;
|
|
20
|
+
if (!C)
|
|
21
|
+
return;
|
|
22
|
+
const l = C.getBoundingClientRect(), E = $.current?.offsetHeight ?? U;
|
|
23
|
+
let S = l.bottom;
|
|
24
|
+
S + E > window.innerHeight - 8 && l.top - E > 8 && (S = l.top - E);
|
|
25
|
+
let M = l.left;
|
|
26
|
+
M + l.width > window.innerWidth - 8 && (M = Math.max(8, window.innerWidth - l.width - 8)), P(
|
|
27
|
+
(w) => w && w.left === M && w.top === S && w.width === l.width ? w : { left: M, top: S, width: l.width }
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
g();
|
|
31
|
+
const c = requestAnimationFrame(() => {
|
|
32
|
+
g(), B(!0);
|
|
33
|
+
}), y = (C) => {
|
|
34
|
+
const l = C.target;
|
|
35
|
+
l instanceof Node && ($.current?.contains(l) || s.current?.contains(l)) || u.current();
|
|
36
|
+
}, m = () => u.current();
|
|
37
|
+
return window.addEventListener("scroll", y, !0), window.addEventListener("resize", m), () => {
|
|
38
|
+
cancelAnimationFrame(c), window.removeEventListener("scroll", y, !0), window.removeEventListener("resize", m);
|
|
39
|
+
};
|
|
40
|
+
}, [a, s, U, x]), Xe(() => {
|
|
41
|
+
if (!a)
|
|
42
|
+
return;
|
|
43
|
+
const g = (y) => {
|
|
44
|
+
const m = y.target;
|
|
45
|
+
s.current?.contains(m) || $.current?.contains(m) || (m instanceof Element ? m : m?.parentElement ?? null)?.closest('.nice-select__dropdown, [role="listbox"], [role="option"]') || u.current();
|
|
46
|
+
}, c = (y) => {
|
|
47
|
+
y.key === "Escape" && u.current();
|
|
48
|
+
};
|
|
49
|
+
return document.addEventListener("mousedown", g), document.addEventListener("keydown", c), () => {
|
|
50
|
+
document.removeEventListener("mousedown", g), document.removeEventListener("keydown", c);
|
|
51
|
+
};
|
|
52
|
+
}, [a, s]), { popupRef: $, coords: pe, ready: le, themeClass: re, portalTarget: v };
|
|
53
|
+
}
|
|
54
|
+
const tn = /* @__PURE__ */ Object.assign(
|
|
55
|
+
/* @__PURE__ */ Ye(
|
|
56
|
+
({
|
|
57
|
+
label: a,
|
|
58
|
+
"aria-label": s,
|
|
59
|
+
helperText: p,
|
|
60
|
+
error: d,
|
|
61
|
+
required: U,
|
|
62
|
+
disabled: x,
|
|
63
|
+
size: $ = "md",
|
|
64
|
+
name: pe,
|
|
65
|
+
id: P,
|
|
66
|
+
className: le,
|
|
67
|
+
style: B,
|
|
68
|
+
accessMode: re,
|
|
69
|
+
displayStyle: O,
|
|
70
|
+
options: me,
|
|
71
|
+
value: v,
|
|
72
|
+
onChange: u,
|
|
73
|
+
placeholder: g,
|
|
74
|
+
multiple: c = !1,
|
|
75
|
+
searchable: y = !0,
|
|
76
|
+
clearable: m = !1,
|
|
77
|
+
emptyText: C,
|
|
78
|
+
maxHeight: l = 240,
|
|
79
|
+
optionsSource: E,
|
|
80
|
+
valueField: S,
|
|
81
|
+
labelField: M,
|
|
82
|
+
virtualScroll: w,
|
|
83
|
+
optionHeight: F = 36,
|
|
84
|
+
onSearch: R,
|
|
85
|
+
loading: N,
|
|
86
|
+
renderOption: V,
|
|
87
|
+
multipleAutosize: G = !1,
|
|
88
|
+
showKeyboardHints: xe,
|
|
89
|
+
labelPlacement: $e,
|
|
90
|
+
errorPlacement: J,
|
|
91
|
+
labelWidth: Q,
|
|
92
|
+
controlWidth: j,
|
|
93
|
+
displayMode: Ce
|
|
94
|
+
}, X) => {
|
|
95
|
+
const oe = He(re, P), Ee = oe === "hidden";
|
|
96
|
+
(oe === "disabled" || oe === "readOnly") && (x = !0);
|
|
97
|
+
const { t: k } = Ke(), Le = We("input", O), Se = qe("input", O), D = Ue(P), _e = Pe({ enabled: Ce, disabled: x }), [b, T] = _(!1), [Y, Z] = _(""), [I, z] = _(-1), [ve, Me] = _(0), ge = ce(null), H = ce(null), [ye, De] = _(null);
|
|
98
|
+
fe(() => {
|
|
99
|
+
!N && H.current && De(H.current.offsetWidth);
|
|
100
|
+
}, [N, v, O]);
|
|
101
|
+
const [K, Te] = _(null);
|
|
102
|
+
fe(() => {
|
|
103
|
+
c && !G && H.current && K == null && Te(H.current.offsetWidth);
|
|
104
|
+
}, [c, G, K]);
|
|
105
|
+
const Ie = Be(
|
|
106
|
+
E ?? null,
|
|
107
|
+
S ?? E?.keyField ?? "id",
|
|
108
|
+
M ?? "name"
|
|
109
|
+
), L = E ? Ie.options : (me ?? []).map(
|
|
110
|
+
(e) => typeof e == "string" ? { value: e, label: e } : e
|
|
111
|
+
), { popupRef: Ae, coords: W, ready: we, themeClass: ee, portalTarget: Ne } = nn(
|
|
112
|
+
b,
|
|
113
|
+
ge,
|
|
114
|
+
() => {
|
|
115
|
+
T(!1), Z("");
|
|
116
|
+
}
|
|
117
|
+
), r = q(() => v ? Array.isArray(v) ? v : [v] : [], [v]), h = q(() => {
|
|
118
|
+
if (!Y && !R || R)
|
|
119
|
+
return L;
|
|
120
|
+
const e = Y.toLowerCase();
|
|
121
|
+
return L.filter(
|
|
122
|
+
(i) => i.label.toLowerCase().includes(e) || String(i.value).toLowerCase().includes(e)
|
|
123
|
+
);
|
|
124
|
+
}, [L, Y, R]), ke = q(() => {
|
|
125
|
+
const e = /* @__PURE__ */ new Map();
|
|
126
|
+
for (const i of h) {
|
|
127
|
+
const t = i.group || "";
|
|
128
|
+
e.has(t) || e.set(t, []), e.get(t).push(i);
|
|
129
|
+
}
|
|
130
|
+
return e;
|
|
131
|
+
}, [h]), ne = he(
|
|
132
|
+
(e) => {
|
|
133
|
+
if (c) {
|
|
134
|
+
const i = r.includes(e) ? r.filter((t) => t !== e) : [...r, e];
|
|
135
|
+
u?.(i);
|
|
136
|
+
} else
|
|
137
|
+
u?.(e), T(!1), Z("");
|
|
138
|
+
},
|
|
139
|
+
[c, r, u]
|
|
140
|
+
), Oe = he(
|
|
141
|
+
(e) => {
|
|
142
|
+
if (e.key === "Escape") {
|
|
143
|
+
T(!1), Z("");
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
147
|
+
if (!b) {
|
|
148
|
+
T(!0), e.preventDefault();
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
I >= 0 && h[I] && (ne(h[I].value), e.preventDefault());
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
e.key === "ArrowDown" && (e.preventDefault(), z((i) => Math.min(i + 1, h.length - 1))), e.key === "ArrowUp" && (e.preventDefault(), z((i) => Math.max(i - 1, 0)));
|
|
155
|
+
},
|
|
156
|
+
[b, I, h, ne]
|
|
157
|
+
), ae = q(() => r.length === 0 ? null : c ? r.map((e) => L.find((i) => i.value === e)?.label || e).join(", ") : L.find((e) => e.value === r[0])?.label || r[0], [r, L, c]), Fe = he(
|
|
158
|
+
(e) => {
|
|
159
|
+
e.stopPropagation(), u?.(c ? [] : "");
|
|
160
|
+
},
|
|
161
|
+
[u, c]
|
|
162
|
+
), Re = q(
|
|
163
|
+
() => [
|
|
164
|
+
{ key: "Enter", description: k("shortcuts.select", "Select") },
|
|
165
|
+
{ key: "Space", description: k("shortcuts.openDropdown", "Open dropdown") },
|
|
166
|
+
ue.moveUp,
|
|
167
|
+
ue.moveDown,
|
|
168
|
+
ue.cancel
|
|
169
|
+
],
|
|
170
|
+
[k]
|
|
171
|
+
);
|
|
172
|
+
return Ee ? null : /* @__PURE__ */ o(
|
|
173
|
+
"div",
|
|
174
|
+
{
|
|
175
|
+
className: `nice-field ${j == null ? "nice-field--select-auto" : ""} nice-field--${$} ${$e === "left" ? "nice-field--label-left" : ""} ${N ? "nice-field--loading" : ""} ${le || ""}`,
|
|
176
|
+
style: {
|
|
177
|
+
...B,
|
|
178
|
+
...Q != null && {
|
|
179
|
+
"--nice-field-label-width": typeof Q == "number" ? `${Q}px` : Q
|
|
180
|
+
},
|
|
181
|
+
...j != null && {
|
|
182
|
+
"--nice-field-control-width": typeof j == "number" ? `${j}px` : j
|
|
183
|
+
},
|
|
184
|
+
...N && ye != null && { "--nice-select-locked-width": `${ye}px` }
|
|
185
|
+
},
|
|
186
|
+
"aria-busy": N || void 0,
|
|
187
|
+
children: [
|
|
188
|
+
a && /* @__PURE__ */ o(
|
|
189
|
+
"label",
|
|
190
|
+
{
|
|
191
|
+
htmlFor: D,
|
|
192
|
+
className: `nice-field__label ${U ? "nice-field__label--required" : ""}`,
|
|
193
|
+
children: [
|
|
194
|
+
a,
|
|
195
|
+
xe && /* @__PURE__ */ n(Ve, { shortcuts: Re, size: "sm" })
|
|
196
|
+
]
|
|
197
|
+
}
|
|
198
|
+
),
|
|
199
|
+
/* @__PURE__ */ o("div", { className: "nice-field__control", children: [
|
|
200
|
+
_e.isDisplay ? /* @__PURE__ */ n(
|
|
201
|
+
Ge,
|
|
202
|
+
{
|
|
203
|
+
value: ae,
|
|
204
|
+
placeholder: g || k("controls.select", "Select..."),
|
|
205
|
+
disabled: x,
|
|
206
|
+
onActivate: () => {
|
|
207
|
+
_e.enterEdit(), T(!0);
|
|
208
|
+
},
|
|
209
|
+
ariaLabel: a ?? s
|
|
210
|
+
}
|
|
211
|
+
) : /* @__PURE__ */ o("div", { className: "nice-select", ref: ge, children: [
|
|
212
|
+
/* @__PURE__ */ o(
|
|
213
|
+
"button",
|
|
214
|
+
{
|
|
215
|
+
ref: (e) => {
|
|
216
|
+
H.current = e, typeof X == "function" ? X(e) : X && (X.current = e);
|
|
217
|
+
},
|
|
218
|
+
type: "button",
|
|
219
|
+
id: D,
|
|
220
|
+
role: "combobox",
|
|
221
|
+
"aria-label": a ? void 0 : s,
|
|
222
|
+
"aria-expanded": b,
|
|
223
|
+
"aria-haspopup": "listbox",
|
|
224
|
+
"aria-invalid": !!d,
|
|
225
|
+
className: `nice-select__trigger nice-select__trigger--${$} nice-select--ds-${Se} ${b ? "nice-select__trigger--open" : ""} ${d ? "nice-select__trigger--error" : ""} ${x ? "nice-select__trigger--disabled" : ""}`,
|
|
226
|
+
style: {
|
|
227
|
+
...Le,
|
|
228
|
+
...c && !G && K != null ? {
|
|
229
|
+
width: K,
|
|
230
|
+
maxWidth: K,
|
|
231
|
+
overflow: "hidden"
|
|
232
|
+
} : {}
|
|
233
|
+
},
|
|
234
|
+
disabled: x,
|
|
235
|
+
onClick: () => T(!b),
|
|
236
|
+
onKeyDown: Oe,
|
|
237
|
+
children: [
|
|
238
|
+
ae ? /* @__PURE__ */ n(
|
|
239
|
+
"span",
|
|
240
|
+
{
|
|
241
|
+
style: c && !G ? {
|
|
242
|
+
flex: 1,
|
|
243
|
+
minWidth: 0,
|
|
244
|
+
overflow: "hidden",
|
|
245
|
+
textOverflow: "ellipsis",
|
|
246
|
+
whiteSpace: "nowrap"
|
|
247
|
+
} : void 0,
|
|
248
|
+
children: ae
|
|
249
|
+
}
|
|
250
|
+
) : /* @__PURE__ */ n("span", { className: "nice-select__placeholder", children: g || k("controls.select", "Select...") }),
|
|
251
|
+
/* @__PURE__ */ o("span", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
|
|
252
|
+
m && r.length > 0 && /* @__PURE__ */ n(
|
|
253
|
+
"span",
|
|
254
|
+
{
|
|
255
|
+
className: "nice-input__clear",
|
|
256
|
+
onClick: Fe,
|
|
257
|
+
role: "button",
|
|
258
|
+
"aria-label": k("controls.clear", "Clear"),
|
|
259
|
+
children: /* @__PURE__ */ n(se, { name: "close", size: 14 })
|
|
260
|
+
}
|
|
261
|
+
),
|
|
262
|
+
/* @__PURE__ */ n(
|
|
263
|
+
"span",
|
|
264
|
+
{
|
|
265
|
+
className: `nice-select__chevron ${b ? "nice-select__chevron--open" : ""}`,
|
|
266
|
+
children: /* @__PURE__ */ n(se, { name: "chevron-down", size: 16 })
|
|
267
|
+
}
|
|
268
|
+
)
|
|
269
|
+
] })
|
|
270
|
+
]
|
|
271
|
+
}
|
|
272
|
+
),
|
|
273
|
+
b && W && Ne && Ze(
|
|
274
|
+
/* @__PURE__ */ o(
|
|
275
|
+
"div",
|
|
276
|
+
{
|
|
277
|
+
ref: Ae,
|
|
278
|
+
className: `nice-select__dropdown${ee ? ` ${ee}` : ""}`,
|
|
279
|
+
"data-theme": ee === "nice-dark" ? "dark" : ee === "nice-light" ? "light" : void 0,
|
|
280
|
+
role: "listbox",
|
|
281
|
+
style: {
|
|
282
|
+
maxHeight: l,
|
|
283
|
+
position: "fixed",
|
|
284
|
+
left: W.left,
|
|
285
|
+
top: W.top,
|
|
286
|
+
width: W.width,
|
|
287
|
+
minWidth: W.width,
|
|
288
|
+
zIndex: 1e3,
|
|
289
|
+
// Hidden until measured so the estimate frame never paints above.
|
|
290
|
+
opacity: we ? 1 : 0,
|
|
291
|
+
pointerEvents: we ? void 0 : "none"
|
|
292
|
+
},
|
|
293
|
+
onScroll: w ? (e) => Me(e.currentTarget.scrollTop) : void 0,
|
|
294
|
+
children: [
|
|
295
|
+
(y || R) && /* @__PURE__ */ n("div", { className: "nice-select__search", children: /* @__PURE__ */ n(
|
|
296
|
+
"input",
|
|
297
|
+
{
|
|
298
|
+
type: "text",
|
|
299
|
+
value: Y,
|
|
300
|
+
onChange: (e) => {
|
|
301
|
+
Z(e.target.value), z(0), R?.(e.target.value);
|
|
302
|
+
},
|
|
303
|
+
placeholder: k("controls.search", "Search..."),
|
|
304
|
+
autoFocus: !0
|
|
305
|
+
}
|
|
306
|
+
) }),
|
|
307
|
+
N && /* @__PURE__ */ n("div", { className: "nice-select__loading", children: /* @__PURE__ */ n(
|
|
308
|
+
"div",
|
|
309
|
+
{
|
|
310
|
+
className: "nice-spinner nice-spinner--sm",
|
|
311
|
+
style: { margin: "8px auto" }
|
|
312
|
+
}
|
|
313
|
+
) }),
|
|
314
|
+
!N && h.length === 0 ? /* @__PURE__ */ n("div", { className: "nice-select__empty", children: C || k("controls.noResults", "No results found") }) : w && !Array.from(ke.keys()).some((e) => e !== "") ? (() => {
|
|
315
|
+
const i = h.length * F, t = Math.max(
|
|
316
|
+
0,
|
|
317
|
+
Math.floor(ve / F) - 3
|
|
318
|
+
), A = Math.min(
|
|
319
|
+
h.length,
|
|
320
|
+
Math.ceil((ve + l) / F) + 3
|
|
321
|
+
), te = h.slice(t, A);
|
|
322
|
+
return /* @__PURE__ */ n("div", { style: { height: i, position: "relative" }, children: te.map((f, je) => {
|
|
323
|
+
const de = t + je, ie = r.includes(f.value);
|
|
324
|
+
return /* @__PURE__ */ n(
|
|
325
|
+
"div",
|
|
326
|
+
{
|
|
327
|
+
role: "option",
|
|
328
|
+
"aria-selected": ie,
|
|
329
|
+
className: `nice-select__option ${ie ? "nice-select__option--selected" : ""} ${de === I ? "nice-select__option--highlighted" : ""} ${f.disabled ? "nice-select__option--disabled" : ""}`,
|
|
330
|
+
style: {
|
|
331
|
+
position: "absolute",
|
|
332
|
+
top: de * F,
|
|
333
|
+
left: 0,
|
|
334
|
+
right: 0,
|
|
335
|
+
height: F,
|
|
336
|
+
display: "flex",
|
|
337
|
+
alignItems: "center",
|
|
338
|
+
padding: "0 12px"
|
|
339
|
+
},
|
|
340
|
+
onClick: () => !f.disabled && ne(String(f.value)),
|
|
341
|
+
onMouseEnter: () => z(de),
|
|
342
|
+
children: V ? V(f, ie) : /* @__PURE__ */ o(be, { children: [
|
|
343
|
+
f.icon && /* @__PURE__ */ n("span", { children: f.icon }),
|
|
344
|
+
/* @__PURE__ */ o("div", { style: { flex: 1 }, children: [
|
|
345
|
+
/* @__PURE__ */ n("div", { children: f.label }),
|
|
346
|
+
f.description && /* @__PURE__ */ n("div", { className: "nice-select__option-desc", children: f.description })
|
|
347
|
+
] }),
|
|
348
|
+
ie && /* @__PURE__ */ n(
|
|
349
|
+
se,
|
|
350
|
+
{
|
|
351
|
+
name: "check",
|
|
352
|
+
size: 16,
|
|
353
|
+
className: "nice-select__option-check"
|
|
354
|
+
}
|
|
355
|
+
)
|
|
356
|
+
] })
|
|
357
|
+
},
|
|
358
|
+
f.value
|
|
359
|
+
);
|
|
360
|
+
}) });
|
|
361
|
+
})() : Array.from(ke.entries()).map(([e, i]) => /* @__PURE__ */ o(Je.Fragment, { children: [
|
|
362
|
+
e && /* @__PURE__ */ n("div", { className: "nice-select__group-label", children: e }),
|
|
363
|
+
i.map((t) => {
|
|
364
|
+
const A = r.includes(t.value), te = h.indexOf(t);
|
|
365
|
+
return /* @__PURE__ */ n(
|
|
366
|
+
"div",
|
|
367
|
+
{
|
|
368
|
+
role: "option",
|
|
369
|
+
"aria-selected": A,
|
|
370
|
+
className: `nice-select__option ${A ? "nice-select__option--selected" : ""} ${te === I ? "nice-select__option--highlighted" : ""} ${t.disabled ? "nice-select__option--disabled" : ""}`,
|
|
371
|
+
onClick: () => !t.disabled && ne(String(t.value)),
|
|
372
|
+
onMouseEnter: () => z(te),
|
|
373
|
+
children: V ? V(t, A) : /* @__PURE__ */ o(be, { children: [
|
|
374
|
+
t.icon && /* @__PURE__ */ n("span", { children: t.icon }),
|
|
375
|
+
/* @__PURE__ */ o("div", { style: { flex: 1 }, children: [
|
|
376
|
+
/* @__PURE__ */ n("div", { children: t.label }),
|
|
377
|
+
t.description && /* @__PURE__ */ n("div", { className: "nice-select__option-desc", children: t.description })
|
|
378
|
+
] }),
|
|
379
|
+
A && /* @__PURE__ */ n(
|
|
380
|
+
se,
|
|
381
|
+
{
|
|
382
|
+
name: "check",
|
|
383
|
+
size: 16,
|
|
384
|
+
className: "nice-select__option-check"
|
|
385
|
+
}
|
|
386
|
+
)
|
|
387
|
+
] })
|
|
388
|
+
},
|
|
389
|
+
t.value
|
|
390
|
+
);
|
|
391
|
+
})
|
|
392
|
+
] }, e))
|
|
393
|
+
]
|
|
394
|
+
}
|
|
395
|
+
),
|
|
396
|
+
Ne
|
|
397
|
+
)
|
|
398
|
+
] }),
|
|
399
|
+
N && /* @__PURE__ */ n("span", { className: "nice-field__spinner", children: /* @__PURE__ */ n("span", { className: "nice-spinner nice-spinner--sm" }) }),
|
|
400
|
+
J === "right" && d && /* @__PURE__ */ n("div", { id: `${D}-error`, className: "nice-field__error", role: "alert", children: d }),
|
|
401
|
+
J === "right" && !d && p && /* @__PURE__ */ n("div", { id: `${D}-helper`, className: "nice-field__helper", children: p })
|
|
402
|
+
] }),
|
|
403
|
+
J !== "right" && d && /* @__PURE__ */ n("div", { id: `${D}-error`, className: "nice-field__error", role: "alert", children: d }),
|
|
404
|
+
J !== "right" && !d && p && /* @__PURE__ */ n("div", { id: `${D}-helper`, className: "nice-field__helper", children: p })
|
|
405
|
+
]
|
|
406
|
+
}
|
|
407
|
+
);
|
|
408
|
+
}
|
|
409
|
+
),
|
|
410
|
+
{ displayName: "NiceSelect" }
|
|
411
|
+
), on = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
412
|
+
__proto__: null,
|
|
413
|
+
NiceSelect: tn
|
|
414
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
415
|
+
export {
|
|
416
|
+
tn as N,
|
|
417
|
+
on as a,
|
|
418
|
+
en as s,
|
|
419
|
+
nn as u
|
|
420
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),c=require("@nice2dev/ui-core"),s=require("react"),Re=require("react-dom");function xe(d){const l=d?.closest?.("[data-theme], .nice-dark, .nice-light, .dark");if(!l)return"";const m=l.getAttribute("data-theme");return m==="dark"||l.classList.contains("nice-dark")||l.classList.contains("dark")?"nice-dark":m==="light"||l.classList.contains("nice-light")?"nice-light":""}function ve(d,l,m,u){const U=u?.maxHeight??320,k=u?.anchorKey,b=s.useRef(null),[oe,W]=s.useState(null),[ne,P]=s.useState(!1),[ie,R]=s.useState(""),x=s.useContext(c.NiceThemeContext)?.portalTarget??(typeof document<"u"?document.body:null),f=s.useRef(m);return f.current=m,s.useLayoutEffect(()=>{if(!d||!l.current)return;R(xe(l.current)),P(!1);const v=()=>{const S=l.current;if(!S)return;const o=S.getBoundingClientRect(),C=b.current?.offsetHeight??U;let M=o.bottom;M+C>window.innerHeight-8&&o.top-C>8&&(M=o.top-C);let E=o.left;E+o.width>window.innerWidth-8&&(E=Math.max(8,window.innerWidth-o.width-8)),W(y=>y&&y.left===E&&y.top===M&&y.width===o.width?y:{left:E,top:M,width:o.width})};v();const r=requestAnimationFrame(()=>{v(),P(!0)}),g=S=>{const o=S.target;o instanceof Node&&(b.current?.contains(o)||l.current?.contains(o))||f.current()},_=()=>f.current();return window.addEventListener("scroll",g,!0),window.addEventListener("resize",_),()=>{cancelAnimationFrame(r),window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",_)}},[d,l,U,k]),s.useEffect(()=>{if(!d)return;const v=g=>{const _=g.target;l.current?.contains(_)||b.current?.contains(_)||(_ instanceof Element?_:_?.parentElement??null)?.closest('.nice-select__dropdown, [role="listbox"], [role="option"]')||f.current()},r=g=>{g.key==="Escape"&&f.current()};return document.addEventListener("mousedown",v),document.addEventListener("keydown",r),()=>{document.removeEventListener("mousedown",v),document.removeEventListener("keydown",r)}},[d,l]),{popupRef:b,coords:oe,ready:ne,themeClass:ie,portalTarget:x}}const ge=Object.assign(s.forwardRef(({label:d,"aria-label":l,helperText:m,error:u,required:U,disabled:k,size:b="md",name:oe,id:W,className:ne,style:P,accessMode:ie,displayStyle:R,options:ae,value:x,onChange:f,placeholder:v,multiple:r=!1,searchable:g=!0,clearable:_=!1,emptyText:S,maxHeight:o=240,optionsSource:C,valueField:M,labelField:E,virtualScroll:y,optionHeight:I=36,onSearch:A,loading:w,renderOption:B,multipleAutosize:V=!1,showKeyboardHints:ye,labelPlacement:we,errorPlacement:G,labelWidth:J,controlWidth:F,displayMode:je},Q)=>{const ce=c.useNiceAccessMode(ie,W),Ne=ce==="hidden";(ce==="disabled"||ce==="readOnly")&&(k=!0);const{t:j}=c.useNiceTranslation(),ke=c.useComponentDisplayStyle("input",R),be=c.useComponentDisplayClass("input",R),L=c.useControlId(W),de=c.useDisplayModeEdit({enabled:je,disabled:k}),[N,D]=s.useState(!1),[X,Y]=s.useState(""),[O,q]=s.useState(-1),[ue,Se]=s.useState(0),fe=s.useRef(null),H=s.useRef(null),[he,Ce]=s.useState(null);s.useLayoutEffect(()=>{!w&&H.current&&Ce(H.current.offsetWidth)},[w,x,R]);const[z,$e]=s.useState(null);s.useLayoutEffect(()=>{r&&!V&&H.current&&z==null&&$e(H.current.offsetWidth)},[r,V,z]);const Me=c.useNiceLookupSource(C??null,M??C?.keyField??"id",E??"name"),$=C?Me.options:(ae??[]).map(e=>typeof e=="string"?{value:e,label:e}:e),{popupRef:Ee,coords:K,ready:pe,themeClass:Z,portalTarget:me}=ve(N,fe,()=>{D(!1),Y("")}),a=s.useMemo(()=>x?Array.isArray(x)?x:[x]:[],[x]),h=s.useMemo(()=>{if(!X&&!A||A)return $;const e=X.toLowerCase();return $.filter(i=>i.label.toLowerCase().includes(e)||String(i.value).toLowerCase().includes(e))},[$,X,A]),_e=s.useMemo(()=>{const e=new Map;for(const i of h){const n=i.group||"";e.has(n)||e.set(n,[]),e.get(n).push(i)}return e},[h]),ee=s.useCallback(e=>{if(r){const i=a.includes(e)?a.filter(n=>n!==e):[...a,e];f?.(i)}else f?.(e),D(!1),Y("")},[r,a,f]),Le=s.useCallback(e=>{if(e.key==="Escape"){D(!1),Y("");return}if(e.key==="Enter"||e.key===" "){if(!N){D(!0),e.preventDefault();return}O>=0&&h[O]&&(ee(h[O].value),e.preventDefault());return}e.key==="ArrowDown"&&(e.preventDefault(),q(i=>Math.min(i+1,h.length-1))),e.key==="ArrowUp"&&(e.preventDefault(),q(i=>Math.max(i-1,0)))},[N,O,h,ee]),le=s.useMemo(()=>a.length===0?null:r?a.map(e=>$.find(i=>i.value===e)?.label||e).join(", "):$.find(e=>e.value===a[0])?.label||a[0],[a,$,r]),De=s.useCallback(e=>{e.stopPropagation(),f?.(r?[]:"")},[f,r]),Oe=s.useMemo(()=>[{key:"Enter",description:j("shortcuts.select","Select")},{key:"Space",description:j("shortcuts.openDropdown","Open dropdown")},c.COMMON_SHORTCUTS.moveUp,c.COMMON_SHORTCUTS.moveDown,c.COMMON_SHORTCUTS.cancel],[j]);return Ne?null:t.jsxs("div",{className:`nice-field ${F==null?"nice-field--select-auto":""} nice-field--${b} ${we==="left"?"nice-field--label-left":""} ${w?"nice-field--loading":""} ${ne||""}`,style:{...P,...J!=null&&{"--nice-field-label-width":typeof J=="number"?`${J}px`:J},...F!=null&&{"--nice-field-control-width":typeof F=="number"?`${F}px`:F},...w&&he!=null&&{"--nice-select-locked-width":`${he}px`}},"aria-busy":w||void 0,children:[d&&t.jsxs("label",{htmlFor:L,className:`nice-field__label ${U?"nice-field__label--required":""}`,children:[d,ye&&t.jsx(c.NiceKeyboardHint,{shortcuts:Oe,size:"sm"})]}),t.jsxs("div",{className:"nice-field__control",children:[de.isDisplay?t.jsx(c.DisplayModeView,{value:le,placeholder:v||j("controls.select","Select..."),disabled:k,onActivate:()=>{de.enterEdit(),D(!0)},ariaLabel:d??l}):t.jsxs("div",{className:"nice-select",ref:fe,children:[t.jsxs("button",{ref:e=>{H.current=e,typeof Q=="function"?Q(e):Q&&(Q.current=e)},type:"button",id:L,role:"combobox","aria-label":d?void 0:l,"aria-expanded":N,"aria-haspopup":"listbox","aria-invalid":!!u,className:`nice-select__trigger nice-select__trigger--${b} nice-select--ds-${be} ${N?"nice-select__trigger--open":""} ${u?"nice-select__trigger--error":""} ${k?"nice-select__trigger--disabled":""}`,style:{...ke,...r&&!V&&z!=null?{width:z,maxWidth:z,overflow:"hidden"}:{}},disabled:k,onClick:()=>D(!N),onKeyDown:Le,children:[le?t.jsx("span",{style:r&&!V?{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}:void 0,children:le}):t.jsx("span",{className:"nice-select__placeholder",children:v||j("controls.select","Select...")}),t.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[_&&a.length>0&&t.jsx("span",{className:"nice-input__clear",onClick:De,role:"button","aria-label":j("controls.clear","Clear"),children:t.jsx(c.NiceIcon,{name:"close",size:14})}),t.jsx("span",{className:`nice-select__chevron ${N?"nice-select__chevron--open":""}`,children:t.jsx(c.NiceIcon,{name:"chevron-down",size:16})})]})]}),N&&K&&me&&Re.createPortal(t.jsxs("div",{ref:Ee,className:`nice-select__dropdown${Z?` ${Z}`:""}`,"data-theme":Z==="nice-dark"?"dark":Z==="nice-light"?"light":void 0,role:"listbox",style:{maxHeight:o,position:"fixed",left:K.left,top:K.top,width:K.width,minWidth:K.width,zIndex:1e3,opacity:pe?1:0,pointerEvents:pe?void 0:"none"},onScroll:y?e=>Se(e.currentTarget.scrollTop):void 0,children:[(g||A)&&t.jsx("div",{className:"nice-select__search",children:t.jsx("input",{type:"text",value:X,onChange:e=>{Y(e.target.value),q(0),A?.(e.target.value)},placeholder:j("controls.search","Search..."),autoFocus:!0})}),w&&t.jsx("div",{className:"nice-select__loading",children:t.jsx("div",{className:"nice-spinner nice-spinner--sm",style:{margin:"8px auto"}})}),!w&&h.length===0?t.jsx("div",{className:"nice-select__empty",children:S||j("controls.noResults","No results found")}):y&&!Array.from(_e.keys()).some(e=>e!=="")?(()=>{const i=h.length*I,n=Math.max(0,Math.floor(ue/I)-3),T=Math.min(h.length,Math.ceil((ue+o)/I)+3),te=h.slice(n,T);return t.jsx("div",{style:{height:i,position:"relative"},children:te.map((p,Te)=>{const re=n+Te,se=a.includes(p.value);return t.jsx("div",{role:"option","aria-selected":se,className:`nice-select__option ${se?"nice-select__option--selected":""} ${re===O?"nice-select__option--highlighted":""} ${p.disabled?"nice-select__option--disabled":""}`,style:{position:"absolute",top:re*I,left:0,right:0,height:I,display:"flex",alignItems:"center",padding:"0 12px"},onClick:()=>!p.disabled&&ee(String(p.value)),onMouseEnter:()=>q(re),children:B?B(p,se):t.jsxs(t.Fragment,{children:[p.icon&&t.jsx("span",{children:p.icon}),t.jsxs("div",{style:{flex:1},children:[t.jsx("div",{children:p.label}),p.description&&t.jsx("div",{className:"nice-select__option-desc",children:p.description})]}),se&&t.jsx(c.NiceIcon,{name:"check",size:16,className:"nice-select__option-check"})]})},p.value)})})})():Array.from(_e.entries()).map(([e,i])=>t.jsxs(s.Fragment,{children:[e&&t.jsx("div",{className:"nice-select__group-label",children:e}),i.map(n=>{const T=a.includes(n.value),te=h.indexOf(n);return t.jsx("div",{role:"option","aria-selected":T,className:`nice-select__option ${T?"nice-select__option--selected":""} ${te===O?"nice-select__option--highlighted":""} ${n.disabled?"nice-select__option--disabled":""}`,onClick:()=>!n.disabled&&ee(String(n.value)),onMouseEnter:()=>q(te),children:B?B(n,T):t.jsxs(t.Fragment,{children:[n.icon&&t.jsx("span",{children:n.icon}),t.jsxs("div",{style:{flex:1},children:[t.jsx("div",{children:n.label}),n.description&&t.jsx("div",{className:"nice-select__option-desc",children:n.description})]}),T&&t.jsx(c.NiceIcon,{name:"check",size:16,className:"nice-select__option-check"})]})},n.value)})]},e))]}),me)]}),w&&t.jsx("span",{className:"nice-field__spinner",children:t.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),G==="right"&&u&&t.jsx("div",{id:`${L}-error`,className:"nice-field__error",role:"alert",children:u}),G==="right"&&!u&&m&&t.jsx("div",{id:`${L}-helper`,className:"nice-field__helper",children:m})]}),G!=="right"&&u&&t.jsx("div",{id:`${L}-error`,className:"nice-field__error",role:"alert",children:u}),G!=="right"&&!u&&m&&t.jsx("div",{id:`${L}-helper`,className:"nice-field__helper",children:m})]})}),{displayName:"NiceSelect"}),Ie=Object.freeze(Object.defineProperty({__proto__:null,NiceSelect:ge},Symbol.toStringTag,{value:"Module"}));exports.NiceSelect=ge;exports.NiceSelect$1=Ie;exports.scopeThemeClass=xe;exports.useAnchoredPopup=ve;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="https://nice2dev.com/schemas/component-doc-v1.json",s="NiceSensorGaugePanel",n="Panel displaying multiple sensor gauges for smart home monitoring.",o="smart-home",t="1.0.0",r="stable",a=[{name:"sensors",type:"SensorData[]",required:!1,default:"[]",description:"Sensor readings"},{name:"layout",type:"'grid' | 'list'",default:"'grid'",description:"Display layout"},{name:"columns",type:"number",default:"3",description:"Grid columns"},{name:"refreshInterval",type:"number",description:"Auto-refresh interval ms"}],i=[{title:"Sensor Panel",description:"Monitor sensors",code:`<NiceSensorGaugePanel
|
|
2
|
+
sensors={sensorReadings}
|
|
3
|
+
layout="grid"
|
|
4
|
+
columns={4}
|
|
5
|
+
showTrends
|
|
6
|
+
showAlerts
|
|
7
|
+
refreshInterval={5000}
|
|
8
|
+
/>`}],c={keyboard:["Tab through sensors"],aria:["Sensor descriptions","Alert states"]},l=["NiceTempDial","NiceRoomGrid"],d={$schema:e,name:s,description:n,category:o,since:t,status:r,props:a,examples:i,accessibility:c,seeAlso:l};exports.$schema=e;exports.accessibility=c;exports.category=o;exports.default=d;exports.description=n;exports.examples=i;exports.name=s;exports.props=a;exports.seeAlso=l;exports.since=t;exports.status=r;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const e = "https://nice2dev.com/schemas/component-doc-v1.json", s = "NiceSensorGaugePanel", n = "Panel displaying multiple sensor gauges for smart home monitoring.", o = "smart-home", t = "1.0.0", r = "stable", a = [{ name: "sensors", type: "SensorData[]", required: !1, default: "[]", description: "Sensor readings" }, { name: "layout", type: "'grid' | 'list'", default: "'grid'", description: "Display layout" }, { name: "columns", type: "number", default: "3", description: "Grid columns" }, { name: "refreshInterval", type: "number", description: "Auto-refresh interval ms" }], i = [{ title: "Sensor Panel", description: "Monitor sensors", code: `<NiceSensorGaugePanel
|
|
2
|
+
sensors={sensorReadings}
|
|
3
|
+
layout="grid"
|
|
4
|
+
columns={4}
|
|
5
|
+
showTrends
|
|
6
|
+
showAlerts
|
|
7
|
+
refreshInterval={5000}
|
|
8
|
+
/>` }], c = { keyboard: ["Tab through sensors"], aria: ["Sensor descriptions", "Alert states"] }, l = ["NiceTempDial", "NiceRoomGrid"], d = {
|
|
9
|
+
$schema: e,
|
|
10
|
+
name: s,
|
|
11
|
+
description: n,
|
|
12
|
+
category: o,
|
|
13
|
+
since: t,
|
|
14
|
+
status: r,
|
|
15
|
+
props: a,
|
|
16
|
+
examples: i,
|
|
17
|
+
accessibility: c,
|
|
18
|
+
seeAlso: l
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
e as $schema,
|
|
22
|
+
c as accessibility,
|
|
23
|
+
o as category,
|
|
24
|
+
d as default,
|
|
25
|
+
n as description,
|
|
26
|
+
i as examples,
|
|
27
|
+
s as name,
|
|
28
|
+
a as props,
|
|
29
|
+
l as seeAlso,
|
|
30
|
+
t as since,
|
|
31
|
+
r as status
|
|
32
|
+
};
|