@stackshift-ui/date-picker 1.0.0-beta.4 → 1.0.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +9 -9
- package/dist/chunk-3EYN2AKU.mjs +0 -1
- package/dist/chunk-WYFM625G.mjs +0 -1
- package/dist/date-picker.d.ts +0 -27
- package/dist/date-picker.js +0 -2
- package/dist/date-picker.mjs +0 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -2
- package/dist/index.mjs +0 -2
- package/dist/setupTests.d.ts +0 -2
- package/dist/setupTests.js +0 -51
- package/dist/setupTests.mjs +0 -51
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stackshift-ui/date-picker",
|
|
3
3
|
"description": "A date picker component with range and presets.",
|
|
4
|
-
"version": "1.0.0-beta.
|
|
4
|
+
"version": "1.0.0-beta.7",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -38,16 +38,16 @@
|
|
|
38
38
|
"classnames": "^2.5.1",
|
|
39
39
|
"date-fns": "^4.1.0",
|
|
40
40
|
"lucide-react": "^0.468.0",
|
|
41
|
-
"@stackshift-ui/
|
|
42
|
-
"@stackshift-ui/
|
|
43
|
-
"@stackshift-ui/scripts": "
|
|
44
|
-
"@stackshift-ui/
|
|
45
|
-
"@stackshift-ui/
|
|
46
|
-
"@stackshift-ui/
|
|
47
|
-
"@stackshift-ui/
|
|
41
|
+
"@stackshift-ui/button": "7.0.0-beta.6",
|
|
42
|
+
"@stackshift-ui/input": "7.0.0-beta.4",
|
|
43
|
+
"@stackshift-ui/scripts": "7.0.0-beta.3",
|
|
44
|
+
"@stackshift-ui/popover": "1.0.0-beta.5",
|
|
45
|
+
"@stackshift-ui/label": "1.0.0-beta.5",
|
|
46
|
+
"@stackshift-ui/system": "7.0.0-beta.4",
|
|
47
|
+
"@stackshift-ui/calendar": "1.0.0-beta.7"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@stackshift-ui/system": ">=
|
|
50
|
+
"@stackshift-ui/system": ">=7.0.0-beta.4",
|
|
51
51
|
"@types/react": "16.8 - 19",
|
|
52
52
|
"next": "10 - 14",
|
|
53
53
|
"react": "16.8 - 19",
|
package/dist/chunk-3EYN2AKU.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var g=Object.create;var f=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var m=(a=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(a,{get:(b,c)=>(typeof require!="undefined"?require:b)[c]}):a)(function(a){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var n=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports);var l=(a,b,c,e)=>{if(b&&typeof b=="object"||typeof b=="function")for(let d of i(b))!k.call(a,d)&&d!==c&&f(a,d,{get:()=>b[d],enumerable:!(e=h(b,d))||e.enumerable});return a};var o=(a,b,c)=>(c=a!=null?g(j(a)):{},l(b||!a||!a.__esModule?f(c,"default",{value:a,enumerable:!0}):c,a));export{m as a,n as b,o as c};
|
package/dist/chunk-WYFM625G.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Calendar as B,ChevronDownIcon as T}from"lucide-react";import*as c 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:p,...i}){let{[L]:f=C}=w(),[m,s]=c.useState(!1),o=n||new Date,d=l=>{s(!1),p==null||p(l)};return t(f,{className:F("flex flex-col gap-3",i.className),...i,children:[e(D,{htmlFor:"date",className:"px-1",children:a}),t(h,{open:m,onOpenChange:s,children:[e(k,{asChild:!0,children:t(v,{variant:"outline",id:"date",className:"w-48 justify-between font-normal",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:p,onMonthChange:i,...f}){let{[S]:m=C}=w(),[s,o]=c.useState(!1),[d,l]=c.useState(u||new Date),[O,x]=c.useState(p||d),[R,b]=c.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),i==null||i(g))},onKeyDown:r=>{r.key==="ArrowDown"&&(r.preventDefault(),o(!0))}}),t(h,{open:s,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,...p}){let{[V]:i=C}=w(),[f,m]=c.useState(!1),[s,o]=c.useState(u),d=l=>{o(l),m(!1),l&&(n==null||n(l))};return t(i,{className:"flex gap-4",...p,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 justify-between font-normal",children:[s?s.toLocaleDateString():"Select date",e(T,{})]})}),e(N,{className:"w-auto overflow-hidden p-0",align:"start",children:e(P,{mode:"single",selected:s,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};
|
package/dist/date-picker.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export interface DatePickerProps {
|
|
2
|
-
label?: string;
|
|
3
|
-
mode?: "single" | "multiple" | "range" | undefined;
|
|
4
|
-
selectedDate?: Date;
|
|
5
|
-
onSelect?: (date: Date) => void;
|
|
6
|
-
required?: boolean;
|
|
7
|
-
min?: number;
|
|
8
|
-
max?: number;
|
|
9
|
-
className?: string;
|
|
10
|
-
}
|
|
11
|
-
export declare function DatePicker({ label, mode, selectedDate, onSelect, ...props }: DatePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
export declare namespace DatePicker {
|
|
13
|
-
var displayName: string;
|
|
14
|
-
}
|
|
15
|
-
export interface DatePickerInputProps extends Omit<DatePickerProps, "mode"> {
|
|
16
|
-
selectedMonth?: Date;
|
|
17
|
-
onMonthChange?: (date: Date) => void;
|
|
18
|
-
}
|
|
19
|
-
export declare function DatePickerInput({ label, selectedDate, onSelect, selectedMonth, onMonthChange, ...props }: DatePickerInputProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
-
export declare namespace DatePickerInput {
|
|
21
|
-
var displayName: string;
|
|
22
|
-
}
|
|
23
|
-
export interface DatePickerTimeProps extends Omit<DatePickerProps, "mode"> {
|
|
24
|
-
selectedTime?: string;
|
|
25
|
-
onTimeChange?: (time: string) => void;
|
|
26
|
-
}
|
|
27
|
-
export declare function DatePickerTime({ label, selectedDate, onSelect, ...props }: DatePickerTimeProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/date-picker.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
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});
|
package/dist/date-picker.mjs
DELETED
package/dist/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./date-picker";
|
package/dist/index.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
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});
|
package/dist/index.mjs
DELETED
package/dist/setupTests.d.ts
DELETED