@brightlocal/ui-components 2.0.1 → 2.1.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.
@@ -234,6 +234,12 @@ SplitLayoutContentLeft.displayName = "SplitLayoutContentLeft";
234
234
 
235
235
  interface SplitLayoutContentRightProps extends React.ComponentProps<"div"> {
236
236
  children: React.ReactNode;
237
+ /**
238
+ * Removes padding so content can fill edge-to-edge.
239
+ * Use with `SplitLayoutImage` for full-bleed imagery.
240
+ * @default false
241
+ */
242
+ flush?: boolean;
237
243
  }
238
244
 
239
245
  /**
@@ -241,16 +247,21 @@ interface SplitLayoutContentRightProps extends React.ComponentProps<"div"> {
241
247
  *
242
248
  * Hidden on mobile/tablet (<1024px), visible on desktop (≥1024px).
243
249
  * Uses bg-card background color.
250
+ *
251
+ * Set `flush` to remove padding for full-bleed content (e.g. images).
244
252
  */
245
253
  const SplitLayoutContentRight = React.forwardRef<
246
254
  HTMLDivElement,
247
255
  SplitLayoutContentRightProps
248
- >(({ className, children, ...props }, ref) => {
256
+ >(({ className, flush = false, children, ...props }, ref) => {
249
257
  return (
250
258
  <div
251
259
  ref={ref}
252
260
  className={cn(
253
- "bg-card p-section-sm hidden flex-1 items-center justify-center overflow-auto lg:flex",
261
+ "bg-card hidden",
262
+ flush
263
+ ? "relative h-screen overflow-hidden lg:block lg:w-1/2 lg:shrink-0"
264
+ : "p-section-sm flex-1 items-center justify-center overflow-auto lg:flex",
254
265
  className
255
266
  )}
256
267
  data-slot="split-layout-right"
@@ -263,6 +274,87 @@ const SplitLayoutContentRight = React.forwardRef<
263
274
 
264
275
  SplitLayoutContentRight.displayName = "SplitLayoutContentRight";
265
276
 
277
+ /* -------------------------------------------------------------------------------------------------
278
+ * SplitLayoutImage
279
+ * -----------------------------------------------------------------------------------------------*/
280
+
281
+ interface SplitLayoutImageProps extends React.ComponentProps<"img"> {
282
+ /**
283
+ * Data hook for automated testing (REQUIRED)
284
+ */
285
+ dataHook: string;
286
+ /**
287
+ * Image source URL
288
+ */
289
+ src: string;
290
+ /**
291
+ * Alt text for the image
292
+ */
293
+ alt: string;
294
+ /**
295
+ * How the image fits its container.
296
+ * @default "cover"
297
+ */
298
+ objectFit?: "cover" | "contain";
299
+ /**
300
+ * CSS object-position value controlling the focal point of the image.
301
+ * @default "center"
302
+ * @example "top", "center", "left 30%"
303
+ */
304
+ objectPosition?: string;
305
+ }
306
+
307
+ /**
308
+ * SplitLayoutImage — Full-bleed image for the right section of a SplitLayout.
309
+ *
310
+ * Fills the entire right panel with no margins. Uses `object-cover` by default
311
+ * so the image scales and crops naturally as the viewport resizes.
312
+ *
313
+ * Must be used inside `<SplitLayoutContentRight flush>`.
314
+ *
315
+ * @example
316
+ * <SplitLayoutContentRight flush>
317
+ * <SplitLayoutImage
318
+ * dataHook="signup-hero"
319
+ * src="/images/signup-step-1.png"
320
+ * alt="Welcome illustration"
321
+ * />
322
+ * </SplitLayoutContentRight>
323
+ */
324
+ const SplitLayoutImage = React.forwardRef<
325
+ HTMLImageElement,
326
+ SplitLayoutImageProps
327
+ >(
328
+ (
329
+ {
330
+ className,
331
+ dataHook,
332
+ src,
333
+ alt,
334
+ objectFit = "cover",
335
+ objectPosition = "center",
336
+ style,
337
+ ...props
338
+ },
339
+ ref
340
+ ) => {
341
+ return (
342
+ <img
343
+ ref={ref}
344
+ alt={alt}
345
+ className={cn("absolute inset-0 h-full w-full", className)}
346
+ data-hook={dataHook}
347
+ data-slot="split-layout-image"
348
+ src={src}
349
+ style={{ objectFit, objectPosition, ...style }}
350
+ {...props}
351
+ />
352
+ );
353
+ }
354
+ );
355
+
356
+ SplitLayoutImage.displayName = "SplitLayoutImage";
357
+
266
358
  /* -------------------------------------------------------------------------------------------------
267
359
  * Exports
268
360
  * -----------------------------------------------------------------------------------------------*/
@@ -272,8 +364,10 @@ export {
272
364
  SplitLayoutHeader,
273
365
  SplitLayoutContentLeft,
274
366
  SplitLayoutContentRight,
367
+ SplitLayoutImage,
275
368
  type SplitLayoutProps,
276
369
  type SplitLayoutHeaderProps,
277
370
  type SplitLayoutContentLeftProps,
278
371
  type SplitLayoutContentRightProps,
372
+ type SplitLayoutImageProps,
279
373
  };