@deriv-ds/design-intelligence-layer 0.4.2 → 0.4.4
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/AGENTS.md +15 -3
- package/README.md +66 -9
- package/dist/index.cjs +5498 -1038
- package/dist/index.d.cts +258 -5
- package/dist/index.d.ts +258 -5
- package/dist/index.js +5377 -958
- package/guides/design-system-guide/deriv-design-intelligence-guide.md +4 -4
- package/guides/design-system-guide/icon-reference.md +202 -0
- package/guides/design-system-guide/quill-ds-guide.md +4 -4
- package/guides/rules/design-system-consuming-project.mdc +27 -13
- package/package.json +14 -7
- package/src/styles.css +10 -0
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
package/AGENTS.md
CHANGED
|
@@ -55,9 +55,21 @@ cp node_modules/@deriv-ds/design-intelligence-layer/guides/rules/design-system-c
|
|
|
55
55
|
1. **Check before building** — if a component exists in `@deriv-ds/design-intelligence-layer`, import it. Never re-implement it.
|
|
56
56
|
2. **Tokens only** — use semantic token classes (`bg-prominent`, `text-on-prominent`, `border-border`, etc.). Never hardcode hex values, raw Tailwind palette colors, or CSS variables.
|
|
57
57
|
3. **Design principles and accessibility first** — every screen must reflect the 8 design principles and meet the accessibility standards (WCAG 2.1 AA). Run both checklists before shipping.
|
|
58
|
-
4. **No separate installs** — do not install `
|
|
59
|
-
5. **
|
|
60
|
-
6. **
|
|
58
|
+
4. **No separate installs** — do not install `tailwindcss` or other bundled dependencies separately. Never install or import `lucide-react` or any other icon library.
|
|
59
|
+
5. **Icons** — use the exported `<Icon />` component (FontAwesome Pro): `<Icon name="bell" weight="bold" />`. Three weights: `regular` (unselected nav, subtle), `bold` (default), `fill` (selected nav, strong actions). Full catalog of names, weights, and intent → icon mappings: `guides/design-system-guide/icon-reference.md`. At runtime, `ICON_NAMES` and `iconAvailableWeights(name)` are exported from the package.
|
|
60
|
+
6. **After a version bump** — re-copy the rules file into `.cursor/rules/`, check for stale local component copies, and align them with the package.
|
|
61
|
+
7. **Blocks are exported from the package** — Blocks (Hero sections, NavBar patterns) are importable directly from `@deriv-ds/design-intelligence-layer`. When a user asks to use a block by name, import it:
|
|
62
|
+
```tsx
|
|
63
|
+
import { HeroMobileHomeTitle, HeroMobileHomeTotalAssets } from "@deriv-ds/design-intelligence-layer"
|
|
64
|
+
import { HeroDesktopHomeOnboarding, HeroDesktopHomeWithBalance } from "@deriv-ds/design-intelligence-layer"
|
|
65
|
+
import { HeroMobileMain, HeroDesktopMain } from "@deriv-ds/design-intelligence-layer"
|
|
66
|
+
import { HeroMobileSecondary, HeroDesktopSecondary } from "@deriv-ds/design-intelligence-layer"
|
|
67
|
+
import { HeroMobileTransaction } from "@deriv-ds/design-intelligence-layer"
|
|
68
|
+
import { Navbar } from "@deriv-ds/design-intelligence-layer"
|
|
69
|
+
// Responsive: renders sidebar on desktop (≥768px), bottom bar on mobile (<768px)
|
|
70
|
+
// For explicit control: NavMobileBottomBar, NavDesktopSidebar are also exported
|
|
71
|
+
```
|
|
72
|
+
See `guides/design-system-guide/deriv-design-intelligence-guide.md` Section 8.5 for full block catalogue and prop signatures.
|
|
61
73
|
|
|
62
74
|
---
|
|
63
75
|
|
package/README.md
CHANGED
|
@@ -6,6 +6,23 @@ Published as **`@deriv-ds/design-intelligence-layer`** on npm.
|
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
+
## License & FontAwesome Pro — read before installing
|
|
10
|
+
|
|
11
|
+
This package is **proprietary to Deriv** (`"license": "UNLICENSED"`). It is not open source and must never be published with public access or mirrored to a public registry.
|
|
12
|
+
|
|
13
|
+
The icon system depends on **FontAwesome Pro**, which is commercially licensed to Deriv on a **per-seat basis**. Compliance rules:
|
|
14
|
+
|
|
15
|
+
1. **Only licensed seat-holders may install or build this package.** FontAwesome counts every developer who uses Pro icons during development as a seat. Currently this is restricted to one designated engineer — do not share registry access beyond licensed seats.
|
|
16
|
+
2. **Token setup (required to install).** The FA registry token is read from an environment variable — it is never stored in the repo. The designated engineer adds this to their shell profile (and CI adds it as a masked secret):
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
export FONTAWESOME_NPM_AUTH_TOKEN=<token from the Deriv FontAwesome account>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The committed-ignored `.npmrc` references it as `${FONTAWESOME_NPM_AUTH_TOKEN}`. Without the variable set, `npm install` fails loudly — that is intentional.
|
|
23
|
+
3. **Never bundle FA glyph data.** FA packages must stay in `dependencies` (tsup externalizes them) so the published tarball contains no FontAwesome code. Do not add `@fortawesome/*` to tsup's bundled output.
|
|
24
|
+
4. **Never commit the token.** `.npmrc` is gitignored; the token lives only in shell profiles and CI secrets. If it ever leaks, regenerate it at fontawesome.com → Account.
|
|
25
|
+
|
|
9
26
|
## Quick Start
|
|
10
27
|
|
|
11
28
|
### Installation
|
|
@@ -167,12 +184,34 @@ npm install react react-dom tailwindcss
|
|
|
167
184
|
|
|
168
185
|
## Blocks
|
|
169
186
|
|
|
170
|
-
Blocks are pre-composed UI patterns built from
|
|
187
|
+
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
188
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
189
|
+
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:
|
|
190
|
+
|
|
191
|
+
1. Drop the block file into your project
|
|
192
|
+
2. Ask you for values to replace each `// TODO`
|
|
193
|
+
3. Bundle in any shared dependencies (e.g. `HeroActionButton`)
|
|
194
|
+
|
|
195
|
+
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.
|
|
196
|
+
|
|
197
|
+
### Available blocks
|
|
198
|
+
|
|
199
|
+
| Block | Playground tab |
|
|
200
|
+
|---|---|
|
|
201
|
+
| `[mobile] section - hero (home)` | Blocks → Hero |
|
|
202
|
+
| `[desktop] section - hero (home)` | Blocks → Hero |
|
|
203
|
+
| `[mobile] section - hero (main)` | Blocks → Hero |
|
|
204
|
+
| `[desktop] section - hero (main)` | Blocks → Hero |
|
|
205
|
+
| `[mobile] section - hero (secondary)` | Blocks → Hero |
|
|
206
|
+
| `[desktop] section - hero (secondary)` | Blocks → Hero |
|
|
207
|
+
| `[mobile] section - hero (transaction details)` | Blocks → Hero |
|
|
208
|
+
| `NavBar` | Blocks → NavBar |
|
|
209
|
+
|
|
210
|
+
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`.
|
|
211
|
+
|
|
212
|
+
### Manual fallback
|
|
213
|
+
|
|
214
|
+
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
215
|
|
|
177
216
|
---
|
|
178
217
|
|
|
@@ -671,7 +710,7 @@ This project uses @deriv-ds/design-intelligence-layer (Quill Design System). Bef
|
|
|
671
710
|
4. Read node_modules/@deriv-ds/design-intelligence-layer/guides/brand-voice/quill-brand-voice.md — apply the brand voice: channel-specific voice, banned phrases, vocabulary, and formatting rules for all player-facing copy
|
|
672
711
|
5. Check if the component exists in the package — import it, don't re-implement
|
|
673
712
|
6. Use only design token classes (bg-prominent, text-on-prominent, border-border-subtle, etc.) — no hardcoded hex or raw Tailwind palette colors
|
|
674
|
-
7. Do not install lucide-react, tailwindcss, or other bundled dependencies separately
|
|
713
|
+
7. Do not install icon libraries (lucide-react etc.), tailwindcss, or other bundled dependencies separately — icons come from FontAwesome Pro via the <Icon /> component (see guides/design-system-guide/icon-reference.md for the full catalog and weight conventions)
|
|
675
714
|
8. If no token exists for a value, ask before using a hardcoded value
|
|
676
715
|
9. After upgrading the package: prefer package imports over local copies of components; if replacing local UI code with the package version, tell the user what was overwritten; re-copy guides/rules/design-system-consuming-project.mdc into .cursor/rules if using Cursor
|
|
677
716
|
|
|
@@ -697,7 +736,7 @@ See node_modules/@deriv-ds/design-intelligence-layer/README.md for complete toke
|
|
|
697
736
|
| `bg-[var(--primary)]` | `bg-primary` | Raw CSS var — Tailwind v4 maps tokens directly |
|
|
698
737
|
| `hsl(var(--primary))` | `bg-primary` | Tailwind v3 syntax — not needed in v4 |
|
|
699
738
|
| `font-[Plus_Jakarta_Sans]` | `font-sans` (Inter) | Project font is Inter, not Plus Jakarta Sans |
|
|
700
|
-
|
|
|
739
|
+
| Importing `lucide-react` | `<Icon name="..." />` | Icons are FontAwesome Pro via the bundled `<Icon />` component — see `guides/design-system-guide/icon-reference.md` |
|
|
701
740
|
|
|
702
741
|
---
|
|
703
742
|
|
|
@@ -705,7 +744,7 @@ See node_modules/@deriv-ds/design-intelligence-layer/README.md for complete toke
|
|
|
705
744
|
|
|
706
745
|
These are bundled with the package. Installing them separately can cause version conflicts:
|
|
707
746
|
|
|
708
|
-
-
|
|
747
|
+
- `@fortawesome/*` and `@awesome.me/*` — FontAwesome Pro icon packages, used through the exported `<Icon />` component (never imported directly in consuming code)
|
|
709
748
|
- `radix-ui` — headless primitives
|
|
710
749
|
- `class-variance-authority` — variant API
|
|
711
750
|
- `cmdk` — command palette
|
|
@@ -736,8 +775,26 @@ npm run build
|
|
|
736
775
|
|
|
737
776
|
# Build the Next.js showcase app
|
|
738
777
|
npm run build:next
|
|
778
|
+
|
|
779
|
+
# Regenerate block sources for the "Copy block" button
|
|
780
|
+
# (auto-runs on `npm run dev` — only needed manually after editing a hero block file)
|
|
781
|
+
npm run generate:blocks
|
|
739
782
|
```
|
|
740
783
|
|
|
784
|
+
### Adding or editing hero blocks
|
|
785
|
+
|
|
786
|
+
Block files live in `app/components/hero-*.tsx`. Each file has two clearly marked sections:
|
|
787
|
+
|
|
788
|
+
- `🟢 BLOCK TO COPY` — the block source consumers receive when they click "Copy block"
|
|
789
|
+
- `🔵 PLAYGROUND ONLY` — the wrapper with switchers, skeletons, and intersection observers (excluded from the prompt)
|
|
790
|
+
|
|
791
|
+
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`.
|
|
792
|
+
|
|
793
|
+
When adding a new hero block:
|
|
794
|
+
1. Create `app/components/hero-<name>-page.tsx` with both 🟢 and 🔵 markers
|
|
795
|
+
2. Add an entry to the `BLOCKS` array in `scripts/generate-block-sources.mjs`
|
|
796
|
+
3. Add `<CopyBlockPromptButton blockId="..." />` to the block's playground header row
|
|
797
|
+
|
|
741
798
|
### Updating design tokens
|
|
742
799
|
|
|
743
800
|
Design tokens are managed in Figma and exported as CSS variables. To update:
|
|
@@ -754,4 +811,4 @@ Design tokens are managed in Figma and exported as CSS variables. To update:
|
|
|
754
811
|
- **Tailwind CSS v4** — CSS-first configuration
|
|
755
812
|
- **shadcn/ui** (New York style) — base component primitives
|
|
756
813
|
- **Radix UI** — accessible headless primitives
|
|
757
|
-
- **Figma** — source of truth for design tokens
|
|
814
|
+
- **Figma** — source of truth for design tokens
|