@prokodo/ui 0.0.49 → 0.0.51

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 (112) hide show
  1. package/dist/components/accordion/{Accordion.module.scss.js → Accordion.base.module.scss.js} +2 -8
  2. package/dist/components/accordion/Accordion.effects.client.js +16 -0
  3. package/dist/components/accordion/Accordion.effects.module.scss.js +8 -0
  4. package/dist/components/accordion/Accordion.view.js +84 -80
  5. package/dist/components/animated/Animated.module.scss.js +2 -8
  6. package/dist/components/avatar/Avatar.module.scss.js +2 -8
  7. package/dist/components/button/Button.module.scss.js +2 -8
  8. package/dist/components/calendly/Calendly.client.js +98 -22
  9. package/dist/components/calendly/Calendly.server.js +3 -2
  10. package/dist/components/calendly/Calendly.view.js +2 -1
  11. package/dist/components/card/{Card.module.scss.js → Card.base.module.scss.js} +2 -12
  12. package/dist/components/card/Card.effects.client.js +16 -0
  13. package/dist/components/card/Card.effects.module.scss.js +14 -0
  14. package/dist/components/card/Card.view.js +15 -4
  15. package/dist/components/carousel/Carousel.client.js +44 -20
  16. package/dist/components/carousel/Carousel.lazy.js +1 -1
  17. package/dist/components/carousel/Carousel.module.scss.js +2 -8
  18. package/dist/components/chip/Chip.module.scss.js +2 -8
  19. package/dist/components/datePicker/DatePicker.client.js +52 -51
  20. package/dist/components/datePicker/DatePicker.view.js +14 -3
  21. package/dist/components/dialog/Dialog.module.scss.js +2 -8
  22. package/dist/components/drawer/{Drawer.module.scss.js → Drawer.base.module.scss.js} +27 -32
  23. package/dist/components/drawer/Drawer.client.js +19 -2
  24. package/dist/components/drawer/Drawer.effects.client.js +16 -0
  25. package/dist/components/drawer/Drawer.effects.module.scss.js +29 -0
  26. package/dist/components/drawer/Drawer.server.js +0 -1
  27. package/dist/components/drawer/Drawer.view.js +44 -40
  28. package/dist/components/dynamic-list/DynamicList.module.scss.js +2 -8
  29. package/dist/components/form/Form.client.js +131 -54
  30. package/dist/components/form/Form.module.scss.js +2 -8
  31. package/dist/components/form/FormField.module.scss.js +2 -8
  32. package/dist/components/form/FormResponse.module.scss.js +2 -8
  33. package/dist/components/grid/Grid.module.scss.js +2 -8
  34. package/dist/components/grid/GridRow.module.scss.js +2 -8
  35. package/dist/components/headline/{Headline.module.scss.js → Headline.base.module.scss.js} +2 -15
  36. package/dist/components/headline/Headline.effects.client.js +14 -0
  37. package/dist/components/headline/Headline.effects.module.scss.js +13 -0
  38. package/dist/components/headline/Headline.js +28 -18
  39. package/dist/components/icon/Icon.module.scss.js +2 -8
  40. package/dist/components/image/Image.module.scss.js +2 -8
  41. package/dist/components/image-text/ImageText.module.scss.js +2 -8
  42. package/dist/components/input/Input.client.js +12 -1
  43. package/dist/components/input/Input.module.scss.js +3 -8
  44. package/dist/components/input/Input.view.js +10 -2
  45. package/dist/components/inputOTP/InputOTP.js +124 -41
  46. package/dist/components/inputOTP/InputOTP.module.scss.js +2 -8
  47. package/dist/components/label/Label.module.scss.js +2 -8
  48. package/dist/components/link/Link.module.scss.js +2 -8
  49. package/dist/components/list/List.module.scss.js +2 -8
  50. package/dist/components/loading/Loading.client.js +68 -0
  51. package/dist/components/loading/Loading.js +9 -55
  52. package/dist/components/loading/Loading.lazy.js +15 -0
  53. package/dist/components/loading/Loading.server.js +16 -0
  54. package/dist/components/loading/Loading.view.js +124 -0
  55. package/dist/components/lottie/Lottie.module.scss.js +2 -8
  56. package/dist/components/post-item/PostItem.module.scss.js +2 -8
  57. package/dist/components/post-item/PostItemAuthor.module.scss.js +2 -8
  58. package/dist/components/post-teaser/PostTeaser.module.scss.js +2 -8
  59. package/dist/components/post-widget/PostWidget.module.scss.js +2 -8
  60. package/dist/components/post-widget-carousel/PostWidgetCarousel.module.scss.js +2 -8
  61. package/dist/components/progressBar/ProgressBar.module.scss.js +1 -7
  62. package/dist/components/quote/Quote.module.scss.js +2 -8
  63. package/dist/components/rich-text/RichText.client.js +50 -22
  64. package/dist/components/rich-text/RichText.js +1 -1
  65. package/dist/components/rich-text/RichText.lazy.js +1 -1
  66. package/dist/components/rich-text/RichText.module.scss.js +5 -8
  67. package/dist/components/rich-text/RichText.server.js +2 -1
  68. package/dist/components/select/Select.module.scss.js +2 -8
  69. package/dist/components/sidenav/SideNav.module.scss.js +2 -8
  70. package/dist/components/skeleton/{Skeleton.module.scss.js → Skeleton.base.module.scss.js} +2 -8
  71. package/dist/components/skeleton/Skeleton.effects.client.js +16 -0
  72. package/dist/components/skeleton/Skeleton.effects.module.scss.js +7 -0
  73. package/dist/components/skeleton/Skeleton.js +21 -18
  74. package/dist/components/slider/Slider.client.js +70 -30
  75. package/dist/components/slider/Slider.module.scss.js +2 -8
  76. package/dist/components/snackbar/Snackbar.module.scss.js +2 -8
  77. package/dist/components/stepper/Stepper.module.scss.js +2 -8
  78. package/dist/components/switch/Switch.module.scss.js +2 -8
  79. package/dist/components/table/Table.module.scss.js +2 -8
  80. package/dist/components/table/TableCell.module.scss.js +2 -8
  81. package/dist/components/teaser/Teaser.module.scss.js +2 -8
  82. package/dist/constants/project.js +1 -1
  83. package/dist/hooks/useResponsiveValue.js +123 -0
  84. package/dist/tsconfig.build.tsbuildinfo +1 -1
  85. package/dist/types/components/accordion/Accordion.effects.client.d.ts +5 -0
  86. package/dist/types/components/calendly/Calendly.server.d.ts +1 -1
  87. package/dist/types/components/calendly/Calendly.view.d.ts +1 -1
  88. package/dist/types/components/card/Card.effects.client.d.ts +7 -0
  89. package/dist/types/components/carousel/Carousel.d.ts +2 -0
  90. package/dist/types/components/carousel/Carousel.lazy.d.ts +2 -0
  91. package/dist/types/components/carousel/Carousel.model.d.ts +14 -0
  92. package/dist/types/components/datePicker/DatePicker.view.d.ts +3 -5
  93. package/dist/types/components/drawer/Drawer.effects.client.d.ts +5 -0
  94. package/dist/types/components/headline/Headline.effects.client.d.ts +1 -0
  95. package/dist/types/components/input/Input.client.d.ts +1 -1
  96. package/dist/types/components/input/Input.view.d.ts +1 -1
  97. package/dist/types/components/loading/Loading.client.d.ts +4 -0
  98. package/dist/types/components/loading/Loading.d.ts +4 -2
  99. package/dist/types/components/loading/Loading.lazy.d.ts +5 -0
  100. package/dist/types/components/loading/Loading.model.d.ts +16 -1
  101. package/dist/types/components/loading/Loading.server.d.ts +4 -0
  102. package/dist/types/components/loading/Loading.view.d.ts +6 -0
  103. package/dist/types/components/loading/index.d.ts +2 -2
  104. package/dist/types/components/rich-text/RichText.d.ts +1 -1
  105. package/dist/types/components/rich-text/RichText.lazy.d.ts +1 -1
  106. package/dist/types/components/rich-text/RichText.model.d.ts +3 -3
  107. package/dist/types/components/skeleton/Skeleton.effects.client.d.ts +5 -0
  108. package/dist/types/components/slider/Slider.model.d.ts +1 -0
  109. package/dist/types/hooks/useResponsiveValue.d.ts +21 -0
  110. package/dist/ui.css +1001 -1449
  111. package/package.json +1 -1
  112. package/dist/components/loading/Loading.module.scss.js +0 -22
@@ -1,6 +1,4 @@
1
1
  const accordionBorderShift = "accordionBorderShift";
2
- const gradientMove = "gradientMove";
3
- const fadeInKeyframe = "fadeInKeyframe";
4
2
  const styles = {
5
3
  "prokodo-Accordion": "prokodo-Accordion",
6
4
  "prokodo-Accordion__item": "prokodo-Accordion__item",
@@ -13,13 +11,9 @@ const styles = {
13
11
  "prokodo-Accordion__icon--is-hidden": "prokodo-Accordion__icon--is-hidden",
14
12
  "prokodo-Accordion__content": "prokodo-Accordion__content",
15
13
  "prokodo-Accordion__content--is-expanded": "prokodo-Accordion__content--is-expanded",
16
- "prokodo-Accordion__actions": "prokodo-Accordion__actions",
17
- gradientMove,
18
- fadeInKeyframe
14
+ "prokodo-Accordion__actions": "prokodo-Accordion__actions"
19
15
  };
20
16
  export {
21
17
  accordionBorderShift,
22
- styles as default,
23
- fadeInKeyframe,
24
- gradientMove
18
+ styles as default
25
19
  };
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ var __defProp = Object.defineProperty;
3
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
+ import { useEffect } from "react";
5
+ function AccordionEffectsLoader({ useBorderShift }) {
6
+ useEffect(() => {
7
+ if (Boolean(useBorderShift)) {
8
+ void import("./Accordion.effects.module.scss.js");
9
+ }
10
+ }, [useBorderShift]);
11
+ return null;
12
+ }
13
+ __name(AccordionEffectsLoader, "AccordionEffectsLoader");
14
+ export {
15
+ AccordionEffectsLoader
16
+ };
@@ -0,0 +1,8 @@
1
+ const accordionBorderShift = "accordionBorderShift";
2
+ const Accordion_effects_module = {
3
+ accordionBorderShift
4
+ };
5
+ export {
6
+ accordionBorderShift,
7
+ Accordion_effects_module as default
8
+ };
@@ -1,9 +1,10 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { jsxs, jsx } from "react/jsx-runtime";
4
4
  import { create } from "../../helpers/bem.js";
5
5
  import { isNull } from "../../helpers/validations.js";
6
- import styles from "./Accordion.module.scss.js";
6
+ import styles from "./Accordion.base.module.scss.js";
7
+ import { AccordionEffectsLoader } from "./Accordion.effects.client.js";
7
8
  import { Headline } from "../headline/Headline.js";
8
9
  import { Animated } from "../animated/Animated.js";
9
10
  import { Button } from "../button/Button.js";
@@ -20,84 +21,87 @@ function AccordionView({
20
21
  iconProps,
21
22
  ...domRest
22
23
  }) {
23
- return /* @__PURE__ */ jsx("div", { ...domRest, className: bem(void 0, { [variant]: true }, className), children: items.map((item, index) => {
24
- const { title, renderHeader, renderContent, actions, className: itemCls } = item;
25
- const accId = `${id}-${title}`;
26
- const isExpanded = expandedIndex === index;
27
- return /* @__PURE__ */ jsxs(
28
- "div",
29
- {
30
- className: bem("item", { "is-expanded": isExpanded }, itemCls),
31
- children: [
32
- /* @__PURE__ */ jsxs(
33
- "div",
34
- {
35
- "aria-controls": `${accId}-content`,
36
- "aria-expanded": isExpanded,
37
- className: bem("header", { "is-expanded": isExpanded }),
38
- id: `${accId}-header`,
39
- role: "button",
40
- tabIndex: 0,
41
- onClick: onToggle ? (e) => onToggle(index, e) : void 0,
42
- onKeyDown: onToggle ? (e) => {
43
- if (e.key === "Enter" || e.key === " ") onToggle(index, e);
44
- } : void 0,
45
- children: [
46
- !isNull(renderHeader) ? renderHeader : /* @__PURE__ */ jsx(
47
- Headline,
48
- {
49
- animated: true,
50
- className: bem("title"),
51
- highlight: isExpanded,
52
- size: "xs",
53
- type: "h3",
54
- variant: isExpanded ? "primary" : "inherit",
55
- ...item.titleOptions ?? titleOptions,
56
- children: title
57
- }
58
- ),
59
- /* @__PURE__ */ jsx(
60
- Icon,
61
- {
62
- className: bem("icon", { "is-hidden": isExpanded }),
63
- color: "inherit",
64
- name: "PlusSignIcon",
65
- size: "sm",
66
- ...iconProps
67
- }
68
- ),
69
- /* @__PURE__ */ jsx(
70
- Icon,
71
- {
72
- className: bem("icon", { "is-hidden": !isExpanded }),
73
- color: "inherit",
74
- name: "MinusSignIcon",
75
- size: "sm",
76
- ...iconProps
77
- }
78
- )
79
- ]
80
- }
81
- ),
82
- /* @__PURE__ */ jsxs(
83
- "div",
84
- {
85
- "aria-labelledby": `${accId}-header`,
86
- className: bem("content", { "is-expanded": isExpanded }),
87
- hidden: !isExpanded,
88
- id: `${accId}-content`,
89
- role: "region",
90
- children: [
91
- !isNull(renderContent) && /* @__PURE__ */ jsx(Animated, { children: renderContent }),
92
- actions !== void 0 && (actions == null ? void 0 : actions.length) ? /* @__PURE__ */ jsx("div", { className: bem("actions"), children: actions.map((action) => /* @__PURE__ */ jsx(Button, { ...action }, `${accId}-action-${action.id}`)) }) : null
93
- ]
94
- }
95
- )
96
- ]
97
- },
98
- accId
99
- );
100
- }) });
24
+ return /* @__PURE__ */ jsxs("div", { ...domRest, className: bem(void 0, { [variant]: true }, className), children: [
25
+ /* @__PURE__ */ jsx(AccordionEffectsLoader, { useBorderShift: true }),
26
+ items.map((item, index) => {
27
+ const { title, renderHeader, renderContent, actions, className: itemCls } = item;
28
+ const accId = `${id}-${title}`;
29
+ const isExpanded = expandedIndex === index;
30
+ return /* @__PURE__ */ jsxs(
31
+ "div",
32
+ {
33
+ className: bem("item", { "is-expanded": isExpanded }, itemCls),
34
+ children: [
35
+ /* @__PURE__ */ jsxs(
36
+ "div",
37
+ {
38
+ "aria-controls": `${accId}-content`,
39
+ "aria-expanded": isExpanded,
40
+ className: bem("header", { "is-expanded": isExpanded }),
41
+ id: `${accId}-header`,
42
+ role: "button",
43
+ tabIndex: 0,
44
+ onClick: onToggle ? (e) => onToggle(index, e) : void 0,
45
+ onKeyDown: onToggle ? (e) => {
46
+ if (e.key === "Enter" || e.key === " ") onToggle(index, e);
47
+ } : void 0,
48
+ children: [
49
+ !isNull(renderHeader) ? renderHeader : /* @__PURE__ */ jsx(
50
+ Headline,
51
+ {
52
+ animated: true,
53
+ className: bem("title"),
54
+ highlight: isExpanded,
55
+ size: "xs",
56
+ type: "h3",
57
+ variant: isExpanded ? "primary" : "inherit",
58
+ ...item.titleOptions ?? titleOptions,
59
+ children: title
60
+ }
61
+ ),
62
+ /* @__PURE__ */ jsx(
63
+ Icon,
64
+ {
65
+ className: bem("icon", { "is-hidden": isExpanded }),
66
+ color: "inherit",
67
+ name: "PlusSignIcon",
68
+ size: "sm",
69
+ ...iconProps
70
+ }
71
+ ),
72
+ /* @__PURE__ */ jsx(
73
+ Icon,
74
+ {
75
+ className: bem("icon", { "is-hidden": !isExpanded }),
76
+ color: "inherit",
77
+ name: "MinusSignIcon",
78
+ size: "sm",
79
+ ...iconProps
80
+ }
81
+ )
82
+ ]
83
+ }
84
+ ),
85
+ /* @__PURE__ */ jsxs(
86
+ "div",
87
+ {
88
+ "aria-labelledby": `${accId}-header`,
89
+ className: bem("content", { "is-expanded": isExpanded }),
90
+ hidden: !isExpanded,
91
+ id: `${accId}-content`,
92
+ role: "region",
93
+ children: [
94
+ !isNull(renderContent) && /* @__PURE__ */ jsx(Animated, { children: renderContent }),
95
+ actions !== void 0 && (actions == null ? void 0 : actions.length) ? /* @__PURE__ */ jsx("div", { className: bem("actions"), children: actions.map((action) => /* @__PURE__ */ jsx(Button, { ...action }, `${accId}-action-${action.id}`)) }) : null
96
+ ]
97
+ }
98
+ )
99
+ ]
100
+ },
101
+ accId
102
+ );
103
+ })
104
+ ] });
101
105
  }
102
106
  __name(AccordionView, "AccordionView");
103
107
  export {
@@ -1,5 +1,3 @@
1
- const gradientMove = "gradientMove";
2
- const fadeInKeyframe = "fadeInKeyframe";
3
1
  const styles = {
4
2
  "prokodo-Animated": "prokodo-Animated",
5
3
  "prokodo-Animated--animate-bottom-top": "prokodo-Animated--animate-bottom-top",
@@ -9,12 +7,8 @@ const styles = {
9
7
  "prokodo-Animated--is-visible": "prokodo-Animated--is-visible",
10
8
  "prokodo-Animated--is-disabled": "prokodo-Animated--is-disabled",
11
9
  "prokodo-Animated--has-fast-speed": "prokodo-Animated--has-fast-speed",
12
- "prokodo-Animated--has-slow-speed": "prokodo-Animated--has-slow-speed",
13
- gradientMove,
14
- fadeInKeyframe
10
+ "prokodo-Animated--has-slow-speed": "prokodo-Animated--has-slow-speed"
15
11
  };
16
12
  export {
17
- styles as default,
18
- fadeInKeyframe,
19
- gradientMove
13
+ styles as default
20
14
  };
@@ -1,5 +1,3 @@
1
- const gradientMove = "gradientMove";
2
- const fadeInKeyframe = "fadeInKeyframe";
3
1
  const styles = {
4
2
  "prokodo-Avatar": "prokodo-Avatar",
5
3
  "prokodo-Avatar--primary": "prokodo-Avatar--primary",
@@ -15,12 +13,8 @@ const styles = {
15
13
  "prokodo-Avatar--has-size-lg": "prokodo-Avatar--has-size-lg",
16
14
  "prokodo-Avatar--has-size-xl": "prokodo-Avatar--has-size-xl",
17
15
  "prokodo-Avatar__image": "prokodo-Avatar__image",
18
- "prokodo-Avatar__link": "prokodo-Avatar__link",
19
- gradientMove,
20
- fadeInKeyframe
16
+ "prokodo-Avatar__link": "prokodo-Avatar__link"
21
17
  };
22
18
  export {
23
- styles as default,
24
- fadeInKeyframe,
25
- gradientMove
19
+ styles as default
26
20
  };
@@ -1,5 +1,3 @@
1
- const gradientMove = "gradientMove";
2
- const fadeInKeyframe = "fadeInKeyframe";
3
1
  const styles = {
4
2
  "prokodo-Button": "prokodo-Button",
5
3
  "prokodo-Button--has-bg-primary": "prokodo-Button--has-bg-primary",
@@ -26,12 +24,8 @@ const styles = {
26
24
  "prokodo-Button__link": "prokodo-Button__link",
27
25
  "prokodo-Button__link--icon-only": "prokodo-Button__link--icon-only",
28
26
  "prokodo-Button__content": "prokodo-Button__content",
29
- "prokodo-Button__content--icon-only": "prokodo-Button__content--icon-only",
30
- gradientMove,
31
- fadeInKeyframe
27
+ "prokodo-Button__content--icon-only": "prokodo-Button__content--icon-only"
32
28
  };
33
29
  export {
34
- styles as default,
35
- fadeInKeyframe,
36
- gradientMove
30
+ styles as default
37
31
  };
@@ -4,9 +4,11 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
4
4
  import { jsxs, jsx } from "react/jsx-runtime";
5
5
  import { useRef, useState, useCallback, useMemo, useEffect } from "react";
6
6
  import { isString } from "../../helpers/validations.js";
7
- import { Animated } from "../animated/Animated.js";
8
7
  import { Loading } from "../loading/Loading.js";
8
+ import { Animated } from "../animated/Animated.js";
9
9
  let scriptAlreadyLoaded = false;
10
+ let cssAlreadyLoaded = false;
11
+ let devWarnedTwice = false;
10
12
  function CalendlyClient(props) {
11
13
  const {
12
14
  calendlyId,
@@ -24,8 +26,11 @@ function CalendlyClient(props) {
24
26
  ...rest
25
27
  } = props;
26
28
  const calendlyRef = useRef(null);
29
+ const visibleRef = useRef(false);
30
+ const didInitRef = useRef(false);
27
31
  const [widgetInitialized, setWidgetInitialized] = useState(false);
28
32
  const [scriptLoaded, setScriptLoaded] = useState(scriptAlreadyLoaded);
33
+ const [error, setError] = useState(null);
29
34
  const format = /* @__PURE__ */ __name((c) => c == null ? void 0 : c.replaceAll("#", ""), "format");
30
35
  const safePrefill = useCallback(() => {
31
36
  const res = {};
@@ -45,7 +50,7 @@ function CalendlyClient(props) {
45
50
  if (isString(colors.button)) p.set("primary_color", format(colors.button));
46
51
  if (isString(data == null ? void 0 : data.utm_campaign)) p.set("utm_campaign", (data == null ? void 0 : data.utm_campaign) ?? "");
47
52
  if (isString(data == null ? void 0 : data.utm_source)) p.set("utm_source", (data == null ? void 0 : data.utm_source) ?? "");
48
- return `https://calendly.com/${calendlyId}?${p.toString()}`;
53
+ return calendlyId ? `https://calendly.com/${calendlyId}?${p.toString()}` : "";
49
54
  }, [
50
55
  calendlyId,
51
56
  colors,
@@ -54,28 +59,68 @@ function CalendlyClient(props) {
54
59
  hideEventTypeDetails,
55
60
  hideCookieSettings
56
61
  ]);
62
+ const tryInit = useCallback((attempt = 0) => {
63
+ const host = calendlyRef.current;
64
+ if (!host) return;
65
+ if (didInitRef.current) return;
66
+ if (host.dataset.initialized === "1") return;
67
+ if (widgetInitialized) return;
68
+ if (!calendlyId) {
69
+ setError("Calendly ID missing.");
70
+ return;
71
+ }
72
+ if (!dataUrl) {
73
+ setError("Calendly URL could not be built.");
74
+ return;
75
+ }
76
+ if (window.Calendly) {
77
+ try {
78
+ host.innerHTML = "";
79
+ } catch {
80
+ }
81
+ host.setAttribute("data-url", dataUrl);
82
+ window.Calendly.initInlineWidget({
83
+ url: dataUrl,
84
+ parentElement: host,
85
+ prefill: safePrefill()
86
+ });
87
+ setWidgetInitialized(true);
88
+ didInitRef.current = true;
89
+ host.dataset.initialized = "1";
90
+ setWidgetInitialized(true);
91
+ if (process.env.NODE_ENV !== "production" && !devWarnedTwice) {
92
+ devWarnedTwice = true;
93
+ console.debug("[Calendly] widget initialized");
94
+ }
95
+ return;
96
+ }
97
+ if (attempt < 10) {
98
+ setTimeout(() => tryInit(attempt + 1), 100);
99
+ } else {
100
+ console.warn("Calendly widget failed to load.");
101
+ setError("Calendly widget failed to load.");
102
+ }
103
+ }, [dataUrl, safePrefill, widgetInitialized, calendlyId]);
57
104
  const onAnimate = useCallback(
58
105
  (visible) => {
59
- if (!visible || !scriptLoaded || widgetInitialized) return;
60
- const tryInit = /* @__PURE__ */ __name((attempt = 0) => {
61
- var _a;
62
- if (window.Calendly) {
63
- (_a = calendlyRef.current) == null ? void 0 : _a.setAttribute("data-url", dataUrl);
64
- window.Calendly.initInlineWidget({
65
- url: dataUrl,
66
- parentElement: calendlyRef.current,
67
- prefill: safePrefill()
68
- });
69
- setWidgetInitialized(true);
70
- return;
71
- }
72
- if (attempt < 10) setTimeout(() => tryInit(attempt + 1), 100);
73
- else console.warn("Calendly widget failed to load.");
74
- }, "tryInit");
75
- tryInit();
106
+ visibleRef.current = visible;
107
+ if (!visible || widgetInitialized) return;
108
+ if (scriptLoaded) tryInit();
76
109
  },
77
- [scriptLoaded, widgetInitialized, dataUrl, safePrefill]
110
+ [scriptLoaded, widgetInitialized, tryInit]
78
111
  );
112
+ useEffect(() => () => {
113
+ const host = calendlyRef.current;
114
+ if (host) {
115
+ try {
116
+ host.innerHTML = "";
117
+ delete host.dataset.initialized;
118
+ } catch {
119
+ }
120
+ }
121
+ didInitRef.current = false;
122
+ setWidgetInitialized(false);
123
+ }, []);
79
124
  useEffect(() => {
80
125
  if (scriptAlreadyLoaded || typeof document === "undefined") {
81
126
  setScriptLoaded(true);
@@ -88,15 +133,46 @@ function CalendlyClient(props) {
88
133
  scriptAlreadyLoaded = true;
89
134
  setScriptLoaded(true);
90
135
  };
136
+ s.onerror = () => {
137
+ setError("Calendly script blocked or failed to load.");
138
+ };
91
139
  document.body.appendChild(s);
140
+ const watchdog = window.setTimeout(() => {
141
+ if (!scriptAlreadyLoaded) setError("Calendly script did not load (timeout).");
142
+ }, 8e3);
143
+ return () => clearTimeout(watchdog);
144
+ }, []);
145
+ useEffect(() => {
146
+ if (cssAlreadyLoaded || typeof document === "undefined") return;
147
+ const link = document.createElement("link");
148
+ link.rel = "stylesheet";
149
+ link.href = "https://assets.calendly.com/assets/external/widget.css";
150
+ document.head.appendChild(link);
151
+ cssAlreadyLoaded = true;
92
152
  }, []);
153
+ useEffect(() => {
154
+ if (scriptLoaded && visibleRef.current && !widgetInitialized) {
155
+ tryInit();
156
+ }
157
+ }, [scriptLoaded, widgetInitialized, tryInit]);
158
+ useEffect(() => {
159
+ if (scriptLoaded && !widgetInitialized) {
160
+ const id = setTimeout(() => tryInit(), 0);
161
+ return () => clearTimeout(id);
162
+ }
163
+ return;
164
+ }, [scriptLoaded, widgetInitialized, tryInit]);
93
165
  const divStyle = {
94
- display: widgetInitialized ? "block" : "none",
166
+ display: "block",
95
167
  minWidth: 320,
96
168
  height: 700
97
169
  };
98
170
  return /* @__PURE__ */ jsxs(Animated, { ...animationProps, onAnimate, children: [
99
- !Boolean(hideLoading) && !widgetInitialized && /* @__PURE__ */ jsx(Loading, {}),
171
+ !Boolean(hideLoading) && !Boolean(widgetInitialized) && !isString(error) && /* @__PURE__ */ jsx(Loading, {}),
172
+ isString(error) && /* @__PURE__ */ jsxs("div", { role: "alert", style: { padding: 12 }, children: [
173
+ /* @__PURE__ */ jsx("p", { style: { margin: 0 }, children: error }),
174
+ dataUrl && /* @__PURE__ */ jsx("p", { style: { marginTop: 8 }, children: /* @__PURE__ */ jsx("a", { href: dataUrl, rel: "noreferrer", target: "_blank", children: "Open Calendly in a new tab" }) })
175
+ ] }),
100
176
  /* @__PURE__ */ jsx("div", { ref: calendlyRef, ...rest, style: divStyle })
101
177
  ] });
102
178
  }
@@ -2,8 +2,9 @@ var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  import { CalendlyView } from "./Calendly.view.js";
5
- function CalendlyServer(props) {
6
- return /* @__PURE__ */ jsx(CalendlyView, { ...props });
5
+ function CalendlyServer({ ...rest }) {
6
+ rest == null ? true : delete rest.hideCookieSettings;
7
+ return /* @__PURE__ */ jsx(CalendlyView, { ...rest });
7
8
  }
8
9
  __name(CalendlyServer, "CalendlyServer");
9
10
  export {
@@ -7,10 +7,11 @@ function CalendlyView({
7
7
  animationProps,
8
8
  hideLoading,
9
9
  LoadingComponent = Loading,
10
+ calendlyId: _calendlyId,
10
11
  ...rest
11
12
  }) {
12
13
  const style = {
13
- display: "none",
14
+ display: "block",
14
15
  minWidth: 320,
15
16
  height: 700
16
17
  };
@@ -1,6 +1,3 @@
1
- const fadeInMask = "fadeInMask";
2
- const fadeInKeyframe = "fadeInKeyframe";
3
- const gradientMove = "gradientMove";
4
1
  const styles = {
5
2
  "prokodo-Card": "prokodo-Card",
6
3
  "prokodo-Card--inherit": "prokodo-Card--inherit",
@@ -17,18 +14,11 @@ const styles = {
17
14
  "prokodo-Card__gradiant--success": "prokodo-Card__gradiant--success",
18
15
  "prokodo-Card__gradiant--warning": "prokodo-Card__gradiant--warning",
19
16
  "prokodo-Card--has-highlight": "prokodo-Card--has-highlight",
20
- fadeInMask,
21
17
  "prokodo-Card--has-gradiant": "prokodo-Card--has-gradiant",
22
18
  "prokodo-Card--has-background": "prokodo-Card--has-background",
23
19
  "prokodo-Card--has-shadow": "prokodo-Card--has-shadow",
24
- "prokodo-Card--has-animation": "prokodo-Card--has-animation",
25
- fadeInKeyframe,
26
- "prokodo-Card--is-clickable": "prokodo-Card--is-clickable",
27
- gradientMove
20
+ "prokodo-Card--is-clickable": "prokodo-Card--is-clickable"
28
21
  };
29
22
  export {
30
- styles as default,
31
- fadeInKeyframe,
32
- fadeInMask,
33
- gradientMove
23
+ styles as default
34
24
  };
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ var __defProp = Object.defineProperty;
3
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
+ import { useEffect } from "react";
5
+ function CardEffectsLoader({ useReveal, useHighlight, useGradient }) {
6
+ useEffect(() => {
7
+ if (Boolean(useReveal) || Boolean(useHighlight) || Boolean(useGradient)) {
8
+ void import("./Card.effects.module.scss.js");
9
+ }
10
+ }, [useReveal, useHighlight, useGradient]);
11
+ return null;
12
+ }
13
+ __name(CardEffectsLoader, "CardEffectsLoader");
14
+ export {
15
+ CardEffectsLoader
16
+ };
@@ -0,0 +1,14 @@
1
+ const Card_fadeInAnimation = "Card_fadeInAnimation";
2
+ const Card_fadeInMask = "Card_fadeInMask";
3
+ const Card_effects_module = {
4
+ "prokodo-Card": "prokodo-Card",
5
+ "prokodo-Card--has-animation": "prokodo-Card--has-animation",
6
+ Card_fadeInAnimation,
7
+ "prokodo-Card--has-highlight": "prokodo-Card--has-highlight",
8
+ Card_fadeInMask
9
+ };
10
+ export {
11
+ Card_fadeInAnimation,
12
+ Card_fadeInMask,
13
+ Card_effects_module as default
14
+ };
@@ -4,7 +4,8 @@ import { jsxs, jsx } from "react/jsx-runtime";
4
4
  import { Animated } from "../animated/Animated.js";
5
5
  import { create } from "../../helpers/bem.js";
6
6
  import { isString } from "../../helpers/validations.js";
7
- import styles from "./Card.module.scss.js";
7
+ import styles from "./Card.base.module.scss.js";
8
+ import { CardEffectsLoader } from "./Card.effects.client.js";
8
9
  import { Skeleton } from "../skeleton/Skeleton.js";
9
10
  import { Image } from "../image/Image.js";
10
11
  import { Link } from "../link/Link.js";
@@ -34,7 +35,7 @@ function CardView({
34
35
  onMouseEnter,
35
36
  onMouseLeave
36
37
  }) {
37
- const mod = {
38
+ const modifiers = {
38
39
  [variant]: true,
39
40
  "is-clickable": Boolean(isClickable),
40
41
  "has-highlight": Boolean(highlight),
@@ -42,13 +43,22 @@ function CardView({
42
43
  "has-background": Boolean(background),
43
44
  "has-shadow": enableShadow !== false && (Boolean(isClickable) || Boolean(enableShadow)),
44
45
  "has-animation": Boolean(animated)
46
+ // hook only; actual animation rules live in effects sheet
45
47
  };
48
+ const effects = /* @__PURE__ */ jsx(
49
+ CardEffectsLoader,
50
+ {
51
+ useGradient: Boolean(gradiant),
52
+ useHighlight: Boolean(highlight),
53
+ useReveal: Boolean(animated)
54
+ }
55
+ );
46
56
  const innerCard = (
47
57
  /* eslint-disable jsx-a11y/no-static-element-interactions */
48
58
  /* @__PURE__ */ jsxs(
49
59
  "div",
50
60
  {
51
- className: bem(void 0, mod, className),
61
+ className: bem(void 0, modifiers, className),
52
62
  role: !redirect && Boolean(isClickable) ? "button" : void 0,
53
63
  tabIndex: !redirect && Boolean(isClickable) ? 0 : -1,
54
64
  onClick: Boolean(isClickable) && !redirect ? onClick : void 0,
@@ -56,10 +66,11 @@ function CardView({
56
66
  onMouseEnter,
57
67
  onMouseLeave,
58
68
  children: [
69
+ effects,
59
70
  Boolean(loading) && /* @__PURE__ */ jsx(
60
71
  Skeleton,
61
72
  {
62
- className: bem("skeleton", mod),
73
+ className: bem("skeleton", modifiers),
63
74
  variant: "rectangular",
64
75
  ...skeletonProps
65
76
  }