@bymarcant/easy-time-input 1.0.0
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/.eslintrc.cjs +18 -0
- package/.hintrc +13 -0
- package/README.md +192 -0
- package/dist/easy-time-input.css +1 -0
- package/dist/easy-time-input.es.js +3896 -0
- package/dist/easy-time-input.umd.js +12 -0
- package/dist/index.d.ts +282 -0
- package/index.html +19 -0
- package/package.json +76 -0
- package/tailwind.config.js +9 -0
- package/tsconfig.json +25 -0
- package/tsconfig.node.json +10 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
(function(ne,O){typeof exports=="object"&&typeof module<"u"?O(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],O):(ne=typeof globalThis<"u"?globalThis:ne||self,O(ne.EasyTimeInput={},ne.React))})(this,(function(ne,O){"use strict";function Qe(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,r.get?r:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const te=Qe(O);var we={exports:{}},pe={};var Ae;function et(){if(Ae)return pe;Ae=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function o(r,s,a){var i=null;if(a!==void 0&&(i=""+a),s.key!==void 0&&(i=""+s.key),"key"in s){a={};for(var d in s)d!=="key"&&(a[d]=s[d])}else a=s;return s=a.ref,{$$typeof:e,type:r,key:i,ref:s!==void 0?s:null,props:a}}return pe.Fragment=t,pe.jsx=o,pe.jsxs=o,pe}var be={};var Pe;function tt(){return Pe||(Pe=1,process.env.NODE_ENV!=="production"&&(function(){function e(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===J?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case R:return"Fragment";case U:return"Profiler";case V:return"StrictMode";case L:return"Suspense";case _:return"SuspenseList";case M:return"Activity"}if(typeof n=="object")switch(typeof n.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),n.$$typeof){case y:return"Portal";case W:return n.displayName||"Context";case z:return(n._context.displayName||"Context")+".Consumer";case B:var h=n.render;return n=n.displayName,n||(n=h.displayName||h.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case c:return h=n.displayName||null,h!==null?h:e(n.type)||"Memo";case b:h=n._payload,n=n._init;try{return e(n(h))}catch{}}return null}function t(n){return""+n}function o(n){try{t(n);var h=!1}catch{h=!0}if(h){h=console;var x=h.error,g=typeof Symbol=="function"&&Symbol.toStringTag&&n[Symbol.toStringTag]||n.constructor.name||"Object";return x.call(h,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",g),t(n)}}function r(n){if(n===R)return"<>";if(typeof n=="object"&&n!==null&&n.$$typeof===b)return"<...>";try{var h=e(n);return h?"<"+h+">":"<...>"}catch{return"<...>"}}function s(){var n=q.A;return n===null?null:n.getOwner()}function a(){return Error("react-stack-top-frame")}function i(n){if(ie.call(n,"key")){var h=Object.getOwnPropertyDescriptor(n,"key").get;if(h&&h.isReactWarning)return!1}return n.key!==void 0}function d(n,h){function x(){F||(F=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",h))}x.isReactWarning=!0,Object.defineProperty(n,"key",{get:x,configurable:!0})}function l(){var n=e(this.type);return H[n]||(H[n]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),n=this.props.ref,n!==void 0?n:null}function w(n,h,x,g,X,oe){var k=x.ref;return n={$$typeof:f,type:n,key:h,props:x,_owner:g},(k!==void 0?k:null)!==null?Object.defineProperty(n,"ref",{enumerable:!1,get:l}):Object.defineProperty(n,"ref",{enumerable:!1,value:null}),n._store={},Object.defineProperty(n._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(n,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(n,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:X}),Object.defineProperty(n,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:oe}),Object.freeze&&(Object.freeze(n.props),Object.freeze(n)),n}function C(n,h,x,g,X,oe){var k=h.children;if(k!==void 0)if(g)if(le(k)){for(g=0;g<k.length;g++)P(k[g]);Object.freeze&&Object.freeze(k)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else P(k);if(ie.call(h,"key")){k=e(n);var T=Object.keys(h).filter(function(N){return N!=="key"});g=0<T.length?"{key: someKey, "+T.join(": ..., ")+": ...}":"{key: someKey}",K[k+g]||(T=0<T.length?"{"+T.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
|
+
let props = %s;
|
|
3
|
+
<%s {...props} />
|
|
4
|
+
React keys must be passed directly to JSX without using spread:
|
|
5
|
+
let props = %s;
|
|
6
|
+
<%s key={someKey} {...props} />`,g,k,T,k),K[k+g]=!0)}if(k=null,x!==void 0&&(o(x),k=""+x),i(h)&&(o(h.key),k=""+h.key),"key"in h){x={};for(var E in h)E!=="key"&&(x[E]=h[E])}else x=h;return k&&d(x,typeof n=="function"?n.displayName||n.name||"Unknown":n),w(n,k,x,s(),X,oe)}function P(n){A(n)?n._store&&(n._store.validated=1):typeof n=="object"&&n!==null&&n.$$typeof===b&&(n._payload.status==="fulfilled"?A(n._payload.value)&&n._payload.value._store&&(n._payload.value._store.validated=1):n._store&&(n._store.validated=1))}function A(n){return typeof n=="object"&&n!==null&&n.$$typeof===f}var $=O,f=Symbol.for("react.transitional.element"),y=Symbol.for("react.portal"),R=Symbol.for("react.fragment"),V=Symbol.for("react.strict_mode"),U=Symbol.for("react.profiler"),z=Symbol.for("react.consumer"),W=Symbol.for("react.context"),B=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),c=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),M=Symbol.for("react.activity"),J=Symbol.for("react.client.reference"),q=$.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ie=Object.prototype.hasOwnProperty,le=Array.isArray,Y=console.createTask?console.createTask:function(){return null};$={react_stack_bottom_frame:function(n){return n()}};var F,H={},p=$.react_stack_bottom_frame.bind($,a)(),ee=Y(r(a)),K={};be.Fragment=R,be.jsx=function(n,h,x){var g=1e4>q.recentlyCreatedOwnerStacks++;return C(n,h,x,!1,g?Error("react-stack-top-frame"):p,g?Y(r(n)):ee)},be.jsxs=function(n,h,x){var g=1e4>q.recentlyCreatedOwnerStacks++;return C(n,h,x,!0,g?Error("react-stack-top-frame"):p,g?Y(r(n)):ee)}})()),be}var Re;function rt(){return Re||(Re=1,process.env.NODE_ENV==="production"?we.exports=et():we.exports=tt()),we.exports}var S=rt();const se=e=>{e.current?.select(),e.current?.focus()},ge=(e,t,o)=>{let r,s,a=!0;if(t&&t instanceof Date?r=new Date(t).toLocaleTimeString("en",{hour12:!1}):r=t,o&&o instanceof Date?s=new Date(o).toLocaleTimeString("en",{hour12:!1}):s=o,r){const i=r.split(":");let d=e.split(":");d.length===1&&(d=[d[0],"00"]);const l=new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate(),parseInt(i[0]),parseInt(i[1]));new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate(),parseInt(d[0]),parseInt(d[1])).getTime()>l.getTime()&&(a=!1)}if(s){const i=s.split(":");let d=e.split(":");d.length===1&&(d=[d[0],"00"]);const l=new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate(),parseInt(i[0]),parseInt(i[1]));new Date(new Date().getFullYear(),new Date().getMonth(),new Date().getDate(),parseInt(d[0]),parseInt(d[1])).getTime()<l.getTime()&&(a=!1)}return a};function Ne(e){var t,o,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(o=Ne(e[t]))&&(r&&(r+=" "),r+=o)}else for(o in e)e[o]&&(r&&(r+=" "),r+=o);return r}function ot(){for(var e,t,o=0,r="",s=arguments.length;o<s;o++)(e=arguments[o])&&(t=Ne(e))&&(r&&(r+=" "),r+=t);return r}const nt=(e,t)=>{const o=new Array(e.length+t.length);for(let r=0;r<e.length;r++)o[r]=e[r];for(let r=0;r<t.length;r++)o[e.length+r]=t[r];return o},st=(e,t)=>({classGroupId:e,validator:t}),Ie=(e=new Map,t=null,o)=>({nextPart:e,validators:t,classGroupId:o}),ye="-",Me=[],at="arbitrary..",it=e=>{const t=ct(e),{conflictingClassGroups:o,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return lt(i);const d=i.split(ye),l=d[0]===""&&d.length>1?1:0;return je(d,l,t)},getConflictingClassGroupIds:(i,d)=>{if(d){const l=r[i],w=o[i];return l?w?nt(w,l):l:w||Me}return o[i]||Me}}},je=(e,t,o)=>{if(e.length-t===0)return o.classGroupId;const s=e[t],a=o.nextPart.get(s);if(a){const w=je(e,t+1,a);if(w)return w}const i=o.validators;if(i===null)return;const d=t===0?e.join(ye):e.slice(t).join(ye),l=i.length;for(let w=0;w<l;w++){const C=i[w];if(C.validator(d))return C.classGroupId}},lt=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),o=t.indexOf(":"),r=t.slice(0,o);return r?at+r:void 0})(),ct=e=>{const{theme:t,classGroups:o}=e;return dt(o,t)},dt=(e,t)=>{const o=Ie();for(const r in e){const s=e[r];ve(s,o,r,t)}return o},ve=(e,t,o,r)=>{const s=e.length;for(let a=0;a<s;a++){const i=e[a];ut(i,t,o,r)}},ut=(e,t,o,r)=>{if(typeof e=="string"){mt(e,t,o);return}if(typeof e=="function"){ft(e,t,o,r);return}pt(e,t,o,r)},mt=(e,t,o)=>{const r=e===""?t:Oe(t,e);r.classGroupId=o},ft=(e,t,o,r)=>{if(bt(e)){ve(e(r),t,o,r);return}t.validators===null&&(t.validators=[]),t.validators.push(st(o,e))},pt=(e,t,o,r)=>{const s=Object.entries(e),a=s.length;for(let i=0;i<a;i++){const[d,l]=s[i];ve(l,Oe(t,d),o,r)}},Oe=(e,t)=>{let o=e;const r=t.split(ye),s=r.length;for(let a=0;a<s;a++){const i=r[a];let d=o.nextPart.get(i);d||(d=Ie(),o.nextPart.set(i,d)),o=d}return o},bt=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,gt=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,o=Object.create(null),r=Object.create(null);const s=(a,i)=>{o[a]=i,t++,t>e&&(t=0,r=o,o=Object.create(null))};return{get(a){let i=o[a];if(i!==void 0)return i;if((i=r[a])!==void 0)return s(a,i),i},set(a,i){a in o?o[a]=i:s(a,i)}}},Te="!",De=":",ht=[],ze=(e,t,o,r,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:o,maybePostfixModifierPosition:r,isExternal:s}),wt=e=>{const{prefix:t,experimentalParseClassName:o}=e;let r=s=>{const a=[];let i=0,d=0,l=0,w;const C=s.length;for(let y=0;y<C;y++){const R=s[y];if(i===0&&d===0){if(R===De){a.push(s.slice(l,y)),l=y+1;continue}if(R==="/"){w=y;continue}}R==="["?i++:R==="]"?i--:R==="("?d++:R===")"&&d--}const P=a.length===0?s:s.slice(l);let A=P,$=!1;P.endsWith(Te)?(A=P.slice(0,-1),$=!0):P.startsWith(Te)&&(A=P.slice(1),$=!0);const f=w&&w>l?w-l:void 0;return ze(a,$,A,f)};if(t){const s=t+De,a=r;r=i=>i.startsWith(s)?a(i.slice(s.length)):ze(ht,!1,i,void 0,!0)}if(o){const s=r;r=a=>o({className:a,parseClassName:s})}return r},yt=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((o,r)=>{t.set(o,1e6+r)}),o=>{const r=[];let s=[];for(let a=0;a<o.length;a++){const i=o[a],d=i[0]==="[",l=t.has(i);d||l?(s.length>0&&(s.sort(),r.push(...s),s=[]),r.push(i)):s.push(i)}return s.length>0&&(s.sort(),r.push(...s)),r}},xt=e=>({cache:gt(e.cacheSize),parseClassName:wt(e),sortModifiers:yt(e),...it(e)}),kt=/\s+/,vt=(e,t)=>{const{parseClassName:o,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:a}=t,i=[],d=e.trim().split(kt);let l="";for(let w=d.length-1;w>=0;w-=1){const C=d[w],{isExternal:P,modifiers:A,hasImportantModifier:$,baseClassName:f,maybePostfixModifierPosition:y}=o(C);if(P){l=C+(l.length>0?" "+l:l);continue}let R=!!y,V=r(R?f.substring(0,y):f);if(!V){if(!R){l=C+(l.length>0?" "+l:l);continue}if(V=r(f),!V){l=C+(l.length>0?" "+l:l);continue}R=!1}const U=A.length===0?"":A.length===1?A[0]:a(A).join(":"),z=$?U+Te:U,W=z+V;if(i.indexOf(W)>-1)continue;i.push(W);const B=s(V,R);for(let L=0;L<B.length;++L){const _=B[L];i.push(z+_)}l=C+(l.length>0?" "+l:l)}return l},Tt=(...e)=>{let t=0,o,r,s="";for(;t<e.length;)(o=e[t++])&&(r=Ve(o))&&(s&&(s+=" "),s+=r);return s},Ve=e=>{if(typeof e=="string")return e;let t,o="";for(let r=0;r<e.length;r++)e[r]&&(t=Ve(e[r]))&&(o&&(o+=" "),o+=t);return o},_t=(e,...t)=>{let o,r,s,a;const i=l=>{const w=t.reduce((C,P)=>P(C),e());return o=xt(w),r=o.cache.get,s=o.cache.set,a=d,d(l)},d=l=>{const w=r(l);if(w)return w;const C=vt(l,o);return s(l,C),C};return a=i,(...l)=>a(Tt(...l))},Ct=[],D=e=>{const t=o=>o[e]||Ct;return t.isThemeGetter=!0,t},Le=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Fe=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Et=/^\d+\/\d+$/,St=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,$t=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,At=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Pt=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Rt=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ce=e=>Et.test(e),v=e=>!!e&&!Number.isNaN(Number(e)),re=e=>!!e&&Number.isInteger(Number(e)),_e=e=>e.endsWith("%")&&v(e.slice(0,-1)),Q=e=>St.test(e),Nt=()=>!0,It=e=>$t.test(e)&&!At.test(e),Ge=()=>!1,Mt=e=>Pt.test(e),jt=e=>Rt.test(e),Ot=e=>!u(e)&&!m(e),Dt=e=>de(e,Be,Ge),u=e=>Le.test(e),ae=e=>de(e,Je,It),Ce=e=>de(e,Gt,v),Ue=e=>de(e,He,Ge),zt=e=>de(e,We,jt),xe=e=>de(e,qe,Mt),m=e=>Fe.test(e),he=e=>ue(e,Je),Vt=e=>ue(e,Ut),Ye=e=>ue(e,He),Lt=e=>ue(e,Be),Ft=e=>ue(e,We),ke=e=>ue(e,qe,!0),de=(e,t,o)=>{const r=Le.exec(e);return r?r[1]?t(r[1]):o(r[2]):!1},ue=(e,t,o=!1)=>{const r=Fe.exec(e);return r?r[1]?t(r[1]):o:!1},He=e=>e==="position"||e==="percentage",We=e=>e==="image"||e==="url",Be=e=>e==="length"||e==="size"||e==="bg-size",Je=e=>e==="length",Gt=e=>e==="number",Ut=e=>e==="family-name",qe=e=>e==="shadow",Yt=_t(()=>{const e=D("color"),t=D("font"),o=D("text"),r=D("font-weight"),s=D("tracking"),a=D("leading"),i=D("breakpoint"),d=D("container"),l=D("spacing"),w=D("radius"),C=D("shadow"),P=D("inset-shadow"),A=D("text-shadow"),$=D("drop-shadow"),f=D("blur"),y=D("perspective"),R=D("aspect"),V=D("ease"),U=D("animate"),z=()=>["auto","avoid","all","avoid-page","page","left","right","column"],W=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],B=()=>[...W(),m,u],L=()=>["auto","hidden","clip","visible","scroll"],_=()=>["auto","contain","none"],c=()=>[m,u,l],b=()=>[ce,"full","auto",...c()],M=()=>[re,"none","subgrid",m,u],J=()=>["auto",{span:["full",re,m,u]},re,m,u],q=()=>[re,"auto",m,u],ie=()=>["auto","min","max","fr",m,u],le=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Y=()=>["start","end","center","stretch","center-safe","end-safe"],F=()=>["auto",...c()],H=()=>[ce,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...c()],p=()=>[e,m,u],ee=()=>[...W(),Ye,Ue,{position:[m,u]}],K=()=>["no-repeat",{repeat:["","x","y","space","round"]}],n=()=>["auto","cover","contain",Lt,Dt,{size:[m,u]}],h=()=>[_e,he,ae],x=()=>["","none","full",w,m,u],g=()=>["",v,he,ae],X=()=>["solid","dashed","dotted","double"],oe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],k=()=>[v,_e,Ye,Ue],T=()=>["","none",f,m,u],E=()=>["none",v,m,u],N=()=>["none",v,m,u],me=()=>[v,m,u],fe=()=>[ce,"full",...c()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Q],breakpoint:[Q],color:[Nt],container:[Q],"drop-shadow":[Q],ease:["in","out","in-out"],font:[Ot],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Q],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Q],shadow:[Q],spacing:["px",v],text:[Q],"text-shadow":[Q],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ce,u,m,R]}],container:["container"],columns:[{columns:[v,u,m,d]}],"break-after":[{"break-after":z()}],"break-before":[{"break-before":z()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:B()}],overflow:[{overflow:L()}],"overflow-x":[{"overflow-x":L()}],"overflow-y":[{"overflow-y":L()}],overscroll:[{overscroll:_()}],"overscroll-x":[{"overscroll-x":_()}],"overscroll-y":[{"overscroll-y":_()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:b()}],"inset-x":[{"inset-x":b()}],"inset-y":[{"inset-y":b()}],start:[{start:b()}],end:[{end:b()}],top:[{top:b()}],right:[{right:b()}],bottom:[{bottom:b()}],left:[{left:b()}],visibility:["visible","invisible","collapse"],z:[{z:[re,"auto",m,u]}],basis:[{basis:[ce,"full","auto",d,...c()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[v,ce,"auto","initial","none",u]}],grow:[{grow:["",v,m,u]}],shrink:[{shrink:["",v,m,u]}],order:[{order:[re,"first","last","none",m,u]}],"grid-cols":[{"grid-cols":M()}],"col-start-end":[{col:J()}],"col-start":[{"col-start":q()}],"col-end":[{"col-end":q()}],"grid-rows":[{"grid-rows":M()}],"row-start-end":[{row:J()}],"row-start":[{"row-start":q()}],"row-end":[{"row-end":q()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ie()}],"auto-rows":[{"auto-rows":ie()}],gap:[{gap:c()}],"gap-x":[{"gap-x":c()}],"gap-y":[{"gap-y":c()}],"justify-content":[{justify:[...le(),"normal"]}],"justify-items":[{"justify-items":[...Y(),"normal"]}],"justify-self":[{"justify-self":["auto",...Y()]}],"align-content":[{content:["normal",...le()]}],"align-items":[{items:[...Y(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Y(),{baseline:["","last"]}]}],"place-content":[{"place-content":le()}],"place-items":[{"place-items":[...Y(),"baseline"]}],"place-self":[{"place-self":["auto",...Y()]}],p:[{p:c()}],px:[{px:c()}],py:[{py:c()}],ps:[{ps:c()}],pe:[{pe:c()}],pt:[{pt:c()}],pr:[{pr:c()}],pb:[{pb:c()}],pl:[{pl:c()}],m:[{m:F()}],mx:[{mx:F()}],my:[{my:F()}],ms:[{ms:F()}],me:[{me:F()}],mt:[{mt:F()}],mr:[{mr:F()}],mb:[{mb:F()}],ml:[{ml:F()}],"space-x":[{"space-x":c()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":c()}],"space-y-reverse":["space-y-reverse"],size:[{size:H()}],w:[{w:[d,"screen",...H()]}],"min-w":[{"min-w":[d,"screen","none",...H()]}],"max-w":[{"max-w":[d,"screen","none","prose",{screen:[i]},...H()]}],h:[{h:["screen","lh",...H()]}],"min-h":[{"min-h":["screen","lh","none",...H()]}],"max-h":[{"max-h":["screen","lh",...H()]}],"font-size":[{text:["base",o,he,ae]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,m,Ce]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",_e,u]}],"font-family":[{font:[Vt,u,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,m,u]}],"line-clamp":[{"line-clamp":[v,"none",m,Ce]}],leading:[{leading:[a,...c()]}],"list-image":[{"list-image":["none",m,u]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",m,u]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:p()}],"text-color":[{text:p()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...X(),"wavy"]}],"text-decoration-thickness":[{decoration:[v,"from-font","auto",m,ae]}],"text-decoration-color":[{decoration:p()}],"underline-offset":[{"underline-offset":[v,"auto",m,u]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:c()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",m,u]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",m,u]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ee()}],"bg-repeat":[{bg:K()}],"bg-size":[{bg:n()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},re,m,u],radial:["",m,u],conic:[re,m,u]},Ft,zt]}],"bg-color":[{bg:p()}],"gradient-from-pos":[{from:h()}],"gradient-via-pos":[{via:h()}],"gradient-to-pos":[{to:h()}],"gradient-from":[{from:p()}],"gradient-via":[{via:p()}],"gradient-to":[{to:p()}],rounded:[{rounded:x()}],"rounded-s":[{"rounded-s":x()}],"rounded-e":[{"rounded-e":x()}],"rounded-t":[{"rounded-t":x()}],"rounded-r":[{"rounded-r":x()}],"rounded-b":[{"rounded-b":x()}],"rounded-l":[{"rounded-l":x()}],"rounded-ss":[{"rounded-ss":x()}],"rounded-se":[{"rounded-se":x()}],"rounded-ee":[{"rounded-ee":x()}],"rounded-es":[{"rounded-es":x()}],"rounded-tl":[{"rounded-tl":x()}],"rounded-tr":[{"rounded-tr":x()}],"rounded-br":[{"rounded-br":x()}],"rounded-bl":[{"rounded-bl":x()}],"border-w":[{border:g()}],"border-w-x":[{"border-x":g()}],"border-w-y":[{"border-y":g()}],"border-w-s":[{"border-s":g()}],"border-w-e":[{"border-e":g()}],"border-w-t":[{"border-t":g()}],"border-w-r":[{"border-r":g()}],"border-w-b":[{"border-b":g()}],"border-w-l":[{"border-l":g()}],"divide-x":[{"divide-x":g()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":g()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...X(),"hidden","none"]}],"divide-style":[{divide:[...X(),"hidden","none"]}],"border-color":[{border:p()}],"border-color-x":[{"border-x":p()}],"border-color-y":[{"border-y":p()}],"border-color-s":[{"border-s":p()}],"border-color-e":[{"border-e":p()}],"border-color-t":[{"border-t":p()}],"border-color-r":[{"border-r":p()}],"border-color-b":[{"border-b":p()}],"border-color-l":[{"border-l":p()}],"divide-color":[{divide:p()}],"outline-style":[{outline:[...X(),"none","hidden"]}],"outline-offset":[{"outline-offset":[v,m,u]}],"outline-w":[{outline:["",v,he,ae]}],"outline-color":[{outline:p()}],shadow:[{shadow:["","none",C,ke,xe]}],"shadow-color":[{shadow:p()}],"inset-shadow":[{"inset-shadow":["none",P,ke,xe]}],"inset-shadow-color":[{"inset-shadow":p()}],"ring-w":[{ring:g()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:p()}],"ring-offset-w":[{"ring-offset":[v,ae]}],"ring-offset-color":[{"ring-offset":p()}],"inset-ring-w":[{"inset-ring":g()}],"inset-ring-color":[{"inset-ring":p()}],"text-shadow":[{"text-shadow":["none",A,ke,xe]}],"text-shadow-color":[{"text-shadow":p()}],opacity:[{opacity:[v,m,u]}],"mix-blend":[{"mix-blend":[...oe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":oe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[v]}],"mask-image-linear-from-pos":[{"mask-linear-from":k()}],"mask-image-linear-to-pos":[{"mask-linear-to":k()}],"mask-image-linear-from-color":[{"mask-linear-from":p()}],"mask-image-linear-to-color":[{"mask-linear-to":p()}],"mask-image-t-from-pos":[{"mask-t-from":k()}],"mask-image-t-to-pos":[{"mask-t-to":k()}],"mask-image-t-from-color":[{"mask-t-from":p()}],"mask-image-t-to-color":[{"mask-t-to":p()}],"mask-image-r-from-pos":[{"mask-r-from":k()}],"mask-image-r-to-pos":[{"mask-r-to":k()}],"mask-image-r-from-color":[{"mask-r-from":p()}],"mask-image-r-to-color":[{"mask-r-to":p()}],"mask-image-b-from-pos":[{"mask-b-from":k()}],"mask-image-b-to-pos":[{"mask-b-to":k()}],"mask-image-b-from-color":[{"mask-b-from":p()}],"mask-image-b-to-color":[{"mask-b-to":p()}],"mask-image-l-from-pos":[{"mask-l-from":k()}],"mask-image-l-to-pos":[{"mask-l-to":k()}],"mask-image-l-from-color":[{"mask-l-from":p()}],"mask-image-l-to-color":[{"mask-l-to":p()}],"mask-image-x-from-pos":[{"mask-x-from":k()}],"mask-image-x-to-pos":[{"mask-x-to":k()}],"mask-image-x-from-color":[{"mask-x-from":p()}],"mask-image-x-to-color":[{"mask-x-to":p()}],"mask-image-y-from-pos":[{"mask-y-from":k()}],"mask-image-y-to-pos":[{"mask-y-to":k()}],"mask-image-y-from-color":[{"mask-y-from":p()}],"mask-image-y-to-color":[{"mask-y-to":p()}],"mask-image-radial":[{"mask-radial":[m,u]}],"mask-image-radial-from-pos":[{"mask-radial-from":k()}],"mask-image-radial-to-pos":[{"mask-radial-to":k()}],"mask-image-radial-from-color":[{"mask-radial-from":p()}],"mask-image-radial-to-color":[{"mask-radial-to":p()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":W()}],"mask-image-conic-pos":[{"mask-conic":[v]}],"mask-image-conic-from-pos":[{"mask-conic-from":k()}],"mask-image-conic-to-pos":[{"mask-conic-to":k()}],"mask-image-conic-from-color":[{"mask-conic-from":p()}],"mask-image-conic-to-color":[{"mask-conic-to":p()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ee()}],"mask-repeat":[{mask:K()}],"mask-size":[{mask:n()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",m,u]}],filter:[{filter:["","none",m,u]}],blur:[{blur:T()}],brightness:[{brightness:[v,m,u]}],contrast:[{contrast:[v,m,u]}],"drop-shadow":[{"drop-shadow":["","none",$,ke,xe]}],"drop-shadow-color":[{"drop-shadow":p()}],grayscale:[{grayscale:["",v,m,u]}],"hue-rotate":[{"hue-rotate":[v,m,u]}],invert:[{invert:["",v,m,u]}],saturate:[{saturate:[v,m,u]}],sepia:[{sepia:["",v,m,u]}],"backdrop-filter":[{"backdrop-filter":["","none",m,u]}],"backdrop-blur":[{"backdrop-blur":T()}],"backdrop-brightness":[{"backdrop-brightness":[v,m,u]}],"backdrop-contrast":[{"backdrop-contrast":[v,m,u]}],"backdrop-grayscale":[{"backdrop-grayscale":["",v,m,u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[v,m,u]}],"backdrop-invert":[{"backdrop-invert":["",v,m,u]}],"backdrop-opacity":[{"backdrop-opacity":[v,m,u]}],"backdrop-saturate":[{"backdrop-saturate":[v,m,u]}],"backdrop-sepia":[{"backdrop-sepia":["",v,m,u]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":c()}],"border-spacing-x":[{"border-spacing-x":c()}],"border-spacing-y":[{"border-spacing-y":c()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",m,u]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[v,"initial",m,u]}],ease:[{ease:["linear","initial",V,m,u]}],delay:[{delay:[v,m,u]}],animate:[{animate:["none",U,m,u]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[y,m,u]}],"perspective-origin":[{"perspective-origin":B()}],rotate:[{rotate:E()}],"rotate-x":[{"rotate-x":E()}],"rotate-y":[{"rotate-y":E()}],"rotate-z":[{"rotate-z":E()}],scale:[{scale:N()}],"scale-x":[{"scale-x":N()}],"scale-y":[{"scale-y":N()}],"scale-z":[{"scale-z":N()}],"scale-3d":["scale-3d"],skew:[{skew:me()}],"skew-x":[{"skew-x":me()}],"skew-y":[{"skew-y":me()}],transform:[{transform:[m,u,"","none","gpu","cpu"]}],"transform-origin":[{origin:B()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:fe()}],"translate-x":[{"translate-x":fe()}],"translate-y":[{"translate-y":fe()}],"translate-z":[{"translate-z":fe()}],"translate-none":["translate-none"],accent:[{accent:p()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:p()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",m,u]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":c()}],"scroll-mx":[{"scroll-mx":c()}],"scroll-my":[{"scroll-my":c()}],"scroll-ms":[{"scroll-ms":c()}],"scroll-me":[{"scroll-me":c()}],"scroll-mt":[{"scroll-mt":c()}],"scroll-mr":[{"scroll-mr":c()}],"scroll-mb":[{"scroll-mb":c()}],"scroll-ml":[{"scroll-ml":c()}],"scroll-p":[{"scroll-p":c()}],"scroll-px":[{"scroll-px":c()}],"scroll-py":[{"scroll-py":c()}],"scroll-ps":[{"scroll-ps":c()}],"scroll-pe":[{"scroll-pe":c()}],"scroll-pt":[{"scroll-pt":c()}],"scroll-pr":[{"scroll-pr":c()}],"scroll-pb":[{"scroll-pb":c()}],"scroll-pl":[{"scroll-pl":c()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",m,u]}],fill:[{fill:["none",...p()]}],"stroke-w":[{stroke:[v,he,ae,Ce]}],stroke:[{stroke:["none",...p()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}}),Ht=(e,t)=>{const[o,r,s]=e.split(":"),a=+o%12===0?12:+o%12;switch(t){case"HH:mm:ss":return`${o}:${r}:${s}`;case"HH:mm":return`${o}:${r}`;case"hh:mm:ss":return`${a}:${r}:${s}`;case"hh:mm":return`${a}:${r}`}},G=(...e)=>Yt(ot(e)),Ee=(e,t,o)=>{if(!e)return"00";if(!isNaN(new Date(e).getTime())){const r=new Date(e).getHours();return t?r.toString():o&&o.includes("hh")?r<1?"1":`${r%12}`:r<10?`0${r}`:r.toString()}if(e instanceof Date){const r=new Date(e).getHours();return r<10?`0${r}`:r.toString()}if(typeof e=="string"&&e.includes(":")){const r=e.split(":")[0];if(r===void 0)return t?"1":"00";if(isNaN(parseInt(r)))return"";const s=Ht(e,o);let a=r;if(s)return a=s.split(":")[0],a;if(parseInt(a)<0)return Math.abs(parseInt(a))<10?`0${Math.abs(parseInt(a))}`:`${Math.abs(parseInt(a))}`;if(t){let i;return i=`${+a%12===0?12:+a%12}`,i}else return r.length<2?`0${r}`:r}return t?"1":"00"},Se=e=>{if(!e)return"00";if(!isNaN(new Date(e).getTime())){const t=new Date(e).getMinutes();return t<10?`0${t}`:t.toString()}if(e instanceof Date)return e.getMinutes().toString();if(typeof e=="string"&&e.includes(":")){const t=e.split(":")[1];return t===void 0?"00":isNaN(parseInt(t))?"":Math.abs(parseInt(t))<10?`0${Math.abs(parseInt(t))}`:`${Math.abs(parseInt(t))}`}return"00"},$e=e=>{if(!e)return"00";if(!isNaN(new Date(e).getTime())){const t=new Date(e).getSeconds();return t<10?`0${t}`:t.toString()}if(e instanceof Date)return e.getSeconds().toString();if(typeof e=="string"&&e.includes(":")){const t=e.split(":")[2];return t===void 0?"00":isNaN(parseInt(t))?"":Math.abs(parseInt(t))<10?`0${Math.abs(parseInt(t))}`:`${Math.abs(parseInt(t))}`}return"00"},Wt=(e,t)=>{switch(t.type){case"SET_HOURS":return{...e,hours:t.payload};case"SET_MINUTES":return{...e,minutes:t.payload};case"SET_SECONDS":return{...e,seconds:t.payload};case"TOGGLE_AM":return{...e,isAm:t.payload};case"INPUT_TYPE":return{...e,inputType:t.payload};default:return e}},Bt=({value:e,onChange:t,hasSeconds:o,hour12:r,maxTime:s,minTime:a,format:i})=>{const[d,l]=O.useReducer(Wt,{isAm:!1,inputType:"hours",hours:Ee(e,r,i),minutes:Se(e),seconds:$e(e),hour12:r,format:i}),{isAm:w,inputType:C,hours:P,minutes:A,seconds:$}=d,f=O.useRef(null),y=O.useRef(null),R=O.useRef(null),V=`${P}:${A}:${$}`,U=`${Ee(e,r,i)}:${Se(e)}:${$e(e)}`;O.useEffect(()=>{e&&typeof e=="string"&&+e?.split(":")[0]<12&&r&&l({type:"TOGGLE_AM",payload:!0})},[]),O.useEffect(()=>{!e&&t&&t(V)},[]),O.useEffect(()=>{if(t){const _=U?.split(":")[0],c=U?.split(":")[1],b=U?.split(":")[2];let M=_;!w&&r&&+_<12&&(M=`${+_+12}`),t(`${M}:${c}:${b}`)}},[w]),e&&t&&U!==V&&(l({type:"SET_HOURS",payload:Ee(e,r,i)}),l({type:"SET_MINUTES",payload:Se(e)}),l({type:"SET_SECONDS",payload:$e(e)}));const z=O.useCallback((_,c,b)=>{let M;if(t&&e||e===""&&_&&t){if(M=o?`${_}:${c}:${b}`:`${_}:${c}`,(s||a)&&!ge(M,s,a))return;t(M);return}else{let J;if(J=o?`${_}:${c}:${b}`:`${_}:${c}`,(s||a)&&!ge(J,s,a))return;l({type:"SET_HOURS",payload:_}),l({type:"SET_MINUTES",payload:c}),l({type:"SET_SECONDS",payload:b});return}},[t,e,o]);return{hoursRef:f,minutesRef:y,secondsRef:R,handleHours:_=>{const{currentTarget:c}=_;if(c.value===""){z(c.value,A,$);return}if(c.value&&c.valueAsNumber<24&&c.valueAsNumber>=0){const b=c.value.slice(-2);if(t)if(r)if(w){z(+b%12===0?"0":`${+b}`,A,$);return}else{z(+b%12===0?"0":`${+b+12}`,A,$);return}else{z(b.length<2?`0${b}`:b,A,$);return}else{if((s||a)&&!ge(b,s,a))return;if(i&&i.includes("hh")){const M=+b>11?"12":`${+b<1?"1":+b%12}`;l({type:"SET_HOURS",payload:M})}else{const M=b.length<2?`0${b}`:b;l({type:"SET_HOURS",payload:M})}}}},handleMinutes:_=>{const{currentTarget:c}=_;if(c.value===""){z(P,c.value,$);return}if(c.value&&c.valueAsNumber<60&&c.valueAsNumber>=0){const b=c.value.slice(-2);if(t)z(P,b.length<2?`0${b}`:b,$);else{const M=b.length<2?`0${b}`:b;l({type:"SET_MINUTES",payload:M})}}},handleSeconds:_=>{const{currentTarget:c}=_;if(c.value===""){z(P,A,c.value);return}if(c.value&&c.valueAsNumber<60&&c.valueAsNumber>=0){const b=c.value.slice(-2);if(t)z(P,A,b.length<2?`0${b}`:b);else{const M=b.length<2?`0${b}`:b;l({type:"SET_SECONDS",payload:M})}}},inputType:C,updateTime:z,hours:P,minutes:A,seconds:$,isAm:w,state:d,dispatch:l}},Jt=e=>te.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",className:"icon icon-tabler icon-tabler-chevron-up",width:24,height:24,viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",...e},te.createElement("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),te.createElement("path",{d:"M6 15l6 -6l6 6"})),qt=e=>te.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",className:"icon icon-tabler icon-tabler-chevron-down",width:24,height:24,viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",...e},te.createElement("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),te.createElement("path",{d:"M6 9l6 6l6 -6"})),j={inputContainer:"_inputContainer_9rf1m_2",timeInputMainContainer:"_timeInputMainContainer_9rf1m_15",disabled:"_disabled_9rf1m_43",hourContainer:"_hourContainer_9rf1m_54",hh:"_hh_9rf1m_54",noValue:"_noValue_9rf1m_54",hyphen:"_hyphen_9rf1m_58",noZero:"_noZero_9rf1m_62",minutesContainer:"_minutesContainer_9rf1m_66",mm:"_mm_9rf1m_66",withSeconds:"_withSeconds_9rf1m_78",secondsContainer:"_secondsContainer_9rf1m_86",timerContainer:"_timerContainer_9rf1m_105",iconContainer:"_iconContainer_9rf1m_115",arrowsContainer:"_arrowsContainer_9rf1m_141",toggleAmPmContainer:"_toggleAmPmContainer_9rf1m_159"},Xt=e=>{const{inputType:t,updateTime:o,hours:r,minutes:s,seconds:a,hour12:i,isAm:d,maxTime:l,minTime:w,format:C}=e;return{handleAddTime:$=>{if($.preventDefault(),t==="hours"){if((l||w)&&!ge(`${+r+1}`,l,w))return;const f=+r+1;let y;i?d?y=`${f>11?"12":f}`:y=`${f>11?"00":f+12}`:C&&C.includes("hh")?y=`${f>11?"12":+f%12}`:y=`${f<0?"00":f<10?`0${f}`:f<24?f:23}`,o(y,s,a)}if(t==="minutes"){const f=+s+1,y=`${f<10?`0${f}`:f<60?f:59}`;o(r,y,a)}if(t==="seconds"){const f=+a+1,y=`${f<10?`0${f}`:f<60?f:59}`;o(r,s,y)}},handleRemoveTime:$=>{if($.preventDefault(),t==="hours"){if((l||w)&&!ge(`${+r-1}`,l,w))return;const f=+r-1;let y;i?d?y=`${f<1?"1":f}`:y=`${f<1?"13":f+12}`:C&&C.includes("hh")?y=`${f<1?"1":f}`:y=`${f<0?"00":f<10?`0${f}`:f}`,o(y,s,a)}if(t==="minutes"){const f=+s-1,y=`${f<0?"00":f<10?`0${f}`:f}`;o(r,y,a)}if(t==="seconds"){const f=+a-1,y=`${f<0?"00":f<10?`0${f}`:f}`;o(r,s,y)}}}},Xe=O.createContext(null),Zt=({children:e,props:t})=>{const{handleAddTime:o,handleRemoveTime:r}=Xt(t),{controlsClassName:s,disabled:a,inputType:i}=t;return S.jsx(Xe,{value:{controlsClassName:s,disabled:a,handleAddTime:o,handleRemoveTime:r,inputType:i},children:e})},Kt=()=>{const e=O.useContext(Xe);if(!e)throw new Error("useContext must be used within a ControlsProvider");return e},Qt=O.memo(function(){const{controlsClassName:t,disabled:o,handleAddTime:r,handleRemoveTime:s,inputType:a}=Kt();return S.jsxs("div",{className:G(j.arrowsContainer,t),"aria-label":`${a}-controls`,children:[S.jsx("button",{onClick:i=>r(i),disabled:o,"aria-label":"add-time",children:S.jsx(Jt,{})}),S.jsx("button",{disabled:o,onClick:i=>s(i),"aria-label":"remove-time",children:S.jsx(qt,{})})]})}),er=e=>te.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"size-6",...e},te.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})),Ze=O.createContext(null),tr=({children:e,props:t})=>{const{dispatch:o,amPmAriaLabel:r,disabled:s,isAm:a}=t,i=()=>{o({type:"TOGGLE_AM",payload:!a})};return S.jsx(Ze,{value:{handleToggleAmPm:i,amPmAriaLabel:r,isAm:a,disabled:s},children:e})},rr=()=>{const e=O.useContext(Ze);if(!e)throw new Error("useContext must be used within a ControlsProvider");return e},or=()=>{const{handleToggleAmPm:e,isAm:t,disabled:o,amPmAriaLabel:r}=rr();return S.jsx("button",{id:"toggle-am-pm","aria-label":r,onClick:e,disabled:o,title:"AM/PM button",type:"button",children:t?"AM":"PM"})},nr=({props:e,children:t})=>{const{inputType:o,isAm:r,disabled:s,disabledHours:a,disabledMinutes:i,disabledSeconds:d,controlsClassName:l,format:w,hour12:C,amPmAriaLabel:P,updateTime:A,hours:$,minutes:f,seconds:y,state:R,dispatch:V}=e;return S.jsx(Zt,{props:{inputType:o,disabled:s||a||i||d,updateTime:A,hours:$,minutes:f,seconds:y,controlsClassName:l,format:w,hour12:C,isAm:r,state:R,dispatch:V},children:S.jsx(tr,{props:{isAm:r,amPmAriaLabel:P,disabled:s||a||i||d,state:R,dispatch:V},children:t})})},sr=({id:e,value:t,dataTestId:o,hoursPlaceholder:r="--",minutesPlaceholder:s="--",secondsPlaceholder:a="--",name:i="time",disabled:d,required:l,onChange:w,className:C,iconClockClassName:P,amPmButtonClassName:A,controlsClassName:$,inputClassName:f,dividerClassName:y,ariaLabel:R="time",iconAriaLabel:V="clock",hoursAriaLabel:U="hours",minutesAriaLabel:z="minutes",secondsAriaLabel:W="seconds",amPmAriaLabel:B="am-pm",hasSeconds:L=!1,hour12:_=!1,disableFocusOnIcon:c=!1,disabledHours:b,disabledMinutes:M,disabledSeconds:J,maxTime:q,minTime:ie,hideControls:le=!1,hoursInputTitle:Y="Hours input",minutesInputTitle:F="Minutes input",secondsInputTitle:H="Seconds input",setZeroOnBlur:p=!1,format:ee})=>{const{hoursRef:K,minutesRef:n,secondsRef:h,inputType:x,updateTime:g,handleHours:X,handleMinutes:oe,handleSeconds:k,hours:T,minutes:E,seconds:N,isAm:me,state:fe,dispatch:Z}=Bt({value:t,onChange:w,hasSeconds:L,hour12:_,maxTime:q,minTime:ie,format:ee}),ar=`${j.timerContainer} ${j.hourContainer}
|
|
7
|
+
${r==="--"?j.hyphen:j.hh}
|
|
8
|
+
${T===""?j.noValue:""}
|
|
9
|
+
${+T>9?j.noZero:""}`,ir=`${j.timerContainer} ${j.minutesContainer} ${L?j.withSeconds:""}
|
|
10
|
+
${s==="--"?j.hyphen:j.mm}
|
|
11
|
+
${E===""?j.noValue:""}
|
|
12
|
+
${+E>9?j.noZero:""}`,lr=`${j.timerContainer} ${j.secondsContainer}`,Ke=ee?.includes("ss")||L,cr=ee?.includes("hh");return S.jsx(nr,{props:{hours:T,minutes:E,seconds:N,isAm:me,inputType:x,disabled:d,controlsClassName:$,hour12:_,amPmAriaLabel:B,updateTime:g,format:cr?"hh":"HH",disabledHours:b,disabledMinutes:M,disabledSeconds:J,state:fe,dispatch:Z},children:S.jsxs("div",{className:G(`${j.inputContainer} ${d?j.disabled:""}`,C),"data-testid":o,role:"textbox",tabIndex:0,children:[!c&&S.jsx("div",{className:G(j.iconContainer,P),role:"button",onClick:()=>{Z({type:"INPUT_TYPE",payload:"hours"}),se(K)},"aria-label":V,children:S.jsx(er,{})}),S.jsxs("div",{className:G(j.timeInputMainContainer),children:[S.jsxs("div",{className:G(ar),onClick:I=>{I.preventDefault(),Z({type:"INPUT_TYPE",payload:"hours"}),se(K)},children:[S.jsx("input",{type:"hidden",name:i,"aria-label":R,value:Ke?`${T}:${E}:${N}`:`${T}:${E}`}),S.jsx("input",{type:"number",id:e,autoComplete:"off",minLength:1,maxLength:2,step:1,min:_?1:0,max:_?12:23,inputMode:"numeric",value:T,onChange:X,pattern:"^(2[0-3]|[01]?[0-9]){1,1}$",placeholder:r,required:l,className:G(f),onBlur:()=>{if(p&&T.length<2){if(_){g(+T>12?"12":me?T:`${+T+12}`,E,N);return}g(`0${T}`,E,N);return}},onKeyDown:I=>{if(I.key==="Tab"){if(Z({type:"INPUT_TYPE",payload:"minutes"}),T===""){g("00",E,N);return}if(T.length<2){g(`0${T}`,E,N);return}}if(I.key==="Backspace"){g("",E,N);return}return["e","E","+","-"].includes(I.key)&&I.preventDefault()},onClick:I=>{I.preventDefault(),se(K),Z({type:"INPUT_TYPE",payload:"hours"})},tabIndex:0,disabled:d||b,"aria-label":U,name:`hours-${i}`,ref:K,title:Y})]}),S.jsx("span",{className:G(y),children:":"}),S.jsx("div",{className:G(ir),onClick:I=>{I.preventDefault(),Z({type:"INPUT_TYPE",payload:"minutes"}),se(n)},children:S.jsx("input",{type:"number",autoComplete:"off",min:0,max:59,step:1,size:2,placeholder:s,value:E,className:G(f),inputMode:"numeric",onChange:oe,pattern:"/^([0-5]){1,1}([0-9]){1,1}$/",required:l,onBlur:()=>{if(p){if(E===""){g(T,"00",N);return}if(E.length<2){g(T,`0${E}`,N);return}}},onKeyDown:I=>{if(I.key==="Tab"&&L){if(E===""){g(T,"00",N);return}if(E.length<2){g(T,`0${E}`,N);return}Z({type:"INPUT_TYPE",payload:"seconds"})}if(I.key==="Backspace"){g(T,"",N);return}return["e","E","+","-"].includes(I.key)&&I.preventDefault()},onClick:I=>{I.preventDefault(),se(n),Z({type:"INPUT_TYPE",payload:"minutes"})},ref:n,tabIndex:0,disabled:d||M,"aria-label":z,name:`minutes-${i}`,title:F})}),Ke?S.jsxs(S.Fragment,{children:[S.jsx("span",{className:G(y),children:":"}),S.jsx("div",{className:G(lr),onClick:I=>{I.preventDefault(),Z({type:"INPUT_TYPE",payload:"seconds"}),se(h)},children:S.jsx("input",{type:"number",autoComplete:"off",step:1,size:2,min:0,max:59,placeholder:a,value:N,className:G(f),pattern:"/^([0-5]){1,1}([0-9]){1,1}$/",required:l,onBlur:()=>{if(p){if(N===""){g(T,E,"00");return}if(N.length<2){g(T,E,`0${N}`);return}}},onKeyDown:I=>{if(I.key==="Tab"){if(N===""){g(T,E,"00");return}if(N.length<2){g(T,E,`0${N}`);return}Z({type:"INPUT_TYPE",payload:"seconds"})}if(I.key==="Backspace"){g(T,E,"");return}return["e","E","+","-"].includes(I.key)&&I.preventDefault()},onChange:k,onClick:I=>{I.preventDefault(),se(h),Z({type:"INPUT_TYPE",payload:"seconds"})},tabIndex:0,disabled:d||J,ref:h,"aria-label":W,name:`seconds-${i}`,title:H})})]}):null,_&&S.jsx("div",{className:G(j.toggleAmPmContainer,A),title:"AM/PM button",children:S.jsx(or,{})})]}),le?null:S.jsx(Qt,{})]})})};ne.TimeInput=sr,Object.defineProperty(ne,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
2
|
+
|
|
3
|
+
export declare type ControlProps = {
|
|
4
|
+
inputType: "hours" | "minutes" | "seconds";
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
updateTime: (hour: string, minute: string, seconds: string) => void;
|
|
7
|
+
hours: string;
|
|
8
|
+
minutes: string;
|
|
9
|
+
seconds: string;
|
|
10
|
+
hour12?: boolean;
|
|
11
|
+
isAm?: boolean;
|
|
12
|
+
maxTime?: string | Date;
|
|
13
|
+
minTime?: string | Date;
|
|
14
|
+
controlsClassName?: string;
|
|
15
|
+
format?: "hh" | "HH";
|
|
16
|
+
state: TimeInputState;
|
|
17
|
+
dispatch: React.Dispatch<TimeInputActions>;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export declare type ControlsContextType = {
|
|
21
|
+
controlsClassName?: string;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
handleAddTime: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
24
|
+
handleRemoveTime: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
25
|
+
inputType: "hours" | "minutes" | "seconds";
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
declare type InputType = {
|
|
29
|
+
type: "INPUT_TYPE";
|
|
30
|
+
payload: "hours" | "minutes" | "seconds";
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
declare type SetHours = {
|
|
34
|
+
type: "SET_HOURS";
|
|
35
|
+
payload: string;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
declare type SetMinutes = {
|
|
39
|
+
type: "SET_MINUTES";
|
|
40
|
+
payload: string;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
declare type SetSeconds = {
|
|
44
|
+
type: "SET_SECONDS";
|
|
45
|
+
payload: string;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* TimeInput component provides a time input field to control hours and minutes.
|
|
50
|
+
* Display time in 24 hours or 12 hours format. Can be handle with keyboard (arrow up or down)
|
|
51
|
+
*
|
|
52
|
+
* @param {TimeInputProps} props - Props for the TimeInput component.
|
|
53
|
+
* @returns {JSX.Element}
|
|
54
|
+
*/
|
|
55
|
+
export declare const TimeInput: ({ id, value, dataTestId, hoursPlaceholder, minutesPlaceholder, secondsPlaceholder, name, disabled, required, onChange, className, iconClockClassName, amPmButtonClassName, controlsClassName, inputClassName, dividerClassName, ariaLabel, iconAriaLabel, hoursAriaLabel, minutesAriaLabel, secondsAriaLabel, amPmAriaLabel, hasSeconds, hour12, disableFocusOnIcon, disabledHours, disabledMinutes, disabledSeconds, maxTime, minTime, hideControls, hoursInputTitle, minutesInputTitle, secondsInputTitle, setZeroOnBlur, format, }: TimeInputProps) => JSX.Element;
|
|
56
|
+
|
|
57
|
+
export declare type TimeInputActions = SetHours | SetMinutes | SetSeconds | ToggleAm | InputType;
|
|
58
|
+
|
|
59
|
+
export declare type TimeInputProps = {
|
|
60
|
+
/**
|
|
61
|
+
* Event function to change the time
|
|
62
|
+
* @type {(value: Date | string) => void}
|
|
63
|
+
*/
|
|
64
|
+
onChange?: (value: Date | string) => void;
|
|
65
|
+
/**
|
|
66
|
+
* The value used to control or display the time in the input.
|
|
67
|
+
* @type {Date | string | undefined | null}
|
|
68
|
+
*/
|
|
69
|
+
value?: Date | string | undefined | null;
|
|
70
|
+
/**
|
|
71
|
+
* Define the name to describe the time input in forms.
|
|
72
|
+
* @type {string}
|
|
73
|
+
*/
|
|
74
|
+
name?: string;
|
|
75
|
+
/**
|
|
76
|
+
* Whether the time input is disabled or not.
|
|
77
|
+
* @type {boolean}
|
|
78
|
+
*/
|
|
79
|
+
disabled?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Whether the hours input is disabled or not.
|
|
82
|
+
* @type {boolean}
|
|
83
|
+
*/
|
|
84
|
+
disabledHours?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Whether the minutes input is disabled or not.
|
|
87
|
+
* @type {boolean}
|
|
88
|
+
*/
|
|
89
|
+
disabledMinutes?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Whether the seconds input is disabled or not.
|
|
92
|
+
* @type {boolean}
|
|
93
|
+
*/
|
|
94
|
+
disabledSeconds?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Whether the time input is required or not.
|
|
97
|
+
* @type {boolean}
|
|
98
|
+
*/
|
|
99
|
+
required?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Define the className to change the styles used in the time input
|
|
102
|
+
* @type {string}
|
|
103
|
+
*/
|
|
104
|
+
className?: string;
|
|
105
|
+
/**
|
|
106
|
+
* Define the className to change the styles used in the icon
|
|
107
|
+
* @type {string}
|
|
108
|
+
*/
|
|
109
|
+
iconClockClassName?: string;
|
|
110
|
+
/**
|
|
111
|
+
* Define the className to change the styles used in the AM/PM button
|
|
112
|
+
* @type {string}
|
|
113
|
+
*/
|
|
114
|
+
amPmButtonClassName?: string;
|
|
115
|
+
/**
|
|
116
|
+
* Define the className to change the styles used in the controls
|
|
117
|
+
* @type {string}
|
|
118
|
+
*/
|
|
119
|
+
controlsClassName?: string;
|
|
120
|
+
/**
|
|
121
|
+
* Define the className to change the styles used in the input
|
|
122
|
+
* @type {string}
|
|
123
|
+
*/
|
|
124
|
+
inputClassName?: string;
|
|
125
|
+
/**
|
|
126
|
+
* Define the className to change the styles used in the divider
|
|
127
|
+
* @type {string}
|
|
128
|
+
*/
|
|
129
|
+
dividerClassName?: string;
|
|
130
|
+
/**
|
|
131
|
+
* Define the data-testid used in the time input
|
|
132
|
+
* @type {string}
|
|
133
|
+
*/
|
|
134
|
+
dataTestId?: string;
|
|
135
|
+
/**
|
|
136
|
+
* Define the placeholder used in the hours input
|
|
137
|
+
* @type {"--" | "HH" | "hh"}
|
|
138
|
+
*/
|
|
139
|
+
hoursPlaceholder?: "--" | "HH" | "hh";
|
|
140
|
+
/**
|
|
141
|
+
* Define the placeholder used in the minutes input
|
|
142
|
+
* @type {"--" | "mm"}
|
|
143
|
+
*/
|
|
144
|
+
minutesPlaceholder?: "--" | "mm";
|
|
145
|
+
/**
|
|
146
|
+
* Define the placeholder used in the seconds input
|
|
147
|
+
* @type {"--" | "ss"}
|
|
148
|
+
*/
|
|
149
|
+
secondsPlaceholder?: "--" | "ss";
|
|
150
|
+
/**
|
|
151
|
+
* Define the aria-label in icon button
|
|
152
|
+
* @type {string}
|
|
153
|
+
*/
|
|
154
|
+
iconAriaLabel?: string;
|
|
155
|
+
/**
|
|
156
|
+
* Define the aria-label in seconds input controller
|
|
157
|
+
* @type {string}
|
|
158
|
+
*/
|
|
159
|
+
secondsAriaLabel?: string;
|
|
160
|
+
/**
|
|
161
|
+
* Define the aria-label in minute input controller
|
|
162
|
+
* @type {string}
|
|
163
|
+
*/
|
|
164
|
+
minutesAriaLabel?: string;
|
|
165
|
+
/**
|
|
166
|
+
* Define the aria-label in hour input controller
|
|
167
|
+
* @type {string}
|
|
168
|
+
*/
|
|
169
|
+
hoursAriaLabel?: string;
|
|
170
|
+
/**
|
|
171
|
+
* Define the aria-label in AM/PM controller
|
|
172
|
+
* @type {string}
|
|
173
|
+
*/
|
|
174
|
+
amPmAriaLabel?: string;
|
|
175
|
+
/**
|
|
176
|
+
* Define the aria-label in the time input. By default is "time"
|
|
177
|
+
* @type {string}
|
|
178
|
+
*/
|
|
179
|
+
ariaLabel?: string;
|
|
180
|
+
/**
|
|
181
|
+
* Define the title for the hour input. By default is "Hours input"
|
|
182
|
+
* @type {string}
|
|
183
|
+
*/
|
|
184
|
+
hoursInputTitle?: string;
|
|
185
|
+
/**
|
|
186
|
+
* Define the title for the minutes input. By default is "Minutes input"
|
|
187
|
+
* @type {string}
|
|
188
|
+
*/
|
|
189
|
+
minutesInputTitle?: string;
|
|
190
|
+
/**
|
|
191
|
+
* Define the title for the seconds input. By default is "Seconds input"
|
|
192
|
+
* @type {string}
|
|
193
|
+
*/
|
|
194
|
+
secondsInputTitle?: string;
|
|
195
|
+
/**
|
|
196
|
+
* Whether the time input has to display seconds. By default is false
|
|
197
|
+
* @type {boolean}
|
|
198
|
+
*/
|
|
199
|
+
hasSeconds?: boolean;
|
|
200
|
+
/**
|
|
201
|
+
* Id to identify the time input
|
|
202
|
+
* @type {string | HTMLInputElement["id"]}
|
|
203
|
+
*/
|
|
204
|
+
id?: HTMLInputElement["id"];
|
|
205
|
+
/**
|
|
206
|
+
* Whether the time input has to show AM/PM button or not. By default is false
|
|
207
|
+
* @type {boolean}
|
|
208
|
+
*/
|
|
209
|
+
hour12?: boolean;
|
|
210
|
+
/**
|
|
211
|
+
* Whether the time input has to display icon. By default is true, but it is false, the input will not focus on click
|
|
212
|
+
* @type {boolean}
|
|
213
|
+
*/
|
|
214
|
+
disableFocusOnIcon?: boolean;
|
|
215
|
+
/**
|
|
216
|
+
* Define the format used in the time input. By default is "HH:mm:ss"
|
|
217
|
+
* @type {"HH:mm:ss" | "HH:mm" | "hh:mm:ss" | "hh:mm"}
|
|
218
|
+
*/
|
|
219
|
+
format?: "HH:mm:ss" | "HH:mm" | "hh:mm:ss" | "hh:mm";
|
|
220
|
+
/**
|
|
221
|
+
* Define the maximum time used in the time input. By default is "23:59:59"
|
|
222
|
+
* @type {string | Date}
|
|
223
|
+
*/
|
|
224
|
+
maxTime?: string | Date;
|
|
225
|
+
/**
|
|
226
|
+
* Define the minimum time used in the time input. By default is "00:00:00"
|
|
227
|
+
* @type {string | Date}
|
|
228
|
+
*/
|
|
229
|
+
minTime?: string | Date;
|
|
230
|
+
/**
|
|
231
|
+
* Whether the time input has to display controls. By default is false
|
|
232
|
+
* @type {boolean}
|
|
233
|
+
*/
|
|
234
|
+
hideControls?: boolean;
|
|
235
|
+
/**
|
|
236
|
+
* Whether the time input has to set the time to 00:00:00 when the input is blurred. By default is false
|
|
237
|
+
* @type {boolean}
|
|
238
|
+
*/
|
|
239
|
+
setZeroOnBlur?: boolean;
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
export declare type TimeInputState = {
|
|
243
|
+
isAm: boolean;
|
|
244
|
+
inputType: "hours" | "minutes" | "seconds";
|
|
245
|
+
hours: string;
|
|
246
|
+
minutes: string;
|
|
247
|
+
seconds: string;
|
|
248
|
+
hour12: boolean | undefined;
|
|
249
|
+
format: TimeInputProps["format"] | undefined;
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
declare type ToggleAm = {
|
|
253
|
+
type: "TOGGLE_AM";
|
|
254
|
+
payload: boolean;
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
export declare type ToggleMeridiemContextType = {
|
|
258
|
+
handleToggleAmPm: () => void;
|
|
259
|
+
amPmAriaLabel: string;
|
|
260
|
+
isAm: boolean;
|
|
261
|
+
disabled?: boolean;
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
export declare type ToggleMeridiemProps = {
|
|
265
|
+
amPmAriaLabel: string;
|
|
266
|
+
isAm: boolean;
|
|
267
|
+
disabled?: boolean;
|
|
268
|
+
state: TimeInputState;
|
|
269
|
+
dispatch: React.Dispatch<TimeInputActions>;
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
export declare type UseTimeInputProps = {
|
|
273
|
+
value?: TimeInputProps["value"];
|
|
274
|
+
onChange?: TimeInputProps["onChange"];
|
|
275
|
+
hasSeconds: TimeInputProps["hasSeconds"];
|
|
276
|
+
hour12: TimeInputProps["hour12"];
|
|
277
|
+
maxTime?: TimeInputProps["maxTime"];
|
|
278
|
+
minTime?: TimeInputProps["minTime"];
|
|
279
|
+
format?: TimeInputProps["format"];
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
export { }
|
package/index.html
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
8
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
9
|
+
<link
|
|
10
|
+
href="https://fonts.googleapis.com/css2?family=Lexend+Deca:wght@100;400;700&family=PT+Sans:ital,wght@0,400;0,700;1,400&display=swap"
|
|
11
|
+
rel="stylesheet"
|
|
12
|
+
/>
|
|
13
|
+
<title>TimeInput</title>
|
|
14
|
+
</head>
|
|
15
|
+
<body>
|
|
16
|
+
<div id="root"></div>
|
|
17
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
18
|
+
</body>
|
|
19
|
+
</html>
|
package/package.json
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bymarcant/easy-time-input",
|
|
3
|
+
"private": false,
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/easy-time-input.umd.js",
|
|
7
|
+
"module": "dist/easy-time-input.es.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"description": "A simple and easy to use time input component for React",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/easy-time-input.es.js",
|
|
14
|
+
"require": "./dist/easy-time-input.umd.js"
|
|
15
|
+
},
|
|
16
|
+
"./style.css": "./dist/easy-time-input.css"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/MarcAnt/easy-time-input.git"
|
|
21
|
+
},
|
|
22
|
+
"author": "MarcAnt",
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"keywords": [
|
|
25
|
+
"time",
|
|
26
|
+
"input",
|
|
27
|
+
"react",
|
|
28
|
+
"typescript",
|
|
29
|
+
"tailwindcss"
|
|
30
|
+
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"dev": "vite",
|
|
33
|
+
"build": "tsc && vite build",
|
|
34
|
+
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
35
|
+
"preview": "vite preview",
|
|
36
|
+
"test": "vitest --run --pool vmThreads",
|
|
37
|
+
"test:ui": "vitest --ui",
|
|
38
|
+
"ts-scss": "typed-scss-modules src --watch",
|
|
39
|
+
"coverage": "vitest run --coverage"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@tailwindcss/vite": "^4.1.18",
|
|
43
|
+
"clsx": "^2.1.1",
|
|
44
|
+
"tailwind-merge": "^3.4.0",
|
|
45
|
+
"tailwindcss": "^4.1.18",
|
|
46
|
+
"vite-plugin-svgr": "^4.5.0"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
50
|
+
"@testing-library/react": "^16.3.1",
|
|
51
|
+
"@testing-library/user-event": "^14.6.1",
|
|
52
|
+
"@types/jest": "^30.0.0",
|
|
53
|
+
"@types/node": "^25.1.0",
|
|
54
|
+
"@types/react": "^19.2.7",
|
|
55
|
+
"@types/react-dom": "^19.2.3",
|
|
56
|
+
"@typescript-eslint/eslint-plugin": "^8.50.0",
|
|
57
|
+
"@typescript-eslint/parser": "^8.50.0",
|
|
58
|
+
"@vitejs/plugin-react": "^5.1.2",
|
|
59
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
60
|
+
"eslint": "^9.39.2",
|
|
61
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
62
|
+
"eslint-plugin-react-refresh": "^0.4.26",
|
|
63
|
+
"jsdom": "^27.3.0",
|
|
64
|
+
"less": "^4.5.1",
|
|
65
|
+
"sass": "^1.97.0",
|
|
66
|
+
"typed-scss-modules": "^8.1.1",
|
|
67
|
+
"typescript": "^5.9.3",
|
|
68
|
+
"vite": "^7.3.0",
|
|
69
|
+
"vite-plugin-dts": "^4.5.4",
|
|
70
|
+
"vitest": "^4.0.16"
|
|
71
|
+
},
|
|
72
|
+
"peerDependencies": {
|
|
73
|
+
"react": "^19.0.0",
|
|
74
|
+
"react-dom": "^19.0.0"
|
|
75
|
+
}
|
|
76
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
|
|
9
|
+
/* Bundler mode */
|
|
10
|
+
"moduleResolution": "bundler",
|
|
11
|
+
"allowImportingTsExtensions": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"isolatedModules": true,
|
|
14
|
+
"noEmit": true,
|
|
15
|
+
"jsx": "react-jsx",
|
|
16
|
+
|
|
17
|
+
/* Linting */
|
|
18
|
+
"strict": true,
|
|
19
|
+
"noUnusedLocals": true,
|
|
20
|
+
"noUnusedParameters": true,
|
|
21
|
+
"noFallthroughCasesInSwitch": true
|
|
22
|
+
},
|
|
23
|
+
"include": ["src"],
|
|
24
|
+
"references": [{ "path": "./tsconfig.node.json" }]
|
|
25
|
+
}
|