@customafk/lunas-ui 0.1.76 → 0.1.77

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.
Files changed (160) hide show
  1. package/dist/{button-BHCJWumN.d.cts → button-BzWNryHl.d.mts} +6 -6
  2. package/dist/{button-DU7qy6Sc.d.mts → button-DCsGcClf.d.cts} +7 -7
  3. package/dist/data-display/date-tooltip.cjs +1 -1
  4. package/dist/data-display/date-tooltip.mjs +1 -1
  5. package/dist/data-display/date.cjs +1 -1
  6. package/dist/data-display/date.mjs +1 -1
  7. package/dist/data-display/empty.d.cts +2 -2
  8. package/dist/data-display/empty.d.mts +2 -2
  9. package/dist/data-display/statistic.d.cts +2 -2
  10. package/dist/data-display/statistic.d.mts +2 -2
  11. package/dist/{date-BeK-z6-c.mjs → date-DHYZRwKG.mjs} +2 -2
  12. package/dist/{date-BeK-z6-c.mjs.map → date-DHYZRwKG.mjs.map} +1 -1
  13. package/dist/{date-DU8xM0hQ.cjs → date-DsocyDCo.cjs} +2 -2
  14. package/dist/{date-DU8xM0hQ.cjs.map → date-DsocyDCo.cjs.map} +1 -1
  15. package/dist/{dialog-eWIoqTyJ.d.mts → dialog-BSlqE4oW.d.cts} +12 -12
  16. package/dist/{dialog-GicGDkD7.d.cts → dialog-CfZKsxFA.d.mts} +12 -12
  17. package/dist/dialogs/detail-dialog/components/sidebar.d.cts +29 -29
  18. package/dist/dialogs/detail-dialog/components/sidebar.d.mts +27 -27
  19. package/dist/dialogs/detail-dialog/index.cjs +1 -1
  20. package/dist/dialogs/detail-dialog/index.cjs.map +1 -1
  21. package/dist/dialogs/detail-dialog/index.d.cts +1 -1
  22. package/dist/dialogs/detail-dialog/index.d.mts +1 -1
  23. package/dist/dialogs/detail-dialog/index.mjs +1 -1
  24. package/dist/dialogs/detail-dialog/index.mjs.map +1 -1
  25. package/dist/features/descriptions/index.cjs +1 -1
  26. package/dist/features/descriptions/index.mjs +1 -1
  27. package/dist/features/search-modal/index.d.cts +2 -2
  28. package/dist/features/search-modal/index.d.mts +2 -2
  29. package/dist/features/tables/index.cjs +1 -1
  30. package/dist/features/tables/index.d.cts +3 -3
  31. package/dist/features/tables/index.d.mts +1 -1
  32. package/dist/features/tables/index.mjs +1 -1
  33. package/dist/features/tanstack-form/index.d.cts +90 -90
  34. package/dist/features/tanstack-form/index.d.mts +90 -90
  35. package/dist/{input-B2qKftzQ.d.cts → input-BmZlgHdZ.d.mts} +6 -6
  36. package/dist/{input-D6oqtoad.d.mts → input-DquhMlv8.d.cts} +7 -7
  37. package/dist/layouts/app-layout/index.d.cts +29 -29
  38. package/dist/layouts/app-layout/index.d.mts +4 -4
  39. package/dist/layouts/flex.d.cts +10 -10
  40. package/dist/layouts/flex.d.mts +10 -10
  41. package/dist/layouts/service-layout/index.d.cts +14 -14
  42. package/dist/layouts/service-layout/index.d.mts +4 -4
  43. package/dist/pages/FeatureDeveloping.d.cts +2 -2
  44. package/dist/pages/FeatureDeveloping.d.mts +2 -2
  45. package/dist/pages/FeatureFixing.d.cts +2 -2
  46. package/dist/pages/FeatureFixing.d.mts +2 -2
  47. package/dist/pages/NotAuthorized.d.cts +2 -2
  48. package/dist/pages/NotAuthorized.d.mts +2 -2
  49. package/dist/pages/NotFound.d.cts +2 -2
  50. package/dist/pages/NotFound.d.mts +2 -2
  51. package/dist/{separator-DojmxxQY.d.mts → separator-BLK3kO-5.d.cts} +3 -3
  52. package/dist/{separator-ji0MW5b4.d.cts → separator-Cuz8xych.d.mts} +3 -3
  53. package/dist/{tooltip-B5BVrx0y.d.cts → tooltip-BZLJxq35.d.cts} +6 -6
  54. package/dist/{tooltip-Dfl_OaO8.d.mts → tooltip-CnUwvDim.d.mts} +6 -6
  55. package/dist/typography/paragraph.d.cts +2 -2
  56. package/dist/typography/paragraph.d.mts +2 -2
  57. package/dist/typography/title.d.cts +2 -2
  58. package/dist/typography/title.d.mts +2 -2
  59. package/dist/ui/alert-dialog.d.cts +12 -12
  60. package/dist/ui/alert-dialog.d.mts +12 -12
  61. package/dist/ui/alert.d.cts +6 -6
  62. package/dist/ui/alert.d.mts +6 -6
  63. package/dist/ui/aspect-ratio.d.cts +2 -2
  64. package/dist/ui/aspect-ratio.d.mts +2 -2
  65. package/dist/ui/avatar.d.cts +4 -4
  66. package/dist/ui/avatar.d.mts +4 -4
  67. package/dist/ui/badge.d.cts +5 -5
  68. package/dist/ui/badge.d.mts +5 -5
  69. package/dist/ui/breadcrumb.d.cts +8 -8
  70. package/dist/ui/breadcrumb.d.mts +8 -8
  71. package/dist/ui/button-group.d.cts +6 -6
  72. package/dist/ui/button-group.d.mts +8 -8
  73. package/dist/ui/button.d.cts +1 -1
  74. package/dist/ui/button.d.mts +1 -1
  75. package/dist/ui/calendar.d.cts +4 -4
  76. package/dist/ui/calendar.d.mts +4 -4
  77. package/dist/ui/card.d.cts +8 -8
  78. package/dist/ui/card.d.mts +8 -8
  79. package/dist/ui/carousel.d.cts +7 -7
  80. package/dist/ui/carousel.d.mts +7 -7
  81. package/dist/ui/collapsible.d.cts +4 -4
  82. package/dist/ui/collapsible.d.mts +4 -4
  83. package/dist/ui/command.d.cts +11 -11
  84. package/dist/ui/command.d.mts +11 -11
  85. package/dist/ui/context-menu.d.cts +16 -16
  86. package/dist/ui/context-menu.d.mts +16 -16
  87. package/dist/ui/dialog.d.cts +1 -1
  88. package/dist/ui/dialog.d.mts +1 -1
  89. package/dist/ui/drawer.d.cts +11 -11
  90. package/dist/ui/drawer.d.mts +11 -11
  91. package/dist/ui/dropdown-menu.d.cts +16 -16
  92. package/dist/ui/dropdown-menu.d.mts +16 -16
  93. package/dist/ui/empty.d.cts +9 -9
  94. package/dist/ui/empty.d.mts +7 -7
  95. package/dist/ui/field.d.cts +25 -25
  96. package/dist/ui/field.d.mts +25 -25
  97. package/dist/ui/file-uploader.d.cts +2 -2
  98. package/dist/ui/file-uploader.d.mts +2 -2
  99. package/dist/ui/form.d.cts +11 -11
  100. package/dist/ui/form.d.mts +11 -11
  101. package/dist/ui/hover-card.d.cts +4 -4
  102. package/dist/ui/hover-card.d.mts +4 -4
  103. package/dist/ui/input-otp.d.cts +5 -5
  104. package/dist/ui/input-otp.d.mts +5 -5
  105. package/dist/ui/input.d.cts +1 -1
  106. package/dist/ui/input.d.mts +1 -1
  107. package/dist/ui/inputs/search-input.d.cts +3 -3
  108. package/dist/ui/inputs/search-input.d.mts +3 -3
  109. package/dist/ui/item.d.cts +18 -18
  110. package/dist/ui/item.d.mts +18 -18
  111. package/dist/ui/label.d.cts +2 -2
  112. package/dist/ui/label.d.mts +2 -2
  113. package/dist/ui/menubar.d.cts +17 -17
  114. package/dist/ui/menubar.d.mts +17 -17
  115. package/dist/ui/multi-select.d.mts +3 -3
  116. package/dist/ui/navigation-menu.d.cts +11 -11
  117. package/dist/ui/navigation-menu.d.mts +11 -11
  118. package/dist/ui/pagination.d.cts +9 -9
  119. package/dist/ui/pagination.d.mts +9 -9
  120. package/dist/ui/popover.d.cts +5 -5
  121. package/dist/ui/popover.d.mts +5 -5
  122. package/dist/ui/progress.d.cts +2 -2
  123. package/dist/ui/progress.d.mts +2 -2
  124. package/dist/ui/radio-group.d.cts +3 -3
  125. package/dist/ui/radio-group.d.mts +3 -3
  126. package/dist/ui/resizable.d.cts +4 -4
  127. package/dist/ui/resizable.d.mts +4 -4
  128. package/dist/ui/scroll-area.d.cts +3 -3
  129. package/dist/ui/scroll-area.d.mts +6 -6
  130. package/dist/ui/select.d.cts +11 -11
  131. package/dist/ui/select.d.mts +11 -11
  132. package/dist/ui/separator.d.cts +1 -1
  133. package/dist/ui/separator.d.mts +1 -1
  134. package/dist/ui/sheet.d.cts +9 -9
  135. package/dist/ui/sheet.d.mts +9 -9
  136. package/dist/ui/sidebar.d.cts +31 -31
  137. package/dist/ui/sidebar.d.mts +31 -31
  138. package/dist/ui/skeleton.d.cts +2 -2
  139. package/dist/ui/skeleton.d.mts +2 -2
  140. package/dist/ui/slider.d.cts +2 -2
  141. package/dist/ui/slider.d.mts +2 -2
  142. package/dist/ui/sonner.d.cts +2 -2
  143. package/dist/ui/sonner.d.mts +2 -2
  144. package/dist/ui/spinner.d.cts +2 -2
  145. package/dist/ui/spinner.d.mts +2 -2
  146. package/dist/ui/switch.d.cts +2 -2
  147. package/dist/ui/switch.d.mts +2 -2
  148. package/dist/ui/table.d.cts +18 -18
  149. package/dist/ui/table.d.mts +9 -9
  150. package/dist/ui/tabs.d.cts +5 -5
  151. package/dist/ui/tabs.d.mts +5 -5
  152. package/dist/ui/textarea.d.cts +2 -2
  153. package/dist/ui/textarea.d.mts +2 -2
  154. package/dist/ui/toggle-group.d.cts +3 -3
  155. package/dist/ui/toggle-group.d.mts +3 -3
  156. package/dist/ui/toggle.d.cts +5 -5
  157. package/dist/ui/toggle.d.mts +5 -5
  158. package/dist/ui/tooltip.d.cts +1 -1
  159. package/dist/ui/tooltip.d.mts +1 -1
  160. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
- import * as react_jsx_runtime32 from "react/jsx-runtime";
2
- import * as class_variance_authority_types12 from "class-variance-authority/types";
1
+ import * as react_jsx_runtime53 from "react/jsx-runtime";
3
2
  import { VariantProps } from "class-variance-authority";
3
+ import * as class_variance_authority_types12 from "class-variance-authority/types";
4
4
 
5
5
  //#region packages/components/ui/button.variants.d.ts
6
6
 
@@ -8,9 +8,9 @@ import { VariantProps } from "class-variance-authority";
8
8
  * Button variants definition for styling using class-variance-authority
9
9
  */
10
10
  declare const buttonVariants: (props?: ({
11
- variant?: "default" | "outline" | "link" | "soft" | "subtle" | "ghost" | null | undefined;
11
+ variant?: "link" | "default" | "outline" | "ghost" | "soft" | "subtle" | null | undefined;
12
12
  color?: "muted" | "warning" | "success" | "info" | "primary" | "secondary" | "important" | "danger" | null | undefined;
13
- size?: "default" | "sm" | "lg" | "xs" | "md" | "xl" | "icon" | null | undefined;
13
+ size?: "xs" | "sm" | "md" | "lg" | "xl" | "default" | "icon" | null | undefined;
14
14
  } & class_variance_authority_types12.ClassProp) | undefined) => string;
15
15
  type ButtonVariantProps = VariantProps<typeof buttonVariants>;
16
16
  //#endregion
@@ -51,7 +51,7 @@ declare function Button({
51
51
  disabled,
52
52
  type,
53
53
  ...props
54
- }: ButtonProps): react_jsx_runtime32.JSX.Element;
54
+ }: ButtonProps): react_jsx_runtime53.JSX.Element;
55
55
  //#endregion
56
56
  export { ButtonProps as n, Button as t };
57
- //# sourceMappingURL=button-BHCJWumN.d.cts.map
57
+ //# sourceMappingURL=button-BzWNryHl.d.mts.map
@@ -1,6 +1,6 @@
1
- import * as react_jsx_runtime76 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime31 from "react/jsx-runtime";
2
+ import * as class_variance_authority_types12 from "class-variance-authority/types";
2
3
  import { VariantProps } from "class-variance-authority";
3
- import * as class_variance_authority_types11 from "class-variance-authority/types";
4
4
 
5
5
  //#region packages/components/ui/button.variants.d.ts
6
6
 
@@ -8,10 +8,10 @@ import * as class_variance_authority_types11 from "class-variance-authority/type
8
8
  * Button variants definition for styling using class-variance-authority
9
9
  */
10
10
  declare const buttonVariants: (props?: ({
11
- variant?: "default" | "outline" | "link" | "soft" | "subtle" | "ghost" | null | undefined;
11
+ variant?: "link" | "default" | "outline" | "ghost" | "soft" | "subtle" | null | undefined;
12
12
  color?: "muted" | "warning" | "success" | "info" | "primary" | "secondary" | "important" | "danger" | null | undefined;
13
- size?: "default" | "sm" | "lg" | "xs" | "md" | "xl" | "icon" | null | undefined;
14
- } & class_variance_authority_types11.ClassProp) | undefined) => string;
13
+ size?: "xs" | "sm" | "md" | "lg" | "xl" | "default" | "icon" | null | undefined;
14
+ } & class_variance_authority_types12.ClassProp) | undefined) => string;
15
15
  type ButtonVariantProps = VariantProps<typeof buttonVariants>;
16
16
  //#endregion
17
17
  //#region packages/components/ui/button.d.ts
@@ -51,7 +51,7 @@ declare function Button({
51
51
  disabled,
52
52
  type,
53
53
  ...props
54
- }: ButtonProps): react_jsx_runtime76.JSX.Element;
54
+ }: ButtonProps): react_jsx_runtime31.JSX.Element;
55
55
  //#endregion
56
56
  export { ButtonProps as n, Button as t };
57
- //# sourceMappingURL=button-DU7qy6Sc.d.mts.map
57
+ //# sourceMappingURL=button-DCsGcClf.d.cts.map
@@ -1,2 +1,2 @@
1
- const e=require(`../chunk-Bmb41Sf3.cjs`),t=require(`../date-DU8xM0hQ.cjs`),n=require(`../badge-xKNC7uv3.cjs`),r=require(`../tooltip-a3HDmxog.cjs`);let i=require(`react/jsx-runtime`);const a=({date:e})=>(0,i.jsx)(r.r,{children:(0,i.jsxs)(r.t,{children:[(0,i.jsx)(r.i,{asChild:!0,children:(0,i.jsx)(n.t,{className:`h-fit`,children:(0,i.jsx)(t.t,{date:e,format:`medium`,className:`font-normal text-white text-xs`})})}),(0,i.jsx)(r.n,{children:(0,i.jsx)(t.t,{date:e,format:`full`,showTime:!0,className:`font-[Inter]! font-medium`})})]})});exports.DateTooltip=a;
1
+ const e=require(`../chunk-Bmb41Sf3.cjs`),t=require(`../date-DsocyDCo.cjs`),n=require(`../badge-xKNC7uv3.cjs`),r=require(`../tooltip-a3HDmxog.cjs`);let i=require(`react/jsx-runtime`);const a=({date:e})=>(0,i.jsx)(r.r,{children:(0,i.jsxs)(r.t,{children:[(0,i.jsx)(r.i,{asChild:!0,children:(0,i.jsx)(n.t,{className:`h-fit`,children:(0,i.jsx)(t.t,{date:e,format:`medium`,className:`font-normal text-white text-xs`})})}),(0,i.jsx)(r.n,{children:(0,i.jsx)(t.t,{date:e,format:`full`,showTime:!0,className:`font-[Inter]! font-medium`})})]})});exports.DateTooltip=a;
2
2
  //# sourceMappingURL=date-tooltip.cjs.map
@@ -1,2 +1,2 @@
1
- import{t as e}from"../date-BeK-z6-c.mjs";import{t}from"../badge-C0sv1P-x.mjs";import{i as n,n as r,r as i,t as a}from"../tooltip-pjVAbfk-.mjs";import{jsx as o,jsxs as s}from"react/jsx-runtime";const c=({date:c})=>o(i,{children:s(a,{children:[o(n,{asChild:!0,children:o(t,{className:`h-fit`,children:o(e,{date:c,format:`medium`,className:`font-normal text-white text-xs`})})}),o(r,{children:o(e,{date:c,format:`full`,showTime:!0,className:`font-[Inter]! font-medium`})})]})});export{c as DateTooltip};
1
+ import{t as e}from"../date-DHYZRwKG.mjs";import{t}from"../badge-C0sv1P-x.mjs";import{i as n,n as r,r as i,t as a}from"../tooltip-pjVAbfk-.mjs";import{jsx as o,jsxs as s}from"react/jsx-runtime";const c=({date:c})=>o(i,{children:s(a,{children:[o(n,{asChild:!0,children:o(t,{className:`h-fit`,children:o(e,{date:c,format:`medium`,className:`font-normal text-white text-xs`})})}),o(r,{children:o(e,{date:c,format:`full`,showTime:!0,className:`font-[Inter]! font-medium`})})]})});export{c as DateTooltip};
2
2
  //# sourceMappingURL=date-tooltip.mjs.map
@@ -1 +1 @@
1
- const e=require(`../date-DU8xM0hQ.cjs`);exports.DateDisplay=e.t;
1
+ const e=require(`../date-DsocyDCo.cjs`);exports.DateDisplay=e.t;
@@ -1 +1 @@
1
- import{t as e}from"../date-BeK-z6-c.mjs";export{e as DateDisplay};
1
+ import{t as e}from"../date-DHYZRwKG.mjs";export{e as DateDisplay};
@@ -1,7 +1,7 @@
1
- import * as react_jsx_runtime1 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
2
2
 
3
3
  //#region packages/components/data-display/empty.d.ts
4
- declare const EmptyDisplay: () => react_jsx_runtime1.JSX.Element;
4
+ declare const EmptyDisplay: () => react_jsx_runtime0.JSX.Element;
5
5
  //#endregion
6
6
  export { EmptyDisplay };
7
7
  //# sourceMappingURL=empty.d.cts.map
@@ -1,7 +1,7 @@
1
- import * as react_jsx_runtime106 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
2
2
 
3
3
  //#region packages/components/data-display/empty.d.ts
4
- declare const EmptyDisplay: () => react_jsx_runtime106.JSX.Element;
4
+ declare const EmptyDisplay: () => react_jsx_runtime0.JSX.Element;
5
5
  //#endregion
6
6
  export { EmptyDisplay };
7
7
  //# sourceMappingURL=empty.d.mts.map
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime0 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime30 from "react/jsx-runtime";
2
2
  import * as react0 from "react";
3
3
 
4
4
  //#region packages/components/data-display/statistic.d.ts
@@ -23,7 +23,7 @@ declare const Statistic: react0.MemoExoticComponent<({
23
23
  showTrailingZeros,
24
24
  size,
25
25
  value
26
- }: Props) => react_jsx_runtime0.JSX.Element>;
26
+ }: Props) => react_jsx_runtime30.JSX.Element>;
27
27
  //#endregion
28
28
  export { Statistic };
29
29
  //# sourceMappingURL=statistic.d.cts.map
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime22 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime1 from "react/jsx-runtime";
2
2
  import * as react0 from "react";
3
3
 
4
4
  //#region packages/components/data-display/statistic.d.ts
@@ -23,7 +23,7 @@ declare const Statistic: react0.MemoExoticComponent<({
23
23
  showTrailingZeros,
24
24
  size,
25
25
  value
26
- }: Props) => react_jsx_runtime22.JSX.Element>;
26
+ }: Props) => react_jsx_runtime1.JSX.Element>;
27
27
  //#endregion
28
28
  export { Statistic };
29
29
  //# sourceMappingURL=statistic.d.mts.map
@@ -1,2 +1,2 @@
1
- import{cn as e}from"@customafk/react-toolkit/utils";import{jsx as t}from"react/jsx-runtime";import{useCallback as n,useMemo as r}from"react";import{format as i,isThisMonth as a,isThisWeek as o,isThisYear as s,isToday as c,isTomorrow as l,isValid as u,isYesterday as d,parseISO as f}from"@customafk/react-toolkit/date-fns";const p={weekdays:[`Chủ Nhật`,`Thứ Hai`,`Thứ Ba`,`Thứ Tư`,`Thứ Năm`,`Thứ Sáu`,`Thứ Bảy`],weekdaysShort:[`CN`,`T2`,`T3`,`T4`,`T5`,`T6`,`T7`],months:[`Tháng 1`,`Tháng 2`,`Tháng 3`,`Tháng 4`,`Tháng 5`,`Tháng 6`,`Tháng 7`,`Tháng 8`,`Tháng 9`,`Tháng 10`,`Tháng 11`,`Tháng 12`],monthsShort:[`T1`,`T2`,`T3`,`T4`,`T5`,`T6`,`T7`,`T8`,`T9`,`T10`,`T11`,`T12`]},m={"01-01":`Tết Dương lịch`,"03-08":`Quốc tế Phụ nữ`,"04-30":`Ngày Giải phóng miền Nam`,"05-01":`Quốc tế Lao động`,"09-02":`Quốc khánh`,"10-20":`Ngày Phụ nữ Việt Nam`,"11-20":`Ngày Nhà giáo Việt Nam`};Object.freeze({SECOND:1e3,MINUTE:60*1e3,HOUR:3600*1e3,DAY:1440*60*1e3,WEEK:10080*60*1e3,MONTH:720*60*60*1e3,YEAR:365*24*60*60*1e3});const h=Object.freeze({MINUTE:60,HOUR:3600,DAY:1440*60,WEEK:10080*60,MONTH:720*60*60,YEAR:365*24*60*60});Object.freeze({HOUR:60,DAY:1440,WEEK:10080,MONTH:720*60});const g=({date:g,format:_=`medium`,showHoliday:v=!1,showTime:y=!1,className:b=``,title:x})=>{let S=r(()=>{try{if(g instanceof Date)return u(g)?g:null;if(typeof g==`string`){let e=f(g);return u(e)?e:new Date(g)}if(typeof g==`number`){let e=new Date(g);return u(e)?e:null}return null}catch{return null}},[g]),C=n(e=>{let t=new Date,n=Math.floor((t.getTime()-e.getTime())/1e3);return n<60?`Vừa xong`:n<3600?`${Math.floor(n/h.MINUTE)} phút trước`:n<86400?`${Math.floor(n/h.HOUR)} giờ trước`:n<604800?`${Math.floor(n/h.DAY)} ngày trước`:n<2592e3?`${Math.floor(n/h.WEEK)} tuần trước`:n<31536e3?`${Math.floor(n/h.MONTH)} tháng trước`:`${Math.floor(n/h.YEAR)} năm trước`},[]),w=n((e,t=!1)=>{let n=e.getDay();return t?p.weekdaysShort[n]:p.weekdays[n]},[]),T=n((e,t=!1)=>{let n=e.getMonth();return t?p.monthsShort[n]:p.months[n]},[]),E=n(e=>m[i(e,`MM-dd`)]||null,[]),D=n(e=>{if(c(e))return y?`Hôm nay ${i(e,`HH:mm`)}`:`Hôm nay`;if(d(e))return y?`Hôm qua ${i(e,`HH:mm`)}`:`Hôm qua`;if(l(e))return y?`Ngày mai ${i(e,`HH:mm`)}`:`Ngày mai`;if(o(e)){let t=w(e);return y?`${t} ${i(e,`HH:mm`)}`:t}if(a(e)){let t=i(e,`d`);return y?`${t}/${i(e,`M`)} ${i(e,`HH:mm`)}`:`${t}/${i(e,`M`)}`}return s(e)?y?i(e,`d/M HH:mm`):i(e,`d/M`):y?i(e,`d/M/yyyy HH:mm`):i(e,`d/M/yyyy`)},[w,y]),O=n((e,t)=>{let n=y?i(e,`, HH:mm`):``;switch(t){case`short`:return i(e,`d/M/yy`)+n;case`medium`:return i(e,`dd/MM/yyyy`)+n;case`long`:return`${i(e,`d`)} ${T(e)} ${i(e,`yyyy`)}`+n;case`full`:return`${w(e)}, ngày ${i(e,`d`)} ${T(e)} năm ${i(e,`yyyy`)}`+n;case`relative`:return C(e);case`datetime`:return i(e,`d/M/yyyy HH:mm`);case`time`:return i(e,`HH:mm`);case`smart`:return D(e);default:return i(e,`d/M/yyyy`)+n}},[D,T,w,C,y]);if(!S)return t(`span`,{className:e(`text-muted-foreground text-sm`,b),children:`--/--/----`});let k=O(S,_),A=v?E(S):null,j=A?`${k} (${A})`:k,M=x||i(S,`EEEE, d MMMM yyyy HH:mm:ss`);return t(`time`,{dateTime:S.toISOString(),className:e(`font-number text-accent-foreground text-sm tabular-nums`,b),title:M,children:j})};export{g as t};
2
- //# sourceMappingURL=date-BeK-z6-c.mjs.map
1
+ import{cn as e}from"@customafk/react-toolkit/utils";import{jsx as t}from"react/jsx-runtime";import{useCallback as n,useMemo as r}from"react";import{format as i,isThisMonth as a,isThisWeek as o,isThisYear as s,isToday as c,isTomorrow as l,isValid as u,isYesterday as d,parseISO as f}from"@customafk/react-toolkit/date-fns";const p={weekdays:[`Chủ Nhật`,`Thứ Hai`,`Thứ Ba`,`Thứ Tư`,`Thứ Năm`,`Thứ Sáu`,`Thứ Bảy`],weekdaysShort:[`CN`,`T2`,`T3`,`T4`,`T5`,`T6`,`T7`],months:[`Tháng 1`,`Tháng 2`,`Tháng 3`,`Tháng 4`,`Tháng 5`,`Tháng 6`,`Tháng 7`,`Tháng 8`,`Tháng 9`,`Tháng 10`,`Tháng 11`,`Tháng 12`],monthsShort:[`T1`,`T2`,`T3`,`T4`,`T5`,`T6`,`T7`,`T8`,`T9`,`T10`,`T11`,`T12`]},m={"01-01":`Tết Dương lịch`,"03-08":`Quốc tế Phụ nữ`,"04-30":`Ngày Giải phóng miền Nam`,"05-01":`Quốc tế Lao động`,"09-02":`Quốc khánh`,"10-20":`Ngày Phụ nữ Việt Nam`,"11-20":`Ngày Nhà giáo Việt Nam`};Object.freeze({SECOND:1e3,MINUTE:60*1e3,HOUR:3600*1e3,DAY:1440*60*1e3,WEEK:10080*60*1e3,MONTH:720*60*60*1e3,YEAR:365*24*60*60*1e3});const h=Object.freeze({MINUTE:60,HOUR:3600,DAY:1440*60,WEEK:10080*60,MONTH:720*60*60,YEAR:365*24*60*60});Object.freeze({HOUR:60,DAY:1440,WEEK:10080,MONTH:720*60});const g=({date:g,format:_=`medium`,showHoliday:v=!1,showTime:y=!1,className:b=``,title:x})=>{let S=r(()=>{try{if(g instanceof Date)return u(g)?g:null;if(typeof g==`string`){let e=f(g);return u(e)?e:new Date(g)}if(typeof g==`number`){let e=new Date(g);return u(e)?e:null}return null}catch{return null}},[g]),C=n(e=>{let t=new Date,n=Math.floor((t.getTime()-e.getTime())/1e3);return n<60?`Vừa xong`:n<3600?`${Math.floor(n/h.MINUTE)} phút trước`:n<86400?`${Math.floor(n/h.HOUR)} giờ trước`:n<604800?`${Math.floor(n/h.DAY)} ngày trước`:n<2592e3?`${Math.floor(n/h.WEEK)} tuần trước`:n<31536e3?`${Math.floor(n/h.MONTH)} tháng trước`:`${Math.floor(n/h.YEAR)} năm trước`},[]),w=n((e,t=!1)=>{let n=e.getDay();return t?p.weekdaysShort[n]:p.weekdays[n]},[]),T=n((e,t=!1)=>{let n=e.getMonth();return t?p.monthsShort[n]:p.months[n]},[]),E=n(e=>m[i(e,`MM-dd`)]||null,[]),D=n(e=>{if(c(e))return y?`Hôm nay ${i(e,`HH:mm`)}`:`Hôm nay`;if(d(e))return y?`Hôm qua ${i(e,`HH:mm`)}`:`Hôm qua`;if(l(e))return y?`Ngày mai ${i(e,`HH:mm`)}`:`Ngày mai`;if(o(e)){let t=w(e);return y?`${t} ${i(e,`HH:mm`)}`:t}if(a(e)){let t=i(e,`d`);return y?`${t}/${i(e,`M`)} ${i(e,`HH:mm`)}`:`${t}/${i(e,`M`)}`}return s(e)?y?i(e,`d/M HH:mm`):i(e,`d/M`):y?i(e,`d/M/yyyy HH:mm`):i(e,`d/M/yyyy`)},[w,y]),O=n((e,t)=>{let n=y?i(e,`, HH:mm`):``;switch(t){case`short`:return i(e,`d/M/yy`)+n;case`medium`:return i(e,`dd/MM/yyyy`)+n;case`long`:return`${i(e,`d`)} ${T(e)} ${i(e,`yyyy`)}`+n;case`full`:return`${w(e)}, ngày ${i(e,`d`)} ${T(e)} năm ${i(e,`yyyy`)}`+n;case`relative`:return C(e);case`datetime`:return i(e,`d/M/yyyy HH:mm`);case`time`:return i(e,`HH:mm`);case`smart`:return D(e);default:return i(e,`d/M/yyyy`)+n}},[D,T,w,C,y]);if(!S)return t(`span`,{className:e(`text-muted-foreground text-sm`,b),children:`--/--/----`});let k=O(S,_),A=v?E(S):null,j=A?`${k} (${A})`:k,M=x||i(S,`EEEE, d MMMM yyyy HH:mm:ss`);return t(`time`,{dateTime:S.toISOString(),className:e(`text-text-positive-weak text-xs tabular-nums`,b),title:M,children:j})};export{g as t};
2
+ //# sourceMappingURL=date-DHYZRwKG.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"date-BeK-z6-c.mjs","names":["DateDisplay: React.FC<Props>","date"],"sources":["../packages/constants.tsx","../packages/components/data-display/date.tsx"],"sourcesContent":["// Vietnamese locale configuration\nexport const vietnameseLocale = {\n weekdays: ['Chủ Nhật', 'Thứ Hai', 'Thứ Ba', 'Thứ Tư', 'Thứ Năm', 'Thứ Sáu', 'Thứ Bảy'],\n weekdaysShort: ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'],\n months: ['Tháng 1', 'Tháng 2', 'Tháng 3', 'Tháng 4', 'Tháng 5', 'Tháng 6', 'Tháng 7', 'Tháng 8', 'Tháng 9', 'Tháng 10', 'Tháng 11', 'Tháng 12'],\n monthsShort: ['T1', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7', 'T8', 'T9', 'T10', 'T11', 'T12'],\n};\n\n// Vietnamese holidays\nexport const vietnameseHolidays = {\n '01-01': 'Tết Dương lịch',\n '03-08': 'Quốc tế Phụ nữ',\n '04-30': 'Ngày Giải phóng miền Nam',\n '05-01': 'Quốc tế Lao động',\n '09-02': 'Quốc khánh',\n '10-20': 'Ngày Phụ nữ Việt Nam',\n '11-20': 'Ngày Nhà giáo Việt Nam',\n};\n\n// Time Constants in milliseconds, seconds, and minutes\nexport const TIME_IN_MS = Object.freeze({\n SECOND: 1000,\n MINUTE: 60 * 1000,\n HOUR: 60 * 60 * 1000,\n DAY: 24 * 60 * 60 * 1000,\n WEEK: 7 * 24 * 60 * 60 * 1000,\n MONTH: 30 * 24 * 60 * 60 * 1000, // Approximation for month length = 30 days\n YEAR: 365 * 24 * 60 * 60 * 1000,\n});\n\nexport const TIME_IN_SECONDS = Object.freeze({\n MINUTE: 60,\n HOUR: 60 * 60,\n DAY: 24 * 60 * 60,\n WEEK: 7 * 24 * 60 * 60,\n MONTH: 30 * 24 * 60 * 60,\n YEAR: 365 * 24 * 60 * 60,\n});\n\nexport const TIME_IN_MINUTES = Object.freeze({\n HOUR: 60,\n DAY: 24 * 60,\n WEEK: 7 * 24 * 60,\n MONTH: 30 * 24 * 60,\n});\n","import { useCallback, useMemo } from 'react';\n\nimport { format, isThisMonth, isThisWeek, isThisYear, isToday, isTomorrow, isValid, isYesterday, parseISO } from '@customafk/react-toolkit/date-fns';\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { TIME_IN_SECONDS, vietnameseHolidays, vietnameseLocale } from '@/constants';\n\ninterface Props {\n date: Date | string | number;\n format?:\n | 'short' // 15/03/24\n | 'medium' // 15/03/2024\n | 'long' // 15 tháng 3, 2024\n | 'full' // Thứ Sáu, ngày 15 tháng 3 năm 2024\n | 'relative' // 2 giờ trước\n | 'datetime' // 15/03/2024 14:30\n | 'time' // 14:30\n | 'smart'; // Tự động chọn format phù hợp\n showHoliday?: boolean;\n showTime?: boolean;\n className?: string;\n title?: string; // Tooltip khi hover\n}\n\nexport const DateDisplay: React.FC<Props> = ({ date, format: formatType = 'medium', showHoliday = false, showTime = false, className = '', title }) => {\n const parsedDate = useMemo(() => {\n try {\n if (date instanceof Date) {\n return isValid(date) ? date : null;\n }\n if (typeof date === 'string') {\n const parsed = parseISO(date);\n return isValid(parsed) ? parsed : new Date(date);\n }\n if (typeof date === 'number') {\n const parsed = new Date(date);\n return isValid(parsed) ? parsed : null;\n }\n return null;\n } catch {\n return null;\n }\n }, [date]);\n\n // Format relative time in Vietnamese\n const formatRelativeTime = useCallback((date: Date): string => {\n const now = new Date();\n const diffInSeconds = Math.floor((now.getTime() - date.getTime()) / 1000);\n\n if (diffInSeconds < 60) return 'Vừa xong';\n if (diffInSeconds < 3600) return `${Math.floor(diffInSeconds / TIME_IN_SECONDS.MINUTE)} phút trước`;\n if (diffInSeconds < 86400) return `${Math.floor(diffInSeconds / TIME_IN_SECONDS.HOUR)} giờ trước`;\n if (diffInSeconds < 604800) return `${Math.floor(diffInSeconds / TIME_IN_SECONDS.DAY)} ngày trước`;\n if (diffInSeconds < 2592000) return `${Math.floor(diffInSeconds / TIME_IN_SECONDS.WEEK)} tuần trước`;\n if (diffInSeconds < 31536000) return `${Math.floor(diffInSeconds / TIME_IN_SECONDS.MONTH)} tháng trước`;\n return `${Math.floor(diffInSeconds / TIME_IN_SECONDS.YEAR)} năm trước`;\n }, []);\n\n // Vietnamese weekday\n const getVietnameseWeekday = useCallback((date: Date, short: boolean = false): string => {\n const dayIndex = date.getDay();\n return short ? vietnameseLocale.weekdaysShort[dayIndex] : vietnameseLocale.weekdays[dayIndex];\n }, []);\n\n // Vietnamese month\n const getVietnameseMonth = useCallback((date: Date, short: boolean = false): string => {\n const monthIndex = date.getMonth();\n return short ? vietnameseLocale.monthsShort[monthIndex] : vietnameseLocale.months[monthIndex];\n }, []);\n\n // Check holiday\n const getHoliday = useCallback((date: Date): string | null => {\n const monthDay = format(date, 'MM-dd') as keyof typeof vietnameseHolidays;\n return vietnameseHolidays[monthDay] || null;\n }, []);\n\n // Smart format - choose appropriate format based on date\n const getSmartFormat = useCallback(\n (date: Date): string => {\n if (isToday(date)) {\n return showTime ? `Hôm nay ${format(date, 'HH:mm')}` : 'Hôm nay';\n }\n if (isYesterday(date)) {\n return showTime ? `Hôm qua ${format(date, 'HH:mm')}` : 'Hôm qua';\n }\n if (isTomorrow(date)) {\n return showTime ? `Ngày mai ${format(date, 'HH:mm')}` : 'Ngày mai';\n }\n if (isThisWeek(date)) {\n const weekday = getVietnameseWeekday(date);\n return showTime ? `${weekday} ${format(date, 'HH:mm')}` : weekday;\n }\n if (isThisMonth(date)) {\n const day = format(date, 'd');\n return showTime ? `${day}/${format(date, 'M')} ${format(date, 'HH:mm')}` : `${day}/${format(date, 'M')}`;\n }\n if (isThisYear(date)) {\n return showTime ? format(date, 'd/M HH:mm') : format(date, 'd/M');\n }\n return showTime ? format(date, 'd/M/yyyy HH:mm') : format(date, 'd/M/yyyy');\n },\n [getVietnameseWeekday, showTime]\n );\n\n // Main formatting function\n const formatDate = useCallback(\n (date: Date, type: string): string => {\n const timeStr = showTime ? format(date, ', HH:mm') : '';\n\n switch (type) {\n case 'short':\n return format(date, 'd/M/yy') + timeStr;\n\n case 'medium':\n return format(date, 'dd/MM/yyyy') + timeStr;\n\n case 'long':\n return `${format(date, 'd')} ${getVietnameseMonth(date)} ${format(date, 'yyyy')}` + timeStr;\n\n case 'full': {\n const data = `${getVietnameseWeekday(date)}, ngày ${format(date, 'd')} ${getVietnameseMonth(date)} năm ${format(date, 'yyyy')}`;\n return data + timeStr;\n }\n\n case 'relative':\n return formatRelativeTime(date);\n\n case 'datetime':\n return format(date, 'd/M/yyyy HH:mm');\n\n case 'time':\n return format(date, 'HH:mm');\n\n case 'smart':\n return getSmartFormat(date);\n\n default:\n return format(date, 'd/M/yyyy') + timeStr;\n }\n },\n [getSmartFormat, getVietnameseMonth, getVietnameseWeekday, formatRelativeTime, showTime]\n );\n\n if (!parsedDate) {\n return <span className={cn('text-muted-foreground text-sm', className)}>--/--/----</span>;\n }\n\n const formattedDate = formatDate(parsedDate, formatType);\n const holiday = showHoliday ? getHoliday(parsedDate) : null;\n const displayText = holiday ? `${formattedDate} (${holiday})` : formattedDate;\n const tooltipTitle = title || format(parsedDate, 'EEEE, d MMMM yyyy HH:mm:ss');\n\n return (\n <time dateTime={parsedDate.toISOString()} className={cn('font-number text-accent-foreground text-sm tabular-nums', className)} title={tooltipTitle}>\n {displayText}\n </time>\n );\n};\n"],"mappings":"kUACA,MAAa,EAAmB,CAC9B,SAAU,CAAC,WAAY,UAAW,SAAU,SAAU,UAAW,UAAW,UAAU,CACtF,cAAe,CAAC,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,KAAK,CACzD,OAAQ,CAAC,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,WAAY,WAAY,WAAW,CAC/I,YAAa,CAAC,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,MAAO,MAAO,MAAM,CACzF,CAGY,EAAqB,CAChC,QAAS,iBACT,QAAS,iBACT,QAAS,2BACT,QAAS,mBACT,QAAS,aACT,QAAS,uBACT,QAAS,yBACV,CAGyB,OAAO,OAAO,CACtC,OAAQ,IACR,OAAQ,GAAK,IACb,KAAM,KAAU,IAChB,IAAK,KAAU,GAAK,IACpB,KAAM,MAAc,GAAK,IACzB,MAAO,IAAU,GAAK,GAAK,IAC3B,KAAM,IAAM,GAAK,GAAK,GAAK,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AQ,EAAR,CACE,IAAK,QACH,OAAO,EAAOA,EAAM,SAAS,CAAG,EAElC,IAAK,SACH,OAAO,EAAOA,EAAM,aAAa,CAAG,EAEtC,IAAK,OACH,MAAO,GAAG,EAAOA,EAAM,IAAI,CAAC,GAAG,EAAmBA,EAAK,CAAC,GAAG,EAAOA,EAAM,OAAO,GAAK,EAEtF,IAAK,OAEH,MADa,GAAG,EAAqBA,EAAK,CAAC,SAAS,EAAOA,EAAM,IAAI,CAAC,GAAG,EAAmBA,EAAK,CAAC,OAAO,EAAOA,EAAM,OAAO,GAC/G,EAGhB,IAAK,WACH,OAAO,EAAmBA,EAAK,CAEjC,IAAK,WACH,OAAO,EAAOA,EAAM,iBAAiB,CAEvC,IAAK,OACH,OAAO,EAAOA,EAAM,QAAQ,CAE9B,IAAK,QACH,OAAO,EAAeA,EAAK,CAE7B,QACE,OAAO,EAAOA,EAAM,WAAW,CAAG,IAGxC,CAAC,EAAgB,EAAoB,EAAsB,EAAoB,EAAS,CACzF,CAED,GAAI,CAAC,EACH,OAAO,EAAC,OAAA,CAAK,UAAW,EAAG,gCAAiC,EAAU,UAAE,cAAiB,CAG3F,IAAM,EAAgB,EAAW,EAAY,EAAW,CAClD,EAAU,EAAc,EAAW,EAAW,CAAG,KACjD,EAAc,EAAU,GAAG,EAAc,IAAI,EAAQ,GAAK,EAC1D,EAAe,GAAS,EAAO,EAAY,6BAA6B,CAE9E,OACE,EAAC,OAAA,CAAK,SAAU,EAAW,aAAa,CAAE,UAAW,EAAG,0DAA2D,EAAU,CAAE,MAAO,WACnI,GACI"}
1
+ {"version":3,"file":"date-DHYZRwKG.mjs","names":["DateDisplay: React.FC<Props>","date"],"sources":["../packages/constants.tsx","../packages/components/data-display/date.tsx"],"sourcesContent":["// Vietnamese locale configuration\nexport const vietnameseLocale = {\n weekdays: ['Chủ Nhật', 'Thứ Hai', 'Thứ Ba', 'Thứ Tư', 'Thứ Năm', 'Thứ Sáu', 'Thứ Bảy'],\n weekdaysShort: ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'],\n months: ['Tháng 1', 'Tháng 2', 'Tháng 3', 'Tháng 4', 'Tháng 5', 'Tháng 6', 'Tháng 7', 'Tháng 8', 'Tháng 9', 'Tháng 10', 'Tháng 11', 'Tháng 12'],\n monthsShort: ['T1', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7', 'T8', 'T9', 'T10', 'T11', 'T12'],\n};\n\n// Vietnamese holidays\nexport const vietnameseHolidays = {\n '01-01': 'Tết Dương lịch',\n '03-08': 'Quốc tế Phụ nữ',\n '04-30': 'Ngày Giải phóng miền Nam',\n '05-01': 'Quốc tế Lao động',\n '09-02': 'Quốc khánh',\n '10-20': 'Ngày Phụ nữ Việt Nam',\n '11-20': 'Ngày Nhà giáo Việt Nam',\n};\n\n// Time Constants in milliseconds, seconds, and minutes\nexport const TIME_IN_MS = Object.freeze({\n SECOND: 1000,\n MINUTE: 60 * 1000,\n HOUR: 60 * 60 * 1000,\n DAY: 24 * 60 * 60 * 1000,\n WEEK: 7 * 24 * 60 * 60 * 1000,\n MONTH: 30 * 24 * 60 * 60 * 1000, // Approximation for month length = 30 days\n YEAR: 365 * 24 * 60 * 60 * 1000,\n});\n\nexport const TIME_IN_SECONDS = Object.freeze({\n MINUTE: 60,\n HOUR: 60 * 60,\n DAY: 24 * 60 * 60,\n WEEK: 7 * 24 * 60 * 60,\n MONTH: 30 * 24 * 60 * 60,\n YEAR: 365 * 24 * 60 * 60,\n});\n\nexport const TIME_IN_MINUTES = Object.freeze({\n HOUR: 60,\n DAY: 24 * 60,\n WEEK: 7 * 24 * 60,\n MONTH: 30 * 24 * 60,\n});\n","import { useCallback, useMemo } from 'react';\n\nimport { format, isThisMonth, isThisWeek, isThisYear, isToday, isTomorrow, isValid, isYesterday, parseISO } from '@customafk/react-toolkit/date-fns';\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { TIME_IN_SECONDS, vietnameseHolidays, vietnameseLocale } from '@/constants';\n\ninterface Props {\n date: Date | string | number;\n format?:\n | 'short' // 15/03/24\n | 'medium' // 15/03/2024\n | 'long' // 15 tháng 3, 2024\n | 'full' // Thứ Sáu, ngày 15 tháng 3 năm 2024\n | 'relative' // 2 giờ trước\n | 'datetime' // 15/03/2024 14:30\n | 'time' // 14:30\n | 'smart'; // Tự động chọn format phù hợp\n showHoliday?: boolean;\n showTime?: boolean;\n className?: string;\n title?: string; // Tooltip khi hover\n}\n\nexport const DateDisplay: React.FC<Props> = ({ date, format: formatType = 'medium', showHoliday = false, showTime = false, className = '', title }) => {\n const parsedDate = useMemo(() => {\n try {\n if (date instanceof Date) {\n return isValid(date) ? date : null;\n }\n if (typeof date === 'string') {\n const parsed = parseISO(date);\n return isValid(parsed) ? parsed : new Date(date);\n }\n if (typeof date === 'number') {\n const parsed = new Date(date);\n return isValid(parsed) ? parsed : null;\n }\n return null;\n } catch {\n return null;\n }\n }, [date]);\n\n // Format relative time in Vietnamese\n const formatRelativeTime = useCallback((date: Date): string => {\n const now = new Date();\n const diffInSeconds = Math.floor((now.getTime() - date.getTime()) / 1000);\n\n if (diffInSeconds < 60) return 'Vừa xong';\n if (diffInSeconds < 3600) return `${Math.floor(diffInSeconds / TIME_IN_SECONDS.MINUTE)} phút trước`;\n if (diffInSeconds < 86400) return `${Math.floor(diffInSeconds / TIME_IN_SECONDS.HOUR)} giờ trước`;\n if (diffInSeconds < 604800) return `${Math.floor(diffInSeconds / TIME_IN_SECONDS.DAY)} ngày trước`;\n if (diffInSeconds < 2592000) return `${Math.floor(diffInSeconds / TIME_IN_SECONDS.WEEK)} tuần trước`;\n if (diffInSeconds < 31536000) return `${Math.floor(diffInSeconds / TIME_IN_SECONDS.MONTH)} tháng trước`;\n return `${Math.floor(diffInSeconds / TIME_IN_SECONDS.YEAR)} năm trước`;\n }, []);\n\n // Vietnamese weekday\n const getVietnameseWeekday = useCallback((date: Date, short: boolean = false): string => {\n const dayIndex = date.getDay();\n return short ? vietnameseLocale.weekdaysShort[dayIndex] : vietnameseLocale.weekdays[dayIndex];\n }, []);\n\n // Vietnamese month\n const getVietnameseMonth = useCallback((date: Date, short: boolean = false): string => {\n const monthIndex = date.getMonth();\n return short ? vietnameseLocale.monthsShort[monthIndex] : vietnameseLocale.months[monthIndex];\n }, []);\n\n // Check holiday\n const getHoliday = useCallback((date: Date): string | null => {\n const monthDay = format(date, 'MM-dd') as keyof typeof vietnameseHolidays;\n return vietnameseHolidays[monthDay] || null;\n }, []);\n\n // Smart format - choose appropriate format based on date\n const getSmartFormat = useCallback(\n (date: Date): string => {\n if (isToday(date)) {\n return showTime ? `Hôm nay ${format(date, 'HH:mm')}` : 'Hôm nay';\n }\n if (isYesterday(date)) {\n return showTime ? `Hôm qua ${format(date, 'HH:mm')}` : 'Hôm qua';\n }\n if (isTomorrow(date)) {\n return showTime ? `Ngày mai ${format(date, 'HH:mm')}` : 'Ngày mai';\n }\n if (isThisWeek(date)) {\n const weekday = getVietnameseWeekday(date);\n return showTime ? `${weekday} ${format(date, 'HH:mm')}` : weekday;\n }\n if (isThisMonth(date)) {\n const day = format(date, 'd');\n return showTime ? `${day}/${format(date, 'M')} ${format(date, 'HH:mm')}` : `${day}/${format(date, 'M')}`;\n }\n if (isThisYear(date)) {\n return showTime ? format(date, 'd/M HH:mm') : format(date, 'd/M');\n }\n return showTime ? format(date, 'd/M/yyyy HH:mm') : format(date, 'd/M/yyyy');\n },\n [getVietnameseWeekday, showTime]\n );\n\n // Main formatting function\n const formatDate = useCallback(\n (date: Date, type: string): string => {\n const timeStr = showTime ? format(date, ', HH:mm') : '';\n\n switch (type) {\n case 'short':\n return format(date, 'd/M/yy') + timeStr;\n\n case 'medium':\n return format(date, 'dd/MM/yyyy') + timeStr;\n\n case 'long':\n return `${format(date, 'd')} ${getVietnameseMonth(date)} ${format(date, 'yyyy')}` + timeStr;\n\n case 'full': {\n const data = `${getVietnameseWeekday(date)}, ngày ${format(date, 'd')} ${getVietnameseMonth(date)} năm ${format(date, 'yyyy')}`;\n return data + timeStr;\n }\n\n case 'relative':\n return formatRelativeTime(date);\n\n case 'datetime':\n return format(date, 'd/M/yyyy HH:mm');\n\n case 'time':\n return format(date, 'HH:mm');\n\n case 'smart':\n return getSmartFormat(date);\n\n default:\n return format(date, 'd/M/yyyy') + timeStr;\n }\n },\n [getSmartFormat, getVietnameseMonth, getVietnameseWeekday, formatRelativeTime, showTime]\n );\n\n if (!parsedDate) {\n return <span className={cn('text-muted-foreground text-sm', className)}>--/--/----</span>;\n }\n\n const formattedDate = formatDate(parsedDate, formatType);\n const holiday = showHoliday ? getHoliday(parsedDate) : null;\n const displayText = holiday ? `${formattedDate} (${holiday})` : formattedDate;\n const tooltipTitle = title || format(parsedDate, 'EEEE, d MMMM yyyy HH:mm:ss');\n\n return (\n <time dateTime={parsedDate.toISOString()} className={cn('text-text-positive-weak text-xs tabular-nums', className)} title={tooltipTitle}>\n {displayText}\n </time>\n );\n};\n"],"mappings":"kUACA,MAAa,EAAmB,CAC9B,SAAU,CAAC,WAAY,UAAW,SAAU,SAAU,UAAW,UAAW,UAAU,CACtF,cAAe,CAAC,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,KAAK,CACzD,OAAQ,CAAC,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,WAAY,WAAY,WAAW,CAC/I,YAAa,CAAC,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,MAAO,MAAO,MAAM,CACzF,CAGY,EAAqB,CAChC,QAAS,iBACT,QAAS,iBACT,QAAS,2BACT,QAAS,mBACT,QAAS,aACT,QAAS,uBACT,QAAS,yBACV,CAGyB,OAAO,OAAO,CACtC,OAAQ,IACR,OAAQ,GAAK,IACb,KAAM,KAAU,IAChB,IAAK,KAAU,GAAK,IACpB,KAAM,MAAc,GAAK,IACzB,MAAO,IAAU,GAAK,GAAK,IAC3B,KAAM,IAAM,GAAK,GAAK,GAAK,IAC5B,CAAC,CAEF,MAAa,EAAkB,OAAO,OAAO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M,SAAS,CAAG,EAElC,IAAK,SACH,OAAO,EAAOA,EAAM,aAAa,CAAG,EAEtC,IAAK,OACH,MAAO,GAAG,EAAOA,EAAM,IAAI,CAAC,GAAG,EAAmBA,EAAK,CAAC,GAAG,EAAOA,EAAM,OAAO,GAAK,EAEtF,IAAK,OAEH,MADa,GAAG,EAAqBA,EAAK,CAAC,SAAS,EAAOA,EAAM,IAAI,CAAC,GAAG,EAAmBA,EAAK,CAAC,OAAO,EAAOA,EAAM,OAAO,GAC/G,EAGhB,IAAK,WACH,OAAO,EAAmBA,EAAK,CAEjC,IAAK,WACH,OAAO,EAAOA,EAAM,iBAAiB,CAEvC,IAAK,OACH,OAAO,EAAOA,EAAM,QAAQ,CAE9B,IAAK,QACH,OAAO,EAAeA,EAAK,CAE7B,QACE,OAAO,EAAOA,EAAM,WAAW,CAAG,IAGxC,CAAC,EAAgB,EAAoB,EAAsB,EAAoB,EAAS,CACzF,CAED,GAAI,CAAC,EACH,OAAO,EAAC,OAAA,CAAK,UAAW,EAAG,gCAAiC,EAAU,UAAE,cAAiB,CAG3F,IAAM,EAAgB,EAAW,EAAY,EAAW,CAClD,EAAU,EAAc,EAAW,EAAW,CAAG,KACjD,EAAc,EAAU,GAAG,EAAc,IAAI,EAAQ,GAAK,EAC1D,EAAe,GAAS,EAAO,EAAY,6BAA6B,CAE9E,OACE,EAAC,OAAA,CAAK,SAAU,EAAW,aAAa,CAAE,UAAW,EAAG,+CAAgD,EAAU,CAAE,MAAO,WACxH,GACI"}
@@ -1,2 +1,2 @@
1
- const e=require(`./chunk-Bmb41Sf3.cjs`);let t=require(`@customafk/react-toolkit/utils`),n=require(`react/jsx-runtime`),r=require(`react`),i=require(`@customafk/react-toolkit/date-fns`);const a={weekdays:[`Chủ Nhật`,`Thứ Hai`,`Thứ Ba`,`Thứ Tư`,`Thứ Năm`,`Thứ Sáu`,`Thứ Bảy`],weekdaysShort:[`CN`,`T2`,`T3`,`T4`,`T5`,`T6`,`T7`],months:[`Tháng 1`,`Tháng 2`,`Tháng 3`,`Tháng 4`,`Tháng 5`,`Tháng 6`,`Tháng 7`,`Tháng 8`,`Tháng 9`,`Tháng 10`,`Tháng 11`,`Tháng 12`],monthsShort:[`T1`,`T2`,`T3`,`T4`,`T5`,`T6`,`T7`,`T8`,`T9`,`T10`,`T11`,`T12`]},o={"01-01":`Tết Dương lịch`,"03-08":`Quốc tế Phụ nữ`,"04-30":`Ngày Giải phóng miền Nam`,"05-01":`Quốc tế Lao động`,"09-02":`Quốc khánh`,"10-20":`Ngày Phụ nữ Việt Nam`,"11-20":`Ngày Nhà giáo Việt Nam`},s=Object.freeze({SECOND:1e3,MINUTE:60*1e3,HOUR:3600*1e3,DAY:1440*60*1e3,WEEK:10080*60*1e3,MONTH:720*60*60*1e3,YEAR:365*24*60*60*1e3}),c=Object.freeze({MINUTE:60,HOUR:3600,DAY:1440*60,WEEK:10080*60,MONTH:720*60*60,YEAR:365*24*60*60}),l=Object.freeze({HOUR:60,DAY:1440,WEEK:10080,MONTH:720*60}),u=({date:e,format:s=`medium`,showHoliday:l=!1,showTime:u=!1,className:d=``,title:f})=>{let p=(0,r.useMemo)(()=>{try{if(e instanceof Date)return(0,i.isValid)(e)?e:null;if(typeof e==`string`){let t=(0,i.parseISO)(e);return(0,i.isValid)(t)?t:new Date(e)}if(typeof e==`number`){let t=new Date(e);return(0,i.isValid)(t)?t:null}return null}catch{return null}},[e]),m=(0,r.useCallback)(e=>{let t=new Date,n=Math.floor((t.getTime()-e.getTime())/1e3);return n<60?`Vừa xong`:n<3600?`${Math.floor(n/c.MINUTE)} phút trước`:n<86400?`${Math.floor(n/c.HOUR)} giờ trước`:n<604800?`${Math.floor(n/c.DAY)} ngày trước`:n<2592e3?`${Math.floor(n/c.WEEK)} tuần trước`:n<31536e3?`${Math.floor(n/c.MONTH)} tháng trước`:`${Math.floor(n/c.YEAR)} năm trước`},[]),h=(0,r.useCallback)((e,t=!1)=>{let n=e.getDay();return t?a.weekdaysShort[n]:a.weekdays[n]},[]),g=(0,r.useCallback)((e,t=!1)=>{let n=e.getMonth();return t?a.monthsShort[n]:a.months[n]},[]),_=(0,r.useCallback)(e=>o[(0,i.format)(e,`MM-dd`)]||null,[]),v=(0,r.useCallback)(e=>{if((0,i.isToday)(e))return u?`Hôm nay ${(0,i.format)(e,`HH:mm`)}`:`Hôm nay`;if((0,i.isYesterday)(e))return u?`Hôm qua ${(0,i.format)(e,`HH:mm`)}`:`Hôm qua`;if((0,i.isTomorrow)(e))return u?`Ngày mai ${(0,i.format)(e,`HH:mm`)}`:`Ngày mai`;if((0,i.isThisWeek)(e)){let t=h(e);return u?`${t} ${(0,i.format)(e,`HH:mm`)}`:t}if((0,i.isThisMonth)(e)){let t=(0,i.format)(e,`d`);return u?`${t}/${(0,i.format)(e,`M`)} ${(0,i.format)(e,`HH:mm`)}`:`${t}/${(0,i.format)(e,`M`)}`}return(0,i.isThisYear)(e)?u?(0,i.format)(e,`d/M HH:mm`):(0,i.format)(e,`d/M`):u?(0,i.format)(e,`d/M/yyyy HH:mm`):(0,i.format)(e,`d/M/yyyy`)},[h,u]),y=(0,r.useCallback)((e,t)=>{let n=u?(0,i.format)(e,`, HH:mm`):``;switch(t){case`short`:return(0,i.format)(e,`d/M/yy`)+n;case`medium`:return(0,i.format)(e,`dd/MM/yyyy`)+n;case`long`:return`${(0,i.format)(e,`d`)} ${g(e)} ${(0,i.format)(e,`yyyy`)}`+n;case`full`:return`${h(e)}, ngày ${(0,i.format)(e,`d`)} ${g(e)} năm ${(0,i.format)(e,`yyyy`)}`+n;case`relative`:return m(e);case`datetime`:return(0,i.format)(e,`d/M/yyyy HH:mm`);case`time`:return(0,i.format)(e,`HH:mm`);case`smart`:return v(e);default:return(0,i.format)(e,`d/M/yyyy`)+n}},[v,g,h,m,u]);if(!p)return(0,n.jsx)(`span`,{className:(0,t.cn)(`text-muted-foreground text-sm`,d),children:`--/--/----`});let b=y(p,s),x=l?_(p):null,S=x?`${b} (${x})`:b,C=f||(0,i.format)(p,`EEEE, d MMMM yyyy HH:mm:ss`);return(0,n.jsx)(`time`,{dateTime:p.toISOString(),className:(0,t.cn)(`font-number text-accent-foreground text-sm tabular-nums`,d),title:C,children:S})};Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return u}});
2
- //# sourceMappingURL=date-DU8xM0hQ.cjs.map
1
+ const e=require(`./chunk-Bmb41Sf3.cjs`);let t=require(`@customafk/react-toolkit/utils`),n=require(`react/jsx-runtime`),r=require(`react`),i=require(`@customafk/react-toolkit/date-fns`);const a={weekdays:[`Chủ Nhật`,`Thứ Hai`,`Thứ Ba`,`Thứ Tư`,`Thứ Năm`,`Thứ Sáu`,`Thứ Bảy`],weekdaysShort:[`CN`,`T2`,`T3`,`T4`,`T5`,`T6`,`T7`],months:[`Tháng 1`,`Tháng 2`,`Tháng 3`,`Tháng 4`,`Tháng 5`,`Tháng 6`,`Tháng 7`,`Tháng 8`,`Tháng 9`,`Tháng 10`,`Tháng 11`,`Tháng 12`],monthsShort:[`T1`,`T2`,`T3`,`T4`,`T5`,`T6`,`T7`,`T8`,`T9`,`T10`,`T11`,`T12`]},o={"01-01":`Tết Dương lịch`,"03-08":`Quốc tế Phụ nữ`,"04-30":`Ngày Giải phóng miền Nam`,"05-01":`Quốc tế Lao động`,"09-02":`Quốc khánh`,"10-20":`Ngày Phụ nữ Việt Nam`,"11-20":`Ngày Nhà giáo Việt Nam`},s=Object.freeze({SECOND:1e3,MINUTE:60*1e3,HOUR:3600*1e3,DAY:1440*60*1e3,WEEK:10080*60*1e3,MONTH:720*60*60*1e3,YEAR:365*24*60*60*1e3}),c=Object.freeze({MINUTE:60,HOUR:3600,DAY:1440*60,WEEK:10080*60,MONTH:720*60*60,YEAR:365*24*60*60}),l=Object.freeze({HOUR:60,DAY:1440,WEEK:10080,MONTH:720*60}),u=({date:e,format:s=`medium`,showHoliday:l=!1,showTime:u=!1,className:d=``,title:f})=>{let p=(0,r.useMemo)(()=>{try{if(e instanceof Date)return(0,i.isValid)(e)?e:null;if(typeof e==`string`){let t=(0,i.parseISO)(e);return(0,i.isValid)(t)?t:new Date(e)}if(typeof e==`number`){let t=new Date(e);return(0,i.isValid)(t)?t:null}return null}catch{return null}},[e]),m=(0,r.useCallback)(e=>{let t=new Date,n=Math.floor((t.getTime()-e.getTime())/1e3);return n<60?`Vừa xong`:n<3600?`${Math.floor(n/c.MINUTE)} phút trước`:n<86400?`${Math.floor(n/c.HOUR)} giờ trước`:n<604800?`${Math.floor(n/c.DAY)} ngày trước`:n<2592e3?`${Math.floor(n/c.WEEK)} tuần trước`:n<31536e3?`${Math.floor(n/c.MONTH)} tháng trước`:`${Math.floor(n/c.YEAR)} năm trước`},[]),h=(0,r.useCallback)((e,t=!1)=>{let n=e.getDay();return t?a.weekdaysShort[n]:a.weekdays[n]},[]),g=(0,r.useCallback)((e,t=!1)=>{let n=e.getMonth();return t?a.monthsShort[n]:a.months[n]},[]),_=(0,r.useCallback)(e=>o[(0,i.format)(e,`MM-dd`)]||null,[]),v=(0,r.useCallback)(e=>{if((0,i.isToday)(e))return u?`Hôm nay ${(0,i.format)(e,`HH:mm`)}`:`Hôm nay`;if((0,i.isYesterday)(e))return u?`Hôm qua ${(0,i.format)(e,`HH:mm`)}`:`Hôm qua`;if((0,i.isTomorrow)(e))return u?`Ngày mai ${(0,i.format)(e,`HH:mm`)}`:`Ngày mai`;if((0,i.isThisWeek)(e)){let t=h(e);return u?`${t} ${(0,i.format)(e,`HH:mm`)}`:t}if((0,i.isThisMonth)(e)){let t=(0,i.format)(e,`d`);return u?`${t}/${(0,i.format)(e,`M`)} ${(0,i.format)(e,`HH:mm`)}`:`${t}/${(0,i.format)(e,`M`)}`}return(0,i.isThisYear)(e)?u?(0,i.format)(e,`d/M HH:mm`):(0,i.format)(e,`d/M`):u?(0,i.format)(e,`d/M/yyyy HH:mm`):(0,i.format)(e,`d/M/yyyy`)},[h,u]),y=(0,r.useCallback)((e,t)=>{let n=u?(0,i.format)(e,`, HH:mm`):``;switch(t){case`short`:return(0,i.format)(e,`d/M/yy`)+n;case`medium`:return(0,i.format)(e,`dd/MM/yyyy`)+n;case`long`:return`${(0,i.format)(e,`d`)} ${g(e)} ${(0,i.format)(e,`yyyy`)}`+n;case`full`:return`${h(e)}, ngày ${(0,i.format)(e,`d`)} ${g(e)} năm ${(0,i.format)(e,`yyyy`)}`+n;case`relative`:return m(e);case`datetime`:return(0,i.format)(e,`d/M/yyyy HH:mm`);case`time`:return(0,i.format)(e,`HH:mm`);case`smart`:return v(e);default:return(0,i.format)(e,`d/M/yyyy`)+n}},[v,g,h,m,u]);if(!p)return(0,n.jsx)(`span`,{className:(0,t.cn)(`text-muted-foreground text-sm`,d),children:`--/--/----`});let b=y(p,s),x=l?_(p):null,S=x?`${b} (${x})`:b,C=f||(0,i.format)(p,`EEEE, d MMMM yyyy HH:mm:ss`);return(0,n.jsx)(`time`,{dateTime:p.toISOString(),className:(0,t.cn)(`text-text-positive-weak text-xs tabular-nums`,d),title:C,children:S})};Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return u}});
2
+ //# sourceMappingURL=date-DsocyDCo.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"date-DU8xM0hQ.cjs","names":["DateDisplay: React.FC<Props>","date"],"sources":["../packages/constants.tsx","../packages/components/data-display/date.tsx"],"sourcesContent":["// Vietnamese locale configuration\nexport const vietnameseLocale = {\n weekdays: ['Chủ Nhật', 'Thứ Hai', 'Thứ Ba', 'Thứ Tư', 'Thứ Năm', 'Thứ Sáu', 'Thứ Bảy'],\n weekdaysShort: ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'],\n months: ['Tháng 1', 'Tháng 2', 'Tháng 3', 'Tháng 4', 'Tháng 5', 'Tháng 6', 'Tháng 7', 'Tháng 8', 'Tháng 9', 'Tháng 10', 'Tháng 11', 'Tháng 12'],\n monthsShort: ['T1', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7', 'T8', 'T9', 'T10', 'T11', 'T12'],\n};\n\n// Vietnamese holidays\nexport const vietnameseHolidays = {\n '01-01': 'Tết Dương lịch',\n '03-08': 'Quốc tế Phụ nữ',\n '04-30': 'Ngày Giải phóng miền Nam',\n '05-01': 'Quốc tế Lao động',\n '09-02': 'Quốc khánh',\n '10-20': 'Ngày Phụ nữ Việt Nam',\n '11-20': 'Ngày Nhà giáo Việt Nam',\n};\n\n// Time Constants in milliseconds, seconds, and minutes\nexport const TIME_IN_MS = Object.freeze({\n SECOND: 1000,\n MINUTE: 60 * 1000,\n HOUR: 60 * 60 * 1000,\n DAY: 24 * 60 * 60 * 1000,\n WEEK: 7 * 24 * 60 * 60 * 1000,\n MONTH: 30 * 24 * 60 * 60 * 1000, // Approximation for month length = 30 days\n YEAR: 365 * 24 * 60 * 60 * 1000,\n});\n\nexport const TIME_IN_SECONDS = Object.freeze({\n MINUTE: 60,\n HOUR: 60 * 60,\n DAY: 24 * 60 * 60,\n WEEK: 7 * 24 * 60 * 60,\n MONTH: 30 * 24 * 60 * 60,\n YEAR: 365 * 24 * 60 * 60,\n});\n\nexport const TIME_IN_MINUTES = Object.freeze({\n HOUR: 60,\n DAY: 24 * 60,\n WEEK: 7 * 24 * 60,\n MONTH: 30 * 24 * 60,\n});\n","import { useCallback, useMemo } from 'react';\n\nimport { format, isThisMonth, isThisWeek, isThisYear, isToday, isTomorrow, isValid, isYesterday, parseISO } from '@customafk/react-toolkit/date-fns';\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { TIME_IN_SECONDS, vietnameseHolidays, vietnameseLocale } from '@/constants';\n\ninterface Props {\n date: Date | string | number;\n format?:\n | 'short' // 15/03/24\n | 'medium' // 15/03/2024\n | 'long' // 15 tháng 3, 2024\n | 'full' // Thứ Sáu, ngày 15 tháng 3 năm 2024\n | 'relative' // 2 giờ trước\n | 'datetime' // 15/03/2024 14:30\n | 'time' // 14:30\n | 'smart'; // Tự động chọn format phù hợp\n showHoliday?: boolean;\n showTime?: boolean;\n className?: string;\n title?: string; // Tooltip khi hover\n}\n\nexport const DateDisplay: React.FC<Props> = ({ date, format: formatType = 'medium', showHoliday = false, showTime = false, className = '', title }) => {\n const parsedDate = useMemo(() => {\n try {\n if (date instanceof Date) {\n return isValid(date) ? date : null;\n }\n if (typeof date === 'string') {\n const parsed = parseISO(date);\n return isValid(parsed) ? parsed : new Date(date);\n }\n if (typeof date === 'number') {\n const parsed = new Date(date);\n return isValid(parsed) ? parsed : null;\n }\n return null;\n } catch {\n return null;\n }\n }, [date]);\n\n // Format relative time in Vietnamese\n const formatRelativeTime = useCallback((date: Date): string => {\n const now = new Date();\n const diffInSeconds = Math.floor((now.getTime() - date.getTime()) / 1000);\n\n if (diffInSeconds < 60) return 'Vừa xong';\n if (diffInSeconds < 3600) return `${Math.floor(diffInSeconds / TIME_IN_SECONDS.MINUTE)} phút trước`;\n if (diffInSeconds < 86400) return `${Math.floor(diffInSeconds / TIME_IN_SECONDS.HOUR)} giờ trước`;\n if (diffInSeconds < 604800) return `${Math.floor(diffInSeconds / TIME_IN_SECONDS.DAY)} ngày trước`;\n if (diffInSeconds < 2592000) return `${Math.floor(diffInSeconds / TIME_IN_SECONDS.WEEK)} tuần trước`;\n if (diffInSeconds < 31536000) return `${Math.floor(diffInSeconds / TIME_IN_SECONDS.MONTH)} tháng trước`;\n return `${Math.floor(diffInSeconds / TIME_IN_SECONDS.YEAR)} năm trước`;\n }, []);\n\n // Vietnamese weekday\n const getVietnameseWeekday = useCallback((date: Date, short: boolean = false): string => {\n const dayIndex = date.getDay();\n return short ? vietnameseLocale.weekdaysShort[dayIndex] : vietnameseLocale.weekdays[dayIndex];\n }, []);\n\n // Vietnamese month\n const getVietnameseMonth = useCallback((date: Date, short: boolean = false): string => {\n const monthIndex = date.getMonth();\n return short ? vietnameseLocale.monthsShort[monthIndex] : vietnameseLocale.months[monthIndex];\n }, []);\n\n // Check holiday\n const getHoliday = useCallback((date: Date): string | null => {\n const monthDay = format(date, 'MM-dd') as keyof typeof vietnameseHolidays;\n return vietnameseHolidays[monthDay] || null;\n }, []);\n\n // Smart format - choose appropriate format based on date\n const getSmartFormat = useCallback(\n (date: Date): string => {\n if (isToday(date)) {\n return showTime ? `Hôm nay ${format(date, 'HH:mm')}` : 'Hôm nay';\n }\n if (isYesterday(date)) {\n return showTime ? `Hôm qua ${format(date, 'HH:mm')}` : 'Hôm qua';\n }\n if (isTomorrow(date)) {\n return showTime ? `Ngày mai ${format(date, 'HH:mm')}` : 'Ngày mai';\n }\n if (isThisWeek(date)) {\n const weekday = getVietnameseWeekday(date);\n return showTime ? `${weekday} ${format(date, 'HH:mm')}` : weekday;\n }\n if (isThisMonth(date)) {\n const day = format(date, 'd');\n return showTime ? `${day}/${format(date, 'M')} ${format(date, 'HH:mm')}` : `${day}/${format(date, 'M')}`;\n }\n if (isThisYear(date)) {\n return showTime ? format(date, 'd/M HH:mm') : format(date, 'd/M');\n }\n return showTime ? format(date, 'd/M/yyyy HH:mm') : format(date, 'd/M/yyyy');\n },\n [getVietnameseWeekday, showTime]\n );\n\n // Main formatting function\n const formatDate = useCallback(\n (date: Date, type: string): string => {\n const timeStr = showTime ? format(date, ', HH:mm') : '';\n\n switch (type) {\n case 'short':\n return format(date, 'd/M/yy') + timeStr;\n\n case 'medium':\n return format(date, 'dd/MM/yyyy') + timeStr;\n\n case 'long':\n return `${format(date, 'd')} ${getVietnameseMonth(date)} ${format(date, 'yyyy')}` + timeStr;\n\n case 'full': {\n const data = `${getVietnameseWeekday(date)}, ngày ${format(date, 'd')} ${getVietnameseMonth(date)} năm ${format(date, 'yyyy')}`;\n return data + timeStr;\n }\n\n case 'relative':\n return formatRelativeTime(date);\n\n case 'datetime':\n return format(date, 'd/M/yyyy HH:mm');\n\n case 'time':\n return format(date, 'HH:mm');\n\n case 'smart':\n return getSmartFormat(date);\n\n default:\n return format(date, 'd/M/yyyy') + timeStr;\n }\n },\n [getSmartFormat, getVietnameseMonth, getVietnameseWeekday, formatRelativeTime, showTime]\n );\n\n if (!parsedDate) {\n return <span className={cn('text-muted-foreground text-sm', className)}>--/--/----</span>;\n }\n\n const formattedDate = formatDate(parsedDate, formatType);\n const holiday = showHoliday ? getHoliday(parsedDate) : null;\n const displayText = holiday ? `${formattedDate} (${holiday})` : formattedDate;\n const tooltipTitle = title || format(parsedDate, 'EEEE, d MMMM yyyy HH:mm:ss');\n\n return (\n <time dateTime={parsedDate.toISOString()} className={cn('font-number text-accent-foreground text-sm tabular-nums', className)} title={tooltipTitle}>\n {displayText}\n </time>\n );\n};\n"],"mappings":"yLACA,MAAa,EAAmB,CAC9B,SAAU,CAAC,WAAY,UAAW,SAAU,SAAU,UAAW,UAAW,UAAU,CACtF,cAAe,CAAC,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,KAAK,CACzD,OAAQ,CAAC,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,WAAY,WAAY,WAAW,CAC/I,YAAa,CAAC,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,MAAO,MAAO,MAAM,CACzF,CAGY,EAAqB,CAChC,QAAS,iBACT,QAAS,iBACT,QAAS,2BACT,QAAS,mBACT,QAAS,aACT,QAAS,uBACT,QAAS,yBACV,CAGY,EAAa,OAAO,OAAO,CACtC,OAAQ,IACR,OAAQ,GAAK,IACb,KAAM,KAAU,IAChB,IAAK,KAAU,GAAK,IACpB,KAAM,MAAc,GAAK,IACzB,MAAO,IAAU,GAAK,GAAK,IAC3B,KAAM,IAAM,GAAK,GAAK,GAAK,IAC5B,CAAC,CAEW,EAAkB,OAAO,OAAO,CAC3C,OAAQ,GACR,KAAM,KACN,IAAK,KAAU,GACf,KAAM,MAAc,GACpB,MAAO,IAAU,GAAK,GACtB,KAAM,IAAM,GAAK,GAAK,GACvB,CAAC,CAEW,EAAkB,OAAO,OAAO,CAC3C,KAAM,GACN,IAAK,KACL,KAAM,MACN,MAAO,IAAU,GAClB,CAAC,CCpBWA,GAAgC,CAAE,OAAM,OAAQ,EAAa,SAAU,cAAc,GAAO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DsocyDCo.cjs","names":["DateDisplay: React.FC<Props>","date"],"sources":["../packages/constants.tsx","../packages/components/data-display/date.tsx"],"sourcesContent":["// Vietnamese locale configuration\nexport const vietnameseLocale = {\n weekdays: ['Chủ Nhật', 'Thứ Hai', 'Thứ Ba', 'Thứ Tư', 'Thứ Năm', 'Thứ Sáu', 'Thứ Bảy'],\n weekdaysShort: ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'],\n months: ['Tháng 1', 'Tháng 2', 'Tháng 3', 'Tháng 4', 'Tháng 5', 'Tháng 6', 'Tháng 7', 'Tháng 8', 'Tháng 9', 'Tháng 10', 'Tháng 11', 'Tháng 12'],\n monthsShort: ['T1', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7', 'T8', 'T9', 'T10', 'T11', 'T12'],\n};\n\n// Vietnamese holidays\nexport const vietnameseHolidays = {\n '01-01': 'Tết Dương lịch',\n '03-08': 'Quốc tế Phụ nữ',\n '04-30': 'Ngày Giải phóng miền Nam',\n '05-01': 'Quốc tế Lao động',\n '09-02': 'Quốc khánh',\n '10-20': 'Ngày Phụ nữ Việt Nam',\n '11-20': 'Ngày Nhà giáo Việt Nam',\n};\n\n// Time Constants in milliseconds, seconds, and minutes\nexport const TIME_IN_MS = Object.freeze({\n SECOND: 1000,\n MINUTE: 60 * 1000,\n HOUR: 60 * 60 * 1000,\n DAY: 24 * 60 * 60 * 1000,\n WEEK: 7 * 24 * 60 * 60 * 1000,\n MONTH: 30 * 24 * 60 * 60 * 1000, // Approximation for month length = 30 days\n YEAR: 365 * 24 * 60 * 60 * 1000,\n});\n\nexport const TIME_IN_SECONDS = Object.freeze({\n MINUTE: 60,\n HOUR: 60 * 60,\n DAY: 24 * 60 * 60,\n WEEK: 7 * 24 * 60 * 60,\n MONTH: 30 * 24 * 60 * 60,\n YEAR: 365 * 24 * 60 * 60,\n});\n\nexport const TIME_IN_MINUTES = Object.freeze({\n HOUR: 60,\n DAY: 24 * 60,\n WEEK: 7 * 24 * 60,\n MONTH: 30 * 24 * 60,\n});\n","import { useCallback, useMemo } from 'react';\n\nimport { format, isThisMonth, isThisWeek, isThisYear, isToday, isTomorrow, isValid, isYesterday, parseISO } from '@customafk/react-toolkit/date-fns';\nimport { cn } from '@customafk/react-toolkit/utils';\n\nimport { TIME_IN_SECONDS, vietnameseHolidays, vietnameseLocale } from '@/constants';\n\ninterface Props {\n date: Date | string | number;\n format?:\n | 'short' // 15/03/24\n | 'medium' // 15/03/2024\n | 'long' // 15 tháng 3, 2024\n | 'full' // Thứ Sáu, ngày 15 tháng 3 năm 2024\n | 'relative' // 2 giờ trước\n | 'datetime' // 15/03/2024 14:30\n | 'time' // 14:30\n | 'smart'; // Tự động chọn format phù hợp\n showHoliday?: boolean;\n showTime?: boolean;\n className?: string;\n title?: string; // Tooltip khi hover\n}\n\nexport const DateDisplay: React.FC<Props> = ({ date, format: formatType = 'medium', showHoliday = false, showTime = false, className = '', title }) => {\n const parsedDate = useMemo(() => {\n try {\n if (date instanceof Date) {\n return isValid(date) ? date : null;\n }\n if (typeof date === 'string') {\n const parsed = parseISO(date);\n return isValid(parsed) ? parsed : new Date(date);\n }\n if (typeof date === 'number') {\n const parsed = new Date(date);\n return isValid(parsed) ? parsed : null;\n }\n return null;\n } catch {\n return null;\n }\n }, [date]);\n\n // Format relative time in Vietnamese\n const formatRelativeTime = useCallback((date: Date): string => {\n const now = new Date();\n const diffInSeconds = Math.floor((now.getTime() - date.getTime()) / 1000);\n\n if (diffInSeconds < 60) return 'Vừa xong';\n if (diffInSeconds < 3600) return `${Math.floor(diffInSeconds / TIME_IN_SECONDS.MINUTE)} phút trước`;\n if (diffInSeconds < 86400) return `${Math.floor(diffInSeconds / TIME_IN_SECONDS.HOUR)} giờ trước`;\n if (diffInSeconds < 604800) return `${Math.floor(diffInSeconds / TIME_IN_SECONDS.DAY)} ngày trước`;\n if (diffInSeconds < 2592000) return `${Math.floor(diffInSeconds / TIME_IN_SECONDS.WEEK)} tuần trước`;\n if (diffInSeconds < 31536000) return `${Math.floor(diffInSeconds / TIME_IN_SECONDS.MONTH)} tháng trước`;\n return `${Math.floor(diffInSeconds / TIME_IN_SECONDS.YEAR)} năm trước`;\n }, []);\n\n // Vietnamese weekday\n const getVietnameseWeekday = useCallback((date: Date, short: boolean = false): string => {\n const dayIndex = date.getDay();\n return short ? vietnameseLocale.weekdaysShort[dayIndex] : vietnameseLocale.weekdays[dayIndex];\n }, []);\n\n // Vietnamese month\n const getVietnameseMonth = useCallback((date: Date, short: boolean = false): string => {\n const monthIndex = date.getMonth();\n return short ? vietnameseLocale.monthsShort[monthIndex] : vietnameseLocale.months[monthIndex];\n }, []);\n\n // Check holiday\n const getHoliday = useCallback((date: Date): string | null => {\n const monthDay = format(date, 'MM-dd') as keyof typeof vietnameseHolidays;\n return vietnameseHolidays[monthDay] || null;\n }, []);\n\n // Smart format - choose appropriate format based on date\n const getSmartFormat = useCallback(\n (date: Date): string => {\n if (isToday(date)) {\n return showTime ? `Hôm nay ${format(date, 'HH:mm')}` : 'Hôm nay';\n }\n if (isYesterday(date)) {\n return showTime ? `Hôm qua ${format(date, 'HH:mm')}` : 'Hôm qua';\n }\n if (isTomorrow(date)) {\n return showTime ? `Ngày mai ${format(date, 'HH:mm')}` : 'Ngày mai';\n }\n if (isThisWeek(date)) {\n const weekday = getVietnameseWeekday(date);\n return showTime ? `${weekday} ${format(date, 'HH:mm')}` : weekday;\n }\n if (isThisMonth(date)) {\n const day = format(date, 'd');\n return showTime ? `${day}/${format(date, 'M')} ${format(date, 'HH:mm')}` : `${day}/${format(date, 'M')}`;\n }\n if (isThisYear(date)) {\n return showTime ? format(date, 'd/M HH:mm') : format(date, 'd/M');\n }\n return showTime ? format(date, 'd/M/yyyy HH:mm') : format(date, 'd/M/yyyy');\n },\n [getVietnameseWeekday, showTime]\n );\n\n // Main formatting function\n const formatDate = useCallback(\n (date: Date, type: string): string => {\n const timeStr = showTime ? format(date, ', HH:mm') : '';\n\n switch (type) {\n case 'short':\n return format(date, 'd/M/yy') + timeStr;\n\n case 'medium':\n return format(date, 'dd/MM/yyyy') + timeStr;\n\n case 'long':\n return `${format(date, 'd')} ${getVietnameseMonth(date)} ${format(date, 'yyyy')}` + timeStr;\n\n case 'full': {\n const data = `${getVietnameseWeekday(date)}, ngày ${format(date, 'd')} ${getVietnameseMonth(date)} năm ${format(date, 'yyyy')}`;\n return data + timeStr;\n }\n\n case 'relative':\n return formatRelativeTime(date);\n\n case 'datetime':\n return format(date, 'd/M/yyyy HH:mm');\n\n case 'time':\n return format(date, 'HH:mm');\n\n case 'smart':\n return getSmartFormat(date);\n\n default:\n return format(date, 'd/M/yyyy') + timeStr;\n }\n },\n [getSmartFormat, getVietnameseMonth, getVietnameseWeekday, formatRelativeTime, showTime]\n );\n\n if (!parsedDate) {\n return <span className={cn('text-muted-foreground text-sm', className)}>--/--/----</span>;\n }\n\n const formattedDate = formatDate(parsedDate, formatType);\n const holiday = showHoliday ? getHoliday(parsedDate) : null;\n const displayText = holiday ? `${formattedDate} (${holiday})` : formattedDate;\n const tooltipTitle = title || format(parsedDate, 'EEEE, d MMMM yyyy HH:mm:ss');\n\n return (\n <time dateTime={parsedDate.toISOString()} className={cn('text-text-positive-weak text-xs tabular-nums', className)} title={tooltipTitle}>\n {displayText}\n </time>\n );\n};\n"],"mappings":"yLACA,MAAa,EAAmB,CAC9B,SAAU,CAAC,WAAY,UAAW,SAAU,SAAU,UAAW,UAAW,UAAU,CACtF,cAAe,CAAC,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,KAAK,CACzD,OAAQ,CAAC,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,UAAW,WAAY,WAAY,WAAW,CAC/I,YAAa,CAAC,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,MAAO,MAAO,MAAM,CACzF,CAGY,EAAqB,CAChC,QAAS,iBACT,QAAS,iBACT,QAAS,2BACT,QAAS,mBACT,QAAS,aACT,QAAS,uBACT,QAAS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AM,WAAW,CAAG,IAGxC,CAAC,EAAgB,EAAoB,EAAsB,EAAoB,EAAS,CACzF,CAED,GAAI,CAAC,EACH,OAAO,EAAA,EAAA,KAAC,OAAA,CAAK,WAAA,EAAA,EAAA,IAAc,gCAAiC,EAAU,UAAE,cAAiB,CAG3F,IAAM,EAAgB,EAAW,EAAY,EAAW,CAClD,EAAU,EAAc,EAAW,EAAW,CAAG,KACjD,EAAc,EAAU,GAAG,EAAc,IAAI,EAAQ,GAAK,EAC1D,EAAe,IAAA,EAAA,EAAA,QAAgB,EAAY,6BAA6B,CAE9E,OACE,EAAA,EAAA,KAAC,OAAA,CAAK,SAAU,EAAW,aAAa,CAAE,WAAA,EAAA,EAAA,IAAc,+CAAgD,EAAU,CAAE,MAAO,WACxH,GACI"}
@@ -1,23 +1,23 @@
1
- import * as react_jsx_runtime23 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime203 from "react/jsx-runtime";
2
2
  import { Dialog } from "radix-ui";
3
3
 
4
4
  //#region packages/components/ui/dialog.d.ts
5
5
  declare function Dialog$1({
6
6
  ...props
7
- }: React.ComponentProps<typeof Dialog.Root>): react_jsx_runtime23.JSX.Element;
7
+ }: React.ComponentProps<typeof Dialog.Root>): react_jsx_runtime203.JSX.Element;
8
8
  declare function DialogTrigger({
9
9
  ...props
10
- }: React.ComponentProps<typeof Dialog.Trigger>): react_jsx_runtime23.JSX.Element;
10
+ }: React.ComponentProps<typeof Dialog.Trigger>): react_jsx_runtime203.JSX.Element;
11
11
  declare function DialogPortal({
12
12
  ...props
13
- }: React.ComponentProps<typeof Dialog.Portal>): react_jsx_runtime23.JSX.Element;
13
+ }: React.ComponentProps<typeof Dialog.Portal>): react_jsx_runtime203.JSX.Element;
14
14
  declare function DialogClose({
15
15
  ...props
16
- }: React.ComponentProps<typeof Dialog.Close>): react_jsx_runtime23.JSX.Element;
16
+ }: React.ComponentProps<typeof Dialog.Close>): react_jsx_runtime203.JSX.Element;
17
17
  declare function DialogOverlay({
18
18
  className,
19
19
  ...props
20
- }: React.ComponentProps<typeof Dialog.Overlay>): react_jsx_runtime23.JSX.Element;
20
+ }: React.ComponentProps<typeof Dialog.Overlay>): react_jsx_runtime203.JSX.Element;
21
21
  declare function DialogContent({
22
22
  className,
23
23
  children,
@@ -25,23 +25,23 @@ declare function DialogContent({
25
25
  ...props
26
26
  }: React.ComponentProps<typeof Dialog.Content> & {
27
27
  showCloseButton?: boolean;
28
- }): react_jsx_runtime23.JSX.Element;
28
+ }): react_jsx_runtime203.JSX.Element;
29
29
  declare function DialogHeader({
30
30
  className,
31
31
  ...props
32
- }: React.ComponentProps<'div'>): react_jsx_runtime23.JSX.Element;
32
+ }: React.ComponentProps<'div'>): react_jsx_runtime203.JSX.Element;
33
33
  declare function DialogFooter({
34
34
  className,
35
35
  ...props
36
- }: React.ComponentProps<'div'>): react_jsx_runtime23.JSX.Element;
36
+ }: React.ComponentProps<'div'>): react_jsx_runtime203.JSX.Element;
37
37
  declare function DialogTitle({
38
38
  className,
39
39
  ...props
40
- }: React.ComponentProps<typeof Dialog.Title>): react_jsx_runtime23.JSX.Element;
40
+ }: React.ComponentProps<typeof Dialog.Title>): react_jsx_runtime203.JSX.Element;
41
41
  declare function DialogDescription({
42
42
  className,
43
43
  ...props
44
- }: React.ComponentProps<typeof Dialog.Description>): react_jsx_runtime23.JSX.Element;
44
+ }: React.ComponentProps<typeof Dialog.Description>): react_jsx_runtime203.JSX.Element;
45
45
  //#endregion
46
46
  export { DialogFooter as a, DialogPortal as c, DialogDescription as i, DialogTitle as l, DialogClose as n, DialogHeader as o, DialogContent as r, DialogOverlay as s, Dialog$1 as t, DialogTrigger as u };
47
- //# sourceMappingURL=dialog-eWIoqTyJ.d.mts.map
47
+ //# sourceMappingURL=dialog-BSlqE4oW.d.cts.map
@@ -1,23 +1,23 @@
1
- import * as react_jsx_runtime56 from "react/jsx-runtime";
1
+ import * as react_jsx_runtime256 from "react/jsx-runtime";
2
2
  import { Dialog } from "radix-ui";
3
3
 
4
4
  //#region packages/components/ui/dialog.d.ts
5
5
  declare function Dialog$1({
6
6
  ...props
7
- }: React.ComponentProps<typeof Dialog.Root>): react_jsx_runtime56.JSX.Element;
7
+ }: React.ComponentProps<typeof Dialog.Root>): react_jsx_runtime256.JSX.Element;
8
8
  declare function DialogTrigger({
9
9
  ...props
10
- }: React.ComponentProps<typeof Dialog.Trigger>): react_jsx_runtime56.JSX.Element;
10
+ }: React.ComponentProps<typeof Dialog.Trigger>): react_jsx_runtime256.JSX.Element;
11
11
  declare function DialogPortal({
12
12
  ...props
13
- }: React.ComponentProps<typeof Dialog.Portal>): react_jsx_runtime56.JSX.Element;
13
+ }: React.ComponentProps<typeof Dialog.Portal>): react_jsx_runtime256.JSX.Element;
14
14
  declare function DialogClose({
15
15
  ...props
16
- }: React.ComponentProps<typeof Dialog.Close>): react_jsx_runtime56.JSX.Element;
16
+ }: React.ComponentProps<typeof Dialog.Close>): react_jsx_runtime256.JSX.Element;
17
17
  declare function DialogOverlay({
18
18
  className,
19
19
  ...props
20
- }: React.ComponentProps<typeof Dialog.Overlay>): react_jsx_runtime56.JSX.Element;
20
+ }: React.ComponentProps<typeof Dialog.Overlay>): react_jsx_runtime256.JSX.Element;
21
21
  declare function DialogContent({
22
22
  className,
23
23
  children,
@@ -25,23 +25,23 @@ declare function DialogContent({
25
25
  ...props
26
26
  }: React.ComponentProps<typeof Dialog.Content> & {
27
27
  showCloseButton?: boolean;
28
- }): react_jsx_runtime56.JSX.Element;
28
+ }): react_jsx_runtime256.JSX.Element;
29
29
  declare function DialogHeader({
30
30
  className,
31
31
  ...props
32
- }: React.ComponentProps<'div'>): react_jsx_runtime56.JSX.Element;
32
+ }: React.ComponentProps<'div'>): react_jsx_runtime256.JSX.Element;
33
33
  declare function DialogFooter({
34
34
  className,
35
35
  ...props
36
- }: React.ComponentProps<'div'>): react_jsx_runtime56.JSX.Element;
36
+ }: React.ComponentProps<'div'>): react_jsx_runtime256.JSX.Element;
37
37
  declare function DialogTitle({
38
38
  className,
39
39
  ...props
40
- }: React.ComponentProps<typeof Dialog.Title>): react_jsx_runtime56.JSX.Element;
40
+ }: React.ComponentProps<typeof Dialog.Title>): react_jsx_runtime256.JSX.Element;
41
41
  declare function DialogDescription({
42
42
  className,
43
43
  ...props
44
- }: React.ComponentProps<typeof Dialog.Description>): react_jsx_runtime56.JSX.Element;
44
+ }: React.ComponentProps<typeof Dialog.Description>): react_jsx_runtime256.JSX.Element;
45
45
  //#endregion
46
46
  export { DialogFooter as a, DialogPortal as c, DialogDescription as i, DialogTitle as l, DialogClose as n, DialogHeader as o, DialogContent as r, DialogOverlay as s, Dialog$1 as t, DialogTrigger as u };
47
- //# sourceMappingURL=dialog-GicGDkD7.d.cts.map
47
+ //# sourceMappingURL=dialog-CfZKsxFA.d.mts.map
@@ -1,8 +1,8 @@
1
- import { t as Button } from "../../../button-BHCJWumN.cjs";
2
- import { t as Separator } from "../../../separator-ji0MW5b4.cjs";
3
- import { n as TooltipContent } from "../../../tooltip-B5BVrx0y.cjs";
4
- import * as react_jsx_runtime2 from "react/jsx-runtime";
5
- import * as class_variance_authority_types0 from "class-variance-authority/types";
1
+ import { t as Button } from "../../../button-DCsGcClf.cjs";
2
+ import { t as Separator } from "../../../separator-BLK3kO-5.cjs";
3
+ import { n as TooltipContent } from "../../../tooltip-BZLJxq35.cjs";
4
+ import * as react_jsx_runtime237 from "react/jsx-runtime";
5
+ import * as class_variance_authority_types8 from "class-variance-authority/types";
6
6
  import { VariantProps } from "class-variance-authority";
7
7
 
8
8
  //#region packages/components/dialogs/detail-dialog/components/sidebar.d.ts
@@ -28,7 +28,7 @@ declare function SidebarProvider({
28
28
  defaultOpen?: boolean;
29
29
  open?: boolean;
30
30
  onOpenChange?: (open: boolean) => void;
31
- }): react_jsx_runtime2.JSX.Element;
31
+ }): react_jsx_runtime237.JSX.Element;
32
32
  declare function Sidebar({
33
33
  side,
34
34
  variant,
@@ -40,71 +40,71 @@ declare function Sidebar({
40
40
  side?: 'left' | 'right';
41
41
  variant?: 'sidebar' | 'floating' | 'inset';
42
42
  collapsible?: 'offcanvas' | 'icon' | 'none';
43
- }): react_jsx_runtime2.JSX.Element;
43
+ }): react_jsx_runtime237.JSX.Element;
44
44
  declare function DetailDialogSidebarTrigger({
45
45
  className,
46
46
  onClick,
47
47
  ...props
48
- }: React.ComponentProps<typeof Button>): react_jsx_runtime2.JSX.Element;
48
+ }: React.ComponentProps<typeof Button>): react_jsx_runtime237.JSX.Element;
49
49
  declare function DetailDialogSidebarRail({
50
50
  className,
51
51
  ...props
52
- }: React.ComponentProps<'button'>): react_jsx_runtime2.JSX.Element;
52
+ }: React.ComponentProps<'button'>): react_jsx_runtime237.JSX.Element;
53
53
  declare function SidebarInset({
54
54
  className,
55
55
  ...props
56
- }: React.ComponentProps<'main'>): react_jsx_runtime2.JSX.Element;
56
+ }: React.ComponentProps<'main'>): react_jsx_runtime237.JSX.Element;
57
57
  declare function DetailDialogSidebarHeader({
58
58
  className,
59
59
  ...props
60
- }: React.ComponentProps<'div'>): react_jsx_runtime2.JSX.Element;
60
+ }: React.ComponentProps<'div'>): react_jsx_runtime237.JSX.Element;
61
61
  declare function DetailDialogSidebarFooter({
62
62
  className,
63
63
  children,
64
64
  ...props
65
- }: React.ComponentProps<'div'>): react_jsx_runtime2.JSX.Element;
65
+ }: React.ComponentProps<'div'>): react_jsx_runtime237.JSX.Element;
66
66
  declare function DetailDialogSidebarSeparator({
67
67
  className,
68
68
  ...props
69
- }: React.ComponentProps<typeof Separator>): react_jsx_runtime2.JSX.Element;
69
+ }: React.ComponentProps<typeof Separator>): react_jsx_runtime237.JSX.Element;
70
70
  declare function DetailDialogSidebarContent({
71
71
  className,
72
72
  ...props
73
- }: React.ComponentProps<'div'>): react_jsx_runtime2.JSX.Element;
73
+ }: React.ComponentProps<'div'>): react_jsx_runtime237.JSX.Element;
74
74
  declare function DetailDialogSidebarGroup({
75
75
  className,
76
76
  ...props
77
- }: React.ComponentProps<'div'>): react_jsx_runtime2.JSX.Element;
77
+ }: React.ComponentProps<'div'>): react_jsx_runtime237.JSX.Element;
78
78
  declare function DetailDialogSidebarGroupLabel({
79
79
  className,
80
80
  asChild,
81
81
  ...props
82
82
  }: React.ComponentProps<'div'> & {
83
83
  asChild?: boolean;
84
- }): react_jsx_runtime2.JSX.Element;
84
+ }): react_jsx_runtime237.JSX.Element;
85
85
  declare function DetailDialogSidebarGroupAction({
86
86
  className,
87
87
  asChild,
88
88
  ...props
89
89
  }: React.ComponentProps<'button'> & {
90
90
  asChild?: boolean;
91
- }): react_jsx_runtime2.JSX.Element;
91
+ }): react_jsx_runtime237.JSX.Element;
92
92
  declare function DetailDialogSidebarGroupContent({
93
93
  className,
94
94
  ...props
95
- }: React.ComponentProps<'div'>): react_jsx_runtime2.JSX.Element;
95
+ }: React.ComponentProps<'div'>): react_jsx_runtime237.JSX.Element;
96
96
  declare function DetailDialogSidebarMenu({
97
97
  className,
98
98
  ...props
99
- }: React.ComponentProps<'ul'>): react_jsx_runtime2.JSX.Element;
99
+ }: React.ComponentProps<'ul'>): react_jsx_runtime237.JSX.Element;
100
100
  declare function DetailDialogSidebarMenuItem({
101
101
  className,
102
102
  ...props
103
- }: React.ComponentProps<'li'>): react_jsx_runtime2.JSX.Element;
103
+ }: React.ComponentProps<'li'>): react_jsx_runtime237.JSX.Element;
104
104
  declare const sidebarMenuButtonVariants: (props?: ({
105
105
  variant?: "default" | "outline" | null | undefined;
106
- size?: "default" | "sm" | "lg" | null | undefined;
107
- } & class_variance_authority_types0.ClassProp) | undefined) => string;
106
+ size?: "sm" | "lg" | "default" | null | undefined;
107
+ } & class_variance_authority_types8.ClassProp) | undefined) => string;
108
108
  declare function DetailDialogSidebarMenuButton({
109
109
  asChild,
110
110
  isActive,
@@ -117,7 +117,7 @@ declare function DetailDialogSidebarMenuButton({
117
117
  asChild?: boolean;
118
118
  isActive?: boolean;
119
119
  tooltip?: string | React.ComponentProps<typeof TooltipContent>;
120
- } & VariantProps<typeof sidebarMenuButtonVariants>): react_jsx_runtime2.JSX.Element;
120
+ } & VariantProps<typeof sidebarMenuButtonVariants>): react_jsx_runtime237.JSX.Element;
121
121
  declare function DetailDialogSidebarMenuAction({
122
122
  className,
123
123
  asChild,
@@ -126,26 +126,26 @@ declare function DetailDialogSidebarMenuAction({
126
126
  }: React.ComponentProps<'button'> & {
127
127
  asChild?: boolean;
128
128
  showOnHover?: boolean;
129
- }): react_jsx_runtime2.JSX.Element;
129
+ }): react_jsx_runtime237.JSX.Element;
130
130
  declare function DetailDialogSidebarMenuBadge({
131
131
  className,
132
132
  ...props
133
- }: React.ComponentProps<'div'>): react_jsx_runtime2.JSX.Element;
133
+ }: React.ComponentProps<'div'>): react_jsx_runtime237.JSX.Element;
134
134
  declare function DetailDialogSidebarMenuSkeleton({
135
135
  className,
136
136
  showIcon,
137
137
  ...props
138
138
  }: React.ComponentProps<'div'> & {
139
139
  showIcon?: boolean;
140
- }): react_jsx_runtime2.JSX.Element;
140
+ }): react_jsx_runtime237.JSX.Element;
141
141
  declare function DetailDialogSidebarMenuSub({
142
142
  className,
143
143
  ...props
144
- }: React.ComponentProps<'ul'>): react_jsx_runtime2.JSX.Element;
144
+ }: React.ComponentProps<'ul'>): react_jsx_runtime237.JSX.Element;
145
145
  declare function DetailDialogSidebarMenuSubItem({
146
146
  className,
147
147
  ...props
148
- }: React.ComponentProps<'li'>): react_jsx_runtime2.JSX.Element;
148
+ }: React.ComponentProps<'li'>): react_jsx_runtime237.JSX.Element;
149
149
  declare function DetailDialogSidebarMenuSubButton({
150
150
  asChild,
151
151
  size,
@@ -156,7 +156,7 @@ declare function DetailDialogSidebarMenuSubButton({
156
156
  asChild?: boolean;
157
157
  size?: 'sm' | 'md';
158
158
  isActive?: boolean;
159
- }): react_jsx_runtime2.JSX.Element;
159
+ }): react_jsx_runtime237.JSX.Element;
160
160
  //#endregion
161
161
  export { DetailDialogSidebarContent, DetailDialogSidebarFooter, DetailDialogSidebarGroup, DetailDialogSidebarGroupAction, DetailDialogSidebarGroupContent, DetailDialogSidebarGroupLabel, DetailDialogSidebarHeader, DetailDialogSidebarMenu, DetailDialogSidebarMenuAction, DetailDialogSidebarMenuBadge, DetailDialogSidebarMenuButton, DetailDialogSidebarMenuItem, DetailDialogSidebarMenuSkeleton, DetailDialogSidebarMenuSub, DetailDialogSidebarMenuSubButton, DetailDialogSidebarMenuSubItem, DetailDialogSidebarRail, DetailDialogSidebarSeparator, DetailDialogSidebarTrigger, Sidebar, SidebarInset, SidebarProvider, useSidebar };
162
162
  //# sourceMappingURL=sidebar.d.cts.map