@makoai/app-sdk 2.27.0 → 2.29.0
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 +142 -1
- package/components/combobox.tsx +150 -0
- package/components/filter-bar.tsx +15 -6
- package/components/index.ts +4 -1
- package/components/period-picker.tsx +54 -24
- package/components/period.ts +54 -5
- package/index.d.ts +4 -2
- package/index.js +10 -1
- package/locale.d.ts +122 -0
- package/locale.js +178 -0
- package/menu/filter-menu.tsx +26 -8
- package/package.json +7 -1
- package/ui-core.js +3 -1
- package/ui.css +53 -0
- package/ui.d.ts +77 -1
- package/ui.js +319 -46
package/components/period.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
// Periods for the date filters (2.27): a week, month, quarter or year, or a
|
|
2
2
|
// custom range. Dates are ISO 'YYYY-MM-DD' strings in UTC, both ends
|
|
3
|
-
// inclusive. Pure functions only
|
|
4
|
-
// apps/attrition-por-cohorte/src/ui/period.ts.
|
|
3
|
+
// inclusive. Pure functions only. Ported 1:1 from the workspace's
|
|
4
|
+
// apps/attrition-por-cohorte/src/ui/period.ts. 2.29: localized labels
|
|
5
|
+
// (`periodLabel(p, locale)`) and rolling presets (`presetPeriod`).
|
|
6
|
+
import { localeStrings } from "../locale.js";
|
|
5
7
|
|
|
6
8
|
export type Unit = "week" | "month" | "quarter" | "year";
|
|
7
|
-
|
|
9
|
+
/** A rolling preset (2.29): the last N days ("28d") or month, quarter, year to date. All end today. */
|
|
10
|
+
export type PeriodPreset = `${number}d` | "mtd" | "qtd" | "ytd";
|
|
11
|
+
/** `preset` (2.29) marks a range picked as a rolling preset: write it to the URL as `period=28d`. */
|
|
12
|
+
export type Period = { unit: Unit | "custom"; from: string; to: string; preset?: PeriodPreset };
|
|
8
13
|
|
|
9
14
|
const d = (iso: string) => new Date(iso + "T00:00:00Z");
|
|
10
15
|
const iso = (x: Date) => x.toISOString().slice(0, 10);
|
|
@@ -46,6 +51,9 @@ const wholeMonths = (p: Period) => p.from.slice(8) === "01" && addDays(p.to, 1).
|
|
|
46
51
|
|
|
47
52
|
/** The period k steps later (k < 0: earlier). A custom range moves by its own length. */
|
|
48
53
|
export function shift(p: Period, k: number): Period {
|
|
54
|
+
// Month, quarter or year to date steps to the whole unit before (or after) it.
|
|
55
|
+
const toDate = p.preset && TO_DATE[p.preset as keyof typeof TO_DATE];
|
|
56
|
+
if (toDate) return shift(periodOf(toDate, p.from), k);
|
|
49
57
|
if (p.unit === "week") return periodOf("week", addDays(p.from, 7 * k));
|
|
50
58
|
if (p.unit !== "custom") return periodOf(p.unit, addMonths(p.from, stepMonths[p.unit] * k));
|
|
51
59
|
if (wholeMonths(p)) {
|
|
@@ -65,8 +73,14 @@ const MON = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct
|
|
|
65
73
|
const day = (s: string, withYear = true) => `${Number(s.slice(8))} ${MON[Number(s.slice(5, 7)) - 1]}${withYear ? ` ${s.slice(0, 4)}` : ""}`;
|
|
66
74
|
const month = (s: string, withYear = true) => `${MON[Number(s.slice(5, 7)) - 1]}${withYear ? ` ${s.slice(0, 4)}` : ""}`;
|
|
67
75
|
|
|
68
|
-
/**
|
|
69
|
-
|
|
76
|
+
/**
|
|
77
|
+
* "Nov 2026", "Q4 2026", "2026", "17–23 Nov 2026", "Sep – Nov 2026".
|
|
78
|
+
* With a `locale` (2.29) the month names come from Intl in that language
|
|
79
|
+
* ("nov. 2026", "16.–22. Nov 2026"). A preset reads as its name: "Last 28 days", "28 derniers jours".
|
|
80
|
+
*/
|
|
81
|
+
export function periodLabel(p: Period, locale?: string): string {
|
|
82
|
+
if (p.preset) return presetLabel(p.preset, locale);
|
|
83
|
+
if (locale) return localLabel(p, locale);
|
|
70
84
|
if (p.unit === "year") return p.from.slice(0, 4);
|
|
71
85
|
if (p.unit === "quarter") return `Q${Math.floor(Number(p.from.slice(5, 7)) / 3) + 1} ${p.from.slice(0, 4)}`;
|
|
72
86
|
if (p.unit === "month") return month(p.from);
|
|
@@ -81,3 +95,38 @@ export function periodLabel(p: Period): string {
|
|
|
81
95
|
}
|
|
82
96
|
|
|
83
97
|
export const UNIT_LABEL: Record<Unit, string> = { week: "Week", month: "Month", quarter: "Quarter", year: "Year" };
|
|
98
|
+
|
|
99
|
+
const TO_DATE = { mtd: "month", qtd: "quarter", ytd: "year" } as const;
|
|
100
|
+
|
|
101
|
+
/** A preset's dates on `today`: `presetPeriod("28d")` is the 28 days ending today. Null for an unknown id. */
|
|
102
|
+
export function presetPeriod(id: string | null | undefined, today = todayIso()): Period | null {
|
|
103
|
+
const days = /^([1-9]\d{0,3})d$/.exec(id ?? "");
|
|
104
|
+
const unit = TO_DATE[id as keyof typeof TO_DATE];
|
|
105
|
+
if (!days && !unit) return null;
|
|
106
|
+
const from = days ? addDays(today, 1 - Number(days[1])) : startOf(unit, today);
|
|
107
|
+
return { unit: "custom", from, to: today, preset: id as PeriodPreset };
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** A preset's name: "Last 28 days", "Month to date"; localized with `locale`. */
|
|
111
|
+
export function presetLabel(id: PeriodPreset, locale?: string, labels?: { lastDays?: (n: number) => string; mtd?: string; qtd?: string; ytd?: string }): string {
|
|
112
|
+
const L = localeStrings("period", locale, labels);
|
|
113
|
+
return /^\d+d$/.test(id) ? L.lastDays(Number(id.slice(0, -1))) : L[id as "mtd" | "qtd" | "ytd"];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function localLabel(p: Period, locale: string): string {
|
|
117
|
+
const fmt = new Intl.DateTimeFormat(locale, { month: "short", timeZone: "UTC" });
|
|
118
|
+
const de = /^de\b/i.test(locale);
|
|
119
|
+
const mon = (s: string, withYear = true) => `${fmt.format(d(s))}${withYear ? ` ${s.slice(0, 4)}` : ""}`;
|
|
120
|
+
const dd = (s: string) => `${Number(s.slice(8))}${de ? "." : ""}`;
|
|
121
|
+
const dayL = (s: string, withYear = true) => `${dd(s)} ${mon(s, withYear)}`;
|
|
122
|
+
if (p.unit === "year") return p.from.slice(0, 4);
|
|
123
|
+
if (p.unit === "quarter") return localeStrings("period", locale).quarterLabel(Math.floor(Number(p.from.slice(5, 7)) / 3) + 1, p.from.slice(0, 4));
|
|
124
|
+
if (p.unit === "month") return mon(p.from);
|
|
125
|
+
const sameYear = p.from.slice(0, 4) === p.to.slice(0, 4);
|
|
126
|
+
if (p.unit === "custom" && wholeMonths(p)) {
|
|
127
|
+
const last = addDays(p.to, 1 - Number(p.to.slice(8)));
|
|
128
|
+
return last === p.from ? mon(p.from) : `${mon(p.from, !sameYear)} – ${mon(last)}`;
|
|
129
|
+
}
|
|
130
|
+
const sameMonth = sameYear && p.from.slice(5, 7) === p.to.slice(5, 7);
|
|
131
|
+
return sameMonth ? `${dd(p.from)}–${dayL(p.to)}` : `${dayL(p.from, !sameYear)} – ${dayL(p.to)}`;
|
|
132
|
+
}
|
package/index.d.ts
CHANGED
|
@@ -408,8 +408,10 @@ export function useTheme(): { theme: "light" | "dark" };
|
|
|
408
408
|
|
|
409
409
|
/** A market's lowercase code, in COUNTRY_ORDER. */
|
|
410
410
|
export type CountryCode = "ch" | "fr" | "es" | "it" | "pl" | "pt";
|
|
411
|
-
/**
|
|
412
|
-
export
|
|
411
|
+
/** A lead-only market (2.28): the valuation funnel runs there, no agents. In this order. */
|
|
412
|
+
export type LeadMarketCode = "de" | "at" | "cz" | "nl" | "be" | "gb";
|
|
413
|
+
/** One colour per market (2.27; lead-only markets 2.28), keyed by lowercase code; `all` is the all-markets line. */
|
|
414
|
+
export const COUNTRY_COLORS: Readonly<Record<CountryCode | LeadMarketCode | "all", string>>;
|
|
413
415
|
/** CH, FR, ES, IT, PL, PT (2.27), as lowercase codes. */
|
|
414
416
|
export const COUNTRY_ORDER: readonly CountryCode[];
|
|
415
417
|
|
package/index.js
CHANGED
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
* in a page (or this export) says which SDK a deployed app actually runs.
|
|
39
39
|
* Kept in step with package.json by snapshot.test.mjs.
|
|
40
40
|
*/
|
|
41
|
-
export const SDK_VERSION = "2.
|
|
41
|
+
export const SDK_VERSION = "2.29.0";
|
|
42
42
|
if (typeof window !== "undefined") {
|
|
43
43
|
try {
|
|
44
44
|
window.__MAKO_APP_SDK__ = SDK_VERSION;
|
|
@@ -2068,6 +2068,9 @@ if (
|
|
|
2068
2068
|
// ---------------------------------------------------------------------------
|
|
2069
2069
|
// Country colours (2.27): one colour per market in every app, deck and chart,
|
|
2070
2070
|
// keyed by the lowercase country code. `all` is the all-markets / group line.
|
|
2071
|
+
// 2.28 adds the 6 lead-only markets (valuation funnel only since 18-19 Nov
|
|
2072
|
+
// 2026), in their order: DE, AT, CZ, NL, BE, GB (realadvisor.co.uk). Their
|
|
2073
|
+
// flags repeat the first six's hues, so they take free ones.
|
|
2071
2074
|
// ---------------------------------------------------------------------------
|
|
2072
2075
|
export const COUNTRY_COLORS = Object.freeze({
|
|
2073
2076
|
ch: "#dc2626",
|
|
@@ -2076,6 +2079,12 @@ export const COUNTRY_COLORS = Object.freeze({
|
|
|
2076
2079
|
es: "#f59e0b",
|
|
2077
2080
|
pt: "#0891b2",
|
|
2078
2081
|
pl: "#db2777",
|
|
2082
|
+
de: "#7c3aed",
|
|
2083
|
+
at: "#65a30d",
|
|
2084
|
+
cz: "#a16207",
|
|
2085
|
+
nl: "#ea580c",
|
|
2086
|
+
be: "#c026d3",
|
|
2087
|
+
gb: "#1e40af",
|
|
2079
2088
|
all: "#475569",
|
|
2080
2089
|
});
|
|
2081
2090
|
|
package/locale.d.ts
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// @makoai/app-sdk strings table (2.29). Re-exported from "@makoai/app-sdk/ui" and "/components".
|
|
2
|
+
|
|
3
|
+
/** The languages the SDK ships strings for. */
|
|
4
|
+
export type LocaleLang = "en" | "fr" | "de" | "it" | "es" | "pl" | "pt";
|
|
5
|
+
export const LOCALES: readonly LocaleLang[];
|
|
6
|
+
/** "fr-CH" → "fr". An unknown language or no locale → "en". */
|
|
7
|
+
export function localeLang(locale?: string | null): LocaleLang;
|
|
8
|
+
|
|
9
|
+
/** Every fixed text of PeriodPicker. Override any with `labels`. */
|
|
10
|
+
export interface PeriodPickerLabels {
|
|
11
|
+
/** The trigger's screen-reader name when `label` is not set. Default "Time". */
|
|
12
|
+
time: string;
|
|
13
|
+
/** The ‹ button's aria-label. Default "Previous period". */
|
|
14
|
+
previous: string;
|
|
15
|
+
/** The › button's aria-label. Default "Next period". */
|
|
16
|
+
next: string;
|
|
17
|
+
/** The menu's aria-label. Default "Pick a period". */
|
|
18
|
+
menu: string;
|
|
19
|
+
/** The unit tabs. Default "Week", "Month", "Quarter", "Year", "Custom". */
|
|
20
|
+
week: string;
|
|
21
|
+
month: string;
|
|
22
|
+
quarter: string;
|
|
23
|
+
year: string;
|
|
24
|
+
custom: string;
|
|
25
|
+
/** The tab of the `presets`. Default "Shortcuts". */
|
|
26
|
+
presets: string;
|
|
27
|
+
/** Under the period in progress in the grid. Default "in progress". */
|
|
28
|
+
inProgress: string;
|
|
29
|
+
/** The trigger's hover title on the period in progress. Default "In progress: the numbers are not final yet". */
|
|
30
|
+
inProgressTitle: string;
|
|
31
|
+
/** The custom range's fields and button. Default "From", "To", "Apply". */
|
|
32
|
+
from: string;
|
|
33
|
+
to: string;
|
|
34
|
+
apply: string;
|
|
35
|
+
/** A quarter, used only with `locale`. Default `Q4 2026`; French `T4 2026`. */
|
|
36
|
+
quarterLabel: (quarter: number, year: string) => string;
|
|
37
|
+
/** A rolling preset. Default `Last 28 days`. */
|
|
38
|
+
lastDays: (n: number) => string;
|
|
39
|
+
/** The to-date presets. Default "Month to date", "Quarter to date", "Year to date". */
|
|
40
|
+
mtd: string;
|
|
41
|
+
qtd: string;
|
|
42
|
+
ytd: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Every fixed text of FilterBar. */
|
|
46
|
+
export interface FilterBarLabels {
|
|
47
|
+
/** The phone chip, the sheet's title and the bar's aria-label. Default "Filters". */
|
|
48
|
+
filters: string;
|
|
49
|
+
/** Default "Reset". */
|
|
50
|
+
reset: string;
|
|
51
|
+
/** Reset's hover title. Default "Back to the default filters". */
|
|
52
|
+
resetTitle: string;
|
|
53
|
+
/** The sheet's close button. Default "Done". */
|
|
54
|
+
done: string;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Every fixed text of MultiSelect, FilterItems and FilterMenu. Explicit props (`allLabel`, `noneLabel`, `formatMany`, `searchPlaceholder`, `searchEmpty`) win. */
|
|
58
|
+
export interface FilterLabels {
|
|
59
|
+
/** The first row and the trigger under All. Default "All". */
|
|
60
|
+
all: string;
|
|
61
|
+
/** The trigger while nothing is ticked. Default "None". */
|
|
62
|
+
none: string;
|
|
63
|
+
/** The trigger for several values. Default `3 selected`. */
|
|
64
|
+
many: (n: number) => string;
|
|
65
|
+
/** The hover action that picks one row alone. Default "Only". */
|
|
66
|
+
only: string;
|
|
67
|
+
/** The search input's placeholder and name. Default "Search". */
|
|
68
|
+
search: string;
|
|
69
|
+
/** Shown when no row matches. Default "No match". */
|
|
70
|
+
noMatch: string;
|
|
71
|
+
/** FilterMenu: a group's own first row. Default `All Pages`. */
|
|
72
|
+
groupAll: (label: string) => string;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Every fixed text of Combobox. Explicit props (`placeholder`, `searchPlaceholder`, `emptyText`) win. */
|
|
76
|
+
export interface ComboboxLabels {
|
|
77
|
+
/** Default "Select...". */
|
|
78
|
+
placeholder: string;
|
|
79
|
+
/** Default "Search...". */
|
|
80
|
+
search: string;
|
|
81
|
+
/** Default "No results found.". */
|
|
82
|
+
empty: string;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** A non-English DataTable set: plain strings, plus `rows` (the default noun) and `of` ("51–100 of 312"). */
|
|
86
|
+
export interface DataTableLocaleStrings {
|
|
87
|
+
rows: string;
|
|
88
|
+
of: string;
|
|
89
|
+
empty: string;
|
|
90
|
+
page: (page: number, pageCount: number) => string;
|
|
91
|
+
perPage: (size: number) => string;
|
|
92
|
+
rowsPerPage: string;
|
|
93
|
+
first: string;
|
|
94
|
+
previous: string;
|
|
95
|
+
next: string;
|
|
96
|
+
last: string;
|
|
97
|
+
sortHint: (label: string) => string;
|
|
98
|
+
exportCsv: string;
|
|
99
|
+
exportTitle: string;
|
|
100
|
+
exportFailed: string;
|
|
101
|
+
expand: string;
|
|
102
|
+
collapse: string;
|
|
103
|
+
info: (label: string) => string;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface LocaleStrings {
|
|
107
|
+
period: PeriodPickerLabels;
|
|
108
|
+
filterBar: FilterBarLabels;
|
|
109
|
+
filter: FilterLabels;
|
|
110
|
+
combobox: ComboboxLabels;
|
|
111
|
+
/** Absent in en: DataTable's English set is DATA_TABLE_LABELS. */
|
|
112
|
+
dataTable?: DataTableLocaleStrings;
|
|
113
|
+
}
|
|
114
|
+
/** The one strings table, by language. */
|
|
115
|
+
export const STRINGS: Readonly<Record<LocaleLang, LocaleStrings>>;
|
|
116
|
+
/** One section for a locale, with `labels` on top. */
|
|
117
|
+
export function localeStrings<K extends "period" | "filterBar" | "filter" | "combobox">(
|
|
118
|
+
section: K,
|
|
119
|
+
locale?: string | null,
|
|
120
|
+
labels?: Partial<LocaleStrings[K]> | null,
|
|
121
|
+
): LocaleStrings[K];
|
|
122
|
+
export function localeStrings(section: "dataTable", locale?: string | null, labels?: null): DataTableLocaleStrings | Record<string, never>;
|
package/locale.js
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
// The SDK's one strings table (2.29): every fixed text the filters and the
|
|
2
|
+
// table write themselves, in the 7 RealAdvisor languages. A component takes
|
|
3
|
+
// `locale` (BCP 47, "fr-CH") and matches on the language part; `labels`
|
|
4
|
+
// overrides single strings on top. No `locale`: English, exactly as before.
|
|
5
|
+
// Plain data and pure functions, no imports, so ui.js and the TSX share it.
|
|
6
|
+
|
|
7
|
+
export const LOCALES = ["en", "fr", "de", "it", "es", "pl", "pt"];
|
|
8
|
+
|
|
9
|
+
/** "fr-CH" → "fr". An unknown language or no locale → "en". */
|
|
10
|
+
export function localeLang(locale) {
|
|
11
|
+
const lang = String(locale ?? "").toLowerCase().split(/[-_]/)[0];
|
|
12
|
+
return LOCALES.includes(lang) ? lang : "en";
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const en = {
|
|
16
|
+
period: {
|
|
17
|
+
time: "Time", previous: "Previous period", next: "Next period", menu: "Pick a period",
|
|
18
|
+
week: "Week", month: "Month", quarter: "Quarter", year: "Year", custom: "Custom", presets: "Shortcuts",
|
|
19
|
+
inProgress: "in progress", inProgressTitle: "In progress: the numbers are not final yet",
|
|
20
|
+
from: "From", to: "To", apply: "Apply",
|
|
21
|
+
quarterLabel: (q, y) => `Q${q} ${y}`,
|
|
22
|
+
lastDays: n => `Last ${n} days`, mtd: "Month to date", qtd: "Quarter to date", ytd: "Year to date",
|
|
23
|
+
},
|
|
24
|
+
filterBar: { filters: "Filters", reset: "Reset", resetTitle: "Back to the default filters", done: "Done" },
|
|
25
|
+
filter: { all: "All", none: "None", many: n => `${n} selected`, only: "Only", search: "Search", noMatch: "No match", groupAll: label => `All ${label}` },
|
|
26
|
+
combobox: { placeholder: "Select...", search: "Search...", empty: "No results found." },
|
|
27
|
+
// DataTable's English set is DATA_TABLE_LABELS in ui.js (its range is JSX).
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const fr = {
|
|
31
|
+
period: {
|
|
32
|
+
time: "Période", previous: "Période précédente", next: "Période suivante", menu: "Choisir une période",
|
|
33
|
+
week: "Semaine", month: "Mois", quarter: "Trimestre", year: "Année", custom: "Personnalisé", presets: "Raccourcis",
|
|
34
|
+
inProgress: "en cours", inProgressTitle: "En cours : les chiffres ne sont pas encore définitifs",
|
|
35
|
+
from: "Du", to: "Au", apply: "Appliquer",
|
|
36
|
+
quarterLabel: (q, y) => `T${q} ${y}`,
|
|
37
|
+
lastDays: n => `${n} derniers jours`, mtd: "Ce mois-ci", qtd: "Ce trimestre", ytd: "Cette année",
|
|
38
|
+
},
|
|
39
|
+
filterBar: { filters: "Filtres", reset: "Réinitialiser", resetTitle: "Revenir aux filtres par défaut", done: "Terminé" },
|
|
40
|
+
filter: { all: "Tous", none: "Aucun", many: n => `${n} sélectionnés`, only: "Seulement", search: "Rechercher", noMatch: "Aucun résultat", groupAll: label => `${label} (tout)` },
|
|
41
|
+
combobox: { placeholder: "Choisir…", search: "Rechercher…", empty: "Aucun résultat." },
|
|
42
|
+
dataTable: {
|
|
43
|
+
rows: "lignes", of: "sur", empty: "Aucune ligne pour ces filtres.",
|
|
44
|
+
page: (p, n) => `Page ${p} sur ${n}`, perPage: s => `${s} par page`, rowsPerPage: "Lignes par page",
|
|
45
|
+
first: "Première page", previous: "Page précédente", next: "Page suivante", last: "Dernière page",
|
|
46
|
+
sortHint: l => `${l} · cliquer pour trier`, exportCsv: "Exporter en CSV",
|
|
47
|
+
exportTitle: "Exporter toutes les lignes de toutes les pages, dans l'ordre du tri",
|
|
48
|
+
exportFailed: "Le navigateur a bloqué le téléchargement. Ouvrez l'app dans un nouvel onglet et exportez à nouveau.",
|
|
49
|
+
expand: "Afficher le détail", collapse: "Masquer le détail", info: l => `À propos de ${l}`,
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const de = {
|
|
54
|
+
period: {
|
|
55
|
+
time: "Zeitraum", previous: "Vorheriger Zeitraum", next: "Nächster Zeitraum", menu: "Zeitraum wählen",
|
|
56
|
+
week: "Woche", month: "Monat", quarter: "Quartal", year: "Jahr", custom: "Individuell", presets: "Schnellwahl",
|
|
57
|
+
inProgress: "laufend", inProgressTitle: "Laufend: die Zahlen sind noch nicht endgültig",
|
|
58
|
+
from: "Von", to: "Bis", apply: "Anwenden",
|
|
59
|
+
quarterLabel: (q, y) => `Q${q} ${y}`,
|
|
60
|
+
lastDays: n => `Letzte ${n} Tage`, mtd: "Dieser Monat", qtd: "Dieses Quartal", ytd: "Dieses Jahr",
|
|
61
|
+
},
|
|
62
|
+
filterBar: { filters: "Filter", reset: "Zurücksetzen", resetTitle: "Zurück zu den Standardfiltern", done: "Fertig" },
|
|
63
|
+
filter: { all: "Alle", none: "Keine", many: n => `${n} ausgewählt`, only: "Nur", search: "Suchen", noMatch: "Keine Treffer", groupAll: label => `${label} (alle)` },
|
|
64
|
+
combobox: { placeholder: "Auswählen…", search: "Suchen…", empty: "Keine Ergebnisse." },
|
|
65
|
+
dataTable: {
|
|
66
|
+
rows: "Zeilen", of: "von", empty: "Keine Zeilen für diese Filter.",
|
|
67
|
+
page: (p, n) => `Seite ${p} von ${n}`, perPage: s => `${s} pro Seite`, rowsPerPage: "Zeilen pro Seite",
|
|
68
|
+
first: "Erste Seite", previous: "Vorherige Seite", next: "Nächste Seite", last: "Letzte Seite",
|
|
69
|
+
sortHint: l => `${l} · klicken zum Sortieren`, exportCsv: "CSV exportieren",
|
|
70
|
+
exportTitle: "Alle Zeilen aller Seiten exportieren, in der aktuellen Sortierung",
|
|
71
|
+
exportFailed: "Der Browser hat den Download blockiert. Öffnen Sie die App in einem neuen Tab und exportieren Sie erneut.",
|
|
72
|
+
expand: "Details anzeigen", collapse: "Details ausblenden", info: l => `Info zu ${l}`,
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const it = {
|
|
77
|
+
period: {
|
|
78
|
+
time: "Periodo", previous: "Periodo precedente", next: "Periodo successivo", menu: "Scegli un periodo",
|
|
79
|
+
week: "Settimana", month: "Mese", quarter: "Trimestre", year: "Anno", custom: "Personalizzato", presets: "Scorciatoie",
|
|
80
|
+
inProgress: "in corso", inProgressTitle: "In corso: i numeri non sono ancora definitivi",
|
|
81
|
+
from: "Da", to: "A", apply: "Applica",
|
|
82
|
+
quarterLabel: (q, y) => `T${q} ${y}`,
|
|
83
|
+
lastDays: n => `Ultimi ${n} giorni`, mtd: "Questo mese", qtd: "Questo trimestre", ytd: "Quest'anno",
|
|
84
|
+
},
|
|
85
|
+
filterBar: { filters: "Filtri", reset: "Reimposta", resetTitle: "Torna ai filtri predefiniti", done: "Fatto" },
|
|
86
|
+
filter: { all: "Tutti", none: "Nessuno", many: n => `${n} selezionati`, only: "Solo", search: "Cerca", noMatch: "Nessun risultato", groupAll: label => `${label} (tutti)` },
|
|
87
|
+
combobox: { placeholder: "Seleziona…", search: "Cerca…", empty: "Nessun risultato." },
|
|
88
|
+
dataTable: {
|
|
89
|
+
rows: "righe", of: "di", empty: "Nessuna riga per questi filtri.",
|
|
90
|
+
page: (p, n) => `Pagina ${p} di ${n}`, perPage: s => `${s} per pagina`, rowsPerPage: "Righe per pagina",
|
|
91
|
+
first: "Prima pagina", previous: "Pagina precedente", next: "Pagina successiva", last: "Ultima pagina",
|
|
92
|
+
sortHint: l => `${l} · clicca per ordinare`, exportCsv: "Esporta CSV",
|
|
93
|
+
exportTitle: "Esporta tutte le righe di tutte le pagine, nell'ordine attuale",
|
|
94
|
+
exportFailed: "Il browser ha bloccato il download. Apri l'app in una nuova scheda ed esporta di nuovo.",
|
|
95
|
+
expand: "Mostra dettagli", collapse: "Nascondi dettagli", info: l => `Info su ${l}`,
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const es = {
|
|
100
|
+
period: {
|
|
101
|
+
time: "Periodo", previous: "Periodo anterior", next: "Periodo siguiente", menu: "Elegir un periodo",
|
|
102
|
+
week: "Semana", month: "Mes", quarter: "Trimestre", year: "Año", custom: "Personalizado", presets: "Atajos",
|
|
103
|
+
inProgress: "en curso", inProgressTitle: "En curso: las cifras aún no son definitivas",
|
|
104
|
+
from: "Desde", to: "Hasta", apply: "Aplicar",
|
|
105
|
+
quarterLabel: (q, y) => `T${q} ${y}`,
|
|
106
|
+
lastDays: n => `Últimos ${n} días`, mtd: "Este mes", qtd: "Este trimestre", ytd: "Este año",
|
|
107
|
+
},
|
|
108
|
+
filterBar: { filters: "Filtros", reset: "Restablecer", resetTitle: "Volver a los filtros por defecto", done: "Listo" },
|
|
109
|
+
filter: { all: "Todos", none: "Ninguno", many: n => `${n} seleccionados`, only: "Solo", search: "Buscar", noMatch: "Sin resultados", groupAll: label => `${label} (todo)` },
|
|
110
|
+
combobox: { placeholder: "Seleccionar…", search: "Buscar…", empty: "Sin resultados." },
|
|
111
|
+
dataTable: {
|
|
112
|
+
rows: "filas", of: "de", empty: "Ninguna fila con estos filtros.",
|
|
113
|
+
page: (p, n) => `Página ${p} de ${n}`, perPage: s => `${s} por página`, rowsPerPage: "Filas por página",
|
|
114
|
+
first: "Primera página", previous: "Página anterior", next: "Página siguiente", last: "Última página",
|
|
115
|
+
sortHint: l => `${l} · clic para ordenar`, exportCsv: "Exportar CSV",
|
|
116
|
+
exportTitle: "Exportar todas las filas de todas las páginas, en el orden actual",
|
|
117
|
+
exportFailed: "El navegador bloqueó la descarga. Abre la app en una pestaña nueva y exporta de nuevo.",
|
|
118
|
+
expand: "Ver detalles", collapse: "Ocultar detalles", info: l => `Acerca de ${l}`,
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const pl = {
|
|
123
|
+
period: {
|
|
124
|
+
time: "Okres", previous: "Poprzedni okres", next: "Następny okres", menu: "Wybierz okres",
|
|
125
|
+
week: "Tydzień", month: "Miesiąc", quarter: "Kwartał", year: "Rok", custom: "Własny", presets: "Skróty",
|
|
126
|
+
inProgress: "w toku", inProgressTitle: "W toku: liczby nie są jeszcze ostateczne",
|
|
127
|
+
from: "Od", to: "Do", apply: "Zastosuj",
|
|
128
|
+
quarterLabel: (q, y) => `Q${q} ${y}`,
|
|
129
|
+
lastDays: n => `Ostatnie ${n} dni`, mtd: "Ten miesiąc", qtd: "Ten kwartał", ytd: "Ten rok",
|
|
130
|
+
},
|
|
131
|
+
filterBar: { filters: "Filtry", reset: "Resetuj", resetTitle: "Przywróć domyślne filtry", done: "Gotowe" },
|
|
132
|
+
filter: { all: "Wszystkie", none: "Brak", many: n => `Wybrano: ${n}`, only: "Tylko", search: "Szukaj", noMatch: "Brak wyników", groupAll: label => `${label} (wszystko)` },
|
|
133
|
+
combobox: { placeholder: "Wybierz…", search: "Szukaj…", empty: "Brak wyników." },
|
|
134
|
+
dataTable: {
|
|
135
|
+
rows: "wierszy", of: "z", empty: "Brak wierszy dla tych filtrów.",
|
|
136
|
+
page: (p, n) => `Strona ${p} z ${n}`, perPage: s => `${s} na stronę`, rowsPerPage: "Wierszy na stronę",
|
|
137
|
+
first: "Pierwsza strona", previous: "Poprzednia strona", next: "Następna strona", last: "Ostatnia strona",
|
|
138
|
+
sortHint: l => `${l} · kliknij, aby sortować`, exportCsv: "Eksportuj CSV",
|
|
139
|
+
exportTitle: "Eksportuj wszystkie wiersze ze wszystkich stron, w bieżącej kolejności",
|
|
140
|
+
exportFailed: "Przeglądarka zablokowała pobieranie. Otwórz aplikację w nowej karcie i wyeksportuj ponownie.",
|
|
141
|
+
expand: "Pokaż szczegóły", collapse: "Ukryj szczegóły", info: l => `Informacje: ${l}`,
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const pt = {
|
|
146
|
+
period: {
|
|
147
|
+
time: "Período", previous: "Período anterior", next: "Período seguinte", menu: "Escolher um período",
|
|
148
|
+
week: "Semana", month: "Mês", quarter: "Trimestre", year: "Ano", custom: "Personalizado", presets: "Atalhos",
|
|
149
|
+
inProgress: "em curso", inProgressTitle: "Em curso: os números ainda não são definitivos",
|
|
150
|
+
from: "De", to: "Até", apply: "Aplicar",
|
|
151
|
+
quarterLabel: (q, y) => `T${q} ${y}`,
|
|
152
|
+
lastDays: n => `Últimos ${n} dias`, mtd: "Este mês", qtd: "Este trimestre", ytd: "Este ano",
|
|
153
|
+
},
|
|
154
|
+
filterBar: { filters: "Filtros", reset: "Repor", resetTitle: "Voltar aos filtros predefinidos", done: "Concluído" },
|
|
155
|
+
filter: { all: "Todos", none: "Nenhum", many: n => `${n} selecionados`, only: "Apenas", search: "Procurar", noMatch: "Sem resultados", groupAll: label => `${label} (tudo)` },
|
|
156
|
+
combobox: { placeholder: "Selecionar…", search: "Procurar…", empty: "Sem resultados." },
|
|
157
|
+
dataTable: {
|
|
158
|
+
rows: "linhas", of: "de", empty: "Nenhuma linha com estes filtros.",
|
|
159
|
+
page: (p, n) => `Página ${p} de ${n}`, perPage: s => `${s} por página`, rowsPerPage: "Linhas por página",
|
|
160
|
+
first: "Primeira página", previous: "Página anterior", next: "Página seguinte", last: "Última página",
|
|
161
|
+
sortHint: l => `${l} · clique para ordenar`, exportCsv: "Exportar CSV",
|
|
162
|
+
exportTitle: "Exportar todas as linhas de todas as páginas, pela ordem atual",
|
|
163
|
+
exportFailed: "O navegador bloqueou a transferência. Abra a app num novo separador e exporte de novo.",
|
|
164
|
+
expand: "Ver detalhes", collapse: "Ocultar detalhes", info: l => `Sobre ${l}`,
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
/** Every language's strings, by section: period, filterBar, filter, combobox, dataTable (not in en). */
|
|
169
|
+
export const STRINGS = { en, fr, de, it, es, pl, pt };
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* One section's strings for a locale, with `labels` on top. No locale and no
|
|
173
|
+
* labels returns the English object itself.
|
|
174
|
+
*/
|
|
175
|
+
export function localeStrings(section, locale, labels) {
|
|
176
|
+
const base = STRINGS[localeLang(locale)][section] ?? en[section] ?? {};
|
|
177
|
+
return labels ? { ...base, ...labels } : base;
|
|
178
|
+
}
|
package/menu/filter-menu.tsx
CHANGED
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
// The selection model is the kit's (2.20, `filter*` in ui-core.js): a
|
|
11
11
|
// selection is a list of leaf values, [] means All, and "nothing ticked" is
|
|
12
12
|
// a draft that emits nothing until the next tick.
|
|
13
|
+
//
|
|
14
|
+
// 2.29: `locale` and `labels` translate All, None, Only, "All <group>" and
|
|
15
|
+
// "N selected" from the SDK's strings table (../locale.js).
|
|
13
16
|
import * as React from "react";
|
|
14
17
|
import { ChevronDown, ChevronRight } from "lucide-react";
|
|
15
18
|
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
|
|
@@ -25,6 +28,7 @@ import {
|
|
|
25
28
|
filterToggleAll,
|
|
26
29
|
type FilterTick,
|
|
27
30
|
} from "../ui.js";
|
|
31
|
+
import { localeStrings, type FilterLabels } from "../locale.js";
|
|
28
32
|
import { Checkbox } from "./checkbox";
|
|
29
33
|
import {
|
|
30
34
|
DropdownMenu,
|
|
@@ -63,8 +67,12 @@ export interface FilterMenuItemsProps {
|
|
|
63
67
|
selected?: readonly string[];
|
|
64
68
|
value?: readonly string[];
|
|
65
69
|
onChange: (selected: string[]) => void;
|
|
66
|
-
/** The first row ("All traffic"). */
|
|
67
|
-
allLabel
|
|
70
|
+
/** The first row ("All traffic"). Default "All" (`labels.all`). */
|
|
71
|
+
allLabel?: string;
|
|
72
|
+
/** Mako thin prop (2.29): BCP 47 tag, e.g. "fr-CH": All, None, Only, "All <group>", "N selected" in that language. Default English. */
|
|
73
|
+
locale?: string;
|
|
74
|
+
/** Mako thin prop (2.29): override single texts on top of the locale. The explicit props win. */
|
|
75
|
+
labels?: Partial<FilterLabels>;
|
|
68
76
|
/** What All emits: [] (default) or every leaf value (false). */
|
|
69
77
|
emptyMeansAll?: boolean;
|
|
70
78
|
/** The "nothing ticked" draft, when the owner shows it (FilterMenu's trigger). Uncontrolled otherwise. */
|
|
@@ -86,6 +94,11 @@ export interface FilterMenuItemsProps {
|
|
|
86
94
|
*/
|
|
87
95
|
export function FilterMenuItems(props: FilterMenuItemsProps) {
|
|
88
96
|
const { options, drill, emptyMeansAll = true } = props;
|
|
97
|
+
const L = localeStrings("filter", props.locale, props.labels);
|
|
98
|
+
const allLabel = props.allLabel ?? L.all;
|
|
99
|
+
// English keeps 2.28's two text nodes ("All ", label); a locale writes one string.
|
|
100
|
+
const translated = props.locale != null || props.labels?.groupAll != null;
|
|
101
|
+
const groupAllText = (label: string) => (translated ? L.groupAll(label) : <>All {label}</>);
|
|
89
102
|
const selected = filterNormalize(options, props.selected ?? props.value ?? []);
|
|
90
103
|
const [ownNone, setOwnNone] = React.useState(false);
|
|
91
104
|
const none = props.none ?? ownNone;
|
|
@@ -109,7 +122,7 @@ export function FilterMenuItems(props: FilterMenuItemsProps) {
|
|
|
109
122
|
const onlyButton = (node: FilterMenuOption) =>
|
|
110
123
|
empty(node) ? null : (
|
|
111
124
|
<span role="button" tabIndex={-1} className="mk-fm-only" onClick={only(node)} onPointerUp={e => e.stopPropagation()}>
|
|
112
|
-
|
|
125
|
+
{L.only}
|
|
113
126
|
</span>
|
|
114
127
|
);
|
|
115
128
|
|
|
@@ -144,7 +157,7 @@ export function FilterMenuItems(props: FilterMenuItemsProps) {
|
|
|
144
157
|
<span
|
|
145
158
|
role="checkbox"
|
|
146
159
|
aria-checked={st === "on" ? true : st === "mixed" ? "mixed" : false}
|
|
147
|
-
aria-label={
|
|
160
|
+
aria-label={L.groupAll(node.label)}
|
|
148
161
|
aria-disabled={empty(node) || undefined}
|
|
149
162
|
className="flex"
|
|
150
163
|
onClick={e => {
|
|
@@ -169,7 +182,7 @@ export function FilterMenuItems(props: FilterMenuItemsProps) {
|
|
|
169
182
|
}}
|
|
170
183
|
>
|
|
171
184
|
<Tick state={st} />
|
|
172
|
-
<span className="flex-1">
|
|
185
|
+
<span className="flex-1">{groupAllText(node.label)}</span>
|
|
173
186
|
</DropdownMenuPrimitive.CheckboxItem>
|
|
174
187
|
);
|
|
175
188
|
|
|
@@ -235,7 +248,7 @@ export function FilterMenuItems(props: FilterMenuItemsProps) {
|
|
|
235
248
|
}}
|
|
236
249
|
>
|
|
237
250
|
<Tick state={allSt} />
|
|
238
|
-
<span className="flex-1">{
|
|
251
|
+
<span className="flex-1">{allLabel}</span>
|
|
239
252
|
</DropdownMenuPrimitive.CheckboxItem>
|
|
240
253
|
<DropdownMenuSeparator />
|
|
241
254
|
{level(options)}
|
|
@@ -268,10 +281,13 @@ export interface FilterMenuProps extends Omit<FilterMenuItemsProps, "none" | "on
|
|
|
268
281
|
|
|
269
282
|
/** The filter dropdown: the kit's trigger (`mk-ms-trigger`) over FilterMenuItems. */
|
|
270
283
|
export function FilterMenu(props: FilterMenuProps) {
|
|
271
|
-
const { options
|
|
284
|
+
const { options } = props;
|
|
285
|
+
const L = localeStrings("filter", props.locale, props.labels);
|
|
286
|
+
const allLabel = props.allLabel ?? L.all;
|
|
287
|
+
const noneLabel = props.noneLabel ?? L.none;
|
|
272
288
|
const selected = filterNormalize(options, props.selected ?? props.value ?? []);
|
|
273
289
|
const [none, setNone] = React.useState(false);
|
|
274
|
-
const text = none ? noneLabel : (props.summary ?? filterText(options, selected, allLabel, props.formatMany));
|
|
290
|
+
const text = none ? noneLabel : (props.summary ?? filterText(options, selected, allLabel, props.formatMany ?? L.many));
|
|
275
291
|
const probes = [...(props.sizeTo ?? [allLabel, ...options.map(o => o.label)]), ...(props.probes ?? [])];
|
|
276
292
|
return (
|
|
277
293
|
<DropdownMenu
|
|
@@ -302,6 +318,8 @@ export function FilterMenu(props: FilterMenuProps) {
|
|
|
302
318
|
selected={selected}
|
|
303
319
|
onChange={props.onChange}
|
|
304
320
|
allLabel={allLabel}
|
|
321
|
+
locale={props.locale}
|
|
322
|
+
labels={props.labels}
|
|
305
323
|
emptyMeansAll={props.emptyMeansAll}
|
|
306
324
|
none={none}
|
|
307
325
|
onNoneChange={setNone}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@makoai/app-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.29.0",
|
|
4
4
|
"description": "Mako app SDK: data bindings (useQuery/useDuckDB), URL state, theme, and the house dashboard kit (/ui).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -55,6 +55,10 @@
|
|
|
55
55
|
"types": "./components/command.tsx",
|
|
56
56
|
"default": "./components/command.tsx"
|
|
57
57
|
},
|
|
58
|
+
"./components/combobox": {
|
|
59
|
+
"types": "./components/combobox.tsx",
|
|
60
|
+
"default": "./components/combobox.tsx"
|
|
61
|
+
},
|
|
58
62
|
"./ui.css": "./ui.css",
|
|
59
63
|
"./tailwind.css": "./tailwind.css"
|
|
60
64
|
},
|
|
@@ -72,6 +76,8 @@
|
|
|
72
76
|
"ui.js",
|
|
73
77
|
"ui-core.js",
|
|
74
78
|
"ui.d.ts",
|
|
79
|
+
"locale.js",
|
|
80
|
+
"locale.d.ts",
|
|
75
81
|
"ui.css",
|
|
76
82
|
"tailwind.css",
|
|
77
83
|
"menu/",
|
package/ui-core.js
CHANGED
|
@@ -144,9 +144,11 @@ export function compareValues(a, b) {
|
|
|
144
144
|
|
|
145
145
|
/**
|
|
146
146
|
* The direction a column sorts in on its first click: numbers largest first
|
|
147
|
-
* (`num: true`), text A→Z.
|
|
147
|
+
* (`num: true`), text A→Z. `sortDescFirst` (2.29, TanStack's name) overrides
|
|
148
|
+
* it: false sorts a number or date column smallest (soonest) first.
|
|
148
149
|
*/
|
|
149
150
|
export function firstSortDir(column) {
|
|
151
|
+
if (column?.sortDescFirst != null) return column.sortDescFirst ? "desc" : "asc";
|
|
150
152
|
return column?.num ? "desc" : "asc";
|
|
151
153
|
}
|
|
152
154
|
|
package/ui.css
CHANGED
|
@@ -269,6 +269,57 @@ button, input, select, textarea { font-family: inherit; }
|
|
|
269
269
|
/* `truncate: false`: the text wraps inside the column; the width still holds. */
|
|
270
270
|
.mk-dt-wrap { white-space: normal; overflow-wrap: anywhere; }
|
|
271
271
|
.mk-dt-table td.mk-dt-empty { text-align: center; color: var(--muted-foreground); padding: 48px 10px; white-space: normal; }
|
|
272
|
+
/* `wrapHeaders`: a header label takes up to 2 lines instead of one ellipsized
|
|
273
|
+
* line, so a client reads every word. The sort icon keeps its place beside it. */
|
|
274
|
+
.mk-dt--wrap-heads .mk-dt-sort, .mk-dt--wrap-heads .mk-dt-label { white-space: normal; }
|
|
275
|
+
.mk-dt--wrap-heads thead .mk-dt-th-text {
|
|
276
|
+
display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
|
|
277
|
+
white-space: normal; overflow-wrap: break-word; line-height: 1.3;
|
|
278
|
+
}
|
|
279
|
+
/* A column's `info`: the "i" sits after the sort button, never inside it. */
|
|
280
|
+
.mk-dt-th-row { display: flex; align-items: center; min-width: 0; }
|
|
281
|
+
.mk-dt-th-row > :is(.mk-dt-sort, .mk-dt-label) { flex: 1 1 auto; width: auto; min-width: 0; padding-right: 2px; }
|
|
282
|
+
.mk-dt-info-wrap { flex: none; display: inline-flex; padding-right: 6px; }
|
|
283
|
+
.mk-dt-info {
|
|
284
|
+
appearance: none; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px;
|
|
285
|
+
padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted-foreground); cursor: pointer;
|
|
286
|
+
}
|
|
287
|
+
.mk-dt-info:hover, .mk-dt-info.open { color: var(--foreground); background: var(--muted); }
|
|
288
|
+
.mk-dt-info:focus-visible { outline: 2px solid var(--ring); outline-offset: 0; }
|
|
289
|
+
.mk-dt-info-pop {
|
|
290
|
+
position: fixed; top: 0; left: 0; z-index: 90; width: max-content; max-width: min(320px, calc(100vw - 16px));
|
|
291
|
+
padding: 10px 12px; font-size: 12px; line-height: 1.45; white-space: normal; text-align: left;
|
|
292
|
+
}
|
|
293
|
+
.mk-dt-info-pop:focus { outline: none; }
|
|
294
|
+
.mk-dt-info-title { display: block; margin-bottom: 4px; font-weight: 600; }
|
|
295
|
+
.mk-dt-info-body > :first-child { margin-top: 0; }
|
|
296
|
+
.mk-dt-info-body > :last-child { margin-bottom: 0; }
|
|
297
|
+
@media (max-width: 640px) { .mk-dt-info-pop { top: auto; width: auto; max-width: none; padding: 16px; } }
|
|
298
|
+
/* Expandable rows: a chevron in the first cell opens a full-width detail row. */
|
|
299
|
+
.mk-dt-xcell { display: flex; align-items: center; gap: 4px; min-width: 0; }
|
|
300
|
+
.mk-dt-xcell > :is(.mk-dt-cell, .mk-dt-wrap) { flex: 1 1 auto; min-width: 0; }
|
|
301
|
+
.mk-dt-expander, .mk-dt-expander-none { flex: none; width: 20px; height: 20px; margin-left: -4px; }
|
|
302
|
+
.mk-dt-expander {
|
|
303
|
+
appearance: none; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0;
|
|
304
|
+
border-radius: var(--mk-radius-sm); background: none; color: var(--muted-foreground); cursor: pointer;
|
|
305
|
+
}
|
|
306
|
+
.mk-dt-expander:hover { color: var(--foreground); background: var(--muted); }
|
|
307
|
+
.mk-dt-expander:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
|
|
308
|
+
.mk-dt-expander svg { transform: rotate(-90deg); transition: transform .14s var(--mk-ease); }
|
|
309
|
+
.mk-dt-expander[aria-expanded="true"] svg { transform: none; }
|
|
310
|
+
.mk-dt-table tbody tr.mk-dt-open > td { border-bottom-color: transparent; }
|
|
311
|
+
.mk-dt-table tbody tr.mk-dt-detail > td,
|
|
312
|
+
.mk-dt-table tbody tr.mk-dt-detail:hover > td { padding: 0; white-space: normal; background: color-mix(in srgb, var(--muted) 40%, var(--card)); }
|
|
313
|
+
.mk-dt-detail-body { position: sticky; left: 0; padding: 10px 16px 14px 34px; overflow-wrap: anywhere; }
|
|
314
|
+
/* `totalRow`: a <tfoot> pinned to the bottom of the scroll box, bold, with a
|
|
315
|
+
* rule on top. Its first cell stays pinned left with the column. */
|
|
316
|
+
.mk-dt-table tfoot td {
|
|
317
|
+
position: sticky; bottom: 0; z-index: 2; border-bottom: 0; font-weight: 600;
|
|
318
|
+
background: var(--card); box-shadow: inset 0 1px 0 var(--border);
|
|
319
|
+
}
|
|
320
|
+
.mk-dt-table tfoot td.mk-dt-pin { z-index: 3; box-shadow: inset -1px 0 0 var(--border), inset 0 1px 0 var(--border); }
|
|
321
|
+
.mk-dt-table tfoot tr.mk-dt-total.mk-dt-click:hover > td,
|
|
322
|
+
.mk-dt-table tfoot tr.mk-dt-total.mk-dt-click:focus-visible > td { background: color-mix(in srgb, var(--muted) 50%, var(--card)); }
|
|
272
323
|
.mk-dt-foot {
|
|
273
324
|
flex: none; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
|
|
274
325
|
padding: 8px 12px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted-foreground);
|
|
@@ -336,6 +387,8 @@ button, input, select, textarea { font-family: inherit; }
|
|
|
336
387
|
/* Ticked in the brand blue (white tick), --primary where a theme has no --brand. */
|
|
337
388
|
.mk-ms-box.on { background: var(--brand, var(--primary)); border-color: var(--brand, var(--primary)); color: #fff; }
|
|
338
389
|
.mk-ms-swatch { width: 8px; height: 8px; border-radius: 999px; flex-shrink: 0; }
|
|
390
|
+
/* An option's `count` (2.28): muted, right-aligned, tabular figures. */
|
|
391
|
+
.mk-ms-count { flex-shrink: 0; margin-left: auto; font-size: 12px; font-weight: 400; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
|
|
339
392
|
.mk-ms-sep { height: 1px; background: var(--border); margin: 4px -4px; flex: none; }
|
|
340
393
|
/* MultiSelect `searchable` (2.27): shadcn's CommandInput (36px, a search icon,
|
|
341
394
|
* a hairline under it), pinned at the top while the rows scroll. The
|