@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260416042420 → 0.8.1-dev.20260416043301

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
3
 
3
4
  interface ViewControlProps {
4
5
  value?: any;
@@ -215,4 +216,15 @@ interface PageBodyRendererProps {
215
216
  }
216
217
  declare const PageBodyRenderer: React.FC<PageBodyRendererProps>;
217
218
 
218
- export { type ActionResponse, DataList, InputControl, type InputControlProps, InputControlType, PageBodyRenderer, ViewControl, type ViewControlProps, ViewControlTypes };
219
+ declare const Toast: () => react_jsx_runtime.JSX.Element;
220
+
221
+ declare class ToastService {
222
+ private static showToast;
223
+ private static closeToast;
224
+ static initialize(showToast: (message: string, messageType: string) => void, closeToast: () => void): void;
225
+ static showError(message: string): void;
226
+ static showInfo(message: string): void;
227
+ static close(): void;
228
+ }
229
+
230
+ export { type ActionResponse, DataList, InputControl, type InputControlProps, InputControlType, PageBodyRenderer, Toast, ToastService, ViewControl, type ViewControlProps, ViewControlTypes };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
3
 
3
4
  interface ViewControlProps {
4
5
  value?: any;
@@ -215,4 +216,15 @@ interface PageBodyRendererProps {
215
216
  }
216
217
  declare const PageBodyRenderer: React.FC<PageBodyRendererProps>;
217
218
 
218
- export { type ActionResponse, DataList, InputControl, type InputControlProps, InputControlType, PageBodyRenderer, ViewControl, type ViewControlProps, ViewControlTypes };
219
+ declare const Toast: () => react_jsx_runtime.JSX.Element;
220
+
221
+ declare class ToastService {
222
+ private static showToast;
223
+ private static closeToast;
224
+ static initialize(showToast: (message: string, messageType: string) => void, closeToast: () => void): void;
225
+ static showError(message: string): void;
226
+ static showInfo(message: string): void;
227
+ static close(): void;
228
+ }
229
+
230
+ export { type ActionResponse, DataList, InputControl, type InputControlProps, InputControlType, PageBodyRenderer, Toast, ToastService, ViewControl, type ViewControlProps, ViewControlTypes };
package/dist/index.js CHANGED
@@ -966,6 +966,8 @@ __export(index_exports, {
966
966
  InputControl: () => InputControl_default,
967
967
  InputControlType: () => InputControlType_default,
968
968
  PageBodyRenderer: () => PageBodyRenderer_default,
969
+ Toast: () => Toast_default,
970
+ ToastService: () => ToastService_default,
969
971
  ViewControl: () => ViewControl_default,
970
972
  ViewControlTypes: () => ViewControlTypes_default
971
973
  });
@@ -5625,12 +5627,96 @@ var PageBodyRenderer = (props) => {
5625
5627
  }) });
5626
5628
  };
5627
5629
  var PageBodyRenderer_default = PageBodyRenderer;
5630
+
5631
+ // src/components/Toast.tsx
5632
+ var import_react52 = require("react");
5633
+ init_ToastService();
5634
+ var import_jsx_runtime70 = require("react/jsx-runtime");
5635
+ var Toast = () => {
5636
+ const [showToast, setShowToast] = (0, import_react52.useState)(false);
5637
+ const [message, setMessage] = (0, import_react52.useState)("");
5638
+ const [messageType, setMessageType] = (0, import_react52.useState)("error");
5639
+ ToastService_default.showError = function(message2) {
5640
+ setShowToast(true);
5641
+ setMessage(message2);
5642
+ setMessageType("error");
5643
+ };
5644
+ ToastService_default.showInfo = function(message2) {
5645
+ setShowToast(true);
5646
+ setMessage(message2);
5647
+ setMessageType("info");
5648
+ setTimeout(() => {
5649
+ setShowToast(false);
5650
+ }, 4e3);
5651
+ };
5652
+ ToastService_default.close = function() {
5653
+ setShowToast(false);
5654
+ };
5655
+ const closeToast = () => {
5656
+ setShowToast(false);
5657
+ };
5658
+ return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_jsx_runtime70.Fragment, { children: showToast && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
5659
+ "div",
5660
+ {
5661
+ className: "fixed top-2 flex justify-center w-1/2 left-1/2 -translate-x-1/2",
5662
+ style: { zIndex: 1e3 },
5663
+ children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
5664
+ "div",
5665
+ {
5666
+ className: `w-full items-center flex justify-between p-3 rounded-md relative ${messageType == "error" ? "bg-error" : "bg-success-soft"}`,
5667
+ children: [
5668
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
5669
+ "span",
5670
+ {
5671
+ className: "font-medium text-inherit text-sm",
5672
+ style: { whiteSpace: "pre-line" },
5673
+ children: message
5674
+ }
5675
+ ),
5676
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
5677
+ "button",
5678
+ {
5679
+ className: "absolute right-2 top-2 ml-2 focus:outline-none",
5680
+ onClick: closeToast,
5681
+ children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
5682
+ "svg",
5683
+ {
5684
+ xmlns: "http://www.w3.org/2000/svg",
5685
+ className: "h-4 w-4",
5686
+ fill: "none",
5687
+ viewBox: "0 0 24 24",
5688
+ stroke: "currentColor",
5689
+ children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
5690
+ "path",
5691
+ {
5692
+ strokeLinecap: "round",
5693
+ strokeLinejoin: "round",
5694
+ strokeWidth: "2",
5695
+ d: "M6 18L18 6M6 6l12 12"
5696
+ }
5697
+ )
5698
+ }
5699
+ )
5700
+ }
5701
+ )
5702
+ ]
5703
+ }
5704
+ )
5705
+ }
5706
+ ) });
5707
+ };
5708
+ var Toast_default = Toast;
5709
+
5710
+ // src/index.ts
5711
+ init_ToastService();
5628
5712
  // Annotate the CommonJS export names for ESM import in node:
5629
5713
  0 && (module.exports = {
5630
5714
  DataList,
5631
5715
  InputControl,
5632
5716
  InputControlType,
5633
5717
  PageBodyRenderer,
5718
+ Toast,
5719
+ ToastService,
5634
5720
  ViewControl,
5635
5721
  ViewControlTypes
5636
5722
  });
package/dist/index.mjs CHANGED
@@ -4,6 +4,7 @@ import {
4
4
  import {
5
5
  Button_default,
6
6
  ServiceClient_default,
7
+ ToastService_default,
7
8
  buttonClasses
8
9
  } from "./chunk-O5BPFXEO.mjs";
9
10
 
@@ -4657,11 +4658,91 @@ var PageBodyRenderer = (props) => {
4657
4658
  }) });
4658
4659
  };
4659
4660
  var PageBodyRenderer_default = PageBodyRenderer;
4661
+
4662
+ // src/components/Toast.tsx
4663
+ import { useState as useState8 } from "react";
4664
+ import { Fragment as Fragment9, jsx as jsx61, jsxs as jsxs34 } from "react/jsx-runtime";
4665
+ var Toast = () => {
4666
+ const [showToast, setShowToast] = useState8(false);
4667
+ const [message, setMessage] = useState8("");
4668
+ const [messageType, setMessageType] = useState8("error");
4669
+ ToastService_default.showError = function(message2) {
4670
+ setShowToast(true);
4671
+ setMessage(message2);
4672
+ setMessageType("error");
4673
+ };
4674
+ ToastService_default.showInfo = function(message2) {
4675
+ setShowToast(true);
4676
+ setMessage(message2);
4677
+ setMessageType("info");
4678
+ setTimeout(() => {
4679
+ setShowToast(false);
4680
+ }, 4e3);
4681
+ };
4682
+ ToastService_default.close = function() {
4683
+ setShowToast(false);
4684
+ };
4685
+ const closeToast = () => {
4686
+ setShowToast(false);
4687
+ };
4688
+ return /* @__PURE__ */ jsx61(Fragment9, { children: showToast && /* @__PURE__ */ jsx61(
4689
+ "div",
4690
+ {
4691
+ className: "fixed top-2 flex justify-center w-1/2 left-1/2 -translate-x-1/2",
4692
+ style: { zIndex: 1e3 },
4693
+ children: /* @__PURE__ */ jsxs34(
4694
+ "div",
4695
+ {
4696
+ className: `w-full items-center flex justify-between p-3 rounded-md relative ${messageType == "error" ? "bg-error" : "bg-success-soft"}`,
4697
+ children: [
4698
+ /* @__PURE__ */ jsx61(
4699
+ "span",
4700
+ {
4701
+ className: "font-medium text-inherit text-sm",
4702
+ style: { whiteSpace: "pre-line" },
4703
+ children: message
4704
+ }
4705
+ ),
4706
+ /* @__PURE__ */ jsx61(
4707
+ "button",
4708
+ {
4709
+ className: "absolute right-2 top-2 ml-2 focus:outline-none",
4710
+ onClick: closeToast,
4711
+ children: /* @__PURE__ */ jsx61(
4712
+ "svg",
4713
+ {
4714
+ xmlns: "http://www.w3.org/2000/svg",
4715
+ className: "h-4 w-4",
4716
+ fill: "none",
4717
+ viewBox: "0 0 24 24",
4718
+ stroke: "currentColor",
4719
+ children: /* @__PURE__ */ jsx61(
4720
+ "path",
4721
+ {
4722
+ strokeLinecap: "round",
4723
+ strokeLinejoin: "round",
4724
+ strokeWidth: "2",
4725
+ d: "M6 18L18 6M6 6l12 12"
4726
+ }
4727
+ )
4728
+ }
4729
+ )
4730
+ }
4731
+ )
4732
+ ]
4733
+ }
4734
+ )
4735
+ }
4736
+ ) });
4737
+ };
4738
+ var Toast_default = Toast;
4660
4739
  export {
4661
4740
  DataList_default as DataList,
4662
4741
  InputControl_default as InputControl,
4663
4742
  InputControlType_default as InputControlType,
4664
4743
  PageBodyRenderer_default as PageBodyRenderer,
4744
+ Toast_default as Toast,
4745
+ ToastService_default as ToastService,
4665
4746
  ViewControl_default as ViewControl,
4666
4747
  ViewControlTypes_default as ViewControlTypes
4667
4748
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acoustte-digital-services/digitalstore-controls-dev",
3
- "version": "0.8.1-dev.20260416042420",
3
+ "version": "0.8.1-dev.20260416043301",
4
4
  "description": "Reusable React components",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",