@bzync/rui 0.0.3

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 (263) hide show
  1. package/LICENSE +15 -0
  2. package/README.md +115 -0
  3. package/dist/autocomplete-CaysJRpk.cjs +1 -0
  4. package/dist/autocomplete-CfbfpcO4.js +453 -0
  5. package/dist/calendar-Bnld4G59.cjs +1 -0
  6. package/dist/calendar-CdICOROs.js +573 -0
  7. package/dist/charts-CxEy2c3M.js +1248 -0
  8. package/dist/charts-UDqS1BH1.cjs +1 -0
  9. package/dist/cn-BdjraxxU.cjs +1 -0
  10. package/dist/cn-DpgY2leY.js +1736 -0
  11. package/dist/component-styles-Ce56hn9T.js +16 -0
  12. package/dist/component-styles-TkZ7v6Ef.cjs +1 -0
  13. package/dist/components/accordion.cjs +1 -0
  14. package/dist/components/accordion.d.ts +22 -0
  15. package/dist/components/accordion.js +122 -0
  16. package/dist/components/alert.cjs +1 -0
  17. package/dist/components/alert.d.ts +13 -0
  18. package/dist/components/alert.js +165 -0
  19. package/dist/components/auth-backdrop.cjs +1 -0
  20. package/dist/components/auth-backdrop.d.ts +7 -0
  21. package/dist/components/auth-backdrop.js +10 -0
  22. package/dist/components/autocomplete/dropdown.d.ts +21 -0
  23. package/dist/components/autocomplete/icons.d.ts +8 -0
  24. package/dist/components/autocomplete/multi-trigger.d.ts +25 -0
  25. package/dist/components/autocomplete/single-trigger.d.ts +21 -0
  26. package/dist/components/autocomplete/types.d.ts +34 -0
  27. package/dist/components/autocomplete.cjs +1 -0
  28. package/dist/components/autocomplete.d.ts +5 -0
  29. package/dist/components/autocomplete.js +3 -0
  30. package/dist/components/avatar.cjs +1 -0
  31. package/dist/components/avatar.d.ts +17 -0
  32. package/dist/components/avatar.js +56 -0
  33. package/dist/components/badge.cjs +1 -0
  34. package/dist/components/badge.d.ts +12 -0
  35. package/dist/components/badge.js +32 -0
  36. package/dist/components/billing-interval-toggle.cjs +1 -0
  37. package/dist/components/billing-interval-toggle.d.ts +18 -0
  38. package/dist/components/billing-interval-toggle.js +39 -0
  39. package/dist/components/breadcrumb.cjs +1 -0
  40. package/dist/components/breadcrumb.d.ts +11 -0
  41. package/dist/components/breadcrumb.js +52 -0
  42. package/dist/components/button.cjs +1 -0
  43. package/dist/components/button.d.ts +17 -0
  44. package/dist/components/button.js +90 -0
  45. package/dist/components/calendar/month-view.d.ts +17 -0
  46. package/dist/components/calendar/types.d.ts +54 -0
  47. package/dist/components/calendar/week-view.d.ts +17 -0
  48. package/dist/components/calendar.cjs +1 -0
  49. package/dist/components/calendar.d.ts +3 -0
  50. package/dist/components/calendar.js +3 -0
  51. package/dist/components/callout.cjs +1 -0
  52. package/dist/components/callout.d.ts +9 -0
  53. package/dist/components/callout.js +131 -0
  54. package/dist/components/card.cjs +1 -0
  55. package/dist/components/card.d.ts +17 -0
  56. package/dist/components/card.js +59 -0
  57. package/dist/components/charts/bar-chart.d.ts +16 -0
  58. package/dist/components/charts/donut-chart.d.ts +10 -0
  59. package/dist/components/charts/funnel-chart.d.ts +8 -0
  60. package/dist/components/charts/gantt-chart.d.ts +15 -0
  61. package/dist/components/charts/heatmap-chart.d.ts +10 -0
  62. package/dist/components/charts/index.d.ts +11 -0
  63. package/dist/components/charts/line-chart.d.ts +16 -0
  64. package/dist/components/charts/multi-line-chart.d.ts +18 -0
  65. package/dist/components/charts/radar-chart.d.ts +13 -0
  66. package/dist/components/charts/scatter-chart.d.ts +24 -0
  67. package/dist/components/charts/shared.d.ts +15 -0
  68. package/dist/components/charts/waterfall-chart.d.ts +14 -0
  69. package/dist/components/charts.cjs +1 -0
  70. package/dist/components/charts.d.ts +2 -0
  71. package/dist/components/charts.js +2 -0
  72. package/dist/components/checkbox.cjs +1 -0
  73. package/dist/components/checkbox.d.ts +9 -0
  74. package/dist/components/checkbox.js +135 -0
  75. package/dist/components/code.cjs +7 -0
  76. package/dist/components/code.d.ts +23 -0
  77. package/dist/components/code.js +276 -0
  78. package/dist/components/command.cjs +1 -0
  79. package/dist/components/command.d.ts +29 -0
  80. package/dist/components/command.js +208 -0
  81. package/dist/components/confirm-dialog.cjs +1 -0
  82. package/dist/components/confirm-dialog.d.ts +14 -0
  83. package/dist/components/confirm-dialog.js +69 -0
  84. package/dist/components/copy-button.cjs +1 -0
  85. package/dist/components/copy-button.d.ts +8 -0
  86. package/dist/components/copy-button.js +87 -0
  87. package/dist/components/datatable/pagination-footer.d.ts +10 -0
  88. package/dist/components/datatable/rows-dropdown.d.ts +5 -0
  89. package/dist/components/datatable/skeleton-row.d.ts +3 -0
  90. package/dist/components/datatable/sort-icon.d.ts +4 -0
  91. package/dist/components/datatable/types.d.ts +30 -0
  92. package/dist/components/datatable.cjs +1 -0
  93. package/dist/components/datatable.d.ts +9 -0
  94. package/dist/components/datatable.js +3 -0
  95. package/dist/components/datepicker.cjs +1 -0
  96. package/dist/components/datepicker.d.ts +14 -0
  97. package/dist/components/datepicker.js +267 -0
  98. package/dist/components/drawer.cjs +1 -0
  99. package/dist/components/drawer.d.ts +18 -0
  100. package/dist/components/drawer.js +3 -0
  101. package/dist/components/dropdown-menu.cjs +1 -0
  102. package/dist/components/dropdown-menu.d.ts +26 -0
  103. package/dist/components/dropdown-menu.js +122 -0
  104. package/dist/components/empty-state.cjs +1 -0
  105. package/dist/components/empty-state.d.ts +10 -0
  106. package/dist/components/empty-state.js +68 -0
  107. package/dist/components/error-state.cjs +1 -0
  108. package/dist/components/error-state.d.ts +10 -0
  109. package/dist/components/error-state.js +80 -0
  110. package/dist/components/file-upload.cjs +1 -0
  111. package/dist/components/file-upload.d.ts +10 -0
  112. package/dist/components/file-upload.js +173 -0
  113. package/dist/components/form-field.cjs +1 -0
  114. package/dist/components/form-field.d.ts +10 -0
  115. package/dist/components/form-field.js +36 -0
  116. package/dist/components/info-button.cjs +1 -0
  117. package/dist/components/info-button.d.ts +4 -0
  118. package/dist/components/info-button.js +32 -0
  119. package/dist/components/input.cjs +1 -0
  120. package/dist/components/input.d.ts +19 -0
  121. package/dist/components/input.js +117 -0
  122. package/dist/components/kbd.cjs +1 -0
  123. package/dist/components/kbd.d.ts +6 -0
  124. package/dist/components/kbd.js +16 -0
  125. package/dist/components/label.cjs +1 -0
  126. package/dist/components/label.d.ts +6 -0
  127. package/dist/components/label.js +31 -0
  128. package/dist/components/layout.cjs +1 -0
  129. package/dist/components/layout.d.ts +51 -0
  130. package/dist/components/layout.js +117 -0
  131. package/dist/components/link.cjs +1 -0
  132. package/dist/components/link.d.ts +9 -0
  133. package/dist/components/link.js +48 -0
  134. package/dist/components/list.cjs +1 -0
  135. package/dist/components/list.d.ts +13 -0
  136. package/dist/components/list.js +46 -0
  137. package/dist/components/modal.cjs +1 -0
  138. package/dist/components/modal.d.ts +31 -0
  139. package/dist/components/modal.js +219 -0
  140. package/dist/components/navigation.cjs +1 -0
  141. package/dist/components/navigation.d.ts +42 -0
  142. package/dist/components/navigation.js +127 -0
  143. package/dist/components/number-input.cjs +1 -0
  144. package/dist/components/number-input.d.ts +16 -0
  145. package/dist/components/number-input.js +142 -0
  146. package/dist/components/otp-input.cjs +1 -0
  147. package/dist/components/otp-input.d.ts +13 -0
  148. package/dist/components/otp-input.js +71 -0
  149. package/dist/components/pagination.cjs +1 -0
  150. package/dist/components/pagination.d.ts +8 -0
  151. package/dist/components/pagination.js +77 -0
  152. package/dist/components/popover.cjs +1 -0
  153. package/dist/components/popover.d.ts +16 -0
  154. package/dist/components/popover.js +115 -0
  155. package/dist/components/progressbar.cjs +1 -0
  156. package/dist/components/progressbar.d.ts +15 -0
  157. package/dist/components/progressbar.js +108 -0
  158. package/dist/components/radio.cjs +1 -0
  159. package/dist/components/radio.d.ts +22 -0
  160. package/dist/components/radio.js +96 -0
  161. package/dist/components/richtext.cjs +1 -0
  162. package/dist/components/richtext.d.ts +10 -0
  163. package/dist/components/richtext.js +370 -0
  164. package/dist/components/select/option-list.d.ts +16 -0
  165. package/dist/components/select/select-multi.d.ts +2 -0
  166. package/dist/components/select/select-single.d.ts +2 -0
  167. package/dist/components/select/types.d.ts +54 -0
  168. package/dist/components/select/utils.d.ts +10 -0
  169. package/dist/components/select.cjs +1 -0
  170. package/dist/components/select.d.ts +3 -0
  171. package/dist/components/select.js +2 -0
  172. package/dist/components/seo.cjs +1 -0
  173. package/dist/components/seo.d.ts +45 -0
  174. package/dist/components/seo.js +64 -0
  175. package/dist/components/separator.cjs +1 -0
  176. package/dist/components/separator.d.ts +6 -0
  177. package/dist/components/separator.js +25 -0
  178. package/dist/components/skeleton.cjs +1 -0
  179. package/dist/components/skeleton.d.ts +37 -0
  180. package/dist/components/skeleton.js +146 -0
  181. package/dist/components/slider.cjs +1 -0
  182. package/dist/components/slider.d.ts +12 -0
  183. package/dist/components/slider.js +72 -0
  184. package/dist/components/snackbar.cjs +1 -0
  185. package/dist/components/snackbar.d.ts +35 -0
  186. package/dist/components/snackbar.js +220 -0
  187. package/dist/components/spinner.cjs +1 -0
  188. package/dist/components/spinner.d.ts +7 -0
  189. package/dist/components/spinner.js +31 -0
  190. package/dist/components/stat.cjs +1 -0
  191. package/dist/components/stat.d.ts +18 -0
  192. package/dist/components/stat.js +90 -0
  193. package/dist/components/status-dot.cjs +1 -0
  194. package/dist/components/status-dot.d.ts +10 -0
  195. package/dist/components/status-dot.js +29 -0
  196. package/dist/components/stepper.cjs +1 -0
  197. package/dist/components/stepper.d.ts +11 -0
  198. package/dist/components/stepper.js +67 -0
  199. package/dist/components/switch.cjs +1 -0
  200. package/dist/components/switch.d.ts +8 -0
  201. package/dist/components/switch.js +79 -0
  202. package/dist/components/table.cjs +1 -0
  203. package/dist/components/table.d.ts +12 -0
  204. package/dist/components/table.js +54 -0
  205. package/dist/components/tabs.cjs +1 -0
  206. package/dist/components/tabs.d.ts +22 -0
  207. package/dist/components/tabs.js +120 -0
  208. package/dist/components/tag.cjs +1 -0
  209. package/dist/components/tag.d.ts +12 -0
  210. package/dist/components/tag.js +58 -0
  211. package/dist/components/terminal/fs.d.ts +10 -0
  212. package/dist/components/terminal/shell-commands-sim.d.ts +5 -0
  213. package/dist/components/terminal/shell-commands.d.ts +16 -0
  214. package/dist/components/terminal/shell-run.d.ts +11 -0
  215. package/dist/components/terminal/terminal-block.d.ts +13 -0
  216. package/dist/components/terminal/terminal-emulator.d.ts +10 -0
  217. package/dist/components/terminal/types.d.ts +35 -0
  218. package/dist/components/terminal.cjs +1 -0
  219. package/dist/components/terminal.d.ts +2 -0
  220. package/dist/components/terminal.js +2 -0
  221. package/dist/components/textarea.cjs +1 -0
  222. package/dist/components/textarea.d.ts +13 -0
  223. package/dist/components/textarea.js +54 -0
  224. package/dist/components/theme-provider.cjs +1 -0
  225. package/dist/components/theme-provider.d.ts +89 -0
  226. package/dist/components/theme-provider.js +93 -0
  227. package/dist/components/theme-toggle.cjs +1 -0
  228. package/dist/components/theme-toggle.d.ts +9 -0
  229. package/dist/components/theme-toggle.js +4 -0
  230. package/dist/components/timeline.cjs +1 -0
  231. package/dist/components/timeline.d.ts +14 -0
  232. package/dist/components/timeline.js +54 -0
  233. package/dist/components/tooltip.cjs +1 -0
  234. package/dist/components/tooltip.d.ts +11 -0
  235. package/dist/components/tooltip.js +84 -0
  236. package/dist/components/tree.cjs +1 -0
  237. package/dist/components/tree.d.ts +16 -0
  238. package/dist/components/tree.js +92 -0
  239. package/dist/createLucideIcon-DDY8HuQR.js +42 -0
  240. package/dist/createLucideIcon-b_X_3fj-.cjs +1 -0
  241. package/dist/datatable-BB3v__r5.cjs +1 -0
  242. package/dist/datatable-DlBhUhuO.js +316 -0
  243. package/dist/drawer-Cbuh6qdL.cjs +1 -0
  244. package/dist/drawer-CqkVZT9Y.js +189 -0
  245. package/dist/focus-Dk1YWVPN.js +42 -0
  246. package/dist/focus-DmG6Ge7X.cjs +1 -0
  247. package/dist/index.cjs +1 -0
  248. package/dist/index.d.ts +70 -0
  249. package/dist/index.js +215 -0
  250. package/dist/lib/cn.d.ts +2 -0
  251. package/dist/lib/component-styles.d.ts +10 -0
  252. package/dist/select-Ch5fp1GT.js +461 -0
  253. package/dist/select-q0YCMhBP.cjs +1 -0
  254. package/dist/styles.css +3 -0
  255. package/dist/terminal-BOR2cFi1.js +1060 -0
  256. package/dist/terminal-CpraMs50.cjs +77 -0
  257. package/dist/theme-toggle-CnoiorKV.js +71 -0
  258. package/dist/theme-toggle-Dp1-24zH.cjs +1 -0
  259. package/dist/use-event-callback-DGkfO_uu.js +10 -0
  260. package/dist/use-event-callback-Du9_9eAi.cjs +1 -0
  261. package/dist/utils-CQ8pvCtk.js +72 -0
  262. package/dist/utils-DOFJTw8o.cjs +1 -0
  263. package/package.json +88 -0
@@ -0,0 +1,573 @@
1
+ import { t as e } from "./cn-DpgY2leY.js";
2
+ import { c as t, s as n } from "./component-styles-Ce56hn9T.js";
3
+ import { AnimatePresence as r, motion as i } from "framer-motion";
4
+ import { useEffect as a, useState as o } from "react";
5
+ import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
6
+ //#region src/components/calendar/types.ts
7
+ var u = [
8
+ "Su",
9
+ "Mo",
10
+ "Tu",
11
+ "We",
12
+ "Th",
13
+ "Fr",
14
+ "Sa"
15
+ ], d = [
16
+ "Sun",
17
+ "Mon",
18
+ "Tue",
19
+ "Wed",
20
+ "Thu",
21
+ "Fri",
22
+ "Sat"
23
+ ], f = [
24
+ "January",
25
+ "February",
26
+ "March",
27
+ "April",
28
+ "May",
29
+ "June",
30
+ "July",
31
+ "August",
32
+ "September",
33
+ "October",
34
+ "November",
35
+ "December"
36
+ ], p = {
37
+ blue: "bg-blue-500/12 text-blue-400 border-blue-500/20",
38
+ green: "bg-emerald-500/12 text-emerald-400 border-emerald-500/20",
39
+ red: "bg-red-500/12 text-red-400 border-red-500/20",
40
+ yellow: "bg-amber-500/12 text-amber-400 border-amber-500/20",
41
+ purple: "bg-violet-500/12 text-violet-400 border-violet-500/20",
42
+ orange: "bg-orange-500/12 text-orange-400 border-orange-500/20"
43
+ };
44
+ function m(e, t) {
45
+ return e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate();
46
+ }
47
+ function h(e, t) {
48
+ let n = new Date(e);
49
+ return n.setDate(n.getDate() + t), n;
50
+ }
51
+ function g(e) {
52
+ let t = new Date(e);
53
+ return t.setDate(t.getDate() - t.getDay()), t;
54
+ }
55
+ var _ = {
56
+ enter: (e) => ({
57
+ opacity: 0,
58
+ x: e * 16
59
+ }),
60
+ center: {
61
+ opacity: 1,
62
+ x: 0
63
+ },
64
+ exit: (e) => ({
65
+ opacity: 0,
66
+ x: e * -16
67
+ })
68
+ };
69
+ //#endregion
70
+ //#region src/components/calendar/month-view.tsx
71
+ function v({ viewDate: t, today: n, value: r, events: i, onSelect: a, onEventClick: o, isDateDisabled: d, onEventCreate: f, onEventDelete: h, editingId: g, onEditToggle: _, onUpdateTitle: v }) {
72
+ let y = t.getFullYear(), b = t.getMonth(), x = new Date(y, b + 1, 0).getDate(), S = new Date(y, b, 1).getDay(), C = [...Array(S).fill(null), ...Array.from({ length: x }, (e, t) => new Date(y, b, t + 1))];
73
+ for (; C.length % 7 != 0;) C.push(null);
74
+ function w(e) {
75
+ return i.filter((t) => m(t.date, e));
76
+ }
77
+ return /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c("div", {
78
+ role: "row",
79
+ className: "grid grid-cols-7 border-b border-border",
80
+ children: u.map((e) => /* @__PURE__ */ c("div", {
81
+ role: "columnheader",
82
+ className: "py-2.5 text-center text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",
83
+ children: e
84
+ }, e))
85
+ }), /* @__PURE__ */ c("div", {
86
+ role: "grid",
87
+ className: "grid grid-cols-7",
88
+ style: { gridTemplateRows: `repeat(${C.length / 7}, minmax(80px, 1fr))` },
89
+ children: C.map((t, i) => {
90
+ let s = i % 7 == 6, u = i >= C.length - 7;
91
+ if (!t) return /* @__PURE__ */ c("div", {
92
+ role: "gridcell",
93
+ className: e("border-black/6 dark:border-white/6 bg-black/[0.015] dark:bg-white/[0.015]", !s && "border-r", !u && "border-b")
94
+ }, `e${i}`);
95
+ let _ = w(t), v = n ? m(t, n) : !1, y = r ? m(t, r) : !1, x = t.getMonth() === b, S = d?.(t) ?? !1;
96
+ return /* @__PURE__ */ l("div", {
97
+ role: "gridcell",
98
+ tabIndex: S ? void 0 : 0,
99
+ "aria-label": t.toLocaleDateString(void 0, { dateStyle: "full" }),
100
+ "aria-disabled": S || void 0,
101
+ "aria-selected": y,
102
+ onClick: () => !S && a(t),
103
+ onKeyDown: (e) => {
104
+ !S && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), a(t));
105
+ },
106
+ className: e("p-1.5 transition-colors group/cell", "border-border focus-visible:z-10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus-ring/35", !s && "border-r", !u && "border-b", !x && "bg-black/[0.015] dark:bg-white/[0.015]", S ? "cursor-not-allowed opacity-40" : "cursor-pointer hover:bg-surface-muted"),
107
+ children: [/* @__PURE__ */ l("div", {
108
+ className: "flex items-center justify-between mb-1",
109
+ children: [/* @__PURE__ */ c("span", {
110
+ className: e("w-6 h-6 rounded-full flex items-center justify-center text-xs font-medium", y ? "bg-primary text-primary-foreground" : v ? "border border-accent-500/50 text-accent-600 dark:text-accent-300" : x ? "text-slate-700 dark:text-slate-200" : "text-slate-400 dark:text-slate-600"),
111
+ children: t.getDate()
112
+ }), f && !S && /* @__PURE__ */ c("button", {
113
+ type: "button",
114
+ "aria-label": `Add event on ${t.toLocaleDateString()}`,
115
+ onClick: (e) => {
116
+ e.stopPropagation(), f(t);
117
+ },
118
+ className: "opacity-0 group-hover/cell:opacity-100 focus:opacity-100 w-5 h-5 rounded-md bg-primary text-primary-foreground flex items-center justify-center text-[10px] hover:bg-primary-hover transition-opacity",
119
+ children: "+"
120
+ })]
121
+ }), /* @__PURE__ */ l("div", {
122
+ className: "space-y-0.5",
123
+ children: [_.slice(0, 2).map((t) => {
124
+ let n = g === t.id;
125
+ return /* @__PURE__ */ l("div", {
126
+ className: e("group/ev flex items-center gap-0.5 rounded border px-1 py-0.5", p[t.color ?? "blue"], n && "ring-1 ring-focus-ring"),
127
+ children: [/* @__PURE__ */ l("button", {
128
+ type: "button",
129
+ onClick: (e) => {
130
+ e.stopPropagation(), o?.(t);
131
+ },
132
+ className: "min-w-0 flex-1 truncate text-left text-[10px] font-medium",
133
+ children: [t.time && /* @__PURE__ */ c("span", {
134
+ className: "opacity-60 mr-1",
135
+ children: t.time
136
+ }), t.title]
137
+ }), h && /* @__PURE__ */ c("button", {
138
+ type: "button",
139
+ "aria-label": `Delete ${t.title}`,
140
+ onClick: (e) => {
141
+ e.stopPropagation(), h(t.id);
142
+ },
143
+ className: "flex size-4 shrink-0 items-center justify-center rounded text-[10px] leading-none opacity-60 hover:bg-muted hover:opacity-100",
144
+ children: "×"
145
+ })]
146
+ }, t.id);
147
+ }), _.length > 2 && /* @__PURE__ */ l("p", {
148
+ className: "text-[10px] text-slate-500 px-1",
149
+ children: [
150
+ "+",
151
+ _.length - 2,
152
+ " more"
153
+ ]
154
+ })]
155
+ })]
156
+ }, t.toISOString());
157
+ })
158
+ })] });
159
+ }
160
+ //#endregion
161
+ //#region src/components/calendar/week-view.tsx
162
+ function y({ viewDate: t, today: n, value: r, events: i, onSelect: a, onEventClick: o, isDateDisabled: u, onEventCreate: f, onEventDelete: _, editingId: v, onEditToggle: y, onUpdateTitle: b }) {
163
+ let x = g(t), S = Array.from({ length: 7 }, (e, t) => h(x, t));
164
+ function C(e) {
165
+ return i.filter((t) => m(t.date, e));
166
+ }
167
+ return /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c("div", {
168
+ role: "row",
169
+ className: "grid grid-cols-7 border-b border-border",
170
+ children: S.map((t) => {
171
+ let i = n ? m(t, n) : !1, o = r ? m(t, r) : !1, s = u?.(t) ?? !1;
172
+ return /* @__PURE__ */ l("div", {
173
+ role: "gridcell",
174
+ tabIndex: s ? void 0 : 0,
175
+ "aria-selected": o,
176
+ "aria-disabled": s || void 0,
177
+ "aria-label": t.toLocaleDateString(void 0, { dateStyle: "full" }),
178
+ onClick: () => !s && a(t),
179
+ onKeyDown: (e) => {
180
+ !s && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), a(t));
181
+ },
182
+ className: e("group/whead flex flex-col items-center gap-1 py-3 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus-ring/35", s ? "cursor-not-allowed opacity-40" : "cursor-pointer hover:bg-surface-muted"),
183
+ children: [
184
+ /* @__PURE__ */ c("span", {
185
+ className: "text-[10px] font-semibold text-slate-400 dark:text-slate-500 uppercase tracking-wide",
186
+ children: d[t.getDay()]
187
+ }),
188
+ /* @__PURE__ */ c("span", {
189
+ className: e("w-8 h-8 rounded-full flex items-center justify-center text-sm font-semibold transition-colors", o ? "bg-primary text-primary-foreground" : i ? "border border-accent-500/50 text-accent-600 dark:text-accent-300" : "text-slate-700 dark:text-slate-200"),
190
+ children: t.getDate()
191
+ }),
192
+ f && !s && /* @__PURE__ */ c("button", {
193
+ type: "button",
194
+ "aria-label": `Add event on ${t.toLocaleDateString()}`,
195
+ onClick: (e) => {
196
+ e.stopPropagation(), f(t);
197
+ },
198
+ className: "opacity-0 group-hover/whead:opacity-100 focus:opacity-100 h-5 px-1.5 rounded-md bg-primary text-primary-foreground text-[10px] hover:bg-primary-hover",
199
+ children: "+ Add"
200
+ })
201
+ ]
202
+ }, t.toISOString());
203
+ })
204
+ }), /* @__PURE__ */ c("div", {
205
+ className: "grid grid-cols-7 min-h-[200px]",
206
+ children: S.map((t, n) => {
207
+ let r = C(t), i = n === 6, s = u?.(t) ?? !1;
208
+ return /* @__PURE__ */ c("div", {
209
+ role: "gridcell",
210
+ tabIndex: s ? void 0 : 0,
211
+ "aria-disabled": s || void 0,
212
+ "aria-label": `${t.toLocaleDateString(void 0, { dateStyle: "full" })} events`,
213
+ onClick: () => !s && a(t),
214
+ onKeyDown: (e) => {
215
+ !s && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), a(t));
216
+ },
217
+ className: e("space-y-1.5 p-2 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus-ring/35", !i && "border-r border-border", s ? "cursor-not-allowed opacity-40" : "cursor-pointer hover:bg-surface-muted/70"),
218
+ children: r.map((t) => /* @__PURE__ */ l("div", {
219
+ className: e("group/wev flex items-start gap-1 rounded-[var(--radius-md)] border px-2 py-1.5", p[t.color ?? "blue"], v === t.id && "ring-1 ring-focus-ring"),
220
+ children: [/* @__PURE__ */ l("button", {
221
+ type: "button",
222
+ onClick: (e) => {
223
+ e.stopPropagation(), o?.(t);
224
+ },
225
+ className: "min-w-0 flex-1 text-left",
226
+ children: [t.time && /* @__PURE__ */ c("div", {
227
+ className: "text-[10px] opacity-60 mb-0.5",
228
+ children: t.time
229
+ }), /* @__PURE__ */ c("div", {
230
+ className: "text-xs font-medium truncate",
231
+ children: t.title
232
+ })]
233
+ }), _ && /* @__PURE__ */ c("button", {
234
+ type: "button",
235
+ "aria-label": `Delete ${t.title}`,
236
+ onClick: (e) => {
237
+ e.stopPropagation(), _(t.id);
238
+ },
239
+ className: "flex size-5 shrink-0 items-center justify-center rounded text-xs opacity-60 hover:bg-muted hover:opacity-100",
240
+ children: "×"
241
+ })]
242
+ }, t.id))
243
+ }, t.toISOString());
244
+ })
245
+ })] });
246
+ }
247
+ //#endregion
248
+ //#region src/components/calendar.tsx
249
+ function b({ value: s, defaultValue: u = null, onChange: d, events: p, defaultEvents: m = [], onEventsChange: b, onEventClick: x, onEventCreate: S, onEventUpdate: C, onEventDelete: w, editable: T = !1, view: E, defaultView: ee = "month", onViewChange: te, viewDate: D, defaultViewDate: O, onViewDateChange: ne, minDate: k, maxDate: A, disabledDates: j, className: re }) {
250
+ let [ie, ae] = o(null), [oe, se] = o(u), [ce, le] = o(ee), [ue, M] = o(O ?? null), [de, fe] = o(() => p ?? m), [pe, N] = o(1), [P, F] = o(null), [I, L] = o(""), [R, me] = o("blue"), [z, B] = o("09:00"), [V, H] = o(null);
251
+ a(() => {
252
+ let e = /* @__PURE__ */ new Date();
253
+ ae(e), O === void 0 && D === void 0 && M(new Date(e.getFullYear(), e.getMonth(), 1));
254
+ }, []), a(() => {
255
+ D === void 0 && O !== void 0 && ue === null && M(O ? new Date(O) : null);
256
+ }, [O]);
257
+ let he = s === void 0 ? oe : s, U = E === void 0 ? ce : E, W = D === void 0 ? ue : D, G = p !== void 0, K = G ? p : de;
258
+ function q(e) {
259
+ return !!(k && e < new Date(k.getFullYear(), k.getMonth(), k.getDate()) || A && e > new Date(A.getFullYear(), A.getMonth(), A.getDate(), 23, 59, 59, 999) || j?.(e));
260
+ }
261
+ function ge(e) {
262
+ E === void 0 && le(e), te?.(e);
263
+ }
264
+ function J(e) {
265
+ e !== null && (D === void 0 && M(e), ne?.(e));
266
+ }
267
+ function _e(e) {
268
+ q(e) || (s === void 0 && se(e), d?.(e));
269
+ }
270
+ function ve(e) {
271
+ return e && (U === "month" ? new Date(e.getFullYear(), e.getMonth() - 1, 1) : h(e, -7));
272
+ }
273
+ function ye(e) {
274
+ return e && (U === "month" ? new Date(e.getFullYear(), e.getMonth() + 1, 1) : h(e, 7));
275
+ }
276
+ function be() {
277
+ N(-1), J(ve(W));
278
+ }
279
+ function xe() {
280
+ N(1), J(ye(W));
281
+ }
282
+ function Se() {
283
+ let e = /* @__PURE__ */ new Date();
284
+ N(0), J(new Date(e.getFullYear(), e.getMonth(), 1)), _e(e);
285
+ }
286
+ function Y(e) {
287
+ G || fe(e), b?.(e);
288
+ }
289
+ function Ce(e, t) {
290
+ if (q(e)) return;
291
+ let n = {
292
+ id: typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID() : String(Date.now() + Math.random()),
293
+ title: t?.trim() || I.trim() || "New event",
294
+ date: new Date(e),
295
+ color: R,
296
+ time: z || void 0
297
+ };
298
+ Y([...K, n]), S?.(n), F(null), L(""), B("09:00");
299
+ }
300
+ function X(e) {
301
+ Y(K.filter((t) => t.id !== e)), w?.(e), V === e && H(null);
302
+ }
303
+ function Z(e) {
304
+ Y(K.map((t) => t.id === e.id ? e : t)), C?.(e), H(null);
305
+ }
306
+ function we(e) {
307
+ T && H((t) => t === e.id ? null : e.id), x?.(e);
308
+ }
309
+ let Q = "";
310
+ if (W) {
311
+ if (U === "month") Q = `${f[W.getMonth()]} ${W.getFullYear()}`;
312
+ else {
313
+ let e = g(W), t = h(e, 6);
314
+ Q = e.getMonth() === t.getMonth() ? `${f[e.getMonth()].slice(0, 3)} ${e.getDate()} \u2013 ${t.getDate()}, ${e.getFullYear()}` : `${f[e.getMonth()].slice(0, 3)} ${e.getDate()} \u2013 ${f[t.getMonth()].slice(0, 3)} ${t.getDate()}, ${e.getFullYear()}`;
315
+ }
316
+ }
317
+ let Te = T || !!S || !!C || !!w || !!b, Ee = {
318
+ today: ie,
319
+ value: he,
320
+ events: K,
321
+ onSelect: _e,
322
+ onEventClick: we,
323
+ onEventCreate: Te ? (e) => F(e) : void 0,
324
+ onEventDelete: Te || w ? X : void 0,
325
+ onEventUpdate: C,
326
+ editingId: V,
327
+ onEditToggle: (e) => H((t) => t === e ? null : e),
328
+ onUpdateTitle: (e, t) => {
329
+ let n = K.find((t) => t.id === e);
330
+ n && Z({
331
+ ...n,
332
+ title: t
333
+ });
334
+ },
335
+ minDate: k,
336
+ maxDate: A,
337
+ disabledDates: j,
338
+ isDateDisabled: q
339
+ }, $ = W ? `${U}-${W.toISOString()}` : null;
340
+ return /* @__PURE__ */ l("div", {
341
+ className: e("flex flex-col overflow-hidden rounded-[var(--radius-lg)] border border-border bg-surface", re),
342
+ children: [
343
+ /* @__PURE__ */ l("div", {
344
+ className: "flex shrink-0 flex-wrap items-center gap-2 border-b border-border px-3 py-3 sm:px-4",
345
+ children: [
346
+ /* @__PURE__ */ l("div", {
347
+ className: "flex items-center gap-0.5",
348
+ children: [/* @__PURE__ */ c("button", {
349
+ type: "button",
350
+ onClick: be,
351
+ "aria-label": `Previous ${U}`,
352
+ className: e(t, "size-8"),
353
+ children: /* @__PURE__ */ c("svg", {
354
+ width: "13",
355
+ height: "13",
356
+ viewBox: "0 0 24 24",
357
+ fill: "none",
358
+ stroke: "currentColor",
359
+ strokeWidth: "2.5",
360
+ strokeLinecap: "round",
361
+ strokeLinejoin: "round",
362
+ children: /* @__PURE__ */ c("path", { d: "m15 18-6-6 6-6" })
363
+ })
364
+ }), /* @__PURE__ */ c("button", {
365
+ type: "button",
366
+ onClick: xe,
367
+ "aria-label": `Next ${U}`,
368
+ className: e(t, "size-8"),
369
+ children: /* @__PURE__ */ c("svg", {
370
+ width: "13",
371
+ height: "13",
372
+ viewBox: "0 0 24 24",
373
+ fill: "none",
374
+ stroke: "currentColor",
375
+ strokeWidth: "2.5",
376
+ strokeLinecap: "round",
377
+ strokeLinejoin: "round",
378
+ children: /* @__PURE__ */ c("path", { d: "m9 18 6-6-6-6" })
379
+ })
380
+ })]
381
+ }),
382
+ /* @__PURE__ */ c("span", {
383
+ "aria-live": "polite",
384
+ className: "min-w-[9rem] flex-1 select-none text-sm font-semibold text-foreground",
385
+ children: Q
386
+ }),
387
+ /* @__PURE__ */ c("button", {
388
+ type: "button",
389
+ onClick: Se,
390
+ className: e("h-8 rounded-[var(--radius-md)] border border-border px-3 text-xs font-medium text-muted-foreground transition-colors hover:border-border-strong hover:bg-muted hover:text-foreground", n),
391
+ children: "Today"
392
+ }),
393
+ /* @__PURE__ */ c("div", {
394
+ role: "group",
395
+ "aria-label": "Calendar view",
396
+ className: "flex overflow-hidden rounded-[var(--radius-md)] border border-border",
397
+ children: ["month", "week"].map((t) => /* @__PURE__ */ c("button", {
398
+ type: "button",
399
+ onClick: () => ge(t),
400
+ "aria-pressed": U === t,
401
+ className: e("h-8 px-3 text-xs capitalize transition-colors focus-visible:z-10", n, U === t ? "bg-muted text-foreground font-medium" : "text-muted-foreground hover:bg-surface-muted hover:text-foreground"),
402
+ children: t
403
+ }, t))
404
+ })
405
+ ]
406
+ }),
407
+ P && /* @__PURE__ */ l("div", {
408
+ className: "flex flex-wrap items-center gap-2 border-b border-border bg-warning/8 px-3 py-3 sm:px-4",
409
+ children: [
410
+ /* @__PURE__ */ l("span", {
411
+ className: "text-xs font-medium text-foreground",
412
+ children: [
413
+ "New event on ",
414
+ P.toLocaleDateString(),
415
+ ":"
416
+ ]
417
+ }),
418
+ /* @__PURE__ */ c("input", {
419
+ autoFocus: !0,
420
+ value: I,
421
+ onChange: (e) => L(e.target.value),
422
+ onKeyDown: (e) => {
423
+ e.key === "Enter" && Ce(P), e.key === "Escape" && (F(null), L(""), B("09:00"));
424
+ },
425
+ placeholder: "Event title",
426
+ className: "h-7 flex-1 min-w-[140px] rounded-md border border-border bg-surface px-2 text-xs text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-focus-ring/25"
427
+ }),
428
+ /* @__PURE__ */ c("input", {
429
+ type: "time",
430
+ value: z,
431
+ onChange: (e) => B(e.target.value),
432
+ className: "h-7 w-[110px] rounded-md border border-border bg-surface px-2 text-xs text-foreground focus:outline-none focus:ring-2 focus:ring-focus-ring/25"
433
+ }),
434
+ /* @__PURE__ */ l("select", {
435
+ "aria-label": "Event color",
436
+ value: R,
437
+ onChange: (e) => me(e.target.value),
438
+ className: "h-7 rounded-[var(--radius-md)] border border-border bg-surface px-2 text-xs text-foreground",
439
+ children: [
440
+ /* @__PURE__ */ c("option", {
441
+ value: "blue",
442
+ children: "Blue"
443
+ }),
444
+ /* @__PURE__ */ c("option", {
445
+ value: "green",
446
+ children: "Green"
447
+ }),
448
+ /* @__PURE__ */ c("option", {
449
+ value: "red",
450
+ children: "Red"
451
+ }),
452
+ /* @__PURE__ */ c("option", {
453
+ value: "yellow",
454
+ children: "Yellow"
455
+ }),
456
+ /* @__PURE__ */ c("option", {
457
+ value: "purple",
458
+ children: "Purple"
459
+ }),
460
+ /* @__PURE__ */ c("option", {
461
+ value: "orange",
462
+ children: "Orange"
463
+ })
464
+ ]
465
+ }),
466
+ /* @__PURE__ */ c("button", {
467
+ type: "button",
468
+ onClick: () => Ce(P),
469
+ className: "h-7 px-3 rounded-md bg-primary text-xs font-medium text-primary-foreground hover:bg-primary-hover",
470
+ children: "Add"
471
+ }),
472
+ /* @__PURE__ */ c("button", {
473
+ type: "button",
474
+ onClick: () => {
475
+ F(null), L(""), B("09:00");
476
+ },
477
+ className: "h-7 rounded-[var(--radius-md)] border border-border bg-surface px-2.5 text-xs text-muted-foreground hover:bg-muted hover:text-foreground",
478
+ children: "Cancel"
479
+ })
480
+ ]
481
+ }),
482
+ V && (() => {
483
+ let e = K.find((e) => e.id === V);
484
+ return e ? /* @__PURE__ */ l("div", {
485
+ className: "flex flex-wrap items-center gap-2 border-b border-border bg-surface-muted px-3 py-3 sm:px-4",
486
+ children: [
487
+ /* @__PURE__ */ c("span", {
488
+ className: "text-xs font-medium text-foreground",
489
+ children: "Edit event:"
490
+ }),
491
+ /* @__PURE__ */ c("input", {
492
+ autoFocus: !0,
493
+ defaultValue: e.title,
494
+ onKeyDown: (t) => {
495
+ if (t.key === "Enter") {
496
+ let n = t.target.value, r = document.getElementById(`cal-edit-time-${e.id}`)?.value ?? e.time ?? "";
497
+ n.trim() && Z({
498
+ ...e,
499
+ title: n.trim(),
500
+ time: r || void 0
501
+ });
502
+ }
503
+ t.key === "Escape" && H(null);
504
+ },
505
+ id: `cal-edit-${e.id}`,
506
+ placeholder: "Title",
507
+ className: "h-7 flex-1 min-w-[140px] rounded-md border border-border bg-surface px-2 text-xs text-foreground focus:outline-none focus:ring-2 focus:ring-focus-ring/25"
508
+ }),
509
+ /* @__PURE__ */ c("input", {
510
+ type: "time",
511
+ defaultValue: e.time ?? "",
512
+ id: `cal-edit-time-${e.id}`,
513
+ className: "h-7 w-[110px] rounded-md border border-border bg-surface px-2 text-xs text-foreground focus:outline-none focus:ring-2 focus:ring-focus-ring/25"
514
+ }),
515
+ /* @__PURE__ */ c("button", {
516
+ type: "button",
517
+ onClick: () => {
518
+ let t = document.getElementById(`cal-edit-${e.id}`), n = document.getElementById(`cal-edit-time-${e.id}`), r = t?.value ?? e.title, i = n?.value ?? "";
519
+ r.trim() && Z({
520
+ ...e,
521
+ title: r.trim(),
522
+ time: i || void 0
523
+ });
524
+ },
525
+ className: "h-7 px-3 rounded-md bg-primary text-xs font-medium text-primary-foreground hover:bg-primary-hover",
526
+ children: "Save"
527
+ }),
528
+ /* @__PURE__ */ c("button", {
529
+ type: "button",
530
+ onClick: () => X(e.id),
531
+ className: "h-7 rounded-[var(--radius-md)] bg-destructive px-2.5 text-xs font-medium text-destructive-foreground hover:bg-destructive-hover",
532
+ children: "Delete"
533
+ }),
534
+ /* @__PURE__ */ c("button", {
535
+ type: "button",
536
+ onClick: () => H(null),
537
+ className: "h-7 rounded-[var(--radius-md)] border border-border bg-surface px-2.5 text-xs text-muted-foreground hover:bg-muted hover:text-foreground",
538
+ children: "Cancel"
539
+ })
540
+ ]
541
+ }) : null;
542
+ })(),
543
+ /* @__PURE__ */ c("div", {
544
+ className: "relative flex-1 overflow-x-auto",
545
+ children: /* @__PURE__ */ c("div", {
546
+ className: "min-w-[42rem]",
547
+ children: /* @__PURE__ */ c(r, {
548
+ mode: "popLayout",
549
+ initial: !1,
550
+ custom: pe,
551
+ children: $ !== null && W !== null && /* @__PURE__ */ c(i.div, {
552
+ custom: pe,
553
+ variants: _,
554
+ initial: "enter",
555
+ animate: "center",
556
+ exit: "exit",
557
+ transition: {
558
+ duration: .18,
559
+ ease: "easeInOut"
560
+ },
561
+ children: c(U === "month" ? v : y, {
562
+ viewDate: W,
563
+ ...Ee
564
+ })
565
+ }, $)
566
+ })
567
+ })
568
+ })
569
+ ]
570
+ });
571
+ }
572
+ //#endregion
573
+ export { b as t };