@dgshahr/ui-kit 1.0.0 → 1.0.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/dist/Form/Datepicker/Days.d.ts.map +1 -1
- package/dist/Form/Datepicker/index.cjs +1 -1
- package/dist/Form/Datepicker/index.mjs +24 -24
- package/dist/Form/Select/Options.d.ts.map +1 -1
- package/dist/Form/Select/index.cjs +1 -1
- package/dist/Form/Select/index.mjs +103 -115
- package/dist/{PickerWrapper-Kka0j3TV.js → PickerWrapper-BN0-64XB.js} +1 -1
- package/dist/{PickerWrapper-lyNHGQj6.cjs → PickerWrapper-_6_IfT-v.cjs} +1 -1
- package/dist/Tooltip/index.cjs +1 -1
- package/dist/Tooltip/index.mjs +1 -1
- package/dist/useFlipPosition-BWxiBDQ_.js +124 -0
- package/dist/useFlipPosition-CWhLgzoz.cjs +1 -0
- package/package.json +1 -1
- package/dist/useFlipPosition-CLwjhe7O.cjs +0 -1
- package/dist/useFlipPosition-pGmVUUhs.js +0 -133
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Days.d.ts","sourceRoot":"","sources":["../../../src/components/Form/Datepicker/Days.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAyFhC,QAAA,MAAM,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"Days.d.ts","sourceRoot":"","sources":["../../../src/components/Form/Datepicker/Days.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAyFhC,QAAA,MAAM,IAAI,EAAE,EAuCX,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require('../../assets/styles.css');const d=require("react/jsx-runtime"),z=require("../../clsx-C11secjj.cjs"),q=require("react"),I=require("../../Button/index.cjs"),gt=require("../../PickerWrapper-lyNHGQj6.cjs"),Wt=require("../../IconArrowDown2-C1dLVveG.cjs"),vt=require("../../IconArrowLeft2-CNA3H0xY.cjs"),Nt=require("../../IconArrowRight2-CF_bdH81.cjs");;/* empty css */const St={lessThanXSeconds:{one:"کمتر از یک ثانیه",other:"کمتر از {{count}} ثانیه"},xSeconds:{one:"1 ثانیه",other:"{{count}} ثانیه"},halfAMinute:"نیم دقیقه",lessThanXMinutes:{one:"کمتر از یک دقیقه",other:"کمتر از {{count}} دقیقه"},xMinutes:{one:"1 دقیقه",other:"{{count}} دقیقه"},aboutXHours:{one:"حدود 1 ساعت",other:"حدود {{count}} ساعت"},xHours:{one:"1 ساعت",other:"{{count}} ساعت"},xDays:{one:"1 روز",other:"{{count}} روز"},aboutXWeeks:{one:"حدود 1 هفته",other:"حدود {{count}} هفته"},xWeeks:{one:"1 هفته",other:"{{count}} هفته"},aboutXMonths:{one:"حدود 1 ماه",other:"حدود {{count}} ماه"},xMonths:{one:"1 ماه",other:"{{count}} ماه"},aboutXYears:{one:"حدود 1 سال",other:"حدود {{count}} سال"},xYears:{one:"1 سال",other:"{{count}} سال"},overXYears:{one:"بیشتر از 1 سال",other:"بیشتر از {{count}} سال"},almostXYears:{one:"نزدیک 1 سال",other:"نزدیک {{count}} سال"}},Yt=(t,e,n)=>{let r;const i=St[t];return typeof i=="string"?r=i:e===1?r=i.one:r=i.other.replace("{{count}}",e.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"در "+r:r+" قبل":r};function A(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const Tt={full:"EEEE do MMMM y",long:"do MMMM y",medium:"d MMM y",short:"yyyy/MM/dd"},Ct={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},jt={full:"{{date}} 'در' {{time}}",long:"{{date}} 'در' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Et={date:A({formats:Tt,defaultWidth:"full"}),time:A({formats:Ct,defaultWidth:"full"}),dateTime:A({formats:jt,defaultWidth:"full"})},Ft={lastWeek:"eeee 'گذشته در' p",yesterday:"'دیروز در' p",today:"'امروز در' p",tomorrow:"'فردا در' p",nextWeek:"eeee 'در' p",other:"P"},_t=(t,e,n,r)=>Ft[t];function T(t){return(e,n)=>{const r=n?.context?String(n.context):"standalone";let i;if(r==="formatting"&&t.formattingValues){const a=t.defaultFormattingWidth||t.defaultWidth,c=n?.width?String(n.width):a;i=t.formattingValues[c]||t.formattingValues[a]}else{const a=t.defaultWidth,c=n?.width?String(n.width):t.defaultWidth;i=t.values[c]||t.values[a]}const s=t.argumentCallback?t.argumentCallback(e):e;return i[s]}}const qt={narrow:["ق","ب"],abbreviated:["ق.ه.","ب.ه."],wide:["قبل از هجرت","بعد از هجرت"]},It={narrow:["1","2","3","4"],abbreviated:["سم1","سم2","سم3","سم4"],wide:["سهماهه 1","سهماهه 2","سهماهه 3","سهماهه 4"]},Ht={narrow:["فر","ار","خر","تی","مر","شه","مه","آب","آذ","دی","به","اس"],abbreviated:["فرو","ارد","خرد","تیر","مرد","شهر","مهر","آبا","آذر","دی","بهم","اسف"],wide:["فروردین","اردیبهشت","خرداد","تیر","مرداد","شهریور","مهر","آبان","آذر","دی","بهمن","اسفند"]},$t={narrow:["ی","د","س","چ","پ","ج","ش"],short:["1ش","2ش","3ش","4ش","5ش","ج","ش"],abbreviated:["یکشنبه","دوشنبه","سهشنبه","چهارشنبه","پنجشنبه","جمعه","شنبه"],wide:["یکشنبه","دوشنبه","سهشنبه","چهارشنبه","پنجشنبه","جمعه","شنبه"]},Rt={narrow:{am:"ق",pm:"ب",midnight:"ن",noon:"ظ",morning:"ص",afternoon:"ب.ظ.",evening:"ع",night:"ش"},abbreviated:{am:"ق.ظ.",pm:"ب.ظ.",midnight:"نیمهشب",noon:"ظهر",morning:"صبح",afternoon:"بعدازظهر",evening:"عصر",night:"شب"},wide:{am:"قبلازظهر",pm:"بعدازظهر",midnight:"نیمهشب",noon:"ظهر",morning:"صبح",afternoon:"بعدازظهر",evening:"عصر",night:"شب"}},Lt={narrow:{am:"ق",pm:"ب",midnight:"ن",noon:"ظ",morning:"ص",afternoon:"ب.ظ.",evening:"ع",night:"ش"},abbreviated:{am:"ق.ظ.",pm:"ب.ظ.",midnight:"نیمهشب",noon:"ظهر",morning:"صبح",afternoon:"بعدازظهر",evening:"عصر",night:"شب"},wide:{am:"قبلازظهر",pm:"بعدازظهر",midnight:"نیمهشب",noon:"ظهر",morning:"صبح",afternoon:"بعدازظهر",evening:"عصر",night:"شب"}},Bt=(t,e)=>Number(t)+"-ام",Xt={ordinalNumber:Bt,era:T({values:qt,defaultWidth:"wide"}),quarter:T({values:It,defaultWidth:"wide",argumentCallback:t=>t-1}),month:T({values:Ht,defaultWidth:"wide"}),day:T({values:$t,defaultWidth:"wide"}),dayPeriod:T({values:Rt,defaultWidth:"wide",formattingValues:Lt,defaultFormattingWidth:"wide"})};function C(t){return(e,n={})=>{const r=n.width,i=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],s=e.match(i);if(!s)return null;const a=s[0],c=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],o=Array.isArray(c)?Gt(c,g=>g.test(a)):Qt(c,g=>g.test(a));let h;h=t.valueCallback?t.valueCallback(o):o,h=n.valueCallback?n.valueCallback(h):h;const u=e.slice(a.length);return{value:h,rest:u}}}function Qt(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function Gt(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return n}function At(t){return(e,n={})=>{const r=e.match(t.matchPattern);if(!r)return null;const i=r[0],s=e.match(t.parsePattern);if(!s)return null;let a=t.valueCallback?t.valueCallback(s[0]):s[0];a=n.valueCallback?n.valueCallback(a):a;const c=e.slice(i.length);return{value:a,rest:c}}}const Vt=/^(\d+)(-?ام)?/i,zt=/\d+/i,Kt={narrow:/^(ق|ب)/i,abbreviated:/^(ق\.?\s?ه\.?|ب\.?\s?ه\.?|ه\.?)/i,wide:/^(قبل از هجرت|هجری شمسی|بعد از هجرت)/i},Ut={any:[/^قبل/i,/^بعد/i]},Jt={narrow:/^[1234]/i,abbreviated:/^(ف|Q|سم)[1234]/i,wide:/^(فصل|quarter|سهماهه) [1234](-ام|ام)?/i},Zt={any:[/1/i,/2/i,/3/i,/4/i]},te={narrow:/^(فر|ار|خر|تی|مر|شه|مه|آب|آذ|دی|به|اس)/i,abbreviated:/^(فرو|ارد|خرد|تیر|مرد|شهر|مهر|آبا|آذر|دی|بهم|اسف)/i,wide:/^(فروردین|اردیبهشت|خرداد|تیر|مرداد|شهریور|مهر|آبان|آذر|دی|بهمن|اسفند)/i},ee={narrow:[/^فر/i,/^ار/i,/^خر/i,/^تی/i,/^مر/i,/^شه/i,/^مه/i,/^آب/i,/^آذ/i,/^دی/i,/^به/i,/^اس/i],any:[/^فر/i,/^ار/i,/^خر/i,/^تی/i,/^مر/i,/^شه/i,/^مه/i,/^آب/i,/^آذ/i,/^دی/i,/^به/i,/^اس/i]},ne={narrow:/^[شیدسچپج]/i,short:/^(ش|ج|1ش|2ش|3ش|4ش|5ش)/i,abbreviated:/^(یکشنبه|دوشنبه|سهشنبه|چهارشنبه|پنجشنبه|جمعه|شنبه)/i,wide:/^(یکشنبه|دوشنبه|سهشنبه|چهارشنبه|پنجشنبه|جمعه|شنبه)/i},re={narrow:[/^ی/i,/^دو/i,/^س/i,/^چ/i,/^پ/i,/^ج/i,/^ش/i],any:[/^(ی|1ش|یکشنبه)/i,/^(د|2ش|دوشنبه)/i,/^(س|3ش|سهشنبه)/i,/^(چ|4ش|چهارشنبه)/i,/^(پ|5ش|پنجشنبه)/i,/^(ج|جمعه)/i,/^(ش|شنبه)/i]},ie={narrow:/^(ب|ق|ن|ظ|ص|ب.ظ.|ع|ش)/i,any:/^(ق.ظ.|ب.ظ.|قبلازظهر|نیمهشب|ظهر|صبح|بعدازظهر|عصر|شب)/i},se={any:{am:/^(ق|ق.ظ.|قبلازظهر)/i,pm:/^(ب|ب.ظ.|بعدازظهر)/i,midnight:/^(نیمهشب|ن)/i,noon:/^(ظ|ظهر)/i,morning:/^(ص|صبح)/i,afternoon:/^(ب|ب.ظ.|بعدازظهر)/i,evening:/^(ع|عصر)/i,night:/^(ش|شب)/i}},ae={ordinalNumber:At({matchPattern:Vt,parsePattern:zt,valueCallback:t=>parseInt(t,10)}),era:C({matchPatterns:Kt,defaultMatchWidth:"wide",parsePatterns:Ut,defaultParseWidth:"any"}),quarter:C({matchPatterns:Jt,defaultMatchWidth:"wide",parsePatterns:Zt,defaultParseWidth:"any",valueCallback:t=>t+1}),month:C({matchPatterns:te,defaultMatchWidth:"wide",parsePatterns:ee,defaultParseWidth:"any"}),day:C({matchPatterns:ne,defaultMatchWidth:"wide",parsePatterns:re,defaultParseWidth:"any"}),dayPeriod:C({matchPatterns:ie,defaultMatchWidth:"any",parsePatterns:se,defaultParseWidth:"any"})},oe={code:"fa-IR",formatDistance:Yt,formatLong:Et,formatRelative:_t,localize:Xt,match:ae,options:{weekStartsOn:6,firstWeekContainsDate:1}};let ce={};function E(){return ce}const mt=6048e5,ue=864e5,ot=Symbol.for("constructDateFrom"),yt=1948320,wt=[0,31,62,93,124,155,186,216,246,276,306,336];function N(t,e,n){return fe(le(t,e,n))}function Q(t,e,n){return he(de(t,e,n))}function de(t,e,n){const[r,i]=kt(t,e);t=r,e=i;const s=e-1,a=t,c=n;let o=yt-1+365*(a-1)+y(8*a+21,33);return s!=0&&(o+=wt[s]),o+c}function fe(t){if(isNaN(t))return{jy:NaN,jm:NaN,jd:NaN};let e,n;const r=t-yt;let i=1+y(33*r+3,12053);n=r-(365*(i-1)+y(8*i+21,33)),n<0&&(i--,n=r-(365*(i-1)+y(8*i+21,33))),n<216?e=y(n,31):e=y(n-6,30);const s=n-wt[e]+1;n++;const a=i,c=e+1;return{jy:a,jm:c,jd:s}}function le(t,e,n){const[r,i]=kt(t,e);return t=r,e=i,y(1461*(t+4800+y(e-14,12)),4)+y(367*(e-2-12*y(e-14,12)),12)-y(3*y(t+4900+y(e-14,12),100),4)+n-32075}function he(t){if(isNaN(t))return{gy:NaN,gm:NaN,gd:NaN};let e=t+68569;const n=y(4*e,146097);e=e-y(146097*n+3,4);const r=y(4e3*(e+1),1461001);e=e-y(1461*r,4)+31;const i=y(80*e,2447),s=e-y(2447*i,80);e=y(i,11);const a=i+2-12*e;return{gy:100*(n-49)+r+e,gm:a,gd:s}}function kt(t,e){if(e=e-1,e<0){const n=e;e=ge(e,12),t-=y(e-n,12)}return e>11&&(t+=y(e,12),e=K(e,12)),[t,e+1]}function y(t,e){return~~(t/e)}function K(t,e){return t-~~(t/e)*e}function ge(t,e){return K(K(t,e)+e,e)}function me(...t){if(t.length>1){const[e,n,r=1,...i]=t,s=Q(e,n+1,r);return new Date(s.gy,s.gm-1,s.gd,...i)}return new Date(...t)}function w(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&ot in t?t[ot](e):t instanceof Date?new t.constructor(e):me(e)}function l(t,e){return w(e||t,t)}function ct(t){const e=l(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function F(t,...e){const n=w.bind(null,e.find(r=>typeof r=="object"));return e.map(n)}function H(t,e){const n=l(t,e?.in);return n.setHours(0,0,0,0),n}function ye(t,e,n){const[r,i]=F(n?.in,t,e),s=H(r),a=H(i),c=+s-ct(s),o=+a-ct(a);return Math.round((c-o)/ue)}function k(t){const e=t.getDate(),n=t.getMonth()+1,r=t.getFullYear();return N(r,n,e).jy}function M(t,...e){const n=t.getDate(),r=t.getMonth()+1,i=t.getFullYear(),s=N(i,r,n),[a,c=s.jm-1,o=s.jd]=e,h=Q(a,c+1,o);return t.setFullYear(h.gy,h.gm-1,h.gd)}function J(t,e){const n=l(t,e?.in);return M(n,k(n),0,1),n.setHours(0,0,0,0),n}function we(t,e){const n=l(t,e?.in);return ye(n,J(n))+1}function P(t){const e=t.getDate(),n=t.getMonth()+1,r=t.getFullYear();return N(r,n,e).jd}function S(t,...e){const n=t.getDate(),r=t.getMonth()+1,i=t.getFullYear(),s=N(i,r,n),[a]=e,c=Q(s.jy,s.jm,a);return t.setFullYear(c.gy,c.gm-1,c.gd)}function v(t,e){const n=E(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??6,i=l(t,e?.in),s=i.getDay(),a=(s<r?7:0)+s-r;return S(i,P(i)-a),i.setHours(0,0,0,0),i}function $(t,e){return v(t,{...e,weekStartsOn:1})}function pt(t,e){const n=l(t,e?.in),r=n.getFullYear(),i=w(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);const s=$(i),a=w(n,0);a.setFullYear(r,0,4),a.setHours(0,0,0,0);const c=$(a);return n.getTime()>=s.getTime()?r+1:n.getTime()>=c.getTime()?r:r-1}function ke(t,e){const n=pt(t,e),r=w(t,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),$(r)}function pe(t,e){const n=l(t,e?.in),r=+$(n)-+ke(n);return Math.round(r/mt)+1}function bt(t,e){const n=l(t,e?.in),r=k(n),i=E(),s=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,a=w(e?.in||t,0);M(a,r+1,0,s),a.setHours(0,0,0,0);const c=v(a,e),o=w(e?.in||t,0);M(o,r,0,s),o.setHours(0,0,0,0);const h=v(o,e);return+n>=+c?r+1:+n>=+h?r:r-1}function be(t,e){const n=E(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=bt(t,e),s=w(e?.in||t,0);return M(s,i,0,r),s.setHours(0,0,0,0),v(s,e)}function xe(t,e){const n=l(t,e?.in),r=+v(n,e)-+be(n,e);return Math.round(r/mt)+1}function f(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}function p(t){const e=t.getDate(),n=t.getMonth()+1,r=t.getFullYear();return N(r,n,e).jm-1}const x={y(t,e){const n=k(t),r=n>0?n:1-n;return f(e==="yy"?r%100:r,e.length)},M(t,e){const n=p(t);return e==="M"?String(n+1):f(n+1,2)},d(t,e){return f(P(t),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(t,e){return f(t.getHours()%12||12,e.length)},H(t,e){return f(t.getHours(),e.length)},m(t,e){return f(t.getMinutes(),e.length)},s(t,e){return f(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),i=Math.trunc(r*Math.pow(10,n-3));return f(i,e.length)}},W={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},ut={G:function(t,e,n){const r=k(t)>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const r=k(t),i=r>0?r:1-r;return n.ordinalNumber(i,{unit:"year"})}return x.y(t,e)},Y:function(t,e,n,r){const i=bt(t,r),s=i>0?i:1-i;if(e==="YY"){const a=s%100;return f(a,2)}return e==="Yo"?n.ordinalNumber(s,{unit:"year"}):f(s,e.length)},R:function(t,e){const n=pt(t);return f(n,e.length)},u:function(t,e){const n=k(t);return f(n,e.length)},Q:function(t,e,n){const r=Math.ceil((p(t)+1)/3);switch(e){case"Q":return String(r);case"QQ":return f(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){const r=Math.ceil((p(t)+1)/3);switch(e){case"q":return String(r);case"qq":return f(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){const r=p(t);switch(e){case"M":case"MM":return x.M(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){const r=p(t);switch(e){case"L":return String(r+1);case"LL":return f(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){const i=xe(t,r);return e==="wo"?n.ordinalNumber(i,{unit:"week"}):f(i,e.length)},I:function(t,e,n){const r=pe(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):f(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(P(t),{unit:"date"}):x.d(t,e)},D:function(t,e,n){const r=we(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):f(r,e.length)},E:function(t,e,n){const r=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){const i=t.getDay(),s=(i-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(s);case"ee":return f(s,2);case"eo":return n.ordinalNumber(s,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});case"eeee":default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){const i=t.getDay(),s=(i-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(s);case"cc":return f(s,e.length);case"co":return n.ordinalNumber(s,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});case"cccc":default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(t,e,n){const r=t.getDay(),i=r===0?7:r;switch(e){case"i":return String(i);case"ii":return f(i,e.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){const i=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(t,e,n){const r=t.getHours();let i;switch(r===12?i=W.noon:r===0?i=W.midnight:i=r/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(t,e,n){const r=t.getHours();let i;switch(r>=17?i=W.evening:r>=12?i=W.afternoon:r>=4?i=W.morning:i=W.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let r=t.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return x.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):x.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):f(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):f(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):x.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):x.s(t,e)},S:function(t,e){return x.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return ft(r);case"XXXX":case"XX":return D(r);case"XXXXX":case"XXX":default:return D(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return ft(r);case"xxxx":case"xx":return D(r);case"xxxxx":case"xxx":default:return D(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+dt(r,":");case"OOOO":default:return"GMT"+D(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+dt(r,":");case"zzzz":default:return"GMT"+D(r,":")}},t:function(t,e,n){const r=Math.trunc(+t/1e3);return f(r,e.length)},T:function(t,e,n){return f(+t,e.length)}};function dt(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),i=Math.trunc(r/60),s=r%60;return s===0?n+String(i):n+String(i)+e+f(s,2)}function ft(t,e){return t%60===0?(t>0?"-":"+")+f(Math.abs(t)/60,2):D(t,e)}function D(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),i=f(Math.trunc(r/60),2),s=f(r%60,2);return n+i+e+s}const lt=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},xt=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},Me=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return lt(t,e);let s;switch(r){case"P":s=e.dateTime({width:"short"});break;case"PP":s=e.dateTime({width:"medium"});break;case"PPP":s=e.dateTime({width:"long"});break;case"PPPP":default:s=e.dateTime({width:"full"});break}return s.replace("{{date}}",lt(r,e)).replace("{{time}}",xt(i,e))},Pe={p:xt,P:Me},Oe=/^D+$/,De=/^Y+$/,We=["D","DD","YY","YYYY"];function ve(t){return Oe.test(t)}function Ne(t){return De.test(t)}function Se(t,e,n){const r=Ye(t,e,n);if(console.warn(r),We.includes(t))throw new RangeError(r)}function Ye(t,e,n){const r=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}function Te(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function Ce(t){return!(!Te(t)&&typeof t!="number"||isNaN(+l(t)))}const je=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Ee=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Fe=/^'([^]*?)'?$/,_e=/''/g,qe=/[a-zA-Z]/;function b(t,e,n){const r=E(),i=r.locale??oe,s=r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,a=r.weekStartsOn??r.locale?.options?.weekStartsOn??6,c=l(t,n?.in);if(!Ce(c))throw new RangeError("Invalid time value");let o=e.match(Ee).map(u=>{const g=u[0];if(g==="p"||g==="P"){const O=Pe[g];return O(u,i.formatLong)}return u}).join("").match(je).map(u=>{if(u==="''")return{isToken:!1,value:"'"};const g=u[0];if(g==="'")return{isToken:!1,value:Ie(u)};if(ut[g])return{isToken:!0,value:u};if(g.match(qe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+g+"`");return{isToken:!1,value:u}});i.localize.preprocessor&&(o=i.localize.preprocessor(c,o));const h={firstWeekContainsDate:s,weekStartsOn:a,locale:i};return o.map(u=>{if(!u.isToken)return u.value;const g=u.value;(Ne(g)||ve(g))&&Se(g,e,String(t));const O=ut[g[0]];return O(c,g,i.localize,h)}).join("")}function Ie(t){const e=t.match(Fe);return e?e[1].replace(_e,"'"):t}var m=(t=>(t[t.Day=0]="Day",t[t.Month=1]="Month",t[t.Year=2]="Year",t))(m||{});const Mt=q.createContext({dateType:m.Day,setDateType:()=>{},internalDate:new Date,setInternalDate:()=>{},datepickerProps:{value:new Date,onChange:()=>{}}});function He(t){return t?t instanceof Date?t:t.start??new Date:new Date}const $e=t=>{const{children:e,datepickerProps:n}=t,[r,i]=q.useState(m.Day),[s,a]=q.useState(He(n.value));return d.jsx(Mt.Provider,{value:{dateType:r,setDateType:i,internalDate:s,setInternalDate:a,datepickerProps:n},children:e})},Y=()=>q.useContext(Mt);function Z(t,e,n){const r=l(t,n?.in);return isNaN(e)?w(n?.in||t,NaN):(e&&S(r,P(r)+e),r)}function tt(t,e){const[n,r]=F(t,e.start,e.end);return{start:n,end:r}}function V(t,e){const{start:n,end:r}=tt(e?.in,t);let i=+n>+r;const s=i?+n:+r,a=i?r:n;a.setHours(0,0,0,0);let c=1;const o=[];for(;+a<=s;)o.push(w(n,a)),S(a,P(a)+c),a.setHours(0,0,0,0);return i?o.reverse():o}function R(t,e){const n=l(t,e?.in),r=p(n);return M(n,k(n),r+1,0),n.setHours(23,59,59,999),n}function Re(t,e){const n=E(),r=n.weekStartsOn??n.locale?.options?.weekStartsOn??6,i=l(t,e?.in),s=i.getDay(),a=(s<r?-7:0)+6-(s-r);return S(i,P(i)+a),i.setHours(23,59,59,999),i}function ht(t,e){return l(t,e?.in).getDay()}function et(t,e){return+l(t)>+l(e)}function G(t,e){return+l(t)<+l(e)}function _(t,e,n){const[r,i]=F(n?.in,t,e);return+H(r)==+H(i)}function nt(t,e,n){const r=+l(t,n?.in),[i,s]=[+l(e.start,n?.in),+l(e.end,n?.in)].sort((a,c)=>a-c);return r>=i&&r<=s}function L(t,e){const n=l(t,e?.in);return S(n,1),n.setHours(0,0,0,0),n}function Pt(t,e,n){return Z(t,-e,n)}const Le=["ش","ی","د","س","چ","پ","ج"];function Be(t){let e=[];const n=R(t),r=L(t),i=V({start:L(t),end:R(t)}).map(c=>({date:c,isInMonth:!0})),s=ht(r),a=ht(n);if(s!==6?e=[...V({start:v(r),end:Pt(r,1)}).map(o=>({date:o,isInMonth:!1})),...i]:e=[...i],a!=5){const c=V({start:Z(n,1),end:Re(n)}).map(o=>({date:o,isInMonth:!1}));e=[...e,...c]}return e}function Xe({date:t,isInMonth:e,showExtraDays:n,value:r,startDate:i,endDate:s}){const a=e||n;if(!a)return"dgsuikit:pointer-events-none";const c=_(new Date,t),o=(i?et(t,i):!0)&&(s?G(t,s):!0),h="dgsuikit:!bg-primary-500 dgsuikit:!text-white dgsuikit:border-none";let u="dgsuikit:py-1 dgsuikit:rounded-2xl dgsuikit:transition dgsuikit:hover:bg-primary-50 dgsuikit:hover:text-primary-500";return c&&(u=`${u} dgsuikit:border dgsuikit:border-primary-300`),!e&&a?u=`${u} dgsuikit:text-gray-400`:u=`${u} dgsuikit:text-gray-600`,o||(u=`${u} dgsuikit:line-through dgsuikit:pointer-events-none`),r instanceof Date?_(r,t)&&(u=`${u} ${h}`):r.start&&_(r.start,t)?u=`${u} dgsuikit:rounded-l-none ${h}`:r.end&&_(r.end,t)?u=`${u} dgsuikit:rounded-r-none ${h}`:r.start&&r.end&&nt(t,{start:r.start,end:r.end})&&(u=`${u} dgsuikit:rounded-none dgsuikit:border-none dgsuikit:bg-primary-50 dgsuikit:text-primary-500`),u}const Qe=()=>{const{internalDate:t,datepickerProps:e}=Y(),{showExtraDays:n,onChange:r,acceptRange:i,value:s}=e,a=Be(t);function c(o){if(i){if(s.start&&!s.end&&G(o,s.start))return;!s.start||s.end?r({start:o,end:null}):r({start:s.start,end:o})}else r(o)}return d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"dgsuikit:bg-gray-50 dgsuikit:p-3 dgsuikit:font-button-small dgsuikit:text-gray-600 dgsuikit:text-center dgsuikit:grid dgsuikit:grid-rows-1 dgsuikit:grid-cols-7",children:Le.map(o=>d.jsx("span",{children:o},o))}),d.jsx("div",{className:"dgsuikit:grid dgsuikit:grid-cols-7 dgsuikit:text-center dgsuikit:font-p3-medium dgsuikit:ss02 dgsuikit:p-3 dgsuikit:gap-y-2",children:a.map(o=>d.jsx("button",{type:"button",className:Xe({...o,...e}),onClick:()=>c(o.date),children:o.isInMonth||n?b(o.date,"d"):""},o.date.toString()))})]})};function rt(t,...e){const n=t.getDate(),r=t.getMonth()+1,i=t.getFullYear(),s=N(i,r,n),[a,c=s.jd]=e,o=Q(s.jy,a+1,c);return t.setFullYear(o.gy,o.gm-1,o.gd)}function Ge(t,e){const{start:n,end:r}=tt(e?.in,t);let i=+n>+r;const s=i?+n:+r,a=i?r:n;a.setHours(0,0,0,0),S(a,1);let c=1;const o=[];for(;+a<=s;)o.push(w(n,a)),rt(a,p(a)+c);return i?o.reverse():o}function U(t,e){const n=l(t,e?.in),r=k(n);return M(n,r+1,0,0),n.setHours(23,59,59,999),n}function B(t,e,n){const[r,i]=F(n?.in,t,e);return k(r)===k(i)&&p(r)===p(i)}function Ae({month:t,value:e,startDate:n,endDate:r}){let i="dgsuikit:rounded-full dgsuikit:py-1 dgsuikit:transition dgsuikit:hover:bg-primary-50 dgsuikit:hover:text-primary-500";const s="dgsuikit:!bg-primary-500 dgsuikit:!text-white",a=(n?et(R(t),n):!0)&&(r?G(t,R(r)):!0);return e instanceof Date?B(e,t)&&(i=`${i} ${s}`):e.start&&B(t,e.start)&&(i=`${i} ${s}`),a||(i=`${i} dgsuikit:line-through dgsuikit:pointer-events-none`),i}const Ve=()=>{const{internalDate:t,datepickerProps:e,setInternalDate:n,setDateType:r}=Y();function i(s){n(L(s)),r(m.Day)}return d.jsx("div",{className:"dgsuikit:p-3 dgsuikit:grid dgsuikit:grid-cols-3 dgsuikit:text-center dgsuikit:gap-y-3 dgsuikit:font-p3-medium dgsuikit:text-gray-600",children:Ge({start:J(t),end:U(t)}).map(s=>d.jsx("button",{type:"button",className:Ae({month:s,...e}),onClick:()=>i(s),children:b(s,"MMMM")},s.toString()))})};function ze(t,e){const{start:n,end:r}=tt(e?.in,t);let i=+n>+r;const s=i?+n:+r,a=i?r:n;a.setHours(0,0,0,0),rt(a,0,1);let c=1;const o=[];for(;+a<=s;)o.push(w(n,a)),M(a,k(a)+c);return i?o.reverse():o}function X(t,e,n){const[r,i]=F(n?.in,t,e);return k(r)===k(i)}function it(t,e,n){const r=l(t,n?.in);if(isNaN(e))return w(n?.in||t,NaN);if(!e)return r;const i=P(r),s=w(n?.in||t,r.getTime());rt(s,p(r)+e+1,0);const a=P(s);return i>=a?s:(M(r,k(s),p(s),i),r)}function Ke(t,e,n){return it(t,e*12,n)}function Ue(t,e,n){return Ke(t,-11,n)}function Je({year:t,value:e,startDate:n,endDate:r}){let i="dgsuikit:rounded-full dgsuikit:py-1 dgsuikit:transition dgsuikit:hover:bg-primary-50 dgsuikit:hover:text-primary-500";const s="dgsuikit:!bg-primary-500 dgsuikit:!text-white",a=(n?et(U(t),n):!0)&&(r?G(t,U(r)):!0);return e instanceof Date?X(e,t)&&(i=`${i} ${s}`):e.start&&X(t,e.start)&&(i=`${i} ${s}`),a||(i=`${i} dgsuikit:line-through dgsuikit:pointer-events-none`),i}const Ze=()=>{const{internalDate:t,setDateType:e,setInternalDate:n,datepickerProps:r}=Y();function i(s){n(J(s)),e(m.Month)}return d.jsx("div",{className:"dgsuikit:p-3 dgsuikit:grid dgsuikit:grid-cols-3 dgsuikit:text-center dgsuikit:gap-y-3 dgsuikit:font-p3-medium dgsuikit:text-gray-600 dgsuikit:ss02",children:ze({start:t,end:Ue(t)}).map(s=>d.jsx("button",{type:"button",onClick:()=>i(s),className:Je({year:s,...r}),children:b(s,"yyyy")},s.toString()))})},tn=()=>{const{dateType:t}=Y();switch(t){case m.Day:return d.jsx(Qe,{});case m.Month:return d.jsx(Ve,{});case m.Year:return d.jsx(Ze,{});default:return null}},en=()=>{const{datepickerProps:t,setDateType:e,setInternalDate:n}=Y(),{toggleWrapperVisibility:r}=gt.usePickerWrapperContext(),{showSubmitButton:i=!0,showTodayButton:s=!0,onSubmit:a}=t;return d.jsxs("div",{className:z.clsx("dgsuikit:flex dgsuikit:p-3 dgsuikit:items-center dgsuikit:border-t dgsuikit:border-gray-200 dgsuikit:gap-4",s?"dgsuikit:justify-between":"dgsuikit:justify-end"),children:[s&&d.jsx(I,{type:"button",variant:"text",size:"small",isFullWidth:i,onClick:()=>{n(new Date),e(m.Day)},children:"رفتن به امروز"}),i&&d.jsx(I,{type:"button",size:"small",isFullWidth:s,onClick:()=>{typeof a=="function"&&a(),r()},children:"اعمال"})]})};function Ot(t,e,n){const{years:r=0,months:i=0,weeks:s=0,days:a=0,hours:c=0,minutes:o=0,seconds:h=0}=e,u=l(t,n?.in),g=i||r?it(u,i+r*12):u,O=a||s?Z(g,a+s*7):g,st=o+c*60,Dt=(h+st*60)*1e3;return w(n?.in||t,+O+Dt)}function nn(t,e,n){return it(t,-e,n)}function j(t,e,n){const{years:r=0,months:i=0,weeks:s=0,days:a=0,hours:c=0,minutes:o=0,seconds:h=0}=e,u=nn(t,i+r*12,n),g=Pt(u,a+s*7,n),O=o+c*60,at=(h+O*60)*1e3;return w(n?.in||t,+g-at)}function rn(t,e){switch(t){case m.Day:return b(e,"yyyy MMMM");case m.Month:return b(e,"yyyy");case m.Year:return`${b(e,"yyyy")}-${b(j(e,{years:11}),"yyyy")}`;default:return"تاریخ اشتباه"}}function sn(t,e,n){switch(e){case m.Day:return B(t,Ot(n,{days:1}));case m.Month:return X(t,n);case m.Year:return nt(n,{start:t,end:j(t,{years:12})})}}function an(t,e,n){switch(e){case m.Day:return B(j(n,{days:1}),t);case m.Month:return X(n,t);case m.Year:return nt(n,{start:t,end:j(t,{years:12})})}}const on=()=>{const{internalDate:t,dateType:e,setDateType:n,setInternalDate:r,datepickerProps:i}=Y(),{startDate:s,endDate:a}=i;function c(o){const h=o==="next"?Ot:j;switch(e){case m.Day:{r(h(L(t),{months:1}));break}case m.Month:{r(h(t,{years:1}));break}case m.Year:r(h(t,{years:12}));break;default:{console.error("wrong date type");break}}}return d.jsxs("div",{className:"dgsuikit:p-3 dgsuikit:flex dgsuikit:justify-between dgsuikit:items-center dgsuikit:border-b dgsuikit:border-gray-200",children:[d.jsxs("button",{type:"button",className:"dgsuikit:bg-gray-100 dgsuikit:rounded-lg dgsuikit:p-3 dgsuikit:min-w-[50%] dgsuikit:flex dgsuikit:justify-between dgsuikit:items-center dgsuikit:disabled:cursor-not-allowed",disabled:e===m.Year,onClick:()=>e!==m.Year&&n(e+1),children:[d.jsx("span",{className:"dgsuikit:font-button-large dgsuikit:text-gray-700 dgsuikit:ss02",children:rn(e,t)}),d.jsx(Wt.IconArrowDown2,{width:20,height:20,className:"dgsuikit:text-gray-600"})]}),d.jsxs("div",{className:"dgsuikit:flex dgsuikit:gap-2",children:[d.jsx(I,{type:"button",variant:"outline",rightIcon:d.jsx(Nt.IconArrowRight2,{}),disabled:s&&sn(t,e,s),onClick:()=>c("prev")}),d.jsx(I,{type:"button",variant:"outline",rightIcon:d.jsx(vt.IconArrowLeft2,{}),disabled:a&&an(t,e,a),onClick:()=>c("next")})]})]})};function cn(t){return t?t instanceof Date?b(t,"d MMMM yyyy"):t.start&&t.end?`از ${b(t.start,"yyyy/M/d")} تا ${b(t.end,"yyyy/M/d")}`:"":""}const un=t=>{const{showSubmitButton:e=!0,showTodayButton:n=!0,value:r}=t,i={...t};return i.dropdownType==="drawer"?i.drawerProps={...i.drawerProps,containerClassName:z.clsx("dgsuikit:!p-0",i.drawerProps?.containerClassName)}:i.popoverClassName=z.clsx("dgsuikit:!p-0 dgsuikit:max-h-max",i.popoverClassName),i.customInput||(i.inputProps={...i.inputProps,value:i.inputProps?.value??cn(r)}),d.jsx(gt.PickerWrapper,{...i,children:d.jsxs($e,{datepickerProps:t,children:[d.jsx(on,{}),d.jsx(tn,{}),(e||n)&&d.jsx(en,{})]})})};module.exports=un;
|
|
1
|
+
"use strict";require('../../assets/styles.css');const d=require("react/jsx-runtime"),z=require("../../clsx-C11secjj.cjs"),q=require("react"),I=require("../../Button/index.cjs"),gt=require("../../PickerWrapper-_6_IfT-v.cjs"),Wt=require("../../IconArrowDown2-C1dLVveG.cjs"),vt=require("../../IconArrowLeft2-CNA3H0xY.cjs"),Nt=require("../../IconArrowRight2-CF_bdH81.cjs");;/* empty css */const St={lessThanXSeconds:{one:"کمتر از یک ثانیه",other:"کمتر از {{count}} ثانیه"},xSeconds:{one:"1 ثانیه",other:"{{count}} ثانیه"},halfAMinute:"نیم دقیقه",lessThanXMinutes:{one:"کمتر از یک دقیقه",other:"کمتر از {{count}} دقیقه"},xMinutes:{one:"1 دقیقه",other:"{{count}} دقیقه"},aboutXHours:{one:"حدود 1 ساعت",other:"حدود {{count}} ساعت"},xHours:{one:"1 ساعت",other:"{{count}} ساعت"},xDays:{one:"1 روز",other:"{{count}} روز"},aboutXWeeks:{one:"حدود 1 هفته",other:"حدود {{count}} هفته"},xWeeks:{one:"1 هفته",other:"{{count}} هفته"},aboutXMonths:{one:"حدود 1 ماه",other:"حدود {{count}} ماه"},xMonths:{one:"1 ماه",other:"{{count}} ماه"},aboutXYears:{one:"حدود 1 سال",other:"حدود {{count}} سال"},xYears:{one:"1 سال",other:"{{count}} سال"},overXYears:{one:"بیشتر از 1 سال",other:"بیشتر از {{count}} سال"},almostXYears:{one:"نزدیک 1 سال",other:"نزدیک {{count}} سال"}},Yt=(t,e,n)=>{let r;const i=St[t];return typeof i=="string"?r=i:e===1?r=i.one:r=i.other.replace("{{count}}",e.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"در "+r:r+" قبل":r};function A(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const Tt={full:"EEEE do MMMM y",long:"do MMMM y",medium:"d MMM y",short:"yyyy/MM/dd"},Ct={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},jt={full:"{{date}} 'در' {{time}}",long:"{{date}} 'در' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Et={date:A({formats:Tt,defaultWidth:"full"}),time:A({formats:Ct,defaultWidth:"full"}),dateTime:A({formats:jt,defaultWidth:"full"})},Ft={lastWeek:"eeee 'گذشته در' p",yesterday:"'دیروز در' p",today:"'امروز در' p",tomorrow:"'فردا در' p",nextWeek:"eeee 'در' p",other:"P"},_t=(t,e,n,r)=>Ft[t];function T(t){return(e,n)=>{const r=n?.context?String(n.context):"standalone";let i;if(r==="formatting"&&t.formattingValues){const a=t.defaultFormattingWidth||t.defaultWidth,c=n?.width?String(n.width):a;i=t.formattingValues[c]||t.formattingValues[a]}else{const a=t.defaultWidth,c=n?.width?String(n.width):t.defaultWidth;i=t.values[c]||t.values[a]}const s=t.argumentCallback?t.argumentCallback(e):e;return i[s]}}const qt={narrow:["ق","ب"],abbreviated:["ق.ه.","ب.ه."],wide:["قبل از هجرت","بعد از هجرت"]},It={narrow:["1","2","3","4"],abbreviated:["سم1","سم2","سم3","سم4"],wide:["سهماهه 1","سهماهه 2","سهماهه 3","سهماهه 4"]},Ht={narrow:["فر","ار","خر","تی","مر","شه","مه","آب","آذ","دی","به","اس"],abbreviated:["فرو","ارد","خرد","تیر","مرد","شهر","مهر","آبا","آذر","دی","بهم","اسف"],wide:["فروردین","اردیبهشت","خرداد","تیر","مرداد","شهریور","مهر","آبان","آذر","دی","بهمن","اسفند"]},$t={narrow:["ی","د","س","چ","پ","ج","ش"],short:["1ش","2ش","3ش","4ش","5ش","ج","ش"],abbreviated:["یکشنبه","دوشنبه","سهشنبه","چهارشنبه","پنجشنبه","جمعه","شنبه"],wide:["یکشنبه","دوشنبه","سهشنبه","چهارشنبه","پنجشنبه","جمعه","شنبه"]},Rt={narrow:{am:"ق",pm:"ب",midnight:"ن",noon:"ظ",morning:"ص",afternoon:"ب.ظ.",evening:"ع",night:"ش"},abbreviated:{am:"ق.ظ.",pm:"ب.ظ.",midnight:"نیمهشب",noon:"ظهر",morning:"صبح",afternoon:"بعدازظهر",evening:"عصر",night:"شب"},wide:{am:"قبلازظهر",pm:"بعدازظهر",midnight:"نیمهشب",noon:"ظهر",morning:"صبح",afternoon:"بعدازظهر",evening:"عصر",night:"شب"}},Lt={narrow:{am:"ق",pm:"ب",midnight:"ن",noon:"ظ",morning:"ص",afternoon:"ب.ظ.",evening:"ع",night:"ش"},abbreviated:{am:"ق.ظ.",pm:"ب.ظ.",midnight:"نیمهشب",noon:"ظهر",morning:"صبح",afternoon:"بعدازظهر",evening:"عصر",night:"شب"},wide:{am:"قبلازظهر",pm:"بعدازظهر",midnight:"نیمهشب",noon:"ظهر",morning:"صبح",afternoon:"بعدازظهر",evening:"عصر",night:"شب"}},Bt=(t,e)=>Number(t)+"-ام",Xt={ordinalNumber:Bt,era:T({values:qt,defaultWidth:"wide"}),quarter:T({values:It,defaultWidth:"wide",argumentCallback:t=>t-1}),month:T({values:Ht,defaultWidth:"wide"}),day:T({values:$t,defaultWidth:"wide"}),dayPeriod:T({values:Rt,defaultWidth:"wide",formattingValues:Lt,defaultFormattingWidth:"wide"})};function C(t){return(e,n={})=>{const r=n.width,i=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],s=e.match(i);if(!s)return null;const a=s[0],c=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],o=Array.isArray(c)?Gt(c,g=>g.test(a)):Qt(c,g=>g.test(a));let h;h=t.valueCallback?t.valueCallback(o):o,h=n.valueCallback?n.valueCallback(h):h;const u=e.slice(a.length);return{value:h,rest:u}}}function Qt(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function Gt(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return n}function At(t){return(e,n={})=>{const r=e.match(t.matchPattern);if(!r)return null;const i=r[0],s=e.match(t.parsePattern);if(!s)return null;let a=t.valueCallback?t.valueCallback(s[0]):s[0];a=n.valueCallback?n.valueCallback(a):a;const c=e.slice(i.length);return{value:a,rest:c}}}const Vt=/^(\d+)(-?ام)?/i,zt=/\d+/i,Kt={narrow:/^(ق|ب)/i,abbreviated:/^(ق\.?\s?ه\.?|ب\.?\s?ه\.?|ه\.?)/i,wide:/^(قبل از هجرت|هجری شمسی|بعد از هجرت)/i},Ut={any:[/^قبل/i,/^بعد/i]},Jt={narrow:/^[1234]/i,abbreviated:/^(ف|Q|سم)[1234]/i,wide:/^(فصل|quarter|سهماهه) [1234](-ام|ام)?/i},Zt={any:[/1/i,/2/i,/3/i,/4/i]},te={narrow:/^(فر|ار|خر|تی|مر|شه|مه|آب|آذ|دی|به|اس)/i,abbreviated:/^(فرو|ارد|خرد|تیر|مرد|شهر|مهر|آبا|آذر|دی|بهم|اسف)/i,wide:/^(فروردین|اردیبهشت|خرداد|تیر|مرداد|شهریور|مهر|آبان|آذر|دی|بهمن|اسفند)/i},ee={narrow:[/^فر/i,/^ار/i,/^خر/i,/^تی/i,/^مر/i,/^شه/i,/^مه/i,/^آب/i,/^آذ/i,/^دی/i,/^به/i,/^اس/i],any:[/^فر/i,/^ار/i,/^خر/i,/^تی/i,/^مر/i,/^شه/i,/^مه/i,/^آب/i,/^آذ/i,/^دی/i,/^به/i,/^اس/i]},ne={narrow:/^[شیدسچپج]/i,short:/^(ش|ج|1ش|2ش|3ش|4ش|5ش)/i,abbreviated:/^(یکشنبه|دوشنبه|سهشنبه|چهارشنبه|پنجشنبه|جمعه|شنبه)/i,wide:/^(یکشنبه|دوشنبه|سهشنبه|چهارشنبه|پنجشنبه|جمعه|شنبه)/i},re={narrow:[/^ی/i,/^دو/i,/^س/i,/^چ/i,/^پ/i,/^ج/i,/^ش/i],any:[/^(ی|1ش|یکشنبه)/i,/^(د|2ش|دوشنبه)/i,/^(س|3ش|سهشنبه)/i,/^(چ|4ش|چهارشنبه)/i,/^(پ|5ش|پنجشنبه)/i,/^(ج|جمعه)/i,/^(ش|شنبه)/i]},ie={narrow:/^(ب|ق|ن|ظ|ص|ب.ظ.|ع|ش)/i,any:/^(ق.ظ.|ب.ظ.|قبلازظهر|نیمهشب|ظهر|صبح|بعدازظهر|عصر|شب)/i},se={any:{am:/^(ق|ق.ظ.|قبلازظهر)/i,pm:/^(ب|ب.ظ.|بعدازظهر)/i,midnight:/^(نیمهشب|ن)/i,noon:/^(ظ|ظهر)/i,morning:/^(ص|صبح)/i,afternoon:/^(ب|ب.ظ.|بعدازظهر)/i,evening:/^(ع|عصر)/i,night:/^(ش|شب)/i}},ae={ordinalNumber:At({matchPattern:Vt,parsePattern:zt,valueCallback:t=>parseInt(t,10)}),era:C({matchPatterns:Kt,defaultMatchWidth:"wide",parsePatterns:Ut,defaultParseWidth:"any"}),quarter:C({matchPatterns:Jt,defaultMatchWidth:"wide",parsePatterns:Zt,defaultParseWidth:"any",valueCallback:t=>t+1}),month:C({matchPatterns:te,defaultMatchWidth:"wide",parsePatterns:ee,defaultParseWidth:"any"}),day:C({matchPatterns:ne,defaultMatchWidth:"wide",parsePatterns:re,defaultParseWidth:"any"}),dayPeriod:C({matchPatterns:ie,defaultMatchWidth:"any",parsePatterns:se,defaultParseWidth:"any"})},oe={code:"fa-IR",formatDistance:Yt,formatLong:Et,formatRelative:_t,localize:Xt,match:ae,options:{weekStartsOn:6,firstWeekContainsDate:1}};let ce={};function F(){return ce}const mt=6048e5,ue=864e5,ot=Symbol.for("constructDateFrom"),yt=1948320,wt=[0,31,62,93,124,155,186,216,246,276,306,336];function N(t,e,n){return fe(le(t,e,n))}function Q(t,e,n){return he(de(t,e,n))}function de(t,e,n){const[r,i]=kt(t,e);t=r,e=i;const s=e-1,a=t,c=n;let o=yt-1+365*(a-1)+y(8*a+21,33);return s!=0&&(o+=wt[s]),o+c}function fe(t){if(isNaN(t))return{jy:NaN,jm:NaN,jd:NaN};let e,n;const r=t-yt;let i=1+y(33*r+3,12053);n=r-(365*(i-1)+y(8*i+21,33)),n<0&&(i--,n=r-(365*(i-1)+y(8*i+21,33))),n<216?e=y(n,31):e=y(n-6,30);const s=n-wt[e]+1;n++;const a=i,c=e+1;return{jy:a,jm:c,jd:s}}function le(t,e,n){const[r,i]=kt(t,e);return t=r,e=i,y(1461*(t+4800+y(e-14,12)),4)+y(367*(e-2-12*y(e-14,12)),12)-y(3*y(t+4900+y(e-14,12),100),4)+n-32075}function he(t){if(isNaN(t))return{gy:NaN,gm:NaN,gd:NaN};let e=t+68569;const n=y(4*e,146097);e=e-y(146097*n+3,4);const r=y(4e3*(e+1),1461001);e=e-y(1461*r,4)+31;const i=y(80*e,2447),s=e-y(2447*i,80);e=y(i,11);const a=i+2-12*e;return{gy:100*(n-49)+r+e,gm:a,gd:s}}function kt(t,e){if(e=e-1,e<0){const n=e;e=ge(e,12),t-=y(e-n,12)}return e>11&&(t+=y(e,12),e=K(e,12)),[t,e+1]}function y(t,e){return~~(t/e)}function K(t,e){return t-~~(t/e)*e}function ge(t,e){return K(K(t,e)+e,e)}function me(...t){if(t.length>1){const[e,n,r=1,...i]=t,s=Q(e,n+1,r);return new Date(s.gy,s.gm-1,s.gd,...i)}return new Date(...t)}function w(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&ot in t?t[ot](e):t instanceof Date?new t.constructor(e):me(e)}function l(t,e){return w(e||t,t)}function ct(t){const e=l(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function _(t,...e){const n=w.bind(null,e.find(r=>typeof r=="object"));return e.map(n)}function H(t,e){const n=l(t,e?.in);return n.setHours(0,0,0,0),n}function ye(t,e,n){const[r,i]=_(n?.in,t,e),s=H(r),a=H(i),c=+s-ct(s),o=+a-ct(a);return Math.round((c-o)/ue)}function k(t){const e=t.getDate(),n=t.getMonth()+1,r=t.getFullYear();return N(r,n,e).jy}function M(t,...e){const n=t.getDate(),r=t.getMonth()+1,i=t.getFullYear(),s=N(i,r,n),[a,c=s.jm-1,o=s.jd]=e,h=Q(a,c+1,o);return t.setFullYear(h.gy,h.gm-1,h.gd)}function J(t,e){const n=l(t,e?.in);return M(n,k(n),0,1),n.setHours(0,0,0,0),n}function we(t,e){const n=l(t,e?.in);return ye(n,J(n))+1}function P(t){const e=t.getDate(),n=t.getMonth()+1,r=t.getFullYear();return N(r,n,e).jd}function S(t,...e){const n=t.getDate(),r=t.getMonth()+1,i=t.getFullYear(),s=N(i,r,n),[a]=e,c=Q(s.jy,s.jm,a);return t.setFullYear(c.gy,c.gm-1,c.gd)}function v(t,e){const n=F(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??6,i=l(t,e?.in),s=i.getDay(),a=(s<r?7:0)+s-r;return S(i,P(i)-a),i.setHours(0,0,0,0),i}function $(t,e){return v(t,{...e,weekStartsOn:1})}function pt(t,e){const n=l(t,e?.in),r=n.getFullYear(),i=w(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);const s=$(i),a=w(n,0);a.setFullYear(r,0,4),a.setHours(0,0,0,0);const c=$(a);return n.getTime()>=s.getTime()?r+1:n.getTime()>=c.getTime()?r:r-1}function ke(t,e){const n=pt(t,e),r=w(t,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),$(r)}function pe(t,e){const n=l(t,e?.in),r=+$(n)-+ke(n);return Math.round(r/mt)+1}function bt(t,e){const n=l(t,e?.in),r=k(n),i=F(),s=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,a=w(e?.in||t,0);M(a,r+1,0,s),a.setHours(0,0,0,0);const c=v(a,e),o=w(e?.in||t,0);M(o,r,0,s),o.setHours(0,0,0,0);const h=v(o,e);return+n>=+c?r+1:+n>=+h?r:r-1}function be(t,e){const n=F(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=bt(t,e),s=w(e?.in||t,0);return M(s,i,0,r),s.setHours(0,0,0,0),v(s,e)}function xe(t,e){const n=l(t,e?.in),r=+v(n,e)-+be(n,e);return Math.round(r/mt)+1}function f(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}function p(t){const e=t.getDate(),n=t.getMonth()+1,r=t.getFullYear();return N(r,n,e).jm-1}const x={y(t,e){const n=k(t),r=n>0?n:1-n;return f(e==="yy"?r%100:r,e.length)},M(t,e){const n=p(t);return e==="M"?String(n+1):f(n+1,2)},d(t,e){return f(P(t),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(t,e){return f(t.getHours()%12||12,e.length)},H(t,e){return f(t.getHours(),e.length)},m(t,e){return f(t.getMinutes(),e.length)},s(t,e){return f(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),i=Math.trunc(r*Math.pow(10,n-3));return f(i,e.length)}},W={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},ut={G:function(t,e,n){const r=k(t)>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const r=k(t),i=r>0?r:1-r;return n.ordinalNumber(i,{unit:"year"})}return x.y(t,e)},Y:function(t,e,n,r){const i=bt(t,r),s=i>0?i:1-i;if(e==="YY"){const a=s%100;return f(a,2)}return e==="Yo"?n.ordinalNumber(s,{unit:"year"}):f(s,e.length)},R:function(t,e){const n=pt(t);return f(n,e.length)},u:function(t,e){const n=k(t);return f(n,e.length)},Q:function(t,e,n){const r=Math.ceil((p(t)+1)/3);switch(e){case"Q":return String(r);case"QQ":return f(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){const r=Math.ceil((p(t)+1)/3);switch(e){case"q":return String(r);case"qq":return f(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){const r=p(t);switch(e){case"M":case"MM":return x.M(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){const r=p(t);switch(e){case"L":return String(r+1);case"LL":return f(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){const i=xe(t,r);return e==="wo"?n.ordinalNumber(i,{unit:"week"}):f(i,e.length)},I:function(t,e,n){const r=pe(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):f(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(P(t),{unit:"date"}):x.d(t,e)},D:function(t,e,n){const r=we(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):f(r,e.length)},E:function(t,e,n){const r=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){const i=t.getDay(),s=(i-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(s);case"ee":return f(s,2);case"eo":return n.ordinalNumber(s,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});case"eeee":default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){const i=t.getDay(),s=(i-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(s);case"cc":return f(s,e.length);case"co":return n.ordinalNumber(s,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});case"cccc":default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(t,e,n){const r=t.getDay(),i=r===0?7:r;switch(e){case"i":return String(i);case"ii":return f(i,e.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){const i=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(t,e,n){const r=t.getHours();let i;switch(r===12?i=W.noon:r===0?i=W.midnight:i=r/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(t,e,n){const r=t.getHours();let i;switch(r>=17?i=W.evening:r>=12?i=W.afternoon:r>=4?i=W.morning:i=W.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let r=t.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return x.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):x.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):f(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):f(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):x.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):x.s(t,e)},S:function(t,e){return x.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return ft(r);case"XXXX":case"XX":return D(r);case"XXXXX":case"XXX":default:return D(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return ft(r);case"xxxx":case"xx":return D(r);case"xxxxx":case"xxx":default:return D(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+dt(r,":");case"OOOO":default:return"GMT"+D(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+dt(r,":");case"zzzz":default:return"GMT"+D(r,":")}},t:function(t,e,n){const r=Math.trunc(+t/1e3);return f(r,e.length)},T:function(t,e,n){return f(+t,e.length)}};function dt(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),i=Math.trunc(r/60),s=r%60;return s===0?n+String(i):n+String(i)+e+f(s,2)}function ft(t,e){return t%60===0?(t>0?"-":"+")+f(Math.abs(t)/60,2):D(t,e)}function D(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),i=f(Math.trunc(r/60),2),s=f(r%60,2);return n+i+e+s}const lt=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},xt=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},Me=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return lt(t,e);let s;switch(r){case"P":s=e.dateTime({width:"short"});break;case"PP":s=e.dateTime({width:"medium"});break;case"PPP":s=e.dateTime({width:"long"});break;case"PPPP":default:s=e.dateTime({width:"full"});break}return s.replace("{{date}}",lt(r,e)).replace("{{time}}",xt(i,e))},Pe={p:xt,P:Me},Oe=/^D+$/,De=/^Y+$/,We=["D","DD","YY","YYYY"];function ve(t){return Oe.test(t)}function Ne(t){return De.test(t)}function Se(t,e,n){const r=Ye(t,e,n);if(console.warn(r),We.includes(t))throw new RangeError(r)}function Ye(t,e,n){const r=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}function Te(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function Ce(t){return!(!Te(t)&&typeof t!="number"||isNaN(+l(t)))}const je=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Ee=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Fe=/^'([^]*?)'?$/,_e=/''/g,qe=/[a-zA-Z]/;function b(t,e,n){const r=F(),i=r.locale??oe,s=r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,a=r.weekStartsOn??r.locale?.options?.weekStartsOn??6,c=l(t,n?.in);if(!Ce(c))throw new RangeError("Invalid time value");let o=e.match(Ee).map(u=>{const g=u[0];if(g==="p"||g==="P"){const O=Pe[g];return O(u,i.formatLong)}return u}).join("").match(je).map(u=>{if(u==="''")return{isToken:!1,value:"'"};const g=u[0];if(g==="'")return{isToken:!1,value:Ie(u)};if(ut[g])return{isToken:!0,value:u};if(g.match(qe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+g+"`");return{isToken:!1,value:u}});i.localize.preprocessor&&(o=i.localize.preprocessor(c,o));const h={firstWeekContainsDate:s,weekStartsOn:a,locale:i};return o.map(u=>{if(!u.isToken)return u.value;const g=u.value;(Ne(g)||ve(g))&&Se(g,e,String(t));const O=ut[g[0]];return O(c,g,i.localize,h)}).join("")}function Ie(t){const e=t.match(Fe);return e?e[1].replace(_e,"'"):t}var m=(t=>(t[t.Day=0]="Day",t[t.Month=1]="Month",t[t.Year=2]="Year",t))(m||{});const Mt=q.createContext({dateType:m.Day,setDateType:()=>{},internalDate:new Date,setInternalDate:()=>{},datepickerProps:{value:new Date,onChange:()=>{}}});function He(t){return t?t instanceof Date?t:t.start??new Date:new Date}const $e=t=>{const{children:e,datepickerProps:n}=t,[r,i]=q.useState(m.Day),[s,a]=q.useState(He(n.value));return d.jsx(Mt.Provider,{value:{dateType:r,setDateType:i,internalDate:s,setInternalDate:a,datepickerProps:n},children:e})},Y=()=>q.useContext(Mt);function Z(t,e,n){const r=l(t,n?.in);return isNaN(e)?w(n?.in||t,NaN):(e&&S(r,P(r)+e),r)}function tt(t,e){const[n,r]=_(t,e.start,e.end);return{start:n,end:r}}function V(t,e){const{start:n,end:r}=tt(e?.in,t);let i=+n>+r;const s=i?+n:+r,a=i?r:n;a.setHours(0,0,0,0);let c=1;const o=[];for(;+a<=s;)o.push(w(n,a)),S(a,P(a)+c),a.setHours(0,0,0,0);return i?o.reverse():o}function R(t,e){const n=l(t,e?.in),r=p(n);return M(n,k(n),r+1,0),n.setHours(23,59,59,999),n}function Re(t,e){const n=F(),r=n.weekStartsOn??n.locale?.options?.weekStartsOn??6,i=l(t,e?.in),s=i.getDay(),a=(s<r?-7:0)+6-(s-r);return S(i,P(i)+a),i.setHours(23,59,59,999),i}function ht(t,e){return l(t,e?.in).getDay()}function et(t,e){return+l(t)>+l(e)}function G(t,e){return+l(t)<+l(e)}function j(t,e,n){const[r,i]=_(n?.in,t,e);return+H(r)==+H(i)}function nt(t,e,n){const r=+l(t,n?.in),[i,s]=[+l(e.start,n?.in),+l(e.end,n?.in)].sort((a,c)=>a-c);return r>=i&&r<=s}function L(t,e){const n=l(t,e?.in);return S(n,1),n.setHours(0,0,0,0),n}function Pt(t,e,n){return Z(t,-e,n)}const Le=["ش","ی","د","س","چ","پ","ج"];function Be(t){let e=[];const n=R(t),r=L(t),i=V({start:L(t),end:R(t)}).map(c=>({date:c,isInMonth:!0})),s=ht(r),a=ht(n);if(s!==6?e=[...V({start:v(r),end:Pt(r,1)}).map(o=>({date:o,isInMonth:!1})),...i]:e=[...i],a!=5){const c=V({start:Z(n,1),end:Re(n)}).map(o=>({date:o,isInMonth:!1}));e=[...e,...c]}return e}function Xe({date:t,isInMonth:e,showExtraDays:n,value:r,startDate:i,endDate:s}){const a=e||n;if(!a)return"dgsuikit:pointer-events-none";const c=j(new Date,t),o=(i?et(t,i):!0)&&(s?G(t,s):!0),h="dgsuikit:!bg-primary-500 dgsuikit:!text-white dgsuikit:border-none";let u="dgsuikit:py-1 dgsuikit:rounded-2xl dgsuikit:transition dgsuikit:hover:bg-primary-50 dgsuikit:hover:text-primary-500";return c&&(u=`${u} dgsuikit:border dgsuikit:border-primary-300`),!e&&a?u=`${u} dgsuikit:text-gray-400`:u=`${u} dgsuikit:text-gray-600`,o||(u=`${u} dgsuikit:line-through dgsuikit:pointer-events-none`),r instanceof Date?j(r,t)&&(u=`${u} ${h}`):r.start&&j(r.start,t)?u=`${u} dgsuikit:rounded-l-none ${h}`:r.end&&j(r.end,t)?u=`${u} dgsuikit:rounded-r-none ${h}`:r.start&&r.end&&nt(t,{start:r.start,end:r.end})&&(u=`${u} dgsuikit:rounded-none dgsuikit:border-none dgsuikit:bg-primary-50 dgsuikit:text-primary-500`),u}const Qe=()=>{const{internalDate:t,datepickerProps:e}=Y(),{showExtraDays:n,onChange:r,acceptRange:i,value:s}=e,a=Be(t);function c(o){if(i){if(s.start&&j(s.start,o))return;s.start&&!s.end&&G(o,s.start)||!s.start||s.end?r({start:o,end:null}):r({start:s.start,end:o})}else r(o)}return d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"dgsuikit:bg-gray-50 dgsuikit:p-3 dgsuikit:font-button-small dgsuikit:text-gray-600 dgsuikit:text-center dgsuikit:grid dgsuikit:grid-rows-1 dgsuikit:grid-cols-7",children:Le.map(o=>d.jsx("span",{children:o},o))}),d.jsx("div",{className:"dgsuikit:grid dgsuikit:grid-cols-7 dgsuikit:text-center dgsuikit:font-p3-medium dgsuikit:ss02 dgsuikit:p-3 dgsuikit:gap-y-2",children:a.map(o=>d.jsx("button",{type:"button",className:Xe({...o,...e}),onClick:()=>c(o.date),children:o.isInMonth||n?b(o.date,"d"):""},o.date.toString()))})]})};function rt(t,...e){const n=t.getDate(),r=t.getMonth()+1,i=t.getFullYear(),s=N(i,r,n),[a,c=s.jd]=e,o=Q(s.jy,a+1,c);return t.setFullYear(o.gy,o.gm-1,o.gd)}function Ge(t,e){const{start:n,end:r}=tt(e?.in,t);let i=+n>+r;const s=i?+n:+r,a=i?r:n;a.setHours(0,0,0,0),S(a,1);let c=1;const o=[];for(;+a<=s;)o.push(w(n,a)),rt(a,p(a)+c);return i?o.reverse():o}function U(t,e){const n=l(t,e?.in),r=k(n);return M(n,r+1,0,0),n.setHours(23,59,59,999),n}function B(t,e,n){const[r,i]=_(n?.in,t,e);return k(r)===k(i)&&p(r)===p(i)}function Ae({month:t,value:e,startDate:n,endDate:r}){let i="dgsuikit:rounded-full dgsuikit:py-1 dgsuikit:transition dgsuikit:hover:bg-primary-50 dgsuikit:hover:text-primary-500";const s="dgsuikit:!bg-primary-500 dgsuikit:!text-white",a=(n?et(R(t),n):!0)&&(r?G(t,R(r)):!0);return e instanceof Date?B(e,t)&&(i=`${i} ${s}`):e.start&&B(t,e.start)&&(i=`${i} ${s}`),a||(i=`${i} dgsuikit:line-through dgsuikit:pointer-events-none`),i}const Ve=()=>{const{internalDate:t,datepickerProps:e,setInternalDate:n,setDateType:r}=Y();function i(s){n(L(s)),r(m.Day)}return d.jsx("div",{className:"dgsuikit:p-3 dgsuikit:grid dgsuikit:grid-cols-3 dgsuikit:text-center dgsuikit:gap-y-3 dgsuikit:font-p3-medium dgsuikit:text-gray-600",children:Ge({start:J(t),end:U(t)}).map(s=>d.jsx("button",{type:"button",className:Ae({month:s,...e}),onClick:()=>i(s),children:b(s,"MMMM")},s.toString()))})};function ze(t,e){const{start:n,end:r}=tt(e?.in,t);let i=+n>+r;const s=i?+n:+r,a=i?r:n;a.setHours(0,0,0,0),rt(a,0,1);let c=1;const o=[];for(;+a<=s;)o.push(w(n,a)),M(a,k(a)+c);return i?o.reverse():o}function X(t,e,n){const[r,i]=_(n?.in,t,e);return k(r)===k(i)}function it(t,e,n){const r=l(t,n?.in);if(isNaN(e))return w(n?.in||t,NaN);if(!e)return r;const i=P(r),s=w(n?.in||t,r.getTime());rt(s,p(r)+e+1,0);const a=P(s);return i>=a?s:(M(r,k(s),p(s),i),r)}function Ke(t,e,n){return it(t,e*12,n)}function Ue(t,e,n){return Ke(t,-11,n)}function Je({year:t,value:e,startDate:n,endDate:r}){let i="dgsuikit:rounded-full dgsuikit:py-1 dgsuikit:transition dgsuikit:hover:bg-primary-50 dgsuikit:hover:text-primary-500";const s="dgsuikit:!bg-primary-500 dgsuikit:!text-white",a=(n?et(U(t),n):!0)&&(r?G(t,U(r)):!0);return e instanceof Date?X(e,t)&&(i=`${i} ${s}`):e.start&&X(t,e.start)&&(i=`${i} ${s}`),a||(i=`${i} dgsuikit:line-through dgsuikit:pointer-events-none`),i}const Ze=()=>{const{internalDate:t,setDateType:e,setInternalDate:n,datepickerProps:r}=Y();function i(s){n(J(s)),e(m.Month)}return d.jsx("div",{className:"dgsuikit:p-3 dgsuikit:grid dgsuikit:grid-cols-3 dgsuikit:text-center dgsuikit:gap-y-3 dgsuikit:font-p3-medium dgsuikit:text-gray-600 dgsuikit:ss02",children:ze({start:t,end:Ue(t)}).map(s=>d.jsx("button",{type:"button",onClick:()=>i(s),className:Je({year:s,...r}),children:b(s,"yyyy")},s.toString()))})},tn=()=>{const{dateType:t}=Y();switch(t){case m.Day:return d.jsx(Qe,{});case m.Month:return d.jsx(Ve,{});case m.Year:return d.jsx(Ze,{});default:return null}},en=()=>{const{datepickerProps:t,setDateType:e,setInternalDate:n}=Y(),{toggleWrapperVisibility:r}=gt.usePickerWrapperContext(),{showSubmitButton:i=!0,showTodayButton:s=!0,onSubmit:a}=t;return d.jsxs("div",{className:z.clsx("dgsuikit:flex dgsuikit:p-3 dgsuikit:items-center dgsuikit:border-t dgsuikit:border-gray-200 dgsuikit:gap-4",s?"dgsuikit:justify-between":"dgsuikit:justify-end"),children:[s&&d.jsx(I,{type:"button",variant:"text",size:"small",isFullWidth:i,onClick:()=>{n(new Date),e(m.Day)},children:"رفتن به امروز"}),i&&d.jsx(I,{type:"button",size:"small",isFullWidth:s,onClick:()=>{typeof a=="function"&&a(),r()},children:"اعمال"})]})};function Ot(t,e,n){const{years:r=0,months:i=0,weeks:s=0,days:a=0,hours:c=0,minutes:o=0,seconds:h=0}=e,u=l(t,n?.in),g=i||r?it(u,i+r*12):u,O=a||s?Z(g,a+s*7):g,st=o+c*60,Dt=(h+st*60)*1e3;return w(n?.in||t,+O+Dt)}function nn(t,e,n){return it(t,-e,n)}function E(t,e,n){const{years:r=0,months:i=0,weeks:s=0,days:a=0,hours:c=0,minutes:o=0,seconds:h=0}=e,u=nn(t,i+r*12,n),g=Pt(u,a+s*7,n),O=o+c*60,at=(h+O*60)*1e3;return w(n?.in||t,+g-at)}function rn(t,e){switch(t){case m.Day:return b(e,"yyyy MMMM");case m.Month:return b(e,"yyyy");case m.Year:return`${b(e,"yyyy")}-${b(E(e,{years:11}),"yyyy")}`;default:return"تاریخ اشتباه"}}function sn(t,e,n){switch(e){case m.Day:return B(t,Ot(n,{days:1}));case m.Month:return X(t,n);case m.Year:return nt(n,{start:t,end:E(t,{years:12})})}}function an(t,e,n){switch(e){case m.Day:return B(E(n,{days:1}),t);case m.Month:return X(n,t);case m.Year:return nt(n,{start:t,end:E(t,{years:12})})}}const on=()=>{const{internalDate:t,dateType:e,setDateType:n,setInternalDate:r,datepickerProps:i}=Y(),{startDate:s,endDate:a}=i;function c(o){const h=o==="next"?Ot:E;switch(e){case m.Day:{r(h(L(t),{months:1}));break}case m.Month:{r(h(t,{years:1}));break}case m.Year:r(h(t,{years:12}));break;default:{console.error("wrong date type");break}}}return d.jsxs("div",{className:"dgsuikit:p-3 dgsuikit:flex dgsuikit:justify-between dgsuikit:items-center dgsuikit:border-b dgsuikit:border-gray-200",children:[d.jsxs("button",{type:"button",className:"dgsuikit:bg-gray-100 dgsuikit:rounded-lg dgsuikit:p-3 dgsuikit:min-w-[50%] dgsuikit:flex dgsuikit:justify-between dgsuikit:items-center dgsuikit:disabled:cursor-not-allowed",disabled:e===m.Year,onClick:()=>e!==m.Year&&n(e+1),children:[d.jsx("span",{className:"dgsuikit:font-button-large dgsuikit:text-gray-700 dgsuikit:ss02",children:rn(e,t)}),d.jsx(Wt.IconArrowDown2,{width:20,height:20,className:"dgsuikit:text-gray-600"})]}),d.jsxs("div",{className:"dgsuikit:flex dgsuikit:gap-2",children:[d.jsx(I,{type:"button",variant:"outline",rightIcon:d.jsx(Nt.IconArrowRight2,{}),disabled:s&&sn(t,e,s),onClick:()=>c("prev")}),d.jsx(I,{type:"button",variant:"outline",rightIcon:d.jsx(vt.IconArrowLeft2,{}),disabled:a&&an(t,e,a),onClick:()=>c("next")})]})]})};function cn(t){return t?t instanceof Date?b(t,"d MMMM yyyy"):t.start&&t.end?`از ${b(t.start,"yyyy/M/d")} تا ${b(t.end,"yyyy/M/d")}`:"":""}const un=t=>{const{showSubmitButton:e=!0,showTodayButton:n=!0,value:r}=t,i={...t};return i.dropdownType==="drawer"?i.drawerProps={...i.drawerProps,containerClassName:z.clsx("dgsuikit:!p-0",i.drawerProps?.containerClassName)}:i.popoverClassName=z.clsx("dgsuikit:!p-0 dgsuikit:max-h-max",i.popoverClassName),i.customInput||(i.inputProps={...i.inputProps,value:i.inputProps?.value??cn(r)}),d.jsx(gt.PickerWrapper,{...i,children:d.jsxs($e,{datepickerProps:t,children:[d.jsx(on,{}),d.jsx(tn,{}),(e||n)&&d.jsx(en,{})]})})};module.exports=un;
|
|
@@ -2,7 +2,7 @@ import { jsx as h, jsxs as N, Fragment as vt } from "react/jsx-runtime";
|
|
|
2
2
|
import { c as z } from "../../clsx-OuTLNxxd.js";
|
|
3
3
|
import { useState as ot, createContext as Nt, useContext as Wt } from "react";
|
|
4
4
|
import $ from "../../Button/index.mjs";
|
|
5
|
-
import { u as Yt, P as St } from "../../PickerWrapper-
|
|
5
|
+
import { u as Yt, P as St } from "../../PickerWrapper-BN0-64XB.js";
|
|
6
6
|
import { I as Tt } from "../../IconArrowDown2-7ddwV5IE.js";
|
|
7
7
|
import { I as Ct } from "../../IconArrowLeft2-cxcPyDqS.js";
|
|
8
8
|
import { I as Et } from "../../IconArrowRight2-BoXg0Gkw.js";
|
|
@@ -456,7 +456,7 @@ const Zt = /^(\d+)(-?ام)?/i, te = /\d+/i, ee = {
|
|
|
456
456
|
}
|
|
457
457
|
};
|
|
458
458
|
let he = {};
|
|
459
|
-
function
|
|
459
|
+
function I() {
|
|
460
460
|
return he;
|
|
461
461
|
}
|
|
462
462
|
const mt = 6048e5, ge = 864e5, ut = Symbol.for("constructDateFrom"), yt = 1948320, wt = [
|
|
@@ -558,7 +558,7 @@ function ct(t) {
|
|
|
558
558
|
);
|
|
559
559
|
return n.setUTCFullYear(e.getFullYear()), +t - +n;
|
|
560
560
|
}
|
|
561
|
-
function
|
|
561
|
+
function H(t, ...e) {
|
|
562
562
|
const n = w.bind(
|
|
563
563
|
null,
|
|
564
564
|
e.find((r) => typeof r == "object")
|
|
@@ -570,7 +570,7 @@ function q(t, e) {
|
|
|
570
570
|
return n.setHours(0, 0, 0, 0), n;
|
|
571
571
|
}
|
|
572
572
|
function Me(t, e, n) {
|
|
573
|
-
const [r, i] =
|
|
573
|
+
const [r, i] = H(
|
|
574
574
|
n?.in,
|
|
575
575
|
t,
|
|
576
576
|
e
|
|
@@ -602,7 +602,7 @@ function S(t, ...e) {
|
|
|
602
602
|
return t.setFullYear(u.gy, u.gm - 1, u.gd);
|
|
603
603
|
}
|
|
604
604
|
function W(t, e) {
|
|
605
|
-
const n =
|
|
605
|
+
const n = I(), r = e?.weekStartsOn ?? e?.locale?.options?.weekStartsOn ?? n.weekStartsOn ?? n.locale?.options?.weekStartsOn ?? 6, i = f(t, e?.in), a = i.getDay(), s = (a < r ? 7 : 0) + a - r;
|
|
606
606
|
return S(i, x(i) - s), i.setHours(0, 0, 0, 0), i;
|
|
607
607
|
}
|
|
608
608
|
function j(t, e) {
|
|
@@ -625,7 +625,7 @@ function Oe(t, e) {
|
|
|
625
625
|
return Math.round(r / mt) + 1;
|
|
626
626
|
}
|
|
627
627
|
function bt(t, e) {
|
|
628
|
-
const n = f(t, e?.in), r = k(n), i =
|
|
628
|
+
const n = f(t, e?.in), r = k(n), i = I(), a = e?.firstWeekContainsDate ?? e?.locale?.options?.firstWeekContainsDate ?? i.firstWeekContainsDate ?? i.locale?.options?.firstWeekContainsDate ?? 1, s = w(e?.in || t, 0);
|
|
629
629
|
P(s, r + 1, 0, a), s.setHours(0, 0, 0, 0);
|
|
630
630
|
const u = W(s, e), o = w(e?.in || t, 0);
|
|
631
631
|
P(o, r, 0, a), o.setHours(0, 0, 0, 0);
|
|
@@ -633,7 +633,7 @@ function bt(t, e) {
|
|
|
633
633
|
return +n >= +u ? r + 1 : +n >= +l ? r : r - 1;
|
|
634
634
|
}
|
|
635
635
|
function De(t, e) {
|
|
636
|
-
const n =
|
|
636
|
+
const n = I(), r = e?.firstWeekContainsDate ?? e?.locale?.options?.firstWeekContainsDate ?? n.firstWeekContainsDate ?? n.locale?.options?.firstWeekContainsDate ?? 1, i = bt(t, e), a = w(e?.in || t, 0);
|
|
637
637
|
return P(a, i, 0, r), a.setHours(0, 0, 0, 0), W(a, e);
|
|
638
638
|
}
|
|
639
639
|
function ve(t, e) {
|
|
@@ -1346,7 +1346,7 @@ function He(t) {
|
|
|
1346
1346
|
}
|
|
1347
1347
|
const $e = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, qe = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, je = /^'([^]*?)'?$/, Re = /''/g, Be = /[a-zA-Z]/;
|
|
1348
1348
|
function b(t, e, n) {
|
|
1349
|
-
const r =
|
|
1349
|
+
const r = I(), i = r.locale ?? le, a = r.firstWeekContainsDate ?? r.locale?.options?.firstWeekContainsDate ?? 1, s = r.weekStartsOn ?? r.locale?.options?.weekStartsOn ?? 6, u = f(t, n?.in);
|
|
1350
1350
|
if (!He(u))
|
|
1351
1351
|
throw new RangeError("Invalid time value");
|
|
1352
1352
|
let o = e.match(qe).map((c) => {
|
|
@@ -1426,7 +1426,7 @@ function Z(t, e, n) {
|
|
|
1426
1426
|
return isNaN(e) ? w(n?.in || t, NaN) : (e && S(r, x(r) + e), r);
|
|
1427
1427
|
}
|
|
1428
1428
|
function tt(t, e) {
|
|
1429
|
-
const [n, r] =
|
|
1429
|
+
const [n, r] = H(t, e.start, e.end);
|
|
1430
1430
|
return { start: n, end: r };
|
|
1431
1431
|
}
|
|
1432
1432
|
function A(t, e) {
|
|
@@ -1445,7 +1445,7 @@ function R(t, e) {
|
|
|
1445
1445
|
return P(n, k(n), r + 1, 0), n.setHours(23, 59, 59, 999), n;
|
|
1446
1446
|
}
|
|
1447
1447
|
function Ge(t, e) {
|
|
1448
|
-
const n =
|
|
1448
|
+
const n = I(), r = n.weekStartsOn ?? n.locale?.options?.weekStartsOn ?? 6, i = f(t, e?.in), a = i.getDay(), s = (a < r ? -7 : 0) + 6 - (a - r);
|
|
1449
1449
|
return S(i, x(i) + s), i.setHours(23, 59, 59, 999), i;
|
|
1450
1450
|
}
|
|
1451
1451
|
function gt(t, e) {
|
|
@@ -1457,8 +1457,8 @@ function et(t, e) {
|
|
|
1457
1457
|
function G(t, e) {
|
|
1458
1458
|
return +f(t) < +f(e);
|
|
1459
1459
|
}
|
|
1460
|
-
function
|
|
1461
|
-
const [r, i] =
|
|
1460
|
+
function F(t, e, n) {
|
|
1461
|
+
const [r, i] = H(
|
|
1462
1462
|
n?.in,
|
|
1463
1463
|
t,
|
|
1464
1464
|
e
|
|
@@ -1517,9 +1517,9 @@ function ze({
|
|
|
1517
1517
|
}) {
|
|
1518
1518
|
const s = e || n;
|
|
1519
1519
|
if (!s) return "dgsuikit:pointer-events-none";
|
|
1520
|
-
const u =
|
|
1520
|
+
const u = F(/* @__PURE__ */ new Date(), t), o = (i ? et(t, i) : !0) && (a ? G(t, a) : !0), l = "dgsuikit:!bg-primary-500 dgsuikit:!text-white dgsuikit:border-none";
|
|
1521
1521
|
let c = "dgsuikit:py-1 dgsuikit:rounded-2xl dgsuikit:transition dgsuikit:hover:bg-primary-50 dgsuikit:hover:text-primary-500";
|
|
1522
|
-
return u && (c = `${c} dgsuikit:border dgsuikit:border-primary-300`), !e && s ? c = `${c} dgsuikit:text-gray-400` : c = `${c} dgsuikit:text-gray-600`, o || (c = `${c} dgsuikit:line-through dgsuikit:pointer-events-none`), r instanceof Date ?
|
|
1522
|
+
return u && (c = `${c} dgsuikit:border dgsuikit:border-primary-300`), !e && s ? c = `${c} dgsuikit:text-gray-400` : c = `${c} dgsuikit:text-gray-600`, o || (c = `${c} dgsuikit:line-through dgsuikit:pointer-events-none`), r instanceof Date ? F(r, t) && (c = `${c} ${l}`) : r.start && F(r.start, t) ? c = `${c} dgsuikit:rounded-l-none ${l}` : r.end && F(r.end, t) ? c = `${c} dgsuikit:rounded-r-none ${l}` : r.start && r.end && nt(t, {
|
|
1523
1523
|
start: r.start,
|
|
1524
1524
|
end: r.end
|
|
1525
1525
|
}) && (c = `${c} dgsuikit:rounded-none dgsuikit:border-none dgsuikit:bg-primary-50 dgsuikit:text-primary-500`), c;
|
|
@@ -1528,8 +1528,8 @@ const Ke = () => {
|
|
|
1528
1528
|
const { internalDate: t, datepickerProps: e } = T(), { showExtraDays: n, onChange: r, acceptRange: i, value: a } = e, s = Ae(t);
|
|
1529
1529
|
function u(o) {
|
|
1530
1530
|
if (i) {
|
|
1531
|
-
if (a.start &&
|
|
1532
|
-
!a.start || a.end ? r({ start: o, end: null }) : r({
|
|
1531
|
+
if (a.start && F(a.start, o)) return;
|
|
1532
|
+
a.start && !a.end && G(o, a.start) || !a.start || a.end ? r({ start: o, end: null }) : r({
|
|
1533
1533
|
start: a.start,
|
|
1534
1534
|
end: o
|
|
1535
1535
|
});
|
|
@@ -1569,7 +1569,7 @@ function U(t, e) {
|
|
|
1569
1569
|
return P(n, r + 1, 0, 0), n.setHours(23, 59, 59, 999), n;
|
|
1570
1570
|
}
|
|
1571
1571
|
function L(t, e, n) {
|
|
1572
|
-
const [r, i] =
|
|
1572
|
+
const [r, i] = H(
|
|
1573
1573
|
n?.in,
|
|
1574
1574
|
t,
|
|
1575
1575
|
e
|
|
@@ -1617,7 +1617,7 @@ function tn(t, e) {
|
|
|
1617
1617
|
return i ? o.reverse() : o;
|
|
1618
1618
|
}
|
|
1619
1619
|
function X(t, e, n) {
|
|
1620
|
-
const [r, i] =
|
|
1620
|
+
const [r, i] = H(
|
|
1621
1621
|
n?.in,
|
|
1622
1622
|
t,
|
|
1623
1623
|
e
|
|
@@ -1734,7 +1734,7 @@ function Ot(t, e, n) {
|
|
|
1734
1734
|
function un(t, e, n) {
|
|
1735
1735
|
return it(t, -e, n);
|
|
1736
1736
|
}
|
|
1737
|
-
function
|
|
1737
|
+
function _(t, e, n) {
|
|
1738
1738
|
const {
|
|
1739
1739
|
years: r = 0,
|
|
1740
1740
|
months: i = 0,
|
|
@@ -1753,7 +1753,7 @@ function cn(t, e) {
|
|
|
1753
1753
|
case m.Month:
|
|
1754
1754
|
return b(e, "yyyy");
|
|
1755
1755
|
case m.Year:
|
|
1756
|
-
return `${b(e, "yyyy")}-${b(
|
|
1756
|
+
return `${b(e, "yyyy")}-${b(_(e, { years: 11 }), "yyyy")}`;
|
|
1757
1757
|
default:
|
|
1758
1758
|
return "تاریخ اشتباه";
|
|
1759
1759
|
}
|
|
@@ -1767,27 +1767,27 @@ function dn(t, e, n) {
|
|
|
1767
1767
|
case m.Year:
|
|
1768
1768
|
return nt(n, {
|
|
1769
1769
|
start: t,
|
|
1770
|
-
end:
|
|
1770
|
+
end: _(t, { years: 12 })
|
|
1771
1771
|
});
|
|
1772
1772
|
}
|
|
1773
1773
|
}
|
|
1774
1774
|
function fn(t, e, n) {
|
|
1775
1775
|
switch (e) {
|
|
1776
1776
|
case m.Day:
|
|
1777
|
-
return L(
|
|
1777
|
+
return L(_(n, { days: 1 }), t);
|
|
1778
1778
|
case m.Month:
|
|
1779
1779
|
return X(n, t);
|
|
1780
1780
|
case m.Year:
|
|
1781
1781
|
return nt(n, {
|
|
1782
1782
|
start: t,
|
|
1783
|
-
end:
|
|
1783
|
+
end: _(t, { years: 12 })
|
|
1784
1784
|
});
|
|
1785
1785
|
}
|
|
1786
1786
|
}
|
|
1787
1787
|
const ln = () => {
|
|
1788
1788
|
const { internalDate: t, dateType: e, setDateType: n, setInternalDate: r, datepickerProps: i } = T(), { startDate: a, endDate: s } = i;
|
|
1789
1789
|
function u(o) {
|
|
1790
|
-
const l = o === "next" ? Ot :
|
|
1790
|
+
const l = o === "next" ? Ot : _;
|
|
1791
1791
|
switch (e) {
|
|
1792
1792
|
case m.Day: {
|
|
1793
1793
|
r(l(B(t), { months: 1 }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Options.d.ts","sourceRoot":"","sources":["../../../src/components/Form/Select/Options.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Options.d.ts","sourceRoot":"","sources":["../../../src/components/Form/Select/Options.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAgD,MAAM,SAAS,CAAC;AAOzF,QAAA,MAAM,OAAO,GAAI,CAAC,EAAG,OAAO,WAAW,CAAC,CAAC,CAAC,4CAwLzC,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require('../../assets/styles.css');const
|
|
1
|
+
"use strict";require('../../assets/styles.css');const i=require("react/jsx-runtime"),d=require("../../clsx-C11secjj.cjs"),T=require("../../index-BCqGGELs.cjs"),c=require("react"),W=require("../../IconSearch-BeVs-gUu.cjs"),_=require("../Checkbox/index.cjs"),H=require("../../Button/index.cjs"),E=require("../../PickerWrapper-_6_IfT-v.cjs"),V=require("../../Chip/index.cjs");;/* empty css */function $({label:r,isMultiple:s,isActive:n,disabled:a}){return s?i.jsx(_,{checked:n,label:r,readOnly:!0,disabled:a}):r}const z=r=>{const{option:s,onClick:n,value:a,mode:o,optionCellClassName:g,optionCell:t}=r;function l(){return Array.isArray(a)?a.includes(s.value):s.value===a}return i.jsx("button",{type:"button",onClick:n,className:d.clsx("dgsuikit:w-full dgsuikit:text-start dgsuikit:px-3 dgsuikit:disabled:cursor-not-allowed dgsuikit:py-3 dgsuikit:font-p1-regular dgsuikit:disabled:bg-gray-50 dgsuikit:transition",l()?"dgsuikit:bg-primary-50 dgsuikit:text-primary-500":"dgsuikit:text-gray-700 dgsuikit:disabled:text-gray-400",g),disabled:s.disabled,children:t?t(s,l()):$({label:s.label,isMultiple:o==="multiple",isActive:l(),disabled:s.disabled??!1})})},A=c.memo(z),D=20,U=r=>{const{options:s,mode:n="single",afterOptions:a,beforeOptions:o,onChange:g,searchable:t=!0,separateSelectedOptions:l=!0,optionsTitle:f="عنوانها",value:p,optionCellClassName:C,emptyContent:M="نتیجهای یافت نشد !",showClearButtonOnEmpty:F=!0}=r,[m,P]=c.useState(""),[x,B]=c.useState(0),k=c.useRef(null),{toggleWrapperVisibility:L}=E.usePickerWrapperContext(),I=d.clsx("dgsuikit:border-t dgsuikit:border-solid dgsuikit:border-gray-100",(!t&&!o||n==="multiple"&&l)&&"dgsuikit:first-of-type:border-t-0",!!a&&"dgsuikit:last-of-type:border-b");let y;const h=t;typeof t=="boolean"?y=t:y=Object.keys(t).length>0;const v=c.useMemo(()=>{if(!Array.isArray(s))throw new Error("options should be array");return m?s?.filter(e=>e.label.includes(m)):s},[m,s]),N=c.useMemo(()=>n==="multiple"&&l?s?.filter(e=>p.includes(e.value))??[]:[],[s,p]),O=c.useMemo(()=>{let e=v;n==="multiple"&&l&&(e=e?.filter(w=>!p.includes(w.value)));const u=Math.min(x+D,e?.length??0);return e?.slice(x,u)},[v,x,p]),b=k?.current?.children[0]?.clientHeight??50,R=(v?.length??0)*b,j=c.useCallback(()=>{const e=k?.current?.parentElement;if(!e)return;const u=e.scrollTop,w=k.current.offsetTop,q=Math.floor((u-w)/b);B(q>=0?q:0)},[b]);c.useEffect(()=>{const e=k.current?.parentElement;if(e)return e.addEventListener("scroll",j),()=>e.removeEventListener("scroll",j)},[j]);const S=c.useCallback(e=>{if(typeof g=="function")if(n==="multiple"){const u=[...p??[]];u.includes(e)?u.splice(u.indexOf(e),1):u.push(e),g(u)}else g(e),L()},[p]);return i.jsxs(i.Fragment,{children:[y&&i.jsx(T.Input,{id:"search-input",wrapperClassName:d.clsx("dgsuikit:sticky dgsuikit:top-0 dgsuikit:pt-3 dgsuikit:right-0 dgsuikit:bg-white dgsuikit:z-10 dgsuikit:px-3",o?"dgsuikit:pb-2":"dgsuikit:pb-3",h?.wrapperClassName),placeholder:h?.placeholder??"جستجوی عنوان",value:m,autoFocus:h?.autoFocus??!0,onChange:e=>P(e.currentTarget.value),rightIcon:h?.rightIcon??i.jsx(W.IconSearch,{width:20,height:20}),...typeof t=="object"?t:{}}),o,n==="multiple"&&l&&N.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"dgsuikit:font-p2-regular dgsuikit:text-gray-400 dgsuikit:px-3 dgsuikit:py-2",children:`${f}ی انتخاب شده`}),N.map(e=>i.jsx(A,{onClick:()=>S(e.value),option:e,optionCellClassName:d.clsx(I,C),...r},e.value))]}),i.jsxs(i.Fragment,{children:[n==="multiple"&&l&&i.jsx("p",{className:"dgsuikit:font-p2-regular dgsuikit:text-gray-400 dgsuikit:px-3 dgsuikit:py-2",children:f}),i.jsx("div",{ref:k,className:"dgsuikit:relative",style:{height:R},children:O?.map((e,u)=>i.jsx("div",{className:d.clsx("dgsuikit:absolute dgsuikit:w-full",I),style:{top:`${(x+u)*b}px`},children:i.jsx(A,{onClick:()=>S(e.value),option:e,...r})},e.value))}),!O?.length&&!N.length&&i.jsxs("div",{className:"dgsuikit:text-center dgsuikit:flex dgsuikit:flex-col dgsuikit:items-center dgsuikit:mt-2",children:[i.jsx("p",{className:"dgsuikit:text-gray-500 dgsuikit:font-p3-medium",children:M}),F&&i.jsx(H,{type:"button",className:"dgsuikit:mt-1",variant:"text",size:"small",onClick:()=>P(""),children:"پاک کردن"})]})]}),a]})};function G(r,s){if(!Array.isArray(r))return s.find(n=>n.value===r)?.label??""}const J=r=>{const{searchable:s=!0,value:n,options:a}=r,o=Array.isArray(n)&&n.length>0;function g(){return r.inputProps?.prefix?r.inputProps.prefix:o?n.map(l=>i.jsx(V,{label:a.find(f=>f.value===l)?.label,clickable:!0,leftIcon:i.jsx(T.IconCloseSquare,{}),onClick:f=>{f.stopPropagation();const p=n.filter(C=>C!==l);r.onChange?.(p)}},l)):null}const t={...r};return t.dropdownType==="popover"&&!s&&(t.popoverClassName=d.clsx("dgsuikit:pt-3",t.popoverClassName)),t.dropdownType==="drawer"&&(t.drawerProps={...t.drawerProps,containerClassName:d.clsx(s?"dgsuikit:!pt-0":"dgsuikit:!pt-3",t.drawerProps?.containerClassName)}),t.customInput||(t.inputProps={...t.inputProps,value:G(n,a),prefix:g(),prefixClassName:o?d.clsx("dgsuikit:flex dgsuikit:items-center flex dgsuikit:flex-wrap dgsuikit:gap-2 dgsuikit:w-full",t.inputProps?.prefixClassName):t.inputProps?.prefixClassName,className:o?"dgsuikit:hidden":t.inputProps?.className,containerClassName:o?d.clsx("dgsuikit:items-baseline",t.inputProps?.containerClassName):t.inputProps?.containerClassName}),i.jsx(E.PickerWrapper,{...t,children:i.jsx(U,{...r})})};module.exports=J;
|
|
@@ -1,173 +1,161 @@
|
|
|
1
|
-
import { jsx as n, jsxs as
|
|
1
|
+
import { jsx as n, jsxs as y, Fragment as I } from "react/jsx-runtime";
|
|
2
2
|
import { c as d } from "../../clsx-OuTLNxxd.js";
|
|
3
|
-
import { I as
|
|
4
|
-
import { memo as
|
|
5
|
-
import { I as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { u as
|
|
3
|
+
import { I as z, a as R } from "../../index-Cj_9z9UD.js";
|
|
4
|
+
import { memo as _, useState as j, useRef as q, useMemo as O, useCallback as B, useEffect as D } from "react";
|
|
5
|
+
import { I as U } from "../../IconSearch-aShj2vmu.js";
|
|
6
|
+
import G from "../Checkbox/index.mjs";
|
|
7
|
+
import J from "../../Button/index.mjs";
|
|
8
|
+
import { u as K, P as Q } from "../../PickerWrapper-BN0-64XB.js";
|
|
9
9
|
import X from "../../Chip/index.mjs";
|
|
10
10
|
import '../../assets/styles.css';/* empty css */
|
|
11
|
-
function Y(
|
|
12
|
-
if (!s) return;
|
|
13
|
-
if (window.innerWidth > 768) {
|
|
14
|
-
s.focus(), s.click();
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
const t = document.createElement("input");
|
|
18
|
-
t.style.position = "absolute", t.style.top = `${s.offsetTop + 7}px`, t.style.left = `${s.offsetLeft}px`, t.style.height = "0px", t.style.opacity = "0px", document.body.appendChild(t), t.focus(), setTimeout(() => {
|
|
19
|
-
s.focus(), s.click(), document.body.removeChild(t);
|
|
20
|
-
}, r);
|
|
21
|
-
}
|
|
22
|
-
function Z({
|
|
11
|
+
function Y({
|
|
23
12
|
label: s,
|
|
24
|
-
isMultiple:
|
|
25
|
-
isActive:
|
|
26
|
-
disabled:
|
|
13
|
+
isMultiple: i,
|
|
14
|
+
isActive: r,
|
|
15
|
+
disabled: a
|
|
27
16
|
}) {
|
|
28
|
-
return
|
|
29
|
-
|
|
17
|
+
return i ? /* @__PURE__ */ n(
|
|
18
|
+
G,
|
|
30
19
|
{
|
|
31
|
-
checked:
|
|
20
|
+
checked: r,
|
|
32
21
|
label: s,
|
|
33
22
|
readOnly: !0,
|
|
34
|
-
disabled:
|
|
23
|
+
disabled: a
|
|
35
24
|
}
|
|
36
25
|
) : s;
|
|
37
26
|
}
|
|
38
|
-
const
|
|
39
|
-
const { option:
|
|
27
|
+
const Z = (s) => {
|
|
28
|
+
const { option: i, onClick: r, value: a, mode: u, optionCellClassName: p, optionCell: t } = s;
|
|
40
29
|
function l() {
|
|
41
|
-
return Array.isArray(
|
|
30
|
+
return Array.isArray(a) ? a.includes(i.value) : i.value === a;
|
|
42
31
|
}
|
|
43
32
|
return /* @__PURE__ */ n(
|
|
44
33
|
"button",
|
|
45
34
|
{
|
|
46
35
|
type: "button",
|
|
47
|
-
onClick:
|
|
36
|
+
onClick: r,
|
|
48
37
|
className: d(
|
|
49
38
|
"dgsuikit:w-full dgsuikit:text-start dgsuikit:px-3 dgsuikit:disabled:cursor-not-allowed dgsuikit:py-3 dgsuikit:font-p1-regular dgsuikit:disabled:bg-gray-50 dgsuikit:transition",
|
|
50
39
|
l() ? "dgsuikit:bg-primary-50 dgsuikit:text-primary-500" : "dgsuikit:text-gray-700 dgsuikit:disabled:text-gray-400",
|
|
51
40
|
p
|
|
52
41
|
),
|
|
53
|
-
disabled:
|
|
54
|
-
children:
|
|
55
|
-
label:
|
|
42
|
+
disabled: i.disabled,
|
|
43
|
+
children: t ? t(i, l()) : Y({
|
|
44
|
+
label: i.label,
|
|
56
45
|
isMultiple: u === "multiple",
|
|
57
46
|
isActive: l(),
|
|
58
|
-
disabled:
|
|
47
|
+
disabled: i.disabled ?? !1
|
|
59
48
|
})
|
|
60
49
|
}
|
|
61
50
|
);
|
|
62
|
-
},
|
|
51
|
+
}, L = _(Z), ee = 20, te = (s) => {
|
|
63
52
|
const {
|
|
64
|
-
options:
|
|
65
|
-
mode:
|
|
66
|
-
afterOptions:
|
|
53
|
+
options: i,
|
|
54
|
+
mode: r = "single",
|
|
55
|
+
afterOptions: a,
|
|
67
56
|
beforeOptions: u,
|
|
68
57
|
onChange: p,
|
|
69
|
-
searchable:
|
|
58
|
+
searchable: t = !0,
|
|
70
59
|
separateSelectedOptions: l = !0,
|
|
71
60
|
optionsTitle: g = "عنوانها",
|
|
72
61
|
value: c,
|
|
73
|
-
optionCellClassName:
|
|
74
|
-
emptyContent:
|
|
62
|
+
optionCellClassName: C,
|
|
63
|
+
emptyContent: F = "نتیجهای یافت نشد !",
|
|
75
64
|
showClearButtonOnEmpty: H = !0
|
|
76
|
-
} = s, [m,
|
|
65
|
+
} = s, [m, S] = j(""), [k, V] = j(0), f = q(null), { toggleWrapperVisibility: W } = K(), A = d(
|
|
77
66
|
"dgsuikit:border-t dgsuikit:border-solid dgsuikit:border-gray-100",
|
|
78
|
-
(!
|
|
79
|
-
!!
|
|
67
|
+
(!t && !u || r === "multiple" && l) && "dgsuikit:first-of-type:border-t-0",
|
|
68
|
+
!!a && "dgsuikit:last-of-type:border-b"
|
|
80
69
|
);
|
|
81
|
-
let
|
|
82
|
-
const
|
|
83
|
-
typeof
|
|
84
|
-
const v =
|
|
85
|
-
if (!Array.isArray(
|
|
70
|
+
let x;
|
|
71
|
+
const h = t;
|
|
72
|
+
typeof t == "boolean" ? x = t : x = Object.keys(t).length > 0;
|
|
73
|
+
const v = O(() => {
|
|
74
|
+
if (!Array.isArray(i))
|
|
86
75
|
throw new Error("options should be array");
|
|
87
|
-
return m ?
|
|
88
|
-
}, [m,
|
|
76
|
+
return m ? i?.filter((e) => e.label.includes(m)) : i;
|
|
77
|
+
}, [m, i]), N = O(() => r === "multiple" && l ? i?.filter((e) => c.includes(e.value)) ?? [] : [], [i, c]), T = O(() => {
|
|
89
78
|
let e = v;
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
return e?.slice(k,
|
|
93
|
-
}, [v, k, c]),
|
|
79
|
+
r === "multiple" && l && (e = e?.filter((P) => !c.includes(P.value)));
|
|
80
|
+
const o = Math.min(k + ee, e?.length ?? 0);
|
|
81
|
+
return e?.slice(k, o);
|
|
82
|
+
}, [v, k, c]), b = f?.current?.children[0]?.clientHeight ?? 50, $ = (v?.length ?? 0) * b, w = B(() => {
|
|
94
83
|
const e = f?.current?.parentElement;
|
|
95
84
|
if (!e) return;
|
|
96
|
-
const
|
|
97
|
-
V(
|
|
98
|
-
}, [
|
|
99
|
-
|
|
85
|
+
const o = e.scrollTop, P = f.current.offsetTop, M = Math.floor((o - P) / b);
|
|
86
|
+
V(M >= 0 ? M : 0);
|
|
87
|
+
}, [b]);
|
|
88
|
+
D(() => {
|
|
100
89
|
const e = f.current?.parentElement;
|
|
101
90
|
if (e)
|
|
102
91
|
return e.addEventListener("scroll", w), () => e.removeEventListener("scroll", w);
|
|
103
|
-
}, [w])
|
|
104
|
-
|
|
105
|
-
}, []);
|
|
106
|
-
const A = B(
|
|
92
|
+
}, [w]);
|
|
93
|
+
const E = B(
|
|
107
94
|
(e) => {
|
|
108
95
|
if (typeof p == "function")
|
|
109
|
-
if (
|
|
110
|
-
const
|
|
111
|
-
|
|
96
|
+
if (r === "multiple") {
|
|
97
|
+
const o = [...c ?? []];
|
|
98
|
+
o.includes(e) ? o.splice(o.indexOf(e), 1) : o.push(e), p(o);
|
|
112
99
|
} else
|
|
113
|
-
p(e),
|
|
100
|
+
p(e), W();
|
|
114
101
|
},
|
|
115
102
|
[c]
|
|
116
103
|
);
|
|
117
|
-
return /* @__PURE__ */
|
|
118
|
-
|
|
119
|
-
|
|
104
|
+
return /* @__PURE__ */ y(I, { children: [
|
|
105
|
+
x && /* @__PURE__ */ n(
|
|
106
|
+
z,
|
|
120
107
|
{
|
|
121
108
|
id: "search-input",
|
|
122
109
|
wrapperClassName: d(
|
|
123
110
|
"dgsuikit:sticky dgsuikit:top-0 dgsuikit:pt-3 dgsuikit:right-0 dgsuikit:bg-white dgsuikit:z-10 dgsuikit:px-3",
|
|
124
111
|
u ? "dgsuikit:pb-2" : "dgsuikit:pb-3",
|
|
125
|
-
|
|
112
|
+
h?.wrapperClassName
|
|
126
113
|
),
|
|
127
|
-
placeholder:
|
|
114
|
+
placeholder: h?.placeholder ?? "جستجوی عنوان",
|
|
128
115
|
value: m,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
116
|
+
autoFocus: h?.autoFocus ?? !0,
|
|
117
|
+
onChange: (e) => S(e.currentTarget.value),
|
|
118
|
+
rightIcon: h?.rightIcon ?? /* @__PURE__ */ n(
|
|
119
|
+
U,
|
|
132
120
|
{
|
|
133
121
|
width: 20,
|
|
134
122
|
height: 20
|
|
135
123
|
}
|
|
136
124
|
),
|
|
137
|
-
...typeof
|
|
125
|
+
...typeof t == "object" ? t : {}
|
|
138
126
|
}
|
|
139
127
|
),
|
|
140
128
|
u,
|
|
141
|
-
|
|
129
|
+
r === "multiple" && l && N.length > 0 && /* @__PURE__ */ y(I, { children: [
|
|
142
130
|
/* @__PURE__ */ n("p", { className: "dgsuikit:font-p2-regular dgsuikit:text-gray-400 dgsuikit:px-3 dgsuikit:py-2", children: `${g}ی انتخاب شده` }),
|
|
143
131
|
N.map((e) => /* @__PURE__ */ n(
|
|
144
|
-
|
|
132
|
+
L,
|
|
145
133
|
{
|
|
146
|
-
onClick: () =>
|
|
134
|
+
onClick: () => E(e.value),
|
|
147
135
|
option: e,
|
|
148
|
-
optionCellClassName: d(
|
|
136
|
+
optionCellClassName: d(A, C),
|
|
149
137
|
...s
|
|
150
138
|
},
|
|
151
139
|
e.value
|
|
152
140
|
))
|
|
153
141
|
] }),
|
|
154
|
-
/* @__PURE__ */
|
|
155
|
-
|
|
142
|
+
/* @__PURE__ */ y(I, { children: [
|
|
143
|
+
r === "multiple" && l && /* @__PURE__ */ n("p", { className: "dgsuikit:font-p2-regular dgsuikit:text-gray-400 dgsuikit:px-3 dgsuikit:py-2", children: g }),
|
|
156
144
|
/* @__PURE__ */ n(
|
|
157
145
|
"div",
|
|
158
146
|
{
|
|
159
147
|
ref: f,
|
|
160
148
|
className: "dgsuikit:relative",
|
|
161
|
-
style: { height:
|
|
162
|
-
children: T?.map((e,
|
|
149
|
+
style: { height: $ },
|
|
150
|
+
children: T?.map((e, o) => /* @__PURE__ */ n(
|
|
163
151
|
"div",
|
|
164
152
|
{
|
|
165
|
-
className: d("dgsuikit:absolute dgsuikit:w-full",
|
|
166
|
-
style: { top: `${(k +
|
|
153
|
+
className: d("dgsuikit:absolute dgsuikit:w-full", A),
|
|
154
|
+
style: { top: `${(k + o) * b}px` },
|
|
167
155
|
children: /* @__PURE__ */ n(
|
|
168
|
-
|
|
156
|
+
L,
|
|
169
157
|
{
|
|
170
|
-
onClick: () =>
|
|
158
|
+
onClick: () => E(e.value),
|
|
171
159
|
option: e,
|
|
172
160
|
...s
|
|
173
161
|
}
|
|
@@ -177,65 +165,65 @@ const ee = (s) => {
|
|
|
177
165
|
))
|
|
178
166
|
}
|
|
179
167
|
),
|
|
180
|
-
!T?.length && !N.length && /* @__PURE__ */
|
|
181
|
-
/* @__PURE__ */ n("p", { className: "dgsuikit:text-gray-500 dgsuikit:font-p3-medium", children:
|
|
168
|
+
!T?.length && !N.length && /* @__PURE__ */ y("div", { className: "dgsuikit:text-center dgsuikit:flex dgsuikit:flex-col dgsuikit:items-center dgsuikit:mt-2", children: [
|
|
169
|
+
/* @__PURE__ */ n("p", { className: "dgsuikit:text-gray-500 dgsuikit:font-p3-medium", children: F }),
|
|
182
170
|
H && /* @__PURE__ */ n(
|
|
183
|
-
|
|
171
|
+
J,
|
|
184
172
|
{
|
|
185
173
|
type: "button",
|
|
186
174
|
className: "dgsuikit:mt-1",
|
|
187
175
|
variant: "text",
|
|
188
176
|
size: "small",
|
|
189
|
-
onClick: () =>
|
|
177
|
+
onClick: () => S(""),
|
|
190
178
|
children: "پاک کردن"
|
|
191
179
|
}
|
|
192
180
|
)
|
|
193
181
|
] })
|
|
194
182
|
] }),
|
|
195
|
-
|
|
183
|
+
a
|
|
196
184
|
] });
|
|
197
185
|
};
|
|
198
|
-
function
|
|
186
|
+
function ie(s, i) {
|
|
199
187
|
if (!Array.isArray(s))
|
|
200
|
-
return
|
|
188
|
+
return i.find((r) => r.value === s)?.label ?? "";
|
|
201
189
|
}
|
|
202
|
-
const
|
|
203
|
-
const { searchable:
|
|
190
|
+
const ge = (s) => {
|
|
191
|
+
const { searchable: i = !0, value: r, options: a } = s, u = Array.isArray(r) && r.length > 0;
|
|
204
192
|
function p() {
|
|
205
|
-
return s.inputProps?.prefix ? s.inputProps.prefix : u ?
|
|
193
|
+
return s.inputProps?.prefix ? s.inputProps.prefix : u ? r.map((l) => /* @__PURE__ */ n(
|
|
206
194
|
X,
|
|
207
195
|
{
|
|
208
|
-
label:
|
|
196
|
+
label: a.find((g) => g.value === l)?.label,
|
|
209
197
|
clickable: !0,
|
|
210
|
-
leftIcon: /* @__PURE__ */ n(
|
|
198
|
+
leftIcon: /* @__PURE__ */ n(R, {}),
|
|
211
199
|
onClick: (g) => {
|
|
212
200
|
g.stopPropagation();
|
|
213
|
-
const c =
|
|
201
|
+
const c = r.filter((C) => C !== l);
|
|
214
202
|
s.onChange?.(c);
|
|
215
203
|
}
|
|
216
204
|
},
|
|
217
205
|
l
|
|
218
206
|
)) : null;
|
|
219
207
|
}
|
|
220
|
-
const
|
|
221
|
-
return
|
|
222
|
-
...
|
|
208
|
+
const t = { ...s };
|
|
209
|
+
return t.dropdownType === "popover" && !i && (t.popoverClassName = d("dgsuikit:pt-3", t.popoverClassName)), t.dropdownType === "drawer" && (t.drawerProps = {
|
|
210
|
+
...t.drawerProps,
|
|
223
211
|
containerClassName: d(
|
|
224
|
-
|
|
225
|
-
|
|
212
|
+
i ? "dgsuikit:!pt-0" : "dgsuikit:!pt-3",
|
|
213
|
+
t.drawerProps?.containerClassName
|
|
226
214
|
)
|
|
227
|
-
}),
|
|
228
|
-
...
|
|
229
|
-
value:
|
|
215
|
+
}), t.customInput || (t.inputProps = {
|
|
216
|
+
...t.inputProps,
|
|
217
|
+
value: ie(r, a),
|
|
230
218
|
prefix: p(),
|
|
231
219
|
prefixClassName: u ? d(
|
|
232
220
|
"dgsuikit:flex dgsuikit:items-center flex dgsuikit:flex-wrap dgsuikit:gap-2 dgsuikit:w-full",
|
|
233
|
-
|
|
234
|
-
) :
|
|
235
|
-
className: u ? "dgsuikit:hidden" :
|
|
236
|
-
containerClassName: u ? d("dgsuikit:items-baseline",
|
|
237
|
-
}), /* @__PURE__ */ n(Q, { ...
|
|
221
|
+
t.inputProps?.prefixClassName
|
|
222
|
+
) : t.inputProps?.prefixClassName,
|
|
223
|
+
className: u ? "dgsuikit:hidden" : t.inputProps?.className,
|
|
224
|
+
containerClassName: u ? d("dgsuikit:items-baseline", t.inputProps?.containerClassName) : t.inputProps?.containerClassName
|
|
225
|
+
}), /* @__PURE__ */ n(Q, { ...t, children: /* @__PURE__ */ n(te, { ...s }) });
|
|
238
226
|
};
|
|
239
227
|
export {
|
|
240
|
-
|
|
228
|
+
ge as default
|
|
241
229
|
};
|
|
@@ -3,7 +3,7 @@ import { jsxs as R, jsx as t, Fragment as S } from "react/jsx-runtime";
|
|
|
3
3
|
import { c as i } from "./clsx-OuTLNxxd.js";
|
|
4
4
|
import { createContext as D, useContext as O, useRef as A, useEffect as L, useState as p } from "react";
|
|
5
5
|
import V from "./Drawer/index.mjs";
|
|
6
|
-
import { u as _ } from "./useFlipPosition-
|
|
6
|
+
import { u as _ } from "./useFlipPosition-BWxiBDQ_.js";
|
|
7
7
|
import { I as j } from "./IconArrowDown2-7ddwV5IE.js";
|
|
8
8
|
import { I as F } from "./index-Cj_9z9UD.js";
|
|
9
9
|
import './assets/styles.css';/* empty css */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";require('./assets/styles.css');const t=require("react/jsx-runtime"),e=require("./clsx-C11secjj.cjs"),n=require("react"),R=require("./Drawer/index.cjs"),q=require("./useFlipPosition-
|
|
1
|
+
"use client";"use strict";require('./assets/styles.css');const t=require("react/jsx-runtime"),e=require("./clsx-C11secjj.cjs"),n=require("react"),R=require("./Drawer/index.cjs"),q=require("./useFlipPosition-CWhLgzoz.cjs"),S=require("./IconArrowDown2-C1dLVveG.cjs"),E=require("./index-BCqGGELs.cjs");;/* empty css */const v=n.createContext({toggleWrapperVisibility:()=>{}}),D=()=>n.useContext(v),A=a=>{const i=n.useRef(null);return n.useEffect(()=>{const s=r=>{i.current&&!i.current.contains(r.target)&&a()};return document.addEventListener("click",s,!0),()=>{document.removeEventListener("click",s,!0)}},[i,a]),i},C="dgsuikit:duration-300",b=400,O=a=>{const{dropdownType:i="popover",disabled:s,isLoading:r,wrapperClassName:N,customInput:g,children:k,drawerProps:m,inputProps:I,popoverClassName:y}=a,[u,c]=n.useState(!1),[f,d]=n.useState(!1),[x,P]=n.useState("bottom-left");let o;const{anchorRef:T,popperRef:W}=q.useFlipPosition({initialPosition:"bottom-left",minVisible:180,onPositionChange(l){P(w=>w===l?w:l)}}),j=A(()=>{i==="popover"&&u&&(c(!1),o&&clearTimeout(o),o=setTimeout(()=>{d(!1)},b))});function h(){if(s||r)return;const l=!f;o&&clearTimeout(o),l?(d(!0),o=setTimeout(()=>{c(!0)},0)):(c(!1),o=setTimeout(()=>{d(!1)},b))}const p=e.clsx({"dgsuikit:!cursor-not-allowed":s,"dgsuikit:!cursor-wait":r,"dgsuikit:!cursor-pointer":!r&&!s});return t.jsxs("div",{ref:j,className:e.clsx("dgsuikit:relative",N),children:[t.jsx("button",{ref:T,type:"button",className:e.clsx("dgsuikit:w-full",p),onClick:h,children:g?g(u):t.jsx(E.Input,{leftIcon:r?t.jsx("div",{className:"dot-flashing dgsuikit:mr-2"}):t.jsx(S.IconArrowDown2,{width:20,height:20,className:e.clsx("dgsuikit:transition",C,{"dgsuikit:rotate-180":u})}),containerClassName:e.clsx(p,{"dgsuikit:items-baseline":r}),className:e.clsx("dgsuikit:caret-transparent",p),disabled:s,...I})}),t.jsx(v.Provider,{value:{toggleWrapperVisibility:h},children:f&&t.jsx(t.Fragment,{children:i==="popover"?t.jsx("div",{ref:W,className:e.clsx("dgsuikit:absolute dgsuikit:min-w-[300px] dgsuikit:right-0 dgsuikit:overflow-y-auto dgsuikit:overflow-x-hidden dgsuikit:shadow-lg dgsuikit:w-full dgsuikit:max-h-[360px] dgsuikit:transition-all dgsuikit:bg-white dgsuikit:z-50 dgsuikit:rounded-lg dgsuikit:border dgsuikit:border-solid dgsuikit:border-gray-200 dgsuikit:pb-3",C,u?"dgsuikit:opacity-100":"dgsuikit:opacity-0 dgsuikit:max-h-0 dgsuikit:overflow-y-hidden",{"dgsuikit:bottom-0 dgsuikit:translate-y-[calc(100%+8px)]":x.includes("bottom"),"dgsuikit:top-0 dgsuikit:translate-y-[calc(-100%-8px)]":x.includes("top")},y),children:k}):t.jsx(R,{...m,open:u,onClose:()=>c(!1),containerClassName:e.clsx("dgsuikit:!pb-3 dgsuikit:!px-0",m?.containerClassName),children:k})})})]})};exports.PickerWrapper=O;exports.usePickerWrapperContext=D;
|
package/dist/Tooltip/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";require('../assets/styles.css');const t=require("react/jsx-runtime"),i=require("../clsx-C11secjj.cjs"),n=require("react"),S=require("../useFlipPosition-
|
|
1
|
+
"use client";"use strict";require('../assets/styles.css');const t=require("react/jsx-runtime"),i=require("../clsx-C11secjj.cjs"),n=require("react"),S=require("../useFlipPosition-CWhLgzoz.cjs");;/* empty css */const T={"bottom-right":"dgsuikit:left-4 dgsuikit:top-0 dgsuikit:-translate-y-1/2 dgsuikit:border-t dgsuikit:border-l dgsuikit:rounded-tl","bottom-center":"dgsuikit:left-1/2 dgsuikit:-translate-x-1/2 dgsuikit:top-0 dgsuikit:-translate-y-1/2 dgsuikit:border-t dgsuikit:border-l dgsuikit:rounded-tl","bottom-left":"dgsuikit:right-4 dgsuikit:top-0 dgsuikit:-translate-y-1/2 dgsuikit:border-t dgsuikit:border-l dgsuikit:rounded-tl","top-right":"dgsuikit:left-4 dgsuikit:bottom-0 dgsuikit:translate-y-1/2 dgsuikit:border-b dgsuikit:border-r dgsuikit:rounded-br","top-center":"dgsuikit:left-1/2 dgsuikit:-translate-x-1/2 dgsuikit:bottom-0 dgsuikit:translate-y-1/2 dgsuikit:border-b dgsuikit:border-r dgsuikit:rounded-br","top-left":"dgsuikit:right-4 dgsuikit:bottom-0 dgsuikit:translate-y-1/2 dgsuikit:border-b dgsuikit:border-r dgsuikit:rounded-br"},j={"bottom-right":"dgsuikit:bottom-0 dgsuikit:translate-y-[calc(100%+8px)] dgsuikit:left-0","bottom-center":"dgsuikit:bottom-0 dgsuikit:translate-y-[calc(100%+8px)] dgsuikit:left-1/2 dgsuikit:-translate-x-1/2","bottom-left":"dgsuikit:bottom-0 dgsuikit:translate-y-[calc(100%+8px)] dgsuikit:right-0","top-right":"dgsuikit:top-0 dgsuikit:-translate-y-[calc(100%+8px)] dgsuikit:left-0","top-center":"dgsuikit:top-0 dgsuikit:-translate-y-[calc(100%+8px)] dgsuikit:left-1/2 dgsuikit:-translate-x-1/2","top-left":"dgsuikit:top-0 dgsuikit:-translate-y-[calc(100%+8px)] dgsuikit:right-0"},v=l=>{const{children:c,content:p,className:b,wrapperClassName:x,footer:f,icon:s,position:d="top-center",title:e}=l,[h,u]=n.useState(!1),[o,m]=n.useState(d),{anchorRef:y,popperRef:N}=S.useFlipPosition({initialPosition:d,onPositionChange(k){m(a=>a===k?a:k)}});function r(){u(!0)}function g(){u(!1)}return t.jsxs("div",{ref:y,className:i.clsx("dgsuikit:relative",x),onMouseEnter:r,onTouchStart:r,onMouseLeave:g,onTouchEnd:g,children:[c,t.jsxs("div",{ref:N,className:i.clsx(b,"dgsuikit:absolute dgsuikit:p-4 dgsuikit:flex dgsuikit:gap-2 dgsuikit:max-w-[400px] dgsuikit:bg-gray-700 dgsuikit:text-white dgsuikit:rounded-lg dgsuikit:border dgsuikit:border-gray-300 dgsuikit:shadow-md dgsuikit:transition dgsuikit:duration-300 dgsuikit:w-max",h?"dgsuikit:opacity-100 dgsuikit:scale-100":"dgsuikit:opacity-0 dgsuikit:scale-0",j[o]),children:[s&&t.jsx("span",{className:"dgsuikit:shrink-0 dgsuikit:[&_svg]:size-5 dgsuikit:pt-1",children:s}),t.jsxs("div",{className:"dgsuikit:flex dgsuikit:flex-col dgsuikit:gap-1 dgsuikit:font-p2-regular",children:[e&&t.jsx("div",{className:"dgsuikit:font-h5-bold",children:e}),p,f]}),t.jsx("div",{className:i.clsx("dgsuikit:w-4 dgsuikit:h-4 dgsuikit:bg-gray-700 dgsuikit:border-gray-300 dgsuikit:absolute dgsuikit:rotate-45",T[o])})]})]})};module.exports=v;
|
package/dist/Tooltip/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsxs as t, jsx as i } from "react/jsx-runtime";
|
|
3
3
|
import { c as s } from "../clsx-OuTLNxxd.js";
|
|
4
4
|
import { useState as n } from "react";
|
|
5
|
-
import { u as T } from "../useFlipPosition-
|
|
5
|
+
import { u as T } from "../useFlipPosition-BWxiBDQ_.js";
|
|
6
6
|
import '../assets/styles.css';/* empty css */
|
|
7
7
|
const v = {
|
|
8
8
|
"bottom-right": "dgsuikit:left-4 dgsuikit:top-0 dgsuikit:-translate-y-1/2 dgsuikit:border-t dgsuikit:border-l dgsuikit:rounded-tl",
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { d as z } from "./index-CzwAoGdL.js";
|
|
2
|
+
import { useRef as w, useState as C, useCallback as H, useMemo as L, useEffect as S } from "react";
|
|
3
|
+
function B(t) {
|
|
4
|
+
return t.startsWith("top") ? t.replace("top", "bottom") : t.replace("bottom", "top");
|
|
5
|
+
}
|
|
6
|
+
function F(t) {
|
|
7
|
+
return t.endsWith("left") ? t.replace("left", "right") : t.endsWith("right") ? t.replace("right", "left") : t;
|
|
8
|
+
}
|
|
9
|
+
function T(t, e) {
|
|
10
|
+
return t.endsWith("center") ? e.left && !e.right ? t.replace("center", "right") : e.right && !e.left ? t.replace("center", "left") : t : t;
|
|
11
|
+
}
|
|
12
|
+
function $(t, e) {
|
|
13
|
+
const r = RegExp(/matrix\(([^)]+)\)/).exec(t);
|
|
14
|
+
if (!r) return `scale(${e})`;
|
|
15
|
+
const n = r[1].split(",").map((s) => parseFloat(s.trim()));
|
|
16
|
+
return n.length !== 6 ? `scale(${e})` : (n[0] = e, n[3] = e, `matrix(${n.join(", ")})`);
|
|
17
|
+
}
|
|
18
|
+
function j(t, e) {
|
|
19
|
+
let r;
|
|
20
|
+
switch (t) {
|
|
21
|
+
case "top-left":
|
|
22
|
+
case "bottom-left":
|
|
23
|
+
r = e.left;
|
|
24
|
+
break;
|
|
25
|
+
case "top-right":
|
|
26
|
+
case "bottom-right":
|
|
27
|
+
r = e.right;
|
|
28
|
+
break;
|
|
29
|
+
case "top-center":
|
|
30
|
+
case "bottom-center":
|
|
31
|
+
default:
|
|
32
|
+
r = e.left + e.width / 2;
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
const n = t.startsWith("top") ? e.top : e.bottom;
|
|
36
|
+
return { anchorX: r, anchorY: n };
|
|
37
|
+
}
|
|
38
|
+
function A(t, e, r, n) {
|
|
39
|
+
let s = 0, l = 0;
|
|
40
|
+
switch (t) {
|
|
41
|
+
case "top-left":
|
|
42
|
+
case "bottom-left":
|
|
43
|
+
s = e;
|
|
44
|
+
break;
|
|
45
|
+
case "top-center":
|
|
46
|
+
case "bottom-center":
|
|
47
|
+
s = e - n.width / 2;
|
|
48
|
+
break;
|
|
49
|
+
case "top-right":
|
|
50
|
+
case "bottom-right":
|
|
51
|
+
s = e - n.width;
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
switch (t) {
|
|
55
|
+
case "top-left":
|
|
56
|
+
case "top-center":
|
|
57
|
+
case "top-right":
|
|
58
|
+
l = r - n.height;
|
|
59
|
+
break;
|
|
60
|
+
case "bottom-left":
|
|
61
|
+
case "bottom-center":
|
|
62
|
+
case "bottom-right":
|
|
63
|
+
l = r;
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
return { top: l, left: s };
|
|
67
|
+
}
|
|
68
|
+
function I(t, e, r, n, s, l, c) {
|
|
69
|
+
const h = t < l, m = t + r.height > s - l, u = e < l, f = e + r.width > n - l;
|
|
70
|
+
if (!c)
|
|
71
|
+
return {
|
|
72
|
+
top: h,
|
|
73
|
+
bottom: m,
|
|
74
|
+
left: u,
|
|
75
|
+
right: f
|
|
76
|
+
};
|
|
77
|
+
const i = Math.min(r.bottom, s) - Math.max(t, 0), o = Math.min(r.right, n) - Math.max(e, 0), g = h && m ? i >= c ? { top: !1, bottom: !1 } : i < r.height / 2 ? { top: !0, bottom: !1 } : { top: !1, bottom: !0 } : h ? { top: i < c, bottom: !1 } : m ? { top: !1, bottom: i < c } : { top: !1, bottom: !1 }, b = u && f ? o >= c ? { left: !1, right: !1 } : o < r.width / 2 ? { left: !0, right: !1 } : { left: !1, right: !0 } : u ? { left: o < c, right: !1 } : f ? { left: !1, right: o < c } : { left: !1, right: !1 };
|
|
78
|
+
return {
|
|
79
|
+
top: g.top,
|
|
80
|
+
bottom: g.bottom,
|
|
81
|
+
left: b.left,
|
|
82
|
+
right: b.right
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function q({
|
|
86
|
+
initialPosition: t,
|
|
87
|
+
onPositionChange: e,
|
|
88
|
+
padding: r = 8,
|
|
89
|
+
debounceWait: n = 50,
|
|
90
|
+
minVisible: s
|
|
91
|
+
}) {
|
|
92
|
+
const l = w(null), c = w(null), [h, m] = C(t), u = H(() => {
|
|
93
|
+
const i = l.current, o = c.current;
|
|
94
|
+
if (!i || !o) return;
|
|
95
|
+
const g = i.getBoundingClientRect(), { anchorX: b, anchorY: v } = j(t, g), d = window.getComputedStyle(o), W = d.display !== "none" && d.visibility !== "hidden" && d.opacity !== "0";
|
|
96
|
+
let y;
|
|
97
|
+
if (W)
|
|
98
|
+
y = o.getBoundingClientRect();
|
|
99
|
+
else {
|
|
100
|
+
const M = d.transform || "none", O = $(M, 1);
|
|
101
|
+
o.style.setProperty("opacity", "0", "important"), o.style.setProperty("transform", O, "important"), o.style.setProperty("visibility", "hidden", "important"), o.style.setProperty("position", "absolute", "important"), o.style.setProperty("transition", "none", "important"), o.offsetHeight, y = o.getBoundingClientRect(), o.style.removeProperty("opacity"), o.style.removeProperty("transform"), o.style.removeProperty("visibility"), o.style.removeProperty("position"), o.style.removeProperty("transition");
|
|
102
|
+
}
|
|
103
|
+
const k = window.innerWidth, x = window.innerHeight, { top: E, left: P } = A(t, b, v, y), p = I(
|
|
104
|
+
E,
|
|
105
|
+
P,
|
|
106
|
+
y,
|
|
107
|
+
k,
|
|
108
|
+
x,
|
|
109
|
+
r,
|
|
110
|
+
s
|
|
111
|
+
);
|
|
112
|
+
let a = t;
|
|
113
|
+
(t.startsWith("top") && p.top || t.startsWith("bottom") && p.bottom) && (a = B(a)), (t.endsWith("left") && p.left || t.endsWith("right") && p.right) && (a = F(a)), a.endsWith("center") && (a = T(a, p)), a !== h && (m(a), e && e(a));
|
|
114
|
+
}, [e, r]), f = L(
|
|
115
|
+
() => z(u, n),
|
|
116
|
+
[u, n]
|
|
117
|
+
);
|
|
118
|
+
return S(() => (f(), window.addEventListener("resize", f), window.addEventListener("scroll", f), () => {
|
|
119
|
+
window.removeEventListener("resize", f), window.removeEventListener("scroll", f), f.cancel();
|
|
120
|
+
}), [f]), { anchorRef: l, popperRef: c, position: h };
|
|
121
|
+
}
|
|
122
|
+
export {
|
|
123
|
+
q as u
|
|
124
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const z=require("./index-BfuaA-Ji.cjs"),m=require("react");function C(t){return t.startsWith("top")?t.replace("top","bottom"):t.replace("bottom","top")}function H(t){return t.endsWith("left")?t.replace("left","right"):t.endsWith("right")?t.replace("right","left"):t}function L(t,e){return t.endsWith("center")?e.left&&!e.right?t.replace("center","right"):e.right&&!e.left?t.replace("center","left"):t:t}function S(t,e){const r=RegExp(/matrix\(([^)]+)\)/).exec(t);if(!r)return`scale(${e})`;const n=r[1].split(",").map(s=>parseFloat(s.trim()));return n.length!==6?`scale(${e})`:(n[0]=e,n[3]=e,`matrix(${n.join(", ")})`)}function B(t,e){let r;switch(t){case"top-left":case"bottom-left":r=e.left;break;case"top-right":case"bottom-right":r=e.right;break;case"top-center":case"bottom-center":default:r=e.left+e.width/2;break}const n=t.startsWith("top")?e.top:e.bottom;return{anchorX:r,anchorY:n}}function F(t,e,r,n){let s=0,l=0;switch(t){case"top-left":case"bottom-left":s=e;break;case"top-center":case"bottom-center":s=e-n.width/2;break;case"top-right":case"bottom-right":s=e-n.width;break}switch(t){case"top-left":case"top-center":case"top-right":l=r-n.height;break;case"bottom-left":case"bottom-center":case"bottom-right":l=r;break}return{top:l,left:s}}function T(t,e,r,n,s,l,f){const u=t<l,p=t+r.height>s-l,h=e<l,c=e+r.width>n-l;if(!f)return{top:u,bottom:p,left:h,right:c};const a=Math.min(r.bottom,s)-Math.max(t,0),o=Math.min(r.right,n)-Math.max(e,0),b=u&&p?a>=f?{top:!1,bottom:!1}:a<r.height/2?{top:!0,bottom:!1}:{top:!1,bottom:!0}:u?{top:a<f,bottom:!1}:p?{top:!1,bottom:a<f}:{top:!1,bottom:!1},d=h&&c?o>=f?{left:!1,right:!1}:o<r.width/2?{left:!0,right:!1}:{left:!1,right:!0}:h?{left:o<f,right:!1}:c?{left:!1,right:o<f}:{left:!1,right:!1};return{top:b.top,bottom:b.bottom,left:d.left,right:d.right}}function $({initialPosition:t,onPositionChange:e,padding:r=8,debounceWait:n=50,minVisible:s}){const l=m.useRef(null),f=m.useRef(null),[u,p]=m.useState(t),h=m.useCallback(()=>{const a=l.current,o=f.current;if(!a||!o)return;const b=a.getBoundingClientRect(),{anchorX:d,anchorY:v}=B(t,b),y=window.getComputedStyle(o),W=y.display!=="none"&&y.visibility!=="hidden"&&y.opacity!=="0";let w;if(W)w=o.getBoundingClientRect();else{const M=y.transform||"none",O=S(M,1);o.style.setProperty("opacity","0","important"),o.style.setProperty("transform",O,"important"),o.style.setProperty("visibility","hidden","important"),o.style.setProperty("position","absolute","important"),o.style.setProperty("transition","none","important"),o.offsetHeight,w=o.getBoundingClientRect(),o.style.removeProperty("opacity"),o.style.removeProperty("transform"),o.style.removeProperty("visibility"),o.style.removeProperty("position"),o.style.removeProperty("transition")}const k=window.innerWidth,P=window.innerHeight,{top:x,left:E}=F(t,d,v,w),g=T(x,E,w,k,P,r,s);let i=t;(t.startsWith("top")&&g.top||t.startsWith("bottom")&&g.bottom)&&(i=C(i)),(t.endsWith("left")&&g.left||t.endsWith("right")&&g.right)&&(i=H(i)),i.endsWith("center")&&(i=L(i,g)),i!==u&&(p(i),e&&e(i))},[e,r]),c=m.useMemo(()=>z.debounce(h,n),[h,n]);return m.useEffect(()=>(c(),window.addEventListener("resize",c),window.addEventListener("scroll",c),()=>{window.removeEventListener("resize",c),window.removeEventListener("scroll",c),c.cancel()}),[c]),{anchorRef:l,popperRef:f,position:u}}exports.useFlipPosition=$;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const L=require("./index-BfuaA-Ji.cjs"),a=require("react");function S(t){return t.startsWith("top")?t.replace("top","bottom"):t.replace("bottom","top")}function B(t){return t.endsWith("left")?t.replace("left","right"):t.endsWith("right")?t.replace("right","left"):t}function F(t,e){return t.endsWith("center")?e.left&&!e.right?t.replace("center","right"):e.right&&!e.left?t.replace("center","left"):t:t}function T(t,e){const r=RegExp(/matrix\(([^)]+)\)/).exec(t);if(!r)return`scale(${e})`;const n=r[1].split(",").map(l=>parseFloat(l.trim()));return n.length!==6?`scale(${e})`:(n[0]=e,n[3]=e,`matrix(${n.join(", ")})`)}function $(t,e){let r;switch(t){case"top-left":case"bottom-left":r=e.left;break;case"top-center":case"bottom-center":r=e.left+e.width/2;break;case"top-right":case"bottom-right":r=e.right;break;default:r=e.left+e.width/2}const n=t.startsWith("top")?e.top:e.bottom;return{anchorX:r,anchorY:n}}function q(t,e,r,n){let l=0,f=0;switch(t){case"top-left":case"bottom-left":l=e;break;case"top-center":case"bottom-center":l=e-n.width/2;break;case"top-right":case"bottom-right":l=e-n.width;break}switch(t){case"top-left":case"top-center":case"top-right":f=r-n.height;break;case"bottom-left":case"bottom-center":case"bottom-right":f=r;break}return{top:f,left:l}}function R(t,e,r,n,l,f,c){const u=t<f,g=t+r.height>l-f,m=e<f,p=e+r.width>n-f;if(c==null)return{top:u,bottom:g,left:m,right:p};const h=Math.min(r.bottom,l)-Math.max(t,0),s=Math.min(r.right,n)-Math.max(e,0),b=u&&g?h>=c?{top:!1,bottom:!1}:h<r.height/2?{top:!0,bottom:!1}:{top:!1,bottom:!0}:u?{top:h<c,bottom:!1}:g?{top:!1,bottom:h<c}:{top:!1,bottom:!1},o=m&&p?s>=c?{left:!1,right:!1}:s<r.width/2?{left:!0,right:!1}:{left:!1,right:!0}:m?{left:s<c,right:!1}:p?{left:!1,right:s<c}:{left:!1,right:!1};return{top:b.top,bottom:b.bottom,left:o.left,right:o.right}}function j({initialPosition:t,onPositionChange:e,padding:r=8,debounceWait:n=50,minVisible:l}){const f=a.useRef(null),c=a.useRef(null),[u,g]=a.useState(t),m=a.useRef(t);a.useEffect(()=>{m.current=t},[t]);const p=a.useRef(u);a.useEffect(()=>{p.current=u},[u]);const h=a.useCallback(()=>{const b=f.current,o=c.current;if(!b||!o)return;const d=m.current,P=b.getBoundingClientRect(),{anchorX:W,anchorY:E}=$(d,P),y=window.getComputedStyle(o),k=y.display!=="none"&&y.visibility!=="hidden"&&y.opacity!=="0";let v;if(k)v=o.getBoundingClientRect();else{const C=y.transform||"none",H=T(C,1);o.style.setProperty("opacity","0","important"),o.style.setProperty("transform",H,"important"),o.style.setProperty("visibility","hidden","important"),o.style.setProperty("position","absolute","important"),o.style.setProperty("transition","none","important"),o.offsetHeight,v=o.getBoundingClientRect(),o.style.removeProperty("opacity"),o.style.removeProperty("transform"),o.style.removeProperty("visibility"),o.style.removeProperty("position"),o.style.removeProperty("transition")}const x=window.innerWidth,M=window.innerHeight,{top:O,left:z}=q(d,W,E,v),w=R(O,z,v,x,M,r,l);let i=d;(d.startsWith("top")&&w.top||d.startsWith("bottom")&&w.bottom)&&(i=S(i)),(i.endsWith("left")&&w.left||i.endsWith("right")&&w.right)&&(i=B(i)),i.endsWith("center")&&(i=F(i,w)),i!==p.current&&(g(i),e&&e(i))},[e,r]),s=a.useMemo(()=>L.debounce(h,n),[h,n]);return a.useEffect(()=>(s(),window.addEventListener("resize",s),window.addEventListener("scroll",s),()=>{window.removeEventListener("resize",s),window.removeEventListener("scroll",s),s.cancel()}),[s]),{anchorRef:f,popperRef:c,position:u}}exports.useFlipPosition=j;
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { d as S } from "./index-CzwAoGdL.js";
|
|
2
|
-
import { useRef as v, useState as B, useEffect as P, useCallback as F, useMemo as T } from "react";
|
|
3
|
-
function $(t) {
|
|
4
|
-
return t.startsWith("top") ? t.replace("top", "bottom") : t.replace("bottom", "top");
|
|
5
|
-
}
|
|
6
|
-
function j(t) {
|
|
7
|
-
return t.endsWith("left") ? t.replace("left", "right") : t.endsWith("right") ? t.replace("right", "left") : t;
|
|
8
|
-
}
|
|
9
|
-
function A(t, e) {
|
|
10
|
-
return t.endsWith("center") ? e.left && !e.right ? t.replace("center", "right") : e.right && !e.left ? t.replace("center", "left") : t : t;
|
|
11
|
-
}
|
|
12
|
-
function I(t, e) {
|
|
13
|
-
const r = RegExp(/matrix\(([^)]+)\)/).exec(t);
|
|
14
|
-
if (!r) return `scale(${e})`;
|
|
15
|
-
const n = r[1].split(",").map((l) => parseFloat(l.trim()));
|
|
16
|
-
return n.length !== 6 ? `scale(${e})` : (n[0] = e, n[3] = e, `matrix(${n.join(", ")})`);
|
|
17
|
-
}
|
|
18
|
-
function U(t, e) {
|
|
19
|
-
let r;
|
|
20
|
-
switch (t) {
|
|
21
|
-
case "top-left":
|
|
22
|
-
case "bottom-left":
|
|
23
|
-
r = e.left;
|
|
24
|
-
break;
|
|
25
|
-
case "top-center":
|
|
26
|
-
case "bottom-center":
|
|
27
|
-
r = e.left + e.width / 2;
|
|
28
|
-
break;
|
|
29
|
-
case "top-right":
|
|
30
|
-
case "bottom-right":
|
|
31
|
-
r = e.right;
|
|
32
|
-
break;
|
|
33
|
-
default:
|
|
34
|
-
r = e.left + e.width / 2;
|
|
35
|
-
}
|
|
36
|
-
const n = t.startsWith("top") ? e.top : e.bottom;
|
|
37
|
-
return { anchorX: r, anchorY: n };
|
|
38
|
-
}
|
|
39
|
-
function Y(t, e, r, n) {
|
|
40
|
-
let l = 0, f = 0;
|
|
41
|
-
switch (t) {
|
|
42
|
-
case "top-left":
|
|
43
|
-
case "bottom-left":
|
|
44
|
-
l = e;
|
|
45
|
-
break;
|
|
46
|
-
case "top-center":
|
|
47
|
-
case "bottom-center":
|
|
48
|
-
l = e - n.width / 2;
|
|
49
|
-
break;
|
|
50
|
-
case "top-right":
|
|
51
|
-
case "bottom-right":
|
|
52
|
-
l = e - n.width;
|
|
53
|
-
break;
|
|
54
|
-
}
|
|
55
|
-
switch (t) {
|
|
56
|
-
case "top-left":
|
|
57
|
-
case "top-center":
|
|
58
|
-
case "top-right":
|
|
59
|
-
f = r - n.height;
|
|
60
|
-
break;
|
|
61
|
-
case "bottom-left":
|
|
62
|
-
case "bottom-center":
|
|
63
|
-
case "bottom-right":
|
|
64
|
-
f = r;
|
|
65
|
-
break;
|
|
66
|
-
}
|
|
67
|
-
return { top: f, left: l };
|
|
68
|
-
}
|
|
69
|
-
function q(t, e, r, n, l, f, c) {
|
|
70
|
-
const a = t < f, p = t + r.height > l - f, h = e < f, m = e + r.width > n - f;
|
|
71
|
-
if (c == null)
|
|
72
|
-
return {
|
|
73
|
-
top: a,
|
|
74
|
-
bottom: p,
|
|
75
|
-
left: h,
|
|
76
|
-
right: m
|
|
77
|
-
};
|
|
78
|
-
const u = Math.min(r.bottom, l) - Math.max(t, 0), s = Math.min(r.right, n) - Math.max(e, 0), g = a && p ? u >= c ? { top: !1, bottom: !1 } : u < r.height / 2 ? { top: !0, bottom: !1 } : { top: !1, bottom: !0 } : a ? { top: u < c, bottom: !1 } : p ? { top: !1, bottom: u < c } : { top: !1, bottom: !1 }, o = h && m ? s >= c ? { left: !1, right: !1 } : s < r.width / 2 ? { left: !0, right: !1 } : { left: !1, right: !0 } : h ? { left: s < c, right: !1 } : m ? { left: !1, right: s < c } : { left: !1, right: !1 };
|
|
79
|
-
return {
|
|
80
|
-
top: g.top,
|
|
81
|
-
bottom: g.bottom,
|
|
82
|
-
left: o.left,
|
|
83
|
-
right: o.right
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
function J({
|
|
87
|
-
initialPosition: t,
|
|
88
|
-
onPositionChange: e,
|
|
89
|
-
padding: r = 8,
|
|
90
|
-
debounceWait: n = 50,
|
|
91
|
-
minVisible: l
|
|
92
|
-
}) {
|
|
93
|
-
const f = v(null), c = v(null), [a, p] = B(t), h = v(t);
|
|
94
|
-
P(() => {
|
|
95
|
-
h.current = t;
|
|
96
|
-
}, [t]);
|
|
97
|
-
const m = v(a);
|
|
98
|
-
P(() => {
|
|
99
|
-
m.current = a;
|
|
100
|
-
}, [a]);
|
|
101
|
-
const u = F(() => {
|
|
102
|
-
const g = f.current, o = c.current;
|
|
103
|
-
if (!g || !o) return;
|
|
104
|
-
const b = h.current, W = g.getBoundingClientRect(), { anchorX: k, anchorY: x } = U(b, W), w = window.getComputedStyle(o), E = w.display !== "none" && w.visibility !== "hidden" && w.opacity !== "0";
|
|
105
|
-
let y;
|
|
106
|
-
if (E)
|
|
107
|
-
y = o.getBoundingClientRect();
|
|
108
|
-
else {
|
|
109
|
-
const H = w.transform || "none", L = I(H, 1);
|
|
110
|
-
o.style.setProperty("opacity", "0", "important"), o.style.setProperty("transform", L, "important"), o.style.setProperty("visibility", "hidden", "important"), o.style.setProperty("position", "absolute", "important"), o.style.setProperty("transition", "none", "important"), o.offsetHeight, y = o.getBoundingClientRect(), o.style.removeProperty("opacity"), o.style.removeProperty("transform"), o.style.removeProperty("visibility"), o.style.removeProperty("position"), o.style.removeProperty("transition");
|
|
111
|
-
}
|
|
112
|
-
const M = window.innerWidth, O = window.innerHeight, { top: z, left: C } = Y(b, k, x, y), d = q(
|
|
113
|
-
z,
|
|
114
|
-
C,
|
|
115
|
-
y,
|
|
116
|
-
M,
|
|
117
|
-
O,
|
|
118
|
-
r,
|
|
119
|
-
l
|
|
120
|
-
);
|
|
121
|
-
let i = b;
|
|
122
|
-
(b.startsWith("top") && d.top || b.startsWith("bottom") && d.bottom) && (i = $(i)), (i.endsWith("left") && d.left || i.endsWith("right") && d.right) && (i = j(i)), i.endsWith("center") && (i = A(i, d)), i !== m.current && (p(i), e && e(i));
|
|
123
|
-
}, [e, r]), s = T(
|
|
124
|
-
() => S(u, n),
|
|
125
|
-
[u, n]
|
|
126
|
-
);
|
|
127
|
-
return P(() => (s(), window.addEventListener("resize", s), window.addEventListener("scroll", s), () => {
|
|
128
|
-
window.removeEventListener("resize", s), window.removeEventListener("scroll", s), s.cancel();
|
|
129
|
-
}), [s]), { anchorRef: f, popperRef: c, position: a };
|
|
130
|
-
}
|
|
131
|
-
export {
|
|
132
|
-
J as u
|
|
133
|
-
};
|