@welcome-back/brand 0.12.0 → 0.14.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/README.md CHANGED
@@ -25,6 +25,7 @@ Two components:
25
25
  - [POS design tokens](#pos-design-tokens)
26
26
  - [Product image frames](#product-image-frames)
27
27
  - [Module icons](#module-icons)
28
+ - [Illustrated icons](#illustrated-icons)
28
29
  - [Accessibility](#accessibility)
29
30
  - [Where to use it, and where not](#where-to-use-it-and-where-not)
30
31
  - [Troubleshooting](#troubleshooting)
@@ -425,6 +426,57 @@ Soft colours are for art, strong colours are for app messages. Do not use these
425
426
  as status colours, and never put `coral` on a badge or a pill with a number: it
426
427
  reads as an error or a notification.
427
428
 
429
+ ## Illustrated icons
430
+
431
+ 108 general illustrated icons in the same style as the module icons, for empty
432
+ states, onboarding, feature cards and marketing surfaces. Each one replaces one
433
+ or more lucide icons. Design: Paper 01M72Y4K1ZCAWQ5WGA3CD16CFN, page 2, in four
434
+ groups: `comercio`, `lugar`, `personas`, `datos`.
435
+
436
+ ```tsx
437
+ import { IllustratedIcon, ILLUSTRATED_ICONS } from '@welcome-back/brand';
438
+
439
+ <IllustratedIcon name="tarjeta-de-pago" className="w-22" />; // decorative, next to a visible label
440
+ <IllustratedIcon name="regalo" className="w-16" label="Regalo" />; // alone: give it a name
441
+ <IllustratedIcon name="codigo-qr" className="w-16" tile={false} />; // no cream tile, white areas only
442
+ ILLUSTRATED_ICONS; // [{ name: 'tarjeta-de-pago', label: 'Tarjeta de pago', group: 'comercio', lucide: ['CreditCard'] }, …]
443
+ ```
444
+
445
+ To find an icon, search `ILLUSTRATED_ICONS` by `label` or by the `lucide` name
446
+ it replaces. The names are the Spanish labels in kebab-case ASCII
447
+ (`Fuego / cocina` → `fuego-cocina`). The `IllustratedIconName` type lists them.
448
+
449
+ - **Size.** It is square: set a width. Use it at 48 px and up. Under 48 px the
450
+ detail turns into noise: use the lucide icon there.
451
+ - **Tile.** `tile` is on by default and draws the same cream tile as
452
+ `ModuleIcon`. Use `tile={false}` only on a white area. In dark mode or on a
453
+ coloured surface, keep the tile: the ink outlines need the cream behind them.
454
+ The ground shadow is part of the art, so it stays without the tile.
455
+ - **Class.** The `<svg>` has the class `wb-illustrated-icon` next to yours.
456
+ - **No text inside.** The art has no `<text>` or `<image>`, and only colours
457
+ from `ILLUSTRATION_COLOURS` (plus the see-through yellow `#FFE45C59` under
458
+ the line chart). Tests check this.
459
+
460
+ ### Edit an icon
461
+
462
+ Each icon is its own file: `src/illustrations/<name>.svg`.
463
+
464
+ 1. Open the file in a design tool (Paper, Illustrator, Inkscape…).
465
+ 2. Keep the `viewBox="0 0 120 120"`, the ground-shadow ellipse first, and no
466
+ tile background (the component draws the tile). Use palette colours only,
467
+ no text, no images. If you add `id`s (gradients, masks), start them with the
468
+ icon name so they cannot clash on a page with many icons.
469
+ 3. Run `npm run build`. It writes `src/illustratedArt.generated.ts` from the
470
+ SVG files; commit that file too. `npm test` fails if you forget.
471
+ 4. Open a PR (see [Publish a change](#publish-a-change)).
472
+
473
+ ### Add an icon
474
+
475
+ 1. Add `src/illustrations/<name>.svg` (same rules as above).
476
+ 2. Add an entry to `src/illustrations/index.json`:
477
+ `{ "name", "label", "group", "lucide": [...] }`.
478
+ 3. Run `npm run build`, update the icon count in the test, and open a PR.
479
+
428
480
  ## Accessibility
429
481
 
430
482
  - **Give exactly one accessible name per loading state.** Either put `label` on
@@ -467,6 +519,8 @@ the content will appear.
467
519
  | `src/RunnerLoader.tsx` | The component: SVG structure, clip paths, props |
468
520
  | `src/runnerCss.ts` | The animation: keyframes, timing, swing angles, reduced motion |
469
521
  | `src/runnerArt.ts` | Vector data: paths, pants fills, clip polygons |
522
+ | `src/illustrations/` | One `.svg` per illustrated icon, plus `index.json` (the manifest) |
523
+ | `src/illustratedArt.generated.ts` | Written by `scripts/build-illustrations.mjs` from `src/illustrations`. Do not edit. |
470
524
  | `src/*.test.tsx` | Vitest tests (server render, no browser) |
471
525
  | `scripts/mark-cjs.mjs` | Marks `dist/cjs` as CommonJS after the build |
472
526
  | `.github/workflows/ci.yml` | Runs on every PR and on `main` |
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ILLUSTRATED_ICONS = void 0;
4
+ exports.IllustratedIcon = IllustratedIcon;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const illustratedArt_generated_js_1 = require("./illustratedArt.generated.js");
7
+ Object.defineProperty(exports, "ILLUSTRATED_ICONS", { enumerable: true, get: function () { return illustratedArt_generated_js_1.ILLUSTRATED_ICONS; } });
8
+ const illustrationColours_js_1 = require("./illustrationColours.js");
9
+ /**
10
+ * An illustrated icon (source: src/illustrations/<name>.svg). Size it with
11
+ * width (it is square). Reads well from 48 px; under that, use a line icon.
12
+ */
13
+ function IllustratedIcon({ name, className, label, tile = true }) {
14
+ const a11y = label
15
+ ? { role: "img", "aria-label": label }
16
+ : { "aria-hidden": true };
17
+ return ((0, jsx_runtime_1.jsxs)("svg", { viewBox: "0 0 120 120", className: className ? `wb-illustrated-icon ${className}` : "wb-illustrated-icon", strokeLinecap: "round", strokeLinejoin: "round", ...a11y, children: [tile && ((0, jsx_runtime_1.jsx)("rect", { x: "0.5", y: "0.5", width: "119", height: "119", rx: "30", fill: illustrationColours_js_1.ILLUSTRATION_COLOURS.paper, stroke: illustrationColours_js_1.ILLUSTRATION_COLOURS.paperBorder })), (0, jsx_runtime_1.jsx)("g", { dangerouslySetInnerHTML: { __html: illustratedArt_generated_js_1.ILLUSTRATED_ART[name] } })] }));
18
+ }