@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,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provides a set of standardized blocks for consistent layout and styling.
|
|
3
|
+
*
|
|
4
|
+
* Includes:
|
|
5
|
+
* - Hero blocks
|
|
6
|
+
* - Content
|
|
7
|
+
* - Page headers
|
|
8
|
+
* - Feature grids
|
|
9
|
+
* - Sections with responsive design
|
|
10
|
+
* - Footer blocks
|
|
11
|
+
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
12
|
+
*/
|
|
13
|
+
export { default as HeroBlock } from './HeroBlock';
|
|
14
|
+
export { default as Code } from './Code';
|
|
15
|
+
export { default as Article } from './Article';
|
|
16
|
+
export { default as Content } from './Content';
|
|
17
|
+
export { default as PageBannerHeader } from './PageBannerHeader';
|
|
18
|
+
export { default as CoverImageHeader } from './CoverImageHeader';
|
|
19
|
+
export { default as FeatureGrid } from './FeatureGrid';
|
|
20
|
+
export { default as Footer } from './Footer';
|
|
21
|
+
export { default as Section } from './Section';
|
|
22
|
+
export { default as ProductCard } from './ProductCard';
|
|
23
|
+
export { default as FeatureCard } from './FeatureCard';
|
|
24
|
+
export { default as CardListGrid } from './CardListGrid';
|
|
25
|
+
|
|
26
|
+
export type { HeroBlockProps } from './HeroBlock';
|
|
27
|
+
export type { CodeProps } from './Code';
|
|
28
|
+
export type { ArticleProps } from './Article';
|
|
29
|
+
export type { ContentProps } from './Content';
|
|
30
|
+
export type { PageBannerHeaderProps } from './PageBannerHeader';
|
|
31
|
+
export type { CoverImageHeaderProps, HeaderAction } from './CoverImageHeader';
|
|
32
|
+
export type { FeatureGridProps, FeatureItem as FeatureGridItem } from './FeatureGrid';
|
|
33
|
+
export type { FooterProps } from './Footer';
|
|
34
|
+
export type { SectionProps } from './Section';
|
|
35
|
+
export type { ProductCardProps, Product, ProductCardAction } from './ProductCard';
|
|
36
|
+
export type { FeatureCardProps, FeatureItem, FeatureCardAction } from './FeatureCard';
|
|
37
|
+
export type { CardListGridProps } from './CardListGrid';
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Button - Enhanced button component with comprehensive features
|
|
3
|
+
*
|
|
4
|
+
* A QwickApps-enhanced version of Material-UI Button with:
|
|
5
|
+
* - Standardized dimension and spacing props
|
|
6
|
+
* - Grid behavior support for ColumnLayout
|
|
7
|
+
* - Custom variants and styling
|
|
8
|
+
* - Loading states with spinner
|
|
9
|
+
* - Link support (href prop)
|
|
10
|
+
* - Icon support
|
|
11
|
+
* - Consistent theming and styling
|
|
12
|
+
* - Data binding support for dynamic content
|
|
13
|
+
*
|
|
14
|
+
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import React from 'react';
|
|
18
|
+
import { Button as MuiButton, ButtonProps as MuiButtonProps, CircularProgress, Paper, Typography } from '@mui/material';
|
|
19
|
+
import type { WithDataBinding, ModelProps } from '@qwickapps/schema';
|
|
20
|
+
import { QWICKAPP_COMPONENT, useBaseProps } from '../../hooks';
|
|
21
|
+
import { useDataBinding } from '../../hooks';
|
|
22
|
+
import ButtonModel from '../../schemas/ButtonSchema';
|
|
23
|
+
|
|
24
|
+
type ButtonViewProps = ModelProps<ButtonModel> & {
|
|
25
|
+
/** Icon to display (before text) */
|
|
26
|
+
icon?: React.ReactNode;
|
|
27
|
+
/** Icon to display after text */
|
|
28
|
+
endIcon?: React.ReactNode;
|
|
29
|
+
/** Event handler for clicks */
|
|
30
|
+
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
31
|
+
/** Button content when using children */
|
|
32
|
+
children?: React.ReactNode;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export interface ButtonProps extends ButtonViewProps, WithDataBinding {}
|
|
36
|
+
|
|
37
|
+
// View component - handles the actual rendering
|
|
38
|
+
const ButtonView = React.forwardRef<HTMLButtonElement, ButtonViewProps>((props, ref) => {
|
|
39
|
+
const {
|
|
40
|
+
label,
|
|
41
|
+
variant = 'primary',
|
|
42
|
+
buttonSize = 'medium',
|
|
43
|
+
icon,
|
|
44
|
+
endIcon,
|
|
45
|
+
href,
|
|
46
|
+
target = '_self',
|
|
47
|
+
onClick,
|
|
48
|
+
disabled = false,
|
|
49
|
+
loading = false,
|
|
50
|
+
fullWidth = false,
|
|
51
|
+
children,
|
|
52
|
+
...restProps
|
|
53
|
+
} = props;
|
|
54
|
+
|
|
55
|
+
const { styleProps, htmlProps, restProps: otherProps } = useBaseProps(restProps);
|
|
56
|
+
|
|
57
|
+
// Map our variants to MUI variants
|
|
58
|
+
const getMuiVariant = (): MuiButtonProps['variant'] => {
|
|
59
|
+
switch (variant) {
|
|
60
|
+
case 'primary':
|
|
61
|
+
return 'contained';
|
|
62
|
+
case 'secondary':
|
|
63
|
+
return 'contained';
|
|
64
|
+
case 'outlined':
|
|
65
|
+
return 'outlined';
|
|
66
|
+
case 'text':
|
|
67
|
+
return 'text';
|
|
68
|
+
case 'contained':
|
|
69
|
+
return 'contained';
|
|
70
|
+
default:
|
|
71
|
+
return 'contained';
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
// Map our variants to MUI colors
|
|
76
|
+
const getMuiColor = (): MuiButtonProps['color'] => {
|
|
77
|
+
switch (variant) {
|
|
78
|
+
case 'primary':
|
|
79
|
+
return 'primary';
|
|
80
|
+
case 'secondary':
|
|
81
|
+
return 'secondary';
|
|
82
|
+
case 'outlined':
|
|
83
|
+
return 'primary';
|
|
84
|
+
case 'text':
|
|
85
|
+
return 'primary';
|
|
86
|
+
case 'contained':
|
|
87
|
+
return 'primary';
|
|
88
|
+
default:
|
|
89
|
+
return 'primary';
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
// Determine if this should be a link
|
|
94
|
+
const isLink = Boolean(href && !disabled && !loading);
|
|
95
|
+
|
|
96
|
+
// Base button props
|
|
97
|
+
const baseProps: Partial<MuiButtonProps> = {
|
|
98
|
+
variant: getMuiVariant(),
|
|
99
|
+
color: getMuiColor(),
|
|
100
|
+
size: buttonSize,
|
|
101
|
+
disabled: disabled || loading,
|
|
102
|
+
fullWidth,
|
|
103
|
+
...htmlProps,
|
|
104
|
+
...styleProps,
|
|
105
|
+
sx: {
|
|
106
|
+
// Ensure consistent text transform
|
|
107
|
+
textTransform: 'none',
|
|
108
|
+
// Loading state adjustments
|
|
109
|
+
...(loading && {
|
|
110
|
+
'& .MuiButton-startIcon': {
|
|
111
|
+
marginRight: 1,
|
|
112
|
+
},
|
|
113
|
+
}),
|
|
114
|
+
...styleProps.sx,
|
|
115
|
+
},
|
|
116
|
+
startIcon: loading ? (
|
|
117
|
+
<CircularProgress
|
|
118
|
+
size={16}
|
|
119
|
+
color="inherit"
|
|
120
|
+
aria-label="Loading"
|
|
121
|
+
/>
|
|
122
|
+
) : icon,
|
|
123
|
+
endIcon: loading ? undefined : endIcon,
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
// Link-specific props
|
|
127
|
+
if (isLink) {
|
|
128
|
+
const linkProps = {
|
|
129
|
+
...baseProps,
|
|
130
|
+
component: 'a' as const,
|
|
131
|
+
href,
|
|
132
|
+
target,
|
|
133
|
+
rel: target === '_blank' ? 'noopener noreferrer' : undefined,
|
|
134
|
+
onClick: undefined, // Links don't use onClick
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
return (
|
|
138
|
+
<MuiButton ref={ref} {...linkProps}>
|
|
139
|
+
{label || children}
|
|
140
|
+
</MuiButton>
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Button-specific props
|
|
145
|
+
const buttonProps = {
|
|
146
|
+
...baseProps,
|
|
147
|
+
onClick: disabled || loading ? undefined : onClick,
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
return (
|
|
151
|
+
<MuiButton ref={ref} {...buttonProps}>
|
|
152
|
+
{label || children}
|
|
153
|
+
</MuiButton>
|
|
154
|
+
);
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
ButtonView.displayName = 'ButtonView';
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Button component with data binding support
|
|
161
|
+
* Supports both traditional props and dataSource-driven rendering
|
|
162
|
+
*/
|
|
163
|
+
function Button(props: ButtonProps) {
|
|
164
|
+
const { dataSource, bindingOptions, ...restProps } = props;
|
|
165
|
+
|
|
166
|
+
// If no dataSource, use traditional props
|
|
167
|
+
if (!dataSource) {
|
|
168
|
+
return <ButtonView {...restProps} />;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// Use data binding
|
|
172
|
+
const bindingResult = useDataBinding<ButtonModel>(
|
|
173
|
+
dataSource,
|
|
174
|
+
restProps as Partial<ButtonModel>,
|
|
175
|
+
ButtonModel.getSchema(),
|
|
176
|
+
{ cache: true, cacheTTL: 300000, strict: false, ...bindingOptions }
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
// Check if we're still loading data using the metadata properties
|
|
180
|
+
const bindingLoading = bindingResult.$loading;
|
|
181
|
+
|
|
182
|
+
// Extract all the actual button properties (excluding metadata)
|
|
183
|
+
const { dataSource: _source, $loading, $error, $dataSource, $cached, cached, ...buttonProps } = bindingResult;
|
|
184
|
+
const error = bindingResult.$error;
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
// Show loading state while fetching data
|
|
188
|
+
if (bindingLoading) {
|
|
189
|
+
return (
|
|
190
|
+
<Paper
|
|
191
|
+
variant="outlined"
|
|
192
|
+
sx={{
|
|
193
|
+
p: 2,
|
|
194
|
+
textAlign: 'center'
|
|
195
|
+
}}
|
|
196
|
+
>
|
|
197
|
+
<Typography variant="body2">Loading Button...</Typography>
|
|
198
|
+
<Typography variant="caption" color="text.secondary">
|
|
199
|
+
Loading button configuration from data source...
|
|
200
|
+
</Typography>
|
|
201
|
+
</Paper>
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
if (error) {
|
|
206
|
+
console.error('Error loading button:', error);
|
|
207
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
208
|
+
return (
|
|
209
|
+
<Paper
|
|
210
|
+
variant="outlined"
|
|
211
|
+
sx={{
|
|
212
|
+
p: 2,
|
|
213
|
+
textAlign: 'center',
|
|
214
|
+
borderColor: 'error.main'
|
|
215
|
+
}}
|
|
216
|
+
>
|
|
217
|
+
<Typography variant="body2" color="error">
|
|
218
|
+
Error loading button: {error.message}
|
|
219
|
+
</Typography>
|
|
220
|
+
</Paper>
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
return null;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
return <ButtonView {...buttonProps} />;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// Mark as QwickApp component
|
|
230
|
+
(Button as any)[QWICKAPP_COMPONENT] = true;
|
|
231
|
+
|
|
232
|
+
export { Button };
|
|
233
|
+
export default Button;
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PaletteSwitcher - Color palette switching control component
|
|
3
|
+
*
|
|
4
|
+
* Provides consistent palette switching with:
|
|
5
|
+
* - Visual palette preview icons
|
|
6
|
+
* - Tooltip with current palette name
|
|
7
|
+
* - Menu-based palette selection
|
|
8
|
+
* - Active palette indicators
|
|
9
|
+
* - Configurable display options
|
|
10
|
+
*
|
|
11
|
+
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import {
|
|
15
|
+
Palette as PaletteIcon,
|
|
16
|
+
Circle as CircleIcon,
|
|
17
|
+
} from '@mui/icons-material';
|
|
18
|
+
import {
|
|
19
|
+
IconButton,
|
|
20
|
+
Menu,
|
|
21
|
+
MenuItem,
|
|
22
|
+
ListItemIcon,
|
|
23
|
+
ListItemText,
|
|
24
|
+
Tooltip,
|
|
25
|
+
Box,
|
|
26
|
+
Typography,
|
|
27
|
+
Paper,
|
|
28
|
+
} from '@mui/material';
|
|
29
|
+
import React, { useState } from 'react';
|
|
30
|
+
import type { WithDataBinding, ModelProps } from '@qwickapps/schema';
|
|
31
|
+
import { QWICKAPP_COMPONENT, useBaseProps } from '../../hooks';
|
|
32
|
+
import { useDataBinding } from '../../hooks';
|
|
33
|
+
import { usePalette } from '../../contexts';
|
|
34
|
+
import type { PaletteConfig } from '../../contexts';
|
|
35
|
+
import PaletteSwitcherModel from '../../schemas/PaletteSwitcherSchema';
|
|
36
|
+
|
|
37
|
+
type PaletteSwitcherViewProps = ModelProps<PaletteSwitcherModel>;
|
|
38
|
+
|
|
39
|
+
export interface PaletteSwitcherProps extends PaletteSwitcherViewProps, WithDataBinding {}
|
|
40
|
+
|
|
41
|
+
// View component - handles the actual rendering
|
|
42
|
+
function PaletteSwitcherView({
|
|
43
|
+
disabled = false,
|
|
44
|
+
buttonSize = 'medium',
|
|
45
|
+
tooltipText,
|
|
46
|
+
showActiveBadge = true,
|
|
47
|
+
showDescriptions = true,
|
|
48
|
+
...restProps
|
|
49
|
+
}: PaletteSwitcherViewProps) {
|
|
50
|
+
const { styleProps, htmlProps } = useBaseProps(restProps);
|
|
51
|
+
const { currentPalette, setPreferredPalette, availablePalettes } = usePalette();
|
|
52
|
+
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
|
|
53
|
+
const open = Boolean(anchorEl);
|
|
54
|
+
|
|
55
|
+
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
|
56
|
+
setAnchorEl(event.currentTarget);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const handleClose = () => {
|
|
60
|
+
setAnchorEl(null);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const handlePaletteSelect = (paletteId: string) => {
|
|
64
|
+
setPreferredPalette(paletteId);
|
|
65
|
+
handleClose();
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const getPaletteIcon = (palette: PaletteConfig): React.ReactNode => {
|
|
69
|
+
const isSelected = palette.id === currentPalette;
|
|
70
|
+
return (
|
|
71
|
+
<CircleIcon
|
|
72
|
+
fontSize="small"
|
|
73
|
+
sx={{
|
|
74
|
+
color: palette.primaryColor,
|
|
75
|
+
filter: isSelected
|
|
76
|
+
? 'drop-shadow(0 0 3px currentColor) brightness(1.2)'
|
|
77
|
+
: 'none',
|
|
78
|
+
transform: isSelected ? 'scale(1.1)' : 'scale(1)',
|
|
79
|
+
transition: 'all 0.2s ease-in-out'
|
|
80
|
+
}}
|
|
81
|
+
/>
|
|
82
|
+
);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const getCurrentPalette = (): PaletteConfig => {
|
|
86
|
+
return availablePalettes.find(p => p.id === currentPalette) || availablePalettes[0];
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
// If no palettes available, return empty state
|
|
90
|
+
if (!availablePalettes || availablePalettes.length === 0) {
|
|
91
|
+
return (
|
|
92
|
+
<Paper
|
|
93
|
+
{...htmlProps}
|
|
94
|
+
{...styleProps}
|
|
95
|
+
variant="outlined"
|
|
96
|
+
sx={{
|
|
97
|
+
p: 2,
|
|
98
|
+
textAlign: 'center',
|
|
99
|
+
opacity: 0.6,
|
|
100
|
+
...styleProps.sx
|
|
101
|
+
}}
|
|
102
|
+
>
|
|
103
|
+
<Typography variant="body2" color="text.secondary">
|
|
104
|
+
No color palettes available
|
|
105
|
+
</Typography>
|
|
106
|
+
</Paper>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const defaultTooltipText = `Switch color palette (current: ${getCurrentPalette().name})`;
|
|
111
|
+
|
|
112
|
+
return (
|
|
113
|
+
<Box {...htmlProps} {...styleProps}>
|
|
114
|
+
<Tooltip title={tooltipText || defaultTooltipText}>
|
|
115
|
+
<IconButton
|
|
116
|
+
onClick={handleClick}
|
|
117
|
+
disabled={disabled}
|
|
118
|
+
size={buttonSize}
|
|
119
|
+
aria-label="palette switcher"
|
|
120
|
+
aria-controls={open ? 'palette-menu' : undefined}
|
|
121
|
+
aria-haspopup="true"
|
|
122
|
+
aria-expanded={open ? 'true' : undefined}
|
|
123
|
+
sx={{
|
|
124
|
+
color: 'var(--theme-on-surface, inherit)',
|
|
125
|
+
'&:hover': {
|
|
126
|
+
backgroundColor: 'var(--menu-hover, rgba(0, 0, 0, 0.04))',
|
|
127
|
+
},
|
|
128
|
+
}}
|
|
129
|
+
>
|
|
130
|
+
<PaletteIcon />
|
|
131
|
+
</IconButton>
|
|
132
|
+
</Tooltip>
|
|
133
|
+
|
|
134
|
+
<Menu
|
|
135
|
+
id="palette-menu"
|
|
136
|
+
anchorEl={anchorEl}
|
|
137
|
+
open={open}
|
|
138
|
+
onClose={handleClose}
|
|
139
|
+
slotProps={{
|
|
140
|
+
paper: {
|
|
141
|
+
'aria-labelledby': 'palette-button',
|
|
142
|
+
},
|
|
143
|
+
}}
|
|
144
|
+
anchorOrigin={{
|
|
145
|
+
vertical: 'bottom',
|
|
146
|
+
horizontal: 'right',
|
|
147
|
+
}}
|
|
148
|
+
transformOrigin={{
|
|
149
|
+
vertical: 'top',
|
|
150
|
+
horizontal: 'right',
|
|
151
|
+
}}
|
|
152
|
+
>
|
|
153
|
+
{availablePalettes.map((palette) => (
|
|
154
|
+
<MenuItem
|
|
155
|
+
key={palette.id}
|
|
156
|
+
onClick={() => handlePaletteSelect(palette.id)}
|
|
157
|
+
selected={currentPalette === palette.id}
|
|
158
|
+
sx={{
|
|
159
|
+
'&:hover': {
|
|
160
|
+
backgroundColor: 'action.hover',
|
|
161
|
+
},
|
|
162
|
+
'&.Mui-selected': {
|
|
163
|
+
backgroundColor: 'action.selected',
|
|
164
|
+
'&:hover': {
|
|
165
|
+
backgroundColor: 'action.selected',
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
}}
|
|
169
|
+
>
|
|
170
|
+
<ListItemIcon>
|
|
171
|
+
{getPaletteIcon(palette)}
|
|
172
|
+
</ListItemIcon>
|
|
173
|
+
<ListItemText
|
|
174
|
+
primary={
|
|
175
|
+
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
|
|
176
|
+
{palette.name}
|
|
177
|
+
{showActiveBadge && currentPalette === palette.id && (
|
|
178
|
+
<Box
|
|
179
|
+
component="span"
|
|
180
|
+
sx={{
|
|
181
|
+
fontSize: '0.75rem',
|
|
182
|
+
px: 1,
|
|
183
|
+
py: 0.25,
|
|
184
|
+
borderRadius: 1,
|
|
185
|
+
backgroundColor: 'primary.main',
|
|
186
|
+
color: 'primary.contrastText',
|
|
187
|
+
}}
|
|
188
|
+
>
|
|
189
|
+
Active
|
|
190
|
+
</Box>
|
|
191
|
+
)}
|
|
192
|
+
</Box>
|
|
193
|
+
}
|
|
194
|
+
secondary={showDescriptions ? palette.description : undefined}
|
|
195
|
+
/>
|
|
196
|
+
</MenuItem>
|
|
197
|
+
))}
|
|
198
|
+
</Menu>
|
|
199
|
+
</Box>
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* PaletteSwitcher component with data binding support
|
|
205
|
+
* Supports both traditional props and dataSource-driven rendering
|
|
206
|
+
*/
|
|
207
|
+
function PaletteSwitcher(props: PaletteSwitcherProps) {
|
|
208
|
+
const { dataSource, bindingOptions, ...restProps } = props;
|
|
209
|
+
|
|
210
|
+
// If no dataSource, use traditional props
|
|
211
|
+
if (!dataSource) {
|
|
212
|
+
return <PaletteSwitcherView {...restProps} />;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// Use data binding
|
|
216
|
+
const { dataSource: _source, loading, error, cached, ...paletteSwitcherProps } = useDataBinding<PaletteSwitcherModel>(
|
|
217
|
+
dataSource,
|
|
218
|
+
restProps as Partial<PaletteSwitcherModel>,
|
|
219
|
+
PaletteSwitcherModel.getSchema(),
|
|
220
|
+
{ cache: true, cacheTTL: 300000, strict: false, ...bindingOptions }
|
|
221
|
+
);
|
|
222
|
+
|
|
223
|
+
// Show loading state
|
|
224
|
+
if (loading) {
|
|
225
|
+
return (
|
|
226
|
+
<Paper
|
|
227
|
+
variant="outlined"
|
|
228
|
+
sx={{
|
|
229
|
+
p: 2,
|
|
230
|
+
textAlign: 'center'
|
|
231
|
+
}}
|
|
232
|
+
>
|
|
233
|
+
<Typography variant="body2">Loading PaletteSwitcher...</Typography>
|
|
234
|
+
<Typography variant="caption" color="text.secondary">
|
|
235
|
+
Loading palette switcher from data source...
|
|
236
|
+
</Typography>
|
|
237
|
+
</Paper>
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if (error) {
|
|
242
|
+
console.error('Error loading palette switcher:', error);
|
|
243
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
244
|
+
return (
|
|
245
|
+
<Paper
|
|
246
|
+
variant="outlined"
|
|
247
|
+
sx={{
|
|
248
|
+
p: 2,
|
|
249
|
+
textAlign: 'center',
|
|
250
|
+
borderColor: 'error.main'
|
|
251
|
+
}}
|
|
252
|
+
>
|
|
253
|
+
<Typography variant="body2" color="error">
|
|
254
|
+
Error loading palette switcher: {error.message}
|
|
255
|
+
</Typography>
|
|
256
|
+
</Paper>
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
return null;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
return <PaletteSwitcherView {...paletteSwitcherProps} />;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// Mark as QwickApp component
|
|
266
|
+
(PaletteSwitcher as any)[QWICKAPP_COMPONENT] = true;
|
|
267
|
+
|
|
268
|
+
export default PaletteSwitcher;
|