@fluid-app/portal-widgets 0.1.17 → 0.1.19

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.
Files changed (40) hide show
  1. package/dist/{CarouselWidget-BJvLjY7H.mjs → CarouselWidget-MOGejQHD.mjs} +24 -6
  2. package/dist/{CarouselWidget-BJvLjY7H.mjs.map → CarouselWidget-MOGejQHD.mjs.map} +1 -1
  3. package/dist/{CarouselWidget-Bdn0LVXT.cjs → CarouselWidget-PEm6vktC.cjs} +24 -6
  4. package/dist/{CarouselWidget-Bdn0LVXT.cjs.map → CarouselWidget-PEm6vktC.cjs.map} +1 -1
  5. package/dist/{ChartWidget-B3GcdLqH.mjs → ChartWidget-7jEGoije.mjs} +1 -4
  6. package/dist/{ChartWidget-B3GcdLqH.mjs.map → ChartWidget-7jEGoije.mjs.map} +1 -1
  7. package/dist/{ChartWidget-DQB7K6S0.cjs → ChartWidget-aspz2XF6.cjs} +1 -4
  8. package/dist/{ChartWidget-DQB7K6S0.cjs.map → ChartWidget-aspz2XF6.cjs.map} +1 -1
  9. package/dist/{EmbedWidget-mv5ce32s.cjs → EmbedWidget-BENxbwxX.cjs} +1 -4
  10. package/dist/{EmbedWidget-mv5ce32s.cjs.map → EmbedWidget-BENxbwxX.cjs.map} +1 -1
  11. package/dist/{EmbedWidget-ChLVA_9a.mjs → EmbedWidget-RuCm5uOj.mjs} +1 -4
  12. package/dist/{EmbedWidget-ChLVA_9a.mjs.map → EmbedWidget-RuCm5uOj.mjs.map} +1 -1
  13. package/dist/{ImageWidget-DMubcgat.mjs → ImageWidget--owpCpb0.mjs} +1 -4
  14. package/dist/{ImageWidget-DMubcgat.mjs.map → ImageWidget--owpCpb0.mjs.map} +1 -1
  15. package/dist/{ImageWidget-DFt4mJJx.cjs → ImageWidget-B2stGyqB.cjs} +1 -4
  16. package/dist/{ImageWidget-DFt4mJJx.cjs.map → ImageWidget-B2stGyqB.cjs.map} +1 -1
  17. package/dist/{NestedWidget-CNkwGwhM.mjs → NestedWidget-BaRb7Z5r.mjs} +1 -4
  18. package/dist/{NestedWidget-CNkwGwhM.mjs.map → NestedWidget-BaRb7Z5r.mjs.map} +1 -1
  19. package/dist/{NestedWidget-ofk9O-t1.cjs → NestedWidget-Dbo3dXEi.cjs} +1 -4
  20. package/dist/{NestedWidget-ofk9O-t1.cjs.map → NestedWidget-Dbo3dXEi.cjs.map} +1 -1
  21. package/dist/{SpacerWidget-Bgz6701y.cjs → SpacerWidget-BFboILmz.cjs} +25 -7
  22. package/dist/{SpacerWidget-Bgz6701y.cjs.map → SpacerWidget-BFboILmz.cjs.map} +1 -1
  23. package/dist/{SpacerWidget-DHGoW6eu.mjs → SpacerWidget-Cc0IuKda.mjs} +25 -7
  24. package/dist/{SpacerWidget-DHGoW6eu.mjs.map → SpacerWidget-Cc0IuKda.mjs.map} +1 -1
  25. package/dist/{TableWidget--yLJTqoW.mjs → TableWidget-DqAN_2sf.mjs} +19 -12
  26. package/dist/TableWidget-DqAN_2sf.mjs.map +1 -0
  27. package/dist/{TableWidget-TfQfFHft.cjs → TableWidget-iS_DwHOX.cjs} +19 -12
  28. package/dist/TableWidget-iS_DwHOX.cjs.map +1 -0
  29. package/dist/{VideoWidget-SODAPZO4.cjs → VideoWidget-D3Fw1jZE.cjs} +1 -4
  30. package/dist/{VideoWidget-SODAPZO4.cjs.map → VideoWidget-D3Fw1jZE.cjs.map} +1 -1
  31. package/dist/{VideoWidget-D6C_jHOF.mjs → VideoWidget-D_1kluGw.mjs} +1 -4
  32. package/dist/VideoWidget-D_1kluGw.mjs.map +1 -0
  33. package/dist/widgets/index.cjs +16 -16
  34. package/dist/widgets/index.d.cts.map +1 -1
  35. package/dist/widgets/index.d.mts.map +1 -1
  36. package/dist/widgets/index.mjs +16 -16
  37. package/package.json +3 -3
  38. package/dist/TableWidget--yLJTqoW.mjs.map +0 -1
  39. package/dist/TableWidget-TfQfFHft.cjs.map +0 -1
  40. package/dist/VideoWidget-D6C_jHOF.mjs.map +0 -1
@@ -252,9 +252,30 @@ const carouselWidgetPropertySchema = {
252
252
  {
253
253
  key: "textWidth",
254
254
  label: "Content Width",
255
- type: "text",
256
- description: "Maximum width for slide content (e.g., 100%, 50%, 600px)",
255
+ type: "cssUnit",
256
+ description: "Maximum width for slide content",
257
257
  defaultValue: "100%",
258
+ allowedUnits: [
259
+ "px",
260
+ "rem",
261
+ "%"
262
+ ],
263
+ defaultUnit: "%",
264
+ minByUnit: {
265
+ px: 50,
266
+ rem: 3,
267
+ "%": 10
268
+ },
269
+ maxByUnit: {
270
+ px: 1200,
271
+ rem: 75,
272
+ "%": 100
273
+ },
274
+ stepByUnit: {
275
+ px: 10,
276
+ rem: 1,
277
+ "%": 1
278
+ },
258
279
  tab: "styling",
259
280
  group: "Layout"
260
281
  },
@@ -262,9 +283,6 @@ const carouselWidgetPropertySchema = {
262
283
  key: "carouselHeight",
263
284
  label: "Carousel Height",
264
285
  description: "Height of the carousel",
265
- min: 100,
266
- max: 1200,
267
- step: 10,
268
286
  defaultValue: "400px",
269
287
  tab: "styling",
270
288
  group: "Design"
@@ -433,4 +451,4 @@ const carouselWidgetPropertySchema = {
433
451
  //#endregion
434
452
  export { CarouselWidget_exports as n, carouselWidgetPropertySchema as r, CarouselWidget as t };
435
453
 
436
- //# sourceMappingURL=CarouselWidget-BJvLjY7H.mjs.map
454
+ //# sourceMappingURL=CarouselWidget-MOGejQHD.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"CarouselWidget-BJvLjY7H.mjs","names":["getBorderRadiusField"],"sources":["../src/widgets/CarouselWidget.tsx"],"sourcesContent":["import DOMPurify from \"dompurify\";\nimport { Button } from \"@fluid-app/ui-primitives\";\nimport { ScrollArrows } from \"../ui/scroll-arrows\";\nimport type { ComponentProps } from \"react\";\nimport { useEffect, useState, useCallback } from \"react\";\nimport type React from \"react\";\nimport {\n MediaRenderer,\n getMediaPropsFromWidgetSchema,\n} from \"../components/MediaRenderer\";\nimport type {\n WidgetSchema,\n BorderRadiusOptions,\n ColorOptions,\n AlignOptions,\n FontSizeOptions,\n PaddingOptions,\n ButtonSizeOptions,\n} from \"@fluid-app/portal-core/types\";\nimport {\n getHeightField,\n type WidgetPropertySchema,\n} from \"@fluid-app/portal-core/registries\";\nimport {\n getBorderRadiusField,\n getColorField,\n getFontSizeField,\n getPaddingField,\n getButtonSizeField,\n} from \"../core/fields\";\n\nconst DEFAULT_SLIDES: CarouselSlide[] = [];\n\ntype CarouselSlide = {\n id: string;\n content: WidgetSchema;\n title?: string;\n description?: string;\n buttonEnabled?: boolean;\n buttonText?: string;\n buttonVariant?:\n | \"default\"\n | \"secondary\"\n | \"outline\"\n | \"destructive\"\n | \"ghost\"\n | \"link\";\n buttonLink?: string;\n};\n\ntype CarouselWidgetProps = ComponentProps<\"div\"> & {\n slides?: CarouselSlide[];\n autoScrollInterval?: number;\n enableAutoScroll?: boolean;\n\n // Layout\n align?: AlignOptions;\n carouselHeight?: string;\n borderRadius?: BorderRadiusOptions;\n padding?: PaddingOptions;\n\n // Text Styling\n headerSize?: FontSizeOptions;\n headerColor?: ColorOptions;\n textSize?: FontSizeOptions;\n textColor?: ColorOptions;\n textWidth?: string;\n\n // Button\n showButton?: boolean;\n buttonColor?: ColorOptions;\n buttonSize?: ButtonSizeOptions;\n\n // Overlay\n overlayEnabled?: boolean;\n overlayType?: \"solid\" | \"gradient\";\n overlayIntensity?: number;\n};\n\nexport function CarouselWidget({\n slides = DEFAULT_SLIDES,\n autoScrollInterval = 3000,\n enableAutoScroll = false,\n carouselHeight = \"400px\",\n align = { vertical: \"bottom\", horizontal: \"left\" },\n overlayIntensity = 40,\n borderRadius = \"none\",\n padding = 0,\n textWidth = \"100%\",\n headerSize = \"lg\",\n headerColor = \"background\",\n textSize = \"md\",\n textColor = \"background\",\n showButton = true,\n buttonColor = \"background\",\n buttonSize = \"default\",\n overlayEnabled = true,\n overlayType = \"solid\",\n className,\n ...props\n}: CarouselWidgetProps): React.JSX.Element {\n const [currentIndex, setCurrentIndex] = useState(0);\n const [isHovered, setIsHovered] = useState(false);\n\n const hasSlides = slides.length > 0;\n const totalSlides = slides.length;\n\n const goToNext = useCallback(() => {\n if (!hasSlides) return;\n setCurrentIndex((prev) => {\n if (prev === totalSlides - 1) {\n return 0;\n }\n return prev + 1;\n });\n }, [hasSlides, totalSlides]);\n\n const goToPrevious = useCallback(() => {\n if (!hasSlides) return;\n setCurrentIndex((prev) => {\n if (prev === 0) {\n return totalSlides - 1;\n }\n return prev - 1;\n });\n }, [hasSlides, totalSlides]);\n\n const goToSlide = useCallback(\n (index: number) => {\n if (!hasSlides) return;\n if (index >= 0 && index < totalSlides) {\n setCurrentIndex(index);\n }\n },\n [hasSlides, totalSlides],\n );\n\n // Auto-scroll effect\n useEffect(() => {\n if (!enableAutoScroll || !hasSlides || isHovered) return;\n\n const intervalId = setInterval(() => {\n goToNext();\n }, autoScrollInterval);\n\n return () => clearInterval(intervalId);\n }, [enableAutoScroll, autoScrollInterval, hasSlides, isHovered, goToNext]);\n\n // Reset to first slide if slides change\n useEffect(() => {\n if (currentIndex >= totalSlides && totalSlides > 0) {\n setCurrentIndex(0);\n }\n }, [totalSlides, currentIndex]);\n\n if (!hasSlides) {\n return (\n <div\n className={`rounded-${borderRadius} ${className} w-full overflow-hidden`}\n style={{ minHeight: carouselHeight }}\n {...props}\n >\n <div\n className=\"bg-muted flex h-full w-full items-center justify-center\"\n style={{ minHeight: carouselHeight }}\n >\n <div className=\"text-muted-foreground flex flex-col items-center gap-2\">\n <div className=\"text-4xl\">🎠</div>\n <p className=\"text-sm\">No slides added</p>\n <p className=\"text-muted-foreground/70 text-xs\">\n Add slides to create a carousel\n </p>\n </div>\n </div>\n </div>\n );\n }\n\n return (\n <div\n className={`relative w-full overflow-hidden rounded-${borderRadius} ${className}`}\n style={{ minHeight: carouselHeight }}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n {...props}\n >\n {/* Slides Container */}\n <div\n className=\"relative h-full w-full\"\n style={{ minHeight: carouselHeight }}\n >\n <div\n className=\"flex h-full transition-transform duration-500 ease-in-out\"\n style={{\n transform: `translateX(-${currentIndex * 100}%)`,\n }}\n >\n {slides.map((slide) => (\n <div\n key={slide.id}\n className=\"relative h-full w-full flex-shrink-0\"\n style={{ minWidth: \"100%\", minHeight: carouselHeight }}\n >\n {/* Background image/content layer */}\n <div className=\"absolute inset-0 h-full w-full\">\n <MediaRenderer\n {...getMediaPropsFromWidgetSchema(slide.content)}\n />\n </div>\n\n {/* Dark overlay for text readability */}\n {overlayEnabled && (\n <div\n className={`absolute inset-0 z-9 ${\n overlayType === \"gradient\"\n ? \"bg-gradient-to-t from-black to-transparent\"\n : \"bg-black\"\n }`}\n style={{\n opacity:\n (Number(String(overlayIntensity).replace(\"%\", \"\")) ||\n 40) / 100,\n }}\n />\n )}\n\n {/* Content box */}\n <div\n className={`absolute inset-x-0 z-10 flex px-3 ${\n align.horizontal === \"left\"\n ? \"justify-start\"\n : align.horizontal === \"center\"\n ? \"justify-center\"\n : \"justify-end\"\n } ${\n align.vertical === \"top\"\n ? \"top-0 pt-13\"\n : align.vertical === \"center\"\n ? \"top-1/2 -translate-y-1/2\"\n : \"bottom-0 pb-13\"\n }`}\n >\n <div\n className={`p-${padding} flex flex-col gap-3`}\n style={{ maxWidth: textWidth }}\n >\n {/* Heading and text */}\n <div className={`flex flex-col text-${align.horizontal}`}>\n {slide.title && (\n <h2\n className={`mb-2 leading-tight font-bold text-${headerColor} text-${headerSize === \"md\" ? \"base\" : headerSize}`}\n >\n {slide.title}\n </h2>\n )}\n {slide.description && (\n <div\n className={`leading-snug text-${textColor} text-${textSize === \"md\" ? \"base\" : textSize} line-clamp-2`}\n dangerouslySetInnerHTML={{\n __html: DOMPurify.sanitize(slide.description, {\n ALLOWED_TAGS: [\n \"br\",\n \"strong\",\n \"em\",\n \"b\",\n \"i\",\n \"ul\",\n \"ol\",\n \"li\",\n \"p\",\n ],\n ALLOWED_ATTR: [],\n }),\n }}\n />\n )}\n </div>\n\n {/* Button */}\n {slide.buttonText && slide.buttonEnabled && showButton && (\n <div className={`text-${align.horizontal}`}>\n <Button\n size={buttonSize}\n className={`rounded-md py-1 font-semibold bg-${buttonColor} text-${buttonColor}-foreground hover:bg-${buttonColor}/90`}\n asChild\n >\n <a href={slide.buttonLink}>{slide.buttonText}</a>\n </Button>\n </div>\n )}\n </div>\n </div>\n </div>\n ))}\n </div>\n </div>\n {/* Dots and Navigation */}\n {totalSlides > 1 && (\n <div\n className={`p-${padding} absolute bottom-0 z-10 flex w-full items-center justify-between ${align.horizontal === \"center\" ? \"h-full\" : \"\"}`}\n >\n {/* Pagination dots - always at bottom */}\n <div\n className={`flex items-center ${\n align.horizontal === \"center\"\n ? `p-${padding} absolute inset-x-0 bottom-3 justify-center`\n : \"\"\n }`}\n >\n <div\n className={`flex items-center gap-2 ${\n align.horizontal === \"center\" ? \"justify-center\" : \"\"\n }`}\n >\n {slides.map((_, index) => (\n <button\n key={`dot-${index}`}\n className={`h-[6px] w-[6px] rounded-full transition-colors ${\n index === currentIndex\n ? \"bg-background\"\n : \"bg-background/40 hover:bg-background/60\"\n }`}\n onClick={() => goToSlide(index)}\n aria-label={`Go to slide ${index + 1}`}\n aria-current={index === currentIndex ? \"true\" : \"false\"}\n />\n ))}\n </div>\n </div>\n\n {/* Navigation arrows - position changes based on alignment */}\n <div\n className={`flex items-center gap-[10px] ${\n align.horizontal === \"center\"\n ? `absolute inset-x-0 top-1/2 justify-between px-${padding}`\n : \"\"\n }`}\n >\n <ScrollArrows onPrevious={goToPrevious} onNext={goToNext} />\n </div>\n </div>\n )}\n </div>\n );\n}\n\nexport const carouselWidgetPropertySchema: WidgetPropertySchema = {\n widgetType: \"CarouselWidget\",\n displayName: \"Carousel\",\n tabsConfig: [\n { id: \"styling\", label: \"Styling\" },\n { id: \"behavior\", label: \"Behavior\" },\n { id: \"data\", label: \"Data\" },\n ],\n dataSourceTargetProps: [\"slides\"],\n fields: [\n // Styling tab - Text Styling group\n getFontSizeField({\n defaultValue: \"lg\",\n key: \"headerSize\",\n label: \"Header Font Size\",\n description: \"Font size for the slide header\",\n tab: \"styling\",\n group: \"Text Styling\",\n }),\n getColorField({\n defaultValue: \"background\",\n key: \"headerColor\",\n label: \"Header Color\",\n description: \"Color variant for the slide header\",\n tab: \"styling\",\n group: \"Text Styling\",\n }),\n {\n key: \"separator\",\n type: \"separator\",\n label: \"Separator\",\n tab: \"styling\",\n group: \"Text Styling\",\n },\n getFontSizeField({\n defaultValue: \"md\",\n key: \"textSize\",\n label: \"Text Font Size\",\n description: \"Font size for the slide text\",\n tab: \"styling\",\n group: \"Text Styling\",\n }),\n getColorField({\n defaultValue: \"background\",\n key: \"textColor\",\n label: \"Text Color\",\n description: \"Color variant for the slide text\",\n tab: \"styling\",\n group: \"Text Styling\",\n }),\n // Styling tab - Layout group\n {\n key: \"align\",\n label: \"Alignment\",\n type: \"alignment\",\n description: \"Alignment of the carousel content\",\n defaultValue: { vertical: \"bottom\", horizontal: \"left\" },\n options: {\n verticalEnabled: true,\n horizontalEnabled: true,\n },\n tab: \"styling\",\n group: \"Layout\",\n },\n {\n key: \"textWidth\",\n label: \"Content Width\",\n type: \"text\",\n description: \"Maximum width for slide content (e.g., 100%, 50%, 600px)\",\n defaultValue: \"100%\",\n tab: \"styling\",\n group: \"Layout\",\n },\n // Styling tab - Design group\n getHeightField({\n key: \"carouselHeight\",\n label: \"Carousel Height\",\n description: \"Height of the carousel\",\n min: 100,\n max: 1200,\n step: 10,\n defaultValue: \"400px\",\n tab: \"styling\",\n group: \"Design\",\n }),\n {\n key: \"separator2\",\n type: \"separator\",\n label: \"Separator\",\n tab: \"styling\",\n group: \"Design\",\n },\n getBorderRadiusField({\n defaultValue: \"md\",\n key: \"borderRadius\",\n label: \"Border Radius\",\n description: \"Rounded corners for the carousel\",\n tab: \"styling\",\n group: \"Design\",\n }),\n getPaddingField({\n defaultValue: 4,\n key: \"padding\",\n label: \"Padding\",\n description: \"Padding for the carousel\",\n tab: \"styling\",\n group: \"Design\",\n }),\n {\n key: \"overlayEnabled\",\n label: \"Enable Overlay\",\n type: \"boolean\",\n description: \"Add background overlay to slide content\",\n defaultValue: true,\n tab: \"styling\",\n group: \"Design\",\n },\n {\n key: \"overlayType\",\n label: \"Overlay Type\",\n type: \"buttonGroup\",\n description: \"Type of overlay to add to the slide content\",\n defaultValue: \"gradient\",\n options: [\n { label: \"Solid\", value: \"solid\" },\n { label: \"Gradient\", value: \"gradient\" },\n ],\n tab: \"styling\",\n group: \"Design\",\n requiresKeyToBeTrue: \"overlayEnabled\",\n },\n {\n key: \"overlayIntensity\",\n label: \"Overlay Intensity\",\n type: \"slider\",\n description: \"Opacity of the overlay background (0-100)\",\n min: 0,\n max: 100,\n step: 5,\n defaultValue: 50,\n unit: \"%\",\n tab: \"styling\",\n group: \"Design\",\n requiresKeyToBeTrue: \"overlayEnabled\",\n },\n {\n key: \"showButton\",\n label: \"Show Button\",\n type: \"boolean\",\n description: \"Display the button in slide content\",\n defaultValue: true,\n tab: \"styling\",\n group: \"Design\",\n },\n getColorField({\n defaultValue: \"primary\",\n key: \"buttonColor\",\n label: \"Button Color\",\n description: \"Color variant for the slide button\",\n tab: \"styling\",\n group: \"Design\",\n requiresKeyToBeTrue: \"showButton\",\n }),\n getButtonSizeField({\n defaultValue: \"default\",\n key: \"buttonSize\",\n label: \"Button Size\",\n description: \"Size of the slide button\",\n tab: \"styling\",\n group: \"Design\",\n requiresKeyToBeTrue: \"showButton\",\n }),\n // Behavior tab - Auto-Scroll group\n {\n key: \"enableAutoScroll\",\n label: \"Enable Auto-Scroll\",\n type: \"boolean\",\n description: \"Automatically advance to the next slide\",\n defaultValue: false,\n tab: \"behavior\",\n group: \"Auto-Scroll\",\n },\n {\n key: \"autoScrollInterval\",\n label: \"Auto-Scroll Interval (ms)\",\n type: \"number\",\n description: \"Time in milliseconds between automatic slide transitions\",\n min: 1000,\n max: 10000,\n step: 500,\n defaultValue: 3000,\n tab: \"behavior\",\n group: \"Auto-Scroll\",\n requiresKeyToBeTrue: \"enableAutoScroll\",\n },\n // Data tab - Data Configuration group\n {\n key: \"dataSource\",\n label: \"Data Source\",\n type: \"dataSource\",\n description: \"\",\n tab: \"data\",\n group: \"Data Configuration\",\n },\n ],\n // Per-item configuration schema for custom data sources\n itemConfigSchema: {\n description: \"Configure settings for this slide\",\n fields: [\n {\n key: \"title\",\n label: \"Custom Title\",\n type: \"text\",\n description: \"Override the item's title for this slide\",\n },\n {\n key: \"description\",\n label: \"Custom Description\",\n type: \"textarea\",\n description: \"Override the item's description for this slide\",\n rows: 3,\n },\n {\n key: \"buttonEnabled\",\n label: \"Show Button\",\n type: \"boolean\",\n description: \"Show the button in the slide\",\n defaultValue: false,\n },\n {\n key: \"buttonText\",\n label: \"Button Text\",\n type: \"text\",\n description: \"Text to display on the slide button\",\n requiresKeyToBeTrue: \"buttonEnabled\",\n },\n {\n key: \"buttonLink\",\n label: \"Button Link\",\n type: \"text\",\n description: \"URL for the slide button\",\n requiresKeyToBeTrue: \"buttonEnabled\",\n },\n ],\n },\n} as const satisfies WidgetPropertySchema;\n"],"mappings":";;;;;;;;;;;;;;AA+BA,MAAM,iBAAkC,EAAE;AAgD1C,SAAgB,eAAe,EAC7B,SAAS,gBACT,qBAAqB,KACrB,mBAAmB,OACnB,iBAAiB,SACjB,QAAQ;CAAE,UAAU;CAAU,YAAY;CAAQ,EAClD,mBAAmB,IACnB,eAAe,QACf,UAAU,GACV,YAAY,QACZ,aAAa,MACb,cAAc,cACd,WAAW,MACX,YAAY,cACZ,aAAa,MACb,cAAc,cACd,aAAa,WACb,iBAAiB,MACjB,cAAc,SACd,WACA,GAAG,SACsC;CACzC,MAAM,CAAC,cAAc,mBAAmB,SAAS,EAAE;CACnD,MAAM,CAAC,WAAW,gBAAgB,SAAS,MAAM;CAEjD,MAAM,YAAY,OAAO,SAAS;CAClC,MAAM,cAAc,OAAO;CAE3B,MAAM,WAAW,kBAAkB;AACjC,MAAI,CAAC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ACL,OAAO;GACR,CAAC;EACF;GACE,KAAK;GACL,MAAM;GACN,OAAO;GACP,KAAK;GACL,OAAO;GACR;EACD,iBAAiB;GACf,cAAc;GACd,KAAK;GACL,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO;GACR,CAAC;EACF,cAAc;GACZ,cAAc;GACd,KAAK;GACL,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO;GACR,CAAC;EAEF;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,cAAc;IAAE,UAAU;IAAU,YAAY;IAAQ;GACxD,SAAS;IACP,iBAAiB;IACjB,mBAAmB;IACpB;GACD,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR;EAED,eAAe;GACb,KAAK;GACL,OAAO;GACP,aAAa;GACb,KAAK;GACL,KAAK;GACL,MAAM;GACN,cAAc;GACd,KAAK;GACL,OAAO;GACR,CAAC;EACF;GACE,KAAK;GACL,MAAM;GACN,OAAO;GACP,KAAK;GACL,OAAO;GACR;EACDA,uBAAqB;GACnB,cAAc;GACd,KAAK;GACL,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO;GACR,CAAC;EACF,gBAAgB;GACd,cAAc;GACd,KAAK;GACL,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO;GACR,CAAC;EACF;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,cAAc;GACd,SAAS,CACP;IAAE,OAAO;IAAS,OAAO;IAAS,EAClC;IAAE,OAAO;IAAY,OAAO;IAAY,CACzC;GACD,KAAK;GACL,OAAO;GACP,qBAAqB;GACtB;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,KAAK;GACL,KAAK;GACL,MAAM;GACN,cAAc;GACd,MAAM;GACN,KAAK;GACL,OAAO;GACP,qBAAqB;GACtB;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD,cAAc;GACZ,cAAc;GACd,KAAK;GACL,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO;GACP,qBAAqB;GACtB,CAAC;EACF,mBAAmB;GACjB,cAAc;GACd,KAAK;GACL,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO;GACP,qBAAqB;GACtB,CAAC;EAEF;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,KAAK;GACL,KAAK;GACL,MAAM;GACN,cAAc;GACd,KAAK;GACL,OAAO;GACP,qBAAqB;GACtB;EAED;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,KAAK;GACL,OAAO;GACR;EACF;CAED,kBAAkB;EAChB,aAAa;EACb,QAAQ;GACN;IACE,KAAK;IACL,OAAO;IACP,MAAM;IACN,aAAa;IACd;GACD;IACE,KAAK;IACL,OAAO;IACP,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,KAAK;IACL,OAAO;IACP,MAAM;IACN,aAAa;IACb,cAAc;IACf;GACD;IACE,KAAK;IACL,OAAO;IACP,MAAM;IACN,aAAa;IACb,qBAAqB;IACtB;GACD;IACE,KAAK;IACL,OAAO;IACP,MAAM;IACN,aAAa;IACb,qBAAqB;IACtB;GACF;EACF;CACF"}
1
+ {"version":3,"file":"CarouselWidget-MOGejQHD.mjs","names":["getBorderRadiusField"],"sources":["../src/widgets/CarouselWidget.tsx"],"sourcesContent":["import DOMPurify from \"dompurify\";\nimport { Button } from \"@fluid-app/ui-primitives\";\nimport { ScrollArrows } from \"../ui/scroll-arrows\";\nimport type { ComponentProps } from \"react\";\nimport { useEffect, useState, useCallback } from \"react\";\nimport type React from \"react\";\nimport {\n MediaRenderer,\n getMediaPropsFromWidgetSchema,\n} from \"../components/MediaRenderer\";\nimport type {\n WidgetSchema,\n BorderRadiusOptions,\n ColorOptions,\n AlignOptions,\n FontSizeOptions,\n PaddingOptions,\n ButtonSizeOptions,\n} from \"@fluid-app/portal-core/types\";\nimport {\n getHeightField,\n type WidgetPropertySchema,\n} from \"@fluid-app/portal-core/registries\";\nimport {\n getBorderRadiusField,\n getColorField,\n getFontSizeField,\n getPaddingField,\n getButtonSizeField,\n} from \"../core/fields\";\n\nconst DEFAULT_SLIDES: CarouselSlide[] = [];\n\ntype CarouselSlide = {\n id: string;\n content: WidgetSchema;\n title?: string;\n description?: string;\n buttonEnabled?: boolean;\n buttonText?: string;\n buttonVariant?:\n | \"default\"\n | \"secondary\"\n | \"outline\"\n | \"destructive\"\n | \"ghost\"\n | \"link\";\n buttonLink?: string;\n};\n\ntype CarouselWidgetProps = ComponentProps<\"div\"> & {\n slides?: CarouselSlide[];\n autoScrollInterval?: number;\n enableAutoScroll?: boolean;\n\n // Layout\n align?: AlignOptions;\n carouselHeight?: string;\n borderRadius?: BorderRadiusOptions;\n padding?: PaddingOptions;\n\n // Text Styling\n headerSize?: FontSizeOptions;\n headerColor?: ColorOptions;\n textSize?: FontSizeOptions;\n textColor?: ColorOptions;\n textWidth?: string;\n\n // Button\n showButton?: boolean;\n buttonColor?: ColorOptions;\n buttonSize?: ButtonSizeOptions;\n\n // Overlay\n overlayEnabled?: boolean;\n overlayType?: \"solid\" | \"gradient\";\n overlayIntensity?: number;\n};\n\nexport function CarouselWidget({\n slides = DEFAULT_SLIDES,\n autoScrollInterval = 3000,\n enableAutoScroll = false,\n carouselHeight = \"400px\",\n align = { vertical: \"bottom\", horizontal: \"left\" },\n overlayIntensity = 40,\n borderRadius = \"none\",\n padding = 0,\n textWidth = \"100%\",\n headerSize = \"lg\",\n headerColor = \"background\",\n textSize = \"md\",\n textColor = \"background\",\n showButton = true,\n buttonColor = \"background\",\n buttonSize = \"default\",\n overlayEnabled = true,\n overlayType = \"solid\",\n className,\n ...props\n}: CarouselWidgetProps): React.JSX.Element {\n const [currentIndex, setCurrentIndex] = useState(0);\n const [isHovered, setIsHovered] = useState(false);\n\n const hasSlides = slides.length > 0;\n const totalSlides = slides.length;\n\n const goToNext = useCallback(() => {\n if (!hasSlides) return;\n setCurrentIndex((prev) => {\n if (prev === totalSlides - 1) {\n return 0;\n }\n return prev + 1;\n });\n }, [hasSlides, totalSlides]);\n\n const goToPrevious = useCallback(() => {\n if (!hasSlides) return;\n setCurrentIndex((prev) => {\n if (prev === 0) {\n return totalSlides - 1;\n }\n return prev - 1;\n });\n }, [hasSlides, totalSlides]);\n\n const goToSlide = useCallback(\n (index: number) => {\n if (!hasSlides) return;\n if (index >= 0 && index < totalSlides) {\n setCurrentIndex(index);\n }\n },\n [hasSlides, totalSlides],\n );\n\n // Auto-scroll effect\n useEffect(() => {\n if (!enableAutoScroll || !hasSlides || isHovered) return;\n\n const intervalId = setInterval(() => {\n goToNext();\n }, autoScrollInterval);\n\n return () => clearInterval(intervalId);\n }, [enableAutoScroll, autoScrollInterval, hasSlides, isHovered, goToNext]);\n\n // Reset to first slide if slides change\n useEffect(() => {\n if (currentIndex >= totalSlides && totalSlides > 0) {\n setCurrentIndex(0);\n }\n }, [totalSlides, currentIndex]);\n\n if (!hasSlides) {\n return (\n <div\n className={`rounded-${borderRadius} ${className} w-full overflow-hidden`}\n style={{ minHeight: carouselHeight }}\n {...props}\n >\n <div\n className=\"bg-muted flex h-full w-full items-center justify-center\"\n style={{ minHeight: carouselHeight }}\n >\n <div className=\"text-muted-foreground flex flex-col items-center gap-2\">\n <div className=\"text-4xl\">🎠</div>\n <p className=\"text-sm\">No slides added</p>\n <p className=\"text-muted-foreground/70 text-xs\">\n Add slides to create a carousel\n </p>\n </div>\n </div>\n </div>\n );\n }\n\n return (\n <div\n className={`relative w-full overflow-hidden rounded-${borderRadius} ${className}`}\n style={{ minHeight: carouselHeight }}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n {...props}\n >\n {/* Slides Container */}\n <div\n className=\"relative h-full w-full\"\n style={{ minHeight: carouselHeight }}\n >\n <div\n className=\"flex h-full transition-transform duration-500 ease-in-out\"\n style={{\n transform: `translateX(-${currentIndex * 100}%)`,\n }}\n >\n {slides.map((slide) => (\n <div\n key={slide.id}\n className=\"relative h-full w-full flex-shrink-0\"\n style={{ minWidth: \"100%\", minHeight: carouselHeight }}\n >\n {/* Background image/content layer */}\n <div className=\"absolute inset-0 h-full w-full\">\n <MediaRenderer\n {...getMediaPropsFromWidgetSchema(slide.content)}\n />\n </div>\n\n {/* Dark overlay for text readability */}\n {overlayEnabled && (\n <div\n className={`absolute inset-0 z-9 ${\n overlayType === \"gradient\"\n ? \"bg-gradient-to-t from-black to-transparent\"\n : \"bg-black\"\n }`}\n style={{\n opacity:\n (Number(String(overlayIntensity).replace(\"%\", \"\")) ||\n 40) / 100,\n }}\n />\n )}\n\n {/* Content box */}\n <div\n className={`absolute inset-x-0 z-10 flex px-3 ${\n align.horizontal === \"left\"\n ? \"justify-start\"\n : align.horizontal === \"center\"\n ? \"justify-center\"\n : \"justify-end\"\n } ${\n align.vertical === \"top\"\n ? \"top-0 pt-13\"\n : align.vertical === \"center\"\n ? \"top-1/2 -translate-y-1/2\"\n : \"bottom-0 pb-13\"\n }`}\n >\n <div\n className={`p-${padding} flex flex-col gap-3`}\n style={{ maxWidth: textWidth }}\n >\n {/* Heading and text */}\n <div className={`flex flex-col text-${align.horizontal}`}>\n {slide.title && (\n <h2\n className={`mb-2 leading-tight font-bold text-${headerColor} text-${headerSize === \"md\" ? \"base\" : headerSize}`}\n >\n {slide.title}\n </h2>\n )}\n {slide.description && (\n <div\n className={`leading-snug text-${textColor} text-${textSize === \"md\" ? \"base\" : textSize} line-clamp-2`}\n dangerouslySetInnerHTML={{\n __html: DOMPurify.sanitize(slide.description, {\n ALLOWED_TAGS: [\n \"br\",\n \"strong\",\n \"em\",\n \"b\",\n \"i\",\n \"ul\",\n \"ol\",\n \"li\",\n \"p\",\n ],\n ALLOWED_ATTR: [],\n }),\n }}\n />\n )}\n </div>\n\n {/* Button */}\n {slide.buttonText && slide.buttonEnabled && showButton && (\n <div className={`text-${align.horizontal}`}>\n <Button\n size={buttonSize}\n className={`rounded-md py-1 font-semibold bg-${buttonColor} text-${buttonColor}-foreground hover:bg-${buttonColor}/90`}\n asChild\n >\n <a href={slide.buttonLink}>{slide.buttonText}</a>\n </Button>\n </div>\n )}\n </div>\n </div>\n </div>\n ))}\n </div>\n </div>\n {/* Dots and Navigation */}\n {totalSlides > 1 && (\n <div\n className={`p-${padding} absolute bottom-0 z-10 flex w-full items-center justify-between ${align.horizontal === \"center\" ? \"h-full\" : \"\"}`}\n >\n {/* Pagination dots - always at bottom */}\n <div\n className={`flex items-center ${\n align.horizontal === \"center\"\n ? `p-${padding} absolute inset-x-0 bottom-3 justify-center`\n : \"\"\n }`}\n >\n <div\n className={`flex items-center gap-2 ${\n align.horizontal === \"center\" ? \"justify-center\" : \"\"\n }`}\n >\n {slides.map((_, index) => (\n <button\n key={`dot-${index}`}\n className={`h-[6px] w-[6px] rounded-full transition-colors ${\n index === currentIndex\n ? \"bg-background\"\n : \"bg-background/40 hover:bg-background/60\"\n }`}\n onClick={() => goToSlide(index)}\n aria-label={`Go to slide ${index + 1}`}\n aria-current={index === currentIndex ? \"true\" : \"false\"}\n />\n ))}\n </div>\n </div>\n\n {/* Navigation arrows - position changes based on alignment */}\n <div\n className={`flex items-center gap-[10px] ${\n align.horizontal === \"center\"\n ? `absolute inset-x-0 top-1/2 justify-between px-${padding}`\n : \"\"\n }`}\n >\n <ScrollArrows onPrevious={goToPrevious} onNext={goToNext} />\n </div>\n </div>\n )}\n </div>\n );\n}\n\nexport const carouselWidgetPropertySchema: WidgetPropertySchema = {\n widgetType: \"CarouselWidget\",\n displayName: \"Carousel\",\n tabsConfig: [\n { id: \"styling\", label: \"Styling\" },\n { id: \"behavior\", label: \"Behavior\" },\n { id: \"data\", label: \"Data\" },\n ],\n dataSourceTargetProps: [\"slides\"],\n fields: [\n // Styling tab - Text Styling group\n getFontSizeField({\n defaultValue: \"lg\",\n key: \"headerSize\",\n label: \"Header Font Size\",\n description: \"Font size for the slide header\",\n tab: \"styling\",\n group: \"Text Styling\",\n }),\n getColorField({\n defaultValue: \"background\",\n key: \"headerColor\",\n label: \"Header Color\",\n description: \"Color variant for the slide header\",\n tab: \"styling\",\n group: \"Text Styling\",\n }),\n {\n key: \"separator\",\n type: \"separator\",\n label: \"Separator\",\n tab: \"styling\",\n group: \"Text Styling\",\n },\n getFontSizeField({\n defaultValue: \"md\",\n key: \"textSize\",\n label: \"Text Font Size\",\n description: \"Font size for the slide text\",\n tab: \"styling\",\n group: \"Text Styling\",\n }),\n getColorField({\n defaultValue: \"background\",\n key: \"textColor\",\n label: \"Text Color\",\n description: \"Color variant for the slide text\",\n tab: \"styling\",\n group: \"Text Styling\",\n }),\n // Styling tab - Layout group\n {\n key: \"align\",\n label: \"Alignment\",\n type: \"alignment\",\n description: \"Alignment of the carousel content\",\n defaultValue: { vertical: \"bottom\", horizontal: \"left\" },\n options: {\n verticalEnabled: true,\n horizontalEnabled: true,\n },\n tab: \"styling\",\n group: \"Layout\",\n },\n {\n key: \"textWidth\",\n label: \"Content Width\",\n type: \"cssUnit\",\n description: \"Maximum width for slide content\",\n defaultValue: \"100%\",\n allowedUnits: [\"px\", \"rem\", \"%\"],\n defaultUnit: \"%\",\n minByUnit: { px: 50, rem: 3, \"%\": 10 },\n maxByUnit: { px: 1200, rem: 75, \"%\": 100 },\n stepByUnit: { px: 10, rem: 1, \"%\": 1 },\n tab: \"styling\",\n group: \"Layout\",\n },\n // Styling tab - Design group\n getHeightField({\n key: \"carouselHeight\",\n label: \"Carousel Height\",\n description: \"Height of the carousel\",\n defaultValue: \"400px\",\n tab: \"styling\",\n group: \"Design\",\n }),\n {\n key: \"separator2\",\n type: \"separator\",\n label: \"Separator\",\n tab: \"styling\",\n group: \"Design\",\n },\n getBorderRadiusField({\n defaultValue: \"md\",\n key: \"borderRadius\",\n label: \"Border Radius\",\n description: \"Rounded corners for the carousel\",\n tab: \"styling\",\n group: \"Design\",\n }),\n getPaddingField({\n defaultValue: 4,\n key: \"padding\",\n label: \"Padding\",\n description: \"Padding for the carousel\",\n tab: \"styling\",\n group: \"Design\",\n }),\n {\n key: \"overlayEnabled\",\n label: \"Enable Overlay\",\n type: \"boolean\",\n description: \"Add background overlay to slide content\",\n defaultValue: true,\n tab: \"styling\",\n group: \"Design\",\n },\n {\n key: \"overlayType\",\n label: \"Overlay Type\",\n type: \"buttonGroup\",\n description: \"Type of overlay to add to the slide content\",\n defaultValue: \"gradient\",\n options: [\n { label: \"Solid\", value: \"solid\" },\n { label: \"Gradient\", value: \"gradient\" },\n ],\n tab: \"styling\",\n group: \"Design\",\n requiresKeyToBeTrue: \"overlayEnabled\",\n },\n {\n key: \"overlayIntensity\",\n label: \"Overlay Intensity\",\n type: \"slider\",\n description: \"Opacity of the overlay background (0-100)\",\n min: 0,\n max: 100,\n step: 5,\n defaultValue: 50,\n unit: \"%\",\n tab: \"styling\",\n group: \"Design\",\n requiresKeyToBeTrue: \"overlayEnabled\",\n },\n {\n key: \"showButton\",\n label: \"Show Button\",\n type: \"boolean\",\n description: \"Display the button in slide content\",\n defaultValue: true,\n tab: \"styling\",\n group: \"Design\",\n },\n getColorField({\n defaultValue: \"primary\",\n key: \"buttonColor\",\n label: \"Button Color\",\n description: \"Color variant for the slide button\",\n tab: \"styling\",\n group: \"Design\",\n requiresKeyToBeTrue: \"showButton\",\n }),\n getButtonSizeField({\n defaultValue: \"default\",\n key: \"buttonSize\",\n label: \"Button Size\",\n description: \"Size of the slide button\",\n tab: \"styling\",\n group: \"Design\",\n requiresKeyToBeTrue: \"showButton\",\n }),\n // Behavior tab - Auto-Scroll group\n {\n key: \"enableAutoScroll\",\n label: \"Enable Auto-Scroll\",\n type: \"boolean\",\n description: \"Automatically advance to the next slide\",\n defaultValue: false,\n tab: \"behavior\",\n group: \"Auto-Scroll\",\n },\n {\n key: \"autoScrollInterval\",\n label: \"Auto-Scroll Interval (ms)\",\n type: \"number\",\n description: \"Time in milliseconds between automatic slide transitions\",\n min: 1000,\n max: 10000,\n step: 500,\n defaultValue: 3000,\n tab: \"behavior\",\n group: \"Auto-Scroll\",\n requiresKeyToBeTrue: \"enableAutoScroll\",\n },\n // Data tab - Data Configuration group\n {\n key: \"dataSource\",\n label: \"Data Source\",\n type: \"dataSource\",\n description: \"\",\n tab: \"data\",\n group: \"Data Configuration\",\n },\n ],\n // Per-item configuration schema for custom data sources\n itemConfigSchema: {\n description: \"Configure settings for this slide\",\n fields: [\n {\n key: \"title\",\n label: \"Custom Title\",\n type: \"text\",\n description: \"Override the item's title for this slide\",\n },\n {\n key: \"description\",\n label: \"Custom Description\",\n type: \"textarea\",\n description: \"Override the item's description for this slide\",\n rows: 3,\n },\n {\n key: \"buttonEnabled\",\n label: \"Show Button\",\n type: \"boolean\",\n description: \"Show the button in the slide\",\n defaultValue: false,\n },\n {\n key: \"buttonText\",\n label: \"Button Text\",\n type: \"text\",\n description: \"Text to display on the slide button\",\n requiresKeyToBeTrue: \"buttonEnabled\",\n },\n {\n key: \"buttonLink\",\n label: \"Button Link\",\n type: \"text\",\n description: \"URL for the slide button\",\n requiresKeyToBeTrue: \"buttonEnabled\",\n },\n ],\n },\n} as const satisfies WidgetPropertySchema;\n"],"mappings":";;;;;;;;;;;;;;AA+BA,MAAM,iBAAkC,EAAE;AAgD1C,SAAgB,eAAe,EAC7B,SAAS,gBACT,qBAAqB,KACrB,mBAAmB,OACnB,iBAAiB,SACjB,QAAQ;CAAE,UAAU;CAAU,YAAY;CAAQ,EAClD,mBAAmB,IACnB,eAAe,QACf,UAAU,GACV,YAAY,QACZ,aAAa,MACb,cAAc,cACd,WAAW,MACX,YAAY,cACZ,aAAa,MACb,cAAc,cACd,aAAa,WACb,i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OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO;GACR,CAAC;EACF;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,cAAc;GACd,SAAS,CACP;IAAE,OAAO;IAAS,OAAO;IAAS,EAClC;IAAE,OAAO;IAAY,OAAO;IAAY,CACzC;GACD,KAAK;GACL,OAAO;GACP,qBAAqB;GACtB;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,KAAK;GACL,KAAK;GACL,MAAM;GACN,cAAc;GACd,MAAM;GACN,KAAK;GACL,OAAO;GACP,qBAAqB;GACtB;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD,cAAc;GACZ,cAAc;GACd,KAAK;GACL,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO;GACP,qBAAqB;GACtB,CAAC;EACF,mBAAmB;GACjB,cAAc;GACd,KAAK;GACL,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO;GACP,qBAAqB;GACtB,CAAC;EAEF;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,KAAK;GACL,KAAK;GACL,MAAM;GACN,cAAc;GACd,KAAK;GACL,OAAO;GACP,qBAAqB;GACtB;EAED;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,KAAK;GACL,OAAO;GACR;EACF;CAED,kBAAkB;EAChB,aAAa;EACb,QAAQ;GACN;IACE,KAAK;IACL,OAAO;IACP,MAAM;IACN,aAAa;IACd;GACD;IACE,KAAK;IACL,OAAO;IACP,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,KAAK;IACL,OAAO;IACP,MAAM;IACN,aAAa;IACb,cAAc;IACf;GACD;IACE,KAAK;IACL,OAAO;IACP,MAAM;IACN,aAAa;IACb,qBAAqB;IACtB;GACD;IACE,KAAK;IACL,OAAO;IACP,MAAM;IACN,aAAa;IACb,qBAAqB;IACtB;GACF;EACF;CACF"}
@@ -252,9 +252,30 @@ const carouselWidgetPropertySchema = {
252
252
  {
253
253
  key: "textWidth",
254
254
  label: "Content Width",
255
- type: "text",
256
- description: "Maximum width for slide content (e.g., 100%, 50%, 600px)",
255
+ type: "cssUnit",
256
+ description: "Maximum width for slide content",
257
257
  defaultValue: "100%",
258
+ allowedUnits: [
259
+ "px",
260
+ "rem",
261
+ "%"
262
+ ],
263
+ defaultUnit: "%",
264
+ minByUnit: {
265
+ px: 50,
266
+ rem: 3,
267
+ "%": 10
268
+ },
269
+ maxByUnit: {
270
+ px: 1200,
271
+ rem: 75,
272
+ "%": 100
273
+ },
274
+ stepByUnit: {
275
+ px: 10,
276
+ rem: 1,
277
+ "%": 1
278
+ },
258
279
  tab: "styling",
259
280
  group: "Layout"
260
281
  },
@@ -262,9 +283,6 @@ const carouselWidgetPropertySchema = {
262
283
  key: "carouselHeight",
263
284
  label: "Carousel Height",
264
285
  description: "Height of the carousel",
265
- min: 100,
266
- max: 1200,
267
- step: 10,
268
286
  defaultValue: "400px",
269
287
  tab: "styling",
270
288
  group: "Design"
@@ -450,4 +468,4 @@ Object.defineProperty(exports, "carouselWidgetPropertySchema", {
450
468
  }
451
469
  });
452
470
 
453
- //# sourceMappingURL=CarouselWidget-Bdn0LVXT.cjs.map
471
+ //# sourceMappingURL=CarouselWidget-PEm6vktC.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"CarouselWidget-Bdn0LVXT.cjs","names":["MediaRenderer","getMediaPropsFromWidgetSchema","DOMPurify","Button","ScrollArrows"],"sources":["../src/widgets/CarouselWidget.tsx"],"sourcesContent":["import DOMPurify from \"dompurify\";\nimport { Button } from \"@fluid-app/ui-primitives\";\nimport { ScrollArrows } from \"../ui/scroll-arrows\";\nimport type { ComponentProps } from \"react\";\nimport { useEffect, useState, useCallback } from \"react\";\nimport type React from \"react\";\nimport {\n MediaRenderer,\n getMediaPropsFromWidgetSchema,\n} from \"../components/MediaRenderer\";\nimport type {\n WidgetSchema,\n BorderRadiusOptions,\n ColorOptions,\n AlignOptions,\n FontSizeOptions,\n PaddingOptions,\n ButtonSizeOptions,\n} from \"@fluid-app/portal-core/types\";\nimport {\n getHeightField,\n type WidgetPropertySchema,\n} from \"@fluid-app/portal-core/registries\";\nimport {\n getBorderRadiusField,\n getColorField,\n getFontSizeField,\n getPaddingField,\n getButtonSizeField,\n} from \"../core/fields\";\n\nconst DEFAULT_SLIDES: CarouselSlide[] = [];\n\ntype CarouselSlide = {\n id: string;\n content: WidgetSchema;\n title?: string;\n description?: string;\n buttonEnabled?: boolean;\n buttonText?: string;\n buttonVariant?:\n | \"default\"\n | \"secondary\"\n | \"outline\"\n | \"destructive\"\n | \"ghost\"\n | \"link\";\n buttonLink?: string;\n};\n\ntype CarouselWidgetProps = ComponentProps<\"div\"> & {\n slides?: CarouselSlide[];\n autoScrollInterval?: number;\n enableAutoScroll?: boolean;\n\n // Layout\n align?: AlignOptions;\n carouselHeight?: string;\n borderRadius?: BorderRadiusOptions;\n padding?: PaddingOptions;\n\n // Text Styling\n headerSize?: FontSizeOptions;\n headerColor?: ColorOptions;\n textSize?: FontSizeOptions;\n textColor?: ColorOptions;\n textWidth?: string;\n\n // Button\n showButton?: boolean;\n buttonColor?: ColorOptions;\n buttonSize?: ButtonSizeOptions;\n\n // Overlay\n overlayEnabled?: boolean;\n overlayType?: \"solid\" | \"gradient\";\n overlayIntensity?: number;\n};\n\nexport function CarouselWidget({\n slides = DEFAULT_SLIDES,\n autoScrollInterval = 3000,\n enableAutoScroll = false,\n carouselHeight = \"400px\",\n align = { vertical: \"bottom\", horizontal: \"left\" },\n overlayIntensity = 40,\n borderRadius = \"none\",\n padding = 0,\n textWidth = \"100%\",\n headerSize = \"lg\",\n headerColor = \"background\",\n textSize = \"md\",\n textColor = \"background\",\n showButton = true,\n buttonColor = \"background\",\n buttonSize = \"default\",\n overlayEnabled = true,\n overlayType = \"solid\",\n className,\n ...props\n}: CarouselWidgetProps): React.JSX.Element {\n const [currentIndex, setCurrentIndex] = useState(0);\n const [isHovered, setIsHovered] = useState(false);\n\n const hasSlides = slides.length > 0;\n const totalSlides = slides.length;\n\n const goToNext = useCallback(() => {\n if (!hasSlides) return;\n setCurrentIndex((prev) => {\n if (prev === totalSlides - 1) {\n return 0;\n }\n return prev + 1;\n });\n }, [hasSlides, totalSlides]);\n\n const goToPrevious = useCallback(() => {\n if (!hasSlides) return;\n setCurrentIndex((prev) => {\n if (prev === 0) {\n return totalSlides - 1;\n }\n return prev - 1;\n });\n }, [hasSlides, totalSlides]);\n\n const goToSlide = useCallback(\n (index: number) => {\n if (!hasSlides) return;\n if (index >= 0 && index < totalSlides) {\n setCurrentIndex(index);\n }\n },\n [hasSlides, totalSlides],\n );\n\n // Auto-scroll effect\n useEffect(() => {\n if (!enableAutoScroll || !hasSlides || isHovered) return;\n\n const intervalId = setInterval(() => {\n goToNext();\n }, autoScrollInterval);\n\n return () => clearInterval(intervalId);\n }, [enableAutoScroll, autoScrollInterval, hasSlides, isHovered, goToNext]);\n\n // Reset to first slide if slides change\n useEffect(() => {\n if (currentIndex >= totalSlides && totalSlides > 0) {\n setCurrentIndex(0);\n }\n }, [totalSlides, currentIndex]);\n\n if (!hasSlides) {\n return (\n <div\n className={`rounded-${borderRadius} ${className} w-full overflow-hidden`}\n style={{ minHeight: carouselHeight }}\n {...props}\n >\n <div\n className=\"bg-muted flex h-full w-full items-center justify-center\"\n style={{ minHeight: carouselHeight }}\n >\n <div className=\"text-muted-foreground flex flex-col items-center gap-2\">\n <div className=\"text-4xl\">🎠</div>\n <p className=\"text-sm\">No slides added</p>\n <p className=\"text-muted-foreground/70 text-xs\">\n Add slides to create a carousel\n </p>\n </div>\n </div>\n </div>\n );\n }\n\n return (\n <div\n className={`relative w-full overflow-hidden rounded-${borderRadius} ${className}`}\n style={{ minHeight: carouselHeight }}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n {...props}\n >\n {/* Slides Container */}\n <div\n className=\"relative h-full w-full\"\n style={{ minHeight: carouselHeight }}\n >\n <div\n className=\"flex h-full transition-transform duration-500 ease-in-out\"\n style={{\n transform: `translateX(-${currentIndex * 100}%)`,\n }}\n >\n {slides.map((slide) => (\n <div\n key={slide.id}\n className=\"relative h-full w-full flex-shrink-0\"\n style={{ minWidth: \"100%\", minHeight: carouselHeight }}\n >\n {/* Background image/content layer */}\n <div className=\"absolute inset-0 h-full w-full\">\n <MediaRenderer\n {...getMediaPropsFromWidgetSchema(slide.content)}\n />\n </div>\n\n {/* Dark overlay for text readability */}\n {overlayEnabled && (\n <div\n className={`absolute inset-0 z-9 ${\n overlayType === \"gradient\"\n ? \"bg-gradient-to-t from-black to-transparent\"\n : \"bg-black\"\n }`}\n style={{\n opacity:\n (Number(String(overlayIntensity).replace(\"%\", \"\")) ||\n 40) / 100,\n }}\n />\n )}\n\n {/* Content box */}\n <div\n className={`absolute inset-x-0 z-10 flex px-3 ${\n align.horizontal === \"left\"\n ? \"justify-start\"\n : align.horizontal === \"center\"\n ? \"justify-center\"\n : \"justify-end\"\n } ${\n align.vertical === \"top\"\n ? \"top-0 pt-13\"\n : align.vertical === \"center\"\n ? \"top-1/2 -translate-y-1/2\"\n : \"bottom-0 pb-13\"\n }`}\n >\n <div\n className={`p-${padding} flex flex-col gap-3`}\n style={{ maxWidth: textWidth }}\n >\n {/* Heading and text */}\n <div className={`flex flex-col text-${align.horizontal}`}>\n {slide.title && (\n <h2\n className={`mb-2 leading-tight font-bold text-${headerColor} text-${headerSize === \"md\" ? \"base\" : headerSize}`}\n >\n {slide.title}\n </h2>\n )}\n {slide.description && (\n <div\n className={`leading-snug text-${textColor} text-${textSize === \"md\" ? \"base\" : textSize} line-clamp-2`}\n dangerouslySetInnerHTML={{\n __html: DOMPurify.sanitize(slide.description, {\n ALLOWED_TAGS: [\n \"br\",\n \"strong\",\n \"em\",\n \"b\",\n \"i\",\n \"ul\",\n \"ol\",\n \"li\",\n \"p\",\n ],\n ALLOWED_ATTR: [],\n }),\n }}\n />\n )}\n </div>\n\n {/* Button */}\n {slide.buttonText && slide.buttonEnabled && showButton && (\n <div className={`text-${align.horizontal}`}>\n <Button\n size={buttonSize}\n className={`rounded-md py-1 font-semibold bg-${buttonColor} text-${buttonColor}-foreground hover:bg-${buttonColor}/90`}\n asChild\n >\n <a href={slide.buttonLink}>{slide.buttonText}</a>\n </Button>\n </div>\n )}\n </div>\n </div>\n </div>\n ))}\n </div>\n </div>\n {/* Dots and Navigation */}\n {totalSlides > 1 && (\n <div\n className={`p-${padding} absolute bottom-0 z-10 flex w-full items-center justify-between ${align.horizontal === \"center\" ? \"h-full\" : \"\"}`}\n >\n {/* Pagination dots - always at bottom */}\n <div\n className={`flex items-center ${\n align.horizontal === \"center\"\n ? `p-${padding} absolute inset-x-0 bottom-3 justify-center`\n : \"\"\n }`}\n >\n <div\n className={`flex items-center gap-2 ${\n align.horizontal === \"center\" ? \"justify-center\" : \"\"\n }`}\n >\n {slides.map((_, index) => (\n <button\n key={`dot-${index}`}\n className={`h-[6px] w-[6px] rounded-full transition-colors ${\n index === currentIndex\n ? \"bg-background\"\n : \"bg-background/40 hover:bg-background/60\"\n }`}\n onClick={() => goToSlide(index)}\n aria-label={`Go to slide ${index + 1}`}\n aria-current={index === currentIndex ? \"true\" : \"false\"}\n />\n ))}\n </div>\n </div>\n\n {/* Navigation arrows - position changes based on alignment */}\n <div\n className={`flex items-center gap-[10px] ${\n align.horizontal === \"center\"\n ? `absolute inset-x-0 top-1/2 justify-between px-${padding}`\n : \"\"\n }`}\n >\n <ScrollArrows onPrevious={goToPrevious} onNext={goToNext} />\n </div>\n </div>\n )}\n </div>\n );\n}\n\nexport const carouselWidgetPropertySchema: WidgetPropertySchema = {\n widgetType: \"CarouselWidget\",\n displayName: \"Carousel\",\n tabsConfig: [\n { id: \"styling\", label: \"Styling\" },\n { id: \"behavior\", label: \"Behavior\" },\n { id: \"data\", label: \"Data\" },\n ],\n dataSourceTargetProps: [\"slides\"],\n fields: [\n // Styling tab - Text Styling group\n getFontSizeField({\n defaultValue: \"lg\",\n key: \"headerSize\",\n label: \"Header Font Size\",\n description: \"Font size for the slide header\",\n tab: \"styling\",\n group: \"Text Styling\",\n }),\n getColorField({\n defaultValue: \"background\",\n key: \"headerColor\",\n label: \"Header Color\",\n description: \"Color variant for the slide header\",\n tab: \"styling\",\n group: \"Text Styling\",\n }),\n {\n key: \"separator\",\n type: \"separator\",\n label: \"Separator\",\n tab: \"styling\",\n group: \"Text Styling\",\n },\n getFontSizeField({\n defaultValue: \"md\",\n key: \"textSize\",\n label: \"Text Font Size\",\n description: \"Font size for the slide text\",\n tab: \"styling\",\n group: \"Text Styling\",\n }),\n getColorField({\n defaultValue: \"background\",\n key: \"textColor\",\n label: \"Text Color\",\n description: \"Color variant for the slide text\",\n tab: \"styling\",\n group: \"Text Styling\",\n }),\n // Styling tab - Layout group\n {\n key: \"align\",\n label: \"Alignment\",\n type: \"alignment\",\n description: \"Alignment of the carousel content\",\n defaultValue: { vertical: \"bottom\", horizontal: \"left\" },\n options: {\n verticalEnabled: true,\n horizontalEnabled: true,\n },\n tab: \"styling\",\n group: \"Layout\",\n },\n {\n key: \"textWidth\",\n label: \"Content Width\",\n type: \"text\",\n description: \"Maximum width for slide content (e.g., 100%, 50%, 600px)\",\n defaultValue: \"100%\",\n tab: \"styling\",\n group: \"Layout\",\n },\n // Styling tab - Design group\n getHeightField({\n key: \"carouselHeight\",\n label: \"Carousel Height\",\n description: \"Height of the carousel\",\n min: 100,\n max: 1200,\n step: 10,\n defaultValue: \"400px\",\n tab: \"styling\",\n group: \"Design\",\n }),\n {\n key: \"separator2\",\n type: \"separator\",\n label: \"Separator\",\n tab: \"styling\",\n group: \"Design\",\n },\n getBorderRadiusField({\n defaultValue: \"md\",\n key: \"borderRadius\",\n label: \"Border Radius\",\n description: \"Rounded corners for the carousel\",\n tab: \"styling\",\n group: \"Design\",\n }),\n getPaddingField({\n defaultValue: 4,\n key: \"padding\",\n label: \"Padding\",\n description: \"Padding for the carousel\",\n tab: \"styling\",\n group: \"Design\",\n }),\n {\n key: \"overlayEnabled\",\n label: \"Enable Overlay\",\n type: \"boolean\",\n description: \"Add background overlay to slide content\",\n defaultValue: true,\n tab: \"styling\",\n group: \"Design\",\n },\n {\n key: \"overlayType\",\n label: \"Overlay Type\",\n type: \"buttonGroup\",\n description: \"Type of overlay to add to the slide content\",\n defaultValue: \"gradient\",\n options: [\n { label: \"Solid\", value: \"solid\" },\n { label: \"Gradient\", value: \"gradient\" },\n ],\n tab: \"styling\",\n group: \"Design\",\n requiresKeyToBeTrue: \"overlayEnabled\",\n },\n {\n key: \"overlayIntensity\",\n label: \"Overlay Intensity\",\n type: \"slider\",\n description: \"Opacity of the overlay background (0-100)\",\n min: 0,\n max: 100,\n step: 5,\n defaultValue: 50,\n unit: \"%\",\n tab: \"styling\",\n group: \"Design\",\n requiresKeyToBeTrue: \"overlayEnabled\",\n },\n {\n key: \"showButton\",\n label: \"Show Button\",\n type: \"boolean\",\n description: \"Display the button in slide content\",\n defaultValue: true,\n tab: \"styling\",\n group: \"Design\",\n },\n getColorField({\n defaultValue: \"primary\",\n key: \"buttonColor\",\n label: \"Button Color\",\n description: \"Color variant for the slide button\",\n tab: \"styling\",\n group: \"Design\",\n requiresKeyToBeTrue: \"showButton\",\n }),\n getButtonSizeField({\n defaultValue: \"default\",\n key: \"buttonSize\",\n label: \"Button Size\",\n description: \"Size of the slide button\",\n tab: \"styling\",\n group: \"Design\",\n requiresKeyToBeTrue: \"showButton\",\n }),\n // Behavior tab - Auto-Scroll group\n {\n key: \"enableAutoScroll\",\n label: \"Enable Auto-Scroll\",\n type: \"boolean\",\n description: \"Automatically advance to the next slide\",\n defaultValue: false,\n tab: \"behavior\",\n group: \"Auto-Scroll\",\n },\n {\n key: \"autoScrollInterval\",\n label: \"Auto-Scroll Interval (ms)\",\n type: \"number\",\n description: \"Time in milliseconds between automatic slide transitions\",\n min: 1000,\n max: 10000,\n step: 500,\n defaultValue: 3000,\n tab: \"behavior\",\n group: \"Auto-Scroll\",\n requiresKeyToBeTrue: \"enableAutoScroll\",\n },\n // Data tab - Data Configuration group\n {\n key: \"dataSource\",\n label: \"Data Source\",\n type: \"dataSource\",\n description: \"\",\n tab: \"data\",\n group: \"Data Configuration\",\n },\n ],\n // Per-item configuration schema for custom data sources\n itemConfigSchema: {\n description: \"Configure settings for this slide\",\n fields: [\n {\n key: \"title\",\n label: \"Custom Title\",\n type: \"text\",\n description: \"Override the item's title for this slide\",\n },\n {\n key: \"description\",\n label: \"Custom Description\",\n type: \"textarea\",\n description: \"Override the item's description for this slide\",\n rows: 3,\n },\n {\n key: \"buttonEnabled\",\n label: \"Show Button\",\n type: \"boolean\",\n description: \"Show the button in the slide\",\n defaultValue: false,\n },\n {\n key: \"buttonText\",\n label: \"Button Text\",\n type: \"text\",\n description: \"Text to display on the slide button\",\n requiresKeyToBeTrue: \"buttonEnabled\",\n },\n {\n key: \"buttonLink\",\n label: \"Button Link\",\n type: \"text\",\n description: \"URL for the slide button\",\n requiresKeyToBeTrue: \"buttonEnabled\",\n },\n ],\n },\n} as const satisfies WidgetPropertySchema;\n"],"mappings":";;;;;;;;;;;;;;AA+BA,MAAM,iBAAkC,EAAE;AAgD1C,SAAgB,eAAe,EAC7B,SAAS,gBACT,qBAAqB,KACrB,mBAAmB,OACnB,iBAAiB,SACjB,QAAQ;CAAE,UAAU;CAAU,YAAY;CAAQ,EAClD,mBAAmB,IACnB,eAAe,QACf,UAAU,GACV,YAAY,QACZ,aAAa,MACb,cAAc,cACd,WAAW,MACX,YAAY,cACZ,aAAa,MACb,cAAc,cACd,aAAa,WACb,iBAAiB,MACjB,cAAc,SACd,WACA,GAAG,SACsC;CACzC,MAA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AO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR;wDAEc;GACb,KAAK;GACL,OAAO;GACP,aAAa;GACb,KAAK;GACL,KAAK;GACL,MAAM;GACN,cAAc;GACd,KAAK;GACL,OAAO;GACR,CAAC;EACF;GACE,KAAK;GACL,MAAM;GACN,OAAO;GACP,KAAK;GACL,OAAO;GACR;8DACoB;GACnB,cAAc;GACd,KAAK;GACL,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO;GACR,CAAC;yDACc;GACd,cAAc;GACd,KAAK;GACL,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO;GACR,CAAC;EACF;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,cAAc;GACd,SAAS,CACP;IAAE,OAAO;IAAS,OAAO;IAAS,EAClC;IAAE,OAAO;IAAY,OAAO;IAAY,CACzC;GACD,KAAK;GACL,OAAO;GACP,qBAAqB;GACtB;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,KAAK;GACL,KAAK;GACL,MAAM;GACN,cAAc;GACd,MAAM;GACN,KAAK;GACL,OAAO;GACP,qBAAqB;GACtB;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR;uDACa;GACZ,cAAc;GACd,KAAK;GACL,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO;GACP,qBAAqB;GACtB,CAAC;4DACiB;GACjB,cAAc;GACd,KAAK;GACL,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO;GACP,qBAAqB;GACtB,CAAC;EAEF;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,KAAK;GACL,KAAK;GACL,MAAM;GACN,cAAc;GACd,KAAK;GACL,OAAO;GACP,qBAAqB;GACtB;EAED;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,KAAK;GACL,OAAO;GACR;EACF;CAED,kBAAkB;EAChB,aAAa;EACb,QAAQ;GACN;IACE,KAAK;IACL,OAAO;IACP,MAAM;IACN,aAAa;IACd;GACD;IACE,KAAK;IACL,OAAO;IACP,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,KAAK;IACL,OAAO;IACP,MAAM;IACN,aAAa;IACb,cAAc;IACf;GACD;IACE,KAAK;IACL,OAAO;IACP,MAAM;IACN,aAAa;IACb,qBAAqB;IACtB;GACD;IACE,KAAK;IACL,OAAO;IACP,MAAM;IACN,aAAa;IACb,qBAAqB;IACtB;GACF;EACF;CACF"}
1
+ {"version":3,"file":"CarouselWidget-PEm6vktC.cjs","names":["MediaRenderer","getMediaPropsFromWidgetSchema","DOMPurify","Button","ScrollArrows"],"sources":["../src/widgets/CarouselWidget.tsx"],"sourcesContent":["import DOMPurify from \"dompurify\";\nimport { Button } from \"@fluid-app/ui-primitives\";\nimport { ScrollArrows } from \"../ui/scroll-arrows\";\nimport type { ComponentProps } from \"react\";\nimport { useEffect, useState, useCallback } from \"react\";\nimport type React from \"react\";\nimport {\n MediaRenderer,\n getMediaPropsFromWidgetSchema,\n} from \"../components/MediaRenderer\";\nimport type {\n WidgetSchema,\n BorderRadiusOptions,\n ColorOptions,\n AlignOptions,\n FontSizeOptions,\n PaddingOptions,\n ButtonSizeOptions,\n} from \"@fluid-app/portal-core/types\";\nimport {\n getHeightField,\n type WidgetPropertySchema,\n} from \"@fluid-app/portal-core/registries\";\nimport {\n getBorderRadiusField,\n getColorField,\n getFontSizeField,\n getPaddingField,\n getButtonSizeField,\n} from \"../core/fields\";\n\nconst DEFAULT_SLIDES: CarouselSlide[] = [];\n\ntype CarouselSlide = {\n id: string;\n content: WidgetSchema;\n title?: string;\n description?: string;\n buttonEnabled?: boolean;\n buttonText?: string;\n buttonVariant?:\n | \"default\"\n | \"secondary\"\n | \"outline\"\n | \"destructive\"\n | \"ghost\"\n | \"link\";\n buttonLink?: string;\n};\n\ntype CarouselWidgetProps = ComponentProps<\"div\"> & {\n slides?: CarouselSlide[];\n autoScrollInterval?: number;\n enableAutoScroll?: boolean;\n\n // Layout\n align?: AlignOptions;\n carouselHeight?: string;\n borderRadius?: BorderRadiusOptions;\n padding?: PaddingOptions;\n\n // Text Styling\n headerSize?: FontSizeOptions;\n headerColor?: ColorOptions;\n textSize?: FontSizeOptions;\n textColor?: ColorOptions;\n textWidth?: string;\n\n // Button\n showButton?: boolean;\n buttonColor?: ColorOptions;\n buttonSize?: ButtonSizeOptions;\n\n // Overlay\n overlayEnabled?: boolean;\n overlayType?: \"solid\" | \"gradient\";\n overlayIntensity?: number;\n};\n\nexport function CarouselWidget({\n slides = DEFAULT_SLIDES,\n autoScrollInterval = 3000,\n enableAutoScroll = false,\n carouselHeight = \"400px\",\n align = { vertical: \"bottom\", horizontal: \"left\" },\n overlayIntensity = 40,\n borderRadius = \"none\",\n padding = 0,\n textWidth = \"100%\",\n headerSize = \"lg\",\n headerColor = \"background\",\n textSize = \"md\",\n textColor = \"background\",\n showButton = true,\n buttonColor = \"background\",\n buttonSize = \"default\",\n overlayEnabled = true,\n overlayType = \"solid\",\n className,\n ...props\n}: CarouselWidgetProps): React.JSX.Element {\n const [currentIndex, setCurrentIndex] = useState(0);\n const [isHovered, setIsHovered] = useState(false);\n\n const hasSlides = slides.length > 0;\n const totalSlides = slides.length;\n\n const goToNext = useCallback(() => {\n if (!hasSlides) return;\n setCurrentIndex((prev) => {\n if (prev === totalSlides - 1) {\n return 0;\n }\n return prev + 1;\n });\n }, [hasSlides, totalSlides]);\n\n const goToPrevious = useCallback(() => {\n if (!hasSlides) return;\n setCurrentIndex((prev) => {\n if (prev === 0) {\n return totalSlides - 1;\n }\n return prev - 1;\n });\n }, [hasSlides, totalSlides]);\n\n const goToSlide = useCallback(\n (index: number) => {\n if (!hasSlides) return;\n if (index >= 0 && index < totalSlides) {\n setCurrentIndex(index);\n }\n },\n [hasSlides, totalSlides],\n );\n\n // Auto-scroll effect\n useEffect(() => {\n if (!enableAutoScroll || !hasSlides || isHovered) return;\n\n const intervalId = setInterval(() => {\n goToNext();\n }, autoScrollInterval);\n\n return () => clearInterval(intervalId);\n }, [enableAutoScroll, autoScrollInterval, hasSlides, isHovered, goToNext]);\n\n // Reset to first slide if slides change\n useEffect(() => {\n if (currentIndex >= totalSlides && totalSlides > 0) {\n setCurrentIndex(0);\n }\n }, [totalSlides, currentIndex]);\n\n if (!hasSlides) {\n return (\n <div\n className={`rounded-${borderRadius} ${className} w-full overflow-hidden`}\n style={{ minHeight: carouselHeight }}\n {...props}\n >\n <div\n className=\"bg-muted flex h-full w-full items-center justify-center\"\n style={{ minHeight: carouselHeight }}\n >\n <div className=\"text-muted-foreground flex flex-col items-center gap-2\">\n <div className=\"text-4xl\">🎠</div>\n <p className=\"text-sm\">No slides added</p>\n <p className=\"text-muted-foreground/70 text-xs\">\n Add slides to create a carousel\n </p>\n </div>\n </div>\n </div>\n );\n }\n\n return (\n <div\n className={`relative w-full overflow-hidden rounded-${borderRadius} ${className}`}\n style={{ minHeight: carouselHeight }}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n {...props}\n >\n {/* Slides Container */}\n <div\n className=\"relative h-full w-full\"\n style={{ minHeight: carouselHeight }}\n >\n <div\n className=\"flex h-full transition-transform duration-500 ease-in-out\"\n style={{\n transform: `translateX(-${currentIndex * 100}%)`,\n }}\n >\n {slides.map((slide) => (\n <div\n key={slide.id}\n className=\"relative h-full w-full flex-shrink-0\"\n style={{ minWidth: \"100%\", minHeight: carouselHeight }}\n >\n {/* Background image/content layer */}\n <div className=\"absolute inset-0 h-full w-full\">\n <MediaRenderer\n {...getMediaPropsFromWidgetSchema(slide.content)}\n />\n </div>\n\n {/* Dark overlay for text readability */}\n {overlayEnabled && (\n <div\n className={`absolute inset-0 z-9 ${\n overlayType === \"gradient\"\n ? \"bg-gradient-to-t from-black to-transparent\"\n : \"bg-black\"\n }`}\n style={{\n opacity:\n (Number(String(overlayIntensity).replace(\"%\", \"\")) ||\n 40) / 100,\n }}\n />\n )}\n\n {/* Content box */}\n <div\n className={`absolute inset-x-0 z-10 flex px-3 ${\n align.horizontal === \"left\"\n ? \"justify-start\"\n : align.horizontal === \"center\"\n ? \"justify-center\"\n : \"justify-end\"\n } ${\n align.vertical === \"top\"\n ? \"top-0 pt-13\"\n : align.vertical === \"center\"\n ? \"top-1/2 -translate-y-1/2\"\n : \"bottom-0 pb-13\"\n }`}\n >\n <div\n className={`p-${padding} flex flex-col gap-3`}\n style={{ maxWidth: textWidth }}\n >\n {/* Heading and text */}\n <div className={`flex flex-col text-${align.horizontal}`}>\n {slide.title && (\n <h2\n className={`mb-2 leading-tight font-bold text-${headerColor} text-${headerSize === \"md\" ? \"base\" : headerSize}`}\n >\n {slide.title}\n </h2>\n )}\n {slide.description && (\n <div\n className={`leading-snug text-${textColor} text-${textSize === \"md\" ? \"base\" : textSize} line-clamp-2`}\n dangerouslySetInnerHTML={{\n __html: DOMPurify.sanitize(slide.description, {\n ALLOWED_TAGS: [\n \"br\",\n \"strong\",\n \"em\",\n \"b\",\n \"i\",\n \"ul\",\n \"ol\",\n \"li\",\n \"p\",\n ],\n ALLOWED_ATTR: [],\n }),\n }}\n />\n )}\n </div>\n\n {/* Button */}\n {slide.buttonText && slide.buttonEnabled && showButton && (\n <div className={`text-${align.horizontal}`}>\n <Button\n size={buttonSize}\n className={`rounded-md py-1 font-semibold bg-${buttonColor} text-${buttonColor}-foreground hover:bg-${buttonColor}/90`}\n asChild\n >\n <a href={slide.buttonLink}>{slide.buttonText}</a>\n </Button>\n </div>\n )}\n </div>\n </div>\n </div>\n ))}\n </div>\n </div>\n {/* Dots and Navigation */}\n {totalSlides > 1 && (\n <div\n className={`p-${padding} absolute bottom-0 z-10 flex w-full items-center justify-between ${align.horizontal === \"center\" ? \"h-full\" : \"\"}`}\n >\n {/* Pagination dots - always at bottom */}\n <div\n className={`flex items-center ${\n align.horizontal === \"center\"\n ? `p-${padding} absolute inset-x-0 bottom-3 justify-center`\n : \"\"\n }`}\n >\n <div\n className={`flex items-center gap-2 ${\n align.horizontal === \"center\" ? \"justify-center\" : \"\"\n }`}\n >\n {slides.map((_, index) => (\n <button\n key={`dot-${index}`}\n className={`h-[6px] w-[6px] rounded-full transition-colors ${\n index === currentIndex\n ? \"bg-background\"\n : \"bg-background/40 hover:bg-background/60\"\n }`}\n onClick={() => goToSlide(index)}\n aria-label={`Go to slide ${index + 1}`}\n aria-current={index === currentIndex ? \"true\" : \"false\"}\n />\n ))}\n </div>\n </div>\n\n {/* Navigation arrows - position changes based on alignment */}\n <div\n className={`flex items-center gap-[10px] ${\n align.horizontal === \"center\"\n ? `absolute inset-x-0 top-1/2 justify-between px-${padding}`\n : \"\"\n }`}\n >\n <ScrollArrows onPrevious={goToPrevious} onNext={goToNext} />\n </div>\n </div>\n )}\n </div>\n );\n}\n\nexport const carouselWidgetPropertySchema: WidgetPropertySchema = {\n widgetType: \"CarouselWidget\",\n displayName: \"Carousel\",\n tabsConfig: [\n { id: \"styling\", label: \"Styling\" },\n { id: \"behavior\", label: \"Behavior\" },\n { id: \"data\", label: \"Data\" },\n ],\n dataSourceTargetProps: [\"slides\"],\n fields: [\n // Styling tab - Text Styling group\n getFontSizeField({\n defaultValue: \"lg\",\n key: \"headerSize\",\n label: \"Header Font Size\",\n description: \"Font size for the slide header\",\n tab: \"styling\",\n group: \"Text Styling\",\n }),\n getColorField({\n defaultValue: \"background\",\n key: \"headerColor\",\n label: \"Header Color\",\n description: \"Color variant for the slide header\",\n tab: \"styling\",\n group: \"Text Styling\",\n }),\n {\n key: \"separator\",\n type: \"separator\",\n label: \"Separator\",\n tab: \"styling\",\n group: \"Text Styling\",\n },\n getFontSizeField({\n defaultValue: \"md\",\n key: \"textSize\",\n label: \"Text Font Size\",\n description: \"Font size for the slide text\",\n tab: \"styling\",\n group: \"Text Styling\",\n }),\n getColorField({\n defaultValue: \"background\",\n key: \"textColor\",\n label: \"Text Color\",\n description: \"Color variant for the slide text\",\n tab: \"styling\",\n group: \"Text Styling\",\n }),\n // Styling tab - Layout group\n {\n key: \"align\",\n label: \"Alignment\",\n type: \"alignment\",\n description: \"Alignment of the carousel content\",\n defaultValue: { vertical: \"bottom\", horizontal: \"left\" },\n options: {\n verticalEnabled: true,\n horizontalEnabled: true,\n },\n tab: \"styling\",\n group: \"Layout\",\n },\n {\n key: \"textWidth\",\n label: \"Content Width\",\n type: \"cssUnit\",\n description: \"Maximum width for slide content\",\n defaultValue: \"100%\",\n allowedUnits: [\"px\", \"rem\", \"%\"],\n defaultUnit: \"%\",\n minByUnit: { px: 50, rem: 3, \"%\": 10 },\n maxByUnit: { px: 1200, rem: 75, \"%\": 100 },\n stepByUnit: { px: 10, rem: 1, \"%\": 1 },\n tab: \"styling\",\n group: \"Layout\",\n },\n // Styling tab - Design group\n getHeightField({\n key: \"carouselHeight\",\n label: \"Carousel Height\",\n description: \"Height of the carousel\",\n defaultValue: \"400px\",\n tab: \"styling\",\n group: \"Design\",\n }),\n {\n key: \"separator2\",\n type: \"separator\",\n label: \"Separator\",\n tab: \"styling\",\n group: \"Design\",\n },\n getBorderRadiusField({\n defaultValue: \"md\",\n key: \"borderRadius\",\n label: \"Border Radius\",\n description: \"Rounded corners for the carousel\",\n tab: \"styling\",\n group: \"Design\",\n }),\n getPaddingField({\n defaultValue: 4,\n key: \"padding\",\n label: \"Padding\",\n description: \"Padding for the carousel\",\n tab: \"styling\",\n group: \"Design\",\n }),\n {\n key: \"overlayEnabled\",\n label: \"Enable Overlay\",\n type: \"boolean\",\n description: \"Add background overlay to slide content\",\n defaultValue: true,\n tab: \"styling\",\n group: \"Design\",\n },\n {\n key: \"overlayType\",\n label: \"Overlay Type\",\n type: \"buttonGroup\",\n description: \"Type of overlay to add to the slide content\",\n defaultValue: \"gradient\",\n options: [\n { label: \"Solid\", value: \"solid\" },\n { label: \"Gradient\", value: \"gradient\" },\n ],\n tab: \"styling\",\n group: \"Design\",\n requiresKeyToBeTrue: \"overlayEnabled\",\n },\n {\n key: \"overlayIntensity\",\n label: \"Overlay Intensity\",\n type: \"slider\",\n description: \"Opacity of the overlay background (0-100)\",\n min: 0,\n max: 100,\n step: 5,\n defaultValue: 50,\n unit: \"%\",\n tab: \"styling\",\n group: \"Design\",\n requiresKeyToBeTrue: \"overlayEnabled\",\n },\n {\n key: \"showButton\",\n label: \"Show Button\",\n type: \"boolean\",\n description: \"Display the button in slide content\",\n defaultValue: true,\n tab: \"styling\",\n group: \"Design\",\n },\n getColorField({\n defaultValue: \"primary\",\n key: \"buttonColor\",\n label: \"Button Color\",\n description: \"Color variant for the slide button\",\n tab: \"styling\",\n group: \"Design\",\n requiresKeyToBeTrue: \"showButton\",\n }),\n getButtonSizeField({\n defaultValue: \"default\",\n key: \"buttonSize\",\n label: \"Button Size\",\n description: \"Size of the slide button\",\n tab: \"styling\",\n group: \"Design\",\n requiresKeyToBeTrue: \"showButton\",\n }),\n // Behavior tab - Auto-Scroll group\n {\n key: \"enableAutoScroll\",\n label: \"Enable Auto-Scroll\",\n type: \"boolean\",\n description: \"Automatically advance to the next slide\",\n defaultValue: false,\n tab: \"behavior\",\n group: \"Auto-Scroll\",\n },\n {\n key: \"autoScrollInterval\",\n label: \"Auto-Scroll Interval (ms)\",\n type: \"number\",\n description: \"Time in milliseconds between automatic slide transitions\",\n min: 1000,\n max: 10000,\n step: 500,\n defaultValue: 3000,\n tab: \"behavior\",\n group: \"Auto-Scroll\",\n requiresKeyToBeTrue: \"enableAutoScroll\",\n },\n // Data tab - Data Configuration group\n {\n key: \"dataSource\",\n label: \"Data Source\",\n type: \"dataSource\",\n description: \"\",\n tab: \"data\",\n group: \"Data Configuration\",\n },\n ],\n // Per-item configuration schema for custom data sources\n itemConfigSchema: {\n description: \"Configure settings for this slide\",\n fields: [\n {\n key: \"title\",\n label: \"Custom Title\",\n type: \"text\",\n description: \"Override the item's title for this slide\",\n },\n {\n key: \"description\",\n label: \"Custom Description\",\n type: \"textarea\",\n description: \"Override the item's description for this slide\",\n rows: 3,\n },\n {\n key: \"buttonEnabled\",\n label: \"Show Button\",\n type: \"boolean\",\n description: \"Show the button in the slide\",\n defaultValue: false,\n },\n {\n key: \"buttonText\",\n label: \"Button Text\",\n type: \"text\",\n description: \"Text to display on the slide button\",\n requiresKeyToBeTrue: \"buttonEnabled\",\n },\n {\n key: \"buttonLink\",\n label: \"Button Link\",\n type: \"text\",\n description: \"URL for the slide button\",\n requiresKeyToBeTrue: \"buttonEnabled\",\n },\n ],\n },\n} as const satisfies WidgetPropertySchema;\n"],"mappings":";;;;;;;;;;;;;;AA+BA,MAAM,iBAAkC,EAAE;AAgD1C,SAAgB,eAAe,EAC7B,SAAS,gBACT,qBAAqB,KACrB,mBAAmB,OACnB,iBAAiB,SACjB,QAAQ;CAAE,UAAU;CAAU,YAAY;CAAQ,EAClD,mBAAmB,IACnB,eAAe,QACf,UAAU,GACV,YAAY,QACZ,aAAa,MACb,cAAc,cACd,WAAW,MACX,YAAY,cACZ,aAAa,MACb,cAAc,cACd,aAAa,WACb,iBAAiB,MACjB,cAAc,SACd,WACA,GAAG,SACsC;CACzC,MAAM,CAAC,cAAc,oBAAA,GAAA,MAAA,UAA4B,EAAE;CACnD,MAAM,CAAC,WAAW,iBAAA,GAAA,MAAA,UAAyB,MAAM;CAEjD,MAAM,YAAY,OAAO,SAAS;CAClC,MAAM,cAAc,OAAO;CAE3B,MAAM,YAAA,GAAA,MAAA,mBAA6B;AACjC,MAAI,CAAC,UAAW;AAChB,mBAAiB,SAAS;AACxB,OAAI,SAAS,cAAc,EACzB,QAAO;AAET,UAAO,OAAO;IACd;IACD,CAAC,WAAW,YAAY,CAAC;CAE5B,MAAM,gBAAA,GAAA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GACd,KAAK;GACL,OAAO;GACR,CAAC;EACF;GACE,KAAK;GACL,MAAM;GACN,OAAO;GACP,KAAK;GACL,OAAO;GACR;8DACoB;GACnB,cAAc;GACd,KAAK;GACL,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO;GACR,CAAC;yDACc;GACd,cAAc;GACd,KAAK;GACL,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO;GACR,CAAC;EACF;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,cAAc;GACd,SAAS,CACP;IAAE,OAAO;IAAS,OAAO;IAAS,EAClC;IAAE,OAAO;IAAY,OAAO;IAAY,CACzC;GACD,KAAK;GACL,OAAO;GACP,qBAAqB;GACtB;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,KAAK;GACL,KAAK;GACL,MAAM;GACN,cAAc;GACd,MAAM;GACN,KAAK;GACL,OAAO;GACP,qBAAqB;GACtB;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR;uDACa;GACZ,cAAc;GACd,KAAK;GACL,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO;GACP,qBAAqB;GACtB,CAAC;4DACiB;GACjB,cAAc;GACd,KAAK;GACL,OAAO;GACP,aAAa;GACb,KAAK;GACL,OAAO;GACP,qBAAqB;GACtB,CAAC;EAEF;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,KAAK;GACL,KAAK;GACL,MAAM;GACN,cAAc;GACd,KAAK;GACL,OAAO;GACP,qBAAqB;GACtB;EAED;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,KAAK;GACL,OAAO;GACR;EACF;CAED,kBAAkB;EAChB,aAAa;EACb,QAAQ;GACN;IACE,KAAK;IACL,OAAO;IACP,MAAM;IACN,aAAa;IACd;GACD;IACE,KAAK;IACL,OAAO;IACP,MAAM;IACN,aAAa;IACb,MAAM;IACP;GACD;IACE,KAAK;IACL,OAAO;IACP,MAAM;IACN,aAAa;IACb,cAAc;IACf;GACD;IACE,KAAK;IACL,OAAO;IACP,MAAM;IACN,aAAa;IACb,qBAAqB;IACtB;GACD;IACE,KAAK;IACL,OAAO;IACP,MAAM;IACN,aAAa;IACb,qBAAqB;IACtB;GACF;EACF;CACF"}
@@ -334,9 +334,6 @@ const chartWidgetPropertySchema = {
334
334
  key: "height",
335
335
  label: "Height",
336
336
  description: "Height of the chart",
337
- min: 50,
338
- max: 1200,
339
- step: 10,
340
337
  defaultValue: "300px",
341
338
  tab: "styling",
342
339
  group: "Design"
@@ -412,4 +409,4 @@ const chartWidgetPropertySchema = {
412
409
  //#endregion
413
410
  export { ChartWidget_exports as n, chartWidgetPropertySchema as r, ChartWidget as t };
414
411
 
415
- //# sourceMappingURL=ChartWidget-B3GcdLqH.mjs.map
412
+ //# sourceMappingURL=ChartWidget-7jEGoije.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChartWidget-B3GcdLqH.mjs","names":["RechartsBarChart","RechartsLineChart","RechartsAreaChart","RechartsPieChart"],"sources":["../src/widgets/ChartWidget.tsx"],"sourcesContent":["import type { WidgetPropertySchema } from \"@fluid-app/portal-core/registries\";\nimport {\n Card,\n ChartContainer,\n ChartLegend,\n ChartLegendContent,\n ChartTooltip,\n ChartTooltipContent,\n} from \"@fluid-app/ui-primitives\";\nimport type { ComponentProps } from \"react\";\nimport type React from \"react\";\nimport {\n Bar,\n BarChart as RechartsBarChart,\n Line,\n LineChart as RechartsLineChart,\n Area,\n AreaChart as RechartsAreaChart,\n Pie,\n PieChart as RechartsPieChart,\n XAxis,\n YAxis,\n CartesianGrid,\n} from \"recharts\";\nimport {\n getBorderRadiusField,\n getColorField,\n getFontSizeField,\n getHeightField,\n getPaddingField,\n} from \"../core/fields\";\nimport type {\n BackgroundValue,\n BorderRadiusOptions,\n ColorOptions,\n FontSizeOptions,\n PaddingOptions,\n} from \"@fluid-app/portal-core/types\";\n\ntype ChartDataPoint = Record<string, unknown>;\n\ntype ChartWidgetProps = ComponentProps<\"div\"> & {\n // Title\n titleEnabled?: boolean;\n title?: string;\n titleFontSize?: FontSizeOptions;\n titleColor?: ColorOptions;\n\n // Description\n description?: string;\n descriptionFontSize?: FontSizeOptions;\n descriptionColor?: ColorOptions;\n\n // Design\n chartType?: \"bar\" | \"line\" | \"area\" | \"pie\";\n showLegend?: boolean;\n showTooltip?: boolean;\n showGrid?: boolean;\n width?: string;\n height?: string;\n background?: BackgroundValue;\n padding?: PaddingOptions;\n borderRadius?: BorderRadiusOptions;\n\n // Data\n dataKey?: string;\n xAxisKey?: string;\n /** Chart data - when provided via dataSource, this overrides defaultData */\n data?: ChartDataPoint[];\n /** Chart configuration - can be dynamically provided via dataSource */\n chartConfig?: Record<string, { label: string; color: string }>;\n};\n\n// Default sample data for demonstration\nconst defaultData = [\n { name: \"Jan\", value: 186 },\n { name: \"Feb\", value: 305 },\n { name: \"Mar\", value: 237 },\n { name: \"Apr\", value: 273 },\n { name: \"May\", value: 209 },\n { name: \"Jun\", value: 214 },\n];\n\n// Pie chart data with individual fill properties\nconst defaultPieData = [\n { name: \"Jan\", value: 186, fill: \"var(--chart-1)\" },\n { name: \"Feb\", value: 305, fill: \"var(--chart-2)\" },\n { name: \"Mar\", value: 237, fill: \"var(--chart-3)\" },\n { name: \"Apr\", value: 273, fill: \"var(--chart-4)\" },\n { name: \"May\", value: 209, fill: \"var(--chart-5)\" },\n];\n\nconst defaultChartConfig = {\n value: {\n label: \"Value\",\n color: \"var(--chart-1)\",\n },\n};\n\nexport function ChartWidget({\n titleEnabled = true,\n title = \"Chart Widget\",\n titleFontSize = \"lg\",\n titleColor = \"foreground\",\n\n description = \"Displaying sample data\",\n descriptionFontSize = \"md\",\n descriptionColor = \"foreground\",\n\n chartType = \"bar\",\n showLegend = false,\n showTooltip = true,\n showGrid = true,\n width = \"100%\",\n height = \"300px\",\n background = {\n type: \"solid\",\n color: \"background\",\n },\n padding = 4,\n borderRadius = \"md\",\n\n dataKey = \"value\",\n xAxisKey = \"name\",\n data,\n chartConfig,\n className,\n ...props\n}: ChartWidgetProps): React.JSX.Element {\n const backgroundColor = background.color || \"background\";\n const backgroundImage =\n (background.resource?.image_url || background.resource?.imageUrl) &&\n background.type === \"image\"\n ? `url(${background.resource.image_url || background.resource.imageUrl})`\n : \"none\";\n // Use provided data or fall back to default\n const chartData = data ?? defaultData;\n const chartPieData =\n chartType === \"pie\" && data\n ? data.map((item, index) => ({\n ...item,\n fill: `var(--chart-${(index % 5) + 1})`,\n }))\n : defaultPieData;\n const config = chartConfig ?? defaultChartConfig;\n const chartElement = (() => {\n switch (chartType) {\n case \"bar\":\n return (\n <RechartsBarChart data={chartData}>\n {showGrid && <CartesianGrid strokeDasharray=\"3 3\" />}\n <XAxis dataKey={xAxisKey} />\n <YAxis />\n {showTooltip && <ChartTooltip content={<ChartTooltipContent />} />}\n {showLegend && <ChartLegend content={<ChartLegendContent />} />}\n <Bar dataKey={dataKey} fill=\"var(--color-value)\" radius={8} />\n </RechartsBarChart>\n );\n\n case \"line\":\n return (\n <RechartsLineChart data={chartData}>\n {showGrid && <CartesianGrid strokeDasharray=\"3 3\" />}\n <XAxis dataKey={xAxisKey} />\n <YAxis />\n {showTooltip && <ChartTooltip content={<ChartTooltipContent />} />}\n {showLegend && <ChartLegend content={<ChartLegendContent />} />}\n <Line\n type=\"monotone\"\n dataKey={dataKey}\n stroke=\"var(--color-value)\"\n strokeWidth={2}\n dot={{ r: 4 }}\n />\n </RechartsLineChart>\n );\n\n case \"area\":\n return (\n <RechartsAreaChart data={chartData}>\n {showGrid && <CartesianGrid strokeDasharray=\"3 3\" />}\n <XAxis dataKey={xAxisKey} />\n <YAxis />\n {showTooltip && <ChartTooltip content={<ChartTooltipContent />} />}\n {showLegend && <ChartLegend content={<ChartLegendContent />} />}\n <Area\n type=\"monotone\"\n dataKey={dataKey}\n stroke=\"var(--color-value)\"\n fill=\"var(--color-value)\"\n fillOpacity={0.6}\n />\n </RechartsAreaChart>\n );\n\n case \"pie\":\n return (\n <RechartsPieChart>\n {showTooltip && (\n <ChartTooltip content={<ChartTooltipContent hideLabel />} />\n )}\n {showLegend && <ChartLegend content={<ChartLegendContent />} />}\n <Pie\n data={chartPieData}\n dataKey={dataKey}\n nameKey={xAxisKey}\n cx=\"50%\"\n cy=\"50%\"\n outerRadius={80}\n label\n />\n </RechartsPieChart>\n );\n\n default:\n // Fallback to bar chart for unknown chart types\n return (\n <RechartsBarChart data={chartData}>\n {showGrid && <CartesianGrid strokeDasharray=\"3 3\" />}\n <XAxis dataKey={xAxisKey} />\n <YAxis />\n {showTooltip && <ChartTooltip content={<ChartTooltipContent />} />}\n {showLegend && <ChartLegend content={<ChartLegendContent />} />}\n <Bar dataKey={dataKey} fill=\"var(--color-value)\" radius={8} />\n </RechartsBarChart>\n );\n }\n })();\n\n return (\n <Card\n className={`bg-${backgroundColor} p-${padding} rounded-${borderRadius} ${className}`}\n style={{\n width,\n maxWidth: \"100%\",\n backgroundImage,\n }}\n {...props}\n >\n <div className=\"p-6\">\n <div className=\"mb-4\">\n {titleEnabled && (\n <h3\n className={`text-${titleFontSize} text-${titleColor} font-bold`}\n >\n {title}\n </h3>\n )}\n {description && (\n <p\n className={`text-${descriptionFontSize} text-${descriptionColor}`}\n >\n {description}\n </p>\n )}\n </div>\n <ChartContainer config={config} style={{ height }}>\n {chartElement}\n </ChartContainer>\n </div>\n </Card>\n );\n}\n\nexport const chartWidgetPropertySchema: WidgetPropertySchema = {\n widgetType: \"ChartWidget\",\n displayName: \"Chart\",\n tabsConfig: [\n { id: \"styling\", label: \"Styling\" },\n { id: \"data\", label: \"Data\" },\n ],\n dataSourceTargetProps: [\"data\", \"chartConfig\"],\n fields: [\n // Content Tab - Title Group\n {\n key: \"titleEnabled\",\n label: \"Widget Title\",\n type: \"boolean\",\n description: \"Enable the title displayed above the chart\",\n defaultValue: true,\n tab: \"styling\",\n group: \"Title\",\n },\n {\n key: \"title\",\n label: \"Title\",\n type: \"text\",\n description: \"The chart title\",\n defaultValue: \"Chart Widget\",\n tab: \"styling\",\n group: \"Title\",\n requiresKeyToBeTrue: \"titleEnabled\",\n },\n getFontSizeField({\n key: \"titleFontSize\",\n label: \"Title Font Size\",\n description: \"Font size for the chart title\",\n defaultValue: \"lg\",\n tab: \"styling\",\n group: \"Title\",\n requiresKeyToBeTrue: \"titleEnabled\",\n }),\n getColorField({\n key: \"titleColor\",\n label: \"Title Color\",\n description: \"Color for the chart title\",\n defaultValue: \"foreground\",\n tab: \"styling\",\n group: \"Title\",\n requiresKeyToBeTrue: \"titleEnabled\",\n }),\n\n // Content Tab - Description Group\n {\n key: \"description\",\n label: \"Description\",\n type: \"textarea\",\n description: \"The chart description\",\n rows: 2,\n defaultValue: \"Displaying sample data\",\n tab: \"styling\",\n group: \"Description\",\n },\n getFontSizeField({\n key: \"descriptionFontSize\",\n label: \"Description Font Size\",\n description: \"Font size for the chart description\",\n defaultValue: \"md\",\n tab: \"styling\",\n group: \"Description\",\n }),\n getColorField({\n key: \"descriptionColor\",\n label: \"Description Color\",\n description: \"Color for the chart description\",\n defaultValue: \"foreground\",\n tab: \"styling\",\n group: \"Description\",\n }),\n\n // Styling Tab - Design Group\n {\n key: \"chartType\",\n label: \"Chart Type\",\n type: \"select\",\n description: \"Type of chart to display\",\n options: [\n { label: \"Bar Chart\", value: \"bar\" },\n { label: \"Line Chart\", value: \"line\" },\n { label: \"Area Chart\", value: \"area\" },\n { label: \"Pie Chart\", value: \"pie\" },\n ],\n defaultValue: \"bar\",\n tab: \"styling\",\n group: \"Design\",\n },\n {\n key: \"showLegend\",\n label: \"Show Legend\",\n type: \"boolean\",\n description: \"Display chart legend\",\n defaultValue: false,\n tab: \"styling\",\n group: \"Design\",\n },\n {\n key: \"showTooltip\",\n label: \"Show Tooltip\",\n type: \"boolean\",\n description: \"Display tooltip on hover\",\n defaultValue: true,\n tab: \"styling\",\n group: \"Design\",\n },\n {\n key: \"showGrid\",\n label: \"Show Grid\",\n type: \"boolean\",\n description: \"Display background grid lines\",\n defaultValue: true,\n tab: \"styling\",\n group: \"Design\",\n },\n {\n key: \"separator\",\n type: \"separator\",\n label: \"Separator\",\n tab: \"styling\",\n group: \"Design\",\n },\n {\n key: \"width\",\n label: \"Width\",\n type: \"text\",\n description:\n \"Width of the chart container (CSS value, e.g., 100%, 600px)\",\n defaultValue: \"100%\",\n tab: \"styling\",\n group: \"Design\",\n },\n getHeightField({\n key: \"height\",\n label: \"Height\",\n description: \"Height of the chart\",\n min: 50,\n max: 1200,\n step: 10,\n defaultValue: \"300px\",\n tab: \"styling\",\n group: \"Design\",\n }),\n {\n key: \"separator2\",\n type: \"separator\",\n label: \"Separator\",\n tab: \"styling\",\n group: \"Design\",\n },\n {\n type: \"background\",\n key: \"background\",\n label: \"Background\",\n description: \"Background for the chart container\",\n defaultValue: \"background\",\n tab: \"styling\",\n group: \"Design\",\n },\n getPaddingField({\n key: \"padding\",\n label: \"Padding\",\n description: \"Padding for the chart container\",\n defaultValue: 4,\n tab: \"styling\",\n group: \"Design\",\n }),\n getBorderRadiusField({\n key: \"borderRadius\",\n label: \"Border Radius\",\n description: \"Border radius for the chart container\",\n defaultValue: \"md\",\n tab: \"styling\",\n group: \"Design\",\n }),\n\n // Data Tab - Data Group\n {\n key: \"dataSource\",\n label: \"Data Source\",\n type: \"dataSource\",\n description: \"Configure dynamic data fetching from an API\",\n tab: \"data\",\n group: \"Data\",\n },\n {\n key: \"dataKey\",\n label: \"Data Key\",\n type: \"select\",\n description: \"Key in the data to use for chart values\",\n options: [{ label: \"value\", value: \"value\" }],\n defaultValue: \"value\",\n tab: \"data\",\n group: \"Data\",\n },\n {\n key: \"xAxisKey\",\n label: \"X-Axis Key\",\n type: \"select\",\n description: \"Key in the data to use for X-axis labels\",\n options: [{ label: \"name\", value: \"name\" }],\n defaultValue: \"name\",\n tab: \"data\",\n group: \"Data\",\n },\n ],\n} satisfies WidgetPropertySchema;\n"],"mappings":";;;;;;;;;;AA0EA,MAAM,cAAc;CAClB;EAAE,MAAM;EAAO,OAAO;EAAK;CAC3B;EAAE,MAAM;EAAO,OAAO;EAAK;CAC3B;EAAE,MAAM;EAAO,OAAO;EAAK;CAC3B;EAAE,MAAM;EAAO,OAAO;EAAK;CAC3B;EAAE,MAAM;EAAO,OAAO;EAAK;CAC3B;EAAE,MAAM;EAAO,OAAO;EAAK;CAC5B;AAGD,MAAM,iBAAiB;CACrB;EAAE,MAAM;EAAO,OAAO;EAAK,MAAM;EAAkB;CACnD;EAAE,MAAM;EAAO,OAAO;EAAK,MAAM;EAAkB;CACnD;EAAE,MAAM;EAAO,OAAO;EAAK,MAAM;EAAkB;CACnD;EAAE,MAAM;EAAO,OAAO;EAAK,MAAM;EAAkB;CACnD;EAAE,MAAM;EAAO,OAAO;EAAK,MAAM;EAAkB;CACpD;AAED,MAAM,qBAAqB,EACzB,OAAO;CACL,OAAO;CACP,OAAO;CACR,EACF;AAED,SAAgB,YAAY,EAC1B,eAAe,MACf,QAAQ,gBACR,gBAAgB,MAChB,aAAa,cAEb,cAAc,0BACd,sBAAsB,MACtB,mBAAmB,cAEnB,YAAY,OACZ,aAAa,OACb,cAAc,MACd,WAAW,MACX,QAAQ,QACR,SAAS,SACT,aAAa;CACX,MAAM;CACN,OAAO;CACR,EACD,UAAU,GACV,eAAe,MAEf,UAAU,SACV,WAAW,QACX,MACA,aACA,WACA,GAAG,SACmC;CACtC,MAAM,kBAAkB,WAAW,SAAS;CAC5C,MAAM,mBACH,WAAW,UAAU,aAAa,WAAW,UAAU,aACxD,WAAW,SAAS,UAChB,OAAO,WAAW,SAAS,aAAa,WAAW,SAAS,SAAS,KACrE;CAEN,MAAM,YAAY,QAAQ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AE,OAAO;KAAa,OAAO;KAAO;IACrC;GACD,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,MAAM;GACN,OAAO;GACP,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aACE;GACF,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD,eAAe;GACb,KAAK;GACL,OAAO;GACP,aAAa;GACb,KAAK;GACL,KAAK;GACL,MAAM;GACN,cAAc;GACd,KAAK;GACL,OAAO;GACR,CAAC;EACF;GACE,KAAK;GACL,MAAM;GACN,OAAO;GACP,KAAK;GACL,OAAO;GACR;EACD;GACE,MAAM;GACN,KAAK;GACL,OAAO;GACP,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD,gBAAgB;GACd,KAAK;GACL,OAAO;GACP,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR,CAAC;EACF,qBAAqB;GACnB,KAAK;GACL,OAAO;GACP,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR,CAAC;EAGF;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,SAAS,CAAC;IAAE,OAAO;IAAS,OAAO;IAAS,CAAC;GAC7C,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,SAAS,CAAC;IAAE,OAAO;IAAQ,OAAO;IAAQ,CAAC;GAC3C,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACF;CACF"}
1
+ {"version":3,"file":"ChartWidget-7jEGoije.mjs","names":["RechartsBarChart","RechartsLineChart","RechartsAreaChart","RechartsPieChart"],"sources":["../src/widgets/ChartWidget.tsx"],"sourcesContent":["import type { WidgetPropertySchema } from \"@fluid-app/portal-core/registries\";\nimport {\n Card,\n ChartContainer,\n ChartLegend,\n ChartLegendContent,\n ChartTooltip,\n ChartTooltipContent,\n} from \"@fluid-app/ui-primitives\";\nimport type { ComponentProps } from \"react\";\nimport type React from \"react\";\nimport {\n Bar,\n BarChart as RechartsBarChart,\n Line,\n LineChart as RechartsLineChart,\n Area,\n AreaChart as RechartsAreaChart,\n Pie,\n PieChart as RechartsPieChart,\n XAxis,\n YAxis,\n CartesianGrid,\n} from \"recharts\";\nimport {\n getBorderRadiusField,\n getColorField,\n getFontSizeField,\n getHeightField,\n getPaddingField,\n} from \"../core/fields\";\nimport type {\n BackgroundValue,\n BorderRadiusOptions,\n ColorOptions,\n FontSizeOptions,\n PaddingOptions,\n} from \"@fluid-app/portal-core/types\";\n\ntype ChartDataPoint = Record<string, unknown>;\n\ntype ChartWidgetProps = ComponentProps<\"div\"> & {\n // Title\n titleEnabled?: boolean;\n title?: string;\n titleFontSize?: FontSizeOptions;\n titleColor?: ColorOptions;\n\n // Description\n description?: string;\n descriptionFontSize?: FontSizeOptions;\n descriptionColor?: ColorOptions;\n\n // Design\n chartType?: \"bar\" | \"line\" | \"area\" | \"pie\";\n showLegend?: boolean;\n showTooltip?: boolean;\n showGrid?: boolean;\n width?: string;\n height?: string;\n background?: BackgroundValue;\n padding?: PaddingOptions;\n borderRadius?: BorderRadiusOptions;\n\n // Data\n dataKey?: string;\n xAxisKey?: string;\n /** Chart data - when provided via dataSource, this overrides defaultData */\n data?: ChartDataPoint[];\n /** Chart configuration - can be dynamically provided via dataSource */\n chartConfig?: Record<string, { label: string; color: string }>;\n};\n\n// Default sample data for demonstration\nconst defaultData = [\n { name: \"Jan\", value: 186 },\n { name: \"Feb\", value: 305 },\n { name: \"Mar\", value: 237 },\n { name: \"Apr\", value: 273 },\n { name: \"May\", value: 209 },\n { name: \"Jun\", value: 214 },\n];\n\n// Pie chart data with individual fill properties\nconst defaultPieData = [\n { name: \"Jan\", value: 186, fill: \"var(--chart-1)\" },\n { name: \"Feb\", value: 305, fill: \"var(--chart-2)\" },\n { name: \"Mar\", value: 237, fill: \"var(--chart-3)\" },\n { name: \"Apr\", value: 273, fill: \"var(--chart-4)\" },\n { name: \"May\", value: 209, fill: \"var(--chart-5)\" },\n];\n\nconst defaultChartConfig = {\n value: {\n label: \"Value\",\n color: \"var(--chart-1)\",\n },\n};\n\nexport function ChartWidget({\n titleEnabled = true,\n title = \"Chart Widget\",\n titleFontSize = \"lg\",\n titleColor = \"foreground\",\n\n description = \"Displaying sample data\",\n descriptionFontSize = \"md\",\n descriptionColor = \"foreground\",\n\n chartType = \"bar\",\n showLegend = false,\n showTooltip = true,\n showGrid = true,\n width = \"100%\",\n height = \"300px\",\n background = {\n type: \"solid\",\n color: \"background\",\n },\n padding = 4,\n borderRadius = \"md\",\n\n dataKey = \"value\",\n xAxisKey = \"name\",\n data,\n chartConfig,\n className,\n ...props\n}: ChartWidgetProps): React.JSX.Element {\n const backgroundColor = background.color || \"background\";\n const backgroundImage =\n (background.resource?.image_url || background.resource?.imageUrl) &&\n background.type === \"image\"\n ? `url(${background.resource.image_url || background.resource.imageUrl})`\n : \"none\";\n // Use provided data or fall back to default\n const chartData = data ?? defaultData;\n const chartPieData =\n chartType === \"pie\" && data\n ? data.map((item, index) => ({\n ...item,\n fill: `var(--chart-${(index % 5) + 1})`,\n }))\n : defaultPieData;\n const config = chartConfig ?? defaultChartConfig;\n const chartElement = (() => {\n switch (chartType) {\n case \"bar\":\n return (\n <RechartsBarChart data={chartData}>\n {showGrid && <CartesianGrid strokeDasharray=\"3 3\" />}\n <XAxis dataKey={xAxisKey} />\n <YAxis />\n {showTooltip && <ChartTooltip content={<ChartTooltipContent />} />}\n {showLegend && <ChartLegend content={<ChartLegendContent />} />}\n <Bar dataKey={dataKey} fill=\"var(--color-value)\" radius={8} />\n </RechartsBarChart>\n );\n\n case \"line\":\n return (\n <RechartsLineChart data={chartData}>\n {showGrid && <CartesianGrid strokeDasharray=\"3 3\" />}\n <XAxis dataKey={xAxisKey} />\n <YAxis />\n {showTooltip && <ChartTooltip content={<ChartTooltipContent />} />}\n {showLegend && <ChartLegend content={<ChartLegendContent />} />}\n <Line\n type=\"monotone\"\n dataKey={dataKey}\n stroke=\"var(--color-value)\"\n strokeWidth={2}\n dot={{ r: 4 }}\n />\n </RechartsLineChart>\n );\n\n case \"area\":\n return (\n <RechartsAreaChart data={chartData}>\n {showGrid && <CartesianGrid strokeDasharray=\"3 3\" />}\n <XAxis dataKey={xAxisKey} />\n <YAxis />\n {showTooltip && <ChartTooltip content={<ChartTooltipContent />} />}\n {showLegend && <ChartLegend content={<ChartLegendContent />} />}\n <Area\n type=\"monotone\"\n dataKey={dataKey}\n stroke=\"var(--color-value)\"\n fill=\"var(--color-value)\"\n fillOpacity={0.6}\n />\n </RechartsAreaChart>\n );\n\n case \"pie\":\n return (\n <RechartsPieChart>\n {showTooltip && (\n <ChartTooltip content={<ChartTooltipContent hideLabel />} />\n )}\n {showLegend && <ChartLegend content={<ChartLegendContent />} />}\n <Pie\n data={chartPieData}\n dataKey={dataKey}\n nameKey={xAxisKey}\n cx=\"50%\"\n cy=\"50%\"\n outerRadius={80}\n label\n />\n </RechartsPieChart>\n );\n\n default:\n // Fallback to bar chart for unknown chart types\n return (\n <RechartsBarChart data={chartData}>\n {showGrid && <CartesianGrid strokeDasharray=\"3 3\" />}\n <XAxis dataKey={xAxisKey} />\n <YAxis />\n {showTooltip && <ChartTooltip content={<ChartTooltipContent />} />}\n {showLegend && <ChartLegend content={<ChartLegendContent />} />}\n <Bar dataKey={dataKey} fill=\"var(--color-value)\" radius={8} />\n </RechartsBarChart>\n );\n }\n })();\n\n return (\n <Card\n className={`bg-${backgroundColor} p-${padding} rounded-${borderRadius} ${className}`}\n style={{\n width,\n maxWidth: \"100%\",\n backgroundImage,\n }}\n {...props}\n >\n <div className=\"p-6\">\n <div className=\"mb-4\">\n {titleEnabled && (\n <h3\n className={`text-${titleFontSize} text-${titleColor} font-bold`}\n >\n {title}\n </h3>\n )}\n {description && (\n <p\n className={`text-${descriptionFontSize} text-${descriptionColor}`}\n >\n {description}\n </p>\n )}\n </div>\n <ChartContainer config={config} style={{ height }}>\n {chartElement}\n </ChartContainer>\n </div>\n </Card>\n );\n}\n\nexport const chartWidgetPropertySchema: WidgetPropertySchema = {\n widgetType: \"ChartWidget\",\n displayName: \"Chart\",\n tabsConfig: [\n { id: \"styling\", label: \"Styling\" },\n { id: \"data\", label: \"Data\" },\n ],\n dataSourceTargetProps: [\"data\", \"chartConfig\"],\n fields: [\n // Content Tab - Title Group\n {\n key: \"titleEnabled\",\n label: \"Widget Title\",\n type: \"boolean\",\n description: \"Enable the title displayed above the chart\",\n defaultValue: true,\n tab: \"styling\",\n group: \"Title\",\n },\n {\n key: \"title\",\n label: \"Title\",\n type: \"text\",\n description: \"The chart title\",\n defaultValue: \"Chart Widget\",\n tab: \"styling\",\n group: \"Title\",\n requiresKeyToBeTrue: \"titleEnabled\",\n },\n getFontSizeField({\n key: \"titleFontSize\",\n label: \"Title Font Size\",\n description: \"Font size for the chart title\",\n defaultValue: \"lg\",\n tab: \"styling\",\n group: \"Title\",\n requiresKeyToBeTrue: \"titleEnabled\",\n }),\n getColorField({\n key: \"titleColor\",\n label: \"Title Color\",\n description: \"Color for the chart title\",\n defaultValue: \"foreground\",\n tab: \"styling\",\n group: \"Title\",\n requiresKeyToBeTrue: \"titleEnabled\",\n }),\n\n // Content Tab - Description Group\n {\n key: \"description\",\n label: \"Description\",\n type: \"textarea\",\n description: \"The chart description\",\n rows: 2,\n defaultValue: \"Displaying sample data\",\n tab: \"styling\",\n group: \"Description\",\n },\n getFontSizeField({\n key: \"descriptionFontSize\",\n label: \"Description Font Size\",\n description: \"Font size for the chart description\",\n defaultValue: \"md\",\n tab: \"styling\",\n group: \"Description\",\n }),\n getColorField({\n key: \"descriptionColor\",\n label: \"Description Color\",\n description: \"Color for the chart description\",\n defaultValue: \"foreground\",\n tab: \"styling\",\n group: \"Description\",\n }),\n\n // Styling Tab - Design Group\n {\n key: \"chartType\",\n label: \"Chart Type\",\n type: \"select\",\n description: \"Type of chart to display\",\n options: [\n { label: \"Bar Chart\", value: \"bar\" },\n { label: \"Line Chart\", value: \"line\" },\n { label: \"Area Chart\", value: \"area\" },\n { label: \"Pie Chart\", value: \"pie\" },\n ],\n defaultValue: \"bar\",\n tab: \"styling\",\n group: \"Design\",\n },\n {\n key: \"showLegend\",\n label: \"Show Legend\",\n type: \"boolean\",\n description: \"Display chart legend\",\n defaultValue: false,\n tab: \"styling\",\n group: \"Design\",\n },\n {\n key: \"showTooltip\",\n label: \"Show Tooltip\",\n type: \"boolean\",\n description: \"Display tooltip on hover\",\n defaultValue: true,\n tab: \"styling\",\n group: \"Design\",\n },\n {\n key: \"showGrid\",\n label: \"Show Grid\",\n type: \"boolean\",\n description: \"Display background grid lines\",\n defaultValue: true,\n tab: \"styling\",\n group: \"Design\",\n },\n {\n key: \"separator\",\n type: \"separator\",\n label: \"Separator\",\n tab: \"styling\",\n group: \"Design\",\n },\n {\n key: \"width\",\n label: \"Width\",\n type: \"text\",\n description:\n \"Width of the chart container (CSS value, e.g., 100%, 600px)\",\n defaultValue: \"100%\",\n tab: \"styling\",\n group: \"Design\",\n },\n getHeightField({\n key: \"height\",\n label: \"Height\",\n description: \"Height of the chart\",\n defaultValue: \"300px\",\n tab: \"styling\",\n group: \"Design\",\n }),\n {\n key: \"separator2\",\n type: \"separator\",\n label: \"Separator\",\n tab: \"styling\",\n group: \"Design\",\n },\n {\n type: \"background\",\n key: \"background\",\n label: \"Background\",\n description: \"Background for the chart container\",\n defaultValue: \"background\",\n tab: \"styling\",\n group: \"Design\",\n },\n getPaddingField({\n key: \"padding\",\n label: \"Padding\",\n description: \"Padding for the chart container\",\n defaultValue: 4,\n tab: \"styling\",\n group: \"Design\",\n }),\n getBorderRadiusField({\n key: \"borderRadius\",\n label: \"Border Radius\",\n description: \"Border radius for the chart container\",\n defaultValue: \"md\",\n tab: \"styling\",\n group: \"Design\",\n }),\n\n // Data Tab - Data Group\n {\n key: \"dataSource\",\n label: \"Data Source\",\n type: \"dataSource\",\n description: \"Configure dynamic data fetching from an API\",\n tab: \"data\",\n group: \"Data\",\n },\n {\n key: \"dataKey\",\n label: \"Data Key\",\n type: \"select\",\n description: \"Key in the data to use for chart values\",\n options: [{ label: \"value\", value: \"value\" }],\n defaultValue: \"value\",\n tab: \"data\",\n group: \"Data\",\n },\n {\n key: \"xAxisKey\",\n label: \"X-Axis Key\",\n type: \"select\",\n description: \"Key in the data to use for X-axis labels\",\n options: [{ label: \"name\", value: \"name\" }],\n defaultValue: \"name\",\n tab: \"data\",\n group: \"Data\",\n },\n ],\n} satisfies WidgetPropertySchema;\n"],"mappings":";;;;;;;;;;AA0EA,MAAM,cAAc;CAClB;EAAE,MAAM;EAAO,OAAO;EAAK;CAC3B;EAAE,MAAM;EAAO,OAAO;EAAK;CAC3B;EAAE,MAAM;EAAO,OAAO;EAAK;CAC3B;EAAE,MAAM;EAAO,OAAO;EAAK;CAC3B;EAAE,MAAM;EAAO,OAAO;EAAK;CAC3B;EAAE,MAAM;EAAO,OAAO;EAAK;CAC5B;AAGD,MAAM,iBAAiB;CACrB;EAAE,MAAM;EAAO,OAAO;EAAK,MAAM;EAAkB;CACnD;EAAE,MAAM;EAAO,OAAO;EAAK,MAAM;EAAkB;CACnD;EAAE,MAAM;EAAO,OAAO;EAAK,MAAM;EAAkB;CACnD;EAAE,MAAM;EAAO,OAAO;EAAK,MAAM;EAAkB;CACnD;EAAE,MAAM;EAAO,OAAO;EAAK,MAAM;EAAkB;CACpD;AAED,MAAM,qBAAqB,EACzB,OAAO;CACL,OAAO;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K;GACL,OAAO;GACP,qBAAqB;GACtB,CAAC;EAGF;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,MAAM;GACN,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD,iBAAiB;GACf,KAAK;GACL,OAAO;GACP,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR,CAAC;EACF,cAAc;GACZ,KAAK;GACL,OAAO;GACP,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR,CAAC;EAGF;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,SAAS;IACP;KAAE,OAAO;KAAa,OAAO;KAAO;IACpC;KAAE,OAAO;KAAc,OAAO;KAAQ;IACtC;KAAE,OAAO;KAAc,OAAO;KAAQ;IACtC;KAAE,OAAO;KAAa,OAAO;KAAO;IACrC;GACD,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,MAAM;GACN,OAAO;GACP,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aACE;GACF,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD,eAAe;GACb,KAAK;GACL,OAAO;GACP,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR,CAAC;EACF;GACE,KAAK;GACL,MAAM;GACN,OAAO;GACP,KAAK;GACL,OAAO;GACR;EACD;GACE,MAAM;GACN,KAAK;GACL,OAAO;GACP,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD,gBAAgB;GACd,KAAK;GACL,OAAO;GACP,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR,CAAC;EACF,qBAAqB;GACnB,KAAK;GACL,OAAO;GACP,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR,CAAC;EAGF;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,SAAS,CAAC;IAAE,OAAO;IAAS,OAAO;IAAS,CAAC;GAC7C,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,SAAS,CAAC;IAAE,OAAO;IAAQ,OAAO;IAAQ,CAAC;GAC3C,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACF;CACF"}
@@ -334,9 +334,6 @@ const chartWidgetPropertySchema = {
334
334
  key: "height",
335
335
  label: "Height",
336
336
  description: "Height of the chart",
337
- min: 50,
338
- max: 1200,
339
- step: 10,
340
337
  defaultValue: "300px",
341
338
  tab: "styling",
342
339
  group: "Design"
@@ -429,4 +426,4 @@ Object.defineProperty(exports, "chartWidgetPropertySchema", {
429
426
  }
430
427
  });
431
428
 
432
- //# sourceMappingURL=ChartWidget-DQB7K6S0.cjs.map
429
+ //# sourceMappingURL=ChartWidget-aspz2XF6.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChartWidget-DQB7K6S0.cjs","names":["RechartsBarChart","CartesianGrid","XAxis","YAxis","ChartTooltip","ChartTooltipContent","ChartLegend","ChartLegendContent","Bar","RechartsLineChart","Line","RechartsAreaChart","Area","RechartsPieChart","Pie","Card","ChartContainer"],"sources":["../src/widgets/ChartWidget.tsx"],"sourcesContent":["import type { WidgetPropertySchema } from \"@fluid-app/portal-core/registries\";\nimport {\n Card,\n ChartContainer,\n ChartLegend,\n ChartLegendContent,\n ChartTooltip,\n ChartTooltipContent,\n} from \"@fluid-app/ui-primitives\";\nimport type { ComponentProps } from \"react\";\nimport type React from \"react\";\nimport {\n Bar,\n BarChart as RechartsBarChart,\n Line,\n LineChart as RechartsLineChart,\n Area,\n AreaChart as RechartsAreaChart,\n Pie,\n PieChart as RechartsPieChart,\n XAxis,\n YAxis,\n CartesianGrid,\n} from \"recharts\";\nimport {\n getBorderRadiusField,\n getColorField,\n getFontSizeField,\n getHeightField,\n getPaddingField,\n} from \"../core/fields\";\nimport type {\n BackgroundValue,\n BorderRadiusOptions,\n ColorOptions,\n FontSizeOptions,\n PaddingOptions,\n} from \"@fluid-app/portal-core/types\";\n\ntype ChartDataPoint = Record<string, unknown>;\n\ntype ChartWidgetProps = ComponentProps<\"div\"> & {\n // Title\n titleEnabled?: boolean;\n title?: string;\n titleFontSize?: FontSizeOptions;\n titleColor?: ColorOptions;\n\n // Description\n description?: string;\n descriptionFontSize?: FontSizeOptions;\n descriptionColor?: ColorOptions;\n\n // Design\n chartType?: \"bar\" | \"line\" | \"area\" | \"pie\";\n showLegend?: boolean;\n showTooltip?: boolean;\n showGrid?: boolean;\n width?: string;\n height?: string;\n background?: BackgroundValue;\n padding?: PaddingOptions;\n borderRadius?: BorderRadiusOptions;\n\n // Data\n dataKey?: string;\n xAxisKey?: string;\n /** Chart data - when provided via dataSource, this overrides defaultData */\n data?: ChartDataPoint[];\n /** Chart configuration - can be dynamically provided via dataSource */\n chartConfig?: Record<string, { label: string; color: string }>;\n};\n\n// Default sample data for demonstration\nconst defaultData = [\n { name: \"Jan\", value: 186 },\n { name: \"Feb\", value: 305 },\n { name: \"Mar\", value: 237 },\n { name: \"Apr\", value: 273 },\n { name: \"May\", value: 209 },\n { name: \"Jun\", value: 214 },\n];\n\n// Pie chart data with individual fill properties\nconst defaultPieData = [\n { name: \"Jan\", value: 186, fill: \"var(--chart-1)\" },\n { name: \"Feb\", value: 305, fill: \"var(--chart-2)\" },\n { name: \"Mar\", value: 237, fill: \"var(--chart-3)\" },\n { name: \"Apr\", value: 273, fill: \"var(--chart-4)\" },\n { name: \"May\", value: 209, fill: \"var(--chart-5)\" },\n];\n\nconst defaultChartConfig = {\n value: {\n label: \"Value\",\n color: \"var(--chart-1)\",\n },\n};\n\nexport function ChartWidget({\n titleEnabled = true,\n title = \"Chart Widget\",\n titleFontSize = \"lg\",\n titleColor = \"foreground\",\n\n description = \"Displaying sample data\",\n descriptionFontSize = \"md\",\n descriptionColor = \"foreground\",\n\n chartType = \"bar\",\n showLegend = false,\n showTooltip = true,\n showGrid = true,\n width = \"100%\",\n height = \"300px\",\n background = {\n type: \"solid\",\n color: \"background\",\n },\n padding = 4,\n borderRadius = \"md\",\n\n dataKey = \"value\",\n xAxisKey = \"name\",\n data,\n chartConfig,\n className,\n ...props\n}: ChartWidgetProps): React.JSX.Element {\n const backgroundColor = background.color || \"background\";\n const backgroundImage =\n (background.resource?.image_url || background.resource?.imageUrl) &&\n background.type === \"image\"\n ? `url(${background.resource.image_url || background.resource.imageUrl})`\n : \"none\";\n // Use provided data or fall back to default\n const chartData = data ?? defaultData;\n const chartPieData =\n chartType === \"pie\" && data\n ? data.map((item, index) => ({\n ...item,\n fill: `var(--chart-${(index % 5) + 1})`,\n }))\n : defaultPieData;\n const config = chartConfig ?? defaultChartConfig;\n const chartElement = (() => {\n switch (chartType) {\n case \"bar\":\n return (\n <RechartsBarChart data={chartData}>\n {showGrid && <CartesianGrid strokeDasharray=\"3 3\" />}\n <XAxis dataKey={xAxisKey} />\n <YAxis />\n {showTooltip && <ChartTooltip content={<ChartTooltipContent />} />}\n {showLegend && <ChartLegend content={<ChartLegendContent />} />}\n <Bar dataKey={dataKey} fill=\"var(--color-value)\" radius={8} />\n </RechartsBarChart>\n );\n\n case \"line\":\n return (\n <RechartsLineChart data={chartData}>\n {showGrid && <CartesianGrid strokeDasharray=\"3 3\" />}\n <XAxis dataKey={xAxisKey} />\n <YAxis />\n {showTooltip && <ChartTooltip content={<ChartTooltipContent />} />}\n {showLegend && <ChartLegend content={<ChartLegendContent />} />}\n <Line\n type=\"monotone\"\n dataKey={dataKey}\n stroke=\"var(--color-value)\"\n strokeWidth={2}\n dot={{ r: 4 }}\n />\n </RechartsLineChart>\n );\n\n case \"area\":\n return (\n <RechartsAreaChart data={chartData}>\n {showGrid && <CartesianGrid strokeDasharray=\"3 3\" />}\n <XAxis dataKey={xAxisKey} />\n <YAxis />\n {showTooltip && <ChartTooltip content={<ChartTooltipContent />} />}\n {showLegend && <ChartLegend content={<ChartLegendContent />} />}\n <Area\n type=\"monotone\"\n dataKey={dataKey}\n stroke=\"var(--color-value)\"\n fill=\"var(--color-value)\"\n fillOpacity={0.6}\n />\n </RechartsAreaChart>\n );\n\n case \"pie\":\n return (\n <RechartsPieChart>\n {showTooltip && (\n <ChartTooltip content={<ChartTooltipContent hideLabel />} />\n )}\n {showLegend && <ChartLegend content={<ChartLegendContent />} />}\n <Pie\n data={chartPieData}\n dataKey={dataKey}\n nameKey={xAxisKey}\n cx=\"50%\"\n cy=\"50%\"\n outerRadius={80}\n label\n />\n </RechartsPieChart>\n );\n\n default:\n // Fallback to bar chart for unknown chart types\n return (\n <RechartsBarChart data={chartData}>\n {showGrid && <CartesianGrid strokeDasharray=\"3 3\" />}\n <XAxis dataKey={xAxisKey} />\n <YAxis />\n {showTooltip && <ChartTooltip content={<ChartTooltipContent />} />}\n {showLegend && <ChartLegend content={<ChartLegendContent />} />}\n <Bar dataKey={dataKey} fill=\"var(--color-value)\" radius={8} />\n </RechartsBarChart>\n );\n }\n })();\n\n return (\n <Card\n className={`bg-${backgroundColor} p-${padding} rounded-${borderRadius} ${className}`}\n style={{\n width,\n maxWidth: \"100%\",\n backgroundImage,\n }}\n {...props}\n >\n <div className=\"p-6\">\n <div className=\"mb-4\">\n {titleEnabled && (\n <h3\n className={`text-${titleFontSize} text-${titleColor} font-bold`}\n >\n {title}\n </h3>\n )}\n {description && (\n <p\n className={`text-${descriptionFontSize} text-${descriptionColor}`}\n >\n {description}\n </p>\n )}\n </div>\n <ChartContainer config={config} style={{ height }}>\n {chartElement}\n </ChartContainer>\n </div>\n </Card>\n );\n}\n\nexport const chartWidgetPropertySchema: WidgetPropertySchema = {\n widgetType: \"ChartWidget\",\n displayName: \"Chart\",\n tabsConfig: [\n { id: \"styling\", label: \"Styling\" },\n { id: \"data\", label: \"Data\" },\n ],\n dataSourceTargetProps: [\"data\", \"chartConfig\"],\n fields: [\n // Content Tab - Title Group\n {\n key: \"titleEnabled\",\n label: \"Widget Title\",\n type: \"boolean\",\n description: \"Enable the title displayed above the chart\",\n defaultValue: true,\n tab: \"styling\",\n group: \"Title\",\n },\n {\n key: \"title\",\n label: \"Title\",\n type: \"text\",\n description: \"The chart title\",\n defaultValue: \"Chart Widget\",\n tab: \"styling\",\n group: \"Title\",\n requiresKeyToBeTrue: \"titleEnabled\",\n },\n getFontSizeField({\n key: \"titleFontSize\",\n label: \"Title Font Size\",\n description: \"Font size for the chart title\",\n defaultValue: \"lg\",\n tab: \"styling\",\n group: \"Title\",\n requiresKeyToBeTrue: \"titleEnabled\",\n }),\n getColorField({\n key: \"titleColor\",\n label: \"Title Color\",\n description: \"Color for the chart title\",\n defaultValue: \"foreground\",\n tab: \"styling\",\n group: \"Title\",\n requiresKeyToBeTrue: \"titleEnabled\",\n }),\n\n // Content Tab - Description Group\n {\n key: \"description\",\n label: \"Description\",\n type: \"textarea\",\n description: \"The chart description\",\n rows: 2,\n defaultValue: \"Displaying sample data\",\n tab: \"styling\",\n group: \"Description\",\n },\n getFontSizeField({\n key: \"descriptionFontSize\",\n label: \"Description Font Size\",\n description: \"Font size for the chart description\",\n defaultValue: \"md\",\n tab: \"styling\",\n group: \"Description\",\n }),\n getColorField({\n key: \"descriptionColor\",\n label: \"Description Color\",\n description: \"Color for the chart description\",\n defaultValue: \"foreground\",\n tab: \"styling\",\n group: \"Description\",\n }),\n\n // Styling Tab - Design Group\n {\n key: \"chartType\",\n label: \"Chart Type\",\n type: \"select\",\n description: \"Type of chart to display\",\n options: [\n { label: \"Bar Chart\", value: \"bar\" },\n { label: \"Line Chart\", value: \"line\" },\n { label: \"Area Chart\", value: \"area\" },\n { label: \"Pie Chart\", value: \"pie\" },\n ],\n defaultValue: \"bar\",\n tab: \"styling\",\n group: \"Design\",\n },\n {\n key: \"showLegend\",\n label: \"Show Legend\",\n type: \"boolean\",\n description: \"Display chart legend\",\n defaultValue: false,\n tab: \"styling\",\n group: \"Design\",\n },\n {\n key: \"showTooltip\",\n label: \"Show Tooltip\",\n type: \"boolean\",\n description: \"Display tooltip on hover\",\n defaultValue: true,\n tab: \"styling\",\n group: \"Design\",\n },\n {\n key: \"showGrid\",\n label: \"Show Grid\",\n type: \"boolean\",\n description: \"Display background grid lines\",\n defaultValue: true,\n tab: \"styling\",\n group: \"Design\",\n },\n {\n key: \"separator\",\n type: \"separator\",\n label: \"Separator\",\n tab: \"styling\",\n group: \"Design\",\n },\n {\n key: \"width\",\n label: \"Width\",\n type: \"text\",\n description:\n \"Width of the chart container (CSS value, e.g., 100%, 600px)\",\n defaultValue: \"100%\",\n tab: \"styling\",\n group: \"Design\",\n },\n getHeightField({\n key: \"height\",\n label: \"Height\",\n description: \"Height of the chart\",\n min: 50,\n max: 1200,\n step: 10,\n defaultValue: \"300px\",\n tab: \"styling\",\n group: \"Design\",\n }),\n {\n key: \"separator2\",\n type: \"separator\",\n label: \"Separator\",\n tab: \"styling\",\n group: \"Design\",\n },\n {\n type: \"background\",\n key: \"background\",\n label: \"Background\",\n description: \"Background for the chart container\",\n defaultValue: \"background\",\n tab: \"styling\",\n group: \"Design\",\n },\n getPaddingField({\n key: \"padding\",\n label: \"Padding\",\n description: \"Padding for the chart container\",\n defaultValue: 4,\n tab: \"styling\",\n group: \"Design\",\n }),\n getBorderRadiusField({\n key: \"borderRadius\",\n label: \"Border Radius\",\n description: \"Border radius for the chart container\",\n defaultValue: \"md\",\n tab: \"styling\",\n group: \"Design\",\n }),\n\n // Data Tab - Data Group\n {\n key: \"dataSource\",\n label: \"Data Source\",\n type: \"dataSource\",\n description: \"Configure dynamic data fetching from an API\",\n tab: \"data\",\n group: \"Data\",\n },\n {\n key: \"dataKey\",\n label: \"Data Key\",\n type: \"select\",\n description: \"Key in the data to use for chart values\",\n options: [{ label: \"value\", value: \"value\" }],\n defaultValue: \"value\",\n tab: \"data\",\n group: \"Data\",\n },\n {\n key: \"xAxisKey\",\n label: \"X-Axis Key\",\n type: \"select\",\n description: \"Key in the data to use for X-axis labels\",\n options: [{ label: \"name\", value: \"name\" }],\n defaultValue: \"name\",\n tab: \"data\",\n group: \"Data\",\n },\n ],\n} satisfies WidgetPropertySchema;\n"],"mappings":";;;;;;;;;;AA0EA,MAAM,cAAc;CAClB;EAAE,MAAM;EAAO,OAAO;EAAK;CAC3B;EAAE,MAAM;EAAO,OAAO;EAAK;CAC3B;EAAE,MAAM;EAAO,OAAO;EAAK;CAC3B;EAAE,MAAM;EAAO,OAAO;EAAK;CAC3B;EAAE,MAAM;EAAO,OAAO;EAAK;CAC3B;EAAE,MAAM;EAAO,OAAO;EAAK;CAC5B;AAGD,MAAM,iBAAiB;CACrB;EAAE,MAAM;EAAO,OAAO;EAAK,MAAM;EAAkB;CACnD;EAAE,MAAM;EAAO,OAAO;EAAK,MAAM;EAAkB;CACnD;EAAE,MAAM;EAAO,OAAO;EAAK,MAAM;EAAkB;CACnD;EAAE,MAAM;EAAO,OAAO;EAAK,MAAM;EAAkB;CACnD;EAAE,MAAM;EAAO,OAAO;EAAK,MAAM;EAAkB;CACpD;AAED,MAAM,qBAAqB,EACzB,OAAO;CACL,OAAO;CACP,OAAO;CACR,EACF;AAED,SAAgB,YAAY,EAC1B,eAAe,MACf,QAAQ,gBACR,gBAAgB,MAChB,aAAa,cAEb,cAAc,0BACd,sBAAsB,MACtB,mBAAmB,cAEnB,YAAY,OACZ,aAAa,OACb,cAAc,MACd,WAAW,MACX,QAAQ,QACR,SAAS,SACT,aAAa;CACX,MAAM;CACN,OAAO;CACR,EACD,UAAU,GACV,eAAe,MAEf,UAAU,SACV,WAAW,QACX,MACA,aACA,WACA,GAAG,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L,OAAO;GACR,CAAC;EAGF;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,SAAS;IACP;KAAE,OAAO;KAAa,OAAO;KAAO;IACpC;KAAE,OAAO;KAAc,OAAO;KAAQ;IACtC;KAAE,OAAO;KAAc,OAAO;KAAQ;IACtC;KAAE,OAAO;KAAa,OAAO;KAAO;IACrC;GACD,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,MAAM;GACN,OAAO;GACP,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aACE;GACF,cAAc;GACd,KAAK;GACL,OAAO;GACR;wDACc;GACb,KAAK;GACL,OAAO;GACP,aAAa;GACb,KAAK;GACL,KAAK;GACL,MAAM;GACN,cAAc;GACd,KAAK;GACL,OAAO;GACR,CAAC;EACF;GACE,KAAK;GACL,MAAM;GACN,OAAO;GACP,KAAK;GACL,OAAO;GACR;EACD;GACE,MAAM;GACN,KAAK;GACL,OAAO;GACP,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR;yDACe;GACd,KAAK;GACL,OAAO;GACP,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR,CAAC;8DACmB;GACnB,KAAK;GACL,OAAO;GACP,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR,CAAC;EAGF;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,SAAS,CAAC;IAAE,OAAO;IAAS,OAAO;IAAS,CAAC;GAC7C,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,SAAS,CAAC;IAAE,OAAO;IAAQ,OAAO;IAAQ,CAAC;GAC3C,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACF;CACF"}
1
+ {"version":3,"file":"ChartWidget-aspz2XF6.cjs","names":["RechartsBarChart","CartesianGrid","XAxis","YAxis","ChartTooltip","ChartTooltipContent","ChartLegend","ChartLegendContent","Bar","RechartsLineChart","Line","RechartsAreaChart","Area","RechartsPieChart","Pie","Card","ChartContainer"],"sources":["../src/widgets/ChartWidget.tsx"],"sourcesContent":["import type { WidgetPropertySchema } from \"@fluid-app/portal-core/registries\";\nimport {\n Card,\n ChartContainer,\n ChartLegend,\n ChartLegendContent,\n ChartTooltip,\n ChartTooltipContent,\n} from \"@fluid-app/ui-primitives\";\nimport type { ComponentProps } from \"react\";\nimport type React from \"react\";\nimport {\n Bar,\n BarChart as RechartsBarChart,\n Line,\n LineChart as RechartsLineChart,\n Area,\n AreaChart as RechartsAreaChart,\n Pie,\n PieChart as RechartsPieChart,\n XAxis,\n YAxis,\n CartesianGrid,\n} from \"recharts\";\nimport {\n getBorderRadiusField,\n getColorField,\n getFontSizeField,\n getHeightField,\n getPaddingField,\n} from \"../core/fields\";\nimport type {\n BackgroundValue,\n BorderRadiusOptions,\n ColorOptions,\n FontSizeOptions,\n PaddingOptions,\n} from \"@fluid-app/portal-core/types\";\n\ntype ChartDataPoint = Record<string, unknown>;\n\ntype ChartWidgetProps = ComponentProps<\"div\"> & {\n // Title\n titleEnabled?: boolean;\n title?: string;\n titleFontSize?: FontSizeOptions;\n titleColor?: ColorOptions;\n\n // Description\n description?: string;\n descriptionFontSize?: FontSizeOptions;\n descriptionColor?: ColorOptions;\n\n // Design\n chartType?: \"bar\" | \"line\" | \"area\" | \"pie\";\n showLegend?: boolean;\n showTooltip?: boolean;\n showGrid?: boolean;\n width?: string;\n height?: string;\n background?: BackgroundValue;\n padding?: PaddingOptions;\n borderRadius?: BorderRadiusOptions;\n\n // Data\n dataKey?: string;\n xAxisKey?: string;\n /** Chart data - when provided via dataSource, this overrides defaultData */\n data?: ChartDataPoint[];\n /** Chart configuration - can be dynamically provided via dataSource */\n chartConfig?: Record<string, { label: string; color: string }>;\n};\n\n// Default sample data for demonstration\nconst defaultData = [\n { name: \"Jan\", value: 186 },\n { name: \"Feb\", value: 305 },\n { name: \"Mar\", value: 237 },\n { name: \"Apr\", value: 273 },\n { name: \"May\", value: 209 },\n { name: \"Jun\", value: 214 },\n];\n\n// Pie chart data with individual fill properties\nconst defaultPieData = [\n { name: \"Jan\", value: 186, fill: \"var(--chart-1)\" },\n { name: \"Feb\", value: 305, fill: \"var(--chart-2)\" },\n { name: \"Mar\", value: 237, fill: \"var(--chart-3)\" },\n { name: \"Apr\", value: 273, fill: \"var(--chart-4)\" },\n { name: \"May\", value: 209, fill: \"var(--chart-5)\" },\n];\n\nconst defaultChartConfig = {\n value: {\n label: \"Value\",\n color: \"var(--chart-1)\",\n },\n};\n\nexport function ChartWidget({\n titleEnabled = true,\n title = \"Chart Widget\",\n titleFontSize = \"lg\",\n titleColor = \"foreground\",\n\n description = \"Displaying sample data\",\n descriptionFontSize = \"md\",\n descriptionColor = \"foreground\",\n\n chartType = \"bar\",\n showLegend = false,\n showTooltip = true,\n showGrid = true,\n width = \"100%\",\n height = \"300px\",\n background = {\n type: \"solid\",\n color: \"background\",\n },\n padding = 4,\n borderRadius = \"md\",\n\n dataKey = \"value\",\n xAxisKey = \"name\",\n data,\n chartConfig,\n className,\n ...props\n}: ChartWidgetProps): React.JSX.Element {\n const backgroundColor = background.color || \"background\";\n const backgroundImage =\n (background.resource?.image_url || background.resource?.imageUrl) &&\n background.type === \"image\"\n ? `url(${background.resource.image_url || background.resource.imageUrl})`\n : \"none\";\n // Use provided data or fall back to default\n const chartData = data ?? defaultData;\n const chartPieData =\n chartType === \"pie\" && data\n ? data.map((item, index) => ({\n ...item,\n fill: `var(--chart-${(index % 5) + 1})`,\n }))\n : defaultPieData;\n const config = chartConfig ?? defaultChartConfig;\n const chartElement = (() => {\n switch (chartType) {\n case \"bar\":\n return (\n <RechartsBarChart data={chartData}>\n {showGrid && <CartesianGrid strokeDasharray=\"3 3\" />}\n <XAxis dataKey={xAxisKey} />\n <YAxis />\n {showTooltip && <ChartTooltip content={<ChartTooltipContent />} />}\n {showLegend && <ChartLegend content={<ChartLegendContent />} />}\n <Bar dataKey={dataKey} fill=\"var(--color-value)\" radius={8} />\n </RechartsBarChart>\n );\n\n case \"line\":\n return (\n <RechartsLineChart data={chartData}>\n {showGrid && <CartesianGrid strokeDasharray=\"3 3\" />}\n <XAxis dataKey={xAxisKey} />\n <YAxis />\n {showTooltip && <ChartTooltip content={<ChartTooltipContent />} />}\n {showLegend && <ChartLegend content={<ChartLegendContent />} />}\n <Line\n type=\"monotone\"\n dataKey={dataKey}\n stroke=\"var(--color-value)\"\n strokeWidth={2}\n dot={{ r: 4 }}\n />\n </RechartsLineChart>\n );\n\n case \"area\":\n return (\n <RechartsAreaChart data={chartData}>\n {showGrid && <CartesianGrid strokeDasharray=\"3 3\" />}\n <XAxis dataKey={xAxisKey} />\n <YAxis />\n {showTooltip && <ChartTooltip content={<ChartTooltipContent />} />}\n {showLegend && <ChartLegend content={<ChartLegendContent />} />}\n <Area\n type=\"monotone\"\n dataKey={dataKey}\n stroke=\"var(--color-value)\"\n fill=\"var(--color-value)\"\n fillOpacity={0.6}\n />\n </RechartsAreaChart>\n );\n\n case \"pie\":\n return (\n <RechartsPieChart>\n {showTooltip && (\n <ChartTooltip content={<ChartTooltipContent hideLabel />} />\n )}\n {showLegend && <ChartLegend content={<ChartLegendContent />} />}\n <Pie\n data={chartPieData}\n dataKey={dataKey}\n nameKey={xAxisKey}\n cx=\"50%\"\n cy=\"50%\"\n outerRadius={80}\n label\n />\n </RechartsPieChart>\n );\n\n default:\n // Fallback to bar chart for unknown chart types\n return (\n <RechartsBarChart data={chartData}>\n {showGrid && <CartesianGrid strokeDasharray=\"3 3\" />}\n <XAxis dataKey={xAxisKey} />\n <YAxis />\n {showTooltip && <ChartTooltip content={<ChartTooltipContent />} />}\n {showLegend && <ChartLegend content={<ChartLegendContent />} />}\n <Bar dataKey={dataKey} fill=\"var(--color-value)\" radius={8} />\n </RechartsBarChart>\n );\n }\n })();\n\n return (\n <Card\n className={`bg-${backgroundColor} p-${padding} rounded-${borderRadius} ${className}`}\n style={{\n width,\n maxWidth: \"100%\",\n backgroundImage,\n }}\n {...props}\n >\n <div className=\"p-6\">\n <div className=\"mb-4\">\n {titleEnabled && (\n <h3\n className={`text-${titleFontSize} text-${titleColor} font-bold`}\n >\n {title}\n </h3>\n )}\n {description && (\n <p\n className={`text-${descriptionFontSize} text-${descriptionColor}`}\n >\n {description}\n </p>\n )}\n </div>\n <ChartContainer config={config} style={{ height }}>\n {chartElement}\n </ChartContainer>\n </div>\n </Card>\n );\n}\n\nexport const chartWidgetPropertySchema: WidgetPropertySchema = {\n widgetType: \"ChartWidget\",\n displayName: \"Chart\",\n tabsConfig: [\n { id: \"styling\", label: \"Styling\" },\n { id: \"data\", label: \"Data\" },\n ],\n dataSourceTargetProps: [\"data\", \"chartConfig\"],\n fields: [\n // Content Tab - Title Group\n {\n key: \"titleEnabled\",\n label: \"Widget Title\",\n type: \"boolean\",\n description: \"Enable the title displayed above the chart\",\n defaultValue: true,\n tab: \"styling\",\n group: \"Title\",\n },\n {\n key: \"title\",\n label: \"Title\",\n type: \"text\",\n description: \"The chart title\",\n defaultValue: \"Chart Widget\",\n tab: \"styling\",\n group: \"Title\",\n requiresKeyToBeTrue: \"titleEnabled\",\n },\n getFontSizeField({\n key: \"titleFontSize\",\n label: \"Title Font Size\",\n description: \"Font size for the chart title\",\n defaultValue: \"lg\",\n tab: \"styling\",\n group: \"Title\",\n requiresKeyToBeTrue: \"titleEnabled\",\n }),\n getColorField({\n key: \"titleColor\",\n label: \"Title Color\",\n description: \"Color for the chart title\",\n defaultValue: \"foreground\",\n tab: \"styling\",\n group: \"Title\",\n requiresKeyToBeTrue: \"titleEnabled\",\n }),\n\n // Content Tab - Description Group\n {\n key: \"description\",\n label: \"Description\",\n type: \"textarea\",\n description: \"The chart description\",\n rows: 2,\n defaultValue: \"Displaying sample data\",\n tab: \"styling\",\n group: \"Description\",\n },\n getFontSizeField({\n key: \"descriptionFontSize\",\n label: \"Description Font Size\",\n description: \"Font size for the chart description\",\n defaultValue: \"md\",\n tab: \"styling\",\n group: \"Description\",\n }),\n getColorField({\n key: \"descriptionColor\",\n label: \"Description Color\",\n description: \"Color for the chart description\",\n defaultValue: \"foreground\",\n tab: \"styling\",\n group: \"Description\",\n }),\n\n // Styling Tab - Design Group\n {\n key: \"chartType\",\n label: \"Chart Type\",\n type: \"select\",\n description: \"Type of chart to display\",\n options: [\n { label: \"Bar Chart\", value: \"bar\" },\n { label: \"Line Chart\", value: \"line\" },\n { label: \"Area Chart\", value: \"area\" },\n { label: \"Pie Chart\", value: \"pie\" },\n ],\n defaultValue: \"bar\",\n tab: \"styling\",\n group: \"Design\",\n },\n {\n key: \"showLegend\",\n label: \"Show Legend\",\n type: \"boolean\",\n description: \"Display chart legend\",\n defaultValue: false,\n tab: \"styling\",\n group: \"Design\",\n },\n {\n key: \"showTooltip\",\n label: \"Show Tooltip\",\n type: \"boolean\",\n description: \"Display tooltip on hover\",\n defaultValue: true,\n tab: \"styling\",\n group: \"Design\",\n },\n {\n key: \"showGrid\",\n label: \"Show Grid\",\n type: \"boolean\",\n description: \"Display background grid lines\",\n defaultValue: true,\n tab: \"styling\",\n group: \"Design\",\n },\n {\n key: \"separator\",\n type: \"separator\",\n label: \"Separator\",\n tab: \"styling\",\n group: \"Design\",\n },\n {\n key: \"width\",\n label: \"Width\",\n type: \"text\",\n description:\n \"Width of the chart container (CSS value, e.g., 100%, 600px)\",\n defaultValue: \"100%\",\n tab: \"styling\",\n group: \"Design\",\n },\n getHeightField({\n key: \"height\",\n label: \"Height\",\n description: \"Height of the chart\",\n defaultValue: \"300px\",\n tab: \"styling\",\n group: \"Design\",\n }),\n {\n key: \"separator2\",\n type: \"separator\",\n label: \"Separator\",\n tab: \"styling\",\n group: \"Design\",\n },\n {\n type: \"background\",\n key: \"background\",\n label: \"Background\",\n description: \"Background for the chart container\",\n defaultValue: \"background\",\n tab: \"styling\",\n group: \"Design\",\n },\n getPaddingField({\n key: \"padding\",\n label: \"Padding\",\n description: \"Padding for the chart container\",\n defaultValue: 4,\n tab: \"styling\",\n group: \"Design\",\n }),\n getBorderRadiusField({\n key: \"borderRadius\",\n label: \"Border Radius\",\n description: \"Border radius for the chart container\",\n defaultValue: \"md\",\n tab: \"styling\",\n group: \"Design\",\n }),\n\n // Data Tab - Data Group\n {\n key: \"dataSource\",\n label: \"Data Source\",\n type: \"dataSource\",\n description: \"Configure dynamic data fetching from an API\",\n tab: \"data\",\n group: \"Data\",\n },\n {\n key: \"dataKey\",\n label: \"Data Key\",\n type: \"select\",\n description: \"Key in the data to use for chart values\",\n options: [{ label: \"value\", value: \"value\" }],\n defaultValue: \"value\",\n tab: \"data\",\n group: \"Data\",\n },\n {\n key: \"xAxisKey\",\n label: \"X-Axis Key\",\n type: \"select\",\n description: \"Key in the data to use for X-axis labels\",\n options: [{ label: \"name\", value: \"name\" }],\n defaultValue: \"name\",\n tab: \"data\",\n group: \"Data\",\n },\n ],\n} satisfies WidgetPropertySchema;\n"],"mappings":";;;;;;;;;;AA0EA,MAAM,cAAc;CAClB;EAAE,MAAM;EAAO,OAAO;EAAK;CAC3B;EAAE,MAAM;EAAO,OAAO;EAAK;CAC3B;EAAE,MAAM;EAAO,OAAO;EAAK;CAC3B;EAAE,MAAM;EAAO,OAAO;EAAK;CAC3B;EAAE,MAAM;EAAO,OAAO;EAAK;CAC3B;EAAE,MAAM;EAAO,OAAO;EAAK;CAC5B;AAGD,MAAM,iBAAiB;CACrB;EAAE,MAAM;EAAO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Aa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACP,qBAAqB;GACtB;0DACgB;GACf,KAAK;GACL,OAAO;GACP,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACP,qBAAqB;GACtB,CAAC;uDACY;GACZ,KAAK;GACL,OAAO;GACP,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACP,qBAAqB;GACtB,CAAC;EAGF;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,MAAM;GACN,cAAc;GACd,KAAK;GACL,OAAO;GACR;0DACgB;GACf,KAAK;GACL,OAAO;GACP,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR,CAAC;uDACY;GACZ,KAAK;GACL,OAAO;GACP,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR,CAAC;EAGF;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,SAAS;IACP;KAAE,OAAO;KAAa,OAAO;KAAO;IACpC;KAAE,OAAO;KAAc,OAAO;KAAQ;IACtC;KAAE,OAAO;KAAc,OAAO;KAAQ;IACtC;KAAE,OAAO;KAAa,OAAO;KAAO;IACrC;GACD,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,MAAM;GACN,OAAO;GACP,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aACE;GACF,cAAc;GACd,KAAK;GACL,OAAO;GACR;wDACc;GACb,KAAK;GACL,OAAO;GACP,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR,CAAC;EACF;GACE,KAAK;GACL,MAAM;GACN,OAAO;GACP,KAAK;GACL,OAAO;GACR;EACD;GACE,MAAM;GACN,KAAK;GACL,OAAO;GACP,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR;yDACe;GACd,KAAK;GACL,OAAO;GACP,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR,CAAC;8DACmB;GACnB,KAAK;GACL,OAAO;GACP,aAAa;GACb,cAAc;GACd,KAAK;GACL,OAAO;GACR,CAAC;EAGF;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,SAAS,CAAC;IAAE,OAAO;IAAS,OAAO;IAAS,CAAC;GAC7C,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACD;GACE,KAAK;GACL,OAAO;GACP,MAAM;GACN,aAAa;GACb,SAAS,CAAC;IAAE,OAAO;IAAQ,OAAO;IAAQ,CAAC;GAC3C,cAAc;GACd,KAAK;GACL,OAAO;GACR;EACF;CACF"}