@qwickapps/react-framework 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +44 -0
- package/README.md +794 -0
- package/dist/components/AccessibilityChecker.d.ts +12 -0
- package/dist/components/AccessibilityChecker.d.ts.map +1 -0
- package/dist/components/Html.d.ts +48 -0
- package/dist/components/Html.d.ts.map +1 -0
- package/dist/components/Logo.d.ts +79 -0
- package/dist/components/Logo.d.ts.map +1 -0
- package/dist/components/Markdown.d.ts +47 -0
- package/dist/components/Markdown.d.ts.map +1 -0
- package/dist/components/QwickApp.d.ts +56 -0
- package/dist/components/QwickApp.d.ts.map +1 -0
- package/dist/components/QwickAppsLogo.d.ts +25 -0
- package/dist/components/QwickAppsLogo.d.ts.map +1 -0
- package/dist/components/ResponsiveMenu.d.ts +38 -0
- package/dist/components/ResponsiveMenu.d.ts.map +1 -0
- package/dist/components/SafeSpan.d.ts +23 -0
- package/dist/components/SafeSpan.d.ts.map +1 -0
- package/dist/components/Scaffold.d.ts +57 -0
- package/dist/components/Scaffold.d.ts.map +1 -0
- package/dist/components/blocks/Article.d.ts +23 -0
- package/dist/components/blocks/Article.d.ts.map +1 -0
- package/dist/components/blocks/CardListGrid.d.ts +23 -0
- package/dist/components/blocks/CardListGrid.d.ts.map +1 -0
- package/dist/components/blocks/Code.d.ts +21 -0
- package/dist/components/blocks/Code.d.ts.map +1 -0
- package/dist/components/blocks/Content.d.ts +24 -0
- package/dist/components/blocks/Content.d.ts.map +1 -0
- package/dist/components/blocks/CoverImageHeader.d.ts +44 -0
- package/dist/components/blocks/CoverImageHeader.d.ts.map +1 -0
- package/dist/components/blocks/FeatureCard.d.ts +66 -0
- package/dist/components/blocks/FeatureCard.d.ts.map +1 -0
- package/dist/components/blocks/FeatureGrid.d.ts +48 -0
- package/dist/components/blocks/FeatureGrid.d.ts.map +1 -0
- package/dist/components/blocks/Footer.d.ts +56 -0
- package/dist/components/blocks/Footer.d.ts.map +1 -0
- package/dist/components/blocks/HeroBlock.d.ts +33 -0
- package/dist/components/blocks/HeroBlock.d.ts.map +1 -0
- package/dist/components/blocks/PageBannerHeader.d.ts +30 -0
- package/dist/components/blocks/PageBannerHeader.d.ts.map +1 -0
- package/dist/components/blocks/ProductCard.d.ts +57 -0
- package/dist/components/blocks/ProductCard.d.ts.map +1 -0
- package/dist/components/blocks/Section.d.ts +40 -0
- package/dist/components/blocks/Section.d.ts.map +1 -0
- package/dist/components/blocks/index.d.ts +37 -0
- package/dist/components/blocks/index.d.ts.map +1 -0
- package/dist/components/buttons/Button.d.ts +38 -0
- package/dist/components/buttons/Button.d.ts.map +1 -0
- package/dist/components/buttons/PaletteSwitcher.d.ts +24 -0
- package/dist/components/buttons/PaletteSwitcher.d.ts.map +1 -0
- package/dist/components/buttons/ThemeSwitcher.d.ts +24 -0
- package/dist/components/buttons/ThemeSwitcher.d.ts.map +1 -0
- package/dist/components/buttons/index.d.ts +11 -0
- package/dist/components/buttons/index.d.ts.map +1 -0
- package/dist/components/forms/FormBlock.d.ts +45 -0
- package/dist/components/forms/FormBlock.d.ts.map +1 -0
- package/dist/components/forms/index.d.ts +8 -0
- package/dist/components/forms/index.d.ts.map +1 -0
- package/dist/components/index.d.ts +32 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/input/ChoiceInputField.d.ts +30 -0
- package/dist/components/input/ChoiceInputField.d.ts.map +1 -0
- package/dist/components/input/HtmlInputField.d.ts +29 -0
- package/dist/components/input/HtmlInputField.d.ts.map +1 -0
- package/dist/components/input/SelectInputField.d.ts +29 -0
- package/dist/components/input/SelectInputField.d.ts.map +1 -0
- package/dist/components/input/TextField.d.ts +18 -0
- package/dist/components/input/TextField.d.ts.map +1 -0
- package/dist/components/input/TextInputField.d.ts +32 -0
- package/dist/components/input/TextInputField.d.ts.map +1 -0
- package/dist/components/input/index.d.ts +17 -0
- package/dist/components/input/index.d.ts.map +1 -0
- package/dist/components/layout/GridCell.d.ts +16 -0
- package/dist/components/layout/GridCell.d.ts.map +1 -0
- package/dist/components/layout/GridCellWrapper.d.ts +46 -0
- package/dist/components/layout/GridCellWrapper.d.ts.map +1 -0
- package/dist/components/layout/GridLayout.d.ts +38 -0
- package/dist/components/layout/GridLayout.d.ts.map +1 -0
- package/dist/components/layout/index.d.ts +12 -0
- package/dist/components/layout/index.d.ts.map +1 -0
- package/dist/components/menu/Menu.d.ts +1 -0
- package/dist/components/menu/Menu.d.ts.map +1 -0
- package/dist/components/menu/MenuItem.d.ts +31 -0
- package/dist/components/menu/MenuItem.d.ts.map +1 -0
- package/dist/components/menu/index.d.ts +7 -0
- package/dist/components/menu/index.d.ts.map +1 -0
- package/dist/components/pages/FormPage.d.ts +66 -0
- package/dist/components/pages/FormPage.d.ts.map +1 -0
- package/dist/components/pages/Page.d.ts +124 -0
- package/dist/components/pages/Page.d.ts.map +1 -0
- package/dist/components/pages/index.d.ts +11 -0
- package/dist/components/pages/index.d.ts.map +1 -0
- package/dist/contexts/DataContext.d.ts +139 -0
- package/dist/contexts/DataContext.d.ts.map +1 -0
- package/dist/contexts/DimensionsContext.d.ts +42 -0
- package/dist/contexts/DimensionsContext.d.ts.map +1 -0
- package/dist/contexts/PaletteContext.d.ts +53 -0
- package/dist/contexts/PaletteContext.d.ts.map +1 -0
- package/dist/contexts/QwickAppContext.d.ts +71 -0
- package/dist/contexts/QwickAppContext.d.ts.map +1 -0
- package/dist/contexts/ThemeContext.d.ts +65 -0
- package/dist/contexts/ThemeContext.d.ts.map +1 -0
- package/dist/contexts/index.d.ts +9 -0
- package/dist/contexts/index.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +10 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/useBaseProps.d.ts +101 -0
- package/dist/hooks/useBaseProps.d.ts.map +1 -0
- package/dist/hooks/useDataBinding.d.ts +22 -0
- package/dist/hooks/useDataBinding.d.ts.map +1 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.css +1 -0
- package/dist/index.esm.js +24143 -0
- package/dist/index.js +24245 -0
- package/dist/palettes/PaletteAutumn.d.ts +10 -0
- package/dist/palettes/PaletteAutumn.d.ts.map +1 -0
- package/dist/palettes/PaletteCosmic.d.ts +10 -0
- package/dist/palettes/PaletteCosmic.d.ts.map +1 -0
- package/dist/palettes/PaletteDefault.d.ts +10 -0
- package/dist/palettes/PaletteDefault.d.ts.map +1 -0
- package/dist/palettes/PaletteOcean.d.ts +10 -0
- package/dist/palettes/PaletteOcean.d.ts.map +1 -0
- package/dist/palettes/PaletteSpring.d.ts +10 -0
- package/dist/palettes/PaletteSpring.d.ts.map +1 -0
- package/dist/palettes/PaletteWinter.d.ts +10 -0
- package/dist/palettes/PaletteWinter.d.ts.map +1 -0
- package/dist/palettes/index.d.ts +13 -0
- package/dist/palettes/index.d.ts.map +1 -0
- package/dist/schemas/ActionSchema.d.ts +21 -0
- package/dist/schemas/ActionSchema.d.ts.map +1 -0
- package/dist/schemas/ArticleSchema.d.ts +13 -0
- package/dist/schemas/ArticleSchema.d.ts.map +1 -0
- package/dist/schemas/Builders.d.ts +7 -0
- package/dist/schemas/Builders.d.ts.map +1 -0
- package/dist/schemas/ButtonSchema.d.ts +19 -0
- package/dist/schemas/ButtonSchema.d.ts.map +1 -0
- package/dist/schemas/CardListGridSchema.d.ts +17 -0
- package/dist/schemas/CardListGridSchema.d.ts.map +1 -0
- package/dist/schemas/ChoiceInputFieldSchema.d.ts +18 -0
- package/dist/schemas/ChoiceInputFieldSchema.d.ts.map +1 -0
- package/dist/schemas/CodeSchema.d.ts +18 -0
- package/dist/schemas/CodeSchema.d.ts.map +1 -0
- package/dist/schemas/ContentSchema.d.ts +20 -0
- package/dist/schemas/ContentSchema.d.ts.map +1 -0
- package/dist/schemas/CoverImageHeaderSchema.d.ts +28 -0
- package/dist/schemas/CoverImageHeaderSchema.d.ts.map +1 -0
- package/dist/schemas/FeatureCardSchema.d.ts +28 -0
- package/dist/schemas/FeatureCardSchema.d.ts.map +1 -0
- package/dist/schemas/FeatureGridSchema.d.ts +17 -0
- package/dist/schemas/FeatureGridSchema.d.ts.map +1 -0
- package/dist/schemas/FeatureItemSchema.d.ts +16 -0
- package/dist/schemas/FeatureItemSchema.d.ts.map +1 -0
- package/dist/schemas/FooterItemSchema.d.ts +15 -0
- package/dist/schemas/FooterItemSchema.d.ts.map +1 -0
- package/dist/schemas/FooterSchema.d.ts +20 -0
- package/dist/schemas/FooterSchema.d.ts.map +1 -0
- package/dist/schemas/FooterSectionSchema.d.ts +15 -0
- package/dist/schemas/FooterSectionSchema.d.ts.map +1 -0
- package/dist/schemas/FormBlockSchema.d.ts +19 -0
- package/dist/schemas/FormBlockSchema.d.ts.map +1 -0
- package/dist/schemas/HeaderActionSchema.d.ts +17 -0
- package/dist/schemas/HeaderActionSchema.d.ts.map +1 -0
- package/dist/schemas/HeroBlockSchema.d.ts +22 -0
- package/dist/schemas/HeroBlockSchema.d.ts.map +1 -0
- package/dist/schemas/HtmlInputFieldSchema.d.ts +18 -0
- package/dist/schemas/HtmlInputFieldSchema.d.ts.map +1 -0
- package/dist/schemas/MetadataItemSchema.d.ts +13 -0
- package/dist/schemas/MetadataItemSchema.d.ts.map +1 -0
- package/dist/schemas/PageBannerHeaderSchema.d.ts +28 -0
- package/dist/schemas/PageBannerHeaderSchema.d.ts.map +1 -0
- package/dist/schemas/PaletteSwitcherSchema.d.ts +16 -0
- package/dist/schemas/PaletteSwitcherSchema.d.ts.map +1 -0
- package/dist/schemas/ProductCardSchema.d.ts +39 -0
- package/dist/schemas/ProductCardSchema.d.ts.map +1 -0
- package/dist/schemas/SafeSpanSchema.d.ts +13 -0
- package/dist/schemas/SafeSpanSchema.d.ts.map +1 -0
- package/dist/schemas/SectionSchema.d.ts +17 -0
- package/dist/schemas/SectionSchema.d.ts.map +1 -0
- package/dist/schemas/SelectInputFieldSchema.d.ts +27 -0
- package/dist/schemas/SelectInputFieldSchema.d.ts.map +1 -0
- package/dist/schemas/TextInputFieldSchema.d.ts +22 -0
- package/dist/schemas/TextInputFieldSchema.d.ts.map +1 -0
- package/dist/schemas/ThemeSwitcherSchema.d.ts +19 -0
- package/dist/schemas/ThemeSwitcherSchema.d.ts.map +1 -0
- package/dist/schemas/index.d.ts +33 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/types.d.ts +7 -0
- package/dist/schemas/types.d.ts.map +1 -0
- package/dist/templates/TemplateResolver.d.ts +52 -0
- package/dist/templates/TemplateResolver.d.ts.map +1 -0
- package/dist/templates/index.d.ts +7 -0
- package/dist/templates/index.d.ts.map +1 -0
- package/dist/tests/ConsoleWarningTest.d.ts +5 -0
- package/dist/tests/ConsoleWarningTest.d.ts.map +1 -0
- package/dist/tests/StorageKeyTest.d.ts +6 -0
- package/dist/tests/StorageKeyTest.d.ts.map +1 -0
- package/dist/tests/ThemeStorageKeyTest.d.ts +6 -0
- package/dist/tests/ThemeStorageKeyTest.d.ts.map +1 -0
- package/dist/types/CacheProvider.d.ts +18 -0
- package/dist/types/CacheProvider.d.ts.map +1 -0
- package/dist/types/ContentProxy.d.ts +47 -0
- package/dist/types/ContentProxy.d.ts.map +1 -0
- package/dist/types/DataBinding.d.ts +7 -0
- package/dist/types/DataBinding.d.ts.map +1 -0
- package/dist/types/DataProvider.d.ts +7 -0
- package/dist/types/DataProvider.d.ts.map +1 -0
- package/dist/types/DataTypes.d.ts +185 -0
- package/dist/types/DataTypes.d.ts.map +1 -0
- package/dist/types/TemplateProvider.d.ts +10 -0
- package/dist/types/TemplateProvider.d.ts.map +1 -0
- package/dist/types/TemplateResolver.d.ts +23 -0
- package/dist/types/TemplateResolver.d.ts.map +1 -0
- package/dist/types/index.d.ts +81 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/utils/breakpoints.d.ts +35 -0
- package/dist/utils/breakpoints.d.ts.map +1 -0
- package/dist/utils/customPaletteManager.d.ts +8 -0
- package/dist/utils/customPaletteManager.d.ts.map +1 -0
- package/dist/utils/dimensions.d.ts +34 -0
- package/dist/utils/dimensions.d.ts.map +1 -0
- package/dist/utils/htmlTransform.d.ts +44 -0
- package/dist/utils/htmlTransform.d.ts.map +1 -0
- package/dist/utils/index.d.ts +15 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/logger.d.ts +14 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/paletteUtils.d.ts +38 -0
- package/dist/utils/paletteUtils.d.ts.map +1 -0
- package/dist/utils/persistenceUtils.d.ts +31 -0
- package/dist/utils/persistenceUtils.d.ts.map +1 -0
- package/dist/utils/reactUtils.d.ts +24 -0
- package/dist/utils/reactUtils.d.ts.map +1 -0
- package/dist/utils/spacing.d.ts +34 -0
- package/dist/utils/spacing.d.ts.map +1 -0
- package/dist/utils/themePerformanceMonitor.d.ts +32 -0
- package/dist/utils/themePerformanceMonitor.d.ts.map +1 -0
- package/dist/utils/themeUtils.d.ts +27 -0
- package/dist/utils/themeUtils.d.ts.map +1 -0
- package/package.json +141 -0
- package/src/__tests__/components/Logo.test.js +172 -0
- package/src/__tests__/contexts/DataContext.test.js +505 -0
- package/src/__tests__/contexts/PaletteContext.test.js +115 -0
- package/src/__tests__/contexts/ThemeContext.test.js +123 -0
- package/src/__tests__/utils/paletteUtils.test.js +142 -0
- package/src/__tests__/utils/themeUtils.test.js +142 -0
- package/src/components/AccessibilityChecker.tsx +264 -0
- package/src/components/Html.tsx +191 -0
- package/src/components/Logo.css +217 -0
- package/src/components/Logo.tsx +370 -0
- package/src/components/Markdown.tsx +191 -0
- package/src/components/QwickApp.css +257 -0
- package/src/components/QwickApp.tsx +157 -0
- package/src/components/QwickAppsLogo.tsx +77 -0
- package/src/components/ResponsiveMenu.css +416 -0
- package/src/components/ResponsiveMenu.tsx +310 -0
- package/src/components/SafeSpan.tsx +128 -0
- package/src/components/Scaffold.css +541 -0
- package/src/components/Scaffold.tsx +463 -0
- package/src/components/__tests__/Article.test.tsx +419 -0
- package/src/components/__tests__/Button.test.tsx +702 -0
- package/src/components/__tests__/CardListGrid.test.tsx +478 -0
- package/src/components/__tests__/ChoiceInputField.test.tsx +864 -0
- package/src/components/__tests__/Code.test.tsx +595 -0
- package/src/components/__tests__/Content.integration.test.tsx +193 -0
- package/src/components/__tests__/Content.test.tsx +504 -0
- package/src/components/__tests__/CoverImageHeader.test.tsx +456 -0
- package/src/components/__tests__/FeatureCard.integration.test.tsx +384 -0
- package/src/components/__tests__/FeatureGrid.integration.test.tsx +364 -0
- package/src/components/__tests__/FeatureGrid.test.tsx +494 -0
- package/src/components/__tests__/Footer.test.tsx +544 -0
- package/src/components/__tests__/FormBlock.test.tsx +857 -0
- package/src/components/__tests__/HeroBlock.integration.test.tsx +272 -0
- package/src/components/__tests__/HeroBlock.test.tsx +463 -0
- package/src/components/__tests__/Html.test.tsx +174 -0
- package/src/components/__tests__/HtmlInputField.test.tsx +856 -0
- package/src/components/__tests__/Markdown.test.tsx +233 -0
- package/src/components/__tests__/PageBannerHeader.test.tsx +614 -0
- package/src/components/__tests__/PaletteSwitcher.test.tsx +864 -0
- package/src/components/__tests__/ProductCard.test.tsx +377 -0
- package/src/components/__tests__/SafeSpan.integration.test.tsx +123 -0
- package/src/components/__tests__/SafeSpan.simple.test.tsx +65 -0
- package/src/components/__tests__/SafeSpan.test.tsx +388 -0
- package/src/components/__tests__/Section.integration.test.tsx +288 -0
- package/src/components/__tests__/Section.test.tsx +494 -0
- package/src/components/__tests__/SelectInputField.test.tsx +886 -0
- package/src/components/__tests__/TextInputField.test.tsx +749 -0
- package/src/components/__tests__/ThemeSwitcher.test.tsx +777 -0
- package/src/components/blocks/Article.tsx +194 -0
- package/src/components/blocks/CardListGrid.tsx +132 -0
- package/src/components/blocks/Code.tsx +313 -0
- package/src/components/blocks/Content.tsx +265 -0
- package/src/components/blocks/CoverImageHeader.css +17 -0
- package/src/components/blocks/CoverImageHeader.tsx +435 -0
- package/src/components/blocks/FeatureCard.tsx +321 -0
- package/src/components/blocks/FeatureGrid.tsx +147 -0
- package/src/components/blocks/Footer.tsx +343 -0
- package/src/components/blocks/HeroBlock.tsx +280 -0
- package/src/components/blocks/PageBannerHeader.tsx +471 -0
- package/src/components/blocks/ProductCard.tsx +472 -0
- package/src/components/blocks/Section.tsx +209 -0
- package/src/components/blocks/index.ts +37 -0
- package/src/components/buttons/Button.tsx +233 -0
- package/src/components/buttons/PaletteSwitcher.tsx +268 -0
- package/src/components/buttons/ThemeSwitcher.tsx +283 -0
- package/src/components/buttons/index.ts +11 -0
- package/src/components/forms/FormBlock.tsx +291 -0
- package/src/components/forms/index.ts +7 -0
- package/src/components/index.ts +37 -0
- package/src/components/input/ChoiceInputField.tsx +188 -0
- package/src/components/input/HtmlInputField.tsx +326 -0
- package/src/components/input/SelectInputField.tsx +197 -0
- package/src/components/input/TextField.tsx +47 -0
- package/src/components/input/TextInputField.tsx +144 -0
- package/src/components/input/index.ts +17 -0
- package/src/components/layout/GridCell.tsx +46 -0
- package/src/components/layout/GridCellWrapper.tsx +87 -0
- package/src/components/layout/GridLayout.tsx +169 -0
- package/src/components/layout/index.ts +13 -0
- package/src/components/menu/Menu.tsx +0 -0
- package/src/components/menu/MenuItem.tsx +32 -0
- package/src/components/menu/index.ts +6 -0
- package/src/components/pages/FormPage.tsx +108 -0
- package/src/components/pages/Page.css +460 -0
- package/src/components/pages/Page.tsx +345 -0
- package/src/components/pages/index.ts +11 -0
- package/src/contexts/DataContext.tsx +355 -0
- package/src/contexts/DimensionsContext.tsx +154 -0
- package/src/contexts/PaletteContext.tsx +217 -0
- package/src/contexts/QwickAppContext.tsx +95 -0
- package/src/contexts/ThemeContext.tsx +376 -0
- package/src/contexts/index.ts +9 -0
- package/src/hooks/__tests__/useDataBinding.test.tsx.disabled +229 -0
- package/src/hooks/index.ts +11 -0
- package/src/hooks/useBaseProps.ts +267 -0
- package/src/hooks/useDataBinding.ts +77 -0
- package/src/index.ts +23 -0
- package/src/palettes/PaletteAutumn.css +172 -0
- package/src/palettes/PaletteAutumn.ts +16 -0
- package/src/palettes/PaletteCosmic.css +172 -0
- package/src/palettes/PaletteCosmic.ts +16 -0
- package/src/palettes/PaletteDefault.css +178 -0
- package/src/palettes/PaletteDefault.ts +17 -0
- package/src/palettes/PaletteOcean.css +172 -0
- package/src/palettes/PaletteOcean.ts +16 -0
- package/src/palettes/PaletteSpring.css +160 -0
- package/src/palettes/PaletteSpring.ts +16 -0
- package/src/palettes/PaletteWinter.css +172 -0
- package/src/palettes/PaletteWinter.ts +16 -0
- package/src/palettes/index.css +12 -0
- package/src/palettes/index.ts +29 -0
- package/src/schemas/ActionSchema.ts +140 -0
- package/src/schemas/ArticleSchema.ts +35 -0
- package/src/schemas/ButtonSchema.ts +99 -0
- package/src/schemas/CardListGridSchema.ts +102 -0
- package/src/schemas/ChoiceInputFieldSchema.ts +89 -0
- package/src/schemas/CodeSchema.ts +88 -0
- package/src/schemas/ContentSchema.ts +128 -0
- package/src/schemas/CoverImageHeaderSchema.ts +208 -0
- package/src/schemas/FeatureCardSchema.ts +161 -0
- package/src/schemas/FeatureGridSchema.ts +87 -0
- package/src/schemas/FeatureItemSchema.ts +68 -0
- package/src/schemas/FooterItemSchema.ts +57 -0
- package/src/schemas/FooterSchema.ts +116 -0
- package/src/schemas/FooterSectionSchema.ts +50 -0
- package/src/schemas/FormBlockSchema.ts +102 -0
- package/src/schemas/HeaderActionSchema.ts +83 -0
- package/src/schemas/HeroBlockSchema.ts +149 -0
- package/src/schemas/HtmlInputFieldSchema.ts +88 -0
- package/src/schemas/MetadataItemSchema.ts +35 -0
- package/src/schemas/PageBannerHeaderSchema.ts +206 -0
- package/src/schemas/PaletteSwitcherSchema.ts +66 -0
- package/src/schemas/ProductCardSchema.ts +264 -0
- package/src/schemas/SafeSpanSchema.ts +36 -0
- package/src/schemas/SectionSchema.ts +106 -0
- package/src/schemas/SelectInputFieldSchema.ts +137 -0
- package/src/schemas/TextInputFieldSchema.ts +129 -0
- package/src/schemas/ThemeSwitcherSchema.ts +97 -0
- package/src/schemas/__tests__/builders.test.ts +313 -0
- package/src/schemas/index.ts +34 -0
- package/src/setupTests.js +60 -0
- package/src/stories/Article.stories.tsx +549 -0
- package/src/stories/Button.stories.tsx +498 -0
- package/src/stories/CardListGrid.stories.tsx +539 -0
- package/src/stories/ChoiceInputField.stories.tsx +591 -0
- package/src/stories/Code.stories.tsx +711 -0
- package/src/stories/Content.stories.tsx +463 -0
- package/src/stories/CoverImageHeader.stories.tsx +794 -0
- package/src/stories/DataBinding.advanced.stories.tsx +548 -0
- package/src/stories/DataBinding.stories.tsx +452 -0
- package/src/stories/DataProvider.stories.tsx +1361 -0
- package/src/stories/FeatureCard.stories.tsx +642 -0
- package/src/stories/FeatureGrid.stories.tsx +669 -0
- package/src/stories/Footer.stories.tsx +724 -0
- package/src/stories/FormBlock.stories.tsx +834 -0
- package/src/stories/HeroBlock.stories.tsx +442 -0
- package/src/stories/Html.stories.tsx +264 -0
- package/src/stories/HtmlInputField.stories.tsx +558 -0
- package/src/stories/Introduction.stories.tsx +721 -0
- package/src/stories/LayoutBlocks.stories.tsx +382 -0
- package/src/stories/LayoutSystem.stories.tsx +253 -0
- package/src/stories/Logo.stories.tsx +400 -0
- package/src/stories/Markdown.stories.tsx +349 -0
- package/src/stories/Page.stories.tsx +762 -0
- package/src/stories/PageBannerHeader.stories.tsx +949 -0
- package/src/stories/PaletteSwitcher.stories.tsx +156 -0
- package/src/stories/ProductCard.stories.tsx +504 -0
- package/src/stories/QwickApp.stories.tsx +461 -0
- package/src/stories/ResponsiveMenu.stories.tsx +299 -0
- package/src/stories/SafeSpan.stories.tsx +612 -0
- package/src/stories/Section.stories.tsx +613 -0
- package/src/stories/SelectInputField.stories.tsx +605 -0
- package/src/stories/TextInputField.stories.tsx +526 -0
- package/src/stories/ThemeSwitcher.stories.tsx +170 -0
- package/src/stories/form/FormComponents.stories.tsx +588 -0
- package/src/templates/TemplateResolver.ts +156 -0
- package/src/templates/index.ts +6 -0
- package/src/tests/ConsoleWarningTest.tsx +30 -0
- package/src/tests/StorageKeyTest.tsx +110 -0
- package/src/tests/ThemeStorageKeyTest.tsx +114 -0
- package/src/types/CacheProvider.ts +14 -0
- package/src/types/ContentProxy.ts +99 -0
- package/src/types/DataTypes.ts +196 -0
- package/src/types/TemplateProvider.ts +9 -0
- package/src/types/TemplateResolver.ts +26 -0
- package/src/types/index.ts +99 -0
- package/src/utils/__tests__/createDataDrivenComponent.test.tsx.disabled +193 -0
- package/src/utils/__tests__/htmlTransform.test.tsx +255 -0
- package/src/utils/breakpoints.ts +87 -0
- package/src/utils/customPaletteManager.js +214 -0
- package/src/utils/dimensions.ts +147 -0
- package/src/utils/htmlTransform.tsx +323 -0
- package/src/utils/index.ts +16 -0
- package/src/utils/logger.ts +28 -0
- package/src/utils/paletteUtils.ts +78 -0
- package/src/utils/persistenceUtils.ts +107 -0
- package/src/utils/reactUtils.tsx +37 -0
- package/src/utils/spacing.ts +155 -0
- package/src/utils/themePerformanceMonitor.js +113 -0
- package/src/utils/themeUtils.ts +67 -0
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ProductCard - Unified product card component with variants
|
|
3
|
+
*
|
|
4
|
+
* A flexible product card that can display products in different formats:
|
|
5
|
+
* - Compact variant: For showcases and lists (shows limited features)
|
|
6
|
+
* - Detailed variant: For product pages (shows full details)
|
|
7
|
+
*
|
|
8
|
+
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { Schedule as ComingSoonIcon, Launch as LaunchIcon, Visibility as PreviewIcon } from '@mui/icons-material';
|
|
12
|
+
import {
|
|
13
|
+
Box,
|
|
14
|
+
Chip,
|
|
15
|
+
Typography,
|
|
16
|
+
useTheme
|
|
17
|
+
} from '@mui/material';
|
|
18
|
+
import { WithDataBinding } from '@qwickapps/schema';
|
|
19
|
+
import { QWICKAPP_COMPONENT, useBaseProps, useDataBinding, WithBaseProps } from '../../hooks';
|
|
20
|
+
import ProductCardModel from '../../schemas/ProductCardSchema';
|
|
21
|
+
import { Button } from '../buttons/Button';
|
|
22
|
+
|
|
23
|
+
export interface Product {
|
|
24
|
+
id: string;
|
|
25
|
+
name: string;
|
|
26
|
+
category: string;
|
|
27
|
+
description: string;
|
|
28
|
+
shortDescription?: string;
|
|
29
|
+
features: string[];
|
|
30
|
+
technologies: string[];
|
|
31
|
+
status: string;
|
|
32
|
+
image?: string;
|
|
33
|
+
url?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface ProductCardAction {
|
|
37
|
+
id: string;
|
|
38
|
+
label: string;
|
|
39
|
+
variant?: 'contained' | 'outlined' | 'text';
|
|
40
|
+
color?: 'primary' | 'secondary' | 'error';
|
|
41
|
+
disabled?: boolean;
|
|
42
|
+
onClick: () => void;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
interface ProductCardViewProps extends WithBaseProps {
|
|
46
|
+
/** Product data */
|
|
47
|
+
product?: Product;
|
|
48
|
+
/** Card variant */
|
|
49
|
+
variant?: 'compact' | 'detailed';
|
|
50
|
+
/** Custom actions - if not provided, uses default actions */
|
|
51
|
+
actions?: ProductCardAction[];
|
|
52
|
+
/** Click handler for card */
|
|
53
|
+
onClick?: () => void;
|
|
54
|
+
/** Whether to show the image */
|
|
55
|
+
showImage?: boolean;
|
|
56
|
+
/** Whether to show technologies */
|
|
57
|
+
showTechnologies?: boolean;
|
|
58
|
+
/** Maximum features to show in compact mode */
|
|
59
|
+
maxFeaturesCompact?: number;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface ProductCardProps extends ProductCardViewProps, WithDataBinding {}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Core ProductCard View component - handles product card rendering
|
|
66
|
+
*/
|
|
67
|
+
function ProductCardView({
|
|
68
|
+
product,
|
|
69
|
+
variant = 'compact',
|
|
70
|
+
actions,
|
|
71
|
+
onClick,
|
|
72
|
+
showImage = true,
|
|
73
|
+
showTechnologies = true,
|
|
74
|
+
maxFeaturesCompact = 3,
|
|
75
|
+
...restProps
|
|
76
|
+
}: ProductCardViewProps) {
|
|
77
|
+
const { styleProps, htmlProps } = useBaseProps(restProps);
|
|
78
|
+
const theme = useTheme();
|
|
79
|
+
|
|
80
|
+
// Return null if no product data
|
|
81
|
+
if (!product) return null;
|
|
82
|
+
|
|
83
|
+
const getStatusIcon = (status: Product['status']) => {
|
|
84
|
+
switch (status) {
|
|
85
|
+
case 'launched':
|
|
86
|
+
return <LaunchIcon fontSize="small" />;
|
|
87
|
+
case 'beta':
|
|
88
|
+
return <PreviewIcon fontSize="small" />;
|
|
89
|
+
case 'coming-soon':
|
|
90
|
+
return <ComingSoonIcon fontSize="small" />;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const getStatusColor = (status: Product['status']) => {
|
|
95
|
+
switch (status) {
|
|
96
|
+
default:
|
|
97
|
+
case 'launched':
|
|
98
|
+
return theme.palette.success.main;
|
|
99
|
+
case 'beta':
|
|
100
|
+
return theme.palette.warning.main;
|
|
101
|
+
case 'coming-soon':
|
|
102
|
+
return theme.palette.grey[500];
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const handleProductClick = () => {
|
|
107
|
+
if (onClick) {
|
|
108
|
+
onClick();
|
|
109
|
+
} else if (product.status === 'launched' && product.url?.startsWith('http')) {
|
|
110
|
+
window.open(product.url, '_blank', 'noopener,noreferrer');
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const getDefaultActions = (): ProductCardAction[] => {
|
|
115
|
+
const actions: ProductCardAction[] = [
|
|
116
|
+
{
|
|
117
|
+
id: 'primary',
|
|
118
|
+
label: product.status === 'launched' ? 'Launch App' :
|
|
119
|
+
product.status === 'beta' ? 'Try Beta' :
|
|
120
|
+
product.status === 'coming-soon' ? 'Coming Soon' :
|
|
121
|
+
product.status,
|
|
122
|
+
variant: 'contained',
|
|
123
|
+
color: 'primary',
|
|
124
|
+
disabled: product.status === 'coming-soon',
|
|
125
|
+
onClick: handleProductClick
|
|
126
|
+
}
|
|
127
|
+
];
|
|
128
|
+
|
|
129
|
+
if (variant === 'detailed' && product.status !== 'coming-soon') {
|
|
130
|
+
actions.push({
|
|
131
|
+
id: 'secondary',
|
|
132
|
+
label: 'Learn More',
|
|
133
|
+
variant: 'outlined',
|
|
134
|
+
color: 'primary',
|
|
135
|
+
onClick: () => window.location.hash = '#/contact'
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return actions;
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
const displayActions = actions || getDefaultActions();
|
|
143
|
+
|
|
144
|
+
const FeaturesList = () => {
|
|
145
|
+
const featuresToShow = variant === 'compact'
|
|
146
|
+
? (product.features || []).slice(0, maxFeaturesCompact)
|
|
147
|
+
: (product.features || []);
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
<Box sx={{ mb: variant === 'detailed' ? 2.5 : 2 }}>
|
|
151
|
+
<Typography
|
|
152
|
+
variant="h6"
|
|
153
|
+
component="h4"
|
|
154
|
+
sx={{
|
|
155
|
+
mb: 1.5,
|
|
156
|
+
fontSize: '1.1rem',
|
|
157
|
+
fontWeight: 600
|
|
158
|
+
}}
|
|
159
|
+
>
|
|
160
|
+
Key Features:
|
|
161
|
+
</Typography>
|
|
162
|
+
<Box component="ul" sx={{
|
|
163
|
+
m: 0,
|
|
164
|
+
p: 0,
|
|
165
|
+
listStyle: 'none'
|
|
166
|
+
}}>
|
|
167
|
+
{featuresToShow.map((feature, index) => (
|
|
168
|
+
<Box
|
|
169
|
+
key={index}
|
|
170
|
+
component="li"
|
|
171
|
+
sx={{
|
|
172
|
+
display: 'flex',
|
|
173
|
+
alignItems: 'flex-start',
|
|
174
|
+
mb: 0.5,
|
|
175
|
+
gap: 1.5
|
|
176
|
+
}}
|
|
177
|
+
>
|
|
178
|
+
<Box
|
|
179
|
+
sx={{
|
|
180
|
+
width: 6,
|
|
181
|
+
height: 6,
|
|
182
|
+
backgroundColor: 'primary.main',
|
|
183
|
+
borderRadius: '50%',
|
|
184
|
+
mt: 1,
|
|
185
|
+
flexShrink: 0
|
|
186
|
+
}}
|
|
187
|
+
/>
|
|
188
|
+
<Typography
|
|
189
|
+
variant="body2"
|
|
190
|
+
sx={{
|
|
191
|
+
fontSize: '0.95rem',
|
|
192
|
+
lineHeight: 1.4,
|
|
193
|
+
opacity: 0.8
|
|
194
|
+
}}
|
|
195
|
+
>
|
|
196
|
+
{feature}
|
|
197
|
+
</Typography>
|
|
198
|
+
</Box>
|
|
199
|
+
))}
|
|
200
|
+
{variant === 'compact' && (product.features || []).length > maxFeaturesCompact && (
|
|
201
|
+
<Typography
|
|
202
|
+
variant="body2"
|
|
203
|
+
color="primary"
|
|
204
|
+
sx={{
|
|
205
|
+
fontSize: '0.9rem',
|
|
206
|
+
pl: 2.5,
|
|
207
|
+
fontWeight: 500
|
|
208
|
+
}}
|
|
209
|
+
>
|
|
210
|
+
+{(product.features || []).length - maxFeaturesCompact} more features
|
|
211
|
+
</Typography>
|
|
212
|
+
)}
|
|
213
|
+
</Box>
|
|
214
|
+
</Box>
|
|
215
|
+
);
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
const TechnologiesSection = () => {
|
|
219
|
+
if (!showTechnologies || variant === 'compact') return null;
|
|
220
|
+
|
|
221
|
+
return (
|
|
222
|
+
<Box sx={{ mb: 3 }}>
|
|
223
|
+
<Typography
|
|
224
|
+
variant="h6"
|
|
225
|
+
component="h4"
|
|
226
|
+
sx={{
|
|
227
|
+
mb: 1.5,
|
|
228
|
+
fontSize: '1rem',
|
|
229
|
+
fontWeight: 600
|
|
230
|
+
}}
|
|
231
|
+
>
|
|
232
|
+
Technologies:
|
|
233
|
+
</Typography>
|
|
234
|
+
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 1 }}>
|
|
235
|
+
{product.technologies.map((tech, index) => (
|
|
236
|
+
<Chip
|
|
237
|
+
key={index}
|
|
238
|
+
label={tech}
|
|
239
|
+
variant="outlined"
|
|
240
|
+
size="small"
|
|
241
|
+
sx={{
|
|
242
|
+
fontSize: '0.8rem',
|
|
243
|
+
fontWeight: 500
|
|
244
|
+
}}
|
|
245
|
+
/>
|
|
246
|
+
))}
|
|
247
|
+
</Box>
|
|
248
|
+
</Box>
|
|
249
|
+
);
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
return (
|
|
253
|
+
<Box
|
|
254
|
+
className={styleProps.className || "product-card"}
|
|
255
|
+
onClick={htmlProps.onClick || (variant === 'compact' ? handleProductClick : undefined)}
|
|
256
|
+
sx={{
|
|
257
|
+
p: 3, // padding="large" equivalent
|
|
258
|
+
borderRadius: 3,
|
|
259
|
+
border: '1px solid',
|
|
260
|
+
borderColor: 'divider',
|
|
261
|
+
cursor: variant === 'compact' ? 'pointer' : 'default',
|
|
262
|
+
position: 'relative',
|
|
263
|
+
height: '100%',
|
|
264
|
+
display: 'flex',
|
|
265
|
+
flexDirection: 'column',
|
|
266
|
+
backgroundColor: 'background.paper',
|
|
267
|
+
transition: 'transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out',
|
|
268
|
+
'&:hover': variant === 'compact' ? {
|
|
269
|
+
transform: 'translateY(-4px)',
|
|
270
|
+
boxShadow: 8
|
|
271
|
+
} : {},
|
|
272
|
+
...(styleProps.sx || {})
|
|
273
|
+
}}
|
|
274
|
+
style={styleProps.style}
|
|
275
|
+
>
|
|
276
|
+
{/* Status Badge */}
|
|
277
|
+
<Chip
|
|
278
|
+
icon={getStatusIcon(product.status)}
|
|
279
|
+
label={product.status.replace('-', ' ')}
|
|
280
|
+
sx={{
|
|
281
|
+
position: 'absolute',
|
|
282
|
+
top: 16,
|
|
283
|
+
right: 16,
|
|
284
|
+
backgroundColor: getStatusColor(product.status),
|
|
285
|
+
color: 'white',
|
|
286
|
+
fontSize: '0.8rem',
|
|
287
|
+
fontWeight: 500,
|
|
288
|
+
textTransform: 'capitalize',
|
|
289
|
+
zIndex: 2,
|
|
290
|
+
'& .MuiChip-icon': {
|
|
291
|
+
color: 'white'
|
|
292
|
+
}
|
|
293
|
+
}}
|
|
294
|
+
/>
|
|
295
|
+
|
|
296
|
+
{/* Product Image */}
|
|
297
|
+
{showImage && product.image && (
|
|
298
|
+
<Box
|
|
299
|
+
sx={{
|
|
300
|
+
width: '100%',
|
|
301
|
+
height: variant === 'detailed' ? 240 : 200,
|
|
302
|
+
mb: 2.5,
|
|
303
|
+
borderRadius: 1,
|
|
304
|
+
overflow: 'hidden',
|
|
305
|
+
backgroundColor: 'divider'
|
|
306
|
+
}}
|
|
307
|
+
>
|
|
308
|
+
<Box
|
|
309
|
+
component="img"
|
|
310
|
+
src={product.image}
|
|
311
|
+
alt={product.name}
|
|
312
|
+
sx={{
|
|
313
|
+
width: '100%',
|
|
314
|
+
height: '100%',
|
|
315
|
+
objectFit: 'cover'
|
|
316
|
+
}}
|
|
317
|
+
onError={(e) => {
|
|
318
|
+
const target = e.target as HTMLImageElement;
|
|
319
|
+
target.style.display = 'none';
|
|
320
|
+
if (target.parentElement) {
|
|
321
|
+
target.parentElement.style.background = 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)';
|
|
322
|
+
target.parentElement.innerHTML = `<div style="display: flex; align-items: center; justify-content: center; height: 100%; color: white; font-size: 1.5rem; font-weight: bold;">${product.name}</div>`;
|
|
323
|
+
}
|
|
324
|
+
}}
|
|
325
|
+
/>
|
|
326
|
+
</Box>
|
|
327
|
+
)}
|
|
328
|
+
|
|
329
|
+
{/* Product Info */}
|
|
330
|
+
<Box sx={{ flex: 1, display: 'flex', flexDirection: 'column' }}>
|
|
331
|
+
<Box sx={{ mb: 2 }}>
|
|
332
|
+
<Typography
|
|
333
|
+
variant="h4"
|
|
334
|
+
component="h3"
|
|
335
|
+
sx={{
|
|
336
|
+
mb: 1,
|
|
337
|
+
fontSize: variant === 'detailed' ? '1.75rem' : '1.5rem',
|
|
338
|
+
fontWeight: 600
|
|
339
|
+
}}
|
|
340
|
+
>
|
|
341
|
+
{product.name}
|
|
342
|
+
</Typography>
|
|
343
|
+
<Typography
|
|
344
|
+
variant="overline"
|
|
345
|
+
sx={{
|
|
346
|
+
mb: 1.5,
|
|
347
|
+
color: 'primary.main',
|
|
348
|
+
fontSize: '0.9rem',
|
|
349
|
+
fontWeight: 500,
|
|
350
|
+
letterSpacing: '0.5px',
|
|
351
|
+
display: 'block'
|
|
352
|
+
}}
|
|
353
|
+
>
|
|
354
|
+
{product.category}
|
|
355
|
+
</Typography>
|
|
356
|
+
<Typography
|
|
357
|
+
variant="body1"
|
|
358
|
+
sx={{
|
|
359
|
+
opacity: 0.8,
|
|
360
|
+
lineHeight: 1.6
|
|
361
|
+
}}
|
|
362
|
+
>
|
|
363
|
+
{variant === 'detailed' ? product.description : (product.shortDescription || product.description)}
|
|
364
|
+
</Typography>
|
|
365
|
+
</Box>
|
|
366
|
+
|
|
367
|
+
{/* Features */}
|
|
368
|
+
<FeaturesList />
|
|
369
|
+
|
|
370
|
+
{/* Technologies */}
|
|
371
|
+
<TechnologiesSection />
|
|
372
|
+
|
|
373
|
+
{/* Action Buttons */}
|
|
374
|
+
<Box sx={{
|
|
375
|
+
display: 'flex',
|
|
376
|
+
gap: 1.5,
|
|
377
|
+
mt: 'auto',
|
|
378
|
+
...(variant === 'compact' && { justifyContent: 'center' })
|
|
379
|
+
}}>
|
|
380
|
+
{displayActions.map((action) => (
|
|
381
|
+
<Button
|
|
382
|
+
key={action.id}
|
|
383
|
+
variant={action.variant || 'contained'}
|
|
384
|
+
color={action.color || 'primary'}
|
|
385
|
+
disabled={action.disabled}
|
|
386
|
+
onClick={action.onClick}
|
|
387
|
+
{...(variant === 'compact' && { fullWidth: true })}
|
|
388
|
+
>
|
|
389
|
+
{action.label}
|
|
390
|
+
</Button>
|
|
391
|
+
))}
|
|
392
|
+
</Box>
|
|
393
|
+
</Box>
|
|
394
|
+
</Box>
|
|
395
|
+
);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* ProductCard component with data binding support
|
|
400
|
+
* Supports both traditional props and dataSource-driven rendering
|
|
401
|
+
*/
|
|
402
|
+
function ProductCard(props: ProductCardProps) {
|
|
403
|
+
const { dataSource, bindingOptions, ...restProps } = props;
|
|
404
|
+
|
|
405
|
+
// Mark as QwickApp component
|
|
406
|
+
(ProductCard as any)[QWICKAPP_COMPONENT] = true;
|
|
407
|
+
|
|
408
|
+
// If no dataSource, use traditional props
|
|
409
|
+
if (!dataSource) {
|
|
410
|
+
return <ProductCardView {...restProps} />;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
// Use data binding
|
|
414
|
+
const { dataSource: _source, loading, error, cached, ...productProps } = useDataBinding<ProductCardModel>(
|
|
415
|
+
dataSource,
|
|
416
|
+
restProps as Partial<ProductCardModel>,
|
|
417
|
+
ProductCardModel.getSchema(),
|
|
418
|
+
{ cache: true, cacheTTL: 300000, strict: false, ...bindingOptions }
|
|
419
|
+
);
|
|
420
|
+
|
|
421
|
+
// Show loading state
|
|
422
|
+
if (loading) {
|
|
423
|
+
return (
|
|
424
|
+
<ProductCardView
|
|
425
|
+
{...restProps}
|
|
426
|
+
product={{
|
|
427
|
+
id: 'loading-product',
|
|
428
|
+
name: 'Loading Product...',
|
|
429
|
+
category: 'Loading',
|
|
430
|
+
description: 'Loading product information from data source',
|
|
431
|
+
shortDescription: 'Loading...',
|
|
432
|
+
features: ['Loading features...'],
|
|
433
|
+
technologies: ['Loading'],
|
|
434
|
+
status: 'coming-soon'
|
|
435
|
+
}}
|
|
436
|
+
variant={restProps.variant || 'compact'}
|
|
437
|
+
showImage={false}
|
|
438
|
+
/>
|
|
439
|
+
);
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
if (error) {
|
|
443
|
+
console.error('Error loading product card:', error);
|
|
444
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
445
|
+
return (
|
|
446
|
+
<ProductCardView
|
|
447
|
+
{...restProps}
|
|
448
|
+
product={{
|
|
449
|
+
id: 'error-product',
|
|
450
|
+
name: 'Product Loading Error',
|
|
451
|
+
category: 'Error',
|
|
452
|
+
description: error.message,
|
|
453
|
+
features: ['Unable to load product features'],
|
|
454
|
+
technologies: ['N/A'],
|
|
455
|
+
status: 'coming-soon'
|
|
456
|
+
}}
|
|
457
|
+
variant={restProps.variant || 'compact'}
|
|
458
|
+
showImage={false}
|
|
459
|
+
/>
|
|
460
|
+
);
|
|
461
|
+
}
|
|
462
|
+
return null;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
// Pass through data directly - let component handle missing properties
|
|
466
|
+
const transformedProps = productProps as ProductCardViewProps;
|
|
467
|
+
|
|
468
|
+
return <ProductCardView {...transformedProps} />;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
export default ProductCard;
|
|
472
|
+
export { ProductCard };
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Section Component - Themed, responsive section container with data binding support
|
|
3
|
+
*
|
|
4
|
+
* Enhanced with data binding support through dataSource prop.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* - Traditional: <Section background="#f5f5f5" padding="large">Content</Section>
|
|
8
|
+
* - Data-driven: <Section dataSource="pages.home.intro-section">Content</Section>
|
|
9
|
+
*
|
|
10
|
+
* Features:
|
|
11
|
+
* - Theme-aware background color (supports theme palette paths and CSS colors)
|
|
12
|
+
* - Responsive vertical spacing and max width
|
|
13
|
+
* - Semantic HTML element customization
|
|
14
|
+
* - Full CMS integration through dataSource prop
|
|
15
|
+
*
|
|
16
|
+
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { Box, Container } from '@mui/material';
|
|
20
|
+
import type { WithDataBinding } from '@qwickapps/schema';
|
|
21
|
+
import React from 'react';
|
|
22
|
+
import { QWICKAPP_COMPONENT, useBaseProps, useDataBinding, WithBaseProps } from '../../hooks';
|
|
23
|
+
import SectionModel from '../../schemas/SectionSchema';
|
|
24
|
+
import type { BreakpointValue } from '../../types';
|
|
25
|
+
import { mapToMUIBreakpoint } from '../../utils/breakpoints';
|
|
26
|
+
|
|
27
|
+
interface SectionViewProps extends WithBaseProps {
|
|
28
|
+
/** Section content */
|
|
29
|
+
children?: React.ReactNode;
|
|
30
|
+
/** Section background color */
|
|
31
|
+
background?: string;
|
|
32
|
+
/** Section text color */
|
|
33
|
+
color?: string;
|
|
34
|
+
/** Section padding/spacing */
|
|
35
|
+
padding?: 'none' | 'tiny' | 'small' | 'medium' | 'large' | 'extra-large';
|
|
36
|
+
/** Maximum content width (maps to MUI Container maxWidth) */
|
|
37
|
+
contentMaxWidth?: BreakpointValue;
|
|
38
|
+
/** HTML element type */
|
|
39
|
+
component?: 'div' | 'section' | 'article' | 'main';
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface SectionProps extends SectionViewProps, WithDataBinding {}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Core Section View component - handles section rendering
|
|
46
|
+
*/
|
|
47
|
+
function SectionView({
|
|
48
|
+
children,
|
|
49
|
+
background = 'var(--theme-surface)',
|
|
50
|
+
color = 'var(--theme-on-surface)',
|
|
51
|
+
padding = 'medium',
|
|
52
|
+
contentMaxWidth = 'lg',
|
|
53
|
+
component = 'section',
|
|
54
|
+
...restProps
|
|
55
|
+
}: SectionViewProps) {
|
|
56
|
+
const { gridProps, styleProps, htmlProps } = useBaseProps(restProps);
|
|
57
|
+
|
|
58
|
+
// Mark as QwickApp component
|
|
59
|
+
(SectionView as any)[QWICKAPP_COMPONENT] = true;
|
|
60
|
+
|
|
61
|
+
// Return empty state if no content
|
|
62
|
+
if (!children) {
|
|
63
|
+
return (
|
|
64
|
+
<Box
|
|
65
|
+
component={component}
|
|
66
|
+
{...htmlProps}
|
|
67
|
+
{...styleProps}
|
|
68
|
+
{...gridProps}
|
|
69
|
+
sx={{
|
|
70
|
+
backgroundColor: background,
|
|
71
|
+
color,
|
|
72
|
+
position: 'static',
|
|
73
|
+
py: 2,
|
|
74
|
+
px: 0,
|
|
75
|
+
...styleProps.sx,
|
|
76
|
+
}}
|
|
77
|
+
>
|
|
78
|
+
<Container
|
|
79
|
+
maxWidth={mapToMUIBreakpoint(contentMaxWidth)}
|
|
80
|
+
sx={{
|
|
81
|
+
position: 'relative',
|
|
82
|
+
textAlign: 'center',
|
|
83
|
+
opacity: 0.6,
|
|
84
|
+
...(contentMaxWidth === false && {
|
|
85
|
+
maxWidth: 'none !important',
|
|
86
|
+
px: 3,
|
|
87
|
+
}),
|
|
88
|
+
}}
|
|
89
|
+
>
|
|
90
|
+
No content provided for this section
|
|
91
|
+
</Container>
|
|
92
|
+
</Box>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Returns MUI spacing units for vertical padding based on spacing preset.
|
|
98
|
+
*/
|
|
99
|
+
const getPadding = () => {
|
|
100
|
+
switch (padding) {
|
|
101
|
+
case 'none':
|
|
102
|
+
return 0;
|
|
103
|
+
case 'tiny':
|
|
104
|
+
return { py: 1, px: 0 }; // 8px bottom only (avoiding double spacing)
|
|
105
|
+
case 'small':
|
|
106
|
+
return { py: 2, px: 0 }; // 16px vertical, no horizontal (Container handles)
|
|
107
|
+
case 'medium':
|
|
108
|
+
return { py: 4, px: 0 }; // 32px vertical
|
|
109
|
+
case 'large':
|
|
110
|
+
return { py: 8, px: 0 }; // 64px vertical
|
|
111
|
+
case 'extra-large':
|
|
112
|
+
return { py: 12, px: 0 }; // 96px vertical
|
|
113
|
+
default:
|
|
114
|
+
return { py: 4, px: 0 }; // Default to medium if unknown
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
return (
|
|
119
|
+
<Box
|
|
120
|
+
component={component}
|
|
121
|
+
{...htmlProps}
|
|
122
|
+
{...styleProps}
|
|
123
|
+
{...gridProps}
|
|
124
|
+
sx={{
|
|
125
|
+
backgroundColor: background,
|
|
126
|
+
color,
|
|
127
|
+
position: 'static',
|
|
128
|
+
...getPadding(),
|
|
129
|
+
...styleProps.sx,
|
|
130
|
+
}}
|
|
131
|
+
>
|
|
132
|
+
{/* Content Container */}
|
|
133
|
+
<Container
|
|
134
|
+
maxWidth={mapToMUIBreakpoint(contentMaxWidth)}
|
|
135
|
+
sx={{
|
|
136
|
+
position: 'relative',
|
|
137
|
+
...(contentMaxWidth === false && {
|
|
138
|
+
maxWidth: 'none !important',
|
|
139
|
+
px: 3, // Add some padding when no max width
|
|
140
|
+
}),
|
|
141
|
+
}}
|
|
142
|
+
>
|
|
143
|
+
{children}
|
|
144
|
+
</Container>
|
|
145
|
+
</Box>
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Main component with data binding support
|
|
150
|
+
function Section(props: SectionProps) {
|
|
151
|
+
const { dataSource, bindingOptions, ...restProps } = props;
|
|
152
|
+
|
|
153
|
+
// If no dataSource, use traditional props
|
|
154
|
+
if (!dataSource) {
|
|
155
|
+
return <SectionView {...restProps} />;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Use data binding
|
|
159
|
+
const { dataSource: _source, loading, error, cached, ...sectionProps } = useDataBinding<SectionModel>(
|
|
160
|
+
dataSource,
|
|
161
|
+
restProps as Partial<SectionModel>,
|
|
162
|
+
SectionModel.getSchema(),
|
|
163
|
+
{ cache: true, cacheTTL: 300000, strict: false, ...bindingOptions }
|
|
164
|
+
);
|
|
165
|
+
|
|
166
|
+
// Show loading state
|
|
167
|
+
if (loading) {
|
|
168
|
+
return (
|
|
169
|
+
<Box
|
|
170
|
+
component="section"
|
|
171
|
+
sx={{
|
|
172
|
+
backgroundColor: 'var(--theme-surface)',
|
|
173
|
+
py: 4,
|
|
174
|
+
px: 0,
|
|
175
|
+
}}
|
|
176
|
+
>
|
|
177
|
+
<Container maxWidth="lg" sx={{ textAlign: 'center' }}>
|
|
178
|
+
<div>Loading Section...</div>
|
|
179
|
+
</Container>
|
|
180
|
+
</Box>
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (error) {
|
|
185
|
+
console.error('Error loading section:', error);
|
|
186
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
187
|
+
return (
|
|
188
|
+
<Box
|
|
189
|
+
component="section"
|
|
190
|
+
sx={{
|
|
191
|
+
backgroundColor: 'var(--theme-surface)',
|
|
192
|
+
py: 4,
|
|
193
|
+
px: 0,
|
|
194
|
+
border: '1px solid red'
|
|
195
|
+
}}
|
|
196
|
+
>
|
|
197
|
+
<Container maxWidth="lg" sx={{ textAlign: 'center' }}>
|
|
198
|
+
<div>Error Loading Section: {error.message}</div>
|
|
199
|
+
</Container>
|
|
200
|
+
</Box>
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
return <SectionView {...sectionProps} />;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export default Section;
|