@ya-accelerators/nextjs-framework 0.0.46 → 0.0.48
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/dist/env.client.d.ts +1 -0
- package/dist/env.client.js +2 -0
- package/dist/env.client.js.map +1 -1
- package/dist/env.d.ts +1 -0
- package/dist/env.js +2 -0
- package/dist/env.js.map +1 -1
- package/dist/hooks/localStorage/index.js +3 -2
- package/dist/hooks/localStorage/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/index.d.ts +2 -0
- package/dist/lib/index.js +2 -0
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/next-auth/index.js +15 -5
- package/dist/lib/next-auth/index.js.map +1 -1
- package/dist/lib/server-action/index.d.ts +2 -0
- package/dist/lib/server-action/index.js +20 -0
- package/dist/lib/server-action/index.js.map +1 -0
- package/dist/logger/index.d.ts +16 -0
- package/dist/logger/index.js +77 -0
- package/dist/logger/index.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/ui/composite/index.d.ts +0 -12
- package/dist/ui/composite/input/index.d.ts +0 -13
- package/dist/ui/composite/input/index.js +0 -2
- package/dist/ui/composite/input/index.js.map +1 -1
- package/dist/ui/layout/form/index.d.ts +2 -2
- package/dist/ui/layout/form/index.jsx +14 -2
- package/dist/ui/layout/form/index.jsx.map +1 -1
- package/dist/ui/layout/index.d.ts +1 -1
- package/dist/ui/types/index.d.ts +1 -6
- package/dist/ui/types/index.js.map +1 -1
- package/dist/util/index.js +15 -0
- package/dist/util/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/ui/composite/input/address/index.d.ts +0 -33
- package/dist/ui/composite/input/address/index.jsx +0 -132
- package/dist/ui/composite/input/address/index.jsx.map +0 -1
- package/dist/ui/composite/input/address/map.d.ts +0 -64
- package/dist/ui/composite/input/address/map.jsx +0 -111
- package/dist/ui/composite/input/address/map.jsx.map +0 -1
- package/dist/ui/composite/input/address/utils.d.ts +0 -23
- package/dist/ui/composite/input/address/utils.js +0 -66
- package/dist/ui/composite/input/address/utils.js.map +0 -1
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { Rounded } from '../../../theme';
|
|
2
|
-
declare global {
|
|
3
|
-
interface Window {
|
|
4
|
-
google: {
|
|
5
|
-
maps: {
|
|
6
|
-
Map: new (element: HTMLElement, options: GoogleMapOptions) => GoogleMap;
|
|
7
|
-
Marker: new (options: GoogleMarkerOptions) => GoogleMarker;
|
|
8
|
-
LatLng: new (lat: number, lng: number) => GoogleLatLng;
|
|
9
|
-
event: {
|
|
10
|
-
addListener: (instance: GoogleMap | GoogleMarker, eventName: string, handler: (e: GoogleMapEvent) => void) => void;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
interface GoogleMapOptions {
|
|
17
|
-
center: {
|
|
18
|
-
lat: number;
|
|
19
|
-
lng: number;
|
|
20
|
-
};
|
|
21
|
-
zoom: number;
|
|
22
|
-
mapTypeControl: boolean;
|
|
23
|
-
streetViewControl: boolean;
|
|
24
|
-
fullscreenControl: boolean;
|
|
25
|
-
}
|
|
26
|
-
interface GoogleMarkerOptions {
|
|
27
|
-
position: {
|
|
28
|
-
lat: number;
|
|
29
|
-
lng: number;
|
|
30
|
-
};
|
|
31
|
-
map: GoogleMap;
|
|
32
|
-
draggable: boolean;
|
|
33
|
-
}
|
|
34
|
-
interface GoogleMap {
|
|
35
|
-
setCenter: (position: {
|
|
36
|
-
lat: number;
|
|
37
|
-
lng: number;
|
|
38
|
-
}) => void;
|
|
39
|
-
}
|
|
40
|
-
interface GoogleMarker {
|
|
41
|
-
setPosition: (position: {
|
|
42
|
-
lat: number;
|
|
43
|
-
lng: number;
|
|
44
|
-
}) => void;
|
|
45
|
-
getPosition: () => GoogleLatLng;
|
|
46
|
-
}
|
|
47
|
-
interface GoogleLatLng {
|
|
48
|
-
lat: () => number;
|
|
49
|
-
lng: () => number;
|
|
50
|
-
}
|
|
51
|
-
interface GoogleMapEvent {
|
|
52
|
-
latLng: GoogleLatLng;
|
|
53
|
-
}
|
|
54
|
-
interface GoogleMapProps {
|
|
55
|
-
apiKey?: string;
|
|
56
|
-
initialLat?: number;
|
|
57
|
-
initialLng?: number;
|
|
58
|
-
onLocationSelect: (lat: number, lng: number) => void;
|
|
59
|
-
rounded?: Rounded;
|
|
60
|
-
disabled?: boolean;
|
|
61
|
-
className?: string;
|
|
62
|
-
}
|
|
63
|
-
export declare const GoogleMapPicker: ({ apiKey, initialLat, initialLng, onLocationSelect, rounded, disabled, className, }: GoogleMapProps) => import("react").JSX.Element;
|
|
64
|
-
export {};
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import LocationOnIcon from '@mui/icons-material/LocationOn';
|
|
3
|
-
import classNames from 'classnames';
|
|
4
|
-
import { useEffect, useRef, useState } from 'react';
|
|
5
|
-
import { Component } from '../../../component';
|
|
6
|
-
import { Rounded } from '../../../theme';
|
|
7
|
-
export const GoogleMapPicker = ({ apiKey, initialLat = 35.6812, initialLng = 139.7671, onLocationSelect, rounded = Rounded.m, disabled = false, className, }) => {
|
|
8
|
-
const mapRef = useRef(null);
|
|
9
|
-
const [mapLoaded, setMapLoaded] = useState(false);
|
|
10
|
-
const [selectedLocation, setSelectedLocation] = useState(initialLat && initialLng ? { lat: initialLat, lng: initialLng } : null);
|
|
11
|
-
useEffect(() => {
|
|
12
|
-
if (!apiKey || mapLoaded)
|
|
13
|
-
return;
|
|
14
|
-
const script = document.createElement('script');
|
|
15
|
-
script.src = `https://maps.googleapis.com/maps/api/js?key=${apiKey}&libraries=places`;
|
|
16
|
-
script.async = true;
|
|
17
|
-
script.defer = true;
|
|
18
|
-
script.onload = () => setMapLoaded(true);
|
|
19
|
-
document.head.appendChild(script);
|
|
20
|
-
return () => {
|
|
21
|
-
document.head.removeChild(script);
|
|
22
|
-
};
|
|
23
|
-
}, [apiKey, mapLoaded]);
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
if (!mapLoaded || !mapRef.current || !window.google)
|
|
26
|
-
return;
|
|
27
|
-
const mapOptions = {
|
|
28
|
-
center: { lat: initialLat, lng: initialLng },
|
|
29
|
-
zoom: 15,
|
|
30
|
-
mapTypeControl: false,
|
|
31
|
-
streetViewControl: false,
|
|
32
|
-
fullscreenControl: false,
|
|
33
|
-
};
|
|
34
|
-
const map = new window.google.maps.Map(mapRef.current, mapOptions);
|
|
35
|
-
let marker = null;
|
|
36
|
-
if (selectedLocation) {
|
|
37
|
-
marker = new window.google.maps.Marker({
|
|
38
|
-
position: selectedLocation,
|
|
39
|
-
map,
|
|
40
|
-
draggable: true,
|
|
41
|
-
});
|
|
42
|
-
map.setCenter(selectedLocation);
|
|
43
|
-
}
|
|
44
|
-
window.google.maps.event.addListener(map, 'click', (e) => {
|
|
45
|
-
if (disabled)
|
|
46
|
-
return;
|
|
47
|
-
const clickedLocation = {
|
|
48
|
-
lat: e.latLng.lat(),
|
|
49
|
-
lng: e.latLng.lng(),
|
|
50
|
-
};
|
|
51
|
-
if (marker) {
|
|
52
|
-
marker.setPosition(clickedLocation);
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
marker = new window.google.maps.Marker({
|
|
56
|
-
position: clickedLocation,
|
|
57
|
-
map,
|
|
58
|
-
draggable: true,
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
setSelectedLocation(clickedLocation);
|
|
62
|
-
onLocationSelect(clickedLocation.lat, clickedLocation.lng);
|
|
63
|
-
});
|
|
64
|
-
if (marker) {
|
|
65
|
-
window.google.maps.event.addListener(marker, 'dragend', () => {
|
|
66
|
-
if (disabled)
|
|
67
|
-
return;
|
|
68
|
-
const position = marker?.getPosition();
|
|
69
|
-
if (position && marker) {
|
|
70
|
-
const newLocation = {
|
|
71
|
-
lat: position.lat(),
|
|
72
|
-
lng: position.lng(),
|
|
73
|
-
};
|
|
74
|
-
setSelectedLocation(newLocation);
|
|
75
|
-
onLocationSelect(newLocation.lat, newLocation.lng);
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
}, [mapLoaded, mapRef, initialLat, initialLng, selectedLocation, onLocationSelect, disabled]);
|
|
80
|
-
const getRoundedClass = () => {
|
|
81
|
-
switch (rounded) {
|
|
82
|
-
case Rounded.none:
|
|
83
|
-
return '';
|
|
84
|
-
case Rounded.s:
|
|
85
|
-
return 'rounded-small';
|
|
86
|
-
case Rounded.m:
|
|
87
|
-
return 'rounded-medium';
|
|
88
|
-
case Rounded.l:
|
|
89
|
-
return 'rounded-large';
|
|
90
|
-
case Rounded.half:
|
|
91
|
-
return 'rounded-[50%]';
|
|
92
|
-
default:
|
|
93
|
-
return 'rounded-medium';
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
return (<div className={classNames('w-full', className)}>
|
|
97
|
-
{selectedLocation && (<div className='mb-control-padding-sm flex items-center justify-end'>
|
|
98
|
-
<LocationOnIcon className='text-primary mr-1'/>
|
|
99
|
-
<Component.Typography.Label>
|
|
100
|
-
{selectedLocation.lat.toFixed(6)}, {selectedLocation.lng.toFixed(6)}
|
|
101
|
-
</Component.Typography.Label>
|
|
102
|
-
</div>)}
|
|
103
|
-
|
|
104
|
-
<div className={classNames('h-64 w-full border border-gray-300', getRoundedClass())}>
|
|
105
|
-
{!apiKey ? (<div className='flex h-full items-center justify-center'>
|
|
106
|
-
<Component.Typography.Label>Google Maps API key is not configured</Component.Typography.Label>
|
|
107
|
-
</div>) : (<div ref={mapRef} className='h-full w-full'/>)}
|
|
108
|
-
</div>
|
|
109
|
-
</div>);
|
|
110
|
-
};
|
|
111
|
-
//# sourceMappingURL=map.jsx.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"map.jsx","sourceRoot":"","sources":["../../../../../../src/ui/composite/input/address/map.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,OAAO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 -1,23 +0,0 @@
|
|
|
1
|
-
export interface AddressLookupResult {
|
|
2
|
-
zipCode: string;
|
|
3
|
-
region: string;
|
|
4
|
-
city: string;
|
|
5
|
-
line1: string;
|
|
6
|
-
lat?: number;
|
|
7
|
-
lng?: number;
|
|
8
|
-
}
|
|
9
|
-
export declare const lookupJapaneseAddress: (zipCode: string) => Promise<AddressLookupResult | null>;
|
|
10
|
-
export declare const lookupInternationalAddress: (zipCode: string, countryCode: string) => Promise<AddressLookupResult | null>;
|
|
11
|
-
export interface CountryAddressFormat {
|
|
12
|
-
labels: {
|
|
13
|
-
zipCode: string;
|
|
14
|
-
region: string;
|
|
15
|
-
city: string;
|
|
16
|
-
line1: string;
|
|
17
|
-
line2: string;
|
|
18
|
-
line3?: string;
|
|
19
|
-
};
|
|
20
|
-
order: Array<'zipCode' | 'region' | 'city' | 'line1' | 'line2' | 'line3'>;
|
|
21
|
-
required: Array<'zipCode' | 'region' | 'city' | 'line1' | 'line2' | 'line3'>;
|
|
22
|
-
}
|
|
23
|
-
export declare const getCountryAddressFormat: (countryCode: string, translate?: (key: string) => string) => CountryAddressFormat;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
export const lookupJapaneseAddress = async (zipCode) => {
|
|
3
|
-
try {
|
|
4
|
-
if (!/^\d{3}-?\d{4}$/.test(zipCode)) {
|
|
5
|
-
return null;
|
|
6
|
-
}
|
|
7
|
-
const response = await fetch(`https://zipcloud.ibsnet.co.jp/api/search?zipcode=${encodeURIComponent(zipCode)}`);
|
|
8
|
-
const data = await response.json();
|
|
9
|
-
if (data.results && data.results.length > 0) {
|
|
10
|
-
const result = data.results[0];
|
|
11
|
-
return {
|
|
12
|
-
zipCode,
|
|
13
|
-
region: result.address1, // Prefecture
|
|
14
|
-
city: result.address2, // City/Ward/Town
|
|
15
|
-
line1: result.address3, // Street name
|
|
16
|
-
lat: undefined,
|
|
17
|
-
lng: undefined,
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
catch (error) {
|
|
23
|
-
console.error('Error looking up address:', error);
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
export const lookupInternationalAddress = async (zipCode, countryCode) => {
|
|
28
|
-
if (countryCode === 'JP') {
|
|
29
|
-
return lookupJapaneseAddress(zipCode);
|
|
30
|
-
}
|
|
31
|
-
return null;
|
|
32
|
-
};
|
|
33
|
-
export const getCountryAddressFormat = (countryCode, translate = (key) => key) => {
|
|
34
|
-
const japanFormat = {
|
|
35
|
-
labels: {
|
|
36
|
-
zipCode: translate('zipCode'),
|
|
37
|
-
region: translate('region'),
|
|
38
|
-
city: translate('city'),
|
|
39
|
-
line1: translate('line1'),
|
|
40
|
-
line2: translate('line2'),
|
|
41
|
-
},
|
|
42
|
-
order: ['zipCode', 'region', 'city', 'line1', 'line2'],
|
|
43
|
-
required: ['zipCode', 'region', 'city', 'line1'],
|
|
44
|
-
};
|
|
45
|
-
const usFormat = {
|
|
46
|
-
labels: {
|
|
47
|
-
zipCode: translate('Zip Code'),
|
|
48
|
-
region: translate('State'),
|
|
49
|
-
city: translate('City'),
|
|
50
|
-
line1: translate('Street Address'),
|
|
51
|
-
line2: translate('Apt, Suite, etc.'),
|
|
52
|
-
line3: translate('Additional Info'),
|
|
53
|
-
},
|
|
54
|
-
order: ['line1', 'line2', 'city', 'region', 'zipCode', 'line3'],
|
|
55
|
-
required: ['line1', 'city', 'region', 'zipCode'],
|
|
56
|
-
};
|
|
57
|
-
switch (countryCode) {
|
|
58
|
-
case 'JP':
|
|
59
|
-
return japanFormat;
|
|
60
|
-
case 'US':
|
|
61
|
-
return usFormat;
|
|
62
|
-
default:
|
|
63
|
-
return japanFormat; // Use Japan format as default
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","s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