@stackshift-ui/date-picker 1.0.0-beta.1 → 1.0.0-beta.10

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.
@@ -0,0 +1 @@
1
+ import{Calendar as B,ChevronDownIcon as T}from"lucide-react";import*as p from"react";import{Button as v}from"@stackshift-ui/button";import{Calendar as P}from"@stackshift-ui/calendar";import{Input as I}from"@stackshift-ui/input";import{Label as D}from"@stackshift-ui/label";import{Popover as h,PopoverContent as N,PopoverTrigger as k}from"@stackshift-ui/popover";import{cn as F,DefaultComponent as C,useStackShiftUIComponents as w}from"@stackshift-ui/system";import{jsx as e,jsxs as t}from"react/jsx-runtime";var L="DatePicker",S="DatePickerInput",V="DatePickerTime";function z({label:a,mode:u="range",selectedDate:n,onSelect:c,...s}){let{[L]:f=C}=w(),[m,i]=p.useState(!1),o=n||new Date,d=l=>{i(!1),c==null||c(l)};return t(f,{className:F("flex flex-col gap-3",s.className),...s,children:[e(D,{htmlFor:"date",className:"px-1",children:a}),t(h,{open:m,onOpenChange:i,children:[e(k,{asChild:!0,children:t(v,{variant:"outline",id:"date",className:"w-48 font-normal [&>span]:w-full [&>span]:justify-between",children:[o?o.toLocaleDateString():"Select date",e(T,{})]})}),e(N,{className:"w-auto overflow-hidden p-0",align:"start",children:e(P,{mode:u,selected:o,captionLayout:"dropdown",onSelect:d})})]})]})}z.displayName=L;function y(a){return a?a.toLocaleDateString("en-US",{day:"2-digit",month:"long",year:"numeric"}):""}function E(a){return a?!isNaN(a.getTime()):!1}function U({label:a,selectedDate:u,onSelect:n,selectedMonth:c,onMonthChange:s,...f}){let{[S]:m=C}=w(),[i,o]=p.useState(!1),[d,l]=p.useState(u||new Date),[O,x]=p.useState(c||d),[R,b]=p.useState(y(d));return t(m,{className:"flex flex-col gap-3",...f,children:[e(D,{htmlFor:"date",className:"px-1",children:a}),t("div",{className:"relative flex gap-2",children:[e(I,{id:"date",value:R,placeholder:"June 01, 2025",className:"bg-background pr-10",onChange:r=>{let g=new Date(r.target.value);b(r.target.value),E(g)&&(l(g),x(g),n==null||n(g),s==null||s(g))},onKeyDown:r=>{r.key==="ArrowDown"&&(r.preventDefault(),o(!0))}}),t(h,{open:i,onOpenChange:o,children:[e(k,{asChild:!0,children:t(v,{id:"date-picker",variant:"ghost",className:"absolute top-1/2 right-2 size-6 -translate-y-1/2",children:[e(B,{className:"size-3.5"}),e("span",{className:"sr-only",children:"Select date"})]})}),e(N,{className:"w-auto overflow-hidden p-0",align:"end",alignOffset:-8,sideOffset:10,children:e(P,{mode:"single",selected:d,captionLayout:"dropdown",month:O,onMonthChange:x,onSelect:r=>{r&&(l(r),b(y(r)),o(!1))}})})]})]})]})}U.displayName=S;function W({label:a,selectedDate:u,onSelect:n,...c}){let{[V]:s=C}=w(),[f,m]=p.useState(!1),[i,o]=p.useState(u),d=l=>{o(l),m(!1),l&&(n==null||n(l))};return t(s,{className:"flex gap-4",...c,children:[t("div",{className:"flex flex-col gap-3",children:[e(D,{htmlFor:"date-picker",className:"px-1",children:a}),t(h,{open:f,onOpenChange:m,children:[e(k,{asChild:!0,children:t(v,{variant:"outline",id:"date-picker",className:"w-32 font-normal [&>span]:w-full [&>span]:justify-between",children:[i?i.toLocaleDateString():"Select date",e(T,{})]})}),e(N,{className:"w-auto overflow-hidden p-0",align:"start",children:e(P,{mode:"single",selected:i,captionLayout:"dropdown",onSelect:d})})]})]}),t("div",{className:"flex flex-col gap-3",children:[e(D,{htmlFor:"time-picker",className:"px-1",children:"Time"}),e(I,{type:"time",id:"time-picker",step:"1",defaultValue:"10:30:00",className:"bg-background appearance-none [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:appearance-none"})]})]})}export{z as a,U as b,W as c};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";var B=Object.create;var h=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var z=Object.getPrototypeOf,E=Object.prototype.hasOwnProperty;var U=(t,n)=>{for(var a in n)h(t,a,{get:n[a],enumerable:!0})},b=(t,n,a,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of V(n))!E.call(t,o)&&o!==a&&h(t,o,{get:()=>n[o],enumerable:!(i=F(n,o))||i.enumerable});return t};var j=(t,n,a)=>(a=t!=null?B(z(t)):{},b(n||!t||!t.__esModule?h(a,"default",{value:t,enumerable:!0}):a,t)),q=t=>b(h({},"__esModule",{value:!0}),t);var K={};U(K,{DatePicker:()=>L,DatePickerInput:()=>S,DatePickerTime:()=>J});module.exports=q(K);var P=require("lucide-react"),m=j(require("react")),N=require("@stackshift-ui/button"),k=require("@stackshift-ui/calendar"),C=require("@stackshift-ui/input"),v=require("@stackshift-ui/label"),r=require("@stackshift-ui/popover"),s=require("@stackshift-ui/system"),e=require("react/jsx-runtime"),T="DatePicker",I="DatePickerInput",A="DatePickerTime";function L({label:t,mode:n="range",selectedDate:a,onSelect:i,...o}){let{[T]:g=s.DefaultComponent}=(0,s.useStackShiftUIComponents)(),[f,p]=m.useState(!1),l=a||new Date,u=d=>{p(!1),i==null||i(d)};return(0,e.jsxs)(g,{className:(0,s.cn)("flex flex-col gap-3",o.className),...o,children:[(0,e.jsx)(v.Label,{htmlFor:"date",className:"px-1",children:t}),(0,e.jsxs)(r.Popover,{open:f,onOpenChange:p,children:[(0,e.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,e.jsxs)(N.Button,{variant:"outline",id:"date",className:"w-48 justify-between font-normal",children:[l?l.toLocaleDateString():"Select date",(0,e.jsx)(P.ChevronDownIcon,{})]})}),(0,e.jsx)(r.PopoverContent,{className:"w-auto overflow-hidden p-0",align:"start",children:(0,e.jsx)(k.Calendar,{mode:n,selected:l,captionLayout:"dropdown",onSelect:u})})]})]})}L.displayName=T;function y(t){return t?t.toLocaleDateString("en-US",{day:"2-digit",month:"long",year:"numeric"}):""}function H(t){return t?!isNaN(t.getTime()):!1}function S({label:t,selectedDate:n,onSelect:a,selectedMonth:i,onMonthChange:o,...g}){let{[I]:f=s.DefaultComponent}=(0,s.useStackShiftUIComponents)(),[p,l]=m.useState(!1),[u,d]=m.useState(n||new Date),[O,w]=m.useState(i||u),[R,x]=m.useState(y(u));return(0,e.jsxs)(f,{className:"flex flex-col gap-3",...g,children:[(0,e.jsx)(v.Label,{htmlFor:"date",className:"px-1",children:t}),(0,e.jsxs)("div",{className:"relative flex gap-2",children:[(0,e.jsx)(C.Input,{id:"date",value:R,placeholder:"June 01, 2025",className:"bg-background pr-10",onChange:c=>{let D=new Date(c.target.value);x(c.target.value),H(D)&&(d(D),w(D),a==null||a(D),o==null||o(D))},onKeyDown:c=>{c.key==="ArrowDown"&&(c.preventDefault(),l(!0))}}),(0,e.jsxs)(r.Popover,{open:p,onOpenChange:l,children:[(0,e.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,e.jsxs)(N.Button,{id:"date-picker",variant:"ghost",className:"absolute top-1/2 right-2 size-6 -translate-y-1/2",children:[(0,e.jsx)(P.Calendar,{className:"size-3.5"}),(0,e.jsx)("span",{className:"sr-only",children:"Select date"})]})}),(0,e.jsx)(r.PopoverContent,{className:"w-auto overflow-hidden p-0",align:"end",alignOffset:-8,sideOffset:10,children:(0,e.jsx)(k.Calendar,{mode:"single",selected:u,captionLayout:"dropdown",month:O,onMonthChange:w,onSelect:c=>{c&&(d(c),x(y(c)),l(!1))}})})]})]})]})}S.displayName=I;function J({label:t,selectedDate:n,onSelect:a,...i}){let{[A]:o=s.DefaultComponent}=(0,s.useStackShiftUIComponents)(),[g,f]=m.useState(!1),[p,l]=m.useState(n),u=d=>{l(d),f(!1),d&&(a==null||a(d))};return(0,e.jsxs)(o,{className:"flex gap-4",...i,children:[(0,e.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,e.jsx)(v.Label,{htmlFor:"date-picker",className:"px-1",children:t}),(0,e.jsxs)(r.Popover,{open:g,onOpenChange:f,children:[(0,e.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,e.jsxs)(N.Button,{variant:"outline",id:"date-picker",className:"w-32 justify-between font-normal",children:[p?p.toLocaleDateString():"Select date",(0,e.jsx)(P.ChevronDownIcon,{})]})}),(0,e.jsx)(r.PopoverContent,{className:"w-auto overflow-hidden p-0",align:"start",children:(0,e.jsx)(k.Calendar,{mode:"single",selected:p,captionLayout:"dropdown",onSelect:u})})]})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,e.jsx)(v.Label,{htmlFor:"time-picker",className:"px-1",children:"Time"}),(0,e.jsx)(C.Input,{type:"time",id:"time-picker",step:"1",defaultValue:"10:30:00",className:"bg-background appearance-none [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:appearance-none"})]})]})}0&&(module.exports={DatePicker,DatePickerInput,DatePickerTime});
2
+ "use strict";var B=Object.create;var h=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var z=Object.getPrototypeOf,E=Object.prototype.hasOwnProperty;var U=(t,n)=>{for(var a in n)h(t,a,{get:n[a],enumerable:!0})},b=(t,n,a,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of V(n))!E.call(t,o)&&o!==a&&h(t,o,{get:()=>n[o],enumerable:!(s=F(n,o))||s.enumerable});return t};var j=(t,n,a)=>(a=t!=null?B(z(t)):{},b(n||!t||!t.__esModule?h(a,"default",{value:t,enumerable:!0}):a,t)),q=t=>b(h({},"__esModule",{value:!0}),t);var K={};U(K,{DatePicker:()=>L,DatePickerInput:()=>S,DatePickerTime:()=>J});module.exports=q(K);var P=require("lucide-react"),m=j(require("react")),N=require("@stackshift-ui/button"),k=require("@stackshift-ui/calendar"),C=require("@stackshift-ui/input"),v=require("@stackshift-ui/label"),r=require("@stackshift-ui/popover"),i=require("@stackshift-ui/system"),e=require("react/jsx-runtime"),T="DatePicker",I="DatePickerInput",A="DatePickerTime";function L({label:t,mode:n="range",selectedDate:a,onSelect:s,...o}){let{[T]:g=i.DefaultComponent}=(0,i.useStackShiftUIComponents)(),[f,c]=m.useState(!1),l=a||new Date,u=d=>{c(!1),s==null||s(d)};return(0,e.jsxs)(g,{className:(0,i.cn)("flex flex-col gap-3",o.className),...o,children:[(0,e.jsx)(v.Label,{htmlFor:"date",className:"px-1",children:t}),(0,e.jsxs)(r.Popover,{open:f,onOpenChange:c,children:[(0,e.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,e.jsxs)(N.Button,{variant:"outline",id:"date",className:"w-48 font-normal [&>span]:w-full [&>span]:justify-between",children:[l?l.toLocaleDateString():"Select date",(0,e.jsx)(P.ChevronDownIcon,{})]})}),(0,e.jsx)(r.PopoverContent,{className:"w-auto overflow-hidden p-0",align:"start",children:(0,e.jsx)(k.Calendar,{mode:n,selected:l,captionLayout:"dropdown",onSelect:u})})]})]})}L.displayName=T;function y(t){return t?t.toLocaleDateString("en-US",{day:"2-digit",month:"long",year:"numeric"}):""}function H(t){return t?!isNaN(t.getTime()):!1}function S({label:t,selectedDate:n,onSelect:a,selectedMonth:s,onMonthChange:o,...g}){let{[I]:f=i.DefaultComponent}=(0,i.useStackShiftUIComponents)(),[c,l]=m.useState(!1),[u,d]=m.useState(n||new Date),[O,w]=m.useState(s||u),[R,x]=m.useState(y(u));return(0,e.jsxs)(f,{className:"flex flex-col gap-3",...g,children:[(0,e.jsx)(v.Label,{htmlFor:"date",className:"px-1",children:t}),(0,e.jsxs)("div",{className:"relative flex gap-2",children:[(0,e.jsx)(C.Input,{id:"date",value:R,placeholder:"June 01, 2025",className:"bg-background pr-10",onChange:p=>{let D=new Date(p.target.value);x(p.target.value),H(D)&&(d(D),w(D),a==null||a(D),o==null||o(D))},onKeyDown:p=>{p.key==="ArrowDown"&&(p.preventDefault(),l(!0))}}),(0,e.jsxs)(r.Popover,{open:c,onOpenChange:l,children:[(0,e.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,e.jsxs)(N.Button,{id:"date-picker",variant:"ghost",className:"absolute top-1/2 right-2 size-6 -translate-y-1/2",children:[(0,e.jsx)(P.Calendar,{className:"size-3.5"}),(0,e.jsx)("span",{className:"sr-only",children:"Select date"})]})}),(0,e.jsx)(r.PopoverContent,{className:"w-auto overflow-hidden p-0",align:"end",alignOffset:-8,sideOffset:10,children:(0,e.jsx)(k.Calendar,{mode:"single",selected:u,captionLayout:"dropdown",month:O,onMonthChange:w,onSelect:p=>{p&&(d(p),x(y(p)),l(!1))}})})]})]})]})}S.displayName=I;function J({label:t,selectedDate:n,onSelect:a,...s}){let{[A]:o=i.DefaultComponent}=(0,i.useStackShiftUIComponents)(),[g,f]=m.useState(!1),[c,l]=m.useState(n),u=d=>{l(d),f(!1),d&&(a==null||a(d))};return(0,e.jsxs)(o,{className:"flex gap-4",...s,children:[(0,e.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,e.jsx)(v.Label,{htmlFor:"date-picker",className:"px-1",children:t}),(0,e.jsxs)(r.Popover,{open:g,onOpenChange:f,children:[(0,e.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,e.jsxs)(N.Button,{variant:"outline",id:"date-picker",className:"w-32 font-normal [&>span]:w-full [&>span]:justify-between",children:[c?c.toLocaleDateString():"Select date",(0,e.jsx)(P.ChevronDownIcon,{})]})}),(0,e.jsx)(r.PopoverContent,{className:"w-auto overflow-hidden p-0",align:"start",children:(0,e.jsx)(k.Calendar,{mode:"single",selected:c,captionLayout:"dropdown",onSelect:u})})]})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,e.jsx)(v.Label,{htmlFor:"time-picker",className:"px-1",children:"Time"}),(0,e.jsx)(C.Input,{type:"time",id:"time-picker",step:"1",defaultValue:"10:30:00",className:"bg-background appearance-none [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:appearance-none"})]})]})}0&&(module.exports={DatePicker,DatePickerInput,DatePickerTime});
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";import{a,b,c}from"./chunk-WYFM625G.mjs";import"./chunk-3EYN2AKU.mjs";export{a as DatePicker,b as DatePickerInput,c as DatePickerTime};
2
+ "use strict";import{a,b,c}from"./chunk-24RFZANX.mjs";import"./chunk-3EYN2AKU.mjs";export{a as DatePicker,b as DatePickerInput,c as DatePickerTime};
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";var B=Object.create;var h=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var z=Object.getPrototypeOf,E=Object.prototype.hasOwnProperty;var U=(t,n)=>{for(var a in n)h(t,a,{get:n[a],enumerable:!0})},b=(t,n,a,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of V(n))!E.call(t,o)&&o!==a&&h(t,o,{get:()=>n[o],enumerable:!(i=F(n,o))||i.enumerable});return t};var j=(t,n,a)=>(a=t!=null?B(z(t)):{},b(n||!t||!t.__esModule?h(a,"default",{value:t,enumerable:!0}):a,t)),q=t=>b(h({},"__esModule",{value:!0}),t);var K={};U(K,{DatePicker:()=>L,DatePickerInput:()=>S,DatePickerTime:()=>J});module.exports=q(K);var P=require("lucide-react"),m=j(require("react")),N=require("@stackshift-ui/button"),k=require("@stackshift-ui/calendar"),C=require("@stackshift-ui/input"),v=require("@stackshift-ui/label"),r=require("@stackshift-ui/popover"),s=require("@stackshift-ui/system"),e=require("react/jsx-runtime"),T="DatePicker",I="DatePickerInput",A="DatePickerTime";function L({label:t,mode:n="range",selectedDate:a,onSelect:i,...o}){let{[T]:g=s.DefaultComponent}=(0,s.useStackShiftUIComponents)(),[f,p]=m.useState(!1),l=a||new Date,u=d=>{p(!1),i==null||i(d)};return(0,e.jsxs)(g,{className:(0,s.cn)("flex flex-col gap-3",o.className),...o,children:[(0,e.jsx)(v.Label,{htmlFor:"date",className:"px-1",children:t}),(0,e.jsxs)(r.Popover,{open:f,onOpenChange:p,children:[(0,e.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,e.jsxs)(N.Button,{variant:"outline",id:"date",className:"w-48 justify-between font-normal",children:[l?l.toLocaleDateString():"Select date",(0,e.jsx)(P.ChevronDownIcon,{})]})}),(0,e.jsx)(r.PopoverContent,{className:"w-auto overflow-hidden p-0",align:"start",children:(0,e.jsx)(k.Calendar,{mode:n,selected:l,captionLayout:"dropdown",onSelect:u})})]})]})}L.displayName=T;function y(t){return t?t.toLocaleDateString("en-US",{day:"2-digit",month:"long",year:"numeric"}):""}function H(t){return t?!isNaN(t.getTime()):!1}function S({label:t,selectedDate:n,onSelect:a,selectedMonth:i,onMonthChange:o,...g}){let{[I]:f=s.DefaultComponent}=(0,s.useStackShiftUIComponents)(),[p,l]=m.useState(!1),[u,d]=m.useState(n||new Date),[O,x]=m.useState(i||u),[R,w]=m.useState(y(u));return(0,e.jsxs)(f,{className:"flex flex-col gap-3",...g,children:[(0,e.jsx)(v.Label,{htmlFor:"date",className:"px-1",children:t}),(0,e.jsxs)("div",{className:"relative flex gap-2",children:[(0,e.jsx)(C.Input,{id:"date",value:R,placeholder:"June 01, 2025",className:"bg-background pr-10",onChange:c=>{let D=new Date(c.target.value);w(c.target.value),H(D)&&(d(D),x(D),a==null||a(D),o==null||o(D))},onKeyDown:c=>{c.key==="ArrowDown"&&(c.preventDefault(),l(!0))}}),(0,e.jsxs)(r.Popover,{open:p,onOpenChange:l,children:[(0,e.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,e.jsxs)(N.Button,{id:"date-picker",variant:"ghost",className:"absolute top-1/2 right-2 size-6 -translate-y-1/2",children:[(0,e.jsx)(P.Calendar,{className:"size-3.5"}),(0,e.jsx)("span",{className:"sr-only",children:"Select date"})]})}),(0,e.jsx)(r.PopoverContent,{className:"w-auto overflow-hidden p-0",align:"end",alignOffset:-8,sideOffset:10,children:(0,e.jsx)(k.Calendar,{mode:"single",selected:u,captionLayout:"dropdown",month:O,onMonthChange:x,onSelect:c=>{c&&(d(c),w(y(c)),l(!1))}})})]})]})]})}S.displayName=I;function J({label:t,selectedDate:n,onSelect:a,...i}){let{[A]:o=s.DefaultComponent}=(0,s.useStackShiftUIComponents)(),[g,f]=m.useState(!1),[p,l]=m.useState(n),u=d=>{l(d),f(!1),d&&(a==null||a(d))};return(0,e.jsxs)(o,{className:"flex gap-4",...i,children:[(0,e.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,e.jsx)(v.Label,{htmlFor:"date-picker",className:"px-1",children:t}),(0,e.jsxs)(r.Popover,{open:g,onOpenChange:f,children:[(0,e.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,e.jsxs)(N.Button,{variant:"outline",id:"date-picker",className:"w-32 justify-between font-normal",children:[p?p.toLocaleDateString():"Select date",(0,e.jsx)(P.ChevronDownIcon,{})]})}),(0,e.jsx)(r.PopoverContent,{className:"w-auto overflow-hidden p-0",align:"start",children:(0,e.jsx)(k.Calendar,{mode:"single",selected:p,captionLayout:"dropdown",onSelect:u})})]})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,e.jsx)(v.Label,{htmlFor:"time-picker",className:"px-1",children:"Time"}),(0,e.jsx)(C.Input,{type:"time",id:"time-picker",step:"1",defaultValue:"10:30:00",className:"bg-background appearance-none [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:appearance-none"})]})]})}0&&(module.exports={DatePicker,DatePickerInput,DatePickerTime});
2
+ "use strict";var B=Object.create;var h=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var z=Object.getPrototypeOf,E=Object.prototype.hasOwnProperty;var U=(t,n)=>{for(var a in n)h(t,a,{get:n[a],enumerable:!0})},b=(t,n,a,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of V(n))!E.call(t,o)&&o!==a&&h(t,o,{get:()=>n[o],enumerable:!(s=F(n,o))||s.enumerable});return t};var j=(t,n,a)=>(a=t!=null?B(z(t)):{},b(n||!t||!t.__esModule?h(a,"default",{value:t,enumerable:!0}):a,t)),q=t=>b(h({},"__esModule",{value:!0}),t);var K={};U(K,{DatePicker:()=>L,DatePickerInput:()=>S,DatePickerTime:()=>J});module.exports=q(K);var P=require("lucide-react"),m=j(require("react")),N=require("@stackshift-ui/button"),k=require("@stackshift-ui/calendar"),C=require("@stackshift-ui/input"),v=require("@stackshift-ui/label"),r=require("@stackshift-ui/popover"),i=require("@stackshift-ui/system"),e=require("react/jsx-runtime"),T="DatePicker",I="DatePickerInput",A="DatePickerTime";function L({label:t,mode:n="range",selectedDate:a,onSelect:s,...o}){let{[T]:g=i.DefaultComponent}=(0,i.useStackShiftUIComponents)(),[f,c]=m.useState(!1),l=a||new Date,u=d=>{c(!1),s==null||s(d)};return(0,e.jsxs)(g,{className:(0,i.cn)("flex flex-col gap-3",o.className),...o,children:[(0,e.jsx)(v.Label,{htmlFor:"date",className:"px-1",children:t}),(0,e.jsxs)(r.Popover,{open:f,onOpenChange:c,children:[(0,e.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,e.jsxs)(N.Button,{variant:"outline",id:"date",className:"w-48 font-normal [&>span]:w-full [&>span]:justify-between",children:[l?l.toLocaleDateString():"Select date",(0,e.jsx)(P.ChevronDownIcon,{})]})}),(0,e.jsx)(r.PopoverContent,{className:"w-auto overflow-hidden p-0",align:"start",children:(0,e.jsx)(k.Calendar,{mode:n,selected:l,captionLayout:"dropdown",onSelect:u})})]})]})}L.displayName=T;function y(t){return t?t.toLocaleDateString("en-US",{day:"2-digit",month:"long",year:"numeric"}):""}function H(t){return t?!isNaN(t.getTime()):!1}function S({label:t,selectedDate:n,onSelect:a,selectedMonth:s,onMonthChange:o,...g}){let{[I]:f=i.DefaultComponent}=(0,i.useStackShiftUIComponents)(),[c,l]=m.useState(!1),[u,d]=m.useState(n||new Date),[O,w]=m.useState(s||u),[R,x]=m.useState(y(u));return(0,e.jsxs)(f,{className:"flex flex-col gap-3",...g,children:[(0,e.jsx)(v.Label,{htmlFor:"date",className:"px-1",children:t}),(0,e.jsxs)("div",{className:"relative flex gap-2",children:[(0,e.jsx)(C.Input,{id:"date",value:R,placeholder:"June 01, 2025",className:"bg-background pr-10",onChange:p=>{let D=new Date(p.target.value);x(p.target.value),H(D)&&(d(D),w(D),a==null||a(D),o==null||o(D))},onKeyDown:p=>{p.key==="ArrowDown"&&(p.preventDefault(),l(!0))}}),(0,e.jsxs)(r.Popover,{open:c,onOpenChange:l,children:[(0,e.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,e.jsxs)(N.Button,{id:"date-picker",variant:"ghost",className:"absolute top-1/2 right-2 size-6 -translate-y-1/2",children:[(0,e.jsx)(P.Calendar,{className:"size-3.5"}),(0,e.jsx)("span",{className:"sr-only",children:"Select date"})]})}),(0,e.jsx)(r.PopoverContent,{className:"w-auto overflow-hidden p-0",align:"end",alignOffset:-8,sideOffset:10,children:(0,e.jsx)(k.Calendar,{mode:"single",selected:u,captionLayout:"dropdown",month:O,onMonthChange:w,onSelect:p=>{p&&(d(p),x(y(p)),l(!1))}})})]})]})]})}S.displayName=I;function J({label:t,selectedDate:n,onSelect:a,...s}){let{[A]:o=i.DefaultComponent}=(0,i.useStackShiftUIComponents)(),[g,f]=m.useState(!1),[c,l]=m.useState(n),u=d=>{l(d),f(!1),d&&(a==null||a(d))};return(0,e.jsxs)(o,{className:"flex gap-4",...s,children:[(0,e.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,e.jsx)(v.Label,{htmlFor:"date-picker",className:"px-1",children:t}),(0,e.jsxs)(r.Popover,{open:g,onOpenChange:f,children:[(0,e.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,e.jsxs)(N.Button,{variant:"outline",id:"date-picker",className:"w-32 font-normal [&>span]:w-full [&>span]:justify-between",children:[c?c.toLocaleDateString():"Select date",(0,e.jsx)(P.ChevronDownIcon,{})]})}),(0,e.jsx)(r.PopoverContent,{className:"w-auto overflow-hidden p-0",align:"start",children:(0,e.jsx)(k.Calendar,{mode:"single",selected:c,captionLayout:"dropdown",onSelect:u})})]})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,e.jsx)(v.Label,{htmlFor:"time-picker",className:"px-1",children:"Time"}),(0,e.jsx)(C.Input,{type:"time",id:"time-picker",step:"1",defaultValue:"10:30:00",className:"bg-background appearance-none [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:appearance-none"})]})]})}0&&(module.exports={DatePicker,DatePickerInput,DatePickerTime});
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";import{a as e,b as o,c as r}from"./chunk-WYFM625G.mjs";import"./chunk-3EYN2AKU.mjs";export{e as DatePicker,o as DatePickerInput,r as DatePickerTime};
2
+ "use strict";import{a as e,b as o,c as r}from"./chunk-24RFZANX.mjs";import"./chunk-3EYN2AKU.mjs";export{e as DatePicker,o as DatePickerInput,r as DatePickerTime};