@contractspec/lib.ui-kit-web 3.7.5 → 3.8.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.
Files changed (234) hide show
  1. package/README.md +33 -88
  2. package/dist/browser/ui/accordion.js +4 -4
  3. package/dist/browser/ui/alert-dialog.js +9 -9
  4. package/dist/browser/ui/alert.js +4 -4
  5. package/dist/browser/ui/atoms/FilterSelect/FilterSelect.js +51 -51
  6. package/dist/browser/ui/atoms/FilterSelect/index.js +51 -51
  7. package/dist/browser/ui/atoms/LoadingSpinner/LoadingSpinner.js +1 -1
  8. package/dist/browser/ui/atoms/Pagination/Pagination.js +13 -13
  9. package/dist/browser/ui/atoms/Pagination/index.js +13 -13
  10. package/dist/browser/ui/atoms/SearchInput/SearchInput.js +8 -8
  11. package/dist/browser/ui/atoms/SearchInput/index.js +8 -8
  12. package/dist/browser/ui/avatar.js +1 -1
  13. package/dist/browser/ui/badge.js +3 -3
  14. package/dist/browser/ui/breadcrumb.js +4 -4
  15. package/dist/browser/ui/button.js +5 -5
  16. package/dist/browser/ui/calendar.js +21 -21
  17. package/dist/browser/ui/card.js +2 -2
  18. package/dist/browser/ui/carousel.js +6 -6
  19. package/dist/browser/ui/checkbox.js +2 -2
  20. package/dist/browser/ui/command.js +14 -14
  21. package/dist/browser/ui/confirm-dialog.js +9 -9
  22. package/dist/browser/ui/context-menu.js +10 -10
  23. package/dist/browser/ui/cta.js +5 -5
  24. package/dist/browser/ui/data-table.js +1005 -0
  25. package/dist/browser/ui/data-table.parts.js +463 -0
  26. package/dist/browser/ui/date-picker.js +26 -26
  27. package/dist/browser/ui/date-range-picker.js +24 -24
  28. package/dist/browser/ui/datetime-picker.js +29 -29
  29. package/dist/browser/ui/dialog.js +5 -5
  30. package/dist/browser/ui/drawer.js +5 -5
  31. package/dist/browser/ui/dropdown-menu.js +10 -10
  32. package/dist/browser/ui/empty-state.js +5 -5
  33. package/dist/browser/ui/empty.js +7 -7
  34. package/dist/browser/ui/field.js +12 -12
  35. package/dist/browser/ui/form.js +4 -4
  36. package/dist/browser/ui/hover-card.js +2 -2
  37. package/dist/browser/ui/input-group.js +16 -16
  38. package/dist/browser/ui/input-otp.js +4 -4
  39. package/dist/browser/ui/input.js +1 -1
  40. package/dist/browser/ui/label.js +2 -2
  41. package/dist/browser/ui/loading-button.js +8 -8
  42. package/dist/browser/ui/marketing/FeatureGrid.js +3 -3
  43. package/dist/browser/ui/marketing/Hero.js +7 -7
  44. package/dist/browser/ui/marketing/PricingTable.js +10 -10
  45. package/dist/browser/ui/menubar.js +12 -12
  46. package/dist/browser/ui/molecules/Autocomplete/index.js +26 -26
  47. package/dist/browser/ui/molecules/SearchAndFilter/SearchAndFilter.js +62 -62
  48. package/dist/browser/ui/molecules/SearchAndFilter/index.js +62 -62
  49. package/dist/browser/ui/molecules/SkeletonList.js +1 -1
  50. package/dist/browser/ui/nav-layout.js +22 -22
  51. package/dist/browser/ui/navigation-menu.js +7 -7
  52. package/dist/browser/ui/organisms/ErrorBoundary/ErrorBoundary.js +11 -11
  53. package/dist/browser/ui/organisms/ListPage/ListPage.js +84 -84
  54. package/dist/browser/ui/page-header.js +4 -4
  55. package/dist/browser/ui/pagination.js +6 -6
  56. package/dist/browser/ui/popover.js +2 -2
  57. package/dist/browser/ui/progress.js +3 -3
  58. package/dist/browser/ui/radio-group.js +3 -3
  59. package/dist/browser/ui/resizable.js +3 -3
  60. package/dist/browser/ui/scroll-area.js +4 -4
  61. package/dist/browser/ui/section.js +1 -1
  62. package/dist/browser/ui/select.js +6 -6
  63. package/dist/browser/ui/separator.js +2 -2
  64. package/dist/browser/ui/sheet.js +5 -5
  65. package/dist/browser/ui/sidebar.js +64 -64
  66. package/dist/browser/ui/skeleton.js +1 -1
  67. package/dist/browser/ui/slider.js +6 -6
  68. package/dist/browser/ui/stack.js +1 -1
  69. package/dist/browser/ui/stat-card-group.js +5 -5
  70. package/dist/browser/ui/stepper.js +2 -2
  71. package/dist/browser/ui/switch.js +3 -3
  72. package/dist/browser/ui/table.js +5 -5
  73. package/dist/browser/ui/tabs.js +3 -3
  74. package/dist/browser/ui/text.js +2 -2
  75. package/dist/browser/ui/textarea.js +1 -1
  76. package/dist/browser/ui/time-picker.js +10 -10
  77. package/dist/browser/ui/toast.js +5 -5
  78. package/dist/browser/ui/toaster.js +5 -5
  79. package/dist/browser/ui/toggle-group.js +7 -7
  80. package/dist/browser/ui/toggle.js +5 -5
  81. package/dist/browser/ui/tooltip.js +3 -3
  82. package/dist/browser/ui/typography.js +14 -14
  83. package/dist/browser/ui/usecases/UseCaseCard.js +8 -8
  84. package/dist/browser/ui/usecases/UserStoryCard.js +3 -3
  85. package/dist/browser/ui/visualization/Visualization.js +439 -0
  86. package/dist/browser/ui/visualization/Visualization.support.js +128 -0
  87. package/dist/browser/ui/visualization/index.js +10 -0
  88. package/dist/ui/accordion.d.ts +2 -2
  89. package/dist/ui/accordion.js +4 -4
  90. package/dist/ui/alert-dialog.d.ts +2 -2
  91. package/dist/ui/alert-dialog.js +9 -9
  92. package/dist/ui/alert.d.ts +2 -2
  93. package/dist/ui/alert.js +4 -4
  94. package/dist/ui/atoms/FilterSelect/FilterSelect.js +51 -51
  95. package/dist/ui/atoms/FilterSelect/index.d.ts +1 -1
  96. package/dist/ui/atoms/FilterSelect/index.js +51 -51
  97. package/dist/ui/atoms/LoadingSpinner/LoadingSpinner.js +1 -1
  98. package/dist/ui/atoms/LoadingSpinner/index.d.ts +1 -1
  99. package/dist/ui/atoms/Pagination/Pagination.js +13 -13
  100. package/dist/ui/atoms/Pagination/index.js +13 -13
  101. package/dist/ui/atoms/SearchInput/SearchInput.js +8 -8
  102. package/dist/ui/atoms/SearchInput/index.js +8 -8
  103. package/dist/ui/avatar.d.ts +2 -2
  104. package/dist/ui/avatar.js +1 -1
  105. package/dist/ui/badge.d.ts +1 -1
  106. package/dist/ui/badge.js +3 -3
  107. package/dist/ui/breadcrumb.d.ts +1 -1
  108. package/dist/ui/breadcrumb.js +4 -4
  109. package/dist/ui/button.d.ts +1 -1
  110. package/dist/ui/button.js +5 -5
  111. package/dist/ui/calendar.js +21 -21
  112. package/dist/ui/card.d.ts +1 -1
  113. package/dist/ui/card.js +2 -2
  114. package/dist/ui/carousel.d.ts +2 -2
  115. package/dist/ui/carousel.js +6 -6
  116. package/dist/ui/checkbox.d.ts +1 -1
  117. package/dist/ui/checkbox.js +2 -2
  118. package/dist/ui/collapsible.d.ts +1 -1
  119. package/dist/ui/command.d.ts +2 -2
  120. package/dist/ui/command.js +14 -14
  121. package/dist/ui/confirm-dialog.js +9 -9
  122. package/dist/ui/context-menu.d.ts +2 -2
  123. package/dist/ui/context-menu.js +10 -10
  124. package/dist/ui/cta.js +5 -5
  125. package/dist/ui/data-table.d.ts +12 -0
  126. package/dist/ui/data-table.js +1000 -0
  127. package/dist/ui/data-table.parts.d.ts +14 -0
  128. package/dist/ui/data-table.parts.js +458 -0
  129. package/dist/ui/date-picker.js +26 -26
  130. package/dist/ui/date-range-picker.js +24 -24
  131. package/dist/ui/datetime-picker.js +29 -29
  132. package/dist/ui/dialog.d.ts +1 -1
  133. package/dist/ui/dialog.js +5 -5
  134. package/dist/ui/drawer.d.ts +1 -1
  135. package/dist/ui/drawer.js +5 -5
  136. package/dist/ui/dropdown-menu.d.ts +2 -2
  137. package/dist/ui/dropdown-menu.js +10 -10
  138. package/dist/ui/empty-state.d.ts +1 -1
  139. package/dist/ui/empty-state.js +5 -5
  140. package/dist/ui/empty.d.ts +2 -2
  141. package/dist/ui/empty.js +7 -7
  142. package/dist/ui/field.d.ts +2 -2
  143. package/dist/ui/field.js +12 -12
  144. package/dist/ui/form.d.ts +3 -3
  145. package/dist/ui/form.js +4 -4
  146. package/dist/ui/hover-card.d.ts +2 -2
  147. package/dist/ui/hover-card.js +2 -2
  148. package/dist/ui/input-group.d.ts +2 -2
  149. package/dist/ui/input-group.js +16 -16
  150. package/dist/ui/input-otp.d.ts +2 -2
  151. package/dist/ui/input-otp.js +4 -4
  152. package/dist/ui/input.js +1 -1
  153. package/dist/ui/label.d.ts +1 -1
  154. package/dist/ui/label.js +2 -2
  155. package/dist/ui/loading-button.js +8 -8
  156. package/dist/ui/map/index.d.ts +1 -1
  157. package/dist/ui/marketing/FeatureGrid.js +3 -3
  158. package/dist/ui/marketing/Hero.js +7 -7
  159. package/dist/ui/marketing/PricingTable.js +10 -10
  160. package/dist/ui/marketing/index.d.ts +1 -1
  161. package/dist/ui/menubar.d.ts +2 -2
  162. package/dist/ui/menubar.js +12 -12
  163. package/dist/ui/molecules/Autocomplete/index.js +26 -26
  164. package/dist/ui/molecules/SearchAndFilter/SearchAndFilter.js +62 -62
  165. package/dist/ui/molecules/SearchAndFilter/index.js +62 -62
  166. package/dist/ui/molecules/SkeletonList.js +1 -1
  167. package/dist/ui/nav-layout.d.ts +1 -1
  168. package/dist/ui/nav-layout.js +22 -22
  169. package/dist/ui/navigation-menu.d.ts +2 -2
  170. package/dist/ui/navigation-menu.js +7 -7
  171. package/dist/ui/organisms/ErrorBoundary/ErrorBoundary.js +11 -11
  172. package/dist/ui/organisms/ErrorBoundary/index.d.ts +1 -1
  173. package/dist/ui/organisms/ListPage/ListPage.js +84 -84
  174. package/dist/ui/organisms/ListPage/index.d.ts +1 -1
  175. package/dist/ui/organisms/ListPage/types.d.ts +1 -1
  176. package/dist/ui/page-header.d.ts +1 -1
  177. package/dist/ui/page-header.js +4 -4
  178. package/dist/ui/pagination.js +6 -6
  179. package/dist/ui/popover.d.ts +2 -2
  180. package/dist/ui/popover.js +2 -2
  181. package/dist/ui/progress.d.ts +1 -1
  182. package/dist/ui/progress.js +3 -3
  183. package/dist/ui/radio-group.d.ts +1 -1
  184. package/dist/ui/radio-group.js +3 -3
  185. package/dist/ui/resizable.d.ts +2 -2
  186. package/dist/ui/resizable.js +3 -3
  187. package/dist/ui/scroll-area.d.ts +1 -1
  188. package/dist/ui/scroll-area.js +4 -4
  189. package/dist/ui/section.d.ts +1 -1
  190. package/dist/ui/section.js +1 -1
  191. package/dist/ui/select.d.ts +1 -1
  192. package/dist/ui/select.js +6 -6
  193. package/dist/ui/separator.d.ts +1 -1
  194. package/dist/ui/separator.js +2 -2
  195. package/dist/ui/sheet.d.ts +2 -2
  196. package/dist/ui/sheet.js +5 -5
  197. package/dist/ui/sidebar.d.ts +1 -1
  198. package/dist/ui/sidebar.js +64 -64
  199. package/dist/ui/skeleton.js +1 -1
  200. package/dist/ui/slider.d.ts +1 -1
  201. package/dist/ui/slider.js +6 -6
  202. package/dist/ui/stack.d.ts +4 -4
  203. package/dist/ui/stack.js +1 -1
  204. package/dist/ui/stat-card-group.js +5 -5
  205. package/dist/ui/stepper.js +2 -2
  206. package/dist/ui/switch.d.ts +1 -1
  207. package/dist/ui/switch.js +3 -3
  208. package/dist/ui/table.d.ts +1 -1
  209. package/dist/ui/table.js +5 -5
  210. package/dist/ui/tabs.d.ts +2 -2
  211. package/dist/ui/tabs.js +3 -3
  212. package/dist/ui/text.js +2 -2
  213. package/dist/ui/textarea.js +1 -1
  214. package/dist/ui/time-picker.js +10 -10
  215. package/dist/ui/toast.d.ts +2 -2
  216. package/dist/ui/toast.js +5 -5
  217. package/dist/ui/toaster.js +5 -5
  218. package/dist/ui/toggle-group.d.ts +1 -1
  219. package/dist/ui/toggle-group.js +7 -7
  220. package/dist/ui/toggle.d.ts +1 -1
  221. package/dist/ui/toggle.js +5 -5
  222. package/dist/ui/tooltip.d.ts +2 -2
  223. package/dist/ui/tooltip.js +3 -3
  224. package/dist/ui/typography.js +14 -14
  225. package/dist/ui/use-toast.d.ts +1 -1
  226. package/dist/ui/usecases/UseCaseCard.js +8 -8
  227. package/dist/ui/usecases/UserStoryCard.js +3 -3
  228. package/dist/ui/visualization/Visualization.d.ts +9 -0
  229. package/dist/ui/visualization/Visualization.js +434 -0
  230. package/dist/ui/visualization/Visualization.support.d.ts +15 -0
  231. package/dist/ui/visualization/Visualization.support.js +123 -0
  232. package/dist/ui/visualization/index.d.ts +1 -0
  233. package/dist/ui/visualization/index.js +5 -0
  234. package/package.json +75 -12
@@ -7,23 +7,23 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
7
7
  });
8
8
 
9
9
  // ui/button.tsx
10
+ import { cn } from "@contractspec/lib.ui-kit-core/utils";
10
11
  import { Slot } from "@radix-ui/react-slot";
11
12
  import { cva } from "class-variance-authority";
12
- import { cn } from "@contractspec/lib.ui-kit-core/utils";
13
13
  import { jsxDEV } from "react/jsx-dev-runtime";
14
- var buttonVariants = cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-hidden focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", {
14
+ var buttonVariants = cva("inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-md font-medium text-sm outline-hidden transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0", {
15
15
  variants: {
16
16
  variant: {
17
17
  default: "bg-primary text-primary-foreground hover:bg-primary/90",
18
- destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
19
- outline: "border bg-background shadow-2xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
18
+ destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",
19
+ outline: "border bg-background shadow-2xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
20
20
  secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
21
21
  ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
22
22
  link: "text-primary underline-offset-4 hover:underline"
23
23
  },
24
24
  size: {
25
25
  default: "h-9 px-4 py-2 has-[>svg]:px-3",
26
- sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
26
+ sm: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",
27
27
  lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
28
28
  icon: "size-9"
29
29
  }
@@ -56,8 +56,8 @@ function Button({
56
56
  }, undefined, false, undefined, this);
57
57
  }
58
58
  // ui/stack.tsx
59
- import { cva as cva2 } from "class-variance-authority";
60
59
  import { cn as cn2 } from "@contractspec/lib.ui-kit-core/utils";
60
+ import { cva as cva2 } from "class-variance-authority";
61
61
  import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
62
62
  var vStackVariants = cva2("flex flex-col", {
63
63
  variants: {
@@ -233,11 +233,11 @@ function UseCaseCard({
233
233
  gap: "sm",
234
234
  children: [
235
235
  /* @__PURE__ */ jsxDEV3("div", {
236
- className: "text-lg font-semibold",
236
+ className: "font-semibold text-lg",
237
237
  children: title
238
238
  }, undefined, false, undefined, this),
239
239
  summary && /* @__PURE__ */ jsxDEV3("div", {
240
- className: "text-muted-foreground text-base",
240
+ className: "text-base text-muted-foreground",
241
241
  children: summary
242
242
  }, undefined, false, undefined, this),
243
243
  ctaHref && /* @__PURE__ */ jsxDEV3(HStack, {
@@ -7,8 +7,8 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
7
7
  });
8
8
 
9
9
  // ui/stack.tsx
10
- import { cva } from "class-variance-authority";
11
10
  import { cn } from "@contractspec/lib.ui-kit-core/utils";
11
+ import { cva } from "class-variance-authority";
12
12
  import { jsxDEV } from "react/jsx-dev-runtime";
13
13
  var vStackVariants = cva("flex flex-col", {
14
14
  variants: {
@@ -182,11 +182,11 @@ function UserStoryCard({
182
182
  gap: "sm",
183
183
  children: [
184
184
  /* @__PURE__ */ jsxDEV2("div", {
185
- className: "text-lg font-semibold",
185
+ className: "font-semibold text-lg",
186
186
  children: title
187
187
  }, undefined, false, undefined, this),
188
188
  body && /* @__PURE__ */ jsxDEV2("div", {
189
- className: "text-muted-foreground text-base",
189
+ className: "text-base text-muted-foreground",
190
190
  children: body
191
191
  }, undefined, false, undefined, this),
192
192
  outcome && /* @__PURE__ */ jsxDEV2("div", {
@@ -0,0 +1,439 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined")
5
+ return require.apply(this, arguments);
6
+ throw Error('Dynamic require of "' + x + '" is not supported');
7
+ });
8
+
9
+ // ui/map/MapBase.tsx
10
+ import * as React from "react";
11
+ import Map, {
12
+ NavigationControl,
13
+ ScaleControl
14
+ } from "react-map-gl/maplibre";
15
+ import { jsxDEV, Fragment } from "react/jsx-dev-runtime";
16
+ "use client";
17
+ var DEFAULT_STYLE = "https://basemaps.cartocdn.com/gl/positron-gl-style/style.json";
18
+ function MapBase(props) {
19
+ const {
20
+ initialViewState = { longitude: 2.3522, latitude: 48.8566, zoom: 5 },
21
+ styleUrl = DEFAULT_STYLE,
22
+ style,
23
+ showControls = true,
24
+ showCssLink = true,
25
+ onMapRef,
26
+ children
27
+ } = props;
28
+ const mapRef = React.useRef(null);
29
+ React.useEffect(() => {
30
+ onMapRef?.(mapRef.current);
31
+ }, [mapRef.current]);
32
+ return /* @__PURE__ */ jsxDEV("div", {
33
+ style: {
34
+ position: "relative",
35
+ width: "100%",
36
+ height: "100%",
37
+ ...style || {}
38
+ },
39
+ children: [
40
+ showCssLink && /* @__PURE__ */ jsxDEV("link", {
41
+ href: "https://unpkg.com/maplibre-gl@4.7.0/dist/maplibre-gl.css",
42
+ rel: "stylesheet"
43
+ }, undefined, false, undefined, this),
44
+ /* @__PURE__ */ jsxDEV(Map, {
45
+ ref: mapRef,
46
+ mapLib: import("maplibre-gl"),
47
+ initialViewState,
48
+ style: { width: "100%", height: "100%" },
49
+ mapStyle: styleUrl,
50
+ maplibreLogo: false,
51
+ children: [
52
+ showControls && /* @__PURE__ */ jsxDEV(Fragment, {
53
+ children: [
54
+ /* @__PURE__ */ jsxDEV(ScaleControl, {
55
+ position: "bottom-left"
56
+ }, undefined, false, undefined, this),
57
+ /* @__PURE__ */ jsxDEV(NavigationControl, {
58
+ position: "bottom-left"
59
+ }, undefined, false, undefined, this)
60
+ ]
61
+ }, undefined, true, undefined, this),
62
+ children
63
+ ]
64
+ }, undefined, true, undefined, this)
65
+ ]
66
+ }, undefined, true, undefined, this);
67
+ }
68
+
69
+ // ui/map/MapGeoJsonOverlay.tsx
70
+ import { Layer, Source } from "react-map-gl/maplibre";
71
+ import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
72
+ "use client";
73
+ function MapGeoJsonOverlay(props) {
74
+ const {
75
+ id = "geojson-overlay",
76
+ data,
77
+ fillColor = "#2563eb",
78
+ fillOpacity = 0.25,
79
+ lineColor = "#1e40af",
80
+ lineWidth = 1.5,
81
+ lineOpacity = 0.8
82
+ } = props;
83
+ const fillLayer = {
84
+ id: `${id}-fill`,
85
+ type: "fill",
86
+ paint: {
87
+ "fill-color": fillColor,
88
+ "fill-opacity": fillOpacity
89
+ }
90
+ };
91
+ const outlineLayer = {
92
+ id: `${id}-outline`,
93
+ type: "line",
94
+ paint: {
95
+ "line-color": lineColor,
96
+ "line-width": lineWidth,
97
+ "line-opacity": lineOpacity
98
+ }
99
+ };
100
+ return /* @__PURE__ */ jsxDEV2(Source, {
101
+ id,
102
+ type: "geojson",
103
+ data,
104
+ children: [
105
+ /* @__PURE__ */ jsxDEV2(Layer, {
106
+ ...fillLayer
107
+ }, undefined, false, undefined, this),
108
+ /* @__PURE__ */ jsxDEV2(Layer, {
109
+ ...outlineLayer
110
+ }, undefined, false, undefined, this)
111
+ ]
112
+ }, undefined, true, undefined, this);
113
+ }
114
+
115
+ // ui/map/MapMarkers.tsx
116
+ import { Marker } from "react-map-gl/maplibre";
117
+ import { jsxDEV as jsxDEV3, Fragment as Fragment2 } from "react/jsx-dev-runtime";
118
+ "use client";
119
+ function MapMarkers({ points }) {
120
+ return /* @__PURE__ */ jsxDEV3(Fragment2, {
121
+ children: points.map((p) => /* @__PURE__ */ jsxDEV3(Marker, {
122
+ longitude: p.lng,
123
+ latitude: p.lat,
124
+ anchor: "bottom",
125
+ children: /* @__PURE__ */ jsxDEV3("button", {
126
+ role: p.onClick ? "button" : undefined,
127
+ tabIndex: p.onClick ? 0 : -1,
128
+ "aria-label": p.ariaLabel || "marker",
129
+ onClick: p.onClick,
130
+ onKeyDown: (e) => {
131
+ if (e.key === "Enter" || e.key === " ") {
132
+ e.preventDefault();
133
+ p.onClick?.();
134
+ }
135
+ },
136
+ style: {
137
+ width: p.size ?? 14,
138
+ height: p.size ?? 14,
139
+ background: p.color ?? "#2563eb",
140
+ border: "2px solid white",
141
+ borderRadius: 9999,
142
+ boxShadow: "0 1px 3px rgba(0,0,0,0.35)",
143
+ cursor: p.onClick ? "pointer" : "default"
144
+ }
145
+ }, undefined, false, undefined, this)
146
+ }, p.id, false, undefined, this))
147
+ }, undefined, false, undefined, this);
148
+ }
149
+
150
+ // ui/visualization/Visualization.support.tsx
151
+ import {
152
+ formatVisualizationValue
153
+ } from "@contractspec/lib.presentation-runtime-core";
154
+ import { cn } from "@contractspec/lib.ui-kit-core/utils";
155
+ import * as echarts from "echarts/core";
156
+ import { jsxDEV as jsxDEV4 } from "react/jsx-dev-runtime";
157
+ "use client";
158
+ function MetricVisualization({
159
+ className,
160
+ model
161
+ }) {
162
+ return /* @__PURE__ */ jsxDEV4("div", {
163
+ className: cn("space-y-2", className),
164
+ children: [
165
+ /* @__PURE__ */ jsxDEV4("div", {
166
+ className: "text-muted-foreground text-sm",
167
+ children: model.metric?.label ?? model.title
168
+ }, undefined, false, undefined, this),
169
+ /* @__PURE__ */ jsxDEV4("div", {
170
+ className: "font-semibold text-3xl",
171
+ children: formatVisualizationValue(model.metric?.value, model.metric?.format)
172
+ }, undefined, false, undefined, this),
173
+ model.metric?.comparisonValue != null ? /* @__PURE__ */ jsxDEV4("div", {
174
+ className: "text-muted-foreground text-sm",
175
+ children: [
176
+ "Comparison:",
177
+ " ",
178
+ formatVisualizationValue(model.metric.comparisonValue, model.metric.format)
179
+ ]
180
+ }, undefined, true, undefined, this) : null,
181
+ /* @__PURE__ */ jsxDEV4(TableAlternative, {
182
+ model
183
+ }, undefined, false, undefined, this)
184
+ ]
185
+ }, undefined, true, undefined, this);
186
+ }
187
+ function TableAlternative({
188
+ model
189
+ }) {
190
+ if (!model.table.columns.length || !model.table.rows.length)
191
+ return null;
192
+ return /* @__PURE__ */ jsxDEV4("details", {
193
+ className: "rounded-md border p-3 text-sm",
194
+ children: [
195
+ /* @__PURE__ */ jsxDEV4("summary", {
196
+ className: "cursor-pointer font-medium",
197
+ children: "Data summary"
198
+ }, undefined, false, undefined, this),
199
+ /* @__PURE__ */ jsxDEV4("div", {
200
+ className: "mt-3 overflow-x-auto",
201
+ children: /* @__PURE__ */ jsxDEV4("table", {
202
+ className: "w-full text-left",
203
+ children: [
204
+ /* @__PURE__ */ jsxDEV4("thead", {
205
+ children: /* @__PURE__ */ jsxDEV4("tr", {
206
+ children: model.table.columns.map((column) => /* @__PURE__ */ jsxDEV4("th", {
207
+ className: "px-2 py-1 font-medium",
208
+ children: column.label
209
+ }, column.key, false, undefined, this))
210
+ }, undefined, false, undefined, this)
211
+ }, undefined, false, undefined, this),
212
+ /* @__PURE__ */ jsxDEV4("tbody", {
213
+ children: model.table.rows.slice(0, 8).map((row, index) => /* @__PURE__ */ jsxDEV4("tr", {
214
+ children: model.table.columns.map((column) => /* @__PURE__ */ jsxDEV4("td", {
215
+ className: "px-2 py-1",
216
+ children: String(row[column.key] ?? "—")
217
+ }, column.key, false, undefined, this))
218
+ }, `summary-row-${index}`, false, undefined, this))
219
+ }, undefined, false, undefined, this)
220
+ ]
221
+ }, undefined, true, undefined, this)
222
+ }, undefined, false, undefined, this)
223
+ ]
224
+ }, undefined, true, undefined, this);
225
+ }
226
+ function FallbackVisualization({
227
+ className,
228
+ model,
229
+ reason
230
+ }) {
231
+ return /* @__PURE__ */ jsxDEV4("div", {
232
+ className: cn("space-y-3", className),
233
+ children: [
234
+ /* @__PURE__ */ jsxDEV4("p", {
235
+ className: "text-muted-foreground text-sm",
236
+ children: reason
237
+ }, undefined, false, undefined, this),
238
+ /* @__PURE__ */ jsxDEV4(TableAlternative, {
239
+ model
240
+ }, undefined, false, undefined, this)
241
+ ]
242
+ }, undefined, true, undefined, this);
243
+ }
244
+ function shouldRenderEChart(model) {
245
+ if (model.kind === "metric")
246
+ return false;
247
+ if (model.kind === "geo" && model.geo?.mode === "slippy-map")
248
+ return false;
249
+ if (model.kind === "geo" && model.geo?.geoJson?.type === "url")
250
+ return false;
251
+ return true;
252
+ }
253
+ function registerGeoMap(model) {
254
+ if (model.kind !== "geo" || model.geo?.geoJson?.type !== "inline")
255
+ return;
256
+ registerInlineMap(model.geo.geoJson);
257
+ }
258
+ function registerInlineMap(geoJson) {
259
+ if (geoJson.type !== "inline")
260
+ return;
261
+ echarts.registerMap("contractspec-visualization-geo", geoJson.data);
262
+ }
263
+
264
+ // ui/visually-hidden.tsx
265
+ import { jsxDEV as jsxDEV5 } from "react/jsx-dev-runtime";
266
+ var srOnlyStyle = {
267
+ border: 0,
268
+ clip: "rect(0 0 0 0)",
269
+ height: "1px",
270
+ margin: "-1px",
271
+ overflow: "hidden",
272
+ padding: 0,
273
+ position: "absolute",
274
+ width: "1px",
275
+ whiteSpace: "nowrap"
276
+ };
277
+ function VisuallyHidden({
278
+ as = "span",
279
+ style,
280
+ children,
281
+ ref,
282
+ ...props
283
+ }) {
284
+ const Comp = as;
285
+ return /* @__PURE__ */ jsxDEV5(Comp, {
286
+ ref,
287
+ style: { ...srOnlyStyle, ...style },
288
+ ...props,
289
+ children
290
+ }, undefined, false, undefined, this);
291
+ }
292
+ // ui/visualization/Visualization.tsx
293
+ import {
294
+ buildVisualizationEChartsOption
295
+ } from "@contractspec/lib.presentation-runtime-core";
296
+ import { cn as cn2 } from "@contractspec/lib.ui-kit-core/utils";
297
+ import {
298
+ BarChart,
299
+ FunnelChart,
300
+ HeatmapChart,
301
+ LineChart,
302
+ MapChart,
303
+ PieChart,
304
+ ScatterChart
305
+ } from "echarts/charts";
306
+ import {
307
+ AriaComponent,
308
+ GeoComponent,
309
+ GridComponent,
310
+ LegendComponent,
311
+ TitleComponent,
312
+ TooltipComponent,
313
+ VisualMapComponent
314
+ } from "echarts/components";
315
+ import * as echarts2 from "echarts/core";
316
+ import { CanvasRenderer } from "echarts/renderers";
317
+ import * as React2 from "react";
318
+ import { jsxDEV as jsxDEV6 } from "react/jsx-dev-runtime";
319
+ "use client";
320
+ echarts2.use([
321
+ AriaComponent,
322
+ TitleComponent,
323
+ TooltipComponent,
324
+ GridComponent,
325
+ LegendComponent,
326
+ VisualMapComponent,
327
+ GeoComponent,
328
+ CanvasRenderer,
329
+ LineChart,
330
+ BarChart,
331
+ PieChart,
332
+ ScatterChart,
333
+ HeatmapChart,
334
+ FunnelChart,
335
+ MapChart
336
+ ]);
337
+ function Visualization({
338
+ model,
339
+ className,
340
+ height = 280,
341
+ onDataPointPress
342
+ }) {
343
+ const chartRef = React2.useRef(null);
344
+ const option = React2.useMemo(() => buildVisualizationEChartsOption(model), [model]);
345
+ React2.useEffect(() => {
346
+ if (!shouldRenderEChart(model) || !chartRef.current)
347
+ return;
348
+ registerGeoMap(model);
349
+ const chart = echarts2.init(chartRef.current, undefined, {
350
+ renderer: "canvas"
351
+ });
352
+ chart.setOption(option);
353
+ if (onDataPointPress) {
354
+ chart.on("click", onDataPointPress);
355
+ }
356
+ const observer = new ResizeObserver(() => chart.resize());
357
+ observer.observe(chartRef.current);
358
+ return () => {
359
+ observer.disconnect();
360
+ if (onDataPointPress) {
361
+ chart.off("click", onDataPointPress);
362
+ }
363
+ chart.dispose();
364
+ };
365
+ }, [model, onDataPointPress, option]);
366
+ if (model.kind === "metric") {
367
+ return /* @__PURE__ */ jsxDEV6(MetricVisualization, {
368
+ className,
369
+ model
370
+ }, undefined, false, undefined, this);
371
+ }
372
+ if (model.kind === "geo" && model.geo?.mode === "slippy-map") {
373
+ return /* @__PURE__ */ jsxDEV6(MapVisualization, {
374
+ className,
375
+ height,
376
+ model
377
+ }, undefined, false, undefined, this);
378
+ }
379
+ if (model.kind === "geo" && model.geo?.geoJson?.type === "url") {
380
+ return /* @__PURE__ */ jsxDEV6(FallbackVisualization, {
381
+ className,
382
+ model,
383
+ reason: "Geo URL sources currently fall back to the summary table."
384
+ }, undefined, false, undefined, this);
385
+ }
386
+ return /* @__PURE__ */ jsxDEV6("div", {
387
+ className: cn2("space-y-3", className),
388
+ children: [
389
+ /* @__PURE__ */ jsxDEV6(VisuallyHidden, {
390
+ children: model.summary
391
+ }, undefined, false, undefined, this),
392
+ /* @__PURE__ */ jsxDEV6("div", {
393
+ ref: chartRef,
394
+ "aria-label": model.summary,
395
+ className: "w-full rounded-md",
396
+ style: { height }
397
+ }, undefined, false, undefined, this),
398
+ /* @__PURE__ */ jsxDEV6(TableAlternative, {
399
+ model
400
+ }, undefined, false, undefined, this)
401
+ ]
402
+ }, undefined, true, undefined, this);
403
+ }
404
+ function MapVisualization({
405
+ className,
406
+ height,
407
+ model
408
+ }) {
409
+ const markers = model.series.flatMap((series) => series.points.filter((point) => point.latitude != null && point.longitude != null).map((point) => ({
410
+ id: point.id,
411
+ lat: point.latitude,
412
+ lng: point.longitude,
413
+ ariaLabel: point.name
414
+ })));
415
+ return /* @__PURE__ */ jsxDEV6("div", {
416
+ className: cn2("space-y-3", className),
417
+ children: [
418
+ /* @__PURE__ */ jsxDEV6("div", {
419
+ style: { height },
420
+ children: /* @__PURE__ */ jsxDEV6(MapBase, {
421
+ children: [
422
+ markers.length > 0 ? /* @__PURE__ */ jsxDEV6(MapMarkers, {
423
+ points: markers
424
+ }, undefined, false, undefined, this) : null,
425
+ model.geo?.geoJson?.type === "inline" ? /* @__PURE__ */ jsxDEV6(MapGeoJsonOverlay, {
426
+ data: model.geo.geoJson.data
427
+ }, undefined, false, undefined, this) : null
428
+ ]
429
+ }, undefined, true, undefined, this)
430
+ }, undefined, false, undefined, this),
431
+ /* @__PURE__ */ jsxDEV6(TableAlternative, {
432
+ model
433
+ }, undefined, false, undefined, this)
434
+ ]
435
+ }, undefined, true, undefined, this);
436
+ }
437
+ export {
438
+ Visualization
439
+ };
@@ -0,0 +1,128 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined")
5
+ return require.apply(this, arguments);
6
+ throw Error('Dynamic require of "' + x + '" is not supported');
7
+ });
8
+
9
+ // ui/visualization/Visualization.support.tsx
10
+ import {
11
+ formatVisualizationValue
12
+ } from "@contractspec/lib.presentation-runtime-core";
13
+ import { cn } from "@contractspec/lib.ui-kit-core/utils";
14
+ import * as echarts from "echarts/core";
15
+ import { jsxDEV } from "react/jsx-dev-runtime";
16
+ "use client";
17
+ function MetricVisualization({
18
+ className,
19
+ model
20
+ }) {
21
+ return /* @__PURE__ */ jsxDEV("div", {
22
+ className: cn("space-y-2", className),
23
+ children: [
24
+ /* @__PURE__ */ jsxDEV("div", {
25
+ className: "text-muted-foreground text-sm",
26
+ children: model.metric?.label ?? model.title
27
+ }, undefined, false, undefined, this),
28
+ /* @__PURE__ */ jsxDEV("div", {
29
+ className: "font-semibold text-3xl",
30
+ children: formatVisualizationValue(model.metric?.value, model.metric?.format)
31
+ }, undefined, false, undefined, this),
32
+ model.metric?.comparisonValue != null ? /* @__PURE__ */ jsxDEV("div", {
33
+ className: "text-muted-foreground text-sm",
34
+ children: [
35
+ "Comparison:",
36
+ " ",
37
+ formatVisualizationValue(model.metric.comparisonValue, model.metric.format)
38
+ ]
39
+ }, undefined, true, undefined, this) : null,
40
+ /* @__PURE__ */ jsxDEV(TableAlternative, {
41
+ model
42
+ }, undefined, false, undefined, this)
43
+ ]
44
+ }, undefined, true, undefined, this);
45
+ }
46
+ function TableAlternative({
47
+ model
48
+ }) {
49
+ if (!model.table.columns.length || !model.table.rows.length)
50
+ return null;
51
+ return /* @__PURE__ */ jsxDEV("details", {
52
+ className: "rounded-md border p-3 text-sm",
53
+ children: [
54
+ /* @__PURE__ */ jsxDEV("summary", {
55
+ className: "cursor-pointer font-medium",
56
+ children: "Data summary"
57
+ }, undefined, false, undefined, this),
58
+ /* @__PURE__ */ jsxDEV("div", {
59
+ className: "mt-3 overflow-x-auto",
60
+ children: /* @__PURE__ */ jsxDEV("table", {
61
+ className: "w-full text-left",
62
+ children: [
63
+ /* @__PURE__ */ jsxDEV("thead", {
64
+ children: /* @__PURE__ */ jsxDEV("tr", {
65
+ children: model.table.columns.map((column) => /* @__PURE__ */ jsxDEV("th", {
66
+ className: "px-2 py-1 font-medium",
67
+ children: column.label
68
+ }, column.key, false, undefined, this))
69
+ }, undefined, false, undefined, this)
70
+ }, undefined, false, undefined, this),
71
+ /* @__PURE__ */ jsxDEV("tbody", {
72
+ children: model.table.rows.slice(0, 8).map((row, index) => /* @__PURE__ */ jsxDEV("tr", {
73
+ children: model.table.columns.map((column) => /* @__PURE__ */ jsxDEV("td", {
74
+ className: "px-2 py-1",
75
+ children: String(row[column.key] ?? "—")
76
+ }, column.key, false, undefined, this))
77
+ }, `summary-row-${index}`, false, undefined, this))
78
+ }, undefined, false, undefined, this)
79
+ ]
80
+ }, undefined, true, undefined, this)
81
+ }, undefined, false, undefined, this)
82
+ ]
83
+ }, undefined, true, undefined, this);
84
+ }
85
+ function FallbackVisualization({
86
+ className,
87
+ model,
88
+ reason
89
+ }) {
90
+ return /* @__PURE__ */ jsxDEV("div", {
91
+ className: cn("space-y-3", className),
92
+ children: [
93
+ /* @__PURE__ */ jsxDEV("p", {
94
+ className: "text-muted-foreground text-sm",
95
+ children: reason
96
+ }, undefined, false, undefined, this),
97
+ /* @__PURE__ */ jsxDEV(TableAlternative, {
98
+ model
99
+ }, undefined, false, undefined, this)
100
+ ]
101
+ }, undefined, true, undefined, this);
102
+ }
103
+ function shouldRenderEChart(model) {
104
+ if (model.kind === "metric")
105
+ return false;
106
+ if (model.kind === "geo" && model.geo?.mode === "slippy-map")
107
+ return false;
108
+ if (model.kind === "geo" && model.geo?.geoJson?.type === "url")
109
+ return false;
110
+ return true;
111
+ }
112
+ function registerGeoMap(model) {
113
+ if (model.kind !== "geo" || model.geo?.geoJson?.type !== "inline")
114
+ return;
115
+ registerInlineMap(model.geo.geoJson);
116
+ }
117
+ function registerInlineMap(geoJson) {
118
+ if (geoJson.type !== "inline")
119
+ return;
120
+ echarts.registerMap("contractspec-visualization-geo", geoJson.data);
121
+ }
122
+ export {
123
+ shouldRenderEChart,
124
+ registerGeoMap,
125
+ TableAlternative,
126
+ MetricVisualization,
127
+ FallbackVisualization
128
+ };
@@ -0,0 +1,10 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined")
5
+ return require.apply(this, arguments);
6
+ throw Error('Dynamic require of "' + x + '" is not supported');
7
+ });
8
+ export {
9
+ Visualization
10
+ };
@@ -1,7 +1,7 @@
1
- import * as React from 'react';
2
1
  import * as AccordionPrimitive from '@radix-ui/react-accordion';
2
+ import * as React from 'react';
3
3
  declare function Accordion({ ...props }: React.ComponentProps<typeof AccordionPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
4
4
  declare function AccordionItem({ className, ...props }: React.ComponentProps<typeof AccordionPrimitive.Item>): import("react/jsx-runtime").JSX.Element;
5
5
  declare function AccordionTrigger({ className, children, ...props }: React.ComponentProps<typeof AccordionPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
6
6
  declare function AccordionContent({ className, children, ...props }: React.ComponentProps<typeof AccordionPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
7
- export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
7
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger };