@frontmcp/ui 0.12.1 → 1.0.0-beta.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.
Files changed (310) hide show
  1. package/README.md +279 -72
  2. package/bridge/adapters/claude.adapter.d.ts.map +1 -1
  3. package/bridge/adapters/gemini.adapter.d.ts.map +1 -1
  4. package/bridge/index.js +2 -36
  5. package/components/Alert/Alert.d.ts +11 -0
  6. package/components/Alert/Alert.d.ts.map +1 -0
  7. package/components/Alert/index.d.ts +4 -0
  8. package/components/Alert/index.d.ts.map +1 -0
  9. package/components/Alert/index.js +61 -0
  10. package/components/Avatar/Avatar.d.ts +10 -0
  11. package/components/Avatar/Avatar.d.ts.map +1 -0
  12. package/components/Avatar/index.d.ts +4 -0
  13. package/components/Avatar/index.d.ts.map +1 -0
  14. package/components/Avatar/index.js +43 -0
  15. package/components/Badge/Badge.d.ts +13 -0
  16. package/components/Badge/Badge.d.ts.map +1 -0
  17. package/components/Badge/index.d.ts +4 -0
  18. package/components/Badge/index.d.ts.map +1 -0
  19. package/{render → components/Badge}/index.js +54 -42
  20. package/components/Button/Button.d.ts +16 -0
  21. package/components/Button/Button.d.ts.map +1 -0
  22. package/components/Button/index.d.ts +4 -0
  23. package/components/Button/index.d.ts.map +1 -0
  24. package/components/Button/index.js +91 -0
  25. package/components/Card/Card.d.ts +25 -0
  26. package/components/Card/Card.d.ts.map +1 -0
  27. package/components/Card/index.d.ts +4 -0
  28. package/components/Card/index.d.ts.map +1 -0
  29. package/components/Card/index.js +110 -0
  30. package/components/List/List.d.ts +15 -0
  31. package/components/List/List.d.ts.map +1 -0
  32. package/components/List/index.d.ts +4 -0
  33. package/components/List/index.d.ts.map +1 -0
  34. package/components/List/index.js +58 -0
  35. package/components/Loader/Loader.d.ts +28 -0
  36. package/components/Loader/Loader.d.ts.map +1 -0
  37. package/components/Loader/LoaderContext.d.ts +20 -0
  38. package/components/Loader/LoaderContext.d.ts.map +1 -0
  39. package/components/Loader/index.d.ts +6 -0
  40. package/components/Loader/index.d.ts.map +1 -0
  41. package/components/Loader/index.js +174 -0
  42. package/components/Modal/Modal.d.ts +22 -0
  43. package/components/Modal/Modal.d.ts.map +1 -0
  44. package/components/Modal/index.d.ts +4 -0
  45. package/components/Modal/index.d.ts.map +1 -0
  46. package/components/Modal/index.js +80 -0
  47. package/components/Select/Select.d.ts +21 -0
  48. package/components/Select/Select.d.ts.map +1 -0
  49. package/components/Select/index.d.ts +4 -0
  50. package/components/Select/index.d.ts.map +1 -0
  51. package/components/Select/index.js +78 -0
  52. package/components/Table/Table.d.ts +15 -0
  53. package/components/Table/Table.d.ts.map +1 -0
  54. package/components/Table/index.d.ts +4 -0
  55. package/components/Table/index.d.ts.map +1 -0
  56. package/components/Table/index.js +70 -0
  57. package/components/TextField/TextField.d.ts +19 -0
  58. package/components/TextField/TextField.d.ts.map +1 -0
  59. package/components/TextField/index.d.ts +4 -0
  60. package/components/TextField/index.d.ts.map +1 -0
  61. package/components/TextField/index.js +77 -0
  62. package/components/index.d.ts +22 -28
  63. package/components/index.d.ts.map +1 -1
  64. package/components/index.js +523 -2521
  65. package/esm/bridge/index.mjs +2 -6
  66. package/esm/components/Alert/index.mjs +28 -0
  67. package/esm/components/Avatar/index.mjs +10 -0
  68. package/esm/components/Badge/index.mjs +56 -0
  69. package/esm/components/Button/index.mjs +58 -0
  70. package/esm/components/Card/index.mjs +77 -0
  71. package/esm/components/List/index.mjs +25 -0
  72. package/esm/components/Loader/index.mjs +141 -0
  73. package/esm/components/Modal/index.mjs +47 -0
  74. package/esm/components/Select/index.mjs +45 -0
  75. package/esm/components/Table/index.mjs +37 -0
  76. package/esm/components/TextField/index.mjs +44 -0
  77. package/esm/components/index.mjs +513 -2415
  78. package/esm/index.mjs +62 -4652
  79. package/esm/package.json +372 -16
  80. package/esm/react/index.mjs +2 -285
  81. package/esm/renderer/charts/index.mjs +336 -0
  82. package/esm/renderer/common/index.mjs +135 -0
  83. package/esm/renderer/csv/index.mjs +193 -0
  84. package/esm/renderer/flow/index.mjs +259 -0
  85. package/esm/renderer/html/index.mjs +99 -0
  86. package/esm/renderer/image/index.mjs +125 -0
  87. package/esm/renderer/index.mjs +2173 -0
  88. package/esm/renderer/maps/index.mjs +217 -0
  89. package/esm/renderer/math/index.mjs +229 -0
  90. package/esm/renderer/mdx/index.mjs +261 -0
  91. package/esm/renderer/media/index.mjs +235 -0
  92. package/esm/renderer/mermaid/index.mjs +220 -0
  93. package/esm/renderer/pdf/index.mjs +229 -0
  94. package/esm/renderer/react/index.mjs +230 -0
  95. package/esm/runtime/index.mjs +194 -0
  96. package/esm/theme/index.mjs +93 -0
  97. package/index.d.ts +10 -18
  98. package/index.d.ts.map +1 -1
  99. package/index.js +63 -4806
  100. package/package.json +372 -16
  101. package/react/index.d.ts +8 -54
  102. package/react/index.d.ts.map +1 -1
  103. package/react/index.js +2 -295
  104. package/renderer/auto-detect.d.ts +39 -0
  105. package/renderer/auto-detect.d.ts.map +1 -0
  106. package/renderer/charts/index.d.ts +22 -0
  107. package/renderer/charts/index.d.ts.map +1 -0
  108. package/renderer/charts/index.js +367 -0
  109. package/renderer/common/index.d.ts +5 -0
  110. package/renderer/common/index.d.ts.map +1 -0
  111. package/renderer/common/index.js +158 -0
  112. package/renderer/common/inject-stylesheet.d.ts +9 -0
  113. package/renderer/common/inject-stylesheet.d.ts.map +1 -0
  114. package/renderer/common/lazy-import.d.ts +85 -0
  115. package/renderer/common/lazy-import.d.ts.map +1 -0
  116. package/renderer/common/use-lazy-module.d.ts +13 -0
  117. package/renderer/common/use-lazy-module.d.ts.map +1 -0
  118. package/renderer/common/use-renderer-theme.d.ts +35 -0
  119. package/renderer/common/use-renderer-theme.d.ts.map +1 -0
  120. package/renderer/csv/index.d.ts +12 -0
  121. package/renderer/csv/index.d.ts.map +1 -0
  122. package/renderer/csv/index.js +224 -0
  123. package/renderer/flow/index.d.ts +40 -0
  124. package/renderer/flow/index.d.ts.map +1 -0
  125. package/renderer/flow/index.js +290 -0
  126. package/renderer/html/index.d.ts +12 -0
  127. package/renderer/html/index.d.ts.map +1 -0
  128. package/renderer/html/index.js +130 -0
  129. package/renderer/image/index.d.ts +11 -0
  130. package/renderer/image/index.d.ts.map +1 -0
  131. package/renderer/image/index.js +156 -0
  132. package/renderer/index.d.ts +32 -0
  133. package/renderer/index.d.ts.map +1 -0
  134. package/renderer/index.js +2206 -0
  135. package/renderer/maps/index.d.ts +27 -0
  136. package/renderer/maps/index.d.ts.map +1 -0
  137. package/renderer/maps/index.js +248 -0
  138. package/renderer/math/index.d.ts +11 -0
  139. package/renderer/math/index.d.ts.map +1 -0
  140. package/renderer/math/index.js +260 -0
  141. package/renderer/mdx/index.d.ts +10 -0
  142. package/renderer/mdx/index.d.ts.map +1 -0
  143. package/renderer/mdx/index.js +292 -0
  144. package/renderer/media/index.d.ts +20 -0
  145. package/renderer/media/index.d.ts.map +1 -0
  146. package/renderer/media/index.js +266 -0
  147. package/renderer/mermaid/index.d.ts +11 -0
  148. package/renderer/mermaid/index.d.ts.map +1 -0
  149. package/renderer/mermaid/index.js +251 -0
  150. package/renderer/pdf/index.d.ts +10 -0
  151. package/renderer/pdf/index.d.ts.map +1 -0
  152. package/renderer/pdf/index.js +260 -0
  153. package/renderer/react/index.d.ts +45 -0
  154. package/renderer/react/index.d.ts.map +1 -0
  155. package/renderer/react/index.js +261 -0
  156. package/renderer/types.d.ts +24 -0
  157. package/renderer/types.d.ts.map +1 -0
  158. package/runtime/babel-runtime.d.ts +70 -0
  159. package/runtime/babel-runtime.d.ts.map +1 -0
  160. package/runtime/content-detector.d.ts +43 -0
  161. package/runtime/content-detector.d.ts.map +1 -0
  162. package/runtime/index.d.ts +10 -0
  163. package/runtime/index.d.ts.map +1 -0
  164. package/runtime/index.js +217 -0
  165. package/theme/FrontMcpThemeProvider.d.ts +4 -0
  166. package/theme/FrontMcpThemeProvider.d.ts.map +1 -0
  167. package/theme/create-theme.d.ts +9 -0
  168. package/theme/create-theme.d.ts.map +1 -0
  169. package/theme/index.d.ts +5 -0
  170. package/theme/index.d.ts.map +1 -0
  171. package/theme/index.js +126 -0
  172. package/theme/types.d.ts +28 -0
  173. package/theme/types.d.ts.map +1 -0
  174. package/theme/use-theme.d.ts +3 -0
  175. package/theme/use-theme.d.ts.map +1 -0
  176. package/bundler/browser-components.d.ts +0 -42
  177. package/bundler/browser-components.d.ts.map +0 -1
  178. package/bundler/bundler.d.ts +0 -282
  179. package/bundler/bundler.d.ts.map +0 -1
  180. package/bundler/index.d.ts +0 -43
  181. package/bundler/index.d.ts.map +0 -1
  182. package/bundler/index.js +0 -3168
  183. package/bundler/types.d.ts +0 -883
  184. package/bundler/types.d.ts.map +0 -1
  185. package/components/alert.d.ts +0 -83
  186. package/components/alert.d.ts.map +0 -1
  187. package/components/alert.schema.d.ts +0 -98
  188. package/components/alert.schema.d.ts.map +0 -1
  189. package/components/avatar.d.ts +0 -77
  190. package/components/avatar.d.ts.map +0 -1
  191. package/components/avatar.schema.d.ts +0 -170
  192. package/components/avatar.schema.d.ts.map +0 -1
  193. package/components/badge.d.ts +0 -78
  194. package/components/badge.d.ts.map +0 -1
  195. package/components/badge.schema.d.ts +0 -91
  196. package/components/badge.schema.d.ts.map +0 -1
  197. package/components/button.d.ts +0 -100
  198. package/components/button.d.ts.map +0 -1
  199. package/components/button.schema.d.ts +0 -120
  200. package/components/button.schema.d.ts.map +0 -1
  201. package/components/card.d.ts +0 -76
  202. package/components/card.d.ts.map +0 -1
  203. package/components/card.schema.d.ts +0 -93
  204. package/components/card.schema.d.ts.map +0 -1
  205. package/components/form.d.ts +0 -227
  206. package/components/form.d.ts.map +0 -1
  207. package/components/form.schema.d.ts +0 -365
  208. package/components/form.schema.d.ts.map +0 -1
  209. package/components/list.d.ts +0 -121
  210. package/components/list.d.ts.map +0 -1
  211. package/components/list.schema.d.ts +0 -129
  212. package/components/list.schema.d.ts.map +0 -1
  213. package/components/modal.d.ts +0 -100
  214. package/components/modal.d.ts.map +0 -1
  215. package/components/modal.schema.d.ts +0 -151
  216. package/components/modal.schema.d.ts.map +0 -1
  217. package/components/table.d.ts +0 -91
  218. package/components/table.d.ts.map +0 -1
  219. package/components/table.schema.d.ts +0 -123
  220. package/components/table.schema.d.ts.map +0 -1
  221. package/esm/bundler/index.mjs +0 -3136
  222. package/esm/layouts/index.mjs +0 -409
  223. package/esm/render/index.mjs +0 -45
  224. package/esm/renderers/index.mjs +0 -621
  225. package/esm/universal/index.mjs +0 -1946
  226. package/esm/web-components/index.mjs +0 -2023
  227. package/layouts/base.d.ts +0 -86
  228. package/layouts/base.d.ts.map +0 -1
  229. package/layouts/index.d.ts +0 -8
  230. package/layouts/index.d.ts.map +0 -1
  231. package/layouts/index.js +0 -437
  232. package/layouts/presets.d.ts +0 -134
  233. package/layouts/presets.d.ts.map +0 -1
  234. package/react/Alert.d.ts +0 -101
  235. package/react/Alert.d.ts.map +0 -1
  236. package/react/Badge.d.ts +0 -100
  237. package/react/Badge.d.ts.map +0 -1
  238. package/react/Button.d.ts +0 -108
  239. package/react/Button.d.ts.map +0 -1
  240. package/react/Card.d.ts +0 -103
  241. package/react/Card.d.ts.map +0 -1
  242. package/react/types.d.ts +0 -105
  243. package/react/types.d.ts.map +0 -1
  244. package/render/index.d.ts +0 -8
  245. package/render/index.d.ts.map +0 -1
  246. package/render/prerender.d.ts +0 -57
  247. package/render/prerender.d.ts.map +0 -1
  248. package/renderers/index.d.ts +0 -26
  249. package/renderers/index.d.ts.map +0 -1
  250. package/renderers/index.js +0 -666
  251. package/renderers/mdx.renderer.d.ts +0 -99
  252. package/renderers/mdx.renderer.d.ts.map +0 -1
  253. package/renderers/react.adapter.d.ts +0 -70
  254. package/renderers/react.adapter.d.ts.map +0 -1
  255. package/renderers/react.renderer.d.ts +0 -105
  256. package/renderers/react.renderer.d.ts.map +0 -1
  257. package/renderers/transpiler.d.ts +0 -49
  258. package/renderers/transpiler.d.ts.map +0 -1
  259. package/universal/UniversalApp.d.ts +0 -108
  260. package/universal/UniversalApp.d.ts.map +0 -1
  261. package/universal/cached-runtime.d.ts +0 -139
  262. package/universal/cached-runtime.d.ts.map +0 -1
  263. package/universal/context.d.ts +0 -122
  264. package/universal/context.d.ts.map +0 -1
  265. package/universal/index.d.ts +0 -57
  266. package/universal/index.d.ts.map +0 -1
  267. package/universal/index.js +0 -2032
  268. package/universal/renderers/html.renderer.d.ts +0 -36
  269. package/universal/renderers/html.renderer.d.ts.map +0 -1
  270. package/universal/renderers/index.d.ts +0 -112
  271. package/universal/renderers/index.d.ts.map +0 -1
  272. package/universal/renderers/markdown.renderer.d.ts +0 -33
  273. package/universal/renderers/markdown.renderer.d.ts.map +0 -1
  274. package/universal/renderers/mdx.renderer.d.ts +0 -38
  275. package/universal/renderers/mdx.renderer.d.ts.map +0 -1
  276. package/universal/renderers/react.renderer.d.ts +0 -46
  277. package/universal/renderers/react.renderer.d.ts.map +0 -1
  278. package/universal/runtime-builder.d.ts +0 -33
  279. package/universal/runtime-builder.d.ts.map +0 -1
  280. package/universal/store.d.ts +0 -135
  281. package/universal/store.d.ts.map +0 -1
  282. package/universal/types.d.ts +0 -199
  283. package/universal/types.d.ts.map +0 -1
  284. package/web-components/core/attribute-parser.d.ts +0 -82
  285. package/web-components/core/attribute-parser.d.ts.map +0 -1
  286. package/web-components/core/base-element.d.ts +0 -197
  287. package/web-components/core/base-element.d.ts.map +0 -1
  288. package/web-components/core/index.d.ts +0 -9
  289. package/web-components/core/index.d.ts.map +0 -1
  290. package/web-components/elements/fmcp-alert.d.ts +0 -46
  291. package/web-components/elements/fmcp-alert.d.ts.map +0 -1
  292. package/web-components/elements/fmcp-badge.d.ts +0 -47
  293. package/web-components/elements/fmcp-badge.d.ts.map +0 -1
  294. package/web-components/elements/fmcp-button.d.ts +0 -117
  295. package/web-components/elements/fmcp-button.d.ts.map +0 -1
  296. package/web-components/elements/fmcp-card.d.ts +0 -53
  297. package/web-components/elements/fmcp-card.d.ts.map +0 -1
  298. package/web-components/elements/fmcp-input.d.ts +0 -96
  299. package/web-components/elements/fmcp-input.d.ts.map +0 -1
  300. package/web-components/elements/fmcp-select.d.ts +0 -100
  301. package/web-components/elements/fmcp-select.d.ts.map +0 -1
  302. package/web-components/elements/index.d.ts +0 -13
  303. package/web-components/elements/index.d.ts.map +0 -1
  304. package/web-components/index.d.ts +0 -49
  305. package/web-components/index.d.ts.map +0 -1
  306. package/web-components/index.js +0 -2058
  307. package/web-components/register.d.ts +0 -57
  308. package/web-components/register.d.ts.map +0 -1
  309. package/web-components/types.d.ts +0 -122
  310. package/web-components/types.d.ts.map +0 -1
@@ -1,2449 +1,547 @@
1
- // libs/ui/src/components/button.schema.ts
2
- import { z } from "zod";
3
- var ButtonVariantSchema = z.enum(["primary", "secondary", "outline", "ghost", "danger", "success", "link"]);
4
- var ButtonSizeSchema = z.enum(["xs", "sm", "md", "lg", "xl"]);
5
- var ButtonOptionsSchema = z.object({
6
- /** Button variant */
7
- variant: ButtonVariantSchema.optional(),
8
- /** Button size */
9
- size: ButtonSizeSchema.optional(),
10
- /** Button type attribute */
11
- type: z.enum(["button", "submit", "reset"]).optional(),
12
- /** Disabled state */
13
- disabled: z.boolean().optional(),
14
- /** Loading state */
15
- loading: z.boolean().optional(),
16
- /** Full width */
17
- fullWidth: z.boolean().optional(),
18
- /** Icon before text (HTML string) */
19
- iconBefore: z.string().optional(),
20
- /** Icon after text (HTML string) */
21
- iconAfter: z.string().optional(),
22
- /** Icon only (no text) */
23
- iconOnly: z.boolean().optional(),
24
- /** Additional CSS classes */
25
- className: z.string().optional(),
26
- /** Button ID */
27
- id: z.string().optional(),
28
- /** Name attribute */
29
- name: z.string().optional(),
30
- /** Value attribute */
31
- value: z.string().optional(),
32
- /** Click handler (URL for links) */
33
- href: z.string().optional(),
34
- /** Open in new tab */
35
- target: z.enum(["_blank", "_self"]).optional(),
36
- /** Data attributes */
37
- data: z.record(z.string(), z.string()).optional(),
38
- /** ARIA label */
39
- ariaLabel: z.string().optional()
40
- }).strict();
41
- var ButtonGroupOptionsSchema = z.object({
42
- /** Attach buttons visually */
43
- attached: z.boolean().optional(),
44
- /** Direction */
45
- direction: z.enum(["horizontal", "vertical"]).optional(),
46
- /** Gap between buttons */
47
- gap: z.enum(["sm", "md", "lg"]).optional(),
48
- /** Additional CSS classes */
49
- className: z.string().optional()
50
- }).strict();
51
-
52
- // libs/ui/src/components/card.schema.ts
53
- import { z as z2 } from "zod";
54
- var CardVariantSchema = z2.enum(["default", "outlined", "elevated", "filled", "ghost"]);
55
- var CardSizeSchema = z2.enum(["sm", "md", "lg"]);
56
- var CardOptionsSchema = z2.object({
57
- /** Card variant */
58
- variant: CardVariantSchema.optional(),
59
- /** Card size (padding) */
60
- size: CardSizeSchema.optional(),
61
- /** Card title */
62
- title: z2.string().optional(),
63
- /** Card subtitle/description */
64
- subtitle: z2.string().optional(),
65
- /** Header actions (HTML string) */
66
- headerActions: z2.string().optional(),
67
- /** Footer content (HTML string) */
68
- footer: z2.string().optional(),
69
- /** Additional CSS classes */
70
- className: z2.string().optional(),
71
- /** Card ID */
72
- id: z2.string().optional(),
73
- /** Data attributes */
74
- data: z2.record(z2.string(), z2.string()).optional(),
75
- /** Clickable card (adds hover effects) */
76
- clickable: z2.boolean().optional(),
77
- /** Click handler URL */
78
- href: z2.string().optional()
79
- }).strict();
80
- var CardGroupOptionsSchema = z2.object({
81
- /** Direction */
82
- direction: z2.enum(["horizontal", "vertical"]).optional(),
83
- /** Gap between cards */
84
- gap: z2.enum(["sm", "md", "lg"]).optional(),
85
- /** Additional CSS classes */
86
- className: z2.string().optional()
87
- }).strict();
88
-
89
- // libs/ui/src/components/badge.schema.ts
90
- import { z as z3 } from "zod";
91
- var BadgeVariantSchema = z3.enum([
92
- "default",
93
- "primary",
94
- "secondary",
95
- "success",
96
- "warning",
97
- "danger",
98
- "info",
99
- "outline"
100
- ]);
101
- var BadgeSizeSchema = z3.enum(["sm", "md", "lg"]);
102
- var BadgeOptionsSchema = z3.object({
103
- /** Badge variant */
104
- variant: BadgeVariantSchema.optional(),
105
- /** Badge size */
106
- size: BadgeSizeSchema.optional(),
107
- /** Rounded pill style */
108
- pill: z3.boolean().optional(),
109
- /** Icon before text (HTML string) */
110
- icon: z3.string().optional(),
111
- /** Dot indicator (no text) */
112
- dot: z3.boolean().optional(),
113
- /** Additional CSS classes */
114
- className: z3.string().optional(),
115
- /** Removable badge */
116
- removable: z3.boolean().optional()
117
- }).strict();
118
- var BadgeGroupOptionsSchema = z3.object({
119
- /** Gap between badges */
120
- gap: z3.enum(["sm", "md", "lg"]).optional(),
121
- /** Additional CSS classes */
122
- className: z3.string().optional()
123
- }).strict();
124
-
125
- // libs/ui/src/components/alert.schema.ts
126
- import { z as z4 } from "zod";
127
- var AlertVariantSchema = z4.enum(["info", "success", "warning", "danger", "neutral"]);
128
- var AlertOptionsSchema = z4.object({
129
- /** Alert variant */
130
- variant: AlertVariantSchema.optional(),
131
- /** Alert title */
132
- title: z4.string().optional(),
133
- /** Show icon */
134
- showIcon: z4.boolean().optional(),
135
- /** Custom icon (HTML string, overrides default) */
136
- icon: z4.string().optional(),
137
- /** Dismissible alert */
138
- dismissible: z4.boolean().optional(),
139
- /** Additional CSS classes */
140
- className: z4.string().optional(),
141
- /** Alert ID */
142
- id: z4.string().optional(),
143
- /** Actions (HTML string for buttons) */
144
- actions: z4.string().optional()
145
- }).strict();
146
- var ToastPositionSchema = z4.enum([
147
- "top-right",
148
- "top-left",
149
- "bottom-right",
150
- "bottom-left",
151
- "top-center",
152
- "bottom-center"
153
- ]);
154
- var ToastOptionsSchema = z4.object({
155
- /** Toast variant */
156
- variant: AlertVariantSchema.optional(),
157
- /** Toast title */
158
- title: z4.string().optional(),
159
- /** Duration in ms (0 = no auto-dismiss) */
160
- duration: z4.number().min(0).optional(),
161
- /** Position */
162
- position: ToastPositionSchema.optional(),
163
- /** Toast ID */
164
- id: z4.string().optional()
165
- }).strict();
166
-
167
- // libs/ui/src/components/avatar.schema.ts
168
- import { z as z5 } from "zod";
169
- var AvatarSizeSchema = z5.enum(["xs", "sm", "md", "lg", "xl", "2xl"]);
170
- var AvatarShapeSchema = z5.enum(["circle", "square", "rounded"]);
171
- var AvatarStatusSchema = z5.enum(["online", "offline", "busy", "away", "none"]);
172
- var AvatarOptionsSchema = z5.object({
173
- /** Image source URL */
174
- src: z5.string().optional(),
175
- /** Alt text / name (required) */
176
- alt: z5.string(),
177
- /** Avatar size */
178
- size: AvatarSizeSchema.optional(),
179
- /** Avatar shape */
180
- shape: AvatarShapeSchema.optional(),
181
- /** Status indicator */
182
- status: AvatarStatusSchema.optional(),
183
- /** Additional CSS classes */
184
- className: z5.string().optional(),
185
- /** Click handler URL */
186
- href: z5.string().optional(),
187
- /** Custom initials (overrides auto-generation) */
188
- initials: z5.string().optional(),
189
- /** Background color for initials (CSS color) */
190
- bgColor: z5.string().optional()
191
- }).strict();
192
- var AvatarSpacingSchema = z5.enum(["tight", "normal", "loose"]);
193
- var AvatarGroupOptionsSchema = z5.object({
194
- /** Maximum visible avatars */
195
- max: z5.number().min(1).optional(),
196
- /** Avatar size */
197
- size: AvatarSizeSchema.optional(),
198
- /** Overlap amount */
199
- spacing: AvatarSpacingSchema.optional(),
200
- /** Additional CSS classes */
201
- className: z5.string().optional()
202
- }).strict();
203
- var AvatarWithTextOptionsSchema = AvatarOptionsSchema.extend({
204
- /** Primary text (name) */
205
- name: z5.string(),
206
- /** Secondary text (email, role, etc.) */
207
- subtitle: z5.string().optional(),
208
- /** Text alignment */
209
- align: z5.enum(["left", "right"]).optional()
210
- }).strict();
211
-
212
- // libs/ui/src/components/modal.schema.ts
213
- import { z as z6 } from "zod";
214
- var ModalSizeSchema = z6.enum(["sm", "md", "lg", "xl", "full"]);
215
- var ModalOptionsSchema = z6.object({
216
- /** Modal ID (required) */
217
- id: z6.string(),
218
- /** Modal title */
219
- title: z6.string().optional(),
220
- /** Modal size */
221
- size: ModalSizeSchema.optional(),
222
- /** Show close button */
223
- showClose: z6.boolean().optional(),
224
- /** Close on backdrop click */
225
- closeOnBackdrop: z6.boolean().optional(),
226
- /** Close on escape key */
227
- closeOnEscape: z6.boolean().optional(),
228
- /** Footer content (HTML string) */
229
- footer: z6.string().optional(),
230
- /** Additional CSS classes for modal */
231
- className: z6.string().optional(),
232
- /** Initially visible */
233
- open: z6.boolean().optional()
234
- }).strict();
235
- var ConfirmModalVariantSchema = z6.enum(["info", "warning", "danger"]);
236
- var ConfirmModalOptionsSchema = z6.object({
237
- /** Modal ID (required) */
238
- id: z6.string(),
239
- /** Confirm message */
240
- message: z6.string(),
241
- /** Title */
242
- title: z6.string().optional(),
243
- /** Variant/severity */
244
- variant: ConfirmModalVariantSchema.optional(),
245
- /** Confirm button text */
246
- confirmText: z6.string().optional(),
247
- /** Cancel button text */
248
- cancelText: z6.string().optional(),
249
- /** Initially visible */
250
- open: z6.boolean().optional(),
251
- /** Confirm action URL */
252
- confirmHref: z6.string().optional()
253
- }).strict();
254
- var DrawerPositionSchema = z6.enum(["left", "right", "top", "bottom"]);
255
- var DrawerOptionsSchema = z6.object({
256
- /** Drawer ID (required) */
257
- id: z6.string(),
258
- /** Position */
259
- position: DrawerPositionSchema.optional(),
260
- /** Size (width for left/right, height for top/bottom) */
261
- size: ModalSizeSchema.optional(),
262
- /** Drawer title */
263
- title: z6.string().optional(),
264
- /** Show close button */
265
- showClose: z6.boolean().optional(),
266
- /** Footer content (HTML string) */
267
- footer: z6.string().optional(),
268
- /** Additional CSS classes */
269
- className: z6.string().optional(),
270
- /** Initially visible */
271
- open: z6.boolean().optional()
272
- }).strict();
273
- var ModalTriggerOptionsSchema = z6.object({
274
- /** Target modal ID (required) */
275
- targetId: z6.string(),
276
- /** Trigger text */
277
- text: z6.string().optional(),
278
- /** HTML tag to use */
279
- tag: z6.enum(["button", "a", "span", "div"]).optional(),
280
- /** Additional CSS classes */
281
- className: z6.string().optional()
282
- }).strict();
283
-
284
- // libs/ui/src/components/table.schema.ts
285
- import { z as z7 } from "zod";
286
- var TableAlignSchema = z7.enum(["left", "center", "right"]);
287
- var TableSortDirectionSchema = z7.enum(["asc", "desc"]).nullable();
288
- var TableColumnSchema = z7.object({
289
- /** Column key (property name) */
290
- key: z7.string(),
291
- /** Column header text */
292
- header: z7.string(),
293
- /** Column width (CSS value) */
294
- width: z7.string().optional(),
295
- /** Text alignment */
296
- align: TableAlignSchema.optional(),
297
- /** Sortable column */
298
- sortable: z7.boolean().optional(),
299
- /** Current sort direction */
300
- sortDirection: TableSortDirectionSchema.optional(),
301
- /** Custom cell renderer (function - cannot validate at runtime) */
302
- render: z7.any().optional(),
303
- /** Additional header CSS classes */
304
- headerClass: z7.string().optional(),
305
- /** Additional cell CSS classes */
306
- cellClass: z7.string().optional()
307
- }).strict();
308
- var TableOptionsSchema = z7.object({
309
- /** Column definitions */
310
- columns: z7.array(TableColumnSchema),
311
- /** Table ID */
312
- id: z7.string().optional(),
313
- /** Show row selection checkboxes */
314
- selectable: z7.boolean().optional(),
315
- /** Row hover effect */
316
- hoverable: z7.boolean().optional(),
317
- /** Striped rows */
318
- striped: z7.boolean().optional(),
319
- /** Bordered cells */
320
- bordered: z7.boolean().optional(),
321
- /** Compact size */
322
- compact: z7.boolean().optional(),
323
- /** Fixed header (sticky) */
324
- stickyHeader: z7.boolean().optional(),
325
- /** Additional CSS classes */
326
- className: z7.string().optional(),
327
- /** Empty state message */
328
- emptyMessage: z7.string().optional(),
329
- /** Empty state HTML */
330
- emptyContent: z7.string().optional(),
331
- /** Loading state */
332
- loading: z7.boolean().optional(),
333
- /** Row key property for selection */
334
- rowKey: z7.string().optional(),
335
- /** Row click handler (URL template with {key}) */
336
- onRowClick: z7.string().optional()
337
- }).strict();
338
- var PaginationOptionsSchema = z7.object({
339
- /** Current page (1-indexed) */
340
- page: z7.number().min(1),
341
- /** Total pages */
342
- totalPages: z7.number().min(0),
343
- /** Total items count */
344
- totalItems: z7.number().min(0).optional(),
345
- /** Items per page */
346
- pageSize: z7.number().min(1).optional(),
347
- /** Page size options */
348
- pageSizeOptions: z7.array(z7.number()).optional(),
349
- /** Show first/last buttons */
350
- showFirstLast: z7.boolean().optional(),
351
- /** Show page count */
352
- showPageCount: z7.boolean().optional(),
353
- /** Show item count */
354
- showItemCount: z7.boolean().optional(),
355
- /** Show page size selector */
356
- showPageSize: z7.boolean().optional(),
357
- /** Max visible page buttons */
358
- maxVisiblePages: z7.number().min(1).optional(),
359
- /** Additional CSS classes */
360
- className: z7.string().optional()
361
- }).strict();
362
-
363
- // libs/ui/src/components/form.schema.ts
364
- import { z as z8 } from "zod";
365
- var InputTypeSchema = z8.enum([
366
- "text",
367
- "email",
368
- "password",
369
- "number",
370
- "tel",
371
- "url",
372
- "search",
373
- "date",
374
- "time",
375
- "datetime-local",
376
- "hidden"
377
- ]);
378
- var InputSizeSchema = z8.enum(["sm", "md", "lg"]);
379
- var InputStateSchema = z8.enum(["default", "error", "success", "warning"]);
380
- var InputOptionsSchema = z8.object({
381
- /** Input type */
382
- type: InputTypeSchema.optional(),
383
- /** Input name (required) */
384
- name: z8.string(),
385
- /** Input ID (defaults to name) */
386
- id: z8.string().optional(),
387
- /** Input value */
388
- value: z8.string().optional(),
389
- /** Placeholder text */
390
- placeholder: z8.string().optional(),
391
- /** Label text */
392
- label: z8.string().optional(),
393
- /** Helper text */
394
- helper: z8.string().optional(),
395
- /** Error message */
396
- error: z8.string().optional(),
397
- /** Input size */
398
- size: InputSizeSchema.optional(),
399
- /** Input state */
400
- state: InputStateSchema.optional(),
401
- /** Required field */
402
- required: z8.boolean().optional(),
403
- /** Disabled state */
404
- disabled: z8.boolean().optional(),
405
- /** Readonly state */
406
- readonly: z8.boolean().optional(),
407
- /** Autocomplete attribute */
408
- autocomplete: z8.string().optional(),
409
- /** Pattern for validation */
410
- pattern: z8.string().optional(),
411
- /** Min value (for number/date) */
412
- min: z8.union([z8.string(), z8.number()]).optional(),
413
- /** Max value (for number/date) */
414
- max: z8.union([z8.string(), z8.number()]).optional(),
415
- /** Step value (for number) */
416
- step: z8.union([z8.string(), z8.number()]).optional(),
417
- /** Additional CSS classes */
418
- className: z8.string().optional(),
419
- /** Data attributes */
420
- data: z8.record(z8.string(), z8.string()).optional(),
421
- /** Icon before input (HTML string) */
422
- iconBefore: z8.string().optional(),
423
- /** Icon after input (HTML string) */
424
- iconAfter: z8.string().optional()
425
- }).strict();
426
- var SelectOptionItemSchema = z8.object({
427
- value: z8.string(),
428
- label: z8.string(),
429
- disabled: z8.boolean().optional(),
430
- selected: z8.boolean().optional()
431
- }).strict();
432
- var SelectOptionsSchema = z8.object({
433
- /** Input name (required) */
434
- name: z8.string(),
435
- /** Input ID (defaults to name) */
436
- id: z8.string().optional(),
437
- /** Input value */
438
- value: z8.string().optional(),
439
- /** Placeholder text */
440
- placeholder: z8.string().optional(),
441
- /** Label text */
442
- label: z8.string().optional(),
443
- /** Helper text */
444
- helper: z8.string().optional(),
445
- /** Error message */
446
- error: z8.string().optional(),
447
- /** Input size */
448
- size: InputSizeSchema.optional(),
449
- /** Input state */
450
- state: InputStateSchema.optional(),
451
- /** Required field */
452
- required: z8.boolean().optional(),
453
- /** Disabled state */
454
- disabled: z8.boolean().optional(),
455
- /** Readonly state */
456
- readonly: z8.boolean().optional(),
457
- /** Additional CSS classes */
458
- className: z8.string().optional(),
459
- /** Data attributes */
460
- data: z8.record(z8.string(), z8.string()).optional(),
461
- /** Icon before input (HTML string) */
462
- iconBefore: z8.string().optional(),
463
- /** Icon after input (HTML string) */
464
- iconAfter: z8.string().optional(),
465
- /** Select options (required) */
466
- options: z8.array(SelectOptionItemSchema),
467
- /** Multiple selection */
468
- multiple: z8.boolean().optional()
469
- }).strict();
470
- var TextareaResizeSchema = z8.enum(["none", "vertical", "horizontal", "both"]);
471
- var TextareaOptionsSchema = z8.object({
472
- /** Input name (required) */
473
- name: z8.string(),
474
- /** Input ID (defaults to name) */
475
- id: z8.string().optional(),
476
- /** Input value */
477
- value: z8.string().optional(),
478
- /** Placeholder text */
479
- placeholder: z8.string().optional(),
480
- /** Label text */
481
- label: z8.string().optional(),
482
- /** Helper text */
483
- helper: z8.string().optional(),
484
- /** Error message */
485
- error: z8.string().optional(),
486
- /** Input size */
487
- size: InputSizeSchema.optional(),
488
- /** Input state */
489
- state: InputStateSchema.optional(),
490
- /** Required field */
491
- required: z8.boolean().optional(),
492
- /** Disabled state */
493
- disabled: z8.boolean().optional(),
494
- /** Readonly state */
495
- readonly: z8.boolean().optional(),
496
- /** Autocomplete attribute */
497
- autocomplete: z8.string().optional(),
498
- /** Additional CSS classes */
499
- className: z8.string().optional(),
500
- /** Data attributes */
501
- data: z8.record(z8.string(), z8.string()).optional(),
502
- /** Icon before input (HTML string) */
503
- iconBefore: z8.string().optional(),
504
- /** Icon after input (HTML string) */
505
- iconAfter: z8.string().optional(),
506
- /** Number of rows */
507
- rows: z8.number().min(1).optional(),
508
- /** Resize behavior */
509
- resize: TextareaResizeSchema.optional()
510
- }).strict();
511
- var CheckboxOptionsSchema = z8.object({
512
- /** Input name (required) */
513
- name: z8.string(),
514
- /** Input ID */
515
- id: z8.string().optional(),
516
- /** Input value */
517
- value: z8.string().optional(),
518
- /** Label text (required) */
519
- label: z8.string(),
520
- /** Checked state */
521
- checked: z8.boolean().optional(),
522
- /** Disabled state */
523
- disabled: z8.boolean().optional(),
524
- /** Helper text */
525
- helper: z8.string().optional(),
526
- /** Error message */
527
- error: z8.string().optional(),
528
- /** Additional CSS classes */
529
- className: z8.string().optional()
530
- }).strict();
531
- var RadioOptionItemSchema = z8.object({
532
- value: z8.string(),
533
- label: z8.string(),
534
- disabled: z8.boolean().optional()
535
- }).strict();
536
- var RadioGroupOptionsSchema = z8.object({
537
- /** Group name (required) */
538
- name: z8.string(),
539
- /** Radio options (required) */
540
- options: z8.array(RadioOptionItemSchema),
541
- /** Selected value */
542
- value: z8.string().optional(),
543
- /** Label for the group */
544
- label: z8.string().optional(),
545
- /** Helper text */
546
- helper: z8.string().optional(),
547
- /** Error message */
548
- error: z8.string().optional(),
549
- /** Layout direction */
550
- direction: z8.enum(["horizontal", "vertical"]).optional(),
551
- /** Additional CSS classes */
552
- className: z8.string().optional()
553
- }).strict();
554
- var FormMethodSchema = z8.enum(["get", "post", "dialog"]);
555
- var FormEnctypeSchema = z8.enum(["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"]);
556
- var FormOptionsSchema = z8.object({
557
- /** Form action URL */
558
- action: z8.string().optional(),
559
- /** Form method */
560
- method: FormMethodSchema.optional(),
561
- /** Form ID */
562
- id: z8.string().optional(),
563
- /** Form enctype */
564
- enctype: FormEnctypeSchema.optional(),
565
- /** Disable browser validation */
566
- novalidate: z8.boolean().optional(),
567
- /** Autocomplete behavior */
568
- autocomplete: z8.enum(["on", "off"]).optional(),
569
- /** Additional CSS classes */
570
- className: z8.string().optional()
571
- }).strict();
572
- var FormRowOptionsSchema = z8.object({
573
- /** Number of columns */
574
- cols: z8.number().min(1).max(12).optional(),
575
- /** Gap between columns */
576
- gap: z8.enum(["sm", "md", "lg"]).optional(),
577
- /** Additional CSS classes */
578
- className: z8.string().optional()
579
- }).strict();
580
- var FormSectionOptionsSchema = z8.object({
581
- /** Section title */
582
- title: z8.string().optional(),
583
- /** Section description */
584
- description: z8.string().optional(),
585
- /** Additional CSS classes */
586
- className: z8.string().optional()
587
- }).strict();
588
- var FormActionsOptionsSchema = z8.object({
589
- /** Alignment */
590
- align: z8.enum(["left", "center", "right", "between"]).optional(),
591
- /** Additional CSS classes */
592
- className: z8.string().optional()
593
- }).strict();
594
-
595
- // libs/ui/src/components/list.schema.ts
596
- import { z as z9 } from "zod";
597
- var PermissionItemSchema = z9.object({
598
- /** Scope identifier */
599
- scope: z9.string(),
600
- /** Display name */
601
- name: z9.string(),
602
- /** Description */
603
- description: z9.string().optional(),
604
- /** Icon HTML */
605
- icon: z9.string().optional(),
606
- /** Required permission (cannot be unchecked) */
607
- required: z9.boolean().optional(),
608
- /** Checked by default */
609
- checked: z9.boolean().optional(),
610
- /** Sensitive/dangerous permission */
611
- sensitive: z9.boolean().optional()
612
- }).strict();
613
- var PermissionListOptionsSchema = z9.object({
614
- /** List ID */
615
- id: z9.string().optional(),
616
- /** Checkable permissions */
617
- checkable: z9.boolean().optional(),
618
- /** Input name for checkable */
619
- inputName: z9.string().optional(),
620
- /** Group title */
621
- title: z9.string().optional(),
622
- /** Additional CSS classes */
623
- className: z9.string().optional()
624
- }).strict();
625
- var FeatureItemSchema = z9.object({
626
- /** Feature name */
627
- name: z9.string(),
628
- /** Feature description */
629
- description: z9.string().optional(),
630
- /** Icon HTML */
631
- icon: z9.string().optional(),
632
- /** Included in plan */
633
- included: z9.boolean().optional()
634
- }).strict();
635
- var FeatureListOptionsSchema = z9.object({
636
- /** Group title */
637
- title: z9.string().optional(),
638
- /** Show included/excluded styling */
639
- showStatus: z9.boolean().optional(),
640
- /** Additional CSS classes */
641
- className: z9.string().optional()
642
- }).strict();
643
- var DescriptionItemSchema = z9.object({
644
- /** Term/label */
645
- term: z9.string(),
646
- /** Description/value */
647
- description: z9.string(),
648
- /** Copy button */
649
- copyable: z9.boolean().optional()
650
- }).strict();
651
- var DescriptionListOptionsSchema = z9.object({
652
- /** Layout direction */
653
- direction: z9.enum(["horizontal", "vertical"]).optional(),
654
- /** Striped rows */
655
- striped: z9.boolean().optional(),
656
- /** Additional CSS classes */
657
- className: z9.string().optional()
658
- }).strict();
659
- var ActionItemSchema = z9.object({
660
- /** Action label */
661
- label: z9.string(),
662
- /** Action description */
663
- description: z9.string().optional(),
664
- /** Icon HTML */
665
- icon: z9.string().optional(),
666
- /** Click URL */
667
- href: z9.string().optional(),
668
- /** Destructive action styling */
669
- destructive: z9.boolean().optional(),
670
- /** Disabled state */
671
- disabled: z9.boolean().optional()
672
- }).strict();
673
- var ActionListOptionsSchema = z9.object({
674
- /** Divided items */
675
- divided: z9.boolean().optional(),
676
- /** Additional CSS classes */
677
- className: z9.string().optional()
678
- }).strict();
679
-
680
- // libs/ui/src/layouts/base.ts
681
- import {
682
- OPENAI_PLATFORM,
683
- canUseCdn,
684
- needsInlineScripts,
685
- DEFAULT_THEME,
686
- buildThemeCss,
687
- mergeThemes,
688
- buildFontPreconnect,
689
- buildFontStylesheets,
690
- buildCdnScripts
691
- } from "@frontmcp/uipack/theme";
692
- import { escapeHtml } from "@frontmcp/uipack/utils";
693
- import { escapeHtml as escapeHtml2 } from "@frontmcp/uipack/utils";
694
-
695
- // libs/ui/src/components/button.ts
696
- import { validateOptions } from "@frontmcp/uipack/validation";
697
- function getVariantClasses(variant) {
698
- const variants = {
699
- primary: "bg-primary hover:bg-primary/90 text-white shadow-sm",
700
- secondary: "bg-secondary hover:bg-secondary/90 text-white shadow-sm",
701
- outline: "border-2 border-primary text-primary hover:bg-primary/10",
702
- ghost: "text-text-primary hover:bg-gray-100",
703
- danger: "bg-danger hover:bg-danger/90 text-white shadow-sm",
704
- success: "bg-success hover:bg-success/90 text-white shadow-sm",
705
- link: "text-primary hover:text-primary/80 hover:underline"
706
- };
707
- return variants[variant];
708
- }
709
- function getSizeClasses(size, iconOnly) {
710
- if (iconOnly) {
711
- const iconSizes = {
712
- xs: "p-1.5",
713
- sm: "p-2",
714
- md: "p-2.5",
715
- lg: "p-3",
716
- xl: "p-4"
717
- };
718
- return iconSizes[size];
719
- }
720
- const sizes = {
721
- xs: "px-2.5 py-1.5 text-xs",
722
- sm: "px-3 py-2 text-sm",
723
- md: "px-4 py-2.5 text-sm",
724
- lg: "px-5 py-3 text-base",
725
- xl: "px-6 py-3.5 text-lg"
726
- };
727
- return sizes[size];
728
- }
729
- function sanitizeDataKey(key) {
730
- const sanitized = key.toLowerCase().replace(/[^a-z0-9_-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
731
- if (!sanitized) {
732
- console.warn(`[frontmcp/ui] Dropping invalid data-* key: "${key}"`);
733
- return null;
1
+ // libs/ui/src/components/Button/Button.tsx
2
+ import { styled } from "@mui/material/styles";
3
+ import MuiButton from "@mui/material/Button";
4
+ import CircularProgress from "@mui/material/CircularProgress";
5
+ import { jsx } from "react/jsx-runtime";
6
+ function mapVariant(variant) {
7
+ switch (variant) {
8
+ case "primary":
9
+ return { variant: "contained", color: "primary" };
10
+ case "secondary":
11
+ return { variant: "outlined", color: "secondary" };
12
+ case "danger":
13
+ return { variant: "contained", color: "error" };
14
+ case "ghost":
15
+ return { variant: "text", color: "inherit" };
734
16
  }
735
- return sanitized;
736
17
  }
737
- var loadingSpinner = `<svg class="animate-spin -ml-1 mr-2 h-4 w-4" fill="none" viewBox="0 0 24 24">
738
- <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
739
- <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
740
- </svg>`;
741
- function isValidHrefProtocol(href) {
742
- const trimmed = href.trim().toLowerCase();
743
- return trimmed.startsWith("http://") || trimmed.startsWith("https://") || trimmed.startsWith("/") || trimmed.startsWith("#") || trimmed.startsWith("mailto:") || trimmed.startsWith("tel:");
744
- }
745
- function button(text, options = {}) {
746
- const validation = validateOptions(options, {
747
- schema: ButtonOptionsSchema,
748
- componentName: "button"
749
- });
750
- if (!validation.success) {
751
- return validation.error;
752
- }
753
- const validatedOptions = validation.data;
754
- const {
755
- variant = "primary",
756
- size = "md",
757
- type = "button",
758
- disabled = false,
759
- loading = false,
760
- fullWidth = false,
761
- iconBefore,
762
- iconAfter,
763
- iconOnly = false,
764
- className = "",
765
- id,
766
- name,
767
- value,
768
- href,
769
- target,
770
- data,
771
- ariaLabel
772
- } = validatedOptions;
773
- if (!iconOnly && !text.trim()) {
774
- console.warn("[frontmcp/ui] Button has empty text. Consider providing text or using iconOnly with ariaLabel.");
775
- }
776
- if (iconOnly && !ariaLabel && !text.trim()) {
777
- console.warn(
778
- "[frontmcp/ui] iconOnly button requires non-empty text or ariaLabel for accessibility; control will have no label."
779
- );
780
- }
781
- if (href && !isValidHrefProtocol(href)) {
782
- console.warn(`[frontmcp/ui] Button href contains potentially dangerous protocol: "${href.slice(0, 20)}..."`);
783
- }
784
- const variantClasses = getVariantClasses(variant);
785
- const sizeClasses = getSizeClasses(size, iconOnly);
786
- const safeClassName = className ? escapeHtml2(className) : "";
787
- const baseClasses = [
788
- "inline-flex items-center justify-center",
789
- "font-medium",
790
- "rounded-lg",
791
- "transition-colors duration-200",
792
- "focus:outline-none focus:ring-2 focus:ring-primary/50 focus:ring-offset-2",
793
- disabled || loading ? "opacity-50 cursor-not-allowed" : "cursor-pointer",
794
- fullWidth ? "w-full" : "",
795
- variantClasses,
796
- sizeClasses,
797
- safeClassName
798
- ].filter(Boolean).join(" ");
799
- const dataAttrs = data ? Object.entries(data).map(([key, val]) => {
800
- const safeKey = sanitizeDataKey(key);
801
- return safeKey ? `data-${safeKey}="${escapeHtml2(val)}"` : "";
802
- }).filter(Boolean).join(" ") : "";
803
- const idAttr = id ? `id="${escapeHtml2(id)}"` : "";
804
- const nameAttr = name ? `name="${escapeHtml2(name)}"` : "";
805
- const valueAttr = value ? `value="${escapeHtml2(value)}"` : "";
806
- const disabledAttr = disabled || loading ? "disabled" : "";
807
- const targetAttr = target ? `target="${escapeHtml2(target)}"` : "";
808
- const relAttr = target === "_blank" ? 'rel="noopener noreferrer"' : "";
809
- const trimmedText = text.trim();
810
- const effectiveAriaLabel = ariaLabel ?? (iconOnly && trimmedText ? trimmedText : void 0);
811
- const ariaLabelAttr = effectiveAriaLabel ? `aria-label="${escapeHtml2(effectiveAriaLabel)}"` : "";
812
- const iconBeforeHtml = iconBefore && !loading ? `<span class="${iconOnly ? "" : "mr-2"}">${iconBefore}</span>` : "";
813
- const iconAfterHtml = iconAfter && !loading ? `<span class="${iconOnly ? "" : "ml-2"}">${iconAfter}</span>` : "";
814
- const loadingHtml = loading ? loadingSpinner : "";
815
- const textHtml = iconOnly ? "" : escapeHtml2(text);
816
- const contentHtml = `${loadingHtml}${iconBeforeHtml}${textHtml}${iconAfterHtml}`;
817
- if (href && !disabled && !loading && isValidHrefProtocol(href)) {
818
- return `<a href="${escapeHtml2(
819
- href
820
- )}" class="${baseClasses}" ${idAttr} ${dataAttrs} ${ariaLabelAttr} ${targetAttr} ${relAttr}>
821
- ${contentHtml}
822
- </a>`;
823
- }
824
- return `<button type="${type}" class="${baseClasses}" ${idAttr} ${nameAttr} ${valueAttr} ${disabledAttr} ${dataAttrs} ${ariaLabelAttr}>
825
- ${contentHtml}
826
- </button>`;
18
+ var StyledButton = styled(MuiButton, {
19
+ name: "Button",
20
+ slot: "Root"
21
+ })(({ theme }) => ({
22
+ textTransform: "none",
23
+ fontWeight: 500,
24
+ borderRadius: theme.shape.borderRadius
25
+ }));
26
+ function Button({
27
+ variant = "primary",
28
+ size = "medium",
29
+ loading = false,
30
+ disabled = false,
31
+ startIcon,
32
+ endIcon,
33
+ fullWidth = false,
34
+ onClick,
35
+ type = "button",
36
+ children
37
+ }) {
38
+ const mapped = mapVariant(variant);
39
+ return /* @__PURE__ */ jsx(
40
+ StyledButton,
41
+ {
42
+ variant: mapped.variant,
43
+ color: mapped.color,
44
+ size,
45
+ disabled: disabled || loading,
46
+ startIcon: loading ? /* @__PURE__ */ jsx(CircularProgress, { size: 16, color: "inherit" }) : startIcon,
47
+ endIcon,
48
+ fullWidth,
49
+ onClick,
50
+ type,
51
+ children
52
+ }
53
+ );
827
54
  }
828
- function buttonGroup(buttons, options = {}) {
829
- if (buttons.length === 0) {
830
- console.warn("[frontmcp/ui] buttonGroup called with empty buttons array");
831
- return "";
55
+
56
+ // libs/ui/src/components/Card/Card.tsx
57
+ import { styled as styled2 } from "@mui/material/styles";
58
+ import MuiCard from "@mui/material/Card";
59
+ import CardHeader from "@mui/material/CardHeader";
60
+ import CardContent from "@mui/material/CardContent";
61
+ import CardActions from "@mui/material/CardActions";
62
+ import CardActionArea from "@mui/material/CardActionArea";
63
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
64
+ var StyledCard = styled2(MuiCard, {
65
+ name: "Card",
66
+ slot: "Root"
67
+ })(({ theme }) => ({
68
+ borderRadius: theme.shape.borderRadius,
69
+ transition: theme.transitions.create(["box-shadow", "border-color"], {
70
+ duration: theme.transitions.duration.short
71
+ })
72
+ }));
73
+ var StyledCardHeader = styled2(CardHeader, {
74
+ name: "Card",
75
+ slot: "Header"
76
+ })(({ theme }) => ({
77
+ "& .MuiCardHeader-title": {
78
+ fontWeight: 600,
79
+ fontSize: theme.typography.body1.fontSize
80
+ },
81
+ "& .MuiCardHeader-subheader": {
82
+ fontSize: theme.typography.body2.fontSize
832
83
  }
833
- const validation = validateOptions(options, {
834
- schema: ButtonGroupOptionsSchema,
835
- componentName: "buttonGroup"
836
- });
837
- if (!validation.success) {
838
- return validation.error;
84
+ }));
85
+ var StyledCardContent = styled2(CardContent, {
86
+ name: "Card",
87
+ slot: "Content"
88
+ })({
89
+ "&:last-child": {
90
+ paddingBottom: 16
839
91
  }
840
- const validatedOptions = validation.data;
841
- const { attached = false, direction = "horizontal", gap = "md", className = "" } = validatedOptions;
842
- const safeClassName = className ? escapeHtml2(className) : "";
843
- if (attached) {
844
- const classes = direction === "horizontal" ? "inline-flex rounded-lg shadow-sm [&>*:first-child]:rounded-r-none [&>*:last-child]:rounded-l-none [&>*:not(:first-child):not(:last-child)]:rounded-none [&>*:not(:first-child)]:-ml-px" : "inline-flex flex-col rounded-lg shadow-sm [&>*:first-child]:rounded-b-none [&>*:last-child]:rounded-t-none [&>*:not(:first-child):not(:last-child)]:rounded-none [&>*:not(:first-child)]:-mt-px";
845
- return `<div class="${classes} ${safeClassName}">${buttons.join("")}</div>`;
92
+ });
93
+ var StyledCardActions = styled2(CardActions, {
94
+ name: "Card",
95
+ slot: "Actions"
96
+ })(({ theme }) => ({
97
+ borderTop: `1px solid ${theme.palette.divider}`,
98
+ padding: theme.spacing(1, 2)
99
+ }));
100
+ function Card({
101
+ title,
102
+ subtitle,
103
+ headerActions,
104
+ footer,
105
+ elevation = 1,
106
+ clickable = false,
107
+ onClick,
108
+ slotProps,
109
+ children
110
+ }) {
111
+ const header = title || subtitle || headerActions ? /* @__PURE__ */ jsx2(StyledCardHeader, { title, subheader: subtitle, action: headerActions, ...slotProps?.header }) : null;
112
+ const content = /* @__PURE__ */ jsx2(StyledCardContent, { ...slotProps?.content, children });
113
+ const actions = footer ? /* @__PURE__ */ jsx2(StyledCardActions, { ...slotProps?.actions, children: footer }) : null;
114
+ if (clickable) {
115
+ return /* @__PURE__ */ jsxs(StyledCard, { elevation, ...slotProps?.root, children: [
116
+ /* @__PURE__ */ jsxs(CardActionArea, { onClick, children: [
117
+ header,
118
+ content
119
+ ] }),
120
+ actions
121
+ ] });
846
122
  }
847
- const gapClasses = { sm: "gap-2", md: "gap-3", lg: "gap-4" };
848
- const directionClasses = direction === "horizontal" ? "flex flex-row" : "flex flex-col";
849
- return `<div class="${directionClasses} ${gapClasses[gap]} ${safeClassName}">${buttons.join("")}</div>`;
123
+ return /* @__PURE__ */ jsxs(StyledCard, { elevation, onClick, ...slotProps?.root, children: [
124
+ header,
125
+ content,
126
+ actions
127
+ ] });
850
128
  }
851
- var primaryButton = (text, opts) => button(text, { ...opts, variant: "primary" });
852
- var secondaryButton = (text, opts) => button(text, { ...opts, variant: "secondary" });
853
- var outlineButton = (text, opts) => button(text, { ...opts, variant: "outline" });
854
- var ghostButton = (text, opts) => button(text, { ...opts, variant: "ghost" });
855
- var dangerButton = (text, opts) => button(text, { ...opts, variant: "danger" });
856
- var linkButton = (text, opts) => button(text, { ...opts, variant: "link" });
857
129
 
858
- // libs/ui/src/components/card.ts
859
- import { sanitizeHtmlContent } from "@frontmcp/uipack/runtime";
860
- function getVariantClasses2(variant) {
861
- const variants = {
862
- default: "bg-white border border-border rounded-xl shadow-sm",
863
- outlined: "bg-transparent border-2 border-border rounded-xl",
864
- elevated: "bg-white rounded-xl shadow-lg",
865
- filled: "bg-gray-50 rounded-xl",
866
- ghost: "bg-transparent"
867
- };
868
- return variants[variant];
869
- }
870
- function getSizeClasses2(size) {
871
- const sizes = {
872
- sm: "p-4",
873
- md: "p-6",
874
- lg: "p-8"
875
- };
876
- return sizes[size];
877
- }
878
- function buildDataAttrs(data) {
879
- if (!data) return "";
880
- return Object.entries(data).map(([key, value]) => `data-${key}="${escapeHtml2(value)}"`).join(" ");
881
- }
882
- function card(content, options = {}) {
883
- const {
884
- variant = "default",
885
- size = "md",
886
- title,
887
- subtitle,
888
- headerActions,
889
- footer,
890
- className = "",
891
- id,
892
- data,
893
- clickable = false,
894
- href,
895
- sanitize = false
896
- } = options;
897
- const safeContent = sanitize ? sanitizeHtmlContent(content) : content;
898
- const safeHeaderActions = sanitize && headerActions ? sanitizeHtmlContent(headerActions) : headerActions;
899
- const safeFooter = sanitize && footer ? sanitizeHtmlContent(footer) : footer;
900
- const variantClasses = getVariantClasses2(variant);
901
- const sizeClasses = getSizeClasses2(size);
902
- const clickableClasses = clickable ? "cursor-pointer hover:shadow-md transition-shadow" : "";
903
- const safeClassName = className ? escapeHtml2(className) : "";
904
- const allClasses = [variantClasses, sizeClasses, clickableClasses, safeClassName].filter(Boolean).join(" ");
905
- const dataAttrs = buildDataAttrs(data);
906
- const idAttr = id ? `id="${escapeHtml2(id)}"` : "";
907
- const hasHeader = title || subtitle || safeHeaderActions;
908
- const headerHtml = hasHeader ? `<div class="flex items-start justify-between mb-4">
909
- <div>
910
- ${title ? `<h3 class="text-lg font-semibold text-text-primary">${escapeHtml2(title)}</h3>` : ""}
911
- ${subtitle ? `<p class="text-sm text-text-secondary mt-1">${escapeHtml2(subtitle)}</p>` : ""}
912
- </div>
913
- ${safeHeaderActions ? `<div class="flex items-center gap-2">${safeHeaderActions}</div>` : ""}
914
- </div>` : "";
915
- const footerHtml = safeFooter ? `<div class="mt-4 pt-4 border-t border-divider">${safeFooter}</div>` : "";
916
- if (href) {
917
- return `<a href="${escapeHtml2(href)}" class="${allClasses}" ${idAttr} ${dataAttrs}>
918
- ${headerHtml}
919
- ${safeContent}
920
- ${footerHtml}
921
- </a>`;
922
- }
923
- return `<div class="${allClasses}" ${idAttr} ${dataAttrs}>
924
- ${headerHtml}
925
- ${safeContent}
926
- ${footerHtml}
927
- </div>`;
928
- }
929
- function cardGroup(cards, options = {}) {
930
- const { direction = "vertical", gap = "md", className = "" } = options;
931
- const gapClasses = { sm: "gap-2", md: "gap-4", lg: "gap-6" };
932
- const directionClasses = direction === "horizontal" ? "flex flex-row flex-wrap" : "flex flex-col";
933
- const safeClassName = className ? escapeHtml2(className) : "";
934
- return `<div class="${directionClasses} ${gapClasses[gap]} ${safeClassName}">
935
- ${cards.join("\n")}
936
- </div>`;
937
- }
938
-
939
- // libs/ui/src/components/form.ts
940
- import { sanitizeHtmlContent as sanitizeHtmlContent2 } from "@frontmcp/uipack/runtime";
941
- function getInputSizeClasses(size) {
942
- const sizes = {
943
- sm: "px-3 py-1.5 text-sm",
944
- md: "px-4 py-2.5 text-sm",
945
- lg: "px-5 py-3 text-base"
946
- };
947
- return sizes[size];
948
- }
949
- function getInputStateClasses(state) {
950
- const states = {
951
- default: "border-border focus:border-primary focus:ring-primary/20",
952
- error: "border-danger focus:border-danger focus:ring-danger/20",
953
- success: "border-success focus:border-success focus:ring-success/20",
954
- warning: "border-warning focus:border-warning focus:ring-warning/20"
955
- };
956
- return states[state];
957
- }
958
- function buildDataAttrs2(data) {
959
- if (!data) return "";
960
- return Object.entries(data).map(([key, value]) => `data-${key}="${escapeHtml2(value)}"`).join(" ");
961
- }
962
- function input(options) {
963
- const {
964
- type = "text",
965
- name,
966
- id = name,
967
- value = "",
968
- placeholder = "",
969
- label,
970
- helper,
971
- error,
972
- size = "md",
973
- state = error ? "error" : "default",
974
- required = false,
975
- disabled = false,
976
- readonly = false,
977
- autocomplete,
978
- pattern,
979
- min,
980
- max,
981
- step,
982
- className = "",
983
- data,
984
- iconBefore,
985
- iconAfter,
986
- sanitize = false
987
- } = options;
988
- const safeIconBefore = sanitize && iconBefore ? sanitizeHtmlContent2(iconBefore) : iconBefore;
989
- const safeIconAfter = sanitize && iconAfter ? sanitizeHtmlContent2(iconAfter) : iconAfter;
990
- const sizeClasses = getInputSizeClasses(size);
991
- const stateClasses = getInputStateClasses(state);
992
- const hasIcon = safeIconBefore || safeIconAfter;
993
- const safeClassName = className ? escapeHtml2(className) : "";
994
- const baseClasses = [
995
- "w-full rounded-lg border bg-white",
996
- "transition-colors duration-200",
997
- "focus:outline-none focus:ring-2",
998
- disabled ? "opacity-50 cursor-not-allowed bg-gray-50" : "",
999
- sizeClasses,
1000
- stateClasses,
1001
- hasIcon ? (safeIconBefore ? "pl-10" : "") + (safeIconAfter ? " pr-10" : "") : "",
1002
- safeClassName
1003
- ].filter(Boolean).join(" ");
1004
- const dataAttrs = buildDataAttrs2(data);
1005
- const inputAttrs = [
1006
- `type="${type}"`,
1007
- `name="${escapeHtml2(name)}"`,
1008
- `id="${escapeHtml2(id)}"`,
1009
- value ? `value="${escapeHtml2(value)}"` : "",
1010
- placeholder ? `placeholder="${escapeHtml2(placeholder)}"` : "",
1011
- required ? "required" : "",
1012
- disabled ? "disabled" : "",
1013
- readonly ? "readonly" : "",
1014
- autocomplete ? `autocomplete="${escapeHtml2(autocomplete)}"` : "",
1015
- pattern ? `pattern="${escapeHtml2(pattern)}"` : "",
1016
- min !== void 0 ? `min="${escapeHtml2(String(min))}"` : "",
1017
- max !== void 0 ? `max="${escapeHtml2(String(max))}"` : "",
1018
- step !== void 0 ? `step="${escapeHtml2(String(step))}"` : "",
1019
- `class="${baseClasses}"`,
1020
- dataAttrs
1021
- ].filter(Boolean).join(" ");
1022
- const labelHtml = label ? `<label for="${escapeHtml2(id)}" class="block text-sm font-medium text-text-primary mb-1.5">
1023
- ${escapeHtml2(label)}${required ? '<span class="text-danger ml-1">*</span>' : ""}
1024
- </label>` : "";
1025
- const helperHtml = helper && !error ? `<p class="mt-1.5 text-sm text-text-secondary">${escapeHtml2(helper)}</p>` : "";
1026
- const errorHtml = error ? `<p class="mt-1.5 text-sm text-danger">${escapeHtml2(error)}</p>` : "";
1027
- const iconBeforeHtml = safeIconBefore ? `<span class="absolute left-3 top-1/2 -translate-y-1/2 text-text-secondary">${safeIconBefore}</span>` : "";
1028
- const iconAfterHtml = safeIconAfter ? `<span class="absolute right-3 top-1/2 -translate-y-1/2 text-text-secondary">${safeIconAfter}</span>` : "";
1029
- const inputHtml = hasIcon ? `<div class="relative">
1030
- ${iconBeforeHtml}
1031
- <input ${inputAttrs}>
1032
- ${iconAfterHtml}
1033
- </div>` : `<input ${inputAttrs}>`;
1034
- return `<div class="form-field">
1035
- ${labelHtml}
1036
- ${inputHtml}
1037
- ${helperHtml}
1038
- ${errorHtml}
1039
- </div>`;
1040
- }
1041
- function select(options) {
1042
- const {
1043
- name,
1044
- id = name,
1045
- options: selectOptions,
1046
- value,
1047
- label,
1048
- helper,
1049
- error,
1050
- size = "md",
1051
- state = error ? "error" : "default",
1052
- required = false,
1053
- disabled = false,
1054
- multiple = false,
1055
- className = "",
1056
- data
1057
- } = options;
1058
- const sizeClasses = getInputSizeClasses(size);
1059
- const stateClasses = getInputStateClasses(state);
1060
- const safeClassName = className ? escapeHtml2(className) : "";
1061
- const baseClasses = [
1062
- "w-full rounded-lg border bg-white",
1063
- "transition-colors duration-200",
1064
- "focus:outline-none focus:ring-2",
1065
- disabled ? "opacity-50 cursor-not-allowed bg-gray-50" : "",
1066
- sizeClasses,
1067
- stateClasses,
1068
- safeClassName
1069
- ].filter(Boolean).join(" ");
1070
- const dataAttrs = buildDataAttrs2(data);
1071
- const optionsHtml = selectOptions.map((opt) => {
1072
- const selected = opt.selected || opt.value === value ? "selected" : "";
1073
- const optDisabled = opt.disabled ? "disabled" : "";
1074
- return `<option value="${escapeHtml2(opt.value)}" ${selected} ${optDisabled}>${escapeHtml2(opt.label)}</option>`;
1075
- }).join("\n");
1076
- const labelHtml = label ? `<label for="${escapeHtml2(id)}" class="block text-sm font-medium text-text-primary mb-1.5">
1077
- ${escapeHtml2(label)}${required ? '<span class="text-danger ml-1">*</span>' : ""}
1078
- </label>` : "";
1079
- const helperHtml = helper && !error ? `<p class="mt-1.5 text-sm text-text-secondary">${escapeHtml2(helper)}</p>` : "";
1080
- const errorHtml = error ? `<p class="mt-1.5 text-sm text-danger">${escapeHtml2(error)}</p>` : "";
1081
- return `<div class="form-field">
1082
- ${labelHtml}
1083
- <select
1084
- name="${escapeHtml2(name)}"
1085
- id="${escapeHtml2(id)}"
1086
- class="${baseClasses}"
1087
- ${required ? "required" : ""}
1088
- ${disabled ? "disabled" : ""}
1089
- ${multiple ? "multiple" : ""}
1090
- ${dataAttrs}
1091
- >
1092
- ${optionsHtml}
1093
- </select>
1094
- ${helperHtml}
1095
- ${errorHtml}
1096
- </div>`;
1097
- }
1098
- function textarea(options) {
1099
- const {
1100
- name,
1101
- id = name,
1102
- value = "",
1103
- placeholder = "",
1104
- label,
1105
- helper,
1106
- error,
1107
- size = "md",
1108
- state = error ? "error" : "default",
1109
- required = false,
1110
- disabled = false,
1111
- readonly = false,
1112
- rows = 4,
1113
- resize = "vertical",
1114
- className = "",
1115
- data
1116
- } = options;
1117
- const sizeClasses = getInputSizeClasses(size);
1118
- const stateClasses = getInputStateClasses(state);
1119
- const resizeClasses = {
1120
- none: "resize-none",
1121
- vertical: "resize-y",
1122
- horizontal: "resize-x",
1123
- both: "resize"
1124
- };
1125
- const safeClassName = className ? escapeHtml2(className) : "";
1126
- const baseClasses = [
1127
- "w-full rounded-lg border bg-white",
1128
- "transition-colors duration-200",
1129
- "focus:outline-none focus:ring-2",
1130
- disabled ? "opacity-50 cursor-not-allowed bg-gray-50" : "",
1131
- sizeClasses,
1132
- stateClasses,
1133
- resizeClasses[resize],
1134
- safeClassName
1135
- ].filter(Boolean).join(" ");
1136
- const dataAttrs = buildDataAttrs2(data);
1137
- const labelHtml = label ? `<label for="${escapeHtml2(id)}" class="block text-sm font-medium text-text-primary mb-1.5">
1138
- ${escapeHtml2(label)}${required ? '<span class="text-danger ml-1">*</span>' : ""}
1139
- </label>` : "";
1140
- const helperHtml = helper && !error ? `<p class="mt-1.5 text-sm text-text-secondary">${escapeHtml2(helper)}</p>` : "";
1141
- const errorHtml = error ? `<p class="mt-1.5 text-sm text-danger">${escapeHtml2(error)}</p>` : "";
1142
- return `<div class="form-field">
1143
- ${labelHtml}
1144
- <textarea
1145
- name="${escapeHtml2(name)}"
1146
- id="${escapeHtml2(id)}"
1147
- rows="${rows}"
1148
- class="${baseClasses}"
1149
- ${placeholder ? `placeholder="${escapeHtml2(placeholder)}"` : ""}
1150
- ${required ? "required" : ""}
1151
- ${disabled ? "disabled" : ""}
1152
- ${readonly ? "readonly" : ""}
1153
- ${dataAttrs}
1154
- >${escapeHtml2(value)}</textarea>
1155
- ${helperHtml}
1156
- ${errorHtml}
1157
- </div>`;
1158
- }
1159
- function checkbox(options) {
1160
- const {
1161
- name,
1162
- id = name,
1163
- value = "true",
1164
- label,
1165
- checked = false,
1166
- disabled = false,
1167
- helper,
1168
- error,
1169
- className = ""
1170
- } = options;
1171
- const checkboxClasses = [
1172
- "h-4 w-4 rounded border-border text-primary",
1173
- "focus:ring-2 focus:ring-primary/20 focus:ring-offset-0",
1174
- disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"
1175
- ].join(" ");
1176
- const helperHtml = helper && !error ? `<p class="text-sm text-text-secondary">${escapeHtml2(helper)}</p>` : "";
1177
- const errorHtml = error ? `<p class="text-sm text-danger">${escapeHtml2(error)}</p>` : "";
1178
- const safeClassName = className ? escapeHtml2(className) : "";
1179
- return `<div class="form-field ${safeClassName}">
1180
- <label class="flex items-start gap-3 ${disabled ? "cursor-not-allowed" : "cursor-pointer"}">
1181
- <input
1182
- type="checkbox"
1183
- name="${escapeHtml2(name)}"
1184
- id="${escapeHtml2(id)}"
1185
- value="${escapeHtml2(value)}"
1186
- class="${checkboxClasses}"
1187
- ${checked ? "checked" : ""}
1188
- ${disabled ? "disabled" : ""}
1189
- >
1190
- <div>
1191
- <span class="text-sm font-medium text-text-primary">${escapeHtml2(label)}</span>
1192
- ${helperHtml}
1193
- ${errorHtml}
1194
- </div>
1195
- </label>
1196
- </div>`;
1197
- }
1198
- function radioGroup(options) {
1199
- const { name, options: radioOptions, value, label, helper, error, direction = "vertical", className = "" } = options;
1200
- const directionClasses = direction === "horizontal" ? "flex flex-row flex-wrap gap-4" : "flex flex-col gap-2";
1201
- const radioClasses = "h-4 w-4 border-border text-primary focus:ring-2 focus:ring-primary/20 focus:ring-offset-0";
1202
- const radiosHtml = radioOptions.map((opt, index) => {
1203
- const radioId = `${name}-${index}`;
1204
- const checked = opt.value === value ? "checked" : "";
1205
- const disabled = opt.disabled ? "disabled" : "";
1206
- const cursorClass = opt.disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer";
1207
- return `<label class="flex items-center gap-2 ${cursorClass}">
1208
- <input
1209
- type="radio"
1210
- name="${escapeHtml2(name)}"
1211
- id="${escapeHtml2(radioId)}"
1212
- value="${escapeHtml2(opt.value)}"
1213
- class="${radioClasses}"
1214
- ${checked}
1215
- ${disabled}
1216
- >
1217
- <span class="text-sm text-text-primary">${escapeHtml2(opt.label)}</span>
1218
- </label>`;
1219
- }).join("\n");
1220
- const labelHtml = label ? `<label class="block text-sm font-medium text-text-primary mb-2">${escapeHtml2(label)}</label>` : "";
1221
- const helperHtml = helper && !error ? `<p class="mt-1.5 text-sm text-text-secondary">${escapeHtml2(helper)}</p>` : "";
1222
- const errorHtml = error ? `<p class="mt-1.5 text-sm text-danger">${escapeHtml2(error)}</p>` : "";
1223
- const safeClassName = className ? escapeHtml2(className) : "";
1224
- return `<div class="form-field ${safeClassName}" role="radiogroup">
1225
- ${labelHtml}
1226
- <div class="${directionClasses}">
1227
- ${radiosHtml}
1228
- </div>
1229
- ${helperHtml}
1230
- ${errorHtml}
1231
- </div>`;
1232
- }
1233
- function form(content, options = {}) {
1234
- const { action, method = "post", id, className = "", preventDefault = false, autocomplete, enctype } = options;
1235
- const attrs = [
1236
- action ? `action="${escapeHtml2(action)}"` : "",
1237
- `method="${method}"`,
1238
- id ? `id="${escapeHtml2(id)}"` : "",
1239
- className ? `class="${escapeHtml2(className)}"` : "",
1240
- autocomplete ? `autocomplete="${autocomplete}"` : "",
1241
- enctype ? `enctype="${enctype}"` : "",
1242
- preventDefault ? 'onsubmit="return false;"' : ""
1243
- ].filter(Boolean).join(" ");
1244
- return `<form ${attrs}>${content}</form>`;
1245
- }
1246
- var GRID_COLS_MAP = {
1247
- 1: "grid-cols-1",
1248
- 2: "grid-cols-2",
1249
- 3: "grid-cols-3",
1250
- 4: "grid-cols-4",
1251
- 5: "grid-cols-5",
1252
- 6: "grid-cols-6",
1253
- 7: "grid-cols-7",
1254
- 8: "grid-cols-8",
1255
- 9: "grid-cols-9",
1256
- 10: "grid-cols-10",
1257
- 11: "grid-cols-11",
1258
- 12: "grid-cols-12"
1259
- };
1260
- function formRow(fields, options = {}) {
1261
- const { gap = "md", className = "" } = options;
1262
- const gapClasses = { sm: "gap-2", md: "gap-4", lg: "gap-6" };
1263
- const gridCols = GRID_COLS_MAP[fields.length] ?? "grid-cols-1";
1264
- const safeClassName = className ? escapeHtml2(className) : "";
1265
- return `<div class="grid ${gridCols} ${gapClasses[gap]} ${safeClassName}">
1266
- ${fields.join("\n")}
1267
- </div>`;
1268
- }
1269
- function formSection(content, options = {}) {
1270
- const { title, description, className = "" } = options;
1271
- const headerHtml = title ? `<div class="mb-4">
1272
- <h3 class="text-lg font-semibold text-text-primary">${escapeHtml2(title)}</h3>
1273
- ${description ? `<p class="text-sm text-text-secondary mt-1">${escapeHtml2(description)}</p>` : ""}
1274
- </div>` : "";
1275
- const safeClassName = className ? escapeHtml2(className) : "";
1276
- return `<div class="form-section ${safeClassName}">
1277
- ${headerHtml}
1278
- <div class="space-y-4">
1279
- ${content}
1280
- </div>
1281
- </div>`;
1282
- }
1283
- function formActions(buttons, options = {}) {
1284
- const { align = "right", className = "" } = options;
1285
- const alignClasses = {
1286
- left: "justify-start",
1287
- center: "justify-center",
1288
- right: "justify-end",
1289
- between: "justify-between"
1290
- };
1291
- const safeClassName = className ? escapeHtml2(className) : "";
1292
- return `<div class="flex items-center gap-3 pt-4 ${alignClasses[align]} ${safeClassName}">
1293
- ${buttons.join("\n")}
1294
- </div>`;
1295
- }
1296
- function hiddenInput(name, value) {
1297
- return `<input type="hidden" name="${escapeHtml2(name)}" value="${escapeHtml2(value)}">`;
1298
- }
1299
- function csrfInput(token) {
1300
- return hiddenInput("_csrf", token);
130
+ // libs/ui/src/components/Alert/Alert.tsx
131
+ import { useState } from "react";
132
+ import MuiAlert from "@mui/material/Alert";
133
+ import AlertTitle from "@mui/material/AlertTitle";
134
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
135
+ function Alert({
136
+ severity = "info",
137
+ title,
138
+ dismissible = false,
139
+ onDismiss,
140
+ icon,
141
+ children
142
+ }) {
143
+ const [dismissed, setDismissed] = useState(false);
144
+ if (dismissed) return null;
145
+ const handleClose = dismissible ? () => {
146
+ setDismissed(true);
147
+ onDismiss?.();
148
+ } : void 0;
149
+ return /* @__PURE__ */ jsxs2(MuiAlert, { severity, onClose: handleClose, icon, children: [
150
+ title && /* @__PURE__ */ jsx3(AlertTitle, { children: title }),
151
+ children
152
+ ] });
1301
153
  }
1302
154
 
1303
- // libs/ui/src/components/badge.ts
1304
- import { sanitizeHtmlContent as sanitizeHtmlContent3 } from "@frontmcp/uipack/runtime";
1305
- function getVariantClasses3(variant) {
1306
- const variants = {
1307
- default: "bg-gray-100 text-gray-800",
1308
- primary: "bg-primary/10 text-primary",
1309
- secondary: "bg-secondary/10 text-secondary",
1310
- success: "bg-success/10 text-success",
1311
- warning: "bg-warning/10 text-warning",
1312
- danger: "bg-danger/10 text-danger",
1313
- info: "bg-blue-100 text-blue-800",
1314
- outline: "border border-border text-text-primary bg-transparent"
1315
- };
1316
- return variants[variant];
1317
- }
1318
- function getSizeClasses3(size, dot) {
1319
- if (dot) {
1320
- const dotSizes = {
1321
- sm: "w-2 h-2",
1322
- md: "w-2.5 h-2.5",
1323
- lg: "w-3 h-3"
1324
- };
1325
- return dotSizes[size];
155
+ // libs/ui/src/components/Badge/Badge.tsx
156
+ import React2 from "react";
157
+ import Chip from "@mui/material/Chip";
158
+ import { jsx as jsx4 } from "react/jsx-runtime";
159
+ function mapColor(variant) {
160
+ switch (variant) {
161
+ case "default":
162
+ return "default";
163
+ case "primary":
164
+ return "primary";
165
+ case "success":
166
+ return "success";
167
+ case "warning":
168
+ return "warning";
169
+ case "error":
170
+ return "error";
171
+ case "info":
172
+ return "info";
1326
173
  }
1327
- const sizes = {
1328
- sm: "px-2 py-0.5 text-xs",
1329
- md: "px-2.5 py-1 text-xs",
1330
- lg: "px-3 py-1.5 text-sm"
1331
- };
1332
- return sizes[size];
1333
174
  }
1334
- function badge(text, options = {}) {
1335
- const {
1336
- variant = "default",
1337
- size = "md",
1338
- pill = false,
1339
- icon,
1340
- dot = false,
1341
- className = "",
1342
- removable = false,
1343
- sanitize = false
1344
- } = options;
1345
- const safeIcon = sanitize && icon ? sanitizeHtmlContent3(icon) : icon;
1346
- const safeClassName = className ? escapeHtml2(className) : "";
1347
- if (dot) {
1348
- const dotVariants = {
1349
- default: "bg-gray-400",
1350
- primary: "bg-primary",
1351
- secondary: "bg-secondary",
1352
- success: "bg-success",
1353
- warning: "bg-warning",
1354
- danger: "bg-danger",
1355
- info: "bg-blue-500",
1356
- outline: "border border-current"
1357
- };
1358
- const dotClasses = ["inline-block rounded-full", getSizeClasses3(size, true), dotVariants[variant], safeClassName].filter(Boolean).join(" ");
1359
- return `<span class="${dotClasses}" aria-label="${escapeHtml2(text)}" title="${escapeHtml2(text)}"></span>`;
175
+ var DotIndicator = React2.createElement("span", {
176
+ style: {
177
+ width: 8,
178
+ height: 8,
179
+ borderRadius: "50%",
180
+ backgroundColor: "currentColor",
181
+ display: "inline-block"
1360
182
  }
1361
- const variantClasses = getVariantClasses3(variant);
1362
- const sizeClasses = getSizeClasses3(size, false);
1363
- const baseClasses = [
1364
- "inline-flex items-center font-medium",
1365
- pill ? "rounded-full" : "rounded-md",
1366
- variantClasses,
1367
- sizeClasses,
1368
- safeClassName
1369
- ].filter(Boolean).join(" ");
1370
- const iconHtml = safeIcon ? `<span class="mr-1">${safeIcon}</span>` : "";
1371
- const removeHtml = removable ? `<button
1372
- type="button"
1373
- class="ml-1.5 -mr-1 hover:opacity-70 transition-opacity"
1374
- onclick="this.parentElement.remove()"
1375
- aria-label="Remove"
1376
- >
1377
- <svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
1378
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
1379
- </svg>
1380
- </button>` : "";
1381
- return `<span class="${baseClasses}">
1382
- ${iconHtml}${escapeHtml2(text)}${removeHtml}
1383
- </span>`;
1384
- }
1385
- function badgeGroup(badges, options = {}) {
1386
- const { gap = "sm", className = "" } = options;
1387
- const gapClasses = { sm: "gap-1", md: "gap-2", lg: "gap-3" };
1388
- const safeClassName = className ? escapeHtml2(className) : "";
1389
- return `<div class="inline-flex flex-wrap ${gapClasses[gap]} ${safeClassName}">
1390
- ${badges.join("\n")}
1391
- </div>`;
1392
- }
1393
- var activeBadge = (text = "Active") => badge(text, { variant: "success", dot: false });
1394
- var inactiveBadge = (text = "Inactive") => badge(text, { variant: "default", dot: false });
1395
- var pendingBadge = (text = "Pending") => badge(text, { variant: "warning", dot: false });
1396
- var errorBadge = (text = "Error") => badge(text, { variant: "danger", dot: false });
1397
- var newBadge = (text = "New") => badge(text, { variant: "primary", size: "sm", pill: true });
1398
- var betaBadge = (text = "Beta") => badge(text, { variant: "secondary", size: "sm", pill: true });
1399
- var onlineDot = (label = "Online") => badge(label, { variant: "success", dot: true });
1400
- var offlineDot = (label = "Offline") => badge(label, { variant: "default", dot: true });
1401
- var busyDot = (label = "Busy") => badge(label, { variant: "danger", dot: true });
1402
- var awayDot = (label = "Away") => badge(label, { variant: "warning", dot: true });
1403
-
1404
- // libs/ui/src/components/alert.ts
1405
- import { sanitizeHtmlContent as sanitizeHtmlContent4 } from "@frontmcp/uipack/runtime";
1406
- var alertIcons = {
1407
- info: `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
1408
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
1409
- </svg>`,
1410
- success: `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
1411
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
1412
- </svg>`,
1413
- warning: `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
1414
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/>
1415
- </svg>`,
1416
- danger: `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
1417
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"/>
1418
- </svg>`,
1419
- neutral: `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
1420
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
1421
- </svg>`
1422
- };
1423
- function getVariantClasses4(variant) {
1424
- const variants = {
1425
- info: {
1426
- container: "bg-blue-50 border-blue-200 text-blue-800",
1427
- icon: "text-blue-500"
1428
- },
1429
- success: {
1430
- container: "bg-success/10 border-success/30 text-success",
1431
- icon: "text-success"
1432
- },
1433
- warning: {
1434
- container: "bg-warning/10 border-warning/30 text-warning",
1435
- icon: "text-warning"
1436
- },
1437
- danger: {
1438
- container: "bg-danger/10 border-danger/30 text-danger",
1439
- icon: "text-danger"
1440
- },
1441
- neutral: {
1442
- container: "bg-gray-50 border-gray-200 text-gray-800",
1443
- icon: "text-gray-500"
183
+ });
184
+ function Badge({
185
+ variant = "default",
186
+ label,
187
+ dot = false,
188
+ removable = false,
189
+ onRemove,
190
+ size = "small",
191
+ icon
192
+ }) {
193
+ const avatarProp = dot && !icon ? { avatar: DotIndicator } : {};
194
+ return /* @__PURE__ */ jsx4(
195
+ Chip,
196
+ {
197
+ label,
198
+ color: mapColor(variant),
199
+ size,
200
+ icon,
201
+ ...avatarProp,
202
+ onDelete: removable && onRemove ? onRemove : void 0,
203
+ variant: "filled"
1444
204
  }
1445
- };
1446
- return variants[variant];
1447
- }
1448
- function alert(message, options = {}) {
1449
- const {
1450
- variant = "info",
1451
- title,
1452
- showIcon = true,
1453
- icon,
1454
- dismissible = false,
1455
- className = "",
1456
- id,
1457
- actions,
1458
- sanitize = false
1459
- } = options;
1460
- const safeIcon = sanitize && icon ? sanitizeHtmlContent4(icon) : icon;
1461
- const safeActions = sanitize && actions ? sanitizeHtmlContent4(actions) : actions;
1462
- const variantClasses = getVariantClasses4(variant);
1463
- const safeClassName = className ? escapeHtml2(className) : "";
1464
- const baseClasses = ["rounded-lg border p-4", variantClasses.container, safeClassName].filter(Boolean).join(" ");
1465
- const iconHtml = showIcon ? `<div class="flex-shrink-0 ${variantClasses.icon}">
1466
- ${safeIcon || alertIcons[variant]}
1467
- </div>` : "";
1468
- const titleHtml = title ? `<h3 class="font-semibold">${escapeHtml2(title)}</h3>` : "";
1469
- const dismissHtml = dismissible ? `<button
1470
- type="button"
1471
- class="flex-shrink-0 ml-auto -mr-1 -mt-1 p-1 rounded hover:bg-black/5 transition-colors"
1472
- onclick="this.closest('.alert').remove()"
1473
- aria-label="Dismiss"
1474
- >
1475
- <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
1476
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
1477
- </svg>
1478
- </button>` : "";
1479
- const actionsHtml = safeActions ? `<div class="mt-3">${safeActions}</div>` : "";
1480
- const idAttr = id ? `id="${escapeHtml2(id)}"` : "";
1481
- return `<div class="alert ${baseClasses}" role="alert" ${idAttr}>
1482
- <div class="flex gap-3">
1483
- ${iconHtml}
1484
- <div class="flex-1">
1485
- ${titleHtml}
1486
- <div class="${title ? "mt-1" : ""}">${escapeHtml2(message)}</div>
1487
- ${actionsHtml}
1488
- </div>
1489
- ${dismissHtml}
1490
- </div>
1491
- </div>`;
1492
- }
1493
- var infoAlert = (message, opts) => alert(message, { ...opts, variant: "info" });
1494
- var successAlert = (message, opts) => alert(message, { ...opts, variant: "success" });
1495
- var warningAlert = (message, opts) => alert(message, { ...opts, variant: "warning" });
1496
- var dangerAlert = (message, opts) => alert(message, { ...opts, variant: "danger" });
1497
- function toast(message, options = {}) {
1498
- const { variant = "info", title, duration = 5e3, position = "top-right", id = `toast-${Date.now()}` } = options;
1499
- const variantClasses = getVariantClasses4(variant);
1500
- const positionClasses = {
1501
- "top-right": "top-4 right-4",
1502
- "top-left": "top-4 left-4",
1503
- "bottom-right": "bottom-4 right-4",
1504
- "bottom-left": "bottom-4 left-4",
1505
- "top-center": "top-4 left-1/2 -translate-x-1/2",
1506
- "bottom-center": "bottom-4 left-1/2 -translate-x-1/2"
1507
- };
1508
- const titleHtml = title ? `<h4 class="font-semibold">${escapeHtml2(title)}</h4>` : "";
1509
- const autoDismissScript = duration > 0 ? `<script>
1510
- setTimeout(() => {
1511
- const toast = document.getElementById('${id}');
1512
- if (toast) {
1513
- toast.classList.add('opacity-0', 'translate-x-2');
1514
- setTimeout(() => toast.remove(), 300);
1515
- }
1516
- }, ${duration});
1517
- </script>` : "";
1518
- return `<div
1519
- id="${escapeHtml2(id)}"
1520
- class="fixed ${positionClasses[position]} z-50 min-w-[300px] max-w-md rounded-lg border shadow-lg ${variantClasses.container} transition-all duration-300 transform"
1521
- role="alert"
1522
- >
1523
- <div class="flex gap-3 p-4">
1524
- <div class="flex-shrink-0 ${variantClasses.icon}">
1525
- ${alertIcons[variant]}
1526
- </div>
1527
- <div class="flex-1">
1528
- ${titleHtml}
1529
- <p class="${title ? "mt-1 text-sm opacity-90" : ""}">${escapeHtml2(message)}</p>
1530
- </div>
1531
- <button
1532
- type="button"
1533
- class="flex-shrink-0 p-1 rounded hover:bg-black/5 transition-colors"
1534
- onclick="this.closest('#${id}').remove()"
1535
- aria-label="Close"
1536
- >
1537
- <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
1538
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
1539
- </svg>
1540
- </button>
1541
- </div>
1542
- </div>
1543
- ${autoDismissScript}`;
1544
- }
1545
- function toastContainer(position = "top-right", id = "toast-container") {
1546
- const positionClasses = {
1547
- "top-right": "top-4 right-4",
1548
- "top-left": "top-4 left-4",
1549
- "bottom-right": "bottom-4 right-4",
1550
- "bottom-left": "bottom-4 left-4",
1551
- "top-center": "top-4 left-1/2 -translate-x-1/2",
1552
- "bottom-center": "bottom-4 left-1/2 -translate-x-1/2"
1553
- };
1554
- return `<div id="${escapeHtml2(id)}" class="fixed ${positionClasses[position]} z-50 flex flex-col gap-2"></div>`;
205
+ );
1555
206
  }
1556
207
 
1557
- // libs/ui/src/components/avatar.ts
1558
- function getSizeClasses4(size) {
1559
- const sizes = {
1560
- xs: { container: "w-6 h-6", text: "text-xs", status: "w-2 h-2 border" },
1561
- sm: { container: "w-8 h-8", text: "text-xs", status: "w-2.5 h-2.5 border" },
1562
- md: { container: "w-10 h-10", text: "text-sm", status: "w-3 h-3 border-2" },
1563
- lg: { container: "w-12 h-12", text: "text-base", status: "w-3.5 h-3.5 border-2" },
1564
- xl: { container: "w-16 h-16", text: "text-lg", status: "w-4 h-4 border-2" },
1565
- "2xl": { container: "w-24 h-24", text: "text-2xl", status: "w-5 h-5 border-2" }
1566
- };
1567
- return sizes[size];
1568
- }
1569
- function getShapeClasses(shape) {
1570
- const shapes = {
1571
- circle: "rounded-full",
1572
- square: "rounded-none",
1573
- rounded: "rounded-lg"
1574
- };
1575
- return shapes[shape];
1576
- }
1577
- function getStatusClasses(status) {
1578
- const statuses = {
1579
- online: "bg-success",
1580
- offline: "bg-gray-400",
1581
- busy: "bg-danger",
1582
- away: "bg-warning",
1583
- none: ""
1584
- };
1585
- return statuses[status];
1586
- }
1587
- function generateInitials(name) {
1588
- const parts = name.trim().split(/\s+/);
1589
- if (parts.length === 1) {
1590
- return parts[0].charAt(0).toUpperCase();
1591
- }
1592
- return (parts[0].charAt(0) + parts[parts.length - 1].charAt(0)).toUpperCase();
1593
- }
1594
- function generateBgColor(name) {
1595
- const colors = [
1596
- "bg-blue-500",
1597
- "bg-green-500",
1598
- "bg-yellow-500",
1599
- "bg-purple-500",
1600
- "bg-pink-500",
1601
- "bg-indigo-500",
1602
- "bg-red-500",
1603
- "bg-orange-500",
1604
- "bg-teal-500",
1605
- "bg-cyan-500"
1606
- ];
1607
- let hash = 0;
1608
- for (let i = 0; i < name.length; i++) {
1609
- hash = name.charCodeAt(i) + ((hash << 5) - hash);
1610
- }
1611
- return colors[Math.abs(hash) % colors.length];
1612
- }
1613
- function avatar(options) {
1614
- const { src, alt, size = "md", shape = "circle", status = "none", className = "", href, initials, bgColor } = options;
1615
- const sizeClasses = getSizeClasses4(size);
1616
- const shapeClasses = getShapeClasses(shape);
1617
- const statusColor = getStatusClasses(status);
1618
- const displayInitials = initials || generateInitials(alt);
1619
- const displayBgColor = bgColor || generateBgColor(alt);
1620
- const containerClasses = [
1621
- "relative inline-flex items-center justify-center",
1622
- "overflow-hidden",
1623
- sizeClasses.container,
1624
- shapeClasses,
1625
- className
1626
- ].filter(Boolean).join(" ");
1627
- const contentHtml = src ? `<img src="${escapeHtml2(src)}" alt="${escapeHtml2(alt)}" class="w-full h-full object-cover">` : `<span class="font-medium text-white ${sizeClasses.text}">${escapeHtml2(displayInitials)}</span>`;
1628
- const bgClasses = src ? "bg-gray-200" : displayBgColor;
1629
- const statusHtml = status !== "none" ? `<span class="absolute bottom-0 right-0 block ${sizeClasses.status} ${shapeClasses} ${statusColor} border-white"></span>` : "";
1630
- const innerHtml = `
1631
- <div class="${containerClasses} ${bgClasses}">
1632
- ${contentHtml}
1633
- ${statusHtml}
1634
- </div>
1635
- `;
1636
- if (href) {
1637
- return `<a href="${escapeHtml2(href)}" class="inline-block">${innerHtml}</a>`;
1638
- }
1639
- return innerHtml;
1640
- }
1641
- function avatarGroup(avatars, options = {}) {
1642
- const { max = 5, size = "md", spacing = "normal", className = "" } = options;
1643
- const spacingClasses = {
1644
- tight: "-space-x-3",
1645
- normal: "-space-x-2",
1646
- loose: "-space-x-1"
1647
- };
1648
- const visibleAvatars = avatars.slice(0, max);
1649
- const remainingCount = avatars.length - max;
1650
- const avatarsHtml = visibleAvatars.map((opts, index) => {
1651
- const avatarHtml = avatar({ ...opts, size });
1652
- return `<div class="relative ring-2 ring-white rounded-full" style="z-index: ${visibleAvatars.length - index}">
1653
- ${avatarHtml}
1654
- </div>`;
1655
- }).join("\n");
1656
- const sizeClasses = getSizeClasses4(size);
1657
- const overflowHtml = remainingCount > 0 ? `<div class="relative ring-2 ring-white rounded-full" style="z-index: 0">
1658
- <div class="${sizeClasses.container} rounded-full bg-gray-200 flex items-center justify-center">
1659
- <span class="${sizeClasses.text} font-medium text-gray-600">+${remainingCount}</span>
1660
- </div>
1661
- </div>` : "";
1662
- return `<div class="flex ${spacingClasses[spacing]} ${className}">
1663
- ${avatarsHtml}
1664
- ${overflowHtml}
1665
- </div>`;
1666
- }
1667
- function avatarWithText(options) {
1668
- const { name, subtitle, align = "left", ...avatarOptions } = options;
1669
- const avatarHtml = avatar({ ...avatarOptions, alt: avatarOptions.alt || name });
1670
- const textHtml = `
1671
- <div class="${align === "right" ? "text-right" : ""}">
1672
- <div class="font-medium text-text-primary">${escapeHtml2(name)}</div>
1673
- ${subtitle ? `<div class="text-sm text-text-secondary">${escapeHtml2(subtitle)}</div>` : ""}
1674
- </div>
1675
- `;
1676
- const flexDirection = align === "right" ? "flex-row-reverse" : "flex-row";
1677
- return `<div class="flex items-center gap-3 ${flexDirection}">
1678
- ${avatarHtml}
1679
- ${textHtml}
1680
- </div>`;
208
+ // libs/ui/src/components/Avatar/Avatar.tsx
209
+ import MuiAvatar from "@mui/material/Avatar";
210
+ import { jsx as jsx5 } from "react/jsx-runtime";
211
+ function Avatar({ src, alt, children, size = 40, variant = "circular" }) {
212
+ return /* @__PURE__ */ jsx5(MuiAvatar, { src, alt, variant, sx: { width: size, height: size }, children });
1681
213
  }
1682
214
 
1683
- // libs/ui/src/components/modal.ts
1684
- function isSafeUrl(url) {
1685
- if (!url) return false;
1686
- const lower = url.toLowerCase().trim();
1687
- const isSafe = lower.startsWith("http://") || lower.startsWith("https://") || lower.startsWith("/") || lower.startsWith("#") || lower.startsWith("mailto:") || lower.startsWith("tel:");
1688
- if (!isSafe) {
1689
- console.warn(`[FrontMCP] Blocked unsafe URL scheme in modal confirmHref: "${url.substring(0, 50)}..."`);
1690
- }
1691
- return isSafe;
1692
- }
1693
- function getSizeClasses5(size) {
1694
- const sizes = {
1695
- sm: "max-w-sm",
1696
- md: "max-w-md",
1697
- lg: "max-w-lg",
1698
- xl: "max-w-2xl",
1699
- full: "max-w-full mx-4"
1700
- };
1701
- return sizes[size];
215
+ // libs/ui/src/components/Modal/Modal.tsx
216
+ import { styled as styled3 } from "@mui/material/styles";
217
+ import Dialog from "@mui/material/Dialog";
218
+ import DialogTitle from "@mui/material/DialogTitle";
219
+ import DialogContent from "@mui/material/DialogContent";
220
+ import DialogActions from "@mui/material/DialogActions";
221
+ import IconButton from "@mui/material/IconButton";
222
+ import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
223
+ var StyledDialogTitle = styled3(DialogTitle, {
224
+ name: "Modal",
225
+ slot: "Title"
226
+ })(({ theme }) => ({
227
+ display: "flex",
228
+ alignItems: "center",
229
+ justifyContent: "space-between",
230
+ fontWeight: 600,
231
+ fontSize: theme.typography.h6.fontSize
232
+ }));
233
+ var StyledDialogContent = styled3(DialogContent, {
234
+ name: "Modal",
235
+ slot: "Content"
236
+ })(({ theme }) => ({
237
+ paddingTop: `${theme.spacing(2)} !important`
238
+ }));
239
+ function Modal({
240
+ open,
241
+ onClose,
242
+ title,
243
+ actions,
244
+ maxWidth = "sm",
245
+ fullWidth = true,
246
+ slotProps,
247
+ children
248
+ }) {
249
+ return /* @__PURE__ */ jsxs3(Dialog, { open, onClose, maxWidth, fullWidth, children: [
250
+ title && /* @__PURE__ */ jsxs3(StyledDialogTitle, { ...slotProps?.title, children: [
251
+ title,
252
+ /* @__PURE__ */ jsx6(IconButton, { onClick: onClose, size: "small", "aria-label": "close", children: "\u2715" })
253
+ ] }),
254
+ /* @__PURE__ */ jsx6(StyledDialogContent, { ...slotProps?.content, children }),
255
+ actions && /* @__PURE__ */ jsx6(DialogActions, { ...slotProps?.actions, children: actions })
256
+ ] });
1702
257
  }
1703
- function modal(content, options) {
1704
- const {
1705
- id,
1706
- title,
1707
- size = "md",
1708
- showClose = true,
1709
- closeOnBackdrop = true,
1710
- closeOnEscape = true,
1711
- footer,
1712
- className = "",
1713
- open = false
1714
- } = options;
1715
- const sizeClasses = getSizeClasses5(size);
1716
- const visibilityClasses = open ? "" : "hidden";
1717
- const headerHtml = title || showClose ? `<div class="flex items-center justify-between p-4 border-b border-divider">
1718
- ${title ? `<h3 class="text-lg font-semibold text-text-primary">${escapeHtml2(title)}</h3>` : "<div></div>"}
1719
- ${showClose ? `
1720
- <button
1721
- type="button"
1722
- class="p-1 rounded-lg text-text-secondary hover:text-text-primary hover:bg-gray-100 transition-colors"
1723
- onclick="document.getElementById('${escapeHtml2(id)}').classList.add('hidden')"
1724
- aria-label="Close"
1725
- >
1726
- <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
1727
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
1728
- </svg>
1729
- </button>
1730
- ` : ""}
1731
- </div>` : "";
1732
- const footerHtml = footer ? `<div class="flex items-center justify-end gap-3 p-4 border-t border-divider">
1733
- ${footer}
1734
- </div>` : "";
1735
- const backdropClickHandler = closeOnBackdrop ? `onclick="if (event.target === this) this.classList.add('hidden')"` : "";
1736
- const escapeHandler = closeOnEscape ? `<script>
1737
- document.addEventListener('keydown', function(e) {
1738
- if (e.key === 'Escape') {
1739
- document.getElementById('${escapeHtml2(id)}')?.classList.add('hidden');
1740
- }
1741
- });
1742
- </script>` : "";
1743
- return `
1744
- <div
1745
- id="${escapeHtml2(id)}"
1746
- class="fixed inset-0 z-50 overflow-y-auto ${visibilityClasses}"
1747
- ${backdropClickHandler}
1748
- role="dialog"
1749
- aria-modal="true"
1750
- aria-labelledby="${escapeHtml2(id)}-title"
1751
- >
1752
- <!-- Backdrop -->
1753
- <div class="fixed inset-0 bg-black/50 transition-opacity"></div>
1754
258
 
1755
- <!-- Modal container -->
1756
- <div class="flex min-h-full items-center justify-center p-4">
1757
- <div class="relative w-full ${sizeClasses} bg-white rounded-xl shadow-xl ${className}">
1758
- ${headerHtml}
1759
- <div class="p-4">
1760
- ${content}
1761
- </div>
1762
- ${footerHtml}
1763
- </div>
1764
- </div>
1765
- </div>
1766
- ${escapeHandler}
1767
- `;
1768
- }
1769
- function modalTrigger(triggerContent, modalId, options = {}) {
1770
- const { className = "", tag = "button" } = options;
1771
- const attrs = `
1772
- class="${className}"
1773
- onclick="document.getElementById('${escapeHtml2(modalId)}').classList.remove('hidden')"
1774
- `;
1775
- if (tag === "button") {
1776
- return `<button type="button" ${attrs}>${triggerContent}</button>`;
1777
- }
1778
- return `<${tag} ${attrs}>${triggerContent}</${tag}>`;
1779
- }
1780
- function confirmModal(options) {
1781
- const {
1782
- id,
1783
- title = "Confirm Action",
1784
- message,
1785
- confirmText = "Confirm",
1786
- cancelText = "Cancel",
1787
- variant = "primary",
1788
- icon,
1789
- confirmHref
1790
- } = options;
1791
- const variantClasses = {
1792
- primary: "bg-primary hover:bg-primary/90 text-white",
1793
- danger: "bg-danger hover:bg-danger/90 text-white",
1794
- warning: "bg-warning hover:bg-warning/90 text-white"
1795
- };
1796
- const iconColors = {
1797
- primary: "text-primary bg-primary/10",
1798
- danger: "text-danger bg-danger/10",
1799
- warning: "text-warning bg-warning/10"
1800
- };
1801
- const defaultIcons = {
1802
- primary: `<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
1803
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/>
1804
- </svg>`,
1805
- danger: `<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
1806
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/>
1807
- </svg>`,
1808
- warning: `<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
1809
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/>
1810
- </svg>`
1811
- };
1812
- const displayIcon = icon || defaultIcons[variant];
1813
- const content = `
1814
- <div class="text-center">
1815
- <div class="mx-auto w-12 h-12 rounded-full ${iconColors[variant]} flex items-center justify-center mb-4">
1816
- ${displayIcon}
1817
- </div>
1818
- <h3 class="text-lg font-semibold text-text-primary mb-2">${escapeHtml2(title)}</h3>
1819
- <p class="text-text-secondary">${escapeHtml2(message)}</p>
1820
- </div>
1821
- `;
1822
- const confirmButton = confirmHref && isSafeUrl(confirmHref) ? `<a
1823
- href="${escapeHtml2(confirmHref)}"
1824
- class="px-4 py-2 rounded-lg ${variantClasses[variant]} transition-colors"
1825
- >
1826
- ${escapeHtml2(confirmText)}
1827
- </a>` : `<button
1828
- type="button"
1829
- class="px-4 py-2 rounded-lg ${variantClasses[variant]} transition-colors"
1830
- onclick="document.getElementById('${escapeHtml2(id)}').classList.add('hidden')"
1831
- >
1832
- ${escapeHtml2(confirmText)}
1833
- </button>`;
1834
- const footer = `
1835
- <button
1836
- type="button"
1837
- class="px-4 py-2 rounded-lg border border-border text-text-primary hover:bg-gray-50 transition-colors"
1838
- onclick="document.getElementById('${escapeHtml2(id)}').classList.add('hidden')"
1839
- >
1840
- ${escapeHtml2(cancelText)}
1841
- </button>
1842
- ${confirmButton}
1843
- `;
1844
- return modal(content, {
1845
- id,
1846
- size: "sm",
1847
- showClose: false,
1848
- footer
1849
- });
259
+ // libs/ui/src/components/Table/Table.tsx
260
+ import { styled as styled4 } from "@mui/material/styles";
261
+ import MuiTable from "@mui/material/Table";
262
+ import TableBody from "@mui/material/TableBody";
263
+ import TableCell from "@mui/material/TableCell";
264
+ import TableContainer from "@mui/material/TableContainer";
265
+ import TableHead from "@mui/material/TableHead";
266
+ import TableRow from "@mui/material/TableRow";
267
+ import Paper from "@mui/material/Paper";
268
+ import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
269
+ var StyledHeaderCell = styled4(TableCell, {
270
+ name: "Table",
271
+ slot: "HeaderCell"
272
+ })(({ theme }) => ({
273
+ fontWeight: 600,
274
+ backgroundColor: theme.palette.mode === "dark" ? theme.palette.grey[900] : theme.palette.grey[50]
275
+ }));
276
+ var StyledBodyCell = styled4(TableCell, {
277
+ name: "Table",
278
+ slot: "BodyCell"
279
+ })({});
280
+ function Table({
281
+ columns,
282
+ rows,
283
+ size = "small",
284
+ stickyHeader = false,
285
+ maxHeight
286
+ }) {
287
+ return /* @__PURE__ */ jsx7(TableContainer, { component: Paper, variant: "outlined", sx: maxHeight ? { maxHeight } : void 0, children: /* @__PURE__ */ jsxs4(MuiTable, { size, stickyHeader, children: [
288
+ /* @__PURE__ */ jsx7(TableHead, { children: /* @__PURE__ */ jsx7(TableRow, { children: columns.map((col) => /* @__PURE__ */ jsx7(StyledHeaderCell, { align: col.align ?? "left", children: col.label }, col.key)) }) }),
289
+ /* @__PURE__ */ jsx7(TableBody, { children: rows.map((row, idx) => /* @__PURE__ */ jsx7(TableRow, { hover: true, children: columns.map((col) => /* @__PURE__ */ jsx7(StyledBodyCell, { align: col.align ?? "left", children: String(row[col.key] ?? "") }, col.key)) }, idx)) })
290
+ ] }) });
1850
291
  }
1851
- function drawer(content, options) {
1852
- const {
1853
- id,
1854
- title,
1855
- position = "right",
1856
- size = "md",
1857
- showClose = true,
1858
- closeOnBackdrop = true,
1859
- footer,
1860
- className = "",
1861
- open = false
1862
- } = options;
1863
- const sizeClasses = {
1864
- left: { sm: "w-64", md: "w-80", lg: "w-96", xl: "w-[32rem]" },
1865
- right: { sm: "w-64", md: "w-80", lg: "w-96", xl: "w-[32rem]" },
1866
- top: { sm: "h-32", md: "h-48", lg: "h-64", xl: "h-96" },
1867
- bottom: { sm: "h-32", md: "h-48", lg: "h-64", xl: "h-96" }
1868
- };
1869
- const positionClasses = {
1870
- left: "inset-y-0 left-0",
1871
- right: "inset-y-0 right-0",
1872
- top: "inset-x-0 top-0",
1873
- bottom: "inset-x-0 bottom-0"
1874
- };
1875
- const fullSizeClasses = {
1876
- left: "h-full",
1877
- right: "h-full",
1878
- top: "w-full",
1879
- bottom: "w-full"
1880
- };
1881
- const visibilityClasses = open ? "" : "hidden";
1882
- const headerHtml = title || showClose ? `<div class="flex items-center justify-between p-4 border-b border-divider">
1883
- ${title ? `<h3 class="text-lg font-semibold text-text-primary">${escapeHtml2(title)}</h3>` : "<div></div>"}
1884
- ${showClose ? `
1885
- <button
1886
- type="button"
1887
- class="p-1 rounded-lg text-text-secondary hover:text-text-primary hover:bg-gray-100 transition-colors"
1888
- onclick="document.getElementById('${escapeHtml2(id)}').classList.add('hidden')"
1889
- aria-label="Close"
1890
- >
1891
- <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
1892
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
1893
- </svg>
1894
- </button>
1895
- ` : ""}
1896
- </div>` : "";
1897
- const footerHtml = footer ? `<div class="p-4 border-t border-divider">${footer}</div>` : "";
1898
- const backdropClickHandler = closeOnBackdrop ? `onclick="if (event.target === this) this.classList.add('hidden')"` : "";
1899
- return `
1900
- <div
1901
- id="${escapeHtml2(id)}"
1902
- class="fixed inset-0 z-50 ${visibilityClasses}"
1903
- ${backdropClickHandler}
1904
- role="dialog"
1905
- aria-modal="true"
1906
- >
1907
- <!-- Backdrop -->
1908
- <div class="fixed inset-0 bg-black/50 transition-opacity"></div>
1909
292
 
1910
- <!-- Drawer -->
1911
- <div class="fixed ${positionClasses[position]} ${sizeClasses[position][size]} ${fullSizeClasses[position]} bg-white shadow-xl flex flex-col ${className}">
1912
- ${headerHtml}
1913
- <div class="flex-1 overflow-y-auto p-4">
1914
- ${content}
1915
- </div>
1916
- ${footerHtml}
1917
- </div>
1918
- </div>
1919
- `;
293
+ // libs/ui/src/components/TextField/TextField.tsx
294
+ import MuiTextField from "@mui/material/TextField";
295
+ import { jsx as jsx8 } from "react/jsx-runtime";
296
+ function TextField({
297
+ label,
298
+ placeholder,
299
+ value,
300
+ defaultValue,
301
+ onChange,
302
+ type = "text",
303
+ multiline = false,
304
+ rows,
305
+ error = false,
306
+ helperText,
307
+ disabled = false,
308
+ required = false,
309
+ fullWidth = true,
310
+ size = "small"
311
+ }) {
312
+ return /* @__PURE__ */ jsx8(
313
+ MuiTextField,
314
+ {
315
+ label,
316
+ placeholder,
317
+ value,
318
+ defaultValue,
319
+ onChange: onChange ? (e) => onChange(e.target.value) : void 0,
320
+ type,
321
+ multiline,
322
+ rows,
323
+ error,
324
+ helperText,
325
+ disabled,
326
+ required,
327
+ fullWidth,
328
+ size,
329
+ variant: "outlined"
330
+ }
331
+ );
1920
332
  }
1921
333
 
1922
- // libs/ui/src/components/table.ts
1923
- function getAlignClasses(align = "left") {
1924
- const alignments = {
1925
- left: "text-left",
1926
- center: "text-center",
1927
- right: "text-right"
1928
- };
1929
- return alignments[align];
1930
- }
1931
- function buildSortIndicator(direction) {
1932
- if (direction === "asc") {
1933
- return `<svg class="w-4 h-4 ml-1 inline-block" fill="none" stroke="currentColor" viewBox="0 0 24 24">
1934
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 15l7-7 7 7"/>
1935
- </svg>`;
1936
- }
1937
- if (direction === "desc") {
1938
- return `<svg class="w-4 h-4 ml-1 inline-block" fill="none" stroke="currentColor" viewBox="0 0 24 24">
1939
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"/>
1940
- </svg>`;
1941
- }
1942
- return `<svg class="w-4 h-4 ml-1 inline-block opacity-30" fill="none" stroke="currentColor" viewBox="0 0 24 24">
1943
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16V4m0 0L3 8m4-4l4 4m6 0v12m0 0l4-4m-4 4l-4-4"/>
1944
- </svg>`;
1945
- }
1946
- function buildTableHeader(columns, options) {
1947
- const { selectable, compact } = options;
1948
- const paddingClass = compact ? "px-3 py-2" : "px-4 py-3";
1949
- const selectAllCell = selectable ? `<th class="${paddingClass} w-12">
1950
- <input
1951
- type="checkbox"
1952
- class="w-4 h-4 rounded border-border text-primary focus:ring-primary/20"
1953
- aria-label="Select all"
1954
- >
1955
- </th>` : "";
1956
- const headerCells = columns.map((col) => {
1957
- const alignClass = getAlignClasses(col.align);
1958
- const widthStyle = col.width ? `style="width: ${col.width}"` : "";
1959
- const sortableClasses = col.sortable ? "cursor-pointer hover:bg-gray-50" : "";
1960
- return `<th
1961
- class="${paddingClass} ${alignClass} font-semibold text-text-primary ${sortableClasses} ${col.headerClass || ""}"
1962
- ${widthStyle}
1963
- >
1964
- ${col.sortable ? `<span class="inline-flex items-center">${escapeHtml2(col.header)}${buildSortIndicator(
1965
- col.sortDirection || null
1966
- )}</span>` : escapeHtml2(col.header)}
1967
- </th>`;
1968
- }).join("\n");
1969
- return `<thead class="bg-gray-50 border-b border-border">
1970
- <tr>
1971
- ${selectAllCell}
1972
- ${headerCells}
1973
- </tr>
1974
- </thead>`;
1975
- }
1976
- function buildTableBody(data, columns, options) {
1977
- const { selectable, hoverable, striped, bordered, compact, rowKey = "id", onRowClick } = options;
1978
- const paddingClass = compact ? "px-3 py-2" : "px-4 py-3";
1979
- if (data.length === 0) {
1980
- const colspan = columns.length + (selectable ? 1 : 0);
1981
- const emptyContent = options.emptyContent || `
1982
- <div class="text-center py-8">
1983
- <svg class="w-12 h-12 mx-auto text-gray-300 mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
1984
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"/>
1985
- </svg>
1986
- <p class="text-text-secondary">${options.emptyMessage || "No data available"}</p>
1987
- </div>
1988
- `;
1989
- return `<tbody>
1990
- <tr>
1991
- <td colspan="${colspan}">${emptyContent}</td>
1992
- </tr>
1993
- </tbody>`;
1994
- }
1995
- const rows = data.map((row, rowIndex) => {
1996
- const rowId = String(row[rowKey] || rowIndex);
1997
- const rowClasses = [
1998
- hoverable ? "hover:bg-gray-50" : "",
1999
- striped && rowIndex % 2 === 1 ? "bg-gray-50/50" : "",
2000
- bordered ? "border-b border-border" : "",
2001
- onRowClick ? "cursor-pointer" : ""
2002
- ].filter(Boolean).join(" ");
2003
- const clickHandler = onRowClick ? `onclick="window.location.href='${escapeHtml2(onRowClick.replace("{key}", rowId))}'"` : "";
2004
- const selectCell = selectable ? `<td class="${paddingClass}" onclick="event.stopPropagation()">
2005
- <input
2006
- type="checkbox"
2007
- class="w-4 h-4 rounded border-border text-primary focus:ring-primary/20"
2008
- name="selected[]"
2009
- value="${escapeHtml2(rowId)}"
2010
- aria-label="Select row"
2011
- >
2012
- </td>` : "";
2013
- const cells = columns.map((col) => {
2014
- const value = row[col.key];
2015
- const alignClass = getAlignClasses(col.align);
2016
- const cellContent = col.render ? col.render(value, row, rowIndex) : escapeHtml2(String(value ?? ""));
2017
- return `<td class="${paddingClass} ${alignClass} ${col.cellClass || ""}">${cellContent}</td>`;
2018
- }).join("\n");
2019
- return `<tr class="${rowClasses}" ${clickHandler}>
2020
- ${selectCell}
2021
- ${cells}
2022
- </tr>`;
2023
- }).join("\n");
2024
- return `<tbody class="divide-y divide-border">${rows}</tbody>`;
2025
- }
2026
- function buildLoadingOverlay() {
2027
- return `<div class="absolute inset-0 bg-white/70 flex items-center justify-center">
2028
- <svg class="animate-spin w-8 h-8 text-primary" fill="none" viewBox="0 0 24 24">
2029
- <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
2030
- <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
2031
- </svg>
2032
- </div>`;
2033
- }
2034
- function table(data, options) {
2035
- const { id, bordered, stickyHeader, className = "", loading = false } = options;
2036
- const tableClasses = ["w-full", bordered ? "border border-border" : "", "text-sm"].filter(Boolean).join(" ");
2037
- const wrapperClasses = ["relative overflow-x-auto", stickyHeader ? "max-h-96 overflow-y-auto" : "", className].filter(Boolean).join(" ");
2038
- const idAttr = id ? `id="${escapeHtml2(id)}"` : "";
2039
- const header = buildTableHeader(options.columns, options);
2040
- const body = buildTableBody(data, options.columns, options);
2041
- const loadingOverlay = loading ? buildLoadingOverlay() : "";
2042
- return `<div class="${wrapperClasses}" ${idAttr}>
2043
- <table class="${tableClasses}">
2044
- ${header}
2045
- ${body}
2046
- </table>
2047
- ${loadingOverlay}
2048
- </div>`;
2049
- }
2050
- function pagination(options) {
2051
- const {
2052
- page,
2053
- totalPages,
2054
- totalItems,
2055
- pageSize = 10,
2056
- showPageSize = false,
2057
- pageSizeOptions = [10, 25, 50, 100],
2058
- className = "",
2059
- baseUrl = ""
2060
- } = options;
2061
- const buildPageLink = (pageNum, label, disabled, active) => {
2062
- const baseClasses = "px-3 py-2 text-sm rounded-lg transition-colors";
2063
- const stateClasses = disabled ? "text-gray-300 cursor-not-allowed" : active ? "bg-primary text-white" : "text-text-primary hover:bg-gray-100";
2064
- if (disabled) {
2065
- return `<span class="${baseClasses} ${stateClasses}">${label}</span>`;
2066
- }
2067
- const pageUrl = baseUrl ? `${baseUrl}${baseUrl.includes("?") ? "&" : "?"}page=${pageNum}` : `?page=${pageNum}`;
2068
- return `<a href="${escapeHtml2(pageUrl)}" class="${baseClasses} ${stateClasses}">${label}</a>`;
2069
- };
2070
- const pageNumbers = [];
2071
- const maxVisible = 5;
2072
- if (totalPages <= maxVisible) {
2073
- for (let i = 1; i <= totalPages; i++) {
2074
- pageNumbers.push(i);
2075
- }
2076
- } else {
2077
- pageNumbers.push(1);
2078
- let start = Math.max(2, page - 1);
2079
- let end = Math.min(totalPages - 1, page + 1);
2080
- if (page <= 2) {
2081
- end = 4;
2082
- } else if (page >= totalPages - 1) {
2083
- start = totalPages - 3;
334
+ // libs/ui/src/components/Select/Select.tsx
335
+ import MuiTextField2 from "@mui/material/TextField";
336
+ import MenuItem from "@mui/material/MenuItem";
337
+ import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
338
+ function Select({
339
+ label,
340
+ value,
341
+ defaultValue,
342
+ onChange,
343
+ options,
344
+ placeholder,
345
+ error = false,
346
+ helperText,
347
+ disabled = false,
348
+ required = false,
349
+ fullWidth = true,
350
+ size = "small"
351
+ }) {
352
+ return /* @__PURE__ */ jsxs5(
353
+ MuiTextField2,
354
+ {
355
+ select: true,
356
+ label,
357
+ value,
358
+ defaultValue,
359
+ onChange: onChange ? (e) => onChange(e.target.value) : void 0,
360
+ error,
361
+ helperText,
362
+ disabled,
363
+ required,
364
+ fullWidth,
365
+ size,
366
+ variant: "outlined",
367
+ ...placeholder ? { SelectProps: { displayEmpty: true } } : {},
368
+ children: [
369
+ placeholder && /* @__PURE__ */ jsx9(MenuItem, { value: "", disabled: true, children: placeholder }),
370
+ options.map((opt) => /* @__PURE__ */ jsx9(MenuItem, { value: opt.value, children: opt.label }, opt.value))
371
+ ]
2084
372
  }
2085
- if (start > 2) {
2086
- pageNumbers.push(-1);
2087
- }
2088
- for (let i = start; i <= end; i++) {
2089
- pageNumbers.push(i);
2090
- }
2091
- if (end < totalPages - 1) {
2092
- pageNumbers.push(-1);
2093
- }
2094
- pageNumbers.push(totalPages);
2095
- }
2096
- const pagesHtml = pageNumbers.map((num) => {
2097
- if (num === -1) {
2098
- return '<span class="px-2 py-2 text-text-secondary">...</span>';
2099
- }
2100
- return buildPageLink(num, String(num), false, num === page);
2101
- }).join("\n");
2102
- const prevLink = buildPageLink(page - 1, "&larr; Previous", page <= 1, false);
2103
- const nextLink = buildPageLink(page + 1, "Next &rarr;", page >= totalPages, false);
2104
- const infoHtml = totalItems !== void 0 ? `<span class="text-sm text-text-secondary">
2105
- Showing ${(page - 1) * pageSize + 1} to ${Math.min(page * pageSize, totalItems)} of ${totalItems} results
2106
- </span>` : "";
2107
- const pageSizeHtml = showPageSize ? `<select
2108
- class="ml-4 px-2 py-1 text-sm border border-border rounded-lg bg-white"
2109
- onchange="window.location.href = '${baseUrl}${baseUrl.includes("?") ? "&" : "?"}page=1&pageSize=' + this.value"
2110
- >
2111
- ${pageSizeOptions.map((size) => `<option value="${size}" ${size === pageSize ? "selected" : ""}>${size} per page</option>`).join("")}
2112
- </select>` : "";
2113
- return `<div class="flex items-center justify-between ${className}">
2114
- <div class="flex items-center">
2115
- ${infoHtml}
2116
- ${pageSizeHtml}
2117
- </div>
2118
- <div class="flex items-center gap-1">
2119
- ${prevLink}
2120
- ${pagesHtml}
2121
- ${nextLink}
2122
- </div>
2123
- </div>`;
373
+ );
2124
374
  }
2125
375
 
2126
- // libs/ui/src/components/list.ts
2127
- var permissionIcons = {
2128
- read: `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
2129
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/>
2130
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"/>
2131
- </svg>`,
2132
- write: `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
2133
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"/>
2134
- </svg>`,
2135
- delete: `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
2136
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/>
2137
- </svg>`,
2138
- profile: `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
2139
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"/>
2140
- </svg>`,
2141
- email: `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
2142
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"/>
2143
- </svg>`,
2144
- settings: `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
2145
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"/>
2146
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/>
2147
- </svg>`,
2148
- default: `<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
2149
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"/>
2150
- </svg>`
2151
- };
2152
- function getPermissionIcon(scope, customIcon) {
2153
- if (customIcon) return customIcon;
2154
- const scopeLower = scope.toLowerCase();
2155
- if (scopeLower.includes("read")) return permissionIcons["read"];
2156
- if (scopeLower.includes("write") || scopeLower.includes("create") || scopeLower.includes("update"))
2157
- return permissionIcons["write"];
2158
- if (scopeLower.includes("delete")) return permissionIcons["delete"];
2159
- if (scopeLower.includes("profile")) return permissionIcons["profile"];
2160
- if (scopeLower.includes("email")) return permissionIcons["email"];
2161
- if (scopeLower.includes("settings") || scopeLower.includes("config")) return permissionIcons["settings"];
2162
- return permissionIcons["default"];
376
+ // libs/ui/src/components/List/List.tsx
377
+ import React3 from "react";
378
+ import MuiList from "@mui/material/List";
379
+ import ListItem from "@mui/material/ListItem";
380
+ import ListItemButton from "@mui/material/ListItemButton";
381
+ import ListItemIcon from "@mui/material/ListItemIcon";
382
+ import ListItemText from "@mui/material/ListItemText";
383
+ import Divider from "@mui/material/Divider";
384
+ import { Fragment, jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
385
+ function List({ items, dense = false }) {
386
+ return /* @__PURE__ */ jsx10(MuiList, { dense, children: items.map((item) => {
387
+ const content = /* @__PURE__ */ jsxs6(Fragment, { children: [
388
+ item.icon && /* @__PURE__ */ jsx10(ListItemIcon, { children: item.icon }),
389
+ /* @__PURE__ */ jsx10(ListItemText, { primary: item.primary, secondary: item.secondary })
390
+ ] });
391
+ return /* @__PURE__ */ jsxs6(React3.Fragment, { children: [
392
+ item.onClick ? /* @__PURE__ */ jsx10(ListItemButton, { onClick: item.onClick, children: content }) : /* @__PURE__ */ jsx10(ListItem, { children: content }),
393
+ item.divider && /* @__PURE__ */ jsx10(Divider, {})
394
+ ] }, item.id);
395
+ }) });
2163
396
  }
2164
- function permissionList(permissions, options = {}) {
2165
- const { id, checkable = false, inputName = "scopes", title, className = "" } = options;
2166
- const titleHtml = title ? `<h4 class="font-medium text-text-primary mb-3">${escapeHtml2(title)}</h4>` : "";
2167
- const itemsHtml = permissions.map((perm, index) => {
2168
- const icon = getPermissionIcon(perm.scope, perm.icon);
2169
- const sensitiveClasses = perm.sensitive ? "border-warning/30 bg-warning/5" : "border-border";
2170
- const sensitiveLabel = perm.sensitive ? '<span class="text-xs text-warning font-medium ml-2">Sensitive</span>' : "";
2171
- const checkboxHtml = checkable ? `<input
2172
- type="checkbox"
2173
- name="${escapeHtml2(inputName)}[]"
2174
- value="${escapeHtml2(perm.scope)}"
2175
- class="w-4 h-4 rounded border-border text-primary focus:ring-primary/20"
2176
- ${perm.checked || perm.required ? "checked" : ""}
2177
- ${perm.required ? "disabled" : ""}
2178
- id="${id ? escapeHtml2(id) : "perm"}-${index}"
2179
- >` : `<div class="w-5 h-5 rounded-full bg-success/10 text-success flex items-center justify-center">
2180
- <svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
2181
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="3" d="M5 13l4 4L19 7"/>
2182
- </svg>
2183
- </div>`;
2184
- return `<div class="flex items-start gap-3 p-3 border ${sensitiveClasses} rounded-lg">
2185
- <div class="flex-shrink-0 mt-0.5 text-text-secondary">
2186
- ${icon}
2187
- </div>
2188
- <div class="flex-1 min-w-0">
2189
- <div class="flex items-center">
2190
- <span class="font-medium text-text-primary">${escapeHtml2(perm.name)}</span>
2191
- ${perm.required ? '<span class="text-xs text-text-secondary ml-2">(Required)</span>' : ""}
2192
- ${sensitiveLabel}
2193
- </div>
2194
- ${perm.description ? `<p class="text-sm text-text-secondary mt-0.5">${escapeHtml2(perm.description)}</p>` : ""}
2195
- </div>
2196
- <div class="flex-shrink-0">
2197
- ${checkboxHtml}
2198
- </div>
2199
- </div>`;
2200
- }).join("\n");
2201
- const idAttr = id ? `id="${escapeHtml2(id)}"` : "";
2202
- return `<div class="permission-list ${className}" ${idAttr}>
2203
- ${titleHtml}
2204
- <div class="space-y-2">
2205
- ${itemsHtml}
2206
- </div>
2207
- </div>`;
2208
- }
2209
- function featureList(features, options = {}) {
2210
- const { style = "check", includedIcon, excludedIcon, className = "" } = options;
2211
- const defaultIncludedIcon = `<svg class="w-5 h-5 text-success" fill="none" stroke="currentColor" viewBox="0 0 24 24">
2212
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
2213
- </svg>`;
2214
- const defaultExcludedIcon = `<svg class="w-5 h-5 text-gray-300" fill="none" stroke="currentColor" viewBox="0 0 24 24">
2215
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
2216
- </svg>`;
2217
- const itemsHtml = features.map((feature, index) => {
2218
- const included = feature.included !== false;
2219
- let iconHtml;
2220
- if (style === "check") {
2221
- iconHtml = included ? includedIcon || defaultIncludedIcon : excludedIcon || defaultExcludedIcon;
2222
- } else if (style === "bullet") {
2223
- iconHtml = `<span class="w-2 h-2 rounded-full ${included ? "bg-primary" : "bg-gray-300"}"></span>`;
2224
- } else {
2225
- iconHtml = `<span class="text-sm font-medium ${included ? "text-primary" : "text-gray-400"}">${index + 1}.</span>`;
2226
- }
2227
- const textClasses = included ? "text-text-primary" : "text-text-secondary line-through";
2228
- return `<li class="flex items-start gap-3">
2229
- <div class="flex-shrink-0 mt-0.5">${iconHtml}</div>
2230
- <div class="flex-1">
2231
- <span class="${textClasses}">${escapeHtml2(feature.name)}</span>
2232
- ${feature.description ? `<p class="text-sm text-text-secondary">${escapeHtml2(feature.description)}</p>` : ""}
2233
- </div>
2234
- </li>`;
2235
- }).join("\n");
2236
- return `<ul class="space-y-3 ${className}">${itemsHtml}</ul>`;
397
+
398
+ // libs/ui/src/components/Loader/Loader.tsx
399
+ import Box from "@mui/material/Box";
400
+ import CircularProgress2 from "@mui/material/CircularProgress";
401
+ import LinearProgress from "@mui/material/LinearProgress";
402
+ import Skeleton from "@mui/material/Skeleton";
403
+ import Backdrop from "@mui/material/Backdrop";
404
+ import Typography from "@mui/material/Typography";
405
+ import { styled as styled5 } from "@mui/material/styles";
406
+
407
+ // libs/ui/src/components/Loader/LoaderContext.tsx
408
+ import { createContext, useContext, useMemo } from "react";
409
+ import { jsx as jsx11 } from "react/jsx-runtime";
410
+ var LoaderContext = createContext({});
411
+ function LoaderProvider({
412
+ custom,
413
+ children
414
+ }) {
415
+ const value = useMemo(() => ({ customLoader: custom }), [custom]);
416
+ return /* @__PURE__ */ jsx11(LoaderContext.Provider, { value, children });
417
+ }
418
+ function useLoaderContext() {
419
+ return useContext(LoaderContext);
2237
420
  }
2238
- function descriptionList(items, options = {}) {
2239
- const { layout = "stacked", dividers = false, className = "" } = options;
2240
- const copyScript = `
2241
- <script>
2242
- function copyToClipboard(text, btn) {
2243
- navigator.clipboard.writeText(text).then(() => {
2244
- const originalText = btn.innerHTML;
2245
- btn.innerHTML = '<svg class="w-4 h-4 text-success" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/></svg>';
2246
- setTimeout(() => btn.innerHTML = originalText, 2000);
2247
- });
2248
- }
2249
- </script>
2250
- `;
2251
- const hasCopyable = items.some((item) => item.copyable);
2252
- if (layout === "horizontal") {
2253
- const itemsHtml2 = items.map((item) => {
2254
- const copyBtn = item.copyable ? `<button type="button" onclick="copyToClipboard('${escapeHtml2(
2255
- item.description
2256
- )}', this)" class="ml-2 p-1 rounded hover:bg-gray-100 transition-colors">
2257
- <svg class="w-4 h-4 text-text-secondary" fill="none" stroke="currentColor" viewBox="0 0 24 24">
2258
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"/>
2259
- </svg>
2260
- </button>` : "";
2261
- return `<div class="py-3 sm:grid sm:grid-cols-3 sm:gap-4 ${dividers ? "border-b border-divider" : ""}">
2262
- <dt class="text-sm font-medium text-text-secondary">${escapeHtml2(item.term)}</dt>
2263
- <dd class="mt-1 sm:mt-0 sm:col-span-2 text-sm text-text-primary flex items-center">
2264
- ${escapeHtml2(item.description)}
2265
- ${copyBtn}
2266
- </dd>
2267
- </div>`;
2268
- }).join("\n");
2269
- return `<dl class="${className}">${itemsHtml2}</dl>${hasCopyable ? copyScript : ""}`;
2270
- }
2271
- if (layout === "grid") {
2272
- const itemsHtml2 = items.map((item) => {
2273
- const copyBtn = item.copyable ? `<button type="button" onclick="copyToClipboard('${escapeHtml2(
2274
- item.description
2275
- )}', this)" class="absolute top-2 right-2 p-1 rounded hover:bg-gray-100 transition-colors">
2276
- <svg class="w-4 h-4 text-text-secondary" fill="none" stroke="currentColor" viewBox="0 0 24 24">
2277
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"/>
2278
- </svg>
2279
- </button>` : "";
2280
- return `<div class="relative p-4 bg-gray-50 rounded-lg">
2281
- <dt class="text-sm font-medium text-text-secondary">${escapeHtml2(item.term)}</dt>
2282
- <dd class="mt-1 text-sm text-text-primary font-medium">${escapeHtml2(item.description)}</dd>
2283
- ${copyBtn}
2284
- </div>`;
2285
- }).join("\n");
2286
- return `<dl class="grid grid-cols-2 gap-4 ${className}">${itemsHtml2}</dl>${hasCopyable ? copyScript : ""}`;
421
+
422
+ // libs/ui/src/components/Loader/Loader.tsx
423
+ import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
424
+ var LoaderRoot = styled5(Box, {
425
+ name: "FrontMcpLoader",
426
+ slot: "Root"
427
+ })({
428
+ display: "inline-flex",
429
+ flexDirection: "column",
430
+ alignItems: "center",
431
+ gap: 8
432
+ });
433
+ var BarRoot = styled5(Box, {
434
+ name: "FrontMcpLoader",
435
+ slot: "Bar"
436
+ })({
437
+ width: "100%",
438
+ display: "flex",
439
+ flexDirection: "column",
440
+ gap: 4
441
+ });
442
+ var OverlayRoot = styled5(Box, {
443
+ name: "FrontMcpLoader",
444
+ slot: "Overlay"
445
+ })({
446
+ position: "relative"
447
+ });
448
+ function Loader({
449
+ variant = "spinner",
450
+ determinate = false,
451
+ value,
452
+ size = 40,
453
+ color = "primary",
454
+ label,
455
+ skeletonShape = "text",
456
+ skeletonWidth,
457
+ skeletonHeight,
458
+ skeletonLines = 1,
459
+ open = true,
460
+ contained = false,
461
+ children,
462
+ custom
463
+ }) {
464
+ const { customLoader } = useLoaderContext();
465
+ const renderFn = custom ?? customLoader;
466
+ if (renderFn) {
467
+ return renderFn({ variant, label, value });
2287
468
  }
2288
- const itemsHtml = items.map((item) => {
2289
- const copyBtn = item.copyable ? `<button type="button" onclick="copyToClipboard('${escapeHtml2(
2290
- item.description
2291
- )}', this)" class="ml-2 p-1 rounded hover:bg-gray-100 transition-colors">
2292
- <svg class="w-4 h-4 text-text-secondary" fill="none" stroke="currentColor" viewBox="0 0 24 24">
2293
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"/>
2294
- </svg>
2295
- </button>` : "";
2296
- return `<div class="${dividers ? "py-3 border-b border-divider last:border-0" : "py-2"}">
2297
- <dt class="text-sm text-text-secondary">${escapeHtml2(item.term)}</dt>
2298
- <dd class="mt-1 text-sm text-text-primary font-medium flex items-center">
2299
- ${escapeHtml2(item.description)}
2300
- ${copyBtn}
2301
- </dd>
2302
- </div>`;
2303
- }).join("\n");
2304
- return `<dl class="${className}">${itemsHtml}</dl>${hasCopyable ? copyScript : ""}`;
2305
- }
2306
- function actionList(items, className = "") {
2307
- const itemsHtml = items.map((item) => {
2308
- const baseClasses = [
2309
- "flex items-center gap-3 px-4 py-3 transition-colors",
2310
- item.disabled ? "opacity-50 cursor-not-allowed" : item.destructive ? "hover:bg-danger/5 text-danger cursor-pointer" : "hover:bg-gray-50 cursor-pointer"
2311
- ].join(" ");
2312
- const iconHtml = item.icon ? `<span class="flex-shrink-0 ${item.destructive ? "text-danger" : "text-text-secondary"}">${item.icon}</span>` : "";
2313
- const contentHtml = `
2314
- ${iconHtml}
2315
- <div class="flex-1 min-w-0">
2316
- <div class="font-medium ${item.destructive ? "text-danger" : "text-text-primary"}">${escapeHtml2(
2317
- item.label
2318
- )}</div>
2319
- ${item.description ? `<p class="text-sm text-text-secondary">${escapeHtml2(item.description)}</p>` : ""}
2320
- </div>
2321
- <svg class="w-5 h-5 text-text-secondary" fill="none" stroke="currentColor" viewBox="0 0 24 24">
2322
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"/>
2323
- </svg>
2324
- `;
2325
- if (item.disabled) {
2326
- return `<div class="${baseClasses}">${contentHtml}</div>`;
2327
- }
2328
- if (item.href) {
2329
- return `<a href="${escapeHtml2(item.href)}" class="${baseClasses}">${contentHtml}</a>`;
469
+ switch (variant) {
470
+ case "bar":
471
+ return /* @__PURE__ */ jsxs7(BarRoot, { children: [
472
+ /* @__PURE__ */ jsx12(
473
+ LinearProgress,
474
+ {
475
+ variant: determinate ? "determinate" : "indeterminate",
476
+ value: determinate ? value : void 0,
477
+ color
478
+ }
479
+ ),
480
+ label && /* @__PURE__ */ jsx12(Typography, { variant: "caption", color: "text.secondary", children: label })
481
+ ] });
482
+ case "skeleton": {
483
+ const lines = Math.max(1, skeletonLines);
484
+ return /* @__PURE__ */ jsx12(Box, { children: Array.from({ length: lines }, (_, i) => /* @__PURE__ */ jsx12(
485
+ Skeleton,
486
+ {
487
+ variant: skeletonShape,
488
+ width: skeletonWidth ?? (skeletonShape === "circular" ? 40 : "100%"),
489
+ height: skeletonHeight ?? (skeletonShape === "circular" ? 40 : void 0),
490
+ animation: "wave"
491
+ },
492
+ i
493
+ )) });
2330
494
  }
2331
- return `<div class="${baseClasses}">${contentHtml}</div>`;
2332
- }).join("\n");
2333
- return `<div class="divide-y divide-divider ${className}">${itemsHtml}</div>`;
495
+ case "overlay":
496
+ return /* @__PURE__ */ jsxs7(OverlayRoot, { children: [
497
+ children,
498
+ /* @__PURE__ */ jsxs7(
499
+ Backdrop,
500
+ {
501
+ open,
502
+ sx: {
503
+ position: contained ? "absolute" : "fixed",
504
+ zIndex: (theme) => theme.zIndex.drawer + 1,
505
+ color: "#fff",
506
+ flexDirection: "column",
507
+ gap: 1
508
+ },
509
+ children: [
510
+ /* @__PURE__ */ jsx12(CircularProgress2, { color: "inherit", size }),
511
+ label && /* @__PURE__ */ jsx12(Typography, { variant: "body2", color: "inherit", children: label })
512
+ ]
513
+ }
514
+ )
515
+ ] });
516
+ case "spinner":
517
+ default:
518
+ return /* @__PURE__ */ jsxs7(LoaderRoot, { children: [
519
+ /* @__PURE__ */ jsx12(
520
+ CircularProgress2,
521
+ {
522
+ variant: determinate ? "determinate" : "indeterminate",
523
+ value: determinate ? value : void 0,
524
+ size,
525
+ color
526
+ }
527
+ ),
528
+ label && /* @__PURE__ */ jsx12(Typography, { variant: "caption", color: "text.secondary", children: label })
529
+ ] });
530
+ }
2334
531
  }
2335
532
  export {
2336
- ActionItemSchema,
2337
- ActionListOptionsSchema,
2338
- AlertOptionsSchema,
2339
- AlertVariantSchema,
2340
- AvatarGroupOptionsSchema,
2341
- AvatarOptionsSchema,
2342
- AvatarShapeSchema,
2343
- AvatarSizeSchema,
2344
- AvatarSpacingSchema,
2345
- AvatarStatusSchema,
2346
- AvatarWithTextOptionsSchema,
2347
- BadgeGroupOptionsSchema,
2348
- BadgeOptionsSchema,
2349
- BadgeSizeSchema,
2350
- BadgeVariantSchema,
2351
- ButtonGroupOptionsSchema,
2352
- ButtonOptionsSchema,
2353
- ButtonSizeSchema,
2354
- ButtonVariantSchema,
2355
- CardGroupOptionsSchema,
2356
- CardOptionsSchema,
2357
- CardSizeSchema,
2358
- CardVariantSchema,
2359
- CheckboxOptionsSchema,
2360
- ConfirmModalOptionsSchema,
2361
- ConfirmModalVariantSchema,
2362
- DescriptionItemSchema,
2363
- DescriptionListOptionsSchema,
2364
- DrawerOptionsSchema,
2365
- DrawerPositionSchema,
2366
- FeatureItemSchema,
2367
- FeatureListOptionsSchema,
2368
- FormActionsOptionsSchema,
2369
- FormEnctypeSchema,
2370
- FormMethodSchema,
2371
- FormOptionsSchema,
2372
- FormRowOptionsSchema,
2373
- FormSectionOptionsSchema,
2374
- InputOptionsSchema,
2375
- InputSizeSchema,
2376
- InputStateSchema,
2377
- InputTypeSchema,
2378
- ModalOptionsSchema,
2379
- ModalSizeSchema,
2380
- ModalTriggerOptionsSchema,
2381
- PaginationOptionsSchema,
2382
- PermissionItemSchema,
2383
- PermissionListOptionsSchema,
2384
- RadioGroupOptionsSchema,
2385
- RadioOptionItemSchema,
2386
- SelectOptionItemSchema,
2387
- SelectOptionsSchema,
2388
- TableAlignSchema,
2389
- TableColumnSchema,
2390
- TableOptionsSchema,
2391
- TableSortDirectionSchema,
2392
- TextareaOptionsSchema,
2393
- TextareaResizeSchema,
2394
- ToastOptionsSchema,
2395
- ToastPositionSchema,
2396
- actionList,
2397
- activeBadge,
2398
- alert,
2399
- avatar,
2400
- avatarGroup,
2401
- avatarWithText,
2402
- awayDot,
2403
- badge,
2404
- badgeGroup,
2405
- betaBadge,
2406
- busyDot,
2407
- button,
2408
- buttonGroup,
2409
- card,
2410
- cardGroup,
2411
- checkbox,
2412
- confirmModal,
2413
- csrfInput,
2414
- dangerAlert,
2415
- dangerButton,
2416
- descriptionList,
2417
- drawer,
2418
- errorBadge,
2419
- featureList,
2420
- form,
2421
- formActions,
2422
- formRow,
2423
- formSection,
2424
- ghostButton,
2425
- hiddenInput,
2426
- inactiveBadge,
2427
- infoAlert,
2428
- input,
2429
- linkButton,
2430
- modal,
2431
- modalTrigger,
2432
- newBadge,
2433
- offlineDot,
2434
- onlineDot,
2435
- outlineButton,
2436
- pagination,
2437
- pendingBadge,
2438
- permissionList,
2439
- primaryButton,
2440
- radioGroup,
2441
- secondaryButton,
2442
- select,
2443
- successAlert,
2444
- table,
2445
- textarea,
2446
- toast,
2447
- toastContainer,
2448
- warningAlert
533
+ Alert,
534
+ Avatar,
535
+ Badge,
536
+ Button,
537
+ Card,
538
+ List,
539
+ Loader,
540
+ LoaderContext,
541
+ LoaderProvider,
542
+ Modal,
543
+ Select,
544
+ Table,
545
+ TextField,
546
+ useLoaderContext
2449
547
  };