@qwickapps/react-framework 1.8.0 → 1.8.1

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 (38) hide show
  1. package/dist/components/QwickIcon.d.ts +1 -1
  2. package/dist/components/QwickIcon.d.ts.map +1 -1
  3. package/dist/components/blocks/HeroSlideshow.d.ts +54 -0
  4. package/dist/components/blocks/HeroSlideshow.d.ts.map +1 -0
  5. package/dist/components/blocks/index.d.ts +2 -0
  6. package/dist/components/blocks/index.d.ts.map +1 -1
  7. package/dist/index.css +1 -1
  8. package/dist/index.esm.css +1 -1
  9. package/dist/index.esm.js +123 -21
  10. package/dist/index.js +123 -20
  11. package/dist/palettes/manifest.json +22 -22
  12. package/dist/schemas/transformers/ComponentTransformer.d.ts.map +1 -1
  13. package/package.json +19 -21
  14. package/scripts/build-palettes.cjs +0 -0
  15. package/scripts/create-project.sh +0 -0
  16. package/src/assets/qwick-icon.svg +11 -0
  17. package/src/components/QwickApp.css +2 -2
  18. package/src/components/QwickIcon.tsx +26 -21
  19. package/src/components/blocks/HeroSlideshow.tsx +156 -0
  20. package/src/components/blocks/index.ts +2 -0
  21. package/src/components/layout/GridCellWrapper.tsx +4 -4
  22. package/src/schemas/transformers/ComponentTransformer.ts +7 -1
  23. package/src/schemas/transformers/ReactNodeTransformer.ts +1 -1
  24. package/src/stories/HeroSlideshow.stories.tsx +164 -0
  25. /package/dist/palettes/{palette-autumn.1.8.0.css → palette-autumn.1.8.1.css} +0 -0
  26. /package/dist/palettes/{palette-autumn.1.8.0.min.css → palette-autumn.1.8.1.min.css} +0 -0
  27. /package/dist/palettes/{palette-boutique.1.8.0.css → palette-boutique.1.8.1.css} +0 -0
  28. /package/dist/palettes/{palette-boutique.1.8.0.min.css → palette-boutique.1.8.1.min.css} +0 -0
  29. /package/dist/palettes/{palette-cosmic.1.8.0.css → palette-cosmic.1.8.1.css} +0 -0
  30. /package/dist/palettes/{palette-cosmic.1.8.0.min.css → palette-cosmic.1.8.1.min.css} +0 -0
  31. /package/dist/palettes/{palette-default.1.8.0.css → palette-default.1.8.1.css} +0 -0
  32. /package/dist/palettes/{palette-default.1.8.0.min.css → palette-default.1.8.1.min.css} +0 -0
  33. /package/dist/palettes/{palette-ocean.1.8.0.css → palette-ocean.1.8.1.css} +0 -0
  34. /package/dist/palettes/{palette-ocean.1.8.0.min.css → palette-ocean.1.8.1.min.css} +0 -0
  35. /package/dist/palettes/{palette-spring.1.8.0.css → palette-spring.1.8.1.css} +0 -0
  36. /package/dist/palettes/{palette-spring.1.8.0.min.css → palette-spring.1.8.1.min.css} +0 -0
  37. /package/dist/palettes/{palette-winter.1.8.0.css → palette-winter.1.8.1.css} +0 -0
  38. /package/dist/palettes/{palette-winter.1.8.0.min.css → palette-winter.1.8.1.min.css} +0 -0
@@ -0,0 +1,156 @@
1
+ /**
2
+ * HeroSlideshow Component
3
+ *
4
+ * A slideshow built on top of HeroBlock that cycles through multiple slides
5
+ * with auto-rotation, fade transitions, and progress dot navigation.
6
+ *
7
+ * Usage (props-driven, e.g. qwickdocs):
8
+ * <HeroSlideshow slides={[{ title: 'Slide 1', ... }, ...]} />
9
+ *
10
+ * Usage (CMS-driven, e.g. work-macha):
11
+ * const slideshow = await payload.findByID({ collection: 'hero-slideshows', id });
12
+ * <HeroSlideshow slides={slideshow.slides} autoPlayInterval={slideshow.autoPlayInterval} />
13
+ *
14
+ * Copyright (c) 2025 QwickApps.com. All rights reserved.
15
+ */
16
+
17
+ 'use client';
18
+
19
+ import React, { useState, useEffect, useCallback } from 'react';
20
+ import { Box } from '@mui/material';
21
+ import HeroBlock from './HeroBlock';
22
+ import type { HeroBlockProps } from './HeroBlock';
23
+ import type { ButtonProps } from '../buttons/Button';
24
+
25
+ /**
26
+ * A single slide - subset of HeroBlockProps that drives visual content
27
+ */
28
+ export interface HeroSlide {
29
+ /** Main headline text */
30
+ title: string;
31
+ /** Subtitle or description text */
32
+ subtitle?: string;
33
+ /** Background image URL */
34
+ backgroundImage?: string;
35
+ /** CSS gradient string, e.g. 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)' */
36
+ backgroundGradient?: string;
37
+ /** Theme color variant when no image/gradient set */
38
+ backgroundColor?: 'default' | 'primary' | 'secondary' | 'surface';
39
+ /** Call-to-action buttons */
40
+ actions?: ButtonProps[];
41
+ /** Overlay opacity when backgroundImage is set (0-1) */
42
+ overlayOpacity?: number;
43
+ }
44
+
45
+ export interface HeroSlideshowProps {
46
+ /** Array of slides to cycle through */
47
+ slides: HeroSlide[];
48
+ /** Auto-play interval in milliseconds. Default: 5000 */
49
+ autoPlayInterval?: number;
50
+ /** Show dot navigation. Default: true */
51
+ showDots?: boolean;
52
+ /** Height preset applied to all slides */
53
+ blockHeight?: HeroBlockProps['blockHeight'];
54
+ /** Text alignment applied to all slides */
55
+ textAlign?: HeroBlockProps['textAlign'];
56
+ }
57
+
58
+ const TRANSITION_DURATION = 300; // ms
59
+
60
+ /**
61
+ * HeroSlideshow - Cycles through HeroBlock slides with fade transitions
62
+ */
63
+ export function HeroSlideshow({
64
+ slides,
65
+ autoPlayInterval = 5000,
66
+ showDots = true,
67
+ blockHeight = 'large',
68
+ textAlign = 'center',
69
+ }: HeroSlideshowProps) {
70
+ const [currentIndex, setCurrentIndex] = useState(0);
71
+ const [isVisible, setIsVisible] = useState(true);
72
+
73
+ const goToSlide = useCallback(
74
+ (index: number) => {
75
+ if (index === currentIndex) return;
76
+ setIsVisible(false);
77
+ setTimeout(() => {
78
+ setCurrentIndex(index);
79
+ setIsVisible(true);
80
+ }, TRANSITION_DURATION);
81
+ },
82
+ [currentIndex],
83
+ );
84
+
85
+ useEffect(() => {
86
+ if (slides.length <= 1 || autoPlayInterval <= 0) return;
87
+ const timer = setTimeout(() => {
88
+ goToSlide((currentIndex + 1) % slides.length);
89
+ }, autoPlayInterval);
90
+ return () => clearTimeout(timer);
91
+ }, [currentIndex, slides.length, autoPlayInterval, goToSlide]);
92
+
93
+ if (!slides.length) return null;
94
+
95
+ const slide = slides[currentIndex];
96
+
97
+ return (
98
+ <Box sx={{ position: 'relative', overflow: 'hidden' }}>
99
+ {/* Current slide with fade transition */}
100
+ <Box
101
+ sx={{
102
+ opacity: isVisible ? 1 : 0,
103
+ transition: `opacity ${TRANSITION_DURATION}ms ease-in-out`,
104
+ }}
105
+ >
106
+ <HeroBlock
107
+ title={slide.title}
108
+ subtitle={slide.subtitle}
109
+ backgroundImage={slide.backgroundImage}
110
+ backgroundGradient={slide.backgroundGradient}
111
+ backgroundColor={slide.backgroundColor}
112
+ actions={slide.actions}
113
+ overlayOpacity={slide.overlayOpacity}
114
+ blockHeight={blockHeight}
115
+ textAlign={textAlign}
116
+ />
117
+ </Box>
118
+
119
+ {/* Progress dots */}
120
+ {showDots && slides.length > 1 && (
121
+ <Box
122
+ sx={{
123
+ position: 'absolute',
124
+ bottom: 20,
125
+ left: '50%',
126
+ transform: 'translateX(-50%)',
127
+ display: 'flex',
128
+ gap: 1,
129
+ zIndex: 10,
130
+ }}
131
+ >
132
+ {slides.map((_, index) => (
133
+ <Box
134
+ key={index}
135
+ role="button"
136
+ aria-label={`Go to slide ${index + 1}`}
137
+ onClick={() => goToSlide(index)}
138
+ sx={{
139
+ width: index === currentIndex ? 28 : 8,
140
+ height: 8,
141
+ borderRadius: 4,
142
+ backgroundColor: 'rgba(255, 255, 255, 0.9)',
143
+ opacity: index === currentIndex ? 1 : 0.45,
144
+ cursor: 'pointer',
145
+ transition: 'all 0.3s ease',
146
+ '&:hover': { opacity: 0.8 },
147
+ }}
148
+ />
149
+ ))}
150
+ </Box>
151
+ )}
152
+ </Box>
153
+ );
154
+ }
155
+
156
+ export default HeroSlideshow;
@@ -11,6 +11,7 @@
11
11
  * Copyright (c) 2025 QwickApps.com. All rights reserved.
12
12
  */
13
13
  export { default as HeroBlock } from './HeroBlock';
14
+ export { default as HeroSlideshow } from './HeroSlideshow';
14
15
  export { default as Code } from './Code';
15
16
  export { default as Article } from './Article';
16
17
  export { default as Content } from './Content';
@@ -28,6 +29,7 @@ export { default as FeatureCard } from './FeatureCard';
28
29
  export { default as CardListGrid } from './CardListGrid';
29
30
 
30
31
  export type { HeroBlockProps } from './HeroBlock';
32
+ export type { HeroSlideshowProps, HeroSlide } from './HeroSlideshow';
31
33
  export type { CodeProps } from './Code';
32
34
  export type { ArticleProps } from './Article';
33
35
  export type { ContentProps } from './Content';
@@ -55,22 +55,22 @@ const GridCellWrapper: React.FC<GridCellWrapperProps> = ({
55
55
  ...gridProps
56
56
  }) => {
57
57
  // If fullWidth is true, force size=12; otherwise build responsive size object for MUI v6
58
- const responsiveSizing = fullWidth
58
+ const responsiveSizing = fullWidth
59
59
  ? { size: 12 }
60
60
  : (() => {
61
- const sizeConfig: unknown = {};
61
+ const sizeConfig: Partial<Record<'xs' | 'sm' | 'md' | 'lg' | 'xl', number | 'auto'>> = {};
62
62
  if (xs !== undefined) sizeConfig.xs = xs;
63
63
  if (sm !== undefined) sizeConfig.sm = sm;
64
64
  if (md !== undefined) sizeConfig.md = md;
65
65
  if (lg !== undefined) sizeConfig.lg = lg;
66
66
  if (xl !== undefined) sizeConfig.xl = xl;
67
-
67
+
68
68
  // If only one value provided, use it as a simple size value
69
69
  const definedBreakpoints = Object.keys(sizeConfig);
70
70
  if (definedBreakpoints.length === 1 && xs !== undefined && sm === undefined && md === undefined && lg === undefined && xl === undefined) {
71
71
  return { size: xs };
72
72
  }
73
-
73
+
74
74
  return { size: sizeConfig };
75
75
  })();
76
76
 
@@ -420,7 +420,13 @@ export class ComponentTransformer {
420
420
  */
421
421
  private static transformElement(element: Element, key: string): ReactNode {
422
422
  const transformedNode = ComponentTransformer.transformHTMLElement(element);
423
- if (transformedNode) return transformedNode;
423
+ if (transformedNode) {
424
+ // Clone the node and add the key prop
425
+ if (React.isValidElement(transformedNode)) {
426
+ return React.cloneElement(transformedNode, { key });
427
+ }
428
+ return transformedNode;
429
+ }
424
430
 
425
431
  const children = Array.from(element.children);
426
432
  const hasTransformableChildren = children.some(child =>
@@ -186,7 +186,7 @@ export class ReactNodeTransformer {
186
186
 
187
187
  // Use Html component to render HTML content safely
188
188
  const typedProps = props as Record<string, unknown>;
189
- return createElement(Html, { key, children: typedProps.children });
189
+ return createElement(Html, { key, children: typedProps.children as ReactNode });
190
190
  }
191
191
 
192
192
  /**
@@ -0,0 +1,164 @@
1
+ /**
2
+ * HeroSlideshow Component Stories
3
+ *
4
+ * Copyright (c) 2025 QwickApps.com. All rights reserved.
5
+ */
6
+
7
+ import type { Meta, StoryObj } from '@storybook/react';
8
+ import React from 'react';
9
+ import QwickApp from '../components/QwickApp';
10
+ import { HeroSlideshow } from '../components/blocks';
11
+ import type { HeroSlide } from '../components/blocks/HeroSlideshow';
12
+
13
+ // ─── Shared slide sets ──────────────────────────────────────────────────────
14
+
15
+ const gradientSlides: HeroSlide[] = [
16
+ {
17
+ title: 'Build Apps 10x Faster',
18
+ subtitle: 'The most developer-friendly React framework. Production-ready in hours, not weeks.',
19
+ backgroundGradient: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
20
+ actions: [
21
+ { label: 'Get Started', variant: 'primary', buttonSize: 'large' },
22
+ { label: 'View Docs', variant: 'outlined', buttonSize: 'large' },
23
+ ],
24
+ },
25
+ {
26
+ title: 'Schema-Driven Components',
27
+ subtitle: 'Define once in Payload CMS, render everywhere. Data binding built in.',
28
+ backgroundGradient: 'linear-gradient(135deg, #f093fb 0%, #f5576c 100%)',
29
+ actions: [
30
+ { label: 'See Components', variant: 'primary', buttonSize: 'large' },
31
+ ],
32
+ },
33
+ {
34
+ title: 'Ship With Confidence',
35
+ subtitle: 'Storybook-documented components, TypeScript-first, MUI-powered.',
36
+ backgroundGradient: 'linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)',
37
+ actions: [
38
+ { label: 'Browse Storybook', variant: 'primary', buttonSize: 'large' },
39
+ { label: 'GitHub', variant: 'text', buttonSize: 'large' },
40
+ ],
41
+ },
42
+ ];
43
+
44
+ const imageSlides: HeroSlide[] = [
45
+ {
46
+ title: 'Connect Talent with Opportunity',
47
+ subtitle: 'WorkMacha bridges restaurant owners and culinary students for short-term gigs.',
48
+ backgroundImage: 'https://images.unsplash.com/photo-1414235077428-338989a2e8c0?w=1400&q=80',
49
+ overlayOpacity: 0.55,
50
+ actions: [
51
+ { label: 'Post a Job', variant: 'primary', buttonSize: 'large' },
52
+ { label: 'Find Work', variant: 'outlined', buttonSize: 'large' },
53
+ ],
54
+ },
55
+ {
56
+ title: 'Build Your Culinary Portfolio',
57
+ subtitle: 'Every gig you complete earns a verified certificate you can share with employers.',
58
+ backgroundImage: 'https://images.unsplash.com/photo-1556910103-1c02745aec4b?w=1400&q=80',
59
+ overlayOpacity: 0.55,
60
+ actions: [
61
+ { label: 'Browse Jobs', variant: 'primary', buttonSize: 'large' },
62
+ ],
63
+ },
64
+ {
65
+ title: 'Hire the Right Talent, Fast',
66
+ subtitle: 'Verified culinary students available for shifts, events, and pop-ups.',
67
+ backgroundImage: 'https://images.unsplash.com/photo-1590846406792-0adc7f938f1d?w=1400&q=80',
68
+ overlayOpacity: 0.5,
69
+ actions: [
70
+ { label: 'Start Hiring', variant: 'primary', buttonSize: 'large' },
71
+ ],
72
+ },
73
+ ];
74
+
75
+ // ─── Meta ────────────────────────────────────────────────────────────────────
76
+
77
+ const meta: Meta<typeof HeroSlideshow> = {
78
+ title: 'Blocks/HeroSlideshow',
79
+ component: HeroSlideshow,
80
+ decorators: [
81
+ (Story) => (
82
+ <QwickApp appName="Storybook" appId="storybook" enableScaffolding={false}>
83
+ <Story />
84
+ </QwickApp>
85
+ ),
86
+ ],
87
+ parameters: {
88
+ layout: 'fullscreen',
89
+ },
90
+ argTypes: {
91
+ autoPlayInterval: {
92
+ control: { type: 'number', min: 0, max: 10000, step: 500 },
93
+ description: 'Auto-advance interval in ms. Set to 0 to disable.',
94
+ },
95
+ showDots: { control: 'boolean' },
96
+ blockHeight: {
97
+ control: { type: 'select' },
98
+ options: ['small', 'medium', 'large', 'viewport'],
99
+ },
100
+ textAlign: {
101
+ control: { type: 'select' },
102
+ options: ['left', 'center', 'right'],
103
+ },
104
+ },
105
+ };
106
+
107
+ export default meta;
108
+ type Story = StoryObj<typeof HeroSlideshow>;
109
+
110
+ // ─── Stories ─────────────────────────────────────────────────────────────────
111
+
112
+ export const GradientSlides: Story = {
113
+ name: 'Gradient slides (props-driven)',
114
+ args: {
115
+ slides: gradientSlides,
116
+ autoPlayInterval: 4000,
117
+ showDots: true,
118
+ blockHeight: 'large',
119
+ textAlign: 'center',
120
+ },
121
+ };
122
+
123
+ export const ImageSlides: Story = {
124
+ name: 'Image slides (WorkMacha style)',
125
+ args: {
126
+ slides: imageSlides,
127
+ autoPlayInterval: 5000,
128
+ showDots: true,
129
+ blockHeight: 'large',
130
+ textAlign: 'center',
131
+ },
132
+ };
133
+
134
+ export const SingleSlide: Story = {
135
+ name: 'Single slide (no dots, no auto-play)',
136
+ args: {
137
+ slides: [gradientSlides[0]],
138
+ autoPlayInterval: 0,
139
+ showDots: false,
140
+ blockHeight: 'medium',
141
+ textAlign: 'center',
142
+ },
143
+ };
144
+
145
+ export const SlowAutoPlay: Story = {
146
+ name: 'Slow auto-play (8 second interval)',
147
+ args: {
148
+ slides: gradientSlides,
149
+ autoPlayInterval: 8000,
150
+ showDots: true,
151
+ blockHeight: 'medium',
152
+ },
153
+ };
154
+
155
+ export const LeftAligned: Story = {
156
+ name: 'Left-aligned content',
157
+ args: {
158
+ slides: imageSlides,
159
+ autoPlayInterval: 5000,
160
+ showDots: true,
161
+ blockHeight: 'large',
162
+ textAlign: 'left',
163
+ },
164
+ };