@krosoft/react 0.0.381 → 0.0.383

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 (220) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +13 -0
  2. package/dist/components/core/cards/DashboardCard.js +18 -0
  3. package/dist/components/core/cards/KpiCard.js +36 -0
  4. package/dist/components/core/cards/KpiCards.js +29 -0
  5. package/dist/components/core/cards/MetricCard.js +63 -0
  6. package/dist/components/core/cards/SkeletonCard.js +13 -0
  7. package/dist/components/core/cards/SkeletonCards.js +11 -0
  8. package/dist/components/core/cards/index.js +7 -1
  9. package/dist/components/core/changelog/AppChangelog.js +123 -0
  10. package/dist/components/core/changelog/AppChangelogEntry.js +85 -0
  11. package/dist/components/core/changelog/AppChangelogNav.js +39 -0
  12. package/dist/components/core/changelog/AppChangelogTagFilter.js +39 -0
  13. package/dist/components/core/changelog/index.js +1 -1
  14. package/dist/components/core/charts/BarChartHorizontal.js +80 -0
  15. package/dist/components/core/charts/BarChartVertical.js +68 -0
  16. package/dist/components/core/charts/ChartCard.js +44 -0
  17. package/dist/components/core/charts/CircularGauge.js +58 -0
  18. package/dist/components/core/charts/LineChart.js +69 -0
  19. package/dist/components/core/charts/PieChart.js +55 -0
  20. package/dist/components/core/charts/chartColors.js +10 -0
  21. package/dist/components/core/charts/chartTooltip.helper.js +15 -0
  22. package/dist/components/core/charts/index.js +8 -1
  23. package/dist/components/core/dialogs/AboutDialog.js +59 -0
  24. package/dist/components/core/dialogs/AppDialog.js +81 -0
  25. package/dist/components/core/dialogs/ConfirmationDialog.js +42 -0
  26. package/dist/components/core/dialogs/FormDialog.js +105 -0
  27. package/dist/components/core/dialogs/index.js +7 -4
  28. package/dist/components/core/filters/ActiveFilters.js +69 -0
  29. package/dist/components/core/filters/AdvancedFilters.js +103 -0
  30. package/dist/components/core/filters/ConditionFilter.js +162 -0
  31. package/dist/components/core/filters/ConditionFilterGroup.js +44 -0
  32. package/dist/components/core/filters/FilterField.js +64 -0
  33. package/dist/components/core/filters/FilterPills.js +13 -0
  34. package/dist/components/core/filters/FilterPillsGroup.js +39 -0
  35. package/dist/components/core/filters/FiltersContainer.js +54 -0
  36. package/dist/components/core/filters/FiltersMobileDrawer.js +57 -0
  37. package/dist/components/core/filters/TableFilter.js +101 -0
  38. package/dist/components/core/filters/index.js +11 -645
  39. package/dist/{GenericForm-Dxd6k7l-.js → components/core/forms/GenericForm.js} +45 -43
  40. package/dist/components/core/forms/index.js +1 -1
  41. package/dist/components/core/icons/FlagFrIcon.js +28 -0
  42. package/dist/{icons-n0m_1w7z.js → components/core/icons/FlagGbIcon.js} +3 -26
  43. package/dist/components/core/icons/index.js +3 -1
  44. package/dist/components/core/index.js +71 -27
  45. package/dist/components/core/inputs/DatePicker.js +46 -0
  46. package/dist/components/core/inputs/DateRangePicker.js +92 -0
  47. package/dist/{inputs-CBojnClc.js → components/core/inputs/FileDropzone.js} +8 -37
  48. package/dist/{ImageInput-BeIOm3GY.js → components/core/inputs/ImageInput.js} +5 -5
  49. package/dist/components/core/inputs/MultiSelect.js +191 -0
  50. package/dist/components/core/inputs/RatingInput.js +36 -0
  51. package/dist/{SearchInput-IT_Rvthr.js → components/core/inputs/SearchInput.js} +4 -4
  52. package/dist/components/core/inputs/SingleSelect.js +198 -0
  53. package/dist/components/core/inputs/index.js +9 -6
  54. package/dist/components/core/inputs/select.helper.js +46 -0
  55. package/dist/{language-DY0EYabh.js → components/core/language/LanguageSelector.js} +13 -12
  56. package/dist/components/core/language/index.js +1 -1
  57. package/dist/{AppActions-8HjAaTQK.js → components/core/layouts/AppActions.js} +19 -19
  58. package/dist/components/core/layouts/AppPageHeader.js +44 -0
  59. package/dist/{AppSubTitle-DI62BaaB.js → components/core/layouts/AppSubTitle.js} +3 -3
  60. package/dist/{AppTitle-BXoTrXQc.js → components/core/layouts/AppTitle.js} +3 -3
  61. package/dist/components/core/layouts/KpiCardsLayout.js +8 -0
  62. package/dist/components/core/layouts/index.js +6 -50
  63. package/dist/components/core/markdown/AppMarkdown.js +134 -0
  64. package/dist/components/core/markdown/AppMarkdownHeading.js +45 -0
  65. package/dist/components/core/markdown/index.js +1 -1
  66. package/dist/components/core/navbar/GlobalSearch.js +128 -0
  67. package/dist/components/core/navbar/NotificationsBell.js +133 -0
  68. package/dist/components/core/navbar/Sidebar.js +99 -0
  69. package/dist/components/core/navbar/SidebarHeader.js +26 -0
  70. package/dist/components/core/navbar/SidebarNavItem.js +72 -0
  71. package/dist/components/core/navbar/Topbar.js +25 -0
  72. package/dist/components/core/navbar/index.js +7 -1
  73. package/dist/{ErrorAlert-cJnfBL8H.js → components/core/states/ErrorAlert.js} +5 -5
  74. package/dist/{states-CJ8xE_Nm.js → components/core/states/ErrorState.js} +4 -11
  75. package/dist/components/core/states/LoadingState.js +12 -0
  76. package/dist/components/core/states/index.js +3 -2
  77. package/dist/components/core/table/DataTable.js +108 -0
  78. package/dist/components/core/table/JsonTableOutput.js +75 -0
  79. package/dist/components/core/table/TableActions.js +75 -0
  80. package/dist/components/core/table/TableBody.js +130 -0
  81. package/dist/components/core/table/TableBulkActions.js +47 -0
  82. package/dist/components/core/table/TableHeader.js +103 -0
  83. package/dist/components/core/table/TablePagination.js +102 -0
  84. package/dist/components/core/table/TableSettings.js +117 -0
  85. package/dist/components/core/table/index.js +9 -709
  86. package/dist/components/core/tabs/AppTabContainer.js +17 -0
  87. package/dist/components/core/tabs/AppTabHeader.js +19 -0
  88. package/dist/components/core/tabs/AppTabs.js +56 -0
  89. package/dist/components/core/tabs/AppVerticalTabs.js +105 -0
  90. package/dist/components/core/tabs/index.js +5 -188
  91. package/dist/{theme-DSumNHLX.js → components/core/theme/ThemeSelector.js} +13 -12
  92. package/dist/components/core/theme/index.js +1 -1
  93. package/dist/components/index.js +117 -34
  94. package/dist/components/ui/accordion.js +34 -0
  95. package/dist/components/ui/alert-dialog.js +54 -0
  96. package/dist/{alert-REQGK9bR.js → components/ui/alert.js} +2 -2
  97. package/dist/components/ui/aspect-ratio.js +5 -0
  98. package/dist/components/ui/avatar.js +25 -0
  99. package/dist/components/ui/badge.js +22 -0
  100. package/dist/components/ui/breadcrumb.js +60 -0
  101. package/dist/{tooltip-_geGvbS7.js → components/ui/button.js} +7 -17
  102. package/dist/components/ui/calendar.js +44 -0
  103. package/dist/components/ui/card.js +42 -0
  104. package/dist/components/ui/carousel.js +115 -0
  105. package/dist/{chart-wW-fwL3s.js → components/ui/chart.js} +51 -89
  106. package/dist/components/ui/checkbox.js +31 -0
  107. package/dist/components/ui/collapsible.js +5 -0
  108. package/dist/components/ui/command.js +84 -0
  109. package/dist/components/ui/context-menu.js +71 -0
  110. package/dist/components/ui/control.js +5 -0
  111. package/dist/components/ui/dialog.js +49 -0
  112. package/dist/components/ui/drawer.js +47 -0
  113. package/dist/components/ui/dropdown-menu.js +72 -0
  114. package/dist/components/ui/form.js +78 -0
  115. package/dist/components/ui/hover-card.js +15 -0
  116. package/dist/components/ui/index.js +49 -9
  117. package/dist/components/ui/input-otp.js +41 -0
  118. package/dist/components/ui/input.js +14 -0
  119. package/dist/components/ui/label.js +14 -0
  120. package/dist/components/ui/menubar.js +86 -0
  121. package/dist/components/ui/navigation-menu.js +58 -0
  122. package/dist/components/ui/pagination.js +62 -0
  123. package/dist/components/ui/popover.js +15 -0
  124. package/dist/components/ui/progress.js +17 -0
  125. package/dist/components/ui/radio-group.js +24 -0
  126. package/dist/components/ui/resizable.js +18 -0
  127. package/dist/components/ui/scroll-area.js +29 -0
  128. package/dist/{select-KWMg2_7Z.js → components/ui/select.js} +3 -3
  129. package/dist/components/ui/separator.js +15 -0
  130. package/dist/components/ui/sheet.js +58 -0
  131. package/dist/components/ui/simple-table.js +57 -0
  132. package/dist/{skeleton-D6Ga4BLw.js → components/ui/skeleton.js} +2 -2
  133. package/dist/components/ui/slider.js +17 -0
  134. package/dist/components/ui/sonner.js +23 -0
  135. package/dist/components/ui/switch.js +14 -0
  136. package/dist/components/ui/tabs.js +58 -0
  137. package/dist/components/ui/textarea.js +12 -0
  138. package/dist/components/ui/toast.js +53 -0
  139. package/dist/components/ui/toaster.js +22 -0
  140. package/dist/components/ui/toggle-group.js +37 -0
  141. package/dist/components/ui/toggle.js +34 -0
  142. package/dist/components/ui/tooltip.js +14 -0
  143. package/dist/{datatable-COQcYUrk.js → constants/datatable.js} +1 -1
  144. package/dist/constants/index.js +3 -5
  145. package/dist/constants/search.js +4 -0
  146. package/dist/contexts/index.js +3 -1
  147. package/dist/{sidebar.context-BahtU6hE.js → contexts/page.context.js} +2 -2
  148. package/dist/contexts/sidebar.context.js +5 -0
  149. package/dist/helpers/changelog.helper.js +69 -0
  150. package/dist/helpers/index.js +6 -166
  151. package/dist/{markdown.helper-YJE2H5KQ.js → helpers/markdown.helper.js} +1 -1
  152. package/dist/helpers/supabase.helper.js +41 -0
  153. package/dist/helpers/table.helper.js +56 -0
  154. package/dist/{tailwind.helper-CJaRYBmL.js → helpers/tailwind.helper.js} +1 -1
  155. package/dist/hooks/behavior/index.js +10 -1
  156. package/dist/hooks/behavior/useConfirmDeleteDialog.js +21 -0
  157. package/dist/hooks/behavior/useConfirmationDialog.js +23 -0
  158. package/dist/hooks/behavior/useDebounce.js +14 -0
  159. package/dist/hooks/behavior/useDebouncedValue.js +15 -0
  160. package/dist/hooks/behavior/useDialog.js +21 -0
  161. package/dist/hooks/behavior/usePage.js +10 -0
  162. package/dist/hooks/behavior/useSidebar.js +10 -0
  163. package/dist/hooks/behavior/useTable.js +83 -0
  164. package/dist/hooks/behavior/useUrlState.js +46 -0
  165. package/dist/hooks/index.js +20 -11
  166. package/dist/hooks/ui/index.js +11 -10
  167. package/dist/{useFixedColumns-Bo-Az3Hp.js → hooks/ui/useDataTable.js} +16 -52
  168. package/dist/{useDocumentTitle-VoQkict_.js → hooks/ui/useDocumentTitle.js} +2 -2
  169. package/dist/hooks/ui/useFixedColumns.js +38 -0
  170. package/dist/{useLanguage-DRnSb5H1.js → hooks/ui/useLanguage.js} +3 -3
  171. package/dist/{useMobile-pTQ8lWvt.js → hooks/ui/useMobile.js} +1 -1
  172. package/dist/{useNotifications-CyhTruIG.js → hooks/ui/useNotifications.js} +2 -2
  173. package/dist/{useScrollFade-D9kqJBDh.js → hooks/ui/useScrollFade.js} +1 -1
  174. package/dist/{ui-nQGnCss1.js → hooks/ui/useServerTable.js} +2 -2
  175. package/dist/{useTheme-DIZjiF5F.js → hooks/ui/useTheme.js} +3 -3
  176. package/dist/{useToast-UeDRLovh.js → hooks/ui/useToast.js} +1 -1
  177. package/dist/i18n/index.js +4 -1
  178. package/dist/i18n/krosoftLocales.js +13 -0
  179. package/dist/i18n/useDateFnsLocale.js +13 -0
  180. package/dist/i18n/useKrosoftTranslation.js +13 -0
  181. package/dist/locales/en.json.js +174 -0
  182. package/dist/locales/fr.json.js +174 -0
  183. package/dist/providers/SidebarProvider.js +42 -0
  184. package/dist/providers/index.js +1 -42
  185. package/dist/pwa/PwaUpdater.js +30 -0
  186. package/dist/pwa/index.js +3 -50
  187. package/dist/pwa/pwaUpdateToast.js +25 -0
  188. package/dist/seasonal/EffectSwitch.js +24 -0
  189. package/dist/seasonal/EmojiSnowfall.js +24 -0
  190. package/dist/seasonal/HalloweenEffect.js +17 -0
  191. package/dist/seasonal/SeasonalEffects.js +8 -0
  192. package/dist/seasonal/SeasonalEffectsSettings.js +35 -0
  193. package/dist/seasonal/SnowEffect.js +12 -0
  194. package/dist/seasonal/index.js +7 -120
  195. package/dist/seasonal/overlayStyle.js +12 -0
  196. package/dist/seasonal/seasons.js +7 -0
  197. package/dist/seasonal/useSeasonalEffects.js +20 -0
  198. package/dist/seasonal/useStoredToggle.js +21 -0
  199. package/dist/tailwind/index.js +7 -53
  200. package/dist/tokens/apply.js +16 -0
  201. package/dist/tokens/index.js +3 -38
  202. package/dist/tokens/radius.js +26 -0
  203. package/dist/types/index.js +0 -1
  204. package/dist/vendor/tailwindcss/lib/public/create-plugin.js +19 -0
  205. package/dist/vendor/tailwindcss/lib/util/createPlugin.js +30 -0
  206. package/dist/vendor/tailwindcss/plugin.js +10 -0
  207. package/package.json +4 -4
  208. package/dist/AppMarkdown-CAxm82x0.js +0 -171
  209. package/dist/MultiSelect-DPN046kI.js +0 -228
  210. package/dist/SingleSelect-DLY5WylQ.js +0 -313
  211. package/dist/behavior-B0BYivtN.js +0 -201
  212. package/dist/cards-DPzVebUM.js +0 -132
  213. package/dist/changelog-DyPFIscf.js +0 -257
  214. package/dist/charts-C7rKxkli.js +0 -342
  215. package/dist/dialogs-CG9Q7pqY.js +0 -269
  216. package/dist/i18n-BhLphJa3.js +0 -364
  217. package/dist/navbar-DD0V0pNE.js +0 -432
  218. package/dist/sheet-cWJO_wkT.js +0 -225
  219. package/dist/switch-DspImmo_.js +0 -24
  220. package/dist/ui-Fxy95kSJ.js +0 -1163
@@ -1,313 +0,0 @@
1
- import { t as e } from "./tailwind.helper-CJaRYBmL.js";
2
- import { r as t, t as n } from "./i18n-BhLphJa3.js";
3
- import { wn as r } from "./ui-Fxy95kSJ.js";
4
- import { c as i, o as a, s as o } from "./tooltip-_geGvbS7.js";
5
- import { h as s, m as c, p as l } from "./sheet-cWJO_wkT.js";
6
- import { i as u, l as d, n as f, t as p, u as m } from "./select-KWMg2_7Z.js";
7
- import { n as h, r as g } from "./MultiSelect-DPN046kI.js";
8
- import * as _ from "react";
9
- import { useEffect as v, useMemo as y, useRef as b, useState as x } from "react";
10
- import { jsx as S, jsxs as C } from "react/jsx-runtime";
11
- import { CalendarIcon as w, CheckIcon as T, ChevronDownIcon as ee, PlusIcon as te, SearchIcon as E, XIcon as D } from "lucide-react";
12
- import { Command as O } from "cmdk";
13
- import { format as k } from "date-fns";
14
- //#region src/components/core/inputs/DatePicker.tsx
15
- var A = ({ date: n, onDateChange: a, placeholder: o }) => {
16
- let s = t(), [c, l] = x(!1), u = b(null);
17
- return v(() => {
18
- if (!c) return;
19
- let e = (e) => {
20
- u.current !== null && !u.current.contains(e.target) && l(!1);
21
- };
22
- return document.addEventListener("mousedown", e), () => {
23
- document.removeEventListener("mousedown", e);
24
- };
25
- }, [c]), /* @__PURE__ */ C("div", {
26
- ref: u,
27
- className: "relative w-full",
28
- children: [/* @__PURE__ */ C(i, {
29
- variant: "outline",
30
- type: "button",
31
- onClick: () => {
32
- l((e) => !e);
33
- },
34
- className: e("w-full justify-start text-left font-normal focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", c && "ring-2 ring-ring ring-offset-2", n === void 0 && "text-muted-foreground"),
35
- children: [/* @__PURE__ */ S(w, { className: "mr-2 size-4 shrink-0" }), n === void 0 ? /* @__PURE__ */ S("span", { children: o }) : k(n, "dd/MM/yyyy", { locale: s })]
36
- }), c ? /* @__PURE__ */ S("div", {
37
- className: "absolute left-0 top-[calc(100%+4px)] z-[100] rounded-surface border bg-popover text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 slide-in-from-top-2",
38
- children: /* @__PURE__ */ S(r, {
39
- mode: "single",
40
- locale: s,
41
- defaultMonth: n,
42
- selected: n,
43
- onSelect: (e) => {
44
- a(e), l(!1);
45
- }
46
- })
47
- }) : null]
48
- });
49
- }, j = (e) => e ? {
50
- from: e.from,
51
- to: e.to
52
- } : void 0, M = ({ value: a, onChange: o, placeholder: u, className: d }) => {
53
- let { t: f } = n(), p = t(), [m, h] = _.useState(!1), [g, v] = _.useState(j(a));
54
- return _.useEffect(() => {
55
- m && v(j(a));
56
- }, [m, a]), /* @__PURE__ */ S("div", {
57
- className: e("grid gap-2", d),
58
- children: /* @__PURE__ */ C(l, {
59
- open: m,
60
- onOpenChange: h,
61
- children: [/* @__PURE__ */ S(s, {
62
- asChild: !0,
63
- children: /* @__PURE__ */ C(i, {
64
- id: "date",
65
- variant: "outline",
66
- className: e("w-[300px] justify-start text-left font-normal", !a?.from && "text-muted-foreground"),
67
- children: [
68
- /* @__PURE__ */ S(w, { className: "mr-2 size-4" }),
69
- ((e) => e?.from ? !e.to || e.from.getTime() === e.to.getTime() ? k(e.from, "dd MMM yyyy", { locale: p }) : `${k(e.from, "dd MMM yyyy", { locale: p })} - ${k(e.to, "dd MMM yyyy", { locale: p })}` : u ?? f("date.pickPeriod"))(a),
70
- a?.from && /* @__PURE__ */ S(i, {
71
- type: "button",
72
- variant: "ghost",
73
- size: "icon",
74
- "aria-label": f("date.clearPeriod"),
75
- className: "ml-auto h-5 w-5 opacity-50 hover:opacity-100",
76
- onClick: (e) => {
77
- e.stopPropagation(), o(void 0), h(!1);
78
- },
79
- children: /* @__PURE__ */ S(D, { className: "size-4" })
80
- })
81
- ]
82
- })
83
- }), /* @__PURE__ */ C(c, {
84
- className: "w-auto p-0",
85
- align: "start",
86
- side: "bottom",
87
- sideOffset: 4,
88
- children: [/* @__PURE__ */ S(r, {
89
- mode: "range",
90
- resetOnSelect: !0,
91
- defaultMonth: g?.from,
92
- selected: g,
93
- onSelect: v,
94
- numberOfMonths: 2,
95
- locale: p,
96
- className: "pointer-events-auto p-3"
97
- }), /* @__PURE__ */ C("div", {
98
- className: "flex items-center justify-between border-t border-border px-3 py-2",
99
- children: [/* @__PURE__ */ S(i, {
100
- variant: "ghost",
101
- size: "sm",
102
- onClick: () => {
103
- v(void 0);
104
- },
105
- children: f("actions.clear")
106
- }), /* @__PURE__ */ C("div", {
107
- className: "flex gap-2",
108
- children: [/* @__PURE__ */ S(i, {
109
- variant: "ghost",
110
- size: "sm",
111
- onClick: () => {
112
- v(j(a)), h(!1);
113
- },
114
- children: f("actions.cancel")
115
- }), /* @__PURE__ */ S(i, {
116
- size: "sm",
117
- onClick: () => {
118
- o(g), h(!1);
119
- },
120
- children: f("actions.apply")
121
- })]
122
- })]
123
- })]
124
- })]
125
- })
126
- });
127
- }, N = ({ options: t = [], value: r, onChange: i, onClear: _, searchable: v = !1, onCreate: b, placeholder: w, searchPlaceholder: k, emptyLabel: A, createLabel: j, disabled: M = !1, modal: N = !0, variant: P = "input", className: F, ...I }) => {
128
- let { t: L } = n(), [R, z] = x(!1), [B, V] = x(""), H = P === "filter" ? a : void 0, U = r !== void 0 && r !== "", W = y(() => U ? t.find((e) => e.value === r) : void 0, [
129
- U,
130
- t,
131
- r
132
- ]), G = U ? W?.label ?? r : void 0, K = B.trim(), q = y(() => {
133
- if (K === "") return t;
134
- let e = K.toLowerCase();
135
- return t.filter((t) => `${t.label} ${t.description ?? ""}`.toLowerCase().includes(e));
136
- }, [t, K]), { listRef: ne, virtualized: J, startIndex: re, endIndex: ie, padTop: Y, padBottom: X, onScroll: ae, resetScroll: Z } = g(R, q.length, t.some((e) => e.imageUrl !== void 0)), oe = J ? q.slice(re, ie) : q;
137
- if (!v) return /* @__PURE__ */ C(p, {
138
- value: r ?? "",
139
- onValueChange: i,
140
- disabled: M,
141
- children: [/* @__PURE__ */ S(d, {
142
- ...I,
143
- className: e(!U && "text-muted-foreground", H, F),
144
- onClear: _ !== void 0 && U && !M ? (e) => {
145
- e.preventDefault(), e.stopPropagation(), _();
146
- } : void 0,
147
- children: /* @__PURE__ */ S(m, { placeholder: w ?? L("select.placeholder") })
148
- }), /* @__PURE__ */ S(f, { children: t.map((e) => /* @__PURE__ */ S(u, {
149
- value: e.value,
150
- disabled: e.disabled,
151
- children: /* @__PURE__ */ C("span", {
152
- className: "flex items-center",
153
- children: [
154
- h(e.imageUrl, "mr-2"),
155
- e.color !== void 0 && /* @__PURE__ */ S("span", {
156
- className: "mr-2 size-2.5 shrink-0 rounded-full",
157
- style: { backgroundColor: e.color }
158
- }),
159
- e.label,
160
- e.description !== void 0 && /* @__PURE__ */ C("span", {
161
- className: "ml-1 text-muted-foreground",
162
- children: [
163
- "(",
164
- e.description,
165
- ")"
166
- ]
167
- })
168
- ]
169
- })
170
- }, e.value)) })]
171
- });
172
- let Q = b !== void 0 && K !== "" && !t.some((e) => e.label.toLowerCase() === K.toLowerCase()), $ = (e) => {
173
- z(e), e ? Z() : V("");
174
- }, se = (e) => {
175
- V(e), Z();
176
- }, ce = (e) => {
177
- i(e), $(!1);
178
- }, le = () => {
179
- b?.(K), $(!1);
180
- };
181
- return /* @__PURE__ */ C(l, {
182
- open: R,
183
- onOpenChange: $,
184
- modal: N,
185
- children: [/* @__PURE__ */ S(s, {
186
- asChild: !0,
187
- children: /* @__PURE__ */ C("button", {
188
- ...I,
189
- type: "button",
190
- role: "combobox",
191
- "aria-expanded": R,
192
- disabled: M,
193
- className: e(o, "w-full", H, "data-[state=open]:ring-2 data-[state=open]:ring-ring data-[state=open]:ring-offset-2", !U && "text-muted-foreground", F),
194
- children: [/* @__PURE__ */ C("div", {
195
- className: "flex min-w-0 items-center truncate",
196
- children: [
197
- h(W?.imageUrl, "mr-2 h-6 w-8"),
198
- W?.color && /* @__PURE__ */ S("span", {
199
- className: "mr-2 size-2.5 shrink-0 rounded-full",
200
- style: { backgroundColor: W.color }
201
- }),
202
- /* @__PURE__ */ S("span", {
203
- className: "truncate",
204
- children: G ?? w ?? L("select.placeholder")
205
- }),
206
- W?.description !== void 0 && /* @__PURE__ */ C("span", {
207
- className: "ml-1 truncate text-muted-foreground",
208
- children: [
209
- "(",
210
- W.description,
211
- ")"
212
- ]
213
- })
214
- ]
215
- }), /* @__PURE__ */ C("div", {
216
- className: "flex items-center gap-1",
217
- children: [_ && U && !M && /* @__PURE__ */ S("span", {
218
- role: "button",
219
- tabIndex: -1,
220
- onClick: (e) => {
221
- e.stopPropagation();
222
- },
223
- onPointerDown: (e) => {
224
- e.preventDefault(), e.stopPropagation(), _();
225
- },
226
- className: "text-muted-foreground hover:text-foreground",
227
- children: /* @__PURE__ */ S(D, { className: "size-4" })
228
- }), /* @__PURE__ */ S(ee, { className: e("size-4 shrink-0 opacity-50 transition-transform", R && "rotate-180") })]
229
- })]
230
- })
231
- }), /* @__PURE__ */ S(c, {
232
- className: "w-[var(--radix-popover-trigger-width)] p-0",
233
- align: "start",
234
- children: /* @__PURE__ */ C(O, {
235
- shouldFilter: !1,
236
- className: "flex flex-col",
237
- children: [/* @__PURE__ */ S("div", {
238
- className: "border-b border-border p-2",
239
- children: /* @__PURE__ */ C("div", {
240
- className: "relative",
241
- children: [/* @__PURE__ */ S(E, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }), /* @__PURE__ */ S(O.Input, {
242
- value: B,
243
- onValueChange: se,
244
- placeholder: k ?? L("search.placeholder"),
245
- className: "w-full rounded-control bg-muted/50 py-1.5 pl-7 pr-2 text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring",
246
- autoFocus: !0
247
- })]
248
- })
249
- }), /* @__PURE__ */ C(O.List, {
250
- ref: ne,
251
- onScroll: ae,
252
- className: e("flex flex-col max-h-56 overflow-y-auto overflow-x-hidden p-1.5 scrollbar-thin scrollbar-thumb-rounded scrollbar-thumb-muted-foreground/20 scrollbar-track-transparent [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-muted-foreground/20 [&::-webkit-scrollbar-track]:bg-transparent", !J && "gap-0.5"),
253
- children: [
254
- q.length === 0 && !Q && /* @__PURE__ */ S("div", {
255
- className: "px-2 py-3 text-center text-xs text-muted-foreground",
256
- children: A ?? L("states.noResult")
257
- }),
258
- Y > 0 && /* @__PURE__ */ S("div", {
259
- "aria-hidden": !0,
260
- style: { height: Y }
261
- }),
262
- oe.map((t) => /* @__PURE__ */ C(O.Item, {
263
- value: t.value,
264
- keywords: [t.label, t.description ?? ""],
265
- disabled: t.disabled,
266
- onSelect: () => {
267
- ce(t.value);
268
- },
269
- className: "flex min-w-0 items-center gap-2 rounded-md px-2 py-2 text-sm cursor-pointer transition-colors data-[selected=true]:bg-muted data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-50",
270
- children: [
271
- h(t.imageUrl),
272
- t.color && /* @__PURE__ */ S("span", {
273
- className: "size-2.5 shrink-0 rounded-full",
274
- style: { backgroundColor: t.color }
275
- }),
276
- /* @__PURE__ */ S("span", {
277
- className: "min-w-0 flex-1 truncate",
278
- title: t.label,
279
- children: t.label
280
- }),
281
- t.description !== void 0 && /* @__PURE__ */ C("span", {
282
- className: "shrink-0 truncate text-muted-foreground",
283
- children: [
284
- "(",
285
- t.description,
286
- ")"
287
- ]
288
- }),
289
- /* @__PURE__ */ S(T, { className: e("ml-auto size-4 shrink-0", r === t.value ? "opacity-100" : "opacity-0") })
290
- ]
291
- }, t.value)),
292
- X > 0 && /* @__PURE__ */ S("div", {
293
- "aria-hidden": !0,
294
- style: { height: X }
295
- }),
296
- Q && /* @__PURE__ */ C(O.Item, {
297
- forceMount: !0,
298
- value: "__create__",
299
- onSelect: le,
300
- className: "flex min-w-0 items-center gap-2.5 rounded-md px-2 py-2 text-sm cursor-pointer transition-colors data-[selected=true]:bg-muted",
301
- children: [/* @__PURE__ */ S(te, { className: "size-4 shrink-0" }), /* @__PURE__ */ S("span", {
302
- className: "truncate",
303
- children: j ? j(K) : L("select.create", { search: K })
304
- })]
305
- })
306
- ]
307
- })]
308
- })
309
- })]
310
- });
311
- };
312
- //#endregion
313
- export { M as n, A as r, N as t };
@@ -1,201 +0,0 @@
1
- import { t as e } from "./i18n-BhLphJa3.js";
2
- import { n as t } from "./datatable-COQcYUrk.js";
3
- import "./constants/index.js";
4
- import { n, t as r } from "./sidebar.context-BahtU6hE.js";
5
- import * as i from "react";
6
- import { useCallback as a, useContext as o, useEffect as s, useMemo as c, useRef as l, useState as u } from "react";
7
- import { TrashIcon as d } from "lucide-react";
8
- import { useSearchParams as f } from "react-router-dom";
9
- import { format as p, parse as m } from "date-fns";
10
- import { useQuery as h } from "@tanstack/react-query";
11
- //#region src/hooks/behavior/useDialog.ts
12
- var g = (e) => {
13
- let [t, n] = u(null);
14
- return {
15
- id: t?.id ?? null,
16
- name: t?.name ?? null,
17
- isOpen: !!t,
18
- openDialog: (t, r) => {
19
- e?.onReset?.(), n({
20
- id: t,
21
- name: r
22
- });
23
- },
24
- onClose: () => {
25
- n(null);
26
- }
27
- };
28
- }, _ = ({ titleKey: e, descriptionKey: t, confirmKey: n = "Confirmer", onConfirm: r, onReset: i }) => {
29
- let a = g({ onReset: i });
30
- return {
31
- isOpen: a.isOpen,
32
- itemName: a.name,
33
- title: e,
34
- description: t,
35
- confirmKey: n,
36
- openDialog: a.openDialog,
37
- onClose: a.onClose,
38
- onConfirm: async () => {
39
- if (a.id) try {
40
- await r(a.id), a.onClose();
41
- } catch (e) {
42
- console.error("Error confirming action:", e);
43
- }
44
- }
45
- };
46
- }, v = ({ titleKey: t, descriptionKey: n, confirmKey: r, onConfirm: i, onReset: a }) => {
47
- let { t: o } = e();
48
- return {
49
- ..._({
50
- titleKey: t,
51
- descriptionKey: n,
52
- confirmKey: r ?? o("actions.delete"),
53
- onConfirm: i,
54
- onReset: a
55
- }),
56
- loadingKey: "actions.deleting",
57
- icon: d,
58
- titleClassName: "flex items-center gap-2 text-destructive"
59
- };
60
- }, y = (e, t) => {
61
- let [n, r] = u(e), i = l(void 0);
62
- return s(() => (i.current = setTimeout(() => {
63
- r(e);
64
- }, t), () => {
65
- clearTimeout(i.current);
66
- }), [e, t]), [n, a((e) => {
67
- clearTimeout(i.current), r(e);
68
- }, [])];
69
- }, b = (e, t = 250) => {
70
- let [n, r] = i.useState(e);
71
- return i.useEffect(() => {
72
- let n = setTimeout(() => {
73
- r(e);
74
- }, t);
75
- return () => {
76
- clearTimeout(n);
77
- };
78
- }, [e, t]), n;
79
- }, x = () => {
80
- let e = o(n);
81
- if (e === void 0) throw Error("usePage must be used within an PageProvider");
82
- return e;
83
- }, S = () => {
84
- let e = o(r);
85
- if (e === void 0) throw Error("useSidebar must be used within a SidebarProvider");
86
- return e;
87
- }, C = ({ queryKey: e, queryFn: n, defaultSortField: r = "", defaultSortDirection: i = "asc", defaultPageSize: o = t, additionalQueryParams: d = {}, resetUrlParams: p = [], onResetFilters: m = () => {}, enabled: g = !0 }) => {
88
- let [_, v] = f(), b = parseInt(_.get("page") || "1", 10), x = _.get("search") || "", S = _.get("sortField") || r, C = _.get("sortDirection") || i, [w, T] = u(b), [E, D] = u(o), O = a((e) => {
89
- D(e), T(1);
90
- }, []), [k, A] = u(x), [j, M] = u(S), [N, P] = u(C), [F, I] = y(k, 300), L = l(F);
91
- s(() => {
92
- L.current !== F && w !== 1 && T(1), L.current = F;
93
- }, [F, w]), s(() => {
94
- v((e) => (w === 1 ? e.delete("page") : e.set("page", w.toString()), F.trim() ? e.set("search", F.trim()) : e.delete("search"), j && j !== r ? e.set("sortField", j) : e.delete("sortField"), N === i ? e.delete("sortDirection") : e.set("sortDirection", N), e), { replace: !0 });
95
- }, [
96
- w,
97
- F,
98
- j,
99
- N,
100
- r,
101
- i,
102
- v
103
- ]);
104
- let R = c(() => ({
105
- pageNumber: w,
106
- pageSize: E,
107
- text: F.trim() || void 0,
108
- ...d
109
- }), [
110
- w,
111
- E,
112
- F,
113
- d
114
- ]), z = c(() => j ? [{
115
- key: j,
116
- order: N
117
- }] : [], [j, N]), B = a((e) => {
118
- e && (j === e ? P(N === "asc" ? "desc" : "asc") : (M(e), P("asc")));
119
- }, [j, N]), V = a(() => {
120
- A(""), I(""), T(1), M(r), P(i), v((e) => (e.delete("page"), e.delete("search"), e.delete("sortField"), e.delete("sortDirection"), p.forEach((t) => {
121
- e.delete(t);
122
- }), e), { replace: !0 }), m();
123
- }, [
124
- r,
125
- i,
126
- I,
127
- v,
128
- p,
129
- m
130
- ]), H = c(() => [
131
- ...e,
132
- R,
133
- z
134
- ], [
135
- e,
136
- R,
137
- z
138
- ]), { data: U, isLoading: W, error: G, refetch: K } = h({
139
- queryKey: H,
140
- queryFn: () => n(R, z),
141
- enabled: g
142
- });
143
- return {
144
- paginationResult: U,
145
- isLoading: W,
146
- error: G,
147
- refetch: K,
148
- pageNumber: w,
149
- pageSize: E,
150
- setPageNumber: T,
151
- setPageSize: O,
152
- search: k,
153
- debouncedSearch: F,
154
- setSearch: A,
155
- sortField: j,
156
- sortDirection: N,
157
- handleSort: B,
158
- resetFilters: V
159
- };
160
- }, w = "yyyy-MM-dd";
161
- function T(e, t, n, r) {
162
- let [i, o] = f(), s = i.get(e), c;
163
- c = s === null ? t : n ? n(s) : s;
164
- let l = a((n) => {
165
- o((i) => {
166
- let a = r ? r(n) : String(n);
167
- return a === (r ? r(t) : String(t)) || a === "" || a === "undefined" ? i.delete(e) : i.set(e, a), i;
168
- }, { replace: !0 });
169
- }, [
170
- e,
171
- t,
172
- r,
173
- o
174
- ]);
175
- return [c, l];
176
- }
177
- function E(e, t = []) {
178
- return T(e, t, (e) => e ? e.split(",").filter(Boolean) : [], (e) => e.join(","));
179
- }
180
- function D(e, t) {
181
- return T(e, t, (e) => parseInt(e, 10) || t, (e) => e.toString());
182
- }
183
- var O = (e) => {
184
- if (!e) return;
185
- let [t, n] = e.split("_"), r = t ? m(t, w, /* @__PURE__ */ new Date()) : void 0;
186
- if (!r || isNaN(r.getTime())) return;
187
- let i = n ? m(n, w, /* @__PURE__ */ new Date()) : void 0;
188
- return {
189
- from: r,
190
- to: i && !isNaN(i.getTime()) ? i : void 0
191
- };
192
- }, k = (e) => {
193
- if (!e?.from) return "";
194
- let t = p(e.from, w), n = e.to ? p(e.to, w) : "";
195
- return n ? `${t}_${n}` : t;
196
- };
197
- function A(e) {
198
- return T(e, void 0, O, k);
199
- }
200
- //#endregion
201
- export { A as a, C as c, b as d, y as f, g as h, E as i, S as l, _ as m, O as n, D as o, v as p, k as r, T as s, w as t, x as u };
@@ -1,132 +0,0 @@
1
- import { t as e } from "./tailwind.helper-CJaRYBmL.js";
2
- import { c as t, d as n, f as r, s as i } from "./chart-wW-fwL3s.js";
3
- import { t as a } from "./i18n-BhLphJa3.js";
4
- import { t as o } from "./skeleton-D6Ga4BLw.js";
5
- import "react";
6
- import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
7
- import { formatNumber as u } from "@krosoft/core/helpers";
8
- //#region src/components/core/cards/DashboardCard.tsx
9
- var d = ({ titleKey: o, icon: s, className: u, children: d }) => {
10
- let { t: f } = a();
11
- return /* @__PURE__ */ l(i, {
12
- className: e("bg-gray-50 dark:bg-gray-950", u),
13
- children: [/* @__PURE__ */ c(n, { children: /* @__PURE__ */ l(r, {
14
- className: "flex items-center gap-2",
15
- children: [s && /* @__PURE__ */ c(s, { className: "mr-2 size-4" }), /* @__PURE__ */ c("span", { children: f(o) })]
16
- }) }), /* @__PURE__ */ c(t, { children: d })]
17
- });
18
- }, f = ({ titleKey: d, value: f, valueClassName: p, icon: m, iconClassName: h, description: g, descriptionClassName: _, onClick: v, isLoading: y, error: b }) => {
19
- let { t: x } = a();
20
- return /* @__PURE__ */ l(i, {
21
- className: e(v === void 0 ? "" : "hover:border-primary cursor-pointer"),
22
- onClick: v,
23
- children: [/* @__PURE__ */ l(n, {
24
- className: "flex flex-row items-center justify-between space-y-0 pb-2",
25
- children: [/* @__PURE__ */ c(r, {
26
- className: "text-sm font-medium",
27
- children: x(d)
28
- }), /* @__PURE__ */ c(m, { className: e("size-6 text-muted-foreground", h) })]
29
- }), /* @__PURE__ */ c(t, { children: y ? /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c(o, { className: "h-8 w-24 mb-1" }), /* @__PURE__ */ c(o, { className: "h-3 w-32" })] }) : b ? /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c("div", {
30
- className: "text-2xl font-bold text-destructive",
31
- children: "—"
32
- }), /* @__PURE__ */ c("p", {
33
- className: "text-xs text-destructive",
34
- children: b
35
- })] }) : /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c("div", {
36
- className: e("text-2xl font-bold", p),
37
- children: typeof f == "number" ? u(f) : f instanceof Date ? f.toLocaleDateString() : f
38
- }), /* @__PURE__ */ c("p", {
39
- className: e("text-xs text-muted-foreground", _),
40
- children: g
41
- })] }) })]
42
- });
43
- }, p = {
44
- 1: "lg:grid-cols-1",
45
- 2: "lg:grid-cols-2",
46
- 3: "lg:grid-cols-3",
47
- 4: "lg:grid-cols-4",
48
- 5: "lg:grid-cols-5",
49
- 6: "lg:grid-cols-6"
50
- }, m = 4, h = ({ stats: t, columns: n = m, isLoading: r, error: i }) => /* @__PURE__ */ c("div", {
51
- className: e("grid gap-4 md:grid-cols-2", p[n] ?? p[m]),
52
- children: t.map((e) => /* @__PURE__ */ c(f, {
53
- titleKey: e.titleKey,
54
- value: e.value,
55
- valueClassName: e.valueClassName,
56
- icon: e.icon,
57
- iconClassName: e.iconClassName,
58
- description: e.description,
59
- descriptionClassName: e.descriptionClassName,
60
- onClick: e.onClick,
61
- isLoading: r,
62
- error: i
63
- }, e.titleKey))
64
- }), g = {
65
- blue: "bg-gradient-to-br from-blue-500 to-cyan-500 text-white",
66
- green: "bg-gradient-to-br from-green-500 to-emerald-500 text-white",
67
- orange: "bg-gradient-to-br from-orange-500 to-yellow-500 text-white",
68
- red: "bg-gradient-to-br from-red-500 to-pink-500 text-white",
69
- purple: "bg-gradient-to-br from-purple-500 to-indigo-500 text-white",
70
- accent: "bg-accent/10 text-accent",
71
- success: "bg-success/10 text-success",
72
- info: "bg-info/10 text-info",
73
- warning: "bg-warning/10 text-warning",
74
- destructive: "bg-destructive/10 text-destructive"
75
- }, _ = {
76
- sm: "size-4",
77
- md: "size-5",
78
- lg: "size-6"
79
- }, v = (e) => e === "up" ? "↑" : e === "down" ? "↓" : "", y = (e) => e === "up" ? "text-green-600" : e === "down" ? "text-red-600" : "text-muted-foreground", b = ({ title: e, value: n, unit: a, subtitle: o, icon: s, iconSize: u = "md", trend: d, trendValue: f, color: p = "blue", children: m }) => {
80
- let h = s;
81
- return /* @__PURE__ */ c(i, {
82
- className: "relative overflow-hidden bg-card border shadow-lg hover:shadow-xl transition-all duration-300",
83
- children: /* @__PURE__ */ l(t, {
84
- className: "pt-6",
85
- children: [/* @__PURE__ */ l("div", {
86
- className: "flex items-start justify-between",
87
- children: [/* @__PURE__ */ l("div", { children: [
88
- /* @__PURE__ */ c(r, {
89
- className: "text-sm font-medium text-muted-foreground",
90
- children: e
91
- }),
92
- /* @__PURE__ */ l("div", {
93
- className: "flex items-baseline space-x-2 mt-1",
94
- children: [/* @__PURE__ */ c("div", {
95
- className: "text-2xl font-bold text-card-foreground",
96
- children: typeof n == "number" ? n.toFixed(1) : n
97
- }), a && /* @__PURE__ */ c("div", {
98
- className: "text-sm text-muted-foreground font-medium",
99
- children: a
100
- })]
101
- }),
102
- o && /* @__PURE__ */ c("div", {
103
- className: "mt-1 text-xs text-muted-foreground",
104
- children: o
105
- }),
106
- d && f && /* @__PURE__ */ l("div", {
107
- className: `flex items-center space-x-1 mt-2 text-xs ${y(d)}`,
108
- children: [/* @__PURE__ */ c("span", { children: v(d) }), /* @__PURE__ */ c("span", { children: f })]
109
- })
110
- ] }), /* @__PURE__ */ c("div", {
111
- className: `p-2 rounded-control ${g[p]} shadow-lg`,
112
- children: /* @__PURE__ */ c(h, { className: _[u] })
113
- })]
114
- }), m && /* @__PURE__ */ c("div", {
115
- className: "mt-4",
116
- children: m
117
- })]
118
- })
119
- });
120
- }, x = () => /* @__PURE__ */ l(i, {
121
- className: "animate-pulse",
122
- children: [/* @__PURE__ */ c(n, { children: /* @__PURE__ */ c("div", { className: "h-6 bg-muted rounded w-1/4" }) }), /* @__PURE__ */ c(t, { children: /* @__PURE__ */ l("div", {
123
- className: "space-y-2",
124
- children: [/* @__PURE__ */ c("div", { className: "h-4 bg-muted rounded" }), /* @__PURE__ */ c("div", { className: "h-4 bg-muted rounded w-3/4" })]
125
- }) })]
126
- }), S = ({ count: e = 1 }) => /* @__PURE__ */ c("div", {
127
- className: "grid gap-6",
128
- style: { gridTemplateColumns: `repeat(${e}, minmax(0, 1fr))` },
129
- children: Array.from({ length: e }).map((e, t) => /* @__PURE__ */ c(x, {}, t))
130
- });
131
- //#endregion
132
- export { f as a, h as i, x as n, d as o, b as r, S as t };