@krosoft/react 0.0.296 → 0.0.298
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/README.md +20 -1
- package/dist/{AppActions-BMh044Sc.js → AppActions-DCFvzqFN.js} +43 -19
- package/dist/{AppSubTitle-BfZTloah.js → AppSubTitle-Cmu-4o-a.js} +2 -2
- package/dist/{AppTitle-BZ5jQWbs.js → AppTitle-CBY03gZy.js} +1 -1
- package/dist/{ErrorAlert-0L-Dwqu8.js → ErrorAlert-CpxyT2oM.js} +1 -1
- package/dist/{GenericForm-BV8n9y1n.js → GenericForm-fiF_fEUb.js} +8 -8
- package/dist/{ImageInput-BdOxyamZ.js → ImageInput-BGe_bc79.js} +3 -3
- package/dist/MultiSelect-xNfIdYS9.js +148 -0
- package/dist/{SearchInput-81oecSco.js → SearchInput-pJFU2KVz.js} +119 -119
- package/dist/{behavior-CFsFoY50.js → behavior-B8iZAgve.js} +3 -4
- package/dist/{cards-BFa9EQc6.js → cards-hgOitfgK.js} +2 -2
- package/dist/{charts-C7MWuqi9.js → charts-CS1Ao2Go.js} +1 -1
- package/dist/components/core/cards/index.js +1 -1
- package/dist/components/core/charts/index.js +1 -1
- package/dist/components/core/dialogs/AppDialog.d.ts.map +1 -1
- package/dist/components/core/dialogs/ConfirmationDialog.d.ts.map +1 -1
- package/dist/components/core/dialogs/index.js +3 -3
- package/dist/components/core/filters/index.js +6 -6
- package/dist/components/core/forms/index.js +1 -1
- package/dist/components/core/index.js +18 -18
- package/dist/components/core/inputs/MultiSelect.d.ts +3 -1
- package/dist/components/core/inputs/MultiSelect.d.ts.map +1 -1
- package/dist/components/core/inputs/SingleSelect.d.ts +7 -1
- package/dist/components/core/inputs/SingleSelect.d.ts.map +1 -1
- package/dist/components/core/inputs/index.js +4 -4
- package/dist/components/core/language/index.js +1 -1
- package/dist/components/core/layouts/AppActions.d.ts.map +1 -1
- package/dist/components/core/layouts/index.js +9 -9
- package/dist/components/core/navbar/index.js +1 -1
- package/dist/components/core/states/index.js +2 -2
- package/dist/components/core/table/index.js +4 -4
- package/dist/components/core/tabs/index.js +6 -6
- package/dist/components/core/theme/index.js +1 -1
- package/dist/components/index.js +26 -26
- package/dist/components/ui/control.d.ts +13 -0
- package/dist/components/ui/control.d.ts.map +1 -1
- package/dist/components/ui/index.d.ts +1 -1
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/components/ui/index.js +6 -6
- package/dist/{dialogs-CUKX7EFT.js → dialogs-CU6kEVHZ.js} +12 -13
- package/dist/hooks/behavior/index.js +1 -1
- package/dist/hooks/behavior/useConfirmDeleteDialog.d.ts.map +1 -1
- package/dist/hooks/index.js +5 -5
- package/dist/hooks/ui/index.js +4 -4
- package/dist/i18n/index.js +1 -1
- package/dist/i18n/krosoftLocales.d.ts +2 -0
- package/dist/i18n/krosoftLocales.d.ts.map +1 -1
- package/dist/{i18n-d2p0RJo9.js → i18n-TbpdvUJO.js} +2 -0
- package/dist/{inputs-V2h_AcMW.js → inputs-Cb0xGJ-E.js} +3 -3
- package/dist/{language-9nbLYpqG.js → language-DcRIOaqX.js} +7 -7
- package/dist/{navbar-BLdw6QDi.js → navbar-CRdXfxxM.js} +37 -37
- package/dist/pwa/index.js +1 -1
- package/dist/{select-CfhuieLs.js → select-KWMg2_7Z.js} +1 -1
- package/dist/{sheet-DRzg-JWH.js → sheet-Dyu9stsE.js} +2 -2
- package/dist/{states-C4MdmAbW.js → states-__YoT7H3.js} +2 -2
- package/dist/tailwind/index.d.ts +5 -0
- package/dist/tailwind/index.d.ts.map +1 -1
- package/dist/tailwind/index.js +5 -0
- package/dist/{theme-2eQs7CHF.js → theme-CHrjFJTd.js} +7 -7
- package/dist/{tooltip-Bu3wNhtW.js → tooltip-_geGvbS7.js} +3 -3
- package/dist/types/AppAction.d.ts +28 -10
- package/dist/types/AppAction.d.ts.map +1 -1
- package/dist/types/ConfirmDialogConfig.d.ts +0 -1
- package/dist/types/ConfirmDialogConfig.d.ts.map +1 -1
- package/dist/{ui-d1qh5cWB.js → ui-BAFhAfBh.js} +3 -3
- package/dist/{ui-DVtB9U8H.js → ui-Ce0ULzME.js} +21 -21
- package/dist/{useDocumentTitle-FqaDq5xD.js → useDocumentTitle-DN2FTz2t.js} +1 -1
- package/dist/{useLanguage-BVUtoDnh.js → useLanguage-Bo6n3OCS.js} +1 -1
- package/dist/{useTheme-CNx4iolb.js → useTheme-DU7ABdZ1.js} +1 -1
- package/package.json +1 -1
- package/dist/MultiSelect-Dmt1iWgB.js +0 -148
package/README.md
CHANGED
|
@@ -92,11 +92,14 @@ Rien n'oblige à suivre un preset : n'importe quelle valeur convient (`--k-radiu
|
|
|
92
92
|
| `--k-success`, `--k-warning`, `--k-info` (+ `-foreground`) | `bg-success`, `text-warning-foreground`, `border-info`… |
|
|
93
93
|
| `--k-topbar-*` | `bg-topbar`, `text-topbar-foreground`, `bg-topbar-accent`… |
|
|
94
94
|
| `--k-brand-from`, `--k-brand-to`, `--k-brand-foreground` | `from-brand-from`, `to-brand-to`, `text-brand-foreground` |
|
|
95
|
+
| `--k-dialog-header-*` (mêmes suffixes) | `from-dialog-header-from`, `text-dialog-header-foreground`… |
|
|
95
96
|
| `--k-sidebar-muted` | `text-sidebar-muted` |
|
|
96
97
|
| `--k-radius-control`, `--k-radius-surface` (+ `-dense`) | `rounded-control`, `rounded-surface` |
|
|
97
98
|
| `--k-font-heading`, `--k-font-body` | appliquées directement par `globals.css` sur `body` et `h1`–`h6` |
|
|
98
99
|
|
|
99
|
-
`--k-brand-*` est le dégradé de marque
|
|
100
|
+
`--k-brand-*` est le dégradé de marque, à la main de l'application : bouton `variant="brand"`, bandeaux, écrans de connexion. Deux bornes plutôt qu'une couleur pleine, parce que les surfaces qui le portent sont des dégradés — un thème qui n'en veut pas met la même valeur des deux côtés. Chaque thème embarqué le redéclare avec ses propres teintes (violet par défaut, jaune sur Temporal, cyan sur Ocean). `-foreground` porte le texte et les icônes posés dessus, et n'est donc pas toujours blanc : un dégradé clair demande un texte sombre.
|
|
101
|
+
|
|
102
|
+
`--k-dialog-header-*` habille l'en-tête d'`AppDialog` et suit les mêmes trois suffixes. Tokens **distincts** de la marque à dessein : l'en-tête est un choix de composant, la marque un choix d'application, et retoucher l'un ne doit pas déplacer l'autre. Ils ne sont pas indépendants pour rien : un projet qui ne déclare que `--k-brand-*` obtient quand même une dialog cohérente, le preset retombant dessus. Story `Design Tokens/Marque` pour comparer les thèmes côte à côte.
|
|
100
103
|
|
|
101
104
|
Ces couleurs sont désormais mappées par le preset partagé : un projet consommateur qui les déclarait dans son propre `tailwind.config` peut supprimer ces lignes.
|
|
102
105
|
|
|
@@ -124,3 +127,19 @@ applyTokenPreset(radiusPresets, "round"); // pose les variables sur <html>
|
|
|
124
127
|
| `tokensToStyle` | Les mêmes variables en `style` React, pour un sous-arbre |
|
|
125
128
|
|
|
126
129
|
C'est aussi ce qui rend la suite extensible : une nouvelle famille de tokens (densité, élévation…) ne demande ni attribut dédié ni preset CSS, seulement un objet à côté de `radiusPresets` et ses variables dans `:root`.
|
|
130
|
+
|
|
131
|
+
## Soumettre un formulaire depuis une barre d'actions
|
|
132
|
+
|
|
133
|
+
`GenericForm` accepte un `id` posé sur son `<form>`. Un bouton rendu ailleurs dans la page — pied d'`AppDialog`, en-tête d'`AppPageHeader` — le soumet en le visant par `form`, plutôt qu'en remontant une fonction de submit :
|
|
134
|
+
|
|
135
|
+
```tsx
|
|
136
|
+
const formId = useId();
|
|
137
|
+
|
|
138
|
+
<AppPageHeader
|
|
139
|
+
titleKey="Modifier l'achat"
|
|
140
|
+
actions={[{ labelKey: "Sauvegarder", type: "submit", form: formId }]}
|
|
141
|
+
/>
|
|
142
|
+
<GenericForm id={formId} schema={schema} onSubmit={onSubmit} renderActions={false} />;
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Une action `type: "submit"` porte donc `form` au lieu d'`onClick` — les deux s'excluent. La validation reste celle du formulaire, et rien ne transite par une ref. Sur mobile, où les actions passent en menu déroulant et ne sont plus des `<button>`, `AppActions` retombe sur `requestSubmit()` du formulaire ciblé : c'est pourquoi `form` y est requis.
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { t as e } from "./tailwind.helper-CJaRYBmL.js";
|
|
2
|
-
import { t } from "./i18n-
|
|
3
|
-
import { Bt as n, Ft as r, Gt as i, Nt as a, jt as o } from "./ui-
|
|
4
|
-
import { s } from "./tooltip-
|
|
2
|
+
import { t } from "./i18n-TbpdvUJO.js";
|
|
3
|
+
import { Bt as n, Ft as r, Gt as i, Nt as a, jt as o } from "./ui-Ce0ULzME.js";
|
|
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";
|
|
7
7
|
import { MoreVerticalIcon as d } from "lucide-react";
|
|
8
8
|
//#region src/components/core/layouts/AppActions.tsx
|
|
9
|
-
|
|
10
|
-
let
|
|
11
|
-
|
|
9
|
+
var f = (e) => {
|
|
10
|
+
let t = document.getElementById(e);
|
|
11
|
+
t instanceof HTMLFormElement && t.requestSubmit();
|
|
12
|
+
};
|
|
13
|
+
function p({ actions: p, className: m }) {
|
|
14
|
+
let { t: h } = t(), g = c();
|
|
15
|
+
return !p || p.length === 0 ? null : g ? /* @__PURE__ */ u(o, { children: [/* @__PURE__ */ l(i, {
|
|
12
16
|
asChild: !0,
|
|
13
17
|
children: /* @__PURE__ */ l(s, {
|
|
14
18
|
variant: "outline",
|
|
@@ -18,43 +22,63 @@ function f({ actions: f, className: p }) {
|
|
|
18
22
|
}), /* @__PURE__ */ l(a, {
|
|
19
23
|
align: "end",
|
|
20
24
|
className: "min-w-48",
|
|
21
|
-
children:
|
|
22
|
-
onClick: () =>
|
|
25
|
+
children: p.map((t, i) => t ? t.children && t.children.length > 0 ? /* @__PURE__ */ u("div", { children: [i > 0 && /* @__PURE__ */ l(n, {}), t.children.map((t, n) => t ? /* @__PURE__ */ u(r, {
|
|
26
|
+
onClick: () => {
|
|
27
|
+
if (t.type === "submit") {
|
|
28
|
+
f(t.form);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
t.onClick?.();
|
|
32
|
+
},
|
|
23
33
|
disabled: t.disabled,
|
|
24
34
|
className: e("gap-2", t.className),
|
|
25
|
-
children: [t.icon && /* @__PURE__ */ l(t.icon, { className: "size-4" }), t.labelKey &&
|
|
35
|
+
children: [t.icon && /* @__PURE__ */ l(t.icon, { className: "size-4" }), t.labelKey && h(t.labelKey)]
|
|
26
36
|
}, n) : null)] }, i) : /* @__PURE__ */ u(r, {
|
|
27
|
-
onClick: () =>
|
|
37
|
+
onClick: () => {
|
|
38
|
+
if (t.type === "submit") {
|
|
39
|
+
f(t.form);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
t.onClick?.();
|
|
43
|
+
},
|
|
28
44
|
disabled: t.disabled,
|
|
29
45
|
className: e("gap-2", t.className),
|
|
30
|
-
children: [t.icon && /* @__PURE__ */ l(t.icon, { className: "size-4" }), t.labelKey &&
|
|
46
|
+
children: [t.icon && /* @__PURE__ */ l(t.icon, { className: "size-4" }), t.labelKey && h(t.labelKey)]
|
|
31
47
|
}, i) : null)
|
|
32
48
|
})] }) : ((t) => /* @__PURE__ */ l("div", {
|
|
33
|
-
className: e("flex gap-2",
|
|
49
|
+
className: e("flex gap-2", m),
|
|
34
50
|
children: t.map((t, n) => t ? t.children && t.children.length > 0 ? /* @__PURE__ */ u(o, { children: [/* @__PURE__ */ l(i, {
|
|
35
51
|
asChild: !0,
|
|
36
52
|
children: /* @__PURE__ */ u(s, {
|
|
37
53
|
variant: t.variant,
|
|
38
54
|
disabled: t.disabled,
|
|
39
55
|
className: e("gap-2", t.className),
|
|
40
|
-
children: [t.icon && /* @__PURE__ */ l(t.icon, { className: "size-4" }), t.labelKey &&
|
|
56
|
+
children: [t.icon && /* @__PURE__ */ l(t.icon, { className: "size-4" }), t.labelKey && h(t.labelKey)]
|
|
41
57
|
})
|
|
42
58
|
}), /* @__PURE__ */ l(a, {
|
|
43
59
|
align: "end",
|
|
44
60
|
children: t.children.map((t, n) => t ? /* @__PURE__ */ u(r, {
|
|
45
|
-
onClick: () =>
|
|
61
|
+
onClick: () => {
|
|
62
|
+
if (t.type === "submit") {
|
|
63
|
+
f(t.form);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
t.onClick?.();
|
|
67
|
+
},
|
|
46
68
|
disabled: t.disabled,
|
|
47
69
|
className: e("gap-2", t.className),
|
|
48
|
-
children: [t.icon && /* @__PURE__ */ l(t.icon, { className: "size-4" }), t.labelKey &&
|
|
70
|
+
children: [t.icon && /* @__PURE__ */ l(t.icon, { className: "size-4" }), t.labelKey && h(t.labelKey)]
|
|
49
71
|
}, n) : null)
|
|
50
72
|
})] }, n) : /* @__PURE__ */ u(s, {
|
|
51
73
|
variant: t.variant,
|
|
52
|
-
|
|
74
|
+
type: t.type,
|
|
75
|
+
form: t.form,
|
|
76
|
+
onClick: t.onClick ? () => void t.onClick?.() : void 0,
|
|
53
77
|
disabled: t.disabled,
|
|
54
78
|
className: e("gap-2", t.className),
|
|
55
|
-
children: [t.icon && /* @__PURE__ */ l(t.icon, { className: "size-4" }), t.labelKey &&
|
|
79
|
+
children: [t.icon && /* @__PURE__ */ l(t.icon, { className: "size-4" }), t.labelKey && h(t.labelKey)]
|
|
56
80
|
}, n) : null)
|
|
57
|
-
}))(
|
|
81
|
+
}))(p);
|
|
58
82
|
}
|
|
59
83
|
//#endregion
|
|
60
|
-
export {
|
|
84
|
+
export { p as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as e } from "./i18n-
|
|
2
|
-
import { t } from "./AppActions-
|
|
1
|
+
import { t as e } from "./i18n-TbpdvUJO.js";
|
|
2
|
+
import { t } from "./AppActions-DCFvzqFN.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-
|
|
2
|
+
import { t } from "./i18n-TbpdvUJO.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 }) {
|
|
@@ -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-
|
|
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-
|
|
5
|
-
import {
|
|
6
|
-
import { g as m } from "./sheet-
|
|
7
|
-
import { i as h, l as g, n as ee, t as _, u as v } from "./select-
|
|
3
|
+
import { t as i } from "./i18n-TbpdvUJO.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-Ce0ULzME.js";
|
|
5
|
+
import { c as p } from "./tooltip-_geGvbS7.js";
|
|
6
|
+
import { g as m } from "./sheet-Dyu9stsE.js";
|
|
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-
|
|
10
|
-
import { t as x } from "./AppSubTitle-
|
|
11
|
-
import { t as S } from "./MultiSelect-
|
|
9
|
+
import { t as b } from "./ImageInput-BGe_bc79.js";
|
|
10
|
+
import { t as x } from "./AppSubTitle-Cmu-4o-a.js";
|
|
11
|
+
import { t as S } from "./MultiSelect-xNfIdYS9.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,7 +1,7 @@
|
|
|
1
1
|
import { t as e } from "./tailwind.helper-CJaRYBmL.js";
|
|
2
|
-
import { t } from "./i18n-
|
|
3
|
-
import "./ui-
|
|
4
|
-
import {
|
|
2
|
+
import { t } from "./i18n-TbpdvUJO.js";
|
|
3
|
+
import "./ui-Ce0ULzME.js";
|
|
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";
|
|
7
7
|
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { t as e } from "./tailwind.helper-CJaRYBmL.js";
|
|
2
|
+
import { t } from "./i18n-TbpdvUJO.js";
|
|
3
|
+
import { bn as n } from "./ui-Ce0ULzME.js";
|
|
4
|
+
import { a as r, o as i, s as a } from "./tooltip-_geGvbS7.js";
|
|
5
|
+
import { h as o, m as s, p as c } from "./sheet-Dyu9stsE.js";
|
|
6
|
+
import { useMemo as l, useState as u } from "react";
|
|
7
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
8
|
+
import { ChevronDownIcon as p, SearchIcon as m, XIcon as h } from "lucide-react";
|
|
9
|
+
import { Command as g } from "cmdk";
|
|
10
|
+
//#region src/components/core/inputs/MultiSelect.tsx
|
|
11
|
+
var _ = ({ options: _, selected: v, onToggle: y, onClear: b, onSelectAll: x, variant: S = "input", placeholder: C, labelKey: w, searchable: T = !1, searchPlaceholder: E, disabled: D = !1, maxCount: O, className: k, ...A }) => {
|
|
12
|
+
let { t: j } = t(), [M, N] = u(""), [P, F] = u(!1), I = S === "pill", L = S === "input" ? void 0 : i, R = l(() => M === "" ? _ : _.filter((e) => e.label.toLowerCase().includes(M.toLowerCase())), [_, M]), z = l(() => R.filter((e) => e.disabled !== !0).map((e) => e.value), [R]), B = l(() => v.filter((e) => _.find((t) => t.value === e)?.disabled === !0), [_, v]), V = l(() => z.length !== 0 && z.every((e) => v.includes(e)), [z, v]), H = l(() => v.map((e) => _.find((t) => t.value === e)?.label ?? e), [_, v]), U = O !== void 0 && O > 0 ? H.slice(0, O) : H, W = H.length - U.length, G = (e) => {
|
|
13
|
+
F(e), e || N("");
|
|
14
|
+
}, K = () => {
|
|
15
|
+
B.length > 0 ? x === void 0 ? v.filter((e) => !B.includes(e)).forEach((e) => {
|
|
16
|
+
y(e);
|
|
17
|
+
}) : x(B) : b === void 0 ? x === void 0 ? v.forEach((e) => {
|
|
18
|
+
y(e);
|
|
19
|
+
}) : x([]) : b();
|
|
20
|
+
}, q = () => {
|
|
21
|
+
if (V) x === void 0 ? b !== void 0 && v.every((e) => z.includes(e)) ? b() : z.forEach((e) => {
|
|
22
|
+
y(e);
|
|
23
|
+
}) : x(v.filter((e) => !z.includes(e)));
|
|
24
|
+
else if (x !== void 0) {
|
|
25
|
+
let e = [...v];
|
|
26
|
+
z.forEach((t) => {
|
|
27
|
+
e.includes(t) || e.push(t);
|
|
28
|
+
}), x(e);
|
|
29
|
+
} else z.forEach((e) => {
|
|
30
|
+
v.includes(e) || y(e);
|
|
31
|
+
});
|
|
32
|
+
}, J = I ? /* @__PURE__ */ f("button", {
|
|
33
|
+
...A,
|
|
34
|
+
type: "button",
|
|
35
|
+
disabled: D,
|
|
36
|
+
className: e(r, "inline-flex items-center justify-between gap-1.5 whitespace-nowrap transition-colors", v.length > 0 ? "border-primary bg-primary/10 text-primary font-medium" : "hover:bg-muted", L, k),
|
|
37
|
+
children: [/* @__PURE__ */ d("span", {
|
|
38
|
+
className: "truncate",
|
|
39
|
+
children: w === void 0 ? C ?? j("select.placeholder") : j(w)
|
|
40
|
+
}), /* @__PURE__ */ f("div", {
|
|
41
|
+
className: "flex shrink-0 items-center gap-1.5",
|
|
42
|
+
children: [v.length > 0 && /* @__PURE__ */ d("span", {
|
|
43
|
+
className: "flex h-4 min-w-[16px] items-center justify-center rounded-full bg-primary px-1 text-[10px] font-bold text-primary-foreground",
|
|
44
|
+
children: v.length
|
|
45
|
+
}), /* @__PURE__ */ d(p, { className: e("size-3.5 opacity-60 transition-transform", P && "rotate-180") })]
|
|
46
|
+
})]
|
|
47
|
+
}) : /* @__PURE__ */ f("button", {
|
|
48
|
+
...A,
|
|
49
|
+
type: "button",
|
|
50
|
+
disabled: D,
|
|
51
|
+
className: e(a, "w-full", L, P && "ring-2 ring-ring ring-offset-2", v.length === 0 && "text-muted-foreground", k),
|
|
52
|
+
children: [/* @__PURE__ */ d("span", {
|
|
53
|
+
className: "truncate",
|
|
54
|
+
children: v.length === 0 ? C ?? j("select.placeholder") : U.join(", ")
|
|
55
|
+
}), /* @__PURE__ */ f("div", {
|
|
56
|
+
className: "flex shrink-0 items-center gap-1",
|
|
57
|
+
children: [
|
|
58
|
+
W > 0 && /* @__PURE__ */ f("span", {
|
|
59
|
+
className: "rounded-control bg-muted px-1.5 py-0.5 text-xs font-medium text-foreground",
|
|
60
|
+
children: ["+", W]
|
|
61
|
+
}),
|
|
62
|
+
v.length > 0 && !D && /* @__PURE__ */ d("span", {
|
|
63
|
+
role: "button",
|
|
64
|
+
tabIndex: -1,
|
|
65
|
+
onClick: (e) => {
|
|
66
|
+
e.stopPropagation();
|
|
67
|
+
},
|
|
68
|
+
onPointerDown: (e) => {
|
|
69
|
+
e.preventDefault(), e.stopPropagation(), K();
|
|
70
|
+
},
|
|
71
|
+
className: "text-muted-foreground hover:text-foreground",
|
|
72
|
+
children: /* @__PURE__ */ d(h, { className: "size-4" })
|
|
73
|
+
}),
|
|
74
|
+
/* @__PURE__ */ d(p, { className: e("size-4 opacity-50 shrink-0 transition-transform", P && "rotate-180") })
|
|
75
|
+
]
|
|
76
|
+
})]
|
|
77
|
+
});
|
|
78
|
+
return /* @__PURE__ */ f(c, {
|
|
79
|
+
open: P,
|
|
80
|
+
onOpenChange: G,
|
|
81
|
+
children: [/* @__PURE__ */ d(o, {
|
|
82
|
+
asChild: !0,
|
|
83
|
+
children: J
|
|
84
|
+
}), /* @__PURE__ */ f(s, {
|
|
85
|
+
className: e("p-0", I ? "w-72 max-w-[var(--radix-popover-content-available-width)]" : "w-[var(--radix-popover-trigger-width)]"),
|
|
86
|
+
align: "start",
|
|
87
|
+
children: [/* @__PURE__ */ f(g, {
|
|
88
|
+
shouldFilter: !1,
|
|
89
|
+
className: "flex flex-col",
|
|
90
|
+
children: [T ? /* @__PURE__ */ d("div", {
|
|
91
|
+
className: "border-b border-border p-2",
|
|
92
|
+
children: /* @__PURE__ */ f("div", {
|
|
93
|
+
className: "relative",
|
|
94
|
+
children: [/* @__PURE__ */ d(m, { className: "absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }), /* @__PURE__ */ d(g.Input, {
|
|
95
|
+
value: M,
|
|
96
|
+
onValueChange: N,
|
|
97
|
+
placeholder: E ?? j("search.placeholder"),
|
|
98
|
+
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",
|
|
99
|
+
autoFocus: !0
|
|
100
|
+
})]
|
|
101
|
+
})
|
|
102
|
+
}) : /* @__PURE__ */ d(g.Input, {
|
|
103
|
+
autoFocus: !0,
|
|
104
|
+
tabIndex: -1,
|
|
105
|
+
className: "sr-only"
|
|
106
|
+
}), /* @__PURE__ */ f(g.List, {
|
|
107
|
+
className: "flex flex-col gap-0.5 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",
|
|
108
|
+
children: [R.length === 0 && /* @__PURE__ */ d("p", {
|
|
109
|
+
className: "px-2 py-3 text-center text-xs text-muted-foreground",
|
|
110
|
+
children: j("states.noResult")
|
|
111
|
+
}), R.map((e) => /* @__PURE__ */ f(g.Item, {
|
|
112
|
+
value: e.value,
|
|
113
|
+
disabled: e.disabled,
|
|
114
|
+
onSelect: () => {
|
|
115
|
+
y(e.value);
|
|
116
|
+
},
|
|
117
|
+
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",
|
|
118
|
+
children: [
|
|
119
|
+
/* @__PURE__ */ d("span", {
|
|
120
|
+
className: "pointer-events-none shrink-0",
|
|
121
|
+
children: /* @__PURE__ */ d(n, { checked: v.includes(e.value) })
|
|
122
|
+
}),
|
|
123
|
+
e.color && /* @__PURE__ */ d("span", {
|
|
124
|
+
className: "size-2.5 shrink-0 rounded-full",
|
|
125
|
+
style: { backgroundColor: e.color }
|
|
126
|
+
}),
|
|
127
|
+
/* @__PURE__ */ d("span", {
|
|
128
|
+
className: "min-w-0 flex-1 truncate",
|
|
129
|
+
title: e.label,
|
|
130
|
+
children: e.label
|
|
131
|
+
})
|
|
132
|
+
]
|
|
133
|
+
}, e.value))]
|
|
134
|
+
})]
|
|
135
|
+
}), z.length > 0 && /* @__PURE__ */ d("div", {
|
|
136
|
+
className: "border-t border-border p-1.5",
|
|
137
|
+
children: /* @__PURE__ */ d("button", {
|
|
138
|
+
type: "button",
|
|
139
|
+
onClick: q,
|
|
140
|
+
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",
|
|
141
|
+
children: j(V ? "filters.deselectAll" : "filters.selectAll")
|
|
142
|
+
})
|
|
143
|
+
})]
|
|
144
|
+
})]
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
//#endregion
|
|
148
|
+
export { _ as t };
|