@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260505044510 → 0.8.1-dev.20260505112744

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,116 @@
1
+ "use client";
2
+
3
+ // src/components/controls/view/DateViewClient.tsx
4
+ import { useEffect, useState } from "react";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ var DateViewClient = (props) => {
7
+ const [timeZoneAbbr, setTimeZoneAbbr] = useState("");
8
+ useEffect(() => {
9
+ const parts = new Intl.DateTimeFormat("en", {
10
+ timeZoneName: "short"
11
+ }).formatToParts(/* @__PURE__ */ new Date());
12
+ const abbr = parts.find((part) => part.type === "timeZoneName")?.value || "";
13
+ setTimeZoneAbbr(abbr);
14
+ }, []);
15
+ const toUtcDate = (dateString) => {
16
+ const s = dateString.trim();
17
+ if (!s) {
18
+ throw new Error("Empty date string");
19
+ }
20
+ const iso = s.replace(" ", "T");
21
+ const hasTimeZone = /Z$/i.test(iso) || /[+-]\d{2}:\d{2}$/.test(iso);
22
+ const utc = hasTimeZone ? iso : `${iso}Z`;
23
+ const date = new Date(utc);
24
+ if (Number.isNaN(date.getTime())) {
25
+ throw new Error(`Invalid date: ${dateString}`);
26
+ }
27
+ return date;
28
+ };
29
+ const formatDate = (date) => {
30
+ return new Intl.DateTimeFormat("en", {
31
+ day: "2-digit",
32
+ month: "short",
33
+ year: "numeric"
34
+ }).format(date);
35
+ };
36
+ const formatTime = (date) => {
37
+ return date.getSeconds() === 0 ? new Intl.DateTimeFormat("en", {
38
+ hour: "2-digit",
39
+ minute: "2-digit"
40
+ }).format(date) : new Intl.DateTimeFormat("en", {
41
+ hour: "2-digit",
42
+ minute: "2-digit",
43
+ second: "2-digit"
44
+ }).format(date);
45
+ };
46
+ const formatDateTime = (date) => {
47
+ return date.getSeconds() === 0 ? new Intl.DateTimeFormat("en", {
48
+ day: "2-digit",
49
+ month: "short",
50
+ year: "numeric",
51
+ hour: "2-digit",
52
+ minute: "2-digit"
53
+ }).format(date) : new Intl.DateTimeFormat("en", {
54
+ day: "2-digit",
55
+ month: "short",
56
+ year: "numeric",
57
+ hour: "2-digit",
58
+ minute: "2-digit",
59
+ second: "2-digit"
60
+ }).format(date);
61
+ };
62
+ const getTimePeriod = (date) => {
63
+ const hours = date.getHours();
64
+ if (hours >= 5 && hours < 8) return "Early Morning";
65
+ if (hours >= 8 && hours < 12) return "Morning";
66
+ if (hours >= 12 && hours < 14) return "Noon";
67
+ if (hours >= 14 && hours < 17) return "Afternoon";
68
+ if (hours >= 17 && hours < 20) return "Evening";
69
+ if (hours >= 20 && hours < 22) return "Late Evening";
70
+ return "Night";
71
+ };
72
+ const getRelativeTime = (dateString) => {
73
+ const now = /* @__PURE__ */ new Date();
74
+ const utcDate = toUtcDate(dateString);
75
+ const diffMs = now.getTime() - utcDate.getTime();
76
+ const diffSec = Math.floor(diffMs / 1e3);
77
+ const diffMin = Math.floor(diffSec / 60);
78
+ const diffHr = Math.floor(diffMin / 60);
79
+ const diffDay = Math.floor(diffHr / 24);
80
+ if (diffSec < 60) return "Just now";
81
+ if (diffMin < 60) return `${diffMin} minute${diffMin > 1 ? "s" : ""} ago`;
82
+ if (diffHr < 24) return `${diffHr} hour${diffHr > 1 ? "s" : ""} ago`;
83
+ if (diffDay < 7) return `${diffDay} day${diffDay > 1 ? "s" : ""} ago`;
84
+ return formatDate(utcDate);
85
+ };
86
+ const parseAndFormatDate = (dateString, format) => {
87
+ if (format === "relative") {
88
+ return getRelativeTime(dateString);
89
+ }
90
+ const utcDate = toUtcDate(dateString);
91
+ switch (props.controlType) {
92
+ case "date":
93
+ return formatDate(utcDate);
94
+ case "time":
95
+ return `${formatTime(utcDate)} ${timeZoneAbbr} (${getTimePeriod(
96
+ utcDate
97
+ )})`;
98
+ default:
99
+ return formatDateTime(utcDate);
100
+ }
101
+ };
102
+ let localDateTime = "";
103
+ try {
104
+ localDateTime = parseAndFormatDate(props.value, props.format);
105
+ } catch (error) {
106
+ console.error("Error parsing date:", props.value, error);
107
+ }
108
+ return /* @__PURE__ */ jsxs("div", { className: "inline-flex flex-wrap gap-1", children: [
109
+ /* @__PURE__ */ jsx("span", { children: localDateTime }),
110
+ !props.format && props.controlType !== "date" && timeZoneAbbr && /* @__PURE__ */ jsx("span", { children: timeZoneAbbr })
111
+ ] });
112
+ };
113
+ var DateViewClient_default = DateViewClient;
114
+ export {
115
+ DateViewClient_default as default
116
+ };
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  HlsPlayer_default
4
- } from "./chunk-CT5SLXYT.mjs";
4
+ } from "./chunk-EX7D6KBZ.mjs";
5
5
  export {
6
6
  HlsPlayer_default as default
7
7
  };
@@ -203,23 +203,26 @@ var HlsPlayer = React.memo(
203
203
  }, [isMobile, resetInactivityTimer]);
204
204
  const posterSources = resolvedSources.filter((s) => s.media && s.posterUrl);
205
205
  const fallbackPoster = posterUrl ?? resolvedSources.find((s) => !s.media)?.posterUrl ?? resolvedSources[0]?.posterUrl;
206
- const overlayButtonStyle = {
206
+ const playBtnSize = "clamp(44px, 8vmin, 80px)";
207
+ const iconBtnSize = "clamp(28px, 4.5vmin, 40px)";
208
+ const iconSvgSize = "clamp(14px, 2.5vmin, 20px)";
209
+ const playIconSize = "clamp(24px, 4.5vmin, 44px)";
210
+ const iconButtonStyle = {
207
211
  pointerEvents: isControlsVisible ? "auto" : "none",
208
- width: 30,
209
- height: 30,
212
+ width: iconBtnSize,
213
+ height: iconBtnSize,
210
214
  borderRadius: "50%",
211
215
  border: "1.5px solid rgba(255,255,255,0.18)",
212
216
  cursor: "pointer",
213
217
  display: "flex",
214
218
  alignItems: "center",
215
219
  justifyContent: "center",
216
- // background: "#F31F49",
217
- // background: "linear-gradient(50deg,rgba(243, 31, 73, 1) 0%, rgba(143, 38, 237, 1) 100%)",
218
- // background: "rgba(0, 0, 0, 0.45)",
219
- // backdropFilter: "blur(10px)",
220
- // WebkitBackdropFilter: "blur(10px)",
221
- // boxShadow: "0 4px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.1)",
222
- transition: "transform 0.18s ease, background 0.18s ease, border-color 0.18s ease"
220
+ background: "rgba(0, 0, 0, 0.45)",
221
+ backdropFilter: "blur(10px)",
222
+ WebkitBackdropFilter: "blur(10px)",
223
+ boxShadow: "0 4px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.1)",
224
+ transition: "transform 0.18s ease",
225
+ flexShrink: 0
223
226
  };
224
227
  if (resolvedSources.length === 0) return null;
225
228
  const showMuteButton = !showControls && !isPlayOnHover;
@@ -299,15 +302,60 @@ var HlsPlayer = React.memo(
299
302
  handlePlayPause();
300
303
  },
301
304
  style: {
302
- ...overlayButtonStyle,
303
- width: 64,
304
- height: 64,
305
- background: "linear-gradient(50deg, rgba(243, 31, 73, 1) 0%, rgba(143, 38, 237, 1) 100%)"
305
+ pointerEvents: isControlsVisible ? "auto" : "none",
306
+ width: playBtnSize,
307
+ height: playBtnSize,
308
+ borderRadius: "50%",
309
+ border: "none",
310
+ cursor: "pointer",
311
+ display: "flex",
312
+ alignItems: "center",
313
+ justifyContent: "center",
314
+ background: "linear-gradient(50deg, rgba(243, 31, 73, 1) 0%, rgba(143, 38, 237, 1) 100%)",
315
+ flexShrink: 0
316
+ // No box-shadow, no transition on background — clean gradient, no hover state.
306
317
  },
307
- children: isPlaying ? /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
308
- /* @__PURE__ */ jsx("rect", { x: "3.5", y: "2.5", width: "4.5", height: "15", rx: "1.5", fill: "white" }),
309
- /* @__PURE__ */ jsx("rect", { x: "12", y: "2.5", width: "4.5", height: "15", rx: "1.5", fill: "white" })
310
- ] }) : /* @__PURE__ */ jsx("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", style: { transform: "translateX(2px)" }, children: /* @__PURE__ */ jsx("path", { d: "M5 3.5L17 10L5 16.5V3.5Z", fill: "white" }) })
318
+ children: isPlaying ? (
319
+ /* Pause two rounded bars, sized to match play icon proportions */
320
+ /* @__PURE__ */ jsxs(
321
+ "svg",
322
+ {
323
+ width: playIconSize,
324
+ height: playIconSize,
325
+ viewBox: "0 0 20 20",
326
+ fill: "none",
327
+ xmlns: "http://www.w3.org/2000/svg",
328
+ children: [
329
+ /* @__PURE__ */ jsx("rect", { x: "3.5", y: "2.5", width: "4.5", height: "15", rx: "1.5", fill: "white" }),
330
+ /* @__PURE__ */ jsx("rect", { x: "12", y: "2.5", width: "4.5", height: "15", rx: "1.5", fill: "white" })
331
+ ]
332
+ }
333
+ )
334
+ ) : (
335
+ /*
336
+ * Play — rounded-corner triangle from the provided SVG path.
337
+ * Original viewBox is "0,0,240,250" (with a 5.33x scale group inside).
338
+ * We flatten the transform: effective drawing area is 240×250 units.
339
+ */
340
+ /* @__PURE__ */ jsx(
341
+ "svg",
342
+ {
343
+ width: playIconSize,
344
+ height: playIconSize,
345
+ viewBox: "0 0 240 250",
346
+ fill: "none",
347
+ xmlns: "http://www.w3.org/2000/svg",
348
+ style: { transform: "translateX(4%)" },
349
+ children: /* @__PURE__ */ jsx(
350
+ "path",
351
+ {
352
+ d: "M60.78 21.93C48.57 22.41 37.33 32.78 37.33 45.87v164.26c0 17.92 19.96 29.67 35.64 20.99l148.31-82.17c16.12-8.93 16.12-33.04 0-41.97L72.97 24.81c-3.92-2.17-8.11-3.07-12.19-2.88z",
353
+ fill: "white"
354
+ }
355
+ )
356
+ }
357
+ )
358
+ )
311
359
  }
312
360
  )
313
361
  }
@@ -333,12 +381,12 @@ var HlsPlayer = React.memo(
333
381
  e.stopPropagation();
334
382
  handleMuteToggle();
335
383
  },
336
- style: overlayButtonStyle,
337
- children: isMuted ? /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
384
+ style: iconButtonStyle,
385
+ children: isMuted ? /* @__PURE__ */ jsxs("svg", { width: iconSvgSize, height: iconSvgSize, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
338
386
  /* @__PURE__ */ jsx("path", { d: "M11 5L6 9H2v6h4l5 4V5Z", fill: "white" }),
339
387
  /* @__PURE__ */ jsx("line", { x1: "23", y1: "9", x2: "17", y2: "15", stroke: "white", strokeWidth: "2", strokeLinecap: "round" }),
340
388
  /* @__PURE__ */ jsx("line", { x1: "17", y1: "9", x2: "23", y2: "15", stroke: "white", strokeWidth: "2", strokeLinecap: "round" })
341
- ] }) : /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
389
+ ] }) : /* @__PURE__ */ jsxs("svg", { width: iconSvgSize, height: iconSvgSize, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
342
390
  /* @__PURE__ */ jsx("path", { d: "M11 5L6 9H2v6h4l5 4V5Z", fill: "white" }),
343
391
  /* @__PURE__ */ jsx("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07", stroke: "white", strokeWidth: "2", strokeLinecap: "round" }),
344
392
  /* @__PURE__ */ jsx("path", { d: "M19.07 4.93a10 10 0 0 1 0 14.14", stroke: "white", strokeWidth: "2", strokeLinecap: "round" })
@@ -354,14 +402,8 @@ var HlsPlayer = React.memo(
354
402
  e.stopPropagation();
355
403
  handleFullscreenToggle();
356
404
  },
357
- style: overlayButtonStyle,
358
- children: isFullscreen ? (
359
- /* Compress / exit icon — two inward-pointing arrows */
360
- /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M8 3v5H3M21 8h-5V3M3 16h5v5M16 21v-5h5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
361
- ) : (
362
- /* Expand icon — four outward-pointing arrows */
363
- /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M3 8V3h5M16 3h5v5M21 16v5h-5M8 21H3v-5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
364
- )
405
+ style: iconButtonStyle,
406
+ children: isFullscreen ? /* @__PURE__ */ jsx("svg", { width: iconSvgSize, height: iconSvgSize, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M8 3v5H3M21 8h-5V3M3 16h5v5M16 21v-5h5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) : /* @__PURE__ */ jsx("svg", { width: iconSvgSize, height: iconSvgSize, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M3 8V3h5M16 3h5v5M21 16v5h-5M8 21H3v-5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
365
407
  }
366
408
  )
367
409
  ]
package/dist/index.js CHANGED
@@ -30,128 +30,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
30
  ));
31
31
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
32
 
33
- // src/components/controls/view/TimeZoneAbbrevations.tsx
34
- var timeZoneAbbreviations;
35
- var init_TimeZoneAbbrevations = __esm({
36
- "src/components/controls/view/TimeZoneAbbrevations.tsx"() {
37
- "use strict";
38
- timeZoneAbbreviations = {
39
- "Asia/Calcutta": "IST",
40
- "Asia/Kolkata": "IST",
41
- "America/New_York": "EST",
42
- "America/Los_Angeles": "PST",
43
- "Europe/London": "GMT",
44
- "Europe/Paris": "CET",
45
- "Asia/Tokyo": "JST",
46
- "America/Chicago": "CST",
47
- "America/Denver": "MST",
48
- "Asia/Shanghai": "CST",
49
- "Asia/Hong_Kong": "HKT",
50
- "Australia/Sydney": "AEST",
51
- "Australia/Melbourne": "AEST",
52
- "Australia/Perth": "AWST",
53
- "Pacific/Auckland": "NZST",
54
- "Europe/Berlin": "CET",
55
- "Europe/Madrid": "CET",
56
- "Europe/Rome": "CET",
57
- "Europe/Athens": "EET",
58
- "Europe/Istanbul": "TRT",
59
- "Africa/Cairo": "EET",
60
- "Africa/Johannesburg": "SAST",
61
- "Asia/Dubai": "GST",
62
- "Asia/Singapore": "SGT",
63
- "Asia/Seoul": "KST",
64
- "America/Toronto": "EST",
65
- "America/Vancouver": "PST",
66
- "America/Sao_Paulo": "BRT",
67
- "America/Mexico_City": "CST",
68
- "Asia/Manila": "PHT",
69
- "Asia/Jakarta": "WIB",
70
- "Asia/Bangkok": "ICT",
71
- "Asia/Karachi": "PKT",
72
- "Asia/Tehran": "IRST",
73
- "Asia/Baghdad": "AST",
74
- "Europe/Moscow": "MSK",
75
- "Europe/Amsterdam": "CET",
76
- "Europe/Brussels": "CET",
77
- "Europe/Zurich": "CET",
78
- "America/Anchorage": "AKST",
79
- "Pacific/Honolulu": "HST",
80
- "Antarctica/McMurdo": "NZST",
81
- "Atlantic/Reykjavik": "GMT",
82
- "Asia/Riyadh": "AST",
83
- "America/Argentina/Buenos_Aires": "ART",
84
- "America/Bogota": "COT",
85
- "Africa/Nairobi": "EAT",
86
- "Asia/Kuala_Lumpur": "MYT",
87
- "Asia/Ho_Chi_Minh": "ICT",
88
- "Europe/Warsaw": "CET",
89
- "Europe/Prague": "CET",
90
- "America/Phoenix": "MST",
91
- "America/Indianapolis": "EST",
92
- "Pacific/Fiji": "FJT",
93
- "Asia/Colombo": "IST",
94
- "Africa/Lagos": "WAT",
95
- "America/Caracas": "VET",
96
- "America/Halifax": "AST",
97
- "Pacific/Tahiti": "TAHT",
98
- "America/St_Johns": "NST",
99
- "Europe/Bucharest": "EET",
100
- "Europe/Helsinki": "EET",
101
- "Europe/Kiev": "EET",
102
- "Europe/Oslo": "CET",
103
- "Europe/Stockholm": "CET",
104
- "Europe/Lisbon": "WET",
105
- "Asia/Beirut": "EET",
106
- "Asia/Damascus": "EET",
107
- "Asia/Jerusalem": "IST",
108
- "Asia/Amman": "EET",
109
- "America/Santiago": "CLT",
110
- "America/Lima": "PET",
111
- "America/Montevideo": "UYT",
112
- "Asia/Tashkent": "UZT",
113
- "Asia/Yerevan": "AMT",
114
- "Asia/Baku": "AZT",
115
- "Europe/Vilnius": "EET",
116
- "Europe/Riga": "EET",
117
- "Europe/Tallinn": "EET",
118
- "Europe/Sofia": "EET",
119
- "Africa/Casablanca": "WET",
120
- "America/Guatemala": "CST",
121
- "America/Panama": "EST",
122
- "America/Costa_Rica": "CST",
123
- "Pacific/Port_Moresby": "PGT",
124
- "Asia/Makassar": "WITA",
125
- "Asia/Vladivostok": "VLAT",
126
- "Asia/Krasnoyarsk": "KRAT",
127
- "Asia/Novosibirsk": "NOVT",
128
- "Asia/Yakutsk": "YAKT",
129
- "Asia/Sakhalin": "SAKT",
130
- "Asia/Ulaanbaatar": "ULAT",
131
- "Asia/Choibalsan": "CHOT",
132
- "Asia/Omsk": "OMST",
133
- "Asia/Kamchatka": "PETT",
134
- "Pacific/Pago_Pago": "SST",
135
- "Pacific/Guam": "ChST",
136
- "Pacific/Saipan": "ChST",
137
- "Pacific/Palau": "PWT",
138
- "Pacific/Efate": "VUT",
139
- "Pacific/Kosrae": "KOST",
140
- "Pacific/Nauru": "NRT",
141
- "Pacific/Tarawa": "GILT",
142
- "Pacific/Enderbury": "PHOT",
143
- "Pacific/Fakaofo": "TKT",
144
- "Pacific/Chatham": "CHAST",
145
- "Pacific/Tongatapu": "TOT",
146
- "Pacific/Funafuti": "TVT",
147
- "Pacific/Majuro": "MHT",
148
- "Pacific/Kwajalein": "MHT",
149
- "Pacific/Wake": "WAKT",
150
- "Pacific/Wallis": "WFT"
151
- };
152
- }
153
- });
154
-
155
33
  // src/components/controls/view/DateViewClient.tsx
156
34
  var DateViewClient_exports = {};
157
35
  __export(DateViewClient_exports, {
@@ -162,28 +40,73 @@ var init_DateViewClient = __esm({
162
40
  "src/components/controls/view/DateViewClient.tsx"() {
163
41
  "use strict";
164
42
  "use client";
165
- import_react2 = __toESM(require("react"));
166
- init_TimeZoneAbbrevations();
43
+ import_react2 = require("react");
167
44
  import_jsx_runtime2 = require("react/jsx-runtime");
168
45
  DateViewClient = (props) => {
169
- const [offsetMilliseconds, setOffsetMilliseconds] = (0, import_react2.useState)(0);
170
46
  const [timeZoneAbbr, setTimeZoneAbbr] = (0, import_react2.useState)("");
171
47
  (0, import_react2.useEffect)(() => {
172
- const now = /* @__PURE__ */ new Date();
173
- const offsetMinutes = now.getTimezoneOffset();
174
- setOffsetMilliseconds(offsetMinutes * 60 * 1e3);
175
- setTimeZoneAbbr(
176
- now.toLocaleTimeString("en", { timeZoneName: "short" }).split(" ")[2]
177
- );
48
+ const parts = new Intl.DateTimeFormat("en", {
49
+ timeZoneName: "short"
50
+ }).formatToParts(/* @__PURE__ */ new Date());
51
+ const abbr = parts.find((part) => part.type === "timeZoneName")?.value || "";
52
+ setTimeZoneAbbr(abbr);
178
53
  }, []);
179
54
  const toUtcDate = (dateString) => {
180
55
  const s = dateString.trim();
56
+ if (!s) {
57
+ throw new Error("Empty date string");
58
+ }
181
59
  const iso = s.replace(" ", "T");
182
- const utc = iso.endsWith("Z") || iso.includes("+") ? iso : iso + "Z";
183
- return new Date(utc);
60
+ const hasTimeZone = /Z$/i.test(iso) || /[+-]\d{2}:\d{2}$/.test(iso);
61
+ const utc = hasTimeZone ? iso : `${iso}Z`;
62
+ const date = new Date(utc);
63
+ if (Number.isNaN(date.getTime())) {
64
+ throw new Error(`Invalid date: ${dateString}`);
65
+ }
66
+ return date;
184
67
  };
185
- const toLocalDate = (utcDate) => {
186
- return new Date(utcDate.getTime() - offsetMilliseconds);
68
+ const formatDate = (date) => {
69
+ return new Intl.DateTimeFormat("en", {
70
+ day: "2-digit",
71
+ month: "short",
72
+ year: "numeric"
73
+ }).format(date);
74
+ };
75
+ const formatTime = (date) => {
76
+ return date.getSeconds() === 0 ? new Intl.DateTimeFormat("en", {
77
+ hour: "2-digit",
78
+ minute: "2-digit"
79
+ }).format(date) : new Intl.DateTimeFormat("en", {
80
+ hour: "2-digit",
81
+ minute: "2-digit",
82
+ second: "2-digit"
83
+ }).format(date);
84
+ };
85
+ const formatDateTime = (date) => {
86
+ return date.getSeconds() === 0 ? new Intl.DateTimeFormat("en", {
87
+ day: "2-digit",
88
+ month: "short",
89
+ year: "numeric",
90
+ hour: "2-digit",
91
+ minute: "2-digit"
92
+ }).format(date) : new Intl.DateTimeFormat("en", {
93
+ day: "2-digit",
94
+ month: "short",
95
+ year: "numeric",
96
+ hour: "2-digit",
97
+ minute: "2-digit",
98
+ second: "2-digit"
99
+ }).format(date);
100
+ };
101
+ const getTimePeriod = (date) => {
102
+ const hours = date.getHours();
103
+ if (hours >= 5 && hours < 8) return "Early Morning";
104
+ if (hours >= 8 && hours < 12) return "Morning";
105
+ if (hours >= 12 && hours < 14) return "Noon";
106
+ if (hours >= 14 && hours < 17) return "Afternoon";
107
+ if (hours >= 17 && hours < 20) return "Evening";
108
+ if (hours >= 20 && hours < 22) return "Late Evening";
109
+ return "Night";
187
110
  };
188
111
  const getRelativeTime = (dateString) => {
189
112
  const now = /* @__PURE__ */ new Date();
@@ -197,77 +120,34 @@ var init_DateViewClient = __esm({
197
120
  if (diffMin < 60) return `${diffMin} minute${diffMin > 1 ? "s" : ""} ago`;
198
121
  if (diffHr < 24) return `${diffHr} hour${diffHr > 1 ? "s" : ""} ago`;
199
122
  if (diffDay < 7) return `${diffDay} day${diffDay > 1 ? "s" : ""} ago`;
200
- return new Intl.DateTimeFormat("en", {
201
- day: "2-digit",
202
- month: "short",
203
- year: "numeric"
204
- }).format(toLocalDate(utcDate));
123
+ return formatDate(utcDate);
205
124
  };
206
125
  const parseAndFormatDate = (dateString, format) => {
207
126
  if (format === "relative") {
208
127
  return getRelativeTime(dateString);
209
128
  }
210
129
  const utcDate = toUtcDate(dateString);
211
- const localDate = toLocalDate(utcDate);
212
130
  switch (props.controlType) {
213
131
  case "date":
214
- return new Intl.DateTimeFormat("en", {
215
- day: "2-digit",
216
- month: "short",
217
- year: "numeric"
218
- }).format(localDate);
132
+ return formatDate(utcDate);
219
133
  case "time":
220
- return `${formatTime(localDate)} ${timeZoneAbbr} (${getTimePeriod(localDate)})`;
134
+ return `${formatTime(utcDate)} ${timeZoneAbbr} (${getTimePeriod(
135
+ utcDate
136
+ )})`;
221
137
  default:
222
- return utcDate.getSeconds() === 0 ? new Intl.DateTimeFormat("en", {
223
- day: "2-digit",
224
- month: "short",
225
- year: "numeric",
226
- hour: "2-digit",
227
- minute: "2-digit"
228
- }).format(localDate) : new Intl.DateTimeFormat("en", {
229
- day: "2-digit",
230
- month: "short",
231
- year: "numeric",
232
- hour: "2-digit",
233
- minute: "2-digit",
234
- second: "2-digit"
235
- }).format(localDate);
138
+ return formatDateTime(utcDate);
236
139
  }
237
140
  };
238
- const formatTime = (localDate) => {
239
- return localDate.getSeconds() === 0 ? new Intl.DateTimeFormat("en", {
240
- hour: "2-digit",
241
- minute: "2-digit"
242
- }).format(localDate) : new Intl.DateTimeFormat("en", {
243
- hour: "2-digit",
244
- minute: "2-digit",
245
- second: "2-digit"
246
- }).format(localDate);
247
- };
248
- const getTimePeriod = (localDate) => {
249
- const hours = localDate.getHours();
250
- if (hours >= 5 && hours < 8) return "Early Morning";
251
- if (hours >= 8 && hours < 12) return "Morning";
252
- if (hours >= 12 && hours < 14) return "Noon";
253
- if (hours >= 14 && hours < 17) return "Afternoon";
254
- if (hours >= 17 && hours < 20) return "Evening";
255
- if (hours >= 20 && hours < 22) return "Late Evening";
256
- return "Night";
257
- };
258
- const getTimeZoneAbbreviation = (timeZone) => {
259
- return timeZoneAbbreviations[timeZone] || timeZone;
260
- };
261
141
  let localDateTime = "";
262
142
  try {
263
143
  localDateTime = parseAndFormatDate(props.value, props.format);
264
144
  } catch (error) {
265
145
  console.error("Error parsing date:", props.value, error);
266
146
  }
267
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react2.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "inline-flex flex-wrap gap-1", children: [
147
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "inline-flex flex-wrap gap-1", children: [
268
148
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: localDateTime }),
269
- !props.format && props.controlType != "date" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: timeZoneAbbr })
270
- ] }) });
149
+ !props.format && props.controlType !== "date" && timeZoneAbbr && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: timeZoneAbbr })
150
+ ] });
271
151
  };
272
152
  DateViewClient_default = DateViewClient;
273
153
  }
@@ -729,23 +609,26 @@ var init_HlsPlayer = __esm({
729
609
  }, [isMobile, resetInactivityTimer]);
730
610
  const posterSources = resolvedSources.filter((s) => s.media && s.posterUrl);
731
611
  const fallbackPoster = posterUrl ?? resolvedSources.find((s) => !s.media)?.posterUrl ?? resolvedSources[0]?.posterUrl;
732
- const overlayButtonStyle = {
612
+ const playBtnSize = "clamp(44px, 8vmin, 80px)";
613
+ const iconBtnSize = "clamp(28px, 4.5vmin, 40px)";
614
+ const iconSvgSize = "clamp(14px, 2.5vmin, 20px)";
615
+ const playIconSize = "clamp(24px, 4.5vmin, 44px)";
616
+ const iconButtonStyle = {
733
617
  pointerEvents: isControlsVisible ? "auto" : "none",
734
- width: 30,
735
- height: 30,
618
+ width: iconBtnSize,
619
+ height: iconBtnSize,
736
620
  borderRadius: "50%",
737
621
  border: "1.5px solid rgba(255,255,255,0.18)",
738
622
  cursor: "pointer",
739
623
  display: "flex",
740
624
  alignItems: "center",
741
625
  justifyContent: "center",
742
- // background: "#F31F49",
743
- // background: "linear-gradient(50deg,rgba(243, 31, 73, 1) 0%, rgba(143, 38, 237, 1) 100%)",
744
- // background: "rgba(0, 0, 0, 0.45)",
745
- // backdropFilter: "blur(10px)",
746
- // WebkitBackdropFilter: "blur(10px)",
747
- // boxShadow: "0 4px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.1)",
748
- transition: "transform 0.18s ease, background 0.18s ease, border-color 0.18s ease"
626
+ background: "rgba(0, 0, 0, 0.45)",
627
+ backdropFilter: "blur(10px)",
628
+ WebkitBackdropFilter: "blur(10px)",
629
+ boxShadow: "0 4px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.1)",
630
+ transition: "transform 0.18s ease",
631
+ flexShrink: 0
749
632
  };
750
633
  if (resolvedSources.length === 0) return null;
751
634
  const showMuteButton = !showControls && !isPlayOnHover;
@@ -825,15 +708,60 @@ var init_HlsPlayer = __esm({
825
708
  handlePlayPause();
826
709
  },
827
710
  style: {
828
- ...overlayButtonStyle,
829
- width: 64,
830
- height: 64,
831
- background: "linear-gradient(50deg, rgba(243, 31, 73, 1) 0%, rgba(143, 38, 237, 1) 100%)"
711
+ pointerEvents: isControlsVisible ? "auto" : "none",
712
+ width: playBtnSize,
713
+ height: playBtnSize,
714
+ borderRadius: "50%",
715
+ border: "none",
716
+ cursor: "pointer",
717
+ display: "flex",
718
+ alignItems: "center",
719
+ justifyContent: "center",
720
+ background: "linear-gradient(50deg, rgba(243, 31, 73, 1) 0%, rgba(143, 38, 237, 1) 100%)",
721
+ flexShrink: 0
722
+ // No box-shadow, no transition on background — clean gradient, no hover state.
832
723
  },
833
- children: isPlaying ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
834
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("rect", { x: "3.5", y: "2.5", width: "4.5", height: "15", rx: "1.5", fill: "white" }),
835
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("rect", { x: "12", y: "2.5", width: "4.5", height: "15", rx: "1.5", fill: "white" })
836
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", style: { transform: "translateX(2px)" }, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("path", { d: "M5 3.5L17 10L5 16.5V3.5Z", fill: "white" }) })
724
+ children: isPlaying ? (
725
+ /* Pause two rounded bars, sized to match play icon proportions */
726
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
727
+ "svg",
728
+ {
729
+ width: playIconSize,
730
+ height: playIconSize,
731
+ viewBox: "0 0 20 20",
732
+ fill: "none",
733
+ xmlns: "http://www.w3.org/2000/svg",
734
+ children: [
735
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("rect", { x: "3.5", y: "2.5", width: "4.5", height: "15", rx: "1.5", fill: "white" }),
736
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("rect", { x: "12", y: "2.5", width: "4.5", height: "15", rx: "1.5", fill: "white" })
737
+ ]
738
+ }
739
+ )
740
+ ) : (
741
+ /*
742
+ * Play — rounded-corner triangle from the provided SVG path.
743
+ * Original viewBox is "0,0,240,250" (with a 5.33x scale group inside).
744
+ * We flatten the transform: effective drawing area is 240×250 units.
745
+ */
746
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
747
+ "svg",
748
+ {
749
+ width: playIconSize,
750
+ height: playIconSize,
751
+ viewBox: "0 0 240 250",
752
+ fill: "none",
753
+ xmlns: "http://www.w3.org/2000/svg",
754
+ style: { transform: "translateX(4%)" },
755
+ children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
756
+ "path",
757
+ {
758
+ d: "M60.78 21.93C48.57 22.41 37.33 32.78 37.33 45.87v164.26c0 17.92 19.96 29.67 35.64 20.99l148.31-82.17c16.12-8.93 16.12-33.04 0-41.97L72.97 24.81c-3.92-2.17-8.11-3.07-12.19-2.88z",
759
+ fill: "white"
760
+ }
761
+ )
762
+ }
763
+ )
764
+ )
837
765
  }
838
766
  )
839
767
  }
@@ -859,12 +787,12 @@ var init_HlsPlayer = __esm({
859
787
  e.stopPropagation();
860
788
  handleMuteToggle();
861
789
  },
862
- style: overlayButtonStyle,
863
- children: isMuted ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
790
+ style: iconButtonStyle,
791
+ children: isMuted ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("svg", { width: iconSvgSize, height: iconSvgSize, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
864
792
  /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("path", { d: "M11 5L6 9H2v6h4l5 4V5Z", fill: "white" }),
865
793
  /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("line", { x1: "23", y1: "9", x2: "17", y2: "15", stroke: "white", strokeWidth: "2", strokeLinecap: "round" }),
866
794
  /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("line", { x1: "17", y1: "9", x2: "23", y2: "15", stroke: "white", strokeWidth: "2", strokeLinecap: "round" })
867
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
795
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("svg", { width: iconSvgSize, height: iconSvgSize, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
868
796
  /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("path", { d: "M11 5L6 9H2v6h4l5 4V5Z", fill: "white" }),
869
797
  /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07", stroke: "white", strokeWidth: "2", strokeLinecap: "round" }),
870
798
  /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("path", { d: "M19.07 4.93a10 10 0 0 1 0 14.14", stroke: "white", strokeWidth: "2", strokeLinecap: "round" })
@@ -880,14 +808,8 @@ var init_HlsPlayer = __esm({
880
808
  e.stopPropagation();
881
809
  handleFullscreenToggle();
882
810
  },
883
- style: overlayButtonStyle,
884
- children: isFullscreen ? (
885
- /* Compress / exit icon — two inward-pointing arrows */
886
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("path", { d: "M8 3v5H3M21 8h-5V3M3 16h5v5M16 21v-5h5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
887
- ) : (
888
- /* Expand icon — four outward-pointing arrows */
889
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("path", { d: "M3 8V3h5M16 3h5v5M21 16v5h-5M8 21H3v-5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
890
- )
811
+ style: iconButtonStyle,
812
+ children: isFullscreen ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("svg", { width: iconSvgSize, height: iconSvgSize, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("path", { d: "M8 3v5H3M21 8h-5V3M3 16h5v5M16 21v-5h5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("svg", { width: iconSvgSize, height: iconSvgSize, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("path", { d: "M3 8V3h5M16 3h5v5M21 16v5h-5M8 21H3v-5", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
891
813
  }
892
814
  )
893
815
  ]
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  HlsPlayer_default
3
- } from "./chunk-CT5SLXYT.mjs";
3
+ } from "./chunk-EX7D6KBZ.mjs";
4
4
  import {
5
5
  Button_default,
6
6
  ClientButton_default,
@@ -44,7 +44,7 @@ var NumberView_default = NumberView;
44
44
 
45
45
  // src/components/controls/view/DateView.tsx
46
46
  import dynamic from "next/dynamic";
47
- var DateView = dynamic(() => import("./DateViewClient-UCGTXQNC.mjs"), {
47
+ var DateView = dynamic(() => import("./DateViewClient-Y4J3UH4R.mjs"), {
48
48
  ssr: false
49
49
  });
50
50
  var DateView_default = DateView;
@@ -1963,7 +1963,7 @@ var DeviceAssetSelector_default = DeviceAssetSelector;
1963
1963
 
1964
1964
  // src/components/pageRenderingEngine/nodes/ImageNode.tsx
1965
1965
  import { Fragment as Fragment2, jsx as jsx37 } from "react/jsx-runtime";
1966
- var HlsPlayer = dynamic2(() => import("./HlsPlayer-HWWCUCH6.mjs"), {
1966
+ var HlsPlayer = dynamic2(() => import("./HlsPlayer-YWNL6PVB.mjs"), {
1967
1967
  ssr: false
1968
1968
  });
1969
1969
  var getNestedValue = (obj, path) => {
@@ -3645,7 +3645,7 @@ var Pagination_default = Pagination;
3645
3645
  // src/components/pageRenderingEngine/nodes/ImageGalleryNode.tsx
3646
3646
  import dynamic6 from "next/dynamic";
3647
3647
  import { Fragment as Fragment8, jsx as jsx56, jsxs as jsxs31 } from "react/jsx-runtime";
3648
- var HlsPlayer2 = dynamic6(() => import("./HlsPlayer-HWWCUCH6.mjs"), { ssr: false });
3648
+ var HlsPlayer2 = dynamic6(() => import("./HlsPlayer-YWNL6PVB.mjs"), { ssr: false });
3649
3649
  var deviceToMediaQuery = (device) => {
3650
3650
  switch (device) {
3651
3651
  case "sm":
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.20260505044510",
3
+ "version": "0.8.1-dev.20260505112744",
4
4
  "description": "Reusable React components",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -1,231 +0,0 @@
1
- "use client";
2
-
3
- // src/components/controls/view/DateViewClient.tsx
4
- import React, { useState, useEffect } from "react";
5
-
6
- // src/components/controls/view/TimeZoneAbbrevations.tsx
7
- var timeZoneAbbreviations = {
8
- "Asia/Calcutta": "IST",
9
- "Asia/Kolkata": "IST",
10
- "America/New_York": "EST",
11
- "America/Los_Angeles": "PST",
12
- "Europe/London": "GMT",
13
- "Europe/Paris": "CET",
14
- "Asia/Tokyo": "JST",
15
- "America/Chicago": "CST",
16
- "America/Denver": "MST",
17
- "Asia/Shanghai": "CST",
18
- "Asia/Hong_Kong": "HKT",
19
- "Australia/Sydney": "AEST",
20
- "Australia/Melbourne": "AEST",
21
- "Australia/Perth": "AWST",
22
- "Pacific/Auckland": "NZST",
23
- "Europe/Berlin": "CET",
24
- "Europe/Madrid": "CET",
25
- "Europe/Rome": "CET",
26
- "Europe/Athens": "EET",
27
- "Europe/Istanbul": "TRT",
28
- "Africa/Cairo": "EET",
29
- "Africa/Johannesburg": "SAST",
30
- "Asia/Dubai": "GST",
31
- "Asia/Singapore": "SGT",
32
- "Asia/Seoul": "KST",
33
- "America/Toronto": "EST",
34
- "America/Vancouver": "PST",
35
- "America/Sao_Paulo": "BRT",
36
- "America/Mexico_City": "CST",
37
- "Asia/Manila": "PHT",
38
- "Asia/Jakarta": "WIB",
39
- "Asia/Bangkok": "ICT",
40
- "Asia/Karachi": "PKT",
41
- "Asia/Tehran": "IRST",
42
- "Asia/Baghdad": "AST",
43
- "Europe/Moscow": "MSK",
44
- "Europe/Amsterdam": "CET",
45
- "Europe/Brussels": "CET",
46
- "Europe/Zurich": "CET",
47
- "America/Anchorage": "AKST",
48
- "Pacific/Honolulu": "HST",
49
- "Antarctica/McMurdo": "NZST",
50
- "Atlantic/Reykjavik": "GMT",
51
- "Asia/Riyadh": "AST",
52
- "America/Argentina/Buenos_Aires": "ART",
53
- "America/Bogota": "COT",
54
- "Africa/Nairobi": "EAT",
55
- "Asia/Kuala_Lumpur": "MYT",
56
- "Asia/Ho_Chi_Minh": "ICT",
57
- "Europe/Warsaw": "CET",
58
- "Europe/Prague": "CET",
59
- "America/Phoenix": "MST",
60
- "America/Indianapolis": "EST",
61
- "Pacific/Fiji": "FJT",
62
- "Asia/Colombo": "IST",
63
- "Africa/Lagos": "WAT",
64
- "America/Caracas": "VET",
65
- "America/Halifax": "AST",
66
- "Pacific/Tahiti": "TAHT",
67
- "America/St_Johns": "NST",
68
- "Europe/Bucharest": "EET",
69
- "Europe/Helsinki": "EET",
70
- "Europe/Kiev": "EET",
71
- "Europe/Oslo": "CET",
72
- "Europe/Stockholm": "CET",
73
- "Europe/Lisbon": "WET",
74
- "Asia/Beirut": "EET",
75
- "Asia/Damascus": "EET",
76
- "Asia/Jerusalem": "IST",
77
- "Asia/Amman": "EET",
78
- "America/Santiago": "CLT",
79
- "America/Lima": "PET",
80
- "America/Montevideo": "UYT",
81
- "Asia/Tashkent": "UZT",
82
- "Asia/Yerevan": "AMT",
83
- "Asia/Baku": "AZT",
84
- "Europe/Vilnius": "EET",
85
- "Europe/Riga": "EET",
86
- "Europe/Tallinn": "EET",
87
- "Europe/Sofia": "EET",
88
- "Africa/Casablanca": "WET",
89
- "America/Guatemala": "CST",
90
- "America/Panama": "EST",
91
- "America/Costa_Rica": "CST",
92
- "Pacific/Port_Moresby": "PGT",
93
- "Asia/Makassar": "WITA",
94
- "Asia/Vladivostok": "VLAT",
95
- "Asia/Krasnoyarsk": "KRAT",
96
- "Asia/Novosibirsk": "NOVT",
97
- "Asia/Yakutsk": "YAKT",
98
- "Asia/Sakhalin": "SAKT",
99
- "Asia/Ulaanbaatar": "ULAT",
100
- "Asia/Choibalsan": "CHOT",
101
- "Asia/Omsk": "OMST",
102
- "Asia/Kamchatka": "PETT",
103
- "Pacific/Pago_Pago": "SST",
104
- "Pacific/Guam": "ChST",
105
- "Pacific/Saipan": "ChST",
106
- "Pacific/Palau": "PWT",
107
- "Pacific/Efate": "VUT",
108
- "Pacific/Kosrae": "KOST",
109
- "Pacific/Nauru": "NRT",
110
- "Pacific/Tarawa": "GILT",
111
- "Pacific/Enderbury": "PHOT",
112
- "Pacific/Fakaofo": "TKT",
113
- "Pacific/Chatham": "CHAST",
114
- "Pacific/Tongatapu": "TOT",
115
- "Pacific/Funafuti": "TVT",
116
- "Pacific/Majuro": "MHT",
117
- "Pacific/Kwajalein": "MHT",
118
- "Pacific/Wake": "WAKT",
119
- "Pacific/Wallis": "WFT"
120
- };
121
-
122
- // src/components/controls/view/DateViewClient.tsx
123
- import { jsx, jsxs } from "react/jsx-runtime";
124
- var DateViewClient = (props) => {
125
- const [offsetMilliseconds, setOffsetMilliseconds] = useState(0);
126
- const [timeZoneAbbr, setTimeZoneAbbr] = useState("");
127
- useEffect(() => {
128
- const now = /* @__PURE__ */ new Date();
129
- const offsetMinutes = now.getTimezoneOffset();
130
- setOffsetMilliseconds(offsetMinutes * 60 * 1e3);
131
- setTimeZoneAbbr(
132
- now.toLocaleTimeString("en", { timeZoneName: "short" }).split(" ")[2]
133
- );
134
- }, []);
135
- const toUtcDate = (dateString) => {
136
- const s = dateString.trim();
137
- const iso = s.replace(" ", "T");
138
- const utc = iso.endsWith("Z") || iso.includes("+") ? iso : iso + "Z";
139
- return new Date(utc);
140
- };
141
- const toLocalDate = (utcDate) => {
142
- return new Date(utcDate.getTime() - offsetMilliseconds);
143
- };
144
- const getRelativeTime = (dateString) => {
145
- const now = /* @__PURE__ */ new Date();
146
- const utcDate = toUtcDate(dateString);
147
- const diffMs = now.getTime() - utcDate.getTime();
148
- const diffSec = Math.floor(diffMs / 1e3);
149
- const diffMin = Math.floor(diffSec / 60);
150
- const diffHr = Math.floor(diffMin / 60);
151
- const diffDay = Math.floor(diffHr / 24);
152
- if (diffSec < 60) return "Just now";
153
- if (diffMin < 60) return `${diffMin} minute${diffMin > 1 ? "s" : ""} ago`;
154
- if (diffHr < 24) return `${diffHr} hour${diffHr > 1 ? "s" : ""} ago`;
155
- if (diffDay < 7) return `${diffDay} day${diffDay > 1 ? "s" : ""} ago`;
156
- return new Intl.DateTimeFormat("en", {
157
- day: "2-digit",
158
- month: "short",
159
- year: "numeric"
160
- }).format(toLocalDate(utcDate));
161
- };
162
- const parseAndFormatDate = (dateString, format) => {
163
- if (format === "relative") {
164
- return getRelativeTime(dateString);
165
- }
166
- const utcDate = toUtcDate(dateString);
167
- const localDate = toLocalDate(utcDate);
168
- switch (props.controlType) {
169
- case "date":
170
- return new Intl.DateTimeFormat("en", {
171
- day: "2-digit",
172
- month: "short",
173
- year: "numeric"
174
- }).format(localDate);
175
- case "time":
176
- return `${formatTime(localDate)} ${timeZoneAbbr} (${getTimePeriod(localDate)})`;
177
- default:
178
- return utcDate.getSeconds() === 0 ? new Intl.DateTimeFormat("en", {
179
- day: "2-digit",
180
- month: "short",
181
- year: "numeric",
182
- hour: "2-digit",
183
- minute: "2-digit"
184
- }).format(localDate) : new Intl.DateTimeFormat("en", {
185
- day: "2-digit",
186
- month: "short",
187
- year: "numeric",
188
- hour: "2-digit",
189
- minute: "2-digit",
190
- second: "2-digit"
191
- }).format(localDate);
192
- }
193
- };
194
- const formatTime = (localDate) => {
195
- return localDate.getSeconds() === 0 ? new Intl.DateTimeFormat("en", {
196
- hour: "2-digit",
197
- minute: "2-digit"
198
- }).format(localDate) : new Intl.DateTimeFormat("en", {
199
- hour: "2-digit",
200
- minute: "2-digit",
201
- second: "2-digit"
202
- }).format(localDate);
203
- };
204
- const getTimePeriod = (localDate) => {
205
- const hours = localDate.getHours();
206
- if (hours >= 5 && hours < 8) return "Early Morning";
207
- if (hours >= 8 && hours < 12) return "Morning";
208
- if (hours >= 12 && hours < 14) return "Noon";
209
- if (hours >= 14 && hours < 17) return "Afternoon";
210
- if (hours >= 17 && hours < 20) return "Evening";
211
- if (hours >= 20 && hours < 22) return "Late Evening";
212
- return "Night";
213
- };
214
- const getTimeZoneAbbreviation = (timeZone) => {
215
- return timeZoneAbbreviations[timeZone] || timeZone;
216
- };
217
- let localDateTime = "";
218
- try {
219
- localDateTime = parseAndFormatDate(props.value, props.format);
220
- } catch (error) {
221
- console.error("Error parsing date:", props.value, error);
222
- }
223
- return /* @__PURE__ */ jsx(React.Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "inline-flex flex-wrap gap-1", children: [
224
- /* @__PURE__ */ jsx("span", { children: localDateTime }),
225
- !props.format && props.controlType != "date" && /* @__PURE__ */ jsx("span", { children: timeZoneAbbr })
226
- ] }) });
227
- };
228
- var DateViewClient_default = DateViewClient;
229
- export {
230
- DateViewClient_default as default
231
- };