@intent-driven/adapter-mantine 0.1.1

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/CHANGELOG.md ADDED
@@ -0,0 +1,16 @@
1
+ # Changelog
2
+
3
+ ## 0.1.1 — 2026-04-15
4
+
5
+ ### Changed
6
+
7
+ - Обновлена peerDependency `@intent-driven/renderer` до `>=0.2.0` (поддержка map primitive и IrreversibleBadge)
8
+
9
+ ---
10
+
11
+ ## 0.1.0 — 2026-04-15
12
+
13
+ - Первый релиз: `mantineAdapter` spec + `MantineAdapterProvider`
14
+ - Корпоративный data-dense стиль (Mantine v9)
15
+ - Parameter controls, buttons, primitives, shell (modal/tabs)
16
+ - Автоматический импорт `@mantine/core/styles.css` и `@mantine/dates/styles.css`
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ignat Dubovsky
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,79 @@
1
+ # @intent-driven/adapter-mantine
2
+
3
+ Mantine-адаптер для `@intent-driven/renderer`. Корпоративный data-dense стиль — дефолт для доменов booking, planning, workflow, messenger, sales.
4
+
5
+ **Часть экосистемы [Intent-Driven Frontend (IDF)](https://github.com/ignatdubovskiy/idf).**
6
+
7
+ ## Установка
8
+
9
+ ```bash
10
+ npm install @intent-driven/adapter-mantine @mantine/core @mantine/dates lucide-react
11
+ # или
12
+ pnpm add @intent-driven/adapter-mantine @mantine/core @mantine/dates lucide-react
13
+ ```
14
+
15
+ Peer dependencies: `react@>=18`, `@intent-driven/renderer@>=0.2.0`, `@mantine/core@>=9`, `@mantine/dates@>=9`, `lucide-react@>=0.400.0`.
16
+
17
+ CSS-файлы `@mantine/core/styles.css` и `@mantine/dates/styles.css` импортируются провайдером автоматически.
18
+
19
+ ## Использование
20
+
21
+ ```jsx
22
+ import { MantineAdapterProvider } from "@intent-driven/adapter-mantine";
23
+ import { ProjectionRendererV2 } from "@intent-driven/renderer";
24
+
25
+ function App() {
26
+ return (
27
+ <MantineAdapterProvider>
28
+ <ProjectionRendererV2
29
+ artifact={artifact}
30
+ world={world}
31
+ exec={exec}
32
+ projectionId="booking_list"
33
+ />
34
+ </MantineAdapterProvider>
35
+ );
36
+ }
37
+ ```
38
+
39
+ ## Что экспортируется
40
+
41
+ | Export | Описание |
42
+ |--------|----------|
43
+ | `MantineAdapterProvider` | Провайдер, регистрирует адаптер в реестре renderer |
44
+ | `mantineAdapter` | Spec-объект адаптера (для ручной регистрации) |
45
+
46
+ ## Capabilities
47
+
48
+ ```js
49
+ capabilities: {
50
+ primitive: {
51
+ chart: { fallback: "svg" }, // SVG fallback, нет @ant-design/plots
52
+ statistic: false,
53
+ sparkline: false,
54
+ map: { fallback: "svg" },
55
+ },
56
+ shell: { modal: true, tabs: true },
57
+ button: { primary: true, secondary: true, danger: true, intent: true, overflow: true },
58
+ }
59
+ ```
60
+
61
+ ## Связь с IDF
62
+
63
+ Один из четырёх UI-адаптеров IDF. Выбор адаптера меняется через `PrefsPanel ⚙ → UI-kit` в рантайме — домен не меняется.
64
+
65
+ Подробнее об архитектуре адаптеров: [manifesto §17](https://github.com/ignatdubovskiy/idf/blob/main/docs/manifesto-v1.7.md).
66
+
67
+ ## Версии
68
+
69
+ [CHANGELOG.md](./CHANGELOG.md)
70
+
71
+ ## Лицензия
72
+
73
+ **MIT** (см. [LICENSE](./LICENSE)).
74
+
75
+ Адаптер транзитивно зависит от `@intent-driven/core` (через peer-dep `@intent-driven/renderer`),
76
+ который распространяется под **Business Source License 1.1**. Hosted SaaS
77
+ на базе ядра — коммерческая лицензия; некоммерческое и внутреннее
78
+ производственное использование — свободно. Change Date: 2030-04-15
79
+ (автопереход на Apache 2.0).
package/dist/index.cjs ADDED
@@ -0,0 +1,561 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/index.js
30
+ var index_exports = {};
31
+ __export(index_exports, {
32
+ MantineAdapterProvider: () => MantineAdapterProvider,
33
+ mantineAdapter: () => mantineAdapter
34
+ });
35
+ module.exports = __toCommonJS(index_exports);
36
+
37
+ // src/adapter.jsx
38
+ var import_core = require("@mantine/core");
39
+ var import_dates = require("@mantine/dates");
40
+ var import_renderer = require("@intent-driven/renderer");
41
+ var import_lucide_react = require("lucide-react");
42
+ var import_jsx_runtime = require("react/jsx-runtime");
43
+ var { humanLabel } = import_renderer.labels;
44
+ var EMOJI_TO_LUCIDE = {
45
+ "\u270E": import_lucide_react.Pencil,
46
+ "\u{1F5D1}": import_lucide_react.Trash2,
47
+ "\u2795": import_lucide_react.Plus,
48
+ "+": import_lucide_react.Plus,
49
+ "\u2713": import_lucide_react.Check,
50
+ "\u2715": import_lucide_react.X,
51
+ "\xD7": import_lucide_react.X,
52
+ "\u{1F4E4}": import_lucide_react.Send,
53
+ "\u{1F4CE}": import_lucide_react.Paperclip,
54
+ "\u{1F3A4}": import_lucide_react.Mic,
55
+ "\u{1F399}": import_lucide_react.Mic,
56
+ "\u{1F5BC}": import_lucide_react.Image,
57
+ "\u{1F3AC}": import_lucide_react.Video,
58
+ "\u{1F4CD}": import_lucide_react.MapPin,
59
+ "\u{1F4CC}": import_lucide_react.Pin,
60
+ "\u{1F5F3}": import_lucide_react.Vote,
61
+ "\u2197": import_lucide_react.CornerUpRight,
62
+ "\u2B50": import_lucide_react.Star,
63
+ "\u2606": import_lucide_react.BookmarkPlus,
64
+ "\u2398": import_lucide_react.Copy,
65
+ "\u{1F310}": import_lucide_react.Languages,
66
+ "\u{1F507}": import_lucide_react.BellOff,
67
+ "\u{1F514}": import_lucide_react.Bell,
68
+ "\u{1F4DE}": import_lucide_react.Phone,
69
+ "\u{1F4F9}": import_lucide_react.Video,
70
+ "\u{1F4F5}": import_lucide_react.PhoneOff,
71
+ "\u{1F50D}": import_lucide_react.Search,
72
+ "\u22EF": import_lucide_react.MoreHorizontal,
73
+ "\u2026": import_lucide_react.MoreHorizontal,
74
+ "\u21C5": import_lucide_react.ArrowUpDown,
75
+ "\u2699": import_lucide_react.Settings,
76
+ "\u{1F464}": import_lucide_react.Users,
77
+ "\u{1F465}": import_lucide_react.Users,
78
+ "\u{1F4E2}": import_lucide_react.Megaphone,
79
+ "\u2709": import_lucide_react.Send,
80
+ "\u2B06": import_lucide_react.ArrowUp,
81
+ "\u2B07": import_lucide_react.ArrowDown,
82
+ "\u{1F511}": import_lucide_react.Key,
83
+ "\u2190": import_lucide_react.LogOut,
84
+ "\u2192": import_lucide_react.LogOut,
85
+ "\u2139": import_lucide_react.Info,
86
+ "\u26A1": import_lucide_react.Zap,
87
+ "\u25CF": import_lucide_react.Eye,
88
+ "\u{1F4AC}": import_lucide_react.MessageCircle,
89
+ "\u{1F512}": import_lucide_react.Lock,
90
+ "\u{1F4A1}": import_lucide_react.Lightbulb,
91
+ "\u23F0": import_lucide_react.Clock,
92
+ "\u{1F504}": import_lucide_react.RotateCcw,
93
+ "\u25B6": import_lucide_react.Play,
94
+ "\u23F8": import_lucide_react.Pause,
95
+ "\u23F9": import_lucide_react.Square,
96
+ "\u{1F4BE}": import_lucide_react.Save,
97
+ "\u{1F517}": import_lucide_react.Link2,
98
+ "\u2702": import_lucide_react.Scissors,
99
+ "\u2725": import_lucide_react.Move,
100
+ "\u{1F6AB}": import_lucide_react.CircleSlash,
101
+ "\u26A0": import_lucide_react.AlertTriangle,
102
+ "\u{1F4E6}": import_lucide_react.BookmarkPlus,
103
+ "\u{1F60A}": import_lucide_react.Smile,
104
+ "\u{1F4CA}": import_lucide_react.Vote,
105
+ "\u{1F4C5}": import_lucide_react.Clock,
106
+ "\u{1F3B5}": import_lucide_react.Play,
107
+ "\u{1F389}": import_lucide_react.Star,
108
+ "\u{1F525}": import_lucide_react.Zap
109
+ };
110
+ function resolveLucide(emoji) {
111
+ return EMOJI_TO_LUCIDE[emoji] || null;
112
+ }
113
+ function MantineTextInput({ spec, value, onChange, error }) {
114
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
115
+ import_core.TextInput,
116
+ {
117
+ label: humanLabel(spec.name, spec.label),
118
+ value: value ?? "",
119
+ onChange: (e) => onChange(e.currentTarget.value),
120
+ placeholder: spec.placeholder,
121
+ required: spec.required,
122
+ error
123
+ }
124
+ );
125
+ }
126
+ function MantineEmail({ spec, value, onChange, error }) {
127
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
128
+ import_core.TextInput,
129
+ {
130
+ type: "email",
131
+ label: humanLabel(spec.name, spec.label),
132
+ value: value ?? "",
133
+ onChange: (e) => onChange(e.currentTarget.value),
134
+ placeholder: spec.placeholder || "name@example.com",
135
+ required: spec.required,
136
+ error
137
+ }
138
+ );
139
+ }
140
+ function MantineUrl({ spec, value, onChange, error }) {
141
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
142
+ import_core.TextInput,
143
+ {
144
+ type: "url",
145
+ label: humanLabel(spec.name, spec.label),
146
+ value: value ?? "",
147
+ onChange: (e) => onChange(e.currentTarget.value),
148
+ placeholder: spec.placeholder,
149
+ required: spec.required,
150
+ error
151
+ }
152
+ );
153
+ }
154
+ function MantineTel({ spec, value, onChange, error }) {
155
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
156
+ import_core.TextInput,
157
+ {
158
+ type: "tel",
159
+ label: humanLabel(spec.name, spec.label),
160
+ value: value ?? "",
161
+ onChange: (e) => onChange(e.currentTarget.value),
162
+ placeholder: spec.placeholder,
163
+ required: spec.required,
164
+ error
165
+ }
166
+ );
167
+ }
168
+ function MantineTextarea({ spec, value, onChange, error }) {
169
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
170
+ import_core.Textarea,
171
+ {
172
+ label: humanLabel(spec.name, spec.label),
173
+ value: value ?? "",
174
+ onChange: (e) => onChange(e.currentTarget.value),
175
+ placeholder: spec.placeholder,
176
+ required: spec.required,
177
+ error,
178
+ autosize: true,
179
+ minRows: 2,
180
+ maxRows: 6
181
+ }
182
+ );
183
+ }
184
+ function MantineNumber({ spec, value, onChange, error }) {
185
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
186
+ import_core.NumberInput,
187
+ {
188
+ label: humanLabel(spec.name, spec.label),
189
+ value: value === "" || value == null ? "" : value,
190
+ onChange: (v) => onChange(v),
191
+ placeholder: spec.placeholder,
192
+ required: spec.required,
193
+ error
194
+ }
195
+ );
196
+ }
197
+ function MantineDateTime({ spec, value, onChange, error }) {
198
+ const name = spec.name || "";
199
+ const label = humanLabel(name, spec.label);
200
+ const isTimeOnly = /time/i.test(name) && !/date/i.test(name);
201
+ if (isTimeOnly) {
202
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
203
+ import_dates.TimeInput,
204
+ {
205
+ label,
206
+ value: value ?? "",
207
+ onChange: (e) => onChange(e.currentTarget.value),
208
+ required: spec.required,
209
+ error
210
+ }
211
+ );
212
+ }
213
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
214
+ import_dates.DateInput,
215
+ {
216
+ label,
217
+ value: value ?? null,
218
+ onChange: (v) => onChange(v || ""),
219
+ placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0434\u0430\u0442\u0443",
220
+ required: spec.required,
221
+ error,
222
+ valueFormat: "DD.MM.YYYY",
223
+ clearable: true
224
+ }
225
+ );
226
+ }
227
+ function MantineSelect({ spec, value, onChange, error }) {
228
+ const data = (spec.options || []).map(
229
+ (o) => typeof o === "string" ? { value: o, label: o } : o
230
+ );
231
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
232
+ import_core.Select,
233
+ {
234
+ label: humanLabel(spec.name, spec.label),
235
+ data,
236
+ value: value ?? null,
237
+ onChange: (v) => onChange(v || ""),
238
+ placeholder: spec.placeholder || "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435\u2026",
239
+ required: spec.required,
240
+ error,
241
+ clearable: true
242
+ }
243
+ );
244
+ }
245
+ function normalizeIcon(icon) {
246
+ if (!icon) return void 0;
247
+ if (typeof icon === "string") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_renderer.Icon, { emoji: icon, size: 16 });
248
+ return icon;
249
+ }
250
+ function MantinePrimaryButton({ label, icon, onClick, disabled, title, size }) {
251
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
252
+ import_core.Button,
253
+ {
254
+ onClick,
255
+ disabled,
256
+ title,
257
+ leftSection: normalizeIcon(icon),
258
+ color: "indigo",
259
+ size: size || "sm",
260
+ children: label
261
+ }
262
+ );
263
+ }
264
+ function MantineSecondaryButton({ label, icon, onClick, disabled, title, size }) {
265
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
266
+ import_core.Button,
267
+ {
268
+ onClick,
269
+ disabled,
270
+ title,
271
+ leftSection: normalizeIcon(icon),
272
+ variant: "default",
273
+ size: size || "sm",
274
+ children: label
275
+ }
276
+ );
277
+ }
278
+ function MantineDangerButton({ label, icon, onClick, disabled, title, size }) {
279
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
280
+ import_core.Button,
281
+ {
282
+ onClick,
283
+ disabled,
284
+ title,
285
+ leftSection: normalizeIcon(icon),
286
+ color: "red",
287
+ size: size || "sm",
288
+ children: label
289
+ }
290
+ );
291
+ }
292
+ function MantineOverflowMenu({ items, triggerIcon, triggerLabel }) {
293
+ if (!items || items.length === 0) return null;
294
+ const grouped = groupOverflowItems(items);
295
+ const hasSections = grouped.length > 1;
296
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.Menu, { shadow: "md", width: 240, position: "bottom-end", withArrow: true, children: [
297
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Menu.Target, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
298
+ import_core.ActionIcon,
299
+ {
300
+ variant: "default",
301
+ size: "lg",
302
+ title: triggerLabel || "\u0415\u0449\u0451",
303
+ "aria-label": triggerLabel || "\u0415\u0449\u0451",
304
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_renderer.Icon, { emoji: triggerIcon || "\u22EF", size: 18 })
305
+ }
306
+ ) }),
307
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Menu.Dropdown, { style: { maxHeight: "60vh", overflowY: "auto" }, children: grouped.map((section, si) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
308
+ hasSections && si > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Menu.Divider, {}),
309
+ hasSections && section.label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Menu.Label, { children: section.label }),
310
+ section.items.map((item) => item.divider ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Menu.Divider, {}, item.key) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
311
+ import_core.Menu.Item,
312
+ {
313
+ leftSection: item.icon ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_renderer.Icon, { emoji: item.icon, size: 14 }) : void 0,
314
+ onClick: item.onClick,
315
+ children: item.label
316
+ },
317
+ item.key
318
+ ))
319
+ ] }, si)) })
320
+ ] });
321
+ }
322
+ function groupOverflowItems(items) {
323
+ if (items.length <= 8) return [{ label: null, items }];
324
+ const byIcon = /* @__PURE__ */ new Map();
325
+ const order = [];
326
+ for (const item of items) {
327
+ const key = item.icon || "__none__";
328
+ if (!byIcon.has(key)) {
329
+ byIcon.set(key, []);
330
+ order.push(key);
331
+ }
332
+ byIcon.get(key).push(item);
333
+ }
334
+ const sections = [];
335
+ const singles = [];
336
+ for (const key of order) {
337
+ const group = byIcon.get(key);
338
+ if (group.length >= 2) {
339
+ sections.push({ label: group[0].label?.split(" ")[0] || null, items: group });
340
+ } else {
341
+ singles.push(...group);
342
+ }
343
+ }
344
+ if (singles.length > 0) {
345
+ sections.push({ label: sections.length > 0 ? "\u0414\u0440\u0443\u0433\u043E\u0435" : null, items: singles });
346
+ }
347
+ return sections.length > 0 ? sections : [{ label: null, items }];
348
+ }
349
+ function MantineIntentButton({ spec, onClick, disabled }) {
350
+ const label = spec.label || spec.intentId;
351
+ const icon = spec.icon;
352
+ const LABEL_MAX = 14;
353
+ const showLabel = label.length <= LABEL_MAX;
354
+ const isDanger = spec.variant === "danger" || spec.irreversibility === "high";
355
+ const isPrimary = spec.variant === "primary";
356
+ const color = isDanger ? "red" : isPrimary ? "indigo" : void 0;
357
+ const variant = isDanger || isPrimary ? "light" : "default";
358
+ if (!showLabel || !label) {
359
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
360
+ import_core.ActionIcon,
361
+ {
362
+ onClick,
363
+ disabled,
364
+ title: label,
365
+ size: "lg",
366
+ variant,
367
+ color,
368
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_renderer.Icon, { emoji: icon, size: 18 })
369
+ }
370
+ );
371
+ }
372
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
373
+ import_core.Button,
374
+ {
375
+ onClick,
376
+ disabled,
377
+ title: label,
378
+ size: "sm",
379
+ variant,
380
+ color,
381
+ leftSection: icon ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_renderer.Icon, { emoji: icon, size: 16 }) : void 0,
382
+ children: label
383
+ }
384
+ );
385
+ }
386
+ function MantineHeading({ level = 2, children }) {
387
+ const order = Math.min(6, Math.max(1, level));
388
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Title, { order, children });
389
+ }
390
+ var TEXT_PRESETS = {
391
+ body: { size: "sm" },
392
+ secondary: { size: "xs", c: "dimmed" },
393
+ muted: { size: "xs", c: "dimmed" },
394
+ heading: { fw: 700, size: "md" },
395
+ accent: { fw: 600, c: "indigo" },
396
+ danger: { c: "red" },
397
+ success: { c: "green" }
398
+ };
399
+ function MantineText({ children, preset, style }) {
400
+ const props = preset && TEXT_PRESETS[preset] || {};
401
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Text, { ...props, style, children });
402
+ }
403
+ function MantineBadge({ children, color }) {
404
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Badge, { color: color || "indigo", variant: "light", size: "sm", radius: "sm", children });
405
+ }
406
+ function MantineAvatar({ src, name, size = 40 }) {
407
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
408
+ import_core.Avatar,
409
+ {
410
+ src: src || void 0,
411
+ name: name || "?",
412
+ color: "initials",
413
+ size,
414
+ radius: "xl",
415
+ children: !src && name ? name[0]?.toUpperCase() : null
416
+ }
417
+ );
418
+ }
419
+ function MantinePaper({ children, padding, withBorder, style }) {
420
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
421
+ import_core.Paper,
422
+ {
423
+ p: padding ?? "md",
424
+ withBorder: withBorder !== false,
425
+ radius: "md",
426
+ style,
427
+ children
428
+ }
429
+ );
430
+ }
431
+ function MantineModalShell({ onClose, children, title }) {
432
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
433
+ import_core.Modal,
434
+ {
435
+ opened: true,
436
+ onClose,
437
+ title,
438
+ centered: true,
439
+ size: "md",
440
+ padding: "lg",
441
+ radius: "md",
442
+ overlayProps: { backgroundOpacity: 0.55, blur: 2 },
443
+ children
444
+ }
445
+ );
446
+ }
447
+ function MantineTabs({ items, active, onSelect, extra }) {
448
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: {
449
+ display: "flex",
450
+ alignItems: "center",
451
+ borderBottom: "1px solid var(--mantine-color-default-border)",
452
+ background: "var(--mantine-color-default)"
453
+ }, children: [
454
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
455
+ import_core.Tabs,
456
+ {
457
+ value: active || null,
458
+ onChange: (v) => v && onSelect && onSelect(v),
459
+ variant: "default",
460
+ style: { flex: 1 },
461
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Tabs.List, { style: { border: "none" }, children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Tabs.Tab, { value: item.value, children: item.label }, item.value)) })
462
+ }
463
+ ),
464
+ extra && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { marginRight: 8 }, children: extra })
465
+ ] });
466
+ }
467
+ var mantineAdapter = {
468
+ name: "mantine",
469
+ // §26.4 + §26.6: capability surface. Mantine-адаптер не реализует
470
+ // chart/sparkline/statistic напрямую — primitive.jsx рендерит SVG-
471
+ // fallback, капабилити явно документируют.
472
+ capabilities: {
473
+ primitive: {
474
+ chart: { chartTypes: ["line", "pie"], fallback: "svg" },
475
+ sparkline: { fallback: "svg" },
476
+ statistic: false,
477
+ // нет — используется chart-fallback или text-primitive
478
+ heading: true,
479
+ text: true,
480
+ badge: true,
481
+ avatar: true,
482
+ paper: true
483
+ },
484
+ shell: { modal: true, tabs: true },
485
+ button: { primary: true, secondary: true, danger: true, intent: true, overflow: true }
486
+ },
487
+ parameter: {
488
+ text: MantineTextInput,
489
+ textarea: MantineTextarea,
490
+ email: MantineEmail,
491
+ url: MantineUrl,
492
+ tel: MantineTel,
493
+ number: MantineNumber,
494
+ datetime: MantineDateTime,
495
+ select: MantineSelect
496
+ // image и file оставляем на built-in — у них специфичная логика
497
+ // FileReader→data URL (ImageControl.jsx). Адаптируем позже через
498
+ // Mantine FileButton / Dropzone.
499
+ },
500
+ button: {
501
+ primary: MantinePrimaryButton,
502
+ secondary: MantineSecondaryButton,
503
+ danger: MantineDangerButton,
504
+ intent: MantineIntentButton,
505
+ overflow: MantineOverflowMenu
506
+ },
507
+ shell: {
508
+ modal: MantineModalShell,
509
+ tabs: MantineTabs
510
+ },
511
+ primitive: {
512
+ heading: MantineHeading,
513
+ text: MantineText,
514
+ badge: MantineBadge,
515
+ avatar: MantineAvatar,
516
+ paper: MantinePaper
517
+ },
518
+ icon: {
519
+ // resolve — функция (не компонент), используется <Icon> для lookup.
520
+ // Принимает emoji-строку, возвращает React-компонент или null.
521
+ resolve: resolveLucide
522
+ }
523
+ };
524
+
525
+ // src/provider.jsx
526
+ var import_react = __toESM(require("react"), 1);
527
+ var import_core2 = require("@mantine/core");
528
+ var import_dates2 = require("@mantine/dates");
529
+ var import_renderer2 = require("@intent-driven/renderer");
530
+ var import_styles = require("@mantine/core/styles.css");
531
+ var import_styles2 = require("@mantine/dates/styles.css");
532
+ var import_jsx_runtime2 = require("react/jsx-runtime");
533
+ function MantineAdapterProvider({
534
+ children,
535
+ colorSchemeManager,
536
+ theme = { primaryColor: "indigo" },
537
+ datesSettings = { locale: "ru", firstDayOfWeek: 1, weekendDays: [0, 6] },
538
+ defaultColorScheme = "light"
539
+ }) {
540
+ import_react.default.useEffect(() => {
541
+ (0, import_renderer2.registerUIAdapter)(mantineAdapter);
542
+ }, []);
543
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
544
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core2.ColorSchemeScript, { defaultColorScheme }),
545
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
546
+ import_core2.MantineProvider,
547
+ {
548
+ defaultColorScheme,
549
+ colorSchemeManager: colorSchemeManager ?? (0, import_core2.localStorageColorSchemeManager)({ key: "idf_theme" }),
550
+ theme,
551
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_dates2.DatesProvider, { settings: datesSettings, children })
552
+ }
553
+ )
554
+ ] });
555
+ }
556
+ // Annotate the CommonJS export names for ESM import in node:
557
+ 0 && (module.exports = {
558
+ MantineAdapterProvider,
559
+ mantineAdapter
560
+ });
561
+ //# sourceMappingURL=index.cjs.map