@qwickapps/react-framework 1.3.4 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (325) hide show
  1. package/README.md +1688 -2
  2. package/dist/__tests__/schemas/transformers/MockSerializableComponent.d.ts +66 -0
  3. package/dist/__tests__/schemas/transformers/MockSerializableComponent.d.ts.map +1 -0
  4. package/dist/components/ErrorBoundary.d.ts +7 -0
  5. package/dist/components/ErrorBoundary.d.ts.map +1 -1
  6. package/dist/components/Html.d.ts +28 -18
  7. package/dist/components/Html.d.ts.map +1 -1
  8. package/dist/components/Logo.d.ts +12 -35
  9. package/dist/components/Logo.d.ts.map +1 -1
  10. package/dist/components/Markdown.d.ts +18 -13
  11. package/dist/components/Markdown.d.ts.map +1 -1
  12. package/dist/components/QwickApp.d.ts +16 -3
  13. package/dist/components/QwickApp.d.ts.map +1 -1
  14. package/dist/components/QwickIcon.d.ts +23 -0
  15. package/dist/components/QwickIcon.d.ts.map +1 -0
  16. package/dist/components/SafeSpan.d.ts +12 -5
  17. package/dist/components/SafeSpan.d.ts.map +1 -1
  18. package/dist/components/Scaffold.d.ts.map +1 -1
  19. package/dist/components/base/ModelView.d.ts +101 -0
  20. package/dist/components/base/ModelView.d.ts.map +1 -0
  21. package/dist/components/base/index.d.ts +11 -0
  22. package/dist/components/base/index.d.ts.map +1 -0
  23. package/dist/components/blocks/Article.d.ts +12 -2
  24. package/dist/components/blocks/Article.d.ts.map +1 -1
  25. package/dist/components/blocks/Code.d.ts +13 -2
  26. package/dist/components/blocks/Code.d.ts.map +1 -1
  27. package/dist/components/blocks/Content.d.ts.map +1 -1
  28. package/dist/components/blocks/CoverImageHeader.d.ts.map +1 -1
  29. package/dist/components/blocks/FeatureCard.d.ts.map +1 -1
  30. package/dist/components/blocks/FeatureGrid.d.ts.map +1 -1
  31. package/dist/components/blocks/Footer.d.ts.map +1 -1
  32. package/dist/components/blocks/HeroBlock.d.ts +27 -13
  33. package/dist/components/blocks/HeroBlock.d.ts.map +1 -1
  34. package/dist/components/blocks/Image.d.ts +41 -0
  35. package/dist/components/blocks/Image.d.ts.map +1 -0
  36. package/dist/components/blocks/PageBannerHeader.d.ts.map +1 -1
  37. package/dist/components/blocks/ProductCard.d.ts.map +1 -1
  38. package/dist/components/blocks/Section.d.ts +16 -2
  39. package/dist/components/blocks/Section.d.ts.map +1 -1
  40. package/dist/components/blocks/Text.d.ts +41 -0
  41. package/dist/components/blocks/Text.d.ts.map +1 -0
  42. package/dist/components/blocks/index.d.ts +4 -0
  43. package/dist/components/blocks/index.d.ts.map +1 -1
  44. package/dist/components/buttons/Button.d.ts +23 -7
  45. package/dist/components/buttons/Button.d.ts.map +1 -1
  46. package/dist/components/forms/FormBlock.d.ts +19 -13
  47. package/dist/components/forms/FormBlock.d.ts.map +1 -1
  48. package/dist/components/index.d.ts +4 -0
  49. package/dist/components/index.d.ts.map +1 -1
  50. package/dist/components/input/ChoiceInputField.d.ts +17 -11
  51. package/dist/components/input/ChoiceInputField.d.ts.map +1 -1
  52. package/dist/components/input/HtmlInputField.d.ts +17 -11
  53. package/dist/components/input/HtmlInputField.d.ts.map +1 -1
  54. package/dist/components/input/SelectInputField.d.ts +16 -10
  55. package/dist/components/input/SelectInputField.d.ts.map +1 -1
  56. package/dist/components/input/SwitchInputField.d.ts +16 -10
  57. package/dist/components/input/SwitchInputField.d.ts.map +1 -1
  58. package/dist/components/input/TextField.d.ts.map +1 -1
  59. package/dist/components/input/TextInputField.d.ts +16 -11
  60. package/dist/components/input/TextInputField.d.ts.map +1 -1
  61. package/dist/components/layout/GridCell.d.ts +23 -6
  62. package/dist/components/layout/GridCell.d.ts.map +1 -1
  63. package/dist/components/layout/GridLayout.d.ts +24 -23
  64. package/dist/components/layout/GridLayout.d.ts.map +1 -1
  65. package/dist/components/pages/FormPage.d.ts.map +1 -1
  66. package/dist/components/pages/Page.d.ts +49 -87
  67. package/dist/components/pages/Page.d.ts.map +1 -1
  68. package/dist/components/pages/index.d.ts +2 -2
  69. package/dist/components/pages/index.d.ts.map +1 -1
  70. package/dist/config/AppConfig.d.ts +49 -0
  71. package/dist/config/AppConfig.d.ts.map +1 -0
  72. package/dist/config/AppConfigBuilder.d.ts +75 -0
  73. package/dist/config/AppConfigBuilder.d.ts.map +1 -0
  74. package/dist/config/index.d.ts +13 -0
  75. package/dist/config/index.d.ts.map +1 -0
  76. package/dist/config/types.d.ts +130 -0
  77. package/dist/config/types.d.ts.map +1 -0
  78. package/dist/config.d.ts +15 -0
  79. package/dist/config.d.ts.map +1 -0
  80. package/dist/config.esm.js +451 -0
  81. package/dist/config.js +455 -0
  82. package/dist/contexts/PrintModeContext.d.ts +27 -0
  83. package/dist/contexts/PrintModeContext.d.ts.map +1 -0
  84. package/dist/contexts/QwickAppContext.d.ts +2 -2
  85. package/dist/contexts/QwickAppContext.d.ts.map +1 -1
  86. package/dist/contexts/ThemeContext.d.ts.map +1 -1
  87. package/dist/contexts/index.d.ts +2 -0
  88. package/dist/contexts/index.d.ts.map +1 -1
  89. package/dist/hooks/index.d.ts +2 -0
  90. package/dist/hooks/index.d.ts.map +1 -1
  91. package/dist/hooks/usePrintMode.d.ts +39 -0
  92. package/dist/hooks/usePrintMode.d.ts.map +1 -0
  93. package/dist/index.css +1 -1
  94. package/dist/index.d.ts +1 -0
  95. package/dist/index.d.ts.map +1 -1
  96. package/dist/index.esm.css +1 -1
  97. package/dist/index.esm.js +20722 -16021
  98. package/dist/index.js +20725 -16010
  99. package/dist/schemas/CodeSchema.d.ts +2 -1
  100. package/dist/schemas/CodeSchema.d.ts.map +1 -1
  101. package/dist/schemas/CollapsibleLayoutSchema.d.ts +2 -1
  102. package/dist/schemas/CollapsibleLayoutSchema.d.ts.map +1 -1
  103. package/dist/schemas/ContentSchema.d.ts +2 -1
  104. package/dist/schemas/ContentSchema.d.ts.map +1 -1
  105. package/dist/schemas/GridCellSchema.d.ts +25 -0
  106. package/dist/schemas/GridCellSchema.d.ts.map +1 -0
  107. package/dist/schemas/GridLayoutSchema.d.ts +23 -0
  108. package/dist/schemas/GridLayoutSchema.d.ts.map +1 -0
  109. package/dist/schemas/HtmlSchema.d.ts +14 -0
  110. package/dist/schemas/HtmlSchema.d.ts.map +1 -0
  111. package/dist/schemas/ImageSchema.d.ts +32 -0
  112. package/dist/schemas/ImageSchema.d.ts.map +1 -0
  113. package/dist/schemas/LogoSchema.d.ts +35 -0
  114. package/dist/schemas/LogoSchema.d.ts.map +1 -0
  115. package/dist/schemas/MarkdownSchema.d.ts +14 -0
  116. package/dist/schemas/MarkdownSchema.d.ts.map +1 -0
  117. package/dist/schemas/PageTemplateSchema.d.ts +31 -0
  118. package/dist/schemas/PageTemplateSchema.d.ts.map +1 -0
  119. package/dist/schemas/PrintConfigSchema.d.ts +31 -0
  120. package/dist/schemas/PrintConfigSchema.d.ts.map +1 -0
  121. package/dist/schemas/SectionSchema.d.ts +2 -1
  122. package/dist/schemas/SectionSchema.d.ts.map +1 -1
  123. package/dist/schemas/TextSchema.d.ts +37 -0
  124. package/dist/schemas/TextSchema.d.ts.map +1 -0
  125. package/dist/schemas/ViewModelSchema.d.ts +23 -0
  126. package/dist/schemas/ViewModelSchema.d.ts.map +1 -0
  127. package/dist/schemas/index.d.ts +15 -1
  128. package/dist/schemas/index.d.ts.map +1 -1
  129. package/dist/schemas/transformers/ComponentTransformer.d.ts +116 -0
  130. package/dist/schemas/transformers/ComponentTransformer.d.ts.map +1 -0
  131. package/dist/schemas/transformers/ReactNodeTransformer.d.ts +53 -0
  132. package/dist/schemas/transformers/ReactNodeTransformer.d.ts.map +1 -0
  133. package/dist/schemas/transformers/__tests__/MockSerializableComponent.d.ts +66 -0
  134. package/dist/schemas/transformers/__tests__/MockSerializableComponent.d.ts.map +1 -0
  135. package/dist/schemas/transformers/registry.d.ts +15 -0
  136. package/dist/schemas/transformers/registry.d.ts.map +1 -0
  137. package/dist/schemas/types/Serializable.d.ts +46 -0
  138. package/dist/schemas/types/Serializable.d.ts.map +1 -0
  139. package/dist/utils/htmlTransform.d.ts.map +1 -1
  140. package/dist/utils/reactUtils.d.ts +12 -3
  141. package/dist/utils/reactUtils.d.ts.map +1 -1
  142. package/package.json +17 -3
  143. package/src/{components/__tests__ → __tests__/components}/AccessibilityProvider.test.tsx +1 -1
  144. package/src/{components/__tests__ → __tests__/components}/Article.test.tsx +1 -1
  145. package/src/{components/__tests__ → __tests__/components}/Breadcrumbs.test.tsx +1 -1
  146. package/src/{components/__tests__ → __tests__/components}/Button.test.tsx +1 -1
  147. package/src/{components/__tests__ → __tests__/components}/CardListGrid.test.tsx +2 -2
  148. package/src/{components/__tests__ → __tests__/components}/ChoiceInputField.test.tsx +1 -1
  149. package/src/{components/__tests__ → __tests__/components}/Code.test.tsx +1 -1
  150. package/src/{components/__tests__ → __tests__/components}/Content.integration.test.tsx +1 -1
  151. package/src/{components/__tests__ → __tests__/components}/Content.test.tsx +1 -1
  152. package/src/{components/__tests__ → __tests__/components}/CoverImageHeader.test.tsx +2 -2
  153. package/src/{components/__tests__ → __tests__/components}/ErrorBoundary.test.tsx +1 -1
  154. package/src/{components/__tests__ → __tests__/components}/FeatureCard.integration.test.tsx +2 -2
  155. package/src/{components/__tests__ → __tests__/components}/FeatureGrid.integration.test.tsx +2 -2
  156. package/src/{components/__tests__ → __tests__/components}/FeatureGrid.test.tsx +2 -2
  157. package/src/{components/__tests__ → __tests__/components}/Footer.test.tsx +4 -4
  158. package/src/{components/__tests__ → __tests__/components}/FormBlock.test.tsx +1 -1
  159. package/src/{components/__tests__ → __tests__/components}/HeroBlock.integration.test.tsx +2 -2
  160. package/src/{components/__tests__ → __tests__/components}/HeroBlock.test.tsx +233 -7
  161. package/src/{components/__tests__ → __tests__/components}/Html.test.tsx +11 -2
  162. package/src/{components/__tests__ → __tests__/components}/HtmlInputField.test.tsx +3 -3
  163. package/src/__tests__/components/Logo.test.js +3 -3
  164. package/src/{components/__tests__ → __tests__/components}/Markdown.test.tsx +1 -1
  165. package/src/{components/__tests__ → __tests__/components}/PageBannerHeader.test.tsx +3 -3
  166. package/src/{components/__tests__ → __tests__/components}/PaletteSwitcher.test.tsx +3 -3
  167. package/src/{components/__tests__ → __tests__/components}/ProductCard.test.tsx +4 -4
  168. package/src/{components/__tests__ → __tests__/components}/SafeSpan.integration.test.tsx +2 -2
  169. package/src/{components/__tests__ → __tests__/components}/SafeSpan.simple.test.tsx +1 -1
  170. package/src/{components/__tests__ → __tests__/components}/SafeSpan.test.tsx +1 -1
  171. package/src/{components/__tests__ → __tests__/components}/Section.integration.test.tsx +1 -1
  172. package/src/{components/__tests__ → __tests__/components}/Section.test.tsx +1 -1
  173. package/src/{components/__tests__ → __tests__/components}/SelectInputField.test.tsx +1 -1
  174. package/src/{components/__tests__ → __tests__/components}/TextInputField.test.tsx +3 -3
  175. package/src/{components/__tests__ → __tests__/components}/ThemeSwitcher.test.tsx +3 -3
  176. package/src/__tests__/components/base/ModelView.test.tsx +220 -0
  177. package/src/__tests__/components/blocks/Code.performance.test.tsx +625 -0
  178. package/src/__tests__/components/blocks/Code.serialization.test.tsx +507 -0
  179. package/src/__tests__/components/blocks/HeroBlock.serialization.test.tsx +414 -0
  180. package/src/__tests__/components/blocks/Image.serialization.test.tsx +257 -0
  181. package/src/__tests__/components/blocks/Section.serialization.test.tsx +553 -0
  182. package/src/__tests__/components/blocks/Text.performance.test.tsx +442 -0
  183. package/src/__tests__/components/blocks/Text.serialization.test.tsx +491 -0
  184. package/src/__tests__/components/buttons/Button.serialization.test.tsx +443 -0
  185. package/src/__tests__/components/input/FormComponents.serialization.test.tsx +482 -0
  186. package/src/__tests__/components/input/SelectInputField.serialization.test.tsx +439 -0
  187. package/src/__tests__/components/input/TextInputField.serialization.test.tsx +359 -0
  188. package/src/{components/layout/CollapsibleLayout/__tests__ → __tests__/components/layout}/CollapsibleLayout.test.tsx +4 -4
  189. package/src/__tests__/components/layout/GridCell.serialization.test.tsx +403 -0
  190. package/src/__tests__/components/layout/GridLayout.serialization.test.tsx +311 -0
  191. package/src/__tests__/hooks/usePrintMode.test.ts +89 -0
  192. package/src/__tests__/schemas/PageTemplateSchema.test.ts +161 -0
  193. package/src/__tests__/schemas/PrintConfigSchema.test.ts +127 -0
  194. package/src/__tests__/schemas/ViewModelSchema.test.ts +80 -0
  195. package/src/__tests__/schemas/transformers/ComponentSerializationPatterns.test.tsx +602 -0
  196. package/src/__tests__/schemas/transformers/ComponentTransformer.htmlPatterns.test.ts +301 -0
  197. package/src/__tests__/schemas/transformers/ComponentTransformer.test.ts +521 -0
  198. package/src/__tests__/schemas/transformers/CrossBrowserCompatibility.test.ts +586 -0
  199. package/src/__tests__/schemas/transformers/MockSerializableComponent.ts +103 -0
  200. package/src/__tests__/schemas/transformers/RealWorldScenarios.test.tsx +1165 -0
  201. package/src/__tests__/schemas/transformers/SerializationErrorHandling.test.ts +602 -0
  202. package/src/__tests__/schemas/transformers/SerializationIntegration.test.tsx +691 -0
  203. package/src/__tests__/schemas/transformers/SerializationPerformance.test.ts +460 -0
  204. package/src/__tests__/schemas/transformers/TestAutomation.test.ts +597 -0
  205. package/src/{utils/__tests__ → __tests__/utils}/nested-dom-fix.test.tsx +1 -1
  206. package/src/components/ErrorBoundary.tsx +8 -8
  207. package/src/components/Html.tsx +147 -44
  208. package/src/components/Logo.tsx +198 -100
  209. package/src/components/Markdown.tsx +125 -16
  210. package/src/components/QwickApp.tsx +64 -31
  211. package/src/components/QwickIcon.tsx +59 -0
  212. package/src/components/SafeSpan.tsx +65 -10
  213. package/src/components/Scaffold.tsx +2 -8
  214. package/src/components/base/ModelView.tsx +199 -0
  215. package/src/components/base/index.ts +11 -0
  216. package/src/components/blocks/Article.tsx +57 -18
  217. package/src/components/blocks/Code.md +529 -0
  218. package/src/components/blocks/Code.tsx +102 -15
  219. package/src/components/blocks/Content.tsx +25 -77
  220. package/src/components/blocks/CoverImageHeader.tsx +9 -4
  221. package/src/components/blocks/FeatureCard.tsx +1 -2
  222. package/src/components/blocks/FeatureGrid.tsx +19 -1
  223. package/src/components/blocks/Footer.tsx +13 -1
  224. package/src/components/blocks/HeroBlock.tsx +87 -20
  225. package/src/components/blocks/Image.tsx +395 -0
  226. package/src/components/blocks/PageBannerHeader.tsx +14 -12
  227. package/src/components/blocks/ProductCard.tsx +51 -52
  228. package/src/components/blocks/Section.tsx +113 -8
  229. package/src/components/blocks/Text.tsx +285 -0
  230. package/src/components/blocks/index.ts +4 -0
  231. package/src/components/buttons/Button.tsx +184 -15
  232. package/src/components/forms/FormBlock.tsx +70 -17
  233. package/src/components/index.ts +5 -0
  234. package/src/components/input/ChoiceInputField.tsx +48 -18
  235. package/src/components/input/HtmlInputField.tsx +48 -18
  236. package/src/components/input/SelectInputField.tsx +48 -16
  237. package/src/components/input/SwitchInputField.tsx +48 -17
  238. package/src/components/input/TextField.tsx +41 -1
  239. package/src/components/input/TextInputField.tsx +52 -18
  240. package/src/components/layout/GridCell.tsx +118 -9
  241. package/src/components/layout/GridLayout.tsx +125 -24
  242. package/src/components/pages/FormPage.tsx +0 -1
  243. package/src/components/pages/Page.css +304 -332
  244. package/src/components/pages/Page.tsx +307 -255
  245. package/src/components/pages/index.ts +2 -2
  246. package/src/config/AppConfig.ts +133 -0
  247. package/src/config/AppConfigBuilder.ts +421 -0
  248. package/src/config/__tests__/AppConfig.test.ts +385 -0
  249. package/src/config/__tests__/AppConfigBuilder.test.ts +432 -0
  250. package/src/config/index.ts +24 -0
  251. package/src/config/types.ts +170 -0
  252. package/src/config.ts +25 -0
  253. package/src/contexts/PrintModeContext.tsx +332 -0
  254. package/src/contexts/QwickAppContext.tsx +2 -2
  255. package/src/contexts/ThemeContext.tsx +1 -2
  256. package/src/contexts/index.ts +2 -0
  257. package/src/hooks/index.ts +5 -1
  258. package/src/hooks/usePrintMode.ts +73 -0
  259. package/src/index.ts +3 -0
  260. package/src/schemas/CodeSchema.ts +3 -3
  261. package/src/schemas/CollapsibleLayoutSchema.ts +2 -1
  262. package/src/schemas/ContentSchema.ts +2 -1
  263. package/src/schemas/GridCellSchema.ts +164 -0
  264. package/src/schemas/GridLayoutSchema.ts +133 -0
  265. package/src/schemas/HtmlSchema.ts +47 -0
  266. package/src/schemas/ImageSchema.ts +235 -0
  267. package/src/schemas/LogoSchema.ts +241 -0
  268. package/src/schemas/MarkdownSchema.ts +47 -0
  269. package/src/schemas/PageTemplateSchema.ts +186 -0
  270. package/src/schemas/PrintConfigSchema.ts +207 -0
  271. package/src/schemas/README.md +661 -0
  272. package/src/schemas/SectionSchema.ts +2 -1
  273. package/src/schemas/TextSchema.ts +329 -0
  274. package/src/schemas/ViewModelSchema.ts +115 -0
  275. package/src/schemas/index.ts +21 -2
  276. package/src/schemas/transformers/ComponentTransformer.ts +403 -0
  277. package/src/schemas/transformers/ReactNodeTransformer.ts +236 -0
  278. package/src/schemas/transformers/registry.ts +72 -0
  279. package/src/schemas/types/Serializable.ts +51 -0
  280. package/src/stories/AccessibilityProvider.stories.tsx +253 -253
  281. package/src/stories/Article.stories.tsx +433 -433
  282. package/src/stories/Button.stories.tsx +1 -1
  283. package/src/stories/CardListGrid.stories.tsx +451 -451
  284. package/src/stories/ChoiceInputField.stories.tsx +503 -503
  285. package/src/stories/Code.stories.tsx +1 -1
  286. package/src/stories/CollapsibleLayout.stories.tsx +1414 -1414
  287. package/src/stories/Content.stories.tsx +393 -393
  288. package/src/stories/CoverImageHeader.stories.tsx +701 -701
  289. package/src/stories/DataBinding.advanced.stories.tsx +432 -432
  290. package/src/stories/DataProvider.stories.tsx +1192 -1192
  291. package/src/stories/FeatureCard.stories.tsx +557 -557
  292. package/src/stories/FeatureGrid.stories.tsx +594 -594
  293. package/src/stories/Footer.stories.tsx +640 -640
  294. package/src/stories/FormBlock.stories.tsx +760 -760
  295. package/src/stories/FormComponents.stories.tsx +349 -541
  296. package/src/stories/GridCell.stories.tsx +417 -0
  297. package/src/stories/GridLayout.stories.tsx +353 -0
  298. package/src/stories/HeroBlock.stories.tsx +862 -373
  299. package/src/stories/HtmlInputField.stories.tsx +474 -474
  300. package/src/stories/Image.stories.tsx +819 -0
  301. package/src/stories/Introduction.stories.tsx +667 -667
  302. package/src/stories/LayoutBlocks.stories.tsx +324 -324
  303. package/src/stories/Logo.stories.tsx +165 -6
  304. package/src/stories/Markdown.stories.tsx +137 -137
  305. package/src/stories/ModelView.stories.tsx +477 -0
  306. package/src/stories/Page.stories.tsx +688 -688
  307. package/src/stories/PageBannerHeader.stories.tsx +864 -864
  308. package/src/stories/PaletteSwitcher.stories.tsx +119 -119
  309. package/src/stories/ProductCard.stories.tsx +424 -424
  310. package/src/stories/QwickApp.stories.tsx +368 -368
  311. package/src/stories/ResponsiveMenu.stories.tsx +249 -249
  312. package/src/stories/SafeSpan.stories.tsx +531 -531
  313. package/src/stories/Section.stories.tsx +90 -2
  314. package/src/stories/SelectInputField.stories.tsx +524 -524
  315. package/src/stories/Text.stories.tsx +560 -0
  316. package/src/stories/TextInputField.stories.tsx +443 -443
  317. package/src/stories/ThemeSwitcher.stories.tsx +123 -123
  318. package/src/utils/htmlTransform.tsx +74 -53
  319. package/src/utils/reactUtils.tsx +57 -6
  320. package/dist/index.bundled.css +0 -12
  321. /package/src/{hooks/__tests__ → __tests__/hooks}/useDataBinding.test.tsx.disabled +0 -0
  322. /package/src/{schemas/__tests__ → __tests__/schemas}/builders.test.ts +0 -0
  323. /package/src/{utils/__tests__ → __tests__/utils}/createDataDrivenComponent.test.tsx.disabled +0 -0
  324. /package/src/{utils/__tests__ → __tests__/utils}/htmlTransform.test.tsx +0 -0
  325. /package/src/{utils/__tests__ → __tests__/utils}/optional-logging.test.ts +0 -0
@@ -1,588 +1,396 @@
1
1
  /**
2
- * Form Components Stories - Testing new base props pattern
2
+ * Form Components Stories - Comprehensive showcase of all form components
3
+ *
4
+ * Demonstrates all form components with serialization examples:
5
+ * - TextInputField: Text input with validation and different types
6
+ * - SelectInputField: Dropdown selection with complex options
7
+ * - HtmlInputField: Rich HTML editor with formatting controls
8
+ * - ChoiceInputField: Dynamic option management
9
+ * - SwitchInputField: Boolean toggle controls
10
+ * - FormBlock: Complete form layout container
11
+ *
12
+ * Includes serialization examples to demonstrate "WebView for React" functionality.
13
+ *
14
+ * Copyright (c) 2025 QwickApps.com. All rights reserved.
3
15
  */
4
16
 
5
- import { Box, Paper, Typography } from '@mui/material';
17
+ import React, { useState } from 'react';
6
18
  import type { Meta, StoryObj } from '@storybook/react';
7
- import { Button } from '../components/buttons/Button';
8
- import { TextField } from '../components/input/TextField';
9
- import { GridCell } from '../components/layout/GridCell';
10
- import GridLayout from '../components/layout/GridLayout';
19
+ import { Box, Typography, Paper, Button, Alert } from '@mui/material';
20
+ import { ComponentTransformer } from '../schemas/transformers/ComponentTransformer';
21
+
22
+ // Import form components
23
+ import { TextInputField } from '../components/input/TextInputField';
24
+ import { SelectInputField } from '../components/input/SelectInputField';
25
+ import { HtmlInputField } from '../components/input/HtmlInputField';
26
+ import { ChoiceInputField } from '../components/input/ChoiceInputField';
27
+ import { SwitchInputField } from '../components/input/SwitchInputField';
28
+ import { FormBlock } from '../components/forms/FormBlock';
29
+
30
+ // Ensure components are registered for serialization
31
+ import '../schemas/transformers/registry';
11
32
 
12
33
  const meta: Meta = {
13
- title: 'Forms/Enhanced Components',
34
+ title: 'Form Components/Complete Showcase',
14
35
  parameters: {
15
- layout: 'padded',
36
+ layout: 'fullscreen',
16
37
  docs: {
17
38
  description: {
18
- component: `Enhanced form components with base props support and grid integration.
19
-
20
- **Key Features:**
21
- - T-shirt sizing for dimensions and spacing (tiny, small, medium, large, x-large)
22
- - Seamless grid behavior when used in GridLayout
23
- - Background and styling props with theme integration
24
- - Responsive breakpoint support (xs, sm, md, lg, xl)
25
- - Consistent prop resolution and inheritance
39
+ component: `
40
+ Comprehensive showcase of all form components with serialization capabilities.
41
+ Each component extends ModelView and supports JSON serialization/deserialization.
26
42
 
27
- **Perfect For:**
28
- - Building responsive forms with minimal code
29
- - Creating consistent layouts across your application
30
- - Rapid prototyping with standardized sizing
31
- - Complex form layouts with grid positioning`,
32
- },
33
- },
34
- },
43
+ **Features:**
44
+ - Full form component library
45
+ - JSON serialization for "WebView for React"
46
+ - Data binding support
47
+ - Validation and error handling
48
+ - Performance optimized
49
+ `
50
+ }
51
+ }
52
+ }
35
53
  };
36
54
 
37
55
  export default meta;
56
+ type Story = StoryObj;
38
57
 
39
- export const BasicTextField: StoryObj = {
40
- render: () => (
41
- <Box>
42
- <h3>TextField with T-shirt Sizing</h3>
43
- <TextField
44
- label="Small Width"
45
- width="small"
46
- margin="normal"
47
- padding="small"
48
- />
49
- <br />
50
- <TextField
51
- label="Large Width"
52
- width="large"
53
- margin="normal"
54
- padding="large"
55
- background="primary.light"
56
- />
57
- </Box>
58
- ),
59
- };
58
+ // Helper component for serialization demonstration
59
+ const SerializationDemo: React.FC<{
60
+ title: string;
61
+ component: React.ReactElement;
62
+ }> = ({ title, component }) => {
63
+ const [serializedData, setSerializedData] = useState<string>('');
64
+ const [deserializedComponent, setDeserializedComponent] = useState<React.ReactElement | null>(null);
65
+ const [error, setError] = useState<string>('');
60
66
 
61
- export const BasicButton: StoryObj = {
62
- render: () => (
63
- <Box>
64
- <h3>Button with T-shirt Sizing</h3>
65
- <Button
66
- variant="contained"
67
- width="small"
68
- margin="medium"
69
- >
70
- Small Width
71
- </Button>
72
- <br />
73
- <Button
74
- variant="contained"
75
- width="large"
76
- margin="normal"
77
- padding="large"
78
- >
79
- Large Width
80
- </Button>
81
- </Box>
82
- ),
83
- };
84
-
85
- export const InColumnLayout: StoryObj = {
86
- render: () => (
87
- <Box>
88
- <h3>Components in GridLayout</h3>
89
- <GridLayout spacing="medium">
90
- <TextField
91
- label="Half Width"
92
- span={6}
93
- fullWidth
94
- />
95
- <TextField
96
- label="Half Width"
97
- span={6}
98
- fullWidth
99
- />
100
- <TextField
101
- label="Full Width"
102
- span={12}
103
- fullWidth
104
- />
105
- <Button
106
- variant="contained"
107
- span={4}
108
- >
109
- One Third
110
- </Button>
111
- <Button
112
- variant="outlined"
113
- span={4}
114
- >
115
- One Third
116
- </Button>
117
- <Button
118
- variant="text"
119
- span={4}
120
- >
121
- One Third
122
- </Button>
123
- </GridLayout>
124
- </Box>
125
- ),
126
- };
67
+ const handleSerialize = () => {
68
+ try {
69
+ const serialized = ComponentTransformer.serialize(component);
70
+ setSerializedData(serialized);
71
+ setError('');
72
+ } catch (err) {
73
+ setError(err instanceof Error ? err.message : 'Serialization failed');
74
+ }
75
+ };
127
76
 
128
- export const ResponsiveGrid: StoryObj = {
129
- render: () => (
130
- <Box>
131
- <h3>Responsive Grid Behavior</h3>
132
- <GridLayout spacing="medium">
133
- <TextField
134
- label="Mobile: Full, Tablet: Half, Desktop: Quarter"
135
- xs={12}
136
- sm={6}
137
- md={3}
138
- fullWidth
139
- />
140
- <TextField
141
- label="Mobile: Full, Tablet: Half, Desktop: Quarter"
142
- xs={12}
143
- sm={6}
144
- md={3}
145
- fullWidth
146
- />
147
- <TextField
148
- label="Mobile: Full, Tablet: Half, Desktop: Quarter"
149
- xs={12}
150
- sm={6}
151
- md={3}
152
- fullWidth
153
- />
154
- <TextField
155
- label="Mobile: Full, Tablet: Half, Desktop: Quarter"
156
- xs={12}
157
- sm={6}
158
- md={3}
159
- fullWidth
160
- />
161
- </GridLayout>
162
- </Box>
163
- ),
164
- };
77
+ const handleDeserialize = () => {
78
+ try {
79
+ if (serializedData) {
80
+ const deserialized = ComponentTransformer.deserialize(serializedData) as React.ReactElement;
81
+ setDeserializedComponent(deserialized);
82
+ setError('');
83
+ }
84
+ } catch (err) {
85
+ setError(err instanceof Error ? err.message : 'Deserialization failed');
86
+ }
87
+ };
165
88
 
166
- export const WithStyling: StoryObj = {
167
- render: () => (
168
- <Box>
169
- <h3>Advanced Styling</h3>
170
- <GridLayout spacing="large">
171
- <TextField
172
- label="With Background"
173
- span={6}
174
- fullWidth
175
- background="linear-gradient(45deg, #FE6B8B 30%, #FF8E53 90%)"
176
- padding="medium"
177
- sx={{ '& .MuiInputBase-root': { color: 'white' } }}
178
- />
179
- <TextField
180
- label="With Custom Height"
181
- span={6}
182
- fullWidth
183
- height={80}
184
- padding="medium"
185
- />
186
- <Button
187
- variant="contained"
188
- span={12}
189
- height="small"
190
- padding="large"
191
- background="linear-gradient(45deg, #2196F3 30%, #21CBF3 90%)"
192
- >
193
- Gradient Button with Height
194
- </Button>
195
- </GridLayout>
196
- </Box>
197
- ),
198
- };
89
+ return (
90
+ <Paper elevation={2} sx={{ p: 3, mb: 4 }}>
91
+ <Typography variant="h6" gutterBottom>
92
+ {title}
93
+ </Typography>
94
+
95
+ {/* Original Component */}
96
+ <Box sx={{ mb: 2 }}>
97
+ <Typography variant="subtitle2" color="text.secondary" gutterBottom>
98
+ Original Component:
99
+ </Typography>
100
+ {component}
101
+ </Box>
199
102
 
200
- export const LoginFormExample: StoryObj = {
201
- render: () => (
202
- <Box sx={{ maxWidth: 400, mx: 'auto', p: 3 }}>
203
- <h3>Login Form with New Components</h3>
204
- <GridLayout spacing="medium">
205
- <TextField
206
- label="Email"
207
- type="email"
208
- span={12}
209
- fullWidth
210
- required
211
- />
212
- <TextField
213
- label="Password"
214
- type="password"
215
- span={12}
216
- fullWidth
217
- required
218
- />
219
- <Button
220
- variant="contained"
221
- span={12}
222
- size="large"
223
- padding="medium"
103
+ {/* Serialization Controls */}
104
+ <Box sx={{ mb: 2, display: 'flex', gap: 2 }}>
105
+ <Button
106
+ variant="outlined"
107
+ size="small"
108
+ onClick={handleSerialize}
224
109
  >
225
- Sign In
110
+ Serialize to JSON
226
111
  </Button>
227
- <Button
228
- variant="text"
229
- span={6}
230
- size="small"
112
+ <Button
113
+ variant="outlined"
114
+ size="small"
115
+ onClick={handleDeserialize}
116
+ disabled={!serializedData}
231
117
  >
232
- Forgot Password?
118
+ Deserialize from JSON
233
119
  </Button>
234
- <Button
235
- variant="text"
236
- span={6}
237
- size="small"
238
- >
239
- Sign Up
240
- </Button>
241
- </GridLayout>
242
- </Box>
243
- ),
244
- };
245
-
246
- // === T-SHIRT SIZING TESTS ===
247
-
248
- export const TSizingDimensions: StoryObj = {
249
- name: 'T-Shirt Sizing - Dimensions',
250
- render: () => (
251
- <Box sx={{ p: 2 }}>
252
- <Typography variant="h6" gutterBottom>Width Sizing</Typography>
253
- <Box sx={{ display: 'flex', flexDirection: 'column', gap: 2, mb: 4 }}>
254
- <TextField label="Tiny Width" width="tiny" />
255
- <TextField label="Small Width" width="small" />
256
- <TextField label="Medium Width" width="medium" />
257
- <TextField label="Large Width" width="large" />
258
- <TextField label="X-Large Width" width="x-large" />
259
- <TextField label="Auto Width" width="auto" />
260
- <TextField label="Custom 300px" width="300px" />
261
- <TextField label="Custom 50%" width="50%" />
262
120
  </Box>
263
121
 
264
- <Typography variant="h6" gutterBottom>Height Sizing (Buttons)</Typography>
265
- <Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 2 }}>
266
- <Button height="tiny">Tiny</Button>
267
- <Button height="small">Small</Button>
268
- <Button height="medium">Medium</Button>
269
- <Button height="large">Large</Button>
270
- <Button height="x-large">X-Large</Button>
271
- <Button height="60px">60px</Button>
272
- </Box>
273
- </Box>
274
- ),
275
- };
276
-
277
- export const TSizingSpacing: StoryObj = {
278
- name: 'T-Shirt Sizing - Spacing',
279
- render: () => (
280
- <Box sx={{ p: 2 }}>
281
- <Typography variant="h6" gutterBottom>Padding Variations</Typography>
282
- <Box sx={{ display: 'flex', flexDirection: 'column', gap: 1, mb: 4 }}>
283
- <TextField label="No Padding" padding="none" background="#f0f0f0" />
284
- <TextField label="Tiny Padding" padding="tiny" background="#f0f0f0" />
285
- <TextField label="Small Padding" padding="small" background="#f0f0f0" />
286
- <TextField label="Medium Padding" padding="medium" background="#f0f0f0" />
287
- <TextField label="Large Padding" padding="large" background="#f0f0f0" />
288
- <TextField label="X-Large Padding" padding="x-large" background="#f0f0f0" />
289
- <TextField label="Custom 20px" padding="20px" background="#f0f0f0" />
290
- </Box>
122
+ {/* Error Display */}
123
+ {error && (
124
+ <Alert severity="error" sx={{ mb: 2 }}>
125
+ {error}
126
+ </Alert>
127
+ )}
291
128
 
292
- <Typography variant="h6" gutterBottom>Margin Variations</Typography>
293
- <Box sx={{ border: '1px dashed #ccc', p: 1 }}>
294
- <TextField label="No Margin" margin="none" background="#e3f2fd" />
295
- <TextField label="Tiny Margin" margin="tiny" background="#e8f5e8" />
296
- <TextField label="Small Margin" margin="small" background="#fff3e0" />
297
- <TextField label="Medium Margin" margin="medium" background="#fce4ec" />
298
- <TextField label="Large Margin" margin="large" background="#f3e5f5" />
299
- <TextField label="X-Large Margin" margin="x-large" background="#e0f2f1" />
300
- </Box>
301
- </Box>
302
- ),
303
- };
304
-
305
- // === GRID BEHAVIOR TESTS ===
129
+ {/* Serialized JSON */}
130
+ {serializedData && (
131
+ <Box sx={{ mb: 2 }}>
132
+ <Typography variant="subtitle2" color="text.secondary" gutterBottom>
133
+ Serialized JSON:
134
+ </Typography>
135
+ <Paper
136
+ variant="outlined"
137
+ sx={{
138
+ p: 2,
139
+ backgroundColor: 'grey.50',
140
+ maxHeight: 200,
141
+ overflow: 'auto'
142
+ }}
143
+ >
144
+ <pre style={{ margin: 0, fontSize: '0.8rem' }}>
145
+ {JSON.stringify(JSON.parse(serializedData), null, 2)}
146
+ </pre>
147
+ </Paper>
148
+ </Box>
149
+ )}
306
150
 
307
- export const GridSpanTests: StoryObj = {
308
- name: 'Grid Behavior - Span',
309
- render: () => (
310
- <Box sx={{ p: 2 }}>
311
- <Typography variant="h6" gutterBottom>Span Property (Equal Distribution)</Typography>
312
- <GridLayout spacing="small">
313
- <TextField label="Span 12 (Full)" span={12} fullWidth background="#ffebee" />
314
- <TextField label="Span 6" span={6} fullWidth background="#e8f5e8" />
315
- <TextField label="Span 6" span={6} fullWidth background="#e8f5e8" />
316
- <TextField label="Span 4" span={4} fullWidth background="#e3f2fd" />
317
- <TextField label="Span 4" span={4} fullWidth background="#e3f2fd" />
318
- <TextField label="Span 4" span={4} fullWidth background="#e3f2fd" />
319
- <Button span={3} variant="outlined">Span 3</Button>
320
- <Button span={3} variant="outlined">Span 3</Button>
321
- <Button span={3} variant="outlined">Span 3</Button>
322
- <Button span={3} variant="outlined">Span 3</Button>
323
- </GridLayout>
324
- </Box>
325
- ),
151
+ {/* Deserialized Component */}
152
+ {deserializedComponent && (
153
+ <Box>
154
+ <Typography variant="subtitle2" color="text.secondary" gutterBottom>
155
+ Deserialized Component:
156
+ </Typography>
157
+ <Box sx={{ p: 2, border: '2px dashed', borderColor: 'success.main', borderRadius: 1 }}>
158
+ {deserializedComponent}
159
+ </Box>
160
+ </Box>
161
+ )}
162
+ </Paper>
163
+ );
326
164
  };
327
165
 
328
- export const GridResponsiveTests: StoryObj = {
329
- name: 'Grid Behavior - Responsive',
166
+ export const TextInputFieldShowcase: Story = {
167
+ name: 'TextInputField - Text Input Component',
330
168
  render: () => (
331
- <Box sx={{ p: 2 }}>
332
- <Typography variant="h6" gutterBottom>Responsive Breakpoints</Typography>
333
- <Typography variant="body2" sx={{ mb: 2, color: 'text.secondary' }}>
334
- Resize browser to see responsive behavior: xs=mobile, sm=tablet, md=desktop
169
+ <Box sx={{ p: 4 }}>
170
+ <Typography variant="h4" gutterBottom>
171
+ TextInputField Serialization Examples
335
172
  </Typography>
336
- <GridLayout spacing="medium">
337
- <TextField
338
- label="xs:12, sm:6, md:4"
339
- xs={12} sm={6} md={4}
340
- fullWidth
341
- background="#ffebee"
342
- />
343
- <TextField
344
- label="xs:12, sm:6, md:4"
345
- xs={12} sm={6} md={4}
346
- fullWidth
347
- background="#e8f5e8"
348
- />
349
- <TextField
350
- label="xs:12, sm:6, md:4"
351
- xs={12} sm={6} md={4}
352
- fullWidth
353
- background="#e3f2fd"
354
- />
355
- <Button
356
- xs={12} sm={12} md={6}
357
- variant="contained"
358
- fullWidth
359
- >
360
- xs:12, sm:12, md:6
361
- </Button>
362
- <Button
363
- xs={12} sm={12} md={6}
364
- variant="outlined"
365
- fullWidth
366
- >
367
- xs:12, sm:12, md:6
368
- </Button>
369
- </GridLayout>
370
- </Box>
371
- ),
372
- };
173
+
174
+ <SerializationDemo
175
+ title="Basic Text Input"
176
+ component={
177
+ <TextInputField
178
+ label="Full Name"
179
+ value="John Doe"
180
+ placeholder="Enter your full name"
181
+ required={true}
182
+ />
183
+ }
184
+ />
373
185
 
374
- // === BACKGROUND TESTS ===
186
+ <SerializationDemo
187
+ title="Email Input with Validation"
188
+ component={
189
+ <TextInputField
190
+ label="Email Address"
191
+ value="user@example.com"
192
+ type="email"
193
+ required={true}
194
+ helperText="We'll never share your email with anyone else."
195
+ />
196
+ }
197
+ />
375
198
 
376
- export const BackgroundTests: StoryObj = {
377
- name: 'Background Variations',
378
- render: () => (
379
- <Box sx={{ p: 2 }}>
380
- <Typography variant="h6" gutterBottom>Background Colors & Gradients</Typography>
381
- <GridLayout spacing="medium">
382
- <TextField
383
- label="Primary Background"
384
- span={6}
385
- fullWidth
386
- background="primary.light"
387
- padding="medium"
388
- />
389
- <TextField
390
- label="Secondary Background"
391
- span={6}
392
- fullWidth
393
- background="secondary.light"
394
- padding="medium"
395
- />
396
- <TextField
397
- label="Custom Color"
398
- span={4}
399
- fullWidth
400
- background="#4caf50"
401
- padding="medium"
402
- />
403
- <TextField
404
- label="RGB Color"
405
- span={4}
406
- fullWidth
407
- background="rgb(255, 152, 0)"
408
- padding="medium"
409
- />
410
- <TextField
411
- label="Hex Color"
412
- span={4}
413
- fullWidth
414
- background="#9c27b0"
415
- padding="medium"
416
- />
417
- <TextField
418
- label="Linear Gradient"
419
- span={12}
420
- fullWidth
421
- background="linear-gradient(45deg, #FE6B8B 30%, #FF8E53 90%)"
422
- padding="large"
423
- sx={{ '& .MuiInputBase-root': { color: 'white' } }}
424
- />
425
- <Button
426
- span={6}
427
- variant="contained"
428
- background="linear-gradient(45deg, #2196F3 30%, #21CBF3 90%)"
429
- padding="medium"
430
- >
431
- Gradient Button
432
- </Button>
433
- <Button
434
- span={6}
435
- variant="outlined"
436
- background="radial-gradient(circle, #ff6b6b, #ee5a24)"
437
- padding="medium"
438
- >
439
- Radial Gradient
440
- </Button>
441
- </GridLayout>
199
+ <SerializationDemo
200
+ title="Multiline Textarea"
201
+ component={
202
+ <TextInputField
203
+ label="Description"
204
+ value="This is a multi-line description field that can contain longer text content."
205
+ multiline={true}
206
+ rows={4}
207
+ placeholder="Enter a detailed description..."
208
+ />
209
+ }
210
+ />
211
+
212
+ <SerializationDemo
213
+ title="Password Input with Error State"
214
+ component={
215
+ <TextInputField
216
+ label="Password"
217
+ value=""
218
+ type="password"
219
+ required={true}
220
+ error="Password must be at least 8 characters long"
221
+ placeholder="Enter a secure password"
222
+ />
223
+ }
224
+ />
442
225
  </Box>
443
- ),
226
+ )
444
227
  };
445
228
 
446
- // === COLUMN LAYOUT TESTS ===
447
-
448
- export const ColumnLayoutTests: StoryObj = {
449
- name: 'GridLayout Features',
229
+ export const SelectInputFieldShowcase: Story = {
230
+ name: 'SelectInputField - Dropdown Selection',
450
231
  render: () => (
451
- <Box sx={{ p: 2 }}>
452
- <Typography variant="h6" gutterBottom>Auto GridCell Distribution</Typography>
453
- <Box sx={{ mb: 4 }}>
454
- <Typography variant="subtitle2" gutterBottom>columns=2</Typography>
455
- <GridLayout columns={2} spacing="small">
456
- <TextField label="Auto GridCell 1" fullWidth />
457
- <TextField label="Auto GridCell 2" fullWidth />
458
- <Button variant="outlined" fullWidth>Auto Button 1</Button>
459
- <Button variant="contained" fullWidth>Auto Button 2</Button>
460
- </GridLayout>
461
- </Box>
462
-
463
- <Box sx={{ mb: 4 }}>
464
- <Typography variant="subtitle2" gutterBottom>columns=3</Typography>
465
- <GridLayout columns={3} spacing="medium">
466
- <TextField label="Third 1" fullWidth />
467
- <TextField label="Third 2" fullWidth />
468
- <TextField label="Third 3" fullWidth />
469
- <Button variant="outlined">Button 1</Button>
470
- <Button variant="contained">Button 2</Button>
471
- <Button variant="text">Button 3</Button>
472
- </GridLayout>
473
- </Box>
474
-
475
- <Typography variant="h6" gutterBottom>Equal Height Columns</Typography>
476
- <GridLayout columns={3} spacing="medium" equalHeight>
477
- <Paper sx={{ p: 2, background: '#ffebee' }}>
478
- <Typography>Short Content</Typography>
479
- </Paper>
480
- <Paper sx={{ p: 2, background: '#e8f5e8' }}>
481
- <Typography>Medium length content that spans multiple lines to show height equalization working properly.</Typography>
482
- </Paper>
483
- <Paper sx={{ p: 2, background: '#e3f2fd' }}>
484
- <Typography>Very long content that demonstrates the equal height feature by having much more text than the other columns, forcing all columns to match this height.</Typography>
485
- </Paper>
486
- </GridLayout>
487
- </Box>
488
- ),
489
- };
232
+ <Box sx={{ p: 4 }}>
233
+ <Typography variant="h4" gutterBottom>
234
+ SelectInputField Serialization Examples
235
+ </Typography>
236
+
237
+ <SerializationDemo
238
+ title="Basic Country Selection"
239
+ component={
240
+ <SelectInputField
241
+ label="Country"
242
+ value="us"
243
+ placeholder="Select your country"
244
+ options={[
245
+ { value: 'us', label: 'United States' },
246
+ { value: 'ca', label: 'Canada' },
247
+ { value: 'uk', label: 'United Kingdom' },
248
+ { value: 'de', label: 'Germany' },
249
+ { value: 'fr', label: 'France' }
250
+ ]}
251
+ required={true}
252
+ />
253
+ }
254
+ />
490
255
 
491
- // === MIXED COMPONENT TESTS ===
256
+ <SerializationDemo
257
+ title="Priority Level with Disabled Options"
258
+ component={
259
+ <SelectInputField
260
+ label="Priority Level"
261
+ value="high"
262
+ options={[
263
+ { value: 'low', label: 'Low Priority', disabled: false },
264
+ { value: 'medium', label: 'Medium Priority', disabled: false },
265
+ { value: 'high', label: 'High Priority', disabled: false },
266
+ { value: 'critical', label: 'Critical Priority', disabled: true }
267
+ ]}
268
+ helperText="Critical priority requires special permissions"
269
+ />
270
+ }
271
+ />
492
272
 
493
- export const MixedComponents: StoryObj = {
494
- name: 'Mixed Component Integration',
495
- render: () => (
496
- <Box sx={{ p: 2 }}>
497
- <Typography variant="h6" gutterBottom>QwickApp + Regular Components</Typography>
498
- <GridLayout spacing="medium">
499
- <TextField
500
- label="QwickApp TextField"
501
- span={6}
502
- fullWidth
503
- background="#f5f5f5"
504
- padding="medium"
505
- />
506
- <GridCell span={6} background="#e1f5fe" padding="medium">
507
- <Typography variant="body2">Regular GridCell with base props</Typography>
508
- <Box sx={{ mt: 1 }}>
509
- <TextField label="Nested TextField" size="small" fullWidth />
510
- </Box>
511
- </GridCell>
512
- <Button
513
- span={4}
514
- variant="contained"
515
- color="primary"
516
- padding="small"
517
- >
518
- QwickApp Button
519
- </Button>
520
- <GridCell span={4} padding="medium">
521
- <Button variant="outlined" fullWidth>Regular MUI Button</Button>
522
- </GridCell>
523
- <GridCell span={4} background="linear-gradient(45deg, #673ab7, #9c27b0)" padding="medium">
524
- <Typography sx={{ color: 'white', textAlign: 'center' }}>
525
- Custom Content
526
- </Typography>
527
- </GridCell>
528
- </GridLayout>
273
+ <SerializationDemo
274
+ title="Numeric Values - Age Range"
275
+ component={
276
+ <SelectInputField
277
+ label="Age Range"
278
+ value={25}
279
+ options={[
280
+ { value: 18, label: '18-24 years' },
281
+ { value: 25, label: '25-34 years' },
282
+ { value: 35, label: '35-44 years' },
283
+ { value: 45, label: '45+ years' }
284
+ ]}
285
+ />
286
+ }
287
+ />
529
288
  </Box>
530
- ),
289
+ )
531
290
  };
532
291
 
533
- // === ERROR & EDGE CASES ===
292
+ export const CompleteFormExample: Story = {
293
+ name: 'Complete Form - All Components Together',
294
+ render: () => {
295
+ const [formData, setFormData] = useState({
296
+ name: '',
297
+ email: '',
298
+ country: '',
299
+ description: '',
300
+ interests: ['Travel', 'Technology'],
301
+ notifications: true,
302
+ newsletter: false
303
+ });
534
304
 
535
- export const EdgeCases: StoryObj = {
536
- name: 'Edge Cases & Error Handling',
537
- render: () => (
538
- <Box sx={{ p: 2 }}>
539
- <Typography variant="h6" gutterBottom>Invalid Values (Check Console)</Typography>
540
- <Box sx={{ mb: 4 }}>
541
- <Typography variant="subtitle2" color="text.secondary" gutterBottom>
542
- These should show warnings in console but still render:
543
- </Typography>
544
- <GridLayout spacing="medium">
545
- <TextField
546
- label="Invalid width"
547
- width="invalid-value"
548
- span={6}
549
- fullWidth
550
- background="#ffe0e0"
305
+ const completeForm = (
306
+ <FormBlock
307
+ title="User Registration"
308
+ description="Create your account and personalize your experience"
309
+ status="info"
310
+ message="Please fill out all required fields to complete registration"
311
+ maxWidth="md"
312
+ background="gradient"
313
+ >
314
+ <Box sx={{ display: 'flex', flexDirection: 'column', gap: 3, p: 3 }}>
315
+ <TextInputField
316
+ label="Full Name"
317
+ value={formData.name}
318
+ placeholder="Enter your full name"
319
+ required={true}
551
320
  />
552
- <TextField
553
- label="Invalid spacing"
554
- padding="not-a-size"
555
- span={6}
556
- fullWidth
557
- background="#ffe0e0"
321
+
322
+ <TextInputField
323
+ label="Email Address"
324
+ value={formData.email}
325
+ type="email"
326
+ placeholder="your@email.com"
327
+ required={true}
328
+ helperText="We'll use this to send you important updates"
558
329
  />
559
- </GridLayout>
560
- </Box>
330
+
331
+ <SelectInputField
332
+ label="Country"
333
+ value={formData.country}
334
+ placeholder="Select your country"
335
+ options={[
336
+ { value: 'us', label: 'United States' },
337
+ { value: 'ca', label: 'Canada' },
338
+ { value: 'uk', label: 'United Kingdom' },
339
+ { value: 'de', label: 'Germany' },
340
+ { value: 'fr', label: 'France' }
341
+ ]}
342
+ required={true}
343
+ />
344
+
345
+ <HtmlInputField
346
+ label="About Yourself"
347
+ value={formData.description}
348
+ placeholder="Tell us about yourself (HTML formatting supported)"
349
+ rows={4}
350
+ multiline={true}
351
+ />
352
+
353
+ <ChoiceInputField
354
+ label="Interests"
355
+ options={formData.interests}
356
+ optionLabelPrefix="Interest"
357
+ placeholder="Add your interests..."
358
+ addButtonText="Add Interest"
359
+ />
360
+
361
+ <SwitchInputField
362
+ label="Email Notifications"
363
+ checked={formData.notifications}
364
+ helperText="Receive important updates via email"
365
+ color="primary"
366
+ />
367
+
368
+ <SwitchInputField
369
+ label="Newsletter Subscription"
370
+ checked={formData.newsletter}
371
+ helperText="Get weekly newsletters with tips and updates"
372
+ color="secondary"
373
+ />
374
+ </Box>
375
+ </FormBlock>
376
+ );
561
377
 
562
- <Typography variant="h6" gutterBottom>Extreme Values</Typography>
563
- <GridLayout spacing="x-large">
564
- <TextField
565
- label="Zero dimensions"
566
- width={0}
567
- height={0}
568
- span={4}
569
- background="#f0f0f0"
570
- />
571
- <TextField
572
- label="Large padding"
573
- padding="50px"
574
- span={4}
575
- background="#f0f0f0"
378
+ return (
379
+ <Box sx={{ p: 4 }}>
380
+ <Typography variant="h4" gutterBottom>
381
+ Complete Form Example - All Components Working Together
382
+ </Typography>
383
+
384
+ <Typography variant="body1" paragraph color="text.secondary">
385
+ This example demonstrates all form components working together in a complete registration form.
386
+ The entire form structure can be serialized and reconstructed using the ComponentTransformer.
387
+ </Typography>
388
+
389
+ <SerializationDemo
390
+ title="Complete User Registration Form"
391
+ component={completeForm}
576
392
  />
577
- <Button
578
- span={4}
579
- width="1000px"
580
- height="100px"
581
- variant="outlined"
582
- >
583
- Oversized Button
584
- </Button>
585
- </GridLayout>
586
- </Box>
587
- ),
393
+ </Box>
394
+ );
395
+ }
588
396
  };