@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.
- package/README.md +1688 -2
- package/dist/__tests__/schemas/transformers/MockSerializableComponent.d.ts +66 -0
- package/dist/__tests__/schemas/transformers/MockSerializableComponent.d.ts.map +1 -0
- package/dist/components/ErrorBoundary.d.ts +7 -0
- package/dist/components/ErrorBoundary.d.ts.map +1 -1
- package/dist/components/Html.d.ts +28 -18
- package/dist/components/Html.d.ts.map +1 -1
- package/dist/components/Logo.d.ts +12 -35
- package/dist/components/Logo.d.ts.map +1 -1
- package/dist/components/Markdown.d.ts +18 -13
- package/dist/components/Markdown.d.ts.map +1 -1
- package/dist/components/QwickApp.d.ts +16 -3
- package/dist/components/QwickApp.d.ts.map +1 -1
- package/dist/components/QwickIcon.d.ts +23 -0
- package/dist/components/QwickIcon.d.ts.map +1 -0
- package/dist/components/SafeSpan.d.ts +12 -5
- package/dist/components/SafeSpan.d.ts.map +1 -1
- package/dist/components/Scaffold.d.ts.map +1 -1
- package/dist/components/base/ModelView.d.ts +101 -0
- package/dist/components/base/ModelView.d.ts.map +1 -0
- package/dist/components/base/index.d.ts +11 -0
- package/dist/components/base/index.d.ts.map +1 -0
- package/dist/components/blocks/Article.d.ts +12 -2
- package/dist/components/blocks/Article.d.ts.map +1 -1
- package/dist/components/blocks/Code.d.ts +13 -2
- package/dist/components/blocks/Code.d.ts.map +1 -1
- package/dist/components/blocks/Content.d.ts.map +1 -1
- package/dist/components/blocks/CoverImageHeader.d.ts.map +1 -1
- package/dist/components/blocks/FeatureCard.d.ts.map +1 -1
- package/dist/components/blocks/FeatureGrid.d.ts.map +1 -1
- package/dist/components/blocks/Footer.d.ts.map +1 -1
- package/dist/components/blocks/HeroBlock.d.ts +27 -13
- package/dist/components/blocks/HeroBlock.d.ts.map +1 -1
- package/dist/components/blocks/Image.d.ts +41 -0
- package/dist/components/blocks/Image.d.ts.map +1 -0
- package/dist/components/blocks/PageBannerHeader.d.ts.map +1 -1
- package/dist/components/blocks/ProductCard.d.ts.map +1 -1
- package/dist/components/blocks/Section.d.ts +16 -2
- package/dist/components/blocks/Section.d.ts.map +1 -1
- package/dist/components/blocks/Text.d.ts +41 -0
- package/dist/components/blocks/Text.d.ts.map +1 -0
- package/dist/components/blocks/index.d.ts +4 -0
- package/dist/components/blocks/index.d.ts.map +1 -1
- package/dist/components/buttons/Button.d.ts +23 -7
- package/dist/components/buttons/Button.d.ts.map +1 -1
- package/dist/components/forms/FormBlock.d.ts +19 -13
- package/dist/components/forms/FormBlock.d.ts.map +1 -1
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/input/ChoiceInputField.d.ts +17 -11
- package/dist/components/input/ChoiceInputField.d.ts.map +1 -1
- package/dist/components/input/HtmlInputField.d.ts +17 -11
- package/dist/components/input/HtmlInputField.d.ts.map +1 -1
- package/dist/components/input/SelectInputField.d.ts +16 -10
- package/dist/components/input/SelectInputField.d.ts.map +1 -1
- package/dist/components/input/SwitchInputField.d.ts +16 -10
- package/dist/components/input/SwitchInputField.d.ts.map +1 -1
- package/dist/components/input/TextField.d.ts.map +1 -1
- package/dist/components/input/TextInputField.d.ts +16 -11
- package/dist/components/input/TextInputField.d.ts.map +1 -1
- package/dist/components/layout/GridCell.d.ts +23 -6
- package/dist/components/layout/GridCell.d.ts.map +1 -1
- package/dist/components/layout/GridLayout.d.ts +24 -23
- package/dist/components/layout/GridLayout.d.ts.map +1 -1
- package/dist/components/pages/FormPage.d.ts.map +1 -1
- package/dist/components/pages/Page.d.ts +49 -87
- package/dist/components/pages/Page.d.ts.map +1 -1
- package/dist/components/pages/index.d.ts +2 -2
- package/dist/components/pages/index.d.ts.map +1 -1
- package/dist/config/AppConfig.d.ts +49 -0
- package/dist/config/AppConfig.d.ts.map +1 -0
- package/dist/config/AppConfigBuilder.d.ts +75 -0
- package/dist/config/AppConfigBuilder.d.ts.map +1 -0
- package/dist/config/index.d.ts +13 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/types.d.ts +130 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config.d.ts +15 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.esm.js +451 -0
- package/dist/config.js +455 -0
- package/dist/contexts/PrintModeContext.d.ts +27 -0
- package/dist/contexts/PrintModeContext.d.ts.map +1 -0
- package/dist/contexts/QwickAppContext.d.ts +2 -2
- package/dist/contexts/QwickAppContext.d.ts.map +1 -1
- package/dist/contexts/ThemeContext.d.ts.map +1 -1
- package/dist/contexts/index.d.ts +2 -0
- package/dist/contexts/index.d.ts.map +1 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/usePrintMode.d.ts +39 -0
- package/dist/hooks/usePrintMode.d.ts.map +1 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.css +1 -1
- package/dist/index.esm.js +20722 -16021
- package/dist/index.js +20725 -16010
- package/dist/schemas/CodeSchema.d.ts +2 -1
- package/dist/schemas/CodeSchema.d.ts.map +1 -1
- package/dist/schemas/CollapsibleLayoutSchema.d.ts +2 -1
- package/dist/schemas/CollapsibleLayoutSchema.d.ts.map +1 -1
- package/dist/schemas/ContentSchema.d.ts +2 -1
- package/dist/schemas/ContentSchema.d.ts.map +1 -1
- package/dist/schemas/GridCellSchema.d.ts +25 -0
- package/dist/schemas/GridCellSchema.d.ts.map +1 -0
- package/dist/schemas/GridLayoutSchema.d.ts +23 -0
- package/dist/schemas/GridLayoutSchema.d.ts.map +1 -0
- package/dist/schemas/HtmlSchema.d.ts +14 -0
- package/dist/schemas/HtmlSchema.d.ts.map +1 -0
- package/dist/schemas/ImageSchema.d.ts +32 -0
- package/dist/schemas/ImageSchema.d.ts.map +1 -0
- package/dist/schemas/LogoSchema.d.ts +35 -0
- package/dist/schemas/LogoSchema.d.ts.map +1 -0
- package/dist/schemas/MarkdownSchema.d.ts +14 -0
- package/dist/schemas/MarkdownSchema.d.ts.map +1 -0
- package/dist/schemas/PageTemplateSchema.d.ts +31 -0
- package/dist/schemas/PageTemplateSchema.d.ts.map +1 -0
- package/dist/schemas/PrintConfigSchema.d.ts +31 -0
- package/dist/schemas/PrintConfigSchema.d.ts.map +1 -0
- package/dist/schemas/SectionSchema.d.ts +2 -1
- package/dist/schemas/SectionSchema.d.ts.map +1 -1
- package/dist/schemas/TextSchema.d.ts +37 -0
- package/dist/schemas/TextSchema.d.ts.map +1 -0
- package/dist/schemas/ViewModelSchema.d.ts +23 -0
- package/dist/schemas/ViewModelSchema.d.ts.map +1 -0
- package/dist/schemas/index.d.ts +15 -1
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/transformers/ComponentTransformer.d.ts +116 -0
- package/dist/schemas/transformers/ComponentTransformer.d.ts.map +1 -0
- package/dist/schemas/transformers/ReactNodeTransformer.d.ts +53 -0
- package/dist/schemas/transformers/ReactNodeTransformer.d.ts.map +1 -0
- package/dist/schemas/transformers/__tests__/MockSerializableComponent.d.ts +66 -0
- package/dist/schemas/transformers/__tests__/MockSerializableComponent.d.ts.map +1 -0
- package/dist/schemas/transformers/registry.d.ts +15 -0
- package/dist/schemas/transformers/registry.d.ts.map +1 -0
- package/dist/schemas/types/Serializable.d.ts +46 -0
- package/dist/schemas/types/Serializable.d.ts.map +1 -0
- package/dist/utils/htmlTransform.d.ts.map +1 -1
- package/dist/utils/reactUtils.d.ts +12 -3
- package/dist/utils/reactUtils.d.ts.map +1 -1
- package/package.json +17 -3
- package/src/{components/__tests__ → __tests__/components}/AccessibilityProvider.test.tsx +1 -1
- package/src/{components/__tests__ → __tests__/components}/Article.test.tsx +1 -1
- package/src/{components/__tests__ → __tests__/components}/Breadcrumbs.test.tsx +1 -1
- package/src/{components/__tests__ → __tests__/components}/Button.test.tsx +1 -1
- package/src/{components/__tests__ → __tests__/components}/CardListGrid.test.tsx +2 -2
- package/src/{components/__tests__ → __tests__/components}/ChoiceInputField.test.tsx +1 -1
- package/src/{components/__tests__ → __tests__/components}/Code.test.tsx +1 -1
- package/src/{components/__tests__ → __tests__/components}/Content.integration.test.tsx +1 -1
- package/src/{components/__tests__ → __tests__/components}/Content.test.tsx +1 -1
- package/src/{components/__tests__ → __tests__/components}/CoverImageHeader.test.tsx +2 -2
- package/src/{components/__tests__ → __tests__/components}/ErrorBoundary.test.tsx +1 -1
- package/src/{components/__tests__ → __tests__/components}/FeatureCard.integration.test.tsx +2 -2
- package/src/{components/__tests__ → __tests__/components}/FeatureGrid.integration.test.tsx +2 -2
- package/src/{components/__tests__ → __tests__/components}/FeatureGrid.test.tsx +2 -2
- package/src/{components/__tests__ → __tests__/components}/Footer.test.tsx +4 -4
- package/src/{components/__tests__ → __tests__/components}/FormBlock.test.tsx +1 -1
- package/src/{components/__tests__ → __tests__/components}/HeroBlock.integration.test.tsx +2 -2
- package/src/{components/__tests__ → __tests__/components}/HeroBlock.test.tsx +233 -7
- package/src/{components/__tests__ → __tests__/components}/Html.test.tsx +11 -2
- package/src/{components/__tests__ → __tests__/components}/HtmlInputField.test.tsx +3 -3
- package/src/__tests__/components/Logo.test.js +3 -3
- package/src/{components/__tests__ → __tests__/components}/Markdown.test.tsx +1 -1
- package/src/{components/__tests__ → __tests__/components}/PageBannerHeader.test.tsx +3 -3
- package/src/{components/__tests__ → __tests__/components}/PaletteSwitcher.test.tsx +3 -3
- package/src/{components/__tests__ → __tests__/components}/ProductCard.test.tsx +4 -4
- package/src/{components/__tests__ → __tests__/components}/SafeSpan.integration.test.tsx +2 -2
- package/src/{components/__tests__ → __tests__/components}/SafeSpan.simple.test.tsx +1 -1
- package/src/{components/__tests__ → __tests__/components}/SafeSpan.test.tsx +1 -1
- package/src/{components/__tests__ → __tests__/components}/Section.integration.test.tsx +1 -1
- package/src/{components/__tests__ → __tests__/components}/Section.test.tsx +1 -1
- package/src/{components/__tests__ → __tests__/components}/SelectInputField.test.tsx +1 -1
- package/src/{components/__tests__ → __tests__/components}/TextInputField.test.tsx +3 -3
- package/src/{components/__tests__ → __tests__/components}/ThemeSwitcher.test.tsx +3 -3
- package/src/__tests__/components/base/ModelView.test.tsx +220 -0
- package/src/__tests__/components/blocks/Code.performance.test.tsx +625 -0
- package/src/__tests__/components/blocks/Code.serialization.test.tsx +507 -0
- package/src/__tests__/components/blocks/HeroBlock.serialization.test.tsx +414 -0
- package/src/__tests__/components/blocks/Image.serialization.test.tsx +257 -0
- package/src/__tests__/components/blocks/Section.serialization.test.tsx +553 -0
- package/src/__tests__/components/blocks/Text.performance.test.tsx +442 -0
- package/src/__tests__/components/blocks/Text.serialization.test.tsx +491 -0
- package/src/__tests__/components/buttons/Button.serialization.test.tsx +443 -0
- package/src/__tests__/components/input/FormComponents.serialization.test.tsx +482 -0
- package/src/__tests__/components/input/SelectInputField.serialization.test.tsx +439 -0
- package/src/__tests__/components/input/TextInputField.serialization.test.tsx +359 -0
- package/src/{components/layout/CollapsibleLayout/__tests__ → __tests__/components/layout}/CollapsibleLayout.test.tsx +4 -4
- package/src/__tests__/components/layout/GridCell.serialization.test.tsx +403 -0
- package/src/__tests__/components/layout/GridLayout.serialization.test.tsx +311 -0
- package/src/__tests__/hooks/usePrintMode.test.ts +89 -0
- package/src/__tests__/schemas/PageTemplateSchema.test.ts +161 -0
- package/src/__tests__/schemas/PrintConfigSchema.test.ts +127 -0
- package/src/__tests__/schemas/ViewModelSchema.test.ts +80 -0
- package/src/__tests__/schemas/transformers/ComponentSerializationPatterns.test.tsx +602 -0
- package/src/__tests__/schemas/transformers/ComponentTransformer.htmlPatterns.test.ts +301 -0
- package/src/__tests__/schemas/transformers/ComponentTransformer.test.ts +521 -0
- package/src/__tests__/schemas/transformers/CrossBrowserCompatibility.test.ts +586 -0
- package/src/__tests__/schemas/transformers/MockSerializableComponent.ts +103 -0
- package/src/__tests__/schemas/transformers/RealWorldScenarios.test.tsx +1165 -0
- package/src/__tests__/schemas/transformers/SerializationErrorHandling.test.ts +602 -0
- package/src/__tests__/schemas/transformers/SerializationIntegration.test.tsx +691 -0
- package/src/__tests__/schemas/transformers/SerializationPerformance.test.ts +460 -0
- package/src/__tests__/schemas/transformers/TestAutomation.test.ts +597 -0
- package/src/{utils/__tests__ → __tests__/utils}/nested-dom-fix.test.tsx +1 -1
- package/src/components/ErrorBoundary.tsx +8 -8
- package/src/components/Html.tsx +147 -44
- package/src/components/Logo.tsx +198 -100
- package/src/components/Markdown.tsx +125 -16
- package/src/components/QwickApp.tsx +64 -31
- package/src/components/QwickIcon.tsx +59 -0
- package/src/components/SafeSpan.tsx +65 -10
- package/src/components/Scaffold.tsx +2 -8
- package/src/components/base/ModelView.tsx +199 -0
- package/src/components/base/index.ts +11 -0
- package/src/components/blocks/Article.tsx +57 -18
- package/src/components/blocks/Code.md +529 -0
- package/src/components/blocks/Code.tsx +102 -15
- package/src/components/blocks/Content.tsx +25 -77
- package/src/components/blocks/CoverImageHeader.tsx +9 -4
- package/src/components/blocks/FeatureCard.tsx +1 -2
- package/src/components/blocks/FeatureGrid.tsx +19 -1
- package/src/components/blocks/Footer.tsx +13 -1
- package/src/components/blocks/HeroBlock.tsx +87 -20
- package/src/components/blocks/Image.tsx +395 -0
- package/src/components/blocks/PageBannerHeader.tsx +14 -12
- package/src/components/blocks/ProductCard.tsx +51 -52
- package/src/components/blocks/Section.tsx +113 -8
- package/src/components/blocks/Text.tsx +285 -0
- package/src/components/blocks/index.ts +4 -0
- package/src/components/buttons/Button.tsx +184 -15
- package/src/components/forms/FormBlock.tsx +70 -17
- package/src/components/index.ts +5 -0
- package/src/components/input/ChoiceInputField.tsx +48 -18
- package/src/components/input/HtmlInputField.tsx +48 -18
- package/src/components/input/SelectInputField.tsx +48 -16
- package/src/components/input/SwitchInputField.tsx +48 -17
- package/src/components/input/TextField.tsx +41 -1
- package/src/components/input/TextInputField.tsx +52 -18
- package/src/components/layout/GridCell.tsx +118 -9
- package/src/components/layout/GridLayout.tsx +125 -24
- package/src/components/pages/FormPage.tsx +0 -1
- package/src/components/pages/Page.css +304 -332
- package/src/components/pages/Page.tsx +307 -255
- package/src/components/pages/index.ts +2 -2
- package/src/config/AppConfig.ts +133 -0
- package/src/config/AppConfigBuilder.ts +421 -0
- package/src/config/__tests__/AppConfig.test.ts +385 -0
- package/src/config/__tests__/AppConfigBuilder.test.ts +432 -0
- package/src/config/index.ts +24 -0
- package/src/config/types.ts +170 -0
- package/src/config.ts +25 -0
- package/src/contexts/PrintModeContext.tsx +332 -0
- package/src/contexts/QwickAppContext.tsx +2 -2
- package/src/contexts/ThemeContext.tsx +1 -2
- package/src/contexts/index.ts +2 -0
- package/src/hooks/index.ts +5 -1
- package/src/hooks/usePrintMode.ts +73 -0
- package/src/index.ts +3 -0
- package/src/schemas/CodeSchema.ts +3 -3
- package/src/schemas/CollapsibleLayoutSchema.ts +2 -1
- package/src/schemas/ContentSchema.ts +2 -1
- package/src/schemas/GridCellSchema.ts +164 -0
- package/src/schemas/GridLayoutSchema.ts +133 -0
- package/src/schemas/HtmlSchema.ts +47 -0
- package/src/schemas/ImageSchema.ts +235 -0
- package/src/schemas/LogoSchema.ts +241 -0
- package/src/schemas/MarkdownSchema.ts +47 -0
- package/src/schemas/PageTemplateSchema.ts +186 -0
- package/src/schemas/PrintConfigSchema.ts +207 -0
- package/src/schemas/README.md +661 -0
- package/src/schemas/SectionSchema.ts +2 -1
- package/src/schemas/TextSchema.ts +329 -0
- package/src/schemas/ViewModelSchema.ts +115 -0
- package/src/schemas/index.ts +21 -2
- package/src/schemas/transformers/ComponentTransformer.ts +403 -0
- package/src/schemas/transformers/ReactNodeTransformer.ts +236 -0
- package/src/schemas/transformers/registry.ts +72 -0
- package/src/schemas/types/Serializable.ts +51 -0
- package/src/stories/AccessibilityProvider.stories.tsx +253 -253
- package/src/stories/Article.stories.tsx +433 -433
- package/src/stories/Button.stories.tsx +1 -1
- package/src/stories/CardListGrid.stories.tsx +451 -451
- package/src/stories/ChoiceInputField.stories.tsx +503 -503
- package/src/stories/Code.stories.tsx +1 -1
- package/src/stories/CollapsibleLayout.stories.tsx +1414 -1414
- package/src/stories/Content.stories.tsx +393 -393
- package/src/stories/CoverImageHeader.stories.tsx +701 -701
- package/src/stories/DataBinding.advanced.stories.tsx +432 -432
- package/src/stories/DataProvider.stories.tsx +1192 -1192
- package/src/stories/FeatureCard.stories.tsx +557 -557
- package/src/stories/FeatureGrid.stories.tsx +594 -594
- package/src/stories/Footer.stories.tsx +640 -640
- package/src/stories/FormBlock.stories.tsx +760 -760
- package/src/stories/FormComponents.stories.tsx +349 -541
- package/src/stories/GridCell.stories.tsx +417 -0
- package/src/stories/GridLayout.stories.tsx +353 -0
- package/src/stories/HeroBlock.stories.tsx +862 -373
- package/src/stories/HtmlInputField.stories.tsx +474 -474
- package/src/stories/Image.stories.tsx +819 -0
- package/src/stories/Introduction.stories.tsx +667 -667
- package/src/stories/LayoutBlocks.stories.tsx +324 -324
- package/src/stories/Logo.stories.tsx +165 -6
- package/src/stories/Markdown.stories.tsx +137 -137
- package/src/stories/ModelView.stories.tsx +477 -0
- package/src/stories/Page.stories.tsx +688 -688
- package/src/stories/PageBannerHeader.stories.tsx +864 -864
- package/src/stories/PaletteSwitcher.stories.tsx +119 -119
- package/src/stories/ProductCard.stories.tsx +424 -424
- package/src/stories/QwickApp.stories.tsx +368 -368
- package/src/stories/ResponsiveMenu.stories.tsx +249 -249
- package/src/stories/SafeSpan.stories.tsx +531 -531
- package/src/stories/Section.stories.tsx +90 -2
- package/src/stories/SelectInputField.stories.tsx +524 -524
- package/src/stories/Text.stories.tsx +560 -0
- package/src/stories/TextInputField.stories.tsx +443 -443
- package/src/stories/ThemeSwitcher.stories.tsx +123 -123
- package/src/utils/htmlTransform.tsx +74 -53
- package/src/utils/reactUtils.tsx +57 -6
- package/dist/index.bundled.css +0 -12
- /package/src/{hooks/__tests__ → __tests__/hooks}/useDataBinding.test.tsx.disabled +0 -0
- /package/src/{schemas/__tests__ → __tests__/schemas}/builders.test.ts +0 -0
- /package/src/{utils/__tests__ → __tests__/utils}/createDataDrivenComponent.test.tsx.disabled +0 -0
- /package/src/{utils/__tests__ → __tests__/utils}/htmlTransform.test.tsx +0 -0
- /package/src/{utils/__tests__ → __tests__/utils}/optional-logging.test.ts +0 -0
|
@@ -1,588 +1,396 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Form Components Stories -
|
|
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
|
|
17
|
+
import React, { useState } from 'react';
|
|
6
18
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
7
|
-
import { Button } from '
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
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: '
|
|
34
|
+
title: 'Form Components/Complete Showcase',
|
|
14
35
|
parameters: {
|
|
15
|
-
layout: '
|
|
36
|
+
layout: 'fullscreen',
|
|
16
37
|
docs: {
|
|
17
38
|
description: {
|
|
18
|
-
component: `
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
**
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
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
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
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
|
-
|
|
110
|
+
Serialize to JSON
|
|
226
111
|
</Button>
|
|
227
|
-
<Button
|
|
228
|
-
variant="
|
|
229
|
-
|
|
230
|
-
|
|
112
|
+
<Button
|
|
113
|
+
variant="outlined"
|
|
114
|
+
size="small"
|
|
115
|
+
onClick={handleDeserialize}
|
|
116
|
+
disabled={!serializedData}
|
|
231
117
|
>
|
|
232
|
-
|
|
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
|
-
|
|
265
|
-
|
|
266
|
-
<
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
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
|
-
|
|
293
|
-
|
|
294
|
-
<
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
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
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
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
|
|
329
|
-
name: '
|
|
166
|
+
export const TextInputFieldShowcase: Story = {
|
|
167
|
+
name: 'TextInputField - Text Input Component',
|
|
330
168
|
render: () => (
|
|
331
|
-
<Box sx={{ p:
|
|
332
|
-
<Typography variant="
|
|
333
|
-
|
|
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
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
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
|
-
|
|
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
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
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
|
-
|
|
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:
|
|
452
|
-
<Typography variant="
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
<
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
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
|
-
|
|
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
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
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
|
-
|
|
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
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
<
|
|
545
|
-
<
|
|
546
|
-
label="
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
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
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
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
|
-
|
|
560
|
-
|
|
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
|
-
|
|
563
|
-
<
|
|
564
|
-
<
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
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
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
height="100px"
|
|
581
|
-
variant="outlined"
|
|
582
|
-
>
|
|
583
|
-
Oversized Button
|
|
584
|
-
</Button>
|
|
585
|
-
</GridLayout>
|
|
586
|
-
</Box>
|
|
587
|
-
),
|
|
393
|
+
</Box>
|
|
394
|
+
);
|
|
395
|
+
}
|
|
588
396
|
};
|