najwer23morsels 1.11.5 → 1.11.7
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/lib/Calendar/index.js +1 -1
- package/lib/{Calendar-Bnm4zaDs.js → Calendar-8yUJpiJE.js} +1 -1
- package/lib/FormForgotPass/index.js +1 -1
- package/lib/FormForgotPassOtp/index.js +1 -1
- package/lib/FormLogin/index.js +1 -1
- package/lib/FormSignUp/index.js +1 -1
- package/lib/Input/Input.d.ts +13 -2
- package/lib/Input/index.js +1 -1
- package/lib/Input-DcnNAaKr.js +1 -0
- package/lib/Select/index.js +1 -1
- package/lib/{Select-CQBKuf2T.js → Select-ha0wdXL7.js} +1 -1
- package/lib/Table/Table.types.d.ts +2 -2
- package/lib/Table/index.js +1 -1
- package/package.json +1 -1
- package/lib/Input-BJj54qdT.js +0 -1
package/lib/Calendar/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{C as Calendar}from"../Calendar-
|
|
1
|
+
export{C as Calendar}from"../Calendar-8yUJpiJE.js";import"react/jsx-runtime";import"react";import"../Button-CUxVuy6N.js";import"../LoaderDots-BoEg_zlZ.js";import"../TextBox-__k4jPYK.js";import"../style-inject.es-CrVRO2OA.js";import"../IconLocate-BXomEqkx.js";import"../Input-DcnNAaKr.js";import"../validator/index.js";import"../validator.const-LBF9whmW.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as a,Fragment as t}from"react/jsx-runtime";import{useRef as n,useState as r,useMemo as o}from"react";import{B as l}from"./Button-CUxVuy6N.js";import{I as d,a as i}from"./IconLocate-BXomEqkx.js";import{I as s}from"./Input-BJj54qdT.js";import{T as c}from"./TextBox-__k4jPYK.js";import{s as p}from"./style-inject.es-CrVRO2OA.js";var h={n23mCalendar:"Calendar-module_n23mCalendar__6E2X7",icon:"Calendar-module_icon__ye4Dl",dropdownWrapper:"Calendar-module_dropdownWrapper__KryyT",open:"Calendar-module_open__Y-JWN",dropdown:"Calendar-module_dropdown__RPTTl",controls:"Calendar-module_controls__XGi-Q",controlsDate:"Calendar-module_controlsDate__L1Wp6",weekdays:"Calendar-module_weekdays__t9VRM",weekdaysChild:"Calendar-module_weekdaysChild__owTwc",days:"Calendar-module_days__D03p-",daysChild:"Calendar-module_daysChild__Jbjrd",daysActive:"Calendar-module_daysActive__Y7Fsv",daysClickable:"Calendar-module_daysClickable__THEm1",months:"Calendar-module_months__NOLDP",years:"Calendar-module_years__li-uY",monthsChild:"Calendar-module_monthsChild__4gx-0",yearsChild:"Calendar-module_yearsChild__mRWoZ"};p("@layer n23mCalendar{.Calendar-module_n23mCalendar__6E2X7{--iff:-apple-system,BlinkMacSystemFont,avenir next,avenir,segoe ui,helvetica neue,helvetica,Cantarell,Ubuntu,roboto,noto,arial,sans-serif;position:relative;& input{padding-right:40px}.Calendar-module_icon__ye4Dl{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 25 25'%3E%3Cpath fill='%23231f20' d='M22.5 3H21V2a1 1 0 0 0-1-1h-1a1 1 0 0 0-1 1v1h-4V2a1 1 0 0 0-1-1h-1a1 1 0 0 0-1 1v1H7V2a1 1 0 0 0-1-1H5a1 1 0 0 0-1 1v1H2.5A1.5 1.5 0 0 0 1 4.5v18A1.5 1.5 0 0 0 2.5 24h20a1.5 1.5 0 0 0 1.5-1.5v-18A1.5 1.5 0 0 0 22.5 3ZM19 2h1v3h-1Zm-7 0h1v3h-1ZM5 2h1v3H5ZM2.5 4H4v1a1 1 0 0 0 1 1h1a1 1 0 0 0 1-1V4h4v1a1 1 0 0 0 1 1h1a1 1 0 0 0 1-1V4h4v1a1 1 0 0 0 1 1h1a1 1 0 0 0 1-1V4h1.5a.5.5 0 0 1 .5.5V8H2V4.5a.5.5 0 0 1 .5-.5Zm20 19h-20a.5.5 0 0 1-.5-.5V9h21v13.5a.5.5 0 0 1-.5.5Z'/%3E%3C/svg%3E\");background-position:100%;background-position:calc(100% - 10px) 50%;background-repeat:no-repeat;background-size:18px;cursor:pointer;display:inline-block;height:40px;position:absolute;right:1px;top:21px;width:40px}.Calendar-module_dropdownWrapper__KryyT{background-color:transparent;display:none;margin-top:65px;padding-bottom:40px;position:absolute;top:0;width:318px;z-index:3;&.Calendar-module_open__Y-JWN{display:block}.Calendar-module_dropdown__RPTTl{corner-shape:squircle;background:#fff;border:1px solid var(--input-cb,#000);border-radius:12px;box-shadow:0 4px 8px 0 rgba(0,0,0,.24),0 6px 20px 0 rgba(0,0,0,.19);box-sizing:border-box;overflow-y:auto;padding:20px;& .Calendar-module_controls__XGi-Q{align-items:center;display:flex;height:40px;justify-content:space-between;padding:0 7px}& .Calendar-module_controlsDate__L1Wp6{display:flex;font-family:var(--n23mFontFamily,var(--iff));font-size:20px;justify-content:center}& .Calendar-module_weekdays__t9VRM{display:flex;justify-content:center;width:100%}& .Calendar-module_weekdaysChild__owTwc{align-items:center;display:flex;font-family:var(--n23mFontFamily,var(--iff));font-size:12px;height:30px;justify-content:center;width:14.28571%}& .Calendar-module_days__D03p-{display:flex;flex-wrap:wrap;justify-content:flex-start;width:100%}& .Calendar-module_daysChild__Jbjrd{font-size:16px}& .Calendar-module_daysChild__Jbjrd:nth-child(7n){color:red;font-weight:700}& .Calendar-module_daysActive__Y7Fsv,& .Calendar-module_daysClickable__THEm1:hover{corner-shape:squircle;background-color:#f2f2f2;border-radius:12px;cursor:pointer}& .Calendar-module_daysClickable__THEm1{cursor:pointer}& .Calendar-module_months__NOLDP,& .Calendar-module_years__li-uY{display:flex;flex-wrap:wrap;gap:12px;justify-content:center}& .Calendar-module_monthsChild__4gx-0,& .Calendar-module_yearsChild__mRWoZ{display:flex;justify-content:center}}}}}");const u=(e,a,t)=>{const n=new Date(0);return n.setFullYear(e,a,t),n.setHours(0,0,0,0),n},m=e=>{const a="string"==typeof e?new Date(e):e,t=a.getFullYear(),n=a.getMonth();return u(t,n+1,0).getDate()},y=e=>{const a="string"==typeof e?new Date(e):e;return`${String(a.getFullYear()).padStart(4,"0")}-${String(a.getMonth()+1).padStart(2,"0")}-${String(a.getDate()).padStart(2,"0")}`},_=e=>{const a="string"==typeof e?new Date(e):e,t=a.getDate(),n=((e=>{const a="string"==typeof e?new Date(e):e,t=a.getFullYear(),n=a.getMonth();return u(t,n,1).getDay()})(a)+6)%7,r=m(a);return Array.from({length:r+n},(e,a)=>{let r="",o="";return a<=n-1?(r="",o="blank"):a===t+n-1?(r=String(a-n+1),o="active"):(r=String(a-n+1),o="clickable"),{day:a-n+1,dayValue:r,cssClass:o}})},g=e=>a=>{"Enter"!==a.key&&" "!==a.key||(a.preventDefault(),e())},C=({children:p,name:C,placeholder:v,label:w="Calendar",initialValue:x,disabled:b,onBlur:f,validatorOptions:D,className:k,style:S,...N})=>{const F=n(null),j=n(null),[M,T]=r({value:x??y(new Date),open:!1,dropDwonState:"days"}),{year:Y,month:V,day:E,iso:A}=((e,a=new Date)=>{const[t="",n="",r=""]=e.split("-"),o=/^\d{4}$/.test(t)?Number(t):a.getFullYear(),l=/^\d{1,2}$/.test(n)&&Number(n)>=1&&Number(n)<=12?Number(n)-1:a.getMonth(),d=/^\d{1,2}$/.test(r)&&Number(r)>=1&&Number(r)<=31?Number(r):a.getDate(),i=Math.min(d,m(u(o,l,1)));return{year:o,month:l,day:i,iso:`${String(o).padStart(4,"0")}-${String(l+1).padStart(2,"0")}-${String(i).padStart(2,"0")}`}})(M.value),H=e=>{const a=e.relatedTarget;a&&j.current?.contains(a)||(T(e=>({...e,open:!1})),f?.(e))},z=e=>{T(a=>({...a,value:y(e),open:!0}))},B=e=>{z(((e,a)=>{const t="string"==typeof e?new Date(e):e,n=t.getFullYear(),r=t.getMonth(),o=u(n,r+1,0).getDate(),l=Math.max(1,Math.min(a,o));return u(n,r,l)})(A,e))},W=e=>{z(((e,a)=>{const t="string"==typeof e?new Date(e):e,n=t.getFullYear(),r=t.getMonth()+a,o=t.getDate(),l=u(n,r,o);if(l.getDate()!==o){const e=u(n,r+1,0).getDate();return u(n,r,e)}return l})(A,e))},$=e=>{z(((e,a)=>{const t="string"==typeof e?new Date(e):e,n=a,r=t.getMonth(),o=t.getDate();return u(n,r,o)})(A,e))},I=e=>{T(a=>({...a,dropDwonState:e}))},Z=e=>{e>0&&B(e),T(e=>({...e,open:!1})),setTimeout(()=>{F.current?.blur()})},L=o(()=>Array.from({length:7},(e,a)=>new Date(2021,0,(a+4)%7).toLocaleString("en-US",{weekday:"short"})),[]),R=o(()=>Array.from({length:12},(e,a)=>new Date(2021,a+1,0).toLocaleString("en-US",{month:"short"})),[]),K=_(A),P=(e=>{const a="string"==typeof e?new Date(e):e,t=a.getFullYear()-4,n=a.getFullYear()+4;return Array.from({length:n-t+1},(e,a)=>t+a).filter(e=>e>=0)})(A);return e("div",{ref:j,className:[h.n23mCalendar,"n23mCalendar",k].filter(Boolean).join(" "),...N,style:{...S},children:[a("div",{className:h.icon,onMouseDown:e=>{b||(e.preventDefault(),document.activeElement===F.current?T(e=>({...e,open:!e.open,dropDwonState:"days"})):F.current?.focus())}}),a(s,{inputRef:F,label:w,type:"text",kind:"input",name:C,autoComplete:"off",placeholder:v,onChange:e=>{const a=e.currentTarget.value;T(e=>({...e,value:a}))},onBlur:H,onFocus:()=>{b||T(e=>({...e,open:!0,dropDwonState:"days"}))},onClick:()=>{b||T(e=>({...e,open:!0,dropDwonState:"days"}))},disabled:b,value:M.value,validatorOptions:[...D??[],{type:"date"}],className:h.arrowUp,"aria-expanded":M.open,role:"combobox"}),a("div",{className:[h.dropdownWrapper,M.open?h.open:""].join(" "),children:e("div",{className:[h.dropdown].join(" "),onMouseDown:e=>e.preventDefault(),onBlur:H,children:["years"===M.dropDwonState&&e(t,{children:[e("div",{className:h.controls,style:{marginBottom:"10px"},children:[a("div",{style:{width:"30px"},children:a(l,{type:"button",padding:"0",height:"30px",width:"30px",title:"Previous years",variant:"secondary",onClick:()=>$(Y-9),children:a(d,{height:22,width:22})})}),a("div",{style:{width:"60%"},className:h.controlsDate,children:a("div",{style:{cursor:"pointer"},role:"button",tabIndex:0,onClick:()=>I("days"),onKeyDown:g(()=>I("days")),children:Y})}),a("div",{style:{width:"30px"},children:a(l,{type:"button",padding:"0",height:"30px",width:"30px",title:"Next years",variant:"secondary",onClick:()=>$(Y+9),children:a(i,{height:22,width:22})})})]}),a("div",{className:h.years,children:P.map(e=>a("div",{className:h.yearsChild,children:a(l,{type:"button",height:"40px",width:"80px",textColor:"black",backgroundColor:Y==e?"white":"#F2F0EF",borderColor:"black",title:"year",onClick:()=>{$(e),I("days")},children:a(c,{mobileSize:14,desktopSize:14,color:"inherit",children:e})},e+M.value)},e+M.value))})]}),"months"===M.dropDwonState&&a("div",{className:h.months,children:R.map((e,t)=>a("div",{className:h.monthsChild,children:a(l,{type:"button",height:"40px",width:"80px",textColor:"black",backgroundColor:V==t?"white":"#F2F0EF",borderColor:"black",title:"month",onClick:()=>{W(t-V),I("days")},children:a(c,{mobileSize:14,desktopSize:14,color:"inherit",children:e})},e+M.value)},e+M.value))}),"days"===M.dropDwonState&&e(t,{children:[e("div",{className:h.controls,children:[a("div",{style:{width:"30px"},children:a(l,{type:"button",padding:"0",height:"30px",width:"30px",title:"Previous month",variant:"secondary",onClick:()=>W(-1),children:a(d,{height:22,width:22})})}),e("div",{style:{width:"60%"},className:h.controlsDate,children:[a("div",{style:{cursor:"pointer"},role:"button",tabIndex:0,onClick:()=>I("years"),onKeyDown:g(()=>I("years")),children:Y}),a("div",{children:"-"}),a("div",{style:{cursor:"pointer"},role:"button",tabIndex:0,onClick:()=>I("months"),onKeyDown:g(()=>I("months")),children:String(V+1).padStart(2,"0")}),a("div",{children:"-"}),a("div",{children:String(E).padStart(2,"0")})]}),a("div",{style:{width:"30px"},children:a(l,{type:"button",padding:"0",height:"30px",width:"30px",title:"Next month",variant:"secondary",onClick:()=>W(1),children:a(i,{height:22,width:22})})})]}),a("div",{className:h.weekdays,children:L.map(e=>a("div",{className:h.weekdaysChild,children:e},e))}),a("div",{className:h.days,children:K.map(e=>{const t=e.day>0&&e.day<=m(A);return a("div",{className:[h.weekdaysChild,h.daysChild,"active"==e.cssClass&&h.daysActive,"clickable"==e.cssClass&&h.daysClickable].join(" "),role:t?"button":void 0,tabIndex:t?0:void 0,onKeyDown:t?g(()=>Z(e.day)):void 0,onMouseDown:()=>Z(e.day),children:t?e.day:" "},e.day+M.value)})})]})]})})]})};C.displayName="Calendar";export{C};
|
|
1
|
+
import{jsxs as e,jsx as a,Fragment as t}from"react/jsx-runtime";import{useRef as n,useState as r,useMemo as o}from"react";import{B as l}from"./Button-CUxVuy6N.js";import{I as d,a as i}from"./IconLocate-BXomEqkx.js";import{I as s}from"./Input-DcnNAaKr.js";import{T as c}from"./TextBox-__k4jPYK.js";import{s as p}from"./style-inject.es-CrVRO2OA.js";var h={n23mCalendar:"Calendar-module_n23mCalendar__6E2X7",icon:"Calendar-module_icon__ye4Dl",dropdownWrapper:"Calendar-module_dropdownWrapper__KryyT",open:"Calendar-module_open__Y-JWN",dropdown:"Calendar-module_dropdown__RPTTl",controls:"Calendar-module_controls__XGi-Q",controlsDate:"Calendar-module_controlsDate__L1Wp6",weekdays:"Calendar-module_weekdays__t9VRM",weekdaysChild:"Calendar-module_weekdaysChild__owTwc",days:"Calendar-module_days__D03p-",daysChild:"Calendar-module_daysChild__Jbjrd",daysActive:"Calendar-module_daysActive__Y7Fsv",daysClickable:"Calendar-module_daysClickable__THEm1",months:"Calendar-module_months__NOLDP",years:"Calendar-module_years__li-uY",monthsChild:"Calendar-module_monthsChild__4gx-0",yearsChild:"Calendar-module_yearsChild__mRWoZ"};p("@layer n23mCalendar{.Calendar-module_n23mCalendar__6E2X7{--iff:-apple-system,BlinkMacSystemFont,avenir next,avenir,segoe ui,helvetica neue,helvetica,Cantarell,Ubuntu,roboto,noto,arial,sans-serif;position:relative;& input{padding-right:40px}.Calendar-module_icon__ye4Dl{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 25 25'%3E%3Cpath fill='%23231f20' d='M22.5 3H21V2a1 1 0 0 0-1-1h-1a1 1 0 0 0-1 1v1h-4V2a1 1 0 0 0-1-1h-1a1 1 0 0 0-1 1v1H7V2a1 1 0 0 0-1-1H5a1 1 0 0 0-1 1v1H2.5A1.5 1.5 0 0 0 1 4.5v18A1.5 1.5 0 0 0 2.5 24h20a1.5 1.5 0 0 0 1.5-1.5v-18A1.5 1.5 0 0 0 22.5 3ZM19 2h1v3h-1Zm-7 0h1v3h-1ZM5 2h1v3H5ZM2.5 4H4v1a1 1 0 0 0 1 1h1a1 1 0 0 0 1-1V4h4v1a1 1 0 0 0 1 1h1a1 1 0 0 0 1-1V4h4v1a1 1 0 0 0 1 1h1a1 1 0 0 0 1-1V4h1.5a.5.5 0 0 1 .5.5V8H2V4.5a.5.5 0 0 1 .5-.5Zm20 19h-20a.5.5 0 0 1-.5-.5V9h21v13.5a.5.5 0 0 1-.5.5Z'/%3E%3C/svg%3E\");background-position:100%;background-position:calc(100% - 10px) 50%;background-repeat:no-repeat;background-size:18px;cursor:pointer;display:inline-block;height:40px;position:absolute;right:1px;top:21px;width:40px}.Calendar-module_dropdownWrapper__KryyT{background-color:transparent;display:none;margin-top:65px;padding-bottom:40px;position:absolute;top:0;width:318px;z-index:3;&.Calendar-module_open__Y-JWN{display:block}.Calendar-module_dropdown__RPTTl{corner-shape:squircle;background:#fff;border:1px solid var(--input-cb,#000);border-radius:12px;box-shadow:0 4px 8px 0 rgba(0,0,0,.24),0 6px 20px 0 rgba(0,0,0,.19);box-sizing:border-box;overflow-y:auto;padding:20px;& .Calendar-module_controls__XGi-Q{align-items:center;display:flex;height:40px;justify-content:space-between;padding:0 7px}& .Calendar-module_controlsDate__L1Wp6{display:flex;font-family:var(--n23mFontFamily,var(--iff));font-size:20px;justify-content:center}& .Calendar-module_weekdays__t9VRM{display:flex;justify-content:center;width:100%}& .Calendar-module_weekdaysChild__owTwc{align-items:center;display:flex;font-family:var(--n23mFontFamily,var(--iff));font-size:12px;height:30px;justify-content:center;width:14.28571%}& .Calendar-module_days__D03p-{display:flex;flex-wrap:wrap;justify-content:flex-start;width:100%}& .Calendar-module_daysChild__Jbjrd{font-size:16px}& .Calendar-module_daysChild__Jbjrd:nth-child(7n){color:red;font-weight:700}& .Calendar-module_daysActive__Y7Fsv,& .Calendar-module_daysClickable__THEm1:hover{corner-shape:squircle;background-color:#f2f2f2;border-radius:12px;cursor:pointer}& .Calendar-module_daysClickable__THEm1{cursor:pointer}& .Calendar-module_months__NOLDP,& .Calendar-module_years__li-uY{display:flex;flex-wrap:wrap;gap:12px;justify-content:center}& .Calendar-module_monthsChild__4gx-0,& .Calendar-module_yearsChild__mRWoZ{display:flex;justify-content:center}}}}}");const u=(e,a,t)=>{const n=new Date(0);return n.setFullYear(e,a,t),n.setHours(0,0,0,0),n},m=e=>{const a="string"==typeof e?new Date(e):e,t=a.getFullYear(),n=a.getMonth();return u(t,n+1,0).getDate()},y=e=>{const a="string"==typeof e?new Date(e):e;return`${String(a.getFullYear()).padStart(4,"0")}-${String(a.getMonth()+1).padStart(2,"0")}-${String(a.getDate()).padStart(2,"0")}`},_=e=>{const a="string"==typeof e?new Date(e):e,t=a.getDate(),n=((e=>{const a="string"==typeof e?new Date(e):e,t=a.getFullYear(),n=a.getMonth();return u(t,n,1).getDay()})(a)+6)%7,r=m(a);return Array.from({length:r+n},(e,a)=>{let r="",o="";return a<=n-1?(r="",o="blank"):a===t+n-1?(r=String(a-n+1),o="active"):(r=String(a-n+1),o="clickable"),{day:a-n+1,dayValue:r,cssClass:o}})},g=e=>a=>{"Enter"!==a.key&&" "!==a.key||(a.preventDefault(),e())},C=({children:p,name:C,placeholder:v,label:w="Calendar",initialValue:x,disabled:b,onBlur:f,validatorOptions:D,className:k,style:S,...N})=>{const F=n(null),j=n(null),[M,T]=r({value:x??y(new Date),open:!1,dropDwonState:"days"}),{year:Y,month:V,day:E,iso:A}=((e,a=new Date)=>{const[t="",n="",r=""]=e.split("-"),o=/^\d{4}$/.test(t)?Number(t):a.getFullYear(),l=/^\d{1,2}$/.test(n)&&Number(n)>=1&&Number(n)<=12?Number(n)-1:a.getMonth(),d=/^\d{1,2}$/.test(r)&&Number(r)>=1&&Number(r)<=31?Number(r):a.getDate(),i=Math.min(d,m(u(o,l,1)));return{year:o,month:l,day:i,iso:`${String(o).padStart(4,"0")}-${String(l+1).padStart(2,"0")}-${String(i).padStart(2,"0")}`}})(M.value),H=e=>{const a=e.relatedTarget;a&&j.current?.contains(a)||(T(e=>({...e,open:!1})),f?.(e))},z=e=>{T(a=>({...a,value:y(e),open:!0}))},B=e=>{z(((e,a)=>{const t="string"==typeof e?new Date(e):e,n=t.getFullYear(),r=t.getMonth(),o=u(n,r+1,0).getDate(),l=Math.max(1,Math.min(a,o));return u(n,r,l)})(A,e))},W=e=>{z(((e,a)=>{const t="string"==typeof e?new Date(e):e,n=t.getFullYear(),r=t.getMonth()+a,o=t.getDate(),l=u(n,r,o);if(l.getDate()!==o){const e=u(n,r+1,0).getDate();return u(n,r,e)}return l})(A,e))},$=e=>{z(((e,a)=>{const t="string"==typeof e?new Date(e):e,n=a,r=t.getMonth(),o=t.getDate();return u(n,r,o)})(A,e))},I=e=>{T(a=>({...a,dropDwonState:e}))},Z=e=>{e>0&&B(e),T(e=>({...e,open:!1})),setTimeout(()=>{F.current?.blur()})},L=o(()=>Array.from({length:7},(e,a)=>new Date(2021,0,(a+4)%7).toLocaleString("en-US",{weekday:"short"})),[]),R=o(()=>Array.from({length:12},(e,a)=>new Date(2021,a+1,0).toLocaleString("en-US",{month:"short"})),[]),K=_(A),P=(e=>{const a="string"==typeof e?new Date(e):e,t=a.getFullYear()-4,n=a.getFullYear()+4;return Array.from({length:n-t+1},(e,a)=>t+a).filter(e=>e>=0)})(A);return e("div",{ref:j,className:[h.n23mCalendar,"n23mCalendar",k].filter(Boolean).join(" "),...N,style:{...S},children:[a("div",{className:h.icon,onMouseDown:e=>{b||(e.preventDefault(),document.activeElement===F.current?T(e=>({...e,open:!e.open,dropDwonState:"days"})):F.current?.focus())}}),a(s,{inputRef:F,label:w,type:"text",kind:"input",name:C,autoComplete:"off",placeholder:v,onChange:e=>{const a=e.currentTarget.value;T(e=>({...e,value:a}))},onBlur:H,onFocus:()=>{b||T(e=>({...e,open:!0,dropDwonState:"days"}))},onClick:()=>{b||T(e=>({...e,open:!0,dropDwonState:"days"}))},disabled:b,value:M.value,validatorOptions:[...D??[],{type:"date"}],className:h.arrowUp,"aria-expanded":M.open,role:"combobox"}),a("div",{className:[h.dropdownWrapper,M.open?h.open:""].join(" "),children:e("div",{className:[h.dropdown].join(" "),onMouseDown:e=>e.preventDefault(),onBlur:H,children:["years"===M.dropDwonState&&e(t,{children:[e("div",{className:h.controls,style:{marginBottom:"10px"},children:[a("div",{style:{width:"30px"},children:a(l,{type:"button",padding:"0",height:"30px",width:"30px",title:"Previous years",variant:"secondary",onClick:()=>$(Y-9),children:a(d,{height:22,width:22})})}),a("div",{style:{width:"60%"},className:h.controlsDate,children:a("div",{style:{cursor:"pointer"},role:"button",tabIndex:0,onClick:()=>I("days"),onKeyDown:g(()=>I("days")),children:Y})}),a("div",{style:{width:"30px"},children:a(l,{type:"button",padding:"0",height:"30px",width:"30px",title:"Next years",variant:"secondary",onClick:()=>$(Y+9),children:a(i,{height:22,width:22})})})]}),a("div",{className:h.years,children:P.map(e=>a("div",{className:h.yearsChild,children:a(l,{type:"button",height:"40px",width:"80px",textColor:"black",backgroundColor:Y==e?"white":"#F2F0EF",borderColor:"black",title:"year",onClick:()=>{$(e),I("days")},children:a(c,{mobileSize:14,desktopSize:14,color:"inherit",children:e})},e+M.value)},e+M.value))})]}),"months"===M.dropDwonState&&a("div",{className:h.months,children:R.map((e,t)=>a("div",{className:h.monthsChild,children:a(l,{type:"button",height:"40px",width:"80px",textColor:"black",backgroundColor:V==t?"white":"#F2F0EF",borderColor:"black",title:"month",onClick:()=>{W(t-V),I("days")},children:a(c,{mobileSize:14,desktopSize:14,color:"inherit",children:e})},e+M.value)},e+M.value))}),"days"===M.dropDwonState&&e(t,{children:[e("div",{className:h.controls,children:[a("div",{style:{width:"30px"},children:a(l,{type:"button",padding:"0",height:"30px",width:"30px",title:"Previous month",variant:"secondary",onClick:()=>W(-1),children:a(d,{height:22,width:22})})}),e("div",{style:{width:"60%"},className:h.controlsDate,children:[a("div",{style:{cursor:"pointer"},role:"button",tabIndex:0,onClick:()=>I("years"),onKeyDown:g(()=>I("years")),children:Y}),a("div",{children:"-"}),a("div",{style:{cursor:"pointer"},role:"button",tabIndex:0,onClick:()=>I("months"),onKeyDown:g(()=>I("months")),children:String(V+1).padStart(2,"0")}),a("div",{children:"-"}),a("div",{children:String(E).padStart(2,"0")})]}),a("div",{style:{width:"30px"},children:a(l,{type:"button",padding:"0",height:"30px",width:"30px",title:"Next month",variant:"secondary",onClick:()=>W(1),children:a(i,{height:22,width:22})})})]}),a("div",{className:h.weekdays,children:L.map(e=>a("div",{className:h.weekdaysChild,children:e},e))}),a("div",{className:h.days,children:K.map(e=>{const t=e.day>0&&e.day<=m(A);return a("div",{className:[h.weekdaysChild,h.daysChild,"active"==e.cssClass&&h.daysActive,"clickable"==e.cssClass&&h.daysClickable].join(" "),role:t?"button":void 0,tabIndex:t?0:void 0,onKeyDown:t?g(()=>Z(e.day)):void 0,onMouseDown:()=>Z(e.day),children:t?e.day:" "},e.day+M.value)})})]})]})})]})};C.displayName="Calendar";export{C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as o,jsxs as r}from"react/jsx-runtime";import{B as e}from"../Button-CUxVuy6N.js";import{F as t}from"../Form-GEUDMZ7Z.js";import{G as s}from"../Grid-DmI4tqqG.js";import{I as i}from"../Input-
|
|
1
|
+
import{jsx as o,jsxs as r}from"react/jsx-runtime";import{B as e}from"../Button-CUxVuy6N.js";import{F as t}from"../Form-GEUDMZ7Z.js";import{G as s}from"../Grid-DmI4tqqG.js";import{I as i}from"../Input-DcnNAaKr.js";import{T as a}from"../TextBox-__k4jPYK.js";import{T as n}from"../Typography-CR1DOKsN.js";import{s as m}from"../style-inject.es-CrVRO2OA.js";import"react";import"../LoaderDots-BoEg_zlZ.js";import"../validator.const-LBF9whmW.js";import"../Loader-ZYEBOkbx.js";import"../validator/index.js";var l={n23mFormForgotPass:"FormForgotPass-module_n23mFormForgotPass__sI7QJ",forogotPasswordWrapper:"FormForgotPass-module_forogotPasswordWrapper__LCDpp"};m("@layer n23mFormForgotPass{.FormForgotPass-module_n23mFormForgotPass__sI7QJ{.FormForgotPass-module_forogotPasswordWrapper__LCDpp{corner-shape:squircle;background-color:#fff;border:1px solid grey;border-radius:12px}}}");const p=({className:m,style:p,onSubmit:d,isPending:c,isError:g,isSuccess:f,errorMsg:u,successMsg:h,onNavigate:F,footerHeight:x="100px",linkMainPage:y,linkLogin:P,...j})=>{const b=o=>{F?F(o):window.location.href=o};return o("div",{className:[l.n23mFormForgotPass,"n23mFormForgotPass",m].filter(Boolean).join(" "),...j,style:{...p},children:o(s,{layout:"flex",flexWrap:"wrap",justifyContent:"center",alignItems:"center",widthMax:"1400px",minHeight:`calc(100dvb - ${x})`,children:r(s,{layout:"container",minHeight:0,widthMin:"min(450px, calc(100% - 40px))",padding:"20px",margin:"20px",className:l.forogotPasswordWrapper,children:[y&&o(n,{desktopSize:20,mobileSize:20,fontWeight:500,variant:"link",href:y.link,onClick:o=>{o.preventDefault(),b(y.link)},children:y.text}),o(a,{tag:"h3",desktopSize:14,mobileSize:14,fontWeight:500,margin:"12px 0 18px",children:"Forgot Password"}),r(t,{onSubmit:d,isError:g,isPending:c,isSuccess:f,errorMsg:u,successMsg:h,children:[o(i,{validatorOptions:[{type:"empty"},{type:"email"}],label:"Email",name:"email",type:"text",placeholder:"you@example.com"}),r(s,{layout:"flex",justifyContent:"space-between",alignItems:"flex-start",children:[o(e,{type:"submit",disabled:c,variant:"primary",children:o(a,{desktopSize:16,mobileSize:16,color:"inherit",children:"Send"})}),P&&o(n,{variant:"link",href:P.link,desktopSize:12,mobileSize:12,onClick:o=>{o.preventDefault(),b(P.link)},children:P.text})]})]})]})})})};p.displayName="FormForgotPass";export{p as FormForgotPass};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as r,jsxs as o}from"react/jsx-runtime";import{useRef as e}from"react";import{B as t}from"../Button-CUxVuy6N.js";import{F as s}from"../Form-GEUDMZ7Z.js";import{G as a}from"../Grid-DmI4tqqG.js";import{I as i}from"../Input-
|
|
1
|
+
import{jsx as r,jsxs as o}from"react/jsx-runtime";import{useRef as e}from"react";import{B as t}from"../Button-CUxVuy6N.js";import{F as s}from"../Form-GEUDMZ7Z.js";import{G as a}from"../Grid-DmI4tqqG.js";import{I as i}from"../Input-DcnNAaKr.js";import{T as n}from"../TextBox-__k4jPYK.js";import{T as p}from"../Typography-CR1DOKsN.js";import{s as l}from"../style-inject.es-CrVRO2OA.js";import"../LoaderDots-BoEg_zlZ.js";import"../validator.const-LBF9whmW.js";import"../Loader-ZYEBOkbx.js";import"../validator/index.js";var m={n23mFormForgotPassOtp:"FormForgotPassOtp-module_n23mFormForgotPassOtp__898ki",forogotPasswordOtpWrapper:"FormForgotPassOtp-module_forogotPasswordOtpWrapper__3s-uz"};l("@layer n23mFormForgotPassOtp{.FormForgotPassOtp-module_n23mFormForgotPassOtp__898ki{.FormForgotPassOtp-module_forogotPasswordOtpWrapper__3s-uz{corner-shape:squircle;background-color:#fff;border:1px solid grey;border-radius:12px}}}");const c=({className:l,style:c,onSubmit:u,isPending:d,isError:g,isSuccess:f,errorMsg:h,successMsg:F,onNavigate:w,footerHeight:y="100px",linkMainPage:b,...v})=>{const x=e(null),P=e(null),O=e(!1);return r("div",{className:[m.n23mFormForgotPassOtp,"n23mFormForgotPassOtp",l].filter(Boolean).join(" "),...v,style:{...c},children:r(a,{layout:"flex",flexWrap:"wrap",justifyContent:"center",alignItems:"center",widthMax:"1400px",minHeight:`calc(100dvb - ${y})`,children:o(a,{layout:"container",minHeight:0,widthMin:"min(450px, calc(100% - 40px))",padding:"20px",margin:"20px",className:m.forogotPasswordOtpWrapper,children:[b&&r(p,{desktopSize:20,mobileSize:20,fontWeight:500,variant:"link",href:b.link,onClick:r=>{var o;r.preventDefault(),o=b.link,w?w(o):window.location.href=o},children:b.text}),r(n,{tag:"h3",desktopSize:14,mobileSize:14,fontWeight:500,margin:"12px 0 18px",children:"Change password"}),o(s,{onSubmit:u,isError:g,isPending:d,isSuccess:f,errorMsg:h,successMsg:F,children:[r(i,{inputRef:x,label:"New password",type:"password",name:"pass",validatorOptions:[{type:"empty"},{type:"equal",options:{ref:P}}],placeholder:"Create a new password",onBlur:()=>{O.current||x.current?.value&&P.current?.value&&(O.current=!0,P.current?.dispatchEvent(new FocusEvent("focusout",{bubbles:!0})),O.current=!1)}}),r(i,{inputRef:P,label:"Confirm new password",type:"password",name:"confirmPass",validatorOptions:[{type:"empty"},{type:"equal",options:{ref:x}}],placeholder:"Re-enter your new password",onBlur:()=>{O.current||x.current?.value&&P.current?.value&&(O.current=!0,x.current?.dispatchEvent(new FocusEvent("focusout",{bubbles:!0})),O.current=!1)}}),r(t,{type:"submit",disabled:d,variant:"primary",children:r(n,{desktopSize:16,mobileSize:16,color:"inherit",children:"Send"})})]})]})})})};c.displayName="FormForgotPassOtp";export{c as FormForgotPassOtp};
|
package/lib/FormLogin/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as i}from"react/jsx-runtime";import{B as o}from"../Button-CUxVuy6N.js";import{F as r}from"../Form-GEUDMZ7Z.js";import{G as n}from"../Grid-DmI4tqqG.js";import{I as t}from"../Input-
|
|
1
|
+
import{jsx as e,jsxs as i}from"react/jsx-runtime";import{B as o}from"../Button-CUxVuy6N.js";import{F as r}from"../Form-GEUDMZ7Z.js";import{G as n}from"../Grid-DmI4tqqG.js";import{I as t}from"../Input-DcnNAaKr.js";import{T as a}from"../TextBox-__k4jPYK.js";import{T as l}from"../Typography-CR1DOKsN.js";import{s}from"../style-inject.es-CrVRO2OA.js";import"react";import"../LoaderDots-BoEg_zlZ.js";import"../validator.const-LBF9whmW.js";import"../Loader-ZYEBOkbx.js";import"../validator/index.js";var m={n23mFormLogin:"FormLogin-module_n23mFormLogin__1mOEk",loginWrapper:"FormLogin-module_loginWrapper__HOEgv"};s("@layer n23mFormLogin{.FormLogin-module_n23mFormLogin__1mOEk{.FormLogin-module_loginWrapper__HOEgv{corner-shape:squircle;background-color:#fff;border:1px solid grey;border-radius:12px}}}");const p=({className:s,style:p,onSubmit:d,isPending:c,isError:g,isSuccess:h,errorMsg:f,successMsg:u,onNavigate:y,linkMainPage:x,linkForgotPassword:k,linkSignUp:v,footerHeight:b="100px",...j})=>{const S=e=>{y?y(e):window.location.href=e};return e("div",{className:[m.n23mFormLogin,"n23mFormLogin",s].filter(Boolean).join(" "),...j,style:{...p},children:e(n,{layout:"flex",flexWrap:"wrap",justifyContent:"center",alignItems:"center",widthMax:"1400px",minHeight:`calc(100dvb - ${b})`,children:i(n,{layout:"container",minHeight:0,widthMin:"min(450px, calc(100% - 40px))",padding:"20px",margin:"20px",className:m.loginWrapper,children:[x&&e(l,{desktopSize:20,mobileSize:20,fontWeight:500,variant:"link",href:x.link,onClick:e=>{e.preventDefault(),S(x.link)},children:x.text}),e(a,{tag:"h3",desktopSize:14,mobileSize:14,fontWeight:500,margin:"12px 0 18px",children:"Good to see you!"}),i(r,{onSubmit:d,isError:g,isPending:c,isSuccess:h,errorMsg:f,successMsg:u,children:[e(t,{validatorOptions:[{type:"empty"},{type:"email"}],label:"Email",name:"email",type:"text",placeholder:"you@example.com"}),e(t,{label:"Password",type:"password",name:"pass",validatorOptions:[{type:"empty"}],placeholder:"Enter your password"}),i(n,{layout:"flex",justifyContent:"space-between",alignItems:"flex-start",children:[e(o,{type:"submit",disabled:c,variant:"primary",children:e(a,{desktopSize:16,mobileSize:16,color:"inherit",children:"Log in"})}),i("div",{children:[k&&e("div",{children:e(l,{variant:"link",href:k.link,desktopSize:12,mobileSize:12,onClick:e=>{e.preventDefault(),S(k.link)},children:k.text})}),v&&e(n,{layout:"flex",justifyContent:"right",children:e(l,{variant:"link",href:v.link,desktopSize:12,mobileSize:12,onClick:e=>{e.preventDefault(),S(v.link)},children:v.text})})]})]})]})]})})})};p.displayName="FormLogin";export{p as FormLogin};
|
package/lib/FormSignUp/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as i}from"react/jsx-runtime";import{B as r}from"../Button-CUxVuy6N.js";import{F as o}from"../Form-GEUDMZ7Z.js";import{G as n}from"../Grid-DmI4tqqG.js";import{I as t}from"../Input-
|
|
1
|
+
import{jsx as e,jsxs as i}from"react/jsx-runtime";import{B as r}from"../Button-CUxVuy6N.js";import{F as o}from"../Form-GEUDMZ7Z.js";import{G as n}from"../Grid-DmI4tqqG.js";import{I as t}from"../Input-DcnNAaKr.js";import{T as a}from"../TextBox-__k4jPYK.js";import{T as s}from"../Typography-CR1DOKsN.js";import{s as p}from"../style-inject.es-CrVRO2OA.js";import"react";import"../LoaderDots-BoEg_zlZ.js";import"../validator.const-LBF9whmW.js";import"../Loader-ZYEBOkbx.js";import"../validator/index.js";var l={n23mFormSignUp:"FormSignUp-module_n23mFormSignUp__p9dT2",signUpWrapper:"FormSignUp-module_signUpWrapper__PcjYN"};p("@layer n23mFormSignUp{.FormSignUp-module_n23mFormSignUp__p9dT2{.FormSignUp-module_signUpWrapper__PcjYN{corner-shape:squircle;background-color:#fff;border:1px solid grey;border-radius:12px}}}");const m=({className:p,style:m,onSubmit:c,isPending:d,isError:g,isSuccess:u,errorMsg:f,successMsg:h,onNavigate:x,footerHeight:y="100px",linkMainPage:S,linkLogin:j,...b})=>{const k=e=>{x?x(e):window.location.href=e};return e("div",{className:[l.n23mFormSignUp,"n23mFormSignUp",p].filter(Boolean).join(" "),...b,style:{...m},children:e(n,{layout:"flex",flexWrap:"wrap",justifyContent:"center",alignItems:"center",widthMax:"1400px",minHeight:`calc(100dvb - ${y})`,children:i(n,{layout:"container",minHeight:0,widthMin:"min(450px, calc(100% - 40px))",padding:"20px",margin:"20px",className:l.signUpWrapper,children:[S&&e(s,{desktopSize:20,mobileSize:20,fontWeight:500,variant:"link",href:S.link,onClick:e=>{e.preventDefault(),k(S.link)},children:S.text}),e(a,{tag:"h3",desktopSize:14,mobileSize:14,fontWeight:500,margin:"12px 0 18px",children:"Create an account now!"}),i(o,{onSubmit:c,isError:g,isPending:d,isSuccess:u,errorMsg:f,successMsg:h,children:[e(t,{validatorOptions:[{type:"empty"},{type:"email"}],label:"Email",name:"email",type:"text",placeholder:"you@example.com"}),e(t,{label:"Password",type:"password",name:"pass",validatorOptions:[{type:"empty"}],placeholder:"Enter your password"}),i(n,{layout:"flex",justifyContent:"space-between",alignItems:"flex-start",children:[e(r,{type:"submit",disabled:d,variant:"primary",children:e(a,{desktopSize:16,mobileSize:16,color:"inherit",children:"Sign up"})}),j&&e("div",{children:e(s,{variant:"link",href:j.link,desktopSize:12,mobileSize:12,onClick:e=>{e.preventDefault(),k(j.link)},children:j.text})})]})]})]})})})};m.displayName="FormSignUp";export{m as FormSignUp};
|
package/lib/Input/Input.d.ts
CHANGED
|
@@ -17,14 +17,25 @@ interface InputBase extends React.HTMLAttributes<HTMLElement> {
|
|
|
17
17
|
autoComplete?: string;
|
|
18
18
|
step?: number | 'any';
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
kind?: 'input'
|
|
20
|
+
type InputKindProps = InputBase & {
|
|
21
|
+
kind?: 'input';
|
|
22
22
|
name: string;
|
|
23
|
+
minHeight?: never;
|
|
24
|
+
maxHeight?: never;
|
|
23
25
|
};
|
|
26
|
+
type TextareaProps = InputBase & {
|
|
27
|
+
kind: 'textarea';
|
|
28
|
+
name: string;
|
|
29
|
+
minHeight?: React.CSSProperties['minHeight'];
|
|
30
|
+
maxHeight?: React.CSSProperties['maxHeight'];
|
|
31
|
+
};
|
|
32
|
+
export type InputProps = InputKindProps | TextareaProps;
|
|
24
33
|
export type SelectProps = InputBase & {
|
|
25
34
|
kind: 'select';
|
|
26
35
|
name?: never;
|
|
27
36
|
id: string;
|
|
37
|
+
minHeight?: never;
|
|
38
|
+
maxHeight?: never;
|
|
28
39
|
};
|
|
29
40
|
export declare const Input: React.FC<InputProps | SelectProps>;
|
|
30
41
|
export {};
|
package/lib/Input/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{I as Input}from"../Input-
|
|
1
|
+
export{I as Input}from"../Input-DcnNAaKr.js";import"react/jsx-runtime";import"react";import"../TextBox-__k4jPYK.js";import"../style-inject.es-CrVRO2OA.js";import"../validator/index.js";import"../validator.const-LBF9whmW.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useRef as n,useEffect as r}from"react";import{T as o}from"./TextBox-__k4jPYK.js";import{s as a,g as i}from"./style-inject.es-CrVRO2OA.js";import{validator as l}from"./validator/index.js";import{V as p}from"./validator.const-LBF9whmW.js";var u={n23mInput:"Input-module_n23mInput__6WopW",n23mInputInput:"Input-module_n23mInputInput__djmAy"};a("@layer n23mInput{.Input-module_n23mInput__6WopW{--iff:-apple-system,BlinkMacSystemFont,avenir next,avenir,segoe ui,helvetica neue,helvetica,Cantarell,Ubuntu,roboto,noto,arial,sans-serif;margin-top:0;&:not(:has(input[type=hidden])){margin-bottom:10px}.Input-module_n23mInputInput__djmAy{display:grid;& input,& textarea{corner-shape:squircle;border:1px solid var(--input-cb,#000);border-radius:12px;box-sizing:border-box;color:var(--input-c,#000);font-family:var(--n23mFontFamily,var(--iff));font-size:16px;font-weight:500;&:disabled{-webkit-text-fill-color:#8a8a8a;background-color:#f3f3f3;border-color:#cfcfcf;color:#8a8a8a;cursor:not-allowed;opacity:1}}& input{height:40px;padding:20px 10px;width:100%}& textarea{field-sizing:content;block-size:100%;max-height:var(--input-maxh,400px);min-height:var(--input-minh,200px);padding:10px;resize:vertical}&input[type=hidden]{margin:0;padding:0}& ::placeholder{filter:brightness(125%);font-weight:300}}.Input-module_n23mInputError__0yrzG{color:var(--najwer23snacks-input-error-font-color);font-family:var(--najwer23snacks-input-error-font-family);font-size:var(--najwer23snacks-input-error-font-size);font-weight:var(--najwer23snacks-input-error-font-weight);line-height:1;margin:2px}}}");const s=e=>{for(const t of[":autofill",":-webkit-autofill"])try{if(e.matches(t))return!0}catch{}return!1},c=e=>"number"==typeof e?`${e}px`:e,d=({className:a,style:d,name:m,label:f,inputRef:h,placeholder:g,type:x="text",labelColor:v="black",kind:b="input",inputColor:y,inputColorBorder:I,defaultValue:_,disabled:C,validatorOptions:j,value:k,autoComplete:w,id:z,onBlur:B,onChange:S,step:T,minHeight:W,maxHeight:V,...F})=>{const N=n(null),E=n(null),H=e=>{if(N.current&&(N.current.textContent=""),!j)return;const t=l(e.value,j);t.length>0?(N.current&&(N.current.textContent=t[0]),e.classList.add("error")):e.classList.remove("error")},L=e=>{B?.(e);const t=e.target;document.activeElement!==t&&H(t)},q=e=>{S?.(e);const t=e.target;((e=>{const{inputType:t}=e.nativeEvent;return!t||"insertReplacementText"===t||s(e.target)})(e)||t.classList.contains("error"))&&H(t)};r(()=>{const e=setTimeout(()=>{const e=E.current?.querySelector("input, textarea");e&&e.value&&s(e)&&H(e)},300);return()=>clearTimeout(e)},[]);const A="textarea"===b;return e("div",{ref:E,className:[u.n23mInput,"n23mInput",a].filter(Boolean).join(" "),...F,style:{...i({"--input-c":y,"--input-cb":I,"--input-minh":A?c(W):void 0,"--input-maxh":A?c(V):void 0}),...d},children:["hidden"!==x&&t(o,{mobileSize:14,desktopSize:14,tag:"label",fontWeight:400,color:v,htmlFor:"select"===b?z:m,children:f}),e("div",{className:u.n23mInputInput,children:["input"===b&&t("input",{ref:h,id:m,name:m,type:x,onBlur:L,onChange:q,placeholder:g,defaultValue:_,disabled:C,value:k,autoComplete:w,step:T}),"textarea"===b&&t("textarea",{autoComplete:w,id:m,name:m,onBlur:L,onChange:q,placeholder:g,defaultValue:_,disabled:C,value:k,ref:h}),"select"===b&&t("input",{id:z,autoComplete:"off",ref:h,type:x,onBlur:L,onChange:q,placeholder:g,defaultValue:_,disabled:C,value:k,step:T})]}),"hidden"!==x&&t(o,{ref:N,mobileSize:12,desktopSize:12,tag:"p",fontWeight:400,color:p.error,lineHeight:"14px",margin:"2px 0 2px"})]})};d.displayName="Input";export{d as I};
|
package/lib/Select/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{S as Select}from"../Select-
|
|
1
|
+
export{S as Select}from"../Select-ha0wdXL7.js";import"react/jsx-runtime";import"react";import"../Input-DcnNAaKr.js";import"../TextBox-__k4jPYK.js";import"../style-inject.es-CrVRO2OA.js";import"../validator/index.js";import"../validator.const-LBF9whmW.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as o}from"react/jsx-runtime";import{useState as t,useRef as n,useId as r,useMemo as l}from"react";import{I as a}from"./Input-
|
|
1
|
+
import{jsxs as e,jsx as o}from"react/jsx-runtime";import{useState as t,useRef as n,useId as r,useMemo as l}from"react";import{I as a}from"./Input-DcnNAaKr.js";import{s as i}from"./style-inject.es-CrVRO2OA.js";var s={n23mSelect:"Select-module_n23mSelect__awO8y",icon:"Select-module_icon__jzEHa",iconRotate:"Select-module_iconRotate__NvZVj",dropdownWrapper:"Select-module_dropdownWrapper__IUKRC",open:"Select-module_open__JxM1W",dropdown:"Select-module_dropdown__DZBqH",dropdownItem:"Select-module_dropdownItem__COzLI"};i('@layer n23mSelect{.Select-module_n23mSelect__awO8y{--iff:-apple-system,BlinkMacSystemFont,avenir next,avenir,segoe ui,helvetica neue,helvetica,Cantarell,Ubuntu,roboto,noto,arial,sans-serif;position:relative;& input{cursor:pointer;padding-right:40px}.Select-module_icon__jzEHa{-webkit-touch-callout:none;-webkit-tap-highlight-color:rgba(0,0,0,0);background:url(\'data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" xml:space="preserve"><g style="stroke:none;stroke-width:1px;fill-rule:nonzero;opacity:1"><path d="M90 24.25a3.499 3.499 0 0 0-5.974-2.475L45 60.8 5.975 21.775a3.5 3.5 0 1 0-4.95 4.95l41.5 41.5a3.499 3.499 0 0 0 4.949 0l41.5-41.5A3.487 3.487 0 0 0 90 24.25z" style="stroke:none;stroke-width:1" transform="matrix(2.81 0 0 2.81 1.407 1.407)"/></g></svg>\') no-repeat 100%;background-position:calc(100% - 10px) 50%;background-size:18px;cursor:pointer;display:inline-block;height:40px;position:absolute;right:2px;top:22px;transform:rotate(0deg);transition:transform .1s ease-in-out;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:40px;&.Select-module_iconRotate__NvZVj{transform:rotate(180deg);transition:transform .1s ease-in-out}}.Select-module_dropdownWrapper__IUKRC{corner-shape:squircle;background:transparent;border-radius:12px;display:none;margin-top:65px;padding-bottom:40px;position:absolute;top:0;width:100%;z-index:3;&.Select-module_open__JxM1W{display:block}.Select-module_dropdown__DZBqH{corner-shape:squircle;-webkit-touch-callout:none;-webkit-tap-highlight-color:rgba(0,0,0,0);background:#fff;border-radius:12px;box-shadow:0 4px 8px 0 rgba(0,0,0,.24),0 6px 20px 0 rgba(0,0,0,.19);cursor:pointer;max-height:180px;overflow-y:auto;overscroll-behavior:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;&:has(.Select-module_dropdownItem__COzLI){border:1px solid var(--input-cb,#000)}.Select-module_dropdownItem__COzLI{background:#fff;border-bottom:1px solid var(--input-cb,#000);box-sizing:border-box;color:var(--input-c,#000);font-family:var(--n23mFontFamily,var(--iff));font-size:16px;font-weight:500;padding:10px;width:100%;&:hover{background-color:#f5f5f5}&:not(:first-child){border-top:none}&:last-child{border-bottom:unset}}}}}}');const d=({className:i,name:d,disabled:p,style:c,options:u,initialValue:m,validatorOptions:b,placeholder:h,onBlur:_,label:x="Select",...g})=>{const[v,w]=t(m?.label??""),[f,k]=t(m?.value??""),[S,y]=t(!1),[I,z]=t(!1),j=n(null),C=r(),O=l(()=>I?u.filter(e=>e.label.toLowerCase().includes(v.toLowerCase())):u,[u,v,I]);return e("div",{className:[s.n23mSelect,"n23mSelect",i].filter(Boolean).join(" "),...g,style:{...c},children:[o("div",{className:[s.icon,S?s.iconRotate:""].join(" "),onMouseDown:e=>{e.preventDefault(),j.current?.focus(),p||(z(!1),y(e=>!e))}}),o(a,{name:d,type:"hidden",kind:"input",validatorOptions:[...b??[],{type:"existsInOptions",options:{options:u,matchBy:"value"}}],value:f}),o(a,{id:C,inputRef:j,label:x,type:"text",kind:"select",disabled:p,placeholder:h,value:v,onChange:e=>{const o=e.currentTarget.value;w(o),k(""),z(!0),y(!0)},onClick:()=>{p||(z(!1),y(!0))},onBlur:e=>{y(!1),z(!1),_?.(e,{value:f,label:v})},validatorOptions:[...b??[],{type:"existsInOptions",options:{options:u,matchBy:"label"}}],"aria-autocomplete":"list","aria-expanded":S,"aria-controls":`${d}-listbox`,role:"combobox"}),o("div",{className:[s.dropdownWrapper,S?s.open:""].join(" "),children:o("div",{className:[s.dropdown].join(" "),children:O.map(e=>o("div",{className:s.dropdownItem,onMouseDown:()=>{(e=>{k(e.value),w(e.label),z(!1),y(!1)})(e)},children:e.label},e.value))})})]})};export{d as S};
|
|
@@ -9,8 +9,8 @@ type TableColumnBase = {
|
|
|
9
9
|
disabledAdd?: boolean;
|
|
10
10
|
disabledEdit?: boolean;
|
|
11
11
|
validatorOptions?: ValidatorOptions;
|
|
12
|
-
thAlign?: 'left' | 'right';
|
|
13
|
-
tdAlign?: 'left' | 'right';
|
|
12
|
+
thAlign?: 'left' | 'right' | 'center';
|
|
13
|
+
tdAlign?: 'left' | 'right' | 'center';
|
|
14
14
|
};
|
|
15
15
|
export type TableColumn = (TableColumnBase & {
|
|
16
16
|
cellType: 'select';
|
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 a}from"react";import{B as i}from"../Button-CUxVuy6N.js";import{C as o}from"../Calendar-
|
|
1
|
+
import{jsxs as e,jsx as l,Fragment as t}from"react/jsx-runtime";import{useState as a}from"react";import{B as i}from"../Button-CUxVuy6N.js";import{C as o}from"../Calendar-8yUJpiJE.js";import{D as n}from"../Dialog-DzjlW8ZU.js";import{F as r}from"../Form-GEUDMZ7Z.js";import{G as d}from"../Grid-DmI4tqqG.js";import{I as s}from"../Input-DcnNAaKr.js";import{L as c}from"../LoaderDots-BoEg_zlZ.js";import{S as p}from"../Select-ha0wdXL7.js";import{T as m}from"../TextBox-__k4jPYK.js";import{T as b}from"../Typography-CR1DOKsN.js";import{s as h,g}from"../style-inject.es-CrVRO2OA.js";import{V as u}from"../validator.const-LBF9whmW.js";import"../IconLocate-BXomEqkx.js";import"../Loader-ZYEBOkbx.js";import"../validator/index.js";var f={n23mTable:"Table-module_n23mTable__kKVd9",table:"Table-module_table__hJFsY",loadingCell:"Table-module_loadingCell__mIX-P",loadingInner:"Table-module_loadingInner__GlNjv"};h('@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]{-webkit-touch-callout:none;-webkit-tap-highlight-color:rgba(0,0,0,0);cursor:pointer;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.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:h,jsonSchema:x,jsonData:_,cellEdit:v,cellDelete:y,onCellReset:T,isLoading:k=!1,style:S,tableLoadingHeight:C,...j})=>{const[z,w]=a(!1),[N,E]=a(!1),[D,M]=a(0),[F,I]=a(null),{onCellEdit:Y,isCellEditError:J=!1,isCellEditPending:O=!1,isCellEditSuccess:V=!1,cellEditErrorMsg:W,cellEditSuccessMsg:P}=v??{},{onCellDelete:B,isCellDeleteError:L=!1,isCellDeletePending:A=!1,isCellDeleteSuccess:G=!1,cellDeleteErrorMsg:X,cellDeleteSuccessMsg:K}=y??{},R=Boolean(Y),H=Boolean(B),q=x.cols.filter(e=>"id"!==e.cellName),Q=()=>{T&&setTimeout(()=>T(),300)},U=()=>{E(!1),Q()},Z=()=>{E(!1),w(!1),Q()};return e("div",{className:[f.n23mTable,"n23mTable",h].filter(Boolean).join(" "),...j,style:{...g({"--table-loading-height":C}),...S},children:[R&&l(n,{open:z,onCancel:()=>{w(!1),Q()},widthMax:"900px",children:e(d,{layout:"container",widthMin:"min(800px, calc(100vw - 25px))",padding:"0px 30px 30px 30px",margin:"auto",children:[l(b,{appearance:"light",variant:"subheading",tag:"h2",style:{margin:"0 0 20px 0"},children:"Edit Cell"}),e(r,{onSubmit:e=>{if(!Y)return;if(Object.values(e).some(({error:e})=>e))return;const l=Object.fromEntries(Object.entries(e).map(([e,{value:l}])=>[e,l]));Y(l)},isError:J,isPending:O,isSuccess:V,errorMsg:W,successMsg:P,children:[l(d,{layout:"columns",col:{smallDesktop:2},gap:{col:"20px"},children:F&&x.cols.map(e=>{const t=F[e.cellName];if("date"===e.cellType){const a=t||e.initialValue;return l(o,{label:e.cellText,name:e.cellName,disabled:e.disabledEdit,initialValue:a,placeholder:e.cellText,validatorOptions:e.validatorOptions},e.cellName)}if("select"===e.cellType){const a=e.options.find(e=>e.value===String(t??""))??e.initialValue;return l(p,{name:e.cellName,options:e.options,disabled:e.disabledEdit,initialValue:a,validatorOptions:e.validatorOptions},e.cellName)}return l(s,{label:e.cellText,name:e.cellName,type:e.cellType,step:"number"===e.cellType?.01:void 0,defaultValue:String(t??""),disabled:e.disabledEdit,placeholder:e.cellText,validatorOptions:e.validatorOptions},e.cellName)})}),e(d,{layout:"flex",widthMax:"100%",padding:"0",justifyContent:H?"space-between":"flex-end",alignItems:"right",margin:"20px 0 0 0",children:[H&&l(i,{type:"button",variant:"danger",disabled:O||A,onClick:()=>{H&&F&&E(!0)},children:l(m,{tag:"span",desktopSize:16,mobileSize:16,fontWeight:400,color:"inherit",children:"Delete"})}),l(i,{type:"submit",variant:"primary",disabled:O||A,children:l(m,{tag:"span",desktopSize:16,mobileSize:16,fontWeight:400,color:"inherit",children:"Save changes"})})]})]},D)]})}),H&&l(n,{open:N,onCancel:G?Z:U,widthMax:"900px",children:e(d,{layout:"container",widthMin:"min(500px, calc(100vw - 25px))",padding:"0px 30px 30px 30px",margin:"auto",children:[l(b,{appearance:"light",variant:"subheading",tag:"h2",style:{margin:"0 0 20px 0"},children:G?"Deleted":"Are you sure?"}),!G&&l(b,{variant:"body",tag:"p",desktopSize:16,mobileSize:16,fontWeight:400,children:"This row will be permanently deleted. This action cannot be undone."}),L&&!G&&l(b,{variant:"body",tag:"p",desktopSize:16,mobileSize:16,fontWeight:400,color:u.error,style:{margin:"10px 0 0 0"},children:X??"Delete failed"}),G&&l(b,{variant:"body",tag:"p",desktopSize:16,mobileSize:16,fontWeight:400,color:u.success,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(i,{type:"button",variant:"success",onClick:Z,children:l(m,{tag:"span",desktopSize:16,mobileSize:16,fontWeight:400,color:"inherit",children:"Close"})}):e(t,{children:[l(i,{type:"button",variant:"secondary",disabled:A,onClick:U,children:l(m,{tag:"span",desktopSize:16,mobileSize:16,fontWeight:400,color:"inherit",children:"Cancel"})}),l(i,{type:"button",variant:"danger",disabled:A,onClick:()=>{B&&F&&B(F.id)},children:l(m,{tag:"span",desktopSize:16,mobileSize:16,fontWeight:400,color:"inherit",children:"Yes, delete"})})]})})]})}),e("table",{className:f.table,"aria-busy":k,children:[l("thead",{children:l("tr",{children:q.map(e=>l("th",{scope:"col",children:l(m,{mobileSize:16,desktopSize:20,color:"black",textAlign:e.thAlign??"left",children:e.cellText})},e.cellName))})}),l("tbody",{children:k?l("tr",{children:l("td",{className:f.loadingCell,colSpan:Math.max(q.length,1),children:l("div",{className:f.loadingInner,children:l(c,{})})})}):_.rows.map(e=>l("tr",{children:q.map(t=>{const a=e[t.cellName];return l("td",{"data-clickable":R,onClick:R?()=>(e=>{I(e),w(!0),M(e=>e+1)})(e):void 0,children:l(m,{fontWeight:400,mobileSize:16,desktopSize:16,color:"black",textAlign:t.tdAlign??"left",children:void 0===a?"":String(a)})},t.cellName)})},e.id))})]})]})};x.displayName="Table";export{x as Table};
|
package/package.json
CHANGED
package/lib/Input-BJj54qdT.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useRef as n,useEffect as r}from"react";import{T as o}from"./TextBox-__k4jPYK.js";import{s as a,g as i}from"./style-inject.es-CrVRO2OA.js";import{validator as l}from"./validator/index.js";import{V as p}from"./validator.const-LBF9whmW.js";var u={n23mInput:"Input-module_n23mInput__6WopW",n23mInputInput:"Input-module_n23mInputInput__djmAy"};a("@layer n23mInput{.Input-module_n23mInput__6WopW{--iff:-apple-system,BlinkMacSystemFont,avenir next,avenir,segoe ui,helvetica neue,helvetica,Cantarell,Ubuntu,roboto,noto,arial,sans-serif;margin-top:0;&:not(:has(input[type=hidden])){margin-bottom:10px}.Input-module_n23mInputInput__djmAy{display:grid;& input,& textarea{corner-shape:squircle;border:1px solid var(--input-cb,#000);border-radius:12px;box-sizing:border-box;color:var(--input-c,#000);font-family:var(--n23mFontFamily,var(--iff));font-size:16px;font-weight:500;&:disabled{-webkit-text-fill-color:#8a8a8a;background-color:#f3f3f3;border-color:#cfcfcf;color:#8a8a8a;cursor:not-allowed;opacity:1}}& input{height:40px;padding:20px 10px;width:100%}& textarea{field-sizing:content;block-size:100%;max-height:400px;min-height:200px;padding:10px;resize:vertical}&input[type=hidden]{margin:0;padding:0}& ::placeholder{filter:brightness(125%);font-weight:300}}.Input-module_n23mInputError__0yrzG{color:var(--najwer23snacks-input-error-font-color);font-family:var(--najwer23snacks-input-error-font-family);font-size:var(--najwer23snacks-input-error-font-size);font-weight:var(--najwer23snacks-input-error-font-weight);line-height:1;margin:2px}}}");const s=e=>{for(const t of[":autofill",":-webkit-autofill"])try{if(e.matches(t))return!0}catch{}return!1},c=({className:a,style:c,name:d,label:m,inputRef:f,placeholder:h,type:g="text",labelColor:x="black",kind:v="input",inputColor:b,inputColorBorder:y,defaultValue:I,disabled:_,validatorOptions:C,value:j,autoComplete:k,id:w,onBlur:z,onChange:B,step:S,...T})=>{const W=n(null),V=n(null),F=e=>{if(W.current&&(W.current.textContent=""),!C)return;const t=l(e.value,C);t.length>0?(W.current&&(W.current.textContent=t[0]),e.classList.add("error")):e.classList.remove("error")},N=e=>{z?.(e);const t=e.target;document.activeElement!==t&&F(t)},E=e=>{B?.(e);const t=e.target;((e=>{const{inputType:t}=e.nativeEvent;return!t||"insertReplacementText"===t||s(e.target)})(e)||t.classList.contains("error"))&&F(t)};return r(()=>{const e=setTimeout(()=>{const e=V.current?.querySelector("input, textarea");e&&e.value&&s(e)&&F(e)},300);return()=>clearTimeout(e)},[]),e("div",{ref:V,className:[u.n23mInput,"n23mInput",a].filter(Boolean).join(" "),...T,style:{...i({"--input-c":b,"--input-cb":y}),...c},children:["hidden"!==g&&t(o,{mobileSize:14,desktopSize:14,tag:"label",fontWeight:400,color:x,htmlFor:"select"===v?w:d,children:m}),e("div",{className:u.n23mInputInput,children:["input"===v&&t("input",{ref:f,id:d,name:d,type:g,onBlur:N,onChange:E,placeholder:h,defaultValue:I,disabled:_,value:j,autoComplete:k,step:S}),"textarea"===v&&t("textarea",{autoComplete:k,id:d,name:d,onBlur:N,onChange:E,placeholder:h,defaultValue:I,disabled:_,value:j,ref:f}),"select"===v&&t("input",{id:w,autoComplete:"off",ref:f,type:g,onBlur:N,onChange:E,placeholder:h,defaultValue:I,disabled:_,value:j,step:S})]}),"hidden"!==g&&t(o,{ref:W,mobileSize:12,desktopSize:12,tag:"p",fontWeight:400,color:p.error,lineHeight:"14px",margin:"2px 0 2px"})]})};c.displayName="Input";export{c as I};
|