@teamimpact/veda-ui-blocks 0.1.0-beta.12 → 0.1.0-beta.14

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/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ReactNode, ReactElement, ImgHTMLAttributes, SVGProps, VideoHTMLAttributes, CanvasHTMLAttributes, ComponentProps, ElementType, ComponentPropsWithRef } from 'react';
2
+ import { ReactNode, ElementType, ComponentPropsWithRef, ReactElement, ImgHTMLAttributes, SVGProps, VideoHTMLAttributes, CanvasHTMLAttributes } from 'react';
3
3
  import { StyleSpecification } from 'maplibre-gl';
4
4
  import { ViewState } from 'react-map-gl/maplibre';
5
5
 
@@ -47,10 +47,43 @@ type BannerProps = {
47
47
  */
48
48
  declare function Banner({ ariaLabel, bannerHeaderText, bannerHeaderActionText, bannerIcon, bannerExpandedContent, className, }: BannerProps): react_jsx_runtime.JSX.Element;
49
49
 
50
+ /**
51
+ * @private
52
+ * should only be used by components within veda-ui-blocks
53
+ */
54
+ type AsLinkProps<T extends ElementType = "a"> = {
55
+ /**
56
+ * The element or component to render as (e.g. "a", "button", RouterLink). Optional. Defaults to 'a'
57
+ * Note, TS is unable to check props against inferred generics when spread is used.
58
+ * For accurate prop checking, `as` prop needs to be explicitly defined.
59
+ * ex. ❌ <AsLink {...props} /> vs ✅ <AsLink {...props} as="a" />
60
+ */
61
+ as?: T;
62
+ isExternal?: boolean;
63
+ } & Omit<ComponentPropsWithRef<T>, "as">;
64
+
65
+ declare const LINK_VARIANTS: readonly ["text", "button", "button-outline", "arrow"];
66
+ declare const LINK_SIZES: readonly ["md", "lg"];
67
+ type LinkVariant = (typeof LINK_VARIANTS)[number];
68
+ type LinkSize = (typeof LINK_SIZES)[number];
69
+
70
+ type LinkProps<T extends ElementType = "a"> = AsLinkProps<T> & {
71
+ /**
72
+ * Optional visual treatment. Defaults to text.
73
+ */
74
+ variant?: LinkVariant;
75
+ /**
76
+ * Optional size. Defaults to md.
77
+ */
78
+ size?: LinkSize;
79
+ isExternal?: boolean;
80
+ };
81
+ declare function Link<T extends ElementType>({ variant, size, isExternal, className, as, children, ...rest }: LinkProps<T>): react_jsx_runtime.JSX.Element;
82
+
50
83
  type CardMediaElement = ReactElement<ImgHTMLAttributes<HTMLImageElement>, "img"> | ReactElement<SVGProps<SVGSVGElement>, "svg"> | ReactElement<VideoHTMLAttributes<HTMLVideoElement>, "video"> | ReactElement<CanvasHTMLAttributes<HTMLCanvasElement>, "canvas">;
51
84
  type LogoMediaElement = ReactElement<ImgHTMLAttributes<HTMLImageElement>, "img"> | ReactElement<SVGProps<SVGSVGElement>, "svg">;
52
85
 
53
- type CardProps = {
86
+ type CardProps<CTA1 extends ElementType = "a", CTA2 extends ElementType = "a"> = {
54
87
  /** Optional: label/tag shown above title. */
55
88
  tag?: ReactNode;
56
89
  /** Optional: heading text for the card. */
@@ -59,15 +92,15 @@ type CardProps = {
59
92
  subtitle?: string;
60
93
  /** Optional: body text for the card. */
61
94
  description?: string;
62
- /** Optional: Call to action for the card. */
63
- callToAction?: {
95
+ /** Optional: Call to action for the card. Defaults to button variant */
96
+ callToAction?: LinkProps<CTA1> & {
64
97
  label: string;
65
- href: string;
98
+ children?: never;
66
99
  };
67
- /** Optional: Secondary outlined call to action for the card. */
68
- callToActionSecondary?: {
100
+ /** Optional: Secondary outlined call to action for the card. Defaults to button-outline variant*/
101
+ callToActionSecondary?: LinkProps<CTA2> & {
69
102
  label: string;
70
- href: string;
103
+ children?: never;
71
104
  };
72
105
  /** Required: media element rendered as either the card background or
73
106
  * an image within the card.
@@ -83,6 +116,7 @@ type CardProps = {
83
116
  * "light" is intended for use on light backgrounds,
84
117
  * "dark" is intended for use on dark backgrounds, and
85
118
  * "brand" applies color styles that are brand specific.
119
+ * * Defaults to "light".
86
120
  */
87
121
  colorMode?: "light" | "dark" | "brand";
88
122
  /** Optional: Whether the card is intended to fill the width of the site with a centered container for content. */
@@ -90,24 +124,27 @@ type CardProps = {
90
124
  className?: string;
91
125
  children?: ReactNode;
92
126
  };
93
- declare function Card({ tag, title, description, subtitle, callToAction, callToActionSecondary, image, imagePosition, colorMode, isMastHead, className, children, }: CardProps): react_jsx_runtime.JSX.Element;
127
+ declare function Card<CTA1 extends ElementType, CTA2 extends ElementType>(props: CardProps<CTA1, CTA2>): react_jsx_runtime.JSX.Element;
94
128
 
95
- type CardCTAProps = ComponentProps<"a"> & {
129
+ type CardCTAProps<T extends ElementType = "a"> = AsLinkProps<T> & {
96
130
  /** Required: heading text for the card. */
97
131
  title: string;
98
- /** Required: link URL the card navigates to. */
99
- url: string;
132
+ /** Semantic heading level for the title. */
133
+ titleAs?: "h2" | "h3" | "h4" | "h5" | "h6";
100
134
  /** Optional: body copy shown below the title row. */
101
135
  description?: string;
102
136
  /** Optional: accent color used for icon and title underline on hover/focus. */
103
137
  accentColor?: string;
104
- /** Semantic heading level for the title. */
105
- titleAs?: "h2" | "h3" | "h4" | "h5" | "h6";
106
- className?: string;
138
+ /**
139
+ * Optional parameter to define the link as external to site.
140
+ * Adds visual indication and native link properties target and rel.
141
+ */
142
+ isExternal?: boolean;
143
+ children?: never;
107
144
  };
108
- declare function CardCTA({ title, url, description, accentColor, titleAs, className, style, ...rest }: CardCTAProps): react_jsx_runtime.JSX.Element;
145
+ declare function CardCTA<T extends ElementType>({ title, titleAs, description, accentColor, className, style, isExternal, as, ...rest }: CardCTAProps<T>): react_jsx_runtime.JSX.Element;
109
146
 
110
- type CardDetailedProps = {
147
+ type CardDetailedProps<CTA1 extends ElementType = "a", CTA2 extends ElementType = "a"> = {
111
148
  /** Optional: intro text above the title */
112
149
  intro?: string;
113
150
  /** Optional: heading text for the card */
@@ -118,15 +155,15 @@ type CardDetailedProps = {
118
155
  tagPrimary?: ReactNode;
119
156
  /** Optional: Array of tags below description */
120
157
  tags?: ReactNode[];
121
- /** Optional: Call to action for the card. */
122
- callToAction?: {
158
+ /** Optional: Call to action for the card. Defaults to button variant */
159
+ callToAction?: LinkProps<CTA1> & {
123
160
  label: string;
124
- href: string;
161
+ children?: never;
125
162
  };
126
- /** Optional: Secondary outlined call to action for the card. */
127
- callToActionSecondary?: {
163
+ /** Optional: Secondary outlined call to action for the card. Defaults to button-outline variant*/
164
+ callToActionSecondary?: LinkProps<CTA2> & {
128
165
  label: string;
129
- href: string;
166
+ children?: never;
130
167
  };
131
168
  /** Required: media element rendered as either the card background or
132
169
  * an image within the card.
@@ -143,35 +180,33 @@ type CardDetailedProps = {
143
180
  /**
144
181
  * CardDetailed: Vertical layout, image on top, overlay tag, intro, title, description, tags, action.
145
182
  */
146
- declare function CardDetailed({ intro, title, description, tags, callToAction, callToActionSecondary, tagPrimary, image, imagePosition, className, }: CardDetailedProps): react_jsx_runtime.JSX.Element;
183
+ declare function CardDetailed<CTA1 extends ElementType, CTA2 extends ElementType>({ intro, title, description, tags, callToAction, callToActionSecondary, tagPrimary, image, imagePosition, className, }: CardDetailedProps<CTA1, CTA2>): react_jsx_runtime.JSX.Element;
147
184
 
148
- type CardMiniProps = {
185
+ type CardMiniProps<T extends ElementType = "a"> = AsLinkProps<T> & {
149
186
  /** Required: media element rendered as the card image thumbnail. */
150
187
  image: CardMediaElement;
151
188
  /** Required: heading text for the card. */
152
189
  title: string;
153
- /** Required: link URL the card navigates to. */
154
- url: string;
155
- /** Optional: label rendered below the title. Pass a Tag component. */
156
- tag?: ReactNode;
157
190
  /** Semantic heading level for the title. */
158
191
  titleAs?: "h2" | "h3" | "h4" | "h5" | "h6";
159
- className?: string;
160
- };
161
- declare function CardMini({ image, title, url, tag, titleAs, className }: CardMiniProps): react_jsx_runtime.JSX.Element;
162
-
163
- type CardSimpleProps = {
164
- /** Required: heading text for the card. */
165
- title: string;
166
- /** Required: media element rendered as the card background. */
167
- image: CardMediaElement;
168
- /** Required: link URL the card navigates to. */
169
- url: string;
192
+ /** Optional: label rendered below the title. Pass a Tag component. */
193
+ tag?: ReactNode;
170
194
  /**
171
195
  * Optional parameter to define the link as external to site.
172
196
  * Adds visual indication and native link properties target and rel.
173
197
  */
174
198
  isExternal?: boolean;
199
+ children?: never;
200
+ };
201
+ declare function CardMini<T extends ElementType>({ image, title, titleAs, tag, className, isExternal, as, ...rest }: CardMiniProps<T>): react_jsx_runtime.JSX.Element;
202
+
203
+ type CardSimpleProps<T extends ElementType = "a"> = AsLinkProps<T> & {
204
+ /** Required: media element rendered as the card background. */
205
+ image: CardMediaElement;
206
+ /** Required: heading text for the card. */
207
+ title: string;
208
+ /** Semantic heading level for title. */
209
+ titleAs?: "h2" | "h3" | "h4" | "h5" | "h6";
175
210
  /** Optional: label rendered at the top of the card. Pass a Tag component. */
176
211
  tag?: ReactNode;
177
212
  /**
@@ -179,11 +214,75 @@ type CardSimpleProps = {
179
214
  * Defaults to `default`.
180
215
  */
181
216
  size?: "default" | "compact";
182
- /** Semantic heading level for title. */
183
- titleAs?: "h2" | "h3" | "h4" | "h5" | "h6";
217
+ /**
218
+ * Optional parameter to define the link as external to site.
219
+ * Adds visual indication and native link properties target and rel.
220
+ */
221
+ isExternal?: boolean;
222
+ children?: never;
223
+ };
224
+ declare function CardSimple<T extends ElementType>({ image, title, titleAs, tag, size, className, isExternal, as, ...rest }: CardSimpleProps<T>): react_jsx_runtime.JSX.Element;
225
+
226
+ type TagProps = {
227
+ /**
228
+ * Visual treatment for the tag. Defaults to solid.
229
+ */
230
+ variant?: "solid" | "outline" | "text";
231
+ size?: "default" | "big";
232
+ /**
233
+ * Custom color used as the fill (solid variant), outline and text (outline variant), or text only (text variant) color depending on the chosen variant.
234
+ */
235
+ color?: string;
236
+ /**
237
+ * Optional override for the tag border color independent of variant.
238
+ */
239
+ borderColor?: string;
240
+ /**
241
+ * Optional override for the tag bg color independent of variant.
242
+ */
243
+ bgColor?: string;
244
+ /**
245
+ * Optional override for the tag text color independent of variant.
246
+ */
247
+ textColor?: string;
248
+ /**
249
+ * Icon to display on the left of the label. When provided, the `blocks-tag--icon` modifier is applied automatically.
250
+ */
251
+ icon?: ReactNode;
252
+ /**
253
+ * Callback for the close button. When provided, a close button is rendered automatically.
254
+ */
255
+ onClose?: () => void;
256
+ children: ReactNode;
257
+ className?: string;
258
+ };
259
+ /**
260
+ * Our custom Tag wrapper aligned to package-level SCSS styling.
261
+ * Public style contract: `.blocks-tag`, modifiers (`--solid`, `--outline`, `--text`, `--big`, `--icon`, `--x-close`),
262
+ * and elements (`__icon`, `__close-button`, `__close-icon`).
263
+ */
264
+ declare function Tag({ variant, size, color, bgColor, borderColor, textColor, icon, onClose, children, className, }: TagProps): react_jsx_runtime.JSX.Element;
265
+
266
+ type CarouselItem = Omit<CardProps, "tag" | "imagePosition" | "colorMode" | "isMastHead" | "subtitle" | "callToActionSecondary" | "className" | "children"> & {
267
+ /** Optional: label rendered as a Tag above the title. */
268
+ tag?: Omit<TagProps, "onClose" | "children"> & {
269
+ label: string;
270
+ };
271
+ };
272
+ type CarouselProps = {
273
+ /** Required: array of slide data rendered as Card components. */
274
+ items: CarouselItem[];
275
+ /**
276
+ * Optional: max number of cards visible at once on desktop.
277
+ * - 1: full width (1 card per view)
278
+ * - 2: half width, 2 cards side by side (default)
279
+ * - 3: third width, 3 cards side by side
280
+ * All layouts collapse to 1 card per view on mobile.
281
+ */
282
+ maxVisibleItems?: 1 | 2 | 3;
184
283
  className?: string;
185
284
  };
186
- declare function CardSimple({ title, image, url, isExternal, tag, size, titleAs, className, }: CardSimpleProps): react_jsx_runtime.JSX.Element;
285
+ declare function Carousel({ items, maxVisibleItems, className }: CarouselProps): react_jsx_runtime.JSX.Element;
187
286
 
188
287
  type NavItem$1 = {
189
288
  label: string;
@@ -237,87 +336,6 @@ interface HeaderProps {
237
336
  }
238
337
  declare function Header(props: HeaderProps): react_jsx_runtime.JSX.Element;
239
338
 
240
- declare const LINK_VARIANTS: readonly ["text", "button", "button-outline", "arrow"];
241
- declare const LINK_SIZES: readonly ["md", "lg"];
242
- type LinkVariant = (typeof LINK_VARIANTS)[number];
243
- type LinkSize = (typeof LINK_SIZES)[number];
244
-
245
- type LinkProps<T extends ElementType = "a"> = {
246
- /**
247
- * Optional visual treatment. Defaults to text.
248
- */
249
- variant?: LinkVariant;
250
- /**
251
- * Optional size. Defaults to md.
252
- */
253
- size?: LinkSize;
254
- /**
255
- * Optional parameter to define Link as external to site.
256
- * Adds visual indication and native link properties target and rel.
257
- */
258
- isExternal?: boolean;
259
- /** The element or component to render as (e.g. "a", "button", RouterLink) */
260
- as?: T;
261
- children: Exclude<ReactNode, null | undefined>;
262
- } & Omit<ComponentPropsWithRef<T>, "as">;
263
- /**
264
- * Polymorphic Link — renders as any element or component via the `as` prop.
265
- *
266
- * @example
267
- * // Native anchor (default)
268
- * <Link href="https://example.com">Visit</Link>
269
- *
270
- * // React Router / TanStack Router
271
- * <Link as={RouterLink} to="/about">About</Link>
272
- *
273
- * // Next.js
274
- * <Link as={NextLink} href="/dashboard">Dashboard</Link>
275
- *
276
- * // Button
277
- * <Link as="button" onClick={handleClick}>Click me</Link>
278
- */
279
- declare function Link<T extends ElementType = "a">({ variant, size, isExternal, className, as, children, ...rest }: LinkProps<T>): react_jsx_runtime.JSX.Element;
280
-
281
- type TagProps = {
282
- /**
283
- * Visual treatment for the tag.
284
- */
285
- variant?: "solid" | "outline" | "text";
286
- size?: "default" | "big";
287
- /**
288
- * Custom color used as the fill (solid variant), outline and text (outline variant), or text only (text variant) color depending on the chosen variant.
289
- */
290
- color?: string;
291
- /**
292
- * Optional override for the tag border color independent of variant.
293
- */
294
- borderColor?: string;
295
- /**
296
- * Optional override for the tag bg color independent of variant.
297
- */
298
- bgColor?: string;
299
- /**
300
- * Optional override for the tag text color independent of variant.
301
- */
302
- textColor?: string;
303
- /**
304
- * Icon to display on the left of the label. When provided, the `blocks-tag--icon` modifier is applied automatically.
305
- */
306
- icon?: ReactNode;
307
- /**
308
- * Callback for the close button. When provided, a close button is rendered automatically.
309
- */
310
- onClose?: () => void;
311
- children: ReactNode;
312
- className?: string;
313
- };
314
- /**
315
- * Our custom Tag wrapper aligned to package-level SCSS styling.
316
- * Public style contract: `.blocks-tag`, modifiers (`--solid`, `--outline`, `--text`, `--big`, `--icon`, `--x-close`),
317
- * and elements (`__icon`, `__close-button`, `__close-icon`).
318
- */
319
- declare function Tag({ variant, size, color, bgColor, borderColor, textColor, icon, onClose, children, className, }: TagProps): react_jsx_runtime.JSX.Element;
320
-
321
339
  interface GeoConfigProviderProps {
322
340
  stacApiUrl?: string;
323
341
  titilerBaseUrl?: string;
@@ -391,6 +409,8 @@ type StacCompareMapProps = {
391
409
  rightLayerConfig: StacRasterLayerConfig;
392
410
  /** Additional CSS class applied to the root container element. */
393
411
  className?: string;
412
+ /** When true, renders a click-to-activate overlay that prevents scroll hijacking. The overlay reappears when the user clicks outside the map. */
413
+ showScrollGuard?: boolean;
394
414
  };
395
415
  /**
396
416
  * Smart swipe-slider map for comparing two STAC datasets side-by-side.
@@ -413,7 +433,7 @@ type StacCompareMapProps = {
413
433
  * </StacApiProvider>
414
434
  * ```
415
435
  */
416
- declare function StacCompareMap({ baseMapStyle, initialViewState, leftLayerConfig, rightLayerConfig, className, }: StacCompareMapProps): react_jsx_runtime.JSX.Element;
436
+ declare function StacCompareMap({ baseMapStyle, initialViewState, leftLayerConfig, rightLayerConfig, className, showScrollGuard, }: StacCompareMapProps): react_jsx_runtime.JSX.Element;
417
437
 
418
438
  type StacSingleLayerMapProps = {
419
439
  /** MapLibre base map style URL or style object. Defaults to Carto Dark with labels. For known vector styles the label layer is derived automatically so STAC data renders beneath labels. */
@@ -422,6 +442,8 @@ type StacSingleLayerMapProps = {
422
442
  initialViewState?: Partial<ViewState>;
423
443
  /** STAC collection and date range to fetch and display as a raster tile layer. */
424
444
  layerConfig: StacRasterLayerConfig;
445
+ /** When true, renders a click-to-activate overlay that prevents scroll hijacking. The overlay reappears when the user clicks outside the map. */
446
+ showScrollGuard?: boolean;
425
447
  };
426
448
  /**
427
449
  * Smart map container that fetches STAC collection tiles and renders them with a legend overlay.
@@ -440,6 +462,6 @@ type StacSingleLayerMapProps = {
440
462
  * </StacApiProvider>
441
463
  * ```
442
464
  */
443
- declare function StacSingleLayerMap({ baseMapStyle, initialViewState, layerConfig, }: StacSingleLayerMapProps): react_jsx_runtime.JSX.Element;
465
+ declare function StacSingleLayerMap({ baseMapStyle, initialViewState, layerConfig, showScrollGuard, }: StacSingleLayerMapProps): react_jsx_runtime.JSX.Element;
444
466
 
445
- export { Banner, type BannerProps, CARTO_DARK_BASEMAP_STYLE, CARTO_DARK_WITH_LABELS_BASEMAP_STYLE, CARTO_LABELS_LAYER_ID, Card, CardCTA, type CardCTAProps, CardDetailed, type CardDetailedProps, CardMini, type CardMiniProps, type CardProps, CardSimple, type CardSimpleProps, Footer, type FooterProps, GeoConfigProvider, type GeoConfigProviderProps, Header, type HeaderProps, Legend, type LegendProps, Link, type LinkProps, NASA_BLUE_MARBLE_BASEMAP_STYLE, OPEN_FREE_MAP_DARK_BASEMAP_STYLE, OPEN_FREE_MAP_LABELS_LAYER_ID, StacCompareMap, type StacCompareMapProps, StacSingleLayerMap, type StacSingleLayerMapProps, Tag, type TagProps };
467
+ export { Banner, type BannerProps, CARTO_DARK_BASEMAP_STYLE, CARTO_DARK_WITH_LABELS_BASEMAP_STYLE, CARTO_LABELS_LAYER_ID, Card, CardCTA, type CardCTAProps, CardDetailed, type CardDetailedProps, CardMini, type CardMiniProps, type CardProps, CardSimple, type CardSimpleProps, Carousel, type CarouselProps, Footer, type FooterProps, GeoConfigProvider, type GeoConfigProviderProps, Header, type HeaderProps, Legend, type LegendProps, Link, type LinkProps, NASA_BLUE_MARBLE_BASEMAP_STYLE, OPEN_FREE_MAP_DARK_BASEMAP_STYLE, OPEN_FREE_MAP_LABELS_LAYER_ID, StacCompareMap, type StacCompareMapProps, StacSingleLayerMap, type StacSingleLayerMapProps, Tag, type TagProps };