@krosoft/react 0.0.381 → 0.0.382
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/components/core/cards/DashboardCard.js +18 -0
- package/dist/components/core/cards/KpiCard.js +36 -0
- package/dist/components/core/cards/KpiCards.js +29 -0
- package/dist/components/core/cards/MetricCard.js +63 -0
- package/dist/components/core/cards/SkeletonCard.js +13 -0
- package/dist/components/core/cards/SkeletonCards.js +11 -0
- package/dist/components/core/cards/index.js +7 -1
- package/dist/components/core/changelog/AppChangelog.js +123 -0
- package/dist/components/core/changelog/AppChangelogEntry.js +85 -0
- package/dist/components/core/changelog/AppChangelogNav.js +39 -0
- package/dist/components/core/changelog/AppChangelogTagFilter.js +39 -0
- package/dist/components/core/changelog/index.js +1 -1
- package/dist/components/core/charts/BarChartHorizontal.js +80 -0
- package/dist/components/core/charts/BarChartVertical.js +68 -0
- package/dist/components/core/charts/ChartCard.js +44 -0
- package/dist/components/core/charts/CircularGauge.js +58 -0
- package/dist/components/core/charts/LineChart.js +69 -0
- package/dist/components/core/charts/PieChart.js +55 -0
- package/dist/components/core/charts/chartColors.js +10 -0
- package/dist/components/core/charts/chartTooltip.helper.js +15 -0
- package/dist/components/core/charts/index.js +8 -1
- package/dist/components/core/dialogs/AboutDialog.js +59 -0
- package/dist/components/core/dialogs/AppDialog.js +81 -0
- package/dist/components/core/dialogs/ConfirmationDialog.js +42 -0
- package/dist/components/core/dialogs/FormDialog.js +105 -0
- package/dist/components/core/dialogs/index.js +7 -4
- package/dist/components/core/filters/ActiveFilters.js +69 -0
- package/dist/components/core/filters/AdvancedFilters.js +103 -0
- package/dist/components/core/filters/ConditionFilter.js +162 -0
- package/dist/components/core/filters/ConditionFilterGroup.js +44 -0
- package/dist/components/core/filters/FilterField.js +64 -0
- package/dist/components/core/filters/FilterPills.js +13 -0
- package/dist/components/core/filters/FilterPillsGroup.js +39 -0
- package/dist/components/core/filters/FiltersContainer.js +54 -0
- package/dist/components/core/filters/FiltersMobileDrawer.js +57 -0
- package/dist/components/core/filters/TableFilter.js +101 -0
- package/dist/components/core/filters/index.js +11 -645
- package/dist/{GenericForm-Dxd6k7l-.js → components/core/forms/GenericForm.js} +45 -43
- package/dist/components/core/forms/index.js +1 -1
- package/dist/components/core/icons/FlagFrIcon.js +28 -0
- package/dist/{icons-n0m_1w7z.js → components/core/icons/FlagGbIcon.js} +3 -26
- package/dist/components/core/icons/index.js +3 -1
- package/dist/components/core/index.js +71 -27
- package/dist/components/core/inputs/DatePicker.js +46 -0
- package/dist/components/core/inputs/DateRangePicker.js +92 -0
- package/dist/{inputs-CBojnClc.js → components/core/inputs/FileDropzone.js} +8 -37
- package/dist/{ImageInput-BeIOm3GY.js → components/core/inputs/ImageInput.js} +5 -5
- package/dist/components/core/inputs/MultiSelect.js +191 -0
- package/dist/components/core/inputs/RatingInput.js +36 -0
- package/dist/{SearchInput-IT_Rvthr.js → components/core/inputs/SearchInput.js} +4 -4
- package/dist/components/core/inputs/SingleSelect.js +198 -0
- package/dist/components/core/inputs/index.js +9 -6
- package/dist/components/core/inputs/select.helper.js +46 -0
- package/dist/{language-DY0EYabh.js → components/core/language/LanguageSelector.js} +13 -12
- package/dist/components/core/language/index.js +1 -1
- package/dist/{AppActions-8HjAaTQK.js → components/core/layouts/AppActions.js} +19 -19
- package/dist/components/core/layouts/AppPageHeader.js +44 -0
- package/dist/{AppSubTitle-DI62BaaB.js → components/core/layouts/AppSubTitle.js} +3 -3
- package/dist/{AppTitle-BXoTrXQc.js → components/core/layouts/AppTitle.js} +3 -3
- package/dist/components/core/layouts/KpiCardsLayout.js +8 -0
- package/dist/components/core/layouts/index.js +6 -50
- package/dist/components/core/markdown/AppMarkdown.js +134 -0
- package/dist/components/core/markdown/AppMarkdownHeading.js +45 -0
- package/dist/components/core/markdown/index.js +1 -1
- package/dist/components/core/navbar/GlobalSearch.js +128 -0
- package/dist/components/core/navbar/NotificationsBell.js +133 -0
- package/dist/components/core/navbar/Sidebar.js +99 -0
- package/dist/components/core/navbar/SidebarHeader.js +26 -0
- package/dist/components/core/navbar/SidebarNavItem.js +72 -0
- package/dist/components/core/navbar/Topbar.js +25 -0
- package/dist/components/core/navbar/index.js +7 -1
- package/dist/{ErrorAlert-cJnfBL8H.js → components/core/states/ErrorAlert.js} +5 -5
- package/dist/{states-CJ8xE_Nm.js → components/core/states/ErrorState.js} +4 -11
- package/dist/components/core/states/LoadingState.js +12 -0
- package/dist/components/core/states/index.js +3 -2
- package/dist/components/core/table/DataTable.js +108 -0
- package/dist/components/core/table/JsonTableOutput.js +75 -0
- package/dist/components/core/table/TableActions.js +75 -0
- package/dist/components/core/table/TableBody.js +130 -0
- package/dist/components/core/table/TableBulkActions.js +47 -0
- package/dist/components/core/table/TableHeader.js +103 -0
- package/dist/components/core/table/TablePagination.js +102 -0
- package/dist/components/core/table/TableSettings.js +117 -0
- package/dist/components/core/table/index.js +9 -709
- package/dist/components/core/tabs/AppTabContainer.js +17 -0
- package/dist/components/core/tabs/AppTabHeader.js +19 -0
- package/dist/components/core/tabs/AppTabs.js +56 -0
- package/dist/components/core/tabs/AppVerticalTabs.js +105 -0
- package/dist/components/core/tabs/index.js +5 -188
- package/dist/{theme-DSumNHLX.js → components/core/theme/ThemeSelector.js} +13 -12
- package/dist/components/core/theme/index.js +1 -1
- package/dist/components/index.js +117 -34
- package/dist/components/ui/accordion.js +34 -0
- package/dist/components/ui/alert-dialog.js +54 -0
- package/dist/{alert-REQGK9bR.js → components/ui/alert.js} +2 -2
- package/dist/components/ui/aspect-ratio.js +5 -0
- package/dist/components/ui/avatar.js +25 -0
- package/dist/components/ui/badge.js +22 -0
- package/dist/components/ui/breadcrumb.js +60 -0
- package/dist/{tooltip-_geGvbS7.js → components/ui/button.js} +7 -17
- package/dist/components/ui/calendar.js +44 -0
- package/dist/components/ui/card.js +42 -0
- package/dist/components/ui/carousel.js +115 -0
- package/dist/{chart-wW-fwL3s.js → components/ui/chart.js} +51 -89
- package/dist/components/ui/checkbox.js +31 -0
- package/dist/components/ui/collapsible.js +5 -0
- package/dist/components/ui/command.js +84 -0
- package/dist/components/ui/context-menu.js +71 -0
- package/dist/components/ui/control.js +5 -0
- package/dist/components/ui/dialog.js +49 -0
- package/dist/components/ui/drawer.js +47 -0
- package/dist/components/ui/dropdown-menu.js +72 -0
- package/dist/components/ui/form.js +78 -0
- package/dist/components/ui/hover-card.js +15 -0
- package/dist/components/ui/index.js +49 -9
- package/dist/components/ui/input-otp.js +41 -0
- package/dist/components/ui/input.js +14 -0
- package/dist/components/ui/label.js +14 -0
- package/dist/components/ui/menubar.js +86 -0
- package/dist/components/ui/navigation-menu.js +58 -0
- package/dist/components/ui/pagination.js +62 -0
- package/dist/components/ui/popover.js +15 -0
- package/dist/components/ui/progress.js +17 -0
- package/dist/components/ui/radio-group.js +24 -0
- package/dist/components/ui/resizable.js +18 -0
- package/dist/components/ui/scroll-area.js +29 -0
- package/dist/{select-KWMg2_7Z.js → components/ui/select.js} +3 -3
- package/dist/components/ui/separator.js +15 -0
- package/dist/components/ui/sheet.js +58 -0
- package/dist/components/ui/simple-table.js +57 -0
- package/dist/{skeleton-D6Ga4BLw.js → components/ui/skeleton.js} +2 -2
- package/dist/components/ui/slider.js +17 -0
- package/dist/components/ui/sonner.js +23 -0
- package/dist/components/ui/switch.js +14 -0
- package/dist/components/ui/tabs.js +58 -0
- package/dist/components/ui/textarea.js +12 -0
- package/dist/components/ui/toast.js +53 -0
- package/dist/components/ui/toaster.js +22 -0
- package/dist/components/ui/toggle-group.js +37 -0
- package/dist/components/ui/toggle.js +34 -0
- package/dist/components/ui/tooltip.js +14 -0
- package/dist/{datatable-COQcYUrk.js → constants/datatable.js} +1 -1
- package/dist/constants/index.js +3 -5
- package/dist/constants/search.js +4 -0
- package/dist/contexts/index.js +3 -1
- package/dist/{sidebar.context-BahtU6hE.js → contexts/page.context.js} +2 -2
- package/dist/contexts/sidebar.context.js +5 -0
- package/dist/helpers/changelog.helper.js +69 -0
- package/dist/helpers/index.js +6 -166
- package/dist/{markdown.helper-YJE2H5KQ.js → helpers/markdown.helper.js} +1 -1
- package/dist/helpers/supabase.helper.js +41 -0
- package/dist/helpers/table.helper.js +56 -0
- package/dist/{tailwind.helper-CJaRYBmL.js → helpers/tailwind.helper.js} +1 -1
- package/dist/hooks/behavior/index.js +10 -1
- package/dist/hooks/behavior/useConfirmDeleteDialog.js +21 -0
- package/dist/hooks/behavior/useConfirmationDialog.js +23 -0
- package/dist/hooks/behavior/useDebounce.js +14 -0
- package/dist/hooks/behavior/useDebouncedValue.js +15 -0
- package/dist/hooks/behavior/useDialog.js +21 -0
- package/dist/hooks/behavior/usePage.js +10 -0
- package/dist/hooks/behavior/useSidebar.js +10 -0
- package/dist/hooks/behavior/useTable.js +83 -0
- package/dist/hooks/behavior/useUrlState.js +46 -0
- package/dist/hooks/index.js +20 -11
- package/dist/hooks/ui/index.js +11 -10
- package/dist/{useFixedColumns-Bo-Az3Hp.js → hooks/ui/useDataTable.js} +16 -52
- package/dist/{useDocumentTitle-VoQkict_.js → hooks/ui/useDocumentTitle.js} +2 -2
- package/dist/hooks/ui/useFixedColumns.js +38 -0
- package/dist/{useLanguage-DRnSb5H1.js → hooks/ui/useLanguage.js} +3 -3
- package/dist/{useMobile-pTQ8lWvt.js → hooks/ui/useMobile.js} +1 -1
- package/dist/{useNotifications-CyhTruIG.js → hooks/ui/useNotifications.js} +2 -2
- package/dist/{useScrollFade-D9kqJBDh.js → hooks/ui/useScrollFade.js} +1 -1
- package/dist/{ui-nQGnCss1.js → hooks/ui/useServerTable.js} +2 -2
- package/dist/{useTheme-DIZjiF5F.js → hooks/ui/useTheme.js} +3 -3
- package/dist/{useToast-UeDRLovh.js → hooks/ui/useToast.js} +1 -1
- package/dist/i18n/index.js +4 -1
- package/dist/i18n/krosoftLocales.js +13 -0
- package/dist/i18n/useDateFnsLocale.js +13 -0
- package/dist/i18n/useKrosoftTranslation.js +13 -0
- package/dist/locales/en.json.js +174 -0
- package/dist/locales/fr.json.js +174 -0
- package/dist/providers/SidebarProvider.js +42 -0
- package/dist/providers/index.js +1 -42
- package/dist/pwa/PwaUpdater.js +30 -0
- package/dist/pwa/index.js +3 -50
- package/dist/pwa/pwaUpdateToast.js +25 -0
- package/dist/seasonal/EffectSwitch.js +24 -0
- package/dist/seasonal/EmojiSnowfall.js +24 -0
- package/dist/seasonal/HalloweenEffect.js +17 -0
- package/dist/seasonal/SeasonalEffects.js +8 -0
- package/dist/seasonal/SeasonalEffectsSettings.js +35 -0
- package/dist/seasonal/SnowEffect.js +12 -0
- package/dist/seasonal/index.js +7 -120
- package/dist/seasonal/overlayStyle.js +12 -0
- package/dist/seasonal/seasons.js +7 -0
- package/dist/seasonal/useSeasonalEffects.js +20 -0
- package/dist/seasonal/useStoredToggle.js +21 -0
- package/dist/tailwind/index.js +7 -53
- package/dist/tokens/apply.js +16 -0
- package/dist/tokens/index.js +3 -38
- package/dist/tokens/radius.js +26 -0
- package/dist/types/index.js +0 -1
- package/dist/vendor/tailwindcss/lib/public/create-plugin.js +19 -0
- package/dist/vendor/tailwindcss/lib/util/createPlugin.js +30 -0
- package/dist/vendor/tailwindcss/plugin.js +10 -0
- package/package.json +3 -3
- package/dist/AppMarkdown-CAxm82x0.js +0 -171
- package/dist/MultiSelect-DPN046kI.js +0 -228
- package/dist/SingleSelect-DLY5WylQ.js +0 -313
- package/dist/behavior-B0BYivtN.js +0 -201
- package/dist/cards-DPzVebUM.js +0 -132
- package/dist/changelog-DyPFIscf.js +0 -257
- package/dist/charts-C7rKxkli.js +0 -342
- package/dist/dialogs-CG9Q7pqY.js +0 -269
- package/dist/i18n-BhLphJa3.js +0 -364
- package/dist/navbar-DD0V0pNE.js +0 -432
- package/dist/sheet-cWJO_wkT.js +0 -225
- package/dist/switch-DspImmo_.js +0 -24
- package/dist/ui-Fxy95kSJ.js +0 -1163
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { cn as e } from "../../../helpers/tailwind.helper.js";
|
|
2
|
+
import { Card as t, CardContent as n, CardDescription as r, CardHeader as i, CardTitle as a } from "../../ui/card.js";
|
|
3
|
+
import { useKrosoftTranslation as o } from "../../../i18n/useKrosoftTranslation.js";
|
|
4
|
+
import { Skeleton as s } from "../../ui/skeleton.js";
|
|
5
|
+
import "react";
|
|
6
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/core/charts/ChartCard.tsx
|
|
8
|
+
var u = ({ title: u, description: d, icon: f, actions: p, footer: m, isLoading: h = !1, isEmpty: g = !1, emptyLabel: _, height: v = 300, className: y, contentClassName: b, children: x }) => {
|
|
9
|
+
let { t: S } = o(), C = f;
|
|
10
|
+
return /* @__PURE__ */ l(t, {
|
|
11
|
+
className: y,
|
|
12
|
+
children: [/* @__PURE__ */ c(i, { children: /* @__PURE__ */ l("div", {
|
|
13
|
+
className: "flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",
|
|
14
|
+
children: [/* @__PURE__ */ l("div", {
|
|
15
|
+
className: "min-w-0",
|
|
16
|
+
children: [/* @__PURE__ */ l(a, {
|
|
17
|
+
className: "flex items-center gap-2",
|
|
18
|
+
children: [C && /* @__PURE__ */ c(C, { className: "size-5 shrink-0" }), /* @__PURE__ */ c("span", {
|
|
19
|
+
className: "truncate",
|
|
20
|
+
children: u
|
|
21
|
+
})]
|
|
22
|
+
}), d !== void 0 && d !== "" ? /* @__PURE__ */ c(r, { children: d }) : null]
|
|
23
|
+
}), p == null ? null : /* @__PURE__ */ c("div", {
|
|
24
|
+
className: "shrink-0",
|
|
25
|
+
children: p
|
|
26
|
+
})]
|
|
27
|
+
}) }), /* @__PURE__ */ l(n, { children: [/* @__PURE__ */ c("div", {
|
|
28
|
+
className: e("w-full", b),
|
|
29
|
+
style: v === null ? void 0 : { height: v },
|
|
30
|
+
children: h ? /* @__PURE__ */ c(s, { className: "size-full rounded-surface" }) : g ? /* @__PURE__ */ c("div", {
|
|
31
|
+
className: "flex size-full items-center justify-center",
|
|
32
|
+
children: /* @__PURE__ */ c("p", {
|
|
33
|
+
className: "text-sm text-muted-foreground",
|
|
34
|
+
children: _ ?? S("states.noData")
|
|
35
|
+
})
|
|
36
|
+
}) : x
|
|
37
|
+
}), !h && !g && m != null ? /* @__PURE__ */ c("div", {
|
|
38
|
+
className: "mt-4",
|
|
39
|
+
children: m
|
|
40
|
+
}) : null] })]
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
//#endregion
|
|
44
|
+
export { u as ChartCard };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { cn as e } from "../../../helpers/tailwind.helper.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/core/charts/CircularGauge.tsx
|
|
5
|
+
var r = {
|
|
6
|
+
warning: 50,
|
|
7
|
+
danger: 80
|
|
8
|
+
}, i = (e, t) => e >= t.danger ? "hsl(var(--destructive))" : e >= t.warning ? "hsl(var(--k-warning))" : "hsl(var(--k-success))", a = ({ value: a, max: o = 100, size: s = 120, strokeWidth: c = 8, label: l, unit: u = "%", color: d, thresholds: f = r, valueFormatter: p = (e) => e.toFixed(1), className: m }) => {
|
|
9
|
+
let h = (s - c) / 2, g = h * 2 * Math.PI, _ = o > 0 ? Math.min(100, Math.max(0, a / o * 100)) : 0, v = d ?? i(_, f);
|
|
10
|
+
return /* @__PURE__ */ n("div", {
|
|
11
|
+
className: e("flex flex-col items-center gap-2", m),
|
|
12
|
+
children: [/* @__PURE__ */ n("div", {
|
|
13
|
+
className: "relative",
|
|
14
|
+
style: {
|
|
15
|
+
width: s,
|
|
16
|
+
height: s
|
|
17
|
+
},
|
|
18
|
+
children: [/* @__PURE__ */ n("svg", {
|
|
19
|
+
width: s,
|
|
20
|
+
height: s,
|
|
21
|
+
className: "-rotate-90",
|
|
22
|
+
children: [/* @__PURE__ */ t("circle", {
|
|
23
|
+
cx: s / 2,
|
|
24
|
+
cy: s / 2,
|
|
25
|
+
r: h,
|
|
26
|
+
className: "stroke-muted",
|
|
27
|
+
strokeWidth: c,
|
|
28
|
+
fill: "transparent"
|
|
29
|
+
}), /* @__PURE__ */ t("circle", {
|
|
30
|
+
cx: s / 2,
|
|
31
|
+
cy: s / 2,
|
|
32
|
+
r: h,
|
|
33
|
+
stroke: v,
|
|
34
|
+
strokeWidth: c,
|
|
35
|
+
fill: "transparent",
|
|
36
|
+
strokeDasharray: g,
|
|
37
|
+
strokeDashoffset: g - _ / 100 * g,
|
|
38
|
+
strokeLinecap: "round",
|
|
39
|
+
className: "transition-all duration-500 ease-out"
|
|
40
|
+
})]
|
|
41
|
+
}), /* @__PURE__ */ n("div", {
|
|
42
|
+
className: "absolute inset-0 flex flex-col items-center justify-center",
|
|
43
|
+
children: [/* @__PURE__ */ t("span", {
|
|
44
|
+
className: "text-2xl font-bold text-card-foreground",
|
|
45
|
+
children: p(a)
|
|
46
|
+
}), u !== "" && /* @__PURE__ */ t("span", {
|
|
47
|
+
className: "text-sm text-muted-foreground",
|
|
48
|
+
children: u
|
|
49
|
+
})]
|
|
50
|
+
})]
|
|
51
|
+
}), l !== void 0 && l !== "" ? /* @__PURE__ */ t("span", {
|
|
52
|
+
className: "text-sm font-medium text-muted-foreground",
|
|
53
|
+
children: l
|
|
54
|
+
}) : null]
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
//#endregion
|
|
58
|
+
export { a as CircularGauge };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { cn as e } from "../../../helpers/tailwind.helper.js";
|
|
2
|
+
import { ChartContainer as t, ChartTooltip as n, ChartTooltipContent as r } from "../../ui/chart.js";
|
|
3
|
+
import { buildTooltipValueFormatter as i } from "./chartTooltip.helper.js";
|
|
4
|
+
import * as a from "react";
|
|
5
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
6
|
+
import { CartesianGrid as c, Line as l, LineChart as u, XAxis as d, YAxis as f } from "recharts";
|
|
7
|
+
//#region src/components/core/charts/LineChart.tsx
|
|
8
|
+
var p = ({ data: p, label: m = "Valeur", color: h = "hsl(var(--primary))", yAxisDomain: g, valueFormatter: _, labelFormatter: v, showDots: y = !0, className: b }) => {
|
|
9
|
+
let x = a.useMemo(() => ({ value: {
|
|
10
|
+
label: m,
|
|
11
|
+
color: h
|
|
12
|
+
} }), [m, h]), S = a.useMemo(() => i(_, m), [_, m]);
|
|
13
|
+
return /* @__PURE__ */ o(t, {
|
|
14
|
+
config: x,
|
|
15
|
+
className: e("aspect-auto size-full", b),
|
|
16
|
+
children: /* @__PURE__ */ s(u, {
|
|
17
|
+
data: p,
|
|
18
|
+
margin: {
|
|
19
|
+
top: 10,
|
|
20
|
+
right: 20,
|
|
21
|
+
left: 0,
|
|
22
|
+
bottom: 10
|
|
23
|
+
},
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ o(c, {
|
|
26
|
+
strokeDasharray: "3 3",
|
|
27
|
+
vertical: !1
|
|
28
|
+
}),
|
|
29
|
+
/* @__PURE__ */ o(d, {
|
|
30
|
+
dataKey: "name",
|
|
31
|
+
tickLine: !1,
|
|
32
|
+
axisLine: !1,
|
|
33
|
+
tickMargin: 8,
|
|
34
|
+
interval: "preserveStartEnd",
|
|
35
|
+
tickFormatter: v ? (e) => v(String(e)) : void 0
|
|
36
|
+
}),
|
|
37
|
+
/* @__PURE__ */ o(f, {
|
|
38
|
+
domain: g,
|
|
39
|
+
tickLine: !1,
|
|
40
|
+
axisLine: !1,
|
|
41
|
+
width: _ ? 48 : 32,
|
|
42
|
+
tickFormatter: _ ? (e) => _(Number(e)) : void 0
|
|
43
|
+
}),
|
|
44
|
+
/* @__PURE__ */ o(n, { content: /* @__PURE__ */ o(r, {
|
|
45
|
+
formatter: S,
|
|
46
|
+
labelFormatter: v ? (e) => v(String(e)) : void 0
|
|
47
|
+
}) }),
|
|
48
|
+
/* @__PURE__ */ o(l, {
|
|
49
|
+
type: "monotone",
|
|
50
|
+
dataKey: "value",
|
|
51
|
+
stroke: "var(--color-value)",
|
|
52
|
+
strokeWidth: 2,
|
|
53
|
+
dot: y ? {
|
|
54
|
+
fill: "var(--color-value)",
|
|
55
|
+
strokeWidth: 0,
|
|
56
|
+
r: 3
|
|
57
|
+
} : !1,
|
|
58
|
+
activeDot: {
|
|
59
|
+
r: 5,
|
|
60
|
+
strokeWidth: 2,
|
|
61
|
+
className: "stroke-background"
|
|
62
|
+
}
|
|
63
|
+
})
|
|
64
|
+
]
|
|
65
|
+
})
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
//#endregion
|
|
69
|
+
export { p as LineChart };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { cn as e } from "../../../helpers/tailwind.helper.js";
|
|
2
|
+
import { ChartContainer as t, ChartLegend as n, ChartLegendContent as r, ChartTooltip as i, ChartTooltipContent as a } from "../../ui/chart.js";
|
|
3
|
+
import { buildTooltipValueFormatter as o } from "./chartTooltip.helper.js";
|
|
4
|
+
import { getChartColor as s } from "./chartColors.js";
|
|
5
|
+
import { useMobile as c } from "../../../hooks/ui/useMobile.js";
|
|
6
|
+
import * as l from "react";
|
|
7
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
8
|
+
import { Pie as f, PieChart as p, Sector as m } from "recharts";
|
|
9
|
+
//#region src/components/core/charts/PieChart.tsx
|
|
10
|
+
var h = 6, g = ({ data: g, innerRadius: _, outerRadius: v, showLegend: y = !0, showLabels: b = !1, valueFormatter: x, onSelect: S, className: C }) => {
|
|
11
|
+
let w = c(), T = l.useMemo(() => g.map((e, t) => ({
|
|
12
|
+
...e,
|
|
13
|
+
fill: e.color ?? s(t)
|
|
14
|
+
})), [g]), E = l.useMemo(() => Object.fromEntries(g.map((e, t) => [e.name, {
|
|
15
|
+
label: e.name,
|
|
16
|
+
color: e.color ?? s(t)
|
|
17
|
+
}])), [g]), D = l.useMemo(() => o(x), [x]), O = _ ?? (w ? 45 : 60), k = v ?? (w ? 80 : 100);
|
|
18
|
+
return /* @__PURE__ */ u(t, {
|
|
19
|
+
config: E,
|
|
20
|
+
className: e("aspect-auto size-full", C),
|
|
21
|
+
children: /* @__PURE__ */ d(p, { children: [
|
|
22
|
+
/* @__PURE__ */ u(i, { content: /* @__PURE__ */ u(a, {
|
|
23
|
+
nameKey: "name",
|
|
24
|
+
hideLabel: !0,
|
|
25
|
+
formatter: D
|
|
26
|
+
}) }),
|
|
27
|
+
/* @__PURE__ */ u(f, {
|
|
28
|
+
data: T,
|
|
29
|
+
dataKey: "value",
|
|
30
|
+
nameKey: "name",
|
|
31
|
+
cx: "50%",
|
|
32
|
+
cy: y ? "45%" : "50%",
|
|
33
|
+
innerRadius: O,
|
|
34
|
+
outerRadius: k,
|
|
35
|
+
paddingAngle: O > 0 ? 2 : 0,
|
|
36
|
+
label: b ? ({ name: e, value: t }) => `${String(e)} (${String(t)})` : void 0,
|
|
37
|
+
isAnimationActive: !1,
|
|
38
|
+
className: e("stroke-background", S && "cursor-pointer"),
|
|
39
|
+
shape: (e) => /* @__PURE__ */ u(m, {
|
|
40
|
+
...e,
|
|
41
|
+
outerRadius: S && e.isActive ? e.outerRadius + h : e.outerRadius
|
|
42
|
+
}),
|
|
43
|
+
onClick: S ? (e, t) => {
|
|
44
|
+
S(g[t], t);
|
|
45
|
+
} : void 0
|
|
46
|
+
}),
|
|
47
|
+
y && /* @__PURE__ */ u(n, { content: /* @__PURE__ */ u(r, {
|
|
48
|
+
nameKey: "name",
|
|
49
|
+
className: "flex-wrap text-muted-foreground"
|
|
50
|
+
}) })
|
|
51
|
+
] })
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
//#endregion
|
|
55
|
+
export { g as PieChart };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/components/core/charts/chartColors.ts
|
|
2
|
+
var e = [
|
|
3
|
+
"hsl(var(--k-chart-1))",
|
|
4
|
+
"hsl(var(--k-chart-2))",
|
|
5
|
+
"hsl(var(--k-chart-3))",
|
|
6
|
+
"hsl(var(--k-chart-4))",
|
|
7
|
+
"hsl(var(--k-chart-5))"
|
|
8
|
+
], t = (t) => e[t % e.length];
|
|
9
|
+
//#endregion
|
|
10
|
+
export { e as CHART_COLORS, t as getChartColor };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import "react";
|
|
2
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/core/charts/chartTooltip.helper.tsx
|
|
4
|
+
var n = (n, r) => n ? (i, a) => /* @__PURE__ */ t("div", {
|
|
5
|
+
className: "flex flex-1 justify-between gap-4",
|
|
6
|
+
children: [/* @__PURE__ */ e("span", {
|
|
7
|
+
className: "text-muted-foreground",
|
|
8
|
+
children: r ?? String(a)
|
|
9
|
+
}), /* @__PURE__ */ e("span", {
|
|
10
|
+
className: "font-mono font-medium tabular-nums text-foreground",
|
|
11
|
+
children: n(Number(i))
|
|
12
|
+
})]
|
|
13
|
+
}) : void 0;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { n as buildTooltipValueFormatter };
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { BarChartHorizontal as e } from "./BarChartHorizontal.js";
|
|
2
|
+
import { BarChartVertical as t } from "./BarChartVertical.js";
|
|
3
|
+
import { CHART_COLORS as n, getChartColor as r } from "./chartColors.js";
|
|
4
|
+
import { ChartCard as i } from "./ChartCard.js";
|
|
5
|
+
import { CircularGauge as a } from "./CircularGauge.js";
|
|
6
|
+
import { LineChart as o } from "./LineChart.js";
|
|
7
|
+
import { PieChart as s } from "./PieChart.js";
|
|
8
|
+
export { e as BarChartHorizontal, t as BarChartVertical, n as CHART_COLORS, i as ChartCard, a as CircularGauge, o as LineChart, s as PieChart, r as getChartColor };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { cn as e } from "../../../helpers/tailwind.helper.js";
|
|
2
|
+
import { useDateFnsLocale as t } from "../../../i18n/useDateFnsLocale.js";
|
|
3
|
+
import { useKrosoftTranslation as n } from "../../../i18n/useKrosoftTranslation.js";
|
|
4
|
+
import { Dialog as r, DialogContent as i, DialogHeader as a, DialogTitle as o } from "../../ui/dialog.js";
|
|
5
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
6
|
+
import { format as l, isValid as u } from "date-fns";
|
|
7
|
+
//#region src/components/core/dialogs/AboutDialog.tsx
|
|
8
|
+
var d = (e, t) => {
|
|
9
|
+
let n = e instanceof Date ? e : new Date(e);
|
|
10
|
+
return u(n) ? l(n, "Pp", { locale: t }) : String(e);
|
|
11
|
+
}, f = ({ open: l, onOpenChange: u, info: f, logo: p, title: m = "about.title", className: h }) => {
|
|
12
|
+
let { t: g } = n(), _ = t(), v = [
|
|
13
|
+
{
|
|
14
|
+
label: g("about.version"),
|
|
15
|
+
value: f.version
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
label: g("about.environment"),
|
|
19
|
+
value: f.environment
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
label: g("about.buildDate"),
|
|
23
|
+
value: f.buildDate ? d(f.buildDate, _) : void 0
|
|
24
|
+
}
|
|
25
|
+
].filter((e) => e.value);
|
|
26
|
+
return /* @__PURE__ */ s(r, {
|
|
27
|
+
open: l,
|
|
28
|
+
onOpenChange: u,
|
|
29
|
+
children: /* @__PURE__ */ c(i, {
|
|
30
|
+
className: e("sm:max-w-sm", h),
|
|
31
|
+
"aria-describedby": void 0,
|
|
32
|
+
children: [
|
|
33
|
+
/* @__PURE__ */ s(a, {
|
|
34
|
+
className: "mb-6",
|
|
35
|
+
children: /* @__PURE__ */ s(o, { children: g(m) })
|
|
36
|
+
}),
|
|
37
|
+
p && /* @__PURE__ */ s("div", {
|
|
38
|
+
className: "flex justify-center",
|
|
39
|
+
children: p
|
|
40
|
+
}),
|
|
41
|
+
/* @__PURE__ */ s("dl", {
|
|
42
|
+
className: "grid grid-cols-[auto_1fr] gap-x-6 gap-y-2 text-sm",
|
|
43
|
+
children: v.map(({ label: e, value: t }) => /* @__PURE__ */ c("div", {
|
|
44
|
+
className: "contents",
|
|
45
|
+
children: [/* @__PURE__ */ s("dt", {
|
|
46
|
+
className: "text-muted-foreground",
|
|
47
|
+
children: e
|
|
48
|
+
}), /* @__PURE__ */ s("dd", {
|
|
49
|
+
className: "font-mono",
|
|
50
|
+
children: t
|
|
51
|
+
})]
|
|
52
|
+
}, e))
|
|
53
|
+
})
|
|
54
|
+
]
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
//#endregion
|
|
59
|
+
export { f as AboutDialog };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { cn as e } from "../../../helpers/tailwind.helper.js";
|
|
2
|
+
import { useKrosoftTranslation as t } from "../../../i18n/useKrosoftTranslation.js";
|
|
3
|
+
import { Button as n } from "../../ui/button.js";
|
|
4
|
+
import { Dialog as r, DialogContent as i, DialogDescription as a, DialogHeader as o, DialogTitle as s } from "../../ui/dialog.js";
|
|
5
|
+
import { Progress as c } from "../../ui/progress.js";
|
|
6
|
+
import { ErrorAlert as l } from "../states/ErrorAlert.js";
|
|
7
|
+
import "react";
|
|
8
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
9
|
+
//#region src/components/core/dialogs/AppDialog.tsx
|
|
10
|
+
var f = {
|
|
11
|
+
sm: "sm:max-w-sm",
|
|
12
|
+
md: "sm:max-w-md",
|
|
13
|
+
lg: "sm:max-w-lg",
|
|
14
|
+
xl: "sm:max-w-xl",
|
|
15
|
+
"2xl": "sm:max-w-2xl",
|
|
16
|
+
"3xl": "sm:max-w-3xl",
|
|
17
|
+
"4xl": "sm:max-w-4xl",
|
|
18
|
+
full: "sm:max-w-[95vw]"
|
|
19
|
+
};
|
|
20
|
+
function p({ open: p, onOpenChange: m, config: h, isLoading: g, error: _, footer: v, className: y, children: b }) {
|
|
21
|
+
let { t: x } = t(), { title: S, description: C, icon: w, size: T = "xl", maxWidth: E, actions: D, headerClassName: O, footerClassName: k } = h, A = g === !0, j = (e) => typeof e == "string" ? x(e) : e, M = (e) => {
|
|
22
|
+
(e || !A) && m(e);
|
|
23
|
+
}, N = v !== void 0 || D !== void 0 && D.length > 0;
|
|
24
|
+
return /* @__PURE__ */ u(r, {
|
|
25
|
+
open: p,
|
|
26
|
+
onOpenChange: M,
|
|
27
|
+
children: /* @__PURE__ */ d(i, {
|
|
28
|
+
className: e("max-h-[100dvh] sm:max-h-[90vh] border-0 shadow-2xl p-0 flex flex-col overflow-hidden", "[&>button]:text-dialog-header-foreground [&>button]:focus:ring-dialog-header-foreground", A && "[&>button]:pointer-events-none [&>button]:opacity-40", E ?? f[T], y),
|
|
29
|
+
children: [
|
|
30
|
+
A ? /* @__PURE__ */ u("div", {
|
|
31
|
+
className: "absolute top-0 left-0 right-0 z-10",
|
|
32
|
+
children: /* @__PURE__ */ u(c, {
|
|
33
|
+
indeterminate: !0,
|
|
34
|
+
className: "h-1 rounded-none"
|
|
35
|
+
})
|
|
36
|
+
}) : null,
|
|
37
|
+
/* @__PURE__ */ d(o, {
|
|
38
|
+
className: e("bg-gradient-to-r from-dialog-header-from to-dialog-header-to p-4 sm:p-6 pr-12 sm:pr-12 sm:rounded-t-surface shrink-0", O),
|
|
39
|
+
children: [/* @__PURE__ */ d(s, {
|
|
40
|
+
className: "text-xl sm:text-2xl font-bold flex items-center gap-2 text-dialog-header-foreground",
|
|
41
|
+
children: [w === void 0 ? null : /* @__PURE__ */ u("div", {
|
|
42
|
+
className: "p-2 bg-dialog-header-foreground/20 rounded-control",
|
|
43
|
+
children: /* @__PURE__ */ u(w, { className: "size-4 text-dialog-header-foreground" })
|
|
44
|
+
}), j(S)]
|
|
45
|
+
}), C !== void 0 && C !== "" ? /* @__PURE__ */ u(a, {
|
|
46
|
+
className: "text-dialog-header-foreground/80 text-base",
|
|
47
|
+
children: j(C)
|
|
48
|
+
}) : null]
|
|
49
|
+
}),
|
|
50
|
+
_ ? /* @__PURE__ */ u("div", {
|
|
51
|
+
className: "px-4 sm:px-6 pt-4",
|
|
52
|
+
children: /* @__PURE__ */ u(l, {
|
|
53
|
+
error: _,
|
|
54
|
+
className: "max-w-full"
|
|
55
|
+
})
|
|
56
|
+
}) : null,
|
|
57
|
+
/* @__PURE__ */ u("div", {
|
|
58
|
+
className: "flex-1 overflow-y-auto px-4 sm:px-6 py-4",
|
|
59
|
+
children: b
|
|
60
|
+
}),
|
|
61
|
+
N ? /* @__PURE__ */ u("div", {
|
|
62
|
+
className: e("sm:rounded-b-surface border-t border-border bg-muted/40 shrink-0 p-4 sm:p-6", k),
|
|
63
|
+
children: v ?? /* @__PURE__ */ u("div", {
|
|
64
|
+
className: "flex justify-end gap-3",
|
|
65
|
+
children: D?.map((e) => /* @__PURE__ */ d(n, {
|
|
66
|
+
type: e.type ?? "button",
|
|
67
|
+
form: e.form,
|
|
68
|
+
variant: e.variant ?? "default",
|
|
69
|
+
onClick: e.onClick,
|
|
70
|
+
disabled: e.disabled === !0 || A && e.disableOnLoading !== !1,
|
|
71
|
+
className: e.className,
|
|
72
|
+
children: [e.icon === void 0 ? null : /* @__PURE__ */ u(e.icon, { className: "size-4" }), x(e.label)]
|
|
73
|
+
}, e.id ?? e.label))
|
|
74
|
+
})
|
|
75
|
+
}) : null
|
|
76
|
+
]
|
|
77
|
+
})
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
//#endregion
|
|
81
|
+
export { p as AppDialog };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { useKrosoftTranslation as e } from "../../../i18n/useKrosoftTranslation.js";
|
|
2
|
+
import { Button as t } from "../../ui/button.js";
|
|
3
|
+
import { AlertDialog as n, AlertDialogCancel as r, AlertDialogContent as i, AlertDialogDescription as a, AlertDialogFooter as o, AlertDialogHeader as s, AlertDialogTitle as c } from "../../ui/alert-dialog.js";
|
|
4
|
+
import { ErrorAlert as l } from "../states/ErrorAlert.js";
|
|
5
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/core/dialogs/ConfirmationDialog.tsx
|
|
7
|
+
function f({ isLoading: f, error: p, config: m, destructive: h = !1 }) {
|
|
8
|
+
let { t: g } = e();
|
|
9
|
+
return m ? /* @__PURE__ */ u(n, {
|
|
10
|
+
open: m.isOpen,
|
|
11
|
+
onOpenChange: (e) => {
|
|
12
|
+
!e && !f && m.onClose();
|
|
13
|
+
},
|
|
14
|
+
children: /* @__PURE__ */ d(i, { children: [
|
|
15
|
+
/* @__PURE__ */ d(s, { children: [
|
|
16
|
+
/* @__PURE__ */ d(c, {
|
|
17
|
+
className: m.titleClassName,
|
|
18
|
+
children: [m.icon && /* @__PURE__ */ u(m.icon, { className: "size-4" }), g(m.title)]
|
|
19
|
+
}),
|
|
20
|
+
/* @__PURE__ */ u(a, { children: g(m.description) }),
|
|
21
|
+
m.itemName && /* @__PURE__ */ u(a, { children: /* @__PURE__ */ u("span", {
|
|
22
|
+
className: "font-semibold block my-2",
|
|
23
|
+
children: m.itemName
|
|
24
|
+
}) })
|
|
25
|
+
] }),
|
|
26
|
+
/* @__PURE__ */ u(l, { error: p }),
|
|
27
|
+
/* @__PURE__ */ d(o, { children: [/* @__PURE__ */ u(r, {
|
|
28
|
+
disabled: f,
|
|
29
|
+
children: g("actions.cancel")
|
|
30
|
+
}), /* @__PURE__ */ u(t, {
|
|
31
|
+
onClick: (e) => {
|
|
32
|
+
e.preventDefault(), m.onConfirm();
|
|
33
|
+
},
|
|
34
|
+
disabled: f,
|
|
35
|
+
className: h ? "bg-destructive text-destructive-foreground hover:bg-destructive/90" : "",
|
|
36
|
+
children: g(f ? m.loadingKey ?? "states.loading" : m.confirmKey)
|
|
37
|
+
})] })
|
|
38
|
+
] })
|
|
39
|
+
}) : null;
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { f as ConfirmationDialog };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { useKrosoftTranslation as e } from "../../../i18n/useKrosoftTranslation.js";
|
|
2
|
+
import { Button as t } from "../../ui/button.js";
|
|
3
|
+
import { AppDialog as n } from "./AppDialog.js";
|
|
4
|
+
import { GenericForm as r } from "../forms/GenericForm.js";
|
|
5
|
+
import { useEffect as i, useId as a, useState as o } from "react";
|
|
6
|
+
import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
7
|
+
import { Pen as u, Save as d, X as f } from "lucide-react";
|
|
8
|
+
//#region src/components/core/dialogs/FormDialog.tsx
|
|
9
|
+
function p({ open: p, onOpenChange: m, data: h, title: g, headerBadge: _, schema: v, onSave: y, customFooter: b, defaultEditing: x = !1, footerActions: S = !0, saveLabel: C, cancelLabel: w, hideSaveIcon: T = !1, size: E = "4xl", maxWidth: D, isLoading: O = !1 }) {
|
|
10
|
+
let { t: k } = e(), A = C ?? k("actions.save"), [j, M] = o(x), [N, P] = o(!1), F = a();
|
|
11
|
+
if (i(() => {
|
|
12
|
+
p && M(x);
|
|
13
|
+
}, [p, x]), h == null) return null;
|
|
14
|
+
let I = () => {
|
|
15
|
+
M(!0);
|
|
16
|
+
}, L = () => {
|
|
17
|
+
M(!1);
|
|
18
|
+
}, R = async (e) => {
|
|
19
|
+
if (y) {
|
|
20
|
+
P(!0);
|
|
21
|
+
try {
|
|
22
|
+
await y(e), M(!1);
|
|
23
|
+
} catch (e) {
|
|
24
|
+
console.error(e);
|
|
25
|
+
} finally {
|
|
26
|
+
P(!1);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}, z = [];
|
|
30
|
+
y !== void 0 && (j ? (w !== "" && z.push({
|
|
31
|
+
label: w ?? k("actions.cancel"),
|
|
32
|
+
onClick: L,
|
|
33
|
+
variant: "outline",
|
|
34
|
+
disabled: N || O,
|
|
35
|
+
icon: f
|
|
36
|
+
}), z.push({
|
|
37
|
+
label: N ? k("actions.saving") : A,
|
|
38
|
+
type: "submit",
|
|
39
|
+
form: F,
|
|
40
|
+
variant: "default",
|
|
41
|
+
disabled: N || O,
|
|
42
|
+
icon: T ? void 0 : d
|
|
43
|
+
})) : z.push({
|
|
44
|
+
label: k("actions.edit"),
|
|
45
|
+
onClick: I,
|
|
46
|
+
variant: "outline",
|
|
47
|
+
icon: u
|
|
48
|
+
}));
|
|
49
|
+
let B = {
|
|
50
|
+
title: g(h),
|
|
51
|
+
size: E,
|
|
52
|
+
maxWidth: D,
|
|
53
|
+
actions: S ? z : []
|
|
54
|
+
};
|
|
55
|
+
return /* @__PURE__ */ c(n, {
|
|
56
|
+
open: p,
|
|
57
|
+
onOpenChange: (e) => {
|
|
58
|
+
m(e), e || L();
|
|
59
|
+
},
|
|
60
|
+
config: B,
|
|
61
|
+
isLoading: N || O,
|
|
62
|
+
children: /* @__PURE__ */ l("div", { children: [
|
|
63
|
+
_ === void 0 ? null : /* @__PURE__ */ c("div", {
|
|
64
|
+
className: "mb-4",
|
|
65
|
+
children: _(h)
|
|
66
|
+
}),
|
|
67
|
+
/* @__PURE__ */ c(r, {
|
|
68
|
+
id: F,
|
|
69
|
+
schema: v,
|
|
70
|
+
initialData: h,
|
|
71
|
+
disabled: !j,
|
|
72
|
+
onSubmit: (e) => {
|
|
73
|
+
R(e);
|
|
74
|
+
},
|
|
75
|
+
renderActions: !1,
|
|
76
|
+
isLoading: N || O
|
|
77
|
+
}),
|
|
78
|
+
b === void 0 ? null : b(h),
|
|
79
|
+
y !== void 0 && !S ? /* @__PURE__ */ c("div", {
|
|
80
|
+
className: "flex justify-end gap-2 border-t pt-4 mt-6",
|
|
81
|
+
children: j ? /* @__PURE__ */ l(s, { children: [w === "" ? null : /* @__PURE__ */ l(t, {
|
|
82
|
+
onClick: L,
|
|
83
|
+
variant: "outline",
|
|
84
|
+
size: "sm",
|
|
85
|
+
disabled: N || O,
|
|
86
|
+
children: [/* @__PURE__ */ c(f, { className: "size-4 mr-2" }), w ?? k("actions.cancel")]
|
|
87
|
+
}), /* @__PURE__ */ l(t, {
|
|
88
|
+
type: "submit",
|
|
89
|
+
form: F,
|
|
90
|
+
size: "sm",
|
|
91
|
+
disabled: N || O,
|
|
92
|
+
className: "text-white",
|
|
93
|
+
children: [T ? null : /* @__PURE__ */ c(d, { className: "size-4 mr-2" }), N ? k("actions.saving") : A]
|
|
94
|
+
})] }) : /* @__PURE__ */ l(t, {
|
|
95
|
+
onClick: I,
|
|
96
|
+
variant: "outline",
|
|
97
|
+
size: "sm",
|
|
98
|
+
children: [/* @__PURE__ */ c(u, { className: "size-4 mr-2" }), k("actions.edit")]
|
|
99
|
+
})
|
|
100
|
+
}) : null
|
|
101
|
+
] })
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
//#endregion
|
|
105
|
+
export { p as default };
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { Dialog as e, DialogClose as t, DialogContent as n, DialogDescription as r, DialogFooter as i, DialogHeader as a, DialogOverlay as o, DialogPortal as s, DialogTitle as c, DialogTrigger as l } from "../../ui/dialog.js";
|
|
2
|
+
import { Progress as u } from "../../ui/progress.js";
|
|
3
|
+
import { AppDialog as d } from "./AppDialog.js";
|
|
4
|
+
import f from "./FormDialog.js";
|
|
5
|
+
import { ConfirmationDialog as p } from "./ConfirmationDialog.js";
|
|
6
|
+
import { AboutDialog as m } from "./AboutDialog.js";
|
|
7
|
+
export { m as AboutDialog, d as AppDialog, p as ConfirmationDialog, e as Dialog, t as DialogClose, n as DialogContent, r as DialogDescription, i as DialogFooter, a as DialogHeader, o as DialogOverlay, s as DialogPortal, c as DialogTitle, l as DialogTrigger, f as FormDialog, u as Progress };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { useKrosoftTranslation as e } from "../../../i18n/useKrosoftTranslation.js";
|
|
2
|
+
import { Badge as t } from "../../ui/badge.js";
|
|
3
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
|
+
import { getLocale as i } from "@krosoft/core/helpers";
|
|
5
|
+
import { XIcon as a } from "lucide-react";
|
|
6
|
+
//#region src/components/core/filters/ActiveFilters.tsx
|
|
7
|
+
var o = (e, t, n, r = {}) => {
|
|
8
|
+
if (t instanceof Date) return t.toLocaleDateString(i());
|
|
9
|
+
let a = String(t), o = r[`${e}_${a}`];
|
|
10
|
+
return o === void 0 ? e.includes("ok") || t === "true" || t === "false" ? n(t === "true" ? "filters.yes" : "filters.no") : a : o;
|
|
11
|
+
};
|
|
12
|
+
function s({ filters: i, onRemoveFilter: s, onClearAll: c, filterLabelKeys: l = {}, optionLabels: u = {} }) {
|
|
13
|
+
let { t: d } = e(), f = Object.entries(i).filter(([e, t]) => !(t == null || t === "" || Array.isArray(t) && t.length === 0));
|
|
14
|
+
return f.length === 0 ? null : /* @__PURE__ */ r("div", {
|
|
15
|
+
className: "flex flex-wrap items-center gap-2 mb-4",
|
|
16
|
+
children: [
|
|
17
|
+
/* @__PURE__ */ n("span", {
|
|
18
|
+
className: "text-sm text-muted-foreground font-medium",
|
|
19
|
+
children: d("filters.active")
|
|
20
|
+
}),
|
|
21
|
+
f.flatMap(([e, i]) => {
|
|
22
|
+
let c = l[e], f = c === void 0 ? e : d(c);
|
|
23
|
+
if (Array.isArray(i)) return i.map((i) => {
|
|
24
|
+
let c = o(e, i, d, u);
|
|
25
|
+
return /* @__PURE__ */ r(t, {
|
|
26
|
+
variant: "secondary",
|
|
27
|
+
className: "flex items-center gap-1 px-3 py-1 bg-primary/10 text-primary border border-primary/20 hover:bg-primary/20",
|
|
28
|
+
children: [
|
|
29
|
+
f,
|
|
30
|
+
": ",
|
|
31
|
+
c,
|
|
32
|
+
/* @__PURE__ */ n("button", {
|
|
33
|
+
onClick: () => {
|
|
34
|
+
s(e, i);
|
|
35
|
+
},
|
|
36
|
+
className: "ml-1 hover:bg-primary/20 rounded-full p-0.5",
|
|
37
|
+
children: /* @__PURE__ */ n(a, { className: "size-4" })
|
|
38
|
+
})
|
|
39
|
+
]
|
|
40
|
+
}, `${e}_${String(i)}`);
|
|
41
|
+
});
|
|
42
|
+
let p = o(e, i, d, u);
|
|
43
|
+
return /* @__PURE__ */ r(t, {
|
|
44
|
+
variant: "secondary",
|
|
45
|
+
className: "flex items-center gap-1 px-3 py-1 bg-primary/10 text-primary border border-primary/20 hover:bg-primary/20",
|
|
46
|
+
children: [
|
|
47
|
+
f,
|
|
48
|
+
": ",
|
|
49
|
+
p,
|
|
50
|
+
/* @__PURE__ */ n("button", {
|
|
51
|
+
onClick: () => {
|
|
52
|
+
s(e);
|
|
53
|
+
},
|
|
54
|
+
className: "ml-1 hover:bg-primary/20 rounded-full p-0.5",
|
|
55
|
+
children: /* @__PURE__ */ n(a, { className: "size-4" })
|
|
56
|
+
})
|
|
57
|
+
]
|
|
58
|
+
}, e);
|
|
59
|
+
}),
|
|
60
|
+
f.length > 0 && /* @__PURE__ */ n("button", {
|
|
61
|
+
onClick: c,
|
|
62
|
+
className: "text-xs text-destructive hover:text-destructive/80 transition-colors font-medium ml-auto",
|
|
63
|
+
children: d("filters.clearAll")
|
|
64
|
+
})
|
|
65
|
+
]
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
export { s as ActiveFilters };
|