@tpzdsp/next-toolkit 1.2.6 → 1.2.8

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.2.6",
3
+ "version": "1.2.8",
4
4
  "description": "A reusable React component library for Next.js applications",
5
5
  "type": "module",
6
6
  "private": false,
@@ -37,6 +37,8 @@ export { Modal } from './Modal/Modal';
37
37
 
38
38
  // Export client component types
39
39
  export type { AccordionProps } from './accordion/Accordion';
40
+ export type { ItemRendererProps } from './dropdown/useDropdownMenu';
41
+ export type { DropdownMenuItem } from './dropdown/DropdownMenu';
40
42
 
41
43
  // Export layout components
42
44
  export { Header } from './layout/header/Header';
@@ -19,6 +19,7 @@ export type MapComponentProps = {
19
19
  geocoderUrl: string;
20
20
  basePath: string;
21
21
  isLoading?: boolean;
22
+ error?: Error;
22
23
  };
23
24
 
24
25
  const positionTransforms: Record<PopupDirection, string> = {
@@ -47,7 +48,9 @@ export const MapComponent = ({
47
48
  geocoderUrl,
48
49
  basePath,
49
50
  isLoading,
51
+ error,
50
52
  }: MapComponentProps) => {
53
+ console.log('ERROR: ', error);
51
54
  const [popupFeatures, setPopupFeatures] = useState([]);
52
55
  const [popupCoordinate, setPopupCoordinate] = useState<number[] | null>(null);
53
56
  const [popupPositionClass, setPopupPositionClass] = useState<PopupDirection>('bottom-right');
package/src/types/api.ts CHANGED
@@ -19,7 +19,7 @@ export type PaginatedResponse<T = unknown> = {
19
19
 
20
20
  // Since we only ever fetch a single API we don't need multiple failure types,
21
21
  // so defining a global one as the default is fine. This can be changed per-app.
22
- export type ApiFailure = { message: string };
22
+ export type ApiFailure = { message: string; status?: number; code?: string; details?: unknown };
23
23
 
24
24
  type GenericResponse<Ok, Error> =
25
25
  | ({
package/src/utils/http.ts CHANGED
@@ -2,6 +2,7 @@ import type { Response, ApiFailure } from '../types/api';
2
2
 
3
3
  export const MimeTypes = {
4
4
  Json: 'application/json',
5
+ JsonLd: 'application/ld+json',
5
6
  GeoJson: 'application/geo+json',
6
7
  Png: 'image/png',
7
8
  XJsonLines: 'application/x-jsonlines',
@@ -12,6 +13,8 @@ export const Http = {
12
13
  Created: 201,
13
14
  NoContent: 204,
14
15
  BadRequest: 400,
16
+ Unauthorized: 401,
17
+ Forbidden: 403,
15
18
  NotFound: 404,
16
19
  NotAllowed: 405,
17
20
  InternalServerError: 500,
@@ -17,6 +17,10 @@ export const decodeAuthToken = (token: string): Credentials | null => {
17
17
  }
18
18
  };
19
19
 
20
+ export const isStringArray = (value: unknown): value is string[] => {
21
+ return Array.isArray(value) && value.every((item) => typeof item === 'string');
22
+ };
23
+
20
24
  /**
21
25
  * Utility function to merge Tailwind CSS classes with conflict resolution
22
26
  * Uses tailwind-merge to handle conflicting utility classes