@payfit/unity-illustrations 2.51.2 → 2.51.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payfit/unity-illustrations",
3
- "version": "2.51.2",
3
+ "version": "2.51.4",
4
4
  "module": "./dist/esm/index.js",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -66,13 +66,13 @@
66
66
  "@payfit/hr-app-eslint": "0.0.0-use.local",
67
67
  "@payfit/hr-apps-tsconfigs": "0.0.0-use.local",
68
68
  "@payfit/storybook-config": "0.0.0-use.local",
69
- "@payfit/unity-themes": "2.51.2",
69
+ "@payfit/unity-themes": "2.51.4",
70
70
  "@payfit/vite-configs": "0.0.0-use.local"
71
71
  },
72
72
  "peerDependencies": {
73
73
  "react": "18.3.1",
74
74
  "react-dom": "18.3.1",
75
- "@payfit/unity-themes": "2.51.2"
75
+ "@payfit/unity-themes": "2.51.4"
76
76
  },
77
77
  "keywords": [
78
78
  "tanstack-intent"
@@ -1,5 +1,3 @@
1
- import type { Meta, StoryObj } from '@storybook/react-vite'
2
-
3
1
  import { UnityThemeProvider } from '@payfit/unity-themes'
4
2
 
5
3
  // Animated illustrations - import directly from individual files
@@ -12,6 +10,7 @@ import FAQWithBackground from '../../generated/FAQWithBackground'
12
10
  import VisuallyImpaired from '../../generated/VisuallyImpaired'
13
11
  import WriteBook from '../../generated/WriteBook'
14
12
  import { Illustration } from './Illustration'
13
+ import preview from '../../../.storybook/preview'
15
14
 
16
15
  function transformIllustrationSource(code: string) {
17
16
  // Find all src props with name values
@@ -58,7 +57,7 @@ function transformIllustrationSource(code: string) {
58
57
  *
59
58
  * See the [usage page](/docs/introduction-3-usage--docs) for complete examples and best practices.
60
59
  */
61
- const meta = {
60
+ const meta = preview.meta({
62
61
  title: 'Components/Illustration',
63
62
  component: Illustration,
64
63
  tags: ['autodocs'],
@@ -140,82 +139,64 @@ const meta = {
140
139
  },
141
140
  },
142
141
  },
143
- } satisfies Meta<typeof Illustration>
144
-
145
- export default meta
146
-
147
- type Story = StoryObj<typeof Illustration>
142
+ })
148
143
 
149
- export const Primary: Story = {
150
- args: {
151
- variant: 'picture',
152
- src: Binoculars,
153
- className: 'uy:size-[150px]',
154
- alt: 'Binoculars illustration',
155
- },
156
- }
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
+ })
157
154
 
158
155
  /**
159
156
  * You can create responsive illustrations that adapt to different screen sizes by using responsive
160
157
  * Tailwind classes in the `className` prop. Set the `alt` prop to provide accessible descriptions
161
158
  * for screen readers when using the picture variant.
162
159
  */
163
- export const IllustratedPicture: Story = {
164
- args: {
165
- variant: 'picture',
166
- src: VisuallyImpaired,
167
- className: 'uy:size-[50vmin]',
168
- },
169
- }
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
170
 
171
171
  /**
172
172
  * You can display illustrations as smaller icons by setting the `variant` prop to `"icon"`.
173
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
174
  */
175
- export const IllustratedIcon: Story = {
176
- args: {
177
- variant: 'icon',
178
- },
179
- render: function Render(args) {
175
+ export const IllustratedIcon = meta.story({
176
+ render: function Render() {
180
177
  return (
181
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" />
182
180
  <Illustration
183
- {...args}
184
- variant="icon"
185
- size="sm"
186
- src={FAQ}
187
- alt="FAQ icon small"
188
- />
189
- <Illustration
190
- {...args}
191
181
  variant="icon"
192
182
  size="md"
193
183
  src={FAQ}
194
184
  alt="FAQ icon medium"
195
185
  />
186
+ <Illustration variant="icon" size="lg" src={FAQ} alt="FAQ icon large" />
196
187
  <Illustration
197
- {...args}
198
- variant="icon"
199
- size="lg"
200
- src={FAQ}
201
- alt="FAQ icon large"
202
- />
203
- <Illustration
204
- {...args}
205
188
  variant="icon"
206
189
  size="sm"
207
190
  src={FAQWithBackground}
208
191
  alt="FAQ with background icon small"
209
192
  />
210
193
  <Illustration
211
- {...args}
212
194
  variant="icon"
213
195
  size="md"
214
196
  src={FAQWithBackground}
215
197
  alt="FAQ with background icon medium"
216
198
  />
217
199
  <Illustration
218
- {...args}
219
200
  variant="icon"
220
201
  size="lg"
221
202
  src={FAQWithBackground}
@@ -224,13 +205,13 @@ export const IllustratedIcon: Story = {
224
205
  </div>
225
206
  )
226
207
  },
227
- }
208
+ })
228
209
 
229
210
  /**
230
211
  * You can render one logical illustration asset under different Unity themes.
231
212
  * The Illustration component reads the active Unity theme and resolves the matching asset URL when a legacy or rebrand variant exists.
232
213
  */
233
- export const ThemeVariants: Story = {
214
+ export const ThemeVariants = meta.story({
234
215
  render: () => {
235
216
  return (
236
217
  <div className="uy:flex uy:flex-wrap uy:items-start uy:gap-400">
@@ -274,27 +255,29 @@ export const ThemeVariants: Story = {
274
255
  </div>
275
256
  )
276
257
  },
277
- }
258
+ })
278
259
 
279
260
  /**
280
261
  * You can make the illustration decorative by setting the `isDecorative` prop to `true`.
281
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.
282
263
  */
283
- export const IsDecorative: Story = {
284
- args: {
285
- variant: 'picture',
286
- src: VisuallyImpaired,
287
- className: 'uy:size-[50vmin]',
288
- isDecorative: true,
289
- },
290
- }
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
+ })
291
274
 
292
275
  /**
293
276
  * You can create responsive layouts where illustrations adapt to different viewport sizes
294
277
  * by combining responsive Tailwind classes with the illustration component (with media and container queries). Use Unity theme
295
278
  * classes to configure how the illustration behaves across breakpoints.
296
279
  */
297
- export const Responsive: Story = {
280
+ export const Responsive = meta.story({
298
281
  render: () => {
299
282
  return (
300
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]">
@@ -314,13 +297,13 @@ export const Responsive: Story = {
314
297
  </div>
315
298
  )
316
299
  },
317
- }
300
+ })
318
301
 
319
302
  /**
320
303
  * Unity illustrations supports animated illustrations in WEBP format. All the animated illustrations have the `Animation` suffix on their name
321
304
  * Animated illustrations will grow fluidly depending on its container size but are capped at their original dimensions to prevent oversizing.
322
305
  */
323
- export const AnimatedIllustrations: Story = {
306
+ export const AnimatedIllustrations = meta.story({
324
307
  parameters: {
325
308
  chromatic: { disableSnapshot: true },
326
309
  },
@@ -376,4 +359,4 @@ export const AnimatedIllustrations: Story = {
376
359
  </div>
377
360
  )
378
361
  },
379
- }
362
+ })
@@ -1,15 +1,14 @@
1
- import type { Meta, StoryObj } from '@storybook/react-vite'
2
-
3
1
  import { UnityThemeProvider } from '@payfit/unity-themes'
4
2
 
5
3
  import { LazyIllustration } from './LazyIllustration'
4
+ import preview from '../../../.storybook/preview'
6
5
 
7
6
  /**
8
7
  * The LazyIllustration component dynamically imports illustrations based on their name.
9
8
  * It uses the lazyIllustrationsMap from the generated illustrationAssets file to load
10
9
  * the corresponding illustration and pass it to the Illustration component.
11
10
  */
12
- const meta = {
11
+ const meta = preview.meta({
13
12
  title: 'Components/LazyIllustration',
14
13
  component: LazyIllustration,
15
14
  tags: ['autodocs'],
@@ -94,57 +93,53 @@ const meta = {
94
93
  },
95
94
  },
96
95
  },
97
- } satisfies Meta<typeof LazyIllustration>
98
-
99
- export default meta
100
-
101
- type Story = StoryObj<typeof LazyIllustration>
96
+ })
102
97
 
103
98
  /**
104
99
  * Basic usage of the LazyIllustration component with a picture variant.
105
100
  * Simply provide the name of the illustration you want to load.
106
101
  */
107
- export const Primary: Story = {
102
+ export const Primary = meta.story({
108
103
  args: {
109
104
  variant: 'picture',
110
105
  name: 'Binoculars',
111
106
  className: 'uy:size-[150px]',
112
107
  alt: 'Binoculars Illustration',
113
108
  },
114
- }
109
+ })
115
110
 
116
111
  /**
117
112
  * You can create responsive illustrations that adapt to different screen sizes by using responsive
118
113
  * Tailwind classes in the `className` prop. Set the `alt` prop to provide accessible descriptions
119
114
  * for screen readers when using the picture variant.
120
115
  */
121
- export const IllustratedPicture: Story = {
116
+ export const IllustratedPicture = meta.story({
122
117
  args: {
123
118
  variant: 'picture',
124
119
  name: 'VisuallyImpaired',
125
120
  className: 'uy:size-[50vmin]',
126
121
  alt: 'Visually impaired person illustration',
127
122
  },
128
- }
123
+ })
129
124
 
130
125
  /**
131
126
  * You can use the LazyIllustration component with the icon variant as well.
132
127
  * Specify the size prop to control the dimensions of the icon.
133
128
  */
134
- export const IconVariant: Story = {
129
+ export const IconVariant = meta.story({
135
130
  args: {
136
131
  variant: 'icon',
137
132
  name: 'Binoculars',
138
133
  size: 'md',
139
134
  alt: 'Binoculars Illustration',
140
135
  },
141
- }
136
+ })
142
137
 
143
138
  /**
144
139
  * LazyIllustration keeps the same logical name API while still resolving theme-aware illustration URLs.
145
140
  * The loaded asset is delegated to Illustration, so switching the active Unity theme updates the rendered source when a themed variant exists.
146
141
  */
147
- export const ThemeVariants: Story = {
142
+ export const ThemeVariants = meta.story({
148
143
  render: () => {
149
144
  return (
150
145
  <div className="uy:flex uy:flex-wrap uy:items-start uy:gap-400">
@@ -177,27 +172,27 @@ export const ThemeVariants: Story = {
177
172
  </div>
178
173
  )
179
174
  },
180
- }
175
+ })
181
176
 
182
177
  /**
183
178
  * You can create responsive illustrations that adapt to different screen sizes
184
179
  * by using responsive Tailwind classes in the className prop.
185
180
  */
186
- export const Responsive: Story = {
181
+ export const Responsive = meta.story({
187
182
  args: {
188
183
  variant: 'picture',
189
184
  name: 'WriteBook',
190
185
  className: 'uy:size-[50vmin]',
191
186
  alt: 'Write Book Illustration',
192
187
  },
193
- }
188
+ })
194
189
 
195
190
  /**
196
191
  * You can use animated illustrations with the LazyIllustration component. Animated illustrations
197
192
  * have the `Animation` suffix and are automatically loaded with their fluid sizing behavior.
198
193
  * The component detects animated assets and applies maximum dimension constraints to prevent oversizing.
199
194
  */
200
- export const AnimatedIllustrations: Story = {
195
+ export const AnimatedIllustrations = meta.story({
201
196
  parameters: {
202
197
  chromatic: { disableSnapshot: true },
203
198
  },
@@ -206,4 +201,4 @@ export const AnimatedIllustrations: Story = {
206
201
  name: 'AccountingAnimation',
207
202
  alt: 'Accounting animation showing financial calculations',
208
203
  },
209
- }
204
+ })