@payfit/unity-illustrations 2.55.21 → 2.55.23

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/package.json +18 -11
  2. package/skills/unity-illustrations/SKILL.md +39 -0
  3. package/src/agent-references/illustrations-catalog.json +1996 -0
  4. package/src/agent-references/manifest.json +16 -0
  5. package/dist/esm/scripts/agent-references/illustration-reference.d.ts +0 -17
  6. package/src/agent-references/README.mdx +0 -17
  7. package/src/agent-references/illustrations.mdx +0 -74
  8. package/src/components/illustration/Illustration.stories.tsx +0 -362
  9. package/src/components/illustration/Illustration.tsx +0 -169
  10. package/src/components/illustration/figma/IllustrationLarge.figma.ts +0 -258
  11. package/src/components/illustration/figma/IllustrationMedium.figma.ts +0 -258
  12. package/src/components/illustration/figma/IllustrationSmall.figma.ts +0 -258
  13. package/src/components/lazy-illustration/LazyIllustration.stories.tsx +0 -204
  14. package/src/components/lazy-illustration/LazyIllustration.tsx +0 -125
  15. package/src/components/lazy-illustration/figma/LazyIllustrationLarge.figma.ts +0 -255
  16. package/src/components/lazy-illustration/figma/LazyIllustrationMedium.figma.ts +0 -255
  17. package/src/components/lazy-illustration/figma/LazyIllustrationSmall.figma.ts +0 -255
  18. package/src/docs/1-Introduction/1-Welcome.mdx +0 -111
  19. package/src/docs/1-Introduction/2-Getting Started.mdx +0 -25
  20. package/src/docs/1-Introduction/3-Usage.mdx +0 -114
  21. package/src/docs/1-Introduction/4-Changelog.mdx +0 -6
  22. package/src/docs/2-Reference/1-Find my illustration.mdx +0 -12
  23. package/src/docs/2-Reference/2-Find my animation.mdx +0 -14
  24. package/src/docs/2-Reference/3-Multi brand support.mdx +0 -146
  25. package/src/docs/blocks/AnimationLibrary.tsx +0 -181
  26. package/src/docs/blocks/BrandSupportBadge.tsx +0 -190
  27. package/src/docs/blocks/BrandSupportFilter.tsx +0 -72
  28. package/src/docs/blocks/Cards.tsx +0 -74
  29. package/src/docs/blocks/IllustrationLibrary.tsx +0 -179
  30. package/src/docs/blocks/useStorybookTheme.ts +0 -73
  31. package/src/index.ts +0 -4
  32. package/src/scripts/agent-references/illustration-reference.test.ts +0 -100
  33. package/src/scripts/agent-references/illustration-reference.ts +0 -140
  34. package/src/scripts/generate-assets.ts +0 -649
  35. package/src/scripts/templates/assetTemplate.ts +0 -224
  36. package/src/scripts/templates/baseTypes.ts +0 -45
  37. package/src/scripts/templates/indexTemplate.ts +0 -109
  38. package/src/unity.css +0 -5
@@ -0,0 +1,16 @@
1
+ {
2
+ "package": "@payfit/unity-illustrations",
3
+ "generatedBy": "@payfit/nx-tools:sync-unity-agent-references",
4
+ "references": [
5
+ {
6
+ "id": "illustrations",
7
+ "title": "Unity illustration catalog",
8
+ "description": "Exact Unity illustration names grouped by usage category.",
9
+ "format": "json",
10
+ "path": "./illustrations-catalog.json",
11
+ "contentType": "application/json",
12
+ "useFor": ["illustration lookup", "illustration usage"],
13
+ "sources": ["assets/**/*"]
14
+ }
15
+ ]
16
+ }
@@ -1,17 +0,0 @@
1
- export type IllustrationReferenceComponent = {
2
- name: string;
3
- type: string;
4
- animated: boolean;
5
- category?: string;
6
- };
7
- export declare const getIllustrationReferenceGroups: (components: IllustrationReferenceComponent[]) => {
8
- category: string;
9
- title: string;
10
- components: IllustrationReferenceComponent[];
11
- }[];
12
- export declare const generateIllustrationsReference: (components: IllustrationReferenceComponent[]) => string;
13
- export declare const generateIllustrationsAgentReferencesReadme: () => string;
14
- export declare const writeIllustrationAgentReferences: ({ components, outputDir, }: {
15
- components: IllustrationReferenceComponent[];
16
- outputDir: string;
17
- }) => void;
@@ -1,17 +0,0 @@
1
- import { Meta } from '@storybook/addon-docs/blocks'
2
-
3
- <Meta title="Agent References/Illustrations Overview" />
4
-
5
- # Unity Illustrations Agent References
6
-
7
- {/* AUTO-GENERATED FILE. DO NOT EDIT.
8
- Generated by unity-illustrations:pre-build.
9
- Source: Unity illustration asset metadata.
10
- */}
11
-
12
-
13
- This directory contains generated Storybook docs references for Unity illustrations. These files are intended for Storybook MCP, MCP indexers, and AI agents.
14
-
15
- Storybook includes these MDX files through the shared `../src/**/*.mdx` stories glob, and `@storybook/addon-mcp` exposes docs content to MCP clients.
16
-
17
- - [Illustrations](./illustrations.mdx)
@@ -1,74 +0,0 @@
1
- import { Meta } from '@storybook/addon-docs/blocks'
2
-
3
- <Meta title="Agent References/Illustrations" />
4
-
5
- # Illustrations
6
-
7
- {/* AUTO-GENERATED FILE. DO NOT EDIT.
8
- Generated by unity-illustrations:pre-build.
9
- Source: Unity illustration asset metadata.
10
- */}
11
-
12
-
13
- Agent reference. Exact illustration names are grouped by variant to reduce context.
14
-
15
- Lazy: `<LazyIllustration name="ExactName" variant="icon|picture" alt="..." />`.
16
-
17
- Eager: `import Asset from "@payfit/unity-illustrations/ExactName"`, then `<Illustration src={Asset} variant="icon|picture" alt="..." />`.
18
-
19
- Animations use `variant="picture"`.
20
-
21
- ## Illustrated icons (icon)
22
-
23
- - AdministrativeDocument, AdministrativeDocumentWithBackground, AnnualTaxes, BabyBottle, BabyBottleWithBackground, Bell, BellWithBackground, Bicycle
24
- - BicycleWithBackground, BlankPayslip, BlankPayslipWithBackground, Box, BoxWithBackground, Buoy, BuoyWithBackground, Calculator
25
- - CalculatorWithBackground, Card, CardWithBackground, CharacterHeadphone, CharacterHeadphoneWithBackground, Checkbox, CheckboxWithBackground, Clock
26
- - ClockWithBackground, ClosedLock, ClosedLockWithBackground, ComputerDocumentation, ComputerDocumentationWithBackground, Confettis, ConfettisWithBackground, Contact
27
- - Conversation, ConversationWithBackground, Data, DataWithBackground, Discount, DiscountWithBackground, Document, DocumentError
28
- - DocumentFiling, DocumentWithBackground, EmailNotification, EmailNotificationWithBackground, EmergencyContact, EmploymentContract, EmploymentContractWithBackground, EmptyDocument
29
- - EmptyDocumentWithBackground, EmptyState, EmptyStateWithBackground, ESignature, ExceedingThreshold, ExceptionalCompensation, ExceptionalCompensationWithBackground, Expenses
30
- - FAQ, FAQWithBackground, FieldGlasses, FieldGlassesWithBackground, FreeShare, FreeShareWithBackground, FullCalendar, FullCalendarWithBackground
31
- - Gear, GearWithBackground, Gift, GiftWithBackground, GoldenRibbon, GoldenRibbonWithBackground, Graph, GraphWithBackground
32
- - HalfCalendar, HalfCalendarWithBackground, Hammer, HammerWithBackground, HandHello, HandHelloWithBackground, HappyCharacter, HappyCharacterWithBackground
33
- - Health, HealthInsurance, HolidayVoucher, HolidayVoucherWithBackground, IdentityCard, InformationUpdate, InformationUpdateWithBackground, JEIJEUJEC
34
- - Kanoon, Kpmg, LegalHelp, LetterBox, LetterBoxWithBackground, LightBulb, LightBulbWithBackground, LittleRocket
35
- - LittleRocketWithBackground, LunchVoucher, MagnifyingGlass, MagnifyingGlassWithBackground, MealPlate, MealPlateWithBackground, MealVoucher, MealVoucherCard
36
- - MealVoucherCardWithBackground, MealVoucherWithBackground, Mobility, MoneyLending, MoneyLendingWithBackground, Notes, OfficialLetter, OfficialLetterWithBackground
37
- - OpenLock, OpenLockWithBackground, OrganismesPayment, PaidLeave, PaymentInformation, Payslip, PayslipCoins, PayslipCoinsWithBackground
38
- - PayslipWithBackground, Pen, PenWithBackground, People, PeopleWithBackground, Performance, PersonalDetails, PersonHeadphone
39
- - PersonHeadphoneWithBackground, PiggyBank, PiggyBankCoins, PiggyBankCoinsWithBackground, PiggyBankWithBackground, Plant, PlantWithBackground, ProvidentScheme
40
- - RemoteWork, Report, ReportWithBackground, Salary, SalaryAdvance, SalaryPayment, SalarySeizure, SalarySeizureWithBackground
41
- - SandCastle, SandCastleWithBackground, Schedule, ScheduleWithBackground, SettingSlider, SettingSliderWithBackground, SetUpTask, SickLeave
42
- - SmallPuzzle, SmallPuzzleWithBackground, SmilingCharacter, SmilingCharacterWithBackground, Spreadsheet, SpreadsheetWithBackground, Stethoscope, StethoscopeWithBackground
43
- - StockOptions, StockOptionsWithBackground, Stopwatch, StopwatchWithBackground, Sunshade, SunshadeWithBackground, TaskToDo, TaskToDoWithBackground
44
- - Template, TemplateWithBackground, Thumbtack, ThumbtackWithBackground, TimeTracking, TipsJar, TipsJarWithBackground, TokenCoin
45
- - TokenCoinWithBackground, ValidationWindow, ValidationWindowWithBackground, WorkExpense, WorkExpenseWithBackground, WorkingTime
46
-
47
- ## Illustrated pictures (picture)
48
-
49
- - Accounting, AddEmployee, AlphabetCube, Analysis, AutomationInProgress, BigIdea, Binoculars, Biscuit
50
- - BiscuitCrumbs, Book, Brainstorming, Calendar, Chat, ChristmasSock, ChristmasSockAndConfettis, Collaboration
51
- - CollectiveResearch, ComputerMail, ConfettiCannon, ContractSignature, CrossLegged, CupOfCoffee, Dancing, DancingPeople
52
- - DancingSkier, Dialogue, Discussion, Doctor, DocumentCreation, DocumentScan, DocumentScanning, EmailLogin
53
- - EmptyStateActivationButton, EmptyStateActivationToggle, EmptyStateDesert, EmptyStateEmptyFolder, EmptyStateIncidentPanel, EmptyStateMaintenance, EmptyStateMoon, EmptyStateResearch
54
- - EmptyStateToDo, Evaluation, FilingDocuments, Flowchart, Graphic, Hands, HighFive, HighlightBooks
55
- - Idea, IndicateSomething, JetlangCalculator, Library, Marteler, Mug, Panel, PaperPlane
56
- - Party, PayfittersWithBadge, PayrollError, Person, PhoneMessage, Planet, PostIt, Progression
57
- - Promotion, Puzzle, PuzzlePiece, ReadingABook, ReceivingPay, RehireEmployee, Remote, Rocket
58
- - SafeDepositBox, Sale, SecurityFields, Signature, SittingOnTheSofa, SolveProblem, SpeakerFingertips, SpeakerWelcome
59
- - SpeakerWithMicrophone, StackOfBook2, StairTreads, TakingNote, Target, TeamBuilding, Telescope, TemplateForm
60
- - Thumbsup, Timer, ToggleOff, ToggleOn, Trophy, TrophyWon, VisuallyImpaired, VisuallyImpairedWinter
61
- - WalkingPeople, WinterParty, WorkAtOffice, WorkFromAnywhere, Wrench, WriteBook
62
-
63
- ## Animations (picture; animated)
64
-
65
- - AccountingAnimation, BinocularsAnimation, CardAnimation, ClockAnimation, ConfettisAnimation, DocumentAnimation, HandsAnimation, KpmgAnimation
66
- - PanelAnimation, PaperPlaneAnimation, PartyAnimation, PayslipFlipAnimation, PeopleAnimation, PiggyBankAnimation, PlantAnimation, ScheduleAnimation
67
- - ThumbsupAnimation, WinterPartyAnimation
68
-
69
- ## Other illustrations (picture)
70
-
71
- - AccountingWithBackground, AlphabetCubeWithBackground, BinocularsWithBackground, BookWithBackground, CalendarWithBackground, ComputerMailWithBackground, ConfettiCannonWithBackground, DialogueWithBackground
72
- - DocumentCreationWithBackground, DocumentScanWithBackground, ExpensesWithBackground, FlowchartWithBackground, HighFiveWithBackground, HighlightBooksWithBackground, IncidentPanel, MartelerWithBackground
73
- - PanelWithBackground, PaperPlaneWithBackground, PayrollErrorWithBackground, PerformanceDiscussion, PerformanceWithBackground, PostItWithBackground, SecurityFieldsWithBackground, SignatureWithBackground
74
- - StackOfBook2WithBackground, TemplateFormWithBackground, ToggleOffWithBackground, ToggleOnWithBackground, TrophyWithBackground, WriteBookWithBackground
@@ -1,362 +0,0 @@
1
- import { UnityThemeProvider } from '@payfit/unity-themes'
2
-
3
- // Animated illustrations - import directly from individual files
4
- import AccountingAnimation from '../../generated/AccountingAnimation'
5
- import Binoculars from '../../generated/Binoculars'
6
- import BinocularsAnimation from '../../generated/BinocularsAnimation'
7
- import CardAnimation from '../../generated/CardAnimation'
8
- import FAQ from '../../generated/FAQ'
9
- import FAQWithBackground from '../../generated/FAQWithBackground'
10
- import VisuallyImpaired from '../../generated/VisuallyImpaired'
11
- import WriteBook from '../../generated/WriteBook'
12
- import { Illustration } from './Illustration'
13
- import preview from '../../../.storybook/preview'
14
-
15
- function transformIllustrationSource(code: string) {
16
- // Find all src props with name values
17
- const srcMatches = [
18
- ...code.matchAll(/src=\{\{[^}]+name:\s*['"`]([^'"`]+)['"`][^}]+\}\}/g),
19
- ]
20
-
21
- if (srcMatches.length === 0) {
22
- return code // Return original code if no illustrations found
23
- }
24
-
25
- // Extract unique illustration names
26
- const illustrationNames = [...new Set(srcMatches.map(match => match[1]))]
27
-
28
- // Create import statements for all unique illustrations
29
- const importStatements = illustrationNames
30
- .map(
31
- name =>
32
- `import ${name} from '@payfit/unity-illustrations/assets/${name}';`,
33
- )
34
- .join('\n')
35
-
36
- // Replace all src prop objects with their corresponding imported variables
37
- let modifiedCode = code
38
- srcMatches.forEach(match => {
39
- const fullMatch = match[0] // The entire src={{...}} part
40
- const illustrationName = match[1] // The name value
41
- modifiedCode = modifiedCode.replace(fullMatch, `src={${illustrationName}}`)
42
- })
43
-
44
- return `${importStatements}\n\n${modifiedCode}`
45
- }
46
-
47
- /**
48
- * Displays illustrations from the Unity design system with consistent styling and accessibility.
49
- *
50
- * The Illustration component handles SVG illustrations and images, providing standardized sizing options,
51
- * responsive behavior, and proper accessibility attributes. All illustration assets must be imported
52
- * individually from the `@payfit/unity-illustrations` package before use. For example, if you want to use the FAQ illustration, you can import it like this:
53
- *
54
- * ```tsx
55
- * import FAQ from '@payfit/unity-illustrations/assets/FAQ'
56
- * ```
57
- *
58
- * See the [usage page](/docs/introduction-3-usage--docs) for complete examples and best practices.
59
- */
60
- const meta = preview.meta({
61
- title: 'Components/Illustration',
62
- component: Illustration,
63
- tags: ['autodocs'],
64
- parameters: {
65
- layout: 'centered',
66
- docs: {
67
- source: {
68
- transform: (code: string) => transformIllustrationSource(code),
69
- language: 'tsx',
70
- },
71
- },
72
- },
73
- argTypes: {
74
- src: {
75
- control: 'select',
76
- description:
77
- 'The illustration asset to render. Must be imported from @payfit/unity-illustrations',
78
- table: {
79
- type: { summary: 'UnityIllustrationAsset' },
80
- category: 'Required',
81
- },
82
- type: { name: 'other', required: true, value: 'UnityIllustrationAsset' },
83
- },
84
- variant: {
85
- control: 'select',
86
- options: ['picture', 'icon'],
87
- description:
88
- 'The illustration variant. It can be a regular picture or an illustrated icon',
89
- table: {
90
- type: { summary: "'picture' | 'icon'" },
91
- category: 'Required',
92
- },
93
- type: { name: 'enum', required: true, value: ['picture', 'icon'] },
94
- },
95
- alt: {
96
- control: 'text',
97
- description:
98
- 'Accessible name for the illustration. Required when isDecorative is `true`',
99
- table: {
100
- type: { summary: 'string' },
101
- category: 'Accessibility',
102
- },
103
- },
104
- description: {
105
- control: 'text',
106
- description:
107
- 'Optional description for complex illustrations. Active only when isDecorative is `true`',
108
- table: {
109
- type: { summary: 'string' },
110
- category: 'Accessibility',
111
- },
112
- },
113
- isDecorative: {
114
- control: 'boolean',
115
- description:
116
- 'Whether the illustration is decorative (hidden from screen readers). When `true`, `alt` becomes optional',
117
- table: {
118
- type: { summary: 'boolean' },
119
- defaultValue: { summary: 'false' },
120
- category: 'Accessibility',
121
- },
122
- },
123
- size: {
124
- control: 'select',
125
- options: ['sm', 'md', 'lg'],
126
- description: 'The size of the illustration. Only applies to icon variant',
127
- if: { arg: 'variant', eq: 'icon' },
128
- table: {
129
- type: { summary: "'sm' | 'md' | 'lg'" },
130
- category: 'Icon Variant',
131
- },
132
- },
133
- className: {
134
- control: 'text',
135
- description: 'Additional CSS classes for styling',
136
- table: {
137
- type: { summary: 'string' },
138
- category: 'Styling',
139
- },
140
- },
141
- },
142
- })
143
-
144
- export const Primary = meta.story({
145
- render: () => (
146
- <Illustration
147
- variant="picture"
148
- src={Binoculars}
149
- className="uy:size-[150px]"
150
- alt="Binoculars illustration"
151
- />
152
- ),
153
- })
154
-
155
- /**
156
- * You can create responsive illustrations that adapt to different screen sizes by using responsive
157
- * Tailwind classes in the `className` prop. Set the `alt` prop to provide accessible descriptions
158
- * for screen readers when using the picture variant.
159
- */
160
- export const IllustratedPicture = meta.story({
161
- render: () => (
162
- <Illustration
163
- variant="picture"
164
- src={VisuallyImpaired}
165
- className="uy:size-[50vmin]"
166
- alt="Visually impaired illustration"
167
- />
168
- ),
169
- })
170
-
171
- /**
172
- * You can display illustrations as smaller icons by setting the `variant` prop to `"icon"`.
173
- * Use the `size` prop to choose from predefined sizes: `"sm"`, `"md"`, or `"lg"`. This is ideal for illustrations that are meant to be used as illustrated icons.
174
- */
175
- export const IllustratedIcon = meta.story({
176
- render: function Render() {
177
- return (
178
- <div className="uy:grid uy:grid-cols-3 uy:items-center uy:gap-200">
179
- <Illustration variant="icon" size="sm" src={FAQ} alt="FAQ icon small" />
180
- <Illustration
181
- variant="icon"
182
- size="md"
183
- src={FAQ}
184
- alt="FAQ icon medium"
185
- />
186
- <Illustration variant="icon" size="lg" src={FAQ} alt="FAQ icon large" />
187
- <Illustration
188
- variant="icon"
189
- size="sm"
190
- src={FAQWithBackground}
191
- alt="FAQ with background icon small"
192
- />
193
- <Illustration
194
- variant="icon"
195
- size="md"
196
- src={FAQWithBackground}
197
- alt="FAQ with background icon medium"
198
- />
199
- <Illustration
200
- variant="icon"
201
- size="lg"
202
- src={FAQWithBackground}
203
- alt="FAQ with background icon large"
204
- />
205
- </div>
206
- )
207
- },
208
- })
209
-
210
- /**
211
- * You can render one logical illustration asset under different Unity themes.
212
- * The Illustration component reads the active Unity theme and resolves the matching asset URL when a legacy or rebrand variant exists.
213
- */
214
- export const ThemeVariants = meta.story({
215
- render: () => {
216
- return (
217
- <div className="uy:flex uy:flex-wrap uy:items-start uy:gap-400">
218
- <UnityThemeProvider theme="legacy">
219
- <div className="uy:flex uy:flex-col uy:items-center uy:gap-150">
220
- <Illustration
221
- src={FAQ}
222
- variant="icon"
223
- size="lg"
224
- alt="FAQ legacy icon"
225
- />
226
- <span className="uy:typography-caption uy:text-content-neutral">
227
- legacy
228
- </span>
229
- </div>
230
- </UnityThemeProvider>
231
- <UnityThemeProvider theme="rebrand">
232
- <div className="uy:flex uy:flex-col uy:items-center uy:gap-150">
233
- <Illustration
234
- src={FAQ}
235
- variant="icon"
236
- size="lg"
237
- alt="FAQ rebrand icon"
238
- />
239
- <span className="uy:typography-caption uy:text-content-neutral">
240
- rebrand
241
- </span>
242
- </div>
243
- </UnityThemeProvider>
244
- <div className="uy:flex uy:flex-col uy:items-center uy:gap-150">
245
- <Illustration
246
- src={FAQ}
247
- variant="icon"
248
- size="lg"
249
- alt="FAQ brand-aware icon"
250
- />
251
- <span className="uy:typography-caption uy:text-content-neutral">
252
- Brand-aware
253
- </span>
254
- </div>
255
- </div>
256
- )
257
- },
258
- })
259
-
260
- /**
261
- * You can make the illustration decorative by setting the `isDecorative` prop to `true`.
262
- * When `isDecorative` is `true`, `alt` becomes optional. Screen readers will ignore the illustration and not read the `alt` or the `description` attributes. Use this when the illustration is purely decorative or visual appeal, and does not provide any information.
263
- */
264
- export const IsDecorative = meta.story({
265
- render: () => (
266
- <Illustration
267
- src={VisuallyImpaired}
268
- variant="picture"
269
- isDecorative
270
- className="uy:size-[50vmin]"
271
- />
272
- ),
273
- })
274
-
275
- /**
276
- * You can create responsive layouts where illustrations adapt to different viewport sizes
277
- * by combining responsive Tailwind classes with the illustration component (with media and container queries). Use Unity theme
278
- * classes to configure how the illustration behaves across breakpoints.
279
- */
280
- export const Responsive = meta.story({
281
- render: () => {
282
- return (
283
- <div className="uy:rounded-150 uy:bg-surface-neutral uy:border-border-neutral uy:shadow-floating uy:p-300 uy:flex uy:flex-col uy:gap-200 uy:sm:flex-row uy:max-w-[50vmax]">
284
- <Illustration
285
- src={WriteBook}
286
- variant="picture"
287
- className="uy:size-full uy:sm:max-w-1/2 uy:md:max-w-1/4"
288
- alt="Write book illustration"
289
- />
290
- <div className="uy:space-y-200">
291
- <h2 className="uy:typography-h2">Title</h2>
292
- <p className="uy:typography-body">
293
- The image above has a different size depending on the viewport size.
294
- Use unity-themes classes to configure how the illustration behaves
295
- </p>
296
- </div>
297
- </div>
298
- )
299
- },
300
- })
301
-
302
- /**
303
- * Unity illustrations supports animated illustrations in WEBP format. All the animated illustrations have the `Animation` suffix on their name
304
- * Animated illustrations will grow fluidly depending on its container size but are capped at their original dimensions to prevent oversizing.
305
- */
306
- export const AnimatedIllustrations = meta.story({
307
- parameters: {
308
- chromatic: { disableSnapshot: true },
309
- },
310
- render: () => {
311
- return (
312
- <div className="uy:space-y-300">
313
- <div>
314
- <h3 className="uy:typography-h3 uy:mb-200">
315
- Large Animation (Fluid)
316
- </h3>
317
- <div className="uy:border uy:border-dashed uy:border-border-neutral uy:p-200 uy:rounded-100 uy:w-[50dvw]">
318
- <Illustration
319
- src={AccountingAnimation}
320
- variant="picture"
321
- alt="Accounting animation showing financial calculations"
322
- />
323
- </div>
324
- <p className="uy:typography-caption uy:text-content-tertiary uy:mt-100">
325
- Max dimensions: 969×852px • Scales down responsively
326
- </p>
327
- </div>
328
-
329
- <div>
330
- <h3 className="uy:typography-h3 uy:mb-200">
331
- Medium Animation (Fluid)
332
- </h3>
333
- <div className="uy:border uy:border-dashed uy:border-border-neutral uy:p-200 uy:rounded-100 uy:w-[25dvw]">
334
- <Illustration
335
- src={BinocularsAnimation}
336
- variant="picture"
337
- alt="Binoculars animation for search or discovery"
338
- />
339
- </div>
340
- <p className="uy:typography-caption uy:text-content-tertiary uy:mt-100">
341
- Max dimensions: 750×750px • Scales down responsively
342
- </p>
343
- </div>
344
- <div>
345
- <h3 className="uy:typography-h3 uy:mb-200">
346
- Small Animation (Fluid)
347
- </h3>
348
- <div className="uy:border uy:border-dashed uy:border-border-neutral uy:p-200 uy:rounded-100">
349
- <Illustration
350
- src={CardAnimation}
351
- variant="picture"
352
- alt="Card animation for payment or identification"
353
- />
354
- </div>
355
- <p className="uy:typography-caption uy:text-content-tertiary uy:mt-100">
356
- Max dimensions: 224×224px • Scales down responsively
357
- </p>
358
- </div>
359
- </div>
360
- )
361
- },
362
- })
@@ -1,169 +0,0 @@
1
- import { forwardRef, useMemo } from 'react'
2
-
3
- import type { VariantProps } from '@payfit/unity-themes'
4
- import type { ImgHTMLAttributes } from 'react'
5
-
6
- import type { UnityIllustrationAsset } from '../../generated/illustrationAssets'
7
-
8
- import { useUnityTheme, uyTv } from '@payfit/unity-themes'
9
-
10
- export const illustratedPicture = uyTv({
11
- base: 'uy:object-contain uy:aspect-auto',
12
- })
13
-
14
- export const illustratedIcon = uyTv({
15
- base: 'uy:object-contain uy:aspect-square',
16
- variants: {
17
- size: {
18
- sm: 'uy:size-7',
19
- md: 'uy:size-9',
20
- lg: 'uy:size-12',
21
- },
22
- },
23
- })
24
-
25
- interface IllustrationPropsCore extends Omit<
26
- ImgHTMLAttributes<HTMLImageElement>,
27
- 'src' | 'children' | 'alt'
28
- > {
29
- /**
30
- * The illustration asset to render. Must be imported from @payfit/unity-illustrations
31
- */
32
- src: UnityIllustrationAsset
33
- }
34
-
35
- interface NonDecorativeIllustrationProps extends IllustrationPropsCore {
36
- /** Whether this is decorative (hidden from screen readers) */
37
- isDecorative?: false | undefined
38
- /** Accessible name for the illustration - required when not decorative */
39
- alt: string
40
- /** Optional description for complex illustrations */
41
- description?: string
42
- }
43
-
44
- interface DecorativeIllustrationProps extends IllustrationPropsCore {
45
- /** Whether this is decorative (hidden from screen readers) */
46
- isDecorative: true
47
- /** Accessible name for the illustration - optional when decorative */
48
- alt?: string
49
- }
50
-
51
- export type IllustrationPropsBase =
52
- | NonDecorativeIllustrationProps
53
- | DecorativeIllustrationProps
54
-
55
- export type IllustratedPictureProps = IllustrationPropsBase &
56
- VariantProps<typeof illustratedPicture> & {
57
- /**
58
- * The illustration variant. It can be a regular picture or an illustrated icon
59
- */
60
- variant: 'picture'
61
- }
62
-
63
- export type IllustratedIconProps = IllustrationPropsBase &
64
- VariantProps<typeof illustratedIcon> & {
65
- /**
66
- * The illustration variant. It can be a regular picture or an illustrated icon
67
- */
68
- variant: 'icon'
69
- /**
70
- * The size of the illustration. It only applies to illustrated icons
71
- */
72
- size: VariantProps<typeof illustratedIcon>['size']
73
- }
74
-
75
- export type IllustrationProps = IllustratedPictureProps | IllustratedIconProps
76
-
77
- /**
78
- * Renders illustrations from the Unity design system with consistent styling and accessibility features.
79
- *
80
- * The Illustration component provides a standardized way to display SVG illustrations and images
81
- * , ensuring consistent sizing, responsive behavior, and accessibility compliance.
82
- * @param {IllustrationProps} props - Component props including variant, src, size, and standard HTML attributes
83
- * @see {@link IllustrationProps} for all available props
84
- * @example
85
- * ```tsx
86
- * import { Illustration } from '@payfit/unity-illustrations'
87
- * import FAQ from '@payfit/unity-illustrations/FAQ'
88
- *
89
- * function Example() {
90
- * return (
91
- * <Illustration
92
- * variant="picture"
93
- * src={FAQ}
94
- * className="uy:size-[150px]"
95
- * alt="FAQ illustration"
96
- * />
97
- * )
98
- * }
99
- * ```
100
- * @remarks
101
- * You must import illustration assets individually from `@payfit/unity-illustrations/[AssetName]` to use with this component.
102
- * See the [usage documentation](https://unity-illustrations.payfit.io/?path=/docs/introduction-usage--docs) for complete examples and best practices.
103
- */
104
- export const Illustration = forwardRef<HTMLImageElement, IllustrationProps>(
105
- (
106
- {
107
- src,
108
- alt,
109
- isDecorative: decorative = false,
110
- variant,
111
- className,
112
- style,
113
- ...props
114
- },
115
- ref,
116
- ) => {
117
- const { theme } = useUnityTheme()
118
- const resolvedUrl = src.urls?.[theme] ?? src.url
119
- const clsx =
120
- variant === 'picture'
121
- ? illustratedPicture({ className })
122
- : illustratedIcon({
123
- className,
124
- size: (props as IllustratedIconProps).size,
125
- })
126
-
127
- const description = decorative
128
- ? (props as NonDecorativeIllustrationProps).description
129
- : undefined
130
-
131
- // Apply max dimensions for animated assets and generate CSS custom properties
132
- const { enhancedStyle, enhancedClassName } = useMemo(() => {
133
- if ('category' in src && 'dimensions' in src) {
134
- const animationClasses =
135
- 'uy:max-w-[var(--uy-illustration-max-width)] uy:max-h-[var(--uy-illustration-max-height)] uy:w-full uy:h-auto'
136
- return {
137
- enhancedStyle: {
138
- '--uy-illustration-max-width': `${src.dimensions.width}px`,
139
- '--uy-illustration-max-height': `${src.dimensions.height}px`,
140
- ...style,
141
- },
142
- enhancedClassName: `${clsx} ${animationClasses}`.trim(),
143
- }
144
- }
145
- return {
146
- enhancedStyle: style,
147
- enhancedClassName: clsx,
148
- }
149
- }, [src, style, clsx])
150
-
151
- return (
152
- <img
153
- ref={ref}
154
- src={resolvedUrl}
155
- alt={decorative ? '' : alt}
156
- title={decorative ? undefined : alt}
157
- className={enhancedClassName}
158
- style={enhancedStyle}
159
- role={decorative ? 'presentation' : 'img'}
160
- aria-hidden={decorative}
161
- aria-description={description}
162
- loading="lazy"
163
- {...props}
164
- />
165
- )
166
- },
167
- )
168
-
169
- Illustration.displayName = 'Illustration'