@jackbernnie/hiyf 0.3.3 → 0.3.5
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.
|
@@ -4,10 +4,12 @@
|
|
|
4
4
|
* Raw <iframe> map embeds are an off-system escape hatch: every provider URL,
|
|
5
5
|
* viewport shape, loading behavior, and frame treatment would be up for grabs.
|
|
6
6
|
* This wrapper closes it:
|
|
7
|
-
* - Location is expressed only as decimal latitude/longitude with
|
|
8
|
-
*
|
|
7
|
+
* - Location is expressed only as decimal latitude/longitude with a
|
|
8
|
+
* clamped zoom.
|
|
9
9
|
* - The embed always uses the approved responsive 16:9 frame, rounded
|
|
10
|
-
* corners, muted loading surface, and
|
|
10
|
+
* corners, muted loading surface, and a keyless OpenStreetMap embed with
|
|
11
|
+
* a marker pin — reliable for every coordinate (Google's keyless embed is
|
|
12
|
+
* deprecated and renders inconsistently).
|
|
11
13
|
* - NO `className`/`style` escape hatch. Need a new map affordance? Add it
|
|
12
14
|
* here so every map stays on-system.
|
|
13
15
|
*/
|
|
@@ -16,12 +18,10 @@ export interface MapEmbedProps {
|
|
|
16
18
|
lat: number;
|
|
17
19
|
/** Longitude in decimal degrees. */
|
|
18
20
|
lon: number;
|
|
19
|
-
/** Zoom level 1-21. Defaults to 14. */
|
|
21
|
+
/** Zoom level 1-21. Defaults to 14. Controls the size of the map window. */
|
|
20
22
|
zoom?: number;
|
|
21
|
-
/** 'satellite' (default) or 'map'. */
|
|
22
|
-
view?: 'map' | 'satellite';
|
|
23
23
|
/** Accessible title for the embed. Defaults to 'Map'. */
|
|
24
24
|
title?: string;
|
|
25
25
|
}
|
|
26
26
|
/** Closed responsive map embed — no className/style. */
|
|
27
|
-
export declare function MapEmbed({ lat, lon, zoom,
|
|
27
|
+
export declare function MapEmbed({ lat, lon, zoom, title, }: MapEmbedProps): import("react").JSX.Element | null;
|
|
@@ -5,7 +5,6 @@ function MapEmbed({
|
|
|
5
5
|
lat,
|
|
6
6
|
lon,
|
|
7
7
|
zoom = 14,
|
|
8
|
-
view = "satellite",
|
|
9
8
|
title = "Map"
|
|
10
9
|
}) {
|
|
11
10
|
if (!Number.isFinite(lat) || !Number.isFinite(lon)) {
|
|
@@ -13,7 +12,9 @@ function MapEmbed({
|
|
|
13
12
|
}
|
|
14
13
|
const zoomValue = Number.isNaN(zoom) ? 14 : zoom;
|
|
15
14
|
const clampedZoom = Math.min(21, Math.max(1, zoomValue));
|
|
16
|
-
const
|
|
15
|
+
const half = Math.min(20, Math.max(4e-3, 40 / 2 ** clampedZoom));
|
|
16
|
+
const bbox = `${lon - half},${lat - half},${lon + half},${lat + half}`;
|
|
17
|
+
const src = `https://www.openstreetmap.org/export/embed.html?bbox=${bbox}&layer=mapnik&marker=${lat},${lon}`;
|
|
17
18
|
return /* @__PURE__ */ jsx("div", { className: "w-full overflow-hidden rounded-lg bg-muted", children: /* @__PURE__ */ jsx(AspectRatio, { ratio: 16 / 9, children: /* @__PURE__ */ jsx(
|
|
18
19
|
"iframe",
|
|
19
20
|
{
|
|
@@ -40,6 +40,8 @@ export interface TableColumn<T> {
|
|
|
40
40
|
filterValue?: string;
|
|
41
41
|
/** Called when a filter option is selected. */
|
|
42
42
|
onFilterChange?: (value: string) => void;
|
|
43
|
+
/** Optional explanatory text shown in a hover tooltip via an info icon next to the header. */
|
|
44
|
+
headerInfo?: string;
|
|
43
45
|
/**
|
|
44
46
|
* Optional custom renderer for this column's cell.
|
|
45
47
|
* Receives the full row object and returns a React node.
|
package/dist/components/Table.js
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import { Table as Table$1, TableCaption, TableHeader, TableRow, TableHead, TableBody, TableCell } from './ui/table.js';
|
|
4
4
|
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator } from './ui/dropdown-menu.js';
|
|
5
|
+
import { Tooltip } from './Tooltip.js';
|
|
6
|
+
import { HugeiconsIcon } from '@hugeicons/react';
|
|
7
|
+
import { InformationCircleIcon } from '@hugeicons/core-free-icons';
|
|
5
8
|
|
|
6
9
|
const ALIGN_CLASS = {
|
|
7
10
|
left: "text-left",
|
|
@@ -124,12 +127,13 @@ function HeaderContent({
|
|
|
124
127
|
onSortChange
|
|
125
128
|
}) {
|
|
126
129
|
const hasMenu = column.sortable || column.filterOptions && column.filterOptions.length > 0;
|
|
127
|
-
if (!hasMenu) {
|
|
130
|
+
if (!hasMenu && !column.headerInfo) {
|
|
128
131
|
return /* @__PURE__ */ jsx(Fragment, { children: column.header });
|
|
129
132
|
}
|
|
130
133
|
return /* @__PURE__ */ jsxs("div", { className: `flex items-center gap-1 ${HEADER_FLEX_CLASS[column.align ?? "left"]}`, children: [
|
|
131
134
|
/* @__PURE__ */ jsx("span", { children: column.header }),
|
|
132
|
-
/* @__PURE__ */ jsx(
|
|
135
|
+
column.headerInfo ? /* @__PURE__ */ jsx(Tooltip, { content: column.headerInfo, children: /* @__PURE__ */ jsx("span", { className: "inline-flex cursor-help text-muted-foreground/70 transition-colors hover:text-foreground", children: /* @__PURE__ */ jsx(HugeiconsIcon, { icon: InformationCircleIcon, size: 14 }) }) }) : null,
|
|
136
|
+
hasMenu ? /* @__PURE__ */ jsx(HeaderMenu, { column, sort, onSortChange }) : null
|
|
133
137
|
] });
|
|
134
138
|
}
|
|
135
139
|
function rowClickIsFromInteractiveElement(event) {
|
package/package.json
CHANGED