@tpzdsp/next-toolkit 1.14.2 → 1.14.3
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
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { type ReactNode, useRef, useId, useState } from 'react';
|
|
3
|
+
import { type ReactNode, type ComponentType, useRef, useId, useState } from 'react';
|
|
4
4
|
|
|
5
5
|
import { FaInfoCircle } from 'react-icons/fa';
|
|
6
6
|
|
|
@@ -39,6 +39,8 @@ type Props = {
|
|
|
39
39
|
triggerLabel?: string;
|
|
40
40
|
/** Preferred placement (Floating UI will auto-adjust if needed) */
|
|
41
41
|
placement?: Placement;
|
|
42
|
+
/** Custom icon component to replace the default FaInfoCircle */
|
|
43
|
+
icon?: ComponentType<{ className?: string }>;
|
|
42
44
|
};
|
|
43
45
|
|
|
44
46
|
export type InfoBoxProps = ExtendProps<'div', Props>;
|
|
@@ -51,6 +53,7 @@ export const InfoBox = ({
|
|
|
51
53
|
maxWidth = '320px',
|
|
52
54
|
triggerLabel = 'Show information',
|
|
53
55
|
placement = 'bottom-start',
|
|
56
|
+
icon: Icon = FaInfoCircle,
|
|
54
57
|
className,
|
|
55
58
|
...props
|
|
56
59
|
}: InfoBoxProps) => {
|
|
@@ -128,7 +131,7 @@ export const InfoBox = ({
|
|
|
128
131
|
className={triggerClasses}
|
|
129
132
|
{...getReferenceProps()}
|
|
130
133
|
>
|
|
131
|
-
<
|
|
134
|
+
<Icon className={iconClasses} aria-hidden="true" />
|
|
132
135
|
</button>
|
|
133
136
|
|
|
134
137
|
{isOpen && (
|
|
@@ -173,14 +173,7 @@ describe('Accordion', () => {
|
|
|
173
173
|
|
|
174
174
|
const container = screen.getByRole('button').closest('div');
|
|
175
175
|
|
|
176
|
-
expect(container).toHaveClass(
|
|
177
|
-
'flex',
|
|
178
|
-
'flex-col',
|
|
179
|
-
'gap-2',
|
|
180
|
-
'border-l-2',
|
|
181
|
-
'border-neutral-100',
|
|
182
|
-
'rounded-md',
|
|
183
|
-
);
|
|
176
|
+
expect(container).toHaveClass('flex', 'flex-col', 'border-l-2', 'border-neutral-100');
|
|
184
177
|
|
|
185
178
|
const button = screen.getByRole('button');
|
|
186
179
|
|
|
@@ -190,8 +183,10 @@ describe('Accordion', () => {
|
|
|
190
183
|
'items-center',
|
|
191
184
|
'px-2',
|
|
192
185
|
'py-1',
|
|
193
|
-
'
|
|
194
|
-
'
|
|
186
|
+
'text-[color:#000000]',
|
|
187
|
+
'border-y-2',
|
|
188
|
+
'border-neutral-100',
|
|
189
|
+
'focus-yellow',
|
|
195
190
|
);
|
|
196
191
|
});
|
|
197
192
|
});
|
|
@@ -28,15 +28,12 @@ export const Accordion = ({
|
|
|
28
28
|
const [isOpen, setIsOpen] = useState(defaultOpen);
|
|
29
29
|
|
|
30
30
|
return (
|
|
31
|
-
<div
|
|
32
|
-
className={cn('flex flex-col gap-2 border-l-2 border-neutral-100 rounded-md', className)}
|
|
33
|
-
{...props}
|
|
34
|
-
>
|
|
31
|
+
<div className={cn('flex flex-col border-l-2 border-neutral-100', className)} {...props}>
|
|
35
32
|
<button
|
|
36
33
|
aria-expanded={isOpen}
|
|
37
34
|
aria-controls={contentId}
|
|
38
|
-
className="flex justify-between items-center px-2 py-1 bg-
|
|
39
|
-
focus-yellow"
|
|
35
|
+
className="flex justify-between items-center px-2 py-1 bg-[#fefefefe] text-[color:#000000]
|
|
36
|
+
border-y-2 border-neutral-100 focus-yellow"
|
|
40
37
|
id={buttonId}
|
|
41
38
|
onClick={() => setIsOpen(!isOpen)}
|
|
42
39
|
type="button"
|
|
@@ -52,7 +49,7 @@ export const Accordion = ({
|
|
|
52
49
|
id={contentId}
|
|
53
50
|
aria-labelledby={buttonId}
|
|
54
51
|
aria-hidden={!isOpen}
|
|
55
|
-
className={cn('
|
|
52
|
+
className={cn('p-2 bg-[#efefef]', isOpen ? 'block' : 'hidden')}
|
|
56
53
|
>
|
|
57
54
|
{children}
|
|
58
55
|
</section>
|
package/src/http/constants.ts
CHANGED
|
@@ -11,6 +11,7 @@ export const MimeType = {
|
|
|
11
11
|
UrlEncodedForm: 'application/x-www-form-urlencoded',
|
|
12
12
|
MultipartForm: 'multipart/form-data',
|
|
13
13
|
Text: 'text/plain',
|
|
14
|
+
NTriples: 'application/n-triples',
|
|
14
15
|
} as const;
|
|
15
16
|
|
|
16
17
|
/**
|
|
@@ -49,6 +50,7 @@ export const HttpStatus = {
|
|
|
49
50
|
UnprocessableContent: 422,
|
|
50
51
|
InternalServerError: 500,
|
|
51
52
|
NotImplemented: 501,
|
|
53
|
+
BadGateway: 502,
|
|
52
54
|
} as const;
|
|
53
55
|
|
|
54
56
|
/**
|
|
@@ -71,6 +73,7 @@ export const HttpStatusText = {
|
|
|
71
73
|
UnprocessableContent: 'Unprocessable Content',
|
|
72
74
|
InternalServerError: 'Internal Server Error',
|
|
73
75
|
NotImplemented: 'Not Implemented',
|
|
76
|
+
BadGateway: 'Bad Gateway',
|
|
74
77
|
} as const;
|
|
75
78
|
|
|
76
79
|
/**
|
package/src/http/fetch.ts
CHANGED
|
@@ -14,6 +14,8 @@ import {
|
|
|
14
14
|
type BetterFetchPlugin,
|
|
15
15
|
} from '@better-fetch/fetch';
|
|
16
16
|
|
|
17
|
+
export { type BetterFetchPlugin } from '@better-fetch/fetch';
|
|
18
|
+
|
|
17
19
|
import { ApiError } from '../errors';
|
|
18
20
|
import { Header, isJsonMimeType, MimeType, type HttpMethods } from './constants';
|
|
19
21
|
import { HttpStatus } from './constants';
|