@regardio/react 0.4.7 → 0.5.1

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 (202) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +5 -5
  3. package/dist/{components/background-slideshow.js → background-slideshow/index.js} +2 -11
  4. package/dist/{components/blurry-gradient.js → blurry-gradient/index.js} +15 -9
  5. package/dist/{components/carousel.d.ts → carousel/index.d.ts} +17 -9
  6. package/dist/{components/carousel.js → carousel/index.js} +34 -30
  7. package/dist/{components/countdown.js → countdown/index.js} +2 -11
  8. package/dist/{components/generic-error.js → generic-error/index.js} +1 -1
  9. package/dist/grid/index.d.ts +1196 -0
  10. package/dist/grid/index.js +239 -0
  11. package/dist/heading/index.d.ts +24 -0
  12. package/dist/{components/heading.js → heading/index.js} +15 -34
  13. package/dist/highlight/index.d.ts +13 -0
  14. package/dist/{components/highlight.js → highlight/index.js} +9 -17
  15. package/dist/hooks/{use-current-route-data.js → use-current-route-data/index.js} +1 -1
  16. package/dist/hooks/{use-focus-search.js → use-focus-search/index.js} +1 -1
  17. package/dist/hooks/{use-matches-data.js → use-matches-data/index.js} +1 -1
  18. package/dist/hooks/{use-media-query.js → use-media-query/index.js} +1 -1
  19. package/dist/hooks/{use-mobile.js → use-mobile/index.js} +1 -1
  20. package/dist/hooks/use-nonce/index.d.ts +6 -0
  21. package/dist/hooks/use-nonce/index.js +8 -0
  22. package/dist/hooks/{use-orientation.d.ts → use-orientation/index.d.ts} +1 -1
  23. package/dist/hooks/{use-orientation.js → use-orientation/index.js} +1 -1
  24. package/dist/hooks/{use-user.js → use-user/index.js} +1 -1
  25. package/dist/{components/icon-button.js → icon-button/index.js} +1 -1
  26. package/dist/{components/if.js → if/index.js} +1 -1
  27. package/dist/{components/iframe.js → iframe/index.js} +2 -11
  28. package/dist/{components/link.d.ts → link/index.d.ts} +19 -13
  29. package/dist/{components/link.js → link/index.js} +31 -36
  30. package/dist/list/index.d.ts +69 -0
  31. package/dist/list/index.js +65 -0
  32. package/dist/{components/markdown-container.js → markdown-container/index.js} +3 -67
  33. package/dist/{components/password-input.js → password-input/index.js} +2 -11
  34. package/dist/{components/picture.js → picture/index.js} +2 -11
  35. package/dist/{components/protected-email.d.ts → protected-email/index.d.ts} +1 -1
  36. package/dist/{components/protected-email.js → protected-email/index.js} +1 -1
  37. package/dist/text/index.d.ts +20 -0
  38. package/dist/text/index.js +38 -0
  39. package/dist/utils/author/index.d.ts +3 -0
  40. package/dist/utils/author/index.js +33 -0
  41. package/dist/utils/text/index.d.ts +15 -0
  42. package/dist/utils/text/index.js +73 -0
  43. package/package.json +92 -121
  44. package/src/{stories/BackgroundSlideshow.stories.tsx → background-slideshow/background-slideshow.stories.tsx} +1 -1
  45. package/src/{components → background-slideshow}/background-slideshow.tsx +3 -1
  46. package/src/background-slideshow/index.ts +2 -0
  47. package/src/{stories/BlurryGradient.stories.tsx → blurry-gradient/blurry-gradient.stories.tsx} +1 -1
  48. package/src/{components → blurry-gradient}/blurry-gradient.tsx +14 -8
  49. package/src/blurry-gradient/index.ts +2 -0
  50. package/src/carousel/carousel-content.tsx +16 -0
  51. package/src/carousel/carousel-item.tsx +23 -0
  52. package/src/carousel/carousel-next.tsx +22 -0
  53. package/src/carousel/carousel-previous.tsx +22 -0
  54. package/src/{components/carousel.tsx → carousel/carousel-root.tsx} +8 -78
  55. package/src/carousel/carousel.stories.tsx +89 -0
  56. package/src/carousel/index.parts.ts +5 -0
  57. package/src/carousel/index.ts +4 -0
  58. package/src/{stories/Countdown.stories.tsx → countdown/countdown.stories.tsx} +1 -1
  59. package/src/{components → countdown}/countdown.tsx +3 -7
  60. package/src/countdown/index.ts +1 -0
  61. package/src/{stories/GenericError.stories.tsx → generic-error/generic-error.stories.tsx} +1 -1
  62. package/src/{components → generic-error}/generic-error.tsx +2 -0
  63. package/src/generic-error/index.ts +2 -0
  64. package/src/grid/grid-item.tsx +188 -0
  65. package/src/grid/grid-root.tsx +72 -0
  66. package/src/grid/grid.stories.tsx +236 -0
  67. package/src/grid/index.parts.ts +2 -0
  68. package/src/grid/index.ts +5 -0
  69. package/src/{stories/Heading.stories.tsx → heading/heading.stories.tsx} +1 -1
  70. package/src/{components → heading}/heading.tsx +17 -25
  71. package/src/heading/index.ts +2 -0
  72. package/src/{stories/Highlight.stories.tsx → highlight/highlight.stories.tsx} +1 -1
  73. package/src/{components → highlight}/highlight.tsx +13 -9
  74. package/src/highlight/index.ts +2 -0
  75. package/src/hooks/use-current-route-data/index.ts +1 -0
  76. package/src/hooks/use-focus-search/index.ts +1 -0
  77. package/src/hooks/use-matches-data/index.ts +1 -0
  78. package/src/hooks/use-media-query/index.ts +1 -0
  79. package/src/hooks/use-mobile/index.ts +1 -0
  80. package/src/hooks/use-nonce/index.ts +1 -0
  81. package/src/hooks/use-orientation/index.ts +1 -0
  82. package/src/hooks/use-user/index.ts +2 -0
  83. package/src/{stories/IconButton.stories.tsx → icon-button/icon-button.stories.tsx} +1 -1
  84. package/src/icon-button/index.ts +2 -0
  85. package/src/{stories/If.stories.tsx → if/if.stories.tsx} +1 -1
  86. package/src/if/index.ts +1 -0
  87. package/src/{stories/Iframe.stories.tsx → iframe/iframe.stories.tsx} +1 -1
  88. package/src/{components → iframe}/iframe.tsx +1 -1
  89. package/src/iframe/index.ts +2 -0
  90. package/src/link/index.ts +2 -0
  91. package/src/{stories/Link.stories.tsx → link/link.stories.tsx} +1 -1
  92. package/src/{components → link}/link.tsx +39 -28
  93. package/src/list/index.parts.ts +2 -0
  94. package/src/list/index.ts +4 -0
  95. package/src/list/list-item.tsx +63 -0
  96. package/src/list/list-root-context.ts +21 -0
  97. package/src/list/list-root.tsx +81 -0
  98. package/src/list/list.css +32 -0
  99. package/src/list/list.stories.tsx +119 -0
  100. package/src/list/list.test.tsx +168 -0
  101. package/src/markdown-container/index.ts +2 -0
  102. package/src/{stories/MarkdownContainer.stories.tsx → markdown-container/markdown-container.stories.tsx} +1 -1
  103. package/src/{components → markdown-container}/markdown-container.tsx +3 -1
  104. package/src/password-input/index.ts +2 -0
  105. package/src/{stories/PasswordInput.stories.tsx → password-input/password-input.stories.tsx} +1 -1
  106. package/src/{components → password-input}/password-input.tsx +4 -4
  107. package/src/picture/index.ts +2 -0
  108. package/src/{stories/Picture.stories.tsx → picture/picture.stories.tsx} +1 -1
  109. package/src/{components → picture}/picture.tsx +2 -4
  110. package/src/protected-email/index.ts +2 -0
  111. package/src/{stories/ProtectedEmail.stories.tsx → protected-email/protected-email.stories.tsx} +1 -1
  112. package/src/{components → protected-email}/protected-email.tsx +3 -1
  113. package/src/tailwind.css +10 -0
  114. package/src/text/index.ts +2 -0
  115. package/src/{stories/Text.stories.tsx → text/text.stories.tsx} +1 -1
  116. package/src/text/text.tsx +46 -0
  117. package/src/utils/author/author.tsx +36 -0
  118. package/src/utils/author/index.ts +1 -0
  119. package/src/utils/text/index.ts +1 -0
  120. package/src/utils/text/text.tsx +103 -0
  121. package/dist/components/box.d.ts +0 -20
  122. package/dist/components/box.js +0 -50
  123. package/dist/components/definition-list.d.ts +0 -43
  124. package/dist/components/definition-list.js +0 -89
  125. package/dist/components/heading.d.ts +0 -27
  126. package/dist/components/highlight.d.ts +0 -19
  127. package/dist/components/item.d.ts +0 -70
  128. package/dist/components/item.js +0 -512
  129. package/dist/components/leaflet-map.d.ts +0 -34
  130. package/dist/components/leaflet-map.js +0 -201
  131. package/dist/components/list-item.d.ts +0 -19
  132. package/dist/components/list-item.js +0 -37
  133. package/dist/components/maptiler-map.d.ts +0 -27
  134. package/dist/components/maptiler-map.js +0 -129
  135. package/dist/components/text.d.ts +0 -20
  136. package/dist/components/text.js +0 -45
  137. package/dist/components/unordered-list.d.ts +0 -19
  138. package/dist/components/unordered-list.js +0 -39
  139. package/dist/hooks/use-nonce.d.ts +0 -12
  140. package/dist/hooks/use-nonce.js +0 -13
  141. package/dist/utils/author.d.ts +0 -9
  142. package/dist/utils/author.js +0 -55
  143. package/dist/utils/cn.d.ts +0 -9
  144. package/dist/utils/cn.js +0 -14
  145. package/dist/utils/is-route-active.d.ts +0 -19
  146. package/dist/utils/is-route-active.js +0 -56
  147. package/dist/utils/text.d.ts +0 -24
  148. package/dist/utils/text.js +0 -127
  149. package/src/components/box.tsx +0 -45
  150. package/src/components/definition-list.tsx +0 -90
  151. package/src/components/item.tsx +0 -340
  152. package/src/components/leaflet-map.tsx +0 -294
  153. package/src/components/link.test.tsx +0 -387
  154. package/src/components/list-item.tsx +0 -30
  155. package/src/components/maptiler-map.tsx +0 -181
  156. package/src/components/text.tsx +0 -38
  157. package/src/components/unordered-list.tsx +0 -32
  158. package/src/hooks/use-nonce.test.ts +0 -35
  159. package/src/stories/Box.stories.tsx +0 -83
  160. package/src/stories/Carousel.stories.tsx +0 -95
  161. package/src/stories/DefinitionList.stories.tsx +0 -51
  162. package/src/stories/Item.stories.tsx +0 -79
  163. package/src/stories/ListItem.stories.tsx +0 -38
  164. package/src/stories/UnorderedList.stories.tsx +0 -73
  165. package/src/styles/tailwind.css +0 -7
  166. package/src/test-setup.ts +0 -1
  167. package/src/utils/author.test.ts +0 -54
  168. package/src/utils/author.tsx +0 -73
  169. package/src/utils/cn.test.ts +0 -48
  170. package/src/utils/cn.ts +0 -14
  171. package/src/utils/is-route-active.test.ts +0 -80
  172. package/src/utils/is-route-active.ts +0 -100
  173. package/src/utils/text.test.ts +0 -152
  174. package/src/utils/text.tsx +0 -209
  175. package/src/vite-env.d.ts +0 -1
  176. /package/dist/{components/background-slideshow.d.ts → background-slideshow/index.d.ts} +0 -0
  177. /package/dist/{components/blurry-gradient.d.ts → blurry-gradient/index.d.ts} +0 -0
  178. /package/dist/{components/countdown.d.ts → countdown/index.d.ts} +0 -0
  179. /package/dist/{components/generic-error.d.ts → generic-error/index.d.ts} +0 -0
  180. /package/dist/hooks/{use-current-route-data.d.ts → use-current-route-data/index.d.ts} +0 -0
  181. /package/dist/hooks/{use-focus-search.d.ts → use-focus-search/index.d.ts} +0 -0
  182. /package/dist/hooks/{use-matches-data.d.ts → use-matches-data/index.d.ts} +0 -0
  183. /package/dist/hooks/{use-media-query.d.ts → use-media-query/index.d.ts} +0 -0
  184. /package/dist/hooks/{use-mobile.d.ts → use-mobile/index.d.ts} +0 -0
  185. /package/dist/hooks/{use-user.d.ts → use-user/index.d.ts} +0 -0
  186. /package/dist/{components/icon-button.d.ts → icon-button/index.d.ts} +0 -0
  187. /package/dist/{components/if.d.ts → if/index.d.ts} +0 -0
  188. /package/dist/{components/iframe.d.ts → iframe/index.d.ts} +0 -0
  189. /package/dist/{components/markdown-container.d.ts → markdown-container/index.d.ts} +0 -0
  190. /package/dist/{components/password-input.d.ts → password-input/index.d.ts} +0 -0
  191. /package/dist/{components/picture.d.ts → picture/index.d.ts} +0 -0
  192. /package/src/hooks/{use-current-route-data.ts → use-current-route-data/use-current-route-data.ts} +0 -0
  193. /package/src/hooks/{use-focus-search.ts → use-focus-search/use-focus-search.ts} +0 -0
  194. /package/src/hooks/{use-matches-data.ts → use-matches-data/use-matches-data.ts} +0 -0
  195. /package/src/hooks/{use-media-query.ts → use-media-query/use-media-query.ts} +0 -0
  196. /package/src/hooks/{use-mobile.ts → use-mobile/use-mobile.ts} +0 -0
  197. /package/src/hooks/{use-nonce.ts → use-nonce/use-nonce.ts} +0 -0
  198. /package/src/hooks/{use-orientation.ts → use-orientation/use-orientation.ts} +0 -0
  199. /package/src/hooks/{use-user.tsx → use-user/use-user.tsx} +0 -0
  200. /package/src/{components → icon-button}/icon-button.tsx +0 -0
  201. /package/src/{components → if}/if.tsx +0 -0
  202. /package/src/{styles/storybook.css → storybook.css} +0 -0
@@ -1,34 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
-
3
- interface MapMarker {
4
- lat: number;
5
- lng: number;
6
- id: string;
7
- content?: string;
8
- htmlContent?: string;
9
- imageUrl?: string;
10
- imageAlt?: string;
11
- offset?: {
12
- x: number;
13
- y: number;
14
- };
15
- }
16
- interface LeafletMapProps {
17
- markers: MapMarker[];
18
- mapUrl: string;
19
- center?: {
20
- lat: number;
21
- lng: number;
22
- };
23
- zoom?: number;
24
- icon?: {
25
- iconUrl: string;
26
- iconSize: [number, number];
27
- iconAnchor: [number, number];
28
- };
29
- attribution?: string;
30
- showPopupsOnHover?: boolean;
31
- }
32
- declare const LeafletMap: ({ markers, mapUrl, center, zoom, icon, attribution, showPopupsOnHover, }: LeafletMapProps) => react_jsx_runtime.JSX.Element;
33
-
34
- export { LeafletMap, LeafletMap as default };
@@ -1,201 +0,0 @@
1
- import 'leaflet/dist/leaflet.css';
2
- import L from 'leaflet';
3
- import { useRef, useEffect } from 'react';
4
- import { jsx } from 'react/jsx-runtime';
5
-
6
- // src/components/leaflet-map.tsx
7
- var LeafletMap = ({
8
- markers,
9
- mapUrl,
10
- center,
11
- zoom = 12,
12
- icon = {
13
- iconAnchor: [12, 41],
14
- iconSize: [25, 41],
15
- iconUrl: "/marker-icon-2x.png"
16
- },
17
- attribution = "",
18
- showPopupsOnHover = false
19
- }) => {
20
- const mapContainerRef = useRef(null);
21
- const mapRef = useRef(null);
22
- const markersRef = useRef([]);
23
- useEffect(() => {
24
- if (!mapContainerRef.current || typeof window === "undefined") return;
25
- let calculatedCenter;
26
- if (center) {
27
- calculatedCenter = [center.lat, center.lng];
28
- } else if (markers.length > 0) {
29
- const firstMarker = markers[0];
30
- if (firstMarker) {
31
- calculatedCenter = [firstMarker.lat, firstMarker.lng];
32
- } else {
33
- calculatedCenter = [52.520008, 13.404954];
34
- }
35
- } else {
36
- calculatedCenter = [52.520008, 13.404954];
37
- }
38
- if (mapRef.current) {
39
- try {
40
- markersRef.current.forEach((marker) => {
41
- try {
42
- mapRef.current?.removeLayer(marker);
43
- } catch (_error) {
44
- }
45
- });
46
- mapRef.current.remove();
47
- } catch (_error) {
48
- }
49
- }
50
- const container = mapContainerRef.current;
51
- if (container) {
52
- container.innerHTML = "";
53
- const leafletContainer = container;
54
- if (leafletContainer._leaflet_id) {
55
- delete leafletContainer._leaflet_id;
56
- }
57
- container.setAttribute("data-map-initialized", "false");
58
- }
59
- const map = new L.Map(mapContainerRef.current, {
60
- center: calculatedCenter,
61
- scrollWheelZoom: false,
62
- tapTolerance: 100,
63
- zoom
64
- });
65
- new L.TileLayer(mapUrl, {
66
- attribution
67
- }).addTo(map);
68
- const customIcon = new L.Icon({
69
- iconAnchor: icon.iconAnchor,
70
- iconSize: icon.iconSize,
71
- iconUrl: icon.iconUrl
72
- });
73
- const newMarkers = [];
74
- markers.forEach((marker) => {
75
- const markerLatLng = [marker.lat, marker.lng];
76
- const leafletMarker = new L.Marker(markerLatLng, {
77
- icon: customIcon
78
- }).addTo(map);
79
- const offset = marker.offset || { x: 0, y: 0 };
80
- let popupContent = "";
81
- if (marker.htmlContent) {
82
- popupContent = marker.htmlContent;
83
- } else if (marker.content) {
84
- popupContent = marker.content;
85
- }
86
- if (marker.imageUrl) {
87
- const imageHtml = `<img src="${marker.imageUrl}" alt="${marker.imageAlt || ""}" style="max-width: 100%; height: auto; display: block; margin-bottom: 8px;" />`;
88
- popupContent = imageHtml + popupContent;
89
- }
90
- if (popupContent) {
91
- const popup = new L.Popup({
92
- className: "custom-map-popup",
93
- closeButton: false,
94
- offset: [offset.x, offset.y]
95
- }).setContent(popupContent);
96
- leafletMarker.bindPopup(popup);
97
- if (showPopupsOnHover) {
98
- leafletMarker.on("mouseover", () => {
99
- leafletMarker.openPopup();
100
- });
101
- leafletMarker.on("mouseout", () => {
102
- leafletMarker.closePopup();
103
- });
104
- }
105
- }
106
- newMarkers.push(leafletMarker);
107
- });
108
- markersRef.current = newMarkers;
109
- if (markers.length > 0) {
110
- const bounds = new L.LatLngBounds(markers.map((m) => new L.LatLng(m.lat, m.lng)));
111
- map.fitBounds(bounds, { padding: [20, 20] });
112
- }
113
- mapRef.current = map;
114
- return () => {
115
- if (mapRef.current) {
116
- try {
117
- markersRef.current.forEach((marker) => {
118
- try {
119
- mapRef.current?.removeLayer(marker);
120
- } catch (_error) {
121
- }
122
- });
123
- mapRef.current.remove();
124
- mapRef.current = null;
125
- if (mapContainerRef.current) {
126
- mapContainerRef.current.innerHTML = "";
127
- mapContainerRef.current.removeAttribute("data-map-initialized");
128
- }
129
- } catch (_error) {
130
- }
131
- }
132
- markersRef.current = [];
133
- };
134
- }, [markers, mapUrl, zoom, icon, attribution, center, showPopupsOnHover]);
135
- useEffect(() => {
136
- const map = mapRef.current;
137
- if (!map || typeof window === "undefined") return;
138
- markersRef.current.forEach((marker) => {
139
- try {
140
- map.removeLayer(marker);
141
- } catch (_error) {
142
- }
143
- });
144
- markersRef.current = [];
145
- const customIcon = new L.Icon({
146
- iconAnchor: icon.iconAnchor,
147
- iconSize: icon.iconSize,
148
- iconUrl: icon.iconUrl
149
- });
150
- const newMarkers = [];
151
- markers.forEach((marker) => {
152
- const markerLatLng = [marker.lat, marker.lng];
153
- const leafletMarker = new L.Marker(markerLatLng, {
154
- icon: customIcon
155
- }).addTo(map);
156
- const offset = marker.offset || { x: 0, y: 0 };
157
- let popupContent = "";
158
- if (marker.htmlContent) {
159
- popupContent = marker.htmlContent;
160
- } else if (marker.content) {
161
- popupContent = marker.content;
162
- }
163
- if (marker.imageUrl) {
164
- const imageHtml = `<img src="${marker.imageUrl}" alt="${marker.imageAlt || ""}" style="max-width: 100%; height: auto; display: block; margin-bottom: 8px;" />`;
165
- popupContent = imageHtml + popupContent;
166
- }
167
- if (popupContent) {
168
- const popup = new L.Popup({
169
- className: "custom-map-popup",
170
- closeButton: false,
171
- offset: [offset.x, offset.y]
172
- }).setContent(popupContent);
173
- leafletMarker.bindPopup(popup);
174
- if (showPopupsOnHover) {
175
- leafletMarker.on("mouseover", () => {
176
- leafletMarker.openPopup();
177
- });
178
- leafletMarker.on("mouseout", () => {
179
- leafletMarker.closePopup();
180
- });
181
- }
182
- }
183
- newMarkers.push(leafletMarker);
184
- });
185
- markersRef.current = newMarkers;
186
- if (markers.length > 0) {
187
- const bounds = new L.LatLngBounds(markers.map((m) => new L.LatLng(m.lat, m.lng)));
188
- map.fitBounds(bounds, { padding: [20, 20] });
189
- }
190
- }, [markers, icon, showPopupsOnHover]);
191
- return /* @__PURE__ */ jsx(
192
- "div",
193
- {
194
- className: "h-full w-full",
195
- ref: mapContainerRef
196
- }
197
- );
198
- };
199
- var leaflet_map_default = LeafletMap;
200
-
201
- export { LeafletMap, leaflet_map_default as default };
@@ -1,19 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import * as cva from 'cva';
3
- import { VariantProps } from 'cva';
4
- import { ComponentProps } from 'react';
5
-
6
- declare const li: (props?: ({
7
- variant?: "primary" | undefined;
8
- } & ({
9
- class?: cva.ClassValue;
10
- className?: never;
11
- } | {
12
- class?: never;
13
- className?: cva.ClassValue;
14
- })) | undefined) => string;
15
- interface ListItemProps extends ComponentProps<'li'>, VariantProps<typeof li> {
16
- }
17
- declare const ListItem: (props: ListItemProps) => react_jsx_runtime.JSX.Element;
18
-
19
- export { ListItem, type ListItemProps };
@@ -1,37 +0,0 @@
1
- import { defineConfig } from 'cva';
2
- import { twMerge } from 'fluid-tailwindcss/tailwind-merge';
3
- import { jsx } from 'react/jsx-runtime';
4
-
5
- // src/utils/cn.ts
6
- var { cva, compose } = defineConfig({
7
- hooks: {
8
- onComplete: (className) => {
9
- return twMerge(className);
10
- }
11
- }
12
- });
13
- var li = cva({
14
- defaultVariants: {
15
- variant: "primary"
16
- },
17
- variants: {
18
- variant: {
19
- primary: []
20
- }
21
- }
22
- });
23
- var ListItem = (props) => {
24
- const { children, className, variant } = props;
25
- return /* @__PURE__ */ jsx(
26
- "li",
27
- {
28
- className: li({
29
- className,
30
- variant
31
- }),
32
- children
33
- }
34
- );
35
- };
36
-
37
- export { ListItem };
@@ -1,27 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
-
3
- interface MapTilerMarker {
4
- lat: number;
5
- lng: number;
6
- id: string;
7
- content?: string;
8
- htmlContent?: string;
9
- offset?: {
10
- x: number;
11
- y: number;
12
- };
13
- }
14
- interface MapTilerMapProps {
15
- markers: MapTilerMarker[];
16
- center?: {
17
- lat: number;
18
- lng: number;
19
- };
20
- zoom?: number;
21
- mapStyle?: string;
22
- apiKey: string;
23
- showPopupsImmediately?: boolean;
24
- }
25
- declare const MapTilerMap: ({ markers, center, zoom, mapStyle, apiKey, showPopupsImmediately, }: MapTilerMapProps) => react_jsx_runtime.JSX.Element;
26
-
27
- export { MapTilerMap };
@@ -1,129 +0,0 @@
1
- import { config, Map, Marker, Popup } from '@maptiler/sdk';
2
- import { useRef, useEffect } from 'react';
3
- import '@maptiler/sdk/dist/maptiler-sdk.css';
4
- import { jsx } from 'react/jsx-runtime';
5
-
6
- // src/components/maptiler-map.tsx
7
- var MapTilerMap = ({
8
- markers,
9
- center,
10
- zoom = 12,
11
- mapStyle = "streets",
12
- apiKey,
13
- showPopupsImmediately = false
14
- }) => {
15
- const mapContainerRef = useRef(null);
16
- const mapRef = useRef(null);
17
- const markersRef = useRef([]);
18
- useEffect(() => {
19
- if (!mapContainerRef.current || typeof window === "undefined") return;
20
- config.apiKey = apiKey;
21
- let calculatedCenter;
22
- if (center) {
23
- calculatedCenter = [center.lng, center.lat];
24
- } else if (markers.length > 0) {
25
- const firstMarker = markers[0];
26
- if (firstMarker) {
27
- calculatedCenter = [firstMarker.lng, firstMarker.lat];
28
- } else {
29
- calculatedCenter = [13.404954, 52.520008];
30
- }
31
- } else {
32
- calculatedCenter = [13.404954, 52.520008];
33
- }
34
- const map = new Map({
35
- center: calculatedCenter,
36
- container: mapContainerRef.current,
37
- style: `https://api.maptiler.com/maps/${mapStyle}/style.json?key=${apiKey}`,
38
- zoom
39
- });
40
- map.on("styleimagemissing", (e) => {
41
- const id = e.id;
42
- console.warn(`Missing sprite image: ${id}`);
43
- });
44
- mapRef.current = map;
45
- const newMarkers = [];
46
- markers.forEach((marker) => {
47
- const markerInstance = new Marker().setLngLat([marker.lng, marker.lat]).addTo(map);
48
- let popupContent = "";
49
- if (marker.htmlContent) {
50
- popupContent = marker.htmlContent;
51
- } else if (marker.content) {
52
- popupContent = marker.content;
53
- }
54
- if (popupContent) {
55
- const popup = new Popup({
56
- closeButton: false,
57
- offset: marker.offset ? [marker.offset.x, marker.offset.y] : [0, 0]
58
- }).setHTML(popupContent);
59
- markerInstance.setPopup(popup);
60
- if (showPopupsImmediately) {
61
- markerInstance.togglePopup();
62
- }
63
- }
64
- newMarkers.push(markerInstance);
65
- });
66
- markersRef.current = newMarkers;
67
- return () => {
68
- if (mapRef.current) {
69
- mapRef.current.remove();
70
- mapRef.current = null;
71
- }
72
- markersRef.current = [];
73
- };
74
- }, [markers, apiKey, mapStyle, zoom, center, showPopupsImmediately]);
75
- useEffect(() => {
76
- const map = mapRef.current;
77
- if (!map) return;
78
- markersRef.current.forEach((marker) => {
79
- marker.remove();
80
- });
81
- markersRef.current = [];
82
- const newMarkers = [];
83
- markers.forEach((marker) => {
84
- const markerInstance = new Marker().setLngLat([marker.lng, marker.lat]).addTo(map);
85
- let popupContent = "";
86
- if (marker.htmlContent) {
87
- popupContent = marker.htmlContent;
88
- } else if (marker.content) {
89
- popupContent = marker.content;
90
- }
91
- if (popupContent) {
92
- const popup = new Popup({
93
- closeButton: false,
94
- offset: marker.offset ? [marker.offset.x, marker.offset.y] : [0, 0]
95
- }).setHTML(popupContent);
96
- markerInstance.setPopup(popup);
97
- if (showPopupsImmediately) {
98
- markerInstance.togglePopup();
99
- }
100
- }
101
- newMarkers.push(markerInstance);
102
- });
103
- markersRef.current = newMarkers;
104
- if (markers.length > 1) {
105
- const lngs = markers.map((m) => m.lng);
106
- const lats = markers.map((m) => m.lat);
107
- const minLng = Math.min(...lngs);
108
- const maxLng = Math.max(...lngs);
109
- const minLat = Math.min(...lats);
110
- const maxLat = Math.max(...lats);
111
- map.fitBounds(
112
- [
113
- [minLng, minLat],
114
- [maxLng, maxLat]
115
- ],
116
- { padding: 20 }
117
- );
118
- }
119
- }, [markers, showPopupsImmediately]);
120
- return /* @__PURE__ */ jsx(
121
- "div",
122
- {
123
- className: "h-full w-full",
124
- ref: mapContainerRef
125
- }
126
- );
127
- };
128
-
129
- export { MapTilerMap };
@@ -1,20 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import * as cva from 'cva';
3
- import { VariantProps } from 'cva';
4
- import { ComponentProps } from 'react';
5
-
6
- declare const text: (props?: ({
7
- themeColor?: "primary" | undefined;
8
- variant?: "primary" | "code" | "subtitle" | undefined;
9
- } & ({
10
- class?: cva.ClassValue;
11
- className?: never;
12
- } | {
13
- class?: never;
14
- className?: cva.ClassValue;
15
- })) | undefined) => string;
16
- interface TextProps extends ComponentProps<'p'>, VariantProps<typeof text> {
17
- }
18
- declare const Text: (props: TextProps) => react_jsx_runtime.JSX.Element;
19
-
20
- export { Text, type TextProps };
@@ -1,45 +0,0 @@
1
- import { defineConfig } from 'cva';
2
- import { twMerge } from 'fluid-tailwindcss/tailwind-merge';
3
- import { jsx } from 'react/jsx-runtime';
4
-
5
- // src/utils/cn.ts
6
- var { cva, compose } = defineConfig({
7
- hooks: {
8
- onComplete: (className) => {
9
- return twMerge(className);
10
- }
11
- }
12
- });
13
- var text = cva({
14
- base: ["relative", "block"],
15
- defaultVariants: {
16
- themeColor: "primary",
17
- variant: "primary"
18
- },
19
- variants: {
20
- themeColor: {
21
- primary: []
22
- },
23
- variant: {
24
- code: ["font-light", "font-monospace"],
25
- primary: [],
26
- subtitle: ["text-lg"]
27
- }
28
- }
29
- });
30
- var Text = (props) => {
31
- const { children, className, variant, themeColor } = props;
32
- return /* @__PURE__ */ jsx(
33
- "div",
34
- {
35
- className: text({
36
- className,
37
- themeColor,
38
- variant
39
- }),
40
- children
41
- }
42
- );
43
- };
44
-
45
- export { Text };
@@ -1,19 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import * as cva from 'cva';
3
- import { VariantProps } from 'cva';
4
- import { ComponentProps } from 'react';
5
-
6
- declare const ul: (props?: ({
7
- variant?: "primary" | "unstyled" | "inline" | undefined;
8
- } & ({
9
- class?: cva.ClassValue;
10
- className?: never;
11
- } | {
12
- class?: never;
13
- className?: cva.ClassValue;
14
- })) | undefined) => string;
15
- interface UnorderedListProps extends ComponentProps<'ul'>, VariantProps<typeof ul> {
16
- }
17
- declare const UnorderedList: (props: UnorderedListProps) => react_jsx_runtime.JSX.Element;
18
-
19
- export { UnorderedList, type UnorderedListProps };
@@ -1,39 +0,0 @@
1
- import { defineConfig } from 'cva';
2
- import { twMerge } from 'fluid-tailwindcss/tailwind-merge';
3
- import { jsx } from 'react/jsx-runtime';
4
-
5
- // src/utils/cn.ts
6
- var { cva, compose } = defineConfig({
7
- hooks: {
8
- onComplete: (className) => {
9
- return twMerge(className);
10
- }
11
- }
12
- });
13
- var ul = cva({
14
- defaultVariants: {
15
- variant: "primary"
16
- },
17
- variants: {
18
- variant: {
19
- inline: ["flex", "flex-wrap", "list-none"],
20
- primary: [],
21
- unstyled: ["list-none", "p-0"]
22
- }
23
- }
24
- });
25
- var UnorderedList = (props) => {
26
- const { children, className, variant } = props;
27
- return /* @__PURE__ */ jsx(
28
- "ul",
29
- {
30
- className: ul({
31
- className,
32
- variant
33
- }),
34
- children
35
- }
36
- );
37
- };
38
-
39
- export { UnorderedList };
@@ -1,12 +0,0 @@
1
- import * as react from 'react';
2
-
3
- declare const NonceContext: react.Context<string>;
4
- declare const NonceProvider: react.Provider<string>;
5
- declare const useNonce: () => string;
6
- /**
7
- * Generate a cryptographically secure nonce for CSP.
8
- * @returns A base64-encoded random nonce
9
- */
10
- declare function generateNonce(): string;
11
-
12
- export { NonceContext, NonceProvider, generateNonce, useNonce };
@@ -1,13 +0,0 @@
1
- import { createContext, useContext } from 'react';
2
-
3
- // src/hooks/use-nonce.ts
4
- var NonceContext = createContext("");
5
- var NonceProvider = NonceContext.Provider;
6
- var useNonce = () => useContext(NonceContext);
7
- function generateNonce() {
8
- const array = new Uint8Array(16);
9
- crypto.getRandomValues(array);
10
- return btoa(String.fromCharCode(...array));
11
- }
12
-
13
- export { NonceContext, NonceProvider, generateNonce, useNonce };
@@ -1,9 +0,0 @@
1
- type AuthorInfo = {
2
- name?: string;
3
- email?: string;
4
- url?: string;
5
- };
6
- declare function parseAuthorString(input: string): AuthorInfo;
7
- declare function generateLinkFromAuthorString(input: string): React.ReactNode;
8
-
9
- export { generateLinkFromAuthorString, parseAuthorString };
@@ -1,55 +0,0 @@
1
- import { jsx } from 'react/jsx-runtime';
2
-
3
- // src/utils/author.tsx
4
- var regex = /^(.*?)\s*(?:<([^>]+)>)?\s*(?:\(([^)]+)\))?$/;
5
- function parseAuthorString(input) {
6
- const match = input.match(regex);
7
- if (match) {
8
- const [, name, email, url] = match;
9
- const result = {};
10
- if (email) {
11
- result.email = email;
12
- }
13
- const trimmedName = name?.trim();
14
- if (trimmedName) {
15
- result.name = trimmedName;
16
- }
17
- if (url) {
18
- result.url = url;
19
- }
20
- return result;
21
- }
22
- return {};
23
- }
24
- function generateLinkFromAuthorString(input) {
25
- const match = input.match(regex);
26
- if (match) {
27
- const [, name, email, url] = match.map((part) => {
28
- return part?.trim();
29
- });
30
- if (email) {
31
- return /* @__PURE__ */ jsx(
32
- "a",
33
- {
34
- className: "u-email p-name",
35
- href: `mailto:${email}`,
36
- children: name
37
- }
38
- );
39
- }
40
- if (url && (url.startsWith("/") || url.startsWith("http"))) {
41
- return /* @__PURE__ */ jsx(
42
- "a",
43
- {
44
- className: "u-url p-name",
45
- href: url,
46
- children: name
47
- }
48
- );
49
- }
50
- return /* @__PURE__ */ jsx("span", { className: "p-name", children: name });
51
- }
52
- return;
53
- }
54
-
55
- export { generateLinkFromAuthorString, parseAuthorString };
@@ -1,9 +0,0 @@
1
- import * as cva$1 from 'cva';
2
- import { cx } from 'cva';
3
- export { VariantProps } from 'cva';
4
-
5
- declare const cva: cva$1.CVA;
6
- declare const compose: cva$1.Compose;
7
- declare const cn: (...inputs: Parameters<typeof cx>) => string;
8
-
9
- export { cn, compose, cva };
package/dist/utils/cn.js DELETED
@@ -1,14 +0,0 @@
1
- import { defineConfig, cx } from 'cva';
2
- import { twMerge } from 'fluid-tailwindcss/tailwind-merge';
3
-
4
- // src/utils/cn.ts
5
- var { cva, compose } = defineConfig({
6
- hooks: {
7
- onComplete: (className) => {
8
- return twMerge(className);
9
- }
10
- }
11
- });
12
- var cn = (...inputs) => twMerge(cx(inputs));
13
-
14
- export { cn, compose, cva };