@qwickapps/react-framework 1.4.0 → 1.4.2
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/QUICK_START_GUIDE.md +82 -0
- package/README.md +231 -21
- package/dist/components/Html.d.ts.map +1 -1
- package/dist/components/Markdown.d.ts +1 -2
- package/dist/components/Markdown.d.ts.map +1 -1
- package/dist/components/SafeSpan.d.ts +1 -2
- package/dist/components/SafeSpan.d.ts.map +1 -1
- package/dist/components/base/Container.d.ts +32 -0
- package/dist/components/base/Container.d.ts.map +1 -0
- package/dist/components/base/ContainerView.d.ts +65 -0
- package/dist/components/base/ContainerView.d.ts.map +1 -0
- package/dist/components/base/ModelView.d.ts +37 -46
- package/dist/components/base/ModelView.d.ts.map +1 -1
- package/dist/components/base/index.d.ts +3 -2
- package/dist/components/base/index.d.ts.map +1 -1
- package/dist/components/blocks/Article.d.ts +1 -2
- package/dist/components/blocks/Article.d.ts.map +1 -1
- package/dist/components/blocks/Code-factory.d.ts +22 -0
- package/dist/components/blocks/Code-factory.d.ts.map +1 -0
- package/dist/components/blocks/Code-old.d.ts +31 -0
- package/dist/components/blocks/Code-old.d.ts.map +1 -0
- package/dist/components/blocks/Code.d.ts +30 -18
- package/dist/components/blocks/Code.d.ts.map +1 -1
- package/dist/components/blocks/HeroBlock.d.ts +1 -2
- package/dist/components/blocks/HeroBlock.d.ts.map +1 -1
- package/dist/components/blocks/Image.d.ts +1 -2
- package/dist/components/blocks/Image.d.ts.map +1 -1
- package/dist/components/blocks/Section.d.ts +1 -2
- package/dist/components/blocks/Section.d.ts.map +1 -1
- package/dist/components/blocks/Text.d.ts +35 -27
- package/dist/components/blocks/Text.d.ts.map +1 -1
- package/dist/components/buttons/Button.d.ts +1 -2
- package/dist/components/buttons/Button.d.ts.map +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/input/ChoiceInputField.d.ts +1 -2
- package/dist/components/input/ChoiceInputField.d.ts.map +1 -1
- package/dist/components/input/HtmlInputField.d.ts +1 -2
- package/dist/components/input/HtmlInputField.d.ts.map +1 -1
- package/dist/components/input/SelectInputField.d.ts +1 -2
- package/dist/components/input/SelectInputField.d.ts.map +1 -1
- package/dist/components/pages/Page.d.ts +29 -47
- package/dist/components/pages/Page.d.ts.map +1 -1
- package/dist/components/pages/index.d.ts +2 -3
- package/dist/components/pages/index.d.ts.map +1 -1
- package/dist/components/shared/createSerializableView.d.ts +68 -0
- package/dist/components/shared/createSerializableView.d.ts.map +1 -0
- package/dist/components/shared/viewProps.d.ts +37 -0
- package/dist/components/shared/viewProps.d.ts.map +1 -0
- package/dist/index.esm.js +21782 -22580
- package/dist/index.js +21782 -22579
- package/dist/qa/ConsoleWarningTest.d.ts +5 -0
- package/dist/qa/ConsoleWarningTest.d.ts.map +1 -0
- package/dist/qa/StorageKeyTest.d.ts +6 -0
- package/dist/qa/StorageKeyTest.d.ts.map +1 -0
- package/dist/qa/ThemeStorageKeyTest.d.ts +6 -0
- package/dist/qa/ThemeStorageKeyTest.d.ts.map +1 -0
- package/dist/schemas/CodeSchema.d.ts +2 -2
- package/dist/schemas/CodeSchema.d.ts.map +1 -1
- package/dist/schemas/ContainerSchema.d.ts +12 -0
- package/dist/schemas/ContainerSchema.d.ts.map +1 -0
- package/dist/schemas/PageTemplateSchema.d.ts +3 -3
- package/dist/schemas/PageTemplateSchema.d.ts.map +1 -1
- package/dist/schemas/ViewModelSchema.d.ts +46 -6
- package/dist/schemas/ViewModelSchema.d.ts.map +1 -1
- package/dist/schemas/ViewSchema.d.ts +65 -0
- package/dist/schemas/ViewSchema.d.ts.map +1 -0
- package/dist/schemas/index.d.ts +1 -1
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/transformers/ComponentTransformer.d.ts +27 -15
- package/dist/schemas/transformers/ComponentTransformer.d.ts.map +1 -1
- package/dist/schemas/transformers/ReactNodeTransformer.d.ts.map +1 -1
- package/dist/schemas/transformers/registry.d.ts +3 -0
- package/dist/schemas/transformers/registry.d.ts.map +1 -1
- package/dist/src/__tests__/schemas/transformers/MockSerializableComponent.d.ts +66 -0
- package/dist/src/__tests__/schemas/transformers/MockSerializableComponent.d.ts.map +1 -0
- package/dist/src/components/AccessibilityChecker.d.ts +12 -0
- package/dist/src/components/AccessibilityChecker.d.ts.map +1 -0
- package/dist/src/components/AccessibilityProvider.d.ts +64 -0
- package/dist/src/components/AccessibilityProvider.d.ts.map +1 -0
- package/dist/src/components/Breadcrumbs.d.ts +39 -0
- package/dist/src/components/Breadcrumbs.d.ts.map +1 -0
- package/dist/src/components/ErrorBoundary.d.ts +46 -0
- package/dist/src/components/ErrorBoundary.d.ts.map +1 -0
- package/dist/src/components/Html.d.ts +58 -0
- package/dist/src/components/Html.d.ts.map +1 -0
- package/dist/src/components/Logo.d.ts +56 -0
- package/dist/src/components/Logo.d.ts.map +1 -0
- package/dist/src/components/Markdown.d.ts +51 -0
- package/dist/src/components/Markdown.d.ts.map +1 -0
- package/dist/src/components/QwickApp.d.ts +69 -0
- package/dist/src/components/QwickApp.d.ts.map +1 -0
- package/dist/src/components/QwickAppsLogo.d.ts +25 -0
- package/dist/src/components/QwickAppsLogo.d.ts.map +1 -0
- package/dist/src/components/QwickIcon.d.ts +23 -0
- package/dist/src/components/QwickIcon.d.ts.map +1 -0
- package/dist/src/components/ResponsiveMenu.d.ts +38 -0
- package/dist/src/components/ResponsiveMenu.d.ts.map +1 -0
- package/dist/src/components/SafeSpan.d.ts +29 -0
- package/dist/src/components/SafeSpan.d.ts.map +1 -0
- package/dist/src/components/Scaffold.d.ts +57 -0
- package/dist/src/components/Scaffold.d.ts.map +1 -0
- package/dist/src/components/base/Container.d.ts +33 -0
- package/dist/src/components/base/Container.d.ts.map +1 -0
- package/dist/src/components/base/ModelView.d.ts +92 -0
- package/dist/src/components/base/ModelView.d.ts.map +1 -0
- package/dist/src/components/base/index.d.ts +12 -0
- package/dist/src/components/base/index.d.ts.map +1 -0
- package/dist/src/components/blocks/Article.d.ts +32 -0
- package/dist/src/components/blocks/Article.d.ts.map +1 -0
- package/dist/src/components/blocks/CardListGrid.d.ts +23 -0
- package/dist/src/components/blocks/CardListGrid.d.ts.map +1 -0
- package/dist/src/components/blocks/Code.d.ts +37 -0
- package/dist/src/components/blocks/Code.d.ts.map +1 -0
- package/dist/src/components/blocks/Content.d.ts +24 -0
- package/dist/src/components/blocks/Content.d.ts.map +1 -0
- package/dist/src/components/blocks/CoverImageHeader.d.ts +44 -0
- package/dist/src/components/blocks/CoverImageHeader.d.ts.map +1 -0
- package/dist/src/components/blocks/FeatureCard.d.ts +66 -0
- package/dist/src/components/blocks/FeatureCard.d.ts.map +1 -0
- package/dist/src/components/blocks/FeatureGrid.d.ts +48 -0
- package/dist/src/components/blocks/FeatureGrid.d.ts.map +1 -0
- package/dist/src/components/blocks/Footer.d.ts +56 -0
- package/dist/src/components/blocks/Footer.d.ts.map +1 -0
- package/dist/src/components/blocks/HeroBlock.d.ts +55 -0
- package/dist/src/components/blocks/HeroBlock.d.ts.map +1 -0
- package/dist/src/components/blocks/Image.d.ts +40 -0
- package/dist/src/components/blocks/Image.d.ts.map +1 -0
- package/dist/src/components/blocks/PageBannerHeader.d.ts +30 -0
- package/dist/src/components/blocks/PageBannerHeader.d.ts.map +1 -0
- package/dist/src/components/blocks/ProductCard.d.ts +57 -0
- package/dist/src/components/blocks/ProductCard.d.ts.map +1 -0
- package/dist/src/components/blocks/Section.d.ts +45 -0
- package/dist/src/components/blocks/Section.d.ts.map +1 -0
- package/dist/src/components/blocks/Text.d.ts +34 -0
- package/dist/src/components/blocks/Text.d.ts.map +1 -0
- package/dist/src/components/blocks/index.d.ts +41 -0
- package/dist/src/components/blocks/index.d.ts.map +1 -0
- package/dist/src/components/buttons/Button.d.ts +41 -0
- package/dist/src/components/buttons/Button.d.ts.map +1 -0
- package/dist/src/components/buttons/PaletteSwitcher.d.ts +24 -0
- package/dist/src/components/buttons/PaletteSwitcher.d.ts.map +1 -0
- package/dist/src/components/buttons/ThemeSwitcher.d.ts +24 -0
- package/dist/src/components/buttons/ThemeSwitcher.d.ts.map +1 -0
- package/dist/src/components/buttons/index.d.ts +11 -0
- package/dist/src/components/buttons/index.d.ts.map +1 -0
- package/dist/src/components/forms/FormBlock.d.ts +51 -0
- package/dist/src/components/forms/FormBlock.d.ts.map +1 -0
- package/dist/src/components/forms/index.d.ts +8 -0
- package/dist/src/components/forms/index.d.ts.map +1 -0
- package/dist/src/components/index.d.ts +41 -0
- package/dist/src/components/index.d.ts.map +1 -0
- package/dist/src/components/input/ChoiceInputField.d.ts +29 -0
- package/dist/src/components/input/ChoiceInputField.d.ts.map +1 -0
- package/dist/src/components/input/HtmlInputField.d.ts +33 -0
- package/dist/src/components/input/HtmlInputField.d.ts.map +1 -0
- package/dist/src/components/input/SelectInputField.d.ts +31 -0
- package/dist/src/components/input/SelectInputField.d.ts.map +1 -0
- package/dist/src/components/input/SwitchInputField.d.ts +27 -0
- package/dist/src/components/input/SwitchInputField.d.ts.map +1 -0
- package/dist/src/components/input/TextField.d.ts +18 -0
- package/dist/src/components/input/TextField.d.ts.map +1 -0
- package/dist/src/components/input/TextInputField.d.ts +34 -0
- package/dist/src/components/input/TextInputField.d.ts.map +1 -0
- package/dist/src/components/input/index.d.ts +19 -0
- package/dist/src/components/input/index.d.ts.map +1 -0
- package/dist/src/components/layout/CollapsibleLayout/CollapsibleLayout.d.ts +34 -0
- package/dist/src/components/layout/CollapsibleLayout/CollapsibleLayout.d.ts.map +1 -0
- package/dist/src/components/layout/CollapsibleLayout/index.d.ts +9 -0
- package/dist/src/components/layout/CollapsibleLayout/index.d.ts.map +1 -0
- package/dist/src/components/layout/GridCell.d.ts +32 -0
- package/dist/src/components/layout/GridCell.d.ts.map +1 -0
- package/dist/src/components/layout/GridCellWrapper.d.ts +46 -0
- package/dist/src/components/layout/GridCellWrapper.d.ts.map +1 -0
- package/dist/src/components/layout/GridLayout.d.ts +50 -0
- package/dist/src/components/layout/GridLayout.d.ts.map +1 -0
- package/dist/src/components/layout/index.d.ts +14 -0
- package/dist/src/components/layout/index.d.ts.map +1 -0
- package/dist/src/components/menu/Menu.d.ts +1 -0
- package/dist/src/components/menu/Menu.d.ts.map +1 -0
- package/dist/src/components/menu/MenuItem.d.ts +31 -0
- package/dist/src/components/menu/MenuItem.d.ts.map +1 -0
- package/dist/src/components/menu/index.d.ts +7 -0
- package/dist/src/components/menu/index.d.ts.map +1 -0
- package/dist/src/components/pages/FormPage.d.ts +66 -0
- package/dist/src/components/pages/FormPage.d.ts.map +1 -0
- package/dist/src/components/pages/Page.d.ts +68 -0
- package/dist/src/components/pages/Page.d.ts.map +1 -0
- package/dist/src/components/pages/index.d.ts +10 -0
- package/dist/src/components/pages/index.d.ts.map +1 -0
- package/dist/src/components/shared/createSerializableView.d.ts +81 -0
- package/dist/src/components/shared/createSerializableView.d.ts.map +1 -0
- package/dist/src/components/shared/viewProps.d.ts +37 -0
- package/dist/src/components/shared/viewProps.d.ts.map +1 -0
- package/dist/src/config/AppConfig.d.ts +49 -0
- package/dist/src/config/AppConfig.d.ts.map +1 -0
- package/dist/src/config/AppConfigBuilder.d.ts +75 -0
- package/dist/src/config/AppConfigBuilder.d.ts.map +1 -0
- package/dist/src/config/index.d.ts +13 -0
- package/dist/src/config/index.d.ts.map +1 -0
- package/dist/src/config/types.d.ts +130 -0
- package/dist/src/config/types.d.ts.map +1 -0
- package/dist/src/config.d.ts +15 -0
- package/dist/src/config.d.ts.map +1 -0
- package/dist/src/contexts/DataContext.d.ts +139 -0
- package/dist/src/contexts/DataContext.d.ts.map +1 -0
- package/dist/src/contexts/DimensionsContext.d.ts +42 -0
- package/dist/src/contexts/DimensionsContext.d.ts.map +1 -0
- package/dist/src/contexts/PaletteContext.d.ts +53 -0
- package/dist/src/contexts/PaletteContext.d.ts.map +1 -0
- package/dist/src/contexts/PrintModeContext.d.ts +27 -0
- package/dist/src/contexts/PrintModeContext.d.ts.map +1 -0
- package/dist/src/contexts/QwickAppContext.d.ts +71 -0
- package/dist/src/contexts/QwickAppContext.d.ts.map +1 -0
- package/dist/src/contexts/ThemeContext.d.ts +65 -0
- package/dist/src/contexts/ThemeContext.d.ts.map +1 -0
- package/dist/src/contexts/index.d.ts +11 -0
- package/dist/src/contexts/index.d.ts.map +1 -0
- package/dist/src/hooks/index.d.ts +12 -0
- package/dist/src/hooks/index.d.ts.map +1 -0
- package/dist/src/hooks/useBaseProps.d.ts +101 -0
- package/dist/src/hooks/useBaseProps.d.ts.map +1 -0
- package/dist/src/hooks/useDataBinding.d.ts +22 -0
- package/dist/src/hooks/useDataBinding.d.ts.map +1 -0
- package/dist/src/hooks/usePrintMode.d.ts +39 -0
- package/dist/src/hooks/usePrintMode.d.ts.map +1 -0
- package/dist/src/index.d.ts +9 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/palettes/PaletteAutumn.d.ts +10 -0
- package/dist/src/palettes/PaletteAutumn.d.ts.map +1 -0
- package/dist/src/palettes/PaletteCosmic.d.ts +10 -0
- package/dist/src/palettes/PaletteCosmic.d.ts.map +1 -0
- package/dist/src/palettes/PaletteDefault.d.ts +10 -0
- package/dist/src/palettes/PaletteDefault.d.ts.map +1 -0
- package/dist/src/palettes/PaletteOcean.d.ts +10 -0
- package/dist/src/palettes/PaletteOcean.d.ts.map +1 -0
- package/dist/src/palettes/PaletteSpring.d.ts +10 -0
- package/dist/src/palettes/PaletteSpring.d.ts.map +1 -0
- package/dist/src/palettes/PaletteWinter.d.ts +10 -0
- package/dist/src/palettes/PaletteWinter.d.ts.map +1 -0
- package/dist/src/palettes/index.d.ts +13 -0
- package/dist/src/palettes/index.d.ts.map +1 -0
- package/dist/src/schemas/ActionSchema.d.ts +21 -0
- package/dist/src/schemas/ActionSchema.d.ts.map +1 -0
- package/dist/src/schemas/ArticleSchema.d.ts +13 -0
- package/dist/src/schemas/ArticleSchema.d.ts.map +1 -0
- package/dist/src/schemas/ButtonSchema.d.ts +19 -0
- package/dist/src/schemas/ButtonSchema.d.ts.map +1 -0
- package/dist/src/schemas/CardListGridSchema.d.ts +17 -0
- package/dist/src/schemas/CardListGridSchema.d.ts.map +1 -0
- package/dist/src/schemas/ChoiceInputFieldSchema.d.ts +18 -0
- package/dist/src/schemas/ChoiceInputFieldSchema.d.ts.map +1 -0
- package/dist/src/schemas/CodeSchema.d.ts +18 -0
- package/dist/src/schemas/CodeSchema.d.ts.map +1 -0
- package/dist/src/schemas/CollapsibleLayoutSchema.d.ts +32 -0
- package/dist/src/schemas/CollapsibleLayoutSchema.d.ts.map +1 -0
- package/dist/src/schemas/ContainerSchema.d.ts +12 -0
- package/dist/src/schemas/ContainerSchema.d.ts.map +1 -0
- package/dist/src/schemas/ContentSchema.d.ts +21 -0
- package/dist/src/schemas/ContentSchema.d.ts.map +1 -0
- package/dist/src/schemas/CoverImageHeaderSchema.d.ts +28 -0
- package/dist/src/schemas/CoverImageHeaderSchema.d.ts.map +1 -0
- package/dist/src/schemas/FeatureCardSchema.d.ts +28 -0
- package/dist/src/schemas/FeatureCardSchema.d.ts.map +1 -0
- package/dist/src/schemas/FeatureGridSchema.d.ts +17 -0
- package/dist/src/schemas/FeatureGridSchema.d.ts.map +1 -0
- package/dist/src/schemas/FeatureItemSchema.d.ts +16 -0
- package/dist/src/schemas/FeatureItemSchema.d.ts.map +1 -0
- package/dist/src/schemas/FooterItemSchema.d.ts +15 -0
- package/dist/src/schemas/FooterItemSchema.d.ts.map +1 -0
- package/dist/src/schemas/FooterSchema.d.ts +20 -0
- package/dist/src/schemas/FooterSchema.d.ts.map +1 -0
- package/dist/src/schemas/FooterSectionSchema.d.ts +15 -0
- package/dist/src/schemas/FooterSectionSchema.d.ts.map +1 -0
- package/dist/src/schemas/FormBlockSchema.d.ts +19 -0
- package/dist/src/schemas/FormBlockSchema.d.ts.map +1 -0
- package/dist/src/schemas/GridCellSchema.d.ts +23 -0
- package/dist/src/schemas/GridCellSchema.d.ts.map +1 -0
- package/dist/src/schemas/GridLayoutSchema.d.ts +21 -0
- package/dist/src/schemas/GridLayoutSchema.d.ts.map +1 -0
- package/dist/src/schemas/HeaderActionSchema.d.ts +17 -0
- package/dist/src/schemas/HeaderActionSchema.d.ts.map +1 -0
- package/dist/src/schemas/HeroBlockSchema.d.ts +22 -0
- package/dist/src/schemas/HeroBlockSchema.d.ts.map +1 -0
- package/dist/src/schemas/HtmlInputFieldSchema.d.ts +18 -0
- package/dist/src/schemas/HtmlInputFieldSchema.d.ts.map +1 -0
- package/dist/src/schemas/HtmlSchema.d.ts +14 -0
- package/dist/src/schemas/HtmlSchema.d.ts.map +1 -0
- package/dist/src/schemas/ImageSchema.d.ts +32 -0
- package/dist/src/schemas/ImageSchema.d.ts.map +1 -0
- package/dist/src/schemas/LogoSchema.d.ts +35 -0
- package/dist/src/schemas/LogoSchema.d.ts.map +1 -0
- package/dist/src/schemas/MarkdownSchema.d.ts +14 -0
- package/dist/src/schemas/MarkdownSchema.d.ts.map +1 -0
- package/dist/src/schemas/MetadataItemSchema.d.ts +13 -0
- package/dist/src/schemas/MetadataItemSchema.d.ts.map +1 -0
- package/dist/src/schemas/PageBannerHeaderSchema.d.ts +28 -0
- package/dist/src/schemas/PageBannerHeaderSchema.d.ts.map +1 -0
- package/dist/src/schemas/PageTemplateSchema.d.ts +31 -0
- package/dist/src/schemas/PageTemplateSchema.d.ts.map +1 -0
- package/dist/src/schemas/PaletteSwitcherSchema.d.ts +16 -0
- package/dist/src/schemas/PaletteSwitcherSchema.d.ts.map +1 -0
- package/dist/src/schemas/PrintConfigSchema.d.ts +31 -0
- package/dist/src/schemas/PrintConfigSchema.d.ts.map +1 -0
- package/dist/src/schemas/ProductCardSchema.d.ts +39 -0
- package/dist/src/schemas/ProductCardSchema.d.ts.map +1 -0
- package/dist/src/schemas/SafeSpanSchema.d.ts +13 -0
- package/dist/src/schemas/SafeSpanSchema.d.ts.map +1 -0
- package/dist/src/schemas/SectionSchema.d.ts +16 -0
- package/dist/src/schemas/SectionSchema.d.ts.map +1 -0
- package/dist/src/schemas/SelectInputFieldSchema.d.ts +27 -0
- package/dist/src/schemas/SelectInputFieldSchema.d.ts.map +1 -0
- package/dist/src/schemas/SwitchInputFieldSchema.d.ts +18 -0
- package/dist/src/schemas/SwitchInputFieldSchema.d.ts.map +1 -0
- package/dist/src/schemas/TextInputFieldSchema.d.ts +22 -0
- package/dist/src/schemas/TextInputFieldSchema.d.ts.map +1 -0
- package/dist/src/schemas/TextSchema.d.ts +37 -0
- package/dist/src/schemas/TextSchema.d.ts.map +1 -0
- package/dist/src/schemas/ThemeSwitcherSchema.d.ts +19 -0
- package/dist/src/schemas/ThemeSwitcherSchema.d.ts.map +1 -0
- package/dist/src/schemas/ViewSchema.d.ts +66 -0
- package/dist/src/schemas/ViewSchema.d.ts.map +1 -0
- package/dist/src/schemas/index.d.ts +47 -0
- package/dist/src/schemas/index.d.ts.map +1 -0
- package/dist/src/schemas/transformers/ComponentTransformer.d.ts +128 -0
- package/dist/src/schemas/transformers/ComponentTransformer.d.ts.map +1 -0
- package/dist/src/schemas/transformers/ReactNodeTransformer.d.ts +53 -0
- package/dist/src/schemas/transformers/ReactNodeTransformer.d.ts.map +1 -0
- package/dist/src/schemas/transformers/registry.d.ts +18 -0
- package/dist/src/schemas/transformers/registry.d.ts.map +1 -0
- package/dist/src/schemas/types/Serializable.d.ts +46 -0
- package/dist/src/schemas/types/Serializable.d.ts.map +1 -0
- package/dist/src/stories/_templates/SerializationTemplate.d.ts +44 -0
- package/dist/src/stories/_templates/SerializationTemplate.d.ts.map +1 -0
- package/dist/src/templates/TemplateResolver.d.ts +52 -0
- package/dist/src/templates/TemplateResolver.d.ts.map +1 -0
- package/dist/src/templates/index.d.ts +7 -0
- package/dist/src/templates/index.d.ts.map +1 -0
- package/dist/src/types/CacheProvider.d.ts +18 -0
- package/dist/src/types/CacheProvider.d.ts.map +1 -0
- package/dist/src/types/CollapsibleLayout.d.ts +142 -0
- package/dist/src/types/CollapsibleLayout.d.ts.map +1 -0
- package/dist/src/types/ContentProxy.d.ts +47 -0
- package/dist/src/types/ContentProxy.d.ts.map +1 -0
- package/dist/src/types/DataTypes.d.ts +185 -0
- package/dist/src/types/DataTypes.d.ts.map +1 -0
- package/dist/src/types/TemplateProvider.d.ts +10 -0
- package/dist/src/types/TemplateProvider.d.ts.map +1 -0
- package/dist/src/types/TemplateResolver.d.ts +23 -0
- package/dist/src/types/TemplateResolver.d.ts.map +1 -0
- package/dist/src/types/index.d.ts +82 -0
- package/dist/src/types/index.d.ts.map +1 -0
- package/dist/src/utils/breakpoints.d.ts +35 -0
- package/dist/src/utils/breakpoints.d.ts.map +1 -0
- package/dist/src/utils/cssUtils.d.ts +17 -0
- package/dist/src/utils/cssUtils.d.ts.map +1 -0
- package/dist/src/utils/customPaletteManager.d.ts +8 -0
- package/dist/src/utils/customPaletteManager.d.ts.map +1 -0
- package/dist/src/utils/dimensions.d.ts +34 -0
- package/dist/src/utils/dimensions.d.ts.map +1 -0
- package/dist/src/utils/htmlTransform.d.ts +44 -0
- package/dist/src/utils/htmlTransform.d.ts.map +1 -0
- package/dist/src/utils/index.d.ts +16 -0
- package/dist/src/utils/index.d.ts.map +1 -0
- package/dist/src/utils/logger.d.ts +26 -0
- package/dist/src/utils/logger.d.ts.map +1 -0
- package/dist/src/utils/paletteUtils.d.ts +38 -0
- package/dist/src/utils/paletteUtils.d.ts.map +1 -0
- package/dist/src/utils/persistenceUtils.d.ts +31 -0
- package/dist/src/utils/persistenceUtils.d.ts.map +1 -0
- package/dist/src/utils/reactUtils.d.ts +33 -0
- package/dist/src/utils/reactUtils.d.ts.map +1 -0
- package/dist/src/utils/spacing.d.ts +34 -0
- package/dist/src/utils/spacing.d.ts.map +1 -0
- package/dist/src/utils/themePerformanceMonitor.d.ts +32 -0
- package/dist/src/utils/themePerformanceMonitor.d.ts.map +1 -0
- package/dist/src/utils/themeUtils.d.ts +27 -0
- package/dist/src/utils/themeUtils.d.ts.map +1 -0
- package/dist/utils/cssUtils.d.ts +17 -0
- package/dist/utils/cssUtils.d.ts.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +5 -2
- package/scripts/bundle-css.cjs +27 -0
- package/scripts/create-project.sh +28 -0
- package/scripts/create-qwickapps-project.js +284 -0
- package/src/__tests__/components/base/Container.test.tsx +966 -0
- package/src/__tests__/schemas/PageTemplateSchema.test.ts +1 -1
- package/src/__tests__/schemas/ViewSchema.test.ts +805 -0
- package/src/__tests__/schemas/builders.test.ts +2 -2
- package/src/__tests__/schemas/transformers/ComponentTransformer.test.ts +19 -19
- package/src/__tests__/schemas/transformers/CrossBrowserCompatibility.test.ts +13 -13
- package/src/__tests__/schemas/transformers/SerializationErrorHandling.test.ts +39 -39
- package/src/__tests__/schemas/transformers/SerializationPerformance.test.ts +14 -14
- package/src/__tests__/schemas/transformers/TestAutomation.test.ts +8 -8
- package/src/__tests__/schemas/transformers/nested-serialization.test.tsx +181 -0
- package/src/__tests__/schemas/transformers/round-trip-component-serialization.test.tsx +458 -0
- package/src/__tests__/test_image_accessibility.test.tsx +226 -0
- package/src/__tests__/utils/optional-logging.test.ts +3 -3
- package/src/components/Html.tsx +24 -15
- package/src/components/Logo.tsx +2 -2
- package/src/components/Markdown.tsx +2 -7
- package/src/components/SafeSpan.tsx +2 -7
- package/src/components/base/Container.tsx +61 -0
- package/src/components/base/ModelView.tsx +225 -91
- package/src/components/base/index.ts +3 -2
- package/src/components/blocks/Article.tsx +2 -7
- package/src/components/blocks/CardListGrid.tsx +2 -2
- package/src/components/blocks/Code.tsx +91 -179
- package/src/components/blocks/Content.tsx +2 -2
- package/src/components/blocks/CoverImageHeader.tsx +2 -2
- package/src/components/blocks/HeroBlock.tsx +54 -146
- package/src/components/blocks/Image.tsx +82 -196
- package/src/components/blocks/PageBannerHeader.tsx +2 -2
- package/src/components/blocks/Section.tsx +79 -181
- package/src/components/blocks/Text.tsx +100 -198
- package/src/components/buttons/Button.tsx +85 -183
- package/src/components/buttons/PaletteSwitcher.tsx +2 -2
- package/src/components/buttons/ThemeSwitcher.tsx +2 -2
- package/src/components/forms/FormBlock.tsx +2 -2
- package/src/components/index.ts +5 -0
- package/src/components/input/ChoiceInputField.tsx +76 -160
- package/src/components/input/HtmlInputField.tsx +141 -264
- package/src/components/input/SelectInputField.tsx +48 -153
- package/src/components/input/SwitchInputField.tsx +41 -139
- package/src/components/input/TextInputField.tsx +39 -116
- package/src/components/layout/GridCell.tsx +36 -122
- package/src/components/layout/GridLayout.tsx +55 -127
- package/src/components/pages/Page.tsx +268 -276
- package/src/components/pages/index.ts +2 -3
- package/src/components/shared/createSerializableView.tsx +280 -0
- package/src/components/shared/viewProps.ts +207 -0
- package/src/config/__tests__/AppConfigBuilder.test.ts +2 -2
- package/src/contexts/DataContext.tsx +1 -1
- package/src/schemas/ButtonSchema.ts +3 -2
- package/src/schemas/CardListGridSchema.ts +3 -2
- package/src/schemas/ChoiceInputFieldSchema.ts +3 -2
- package/src/schemas/CodeSchema.ts +8 -6
- package/src/schemas/ContainerSchema.ts +25 -0
- package/src/schemas/FeatureCardSchema.ts +1 -1
- package/src/schemas/FormBlockSchema.ts +3 -2
- package/src/schemas/GridCellSchema.ts +4 -10
- package/src/schemas/GridLayoutSchema.ts +8 -14
- package/src/schemas/HeroBlockSchema.ts +3 -2
- package/src/schemas/HtmlInputFieldSchema.ts +3 -2
- package/src/schemas/ImageSchema.ts +3 -2
- package/src/schemas/PageTemplateSchema.ts +5 -5
- package/src/schemas/SectionSchema.ts +4 -12
- package/src/schemas/SelectInputFieldSchema.ts +3 -2
- package/src/schemas/SwitchInputFieldSchema.ts +2 -2
- package/src/schemas/TextInputFieldSchema.ts +3 -2
- package/src/schemas/ViewSchema.ts +570 -0
- package/src/schemas/index.ts +1 -1
- package/src/schemas/transformers/ComponentTransformer.ts +185 -163
- package/src/schemas/transformers/ReactNodeTransformer.ts +31 -28
- package/src/schemas/transformers/registry.ts +17 -10
- package/src/stories/Button.stories.tsx +24 -0
- package/src/stories/ChoiceInputField.stories.tsx +28 -1
- package/src/stories/Code.stories.tsx +61 -1
- package/src/stories/Container.stories.tsx +954 -0
- package/src/stories/FormBlock.stories.tsx +54 -0
- package/src/stories/FormComponents.stories.tsx +8 -13
- package/src/stories/GridCell.stories.tsx +23 -64
- package/src/stories/GridLayout.stories.tsx +22 -47
- package/src/stories/HeroBlock.stories.tsx +28 -0
- package/src/stories/HtmlInputField.stories.tsx +23 -1
- package/src/stories/Image.stories.tsx +45 -233
- package/src/stories/Markdown.stories.tsx +1 -1
- package/src/stories/Section.stories.tsx +38 -4
- package/src/stories/SelectInputField.stories.tsx +26 -1
- package/src/stories/Text.stories.tsx +22 -54
- package/src/stories/TextInputField.stories.tsx +24 -1
- package/src/stories/_templates/SerializationTemplate.tsx +165 -0
- package/src/templates/TemplateResolver.ts +2 -2
- package/src/types/CollapsibleLayout.ts +2 -2
- package/src/utils/cssUtils.ts +49 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/logger.ts +13 -13
- package/src/__tests__/components/base/ModelView.test.tsx +0 -220
- package/src/__tests__/schemas/ViewModelSchema.test.ts +0 -80
- package/src/components/blocks/Code.md +0 -529
- package/src/schemas/README.md +0 -661
- package/src/schemas/ViewModelSchema.ts +0 -115
- package/src/tests/ConsoleWarningTest.tsx +0 -30
- package/src/tests/StorageKeyTest.tsx +0 -110
- package/src/tests/ThemeStorageKeyTest.tsx +0 -114
|
@@ -5,36 +5,39 @@
|
|
|
5
5
|
* - Complete select dropdown functionality with options
|
|
6
6
|
* - Form validation and error handling
|
|
7
7
|
* - Data binding support for dynamic content
|
|
8
|
-
* - Full serialization support via
|
|
8
|
+
* - Full serialization support via factory pattern
|
|
9
9
|
* - Consistent Material-UI styling
|
|
10
10
|
*
|
|
11
11
|
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import React
|
|
14
|
+
import React from 'react';
|
|
15
15
|
import {
|
|
16
16
|
FormControl,
|
|
17
17
|
FormHelperText,
|
|
18
18
|
InputLabel,
|
|
19
19
|
MenuItem,
|
|
20
|
-
Paper,
|
|
21
20
|
Select,
|
|
22
21
|
SelectChangeEvent,
|
|
23
|
-
Typography
|
|
24
22
|
} from '@mui/material';
|
|
25
|
-
import type { WithDataBinding, ModelProps } from '@qwickapps/schema';
|
|
26
|
-
import { QWICKAPP_COMPONENT, useBaseProps, useDataBinding } from '../../hooks';
|
|
27
23
|
import SelectInputFieldModel, { SelectOption } from '../../schemas/SelectInputFieldSchema';
|
|
28
|
-
import {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
import { createSerializableView, SerializableComponent } from '../shared/createSerializableView';
|
|
25
|
+
import { ViewProps } from '../shared/viewProps';
|
|
26
|
+
|
|
27
|
+
export interface SelectInputFieldProps extends ViewProps {
|
|
28
|
+
// Component-specific props from SelectInputFieldModel
|
|
29
|
+
label?: string;
|
|
30
|
+
value?: string | number;
|
|
31
|
+
options?: SelectOption[];
|
|
32
|
+
required?: boolean;
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
error?: string;
|
|
35
|
+
helperText?: string;
|
|
36
|
+
placeholder?: string;
|
|
37
|
+
// Additional props for enhanced functionality
|
|
32
38
|
onChange?: (value: string | number) => void;
|
|
33
|
-
/** Focus handler */
|
|
34
39
|
onFocus?: () => void;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface SelectInputFieldProps extends SelectInputFieldViewProps, WithDataBinding {}
|
|
40
|
+
}
|
|
38
41
|
|
|
39
42
|
// Export SelectOption for external use
|
|
40
43
|
export { SelectOption };
|
|
@@ -52,69 +55,49 @@ function SelectInputFieldView({
|
|
|
52
55
|
helperText,
|
|
53
56
|
placeholder,
|
|
54
57
|
...restProps
|
|
55
|
-
}:
|
|
56
|
-
const { styleProps, htmlProps } = useBaseProps(restProps);
|
|
57
|
-
|
|
58
|
+
}: SelectInputFieldProps) {
|
|
58
59
|
const handleChange = (event: SelectChangeEvent<string | number>) => {
|
|
59
60
|
if (onChange) {
|
|
60
61
|
onChange(event.target.value);
|
|
61
62
|
}
|
|
62
63
|
};
|
|
63
64
|
|
|
64
|
-
//
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
sx={{
|
|
72
|
-
p: 2,
|
|
73
|
-
textAlign: 'center',
|
|
74
|
-
opacity: 0.6,
|
|
75
|
-
borderColor: 'error.main',
|
|
76
|
-
...styleProps.sx
|
|
77
|
-
}}
|
|
78
|
-
>
|
|
79
|
-
<Typography variant="body2" color="error">
|
|
80
|
-
No options provided for select field
|
|
81
|
-
</Typography>
|
|
82
|
-
</Paper>
|
|
83
|
-
);
|
|
84
|
-
}
|
|
65
|
+
// Filter out ViewProps that conflict with FormControl
|
|
66
|
+
const { margin, padding, paddingX, paddingY, paddingTop, paddingRight, paddingBottom, paddingLeft,
|
|
67
|
+
width, height, minWidth, maxWidth, minHeight, maxHeight, sx, style,
|
|
68
|
+
span, xs, sm, md, lg, xl, background, backgroundImage, backgroundGradient, textAlign,
|
|
69
|
+
className, ...filteredProps } = restProps;
|
|
70
|
+
|
|
71
|
+
const labelId = label ? `select-label-${label.toLowerCase().replace(/\s+/g, '-')}` : undefined;
|
|
85
72
|
|
|
86
73
|
return (
|
|
87
|
-
<FormControl
|
|
88
|
-
|
|
89
|
-
{
|
|
90
|
-
|
|
91
|
-
error={!!error}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}}
|
|
74
|
+
<FormControl
|
|
75
|
+
fullWidth
|
|
76
|
+
required={required}
|
|
77
|
+
disabled={disabled}
|
|
78
|
+
error={!!error}
|
|
79
|
+
sx={sx}
|
|
80
|
+
style={style}
|
|
81
|
+
className={className}
|
|
82
|
+
{...filteredProps}
|
|
97
83
|
>
|
|
98
|
-
<InputLabel
|
|
99
|
-
{label}
|
|
100
|
-
</InputLabel>
|
|
84
|
+
{label && <InputLabel id={labelId}>{label}</InputLabel>}
|
|
101
85
|
<Select
|
|
86
|
+
labelId={labelId}
|
|
87
|
+
label={label}
|
|
102
88
|
value={value}
|
|
103
89
|
onChange={handleChange}
|
|
104
90
|
onFocus={onFocus}
|
|
105
91
|
displayEmpty={!!placeholder}
|
|
106
|
-
renderValue={value !== '' ? undefined : () => (
|
|
107
|
-
<span style={{ opacity: 0.6 }}>{placeholder}</span>
|
|
108
|
-
)}
|
|
109
92
|
>
|
|
110
93
|
{placeholder && (
|
|
111
94
|
<MenuItem value="" disabled>
|
|
112
95
|
<em>{placeholder}</em>
|
|
113
96
|
</MenuItem>
|
|
114
97
|
)}
|
|
115
|
-
{options.map((option) => (
|
|
98
|
+
{options.map((option, index) => (
|
|
116
99
|
<MenuItem
|
|
117
|
-
key={option.value}
|
|
100
|
+
key={`${option.value}-${index}`}
|
|
118
101
|
value={option.value}
|
|
119
102
|
disabled={option.disabled}
|
|
120
103
|
>
|
|
@@ -123,107 +106,19 @@ function SelectInputFieldView({
|
|
|
123
106
|
))}
|
|
124
107
|
</Select>
|
|
125
108
|
{(error || helperText) && (
|
|
126
|
-
<FormHelperText>
|
|
127
|
-
{error || helperText}
|
|
128
|
-
</FormHelperText>
|
|
109
|
+
<FormHelperText>{error || helperText}</FormHelperText>
|
|
129
110
|
)}
|
|
130
111
|
</FormControl>
|
|
131
112
|
);
|
|
132
113
|
}
|
|
133
114
|
|
|
134
|
-
//
|
|
135
|
-
export
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
//
|
|
141
|
-
|
|
142
|
-
return <SelectInputField {...jsonData} />;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
// Component-specific serialization properties
|
|
146
|
-
protected getComponentSpecificProps(): any {
|
|
147
|
-
return {
|
|
148
|
-
label: this.props.label,
|
|
149
|
-
value: this.props.value,
|
|
150
|
-
options: this.props.options,
|
|
151
|
-
required: this.props.required,
|
|
152
|
-
disabled: this.props.disabled,
|
|
153
|
-
error: this.props.error,
|
|
154
|
-
helperText: this.props.helperText,
|
|
155
|
-
placeholder: this.props.placeholder,
|
|
156
|
-
// Event handlers don't serialize
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// SelectInputField component renders traditional props view
|
|
161
|
-
protected renderView(): React.ReactElement {
|
|
162
|
-
const { dataSource, bindingOptions, ...restProps } = this.props;
|
|
163
|
-
return <SelectInputFieldView {...restProps} />;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
// SelectInputField component renders data-bound view
|
|
167
|
-
protected renderWithDataBinding(): React.ReactElement {
|
|
168
|
-
return <SelectInputFieldWithDataBinding {...this.props} />;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// Helper component to handle data binding with hooks (since we can't use hooks in class components)
|
|
173
|
-
function SelectInputFieldWithDataBinding(props: SelectInputFieldProps) {
|
|
174
|
-
const { dataSource, bindingOptions, ...restProps } = props;
|
|
175
|
-
|
|
176
|
-
// Use data binding
|
|
177
|
-
const { dataSource: _source, loading, error, cached, ...selectInputFieldProps } = useDataBinding<SelectInputFieldModel>(
|
|
178
|
-
dataSource!,
|
|
179
|
-
restProps as Partial<SelectInputFieldModel>,
|
|
180
|
-
SelectInputFieldModel.getSchema(),
|
|
181
|
-
{ cache: true, cacheTTL: 300000, strict: false, ...bindingOptions }
|
|
182
|
-
);
|
|
183
|
-
|
|
184
|
-
// Show loading state
|
|
185
|
-
if (loading) {
|
|
186
|
-
return (
|
|
187
|
-
<Paper
|
|
188
|
-
variant="outlined"
|
|
189
|
-
sx={{
|
|
190
|
-
p: 2,
|
|
191
|
-
textAlign: 'center'
|
|
192
|
-
}}
|
|
193
|
-
>
|
|
194
|
-
<Typography variant="body2">Loading SelectInputField...</Typography>
|
|
195
|
-
<Typography variant="caption" color="text.secondary">
|
|
196
|
-
Loading select field configuration from data source...
|
|
197
|
-
</Typography>
|
|
198
|
-
</Paper>
|
|
199
|
-
);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
if (error) {
|
|
203
|
-
console.error('Error loading select input field:', error);
|
|
204
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
205
|
-
return (
|
|
206
|
-
<Paper
|
|
207
|
-
variant="outlined"
|
|
208
|
-
sx={{
|
|
209
|
-
p: 2,
|
|
210
|
-
textAlign: 'center',
|
|
211
|
-
borderColor: 'error.main'
|
|
212
|
-
}}
|
|
213
|
-
>
|
|
214
|
-
<Typography variant="body2" color="error">
|
|
215
|
-
Error loading select field: {error.message}
|
|
216
|
-
</Typography>
|
|
217
|
-
</Paper>
|
|
218
|
-
);
|
|
219
|
-
}
|
|
220
|
-
return null;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
return <SelectInputFieldView {...selectInputFieldProps} />;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
// Mark as QwickApp component
|
|
227
|
-
(SelectInputField as any)[QWICKAPP_COMPONENT] = true;
|
|
115
|
+
// Create the serializable SelectInputField component using the factory
|
|
116
|
+
export const SelectInputField: SerializableComponent<SelectInputFieldProps> = createSerializableView<SelectInputFieldProps>({
|
|
117
|
+
tagName: 'SelectInputField',
|
|
118
|
+
version: '1.0.0',
|
|
119
|
+
role: 'view',
|
|
120
|
+
View: SelectInputFieldView,
|
|
121
|
+
// SelectInputField component uses default react-children strategy
|
|
122
|
+
});
|
|
228
123
|
|
|
229
124
|
export default SelectInputField;
|
|
@@ -5,34 +5,35 @@
|
|
|
5
5
|
* - Complete switch toggle functionality
|
|
6
6
|
* - Form validation and error handling
|
|
7
7
|
* - Data binding support for dynamic content
|
|
8
|
-
* - Full serialization support via
|
|
8
|
+
* - Full serialization support via factory pattern
|
|
9
9
|
* - Consistent Material-UI styling
|
|
10
10
|
*
|
|
11
11
|
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import React
|
|
14
|
+
import React from 'react';
|
|
15
15
|
import {
|
|
16
16
|
FormControl,
|
|
17
17
|
FormControlLabel,
|
|
18
18
|
FormHelperText,
|
|
19
|
-
Paper,
|
|
20
19
|
Switch,
|
|
21
|
-
Typography
|
|
22
20
|
} from '@mui/material';
|
|
23
|
-
import type { WithDataBinding, ModelProps } from '@qwickapps/schema';
|
|
24
|
-
import { QWICKAPP_COMPONENT, useBaseProps, useDataBinding } from '../../hooks';
|
|
25
21
|
import SwitchInputFieldModel from '../../schemas/SwitchInputFieldSchema';
|
|
26
|
-
import {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
import { createSerializableView, SerializableComponent } from '../shared/createSerializableView';
|
|
23
|
+
import { ViewProps } from '../shared/viewProps';
|
|
24
|
+
|
|
25
|
+
export interface SwitchInputFieldProps extends ViewProps {
|
|
26
|
+
// Component-specific props from SwitchInputFieldModel
|
|
27
|
+
label?: string;
|
|
28
|
+
checked?: boolean;
|
|
29
|
+
required?: boolean;
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
error?: string;
|
|
32
|
+
helperText?: string;
|
|
33
|
+
// Additional props for enhanced functionality
|
|
30
34
|
onChange?: (checked: boolean) => void;
|
|
31
|
-
/** Focus handler */
|
|
32
35
|
onFocus?: () => void;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface SwitchInputFieldProps extends SwitchInputFieldViewProps, WithDataBinding {}
|
|
36
|
+
}
|
|
36
37
|
|
|
37
38
|
// View component - handles the actual rendering
|
|
38
39
|
function SwitchInputFieldView({
|
|
@@ -44,29 +45,27 @@ function SwitchInputFieldView({
|
|
|
44
45
|
disabled = false,
|
|
45
46
|
error,
|
|
46
47
|
helperText,
|
|
47
|
-
size = 'medium',
|
|
48
|
-
color = 'primary',
|
|
49
48
|
...restProps
|
|
50
|
-
}:
|
|
51
|
-
const { styleProps, htmlProps } = useBaseProps(restProps);
|
|
52
|
-
|
|
49
|
+
}: SwitchInputFieldProps) {
|
|
53
50
|
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
54
|
-
|
|
55
|
-
onChange(event.target.checked);
|
|
56
|
-
}
|
|
51
|
+
onChange?.(event.target.checked);
|
|
57
52
|
};
|
|
58
53
|
|
|
54
|
+
// Filter out ViewProps that conflict with FormControl
|
|
55
|
+
const { margin, padding, paddingX, paddingY, paddingTop, paddingRight, paddingBottom, paddingLeft,
|
|
56
|
+
width, height, minWidth, maxWidth, minHeight, maxHeight, sx, style,
|
|
57
|
+
span, xs, sm, md, lg, xl, background, backgroundImage, backgroundGradient, textAlign,
|
|
58
|
+
className, ...filteredProps } = restProps;
|
|
59
|
+
|
|
59
60
|
return (
|
|
60
|
-
<FormControl
|
|
61
|
-
|
|
62
|
-
{
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
...styleProps.sx
|
|
69
|
-
}}
|
|
61
|
+
<FormControl
|
|
62
|
+
component="fieldset"
|
|
63
|
+
error={!!error}
|
|
64
|
+
disabled={disabled}
|
|
65
|
+
sx={sx}
|
|
66
|
+
style={style}
|
|
67
|
+
className={className}
|
|
68
|
+
{...filteredProps}
|
|
70
69
|
>
|
|
71
70
|
<FormControlLabel
|
|
72
71
|
control={
|
|
@@ -74,123 +73,26 @@ function SwitchInputFieldView({
|
|
|
74
73
|
checked={checked}
|
|
75
74
|
onChange={handleChange}
|
|
76
75
|
onFocus={onFocus}
|
|
77
|
-
|
|
78
|
-
color={color}
|
|
76
|
+
required={required}
|
|
79
77
|
disabled={disabled}
|
|
80
78
|
/>
|
|
81
79
|
}
|
|
82
80
|
label={label}
|
|
83
|
-
disabled={disabled}
|
|
84
81
|
/>
|
|
85
82
|
{(error || helperText) && (
|
|
86
|
-
<FormHelperText>
|
|
87
|
-
{error || helperText}
|
|
88
|
-
</FormHelperText>
|
|
83
|
+
<FormHelperText>{error || helperText}</FormHelperText>
|
|
89
84
|
)}
|
|
90
85
|
</FormControl>
|
|
91
86
|
);
|
|
92
87
|
}
|
|
93
88
|
|
|
94
|
-
//
|
|
95
|
-
export
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
//
|
|
101
|
-
|
|
102
|
-
return <SwitchInputField {...jsonData} />;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// Component-specific serialization properties
|
|
106
|
-
protected getComponentSpecificProps(): any {
|
|
107
|
-
return {
|
|
108
|
-
label: this.props.label,
|
|
109
|
-
checked: this.props.checked,
|
|
110
|
-
required: this.props.required,
|
|
111
|
-
disabled: this.props.disabled,
|
|
112
|
-
error: this.props.error,
|
|
113
|
-
helperText: this.props.helperText,
|
|
114
|
-
size: this.props.size,
|
|
115
|
-
color: this.props.color,
|
|
116
|
-
// Event handlers don't serialize
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// SwitchInputField component renders traditional props view
|
|
121
|
-
protected renderView(): React.ReactElement {
|
|
122
|
-
const { dataSource, bindingOptions, ...restProps } = this.props;
|
|
123
|
-
return <SwitchInputFieldView {...restProps} />;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// SwitchInputField component renders data-bound view
|
|
127
|
-
protected renderWithDataBinding(): React.ReactElement {
|
|
128
|
-
return <SwitchInputFieldWithDataBinding {...this.props} />;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
// Helper component to handle data binding with hooks (since we can't use hooks in class components)
|
|
133
|
-
function SwitchInputFieldWithDataBinding(props: SwitchInputFieldProps) {
|
|
134
|
-
const { dataSource, bindingOptions, ...restProps } = props;
|
|
135
|
-
|
|
136
|
-
// Use data binding
|
|
137
|
-
const bindingResult = useDataBinding<SwitchInputFieldModel>(
|
|
138
|
-
dataSource!,
|
|
139
|
-
restProps as Partial<SwitchInputFieldModel>,
|
|
140
|
-
SwitchInputFieldModel.getSchema(),
|
|
141
|
-
{ cache: true, cacheTTL: 300000, strict: false, ...bindingOptions }
|
|
142
|
-
);
|
|
143
|
-
|
|
144
|
-
// Check if we're still loading data using the metadata properties
|
|
145
|
-
const bindingLoading = bindingResult.$loading;
|
|
146
|
-
|
|
147
|
-
// Extract all the actual switch properties (excluding metadata)
|
|
148
|
-
const { dataSource: _source, $loading, $error, $dataSource, $cached, cached, ...switchInputFieldProps } = bindingResult;
|
|
149
|
-
const error = bindingResult.$error;
|
|
150
|
-
|
|
151
|
-
// Show loading state while fetching data
|
|
152
|
-
if (bindingLoading) {
|
|
153
|
-
return (
|
|
154
|
-
<Paper
|
|
155
|
-
variant="outlined"
|
|
156
|
-
sx={{
|
|
157
|
-
p: 2,
|
|
158
|
-
textAlign: 'center'
|
|
159
|
-
}}
|
|
160
|
-
>
|
|
161
|
-
<Typography variant="body2">Loading SwitchInputField...</Typography>
|
|
162
|
-
<Typography variant="caption" color="text.secondary">
|
|
163
|
-
Loading switch field configuration from data source...
|
|
164
|
-
</Typography>
|
|
165
|
-
</Paper>
|
|
166
|
-
);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
if (error) {
|
|
170
|
-
console.error('Error loading switch input field:', error);
|
|
171
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
172
|
-
return (
|
|
173
|
-
<Paper
|
|
174
|
-
variant="outlined"
|
|
175
|
-
sx={{
|
|
176
|
-
p: 2,
|
|
177
|
-
textAlign: 'center',
|
|
178
|
-
borderColor: 'error.main'
|
|
179
|
-
}}
|
|
180
|
-
>
|
|
181
|
-
<Typography variant="body2" color="error">
|
|
182
|
-
Error loading switch field: {error.message}
|
|
183
|
-
</Typography>
|
|
184
|
-
</Paper>
|
|
185
|
-
);
|
|
186
|
-
}
|
|
187
|
-
return null;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
return <SwitchInputFieldView {...switchInputFieldProps} />;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
// Mark as QwickApp component
|
|
194
|
-
(SwitchInputField as any)[QWICKAPP_COMPONENT] = true;
|
|
89
|
+
// Create the serializable SwitchInputField component using the factory
|
|
90
|
+
export const SwitchInputField: SerializableComponent<SwitchInputFieldProps> = createSerializableView<SwitchInputFieldProps>({
|
|
91
|
+
tagName: 'SwitchInputField',
|
|
92
|
+
version: '1.0.0',
|
|
93
|
+
role: 'view',
|
|
94
|
+
View: SwitchInputFieldView,
|
|
95
|
+
// SwitchInputField component uses default react-children strategy
|
|
96
|
+
});
|
|
195
97
|
|
|
196
98
|
export default SwitchInputField;
|
|
@@ -5,29 +5,36 @@
|
|
|
5
5
|
* - Complete text field functionality (single/multiline, input types)
|
|
6
6
|
* - Form validation and error handling
|
|
7
7
|
* - Data binding support for dynamic content
|
|
8
|
-
* - Full serialization support via
|
|
8
|
+
* - Full serialization support via factory pattern
|
|
9
9
|
* - Consistent Material-UI styling
|
|
10
10
|
*
|
|
11
11
|
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
import React, { ReactElement } from 'react';
|
|
15
|
-
import { TextField, TextFieldProps
|
|
16
|
-
import type { WithDataBinding, ModelProps } from '@qwickapps/schema';
|
|
17
|
-
import { QWICKAPP_COMPONENT, useBaseProps, useDataBinding } from '../../hooks';
|
|
15
|
+
import { TextField, TextFieldProps } from '@mui/material';
|
|
18
16
|
import TextInputFieldModel from '../../schemas/TextInputFieldSchema';
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
import { createSerializableView, SerializableComponent } from '../shared/createSerializableView';
|
|
18
|
+
import { ViewProps } from '../shared/viewProps';
|
|
19
|
+
|
|
20
|
+
export interface TextInputFieldProps extends ViewProps {
|
|
21
|
+
// Component-specific props from TextInputFieldModel
|
|
22
|
+
label?: string;
|
|
23
|
+
value?: string;
|
|
24
|
+
required?: boolean;
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
error?: string;
|
|
27
|
+
helperText?: string;
|
|
28
|
+
placeholder?: string;
|
|
29
|
+
type?: string;
|
|
30
|
+
multiline?: boolean;
|
|
31
|
+
rows?: number;
|
|
32
|
+
maxRows?: number;
|
|
33
|
+
// Additional props for enhanced functionality
|
|
23
34
|
onChange?: (value: string) => void;
|
|
24
|
-
/** Focus handler */
|
|
25
35
|
onFocus?: () => void;
|
|
26
|
-
/** Additional TextField props */
|
|
27
36
|
textFieldProps?: Omit<TextFieldProps, 'label' | 'value' | 'onChange' | 'onFocus' | 'required' | 'disabled' | 'error' | 'helperText' | 'placeholder' | 'type' | 'multiline' | 'rows' | 'maxRows'>;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface TextInputFieldProps extends TextInputFieldViewProps, WithDataBinding {}
|
|
37
|
+
}
|
|
31
38
|
|
|
32
39
|
// View component - handles the actual rendering
|
|
33
40
|
function TextInputFieldView({
|
|
@@ -46,17 +53,20 @@ function TextInputFieldView({
|
|
|
46
53
|
maxRows,
|
|
47
54
|
textFieldProps,
|
|
48
55
|
...restProps
|
|
49
|
-
}:
|
|
50
|
-
const { styleProps, htmlProps, restProps: otherProps } = useBaseProps(restProps);
|
|
51
|
-
|
|
56
|
+
}: TextInputFieldProps) {
|
|
52
57
|
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
53
58
|
onChange?.(event.target.value);
|
|
54
59
|
};
|
|
55
60
|
|
|
61
|
+
// Filter out ViewProps that conflict with TextField
|
|
62
|
+
const { margin, padding, paddingX, paddingY, paddingTop, paddingRight, paddingBottom, paddingLeft,
|
|
63
|
+
width, height, minWidth, maxWidth, minHeight, maxHeight, sx, style,
|
|
64
|
+
span, xs, sm, md, lg, xl, background, backgroundImage, backgroundGradient, textAlign,
|
|
65
|
+
className, ...filteredProps } = restProps;
|
|
66
|
+
|
|
56
67
|
return (
|
|
57
68
|
<TextField
|
|
58
|
-
{...
|
|
59
|
-
{...styleProps}
|
|
69
|
+
{...filteredProps}
|
|
60
70
|
fullWidth
|
|
61
71
|
label={label}
|
|
62
72
|
value={value}
|
|
@@ -71,108 +81,21 @@ function TextInputFieldView({
|
|
|
71
81
|
multiline={multiline}
|
|
72
82
|
rows={rows}
|
|
73
83
|
maxRows={maxRows}
|
|
84
|
+
sx={sx}
|
|
85
|
+
style={style}
|
|
86
|
+
className={className}
|
|
74
87
|
{...textFieldProps}
|
|
75
88
|
/>
|
|
76
89
|
);
|
|
77
90
|
}
|
|
78
91
|
|
|
79
|
-
//
|
|
80
|
-
export
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
//
|
|
86
|
-
|
|
87
|
-
return <TextInputField {...jsonData} />;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// Component-specific serialization properties
|
|
91
|
-
protected getComponentSpecificProps(): any {
|
|
92
|
-
return {
|
|
93
|
-
label: this.props.label,
|
|
94
|
-
value: this.props.value,
|
|
95
|
-
required: this.props.required,
|
|
96
|
-
disabled: this.props.disabled,
|
|
97
|
-
error: this.props.error,
|
|
98
|
-
helperText: this.props.helperText,
|
|
99
|
-
placeholder: this.props.placeholder,
|
|
100
|
-
type: this.props.type,
|
|
101
|
-
multiline: this.props.multiline,
|
|
102
|
-
rows: this.props.rows,
|
|
103
|
-
maxRows: this.props.maxRows,
|
|
104
|
-
// Event handlers don't serialize
|
|
105
|
-
// textFieldProps don't serialize (they're component-specific overrides)
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// TextInputField component renders traditional props view
|
|
110
|
-
protected renderView(): React.ReactElement {
|
|
111
|
-
const { dataSource, bindingOptions, ...restProps } = this.props;
|
|
112
|
-
return <TextInputFieldView {...restProps} />;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// TextInputField component renders data-bound view
|
|
116
|
-
protected renderWithDataBinding(): React.ReactElement {
|
|
117
|
-
return <TextInputFieldWithDataBinding {...this.props} />;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// Helper component to handle data binding with hooks (since we can't use hooks in class components)
|
|
122
|
-
function TextInputFieldWithDataBinding(props: TextInputFieldProps) {
|
|
123
|
-
const { dataSource, bindingOptions, ...restProps } = props;
|
|
124
|
-
|
|
125
|
-
// Use data binding
|
|
126
|
-
const { dataSource: _source, loading, error, cached, ...textInputFieldProps } = useDataBinding<TextInputFieldModel>(
|
|
127
|
-
dataSource!,
|
|
128
|
-
restProps as Partial<TextInputFieldModel>,
|
|
129
|
-
TextInputFieldModel.getSchema(),
|
|
130
|
-
{ cache: true, cacheTTL: 300000, strict: false, ...bindingOptions }
|
|
131
|
-
);
|
|
132
|
-
|
|
133
|
-
// Show loading state
|
|
134
|
-
if (loading) {
|
|
135
|
-
return (
|
|
136
|
-
<Paper
|
|
137
|
-
variant="outlined"
|
|
138
|
-
sx={{
|
|
139
|
-
p: 3,
|
|
140
|
-
textAlign: 'center'
|
|
141
|
-
}}
|
|
142
|
-
>
|
|
143
|
-
<Typography variant="body2">Loading TextInputField...</Typography>
|
|
144
|
-
<Typography variant="caption" color="text.secondary">
|
|
145
|
-
Loading text input field from data source...
|
|
146
|
-
</Typography>
|
|
147
|
-
</Paper>
|
|
148
|
-
);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
if (error) {
|
|
152
|
-
console.error('Error loading text input field:', error);
|
|
153
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
154
|
-
return (
|
|
155
|
-
<Paper
|
|
156
|
-
variant="outlined"
|
|
157
|
-
sx={{
|
|
158
|
-
p: 3,
|
|
159
|
-
textAlign: 'center',
|
|
160
|
-
borderColor: 'error.main'
|
|
161
|
-
}}
|
|
162
|
-
>
|
|
163
|
-
<Typography variant="body2" color="error">
|
|
164
|
-
Error loading text input field: {error.message}
|
|
165
|
-
</Typography>
|
|
166
|
-
</Paper>
|
|
167
|
-
);
|
|
168
|
-
}
|
|
169
|
-
return null;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
return <TextInputFieldView {...textInputFieldProps} />;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
// Mark as QwickApp component
|
|
176
|
-
(TextInputField as any)[QWICKAPP_COMPONENT] = true;
|
|
92
|
+
// Create the serializable TextInputField component using the factory
|
|
93
|
+
export const TextInputField: SerializableComponent<TextInputFieldProps> = createSerializableView<TextInputFieldProps>({
|
|
94
|
+
tagName: 'TextInputField',
|
|
95
|
+
version: '1.0.0',
|
|
96
|
+
role: 'view',
|
|
97
|
+
View: TextInputFieldView,
|
|
98
|
+
// TextInputField component uses default react-children strategy
|
|
99
|
+
});
|
|
177
100
|
|
|
178
101
|
export default TextInputField;
|