@krosoft/react 0.0.381 → 0.0.383
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,103 @@
|
|
|
1
|
+
import { useKrosoftTranslation as e } from "../../../i18n/useKrosoftTranslation.js";
|
|
2
|
+
import { Button as t } from "../../ui/button.js";
|
|
3
|
+
import { Label as n } from "../../ui/label.js";
|
|
4
|
+
import { Sheet as r, SheetContent as i, SheetFooter as a, SheetHeader as o, SheetTitle as s, SheetTrigger as c } from "../../ui/sheet.js";
|
|
5
|
+
import { FilterField as l } from "./FilterField.js";
|
|
6
|
+
import { useEffect as u, useMemo as d, useState as f } from "react";
|
|
7
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
8
|
+
import { Filter as h } from "lucide-react";
|
|
9
|
+
//#region src/components/core/filters/AdvancedFilters.tsx
|
|
10
|
+
var g = (e) => !(e == null || e === "" || Array.isArray(e) && e.length === 0);
|
|
11
|
+
function _({ sections: _, filters: v, onFiltersChange: y, buttonText: b, sheetTitle: x }) {
|
|
12
|
+
let { t: S } = e(), [C, w] = f(!1), [T, E] = f(v);
|
|
13
|
+
u(() => {
|
|
14
|
+
E(v);
|
|
15
|
+
}, [v, C]);
|
|
16
|
+
let D = (e, t) => {
|
|
17
|
+
E((n) => ({
|
|
18
|
+
...n,
|
|
19
|
+
[e]: t
|
|
20
|
+
}));
|
|
21
|
+
}, O = (e, t) => {
|
|
22
|
+
let n = T[e], r = Array.isArray(n) ? n : [], i = r.includes(t) ? r.filter((e) => e !== t) : [...r, t];
|
|
23
|
+
D(e, i);
|
|
24
|
+
}, k = () => {
|
|
25
|
+
y(T), w(!1);
|
|
26
|
+
}, A = () => {
|
|
27
|
+
E({}), y({}), w(!1);
|
|
28
|
+
}, j = d(() => {
|
|
29
|
+
let e = new Set(_.flatMap((e) => e.filters.map((e) => e.key)));
|
|
30
|
+
return Object.entries(v).filter(([t, n]) => e.has(t) && g(n)).length;
|
|
31
|
+
}, [_, v]);
|
|
32
|
+
return /* @__PURE__ */ m(r, {
|
|
33
|
+
open: C,
|
|
34
|
+
onOpenChange: w,
|
|
35
|
+
children: [/* @__PURE__ */ p(c, {
|
|
36
|
+
asChild: !0,
|
|
37
|
+
children: /* @__PURE__ */ m(t, {
|
|
38
|
+
variant: "outline",
|
|
39
|
+
className: "gap-2",
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ p(h, { className: "size-4 shrink-0" }),
|
|
42
|
+
b ?? S("filters.more"),
|
|
43
|
+
j > 0 && /* @__PURE__ */ p("span", {
|
|
44
|
+
className: "ml-1 flex h-5 min-w-5 items-center justify-center rounded-full bg-primary px-1.5 text-xs font-semibold text-primary-foreground",
|
|
45
|
+
children: j
|
|
46
|
+
})
|
|
47
|
+
]
|
|
48
|
+
})
|
|
49
|
+
}), /* @__PURE__ */ m(i, {
|
|
50
|
+
side: "right",
|
|
51
|
+
className: "w-[400px] sm:w-[500px] flex flex-col p-0",
|
|
52
|
+
children: [
|
|
53
|
+
/* @__PURE__ */ p(o, {
|
|
54
|
+
className: "p-6 pb-0",
|
|
55
|
+
children: /* @__PURE__ */ p(s, { children: x ?? S("filters.advanced") })
|
|
56
|
+
}),
|
|
57
|
+
/* @__PURE__ */ p("div", {
|
|
58
|
+
className: "flex-1 overflow-y-auto p-6 pt-6",
|
|
59
|
+
children: /* @__PURE__ */ p("div", {
|
|
60
|
+
className: "space-y-6",
|
|
61
|
+
children: _.map((e, t) => /* @__PURE__ */ m("div", {
|
|
62
|
+
className: "space-y-4",
|
|
63
|
+
children: [/* @__PURE__ */ p("h3", {
|
|
64
|
+
className: "font-semibold text-sm text-foreground border-b pb-2",
|
|
65
|
+
children: S(e.titleKey)
|
|
66
|
+
}), e.filters.map((e) => /* @__PURE__ */ m("div", {
|
|
67
|
+
className: "space-y-2",
|
|
68
|
+
children: [/* @__PURE__ */ p(n, {
|
|
69
|
+
htmlFor: e.key,
|
|
70
|
+
children: S(e.labelKey)
|
|
71
|
+
}), /* @__PURE__ */ p(l, {
|
|
72
|
+
field: e,
|
|
73
|
+
value: T[e.key],
|
|
74
|
+
onChange: (t) => {
|
|
75
|
+
D(e.key, t);
|
|
76
|
+
},
|
|
77
|
+
onToggleMultiSelect: (t) => {
|
|
78
|
+
O(e.key, t);
|
|
79
|
+
}
|
|
80
|
+
})]
|
|
81
|
+
}, e.key))]
|
|
82
|
+
}, t))
|
|
83
|
+
})
|
|
84
|
+
}),
|
|
85
|
+
/* @__PURE__ */ m(a, {
|
|
86
|
+
className: "gap-2 p-6 border-t bg-background",
|
|
87
|
+
children: [/* @__PURE__ */ p(t, {
|
|
88
|
+
variant: "outline",
|
|
89
|
+
className: "flex-1",
|
|
90
|
+
onClick: A,
|
|
91
|
+
children: S("filters.clear")
|
|
92
|
+
}), /* @__PURE__ */ p(t, {
|
|
93
|
+
className: "flex-1",
|
|
94
|
+
onClick: k,
|
|
95
|
+
children: S("filters.apply")
|
|
96
|
+
})]
|
|
97
|
+
})
|
|
98
|
+
]
|
|
99
|
+
})]
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
//#endregion
|
|
103
|
+
export { _ as AdvancedFilters };
|
|
@@ -0,0 +1,162 @@
|
|
|
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 { controlBaseClass as r } from "../../ui/control.js";
|
|
5
|
+
import { Label as i } from "../../ui/label.js";
|
|
6
|
+
import { Input as a } from "../../ui/input.js";
|
|
7
|
+
import { Popover as o, PopoverContent as s, PopoverTrigger as c } from "../../ui/popover.js";
|
|
8
|
+
import { ToggleGroup as l, ToggleGroupItem as u } from "../../ui/toggle-group.js";
|
|
9
|
+
import { SingleSelect as d } from "../inputs/SingleSelect.js";
|
|
10
|
+
import { useState as f } from "react";
|
|
11
|
+
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
12
|
+
import { ChevronDownIcon as g, XIcon as _ } from "lucide-react";
|
|
13
|
+
//#region src/components/core/filters/ConditionFilter.tsx
|
|
14
|
+
var v = (e) => e?.requiresValue !== !1;
|
|
15
|
+
function y({ fields: y, operators: b, value: x, onChange: S, labelKey: C, icon: w, disabled: T = !1, className: E }) {
|
|
16
|
+
let { t: D } = t(), [O, k] = f(!1), [A, j] = f({ value: "" }), M = x === void 0 ? void 0 : y.find((e) => e.value === x.field), N = x === void 0 ? void 0 : b.find((e) => e.value === x.operator), P = x !== void 0, F = b.find((e) => e.value === A.operator), I = v(F), L = F?.numeric === !0, R = A.value.trim(), z = I && L && R !== "" && Number.isNaN(Number(R)), B = A.field !== void 0 && F !== void 0 && (!I || R !== "") && !z, V = (e) => {
|
|
17
|
+
e && j(x === void 0 ? { value: "" } : { ...x }), k(e);
|
|
18
|
+
}, H = () => {
|
|
19
|
+
B && A.field !== void 0 && F !== void 0 && (S({
|
|
20
|
+
field: A.field,
|
|
21
|
+
operator: F.value,
|
|
22
|
+
value: I ? R : ""
|
|
23
|
+
}), k(!1));
|
|
24
|
+
}, U = () => {
|
|
25
|
+
S(void 0), k(!1);
|
|
26
|
+
}, W = D(C === void 0 ? "filters.condition.label" : C);
|
|
27
|
+
return /* @__PURE__ */ h(o, {
|
|
28
|
+
open: O,
|
|
29
|
+
onOpenChange: V,
|
|
30
|
+
children: [/* @__PURE__ */ m(c, {
|
|
31
|
+
asChild: !0,
|
|
32
|
+
children: /* @__PURE__ */ h("button", {
|
|
33
|
+
type: "button",
|
|
34
|
+
disabled: T,
|
|
35
|
+
className: e(r, "inline-flex items-center justify-between gap-1.5 whitespace-nowrap transition-colors", P ? "border-primary bg-primary/10 text-primary" : "hover:bg-muted", !P && "w-full md:w-[200px]", E),
|
|
36
|
+
children: [/* @__PURE__ */ h("span", {
|
|
37
|
+
className: "flex min-w-0 items-center gap-1.5",
|
|
38
|
+
children: [w !== void 0 && /* @__PURE__ */ m(w, { className: "size-3.5 shrink-0 opacity-70" }), /* @__PURE__ */ m("span", {
|
|
39
|
+
className: "truncate",
|
|
40
|
+
children: x === void 0 ? W : /* @__PURE__ */ h(p, { children: [
|
|
41
|
+
W,
|
|
42
|
+
" :",
|
|
43
|
+
" ",
|
|
44
|
+
/* @__PURE__ */ m("span", {
|
|
45
|
+
className: "font-semibold",
|
|
46
|
+
children: M?.label ?? x.field
|
|
47
|
+
}),
|
|
48
|
+
" ",
|
|
49
|
+
N?.label ?? x.operator,
|
|
50
|
+
x.value !== "" && /* @__PURE__ */ h("span", {
|
|
51
|
+
className: "font-semibold",
|
|
52
|
+
children: [" ", x.value]
|
|
53
|
+
})
|
|
54
|
+
] })
|
|
55
|
+
})]
|
|
56
|
+
}), /* @__PURE__ */ h("span", {
|
|
57
|
+
className: "flex shrink-0 items-center gap-1",
|
|
58
|
+
children: [P && !T && /* @__PURE__ */ m("span", {
|
|
59
|
+
role: "button",
|
|
60
|
+
tabIndex: -1,
|
|
61
|
+
"aria-label": D("filters.condition.clear"),
|
|
62
|
+
onClick: (e) => {
|
|
63
|
+
e.stopPropagation();
|
|
64
|
+
},
|
|
65
|
+
onPointerDown: (e) => {
|
|
66
|
+
e.preventDefault(), e.stopPropagation(), S(void 0);
|
|
67
|
+
},
|
|
68
|
+
className: "opacity-70 hover:opacity-100",
|
|
69
|
+
children: /* @__PURE__ */ m(_, { className: "size-3.5" })
|
|
70
|
+
}), /* @__PURE__ */ m(g, { className: e("size-3.5 opacity-60 transition-transform", O && "rotate-180") })]
|
|
71
|
+
})]
|
|
72
|
+
})
|
|
73
|
+
}), /* @__PURE__ */ h(s, {
|
|
74
|
+
align: "start",
|
|
75
|
+
className: "w-80 space-y-4",
|
|
76
|
+
children: [
|
|
77
|
+
/* @__PURE__ */ h("div", {
|
|
78
|
+
className: "space-y-1.5",
|
|
79
|
+
children: [/* @__PURE__ */ m(i, { children: D("filters.condition.field") }), /* @__PURE__ */ m(d, {
|
|
80
|
+
options: y,
|
|
81
|
+
value: A.field,
|
|
82
|
+
onChange: (e) => {
|
|
83
|
+
j((t) => ({
|
|
84
|
+
...t,
|
|
85
|
+
field: e
|
|
86
|
+
}));
|
|
87
|
+
},
|
|
88
|
+
placeholder: D("filters.condition.selectField")
|
|
89
|
+
})]
|
|
90
|
+
}),
|
|
91
|
+
/* @__PURE__ */ h("div", {
|
|
92
|
+
className: "space-y-1.5",
|
|
93
|
+
children: [/* @__PURE__ */ m(i, { children: D("filters.condition.operator") }), /* @__PURE__ */ m(l, {
|
|
94
|
+
type: "single",
|
|
95
|
+
variant: "outline",
|
|
96
|
+
size: "sm",
|
|
97
|
+
className: "flex-wrap justify-start",
|
|
98
|
+
value: A.operator ?? "",
|
|
99
|
+
onValueChange: (e) => {
|
|
100
|
+
j((t) => {
|
|
101
|
+
let n = b.find((t) => t.value === e)?.numeric !== !0 || !Number.isNaN(Number(t.value.trim()));
|
|
102
|
+
return {
|
|
103
|
+
...t,
|
|
104
|
+
operator: e === "" ? void 0 : e,
|
|
105
|
+
value: n ? t.value : ""
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
},
|
|
109
|
+
children: b.map((e) => /* @__PURE__ */ m(u, {
|
|
110
|
+
value: e.value,
|
|
111
|
+
title: e.title,
|
|
112
|
+
"aria-label": e.title ?? e.label,
|
|
113
|
+
className: "min-w-9 px-2",
|
|
114
|
+
children: e.label
|
|
115
|
+
}, e.value))
|
|
116
|
+
})]
|
|
117
|
+
}),
|
|
118
|
+
I && /* @__PURE__ */ h("div", {
|
|
119
|
+
className: "space-y-1.5",
|
|
120
|
+
children: [
|
|
121
|
+
/* @__PURE__ */ m(i, {
|
|
122
|
+
htmlFor: "condition-filter-value",
|
|
123
|
+
children: D("filters.condition.value")
|
|
124
|
+
}),
|
|
125
|
+
/* @__PURE__ */ m(a, {
|
|
126
|
+
id: "condition-filter-value",
|
|
127
|
+
value: A.value,
|
|
128
|
+
type: L ? "number" : "text",
|
|
129
|
+
step: "any",
|
|
130
|
+
onChange: (e) => {
|
|
131
|
+
j((t) => ({
|
|
132
|
+
...t,
|
|
133
|
+
value: e.target.value
|
|
134
|
+
}));
|
|
135
|
+
},
|
|
136
|
+
onKeyDown: (e) => {
|
|
137
|
+
e.key === "Enter" && (e.preventDefault(), H());
|
|
138
|
+
}
|
|
139
|
+
}),
|
|
140
|
+
" "
|
|
141
|
+
]
|
|
142
|
+
}),
|
|
143
|
+
/* @__PURE__ */ h("div", {
|
|
144
|
+
className: "flex justify-end gap-2",
|
|
145
|
+
children: [P && /* @__PURE__ */ m(n, {
|
|
146
|
+
variant: "ghost",
|
|
147
|
+
size: "sm",
|
|
148
|
+
onClick: U,
|
|
149
|
+
children: D("filters.condition.clear")
|
|
150
|
+
}), /* @__PURE__ */ m(n, {
|
|
151
|
+
size: "sm",
|
|
152
|
+
onClick: H,
|
|
153
|
+
disabled: !B,
|
|
154
|
+
children: D("filters.condition.apply")
|
|
155
|
+
})]
|
|
156
|
+
})
|
|
157
|
+
]
|
|
158
|
+
})]
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
//#endregion
|
|
162
|
+
export { y as ConditionFilter };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { cn as e } from "../../../helpers/tailwind.helper.js";
|
|
2
|
+
import { ConditionFilter as t } from "./ConditionFilter.js";
|
|
3
|
+
import { useRef as n } from "react";
|
|
4
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
import { PlusIcon as a } from "lucide-react";
|
|
6
|
+
//#region src/components/core/filters/ConditionFilterGroup.tsx
|
|
7
|
+
var o = (e, t) => e.field === t.field && e.operator === t.operator && e.value === t.value;
|
|
8
|
+
function s({ fields: s, operators: c, values: l, onChange: u, labelKey: d, max: f = 5, disabled: p = !1, className: m }) {
|
|
9
|
+
let h = n(!1), g = (e) => {
|
|
10
|
+
e === void 0 || l.some((t) => o(t, e)) || u([...l, e]);
|
|
11
|
+
}, _ = (e, t) => {
|
|
12
|
+
t === void 0 ? (h.current = !0, u(l.filter((t, n) => n !== e))) : u(l.map((n, r) => r === e ? t : n));
|
|
13
|
+
}, v = l.length === 0, y = () => {
|
|
14
|
+
h.current = !1;
|
|
15
|
+
};
|
|
16
|
+
return /* @__PURE__ */ i("div", {
|
|
17
|
+
className: e("flex flex-wrap items-center gap-2", m),
|
|
18
|
+
onPointerDownCapture: y,
|
|
19
|
+
onKeyDownCapture: y,
|
|
20
|
+
onClickCapture: (e) => {
|
|
21
|
+
h.current && (h.current = !1, e.preventDefault(), e.stopPropagation());
|
|
22
|
+
},
|
|
23
|
+
children: [l.map((e, n) => /* @__PURE__ */ r(t, {
|
|
24
|
+
fields: s,
|
|
25
|
+
operators: c,
|
|
26
|
+
value: e,
|
|
27
|
+
onChange: (e) => {
|
|
28
|
+
_(n, e);
|
|
29
|
+
},
|
|
30
|
+
labelKey: d,
|
|
31
|
+
disabled: p
|
|
32
|
+
}, n)), l.length < f && /* @__PURE__ */ r(t, {
|
|
33
|
+
fields: s,
|
|
34
|
+
operators: c,
|
|
35
|
+
value: void 0,
|
|
36
|
+
onChange: g,
|
|
37
|
+
labelKey: v ? d : "filters.condition.add",
|
|
38
|
+
icon: v ? void 0 : a,
|
|
39
|
+
disabled: p
|
|
40
|
+
})]
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { s as ConditionFilterGroup };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { useKrosoftTranslation as e } from "../../../i18n/useKrosoftTranslation.js";
|
|
2
|
+
import { Input as t } from "../../ui/input.js";
|
|
3
|
+
import { MultiSelect as n } from "../inputs/MultiSelect.js";
|
|
4
|
+
import { DatePicker as r } from "../inputs/DatePicker.js";
|
|
5
|
+
import { DateRangePicker as i } from "../inputs/DateRangePicker.js";
|
|
6
|
+
import { SingleSelect as a } from "../inputs/SingleSelect.js";
|
|
7
|
+
import "react";
|
|
8
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
9
|
+
//#region src/components/core/filters/FilterField.tsx
|
|
10
|
+
var s = ({ field: s, value: c, onChange: l, onToggleMultiSelect: u }) => {
|
|
11
|
+
let { t: d } = e();
|
|
12
|
+
switch (s.type) {
|
|
13
|
+
case "text": return /* @__PURE__ */ o(t, {
|
|
14
|
+
placeholder: s.placeholder,
|
|
15
|
+
value: c ?? "",
|
|
16
|
+
onChange: (e) => {
|
|
17
|
+
l(e.target.value);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
case "number": return /* @__PURE__ */ o(t, {
|
|
21
|
+
type: "number",
|
|
22
|
+
placeholder: s.placeholder,
|
|
23
|
+
value: c ?? "",
|
|
24
|
+
onChange: (e) => {
|
|
25
|
+
l(e.target.value);
|
|
26
|
+
},
|
|
27
|
+
min: s.min,
|
|
28
|
+
max: s.max
|
|
29
|
+
});
|
|
30
|
+
case "select": return /* @__PURE__ */ o(a, {
|
|
31
|
+
options: s.options ?? [],
|
|
32
|
+
value: c,
|
|
33
|
+
onChange: l,
|
|
34
|
+
searchable: s.searchable === !0,
|
|
35
|
+
placeholder: s.placeholder,
|
|
36
|
+
searchPlaceholder: s.searchPlaceholder
|
|
37
|
+
});
|
|
38
|
+
case "date": return /* @__PURE__ */ o(r, {
|
|
39
|
+
date: c,
|
|
40
|
+
onDateChange: l,
|
|
41
|
+
placeholder: s.placeholder ?? d("date.pickDate")
|
|
42
|
+
});
|
|
43
|
+
case "date-range": return /* @__PURE__ */ o(i, {
|
|
44
|
+
value: c,
|
|
45
|
+
onChange: l,
|
|
46
|
+
placeholder: s.placeholder
|
|
47
|
+
});
|
|
48
|
+
case "multi-select": return /* @__PURE__ */ o(n, {
|
|
49
|
+
options: s.options ?? [],
|
|
50
|
+
selected: c ?? [],
|
|
51
|
+
onToggle: u,
|
|
52
|
+
onClear: () => {
|
|
53
|
+
l([]);
|
|
54
|
+
},
|
|
55
|
+
onSelectAll: l,
|
|
56
|
+
placeholder: s.placeholder,
|
|
57
|
+
searchable: s.searchable,
|
|
58
|
+
searchPlaceholder: s.searchPlaceholder
|
|
59
|
+
});
|
|
60
|
+
default: return null;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
//#endregion
|
|
64
|
+
export { s as FilterField };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FilterPillsGroup as e } from "./FilterPillsGroup.js";
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/core/filters/FilterPills.tsx
|
|
4
|
+
function n({ options: n, value: r, onChange: i, variant: a = "solid" }) {
|
|
5
|
+
return /* @__PURE__ */ t(e, {
|
|
6
|
+
options: n,
|
|
7
|
+
values: [r],
|
|
8
|
+
onToggle: i,
|
|
9
|
+
variant: a
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { n as FilterPills };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { cn as e } from "../../../helpers/tailwind.helper.js";
|
|
2
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/core/filters/FilterPillsGroup.tsx
|
|
4
|
+
var r = {
|
|
5
|
+
solid: "border-foreground bg-foreground text-background",
|
|
6
|
+
outline: "border-primary bg-primary/10 text-primary font-medium"
|
|
7
|
+
};
|
|
8
|
+
function i(t, n, i) {
|
|
9
|
+
return i === void 0 ? t ? r[n] : "border-border bg-background text-muted-foreground hover:text-foreground hover:border-foreground/40" : e(i, t ? "font-semibold" : "opacity-60 hover:opacity-100");
|
|
10
|
+
}
|
|
11
|
+
function a({ options: r, values: a, onToggle: o, variant: s = "solid" }) {
|
|
12
|
+
return /* @__PURE__ */ t("div", {
|
|
13
|
+
className: "flex flex-wrap gap-1.5",
|
|
14
|
+
children: r.map(({ value: r, label: c, count: l, icon: u, className: d }) => {
|
|
15
|
+
let f = i(a.includes(r), s, d);
|
|
16
|
+
return /* @__PURE__ */ n("button", {
|
|
17
|
+
onClick: () => {
|
|
18
|
+
o(r);
|
|
19
|
+
},
|
|
20
|
+
className: e("inline-flex items-center gap-1 text-xs px-2.5 py-1 rounded-control border transition-colors", f),
|
|
21
|
+
children: [
|
|
22
|
+
u && /* @__PURE__ */ t(u, { className: "size-3 shrink-0" }),
|
|
23
|
+
c,
|
|
24
|
+
" ",
|
|
25
|
+
l !== void 0 && /* @__PURE__ */ n("span", {
|
|
26
|
+
className: "opacity-60",
|
|
27
|
+
children: [
|
|
28
|
+
"(",
|
|
29
|
+
l,
|
|
30
|
+
")"
|
|
31
|
+
]
|
|
32
|
+
})
|
|
33
|
+
]
|
|
34
|
+
}, String(r));
|
|
35
|
+
})
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { a as FilterPillsGroup };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { useKrosoftTranslation as e } from "../../../i18n/useKrosoftTranslation.js";
|
|
2
|
+
import { Button as t } from "../../ui/button.js";
|
|
3
|
+
import { SearchInput as n } from "../inputs/SearchInput.js";
|
|
4
|
+
import { useMobile as r } from "../../../hooks/ui/useMobile.js";
|
|
5
|
+
import { FiltersMobileDrawer as i } from "./FiltersMobileDrawer.js";
|
|
6
|
+
import "react";
|
|
7
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
8
|
+
import { FilterXIcon as s } from "lucide-react";
|
|
9
|
+
//#region src/components/core/filters/FiltersContainer.tsx
|
|
10
|
+
function c({ children: c, search: l, searchPlaceholder: u, activeFiltersCount: d = 0, onReset: f, onSearch: p }) {
|
|
11
|
+
let { t: m } = e();
|
|
12
|
+
return r() ? /* @__PURE__ */ o("div", {
|
|
13
|
+
className: "flex items-center gap-2",
|
|
14
|
+
children: [p !== void 0 && /* @__PURE__ */ a("div", {
|
|
15
|
+
className: "flex-1",
|
|
16
|
+
children: /* @__PURE__ */ a(n, {
|
|
17
|
+
search: l ?? "",
|
|
18
|
+
onSearch: p,
|
|
19
|
+
placeholder: u
|
|
20
|
+
})
|
|
21
|
+
}), /* @__PURE__ */ a(i, {
|
|
22
|
+
activeFiltersCount: d,
|
|
23
|
+
onReset: f,
|
|
24
|
+
children: c
|
|
25
|
+
})]
|
|
26
|
+
}) : /* @__PURE__ */ o("div", {
|
|
27
|
+
className: "flex justify-between",
|
|
28
|
+
children: [/* @__PURE__ */ o("div", {
|
|
29
|
+
className: "flex flex-wrap gap-2",
|
|
30
|
+
children: [p !== void 0 && /* @__PURE__ */ a(n, {
|
|
31
|
+
search: l ?? "",
|
|
32
|
+
onSearch: p,
|
|
33
|
+
placeholder: u
|
|
34
|
+
}), c]
|
|
35
|
+
}), f && /* @__PURE__ */ a("div", {
|
|
36
|
+
className: "flex flex-wrap gap-4",
|
|
37
|
+
children: /* @__PURE__ */ o(t, {
|
|
38
|
+
variant: "outline",
|
|
39
|
+
onClick: f,
|
|
40
|
+
className: "relative",
|
|
41
|
+
children: [
|
|
42
|
+
/* @__PURE__ */ a(s, {}),
|
|
43
|
+
m("filters.reset"),
|
|
44
|
+
d > 0 && /* @__PURE__ */ a("span", {
|
|
45
|
+
className: "absolute -top-2 -right-2 flex h-5 w-5 items-center justify-center rounded-full bg-primary text-xs text-primary-foreground",
|
|
46
|
+
children: d
|
|
47
|
+
})
|
|
48
|
+
]
|
|
49
|
+
})
|
|
50
|
+
})]
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
export { c as FiltersContainer };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { useKrosoftTranslation as e } from "../../../i18n/useKrosoftTranslation.js";
|
|
2
|
+
import { Button as t } from "../../ui/button.js";
|
|
3
|
+
import { Drawer as n, DrawerClose as r, DrawerContent as i, DrawerFooter as a, DrawerHeader as o, DrawerTitle as s, DrawerTrigger as c } from "../../ui/drawer.js";
|
|
4
|
+
import { useState as l } from "react";
|
|
5
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
6
|
+
import { FilterIcon as f, FilterXIcon as p } from "lucide-react";
|
|
7
|
+
//#region src/components/core/filters/FiltersMobileDrawer.tsx
|
|
8
|
+
function m({ children: m, activeFiltersCount: h = 0, onReset: g, onApply: _ }) {
|
|
9
|
+
let { t: v } = e(), [y, b] = l(!1);
|
|
10
|
+
return /* @__PURE__ */ d(n, {
|
|
11
|
+
open: y,
|
|
12
|
+
onOpenChange: b,
|
|
13
|
+
children: [/* @__PURE__ */ u(c, {
|
|
14
|
+
asChild: !0,
|
|
15
|
+
children: /* @__PURE__ */ d(t, {
|
|
16
|
+
variant: "outline",
|
|
17
|
+
className: "relative",
|
|
18
|
+
children: [
|
|
19
|
+
/* @__PURE__ */ u(f, { className: "h-4 w-4 mr-2" }),
|
|
20
|
+
v("filters.filter"),
|
|
21
|
+
h > 0 && /* @__PURE__ */ u("span", {
|
|
22
|
+
className: "absolute -top-2 -right-2 flex h-5 w-5 items-center justify-center rounded-full bg-primary text-xs text-primary-foreground",
|
|
23
|
+
children: h
|
|
24
|
+
})
|
|
25
|
+
]
|
|
26
|
+
})
|
|
27
|
+
}), /* @__PURE__ */ d(i, { children: [
|
|
28
|
+
/* @__PURE__ */ u(o, { children: /* @__PURE__ */ u(s, { children: v("filters.title") }) }),
|
|
29
|
+
/* @__PURE__ */ u("div", {
|
|
30
|
+
className: "flex flex-col gap-4 px-4 pb-4",
|
|
31
|
+
children: m
|
|
32
|
+
}),
|
|
33
|
+
/* @__PURE__ */ d(a, {
|
|
34
|
+
className: "flex-row gap-2",
|
|
35
|
+
children: [/* @__PURE__ */ d(t, {
|
|
36
|
+
variant: "outline",
|
|
37
|
+
onClick: () => {
|
|
38
|
+
g?.(), b(!1);
|
|
39
|
+
},
|
|
40
|
+
className: "flex-1",
|
|
41
|
+
children: [/* @__PURE__ */ u(p, { className: "h-4 w-4 mr-2" }), v("filters.reset")]
|
|
42
|
+
}), /* @__PURE__ */ u(r, {
|
|
43
|
+
asChild: !0,
|
|
44
|
+
children: /* @__PURE__ */ u(t, {
|
|
45
|
+
onClick: () => {
|
|
46
|
+
_?.(), b(!1);
|
|
47
|
+
},
|
|
48
|
+
className: "flex-1",
|
|
49
|
+
children: v("actions.apply")
|
|
50
|
+
})
|
|
51
|
+
})]
|
|
52
|
+
})
|
|
53
|
+
] })]
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
export { m as FiltersMobileDrawer };
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { useKrosoftTranslation as e } from "../../../i18n/useKrosoftTranslation.js";
|
|
2
|
+
import { SearchInput as t } from "../inputs/SearchInput.js";
|
|
3
|
+
import { MultiSelect as n } from "../inputs/MultiSelect.js";
|
|
4
|
+
import { ActiveFilters as r } from "./ActiveFilters.js";
|
|
5
|
+
import { AdvancedFilters as i } from "./AdvancedFilters.js";
|
|
6
|
+
import { useMemo as a } from "react";
|
|
7
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/core/filters/TableFilter.tsx
|
|
9
|
+
function c({ searchQuery: c, onSearchChange: l, searchPlaceholder: u, filters: d, onFiltersChange: f, sections: p, advancedButtonText: m, sheetTitle: h }) {
|
|
10
|
+
let { t: g } = e(), _ = (e, t) => {
|
|
11
|
+
let n = d[e], r = Array.isArray(n) ? n : [], i = r.includes(t) ? r.filter((e) => e !== t) : [...r, t], a = { ...d };
|
|
12
|
+
i.length === 0 ? delete a[e] : a[e] = i, f(a);
|
|
13
|
+
}, v = (e) => {
|
|
14
|
+
let t = { ...d };
|
|
15
|
+
delete t[e], f(t);
|
|
16
|
+
}, y = () => {
|
|
17
|
+
f({});
|
|
18
|
+
}, b = (e, t) => {
|
|
19
|
+
let n = { ...d }, r = n[e];
|
|
20
|
+
Array.isArray(r) ? t === void 0 ? delete n[e] : (n[e] = r.filter((e) => e !== t), Array.isArray(n[e]) && n[e].length === 0 && delete n[e]) : delete n[e], f(n);
|
|
21
|
+
}, x = a(() => {
|
|
22
|
+
let e = [];
|
|
23
|
+
return p.forEach((t) => {
|
|
24
|
+
t.filters.forEach((t) => {
|
|
25
|
+
t.isQuickFilter === !0 && e.push({
|
|
26
|
+
key: t.key,
|
|
27
|
+
labelKey: t.labelKey,
|
|
28
|
+
options: t.options ?? [],
|
|
29
|
+
searchable: t.searchable,
|
|
30
|
+
searchPlaceholder: t.searchPlaceholder
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
}), e;
|
|
34
|
+
}, [p]), S = a(() => {
|
|
35
|
+
let e = {};
|
|
36
|
+
return p.forEach((t) => {
|
|
37
|
+
t.filters.forEach((t) => {
|
|
38
|
+
e[t.key] = t.badgeLabelKey ?? t.labelKey;
|
|
39
|
+
});
|
|
40
|
+
}), e;
|
|
41
|
+
}, [p]), C = a(() => {
|
|
42
|
+
let e = {};
|
|
43
|
+
return p.forEach((t) => {
|
|
44
|
+
t.filters.forEach((t) => {
|
|
45
|
+
t.options !== void 0 && t.options.forEach((n) => {
|
|
46
|
+
e[`${t.key}_${n.value}`] = n.label;
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
}), e;
|
|
50
|
+
}, [p]);
|
|
51
|
+
return /* @__PURE__ */ s("div", {
|
|
52
|
+
className: "space-y-4 w-full",
|
|
53
|
+
children: [/* @__PURE__ */ s("div", {
|
|
54
|
+
className: "flex flex-wrap items-center gap-2 justify-between",
|
|
55
|
+
children: [/* @__PURE__ */ s("div", {
|
|
56
|
+
className: "flex flex-wrap items-center gap-2",
|
|
57
|
+
children: [l === void 0 ? null : /* @__PURE__ */ o(t, {
|
|
58
|
+
searchQuery: c,
|
|
59
|
+
onSearch: l,
|
|
60
|
+
onClear: () => {
|
|
61
|
+
l("");
|
|
62
|
+
},
|
|
63
|
+
placeholder: u ?? g("search.placeholder")
|
|
64
|
+
}), x.map((e) => /* @__PURE__ */ o(n, {
|
|
65
|
+
variant: "pill",
|
|
66
|
+
labelKey: e.labelKey,
|
|
67
|
+
options: e.options,
|
|
68
|
+
selected: Array.isArray(d[e.key]) ? d[e.key] : [],
|
|
69
|
+
onToggle: (t) => {
|
|
70
|
+
_(e.key, t);
|
|
71
|
+
},
|
|
72
|
+
onClear: () => {
|
|
73
|
+
v(e.key);
|
|
74
|
+
},
|
|
75
|
+
onSelectAll: (t) => {
|
|
76
|
+
f({
|
|
77
|
+
...d,
|
|
78
|
+
[e.key]: t
|
|
79
|
+
});
|
|
80
|
+
},
|
|
81
|
+
searchable: e.searchable,
|
|
82
|
+
searchPlaceholder: e.searchPlaceholder
|
|
83
|
+
}, e.key))]
|
|
84
|
+
}), p.length > 0 && /* @__PURE__ */ o(i, {
|
|
85
|
+
sections: p,
|
|
86
|
+
filters: d,
|
|
87
|
+
onFiltersChange: f,
|
|
88
|
+
buttonText: m,
|
|
89
|
+
sheetTitle: h
|
|
90
|
+
})]
|
|
91
|
+
}), /* @__PURE__ */ o(r, {
|
|
92
|
+
filters: d,
|
|
93
|
+
onRemoveFilter: b,
|
|
94
|
+
onClearAll: y,
|
|
95
|
+
filterLabelKeys: S,
|
|
96
|
+
optionLabels: C
|
|
97
|
+
})]
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
//#endregion
|
|
101
|
+
export { c as TableFilter };
|