@krosoft/react 0.0.391 → 0.0.393
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 +1 -2
- package/dist/components/core/cards/DashboardCard.js +7 -8
- package/dist/components/core/cards/KpiCard.js +13 -14
- package/dist/components/core/cards/KpiCards.js +1 -2
- package/dist/components/core/cards/MetricCard.js +1 -2
- package/dist/components/core/cards/SkeletonCard.js +1 -2
- package/dist/components/core/cards/SkeletonCards.js +1 -2
- package/dist/components/core/changelog/AppChangelog.js +13 -14
- package/dist/components/core/changelog/AppChangelogEntry.js +19 -20
- package/dist/components/core/changelog/AppChangelogNav.js +1 -2
- package/dist/components/core/changelog/AppChangelogTagFilter.js +11 -12
- package/dist/components/core/charts/BarChartHorizontal.js +6 -7
- package/dist/components/core/charts/BarChartVertical.js +6 -7
- package/dist/components/core/charts/ChartCard.js +7 -8
- package/dist/components/core/charts/CircularGauge.js +1 -2
- package/dist/components/core/charts/LineChart.js +6 -7
- package/dist/components/core/charts/PieChart.js +12 -13
- package/dist/components/core/charts/chartColors.js +1 -2
- package/dist/components/core/charts/chartTooltip.helper.js +1 -2
- package/dist/components/core/dialogs/AboutDialog.js +11 -12
- package/dist/components/core/dialogs/AppDialog.js +27 -28
- package/dist/components/core/dialogs/ConfirmationDialog.js +15 -16
- package/dist/components/core/dialogs/FormDialog.js +7 -8
- package/dist/components/core/dialogs/index.js +4 -4
- package/dist/components/core/filters/ActiveFilters.js +1 -2
- package/dist/components/core/filters/AdvancedFilters.js +1 -2
- package/dist/components/core/filters/ConditionFilter.js +19 -20
- package/dist/components/core/filters/ConditionFilterGroup.js +1 -2
- package/dist/components/core/filters/FilterField.js +9 -10
- package/dist/components/core/filters/FilterPills.js +1 -2
- package/dist/components/core/filters/FilterPillsGroup.js +1 -2
- package/dist/components/core/filters/FiltersContainer.js +6 -7
- package/dist/components/core/filters/FiltersMobileDrawer.js +1 -2
- package/dist/components/core/filters/TableFilter.js +5 -6
- package/dist/components/core/filters/index.js +7 -7
- package/dist/components/core/forms/GenericForm.js +119 -120
- package/dist/components/core/icons/FlagFrIcon.js +1 -2
- package/dist/components/core/icons/FlagGbIcon.js +1 -2
- package/dist/components/core/inputs/DatePicker.js +9 -10
- package/dist/components/core/inputs/DateRangePicker.js +19 -20
- package/dist/components/core/inputs/FileDropzone.js +2 -3
- package/dist/components/core/inputs/ImageInput.js +9 -10
- package/dist/components/core/inputs/MultiSelect.js +89 -90
- package/dist/components/core/inputs/RatingInput.js +1 -2
- package/dist/components/core/inputs/SearchInput.js +7 -8
- package/dist/components/core/inputs/SingleSelect.js +36 -37
- package/dist/components/core/inputs/index.js +5 -5
- package/dist/components/core/inputs/select.helper.js +1 -2
- package/dist/components/core/language/LanguageSelector.js +1 -2
- package/dist/components/core/layouts/AppActions.js +44 -45
- package/dist/components/core/layouts/AppPageHeader.js +9 -10
- package/dist/components/core/layouts/AppSubTitle.js +1 -2
- package/dist/components/core/layouts/AppTitle.js +1 -2
- package/dist/components/core/layouts/KpiCardsLayout.js +1 -2
- package/dist/components/core/layouts/index.js +4 -4
- package/dist/components/core/markdown/AppMarkdown.js +1 -2
- package/dist/components/core/markdown/AppMarkdownHeading.js +4 -5
- package/dist/components/core/navbar/GlobalSearch.js +16 -17
- package/dist/components/core/navbar/NotificationsBell.js +21 -22
- package/dist/components/core/navbar/Sidebar.js +32 -33
- package/dist/components/core/navbar/SidebarHeader.js +1 -2
- package/dist/components/core/navbar/SidebarNavItem.js +20 -21
- package/dist/components/core/navbar/Topbar.js +5 -6
- package/dist/components/core/navbar/index.js +4 -4
- package/dist/components/core/states/ErrorAlert.js +1 -2
- package/dist/components/core/states/ErrorState.js +1 -2
- package/dist/components/core/states/LoadingState.js +1 -2
- package/dist/components/core/table/DataTable.js +1 -2
- package/dist/components/core/table/JsonTableOutput.js +17 -18
- package/dist/components/core/table/TableActions.js +31 -32
- package/dist/components/core/table/TableBody.js +25 -26
- package/dist/components/core/table/TableBulkActions.js +11 -12
- package/dist/components/core/table/TableHeader.js +15 -16
- package/dist/components/core/table/TablePagination.js +1 -2
- package/dist/components/core/table/TableSettings.js +20 -21
- package/dist/components/core/table/index.js +7 -7
- package/dist/components/core/tabs/AppTabContainer.js +1 -2
- package/dist/components/core/tabs/AppTabHeader.js +1 -2
- package/dist/components/core/tabs/AppTabs.js +10 -11
- package/dist/components/core/tabs/AppVerticalTabs.js +10 -11
- package/dist/components/core/tabs/index.js +3 -3
- package/dist/components/core/theme/ThemeSelector.js +1 -2
- package/dist/components/ui/accordion.js +1 -2
- package/dist/components/ui/alert-dialog.js +1 -2
- package/dist/components/ui/alert.js +1 -2
- package/dist/components/ui/aspect-ratio.js +1 -2
- package/dist/components/ui/avatar.js +1 -2
- package/dist/components/ui/badge.js +1 -2
- package/dist/components/ui/breadcrumb.js +1 -2
- package/dist/components/ui/button.js +1 -2
- package/dist/components/ui/calendar.js +8 -9
- package/dist/components/ui/card.js +1 -2
- package/dist/components/ui/carousel.js +1 -2
- package/dist/components/ui/chart.js +1 -2
- package/dist/components/ui/checkbox.js +1 -2
- package/dist/components/ui/collapsible.js +1 -2
- package/dist/components/ui/command.js +19 -20
- package/dist/components/ui/context-menu.js +1 -2
- package/dist/components/ui/control.js +1 -2
- package/dist/components/ui/dialog.js +1 -2
- package/dist/components/ui/drawer.js +1 -2
- package/dist/components/ui/dropdown-menu.js +1 -2
- package/dist/components/ui/form.js +1 -2
- package/dist/components/ui/hover-card.js +1 -2
- package/dist/components/ui/index.js +19 -19
- package/dist/components/ui/input-otp.js +1 -2
- package/dist/components/ui/input.js +1 -2
- package/dist/components/ui/label.js +1 -2
- package/dist/components/ui/menubar.js +1 -2
- package/dist/components/ui/navigation-menu.js +1 -2
- package/dist/components/ui/pagination.js +1 -2
- package/dist/components/ui/popover.js +1 -2
- package/dist/components/ui/progress.js +1 -2
- package/dist/components/ui/radio-group.js +1 -2
- package/dist/components/ui/resizable.js +1 -2
- package/dist/components/ui/scroll-area.js +1 -2
- package/dist/components/ui/select.js +1 -2
- package/dist/components/ui/separator.js +1 -2
- package/dist/components/ui/sheet.js +1 -2
- package/dist/components/ui/simple-table.js +1 -2
- package/dist/components/ui/skeleton.js +1 -2
- package/dist/components/ui/slider.js +1 -2
- package/dist/components/ui/sonner.js +1 -2
- package/dist/components/ui/switch.js +1 -2
- package/dist/components/ui/tabs.js +1 -2
- package/dist/components/ui/textarea.js +1 -2
- package/dist/components/ui/toast.js +1 -2
- package/dist/components/ui/toaster.js +10 -11
- package/dist/components/ui/toggle-group.js +1 -2
- package/dist/components/ui/toggle.js +1 -2
- package/dist/components/ui/tooltip.js +1 -2
- package/dist/constants/datatable.js +1 -2
- package/dist/constants/search.js +1 -2
- package/dist/contexts/page.context.js +1 -2
- package/dist/contexts/sidebar.context.js +1 -2
- package/dist/helpers/changelog.helper.js +1 -2
- package/dist/helpers/markdown.helper.js +1 -2
- package/dist/helpers/supabase.helper.js +1 -2
- package/dist/helpers/table.helper.js +1 -2
- package/dist/helpers/tailwind.helper.js +1 -2
- package/dist/hooks/behavior/index.js +6 -6
- package/dist/hooks/behavior/useConfirmDeleteDialog.js +1 -2
- package/dist/hooks/behavior/useConfirmationDialog.js +1 -2
- package/dist/hooks/behavior/useDebounce.js +1 -2
- package/dist/hooks/behavior/useDebouncedValue.js +1 -2
- package/dist/hooks/behavior/useDialog.js +1 -2
- package/dist/hooks/behavior/usePage.js +1 -2
- package/dist/hooks/behavior/useSidebar.js +1 -2
- package/dist/hooks/behavior/useTable.js +1 -2
- package/dist/hooks/behavior/useUrlState.js +1 -2
- package/dist/hooks/ui/index.js +10 -10
- package/dist/hooks/ui/useDataTable.js +1 -2
- package/dist/hooks/ui/useDocumentTitle.js +1 -2
- package/dist/hooks/ui/useFixedColumns.js +1 -2
- package/dist/hooks/ui/useLanguage.js +1 -2
- package/dist/hooks/ui/useMobile.js +1 -2
- package/dist/hooks/ui/useNotifications.js +1 -2
- package/dist/hooks/ui/useScrollFade.js +1 -2
- package/dist/hooks/ui/useServerTable.js +1 -2
- package/dist/hooks/ui/useTheme.js +1 -2
- package/dist/hooks/ui/useToast.js +1 -2
- package/dist/i18n/krosoftLocales.js +1 -2
- package/dist/i18n/translateKrosoft.js +1 -2
- package/dist/i18n/useDateFnsLocale.js +1 -2
- package/dist/i18n/useKrosoftTranslation.js +1 -2
- package/dist/locales/en.json.js +1 -2
- package/dist/locales/fr.json.js +1 -2
- package/dist/providers/SidebarProvider.js +5 -6
- package/dist/pwa/PwaUpdater.js +1 -2
- package/dist/pwa/index.js +3 -3
- package/dist/pwa/pwaUpdateToast.js +1 -2
- package/dist/query/createQueryClient.js +1 -2
- package/dist/seasonal/EffectSwitch.js +1 -2
- package/dist/seasonal/EmojiSnowfall.js +1 -2
- package/dist/seasonal/HalloweenEffect.js +5 -6
- package/dist/seasonal/SeasonalEffects.js +4 -5
- package/dist/seasonal/SeasonalEffectsSettings.js +8 -9
- package/dist/seasonal/SnowEffect.js +5 -6
- package/dist/seasonal/overlayStyle.js +1 -2
- package/dist/seasonal/seasons.js +1 -2
- package/dist/seasonal/useSeasonalEffects.js +1 -2
- package/dist/seasonal/useStoredToggle.js +1 -2
- package/dist/tailwind/index.js +1 -2
- package/dist/tokens/apply.js +1 -2
- package/dist/tokens/radius.js +1 -2
- package/dist/vendor/tailwindcss/lib/public/create-plugin.js +1 -2
- package/dist/vendor/tailwindcss/lib/util/createPlugin.js +1 -2
- package/dist/vendor/tailwindcss/plugin.js +1 -2
- package/package.json +3 -3
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Tooltip as e, TooltipContent as t, TooltipTrigger as n } from "../../ui/tooltip.js";
|
|
2
|
+
import { cn as r } from "../../../helpers/tailwind.helper.js";
|
|
3
3
|
import * as i from "react";
|
|
4
4
|
import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
5
5
|
import { ChevronDownIcon as c } from "lucide-react";
|
|
6
|
-
|
|
6
|
+
// src/components/core/navbar/SidebarNavItem.tsx
|
|
7
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
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
9
|
href: u ?? "#",
|
|
10
10
|
onClick: (e) => {
|
|
11
11
|
e.ctrlKey || e.metaKey || e.button === 1 || (e.preventDefault(), m && m.length > 0 ? g || x(!b) : u && v(u));
|
|
12
12
|
},
|
|
13
|
-
className:
|
|
13
|
+
className: r("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
14
|
children: [/* @__PURE__ */ o("div", {
|
|
15
|
-
className:
|
|
16
|
-
children: /* @__PURE__ */ o(d, { className:
|
|
15
|
+
className: r("flex-shrink-0 transition-transform group-hover:scale-110", g ? "flex items-center justify-center" : ""),
|
|
16
|
+
children: /* @__PURE__ */ o(d, { className: r("size-4", w && "text-sidebar-primary") })
|
|
17
17
|
}), !g && /* @__PURE__ */ s(a, { children: [
|
|
18
18
|
/* @__PURE__ */ o("span", {
|
|
19
|
-
className:
|
|
19
|
+
className: r("flex-grow transition-opacity duration-150", w ? "font-semibold" : "font-medium", _ ? "text-sm" : ""),
|
|
20
20
|
children: f
|
|
21
21
|
}),
|
|
22
22
|
p !== void 0 && /* @__PURE__ */ o("span", {
|
|
23
23
|
className: "bg-red-500 text-white text-xs rounded-full py-1 min-w-[20px] text-center px-2 font-semibold",
|
|
24
24
|
children: p
|
|
25
25
|
}),
|
|
26
|
-
m && m.length > 0 && /* @__PURE__ */ o(c, { className:
|
|
26
|
+
m && m.length > 0 && /* @__PURE__ */ o(c, { className: r("size-4 transition-transform duration-200", b ? "rotate-180" : "") })
|
|
27
27
|
] })]
|
|
28
28
|
});
|
|
29
|
-
return /* @__PURE__ */ s(a, { children: [g ? /* @__PURE__ */ s(
|
|
29
|
+
return /* @__PURE__ */ s(a, { children: [g ? /* @__PURE__ */ s(e, { children: [/* @__PURE__ */ o(n, {
|
|
30
30
|
asChild: !0,
|
|
31
31
|
children: T
|
|
32
|
-
}), /* @__PURE__ */ o(
|
|
32
|
+
}), /* @__PURE__ */ o(t, {
|
|
33
33
|
side: "right",
|
|
34
34
|
sideOffset: 6,
|
|
35
35
|
className: "rounded-surface z-[99999] flex gap-2 bg-sidebar text-sidebar-foreground border border-sidebar-border py-2 text-sm shadow-lg",
|
|
@@ -51,22 +51,21 @@ var l = (e, t, n) => t === e ? !0 : e === "/" || !t.startsWith(`${e}/`) ? !1 : !
|
|
|
51
51
|
})
|
|
52
52
|
})
|
|
53
53
|
})] }) : T, !g && m && m.length > 0 && b && /* @__PURE__ */ o("div", {
|
|
54
|
-
className:
|
|
55
|
-
children: m.map((
|
|
56
|
-
let
|
|
54
|
+
className: r("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((e, t) => {
|
|
56
|
+
let n = l(e.path, h, y);
|
|
57
57
|
return /* @__PURE__ */ s("a", {
|
|
58
|
-
href:
|
|
59
|
-
onClick: (
|
|
60
|
-
|
|
58
|
+
href: e.path,
|
|
59
|
+
onClick: (t) => {
|
|
60
|
+
t.ctrlKey || t.metaKey || t.button === 1 || (t.preventDefault(), v(e.path));
|
|
61
61
|
},
|
|
62
|
-
className:
|
|
63
|
-
children: [/* @__PURE__ */ o("span", { children:
|
|
62
|
+
className: r("flex items-center justify-between rounded-control text-sm transition-all duration-200", _ ? "px-3 py-1" : "px-4 py-2", n ? "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: e.label }), e.badge !== void 0 && /* @__PURE__ */ o("span", {
|
|
64
64
|
className: "bg-sidebar-primary/20 text-sidebar-primary text-[10px] rounded-full py-0.5 px-2 font-semibold",
|
|
65
|
-
children:
|
|
65
|
+
children: e.badge
|
|
66
66
|
})]
|
|
67
|
-
},
|
|
67
|
+
}, t);
|
|
68
68
|
})
|
|
69
69
|
})] });
|
|
70
70
|
};
|
|
71
|
-
//#endregion
|
|
72
71
|
export { u as SidebarNavItem };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Button as e } from "../../ui/button.js";
|
|
2
|
+
import { cn as t } from "../../../helpers/tailwind.helper.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
5
5
|
import { MenuIcon as i } from "lucide-react";
|
|
6
|
-
|
|
6
|
+
// src/components/core/navbar/Topbar.tsx
|
|
7
7
|
var a = ({ collapsed: a, isMobile: o, onToggleSidebar: s, actionsNode: c, userMenuNode: l }) => /* @__PURE__ */ r("header", {
|
|
8
|
-
className:
|
|
8
|
+
className: t("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
9
|
tabIndex: -1,
|
|
10
10
|
children: [/* @__PURE__ */ n("div", {
|
|
11
11
|
className: "flex items-center min-w-0 flex-1",
|
|
12
|
-
children: /* @__PURE__ */ n(
|
|
12
|
+
children: /* @__PURE__ */ n(e, {
|
|
13
13
|
variant: "ghost",
|
|
14
14
|
size: "icon",
|
|
15
15
|
onClick: s,
|
|
@@ -21,5 +21,4 @@ var a = ({ collapsed: a, isMobile: o, onToggleSidebar: s, actionsNode: c, userMe
|
|
|
21
21
|
children: [c, l]
|
|
22
22
|
})]
|
|
23
23
|
});
|
|
24
|
-
//#endregion
|
|
25
24
|
export { a as Topbar };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GlobalSearch as e } from "./GlobalSearch.js";
|
|
2
2
|
import { NotificationsBell as t } from "./NotificationsBell.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { Sidebar as n } from "./Sidebar.js";
|
|
4
|
+
import { SidebarHeader as r } from "./SidebarHeader.js";
|
|
5
|
+
import { SidebarNavItem as i } from "./SidebarNavItem.js";
|
|
6
6
|
import { Topbar as a } from "./Topbar.js";
|
|
7
|
-
export { e as GlobalSearch, t as NotificationsBell,
|
|
7
|
+
export { e as GlobalSearch, t as NotificationsBell, n as Sidebar, r as SidebarHeader, i as SidebarNavItem, a as Topbar };
|
|
@@ -3,7 +3,7 @@ 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";
|
|
6
|
-
|
|
6
|
+
// src/components/core/states/ErrorAlert.tsx
|
|
7
7
|
var o = (e) => e instanceof Error ? {} : {
|
|
8
8
|
code: e.code,
|
|
9
9
|
errors: e.errors ?? void 0
|
|
@@ -33,5 +33,4 @@ var o = (e) => e instanceof Error ? {} : {
|
|
|
33
33
|
})] })]
|
|
34
34
|
});
|
|
35
35
|
};
|
|
36
|
-
//#endregion
|
|
37
36
|
export { s as ErrorAlert };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useKrosoftTranslation as e } from "../../../i18n/useKrosoftTranslation.js";
|
|
2
2
|
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
|
-
|
|
3
|
+
// src/components/core/states/ErrorState.tsx
|
|
4
4
|
var r = ({ message: r }) => {
|
|
5
5
|
let { t: i } = e();
|
|
6
6
|
return /* @__PURE__ */ n("div", {
|
|
@@ -14,5 +14,4 @@ var r = ({ message: r }) => {
|
|
|
14
14
|
}) : null]
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
|
-
//#endregion
|
|
18
17
|
export { r as ErrorState };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
2
|
import { Loader2Icon as n } from "lucide-react";
|
|
3
|
-
|
|
3
|
+
// src/components/core/states/LoadingState.tsx
|
|
4
4
|
var r = ({ message: r }) => /* @__PURE__ */ t("div", {
|
|
5
5
|
className: "flex flex-col items-center justify-center p-12 text-muted-foreground animate-fade-in",
|
|
6
6
|
children: [/* @__PURE__ */ e(n, { className: "size-8 animate-spin mb-4 text-primary" }), r !== void 0 && r !== "" ? /* @__PURE__ */ e("p", {
|
|
@@ -8,5 +8,4 @@ var r = ({ message: r }) => /* @__PURE__ */ t("div", {
|
|
|
8
8
|
children: r
|
|
9
9
|
}) : null]
|
|
10
10
|
});
|
|
11
|
-
//#endregion
|
|
12
11
|
export { r as LoadingState };
|
|
@@ -8,7 +8,7 @@ import { TablePagination as o } from "./TablePagination.js";
|
|
|
8
8
|
import { TableSettings as s } from "./TableSettings.js";
|
|
9
9
|
import { useMemo as c } from "react";
|
|
10
10
|
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
11
|
-
|
|
11
|
+
// src/components/core/table/DataTable.tsx
|
|
12
12
|
function d({ data: d, isLoading: te = !1, error: f = null, config: p, server: m }) {
|
|
13
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
14
|
data: d,
|
|
@@ -104,5 +104,4 @@ function d({ data: d, isLoading: te = !1, error: f = null, config: p, server: m
|
|
|
104
104
|
})]
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
|
-
//#endregion
|
|
108
107
|
export { d as DataTable };
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { Label as e } from "../../ui/label.js";
|
|
2
|
+
import { SimpleTable as t, SimpleTableBody as n, SimpleTableCell as r, SimpleTableHead as i, SimpleTableHeader as a, SimpleTableRow as o } from "../../ui/simple-table.js";
|
|
3
|
+
import { Switch as s } from "../../ui/switch.js";
|
|
4
|
+
import { useKrosoftTranslation as c } from "../../../i18n/useKrosoftTranslation.js";
|
|
5
5
|
import { useState as l } from "react";
|
|
6
6
|
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
7
7
|
import { formatJsonValue as f, isRecord as p, tryParseJson as m } from "@krosoft/core/helpers";
|
|
8
|
-
|
|
8
|
+
// src/components/core/table/JsonTableOutput.tsx
|
|
9
9
|
var h = ({ header: h, output: g }) => {
|
|
10
|
-
let { t: _ } =
|
|
10
|
+
let { t: _ } = c(), [v, y] = l(!0), b = m(g), x = b !== null, S = () => /* @__PURE__ */ d("div", {
|
|
11
11
|
className: "flex items-center justify-between mb-2",
|
|
12
12
|
children: [/* @__PURE__ */ u("span", {
|
|
13
13
|
className: "font-medium text-sm",
|
|
14
14
|
children: h
|
|
15
15
|
}), /* @__PURE__ */ d("div", {
|
|
16
16
|
className: "flex items-center gap-2",
|
|
17
|
-
children: [/* @__PURE__ */ u(
|
|
17
|
+
children: [/* @__PURE__ */ u(s, {
|
|
18
18
|
id: "table-mode",
|
|
19
19
|
checked: v,
|
|
20
20
|
onCheckedChange: y
|
|
21
|
-
}), /* @__PURE__ */ u(
|
|
21
|
+
}), /* @__PURE__ */ u(e, {
|
|
22
22
|
htmlFor: "table-mode",
|
|
23
23
|
className: "text-xs",
|
|
24
24
|
children: _("table.tableMode")
|
|
@@ -26,7 +26,7 @@ var h = ({ header: h, output: g }) => {
|
|
|
26
26
|
})]
|
|
27
27
|
}), C = ({ children: e }) => /* @__PURE__ */ u("div", {
|
|
28
28
|
className: "border rounded min-w-0 w-full",
|
|
29
|
-
children: /* @__PURE__ */ u(
|
|
29
|
+
children: /* @__PURE__ */ u(t, { children: e })
|
|
30
30
|
}), w = () => /* @__PURE__ */ u("pre", {
|
|
31
31
|
className: "text-xs bg-muted p-4 rounded overflow-x-auto whitespace-pre-wrap",
|
|
32
32
|
children: x && !v ? JSON.stringify(b, null, 2) : g
|
|
@@ -37,32 +37,32 @@ var h = ({ header: h, output: g }) => {
|
|
|
37
37
|
if (!x || !v) return /* @__PURE__ */ u(w, {});
|
|
38
38
|
if (Array.isArray(b) && b.length > 0 && p(b[0])) {
|
|
39
39
|
let e = b, t = Object.keys(e[0]);
|
|
40
|
-
return /* @__PURE__ */ d(C, { children: [/* @__PURE__ */ u(
|
|
40
|
+
return /* @__PURE__ */ d(C, { children: [/* @__PURE__ */ u(a, {
|
|
41
41
|
className: "bg-muted/50",
|
|
42
|
-
children: /* @__PURE__ */ u(
|
|
42
|
+
children: /* @__PURE__ */ u(o, { children: t.map((e) => /* @__PURE__ */ u(i, {
|
|
43
43
|
className: "font-medium",
|
|
44
44
|
children: e
|
|
45
45
|
}, e)) })
|
|
46
|
-
}), /* @__PURE__ */ u(
|
|
46
|
+
}), /* @__PURE__ */ u(n, { children: e.map((e, n) => /* @__PURE__ */ u(o, { children: t.map((t) => /* @__PURE__ */ u(r, {
|
|
47
47
|
className: "text-sm whitespace-pre-wrap",
|
|
48
48
|
children: f(e[t])
|
|
49
49
|
}, t)) }, n)) })] });
|
|
50
50
|
}
|
|
51
51
|
if (p(b)) {
|
|
52
52
|
let e = Object.entries(b);
|
|
53
|
-
return /* @__PURE__ */ d(C, { children: [/* @__PURE__ */ u(
|
|
53
|
+
return /* @__PURE__ */ d(C, { children: [/* @__PURE__ */ u(a, {
|
|
54
54
|
className: "bg-muted/50",
|
|
55
|
-
children: /* @__PURE__ */ d(
|
|
55
|
+
children: /* @__PURE__ */ d(o, { children: [/* @__PURE__ */ u(i, {
|
|
56
56
|
className: "font-medium",
|
|
57
57
|
children: _("table.property")
|
|
58
|
-
}), /* @__PURE__ */ u(
|
|
58
|
+
}), /* @__PURE__ */ u(i, {
|
|
59
59
|
className: "font-medium",
|
|
60
60
|
children: _("table.value")
|
|
61
61
|
})] })
|
|
62
|
-
}), /* @__PURE__ */ u(
|
|
62
|
+
}), /* @__PURE__ */ u(n, { children: e.map(([e, t]) => /* @__PURE__ */ d(o, { children: [/* @__PURE__ */ u(r, {
|
|
63
63
|
className: "font-medium text-sm",
|
|
64
64
|
children: e
|
|
65
|
-
}), /* @__PURE__ */ u(
|
|
65
|
+
}), /* @__PURE__ */ u(r, {
|
|
66
66
|
className: "text-sm whitespace-pre-wrap",
|
|
67
67
|
children: f(t)
|
|
68
68
|
})] }, e)) })] });
|
|
@@ -71,5 +71,4 @@ var h = ({ header: h, output: g }) => {
|
|
|
71
71
|
})()]
|
|
72
72
|
}) : null;
|
|
73
73
|
};
|
|
74
|
-
//#endregion
|
|
75
74
|
export { h as JsonTableOutput };
|
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { DropdownMenu as
|
|
4
|
-
import {
|
|
1
|
+
import { Button as e } from "../../ui/button.js";
|
|
2
|
+
import { Tooltip as t, TooltipContent as n, TooltipProvider as r, TooltipTrigger as i } from "../../ui/tooltip.js";
|
|
3
|
+
import { DropdownMenu as a, DropdownMenuContent as o, DropdownMenuItem as s, DropdownMenuTrigger as c } from "../../ui/dropdown-menu.js";
|
|
4
|
+
import { useKrosoftTranslation as l } from "../../../i18n/useKrosoftTranslation.js";
|
|
5
5
|
import "react";
|
|
6
6
|
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
7
7
|
import { MoreVerticalIcon as f } from "lucide-react";
|
|
8
|
-
|
|
8
|
+
// src/components/core/table/TableActions.tsx
|
|
9
9
|
function p({ actions: p, row: m }) {
|
|
10
|
-
let { t: h } =
|
|
10
|
+
let { t: h } = l(), g = p.filter((e) => e.visible === void 0 || e.visible(m));
|
|
11
11
|
if (g.length === 0) return null;
|
|
12
12
|
let _ = g.filter((e) => e.overflow !== !0), v = g.filter((e) => e.overflow === !0);
|
|
13
|
-
return /* @__PURE__ */ u(
|
|
13
|
+
return /* @__PURE__ */ u(r, { children: /* @__PURE__ */ d("div", {
|
|
14
14
|
className: "flex items-center justify-end gap-1",
|
|
15
|
-
children: [_.map((
|
|
16
|
-
let
|
|
17
|
-
return
|
|
15
|
+
children: [_.map((r, a) => {
|
|
16
|
+
let o = r.icon, s = h(r.labelKey), c = r.disabled?.(m) ?? !1;
|
|
17
|
+
return r.iconOnly === !0 && o !== void 0 ? /* @__PURE__ */ d(t, { children: [/* @__PURE__ */ u(i, {
|
|
18
18
|
asChild: !0,
|
|
19
19
|
children: /* @__PURE__ */ u("span", {
|
|
20
20
|
className: "inline-flex",
|
|
21
|
-
tabIndex:
|
|
22
|
-
children: /* @__PURE__ */ u(
|
|
23
|
-
variant:
|
|
21
|
+
tabIndex: c ? 0 : void 0,
|
|
22
|
+
children: /* @__PURE__ */ u(e, {
|
|
23
|
+
variant: r.variant ?? "ghost",
|
|
24
24
|
size: "icon",
|
|
25
|
-
disabled:
|
|
26
|
-
"aria-label":
|
|
27
|
-
className: `h-7 w-7 text-muted-foreground hover:text-foreground ${
|
|
28
|
-
onClick: (
|
|
29
|
-
|
|
25
|
+
disabled: c,
|
|
26
|
+
"aria-label": s,
|
|
27
|
+
className: `h-7 w-7 text-muted-foreground hover:text-foreground ${r.className ?? ""}`,
|
|
28
|
+
onClick: (e) => {
|
|
29
|
+
e.stopPropagation(), r.onClick(m);
|
|
30
30
|
},
|
|
31
|
-
children: /* @__PURE__ */ u(
|
|
31
|
+
children: /* @__PURE__ */ u(o, { className: "size-3.5" })
|
|
32
32
|
})
|
|
33
33
|
})
|
|
34
|
-
}), /* @__PURE__ */ u(
|
|
35
|
-
variant:
|
|
34
|
+
}), /* @__PURE__ */ u(n, { children: s })] }, a) : /* @__PURE__ */ d(e, {
|
|
35
|
+
variant: r.variant ?? "ghost",
|
|
36
36
|
size: "sm",
|
|
37
|
-
disabled:
|
|
38
|
-
className: `h-7 px-2 text-muted-foreground hover:text-foreground ${
|
|
39
|
-
onClick: (
|
|
40
|
-
|
|
37
|
+
disabled: c,
|
|
38
|
+
className: `h-7 px-2 text-muted-foreground hover:text-foreground ${r.className ?? ""}`,
|
|
39
|
+
onClick: (e) => {
|
|
40
|
+
e.stopPropagation(), r.onClick(m);
|
|
41
41
|
},
|
|
42
|
-
children: [
|
|
43
|
-
},
|
|
44
|
-
}), v.length > 0 && /* @__PURE__ */ d(
|
|
42
|
+
children: [o !== void 0 && /* @__PURE__ */ u(o, { className: "size-3.5" }), s]
|
|
43
|
+
}, a);
|
|
44
|
+
}), v.length > 0 && /* @__PURE__ */ d(a, { children: [/* @__PURE__ */ u(c, {
|
|
45
45
|
asChild: !0,
|
|
46
|
-
children: /* @__PURE__ */ u(
|
|
46
|
+
children: /* @__PURE__ */ u(e, {
|
|
47
47
|
variant: "ghost",
|
|
48
48
|
size: "icon",
|
|
49
49
|
className: "h-7 w-7 text-muted-foreground hover:text-foreground",
|
|
50
50
|
children: /* @__PURE__ */ u(f, { className: "size-3.5" })
|
|
51
51
|
})
|
|
52
|
-
}), /* @__PURE__ */ u(
|
|
52
|
+
}), /* @__PURE__ */ u(o, {
|
|
53
53
|
align: "end",
|
|
54
54
|
onClick: (e) => {
|
|
55
55
|
e.stopPropagation();
|
|
56
56
|
},
|
|
57
57
|
children: v.map((e, t) => {
|
|
58
58
|
let n = e.icon;
|
|
59
|
-
return /* @__PURE__ */ d(
|
|
59
|
+
return /* @__PURE__ */ d(s, {
|
|
60
60
|
disabled: e.disabled?.(m) ?? !1,
|
|
61
61
|
onClick: () => {
|
|
62
62
|
e.onClick(m);
|
|
@@ -71,5 +71,4 @@ function p({ actions: p, row: m }) {
|
|
|
71
71
|
})] })]
|
|
72
72
|
}) });
|
|
73
73
|
}
|
|
74
|
-
//#endregion
|
|
75
74
|
export { p as TableActions };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useKrosoftTranslation as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { Checkbox as e } from "../../ui/checkbox.js";
|
|
2
|
+
import { useKrosoftTranslation as t } from "../../../i18n/useKrosoftTranslation.js";
|
|
3
|
+
import { TableActions as n } from "./TableActions.js";
|
|
4
|
+
import { ACTIONS_COLUMN_KEY as r, SELECTION_COLUMN_KEY as i, getAlignmentClass as a, getColumnAlignment as o, getFixedCellProps as s } from "../../../helpers/table.helper.js";
|
|
5
5
|
import "react";
|
|
6
6
|
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
7
7
|
import { AlertTriangleIcon as u, Loader2Icon as d } from "lucide-react";
|
|
8
8
|
import { useNavigate as f } from "react-router-dom";
|
|
9
|
-
|
|
9
|
+
// src/components/core/table/TableBody.tsx
|
|
10
10
|
function p({ isLoading: p, error: m, colSpanCount: h, messages: g, paginatedData: _, rowKey: v, onRowClick: y, onRowNavigate: b, rowNavigable: x, hasBulkActions: S, rowSelectable: C, selectedKeys: w, toggleRowSelection: T, visibleColumnsArray: E, columnWidths: D, hasActions: O, actions: k, columns: A, bordered: j = !1, dense: M = !1, resizableColumns: N = !1, fixedColumns: P = {} }) {
|
|
11
|
-
let { t: F } =
|
|
11
|
+
let { t: F } = t(), I = F(g?.loadingKey ?? "states.loading"), L = F(g?.emptyKey ?? "states.noResult"), R = f(), z = (e, t) => {
|
|
12
12
|
let n = A.find((e) => e.key === t);
|
|
13
13
|
if (n?.renderCell !== void 0) return n.renderCell(e);
|
|
14
14
|
let r = e[t];
|
|
@@ -53,19 +53,19 @@ function p({ isLoading: p, error: m, colSpanCount: h, messages: g, paginatedData
|
|
|
53
53
|
children: L
|
|
54
54
|
}) })
|
|
55
55
|
});
|
|
56
|
-
let B =
|
|
56
|
+
let B = s(P[i], "body"), V = s(P[r], "body"), H = S && w.size > 0, U = (e) => {
|
|
57
57
|
if (x === void 0 || x(e)) return b?.(e);
|
|
58
58
|
}, W = (e, t, n) => {
|
|
59
59
|
H ? T(e) : t === void 0 ? y?.(e, n) : n.ctrlKey || n.metaKey ? window.open(t, "_blank") : R(t);
|
|
60
60
|
};
|
|
61
61
|
return /* @__PURE__ */ c("tbody", {
|
|
62
62
|
className: "divide-y divide-border",
|
|
63
|
-
children: _.map((
|
|
64
|
-
let
|
|
63
|
+
children: _.map((t) => {
|
|
64
|
+
let r = v(t), i = C === void 0 || C(t), u = U(t);
|
|
65
65
|
return /* @__PURE__ */ l("tr", {
|
|
66
66
|
className: `group hover:bg-muted/50 transition-colors ${H || u !== void 0 || y !== void 0 ? "cursor-pointer" : ""}`,
|
|
67
|
-
onClick: (
|
|
68
|
-
W(
|
|
67
|
+
onClick: (e) => {
|
|
68
|
+
W(t, u, e);
|
|
69
69
|
},
|
|
70
70
|
children: [
|
|
71
71
|
S ? /* @__PURE__ */ c("td", {
|
|
@@ -81,28 +81,28 @@ function p({ isLoading: p, error: m, colSpanCount: h, messages: g, paginatedData
|
|
|
81
81
|
},
|
|
82
82
|
children: /* @__PURE__ */ c("div", {
|
|
83
83
|
className: "flex items-center justify-center",
|
|
84
|
-
children: /* @__PURE__ */ c(
|
|
85
|
-
checked: w.has(
|
|
86
|
-
disabled: !
|
|
84
|
+
children: /* @__PURE__ */ c(e, {
|
|
85
|
+
checked: w.has(r),
|
|
86
|
+
disabled: !i,
|
|
87
87
|
onCheckedChange: () => {
|
|
88
|
-
T(
|
|
88
|
+
T(t);
|
|
89
89
|
}
|
|
90
90
|
})
|
|
91
91
|
})
|
|
92
92
|
}) : null,
|
|
93
|
-
E.map((
|
|
94
|
-
let
|
|
93
|
+
E.map((e, n) => {
|
|
94
|
+
let r = n === E.length - 1, i = s(P[e.key], "body");
|
|
95
95
|
return /* @__PURE__ */ c("td", {
|
|
96
|
-
className: `${`${
|
|
96
|
+
className: `${`${n === 0 && !S ? "pl-4" : "pl-2"} ${r && !O ? "pr-4" : "pr-2"}`} ${M ? "py-2" : "py-4"} text-sm ${a(o(e))} ${i.className} ${j && !r ? "border-r border-border" : ""} ${e.className ?? ""}`,
|
|
97
97
|
style: {
|
|
98
|
-
...N ? { width: D[
|
|
99
|
-
...
|
|
98
|
+
...N ? { width: D[e.key] } : { minWidth: D[e.key] },
|
|
99
|
+
...i.style
|
|
100
100
|
},
|
|
101
101
|
children: /* @__PURE__ */ c("div", {
|
|
102
102
|
className: "w-full h-full",
|
|
103
|
-
children: z(
|
|
103
|
+
children: z(t, e.key)
|
|
104
104
|
})
|
|
105
|
-
},
|
|
105
|
+
}, e.key);
|
|
106
106
|
}),
|
|
107
107
|
O ? /* @__PURE__ */ c("td", {
|
|
108
108
|
className: `py-1 pl-1 pr-4 text-right align-middle whitespace-nowrap ${V.className}`,
|
|
@@ -115,16 +115,15 @@ function p({ isLoading: p, error: m, colSpanCount: h, messages: g, paginatedData
|
|
|
115
115
|
},
|
|
116
116
|
children: k !== void 0 && k.length > 0 ? /* @__PURE__ */ c("div", {
|
|
117
117
|
className: "flex items-center justify-end",
|
|
118
|
-
children: /* @__PURE__ */ c(
|
|
118
|
+
children: /* @__PURE__ */ c(n, {
|
|
119
119
|
actions: k,
|
|
120
|
-
row:
|
|
120
|
+
row: t
|
|
121
121
|
})
|
|
122
122
|
}) : null
|
|
123
123
|
}) : null
|
|
124
124
|
]
|
|
125
|
-
},
|
|
125
|
+
}, r);
|
|
126
126
|
})
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
|
-
//#endregion
|
|
130
129
|
export { p as TableBody };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Button as e } from "../../ui/button.js";
|
|
2
|
+
import { useKrosoftTranslation as t } from "../../../i18n/useKrosoftTranslation.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
5
|
-
|
|
5
|
+
// src/components/core/table/TableBulkActions.tsx
|
|
6
6
|
function i({ selectedRows: i, setSelectedRows: a, bulkActions: o }) {
|
|
7
|
-
let { t: s } =
|
|
7
|
+
let { t: s } = t();
|
|
8
8
|
return /* @__PURE__ */ r("div", {
|
|
9
9
|
className: "bg-muted/60 border border-border px-3 py-1.5 flex items-center justify-between rounded-surface",
|
|
10
10
|
children: [/* @__PURE__ */ r("div", {
|
|
@@ -14,25 +14,25 @@ function i({ selectedRows: i, setSelectedRows: a, bulkActions: o }) {
|
|
|
14
14
|
children: s("table.selectedCount", { count: i.length })
|
|
15
15
|
}), /* @__PURE__ */ n("div", {
|
|
16
16
|
className: "flex items-center gap-2",
|
|
17
|
-
children: o.map((
|
|
18
|
-
let c =
|
|
19
|
-
return /* @__PURE__ */ r(
|
|
17
|
+
children: o.map((t, o) => {
|
|
18
|
+
let c = t.icon;
|
|
19
|
+
return /* @__PURE__ */ r(e, {
|
|
20
20
|
variant: "outline",
|
|
21
21
|
size: "sm",
|
|
22
22
|
onClick: () => {
|
|
23
|
-
|
|
23
|
+
t.onClick(i, () => {
|
|
24
24
|
a([]);
|
|
25
25
|
});
|
|
26
26
|
},
|
|
27
|
-
className: `h-7 bg-background shadow-sm text-xs px-2.5 ${
|
|
27
|
+
className: `h-7 bg-background shadow-sm text-xs px-2.5 ${t.variant === "destructive" ? "text-destructive border-destructive/30 hover:bg-destructive/10 hover:text-destructive" : "text-foreground"}`,
|
|
28
28
|
children: [c !== void 0 && /* @__PURE__ */ n("span", {
|
|
29
29
|
className: "mr-1.5 flex items-center justify-center",
|
|
30
30
|
children: /* @__PURE__ */ n(c, { className: "h-3.5 w-3.5" })
|
|
31
|
-
}), s(
|
|
31
|
+
}), s(t.labelKey)]
|
|
32
32
|
}, o);
|
|
33
33
|
})
|
|
34
34
|
})]
|
|
35
|
-
}), /* @__PURE__ */ n(
|
|
35
|
+
}), /* @__PURE__ */ n(e, {
|
|
36
36
|
variant: "ghost",
|
|
37
37
|
size: "sm",
|
|
38
38
|
onClick: () => {
|
|
@@ -43,5 +43,4 @@ function i({ selectedRows: i, setSelectedRows: a, bulkActions: o }) {
|
|
|
43
43
|
})]
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
|
-
//#endregion
|
|
47
46
|
export { i as TableBulkActions };
|