najwer23morsels 1.10.21 → 1.10.23
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as a,jsx as o,Fragment as i}from"react/jsx-runtime";import{useRef as e,useState as r,useLayoutEffect as n}from"react";import{B as t}from"../Button-QC014EKI.js";import{G as d}from"../Grid-DmI4tqqG.js";import{u as s}from"../useWindowSize-CAQRbyxi.js";import{b as l}from"../IconLocate-CQda7FAB.js";import{N as g}from"../NavigationTabs-CWkGtNHu.js";import{T as
|
|
1
|
+
import{jsxs as a,jsx as o,Fragment as i}from"react/jsx-runtime";import{useRef as e,useState as r,useLayoutEffect as n}from"react";import{B as t}from"../Button-QC014EKI.js";import{G as d}from"../Grid-DmI4tqqG.js";import{u as s}from"../useWindowSize-CAQRbyxi.js";import{b as l}from"../IconLocate-CQda7FAB.js";import{N as g}from"../NavigationTabs-CWkGtNHu.js";import{T as b}from"../TextBox-__k4jPYK.js";import{s as h,g as m}from"../style-inject.es-CrVRO2OA.js";import"../Loader-ZYEBOkbx.js";import"../LoaderDots-BoEg_zlZ.js";var v={n23mNavigationDashboard:"NavigationDashboard-module_n23mNavigationDashboard__DaVvB",dragging:"NavigationDashboard-module_dragging__gT3R-",row:"NavigationDashboard-module_row__0hfcb",sidebarContainer:"NavigationDashboard-module_sidebarContainer__yDMvb",sticky:"NavigationDashboard-module_sticky__mJ3qk",rowOpen:"NavigationDashboard-module_rowOpen__R8X9U",sidebarContainerOpen:"NavigationDashboard-module_sidebarContainerOpen__a5s0j",sidebarContainerClosed:"NavigationDashboard-module_sidebarContainerClosed__MtEom",asideInner:"NavigationDashboard-module_asideInner__6XAWJ",sidebarOpen:"NavigationDashboard-module_sidebarOpen__p8DGE",sidebarClosed:"NavigationDashboard-module_sidebarClosed__WCDNU",outlet:"NavigationDashboard-module_outlet__ZDTtw",outletContent:"NavigationDashboard-module_outletContent__d1Xs6",toggleAnchor:"NavigationDashboard-module_toggleAnchor__s9fbs",toggleOpen:"NavigationDashboard-module_toggleOpen__m8fxh",toggleClosed:"NavigationDashboard-module_toggleClosed__efOTE",rowNoAside:"NavigationDashboard-module_rowNoAside__v3MDd",outletNoAside:"NavigationDashboard-module_outletNoAside__whzV-"};h("@layer n23mNavigationDashboard{.NavigationDashboard-module_n23mNavigationDashboard__DaVvB{--navigationdashboard-sidebar-w:300px;--navigationdashboard-sidebar-min:200px;--navigationdashboard-sidebar-border:2px;--navigationdashboard-toggle-nudge:0px;--navigationdashboard-sidebar-duration:450ms;--navigationdashboard-sidebar-easing:cubic-bezier(0.22,1,0.36,1);&.NavigationDashboard-module_dragging__gT3R-{cursor:col-resize;user-select:none}&.NavigationDashboard-module_dragging__gT3R- .NavigationDashboard-module_row__0hfcb,&.NavigationDashboard-module_dragging__gT3R- .NavigationDashboard-module_sidebarContainer__yDMvb,&.NavigationDashboard-module_dragging__gT3R- .NavigationDashboard-module_sticky__mJ3qk{transition:none}&[data-collapsing=true] .NavigationDashboard-module_sticky__mJ3qk{opacity:.45}.NavigationDashboard-module_row__0hfcb{display:grid;grid-template-columns:0 minmax(0,1fr);min-width:0;overflow-x:clip;transition:grid-template-columns var(--navigationdashboard-sidebar-duration) var(--navigationdashboard-sidebar-easing);width:100%}.NavigationDashboard-module_rowOpen__R8X9U{grid-template-columns:var(--navigationdashboard-sidebar-w) minmax(0,1fr)}.NavigationDashboard-module_sidebarContainer__yDMvb{border-right:var(--navigationdashboard-sidebar-border) solid transparent;box-sizing:border-box;min-width:0;overflow:clip;position:relative;transition:border-right-color var(--navigationdashboard-sidebar-duration) var(--navigationdashboard-sidebar-easing)}.NavigationDashboard-module_sidebarContainerOpen__a5s0j{border-right-color:#e1dfdf}.NavigationDashboard-module_sidebarContainerClosed__MtEom{border-right-color:transparent}.NavigationDashboard-module_sticky__mJ3qk{-ms-overflow-style:none;-webkit-overflow-scrolling:touch;box-sizing:border-box;height:calc(100dvh - var(--navigationdashboard-h, 0px));min-width:0;opacity:1;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;padding:20px 30px 20px 20px;position:sticky;scrollbar-width:none;top:var(--navigationdashboard-h,0);transform:translateZ(0);transition:transform var(--navigationdashboard-sidebar-duration) var(--navigationdashboard-sidebar-easing),opacity .3s ease;width:100%;will-change:transform;&::-webkit-scrollbar{display:none}}.NavigationDashboard-module_asideInner__6XAWJ{box-sizing:border-box;min-width:0;width:calc(max(var(--navigationdashboard-sidebar-min), var(--navigationdashboard-sidebar-w)) - 52px)}.NavigationDashboard-module_asideInner__6XAWJ>*{height:auto;max-height:none;overflow:visible}.NavigationDashboard-module_sidebarOpen__p8DGE{opacity:1}.NavigationDashboard-module_sidebarClosed__WCDNU{opacity:0;pointer-events:none}.NavigationDashboard-module_outlet__ZDTtw{box-sizing:border-box;min-width:0;padding:20px 0 20px 20px;position:relative;width:100%}.NavigationDashboard-module_outletContent__d1Xs6{min-width:0;width:100%}.NavigationDashboard-module_toggleAnchor__s9fbs{height:0;margin-left:-20px;position:sticky;top:calc(var(--navigationdashboard-h, 0px) + (100dvh - var(--navigationdashboard-h, 0px))/2);width:0}.NavigationDashboard-module_toggleOpen__m8fxh{cursor:col-resize;transform:translate(calc(-50% - var(--navigationdashboard-sidebar-border)/2 + var(--navigationdashboard-toggle-nudge)),-50%)}.NavigationDashboard-module_toggleClosed__efOTE{cursor:col-resize;transform:translate(-4px,-50%)}.NavigationDashboard-module_rowNoAside__v3MDd{grid-template-columns:minmax(0,1fr);transition:none}.NavigationDashboard-module_outletNoAside__whzV-{min-width:0}}}");const c=768,u=({children:h,className:u,style:_,menuTopLeftColumn:p=o(i,{children:"menuTopLeftColumn"}),menuTopRightColumn:w=o(i,{children:"menuTopRightColumn"}),menuMobile:N=o(i,{children:"menuMobile"}),outlet:D=o(i,{children:"outlet"}),aside:x=o(i,{children:"aside"}),...f})=>{const C=e(null),y=e(null),{width:k}=s(),O=null!=x&&!1!==x&&k>=c,[j,T]=r(k>=c),[M,z]=r(300),[A,E]=r(!1),L=O&&j,R=e(null),F=e(300),X=e(!1),P=()=>{T(!(k<c)&&(a=>!a))},B=()=>{const a=R.current,o=C.current;if(R.current=null,!a?.moved||!o)return;X.current=!0,o.dataset.collapsing="false";const i=F.current;if(i<220)o.style.setProperty("--navigationdashboard-sidebar-w",`${M}px`),T(!1);else{const a=Math.min(480,Math.max(300,i));o.style.setProperty("--navigationdashboard-sidebar-w",`${a}px`),F.current=a,z(a),T(!0)}E(!1)};return n(()=>{k<c&&T(!1)},[k]),n(()=>{const a=C.current;a&&a.style.setProperty("--navigationdashboard-sidebar-w",`${M}px`)},[M]),n(()=>{const a=C.current,o=y.current;if(!a||!o)return;let i=0;const e=()=>{i=0;const e=Math.max(0,o.getBoundingClientRect().bottom);a.style.setProperty("--navigationdashboard-h",`${e}px`)},r=()=>{i||(i=requestAnimationFrame(e))};e(),window.addEventListener("scroll",r,{passive:!0}),window.addEventListener("resize",r),window.addEventListener("pageshow",r),window.visualViewport?.addEventListener("resize",r);const n=new ResizeObserver(r);return n.observe(o),()=>{window.removeEventListener("scroll",r),window.removeEventListener("resize",r),window.removeEventListener("pageshow",r),window.visualViewport?.removeEventListener("resize",r),n.disconnect(),cancelAnimationFrame(i)}},[]),a("div",{ref:C,className:[v.n23mNavigationDashboard,"n23mNavigationDashboard",A&&v.dragging,u].filter(Boolean).join(" "),...f,style:{...m({"--navigationdashboard-sidebar-w":`${M}px`,"--navigationdashboard-sidebar-min":"300px"}),..._},children:[o("div",{ref:y,children:o(g,{widthInnerContainer:"100%",widthMainContainer:"100%",menuOnlyTop:!0,menuTopLeftColumn:a(d,{layout:"flex",justifyContent:"flex-start",gap:{col:"15px",row:"0px"},alignItems:"center",minHeight:"100%",children:[O&&o(d,{layout:"flex",justifyContent:"flex-start",margin:0,children:o(t,{onClick:P,height:"40px",width:"40px",backgroundColor:"#F2F0EF",backgroundColorDisabled:"#F2F0EF",borderColor:"black",children:o(b,{tag:"div",mobileSize:0,desktopSize:0,margin:"2px 0 0",children:o(l,{open:j,width:20,height:20})})})}),o("div",{children:p})]}),menuTopRightColumn:w,menuMobile:N})}),o(d,{layout:"container",padding:"0 20px 0 0",widthMin:"100%",children:a("div",{className:[v.row,O?L&&v.rowOpen:v.rowNoAside].filter(Boolean).join(" "),children:[O&&o("div",{className:[v.sidebarContainer,L?v.sidebarContainerOpen:v.sidebarContainerClosed].join(" "),children:o("div",{className:[v.sticky,L?v.sidebarOpen:v.sidebarClosed].join(" "),children:o("div",{className:v.asideInner,children:x})})}),a("div",{className:[v.outlet,!O&&v.outletNoAside].filter(Boolean).join(" "),children:[O&&o("div",{className:v.toggleAnchor,children:o(t,{height:"60px",width:"10px",backgroundColor:"#F2F0EF",borderColor:"black",type:"button",onClick:()=>{X.current?X.current=!1:P()},onPointerDown:a=>{if(X.current=!1,0!==a.button||k<c)return;a.currentTarget.setPointerCapture(a.pointerId);const o=L?M:0;R.current={startX:a.clientX,startWidth:o,moved:!1,wasOpen:L},F.current=o},onPointerMove:a=>{const o=R.current,i=C.current;if(!o||!i)return;const e=a.clientX-o.startX;if(!o.moved){if(Math.abs(e)<4)return;o.moved=!0,E(!0)}const r=Math.min(480,Math.max(0,o.startWidth+e));F.current=r,i.style.setProperty("--navigationdashboard-sidebar-w",`${r}px`),i.dataset.collapsing=r<220?"true":"false",!o.wasOpen&&r>0&&T(!0)},onPointerUp:B,onPointerCancel:B,className:[L?v.toggleOpen:v.toggleClosed].join(" "),children:o("div",{children:"|"})})}),o("div",{className:v.outletContent,children:D})]})]})})]})};u.displayName="NavigationDashboard";export{u as NavigationDashboard};
|
package/lib/Table/Table.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ interface TableProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
10
10
|
cellEdit?: TableCellEdit;
|
|
11
11
|
cellDelete?: TableCellDelete;
|
|
12
12
|
onCellReset?: () => void;
|
|
13
|
+
isLoading?: boolean;
|
|
14
|
+
tableLoadingHeight?: React.CSSProperties['height'];
|
|
13
15
|
}
|
|
14
16
|
export declare const Table: React.FC<TableProps>;
|
|
15
17
|
export {};
|
package/lib/Table/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as l,Fragment as t}from"react/jsx-runtime";import{useState as o}from"react";import{B as
|
|
1
|
+
import{jsxs as e,jsx as l,Fragment as t}from"react/jsx-runtime";import{useState as o}from"react";import{B as a}from"../Button-QC014EKI.js";import{C as i}from"../Calendar-BkDrBfRy.js";import{D as n}from"../Dialog-8B0xk8Wx.js";import{F as r}from"../Form-CgTuTB2Q.js";import{G as d}from"../Grid-DmI4tqqG.js";import{I as s}from"../Input-Bl7_BOs4.js";import{L as c}from"../LoaderDots-BoEg_zlZ.js";import{S as p}from"../Select-QBTZllFj.js";import{T as g}from"../TextBox-__k4jPYK.js";import{T as h}from"../Typography-CZqNLAT7.js";import{s as m,g as b}from"../style-inject.es-CrVRO2OA.js";import"../Loader-ZYEBOkbx.js";import"../IconLocate-CQda7FAB.js";import"../validator/index.js";var u={n23mTable:"Table-module_n23mTable__kKVd9",table:"Table-module_table__hJFsY",loadingCell:"Table-module_loadingCell__mIX-P",loadingInner:"Table-module_loadingInner__GlNjv"};m('@layer n23mTable{.Table-module_n23mTable__kKVd9{--hover-bg:rgba(0,0,0,.11);background-attachment:local,local,scroll,scroll;background-color:#fff;background-image:linear-gradient(90deg,#fff 20px,hsla(0,0%,100%,0)),linear-gradient(270deg,#fff 20px,hsla(0,0%,100%,0)),radial-gradient(farthest-side at 0 50%,rgba(0,0,0,.25),transparent),radial-gradient(farthest-side at 100% 50%,rgba(0,0,0,.25),transparent);background-position:0,100%,0,100%;background-repeat:no-repeat;background-size:40px 100%,40px 100%,14px 100%,14px 100%;isolation:isolate;overflow-x:auto;overflow-y:hidden}.Table-module_n23mTable__kKVd9:focus-visible{outline:2px solid currentcolor;outline-offset:2px}.Table-module_table__hJFsY{border-collapse:collapse;min-width:max-content;width:100%}.Table-module_table__hJFsY td,.Table-module_table__hJFsY th{border:1px solid grey;padding:10px 12px;position:relative}.Table-module_table__hJFsY td[data-clickable=true]{cursor:pointer}.Table-module_table__hJFsY td.Table-module_loadingCell__mIX-P{cursor:default;padding:0}.Table-module_loadingInner__GlNjv{align-items:flex-start;box-sizing:border-box;display:flex;justify-content:flex-start;min-height:var(--table-loading-height,219.25px);padding:10px}@media (hover:hover){.Table-module_table__hJFsY tbody tr:hover>td{background-color:var(--hover-bg)}.Table-module_table__hJFsY tbody td:hover:after{background-color:var(--hover-bg);content:"";inset:-100vh 0;pointer-events:none;position:absolute;z-index:-1}.Table-module_table__hJFsY tbody tr:hover>td.Table-module_loadingCell__mIX-P{background-color:transparent}.Table-module_table__hJFsY tbody td.Table-module_loadingCell__mIX-P:hover:after{content:none}}}');const x=({className:m,jsonSchema:x,jsonData:f,cellEdit:_,cellDelete:y,onCellReset:k,isLoading:T=!1,style:C,tableLoadingHeight:v,...S})=>{const[w,j]=o(!1),[z,N]=o(!1),[D,E]=o(0),[M,B]=o(null),{onCellEdit:F,isCellEditError:I=!1,isCellEditPending:Y=!1,isCellEditSuccess:J=!1,cellEditErrorMsg:W,cellEditSuccessMsg:V}=_??{},{onCellDelete:P,isCellDeleteError:L=!1,isCellDeletePending:A=!1,isCellDeleteSuccess:G=!1,cellDeleteErrorMsg:X,cellDeleteSuccessMsg:K}=y??{},O=Boolean(F),R=Boolean(P),H=x.cols.filter(e=>"id"!==e.cellName),q=()=>{N(!1),k?.()},Q=()=>{N(!1),j(!1),k?.()};return e("div",{className:[u.n23mTable,"n23mTable",m].filter(Boolean).join(" "),...S,style:{...b({"--table-loading-height":v}),...C},children:[O&&l(n,{open:w,onCancel:()=>{j(!1),k?.()},widthMax:"900px",children:e(d,{layout:"container",widthMin:"min(800px, calc(100vw - 25px))",padding:"0px 30px 30px 30px",margin:"auto",children:[l(h,{appearance:"light",variant:"subheading",style:{margin:"0 0 20px 0"},children:"Edit Cell"}),e(r,{onSubmit:e=>{if(!F)return;if(Object.values(e).some(({error:e})=>e))return;const l=Object.fromEntries(Object.entries(e).map(([e,{value:l}])=>[e,l]));F(l)},isError:I,isPending:Y,isSuccess:J,errorMsg:W,successMsg:V,children:[l(d,{layout:"columns",col:{smallDesktop:2},gap:{col:"20px"},children:M&&x.cols.map(e=>{const t="id"===e.cellName,o=M[e.cellName];if("date"===e.cellType){const t=o||e.initialValue;return l(i,{label:e.cellText,name:e.cellName,initialValue:t,placeholder:e.cellText},e.cellName)}if("select"===e.cellType){const t=e.options.find(e=>e.value===String(o??""))??e.initialValue;return l(p,{name:e.cellName,options:e.options,initialValue:t},e.cellName)}return l(s,{label:e.cellText,name:e.cellName,type:e.cellType,step:"number"===e.cellType?.01:void 0,defaultValue:String(o??""),disabled:t,placeholder:e.cellText},e.cellName)})}),e(d,{layout:"flex",widthMax:"100%",padding:"0",justifyContent:R?"space-between":"flex-end",alignItems:"right",margin:"20px 0 0 0",children:[R&&l(a,{type:"button",height:"40px",width:"auto",padding:"0 10px",disabled:Y||A,backgroundColor:"red",backgroundColorDisabled:"grey",onClick:()=>{R&&M&&N(!0)},children:l(g,{tag:"span",desktopSize:16,mobileSize:16,fontWeight:400,color:"white",children:"Delete"})}),l(a,{type:"submit",height:"40px",width:"auto",padding:"0 10px",disabled:Y||A,backgroundColor:"#4BB543",backgroundColorDisabled:"grey",children:l(g,{tag:"span",desktopSize:16,mobileSize:16,fontWeight:400,color:"white",children:"Save"})})]})]},D)]})}),R&&l(n,{open:z,onCancel:G?Q:q,widthMax:"450px",children:e(d,{layout:"container",widthMin:"min(400px, calc(100vw - 25px))",padding:"0px 30px 30px 30px",margin:"auto",children:[l(h,{appearance:"light",variant:"subheading",style:{margin:"0 0 10px 0"},children:G?"Deleted":"Are you sure?"}),!G&&l(g,{tag:"p",desktopSize:16,mobileSize:16,fontWeight:400,color:"black",children:"This row will be permanently deleted. This action cannot be undone."}),L&&!G&&l(g,{tag:"p",desktopSize:16,mobileSize:16,fontWeight:400,color:"red",style:{margin:"10px 0 0 0"},children:X??"Delete failed"}),G&&l(g,{tag:"p",desktopSize:16,mobileSize:16,fontWeight:400,color:"#4BB543",children:K??"Row deleted"}),l(d,{layout:"flex",widthMax:"100%",padding:"0",justifyContent:G?"flex-end":"space-between",margin:"20px 0 0 0",children:G?l(a,{type:"button",height:"40px",width:"auto",padding:"0 10px",backgroundColor:"#4BB543",onClick:Q,children:l(g,{tag:"span",desktopSize:16,mobileSize:16,fontWeight:400,color:"white",children:"Close"})}):e(t,{children:[l(a,{type:"button",height:"40px",width:"auto",padding:"0 10px",disabled:A,backgroundColor:"grey",backgroundColorDisabled:"grey",onClick:q,children:l(g,{tag:"span",desktopSize:16,mobileSize:16,fontWeight:400,color:"white",children:"Cancel"})}),l(a,{type:"button",height:"40px",width:"auto",padding:"0 10px",disabled:A,backgroundColor:"red",backgroundColorDisabled:"grey",onClick:()=>{P&&M&&P(M.id)},children:l(g,{tag:"span",desktopSize:16,mobileSize:16,fontWeight:400,color:"white",children:"Yes, delete"})})]})})]})}),e("table",{className:u.table,"aria-busy":T,children:[l("thead",{children:l("tr",{children:H.map(e=>l("th",{scope:"col",children:l(g,{mobileSize:16,desktopSize:20,color:"black",textAlign:e.thAlign??"left",children:e.cellText})},e.cellName))})}),l("tbody",{children:T?l("tr",{children:l("td",{className:u.loadingCell,colSpan:Math.max(H.length,1),children:l("div",{className:u.loadingInner,children:l(c,{})})})}):f.rows.map(e=>l("tr",{children:H.map(t=>{const o=e[t.cellName];return l("td",{"data-clickable":O,onClick:O?()=>(e=>{B(e),j(!0),E(e=>e+1)})(e):void 0,children:l(g,{fontWeight:400,mobileSize:16,desktopSize:16,color:"black",textAlign:t.tdAlign??"left",children:void 0===o?"":String(o)})},t.cellName)})},e.id))})]})]})};x.displayName="Table";export{x as Table};
|