@uniformdev/csk-components 6.0.123-alpha.1 → 6.1.63-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-PMMAALCQ.mjs → chunk-AOFJCDRO.mjs} +1 -1
- package/dist/{chunk-2BMAPB63.mjs → chunk-AWTML4I7.mjs} +1 -1
- 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-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 -648
- package/dist/components/canvas/index.mjs +1 -1
- 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 +24 -33
- package/dist/components/ui/index.mjs +1 -1
- package/dist/content/components/canvas/Accordion/accordion.tsx +8 -7
- package/dist/content/components/canvas/Accordion/index.tsx +2 -2
- package/dist/content/components/canvas/AccordionItem/accordion-item.tsx +9 -7
- 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 +3 -5
- package/dist/content/components/canvas/Card/card.tsx +9 -9
- package/dist/content/components/canvas/Card/index.tsx +3 -3
- package/dist/content/components/canvas/Carousel/carousel.tsx +9 -7
- package/dist/content/components/canvas/Carousel/index.tsx +4 -4
- package/dist/content/components/canvas/Container/container.tsx +7 -6
- package/dist/content/components/canvas/Container/index.tsx +3 -3
- 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 +29 -32
- package/dist/content/components/canvas/DemoHero/columns-variant.tsx +4 -4
- package/dist/content/components/canvas/DemoHero/default-variant.tsx +4 -4
- package/dist/content/components/canvas/DemoHero/demo-hero.tsx +41 -18
- package/dist/content/components/canvas/DemoHero/fixed-hero.tsx +13 -6
- package/dist/content/components/canvas/DemoHero/flexible-hero.tsx +8 -2
- package/dist/content/components/canvas/DemoHero/index.tsx +3 -4
- 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 +9 -6
- 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 -7
- 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 +13 -7
- 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 +20 -33
- 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 +9 -10
- 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 +2 -2
- 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 +2 -2
- 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 +4 -4
- package/dist/content/components/canvas/Section/default-variant.tsx +6 -6
- 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 -12
- 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 +8 -7
- 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 +44 -42
- package/dist/content/components/canvas/Testimonial/default-variant.tsx +7 -7
- package/dist/content/components/canvas/Testimonial/index.tsx +2 -2
- package/dist/content/components/canvas/Testimonial/testimonial.tsx +11 -13
- package/dist/content/components/canvas/Testimonial/with-large-avatar-variant.tsx +7 -7
- package/dist/content/components/canvas/Testimonial/with-overlapping-image-variant.tsx +7 -7
- 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 -3
- package/dist/content/components/canvas/Video/placeholder.tsx +1 -1
- package/dist/content/components/canvas/Video/video.tsx +8 -5
- 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/Carousel/index.ts +2 -2
- 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/Flex/flex.tsx +2 -0
- package/dist/content/components/ui/Flex/index.ts +2 -0
- package/dist/content/components/ui/FlexItem/index.ts +1 -1
- package/dist/content/components/ui/Footer/index.ts +4 -3
- package/dist/content/components/ui/Grid/grid.tsx +2 -0
- package/dist/content/components/ui/Grid/index.ts +3 -0
- package/dist/content/components/ui/GridItem/grid-item.tsx +10 -1
- package/dist/content/components/ui/GridItem/index.ts +3 -0
- 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 +3 -1
- package/dist/content/components/ui/InlineSVG/inline-svg.tsx +14 -3
- package/dist/content/components/ui/InlineSVG/utils.ts +66 -11
- package/dist/content/components/ui/Rating/index.tsx +1 -1
- package/dist/content/components/ui/Rating/rating.tsx +1 -1
- 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-D5cLtaIv.d.mts → index-CSSWgmI5.d.mts} +54 -28
- package/dist/index-CrBZatTs.d.mts +18 -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 +20 -7
- package/dist/utils/routing.mjs +1 -1
- package/dist/utils/sitemap.mjs +1 -1
- package/dist/utils/styling.d.mts +3 -0
- 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 +43 -14
- package/dist/ThemeSwitcher-6Q7LCO4Q.mjs +0 -1
- package/dist/accordion-item-QAVKQEB2.mjs +0 -1
- package/dist/accordion-item-Y4PSNOH4.mjs +0 -1
- package/dist/banner-EYII7V7X.mjs +0 -1
- package/dist/carousel-RZ2DV6QX.mjs +0 -1
- package/dist/carousel-YELQRJVB.mjs +0 -1
- package/dist/chunk-2UV7TQNF.mjs +0 -1
- package/dist/chunk-2YTACEBA.mjs +0 -1
- package/dist/chunk-56OQGKRM.mjs +0 -1
- package/dist/chunk-ABORGLS6.mjs +0 -2
- package/dist/chunk-B2O55EVA.mjs +0 -1
- package/dist/chunk-EOV2LPGC.mjs +0 -1
- package/dist/chunk-EUVKAE6M.mjs +0 -1
- package/dist/chunk-FIN5US3Q.mjs +0 -1
- package/dist/chunk-LZOK42EM.mjs +0 -1
- package/dist/chunk-MSXDLSXH.mjs +0 -1
- package/dist/chunk-RX4IAAQQ.mjs +0 -1
- package/dist/chunk-RYEXR67P.mjs +0 -1
- package/dist/chunk-TCQTXNKT.mjs +0 -1
- package/dist/chunk-TFA6HYP4.mjs +0 -7
- package/dist/chunk-VW2XC3SE.mjs +0 -1
- package/dist/chunk-YEKQJ4YC.mjs +0 -1
- package/dist/content/components/canvas/Banner/types.ts +0 -21
- package/dist/countdown-LYDXJLEE.mjs +0 -1
- package/dist/image-gallery-AMU6FS7N.mjs +0 -1
- package/dist/mobile-JGZBHQC2.mjs +0 -1
- package/dist/modal-43IHAVWB.mjs +0 -1
- package/dist/modal-5FNTFSTN.mjs +0 -1
- package/dist/navigation-flyout-EPIOXRWJ.mjs +0 -1
- package/dist/navigation-group-OCZ35QI2.mjs +0 -1
- package/dist/tabs-J23TEEQ7.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}/Banner/close-button.tsx +0 -0
|
@@ -1,3 +1,38 @@
|
|
|
1
|
+
import { SVGProps } from 'react';
|
|
2
|
+
|
|
3
|
+
type SVGAttributes = Record<string, string | number | boolean>;
|
|
4
|
+
type ReactSVGProps = SVGProps<SVGSVGElement>;
|
|
5
|
+
const PRESERVE_AS_STRING = ['id', 'class', 'viewBox', 'preserveAspectRatio'];
|
|
6
|
+
|
|
7
|
+
const ATTRIBUTE_MAP: Record<string, string> = {
|
|
8
|
+
class: 'className',
|
|
9
|
+
'stroke-width': 'strokeWidth',
|
|
10
|
+
'stroke-linecap': 'strokeLinecap',
|
|
11
|
+
'stroke-linejoin': 'strokeLinejoin',
|
|
12
|
+
'stroke-miterlimit': 'strokeMiterlimit',
|
|
13
|
+
'stroke-dasharray': 'strokeDasharray',
|
|
14
|
+
'stroke-dashoffset': 'strokeDashoffset',
|
|
15
|
+
'stroke-opacity': 'strokeOpacity',
|
|
16
|
+
'fill-opacity': 'fillOpacity',
|
|
17
|
+
'fill-rule': 'fillRule',
|
|
18
|
+
'clip-rule': 'clipRule',
|
|
19
|
+
'clip-path': 'clipPath',
|
|
20
|
+
'font-family': 'fontFamily',
|
|
21
|
+
'font-size': 'fontSize',
|
|
22
|
+
'font-weight': 'fontWeight',
|
|
23
|
+
'text-anchor': 'textAnchor',
|
|
24
|
+
'pointer-events': 'pointerEvents',
|
|
25
|
+
'vector-effect': 'vectorEffect',
|
|
26
|
+
'color-interpolation': 'colorInterpolation',
|
|
27
|
+
'dominant-baseline': 'dominantBaseline',
|
|
28
|
+
'text-rendering': 'textRendering',
|
|
29
|
+
'shape-rendering': 'shapeRendering',
|
|
30
|
+
'color-rendering': 'colorRendering',
|
|
31
|
+
'image-rendering': 'imageRendering',
|
|
32
|
+
'xml:space': 'xmlSpace',
|
|
33
|
+
'xmlns:xlink': 'xmlnsXlink',
|
|
34
|
+
} as const;
|
|
35
|
+
|
|
1
36
|
/**
|
|
2
37
|
* Sanitizes SVG by removing potentially dangerous or unwanted content.
|
|
3
38
|
*/
|
|
@@ -21,26 +56,32 @@ export const applyCurrentColor = (svg: string): string =>
|
|
|
21
56
|
/**
|
|
22
57
|
* Extracts attributes from the <svg> tag as key-value pairs.
|
|
23
58
|
*/
|
|
24
|
-
export const getSvgAttributes = (
|
|
25
|
-
const
|
|
26
|
-
if (!
|
|
59
|
+
export const getSvgAttributes = (svgContent: string): SVGAttributes => {
|
|
60
|
+
const svgTagMatch = svgContent.match(/<svg([^>]*)>/i);
|
|
61
|
+
if (!svgTagMatch) return {};
|
|
62
|
+
|
|
63
|
+
const attributesString = svgTagMatch[1];
|
|
64
|
+
const attributes: SVGAttributes = {};
|
|
27
65
|
|
|
28
|
-
const
|
|
29
|
-
|
|
66
|
+
const attrRegex = /(\w+(?:[-:]\w+)*)\s*=\s*["']([^"']*)["']/g;
|
|
67
|
+
let match;
|
|
30
68
|
|
|
31
|
-
|
|
32
|
-
|
|
69
|
+
while ((match = attrRegex.exec(attributesString ?? '')) !== null) {
|
|
70
|
+
const [, key, value] = match;
|
|
33
71
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (
|
|
72
|
+
if (!key || !value) continue;
|
|
73
|
+
|
|
74
|
+
if (value === 'true' || value === 'false') {
|
|
75
|
+
attributes[key] = value === 'true';
|
|
76
|
+
} else if (!isNaN(Number(value)) && value !== '' && !PRESERVE_AS_STRING.includes(key)) {
|
|
77
|
+
attributes[key] = Number(value);
|
|
78
|
+
} else {
|
|
37
79
|
attributes[key] = value;
|
|
38
80
|
}
|
|
39
81
|
}
|
|
40
82
|
|
|
41
83
|
return attributes;
|
|
42
84
|
};
|
|
43
|
-
|
|
44
85
|
/**
|
|
45
86
|
* Extracts inner content from an SVG string (everything inside <svg>...</svg>).
|
|
46
87
|
*/
|
|
@@ -49,6 +90,20 @@ export const getSvgInnerContent = (svg: string): string => {
|
|
|
49
90
|
return match?.[1] ?? '';
|
|
50
91
|
};
|
|
51
92
|
|
|
93
|
+
/**
|
|
94
|
+
* Converts SVG attributes to React props.
|
|
95
|
+
*/
|
|
96
|
+
export const convertSvgAttributesToReactProps = (attributes: SVGAttributes): Partial<ReactSVGProps> => {
|
|
97
|
+
const reactProps: Record<string, string | number | boolean> = {};
|
|
98
|
+
|
|
99
|
+
for (const [key, value] of Object.entries(attributes)) {
|
|
100
|
+
const reactPropName = ATTRIBUTE_MAP[key] || key;
|
|
101
|
+
reactProps[reactPropName] = value;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return reactProps;
|
|
105
|
+
};
|
|
106
|
+
|
|
52
107
|
/**
|
|
53
108
|
* Fetches raw SVG content from a remote URL.
|
|
54
109
|
*/
|
|
@@ -5,7 +5,7 @@ import { RatingProps } from '.';
|
|
|
5
5
|
export const Rating: FC<RatingProps> = ({ rating, showReviewLabel, starsColor, activeStarsColor }) => (
|
|
6
6
|
<div className="flex items-center space-x-1">
|
|
7
7
|
{Array.from({ length: 5 }, (_, starIndex) => {
|
|
8
|
-
const selectedRating = rating >= starIndex + 1;
|
|
8
|
+
const selectedRating = rating && rating >= starIndex + 1;
|
|
9
9
|
return (
|
|
10
10
|
<svg
|
|
11
11
|
key={starIndex}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { HTMLAttributes } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { HTMLAttributes, ComponentProps as ReactComponentProps } from 'react';
|
|
2
|
+
import { AssetParamValueItem } from '@uniformdev/canvas';
|
|
3
|
+
import { UniformComposition } from '@uniformdev/next-app-router';
|
|
4
|
+
import { ComponentParameter } from '@uniformdev/next-app-router-shared';
|
|
5
|
+
|
|
6
|
+
type ResolveEmptyPlaceholderFunction = NonNullable<
|
|
7
|
+
ReactComponentProps<typeof UniformComposition>['resolveEmptyPlaceholder']
|
|
8
|
+
>;
|
|
9
|
+
export type ResolveEmptyPlaceholderOptions = Parameters<ResolveEmptyPlaceholderFunction>[0];
|
|
10
10
|
|
|
11
11
|
export type ViewPort<T> = {
|
|
12
12
|
desktop?: T;
|
|
@@ -25,3 +25,26 @@ export type SpaceType = Pick<
|
|
|
25
25
|
| 'paddingRight'
|
|
26
26
|
| 'paddingBottom'
|
|
27
27
|
>;
|
|
28
|
+
|
|
29
|
+
type ToComponentParameters<T> = {
|
|
30
|
+
[K in keyof T]: ComponentParameter<T[K]>;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export type ComponentProps<
|
|
34
|
+
T,
|
|
35
|
+
S extends string = string,
|
|
36
|
+
> = import('@uniformdev/next-app-router/component').ComponentProps<ToComponentParameters<T>, S>;
|
|
37
|
+
|
|
38
|
+
type ValueOfField<F> = F extends { value: infer V } ? V : never;
|
|
39
|
+
type FlattenFields<T extends AssetParamValueItem> = {
|
|
40
|
+
[K in keyof T['fields']]: ValueOfField<T['fields'][K]>;
|
|
41
|
+
};
|
|
42
|
+
type RenameKey<T, K extends keyof T, NewName extends PropertyKey> = Omit<T, K> & { [P in NewName]: T[K] };
|
|
43
|
+
|
|
44
|
+
export type ResolvedAssetFromItem<T extends AssetParamValueItem> = RenameKey<FlattenFields<T>, 'id', 'file'> & {
|
|
45
|
+
id: T['_id'];
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export type ReplaceFieldsWithAssets<T, K extends keyof T> = Omit<T, K> & {
|
|
49
|
+
[P in K]?: ResolvedAssetFromItem<AssetParamValueItem>[];
|
|
50
|
+
};
|
|
@@ -1,21 +1,6 @@
|
|
|
1
|
-
import { AssetParamValue } from '@uniformdev/assets';
|
|
1
|
+
import { AssetParamValue, AssetParamValueItem } from '@uniformdev/assets';
|
|
2
2
|
import { flattenValues } from '@uniformdev/canvas';
|
|
3
|
-
|
|
4
|
-
type ResolvedAsset = {
|
|
5
|
-
id?: string;
|
|
6
|
-
url: string;
|
|
7
|
-
file?: string;
|
|
8
|
-
size?: number;
|
|
9
|
-
title?: string;
|
|
10
|
-
width?: number;
|
|
11
|
-
height?: number;
|
|
12
|
-
mediaType?: string;
|
|
13
|
-
description?: string;
|
|
14
|
-
focalPoint?: {
|
|
15
|
-
x: number;
|
|
16
|
-
y: number;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
3
|
+
import { ResolvedAssetFromItem } from '@/types/cskTypes';
|
|
19
4
|
|
|
20
5
|
/**
|
|
21
6
|
* Resolves a list of assets, filtering out any entries without a valid URL.
|
|
@@ -23,5 +8,5 @@ type ResolvedAsset = {
|
|
|
23
8
|
* @param {AssetParamValue | undefined} image - The list of assets to resolve.
|
|
24
9
|
* @returns {ResolvedAsset[]} - An array of resolved assets with valid URLs.
|
|
25
10
|
*/
|
|
26
|
-
export const resolveAsset = (image?: AssetParamValue):
|
|
11
|
+
export const resolveAsset = (image?: AssetParamValue): ResolvedAssetFromItem<AssetParamValueItem>[] =>
|
|
27
12
|
(flattenValues(image as never) || []).filter(({ url }) => Boolean(url));
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { ResolveComponentFunction, ResolveComponentResult } from '@uniformdev/next-app-router';
|
|
2
|
+
import ComponentEmptyPlaceholder from '@/components/ui/ComponentEmptyPlaceholder';
|
|
3
3
|
|
|
4
|
-
export type ComponentMapping = Record<string, ResolveComponentResult>;
|
|
4
|
+
export type ComponentMapping = Record<string, ResolveComponentResult['component']>;
|
|
5
5
|
|
|
6
6
|
const createComponentResolver =
|
|
7
|
-
(mappings: ComponentMapping) =>
|
|
8
|
-
({ component }
|
|
9
|
-
mappings[component?.type]
|
|
7
|
+
(mappings: ComponentMapping): ResolveComponentFunction =>
|
|
8
|
+
({ component }) => ({
|
|
9
|
+
component: mappings[component?.type] || ComponentEmptyPlaceholder,
|
|
10
|
+
});
|
|
10
11
|
|
|
11
12
|
export default createComponentResolver;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ComponentType } from 'react';
|
|
2
|
-
import { ComponentProps } from '@uniformdev/
|
|
2
|
+
import { ComponentProps } from '@uniformdev/next-app-router/component';
|
|
3
3
|
import { ResolveEmptyPlaceholderOptions } from '@/types/cskTypes';
|
|
4
4
|
|
|
5
|
-
export const DEFAULT_EMPTY_PLACEHOLDER = { component: () => <div className="h-20 w-full" /> };
|
|
5
|
+
export const DEFAULT_EMPTY_PLACEHOLDER = { component: () => <div className="h-full min-h-20 w-full" /> };
|
|
6
6
|
|
|
7
7
|
export type EmptyPlaceholderMapping = Record<
|
|
8
8
|
string,
|
|
@@ -12,11 +12,7 @@ export type EmptyPlaceholderMapping = Record<
|
|
|
12
12
|
}
|
|
13
13
|
>;
|
|
14
14
|
|
|
15
|
-
const createEmptyPlaceholderResolver =
|
|
16
|
-
(
|
|
17
|
-
({ parentComponent, ...restProps }: ResolveEmptyPlaceholderOptions) =>
|
|
18
|
-
parentComponent
|
|
19
|
-
? mappings[parentComponent.type]?.({ parentComponent, ...restProps }) || DEFAULT_EMPTY_PLACEHOLDER
|
|
20
|
-
: DEFAULT_EMPTY_PLACEHOLDER;
|
|
15
|
+
const createEmptyPlaceholderResolver = (mappings: EmptyPlaceholderMapping) => (props: ResolveEmptyPlaceholderOptions) =>
|
|
16
|
+
mappings[props?.parentComponent?.type]?.(props) || DEFAULT_EMPTY_PLACEHOLDER;
|
|
21
17
|
|
|
22
18
|
export default createEmptyPlaceholderResolver;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'server-only';
|
|
2
|
+
|
|
3
|
+
import { createCompositionCache } from '@uniformdev/next-app-router';
|
|
4
|
+
import { SlotDefinition } from '@uniformdev/next-app-router-shared';
|
|
5
|
+
import { ComponentProps } from '@/types/cskTypes';
|
|
6
|
+
|
|
7
|
+
export const compositionCache = createCompositionCache();
|
|
8
|
+
|
|
9
|
+
export const getSlotComponents = <T>(slot: SlotDefinition, context: ComponentProps<T>['context']) =>
|
|
10
|
+
slot.items.map(slot =>
|
|
11
|
+
compositionCache.getUniformComponent({
|
|
12
|
+
componentId: slot!._id,
|
|
13
|
+
compositionId: context._id,
|
|
14
|
+
})
|
|
15
|
+
);
|
|
@@ -1,23 +1,68 @@
|
|
|
1
1
|
import { ResolvedRouteGetResponse, RouteGetResponseEdgehancedComposition, LinkParamValue } from '@uniformdev/canvas';
|
|
2
2
|
|
|
3
|
-
const DYNAMIC_KEY_REGEX = /:([a-zA-Z0-9-_]+)/g;
|
|
4
|
-
|
|
5
3
|
/**
|
|
6
|
-
*
|
|
4
|
+
* Replaces dynamic segments in an unresolved path template (with `:tokens`)
|
|
5
|
+
* using values from a resolved path.
|
|
6
|
+
*
|
|
7
|
+
* If the structure doesn't match, returns `undefined` instead of throwing an error.
|
|
8
|
+
*
|
|
9
|
+
* @param {string} unresolved - The path template containing dynamic segments (e.g. `/:locale/:dynamic/static`).
|
|
10
|
+
* @param {string} resolved - The fully resolved path with actual values (e.g. `/en/test/static`).
|
|
11
|
+
* @returns {string | undefined} - The final path with dynamic tokens replaced (e.g. `/en/test/static`), or `undefined` on mismatch.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* resolveRouteToPath("/:locale/:dynamic", "/en/test");
|
|
15
|
+
* // Returns: "/en/test"
|
|
7
16
|
*
|
|
8
|
-
* @
|
|
9
|
-
*
|
|
10
|
-
*
|
|
17
|
+
* @example
|
|
18
|
+
* resolveRouteToPath("/:locale/:dynamic/static/:dynamic", "/en/test/static/foo");
|
|
19
|
+
* // Returns: "/en/test/static/foo"
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* resolveRouteToPath("/:locale/static", "/en/test");
|
|
23
|
+
* // Returns: undefined
|
|
11
24
|
*/
|
|
12
|
-
export const resolveRouteToPath = (
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
25
|
+
export const resolveRouteToPath = (unresolved: string, resolved: string): string | undefined => {
|
|
26
|
+
const unresolvedParts = unresolved.split('/').filter(Boolean);
|
|
27
|
+
const resolvedParts = resolved.split('/').filter(Boolean);
|
|
28
|
+
|
|
29
|
+
if (resolvedParts.length < unresolvedParts.length) {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const { valid, result } = unresolvedParts.reduce<{
|
|
34
|
+
valid: boolean;
|
|
35
|
+
result: string[];
|
|
36
|
+
index: number;
|
|
37
|
+
}>(
|
|
38
|
+
(acc, part) => {
|
|
39
|
+
if (!acc.valid) return acc;
|
|
40
|
+
const currentResolved = resolvedParts[acc.index];
|
|
41
|
+
if (!currentResolved) return { ...acc, valid: false };
|
|
42
|
+
|
|
43
|
+
if (part.startsWith(':')) {
|
|
44
|
+
return {
|
|
45
|
+
...acc,
|
|
46
|
+
result: [...acc.result, currentResolved],
|
|
47
|
+
index: acc.index + 1,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (part === currentResolved) {
|
|
52
|
+
return {
|
|
53
|
+
...acc,
|
|
54
|
+
result: [...acc.result, part],
|
|
55
|
+
index: acc.index + 1,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return { ...acc, valid: false };
|
|
60
|
+
},
|
|
61
|
+
{ valid: true, result: [], index: 0 }
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
return valid ? '/' + result.join('/') : undefined;
|
|
65
|
+
};
|
|
21
66
|
|
|
22
67
|
/**
|
|
23
68
|
* Checks if a given route response is free of errors and contains a composition.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useCallback, useMemo } from 'react';
|
|
2
|
+
import { useUniformContext } from '@uniformdev/next-app-router-client';
|
|
3
|
+
|
|
4
|
+
const useCookiesConsent = () => {
|
|
5
|
+
const { context } = useUniformContext();
|
|
6
|
+
|
|
7
|
+
const consent = useMemo(() => context?.storage?.data?.consent, [context?.storage?.data?.consent]);
|
|
8
|
+
|
|
9
|
+
const updateConsent = useCallback(
|
|
10
|
+
(value: boolean) => context?.storage.updateData([{ type: 'consent', data: value }]),
|
|
11
|
+
[context?.storage]
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
return { consent, updateConsent };
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default useCookiesConsent;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ComponentType, FC } from 'react';
|
|
2
|
+
import { flattenValues, FlattenValuesOptions } from '@uniformdev/canvas';
|
|
3
|
+
import { ComponentProps } from '@/types/cskTypes';
|
|
4
|
+
|
|
5
|
+
export const withFlattenParameters = <TProps extends ComponentProps<T>, T>(
|
|
6
|
+
WrappedComponent: ComponentType<TProps>,
|
|
7
|
+
options?: FlattenValuesOptions
|
|
8
|
+
): ComponentType<TProps> => {
|
|
9
|
+
const ComponentWithContainer: FC<TProps> = props => (
|
|
10
|
+
<WrappedComponent {...flattenValues(props, options)} {...props} />
|
|
11
|
+
);
|
|
12
|
+
ComponentWithContainer.displayName = `withFlattenParameters(${
|
|
13
|
+
WrappedComponent.displayName || WrappedComponent.name || 'Component'
|
|
14
|
+
})`;
|
|
15
|
+
|
|
16
|
+
return ComponentWithContainer;
|
|
17
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ComponentType, FC } from 'react';
|
|
2
|
+
import { ComponentInstance } from '@uniformdev/canvas';
|
|
3
|
+
import { ComponentProps } from '@/types/cskTypes';
|
|
4
|
+
import { getSlotComponents } from '@/utils/getSlotComponents';
|
|
5
|
+
|
|
6
|
+
export const withSlotsDataValue = <TProps extends ComponentProps<T>, T>(
|
|
7
|
+
WrappedComponent: ComponentType<
|
|
8
|
+
TProps & {
|
|
9
|
+
slotData?: Record<string, ComponentInstance[]>;
|
|
10
|
+
}
|
|
11
|
+
>,
|
|
12
|
+
withSlotData?: string[]
|
|
13
|
+
): ComponentType<TProps> => {
|
|
14
|
+
const ComponentWithContainer: FC<TProps> = props => {
|
|
15
|
+
const slotData = withSlotData?.reduce<Record<string, ComponentInstance[]>>((acc, slotName) => {
|
|
16
|
+
const slot = props.slots[slotName];
|
|
17
|
+
if (slot) {
|
|
18
|
+
return {
|
|
19
|
+
...acc,
|
|
20
|
+
[slotName]: getSlotComponents(slot, props.context).filter(i => i !== null),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return acc;
|
|
24
|
+
}, {});
|
|
25
|
+
|
|
26
|
+
return <WrappedComponent {...props} slotData={slotData} />;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
ComponentWithContainer.displayName = `withSlotsDataValue(${
|
|
30
|
+
WrappedComponent.displayName || WrappedComponent.name || 'Component'
|
|
31
|
+
})`;
|
|
32
|
+
|
|
33
|
+
return ComponentWithContainer;
|
|
34
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{b as k}from"./chunk-VWWXSA5H.mjs";import{b as m}from"./chunk-QPQGRQKI.mjs";import"./chunk-S7CSCIW4.mjs";import{a as x}from"./chunk-OKUDTS22.mjs";import"./chunk-27WJUZYR.mjs";import{useCallback as g,useEffect as M,useState as O}from"react";import u from"js-cookie";import{UniformSlot as W,UniformText as w}from"@uniformdev/next-app-router/component";import{useCallback as V,useMemo as j}from"react";import{useUniformContext as D}from"@uniformdev/next-app-router-client";var I=()=>{let{context:t}=D(),s=j(()=>t?.storage?.data?.consent,[t?.storage?.data?.consent]),a=V(r=>t?.storage.updateData([{type:"consent",data:r}]),[t?.storage]);return{consent:s,updateConsent:a}},B=I;import{jsx as o,jsxs as h}from"react/jsx-runtime";var c="hasAcceptedCookies",_=({backgroundColor:t,spacing:s,border:a,fluidContent:r,allowTextColor:b,allowButtonColor:P,allowButtonHoverColor:v,declineTextColor:y,declineButtonColor:N,declineButtonHoverColor:S,slots:T,variant:z,parameters:f,component:C,context:A})=>{let[E,n]=O(!1),{consent:l,updateConsent:e}=B(),{defaultConsent:p}=A?.pageState||{};M(()=>{let d=u.get(c),i=d===void 0?void 0:d==="true";if(i===void 0){p||(n(!0),l&&e(!1));return}l!==i&&e(i)},[p,l,e,n]);let F=g(()=>{e(!0),u.set(c,"true"),n(!1)},[e]),U=g(()=>{e(!1),u.set(c,"false"),n(!1)},[e]);return E?o(k,{backgroundColor:t,spacing:s,border:a,fluidContent:r,floating:!0,variant:z,children:h("div",{className:"flex flex-col gap-x-6 md:flex-row p-5 xs:p-10 items-center justify-between w-full",children:[o(W,{slot:T.cookieConsentContent}),h("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",children:[o(m,{className:"w-full cursor-pointer",size:"button-medium",textSize:"sm",textWeight:"normal",buttonColor:P,textColor:b,hoverButtonColor:v,onClick:F,children:o(w,{placeholder:"allowButtonText",parameter:f.allowButtonText,component:C})}),o(m,{className:"w-full cursor-pointer",size:"button-medium",textSize:"sm",textWeight:"normal",buttonColor:N,textColor:y,hoverButtonColor:S,onClick:U,children:o(w,{placeholder:"declineButtonText",parameter:f.declineButtonText,component:C})})]})]})}):null},te=x(_);export{te as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import"./chunk-YQYDZJ65.mjs";import{a as d,c as a}from"./chunk-S7CSCIW4.mjs";import{a as N}from"./chunk-OKUDTS22.mjs";import"./chunk-LPAOEOU4.mjs";import{useState as T,useEffect as y,useMemo as h}from"react";import{UniformSlot as H}from"@uniformdev/next-app-router/component";var S=({variant:e,backgroundColor:n,border:o,size:t})=>a("flex w-fit p-4 text-center gap-2 items-end leading-none",{"flex-col":e==="labelsUnder",[`bg-${n}`]:!!n,[d(o,"{value}")]:o,"items-center":o,[d(t,"text-{value}")]:!!t,[d(o,"{value}")]:!!o}),_=({textColor:e})=>a("flex gap-5 flex-wrap flex-col sm:flex-row",{[`text-${e}`]:e});import{jsx as u}from"react/jsx-runtime";var c=e=>{let n=new Date(e?.datetime??0).getTime(),o=new Date().getTime(),t=Math.max(Math.floor((n-o)/1e3),0),i=Math.floor(t%60),r=Math.floor(t/60%60),f=Math.floor(t/3600%24);return{days:Math.floor(t/86400),hours:f,minutes:r,seconds:i,timeDifference:t}},x=({maxUnitsCount:e,currentTime:n,unit:o,isAlignEnd:t})=>u("div",{className:"relative mx-auto h-[1.25em] w-[1.75em] overflow-hidden",children:u("div",{className:"absolute transition-transform duration-500 ease-in-out",style:{transform:`translateY(-${n*1.25}em)`},children:Array.from({length:e+1},(i,r)=>u("div",{className:a("flex h-[1.25em] w-[1.75em] justify-center",{"items-end":t,"items-center":!t}),children:r<10?`0${r}`:r},`${o}-${r}`))})});import{jsx as m,jsxs as R}from"react/jsx-runtime";var P=["days","hours","minutes","seconds"],g=({targetDate:e,backgroundColor:n,textColor:o,border:t,size:i,slots:r,variant:f})=>{let[{timeDifference:l,...C},I]=T(c(e)),v=h(()=>{let{days:s}=c(e);return{seconds:59,minutes:59,hours:23,days:s}},[e]);return y(()=>{if(l>0){let s=setInterval(()=>{I(c(e))},1e3);return()=>clearInterval(s)}},[e,l]),m("div",{children:l?m("div",{className:_({textColor:o}),children:P.map(s=>{if(C[s]===0&&s==="days")return null;let U=C[s];return R("div",{className:S({variant:f,backgroundColor:n,border:t,size:i}),children:[m("div",{className:"mx-auto",children:x({maxUnitsCount:v[s],currentTime:U,unit:s,isAlignEnd:!t})}),m("div",{className:"mx-auto",style:{fontSize:"0.5em"},children:s})]},s)})}):m(H,{slot:r.countdownComplete})})},ee=N(g);export{ee as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{a as G}from"./chunk-BK7UG4U4.mjs";import{a as C}from"./chunk-7GVG4HLE.mjs";import{c as d}from"./chunk-S7CSCIW4.mjs";import{a as g}from"./chunk-OKUDTS22.mjs";import h from"react-responsive-masonry";import{Fragment as P,jsx as y}from"react/jsx-runtime";var u={firstLineCount:2,secondLineCount:3,otherLinesCount:4},I=({slot:r,aspectRatio:n,config:i})=>{let{firstLineCount:l=u.firstLineCount,secondLineCount:m=u.secondLineCount,otherLinesCount:s=u.otherLinesCount}=i||{},{items:p=[]}=r||{},f=p.reduce((e,o,t)=>(t<l?e[0]?.push(o?.component):t<l+m?e[1]?.push(o?.component):e[2]?.push(o?.component),e),[[],[],[]])||[];return y(P,{children:f?.map((e,o)=>e.length?y(h,{columnsCount:o<2||e.length<s?e.length:s,gutter:"4px",children:e.map((t,c)=>y("div",{className:d("flex flex-1 items-center justify-center",{[`aspect-${n}`]:!!n}),children:t},`img-${c}`))},`line-${o}`):null)})};import{jsx as a}from"react/jsx-runtime";var L=({slots:r,backgroundColor:n,spacing:i,border:l,fluidContent:m,height:s,aspectRatio:p,config:f,items:e})=>{let o={...r.imageGalleryItems,items:e?.length?e.map((t,c)=>({_id:`image-${c}-${t?.id}`,component:a(G,{src:t.url,alt:t.title||"",style:{objectFit:"cover"},fill:!0}),variantId:void 0,$pzCrit:void 0})):r.imageGalleryItems?.items||[]};return a(C,{backgroundColor:n,spacing:i,border:l,fluidContent:m,height:s,children:a("div",{className:"flex flex-col gap-1",children:a(I,{slot:o,aspectRatio:p,config:f})})})},_=g(L);export{_ as default};
|
|
@@ -1,20 +1,36 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, PropsWithChildren, ReactNode, ReactElement } from 'react';
|
|
3
|
+
import { SpaceType, ViewPort } from './types/cskTypes.mjs';
|
|
4
|
+
import { T as TextProps } from './index-CrBZatTs.mjs';
|
|
3
5
|
|
|
4
|
-
type
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
letterSpacing?: string;
|
|
13
|
-
children: ReactElement | string;
|
|
14
|
-
alignment?: 'left' | 'center' | 'right';
|
|
15
|
-
lineCountRestrictions?: string;
|
|
6
|
+
type ContainerProps = HTMLAttributes<HTMLDivElement> & {
|
|
7
|
+
backgroundColor?: string;
|
|
8
|
+
spacing?: SpaceType | ViewPort<SpaceType>;
|
|
9
|
+
border?: string | ViewPort<string>;
|
|
10
|
+
fluidContent?: boolean;
|
|
11
|
+
height?: string | ViewPort<string>;
|
|
12
|
+
wrapperClassName?: string;
|
|
13
|
+
maxWidth?: string;
|
|
16
14
|
};
|
|
17
15
|
|
|
16
|
+
declare enum ContentAlignment {
|
|
17
|
+
Left = "left",
|
|
18
|
+
Center = "center",
|
|
19
|
+
Right = "right"
|
|
20
|
+
}
|
|
21
|
+
declare enum BannerVariants {
|
|
22
|
+
None = "",
|
|
23
|
+
Top = "top",
|
|
24
|
+
Bottom = "bottom"
|
|
25
|
+
}
|
|
26
|
+
type BannerProps = ContainerProps & {
|
|
27
|
+
iconColor?: string;
|
|
28
|
+
contentAlignment?: ContentAlignment;
|
|
29
|
+
floating?: boolean;
|
|
30
|
+
variant?: BannerVariants;
|
|
31
|
+
};
|
|
32
|
+
declare const _default: react.ComponentType<BannerProps>;
|
|
33
|
+
|
|
18
34
|
declare enum ButtonVariant {
|
|
19
35
|
Link = "link"
|
|
20
36
|
}
|
|
@@ -38,20 +54,10 @@ type ButtonProps = PropsWithChildren<{
|
|
|
38
54
|
hoverTextColor?: string;
|
|
39
55
|
}>;
|
|
40
56
|
|
|
41
|
-
type ContainerProps = HTMLAttributes<HTMLDivElement> & {
|
|
42
|
-
backgroundColor?: string;
|
|
43
|
-
spacing?: SpaceType | ViewPort<SpaceType>;
|
|
44
|
-
border?: string | ViewPort<string>;
|
|
45
|
-
fluidContent?: boolean;
|
|
46
|
-
height?: string | ViewPort<string>;
|
|
47
|
-
wrapperClassName?: string;
|
|
48
|
-
maxWidth?: string;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
57
|
type FooterProps = Omit<ContainerProps, 'height' | 'content'> & {
|
|
52
|
-
logo?:
|
|
53
|
-
copyright?:
|
|
54
|
-
content?:
|
|
58
|
+
logo?: ReactNode;
|
|
59
|
+
copyright?: ReactNode;
|
|
60
|
+
content?: ReactNode;
|
|
55
61
|
};
|
|
56
62
|
|
|
57
63
|
type HeaderProps = PropsWithChildren & Omit<ContainerProps, 'fluidContent' | 'height'> & {
|
|
@@ -61,4 +67,24 @@ type HeaderProps = PropsWithChildren & Omit<ContainerProps, 'fluidContent' | 'he
|
|
|
61
67
|
sticky?: boolean;
|
|
62
68
|
};
|
|
63
69
|
|
|
64
|
-
|
|
70
|
+
type IconLabelProps = {
|
|
71
|
+
icon?: ReactNode;
|
|
72
|
+
children: ReactElement | string;
|
|
73
|
+
textClassName?: string;
|
|
74
|
+
iconClassName?: string;
|
|
75
|
+
className?: string;
|
|
76
|
+
text?: string;
|
|
77
|
+
tag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span';
|
|
78
|
+
size?: TextProps['size'];
|
|
79
|
+
color?: string;
|
|
80
|
+
weight?: TextProps['weight'];
|
|
81
|
+
font?: string;
|
|
82
|
+
alignment?: TextProps['alignment'];
|
|
83
|
+
transform?: TextProps['transform'];
|
|
84
|
+
decoration?: TextProps['decoration'];
|
|
85
|
+
letterSpacing?: TextProps['letterSpacing'];
|
|
86
|
+
iconPosition?: 'left' | 'right';
|
|
87
|
+
lineCountRestrictions?: string;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export { type ButtonProps as B, type ContainerProps as C, type FooterProps as F, type HeaderProps as H, type IconLabelProps as I, _default as _, ButtonVariant as a, type BannerProps as b, ContentAlignment as c };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { ViewPort } from './types/cskTypes.mjs';
|
|
3
|
+
|
|
4
|
+
type TextProps = {
|
|
5
|
+
className?: string;
|
|
6
|
+
size?: string | ViewPort<string>;
|
|
7
|
+
color?: string;
|
|
8
|
+
weight?: string;
|
|
9
|
+
font?: string;
|
|
10
|
+
transform?: 'uppercase' | 'lowercase' | 'capitalize' | 'normal-case';
|
|
11
|
+
decoration?: 'underline' | 'overline' | 'line-through' | 'no-underline';
|
|
12
|
+
letterSpacing?: string;
|
|
13
|
+
children: ReactElement | string;
|
|
14
|
+
alignment?: 'left' | 'center' | 'right';
|
|
15
|
+
lineCountRestrictions?: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type { TextProps as T };
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as w,b as y,c as x,d as E,e as F,f as S,g as P,h as R,i as $,j as I,k as _}from"./chunk-Y337A266.mjs";import{program as V}from"commander";import g from"path";import*as b from"ora";import{dirname as N}from"path";import{fileURLToPath as ee}from"url";import{checkbox as te}from"@inquirer/prompts";import U from"fs";var q=(r,t)=>U.readdirSync(r,{withFileTypes:!0}).filter(e=>t==="folder"?e.isDirectory():e.isFile()).map(e=>e.name),T=r=>q(r,"folder");import f from"fs";import a from"path";import{confirm as z}from"@inquirer/prompts";var K=async r=>{f.existsSync(r)||await f.promises.mkdir(r,{recursive:!0})};var O=r=>{let t=y.find(o=>f.existsSync(r+o));if(t)return r+t;let e=y.find(o=>f.existsSync(a.join(r,`index${o}`)));if(e)return a.join(r,`index${e}`)},Q=r=>{let e=f.readFileSync(r,"utf8").match(w)?.map(n=>n.replace(/['"]/g,"")),o=e?.filter(n=>n.startsWith("@/")).map(n=>n.replace("@/","")),s=e?.filter(n=>!n.startsWith("@/")).map(n=>n);return{aliases:o,relativePaths:s}},h=async(r,t,e)=>{e.add(r);let{aliases:o=[],relativePaths:s=[]}=Q(r);if(o.length)for(let n of o){let i=O(a.join(t,n));i&&!e.has(i)&&await h(i,t,e)}if(s.length)for(let n of s){let i=O(a.join(a.dirname(r),n));i&&!e.has(i)&&await h(i,t,e)}},j=5,A=async(r,t,e,o,s)=>{try{let n=new Set;s?.start("Searching for all canvas components and their dependencies...");for(let c of e){let l=a.join(r,c),d=f.readdirSync(l,{withFileTypes:!0}).filter(m=>m.isFile()&&x.includes(m.name));for(let m of d)await h(a.join(m?.path||m.parentPath,m.name),o,n)}let i=Array.from(n),p=i.filter(c=>{let l=a.join(t,a.relative(o,c));return f.existsSync(l)&&f.readFileSync(l,"utf8")!==f.readFileSync(c,"utf8")}),u=await(async()=>{if(!p.length)return!0;s?.stop();let c=p.slice(0,j).map(d=>a.relative(process.cwd(),a.join(t,a.relative(o,d)))).join(`
|
|
2
2
|
`),l=p.length>j?`
|
|
3
3
|
...`:"";return z({message:`Found ${p.length} files that will be overridden:
|
|
4
4
|
${c}${l}
|
|
5
|
-
Do you want to override them?`})})()?i:i.filter(c=>!p.includes(c));s?.start("Extracting canvas components and their dependencies...");for(let c of u){let l=a.join(t,a.relative(o,c));await K(a.dirname(l)),await f.promises.copyFile(c,l)}}catch(n){throw s?.stop(),n}};import v from"
|
|
6
|
-
${t}`)),Z=(r,t,e,o)=>r.replace(E,s=>{let n=new RegExp(S(t));if(n.test(s))return o?.info(`Registration key already in use. Overriding with ${e}.`),s.replace(n,`${t}:
|
|
5
|
+
Do you want to override them?`})})()?i:i.filter(c=>!p.includes(c));s?.start("Extracting canvas components and their dependencies...");for(let c of u){let l=a.join(t,a.relative(o,c));await K(a.dirname(l)),await f.promises.copyFile(c,l)}}catch(n){throw s?.stop(),n}};import v from"fs";import G from"path";import{exec as Y}from"child_process";import B from"prettier";var W=async r=>new Promise((t,e)=>{Y(r,(o,s,n)=>{if(o){e(o.message);return}if(n){e(n);return}t(s)})}),k=(r,t)=>B.format(r,{parser:"typescript",printWidth:120,singleQuote:!0,semi:!0,trailingComma:"es5",tabWidth:2,arrowParens:"avoid",endOfLine:"auto",...t});var D={DemoHero:(r,t)=>[{componentName:"DemoHero.FlexibleHero",importSection:t,componentId:"flexibleHero"},{componentName:"DemoHero.FixedHero",importSection:t,componentId:"fixedHero"}]},L=r=>r.reduce((t,e)=>{let o=`import ${e} from './${e}';`;if(D[e])return[...t,...D[e](e,o)];let s=_[e];return[...t,{componentName:e,importSection:o,componentId:s}]},[]);var J=(r,t,e,o)=>r.replace(F,s=>r.includes(t)?(o?.info(`Import for this component already exists. Skipping for ${e}.`),s):(o?.info(`Import for ${e} added successfully.`),`${s}
|
|
6
|
+
${t}`)),Z=(r,t,e,o)=>r.replace(E,s=>{let n=new RegExp(S(t));if(n.test(s))return o?.info(`Registration key already in use. Overriding with ${e}.`),s.replace(n,`${t}: ${e},`);o?.info(`Registration for ${e} added to the resolver.`);let i=`${t}: ${e},`;return s.replace(P,`${i}}`)}),H=async(r,t,e)=>{try{let o=G.join(r,"components","canvas","index.ts");if(!v.existsSync(o)){e?.fail("Canvas resolver file not found. Please check the main canvas resolver before running to ensure that extracted components are properly added.");return}let s=await v.promises.readFile(o,"utf-8"),n=s===R?$:s,p=L(t).reduce((c,{componentName:l,importSection:d,componentId:m})=>Z(J(c,d,l,e),m,l,e),n),C=await k(p);await v.promises.writeFile(o,C);let u=G.relative(process.cwd(),o);await W(`npx eslint ${u} --fix`).catch(()=>e?.fail("Could not format your resolver file using your lint configuration. Please check it before running.")),e?.succeed(`Canvas components successfully registered in ${o}`)}catch(o){throw e?.stop(),o}};var re=ee(import.meta.url),oe=N(re),X=g.resolve(oe,"content"),M=async r=>{try{let t=b.default(),e=g.resolve(X,"components","canvas"),o=T(e);if(r.some(n=>{let i=o.includes(n);return i||console.error("Invalid component name:",n),!i}))return;if(t.info("Welcome to Uniform Extractor"),r.length)t.info("Canvas components to extract:"),t.info(`${r.join(", ")};`);else{let n=await te({message:"Select the canvas components to extract:",choices:o.map((i,p)=>({value:p,name:i})),loop:!1,instructions:!0,required:!0});r=o.filter((i,p)=>n.includes(p))}t.start("Extracting canvas components and their dependencies..."),await A(g.resolve(e),g.resolve(process.cwd(),"src"),r,X,t),t.succeed("Canvas components and their dependencies successfully extracted"),t?.start("Starting registration...");let s=g.resolve(process.cwd(),"src");await H(s,r,t);return}catch(t){t instanceof Error&&(t.message.includes("force closed")?console.info(`
|
|
7
7
|
\u{1F44B} See you next time! \u{1F9E1}
|
|
8
8
|
`):console.error(`
|
|
9
9
|
\u{1F641} Something went wrong. Please try again.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{a as u,b as s}from"./chunk-NKINOJY6.mjs";import{a as o}from"./chunk-7GVG4HLE.mjs";import{c as n}from"./chunk-S7CSCIW4.mjs";import{useState as C}from"react";import{jsx as e,jsxs as l}from"react/jsx-runtime";var B=({isOpen:t,onClick:i,color:a})=>e("button",{onClick:i,"aria-label":"Menu",className:n("w-7 h-7 relative focus:outline-none"),children:l("div",{className:"absolute left-1/2 top-1/2 block w-7 -translate-x-1/2 -translate-y-1/2",children:[e("span",{"aria-hidden":"true",className:n("block absolute h-0.5 w-7 transform transition duration-500 ease-in-out",{"rotate-45":t," -translate-y-2":!t,[`bg-${a}`]:!!a})}),e("span",{"aria-hidden":"true",className:n("block absolute h-0.5 w-7 transform transition duration-500 ease-in-out",{"opacity-0":t,[`bg-${a}`]:!!a})}),e("span",{"aria-hidden":"true",className:n("block absolute h-0.5 w-7 transform transition duration-500 ease-in-out",{"-rotate-45":t," translate-y-2":!t,[`bg-${a}`]:!!a})})]})}),G=({leftSection:t,rightSection:i,children:a,backgroundColor:m,spacing:c,border:d,className:p,color:f})=>{let[r,b]=C(!1);return l("nav",{children:[e(o,{id:"mobile-header",fluidContent:!0,backgroundColor:m,spacing:c,border:d,className:p,children:l(u,{className:"items-center",columnsCount:"12",children:[e(s,{columnSpan:"span-2",children:e(B,{isOpen:r,onClick:()=>{b(v=>!v)},color:f})}),e(s,{columnSpan:"span-6",children:e("div",{className:"flex items-center justify-start",children:t})}),e(s,{columnSpan:"span-4",children:e("div",{className:"flex items-center justify-end gap-x-4",children:i})})]})}),e(o,{fluidContent:!0,className:n({"min-h-screen":r}),backgroundColor:m,children:r&&e("div",{className:"size-full py-8",children:e("div",{className:"flex flex-col items-center justify-center gap-y-8",children:a})})})]})};export{G as MobileHeader};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{b as m}from"./chunk-AWTML4I7.mjs";import{a}from"./chunk-OKUDTS22.mjs";import{UniformSlot as r}from"@uniformdev/next-app-router/component";import{jsx as t}from"react/jsx-runtime";var d=({slots:o,maxWidth:e,backgroundColor:l,closeIconColor:i,disableCloseModalOnClickOutside:n})=>t(m,{maxWidth:e,backgroundColor:l,closeIconColor:i,disableCloseModalOnClickOutside:n,trigger:t(r,{slot:o.trigger}),content:t(r,{slot:o.modalContent}),actions:o?.modalActions?.items?.length&&t(r,{slot:o.modalActions})}),M=a(d);export{M as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{a as g}from"./chunk-AWTML4I7.mjs";import{c as s}from"./chunk-S7CSCIW4.mjs";import{useCallback as m,useState as B,useRef as L,useEffect as k}from"react";import{jsx as v}from"react/jsx-runtime";var h=({className:o,...l})=>v("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:s("size-8",o),...l,children:v("path",{d:"m16.192 6.344-4.243 4.242-4.242-4.242-1.414 1.414L10.535 12l-4.242 4.242 1.414 1.414 4.242-4.242 4.243 4.242 1.414-1.414L13.364 12l4.242-4.242z"})});var P=({showModal:o})=>s("fixed left-0 top-0 size-full",{hidden:!o,block:o}),M=({maxWidth:o,backgroundColor:l})=>s("rounded-lg shadow-lg relative",g[o||"small"],{[`bg-${l}`]:!!l}),b=({disableCloseModalOnClickOutside:o})=>s("group absolute right-4 top-4 opacity-40 hover:opacity-100",{hidden:o});import{jsx as e,jsxs as x}from"react/jsx-runtime";var O=({trigger:o,content:l,actions:p,maxWidth:E,backgroundColor:F,closeIconColor:f,disableCloseModalOnClickOutside:a,onChangeModalState:i,className:w})=>{let n=L(null),[r,c]=B(!1);k(()=>{i&&i(r)},[r,i]);let N=m(()=>{a||c(!1)},[a]),u=m(()=>{c(t=>!t)},[]),y=m(t=>{t.stopPropagation()},[]);return k(()=>{if(!n.current)return;let t=n.current.querySelectorAll("button, a"),C=()=>c(!1);return t.forEach(d=>{d.addEventListener("click",C)}),()=>t.forEach(d=>{d.removeEventListener("click",C)})},[]),x("div",{children:[e("div",{onClick:u,children:o}),e("div",{className:P({showModal:r}),children:e("dialog",{open:r,onClick:N,"aria-label":"Close modal","aria-modal":"true",className:"flex size-full items-center justify-center bg-black/50 px-4",children:x("form",{method:"dialog",className:s(M({maxWidth:E,backgroundColor:F}),w),onClick:y,children:[e("button",{onClick:u,className:b({disableCloseModalOnClickOutside:a}),children:e(h,{className:s({[`fill-${f}`]:f})})}),e("div",{className:"p-6 md:p-8",children:l}),p&&e("div",{ref:n,className:"border-t p-6 md:p-8",children:p})]})})})]})};export{O as Modal};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{a as k}from"./chunk-6CKVLOIH.mjs";import{a as x}from"./chunk-6TUDWIYU.mjs";import{a as b,b as g}from"./chunk-NKINOJY6.mjs";import{a as h}from"./chunk-BK7UG4U4.mjs";import"./chunk-7GVG4HLE.mjs";import"./chunk-WAW7PQYM.mjs";import{a as m,c as o}from"./chunk-S7CSCIW4.mjs";import{a as P}from"./chunk-OKUDTS22.mjs";import{useCallback as L,useMemo as j,useState as tt}from"react";import{UniformText as ot}from"@uniformdev/next-app-router/component";import{UniformSlot as w}from"@uniformdev/next-app-router/component";import{jsx as r,jsxs as K}from"react/jsx-runtime";var I=({isOpen:t,backgroundColor:a,slots:e,border:s,hasRightContent:i})=>r("div",{className:o("absolute z-10 w-max left-1/2 -translate-x-1/2 pt-4",{hidden:!t,block:t,"w-full md:w-[460px]":!i,"w-full md:w-[460px] xl:w-[768px]":i}),children:r("div",{className:o("p-8",{[`bg-${a}`]:!!a,[m(s,"{value}")]:s}),children:K(b,{columnsCount:"2",gapX:"4",children:[r(g,{children:r("div",{className:"flex flex-col gap-y-4",children:r(w,{slot:e.navigationFlyoutLeftContent})})}),r(g,{children:r(w,{slot:e.navigationFlyoutRightContent})})]})})});import{useEffect as Q,useState as Y}from"react";import{UniformSlot as B}from"@uniformdev/next-app-router/component";import{jsx as p,jsxs as R}from"react/jsx-runtime";var Z=()=>{let[t,a]=Y(0);return Q(()=>{let e=document.getElementById("mobile-header");e&&a(e.offsetHeight)},[]),t},H=({isOpen:t,backgroundColor:a,slots:e,onClose:s})=>{let i=Z();return R("div",{style:{top:i},className:o("fixed left-0 right-0 bottom-0 z-10 w-full pt-4",{[`bg-${a}`]:!!a,hidden:!t,block:t}),children:[p("button",{onClick:s,className:"w-max rotate-180 px-4",children:p(x,{})}),R("div",{className:"flex flex-col items-center justify-center gap-y-8 p-4",children:[p(B,{slot:e.navigationFlyoutLeftContent}),p(B,{slot:e.navigationFlyoutRightContent})]})]})};var M=({isOpen:t})=>o("transition transform hidden md:block",{"rotate-180":t,"rotate-0":!t}),G=({color:t})=>o("flex items-center gap-x-2",{[`text-${t}`]:!!t});import{jsx as n,jsxs as O}from"react/jsx-runtime";var et=({icon:t,caretIcon:a,backgroundColor:e,border:s,size:i,tag:D,color:v,weight:S,font:U,transform:$,decoration:A,letterSpacing:T,alignment:W,component:c,context:d,slots:l,hoverEffect:f="",className:E,parameters:V})=>{let[u,C]=tt(!1),_=L(()=>C(!0),[]),y=L(()=>C(!1),[]),z=j(()=>!!l?.navigationFlyoutRightContent?.items?.filter(J=>!J?._id.startsWith("placeholder_"))?.length,[l]),N=o("transition-all duration-150",{[m(f,"group-hover:{value}")]:!!f}),[X]=a||[],{url:F,title:q=""}=X||{};return O("div",{className:"relative",onMouseLeave:y,children:[O("button",{onMouseEnter:_,className:G({color:v}),children:[n(k,{icon:t,className:o("group",E),iconClassName:N,textClassName:N,size:i,tag:D,color:v,weight:S,font:U,transform:$,decoration:A,letterSpacing:T,alignment:W,children:n(ot,{placeholder:"Text goes here",parameter:V.text,component:c})}),F&&n("div",{className:o("relative size-[1em]",M({isOpen:u}),{[`text-${i}`]:!!i}),children:n(h,{src:F,alt:q,fill:!0})})]}),n("div",{className:"hidden md:block",children:n(I,{hasRightContent:z,isOpen:u,backgroundColor:e,context:d,slots:l,border:s,component:c})}),n("div",{className:"block md:hidden",children:n(H,{onClose:y,isOpen:u,backgroundColor:e,context:d,slots:l,border:s,component:c})})]})},Ht=P(et);export{Ht as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{a as x}from"./chunk-6CKVLOIH.mjs";import{a as h}from"./chunk-6TUDWIYU.mjs";import{a as b}from"./chunk-BK7UG4U4.mjs";import"./chunk-WAW7PQYM.mjs";import{a as n,c as t}from"./chunk-S7CSCIW4.mjs";import{a as G}from"./chunk-OKUDTS22.mjs";import{useCallback as I,useState as Q}from"react";import{UniformText as X}from"@uniformdev/next-app-router/component";import{UniformSlot as V}from"@uniformdev/next-app-router/component";import{jsx as p}from"react/jsx-runtime";var k=({isOpen:o,backgroundColor:e,slots:a,border:i})=>p("div",{className:t("absolute left-0 max-w-64 z-10 pt-4",{hidden:!o,block:o}),children:p("div",{className:t({[`bg-${e}`]:!!e,[n(i,"{value}")]:i}),children:p("div",{className:"flex flex-col gap-y-4 p-4",children:p(V,{slot:a.links})})})});import{useEffect as W,useState as z}from"react";import{UniformSlot as q}from"@uniformdev/next-app-router/component";import{jsx as l,jsxs as K}from"react/jsx-runtime";var J=()=>{let[o,e]=z(0);return W(()=>{let a=document.getElementById("mobile-header");a&&e(a.offsetHeight)},[]),o},y=({isOpen:o,backgroundColor:e,slots:a,onClose:i})=>{let s=J();return K("div",{style:{top:s},className:t("fixed left-0 right-0 bottom-0 z-10 w-full pt-4",{[`bg-${e}`]:!!e,hidden:!o,block:o}),children:[l("button",{onClick:i,className:"w-max rotate-180 px-4",children:l(h,{})}),l("div",{className:"flex flex-col items-center gap-y-4 p-4",children:l(q,{slot:a.links})})]})};var F=({isOpen:o})=>t("transition transform hidden md:block",{"rotate-180":o,"rotate-0":!o}),B=({color:o})=>t("flex items-center gap-x-2",{[`text-${o}`]:!!o});import{jsx as r,jsxs as w}from"react/jsx-runtime";var Y=({icon:o,caretIcon:e,backgroundColor:a,border:i,size:s,tag:H,color:c,weight:M,font:O,transform:D,decoration:R,letterSpacing:S,alignment:U,component:$,context:u,slots:v,hoverEffect:d="",className:A,parameters:L})=>{let[m,g]=Q(!1),f=I(()=>g(!0),[]),N=I(()=>g(!1),[]),C=t("transition-all duration-150",{[n(d,"group-hover:{value}")]:!!d}),[T]=e||[],{url:P,title:E=""}=T||{};return w("div",{className:"relative",onMouseLeave:N,children:[w("button",{onMouseEnter:f,onClick:f,className:B({color:c}),children:[r(x,{icon:o,className:t("group",A),iconClassName:C,textClassName:C,size:s,tag:H,color:c,weight:M,font:O,transform:D,decoration:R,letterSpacing:S,alignment:U,children:r(X,{placeholder:"Text goes here",parameter:L.text,component:$})}),P&&r("div",{className:t("relative size-[1em]",F({isOpen:m}),{[`text-${s}`]:!!s}),children:r(b,{src:P,alt:E,fill:!0})})]}),r("div",{className:"hidden md:block",children:r(k,{isOpen:m,backgroundColor:a,context:u,slots:v,border:i})}),r("div",{className:"block md:hidden",children:r(y,{onClose:N,isOpen:m,backgroundColor:a,context:u,slots:v})})]})},xo=G(Y);export{xo as default};
|