@akinon/next 1.91.0-rc.3 → 1.91.0-rc.4
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/CHANGELOG.md +10 -0
- package/components/accordion.tsx +20 -5
- package/components/file-input.tsx +65 -3
- package/components/modal.tsx +32 -16
- package/components/plugin-module.tsx +8 -3
- package/package.json +2 -2
- package/plugins.js +2 -1
- package/types/index.ts +28 -1
- package/with-pz-config.js +1 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @akinon/next
|
|
2
2
|
|
|
3
|
+
## 1.91.0-rc.4
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 7eb51ca: ZERO-3424 :Update package versions
|
|
8
|
+
- c39c700: ZERO-3420: Refactor Modal component
|
|
9
|
+
- 0de5573: ZERO-3418: Update remotePatterns hostname to allow all subdomains
|
|
10
|
+
- 9dc7298: ZERO-3416: Refactor Accordion component to enhance props and improve styling flexibility
|
|
11
|
+
- 2d3f178: ZERO-3417: Enhance FileInput component with additional props for customization
|
|
12
|
+
|
|
3
13
|
## 1.91.0-rc.3
|
|
4
14
|
|
|
5
15
|
### Minor Changes
|
package/components/accordion.tsx
CHANGED
|
@@ -7,15 +7,19 @@ import { AccordionProps } from '../types';
|
|
|
7
7
|
|
|
8
8
|
export const Accordion = ({
|
|
9
9
|
isCollapse = false,
|
|
10
|
+
collapseClassName,
|
|
10
11
|
title,
|
|
11
12
|
subTitle,
|
|
12
13
|
icons = ['chevron-up', 'chevron-down'],
|
|
13
14
|
iconSize = 16,
|
|
14
15
|
iconColor = 'fill-[#000000]',
|
|
15
16
|
children,
|
|
17
|
+
headerClassName,
|
|
16
18
|
className,
|
|
17
19
|
titleClassName,
|
|
18
|
-
|
|
20
|
+
subTitleClassName,
|
|
21
|
+
dataTestId,
|
|
22
|
+
contentClassName
|
|
19
23
|
}: AccordionProps) => {
|
|
20
24
|
const [collapse, setCollapse] = useState(isCollapse);
|
|
21
25
|
|
|
@@ -27,15 +31,22 @@ export const Accordion = ({
|
|
|
27
31
|
)}
|
|
28
32
|
>
|
|
29
33
|
<div
|
|
30
|
-
className=
|
|
34
|
+
className={twMerge(
|
|
35
|
+
'flex items-center justify-between cursor-pointer',
|
|
36
|
+
headerClassName
|
|
37
|
+
)}
|
|
31
38
|
onClick={() => setCollapse(!collapse)}
|
|
32
39
|
data-testid={dataTestId}
|
|
33
40
|
>
|
|
34
|
-
<div className=
|
|
41
|
+
<div className={twMerge('flex flex-col', contentClassName)}>
|
|
35
42
|
{title && (
|
|
36
43
|
<h3 className={twMerge('text-sm', titleClassName)}>{title}</h3>
|
|
37
44
|
)}
|
|
38
|
-
{subTitle &&
|
|
45
|
+
{subTitle && (
|
|
46
|
+
<h4 className={twMerge('text-xs text-gray-700', subTitleClassName)}>
|
|
47
|
+
{subTitle}
|
|
48
|
+
</h4>
|
|
49
|
+
)}
|
|
39
50
|
</div>
|
|
40
51
|
|
|
41
52
|
{icons && (
|
|
@@ -46,7 +57,11 @@ export const Accordion = ({
|
|
|
46
57
|
/>
|
|
47
58
|
)}
|
|
48
59
|
</div>
|
|
49
|
-
{collapse &&
|
|
60
|
+
{collapse && (
|
|
61
|
+
<div className={twMerge('mt-3 text-sm', collapseClassName)}>
|
|
62
|
+
{children}
|
|
63
|
+
</div>
|
|
64
|
+
)}
|
|
50
65
|
</div>
|
|
51
66
|
);
|
|
52
67
|
};
|
|
@@ -1,8 +1,70 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
1
2
|
import { forwardRef } from 'react';
|
|
2
|
-
import {
|
|
3
|
+
import { useLocalization } from '@akinon/next/hooks';
|
|
4
|
+
import { twMerge } from 'tailwind-merge';
|
|
5
|
+
import { FileInputProps } from '../types';
|
|
3
6
|
|
|
4
7
|
export const FileInput = forwardRef<HTMLInputElement, FileInputProps>(
|
|
5
|
-
function
|
|
6
|
-
|
|
8
|
+
function FileInput(
|
|
9
|
+
{
|
|
10
|
+
buttonClassName,
|
|
11
|
+
onChange,
|
|
12
|
+
fileClassName,
|
|
13
|
+
fileNameWrapperClassName,
|
|
14
|
+
fileInputClassName,
|
|
15
|
+
...props
|
|
16
|
+
},
|
|
17
|
+
ref
|
|
18
|
+
) {
|
|
19
|
+
const { t } = useLocalization();
|
|
20
|
+
const [fileNames, setFileNames] = useState<string[]>([]);
|
|
21
|
+
|
|
22
|
+
const handleFileChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
23
|
+
const files = Array.from(event.target.files || []);
|
|
24
|
+
setFileNames(files.map((file) => file.name));
|
|
25
|
+
|
|
26
|
+
if (onChange) {
|
|
27
|
+
onChange(event);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<div className="relative">
|
|
33
|
+
<input
|
|
34
|
+
type="file"
|
|
35
|
+
{...props}
|
|
36
|
+
ref={ref}
|
|
37
|
+
className={twMerge(
|
|
38
|
+
'absolute inset-0 w-full h-full opacity-0 cursor-pointer',
|
|
39
|
+
fileInputClassName
|
|
40
|
+
)}
|
|
41
|
+
onChange={handleFileChange}
|
|
42
|
+
/>
|
|
43
|
+
<button
|
|
44
|
+
type="button"
|
|
45
|
+
className={twMerge(
|
|
46
|
+
'bg-primary text-white py-2 px-4 text-sm',
|
|
47
|
+
buttonClassName
|
|
48
|
+
)}
|
|
49
|
+
>
|
|
50
|
+
{t('common.file_input.select_file')}
|
|
51
|
+
</button>
|
|
52
|
+
<div
|
|
53
|
+
className={twMerge('mt-1 text-gray-500', fileNameWrapperClassName)}
|
|
54
|
+
>
|
|
55
|
+
{fileNames.length > 0 ? (
|
|
56
|
+
<ul className={twMerge('list-disc pl-4 text-xs', fileClassName)}>
|
|
57
|
+
{fileNames.map((name, index) => (
|
|
58
|
+
<li key={index}>{name}</li>
|
|
59
|
+
))}
|
|
60
|
+
</ul>
|
|
61
|
+
) : (
|
|
62
|
+
<span className={twMerge('text-xs', fileClassName)}>
|
|
63
|
+
{t('common.file_input.no_file')}
|
|
64
|
+
</span>
|
|
65
|
+
)}
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
);
|
|
7
69
|
}
|
|
8
70
|
);
|
package/components/modal.tsx
CHANGED
|
@@ -4,16 +4,7 @@ import { ReactPortal } from './react-portal';
|
|
|
4
4
|
import { Icon } from './icon';
|
|
5
5
|
import { twMerge } from 'tailwind-merge';
|
|
6
6
|
import { useEffect } from 'react';
|
|
7
|
-
|
|
8
|
-
export interface ModalProps {
|
|
9
|
-
portalId: string;
|
|
10
|
-
children?: React.ReactNode;
|
|
11
|
-
open?: boolean;
|
|
12
|
-
setOpen?: (open: boolean) => void;
|
|
13
|
-
title?: React.ReactNode;
|
|
14
|
-
showCloseButton?: React.ReactNode;
|
|
15
|
-
className?: string;
|
|
16
|
-
}
|
|
7
|
+
import { ModalProps } from '../types';
|
|
17
8
|
|
|
18
9
|
export const Modal = (props: ModalProps) => {
|
|
19
10
|
const {
|
|
@@ -23,7 +14,14 @@ export const Modal = (props: ModalProps) => {
|
|
|
23
14
|
setOpen,
|
|
24
15
|
title = '',
|
|
25
16
|
showCloseButton = true,
|
|
26
|
-
className
|
|
17
|
+
className,
|
|
18
|
+
overlayClassName,
|
|
19
|
+
headerWrapperClassName,
|
|
20
|
+
titleClassName,
|
|
21
|
+
closeButtonClassName,
|
|
22
|
+
iconName = 'close',
|
|
23
|
+
iconSize = 16,
|
|
24
|
+
iconClassName
|
|
27
25
|
} = props;
|
|
28
26
|
|
|
29
27
|
useEffect(() => {
|
|
@@ -38,7 +36,12 @@ export const Modal = (props: ModalProps) => {
|
|
|
38
36
|
|
|
39
37
|
return (
|
|
40
38
|
<ReactPortal wrapperId={portalId}>
|
|
41
|
-
<div
|
|
39
|
+
<div
|
|
40
|
+
className={twMerge(
|
|
41
|
+
'fixed top-0 left-0 w-screen h-screen bg-primary bg-opacity-60 z-50',
|
|
42
|
+
overlayClassName
|
|
43
|
+
)}
|
|
44
|
+
/>
|
|
42
45
|
<section
|
|
43
46
|
className={twMerge(
|
|
44
47
|
'fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-50 bg-white',
|
|
@@ -46,15 +49,28 @@ export const Modal = (props: ModalProps) => {
|
|
|
46
49
|
)}
|
|
47
50
|
>
|
|
48
51
|
{(showCloseButton || title) && (
|
|
49
|
-
<div
|
|
50
|
-
|
|
52
|
+
<div
|
|
53
|
+
className={twMerge(
|
|
54
|
+
'flex px-6 py-4 border-b border-gray-400',
|
|
55
|
+
headerWrapperClassName
|
|
56
|
+
)}
|
|
57
|
+
>
|
|
58
|
+
{title && (
|
|
59
|
+
<h3 className={twMerge('text-lg font-light', titleClassName)}>
|
|
60
|
+
{title}
|
|
61
|
+
</h3>
|
|
62
|
+
)}
|
|
51
63
|
{showCloseButton && (
|
|
52
64
|
<button
|
|
53
65
|
type="button"
|
|
54
66
|
onClick={() => setOpen(false)}
|
|
55
|
-
className=
|
|
67
|
+
className={twMerge('ml-auto', closeButtonClassName)}
|
|
56
68
|
>
|
|
57
|
-
<Icon
|
|
69
|
+
<Icon
|
|
70
|
+
name={iconName}
|
|
71
|
+
size={iconSize}
|
|
72
|
+
className={iconClassName}
|
|
73
|
+
/>
|
|
58
74
|
</button>
|
|
59
75
|
)}
|
|
60
76
|
</div>
|
|
@@ -20,7 +20,8 @@ enum Plugin {
|
|
|
20
20
|
B2B = 'pz-b2b',
|
|
21
21
|
Akifast = 'pz-akifast',
|
|
22
22
|
MultiBasket = 'pz-multi-basket',
|
|
23
|
-
SavedCard = 'pz-saved-card'
|
|
23
|
+
SavedCard = 'pz-saved-card',
|
|
24
|
+
Hepsipay = 'pz-hepsipay'
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
export enum Component {
|
|
@@ -45,7 +46,8 @@ export enum Component {
|
|
|
45
46
|
AkifastQuickLoginButton = 'QuickLoginButton',
|
|
46
47
|
AkifastCheckoutButton = 'CheckoutButton',
|
|
47
48
|
MultiBasket = 'MultiBasket',
|
|
48
|
-
SavedCard = 'SavedCardOption'
|
|
49
|
+
SavedCard = 'SavedCardOption',
|
|
50
|
+
Hepsipay = 'Hepsipay'
|
|
49
51
|
}
|
|
50
52
|
|
|
51
53
|
const PluginComponents = new Map([
|
|
@@ -78,7 +80,8 @@ const PluginComponents = new Map([
|
|
|
78
80
|
[Component.AkifastQuickLoginButton, Component.AkifastCheckoutButton]
|
|
79
81
|
],
|
|
80
82
|
[Plugin.MultiBasket, [Component.MultiBasket]],
|
|
81
|
-
[Plugin.SavedCard, [Component.SavedCard]]
|
|
83
|
+
[Plugin.SavedCard, [Component.SavedCard]],
|
|
84
|
+
[Plugin.Hepsipay, [Component.Hepsipay]]
|
|
82
85
|
]);
|
|
83
86
|
|
|
84
87
|
const getPlugin = (component: Component) => {
|
|
@@ -143,6 +146,8 @@ export default function PluginModule({
|
|
|
143
146
|
promise = import(`${'@akinon/pz-multi-basket'}`);
|
|
144
147
|
} else if (plugin === Plugin.SavedCard) {
|
|
145
148
|
promise = import(`${'@akinon/pz-saved-card'}`);
|
|
149
|
+
} else if (plugin === Plugin.Hepsipay) {
|
|
150
|
+
promise = import(`${'@akinon/pz-hepsipay'}`);
|
|
146
151
|
}
|
|
147
152
|
} catch (error) {
|
|
148
153
|
logger.error(error);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akinon/next",
|
|
3
3
|
"description": "Core package for Project Zero Next",
|
|
4
|
-
"version": "1.91.0-rc.
|
|
4
|
+
"version": "1.91.0-rc.4",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bin": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"set-cookie-parser": "2.6.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@akinon/eslint-plugin-projectzero": "1.91.0-rc.
|
|
37
|
+
"@akinon/eslint-plugin-projectzero": "1.91.0-rc.4",
|
|
38
38
|
"@babel/core": "7.26.10",
|
|
39
39
|
"@babel/preset-env": "7.26.9",
|
|
40
40
|
"@babel/preset-typescript": "7.27.0",
|
package/plugins.js
CHANGED
package/types/index.ts
CHANGED
|
@@ -283,7 +283,13 @@ export interface ButtonProps
|
|
|
283
283
|
target?: '_blank' | '_self' | '_parent' | '_top';
|
|
284
284
|
}
|
|
285
285
|
|
|
286
|
-
export
|
|
286
|
+
export interface FileInputProps extends React.HTMLProps<HTMLInputElement> {
|
|
287
|
+
fileClassName?: string;
|
|
288
|
+
fileNameWrapperClassName?: string;
|
|
289
|
+
fileInputClassName?: string;
|
|
290
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
291
|
+
buttonClassName?: string;
|
|
292
|
+
}
|
|
287
293
|
|
|
288
294
|
export interface PriceProps {
|
|
289
295
|
currencyCode?: string;
|
|
@@ -304,15 +310,19 @@ export interface InputProps extends React.HTMLProps<HTMLInputElement> {
|
|
|
304
310
|
|
|
305
311
|
export interface AccordionProps {
|
|
306
312
|
isCollapse?: boolean;
|
|
313
|
+
collapseClassName?: string;
|
|
307
314
|
title?: string;
|
|
308
315
|
subTitle?: string;
|
|
309
316
|
icons?: string[];
|
|
310
317
|
iconSize?: number;
|
|
311
318
|
iconColor?: string;
|
|
312
319
|
children?: ReactNode;
|
|
320
|
+
headerClassName?: string;
|
|
313
321
|
className?: string;
|
|
314
322
|
titleClassName?: string;
|
|
323
|
+
subTitleClassName?: string;
|
|
315
324
|
dataTestId?: string;
|
|
325
|
+
contentClassName?: string;
|
|
316
326
|
}
|
|
317
327
|
|
|
318
328
|
export interface PluginModuleComponentProps {
|
|
@@ -337,3 +347,20 @@ export interface PaginationProps {
|
|
|
337
347
|
direction?: 'next' | 'prev';
|
|
338
348
|
isLoading?: boolean;
|
|
339
349
|
}
|
|
350
|
+
|
|
351
|
+
export interface ModalProps {
|
|
352
|
+
portalId: string;
|
|
353
|
+
children?: React.ReactNode;
|
|
354
|
+
open?: boolean;
|
|
355
|
+
setOpen?: (open: boolean) => void;
|
|
356
|
+
title?: React.ReactNode;
|
|
357
|
+
showCloseButton?: React.ReactNode;
|
|
358
|
+
className?: string;
|
|
359
|
+
overlayClassName?: string;
|
|
360
|
+
headerWrapperClassName?: string;
|
|
361
|
+
titleClassName?: string;
|
|
362
|
+
closeButtonClassName?: string;
|
|
363
|
+
iconName?: string;
|
|
364
|
+
iconSize?: number;
|
|
365
|
+
iconClassName?: string;
|
|
366
|
+
}
|
package/with-pz-config.js
CHANGED