@krosoft/react 0.0.307 → 0.0.309

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.
Files changed (54) hide show
  1. package/dist/{AppActions-CvT8dDnQ.js → AppActions-DBxmXROG.js} +2 -2
  2. package/dist/{AppSubTitle-DJQjeSdC.js → AppSubTitle-Ck4UmLrQ.js} +2 -2
  3. package/dist/{AppTitle-C8t_LSuG.js → AppTitle-CA3AuX6v.js} +1 -1
  4. package/dist/{ErrorAlert-DrjpMJu6.js → ErrorAlert-BuKadO9Z.js} +1 -1
  5. package/dist/{GenericForm-DBLeKiPm.js → GenericForm-tZkFJ7mA.js} +6 -6
  6. package/dist/{ImageInput-B6NH8JDS.js → ImageInput-BT08niR9.js} +2 -2
  7. package/dist/MultiSelect-D7AFiC_X.js +228 -0
  8. package/dist/{SearchInput-sg_-w8UW.js → SearchInput-tvcgwvmw.js} +106 -90
  9. package/dist/{behavior-UUjjj8qt.js → behavior-C2896MtZ.js} +1 -1
  10. package/dist/{cards-DUbAISUO.js → cards-m0h-usz_.js} +2 -2
  11. package/dist/{charts-BDlyl5wa.js → charts-B1R8vOM7.js} +1 -1
  12. package/dist/components/core/cards/index.js +1 -1
  13. package/dist/components/core/charts/index.js +1 -1
  14. package/dist/components/core/dialogs/index.js +3 -3
  15. package/dist/components/core/filters/index.js +5 -5
  16. package/dist/components/core/forms/index.js +1 -1
  17. package/dist/components/core/index.js +18 -18
  18. package/dist/components/core/inputs/MultiSelect.d.ts +8 -1
  19. package/dist/components/core/inputs/MultiSelect.d.ts.map +1 -1
  20. package/dist/components/core/inputs/SingleSelect.d.ts.map +1 -1
  21. package/dist/components/core/inputs/index.js +4 -4
  22. package/dist/components/core/inputs/select.helper.d.ts +22 -0
  23. package/dist/components/core/inputs/select.helper.d.ts.map +1 -1
  24. package/dist/components/core/language/index.js +1 -1
  25. package/dist/components/core/layouts/index.js +8 -8
  26. package/dist/components/core/navbar/index.js +1 -1
  27. package/dist/components/core/states/index.js +2 -2
  28. package/dist/components/core/table/index.js +2 -2
  29. package/dist/components/core/tabs/index.js +5 -5
  30. package/dist/components/core/theme/index.js +1 -1
  31. package/dist/components/index.js +18 -18
  32. package/dist/components/ui/index.js +2 -2
  33. package/dist/{dialogs-BwObbaoM.js → dialogs--0dbPy6W.js} +5 -5
  34. package/dist/hooks/behavior/index.js +1 -1
  35. package/dist/hooks/index.js +5 -5
  36. package/dist/hooks/ui/index.js +4 -4
  37. package/dist/i18n/index.js +1 -1
  38. package/dist/i18n/krosoftLocales.d.ts +2 -0
  39. package/dist/i18n/krosoftLocales.d.ts.map +1 -1
  40. package/dist/{i18n-Iyf3fyzr.js → i18n-DbPbmPRj.js} +2 -0
  41. package/dist/{inputs-Cxz5kfwF.js → inputs-2cwQbuBl.js} +3 -3
  42. package/dist/{language-DgO7XgOg.js → language-9LfgyTr7.js} +2 -2
  43. package/dist/{navbar-tmnNnH3O.js → navbar-DKgwZj74.js} +3 -3
  44. package/dist/pwa/index.js +1 -1
  45. package/dist/{sheet-C2vx5V6Q.js → sheet-w_xag5lP.js} +1 -1
  46. package/dist/{states-Bs9lIWQe.js → states-Ceb6VL--.js} +2 -2
  47. package/dist/{theme-DpbtnjRk.js → theme-BMH6B6jL.js} +2 -2
  48. package/dist/{ui-O4O5BzZ0.js → ui-CfT3vbQZ.js} +3 -3
  49. package/dist/{ui-BdLutnCT.js → ui-k3NqEwlP.js} +1 -1
  50. package/dist/{useDocumentTitle--JeBsMsb.js → useDocumentTitle-BISAg9M7.js} +1 -1
  51. package/dist/{useLanguage-0bm0Xoa9.js → useLanguage-BVuLE78e.js} +1 -1
  52. package/dist/{useTheme-CFOgsA9n.js → useTheme-DRWux5vA.js} +1 -1
  53. package/package.json +1 -1
  54. package/dist/MultiSelect-0iYNlt_e.js +0 -157
@@ -1,6 +1,6 @@
1
1
  import { t as e } from "./tailwind.helper-CJaRYBmL.js";
2
- import { t } from "./i18n-Iyf3fyzr.js";
3
- import { Bt as n, Ft as r, Gt as i, Nt as a, jt as o } from "./ui-BdLutnCT.js";
2
+ import { t } from "./i18n-DbPbmPRj.js";
3
+ import { Bt as n, Ft as r, Gt as i, Nt as a, jt as o } from "./ui-k3NqEwlP.js";
4
4
  import { c as s } from "./tooltip-_geGvbS7.js";
5
5
  import { t as c } from "./useMobile-pTQ8lWvt.js";
6
6
  import { jsx as l, jsxs as u } from "react/jsx-runtime";
@@ -1,5 +1,5 @@
1
- import { t as e } from "./i18n-Iyf3fyzr.js";
2
- import { t } from "./AppActions-CvT8dDnQ.js";
1
+ import { t as e } from "./i18n-DbPbmPRj.js";
2
+ import { t } from "./AppActions-DBxmXROG.js";
3
3
  import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
4
  //#region src/components/core/layouts/AppSubTitle.tsx
5
5
  function i({ titleKey: i, actions: a, className: o }) {
@@ -1,5 +1,5 @@
1
1
  import { t as e } from "./tailwind.helper-CJaRYBmL.js";
2
- import { t } from "./i18n-Iyf3fyzr.js";
2
+ import { t } from "./i18n-DbPbmPRj.js";
3
3
  import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
4
  //#region src/components/core/layouts/AppTitle.tsx
5
5
  function i({ titleKey: i, descriptionKey: a, isSubTitle: o, inline: s }) {
@@ -1,4 +1,4 @@
1
- import { t as e } from "./i18n-Iyf3fyzr.js";
1
+ import { t as e } from "./i18n-DbPbmPRj.js";
2
2
  import { n as t, t as n } from "./alert-REQGK9bR.js";
3
3
  import "react";
4
4
  import { jsx as r, jsxs as i } from "react/jsx-runtime";
@@ -1,14 +1,14 @@
1
1
  import { t as e } from "./tailwind.helper-CJaRYBmL.js";
2
2
  import { c as t, d as n, s as r } from "./chart-Dq3AIrue.js";
3
- import { t as i } from "./i18n-Iyf3fyzr.js";
4
- import { Ct as a, Dt as o, Et as s, Ot as c, St as l, Tt as u, bn as d, p as f } from "./ui-BdLutnCT.js";
3
+ import { t as i } from "./i18n-DbPbmPRj.js";
4
+ import { Ct as a, Dt as o, Et as s, Ot as c, St as l, Tt as u, bn as d, p as f } from "./ui-k3NqEwlP.js";
5
5
  import { c as p } from "./tooltip-_geGvbS7.js";
6
- import { g as m } from "./sheet-C2vx5V6Q.js";
6
+ import { g as m } from "./sheet-w_xag5lP.js";
7
7
  import { i as h, l as g, n as ee, t as _, u as v } from "./select-KWMg2_7Z.js";
8
8
  import { n as y } from "./useToast-UeDRLovh.js";
9
- import { t as b } from "./ImageInput-B6NH8JDS.js";
10
- import { t as x } from "./AppSubTitle-DJQjeSdC.js";
11
- import { t as S } from "./MultiSelect-0iYNlt_e.js";
9
+ import { t as b } from "./ImageInput-BT08niR9.js";
10
+ import { t as x } from "./AppSubTitle-Ck4UmLrQ.js";
11
+ import { t as S } from "./MultiSelect-D7AFiC_X.js";
12
12
  import { useEffect as C, useRef as w, useState as T } from "react";
13
13
  import { jsx as E, jsxs as D } from "react/jsx-runtime";
14
14
  import { useForm as O } from "react-hook-form";
@@ -1,6 +1,6 @@
1
1
  import { t as e } from "./tailwind.helper-CJaRYBmL.js";
2
- import { t } from "./i18n-Iyf3fyzr.js";
3
- import "./ui-BdLutnCT.js";
2
+ import { t } from "./i18n-DbPbmPRj.js";
3
+ import "./ui-k3NqEwlP.js";
4
4
  import { c as n } from "./tooltip-_geGvbS7.js";
5
5
  import { t as r } from "./useNotifications-CyhTruIG.js";
6
6
  import { forwardRef as i, useRef as a } from "react";
@@ -0,0 +1,228 @@
1
+ import { t as e } from "./tailwind.helper-CJaRYBmL.js";
2
+ import { t } from "./i18n-DbPbmPRj.js";
3
+ import { Pn as n, bn as r } from "./ui-k3NqEwlP.js";
4
+ import { a as i, o as a, s as o } from "./tooltip-_geGvbS7.js";
5
+ import { h as s, m as c, p as l } from "./sheet-w_xag5lP.js";
6
+ import { useCallback as u, useLayoutEffect as d, useMemo as f, useRef as p, useState as m } from "react";
7
+ import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
8
+ import { ChevronDownIcon as v, SearchIcon as y, XIcon as b } from "lucide-react";
9
+ import { Command as x } from "cmdk";
10
+ //#region src/components/core/inputs/select.helper.tsx
11
+ var S = 40, C = 224, w = 6;
12
+ function T(e, t, n) {
13
+ let r = p(null), [i, a] = m(0), [o, s] = m(0), c = o || (n ? 52 : 40), l = t > S, f = l ? Math.max(0, Math.floor(i / c) - w) : 0, h = l ? Math.min(t, Math.ceil((i + C) / c) + w) : t, g = l ? f * c : 0, _ = l ? (t - h) * c : 0;
14
+ d(() => {
15
+ if (!e) return;
16
+ let t = r.current?.querySelector("[cmdk-item]");
17
+ if (t) {
18
+ let e = t.getBoundingClientRect().height;
19
+ e > 0 && Math.abs(e - o) > .5 && s(e);
20
+ }
21
+ }, [
22
+ e,
23
+ t,
24
+ o
25
+ ]);
26
+ let v = u(() => {
27
+ a(0), r.current && (r.current.scrollTop = 0);
28
+ }, []);
29
+ return {
30
+ listRef: r,
31
+ virtualized: l,
32
+ startIndex: f,
33
+ endIndex: h,
34
+ padTop: g,
35
+ padBottom: _,
36
+ onScroll: l ? (e) => {
37
+ a(e.currentTarget.scrollTop);
38
+ } : void 0,
39
+ resetScroll: v
40
+ };
41
+ }
42
+ var E = (t, n) => t === void 0 ? null : t ? /* @__PURE__ */ g("img", {
43
+ src: t,
44
+ alt: "",
45
+ loading: "lazy",
46
+ className: e("h-9 w-12 shrink-0 rounded object-cover", n)
47
+ }) : /* @__PURE__ */ g("span", {
48
+ className: e("flex h-9 w-12 shrink-0 items-center justify-center rounded bg-muted text-[9px] text-muted-foreground", n),
49
+ children: "—"
50
+ }), D = ({ options: u, selected: d, onToggle: p, onClear: S, onSelectAll: C, variant: w = "input", placeholder: D, labelKey: O, searchable: ee = !1, searchPlaceholder: te, disabled: k = !1, modal: ne = !0, chips: re = !1, maxCount: A, className: j, ...M }) => {
51
+ let { t: N } = t(), [P, F] = m(""), [I, ie] = m(!1), L = w === "pill", R = w === "input" ? void 0 : a, z = f(() => P === "" ? u : u.filter((e) => e.label.toLowerCase().includes(P.toLowerCase())), [u, P]), B = f(() => z.filter((e) => e.disabled !== !0).map((e) => e.value), [z]), V = f(() => d.filter((e) => u.find((t) => t.value === e)?.disabled === !0), [u, d]), H = f(() => B.length !== 0 && B.every((e) => d.includes(e)), [B, d]), U = f(() => d.map((e) => u.find((t) => t.value === e)?.label ?? e), [u, d]), W = A !== void 0 && A > 0 ? U.slice(0, A) : U, G = U.length - W.length, { listRef: K, virtualized: q, startIndex: J, endIndex: ae, padTop: Y, padBottom: X, onScroll: oe, resetScroll: Z } = T(I, z.length, u.some((e) => e.imageUrl !== void 0)), se = q ? z.slice(J, ae) : z, ce = (e) => {
52
+ ie(e), e ? Z() : F("");
53
+ }, Q = (e) => {
54
+ F(e), Z();
55
+ }, le = () => {
56
+ V.length > 0 ? C === void 0 ? d.filter((e) => !V.includes(e)).forEach((e) => {
57
+ p(e);
58
+ }) : C(V) : S === void 0 ? C === void 0 ? d.forEach((e) => {
59
+ p(e);
60
+ }) : C([]) : S();
61
+ }, ue = () => {
62
+ if (H) C === void 0 ? S !== void 0 && d.every((e) => B.includes(e)) ? S() : B.forEach((e) => {
63
+ p(e);
64
+ }) : C(d.filter((e) => !B.includes(e)));
65
+ else if (C !== void 0) {
66
+ let e = [...d];
67
+ B.forEach((t) => {
68
+ e.includes(t) || e.push(t);
69
+ }), C(e);
70
+ } else B.forEach((e) => {
71
+ d.includes(e) || p(e);
72
+ });
73
+ }, $ = f(() => d.map((e) => ({
74
+ value: e,
75
+ option: u.find((t) => t.value === e)
76
+ })), [u, d]), de = L ? /* @__PURE__ */ _("button", {
77
+ ...M,
78
+ type: "button",
79
+ disabled: k,
80
+ className: e(i, "inline-flex items-center justify-between gap-1.5 whitespace-nowrap transition-colors", d.length > 0 ? "border-primary bg-primary/10 text-primary font-medium" : "hover:bg-muted", R, j),
81
+ children: [/* @__PURE__ */ g("span", {
82
+ className: "truncate",
83
+ children: O === void 0 ? D ?? N("select.placeholder") : N(O)
84
+ }), /* @__PURE__ */ _("div", {
85
+ className: "flex shrink-0 items-center gap-1.5",
86
+ children: [d.length > 0 && /* @__PURE__ */ g("span", {
87
+ className: "flex h-4 min-w-[16px] items-center justify-center rounded-full bg-primary px-1 text-[10px] font-bold text-primary-foreground",
88
+ children: d.length
89
+ }), /* @__PURE__ */ g(v, { className: e("size-3.5 opacity-60 transition-transform", I && "rotate-180") })]
90
+ })]
91
+ }) : /* @__PURE__ */ _("button", {
92
+ ...M,
93
+ type: "button",
94
+ disabled: k,
95
+ className: e(o, "w-full", R, I && "ring-2 ring-ring ring-offset-2", d.length === 0 && "text-muted-foreground", j),
96
+ children: [/* @__PURE__ */ g("span", {
97
+ className: "truncate",
98
+ children: d.length === 0 ? D ?? N("select.placeholder") : W.join(", ")
99
+ }), /* @__PURE__ */ _("div", {
100
+ className: "flex shrink-0 items-center gap-1",
101
+ children: [
102
+ G > 0 && /* @__PURE__ */ _("span", {
103
+ className: "rounded-control bg-muted px-1.5 py-0.5 text-xs font-medium text-foreground",
104
+ children: ["+", G]
105
+ }),
106
+ d.length > 0 && !k && /* @__PURE__ */ g("span", {
107
+ role: "button",
108
+ tabIndex: -1,
109
+ onClick: (e) => {
110
+ e.stopPropagation();
111
+ },
112
+ onPointerDown: (e) => {
113
+ e.preventDefault(), e.stopPropagation(), le();
114
+ },
115
+ className: "text-muted-foreground hover:text-foreground",
116
+ children: /* @__PURE__ */ g(b, { className: "size-4" })
117
+ }),
118
+ /* @__PURE__ */ g(v, { className: e("size-4 opacity-50 shrink-0 transition-transform", I && "rotate-180") })
119
+ ]
120
+ })]
121
+ }), fe = re && $.length > 0 ? /* @__PURE__ */ g("div", {
122
+ className: "mt-2 flex flex-wrap gap-1.5",
123
+ children: $.map(({ value: e, option: t }) => {
124
+ let r = t?.disabled === !0;
125
+ return /* @__PURE__ */ _(n, {
126
+ variant: "secondary",
127
+ className: "flex items-center gap-1 border border-primary/20 bg-primary/10 py-0.5 pl-2 pr-1 text-primary",
128
+ children: [/* @__PURE__ */ g("span", {
129
+ className: "max-w-[16rem] truncate",
130
+ children: t?.label ?? e
131
+ }), !r && /* @__PURE__ */ g("button", {
132
+ type: "button",
133
+ onClick: () => {
134
+ p(e);
135
+ },
136
+ className: "rounded-full p-0.5 hover:bg-primary/20",
137
+ "aria-label": N("filters.remove"),
138
+ children: /* @__PURE__ */ g(b, { className: "size-3" })
139
+ })]
140
+ }, e);
141
+ })
142
+ }) : null;
143
+ return /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ _(l, {
144
+ open: I,
145
+ onOpenChange: ce,
146
+ modal: ne,
147
+ children: [/* @__PURE__ */ g(s, {
148
+ asChild: !0,
149
+ children: de
150
+ }), /* @__PURE__ */ _(c, {
151
+ className: e("p-0", L ? "w-72 max-w-[var(--radix-popover-content-available-width)]" : "w-[var(--radix-popover-trigger-width)]"),
152
+ align: "start",
153
+ children: [/* @__PURE__ */ _(x, {
154
+ shouldFilter: !1,
155
+ className: "flex flex-col",
156
+ children: [ee ? /* @__PURE__ */ g("div", {
157
+ className: "border-b border-border p-2",
158
+ children: /* @__PURE__ */ _("div", {
159
+ className: "relative",
160
+ children: [/* @__PURE__ */ g(y, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }), /* @__PURE__ */ g(x.Input, {
161
+ value: P,
162
+ onValueChange: Q,
163
+ placeholder: te ?? N("search.placeholder"),
164
+ 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",
165
+ autoFocus: !0
166
+ })]
167
+ })
168
+ }) : /* @__PURE__ */ g(x.Input, {
169
+ autoFocus: !0,
170
+ tabIndex: -1,
171
+ className: "sr-only"
172
+ }), /* @__PURE__ */ _(x.List, {
173
+ ref: K,
174
+ onScroll: oe,
175
+ 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"),
176
+ children: [
177
+ z.length === 0 && /* @__PURE__ */ g("p", {
178
+ className: "px-2 py-3 text-center text-xs text-muted-foreground",
179
+ children: N("states.noResult")
180
+ }),
181
+ Y > 0 && /* @__PURE__ */ g("div", {
182
+ "aria-hidden": !0,
183
+ style: { height: Y }
184
+ }),
185
+ se.map((e) => /* @__PURE__ */ _(x.Item, {
186
+ value: e.value,
187
+ disabled: e.disabled,
188
+ onSelect: () => {
189
+ p(e.value);
190
+ },
191
+ 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",
192
+ children: [
193
+ /* @__PURE__ */ g("span", {
194
+ className: "pointer-events-none shrink-0",
195
+ children: /* @__PURE__ */ g(r, { checked: d.includes(e.value) })
196
+ }),
197
+ E(e.imageUrl),
198
+ e.color && /* @__PURE__ */ g("span", {
199
+ className: "size-2.5 shrink-0 rounded-full",
200
+ style: { backgroundColor: e.color }
201
+ }),
202
+ /* @__PURE__ */ g("span", {
203
+ className: "min-w-0 flex-1 truncate",
204
+ title: e.label,
205
+ children: e.label
206
+ })
207
+ ]
208
+ }, e.value)),
209
+ X > 0 && /* @__PURE__ */ g("div", {
210
+ "aria-hidden": !0,
211
+ style: { height: X }
212
+ })
213
+ ]
214
+ })]
215
+ }), B.length > 0 && /* @__PURE__ */ g("div", {
216
+ className: "border-t border-border p-1.5",
217
+ children: /* @__PURE__ */ g("button", {
218
+ type: "button",
219
+ onClick: ue,
220
+ 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",
221
+ children: N(H ? "filters.deselectAll" : "filters.selectAll")
222
+ })
223
+ })]
224
+ })]
225
+ }), fe] });
226
+ };
227
+ //#endregion
228
+ export { E as n, T as r, D as t };