@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260708070033 → 0.8.1-dev.20260709113231

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.
@@ -0,0 +1,32 @@
1
+ "use client";
2
+
3
+ "use client";
4
+
5
+ // src/components/pageRenderingEngine/nodes/EnterAnimationClient.tsx
6
+ import React, { useEffect, useRef } from "react";
7
+ import { Fragment, jsx } from "react/jsx-runtime";
8
+ function EnterAnimationClient({ hasEnterAnimation, children }) {
9
+ const ref = useRef(null);
10
+ useEffect(() => {
11
+ if (!hasEnterAnimation || !ref.current) return;
12
+ const observer = new IntersectionObserver(
13
+ (entries) => {
14
+ entries.forEach((entry) => {
15
+ if (entry.isIntersecting) {
16
+ entry.target.classList.add("visible");
17
+ observer.unobserve(entry.target);
18
+ }
19
+ });
20
+ },
21
+ { threshold: 0.1 }
22
+ );
23
+ observer.observe(ref.current);
24
+ return () => observer.disconnect();
25
+ }, [hasEnterAnimation]);
26
+ return /* @__PURE__ */ jsx(Fragment, { children: children && // enforce passing the ref to Wrapper
27
+ //@ts-ignore
28
+ React.cloneElement(children, { ref }) });
29
+ }
30
+ export {
31
+ EnterAnimationClient as default
32
+ };
@@ -0,0 +1,30 @@
1
+ "use client";
2
+
3
+ // src/components/pageRenderingEngine/nodes/EnterAnimationClient.tsx
4
+ import React, { useEffect, useRef } from "react";
5
+ import { Fragment, jsx } from "react/jsx-runtime";
6
+ function EnterAnimationClient({ hasEnterAnimation, children }) {
7
+ const ref = useRef(null);
8
+ useEffect(() => {
9
+ if (!hasEnterAnimation || !ref.current) return;
10
+ const observer = new IntersectionObserver(
11
+ (entries) => {
12
+ entries.forEach((entry) => {
13
+ if (entry.isIntersecting) {
14
+ entry.target.classList.add("visible");
15
+ observer.unobserve(entry.target);
16
+ }
17
+ });
18
+ },
19
+ { threshold: 0.1 }
20
+ );
21
+ observer.observe(ref.current);
22
+ return () => observer.disconnect();
23
+ }, [hasEnterAnimation]);
24
+ return /* @__PURE__ */ jsx(Fragment, { children: children && // enforce passing the ref to Wrapper
25
+ //@ts-ignore
26
+ React.cloneElement(children, { ref }) });
27
+ }
28
+ export {
29
+ EnterAnimationClient as default
30
+ };
@@ -22,15 +22,15 @@ import {
22
22
  Hyperlink,
23
23
  Icon_default,
24
24
  InputControlType_default
25
- } from "./chunk-2GSYECIS.mjs";
25
+ } from "./chunk-FI2KJBK2.mjs";
26
26
  import {
27
27
  Button_default,
28
28
  ClientButton_default
29
- } from "./chunk-67IG5NBU.mjs";
29
+ } from "./chunk-JKP4XOZB.mjs";
30
30
  import "./chunk-IMNQO57B.mjs";
31
31
 
32
32
  // src/components/controls/edit/InputControlClient.tsx
33
- import React4 from "react";
33
+ import React5 from "react";
34
34
 
35
35
  // src/components/controls/edit/Select.tsx
36
36
  import { useState, useEffect } from "react";
@@ -570,9 +570,81 @@ var AssetUpload = (props) => {
570
570
  };
571
571
  var AssetUpload_default = AssetUpload;
572
572
 
573
+ // src/components/controls/edit/SwitchInput.tsx
574
+ import React4 from "react";
575
+ import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
576
+ var SwitchInput = (props) => {
577
+ const textChangeHandler = (event) => {
578
+ let text = event.target.checked;
579
+ if (props.callback !== void 0) {
580
+ props.callback({
581
+ name: props.name,
582
+ value: text,
583
+ index: props.index,
584
+ groupKey: props.groupKey
585
+ });
586
+ }
587
+ };
588
+ let value = false;
589
+ if (props.value != void 0 && props.value != null && props.value != "" && (props.value == "true" || props.value.toString() == "true")) {
590
+ value = true;
591
+ }
592
+ return /* @__PURE__ */ jsx4(React4.Fragment, { children: /* @__PURE__ */ jsxs4("div", { className: "flex items-start justify-between gap-4 py-3", children: [
593
+ /* @__PURE__ */ jsxs4("div", { className: "min-w-0", children: [
594
+ props?.attributes?.label && /* @__PURE__ */ jsxs4(
595
+ "label",
596
+ {
597
+ htmlFor: props.name,
598
+ className: "inline-block text-sm font-semibold text-slate-800",
599
+ children: [
600
+ props.attributes.label,
601
+ props?.attributes?.required && /* @__PURE__ */ jsx4("span", { className: "bg-error-weak", children: "*" })
602
+ ]
603
+ }
604
+ ),
605
+ /* @__PURE__ */ jsx4("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage || "" })
606
+ ] }),
607
+ /* @__PURE__ */ jsxs4(
608
+ "label",
609
+ {
610
+ htmlFor: props.name,
611
+ className: "relative inline-flex shrink-0 cursor-pointer items-center peer-disabled:cursor-not-allowed",
612
+ children: [
613
+ /* @__PURE__ */ jsx4(
614
+ "input",
615
+ {
616
+ type: "checkbox",
617
+ name: props.name,
618
+ id: props.name,
619
+ checked: value,
620
+ onChange: textChangeHandler,
621
+ required: props?.attributes?.required,
622
+ disabled: props?.attributes?.readOnly,
623
+ className: "peer sr-only"
624
+ }
625
+ ),
626
+ /* @__PURE__ */ jsx4(
627
+ "div",
628
+ {
629
+ className: "h-6 w-11 rounded-full bg-slate-200 shadow-inner\r\n transition-colors duration-200 ease-in-out\r\n peer-checked:bg-blue-600\r\n peer-focus-visible:ring-2 peer-focus-visible:ring-blue-300 peer-focus-visible:ring-offset-2\r\n peer-disabled:bg-slate-100"
630
+ }
631
+ ),
632
+ /* @__PURE__ */ jsx4(
633
+ "div",
634
+ {
635
+ className: "absolute left-0.5 top-0.5 h-5 w-5 rounded-full bg-default shadow\r\n transition-transform duration-200 ease-in-out\r\n peer-checked:translate-x-5\r\n peer-disabled:bg-slate-50"
636
+ }
637
+ )
638
+ ]
639
+ }
640
+ )
641
+ ] }) });
642
+ };
643
+ var SwitchInput_default = SwitchInput;
644
+
573
645
  // src/components/controls/edit/InputControlClient.tsx
574
- import { jsx as jsx4 } from "react/jsx-runtime";
575
- var InputControl = React4.forwardRef(
646
+ import { jsx as jsx5 } from "react/jsx-runtime";
647
+ var InputControl = React5.forwardRef(
576
648
  (props, ref) => {
577
649
  const ControlComponents = {
578
650
  [InputControlType_default.lineTextInput]: LineTextInput_default,
@@ -591,10 +663,11 @@ var InputControl = React4.forwardRef(
591
663
  [InputControlType_default.selectWithSearchPanel]: SelectWithSearchPanel_default,
592
664
  [InputControlType_default.booleanSelect]: BooleanSelect_default,
593
665
  [InputControlType_default.timeInput]: TimeInput_default,
594
- [InputControlType_default.asset]: AssetUpload_default
666
+ [InputControlType_default.asset]: AssetUpload_default,
667
+ [InputControlType_default.switchInput]: SwitchInput_default
595
668
  };
596
669
  const SelectedControlComponent = ControlComponents[props.controlType];
597
- return /* @__PURE__ */ jsx4(React4.Fragment, { children: SelectedControlComponent ? /* @__PURE__ */ jsx4(SelectedControlComponent, { ...props }) : "Control not found" });
670
+ return /* @__PURE__ */ jsx5(React5.Fragment, { children: SelectedControlComponent ? /* @__PURE__ */ jsx5(SelectedControlComponent, { ...props }) : "Control not found" });
598
671
  }
599
672
  );
600
673
  InputControl.displayName = "InputControl";
@@ -24,7 +24,7 @@ import {
24
24
  import {
25
25
  Button_default,
26
26
  ClientButton_default
27
- } from "./chunk-IKIXEQPV.mjs";
27
+ } from "./chunk-YL6E76X2.mjs";
28
28
  import "./chunk-56HSDML5.mjs";
29
29
 
30
30
  // src/components/controls/edit/InputControlClient.tsx
@@ -26,7 +26,7 @@ import {
26
26
  import {
27
27
  Button_default,
28
28
  ClientButton_default
29
- } from "./chunk-67IG5NBU.mjs";
29
+ } from "./chunk-JKP4XOZB.mjs";
30
30
  import "./chunk-IMNQO57B.mjs";
31
31
 
32
32
  // src/components/controls/edit/InputControlClient.tsx
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  Button_default,
9
9
  ToastService_default
10
- } from "./chunk-67IG5NBU.mjs";
10
+ } from "./chunk-JKP4XOZB.mjs";
11
11
  import "./chunk-IMNQO57B.mjs";
12
12
 
13
13
  // src/components/pageRenderingEngine/nodes/LinkNodeButton.tsx
@@ -67,10 +67,9 @@ var LinkNodeButton = (props) => {
67
67
  }
68
68
  return current;
69
69
  }, []);
70
- const onClick = useCallback(async (e) => {
70
+ const onClick = useCallback(async () => {
71
71
  if (!node.postUrl) {
72
- ToastService_default.showError("No POST URL configured for this button");
73
- return;
72
+ return { isSuccessful: false, message: "No POST URL configured for this button" };
74
73
  }
75
74
  setIsLoading(true);
76
75
  try {
@@ -14,34 +14,48 @@ import { useCallback, useState as useState3 } from "react";
14
14
  import React3, { useState as useState2 } from "react";
15
15
 
16
16
  // src/components/ToastService.tsx
17
- var ToastService = class _ToastService {
17
+ var toastHandlersKey = "__digitalStoreToastHandlers";
18
+ var getToastHandlers = () => {
19
+ const globalScope = globalThis;
20
+ if (!globalScope[toastHandlersKey]) {
21
+ globalScope[toastHandlersKey] = {};
22
+ }
23
+ return globalScope[toastHandlersKey];
24
+ };
25
+ var ToastService = class {
18
26
  static initialize(showToast, closeToast) {
19
- _ToastService.showToast = showToast;
20
- _ToastService.closeToast = closeToast;
27
+ const handlers = getToastHandlers();
28
+ handlers.showToast = showToast;
29
+ handlers.closeToast = closeToast;
21
30
  }
22
31
  static showError(message) {
23
- if (_ToastService.showToast) {
24
- _ToastService.showToast(message, "error");
32
+ const handlers = getToastHandlers();
33
+ if (handlers.showToast) {
34
+ handlers.showToast(message, "error");
25
35
  }
26
36
  }
27
37
  static showInfo(message) {
28
- if (_ToastService.showToast) {
29
- _ToastService.showToast(message, "info");
38
+ const handlers = getToastHandlers();
39
+ if (handlers.showToast) {
40
+ handlers.showToast(message, "info");
30
41
  }
31
42
  }
32
43
  static showWarning(message) {
33
- if (_ToastService.showToast) {
34
- _ToastService.showToast(message, "warning");
44
+ const handlers = getToastHandlers();
45
+ if (handlers.showToast) {
46
+ handlers.showToast(message, "warning");
35
47
  }
36
48
  }
37
49
  static showSuccess(message) {
38
- if (_ToastService.showToast) {
39
- _ToastService.showToast(message, "success");
50
+ const handlers = getToastHandlers();
51
+ if (handlers.showToast) {
52
+ handlers.showToast(message, "success");
40
53
  }
41
54
  }
42
55
  static close() {
43
- if (_ToastService.closeToast) {
44
- _ToastService.closeToast();
56
+ const handlers = getToastHandlers();
57
+ if (handlers.closeToast) {
58
+ handlers.closeToast();
45
59
  }
46
60
  }
47
61
  };
@@ -254,10 +268,9 @@ var LinkNodeButton = (props) => {
254
268
  }
255
269
  return current;
256
270
  }, []);
257
- const onClick = useCallback(async (e) => {
271
+ const onClick = useCallback(async () => {
258
272
  if (!node.postUrl) {
259
- ToastService_default.showError("No POST URL configured for this button");
260
- return;
273
+ return { isSuccessful: false, message: "No POST URL configured for this button" };
261
274
  }
262
275
  setIsLoading(true);
263
276
  try {
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  Button_default,
7
7
  ToastService_default
8
- } from "./chunk-IKIXEQPV.mjs";
8
+ } from "./chunk-YL6E76X2.mjs";
9
9
  import "./chunk-56HSDML5.mjs";
10
10
 
11
11
  // src/components/pageRenderingEngine/nodes/LinkNodeButton.tsx
@@ -65,10 +65,9 @@ var LinkNodeButton = (props) => {
65
65
  }
66
66
  return current;
67
67
  }, []);
68
- const onClick = useCallback(async (e) => {
68
+ const onClick = useCallback(async () => {
69
69
  if (!node.postUrl) {
70
- ToastService_default.showError("No POST URL configured for this button");
71
- return;
70
+ return { isSuccessful: false, message: "No POST URL configured for this button" };
72
71
  }
73
72
  setIsLoading(true);
74
73
  try {
@@ -6,34 +6,48 @@ import {
6
6
  } from "./chunk-IMNQO57B.mjs";
7
7
 
8
8
  // src/components/ToastService.tsx
9
- var ToastService = class _ToastService {
9
+ var toastHandlersKey = "__digitalStoreToastHandlers";
10
+ var getToastHandlers = () => {
11
+ const globalScope = globalThis;
12
+ if (!globalScope[toastHandlersKey]) {
13
+ globalScope[toastHandlersKey] = {};
14
+ }
15
+ return globalScope[toastHandlersKey];
16
+ };
17
+ var ToastService = class {
10
18
  static initialize(showToast, closeToast) {
11
- _ToastService.showToast = showToast;
12
- _ToastService.closeToast = closeToast;
19
+ const handlers = getToastHandlers();
20
+ handlers.showToast = showToast;
21
+ handlers.closeToast = closeToast;
13
22
  }
14
23
  static showError(message) {
15
- if (_ToastService.showToast) {
16
- _ToastService.showToast(message, "error");
24
+ const handlers = getToastHandlers();
25
+ if (handlers.showToast) {
26
+ handlers.showToast(message, "error");
17
27
  }
18
28
  }
19
29
  static showInfo(message) {
20
- if (_ToastService.showToast) {
21
- _ToastService.showToast(message, "info");
30
+ const handlers = getToastHandlers();
31
+ if (handlers.showToast) {
32
+ handlers.showToast(message, "info");
22
33
  }
23
34
  }
24
35
  static showWarning(message) {
25
- if (_ToastService.showToast) {
26
- _ToastService.showToast(message, "warning");
36
+ const handlers = getToastHandlers();
37
+ if (handlers.showToast) {
38
+ handlers.showToast(message, "warning");
27
39
  }
28
40
  }
29
41
  static showSuccess(message) {
30
- if (_ToastService.showToast) {
31
- _ToastService.showToast(message, "success");
42
+ const handlers = getToastHandlers();
43
+ if (handlers.showToast) {
44
+ handlers.showToast(message, "success");
32
45
  }
33
46
  }
34
47
  static close() {
35
- if (_ToastService.closeToast) {
36
- _ToastService.closeToast();
48
+ const handlers = getToastHandlers();
49
+ if (handlers.closeToast) {
50
+ handlers.closeToast();
37
51
  }
38
52
  }
39
53
  };
@@ -4,34 +4,48 @@ import {
4
4
  } from "./chunk-56HSDML5.mjs";
5
5
 
6
6
  // src/components/ToastService.tsx
7
- var ToastService = class _ToastService {
7
+ var toastHandlersKey = "__digitalStoreToastHandlers";
8
+ var getToastHandlers = () => {
9
+ const globalScope = globalThis;
10
+ if (!globalScope[toastHandlersKey]) {
11
+ globalScope[toastHandlersKey] = {};
12
+ }
13
+ return globalScope[toastHandlersKey];
14
+ };
15
+ var ToastService = class {
8
16
  static initialize(showToast, closeToast) {
9
- _ToastService.showToast = showToast;
10
- _ToastService.closeToast = closeToast;
17
+ const handlers = getToastHandlers();
18
+ handlers.showToast = showToast;
19
+ handlers.closeToast = closeToast;
11
20
  }
12
21
  static showError(message) {
13
- if (_ToastService.showToast) {
14
- _ToastService.showToast(message, "error");
22
+ const handlers = getToastHandlers();
23
+ if (handlers.showToast) {
24
+ handlers.showToast(message, "error");
15
25
  }
16
26
  }
17
27
  static showInfo(message) {
18
- if (_ToastService.showToast) {
19
- _ToastService.showToast(message, "info");
28
+ const handlers = getToastHandlers();
29
+ if (handlers.showToast) {
30
+ handlers.showToast(message, "info");
20
31
  }
21
32
  }
22
33
  static showWarning(message) {
23
- if (_ToastService.showToast) {
24
- _ToastService.showToast(message, "warning");
34
+ const handlers = getToastHandlers();
35
+ if (handlers.showToast) {
36
+ handlers.showToast(message, "warning");
25
37
  }
26
38
  }
27
39
  static showSuccess(message) {
28
- if (_ToastService.showToast) {
29
- _ToastService.showToast(message, "success");
40
+ const handlers = getToastHandlers();
41
+ if (handlers.showToast) {
42
+ handlers.showToast(message, "success");
30
43
  }
31
44
  }
32
45
  static close() {
33
- if (_ToastService.closeToast) {
34
- _ToastService.closeToast();
46
+ const handlers = getToastHandlers();
47
+ if (handlers.closeToast) {
48
+ handlers.closeToast();
35
49
  }
36
50
  }
37
51
  };
package/dist/index.d.mts CHANGED
@@ -192,8 +192,6 @@ declare const PageBodyRenderer: (props: PageBodyRendererProps) => React__default
192
192
  declare const Toast: () => React__default.JSX.Element;
193
193
 
194
194
  declare class ToastService {
195
- private static showToast;
196
- private static closeToast;
197
195
  static initialize(showToast: (message: string, messageType: string) => void, closeToast: () => void): void;
198
196
  static showError(message: string): void;
199
197
  static showInfo(message: string): void;
package/dist/index.d.ts CHANGED
@@ -192,8 +192,6 @@ declare const PageBodyRenderer: (props: PageBodyRendererProps) => React__default
192
192
  declare const Toast: () => React__default.JSX.Element;
193
193
 
194
194
  declare class ToastService {
195
- private static showToast;
196
- private static closeToast;
197
195
  static initialize(showToast: (message: string, messageType: string) => void, closeToast: () => void): void;
198
196
  static showError(message: string): void;
199
197
  static showInfo(message: string): void;