@deriv-ds/design-intelligence-layer 0.4.2 → 0.4.3

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 (2) hide show
  1. package/README.md +46 -6
  2. package/package.json +6 -3
package/README.md CHANGED
@@ -167,12 +167,34 @@ npm install react react-dom tailwindcss
167
167
 
168
168
  ## Blocks
169
169
 
170
- Blocks are pre-composed UI patterns built from Quill primitives. They are demonstrated in the **Blocks** tab of the development playground and are **not** exported from the npm package — import the underlying components directly if you need to use them.
170
+ Blocks are pre-composed UI patterns built from package primitives. They live in the **Blocks** tab of the development playground and are **not** exported from the npm package.
171
171
 
172
- | Block | Variants | Description |
173
- |---|---|---|
174
- | NavBar | Desktop, Mobile (closed), Mobile (open) | Landing page top navigation bar. Logo + ghost nav links (Products, Use Cases, Docs, Blog, FAQ) + Sign in / Sign up CTAs. |
175
- | Hero | Type 1 (Desktop + Mobile), Type 2 | Landing page hero sections. Type 1: tagline pill + heading + body + CTAs left, image right (responsive). Type 2: centred single-column, tagline pill + heading + body + primary CTA with arrow icon, no image. |
172
+ To use a block in your project, click the **"Copy block"** button in the playground next to the block label. It copies an AI-ready prompt with the full block source to your clipboard. Paste it into your AI agent (Claude Code, Cursor, Kiro, Copilot) and the agent will:
173
+
174
+ 1. Drop the block file into your project
175
+ 2. Ask you for values to replace each `// TODO`
176
+ 3. Bundle in any shared dependencies (e.g. `HeroActionButton`)
177
+
178
+ The agent doesn't generate or invent — it pastes the exact code from the playground and only swaps the dummy data for your real data.
179
+
180
+ ### Available blocks
181
+
182
+ | Block | Playground tab |
183
+ |---|---|
184
+ | `[mobile] section - hero (home)` | Blocks → Hero |
185
+ | `[desktop] section - hero (home)` | Blocks → Hero |
186
+ | `[mobile] section - hero (main)` | Blocks → Hero |
187
+ | `[desktop] section - hero (main)` | Blocks → Hero |
188
+ | `[mobile] section - hero (secondary)` | Blocks → Hero |
189
+ | `[desktop] section - hero (secondary)` | Blocks → Hero |
190
+ | `[mobile] section - hero (transaction details)` | Blocks → Hero |
191
+ | `NavBar` | Blocks → NavBar |
192
+
193
+ The block source files live in `app/components/hero-*.tsx`. The playground reads them and builds the AI prompt at dev/build time via `scripts/generate-block-sources.mjs`.
194
+
195
+ ### Manual fallback
196
+
197
+ If you don't want to use an AI agent, open the block file directly on GitHub and copy everything between the `🟢 BLOCK TO COPY` and `🔵 PLAYGROUND ONLY` markers. Replace each `// TODO` with your own data. If the block imports `HeroActionButton`, also copy `app/components/hero-action-button.tsx`.
176
198
 
177
199
  ---
178
200
 
@@ -736,8 +758,26 @@ npm run build
736
758
 
737
759
  # Build the Next.js showcase app
738
760
  npm run build:next
761
+
762
+ # Regenerate block sources for the "Copy block" button
763
+ # (auto-runs on `npm run dev` — only needed manually after editing a hero block file)
764
+ npm run generate:blocks
739
765
  ```
740
766
 
767
+ ### Adding or editing hero blocks
768
+
769
+ Block files live in `app/components/hero-*.tsx`. Each file has two clearly marked sections:
770
+
771
+ - `🟢 BLOCK TO COPY` — the block source consumers receive when they click "Copy block"
772
+ - `🔵 PLAYGROUND ONLY` — the wrapper with switchers, skeletons, and intersection observers (excluded from the prompt)
773
+
774
+ The `scripts/generate-block-sources.mjs` script reads each block file, extracts the section between the two markers, builds an AI-ready prompt, and writes `app/blocks-source.generated.ts`. The `CopyBlockPromptButton` component reads from that generated file. The script auto-runs on every `npm run dev`.
775
+
776
+ When adding a new hero block:
777
+ 1. Create `app/components/hero-<name>-page.tsx` with both 🟢 and 🔵 markers
778
+ 2. Add an entry to the `BLOCKS` array in `scripts/generate-block-sources.mjs`
779
+ 3. Add `<CopyBlockPromptButton blockId="..." />` to the block's playground header row
780
+
741
781
  ### Updating design tokens
742
782
 
743
783
  Design tokens are managed in Figma and exported as CSS variables. To update:
@@ -754,4 +794,4 @@ Design tokens are managed in Figma and exported as CSS variables. To update:
754
794
  - **Tailwind CSS v4** — CSS-first configuration
755
795
  - **shadcn/ui** (New York style) — base component primitives
756
796
  - **Radix UI** — accessible headless primitives
757
- - **Figma** — source of truth for design tokens
797
+ - **Figma** — source of truth for design tokens
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deriv-ds/design-intelligence-layer",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "Deriv Design System — shadcn/ui components with Tailwind CSS v4",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -23,9 +23,11 @@
23
23
  "**/*.css"
24
24
  ],
25
25
  "scripts": {
26
- "dev": "next dev -H 127.0.0.1 -p 3000",
26
+ "dev": "npm run generate:blocks && next dev -H 127.0.0.1 -p 3000",
27
27
  "generate:registry": "node scripts/generate-component-registry.mjs",
28
+ "generate:blocks": "node scripts/generate-block-sources.mjs",
28
29
  "build": "tsup",
30
+ "prebuild:next": "npm run generate:blocks",
29
31
  "build:next": "next build",
30
32
  "start": "next start",
31
33
  "lint": "eslint",
@@ -87,6 +89,7 @@
87
89
  "overrides": {
88
90
  "lodash": "^4.18.0",
89
91
  "postcss": "^8.5.10",
90
- "qs": "^6.15.2"
92
+ "qs": "^6.15.2",
93
+ "hono": "^4.12.21"
91
94
  }
92
95
  }