@q2devel/q2-storybook 1.0.160 → 1.0.164
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/auth/hooks/useCurrentUserUpdateHookFactory.js +1 -1
- package/dist/auth/hooks/useCurrentUserUpdatePasswordHookFactory.js +9 -2
- package/dist/auth/hooks/useResetPasswordHookFactory.js +9 -2
- package/dist/auth/hooks/useSignInHookFactory.js +9 -2
- package/dist/auth/hooks/useSignOutHookFactory.js +8 -1
- package/dist/auth/hooks/useSignUpHookFactory.js +9 -2
- package/dist/auth/provider/AuthContextProviderFactory.js +9 -2
- package/dist/auth/service/AuthService.js +6 -3
- package/dist/components/Base/badge/Badge.d.ts +1 -1
- package/dist/components/Base/badge/Badge.js +2 -2
- package/dist/components/Base/blog-builder/BlogBuilder.d.ts +3 -3
- package/dist/components/Base/blog-builder/BlogBuilder.js +23 -23
- package/dist/components/Base/blog-builder/text-and-media-paragraph/TextAndMediaParagraph.d.ts +1 -1
- package/dist/components/Base/blog-builder/text-and-media-paragraph/TextAndMediaParagraph.js +1 -1
- package/dist/components/Base/blog-builder/video-paragraph/VideoParagraph.d.ts +1 -1
- package/dist/components/Base/blog-builder/video-paragraph/VideoParagraph.js +1 -1
- package/dist/components/Base/heading/Heading.d.ts +1 -1
- package/dist/components/Base/heading/Heading.js +1 -1
- package/dist/components/Base/image-gallery-modal/ImageGalleryModal.js +1 -1
- package/dist/components/Base/modal/Modal.js +3 -2
- package/dist/components/Base/price/Price.js +2 -2
- package/dist/components/Base/select/Select.d.ts +2 -2
- package/dist/components/Base/select/Select.js +20 -18
- package/dist/components/Base/spinner/Spinner.d.ts +3 -3
- package/dist/components/Base/spinner/Spinner.js +7 -7
- package/dist/components/Base/switch/Switch.js +20 -14
- package/dist/components/Base/tooltip/Tooltip.js +10 -3
- package/dist/components/Ecommerce/basket-dialog/BasketDialog.js +8 -5
- package/dist/components/Ecommerce/basket-overview/BasketOverview.js +4 -1
- package/dist/components/Ecommerce/category-tree/CategoryTree.js +3 -2
- package/dist/components/Ecommerce/instructions-list/Instruction.js +3 -3
- package/dist/components/Ecommerce/instructions-list/InstructionsList.js +1 -1
- package/dist/components/Ecommerce/product-card/ProductCard.js +18 -4
- package/dist/components/Ecommerce/product-detail/ProductDetail.js +79 -23
- package/dist/components/Ecommerce/progress-stepper/ProgressStepper.js +11 -5
- package/dist/components/Ecommerce/wishlist/DeleteButton.js +3 -1
- package/dist/components/Ecommerce/wishlist/LikeButton.js +9 -3
- package/dist/components/Ecommerce/wishlist/WishlistDropdown.js +3 -3
- package/dist/components/Forms/checkbox/Checkbox.js +5 -2
- package/dist/components/Forms/checkbox/CheckboxGroup.js +4 -1
- package/dist/components/Forms/contact-form/ContactForm.d.ts +2 -2
- package/dist/components/Forms/contact-form/ContactForm.js +69 -55
- package/dist/components/Forms/dropdown/Dropdown.js +4 -2
- package/dist/components/Forms/select-field/SelectField.js +13 -8
- package/dist/components/Forms/text-area/TextArea.d.ts +3 -3
- package/dist/components/Forms/text-area/TextArea.js +13 -13
- package/dist/components/Forms/text-field/TextField.js +6 -2
- package/dist/components/MIKS/ScheduleDetail/ScheduleDetail.js +7 -7
- package/dist/components/MIKS/date-carousel/DateCarousel.js +37 -35
- package/dist/components/MIKS/event-card/EventCard.js +10 -10
- package/dist/components/MIKS/filters/FilterContainer.d.ts +2 -2
- package/dist/components/MIKS/filters/FilterContainer.js +2 -2
- package/dist/components/MIKS/filters/FilterGrid.d.ts +2 -2
- package/dist/components/MIKS/filters/FilterGrid.js +3 -3
- package/dist/components/MIKS/filters/FilterType.js +18 -18
- package/dist/components/MIKS/filters/FilterWhen.js +35 -26
- package/dist/components/MIKS/filters/FilterWhere.js +15 -15
- package/dist/components/MIKS/filters/index.d.ts +7 -7
- package/dist/components/MIKS/filters/index.js +6 -6
- package/dist/components/MIKS/filters/useFilters.d.ts +1 -1
- package/dist/components/MIKS/filters/useFilters.js +4 -2
- package/dist/components/MIKS/footer/Footer.d.ts +1 -1
- package/dist/components/MIKS/footer/Footer.js +15 -15
- package/dist/components/MIKS/index.d.ts +4 -4
- package/dist/components/MIKS/index.js +1 -1
- package/dist/components/MIKS/movie-detail/MovieDetail.js +10 -10
- package/dist/components/MIKS/navbar/NavBar.js +1 -1
- package/dist/components/MIKS/theatre-event/TheatreEvent.js +5 -5
- package/dist/components/Tables/apartment-price-list/ApartmentPriceList.d.ts +1 -1
- package/dist/components/Tables/apartment-price-list/ApartmentPriceList.js +4 -1
- package/dist/components/Web/banner/Banner.d.ts +1 -1
- package/dist/components/Web/banner/Banner.js +27 -7
- package/dist/components/Web/blog/BlogCard.d.ts +5 -5
- package/dist/components/Web/blog/BlogCard.js +57 -32
- package/dist/components/Web/breadcrumb/Breadcrumb.js +1 -1
- package/dist/components/Web/dynamic-grid/DynamicLayout.d.ts +1 -1
- package/dist/components/Web/dynamic-grid/DynamicLayout.js +49 -49
- package/dist/components/Web/faq/FaqSection.js +1 -1
- package/dist/components/Web/footer/Footer.d.ts +1 -1
- package/dist/components/Web/footer/Footer.js +1 -1
- package/dist/components/Web/footer/FooterProps.d.ts +1 -1
- package/dist/components/Web/tabs/HorizontalTab.d.ts +1 -1
- package/dist/components/Web/tabs/HorizontalTab.js +3 -3
- package/dist/components/Web/web-section/WebSection.js +10 -2
- package/dist/components/label/Label.js +2 -2
- package/dist/index.d.ts +62 -62
- package/dist/index.js +54 -54
- package/dist/server/grid-endpoint.js +11 -11
- package/dist/utils/generalHelperFunction.js +1 -1
- package/package.json +84 -84
- package/dist/components/Web/ScheduleDetail/ScheduleDetail.d.ts +0 -28
- package/dist/components/Web/ScheduleDetail/ScheduleDetail.js +0 -18
- package/dist/components/Web/event-card/EventCard.d.ts +0 -30
- package/dist/components/Web/event-card/EventCard.js +0 -18
- package/dist/components/Web/event-card-horizontal/EventCardHorizontal.d.ts +0 -30
- package/dist/components/Web/event-card-horizontal/EventCardHorizontal.js +0 -24
|
@@ -2,7 +2,7 @@ import { useContext, useCallback } from 'react';
|
|
|
2
2
|
import { updateCurrentUser } from '../service/AuthService';
|
|
3
3
|
const createUseCurrentUserUpdateHook = (AuthContext) => {
|
|
4
4
|
return () => {
|
|
5
|
-
const { axiosInstance, config, addLoading, removeLoading, setCurrentUser } = useContext(AuthContext);
|
|
5
|
+
const { axiosInstance, config, addLoading, removeLoading, setCurrentUser, } = useContext(AuthContext);
|
|
6
6
|
const loading = useContext(AuthContext).loading;
|
|
7
7
|
const isLoading = loading.includes('UPDATE_CURRENT_USER');
|
|
8
8
|
const updateCallback = useCallback(async (data) => {
|
|
@@ -2,7 +2,7 @@ import { useContext, useCallback } from 'react';
|
|
|
2
2
|
import { updateCurrentUserPassword } from '../service/AuthService';
|
|
3
3
|
const createUseCurrentUserUpdatePasswordHook = (AuthContext) => {
|
|
4
4
|
return () => {
|
|
5
|
-
const { axiosInstance, config, addLoading, removeLoading, setAccessToken, setCurrentUser } = useContext(AuthContext);
|
|
5
|
+
const { axiosInstance, config, addLoading, removeLoading, setAccessToken, setCurrentUser, } = useContext(AuthContext);
|
|
6
6
|
const loading = useContext(AuthContext).loading;
|
|
7
7
|
const isLoading = loading.includes('UPDATE_CURRENT_USER_PASSWORD');
|
|
8
8
|
const updatePasswordCallback = useCallback(async (data) => {
|
|
@@ -21,7 +21,14 @@ const createUseCurrentUserUpdatePasswordHook = (AuthContext) => {
|
|
|
21
21
|
finally {
|
|
22
22
|
removeLoading('UPDATE_CURRENT_USER_PASSWORD');
|
|
23
23
|
}
|
|
24
|
-
}, [
|
|
24
|
+
}, [
|
|
25
|
+
axiosInstance,
|
|
26
|
+
config,
|
|
27
|
+
addLoading,
|
|
28
|
+
removeLoading,
|
|
29
|
+
setAccessToken,
|
|
30
|
+
setCurrentUser,
|
|
31
|
+
]);
|
|
25
32
|
return {
|
|
26
33
|
updateCurrentUserPassword: updatePasswordCallback,
|
|
27
34
|
isLoading,
|
|
@@ -2,7 +2,7 @@ import { useContext, useCallback } from 'react';
|
|
|
2
2
|
import { resetPassword } from '../service/AuthService';
|
|
3
3
|
const createUseResetPasswordHook = (AuthContext) => {
|
|
4
4
|
return () => {
|
|
5
|
-
const { axiosInstance, config, setAccessToken, setCurrentUser, addLoading, removeLoading } = useContext(AuthContext);
|
|
5
|
+
const { axiosInstance, config, setAccessToken, setCurrentUser, addLoading, removeLoading, } = useContext(AuthContext);
|
|
6
6
|
const loading = useContext(AuthContext).loading;
|
|
7
7
|
const isLoading = loading.includes('RESET_PASSWORD');
|
|
8
8
|
const resetPasswordCallback = useCallback(async (data) => {
|
|
@@ -19,7 +19,14 @@ const createUseResetPasswordHook = (AuthContext) => {
|
|
|
19
19
|
finally {
|
|
20
20
|
removeLoading('RESET_PASSWORD');
|
|
21
21
|
}
|
|
22
|
-
}, [
|
|
22
|
+
}, [
|
|
23
|
+
axiosInstance,
|
|
24
|
+
config,
|
|
25
|
+
setAccessToken,
|
|
26
|
+
setCurrentUser,
|
|
27
|
+
addLoading,
|
|
28
|
+
removeLoading,
|
|
29
|
+
]);
|
|
23
30
|
return {
|
|
24
31
|
resetPassword: resetPasswordCallback,
|
|
25
32
|
isLoading,
|
|
@@ -3,7 +3,7 @@ import { useContext, useCallback } from 'react';
|
|
|
3
3
|
import { signIn } from '../service/AuthService';
|
|
4
4
|
const createUseSignInHook = (AuthContext) => {
|
|
5
5
|
return () => {
|
|
6
|
-
const { axiosInstance, config, setAccessToken, setCurrentUser, addLoading, removeLoading } = useContext(AuthContext);
|
|
6
|
+
const { axiosInstance, config, setAccessToken, setCurrentUser, addLoading, removeLoading, } = useContext(AuthContext);
|
|
7
7
|
const loading = useContext(AuthContext).loading;
|
|
8
8
|
const isLoading = loading.includes('SIGN_IN');
|
|
9
9
|
const signInCallback = useCallback(async (data, customApiUrl) => {
|
|
@@ -20,7 +20,14 @@ const createUseSignInHook = (AuthContext) => {
|
|
|
20
20
|
finally {
|
|
21
21
|
removeLoading('SIGN_IN');
|
|
22
22
|
}
|
|
23
|
-
}, [
|
|
23
|
+
}, [
|
|
24
|
+
axiosInstance,
|
|
25
|
+
config,
|
|
26
|
+
setAccessToken,
|
|
27
|
+
setCurrentUser,
|
|
28
|
+
addLoading,
|
|
29
|
+
removeLoading,
|
|
30
|
+
]);
|
|
24
31
|
return {
|
|
25
32
|
signIn: signInCallback,
|
|
26
33
|
isLoading,
|
|
@@ -20,7 +20,14 @@ const createUseSignOutHook = (AuthContext) => {
|
|
|
20
20
|
finally {
|
|
21
21
|
removeLoading('SIGN_OUT');
|
|
22
22
|
}
|
|
23
|
-
}, [
|
|
23
|
+
}, [
|
|
24
|
+
axiosInstance,
|
|
25
|
+
config,
|
|
26
|
+
destroyAccessToken,
|
|
27
|
+
setCurrentUser,
|
|
28
|
+
addLoading,
|
|
29
|
+
removeLoading,
|
|
30
|
+
]);
|
|
24
31
|
return {
|
|
25
32
|
signOut: signOutCallback,
|
|
26
33
|
isLoading,
|
|
@@ -3,7 +3,7 @@ import { useContext, useCallback } from 'react';
|
|
|
3
3
|
import { signUp } from '../service/AuthService';
|
|
4
4
|
const createUseSignUpHook = (AuthContext) => {
|
|
5
5
|
return () => {
|
|
6
|
-
const { axiosInstance, config, setAccessToken, setCurrentUser, addLoading, removeLoading } = useContext(AuthContext);
|
|
6
|
+
const { axiosInstance, config, setAccessToken, setCurrentUser, addLoading, removeLoading, } = useContext(AuthContext);
|
|
7
7
|
const loading = useContext(AuthContext).loading;
|
|
8
8
|
const isLoading = loading.includes('SIGN_UP');
|
|
9
9
|
const signUpCallback = useCallback(async (data) => {
|
|
@@ -20,7 +20,14 @@ const createUseSignUpHook = (AuthContext) => {
|
|
|
20
20
|
finally {
|
|
21
21
|
removeLoading('SIGN_UP');
|
|
22
22
|
}
|
|
23
|
-
}, [
|
|
23
|
+
}, [
|
|
24
|
+
axiosInstance,
|
|
25
|
+
config,
|
|
26
|
+
setAccessToken,
|
|
27
|
+
setCurrentUser,
|
|
28
|
+
addLoading,
|
|
29
|
+
removeLoading,
|
|
30
|
+
]);
|
|
24
31
|
return {
|
|
25
32
|
signUp: signUpCallback,
|
|
26
33
|
isLoading,
|
|
@@ -34,11 +34,18 @@ const createAuthContextProvider = (AuthContext) => {
|
|
|
34
34
|
addLoading,
|
|
35
35
|
removeLoading,
|
|
36
36
|
destroyAccessToken,
|
|
37
|
-
}), [
|
|
37
|
+
}), [
|
|
38
|
+
accessToken,
|
|
39
|
+
currentUser,
|
|
40
|
+
loading,
|
|
41
|
+
isLogged,
|
|
42
|
+
isReady,
|
|
43
|
+
axiosInstance,
|
|
44
|
+
]);
|
|
38
45
|
useEffect(() => {
|
|
39
46
|
setIsReady(true);
|
|
40
47
|
}, []);
|
|
41
|
-
return _jsx(AuthContext.Provider, { value: authContextValue, children: children });
|
|
48
|
+
return (_jsx(AuthContext.Provider, { value: authContextValue, children: children }));
|
|
42
49
|
};
|
|
43
50
|
Provider.displayName = 'AuthContextProvider';
|
|
44
51
|
return Provider;
|
|
@@ -49,7 +49,8 @@ export const getCurrentUser = async (axios, config) => {
|
|
|
49
49
|
return responseData;
|
|
50
50
|
};
|
|
51
51
|
export const updateCurrentUser = async (axios, config, requestData) => {
|
|
52
|
-
const requestType = config.currentUserUpdateRouteRequestDataType ||
|
|
52
|
+
const requestType = config.currentUserUpdateRouteRequestDataType ||
|
|
53
|
+
config.defaultRequestType;
|
|
53
54
|
const data = requestType === 'json' ? requestData : createFormData(requestData);
|
|
54
55
|
const response = await axios.post(config.currentUserUpdateRoute, data);
|
|
55
56
|
const responseData = config.getDataFromRequest(response.data);
|
|
@@ -60,7 +61,8 @@ export const updateCurrentUser = async (axios, config, requestData) => {
|
|
|
60
61
|
};
|
|
61
62
|
};
|
|
62
63
|
export const updateCurrentUserPassword = async (axios, config, requestData) => {
|
|
63
|
-
const requestType = config.currentUserChangePasswordRouteRequestDataType ||
|
|
64
|
+
const requestType = config.currentUserChangePasswordRouteRequestDataType ||
|
|
65
|
+
config.defaultRequestType;
|
|
64
66
|
const data = requestType === 'json' ? requestData : createFormData(requestData);
|
|
65
67
|
const response = await axios.post(config.currentUserChangePasswordRoute, data);
|
|
66
68
|
const responseData = config.getDataFromRequest(response.data);
|
|
@@ -90,7 +92,8 @@ function createFormData(data) {
|
|
|
90
92
|
if (data.hasOwnProperty(key)) {
|
|
91
93
|
// Pokud je hodnota null nebo undefined, nepřidávej ji do FormData
|
|
92
94
|
if (data[key] !== null && data[key] !== undefined) {
|
|
93
|
-
if (typeof data[key] === 'object' &&
|
|
95
|
+
if (typeof data[key] === 'object' &&
|
|
96
|
+
!(data[key] instanceof File)) {
|
|
94
97
|
formData.append(key, JSON.stringify(data[key]));
|
|
95
98
|
}
|
|
96
99
|
else {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
const Badge = ({ children, onClick, color =
|
|
3
|
+
const Badge = ({ children, onClick, color = 'bg-blue-100 text-blue-800', className = '', labelClassName = '', rightIcon, }) => (_jsxs("span", { className: `inline-flex items-center rounded px-2.5 py-0.5 text-xs font-medium ${color} ${className}`, onClick: onClick, children: [_jsx("span", { className: labelClassName, children: children }), rightIcon && _jsx("span", { className: "ml-1", children: rightIcon })] }));
|
|
4
4
|
export default Badge;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ReactNode } from
|
|
2
|
-
import { BlogItem } from
|
|
3
|
-
type ContentType =
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { BlogItem } from '@q2devel/q2-core';
|
|
3
|
+
type ContentType = 'text' | 'l-text-r-image' | 'r-text-l-image' | 'image' | 'video' | 'table' | 'carousel';
|
|
4
4
|
interface BlogBuilderProps {
|
|
5
5
|
/** The blog post to render. Can be null/undefined safely. */
|
|
6
6
|
post?: BlogItem | null;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { ImageParagraph } from
|
|
3
|
-
import { TextAndMediaParagraph } from
|
|
4
|
-
import { TextParagraph } from
|
|
5
|
-
import Heading from
|
|
6
|
-
import { VideoParagraph } from
|
|
7
|
-
import { CarouselParagraph } from
|
|
8
|
-
import { formatDate } from
|
|
9
|
-
const SkeletonLine = ({ className =
|
|
10
|
-
export const BlogBuilder = ({ post, contentType =
|
|
2
|
+
import { ImageParagraph } from './image-paragraph/ImageParagraph';
|
|
3
|
+
import { TextAndMediaParagraph } from './text-and-media-paragraph/TextAndMediaParagraph';
|
|
4
|
+
import { TextParagraph } from './text-paragraph/TextParagraph';
|
|
5
|
+
import Heading from '../heading/Heading';
|
|
6
|
+
import { VideoParagraph } from './video-paragraph/VideoParagraph';
|
|
7
|
+
import { CarouselParagraph } from './carousel-paragraph/CarouselParagraph';
|
|
8
|
+
import { formatDate } from '../../../utils/generalHelperFunction';
|
|
9
|
+
const SkeletonLine = ({ className = '' }) => (_jsx("div", { className: `animate-pulse rounded bg-gray-200 ${className}` }));
|
|
10
|
+
export const BlogBuilder = ({ post, contentType = 'l-text-r-image', createdText = 'Publikováno:', textClassName = '', tags: propTags, tagUrls, skeleton = false, emptyState = null, hideMetaIfEmpty = true, }) => {
|
|
11
11
|
// Normalize fields so the component never explodes if post is missing/partial.
|
|
12
|
-
const title = post?.title ??
|
|
13
|
-
const body = post?.body ??
|
|
14
|
-
const imageUrl = post?.field_image_url ??
|
|
12
|
+
const title = post?.title ?? '';
|
|
13
|
+
const body = post?.body ?? '';
|
|
14
|
+
const imageUrl = post?.field_image_url ?? '';
|
|
15
15
|
const videoLink = post?.field_video_link;
|
|
16
16
|
const created = post?.created;
|
|
17
17
|
const carouselItems = Array.isArray(post?.field_carousel_items)
|
|
@@ -34,9 +34,9 @@ export const BlogBuilder = ({ post, contentType = "l-text-r-image", createdText
|
|
|
34
34
|
if (!post)
|
|
35
35
|
return null;
|
|
36
36
|
switch (contentType) {
|
|
37
|
-
case
|
|
38
|
-
return _jsx(TextParagraph, { content: { text: body } }, "text-content");
|
|
39
|
-
case
|
|
37
|
+
case 'text':
|
|
38
|
+
return (_jsx(TextParagraph, { content: { text: body } }, "text-content"));
|
|
39
|
+
case 'l-text-r-image':
|
|
40
40
|
return (_jsx(TextAndMediaParagraph, { content: {
|
|
41
41
|
text: body,
|
|
42
42
|
image: imageUrl,
|
|
@@ -44,7 +44,7 @@ export const BlogBuilder = ({ post, contentType = "l-text-r-image", createdText
|
|
|
44
44
|
videoLink,
|
|
45
45
|
videoTitle: title,
|
|
46
46
|
}, mediaPosition: "right", textClassName: textClassName }, "text-image-content"));
|
|
47
|
-
case
|
|
47
|
+
case 'r-text-l-image':
|
|
48
48
|
return (_jsx(TextAndMediaParagraph, { content: {
|
|
49
49
|
text: body,
|
|
50
50
|
image: imageUrl,
|
|
@@ -52,15 +52,15 @@ export const BlogBuilder = ({ post, contentType = "l-text-r-image", createdText
|
|
|
52
52
|
videoLink,
|
|
53
53
|
videoTitle: title,
|
|
54
54
|
}, mediaPosition: "left", textClassName: textClassName }, "text-image-content"));
|
|
55
|
-
case
|
|
55
|
+
case 'image':
|
|
56
56
|
if (!imageUrl)
|
|
57
57
|
return null;
|
|
58
58
|
return (_jsx(ImageParagraph, { content: { src: imageUrl, alt: title } }, "image-content"));
|
|
59
|
-
case
|
|
59
|
+
case 'video':
|
|
60
60
|
return (_jsx(VideoParagraph, { content: { videoLink, title }, textClassName: textClassName }, "video-content"));
|
|
61
|
-
case
|
|
61
|
+
case 'carousel':
|
|
62
62
|
return (_jsx(CarouselParagraph, { bannerItems: carouselItems }, "carousel-content"));
|
|
63
|
-
case
|
|
63
|
+
case 'table':
|
|
64
64
|
return (_jsx("div", { children: "Table Component (bude implementov\u00E1no)" }, "table-content"));
|
|
65
65
|
default:
|
|
66
66
|
return (_jsxs("div", { children: ["Nezn\u00E1m\u00FD typ obsahu: ", contentType] }, "unknown-content"));
|
|
@@ -72,9 +72,9 @@ export const BlogBuilder = ({ post, contentType = "l-text-r-image", createdText
|
|
|
72
72
|
}
|
|
73
73
|
if (tags.length === 0)
|
|
74
74
|
return null;
|
|
75
|
-
const baseClass =
|
|
76
|
-
const neutralClass =
|
|
77
|
-
const hoverable =
|
|
75
|
+
const baseClass = 'inline-block px-3 py-1 text-sm rounded-full transition-colors';
|
|
76
|
+
const neutralClass = 'bg-gray-100 text-gray-700';
|
|
77
|
+
const hoverable = 'hover:bg-gray-200 cursor-pointer';
|
|
78
78
|
return (_jsx("div", { className: "flex flex-wrap items-center gap-2", children: tags.map((tag, idx) => {
|
|
79
79
|
const href = tagUrls?.[tag];
|
|
80
80
|
return href ? (_jsx("a", { href: href, className: `${baseClass} ${neutralClass} ${hoverable}`, "aria-label": `Zobrazit články s tagem ${tag}`, children: tag }, `${tag}-${idx}`)) : (_jsx("span", { className: `${baseClass} ${neutralClass}`, children: tag }, `${tag}-${idx}`));
|
package/dist/components/Base/blog-builder/text-and-media-paragraph/TextAndMediaParagraph.d.ts
CHANGED
|
@@ -9,5 +9,5 @@ type TextAndMediaParagraphProps = {
|
|
|
9
9
|
mediaPosition: 'left' | 'right';
|
|
10
10
|
textClassName?: string;
|
|
11
11
|
};
|
|
12
|
-
export declare const TextAndMediaParagraph: ({ content, mediaPosition, textClassName }: TextAndMediaParagraphProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare const TextAndMediaParagraph: ({ content, mediaPosition, textClassName, }: TextAndMediaParagraphProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
export {};
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import HTMLReactParser from 'html-react-parser/lib/index';
|
|
3
3
|
import { getYoutubeEmbedUrl } from '../../../../utils/Helper';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
|
-
export const TextAndMediaParagraph = ({ content, mediaPosition, textClassName = 'mt-8' }) => {
|
|
5
|
+
export const TextAndMediaParagraph = ({ content, mediaPosition, textClassName = 'mt-8', }) => {
|
|
6
6
|
const hasVideo = content.videoLink && content.videoLink.trim() !== '';
|
|
7
7
|
const hasImage = content.image && content.image.trim() !== '';
|
|
8
8
|
const renderMedia = () => {
|
|
@@ -5,5 +5,5 @@ type VideoParagraphProps = {
|
|
|
5
5
|
};
|
|
6
6
|
textClassName?: string;
|
|
7
7
|
};
|
|
8
|
-
export declare const VideoParagraph: ({ content, textClassName }: VideoParagraphProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const VideoParagraph: ({ content, textClassName, }: VideoParagraphProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { getYoutubeEmbedUrl } from '../../../../utils/Helper';
|
|
3
|
-
export const VideoParagraph = ({ content, textClassName }) => {
|
|
3
|
+
export const VideoParagraph = ({ content, textClassName, }) => {
|
|
4
4
|
return (_jsx("div", { className: "mx-auto max-w-3xl", children: _jsx("div", { className: "w-full max-w-2xl aspect-video mx-auto", children: _jsx("iframe", { className: "w-full h-full", src: getYoutubeEmbedUrl(content.videoLink ?? ''), title: content.title ?? 'YouTube video player', allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share", referrerPolicy: "strict-origin-when-cross-origin", allowFullScreen: true }) }) }));
|
|
5
5
|
};
|
|
@@ -5,5 +5,5 @@ interface HeadingProps {
|
|
|
5
5
|
className?: string;
|
|
6
6
|
id?: string;
|
|
7
7
|
}
|
|
8
|
-
declare const Heading: ({ level, children, className, id
|
|
8
|
+
declare const Heading: ({ level, children, className, id }: HeadingProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
export default Heading;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { buildClassesByJoining } from '../../../utils/StyleHelper';
|
|
4
|
-
const Heading = ({ level = 1, children, className = '', id
|
|
4
|
+
const Heading = ({ level = 1, children, className = '', id }) => {
|
|
5
5
|
const Tag = `h${level}`;
|
|
6
6
|
const baseStyles = {
|
|
7
7
|
1: 'text-4xl font-bold mt-12 mb-8 text-gray-900',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Dialog, DialogBackdrop, DialogPanel } from '@headlessui/react';
|
|
4
|
-
import { ChevronLeftIcon, ChevronRightIcon, XMarkIcon } from '@heroicons/react/24/outline';
|
|
4
|
+
import { ChevronLeftIcon, ChevronRightIcon, XMarkIcon, } from '@heroicons/react/24/outline';
|
|
5
5
|
import { useEffect, useState } from 'react';
|
|
6
6
|
export const ImageGalleryModal = ({ images, isOpen, initialIndex = 0, onClose, onImageChange, }) => {
|
|
7
7
|
const [currentImageIndex, setCurrentImageIndex] = useState(initialIndex);
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Dialog, DialogBackdrop, DialogPanel, DialogTitle } from '@headlessui/react';
|
|
3
|
+
import { Dialog, DialogBackdrop, DialogPanel, DialogTitle, } from '@headlessui/react';
|
|
4
4
|
import { CheckIcon, XMarkIcon } from '@heroicons/react/24/outline';
|
|
5
5
|
import { buildClassesByJoining } from '../../../utils/StyleHelper';
|
|
6
6
|
export const Modal = ({ title, description, descriptionClassName, buttonText, showIcon = true, icon = _jsx(CheckIcon, { "aria-hidden": "true", className: "size-6" }), iconBackgroundColor = 'bg-green-100', iconColor = 'text-green-600', buttonClassName, secondButtonText, secondButtonClassName, onSecondButtonClick, showSecondButton = false, panelClassName, backdropClassName, onClose, isOpen, showCloseButton = false, closeButtonClassName, className, }) => {
|
|
7
7
|
const handleClose = (value) => {
|
|
8
8
|
onClose?.();
|
|
9
9
|
};
|
|
10
|
-
return (_jsxs(Dialog, { open: isOpen, onClose: handleClose, className: buildClassesByJoining('relative z-10', className), children: [_jsx(DialogBackdrop, { transition: true, className: buildClassesByJoining('fixed inset-0 bg-gray-500/75 transition-opacity data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in', backdropClassName) }), _jsx("div", { className: "fixed inset-0 z-10 w-screen overflow-y-auto", children: _jsx("div", { className: "flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0", children: _jsxs(DialogPanel, { transition: true, className: buildClassesByJoining('relative transform overflow-hidden rounded-lg bg-white px-4 pt-5 pb-4 text-left shadow-xl transition-all data-closed:translate-y-4 data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in sm:my-8 sm:w-full sm:max-w-sm sm:p-6 data-closed:sm:translate-y-0 data-closed:sm:scale-95', panelClassName), children: [showCloseButton && (_jsxs("button", { type: "button", className: buildClassesByJoining('absolute top-4 right-4 text-gray-400 hover:text-gray-500 focus:outline-none', closeButtonClassName), onClick: () => onClose?.(), children: [_jsx("span", { className: "sr-only", children: "Close" }), _jsx(XMarkIcon, { className: "h-6 w-6", "aria-hidden": "true" })] })), _jsxs("div", { children: [showIcon && (_jsx("div", { className: buildClassesByJoining('mx-auto flex size-12 items-center justify-center rounded-full', iconBackgroundColor), children: _jsx("div", { className: iconColor, children: icon }) })), _jsxs("div", { className: "mt-3 text-center sm:mt-5", children: [title && (_jsx(DialogTitle, { as: "h3", className: "text-base font-semibold text-gray-900", children: title })), _jsx("div", { className: buildClassesByJoining('mt-2', descriptionClassName), children: description })] })] }), (buttonText ||
|
|
10
|
+
return (_jsxs(Dialog, { open: isOpen, onClose: handleClose, className: buildClassesByJoining('relative z-10', className), children: [_jsx(DialogBackdrop, { transition: true, className: buildClassesByJoining('fixed inset-0 bg-gray-500/75 transition-opacity data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in', backdropClassName) }), _jsx("div", { className: "fixed inset-0 z-10 w-screen overflow-y-auto", children: _jsx("div", { className: "flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0", children: _jsxs(DialogPanel, { transition: true, className: buildClassesByJoining('relative transform overflow-hidden rounded-lg bg-white px-4 pt-5 pb-4 text-left shadow-xl transition-all data-closed:translate-y-4 data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in sm:my-8 sm:w-full sm:max-w-sm sm:p-6 data-closed:sm:translate-y-0 data-closed:sm:scale-95', panelClassName), children: [showCloseButton && (_jsxs("button", { type: "button", className: buildClassesByJoining('absolute top-4 right-4 text-gray-400 hover:text-gray-500 focus:outline-none', closeButtonClassName), onClick: () => onClose?.(), children: [_jsx("span", { className: "sr-only", children: "Close" }), _jsx(XMarkIcon, { className: "h-6 w-6", "aria-hidden": "true" })] })), _jsxs("div", { children: [showIcon && (_jsx("div", { className: buildClassesByJoining('mx-auto flex size-12 items-center justify-center rounded-full', iconBackgroundColor), children: _jsx("div", { className: iconColor, children: icon }) })), _jsxs("div", { className: "mt-3 text-center sm:mt-5", children: [title && (_jsx(DialogTitle, { as: "h3", className: "text-base font-semibold text-gray-900", children: title })), _jsx("div", { className: buildClassesByJoining('mt-2', descriptionClassName), children: description })] })] }), (buttonText ||
|
|
11
|
+
(showSecondButton && secondButtonText)) && (_jsxs("div", { className: "mt-5 sm:mt-6 space-y-3", children: [buttonText && (_jsx("button", { type: "button", onClick: () => onClose?.(), className: buildClassesByJoining('inline-flex w-full justify-center rounded-md bg-green-600 px-3 py-2 text-sm font-semibold text-white shadow-xs hover:bg-green-500 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-green-600', buttonClassName), children: buttonText })), showSecondButton && secondButtonText && (_jsx("button", { type: "button", onClick: () => onSecondButtonClick?.(), className: buildClassesByJoining('inline-flex w-full justify-center rounded-md bg-green-600 px-3 py-2 text-sm font-semibold text-white shadow-xs hover:bg-green-500 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-green-600', secondButtonClassName), children: secondButtonText }))] }))] }) }) })] }));
|
|
11
12
|
};
|
|
12
13
|
export default Modal;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { formatPrice } from '../../../utils/generalHelperFunction';
|
|
2
|
+
import { formatPrice, } from '../../../utils/generalHelperFunction';
|
|
3
3
|
export const Price = ({ value, locale = 'cs', options, className = '', quantUnit, quantUnitClassName = 'font-bold text-black', containerClassName = 'flex items-baseline gap-1', }) => {
|
|
4
4
|
const { number, currency, position } = formatPrice(value, locale, options);
|
|
5
|
-
return (_jsxs("span", { className: containerClassName, children: [position === 'before' && (_jsx("span", { className: options?.currencyClassName, children: currency })), _jsx("span", { className: `${className} ${options?.numberClassName || ''}`, children: number }), position === 'after' && (_jsxs("span", { className: options?.currencyClassName, children: [" ", currency] })), quantUnit && _jsx("span", { className: quantUnitClassName, children: quantUnit })] }));
|
|
5
|
+
return (_jsxs("span", { className: containerClassName, children: [position === 'before' && (_jsx("span", { className: options?.currencyClassName, children: currency })), _jsx("span", { className: `${className} ${options?.numberClassName || ''}`, children: number }), position === 'after' && (_jsxs("span", { className: options?.currencyClassName, children: [" ", currency] })), quantUnit && (_jsx("span", { className: quantUnitClassName, children: quantUnit }))] }));
|
|
6
6
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from 'react';
|
|
2
2
|
export interface SelectProps {
|
|
3
3
|
label?: string;
|
|
4
4
|
onClick?: (data: {
|
|
@@ -6,7 +6,7 @@ export interface SelectProps {
|
|
|
6
6
|
event: any;
|
|
7
7
|
}) => void;
|
|
8
8
|
disabled?: boolean;
|
|
9
|
-
rounded?:
|
|
9
|
+
rounded?: 'none' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
10
10
|
className?: string;
|
|
11
11
|
unstyled?: boolean;
|
|
12
12
|
isToggled?: boolean;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useState, useEffect } from
|
|
4
|
-
import buildClassesByJoining from
|
|
3
|
+
import { useState, useEffect } from 'react';
|
|
4
|
+
import buildClassesByJoining from '../../../utils/StyleHelper';
|
|
5
5
|
const roundedClasses = {
|
|
6
|
-
none:
|
|
7
|
-
sm:
|
|
8
|
-
md:
|
|
9
|
-
lg:
|
|
10
|
-
xl:
|
|
11
|
-
full:
|
|
6
|
+
none: 'rounded-none',
|
|
7
|
+
sm: 'rounded-sm',
|
|
8
|
+
md: 'rounded-md',
|
|
9
|
+
lg: 'rounded-lg',
|
|
10
|
+
xl: 'rounded-xl',
|
|
11
|
+
full: 'rounded-full',
|
|
12
12
|
};
|
|
13
13
|
const variantClasses = {
|
|
14
|
-
primary:
|
|
15
|
-
smoothOnly:
|
|
14
|
+
primary: 'text-white transform transition-transform duration-200 hover:scale-105',
|
|
15
|
+
smoothOnly: 'transition-all duration-200 ease-in-out',
|
|
16
16
|
};
|
|
17
|
-
const Select = ({ label, onClick, disabled = false, rounded =
|
|
18
|
-
const isControlled = typeof isToggled ===
|
|
17
|
+
const Select = ({ label, onClick, disabled = false, rounded = 'md', className = '', unstyled = false, isToggled, scaleOnHover = false, smoothSelect = false, }) => {
|
|
18
|
+
const isControlled = typeof isToggled === 'boolean';
|
|
19
19
|
const [internalToggled, setInternalToggled] = useState(isToggled ?? false);
|
|
20
20
|
useEffect(() => {
|
|
21
21
|
if (isControlled) {
|
|
@@ -34,12 +34,14 @@ const Select = ({ label, onClick, disabled = false, rounded = "md", className =
|
|
|
34
34
|
};
|
|
35
35
|
const baseClasses = unstyled
|
|
36
36
|
? className
|
|
37
|
-
: buildClassesByJoining(
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
: buildClassesByJoining('inline-block px-4 py-2 font-medium transition-colors duration-200', scaleOnHover &&
|
|
38
|
+
smoothSelect &&
|
|
39
|
+
`${variantClasses.primary} ${variantClasses.smoothOnly}`, scaleOnHover && !smoothSelect && variantClasses.primary, !scaleOnHover && smoothSelect && variantClasses.smoothOnly, roundedClasses[rounded], {
|
|
40
|
+
'opacity-50 cursor-not-allowed pointer-events-none': disabled,
|
|
41
|
+
'cursor-pointer': !disabled,
|
|
40
42
|
}, toggled
|
|
41
|
-
?
|
|
42
|
-
:
|
|
43
|
+
? 'brightness-110 ring-2 ring-white'
|
|
44
|
+
: 'brightness-80 text-white', className);
|
|
43
45
|
return (_jsx("button", { className: baseClasses, onClick: handleToggleClick, disabled: disabled, children: label }));
|
|
44
46
|
};
|
|
45
47
|
export default Select;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { FC } from
|
|
2
|
-
type SpinnerSize =
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
type SpinnerSize = 'sm' | 'md' | 'lg' | number;
|
|
3
3
|
export interface SpinnerProps {
|
|
4
4
|
size?: SpinnerSize;
|
|
5
5
|
color?: string;
|
|
6
6
|
className?: string;
|
|
7
|
-
|
|
7
|
+
'aria-label'?: string;
|
|
8
8
|
}
|
|
9
9
|
export declare const Spinner: FC<SpinnerProps>;
|
|
10
10
|
export default Spinner;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import clsx from
|
|
2
|
+
import clsx from 'clsx';
|
|
3
3
|
const sizeMap = {
|
|
4
|
-
sm:
|
|
5
|
-
md:
|
|
6
|
-
lg:
|
|
4
|
+
sm: 'h-4 w-4',
|
|
5
|
+
md: 'h-6 w-6',
|
|
6
|
+
lg: 'h-10 w-10',
|
|
7
7
|
};
|
|
8
|
-
export const Spinner = ({ size =
|
|
9
|
-
const dimensionClass = typeof size ===
|
|
10
|
-
return (_jsxs("svg", { className: clsx(
|
|
8
|
+
export const Spinner = ({ size = 'md', color = 'text-gray-500', className, 'aria-label': ariaLabel = 'Loading...', }) => {
|
|
9
|
+
const dimensionClass = typeof size === 'number' ? `h-[${size}px] w-[${size}px]` : sizeMap[size];
|
|
10
|
+
return (_jsxs("svg", { className: clsx('animate-spin', dimensionClass, color, className), fill: "none", viewBox: "0 0 24 24", role: "status", "aria-label": ariaLabel, children: [_jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }), _jsx("path", { className: "opacity-75", fill: "currentColor", d: "m4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })] }));
|
|
11
11
|
};
|
|
12
12
|
export default Spinner;
|
|
@@ -1,33 +1,39 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useState } from
|
|
4
|
-
import { Switch } from
|
|
5
|
-
const SwitchToggle = ({ description, color =
|
|
6
|
-
bgColor =
|
|
7
|
-
ringColor =
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { Switch } from '@headlessui/react';
|
|
5
|
+
const SwitchToggle = ({ description, color = '#3b82f6', // default blue
|
|
6
|
+
bgColor = '#e5e7eb', // default gray-200
|
|
7
|
+
ringColor = '#2563eb', // default blue-600
|
|
8
8
|
selected = false, simpleToggle, shortToggle, toggleIcon, }) => {
|
|
9
9
|
const [enabled, setEnabled] = useState(selected);
|
|
10
10
|
if (simpleToggle) {
|
|
11
11
|
return (_jsxs(Switch, { checked: enabled, onChange: setEnabled, style: {
|
|
12
12
|
backgroundColor: enabled ? color : bgColor,
|
|
13
|
-
boxShadow: enabled ? `0 0 0 2px ${ringColor}` :
|
|
14
|
-
}, className: "group relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-offset-2", children: [_jsx("span", { className: "sr-only", children: description ||
|
|
15
|
-
transform: enabled
|
|
13
|
+
boxShadow: enabled ? `0 0 0 2px ${ringColor}` : 'none',
|
|
14
|
+
}, className: "group relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-offset-2", children: [_jsx("span", { className: "sr-only", children: description || 'Use setting' }), _jsx("span", { "aria-hidden": "true", className: "pointer-events-none inline-block size-5 transform rounded-full bg-white shadow-sm ring-0 transition duration-200 ease-in-out", style: {
|
|
15
|
+
transform: enabled
|
|
16
|
+
? 'translateX(1.25rem)'
|
|
17
|
+
: 'translateX(0)',
|
|
16
18
|
} })] }));
|
|
17
19
|
}
|
|
18
20
|
if (shortToggle) {
|
|
19
|
-
return (_jsxs(Switch, { checked: enabled, onChange: setEnabled, className: "group relative inline-flex h-5 w-10 shrink-0 cursor-pointer items-center justify-center rounded-full focus:outline-none", children: [_jsx("span", { className: "sr-only", children: description ||
|
|
21
|
+
return (_jsxs(Switch, { checked: enabled, onChange: setEnabled, className: "group relative inline-flex h-5 w-10 shrink-0 cursor-pointer items-center justify-center rounded-full focus:outline-none", children: [_jsx("span", { className: "sr-only", children: description || 'Use setting' }), _jsx("span", { "aria-hidden": "true", className: "pointer-events-none absolute size-full rounded-md bg-white" }), _jsx("span", { "aria-hidden": "true", className: "pointer-events-none absolute mx-auto h-4 w-9 rounded-full transition-colors duration-200 ease-in-out", style: {
|
|
20
22
|
backgroundColor: enabled ? color : bgColor,
|
|
21
23
|
} }), _jsx("span", { "aria-hidden": "true", className: "pointer-events-none absolute left-0 inline-block size-5 transform rounded-full border border-gray-200 bg-white shadow-sm ring-0 transition-transform duration-200 ease-in-out", style: {
|
|
22
|
-
transform: enabled
|
|
24
|
+
transform: enabled
|
|
25
|
+
? 'translateX(1.25rem)'
|
|
26
|
+
: 'translateX(0)',
|
|
23
27
|
} })] }));
|
|
24
28
|
}
|
|
25
29
|
if (toggleIcon) {
|
|
26
30
|
return (_jsxs(Switch, { checked: enabled, onChange: setEnabled, style: {
|
|
27
31
|
backgroundColor: enabled ? color : bgColor,
|
|
28
|
-
boxShadow: enabled ? `0 0 0 2px ${ringColor}` :
|
|
29
|
-
}, className: "group relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-offset-2", children: [_jsx("span", { className: "sr-only", children: description ||
|
|
30
|
-
transform: enabled
|
|
32
|
+
boxShadow: enabled ? `0 0 0 2px ${ringColor}` : 'none',
|
|
33
|
+
}, className: "group relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-offset-2", children: [_jsx("span", { className: "sr-only", children: description || 'Use setting' }), _jsxs("span", { className: "pointer-events-none relative inline-block size-5 transform rounded-full bg-white shadow-sm ring-0 transition duration-200 ease-in-out", style: {
|
|
34
|
+
transform: enabled
|
|
35
|
+
? 'translateX(1.25rem)'
|
|
36
|
+
: 'translateX(0)',
|
|
31
37
|
}, children: [_jsx("span", { "aria-hidden": "true", className: "absolute inset-0 flex size-full items-center justify-center transition-opacity duration-200 ease-in group-data-checked:opacity-0 group-data-checked:duration-100 group-data-checked:ease-out", style: { opacity: enabled ? 0 : 1 }, children: _jsx("svg", { fill: "none", viewBox: "0 0 12 12", className: "size-3 text-gray-400", children: _jsx("path", { d: "M4 8l2-2m0 0l2-2M6 6L4 4m2 2l2 2", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" }) }) }), _jsx("span", { "aria-hidden": "true", className: "absolute inset-0 flex size-full items-center justify-center transition-opacity duration-100 ease-out group-data-checked:opacity-100 group-data-checked:duration-200 group-data-checked:ease-in", style: { opacity: enabled ? 1 : 0, color: color }, children: _jsx("svg", { fill: "currentColor", viewBox: "0 0 12 12", className: "size-3", children: _jsx("path", { d: "M3.707 5.293a1 1 0 00-1.414 1.414l1.414-1.414zM5 8l-.707.707a1 1 0 001.414 0L5 8zm4.707-3.293a1 1 0 00-1.414-1.414l1.414 1.414zm-7.414 2l2 2 1.414-1.414-2-2-1.414 1.414zm3.414 2l4-4-1.414-1.414-4 4 1.414 1.414z" }) }) })] })] }));
|
|
32
38
|
}
|
|
33
39
|
return null;
|
|
@@ -5,7 +5,7 @@ import { forwardRef, useImperativeHandle, useRef, useState, } from 'react';
|
|
|
5
5
|
const Tooltip = ({ className, children, content, placement = 'top', strategy: strategyProp = 'absolute', contentClassName, zIndex = 30, portalTarget, backgroundColor, textColor, disabled = false, disableAutoHide, lazy = true, size = 'md', variant = 'default', ...props }, ref) => {
|
|
6
6
|
const [open, setOpen] = useState(false);
|
|
7
7
|
const arrowRef = useRef(null);
|
|
8
|
-
const { x, y, refs, strategy, context, middlewareData: { arrow: { x: arrowX, y: arrowY } = {}, hide: hideMiddleware }, placement: floatingPlacement, } = useFloating({
|
|
8
|
+
const { x, y, refs, strategy, context, middlewareData: { arrow: { x: arrowX, y: arrowY } = {}, hide: hideMiddleware, }, placement: floatingPlacement, } = useFloating({
|
|
9
9
|
open: open,
|
|
10
10
|
onOpenChange: (value) => {
|
|
11
11
|
return disabled ? setOpen(false) : setOpen(disableAutoHide || value);
|
|
@@ -30,7 +30,12 @@ const Tooltip = ({ className, children, content, placement = 'top', strategy: st
|
|
|
30
30
|
const focus = useFocus(context);
|
|
31
31
|
const dismiss = useDismiss(context);
|
|
32
32
|
const role = useRole(context, { role: 'tooltip' });
|
|
33
|
-
const { getReferenceProps, getFloatingProps } = useInteractions([
|
|
33
|
+
const { getReferenceProps, getFloatingProps } = useInteractions([
|
|
34
|
+
hover,
|
|
35
|
+
focus,
|
|
36
|
+
dismiss,
|
|
37
|
+
role,
|
|
38
|
+
]);
|
|
34
39
|
useImperativeHandle(ref, () => {
|
|
35
40
|
return {
|
|
36
41
|
open() {
|
|
@@ -129,7 +134,9 @@ const Tooltip = ({ className, children, content, placement = 'top', strategy: st
|
|
|
129
134
|
...getFloatingProps(),
|
|
130
135
|
});
|
|
131
136
|
}
|
|
132
|
-
return (_jsxs("div", { className: tooltipClasses, ref: refs.setFloating, style: tooltipStyles, ...getFloatingProps(), children: [_jsx("span", { className: "relative z-10", dangerouslySetInnerHTML: typeof content === 'string'
|
|
137
|
+
return (_jsxs("div", { className: tooltipClasses, ref: refs.setFloating, style: tooltipStyles, ...getFloatingProps(), children: [_jsx("span", { className: "relative z-10", dangerouslySetInnerHTML: typeof content === 'string'
|
|
138
|
+
? { __html: content }
|
|
139
|
+
: undefined, children: typeof content !== 'string' ? content : null }), _jsx("div", { ref: arrowRef, style: {
|
|
133
140
|
position: 'absolute',
|
|
134
141
|
width: '10px',
|
|
135
142
|
height: '10px',
|