@clyrex-digital/clyrex-controls-dev 0.8.1-dev.20260722112436 → 0.8.1-dev.20260723122345

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.
@@ -134,7 +134,7 @@ var Confirm_default = Confirm;
134
134
  }
135
135
 
136
136
  // src/components/Button.tsx
137
- import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
137
+ import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
138
138
  var Button = (props) => {
139
139
  const [inProgress, setInProgress] = useState2(false);
140
140
  const [isActionPerformed, setIsActionPerformed] = useState2(false);
@@ -144,7 +144,9 @@ var Button = (props) => {
144
144
  event.preventDefault();
145
145
  event.stopPropagation();
146
146
  if (props.confirm) {
147
- const confirmed = await showConfirmation("Are you sure you want to delete this item?");
147
+ const confirmed = await showConfirmation(
148
+ "Are you sure you want to delete this item?"
149
+ );
148
150
  setShowModal(null);
149
151
  if (!confirmed) {
150
152
  return;
@@ -159,7 +161,9 @@ var Button = (props) => {
159
161
  isValid = await props.onValidate();
160
162
  if (!isValid) {
161
163
  setInProgress(false);
162
- ToastService_default.showError("There are errors in the form. Please fix them before proceeding.");
164
+ ToastService_default.showError(
165
+ "There are errors in the form. Please fix them before proceeding."
166
+ );
163
167
  return;
164
168
  }
165
169
  }
@@ -183,7 +187,16 @@ var Button = (props) => {
183
187
  return new Promise((resolve) => {
184
188
  const onConfirm = () => resolve(true);
185
189
  const onCancel = () => resolve(false);
186
- setShowModal(/* @__PURE__ */ jsx3(Confirm_default, { message: props.confirmationMessage, onConfirm, onCancel }));
190
+ setShowModal(
191
+ /* @__PURE__ */ jsx3(
192
+ Confirm_default,
193
+ {
194
+ message: props.confirmationMessage,
195
+ onConfirm,
196
+ onCancel
197
+ }
198
+ )
199
+ );
187
200
  });
188
201
  };
189
202
  let buttonClass = props.ButtonType ? buttonClasses.get(props.ButtonType) : buttonClasses.get("Primary" /* Solid */);
@@ -197,13 +210,39 @@ var Button = (props) => {
197
210
  onClick: execute,
198
211
  disabled: props.disabled,
199
212
  title: isDisabled ? "The button is disabled to prevent any action" : "",
200
- className: buttonClass + " relative " + props.className,
213
+ className: `${buttonClass} relative inline-flex items-center justify-center gap-2 ${props.className ?? ""}`,
201
214
  children: [
202
215
  isActionPerformed && props.oneTimeAction && responseMessage ? responseMessage : props.children,
203
- inProgress && /* @__PURE__ */ jsx3(React3.Fragment, { children: props.hideProgressIndicator === true ? /* @__PURE__ */ jsx3("div", { className: "absolute bottom-0 left-0 h-0.5 bg-gray-400 rounded animate-progress" }) : /* @__PURE__ */ jsxs2("svg", { className: "animate-spin ml-2 mr-3 h-5 w-5 " + progressClass, xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
204
- /* @__PURE__ */ jsx3("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
205
- /* @__PURE__ */ jsx3("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
206
- ] }) })
216
+ inProgress && /* @__PURE__ */ jsx3(Fragment2, { children: props.hideProgressIndicator ? /* @__PURE__ */ jsx3("div", { className: "absolute bottom-0 left-0 h-0.5 bg-gray-400 rounded animate-progress" }) : /* @__PURE__ */ jsxs2(
217
+ "svg",
218
+ {
219
+ className: `animate-spin h-5 w-5 flex-shrink-0 ${progressClass}`,
220
+ xmlns: "http://www.w3.org/2000/svg",
221
+ fill: "none",
222
+ viewBox: "0 0 24 24",
223
+ children: [
224
+ /* @__PURE__ */ jsx3(
225
+ "circle",
226
+ {
227
+ className: "opacity-25",
228
+ cx: "12",
229
+ cy: "12",
230
+ r: "10",
231
+ stroke: "currentColor",
232
+ strokeWidth: "4"
233
+ }
234
+ ),
235
+ /* @__PURE__ */ jsx3(
236
+ "path",
237
+ {
238
+ className: "opacity-75",
239
+ fill: "currentColor",
240
+ d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
241
+ }
242
+ )
243
+ ]
244
+ }
245
+ ) })
207
246
  ]
208
247
  }
209
248
  ),
@@ -213,10 +252,12 @@ var Button = (props) => {
213
252
  var Button_default = Button;
214
253
 
215
254
  // src/components/pageRenderingEngine/nodes/LinkNodeButton.tsx
216
- import { jsx as jsx4 } from "react/jsx-runtime";
255
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
217
256
  var LinkNodeButton = (props) => {
218
257
  const { node, dataitem, children, linkText, linkType, linkUrl } = props;
219
258
  const [isLoading, setIsLoading] = useState3(false);
259
+ const [successMessage, setSuccessMessage] = useState3(null);
260
+ console.log("LinkNodeButton props:", props);
220
261
  const extractFieldNames = useCallback((template) => {
221
262
  if (!template) return [];
222
263
  const regex = /\{(\{\})?([a-zA-Z_$][a-zA-Z0-9_$]*)(?:\}\})?\}/g;
@@ -224,35 +265,38 @@ var LinkNodeButton = (props) => {
224
265
  const fieldNames = matches.map((match) => match[2] || match[1]).filter((name, index, self) => self.indexOf(name) === index);
225
266
  return fieldNames;
226
267
  }, []);
227
- const replaceTemplateVariables = useCallback((template, responseData) => {
228
- if (!template) return template;
229
- let result = template;
230
- const fieldNames = extractFieldNames(template);
231
- if (responseData) {
232
- fieldNames.forEach((fieldName) => {
233
- const value = getNestedValue(responseData, fieldName);
234
- if (value !== void 0) {
235
- const regex1 = new RegExp(`\\{${fieldName}\\}`, "g");
236
- const regex2 = new RegExp(`\\{\\{${fieldName}\\}\\}`, "g");
237
- result = result.replace(regex1, String(value));
238
- result = result.replace(regex2, String(value));
239
- }
240
- });
241
- }
242
- if (props.routeParameters) {
243
- Object.entries(props.routeParameters).forEach(([key, value]) => {
244
- const regex = new RegExp(`\\{\\{${key}\\}\\}`, "g");
245
- result = result.replace(regex, String(value));
246
- });
247
- }
248
- if (dataitem) {
249
- Object.entries(dataitem).forEach(([key, value]) => {
250
- const regex = new RegExp(`\\{\\{${key}\\}\\}`, "g");
251
- result = result.replace(regex, String(value));
252
- });
253
- }
254
- return result;
255
- }, [props.routeParameters, dataitem, extractFieldNames]);
268
+ const replaceTemplateVariables = useCallback(
269
+ (template, responseData) => {
270
+ if (!template) return template;
271
+ let result = template;
272
+ const fieldNames = extractFieldNames(template);
273
+ if (responseData) {
274
+ fieldNames.forEach((fieldName) => {
275
+ const value = getNestedValue(responseData, fieldName);
276
+ if (value !== void 0) {
277
+ const regex1 = new RegExp(`\\{${fieldName}\\}`, "g");
278
+ const regex2 = new RegExp(`\\{\\{${fieldName}\\}\\}`, "g");
279
+ result = result.replace(regex1, String(value));
280
+ result = result.replace(regex2, String(value));
281
+ }
282
+ });
283
+ }
284
+ if (props.routeParameters) {
285
+ Object.entries(props.routeParameters).forEach(([key, value]) => {
286
+ const regex = new RegExp(`\\{\\{${key}\\}\\}`, "g");
287
+ result = result.replace(regex, String(value));
288
+ });
289
+ }
290
+ if (dataitem) {
291
+ Object.entries(dataitem).forEach(([key, value]) => {
292
+ const regex = new RegExp(`\\{\\{${key}\\}\\}`, "g");
293
+ result = result.replace(regex, String(value));
294
+ });
295
+ }
296
+ return result;
297
+ },
298
+ [props.routeParameters, dataitem, extractFieldNames]
299
+ );
256
300
  const getNestedValue = useCallback((obj, path) => {
257
301
  if (!obj || !path) return void 0;
258
302
  if (obj[path] !== void 0) {
@@ -270,7 +314,10 @@ var LinkNodeButton = (props) => {
270
314
  }, []);
271
315
  const onClick = useCallback(async () => {
272
316
  if (!node.postUrl) {
273
- return { isSuccessful: false, message: "No POST URL configured for this button" };
317
+ return {
318
+ isSuccessful: false,
319
+ message: "No POST URL configured for this button"
320
+ };
274
321
  }
275
322
  setIsLoading(true);
276
323
  try {
@@ -296,6 +343,7 @@ var LinkNodeButton = (props) => {
296
343
  }
297
344
  if (response?.message) {
298
345
  ToastService_default.showSuccess(response.message);
346
+ setSuccessMessage(response.message);
299
347
  }
300
348
  if (response && node.redirectUrl) {
301
349
  const fieldNames = extractFieldNames(node.redirectUrl);
@@ -318,7 +366,9 @@ var LinkNodeButton = (props) => {
318
366
  }
319
367
  });
320
368
  console.log("Field value map:", fieldValueMap);
321
- const missingFields = fieldNames.filter((fieldName) => !fieldValueMap[fieldName]);
369
+ const missingFields = fieldNames.filter(
370
+ (fieldName) => !fieldValueMap[fieldName]
371
+ );
322
372
  if (missingFields.length > 0) {
323
373
  console.warn(`Missing field values for: ${missingFields.join(", ")}`);
324
374
  }
@@ -329,7 +379,10 @@ var LinkNodeButton = (props) => {
329
379
  resolvedRedirectUrl = resolvedRedirectUrl.replace(regex1, value);
330
380
  resolvedRedirectUrl = resolvedRedirectUrl.replace(regex2, value);
331
381
  });
332
- resolvedRedirectUrl = replaceTemplateVariables(resolvedRedirectUrl, response);
382
+ resolvedRedirectUrl = replaceTemplateVariables(
383
+ resolvedRedirectUrl,
384
+ response
385
+ );
333
386
  console.log("Final redirect URL:", resolvedRedirectUrl);
334
387
  if (resolvedRedirectUrl && !resolvedRedirectUrl.includes("{")) {
335
388
  window.location.href = resolvedRedirectUrl;
@@ -340,14 +393,27 @@ var LinkNodeButton = (props) => {
340
393
  return { isSuccessful: false, message: errorMessage };
341
394
  }
342
395
  setIsLoading(false);
343
- return { isSuccessful: true, message: response?.message, result: response };
396
+ return {
397
+ isSuccessful: true,
398
+ message: response?.message,
399
+ result: response
400
+ };
344
401
  } catch (err) {
345
402
  console.error("Button API call failed:", err);
346
403
  const errorMessage = err.message || "An unexpected error occurred";
347
404
  setIsLoading(false);
348
405
  return { isSuccessful: false, message: errorMessage };
349
406
  }
350
- }, [node.postUrl, node.payload, node.redirectUrl, replaceTemplateVariables, extractFieldNames, getNestedValue, props.apiBaseUrl, props.session]);
407
+ }, [
408
+ node.postUrl,
409
+ node.payload,
410
+ node.redirectUrl,
411
+ replaceTemplateVariables,
412
+ extractFieldNames,
413
+ getNestedValue,
414
+ props.apiBaseUrl,
415
+ props.session
416
+ ]);
351
417
  const renderButtonContent = () => {
352
418
  if (children) {
353
419
  return children;
@@ -357,14 +423,41 @@ var LinkNodeButton = (props) => {
357
423
  }
358
424
  return node.title || "Button";
359
425
  };
426
+ const fontSize = node.children?.[0]?.style?.match(/font-size:\s*([^;]+)/)?.[1];
360
427
  return /* @__PURE__ */ jsx4("div", { className: "link-button-wrapper", children: /* @__PURE__ */ jsx4(
361
428
  Button_default,
362
429
  {
363
430
  ButtonType: linkType,
364
431
  onClick,
365
- disabled: isLoading,
432
+ disabled: isLoading || !!successMessage,
366
433
  className: "w-full",
367
- children: renderButtonContent()
434
+ children: successMessage ? /* @__PURE__ */ jsxs3(
435
+ "span",
436
+ {
437
+ style: fontSize ? { fontSize } : void 0,
438
+ className: "inline-flex items-center gap-2",
439
+ children: [
440
+ /* @__PURE__ */ jsx4(
441
+ "svg",
442
+ {
443
+ xmlns: "http://www.w3.org/2000/svg",
444
+ viewBox: "0 0 20 20",
445
+ fill: "currentColor",
446
+ className: "w-5 h-5",
447
+ children: /* @__PURE__ */ jsx4(
448
+ "path",
449
+ {
450
+ fillRule: "evenodd",
451
+ d: "M16.704 5.29a1 1 0 010 1.42l-7.25 7.25a1 1 0 01-1.415 0L3.29 9.21a1 1 0 111.415-1.414l4.042 4.042 6.543-6.543a1 1 0 011.414 0z",
452
+ clipRule: "evenodd"
453
+ }
454
+ )
455
+ }
456
+ ),
457
+ /* @__PURE__ */ jsx4("span", { children: successMessage })
458
+ ]
459
+ }
460
+ ) : renderButtonContent()
368
461
  }
369
462
  ) });
370
463
  };
package/dist/index.js CHANGED
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  "use strict";
2
4
  var __create = Object.create;
3
5
  var __defProp = Object.defineProperty;
package/dist/index.mjs CHANGED
@@ -1,6 +1,8 @@
1
+ "use client";
2
+
1
3
  import {
2
4
  OdataBuilder
3
- } from "./chunk-UFKPTMM7.mjs";
5
+ } from "./chunk-X3YSXTD2.mjs";
4
6
  import {
5
7
  AssetUtility_default,
6
8
  BooleanSelect_default,
@@ -17,22 +19,22 @@ import {
17
19
  PhoneInput_default,
18
20
  SelectWithSearchInput_default,
19
21
  TimeInput_default
20
- } from "./chunk-YG6FKKQJ.mjs";
22
+ } from "./chunk-7ZFZLN56.mjs";
21
23
  import {
22
24
  Constants,
23
25
  Hyperlink,
24
26
  Icon_default,
25
27
  InputControlType_default
26
- } from "./chunk-DBHUCH4B.mjs";
28
+ } from "./chunk-5GHPW7SJ.mjs";
27
29
  import {
28
30
  ServiceClient_default
29
- } from "./chunk-3GWLDT7C.mjs";
31
+ } from "./chunk-WEV5U33G.mjs";
30
32
  import {
31
33
  Button_default,
32
34
  ClientButton_default,
33
35
  ToastService_default
34
- } from "./chunk-RHVNJMS4.mjs";
35
- import "./chunk-56HSDML5.mjs";
36
+ } from "./chunk-23WJE3YB.mjs";
37
+ import "./chunk-IMNQO57B.mjs";
36
38
 
37
39
  // src/components/controls/view/ViewControl.tsx
38
40
  import React13 from "react";
@@ -76,7 +78,7 @@ var NumberView_default = NumberView;
76
78
 
77
79
  // src/components/controls/view/DateView.tsx
78
80
  import dynamic from "next/dynamic";
79
- var DateView = dynamic(() => import("./DateViewClient-4CTEMOMJ.mjs"), {
81
+ var DateView = dynamic(() => import("./DateViewClient-JBS5UXMD.mjs"), {
80
82
  ssr: false
81
83
  });
82
84
  var DateView_default = DateView;
@@ -131,7 +133,7 @@ import React3 from "react";
131
133
  // src/components/DeviceAssetSelector.tsx
132
134
  import dynamic2 from "next/dynamic";
133
135
  import { jsx as jsx3 } from "react/jsx-runtime";
134
- var HlsPlayer = dynamic2(() => import("./HlsPlayer-57543DTW.mjs"), { ssr: false });
136
+ var HlsPlayer = dynamic2(() => import("./HlsPlayer-5AWFZ2P6.mjs"), { ssr: false });
135
137
  var FORMAT_CLASSES = {
136
138
  center: "justify-center",
137
139
  left: "justify-start",
@@ -366,7 +368,7 @@ var AiGeneratedSummary_default = AiGeneratedSummary;
366
368
 
367
369
  // src/components/controls/view/DateTimeVew.tsx
368
370
  import dynamic3 from "next/dynamic";
369
- var DateTimeView = dynamic3(() => import("./DateTimeViewClient-K5FE5VSN.mjs"), {
371
+ var DateTimeView = dynamic3(() => import("./DateTimeViewClient-M7V35KUW.mjs"), {
370
372
  ssr: false
371
373
  });
372
374
  var DateTimeVew_default = DateTimeView;
@@ -407,7 +409,7 @@ var ViewControl_default = ViewControl;
407
409
 
408
410
  // src/components/controls/edit/InputControl.tsx
409
411
  import dynamic4 from "next/dynamic";
410
- var InputControl = dynamic4(() => import("./InputControlClient-BUOYZNWQ.mjs"), {
412
+ var InputControl = dynamic4(() => import("./InputControlClient-7NS4QUWO.mjs"), {
411
413
  ssr: false
412
414
  });
413
415
  var InputControl_default = InputControl;
@@ -503,7 +505,7 @@ import React14 from "react";
503
505
  // src/components/pageRenderingEngine/nodes/ImageNode.tsx
504
506
  import dynamic5 from "next/dynamic";
505
507
  import { jsx as jsx17 } from "react/jsx-runtime";
506
- var HlsPlayer2 = dynamic5(() => import("./HlsPlayer-57543DTW.mjs"), { ssr: false });
508
+ var HlsPlayer2 = dynamic5(() => import("./HlsPlayer-5AWFZ2P6.mjs"), { ssr: false });
507
509
  var getNestedValue = (obj, path) => {
508
510
  if (!obj || !path) return void 0;
509
511
  return path.split(".").reduce((current, key) => {
@@ -611,7 +613,7 @@ var ImageNode_default = ImageNode;
611
613
  // src/components/pageRenderingEngine/nodes/LinkNode.tsx
612
614
  import dynamic6 from "next/dynamic";
613
615
  import { Fragment, jsx as jsx18, jsxs as jsxs6 } from "react/jsx-runtime";
614
- var LinkNodeButton = dynamic6(() => import("./LinkNodeButton-BIZA2NPE.mjs"), {
616
+ var LinkNodeButton = dynamic6(() => import("./LinkNodeButton-AOEDCCL7.mjs"), {
615
617
  ssr: false
616
618
  });
617
619
  function getNestedValue2(obj, path) {
@@ -1046,7 +1048,7 @@ var QuoteNode_default = QuoteNode;
1046
1048
  import React20 from "react";
1047
1049
  import dynamic7 from "next/dynamic";
1048
1050
  import { jsx as jsx27, jsxs as jsxs9 } from "react/jsx-runtime";
1049
- var CopyButton = dynamic7(() => import("./CopyButton-XONTQQW7.mjs"), {
1051
+ var CopyButton = dynamic7(() => import("./CopyButton-UPJPMJUB.mjs"), {
1050
1052
  ssr: false,
1051
1053
  // optional: fallback UI while loading
1052
1054
  loading: () => /* @__PURE__ */ jsx27("span", { className: "text-gray-400 text-xs", children: "Copy" })
@@ -1189,7 +1191,7 @@ import React22 from "react";
1189
1191
  // src/components/pageRenderingEngine/nodes/EmbedNode.tsx
1190
1192
  import dynamic8 from "next/dynamic";
1191
1193
  import { jsx as jsx30 } from "react/jsx-runtime";
1192
- var IframeClient = dynamic8(() => import("./IframeClient-J22NMEVY.mjs"), {
1194
+ var IframeClient = dynamic8(() => import("./IframeClient-RGJFZ5P2.mjs"), {
1193
1195
  ssr: false
1194
1196
  });
1195
1197
  var EmbedNode = (props) => {
@@ -1425,7 +1427,7 @@ var NoDataFound_default = NoDataFound;
1425
1427
  // src/components/pageRenderingEngine/nodes/ImageGalleryNode.tsx
1426
1428
  import dynamic9 from "next/dynamic";
1427
1429
  import { Fragment as Fragment5, jsx as jsx32, jsxs as jsxs11 } from "react/jsx-runtime";
1428
- var HlsPlayer3 = dynamic9(() => import("./HlsPlayer-57543DTW.mjs"), { ssr: false });
1430
+ var HlsPlayer3 = dynamic9(() => import("./HlsPlayer-5AWFZ2P6.mjs"), { ssr: false });
1429
1431
  var deviceToMediaQuery = (device) => {
1430
1432
  switch (device) {
1431
1433
  case "lg":
@@ -2240,8 +2242,8 @@ var DocumentNode_default = DocumentNode;
2240
2242
 
2241
2243
  // src/components/pageRenderingEngine/nodes/DivContainer.tsx
2242
2244
  import { jsx as jsx34, jsxs as jsxs13 } from "react/jsx-runtime";
2243
- var Pagination = dynamic10(() => import("./Pagination-NCJCOYHF.mjs"), { ssr: true });
2244
- var Slider = dynamic10(() => import("./Slider-PEIVH6A5.mjs"), {
2245
+ var Pagination = dynamic10(() => import("./Pagination-T7YN2OMV.mjs"), { ssr: true });
2246
+ var Slider = dynamic10(() => import("./Slider-554BKC7N.mjs"), {
2245
2247
  ssr: false
2246
2248
  });
2247
2249
  function toCamelCase(str) {