@teamimpact/veda-ui-blocks 0.1.0-beta.13 → 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,17 +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;
66
- isExternal?: boolean;
98
+ children?: never;
67
99
  };
68
- /** Optional: Secondary outlined call to action for the card. */
69
- callToActionSecondary?: {
100
+ /** Optional: Secondary outlined call to action for the card. Defaults to button-outline variant*/
101
+ callToActionSecondary?: LinkProps<CTA2> & {
70
102
  label: string;
71
- href: string;
72
- isExternal?: boolean;
103
+ children?: never;
73
104
  };
74
105
  /** Required: media element rendered as either the card background or
75
106
  * an image within the card.
@@ -85,6 +116,7 @@ type CardProps = {
85
116
  * "light" is intended for use on light backgrounds,
86
117
  * "dark" is intended for use on dark backgrounds, and
87
118
  * "brand" applies color styles that are brand specific.
119
+ * * Defaults to "light".
88
120
  */
89
121
  colorMode?: "light" | "dark" | "brand";
90
122
  /** Optional: Whether the card is intended to fill the width of the site with a centered container for content. */
@@ -92,24 +124,27 @@ type CardProps = {
92
124
  className?: string;
93
125
  children?: ReactNode;
94
126
  };
95
- 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;
96
128
 
97
- type CardCTAProps = ComponentProps<"a"> & {
129
+ type CardCTAProps<T extends ElementType = "a"> = AsLinkProps<T> & {
98
130
  /** Required: heading text for the card. */
99
131
  title: string;
100
- /** Required: link URL the card navigates to. */
101
- url: string;
132
+ /** Semantic heading level for the title. */
133
+ titleAs?: "h2" | "h3" | "h4" | "h5" | "h6";
102
134
  /** Optional: body copy shown below the title row. */
103
135
  description?: string;
104
136
  /** Optional: accent color used for icon and title underline on hover/focus. */
105
137
  accentColor?: string;
106
- /** Semantic heading level for the title. */
107
- titleAs?: "h2" | "h3" | "h4" | "h5" | "h6";
108
- 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;
109
144
  };
110
- 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;
111
146
 
112
- type CardDetailedProps = {
147
+ type CardDetailedProps<CTA1 extends ElementType = "a", CTA2 extends ElementType = "a"> = {
113
148
  /** Optional: intro text above the title */
114
149
  intro?: string;
115
150
  /** Optional: heading text for the card */
@@ -120,17 +155,15 @@ type CardDetailedProps = {
120
155
  tagPrimary?: ReactNode;
121
156
  /** Optional: Array of tags below description */
122
157
  tags?: ReactNode[];
123
- /** Optional: Call to action for the card. */
124
- callToAction?: {
158
+ /** Optional: Call to action for the card. Defaults to button variant */
159
+ callToAction?: LinkProps<CTA1> & {
125
160
  label: string;
126
- href: string;
127
- isExternal?: boolean;
161
+ children?: never;
128
162
  };
129
- /** Optional: Secondary outlined call to action for the card. */
130
- callToActionSecondary?: {
163
+ /** Optional: Secondary outlined call to action for the card. Defaults to button-outline variant*/
164
+ callToActionSecondary?: LinkProps<CTA2> & {
131
165
  label: string;
132
- href: string;
133
- isExternal?: boolean;
166
+ children?: never;
134
167
  };
135
168
  /** Required: media element rendered as either the card background or
136
169
  * an image within the card.
@@ -147,35 +180,33 @@ type CardDetailedProps = {
147
180
  /**
148
181
  * CardDetailed: Vertical layout, image on top, overlay tag, intro, title, description, tags, action.
149
182
  */
150
- 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;
151
184
 
152
- type CardMiniProps = {
185
+ type CardMiniProps<T extends ElementType = "a"> = AsLinkProps<T> & {
153
186
  /** Required: media element rendered as the card image thumbnail. */
154
187
  image: CardMediaElement;
155
188
  /** Required: heading text for the card. */
156
189
  title: string;
157
- /** Required: link URL the card navigates to. */
158
- url: string;
159
- /** Optional: label rendered below the title. Pass a Tag component. */
160
- tag?: ReactNode;
161
190
  /** Semantic heading level for the title. */
162
191
  titleAs?: "h2" | "h3" | "h4" | "h5" | "h6";
163
- className?: string;
164
- };
165
- declare function CardMini({ image, title, url, tag, titleAs, className }: CardMiniProps): react_jsx_runtime.JSX.Element;
166
-
167
- type CardSimpleProps = {
168
- /** Required: heading text for the card. */
169
- title: string;
170
- /** Required: media element rendered as the card background. */
171
- image: CardMediaElement;
172
- /** Required: link URL the card navigates to. */
173
- url: string;
192
+ /** Optional: label rendered below the title. Pass a Tag component. */
193
+ tag?: ReactNode;
174
194
  /**
175
195
  * Optional parameter to define the link as external to site.
176
196
  * Adds visual indication and native link properties target and rel.
177
197
  */
178
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";
179
210
  /** Optional: label rendered at the top of the card. Pass a Tag component. */
180
211
  tag?: ReactNode;
181
212
  /**
@@ -183,11 +214,75 @@ type CardSimpleProps = {
183
214
  * Defaults to `default`.
184
215
  */
185
216
  size?: "default" | "compact";
186
- /** Semantic heading level for title. */
187
- 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;
188
283
  className?: string;
189
284
  };
190
- 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;
191
286
 
192
287
  type NavItem$1 = {
193
288
  label: string;
@@ -241,87 +336,6 @@ interface HeaderProps {
241
336
  }
242
337
  declare function Header(props: HeaderProps): react_jsx_runtime.JSX.Element;
243
338
 
244
- declare const LINK_VARIANTS: readonly ["text", "button", "button-outline", "arrow"];
245
- declare const LINK_SIZES: readonly ["md", "lg"];
246
- type LinkVariant = (typeof LINK_VARIANTS)[number];
247
- type LinkSize = (typeof LINK_SIZES)[number];
248
-
249
- type LinkProps<T extends ElementType = "a"> = {
250
- /**
251
- * Optional visual treatment. Defaults to text.
252
- */
253
- variant?: LinkVariant;
254
- /**
255
- * Optional size. Defaults to md.
256
- */
257
- size?: LinkSize;
258
- /**
259
- * Optional parameter to define Link as external to site.
260
- * Adds visual indication and native link properties target and rel.
261
- */
262
- isExternal?: boolean;
263
- /** The element or component to render as (e.g. "a", "button", RouterLink) */
264
- as?: T;
265
- children: Exclude<ReactNode, null | undefined>;
266
- } & Omit<ComponentPropsWithRef<T>, "as">;
267
- /**
268
- * Polymorphic Link — renders as any element or component via the `as` prop.
269
- *
270
- * @example
271
- * // Native anchor (default)
272
- * <Link href="https://example.com">Visit</Link>
273
- *
274
- * // React Router / TanStack Router
275
- * <Link as={RouterLink} to="/about">About</Link>
276
- *
277
- * // Next.js
278
- * <Link as={NextLink} href="/dashboard">Dashboard</Link>
279
- *
280
- * // Button
281
- * <Link as="button" onClick={handleClick}>Click me</Link>
282
- */
283
- declare function Link<T extends ElementType = "a">({ variant, size, isExternal, className, as, children, ...rest }: LinkProps<T>): react_jsx_runtime.JSX.Element;
284
-
285
- type TagProps = {
286
- /**
287
- * Visual treatment for the tag.
288
- */
289
- variant?: "solid" | "outline" | "text";
290
- size?: "default" | "big";
291
- /**
292
- * Custom color used as the fill (solid variant), outline and text (outline variant), or text only (text variant) color depending on the chosen variant.
293
- */
294
- color?: string;
295
- /**
296
- * Optional override for the tag border color independent of variant.
297
- */
298
- borderColor?: string;
299
- /**
300
- * Optional override for the tag bg color independent of variant.
301
- */
302
- bgColor?: string;
303
- /**
304
- * Optional override for the tag text color independent of variant.
305
- */
306
- textColor?: string;
307
- /**
308
- * Icon to display on the left of the label. When provided, the `blocks-tag--icon` modifier is applied automatically.
309
- */
310
- icon?: ReactNode;
311
- /**
312
- * Callback for the close button. When provided, a close button is rendered automatically.
313
- */
314
- onClose?: () => void;
315
- children: ReactNode;
316
- className?: string;
317
- };
318
- /**
319
- * Our custom Tag wrapper aligned to package-level SCSS styling.
320
- * Public style contract: `.blocks-tag`, modifiers (`--solid`, `--outline`, `--text`, `--big`, `--icon`, `--x-close`),
321
- * and elements (`__icon`, `__close-button`, `__close-icon`).
322
- */
323
- declare function Tag({ variant, size, color, bgColor, borderColor, textColor, icon, onClose, children, className, }: TagProps): react_jsx_runtime.JSX.Element;
324
-
325
339
  interface GeoConfigProviderProps {
326
340
  stacApiUrl?: string;
327
341
  titilerBaseUrl?: string;
@@ -395,6 +409,8 @@ type StacCompareMapProps = {
395
409
  rightLayerConfig: StacRasterLayerConfig;
396
410
  /** Additional CSS class applied to the root container element. */
397
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;
398
414
  };
399
415
  /**
400
416
  * Smart swipe-slider map for comparing two STAC datasets side-by-side.
@@ -417,7 +433,7 @@ type StacCompareMapProps = {
417
433
  * </StacApiProvider>
418
434
  * ```
419
435
  */
420
- 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;
421
437
 
422
438
  type StacSingleLayerMapProps = {
423
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. */
@@ -426,6 +442,8 @@ type StacSingleLayerMapProps = {
426
442
  initialViewState?: Partial<ViewState>;
427
443
  /** STAC collection and date range to fetch and display as a raster tile layer. */
428
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;
429
447
  };
430
448
  /**
431
449
  * Smart map container that fetches STAC collection tiles and renders them with a legend overlay.
@@ -444,6 +462,6 @@ type StacSingleLayerMapProps = {
444
462
  * </StacApiProvider>
445
463
  * ```
446
464
  */
447
- 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;
448
466
 
449
- 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 };