@uniformdev/csk-components 6.1.57 → 6.1.64-alpha.1
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/README.md +74 -81
- package/dist/ThemeSwitcher-EUDUX3QI.mjs +1 -0
- package/dist/accordion-item-7IKL6Z6Q.mjs +1 -0
- package/dist/accordion-item-MORC2F2Q.mjs +1 -0
- package/dist/banner-WOYK426U.mjs +1 -0
- package/dist/carousel-ALNEGOPM.mjs +1 -0
- package/dist/carousel-HKYR3ZBB.mjs +1 -0
- package/dist/chunk-27WJUZYR.mjs +1 -0
- package/dist/chunk-3JU2XCD2.mjs +1 -0
- package/dist/chunk-47YB4P2Q.mjs +1 -0
- package/dist/chunk-6CKVLOIH.mjs +1 -0
- package/dist/chunk-7GVG4HLE.mjs +1 -0
- package/dist/chunk-AOFJCDRO.mjs +1 -0
- package/dist/chunk-AWTML4I7.mjs +1 -0
- package/dist/chunk-CZ4X5ZBK.mjs +1 -0
- package/dist/chunk-D673IM2U.mjs +1 -0
- package/dist/chunk-I6SUO5WR.mjs +1 -0
- package/dist/chunk-JT77BVIX.mjs +1 -0
- package/dist/chunk-LPAOEOU4.mjs +1 -0
- package/dist/chunk-MKOFM4XK.mjs +1 -0
- package/dist/chunk-NKINOJY6.mjs +1 -0
- package/dist/chunk-OKUDTS22.mjs +1 -0
- package/dist/chunk-OL6JBPZ4.mjs +1 -0
- package/dist/chunk-OY6ZJNCE.mjs +1 -0
- package/dist/chunk-PLKWUEFW.mjs +1 -0
- package/dist/chunk-QPQGRQKI.mjs +1 -0
- package/dist/chunk-VWWXSA5H.mjs +1 -0
- package/dist/chunk-WAW7PQYM.mjs +1 -0
- package/dist/chunk-XKCRANRQ.mjs +1 -0
- package/dist/chunk-XYU3TGOU.mjs +1 -0
- package/dist/chunk-Y337A266.mjs +7 -0
- package/dist/chunk-YQYDZJ65.mjs +1 -0
- package/dist/chunk-ZAHWFLY4.mjs +1 -0
- package/dist/{chunk-V4EBWEG4.mjs → chunk-ZWDCDE5W.mjs} +1 -1
- package/dist/components/canvas/emptyPlaceholders.d.mts +5 -4
- package/dist/components/canvas/emptyPlaceholders.mjs +1 -1
- package/dist/components/canvas/index.d.mts +4 -664
- package/dist/components/canvas/index.mjs +1 -2
- package/dist/components/canvas/serverClient.d.mts +694 -0
- package/dist/components/canvas/serverClient.mjs +1 -0
- package/dist/components/canvas/serverOnly.d.mts +41 -0
- package/dist/components/canvas/serverOnly.mjs +1 -0
- package/dist/components/ui/index.d.mts +81 -54
- package/dist/components/ui/index.mjs +1 -1
- package/dist/content/components/canvas/Accordion/accordion.tsx +12 -17
- package/dist/content/components/canvas/Accordion/index.tsx +2 -2
- package/dist/content/components/canvas/AccordionItem/accordion-item.tsx +28 -39
- package/dist/content/components/canvas/AccordionItem/index.tsx +4 -6
- package/dist/content/components/canvas/Badge/badge.tsx +12 -5
- package/dist/content/components/canvas/Badge/index.tsx +2 -3
- package/dist/content/components/canvas/Badge/style-utils.ts +6 -6
- package/dist/content/components/canvas/Banner/banner.tsx +24 -36
- package/dist/content/components/canvas/Banner/index.tsx +7 -11
- package/dist/content/components/canvas/Breadcrumbs/breadcrumbs.tsx +21 -22
- package/dist/content/components/canvas/Breadcrumbs/index.tsx +4 -7
- package/dist/content/components/canvas/Button/button.tsx +19 -11
- package/dist/content/components/canvas/Button/index.tsx +4 -7
- package/dist/content/components/canvas/Card/card.tsx +10 -12
- package/dist/content/components/canvas/Card/index.tsx +3 -3
- package/dist/content/components/canvas/Carousel/carousel.tsx +10 -10
- package/dist/content/components/canvas/Carousel/index.tsx +4 -4
- package/dist/content/components/canvas/Container/container.tsx +7 -10
- package/dist/content/components/canvas/Container/index.tsx +3 -3
- package/dist/content/components/canvas/Container/parameters.ts +0 -4
- package/dist/content/components/canvas/CookieConsent/cookie-consent.tsx +126 -0
- package/dist/content/components/canvas/CookieConsent/empty-placeholder.tsx +12 -0
- package/dist/content/components/canvas/CookieConsent/index.tsx +26 -0
- package/dist/content/components/canvas/Countdown/countdown.tsx +9 -7
- package/dist/content/components/canvas/Countdown/index.tsx +2 -3
- package/dist/content/components/canvas/DemoHero/atoms.tsx +59 -35
- package/dist/content/components/canvas/DemoHero/columns-variant.tsx +5 -11
- package/dist/content/components/canvas/DemoHero/default-variant.tsx +5 -12
- package/dist/content/components/canvas/DemoHero/demo-hero.tsx +43 -22
- package/dist/content/components/canvas/DemoHero/fixed-hero.tsx +63 -65
- package/dist/content/components/canvas/DemoHero/flexible-hero.tsx +8 -2
- package/dist/content/components/canvas/DemoHero/index.tsx +6 -18
- package/dist/content/components/canvas/DemoHero/utils.ts +14 -0
- package/dist/content/components/canvas/Divider/divider.tsx +5 -2
- package/dist/content/components/canvas/Divider/index.tsx +2 -2
- package/dist/content/components/canvas/Flex/flex.tsx +11 -10
- package/dist/content/components/canvas/Flex/index.tsx +6 -6
- package/dist/content/components/canvas/FlexItem/flex-item.tsx +7 -4
- package/dist/content/components/canvas/FlexItem/index.tsx +4 -5
- package/dist/content/components/canvas/Footer/footer.tsx +9 -8
- package/dist/content/components/canvas/Footer/index.tsx +2 -3
- package/dist/content/components/canvas/Grid/grid.tsx +9 -9
- package/dist/content/components/canvas/Grid/index.tsx +5 -5
- package/dist/content/components/canvas/GridItem/grid-item.tsx +10 -8
- package/dist/content/components/canvas/GridItem/index.tsx +5 -5
- package/dist/content/components/canvas/Header/header.tsx +10 -7
- package/dist/content/components/canvas/Header/index.tsx +2 -3
- package/dist/content/components/canvas/IconLabel/icon-label.tsx +16 -8
- package/dist/content/components/canvas/IconLabel/index.tsx +4 -5
- package/dist/content/components/canvas/Image/image.tsx +25 -8
- package/dist/content/components/canvas/Image/index.tsx +2 -3
- package/dist/content/components/canvas/ImageGallery/empty-placeholder.tsx +1 -1
- package/dist/content/components/canvas/ImageGallery/gallery-inner.tsx +6 -6
- package/dist/content/components/canvas/ImageGallery/image-gallery.tsx +21 -36
- package/dist/content/components/canvas/ImageGallery/index.tsx +11 -12
- package/dist/content/components/canvas/Link/index.tsx +2 -3
- package/dist/content/components/canvas/Link/link.tsx +7 -4
- package/dist/content/components/canvas/Modal/index.tsx +2 -2
- package/dist/content/components/canvas/Modal/modal.tsx +16 -74
- package/dist/content/components/canvas/NavigationFlyout/desktop.tsx +9 -13
- package/dist/content/components/canvas/NavigationFlyout/index.tsx +21 -3
- package/dist/content/components/canvas/NavigationFlyout/mobile.tsx +10 -13
- package/dist/content/components/canvas/NavigationFlyout/{navigation-flyout.tsx → navigation-flyout-client.tsx} +26 -20
- package/dist/content/components/canvas/NavigationGroup/desktop.tsx +7 -10
- package/dist/content/components/canvas/NavigationGroup/index.tsx +20 -3
- package/dist/content/components/canvas/NavigationGroup/mobile.tsx +9 -8
- package/dist/content/components/canvas/NavigationGroup/{navigation-group.tsx → navigation-group-client.tsx} +21 -18
- package/dist/content/components/canvas/NavigationLink/index.tsx +2 -4
- package/dist/content/components/canvas/NavigationLink/navigation-link.tsx +12 -9
- package/dist/content/components/canvas/Page/index.tsx +7 -7
- package/dist/content/components/canvas/Page/page.tsx +9 -18
- package/dist/content/components/canvas/Review/default-variant.tsx +3 -5
- package/dist/content/components/canvas/Review/empty-placeholder.tsx +6 -3
- package/dist/content/components/canvas/Review/index.tsx +6 -6
- package/dist/content/components/canvas/Review/multi-column-variant.tsx +3 -5
- package/dist/content/components/canvas/Review/review.tsx +11 -11
- package/dist/content/components/canvas/RichText/index.tsx +7 -6
- package/dist/content/components/canvas/RichText/rich-text.tsx +23 -6
- package/dist/content/components/canvas/Section/columns-variant.tsx +5 -11
- package/dist/content/components/canvas/Section/default-variant.tsx +7 -16
- package/dist/content/components/canvas/Section/empty-placeholder.tsx +5 -2
- package/dist/content/components/canvas/Section/index.tsx +2 -2
- package/dist/content/components/canvas/Section/section.tsx +11 -16
- package/dist/content/components/canvas/SimpleFooter/index.tsx +16 -0
- package/dist/content/components/canvas/SimpleFooter/simple-footer.tsx +85 -0
- package/dist/content/components/canvas/SimpleHeader/index.tsx +22 -0
- package/dist/content/components/canvas/SimpleHeader/simple-header.tsx +63 -0
- package/dist/content/components/canvas/Spacer/index.tsx +2 -2
- package/dist/content/components/canvas/Spacer/spacer.tsx +5 -2
- package/dist/content/components/canvas/Tab/index.tsx +2 -3
- package/dist/content/components/canvas/Tab/tab.tsx +6 -5
- package/dist/content/components/canvas/Table/index.tsx +2 -2
- package/dist/content/components/canvas/Table/table.tsx +9 -13
- package/dist/content/components/canvas/TableCustomCell/index.tsx +2 -2
- package/dist/content/components/canvas/TableCustomCell/table-custom-cell.tsx +7 -4
- package/dist/content/components/canvas/TableDataCell/index.tsx +2 -2
- package/dist/content/components/canvas/TableDataCell/table-data-cell.tsx +7 -4
- package/dist/content/components/canvas/TableHeaderCell/index.tsx +2 -2
- package/dist/content/components/canvas/TableHeaderCell/table-header-cell.tsx +7 -4
- package/dist/content/components/canvas/TableRow/index.tsx +5 -3
- package/dist/content/components/canvas/TableRow/table-row.tsx +6 -3
- package/dist/content/components/canvas/Tabs/index.tsx +7 -7
- package/dist/content/components/canvas/Tabs/style-utils.ts +12 -11
- package/dist/content/components/canvas/Tabs/tabs.tsx +45 -48
- package/dist/content/components/canvas/Testimonial/default-variant.tsx +9 -11
- package/dist/content/components/canvas/Testimonial/index.tsx +2 -2
- package/dist/content/components/canvas/Testimonial/testimonial.tsx +11 -17
- package/dist/content/components/canvas/Testimonial/with-large-avatar-variant.tsx +9 -11
- package/dist/content/components/canvas/Testimonial/with-overlapping-image-variant.tsx +9 -11
- package/dist/content/components/canvas/Text/index.tsx +2 -3
- package/dist/content/components/canvas/Text/text.tsx +21 -15
- package/dist/content/components/canvas/ThemeSwitcher/index.tsx +2 -2
- package/dist/content/components/canvas/ThemeSwitcher/theme-switcher.tsx +6 -3
- package/dist/content/components/canvas/Video/index.tsx +2 -5
- package/dist/content/components/canvas/Video/placeholder.tsx +1 -1
- package/dist/content/components/canvas/Video/video.tsx +9 -7
- package/dist/content/components/ui/Accordion/accordion.tsx +23 -0
- package/dist/content/components/ui/Accordion/index.tsx +9 -0
- package/dist/content/components/ui/AccordionItem/accordion-item.tsx +41 -0
- package/dist/content/components/ui/AccordionItem/index.tsx +16 -0
- package/dist/content/components/ui/Banner/banner.tsx +47 -0
- package/dist/content/components/ui/Banner/index.tsx +29 -0
- package/dist/content/components/{canvas → ui}/Banner/style-utils.ts +1 -2
- package/dist/content/components/ui/Button/index.ts +2 -5
- package/dist/content/components/ui/Carousel/carousel.tsx +2 -2
- package/dist/content/components/ui/Carousel/index.ts +3 -3
- package/dist/content/components/ui/ComponentEmptyPlaceholder/component-empty-placeholder.tsx +13 -0
- package/dist/content/components/ui/ComponentEmptyPlaceholder/index.ts +6 -0
- package/dist/content/components/ui/Container/container.tsx +2 -7
- package/dist/content/components/ui/Container/index.ts +0 -6
- package/dist/content/components/ui/Flex/flex.tsx +21 -27
- package/dist/content/components/ui/Flex/index.ts +3 -5
- package/dist/content/components/ui/FlexItem/index.ts +1 -1
- package/dist/content/components/ui/Footer/index.ts +5 -4
- package/dist/content/components/ui/Grid/grid.tsx +21 -25
- package/dist/content/components/ui/Grid/index.ts +6 -15
- package/dist/content/components/ui/GridItem/grid-item.tsx +10 -1
- package/dist/content/components/ui/GridItem/index.ts +6 -9
- package/dist/content/components/ui/Header/index.ts +1 -1
- package/dist/content/components/ui/IconLabel/icon-label.tsx +2 -0
- package/dist/content/components/ui/IconLabel/index.ts +1 -0
- package/dist/content/components/ui/InlineSVG/index.ts +15 -0
- package/dist/content/components/ui/InlineSVG/inline-svg.tsx +70 -0
- package/dist/content/components/ui/InlineSVG/utils.ts +132 -0
- package/dist/content/components/ui/Modal/index.tsx +22 -0
- package/dist/content/components/ui/Modal/modal.tsx +89 -0
- package/dist/content/components/{canvas → ui}/Modal/style-utils.ts +4 -4
- package/dist/content/components/ui/Rating/index.tsx +1 -1
- package/dist/content/components/ui/Rating/rating.tsx +1 -1
- package/dist/content/components/ui/Text/index.ts +3 -6
- package/dist/content/types/cskTypes.ts +32 -9
- package/dist/content/utils/assets.ts +3 -18
- package/dist/content/utils/createComponentResolver.ts +7 -6
- package/dist/content/utils/createEmptyPlaceholderResolver.tsx +4 -8
- package/dist/content/utils/getSlotComponents.ts +15 -0
- package/dist/content/utils/routing.ts +60 -15
- package/dist/content/utils/useCookiesConsent.ts +17 -0
- package/dist/content/utils/withFlattenParameters.tsx +17 -0
- package/dist/content/utils/withSlotsDataValue.tsx +34 -0
- package/dist/cookie-consent-5QJUCW2K.mjs +1 -0
- package/dist/countdown-FRQZMVKW.mjs +1 -0
- package/dist/image-gallery-HWCMTJL3.mjs +1 -0
- package/dist/index-CrBZatTs.d.mts +18 -0
- package/dist/index-vyIO0XN2.d.mts +90 -0
- package/dist/index.mjs +3 -3
- package/dist/mobile-KBYNJEBM.mjs +1 -0
- package/dist/modal-4TVVGHWS.mjs +1 -0
- package/dist/modal-E5RMA4EO.mjs +1 -0
- package/dist/navigation-flyout-client-WUN4A34X.mjs +1 -0
- package/dist/navigation-group-client-Y72BOPIH.mjs +1 -0
- package/dist/parameters-B8w5Q6Pp.d.mts +29 -0
- package/dist/tabs-VMFTATOP.mjs +1 -0
- package/dist/theme-switcher-QTX46Z7E.mjs +1 -0
- package/dist/theme-switcher-RGY4D3KL.mjs +1 -0
- package/dist/types/cskTypes.d.mts +27 -9
- package/dist/utils/assets.d.mts +8 -17
- package/dist/utils/assets.mjs +1 -1
- package/dist/utils/createComponentResolver.d.mts +3 -9
- package/dist/utils/createComponentResolver.mjs +1 -1
- package/dist/utils/createEmptyPlaceholderResolver.d.mts +4 -2
- package/dist/utils/createEmptyPlaceholderResolver.mjs +1 -1
- package/dist/utils/getSlotComponents.d.mts +11 -0
- package/dist/utils/getSlotComponents.mjs +1 -0
- package/dist/utils/routing.d.mts +21 -8
- package/dist/utils/routing.mjs +1 -1
- package/dist/utils/sitemap.d.mts +21 -0
- package/dist/utils/sitemap.mjs +1 -0
- package/dist/utils/styling.d.mts +4 -1
- package/dist/utils/styling.mjs +1 -1
- package/dist/utils/withFlattenParameters.d.mts +10 -0
- package/dist/utils/withFlattenParameters.mjs +1 -0
- package/dist/utils/withSlotsDataValue.d.mts +12 -0
- package/dist/utils/withSlotsDataValue.mjs +1 -0
- package/dist/video-VG6ZQCKN.mjs +1 -0
- package/package.json +48 -15
- package/dist/ThemeSwitcher-6Q7LCO4Q.mjs +0 -1
- package/dist/accordion-item-G5CNMERW.mjs +0 -1
- package/dist/banner-2B4K5R4N.mjs +0 -1
- package/dist/carousel-BBEW5P4Y.mjs +0 -1
- package/dist/carousel-ERCHOWUS.mjs +0 -1
- package/dist/chunk-2SEOCBRK.mjs +0 -1
- package/dist/chunk-2UV7TQNF.mjs +0 -1
- package/dist/chunk-2YTACEBA.mjs +0 -1
- package/dist/chunk-3PDY7RJC.mjs +0 -7
- package/dist/chunk-4LWAGTFW.mjs +0 -1
- package/dist/chunk-56OQGKRM.mjs +0 -1
- package/dist/chunk-5VM2Y55L.mjs +0 -1
- package/dist/chunk-AKRWCDDG.mjs +0 -1
- package/dist/chunk-FPOIJMYT.mjs +0 -1
- package/dist/chunk-LA36HQWS.mjs +0 -1
- package/dist/chunk-M3BGP5VE.mjs +0 -1
- package/dist/chunk-MSXDLSXH.mjs +0 -1
- package/dist/chunk-QHIWJPL6.mjs +0 -1
- package/dist/chunk-RX4IAAQQ.mjs +0 -1
- package/dist/chunk-TIRCISSU.mjs +0 -1
- package/dist/chunk-TM7Q5NMH.mjs +0 -1
- package/dist/chunk-YEKQJ4YC.mjs +0 -1
- package/dist/chunk-YUCUJWBO.mjs +0 -1
- package/dist/chunk-Z7JSWSPD.mjs +0 -1
- package/dist/content/components/canvas/Banner/types.ts +0 -21
- package/dist/content/components/canvas/Image/placeholder.tsx +0 -20
- package/dist/content/components/ui/Container/utils.ts +0 -18
- package/dist/countdown-LYDXJLEE.mjs +0 -1
- package/dist/image-gallery-F6JLG7XW.mjs +0 -1
- package/dist/index-B9eeSbLG.d.mts +0 -71
- package/dist/mobile-UAUHHXPH.mjs +0 -1
- package/dist/modal-HKMQGV4B.mjs +0 -1
- package/dist/navigation-flyout-MXIJA6PC.mjs +0 -1
- package/dist/navigation-group-DEN3D2BO.mjs +0 -1
- package/dist/tabs-AQFKYC6M.mjs +0 -1
- package/dist/theme-switcher-76F2V343.mjs +0 -1
- package/dist/theme-switcher-WO5JIV2W.mjs +0 -1
- package/dist/video-RC2QHJS2.mjs +0 -1
- /package/dist/content/components/{canvas → ui}/AccordionItem/icon-arrow-down.tsx +0 -0
- /package/dist/content/components/{canvas → ui}/AccordionItem/icon-arrow-up.tsx +0 -0
- /package/dist/content/components/{canvas → ui}/Banner/close-button.tsx +0 -0
- /package/dist/content/components/{canvas → ui}/Modal/close-icon.tsx +0 -0
|
@@ -1,34 +1,24 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { LinkParamValue, CanvasClient, flattenValues } from '@uniformdev/canvas';
|
|
3
3
|
import { ProjectMapClient } from '@uniformdev/project-map';
|
|
4
4
|
import BaseButton, { ButtonVariant } from '@/components/ui/Button';
|
|
5
5
|
import BaseText from '@/components/ui/Text';
|
|
6
|
+
import { compositionCache } from '@/utils/getSlotComponents';
|
|
6
7
|
import { formatUniformLink, resolveRouteToPath } from '@/utils/routing';
|
|
7
8
|
import { cn } from '@/utils/styling';
|
|
8
|
-
import {
|
|
9
|
+
import { withFlattenParameters } from '@/utils/withFlattenParameters';
|
|
10
|
+
import { BreadcrumbLink, BreadcrumbsParameters, BreadcrumbsProps } from '.';
|
|
9
11
|
import { getSeparator } from './helpers';
|
|
10
12
|
|
|
11
|
-
export const Breadcrumbs: FC<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
size,
|
|
15
|
-
color,
|
|
16
|
-
font,
|
|
17
|
-
transform,
|
|
18
|
-
autoGenerate,
|
|
19
|
-
context,
|
|
20
|
-
}) => {
|
|
13
|
+
export const Breadcrumbs: FC<
|
|
14
|
+
BreadcrumbsProps & Omit<BreadcrumbsParameters, 'links'> & { links?: { title?: string; link?: LinkParamValue }[] }
|
|
15
|
+
> = async ({ separator, links, size, color, font, transform, autoGenerate, context }) => {
|
|
21
16
|
// Matched route is 'composition' — this means we're in the composition pattern,
|
|
22
17
|
// so we don't have access to the project map at this point.
|
|
23
|
-
const isInPattern = !context?.
|
|
18
|
+
const isInPattern = !context?.type || context?.type !== 'page';
|
|
24
19
|
|
|
25
20
|
const getManualBreadcrumbs = async (): Promise<BreadcrumbLink[]> =>
|
|
26
|
-
links?.reduce<BreadcrumbLink[]>((acc,
|
|
27
|
-
const { title, link } = flattenValues(item) as {
|
|
28
|
-
title?: string;
|
|
29
|
-
link?: LinkParamValue;
|
|
30
|
-
};
|
|
31
|
-
|
|
21
|
+
links?.filter(Boolean).reduce<BreadcrumbLink[]>((acc, { title, link }) => {
|
|
32
22
|
if (!title) return acc;
|
|
33
23
|
|
|
34
24
|
return [...acc, { title, link: formatUniformLink(link) }];
|
|
@@ -36,15 +26,19 @@ export const Breadcrumbs: FC<BreadcrumbsProps> = async ({
|
|
|
36
26
|
|
|
37
27
|
const getAutoBreadcrumbs = async (): Promise<BreadcrumbLink[]> => {
|
|
38
28
|
if (isInPattern) return [];
|
|
39
|
-
|
|
40
29
|
const client = new ProjectMapClient({
|
|
41
30
|
projectId: process.env.UNIFORM_PROJECT_ID,
|
|
42
31
|
apiKey: process.env.UNIFORM_API_KEY,
|
|
32
|
+
apiHost: process.env.UNIFORM_CLI_BASE_URL || 'https://uniform.app',
|
|
43
33
|
});
|
|
44
34
|
|
|
35
|
+
const { projectMapNodes } = compositionCache.getUniformComposition({ id: context?._id }) || {};
|
|
36
|
+
if (!projectMapNodes || !projectMapNodes[0]) return [];
|
|
37
|
+
|
|
45
38
|
const { nodes } = await client.getNodes({
|
|
46
|
-
path:
|
|
39
|
+
path: projectMapNodes[0].path,
|
|
47
40
|
includeAncestors: true,
|
|
41
|
+
depth: 0,
|
|
48
42
|
});
|
|
49
43
|
|
|
50
44
|
if (!nodes?.length) return [];
|
|
@@ -58,6 +52,8 @@ export const Breadcrumbs: FC<BreadcrumbsProps> = async ({
|
|
|
58
52
|
? await new CanvasClient({
|
|
59
53
|
projectId: process.env.UNIFORM_PROJECT_ID,
|
|
60
54
|
apiKey: process.env.UNIFORM_API_KEY,
|
|
55
|
+
apiHost: process.env.UNIFORM_CLI_BASE_URL || 'https://uniform.app',
|
|
56
|
+
edgeApiHost: process.env.UNIFORM_CLI_BASE_EDGE_URL || 'https://uniform.global',
|
|
61
57
|
})
|
|
62
58
|
.getCompositionById({ compositionId: node.compositionId })
|
|
63
59
|
.then(({ composition }) => {
|
|
@@ -68,7 +64,8 @@ export const Breadcrumbs: FC<BreadcrumbsProps> = async ({
|
|
|
68
64
|
.catch(() => node.name)
|
|
69
65
|
: node.name;
|
|
70
66
|
|
|
71
|
-
const link =
|
|
67
|
+
const link =
|
|
68
|
+
node.type === 'placeholder' ? undefined : resolveRouteToPath(node.path, context.pageState.routePath);
|
|
72
69
|
|
|
73
70
|
return { title, link };
|
|
74
71
|
})
|
|
@@ -127,3 +124,5 @@ export const Breadcrumbs: FC<BreadcrumbsProps> = async ({
|
|
|
127
124
|
</ul>
|
|
128
125
|
);
|
|
129
126
|
};
|
|
127
|
+
|
|
128
|
+
export default withFlattenParameters(Breadcrumbs);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { DataWithProperties } from '@uniformdev/canvas';
|
|
2
|
-
import { ComponentProps } from '@uniformdev/canvas-next-rsc/component';
|
|
3
2
|
import { TextParameters } from '@/components/canvas/Text/parameters';
|
|
4
|
-
import {
|
|
3
|
+
import { ComponentProps } from '@/types/cskTypes';
|
|
5
4
|
|
|
6
5
|
export type BreadcrumbLink = {
|
|
7
6
|
title: string;
|
|
@@ -13,10 +12,8 @@ export type BreadcrumbsParameters = {
|
|
|
13
12
|
separator?: 'slash' | 'chevron';
|
|
14
13
|
links?: DataWithProperties[];
|
|
15
14
|
autoGenerate?: boolean;
|
|
16
|
-
}
|
|
15
|
+
} & Pick<TextParameters, 'size' | 'color' | 'font' | 'transform'>;
|
|
17
16
|
|
|
18
|
-
export type BreadcrumbsProps = ComponentProps<
|
|
19
|
-
BreadcrumbsParameters & Pick<TextParameters, 'size' | 'color' | 'font' | 'transform'>
|
|
20
|
-
>;
|
|
17
|
+
export type BreadcrumbsProps = ComponentProps<BreadcrumbsParameters>;
|
|
21
18
|
|
|
22
|
-
export default
|
|
19
|
+
export { default } from './breadcrumbs';
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { FC, useMemo } from 'react';
|
|
2
|
-
import { UniformText } from '@uniformdev/
|
|
2
|
+
import { ComponentParameter, UniformText } from '@uniformdev/next-app-router/component';
|
|
3
3
|
import BaseButton, { ButtonProps as BaseButtonProps } from '@/components/ui/Button';
|
|
4
4
|
import BaseImage from '@/components/ui/Image';
|
|
5
|
-
import {
|
|
5
|
+
import { ReplaceFieldsWithAssets } from '@/types/cskTypes';
|
|
6
6
|
import { formatUniformLink } from '@/utils/routing';
|
|
7
|
-
import {
|
|
7
|
+
import { withFlattenParameters } from '@/utils/withFlattenParameters';
|
|
8
|
+
import { ButtonParameters, ButtonProps } from '.';
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
const Button: FC<ButtonProps & ReplaceFieldsWithAssets<ButtonParameters, 'icon'>> = ({
|
|
10
11
|
component,
|
|
11
12
|
context,
|
|
12
13
|
link,
|
|
@@ -25,13 +26,13 @@ export const Button: FC<ButtonProps> = ({
|
|
|
25
26
|
className,
|
|
26
27
|
onClick,
|
|
27
28
|
text,
|
|
29
|
+
variant,
|
|
30
|
+
parameters,
|
|
28
31
|
}) => {
|
|
29
32
|
const href = formatUniformLink(link);
|
|
30
33
|
|
|
31
|
-
const isEditorPreviewMode = context.previewMode === 'editor' && context?.isContextualEditing;
|
|
32
|
-
|
|
33
34
|
const iconParameters = useMemo(() => {
|
|
34
|
-
const [resolvedImage] =
|
|
35
|
+
const [resolvedImage] = icon || [];
|
|
35
36
|
const { url, title = '' } = resolvedImage || {};
|
|
36
37
|
if (!url) return undefined;
|
|
37
38
|
|
|
@@ -62,18 +63,18 @@ export const Button: FC<ButtonProps> = ({
|
|
|
62
63
|
|
|
63
64
|
const hasContent = !!text || !!iconParameters;
|
|
64
65
|
|
|
65
|
-
if (!hasContent && !
|
|
66
|
+
if (!hasContent && !context.isContextualEditing) return null;
|
|
66
67
|
|
|
67
68
|
return (
|
|
68
69
|
<BaseButton
|
|
69
|
-
variant={
|
|
70
|
+
variant={variant as BaseButtonProps['variant']}
|
|
70
71
|
href={href}
|
|
71
72
|
border={border}
|
|
72
73
|
size={size}
|
|
73
74
|
onClick={onClick}
|
|
74
75
|
className={className}
|
|
75
76
|
textSize={textSize}
|
|
76
|
-
isActive={context.
|
|
77
|
+
isActive={context.pageState.routePath === href}
|
|
77
78
|
textColor={textColor}
|
|
78
79
|
textFont={textFont}
|
|
79
80
|
textWeight={textWeight}
|
|
@@ -81,10 +82,17 @@ export const Button: FC<ButtonProps> = ({
|
|
|
81
82
|
buttonColor={buttonColor}
|
|
82
83
|
hoverButtonColor={hoverButtonColor}
|
|
83
84
|
hoverTextColor={hoverTextColor}
|
|
85
|
+
// eslint-disable-next-line react-hooks/static-components
|
|
84
86
|
icon={<Icon />}
|
|
85
87
|
iconPosition={iconPosition}
|
|
86
88
|
>
|
|
87
|
-
<UniformText
|
|
89
|
+
<UniformText
|
|
90
|
+
placeholder="Button text goes here"
|
|
91
|
+
parameter={parameters.text as ComponentParameter<string>}
|
|
92
|
+
component={component}
|
|
93
|
+
/>
|
|
88
94
|
</BaseButton>
|
|
89
95
|
);
|
|
90
96
|
};
|
|
97
|
+
|
|
98
|
+
export default withFlattenParameters(Button);
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import { DefaultTheme } from 'tailwindcss/types/generated/default-theme';
|
|
2
1
|
import { AssetParamValue } from '@uniformdev/assets';
|
|
3
2
|
import { LinkParamValue } from '@uniformdev/canvas';
|
|
4
|
-
import { ComponentProps } from '@uniformdev/canvas-next-rsc/component';
|
|
5
3
|
import { ButtonProps as BaseButtonProps } from '@/components/ui/Button';
|
|
6
|
-
import { ViewPort } from '@/types/cskTypes';
|
|
7
|
-
import { Button } from './button';
|
|
4
|
+
import { ComponentProps, ViewPort } from '@/types/cskTypes';
|
|
8
5
|
|
|
9
6
|
export type ButtonParameters = {
|
|
10
7
|
text?: string;
|
|
11
8
|
link?: LinkParamValue;
|
|
12
9
|
textColor?: string;
|
|
13
|
-
textWeight?:
|
|
10
|
+
textWeight?: string;
|
|
14
11
|
textFont?: 'uppercase' | 'lowercase' | 'capitalize' | 'normal-case';
|
|
15
12
|
textTransform?: string;
|
|
16
13
|
buttonColor?: string;
|
|
@@ -29,6 +26,6 @@ export type ButtonAdditionalProps = {
|
|
|
29
26
|
onClick?: () => void;
|
|
30
27
|
};
|
|
31
28
|
|
|
32
|
-
export type ButtonProps = ComponentProps<ButtonParameters & ButtonAdditionalProps
|
|
29
|
+
export type ButtonProps = ComponentProps<ButtonParameters> & ButtonAdditionalProps;
|
|
33
30
|
|
|
34
|
-
export default
|
|
31
|
+
export { default } from './button';
|
|
@@ -1,42 +1,40 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import { UniformSlot } from '@uniformdev/
|
|
2
|
+
import { UniformSlot } from '@uniformdev/next-app-router/component';
|
|
3
3
|
import Container from '@/components/ui/Container';
|
|
4
4
|
import { cn } from '@/utils/styling';
|
|
5
|
-
import {
|
|
5
|
+
import { withFlattenParameters } from '@/utils/withFlattenParameters';
|
|
6
|
+
import { CardParameters, CardProps, CardVariants } from '.';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
component,
|
|
9
|
-
context,
|
|
8
|
+
const Card: FC<CardProps & CardParameters> = ({
|
|
10
9
|
slots,
|
|
11
10
|
backgroundColor,
|
|
12
11
|
spacing,
|
|
13
12
|
border,
|
|
14
13
|
fluidContent,
|
|
15
|
-
fullHeight,
|
|
16
|
-
fitHeight,
|
|
17
14
|
height,
|
|
18
15
|
className,
|
|
19
16
|
contentClassName,
|
|
17
|
+
variant,
|
|
20
18
|
}) => {
|
|
21
|
-
const isBackgroundImageVariant =
|
|
19
|
+
const isBackgroundImageVariant = variant === CardVariants.BackgroundImage;
|
|
22
20
|
|
|
23
21
|
return (
|
|
24
22
|
<Container
|
|
25
23
|
className={cn('relative overflow-hidden', className)}
|
|
26
|
-
{...{ backgroundColor, spacing, border, fluidContent,
|
|
24
|
+
{...{ backgroundColor, spacing, border, fluidContent, height }}
|
|
27
25
|
>
|
|
28
26
|
<div
|
|
29
27
|
className={cn({
|
|
30
28
|
'inset-0 size-full absolute': isBackgroundImageVariant,
|
|
31
29
|
})}
|
|
32
30
|
>
|
|
33
|
-
<UniformSlot
|
|
31
|
+
<UniformSlot slot={slots.cardMedia} />
|
|
34
32
|
</div>
|
|
35
33
|
<div className={cn('relative flex flex-col gap-y-2', contentClassName)}>
|
|
36
|
-
<UniformSlot
|
|
34
|
+
<UniformSlot slot={slots.cardContent} />
|
|
37
35
|
</div>
|
|
38
36
|
</Container>
|
|
39
37
|
);
|
|
40
38
|
};
|
|
41
39
|
|
|
42
|
-
export default Card;
|
|
40
|
+
export default withFlattenParameters(Card);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ComponentProps } from '@uniformdev/canvas-next-rsc/component';
|
|
2
1
|
import { ContainerParameters } from '@/components/canvas/Container/parameters';
|
|
2
|
+
import { ComponentProps } from '@/types/cskTypes';
|
|
3
3
|
|
|
4
4
|
export type CardAdditionalProps = {
|
|
5
5
|
className?: string;
|
|
@@ -17,7 +17,7 @@ export enum CardSlots {
|
|
|
17
17
|
CardContent = 'cardContent',
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export type CardProps = ComponentProps<CardParameters & CardAdditionalProps
|
|
20
|
+
export type CardProps = ComponentProps<CardParameters, CardSlots> & CardAdditionalProps;
|
|
21
21
|
|
|
22
|
-
export {
|
|
22
|
+
export { default } from './card';
|
|
23
23
|
export { CardEmptyPlaceholder } from './empty-placeholder';
|
|
@@ -1,31 +1,29 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { FC } from 'react';
|
|
4
|
-
import { UniformSlot } from '@uniformdev/
|
|
4
|
+
import { UniformSlot } from '@uniformdev/next-app-router/component';
|
|
5
5
|
import BaseCarousel from '@/components/ui/Carousel';
|
|
6
|
-
import {
|
|
6
|
+
import { withFlattenParameters } from '@/utils/withFlattenParameters';
|
|
7
|
+
import { CarouselParameters, CarouselProps } from '.';
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
const Carousel: FC<CarouselProps & CarouselParameters> = ({
|
|
9
10
|
slots,
|
|
10
|
-
component,
|
|
11
|
-
context,
|
|
12
11
|
backgroundColor,
|
|
13
12
|
spacing,
|
|
14
13
|
border,
|
|
15
14
|
fluidContent,
|
|
16
|
-
fullHeight,
|
|
17
|
-
fitHeight,
|
|
18
15
|
height,
|
|
19
16
|
itemsPerPage,
|
|
20
17
|
gapX,
|
|
18
|
+
variant,
|
|
21
19
|
}) => (
|
|
22
20
|
<BaseCarousel
|
|
23
|
-
{...{ backgroundColor, spacing, border, fluidContent,
|
|
21
|
+
{...{ backgroundColor, spacing, border, fluidContent, height, itemsPerPage, gapX }}
|
|
24
22
|
countOfItems={slots.carouselItems?.items.length ?? 0}
|
|
25
|
-
variant={
|
|
23
|
+
variant={variant}
|
|
26
24
|
>
|
|
27
25
|
{({ className, style }) => (
|
|
28
|
-
<UniformSlot
|
|
26
|
+
<UniformSlot slot={slots.carouselItems}>
|
|
29
27
|
{({ child, key }) => (
|
|
30
28
|
<div key={key} className={className} style={style}>
|
|
31
29
|
{child}
|
|
@@ -35,3 +33,5 @@ export const Carousel: FC<CarouselProps> = ({
|
|
|
35
33
|
)}
|
|
36
34
|
</BaseCarousel>
|
|
37
35
|
);
|
|
36
|
+
|
|
37
|
+
export default withFlattenParameters(Carousel);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import dynamic from 'next/dynamic';
|
|
2
|
-
import { ComponentProps } from '@uniformdev/canvas-next-rsc/component';
|
|
3
2
|
import { ContainerParameters } from '@/components/canvas/Container/parameters';
|
|
3
|
+
import { ComponentProps } from '@/types/cskTypes';
|
|
4
4
|
|
|
5
5
|
export type CarouselParameters = ContainerParameters & {
|
|
6
|
-
itemsPerPage
|
|
7
|
-
gapX
|
|
6
|
+
itemsPerPage?: string;
|
|
7
|
+
gapX?: string;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export enum CarouselSlots {
|
|
@@ -13,5 +13,5 @@ export enum CarouselSlots {
|
|
|
13
13
|
|
|
14
14
|
export type CarouselProps = ComponentProps<CarouselParameters, CarouselSlots>;
|
|
15
15
|
|
|
16
|
-
export default dynamic(() => import('./carousel').then(mod => mod.
|
|
16
|
+
export default dynamic(() => import('./carousel').then(mod => mod.default));
|
|
17
17
|
export { CarouselEmptyPlaceholder } from './empty-placeholder';
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import { UniformSlot } from '@uniformdev/
|
|
2
|
+
import { UniformSlot } from '@uniformdev/next-app-router/component';
|
|
3
3
|
import BaseContainer from '@/components/ui/Container';
|
|
4
|
-
import {
|
|
4
|
+
import { withFlattenParameters } from '@/utils/withFlattenParameters';
|
|
5
|
+
import { ContainerParameters, ContainerProps } from '.';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
const Container: FC<ContainerProps & ContainerParameters> = ({
|
|
7
8
|
displayName,
|
|
8
9
|
anchor: id,
|
|
9
10
|
slots,
|
|
10
|
-
component,
|
|
11
|
-
context,
|
|
12
11
|
backgroundColor,
|
|
13
12
|
spacing,
|
|
14
13
|
border,
|
|
15
14
|
fluidContent,
|
|
16
|
-
fullHeight,
|
|
17
|
-
fitHeight,
|
|
18
15
|
height,
|
|
19
16
|
className,
|
|
20
17
|
}) => (
|
|
@@ -26,12 +23,12 @@ export const Container: FC<ContainerProps> = ({
|
|
|
26
23
|
spacing,
|
|
27
24
|
border,
|
|
28
25
|
fluidContent,
|
|
29
|
-
fullHeight,
|
|
30
|
-
fitHeight,
|
|
31
26
|
height,
|
|
32
27
|
className,
|
|
33
28
|
}}
|
|
34
29
|
>
|
|
35
|
-
<UniformSlot
|
|
30
|
+
<UniformSlot slot={slots.containerContent} />
|
|
36
31
|
</BaseContainer>
|
|
37
32
|
);
|
|
33
|
+
|
|
34
|
+
export default withFlattenParameters(Container);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentProps } from '
|
|
1
|
+
import { ComponentProps } from '@/types/cskTypes';
|
|
2
2
|
import { ContainerParameters } from './parameters';
|
|
3
3
|
|
|
4
4
|
export type ContainerAdditionalProps = {
|
|
@@ -9,7 +9,7 @@ export enum ContainerSlots {
|
|
|
9
9
|
ContainerContent = 'containerContent',
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export type ContainerProps = ComponentProps<ContainerParameters & ContainerAdditionalProps
|
|
12
|
+
export type ContainerProps = ComponentProps<ContainerParameters, ContainerSlots> & ContainerAdditionalProps;
|
|
13
13
|
|
|
14
14
|
export { type ContainerParameters } from './parameters';
|
|
15
|
-
export {
|
|
15
|
+
export { default } from './container';
|
|
@@ -9,9 +9,5 @@ export type ContainerParameters = {
|
|
|
9
9
|
spacing?: SpaceType | ViewPort<SpaceType>;
|
|
10
10
|
border?: string | ViewPort<string>;
|
|
11
11
|
fluidContent?: boolean;
|
|
12
|
-
/** @deprecated Use height prop instead */
|
|
13
|
-
fullHeight?: boolean;
|
|
14
|
-
/** @deprecated Use height prop instead */
|
|
15
|
-
fitHeight?: boolean;
|
|
16
12
|
height?: HeightType | ViewPort<HeightType>;
|
|
17
13
|
};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { FC, useCallback, useEffect, useState } from 'react';
|
|
4
|
+
import Cookies from 'js-cookie';
|
|
5
|
+
import { ComponentParameter, UniformSlot, UniformText } from '@uniformdev/next-app-router/component';
|
|
6
|
+
import BaseBanner, { BannerVariants } from '@/components/ui/Banner';
|
|
7
|
+
import BaseButton from '@/components/ui/Button';
|
|
8
|
+
import useCookiesConsent from '@/utils/useCookiesConsent';
|
|
9
|
+
import { withFlattenParameters } from '@/utils/withFlattenParameters';
|
|
10
|
+
import { CookieConsentProps, CookieConsentParameters } from '.';
|
|
11
|
+
|
|
12
|
+
const CLIENT_COOKIE_NAME = 'hasAcceptedCookies';
|
|
13
|
+
|
|
14
|
+
const CookieConsent: FC<CookieConsentProps & CookieConsentParameters> = ({
|
|
15
|
+
backgroundColor,
|
|
16
|
+
spacing,
|
|
17
|
+
border,
|
|
18
|
+
fluidContent,
|
|
19
|
+
allowTextColor,
|
|
20
|
+
allowButtonColor,
|
|
21
|
+
allowButtonHoverColor,
|
|
22
|
+
declineTextColor,
|
|
23
|
+
declineButtonColor,
|
|
24
|
+
declineButtonHoverColor,
|
|
25
|
+
slots,
|
|
26
|
+
variant,
|
|
27
|
+
parameters,
|
|
28
|
+
component,
|
|
29
|
+
context,
|
|
30
|
+
}) => {
|
|
31
|
+
const [showCookieConsent, setShowCookieConsent] = useState(false);
|
|
32
|
+
const { consent, updateConsent } = useCookiesConsent();
|
|
33
|
+
const { defaultConsent } = context?.pageState || {};
|
|
34
|
+
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
// get user has accepted cookies from cookie
|
|
37
|
+
const cookieValue = Cookies.get(CLIENT_COOKIE_NAME);
|
|
38
|
+
const userHasAcceptedCookies = cookieValue === undefined ? undefined : cookieValue === 'true';
|
|
39
|
+
|
|
40
|
+
if (userHasAcceptedCookies === undefined) {
|
|
41
|
+
// if user has not accepted cookies and default consent is false, show cookie consent
|
|
42
|
+
if (!defaultConsent) {
|
|
43
|
+
// eslint-disable-next-line react-hooks/set-state-in-effect
|
|
44
|
+
setShowCookieConsent(true);
|
|
45
|
+
|
|
46
|
+
// if consent is true, but user has not accepted cookies, update consent to false
|
|
47
|
+
if (consent) {
|
|
48
|
+
updateConsent(false);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// if user has accepted cookies and consent is not the same, update consent
|
|
55
|
+
if (consent !== userHasAcceptedCookies) {
|
|
56
|
+
updateConsent(userHasAcceptedCookies);
|
|
57
|
+
}
|
|
58
|
+
}, [defaultConsent, consent, updateConsent, setShowCookieConsent]);
|
|
59
|
+
|
|
60
|
+
const handleAllowCookiesButtonClick = useCallback(() => {
|
|
61
|
+
updateConsent(true);
|
|
62
|
+
Cookies.set(CLIENT_COOKIE_NAME, 'true');
|
|
63
|
+
setShowCookieConsent(false);
|
|
64
|
+
}, [updateConsent]);
|
|
65
|
+
|
|
66
|
+
const handleDeclineCookiesButtonClick = useCallback(() => {
|
|
67
|
+
updateConsent(false);
|
|
68
|
+
Cookies.set(CLIENT_COOKIE_NAME, 'false');
|
|
69
|
+
setShowCookieConsent(false);
|
|
70
|
+
}, [updateConsent]);
|
|
71
|
+
|
|
72
|
+
if (!showCookieConsent) return null;
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<BaseBanner
|
|
76
|
+
{...{
|
|
77
|
+
backgroundColor,
|
|
78
|
+
spacing,
|
|
79
|
+
border,
|
|
80
|
+
fluidContent,
|
|
81
|
+
floating: true,
|
|
82
|
+
variant: variant as BannerVariants,
|
|
83
|
+
}}
|
|
84
|
+
>
|
|
85
|
+
<div className="flex flex-col gap-x-6 md:flex-row p-5 xs:p-10 items-center justify-between w-full">
|
|
86
|
+
<UniformSlot slot={slots.cookieConsentContent} />
|
|
87
|
+
<div className="flex justify-between gap-2 flex-col sm:flex-row md:flex-col lg:flex-row shrink-0 md:justify-start w-full md:w-auto md:space-x-0 md:space-y-2 lg:space-y-0 lg:space-x-3 mt-4 md:mt-0">
|
|
88
|
+
<BaseButton
|
|
89
|
+
className="w-full cursor-pointer"
|
|
90
|
+
size="button-medium"
|
|
91
|
+
textSize="sm"
|
|
92
|
+
textWeight="normal"
|
|
93
|
+
buttonColor={allowButtonColor}
|
|
94
|
+
textColor={allowTextColor}
|
|
95
|
+
hoverButtonColor={allowButtonHoverColor}
|
|
96
|
+
onClick={handleAllowCookiesButtonClick}
|
|
97
|
+
>
|
|
98
|
+
<UniformText
|
|
99
|
+
placeholder="allowButtonText"
|
|
100
|
+
parameter={parameters.allowButtonText as ComponentParameter<string>}
|
|
101
|
+
component={component}
|
|
102
|
+
/>
|
|
103
|
+
</BaseButton>
|
|
104
|
+
<BaseButton
|
|
105
|
+
className="w-full cursor-pointer"
|
|
106
|
+
size="button-medium"
|
|
107
|
+
textSize="sm"
|
|
108
|
+
textWeight="normal"
|
|
109
|
+
buttonColor={declineButtonColor}
|
|
110
|
+
textColor={declineTextColor}
|
|
111
|
+
hoverButtonColor={declineButtonHoverColor}
|
|
112
|
+
onClick={handleDeclineCookiesButtonClick}
|
|
113
|
+
>
|
|
114
|
+
<UniformText
|
|
115
|
+
placeholder="declineButtonText"
|
|
116
|
+
parameter={parameters.declineButtonText as ComponentParameter<string>}
|
|
117
|
+
component={component}
|
|
118
|
+
/>
|
|
119
|
+
</BaseButton>
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
122
|
+
</BaseBanner>
|
|
123
|
+
);
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export default withFlattenParameters(CookieConsent);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ResolveEmptyPlaceholderOptions } from '@/types/cskTypes';
|
|
2
|
+
import { DEFAULT_EMPTY_PLACEHOLDER } from '@/utils/createEmptyPlaceholderResolver';
|
|
3
|
+
import { CookieConsentSlots } from '.';
|
|
4
|
+
|
|
5
|
+
export const CookieConsentEmptyPlaceholder = (props: ResolveEmptyPlaceholderOptions) => {
|
|
6
|
+
switch (props.slotName) {
|
|
7
|
+
case CookieConsentSlots.CookieConsentContent:
|
|
8
|
+
return { component: () => <div className="h-20 w-full" /> };
|
|
9
|
+
default:
|
|
10
|
+
return DEFAULT_EMPTY_PLACEHOLDER;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import dynamic from 'next/dynamic';
|
|
2
|
+
import { ContainerParameters } from '@/components/canvas/Container/parameters';
|
|
3
|
+
import { ContentAlignment } from '@/components/ui/Banner';
|
|
4
|
+
import { ComponentProps } from '@/types/cskTypes';
|
|
5
|
+
|
|
6
|
+
export enum CookieConsentSlots {
|
|
7
|
+
CookieConsentContent = 'cookieConsentContent',
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type CookieConsentParameters = ContainerParameters & {
|
|
11
|
+
allowButtonText?: string;
|
|
12
|
+
allowTextColor?: string;
|
|
13
|
+
allowButtonColor?: string;
|
|
14
|
+
allowButtonHoverColor?: string;
|
|
15
|
+
declineButtonText?: string;
|
|
16
|
+
declineTextColor?: string;
|
|
17
|
+
declineButtonColor?: string;
|
|
18
|
+
declineButtonHoverColor?: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type CookieConsentProps = ComponentProps<CookieConsentParameters, CookieConsentSlots>;
|
|
22
|
+
|
|
23
|
+
export { ContentAlignment };
|
|
24
|
+
|
|
25
|
+
export default dynamic(() => import('./cookie-consent').then(mod => mod.default));
|
|
26
|
+
export { CookieConsentEmptyPlaceholder } from './empty-placeholder';
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { FC, useState, useEffect, useMemo } from 'react';
|
|
4
|
-
import { UniformSlot } from '@uniformdev/
|
|
5
|
-
import {
|
|
4
|
+
import { UniformSlot } from '@uniformdev/next-app-router/component';
|
|
5
|
+
import { withFlattenParameters } from '@/utils/withFlattenParameters';
|
|
6
|
+
import { CountdownParameters, CountdownProps, CountdownVariants } from '.';
|
|
6
7
|
import { CountdownUnit } from './constants';
|
|
7
8
|
import { getTextClass, getUnitClass } from './style-utils';
|
|
8
9
|
import { formatTime, renderNumberList } from './utils';
|
|
9
10
|
|
|
10
11
|
const UNITS_TO_SHOW = [CountdownUnit.Days, CountdownUnit.Hours, CountdownUnit.Minutes, CountdownUnit.Seconds];
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
const Countdown: FC<CountdownProps & CountdownParameters> = ({
|
|
13
14
|
targetDate,
|
|
14
15
|
backgroundColor,
|
|
15
16
|
textColor,
|
|
16
17
|
border,
|
|
17
18
|
size,
|
|
18
|
-
component,
|
|
19
|
-
context,
|
|
20
19
|
slots,
|
|
20
|
+
variant,
|
|
21
21
|
}) => {
|
|
22
22
|
const [{ timeDifference, ...time }, setTime] = useState(formatTime(targetDate));
|
|
23
23
|
|
|
@@ -55,7 +55,7 @@ export const Countdown: FC<CountdownProps> = ({
|
|
|
55
55
|
<div
|
|
56
56
|
key={unit}
|
|
57
57
|
className={getUnitClass({
|
|
58
|
-
variant:
|
|
58
|
+
variant: variant as CountdownVariants,
|
|
59
59
|
backgroundColor,
|
|
60
60
|
border,
|
|
61
61
|
size,
|
|
@@ -77,8 +77,10 @@ export const Countdown: FC<CountdownProps> = ({
|
|
|
77
77
|
})}
|
|
78
78
|
</div>
|
|
79
79
|
) : (
|
|
80
|
-
<UniformSlot
|
|
80
|
+
<UniformSlot slot={slots.countdownComplete} />
|
|
81
81
|
)}
|
|
82
82
|
</div>
|
|
83
83
|
);
|
|
84
84
|
};
|
|
85
|
+
|
|
86
|
+
export default withFlattenParameters(Countdown);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import dynamic from 'next/dynamic';
|
|
2
|
-
import { ComponentProps } from '@uniformdev/canvas-next-rsc/component';
|
|
3
2
|
import { TextProps as BaseTextProps } from '@/components/ui/Text';
|
|
4
|
-
import { ViewPort } from '@/types/cskTypes';
|
|
3
|
+
import { ComponentProps, ViewPort } from '@/types/cskTypes';
|
|
5
4
|
|
|
6
5
|
type UniformDate = {
|
|
7
6
|
datetime: string;
|
|
@@ -25,5 +24,5 @@ export enum CountdownVariants {
|
|
|
25
24
|
|
|
26
25
|
export type CountdownProps = ComponentProps<CountdownParameters, CountdownSlots>;
|
|
27
26
|
|
|
28
|
-
export default dynamic(() => import('./countdown').then(mod => mod.
|
|
27
|
+
export default dynamic(() => import('./countdown').then(mod => mod.default));
|
|
29
28
|
export { CountdownEmptyPlaceholder } from './empty-placeholder';
|