@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260323045408 → 0.8.1-dev.20260323055150

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.
Files changed (3) hide show
  1. package/dist/index.js +1102 -178
  2. package/dist/index.mjs +1102 -178
  3. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1387,7 +1387,7 @@ var SelectWithSearchPanel = (props) => {
1387
1387
  const containerRef = useRef2(null);
1388
1388
  const [isCreateOpen, setIsCreateOpen] = useState5(false);
1389
1389
  const [formData, setFormData] = useState5({});
1390
- const getNestedValue = (obj, path) => {
1390
+ const getNestedValue2 = (obj, path) => {
1391
1391
  return path.split(".").reduce((acc, key) => acc?.[key], obj);
1392
1392
  };
1393
1393
  useEffect4(() => {
@@ -1425,7 +1425,7 @@ var SelectWithSearchPanel = (props) => {
1425
1425
  props.dataSourceDependsOn
1426
1426
  ]);
1427
1427
  const filteredItems = list?.filter((item) => {
1428
- const value = getNestedValue(item, props.dataTextFieldName);
1428
+ const value = getNestedValue2(item, props.dataTextFieldName);
1429
1429
  return value?.toLowerCase().includes(searchTerm?.toLowerCase());
1430
1430
  });
1431
1431
  const playBeep = () => {
@@ -1456,7 +1456,7 @@ var SelectWithSearchPanel = (props) => {
1456
1456
  }, [searchTerm]);
1457
1457
  const handleSelect = (event, item) => {
1458
1458
  event.preventDefault();
1459
- setSearchTerm(getNestedValue(item, props.dataTextFieldName));
1459
+ setSearchTerm(getNestedValue2(item, props.dataTextFieldName));
1460
1460
  if (props.callback) {
1461
1461
  const val = {};
1462
1462
  props.callback({
@@ -1603,7 +1603,7 @@ var SelectWithSearchPanel = (props) => {
1603
1603
  role: "option",
1604
1604
  tabIndex: -1,
1605
1605
  onMouseEnter: () => setHighlightedIndex(index),
1606
- children: /* @__PURE__ */ jsx27("span", { children: getNestedValue(item, props.dataTextFieldName) })
1606
+ children: /* @__PURE__ */ jsx27("span", { children: getNestedValue2(item, props.dataTextFieldName) })
1607
1607
  }
1608
1608
  ) }, item[props.dataKeyFieldName])) : /* @__PURE__ */ jsx27("div", { className: "px-4 py-2 text-gray-500", children: "No results found" })
1609
1609
  }
@@ -1905,51 +1905,146 @@ var OdataBuilder = class {
1905
1905
  this.baseUrl = url;
1906
1906
  this.top = Constants.pagesize.toString();
1907
1907
  this.skip = "0";
1908
+ this.keyword = "";
1908
1909
  this.filterBy = "";
1909
1910
  this.orderBy = "";
1910
1911
  }
1912
+ // parseSearchParams(ReadonlyUrlSearchParams): DataQuery {
1913
+ // this.top = top;
1914
+ // return this;
1915
+ // }
1911
1916
  setQuery(odata) {
1912
- if (!odata) return this;
1913
- if (odata["$skip"]) this.skip = odata["$skip"];
1914
- if (odata["$top"]) this.top = odata["$top"];
1915
- if (odata["$filter"]) this.filterBy = odata["$filter"];
1916
- if (odata["$orderby"]) this.orderBy = odata["$orderby"];
1917
+ if (odata) {
1918
+ for (const key in odata) {
1919
+ if (odata[key] != null && odata[key] != "") {
1920
+ if (key == "$skip") {
1921
+ this.setSkip(odata[key]);
1922
+ }
1923
+ if (key == "$filter") {
1924
+ this.setFilter(odata[key]);
1925
+ }
1926
+ if (key == "$top") {
1927
+ this.setTop(odata[key]);
1928
+ }
1929
+ if (key == "$orderby") {
1930
+ this.setOrderBy(odata[key]);
1931
+ }
1932
+ }
1933
+ }
1934
+ }
1935
+ return this;
1936
+ }
1937
+ // parseKeyValuePairs(inputString: string): { [key: string]: string } {
1938
+ // return inputString.split('$')
1939
+ // .map((pair) => pair.split('='))
1940
+ // .reduce((result: { [key: string]: string }, [key, value]) => {
1941
+ // if (key && value) {
1942
+ // result[key.trim()] = value.trim();
1943
+ // }
1944
+ // return result;
1945
+ // }, {});
1946
+ // }
1947
+ static getOdataQueryString(obj, defaultOrder) {
1948
+ let queryString = "";
1949
+ let skip = (obj && obj["$skip"]) ?? "0";
1950
+ let top = (obj && obj["$top"]) ?? Constants.pagesize.toString();
1951
+ queryString = `$skip=${skip}&$top=${top}&$count=true`;
1952
+ if (obj) {
1953
+ if (obj["$filter"] && obj["$filter"] !== null && obj["$filter"] !== "") {
1954
+ queryString = queryString + `&$filter=${encodeURIComponent(obj["$filter"])}`;
1955
+ }
1956
+ if (obj["$orderby"] && obj["$orderby"] !== null && obj["$orderby"] !== "") {
1957
+ queryString = queryString + `&$orderby=${encodeURIComponent(obj["$orderby"])}`;
1958
+ } else if (defaultOrder) {
1959
+ queryString = queryString + `&$orderby=${encodeURIComponent(defaultOrder)}`;
1960
+ }
1961
+ } else {
1962
+ if (defaultOrder) {
1963
+ queryString = queryString + `&$orderby=${encodeURIComponent(defaultOrder)}`;
1964
+ }
1965
+ }
1966
+ return queryString;
1967
+ }
1968
+ setTop(top) {
1969
+ this.top = top;
1970
+ return this;
1971
+ }
1972
+ setSkip(skip) {
1973
+ this.skip = skip;
1974
+ return this;
1975
+ }
1976
+ setKeyword(keyword) {
1977
+ this.keyword = keyword;
1978
+ return this;
1979
+ }
1980
+ setFilter(filterBy) {
1981
+ this.filterBy = filterBy;
1982
+ return this;
1983
+ }
1984
+ setOrderBy(orderBy) {
1985
+ this.orderBy = orderBy;
1917
1986
  return this;
1918
1987
  }
1919
1988
  getPageNumber(pageSize) {
1920
- const skip = parseInt(this.skip);
1921
- const top = parseInt(this.top);
1922
- if (!isNaN(skip) && !isNaN(top)) {
1923
- return skip / pageSize + 1;
1989
+ let pageNumber = 1;
1990
+ if (this.skip && this.top) {
1991
+ const skip = parseInt(this.skip);
1992
+ const top = parseInt(this.top);
1993
+ if (!isNaN(skip) && !isNaN(top)) {
1994
+ pageNumber = skip / pageSize + 1;
1995
+ }
1924
1996
  }
1925
- return 1;
1997
+ return pageNumber;
1998
+ }
1999
+ getUrl() {
2000
+ let url = `${this.baseUrl}?$skip=${this.skip}&$top=${this.top}&$count=true`;
2001
+ if (this.filterBy !== null && this.filterBy !== "") {
2002
+ url = url + `&$filter=${encodeURIComponent(this.filterBy)}`;
2003
+ }
2004
+ if (this.orderBy !== null && this.orderBy !== "") {
2005
+ url = url + `&$orderby=${encodeURIComponent(this.orderBy)}`;
2006
+ }
2007
+ console.log(url);
2008
+ return url;
1926
2009
  }
1927
2010
  getNewOrderByUrl(orderBy) {
1928
- let url = `${this.baseUrl}?$skip=0&$top=${this.top}&$count=true`;
1929
- if (this.filterBy) {
1930
- url += `&$filter=${encodeURIComponent(this.filterBy)}`;
2011
+ let url = `${this.baseUrl}?$skip=${0}&$top=${this.top}&$count=true`;
2012
+ if (this.filterBy !== null && this.filterBy !== "") {
2013
+ url = url + `&$filter=${encodeURIComponent(this.filterBy)}`;
1931
2014
  }
1932
- url += `&$orderby=${encodeURIComponent(orderBy)}`;
2015
+ url = url + `&$orderby=${encodeURIComponent(orderBy)}`;
1933
2016
  return url;
1934
2017
  }
1935
2018
  getNewFilterUrl(filterBy) {
1936
- let url = `${this.baseUrl}?$skip=0&$top=${this.top}&$count=true`;
1937
- if (filterBy) {
1938
- url += `&$filter=${encodeURIComponent(filterBy)}`;
2019
+ let url = `${this.baseUrl}?$skip=${0}&$top=${this.top}&$count=true`;
2020
+ if (filterBy !== null && filterBy !== "") {
2021
+ url = url + `&$filter=${encodeURIComponent(filterBy)}`;
1939
2022
  }
1940
- if (this.orderBy) {
1941
- url += `&$orderby=${encodeURIComponent(this.orderBy)}`;
2023
+ if (this.orderBy !== null && this.orderBy !== "") {
2024
+ url = url + `&$orderby=${encodeURIComponent(this.orderBy)}`;
1942
2025
  }
1943
2026
  return url;
1944
2027
  }
1945
2028
  getNewPageUrl(page) {
1946
- const skip = page * Constants.pagesize - Constants.pagesize;
2029
+ let skip = page * Constants.pagesize - Constants.pagesize;
1947
2030
  let url = `${this.baseUrl}?$skip=${skip}&$top=${this.top}&$count=true`;
1948
- if (this.filterBy) {
1949
- url += `&$filter=${encodeURIComponent(this.filterBy)}`;
2031
+ if (this.filterBy !== null && this.filterBy !== "") {
2032
+ url = url + `&$filter=${encodeURIComponent(this.filterBy)}`;
1950
2033
  }
1951
- if (this.orderBy) {
1952
- url += `&$orderby=${encodeURIComponent(this.orderBy)}`;
2034
+ if (this.orderBy !== null && this.orderBy !== "") {
2035
+ url = url + `&$orderby=${encodeURIComponent(this.orderBy)}`;
2036
+ }
2037
+ return url;
2038
+ }
2039
+ getNewPageSizeUrl(pageSize) {
2040
+ const currentPage = this.getPageNumber(parseInt(this.top || Constants.pagesize.toString()));
2041
+ const skip = (currentPage - 1) * pageSize;
2042
+ let url = `${this.baseUrl}?$skip=${skip}&$top=${pageSize}&$count=true`;
2043
+ if (this.filterBy !== null && this.filterBy !== "") {
2044
+ url = url + `&$filter=${encodeURIComponent(this.filterBy)}`;
2045
+ }
2046
+ if (this.orderBy !== null && this.orderBy !== "") {
2047
+ url = url + `&$orderby=${encodeURIComponent(this.orderBy)}`;
1953
2048
  }
1954
2049
  return url;
1955
2050
  }
@@ -2505,7 +2600,7 @@ var DataList = (props) => {
2505
2600
  var DataList_default = DataList;
2506
2601
 
2507
2602
  // src/components/pageRenderingEngine/PageBodyRenderer.tsx
2508
- import React51 from "react";
2603
+ import React54 from "react";
2509
2604
 
2510
2605
  // src/components/pageRenderingEngine/nodes/ParagraphNode.tsx
2511
2606
  import React37 from "react";
@@ -2531,17 +2626,17 @@ var TextNode = (props) => {
2531
2626
  }
2532
2627
  return styleObject;
2533
2628
  }
2534
- function toCamelCase(str) {
2629
+ function toCamelCase2(str) {
2535
2630
  return str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
2536
2631
  }
2537
- function convertKeysToCamelCase(obj) {
2632
+ function convertKeysToCamelCase2(obj) {
2538
2633
  if (Array.isArray(obj)) {
2539
- return obj.map(convertKeysToCamelCase);
2634
+ return obj.map(convertKeysToCamelCase2);
2540
2635
  } else if (obj !== null && typeof obj === "object") {
2541
2636
  return Object.fromEntries(
2542
2637
  Object.entries(obj).filter(([_, value]) => value !== "").map(([key, value]) => [
2543
- toCamelCase(key),
2544
- convertKeysToCamelCase(value)
2638
+ toCamelCase2(key),
2639
+ convertKeysToCamelCase2(value)
2545
2640
  ])
2546
2641
  );
2547
2642
  }
@@ -2561,7 +2656,7 @@ var TextNode = (props) => {
2561
2656
  if (format === 1024) classes.push("capitalize");
2562
2657
  return classes.join(" ");
2563
2658
  }
2564
- const styles = convertKeysToCamelCase(cssStringToJson(props.node.style));
2659
+ const styles = convertKeysToCamelCase2(cssStringToJson(props.node.style));
2565
2660
  function replacePlaceholders(template, dataItem) {
2566
2661
  return template.replace(/{(\w+)}/g, (_, key) => {
2567
2662
  return key in dataItem ? dataItem[key] : `{${key}}`;
@@ -2682,13 +2777,13 @@ var DatafieldNode = (props) => {
2682
2777
  }
2683
2778
  return styleObject;
2684
2779
  }
2685
- function toCamelCase(str) {
2780
+ function toCamelCase2(str) {
2686
2781
  return str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
2687
2782
  }
2688
- function convertKeysToCamelCase(obj) {
2783
+ function convertKeysToCamelCase2(obj) {
2689
2784
  if (!obj || typeof obj !== "object") return obj;
2690
2785
  return Object.fromEntries(
2691
- Object.entries(obj).map(([key, value2]) => [toCamelCase(key), value2])
2786
+ Object.entries(obj).map(([key, value2]) => [toCamelCase2(key), value2])
2692
2787
  );
2693
2788
  }
2694
2789
  const Formats = [
@@ -2705,7 +2800,7 @@ var DatafieldNode = (props) => {
2705
2800
  "italic underline",
2706
2801
  "italic underline font-medium"
2707
2802
  ];
2708
- const styles = convertKeysToCamelCase(cssStringToJson(props.node.style));
2803
+ const styles = convertKeysToCamelCase2(cssStringToJson(props.node.style));
2709
2804
  const fieldName = props.node.fieldName;
2710
2805
  const value = props.dataitem ? getNestedProperty(props.dataitem, fieldName) : null;
2711
2806
  console.log(fieldName, value, "haha");
@@ -3534,68 +3629,817 @@ var FormContainerNode = (props) => {
3534
3629
  var FormContainerNode_default = FormContainerNode;
3535
3630
 
3536
3631
  // src/components/pageRenderingEngine/nodes/DivContainer.tsx
3537
- import React50 from "react";
3538
- import Link3 from "next/link";
3632
+ import React53 from "react";
3633
+
3634
+ // src/components/utilities/AnimationUtility.tsx
3635
+ var AnimationUtility = class {
3636
+ static generateAnimationCSS(config, guid) {
3637
+ const {
3638
+ duration = 700,
3639
+ delay = 0,
3640
+ easing = "ease-out",
3641
+ distance = 30,
3642
+ scaleStart = 1,
3643
+ scaleEnd = 1.2,
3644
+ repeat = 1,
3645
+ intensity = 20,
3646
+ speedPerChar = 100,
3647
+ cursor = true,
3648
+ mode = "enter",
3649
+ direction = "left"
3650
+ // Default direction
3651
+ } = config;
3652
+ let base = "", visible = "", keyframes = "";
3653
+ switch (config.animation) {
3654
+ case "Fade":
3655
+ base = `opacity:0; transition:opacity ${duration}ms ${easing} ${delay}ms;`;
3656
+ visible = `opacity:1;`;
3657
+ break;
3658
+ case "FadeInUp":
3659
+ base = `opacity:0; transform:translateY(${distance}px); transition:all ${duration}ms ${easing} ${delay}ms;`;
3660
+ visible = `opacity:1; transform:translateY(0);`;
3661
+ break;
3662
+ case "Slide":
3663
+ const slideTransform = this.getSlideTransform(direction, distance);
3664
+ base = `opacity:0; transform:${slideTransform.start}; transition:all ${duration}ms ${easing} ${delay}ms; will-change: transform, opacity;`;
3665
+ visible = `opacity:1; transform:${slideTransform.end}; will-change: unset;`;
3666
+ break;
3667
+ case "ZoomIn":
3668
+ if (mode === "enter") {
3669
+ base = `opacity:0; transform:scale(${scaleStart}); transition:all ${duration}ms ${easing} ${delay}ms;`;
3670
+ visible = `opacity:1; transform:scale(${scaleEnd});`;
3671
+ } else {
3672
+ base = `transform:scale(${scaleStart}); transition:transform ${duration / 1e3}s ${easing} ${delay / 1e3}s;`;
3673
+ visible = `transform:scale(${scaleEnd});`;
3674
+ }
3675
+ break;
3676
+ case "Bounce":
3677
+ keyframes = `
3678
+ @keyframes bounce {
3679
+ 0%,20%,50%,80%,100% { transform: translateY(0); }
3680
+ 40% { transform: translateY(-${intensity}px); }
3681
+ 60% { transform: translateY(-${intensity / 2}px); }
3682
+ }
3683
+ `;
3684
+ if (mode === "enter") {
3685
+ base = `opacity:0;`;
3686
+ visible = `opacity:1; animation:bounce ${duration}ms ${easing} ${delay}ms ${repeat};`;
3687
+ } else {
3688
+ base = ``;
3689
+ visible = `animation:bounce ${duration / 1e3}s ${easing} ${delay / 1e3}s ${repeat};`;
3690
+ }
3691
+ break;
3692
+ case "Typewriter":
3693
+ keyframes = `
3694
+ @keyframes typewriter { from { width: 0 } to { width: 100% } }
3695
+ @keyframes blink { 50% { border-color: transparent } }
3696
+ `;
3697
+ base = `
3698
+ overflow:hidden;
3699
+ border-right:${cursor ? "2px solid black" : "none"};
3700
+ white-space:nowrap;
3701
+ width:0;
3702
+ margin:0 auto;
3703
+ `;
3704
+ visible = `
3705
+ animation:typewriter ${speedPerChar * 30}ms steps(30,end) ${delay}ms forwards
3706
+ ${cursor ? ", blink .75s step-end infinite" : ""};
3707
+ `;
3708
+ break;
3709
+ }
3710
+ if (mode === "hover") {
3711
+ return `
3712
+ ${keyframes}
3713
+ ${guid} { ${base} }
3714
+ ${guid}:hover { ${visible} }
3715
+ `;
3716
+ } else {
3717
+ return `
3718
+ ${keyframes}
3719
+ ${guid} { ${base} }
3720
+ ${guid}.visible { ${visible} }
3721
+ `;
3722
+ }
3723
+ }
3724
+ // Helper method to generate slide transforms based on direction
3725
+ static getSlideTransform(direction, distance) {
3726
+ switch (direction) {
3727
+ case "left":
3728
+ return { start: `translateX(${distance}px)`, end: `translateX(0)` };
3729
+ case "right":
3730
+ return { start: `translateX(-${distance}px)`, end: `translateX(0)` };
3731
+ case "up":
3732
+ return { start: `translateY(${distance}px)`, end: `translateY(0)` };
3733
+ case "down":
3734
+ return { start: `translateY(-${distance}px)`, end: `translateY(0)` };
3735
+ default:
3736
+ return { start: `translateX(${distance}px)`, end: `translateX(0)` };
3737
+ }
3738
+ }
3739
+ };
3740
+ var AnimationUtility_default = AnimationUtility;
3741
+
3742
+ // src/components/Pagination.tsx
3743
+ import { useMemo } from "react";
3539
3744
  import { jsx as jsx65, jsxs as jsxs32 } from "react/jsx-runtime";
3540
- var DivContainer = (props) => {
3541
- const { cssProperties: styles, hoverCssProperties: hoverStyles, mobileCssProperties: mobileStyles } = props.node;
3542
- const updatedStyles = convertKeysToCamelCase(styles);
3543
- const NodeTypes2 = {
3544
- ["paragraph"]: ParagraphNode_default,
3545
- ["heading"]: HeadingNode_default,
3546
- ["list"]: ListNode_default,
3547
- ["quote"]: QuoteNode_default,
3548
- ["code"]: CodeNode_default,
3549
- ["image"]: ImageNode_default,
3550
- ["horizontalrule"]: HorizontalRuleNode_default,
3551
- ["layout-container"]: LayoutContainerNode_default,
3552
- ["widget"]: WidgetNode_default,
3553
- ["embed"]: EmbedNode_default,
3554
- ["div-container"]: DivContainer,
3555
- ["text"]: TextNode_default,
3556
- ["datafield"]: DatafieldNode_default,
3557
- ["svg-icon"]: SVGIconNode_default
3745
+ var Pagination = (props) => {
3746
+ const { dataset, path, query, showPageSizeSelector = false, showJumpToPage = false } = props;
3747
+ const builder = useMemo(() => {
3748
+ const b = new OdataBuilder(path);
3749
+ if (query) b.setQuery(query);
3750
+ return b;
3751
+ }, [path, query]);
3752
+ const activePageNumber = builder.getPageNumber(Constants.pagesize);
3753
+ const totalItems = dataset?.count || 0;
3754
+ const itemsPerPage = parseInt(builder.top || Constants.pagesize.toString());
3755
+ const totalPages = Math.ceil(totalItems / itemsPerPage);
3756
+ const startItem = totalItems > 0 ? (activePageNumber - 1) * itemsPerPage + 1 : 0;
3757
+ const endItem = Math.min(activePageNumber * itemsPerPage, totalItems);
3758
+ const getPaginationRange = () => {
3759
+ const delta = 1;
3760
+ const range = [];
3761
+ if (totalPages <= 7) {
3762
+ return Array.from({ length: totalPages }, (_, i) => i + 1);
3763
+ }
3764
+ range.push(1);
3765
+ let start = Math.max(2, activePageNumber - delta);
3766
+ let end = Math.min(totalPages - 1, activePageNumber + delta);
3767
+ if (activePageNumber - delta <= 2) {
3768
+ end = Math.min(totalPages - 1, 4);
3769
+ }
3770
+ if (activePageNumber + delta >= totalPages - 1) {
3771
+ start = Math.max(2, totalPages - 4);
3772
+ }
3773
+ if (start > 2) {
3774
+ range.push("...");
3775
+ }
3776
+ for (let i = start; i <= end; i++) {
3777
+ range.push(i);
3778
+ }
3779
+ if (end < totalPages - 1) {
3780
+ range.push("...");
3781
+ }
3782
+ if (totalPages > 1) {
3783
+ range.push(totalPages);
3784
+ }
3785
+ return range;
3558
3786
  };
3559
- function toCamelCase(str) {
3560
- return str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
3787
+ const paginationRange = getPaginationRange();
3788
+ const PageButton = ({ page, children }) => /* @__PURE__ */ jsx65(
3789
+ Hyperlink,
3790
+ {
3791
+ linkType: "Link" /* Link */,
3792
+ className: `
3793
+ min-w-[20px] md:min-w-[40px] h-10 flex items-center justify-center px-2.5 md:px-3
3794
+ border text-sm font-medium transition-colors duration-150
3795
+ ${activePageNumber === page ? "bg-primary-base font-semibold" : ""}
3796
+ `,
3797
+ href: builder.getNewPageUrl(page),
3798
+ children
3799
+ }
3800
+ );
3801
+ const NavigationButton = ({ page, disabled, children }) => {
3802
+ if (disabled) {
3803
+ return /* @__PURE__ */ jsx65("span", { className: "min-w-[20px] md:min-w-[40px] h-10 flex items-center justify-center px-2 md:px-3 border bg-neutral-base cursor-not-allowed", children });
3804
+ }
3805
+ return /* @__PURE__ */ jsx65(
3806
+ Hyperlink,
3807
+ {
3808
+ className: "min-w-[20px] md:min-w-[40px] h-10 flex items-center justify-center px-2 md:px-3 border transition-colors duration-150",
3809
+ href: builder.getNewPageUrl(page),
3810
+ children
3811
+ }
3812
+ );
3813
+ };
3814
+ if (totalPages <= 1 && totalItems === 0) return null;
3815
+ return /* @__PURE__ */ jsxs32("div", { className: "py-6 border-t bg-default", children: [
3816
+ /* @__PURE__ */ jsxs32("div", { className: "flex flex-col sm:flex-row items-center justify-between gap-4", children: [
3817
+ /* @__PURE__ */ jsxs32("div", { className: "text-sm", children: [
3818
+ "Showing ",
3819
+ /* @__PURE__ */ jsxs32("span", { className: "font-semibold", children: [
3820
+ startItem,
3821
+ "-",
3822
+ endItem
3823
+ ] }),
3824
+ " ",
3825
+ "out of ",
3826
+ /* @__PURE__ */ jsx65("span", { className: "font-semibold", children: totalItems.toLocaleString() }),
3827
+ " results"
3828
+ ] }),
3829
+ totalPages > 1 && /* @__PURE__ */ jsxs32("div", { className: "flex items-center space-x-1", children: [
3830
+ /* @__PURE__ */ jsxs32(
3831
+ NavigationButton,
3832
+ {
3833
+ page: activePageNumber - 1,
3834
+ disabled: activePageNumber === 1,
3835
+ children: [
3836
+ /* @__PURE__ */ jsx65("span", { children: /* @__PURE__ */ jsx65(Icon_default, { name: "chevronLeft", className: "w-4 h-4 mr-1" }) }),
3837
+ /* @__PURE__ */ jsx65("span", { className: "text-sm", children: "Prev" })
3838
+ ]
3839
+ }
3840
+ ),
3841
+ paginationRange.map((item, index) => {
3842
+ if (item === "...") {
3843
+ return /* @__PURE__ */ jsx65(
3844
+ "span",
3845
+ {
3846
+ className: "min-w-[20px] md:min-w-[40px] h-10 flex items-center justify-center text-gray-500",
3847
+ children: "..."
3848
+ },
3849
+ `ellipsis-${index}`
3850
+ );
3851
+ }
3852
+ const page = item;
3853
+ return /* @__PURE__ */ jsx65(PageButton, { page, children: page }, page);
3854
+ }),
3855
+ /* @__PURE__ */ jsxs32(
3856
+ NavigationButton,
3857
+ {
3858
+ page: activePageNumber + 1,
3859
+ disabled: activePageNumber === totalPages,
3860
+ children: [
3861
+ /* @__PURE__ */ jsx65("span", { className: "text-sm", children: "Next" }),
3862
+ /* @__PURE__ */ jsx65("span", { children: /* @__PURE__ */ jsx65(Icon_default, { name: "chevronRight", className: "w-4 h-4 ml-1" }) })
3863
+ ]
3864
+ }
3865
+ )
3866
+ ] }),
3867
+ showJumpToPage && totalPages > 5 && /* @__PURE__ */ jsxs32("div", { className: "flex items-center space-x-2", children: [
3868
+ /* @__PURE__ */ jsx65("span", { className: "text-sm", children: "Go to:" }),
3869
+ /* @__PURE__ */ jsx65("div", { className: "relative", children: /* @__PURE__ */ jsx65(
3870
+ "input",
3871
+ {
3872
+ type: "number",
3873
+ min: "1",
3874
+ max: totalPages,
3875
+ defaultValue: activePageNumber,
3876
+ className: "w-20 h-10 px-3 border rounded text-sm focus:outline-none focus:ring-2 focus:border-transparent",
3877
+ onKeyDown: (e) => {
3878
+ if (e.key === "Enter") {
3879
+ const input = e.target;
3880
+ const page = parseInt(input.value);
3881
+ if (page >= 1 && page <= totalPages && page !== activePageNumber) {
3882
+ window.location.href = builder.getNewPageUrl(page);
3883
+ }
3884
+ }
3885
+ }
3886
+ }
3887
+ ) })
3888
+ ] })
3889
+ ] }),
3890
+ showPageSizeSelector && /* @__PURE__ */ jsx65("div", { className: "mt-4 pt-4 border-t bg-default", children: /* @__PURE__ */ jsxs32("div", { className: "flex items-center justify-center space-x-2", children: [
3891
+ /* @__PURE__ */ jsx65("span", { className: "text-sm", children: "Show:" }),
3892
+ /* @__PURE__ */ jsx65("div", { className: "flex space-x-1", children: [10, 25, 50, 100].map((size) => /* @__PURE__ */ jsx65(
3893
+ Hyperlink,
3894
+ {
3895
+ className: `
3896
+ px-3 py-1 text-sm rounded border transition-colors duration-150
3897
+ ${itemsPerPage === size ? "bg-primary-base font-medium" : "bg-neutral-weak"}
3898
+ `,
3899
+ href: builder.getNewPageSizeUrl(size),
3900
+ children: size
3901
+ },
3902
+ size
3903
+ )) }),
3904
+ /* @__PURE__ */ jsx65("span", { className: "text-sm", children: "per page" })
3905
+ ] }) })
3906
+ ] });
3907
+ };
3908
+ var Pagination_default = Pagination;
3909
+
3910
+ // src/components/utilities/PathUtility.tsx
3911
+ var PathUtility = class {
3912
+ constructor() {
3561
3913
  }
3562
- function convertKeysToCamelCase(obj) {
3563
- if (!obj || typeof obj !== "object") return obj;
3564
- if (Array.isArray(obj)) {
3565
- return obj.map(convertKeysToCamelCase);
3914
+ normalizePath(path) {
3915
+ if (path == null) {
3916
+ return "/";
3566
3917
  }
3567
- return Object.fromEntries(
3568
- Object.entries(obj).filter(([_, value]) => value !== "" && value !== void 0).map(([key, value]) => [
3569
- toCamelCase(key),
3570
- convertKeysToCamelCase(value)
3571
- // Recursively convert nested objects
3572
- ])
3918
+ const trimmedPath = path.replace(/^\/|\/$/g, "");
3919
+ return trimmedPath === "" ? "/" : "/" + trimmedPath + "/";
3920
+ }
3921
+ joinAndNormalizePaths(path1, path2) {
3922
+ path1 = path1.replace(/\/$/, "");
3923
+ path2 = path2.replace(/^\//, "");
3924
+ const joinedPath = `${path1}/${path2}`;
3925
+ const normalizedPath = joinedPath.replace(/\/{2,}/g, "/");
3926
+ return normalizedPath === "" ? "/" : "/" + normalizedPath;
3927
+ }
3928
+ removeLeadingAndTrailingSlashes(path) {
3929
+ if (path == null) {
3930
+ return "/";
3931
+ }
3932
+ const trimmedPath = path.replace(/^\/|\/$/g, "");
3933
+ return trimmedPath;
3934
+ }
3935
+ removeTrailingSlash(path) {
3936
+ if (path == null) {
3937
+ return "/";
3938
+ }
3939
+ const trimmedPath = path.replace(/\/$/, "");
3940
+ return trimmedPath;
3941
+ }
3942
+ joinPaths(path1, path2) {
3943
+ if (!path1.endsWith("/") && !path2.startsWith("/")) {
3944
+ return `${path1}/${path2}`;
3945
+ } else if (path1.endsWith("/") && path2.startsWith("/")) {
3946
+ return `${path1}${path2.substr(1)}`;
3947
+ } else {
3948
+ return `${path1}${path2}`;
3949
+ }
3950
+ }
3951
+ getFirstSegment(path) {
3952
+ if (!path || path === "/") {
3953
+ return "";
3954
+ }
3955
+ const segments = path.split("/").filter(Boolean);
3956
+ return segments.length > 0 ? segments[0] : "";
3957
+ }
3958
+ };
3959
+ var PathUtility_default = new PathUtility();
3960
+
3961
+ // src/components/pageRenderingEngine/nodes/EnterAnimationClient.tsx
3962
+ import React51, { useEffect as useEffect10, useRef as useRef6 } from "react";
3963
+ import { Fragment as Fragment7, jsx as jsx66 } from "react/jsx-runtime";
3964
+ function EnterAnimationClient({ hasEnterAnimation, children }) {
3965
+ const ref = useRef6(null);
3966
+ useEffect10(() => {
3967
+ if (!hasEnterAnimation || !ref.current) return;
3968
+ const observer = new IntersectionObserver(
3969
+ (entries) => {
3970
+ entries.forEach((entry) => {
3971
+ if (entry.isIntersecting) {
3972
+ entry.target.classList.add("visible");
3973
+ observer.unobserve(entry.target);
3974
+ }
3975
+ });
3976
+ },
3977
+ { threshold: 0.1 }
3978
+ );
3979
+ observer.observe(ref.current);
3980
+ return () => observer.disconnect();
3981
+ }, [hasEnterAnimation]);
3982
+ return /* @__PURE__ */ jsx66(Fragment7, { children: children && // enforce passing the ref to Wrapper
3983
+ //@ts-ignore
3984
+ React51.cloneElement(children, { ref }) });
3985
+ }
3986
+
3987
+ // src/components/Slider.tsx
3988
+ import { useState as useState11, useEffect as useEffect11, Children, cloneElement } from "react";
3989
+ import { Fragment as Fragment8, jsx as jsx67, jsxs as jsxs33 } from "react/jsx-runtime";
3990
+ var Slider = ({
3991
+ children,
3992
+ slidesToShow = 4,
3993
+ infinite_scroll = false,
3994
+ autoplay = false,
3995
+ autoplay_speed = 3e3,
3996
+ show_arrows = false,
3997
+ show_dots = false,
3998
+ scaleOnHover = false,
3999
+ className = "",
4000
+ arrowClassName = "bg-black/50 hover:bg-black/80 text-white rounded-full w-10 h-10 flex items-center justify-center",
4001
+ dotActiveClassName = "bg-gray-300",
4002
+ dotInactiveClassName = "bg-gray-600",
4003
+ gap,
4004
+ pillStyle = "cumulative",
4005
+ progressPosition = "bottom"
4006
+ }) => {
4007
+ const [currentSlide, setCurrentSlide] = useState11(0);
4008
+ const [transition, setTransition] = useState11(true);
4009
+ const [slidesToShowState, setSlidesToShowState] = useState11(
4010
+ typeof slidesToShow === "number" ? slidesToShow : slidesToShow.large
4011
+ );
4012
+ const [isPlaying, setIsPlaying] = useState11(autoplay);
4013
+ useEffect11(() => {
4014
+ if (typeof slidesToShow === "number") return;
4015
+ const handleResize = () => {
4016
+ if (window.innerWidth >= 1024) {
4017
+ setSlidesToShowState(slidesToShow.large);
4018
+ } else if (window.innerWidth >= 768) {
4019
+ setSlidesToShowState(slidesToShow.medium);
4020
+ } else {
4021
+ setSlidesToShowState(slidesToShow.small);
4022
+ }
4023
+ };
4024
+ handleResize();
4025
+ window.addEventListener("resize", handleResize);
4026
+ return () => window.removeEventListener("resize", handleResize);
4027
+ }, [slidesToShow]);
4028
+ useEffect11(() => {
4029
+ if (!autoplay) return;
4030
+ const timer = setInterval(() => {
4031
+ if (isPlaying) {
4032
+ nextSlide();
4033
+ }
4034
+ }, autoplay_speed);
4035
+ return () => clearInterval(timer);
4036
+ }, [autoplay, autoplay_speed, currentSlide, isPlaying]);
4037
+ const totalSlides = Children.count(children);
4038
+ const maxSlide = totalSlides - slidesToShowState;
4039
+ const nextSlide = () => {
4040
+ if (currentSlide >= maxSlide) {
4041
+ if (infinite_scroll) {
4042
+ setTransition(true);
4043
+ setCurrentSlide(0);
4044
+ }
4045
+ } else {
4046
+ setTransition(true);
4047
+ setCurrentSlide(currentSlide + 1);
4048
+ }
4049
+ };
4050
+ const prevSlide = () => {
4051
+ if (currentSlide <= 0) {
4052
+ if (infinite_scroll) {
4053
+ setTransition(true);
4054
+ setCurrentSlide(maxSlide);
4055
+ }
4056
+ } else {
4057
+ setTransition(true);
4058
+ setCurrentSlide(currentSlide - 1);
4059
+ }
4060
+ };
4061
+ const goToSlide = (index) => {
4062
+ setTransition(true);
4063
+ setCurrentSlide(index);
4064
+ };
4065
+ const handlePillClick = (index) => {
4066
+ goToSlide(index);
4067
+ if (autoplay) {
4068
+ setIsPlaying(true);
4069
+ }
4070
+ };
4071
+ const handleMouseEnter = () => {
4072
+ if (autoplay) {
4073
+ setIsPlaying(false);
4074
+ }
4075
+ };
4076
+ const handleMouseLeave = () => {
4077
+ if (autoplay) {
4078
+ setIsPlaying(true);
4079
+ }
4080
+ };
4081
+ const translateX = -currentSlide * (100 / slidesToShowState);
4082
+ const slides = Children.map(children, (child, index) => {
4083
+ return /* @__PURE__ */ jsx67(
4084
+ "div",
4085
+ {
4086
+ className: `flex-none ${scaleOnHover ? "group hover:z-50" : ""} relative`,
4087
+ style: { width: `calc(${100 / slidesToShowState}%)`, paddingRight: gap },
4088
+ children: cloneElement(child, {
4089
+ className: `w-full`
4090
+ })
4091
+ },
4092
+ index
3573
4093
  );
4094
+ });
4095
+ const getProgressPositionClass = () => {
4096
+ switch (progressPosition) {
4097
+ case "top":
4098
+ return "top-4";
4099
+ case "bottom-outside":
4100
+ return "bottom-4 translate-y-full mt-4";
4101
+ case "bottom":
4102
+ default:
4103
+ return "bottom-4";
4104
+ }
4105
+ };
4106
+ return /* @__PURE__ */ jsxs33(
4107
+ "div",
4108
+ {
4109
+ className: `relative w-full overflow-hidden ${className}`,
4110
+ onMouseEnter: handleMouseEnter,
4111
+ onMouseLeave: handleMouseLeave,
4112
+ children: [
4113
+ /* @__PURE__ */ jsx67(
4114
+ "div",
4115
+ {
4116
+ className: "flex h-full",
4117
+ style: {
4118
+ transition: transition ? "transform 0.5s ease" : "none",
4119
+ transform: `translateX(${translateX}%)`
4120
+ },
4121
+ children: slides
4122
+ }
4123
+ ),
4124
+ show_arrows && /* @__PURE__ */ jsxs33(Fragment8, { children: [
4125
+ /* @__PURE__ */ jsx67(
4126
+ ArrowButton,
4127
+ {
4128
+ direction: "left",
4129
+ onClick: prevSlide,
4130
+ visible: infinite_scroll || currentSlide > 0,
4131
+ className: arrowClassName,
4132
+ children: /* @__PURE__ */ jsx67("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: "w-6 h-6", children: /* @__PURE__ */ jsx67("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15.75 19.5 8.25 12l7.5-7.5" }) })
4133
+ }
4134
+ ),
4135
+ /* @__PURE__ */ jsxs33(
4136
+ ArrowButton,
4137
+ {
4138
+ direction: "right",
4139
+ onClick: nextSlide,
4140
+ visible: infinite_scroll || currentSlide < maxSlide,
4141
+ className: arrowClassName,
4142
+ children: [
4143
+ /* @__PURE__ */ jsx67("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: "w-6 h-6", children: /* @__PURE__ */ jsx67("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "m8.25 4.5 7.5 7.5-7.5 7.5" }) }),
4144
+ " "
4145
+ ]
4146
+ }
4147
+ )
4148
+ ] }),
4149
+ show_dots && /* @__PURE__ */ jsx67("div", { className: `absolute left-1/2 -translate-x-1/2 flex justify-center space-x-1.5 ${getProgressPositionClass()}`, children: Array.from({ length: totalSlides }).map((_, index) => /* @__PURE__ */ jsx67(
4150
+ ProgressPill,
4151
+ {
4152
+ active: index === currentSlide,
4153
+ duration: autoplay_speed,
4154
+ index,
4155
+ onClick: () => handlePillClick(index),
4156
+ isPlaying: isPlaying && index === currentSlide && autoplay,
4157
+ style: pillStyle,
4158
+ activeClassName: dotActiveClassName,
4159
+ inactiveClassName: dotInactiveClassName,
4160
+ currentSlide,
4161
+ totalSlides
4162
+ },
4163
+ index
4164
+ )) })
4165
+ ]
4166
+ }
4167
+ );
4168
+ };
4169
+ var ArrowButton = ({
4170
+ direction,
4171
+ onClick,
4172
+ visible,
4173
+ children,
4174
+ className = ""
4175
+ }) => /* @__PURE__ */ jsx67(
4176
+ "button",
4177
+ {
4178
+ className: `
4179
+ absolute top-1/2 -translate-y-1/2 z-10
4180
+ ${direction === "left" ? "left-2.5" : "right-2.5"}
4181
+ ${!visible && "hidden"}
4182
+ ${className}
4183
+ `,
4184
+ onClick,
4185
+ "aria-label": direction === "left" ? "Previous slide" : "Next slide",
4186
+ children
3574
4187
  }
3575
- function generateCompleteBackgroundString(layers) {
3576
- if (!layers || !Array.isArray(layers)) return "";
3577
- return layers.filter((layer) => layer && layer.type && layer.value).map((layer) => {
3578
- if (layer.type === "image" && layer.value && typeof layer.value === "object") {
3579
- const imageValue = layer.value;
3580
- if (!imageValue.assetUrl) return "";
3581
- const url = `url('${AssetUtility_default.resolveUrl("/api/images", imageValue.assetUrl)}')`;
3582
- const repeat = layer.repeat || "no-repeat";
3583
- const position = layer.position || "center";
3584
- const size = layer.size || "auto";
3585
- const attachment = layer.attachment || "scroll";
3586
- return `${url} ${position} / ${size} ${repeat} ${attachment}`;
3587
- }
3588
- if (layer.type === "gradient" && layer.value && typeof layer.value === "object") {
3589
- const gradient = layer.value;
3590
- if (!gradient.colors || !gradient.direction) return "";
3591
- const colors = gradient.colors.map(
3592
- (colorStop) => `color-mix(in srgb, ${colorStop.color}, transparent ${colorStop.transparency ?? 0}%) ${colorStop.start || "0%"}`
3593
- ).join(", ");
3594
- return `linear-gradient(${gradient.direction}, ${colors})`;
4188
+ );
4189
+ var ProgressPill = ({
4190
+ active,
4191
+ duration,
4192
+ index,
4193
+ onClick,
4194
+ isPlaying,
4195
+ style = "modern",
4196
+ activeClassName = "",
4197
+ inactiveClassName = "",
4198
+ currentSlide,
4199
+ totalSlides
4200
+ }) => {
4201
+ const [progress, setProgress] = useState11(0);
4202
+ useEffect11(() => {
4203
+ if (active) {
4204
+ setProgress(0);
4205
+ }
4206
+ }, [active, index]);
4207
+ useEffect11(() => {
4208
+ if (!active || !isPlaying) {
4209
+ if (!active) {
4210
+ setProgress(0);
3595
4211
  }
3596
- return "";
3597
- }).filter((bg) => bg.trim() !== "").join(", ");
4212
+ return;
4213
+ }
4214
+ const startTime = Date.now();
4215
+ const interval = setInterval(() => {
4216
+ const elapsed = Date.now() - startTime;
4217
+ const newProgress = elapsed / duration * 100;
4218
+ if (newProgress >= 100) {
4219
+ setProgress(100);
4220
+ clearInterval(interval);
4221
+ } else {
4222
+ setProgress(newProgress);
4223
+ }
4224
+ }, 50);
4225
+ return () => clearInterval(interval);
4226
+ }, [active, isPlaying, duration, index]);
4227
+ const isFilled = index < currentSlide;
4228
+ const isActive = index === currentSlide;
4229
+ const shouldShowProgress = isActive || style === "cumulative" && isFilled;
4230
+ const baseClasses = "cursor-pointer transition-all duration-300 ease-out";
4231
+ const getStyleClasses = () => {
4232
+ switch (style) {
4233
+ case "minimal":
4234
+ return `
4235
+ ${isActive ? "w-8" : "w-2"} h-2 rounded-full
4236
+ ${isActive ? activeClassName || "bg-white" : inactiveClassName || "bg-white/50"}
4237
+ hover:scale-110
4238
+ `;
4239
+ case "cumulative":
4240
+ return `
4241
+ w-4 h-1 rounded-full overflow-hidden relative
4242
+ ${isFilled ? activeClassName || "bg-white" : inactiveClassName || "bg-white/30"}
4243
+ `;
4244
+ case "modern":
4245
+ return `
4246
+ w-8 h-1.5 rounded-full overflow-hidden relative
4247
+ ${isActive ? inactiveClassName || "bg-white/30" : inactiveClassName || "bg-white/30"}
4248
+ hover:h-2
4249
+ `;
4250
+ case "default":
4251
+ default:
4252
+ return `
4253
+ w-6 h-1.5 rounded-full
4254
+ ${isActive ? activeClassName || "bg-white" : inactiveClassName || "bg-white/50"}
4255
+ hover:w-8
4256
+ `;
4257
+ }
4258
+ };
4259
+ const renderProgressBar = () => {
4260
+ if (style === "modern" && isActive || style === "cumulative" && shouldShowProgress) {
4261
+ const displayProgress = style === "cumulative" && isFilled ? 100 : progress;
4262
+ return /* @__PURE__ */ jsx67(
4263
+ "div",
4264
+ {
4265
+ className: `absolute top-0 left-0 h-full rounded-full ${style === "cumulative" && isFilled ? activeClassName || "bg-white" : activeClassName || "bg-white"} transition-all duration-50 ease-linear`,
4266
+ style: { width: `${displayProgress}%` }
4267
+ }
4268
+ );
4269
+ }
4270
+ return null;
4271
+ };
4272
+ const renderCumulativeFill = () => {
4273
+ if (style === "cumulative" && isFilled && !isActive) {
4274
+ return /* @__PURE__ */ jsx67(
4275
+ "div",
4276
+ {
4277
+ className: `absolute top-0 left-0 h-full rounded-full ${activeClassName || "bg-white"} transition-all duration-300`,
4278
+ style: { width: "100%" }
4279
+ }
4280
+ );
4281
+ }
4282
+ return null;
4283
+ };
4284
+ return /* @__PURE__ */ jsxs33(
4285
+ "button",
4286
+ {
4287
+ className: `${baseClasses} ${getStyleClasses()}`,
4288
+ onClick,
4289
+ "aria-label": `Go to slide ${index + 1}`,
4290
+ "aria-current": isActive ? "true" : "false",
4291
+ children: [
4292
+ renderProgressBar(),
4293
+ renderCumulativeFill()
4294
+ ]
4295
+ }
4296
+ );
4297
+ };
4298
+ var Slider_default = Slider;
4299
+
4300
+ // src/components/NoDataFound.tsx
4301
+ import { jsx as jsx68, jsxs as jsxs34 } from "react/jsx-runtime";
4302
+ var NoDataFound = () => {
4303
+ return /* @__PURE__ */ jsxs34("div", { className: "flex flex-col items-center justify-center py-12 px-4 text-center bg-neutral-weak", children: [
4304
+ /* @__PURE__ */ jsx68("div", { className: "mb-5", children: /* @__PURE__ */ jsx68("div", { className: "mx-auto w-20 h-20 rounded-full flex items-center justify-center bg-neutral-soft", children: /* @__PURE__ */ jsx68(
4305
+ "svg",
4306
+ {
4307
+ className: "w-10 h-10",
4308
+ fill: "none",
4309
+ stroke: "currentColor",
4310
+ viewBox: "0 0 24 24",
4311
+ xmlns: "http://www.w3.org/2000/svg",
4312
+ children: /* @__PURE__ */ jsx68(
4313
+ "path",
4314
+ {
4315
+ strokeLinecap: "round",
4316
+ strokeLinejoin: "round",
4317
+ strokeWidth: "1.5",
4318
+ d: "M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"
4319
+ }
4320
+ )
4321
+ }
4322
+ ) }) }),
4323
+ /* @__PURE__ */ jsx68("h3", { className: "text-lg font-medium mb-2", children: "No data available" }),
4324
+ /* @__PURE__ */ jsx68("p", { className: " max-w-sm mb-0", children: "No records found. Data may be empty or not available at the moment." })
4325
+ ] });
4326
+ };
4327
+ var NoDataFound_default = NoDataFound;
4328
+
4329
+ // src/components/pageRenderingEngine/nodes/DivContainer.tsx
4330
+ import { jsx as jsx69, jsxs as jsxs35 } from "react/jsx-runtime";
4331
+ function toCamelCase(str) {
4332
+ return str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
4333
+ }
4334
+ function convertKeysToCamelCase(obj) {
4335
+ if (!obj || typeof obj !== "object") return obj;
4336
+ if (Array.isArray(obj)) return obj.map(convertKeysToCamelCase);
4337
+ return Object.fromEntries(
4338
+ Object.entries(obj).filter(([_, value]) => value !== "" && value !== void 0).map(([key, value]) => [
4339
+ toCamelCase(key),
4340
+ convertKeysToCamelCase(value)
4341
+ ])
4342
+ );
4343
+ }
4344
+ var getNestedValue = (obj, path) => {
4345
+ if (!obj || !path) return void 0;
4346
+ return path.split(".").reduce((current, key) => {
4347
+ return current && current[key] !== void 0 ? current[key] : void 0;
4348
+ }, obj);
4349
+ };
4350
+ function generateCompleteBackgroundString(layers) {
4351
+ if (!layers || !Array.isArray(layers)) return "";
4352
+ return layers.filter((layer) => layer && layer.type && layer.value).map((layer) => {
4353
+ if (layer.type === "image" && typeof layer.value === "object") {
4354
+ const imageValue = layer.value;
4355
+ if (!imageValue.assetUrl) return "";
4356
+ const url = `url('${AssetUtility_default.resolveUrl(
4357
+ ApiPathServerUtility.getApiPath(),
4358
+ imageValue.assetUrl
4359
+ )}')`;
4360
+ const repeat = layer.repeat || "no-repeat";
4361
+ const position = layer.position || "center";
4362
+ const size = layer.size || "auto";
4363
+ const attachment = layer.attachment || "scroll";
4364
+ return `${url} ${position} / ${size} ${repeat} ${attachment}`;
4365
+ }
4366
+ if (layer.type === "gradient" && typeof layer.value === "object") {
4367
+ const gradient = layer.value;
4368
+ if (!gradient.colors || !gradient.direction) return "";
4369
+ const colors = gradient.colors.map(
4370
+ (colorStop) => `color-mix(in srgb, ${colorStop.color}, transparent ${colorStop.transparency ?? 0}%) ${colorStop.start || "0%"}`
4371
+ ).join(", ");
4372
+ return `linear-gradient(${gradient.direction}, ${colors})`;
4373
+ }
4374
+ return "";
4375
+ }).filter((bg) => bg.trim() !== "").join(", ");
4376
+ }
4377
+ var generateCssString = (guid, stylesObject, mobileStylesObject) => {
4378
+ let gridColumns = stylesObject.gridTemplateColumns ? stylesObject.gridTemplateColumns.match(/\d+/g) : [];
4379
+ let hasGridProperties = gridColumns.length > 0;
4380
+ let largeCols = hasGridProperties ? parseInt(gridColumns[0]) : 4;
4381
+ let tabletColumns = hasGridProperties ? Math.ceil(parseInt(gridColumns[0]) / 2) : 2;
4382
+ let mobileColumns = 1;
4383
+ let cssRules = Object.entries(stylesObject).filter(([_, value]) => value !== void 0 && value !== "").map(([key, value]) => {
4384
+ const cssKey = key.replace(/([A-Z])/g, "-$1").toLowerCase();
4385
+ return `${cssKey}: ${value};`;
4386
+ });
4387
+ let css = `#${guid} {
4388
+ ${cssRules.join(
4389
+ "\n"
4390
+ )}
4391
+ transition: all 0.3s ease-in-out; }`;
4392
+ if (mobileStylesObject) {
4393
+ let mobileCssRules = Object.entries(mobileStylesObject).filter(([_, value]) => value !== void 0 && value !== "").map(([key, value]) => {
4394
+ const cssKey = key.replace(/([A-Z])/g, "-$1").toLowerCase();
4395
+ return `${cssKey}: ${value};`;
4396
+ });
4397
+ if (mobileCssRules.length > 0) {
4398
+ css += `
4399
+ @media (max-width: 480px) { #${guid} {
4400
+ ${mobileCssRules.join(
4401
+ "\n"
4402
+ )}
4403
+ } }`;
4404
+ }
3598
4405
  }
4406
+ if (hasGridProperties) {
4407
+ css += `
4408
+ @media (max-width: 1279px) { #${guid} { grid-template-columns: repeat(${tabletColumns}, minmax(0, 1fr)); } }`;
4409
+ css += `
4410
+ @media (max-width: 768px) { #${guid} { grid-template-columns: repeat(${tabletColumns}, minmax(0, 1fr)); } }`;
4411
+ css += `
4412
+ @media (max-width: 480px) { #${guid} { grid-template-columns: repeat(${mobileColumns}, minmax(0, 1fr)); } }`;
4413
+ }
4414
+ const output = {
4415
+ css,
4416
+ gridColsLarge: largeCols,
4417
+ gridColsMedium: tabletColumns,
4418
+ gridColsSmall: mobileColumns
4419
+ };
4420
+ return output;
4421
+ };
4422
+ var DivContainer = async (props) => {
4423
+ const NodeTypes2 = {
4424
+ paragraph: ParagraphNode_default,
4425
+ heading: HeadingNode_default,
4426
+ list: ListNode_default,
4427
+ quote: QuoteNode_default,
4428
+ code: CodeNode_default,
4429
+ image: ImageNode_default,
4430
+ horizontalrule: HorizontalRuleNode_default,
4431
+ "layout-container": LayoutContainerNode_default,
4432
+ widget: WidgetNode_default,
4433
+ embed: EmbedNode_default,
4434
+ "div-container": DivContainer,
4435
+ text: TextNode_default,
4436
+ datafield: DatafieldNode_default,
4437
+ "svg-icon": SVGIconNode_default
4438
+ };
4439
+ const styles = props.node.cssProperties;
4440
+ const mobileStyles = props.node.mobileCssProperties;
4441
+ const dataBindingProperties = props.node.dataBinding;
4442
+ const updatedStyles = convertKeysToCamelCase(styles);
3599
4443
  var background = generateCompleteBackgroundString(props.node.backgroundLayers);
3600
4444
  let containerPaddingClass = "";
3601
4445
  if (props.node.containerPadding == "small") {
@@ -3605,103 +4449,183 @@ var DivContainer = (props) => {
3605
4449
  }
3606
4450
  const updatedStyle = { ...updatedStyles };
3607
4451
  const backgroundStyle = background && background !== "" ? { background } : {};
4452
+ const combinedStyles = {
4453
+ ...backgroundStyle
4454
+ };
4455
+ if (props.node.enableBackgroundClipText) {
4456
+ combinedStyles.WebkitBackgroundClip = "text";
4457
+ combinedStyles.backgroundClip = "text";
4458
+ }
3608
4459
  const guid = "css" + crypto.randomUUID().toLocaleLowerCase();
3609
- const generateCssString = (stylesObject, hoverStylesObject, mobileStylesObject) => {
3610
- let gridColumns = stylesObject.gridTemplateColumns ? stylesObject.gridTemplateColumns.match(/\d+/g) : [];
3611
- let hasGridProperties = gridColumns.length > 0;
3612
- let tabletColumns = hasGridProperties ? Math.ceil(parseInt(gridColumns[0]) / 2) : 2;
3613
- let mobileColumns = 1;
3614
- let cssRules = Object.entries(stylesObject).filter(([_, value]) => value !== void 0 && value !== "").map(([key, value]) => {
3615
- const cssKey = key.replace(/([A-Z])/g, "-$1").toLowerCase();
3616
- return `${cssKey}: ${value};`;
4460
+ const { enterAnimation, exitAnimation, hoverAnimation } = props.node;
4461
+ let animationCSS = "";
4462
+ if (enterAnimation?.name) {
4463
+ animationCSS += AnimationUtility_default.generateAnimationCSS(
4464
+ { animation: enterAnimation.name, mode: "enter", ...enterAnimation.properties },
4465
+ `#${guid}`
4466
+ );
4467
+ }
4468
+ if (hoverAnimation?.name) {
4469
+ animationCSS += AnimationUtility_default.generateAnimationCSS(
4470
+ { animation: hoverAnimation.name, mode: "hover", ...hoverAnimation.properties },
4471
+ `#${guid}`
4472
+ );
4473
+ }
4474
+ const shouldHideContainer = () => {
4475
+ if (!props.node.fieldVisibleOnTrue) return false;
4476
+ const fieldValue = getNestedValue(props.dataitem, props.node.fieldVisibleOnTrue);
4477
+ return fieldValue !== void 0 && fieldValue === false;
4478
+ };
4479
+ const isHidden = shouldHideContainer();
4480
+ let odataString = void 0;
4481
+ let endpoint = void 0;
4482
+ let result = null;
4483
+ let response = null;
4484
+ let childCollectionData = null;
4485
+ if (dataBindingProperties) {
4486
+ const serviceClient = new ServiceClient(props.apiBaseUrl, props.session);
4487
+ endpoint = dataBindingProperties.dataSource;
4488
+ endpoint = endpoint.replace(/\{(\w+)\}/g, (_, key) => {
4489
+ return props.routeParameters?.[key] ?? `{${key}}`;
3617
4490
  });
3618
- let css2 = `#${guid} {
3619
- ${cssRules.join("\n")}
3620
-
3621
- transition: all 0.3s ease-in-out;
3622
- }`;
3623
- if (hoverStylesObject) {
3624
- let hoverCssRules = Object.entries(hoverStylesObject).filter(([_, value]) => value !== void 0 && value !== "").map(([key, value]) => {
3625
- const cssKey = key.replace(/([A-Z])/g, "-$1").toLowerCase();
3626
- return `${cssKey}: ${value};`;
3627
- });
3628
- if (hoverCssRules.length > 0) {
3629
- css2 += `
3630
- #${guid}:hover {
3631
- ${hoverCssRules.join("\n")}
3632
- }`;
4491
+ if (dataBindingProperties.applyODataParams) {
4492
+ odataString = OdataBuilder.getOdataQueryString(props.query);
4493
+ if (odataString) {
4494
+ const separator = endpoint.includes("?") ? "&" : "?";
4495
+ endpoint += separator + odataString;
3633
4496
  }
3634
4497
  }
3635
- if (mobileStylesObject) {
3636
- let mobileCssRules = Object.entries(mobileStylesObject).filter(([_, value]) => value !== void 0 && value !== "").map(([key, value]) => {
3637
- const cssKey = key.replace(/([A-Z])/g, "-$1").toLowerCase();
3638
- return `${cssKey}: ${value};`;
3639
- });
3640
- if (mobileCssRules.length > 0) {
3641
- css2 += `
3642
- @media (max-width: 480px) { #${guid} {
3643
- ${mobileCssRules.join("\n")}
3644
- } }`;
4498
+ response = await serviceClient.get(endpoint);
4499
+ result = response?.result;
4500
+ if (dataBindingProperties.showNoResultsMessage && (result === void 0 || result.length == 0)) {
4501
+ return /* @__PURE__ */ jsx69(NoDataFound_default, {});
4502
+ }
4503
+ if (dataBindingProperties.childCollectionName && props.dataitem) {
4504
+ childCollectionData = getNestedValue(props.dataitem, dataBindingProperties.childCollectionName);
4505
+ }
4506
+ }
4507
+ const cssResult = generateCssString(guid, updatedStyle, mobileStyles);
4508
+ function renderNode(node, props2, dataitem, key, href) {
4509
+ const SelectedNode = NodeTypes2[node.type];
4510
+ if (!SelectedNode) return null;
4511
+ return /* @__PURE__ */ jsx69(React53.Fragment, { children: /* @__PURE__ */ jsx69(
4512
+ SelectedNode,
4513
+ {
4514
+ node,
4515
+ parentTag: Wrapper,
4516
+ routeParameters: props2.routeParameters,
4517
+ query: props2.query,
4518
+ session: props2.session,
4519
+ host: props2.host,
4520
+ path: props2.path,
4521
+ apiBaseUrl: props2.apiBaseUrl,
4522
+ breadcrumb: props2.breadcrumb,
4523
+ dataitem,
4524
+ href
3645
4525
  }
4526
+ ) }, key);
4527
+ }
4528
+ function renderChildren(nodes, props2, data, key, href) {
4529
+ if (!nodes) return null;
4530
+ const childNodes = nodes.map((node, index) => {
4531
+ if (node.type === "div-container" && node.dataBinding?.childCollectionName && data) {
4532
+ return renderNode(node, props2, data, index, href);
4533
+ }
4534
+ return renderNode(node, props2, data, index, href);
4535
+ });
4536
+ return childNodes;
4537
+ }
4538
+ function queryObjectToString(query) {
4539
+ if (!query) return "";
4540
+ return Object.entries(query).map(
4541
+ ([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`
4542
+ ).join("&");
4543
+ }
4544
+ function resolveHrefTemplate(template, dataItem) {
4545
+ return template.replace(/\{([^}]+)\}/g, (match, key) => {
4546
+ return dataItem[key] !== void 0 ? dataItem[key] : match;
4547
+ });
4548
+ }
4549
+ const dataToRender = (() => {
4550
+ if (childCollectionData && Array.isArray(childCollectionData)) {
4551
+ return childCollectionData;
3646
4552
  }
3647
- if (hasGridProperties) {
3648
- css2 += `
3649
- @media (max-width: 1279px) { #${guid} { grid-template-columns: repeat(${tabletColumns}, minmax(0, 1fr)); } }`;
3650
- css2 += `
3651
- @media (max-width: 768px) { #${guid} { grid-template-columns: repeat(${tabletColumns}, minmax(0, 1fr)); } }`;
3652
- css2 += `
3653
- @media (max-width: 480px) { #${guid} { grid-template-columns: repeat(${mobileColumns}, minmax(0, 1fr)); } }`;
4553
+ if (result && props.node.dataBinding?.responseType === "array") {
4554
+ return result;
3654
4555
  }
3655
- return css2;
3656
- };
3657
- const css = generateCssString(updatedStyle, hoverStyles, mobileStyles);
3658
- return /* @__PURE__ */ jsxs32(React50.Fragment, { children: [
3659
- /* @__PURE__ */ jsx65("style", { dangerouslySetInnerHTML: { __html: css } }),
3660
- props.node.href && props.node.href !== "" ? /* @__PURE__ */ jsx65(Link3, { href: props.node.href, className: "block", children: /* @__PURE__ */ jsx65(
3661
- "div",
4556
+ if (result && props.node.dataBinding?.responseType === "object") {
4557
+ return [result];
4558
+ }
4559
+ return [props.dataitem];
4560
+ })();
4561
+ const renderLink = result && props.node.dataBinding?.responseType === "array" ? true : false;
4562
+ let Wrapper;
4563
+ let wrapperProps;
4564
+ switch (true) {
4565
+ case props.node.componentProperties?.type === "slider":
4566
+ Wrapper = Slider_default;
4567
+ const largeCols = props.node.componentProperties?.columns || 4;
4568
+ const slidesToShow = {
4569
+ large: largeCols,
4570
+ medium: Math.ceil(largeCols / 2),
4571
+ small: 1
4572
+ };
4573
+ wrapperProps = { ...props.node.componentProperties, "slidesToShow": slidesToShow };
4574
+ break;
4575
+ case !!(props.node.href || props.href):
4576
+ Wrapper = "a";
4577
+ let href = props.node.href || props.href;
4578
+ if (href?.includes("{")) {
4579
+ href = resolveHrefTemplate(href, props.dataitem);
4580
+ }
4581
+ const currentPath = decodeURIComponent(PathUtility_default.removeTrailingSlash(props.path) + "?" + queryObjectToString(props.query));
4582
+ const resolvedHref = decodeURIComponent(href || "");
4583
+ const isSelected = currentPath === resolvedHref;
4584
+ wrapperProps = { href, "data-isSelected": isSelected, "data-path": currentPath, "data-href": resolvedHref, class: "no-link-color" };
4585
+ break;
4586
+ default: {
4587
+ const replacementTag = props.node.replaceDivTagWith;
4588
+ const allowedTags = ["div", "section", "article", "details", "summary"];
4589
+ if (replacementTag && allowedTags.includes(replacementTag)) {
4590
+ Wrapper = replacementTag;
4591
+ } else {
4592
+ Wrapper = "div";
4593
+ }
4594
+ wrapperProps = {};
4595
+ break;
4596
+ }
4597
+ }
4598
+ if (isHidden) {
4599
+ return null;
4600
+ }
4601
+ const classNames = [
4602
+ containerPaddingClass,
4603
+ props.node.autoFormat && "auto-format",
4604
+ props.node.bgClass
4605
+ ].filter(Boolean).join(" ");
4606
+ return /* @__PURE__ */ jsxs35(React53.Fragment, { children: [
4607
+ /* @__PURE__ */ jsx69("style", { dangerouslySetInnerHTML: { __html: cssResult.css + animationCSS } }),
4608
+ /* @__PURE__ */ jsx69(EnterAnimationClient, { hasEnterAnimation: !!props.node.enterAnimation, children: /* @__PURE__ */ jsx69(React53.Fragment, { children: /* @__PURE__ */ jsx69(
4609
+ Wrapper,
3662
4610
  {
3663
4611
  id: guid,
3664
- style: { ...backgroundStyle, display: "block" },
3665
- className: containerPaddingClass,
3666
- children: props.node.children?.map((node, index) => {
3667
- const SelectedNode = NodeTypes2[node.type];
3668
- return /* @__PURE__ */ jsx65(React50.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx65(
3669
- SelectedNode,
3670
- {
3671
- node,
3672
- routeParameters: props.routeParameters,
3673
- query: props.query,
3674
- session: props.session,
3675
- host: props.host,
3676
- path: props.path,
3677
- apiBaseUrl: props.apiBaseUrl,
3678
- breadcrumb: props.breadcrumb
3679
- }
3680
- ) }, index);
3681
- })
4612
+ style: combinedStyles,
4613
+ className: classNames || void 0,
4614
+ ...wrapperProps,
4615
+ children: dataToRender.map(
4616
+ (item, idx) => item?.links?.view && renderLink ? renderChildren(props.node.children, props, item, idx, props.href ? void 0 : item?.links?.view)?.map(
4617
+ (child, i) => /* @__PURE__ */ jsx69(React53.Fragment, { children: child }, i)
4618
+ ) : renderChildren(props.node.children, props, item, idx)
4619
+ )
3682
4620
  }
3683
- ) }) : /* @__PURE__ */ jsx65("div", { id: guid, style: { ...backgroundStyle }, className: containerPaddingClass, children: props.node.children && props.node.children.map((node, index) => {
3684
- const SelectedNode = NodeTypes2[node.type];
3685
- return /* @__PURE__ */ jsx65(React50.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx65(
3686
- SelectedNode,
3687
- {
3688
- node,
3689
- routeParameters: props.routeParameters,
3690
- query: props.query,
3691
- session: props.session,
3692
- host: props.host,
3693
- path: props.path,
3694
- apiBaseUrl: props.apiBaseUrl,
3695
- breadcrumb: props.breadcrumb
3696
- }
3697
- ) }, index);
3698
- }) })
4621
+ ) }) }),
4622
+ dataBindingProperties && props.node.dataBinding.enablePagination && /* @__PURE__ */ jsx69("div", { children: /* @__PURE__ */ jsx69(Pagination_default, { path: props.path, query: props.query, dataset: response }) })
3699
4623
  ] });
3700
4624
  };
3701
4625
  var DivContainer_default = DivContainer;
3702
4626
 
3703
4627
  // src/components/pageRenderingEngine/PageBodyRenderer.tsx
3704
- import { jsx as jsx66 } from "react/jsx-runtime";
4628
+ import { jsx as jsx70 } from "react/jsx-runtime";
3705
4629
  var NodeTypes = {
3706
4630
  ["paragraph"]: ParagraphNode_default,
3707
4631
  ["heading"]: HeadingNode_default,
@@ -3729,11 +4653,11 @@ var PageBodyRenderer = (props) => {
3729
4653
  if (pageBodyTree && pageBodyTree.root) {
3730
4654
  rootNode = pageBodyTree.root;
3731
4655
  }
3732
- return /* @__PURE__ */ jsx66(React51.Fragment, { children: rootNode && rootNode?.children?.map((node, index) => {
4656
+ return /* @__PURE__ */ jsx70(React54.Fragment, { children: rootNode && rootNode?.children?.map((node, index) => {
3733
4657
  {
3734
4658
  }
3735
4659
  const SelectedNode = NodeTypes[node.type];
3736
- return /* @__PURE__ */ jsx66(React51.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx66(React51.Fragment, { children: node.type == "layout-container" ? /* @__PURE__ */ jsx66(React51.Fragment, { children: /* @__PURE__ */ jsx66(
4660
+ return /* @__PURE__ */ jsx70(React54.Fragment, { children: SelectedNode && /* @__PURE__ */ jsx70(React54.Fragment, { children: node.type == "layout-container" ? /* @__PURE__ */ jsx70(React54.Fragment, { children: /* @__PURE__ */ jsx70(
3737
4661
  SelectedNode,
3738
4662
  {
3739
4663
  node,
@@ -3746,7 +4670,7 @@ var PageBodyRenderer = (props) => {
3746
4670
  apiBaseUrl: props.apiBaseUrl,
3747
4671
  widgetRegistry: props.widgetRegistry
3748
4672
  }
3749
- ) }) : /* @__PURE__ */ jsx66(React51.Fragment, { children: /* @__PURE__ */ jsx66(
4673
+ ) }) : /* @__PURE__ */ jsx70(React54.Fragment, { children: /* @__PURE__ */ jsx70(
3750
4674
  SelectedNode,
3751
4675
  {
3752
4676
  node,