@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
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GridCell Stories - Grid layout cell wrapper with serialization support
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
6
|
+
import { GridCell } from '../components/layout/GridCell';
|
|
7
|
+
import { Text } from '../components/blocks/Text';
|
|
8
|
+
import { Button } from '../components/buttons/Button';
|
|
9
|
+
import { Code } from '../components/blocks/Code';
|
|
10
|
+
import { Image } from '../components/blocks/Image';
|
|
11
|
+
import { ComponentTransformer } from '../schemas/transformers/ComponentTransformer';
|
|
12
|
+
import React from 'react';
|
|
13
|
+
|
|
14
|
+
// Ensure components are registered for serialization
|
|
15
|
+
ComponentTransformer.registerComponent(GridCell as any);
|
|
16
|
+
ComponentTransformer.registerComponent(Text as any);
|
|
17
|
+
ComponentTransformer.registerComponent(Button as any);
|
|
18
|
+
ComponentTransformer.registerComponent(Code as any);
|
|
19
|
+
ComponentTransformer.registerComponent(Image as any);
|
|
20
|
+
|
|
21
|
+
const meta: Meta<typeof GridCell> = {
|
|
22
|
+
title: 'Layout/GridCell',
|
|
23
|
+
component: GridCell,
|
|
24
|
+
parameters: {
|
|
25
|
+
layout: 'centered',
|
|
26
|
+
docs: {
|
|
27
|
+
description: {
|
|
28
|
+
component: `GridCell is a wrapper component for grid layout cells that supports comprehensive responsive behavior and serialization.
|
|
29
|
+
|
|
30
|
+
**Key Features:**
|
|
31
|
+
- **Responsive Grid Properties**: Full breakpoint support (xs, sm, md, lg, xl)
|
|
32
|
+
- **Flexible Span System**: Span-based column width control
|
|
33
|
+
- **Base Props Support**: Inherits styling capabilities (background, padding, margin, dimensions)
|
|
34
|
+
- **Nested Component Support**: Handles any content including other serializable components
|
|
35
|
+
- **Serialization Ready**: Complete ModelView implementation for serialize → deserialize workflows
|
|
36
|
+
- **Grid Integration**: Works seamlessly with GridLayout for data-driven layouts
|
|
37
|
+
|
|
38
|
+
**Responsive Behavior:**
|
|
39
|
+
- **xs**: Extra small screens (mobile portrait)
|
|
40
|
+
- **sm**: Small screens (mobile landscape, small tablets)
|
|
41
|
+
- **md**: Medium screens (tablets, small laptops)
|
|
42
|
+
- **lg**: Large screens (desktops)
|
|
43
|
+
- **xl**: Extra large screens (large desktops, wide monitors)
|
|
44
|
+
|
|
45
|
+
**Serialization Features:**
|
|
46
|
+
- Preserves all responsive grid properties
|
|
47
|
+
- Maintains styling properties (background, padding, margins)
|
|
48
|
+
- Handles nested component serialization automatically
|
|
49
|
+
- Supports mixed content serialization`,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
decorators: [
|
|
54
|
+
(Story) => (
|
|
55
|
+
<div style={{
|
|
56
|
+
width: '100%',
|
|
57
|
+
minHeight: '200px',
|
|
58
|
+
display: 'grid',
|
|
59
|
+
gridTemplateColumns: 'repeat(12, 1fr)',
|
|
60
|
+
gap: '16px',
|
|
61
|
+
padding: '16px',
|
|
62
|
+
backgroundColor: '#f8f9fa'
|
|
63
|
+
}}>
|
|
64
|
+
<Story />
|
|
65
|
+
</div>
|
|
66
|
+
),
|
|
67
|
+
],
|
|
68
|
+
argTypes: {
|
|
69
|
+
span: {
|
|
70
|
+
control: { type: 'number', min: 1, max: 12 },
|
|
71
|
+
description: 'Number of columns to span (1-12)',
|
|
72
|
+
},
|
|
73
|
+
xs: {
|
|
74
|
+
control: { type: 'number', min: 1, max: 12 },
|
|
75
|
+
description: 'Columns on extra small screens',
|
|
76
|
+
},
|
|
77
|
+
sm: {
|
|
78
|
+
control: { type: 'number', min: 1, max: 12 },
|
|
79
|
+
description: 'Columns on small screens',
|
|
80
|
+
},
|
|
81
|
+
md: {
|
|
82
|
+
control: { type: 'number', min: 1, max: 12 },
|
|
83
|
+
description: 'Columns on medium screens',
|
|
84
|
+
},
|
|
85
|
+
lg: {
|
|
86
|
+
control: { type: 'number', min: 1, max: 12 },
|
|
87
|
+
description: 'Columns on large screens',
|
|
88
|
+
},
|
|
89
|
+
xl: {
|
|
90
|
+
control: { type: 'number', min: 1, max: 12 },
|
|
91
|
+
description: 'Columns on extra large screens',
|
|
92
|
+
},
|
|
93
|
+
background: {
|
|
94
|
+
control: 'text',
|
|
95
|
+
description: 'Background color or theme color',
|
|
96
|
+
},
|
|
97
|
+
padding: {
|
|
98
|
+
control: { type: 'select', options: ['tiny', 'small', 'medium', 'large', 'huge', 'none'] },
|
|
99
|
+
description: 'Internal spacing',
|
|
100
|
+
},
|
|
101
|
+
margin: {
|
|
102
|
+
control: { type: 'select', options: ['tiny', 'small', 'medium', 'large', 'huge', 'none'] },
|
|
103
|
+
description: 'External spacing',
|
|
104
|
+
},
|
|
105
|
+
height: {
|
|
106
|
+
control: 'text',
|
|
107
|
+
description: 'Cell height',
|
|
108
|
+
},
|
|
109
|
+
width: {
|
|
110
|
+
control: 'text',
|
|
111
|
+
description: 'Cell width',
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export default meta;
|
|
117
|
+
type Story = StoryObj<typeof GridCell>;
|
|
118
|
+
|
|
119
|
+
// Basic GridCell examples
|
|
120
|
+
export const BasicCell: Story = {
|
|
121
|
+
args: {
|
|
122
|
+
span: 6,
|
|
123
|
+
background: '#ffffff',
|
|
124
|
+
padding: 'medium',
|
|
125
|
+
},
|
|
126
|
+
render: (args) => (
|
|
127
|
+
<GridCell {...args}>
|
|
128
|
+
<Text content="Basic Grid Cell" variant="h4" />
|
|
129
|
+
<Text content="This is a basic grid cell spanning 6 columns with medium padding and white background." variant="body1" />
|
|
130
|
+
</GridCell>
|
|
131
|
+
),
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
export const ResponsiveCell: Story = {
|
|
135
|
+
args: {
|
|
136
|
+
xs: 12,
|
|
137
|
+
sm: 8,
|
|
138
|
+
md: 6,
|
|
139
|
+
lg: 4,
|
|
140
|
+
xl: 3,
|
|
141
|
+
background: '#e3f2fd',
|
|
142
|
+
padding: 'large',
|
|
143
|
+
},
|
|
144
|
+
render: (args) => (
|
|
145
|
+
<GridCell {...args}>
|
|
146
|
+
<Text content="Responsive Cell" variant="h5" />
|
|
147
|
+
<Text content="Resize your browser to see responsive behavior:" variant="body1" />
|
|
148
|
+
<ul style={{ margin: '12px 0', paddingLeft: '20px' }}>
|
|
149
|
+
<li>Mobile (xs): 12 columns</li>
|
|
150
|
+
<li>Tablet (sm): 8 columns</li>
|
|
151
|
+
<li>Desktop (md): 6 columns</li>
|
|
152
|
+
<li>Large (lg): 4 columns</li>
|
|
153
|
+
<li>XL (xl): 3 columns</li>
|
|
154
|
+
</ul>
|
|
155
|
+
</GridCell>
|
|
156
|
+
),
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export const StyledCell: Story = {
|
|
160
|
+
args: {
|
|
161
|
+
span: 8,
|
|
162
|
+
background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
|
|
163
|
+
padding: 'huge',
|
|
164
|
+
margin: 'medium',
|
|
165
|
+
height: '200px',
|
|
166
|
+
},
|
|
167
|
+
render: (args) => (
|
|
168
|
+
<GridCell {...args}>
|
|
169
|
+
<div style={{ color: 'white', textAlign: 'center' }}>
|
|
170
|
+
<Text content="Styled Cell" variant="h3" color="inherit" />
|
|
171
|
+
<Text content="Custom background gradient with huge padding and medium margin" variant="body1" color="inherit" />
|
|
172
|
+
</div>
|
|
173
|
+
</GridCell>
|
|
174
|
+
),
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
// Content examples
|
|
178
|
+
export const WithTextContent: Story = {
|
|
179
|
+
args: {
|
|
180
|
+
span: 10,
|
|
181
|
+
background: '#f5f5f5',
|
|
182
|
+
padding: 'large',
|
|
183
|
+
},
|
|
184
|
+
render: (args) => (
|
|
185
|
+
<GridCell {...args}>
|
|
186
|
+
<Text content="Article Title" variant="h2" />
|
|
187
|
+
<Text content="Published on January 15, 2024" variant="caption" color="textSecondary" />
|
|
188
|
+
<Text content="This is the main article content. GridCell can contain rich text content with multiple Text components, each with their own styling and formatting options." variant="body1" />
|
|
189
|
+
<Text content="Supporting paragraph with additional information and context about the topic being discussed." variant="body2" />
|
|
190
|
+
</GridCell>
|
|
191
|
+
),
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
export const WithButtonActions: Story = {
|
|
195
|
+
args: {
|
|
196
|
+
span: 6,
|
|
197
|
+
background: '#fff',
|
|
198
|
+
padding: 'large',
|
|
199
|
+
},
|
|
200
|
+
render: (args) => (
|
|
201
|
+
<GridCell {...args}>
|
|
202
|
+
<Text content="Action Card" variant="h4" />
|
|
203
|
+
<Text content="This card demonstrates how GridCell can contain interactive elements." variant="body1" />
|
|
204
|
+
<div style={{ marginTop: '16px', display: 'flex', gap: '12px', flexWrap: 'wrap' }}>
|
|
205
|
+
<Button label="Primary Action" variant="primary" />
|
|
206
|
+
<Button label="Secondary" variant="outlined" />
|
|
207
|
+
<Button label="Text Button" variant="text" />
|
|
208
|
+
</div>
|
|
209
|
+
</GridCell>
|
|
210
|
+
),
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
export const WithCodeBlock: Story = {
|
|
214
|
+
args: {
|
|
215
|
+
span: 12,
|
|
216
|
+
background: '#1e1e1e',
|
|
217
|
+
padding: 'large',
|
|
218
|
+
},
|
|
219
|
+
render: (args) => (
|
|
220
|
+
<GridCell {...args}>
|
|
221
|
+
<Text content="Code Example" variant="h4" color="inherit" />
|
|
222
|
+
<Code
|
|
223
|
+
language="typescript"
|
|
224
|
+
title="GridCell Usage"
|
|
225
|
+
showCopy={true}
|
|
226
|
+
theme="dark"
|
|
227
|
+
>
|
|
228
|
+
{`import { GridCell } from '@qwickapps/react-framework';
|
|
229
|
+
|
|
230
|
+
function ResponsiveCard() {
|
|
231
|
+
return (
|
|
232
|
+
<GridCell
|
|
233
|
+
xs={12}
|
|
234
|
+
sm={6}
|
|
235
|
+
md={4}
|
|
236
|
+
background="background.paper"
|
|
237
|
+
padding="large"
|
|
238
|
+
>
|
|
239
|
+
<Text content="Responsive Card" variant="h5" />
|
|
240
|
+
<Text content="Content goes here..." variant="body1" />
|
|
241
|
+
</GridCell>
|
|
242
|
+
);
|
|
243
|
+
}`}
|
|
244
|
+
</Code>
|
|
245
|
+
</GridCell>
|
|
246
|
+
),
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
// Serialization examples
|
|
250
|
+
export const SerializationDemo: Story = {
|
|
251
|
+
args: {
|
|
252
|
+
xs: 12,
|
|
253
|
+
md: 8,
|
|
254
|
+
lg: 6,
|
|
255
|
+
background: 'background.paper',
|
|
256
|
+
padding: 'large',
|
|
257
|
+
margin: 'medium',
|
|
258
|
+
},
|
|
259
|
+
render: (args) => {
|
|
260
|
+
const cellComponent = (
|
|
261
|
+
<GridCell {...args}>
|
|
262
|
+
<Text content="Serializable GridCell" variant="h4" />
|
|
263
|
+
<Text content="This entire cell and its contents can be serialized to JSON and perfectly reconstructed." variant="body1" />
|
|
264
|
+
<Button label="Interactive Element" variant="outlined" />
|
|
265
|
+
<Code language="json" title="Partial Serialized Structure" showCopy={false}>
|
|
266
|
+
{`{
|
|
267
|
+
"tag": "GridCell",
|
|
268
|
+
"version": "1.0.0",
|
|
269
|
+
"data": {
|
|
270
|
+
"xs": 12,
|
|
271
|
+
"md": 8,
|
|
272
|
+
"lg": 6,
|
|
273
|
+
"background": "background.paper",
|
|
274
|
+
"padding": "large",
|
|
275
|
+
"margin": "medium",
|
|
276
|
+
"children": "[nested components...]"
|
|
277
|
+
}
|
|
278
|
+
}`}
|
|
279
|
+
</Code>
|
|
280
|
+
</GridCell>
|
|
281
|
+
);
|
|
282
|
+
|
|
283
|
+
return (
|
|
284
|
+
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(12, 1fr)', gap: '16px' }}>
|
|
285
|
+
<div style={{ gridColumn: '1 / -1', marginBottom: '16px' }}>
|
|
286
|
+
<h3>Original Component:</h3>
|
|
287
|
+
</div>
|
|
288
|
+
{cellComponent}
|
|
289
|
+
|
|
290
|
+
<div style={{ gridColumn: '1 / -1', marginTop: '24px' }}>
|
|
291
|
+
<h3>Round-trip Serialization Test:</h3>
|
|
292
|
+
</div>
|
|
293
|
+
{ComponentTransformer.deserialize(ComponentTransformer.serialize(cellComponent))}
|
|
294
|
+
|
|
295
|
+
<div style={{ gridColumn: '1 / -1', marginTop: '24px' }}>
|
|
296
|
+
<div style={{
|
|
297
|
+
padding: '16px',
|
|
298
|
+
backgroundColor: '#e7f3ff',
|
|
299
|
+
borderRadius: '8px',
|
|
300
|
+
fontSize: '14px'
|
|
301
|
+
}}>
|
|
302
|
+
<strong>✓ Serialization Test Passed</strong>
|
|
303
|
+
<br />
|
|
304
|
+
Both cells above should be identical, demonstrating that the component can be perfectly serialized and deserialized.
|
|
305
|
+
</div>
|
|
306
|
+
</div>
|
|
307
|
+
</div>
|
|
308
|
+
);
|
|
309
|
+
},
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
export const NestedSerializableComponents: Story = {
|
|
313
|
+
args: {
|
|
314
|
+
span: 12,
|
|
315
|
+
background: '#f8f9fa',
|
|
316
|
+
padding: 'huge',
|
|
317
|
+
},
|
|
318
|
+
render: (args) => (
|
|
319
|
+
<GridCell {...args}>
|
|
320
|
+
<Text content="Complex Nested Content" variant="h3" />
|
|
321
|
+
<Text content="This cell contains multiple types of serializable components:" variant="body1" />
|
|
322
|
+
|
|
323
|
+
<div style={{ margin: '24px 0' }}>
|
|
324
|
+
<Text content="1. Multiple Text Components" variant="h6" />
|
|
325
|
+
<Text content="Each with different styling and properties" variant="body2" color="textSecondary" />
|
|
326
|
+
</div>
|
|
327
|
+
|
|
328
|
+
<div style={{ margin: '24px 0' }}>
|
|
329
|
+
<Text content="2. Interactive Elements" variant="h6" />
|
|
330
|
+
<div style={{ display: 'flex', gap: '8px', marginTop: '8px' }}>
|
|
331
|
+
<Button label="Save" variant="primary" buttonSize="small" />
|
|
332
|
+
<Button label="Cancel" variant="outlined" buttonSize="small" />
|
|
333
|
+
</div>
|
|
334
|
+
</div>
|
|
335
|
+
|
|
336
|
+
<div style={{ margin: '24px 0' }}>
|
|
337
|
+
<Text content="3. Code Blocks" variant="h6" />
|
|
338
|
+
<Code language="javascript" title="Serialization Method">
|
|
339
|
+
{`// All of this content is preserved during serialization
|
|
340
|
+
const serialized = ComponentTransformer.serialize(cellComponent);
|
|
341
|
+
const deserialized = ComponentTransformer.deserialize(serialized);`}
|
|
342
|
+
</Code>
|
|
343
|
+
</div>
|
|
344
|
+
|
|
345
|
+
<Text content="All these nested components maintain their properties, styling, and interactivity through the serialization process." variant="body2" />
|
|
346
|
+
</GridCell>
|
|
347
|
+
),
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
export const PerformanceTest: Story = {
|
|
351
|
+
args: {
|
|
352
|
+
span: 12,
|
|
353
|
+
background: '#fff',
|
|
354
|
+
padding: 'medium',
|
|
355
|
+
},
|
|
356
|
+
render: (args) => {
|
|
357
|
+
// Create a cell with many nested components
|
|
358
|
+
const textItems = Array.from({ length: 15 }, (_, i) => (
|
|
359
|
+
<Text
|
|
360
|
+
key={i}
|
|
361
|
+
content={`Performance test item ${i + 1}: This text verifies that serialization remains fast even with many nested components.`}
|
|
362
|
+
variant="body2"
|
|
363
|
+
/>
|
|
364
|
+
));
|
|
365
|
+
|
|
366
|
+
const complexCell = (
|
|
367
|
+
<GridCell {...args}>
|
|
368
|
+
<Text content="Performance Test Cell" variant="h4" />
|
|
369
|
+
<Text content="This cell contains 15 Text components to test serialization performance:" variant="body1" />
|
|
370
|
+
{textItems}
|
|
371
|
+
<Button label="Test Button" variant="outlined" />
|
|
372
|
+
</GridCell>
|
|
373
|
+
);
|
|
374
|
+
|
|
375
|
+
// Measure serialization performance
|
|
376
|
+
const startTime = performance.now();
|
|
377
|
+
const serialized = ComponentTransformer.serialize(complexCell);
|
|
378
|
+
const deserialized = ComponentTransformer.deserialize(serialized);
|
|
379
|
+
const endTime = performance.now();
|
|
380
|
+
|
|
381
|
+
return (
|
|
382
|
+
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(12, 1fr)', gap: '16px' }}>
|
|
383
|
+
<div style={{
|
|
384
|
+
gridColumn: '1 / -1',
|
|
385
|
+
padding: '12px',
|
|
386
|
+
backgroundColor: '#e7f3ff',
|
|
387
|
+
borderRadius: '4px',
|
|
388
|
+
marginBottom: '16px'
|
|
389
|
+
}}>
|
|
390
|
+
<strong>Performance Result:</strong> Serialized and deserialized in {(endTime - startTime).toFixed(2)}ms
|
|
391
|
+
<br />
|
|
392
|
+
<small>Serialized size: {serialized.length.toLocaleString()} characters</small>
|
|
393
|
+
</div>
|
|
394
|
+
|
|
395
|
+
{deserialized}
|
|
396
|
+
</div>
|
|
397
|
+
);
|
|
398
|
+
},
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
export const ThemeIntegration: Story = {
|
|
402
|
+
args: {
|
|
403
|
+
xs: 12,
|
|
404
|
+
sm: 6,
|
|
405
|
+
background: 'primary.light',
|
|
406
|
+
padding: 'large',
|
|
407
|
+
},
|
|
408
|
+
render: (args) => (
|
|
409
|
+
<GridCell {...args}>
|
|
410
|
+
<Text content="Theme-Aware Cell" variant="h4" color="primary.contrastText" />
|
|
411
|
+
<Text content="This cell uses theme colors for background and automatically adjusts text color for contrast." variant="body1" color="primary.contrastText" />
|
|
412
|
+
<div style={{ marginTop: '16px' }}>
|
|
413
|
+
<Button label="Themed Button" variant="contained" />
|
|
414
|
+
</div>
|
|
415
|
+
</GridCell>
|
|
416
|
+
),
|
|
417
|
+
};
|