@krosoft/react 0.0.380 → 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 +4 -4
- 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,99 @@
|
|
|
1
|
+
import { cn as e } from "../../../helpers/tailwind.helper.js";
|
|
2
|
+
import { useKrosoftTranslation as t } from "../../../i18n/useKrosoftTranslation.js";
|
|
3
|
+
import { Input as n } from "../../ui/input.js";
|
|
4
|
+
import { Sheet as r, SheetContent as i, SheetDescription as a, SheetTitle as o } from "../../ui/sheet.js";
|
|
5
|
+
import { Skeleton as s } from "../../ui/skeleton.js";
|
|
6
|
+
import { TooltipProvider as c } from "../../ui/tooltip.js";
|
|
7
|
+
import { SidebarNavItem as l } from "./SidebarNavItem.js";
|
|
8
|
+
import { useSidebar as u } from "../../../hooks/behavior/useSidebar.js";
|
|
9
|
+
import * as d from "react";
|
|
10
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
11
|
+
import { SearchIcon as m } from "lucide-react";
|
|
12
|
+
//#region src/components/core/navbar/Sidebar.tsx
|
|
13
|
+
var h = ({ groups: h, currentPath: g, onItemClick: _, slots: v, search: y, dense: b = !1, loading: x = !1, showCloseButton: S = !0 }) => {
|
|
14
|
+
let { t: C } = t(), { enabled: w = !1, placeholder: T } = y ?? {}, { header: E, footer: D } = v ?? {}, { collapsed: O, isMobile: k, setCollapsed: A } = u(), [j, M] = d.useState(""), N = !k && O, P = !O, F = (e) => {
|
|
15
|
+
_(e), k && A(!0);
|
|
16
|
+
}, I = j.trim().toLowerCase(), L = I === "" ? h : h.map((e) => ({
|
|
17
|
+
...e,
|
|
18
|
+
items: e.items.filter((e) => e.label.toLowerCase().includes(I) || (e.subItems?.some((e) => e.label.toLowerCase().includes(I)) ?? !1))
|
|
19
|
+
})).filter((e) => e.items.length > 0), R = /* @__PURE__ */ p("div", {
|
|
20
|
+
className: "flex flex-col h-full bg-sidebar text-sidebar-foreground",
|
|
21
|
+
children: [
|
|
22
|
+
E,
|
|
23
|
+
w && !N && /* @__PURE__ */ f("div", {
|
|
24
|
+
className: e("px-4", b ? "pt-2" : "pt-4"),
|
|
25
|
+
children: /* @__PURE__ */ p("div", {
|
|
26
|
+
className: "relative",
|
|
27
|
+
children: [/* @__PURE__ */ f(m, { className: "absolute left-3 top-1/2 size-4 -translate-y-1/2 text-sidebar-muted" }), /* @__PURE__ */ f(n, {
|
|
28
|
+
type: "search",
|
|
29
|
+
value: j,
|
|
30
|
+
onChange: (e) => {
|
|
31
|
+
M(e.target.value);
|
|
32
|
+
},
|
|
33
|
+
placeholder: T ?? C("search.placeholder"),
|
|
34
|
+
className: e("bg-sidebar-accent/40 border-sidebar-border pl-9 text-sidebar-foreground placeholder:text-sidebar-muted", b ? "h-8 text-sm" : "h-9")
|
|
35
|
+
})]
|
|
36
|
+
})
|
|
37
|
+
}),
|
|
38
|
+
/* @__PURE__ */ f("div", {
|
|
39
|
+
className: e("flex-1 overflow-y-auto scrollbar-modern", N ? "px-0" : "px-2", b ? "py-2" : "py-4"),
|
|
40
|
+
children: x ? Array.from({ length: 5 }).map((t, n) => /* @__PURE__ */ p("div", {
|
|
41
|
+
className: e("flex items-center gap-3", b ? "mb-1 h-9" : "mb-2 h-12", N ? "justify-center px-3" : "px-4"),
|
|
42
|
+
children: [/* @__PURE__ */ f(s, { className: "size-5 flex-shrink-0 rounded-control" }), !N && /* @__PURE__ */ f(s, { className: "h-4 flex-1" })]
|
|
43
|
+
}, n)) : L.map((t, n) => /* @__PURE__ */ p("div", {
|
|
44
|
+
className: b ? "mb-7" : "mb-10",
|
|
45
|
+
children: [!N && t.title !== void 0 && t.title !== "" && /* @__PURE__ */ f("h3", {
|
|
46
|
+
className: e("px-4 text-xs uppercase tracking-wider font-semibold text-sidebar-muted", b ? "mb-3" : "mb-4"),
|
|
47
|
+
children: t.title
|
|
48
|
+
}), /* @__PURE__ */ f("nav", {
|
|
49
|
+
className: e("flex flex-col", b ? "gap-0.5" : "gap-1"),
|
|
50
|
+
children: t.items.map((e, t) => /* @__PURE__ */ f(l, {
|
|
51
|
+
...e,
|
|
52
|
+
currentPath: g,
|
|
53
|
+
collapsed: N,
|
|
54
|
+
dense: b,
|
|
55
|
+
onItemClick: F
|
|
56
|
+
}, t))
|
|
57
|
+
})]
|
|
58
|
+
}, n))
|
|
59
|
+
}),
|
|
60
|
+
D && /* @__PURE__ */ f("div", {
|
|
61
|
+
className: e("border-t border-sidebar-border", b ? "p-2" : "p-4", N ? "flex justify-center" : ""),
|
|
62
|
+
children: D
|
|
63
|
+
})
|
|
64
|
+
]
|
|
65
|
+
});
|
|
66
|
+
return k ? /* @__PURE__ */ f(r, {
|
|
67
|
+
open: P,
|
|
68
|
+
onOpenChange: (e) => {
|
|
69
|
+
A(!e);
|
|
70
|
+
},
|
|
71
|
+
children: /* @__PURE__ */ p(i, {
|
|
72
|
+
side: "left",
|
|
73
|
+
className: e("w-[16rem] p-0 bg-sidebar border-r border-sidebar-border overflow-hidden", S ? "[&>button]:text-sidebar-foreground" : "[&>button]:hidden"),
|
|
74
|
+
children: [
|
|
75
|
+
/* @__PURE__ */ f(o, {
|
|
76
|
+
className: "sr-only",
|
|
77
|
+
children: C("sidebar.menu")
|
|
78
|
+
}),
|
|
79
|
+
/* @__PURE__ */ f(a, {
|
|
80
|
+
className: "sr-only",
|
|
81
|
+
children: C("sidebar.description")
|
|
82
|
+
}),
|
|
83
|
+
R
|
|
84
|
+
]
|
|
85
|
+
})
|
|
86
|
+
}) : /* @__PURE__ */ f(c, {
|
|
87
|
+
delayDuration: 0,
|
|
88
|
+
children: /* @__PURE__ */ f("aside", {
|
|
89
|
+
className: e("flex flex-col bg-sidebar h-screen border-r border-sidebar-border transition-all duration-300", N ? "w-[--navbar-width-icon]" : "w-[--navbar-width]", "flex"),
|
|
90
|
+
style: {
|
|
91
|
+
"--navbar-width": "16rem",
|
|
92
|
+
"--navbar-width-icon": "4rem"
|
|
93
|
+
},
|
|
94
|
+
children: R
|
|
95
|
+
})
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
//#endregion
|
|
99
|
+
export { h as Sidebar };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { cn as e } from "../../../helpers/tailwind.helper.js";
|
|
2
|
+
import { useSidebar as t } from "../../../hooks/behavior/useSidebar.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/core/navbar/SidebarHeader.tsx
|
|
6
|
+
var i = ({ name: i = "appname", subName: a = "appsubname", icon: o, dense: s = !1 }) => {
|
|
7
|
+
let { collapsed: c, isMobile: l } = t(), u = !l && c;
|
|
8
|
+
return /* @__PURE__ */ r("div", {
|
|
9
|
+
className: e("flex items-center flex-shrink-0 gap-3 px-4", s ? "h-14" : "h-16 md:h-20", u ? "justify-center" : ""),
|
|
10
|
+
children: [o !== void 0 && /* @__PURE__ */ n("div", {
|
|
11
|
+
className: "flex-shrink-0 text-sidebar-foreground",
|
|
12
|
+
children: /* @__PURE__ */ n(o, { className: s ? "size-5" : "size-6" })
|
|
13
|
+
}), !u && /* @__PURE__ */ r("div", {
|
|
14
|
+
className: "flex flex-col",
|
|
15
|
+
children: [/* @__PURE__ */ n("h1", {
|
|
16
|
+
className: e("font-bold text-sidebar-foreground leading-tight", s ? "text-base" : "text-lg"),
|
|
17
|
+
children: i
|
|
18
|
+
}), /* @__PURE__ */ n("span", {
|
|
19
|
+
className: e("text-sidebar-muted font-medium", s ? "text-[11px]" : "text-xs"),
|
|
20
|
+
children: a
|
|
21
|
+
})]
|
|
22
|
+
})]
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
//#endregion
|
|
26
|
+
export { i as SidebarHeader };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { cn as e } from "../../../helpers/tailwind.helper.js";
|
|
2
|
+
import { Tooltip as t, TooltipContent as n, TooltipTrigger as r } from "../../ui/tooltip.js";
|
|
3
|
+
import * as i from "react";
|
|
4
|
+
import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
5
|
+
import { ChevronDownIcon as c } from "lucide-react";
|
|
6
|
+
//#region src/components/core/navbar/SidebarNavItem.tsx
|
|
7
|
+
var l = (e, t, n) => t === e ? !0 : e === "/" || !t.startsWith(`${e}/`) ? !1 : !n.some((n) => n !== e && n.startsWith(`${e}/`) && (t === n || t.startsWith(`${n}/`))), u = ({ path: u, icon: d, label: f, badge: p, subItems: m, currentPath: h, collapsed: g, dense: _ = !1, onItemClick: v }) => {
|
|
8
|
+
let y = m?.map((e) => e.path) ?? [], [b, x] = i.useState(m?.some((e) => l(e.path, h, y)) ?? !1), S = u ? h === u || u !== "/" && h.startsWith(`${u}/`) : !1, C = m?.some((e) => l(e.path, h, y)), w = S || !g && C, T = /* @__PURE__ */ s("a", {
|
|
9
|
+
href: u ?? "#",
|
|
10
|
+
onClick: (e) => {
|
|
11
|
+
e.ctrlKey || e.metaKey || e.button === 1 || (e.preventDefault(), m && m.length > 0 ? g || x(!b) : u && v(u));
|
|
12
|
+
},
|
|
13
|
+
className: e("flex items-center cursor-pointer transition-all duration-200 group rounded-control", _ ? "gap-2.5 mb-0.5" : "gap-3 mb-1", g ? _ ? "justify-center p-2 h-9 w-9 mx-auto" : "justify-center p-3 h-12 w-12 mx-auto" : _ ? "px-3 py-1.5 h-9" : "px-4 py-3 h-12", w ? "bg-sidebar-primary/10 text-sidebar-primary font-semibold border border-sidebar-primary/40 [&_svg]:text-sidebar-primary" : "border border-transparent hover:bg-sidebar-accent text-sidebar-foreground hover:text-sidebar-accent-foreground"),
|
|
14
|
+
children: [/* @__PURE__ */ o("div", {
|
|
15
|
+
className: e("flex-shrink-0 transition-transform group-hover:scale-110", g ? "flex items-center justify-center" : ""),
|
|
16
|
+
children: /* @__PURE__ */ o(d, { className: e("size-4", w && "text-sidebar-primary") })
|
|
17
|
+
}), !g && /* @__PURE__ */ s(a, { children: [
|
|
18
|
+
/* @__PURE__ */ o("span", {
|
|
19
|
+
className: e("flex-grow transition-opacity duration-150", w ? "font-semibold" : "font-medium", _ ? "text-sm" : ""),
|
|
20
|
+
children: f
|
|
21
|
+
}),
|
|
22
|
+
p !== void 0 && /* @__PURE__ */ o("span", {
|
|
23
|
+
className: "bg-red-500 text-white text-xs rounded-full py-1 min-w-[20px] text-center px-2 font-semibold",
|
|
24
|
+
children: p
|
|
25
|
+
}),
|
|
26
|
+
m && m.length > 0 && /* @__PURE__ */ o(c, { className: e("size-4 transition-transform duration-200", b ? "rotate-180" : "") })
|
|
27
|
+
] })]
|
|
28
|
+
});
|
|
29
|
+
return /* @__PURE__ */ s(a, { children: [g ? /* @__PURE__ */ s(t, { children: [/* @__PURE__ */ o(r, {
|
|
30
|
+
asChild: !0,
|
|
31
|
+
children: T
|
|
32
|
+
}), /* @__PURE__ */ o(n, {
|
|
33
|
+
side: "right",
|
|
34
|
+
sideOffset: 6,
|
|
35
|
+
className: "rounded-surface z-[99999] flex gap-2 bg-sidebar text-sidebar-foreground border border-sidebar-border py-2 text-sm shadow-lg",
|
|
36
|
+
children: /* @__PURE__ */ o("div", {
|
|
37
|
+
className: "flex flex-col gap-2",
|
|
38
|
+
children: /* @__PURE__ */ s("div", {
|
|
39
|
+
className: "flex items-center gap-2",
|
|
40
|
+
children: [/* @__PURE__ */ o("p", {
|
|
41
|
+
className: "font-semibold",
|
|
42
|
+
children: f
|
|
43
|
+
}), p !== void 0 && /* @__PURE__ */ s("span", {
|
|
44
|
+
className: "ml-1 text-xs",
|
|
45
|
+
children: [
|
|
46
|
+
"(",
|
|
47
|
+
p,
|
|
48
|
+
")"
|
|
49
|
+
]
|
|
50
|
+
})]
|
|
51
|
+
})
|
|
52
|
+
})
|
|
53
|
+
})] }) : T, !g && m && m.length > 0 && b && /* @__PURE__ */ o("div", {
|
|
54
|
+
className: e("flex flex-col ml-4 pl-4 border-l-2 border-sidebar-border/50 animate-in slide-in-from-top-2 fade-in duration-200", _ ? "gap-0.5 mb-0.5" : "gap-1 mb-2"),
|
|
55
|
+
children: m.map((t, n) => {
|
|
56
|
+
let r = l(t.path, h, y);
|
|
57
|
+
return /* @__PURE__ */ s("a", {
|
|
58
|
+
href: t.path,
|
|
59
|
+
onClick: (e) => {
|
|
60
|
+
e.ctrlKey || e.metaKey || e.button === 1 || (e.preventDefault(), v(t.path));
|
|
61
|
+
},
|
|
62
|
+
className: e("flex items-center justify-between rounded-control text-sm transition-all duration-200", _ ? "px-3 py-1" : "px-4 py-2", r ? "bg-sidebar-accent/50 text-sidebar-primary font-semibold" : "text-sidebar-muted hover:bg-sidebar-accent hover:text-sidebar-foreground"),
|
|
63
|
+
children: [/* @__PURE__ */ o("span", { children: t.label }), t.badge !== void 0 && /* @__PURE__ */ o("span", {
|
|
64
|
+
className: "bg-sidebar-primary/20 text-sidebar-primary text-[10px] rounded-full py-0.5 px-2 font-semibold",
|
|
65
|
+
children: t.badge
|
|
66
|
+
})]
|
|
67
|
+
}, n);
|
|
68
|
+
})
|
|
69
|
+
})] });
|
|
70
|
+
};
|
|
71
|
+
//#endregion
|
|
72
|
+
export { u as SidebarNavItem };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { cn as e } from "../../../helpers/tailwind.helper.js";
|
|
2
|
+
import { Button as t } from "../../ui/button.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
5
|
+
import { MenuIcon as i } from "lucide-react";
|
|
6
|
+
//#region src/components/core/navbar/Topbar.tsx
|
|
7
|
+
var a = ({ collapsed: a, isMobile: o, onToggleSidebar: s, actionsNode: c, userMenuNode: l }) => /* @__PURE__ */ r("header", {
|
|
8
|
+
className: e("fixed top-0 right-0 z-[60] h-16 md:h-20 bg-topbar text-topbar-foreground flex items-center justify-between px-4 transition-all duration-300", o && "left-0", !o && a && "left-[5rem]", !o && !a && "left-[16rem]"),
|
|
9
|
+
tabIndex: -1,
|
|
10
|
+
children: [/* @__PURE__ */ n("div", {
|
|
11
|
+
className: "flex items-center min-w-0 flex-1",
|
|
12
|
+
children: /* @__PURE__ */ n(t, {
|
|
13
|
+
variant: "ghost",
|
|
14
|
+
size: "icon",
|
|
15
|
+
onClick: s,
|
|
16
|
+
className: "text-topbar-foreground hover:bg-topbar-accent hover:text-topbar-accent-foreground",
|
|
17
|
+
children: /* @__PURE__ */ n(i, { className: "size-4" })
|
|
18
|
+
})
|
|
19
|
+
}), /* @__PURE__ */ r("div", {
|
|
20
|
+
className: "flex items-center gap-2 md:gap-4 flex-shrink-0",
|
|
21
|
+
children: [c, l]
|
|
22
|
+
})]
|
|
23
|
+
});
|
|
24
|
+
//#endregion
|
|
25
|
+
export { a as Topbar };
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { GlobalSearch as e } from "./GlobalSearch.js";
|
|
2
|
+
import { NotificationsBell as t } from "./NotificationsBell.js";
|
|
3
|
+
import { SidebarNavItem as n } from "./SidebarNavItem.js";
|
|
4
|
+
import { Sidebar as r } from "./Sidebar.js";
|
|
5
|
+
import { SidebarHeader as i } from "./SidebarHeader.js";
|
|
6
|
+
import { Topbar as a } from "./Topbar.js";
|
|
7
|
+
export { e as GlobalSearch, t as NotificationsBell, r as Sidebar, i as SidebarHeader, n as SidebarNavItem, a as Topbar };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useKrosoftTranslation as e } from "../../../i18n/useKrosoftTranslation.js";
|
|
2
|
+
import { Alert as t, AlertDescription as n } from "../../ui/alert.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
5
|
import { AlertTriangle as a } from "lucide-react";
|
|
@@ -11,10 +11,10 @@ var o = (e) => e instanceof Error ? {} : {
|
|
|
11
11
|
let { t: l } = e();
|
|
12
12
|
if (!s) return null;
|
|
13
13
|
let { code: u, errors: d } = o(s);
|
|
14
|
-
return /* @__PURE__ */ i(
|
|
14
|
+
return /* @__PURE__ */ i(t, {
|
|
15
15
|
variant: "destructive",
|
|
16
16
|
className: c,
|
|
17
|
-
children: [/* @__PURE__ */ r(a, { className: "size-4" }), /* @__PURE__ */ i(
|
|
17
|
+
children: [/* @__PURE__ */ r(a, { className: "size-4" }), /* @__PURE__ */ i(n, { children: [/* @__PURE__ */ i("div", {
|
|
18
18
|
className: "flex items-center space-x-2",
|
|
19
19
|
children: [
|
|
20
20
|
/* @__PURE__ */ r("span", {
|
|
@@ -34,4 +34,4 @@ var o = (e) => e instanceof Error ? {} : {
|
|
|
34
34
|
});
|
|
35
35
|
};
|
|
36
36
|
//#endregion
|
|
37
|
-
export { s as
|
|
37
|
+
export { s as ErrorAlert };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useKrosoftTranslation as e } from "../../../i18n/useKrosoftTranslation.js";
|
|
2
2
|
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
|
-
import { Loader2Icon as r } from "lucide-react";
|
|
4
3
|
//#region src/components/core/states/ErrorState.tsx
|
|
5
|
-
var
|
|
4
|
+
var r = ({ message: r }) => {
|
|
6
5
|
let { t: i } = e();
|
|
7
6
|
return /* @__PURE__ */ n("div", {
|
|
8
7
|
className: "p-6 border border-destructive bg-destructive/10 text-destructive rounded-surface animate-fade-in",
|
|
@@ -14,12 +13,6 @@ var i = ({ message: r }) => {
|
|
|
14
13
|
children: r
|
|
15
14
|
}) : null]
|
|
16
15
|
});
|
|
17
|
-
}
|
|
18
|
-
className: "flex flex-col items-center justify-center p-12 text-muted-foreground animate-fade-in",
|
|
19
|
-
children: [/* @__PURE__ */ t(r, { className: "size-8 animate-spin mb-4 text-primary" }), e !== void 0 && e !== "" ? /* @__PURE__ */ t("p", {
|
|
20
|
-
className: "font-semibold text-sm",
|
|
21
|
-
children: e
|
|
22
|
-
}) : null]
|
|
23
|
-
});
|
|
16
|
+
};
|
|
24
17
|
//#endregion
|
|
25
|
-
export {
|
|
18
|
+
export { r as ErrorState };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
import { Loader2Icon as n } from "lucide-react";
|
|
3
|
+
//#region src/components/core/states/LoadingState.tsx
|
|
4
|
+
var r = ({ message: r }) => /* @__PURE__ */ t("div", {
|
|
5
|
+
className: "flex flex-col items-center justify-center p-12 text-muted-foreground animate-fade-in",
|
|
6
|
+
children: [/* @__PURE__ */ e(n, { className: "size-8 animate-spin mb-4 text-primary" }), r !== void 0 && r !== "" ? /* @__PURE__ */ e("p", {
|
|
7
|
+
className: "font-semibold text-sm",
|
|
8
|
+
children: r
|
|
9
|
+
}) : null]
|
|
10
|
+
});
|
|
11
|
+
//#endregion
|
|
12
|
+
export { r as LoadingState };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ErrorAlert as e } from "./ErrorAlert.js";
|
|
2
|
+
import { ErrorState as t } from "./ErrorState.js";
|
|
3
|
+
import { LoadingState as n } from "./LoadingState.js";
|
|
3
4
|
export { e as ErrorAlert, t as ErrorState, n as LoadingState };
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { useDataTable as e } from "../../../hooks/ui/useDataTable.js";
|
|
2
|
+
import { useFixedColumns as t } from "../../../hooks/ui/useFixedColumns.js";
|
|
3
|
+
import { pageSizeDefault as n, pagesSizes as r } from "../../../constants/datatable.js";
|
|
4
|
+
import { TableBody as i } from "./TableBody.js";
|
|
5
|
+
import { TableBulkActions as ee } from "./TableBulkActions.js";
|
|
6
|
+
import { TableHeader as a } from "./TableHeader.js";
|
|
7
|
+
import { TablePagination as o } from "./TablePagination.js";
|
|
8
|
+
import { TableSettings as s } from "./TableSettings.js";
|
|
9
|
+
import { useMemo as c } from "react";
|
|
10
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
11
|
+
//#region src/components/core/table/DataTable.tsx
|
|
12
|
+
function d({ data: d, isLoading: te = !1, error: f = null, config: p, server: m }) {
|
|
13
|
+
let { columns: h, rowKey: g, rowSelectable: _, onRowClick: v, onRowNavigate: y, rowNavigable: b, actions: x, bulkActions: S } = p, ne = p.pageSizeDefault ?? n, re = p.pageSizeOptions ?? r, C = p.dense ?? !1, w = p.bordered ?? !1, T = p.draggableColumns ?? !1, E = p.resizableColumns ?? !1, D = p.columnVisibility ?? !1, O = p.fixedActions ?? !1, { sortColumn: k, sortDirection: A, selectedRows: j, setSelectedRows: M, visibleColumns: N, columnWidths: P, safeCurrentPage: F, totalPages: I, startIndex: L, endIndex: R, tableRef: z, hasActions: B, hasBulkActions: V, visibleColumnsArray: H, colSpanCount: ie, paginatedData: U, handleSort: W, handleMouseDown: G, handleDragStart: K, handleDragOver: q, handleDrop: J, toggleColumnVisibility: Y, setColumnsVisibility: ae, toggleRowSelection: oe, toggleSelectAll: se, pageSize: ce, setPageSize: le, setCurrentPage: ue } = e({
|
|
14
|
+
data: d,
|
|
15
|
+
columns: h,
|
|
16
|
+
rowKey: g,
|
|
17
|
+
rowSelectable: _,
|
|
18
|
+
pageSizeDefault: ne,
|
|
19
|
+
actions: x,
|
|
20
|
+
bulkActions: S,
|
|
21
|
+
columnVisibility: D,
|
|
22
|
+
columnVisibilityState: p.columnVisibilityState,
|
|
23
|
+
onColumnVisibilityChange: p.onColumnVisibilityChange,
|
|
24
|
+
columnVisibilityStorage: p.columnVisibilityStorage,
|
|
25
|
+
server: m
|
|
26
|
+
}), de = V && H.some((e) => e.fixed === "left"), X = t(z), Z = c(() => new Set(j.map(g)), [j, g]), Q = c(() => _ === void 0 ? d : d.filter(_), [d, _]), $ = Q.length > 0 && Q.every((e) => Z.has(g(e))), fe = !$ && Q.some((e) => Z.has(g(e)));
|
|
27
|
+
return /* @__PURE__ */ u("div", {
|
|
28
|
+
className: "space-y-4 [--k-radius-control:var(--k-radius-control-dense,0.5rem)] [--k-radius-surface:var(--k-radius-surface-dense,0.75rem)]",
|
|
29
|
+
children: [j.length > 0 && S !== void 0 && S.length > 0 && /* @__PURE__ */ l(ee, {
|
|
30
|
+
selectedRows: j,
|
|
31
|
+
setSelectedRows: M,
|
|
32
|
+
bulkActions: S
|
|
33
|
+
}), /* @__PURE__ */ u("div", {
|
|
34
|
+
className: "w-full bg-card rounded-surface border border-border overflow-hidden",
|
|
35
|
+
children: [/* @__PURE__ */ l("div", {
|
|
36
|
+
className: "overflow-x-auto",
|
|
37
|
+
children: /* @__PURE__ */ u("table", {
|
|
38
|
+
ref: z,
|
|
39
|
+
className: "w-full",
|
|
40
|
+
children: [/* @__PURE__ */ l(a, {
|
|
41
|
+
hasBulkActions: V,
|
|
42
|
+
allSelected: $,
|
|
43
|
+
someSelected: fe,
|
|
44
|
+
toggleSelectAll: se,
|
|
45
|
+
visibleColumnsArray: H,
|
|
46
|
+
draggableColumns: T,
|
|
47
|
+
resizableColumns: E,
|
|
48
|
+
columnWidths: P,
|
|
49
|
+
sortColumn: k,
|
|
50
|
+
sortDirection: A,
|
|
51
|
+
handleSort: W,
|
|
52
|
+
handleDragStart: K,
|
|
53
|
+
handleDragOver: q,
|
|
54
|
+
handleDrop: J,
|
|
55
|
+
handleMouseDown: G,
|
|
56
|
+
hasActions: B,
|
|
57
|
+
bordered: w,
|
|
58
|
+
dense: C,
|
|
59
|
+
fixedColumns: X,
|
|
60
|
+
fixedSelection: de,
|
|
61
|
+
fixedActions: O,
|
|
62
|
+
settingsNode: D ? /* @__PURE__ */ l(s, {
|
|
63
|
+
columns: h,
|
|
64
|
+
visibleColumns: N,
|
|
65
|
+
toggleColumnVisibility: Y,
|
|
66
|
+
setColumnsVisibility: ae
|
|
67
|
+
}) : void 0
|
|
68
|
+
}), /* @__PURE__ */ l(i, {
|
|
69
|
+
bordered: w,
|
|
70
|
+
dense: C,
|
|
71
|
+
isLoading: te,
|
|
72
|
+
error: f,
|
|
73
|
+
colSpanCount: ie,
|
|
74
|
+
messages: p.messages,
|
|
75
|
+
paginatedData: U,
|
|
76
|
+
rowKey: g,
|
|
77
|
+
onRowClick: v,
|
|
78
|
+
onRowNavigate: y,
|
|
79
|
+
rowNavigable: b,
|
|
80
|
+
hasBulkActions: V,
|
|
81
|
+
rowSelectable: _,
|
|
82
|
+
selectedKeys: Z,
|
|
83
|
+
toggleRowSelection: oe,
|
|
84
|
+
visibleColumnsArray: H,
|
|
85
|
+
columnWidths: P,
|
|
86
|
+
hasActions: B || D,
|
|
87
|
+
actions: x,
|
|
88
|
+
columns: h,
|
|
89
|
+
resizableColumns: E,
|
|
90
|
+
fixedColumns: X
|
|
91
|
+
})]
|
|
92
|
+
})
|
|
93
|
+
}), /* @__PURE__ */ l(o, {
|
|
94
|
+
totalItems: m?.totalRows ?? d.length,
|
|
95
|
+
startIndex: L,
|
|
96
|
+
endIndex: R,
|
|
97
|
+
pageSize: ce,
|
|
98
|
+
setPageSize: le,
|
|
99
|
+
currentPage: F,
|
|
100
|
+
setCurrentPage: ue,
|
|
101
|
+
pageSizeOptions: re,
|
|
102
|
+
totalPages: I
|
|
103
|
+
})]
|
|
104
|
+
})]
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
//#endregion
|
|
108
|
+
export { d as DataTable };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { useKrosoftTranslation as e } from "../../../i18n/useKrosoftTranslation.js";
|
|
2
|
+
import { Label as t } from "../../ui/label.js";
|
|
3
|
+
import { SimpleTable as n, SimpleTableBody as r, SimpleTableCell as i, SimpleTableHead as a, SimpleTableHeader as o, SimpleTableRow as s } from "../../ui/simple-table.js";
|
|
4
|
+
import { Switch as c } from "../../ui/switch.js";
|
|
5
|
+
import { useState as l } from "react";
|
|
6
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
7
|
+
import { formatJsonValue as f, isRecord as p, tryParseJson as m } from "@krosoft/core/helpers";
|
|
8
|
+
//#region src/components/core/table/JsonTableOutput.tsx
|
|
9
|
+
var h = ({ header: h, output: g }) => {
|
|
10
|
+
let { t: _ } = e(), [v, y] = l(!0), b = m(g), x = b !== null, S = () => /* @__PURE__ */ d("div", {
|
|
11
|
+
className: "flex items-center justify-between mb-2",
|
|
12
|
+
children: [/* @__PURE__ */ u("span", {
|
|
13
|
+
className: "font-medium text-sm",
|
|
14
|
+
children: h
|
|
15
|
+
}), /* @__PURE__ */ d("div", {
|
|
16
|
+
className: "flex items-center gap-2",
|
|
17
|
+
children: [/* @__PURE__ */ u(c, {
|
|
18
|
+
id: "table-mode",
|
|
19
|
+
checked: v,
|
|
20
|
+
onCheckedChange: y
|
|
21
|
+
}), /* @__PURE__ */ u(t, {
|
|
22
|
+
htmlFor: "table-mode",
|
|
23
|
+
className: "text-xs",
|
|
24
|
+
children: _("table.tableMode")
|
|
25
|
+
})]
|
|
26
|
+
})]
|
|
27
|
+
}), C = ({ children: e }) => /* @__PURE__ */ u("div", {
|
|
28
|
+
className: "border rounded min-w-0 w-full",
|
|
29
|
+
children: /* @__PURE__ */ u(n, { children: e })
|
|
30
|
+
}), w = () => /* @__PURE__ */ u("pre", {
|
|
31
|
+
className: "text-xs bg-muted p-4 rounded overflow-x-auto whitespace-pre-wrap",
|
|
32
|
+
children: x && !v ? JSON.stringify(b, null, 2) : g
|
|
33
|
+
});
|
|
34
|
+
return g ? /* @__PURE__ */ d("div", {
|
|
35
|
+
className: "min-w-0 w-full",
|
|
36
|
+
children: [S(), (() => {
|
|
37
|
+
if (!x || !v) return /* @__PURE__ */ u(w, {});
|
|
38
|
+
if (Array.isArray(b) && b.length > 0 && p(b[0])) {
|
|
39
|
+
let e = b, t = Object.keys(e[0]);
|
|
40
|
+
return /* @__PURE__ */ d(C, { children: [/* @__PURE__ */ u(o, {
|
|
41
|
+
className: "bg-muted/50",
|
|
42
|
+
children: /* @__PURE__ */ u(s, { children: t.map((e) => /* @__PURE__ */ u(a, {
|
|
43
|
+
className: "font-medium",
|
|
44
|
+
children: e
|
|
45
|
+
}, e)) })
|
|
46
|
+
}), /* @__PURE__ */ u(r, { children: e.map((e, n) => /* @__PURE__ */ u(s, { children: t.map((t) => /* @__PURE__ */ u(i, {
|
|
47
|
+
className: "text-sm whitespace-pre-wrap",
|
|
48
|
+
children: f(e[t])
|
|
49
|
+
}, t)) }, n)) })] });
|
|
50
|
+
}
|
|
51
|
+
if (p(b)) {
|
|
52
|
+
let e = Object.entries(b);
|
|
53
|
+
return /* @__PURE__ */ d(C, { children: [/* @__PURE__ */ u(o, {
|
|
54
|
+
className: "bg-muted/50",
|
|
55
|
+
children: /* @__PURE__ */ d(s, { children: [/* @__PURE__ */ u(a, {
|
|
56
|
+
className: "font-medium",
|
|
57
|
+
children: _("table.property")
|
|
58
|
+
}), /* @__PURE__ */ u(a, {
|
|
59
|
+
className: "font-medium",
|
|
60
|
+
children: _("table.value")
|
|
61
|
+
})] })
|
|
62
|
+
}), /* @__PURE__ */ u(r, { children: e.map(([e, t]) => /* @__PURE__ */ d(s, { children: [/* @__PURE__ */ u(i, {
|
|
63
|
+
className: "font-medium text-sm",
|
|
64
|
+
children: e
|
|
65
|
+
}), /* @__PURE__ */ u(i, {
|
|
66
|
+
className: "text-sm whitespace-pre-wrap",
|
|
67
|
+
children: f(t)
|
|
68
|
+
})] }, e)) })] });
|
|
69
|
+
}
|
|
70
|
+
return /* @__PURE__ */ u(w, {});
|
|
71
|
+
})()]
|
|
72
|
+
}) : null;
|
|
73
|
+
};
|
|
74
|
+
//#endregion
|
|
75
|
+
export { h as JsonTableOutput };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { useKrosoftTranslation as e } from "../../../i18n/useKrosoftTranslation.js";
|
|
2
|
+
import { Button as t } from "../../ui/button.js";
|
|
3
|
+
import { DropdownMenu as n, DropdownMenuContent as r, DropdownMenuItem as i, DropdownMenuTrigger as a } from "../../ui/dropdown-menu.js";
|
|
4
|
+
import { Tooltip as o, TooltipContent as s, TooltipProvider as c, TooltipTrigger as l } from "../../ui/tooltip.js";
|
|
5
|
+
import "react";
|
|
6
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
7
|
+
import { MoreVerticalIcon as f } from "lucide-react";
|
|
8
|
+
//#region src/components/core/table/TableActions.tsx
|
|
9
|
+
function p({ actions: p, row: m }) {
|
|
10
|
+
let { t: h } = e(), g = p.filter((e) => e.visible === void 0 || e.visible(m));
|
|
11
|
+
if (g.length === 0) return null;
|
|
12
|
+
let _ = g.filter((e) => e.overflow !== !0), v = g.filter((e) => e.overflow === !0);
|
|
13
|
+
return /* @__PURE__ */ u(c, { children: /* @__PURE__ */ d("div", {
|
|
14
|
+
className: "flex items-center justify-end gap-1",
|
|
15
|
+
children: [_.map((e, n) => {
|
|
16
|
+
let r = e.icon, i = h(e.labelKey), a = e.disabled?.(m) ?? !1;
|
|
17
|
+
return e.iconOnly === !0 && r !== void 0 ? /* @__PURE__ */ d(o, { children: [/* @__PURE__ */ u(l, {
|
|
18
|
+
asChild: !0,
|
|
19
|
+
children: /* @__PURE__ */ u("span", {
|
|
20
|
+
className: "inline-flex",
|
|
21
|
+
tabIndex: a ? 0 : void 0,
|
|
22
|
+
children: /* @__PURE__ */ u(t, {
|
|
23
|
+
variant: e.variant ?? "ghost",
|
|
24
|
+
size: "icon",
|
|
25
|
+
disabled: a,
|
|
26
|
+
"aria-label": i,
|
|
27
|
+
className: `h-7 w-7 text-muted-foreground hover:text-foreground ${e.className ?? ""}`,
|
|
28
|
+
onClick: (t) => {
|
|
29
|
+
t.stopPropagation(), e.onClick(m);
|
|
30
|
+
},
|
|
31
|
+
children: /* @__PURE__ */ u(r, { className: "size-3.5" })
|
|
32
|
+
})
|
|
33
|
+
})
|
|
34
|
+
}), /* @__PURE__ */ u(s, { children: i })] }, n) : /* @__PURE__ */ d(t, {
|
|
35
|
+
variant: e.variant ?? "ghost",
|
|
36
|
+
size: "sm",
|
|
37
|
+
disabled: a,
|
|
38
|
+
className: `h-7 px-2 text-muted-foreground hover:text-foreground ${e.className ?? ""}`,
|
|
39
|
+
onClick: (t) => {
|
|
40
|
+
t.stopPropagation(), e.onClick(m);
|
|
41
|
+
},
|
|
42
|
+
children: [r !== void 0 && /* @__PURE__ */ u(r, { className: "size-3.5" }), i]
|
|
43
|
+
}, n);
|
|
44
|
+
}), v.length > 0 && /* @__PURE__ */ d(n, { children: [/* @__PURE__ */ u(a, {
|
|
45
|
+
asChild: !0,
|
|
46
|
+
children: /* @__PURE__ */ u(t, {
|
|
47
|
+
variant: "ghost",
|
|
48
|
+
size: "icon",
|
|
49
|
+
className: "h-7 w-7 text-muted-foreground hover:text-foreground",
|
|
50
|
+
children: /* @__PURE__ */ u(f, { className: "size-3.5" })
|
|
51
|
+
})
|
|
52
|
+
}), /* @__PURE__ */ u(r, {
|
|
53
|
+
align: "end",
|
|
54
|
+
onClick: (e) => {
|
|
55
|
+
e.stopPropagation();
|
|
56
|
+
},
|
|
57
|
+
children: v.map((e, t) => {
|
|
58
|
+
let n = e.icon;
|
|
59
|
+
return /* @__PURE__ */ d(i, {
|
|
60
|
+
disabled: e.disabled?.(m) ?? !1,
|
|
61
|
+
onClick: () => {
|
|
62
|
+
e.onClick(m);
|
|
63
|
+
},
|
|
64
|
+
className: e.className,
|
|
65
|
+
children: [n !== void 0 && /* @__PURE__ */ u("span", {
|
|
66
|
+
className: "mr-2 size-4 flex items-center justify-center",
|
|
67
|
+
children: /* @__PURE__ */ u(n, { className: "size-4" })
|
|
68
|
+
}), h(e.labelKey)]
|
|
69
|
+
}, t);
|
|
70
|
+
})
|
|
71
|
+
})] })]
|
|
72
|
+
}) });
|
|
73
|
+
}
|
|
74
|
+
//#endregion
|
|
75
|
+
export { p as TableActions };
|