@tpzdsp/next-toolkit 1.12.0 → 1.12.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tpzdsp/next-toolkit",
3
- "version": "1.12.0",
3
+ "version": "1.12.1",
4
4
  "description": "A reusable React component library for Next.js applications",
5
5
  "engines": {
6
6
  "node": ">= 24.12.0",
@@ -3,6 +3,27 @@
3
3
  @tailwind components;
4
4
  @tailwind utilities;
5
5
 
6
+ /**
7
+ * Accessibility: Respect user's motion preferences
8
+ *
9
+ * Many users experience discomfort or motion sickness from animations.
10
+ * This disables transitions and animations when the user has enabled
11
+ * "Reduce motion" in their operating system settings.
12
+ *
13
+ * Using 0.01ms instead of 0s ensures animation events still fire
14
+ * (which some JavaScript might depend on), but the effect is instant.
15
+ */
16
+ @media (prefers-reduced-motion: reduce) {
17
+ *,
18
+ *::before,
19
+ *::after {
20
+ animation-duration: 0.01ms !important;
21
+ animation-iteration-count: 1 !important;
22
+ transition-duration: 0.01ms !important;
23
+ scroll-behavior: auto !important;
24
+ }
25
+ }
26
+
6
27
  /* Custom font faces */
7
28
  @layer base {
8
29
  /* Add your custom font faces here */
@@ -59,7 +59,7 @@ export const requestLogger = (options?: RequestLoggerOptions): BetterFetchPlugin
59
59
 
60
60
  const timings = new Map<string, number>();
61
61
 
62
- const genId = () => crypto.randomUUID().split('-')[0].toUpperCase();
62
+ const genId = () => crypto.randomUUID().split('-')[0]!.toUpperCase();
63
63
 
64
64
  return {
65
65
  id: 'logger',
@@ -56,5 +56,11 @@ export const transformPolygonCoords = (
56
56
  from: string,
57
57
  to: string,
58
58
  ): number[][][] => {
59
- return coords.map((ring) => ring.map(([x, y]) => transform([x, y], from, to)));
59
+ return coords.map((ring) =>
60
+ ring.map(([x, y]) => {
61
+ const result = transform([x!, y!], from, to);
62
+
63
+ return [result[0]!, result[1]!];
64
+ }),
65
+ );
60
66
  };
@@ -48,8 +48,8 @@ export const osOpenNamesSearch = (options?: SearchOption) => {
48
48
  .map((feature) => {
49
49
  if (feature.geometry.type === 'Point') {
50
50
  const result: SearchResult = {
51
- lon: feature.geometry.coordinates[0],
52
- lat: feature.geometry.coordinates[1],
51
+ lon: feature.geometry.coordinates[0]!,
52
+ lat: feature.geometry.coordinates[1]!,
53
53
  address: feature?.properties?.address,
54
54
  };
55
55
 
@@ -51,8 +51,8 @@ export const useKeyboardDrawing = ({
51
51
  const delta = DELTA * resolution;
52
52
 
53
53
  setCursorPosition([
54
- cursorPosition[0] + dx * delta,
55
- cursorPosition[1] - dy * delta, // Invert Y for map coordinates
54
+ cursorPosition[0]! + dx * delta,
55
+ cursorPosition[1]! - dy * delta, // Invert Y for map coordinates
56
56
  ]);
57
57
  },
58
58
  [cursorPosition, map],
package/src/map/utils.ts CHANGED
@@ -13,7 +13,8 @@ const POPUP_HEIGHT = 300;
13
13
 
14
14
  export const getPopupPositionClass = (coordinate: number[], map: Map): PopupDirection => {
15
15
  const pixel = map.getPixelFromCoordinate(coordinate);
16
- const [x, y] = pixel;
16
+ const x = pixel[0]!;
17
+ const y = pixel[1]!;
17
18
 
18
19
  const isTop = y > POPUP_HEIGHT;
19
20
  const isBottom = y < POPUP_HEIGHT;