@alfadocs/ui-kit-debug 1.106.0 → 1.107.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfadocs/ui-kit-debug",
3
- "version": "1.106.0",
3
+ "version": "1.107.0",
4
4
  "type": "module",
5
5
  "description": "AlfaDocs shared design system — tokens, components, patterns, and translations for platform, booking, and alfascribe. (debug build — identical runtime to @alfadocs/ui-kit, ships source maps for symbolication).",
6
6
  "license": "BUSL-1.1",
@@ -1,107 +0,0 @@
1
- import { jsx as p } from "react/jsx-runtime";
2
- import { forwardRef as S, Children as j } from "react";
3
- import { c as e } from "./index-D2ZczOXr.js";
4
- const a = 6;
5
- function w(s, o) {
6
- const t = Math.max(1, Math.min(o, a));
7
- if (s <= t) return Math.max(1, s);
8
- const n = Math.ceil(s / t), r = Math.ceil(s / n);
9
- for (let l = r; l >= 2; l -= 1)
10
- if (s % l !== 1) return l;
11
- return r;
12
- }
13
- function N(s, o) {
14
- return o > 1 && s > o && s % o === 1;
15
- }
16
- const b = {
17
- 2: {
18
- 1: "ds:@[400px]:grid-cols-1",
19
- 2: "ds:@[400px]:grid-cols-2",
20
- 3: "ds:@[400px]:grid-cols-3",
21
- 4: "ds:@[400px]:grid-cols-4",
22
- 5: "ds:@[400px]:grid-cols-5",
23
- 6: "ds:@[400px]:grid-cols-6"
24
- },
25
- 3: {
26
- 1: "ds:@[608px]:grid-cols-1",
27
- 2: "ds:@[608px]:grid-cols-2",
28
- 3: "ds:@[608px]:grid-cols-3",
29
- 4: "ds:@[608px]:grid-cols-4",
30
- 5: "ds:@[608px]:grid-cols-5",
31
- 6: "ds:@[608px]:grid-cols-6"
32
- },
33
- 4: {
34
- 1: "ds:@[816px]:grid-cols-1",
35
- 2: "ds:@[816px]:grid-cols-2",
36
- 3: "ds:@[816px]:grid-cols-3",
37
- 4: "ds:@[816px]:grid-cols-4",
38
- 5: "ds:@[816px]:grid-cols-5",
39
- 6: "ds:@[816px]:grid-cols-6"
40
- },
41
- 5: {
42
- 1: "ds:@[1024px]:grid-cols-1",
43
- 2: "ds:@[1024px]:grid-cols-2",
44
- 3: "ds:@[1024px]:grid-cols-3",
45
- 4: "ds:@[1024px]:grid-cols-4",
46
- 5: "ds:@[1024px]:grid-cols-5",
47
- 6: "ds:@[1024px]:grid-cols-6"
48
- },
49
- 6: {
50
- 1: "ds:@[1232px]:grid-cols-1",
51
- 2: "ds:@[1232px]:grid-cols-2",
52
- 3: "ds:@[1232px]:grid-cols-3",
53
- 4: "ds:@[1232px]:grid-cols-4",
54
- 5: "ds:@[1232px]:grid-cols-5",
55
- 6: "ds:@[1232px]:grid-cols-6"
56
- }
57
- }, G = {
58
- 2: { full: "ds:@[400px]:col-span-full", one: "ds:@[400px]:col-span-1" },
59
- 3: { full: "ds:@[608px]:col-span-full", one: "ds:@[608px]:col-span-1" },
60
- 4: { full: "ds:@[816px]:col-span-full", one: "ds:@[816px]:col-span-1" },
61
- 5: { full: "ds:@[1024px]:col-span-full", one: "ds:@[1024px]:col-span-1" },
62
- 6: { full: "ds:@[1232px]:col-span-full", one: "ds:@[1232px]:col-span-1" }
63
- }, A = e("ds:@container ds:block ds:w-full ds:min-w-0"), C = e(
64
- [
65
- "ds:grid ds:list-none ds:m-0 ds:p-0 ds:grid-cols-1",
66
- "ds:gap-[var(--spacing-md)] ds:items-stretch"
67
- ].join(" ")
68
- ), O = e("ds:flex ds:min-w-0 ds:[&>*]:w-full ds:[&>*]:min-w-0"), v = S(
69
- function({ children: o, maxColumns: t = a, className: n, ...r }, l) {
70
- const x = j.toArray(o), c = x.length, m = Math.min(t, a), g = [], u = {};
71
- for (let d = 2; d <= a; d += 1) {
72
- const i = w(c, Math.min(d, m));
73
- g.push(b[d][i]), u[d] = N(c, i);
74
- }
75
- return /* @__PURE__ */ p(
76
- "div",
77
- {
78
- ref: l,
79
- "data-component": "stat-group",
80
- "data-count": c,
81
- role: r["aria-label"] ? "group" : void 0,
82
- className: [A(), n].filter(Boolean).join(" "),
83
- ...r,
84
- children: /* @__PURE__ */ p("ul", { className: [C(), ...g].join(" "), children: x.map((d, i) => {
85
- const h = i === c - 1 ? Object.entries(G).map(([M, f]) => u[Number(M)] ? f.full : f.one).join(" ") : "";
86
- return /* @__PURE__ */ p(
87
- "li",
88
- {
89
- "data-stat-group-item": "",
90
- className: [O(), h].filter(Boolean).join(" "),
91
- children: d
92
- },
93
- i
94
- );
95
- }) })
96
- }
97
- );
98
- }
99
- );
100
- v.displayName = "StatGroup";
101
- export {
102
- a as S,
103
- v as a,
104
- N as b,
105
- w as s
106
- };
107
- //# sourceMappingURL=stat-group-DSNnzkbW.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stat-group-DSNnzkbW.js","sources":["../../src/components/stat-group/stat-group.tsx"],"sourcesContent":["import {\n Children,\n forwardRef,\n type HTMLAttributes,\n type ReactNode,\n} from 'react';\nimport { cva } from 'class-variance-authority';\n\n/* ------------------------------------------------------------------ */\n/* Layout maths (pure, no measuring) */\n/* ------------------------------------------------------------------ */\n\n// Min tile width is 192px (4 x --spacing-2xl) and the gap is --spacing-md\n// (16px). Container queries cannot read var(), and rem in a container query\n// resolves against the host root font size (10px on the platform), so the\n// breakpoints below are literal px: n columns need n * 192 + (n - 1) * 16 px.\nexport const STAT_GROUP_MAX_COLUMNS = 6;\nexport type StatGroupColumns = 1 | 2 | 3 | 4 | 5 | 6;\n\n/**\n * Columns for `count` tiles when `available` columns fit: one row if they\n * all fit, otherwise balanced rows, preferring a split with no lone tile.\n */\nexport function statGroupColumns(\n count: number,\n available: number,\n): StatGroupColumns {\n const fit = Math.max(1, Math.min(available, STAT_GROUP_MAX_COLUMNS));\n if (count <= fit) return Math.max(1, count) as StatGroupColumns;\n const rows = Math.ceil(count / fit);\n const balanced = Math.ceil(count / rows);\n for (let cols = balanced; cols >= 2; cols -= 1) {\n if (count % cols !== 1) return cols as StatGroupColumns;\n }\n return balanced as StatGroupColumns;\n}\n\n/** True when the last row would hold a single tile at this column count. */\nexport function statGroupHasOrphan(count: number, cols: number): boolean {\n return cols > 1 && count > cols && count % cols === 1;\n}\n\n/* ------------------------------------------------------------------ */\n/* Static class tables (Tailwind needs literal class names) */\n/* ------------------------------------------------------------------ */\n\n// Keys are the number of columns that fit (container width in the value).\nconst COLS: Record<number, Record<StatGroupColumns, string>> = {\n 2: {\n 1: 'ds:@[400px]:grid-cols-1',\n 2: 'ds:@[400px]:grid-cols-2',\n 3: 'ds:@[400px]:grid-cols-3',\n 4: 'ds:@[400px]:grid-cols-4',\n 5: 'ds:@[400px]:grid-cols-5',\n 6: 'ds:@[400px]:grid-cols-6',\n },\n 3: {\n 1: 'ds:@[608px]:grid-cols-1',\n 2: 'ds:@[608px]:grid-cols-2',\n 3: 'ds:@[608px]:grid-cols-3',\n 4: 'ds:@[608px]:grid-cols-4',\n 5: 'ds:@[608px]:grid-cols-5',\n 6: 'ds:@[608px]:grid-cols-6',\n },\n 4: {\n 1: 'ds:@[816px]:grid-cols-1',\n 2: 'ds:@[816px]:grid-cols-2',\n 3: 'ds:@[816px]:grid-cols-3',\n 4: 'ds:@[816px]:grid-cols-4',\n 5: 'ds:@[816px]:grid-cols-5',\n 6: 'ds:@[816px]:grid-cols-6',\n },\n 5: {\n 1: 'ds:@[1024px]:grid-cols-1',\n 2: 'ds:@[1024px]:grid-cols-2',\n 3: 'ds:@[1024px]:grid-cols-3',\n 4: 'ds:@[1024px]:grid-cols-4',\n 5: 'ds:@[1024px]:grid-cols-5',\n 6: 'ds:@[1024px]:grid-cols-6',\n },\n 6: {\n 1: 'ds:@[1232px]:grid-cols-1',\n 2: 'ds:@[1232px]:grid-cols-2',\n 3: 'ds:@[1232px]:grid-cols-3',\n 4: 'ds:@[1232px]:grid-cols-4',\n 5: 'ds:@[1232px]:grid-cols-5',\n 6: 'ds:@[1232px]:grid-cols-6',\n },\n};\n\n// A lone last tile spans the row when no column count can avoid it.\nconst SPAN: Record<number, { full: string; one: string }> = {\n 2: { full: 'ds:@[400px]:col-span-full', one: 'ds:@[400px]:col-span-1' },\n 3: { full: 'ds:@[608px]:col-span-full', one: 'ds:@[608px]:col-span-1' },\n 4: { full: 'ds:@[816px]:col-span-full', one: 'ds:@[816px]:col-span-1' },\n 5: { full: 'ds:@[1024px]:col-span-full', one: 'ds:@[1024px]:col-span-1' },\n 6: { full: 'ds:@[1232px]:col-span-full', one: 'ds:@[1232px]:col-span-1' },\n};\n\n/* ------------------------------------------------------------------ */\n/* CVA */\n/* ------------------------------------------------------------------ */\n\n// The wrapper is the size container; the list inside is the grid.\nconst rootVariants = cva('ds:@container ds:block ds:w-full ds:min-w-0');\n\nconst listVariants = cva(\n [\n 'ds:grid ds:list-none ds:m-0 ds:p-0 ds:grid-cols-1',\n 'ds:gap-[var(--spacing-md)] ds:items-stretch',\n ].join(' '),\n);\n\nconst itemVariants = cva('ds:flex ds:min-w-0 ds:[&>*]:w-full ds:[&>*]:min-w-0');\n\n/* ------------------------------------------------------------------ */\n/* Public types */\n/* ------------------------------------------------------------------ */\n\nexport interface StatGroupProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'children'\n> {\n /** The tiles, usually `Stat`. Each child becomes one grid cell. */\n children: ReactNode;\n /**\n * Most columns allowed, 1 to 6. Default 6. Lower it to keep tiles wider,\n * for example 4 on a dense dashboard.\n */\n maxColumns?: StatGroupColumns;\n /** Accessible name for the group of figures. */\n 'aria-label'?: string;\n}\n\n/* ------------------------------------------------------------------ */\n/* Component */\n/* ------------------------------------------------------------------ */\n\nexport const StatGroup = forwardRef<HTMLDivElement, StatGroupProps>(\n function StatGroup(\n { children, maxColumns = STAT_GROUP_MAX_COLUMNS, className, ...rest },\n ref,\n ) {\n const items = Children.toArray(children);\n const count = items.length;\n const cap = Math.min(maxColumns, STAT_GROUP_MAX_COLUMNS);\n\n const listClasses: string[] = [];\n const orphanAt: Record<number, boolean> = {};\n for (let fit = 2; fit <= STAT_GROUP_MAX_COLUMNS; fit += 1) {\n const cols = statGroupColumns(count, Math.min(fit, cap));\n listClasses.push(COLS[fit]![cols]);\n orphanAt[fit] = statGroupHasOrphan(count, cols);\n }\n\n return (\n <div\n ref={ref}\n data-component=\"stat-group\"\n data-count={count}\n role={rest['aria-label'] ? 'group' : undefined}\n className={[rootVariants(), className].filter(Boolean).join(' ')}\n {...rest}\n >\n <ul className={[listVariants(), ...listClasses].join(' ')}>\n {items.map((child, index) => {\n const isLast = index === count - 1;\n const spans = isLast\n ? Object.entries(SPAN)\n .map(([fit, s]) => (orphanAt[Number(fit)] ? s.full : s.one))\n .join(' ')\n : '';\n return (\n <li\n key={index}\n data-stat-group-item=\"\"\n className={[itemVariants(), spans].filter(Boolean).join(' ')}\n >\n {child}\n </li>\n );\n })}\n </ul>\n </div>\n );\n },\n);\n\nStatGroup.displayName = 'StatGroup';\n"],"names":["STAT_GROUP_MAX_COLUMNS","statGroupColumns","count","available","fit","rows","balanced","cols","statGroupHasOrphan","COLS","SPAN","rootVariants","cva","listVariants","itemVariants","StatGroup","forwardRef","children","maxColumns","className","rest","ref","items","Children","cap","listClasses","orphanAt","jsx","child","index","spans","s"],"mappings":";;;AAgBO,MAAMA,IAAyB;AAO/B,SAASC,EACdC,GACAC,GACkB;AAClB,QAAMC,IAAM,KAAK,IAAI,GAAG,KAAK,IAAID,GAAWH,CAAsB,CAAC;AACnE,MAAIE,KAASE,EAAK,QAAO,KAAK,IAAI,GAAGF,CAAK;AAC1C,QAAMG,IAAO,KAAK,KAAKH,IAAQE,CAAG,GAC5BE,IAAW,KAAK,KAAKJ,IAAQG,CAAI;AACvC,WAASE,IAAOD,GAAUC,KAAQ,GAAGA,KAAQ;AAC3C,QAAIL,IAAQK,MAAS,EAAG,QAAOA;AAEjC,SAAOD;AACT;AAGO,SAASE,EAAmBN,GAAeK,GAAuB;AACvE,SAAOA,IAAO,KAAKL,IAAQK,KAAQL,IAAQK,MAAS;AACtD;AAOA,MAAME,IAAyD;AAAA,E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