@techrox/page-studio-blocks 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 techrox
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,141 @@
1
+ # @techrox/page-studio-blocks
2
+
3
+ 50 production-ready content blocks + the Puck config builder + the StudioProvider context.
4
+
5
+ Shared by both `@techrox/page-studio` (editor) and `@techrox/page-studio-renderer` (public render).
6
+
7
+ ```bash
8
+ pnpm add @techrox/page-studio-blocks
9
+ pnpm add @puckeditor/core antd @ant-design/icons # peers
10
+ ```
11
+
12
+ ## Block catalogue
13
+
14
+ | Category | Blocks |
15
+ |---|---|
16
+ | **Page sections** | Hero, SectionHeader, CTABanner, Banner, AnnouncementBar, InlineCTA |
17
+ | **Content** | RichText, PrinciplesList, TwoColumn, ThreeColumn, ImageText, Quote, KeyValueList, Container, CodeBlock |
18
+ | **Cards** | IconCards, MetricCards, ImageOverlayCards |
19
+ | **Pricing** | PricingTable, PricingComparison |
20
+ | **Lists** | StatsStrip, CountUpStats, PillarsRow, ApproachSteps, StepsVertical, ServicesGrid, TeamGrid |
21
+ | **Articles** | ArticleFeatured, ArticleGrid, ArticleList |
22
+ | **Trust** | LogoStrip, PressMentions, AwardsBar, TestimonialQuote, TestimonialGrid |
23
+ | **Interactive** | FAQ, AccordionBlock, TabsBlock, Timeline, EventsList |
24
+ | **Media** | VideoEmbed, ImageGallery, ImageCaption, MapEmbed |
25
+ | **Forms** | ContactSection, NewsletterSignup, ContactInfo, SocialLinks |
26
+ | **Layout** | Spacer, Divider, RawHtml |
27
+
28
+ Each block is a Puck-shaped object: `{ label, fields, defaultProps, render }`.
29
+
30
+ ## Usage
31
+
32
+ ```jsx
33
+ import { createPuckConfig, PageStudioProvider } from '@techrox/page-studio-blocks';
34
+ import '@techrox/page-studio-blocks/styles.css';
35
+
36
+ const config = createPuckConfig(); // all 50 blocks + reveal animations
37
+ ```
38
+
39
+ To swap or extend blocks:
40
+
41
+ ```jsx
42
+ import { createPuckConfig, defaultBlocks, Hero } from '@techrox/page-studio-blocks';
43
+ import { MyBlock } from './my-block';
44
+
45
+ const config = createPuckConfig({
46
+ blocks: {
47
+ ...defaultBlocks,
48
+ Hero: MyCustomHero, // override
49
+ MyBlock, // add
50
+ },
51
+ categories: {
52
+ ...defaultCategories,
53
+ Custom: { components: ['MyBlock'] },
54
+ },
55
+ });
56
+ ```
57
+
58
+ ## StudioProvider
59
+
60
+ Several blocks need host-provided primitives at render time. Wrap your editor *and* your renderer:
61
+
62
+ ```jsx
63
+ import { PageStudioProvider } from '@techrox/page-studio-blocks';
64
+ import NextLink from 'next/link';
65
+
66
+ <PageStudioProvider value={{
67
+ Link: NextLink, // optional, default <a>
68
+ services: [{ slug, short, eyebrow, summary, icon }],
69
+ site: { email, phone, social: { linkedin } },
70
+ submitLead: async (payload) => { /* POST to your backend */ },
71
+ subscribeNewsletter: async (payload) => { /* POST */ },
72
+ track: (eventType, props) => analytics.capture(eventType, props),
73
+ }}>
74
+ {/* <PageStudio /> or <PageStudioRender /> */}
75
+ </PageStudioProvider>
76
+ ```
77
+
78
+ | Key | Type | Default | Used by |
79
+ |---|---|---|---|
80
+ | `Link` | `Component<{ href, children, ... }>` | `<a>` | Any block with links (Hero, CTABanner, ServicesGrid, …) |
81
+ | `services` | `Service[]` | `[]` | `ServicesGrid`, `ContactSection` |
82
+ | `site` | `{ email, phone, social }` | `{ email: '', phone: '', social: {} }` | `ContactSection` |
83
+ | `submitLead` | `(payload) => Promise<void>` | throws | `ContactSection` |
84
+ | `subscribeNewsletter` | `(payload) => Promise<void>` | throws | `NewsletterSignup` |
85
+ | `track` | `(type, props) => void` | no-op | `ContactSection` (and any host-extended blocks) |
86
+
87
+ Service shape:
88
+
89
+ ```ts
90
+ type Service = {
91
+ slug: string;
92
+ short: string; // short label, shown in cards + the dropdown
93
+ eyebrow?: string;
94
+ summary?: string;
95
+ icon: React.ComponentType;
96
+ };
97
+ ```
98
+
99
+ ## Required host CSS
100
+
101
+ Blocks reference typography/layout classes the host provides. The full list:
102
+
103
+ | Class | Purpose |
104
+ |---|---|
105
+ | `.tps-section`, `.tps-section-soft` | Standard section wrapper + soft-background variant |
106
+ | `.tps-container` | Max-width centered container |
107
+ | `.tps-hero`, `.tps-hero-inner` | Hero block's gradient-halo variant |
108
+ | `.tps-service-hero` | ContactSection's hero region |
109
+ | `.tps-eyebrow` | Small caps eyebrow text |
110
+ | `.tps-h1`, `.tps-h2`, `.tps-h3` | Brand heading sizes |
111
+ | `.tps-lede` | Lede paragraph |
112
+ | `.tps-form-card` | ContactSection form card |
113
+ | `.tps-service-icon` | Wrapper for service icons in ServicesGrid |
114
+
115
+ CSS variables (with `--psd-*` defaults in the package's styles.css):
116
+
117
+ | Variable | Default |
118
+ |---|---|
119
+ | `--psd-primary` | `#0F766E` |
120
+ | `--psd-primary-dark` | `#0B5550` |
121
+ | `--psd-accent` | `#F59E0B` |
122
+ | `--psd-ink` | `#0F172A` |
123
+ | `--psd-muted` | `#64748B` |
124
+ | `--psd-line` | `#E2E8F0` |
125
+ | `--psd-bg-soft` | `#F8FAFC` |
126
+ | `--psd-radius` | `8px` |
127
+
128
+ Many blocks also read `--tps-*` legacy variables for backwards compatibility with the original Page Studio host — alias these to your brand if you don't want to rewrite block code.
129
+
130
+ ## Exports
131
+
132
+ - `createPuckConfig({ blocks?, categories?, reveal?, root? })`
133
+ - `defaultBlocks`, `defaultCategories`, `defaultOverrides`, `emptyPuckData`
134
+ - `PageStudioProvider`, `useStudio`, `StudioLink`
135
+ - `withReveal(block, animation)` — wrap a block with a scroll-reveal animation
136
+ - `BlockThumbnail`, `BLOCK_DESCRIPTIONS` — picker preview helpers
137
+ - Every block by name (e.g. `Hero`, `RichText`, `Spacer`) for cherry-picking
138
+
139
+ ## License
140
+
141
+ MIT.