@sth87/shadcn-design-system 0.2.11 → 0.3.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/README.md +2 -3
- package/dist/AI_CONTEXT.md +4 -4
- package/dist/cjs/components/Calendar/Calendar.cjs +1 -1
- package/dist/cjs/components/Calendar/index.cjs +1 -1
- package/dist/cjs/components/Checkbox/Checkbox.cjs +1 -1
- package/dist/cjs/components/Checkbox/Confetti.cjs +1 -0
- package/dist/cjs/components/DatePicker/DatePicker.cjs +1 -1
- package/dist/cjs/components/DatePicker/RangePicker.cjs +1 -1
- package/dist/cjs/components/DatePicker/TimePicker.cjs +1 -1
- package/dist/cjs/components/Slider/Slider.cjs +1 -1
- package/dist/cjs/components/Slider/SpecSliderLabel.cjs +1 -0
- package/dist/cjs/components/Table/TableFilter/data-table-filter-popover.cjs +1 -1
- package/dist/cjs/components/Table/data-table.cjs +1 -1
- package/dist/cjs/components/Tabs/Tabs.cjs +1 -1
- package/dist/cjs/components/Tooltip/SpecTooltip.cjs +1 -0
- package/dist/cjs/components/Tooltip/Tooltip.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/packages/ui/src/components/calendar-logic.cjs +1 -0
- package/dist/cjs/packages/ui/src/components/calendar.cjs +1 -1
- package/dist/cjs/styles/index.css +1 -1
- package/dist/cjs/utils/animations.cjs +1 -1
- package/dist/cjs/utils/data-table.cjs +1 -1
- package/dist/cjs/utils/date-format.cjs +1 -0
- package/dist/esm/components/Calendar/Calendar.js +23 -19
- package/dist/esm/components/Calendar/index.js +7 -3
- package/dist/esm/components/Checkbox/Checkbox.js +46 -44
- package/dist/esm/components/Checkbox/Confetti.js +28 -0
- package/dist/esm/components/DatePicker/DatePicker.js +78 -81
- package/dist/esm/components/DatePicker/RangePicker.js +121 -124
- package/dist/esm/components/DatePicker/TimePicker.js +122 -124
- package/dist/esm/components/Slider/Slider.js +140 -199
- package/dist/esm/components/Slider/SpecSliderLabel.js +60 -0
- package/dist/esm/components/Table/TableFilter/data-table-filter-popover.js +30 -26
- package/dist/esm/components/Table/data-table.js +51 -47
- package/dist/esm/components/Tabs/Tabs.js +80 -91
- package/dist/esm/components/Tooltip/SpecTooltip.js +69 -0
- package/dist/esm/components/Tooltip/Tooltip.js +42 -85
- package/dist/esm/index.js +162 -158
- package/dist/esm/packages/ui/src/components/calendar-logic.js +83 -0
- package/dist/esm/packages/ui/src/components/calendar.js +459 -184
- package/dist/esm/styles/index.css +1 -1
- package/dist/esm/utils/animations.js +36 -44
- package/dist/esm/utils/data-table.js +6 -0
- package/dist/esm/utils/date-format.js +162 -0
- package/dist/types/components/Calendar/Calendar.d.ts +5 -5
- package/dist/types/components/Calendar/Calendar.d.ts.map +1 -1
- package/dist/types/components/Calendar/index.d.ts +1 -1
- package/dist/types/components/Calendar/index.d.ts.map +1 -1
- package/dist/types/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/types/components/Checkbox/Confetti.d.ts +2 -0
- package/dist/types/components/Checkbox/Confetti.d.ts.map +1 -0
- package/dist/types/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/types/components/DatePicker/RangePicker.d.ts.map +1 -1
- package/dist/types/components/DatePicker/TimePicker.d.ts.map +1 -1
- package/dist/types/components/Marquee/Marquee.d.ts +1 -1
- package/dist/types/components/Slider/Slider.d.ts +1 -1
- package/dist/types/components/Slider/Slider.d.ts.map +1 -1
- package/dist/types/components/Slider/SpecSliderLabel.d.ts +14 -0
- package/dist/types/components/Slider/SpecSliderLabel.d.ts.map +1 -0
- package/dist/types/components/Table/TableFilter/data-table-filter-popover.d.ts.map +1 -1
- package/dist/types/components/Table/data-table.d.ts.map +1 -1
- package/dist/types/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/types/components/Tooltip/SpecTooltip.d.ts +11 -0
- package/dist/types/components/Tooltip/SpecTooltip.d.ts.map +1 -0
- package/dist/types/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/types/components/Upload/Upload.d.ts +1 -1
- package/dist/types/packages/ui/src/components/badge.d.ts +2 -2
- package/dist/types/packages/ui/src/components/button.d.ts +1 -1
- package/dist/types/packages/ui/src/components/calendar-logic.d.ts +72 -0
- package/dist/types/packages/ui/src/components/calendar-logic.d.ts.map +1 -0
- package/dist/types/packages/ui/src/components/calendar.d.ts +95 -6
- package/dist/types/packages/ui/src/components/calendar.d.ts.map +1 -1
- package/dist/types/utils/animations.d.ts +0 -19
- package/dist/types/utils/animations.d.ts.map +1 -1
- package/dist/types/utils/data-table.d.ts.map +1 -1
- package/dist/types/utils/date-format.d.ts +24 -0
- package/dist/types/utils/date-format.d.ts.map +1 -0
- package/package.json +2 -3
- package/dist/cjs/utils/css.cjs +0 -1
- package/dist/esm/utils/css.js +0 -24
- package/dist/types/utils/css.d.ts +0 -4
- package/dist/types/utils/css.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),e=require("../packages/ui/src/lib/utils.cjs"),c=require("../components/Glass/Glass.cjs"),f="ds:transition-[transform,color,background-color,border-color,box-shadow] ds:duration-300 ds:ease-[cubic-bezier(0.34,1.56,0.64,1)]",l=(a,r)=>{switch(a){case"bounce":return{className:e.cn("ds:animate-bounce",r)};case"slide-up":return{className:e.cn("ds:animate-slide-in-from-bottom",r)};case"slide-down":return{className:e.cn("ds:animate-slide-in-from-top",r)};case"slide-left":return{className:e.cn("ds:animate-slide-in-from-right",r)};case"slide-right":return{className:e.cn("ds:animate-slide-in-from-left",r)};case"zoom-in":return{className:e.cn("ds:animate-zoom-in",r)};case"zoom-out":return{className:e.cn("ds:animate-zoom-out",r)};case"skewed":return{className:e.cn("ds:animate-skewed-in",r)};case"flip":return{className:e.cn("ds:animate-flip-in",r)};case"shake":return{className:e.cn("ds:animate-shake",r)};case"gradient-outline":return{className:e.cn("ds:gradient-outline",r)};default:return{className:r}}},u=({animation:a,children:r,className:n,rootClassName:s,variantType:o,...i})=>{switch(a){case"heartbeat":return{className:e.cn("ds:animate-heartbeat",n)};case"rainbow":return{className:e.cn("ds:animate-rainbow ds:text-primary-foreground ds:focus-visible:ring-ring/50 ds:relative ds:inline-flex ds:h-9 ds:items-center ds:justify-center ds:gap-2 ds:rounded-md ds:border-2 ds:border-transparent ds:bg-[length:200%] ds:[background-clip:padding-box,border-box,border-box] ds:[background-origin:border-box] ds:px-3 ds:py-2 ds:text-sm ds:font-medium ds:transition-colors ds:focus-visible:ring-[3px] ds:focus-visible:outline-none ds:disabled:pointer-events-none ds:disabled:opacity-50","ds:before:animate-rainbow ds:before:absolute ds:before:bottom-[-20%] ds:before:left-0 ds:before:z-0 ds:before:h-1/5 ds:before:w-full ds:before:bg-[linear-gradient(90deg,#ff4242,#a1ff42,#42a1ff,#42d0ff,#a142ff)] ds:before:[filter:blur(calc(0.625*1rem))] ds:bg-[linear-gradient(var(--primary),var(--primary)),linear-gradient(var(--primary)_30%,rgba(0,0,0,0)),linear-gradient(90deg,#ff4242,#a1ff42,#42a1ff,#42d0ff,#a142ff)]",n)};case"shine":return{className:e.cn("ds:relative ds:overflow-hidden ds:before:absolute ds:before:inset-0 ds:before:rounded-[inherit] ds:before:bg-[linear-gradient(45deg,transparent_25%,rgba(255,255,255,0.5)_50%,transparent_75%,transparent_100%)] ds:before:bg-[length:250%_250%,100%_100%] ds:before:bg-[position:200%_0,0_0] ds:before:bg-no-repeat ds:before:transition-[background-position_0s_ease] ds:before:duration-1000 ds:hover:before:bg-[position:-100%_0,0_0] ds:dark:before:bg-[linear-gradient(45deg,transparent_25%,rgba(0,0,0,0.2)_50%,transparent_75%,transparent_100%)]",n)};case"bounce":return{children:t.jsx("button",{className:e.cn(s,f,"ds:hover:scale-110",n),...i,children:r})};case"tap":return{children:t.jsx("button",{className:e.cn(s,f,"ds:active:scale-[0.85]",n),...i,children:r})};case"glass":{const d=s?.match(/((?:!)?rounded-\S+)/g),b=d?d[d.length-1]:"rounded-md";return{variant:o?"link":void 0,children:t.jsx(c.default,{className:e.cn("ds:hover:scale-110",b),children:t.jsx("span",{className:e.cn(s,"ds:!bg-none ds:!bg-transparent ds:border-0",n),children:r})})}}case"glow":return{className:e.cn(s,"ds:animate-glow",n)};case"liquid":return{className:e.cn("ds:relative ds:overflow-hidden","ds:bg-[linear-gradient(rgba(0,0,0,0.15)_0_0)] ds:bg-no-repeat","ds:bg-[length:200%_0.4em] ds:bg-[position:200%_100%]","ds:[transition:0.3s_0s,background-position_0.3s_0.3s]","ds:hover:bg-[length:200%_100%] ds:hover:bg-[position:0%_100%]","ds:hover:text-white","ds:hover:[transition:0.3s_0.3s,background-position_0.3s_0s]",n)};case"link-underline":return{variant:o?"link":void 0,className:e.cn("ds:after:bg-primary ds:relative ds:!no-underline ds:after:absolute ds:after:bottom-2 ds:after:h-px ds:after:w-2/3 ds:after:origin-bottom-right ds:after:scale-x-0 ds:after:transition-transform ds:after:duration-300 ds:after:ease-in-out ds:hover:after:origin-bottom-left ds:hover:after:scale-x-100",n)};case"loading":return{className:e.cn("ds:relative ds:overflow-hidden","ds:before:content-[''] ds:before:absolute ds:before:z-[1] ds:before:top-0 ds:before:-left-full ds:before:w-[300%] ds:before:h-full","ds:before:bg-[repeating-linear-gradient(60deg,transparent,transparent_10px,#ffffff20_10px,#ffffff20_20px)]","ds:before:animate-slide-loading",n)};case"gradient-outline":return{className:e.cn("ds:gradient-outline",n)};case"draw":return{className:e.cn("ds:animate-draw",n)};default:return null}};exports.animationClass=l;exports.animationEffect=u;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function s({column:t,withBorder:i=!1}){const e=t.getIsPinned(),n=e==="left"&&t.getIsLastColumn("left"),r=e==="right"&&t.getIsFirstColumn("right");return{boxShadow:i?n?"-4px 0 4px -4px var(--border) inset":r?"4px 0 4px -4px var(--border) inset":void 0:void 0,left:e==="left"?`${t.getStart("left")}px`:void 0,right:e==="right"?`${t.getAfter("right")}px`:void 0,position:e?"sticky":"relative",width:t.getSize(),minWidth:t.getSize(),maxWidth:t.getSize(),zIndex:e?1:void 0}}exports.getCommonPinningStyles=s;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("dayjs"),N=require("dayjs/plugin/customParseFormat");h.extend(N);const b=new Set(["y","M","L","d","E","H","h","m","s","S","a"]),y=/[A-Za-z]/,v="en-US";function S(e){const r=[];let n=0;for(;n<e.length;){const t=e[n];if(t==="'"){if(e[n+1]==="'"){r.push({kind:"literal",text:"'"}),n+=2;continue}let c="";for(n+=1;n<e.length;){if(e[n]==="'"){if(e[n+1]==="'"){c+="'",n+=2;continue}break}c+=e[n],n+=1}n+=1,r.push({kind:"literal",text:c});continue}if(!y.test(t)){r.push({kind:"literal",text:t}),n+=1;continue}let s=1;for(;e[n+s]===t;)s+=1;if(!b.has(t))throw new RangeError(`Unsupported date format token "${t.repeat(s)}" in "${e}"`);r.push({kind:"field",letter:t,count:s}),n+=s}return r}function D(e){return y.test(e)?`[${e.replace(/]/g,"")}]`:e}function o(e,r){throw new RangeError(`Unsupported date format token "${e.letter.repeat(e.count)}" in "${r}"`)}function x(e,r){const{letter:n,count:t}=e;switch(n){case"y":return t===2?"YY":t===4?"YYYY":o(e,r);case"M":case"L":return t<=2?"M".repeat(t):null;case"d":return t<=2?"D".repeat(t):o(e,r);case"E":return null;case"H":case"h":case"m":case"s":return t<=2?n.repeat(t):o(e,r);case"S":return t===3?"SSS":o(e,r);case"a":return t<=2?"A":t===3?"a":o(e,r);default:return o(e,r)}}function O(e,r,n,t){const{letter:s,count:c}=r,d=s==="M"||s==="L";if(d?c!==3&&c!==4:c>4)return o(r,n);const i=c===4;if(t){const m=i?"wide":"abbreviated",u=s==="L"?"standalone":"formatting";return d?t.localize.month(e.getMonth(),{width:m,context:u}):t.localize.day(e.getDay(),{width:m,context:u})}const f=d?{month:i?"long":"short"}:{weekday:i?"long":"short"};return new Intl.DateTimeFormat(v,f).format(e)}function R(e,r,n){if(Number.isNaN(e.getTime()))throw new RangeError("Invalid time value");const t=S(r).map(s=>s.kind==="literal"?D(s.text):x(s,r)??`[${O(e,s,r,n)}]`);return h(e).format(t.join(""))}function L(e){return!!e&&!Number.isNaN(e.getTime())}const w=["year","month","day","hour","minute","second","ms"];function A(e){switch(e){case"y":return"year";case"M":case"L":return"month";case"d":return"day";case"H":case"h":case"a":return"hour";case"m":return"minute";case"s":return"second";default:return"ms"}}function $(e,r){const{letter:n,count:t}=e;switch(n){case"y":return t===2?"YY":t===4?"YYYY":o(e,r);case"M":case"L":return t<=2?"M":t===3?"MMM":t===4?"MMMM":o(e,r);case"d":return t<=2?"D":o(e,r);case"H":case"h":case"m":case"s":return t<=2?n:o(e,r);case"S":return t===3?"SSS":o(e,r);case"a":return"A";default:return o(e,r)}}const M=e=>e.replace(/\d+/g,r=>String(Number(r))).toLowerCase();function z(e,r,n=new Date){const t=S(r),s=t.filter(a=>a.kind==="field");if(!s.length)return;const c=t.map(a=>a.kind==="literal"?D(a.text):$(a,r)).join(""),d=e.trim(),i=h(d,c,"en");if(!i.isValid()||M(i.format(c))!==M(d))return;const f=new Set(s.map(a=>A(a.letter))),m=Math.min(...[...f].map(a=>w.indexOf(a))),u=n,l=(a,E,T,Y)=>{const p=w.indexOf(a);return f.has(a)?E:p<m?T:Y},g=new Date(l("year",i.year(),u.getFullYear(),0),l("month",i.month(),u.getMonth(),0),l("day",i.date(),u.getDate(),1),l("hour",i.hour(),u.getHours(),0),l("minute",i.minute(),u.getMinutes(),0),l("second",i.second(),u.getSeconds(),0),l("ms",i.millisecond(),u.getMilliseconds(),0));return L(g)?g:void 0}exports.formatDate=R;exports.isValidDate=L;exports.parseDate=z;
|
|
@@ -1,31 +1,32 @@
|
|
|
1
1
|
import { jsx as p } from "react/jsx-runtime";
|
|
2
2
|
import { CalendarDayButton as i, Calendar as f } from "../../packages/ui/src/components/calendar.js";
|
|
3
3
|
import { cn as u } from "../../packages/ui/src/lib/utils.js";
|
|
4
|
-
import { enUS as C, vi as x } from "
|
|
5
|
-
|
|
4
|
+
import { enUS as C, vi as x } from "../../packages/ui/src/components/calendar-logic.js";
|
|
5
|
+
import { createCalendarLocale as U } from "../../packages/ui/src/components/calendar-logic.js";
|
|
6
|
+
function h({
|
|
6
7
|
language: r = "vi",
|
|
7
8
|
className: t,
|
|
8
|
-
captionLayout:
|
|
9
|
-
formatters:
|
|
9
|
+
captionLayout: e = "dropdown",
|
|
10
|
+
formatters: n,
|
|
10
11
|
buttonVariant: l,
|
|
11
|
-
locale:
|
|
12
|
-
variant:
|
|
13
|
-
color:
|
|
14
|
-
...
|
|
12
|
+
locale: a,
|
|
13
|
+
variant: c = "default",
|
|
14
|
+
color: m = "primary",
|
|
15
|
+
...d
|
|
15
16
|
}) {
|
|
16
|
-
const
|
|
17
|
+
const o = a || (r === "en" ? C : x);
|
|
17
18
|
return /* @__PURE__ */ p(
|
|
18
19
|
f,
|
|
19
20
|
{
|
|
20
|
-
...
|
|
21
|
-
locale:
|
|
21
|
+
...d,
|
|
22
|
+
locale: o,
|
|
22
23
|
buttonVariant: l,
|
|
23
|
-
captionLayout:
|
|
24
|
-
variant:
|
|
25
|
-
color:
|
|
24
|
+
captionLayout: e,
|
|
25
|
+
variant: c,
|
|
26
|
+
color: m,
|
|
26
27
|
formatters: {
|
|
27
|
-
formatMonthDropdown: (s) => s.toLocaleString(
|
|
28
|
-
...
|
|
28
|
+
formatMonthDropdown: (s) => s.toLocaleString(o.code, { month: "short" }),
|
|
29
|
+
...n
|
|
29
30
|
},
|
|
30
31
|
className: u(
|
|
31
32
|
"ds:mx-auto ds:[--cell-size:clamp(0px,calc(100vw/7.5),40px)]",
|
|
@@ -34,8 +35,11 @@ function w({
|
|
|
34
35
|
}
|
|
35
36
|
);
|
|
36
37
|
}
|
|
37
|
-
const
|
|
38
|
+
const w = i;
|
|
38
39
|
export {
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
h as Calendar,
|
|
41
|
+
w as CalendarDayButton,
|
|
42
|
+
U as createCalendarLocale,
|
|
43
|
+
C as enUSLocale,
|
|
44
|
+
x as viLocale
|
|
41
45
|
};
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { Calendar as
|
|
1
|
+
import { Calendar as o, CalendarDayButton as r } from "./Calendar.js";
|
|
2
|
+
import { createCalendarLocale as n, enUS as t, vi as c } from "../../packages/ui/src/components/calendar-logic.js";
|
|
2
3
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
o as Calendar,
|
|
5
|
+
r as CalendarDayButton,
|
|
6
|
+
n as createCalendarLocale,
|
|
7
|
+
t as enUSLocale,
|
|
8
|
+
c as viLocale
|
|
5
9
|
};
|
|
@@ -1,78 +1,80 @@
|
|
|
1
1
|
import { jsxs as t, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { Checkbox as
|
|
2
|
+
import o, { useState as L } from "react";
|
|
3
|
+
import { Checkbox as P } from "../../packages/ui/src/components/checkbox.js";
|
|
4
4
|
import { cn as r } from "../../packages/ui/src/lib/utils.js";
|
|
5
5
|
import { Tooltip as g } from "../Tooltip/Tooltip.js";
|
|
6
6
|
import { Info as C } from "lucide-react";
|
|
7
|
-
import { AnimatePresence as $ } from "motion/react";
|
|
8
|
-
import { ConfettiPiece as q } from "../../utils/css.js";
|
|
9
7
|
import { Label as b } from "../../packages/ui/src/components/label.js";
|
|
10
|
-
const
|
|
11
|
-
(N,
|
|
8
|
+
const w = () => import("./Confetti.js"), V = o.lazy(w), $ = o.forwardRef(
|
|
9
|
+
(N, v) => {
|
|
12
10
|
const {
|
|
13
|
-
label:
|
|
14
|
-
infoTooltip:
|
|
15
|
-
helperText:
|
|
16
|
-
state:
|
|
17
|
-
variant:
|
|
18
|
-
size:
|
|
19
|
-
color:
|
|
11
|
+
label: l,
|
|
12
|
+
infoTooltip: n,
|
|
13
|
+
helperText: a,
|
|
14
|
+
state: c,
|
|
15
|
+
variant: k = "default",
|
|
16
|
+
size: y = "default",
|
|
17
|
+
color: T,
|
|
20
18
|
labelPosition: s = "right",
|
|
21
|
-
labelAlignment:
|
|
22
|
-
icon:
|
|
23
|
-
animation:
|
|
24
|
-
id:
|
|
19
|
+
labelAlignment: f = "center",
|
|
20
|
+
icon: z,
|
|
21
|
+
animation: d,
|
|
22
|
+
id: I,
|
|
25
23
|
onCheckedChange: m,
|
|
26
|
-
...
|
|
27
|
-
} = N, [
|
|
24
|
+
...S
|
|
25
|
+
} = N, [j, h] = L(!1), F = o.useId();
|
|
26
|
+
o.useEffect(() => {
|
|
27
|
+
d === "confetti" && w();
|
|
28
|
+
}, [d]);
|
|
29
|
+
const i = I || F, R = {
|
|
28
30
|
default: "ds:text-muted-foreground",
|
|
29
31
|
success: "ds:text-success",
|
|
30
32
|
warning: "ds:text-warning",
|
|
31
33
|
error: "ds:text-error"
|
|
32
|
-
}, _ = (
|
|
33
|
-
|
|
34
|
-
}, p = s === "top" || s === "bottom",
|
|
34
|
+
}, _ = (u) => {
|
|
35
|
+
u && (h(!0), setTimeout(() => h(!1), 800)), m?.(u);
|
|
36
|
+
}, p = s === "top" || s === "bottom", A = p ? "ds:flex-col" : "ds:flex-row", D = p ? "ds:gap-1.5" : "ds:gap-2", E = f === "start" ? "ds:items-start" : f === "center" ? "ds:items-center" : "ds:items-end", x = "ds:flex ds:gap-2 ds:peer-disabled:cursor-not-allowed ds:peer-disabled:opacity-70";
|
|
35
37
|
return /* @__PURE__ */ t("div", { className: r("ds:flex ds:flex-col ds:gap-1.5 ds:relative", {}), children: [
|
|
36
|
-
/* @__PURE__ */ t("div", { className: r("ds:flex",
|
|
37
|
-
(s === "top" || s === "left") &&
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
/* @__PURE__ */ t("div", { className: r("ds:flex", A, D, E), children: [
|
|
39
|
+
(s === "top" || s === "left") && l && /* @__PURE__ */ t(b, { htmlFor: i, className: x, children: [
|
|
40
|
+
l,
|
|
41
|
+
n && /* @__PURE__ */ e(g, { content: n, children: /* @__PURE__ */ e(C, { className: "ds:size-3.5 ds:min-w-3.5" }) })
|
|
40
42
|
] }),
|
|
41
43
|
/* @__PURE__ */ t("div", { className: "ds:relative ds:inline-flex", children: [
|
|
42
44
|
/* @__PURE__ */ e(
|
|
43
|
-
|
|
45
|
+
P,
|
|
44
46
|
{
|
|
45
|
-
ref:
|
|
46
|
-
id:
|
|
47
|
-
...
|
|
48
|
-
variant:
|
|
49
|
-
size:
|
|
50
|
-
color:
|
|
51
|
-
icon:
|
|
52
|
-
onCheckedChange:
|
|
47
|
+
ref: v,
|
|
48
|
+
id: i,
|
|
49
|
+
...S,
|
|
50
|
+
variant: k,
|
|
51
|
+
size: y,
|
|
52
|
+
color: T,
|
|
53
|
+
icon: z,
|
|
54
|
+
onCheckedChange: d ? _ : m
|
|
53
55
|
}
|
|
54
56
|
),
|
|
55
|
-
|
|
57
|
+
j && /* @__PURE__ */ e(o.Suspense, { fallback: null, children: /* @__PURE__ */ e(V, {}) })
|
|
56
58
|
] }),
|
|
57
|
-
(s === "bottom" || s === "right") &&
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
(s === "bottom" || s === "right") && l && /* @__PURE__ */ t(b, { htmlFor: i, className: x, children: [
|
|
60
|
+
l,
|
|
61
|
+
n && /* @__PURE__ */ e(g, { content: n, children: /* @__PURE__ */ e(C, { className: "ds:size-3.5 ds:min-w-3.5" }) })
|
|
60
62
|
] })
|
|
61
63
|
] }),
|
|
62
|
-
|
|
64
|
+
a && /* @__PURE__ */ e("div", { className: "ds:flex ds:items-center ds:justify-between ds:text-xs ds:gap-2", children: a && /* @__PURE__ */ e(
|
|
63
65
|
"p",
|
|
64
66
|
{
|
|
65
67
|
className: r(
|
|
66
68
|
"ds:text-xs",
|
|
67
|
-
|
|
69
|
+
c ? R?.[c] : ""
|
|
68
70
|
),
|
|
69
|
-
children:
|
|
71
|
+
children: a
|
|
70
72
|
}
|
|
71
73
|
) })
|
|
72
74
|
] });
|
|
73
75
|
}
|
|
74
76
|
);
|
|
75
|
-
|
|
77
|
+
$.displayName = "Checkbox";
|
|
76
78
|
export {
|
|
77
|
-
|
|
79
|
+
$ as default
|
|
78
80
|
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { motion as s, easeOut as i } from "motion/react";
|
|
3
|
+
const o = ["#FF0000", "#00FF00", "#0000FF", "#FFFF00", "#FF00FF", "#00FFFF"], c = 12, r = (t) => {
|
|
4
|
+
const a = Math.random() * Math.PI * 2, e = 30 + Math.random() * 20;
|
|
5
|
+
return {
|
|
6
|
+
initial: { x: "50%", y: "50%", scale: 0, opacity: 0 },
|
|
7
|
+
animate: {
|
|
8
|
+
x: `calc(50% + ${Math.cos(a) * e}px)`,
|
|
9
|
+
y: `calc(50% + ${Math.sin(a) * e}px)`,
|
|
10
|
+
scale: [0, 1, 0],
|
|
11
|
+
opacity: [0, 1, 0]
|
|
12
|
+
},
|
|
13
|
+
transition: { duration: 0.4, delay: t * 0.05, ease: i }
|
|
14
|
+
};
|
|
15
|
+
}, l = ({ index: t }) => /* @__PURE__ */ n(
|
|
16
|
+
s.div,
|
|
17
|
+
{
|
|
18
|
+
className: "ds:absolute ds:h-1 ds:w-1 ds:rounded-full",
|
|
19
|
+
style: { backgroundColor: o[t % o.length] },
|
|
20
|
+
...r(t)
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
function m() {
|
|
24
|
+
return /* @__PURE__ */ n("div", { className: "ds:pointer-events-none ds:absolute ds:inset-0", children: Array.from({ length: c }, (t, a) => /* @__PURE__ */ n(l, { index: a }, a)) });
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
m as default
|
|
28
|
+
};
|
|
@@ -1,68 +1,65 @@
|
|
|
1
1
|
import { jsxs as h, jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import * as p from "react";
|
|
3
3
|
import { Calendar as ge } from "../../packages/ui/src/components/calendar.js";
|
|
4
|
-
import { Popover as
|
|
5
|
-
import { Drawer as ye, DrawerTrigger as
|
|
4
|
+
import { Popover as we, PopoverTrigger as ve, PopoverContent as he } from "../../packages/ui/src/components/popover.js";
|
|
5
|
+
import { Drawer as ye, DrawerTrigger as De, DrawerContent as be, DrawerHeader as Me, DrawerTitle as xe, DrawerDescription as ze } from "../../packages/ui/src/components/drawer.js";
|
|
6
6
|
import { cn as M } from "../../packages/ui/src/lib/utils.js";
|
|
7
7
|
import { TimePicker as Ce } from "./TimePicker.js";
|
|
8
8
|
import { CalendarIcon as He } from "lucide-react";
|
|
9
9
|
import { isMobile as x } from "react-device-detect";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
function
|
|
16
|
-
return t ? B(t,
|
|
10
|
+
import { DATE_FORMAT as K } from "../../constants/common.js";
|
|
11
|
+
import { parseDate as Ne, formatDate as B } from "../../utils/date-format.js";
|
|
12
|
+
import { enUS as Pe, vi as ke } from "../../packages/ui/src/components/calendar-logic.js";
|
|
13
|
+
import Se from "../Button/Button.js";
|
|
14
|
+
import Re from "../Input/Input.js";
|
|
15
|
+
function Oe(t, s = K, n) {
|
|
16
|
+
return t ? B(t, s, n) : "";
|
|
17
17
|
}
|
|
18
|
-
const z = (t,
|
|
19
|
-
|
|
20
|
-
return
|
|
21
|
-
|
|
22
|
-
function Ie(t) {
|
|
23
|
-
return t.replace(/dd|MM|yyyy/g, (o) => {
|
|
24
|
-
switch (o) {
|
|
18
|
+
const z = (t, s = K) => Ne(t, s, /* @__PURE__ */ new Date());
|
|
19
|
+
function Fe(t) {
|
|
20
|
+
return t.replace(/dd|MM|yyyy/g, (s) => {
|
|
21
|
+
switch (s) {
|
|
25
22
|
case "dd":
|
|
26
23
|
case "MM":
|
|
27
24
|
return "99";
|
|
28
25
|
case "yyyy":
|
|
29
26
|
return "9999";
|
|
30
27
|
default:
|
|
31
|
-
return
|
|
28
|
+
return s;
|
|
32
29
|
}
|
|
33
|
-
}).replace(/d|M|y/g, (
|
|
34
|
-
switch (
|
|
30
|
+
}).replace(/d|M|y/g, (s) => {
|
|
31
|
+
switch (s) {
|
|
35
32
|
case "d":
|
|
36
33
|
case "M":
|
|
37
34
|
return "9";
|
|
38
35
|
case "y":
|
|
39
36
|
return "9";
|
|
40
37
|
default:
|
|
41
|
-
return
|
|
38
|
+
return s;
|
|
42
39
|
}
|
|
43
40
|
});
|
|
44
41
|
}
|
|
45
|
-
function
|
|
42
|
+
function Ge({
|
|
46
43
|
value: t,
|
|
47
|
-
onChange:
|
|
48
|
-
onSelect:
|
|
49
|
-
calendarClassName:
|
|
50
|
-
side:
|
|
51
|
-
align:
|
|
44
|
+
onChange: s,
|
|
45
|
+
onSelect: n,
|
|
46
|
+
calendarClassName: _,
|
|
47
|
+
side: q = "bottom",
|
|
48
|
+
align: G = "end",
|
|
52
49
|
format: y = "dd/MM/yyyy",
|
|
53
|
-
language:
|
|
50
|
+
language: J = "vi",
|
|
54
51
|
mask: N,
|
|
55
|
-
closeOnSelect:
|
|
52
|
+
closeOnSelect: Q = !1,
|
|
56
53
|
calendarConfig: P,
|
|
57
54
|
desktopMode: k = "popover",
|
|
58
|
-
mobileMode:
|
|
59
|
-
showOutsideDays:
|
|
55
|
+
mobileMode: W = "drawer",
|
|
56
|
+
showOutsideDays: X = !0,
|
|
60
57
|
children: S,
|
|
61
58
|
showTime: c = !1,
|
|
62
59
|
timeFormat: g = "HH:mm",
|
|
63
60
|
hideDate: R = !1,
|
|
64
|
-
numberOfMonths:
|
|
65
|
-
variant:
|
|
61
|
+
numberOfMonths: Y = 1,
|
|
62
|
+
variant: Z = "default",
|
|
66
63
|
color: L = "primary",
|
|
67
64
|
// TimePicker props
|
|
68
65
|
timePickerMode: ee = "wheel",
|
|
@@ -75,37 +72,37 @@ function Qe({
|
|
|
75
72
|
nowButtonLabel: de = "Now",
|
|
76
73
|
timePickerLabel: ie,
|
|
77
74
|
openOnFocus: le = !0,
|
|
78
|
-
...
|
|
75
|
+
...o
|
|
79
76
|
}) {
|
|
80
77
|
let u, O;
|
|
81
78
|
typeof y == "string" ? (u = y, O = y) : (u = y.input, O = y.output);
|
|
82
79
|
let C;
|
|
83
|
-
N === !0 ? C =
|
|
84
|
-
const F = R && c ? g : c ? `${u} ${g}` : u, T = t ? z(t, F) : void 0, [
|
|
80
|
+
N === !0 ? C = Fe(u) : typeof N == "string" && (C = N);
|
|
81
|
+
const F = R && c ? g : c ? `${u} ${g}` : u, T = t ? z(t, F) : void 0, [D, b] = p.useState(!1), [d, i] = p.useState(T), [ce, w] = p.useState(T), [v, f] = p.useState(t || ""), ue = p.useRef(null), $ = p.useRef(!1), I = P?.locale ? P?.locale : J === "en" ? Pe : ke, A = x ? W : k;
|
|
85
82
|
p.useEffect(() => {
|
|
86
|
-
if (t !==
|
|
83
|
+
if (t !== v && !$.current) {
|
|
87
84
|
f(t || "");
|
|
88
85
|
const e = t ? z(t, F) : void 0;
|
|
89
|
-
e ? (i(e),
|
|
86
|
+
e ? (i(e), w(e)) : t || (i(void 0), w(void 0));
|
|
90
87
|
}
|
|
91
|
-
}, [t,
|
|
88
|
+
}, [t, v, F]);
|
|
92
89
|
const l = (e) => {
|
|
93
90
|
if (!e) return "";
|
|
94
|
-
let r =
|
|
91
|
+
let r = Oe(e, O, I);
|
|
95
92
|
return c && (r += ` ${B(e, g)}`), r;
|
|
96
93
|
}, fe = (e) => {
|
|
97
|
-
i(e), f(l(e)),
|
|
94
|
+
i(e), f(l(e)), n?.(e, l(e));
|
|
98
95
|
}, me = (e) => {
|
|
99
96
|
if (!e) {
|
|
100
|
-
f(""), i(void 0),
|
|
97
|
+
f(""), i(void 0), n?.(void 0, void 0);
|
|
101
98
|
return;
|
|
102
99
|
}
|
|
103
100
|
f(e);
|
|
104
101
|
const r = z(e, u);
|
|
105
|
-
r ? (i(r),
|
|
102
|
+
r ? (i(r), w(r), n?.(r, l(r))) : (i(void 0), n?.(void 0, void 0));
|
|
106
103
|
}, pe = (e, r, H) => {
|
|
107
104
|
if (!H) {
|
|
108
|
-
|
|
105
|
+
s?.(e, r, void 0);
|
|
109
106
|
return;
|
|
110
107
|
}
|
|
111
108
|
const m = new Date(d || /* @__PURE__ */ new Date());
|
|
@@ -114,33 +111,33 @@ function Qe({
|
|
|
114
111
|
H.getMinutes(),
|
|
115
112
|
H.getSeconds(),
|
|
116
113
|
0
|
|
117
|
-
), i(m), f(l(m)),
|
|
114
|
+
), i(m), f(l(m)), n?.(m, l(m)), s?.(e, l(m), m);
|
|
118
115
|
}, U = S ? S({
|
|
119
|
-
value:
|
|
116
|
+
value: v,
|
|
120
117
|
date: d,
|
|
121
118
|
onSelect: fe,
|
|
122
119
|
onChange: me
|
|
123
120
|
}) : /* @__PURE__ */ h(
|
|
124
|
-
|
|
121
|
+
Se,
|
|
125
122
|
{
|
|
126
123
|
variant: "ghost",
|
|
127
124
|
className: "ds:!p-1 ds:!leading-0 ds:h-auto ds:rounded ds:hover:bg-accent ds:transition-colors",
|
|
128
|
-
size:
|
|
125
|
+
size: o.size,
|
|
129
126
|
children: [
|
|
130
127
|
/* @__PURE__ */ a(
|
|
131
128
|
He,
|
|
132
129
|
{
|
|
133
130
|
className: M({
|
|
134
|
-
"ds:size-3":
|
|
135
|
-
"ds:size-3.5": !
|
|
136
|
-
"ds:size-4":
|
|
131
|
+
"ds:size-3": o.size === "xs" || o.size === "sm",
|
|
132
|
+
"ds:size-3.5": !o.size || o.size === "normal",
|
|
133
|
+
"ds:size-4": o.size === "lg" || o.size === "xl"
|
|
137
134
|
})
|
|
138
135
|
}
|
|
139
136
|
),
|
|
140
137
|
/* @__PURE__ */ a("span", { className: "ds:sr-only", children: "Select date" })
|
|
141
138
|
]
|
|
142
139
|
}
|
|
143
|
-
),
|
|
140
|
+
), V = /* @__PURE__ */ h(
|
|
144
141
|
"div",
|
|
145
142
|
{
|
|
146
143
|
className: M(
|
|
@@ -158,9 +155,9 @@ function Qe({
|
|
|
158
155
|
selected: d,
|
|
159
156
|
captionLayout: "dropdown",
|
|
160
157
|
month: ce,
|
|
161
|
-
onMonthChange:
|
|
162
|
-
numberOfMonths: x ? 1 :
|
|
163
|
-
variant:
|
|
158
|
+
onMonthChange: w,
|
|
159
|
+
numberOfMonths: x ? 1 : Y || 1,
|
|
160
|
+
variant: Z,
|
|
164
161
|
color: L,
|
|
165
162
|
onSelect: (e) => {
|
|
166
163
|
let r = e;
|
|
@@ -169,13 +166,13 @@ function Qe({
|
|
|
169
166
|
d.getMinutes(),
|
|
170
167
|
d.getSeconds(),
|
|
171
168
|
d.getMilliseconds()
|
|
172
|
-
)), i(r), f(l(r)),
|
|
169
|
+
)), i(r), f(l(r)), n?.(r, l(r)), Q && !c && b(!1);
|
|
173
170
|
},
|
|
174
|
-
locale:
|
|
171
|
+
locale: I,
|
|
175
172
|
formatters: {
|
|
176
|
-
formatMonthDropdown: (e) => e.toLocaleString(
|
|
173
|
+
formatMonthDropdown: (e) => e.toLocaleString(I.code, { month: "short" })
|
|
177
174
|
},
|
|
178
|
-
showOutsideDays:
|
|
175
|
+
showOutsideDays: X,
|
|
179
176
|
className: M(
|
|
180
177
|
"ds:my-auto ds:bg-transparent ds:mx-auto",
|
|
181
178
|
{
|
|
@@ -183,7 +180,7 @@ function Qe({
|
|
|
183
180
|
"ds:[--cell-size:clamp(0px,calc(100vw/7.5),34px)]": !x && k !== "drawer",
|
|
184
181
|
"ds:w-full": A === "drawer" && c
|
|
185
182
|
},
|
|
186
|
-
|
|
183
|
+
_
|
|
187
184
|
)
|
|
188
185
|
}
|
|
189
186
|
),
|
|
@@ -207,13 +204,13 @@ function Qe({
|
|
|
207
204
|
timeLabel: ie,
|
|
208
205
|
standalone: !1,
|
|
209
206
|
color: L,
|
|
210
|
-
isOpen:
|
|
207
|
+
isOpen: D
|
|
211
208
|
}
|
|
212
209
|
) })
|
|
213
210
|
]
|
|
214
211
|
}
|
|
215
|
-
),
|
|
216
|
-
/* @__PURE__ */ a(
|
|
212
|
+
), j = /* @__PURE__ */ h(we, { open: D, onOpenChange: b, children: [
|
|
213
|
+
/* @__PURE__ */ a(ve, { asChild: !0, disabled: o.disabled, children: U }),
|
|
217
214
|
/* @__PURE__ */ a(
|
|
218
215
|
he,
|
|
219
216
|
{
|
|
@@ -221,15 +218,15 @@ function Qe({
|
|
|
221
218
|
"ds:w-auto ds:overflow-hidden ds:p-0",
|
|
222
219
|
"ds:backdrop-blur ds:bg-background/50"
|
|
223
220
|
),
|
|
224
|
-
side:
|
|
225
|
-
align:
|
|
226
|
-
children:
|
|
221
|
+
side: q,
|
|
222
|
+
align: G,
|
|
223
|
+
children: V
|
|
227
224
|
}
|
|
228
225
|
)
|
|
229
|
-
] }),
|
|
230
|
-
/* @__PURE__ */ a(
|
|
226
|
+
] }), E = /* @__PURE__ */ h(ye, { open: D, onOpenChange: b, children: [
|
|
227
|
+
/* @__PURE__ */ a(De, { asChild: !0, children: U }),
|
|
231
228
|
/* @__PURE__ */ h(
|
|
232
|
-
|
|
229
|
+
be,
|
|
233
230
|
{
|
|
234
231
|
className: M(
|
|
235
232
|
"ds:w-auto ds:overflow-hidden ds:p-0",
|
|
@@ -240,40 +237,40 @@ function Qe({
|
|
|
240
237
|
/* @__PURE__ */ a(xe, { children: "Select date" }),
|
|
241
238
|
/* @__PURE__ */ a(ze, { children: "Set date" })
|
|
242
239
|
] }),
|
|
243
|
-
|
|
240
|
+
V
|
|
244
241
|
]
|
|
245
242
|
}
|
|
246
243
|
)
|
|
247
244
|
] });
|
|
248
|
-
return S ? A === "drawer" ?
|
|
249
|
-
|
|
245
|
+
return S ? A === "drawer" ? E : j : /* @__PURE__ */ a(
|
|
246
|
+
Re,
|
|
250
247
|
{
|
|
251
|
-
...
|
|
248
|
+
...o,
|
|
252
249
|
ref: ue,
|
|
253
250
|
type: "text",
|
|
254
251
|
clearable: !0,
|
|
255
|
-
value:
|
|
252
|
+
value: v,
|
|
256
253
|
mask: C,
|
|
257
254
|
onChange: (e) => {
|
|
258
|
-
|
|
255
|
+
$.current = !0, f(e.target.value);
|
|
259
256
|
const r = z(e.target.value, u);
|
|
260
|
-
r ? (i(r),
|
|
257
|
+
r ? (i(r), w(r), n?.(r, l(r)), s?.(e, l(r), r)) : (n?.(void 0, void 0), s?.(e, void 0, void 0));
|
|
261
258
|
},
|
|
262
259
|
onFocus: (e) => {
|
|
263
|
-
le && !
|
|
260
|
+
le && !D && !C && b(!0), o.onFocus?.(e);
|
|
264
261
|
},
|
|
265
262
|
onBlur: (e) => {
|
|
266
263
|
setTimeout(() => {
|
|
267
|
-
|
|
268
|
-
}, 150),
|
|
264
|
+
$.current = !1, D || !z(v, u) && v && (f(""), i(void 0), w(void 0), n?.(void 0, void 0));
|
|
265
|
+
}, 150), o.onBlur?.(e);
|
|
269
266
|
},
|
|
270
267
|
onKeyDown: (e) => {
|
|
271
|
-
e.key === "ArrowDown" && (e.preventDefault(),
|
|
268
|
+
e.key === "ArrowDown" && (e.preventDefault(), b(!0)), o.onKeyDown?.(e);
|
|
272
269
|
},
|
|
273
|
-
suffixIcon: A === "drawer" ?
|
|
270
|
+
suffixIcon: A === "drawer" ? E : j
|
|
274
271
|
}
|
|
275
272
|
);
|
|
276
273
|
}
|
|
277
274
|
export {
|
|
278
|
-
|
|
275
|
+
Ge as DatePicker
|
|
279
276
|
};
|