@krosoft/react 0.0.381 → 0.0.382
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/components/core/cards/DashboardCard.js +18 -0
- package/dist/components/core/cards/KpiCard.js +36 -0
- package/dist/components/core/cards/KpiCards.js +29 -0
- package/dist/components/core/cards/MetricCard.js +63 -0
- package/dist/components/core/cards/SkeletonCard.js +13 -0
- package/dist/components/core/cards/SkeletonCards.js +11 -0
- package/dist/components/core/cards/index.js +7 -1
- package/dist/components/core/changelog/AppChangelog.js +123 -0
- package/dist/components/core/changelog/AppChangelogEntry.js +85 -0
- package/dist/components/core/changelog/AppChangelogNav.js +39 -0
- package/dist/components/core/changelog/AppChangelogTagFilter.js +39 -0
- package/dist/components/core/changelog/index.js +1 -1
- package/dist/components/core/charts/BarChartHorizontal.js +80 -0
- package/dist/components/core/charts/BarChartVertical.js +68 -0
- package/dist/components/core/charts/ChartCard.js +44 -0
- package/dist/components/core/charts/CircularGauge.js +58 -0
- package/dist/components/core/charts/LineChart.js +69 -0
- package/dist/components/core/charts/PieChart.js +55 -0
- package/dist/components/core/charts/chartColors.js +10 -0
- package/dist/components/core/charts/chartTooltip.helper.js +15 -0
- package/dist/components/core/charts/index.js +8 -1
- package/dist/components/core/dialogs/AboutDialog.js +59 -0
- package/dist/components/core/dialogs/AppDialog.js +81 -0
- package/dist/components/core/dialogs/ConfirmationDialog.js +42 -0
- package/dist/components/core/dialogs/FormDialog.js +105 -0
- package/dist/components/core/dialogs/index.js +7 -4
- package/dist/components/core/filters/ActiveFilters.js +69 -0
- package/dist/components/core/filters/AdvancedFilters.js +103 -0
- package/dist/components/core/filters/ConditionFilter.js +162 -0
- package/dist/components/core/filters/ConditionFilterGroup.js +44 -0
- package/dist/components/core/filters/FilterField.js +64 -0
- package/dist/components/core/filters/FilterPills.js +13 -0
- package/dist/components/core/filters/FilterPillsGroup.js +39 -0
- package/dist/components/core/filters/FiltersContainer.js +54 -0
- package/dist/components/core/filters/FiltersMobileDrawer.js +57 -0
- package/dist/components/core/filters/TableFilter.js +101 -0
- package/dist/components/core/filters/index.js +11 -645
- package/dist/{GenericForm-Dxd6k7l-.js → components/core/forms/GenericForm.js} +45 -43
- package/dist/components/core/forms/index.js +1 -1
- package/dist/components/core/icons/FlagFrIcon.js +28 -0
- package/dist/{icons-n0m_1w7z.js → components/core/icons/FlagGbIcon.js} +3 -26
- package/dist/components/core/icons/index.js +3 -1
- package/dist/components/core/index.js +71 -27
- package/dist/components/core/inputs/DatePicker.js +46 -0
- package/dist/components/core/inputs/DateRangePicker.js +92 -0
- package/dist/{inputs-CBojnClc.js → components/core/inputs/FileDropzone.js} +8 -37
- package/dist/{ImageInput-BeIOm3GY.js → components/core/inputs/ImageInput.js} +5 -5
- package/dist/components/core/inputs/MultiSelect.js +191 -0
- package/dist/components/core/inputs/RatingInput.js +36 -0
- package/dist/{SearchInput-IT_Rvthr.js → components/core/inputs/SearchInput.js} +4 -4
- package/dist/components/core/inputs/SingleSelect.js +198 -0
- package/dist/components/core/inputs/index.js +9 -6
- package/dist/components/core/inputs/select.helper.js +46 -0
- package/dist/{language-DY0EYabh.js → components/core/language/LanguageSelector.js} +13 -12
- package/dist/components/core/language/index.js +1 -1
- package/dist/{AppActions-8HjAaTQK.js → components/core/layouts/AppActions.js} +19 -19
- package/dist/components/core/layouts/AppPageHeader.js +44 -0
- package/dist/{AppSubTitle-DI62BaaB.js → components/core/layouts/AppSubTitle.js} +3 -3
- package/dist/{AppTitle-BXoTrXQc.js → components/core/layouts/AppTitle.js} +3 -3
- package/dist/components/core/layouts/KpiCardsLayout.js +8 -0
- package/dist/components/core/layouts/index.js +6 -50
- package/dist/components/core/markdown/AppMarkdown.js +134 -0
- package/dist/components/core/markdown/AppMarkdownHeading.js +45 -0
- package/dist/components/core/markdown/index.js +1 -1
- package/dist/components/core/navbar/GlobalSearch.js +128 -0
- package/dist/components/core/navbar/NotificationsBell.js +133 -0
- package/dist/components/core/navbar/Sidebar.js +99 -0
- package/dist/components/core/navbar/SidebarHeader.js +26 -0
- package/dist/components/core/navbar/SidebarNavItem.js +72 -0
- package/dist/components/core/navbar/Topbar.js +25 -0
- package/dist/components/core/navbar/index.js +7 -1
- package/dist/{ErrorAlert-cJnfBL8H.js → components/core/states/ErrorAlert.js} +5 -5
- package/dist/{states-CJ8xE_Nm.js → components/core/states/ErrorState.js} +4 -11
- package/dist/components/core/states/LoadingState.js +12 -0
- package/dist/components/core/states/index.js +3 -2
- package/dist/components/core/table/DataTable.js +108 -0
- package/dist/components/core/table/JsonTableOutput.js +75 -0
- package/dist/components/core/table/TableActions.js +75 -0
- package/dist/components/core/table/TableBody.js +130 -0
- package/dist/components/core/table/TableBulkActions.js +47 -0
- package/dist/components/core/table/TableHeader.js +103 -0
- package/dist/components/core/table/TablePagination.js +102 -0
- package/dist/components/core/table/TableSettings.js +117 -0
- package/dist/components/core/table/index.js +9 -709
- package/dist/components/core/tabs/AppTabContainer.js +17 -0
- package/dist/components/core/tabs/AppTabHeader.js +19 -0
- package/dist/components/core/tabs/AppTabs.js +56 -0
- package/dist/components/core/tabs/AppVerticalTabs.js +105 -0
- package/dist/components/core/tabs/index.js +5 -188
- package/dist/{theme-DSumNHLX.js → components/core/theme/ThemeSelector.js} +13 -12
- package/dist/components/core/theme/index.js +1 -1
- package/dist/components/index.js +117 -34
- package/dist/components/ui/accordion.js +34 -0
- package/dist/components/ui/alert-dialog.js +54 -0
- package/dist/{alert-REQGK9bR.js → components/ui/alert.js} +2 -2
- package/dist/components/ui/aspect-ratio.js +5 -0
- package/dist/components/ui/avatar.js +25 -0
- package/dist/components/ui/badge.js +22 -0
- package/dist/components/ui/breadcrumb.js +60 -0
- package/dist/{tooltip-_geGvbS7.js → components/ui/button.js} +7 -17
- package/dist/components/ui/calendar.js +44 -0
- package/dist/components/ui/card.js +42 -0
- package/dist/components/ui/carousel.js +115 -0
- package/dist/{chart-wW-fwL3s.js → components/ui/chart.js} +51 -89
- package/dist/components/ui/checkbox.js +31 -0
- package/dist/components/ui/collapsible.js +5 -0
- package/dist/components/ui/command.js +84 -0
- package/dist/components/ui/context-menu.js +71 -0
- package/dist/components/ui/control.js +5 -0
- package/dist/components/ui/dialog.js +49 -0
- package/dist/components/ui/drawer.js +47 -0
- package/dist/components/ui/dropdown-menu.js +72 -0
- package/dist/components/ui/form.js +78 -0
- package/dist/components/ui/hover-card.js +15 -0
- package/dist/components/ui/index.js +49 -9
- package/dist/components/ui/input-otp.js +41 -0
- package/dist/components/ui/input.js +14 -0
- package/dist/components/ui/label.js +14 -0
- package/dist/components/ui/menubar.js +86 -0
- package/dist/components/ui/navigation-menu.js +58 -0
- package/dist/components/ui/pagination.js +62 -0
- package/dist/components/ui/popover.js +15 -0
- package/dist/components/ui/progress.js +17 -0
- package/dist/components/ui/radio-group.js +24 -0
- package/dist/components/ui/resizable.js +18 -0
- package/dist/components/ui/scroll-area.js +29 -0
- package/dist/{select-KWMg2_7Z.js → components/ui/select.js} +3 -3
- package/dist/components/ui/separator.js +15 -0
- package/dist/components/ui/sheet.js +58 -0
- package/dist/components/ui/simple-table.js +57 -0
- package/dist/{skeleton-D6Ga4BLw.js → components/ui/skeleton.js} +2 -2
- package/dist/components/ui/slider.js +17 -0
- package/dist/components/ui/sonner.js +23 -0
- package/dist/components/ui/switch.js +14 -0
- package/dist/components/ui/tabs.js +58 -0
- package/dist/components/ui/textarea.js +12 -0
- package/dist/components/ui/toast.js +53 -0
- package/dist/components/ui/toaster.js +22 -0
- package/dist/components/ui/toggle-group.js +37 -0
- package/dist/components/ui/toggle.js +34 -0
- package/dist/components/ui/tooltip.js +14 -0
- package/dist/{datatable-COQcYUrk.js → constants/datatable.js} +1 -1
- package/dist/constants/index.js +3 -5
- package/dist/constants/search.js +4 -0
- package/dist/contexts/index.js +3 -1
- package/dist/{sidebar.context-BahtU6hE.js → contexts/page.context.js} +2 -2
- package/dist/contexts/sidebar.context.js +5 -0
- package/dist/helpers/changelog.helper.js +69 -0
- package/dist/helpers/index.js +6 -166
- package/dist/{markdown.helper-YJE2H5KQ.js → helpers/markdown.helper.js} +1 -1
- package/dist/helpers/supabase.helper.js +41 -0
- package/dist/helpers/table.helper.js +56 -0
- package/dist/{tailwind.helper-CJaRYBmL.js → helpers/tailwind.helper.js} +1 -1
- package/dist/hooks/behavior/index.js +10 -1
- package/dist/hooks/behavior/useConfirmDeleteDialog.js +21 -0
- package/dist/hooks/behavior/useConfirmationDialog.js +23 -0
- package/dist/hooks/behavior/useDebounce.js +14 -0
- package/dist/hooks/behavior/useDebouncedValue.js +15 -0
- package/dist/hooks/behavior/useDialog.js +21 -0
- package/dist/hooks/behavior/usePage.js +10 -0
- package/dist/hooks/behavior/useSidebar.js +10 -0
- package/dist/hooks/behavior/useTable.js +83 -0
- package/dist/hooks/behavior/useUrlState.js +46 -0
- package/dist/hooks/index.js +20 -11
- package/dist/hooks/ui/index.js +11 -10
- package/dist/{useFixedColumns-Bo-Az3Hp.js → hooks/ui/useDataTable.js} +16 -52
- package/dist/{useDocumentTitle-VoQkict_.js → hooks/ui/useDocumentTitle.js} +2 -2
- package/dist/hooks/ui/useFixedColumns.js +38 -0
- package/dist/{useLanguage-DRnSb5H1.js → hooks/ui/useLanguage.js} +3 -3
- package/dist/{useMobile-pTQ8lWvt.js → hooks/ui/useMobile.js} +1 -1
- package/dist/{useNotifications-CyhTruIG.js → hooks/ui/useNotifications.js} +2 -2
- package/dist/{useScrollFade-D9kqJBDh.js → hooks/ui/useScrollFade.js} +1 -1
- package/dist/{ui-nQGnCss1.js → hooks/ui/useServerTable.js} +2 -2
- package/dist/{useTheme-DIZjiF5F.js → hooks/ui/useTheme.js} +3 -3
- package/dist/{useToast-UeDRLovh.js → hooks/ui/useToast.js} +1 -1
- package/dist/i18n/index.js +4 -1
- package/dist/i18n/krosoftLocales.js +13 -0
- package/dist/i18n/useDateFnsLocale.js +13 -0
- package/dist/i18n/useKrosoftTranslation.js +13 -0
- package/dist/locales/en.json.js +174 -0
- package/dist/locales/fr.json.js +174 -0
- package/dist/providers/SidebarProvider.js +42 -0
- package/dist/providers/index.js +1 -42
- package/dist/pwa/PwaUpdater.js +30 -0
- package/dist/pwa/index.js +3 -50
- package/dist/pwa/pwaUpdateToast.js +25 -0
- package/dist/seasonal/EffectSwitch.js +24 -0
- package/dist/seasonal/EmojiSnowfall.js +24 -0
- package/dist/seasonal/HalloweenEffect.js +17 -0
- package/dist/seasonal/SeasonalEffects.js +8 -0
- package/dist/seasonal/SeasonalEffectsSettings.js +35 -0
- package/dist/seasonal/SnowEffect.js +12 -0
- package/dist/seasonal/index.js +7 -120
- package/dist/seasonal/overlayStyle.js +12 -0
- package/dist/seasonal/seasons.js +7 -0
- package/dist/seasonal/useSeasonalEffects.js +20 -0
- package/dist/seasonal/useStoredToggle.js +21 -0
- package/dist/tailwind/index.js +7 -53
- package/dist/tokens/apply.js +16 -0
- package/dist/tokens/index.js +3 -38
- package/dist/tokens/radius.js +26 -0
- package/dist/types/index.js +0 -1
- package/dist/vendor/tailwindcss/lib/public/create-plugin.js +19 -0
- package/dist/vendor/tailwindcss/lib/util/createPlugin.js +30 -0
- package/dist/vendor/tailwindcss/plugin.js +10 -0
- package/package.json +3 -3
- package/dist/AppMarkdown-CAxm82x0.js +0 -171
- package/dist/MultiSelect-DPN046kI.js +0 -228
- package/dist/SingleSelect-DLY5WylQ.js +0 -313
- package/dist/behavior-B0BYivtN.js +0 -201
- package/dist/cards-DPzVebUM.js +0 -132
- package/dist/changelog-DyPFIscf.js +0 -257
- package/dist/charts-C7rKxkli.js +0 -342
- package/dist/dialogs-CG9Q7pqY.js +0 -269
- package/dist/i18n-BhLphJa3.js +0 -364
- package/dist/navbar-DD0V0pNE.js +0 -432
- package/dist/sheet-cWJO_wkT.js +0 -225
- package/dist/switch-DspImmo_.js +0 -24
- package/dist/ui-Fxy95kSJ.js +0 -1163
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { cn as e } from "../../../helpers/tailwind.helper.js";
|
|
2
|
+
import { useKrosoftTranslation as t } from "../../../i18n/useKrosoftTranslation.js";
|
|
3
|
+
import { Badge as ee } from "../../ui/badge.js";
|
|
4
|
+
import { Checkbox as n } from "../../ui/checkbox.js";
|
|
5
|
+
import { controlBaseClass as te, controlFilterWidthClass as r, controlTriggerClass as i } from "../../ui/control.js";
|
|
6
|
+
import { Popover as a, PopoverContent as o, PopoverTrigger as s } from "../../ui/popover.js";
|
|
7
|
+
import { renderOptionThumbnail as ne, useOptionWindow as re } from "./select.helper.js";
|
|
8
|
+
import { useMemo as c, useState as l } from "react";
|
|
9
|
+
import { Fragment as ie, jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
10
|
+
import { ChevronDownIcon as f, SearchIcon as p, XIcon as m } from "lucide-react";
|
|
11
|
+
import { Command as h } from "cmdk";
|
|
12
|
+
//#region src/components/core/inputs/MultiSelect.tsx
|
|
13
|
+
var g = ({ options: g, selected: _, onToggle: v, onClear: y, onSelectAll: b, variant: x = "input", placeholder: S, labelKey: C, searchable: w = !1, searchPlaceholder: T, disabled: E = !1, modal: D = !0, chips: O = !1, maxCount: k, className: A, ...j }) => {
|
|
14
|
+
let { t: M } = t(), [N, P] = l(""), [F, I] = l(!1), L = x === "pill", R = x === "input" ? void 0 : r, z = c(() => N === "" ? g : g.filter((e) => e.label.toLowerCase().includes(N.toLowerCase())), [g, N]), B = c(() => z.filter((e) => e.disabled !== !0).map((e) => e.value), [z]), V = c(() => _.filter((e) => g.find((t) => t.value === e)?.disabled === !0), [g, _]), H = c(() => B.length !== 0 && B.every((e) => _.includes(e)), [B, _]), U = c(() => _.map((e) => g.find((t) => t.value === e)?.label ?? e), [g, _]), W = k !== void 0 && k > 0 ? U.slice(0, k) : U, G = U.length - W.length, { listRef: K, virtualized: q, startIndex: J, endIndex: ae, padTop: Y, padBottom: X, onScroll: oe, resetScroll: Z } = re(F, z.length, g.some((e) => e.imageUrl !== void 0)), se = q ? z.slice(J, ae) : z, ce = (e) => {
|
|
15
|
+
I(e), e ? Z() : P("");
|
|
16
|
+
}, le = (e) => {
|
|
17
|
+
P(e), Z();
|
|
18
|
+
}, ue = () => {
|
|
19
|
+
V.length > 0 ? b === void 0 ? _.filter((e) => !V.includes(e)).forEach((e) => {
|
|
20
|
+
v(e);
|
|
21
|
+
}) : b(V) : y === void 0 ? b === void 0 ? _.forEach((e) => {
|
|
22
|
+
v(e);
|
|
23
|
+
}) : b([]) : y();
|
|
24
|
+
}, Q = () => {
|
|
25
|
+
if (H) b === void 0 ? y !== void 0 && _.every((e) => B.includes(e)) ? y() : B.forEach((e) => {
|
|
26
|
+
v(e);
|
|
27
|
+
}) : b(_.filter((e) => !B.includes(e)));
|
|
28
|
+
else if (b !== void 0) {
|
|
29
|
+
let e = [..._];
|
|
30
|
+
B.forEach((t) => {
|
|
31
|
+
e.includes(t) || e.push(t);
|
|
32
|
+
}), b(e);
|
|
33
|
+
} else B.forEach((e) => {
|
|
34
|
+
_.includes(e) || v(e);
|
|
35
|
+
});
|
|
36
|
+
}, $ = c(() => _.map((e) => ({
|
|
37
|
+
value: e,
|
|
38
|
+
option: g.find((t) => t.value === e)
|
|
39
|
+
})), [g, _]), de = L ? /* @__PURE__ */ d("button", {
|
|
40
|
+
...j,
|
|
41
|
+
type: "button",
|
|
42
|
+
disabled: E,
|
|
43
|
+
className: e(te, "inline-flex items-center justify-between gap-1.5 whitespace-nowrap transition-colors", _.length > 0 ? "border-primary bg-primary/10 text-primary font-medium" : "hover:bg-muted", R, A),
|
|
44
|
+
children: [/* @__PURE__ */ u("span", {
|
|
45
|
+
className: "truncate",
|
|
46
|
+
children: C === void 0 ? S ?? M("select.placeholder") : M(C)
|
|
47
|
+
}), /* @__PURE__ */ d("div", {
|
|
48
|
+
className: "flex shrink-0 items-center gap-1.5",
|
|
49
|
+
children: [_.length > 0 && /* @__PURE__ */ u("span", {
|
|
50
|
+
className: "flex h-4 min-w-[16px] items-center justify-center rounded-full bg-primary px-1 text-[10px] font-bold text-primary-foreground",
|
|
51
|
+
children: _.length
|
|
52
|
+
}), /* @__PURE__ */ u(f, { className: e("size-3.5 opacity-60 transition-transform", F && "rotate-180") })]
|
|
53
|
+
})]
|
|
54
|
+
}) : /* @__PURE__ */ d("button", {
|
|
55
|
+
...j,
|
|
56
|
+
type: "button",
|
|
57
|
+
disabled: E,
|
|
58
|
+
className: e(i, "w-full", R, F && "ring-2 ring-ring ring-offset-2", _.length === 0 && "text-muted-foreground", A),
|
|
59
|
+
children: [/* @__PURE__ */ u("span", {
|
|
60
|
+
className: "truncate",
|
|
61
|
+
children: _.length === 0 ? S ?? M("select.placeholder") : W.join(", ")
|
|
62
|
+
}), /* @__PURE__ */ d("div", {
|
|
63
|
+
className: "flex shrink-0 items-center gap-1",
|
|
64
|
+
children: [
|
|
65
|
+
G > 0 && /* @__PURE__ */ d("span", {
|
|
66
|
+
className: "rounded-control bg-muted px-1.5 py-0.5 text-xs font-medium text-foreground",
|
|
67
|
+
children: ["+", G]
|
|
68
|
+
}),
|
|
69
|
+
_.length > 0 && !E && /* @__PURE__ */ u("span", {
|
|
70
|
+
role: "button",
|
|
71
|
+
tabIndex: -1,
|
|
72
|
+
onClick: (e) => {
|
|
73
|
+
e.stopPropagation();
|
|
74
|
+
},
|
|
75
|
+
onPointerDown: (e) => {
|
|
76
|
+
e.preventDefault(), e.stopPropagation(), ue();
|
|
77
|
+
},
|
|
78
|
+
className: "text-muted-foreground hover:text-foreground",
|
|
79
|
+
children: /* @__PURE__ */ u(m, { className: "size-4" })
|
|
80
|
+
}),
|
|
81
|
+
/* @__PURE__ */ u(f, { className: e("size-4 opacity-50 shrink-0 transition-transform", F && "rotate-180") })
|
|
82
|
+
]
|
|
83
|
+
})]
|
|
84
|
+
}), fe = O && $.length > 0 ? /* @__PURE__ */ u("div", {
|
|
85
|
+
className: "mt-2 flex flex-wrap gap-1.5",
|
|
86
|
+
children: $.map(({ value: e, option: t }) => {
|
|
87
|
+
let n = t?.disabled === !0;
|
|
88
|
+
return /* @__PURE__ */ d(ee, {
|
|
89
|
+
variant: "secondary",
|
|
90
|
+
className: "flex items-center gap-1 border border-primary/20 bg-primary/10 py-0.5 pl-2 pr-1 text-primary",
|
|
91
|
+
children: [/* @__PURE__ */ u("span", {
|
|
92
|
+
className: "max-w-[16rem] truncate",
|
|
93
|
+
children: t?.label ?? e
|
|
94
|
+
}), !n && /* @__PURE__ */ u("button", {
|
|
95
|
+
type: "button",
|
|
96
|
+
onClick: () => {
|
|
97
|
+
v(e);
|
|
98
|
+
},
|
|
99
|
+
className: "rounded-full p-0.5 hover:bg-primary/20",
|
|
100
|
+
"aria-label": M("filters.remove"),
|
|
101
|
+
children: /* @__PURE__ */ u(m, { className: "size-3" })
|
|
102
|
+
})]
|
|
103
|
+
}, e);
|
|
104
|
+
})
|
|
105
|
+
}) : null;
|
|
106
|
+
return /* @__PURE__ */ d(ie, { children: [/* @__PURE__ */ d(a, {
|
|
107
|
+
open: F,
|
|
108
|
+
onOpenChange: ce,
|
|
109
|
+
modal: D,
|
|
110
|
+
children: [/* @__PURE__ */ u(s, {
|
|
111
|
+
asChild: !0,
|
|
112
|
+
children: de
|
|
113
|
+
}), /* @__PURE__ */ d(o, {
|
|
114
|
+
className: e("p-0", L ? "w-72 max-w-[var(--radix-popover-content-available-width)]" : "w-[var(--radix-popover-trigger-width)]"),
|
|
115
|
+
align: "start",
|
|
116
|
+
children: [/* @__PURE__ */ d(h, {
|
|
117
|
+
shouldFilter: !1,
|
|
118
|
+
className: "flex flex-col",
|
|
119
|
+
children: [w ? /* @__PURE__ */ u("div", {
|
|
120
|
+
className: "border-b border-border p-2",
|
|
121
|
+
children: /* @__PURE__ */ d("div", {
|
|
122
|
+
className: "relative",
|
|
123
|
+
children: [/* @__PURE__ */ u(p, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }), /* @__PURE__ */ u(h.Input, {
|
|
124
|
+
value: N,
|
|
125
|
+
onValueChange: le,
|
|
126
|
+
placeholder: T ?? M("search.placeholder"),
|
|
127
|
+
className: "w-full rounded-control bg-muted/50 py-1.5 pl-7 pr-2 text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring",
|
|
128
|
+
autoFocus: !0
|
|
129
|
+
})]
|
|
130
|
+
})
|
|
131
|
+
}) : /* @__PURE__ */ u(h.Input, {
|
|
132
|
+
autoFocus: !0,
|
|
133
|
+
tabIndex: -1,
|
|
134
|
+
className: "sr-only"
|
|
135
|
+
}), /* @__PURE__ */ d(h.List, {
|
|
136
|
+
ref: K,
|
|
137
|
+
onScroll: oe,
|
|
138
|
+
className: e("flex flex-col max-h-56 overflow-y-auto overflow-x-hidden p-1.5 scrollbar-thin scrollbar-thumb-rounded scrollbar-thumb-muted-foreground/20 scrollbar-track-transparent [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-muted-foreground/20 [&::-webkit-scrollbar-track]:bg-transparent", !q && "gap-0.5"),
|
|
139
|
+
children: [
|
|
140
|
+
z.length === 0 && /* @__PURE__ */ u("p", {
|
|
141
|
+
className: "px-2 py-3 text-center text-xs text-muted-foreground",
|
|
142
|
+
children: M("states.noResult")
|
|
143
|
+
}),
|
|
144
|
+
Y > 0 && /* @__PURE__ */ u("div", {
|
|
145
|
+
"aria-hidden": !0,
|
|
146
|
+
style: { height: Y }
|
|
147
|
+
}),
|
|
148
|
+
se.map((e) => /* @__PURE__ */ d(h.Item, {
|
|
149
|
+
value: e.value,
|
|
150
|
+
disabled: e.disabled,
|
|
151
|
+
onSelect: () => {
|
|
152
|
+
v(e.value);
|
|
153
|
+
},
|
|
154
|
+
className: "flex min-w-0 items-center gap-2.5 rounded-md px-2 py-2 text-sm cursor-pointer transition-colors data-[selected=true]:bg-muted data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-50",
|
|
155
|
+
children: [
|
|
156
|
+
/* @__PURE__ */ u("span", {
|
|
157
|
+
className: "pointer-events-none shrink-0",
|
|
158
|
+
children: /* @__PURE__ */ u(n, { checked: _.includes(e.value) })
|
|
159
|
+
}),
|
|
160
|
+
ne(e.imageUrl),
|
|
161
|
+
e.color && /* @__PURE__ */ u("span", {
|
|
162
|
+
className: "size-2.5 shrink-0 rounded-full",
|
|
163
|
+
style: { backgroundColor: e.color }
|
|
164
|
+
}),
|
|
165
|
+
/* @__PURE__ */ u("span", {
|
|
166
|
+
className: "min-w-0 flex-1 truncate",
|
|
167
|
+
title: e.label,
|
|
168
|
+
children: e.label
|
|
169
|
+
})
|
|
170
|
+
]
|
|
171
|
+
}, e.value)),
|
|
172
|
+
X > 0 && /* @__PURE__ */ u("div", {
|
|
173
|
+
"aria-hidden": !0,
|
|
174
|
+
style: { height: X }
|
|
175
|
+
})
|
|
176
|
+
]
|
|
177
|
+
})]
|
|
178
|
+
}), B.length > 0 && /* @__PURE__ */ u("div", {
|
|
179
|
+
className: "border-t border-border p-1.5",
|
|
180
|
+
children: /* @__PURE__ */ u("button", {
|
|
181
|
+
type: "button",
|
|
182
|
+
onClick: Q,
|
|
183
|
+
className: "w-full rounded-md px-2 py-1.5 text-xs text-muted-foreground hover:text-foreground hover:bg-muted transition-colors text-center",
|
|
184
|
+
children: M(H ? "filters.deselectAll" : "filters.selectAll")
|
|
185
|
+
})
|
|
186
|
+
})]
|
|
187
|
+
})]
|
|
188
|
+
}), fe] });
|
|
189
|
+
};
|
|
190
|
+
//#endregion
|
|
191
|
+
export { g as MultiSelect };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { cn as e } from "../../../helpers/tailwind.helper.js";
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import { Heart as n, Star as r } from "lucide-react";
|
|
4
|
+
//#region src/components/core/inputs/RatingInput.tsx
|
|
5
|
+
var i = {
|
|
6
|
+
heart: {
|
|
7
|
+
Icon: n,
|
|
8
|
+
filledClassName: "fill-rose-500 text-rose-500",
|
|
9
|
+
unit: "cœur"
|
|
10
|
+
},
|
|
11
|
+
star: {
|
|
12
|
+
Icon: r,
|
|
13
|
+
filledClassName: "fill-amber-400 text-amber-400",
|
|
14
|
+
unit: "étoile"
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
function a({ value: n, onChange: r, max: a = 5, size: o = "md", icon: s = "star", colorClassName: c, className: l }) {
|
|
18
|
+
let { Icon: u, filledClassName: d, unit: f } = i[s], p = !r, m = o === "sm" ? "h-3.5 w-3.5" : "h-5 w-5", h = c ?? d;
|
|
19
|
+
return /* @__PURE__ */ t("div", {
|
|
20
|
+
className: e("flex items-center gap-0.5", l),
|
|
21
|
+
role: p ? "img" : void 0,
|
|
22
|
+
"aria-label": p ? `${n}/${a} ${f}${n > 1 ? "s" : ""}` : void 0,
|
|
23
|
+
children: Array.from({ length: a }, (i, a) => {
|
|
24
|
+
let o = a + 1, s = /* @__PURE__ */ t(u, { className: e(m, o <= n ? h : "text-muted-foreground/40") });
|
|
25
|
+
return p ? /* @__PURE__ */ t("span", { children: s }, o) : /* @__PURE__ */ t("button", {
|
|
26
|
+
type: "button",
|
|
27
|
+
onClick: () => r?.(n === o ? 0 : o),
|
|
28
|
+
"aria-label": `${o} ${f}${o > 1 ? "s" : ""}`,
|
|
29
|
+
className: "leading-none transition-transform hover:scale-110",
|
|
30
|
+
children: s
|
|
31
|
+
}, o);
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { a as RatingInput };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t } from "
|
|
3
|
-
import {
|
|
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
4
|
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
5
|
import { SearchIcon as a, XIcon as o } from "lucide-react";
|
|
6
6
|
//#region src/components/core/inputs/SearchInput.tsx
|
|
@@ -33,4 +33,4 @@ var s = ({ searchQuery: s, search: c, placeholder: l, onSearch: u, onSubmit: d,
|
|
|
33
33
|
});
|
|
34
34
|
};
|
|
35
35
|
//#endregion
|
|
36
|
-
export { s as
|
|
36
|
+
export { s as SearchInput };
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { cn as e } from "../../../helpers/tailwind.helper.js";
|
|
2
|
+
import { useKrosoftTranslation as t } from "../../../i18n/useKrosoftTranslation.js";
|
|
3
|
+
import { controlFilterWidthClass as ee, controlTriggerClass as te } from "../../ui/control.js";
|
|
4
|
+
import { Popover as n, PopoverContent as r, PopoverTrigger as i } from "../../ui/popover.js";
|
|
5
|
+
import { Select as a, SelectContent as o, SelectItem as s, SelectTrigger as c, SelectValue as l } from "../../ui/select.js";
|
|
6
|
+
import { renderOptionThumbnail as u, useOptionWindow as ne } from "./select.helper.js";
|
|
7
|
+
import { useMemo as d, useState as f } from "react";
|
|
8
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
9
|
+
import { CheckIcon as h, ChevronDownIcon as g, PlusIcon as _, SearchIcon as v, XIcon as y } from "lucide-react";
|
|
10
|
+
import { Command as b } from "cmdk";
|
|
11
|
+
//#region src/components/core/inputs/SingleSelect.tsx
|
|
12
|
+
var x = ({ options: x = [], value: S, onChange: C, onClear: w, searchable: T = !1, onCreate: E, placeholder: D, searchPlaceholder: re, emptyLabel: ie, createLabel: O, disabled: k = !1, modal: A = !0, variant: j = "input", className: M, ...N }) => {
|
|
13
|
+
let { t: P } = t(), [F, I] = f(!1), [L, R] = f(""), z = j === "filter" ? ee : void 0, B = S !== void 0 && S !== "", V = d(() => B ? x.find((e) => e.value === S) : void 0, [
|
|
14
|
+
B,
|
|
15
|
+
x,
|
|
16
|
+
S
|
|
17
|
+
]), H = B ? V?.label ?? S : void 0, U = L.trim(), W = d(() => {
|
|
18
|
+
if (U === "") return x;
|
|
19
|
+
let e = U.toLowerCase();
|
|
20
|
+
return x.filter((t) => `${t.label} ${t.description ?? ""}`.toLowerCase().includes(e));
|
|
21
|
+
}, [x, U]), { listRef: G, virtualized: K, startIndex: q, endIndex: J, padTop: Y, padBottom: X, onScroll: ae, resetScroll: Z } = ne(F, W.length, x.some((e) => e.imageUrl !== void 0)), oe = K ? W.slice(q, J) : W;
|
|
22
|
+
if (!T) return /* @__PURE__ */ m(a, {
|
|
23
|
+
value: S ?? "",
|
|
24
|
+
onValueChange: C,
|
|
25
|
+
disabled: k,
|
|
26
|
+
children: [/* @__PURE__ */ p(c, {
|
|
27
|
+
...N,
|
|
28
|
+
className: e(!B && "text-muted-foreground", z, M),
|
|
29
|
+
onClear: w !== void 0 && B && !k ? (e) => {
|
|
30
|
+
e.preventDefault(), e.stopPropagation(), w();
|
|
31
|
+
} : void 0,
|
|
32
|
+
children: /* @__PURE__ */ p(l, { placeholder: D ?? P("select.placeholder") })
|
|
33
|
+
}), /* @__PURE__ */ p(o, { children: x.map((e) => /* @__PURE__ */ p(s, {
|
|
34
|
+
value: e.value,
|
|
35
|
+
disabled: e.disabled,
|
|
36
|
+
children: /* @__PURE__ */ m("span", {
|
|
37
|
+
className: "flex items-center",
|
|
38
|
+
children: [
|
|
39
|
+
u(e.imageUrl, "mr-2"),
|
|
40
|
+
e.color !== void 0 && /* @__PURE__ */ p("span", {
|
|
41
|
+
className: "mr-2 size-2.5 shrink-0 rounded-full",
|
|
42
|
+
style: { backgroundColor: e.color }
|
|
43
|
+
}),
|
|
44
|
+
e.label,
|
|
45
|
+
e.description !== void 0 && /* @__PURE__ */ m("span", {
|
|
46
|
+
className: "ml-1 text-muted-foreground",
|
|
47
|
+
children: [
|
|
48
|
+
"(",
|
|
49
|
+
e.description,
|
|
50
|
+
")"
|
|
51
|
+
]
|
|
52
|
+
})
|
|
53
|
+
]
|
|
54
|
+
})
|
|
55
|
+
}, e.value)) })]
|
|
56
|
+
});
|
|
57
|
+
let Q = E !== void 0 && U !== "" && !x.some((e) => e.label.toLowerCase() === U.toLowerCase()), $ = (e) => {
|
|
58
|
+
I(e), e ? Z() : R("");
|
|
59
|
+
}, se = (e) => {
|
|
60
|
+
R(e), Z();
|
|
61
|
+
}, ce = (e) => {
|
|
62
|
+
C(e), $(!1);
|
|
63
|
+
}, le = () => {
|
|
64
|
+
E?.(U), $(!1);
|
|
65
|
+
};
|
|
66
|
+
return /* @__PURE__ */ m(n, {
|
|
67
|
+
open: F,
|
|
68
|
+
onOpenChange: $,
|
|
69
|
+
modal: A,
|
|
70
|
+
children: [/* @__PURE__ */ p(i, {
|
|
71
|
+
asChild: !0,
|
|
72
|
+
children: /* @__PURE__ */ m("button", {
|
|
73
|
+
...N,
|
|
74
|
+
type: "button",
|
|
75
|
+
role: "combobox",
|
|
76
|
+
"aria-expanded": F,
|
|
77
|
+
disabled: k,
|
|
78
|
+
className: e(te, "w-full", z, "data-[state=open]:ring-2 data-[state=open]:ring-ring data-[state=open]:ring-offset-2", !B && "text-muted-foreground", M),
|
|
79
|
+
children: [/* @__PURE__ */ m("div", {
|
|
80
|
+
className: "flex min-w-0 items-center truncate",
|
|
81
|
+
children: [
|
|
82
|
+
u(V?.imageUrl, "mr-2 h-6 w-8"),
|
|
83
|
+
V?.color && /* @__PURE__ */ p("span", {
|
|
84
|
+
className: "mr-2 size-2.5 shrink-0 rounded-full",
|
|
85
|
+
style: { backgroundColor: V.color }
|
|
86
|
+
}),
|
|
87
|
+
/* @__PURE__ */ p("span", {
|
|
88
|
+
className: "truncate",
|
|
89
|
+
children: H ?? D ?? P("select.placeholder")
|
|
90
|
+
}),
|
|
91
|
+
V?.description !== void 0 && /* @__PURE__ */ m("span", {
|
|
92
|
+
className: "ml-1 truncate text-muted-foreground",
|
|
93
|
+
children: [
|
|
94
|
+
"(",
|
|
95
|
+
V.description,
|
|
96
|
+
")"
|
|
97
|
+
]
|
|
98
|
+
})
|
|
99
|
+
]
|
|
100
|
+
}), /* @__PURE__ */ m("div", {
|
|
101
|
+
className: "flex items-center gap-1",
|
|
102
|
+
children: [w && B && !k && /* @__PURE__ */ p("span", {
|
|
103
|
+
role: "button",
|
|
104
|
+
tabIndex: -1,
|
|
105
|
+
onClick: (e) => {
|
|
106
|
+
e.stopPropagation();
|
|
107
|
+
},
|
|
108
|
+
onPointerDown: (e) => {
|
|
109
|
+
e.preventDefault(), e.stopPropagation(), w();
|
|
110
|
+
},
|
|
111
|
+
className: "text-muted-foreground hover:text-foreground",
|
|
112
|
+
children: /* @__PURE__ */ p(y, { className: "size-4" })
|
|
113
|
+
}), /* @__PURE__ */ p(g, { className: e("size-4 shrink-0 opacity-50 transition-transform", F && "rotate-180") })]
|
|
114
|
+
})]
|
|
115
|
+
})
|
|
116
|
+
}), /* @__PURE__ */ p(r, {
|
|
117
|
+
className: "w-[var(--radix-popover-trigger-width)] p-0",
|
|
118
|
+
align: "start",
|
|
119
|
+
children: /* @__PURE__ */ m(b, {
|
|
120
|
+
shouldFilter: !1,
|
|
121
|
+
className: "flex flex-col",
|
|
122
|
+
children: [/* @__PURE__ */ p("div", {
|
|
123
|
+
className: "border-b border-border p-2",
|
|
124
|
+
children: /* @__PURE__ */ m("div", {
|
|
125
|
+
className: "relative",
|
|
126
|
+
children: [/* @__PURE__ */ p(v, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }), /* @__PURE__ */ p(b.Input, {
|
|
127
|
+
value: L,
|
|
128
|
+
onValueChange: se,
|
|
129
|
+
placeholder: re ?? P("search.placeholder"),
|
|
130
|
+
className: "w-full rounded-control bg-muted/50 py-1.5 pl-7 pr-2 text-sm text-foreground placeholder:text-muted-foreground outline-none focus:ring-1 focus:ring-ring",
|
|
131
|
+
autoFocus: !0
|
|
132
|
+
})]
|
|
133
|
+
})
|
|
134
|
+
}), /* @__PURE__ */ m(b.List, {
|
|
135
|
+
ref: G,
|
|
136
|
+
onScroll: ae,
|
|
137
|
+
className: e("flex flex-col max-h-56 overflow-y-auto overflow-x-hidden p-1.5 scrollbar-thin scrollbar-thumb-rounded scrollbar-thumb-muted-foreground/20 scrollbar-track-transparent [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-muted-foreground/20 [&::-webkit-scrollbar-track]:bg-transparent", !K && "gap-0.5"),
|
|
138
|
+
children: [
|
|
139
|
+
W.length === 0 && !Q && /* @__PURE__ */ p("div", {
|
|
140
|
+
className: "px-2 py-3 text-center text-xs text-muted-foreground",
|
|
141
|
+
children: ie ?? P("states.noResult")
|
|
142
|
+
}),
|
|
143
|
+
Y > 0 && /* @__PURE__ */ p("div", {
|
|
144
|
+
"aria-hidden": !0,
|
|
145
|
+
style: { height: Y }
|
|
146
|
+
}),
|
|
147
|
+
oe.map((t) => /* @__PURE__ */ m(b.Item, {
|
|
148
|
+
value: t.value,
|
|
149
|
+
keywords: [t.label, t.description ?? ""],
|
|
150
|
+
disabled: t.disabled,
|
|
151
|
+
onSelect: () => {
|
|
152
|
+
ce(t.value);
|
|
153
|
+
},
|
|
154
|
+
className: "flex min-w-0 items-center gap-2 rounded-md px-2 py-2 text-sm cursor-pointer transition-colors data-[selected=true]:bg-muted data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-50",
|
|
155
|
+
children: [
|
|
156
|
+
u(t.imageUrl),
|
|
157
|
+
t.color && /* @__PURE__ */ p("span", {
|
|
158
|
+
className: "size-2.5 shrink-0 rounded-full",
|
|
159
|
+
style: { backgroundColor: t.color }
|
|
160
|
+
}),
|
|
161
|
+
/* @__PURE__ */ p("span", {
|
|
162
|
+
className: "min-w-0 flex-1 truncate",
|
|
163
|
+
title: t.label,
|
|
164
|
+
children: t.label
|
|
165
|
+
}),
|
|
166
|
+
t.description !== void 0 && /* @__PURE__ */ m("span", {
|
|
167
|
+
className: "shrink-0 truncate text-muted-foreground",
|
|
168
|
+
children: [
|
|
169
|
+
"(",
|
|
170
|
+
t.description,
|
|
171
|
+
")"
|
|
172
|
+
]
|
|
173
|
+
}),
|
|
174
|
+
/* @__PURE__ */ p(h, { className: e("ml-auto size-4 shrink-0", S === t.value ? "opacity-100" : "opacity-0") })
|
|
175
|
+
]
|
|
176
|
+
}, t.value)),
|
|
177
|
+
X > 0 && /* @__PURE__ */ p("div", {
|
|
178
|
+
"aria-hidden": !0,
|
|
179
|
+
style: { height: X }
|
|
180
|
+
}),
|
|
181
|
+
Q && /* @__PURE__ */ m(b.Item, {
|
|
182
|
+
forceMount: !0,
|
|
183
|
+
value: "__create__",
|
|
184
|
+
onSelect: le,
|
|
185
|
+
className: "flex min-w-0 items-center gap-2.5 rounded-md px-2 py-2 text-sm cursor-pointer transition-colors data-[selected=true]:bg-muted",
|
|
186
|
+
children: [/* @__PURE__ */ p(_, { className: "size-4 shrink-0" }), /* @__PURE__ */ p("span", {
|
|
187
|
+
className: "truncate",
|
|
188
|
+
children: O ? O(U) : P("select.create", { search: U })
|
|
189
|
+
})]
|
|
190
|
+
})
|
|
191
|
+
]
|
|
192
|
+
})]
|
|
193
|
+
})
|
|
194
|
+
})]
|
|
195
|
+
});
|
|
196
|
+
};
|
|
197
|
+
//#endregion
|
|
198
|
+
export { x as SingleSelect };
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t } from "
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
1
|
+
import { SearchInput as e } from "./SearchInput.js";
|
|
2
|
+
import { ImageInput as t } from "./ImageInput.js";
|
|
3
|
+
import { MultiSelect as n } from "./MultiSelect.js";
|
|
4
|
+
import { DatePicker as r } from "./DatePicker.js";
|
|
5
|
+
import { DateRangePicker as i } from "./DateRangePicker.js";
|
|
6
|
+
import { SingleSelect as a } from "./SingleSelect.js";
|
|
7
|
+
import { FileDropzone as o } from "./FileDropzone.js";
|
|
8
|
+
import { RatingInput as s } from "./RatingInput.js";
|
|
9
|
+
export { r as DatePicker, i as DateRangePicker, o as FileDropzone, t as ImageInput, n as MultiSelect, s as RatingInput, e as SearchInput, a as SingleSelect };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { cn as e } from "../../../helpers/tailwind.helper.js";
|
|
2
|
+
import { useCallback as t, useLayoutEffect as n, useRef as r, useState as i } from "react";
|
|
3
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/core/inputs/select.helper.tsx
|
|
5
|
+
var o = 40, s = 224, c = 6;
|
|
6
|
+
function l(e, a, l) {
|
|
7
|
+
let u = r(null), [d, f] = i(0), [p, m] = i(0), h = p || (l ? 52 : 40), g = a > o, _ = g ? Math.max(0, Math.floor(d / h) - c) : 0, v = g ? Math.min(a, Math.ceil((d + s) / h) + c) : a, y = g ? _ * h : 0, b = g ? (a - v) * h : 0;
|
|
8
|
+
n(() => {
|
|
9
|
+
if (!e) return;
|
|
10
|
+
let t = u.current?.querySelector("[cmdk-item]");
|
|
11
|
+
if (t) {
|
|
12
|
+
let e = t.getBoundingClientRect().height;
|
|
13
|
+
e > 0 && Math.abs(e - p) > .5 && m(e);
|
|
14
|
+
}
|
|
15
|
+
}, [
|
|
16
|
+
e,
|
|
17
|
+
a,
|
|
18
|
+
p
|
|
19
|
+
]);
|
|
20
|
+
let x = t(() => {
|
|
21
|
+
f(0), u.current && (u.current.scrollTop = 0);
|
|
22
|
+
}, []);
|
|
23
|
+
return {
|
|
24
|
+
listRef: u,
|
|
25
|
+
virtualized: g,
|
|
26
|
+
startIndex: _,
|
|
27
|
+
endIndex: v,
|
|
28
|
+
padTop: y,
|
|
29
|
+
padBottom: b,
|
|
30
|
+
onScroll: g ? (e) => {
|
|
31
|
+
f(e.currentTarget.scrollTop);
|
|
32
|
+
} : void 0,
|
|
33
|
+
resetScroll: x
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
var u = (t, n) => t === void 0 ? null : t ? /* @__PURE__ */ a("img", {
|
|
37
|
+
src: t,
|
|
38
|
+
alt: "",
|
|
39
|
+
loading: "lazy",
|
|
40
|
+
className: e("h-9 w-12 shrink-0 rounded object-cover", n)
|
|
41
|
+
}) : /* @__PURE__ */ a("span", {
|
|
42
|
+
className: e("flex h-9 w-12 shrink-0 items-center justify-center rounded bg-muted text-[9px] text-muted-foreground", n),
|
|
43
|
+
children: "—"
|
|
44
|
+
});
|
|
45
|
+
//#endregion
|
|
46
|
+
export { u as renderOptionThumbnail, l as useOptionWindow };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { useKrosoftTranslation as e } from "../../../i18n/useKrosoftTranslation.js";
|
|
2
|
+
import { Button as t } from "../../ui/button.js";
|
|
3
|
+
import { Select as n, SelectContent as r, SelectItem as i, SelectTrigger as a, SelectValue as o } from "../../ui/select.js";
|
|
4
|
+
import { Tooltip as s, TooltipContent as c, TooltipProvider as l, TooltipTrigger as u } from "../../ui/tooltip.js";
|
|
5
|
+
import { useLanguage as d } from "../../../hooks/ui/useLanguage.js";
|
|
5
6
|
import "react";
|
|
6
7
|
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
7
8
|
import { LanguagesIcon as m } from "lucide-react";
|
|
@@ -10,7 +11,7 @@ function h({ languageOptions: h, variant: g = "select", id: _, className: v }) {
|
|
|
10
11
|
let { t: y } = e(), { currentLanguageOption: b, nextLanguageOption: x, changeLanguage: S, cycleLanguage: C } = d(h);
|
|
11
12
|
if (g === "mini") {
|
|
12
13
|
let e = b?.icon ?? m;
|
|
13
|
-
return /* @__PURE__ */ f(
|
|
14
|
+
return /* @__PURE__ */ f(l, { children: /* @__PURE__ */ p(s, { children: [/* @__PURE__ */ f(u, {
|
|
14
15
|
asChild: !0,
|
|
15
16
|
children: /* @__PURE__ */ p(t, {
|
|
16
17
|
id: _,
|
|
@@ -23,7 +24,7 @@ function h({ languageOptions: h, variant: g = "select", id: _, className: v }) {
|
|
|
23
24
|
children: y("language.current", { language: b?.label ?? "" })
|
|
24
25
|
})]
|
|
25
26
|
})
|
|
26
|
-
}), /* @__PURE__ */ f(
|
|
27
|
+
}), /* @__PURE__ */ f(c, {
|
|
27
28
|
side: "bottom",
|
|
28
29
|
align: "center",
|
|
29
30
|
children: y("language.switchTo", { language: x?.label ?? "" })
|
|
@@ -31,16 +32,16 @@ function h({ languageOptions: h, variant: g = "select", id: _, className: v }) {
|
|
|
31
32
|
}
|
|
32
33
|
return /* @__PURE__ */ p("div", {
|
|
33
34
|
className: "space-y-2",
|
|
34
|
-
children: [/* @__PURE__ */ p(
|
|
35
|
+
children: [/* @__PURE__ */ p(n, {
|
|
35
36
|
value: b?.value,
|
|
36
37
|
onValueChange: S,
|
|
37
|
-
children: [/* @__PURE__ */ f(
|
|
38
|
+
children: [/* @__PURE__ */ f(a, {
|
|
38
39
|
id: _,
|
|
39
40
|
className: "w-full",
|
|
40
|
-
children: /* @__PURE__ */ f(
|
|
41
|
-
}), /* @__PURE__ */ f(
|
|
41
|
+
children: /* @__PURE__ */ f(o, { placeholder: y("select.language") })
|
|
42
|
+
}), /* @__PURE__ */ f(r, { children: h.map((e) => {
|
|
42
43
|
let t = e.icon ?? m;
|
|
43
|
-
return /* @__PURE__ */ f(
|
|
44
|
+
return /* @__PURE__ */ f(i, {
|
|
44
45
|
value: e.value,
|
|
45
46
|
children: /* @__PURE__ */ p("div", {
|
|
46
47
|
className: "flex items-center gap-2",
|
|
@@ -55,4 +56,4 @@ function h({ languageOptions: h, variant: g = "select", id: _, className: v }) {
|
|
|
55
56
|
});
|
|
56
57
|
}
|
|
57
58
|
//#endregion
|
|
58
|
-
export { h as
|
|
59
|
+
export { h as LanguageSelector };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { LanguageSelector } from "./LanguageSelector.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t } from "
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
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 { DropdownMenu as r, DropdownMenuContent as i, DropdownMenuItem as a, DropdownMenuSeparator as o, DropdownMenuTrigger as s } from "../../ui/dropdown-menu.js";
|
|
5
|
+
import { useMobile as c } from "../../../hooks/ui/useMobile.js";
|
|
6
6
|
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
7
7
|
import { MoreVerticalIcon as d } from "lucide-react";
|
|
8
8
|
//#region src/components/core/layouts/AppActions.tsx
|
|
@@ -12,52 +12,52 @@ var f = (e) => {
|
|
|
12
12
|
};
|
|
13
13
|
function p({ actions: p, className: m }) {
|
|
14
14
|
let { t: h } = t(), g = c();
|
|
15
|
-
return !p || p.length === 0 ? null : g ? /* @__PURE__ */ u(
|
|
15
|
+
return !p || p.length === 0 ? null : g ? /* @__PURE__ */ u(r, { children: [/* @__PURE__ */ l(s, {
|
|
16
16
|
asChild: !0,
|
|
17
|
-
children: /* @__PURE__ */ l(
|
|
17
|
+
children: /* @__PURE__ */ l(n, {
|
|
18
18
|
variant: "outline",
|
|
19
19
|
size: "icon",
|
|
20
20
|
children: /* @__PURE__ */ l(d, { className: "size-4" })
|
|
21
21
|
})
|
|
22
|
-
}), /* @__PURE__ */ l(
|
|
22
|
+
}), /* @__PURE__ */ l(i, {
|
|
23
23
|
align: "end",
|
|
24
24
|
className: "min-w-48",
|
|
25
|
-
children: p.map((t,
|
|
25
|
+
children: p.map((t, n) => t ? t.children && t.children.length > 0 ? /* @__PURE__ */ u("div", { children: [n > 0 && /* @__PURE__ */ l(o, {}), t.children.map((t, n) => t ? /* @__PURE__ */ u(a, {
|
|
26
26
|
onClick: () => {
|
|
27
27
|
t.type === "submit" ? f(t.form) : t.onClick?.();
|
|
28
28
|
},
|
|
29
29
|
disabled: t.disabled,
|
|
30
30
|
className: e("gap-2", t.className),
|
|
31
31
|
children: [t.icon && /* @__PURE__ */ l(t.icon, { className: "size-4" }), t.labelKey && h(t.labelKey)]
|
|
32
|
-
},
|
|
32
|
+
}, n) : null)] }, n) : /* @__PURE__ */ u(a, {
|
|
33
33
|
onClick: () => {
|
|
34
34
|
t.type === "submit" ? f(t.form) : t.onClick?.();
|
|
35
35
|
},
|
|
36
36
|
disabled: t.disabled,
|
|
37
37
|
className: e("gap-2", t.className),
|
|
38
38
|
children: [t.icon && /* @__PURE__ */ l(t.icon, { className: "size-4" }), t.labelKey && h(t.labelKey)]
|
|
39
|
-
},
|
|
39
|
+
}, n) : null)
|
|
40
40
|
})] }) : ((t) => /* @__PURE__ */ l("div", {
|
|
41
41
|
className: e("flex gap-2", m),
|
|
42
|
-
children: t.map((t,
|
|
42
|
+
children: t.map((t, o) => t ? t.children && t.children.length > 0 ? /* @__PURE__ */ u(r, { children: [/* @__PURE__ */ l(s, {
|
|
43
43
|
asChild: !0,
|
|
44
|
-
children: /* @__PURE__ */ u(
|
|
44
|
+
children: /* @__PURE__ */ u(n, {
|
|
45
45
|
variant: t.variant,
|
|
46
46
|
disabled: t.disabled,
|
|
47
47
|
className: e("gap-2", t.className),
|
|
48
48
|
children: [t.icon && /* @__PURE__ */ l(t.icon, { className: "size-4" }), t.labelKey && h(t.labelKey)]
|
|
49
49
|
})
|
|
50
|
-
}), /* @__PURE__ */ l(
|
|
50
|
+
}), /* @__PURE__ */ l(i, {
|
|
51
51
|
align: "end",
|
|
52
|
-
children: t.children.map((t,
|
|
52
|
+
children: t.children.map((t, n) => t ? /* @__PURE__ */ u(a, {
|
|
53
53
|
onClick: () => {
|
|
54
54
|
t.type === "submit" ? f(t.form) : t.onClick?.();
|
|
55
55
|
},
|
|
56
56
|
disabled: t.disabled,
|
|
57
57
|
className: e("gap-2", t.className),
|
|
58
58
|
children: [t.icon && /* @__PURE__ */ l(t.icon, { className: "size-4" }), t.labelKey && h(t.labelKey)]
|
|
59
|
-
},
|
|
60
|
-
})] },
|
|
59
|
+
}, n) : null)
|
|
60
|
+
})] }, o) : /* @__PURE__ */ u(n, {
|
|
61
61
|
variant: t.variant,
|
|
62
62
|
type: t.type,
|
|
63
63
|
form: t.form,
|
|
@@ -65,8 +65,8 @@ function p({ actions: p, className: m }) {
|
|
|
65
65
|
disabled: t.disabled,
|
|
66
66
|
className: e("gap-2", t.className),
|
|
67
67
|
children: [t.icon && /* @__PURE__ */ l(t.icon, { className: "size-4" }), t.labelKey && h(t.labelKey)]
|
|
68
|
-
},
|
|
68
|
+
}, o) : null)
|
|
69
69
|
}))(p);
|
|
70
70
|
}
|
|
71
71
|
//#endregion
|
|
72
|
-
export { p as
|
|
72
|
+
export { p as AppActions };
|