@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
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Text -
|
|
2
|
+
* Text - Factory-based typography component with serialization support
|
|
3
|
+
*
|
|
4
|
+
* Migrated from class-based ModelView to factory pattern for better
|
|
5
|
+
* schema-driven architecture while preserving all typography features.
|
|
3
6
|
*
|
|
4
7
|
* Features:
|
|
5
8
|
* - Complete typography variant support (h1-h6, body1/2, subtitle, etc.)
|
|
@@ -7,30 +10,31 @@
|
|
|
7
10
|
* - Custom typography overrides (fontSize, fontFamily, etc.)
|
|
8
11
|
* - Semantic HTML element rendering
|
|
9
12
|
* - Text formatting and decoration options
|
|
10
|
-
* - Full serialization support via
|
|
13
|
+
* - Full serialization support via createSerializableView
|
|
11
14
|
*
|
|
12
15
|
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
13
16
|
*/
|
|
14
17
|
|
|
15
|
-
import React, { ReactElement, ReactNode } from 'react';
|
|
16
18
|
import { Typography } from '@mui/material';
|
|
17
|
-
import
|
|
18
|
-
import {
|
|
19
|
-
import
|
|
20
|
-
import {
|
|
21
|
-
|
|
22
|
-
type
|
|
23
|
-
/** Click handler for the text */
|
|
24
|
-
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
25
|
-
/** Additional inline styles */
|
|
26
|
-
style?: React.CSSProperties;
|
|
27
|
-
/** Additional CSS class names */
|
|
28
|
-
className?: string;
|
|
29
|
-
};
|
|
19
|
+
import React from 'react';
|
|
20
|
+
import { createSerializableView, SerializableComponent } from '../shared/createSerializableView';
|
|
21
|
+
import { ViewProps } from '../shared/viewProps';
|
|
22
|
+
import { ComponentTransformer } from '../../schemas/transformers/ComponentTransformer';
|
|
23
|
+
import TextSchema from '../../schemas/TextSchema';
|
|
24
|
+
import type { SchemaProps } from '@qwickapps/schema/src/types/ModelProps';
|
|
30
25
|
|
|
31
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Props interface for Text component
|
|
28
|
+
* Uses SchemaProps<typeof TextSchema> for clean typing
|
|
29
|
+
*/
|
|
30
|
+
export type TextProps = ViewProps & SchemaProps<typeof TextSchema>;
|
|
32
31
|
|
|
33
|
-
|
|
32
|
+
/**
|
|
33
|
+
* TextView - Pure view component that renders the typography
|
|
34
|
+
*
|
|
35
|
+
* This component receives fully processed props from createSerializableView
|
|
36
|
+
* and renders the text using Material-UI Typography with all styling applied.
|
|
37
|
+
*/
|
|
34
38
|
function TextView({
|
|
35
39
|
content,
|
|
36
40
|
variant = 'body1',
|
|
@@ -49,22 +53,15 @@ function TextView({
|
|
|
49
53
|
fontFamily,
|
|
50
54
|
customColor,
|
|
51
55
|
maxWidth,
|
|
52
|
-
children,
|
|
53
|
-
onClick,
|
|
54
|
-
style,
|
|
55
56
|
className,
|
|
57
|
+
style,
|
|
56
58
|
...restProps
|
|
57
|
-
}:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
// Mark as QwickApp component
|
|
61
|
-
(TextView as any)[QWICKAPP_COMPONENT] = true;
|
|
62
|
-
|
|
63
|
-
// Determine the text content to display
|
|
64
|
-
const textContent = children || content;
|
|
59
|
+
}: TextProps) {
|
|
60
|
+
// Use content prop directly (already a string from content-prop strategy)
|
|
61
|
+
const textContent = content || '';
|
|
65
62
|
|
|
66
63
|
// Early return if no content provided
|
|
67
|
-
if (!textContent
|
|
64
|
+
if (!textContent) {
|
|
68
65
|
return null;
|
|
69
66
|
}
|
|
70
67
|
|
|
@@ -86,14 +83,12 @@ function TextView({
|
|
|
86
83
|
if (textDecoration !== 'none') customStyles.textDecoration = textDecoration;
|
|
87
84
|
if (textTransform !== 'none') customStyles.textTransform = textTransform;
|
|
88
85
|
|
|
89
|
-
// Handle onClick cursor
|
|
90
|
-
if (onClick) customStyles.cursor = 'pointer';
|
|
86
|
+
// Handle onClick cursor if onClick is provided
|
|
87
|
+
if (restProps.onClick) customStyles.cursor = 'pointer';
|
|
91
88
|
|
|
92
89
|
return (
|
|
93
90
|
<Typography
|
|
94
|
-
{...
|
|
95
|
-
{...styleProps}
|
|
96
|
-
{...otherProps}
|
|
91
|
+
{...restProps}
|
|
97
92
|
variant={variant}
|
|
98
93
|
color={color as any}
|
|
99
94
|
align={align}
|
|
@@ -103,183 +98,90 @@ function TextView({
|
|
|
103
98
|
gutterBottom={gutterBottom}
|
|
104
99
|
className={`text ${className || ''}`.trim()}
|
|
105
100
|
style={customStyles}
|
|
106
|
-
onClick={onClick}
|
|
107
101
|
>
|
|
108
102
|
{textContent}
|
|
109
103
|
</Typography>
|
|
110
104
|
);
|
|
111
105
|
}
|
|
112
106
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
107
|
+
/**
|
|
108
|
+
* Create Text component using the factory pattern
|
|
109
|
+
*/
|
|
110
|
+
export const Text: SerializableComponent<TextProps> = createSerializableView<TextProps>({
|
|
111
|
+
tagName: 'Text',
|
|
112
|
+
version: '1.0.0',
|
|
113
|
+
role: 'view',
|
|
114
|
+
View: TextView,
|
|
115
|
+
childrenStrategy: { mode: 'content-prop', propName: 'content' }
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
// Register HTML patterns that Text component can handle
|
|
119
|
+
(Text as any).registerPatternHandlers = (registry: any): void => {
|
|
120
|
+
// Register paragraph elements
|
|
121
|
+
if (!registry.hasPattern('p')) {
|
|
122
|
+
registry.registerPattern('p', (Text as any).transformParagraph);
|
|
122
123
|
}
|
|
123
124
|
|
|
124
|
-
//
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
color: this.props.color,
|
|
130
|
-
align: this.props.align,
|
|
131
|
-
component: this.props.component,
|
|
132
|
-
fontWeight: this.props.fontWeight,
|
|
133
|
-
textDecoration: this.props.textDecoration,
|
|
134
|
-
textTransform: this.props.textTransform,
|
|
135
|
-
noWrap: this.props.noWrap,
|
|
136
|
-
paragraph: this.props.paragraph,
|
|
137
|
-
gutterBottom: this.props.gutterBottom,
|
|
138
|
-
fontSize: this.props.fontSize,
|
|
139
|
-
lineHeight: this.props.lineHeight,
|
|
140
|
-
letterSpacing: this.props.letterSpacing,
|
|
141
|
-
fontFamily: this.props.fontFamily,
|
|
142
|
-
customColor: this.props.customColor,
|
|
143
|
-
maxWidth: this.props.maxWidth,
|
|
144
|
-
// Note: children ReactNode will be handled by base serialization if needed
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// Text component renders traditional props view
|
|
149
|
-
protected renderView(): React.ReactElement {
|
|
150
|
-
const { dataSource, bindingOptions, ...restProps } = this.props;
|
|
151
|
-
return <TextView {...restProps} />;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
// Text component renders data-bound view
|
|
155
|
-
protected renderWithDataBinding(): React.ReactElement {
|
|
156
|
-
return <TextWithDataBinding {...this.props} />;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
// Register HTML patterns that Text component can handle
|
|
160
|
-
static registerPatternHandlers(registry: any): void {
|
|
161
|
-
// Register paragraph elements
|
|
162
|
-
if (!registry.hasPattern('p')) {
|
|
163
|
-
registry.registerPattern('p', Text.transformParagraph);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
// Register heading elements
|
|
167
|
-
const headings = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
168
|
-
headings.forEach(heading => {
|
|
169
|
-
if (!registry.hasPattern(heading)) {
|
|
170
|
-
registry.registerPattern(heading, (element: Element) => Text.transformHeading(element, heading));
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
// Register span elements
|
|
175
|
-
if (!registry.hasPattern('span')) {
|
|
176
|
-
registry.registerPattern('span', Text.transformSpan);
|
|
125
|
+
// Register heading elements
|
|
126
|
+
const headings = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
127
|
+
headings.forEach(heading => {
|
|
128
|
+
if (!registry.hasPattern(heading)) {
|
|
129
|
+
registry.registerPattern(heading, (element: Element) => (Text as any).transformHeading(element, heading));
|
|
177
130
|
}
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
// Register span elements
|
|
134
|
+
if (!registry.hasPattern('span')) {
|
|
135
|
+
registry.registerPattern('span', (Text as any).transformSpan);
|
|
178
136
|
}
|
|
137
|
+
};
|
|
179
138
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
// Transform heading elements to Text component
|
|
193
|
-
private static transformHeading(element: Element, tagName: string): any {
|
|
194
|
-
const variantMap: { [key: string]: string } = {
|
|
195
|
-
'h1': 'h1',
|
|
196
|
-
'h2': 'h2',
|
|
197
|
-
'h3': 'h3',
|
|
198
|
-
'h4': 'h4',
|
|
199
|
-
'h5': 'h5',
|
|
200
|
-
'h6': 'h6'
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
return {
|
|
204
|
-
tagName: 'Text',
|
|
205
|
-
props: {
|
|
206
|
-
variant: variantMap[tagName] || 'h4',
|
|
207
|
-
component: tagName,
|
|
208
|
-
children: element.textContent || ''
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
// Transform span elements to Text component
|
|
214
|
-
private static transformSpan(element: Element): any {
|
|
215
|
-
return {
|
|
216
|
-
tagName: 'Text',
|
|
217
|
-
props: {
|
|
218
|
-
variant: 'body2',
|
|
219
|
-
component: 'span',
|
|
220
|
-
children: element.textContent || ''
|
|
221
|
-
}
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
// Helper component to handle data binding with hooks (since we can't use hooks in class components)
|
|
227
|
-
function TextWithDataBinding(props: TextProps) {
|
|
228
|
-
const { dataSource, bindingOptions, ...restProps } = props;
|
|
229
|
-
|
|
230
|
-
// Use data binding
|
|
231
|
-
const { dataSource: _source, loading, error, cached, ...rawTextProps } = useDataBinding<TextModel>(
|
|
232
|
-
dataSource!,
|
|
233
|
-
restProps as Partial<TextModel>,
|
|
234
|
-
TextModel.getSchema(),
|
|
235
|
-
{ cache: true, cacheTTL: 300000, strict: false, ...bindingOptions }
|
|
236
|
-
);
|
|
237
|
-
|
|
238
|
-
// Use props directly since new serialization system handles component-level transformation
|
|
239
|
-
const textProps = rawTextProps;
|
|
139
|
+
// Transform paragraph elements to Text component
|
|
140
|
+
(Text as any).transformParagraph = (element: Element): any => {
|
|
141
|
+
return {
|
|
142
|
+
tagName: 'Text',
|
|
143
|
+
props: {
|
|
144
|
+
variant: 'body1',
|
|
145
|
+
component: 'p',
|
|
146
|
+
content: element.textContent || ''
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
};
|
|
240
150
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
maxWidth: textProps.maxWidth
|
|
252
|
-
}}
|
|
253
|
-
>
|
|
254
|
-
Loading text...
|
|
255
|
-
</Typography>
|
|
256
|
-
);
|
|
257
|
-
}
|
|
151
|
+
// Transform heading elements to Text component
|
|
152
|
+
(Text as any).transformHeading = (element: Element, tagName: string): any => {
|
|
153
|
+
const variantMap: { [key: string]: string } = {
|
|
154
|
+
'h1': 'h1',
|
|
155
|
+
'h2': 'h2',
|
|
156
|
+
'h3': 'h3',
|
|
157
|
+
'h4': 'h4',
|
|
158
|
+
'h5': 'h5',
|
|
159
|
+
'h6': 'h6'
|
|
160
|
+
};
|
|
258
161
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
color="error"
|
|
266
|
-
sx={{
|
|
267
|
-
backgroundColor: 'error.light',
|
|
268
|
-
color: 'error.contrastText',
|
|
269
|
-
borderRadius: '4px',
|
|
270
|
-
padding: '0.5rem',
|
|
271
|
-
maxWidth: textProps.maxWidth
|
|
272
|
-
}}
|
|
273
|
-
>
|
|
274
|
-
Error Loading Text: {error.message}
|
|
275
|
-
</Typography>
|
|
276
|
-
);
|
|
162
|
+
return {
|
|
163
|
+
tagName: 'Text',
|
|
164
|
+
props: {
|
|
165
|
+
variant: variantMap[tagName] || 'h4',
|
|
166
|
+
component: tagName,
|
|
167
|
+
content: element.textContent || ''
|
|
277
168
|
}
|
|
278
|
-
|
|
279
|
-
|
|
169
|
+
};
|
|
170
|
+
};
|
|
280
171
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
172
|
+
// Transform span elements to Text component
|
|
173
|
+
(Text as any).transformSpan = (element: Element): any => {
|
|
174
|
+
return {
|
|
175
|
+
tagName: 'Text',
|
|
176
|
+
props: {
|
|
177
|
+
variant: 'body2',
|
|
178
|
+
component: 'span',
|
|
179
|
+
content: element.textContent || ''
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
};
|
|
284
183
|
|
|
184
|
+
/**
|
|
185
|
+
* Export the component as default
|
|
186
|
+
*/
|
|
285
187
|
export default Text;
|
|
@@ -15,12 +15,10 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import React, { ReactElement } from 'react';
|
|
18
|
-
import { Button as MuiButton, ButtonProps as MuiButtonProps, CircularProgress
|
|
19
|
-
import type { WithDataBinding, ModelProps } from '@qwickapps/schema';
|
|
20
|
-
import { QWICKAPP_COMPONENT, useBaseProps } from '../../hooks';
|
|
21
|
-
import { useDataBinding } from '../../hooks';
|
|
18
|
+
import { Button as MuiButton, ButtonProps as MuiButtonProps, CircularProgress } from '@mui/material';
|
|
22
19
|
import ButtonModel from '../../schemas/ButtonSchema';
|
|
23
|
-
import {
|
|
20
|
+
import { createSerializableView, SerializableComponent } from '../shared/createSerializableView';
|
|
21
|
+
import { ViewProps } from '../shared/viewProps';
|
|
24
22
|
|
|
25
23
|
// Action serialization pattern for button clicks
|
|
26
24
|
export interface ButtonAction {
|
|
@@ -31,23 +29,24 @@ export interface ButtonAction {
|
|
|
31
29
|
customHandler?: string;
|
|
32
30
|
}
|
|
33
31
|
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
export interface ButtonProps extends ViewProps {
|
|
33
|
+
// Component-specific props from ButtonModel
|
|
34
|
+
label?: string;
|
|
35
|
+
variant?: 'primary' | 'secondary' | 'outlined' | 'text' | 'contained';
|
|
36
|
+
buttonSize?: 'small' | 'medium' | 'large';
|
|
37
|
+
href?: string;
|
|
38
|
+
target?: '_blank' | '_self' | '_parent' | '_top';
|
|
39
|
+
disabled?: boolean;
|
|
40
|
+
loading?: boolean;
|
|
41
|
+
fullWidth?: boolean;
|
|
42
|
+
// Additional props for enhanced functionality
|
|
36
43
|
icon?: React.ReactNode;
|
|
37
|
-
/** Icon to display after text */
|
|
38
44
|
endIcon?: React.ReactNode;
|
|
39
|
-
/** Event handler for clicks */
|
|
40
|
-
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
41
|
-
/** Button content when using children */
|
|
42
|
-
children?: React.ReactNode;
|
|
43
|
-
/** Serializable action descriptor for buttons */
|
|
44
45
|
action?: ButtonAction;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export interface ButtonProps extends ButtonViewProps, WithDataBinding {}
|
|
46
|
+
}
|
|
48
47
|
|
|
49
48
|
// View component - handles the actual rendering
|
|
50
|
-
const ButtonView = React.forwardRef<HTMLButtonElement,
|
|
49
|
+
const ButtonView = React.forwardRef<HTMLButtonElement, ButtonProps>((props, ref) => {
|
|
51
50
|
const {
|
|
52
51
|
label,
|
|
53
52
|
variant = 'primary',
|
|
@@ -64,8 +63,6 @@ const ButtonView = React.forwardRef<HTMLButtonElement, ButtonViewProps>((props,
|
|
|
64
63
|
children,
|
|
65
64
|
...restProps
|
|
66
65
|
} = props;
|
|
67
|
-
|
|
68
|
-
const { styleProps, htmlProps, restProps: otherProps } = useBaseProps(restProps);
|
|
69
66
|
|
|
70
67
|
// Map our variants to MUI variants
|
|
71
68
|
const getMuiVariant = (): MuiButtonProps['variant'] => {
|
|
@@ -170,8 +167,7 @@ const ButtonView = React.forwardRef<HTMLButtonElement, ButtonViewProps>((props,
|
|
|
170
167
|
size: buttonSize,
|
|
171
168
|
disabled: disabled || loading,
|
|
172
169
|
fullWidth,
|
|
173
|
-
...
|
|
174
|
-
...styleProps,
|
|
170
|
+
...restProps,
|
|
175
171
|
sx: {
|
|
176
172
|
// Ensure consistent text transform
|
|
177
173
|
textTransform: 'none',
|
|
@@ -181,7 +177,7 @@ const ButtonView = React.forwardRef<HTMLButtonElement, ButtonViewProps>((props,
|
|
|
181
177
|
marginRight: 1,
|
|
182
178
|
},
|
|
183
179
|
}),
|
|
184
|
-
...
|
|
180
|
+
...(restProps.sx || {}),
|
|
185
181
|
},
|
|
186
182
|
startIcon: loading ? (
|
|
187
183
|
<CircularProgress
|
|
@@ -226,177 +222,83 @@ const ButtonView = React.forwardRef<HTMLButtonElement, ButtonViewProps>((props,
|
|
|
226
222
|
|
|
227
223
|
ButtonView.displayName = 'ButtonView';
|
|
228
224
|
|
|
229
|
-
//
|
|
230
|
-
export
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
//
|
|
236
|
-
|
|
237
|
-
|
|
225
|
+
// Create the serializable Button component using the factory
|
|
226
|
+
export const Button: SerializableComponent<ButtonProps> = createSerializableView<ButtonProps>({
|
|
227
|
+
tagName: 'Button',
|
|
228
|
+
version: '1.0.0',
|
|
229
|
+
role: 'view',
|
|
230
|
+
View: ButtonView,
|
|
231
|
+
// Button component uses default react-children strategy for potential child content
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
// Register HTML patterns that Button component can handle
|
|
235
|
+
(Button as any).registerPatternHandlers = (registry: any): void => {
|
|
236
|
+
// Register button elements
|
|
237
|
+
if (!registry.hasPattern('button')) {
|
|
238
|
+
registry.registerPattern('button', transformButton);
|
|
238
239
|
}
|
|
239
240
|
|
|
240
|
-
//
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
label: this.props.label,
|
|
244
|
-
variant: this.props.variant,
|
|
245
|
-
buttonSize: this.props.buttonSize,
|
|
246
|
-
href: this.props.href,
|
|
247
|
-
target: this.props.target,
|
|
248
|
-
disabled: this.props.disabled,
|
|
249
|
-
loading: this.props.loading,
|
|
250
|
-
fullWidth: this.props.fullWidth,
|
|
251
|
-
// Include action pattern for click handlers
|
|
252
|
-
action: this.props.action
|
|
253
|
-
};
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
// Button component renders traditional props view
|
|
257
|
-
protected renderView(): React.ReactElement {
|
|
258
|
-
const { dataSource, bindingOptions, ...restProps } = this.props;
|
|
259
|
-
return <ButtonView {...restProps} />;
|
|
241
|
+
// Register input type="button" elements
|
|
242
|
+
if (!registry.hasPattern('input[type="button"]')) {
|
|
243
|
+
registry.registerPattern('input[type="button"]', transformInputButton);
|
|
260
244
|
}
|
|
261
|
-
|
|
262
|
-
//
|
|
263
|
-
|
|
264
|
-
|
|
245
|
+
|
|
246
|
+
// Register input type="submit" elements
|
|
247
|
+
if (!registry.hasPattern('input[type="submit"]')) {
|
|
248
|
+
registry.registerPattern('input[type="submit"]', transformSubmitButton);
|
|
265
249
|
}
|
|
250
|
+
};
|
|
266
251
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
252
|
+
// Transform button elements to Button component
|
|
253
|
+
function transformButton(element: Element): any {
|
|
254
|
+
const variant = element.getAttribute('data-variant') ||
|
|
255
|
+
(element.className.includes('btn-primary') ? 'primary' :
|
|
256
|
+
element.className.includes('btn-outlined') ? 'outlined' : 'secondary');
|
|
257
|
+
const disabled = element.hasAttribute('disabled');
|
|
258
|
+
const href = element.getAttribute('data-href');
|
|
259
|
+
const target = element.getAttribute('data-target');
|
|
260
|
+
|
|
261
|
+
return {
|
|
262
|
+
tagName: 'Button',
|
|
263
|
+
props: {
|
|
264
|
+
label: element.textContent || 'Button',
|
|
265
|
+
variant,
|
|
266
|
+
disabled,
|
|
267
|
+
href: href || undefined,
|
|
268
|
+
target: target || undefined
|
|
277
269
|
}
|
|
278
|
-
|
|
279
|
-
// Register input type="submit" elements
|
|
280
|
-
if (!registry.hasPattern('input[type="submit"]')) {
|
|
281
|
-
registry.registerPattern('input[type="submit"]', Button.transformSubmitButton);
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
// Transform button elements to Button component
|
|
286
|
-
private static transformButton(element: Element): any {
|
|
287
|
-
const variant = element.getAttribute('data-variant') ||
|
|
288
|
-
(element.className.includes('btn-primary') ? 'primary' :
|
|
289
|
-
element.className.includes('btn-outlined') ? 'outlined' : 'secondary');
|
|
290
|
-
const disabled = element.hasAttribute('disabled');
|
|
291
|
-
const href = element.getAttribute('data-href');
|
|
292
|
-
const target = element.getAttribute('data-target');
|
|
293
|
-
|
|
294
|
-
return {
|
|
295
|
-
tagName: 'Button',
|
|
296
|
-
props: {
|
|
297
|
-
label: element.textContent || 'Button',
|
|
298
|
-
variant,
|
|
299
|
-
disabled,
|
|
300
|
-
href: href || undefined,
|
|
301
|
-
target: target || undefined
|
|
302
|
-
}
|
|
303
|
-
};
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
// Transform input type="button" elements to Button component
|
|
307
|
-
private static transformInputButton(element: Element): any {
|
|
308
|
-
const disabled = element.hasAttribute('disabled');
|
|
309
|
-
const value = element.getAttribute('value') || 'Button';
|
|
310
|
-
|
|
311
|
-
return {
|
|
312
|
-
tagName: 'Button',
|
|
313
|
-
props: {
|
|
314
|
-
label: value,
|
|
315
|
-
variant: 'secondary',
|
|
316
|
-
disabled
|
|
317
|
-
}
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
// Transform input type="submit" elements to Button component
|
|
322
|
-
private static transformSubmitButton(element: Element): any {
|
|
323
|
-
const disabled = element.hasAttribute('disabled');
|
|
324
|
-
const value = element.getAttribute('value') || 'Submit';
|
|
325
|
-
|
|
326
|
-
return {
|
|
327
|
-
tagName: 'Button',
|
|
328
|
-
props: {
|
|
329
|
-
label: value,
|
|
330
|
-
variant: 'primary',
|
|
331
|
-
disabled,
|
|
332
|
-
type: 'submit'
|
|
333
|
-
}
|
|
334
|
-
};
|
|
335
|
-
}
|
|
270
|
+
};
|
|
336
271
|
}
|
|
337
272
|
|
|
338
|
-
//
|
|
339
|
-
function
|
|
340
|
-
const
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
// Check if we're still loading data using the metadata properties
|
|
351
|
-
const bindingLoading = bindingResult.$loading;
|
|
352
|
-
|
|
353
|
-
// Extract all the actual button properties (excluding metadata)
|
|
354
|
-
const { dataSource: _source, $loading, $error, $dataSource, $cached, cached, ...buttonProps } = bindingResult;
|
|
355
|
-
const error = bindingResult.$error;
|
|
356
|
-
|
|
357
|
-
// Show loading state while fetching data
|
|
358
|
-
if (bindingLoading) {
|
|
359
|
-
return (
|
|
360
|
-
<Paper
|
|
361
|
-
variant="outlined"
|
|
362
|
-
sx={{
|
|
363
|
-
p: 2,
|
|
364
|
-
textAlign: 'center'
|
|
365
|
-
}}
|
|
366
|
-
>
|
|
367
|
-
<Typography variant="body2">Loading Button...</Typography>
|
|
368
|
-
<Typography variant="caption" color="text.secondary">
|
|
369
|
-
Loading button configuration from data source...
|
|
370
|
-
</Typography>
|
|
371
|
-
</Paper>
|
|
372
|
-
);
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
if (error) {
|
|
376
|
-
console.error('Error loading button:', error);
|
|
377
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
378
|
-
return (
|
|
379
|
-
<Paper
|
|
380
|
-
variant="outlined"
|
|
381
|
-
sx={{
|
|
382
|
-
p: 2,
|
|
383
|
-
textAlign: 'center',
|
|
384
|
-
borderColor: 'error.main'
|
|
385
|
-
}}
|
|
386
|
-
>
|
|
387
|
-
<Typography variant="body2" color="error">
|
|
388
|
-
Error loading button: {error.message}
|
|
389
|
-
</Typography>
|
|
390
|
-
</Paper>
|
|
391
|
-
);
|
|
273
|
+
// Transform input type="button" elements to Button component
|
|
274
|
+
function transformInputButton(element: Element): any {
|
|
275
|
+
const disabled = element.hasAttribute('disabled');
|
|
276
|
+
const value = element.getAttribute('value') || 'Button';
|
|
277
|
+
|
|
278
|
+
return {
|
|
279
|
+
tagName: 'Button',
|
|
280
|
+
props: {
|
|
281
|
+
label: value,
|
|
282
|
+
variant: 'secondary',
|
|
283
|
+
disabled
|
|
392
284
|
}
|
|
393
|
-
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
return <ButtonView {...buttonProps} />;
|
|
285
|
+
};
|
|
397
286
|
}
|
|
398
287
|
|
|
399
|
-
//
|
|
400
|
-
(
|
|
288
|
+
// Transform input type="submit" elements to Button component
|
|
289
|
+
function transformSubmitButton(element: Element): any {
|
|
290
|
+
const disabled = element.hasAttribute('disabled');
|
|
291
|
+
const value = element.getAttribute('value') || 'Submit';
|
|
292
|
+
|
|
293
|
+
return {
|
|
294
|
+
tagName: 'Button',
|
|
295
|
+
props: {
|
|
296
|
+
label: value,
|
|
297
|
+
variant: 'primary',
|
|
298
|
+
disabled,
|
|
299
|
+
type: 'submit'
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
}
|
|
401
303
|
|
|
402
304
|
export default Button;
|